@webda/workflow 0.0.0-stage → 4.0.0-beta.13

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 (48) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +54 -2
  3. package/lib/authoring.d.ts +112 -0
  4. package/lib/authoring.d.ts.map +1 -0
  5. package/lib/authoring.js +107 -0
  6. package/lib/authoring.js.map +1 -0
  7. package/lib/expression.d.ts +21 -0
  8. package/lib/expression.d.ts.map +1 -0
  9. package/lib/expression.js +196 -0
  10. package/lib/expression.js.map +1 -0
  11. package/lib/graph.d.ts +291 -0
  12. package/lib/graph.d.ts.map +1 -0
  13. package/lib/graph.js +72 -0
  14. package/lib/graph.js.map +1 -0
  15. package/lib/hooks.d.ts +38 -0
  16. package/lib/hooks.d.ts.map +1 -0
  17. package/lib/hooks.js +23 -0
  18. package/lib/hooks.js.map +1 -0
  19. package/lib/index.d.ts +11 -0
  20. package/lib/index.d.ts.map +1 -0
  21. package/lib/index.js +15 -0
  22. package/lib/index.js.map +1 -0
  23. package/lib/interpreter.d.ts +63 -0
  24. package/lib/interpreter.d.ts.map +1 -0
  25. package/lib/interpreter.js +330 -0
  26. package/lib/interpreter.js.map +1 -0
  27. package/lib/models/workflow.model.d.ts +71 -0
  28. package/lib/models/workflow.model.d.ts.map +1 -0
  29. package/lib/models/workflow.model.js +70 -0
  30. package/lib/models/workflow.model.js.map +1 -0
  31. package/lib/models/workflowinstance.model.d.ts +132 -0
  32. package/lib/models/workflowinstance.model.d.ts.map +1 -0
  33. package/lib/models/workflowinstance.model.js +168 -0
  34. package/lib/models/workflowinstance.model.js.map +1 -0
  35. package/lib/models/workflowsignal.model.d.ts +51 -0
  36. package/lib/models/workflowsignal.model.d.ts.map +1 -0
  37. package/lib/models/workflowsignal.model.js +53 -0
  38. package/lib/models/workflowsignal.model.js.map +1 -0
  39. package/lib/models/workflowtask.model.d.ts +103 -0
  40. package/lib/models/workflowtask.model.d.ts.map +1 -0
  41. package/lib/models/workflowtask.model.js +104 -0
  42. package/lib/models/workflowtask.model.js.map +1 -0
  43. package/lib/workflow.service.d.ts +670 -0
  44. package/lib/workflow.service.d.ts.map +1 -0
  45. package/lib/workflow.service.js +1950 -0
  46. package/lib/workflow.service.js.map +1 -0
  47. package/package.json +68 -3
  48. package/webda.module.json +2670 -0
@@ -0,0 +1,330 @@
1
+ import { evaluate } from "./expression.js";
2
+ /**
3
+ * Maximum number of iterations of a `while`
4
+ */
5
+ export const MAX_LOOP_ITERATIONS = 10000;
6
+ /**
7
+ * An error thrown inside the flow, catchable by a `try`
8
+ */
9
+ class FlowThrow {
10
+ error;
11
+ /**
12
+ * @param error - the flow error
13
+ */
14
+ constructor(error) {
15
+ this.error = error;
16
+ }
17
+ }
18
+ const NORMAL = { type: "normal" };
19
+ /**
20
+ * Task key of a statement at an iteration path
21
+ * @param id - the statement id
22
+ * @param path - indexes of the enclosing loops and branches
23
+ * @returns the key
24
+ */
25
+ export function taskKey(id, path) {
26
+ return `${id}@${path.join(".")}`;
27
+ }
28
+ /**
29
+ * Statement id of a task key
30
+ * @param key - the task key
31
+ * @returns the statement id
32
+ */
33
+ export function statementIdOf(key) {
34
+ return key.substring(0, key.lastIndexOf("@"));
35
+ }
36
+ /**
37
+ * Replay of one flow against its journal
38
+ */
39
+ class Replay {
40
+ def;
41
+ journal;
42
+ /**
43
+ * @param def - the flow
44
+ * @param journal - finished task outcomes
45
+ */
46
+ constructor(def, journal) {
47
+ this.def = def;
48
+ this.journal = journal;
49
+ }
50
+ /**
51
+ * Throw a flow error
52
+ * @param code - error code
53
+ * @param message - error message
54
+ * @returns never
55
+ */
56
+ fail(code, message) {
57
+ throw new FlowThrow({ code, message, operation: this.def.id });
58
+ }
59
+ /**
60
+ * Evaluate an expression, an invalid one throws in the flow
61
+ * @param expr - the expression
62
+ * @param scope - the variables
63
+ * @returns the value
64
+ */
65
+ value(expr, scope) {
66
+ try {
67
+ return evaluate(expr, scope);
68
+ }
69
+ catch (err) {
70
+ return this.fail("ExpressionError", err.message);
71
+ }
72
+ }
73
+ /**
74
+ * Run a block of statements in order, stopping at the first one that does not complete normally
75
+ * @param stmts - the statements
76
+ * @param scope - the variables
77
+ * @param path - the iteration path
78
+ * @returns the completion
79
+ */
80
+ block(stmts, scope, path) {
81
+ for (const stmt of stmts ?? []) {
82
+ const res = this.stmt(stmt, scope, path);
83
+ if (res.type !== "normal") {
84
+ return res;
85
+ }
86
+ }
87
+ return NORMAL;
88
+ }
89
+ /**
90
+ * Run one statement
91
+ * @param stmt - the statement
92
+ * @param scope - the variables
93
+ * @param path - the iteration path
94
+ * @returns the completion
95
+ */
96
+ stmt(stmt, scope, path) {
97
+ switch (stmt.kind) {
98
+ case "task":
99
+ return this.task(stmt, scope, path);
100
+ case "assign":
101
+ scope[stmt.name] = this.value(stmt.value, scope);
102
+ return NORMAL;
103
+ case "if":
104
+ return this.block(this.value(stmt.cond, scope) ? stmt.then : stmt.else, scope, path);
105
+ case "forOf": {
106
+ const items = this.value(stmt.items, scope);
107
+ if (!Array.isArray(items)) {
108
+ this.fail("TypeError", `${stmt.id}: items is not an array`);
109
+ }
110
+ for (let i = 0; i < items.length; i++) {
111
+ scope[stmt.item] = items[i];
112
+ const res = this.block(stmt.body, scope, [...path, i]);
113
+ if (res.type !== "normal") {
114
+ return res;
115
+ }
116
+ }
117
+ return NORMAL;
118
+ }
119
+ case "while":
120
+ for (let i = 0; this.value(stmt.cond, scope); i++) {
121
+ if (i >= MAX_LOOP_ITERATIONS) {
122
+ this.fail("LoopLimit", `${stmt.id}: more than ${MAX_LOOP_ITERATIONS} iterations`);
123
+ }
124
+ const res = this.block(stmt.body, scope, [...path, i]);
125
+ if (res.type !== "normal") {
126
+ return res;
127
+ }
128
+ }
129
+ return NORMAL;
130
+ case "try":
131
+ return this.try(stmt, scope, path);
132
+ case "parallel":
133
+ return this.concurrent(stmt.branches.map((branch, i) => ({ body: branch, scope: structuredClone(scope), path: [...path, i] })), Infinity, scope, stmt.assign);
134
+ case "map": {
135
+ const items = this.value(stmt.items, scope);
136
+ if (!Array.isArray(items)) {
137
+ this.fail("TypeError", `${stmt.id}: items is not an array`);
138
+ }
139
+ return this.concurrent(items.map((item, i) => ({
140
+ body: stmt.body,
141
+ scope: { ...structuredClone(scope), [stmt.item]: structuredClone(item) },
142
+ path: [...path, i]
143
+ })), stmt.concurrency && stmt.concurrency > 0 ? stmt.concurrency : Infinity, scope, stmt.assign);
144
+ }
145
+ case "return":
146
+ return { type: "return", value: stmt.value === undefined ? undefined : this.value(stmt.value, scope) };
147
+ case "throw": {
148
+ const value = this.value(stmt.value, scope);
149
+ if (value && typeof value.code === "string" && typeof value.message === "string") {
150
+ // A caught FlowError rethrown
151
+ throw new FlowThrow({ code: value.code, message: value.message, operation: String(value.operation ?? "") });
152
+ }
153
+ return this.fail("FlowError", typeof value === "string" ? value : JSON.stringify(value));
154
+ }
155
+ }
156
+ return this.fail("InvalidStatement", `Unknown statement kind ${stmt?.kind}`);
157
+ }
158
+ /**
159
+ * A task: its outcome from the journal, or schedule it
160
+ * @param stmt - the task statement
161
+ * @param scope - the variables
162
+ * @param path - the iteration path
163
+ * @returns the completion
164
+ */
165
+ task(stmt, scope, path) {
166
+ const key = taskKey(stmt.id, path);
167
+ const outcome = this.journal[key];
168
+ if (outcome === undefined) {
169
+ return {
170
+ type: "pending",
171
+ schedule: [
172
+ {
173
+ key,
174
+ operation: stmt.operation,
175
+ input: this.value(stmt.input, scope),
176
+ options: { ...this.def.options, ...stmt.options }
177
+ }
178
+ ]
179
+ };
180
+ }
181
+ if ("error" in outcome) {
182
+ throw new FlowThrow(outcome.error);
183
+ }
184
+ if (stmt.assign) {
185
+ scope[stmt.assign] = structuredClone(outcome.result);
186
+ }
187
+ return NORMAL;
188
+ }
189
+ /**
190
+ * try/catch/finally: finally runs after the body or the catch, then their completion goes on
191
+ * @param stmt - the try statement
192
+ * @param scope - the variables
193
+ * @param path - the iteration path
194
+ * @returns the completion
195
+ */
196
+ try(stmt, scope, path) {
197
+ let res = NORMAL;
198
+ let thrown;
199
+ try {
200
+ res = this.block(stmt.body, scope, path);
201
+ }
202
+ catch (err) {
203
+ if (!(err instanceof FlowThrow))
204
+ throw err;
205
+ if (stmt.catch) {
206
+ if (stmt.catchVar) {
207
+ scope[stmt.catchVar] = structuredClone(err.error);
208
+ }
209
+ try {
210
+ res = this.block(stmt.catch, scope, path);
211
+ }
212
+ catch (err2) {
213
+ if (!(err2 instanceof FlowThrow))
214
+ throw err2;
215
+ thrown = err2;
216
+ }
217
+ }
218
+ else {
219
+ thrown = err;
220
+ }
221
+ }
222
+ if (res?.type === "pending") {
223
+ return res;
224
+ }
225
+ const fin = this.block(stmt.finally, scope, path);
226
+ if (fin.type !== "normal") {
227
+ return fin;
228
+ }
229
+ if (thrown) {
230
+ throw thrown;
231
+ }
232
+ return res;
233
+ }
234
+ /**
235
+ * Run branches concurrently: each one on its own copy of the variables, at most `concurrency` unfinished
236
+ * @param branches - the bodies with their scope and path
237
+ * @param concurrency - maximum number of unfinished branches
238
+ * @param scope - the parent variables
239
+ * @param assign - variable receiving the return values
240
+ * @returns the completion
241
+ */
242
+ concurrent(branches, concurrency, scope, assign) {
243
+ const values = [];
244
+ const schedule = [];
245
+ let running = 0;
246
+ let error;
247
+ for (const branch of branches) {
248
+ if (running >= concurrency) {
249
+ // A later branch cannot start before one of the running ones finishes
250
+ break;
251
+ }
252
+ try {
253
+ const res = this.block(branch.body, branch.scope, branch.path);
254
+ if (res.type === "pending") {
255
+ running++;
256
+ schedule.push(...res.schedule);
257
+ }
258
+ else {
259
+ values.push(res.type === "return" ? res.value : undefined);
260
+ }
261
+ }
262
+ catch (err) {
263
+ if (!(err instanceof FlowThrow))
264
+ throw err;
265
+ // The first branch to fail (in order) fails the whole statement
266
+ error ??= err;
267
+ }
268
+ }
269
+ if (error) {
270
+ throw error;
271
+ }
272
+ if (schedule.length) {
273
+ return { type: "pending", schedule };
274
+ }
275
+ if (assign) {
276
+ scope[assign] = values;
277
+ }
278
+ return NORMAL;
279
+ }
280
+ }
281
+ /**
282
+ * Replay a flow against its journal
283
+ *
284
+ * Pure: no I/O, the same arguments always give the same result.
285
+ * @param def - the flow definition
286
+ * @param input - the flow input, by parameter name
287
+ * @param journal - outcomes of the finished tasks
288
+ * @returns done with the output, error with the uncaught error, or pending with the tasks to run
289
+ */
290
+ export function run(def, input, journal) {
291
+ const replay = new Replay(def, journal);
292
+ try {
293
+ const res = replay.block(def.body, structuredClone(input ?? {}), []);
294
+ if (res.type === "pending") {
295
+ return { status: "pending", schedule: res.schedule };
296
+ }
297
+ return { status: "done", output: res.type === "return" ? res.value : undefined };
298
+ }
299
+ catch (err) {
300
+ if (err instanceof FlowThrow) {
301
+ return { status: "error", error: err.error };
302
+ }
303
+ throw err;
304
+ }
305
+ }
306
+ /**
307
+ * Statement ids of a definition, nested ones included
308
+ * @param def - the flow definition
309
+ * @returns the ids
310
+ */
311
+ export function keysOf(def) {
312
+ const ids = new Set();
313
+ const walk = (stmts) => {
314
+ for (const stmt of stmts ?? []) {
315
+ if (!stmt || typeof stmt !== "object")
316
+ continue;
317
+ ids.add(stmt.id);
318
+ walk(stmt.then);
319
+ walk(stmt.else);
320
+ walk(stmt.body);
321
+ walk(stmt.catch);
322
+ walk(stmt.finally);
323
+ for (const branch of stmt.branches ?? [])
324
+ walk(branch);
325
+ }
326
+ };
327
+ walk(def.body);
328
+ return ids;
329
+ }
330
+ //# sourceMappingURL=interpreter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpreter.js","sources":["../src/interpreter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AA0BzC;;GAEG;AACH,MAAM,SAAS;IAIM,KAAK;IAHxB;;OAEG;IACH,YAAmB,KAAgB;qBAAhB,KAAK;IAAc,CAAC;CACxC;AAOD,MAAM,MAA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AAG,CAAC,KAAwB,EAAE,EAAE;QACxC,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;YAC/B,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,SAAS;YAChD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE;gBAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACf,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { CoreModel, type IOperationContext } from "@webda/core";
2
+ import type { TaskOptions } from "../graph.js";
3
+ /**
4
+ * A cron launching a stored workflow
5
+ */
6
+ export interface StoredWorkflowCron {
7
+ /**
8
+ * Cron expression
9
+ */
10
+ cron: string;
11
+ /**
12
+ * Description
13
+ */
14
+ description?: string;
15
+ /**
16
+ * Flow input, by parameter name
17
+ */
18
+ input?: Record<string, any>;
19
+ }
20
+ /**
21
+ * A workflow defined at runtime: the same graph as a `.flow.ts` flow, stored as data
22
+ *
23
+ * Saving validates the graph (expressions, statement kinds, operations, `useSystem`); the WorkflowService registers
24
+ * it as the operation `name` and its crons, which run as the user who saved it last.
25
+ *
26
+ * @WebdaModel
27
+ * @WebdaPlural Workflows
28
+ */
29
+ export default class Workflow extends CoreModel {
30
+ /**
31
+ * Flow id: the operation launching it
32
+ */
33
+ name: string;
34
+ /**
35
+ * Names of the flow parameters, in order
36
+ */
37
+ params: string[];
38
+ /**
39
+ * JSON schema of the input
40
+ */
41
+ input: object;
42
+ /**
43
+ * The statements ({@link Stmt}[])
44
+ */
45
+ body: any[];
46
+ /**
47
+ * Default options of every task
48
+ */
49
+ options?: TaskOptions;
50
+ /**
51
+ * Crons launching the flow
52
+ */
53
+ crons?: StoredWorkflowCron[];
54
+ /**
55
+ * {@link flowVersion} of the graph, computed on save
56
+ */
57
+ version: string;
58
+ /**
59
+ * User id of the last save: the identity of its crons
60
+ */
61
+ updatedBy?: string;
62
+ /**
63
+ * The system always; any authenticated user reads; writes need the stored workflow role
64
+ * @param context - the caller
65
+ * @param action - the action
66
+ * @returns true when allowed, the reason otherwise
67
+ */
68
+ canAct(context: IOperationContext, action: string): Promise<string | boolean>;
69
+ }
70
+ export { Workflow };
71
+ //# sourceMappingURL=workflow.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.model.d.ts","sources":["../../src/models/workflow.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,SAAS;IAC7C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACG,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAalF;CACF;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { CoreModel } from "@webda/core";
2
+ import { useWorkflowControls } from "../hooks.js";
3
+ /**
4
+ * A workflow defined at runtime: the same graph as a `.flow.ts` flow, stored as data
5
+ *
6
+ * Saving validates the graph (expressions, statement kinds, operations, `useSystem`); the WorkflowService registers
7
+ * it as the operation `name` and its crons, which run as the user who saved it last.
8
+ *
9
+ * @WebdaModel
10
+ * @WebdaPlural Workflows
11
+ */
12
+ export default class Workflow extends CoreModel {
13
+ /**
14
+ * Flow id: the operation launching it
15
+ */
16
+ name;
17
+ /**
18
+ * Names of the flow parameters, in order
19
+ */
20
+ params;
21
+ /**
22
+ * JSON schema of the input
23
+ */
24
+ input;
25
+ /**
26
+ * The statements ({@link Stmt}[])
27
+ */
28
+ body;
29
+ /**
30
+ * Default options of every task
31
+ */
32
+ options;
33
+ /**
34
+ * Crons launching the flow
35
+ */
36
+ crons;
37
+ /**
38
+ * {@link flowVersion} of the graph, computed on save
39
+ */
40
+ version;
41
+ /**
42
+ * User id of the last save: the identity of its crons
43
+ */
44
+ updatedBy;
45
+ /**
46
+ * The system always; any authenticated user reads; writes need the stored workflow role
47
+ * @param context - the caller
48
+ * @param action - the action
49
+ * @returns true when allowed, the reason otherwise
50
+ */
51
+ async canAct(context, action) {
52
+ if (context.isGlobalContext())
53
+ return true;
54
+ if (!context.getCurrentUserId())
55
+ return "Authentication required";
56
+ if (action === "get" || action === "query")
57
+ return true;
58
+ let role = "workflow-admin";
59
+ try {
60
+ role = useWorkflowControls().getStoredWorkflowRole();
61
+ }
62
+ catch {
63
+ // No WorkflowService: the default role
64
+ }
65
+ const roles = context.getSession()?.roles ?? (await context.getCurrentUser())?.getRoles?.() ?? [];
66
+ return roles.includes(role) || `Role ${role} required`;
67
+ }
68
+ }
69
+ export { Workflow };
70
+ //# sourceMappingURL=workflow.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.model.js","sources":["../../src/models/workflow.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAoBlD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,SAAS;IAC7C;;OAEG;IACH,IAAI,CAAS;IACb;;OAEG;IACH,MAAM,CAAW;IACjB;;OAEG;IACH,KAAK,CAAS;IACd;;OAEG;IACH,IAAI,CAAQ;IACZ;;OAEG;IACH,OAAO,CAAe;IACtB;;OAEG;IACH,KAAK,CAAwB;IAC7B;;OAEG;IACH,OAAO,CAAS;IAChB;;OAEG;IACH,SAAS,CAAU;IAEnB;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,OAA0B,EAAE,MAAc;QACrD,IAAI,OAAO,CAAC,eAAe,EAAE;YAAE,OAAO,IAAI,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAAE,OAAO,yBAAyB,CAAC;QAClE,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACxD,IAAI,IAAI,GAAG,gBAAgB,CAAC;QAC5B,IAAI,CAAC;YACH,IAAI,GAAG,mBAAmB,EAAE,CAAC,qBAAqB,EAAE,CAAC;QACvD,CAAC;QAAC,MAAM,CAAC;YACP,uCAAuC;QACzC,CAAC;QACD,MAAM,KAAK,GACT,OAAO,CAAC,UAAU,EAAE,EAAE,KAAK,IAAK,CAAC,MAAM,OAAO,CAAC,cAAc,EAAE,CAAS,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;QAC/F,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,IAAI,WAAW,CAAC;IACzD,CAAC;CACF;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,132 @@
1
+ import { CoreModel, type IOperationContext, type MfaState } from "@webda/core";
2
+ import type { FlowDefinitionData, FlowError, Journal } from "../graph.js";
3
+ /**
4
+ * Status of a workflow instance
5
+ */
6
+ export type WorkflowInstanceStatus = "RUNNING" | "WAITING" | "SUCCESS" | "ERROR" | "CANCELLED";
7
+ /**
8
+ * Who launched a workflow: the steps run as this identity
9
+ */
10
+ export interface WorkflowLauncher {
11
+ /**
12
+ * User id of the launcher
13
+ */
14
+ userId?: string;
15
+ /**
16
+ * Ident used by the launcher to log in
17
+ */
18
+ identId?: string;
19
+ /**
20
+ * Granted scopes of the launcher session, when restricted
21
+ */
22
+ scopes?: string[];
23
+ /**
24
+ * OAuth client id of the launcher session, when applicable
25
+ */
26
+ clientId?: string;
27
+ /**
28
+ * MFA state of the launcher session
29
+ */
30
+ mfa?: MfaState;
31
+ /**
32
+ * MFA verification timestamp of the launcher session
33
+ */
34
+ mfaAt?: number;
35
+ /**
36
+ * Launched by the system
37
+ */
38
+ system?: boolean;
39
+ }
40
+ /**
41
+ * Whether a caller may read or control an object launched by `launcherId`
42
+ * @param context - the caller
43
+ * @param action - the action
44
+ * @param launcherId - user id of the launcher
45
+ * @returns true when allowed, the reason otherwise
46
+ */
47
+ export declare function canReadWorkflow(context: IOperationContext, action: string, launcherId?: string): string | boolean;
48
+ /**
49
+ * A running (or finished) flow: its pinned definition, input and journal of task outcomes
50
+ *
51
+ * @WebdaModel
52
+ * @WebdaPlural WorkflowInstances
53
+ */
54
+ export default class WorkflowInstance extends CoreModel {
55
+ /**
56
+ * Flow id: the operation id launching the flow
57
+ */
58
+ flowId: string;
59
+ /**
60
+ * Version of the pinned definition
61
+ */
62
+ version: string;
63
+ /**
64
+ * The definition the instance runs, pinned at launch
65
+ */
66
+ definition: FlowDefinitionData;
67
+ /**
68
+ * Flow input, by parameter name
69
+ */
70
+ input: Record<string, any>;
71
+ /**
72
+ * Outcomes of the finished tasks, by task key
73
+ */
74
+ journal: Journal;
75
+ /**
76
+ * Current status
77
+ */
78
+ status: WorkflowInstanceStatus;
79
+ /**
80
+ * Identity the steps run as
81
+ */
82
+ launcher: WorkflowLauncher;
83
+ /**
84
+ * Flow output, once SUCCESS
85
+ */
86
+ output?: any;
87
+ /**
88
+ * Uncaught error, once ERROR
89
+ */
90
+ error?: FlowError;
91
+ /**
92
+ * Revision of the instance, incremented by every write (compare-and-set)
93
+ */
94
+ revision: number;
95
+ /**
96
+ * Parent instance and task key of a child flow
97
+ */
98
+ parent?: {
99
+ instance: string;
100
+ key: string;
101
+ };
102
+ /**
103
+ * Creation time (ms)
104
+ */
105
+ createdAt: number;
106
+ /**
107
+ * Last update time (ms)
108
+ */
109
+ updatedAt: number;
110
+ /**
111
+ * Launcher and system may read, writes go through the service only
112
+ * @param context - the caller
113
+ * @param action - the action
114
+ * @returns true when allowed, the reason otherwise
115
+ */
116
+ canAct(context: IOperationContext, action: string): string | boolean;
117
+ /**
118
+ * Cancel the instance, its live tasks and the children it waits on
119
+ */
120
+ cancel(): Promise<void>;
121
+ /**
122
+ * Restart a failed instance from its failed task, keeping the outcomes before it
123
+ */
124
+ retry(): Promise<void>;
125
+ /**
126
+ * Move a running instance to another version of its flow
127
+ * @param version - the target version, the latest registered when omitted
128
+ */
129
+ migrate(version?: string): Promise<void>;
130
+ }
131
+ export { WorkflowInstance };
132
+ //# sourceMappingURL=workflowinstance.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowinstance.model.d.ts","sources":["../../src/models/workflowinstance.model.ts"],"names":[],"mappings":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