@contractspec/example.workflow-system 1.44.1 → 1.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/approval/approval.enum.d.ts +3 -3
  2. package/dist/approval/approval.enum.d.ts.map +1 -1
  3. package/dist/approval/approval.event.d.ts +31 -31
  4. package/dist/approval/approval.event.js +4 -4
  5. package/dist/approval/approval.event.js.map +1 -1
  6. package/dist/approval/approval.operations.d.ts +136 -136
  7. package/dist/approval/approval.operations.js +8 -8
  8. package/dist/approval/approval.operations.js.map +1 -1
  9. package/dist/approval/approval.schema.d.ts +24 -24
  10. package/dist/entities/approval.d.ts +36 -36
  11. package/dist/entities/approval.d.ts.map +1 -1
  12. package/dist/entities/index.d.ts +127 -127
  13. package/dist/entities/index.d.ts.map +1 -1
  14. package/dist/entities/instance.d.ts +47 -47
  15. package/dist/entities/step.d.ts +32 -32
  16. package/dist/entities/workflow.d.ts +23 -23
  17. package/dist/entities/workflow.d.ts.map +1 -1
  18. package/dist/example.d.ts +3 -36
  19. package/dist/example.d.ts.map +1 -1
  20. package/dist/example.js +16 -11
  21. package/dist/example.js.map +1 -1
  22. package/dist/instance/instance.enum.d.ts +2 -2
  23. package/dist/instance/instance.event.d.ts +87 -87
  24. package/dist/instance/instance.event.d.ts.map +1 -1
  25. package/dist/instance/instance.event.js +9 -9
  26. package/dist/instance/instance.event.js.map +1 -1
  27. package/dist/instance/instance.operations.d.ts +261 -261
  28. package/dist/instance/instance.operations.d.ts.map +1 -1
  29. package/dist/instance/instance.operations.js +15 -15
  30. package/dist/instance/instance.operations.js.map +1 -1
  31. package/dist/instance/instance.schema.d.ts +54 -54
  32. package/dist/presentations/index.js +11 -11
  33. package/dist/presentations/index.js.map +1 -1
  34. package/dist/shared/types.d.ts +1 -1
  35. package/dist/state-machine/index.d.ts +2 -2
  36. package/dist/state-machine/index.js.map +1 -1
  37. package/dist/workflow/workflow.enum.d.ts +5 -5
  38. package/dist/workflow/workflow.event.d.ts +33 -33
  39. package/dist/workflow/workflow.event.d.ts.map +1 -1
  40. package/dist/workflow/workflow.event.js +5 -5
  41. package/dist/workflow/workflow.event.js.map +1 -1
  42. package/dist/workflow/workflow.handler.js +1 -1
  43. package/dist/workflow/workflow.handler.js.map +1 -1
  44. package/dist/workflow/workflow.operations.d.ts +250 -250
  45. package/dist/workflow/workflow.operations.js +10 -10
  46. package/dist/workflow/workflow.operations.js.map +1 -1
  47. package/dist/workflow/workflow.schema.d.ts +63 -63
  48. package/dist/workflow/workflow.schema.d.ts.map +1 -1
  49. package/dist/workflow/workflow.schema.js +1 -1
  50. package/dist/workflow/workflow.schema.js.map +1 -1
  51. package/dist/workflow-system.feature.js +71 -71
  52. package/dist/workflow-system.feature.js.map +1 -1
  53. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["WorkflowDesignerPresentation: PresentationSpec","WorkflowListPresentation: PresentationSpec","WorkflowDetailPresentation: PresentationSpec","InstanceListPresentation: PresentationSpec","InstanceDetailPresentation: PresentationSpec","ProgressTrackerPresentation: PresentationSpec","ApprovalInboxPresentation: PresentationSpec","ApprovalDetailPresentation: PresentationSpec","ApprovalFormPresentation: PresentationSpec","PendingApprovalsBadgePresentation: PresentationSpec","WorkflowMetricsPresentation: PresentationSpec"],"sources":["../../src/presentations/index.ts"],"sourcesContent":["/**\n * Workflow System Presentation Descriptors\n */\nimport type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { WorkflowDefinitionModel } from '../workflow/workflow.schema';\nimport { WorkflowInstanceModel } from '../instance/instance.schema';\nimport { ApprovalRequestModel } from '../approval/approval.schema';\n\n// ============ Workflow Definition Presentations ============\n\n/**\n * Workflow designer canvas for building workflows.\n */\nexport const WorkflowDesignerPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.designer',\n version: 1,\n title: 'Workflow Designer',\n description: 'Visual workflow designer with drag-and-drop steps',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'designer', 'admin'],\n stability: StabilityEnum.Experimental,\n goal: 'Building and modifying workflow definitions',\n context: 'Workflow administration and setup',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowDesigner',\n props: WorkflowDefinitionModel,\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.designer.enabled'],\n },\n};\n\n/**\n * List of workflow definitions.\n */\nexport const WorkflowListPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.definition.list',\n version: 1,\n title: 'Workflow List',\n description: 'List of workflow definitions with status and actions',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'list', 'admin'],\n stability: StabilityEnum.Experimental,\n goal: 'Overview of all defined workflows',\n context: 'Workflow management dashboard',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowDefinitionList',\n props: WorkflowDefinitionModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n/**\n * Workflow definition detail view.\n */\nexport const WorkflowDetailPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.definition.detail',\n version: 1,\n title: 'Workflow Details',\n description: 'Detailed view of a workflow definition with steps',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Viewing technical details of a workflow definition',\n context: 'Workflow inspection and debugging',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowDefinitionDetail',\n props: WorkflowDefinitionModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n// ============ Workflow Instance Presentations ============\n\n/**\n * List of running workflow instances.\n */\nexport const InstanceListPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.instance.list',\n version: 1,\n title: 'Instance List',\n description: 'List of workflow instances with status and progress',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'instance', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Monitoring active and past workflow executions',\n context: 'Operations monitoring',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowInstanceList',\n props: WorkflowInstanceModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n/**\n * Workflow instance detail view with timeline.\n */\nexport const InstanceDetailPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.instance.detail',\n version: 1,\n title: 'Instance Details',\n description: 'Detailed view of a workflow instance with step timeline',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'instance', 'detail', 'timeline'],\n stability: StabilityEnum.Experimental,\n goal: 'Detailed inspection of a specific workflow instance',\n context: 'Case management and troubleshooting',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowInstanceDetail',\n props: WorkflowInstanceModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n/**\n * Workflow progress tracker widget.\n */\nexport const ProgressTrackerPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.instance.progress',\n version: 1,\n title: 'Progress Tracker',\n description: 'Visual progress tracker showing current step in workflow',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'progress', 'widget'],\n stability: StabilityEnum.Experimental,\n goal: 'Quick view of current progress for a workflow',\n context: 'Embedded progress indicator in entity views',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowProgressTracker',\n props: WorkflowInstanceModel,\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n// ============ Approval Presentations ============\n\n/**\n * Approval inbox - list of pending approvals.\n */\nexport const ApprovalInboxPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.inbox',\n version: 1,\n title: 'Approval Inbox',\n description: 'Inbox showing pending approval requests for current user',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'inbox'],\n stability: StabilityEnum.Experimental,\n goal: 'Managing personal workload of approval requests',\n context: 'Personal task management',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ApprovalInbox',\n props: ApprovalRequestModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n/**\n * Approval request detail view.\n */\nexport const ApprovalDetailPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.detail',\n version: 1,\n title: 'Approval Details',\n description: 'Detailed approval request view with context and actions',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Decision support for an approval request',\n context: 'Specific approval action',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ApprovalRequestDetail',\n props: ApprovalRequestModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n/**\n * Approval decision form.\n */\nexport const ApprovalFormPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.form',\n version: 1,\n title: 'Approval Form',\n description: 'Form for submitting approval decisions',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'form'],\n stability: StabilityEnum.Experimental,\n goal: 'Submitting a decision on an approval request',\n context: 'Approval decision dialog',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ApprovalDecisionForm',\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n// ============ Dashboard Widgets ============\n\n/**\n * Pending approvals count badge.\n */\nexport const PendingApprovalsBadgePresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.badge',\n version: 1,\n title: 'Pending Approvals Badge',\n description: 'Badge showing count of pending approvals',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'badge', 'widget'],\n stability: StabilityEnum.Experimental,\n goal: 'Visual notification of pending approvals',\n context: 'Global navigation or sidebar',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'PendingApprovalsBadge',\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n/**\n * Workflow metrics dashboard widget.\n */\nexport const WorkflowMetricsPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.metrics',\n version: 1,\n title: 'Workflow Metrics',\n description: 'Dashboard widget showing workflow metrics and statistics',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'metrics', 'dashboard'],\n stability: StabilityEnum.Experimental,\n goal: 'Monitoring throughput and bottlenecks',\n context: 'System performance dashboard',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowMetricsDashboard',\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.metrics.enabled'],\n },\n};\n\n// ============ All Presentations ============\n\nexport const WorkflowSystemPresentations = {\n // Definition\n WorkflowDesignerPresentation,\n WorkflowListPresentation,\n WorkflowDetailPresentation,\n\n // Instance\n InstanceListPresentation,\n InstanceDetailPresentation,\n ProgressTrackerPresentation,\n\n // Approval\n ApprovalInboxPresentation,\n ApprovalDetailPresentation,\n ApprovalFormPresentation,\n PendingApprovalsBadgePresentation,\n\n // Dashboard\n WorkflowMetricsPresentation,\n};\n"],"mappings":";;;;;;;;;AAcA,MAAaA,+BAAiD;CAC5D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAQ;EACvC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,4BAA4B,EACrC;CACF;;;;AAKD,MAAaC,2BAA6C;CACxD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EAC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;GAAO;EACtC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF;;;;AAOD,MAAaC,oCAAsD;CACjE,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAS;GAAS;EACjD,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF;;;;AAKD,MAAaC,8BAAgD;CAC3D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAW;GAAY;EAC1C,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,2BAA2B,EACpC;CACF;AAID,MAAa,8BAA8B;CAEzC;CACA;CACA;CAGA;CACA;CACA;CAGA;CACA;CACA;CACA;CAGA;CACD"}
1
+ {"version":3,"file":"index.js","names":["WorkflowDesignerPresentation: PresentationSpec","WorkflowListPresentation: PresentationSpec","WorkflowDetailPresentation: PresentationSpec","InstanceListPresentation: PresentationSpec","InstanceDetailPresentation: PresentationSpec","ProgressTrackerPresentation: PresentationSpec","ApprovalInboxPresentation: PresentationSpec","ApprovalDetailPresentation: PresentationSpec","ApprovalFormPresentation: PresentationSpec","PendingApprovalsBadgePresentation: PresentationSpec","WorkflowMetricsPresentation: PresentationSpec"],"sources":["../../src/presentations/index.ts"],"sourcesContent":["/**\n * Workflow System Presentation Descriptors\n */\nimport type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { WorkflowDefinitionModel } from '../workflow/workflow.schema';\nimport { WorkflowInstanceModel } from '../instance/instance.schema';\nimport { ApprovalRequestModel } from '../approval/approval.schema';\n\n// ============ Workflow Definition Presentations ============\n\n/**\n * Workflow designer canvas for building workflows.\n */\nexport const WorkflowDesignerPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.designer',\n version: '1.0.0',\n title: 'Workflow Designer',\n description: 'Visual workflow designer with drag-and-drop steps',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'designer', 'admin'],\n stability: StabilityEnum.Experimental,\n goal: 'Building and modifying workflow definitions',\n context: 'Workflow administration and setup',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowDesigner',\n props: WorkflowDefinitionModel,\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.designer.enabled'],\n },\n};\n\n/**\n * List of workflow definitions.\n */\nexport const WorkflowListPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.definition.list',\n version: '1.0.0',\n title: 'Workflow List',\n description: 'List of workflow definitions with status and actions',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'list', 'admin'],\n stability: StabilityEnum.Experimental,\n goal: 'Overview of all defined workflows',\n context: 'Workflow management dashboard',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowDefinitionList',\n props: WorkflowDefinitionModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n/**\n * Workflow definition detail view.\n */\nexport const WorkflowDetailPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.definition.detail',\n version: '1.0.0',\n title: 'Workflow Details',\n description: 'Detailed view of a workflow definition with steps',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Viewing technical details of a workflow definition',\n context: 'Workflow inspection and debugging',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowDefinitionDetail',\n props: WorkflowDefinitionModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n// ============ Workflow Instance Presentations ============\n\n/**\n * List of running workflow instances.\n */\nexport const InstanceListPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.instance.list',\n version: '1.0.0',\n title: 'Instance List',\n description: 'List of workflow instances with status and progress',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'instance', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Monitoring active and past workflow executions',\n context: 'Operations monitoring',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowInstanceList',\n props: WorkflowInstanceModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n/**\n * Workflow instance detail view with timeline.\n */\nexport const InstanceDetailPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.instance.detail',\n version: '1.0.0',\n title: 'Instance Details',\n description: 'Detailed view of a workflow instance with step timeline',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'instance', 'detail', 'timeline'],\n stability: StabilityEnum.Experimental,\n goal: 'Detailed inspection of a specific workflow instance',\n context: 'Case management and troubleshooting',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowInstanceDetail',\n props: WorkflowInstanceModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n/**\n * Workflow progress tracker widget.\n */\nexport const ProgressTrackerPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.instance.progress',\n version: '1.0.0',\n title: 'Progress Tracker',\n description: 'Visual progress tracker showing current step in workflow',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'progress', 'widget'],\n stability: StabilityEnum.Experimental,\n goal: 'Quick view of current progress for a workflow',\n context: 'Embedded progress indicator in entity views',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowProgressTracker',\n props: WorkflowInstanceModel,\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.enabled'],\n },\n};\n\n// ============ Approval Presentations ============\n\n/**\n * Approval inbox - list of pending approvals.\n */\nexport const ApprovalInboxPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.inbox',\n version: '1.0.0',\n title: 'Approval Inbox',\n description: 'Inbox showing pending approval requests for current user',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'inbox'],\n stability: StabilityEnum.Experimental,\n goal: 'Managing personal workload of approval requests',\n context: 'Personal task management',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ApprovalInbox',\n props: ApprovalRequestModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n/**\n * Approval request detail view.\n */\nexport const ApprovalDetailPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.detail',\n version: '1.0.0',\n title: 'Approval Details',\n description: 'Detailed approval request view with context and actions',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Decision support for an approval request',\n context: 'Specific approval action',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ApprovalRequestDetail',\n props: ApprovalRequestModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n/**\n * Approval decision form.\n */\nexport const ApprovalFormPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.form',\n version: '1.0.0',\n title: 'Approval Form',\n description: 'Form for submitting approval decisions',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'form'],\n stability: StabilityEnum.Experimental,\n goal: 'Submitting a decision on an approval request',\n context: 'Approval decision dialog',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ApprovalDecisionForm',\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n// ============ Dashboard Widgets ============\n\n/**\n * Pending approvals count badge.\n */\nexport const PendingApprovalsBadgePresentation: PresentationSpec = {\n meta: {\n key: 'workflow.approval.badge',\n version: '1.0.0',\n title: 'Pending Approvals Badge',\n description: 'Badge showing count of pending approvals',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'approval', 'badge', 'widget'],\n stability: StabilityEnum.Experimental,\n goal: 'Visual notification of pending approvals',\n context: 'Global navigation or sidebar',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'PendingApprovalsBadge',\n },\n targets: ['react'],\n policy: {\n flags: ['workflow.approvals.enabled'],\n },\n};\n\n/**\n * Workflow metrics dashboard widget.\n */\nexport const WorkflowMetricsPresentation: PresentationSpec = {\n meta: {\n key: 'workflow.metrics',\n version: '1.0.0',\n title: 'Workflow Metrics',\n description: 'Dashboard widget showing workflow metrics and statistics',\n domain: 'workflow-system',\n owners: ['@workflow-team'],\n tags: ['workflow', 'metrics', 'dashboard'],\n stability: StabilityEnum.Experimental,\n goal: 'Monitoring throughput and bottlenecks',\n context: 'System performance dashboard',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'WorkflowMetricsDashboard',\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['workflow.metrics.enabled'],\n },\n};\n\n// ============ All Presentations ============\n\nexport const WorkflowSystemPresentations = {\n // Definition\n WorkflowDesignerPresentation,\n WorkflowListPresentation,\n WorkflowDetailPresentation,\n\n // Instance\n InstanceListPresentation,\n InstanceDetailPresentation,\n ProgressTrackerPresentation,\n\n // Approval\n ApprovalInboxPresentation,\n ApprovalDetailPresentation,\n ApprovalFormPresentation,\n PendingApprovalsBadgePresentation,\n\n // Dashboard\n WorkflowMetricsPresentation,\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AC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,2BAA2B,EACpC;CACF;AAID,MAAa,8BAA8B;CAEzC;CACA;CACA;CAGA;CACA;CACA;CAGA;CACA;CACA;CACA;CAGA;CACD"}
@@ -7,7 +7,7 @@ interface WorkflowDefinitionRecord {
7
7
  key: string;
8
8
  name: string;
9
9
  description?: string;
10
- version: number;
10
+ version: string;
11
11
  status: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'ARCHIVED';
12
12
  triggerType: 'MANUAL' | 'EVENT' | 'SCHEDULED' | 'API';
13
13
  initialStepId?: string;
@@ -43,7 +43,7 @@ interface StateMachineStep {
43
43
  interface StateMachineDefinition {
44
44
  key: string;
45
45
  name: string;
46
- version: number;
46
+ version: string;
47
47
  initialStepKey: string;
48
48
  steps: Record<string, StateMachineStep>;
49
49
  }
@@ -127,7 +127,7 @@ declare function createStateMachineEngine(): IStateMachineEngine;
127
127
  declare function buildStateMachineDefinition(workflow: {
128
128
  key: string;
129
129
  name: string;
130
- version: number;
130
+ version: string;
131
131
  initialStepId: string | null;
132
132
  }, steps: {
133
133
  key: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["newStatus: StateMachineState['status']","stepMap: Record<string, StateMachineStep>"],"sources":["../../src/state-machine/index.ts"],"sourcesContent":["/**\n * Workflow State Machine Engine\n *\n * Provides state machine logic for workflow transitions.\n * This is a spec-level abstraction that defines the interface\n * for workflow state transitions.\n */\n\n// ============ Types ============\n\n/**\n * Represents a transition definition in a workflow step.\n */\nexport interface TransitionDefinition {\n /** The action that triggers this transition (e.g., \"approve\", \"reject\") */\n action: string;\n /** The target step key to transition to */\n targetStepKey: string;\n /** Optional condition expression for conditional transitions */\n condition?: string;\n /** Optional guard roles - only users with these roles can take this action */\n allowedRoles?: string[];\n}\n\n/**\n * Step definition for state machine.\n */\nexport interface StateMachineStep {\n key: string;\n name: string;\n type:\n | 'START'\n | 'APPROVAL'\n | 'TASK'\n | 'CONDITION'\n | 'PARALLEL'\n | 'WAIT'\n | 'ACTION'\n | 'END';\n /** Map of action -> transition definition */\n transitions: Record<string, string | TransitionDefinition>;\n /** For approval steps: how approvals are handled */\n approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';\n /** Roles that can approve/act on this step */\n allowedRoles?: string[];\n /** Timeout in seconds */\n timeoutSeconds?: number;\n /** Condition expression for CONDITION type */\n conditionExpression?: string;\n}\n\n/**\n * Workflow state machine definition.\n */\nexport interface StateMachineDefinition {\n key: string;\n name: string;\n version: number;\n initialStepKey: string;\n steps: Record<string, StateMachineStep>;\n}\n\n/**\n * Current state of an instance.\n */\nexport interface StateMachineState {\n currentStepKey: string;\n status:\n | 'PENDING'\n | 'RUNNING'\n | 'WAITING'\n | 'PAUSED'\n | 'COMPLETED'\n | 'CANCELLED'\n | 'FAILED'\n | 'TIMEOUT';\n contextData: Record<string, unknown>;\n history: {\n stepKey: string;\n action: string;\n timestamp: Date;\n executedBy: string;\n }[];\n}\n\n/**\n * Result of a transition attempt.\n */\nexport interface TransitionResult {\n success: boolean;\n previousStepKey: string;\n currentStepKey: string | null;\n status: StateMachineState['status'];\n error?: string;\n}\n\n/**\n * Context for transition validation.\n */\nexport interface TransitionContext {\n userId: string;\n userRoles: string[];\n data?: Record<string, unknown>;\n}\n\n// ============ State Machine Engine ============\n\n/**\n * State machine engine interface.\n * Implementation should be provided at runtime.\n */\nexport interface IStateMachineEngine {\n /**\n * Validate that a transition is allowed.\n */\n canTransition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): { allowed: boolean; reason?: string };\n\n /**\n * Get available actions for the current step.\n */\n getAvailableActions(\n definition: StateMachineDefinition,\n state: StateMachineState,\n context: TransitionContext\n ): string[];\n\n /**\n * Execute a transition.\n */\n transition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): TransitionResult;\n\n /**\n * Evaluate a condition expression.\n */\n evaluateCondition(\n expression: string,\n contextData: Record<string, unknown>\n ): boolean;\n}\n\n/**\n * Basic state machine engine implementation.\n * This is a reference implementation for spec validation.\n */\nexport class BasicStateMachineEngine implements IStateMachineEngine {\n canTransition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): { allowed: boolean; reason?: string } {\n // Check if state allows transitions\n if (state.status !== 'RUNNING' && state.status !== 'WAITING') {\n return {\n allowed: false,\n reason: `Workflow is ${state.status}, cannot transition`,\n };\n }\n\n const currentStep = definition.steps[state.currentStepKey];\n if (!currentStep) {\n return {\n allowed: false,\n reason: `Step ${state.currentStepKey} not found`,\n };\n }\n\n // Check if action exists for this step\n const transition = currentStep.transitions[action];\n if (!transition) {\n return {\n allowed: false,\n reason: `Action ${action} not available in step ${state.currentStepKey}`,\n };\n }\n\n // Check role-based access\n if (currentStep.allowedRoles && currentStep.allowedRoles.length > 0) {\n const hasRole = currentStep.allowedRoles.some((role) =>\n context.userRoles.includes(role)\n );\n if (!hasRole) {\n return {\n allowed: false,\n reason: `User lacks required role for this action`,\n };\n }\n }\n\n // Check transition-specific roles if defined\n if (\n typeof transition === 'object' &&\n transition.allowedRoles &&\n transition.allowedRoles.length > 0\n ) {\n const hasRole = transition.allowedRoles.some((role) =>\n context.userRoles.includes(role)\n );\n if (!hasRole) {\n return {\n allowed: false,\n reason: `User lacks required role for action ${action}`,\n };\n }\n }\n\n return { allowed: true };\n }\n\n getAvailableActions(\n definition: StateMachineDefinition,\n state: StateMachineState,\n context: TransitionContext\n ): string[] {\n if (state.status !== 'RUNNING' && state.status !== 'WAITING') {\n return [];\n }\n\n const currentStep = definition.steps[state.currentStepKey];\n if (!currentStep) {\n return [];\n }\n\n return Object.keys(currentStep.transitions).filter((action) => {\n const result = this.canTransition(definition, state, action, context);\n return result.allowed;\n });\n }\n\n transition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): TransitionResult {\n const validation = this.canTransition(definition, state, action, context);\n if (!validation.allowed) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: validation.reason,\n };\n }\n\n const currentStep = definition.steps[state.currentStepKey];\n if (!currentStep) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: `Current step ${state.currentStepKey} not found`,\n };\n }\n const transition = currentStep.transitions[action];\n if (!transition) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: `Transition for action ${action} not found`,\n };\n }\n const targetStepKey =\n typeof transition === 'string' ? transition : transition.targetStepKey;\n const targetStep = definition.steps[targetStepKey];\n\n if (!targetStep) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: `Target step ${targetStepKey} not found`,\n };\n }\n\n // Determine new status\n let newStatus: StateMachineState['status'] = 'RUNNING';\n if (targetStep.type === 'END') {\n newStatus = 'COMPLETED';\n } else if (targetStep.type === 'APPROVAL' || targetStep.type === 'WAIT') {\n newStatus = 'WAITING';\n }\n\n return {\n success: true,\n previousStepKey: state.currentStepKey,\n currentStepKey: targetStepKey,\n status: newStatus,\n };\n }\n\n evaluateCondition(\n expression: string,\n contextData: Record<string, unknown>\n ): boolean {\n // Basic condition evaluation\n // In production, this should use a proper expression language\n try {\n // Simple property checks like \"amount > 1000\"\n const match = expression.match(\n /^(\\w+)\\s*(>=|<=|>|<|===|!==|==|!=)\\s*(.+)$/\n );\n if (match) {\n const [, prop, operator, value] = match;\n if (!prop || !operator || value === undefined) {\n return false;\n }\n const propValue = contextData[prop];\n const compareValue = JSON.parse(value);\n\n switch (operator) {\n case '>':\n return Number(propValue) > Number(compareValue);\n case '<':\n return Number(propValue) < Number(compareValue);\n case '>=':\n return Number(propValue) >= Number(compareValue);\n case '<=':\n return Number(propValue) <= Number(compareValue);\n case '===':\n case '==':\n return propValue === compareValue;\n case '!==':\n case '!=':\n return propValue !== compareValue;\n }\n }\n\n // Check for boolean property\n if (expression in contextData) {\n return Boolean(contextData[expression]);\n }\n\n return false;\n } catch {\n return false;\n }\n }\n}\n\n/**\n * Create a new state machine engine instance.\n */\nexport function createStateMachineEngine(): IStateMachineEngine {\n return new BasicStateMachineEngine();\n}\n\n// ============ Utility Functions ============\n\n/**\n * Build a state machine definition from workflow entities.\n */\nexport function buildStateMachineDefinition(\n workflow: {\n key: string;\n name: string;\n version: number;\n initialStepId: string | null;\n },\n steps: {\n key: string;\n name: string;\n type: string;\n transitions: Record<string, string | TransitionDefinition>;\n approvalMode?: string;\n approverRoles?: string[];\n timeoutSeconds?: number;\n conditionExpression?: string;\n }[]\n): StateMachineDefinition {\n const stepMap: Record<string, StateMachineStep> = {};\n\n for (const step of steps) {\n stepMap[step.key] = {\n key: step.key,\n name: step.name,\n type: step.type as StateMachineStep['type'],\n transitions: step.transitions,\n approvalMode: step.approvalMode as StateMachineStep['approvalMode'],\n allowedRoles: step.approverRoles,\n timeoutSeconds: step.timeoutSeconds,\n conditionExpression: step.conditionExpression,\n };\n }\n\n // Find initial step\n const startStep = steps.find((s) => s.type === 'START');\n const initialStepKey = startStep?.key ?? steps[0]?.key ?? '';\n\n return {\n key: workflow.key,\n name: workflow.name,\n version: workflow.version,\n initialStepKey,\n steps: stepMap,\n };\n}\n\n/**\n * Create initial state for a new workflow instance.\n */\nexport function createInitialState(\n definition: StateMachineDefinition,\n contextData: Record<string, unknown> = {}\n): StateMachineState {\n return {\n currentStepKey: definition.initialStepKey,\n status: 'RUNNING',\n contextData,\n history: [],\n };\n}\n"],"mappings":";;;;;AA0JA,IAAa,0BAAb,MAAoE;CAClE,cACE,YACA,OACA,QACA,SACuC;AAEvC,MAAI,MAAM,WAAW,aAAa,MAAM,WAAW,UACjD,QAAO;GACL,SAAS;GACT,QAAQ,eAAe,MAAM,OAAO;GACrC;EAGH,MAAM,cAAc,WAAW,MAAM,MAAM;AAC3C,MAAI,CAAC,YACH,QAAO;GACL,S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ACd,UAMA,OAUwB;CACxB,MAAMC,UAA4C,EAAE;AAEpD,MAAK,MAAM,QAAQ,MACjB,SAAQ,KAAK,OAAO;EAClB,KAAK,KAAK;EACV,MAAM,KAAK;EACX,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,cAAc,KAAK;EACnB,cAAc,KAAK;EACnB,gBAAgB,KAAK;EACrB,qBAAqB,KAAK;EAC3B;CAKH,MAAM,iBADY,MAAM,MAAM,MAAM,EAAE,SAAS,QAAQ,EACrB,OAAO,MAAM,IAAI,OAAO;AAE1D,QAAO;EACL,KAAK,SAAS;EACd,MAAM,SAAS;EACf,SAAS,SAAS;EAClB;EACA,OAAO;EACR;;;;;AAMH,SAAgB,mBACd,YACA,cAAuC,EAAE,EACtB;AACnB,QAAO;EACL,gBAAgB,WAAW;EAC3B,QAAQ;EACR;EACA,SAAS,EAAE;EACZ"}
1
+ {"version":3,"file":"index.js","names":["newStatus: StateMachineState['status']","stepMap: Record<string, StateMachineStep>"],"sources":["../../src/state-machine/index.ts"],"sourcesContent":["/**\n * Workflow State Machine Engine\n *\n * Provides state machine logic for workflow transitions.\n * This is a spec-level abstraction that defines the interface\n * for workflow state transitions.\n */\n\n// ============ Types ============\n\n/**\n * Represents a transition definition in a workflow step.\n */\nexport interface TransitionDefinition {\n /** The action that triggers this transition (e.g., \"approve\", \"reject\") */\n action: string;\n /** The target step key to transition to */\n targetStepKey: string;\n /** Optional condition expression for conditional transitions */\n condition?: string;\n /** Optional guard roles - only users with these roles can take this action */\n allowedRoles?: string[];\n}\n\n/**\n * Step definition for state machine.\n */\nexport interface StateMachineStep {\n key: string;\n name: string;\n type:\n | 'START'\n | 'APPROVAL'\n | 'TASK'\n | 'CONDITION'\n | 'PARALLEL'\n | 'WAIT'\n | 'ACTION'\n | 'END';\n /** Map of action -> transition definition */\n transitions: Record<string, string | TransitionDefinition>;\n /** For approval steps: how approvals are handled */\n approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';\n /** Roles that can approve/act on this step */\n allowedRoles?: string[];\n /** Timeout in seconds */\n timeoutSeconds?: number;\n /** Condition expression for CONDITION type */\n conditionExpression?: string;\n}\n\n/**\n * Workflow state machine definition.\n */\nexport interface StateMachineDefinition {\n key: string;\n name: string;\n version: string;\n initialStepKey: string;\n steps: Record<string, StateMachineStep>;\n}\n\n/**\n * Current state of an instance.\n */\nexport interface StateMachineState {\n currentStepKey: string;\n status:\n | 'PENDING'\n | 'RUNNING'\n | 'WAITING'\n | 'PAUSED'\n | 'COMPLETED'\n | 'CANCELLED'\n | 'FAILED'\n | 'TIMEOUT';\n contextData: Record<string, unknown>;\n history: {\n stepKey: string;\n action: string;\n timestamp: Date;\n executedBy: string;\n }[];\n}\n\n/**\n * Result of a transition attempt.\n */\nexport interface TransitionResult {\n success: boolean;\n previousStepKey: string;\n currentStepKey: string | null;\n status: StateMachineState['status'];\n error?: string;\n}\n\n/**\n * Context for transition validation.\n */\nexport interface TransitionContext {\n userId: string;\n userRoles: string[];\n data?: Record<string, unknown>;\n}\n\n// ============ State Machine Engine ============\n\n/**\n * State machine engine interface.\n * Implementation should be provided at runtime.\n */\nexport interface IStateMachineEngine {\n /**\n * Validate that a transition is allowed.\n */\n canTransition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): { allowed: boolean; reason?: string };\n\n /**\n * Get available actions for the current step.\n */\n getAvailableActions(\n definition: StateMachineDefinition,\n state: StateMachineState,\n context: TransitionContext\n ): string[];\n\n /**\n * Execute a transition.\n */\n transition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): TransitionResult;\n\n /**\n * Evaluate a condition expression.\n */\n evaluateCondition(\n expression: string,\n contextData: Record<string, unknown>\n ): boolean;\n}\n\n/**\n * Basic state machine engine implementation.\n * This is a reference implementation for spec validation.\n */\nexport class BasicStateMachineEngine implements IStateMachineEngine {\n canTransition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): { allowed: boolean; reason?: string } {\n // Check if state allows transitions\n if (state.status !== 'RUNNING' && state.status !== 'WAITING') {\n return {\n allowed: false,\n reason: `Workflow is ${state.status}, cannot transition`,\n };\n }\n\n const currentStep = definition.steps[state.currentStepKey];\n if (!currentStep) {\n return {\n allowed: false,\n reason: `Step ${state.currentStepKey} not found`,\n };\n }\n\n // Check if action exists for this step\n const transition = currentStep.transitions[action];\n if (!transition) {\n return {\n allowed: false,\n reason: `Action ${action} not available in step ${state.currentStepKey}`,\n };\n }\n\n // Check role-based access\n if (currentStep.allowedRoles && currentStep.allowedRoles.length > 0) {\n const hasRole = currentStep.allowedRoles.some((role) =>\n context.userRoles.includes(role)\n );\n if (!hasRole) {\n return {\n allowed: false,\n reason: `User lacks required role for this action`,\n };\n }\n }\n\n // Check transition-specific roles if defined\n if (\n typeof transition === 'object' &&\n transition.allowedRoles &&\n transition.allowedRoles.length > 0\n ) {\n const hasRole = transition.allowedRoles.some((role) =>\n context.userRoles.includes(role)\n );\n if (!hasRole) {\n return {\n allowed: false,\n reason: `User lacks required role for action ${action}`,\n };\n }\n }\n\n return { allowed: true };\n }\n\n getAvailableActions(\n definition: StateMachineDefinition,\n state: StateMachineState,\n context: TransitionContext\n ): string[] {\n if (state.status !== 'RUNNING' && state.status !== 'WAITING') {\n return [];\n }\n\n const currentStep = definition.steps[state.currentStepKey];\n if (!currentStep) {\n return [];\n }\n\n return Object.keys(currentStep.transitions).filter((action) => {\n const result = this.canTransition(definition, state, action, context);\n return result.allowed;\n });\n }\n\n transition(\n definition: StateMachineDefinition,\n state: StateMachineState,\n action: string,\n context: TransitionContext\n ): TransitionResult {\n const validation = this.canTransition(definition, state, action, context);\n if (!validation.allowed) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: validation.reason,\n };\n }\n\n const currentStep = definition.steps[state.currentStepKey];\n if (!currentStep) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: `Current step ${state.currentStepKey} not found`,\n };\n }\n const transition = currentStep.transitions[action];\n if (!transition) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: `Transition for action ${action} not found`,\n };\n }\n const targetStepKey =\n typeof transition === 'string' ? transition : transition.targetStepKey;\n const targetStep = definition.steps[targetStepKey];\n\n if (!targetStep) {\n return {\n success: false,\n previousStepKey: state.currentStepKey,\n currentStepKey: state.currentStepKey,\n status: state.status,\n error: `Target step ${targetStepKey} not found`,\n };\n }\n\n // Determine new status\n let newStatus: StateMachineState['status'] = 'RUNNING';\n if (targetStep.type === 'END') {\n newStatus = 'COMPLETED';\n } else if (targetStep.type === 'APPROVAL' || targetStep.type === 'WAIT') {\n newStatus = 'WAITING';\n }\n\n return {\n success: true,\n previousStepKey: state.currentStepKey,\n currentStepKey: targetStepKey,\n status: newStatus,\n };\n }\n\n evaluateCondition(\n expression: string,\n contextData: Record<string, unknown>\n ): boolean {\n // Basic condition evaluation\n // In production, this should use a proper expression language\n try {\n // Simple property checks like \"amount > 1000\"\n const match = expression.match(\n /^(\\w+)\\s*(>=|<=|>|<|===|!==|==|!=)\\s*(.+)$/\n );\n if (match) {\n const [, prop, operator, value] = match;\n if (!prop || !operator || value === undefined) {\n return false;\n }\n const propValue = contextData[prop];\n const compareValue = JSON.parse(value);\n\n switch (operator) {\n case '>':\n return Number(propValue) > Number(compareValue);\n case '<':\n return Number(propValue) < Number(compareValue);\n case '>=':\n return Number(propValue) >= Number(compareValue);\n case '<=':\n return Number(propValue) <= Number(compareValue);\n case '===':\n case '==':\n return propValue === compareValue;\n case '!==':\n case '!=':\n return propValue !== compareValue;\n }\n }\n\n // Check for boolean property\n if (expression in contextData) {\n return Boolean(contextData[expression]);\n }\n\n return false;\n } catch {\n return false;\n }\n }\n}\n\n/**\n * Create a new state machine engine instance.\n */\nexport function createStateMachineEngine(): IStateMachineEngine {\n return new BasicStateMachineEngine();\n}\n\n// ============ Utility Functions ============\n\n/**\n * Build a state machine definition from workflow entities.\n */\nexport function buildStateMachineDefinition(\n workflow: {\n key: string;\n name: string;\n version: string;\n initialStepId: string | null;\n },\n steps: {\n key: string;\n name: string;\n type: string;\n transitions: Record<string, string | TransitionDefinition>;\n approvalMode?: string;\n approverRoles?: string[];\n timeoutSeconds?: number;\n conditionExpression?: string;\n }[]\n): StateMachineDefinition {\n const stepMap: Record<string, StateMachineStep> = {};\n\n for (const step of steps) {\n stepMap[step.key] = {\n key: step.key,\n name: step.name,\n type: step.type as StateMachineStep['type'],\n transitions: step.transitions,\n approvalMode: step.approvalMode as StateMachineStep['approvalMode'],\n allowedRoles: step.approverRoles,\n timeoutSeconds: step.timeoutSeconds,\n conditionExpression: step.conditionExpression,\n };\n }\n\n // Find initial step\n const startStep = steps.find((s) => s.type === 'START');\n const initialStepKey = startStep?.key ?? steps[0]?.key ?? '';\n\n return {\n key: workflow.key,\n name: workflow.name,\n version: workflow.version,\n initialStepKey,\n steps: stepMap,\n };\n}\n\n/**\n * Create initial state for a new workflow instance.\n */\nexport function createInitialState(\n definition: StateMachineDefinition,\n contextData: Record<string, unknown> = {}\n): StateMachineState {\n return {\n currentStepKey: definition.initialStepKey,\n status: 'RUNNING',\n contextData,\n history: [],\n };\n}\n"],"mappings":";;;;;AA0JA,IAAa,0BAAb,MAAoE;CAClE,cACE,YACA,OACA,QACA,SACuC;AAEvC,MAAI,MAAM,WAAW,aAAa,MAAM,WAAW,UACjD,QAAO;GACL,SAAS;GACT,QAAQ,eAAe,MAAM,OAAO;GACrC;EAGH,MAAM,cAAc,WAAW,MAAM,MAAM;AAC3C,MAAI,CAAC,YACH,QAAO;GACL,SAAS;GACT,QAAQ,QAAQ,MAAM,eAAe;GACtC;EAIH,MAAM,aAAa,YAAY,YAAY;AAC3C,MAAI,CAAC,WACH,QAAO;GACL,SAAS;GACT,QAAQ,UAAU,OAAO,yBAAyB,MAAM;GACzD;AAIH,MAAI,Y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AAc,KAAK;EACnB,cAAc,KAAK;EACnB,gBAAgB,KAAK;EACrB,qBAAqB,KAAK;EAC3B;CAKH,MAAM,iBADY,MAAM,MAAM,MAAM,EAAE,SAAS,QAAQ,EACrB,OAAO,MAAM,IAAI,OAAO;AAE1D,QAAO;EACL,KAAK,SAAS;EACd,MAAM,SAAS;EACf,SAAS,SAAS;EAClB;EACA,OAAO;EACR;;;;;AAMH,SAAgB,mBACd,YACA,cAAuC,EAAE,EACtB;AACnB,QAAO;EACL,gBAAgB,WAAW;EAC3B,QAAQ;EACR;EACA,SAAS,EAAE;EACZ"}
@@ -1,22 +1,22 @@
1
- import * as _contractspec_lib_schema839 from "@contractspec/lib.schema";
1
+ import * as _contractspec_lib_schema540 from "@contractspec/lib.schema";
2
2
 
3
3
  //#region src/workflow/workflow.enum.d.ts
4
4
  /**
5
5
  * Workflow status enum.
6
6
  */
7
- declare const WorkflowStatusEnum: _contractspec_lib_schema839.EnumType<[string, string, string, string]>;
7
+ declare const WorkflowStatusEnum: _contractspec_lib_schema540.EnumType<[string, string, string, string]>;
8
8
  /**
9
9
  * Trigger type enum.
10
10
  */
11
- declare const TriggerTypeEnum: _contractspec_lib_schema839.EnumType<[string, string, string, string]>;
11
+ declare const TriggerTypeEnum: _contractspec_lib_schema540.EnumType<[string, string, string, string]>;
12
12
  /**
13
13
  * Step type enum.
14
14
  */
15
- declare const StepTypeEnum: _contractspec_lib_schema839.EnumType<[string, string, string, string, string, string, string, string]>;
15
+ declare const StepTypeEnum: _contractspec_lib_schema540.EnumType<[string, string, string, string, string, string, string, string]>;
16
16
  /**
17
17
  * Approval mode enum.
18
18
  */
19
- declare const ApprovalModeEnum: _contractspec_lib_schema839.EnumType<[string, string, string, string]>;
19
+ declare const ApprovalModeEnum: _contractspec_lib_schema540.EnumType<[string, string, string, string]>;
20
20
  //#endregion
21
21
  export { ApprovalModeEnum, StepTypeEnum, TriggerTypeEnum, WorkflowStatusEnum };
22
22
  //# sourceMappingURL=workflow.enum.d.ts.map
@@ -1,132 +1,132 @@
1
- import * as _contractspec_lib_schema1149 from "@contractspec/lib.schema";
2
- import * as _contractspec_lib_contracts30 from "@contractspec/lib.contracts";
1
+ import * as _contractspec_lib_schema509 from "@contractspec/lib.schema";
2
+ import * as _contractspec_lib_contracts8 from "@contractspec/lib.contracts";
3
3
 
4
4
  //#region src/workflow/workflow.event.d.ts
5
5
  /**
6
6
  * WorkflowCreatedEvent - A new workflow definition has been created.
7
7
  */
8
- declare const WorkflowCreatedEvent: _contractspec_lib_contracts30.EventSpec<_contractspec_lib_schema1149.SchemaModel<{
8
+ declare const WorkflowCreatedEvent: _contractspec_lib_contracts8.EventSpec<_contractspec_lib_schema509.SchemaModel<{
9
9
  workflowId: {
10
- type: _contractspec_lib_schema1149.FieldType<string, string>;
10
+ type: _contractspec_lib_schema509.FieldType<string, string>;
11
11
  isOptional: false;
12
12
  };
13
13
  key: {
14
- type: _contractspec_lib_schema1149.FieldType<string, string>;
14
+ type: _contractspec_lib_schema509.FieldType<string, string>;
15
15
  isOptional: false;
16
16
  };
17
17
  name: {
18
- type: _contractspec_lib_schema1149.FieldType<string, string>;
18
+ type: _contractspec_lib_schema509.FieldType<string, string>;
19
19
  isOptional: false;
20
20
  };
21
21
  version: {
22
- type: _contractspec_lib_schema1149.FieldType<number, number>;
22
+ type: _contractspec_lib_schema509.FieldType<string, string>;
23
23
  isOptional: false;
24
24
  };
25
25
  organizationId: {
26
- type: _contractspec_lib_schema1149.FieldType<string, string>;
26
+ type: _contractspec_lib_schema509.FieldType<string, string>;
27
27
  isOptional: false;
28
28
  };
29
29
  createdBy: {
30
- type: _contractspec_lib_schema1149.FieldType<string, string>;
30
+ type: _contractspec_lib_schema509.FieldType<string, string>;
31
31
  isOptional: false;
32
32
  };
33
33
  timestamp: {
34
- type: _contractspec_lib_schema1149.FieldType<Date, string>;
34
+ type: _contractspec_lib_schema509.FieldType<Date, string>;
35
35
  isOptional: false;
36
36
  };
37
37
  }>>;
38
38
  /**
39
39
  * WorkflowUpdatedEvent - A workflow definition has been updated.
40
40
  */
41
- declare const WorkflowUpdatedEvent: _contractspec_lib_contracts30.EventSpec<_contractspec_lib_schema1149.SchemaModel<{
41
+ declare const WorkflowUpdatedEvent: _contractspec_lib_contracts8.EventSpec<_contractspec_lib_schema509.SchemaModel<{
42
42
  workflowId: {
43
- type: _contractspec_lib_schema1149.FieldType<string, string>;
43
+ type: _contractspec_lib_schema509.FieldType<string, string>;
44
44
  isOptional: false;
45
45
  };
46
46
  key: {
47
- type: _contractspec_lib_schema1149.FieldType<string, string>;
47
+ type: _contractspec_lib_schema509.FieldType<string, string>;
48
48
  isOptional: false;
49
49
  };
50
50
  name: {
51
- type: _contractspec_lib_schema1149.FieldType<string, string>;
51
+ type: _contractspec_lib_schema509.FieldType<string, string>;
52
52
  isOptional: false;
53
53
  };
54
54
  version: {
55
- type: _contractspec_lib_schema1149.FieldType<number, number>;
55
+ type: _contractspec_lib_schema509.FieldType<string, string>;
56
56
  isOptional: false;
57
57
  };
58
58
  organizationId: {
59
- type: _contractspec_lib_schema1149.FieldType<string, string>;
59
+ type: _contractspec_lib_schema509.FieldType<string, string>;
60
60
  isOptional: false;
61
61
  };
62
62
  createdBy: {
63
- type: _contractspec_lib_schema1149.FieldType<string, string>;
63
+ type: _contractspec_lib_schema509.FieldType<string, string>;
64
64
  isOptional: false;
65
65
  };
66
66
  timestamp: {
67
- type: _contractspec_lib_schema1149.FieldType<Date, string>;
67
+ type: _contractspec_lib_schema509.FieldType<Date, string>;
68
68
  isOptional: false;
69
69
  };
70
70
  }>>;
71
71
  /**
72
72
  * WorkflowPublishedEvent - A workflow definition has been published.
73
73
  */
74
- declare const WorkflowPublishedEvent: _contractspec_lib_contracts30.EventSpec<_contractspec_lib_schema1149.SchemaModel<{
74
+ declare const WorkflowPublishedEvent: _contractspec_lib_contracts8.EventSpec<_contractspec_lib_schema509.SchemaModel<{
75
75
  workflowId: {
76
- type: _contractspec_lib_schema1149.FieldType<string, string>;
76
+ type: _contractspec_lib_schema509.FieldType<string, string>;
77
77
  isOptional: false;
78
78
  };
79
79
  key: {
80
- type: _contractspec_lib_schema1149.FieldType<string, string>;
80
+ type: _contractspec_lib_schema509.FieldType<string, string>;
81
81
  isOptional: false;
82
82
  };
83
83
  name: {
84
- type: _contractspec_lib_schema1149.FieldType<string, string>;
84
+ type: _contractspec_lib_schema509.FieldType<string, string>;
85
85
  isOptional: false;
86
86
  };
87
87
  version: {
88
- type: _contractspec_lib_schema1149.FieldType<number, number>;
88
+ type: _contractspec_lib_schema509.FieldType<string, string>;
89
89
  isOptional: false;
90
90
  };
91
91
  organizationId: {
92
- type: _contractspec_lib_schema1149.FieldType<string, string>;
92
+ type: _contractspec_lib_schema509.FieldType<string, string>;
93
93
  isOptional: false;
94
94
  };
95
95
  createdBy: {
96
- type: _contractspec_lib_schema1149.FieldType<string, string>;
96
+ type: _contractspec_lib_schema509.FieldType<string, string>;
97
97
  isOptional: false;
98
98
  };
99
99
  timestamp: {
100
- type: _contractspec_lib_schema1149.FieldType<Date, string>;
100
+ type: _contractspec_lib_schema509.FieldType<Date, string>;
101
101
  isOptional: false;
102
102
  };
103
103
  }>>;
104
104
  /**
105
105
  * StepAddedEvent - A step has been added to a workflow definition.
106
106
  */
107
- declare const StepAddedEvent: _contractspec_lib_contracts30.EventSpec<_contractspec_lib_schema1149.SchemaModel<{
107
+ declare const StepAddedEvent: _contractspec_lib_contracts8.EventSpec<_contractspec_lib_schema509.SchemaModel<{
108
108
  stepId: {
109
- type: _contractspec_lib_schema1149.FieldType<string, string>;
109
+ type: _contractspec_lib_schema509.FieldType<string, string>;
110
110
  isOptional: false;
111
111
  };
112
112
  workflowId: {
113
- type: _contractspec_lib_schema1149.FieldType<string, string>;
113
+ type: _contractspec_lib_schema509.FieldType<string, string>;
114
114
  isOptional: false;
115
115
  };
116
116
  stepKey: {
117
- type: _contractspec_lib_schema1149.FieldType<string, string>;
117
+ type: _contractspec_lib_schema509.FieldType<string, string>;
118
118
  isOptional: false;
119
119
  };
120
120
  stepType: {
121
- type: _contractspec_lib_schema1149.FieldType<string, string>;
121
+ type: _contractspec_lib_schema509.FieldType<string, string>;
122
122
  isOptional: false;
123
123
  };
124
124
  position: {
125
- type: _contractspec_lib_schema1149.FieldType<number, number>;
125
+ type: _contractspec_lib_schema509.FieldType<number, number>;
126
126
  isOptional: false;
127
127
  };
128
128
  timestamp: {
129
- type: _contractspec_lib_schema1149.FieldType<Date, string>;
129
+ type: _contractspec_lib_schema509.FieldType<Date, string>;
130
130
  isOptional: false;
131
131
  };
132
132
  }>>;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.event.d.ts","names":[],"sources":["../../src/workflow/workflow.event.ts"],"sourcesContent":[],"mappings":";;;;;;;cA0Ca,sBAAoB,6BAAA,CAAA,uCAAA;EAApB,UAAA,EAAA;IAUX,IAAA,EAAA,4BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;gDAV+B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAAA,CAAA;EAepB,OAAA,EAAA;IAUX,IAAA,wCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;gDAV+B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAAA,CAAA;EAepB,SAAA,EAAA;IAUX,IAAA,wCAAA,KAAA,EAAA,MAAA,CAAA;;;;;;;cAzBW,sBAAoB,6BAAA,CAAA,uCAAA;;IAeE,IAAA,EALjC,4BAAA,CAAA,SAKiC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAetB,CAAA;EAUX,GAAA,EAAA;;;;;;;;EAVyB,OAAA,EAAA;IAAA,IAAA,wCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;cAfd,wBAAsB,6BAAA,CAAA,uCAAA;;UAUjC,4BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,gBAAc,6BAAA,CAAA,uCAAA;;UAUzB,4BAAA,CAAA"}
1
+ {"version":3,"file":"workflow.event.d.ts","names":[],"sources":["../../src/workflow/workflow.event.ts"],"sourcesContent":[],"mappings":";;;;;;;cA0Ca,sBAAoB,4BAAA,CAAA,sCAAA;EAApB,UAAA,EAAA;IAUX,IAAA,EAAA,2BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;+CAV+B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAAA,CAAA;EAepB,OAAA,EAAA;IAUX,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;+CAV+B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAAA,CAAA;EAepB,SAAA,EAAA;IAUX,IAAA,uCAAA,KAAA,EAAA,MAAA,CAAA;;;;;;;cAzBW,sBAAoB,4BAAA,CAAA,sCAAA;;IAeE,IAAA,EALjC,2BAAA,CAAA,SAKiC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAetB,CAAA;EAUX,GAAA,EAAA;;;;;;;;EAVyB,OAAA,EAAA;IAAA,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;cAfd,wBAAsB,4BAAA,CAAA,sCAAA;;UAUjC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,gBAAc,4BAAA,CAAA,sCAAA;;UAUzB,2BAAA,CAAA"}
@@ -22,7 +22,7 @@ const WorkflowDefinitionPayload = defineSchemaModel$1({
22
22
  isOptional: false
23
23
  },
24
24
  version: {
25
- type: ScalarTypeEnum.Int_unsecure(),
25
+ type: ScalarTypeEnum.String_unsecure(),
26
26
  isOptional: false
27
27
  },
28
28
  organizationId: {
@@ -78,7 +78,7 @@ const StepAddedPayload = defineSchemaModel$1({
78
78
  const WorkflowCreatedEvent = defineEvent({
79
79
  meta: {
80
80
  key: "workflow.definition.created",
81
- version: 1,
81
+ version: "1.0.0",
82
82
  description: "A new workflow definition has been created.",
83
83
  stability: "stable",
84
84
  owners: ["@workflow-team"],
@@ -96,7 +96,7 @@ const WorkflowCreatedEvent = defineEvent({
96
96
  const WorkflowUpdatedEvent = defineEvent({
97
97
  meta: {
98
98
  key: "workflow.definition.updated",
99
- version: 1,
99
+ version: "1.0.0",
100
100
  description: "A workflow definition has been updated.",
101
101
  stability: "stable",
102
102
  owners: ["@workflow-team"],
@@ -114,7 +114,7 @@ const WorkflowUpdatedEvent = defineEvent({
114
114
  const WorkflowPublishedEvent = defineEvent({
115
115
  meta: {
116
116
  key: "workflow.definition.published",
117
- version: 1,
117
+ version: "1.0.0",
118
118
  description: "A workflow definition has been published and is now active.",
119
119
  stability: "stable",
120
120
  owners: ["@workflow-team"],
@@ -132,7 +132,7 @@ const WorkflowPublishedEvent = defineEvent({
132
132
  const StepAddedEvent = defineEvent({
133
133
  meta: {
134
134
  key: "workflow.step.added",
135
- version: 1,
135
+ version: "1.0.0",
136
136
  description: "A step has been added to a workflow definition.",
137
137
  stability: "stable",
138
138
  owners: ["@workflow-team"],
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.event.js","names":["defineSchemaModel"],"sources":["../../src/workflow/workflow.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\n/**\n * Payload for workflow definition events.\n */\nconst WorkflowDefinitionPayload = defineSchemaModel({\n name: 'WorkflowDefinitionEventPayload',\n description: 'Payload for workflow definition events',\n fields: {\n workflowId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n version: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when a step is added.\n */\nconst StepAddedPayload = defineSchemaModel({\n name: 'StepAddedEventPayload',\n description: 'Payload when a step is added',\n fields: {\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n workflowId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * WorkflowCreatedEvent - A new workflow definition has been created.\n */\nexport const WorkflowCreatedEvent = defineEvent({\n meta: {\n key: 'workflow.definition.created',\n version: 1,\n description: 'A new workflow definition has been created.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'definition', 'created'],\n },\n payload: WorkflowDefinitionPayload,\n});\n\n/**\n * WorkflowUpdatedEvent - A workflow definition has been updated.\n */\nexport const WorkflowUpdatedEvent = defineEvent({\n meta: {\n key: 'workflow.definition.updated',\n version: 1,\n description: 'A workflow definition has been updated.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'definition', 'updated'],\n },\n payload: WorkflowDefinitionPayload,\n});\n\n/**\n * WorkflowPublishedEvent - A workflow definition has been published.\n */\nexport const WorkflowPublishedEvent = defineEvent({\n meta: {\n key: 'workflow.definition.published',\n version: 1,\n description: 'A workflow definition has been published and is now active.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'definition', 'published'],\n },\n payload: WorkflowDefinitionPayload,\n});\n\n/**\n * StepAddedEvent - A step has been added to a workflow definition.\n */\nexport const StepAddedEvent = defineEvent({\n meta: {\n key: 'workflow.step.added',\n version: 1,\n description: 'A step has been added to a workflow definition.',\n stability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T,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAc;GAAU;EAC5C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAc;GAAY;EAC9C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,iBAAiB,YAAY;CACxC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAQ;GAAQ;EACpC;CACD,SAAS;CACV,CAAC"}
1
+ {"version":3,"file":"workflow.event.js","names":["defineSchemaModel"],"sources":["../../src/workflow/workflow.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\n/**\n * Payload for workflow definition events.\n */\nconst WorkflowDefinitionPayload = defineSchemaModel({\n name: 'WorkflowDefinitionEventPayload',\n description: 'Payload for workflow definition events',\n fields: {\n workflowId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Payload when a step is added.\n */\nconst StepAddedPayload = defineSchemaModel({\n name: 'StepAddedEventPayload',\n description: 'Payload when a step is added',\n fields: {\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n workflowId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * WorkflowCreatedEvent - A new workflow definition has been created.\n */\nexport const WorkflowCreatedEvent = defineEvent({\n meta: {\n key: 'workflow.definition.created',\n version: '1.0.0',\n description: 'A new workflow definition has been created.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'definition', 'created'],\n },\n payload: WorkflowDefinitionPayload,\n});\n\n/**\n * WorkflowUpdatedEvent - A workflow definition has been updated.\n */\nexport const WorkflowUpdatedEvent = defineEvent({\n meta: {\n key: 'workflow.definition.updated',\n version: '1.0.0',\n description: 'A workflow definition has been updated.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'definition', 'updated'],\n },\n payload: WorkflowDefinitionPayload,\n});\n\n/**\n * WorkflowPublishedEvent - A workflow definition has been published.\n */\nexport const WorkflowPublishedEvent = defineEvent({\n meta: {\n key: 'workflow.definition.published',\n version: '1.0.0',\n description: 'A workflow definition has been published and is now active.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'definition', 'published'],\n },\n payload: WorkflowDefinitionPayload,\n});\n\n/**\n * StepAddedEvent - A step has been added to a workflow definition.\n */\nexport const StepAddedEvent = defineEvent({\n meta: {\n key: 'workflow.step.added',\n version: '1.0.0',\n description: 'A step has been added to a workflow definition.',\n stability: 'stable',\n owners: ['@workflow-team'],\n tags: ['workflow', 'step', 'added'],\n },\n payload: StepAddedPayload,\n});\n"],"mappings":";;;;;;;AAMA,MAAM,4BAA4BA,oBAAkB;CAClD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GA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AC9C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,iBAAiB,YAAY;CACxC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAQ;GAAQ;EACpC;CACD,SAAS;CACV,CAAC"}
@@ -9,7 +9,7 @@ async function handleCreateWorkflow(input, context) {
9
9
  key: input.key,
10
10
  name: input.name,
11
11
  description: input.description,
12
- version: 1,
12
+ version: "1.0.0",
13
13
  status: "DRAFT",
14
14
  triggerType: input.triggerType ?? "MANUAL",
15
15
  featureFlagKey: input.featureFlagKey,
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.handler.js","names":["workflow: WorkflowDefinitionRecord","step: WorkflowStepRecord"],"sources":["../../src/workflow/workflow.handler.ts"],"sourcesContent":["/**\n * Workflow definition handlers.\n */\n\nimport type {\n WorkflowDefinitionRecord,\n WorkflowStepRecord,\n HandlerContext,\n} from '../shared/types';\nimport { mockDataStore } from '../shared/mock-data';\n\nexport async function handleCreateWorkflow(\n input: {\n name: string;\n key: string;\n description?: string;\n triggerType?: 'MANUAL' | 'EVENT' | 'SCHEDULED' | 'API';\n featureFlagKey?: string;\n },\n context: HandlerContext\n): Promise<WorkflowDefinitionRecord> {\n const id = `wf_${Date.now()}`;\n const now = new Date();\n\n const workflow: WorkflowDefinitionRecord = {\n id,\n key: input.key,\n name: input.name,\n description: input.description,\n version: 1,\n status: 'DRAFT',\n triggerType: input.triggerType ?? 'MANUAL',\n featureFlagKey: input.featureFlagKey,\n organizationId: context.organizationId,\n createdBy: context.userId,\n createdAt: now,\n updatedAt: now,\n };\n\n mockDataStore.workflows.set(id, workflow);\n return workflow;\n}\n\nexport async function handleAddStep(\n input: {\n workflowId: string;\n key: string;\n name: string;\n description?: string;\n type:\n | 'START'\n | 'APPROVAL'\n | 'TASK'\n | 'CONDITION'\n | 'PARALLEL'\n | 'WAIT'\n | 'ACTION'\n | 'END';\n position?: number;\n transitions: Record<string, string>;\n approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';\n approverRoles?: string[];\n timeoutSeconds?: number;\n },\n _context: HandlerContext\n): Promise<WorkflowStepRecord> {\n const id = `step_${Date.now()}`;\n const now = new Date();\n\n // Calculate position\n const existingSteps = Array.from(mockDataStore.steps.values()).filter(\n (s) => s.workflowDefinitionId === input.workflowId\n );\n const position = input.position ?? existingSteps.length;\n\n const step: WorkflowStepRecord = {\n id,\n workflowDefinitionId: input.workflowId,\n key: input.key,\n name: input.name,\n description: input.description,\n type: input.type,\n position,\n transitions: input.transitions,\n approvalMode: input.approvalMode,\n approverRoles: input.approverRoles ?? [],\n timeoutSeconds: input.timeoutSeconds,\n createdAt: now,\n updatedAt: now,\n };\n\n mockDataStore.steps.set(id, step);\n\n // Update workflow with initial step if this is the first step\n if (existingSteps.length === 0 || input.type === 'START') {\n const workflow = mockDataStore.workflows.get(input.workflowId);\n if (workflow) {\n workflow.initialStepId = id;\n workflow.updatedAt = now;\n }\n }\n\n return step;\n}\n\nexport async function handlePublishWorkflow(\n input: { workflowId: string },\n _context: HandlerContext\n): Promise<WorkflowDefinitionRecord> {\n const workflow = mockDataStore.workflows.get(input.workflowId);\n if (!workflow) {\n throw new Error(`Workflow ${input.workflowId} not found`);\n }\n\n const now = new Date();\n workflow.status = 'ACTIVE';\n workflow.publishedAt = now;\n workflow.updatedAt = now;\n\n return workflow;\n}\n"],"mappings":";;;AAWA,eAAsB,qBACpB,OAOA,SACmC;CACnC,MAAM,KAAK,MAAM,KAAK,KAAK;CAC3B,MAAM,sBAAM,IAAI,MAAM;CAEtB,MAAMA,WAAqC;EACzC;EACA,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,SAAS;EACT,QAAQ;EACR,aAAa,MAAM,eAAe;EAClC,gBAAgB,MAAM;EACtB,gBAAgB,QAAQ;EACxB,WAAW,QAAQ;EACnB,WAAW;EACX,WAAW;EACZ;AAED,eAAc,UAAU,IAAI,IAAI,SAAS;AACzC,QAAO;;AAGT,eAAsB,cACpB,OAoBA,UAC6B;CAC7B,MAAM,KAAK,QAAQ,KAAK,KAAK;CAC7B,MAAM,sBAAM,IAAI,MAAM;CAGtB,MAAM,gBAAgB,MAAM,KAAK,cAAc,MAAM,QAAQ,CAAC,CAAC,QAC5D,MAAM,EAAE,yBAAyB,MAAM,WACzC;CACD,MAAM,WAAW,MAAM,YAAY,cAAc;CAEjD,MAAMC,OAA2B;EAC/B;EACA,sBAAsB,MAAM;EAC5B,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,MAAM,MAAM;EACZ;EACA,aAAa,MAAM;EACnB,cAAc,MAAM;EACpB,eAAe,MAAM,iBAAiB,EAAE;EACxC,gBAAgB,MAAM;EACtB,WAAW;EACX,WAAW;EACZ;AAED,eAAc,MAAM,IAAI,IAAI,KAAK;AAGjC,KAAI,cAAc,WAAW,KAAK,MAAM,SAAS,SAAS;EACxD,MAAM,WAAW,cAAc,UAAU,IAAI,MAAM,WAAW;AAC9D,MAAI,UAAU;AACZ,YAAS,gBAAgB;AACzB,YAAS,YAAY;;;AAIzB,QAAO;;AAGT,eAAsB,sBACpB,OACA,UACmC;CACnC,MAAM,WAAW,cAAc,UAAU,IAAI,MAAM,WAAW;AAC9D,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,YAAY,MAAM,WAAW,YAAY;CAG3D,MAAM,sBAAM,IAAI,MAAM;AACtB,UAAS,SAAS;AAClB,UAAS,cAAc;AACvB,UAAS,YAAY;AAErB,QAAO"}
1
+ {"version":3,"file":"workflow.handler.js","names":["workflow: WorkflowDefinitionRecord","step: WorkflowStepRecord"],"sources":["../../src/workflow/workflow.handler.ts"],"sourcesContent":["/**\n * Workflow definition handlers.\n */\n\nimport type {\n WorkflowDefinitionRecord,\n WorkflowStepRecord,\n HandlerContext,\n} from '../shared/types';\nimport { mockDataStore } from '../shared/mock-data';\n\nexport async function handleCreateWorkflow(\n input: {\n name: string;\n key: string;\n description?: string;\n triggerType?: 'MANUAL' | 'EVENT' | 'SCHEDULED' | 'API';\n featureFlagKey?: string;\n },\n context: HandlerContext\n): Promise<WorkflowDefinitionRecord> {\n const id = `wf_${Date.now()}`;\n const now = new Date();\n\n const workflow: WorkflowDefinitionRecord = {\n id,\n key: input.key,\n name: input.name,\n description: input.description,\n version: '1.0.0',\n status: 'DRAFT',\n triggerType: input.triggerType ?? 'MANUAL',\n featureFlagKey: input.featureFlagKey,\n organizationId: context.organizationId,\n createdBy: context.userId,\n createdAt: now,\n updatedAt: now,\n };\n\n mockDataStore.workflows.set(id, workflow);\n return workflow;\n}\n\nexport async function handleAddStep(\n input: {\n workflowId: string;\n key: string;\n name: string;\n description?: string;\n type:\n | 'START'\n | 'APPROVAL'\n | 'TASK'\n | 'CONDITION'\n | 'PARALLEL'\n | 'WAIT'\n | 'ACTION'\n | 'END';\n position?: number;\n transitions: Record<string, string>;\n approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';\n approverRoles?: string[];\n timeoutSeconds?: number;\n },\n _context: HandlerContext\n): Promise<WorkflowStepRecord> {\n const id = `step_${Date.now()}`;\n const now = new Date();\n\n // Calculate position\n const existingSteps = Array.from(mockDataStore.steps.values()).filter(\n (s) => s.workflowDefinitionId === input.workflowId\n );\n const position = input.position ?? existingSteps.length;\n\n const step: WorkflowStepRecord = {\n id,\n workflowDefinitionId: input.workflowId,\n key: input.key,\n name: input.name,\n description: input.description,\n type: input.type,\n position,\n transitions: input.transitions,\n approvalMode: input.approvalMode,\n approverRoles: input.approverRoles ?? [],\n timeoutSeconds: input.timeoutSeconds,\n createdAt: now,\n updatedAt: now,\n };\n\n mockDataStore.steps.set(id, step);\n\n // Update workflow with initial step if this is the first step\n if (existingSteps.length === 0 || input.type === 'START') {\n const workflow = mockDataStore.workflows.get(input.workflowId);\n if (workflow) {\n workflow.initialStepId = id;\n workflow.updatedAt = now;\n }\n }\n\n return step;\n}\n\nexport async function handlePublishWorkflow(\n input: { workflowId: string },\n _context: HandlerContext\n): Promise<WorkflowDefinitionRecord> {\n const workflow = mockDataStore.workflows.get(input.workflowId);\n if (!workflow) {\n throw new Error(`Workflow ${input.workflowId} not found`);\n }\n\n const now = new Date();\n workflow.status = 'ACTIVE';\n workflow.publishedAt = now;\n workflow.updatedAt = now;\n\n return workflow;\n}\n"],"mappings":";;;AAWA,eAAsB,qBACpB,OAOA,SACmC;CACnC,MAAM,KAAK,MAAM,KAAK,KAAK;CAC3B,MAAM,sBAAM,IAAI,MAAM;CAEtB,MAAMA,WAAqC;EACzC;EACA,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,SAAS;EACT,QAAQ;EACR,aAAa,MAAM,eAAe;EAClC,gBAAgB,MAAM;EACtB,gBAAgB,QAAQ;EACxB,WAAW,QAAQ;EACnB,WAAW;EACX,WAAW;EACZ;AAED,eAAc,UAAU,IAAI,IAAI,SAAS;AACzC,QAAO;;AAGT,eAAsB,cACpB,OAoBA,UAC6B;CAC7B,MAAM,KAAK,QAAQ,KAAK,KAAK;CAC7B,MAAM,sBAAM,IAAI,MAAM;CAGtB,MAAM,gBAAgB,MAAM,KAAK,cAAc,MAAM,QAAQ,CAAC,CAAC,QAC5D,MAAM,EAAE,yBAAyB,MAAM,WACzC;CACD,MAAM,WAAW,MAAM,YAAY,cAAc;CAEjD,MAAMC,OAA2B;EAC/B;EACA,sBAAsB,MAAM;EAC5B,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,MAAM,MAAM;EACZ;EACA,aAAa,MAAM;EACnB,cAAc,MAAM;EACpB,eAAe,MAAM,iBAAiB,EAAE;EACxC,gBAAgB,MAAM;EACtB,WAAW;EACX,WAAW;EACZ;AAED,eAAc,MAAM,IAAI,IAAI,KAAK;AAGjC,KAAI,cAAc,WAAW,KAAK,MAAM,SAAS,SAAS;EACxD,MAAM,WAAW,cAAc,UAAU,IAAI,MAAM,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