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