@lssm/example.workflow-system 0.0.0-canary-20251217080011 → 1.41.0

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 (187) hide show
  1. package/dist/approval/approval.contracts.js +1 -250
  2. package/dist/approval/approval.enum.js +1 -29
  3. package/dist/approval/approval.event.js +1 -186
  4. package/dist/approval/approval.handler.js +1 -71
  5. package/dist/approval/approval.schema.js +1 -111
  6. package/dist/approval/index.js +1 -6
  7. package/dist/docs/index.js +1 -1
  8. package/dist/docs/workflow-system.docblock.js +5 -61
  9. package/dist/entities/approval.js +1 -128
  10. package/dist/entities/index.js +1 -31
  11. package/dist/entities/instance.js +1 -168
  12. package/dist/entities/step.js +1 -135
  13. package/dist/entities/workflow.js +1 -102
  14. package/dist/example.js +1 -50
  15. package/dist/index.js +1 -19
  16. package/dist/instance/index.js +1 -6
  17. package/dist/instance/instance.contracts.js +1 -334
  18. package/dist/instance/instance.enum.js +1 -20
  19. package/dist/instance/instance.event.js +1 -214
  20. package/dist/instance/instance.handler.js +1 -93
  21. package/dist/instance/instance.schema.js +1 -173
  22. package/dist/presentations/index.js +1 -291
  23. package/dist/shared/index.js +1 -3
  24. package/dist/shared/mock-data.js +1 -11
  25. package/dist/state-machine/index.js +1 -157
  26. package/dist/workflow/index.js +1 -6
  27. package/dist/workflow/workflow.contracts.js +1 -239
  28. package/dist/workflow/workflow.enum.js +1 -47
  29. package/dist/workflow/workflow.event.js +1 -116
  30. package/dist/workflow/workflow.handler.js +1 -65
  31. package/dist/workflow/workflow.schema.js +1 -250
  32. package/dist/workflow-system.feature.js +1 -337
  33. package/package.json +44 -45
  34. package/dist/approval/approval.contracts.d.ts +0 -534
  35. package/dist/approval/approval.enum.d.ts +0 -13
  36. package/dist/approval/approval.event.d.ts +0 -130
  37. package/dist/approval/approval.handler.d.ts +0 -22
  38. package/dist/approval/approval.schema.d.ts +0 -99
  39. package/dist/approval/index.d.ts +0 -5
  40. package/dist/docs/index.d.ts +0 -1
  41. package/dist/docs/workflow-system.docblock.d.ts +0 -1
  42. package/dist/entities/approval.d.ts +0 -57
  43. package/dist/entities/index.d.ts +0 -138
  44. package/dist/entities/instance.d.ts +0 -68
  45. package/dist/entities/step.d.ts +0 -49
  46. package/dist/entities/workflow.d.ts +0 -40
  47. package/dist/example.d.ts +0 -39
  48. package/dist/index.d.ts +0 -16
  49. package/dist/instance/index.d.ts +0 -5
  50. package/dist/instance/instance.contracts.d.ts +0 -1023
  51. package/dist/instance/instance.enum.d.ts +0 -9
  52. package/dist/instance/instance.event.d.ts +0 -355
  53. package/dist/instance/instance.handler.d.ts +0 -26
  54. package/dist/instance/instance.schema.d.ts +0 -222
  55. package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
  56. package/dist/libs/contracts/dist/client/index.js +0 -5
  57. package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
  58. package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
  59. package/dist/libs/contracts/dist/client/react/index.js +0 -4
  60. package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
  61. package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
  62. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  63. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  64. package/dist/libs/contracts/dist/docs/index.js +0 -29
  65. package/dist/libs/contracts/dist/docs/presentations.js +0 -71
  66. package/dist/libs/contracts/dist/docs/registry.js +0 -44
  67. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  68. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  69. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  70. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  71. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  72. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  73. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  74. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  75. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  76. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  77. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  78. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  79. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  80. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  81. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  82. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  83. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  84. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  85. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  86. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  87. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  88. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  89. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  90. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  91. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  92. package/dist/libs/contracts/dist/events.js +0 -10
  93. package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
  94. package/dist/libs/contracts/dist/index.js +0 -71
  95. package/dist/libs/contracts/dist/install.js +0 -2
  96. package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
  97. package/dist/libs/contracts/dist/integrations/index.js +0 -18
  98. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  99. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  100. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  101. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  102. package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
  103. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  104. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  105. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  106. package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
  107. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
  108. package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
  109. package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
  110. package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
  111. package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
  112. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
  113. package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
  114. package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
  115. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  116. package/dist/libs/contracts/dist/jsonschema.js +0 -1
  117. package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
  118. package/dist/libs/contracts/dist/knowledge/index.js +0 -7
  119. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  120. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  121. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  122. package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
  123. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  124. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  125. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  126. package/dist/libs/contracts/dist/llm/exporters.js +0 -19
  127. package/dist/libs/contracts/dist/llm/index.js +0 -2
  128. package/dist/libs/contracts/dist/llm/prompts.js +0 -1
  129. package/dist/libs/contracts/dist/onboarding-base.js +0 -196
  130. package/dist/libs/contracts/dist/openapi.js +0 -1
  131. package/dist/libs/contracts/dist/ownership.js +0 -21
  132. package/dist/libs/contracts/dist/presentations.js +0 -1
  133. package/dist/libs/contracts/dist/presentations.v2.js +0 -11
  134. package/dist/libs/contracts/dist/prompt.js +0 -1
  135. package/dist/libs/contracts/dist/promptRegistry.js +0 -1
  136. package/dist/libs/contracts/dist/regenerator/index.js +0 -1
  137. package/dist/libs/contracts/dist/regenerator/service.js +0 -6
  138. package/dist/libs/contracts/dist/registry.js +0 -2
  139. package/dist/libs/contracts/dist/resources.js +0 -1
  140. package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
  141. package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
  142. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  143. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -39
  144. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  145. package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
  146. package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
  147. package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
  148. package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
  149. package/dist/libs/contracts/dist/server/index.js +0 -8
  150. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
  151. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
  152. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
  153. package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
  154. package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
  155. package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
  156. package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
  157. package/dist/libs/contracts/dist/server/rest-express.js +0 -1
  158. package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
  159. package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
  160. package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
  161. package/dist/libs/contracts/dist/spec.js +0 -34
  162. package/dist/libs/contracts/dist/telemetry/index.js +0 -1
  163. package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
  164. package/dist/libs/contracts/dist/tests/index.js +0 -1
  165. package/dist/libs/contracts/dist/tests/runner.js +0 -2
  166. package/dist/libs/contracts/dist/workflow/index.js +0 -1
  167. package/dist/libs/contracts/dist/workflow/runner.js +0 -1
  168. package/dist/libs/schema/dist/EnumType.js +0 -56
  169. package/dist/libs/schema/dist/FieldType.js +0 -49
  170. package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -236
  171. package/dist/libs/schema/dist/SchemaModel.js +0 -39
  172. package/dist/libs/schema/dist/entity/defineEntity.js +0 -236
  173. package/dist/libs/schema/dist/entity/index.js +0 -2
  174. package/dist/libs/schema/dist/entity/types.js +0 -1
  175. package/dist/libs/schema/dist/index.js +0 -6
  176. package/dist/presentations/index.d.ts +0 -63
  177. package/dist/shared/index.d.ts +0 -3
  178. package/dist/shared/mock-data.d.ts +0 -18
  179. package/dist/shared/types.d.ts +0 -80
  180. package/dist/state-machine/index.d.ts +0 -147
  181. package/dist/workflow/index.d.ts +0 -5
  182. package/dist/workflow/workflow.contracts.d.ts +0 -1010
  183. package/dist/workflow/workflow.enum.d.ts +0 -21
  184. package/dist/workflow/workflow.event.d.ts +0 -134
  185. package/dist/workflow/workflow.handler.d.ts +0 -28
  186. package/dist/workflow/workflow.schema.d.ts +0 -264
  187. package/dist/workflow-system.feature.d.ts +0 -11
@@ -1,63 +0,0 @@
1
- import { PresentationDescriptorV2 } from "@lssm/lib.contracts";
2
-
3
- //#region src/presentations/index.d.ts
4
-
5
- /**
6
- * Workflow designer canvas for building workflows.
7
- */
8
- declare const WorkflowDesignerPresentation: PresentationDescriptorV2;
9
- /**
10
- * List of workflow definitions.
11
- */
12
- declare const WorkflowListPresentation: PresentationDescriptorV2;
13
- /**
14
- * Workflow definition detail view.
15
- */
16
- declare const WorkflowDetailPresentation: PresentationDescriptorV2;
17
- /**
18
- * List of running workflow instances.
19
- */
20
- declare const InstanceListPresentation: PresentationDescriptorV2;
21
- /**
22
- * Workflow instance detail view with timeline.
23
- */
24
- declare const InstanceDetailPresentation: PresentationDescriptorV2;
25
- /**
26
- * Workflow progress tracker widget.
27
- */
28
- declare const ProgressTrackerPresentation: PresentationDescriptorV2;
29
- /**
30
- * Approval inbox - list of pending approvals.
31
- */
32
- declare const ApprovalInboxPresentation: PresentationDescriptorV2;
33
- /**
34
- * Approval request detail view.
35
- */
36
- declare const ApprovalDetailPresentation: PresentationDescriptorV2;
37
- /**
38
- * Approval decision form.
39
- */
40
- declare const ApprovalFormPresentation: PresentationDescriptorV2;
41
- /**
42
- * Pending approvals count badge.
43
- */
44
- declare const PendingApprovalsBadgePresentation: PresentationDescriptorV2;
45
- /**
46
- * Workflow metrics dashboard widget.
47
- */
48
- declare const WorkflowMetricsPresentation: PresentationDescriptorV2;
49
- declare const WorkflowSystemPresentations: {
50
- WorkflowDesignerPresentation: PresentationDescriptorV2;
51
- WorkflowListPresentation: PresentationDescriptorV2;
52
- WorkflowDetailPresentation: PresentationDescriptorV2;
53
- InstanceListPresentation: PresentationDescriptorV2;
54
- InstanceDetailPresentation: PresentationDescriptorV2;
55
- ProgressTrackerPresentation: PresentationDescriptorV2;
56
- ApprovalInboxPresentation: PresentationDescriptorV2;
57
- ApprovalDetailPresentation: PresentationDescriptorV2;
58
- ApprovalFormPresentation: PresentationDescriptorV2;
59
- PendingApprovalsBadgePresentation: PresentationDescriptorV2;
60
- WorkflowMetricsPresentation: PresentationDescriptorV2;
61
- };
62
- //#endregion
63
- export { ApprovalDetailPresentation, ApprovalFormPresentation, ApprovalInboxPresentation, InstanceDetailPresentation, InstanceListPresentation, PendingApprovalsBadgePresentation, ProgressTrackerPresentation, WorkflowDesignerPresentation, WorkflowDetailPresentation, WorkflowListPresentation, WorkflowMetricsPresentation, WorkflowSystemPresentations };
@@ -1,3 +0,0 @@
1
- import { ApprovalRequestRecord, HandlerContext, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord } from "./types.js";
2
- import { mockDataStore } from "./mock-data.js";
3
- export { ApprovalRequestRecord, HandlerContext, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord, mockDataStore };
@@ -1,18 +0,0 @@
1
- import { ApprovalRequestRecord, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord } from "./types.js";
2
-
3
- //#region src/shared/mock-data.d.ts
4
-
5
- declare const mockDataStore: {
6
- workflows: Map<string, WorkflowDefinitionRecord>;
7
- steps: Map<string, WorkflowStepRecord>;
8
- instances: Map<string, WorkflowInstanceRecord>;
9
- approvals: Map<string, ApprovalRequestRecord>;
10
- stepExecutions: Map<string, {
11
- id: string;
12
- instanceId: string;
13
- stepId: string;
14
- status: string;
15
- }>;
16
- };
17
- //#endregion
18
- export { mockDataStore };
@@ -1,80 +0,0 @@
1
- //#region src/shared/types.d.ts
2
- /**
3
- * Shared types for workflow system handlers.
4
- */
5
- interface WorkflowDefinitionRecord {
6
- id: string;
7
- key: string;
8
- name: string;
9
- description?: string;
10
- version: number;
11
- status: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'ARCHIVED';
12
- triggerType: 'MANUAL' | 'EVENT' | 'SCHEDULED' | 'API';
13
- initialStepId?: string;
14
- featureFlagKey?: string;
15
- organizationId: string;
16
- createdBy: string;
17
- createdAt: Date;
18
- updatedAt: Date;
19
- publishedAt?: Date;
20
- }
21
- interface WorkflowStepRecord {
22
- id: string;
23
- workflowDefinitionId: string;
24
- key: string;
25
- name: string;
26
- description?: string;
27
- type: 'START' | 'APPROVAL' | 'TASK' | 'CONDITION' | 'PARALLEL' | 'WAIT' | 'ACTION' | 'END';
28
- position: number;
29
- transitions: Record<string, string>;
30
- approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';
31
- approverRoles: string[];
32
- timeoutSeconds?: number;
33
- createdAt: Date;
34
- updatedAt: Date;
35
- }
36
- interface WorkflowInstanceRecord {
37
- id: string;
38
- workflowDefinitionId: string;
39
- referenceId?: string;
40
- referenceType?: string;
41
- status: 'PENDING' | 'RUNNING' | 'WAITING' | 'PAUSED' | 'COMPLETED' | 'CANCELLED' | 'FAILED' | 'TIMEOUT';
42
- currentStepId?: string;
43
- contextData: Record<string, unknown>;
44
- triggeredBy: string;
45
- organizationId: string;
46
- priority: number;
47
- dueAt?: Date;
48
- outcome?: string;
49
- resultData?: Record<string, unknown>;
50
- errorMessage?: string;
51
- createdAt: Date;
52
- updatedAt: Date;
53
- startedAt?: Date;
54
- completedAt?: Date;
55
- }
56
- interface ApprovalRequestRecord {
57
- id: string;
58
- workflowInstanceId: string;
59
- stepExecutionId: string;
60
- approverId: string;
61
- approverRole?: string;
62
- title: string;
63
- description?: string;
64
- status: 'PENDING' | 'APPROVED' | 'REJECTED' | 'DELEGATED' | 'ESCALATED' | 'WITHDRAWN' | 'EXPIRED';
65
- decision?: 'APPROVE' | 'REJECT' | 'REQUEST_CHANGES' | 'DELEGATE' | 'ABSTAIN';
66
- decisionComment?: string;
67
- decidedAt?: Date;
68
- dueAt?: Date;
69
- contextSnapshot?: Record<string, unknown>;
70
- sequenceOrder: number;
71
- createdAt: Date;
72
- updatedAt: Date;
73
- }
74
- interface HandlerContext {
75
- userId: string;
76
- userRoles: string[];
77
- organizationId: string;
78
- }
79
- //#endregion
80
- export { ApprovalRequestRecord, HandlerContext, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord };
@@ -1,147 +0,0 @@
1
- //#region src/state-machine/index.d.ts
2
- /**
3
- * Workflow State Machine Engine
4
- *
5
- * Provides state machine logic for workflow transitions.
6
- * This is a spec-level abstraction that defines the interface
7
- * for workflow state transitions.
8
- */
9
- /**
10
- * Represents a transition definition in a workflow step.
11
- */
12
- interface TransitionDefinition {
13
- /** The action that triggers this transition (e.g., "approve", "reject") */
14
- action: string;
15
- /** The target step key to transition to */
16
- targetStepKey: string;
17
- /** Optional condition expression for conditional transitions */
18
- condition?: string;
19
- /** Optional guard roles - only users with these roles can take this action */
20
- allowedRoles?: string[];
21
- }
22
- /**
23
- * Step definition for state machine.
24
- */
25
- interface StateMachineStep {
26
- key: string;
27
- name: string;
28
- type: 'START' | 'APPROVAL' | 'TASK' | 'CONDITION' | 'PARALLEL' | 'WAIT' | 'ACTION' | 'END';
29
- /** Map of action -> transition definition */
30
- transitions: Record<string, string | TransitionDefinition>;
31
- /** For approval steps: how approvals are handled */
32
- approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';
33
- /** Roles that can approve/act on this step */
34
- allowedRoles?: string[];
35
- /** Timeout in seconds */
36
- timeoutSeconds?: number;
37
- /** Condition expression for CONDITION type */
38
- conditionExpression?: string;
39
- }
40
- /**
41
- * Workflow state machine definition.
42
- */
43
- interface StateMachineDefinition {
44
- key: string;
45
- name: string;
46
- version: number;
47
- initialStepKey: string;
48
- steps: Record<string, StateMachineStep>;
49
- }
50
- /**
51
- * Current state of an instance.
52
- */
53
- interface StateMachineState {
54
- currentStepKey: string;
55
- status: 'PENDING' | 'RUNNING' | 'WAITING' | 'PAUSED' | 'COMPLETED' | 'CANCELLED' | 'FAILED' | 'TIMEOUT';
56
- contextData: Record<string, unknown>;
57
- history: {
58
- stepKey: string;
59
- action: string;
60
- timestamp: Date;
61
- executedBy: string;
62
- }[];
63
- }
64
- /**
65
- * Result of a transition attempt.
66
- */
67
- interface TransitionResult {
68
- success: boolean;
69
- previousStepKey: string;
70
- currentStepKey: string | null;
71
- status: StateMachineState['status'];
72
- error?: string;
73
- }
74
- /**
75
- * Context for transition validation.
76
- */
77
- interface TransitionContext {
78
- userId: string;
79
- userRoles: string[];
80
- data?: Record<string, unknown>;
81
- }
82
- /**
83
- * State machine engine interface.
84
- * Implementation should be provided at runtime.
85
- */
86
- interface IStateMachineEngine {
87
- /**
88
- * Validate that a transition is allowed.
89
- */
90
- canTransition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): {
91
- allowed: boolean;
92
- reason?: string;
93
- };
94
- /**
95
- * Get available actions for the current step.
96
- */
97
- getAvailableActions(definition: StateMachineDefinition, state: StateMachineState, context: TransitionContext): string[];
98
- /**
99
- * Execute a transition.
100
- */
101
- transition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): TransitionResult;
102
- /**
103
- * Evaluate a condition expression.
104
- */
105
- evaluateCondition(expression: string, contextData: Record<string, unknown>): boolean;
106
- }
107
- /**
108
- * Basic state machine engine implementation.
109
- * This is a reference implementation for spec validation.
110
- */
111
- declare class BasicStateMachineEngine implements IStateMachineEngine {
112
- canTransition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): {
113
- allowed: boolean;
114
- reason?: string;
115
- };
116
- getAvailableActions(definition: StateMachineDefinition, state: StateMachineState, context: TransitionContext): string[];
117
- transition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): TransitionResult;
118
- evaluateCondition(expression: string, contextData: Record<string, unknown>): boolean;
119
- }
120
- /**
121
- * Create a new state machine engine instance.
122
- */
123
- declare function createStateMachineEngine(): IStateMachineEngine;
124
- /**
125
- * Build a state machine definition from workflow entities.
126
- */
127
- declare function buildStateMachineDefinition(workflow: {
128
- key: string;
129
- name: string;
130
- version: number;
131
- initialStepId: string | null;
132
- }, steps: {
133
- key: string;
134
- name: string;
135
- type: string;
136
- transitions: Record<string, string | TransitionDefinition>;
137
- approvalMode?: string;
138
- approverRoles?: string[];
139
- timeoutSeconds?: number;
140
- conditionExpression?: string;
141
- }[]): StateMachineDefinition;
142
- /**
143
- * Create initial state for a new workflow instance.
144
- */
145
- declare function createInitialState(definition: StateMachineDefinition, contextData?: Record<string, unknown>): StateMachineState;
146
- //#endregion
147
- export { BasicStateMachineEngine, IStateMachineEngine, StateMachineDefinition, StateMachineState, StateMachineStep, TransitionContext, TransitionDefinition, TransitionResult, buildStateMachineDefinition, createInitialState, createStateMachineEngine };
@@ -1,5 +0,0 @@
1
- import { ApprovalModeEnum, StepTypeEnum, TriggerTypeEnum, WorkflowStatusEnum } from "./workflow.enum.js";
2
- import { AddStepInputModel, CreateWorkflowInputModel, UpdateWorkflowInputModel, WorkflowDefinitionModel, WorkflowStepModel } from "./workflow.schema.js";
3
- import { AddStepContract, CreateWorkflowContract, GetWorkflowContract, ListWorkflowsContract, PublishWorkflowContract, UpdateWorkflowContract } from "./workflow.contracts.js";
4
- import { StepAddedEvent, WorkflowCreatedEvent, WorkflowPublishedEvent, WorkflowUpdatedEvent } from "./workflow.event.js";
5
- export { AddStepContract, AddStepInputModel, ApprovalModeEnum, CreateWorkflowContract, CreateWorkflowInputModel, GetWorkflowContract, ListWorkflowsContract, PublishWorkflowContract, StepAddedEvent, StepTypeEnum, TriggerTypeEnum, UpdateWorkflowContract, UpdateWorkflowInputModel, WorkflowCreatedEvent, WorkflowDefinitionModel, WorkflowPublishedEvent, WorkflowStatusEnum, WorkflowStepModel, WorkflowUpdatedEvent };