@particle-academy/fancy-flow 0.29.1 → 0.31.0
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/dist/engine.cjs +120 -0
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +4 -2
- package/dist/engine.d.ts +4 -2
- package/dist/engine.js +1 -0
- package/dist/engine.js.map +1 -1
- package/dist/index.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -5
- package/dist/index.d.ts +17 -5
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.cts +4 -46
- package/dist/registry/index.d.ts +4 -46
- package/dist/registry-Dd1Q66uP.d.ts +45 -0
- package/dist/registry-qv4gRiuQ.d.cts +45 -0
- package/dist/{types-BGtR3k9J.d.ts → types-Bj_ZHwqG.d.ts} +96 -2
- package/dist/{types-B_pxRqfw.d.cts → types-DEmDSByY.d.cts} +96 -2
- package/dist/ux.d.cts +1 -2
- package/dist/ux.d.ts +1 -2
- package/package.json +1 -1
- package/dist/pause-9iT4tCEV.d.cts +0 -96
- package/dist/pause-9iT4tCEV.d.ts +0 -96
package/dist/pause-9iT4tCEV.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The human-pause contract.
|
|
3
|
-
*
|
|
4
|
-
* A workflow that waits for a person is not an error, but it travels the same
|
|
5
|
-
* channel as one: the executor aborts, the engine records a reason string, and
|
|
6
|
-
* the durable runner decides whether that string meant "failed" or "waiting".
|
|
7
|
-
*
|
|
8
|
-
* That seam existed before this module, as two `str_starts_with` checks in the
|
|
9
|
-
* Laravel run job against constants owned by two BUILTIN executors. It worked,
|
|
10
|
-
* and it was invisible: a third-party human-input node had no way to announce
|
|
11
|
-
* that it pauses, and nothing stopped a refactor from removing the mechanism
|
|
12
|
-
* out from under published packages. Reported by the MOIC Suite consumer, who
|
|
13
|
-
* needed exactly that and had to reach for a private constant to get it.
|
|
14
|
-
*
|
|
15
|
-
* So the encoding is now public, typed, and versioned by prefix rather than
|
|
16
|
-
* implied. The wire format stays a plain string on purpose — it survives the
|
|
17
|
-
* existing abort → `RunResult.error` path unchanged, crosses a queue boundary,
|
|
18
|
-
* and decodes identically in PHP, none of which a thrown class would do.
|
|
19
|
-
*
|
|
20
|
-
* @see decodePause — the one function a durable runner needs.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* What the run is waiting for.
|
|
24
|
-
*
|
|
25
|
-
* `approval` and `input` are the shapes both runtimes ship. The type stays open
|
|
26
|
-
* because the whole point is that a marketplace node can define its own —
|
|
27
|
-
* a signature step, a payment confirmation, a review queue — and a runner that
|
|
28
|
-
* does not recognise one should report it rather than guess.
|
|
29
|
-
*/
|
|
30
|
-
type PauseAwaiting = "approval" | "input" | (string & {});
|
|
31
|
-
/** A run halted, waiting for a person. */
|
|
32
|
-
type PauseSignal = {
|
|
33
|
-
/** The node that paused — where a submission gets injected on resume. */
|
|
34
|
-
nodeId: string;
|
|
35
|
-
awaiting: PauseAwaiting;
|
|
36
|
-
/**
|
|
37
|
-
* Kind-supplied context for whoever renders the wait — a form schema, the
|
|
38
|
-
* question being asked, a diff to approve. Must be JSON-serializable: it
|
|
39
|
-
* crosses a queue boundary and, for durable runs, a database column.
|
|
40
|
-
*/
|
|
41
|
-
detail?: unknown;
|
|
42
|
-
};
|
|
43
|
-
/** Marks a reason string as a pause rather than a failure. */
|
|
44
|
-
declare const PAUSE_PREFIX = "fancy-flow:pause:";
|
|
45
|
-
/**
|
|
46
|
-
* Reason prefixes shipped before this contract, kept decodable forever.
|
|
47
|
-
*
|
|
48
|
-
* These are what `DurableApprovalExecutor` and `DurableUserInputExecutor`
|
|
49
|
-
* emitted, and they are written into the `error` column of every run that
|
|
50
|
-
* paused under an older version. Dropping them would strand those runs
|
|
51
|
-
* mid-flight — a resume path that only works for new runs is not a resume path.
|
|
52
|
-
*/
|
|
53
|
-
declare const LEGACY_PAUSE_PREFIXES: ReadonlyArray<readonly [string, PauseAwaiting]>;
|
|
54
|
-
/**
|
|
55
|
-
* Encode a pause as the reason string an executor aborts with.
|
|
56
|
-
*
|
|
57
|
-
* The payload is JSON rather than delimited fields because a node id may
|
|
58
|
-
* contain a colon, and a positional encoding that breaks on user data is the
|
|
59
|
-
* kind of bug that only shows up in someone else's graph.
|
|
60
|
-
*/
|
|
61
|
-
declare function encodePause(signal: PauseSignal): string;
|
|
62
|
-
/**
|
|
63
|
-
* Decode a run's error reason into a pause, or null if it was a real failure.
|
|
64
|
-
*
|
|
65
|
-
* This is the whole contract from a runner's side: call it on `result.error`,
|
|
66
|
-
* and if it returns non-null, persist the run as waiting on `signal.nodeId`
|
|
67
|
-
* instead of failing it. Accepts the legacy prefixes, so a runner written
|
|
68
|
-
* against this handles runs that paused under an older version.
|
|
69
|
-
*/
|
|
70
|
-
declare function decodePause(reason: string | null | undefined): PauseSignal | null;
|
|
71
|
-
/** True when a run's error reason is actually a pause. */
|
|
72
|
-
declare function isPause(reason: string | null | undefined): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Abort the current node as a pause.
|
|
75
|
-
*
|
|
76
|
-
* Called from inside an executor with its own context. Node authors should
|
|
77
|
-
* reach for this rather than hand-encoding a reason, so the format stays ours
|
|
78
|
-
* to change:
|
|
79
|
-
*
|
|
80
|
-
* ```ts
|
|
81
|
-
* const values = ctx.inputs.values;
|
|
82
|
-
* if (values === undefined) pauseForHuman(ctx, "input", { fields });
|
|
83
|
-
* return values;
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* Note the `undefined` check — an empty submission (`{}`) is a real answer and
|
|
87
|
-
* must resume. Truthiness here pauses forever on an empty form.
|
|
88
|
-
*/
|
|
89
|
-
declare function pauseForHuman(ctx: {
|
|
90
|
-
node: {
|
|
91
|
-
id: string;
|
|
92
|
-
};
|
|
93
|
-
abort: (reason?: string) => never;
|
|
94
|
-
}, awaiting: PauseAwaiting, detail?: unknown): never;
|
|
95
|
-
|
|
96
|
-
export { LEGACY_PAUSE_PREFIXES as L, type PauseAwaiting as P, PAUSE_PREFIX as a, type PauseSignal as b, decodePause as d, encodePause as e, isPause as i, pauseForHuman as p };
|