@contractspec/example.workflow-system 3.7.6 → 3.7.7
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.
- package/README.md +69 -119
- package/dist/approval/approval.event.js +1 -1
- package/dist/approval/approval.handler.d.ts +1 -1
- package/dist/approval/index.d.ts +4 -4
- package/dist/approval/index.js +1 -1
- package/dist/browser/approval/approval.event.js +1 -1
- package/dist/browser/approval/index.js +1 -1
- package/dist/browser/entities/index.js +166 -166
- package/dist/browser/index.js +1800 -1802
- package/dist/browser/instance/index.js +210 -210
- package/dist/browser/instance/instance.event.js +1 -1
- package/dist/browser/ui/hooks/index.js +1 -1
- package/dist/browser/ui/hooks/useWorkflowList.js +1 -1
- package/dist/browser/ui/index.js +1 -1
- package/dist/entities/index.d.ts +53 -53
- package/dist/entities/index.js +166 -166
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1800 -1802
- package/dist/instance/index.d.ts +3 -3
- package/dist/instance/index.js +210 -210
- package/dist/instance/instance.event.js +1 -1
- package/dist/instance/instance.handler.d.ts +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/mock-data.d.ts +1 -1
- package/dist/ui/hooks/index.js +1 -1
- package/dist/ui/hooks/useWorkflowList.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/workflow/index.d.ts +4 -4
- package/dist/workflow/workflow.handler.d.ts +1 -1
- package/package.json +6 -6
package/dist/entities/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { ApprovalCommentEntity, ApprovalDecisionEnum, ApprovalRequestEntity, ApprovalStatusEnum, } from './approval';
|
|
2
|
+
export { InstanceStatusEnum, StepExecutionEntity, StepExecutionStatusEnum, WorkflowInstanceEntity, } from './instance';
|
|
3
|
+
export { ApprovalModeEnum, StepTypeEnum, WorkflowStepEntity } from './step';
|
|
4
|
+
export { WorkflowDefinitionEntity, WorkflowStatusEnum, WorkflowTriggerTypeEnum, } from './workflow';
|
|
5
5
|
import type { ModuleSchemaContribution } from '@contractspec/lib.schema';
|
|
6
6
|
export declare const workflowSystemEntities: (import("@contractspec/lib.schema").EntitySpec<{
|
|
7
7
|
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
@@ -36,55 +36,6 @@ export declare const workflowSystemEntities: (import("@contractspec/lib.schema")
|
|
|
36
36
|
createdAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
37
37
|
updatedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
38
38
|
approvalRequest: import("@contractspec/lib.schema").EntityRelationField;
|
|
39
|
-
}> | import("@contractspec/lib.schema").EntitySpec<{
|
|
40
|
-
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
41
|
-
name: import("@contractspec/lib.schema").EntityScalarField;
|
|
42
|
-
key: import("@contractspec/lib.schema").EntityScalarField;
|
|
43
|
-
description: import("@contractspec/lib.schema").EntityScalarField;
|
|
44
|
-
version: import("@contractspec/lib.schema").EntityScalarField;
|
|
45
|
-
status: import("@contractspec/lib.schema").EntityEnumField;
|
|
46
|
-
triggerType: import("@contractspec/lib.schema").EntityEnumField;
|
|
47
|
-
triggerConfig: import("@contractspec/lib.schema").EntityScalarField;
|
|
48
|
-
initialStepId: import("@contractspec/lib.schema").EntityScalarField;
|
|
49
|
-
featureFlagKey: import("@contractspec/lib.schema").EntityScalarField;
|
|
50
|
-
settings: import("@contractspec/lib.schema").EntityScalarField;
|
|
51
|
-
metadata: import("@contractspec/lib.schema").EntityScalarField;
|
|
52
|
-
organizationId: import("@contractspec/lib.schema").EntityScalarField;
|
|
53
|
-
createdBy: import("@contractspec/lib.schema").EntityScalarField;
|
|
54
|
-
createdAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
55
|
-
updatedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
56
|
-
publishedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
57
|
-
steps: import("@contractspec/lib.schema").EntityRelationField;
|
|
58
|
-
instances: import("@contractspec/lib.schema").EntityRelationField;
|
|
59
|
-
}> | import("@contractspec/lib.schema").EntitySpec<{
|
|
60
|
-
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
61
|
-
workflowDefinitionId: import("@contractspec/lib.schema").EntityScalarField;
|
|
62
|
-
name: import("@contractspec/lib.schema").EntityScalarField;
|
|
63
|
-
key: import("@contractspec/lib.schema").EntityScalarField;
|
|
64
|
-
description: import("@contractspec/lib.schema").EntityScalarField;
|
|
65
|
-
type: import("@contractspec/lib.schema").EntityEnumField;
|
|
66
|
-
position: import("@contractspec/lib.schema").EntityScalarField;
|
|
67
|
-
transitions: import("@contractspec/lib.schema").EntityScalarField;
|
|
68
|
-
approvalMode: import("@contractspec/lib.schema").EntityEnumField;
|
|
69
|
-
approverRoles: import("@contractspec/lib.schema").EntityScalarField;
|
|
70
|
-
approverUserIds: import("@contractspec/lib.schema").EntityScalarField;
|
|
71
|
-
escalationConfig: import("@contractspec/lib.schema").EntityScalarField;
|
|
72
|
-
assigneeRoles: import("@contractspec/lib.schema").EntityScalarField;
|
|
73
|
-
taskTemplate: import("@contractspec/lib.schema").EntityScalarField;
|
|
74
|
-
conditionExpression: import("@contractspec/lib.schema").EntityScalarField;
|
|
75
|
-
waitDuration: import("@contractspec/lib.schema").EntityScalarField;
|
|
76
|
-
waitForEvent: import("@contractspec/lib.schema").EntityScalarField;
|
|
77
|
-
actionType: import("@contractspec/lib.schema").EntityScalarField;
|
|
78
|
-
actionConfig: import("@contractspec/lib.schema").EntityScalarField;
|
|
79
|
-
timeoutSeconds: import("@contractspec/lib.schema").EntityScalarField;
|
|
80
|
-
slaSeconds: import("@contractspec/lib.schema").EntityScalarField;
|
|
81
|
-
notifyOnEnter: import("@contractspec/lib.schema").EntityScalarField;
|
|
82
|
-
notifyOnExit: import("@contractspec/lib.schema").EntityScalarField;
|
|
83
|
-
metadata: import("@contractspec/lib.schema").EntityScalarField;
|
|
84
|
-
createdAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
85
|
-
updatedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
86
|
-
workflowDefinition: import("@contractspec/lib.schema").EntityRelationField;
|
|
87
|
-
executions: import("@contractspec/lib.schema").EntityRelationField;
|
|
88
39
|
}> | import("@contractspec/lib.schema").EntitySpec<{
|
|
89
40
|
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
90
41
|
workflowDefinitionId: import("@contractspec/lib.schema").EntityScalarField;
|
|
@@ -129,5 +80,54 @@ export declare const workflowSystemEntities: (import("@contractspec/lib.schema")
|
|
|
129
80
|
completedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
130
81
|
workflowInstance: import("@contractspec/lib.schema").EntityRelationField;
|
|
131
82
|
workflowStep: import("@contractspec/lib.schema").EntityRelationField;
|
|
83
|
+
}> | import("@contractspec/lib.schema").EntitySpec<{
|
|
84
|
+
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
85
|
+
workflowDefinitionId: import("@contractspec/lib.schema").EntityScalarField;
|
|
86
|
+
name: import("@contractspec/lib.schema").EntityScalarField;
|
|
87
|
+
key: import("@contractspec/lib.schema").EntityScalarField;
|
|
88
|
+
description: import("@contractspec/lib.schema").EntityScalarField;
|
|
89
|
+
type: import("@contractspec/lib.schema").EntityEnumField;
|
|
90
|
+
position: import("@contractspec/lib.schema").EntityScalarField;
|
|
91
|
+
transitions: import("@contractspec/lib.schema").EntityScalarField;
|
|
92
|
+
approvalMode: import("@contractspec/lib.schema").EntityEnumField;
|
|
93
|
+
approverRoles: import("@contractspec/lib.schema").EntityScalarField;
|
|
94
|
+
approverUserIds: import("@contractspec/lib.schema").EntityScalarField;
|
|
95
|
+
escalationConfig: import("@contractspec/lib.schema").EntityScalarField;
|
|
96
|
+
assigneeRoles: import("@contractspec/lib.schema").EntityScalarField;
|
|
97
|
+
taskTemplate: import("@contractspec/lib.schema").EntityScalarField;
|
|
98
|
+
conditionExpression: import("@contractspec/lib.schema").EntityScalarField;
|
|
99
|
+
waitDuration: import("@contractspec/lib.schema").EntityScalarField;
|
|
100
|
+
waitForEvent: import("@contractspec/lib.schema").EntityScalarField;
|
|
101
|
+
actionType: import("@contractspec/lib.schema").EntityScalarField;
|
|
102
|
+
actionConfig: import("@contractspec/lib.schema").EntityScalarField;
|
|
103
|
+
timeoutSeconds: import("@contractspec/lib.schema").EntityScalarField;
|
|
104
|
+
slaSeconds: import("@contractspec/lib.schema").EntityScalarField;
|
|
105
|
+
notifyOnEnter: import("@contractspec/lib.schema").EntityScalarField;
|
|
106
|
+
notifyOnExit: import("@contractspec/lib.schema").EntityScalarField;
|
|
107
|
+
metadata: import("@contractspec/lib.schema").EntityScalarField;
|
|
108
|
+
createdAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
109
|
+
updatedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
110
|
+
workflowDefinition: import("@contractspec/lib.schema").EntityRelationField;
|
|
111
|
+
executions: import("@contractspec/lib.schema").EntityRelationField;
|
|
112
|
+
}> | import("@contractspec/lib.schema").EntitySpec<{
|
|
113
|
+
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
114
|
+
name: import("@contractspec/lib.schema").EntityScalarField;
|
|
115
|
+
key: import("@contractspec/lib.schema").EntityScalarField;
|
|
116
|
+
description: import("@contractspec/lib.schema").EntityScalarField;
|
|
117
|
+
version: import("@contractspec/lib.schema").EntityScalarField;
|
|
118
|
+
status: import("@contractspec/lib.schema").EntityEnumField;
|
|
119
|
+
triggerType: import("@contractspec/lib.schema").EntityEnumField;
|
|
120
|
+
triggerConfig: import("@contractspec/lib.schema").EntityScalarField;
|
|
121
|
+
initialStepId: import("@contractspec/lib.schema").EntityScalarField;
|
|
122
|
+
featureFlagKey: import("@contractspec/lib.schema").EntityScalarField;
|
|
123
|
+
settings: import("@contractspec/lib.schema").EntityScalarField;
|
|
124
|
+
metadata: import("@contractspec/lib.schema").EntityScalarField;
|
|
125
|
+
organizationId: import("@contractspec/lib.schema").EntityScalarField;
|
|
126
|
+
createdBy: import("@contractspec/lib.schema").EntityScalarField;
|
|
127
|
+
createdAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
128
|
+
updatedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
129
|
+
publishedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
130
|
+
steps: import("@contractspec/lib.schema").EntityRelationField;
|
|
131
|
+
instances: import("@contractspec/lib.schema").EntityRelationField;
|
|
132
132
|
}>)[];
|
|
133
133
|
export declare const workflowSystemSchemaContribution: ModuleSchemaContribution;
|
package/dist/entities/index.js
CHANGED
|
@@ -113,82 +113,160 @@ var ApprovalCommentEntity = defineEntity({
|
|
|
113
113
|
indexes: [index.on(["approvalRequestId", "createdAt"])]
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
// src/entities/
|
|
116
|
+
// src/entities/instance.ts
|
|
117
117
|
import {
|
|
118
118
|
defineEntity as defineEntity2,
|
|
119
119
|
defineEntityEnum as defineEntityEnum2,
|
|
120
120
|
field as field2,
|
|
121
121
|
index as index2
|
|
122
122
|
} from "@contractspec/lib.schema";
|
|
123
|
-
var
|
|
124
|
-
name: "
|
|
125
|
-
values: [
|
|
123
|
+
var InstanceStatusEnum = defineEntityEnum2({
|
|
124
|
+
name: "InstanceStatus",
|
|
125
|
+
values: [
|
|
126
|
+
"PENDING",
|
|
127
|
+
"RUNNING",
|
|
128
|
+
"WAITING",
|
|
129
|
+
"PAUSED",
|
|
130
|
+
"COMPLETED",
|
|
131
|
+
"CANCELLED",
|
|
132
|
+
"FAILED",
|
|
133
|
+
"TIMEOUT"
|
|
134
|
+
],
|
|
126
135
|
schema: "workflow",
|
|
127
|
-
description: "Status of a workflow
|
|
136
|
+
description: "Status of a workflow instance."
|
|
128
137
|
});
|
|
129
|
-
var
|
|
130
|
-
name: "
|
|
131
|
-
values: [
|
|
138
|
+
var StepExecutionStatusEnum = defineEntityEnum2({
|
|
139
|
+
name: "StepExecutionStatus",
|
|
140
|
+
values: [
|
|
141
|
+
"PENDING",
|
|
142
|
+
"ACTIVE",
|
|
143
|
+
"COMPLETED",
|
|
144
|
+
"SKIPPED",
|
|
145
|
+
"FAILED",
|
|
146
|
+
"TIMEOUT"
|
|
147
|
+
],
|
|
132
148
|
schema: "workflow",
|
|
133
|
-
description: "
|
|
149
|
+
description: "Status of a step execution."
|
|
134
150
|
});
|
|
135
|
-
var
|
|
136
|
-
name: "
|
|
137
|
-
description: "A
|
|
151
|
+
var WorkflowInstanceEntity = defineEntity2({
|
|
152
|
+
name: "WorkflowInstance",
|
|
153
|
+
description: "A running instance of a workflow definition.",
|
|
138
154
|
schema: "workflow",
|
|
139
|
-
map: "
|
|
155
|
+
map: "workflow_instance",
|
|
140
156
|
fields: {
|
|
141
|
-
id: field2.id({ description: "Unique
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
id: field2.id({ description: "Unique instance ID" }),
|
|
158
|
+
workflowDefinitionId: field2.foreignKey(),
|
|
159
|
+
referenceId: field2.string({
|
|
160
|
+
isOptional: true,
|
|
161
|
+
description: "External reference (e.g., order ID)"
|
|
145
162
|
}),
|
|
146
|
-
|
|
163
|
+
referenceType: field2.string({
|
|
147
164
|
isOptional: true,
|
|
148
|
-
description:
|
|
165
|
+
description: 'Type of reference (e.g., "Order")'
|
|
149
166
|
}),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
167
|
+
status: field2.enum("InstanceStatus", { default: "PENDING" }),
|
|
168
|
+
currentStepId: field2.string({
|
|
169
|
+
isOptional: true,
|
|
170
|
+
description: "Current step being executed"
|
|
171
|
+
}),
|
|
172
|
+
contextData: field2.json({ description: "Data context for this instance" }),
|
|
173
|
+
triggeredBy: field2.foreignKey({
|
|
174
|
+
description: "User who triggered the workflow"
|
|
153
175
|
}),
|
|
154
|
-
|
|
155
|
-
triggerType: field2.enum("WorkflowTriggerType", { default: "MANUAL" }),
|
|
156
|
-
triggerConfig: field2.json({
|
|
176
|
+
triggerSource: field2.string({
|
|
157
177
|
isOptional: true,
|
|
158
|
-
description: "
|
|
178
|
+
description: 'Source of trigger (e.g., "api", "ui")'
|
|
179
|
+
}),
|
|
180
|
+
organizationId: field2.foreignKey(),
|
|
181
|
+
priority: field2.int({
|
|
182
|
+
default: 0,
|
|
183
|
+
description: "Processing priority (higher = more urgent)"
|
|
159
184
|
}),
|
|
160
|
-
|
|
185
|
+
dueAt: field2.dateTime({
|
|
161
186
|
isOptional: true,
|
|
162
|
-
description: "
|
|
187
|
+
description: "When this instance should complete"
|
|
163
188
|
}),
|
|
164
|
-
|
|
189
|
+
outcome: field2.string({
|
|
165
190
|
isOptional: true,
|
|
166
|
-
description:
|
|
191
|
+
description: 'Final outcome (e.g., "approved", "rejected")'
|
|
167
192
|
}),
|
|
168
|
-
|
|
193
|
+
resultData: field2.json({
|
|
169
194
|
isOptional: true,
|
|
170
|
-
description: "
|
|
195
|
+
description: "Final result data"
|
|
171
196
|
}),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
description: "User who created this workflow"
|
|
197
|
+
errorMessage: field2.string({
|
|
198
|
+
isOptional: true,
|
|
199
|
+
description: "Error message if failed"
|
|
176
200
|
}),
|
|
177
201
|
createdAt: field2.createdAt(),
|
|
178
202
|
updatedAt: field2.updatedAt(),
|
|
179
|
-
|
|
203
|
+
startedAt: field2.dateTime({ isOptional: true }),
|
|
204
|
+
completedAt: field2.dateTime({ isOptional: true }),
|
|
205
|
+
workflowDefinition: field2.belongsTo("WorkflowDefinition", ["workflowDefinitionId"], ["id"]),
|
|
206
|
+
currentStep: field2.belongsTo("WorkflowStep", ["currentStepId"], ["id"]),
|
|
207
|
+
stepExecutions: field2.hasMany("StepExecution"),
|
|
208
|
+
approvalRequests: field2.hasMany("ApprovalRequest")
|
|
209
|
+
},
|
|
210
|
+
indexes: [
|
|
211
|
+
index2.on(["organizationId", "status"]),
|
|
212
|
+
index2.on(["workflowDefinitionId", "status"]),
|
|
213
|
+
index2.on(["referenceType", "referenceId"]),
|
|
214
|
+
index2.on(["triggeredBy", "status"]),
|
|
215
|
+
index2.on(["status", "dueAt"]),
|
|
216
|
+
index2.on(["createdAt"])
|
|
217
|
+
],
|
|
218
|
+
enums: [InstanceStatusEnum]
|
|
219
|
+
});
|
|
220
|
+
var StepExecutionEntity = defineEntity2({
|
|
221
|
+
name: "StepExecution",
|
|
222
|
+
description: "Execution record of a step within a workflow instance.",
|
|
223
|
+
schema: "workflow",
|
|
224
|
+
map: "step_execution",
|
|
225
|
+
fields: {
|
|
226
|
+
id: field2.id({ description: "Unique execution ID" }),
|
|
227
|
+
workflowInstanceId: field2.foreignKey(),
|
|
228
|
+
workflowStepId: field2.foreignKey(),
|
|
229
|
+
status: field2.enum("StepExecutionStatus", { default: "PENDING" }),
|
|
230
|
+
executionOrder: field2.int({
|
|
231
|
+
default: 0,
|
|
232
|
+
description: "Order of execution within instance"
|
|
233
|
+
}),
|
|
234
|
+
inputData: field2.json({
|
|
180
235
|
isOptional: true,
|
|
181
|
-
description: "
|
|
236
|
+
description: "Data when entering step"
|
|
237
|
+
}),
|
|
238
|
+
outputData: field2.json({
|
|
239
|
+
isOptional: true,
|
|
240
|
+
description: "Data when exiting step"
|
|
241
|
+
}),
|
|
242
|
+
actionTaken: field2.string({
|
|
243
|
+
isOptional: true,
|
|
244
|
+
description: 'Action that caused transition (e.g., "approve")'
|
|
182
245
|
}),
|
|
183
|
-
|
|
184
|
-
|
|
246
|
+
transitionedTo: field2.string({
|
|
247
|
+
isOptional: true,
|
|
248
|
+
description: "Step key transitioned to"
|
|
249
|
+
}),
|
|
250
|
+
executedBy: field2.string({
|
|
251
|
+
isOptional: true,
|
|
252
|
+
description: "User who completed this step"
|
|
253
|
+
}),
|
|
254
|
+
errorMessage: field2.string({ isOptional: true }),
|
|
255
|
+
errorDetails: field2.json({ isOptional: true }),
|
|
256
|
+
retryCount: field2.int({ default: 0 }),
|
|
257
|
+
createdAt: field2.createdAt(),
|
|
258
|
+
updatedAt: field2.updatedAt(),
|
|
259
|
+
startedAt: field2.dateTime({ isOptional: true }),
|
|
260
|
+
completedAt: field2.dateTime({ isOptional: true }),
|
|
261
|
+
workflowInstance: field2.belongsTo("WorkflowInstance", ["workflowInstanceId"], ["id"], { onDelete: "Cascade" }),
|
|
262
|
+
workflowStep: field2.belongsTo("WorkflowStep", ["workflowStepId"], ["id"])
|
|
185
263
|
},
|
|
186
264
|
indexes: [
|
|
187
|
-
index2.
|
|
188
|
-
index2.on(["
|
|
189
|
-
index2.on(["
|
|
265
|
+
index2.on(["workflowInstanceId", "executionOrder"]),
|
|
266
|
+
index2.on(["workflowInstanceId", "workflowStepId"]),
|
|
267
|
+
index2.on(["status"])
|
|
190
268
|
],
|
|
191
|
-
enums: [
|
|
269
|
+
enums: [StepExecutionStatusEnum]
|
|
192
270
|
});
|
|
193
271
|
|
|
194
272
|
// src/entities/step.ts
|
|
@@ -311,160 +389,82 @@ var WorkflowStepEntity = defineEntity3({
|
|
|
311
389
|
enums: [StepTypeEnum, ApprovalModeEnum]
|
|
312
390
|
});
|
|
313
391
|
|
|
314
|
-
// src/entities/
|
|
392
|
+
// src/entities/workflow.ts
|
|
315
393
|
import {
|
|
316
394
|
defineEntity as defineEntity4,
|
|
317
395
|
defineEntityEnum as defineEntityEnum4,
|
|
318
396
|
field as field4,
|
|
319
397
|
index as index4
|
|
320
398
|
} from "@contractspec/lib.schema";
|
|
321
|
-
var
|
|
322
|
-
name: "
|
|
323
|
-
values: [
|
|
324
|
-
"PENDING",
|
|
325
|
-
"RUNNING",
|
|
326
|
-
"WAITING",
|
|
327
|
-
"PAUSED",
|
|
328
|
-
"COMPLETED",
|
|
329
|
-
"CANCELLED",
|
|
330
|
-
"FAILED",
|
|
331
|
-
"TIMEOUT"
|
|
332
|
-
],
|
|
399
|
+
var WorkflowStatusEnum = defineEntityEnum4({
|
|
400
|
+
name: "WorkflowStatus",
|
|
401
|
+
values: ["DRAFT", "ACTIVE", "DEPRECATED", "ARCHIVED"],
|
|
333
402
|
schema: "workflow",
|
|
334
|
-
description: "Status of a workflow
|
|
403
|
+
description: "Status of a workflow definition."
|
|
335
404
|
});
|
|
336
|
-
var
|
|
337
|
-
name: "
|
|
338
|
-
values: [
|
|
339
|
-
"PENDING",
|
|
340
|
-
"ACTIVE",
|
|
341
|
-
"COMPLETED",
|
|
342
|
-
"SKIPPED",
|
|
343
|
-
"FAILED",
|
|
344
|
-
"TIMEOUT"
|
|
345
|
-
],
|
|
405
|
+
var WorkflowTriggerTypeEnum = defineEntityEnum4({
|
|
406
|
+
name: "WorkflowTriggerType",
|
|
407
|
+
values: ["MANUAL", "EVENT", "SCHEDULED", "API"],
|
|
346
408
|
schema: "workflow",
|
|
347
|
-
description: "
|
|
409
|
+
description: "What triggers workflow instantiation."
|
|
348
410
|
});
|
|
349
|
-
var
|
|
350
|
-
name: "
|
|
351
|
-
description: "A
|
|
411
|
+
var WorkflowDefinitionEntity = defineEntity4({
|
|
412
|
+
name: "WorkflowDefinition",
|
|
413
|
+
description: "A workflow blueprint that defines the process structure.",
|
|
352
414
|
schema: "workflow",
|
|
353
|
-
map: "
|
|
415
|
+
map: "workflow_definition",
|
|
354
416
|
fields: {
|
|
355
|
-
id: field4.id({ description: "Unique
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
description: "External reference (e.g., order ID)"
|
|
360
|
-
}),
|
|
361
|
-
referenceType: field4.string({
|
|
362
|
-
isOptional: true,
|
|
363
|
-
description: 'Type of reference (e.g., "Order")'
|
|
417
|
+
id: field4.id({ description: "Unique workflow definition ID" }),
|
|
418
|
+
name: field4.string({ description: "Human-readable workflow name" }),
|
|
419
|
+
key: field4.string({
|
|
420
|
+
description: 'Unique key for referencing (e.g., "purchase_approval")'
|
|
364
421
|
}),
|
|
365
|
-
|
|
366
|
-
currentStepId: field4.string({
|
|
422
|
+
description: field4.string({
|
|
367
423
|
isOptional: true,
|
|
368
|
-
description: "
|
|
424
|
+
description: "Detailed description"
|
|
369
425
|
}),
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
description: "
|
|
426
|
+
version: field4.int({
|
|
427
|
+
default: 1,
|
|
428
|
+
description: "Version number for versioning definitions"
|
|
373
429
|
}),
|
|
374
|
-
|
|
430
|
+
status: field4.enum("WorkflowStatus", { default: "DRAFT" }),
|
|
431
|
+
triggerType: field4.enum("WorkflowTriggerType", { default: "MANUAL" }),
|
|
432
|
+
triggerConfig: field4.json({
|
|
375
433
|
isOptional: true,
|
|
376
|
-
description:
|
|
377
|
-
}),
|
|
378
|
-
organizationId: field4.foreignKey(),
|
|
379
|
-
priority: field4.int({
|
|
380
|
-
default: 0,
|
|
381
|
-
description: "Processing priority (higher = more urgent)"
|
|
434
|
+
description: "Trigger-specific configuration"
|
|
382
435
|
}),
|
|
383
|
-
|
|
436
|
+
initialStepId: field4.string({
|
|
384
437
|
isOptional: true,
|
|
385
|
-
description: "
|
|
438
|
+
description: "First step when workflow starts"
|
|
386
439
|
}),
|
|
387
|
-
|
|
440
|
+
featureFlagKey: field4.string({
|
|
388
441
|
isOptional: true,
|
|
389
|
-
description:
|
|
442
|
+
description: "Feature flag to control availability"
|
|
390
443
|
}),
|
|
391
|
-
|
|
444
|
+
settings: field4.json({
|
|
392
445
|
isOptional: true,
|
|
393
|
-
description: "
|
|
446
|
+
description: "Workflow-wide settings"
|
|
394
447
|
}),
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
448
|
+
metadata: field4.json({ isOptional: true, description: "Custom metadata" }),
|
|
449
|
+
organizationId: field4.foreignKey({ description: "Owning organization" }),
|
|
450
|
+
createdBy: field4.foreignKey({
|
|
451
|
+
description: "User who created this workflow"
|
|
398
452
|
}),
|
|
399
453
|
createdAt: field4.createdAt(),
|
|
400
454
|
updatedAt: field4.updatedAt(),
|
|
401
|
-
|
|
402
|
-
completedAt: field4.dateTime({ isOptional: true }),
|
|
403
|
-
workflowDefinition: field4.belongsTo("WorkflowDefinition", ["workflowDefinitionId"], ["id"]),
|
|
404
|
-
currentStep: field4.belongsTo("WorkflowStep", ["currentStepId"], ["id"]),
|
|
405
|
-
stepExecutions: field4.hasMany("StepExecution"),
|
|
406
|
-
approvalRequests: field4.hasMany("ApprovalRequest")
|
|
407
|
-
},
|
|
408
|
-
indexes: [
|
|
409
|
-
index4.on(["organizationId", "status"]),
|
|
410
|
-
index4.on(["workflowDefinitionId", "status"]),
|
|
411
|
-
index4.on(["referenceType", "referenceId"]),
|
|
412
|
-
index4.on(["triggeredBy", "status"]),
|
|
413
|
-
index4.on(["status", "dueAt"]),
|
|
414
|
-
index4.on(["createdAt"])
|
|
415
|
-
],
|
|
416
|
-
enums: [InstanceStatusEnum]
|
|
417
|
-
});
|
|
418
|
-
var StepExecutionEntity = defineEntity4({
|
|
419
|
-
name: "StepExecution",
|
|
420
|
-
description: "Execution record of a step within a workflow instance.",
|
|
421
|
-
schema: "workflow",
|
|
422
|
-
map: "step_execution",
|
|
423
|
-
fields: {
|
|
424
|
-
id: field4.id({ description: "Unique execution ID" }),
|
|
425
|
-
workflowInstanceId: field4.foreignKey(),
|
|
426
|
-
workflowStepId: field4.foreignKey(),
|
|
427
|
-
status: field4.enum("StepExecutionStatus", { default: "PENDING" }),
|
|
428
|
-
executionOrder: field4.int({
|
|
429
|
-
default: 0,
|
|
430
|
-
description: "Order of execution within instance"
|
|
431
|
-
}),
|
|
432
|
-
inputData: field4.json({
|
|
433
|
-
isOptional: true,
|
|
434
|
-
description: "Data when entering step"
|
|
435
|
-
}),
|
|
436
|
-
outputData: field4.json({
|
|
437
|
-
isOptional: true,
|
|
438
|
-
description: "Data when exiting step"
|
|
439
|
-
}),
|
|
440
|
-
actionTaken: field4.string({
|
|
455
|
+
publishedAt: field4.dateTime({
|
|
441
456
|
isOptional: true,
|
|
442
|
-
description:
|
|
443
|
-
}),
|
|
444
|
-
transitionedTo: field4.string({
|
|
445
|
-
isOptional: true,
|
|
446
|
-
description: "Step key transitioned to"
|
|
447
|
-
}),
|
|
448
|
-
executedBy: field4.string({
|
|
449
|
-
isOptional: true,
|
|
450
|
-
description: "User who completed this step"
|
|
457
|
+
description: "When workflow was activated"
|
|
451
458
|
}),
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
retryCount: field4.int({ default: 0 }),
|
|
455
|
-
createdAt: field4.createdAt(),
|
|
456
|
-
updatedAt: field4.updatedAt(),
|
|
457
|
-
startedAt: field4.dateTime({ isOptional: true }),
|
|
458
|
-
completedAt: field4.dateTime({ isOptional: true }),
|
|
459
|
-
workflowInstance: field4.belongsTo("WorkflowInstance", ["workflowInstanceId"], ["id"], { onDelete: "Cascade" }),
|
|
460
|
-
workflowStep: field4.belongsTo("WorkflowStep", ["workflowStepId"], ["id"])
|
|
459
|
+
steps: field4.hasMany("WorkflowStep"),
|
|
460
|
+
instances: field4.hasMany("WorkflowInstance")
|
|
461
461
|
},
|
|
462
462
|
indexes: [
|
|
463
|
-
index4.
|
|
464
|
-
index4.on(["
|
|
465
|
-
index4.on(["
|
|
463
|
+
index4.unique(["organizationId", "key", "version"]),
|
|
464
|
+
index4.on(["organizationId", "status"]),
|
|
465
|
+
index4.on(["key", "version"])
|
|
466
466
|
],
|
|
467
|
-
enums: [
|
|
467
|
+
enums: [WorkflowStatusEnum, WorkflowTriggerTypeEnum]
|
|
468
468
|
});
|
|
469
469
|
// src/entities/index.ts
|
|
470
470
|
var workflowSystemEntities = [
|
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates a complete workflow/approval system with state machine engine.
|
|
5
5
|
*/
|
|
6
|
-
export * from './workflow';
|
|
7
|
-
export * from './instance';
|
|
8
6
|
export * from './approval';
|
|
9
|
-
export * from './shared';
|
|
10
7
|
export * from './handlers/workflow.handlers';
|
|
11
|
-
export * from './
|
|
8
|
+
export * from './instance';
|
|
12
9
|
export * from './presentations';
|
|
13
|
-
export * from './
|
|
10
|
+
export * from './shared';
|
|
11
|
+
export * from './state-machine';
|
|
14
12
|
export * from './ui';
|
|
13
|
+
export * from './workflow';
|
|
14
|
+
export * from './workflow-system.feature';
|