@fluidgrids/workflows 2026.1029.1 → 2026.1030.1
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 +112 -4
- package/dist/{activation-CESehfYi.d.cts → activation-DqUfpHzk.d.cts} +1 -1
- package/dist/{activation-BnVQMv9y.d.ts → activation-xpx1oWuo.d.ts} +1 -1
- package/dist/{chunk-MJ5TGYVG.js → chunk-2D3MYIIF.js} +969 -153
- package/dist/{chunk-2B37XAFQ.cjs → chunk-3U2NU7YC.cjs} +24 -11
- package/dist/{chunk-NEIUQASE.cjs → chunk-4QKB4ARC.cjs} +3 -3
- package/dist/{chunk-GBQ33SIZ.cjs → chunk-54FLQNUM.cjs} +12 -1
- package/dist/{chunk-2DDULZFM.js → chunk-5HIVIV53.js} +86 -75
- package/dist/chunk-5MFVJM76.js +1222 -0
- package/dist/{chunk-EWYADREB.cjs → chunk-672KMMBK.cjs} +2 -2
- package/dist/{chunk-KXJDRQ6G.js → chunk-6A2FGSUS.js} +22 -2
- package/dist/{chunk-OIX4O6UR.js → chunk-6OLN6BMB.js} +16 -3
- package/dist/{chunk-6FSHT5IL.js → chunk-7EZIANC7.js} +1 -1
- package/dist/chunk-A5SXCA62.cjs +93 -0
- package/dist/chunk-AC6ZEXVR.js +85 -0
- package/dist/{chunk-FWBRQWRX.js → chunk-AE5Q6ZAJ.js} +167 -10
- package/dist/{chunk-7ILGCUI6.js → chunk-C4F5KJTI.js} +142 -3
- package/dist/{chunk-WXXNCHUY.js → chunk-G5H32GIG.js} +1 -1
- package/dist/{chunk-OMY3CKUZ.cjs → chunk-GEQDGUGB.cjs} +1042 -226
- package/dist/{chunk-25BKWR2O.js → chunk-HCM7ZC7Q.js} +1 -1
- package/dist/{chunk-I47EENR4.cjs → chunk-HMZUGSMU.cjs} +673 -156
- package/dist/{chunk-NXFBVDOI.cjs → chunk-IQPXHQQQ.cjs} +8 -4
- package/dist/{chunk-RUQIMTN5.cjs → chunk-ISOIA7NV.cjs} +178 -15
- package/dist/chunk-JSC75O5C.cjs +167 -0
- package/dist/{chunk-BD7ZPG53.js → chunk-NWQ5WRLE.js} +10 -2
- package/dist/chunk-ODZ2IAR2.cjs +1247 -0
- package/dist/{chunk-FQSJI5NV.js → chunk-SR7TR5KX.js} +6 -2
- package/dist/{chunk-OKX3FYIM.cjs → chunk-TCTE7DX5.cjs} +3 -3
- package/dist/{chunk-3FIDHONL.cjs → chunk-TYF56RGB.cjs} +99 -80
- package/dist/{chunk-J3PYFGKA.cjs → chunk-VA4OFR72.cjs} +162 -4
- package/dist/chunk-VU5S5A7V.js +150 -0
- package/dist/{chunk-A36CCOWS.js → chunk-YEHR4NNE.js} +633 -128
- package/dist/{chunk-ELL2RBML.cjs → chunk-ZCGKGDCL.cjs} +23 -1
- package/dist/codegen/index.d.cts +2 -2
- package/dist/codegen/index.d.ts +2 -2
- package/dist/{collect-BTHjQaSp.d.ts → collect-6NIEufHd.d.ts} +20 -3
- package/dist/{collect-CSyOg5XC.d.cts → collect-CcTCKqx6.d.cts} +20 -3
- package/dist/{file-cgL9l9l8.d.cts → file-BxYpwjRQ.d.cts} +250 -15
- package/dist/{file-olQudcx5.d.ts → file-CFdPQJI9.d.ts} +250 -15
- package/dist/history/index.cjs +283 -106
- package/dist/history/index.d.cts +549 -10
- package/dist/history/index.d.ts +549 -10
- package/dist/history/index.js +5 -4
- package/dist/index.cjs +146 -53
- package/dist/index.d.cts +38 -14
- package/dist/index.d.ts +38 -14
- package/dist/index.js +6 -5
- package/dist/interceptors-CNcr2dlk.d.ts +159 -0
- package/dist/interceptors-CqkNZVfI.d.cts +159 -0
- package/dist/ir/index.cjs +339 -36
- package/dist/ir/index.d.cts +244 -8
- package/dist/ir/index.d.ts +244 -8
- package/dist/ir/index.js +306 -21
- package/dist/{lower-3S6PsqjJ.d.cts → lower-BtRfIW2A.d.cts} +23 -9
- package/dist/{lower-DmZpQ8hJ.d.ts → lower-CpsMFOFX.d.ts} +23 -9
- package/dist/{manifest-BJjrQt77.d.ts → manifest-D-I_twys.d.ts} +1 -1
- package/dist/{manifest-gRI2Q5Fj.d.cts → manifest-DahBQVM8.d.cts} +1 -1
- package/dist/node-evaluator-DGQDPSPI.cjs +24 -0
- package/dist/node-evaluator-LEEVD7H7.js +14 -0
- package/dist/payload-fields-BVRQn2yH.d.cts +122 -0
- package/dist/payload-fields-oOBWxDiG.d.ts +122 -0
- package/dist/quickjs/index.cjs +27 -27
- package/dist/quickjs/index.d.cts +6 -6
- package/dist/quickjs/index.d.ts +6 -6
- package/dist/quickjs/index.js +9 -9
- package/dist/roundtrip/index.cjs +72 -66
- package/dist/roundtrip/index.d.cts +25 -11
- package/dist/roundtrip/index.d.ts +25 -11
- package/dist/roundtrip/index.js +13 -11
- package/dist/runtime/index.cjs +19 -19
- package/dist/runtime/index.d.cts +139 -12
- package/dist/runtime/index.d.ts +139 -12
- package/dist/runtime/index.js +6 -6
- package/dist/testing/index.cjs +688 -121
- package/dist/testing/index.d.cts +174 -10
- package/dist/testing/index.d.ts +174 -10
- package/dist/testing/index.js +646 -82
- package/dist/{types-CnIOinoz.d.ts → types-Bv2i4cBX.d.cts} +126 -23
- package/dist/{types-CQKOhPTa.d.cts → types-DGx-b9eq.d.ts} +126 -23
- package/dist/{types-Bb2wRnJ5.d.cts → types-V7jEEUaL.d.cts} +1 -1
- package/dist/{types-Bb2wRnJ5.d.ts → types-V7jEEUaL.d.ts} +1 -1
- package/dist/{workflow-8uRU9rhL.d.ts → workflow-B18OeF7g.d.ts} +2 -2
- package/dist/{workflow-DWTPHFbt.d.ts → workflow-BGnv8SS6.d.ts} +261 -14
- package/dist/{workflow-CZOXUlQ5.d.cts → workflow-BJPFv3cp.d.cts} +2 -2
- package/dist/{workflow-O6e64ZcG.d.cts → workflow-DS32Gtws.d.cts} +261 -14
- package/fixtures/histories/activity-options-updated.history.json +159 -0
- package/fixtures/histories/activity-paused-unpaused.history.json +160 -0
- package/fixtures/histories/codec-opaque.history.json +229 -0
- package/fixtures/histories/dynamic-workflow.history.json +150 -0
- package/fixtures/histories/interceptor-headers.history.json +339 -0
- package/fixtures/histories/query-custom.history.json +213 -0
- package/fixtures/histories/query-default-handler.history.json +120 -0
- package/fixtures/histories/reset-forked-reapplied-signals.history.json +239 -0
- package/fixtures/histories/reset-reapplied-update-admitted.history.json +228 -0
- package/fixtures/histories/search-attributes-upserted.history.json +177 -0
- package/fixtures/histories/update-accepted-completed.history.json +45 -30
- package/fixtures/histories/update-default-handler.history.json +246 -0
- package/fixtures/histories/update-handler-awaits-activity.history.json +196 -0
- package/fixtures/histories/update-not-handled.history.json +138 -0
- package/fixtures/histories/update-rejected-no-event.history.json +190 -0
- package/fixtures/histories/update-with-start-admitted.history.json +150 -0
- package/fixtures/histories/user-activity-cancel.history.json +149 -0
- package/fixtures/histories/user-activity-retry.history.json +143 -0
- package/fixtures/histories/user-activity.history.json +149 -0
- package/package.json +1 -1
- package/schema/bridge-v2.schema.json +1062 -0
- package/schema/history-file.schema.json +255 -81
- package/schema/ir-v2.schema.json +246 -1
- package/schema/payload-fields.json +162 -0
- package/schema/run-event.schema.json +239 -80
- package/schema/workflow-command.schema.json +210 -84
- package/schema/workflow-task.schema.json +532 -167
- package/dist/chunk-6QPOJZT6.cjs +0 -1180
- package/dist/chunk-A2OHX3UQ.js +0 -1156
- package/dist/chunk-PWIUEWC3.js +0 -81
- package/dist/chunk-YHBVMOMK.cjs +0 -87
- package/dist/node-evaluator-SOADN23V.js +0 -14
- package/dist/node-evaluator-YGDEXK4U.cjs +0 -24
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { a as Json, J as JsonObject } from './types-V7jEEUaL.js';
|
|
2
|
+
import { ad as RunTarget, M as Headers } from './types-DGx-b9eq.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interceptors (11 §2.10): middleware around what workflow code receives
|
|
6
|
+
* (inbound) and issues (outbound), and around activity execution. A `headers`
|
|
7
|
+
* map travels with starts, signals, updates, activities and children, so one
|
|
8
|
+
* interceptor can hand context (trace ids, tenant hints) to the next one in
|
|
9
|
+
* another run or on a worker.
|
|
10
|
+
*
|
|
11
|
+
* A managed bundle registers workflow interceptors by exporting
|
|
12
|
+
* `interceptors` (made with {@link workflowInterceptors}, or a plain factory
|
|
13
|
+
* function) from any module; the factory runs once per workflow task inside
|
|
14
|
+
* the isolate, so it must be deterministic. Self-hosted workers and clients
|
|
15
|
+
* register theirs on the worker or client (C-R2).
|
|
16
|
+
*
|
|
17
|
+
* Every chain is composed in list order: the first interceptor is the
|
|
18
|
+
* outermost and calls `next` to reach the second, the last one reaches the
|
|
19
|
+
* runtime. Outbound methods should call `next` synchronously, before any
|
|
20
|
+
* await, so the command is issued where the code issued it.
|
|
21
|
+
*
|
|
22
|
+
* Pure JavaScript; it runs inside the isolate.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** The workflow function is about to run. */
|
|
26
|
+
interface WorkflowExecuteInput {
|
|
27
|
+
readonly workflowFn: string;
|
|
28
|
+
input: Json;
|
|
29
|
+
/** The start's headers (`WORKFLOW_STARTED.headers`). */
|
|
30
|
+
readonly headers: Headers;
|
|
31
|
+
}
|
|
32
|
+
/** A signal is about to reach its handler. */
|
|
33
|
+
interface SignalInput {
|
|
34
|
+
readonly name: string;
|
|
35
|
+
payload: Json;
|
|
36
|
+
readonly headers: Headers;
|
|
37
|
+
}
|
|
38
|
+
/** A query is about to reach its handler. */
|
|
39
|
+
interface QueryInput {
|
|
40
|
+
readonly queryId: string;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
args: Json;
|
|
43
|
+
}
|
|
44
|
+
/** An update is about to be validated or handled. */
|
|
45
|
+
interface UpdateInput {
|
|
46
|
+
readonly updateId: string;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
args: Json;
|
|
49
|
+
readonly headers: Headers;
|
|
50
|
+
}
|
|
51
|
+
/** An activity (`ctx.run` or `ctx.activity`) is about to be scheduled. */
|
|
52
|
+
interface ScheduleActivityInput {
|
|
53
|
+
readonly activityId: string;
|
|
54
|
+
readonly kind: 'node' | 'user';
|
|
55
|
+
/** The node type, or the user activity's name. */
|
|
56
|
+
readonly name: string;
|
|
57
|
+
/** The node operation; absent for a user activity. */
|
|
58
|
+
readonly operation?: string;
|
|
59
|
+
args: Json;
|
|
60
|
+
headers: Headers;
|
|
61
|
+
}
|
|
62
|
+
/** A local activity is about to be run. Its headers do not leave the task. */
|
|
63
|
+
interface ScheduleLocalActivityInput {
|
|
64
|
+
readonly localActivityId: string;
|
|
65
|
+
readonly nodeType: string;
|
|
66
|
+
readonly operation: string;
|
|
67
|
+
args: Json;
|
|
68
|
+
}
|
|
69
|
+
/** A durable timer (`ctx.sleep`) is about to start. */
|
|
70
|
+
interface StartTimerInput {
|
|
71
|
+
durationMs: number;
|
|
72
|
+
summary?: string;
|
|
73
|
+
}
|
|
74
|
+
/** A child run is about to start. */
|
|
75
|
+
interface StartChildInput {
|
|
76
|
+
readonly workflowKey?: string;
|
|
77
|
+
readonly workflowFn?: string;
|
|
78
|
+
input: Json;
|
|
79
|
+
headers: Headers;
|
|
80
|
+
}
|
|
81
|
+
/** A signal to another run is about to be sent. */
|
|
82
|
+
interface SignalRunInput {
|
|
83
|
+
readonly target: RunTarget;
|
|
84
|
+
readonly name: string;
|
|
85
|
+
payload: Json;
|
|
86
|
+
headers: Headers;
|
|
87
|
+
}
|
|
88
|
+
/** A cancel request to another run is about to be sent. */
|
|
89
|
+
interface CancelRunInput {
|
|
90
|
+
readonly target: RunTarget;
|
|
91
|
+
}
|
|
92
|
+
/** The run is about to continue as new. */
|
|
93
|
+
interface ContinueAsNewInput {
|
|
94
|
+
input: Json;
|
|
95
|
+
options: JsonObject;
|
|
96
|
+
headers: Headers;
|
|
97
|
+
}
|
|
98
|
+
/** Search attributes are about to be upserted. */
|
|
99
|
+
interface UpsertSearchAttributesInput {
|
|
100
|
+
attributes: JsonObject;
|
|
101
|
+
}
|
|
102
|
+
/** Context (memo) entries are about to be upserted. */
|
|
103
|
+
interface UpsertContextInput {
|
|
104
|
+
entries: JsonObject;
|
|
105
|
+
}
|
|
106
|
+
/** Interceptors of what reaches workflow code. */
|
|
107
|
+
interface WorkflowInboundInterceptor {
|
|
108
|
+
execute?(input: WorkflowExecuteInput, next: (input: WorkflowExecuteInput) => Promise<unknown>): Promise<unknown>;
|
|
109
|
+
handleSignal?(input: SignalInput, next: (input: SignalInput) => unknown): unknown;
|
|
110
|
+
/** Synchronous: a query handler must not wait. */
|
|
111
|
+
handleQuery?(input: QueryInput, next: (input: QueryInput) => unknown): unknown;
|
|
112
|
+
/** Synchronous: throw to reject the update (nothing is written to history). */
|
|
113
|
+
validateUpdate?(input: UpdateInput, next: (input: UpdateInput) => void): void;
|
|
114
|
+
handleUpdate?(input: UpdateInput, next: (input: UpdateInput) => unknown): unknown;
|
|
115
|
+
}
|
|
116
|
+
/** Interceptors of what workflow code issues. */
|
|
117
|
+
interface WorkflowOutboundInterceptor {
|
|
118
|
+
scheduleActivity?(input: ScheduleActivityInput, next: (input: ScheduleActivityInput) => Promise<unknown>): Promise<unknown>;
|
|
119
|
+
scheduleLocalActivity?(input: ScheduleLocalActivityInput, next: (input: ScheduleLocalActivityInput) => Promise<unknown>): Promise<unknown>;
|
|
120
|
+
startTimer?(input: StartTimerInput, next: (input: StartTimerInput) => Promise<void>): Promise<void>;
|
|
121
|
+
startChild?(input: StartChildInput, next: (input: StartChildInput) => Promise<unknown>): Promise<unknown>;
|
|
122
|
+
signalRun?(input: SignalRunInput, next: (input: SignalRunInput) => Promise<void>): Promise<void>;
|
|
123
|
+
cancelRun?(input: CancelRunInput, next: (input: CancelRunInput) => Promise<void>): Promise<void>;
|
|
124
|
+
sideEffect?(input: Record<string, never>, next: () => Json): Json;
|
|
125
|
+
continueAsNew?(input: ContinueAsNewInput, next: (input: ContinueAsNewInput) => Promise<never>): Promise<never>;
|
|
126
|
+
upsertSearchAttributes?(input: UpsertSearchAttributesInput, next: (input: UpsertSearchAttributesInput) => void): void;
|
|
127
|
+
upsertContext?(input: UpsertContextInput, next: (input: UpsertContextInput) => void): void;
|
|
128
|
+
/** Attributes added to every `ctx.log` line's data. */
|
|
129
|
+
getLogAttributes?(input: Record<string, Json>, next: (input: Record<string, Json>) => Record<string, Json>): Record<string, Json>;
|
|
130
|
+
}
|
|
131
|
+
/** The workflow interceptors of a bundle. */
|
|
132
|
+
interface WorkflowInterceptors {
|
|
133
|
+
inbound?: WorkflowInboundInterceptor[];
|
|
134
|
+
outbound?: WorkflowOutboundInterceptor[];
|
|
135
|
+
}
|
|
136
|
+
/** Makes the interceptors of one workflow task. */
|
|
137
|
+
type WorkflowInterceptorsFactory = () => WorkflowInterceptors;
|
|
138
|
+
declare const INTERCEPTORS_MARKER = "fluidgrids.workflow-interceptors";
|
|
139
|
+
/** A factory marked by {@link workflowInterceptors}. */
|
|
140
|
+
interface MarkedInterceptorsFactory {
|
|
141
|
+
readonly __fluidgrids: typeof INTERCEPTORS_MARKER;
|
|
142
|
+
readonly factory: WorkflowInterceptorsFactory;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Declare the workflow interceptors of a bundle; export the value as
|
|
146
|
+
* `interceptors` from any module.
|
|
147
|
+
*/
|
|
148
|
+
declare function workflowInterceptors(factory: WorkflowInterceptorsFactory): MarkedInterceptorsFactory;
|
|
149
|
+
/** The factory of an `interceptors` export, or undefined when the value is not one. */
|
|
150
|
+
declare function interceptorsFactoryOf(value: unknown): WorkflowInterceptorsFactory | undefined;
|
|
151
|
+
/** Run every factory and concatenate their lists, in factory order. */
|
|
152
|
+
declare function resolveWorkflowInterceptors(factories: readonly WorkflowInterceptorsFactory[]): Required<WorkflowInterceptors>;
|
|
153
|
+
/**
|
|
154
|
+
* Compose `method` of each interceptor around `terminal`, first interceptor
|
|
155
|
+
* outermost. Interceptors without the method are skipped.
|
|
156
|
+
*/
|
|
157
|
+
declare function compose<I, O, T extends object>(interceptors: readonly T[], method: keyof T, terminal: (input: I) => O): (input: I) => O;
|
|
158
|
+
|
|
159
|
+
export { type CancelRunInput as C, INTERCEPTORS_MARKER as I, type MarkedInterceptorsFactory as M, type QueryInput as Q, type ScheduleActivityInput as S, type UpdateInput as U, type WorkflowExecuteInput as W, type ContinueAsNewInput as a, type ScheduleLocalActivityInput as b, type SignalInput as c, type SignalRunInput as d, type StartChildInput as e, type StartTimerInput as f, type UpsertContextInput as g, type UpsertSearchAttributesInput as h, type WorkflowInboundInterceptor as i, type WorkflowInterceptors as j, type WorkflowInterceptorsFactory as k, type WorkflowOutboundInterceptor as l, compose as m, interceptorsFactoryOf as n, resolveWorkflowInterceptors as r, workflowInterceptors as w };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { a as Json, J as JsonObject } from './types-V7jEEUaL.cjs';
|
|
2
|
+
import { ad as RunTarget, M as Headers } from './types-Bv2i4cBX.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interceptors (11 §2.10): middleware around what workflow code receives
|
|
6
|
+
* (inbound) and issues (outbound), and around activity execution. A `headers`
|
|
7
|
+
* map travels with starts, signals, updates, activities and children, so one
|
|
8
|
+
* interceptor can hand context (trace ids, tenant hints) to the next one in
|
|
9
|
+
* another run or on a worker.
|
|
10
|
+
*
|
|
11
|
+
* A managed bundle registers workflow interceptors by exporting
|
|
12
|
+
* `interceptors` (made with {@link workflowInterceptors}, or a plain factory
|
|
13
|
+
* function) from any module; the factory runs once per workflow task inside
|
|
14
|
+
* the isolate, so it must be deterministic. Self-hosted workers and clients
|
|
15
|
+
* register theirs on the worker or client (C-R2).
|
|
16
|
+
*
|
|
17
|
+
* Every chain is composed in list order: the first interceptor is the
|
|
18
|
+
* outermost and calls `next` to reach the second, the last one reaches the
|
|
19
|
+
* runtime. Outbound methods should call `next` synchronously, before any
|
|
20
|
+
* await, so the command is issued where the code issued it.
|
|
21
|
+
*
|
|
22
|
+
* Pure JavaScript; it runs inside the isolate.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** The workflow function is about to run. */
|
|
26
|
+
interface WorkflowExecuteInput {
|
|
27
|
+
readonly workflowFn: string;
|
|
28
|
+
input: Json;
|
|
29
|
+
/** The start's headers (`WORKFLOW_STARTED.headers`). */
|
|
30
|
+
readonly headers: Headers;
|
|
31
|
+
}
|
|
32
|
+
/** A signal is about to reach its handler. */
|
|
33
|
+
interface SignalInput {
|
|
34
|
+
readonly name: string;
|
|
35
|
+
payload: Json;
|
|
36
|
+
readonly headers: Headers;
|
|
37
|
+
}
|
|
38
|
+
/** A query is about to reach its handler. */
|
|
39
|
+
interface QueryInput {
|
|
40
|
+
readonly queryId: string;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
args: Json;
|
|
43
|
+
}
|
|
44
|
+
/** An update is about to be validated or handled. */
|
|
45
|
+
interface UpdateInput {
|
|
46
|
+
readonly updateId: string;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
args: Json;
|
|
49
|
+
readonly headers: Headers;
|
|
50
|
+
}
|
|
51
|
+
/** An activity (`ctx.run` or `ctx.activity`) is about to be scheduled. */
|
|
52
|
+
interface ScheduleActivityInput {
|
|
53
|
+
readonly activityId: string;
|
|
54
|
+
readonly kind: 'node' | 'user';
|
|
55
|
+
/** The node type, or the user activity's name. */
|
|
56
|
+
readonly name: string;
|
|
57
|
+
/** The node operation; absent for a user activity. */
|
|
58
|
+
readonly operation?: string;
|
|
59
|
+
args: Json;
|
|
60
|
+
headers: Headers;
|
|
61
|
+
}
|
|
62
|
+
/** A local activity is about to be run. Its headers do not leave the task. */
|
|
63
|
+
interface ScheduleLocalActivityInput {
|
|
64
|
+
readonly localActivityId: string;
|
|
65
|
+
readonly nodeType: string;
|
|
66
|
+
readonly operation: string;
|
|
67
|
+
args: Json;
|
|
68
|
+
}
|
|
69
|
+
/** A durable timer (`ctx.sleep`) is about to start. */
|
|
70
|
+
interface StartTimerInput {
|
|
71
|
+
durationMs: number;
|
|
72
|
+
summary?: string;
|
|
73
|
+
}
|
|
74
|
+
/** A child run is about to start. */
|
|
75
|
+
interface StartChildInput {
|
|
76
|
+
readonly workflowKey?: string;
|
|
77
|
+
readonly workflowFn?: string;
|
|
78
|
+
input: Json;
|
|
79
|
+
headers: Headers;
|
|
80
|
+
}
|
|
81
|
+
/** A signal to another run is about to be sent. */
|
|
82
|
+
interface SignalRunInput {
|
|
83
|
+
readonly target: RunTarget;
|
|
84
|
+
readonly name: string;
|
|
85
|
+
payload: Json;
|
|
86
|
+
headers: Headers;
|
|
87
|
+
}
|
|
88
|
+
/** A cancel request to another run is about to be sent. */
|
|
89
|
+
interface CancelRunInput {
|
|
90
|
+
readonly target: RunTarget;
|
|
91
|
+
}
|
|
92
|
+
/** The run is about to continue as new. */
|
|
93
|
+
interface ContinueAsNewInput {
|
|
94
|
+
input: Json;
|
|
95
|
+
options: JsonObject;
|
|
96
|
+
headers: Headers;
|
|
97
|
+
}
|
|
98
|
+
/** Search attributes are about to be upserted. */
|
|
99
|
+
interface UpsertSearchAttributesInput {
|
|
100
|
+
attributes: JsonObject;
|
|
101
|
+
}
|
|
102
|
+
/** Context (memo) entries are about to be upserted. */
|
|
103
|
+
interface UpsertContextInput {
|
|
104
|
+
entries: JsonObject;
|
|
105
|
+
}
|
|
106
|
+
/** Interceptors of what reaches workflow code. */
|
|
107
|
+
interface WorkflowInboundInterceptor {
|
|
108
|
+
execute?(input: WorkflowExecuteInput, next: (input: WorkflowExecuteInput) => Promise<unknown>): Promise<unknown>;
|
|
109
|
+
handleSignal?(input: SignalInput, next: (input: SignalInput) => unknown): unknown;
|
|
110
|
+
/** Synchronous: a query handler must not wait. */
|
|
111
|
+
handleQuery?(input: QueryInput, next: (input: QueryInput) => unknown): unknown;
|
|
112
|
+
/** Synchronous: throw to reject the update (nothing is written to history). */
|
|
113
|
+
validateUpdate?(input: UpdateInput, next: (input: UpdateInput) => void): void;
|
|
114
|
+
handleUpdate?(input: UpdateInput, next: (input: UpdateInput) => unknown): unknown;
|
|
115
|
+
}
|
|
116
|
+
/** Interceptors of what workflow code issues. */
|
|
117
|
+
interface WorkflowOutboundInterceptor {
|
|
118
|
+
scheduleActivity?(input: ScheduleActivityInput, next: (input: ScheduleActivityInput) => Promise<unknown>): Promise<unknown>;
|
|
119
|
+
scheduleLocalActivity?(input: ScheduleLocalActivityInput, next: (input: ScheduleLocalActivityInput) => Promise<unknown>): Promise<unknown>;
|
|
120
|
+
startTimer?(input: StartTimerInput, next: (input: StartTimerInput) => Promise<void>): Promise<void>;
|
|
121
|
+
startChild?(input: StartChildInput, next: (input: StartChildInput) => Promise<unknown>): Promise<unknown>;
|
|
122
|
+
signalRun?(input: SignalRunInput, next: (input: SignalRunInput) => Promise<void>): Promise<void>;
|
|
123
|
+
cancelRun?(input: CancelRunInput, next: (input: CancelRunInput) => Promise<void>): Promise<void>;
|
|
124
|
+
sideEffect?(input: Record<string, never>, next: () => Json): Json;
|
|
125
|
+
continueAsNew?(input: ContinueAsNewInput, next: (input: ContinueAsNewInput) => Promise<never>): Promise<never>;
|
|
126
|
+
upsertSearchAttributes?(input: UpsertSearchAttributesInput, next: (input: UpsertSearchAttributesInput) => void): void;
|
|
127
|
+
upsertContext?(input: UpsertContextInput, next: (input: UpsertContextInput) => void): void;
|
|
128
|
+
/** Attributes added to every `ctx.log` line's data. */
|
|
129
|
+
getLogAttributes?(input: Record<string, Json>, next: (input: Record<string, Json>) => Record<string, Json>): Record<string, Json>;
|
|
130
|
+
}
|
|
131
|
+
/** The workflow interceptors of a bundle. */
|
|
132
|
+
interface WorkflowInterceptors {
|
|
133
|
+
inbound?: WorkflowInboundInterceptor[];
|
|
134
|
+
outbound?: WorkflowOutboundInterceptor[];
|
|
135
|
+
}
|
|
136
|
+
/** Makes the interceptors of one workflow task. */
|
|
137
|
+
type WorkflowInterceptorsFactory = () => WorkflowInterceptors;
|
|
138
|
+
declare const INTERCEPTORS_MARKER = "fluidgrids.workflow-interceptors";
|
|
139
|
+
/** A factory marked by {@link workflowInterceptors}. */
|
|
140
|
+
interface MarkedInterceptorsFactory {
|
|
141
|
+
readonly __fluidgrids: typeof INTERCEPTORS_MARKER;
|
|
142
|
+
readonly factory: WorkflowInterceptorsFactory;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Declare the workflow interceptors of a bundle; export the value as
|
|
146
|
+
* `interceptors` from any module.
|
|
147
|
+
*/
|
|
148
|
+
declare function workflowInterceptors(factory: WorkflowInterceptorsFactory): MarkedInterceptorsFactory;
|
|
149
|
+
/** The factory of an `interceptors` export, or undefined when the value is not one. */
|
|
150
|
+
declare function interceptorsFactoryOf(value: unknown): WorkflowInterceptorsFactory | undefined;
|
|
151
|
+
/** Run every factory and concatenate their lists, in factory order. */
|
|
152
|
+
declare function resolveWorkflowInterceptors(factories: readonly WorkflowInterceptorsFactory[]): Required<WorkflowInterceptors>;
|
|
153
|
+
/**
|
|
154
|
+
* Compose `method` of each interceptor around `terminal`, first interceptor
|
|
155
|
+
* outermost. Interceptors without the method are skipped.
|
|
156
|
+
*/
|
|
157
|
+
declare function compose<I, O, T extends object>(interceptors: readonly T[], method: keyof T, terminal: (input: I) => O): (input: I) => O;
|
|
158
|
+
|
|
159
|
+
export { type CancelRunInput as C, INTERCEPTORS_MARKER as I, type MarkedInterceptorsFactory as M, type QueryInput as Q, type ScheduleActivityInput as S, type UpdateInput as U, type WorkflowExecuteInput as W, type ContinueAsNewInput as a, type ScheduleLocalActivityInput as b, type SignalInput as c, type SignalRunInput as d, type StartChildInput as e, type StartTimerInput as f, type UpsertContextInput as g, type UpsertSearchAttributesInput as h, type WorkflowInboundInterceptor as i, type WorkflowInterceptors as j, type WorkflowInterceptorsFactory as k, type WorkflowOutboundInterceptor as l, compose as m, interceptorsFactoryOf as n, resolveWorkflowInterceptors as r, workflowInterceptors as w };
|