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.

workflow.approval.delegate

Delegate an approval request to another user.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.workflow-system
  • Tags: workflow, approval, delegate
  • File: packages/examples/workflow-system/src/approval/approval.operations.ts
  • field.key.label
    workflow.approval.delegate
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    workflow.approval.delegate
    field.description.label

    Delegate an approval request to another user.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.workflow-system
  • Tags: workflow, approval, delegate
  • File: packages/examples/workflow-system/src/approval/approval.operations.ts
  • field.tags.label
    workflow,approval,delegate
    field.owners.label
    @example.workflow-system
    field.stability.label
    stable

    Delegate an approval request to another user.

    Goal

    Allow approvers to pass approval to others.

    Context

    Approval inbox.

    Emitted Events

    `workflow.approval.delegated` (v1.0.0)

    Source Definition

    import {
    	defineCommand,
    	defineQuery,
    } from '@lssm-tech/lib.contracts-spec/operations';
    import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
    import { ApprovalDecisionEnum, ApprovalStatusEnum } from './approval.enum';
    import { ApprovalCommentModel, ApprovalRequestModel } from './approval.schema';
    
    export const DelegateApprovalContract = defineCommand({
    	meta: {
    		key: 'workflow.approval.delegate',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@example.workflow-system'],
    		tags: ['workflow', 'approval', 'delegate'],
    		description: 'Delegate an approval request to another user.',
    		goal: 'Allow approvers to pass approval to others.',
    		context: 'Approval inbox.',
    	},
    	io: {
    		input: defineSchemaModel({
    			name: 'DelegateInput',
    			fields: {
    				requestId: {
    					type: ScalarTypeEnum.String_unsecure(),
    					isOptional: false,
    				},
    				delegateTo: {
    					type: ScalarTypeEnum.String_unsecure(),
    					isOptional: false,
    				},
    				reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
    			},
    		}),
    		output: ApprovalRequestModel,
    	},
    	policy: { auth: 'user' },
    	sideEffects: {
    		emits: [
    			{
    				key: 'workflow.approval.delegated',
    				version: '1.0.0',
    				when: 'Approval is delegated',
    				payload: ApprovalRequestModel,
    			},
    		],
    		audit: ['workflow.approval.delegated'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'delegate-approval-happy-path',
    				given: ['Approval request is pending', 'User is assignee'],
    				when: ['User delegates to another user'],
    				then: ['Assignee is updated', 'ApprovalDelegated event is emitted'],
    			},
    		],
    		examples: [
    			{
    				key: 'delegate-to-manager',
    				input: {
    					requestId: 'req-123',
    					delegateTo: 'user-456',
    					reason: 'Out of office',
    				},
    				output: { id: 'req-123', assigneeId: 'user-456' },
    			},
    		],
    	},
    });