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.create

Create a new deal in the pipeline.

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

    Create a new deal in the pipeline.

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

    Create a new deal in the pipeline.

    Goal

    Allow sales reps to create new opportunities.

    Context

    Deal creation UI, quick add.

    Emitted Events

    `deal.created` (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 CreateDealContract = defineCommand({
    	meta: {
    		key: 'crm.deal.create',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@example.crm-pipeline'],
    		tags: ['crm', 'deal', 'create'],
    		description: 'Create a new deal in the pipeline.',
    		goal: 'Allow sales reps to create new opportunities.',
    		context: 'Deal creation UI, quick add.',
    	},
    	io: {
    		input: CreateDealInputModel,
    		output: DealModel,
    	},
    	policy: {
    		auth: 'user',
    	},
    	sideEffects: {
    		emits: [
    			{
    				key: 'deal.created',
    				version: '1.0.0',
    				when: 'Deal is created',
    				payload: DealModel,
    			},
    		],
    		audit: ['deal.created'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'create-deal-happy-path',
    				given: ['User is authenticated'],
    				when: ['User creates a deal with valid data'],
    				then: ['Deal is created', 'DealCreated event is emitted'],
    			},
    		],
    		examples: [
    			{
    				key: 'create-basic-deal',
    				input: {
    					title: 'Big Corp Q3 License',
    					stageId: 'stage-lead',
    					value: 50000,
    					companyId: 'comp-123',
    				},
    				output: {
    					id: 'deal-789',
    					title: 'Big Corp Q3 License',
    					status: 'open',
    				},
    			},
    		],
    	},
    });