@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,670 @@
1
+ import { Service, ServiceParameters, SimpleOperationContext, type OperationContext } from "@webda/core";
2
+ import { type FlowDefinition, type FlowDefinitionData, type FlowError, type JournalEntry } from "./graph.js";
3
+ import { type ScheduledTask } from "./interpreter.js";
4
+ import { type WorkflowControls } from "./hooks.js";
5
+ import { WorkflowInstance, type WorkflowLauncher } from "./models/workflowinstance.model.js";
6
+ import { WorkflowTask } from "./models/workflowtask.model.js";
7
+ import { WorkflowSignal } from "./models/workflowsignal.model.js";
8
+ import { Workflow as StoredWorkflow } from "./models/workflow.model.js";
9
+ /**
10
+ * Output schema of every flow launch operation
11
+ */
12
+ export declare const LAUNCH_OUTPUT_SCHEMA = "Webda/WorkflowLaunch.output";
13
+ /**
14
+ * `runAt` of a wait without timeout (JSON has no Infinity)
15
+ */
16
+ export declare const NO_TIMEOUT: number;
17
+ /**
18
+ * A stored workflow registered on this replica
19
+ */
20
+ interface RegisteredStoredFlow {
21
+ flowId: string;
22
+ version: string;
23
+ updatedBy?: string;
24
+ /**
25
+ * JSON of its crons, to notice a change
26
+ */
27
+ crons: string;
28
+ /**
29
+ * Export ids of the crons registered for it: only those are removed
30
+ */
31
+ cronIds: string[];
32
+ }
33
+ /**
34
+ * Abort signal of the current workflow task attempt
35
+ *
36
+ * It is aborted on timeout, when the worker loses the task lease, and when the service stops. An operation run by a
37
+ * workflow should observe it to stop early: an attempt that keeps running is ignored, and the task may run again
38
+ * (operations are assumed idempotent).
39
+ * @returns the signal, undefined outside a workflow task
40
+ */
41
+ export declare function useAbortSignal(): AbortSignal | undefined;
42
+ /**
43
+ * An attempt running on this replica
44
+ */
45
+ interface RunningAttempt {
46
+ task: WorkflowTask;
47
+ controller: AbortController;
48
+ }
49
+ /**
50
+ * Parameters of the {@link WorkflowService}
51
+ */
52
+ export declare class WorkflowServiceParameters extends ServiceParameters {
53
+ /**
54
+ * Interval between two polls of the worker (ms)
55
+ * @default 1000
56
+ */
57
+ pollInterval: number;
58
+ /**
59
+ * Maximum number of tasks running at once on this replica
60
+ * @default 10
61
+ */
62
+ concurrency: number;
63
+ /**
64
+ * Lease of a claimed task (ms), renewed while it runs
65
+ * @default 60000
66
+ */
67
+ leaseDuration: number;
68
+ /**
69
+ * Maximum size of the journal and input of an instance (bytes of JSON)
70
+ * @default 262144
71
+ */
72
+ maxContextSize: number;
73
+ /**
74
+ * Run the worker loop on this replica
75
+ * @default true
76
+ */
77
+ worker: boolean;
78
+ /**
79
+ * Allow `useSystem` tasks in stored workflows
80
+ * @default false
81
+ */
82
+ allowStoredSystem: boolean;
83
+ /**
84
+ * How long a signal sent before any wait is kept (Duration syntax)
85
+ * @default "1d"
86
+ */
87
+ signalTtl: string;
88
+ /**
89
+ * Interval of the recovery sweep (ms): an active instance not updated for this long and without a live task is
90
+ * replayed
91
+ * @default 60000
92
+ */
93
+ sweepInterval: number;
94
+ /**
95
+ * Grace period of stop() for the running attempts (ms), then they are aborted and their outcome dropped
96
+ * @default 30000
97
+ */
98
+ stopTimeout: number;
99
+ /**
100
+ * Flows to register
101
+ */
102
+ flows?: FlowDefinitionData[];
103
+ /**
104
+ * Maximum size of a signal payload (bytes of JSON)
105
+ * @default 65536
106
+ */
107
+ maxSignalPayload: number;
108
+ /**
109
+ * Maximum number of unexpired buffered signals per `(event, key)`: a new one past it is refused
110
+ * @default 100
111
+ */
112
+ maxBufferedSignals: number;
113
+ /**
114
+ * Role needed to create, update or delete a stored workflow
115
+ * @default "workflow-admin"
116
+ */
117
+ storedWorkflowRole: string;
118
+ /**
119
+ * PubSub service announcing the stored workflow changes to the other replicas
120
+ */
121
+ syncPubSub?: string;
122
+ /**
123
+ * Without `syncPubSub`, interval between two reloads of the stored workflows (ms)
124
+ * @default 60000
125
+ */
126
+ syncInterval: number;
127
+ /**
128
+ * @override
129
+ * @param params - the input parameters
130
+ * @returns this
131
+ */
132
+ load(params?: any): this;
133
+ }
134
+ /**
135
+ * Runs durable workflows: registers each flow as an operation, launches instances and runs their tasks
136
+ *
137
+ * Every replica runs the worker loop: a task is claimed with a lease (a conditional patch on `leaseUntil`), so it
138
+ * runs on one replica at a time. Its outcome goes to the instance journal (a conditional patch on `revision`), then
139
+ * the flow is replayed to find the next tasks.
140
+ *
141
+ * @WebdaModda WorkflowService
142
+ */
143
+ export declare class WorkflowService<T extends WorkflowServiceParameters = WorkflowServiceParameters> extends Service<T> implements WorkflowControls {
144
+ /**
145
+ * Flows registered on this service, by flow id
146
+ */
147
+ protected flows: Map<string, FlowDefinition>;
148
+ /**
149
+ * Every version registered of each flow, for migrate
150
+ */
151
+ protected versions: Map<string, Map<string, FlowDefinition>>;
152
+ /**
153
+ * Flows of the modules (compiled `.flow.ts`) registered by this service
154
+ */
155
+ protected moduleFlows: Set<string>;
156
+ /**
157
+ * Worker id, the lease owner of the tasks it claims
158
+ */
159
+ protected workerId: `${string}-${string}-${string}-${string}-${string}`;
160
+ /**
161
+ * Attempts running on this replica, by task uuid
162
+ */
163
+ protected running: Map<string, RunningAttempt>;
164
+ /**
165
+ * Tasks reclaimed after too many crashes: they fail without running
166
+ */
167
+ protected crashed: WeakSet<WorkflowTask>;
168
+ /**
169
+ * The service is stopping: nothing more is claimed
170
+ */
171
+ protected stopping: boolean;
172
+ /**
173
+ * Poll in progress
174
+ */
175
+ protected pollPromise?: Promise<void>;
176
+ /**
177
+ * Last recovery sweep (ms)
178
+ */
179
+ protected lastSweep: number;
180
+ /**
181
+ * Executions started by the worker loop
182
+ */
183
+ protected executions: Set<Promise<void>>;
184
+ /**
185
+ * Worker loop timer
186
+ */
187
+ protected timer?: NodeJS.Timeout;
188
+ /**
189
+ * Stored workflows registered here, by workflow uuid
190
+ */
191
+ protected storedFlows: Map<string, RegisteredStoredFlow>;
192
+ /**
193
+ * Stored workflows reload timer
194
+ */
195
+ protected syncTimer?: NodeJS.Timeout;
196
+ /**
197
+ * Subscription to the stored workflow changes
198
+ */
199
+ protected syncConsumer?: {
200
+ cancel: () => any;
201
+ };
202
+ /**
203
+ * @override
204
+ */
205
+ resolve(): this;
206
+ /**
207
+ * Register the flows compiled from the `.flow.ts` files (`flows` of the modules), with their crons
208
+ *
209
+ * The first WorkflowService to resolve registers them; the typed calls are resolved in {@link init}, once every
210
+ * service registered its operations.
211
+ */
212
+ protected registerModuleFlows(): void;
213
+ /**
214
+ * The operation a typed call (`target: { class, method }`) runs: the operation of the configured service whose
215
+ * instance is of that class (matched by constructor name, the class or an ancestor)
216
+ * @param target - the target of the task
217
+ * @param target.class - the service class name
218
+ * @param target.method - the method name
219
+ * @returns the operation id, or why there is none: no service (missing) or several (ambiguous)
220
+ */
221
+ resolveTarget(target: {
222
+ class: string;
223
+ method: string;
224
+ }): {
225
+ operation?: string;
226
+ missing?: string;
227
+ ambiguous?: string;
228
+ };
229
+ /**
230
+ * Resolve the typed calls of a flow body in place
231
+ * @param body - the statements
232
+ * @returns the problems, by statement id
233
+ */
234
+ protected resolveTargets(body: any[]): {
235
+ missing: string[];
236
+ ambiguous: string[];
237
+ };
238
+ /**
239
+ * Point every typed call of the compiled flows at the operation of the configured service of its class
240
+ *
241
+ * A flow whose service is not configured (a packaged unit without it) is removed with its crons; a call that several
242
+ * services serve, or a flow whose operation was taken over, stops the startup.
243
+ * @throws FatalInitError on an ambiguous call, or a flow id taken by another operation
244
+ */
245
+ protected resolveModuleTargets(): void;
246
+ /**
247
+ * Remove a module flow: its operation and its crons
248
+ * @param id - the flow id
249
+ */
250
+ protected unregisterModuleFlow(id: string): void;
251
+ /**
252
+ * @override
253
+ */
254
+ init(): Promise<this>;
255
+ /**
256
+ * Stop the worker loop
257
+ *
258
+ * Running attempts get `stopTimeout` to finish, then they are aborted and their outcome dropped: their lease
259
+ * expires and another worker runs them again.
260
+ * @override
261
+ */
262
+ stop(): Promise<void>;
263
+ /**
264
+ * Register a schema in the validator and the application
265
+ * @param name - schema name
266
+ * @param schema - the JSON schema
267
+ */
268
+ protected registerSchema(name: string, schema: any): void;
269
+ /**
270
+ * Register a flow as an operation `<flow id>` served by {@link launch}
271
+ * @param def - the flow definition
272
+ */
273
+ registerFlow(def: FlowDefinition): void;
274
+ /**
275
+ * Get a registered flow
276
+ * @param flowId - the flow id
277
+ * @returns the definition
278
+ */
279
+ getFlow(flowId: string): FlowDefinition | undefined;
280
+ /**
281
+ * Find a flow registered on any WorkflowService, by its operation
282
+ * @param flowId - the flow id
283
+ * @returns the current definition, undefined when the operation is not a flow
284
+ */
285
+ resolveFlow(flowId: string | undefined): FlowDefinition | undefined;
286
+ /**
287
+ * Find a version of a flow
288
+ * @param flowId - the flow id
289
+ * @param version - the version
290
+ * @returns the definition
291
+ */
292
+ getFlowVersion(flowId: string, version: string): FlowDefinition | undefined;
293
+ /**
294
+ * Role needed to write a stored workflow
295
+ * @returns the role
296
+ */
297
+ getStoredWorkflowRole(): string;
298
+ /**
299
+ * Validate and stamp stored workflows on save, and register them once saved
300
+ */
301
+ protected listenStored(): void;
302
+ /**
303
+ * Validate a stored workflow about to be saved and stamp its version and last saver
304
+ * @param workflow - the workflow as it will be saved
305
+ * @param target - the data written: receives `version` and `updatedBy`
306
+ */
307
+ protected prepareStored(workflow: any, target: any): void;
308
+ /**
309
+ * Validate a stored workflow
310
+ * @param workflow - the workflow
311
+ * @throws BadRequest when its name, graph or options are refused
312
+ */
313
+ validateStored(workflow: any): void;
314
+ /**
315
+ * The flow served by an operation, if it is a flow
316
+ * @param flowId - the operation id
317
+ * @returns the flow of the WorkflowService serving the operation
318
+ */
319
+ protected operationFlow(flowId: string): FlowDefinition | undefined;
320
+ /**
321
+ * User a stored flow runs as when the system launches it: its last saver
322
+ * @param flowId - the flow id
323
+ * @returns the user id, undefined when unknown
324
+ */
325
+ storedRunAs(flowId: string): string | undefined;
326
+ /**
327
+ * Identity of a new instance: a stored flow never runs as the system, it runs as its last saver
328
+ * @param def - the flow
329
+ * @param launcher - the identity of the caller (launch) or of the parent instance (child flows)
330
+ * @returns the launcher of the instance
331
+ * @throws Forbidden when a stored flow launched by the system has no user to run as
332
+ */
333
+ protected instanceLauncher(def: FlowDefinition, launcher: WorkflowLauncher): WorkflowLauncher;
334
+ /**
335
+ * Identity of a child flow, which must be allowed to call the flow operation like a launch
336
+ * @param def - the child flow
337
+ * @param launcher - the launcher of the parent
338
+ * @param input - the child input
339
+ * @returns the launcher of the child
340
+ * @throws TaskError Forbidden when the child may not be started
341
+ */
342
+ protected childLauncher(def: FlowDefinition, launcher: WorkflowLauncher, input: any): Promise<WorkflowLauncher>;
343
+ /**
344
+ * A stored workflow changed on this replica: register it here and tell the others
345
+ * @param uuid - the workflow uuid
346
+ */
347
+ protected storedChanged(uuid: string): Promise<void>;
348
+ /**
349
+ * Register, re-register or remove a stored workflow from the store
350
+ * @param uuid - the workflow uuid
351
+ */
352
+ protected syncStored(uuid: string): Promise<void>;
353
+ /**
354
+ * Validate then register a stored workflow; an invalid one is removed and logged
355
+ * @param workflow - the stored workflow
356
+ * @returns true when registered
357
+ */
358
+ protected registerStored(workflow: StoredWorkflow): boolean;
359
+ /**
360
+ * Register a stored workflow as a flow, with its crons
361
+ * @param workflow - the stored workflow
362
+ */
363
+ protected applyStored(workflow: StoredWorkflow): void;
364
+ /**
365
+ * Remove a stored workflow: its operation and its crons (running instances keep their pinned definition)
366
+ * @param uuid - the workflow uuid
367
+ */
368
+ protected unregisterStored(uuid: string): void;
369
+ /**
370
+ * Load every stored workflow: register the new and changed ones, remove the deleted ones
371
+ */
372
+ protected reloadStored(): Promise<void>;
373
+ /**
374
+ * Follow the stored workflow changes of the other replicas: through `syncPubSub`, or a reload every
375
+ * `syncInterval`
376
+ */
377
+ protected startSync(): void;
378
+ /**
379
+ * Launch the flow of the current operation, as the caller
380
+ * @param args - the flow parameters, in order
381
+ * @returns the instance uuid
382
+ */
383
+ launch(...args: any[]): Promise<{
384
+ uuid: string;
385
+ }>;
386
+ /**
387
+ * Create an instance and run it to its first tasks
388
+ * @param def - the flow definition, pinned in the instance
389
+ * @param input - the flow input
390
+ * @param launcher - the identity of the steps
391
+ * @param options - the parent of an awaited child, a fixed uuid (created once)
392
+ * @param options.parent - parent instance and task key
393
+ * @param options.parent.instance - parent instance uuid
394
+ * @param options.parent.key - task key in the parent
395
+ * @param options.uuid - uuid of the instance: an existing one is not created again
396
+ * @returns the instance
397
+ */
398
+ protected createInstance(def: FlowDefinition, input: Record<string, any>, launcher: WorkflowLauncher, options?: {
399
+ parent?: {
400
+ instance: string;
401
+ key: string;
402
+ };
403
+ uuid?: string;
404
+ }): Promise<WorkflowInstance>;
405
+ /**
406
+ * Start the worker loop
407
+ */
408
+ protected startWorker(): void;
409
+ /**
410
+ * One iteration of the worker loop: claim due tasks and run them in the background
411
+ * @returns the poll in progress, it ends when the tasks are claimed and started
412
+ */
413
+ protected poll(): Promise<void>;
414
+ /**
415
+ * Run the recovery sweep when `sweepInterval` passed since the last one
416
+ */
417
+ protected maybeSweep(): Promise<void>;
418
+ /**
419
+ * Replay the stranded instances: active, not updated for `sweepInterval`, without a PENDING or RUNNING task
420
+ *
421
+ * A crash between two steps leaves such an instance: replay is idempotent, and the revision CAS of
422
+ * {@link advance} guards against a concurrent writer.
423
+ * @returns the number of instances replayed
424
+ */
425
+ protected sweep(): Promise<number>;
426
+ /**
427
+ * One poll: claim the due tasks and run them
428
+ * @returns the number of tasks claimed
429
+ */
430
+ protected tick(): Promise<number>;
431
+ /**
432
+ * Claim the due tasks, up to the free slots of this replica
433
+ *
434
+ * The PENDING tasks due now, and the RUNNING ones whose lease expired (their worker crashed)
435
+ * @returns the tasks claimed
436
+ */
437
+ protected claimDue(): Promise<WorkflowTask[]>;
438
+ /**
439
+ * Claim a task with a lease: a conditional patch on its `leaseUntil`
440
+ *
441
+ * Reclaiming an expired lease counts as a new attempt.
442
+ * @param task - the task, as queried
443
+ * @param extra - other fields to set with the claim
444
+ * @returns true when this worker holds the task
445
+ */
446
+ protected claim(task: WorkflowTask, extra?: Partial<WorkflowTask>): Promise<boolean>;
447
+ /**
448
+ * Run a claimed task, write its outcome and advance its instance
449
+ *
450
+ * Every write of the attempt is conditional on the lease this worker holds: an attempt whose lease was lost (its
451
+ * worker was too slow and another one reclaimed it) drops its outcome.
452
+ * @param task - the task
453
+ * @param advance - advance the instance after the outcome is journaled
454
+ */
455
+ protected execute(task: WorkflowTask, advance?: boolean): Promise<void>;
456
+ /**
457
+ * Conditional patch of a task row on the lease this worker holds
458
+ * @param task - the task, with the lease this worker holds
459
+ * @param data - the changes
460
+ * @returns false when another worker holds the lease now
461
+ */
462
+ protected patchLeased(task: WorkflowTask, data: Partial<WorkflowTask>): Promise<boolean>;
463
+ /**
464
+ * Check this worker still holds the lease of a task, and extend it
465
+ * @param task - the task
466
+ * @returns false when the lease was lost
467
+ */
468
+ protected holdsLease(task: WorkflowTask): Promise<boolean>;
469
+ /**
470
+ * Extend the lease of a running task, abort the attempt when the lease was lost
471
+ * @param task - the task
472
+ */
473
+ protected renewLease(task: WorkflowTask): Promise<void>;
474
+ /**
475
+ * Record the end of an attempt, if this worker still holds its lease
476
+ *
477
+ * `leaseUntil` becomes the end time, never 0: a worker that queried the task before cannot claim it again.
478
+ * @param task - the task
479
+ * @param data - status and outcome
480
+ * @returns false when the lease was lost
481
+ */
482
+ protected finishTask(task: WorkflowTask, data: Partial<WorkflowTask>): Promise<boolean>;
483
+ /**
484
+ * Create the next attempt of a failed task, after the backoff delay
485
+ * @param task - the failed attempt
486
+ */
487
+ protected scheduleRetry(task: WorkflowTask): Promise<void>;
488
+ /**
489
+ * Run the operation (or built-in) of a task
490
+ * @param task - the task
491
+ * @param instance - its instance
492
+ * @param controller - aborted on timeout
493
+ * @returns the result
494
+ */
495
+ protected runTask(task: WorkflowTask, instance: WorkflowInstance, controller: AbortController): Promise<any>;
496
+ /**
497
+ * Build the context of the launcher: the session is rebuilt from the user id, so the permissions are fresh
498
+ * @param launcher - the launcher
499
+ * @param input - the operation input
500
+ * @returns the context
501
+ */
502
+ protected launcherContext(launcher: WorkflowLauncher, input: any): SimpleOperationContext;
503
+ /**
504
+ * Convert an error to the data the flow sees
505
+ * @param err - the error
506
+ * @param operation - the operation of the task
507
+ * @returns the flow error
508
+ */
509
+ protected toFlowError(err: any, operation: string): FlowError;
510
+ /**
511
+ * Write a task outcome to the instance journal: a conditional patch on `revision`, retried on conflict
512
+ *
513
+ * The first outcome of a key wins. A journal over `maxContextSize` fails the instance.
514
+ * @param instanceId - the instance uuid
515
+ * @param key - the task key
516
+ * @param entry - the outcome
517
+ * @returns true when the outcome is in the journal
518
+ */
519
+ protected writeJournal(instanceId: string, key: string, entry: JournalEntry): Promise<boolean>;
520
+ /**
521
+ * Patch an instance if its revision did not change
522
+ * @param instance - the instance as read
523
+ * @param data - the changes
524
+ * @returns false when another writer changed it first
525
+ */
526
+ protected patchInstance(instance: WorkflowInstance, data: Partial<WorkflowInstance>): Promise<boolean>;
527
+ /**
528
+ * Replay an instance and act on the result: finish it, or create its missing tasks
529
+ * @param instanceId - the instance uuid
530
+ */
531
+ protected advance(instanceId: string): Promise<void>;
532
+ /**
533
+ * Create the task of a scheduled key, unless a PENDING or RUNNING one exists
534
+ * @param instance - the instance
535
+ * @param scheduled - the task to run
536
+ * @returns true when the task was resolved at once (a buffered signal): the journal changed
537
+ */
538
+ protected scheduleTask(instance: WorkflowInstance, scheduled: ScheduledTask): Promise<boolean>;
539
+ /**
540
+ * Start an awaited child flow: the task waits for the child instance, which runs as the same launcher
541
+ * @param instance - the parent instance
542
+ * @param scheduled - the task, its operation is a flow id
543
+ * @param index - row index of the key
544
+ * @returns true when the child finished at once: the parent journal changed
545
+ */
546
+ protected scheduleChild(instance: WorkflowInstance, scheduled: ScheduledTask, index: number): Promise<boolean>;
547
+ /**
548
+ * Journal the end of a child into its parent: its output, its error, or `Cancelled`
549
+ * @param childId - the child instance uuid
550
+ */
551
+ protected deliverToParent(childId: string): Promise<void>;
552
+ /**
553
+ * Cancel an instance, its live tasks and the children it waits on
554
+ * @param uuid - the instance uuid
555
+ */
556
+ cancelInstance(uuid: string): Promise<void>;
557
+ /**
558
+ * Cancel an instance and, recursively, the children it waits on
559
+ * @param uuid - the instance uuid
560
+ * @returns false when the instance was not running
561
+ */
562
+ protected cancelTree(uuid: string): Promise<boolean>;
563
+ /**
564
+ * Mark a task row CANCELLED, conditionally on its lease: whoever holds it can no longer write its outcome
565
+ * @param row - the task row, as read
566
+ */
567
+ protected supersede(row: WorkflowTask): Promise<void>;
568
+ /**
569
+ * Restart a failed instance: drop the outcome that failed it and every outcome journaled after it, then replay
570
+ * @param uuid - the instance uuid
571
+ */
572
+ retryInstance(uuid: string): Promise<void>;
573
+ /**
574
+ * Move a running instance to another version of its flow
575
+ *
576
+ * Refused when a journaled or live task key has no statement in the target graph.
577
+ * @param uuid - the instance uuid
578
+ * @param version - the target version, the latest registered when undefined
579
+ */
580
+ migrateInstance(uuid: string, version?: string): Promise<void>;
581
+ /**
582
+ * Deliver a signal: resolve the waits on `(event, key)` whose instance accepts the caller, or buffer it when
583
+ * nothing waits
584
+ * @param event - event name
585
+ * @param key - business key
586
+ * @param payload - the result of the waits
587
+ * @returns the number of waits resolved
588
+ */
589
+ signal(event: string, key: string, payload?: any): Promise<{
590
+ delivered: number;
591
+ }>;
592
+ /**
593
+ * The waits on `(event, key)` of active instances
594
+ * @param event - event name
595
+ * @param key - business key
596
+ * @returns the waits and their instance
597
+ */
598
+ protected waitsFor(event: string, key: string): Promise<{
599
+ instance: WorkflowInstance;
600
+ task: WorkflowTask;
601
+ }[]>;
602
+ /**
603
+ * Whether a sender may signal a wait: the launcher, the system, and the users in the `allow` of the wait
604
+ * @param context - the sender
605
+ * @param instance - the instance waiting
606
+ * @param task - the wait
607
+ * @returns true when allowed
608
+ */
609
+ protected canSignal(context: OperationContext, instance: WorkflowInstance, task: WorkflowTask): Promise<boolean>;
610
+ /**
611
+ * Save a signal nothing waits for yet
612
+ * @param context - the sender
613
+ * @param event - event name
614
+ * @param key - business key
615
+ * @param payload - the payload
616
+ * @returns the buffered signal
617
+ */
618
+ protected bufferSignal(context: OperationContext, event: string, key: string, payload: any): Promise<WorkflowSignal>;
619
+ /**
620
+ * Deliver a just buffered signal to a wait created while it was being saved
621
+ * @param signal - the buffered signal
622
+ * @returns true when a wait consumed it
623
+ */
624
+ protected deliverBuffered(signal: WorkflowSignal): Promise<boolean>;
625
+ /**
626
+ * Resolve a new wait with the oldest unexpired buffered signal its instance accepts
627
+ * @param instance - the instance
628
+ * @param task - the wait
629
+ * @returns true when a signal was consumed
630
+ */
631
+ protected consumeBuffered(instance: WorkflowInstance, task: WorkflowTask): Promise<boolean>;
632
+ /**
633
+ * Consume a buffered signal for a wait: its sender is checked now, against this instance
634
+ * @param signal - the buffered signal
635
+ * @param instance - the instance waiting
636
+ * @param task - the wait
637
+ * @param advance - advance the instance once the payload is journaled
638
+ * @returns true when consumed and delivered
639
+ */
640
+ protected consumeSignal(signal: WorkflowSignal, instance: WorkflowInstance, task: WorkflowTask, advance: boolean): Promise<boolean>;
641
+ /**
642
+ * Resolve a wait with a payload: claimed like a task, so it resolves once
643
+ * @param task - the wait
644
+ * @param payload - its result
645
+ * @param advance - advance the instance once the payload is journaled
646
+ * @returns false when the wait was already resolved or timed out
647
+ */
648
+ protected resolveWait(task: WorkflowTask, payload: any, advance?: boolean): Promise<boolean>;
649
+ /**
650
+ * End of a `Workflow.Sleep`
651
+ * @param input - `{ duration?: string, until?: number }`
652
+ * @param now - the current time
653
+ * @returns when the timer fires
654
+ */
655
+ protected sleepUntil(input: any, now: number): number;
656
+ /**
657
+ * Create a task row, unless another worker created the same row first
658
+ * @param instance - the instance uuid
659
+ * @param scheduled - the task
660
+ * @param launcherId - user id of the launcher
661
+ * @param runAt - when it becomes runnable
662
+ * @param attempt - attempt number
663
+ * @param index - row index of the key, when known
664
+ * @param extra - other fields of the row
665
+ * @returns the task created, undefined when another worker created it
666
+ */
667
+ protected createTask(instance: string, scheduled: ScheduledTask, launcherId: string | undefined, runAt: number, attempt: number, index?: number, extra?: Partial<WorkflowTask>): Promise<WorkflowTask | undefined>;
668
+ }
669
+ export default WorkflowService;
670
+ //# sourceMappingURL=workflow.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.service.d.ts","sources":["../src/workflow.service.ts"],"names":[],"mappings":"AACA,OAAO,EAUL,OAAO,EACP,iBAAiB,EAEjB,sBAAsB,EAQtB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EAAE,YAAY,EAA2B,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIxE;;GAEG;AACH,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAmClE;;GAEG;AACH,eAAO,MAAM,UAAU,QAA0B,CAAC;AA4BlD;;GAEG;AACH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAoBD;;;;;;;GAOG;AACH,wB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