@powerhousedao/reactor-workflow 6.2.3-dev.48 → 6.2.3-dev.50
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 +274 -8
- package/dist/index.d.ts +263 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1293 -107
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-e-vFPyTd.js → piece-registry-BKRLK7Kv.js} +1192 -90
- package/dist/piece-registry-BKRLK7Kv.js.map +1 -0
- package/dist/{piece-registry-wQBhKJUl.d.ts → piece-registry-Ds8WkewF.d.ts} +232 -99
- package/dist/piece-registry-Ds8WkewF.d.ts.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +91 -3
- package/dist/testing.js.map +1 -0
- package/dist/worker-entry.js +5685 -285
- package/dist/worker-entry.js.map +1 -1
- package/package.json +16 -8
- package/dist/loader-Gkx6I_Bo.js +0 -91
- package/dist/loader-Gkx6I_Bo.js.map +0 -1
- package/dist/piece-registry-e-vFPyTd.js.map +0 -1
- package/dist/piece-registry-wQBhKJUl.d.ts.map +0 -1
- package/dist/reactor-rpc-BqAjCK1p.js +0 -1134
- package/dist/reactor-rpc-BqAjCK1p.js.map +0 -1
- package/dist/worker-entry.d.ts +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as StepExecutionRecord, F as BlockResolution, I as PieceOrigin, O as PieceResolver, P as BlockMatch, S as PropertySettingDef, T as ReactorTap, _ as PieceWorkerResult, b as WorkflowTelemetryOptions, f as SecretStore, g as PieceWorker, h as ModelManifestSource, i as ReplayedStep, j as EgressPolicy, l as ConnectionRequest, n as packagePieces, r as CORE_PIECE_NAME, s as AttachmentPort, t as PieceRegistry, v as TELEMETRY_SCOPE, w as WorkflowRunResult, y as WorkflowTelemetry } from "./piece-registry-Ds8WkewF.js";
|
|
2
2
|
import { ActionBase, TriggerBase } from "@powerhousedao/pieces-framework";
|
|
3
3
|
import { ILogger, OperationWithContext } from "document-model";
|
|
4
4
|
import "@powerhousedao/pieces-framework/workflow";
|
|
@@ -16,12 +16,16 @@ interface AttachmentClientLike {
|
|
|
16
16
|
file: Blob;
|
|
17
17
|
fileName?: string;
|
|
18
18
|
mimeType?: string;
|
|
19
|
+
} | {
|
|
20
|
+
preprocessed: PreprocessedUpload;
|
|
21
|
+
signal?: AbortSignal;
|
|
19
22
|
}): Promise<{
|
|
20
23
|
ref?: string;
|
|
21
24
|
} & Record<string, unknown>>;
|
|
22
25
|
download(input: {
|
|
23
26
|
documentId: string;
|
|
24
27
|
ref: string;
|
|
28
|
+
signal?: AbortSignal;
|
|
25
29
|
}): Promise<{
|
|
26
30
|
header: {
|
|
27
31
|
sizeBytes?: number;
|
|
@@ -31,7 +35,26 @@ interface AttachmentClientLike {
|
|
|
31
35
|
body: ReadableStream<Uint8Array>;
|
|
32
36
|
}>;
|
|
33
37
|
}
|
|
34
|
-
|
|
38
|
+
interface PreprocessedUpload {
|
|
39
|
+
ref: string;
|
|
40
|
+
hash: string;
|
|
41
|
+
sizeBytes: number;
|
|
42
|
+
options: {
|
|
43
|
+
mimeType: string;
|
|
44
|
+
fileName: string;
|
|
45
|
+
extension?: string | null;
|
|
46
|
+
clientHash: string;
|
|
47
|
+
sizeBytes: number;
|
|
48
|
+
};
|
|
49
|
+
data: ReadableStream<Uint8Array>;
|
|
50
|
+
stream: () => ReadableStream<Uint8Array>;
|
|
51
|
+
}
|
|
52
|
+
interface AttachmentPortAccess {
|
|
53
|
+
documentIdFor: () => string | undefined;
|
|
54
|
+
canReadRef: (ref: string) => Promise<boolean>;
|
|
55
|
+
onWritten?: (ref: string) => void;
|
|
56
|
+
}
|
|
57
|
+
export declare function createAttachmentPort(client: AttachmentClientLike, access: AttachmentPortAccess): AttachmentPort;
|
|
35
58
|
//#endregion
|
|
36
59
|
//#region src/reactor/package-name.d.ts
|
|
37
60
|
export declare const WORKFLOW_PACKAGE_NAME = "@powerhousedao/workflow";
|
|
@@ -39,12 +62,37 @@ export declare const WORKFLOW_PACKAGE_NAME = "@powerhousedao/workflow";
|
|
|
39
62
|
//#region src/pieces/activepieces/registry-source.d.ts
|
|
40
63
|
export declare function setPieceRegistryUrl(url: string | undefined): void;
|
|
41
64
|
//#endregion
|
|
65
|
+
//#region src/reactor/run-scope.d.ts
|
|
66
|
+
interface ReactorConnectionScope {
|
|
67
|
+
access: "read" | "write";
|
|
68
|
+
}
|
|
69
|
+
interface RunScope {
|
|
70
|
+
runUser: {
|
|
71
|
+
address: string;
|
|
72
|
+
subject: AuthSubject;
|
|
73
|
+
} | null;
|
|
74
|
+
requireReactor: "read" | "write";
|
|
75
|
+
connection: ReactorConnectionScope;
|
|
76
|
+
deadline: number;
|
|
77
|
+
journal: {
|
|
78
|
+
recordDocuments(documentIds: string[]): Promise<void>;
|
|
79
|
+
recordJob(jobId: string, documentIds: string[]): Promise<void>;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
type RunUser = NonNullable<RunScope["runUser"]>;
|
|
83
|
+
//#endregion
|
|
42
84
|
//#region src/reactor/host.d.ts
|
|
43
85
|
type WorkflowCaller = object;
|
|
44
86
|
type HostIdentity = {
|
|
45
87
|
address?: string;
|
|
46
88
|
key: string;
|
|
47
89
|
};
|
|
90
|
+
interface AttachmentReadRequest {
|
|
91
|
+
workflowId: string;
|
|
92
|
+
ref: string;
|
|
93
|
+
documentIds: string[];
|
|
94
|
+
runUser?: RunUser | null;
|
|
95
|
+
}
|
|
48
96
|
interface WorkflowRuntimeHostDeps {
|
|
49
97
|
relationalDb: IRelationalDb;
|
|
50
98
|
reactorClient: IReactorClient;
|
|
@@ -58,10 +106,11 @@ interface WorkflowRuntimeHostDeps {
|
|
|
58
106
|
modelEntries?(documentType: string): ModelManifestEntry[];
|
|
59
107
|
webhooks?: IWebhookScope;
|
|
60
108
|
attachments?: AttachmentClientLike;
|
|
61
|
-
canReadAttachmentRef?(
|
|
109
|
+
canReadAttachmentRef?(request: AttachmentReadRequest): Promise<boolean>;
|
|
62
110
|
secrets?: SecretStore;
|
|
63
111
|
secretsKeyFile?: string | false;
|
|
64
112
|
logger?: ILogger;
|
|
113
|
+
telemetry?: WorkflowTelemetryOptions;
|
|
65
114
|
syncWaitMs?: number;
|
|
66
115
|
pieceVersionLookupMs?: number;
|
|
67
116
|
}
|
|
@@ -176,7 +225,7 @@ interface WorkflowAccessOptions {
|
|
|
176
225
|
//#region src/reactor/step-test.d.ts
|
|
177
226
|
interface StepTestResult {
|
|
178
227
|
runId: string | null;
|
|
179
|
-
status: "SUCCEEDED" | "FAILED";
|
|
228
|
+
status: "SUCCEEDED" | "FAILED" | "INDETERMINATE";
|
|
180
229
|
output?: unknown;
|
|
181
230
|
error?: string;
|
|
182
231
|
errorName?: string;
|
|
@@ -222,6 +271,7 @@ interface StepExecutionRow {
|
|
|
222
271
|
version_match: string | null;
|
|
223
272
|
version_note: string | null;
|
|
224
273
|
config_hash: string | null;
|
|
274
|
+
attempts: number | null;
|
|
225
275
|
}
|
|
226
276
|
interface RunDocumentRow {
|
|
227
277
|
run_id: string;
|
|
@@ -257,7 +307,18 @@ interface TriggerDedupeRow {
|
|
|
257
307
|
dedupe_key: string;
|
|
258
308
|
run_id: string | null;
|
|
259
309
|
created_at: string;
|
|
260
|
-
|
|
310
|
+
attempts: number | null;
|
|
311
|
+
}
|
|
312
|
+
/** What a fire claim resolved to; see {@link WorkflowRunStore.claimAndEnqueueRun}. */
|
|
313
|
+
type FireClaim = {
|
|
314
|
+
outcome: "claimed";
|
|
315
|
+
runId: string;
|
|
316
|
+
} | {
|
|
317
|
+
outcome: "duplicate";
|
|
318
|
+
} | {
|
|
319
|
+
outcome: "abandoned";
|
|
320
|
+
attempts: number;
|
|
321
|
+
};
|
|
261
322
|
interface PieceStoreRow {
|
|
262
323
|
scope: string;
|
|
263
324
|
scope_key: string;
|
|
@@ -265,6 +326,12 @@ interface PieceStoreRow {
|
|
|
265
326
|
value: string;
|
|
266
327
|
updated_at: string;
|
|
267
328
|
}
|
|
329
|
+
interface WorkflowParkRow {
|
|
330
|
+
workflow_id: string;
|
|
331
|
+
published_version: number;
|
|
332
|
+
reason: string;
|
|
333
|
+
parked_at: string;
|
|
334
|
+
}
|
|
268
335
|
interface WorkflowRuntimeDB {
|
|
269
336
|
run: RunRow;
|
|
270
337
|
step_execution: StepExecutionRow;
|
|
@@ -272,6 +339,11 @@ interface WorkflowRuntimeDB {
|
|
|
272
339
|
trigger_state: TriggerStateRow;
|
|
273
340
|
trigger_dedupe: TriggerDedupeRow;
|
|
274
341
|
piece_store: PieceStoreRow;
|
|
342
|
+
workflow_park: WorkflowParkRow;
|
|
343
|
+
migration_mark: {
|
|
344
|
+
name: string;
|
|
345
|
+
applied_at: string;
|
|
346
|
+
};
|
|
275
347
|
}
|
|
276
348
|
interface ErasedRuns {
|
|
277
349
|
runs: number;
|
|
@@ -310,8 +382,72 @@ declare class WorkflowRunStore {
|
|
|
310
382
|
clearUnmigratedTriggerState(workflowId: string): void;
|
|
311
383
|
recoverOrphanedRuns(): Promise<number>;
|
|
312
384
|
recoverAbandonedRuns(): Promise<number>;
|
|
385
|
+
/**
|
|
386
|
+
* Closes a run out as CANCELLED, with the reason as its error.
|
|
387
|
+
*
|
|
388
|
+
* Two callers, one meaning — "this run did not finish, and the workflow is
|
|
389
|
+
* not at fault": a firing SINGLETON concurrency refused, and a run that
|
|
390
|
+
* passed its `runTimeoutSeconds`. Separate from `failRun` because a
|
|
391
|
+
* CANCELLED run is not rerunnable and must not read as a workflow defect.
|
|
392
|
+
*/
|
|
393
|
+
cancelRun(runId: string, reason: string): Promise<void>;
|
|
313
394
|
enqueueRun(options: EnqueueRunOptions): Promise<string>;
|
|
314
|
-
|
|
395
|
+
/**
|
|
396
|
+
* Claims the dedupe key and journals the PENDING run, bounding crash replays.
|
|
397
|
+
*
|
|
398
|
+
* Three outcomes, as {@link FireClaim}:
|
|
399
|
+
*
|
|
400
|
+
* - **`"claimed"`** with a run id: this fire is ours to run.
|
|
401
|
+
* - **`"duplicate"`**: an earlier delivery of this operation already
|
|
402
|
+
* fired: it journaled a run, or ran without one
|
|
403
|
+
* ({@link FIRED_WITHOUT_RUN_ID}).
|
|
404
|
+
* - **`"abandoned"`**: the operation has been delivered
|
|
405
|
+
* {@link FIRE_CRASH_BUDGET} times and has never once got as far as
|
|
406
|
+
* journaling a run — i.e. it is taking the process down before the write
|
|
407
|
+
* lands, and the read-model cursor replays it on every boot. That is the
|
|
408
|
+
* EPIPE boot loop (backlog item 5), and a budget is what turns it from an
|
|
409
|
+
* unbootable reactor into one FAILED run naming the loop.
|
|
410
|
+
*
|
|
411
|
+
* Two writes, and which one is which matters:
|
|
412
|
+
*
|
|
413
|
+
* - The **attempt count** is bumped in its own committed transaction,
|
|
414
|
+
* BEFORE the risky work. That is the only way a delivery that leaves no
|
|
415
|
+
* run behind can be counted at all, which is what the budget needs. The
|
|
416
|
+
* counter is never a claim signal — it only decides the budget.
|
|
417
|
+
* - The **claim** is `run_id`, and it is set in the SAME transaction as the
|
|
418
|
+
* run row, under a `WHERE run_id IS NULL` guard. The guard takes the
|
|
419
|
+
* row's lock, so of two concurrent deliveries of one operation the second
|
|
420
|
+
* blocks until the first commits and then matches no row: exactly one
|
|
421
|
+
* delivery wins, and the run it journaled is committed with the claim. A
|
|
422
|
+
* crash in between rolls BOTH back, so a claim that holds a run id always
|
|
423
|
+
* holds a run — and a claim without one is retried, up to the budget.
|
|
424
|
+
*
|
|
425
|
+
* Counting and claiming are deliberately not the same write: if the bump
|
|
426
|
+
* rode along inside the claim transaction, a run insert that takes the
|
|
427
|
+
* process down would roll the count back with it and the budget could never
|
|
428
|
+
* reach its limit — the boot loop it exists to bound.
|
|
429
|
+
*/
|
|
430
|
+
claimAndEnqueueRun(dedupeKey: string, ttlMs: number, nowIso: string, options: EnqueueRunOptions): Promise<FireClaim>;
|
|
431
|
+
/**
|
|
432
|
+
* Counts one delivery of an operation, and reports whether a run was ever
|
|
433
|
+
* journaled for it.
|
|
434
|
+
*
|
|
435
|
+
* Committed on its own: the point is to leave a trace even when whatever
|
|
436
|
+
* comes next takes the process down. It is NOT a claim — the row it writes
|
|
437
|
+
* holds no run id, and {@link claimAndEnqueueRun} is what decides, under a
|
|
438
|
+
* lock, which delivery gets to fill it in.
|
|
439
|
+
*/
|
|
440
|
+
recordFireAttempt(workflowId: string, dedupeKey: string, ttlMs: number, nowIso: string): Promise<{
|
|
441
|
+
attempts: number;
|
|
442
|
+
runId: string | null;
|
|
443
|
+
}>;
|
|
444
|
+
/**
|
|
445
|
+
* The abandonment of an over-budget fire, as a visible FAILED run, linked to
|
|
446
|
+
* its dedupe key so a later delivery is a duplicate rather than another one.
|
|
447
|
+
*/
|
|
448
|
+
journalAbandonedFire(dedupeKey: string, options: EnqueueRunOptions & {
|
|
449
|
+
attempts: number;
|
|
450
|
+
}): Promise<string>;
|
|
315
451
|
private insertPendingRun;
|
|
316
452
|
beginRun(runId: string, details: {
|
|
317
453
|
workflowName: string;
|
|
@@ -331,6 +467,19 @@ declare class WorkflowRunStore {
|
|
|
331
467
|
recordRunDocuments(runId: string, documentIds: string[]): Promise<void>;
|
|
332
468
|
getRunDocuments(runId: string): Promise<string[]>;
|
|
333
469
|
getRunDocumentsForRuns(runIds: string[]): Promise<Map<string, string[]>>;
|
|
470
|
+
/**
|
|
471
|
+
* Parks a workflow: its park row, and an ENABLED trigger_state row turned
|
|
472
|
+
* PARKED, in one transaction. True when a trigger_state row was parked.
|
|
473
|
+
*/
|
|
474
|
+
parkWorkflow(workflowId: string, publishedVersion: number, reason: string): Promise<boolean>;
|
|
475
|
+
/** A disable clears a park: the park row, and a PARKED trigger row turned
|
|
476
|
+
* DISABLED, so re-enabling arms it whether or not the supervisor held it. */
|
|
477
|
+
clearParkOnDisable(workflowId: string): Promise<void>;
|
|
478
|
+
/** Undoes {@link parkWorkflow}; `trigger` says whether it parked a row. */
|
|
479
|
+
liftPark(workflowId: string, trigger: boolean): Promise<void>;
|
|
480
|
+
getWorkflowPark(workflowId: string): Promise<WorkflowParkRow | undefined>;
|
|
481
|
+
listWorkflowParks(): Promise<WorkflowParkRow[]>;
|
|
482
|
+
clearWorkflowPark(workflowId: string): Promise<void>;
|
|
334
483
|
getTriggerState(workflowId: string): Promise<TriggerStateRow | undefined>;
|
|
335
484
|
upsertTriggerState(row: TriggerStateInput): Promise<void>;
|
|
336
485
|
setTriggerStatus(workflowId: string, status: string, error?: string): Promise<void>;
|
|
@@ -355,24 +504,22 @@ declare class WorkflowRunStore {
|
|
|
355
504
|
deletePieceStore(scope: string, scopeKey: string): Promise<void>;
|
|
356
505
|
}
|
|
357
506
|
//#endregion
|
|
358
|
-
//#region src/reactor/
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
};
|
|
507
|
+
//#region src/reactor/park-state.d.ts
|
|
508
|
+
declare class ParkState {
|
|
509
|
+
private readonly load;
|
|
510
|
+
private readonly parks;
|
|
511
|
+
private readonly written;
|
|
512
|
+
private seeded;
|
|
513
|
+
private seeding?;
|
|
514
|
+
constructor(load: () => Promise<readonly WorkflowParkRow[] | undefined>);
|
|
515
|
+
get(workflowId: string): Promise<WorkflowParkRow | undefined>;
|
|
516
|
+
known(workflowId: string): {
|
|
517
|
+
park?: WorkflowParkRow;
|
|
518
|
+
} | undefined;
|
|
519
|
+
set(park: WorkflowParkRow): void;
|
|
520
|
+
delete(workflowId: string): void;
|
|
521
|
+
private seed;
|
|
374
522
|
}
|
|
375
|
-
type RunUser = NonNullable<RunScope["runUser"]>;
|
|
376
523
|
//#endregion
|
|
377
524
|
//#region src/reactor/trigger-supervisor.d.ts
|
|
378
525
|
interface PieceTriggerBinding {
|
|
@@ -400,12 +547,14 @@ interface ScheduleTriggerBinding {
|
|
|
400
547
|
type TriggerBinding = PieceTriggerBinding | ScheduleTriggerBinding;
|
|
401
548
|
interface TriggerSupervisorOptions {
|
|
402
549
|
store: () => Promise<WorkflowRunStore | undefined>;
|
|
550
|
+
parks?: ParkState;
|
|
403
551
|
resolveAuth: (connectionId: string | null | undefined, request?: ConnectionRequest) => Promise<unknown>;
|
|
404
552
|
fire: (workflowId: string, payload: unknown, kind: string) => void;
|
|
405
553
|
cacheDir: string;
|
|
406
554
|
resolver?: PieceResolver;
|
|
407
555
|
worker?: PieceWorker;
|
|
408
556
|
models?: ModelManifestSource;
|
|
557
|
+
telemetry?: WorkflowTelemetry;
|
|
409
558
|
reactorAccess?: (binding: PieceTriggerBinding, requireReactor: "read" | "write", runUser: RunUser | null | undefined) => Promise<ReactorTap>;
|
|
410
559
|
egress?: EgressPolicy | null;
|
|
411
560
|
tickMs?: number;
|
|
@@ -424,6 +573,7 @@ declare class TriggerSupervisor {
|
|
|
424
573
|
private readonly hookTimeoutMs;
|
|
425
574
|
private readonly now;
|
|
426
575
|
private readonly egress;
|
|
576
|
+
private readonly parks;
|
|
427
577
|
private timer?;
|
|
428
578
|
private ops;
|
|
429
579
|
private ticking;
|
|
@@ -437,7 +587,21 @@ declare class TriggerSupervisor {
|
|
|
437
587
|
private own;
|
|
438
588
|
private resolver;
|
|
439
589
|
private readonly enableRetries;
|
|
440
|
-
|
|
590
|
+
private readonly versions;
|
|
591
|
+
upsert(binding: TriggerBinding, publishedVersion?: number): Promise<void>;
|
|
592
|
+
/** Parks a workflow; true when a trigger row was parked with it. */
|
|
593
|
+
park(workflowId: string, publishedVersion: number, reason: string): Promise<boolean>;
|
|
594
|
+
/** Undoes {@link park} for that version only: a later park stands. */
|
|
595
|
+
liftPark(workflowId: string, publishedVersion: number, trigger: boolean): Promise<void>;
|
|
596
|
+
/** A disable clears the park. With no binding in memory to release a PARKED
|
|
597
|
+
* row through onDisable (a boot), the row is turned DISABLED here. */
|
|
598
|
+
releasePark(workflowId: string, flipRow: boolean): Promise<void>;
|
|
599
|
+
/** A re-publish past the parked version: on this lane, a park older than
|
|
600
|
+
* `publishedVersion` goes and a row it parked is ENABLED again, as it was
|
|
601
|
+
* before (only an ENABLED row is ever parked); a park as new stands. The
|
|
602
|
+
* next upsert of the same binding then arms rather than skipping as
|
|
603
|
+
* unchanged, and a retry held back by the park is due now. */
|
|
604
|
+
unpark(workflowId: string, publishedVersion: number): Promise<void>;
|
|
441
605
|
remove(workflowId: string): Promise<void>;
|
|
442
606
|
forget(workflowId: string): Promise<void>;
|
|
443
607
|
private unbind;
|
|
@@ -458,6 +622,30 @@ declare class TriggerSupervisor {
|
|
|
458
622
|
private enable;
|
|
459
623
|
private renewAtAfterEnable;
|
|
460
624
|
private webhookUrlOrThrow;
|
|
625
|
+
/**
|
|
626
|
+
* The park, when it holds this registration back.
|
|
627
|
+
*
|
|
628
|
+
* `policy.onFailure = PARK` is a **runtime override of the document's
|
|
629
|
+
* enabled-ness**: the document still says ENABLED, and re-arming from it is
|
|
630
|
+
* what a restart does for every workflow it finds. So the park row is the
|
|
631
|
+
* authority, read on this lane, and it blocks every registration of the
|
|
632
|
+
* version that failed or an older one — a boot re-arm, an ERROR row's
|
|
633
|
+
* retry. A newer version is what a re-publish is: it is never blocked, and
|
|
634
|
+
* {@link enable} lifts the park it outlived. A re-enable lifts it through
|
|
635
|
+
* the disable before it.
|
|
636
|
+
*/
|
|
637
|
+
private blockingPark;
|
|
638
|
+
/**
|
|
639
|
+
* An enable a park held back. The row is left as it stands, and a pending
|
|
640
|
+
* retry keeps its release flag, so the enable after the park lifts releases
|
|
641
|
+
* a failed attempt and arms afresh; the retry is only pushed back, so it
|
|
642
|
+
* does not take every tick's slot. A binding this replaced is restored, so
|
|
643
|
+
* nothing is released later with one that was never armed.
|
|
644
|
+
*/
|
|
645
|
+
private holdParked;
|
|
646
|
+
/** The status an enable that succeeded writes: never ENABLED while a park
|
|
647
|
+
* stands, whatever ran meanwhile. The registration stays recorded. */
|
|
648
|
+
private armedStatus;
|
|
461
649
|
private deferToStoredRetry;
|
|
462
650
|
private releaseRegistration;
|
|
463
651
|
private enableSchedule;
|
|
@@ -475,8 +663,15 @@ declare class TriggerSupervisor {
|
|
|
475
663
|
}
|
|
476
664
|
//#endregion
|
|
477
665
|
//#region src/reactor/service.d.ts
|
|
666
|
+
/** Why a firing was journaled CANCELLED without running, when it was. */
|
|
667
|
+
type FiringRefusal = "parked" | "singleton" | "stale" | "queue-full" | "expired";
|
|
478
668
|
type PersistedRunResult = WorkflowRunResult & {
|
|
479
669
|
runId: string | null;
|
|
670
|
+
refusal?: FiringRefusal;
|
|
671
|
+
};
|
|
672
|
+
type RunResume = {
|
|
673
|
+
completedSteps: Map<string, ReplayedStep>;
|
|
674
|
+
rerunOf: string;
|
|
480
675
|
};
|
|
481
676
|
interface ConnectionSummary {
|
|
482
677
|
id: string;
|
|
@@ -538,9 +733,11 @@ interface WebhookEndpointRecord {
|
|
|
538
733
|
export declare class WorkflowRuntimeService {
|
|
539
734
|
private readonly host;
|
|
540
735
|
private readonly logger;
|
|
736
|
+
private readonly telemetry;
|
|
541
737
|
private readonly attachments?;
|
|
542
738
|
private executor?;
|
|
543
739
|
private pieceWorkers?;
|
|
740
|
+
private unobservePool?;
|
|
544
741
|
private storePromise;
|
|
545
742
|
private storeError?;
|
|
546
743
|
private storeOpening;
|
|
@@ -571,7 +768,10 @@ export declare class WorkflowRuntimeService {
|
|
|
571
768
|
private endpointCount;
|
|
572
769
|
private hasWebhookEndpoints;
|
|
573
770
|
private readonly registeredAs;
|
|
771
|
+
private readonly registrationChains;
|
|
772
|
+
private inRegistrationOrder;
|
|
574
773
|
private updateRegistration;
|
|
774
|
+
private registerNow;
|
|
575
775
|
private applyRegistration;
|
|
576
776
|
private enableSupervised;
|
|
577
777
|
private registerPieceTrigger;
|
|
@@ -627,6 +827,7 @@ export declare class WorkflowRuntimeService {
|
|
|
627
827
|
private matchDocumentLifecycle;
|
|
628
828
|
private matchDriveLifecycle;
|
|
629
829
|
private triggerSupervisor?;
|
|
830
|
+
private readonly parks;
|
|
630
831
|
supervisor(): TriggerSupervisor;
|
|
631
832
|
startTriggerSupervisor(): void;
|
|
632
833
|
stopTriggerSupervisor(): void;
|
|
@@ -665,6 +866,7 @@ export declare class WorkflowRuntimeService {
|
|
|
665
866
|
private designReactorAccess;
|
|
666
867
|
private readonly descriptors;
|
|
667
868
|
private designWorker?;
|
|
869
|
+
private createDesignWorker;
|
|
668
870
|
private designEgress;
|
|
669
871
|
private readonly describing;
|
|
670
872
|
private pieceDescriptor;
|
|
@@ -672,6 +874,7 @@ export declare class WorkflowRuntimeService {
|
|
|
672
874
|
driveWorkflowIds(driveId: string, ctx?: WorkflowCaller): Promise<string[]>;
|
|
673
875
|
runs(args: RunsArgs, ctx?: WorkflowCaller): Promise<RunRecord[]>;
|
|
674
876
|
runsPage(args: RunsPageArgs, ctx?: WorkflowCaller): Promise<RunPage>;
|
|
877
|
+
private listRunsPage;
|
|
675
878
|
run(runId: string, ctx?: WorkflowCaller): Promise<RunRecord | null>;
|
|
676
879
|
connections(ctx?: WorkflowCaller): Promise<ConnectionSummary[]>;
|
|
677
880
|
checkConnection(connectionId: string, ctx?: WorkflowCaller): Promise<ConnectionCheckResult>;
|
|
@@ -726,13 +929,41 @@ export declare class WorkflowRuntimeService {
|
|
|
726
929
|
private noteLastTest;
|
|
727
930
|
private blockExecutor;
|
|
728
931
|
private workers;
|
|
729
|
-
fire(workflowId: string, triggerPayload?: unknown, triggerKind?: string, resume?:
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
932
|
+
fire(workflowId: string, triggerPayload?: unknown, triggerKind?: string, resume?: RunResume, ctx?: WorkflowCaller, enqueuedRunId?: string): Promise<PersistedRunResult>;
|
|
933
|
+
private runFired;
|
|
934
|
+
private readonly runGate;
|
|
935
|
+
/** Why a trigger's firing of a PARKED workflow is refused; undefined when
|
|
936
|
+
* it is not parked, or when an operator started the run. */
|
|
937
|
+
private parkedFiring;
|
|
938
|
+
/** Why a firing that waited for its slot may no longer run, if it may not. */
|
|
939
|
+
private staleAfterWait;
|
|
940
|
+
/** Whether the workflow is still ENABLED at this published version. An
|
|
941
|
+
* unreadable document counts as unchanged, so a failure still parks. */
|
|
942
|
+
private stillRunsVersion;
|
|
943
|
+
/** A park recorded against an earlier published version than this state's. */
|
|
944
|
+
private outdatedPark;
|
|
945
|
+
/**
|
|
946
|
+
* A firing SINGLETON refused.
|
|
947
|
+
*
|
|
948
|
+
* Journaled as a CANCELLED run rather than dropped: a firing that vanished
|
|
949
|
+
* is indistinguishable from a trigger that never fired, which is the class
|
|
950
|
+
* of bug this work package exists to stamp out. An already-enqueued row is
|
|
951
|
+
* closed out in place, so nothing is left PENDING for a sweep to find.
|
|
952
|
+
*/
|
|
953
|
+
private skipFiring;
|
|
954
|
+
/**
|
|
955
|
+
* `policy.onFailure` for a run that failed terminally.
|
|
956
|
+
*
|
|
957
|
+
* PARK is the document model's own default, so this is where enforcing the
|
|
958
|
+
* knob becomes visible: a terminal failure parks the workflow, whatever its
|
|
959
|
+
* trigger kind, and nothing fires it until it is re-published or
|
|
960
|
+
* re-enabled. That is what PARK means, and
|
|
961
|
+
* leaving a broken workflow firing every minute is what it meant before.
|
|
962
|
+
*
|
|
963
|
+
* NOTIFY logs at error level, which is the only notification channel this
|
|
964
|
+
* engine has; it is marked as such rather than pretending to page anyone.
|
|
965
|
+
*/
|
|
966
|
+
private applyFailureMode;
|
|
736
967
|
rerun(runId: string, ctx?: WorkflowCaller): Promise<PersistedRunResult>;
|
|
737
968
|
private rereads;
|
|
738
969
|
testStep(workflowId: string, stepId: string, ctx?: WorkflowCaller, access?: WorkflowAccessOptions): Promise<StepTestResult>;
|
|
@@ -19350,6 +19581,6 @@ interface WebhookPayload {
|
|
|
19350
19581
|
body: unknown;
|
|
19351
19582
|
}
|
|
19352
19583
|
//#endregion
|
|
19353
|
-
export { type AttachmentClientLike, type BlockResolutionRecord, CORE_PIECE_NAME, type ConnectionCheckResult, type ConnectionSummary, type HostIdentity, type OAuthAttemptStatus, type OAuthAttemptView, type OAuthStart, type OutputTree, type OutputTreeNode, type PersistedRunResult, PieceRegistry, type PieceStoreRow, type PieceTriggerBinding, type RunPage, type RunRecord, type RunRow, type RunsArgs, type RunsPageArgs, type ScheduleTriggerBinding, type StepExecutionRow, type StepTestResult, type TriggerBinding, type TriggerDedupeRow, type TriggerStateRow, type WebhookConfig, type WebhookPayload, type WorkflowAccessOptions, type WorkflowCaller, type WorkflowRuntimeDB, type WorkflowRuntimeHostDeps, packagePieces };
|
|
19584
|
+
export { type AttachmentClientLike, type AttachmentReadRequest, type BlockResolutionRecord, CORE_PIECE_NAME, type ConnectionCheckResult, type ConnectionSummary, type HostIdentity, type OAuthAttemptStatus, type OAuthAttemptView, type OAuthStart, type OutputTree, type OutputTreeNode, type PersistedRunResult, PieceRegistry, type PieceStoreRow, type PieceTriggerBinding, type RunPage, type RunRecord, type RunRow, type RunsArgs, type RunsPageArgs, type ScheduleTriggerBinding, type StepExecutionRow, type StepTestResult, TELEMETRY_SCOPE, type TriggerBinding, type TriggerDedupeRow, type TriggerStateRow, type WebhookConfig, type WebhookPayload, type WorkflowAccessOptions, type WorkflowCaller, type WorkflowRuntimeDB, type WorkflowRuntimeHostDeps, type WorkflowTelemetryOptions, packagePieces };
|
|
19354
19585
|
export {};
|
|
19355
19586
|
//# sourceMappingURL=index.d.ts.map
|