@contractspec/example.workflow-system 0.0.0-canary-20260113170453

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 (157) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +124 -0
  3. package/dist/approval/approval.enum.d.ts +14 -0
  4. package/dist/approval/approval.enum.d.ts.map +1 -0
  5. package/dist/approval/approval.enum.js +29 -0
  6. package/dist/approval/approval.enum.js.map +1 -0
  7. package/dist/approval/approval.event.d.ts +131 -0
  8. package/dist/approval/approval.event.d.ts.map +1 -0
  9. package/dist/approval/approval.event.js +220 -0
  10. package/dist/approval/approval.event.js.map +1 -0
  11. package/dist/approval/approval.handler.d.ts +23 -0
  12. package/dist/approval/approval.handler.d.ts.map +1 -0
  13. package/dist/approval/approval.handler.js +72 -0
  14. package/dist/approval/approval.handler.js.map +1 -0
  15. package/dist/approval/approval.operations.d.ts +535 -0
  16. package/dist/approval/approval.operations.d.ts.map +1 -0
  17. package/dist/approval/approval.operations.js +345 -0
  18. package/dist/approval/approval.operations.js.map +1 -0
  19. package/dist/approval/approval.schema.d.ts +100 -0
  20. package/dist/approval/approval.schema.d.ts.map +1 -0
  21. package/dist/approval/approval.schema.js +110 -0
  22. package/dist/approval/approval.schema.js.map +1 -0
  23. package/dist/approval/index.d.ts +5 -0
  24. package/dist/approval/index.js +6 -0
  25. package/dist/docs/index.d.ts +1 -0
  26. package/dist/docs/index.js +1 -0
  27. package/dist/docs/workflow-system.docblock.d.ts +1 -0
  28. package/dist/docs/workflow-system.docblock.js +115 -0
  29. package/dist/docs/workflow-system.docblock.js.map +1 -0
  30. package/dist/entities/approval.d.ts +58 -0
  31. package/dist/entities/approval.d.ts.map +1 -0
  32. package/dist/entities/approval.js +128 -0
  33. package/dist/entities/approval.js.map +1 -0
  34. package/dist/entities/index.d.ts +139 -0
  35. package/dist/entities/index.d.ts.map +1 -0
  36. package/dist/entities/index.js +32 -0
  37. package/dist/entities/index.js.map +1 -0
  38. package/dist/entities/instance.d.ts +69 -0
  39. package/dist/entities/instance.d.ts.map +1 -0
  40. package/dist/entities/instance.js +168 -0
  41. package/dist/entities/instance.js.map +1 -0
  42. package/dist/entities/step.d.ts +50 -0
  43. package/dist/entities/step.d.ts.map +1 -0
  44. package/dist/entities/step.js +135 -0
  45. package/dist/entities/step.js.map +1 -0
  46. package/dist/entities/workflow.d.ts +41 -0
  47. package/dist/entities/workflow.d.ts.map +1 -0
  48. package/dist/entities/workflow.js +102 -0
  49. package/dist/entities/workflow.js.map +1 -0
  50. package/dist/example.d.ts +7 -0
  51. package/dist/example.d.ts.map +1 -0
  52. package/dist/example.js +58 -0
  53. package/dist/example.js.map +1 -0
  54. package/dist/handlers/index.d.ts +2 -0
  55. package/dist/handlers/index.js +3 -0
  56. package/dist/handlers/workflow.handlers.d.ts +122 -0
  57. package/dist/handlers/workflow.handlers.d.ts.map +1 -0
  58. package/dist/handlers/workflow.handlers.js +263 -0
  59. package/dist/handlers/workflow.handlers.js.map +1 -0
  60. package/dist/index.d.ts +26 -0
  61. package/dist/index.js +26 -0
  62. package/dist/instance/index.d.ts +5 -0
  63. package/dist/instance/index.js +6 -0
  64. package/dist/instance/instance.enum.d.ts +10 -0
  65. package/dist/instance/instance.enum.d.ts.map +1 -0
  66. package/dist/instance/instance.enum.js +20 -0
  67. package/dist/instance/instance.enum.js.map +1 -0
  68. package/dist/instance/instance.event.d.ts +356 -0
  69. package/dist/instance/instance.event.d.ts.map +1 -0
  70. package/dist/instance/instance.event.js +293 -0
  71. package/dist/instance/instance.event.js.map +1 -0
  72. package/dist/instance/instance.handler.d.ts +27 -0
  73. package/dist/instance/instance.handler.d.ts.map +1 -0
  74. package/dist/instance/instance.handler.js +94 -0
  75. package/dist/instance/instance.handler.js.map +1 -0
  76. package/dist/instance/instance.operations.d.ts +1024 -0
  77. package/dist/instance/instance.operations.d.ts.map +1 -0
  78. package/dist/instance/instance.operations.js +464 -0
  79. package/dist/instance/instance.operations.js.map +1 -0
  80. package/dist/instance/instance.schema.d.ts +223 -0
  81. package/dist/instance/instance.schema.d.ts.map +1 -0
  82. package/dist/instance/instance.schema.js +172 -0
  83. package/dist/instance/instance.schema.js.map +1 -0
  84. package/dist/presentations/index.d.ts +63 -0
  85. package/dist/presentations/index.d.ts.map +1 -0
  86. package/dist/presentations/index.js +340 -0
  87. package/dist/presentations/index.js.map +1 -0
  88. package/dist/seeders/index.d.ts +10 -0
  89. package/dist/seeders/index.d.ts.map +1 -0
  90. package/dist/seeders/index.js +19 -0
  91. package/dist/seeders/index.js.map +1 -0
  92. package/dist/shared/index.d.ts +3 -0
  93. package/dist/shared/index.js +3 -0
  94. package/dist/shared/mock-data.d.ts +19 -0
  95. package/dist/shared/mock-data.d.ts.map +1 -0
  96. package/dist/shared/mock-data.js +12 -0
  97. package/dist/shared/mock-data.js.map +1 -0
  98. package/dist/shared/types.d.ts +81 -0
  99. package/dist/shared/types.d.ts.map +1 -0
  100. package/dist/shared/types.js +0 -0
  101. package/dist/state-machine/index.d.ts +148 -0
  102. package/dist/state-machine/index.d.ts.map +1 -0
  103. package/dist/state-machine/index.js +158 -0
  104. package/dist/state-machine/index.js.map +1 -0
  105. package/dist/tests/operations.test-spec.d.ts +10 -0
  106. package/dist/tests/operations.test-spec.d.ts.map +1 -0
  107. package/dist/tests/operations.test-spec.js +123 -0
  108. package/dist/tests/operations.test-spec.js.map +1 -0
  109. package/dist/ui/WorkflowDashboard.d.ts +7 -0
  110. package/dist/ui/WorkflowDashboard.d.ts.map +1 -0
  111. package/dist/ui/WorkflowDashboard.js +223 -0
  112. package/dist/ui/WorkflowDashboard.js.map +1 -0
  113. package/dist/ui/hooks/index.d.ts +2 -0
  114. package/dist/ui/hooks/index.js +5 -0
  115. package/dist/ui/hooks/useWorkflowList.d.ts +22 -0
  116. package/dist/ui/hooks/useWorkflowList.d.ts.map +1 -0
  117. package/dist/ui/hooks/useWorkflowList.js +55 -0
  118. package/dist/ui/hooks/useWorkflowList.js.map +1 -0
  119. package/dist/ui/index.d.ts +6 -0
  120. package/dist/ui/index.js +6 -0
  121. package/dist/ui/renderers/index.d.ts +2 -0
  122. package/dist/ui/renderers/index.js +3 -0
  123. package/dist/ui/renderers/workflow.markdown.d.ts +28 -0
  124. package/dist/ui/renderers/workflow.markdown.d.ts.map +1 -0
  125. package/dist/ui/renderers/workflow.markdown.js +234 -0
  126. package/dist/ui/renderers/workflow.markdown.js.map +1 -0
  127. package/dist/workflow/index.d.ts +5 -0
  128. package/dist/workflow/index.js +6 -0
  129. package/dist/workflow/workflow.enum.d.ts +22 -0
  130. package/dist/workflow/workflow.enum.d.ts.map +1 -0
  131. package/dist/workflow/workflow.enum.js +47 -0
  132. package/dist/workflow/workflow.enum.js.map +1 -0
  133. package/dist/workflow/workflow.event.d.ts +135 -0
  134. package/dist/workflow/workflow.event.d.ts.map +1 -0
  135. package/dist/workflow/workflow.event.js +150 -0
  136. package/dist/workflow/workflow.event.js.map +1 -0
  137. package/dist/workflow/workflow.handler.d.ts +29 -0
  138. package/dist/workflow/workflow.handler.d.ts.map +1 -0
  139. package/dist/workflow/workflow.handler.js +66 -0
  140. package/dist/workflow/workflow.handler.js.map +1 -0
  141. package/dist/workflow/workflow.operations.d.ts +1011 -0
  142. package/dist/workflow/workflow.operations.d.ts.map +1 -0
  143. package/dist/workflow/workflow.operations.js +345 -0
  144. package/dist/workflow/workflow.operations.js.map +1 -0
  145. package/dist/workflow/workflow.schema.d.ts +265 -0
  146. package/dist/workflow/workflow.schema.d.ts.map +1 -0
  147. package/dist/workflow/workflow.schema.js +249 -0
  148. package/dist/workflow/workflow.schema.js.map +1 -0
  149. package/dist/workflow-system.capability.d.ts +9 -0
  150. package/dist/workflow-system.capability.d.ts.map +1 -0
  151. package/dist/workflow-system.capability.js +34 -0
  152. package/dist/workflow-system.capability.js.map +1 -0
  153. package/dist/workflow-system.feature.d.ts +12 -0
  154. package/dist/workflow-system.feature.d.ts.map +1 -0
  155. package/dist/workflow-system.feature.js +346 -0
  156. package/dist/workflow-system.feature.js.map +1 -0
  157. package/package.json +133 -0
@@ -0,0 +1,148 @@
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: string;
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: string;
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 };
148
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/state-machine/index.ts"],"sourcesContent":[],"mappings":";;AAaA;AAcA;AA2BA;AAWA;AAuBA;AAWA;AAYA;;;AAQa,UA1GI,oBAAA,CA0GJ;EAOG;EACL,MAAA,EAAA,MAAA;EACE;EAOG,aAAA,EAAA,MAAA;EACL;EAEE,SAAA,CAAA,EAAA,MAAA;EACR;EAOY,YAAA,CAAA,EAAA,MAAA,EAAA;;AAQjB;;;AAKa,UApII,gBAAA,CAoIJ;EA6DG,GAAA,EAAA,MAAA;EACL,IAAA,EAAA,MAAA;EACE,IAAA,EAAA,OAAA,GAAA,UAAA,GAAA,MAAA,GAAA,WAAA,GAAA,UAAA,GAAA,MAAA,GAAA,QAAA,GAAA,KAAA;EAkBG;EACL,WAAA,EAzMI,MAyMJ,CAAA,MAAA,EAAA,MAAA,GAzM4B,oBAyM5B,CAAA;EAEE;EACR,YAAA,CAAA,EAAA,KAAA,GAAA,KAAA,GAAA,UAAA,GAAA,YAAA;EAgEY;EA1J+B,YAAA,CAAA,EAAA,MAAA,EAAA;EAAmB;EA4MnD,cAAA,CAAA,EAAA,MAAA;EASA;EAWyB,mBAAA,CAAA,EAAA,MAAA;;;;AAsCzC;AACc,UA3WG,sBAAA,CA2WH;EACC,GAAA,EAAA,MAAA;EACZ,IAAA,EAAA,MAAA;EAAiB,OAAA,EAAA,MAAA;;SAxWX,eAAe;;;;;UAMP,iBAAA;;;eAWF;;;;eAIA;;;;;;;UAQE,gBAAA;;;;UAIP;;;;;;UAOO,iBAAA;;;SAGR;;;;;;UASQ,mBAAA;;;;4BAKD,+BACL,4CAEE;;;;;;;kCAOG,+BACL,4BACE;;;;yBAOG,+BACL,4CAEE,oBACR;;;;qDAOY;;;;;;cAQJ,uBAAA,YAAmC;4BAEhC,+BACL,4CAEE;;;;kCA6DG,+BACL,4BACE;yBAkBG,+BACL,4CAEE,oBACR;qDAgEY;;;;;iBAkDD,wBAAA,CAAA,GAA4B;;;;iBAS5B,2BAAA;;;;;;;;;eAWC,wBAAwB;;;;;MAMtC;;;;iBAgCa,kBAAA,aACF,sCACC,0BACZ"}
@@ -0,0 +1,158 @@
1
+ //#region src/state-machine/index.ts
2
+ /**
3
+ * Basic state machine engine implementation.
4
+ * This is a reference implementation for spec validation.
5
+ */
6
+ var BasicStateMachineEngine = class {
7
+ canTransition(definition, state, action, context) {
8
+ if (state.status !== "RUNNING" && state.status !== "WAITING") return {
9
+ allowed: false,
10
+ reason: `Workflow is ${state.status}, cannot transition`
11
+ };
12
+ const currentStep = definition.steps[state.currentStepKey];
13
+ if (!currentStep) return {
14
+ allowed: false,
15
+ reason: `Step ${state.currentStepKey} not found`
16
+ };
17
+ const transition = currentStep.transitions[action];
18
+ if (!transition) return {
19
+ allowed: false,
20
+ reason: `Action ${action} not available in step ${state.currentStepKey}`
21
+ };
22
+ if (currentStep.allowedRoles && currentStep.allowedRoles.length > 0) {
23
+ if (!currentStep.allowedRoles.some((role) => context.userRoles.includes(role))) return {
24
+ allowed: false,
25
+ reason: `User lacks required role for this action`
26
+ };
27
+ }
28
+ if (typeof transition === "object" && transition.allowedRoles && transition.allowedRoles.length > 0) {
29
+ if (!transition.allowedRoles.some((role) => context.userRoles.includes(role))) return {
30
+ allowed: false,
31
+ reason: `User lacks required role for action ${action}`
32
+ };
33
+ }
34
+ return { allowed: true };
35
+ }
36
+ getAvailableActions(definition, state, context) {
37
+ if (state.status !== "RUNNING" && state.status !== "WAITING") return [];
38
+ const currentStep = definition.steps[state.currentStepKey];
39
+ if (!currentStep) return [];
40
+ return Object.keys(currentStep.transitions).filter((action) => {
41
+ return this.canTransition(definition, state, action, context).allowed;
42
+ });
43
+ }
44
+ transition(definition, state, action, context) {
45
+ const validation = this.canTransition(definition, state, action, context);
46
+ if (!validation.allowed) return {
47
+ success: false,
48
+ previousStepKey: state.currentStepKey,
49
+ currentStepKey: state.currentStepKey,
50
+ status: state.status,
51
+ error: validation.reason
52
+ };
53
+ const currentStep = definition.steps[state.currentStepKey];
54
+ if (!currentStep) return {
55
+ success: false,
56
+ previousStepKey: state.currentStepKey,
57
+ currentStepKey: state.currentStepKey,
58
+ status: state.status,
59
+ error: `Current step ${state.currentStepKey} not found`
60
+ };
61
+ const transition = currentStep.transitions[action];
62
+ if (!transition) return {
63
+ success: false,
64
+ previousStepKey: state.currentStepKey,
65
+ currentStepKey: state.currentStepKey,
66
+ status: state.status,
67
+ error: `Transition for action ${action} not found`
68
+ };
69
+ const targetStepKey = typeof transition === "string" ? transition : transition.targetStepKey;
70
+ const targetStep = definition.steps[targetStepKey];
71
+ if (!targetStep) return {
72
+ success: false,
73
+ previousStepKey: state.currentStepKey,
74
+ currentStepKey: state.currentStepKey,
75
+ status: state.status,
76
+ error: `Target step ${targetStepKey} not found`
77
+ };
78
+ let newStatus = "RUNNING";
79
+ if (targetStep.type === "END") newStatus = "COMPLETED";
80
+ else if (targetStep.type === "APPROVAL" || targetStep.type === "WAIT") newStatus = "WAITING";
81
+ return {
82
+ success: true,
83
+ previousStepKey: state.currentStepKey,
84
+ currentStepKey: targetStepKey,
85
+ status: newStatus
86
+ };
87
+ }
88
+ evaluateCondition(expression, contextData) {
89
+ try {
90
+ const match = expression.match(/^(\w+)\s*(>=|<=|>|<|===|!==|==|!=)\s*(.+)$/);
91
+ if (match) {
92
+ const [, prop, operator, value] = match;
93
+ if (!prop || !operator || value === void 0) return false;
94
+ const propValue = contextData[prop];
95
+ const compareValue = JSON.parse(value);
96
+ switch (operator) {
97
+ case ">": return Number(propValue) > Number(compareValue);
98
+ case "<": return Number(propValue) < Number(compareValue);
99
+ case ">=": return Number(propValue) >= Number(compareValue);
100
+ case "<=": return Number(propValue) <= Number(compareValue);
101
+ case "===":
102
+ case "==": return propValue === compareValue;
103
+ case "!==":
104
+ case "!=": return propValue !== compareValue;
105
+ }
106
+ }
107
+ if (expression in contextData) return Boolean(contextData[expression]);
108
+ return false;
109
+ } catch {
110
+ return false;
111
+ }
112
+ }
113
+ };
114
+ /**
115
+ * Create a new state machine engine instance.
116
+ */
117
+ function createStateMachineEngine() {
118
+ return new BasicStateMachineEngine();
119
+ }
120
+ /**
121
+ * Build a state machine definition from workflow entities.
122
+ */
123
+ function buildStateMachineDefinition(workflow, steps) {
124
+ const stepMap = {};
125
+ for (const step of steps) stepMap[step.key] = {
126
+ key: step.key,
127
+ name: step.name,
128
+ type: step.type,
129
+ transitions: step.transitions,
130
+ approvalMode: step.approvalMode,
131
+ allowedRoles: step.approverRoles,
132
+ timeoutSeconds: step.timeoutSeconds,
133
+ conditionExpression: step.conditionExpression
134
+ };
135
+ const initialStepKey = steps.find((s) => s.type === "START")?.key ?? steps[0]?.key ?? "";
136
+ return {
137
+ key: workflow.key,
138
+ name: workflow.name,
139
+ version: workflow.version,
140
+ initialStepKey,
141
+ steps: stepMap
142
+ };
143
+ }
144
+ /**
145
+ * Create initial state for a new workflow instance.
146
+ */
147
+ function createInitialState(definition, contextData = {}) {
148
+ return {
149
+ currentStepKey: definition.initialStepKey,
150
+ status: "RUNNING",
151
+ contextData,
152
+ history: []
153
+ };
154
+ }
155
+
156
+ //#endregion
157
+ export { BasicStateMachineEngine, buildStateMachineDefinition, createInitialState, createStateMachineEngine };
158
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"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":"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"}
@@ -0,0 +1,10 @@
1
+ import * as _contractspec_lib_contracts51 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/tests/operations.test-spec.d.ts
4
+ declare const DefinitionListTest: _contractspec_lib_contracts51.TestSpec;
5
+ declare const InstanceListTest: _contractspec_lib_contracts51.TestSpec;
6
+ declare const ApprovalListMineTest: _contractspec_lib_contracts51.TestSpec;
7
+ declare const ApprovalDecideTest: _contractspec_lib_contracts51.TestSpec;
8
+ //#endregion
9
+ export { ApprovalDecideTest, ApprovalListMineTest, DefinitionListTest, InstanceListTest };
10
+ //# sourceMappingURL=operations.test-spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.test-spec.d.ts","names":[],"sources":["../../src/tests/operations.test-spec.ts"],"sourcesContent":[],"mappings":";;;cAEa,oBAyBX,6BAAA,CAzB6B;cA2BlB,kBAyBX,6BAAA,CAzB2B;cA2BhB,sBAyBX,6BAAA,CAzB+B;AAtDpB,cAiFA,kBAxDX,EAiFA,6BAAA,CAzB6B,QAxD7B"}
@@ -0,0 +1,123 @@
1
+ import { defineTestSpec } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/tests/operations.test-spec.ts
4
+ const DefinitionListTest = defineTestSpec({
5
+ meta: {
6
+ key: "workflow.definition.list.test",
7
+ version: "1.0.0",
8
+ stability: "experimental",
9
+ owners: ["@example.workflow-system"],
10
+ description: "Test for listing workflow definitions",
11
+ tags: ["test"]
12
+ },
13
+ target: {
14
+ type: "operation",
15
+ operation: {
16
+ key: "workflow.definition.list",
17
+ version: "1.0.0"
18
+ }
19
+ },
20
+ scenarios: [{
21
+ key: "success",
22
+ when: { operation: { key: "workflow.definition.list" } },
23
+ then: [{
24
+ type: "expectOutput",
25
+ match: {}
26
+ }]
27
+ }, {
28
+ key: "error",
29
+ when: { operation: { key: "workflow.definition.list" } },
30
+ then: [{ type: "expectError" }]
31
+ }]
32
+ });
33
+ const InstanceListTest = defineTestSpec({
34
+ meta: {
35
+ key: "workflow.instance.list.test",
36
+ version: "1.0.0",
37
+ stability: "experimental",
38
+ owners: ["@example.workflow-system"],
39
+ description: "Test for listing workflow instances",
40
+ tags: ["test"]
41
+ },
42
+ target: {
43
+ type: "operation",
44
+ operation: {
45
+ key: "workflow.instance.list",
46
+ version: "1.0.0"
47
+ }
48
+ },
49
+ scenarios: [{
50
+ key: "success",
51
+ when: { operation: { key: "workflow.instance.list" } },
52
+ then: [{
53
+ type: "expectOutput",
54
+ match: {}
55
+ }]
56
+ }, {
57
+ key: "error",
58
+ when: { operation: { key: "workflow.instance.list" } },
59
+ then: [{ type: "expectError" }]
60
+ }]
61
+ });
62
+ const ApprovalListMineTest = defineTestSpec({
63
+ meta: {
64
+ key: "workflow.approval.list.mine.test",
65
+ version: "1.0.0",
66
+ stability: "experimental",
67
+ owners: ["@example.workflow-system"],
68
+ description: "Test for listing my approvals",
69
+ tags: ["test"]
70
+ },
71
+ target: {
72
+ type: "operation",
73
+ operation: {
74
+ key: "workflow.approval.list.mine",
75
+ version: "1.0.0"
76
+ }
77
+ },
78
+ scenarios: [{
79
+ key: "success",
80
+ when: { operation: { key: "workflow.approval.list.mine" } },
81
+ then: [{
82
+ type: "expectOutput",
83
+ match: {}
84
+ }]
85
+ }, {
86
+ key: "error",
87
+ when: { operation: { key: "workflow.approval.list.mine" } },
88
+ then: [{ type: "expectError" }]
89
+ }]
90
+ });
91
+ const ApprovalDecideTest = defineTestSpec({
92
+ meta: {
93
+ key: "workflow.approval.decide.test",
94
+ version: "1.0.0",
95
+ stability: "experimental",
96
+ owners: ["@example.workflow-system"],
97
+ description: "Test for deciding on approval",
98
+ tags: ["test"]
99
+ },
100
+ target: {
101
+ type: "operation",
102
+ operation: {
103
+ key: "workflow.approval.decide",
104
+ version: "1.0.0"
105
+ }
106
+ },
107
+ scenarios: [{
108
+ key: "success",
109
+ when: { operation: { key: "workflow.approval.decide" } },
110
+ then: [{
111
+ type: "expectOutput",
112
+ match: {}
113
+ }]
114
+ }, {
115
+ key: "error",
116
+ when: { operation: { key: "workflow.approval.decide" } },
117
+ then: [{ type: "expectError" }]
118
+ }]
119
+ });
120
+
121
+ //#endregion
122
+ export { ApprovalDecideTest, ApprovalListMineTest, DefinitionListTest, InstanceListTest };
123
+ //# sourceMappingURL=operations.test-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.test-spec.js","names":[],"sources":["../../src/tests/operations.test-spec.ts"],"sourcesContent":["import { defineTestSpec } from '@contractspec/lib.contracts';\n\nexport const DefinitionListTest = defineTestSpec({\n meta: {\n key: 'workflow.definition.list.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.workflow-system'],\n description: 'Test for listing workflow definitions',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'workflow.definition.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'workflow.definition.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'workflow.definition.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const InstanceListTest = defineTestSpec({\n meta: {\n key: 'workflow.instance.list.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.workflow-system'],\n description: 'Test for listing workflow instances',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'workflow.instance.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'workflow.instance.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'workflow.instance.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const ApprovalListMineTest = defineTestSpec({\n meta: {\n key: 'workflow.approval.list.mine.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.workflow-system'],\n description: 'Test for listing my approvals',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'workflow.approval.list.mine', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'workflow.approval.list.mine' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'workflow.approval.list.mine' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const ApprovalDecideTest = defineTestSpec({\n meta: {\n key: 'workflow.approval.decide.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.workflow-system'],\n description: 'Test for deciding on approval',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'workflow.approval.decide', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'workflow.approval.decide' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'workflow.approval.decide' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n"],"mappings":";;;AAEA,MAAa,qBAAqB,eAAe;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,2BAA2B;EACpC,aAAa;EACb,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAA4B,SAAS;GAAS;EACjE;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,4BAA4B,EAAE;EACxD,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,4BAA4B,EAAE;EACxD,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC;AAEF,MAAa,mBAAmB,eAAe;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,2BAA2B;EACpC,aAAa;EACb,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAA0B,SAAS;GAAS;EAC/D;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,0BAA0B,EAAE;EACtD,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,0BAA0B,EAAE;EACtD,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC;AAEF,MAAa,uBAAuB,eAAe;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,2BAA2B;EACpC,aAAa;EACb,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAA+B,SAAS;GAAS;EACpE;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,+BAA+B,EAAE;EAC3D,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,+BAA+B,EAAE;EAC3D,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC;AAEF,MAAa,qBAAqB,eAAe;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,2BAA2B;EACpC,aAAa;EACb,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAA4B,SAAS;GAAS;EACjE;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,4BAA4B,EAAE;EACxD,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,4BAA4B,EAAE;EACxD,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+
3
+ //#region src/ui/WorkflowDashboard.d.ts
4
+ declare function WorkflowDashboard(): react_jsx_runtime0.JSX.Element;
5
+ //#endregion
6
+ export { WorkflowDashboard };
7
+ //# sourceMappingURL=WorkflowDashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowDashboard.d.ts","names":[],"sources":["../../src/ui/WorkflowDashboard.tsx"],"sourcesContent":[],"mappings":";;;iBAmCgB,iBAAA,CAAA,GAAiB,kBAAA,CAAA,GAAA,CAAA"}