OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

crm.deal.win

Mark a deal as won.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.crm-pipeline
  • Tags: crm, deal, won
  • File: packages/examples/crm-pipeline/src/deal/deal.operation.ts
  • field.key.label
    crm.deal.win
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    crm.deal.win
    field.description.label

    Mark a deal as won.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.crm-pipeline
  • Tags: crm, deal, won
  • File: packages/examples/crm-pipeline/src/deal/deal.operation.ts
  • field.tags.label
    crm,deal,won
    field.owners.label
    @example.crm-pipeline
    field.stability.label
    stable

    Mark a deal as won.

    Goal

    Close a deal as successful.

    Context

    Deal closing flow.

    Emitted Events

    `deal.won` (v1.0.0)

    Source Definition

    import {
    	defineCommand,
    	defineQuery,
    } from '@lssm-tech/lib.contracts-spec/operations';
    import {
    	CreateDealInputModel,
    	DealLostPayloadModel,
    	DealModel,
    	DealMovedPayloadModel,
    	DealWonPayloadModel,
    	ListDealsInputModel,
    	ListDealsOutputModel,
    	LoseDealInputModel,
    	MoveDealInputModel,
    	WinDealInputModel,
    } from './deal.schema';
    
    export const WinDealContract = defineCommand({
    	meta: {
    		key: 'crm.deal.win',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@example.crm-pipeline'],
    		tags: ['crm', 'deal', 'won'],
    		description: 'Mark a deal as won.',
    		goal: 'Close a deal as successful.',
    		context: 'Deal closing flow.',
    	},
    	io: {
    		input: WinDealInputModel,
    		output: DealModel,
    	},
    	policy: {
    		auth: 'user',
    	},
    	sideEffects: {
    		emits: [
    			{
    				key: 'deal.won',
    				version: '1.0.0',
    				when: 'Deal is won',
    				payload: DealWonPayloadModel,
    			},
    		],
    		audit: ['deal.won'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'win-deal-happy-path',
    				given: ['Deal is open'],
    				when: ['User marks deal as won'],
    				then: ['Deal status becomes WON', 'DealWon event is emitted'],
    			},
    		],
    		examples: [
    			{
    				key: 'mark-won',
    				input: {
    					dealId: 'deal-789',
    					actualValue: 52000,
    					note: 'Signed contract attached',
    				},
    				output: {
    					id: 'deal-789',
    					status: 'won',
    					closedAt: '2025-01-20T14:30:00Z',
    				},
    			},
    		],
    	},
    });