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.

marketplace.order.create

Create a new order.

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

    Create a new order.

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

    Create a new order.

    Goal

    Allow buyers to purchase products.

    Context

    Checkout flow.

    Emitted Events

    `marketplace.order.created` (v1.0.0)

    Source Definition

    import { defineCommand } from '@lssm-tech/lib.contracts-spec/operations';
    import {
    	CreateOrderInputModel,
    	OrderModel,
    	UpdateOrderStatusInputModel,
    } from './order.schema';
    
    export const CreateOrderContract = defineCommand({
    	meta: {
    		key: 'marketplace.order.create',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@example.marketplace'],
    		tags: ['marketplace', 'order', 'create'],
    		description: 'Create a new order.',
    		goal: 'Allow buyers to purchase products.',
    		context: 'Checkout flow.',
    	},
    	io: { input: CreateOrderInputModel, output: OrderModel },
    	policy: { auth: 'user' },
    	sideEffects: {
    		emits: [
    			{
    				key: 'marketplace.order.created',
    				version: '1.0.0',
    				when: 'Order is created',
    				payload: OrderModel,
    			},
    		],
    		audit: ['marketplace.order.created'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'create-order-happy-path',
    				given: ['User is authenticated'],
    				when: ['User creates order with valid items'],
    				then: ['Order is created', 'OrderCreated event is emitted'],
    			},
    		],
    		examples: [
    			{
    				key: 'create-basic-order',
    				input: {
    					storeId: 'store-123',
    					items: [{ productId: 'prod-456', quantity: 1, unitPrice: 100 }],
    				},
    				output: { id: 'order-789', status: 'pending', total: 100 },
    			},
    		],
    	},
    });