@contractspec/example.workflow-system 1.46.1 → 1.47.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 (85) 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 +32 -32
  4. package/dist/approval/approval.event.d.ts.map +1 -1
  5. package/dist/approval/approval.event.js +5 -5
  6. package/dist/approval/approval.event.js.map +1 -1
  7. package/dist/approval/approval.handler.js.map +1 -1
  8. package/dist/approval/approval.operations.d.ts +134 -134
  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.js.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/example.d.ts +2 -2
  18. package/dist/example.d.ts.map +1 -1
  19. package/dist/example.js +4 -2
  20. package/dist/example.js.map +1 -1
  21. package/dist/handlers/index.d.ts +2 -0
  22. package/dist/handlers/index.js +3 -0
  23. package/dist/handlers/workflow.handlers.d.ts +122 -0
  24. package/dist/handlers/workflow.handlers.d.ts.map +1 -0
  25. package/dist/handlers/workflow.handlers.js +263 -0
  26. package/dist/handlers/workflow.handlers.js.map +1 -0
  27. package/dist/index.d.ts +6 -1
  28. package/dist/index.js +6 -1
  29. package/dist/instance/instance.enum.d.ts +2 -2
  30. package/dist/instance/instance.event.d.ts +87 -87
  31. package/dist/instance/instance.event.d.ts.map +1 -1
  32. package/dist/instance/instance.event.js +4 -4
  33. package/dist/instance/instance.event.js.map +1 -1
  34. package/dist/instance/instance.handler.js.map +1 -1
  35. package/dist/instance/instance.operations.d.ts +256 -256
  36. package/dist/instance/instance.schema.d.ts +54 -54
  37. package/dist/presentations/index.d.ts +23 -24
  38. package/dist/presentations/index.d.ts.map +1 -1
  39. package/dist/presentations/index.js +26 -23
  40. package/dist/presentations/index.js.map +1 -1
  41. package/dist/seeders/index.d.ts +10 -0
  42. package/dist/seeders/index.d.ts.map +1 -0
  43. package/dist/seeders/index.js +19 -0
  44. package/dist/seeders/index.js.map +1 -0
  45. package/dist/state-machine/index.js.map +1 -1
  46. package/dist/tests/operations.test-spec.d.ts +10 -0
  47. package/dist/tests/operations.test-spec.d.ts.map +1 -0
  48. package/dist/tests/operations.test-spec.js +123 -0
  49. package/dist/tests/operations.test-spec.js.map +1 -0
  50. package/dist/ui/WorkflowDashboard.d.ts +7 -0
  51. package/dist/ui/WorkflowDashboard.d.ts.map +1 -0
  52. package/dist/ui/WorkflowDashboard.js +223 -0
  53. package/dist/ui/WorkflowDashboard.js.map +1 -0
  54. package/dist/ui/hooks/index.d.ts +2 -0
  55. package/dist/ui/hooks/index.js +5 -0
  56. package/dist/ui/hooks/useWorkflowList.d.ts +22 -0
  57. package/dist/ui/hooks/useWorkflowList.d.ts.map +1 -0
  58. package/dist/ui/hooks/useWorkflowList.js +55 -0
  59. package/dist/ui/hooks/useWorkflowList.js.map +1 -0
  60. package/dist/ui/index.d.ts +6 -0
  61. package/dist/ui/index.js +6 -0
  62. package/dist/ui/renderers/index.d.ts +2 -0
  63. package/dist/ui/renderers/index.js +3 -0
  64. package/dist/ui/renderers/workflow.markdown.d.ts +28 -0
  65. package/dist/ui/renderers/workflow.markdown.d.ts.map +1 -0
  66. package/dist/ui/renderers/workflow.markdown.js +234 -0
  67. package/dist/ui/renderers/workflow.markdown.js.map +1 -0
  68. package/dist/workflow/workflow.enum.d.ts +5 -5
  69. package/dist/workflow/workflow.enum.d.ts.map +1 -1
  70. package/dist/workflow/workflow.event.d.ts +33 -33
  71. package/dist/workflow/workflow.event.js +3 -3
  72. package/dist/workflow/workflow.event.js.map +1 -1
  73. package/dist/workflow/workflow.handler.js.map +1 -1
  74. package/dist/workflow/workflow.operations.d.ts +246 -246
  75. package/dist/workflow/workflow.schema.d.ts +63 -63
  76. package/dist/workflow/workflow.schema.d.ts.map +1 -1
  77. package/dist/workflow-system.capability.d.ts +9 -0
  78. package/dist/workflow-system.capability.d.ts.map +1 -0
  79. package/dist/workflow-system.capability.js +34 -0
  80. package/dist/workflow-system.capability.js.map +1 -0
  81. package/dist/workflow-system.feature.d.ts +2 -2
  82. package/dist/workflow-system.feature.d.ts.map +1 -1
  83. package/dist/workflow-system.feature.js +9 -2
  84. package/dist/workflow-system.feature.js.map +1 -1
  85. package/package.json +24 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.markdown.d.ts","names":[],"sources":["../../../src/ui/renderers/workflow.markdown.ts"],"sourcesContent":[],"mappings":";;;;AA+KA;AAmDA;;cAxIa,mCAAmC;;;;;;;cAqFnC,wCAAwC;;;;;;;cAmDxC,wCAAwC"}
@@ -0,0 +1,234 @@
1
+ //#region src/ui/renderers/workflow.markdown.ts
2
+ const mockWorkflowDefinitions = [
3
+ {
4
+ id: "wf-1",
5
+ name: "Purchase Approval",
6
+ type: "APPROVAL",
7
+ steps: [
8
+ {
9
+ id: "s1",
10
+ name: "Manager Review",
11
+ order: 1,
12
+ requiredRoles: ["manager"]
13
+ },
14
+ {
15
+ id: "s2",
16
+ name: "Finance Review",
17
+ order: 2,
18
+ requiredRoles: ["finance"]
19
+ },
20
+ {
21
+ id: "s3",
22
+ name: "Final Approval",
23
+ order: 3,
24
+ requiredRoles: ["admin"]
25
+ }
26
+ ],
27
+ status: "ACTIVE"
28
+ },
29
+ {
30
+ id: "wf-2",
31
+ name: "Leave Request",
32
+ type: "APPROVAL",
33
+ steps: [{
34
+ id: "s1",
35
+ name: "Supervisor Approval",
36
+ order: 1,
37
+ requiredRoles: ["supervisor"]
38
+ }, {
39
+ id: "s2",
40
+ name: "HR Review",
41
+ order: 2,
42
+ requiredRoles: ["hr"]
43
+ }],
44
+ status: "ACTIVE"
45
+ },
46
+ {
47
+ id: "wf-3",
48
+ name: "Document Review",
49
+ type: "SEQUENTIAL",
50
+ steps: [
51
+ {
52
+ id: "s1",
53
+ name: "Author Review",
54
+ order: 1,
55
+ requiredRoles: ["author"]
56
+ },
57
+ {
58
+ id: "s2",
59
+ name: "Peer Review",
60
+ order: 2,
61
+ requiredRoles: ["reviewer"]
62
+ },
63
+ {
64
+ id: "s3",
65
+ name: "Publish",
66
+ order: 3,
67
+ requiredRoles: ["publisher"]
68
+ }
69
+ ],
70
+ status: "DRAFT"
71
+ }
72
+ ];
73
+ const mockWorkflowInstances = [
74
+ {
75
+ id: "inst-1",
76
+ definitionId: "wf-1",
77
+ definitionName: "Purchase Approval",
78
+ status: "IN_PROGRESS",
79
+ currentStepId: "s2",
80
+ startedAt: "2024-01-15T10:00:00Z",
81
+ requestedBy: "John Doe"
82
+ },
83
+ {
84
+ id: "inst-2",
85
+ definitionId: "wf-1",
86
+ definitionName: "Purchase Approval",
87
+ status: "COMPLETED",
88
+ currentStepId: null,
89
+ startedAt: "2024-01-10T09:00:00Z",
90
+ completedAt: "2024-01-12T14:00:00Z",
91
+ requestedBy: "Jane Smith"
92
+ },
93
+ {
94
+ id: "inst-3",
95
+ definitionId: "wf-2",
96
+ definitionName: "Leave Request",
97
+ status: "PENDING",
98
+ currentStepId: "s1",
99
+ startedAt: "2024-01-16T08:00:00Z",
100
+ requestedBy: "Bob Wilson"
101
+ }
102
+ ];
103
+ /**
104
+ * Markdown renderer for Workflow Dashboard
105
+ */
106
+ const workflowDashboardMarkdownRenderer = {
107
+ target: "markdown",
108
+ render: async (desc) => {
109
+ if (desc.source.type !== "component" || desc.source.componentKey !== "WorkflowDashboard") throw new Error("workflowDashboardMarkdownRenderer: not WorkflowDashboard");
110
+ const definitions = mockWorkflowDefinitions;
111
+ const instances = mockWorkflowInstances;
112
+ const activeDefinitions = definitions.filter((d) => d.status === "ACTIVE");
113
+ const pendingInstances = instances.filter((i) => i.status === "PENDING");
114
+ const inProgressInstances = instances.filter((i) => i.status === "IN_PROGRESS");
115
+ const completedInstances = instances.filter((i) => i.status === "COMPLETED");
116
+ const lines = [
117
+ "# Workflow Dashboard",
118
+ "",
119
+ "> Workflow and approval management overview",
120
+ "",
121
+ "## Summary",
122
+ "",
123
+ "| Metric | Value |",
124
+ "|--------|-------|",
125
+ `| Active Workflows | ${activeDefinitions.length} |`,
126
+ `| Pending Approvals | ${pendingInstances.length} |`,
127
+ `| In Progress | ${inProgressInstances.length} |`,
128
+ `| Completed | ${completedInstances.length} |`,
129
+ "",
130
+ "## Active Workflow Definitions",
131
+ ""
132
+ ];
133
+ if (activeDefinitions.length === 0) lines.push("_No active workflow definitions._");
134
+ else {
135
+ lines.push("| Name | Type | Steps | Status |");
136
+ lines.push("|------|------|-------|--------|");
137
+ for (const def of activeDefinitions) lines.push(`| ${def.name} | ${def.type} | ${def.steps.length} | ${def.status} |`);
138
+ }
139
+ lines.push("");
140
+ lines.push("## Recent Instances");
141
+ lines.push("");
142
+ if (instances.length === 0) lines.push("_No workflow instances._");
143
+ else {
144
+ lines.push("| Workflow | Requested By | Status | Started |");
145
+ lines.push("|----------|--------------|--------|---------|");
146
+ for (const inst of instances.slice(0, 10)) {
147
+ const startedDate = new Date(inst.startedAt).toLocaleDateString();
148
+ lines.push(`| ${inst.definitionName} | ${inst.requestedBy} | ${inst.status} | ${startedDate} |`);
149
+ }
150
+ }
151
+ return {
152
+ mimeType: "text/markdown",
153
+ body: lines.join("\n")
154
+ };
155
+ }
156
+ };
157
+ /**
158
+ * Markdown renderer for Workflow Definition List
159
+ */
160
+ const workflowDefinitionListMarkdownRenderer = {
161
+ target: "markdown",
162
+ render: async (desc) => {
163
+ if (desc.source.type !== "component" || desc.source.componentKey !== "WorkflowDefinitionList") throw new Error("workflowDefinitionListMarkdownRenderer: not WorkflowDefinitionList");
164
+ const definitions = mockWorkflowDefinitions;
165
+ const lines = [
166
+ "# Workflow Definitions",
167
+ "",
168
+ "> Configure automated approval and process workflows",
169
+ ""
170
+ ];
171
+ for (const def of definitions) {
172
+ lines.push(`## ${def.name}`);
173
+ lines.push("");
174
+ lines.push(`**Type:** ${def.type} | **Status:** ${def.status}`);
175
+ lines.push("");
176
+ lines.push("### Steps");
177
+ lines.push("");
178
+ for (const step of def.steps) lines.push(`${step.order}. **${step.name}** - Roles: ${step.requiredRoles.join(", ")}`);
179
+ lines.push("");
180
+ }
181
+ return {
182
+ mimeType: "text/markdown",
183
+ body: lines.join("\n")
184
+ };
185
+ }
186
+ };
187
+ /**
188
+ * Markdown renderer for Workflow Instance Detail
189
+ */
190
+ const workflowInstanceDetailMarkdownRenderer = {
191
+ target: "markdown",
192
+ render: async (desc) => {
193
+ if (desc.source.type !== "component" || desc.source.componentKey !== "WorkflowInstanceDetail") throw new Error("workflowInstanceDetailMarkdownRenderer: not WorkflowInstanceDetail");
194
+ const instance = mockWorkflowInstances[0];
195
+ if (!instance) return {
196
+ mimeType: "text/markdown",
197
+ body: "# No Workflow Instances\n\nNo workflow instances available."
198
+ };
199
+ const definition = mockWorkflowDefinitions.find((d) => d.id === instance.definitionId);
200
+ const lines = [
201
+ `# Workflow: ${instance.definitionName}`,
202
+ "",
203
+ `**Instance ID:** ${instance.id}`,
204
+ `**Status:** ${instance.status}`,
205
+ `**Requested By:** ${instance.requestedBy}`,
206
+ `**Started:** ${new Date(instance.startedAt).toLocaleString()}`,
207
+ "",
208
+ "## Steps Progress",
209
+ ""
210
+ ];
211
+ if (definition) for (const step of definition.steps) {
212
+ const isCurrent = step.id === instance.currentStepId;
213
+ const isCompleted = definition.steps.indexOf(step) < definition.steps.findIndex((s) => s.id === instance.currentStepId);
214
+ let status = "⬜ Pending";
215
+ if (isCompleted) status = "✅ Completed";
216
+ if (isCurrent) status = "🔄 In Progress";
217
+ lines.push(`- ${status} **${step.name}**`);
218
+ }
219
+ lines.push("");
220
+ lines.push("## Actions");
221
+ lines.push("");
222
+ lines.push("- **Approve** - Move to next step");
223
+ lines.push("- **Reject** - Reject and return");
224
+ lines.push("- **Delegate** - Assign to another approver");
225
+ return {
226
+ mimeType: "text/markdown",
227
+ body: lines.join("\n")
228
+ };
229
+ }
230
+ };
231
+
232
+ //#endregion
233
+ export { workflowDashboardMarkdownRenderer, workflowDefinitionListMarkdownRenderer, workflowInstanceDetailMarkdownRenderer };
234
+ //# sourceMappingURL=workflow.markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.markdown.js","names":[],"sources":["../../../src/ui/renderers/workflow.markdown.ts"],"sourcesContent":["/**\n * Markdown renderers for Workflow System presentations\n */\nimport type { PresentationRenderer } from '@contractspec/lib.contracts';\n\n// Mock data for workflow rendering\nconst mockWorkflowDefinitions = [\n {\n id: 'wf-1',\n name: 'Purchase Approval',\n type: 'APPROVAL',\n steps: [\n {\n id: 's1',\n name: 'Manager Review',\n order: 1,\n requiredRoles: ['manager'],\n },\n {\n id: 's2',\n name: 'Finance Review',\n order: 2,\n requiredRoles: ['finance'],\n },\n { id: 's3', name: 'Final Approval', order: 3, requiredRoles: ['admin'] },\n ],\n status: 'ACTIVE',\n },\n {\n id: 'wf-2',\n name: 'Leave Request',\n type: 'APPROVAL',\n steps: [\n {\n id: 's1',\n name: 'Supervisor Approval',\n order: 1,\n requiredRoles: ['supervisor'],\n },\n { id: 's2', name: 'HR Review', order: 2, requiredRoles: ['hr'] },\n ],\n status: 'ACTIVE',\n },\n {\n id: 'wf-3',\n name: 'Document Review',\n type: 'SEQUENTIAL',\n steps: [\n { id: 's1', name: 'Author Review', order: 1, requiredRoles: ['author'] },\n { id: 's2', name: 'Peer Review', order: 2, requiredRoles: ['reviewer'] },\n { id: 's3', name: 'Publish', order: 3, requiredRoles: ['publisher'] },\n ],\n status: 'DRAFT',\n },\n];\n\nconst mockWorkflowInstances = [\n {\n id: 'inst-1',\n definitionId: 'wf-1',\n definitionName: 'Purchase Approval',\n status: 'IN_PROGRESS',\n currentStepId: 's2',\n startedAt: '2024-01-15T10:00:00Z',\n requestedBy: 'John Doe',\n },\n {\n id: 'inst-2',\n definitionId: 'wf-1',\n definitionName: 'Purchase Approval',\n status: 'COMPLETED',\n currentStepId: null,\n startedAt: '2024-01-10T09:00:00Z',\n completedAt: '2024-01-12T14:00:00Z',\n requestedBy: 'Jane Smith',\n },\n {\n id: 'inst-3',\n definitionId: 'wf-2',\n definitionName: 'Leave Request',\n status: 'PENDING',\n currentStepId: 's1',\n startedAt: '2024-01-16T08:00:00Z',\n requestedBy: 'Bob Wilson',\n },\n];\n\n/**\n * Markdown renderer for Workflow Dashboard\n */\nexport const workflowDashboardMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc) => {\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'WorkflowDashboard'\n ) {\n throw new Error(\n 'workflowDashboardMarkdownRenderer: not WorkflowDashboard'\n );\n }\n\n const definitions = mockWorkflowDefinitions;\n const instances = mockWorkflowInstances;\n\n // Calculate stats\n const activeDefinitions = definitions.filter((d) => d.status === 'ACTIVE');\n const pendingInstances = instances.filter((i) => i.status === 'PENDING');\n const inProgressInstances = instances.filter(\n (i) => i.status === 'IN_PROGRESS'\n );\n const completedInstances = instances.filter(\n (i) => i.status === 'COMPLETED'\n );\n\n const lines: string[] = [\n '# Workflow Dashboard',\n '',\n '> Workflow and approval management overview',\n '',\n '## Summary',\n '',\n '| Metric | Value |',\n '|--------|-------|',\n `| Active Workflows | ${activeDefinitions.length} |`,\n `| Pending Approvals | ${pendingInstances.length} |`,\n `| In Progress | ${inProgressInstances.length} |`,\n `| Completed | ${completedInstances.length} |`,\n '',\n '## Active Workflow Definitions',\n '',\n ];\n\n if (activeDefinitions.length === 0) {\n lines.push('_No active workflow definitions._');\n } else {\n lines.push('| Name | Type | Steps | Status |');\n lines.push('|------|------|-------|--------|');\n for (const def of activeDefinitions) {\n lines.push(\n `| ${def.name} | ${def.type} | ${def.steps.length} | ${def.status} |`\n );\n }\n }\n\n lines.push('');\n lines.push('## Recent Instances');\n lines.push('');\n\n if (instances.length === 0) {\n lines.push('_No workflow instances._');\n } else {\n lines.push('| Workflow | Requested By | Status | Started |');\n lines.push('|----------|--------------|--------|---------|');\n for (const inst of instances.slice(0, 10)) {\n const startedDate = new Date(inst.startedAt).toLocaleDateString();\n lines.push(\n `| ${inst.definitionName} | ${inst.requestedBy} | ${inst.status} | ${startedDate} |`\n );\n }\n }\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n\n/**\n * Markdown renderer for Workflow Definition List\n */\nexport const workflowDefinitionListMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc) => {\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'WorkflowDefinitionList'\n ) {\n throw new Error(\n 'workflowDefinitionListMarkdownRenderer: not WorkflowDefinitionList'\n );\n }\n\n const definitions = mockWorkflowDefinitions;\n\n const lines: string[] = [\n '# Workflow Definitions',\n '',\n '> Configure automated approval and process workflows',\n '',\n ];\n\n for (const def of definitions) {\n lines.push(`## ${def.name}`);\n lines.push('');\n lines.push(`**Type:** ${def.type} | **Status:** ${def.status}`);\n lines.push('');\n lines.push('### Steps');\n lines.push('');\n\n for (const step of def.steps) {\n lines.push(\n `${step.order}. **${step.name}** - Roles: ${step.requiredRoles.join(', ')}`\n );\n }\n\n lines.push('');\n }\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n\n/**\n * Markdown renderer for Workflow Instance Detail\n */\nexport const workflowInstanceDetailMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc) => {\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'WorkflowInstanceDetail'\n ) {\n throw new Error(\n 'workflowInstanceDetailMarkdownRenderer: not WorkflowInstanceDetail'\n );\n }\n\n const instance = mockWorkflowInstances[0];\n if (!instance) {\n return {\n mimeType: 'text/markdown',\n body: '# No Workflow Instances\\n\\nNo workflow instances available.',\n };\n }\n const definition = mockWorkflowDefinitions.find(\n (d) => d.id === instance.definitionId\n );\n\n const lines: string[] = [\n `# Workflow: ${instance.definitionName}`,\n '',\n `**Instance ID:** ${instance.id}`,\n `**Status:** ${instance.status}`,\n `**Requested By:** ${instance.requestedBy}`,\n `**Started:** ${new Date(instance.startedAt).toLocaleString()}`,\n '',\n '## Steps Progress',\n '',\n ];\n\n if (definition) {\n for (const step of definition.steps) {\n const isCurrent = step.id === instance.currentStepId;\n const isCompleted =\n definition.steps.indexOf(step) <\n definition.steps.findIndex((s) => s.id === instance.currentStepId);\n\n let status = '⬜ Pending';\n if (isCompleted) status = '✅ Completed';\n if (isCurrent) status = '🔄 In Progress';\n\n lines.push(`- ${status} **${step.name}**`);\n }\n }\n\n lines.push('');\n lines.push('## Actions');\n lines.push('');\n lines.push('- **Approve** - Move to next step');\n lines.push('- **Reject** - Reject and return');\n lines.push('- **Delegate** - Assign to another approver');\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n"],"mappings":";AAMA,MAAM,0BAA0B;CAC9B;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,OAAO;GACL;IACE,IAAI;IACJ,MAAM;IACN,OAAO;IACP,eAAe,CAAC,UAAU;IAC3B;GACD;IACE,IAAI;IACJ,MAAM;IACN,OAAO;IACP,eAAe,CAAC,UAAU;IAC3B;GACD;IAAE,IAAI;IAAM,MAAM;IAAkB,OAAO;IAAG,eAAe,CAAC,QAAQ;IAAE;GACzE;EACD,QAAQ;EACT;CACD;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,OAAO,CACL;GACE,IAAI;GACJ,MAAM;GACN,OAAO;GACP,eAAe,CAAC,aAAa;GAC9B,EACD;GAAE,IAAI;GAAM,MAAM;GAAa,OAAO;GAAG,eAAe,CAAC,KAAK;GAAE,CACjE;EACD,QAAQ;EACT;CACD;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,OAAO;GACL;IAAE,IAAI;IAAM,MAAM;IAAiB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EJ;;;;AAKD,MAAa,yCAGR;CACH,QAAQ;CACR,QAAQ,OAAO,SAAS;AACtB,MACE,KAAK,OAAO,SAAS,eACrB,KAAK,OAAO,iBAAiB,yBAE7B,OAAM,IAAI,MACR,qEACD;EAGH,MAAM,WAAW,sBAAsB;AACvC,MAAI,CAAC,SACH,QAAO;GACL,UAAU;GACV,MAAM;GACP;EAEH,MAAM,aAAa,wBAAwB,MACxC,MAAM,EAAE,OAAO,SAAS,aAC1B;EAED,MAAM,QAAkB;GACtB,eAAe,SAAS;GACxB;GACA,oBAAoB,SAAS;GAC7B,eAAe,SAAS;GACxB,qBAAqB,SAAS;GAC9B,gBAAgB,IAAI,KAAK,SAAS,UAAU,CAAC,gBAAgB;GAC7D;GACA;GACA;GACD;AAED,MAAI,WACF,MAAK,MAAM,QAAQ,WAAW,OAAO;GACnC,MAAM,YAAY,KAAK,OAAO,SAAS;GACvC,MAAM,cACJ,WAAW,MAAM,QAAQ,KAAK,GAC9B,WAAW,MAAM,WAAW,MAAM,EAAE,OAAO,SAAS,cAAc;GAEpE,IAAI,SAAS;AACb,OAAI,YAAa,UAAS;AAC1B,OAAI,UAAW,UAAS;AAExB,SAAM,KAAK,KAAK,OAAO,KAAK,KAAK,KAAK,IAAI;;AAI9C,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,aAAa;AACxB,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,oCAAoC;AAC/C,QAAM,KAAK,mCAAmC;AAC9C,QAAM,KAAK,8CAA8C;AAEzD,SAAO;GACL,UAAU;GACV,MAAM,MAAM,KAAK,KAAK;GACvB;;CAEJ"}
@@ -1,22 +1,22 @@
1
- import * as _contractspec_lib_schema932 from "@contractspec/lib.schema";
1
+ import * as _contractspec_lib_schema1176 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_schema932.EnumType<[string, string, string, string]>;
7
+ declare const WorkflowStatusEnum: _contractspec_lib_schema1176.EnumType<[string, string, string, string]>;
8
8
  /**
9
9
  * Trigger type enum.
10
10
  */
11
- declare const TriggerTypeEnum: _contractspec_lib_schema932.EnumType<[string, string, string, string]>;
11
+ declare const TriggerTypeEnum: _contractspec_lib_schema1176.EnumType<[string, string, string, string]>;
12
12
  /**
13
13
  * Step type enum.
14
14
  */
15
- declare const StepTypeEnum: _contractspec_lib_schema932.EnumType<[string, string, string, string, string, string, string, string]>;
15
+ declare const StepTypeEnum: _contractspec_lib_schema1176.EnumType<[string, string, string, string, string, string, string, string]>;
16
16
  /**
17
17
  * Approval mode enum.
18
18
  */
19
- declare const ApprovalModeEnum: _contractspec_lib_schema932.EnumType<[string, string, string, string]>;
19
+ declare const ApprovalModeEnum: _contractspec_lib_schema1176.EnumType<[string, string, string, string]>;
20
20
  //#endregion
21
21
  export { ApprovalModeEnum, StepTypeEnum, TriggerTypeEnum, WorkflowStatusEnum };
22
22
  //# sourceMappingURL=workflow.enum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.enum.d.ts","names":[],"sources":["../../src/workflow/workflow.enum.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,kBAKX,EAAA,2BAAA,CAL6B,QAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;AAU/B;AAUA;AAcA;cAxBa,iBAKX,2BAAA,CAL0B;;;;cAUf,cASX,2BAAA,CATuB;;;;cAcZ,kBAKX,2BAAA,CAL2B"}
1
+ {"version":3,"file":"workflow.enum.d.ts","names":[],"sources":["../../src/workflow/workflow.enum.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,kBAKX,EAAA,4BAAA,CAL6B,QAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;AAU/B;AAUA;AAcA;cAxBa,iBAKX,4BAAA,CAL0B;;;;cAUf,cASX,4BAAA,CATuB;;;;cAcZ,kBAKX,4BAAA,CAL2B"}
@@ -1,132 +1,132 @@
1
- import * as _contractspec_lib_schema901 from "@contractspec/lib.schema";
2
- import * as _contractspec_lib_contracts24 from "@contractspec/lib.contracts";
1
+ import * as _contractspec_lib_contracts55 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema839 from "@contractspec/lib.schema";
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_contracts24.EventSpec<_contractspec_lib_schema901.SchemaModel<{
8
+ declare const WorkflowCreatedEvent: _contractspec_lib_contracts55.EventSpec<_contractspec_lib_schema839.SchemaModel<{
9
9
  workflowId: {
10
- type: _contractspec_lib_schema901.FieldType<string, string>;
10
+ type: _contractspec_lib_schema839.FieldType<string, string>;
11
11
  isOptional: false;
12
12
  };
13
13
  key: {
14
- type: _contractspec_lib_schema901.FieldType<string, string>;
14
+ type: _contractspec_lib_schema839.FieldType<string, string>;
15
15
  isOptional: false;
16
16
  };
17
17
  name: {
18
- type: _contractspec_lib_schema901.FieldType<string, string>;
18
+ type: _contractspec_lib_schema839.FieldType<string, string>;
19
19
  isOptional: false;
20
20
  };
21
21
  version: {
22
- type: _contractspec_lib_schema901.FieldType<string, string>;
22
+ type: _contractspec_lib_schema839.FieldType<string, string>;
23
23
  isOptional: false;
24
24
  };
25
25
  organizationId: {
26
- type: _contractspec_lib_schema901.FieldType<string, string>;
26
+ type: _contractspec_lib_schema839.FieldType<string, string>;
27
27
  isOptional: false;
28
28
  };
29
29
  createdBy: {
30
- type: _contractspec_lib_schema901.FieldType<string, string>;
30
+ type: _contractspec_lib_schema839.FieldType<string, string>;
31
31
  isOptional: false;
32
32
  };
33
33
  timestamp: {
34
- type: _contractspec_lib_schema901.FieldType<Date, string>;
34
+ type: _contractspec_lib_schema839.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_contracts24.EventSpec<_contractspec_lib_schema901.SchemaModel<{
41
+ declare const WorkflowUpdatedEvent: _contractspec_lib_contracts55.EventSpec<_contractspec_lib_schema839.SchemaModel<{
42
42
  workflowId: {
43
- type: _contractspec_lib_schema901.FieldType<string, string>;
43
+ type: _contractspec_lib_schema839.FieldType<string, string>;
44
44
  isOptional: false;
45
45
  };
46
46
  key: {
47
- type: _contractspec_lib_schema901.FieldType<string, string>;
47
+ type: _contractspec_lib_schema839.FieldType<string, string>;
48
48
  isOptional: false;
49
49
  };
50
50
  name: {
51
- type: _contractspec_lib_schema901.FieldType<string, string>;
51
+ type: _contractspec_lib_schema839.FieldType<string, string>;
52
52
  isOptional: false;
53
53
  };
54
54
  version: {
55
- type: _contractspec_lib_schema901.FieldType<string, string>;
55
+ type: _contractspec_lib_schema839.FieldType<string, string>;
56
56
  isOptional: false;
57
57
  };
58
58
  organizationId: {
59
- type: _contractspec_lib_schema901.FieldType<string, string>;
59
+ type: _contractspec_lib_schema839.FieldType<string, string>;
60
60
  isOptional: false;
61
61
  };
62
62
  createdBy: {
63
- type: _contractspec_lib_schema901.FieldType<string, string>;
63
+ type: _contractspec_lib_schema839.FieldType<string, string>;
64
64
  isOptional: false;
65
65
  };
66
66
  timestamp: {
67
- type: _contractspec_lib_schema901.FieldType<Date, string>;
67
+ type: _contractspec_lib_schema839.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_contracts24.EventSpec<_contractspec_lib_schema901.SchemaModel<{
74
+ declare const WorkflowPublishedEvent: _contractspec_lib_contracts55.EventSpec<_contractspec_lib_schema839.SchemaModel<{
75
75
  workflowId: {
76
- type: _contractspec_lib_schema901.FieldType<string, string>;
76
+ type: _contractspec_lib_schema839.FieldType<string, string>;
77
77
  isOptional: false;
78
78
  };
79
79
  key: {
80
- type: _contractspec_lib_schema901.FieldType<string, string>;
80
+ type: _contractspec_lib_schema839.FieldType<string, string>;
81
81
  isOptional: false;
82
82
  };
83
83
  name: {
84
- type: _contractspec_lib_schema901.FieldType<string, string>;
84
+ type: _contractspec_lib_schema839.FieldType<string, string>;
85
85
  isOptional: false;
86
86
  };
87
87
  version: {
88
- type: _contractspec_lib_schema901.FieldType<string, string>;
88
+ type: _contractspec_lib_schema839.FieldType<string, string>;
89
89
  isOptional: false;
90
90
  };
91
91
  organizationId: {
92
- type: _contractspec_lib_schema901.FieldType<string, string>;
92
+ type: _contractspec_lib_schema839.FieldType<string, string>;
93
93
  isOptional: false;
94
94
  };
95
95
  createdBy: {
96
- type: _contractspec_lib_schema901.FieldType<string, string>;
96
+ type: _contractspec_lib_schema839.FieldType<string, string>;
97
97
  isOptional: false;
98
98
  };
99
99
  timestamp: {
100
- type: _contractspec_lib_schema901.FieldType<Date, string>;
100
+ type: _contractspec_lib_schema839.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_contracts24.EventSpec<_contractspec_lib_schema901.SchemaModel<{
107
+ declare const StepAddedEvent: _contractspec_lib_contracts55.EventSpec<_contractspec_lib_schema839.SchemaModel<{
108
108
  stepId: {
109
- type: _contractspec_lib_schema901.FieldType<string, string>;
109
+ type: _contractspec_lib_schema839.FieldType<string, string>;
110
110
  isOptional: false;
111
111
  };
112
112
  workflowId: {
113
- type: _contractspec_lib_schema901.FieldType<string, string>;
113
+ type: _contractspec_lib_schema839.FieldType<string, string>;
114
114
  isOptional: false;
115
115
  };
116
116
  stepKey: {
117
- type: _contractspec_lib_schema901.FieldType<string, string>;
117
+ type: _contractspec_lib_schema839.FieldType<string, string>;
118
118
  isOptional: false;
119
119
  };
120
120
  stepType: {
121
- type: _contractspec_lib_schema901.FieldType<string, string>;
121
+ type: _contractspec_lib_schema839.FieldType<string, string>;
122
122
  isOptional: false;
123
123
  };
124
124
  position: {
125
- type: _contractspec_lib_schema901.FieldType<number, number>;
125
+ type: _contractspec_lib_schema839.FieldType<number, number>;
126
126
  isOptional: false;
127
127
  };
128
128
  timestamp: {
129
- type: _contractspec_lib_schema901.FieldType<Date, string>;
129
+ type: _contractspec_lib_schema839.FieldType<Date, string>;
130
130
  isOptional: false;
131
131
  };
132
132
  }>>;
@@ -1,11 +1,11 @@
1
+ import { defineEvent, defineSchemaModel } from "@contractspec/lib.contracts";
1
2
  import { ScalarTypeEnum } from "@contractspec/lib.schema";
2
- import { defineEvent, defineSchemaModel as defineSchemaModel$1 } from "@contractspec/lib.contracts";
3
3
 
4
4
  //#region src/workflow/workflow.event.ts
5
5
  /**
6
6
  * Payload for workflow definition events.
7
7
  */
8
- const WorkflowDefinitionPayload = defineSchemaModel$1({
8
+ const WorkflowDefinitionPayload = defineSchemaModel({
9
9
  name: "WorkflowDefinitionEventPayload",
10
10
  description: "Payload for workflow definition events",
11
11
  fields: {
@@ -42,7 +42,7 @@ const WorkflowDefinitionPayload = defineSchemaModel$1({
42
42
  /**
43
43
  * Payload when a step is added.
44
44
  */
45
- const StepAddedPayload = defineSchemaModel$1({
45
+ const StepAddedPayload = defineSchemaModel({
46
46
  name: "StepAddedEventPayload",
47
47
  description: "Payload when a step is added",
48
48
  fields: {
@@ -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.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;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAM,mBAAmBA,oBAAkB;CACzC,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAc;GAAU;EAC5C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,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":[],"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: StepAdd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;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 +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.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,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":[],"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,MAAM,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,MAAM,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;AAC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