@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/instance/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Instance domain - Workflow instance execution and management.
|
|
3
3
|
*/
|
|
4
4
|
export { InstanceStatusEnum } from './instance.enum';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
5
|
+
export { InstanceCancelledEvent, InstanceCompletedEvent, InstanceFailedEvent, InstancePausedEvent, InstanceResumedEvent, InstanceStartedEvent, InstanceTimedOutEvent, StepEnteredEvent, StepExitedEvent, } from './instance.event';
|
|
6
|
+
export { CancelWorkflowContract, GetInstanceContract, ListInstancesContract, PauseWorkflowContract, ResumeWorkflowContract, StartWorkflowContract, TransitionWorkflowContract, } from './instance.operations';
|
|
7
|
+
export { StartWorkflowInputModel, TransitionInputModel, TransitionResultModel, WorkflowInstanceModel, } from './instance.schema';
|
package/dist/instance/index.js
CHANGED
|
@@ -12,86 +12,240 @@ var InstanceStatusEnum = defineEnum("InstanceStatus", [
|
|
|
12
12
|
"TIMEOUT"
|
|
13
13
|
]);
|
|
14
14
|
|
|
15
|
-
// src/instance/instance.
|
|
15
|
+
// src/instance/instance.event.ts
|
|
16
|
+
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
16
17
|
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
17
|
-
var
|
|
18
|
-
name: "
|
|
19
|
-
description: "
|
|
18
|
+
var InstanceEventPayload = defineSchemaModel({
|
|
19
|
+
name: "InstanceEventPayload",
|
|
20
|
+
description: "Base payload for instance events",
|
|
20
21
|
fields: {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
+
workflowId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
workflowKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
25
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
26
|
+
referenceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
27
|
+
referenceType: {
|
|
28
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
29
|
+
isOptional: true
|
|
30
|
+
},
|
|
31
|
+
triggeredBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
32
|
+
organizationId: {
|
|
23
33
|
type: ScalarTypeEnum.String_unsecure(),
|
|
24
34
|
isOptional: false
|
|
25
35
|
},
|
|
36
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
var StepTransitionPayload = defineSchemaModel({
|
|
40
|
+
name: "StepTransitionEventPayload",
|
|
41
|
+
description: "Payload for step transition events",
|
|
42
|
+
fields: {
|
|
43
|
+
instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
44
|
+
workflowId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
45
|
+
fromStepKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
46
|
+
toStepKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
47
|
+
action: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
48
|
+
executedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
49
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var InstanceCompletedPayload = defineSchemaModel({
|
|
53
|
+
name: "InstanceCompletedEventPayload",
|
|
54
|
+
description: "Payload when instance completes",
|
|
55
|
+
fields: {
|
|
56
|
+
instanceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
57
|
+
workflowId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
58
|
+
workflowKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
59
|
+
outcome: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
26
60
|
referenceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
27
61
|
referenceType: {
|
|
28
62
|
type: ScalarTypeEnum.String_unsecure(),
|
|
29
63
|
isOptional: true
|
|
30
64
|
},
|
|
65
|
+
duration: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
66
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var InstanceStartedEvent = defineEvent({
|
|
70
|
+
meta: {
|
|
71
|
+
key: "workflow.instance.started",
|
|
72
|
+
version: "1.0.0",
|
|
73
|
+
description: "A new workflow instance has been started.",
|
|
74
|
+
stability: "stable",
|
|
75
|
+
owners: ["@workflow-team"],
|
|
76
|
+
tags: ["workflow", "instance", "started"]
|
|
77
|
+
},
|
|
78
|
+
payload: InstanceEventPayload
|
|
79
|
+
});
|
|
80
|
+
var StepEnteredEvent = defineEvent({
|
|
81
|
+
meta: {
|
|
82
|
+
key: "workflow.step.entered",
|
|
83
|
+
version: "1.0.0",
|
|
84
|
+
description: "A workflow instance has entered a new step.",
|
|
85
|
+
stability: "stable",
|
|
86
|
+
owners: ["@workflow-team"],
|
|
87
|
+
tags: ["workflow", "step", "entered"]
|
|
88
|
+
},
|
|
89
|
+
payload: StepTransitionPayload
|
|
90
|
+
});
|
|
91
|
+
var StepExitedEvent = defineEvent({
|
|
92
|
+
meta: {
|
|
93
|
+
key: "workflow.step.exited",
|
|
94
|
+
version: "1.0.0",
|
|
95
|
+
description: "A workflow instance has exited a step.",
|
|
96
|
+
stability: "stable",
|
|
97
|
+
owners: ["@workflow-team"],
|
|
98
|
+
tags: ["workflow", "step", "exited"]
|
|
99
|
+
},
|
|
100
|
+
payload: StepTransitionPayload
|
|
101
|
+
});
|
|
102
|
+
var InstanceCompletedEvent = defineEvent({
|
|
103
|
+
meta: {
|
|
104
|
+
key: "workflow.instance.completed",
|
|
105
|
+
version: "1.0.0",
|
|
106
|
+
description: "A workflow instance has completed.",
|
|
107
|
+
stability: "stable",
|
|
108
|
+
owners: ["@workflow-team"],
|
|
109
|
+
tags: ["workflow", "instance", "completed"]
|
|
110
|
+
},
|
|
111
|
+
payload: InstanceCompletedPayload
|
|
112
|
+
});
|
|
113
|
+
var InstanceCancelledEvent = defineEvent({
|
|
114
|
+
meta: {
|
|
115
|
+
key: "workflow.instance.cancelled",
|
|
116
|
+
version: "1.0.0",
|
|
117
|
+
description: "A workflow instance has been cancelled.",
|
|
118
|
+
stability: "stable",
|
|
119
|
+
owners: ["@workflow-team"],
|
|
120
|
+
tags: ["workflow", "instance", "cancelled"]
|
|
121
|
+
},
|
|
122
|
+
payload: InstanceEventPayload
|
|
123
|
+
});
|
|
124
|
+
var InstancePausedEvent = defineEvent({
|
|
125
|
+
meta: {
|
|
126
|
+
key: "workflow.instance.paused",
|
|
127
|
+
version: "1.0.0",
|
|
128
|
+
description: "A workflow instance has been paused.",
|
|
129
|
+
stability: "stable",
|
|
130
|
+
owners: ["@workflow-team"],
|
|
131
|
+
tags: ["workflow", "instance", "paused"]
|
|
132
|
+
},
|
|
133
|
+
payload: InstanceEventPayload
|
|
134
|
+
});
|
|
135
|
+
var InstanceResumedEvent = defineEvent({
|
|
136
|
+
meta: {
|
|
137
|
+
key: "workflow.instance.resumed",
|
|
138
|
+
version: "1.0.0",
|
|
139
|
+
description: "A workflow instance has been resumed.",
|
|
140
|
+
stability: "stable",
|
|
141
|
+
owners: ["@workflow-team"],
|
|
142
|
+
tags: ["workflow", "instance", "resumed"]
|
|
143
|
+
},
|
|
144
|
+
payload: InstanceEventPayload
|
|
145
|
+
});
|
|
146
|
+
var InstanceFailedEvent = defineEvent({
|
|
147
|
+
meta: {
|
|
148
|
+
key: "workflow.instance.failed",
|
|
149
|
+
version: "1.0.0",
|
|
150
|
+
description: "A workflow instance has failed.",
|
|
151
|
+
stability: "stable",
|
|
152
|
+
owners: ["@workflow-team"],
|
|
153
|
+
tags: ["workflow", "instance", "failed"]
|
|
154
|
+
},
|
|
155
|
+
payload: InstanceEventPayload
|
|
156
|
+
});
|
|
157
|
+
var InstanceTimedOutEvent = defineEvent({
|
|
158
|
+
meta: {
|
|
159
|
+
key: "workflow.instance.timedOut",
|
|
160
|
+
version: "1.0.0",
|
|
161
|
+
description: "A workflow instance has timed out.",
|
|
162
|
+
stability: "stable",
|
|
163
|
+
owners: ["@workflow-team"],
|
|
164
|
+
tags: ["workflow", "instance", "timeout"]
|
|
165
|
+
},
|
|
166
|
+
payload: InstanceEventPayload
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// src/instance/instance.schema.ts
|
|
170
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
171
|
+
var WorkflowInstanceModel = defineSchemaModel2({
|
|
172
|
+
name: "WorkflowInstanceModel",
|
|
173
|
+
description: "A running workflow instance",
|
|
174
|
+
fields: {
|
|
175
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
176
|
+
workflowDefinitionId: {
|
|
177
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
178
|
+
isOptional: false
|
|
179
|
+
},
|
|
180
|
+
referenceId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
181
|
+
referenceType: {
|
|
182
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
183
|
+
isOptional: true
|
|
184
|
+
},
|
|
31
185
|
status: { type: InstanceStatusEnum, isOptional: false },
|
|
32
186
|
currentStepId: {
|
|
33
|
-
type:
|
|
187
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
34
188
|
isOptional: true
|
|
35
189
|
},
|
|
36
|
-
contextData: { type:
|
|
37
|
-
triggeredBy: { type:
|
|
190
|
+
contextData: { type: ScalarTypeEnum2.JSON(), isOptional: true },
|
|
191
|
+
triggeredBy: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
38
192
|
organizationId: {
|
|
39
|
-
type:
|
|
193
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
40
194
|
isOptional: false
|
|
41
195
|
},
|
|
42
|
-
priority: { type:
|
|
43
|
-
dueAt: { type:
|
|
44
|
-
outcome: { type:
|
|
45
|
-
resultData: { type:
|
|
196
|
+
priority: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
197
|
+
dueAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
198
|
+
outcome: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
199
|
+
resultData: { type: ScalarTypeEnum2.JSON(), isOptional: true },
|
|
46
200
|
errorMessage: {
|
|
47
|
-
type:
|
|
201
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
48
202
|
isOptional: true
|
|
49
203
|
},
|
|
50
|
-
createdAt: { type:
|
|
51
|
-
startedAt: { type:
|
|
52
|
-
completedAt: { type:
|
|
204
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
205
|
+
startedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
206
|
+
completedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
|
|
53
207
|
}
|
|
54
208
|
});
|
|
55
|
-
var StartWorkflowInputModel =
|
|
209
|
+
var StartWorkflowInputModel = defineSchemaModel2({
|
|
56
210
|
name: "StartWorkflowInput",
|
|
57
211
|
description: "Input for starting a workflow",
|
|
58
212
|
fields: {
|
|
59
|
-
workflowKey: { type:
|
|
60
|
-
contextData: { type:
|
|
61
|
-
referenceId: { type:
|
|
213
|
+
workflowKey: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
214
|
+
contextData: { type: ScalarTypeEnum2.JSON(), isOptional: true },
|
|
215
|
+
referenceId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
62
216
|
referenceType: {
|
|
63
|
-
type:
|
|
217
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
64
218
|
isOptional: true
|
|
65
219
|
},
|
|
66
|
-
priority: { type:
|
|
67
|
-
dueAt: { type:
|
|
220
|
+
priority: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
221
|
+
dueAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
|
|
68
222
|
}
|
|
69
223
|
});
|
|
70
|
-
var TransitionInputModel =
|
|
224
|
+
var TransitionInputModel = defineSchemaModel2({
|
|
71
225
|
name: "TransitionInput",
|
|
72
226
|
description: "Input for transitioning a workflow",
|
|
73
227
|
fields: {
|
|
74
|
-
instanceId: { type:
|
|
75
|
-
action: { type:
|
|
76
|
-
data: { type:
|
|
77
|
-
comment: { type:
|
|
228
|
+
instanceId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
229
|
+
action: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
230
|
+
data: { type: ScalarTypeEnum2.JSON(), isOptional: true },
|
|
231
|
+
comment: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
78
232
|
}
|
|
79
233
|
});
|
|
80
|
-
var TransitionResultModel =
|
|
234
|
+
var TransitionResultModel = defineSchemaModel2({
|
|
81
235
|
name: "TransitionResult",
|
|
82
236
|
description: "Result of a workflow transition",
|
|
83
237
|
fields: {
|
|
84
|
-
success: { type:
|
|
238
|
+
success: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
85
239
|
instance: { type: WorkflowInstanceModel, isOptional: false },
|
|
86
240
|
previousStepKey: {
|
|
87
|
-
type:
|
|
241
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
88
242
|
isOptional: true
|
|
89
243
|
},
|
|
90
244
|
currentStepKey: {
|
|
91
|
-
type:
|
|
245
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
92
246
|
isOptional: true
|
|
93
247
|
},
|
|
94
|
-
message: { type:
|
|
248
|
+
message: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
95
249
|
}
|
|
96
250
|
});
|
|
97
251
|
|
|
@@ -100,7 +254,7 @@ import {
|
|
|
100
254
|
defineCommand,
|
|
101
255
|
defineQuery
|
|
102
256
|
} from "@contractspec/lib.contracts-spec/operations";
|
|
103
|
-
import { defineSchemaModel as
|
|
257
|
+
import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
|
|
104
258
|
var OWNERS = ["@example.workflow-system"];
|
|
105
259
|
var StartWorkflowContract = defineCommand({
|
|
106
260
|
meta: {
|
|
@@ -229,14 +383,14 @@ var PauseWorkflowContract = defineCommand({
|
|
|
229
383
|
context: "Administrative action, emergency stop."
|
|
230
384
|
},
|
|
231
385
|
io: {
|
|
232
|
-
input:
|
|
386
|
+
input: defineSchemaModel3({
|
|
233
387
|
name: "PauseResumeInput",
|
|
234
388
|
fields: {
|
|
235
389
|
instanceId: {
|
|
236
|
-
type:
|
|
390
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
237
391
|
isOptional: false
|
|
238
392
|
},
|
|
239
|
-
reason: { type:
|
|
393
|
+
reason: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
|
|
240
394
|
}
|
|
241
395
|
}),
|
|
242
396
|
output: WorkflowInstanceModel
|
|
@@ -283,14 +437,14 @@ var ResumeWorkflowContract = defineCommand({
|
|
|
283
437
|
context: "Administrative action."
|
|
284
438
|
},
|
|
285
439
|
io: {
|
|
286
|
-
input:
|
|
440
|
+
input: defineSchemaModel3({
|
|
287
441
|
name: "PauseResumeInput",
|
|
288
442
|
fields: {
|
|
289
443
|
instanceId: {
|
|
290
|
-
type:
|
|
444
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
291
445
|
isOptional: false
|
|
292
446
|
},
|
|
293
|
-
reason: { type:
|
|
447
|
+
reason: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
|
|
294
448
|
}
|
|
295
449
|
}),
|
|
296
450
|
output: WorkflowInstanceModel
|
|
@@ -337,15 +491,15 @@ var CancelWorkflowContract = defineCommand({
|
|
|
337
491
|
context: "User request, system cancellation."
|
|
338
492
|
},
|
|
339
493
|
io: {
|
|
340
|
-
input:
|
|
494
|
+
input: defineSchemaModel3({
|
|
341
495
|
name: "CancelWorkflowInput",
|
|
342
496
|
fields: {
|
|
343
497
|
instanceId: {
|
|
344
|
-
type:
|
|
498
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
345
499
|
isOptional: false
|
|
346
500
|
},
|
|
347
501
|
reason: {
|
|
348
|
-
type:
|
|
502
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
349
503
|
isOptional: false
|
|
350
504
|
}
|
|
351
505
|
}
|
|
@@ -394,39 +548,39 @@ var ListInstancesContract = defineQuery({
|
|
|
394
548
|
context: "Dashboard, monitoring."
|
|
395
549
|
},
|
|
396
550
|
io: {
|
|
397
|
-
input:
|
|
551
|
+
input: defineSchemaModel3({
|
|
398
552
|
name: "ListInstancesInput",
|
|
399
553
|
fields: {
|
|
400
554
|
workflowKey: {
|
|
401
|
-
type:
|
|
555
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
402
556
|
isOptional: true
|
|
403
557
|
},
|
|
404
558
|
status: { type: InstanceStatusEnum, isOptional: true },
|
|
405
559
|
referenceType: {
|
|
406
|
-
type:
|
|
560
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
407
561
|
isOptional: true
|
|
408
562
|
},
|
|
409
563
|
referenceId: {
|
|
410
|
-
type:
|
|
564
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
411
565
|
isOptional: true
|
|
412
566
|
},
|
|
413
567
|
triggeredBy: {
|
|
414
|
-
type:
|
|
568
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
415
569
|
isOptional: true
|
|
416
570
|
},
|
|
417
571
|
limit: {
|
|
418
|
-
type:
|
|
572
|
+
type: ScalarTypeEnum3.Int_unsecure(),
|
|
419
573
|
isOptional: true,
|
|
420
574
|
defaultValue: 20
|
|
421
575
|
},
|
|
422
576
|
offset: {
|
|
423
|
-
type:
|
|
577
|
+
type: ScalarTypeEnum3.Int_unsecure(),
|
|
424
578
|
isOptional: true,
|
|
425
579
|
defaultValue: 0
|
|
426
580
|
}
|
|
427
581
|
}
|
|
428
582
|
}),
|
|
429
|
-
output:
|
|
583
|
+
output: defineSchemaModel3({
|
|
430
584
|
name: "ListInstancesOutput",
|
|
431
585
|
fields: {
|
|
432
586
|
instances: {
|
|
@@ -434,7 +588,7 @@ var ListInstancesContract = defineQuery({
|
|
|
434
588
|
isArray: true,
|
|
435
589
|
isOptional: false
|
|
436
590
|
},
|
|
437
|
-
total: { type:
|
|
591
|
+
total: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false }
|
|
438
592
|
}
|
|
439
593
|
})
|
|
440
594
|
},
|
|
@@ -469,11 +623,11 @@ var GetInstanceContract = defineQuery({
|
|
|
469
623
|
context: "Instance detail view."
|
|
470
624
|
},
|
|
471
625
|
io: {
|
|
472
|
-
input:
|
|
626
|
+
input: defineSchemaModel3({
|
|
473
627
|
name: "GetInstanceInput",
|
|
474
628
|
fields: {
|
|
475
629
|
instanceId: {
|
|
476
|
-
type:
|
|
630
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
477
631
|
isOptional: false
|
|
478
632
|
}
|
|
479
633
|
}
|
|
@@ -499,160 +653,6 @@ var GetInstanceContract = defineQuery({
|
|
|
499
653
|
]
|
|
500
654
|
}
|
|
501
655
|
});
|
|
502
|
-
|
|
503
|
-
// src/instance/instance.event.ts
|
|
504
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
505
|
-
import { ScalarTypeEnum as ScalarTypeEnum3, defineSchemaModel as defineSchemaModel3 } from "@contractspec/lib.schema";
|
|
506
|
-
var InstanceEventPayload = defineSchemaModel3({
|
|
507
|
-
name: "InstanceEventPayload",
|
|
508
|
-
description: "Base payload for instance events",
|
|
509
|
-
fields: {
|
|
510
|
-
instanceId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
511
|
-
workflowId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
512
|
-
workflowKey: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
513
|
-
status: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
514
|
-
referenceId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
515
|
-
referenceType: {
|
|
516
|
-
type: ScalarTypeEnum3.String_unsecure(),
|
|
517
|
-
isOptional: true
|
|
518
|
-
},
|
|
519
|
-
triggeredBy: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
520
|
-
organizationId: {
|
|
521
|
-
type: ScalarTypeEnum3.String_unsecure(),
|
|
522
|
-
isOptional: false
|
|
523
|
-
},
|
|
524
|
-
timestamp: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
var StepTransitionPayload = defineSchemaModel3({
|
|
528
|
-
name: "StepTransitionEventPayload",
|
|
529
|
-
description: "Payload for step transition events",
|
|
530
|
-
fields: {
|
|
531
|
-
instanceId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
532
|
-
workflowId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
533
|
-
fromStepKey: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
534
|
-
toStepKey: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
535
|
-
action: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
536
|
-
executedBy: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
537
|
-
timestamp: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
538
|
-
}
|
|
539
|
-
});
|
|
540
|
-
var InstanceCompletedPayload = defineSchemaModel3({
|
|
541
|
-
name: "InstanceCompletedEventPayload",
|
|
542
|
-
description: "Payload when instance completes",
|
|
543
|
-
fields: {
|
|
544
|
-
instanceId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
545
|
-
workflowId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
546
|
-
workflowKey: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
547
|
-
outcome: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
548
|
-
referenceId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
549
|
-
referenceType: {
|
|
550
|
-
type: ScalarTypeEnum3.String_unsecure(),
|
|
551
|
-
isOptional: true
|
|
552
|
-
},
|
|
553
|
-
duration: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
554
|
-
timestamp: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
var InstanceStartedEvent = defineEvent({
|
|
558
|
-
meta: {
|
|
559
|
-
key: "workflow.instance.started",
|
|
560
|
-
version: "1.0.0",
|
|
561
|
-
description: "A new workflow instance has been started.",
|
|
562
|
-
stability: "stable",
|
|
563
|
-
owners: ["@workflow-team"],
|
|
564
|
-
tags: ["workflow", "instance", "started"]
|
|
565
|
-
},
|
|
566
|
-
payload: InstanceEventPayload
|
|
567
|
-
});
|
|
568
|
-
var StepEnteredEvent = defineEvent({
|
|
569
|
-
meta: {
|
|
570
|
-
key: "workflow.step.entered",
|
|
571
|
-
version: "1.0.0",
|
|
572
|
-
description: "A workflow instance has entered a new step.",
|
|
573
|
-
stability: "stable",
|
|
574
|
-
owners: ["@workflow-team"],
|
|
575
|
-
tags: ["workflow", "step", "entered"]
|
|
576
|
-
},
|
|
577
|
-
payload: StepTransitionPayload
|
|
578
|
-
});
|
|
579
|
-
var StepExitedEvent = defineEvent({
|
|
580
|
-
meta: {
|
|
581
|
-
key: "workflow.step.exited",
|
|
582
|
-
version: "1.0.0",
|
|
583
|
-
description: "A workflow instance has exited a step.",
|
|
584
|
-
stability: "stable",
|
|
585
|
-
owners: ["@workflow-team"],
|
|
586
|
-
tags: ["workflow", "step", "exited"]
|
|
587
|
-
},
|
|
588
|
-
payload: StepTransitionPayload
|
|
589
|
-
});
|
|
590
|
-
var InstanceCompletedEvent = defineEvent({
|
|
591
|
-
meta: {
|
|
592
|
-
key: "workflow.instance.completed",
|
|
593
|
-
version: "1.0.0",
|
|
594
|
-
description: "A workflow instance has completed.",
|
|
595
|
-
stability: "stable",
|
|
596
|
-
owners: ["@workflow-team"],
|
|
597
|
-
tags: ["workflow", "instance", "completed"]
|
|
598
|
-
},
|
|
599
|
-
payload: InstanceCompletedPayload
|
|
600
|
-
});
|
|
601
|
-
var InstanceCancelledEvent = defineEvent({
|
|
602
|
-
meta: {
|
|
603
|
-
key: "workflow.instance.cancelled",
|
|
604
|
-
version: "1.0.0",
|
|
605
|
-
description: "A workflow instance has been cancelled.",
|
|
606
|
-
stability: "stable",
|
|
607
|
-
owners: ["@workflow-team"],
|
|
608
|
-
tags: ["workflow", "instance", "cancelled"]
|
|
609
|
-
},
|
|
610
|
-
payload: InstanceEventPayload
|
|
611
|
-
});
|
|
612
|
-
var InstancePausedEvent = defineEvent({
|
|
613
|
-
meta: {
|
|
614
|
-
key: "workflow.instance.paused",
|
|
615
|
-
version: "1.0.0",
|
|
616
|
-
description: "A workflow instance has been paused.",
|
|
617
|
-
stability: "stable",
|
|
618
|
-
owners: ["@workflow-team"],
|
|
619
|
-
tags: ["workflow", "instance", "paused"]
|
|
620
|
-
},
|
|
621
|
-
payload: InstanceEventPayload
|
|
622
|
-
});
|
|
623
|
-
var InstanceResumedEvent = defineEvent({
|
|
624
|
-
meta: {
|
|
625
|
-
key: "workflow.instance.resumed",
|
|
626
|
-
version: "1.0.0",
|
|
627
|
-
description: "A workflow instance has been resumed.",
|
|
628
|
-
stability: "stable",
|
|
629
|
-
owners: ["@workflow-team"],
|
|
630
|
-
tags: ["workflow", "instance", "resumed"]
|
|
631
|
-
},
|
|
632
|
-
payload: InstanceEventPayload
|
|
633
|
-
});
|
|
634
|
-
var InstanceFailedEvent = defineEvent({
|
|
635
|
-
meta: {
|
|
636
|
-
key: "workflow.instance.failed",
|
|
637
|
-
version: "1.0.0",
|
|
638
|
-
description: "A workflow instance has failed.",
|
|
639
|
-
stability: "stable",
|
|
640
|
-
owners: ["@workflow-team"],
|
|
641
|
-
tags: ["workflow", "instance", "failed"]
|
|
642
|
-
},
|
|
643
|
-
payload: InstanceEventPayload
|
|
644
|
-
});
|
|
645
|
-
var InstanceTimedOutEvent = defineEvent({
|
|
646
|
-
meta: {
|
|
647
|
-
key: "workflow.instance.timedOut",
|
|
648
|
-
version: "1.0.0",
|
|
649
|
-
description: "A workflow instance has timed out.",
|
|
650
|
-
stability: "stable",
|
|
651
|
-
owners: ["@workflow-team"],
|
|
652
|
-
tags: ["workflow", "instance", "timeout"]
|
|
653
|
-
},
|
|
654
|
-
payload: InstanceEventPayload
|
|
655
|
-
});
|
|
656
656
|
export {
|
|
657
657
|
WorkflowInstanceModel,
|
|
658
658
|
TransitionWorkflowContract,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/instance/instance.event.ts
|
|
3
3
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
4
|
-
import {
|
|
4
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
5
5
|
var InstanceEventPayload = defineSchemaModel({
|
|
6
6
|
name: "InstanceEventPayload",
|
|
7
7
|
description: "Base payload for instance events",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Workflow instance handlers.
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { HandlerContext, WorkflowInstanceRecord } from '../shared/types';
|
|
5
5
|
export declare function handleStartWorkflow(input: {
|
|
6
6
|
workflowKey: string;
|
|
7
7
|
contextData?: Record<string, unknown>;
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Mock data store for workflow system.
|
|
3
3
|
* In production, this would be backed by a database.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { ApprovalRequestRecord, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord } from './types';
|
|
6
6
|
export declare const mockDataStore: {
|
|
7
7
|
workflows: Map<string, WorkflowDefinitionRecord>;
|
|
8
8
|
steps: Map<string, WorkflowStepRecord>;
|
package/dist/ui/hooks/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/ui/hooks/useWorkflowList.ts
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
3
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
"use client";
|
|
6
6
|
function useWorkflowList(projectId = "local-project") {
|
|
7
7
|
const { handlers } = useTemplateRuntime();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/ui/hooks/useWorkflowList.ts
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
3
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
"use client";
|
|
6
6
|
function useWorkflowList(projectId = "local-project") {
|
|
7
7
|
const { handlers } = useTemplateRuntime();
|
package/dist/ui/index.d.ts
CHANGED
package/dist/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/ui/hooks/useWorkflowList.ts
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
3
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
"use client";
|
|
6
6
|
function useWorkflowList(projectId = "local-project") {
|
|
7
7
|
const { handlers } = useTemplateRuntime();
|
package/dist/workflow/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Workflow domain - Workflow definition and step management.
|
|
3
3
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { CreateWorkflowContract,
|
|
7
|
-
export {
|
|
4
|
+
export { ApprovalModeEnum, StepTypeEnum, TriggerTypeEnum, WorkflowStatusEnum, } from './workflow.enum';
|
|
5
|
+
export { StepAddedEvent, WorkflowCreatedEvent, WorkflowPublishedEvent, WorkflowUpdatedEvent, } from './workflow.event';
|
|
6
|
+
export { AddStepContract, CreateWorkflowContract, GetWorkflowContract, ListWorkflowsContract, PublishWorkflowContract, UpdateWorkflowContract, } from './workflow.operations';
|
|
7
|
+
export { AddStepInputModel, CreateWorkflowInputModel, UpdateWorkflowInputModel, WorkflowDefinitionModel, WorkflowStepModel, } from './workflow.schema';
|