@fluidgrids/workflows 0.0.0-stage → 2026.1027.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/LICENSE +9 -0
- package/README.md +187 -2
- package/dist/assemble-BJo9TECS.d.cts +569 -0
- package/dist/assemble-DMOuaxRI.d.ts +569 -0
- package/dist/chunk-265J2FCH.cjs +33 -0
- package/dist/chunk-27HASETB.cjs +250 -0
- package/dist/chunk-4DPEGDPW.js +74 -0
- package/dist/chunk-5LUIDMF4.js +42 -0
- package/dist/chunk-AU3YW7FZ.cjs +279 -0
- package/dist/chunk-BWSLWF2E.js +722 -0
- package/dist/chunk-BYJ7QTLY.cjs +76 -0
- package/dist/chunk-G4UEPUGO.cjs +46 -0
- package/dist/chunk-GO34UHSY.js +95 -0
- package/dist/chunk-IZQNUNSU.cjs +931 -0
- package/dist/chunk-KUTMY2IO.cjs +745 -0
- package/dist/chunk-LMX35GNQ.js +893 -0
- package/dist/chunk-LRM6JXJA.cjs +181 -0
- package/dist/chunk-LSKSBVL4.cjs +102 -0
- package/dist/chunk-LUXCXFOE.cjs +269 -0
- package/dist/chunk-PL73GJR4.js +174 -0
- package/dist/chunk-REV7ZOA4.js +170 -0
- package/dist/chunk-RRQ5HOBF.cjs +185 -0
- package/dist/chunk-S34NJE3A.js +262 -0
- package/dist/chunk-SRQRLWOS.js +31 -0
- package/dist/chunk-SS4LT2IP.js +268 -0
- package/dist/chunk-X4HKU3MX.js +244 -0
- package/dist/codegen/index.cjs +18 -0
- package/dist/codegen/index.d.cts +15 -0
- package/dist/codegen/index.d.ts +15 -0
- package/dist/codegen/index.js +5 -0
- package/dist/expressions-DhHaqyar.d.cts +62 -0
- package/dist/expressions-DhHaqyar.d.ts +62 -0
- package/dist/hash-CZkTXPCX.d.cts +15 -0
- package/dist/hash-CZkTXPCX.d.ts +15 -0
- package/dist/index.cjs +117 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +4 -0
- package/dist/ir/index.cjs +1244 -0
- package/dist/ir/index.d.cts +828 -0
- package/dist/ir/index.d.ts +828 -0
- package/dist/ir/index.js +1120 -0
- package/dist/lower-DcOY8ux0.d.cts +49 -0
- package/dist/lower-Dw5grNrI.d.ts +49 -0
- package/dist/manifest-Bp9ZJlav.d.ts +60 -0
- package/dist/manifest-Duf-gHdO.d.cts +60 -0
- package/dist/node-evaluator-2GTUZVPK.cjs +17 -0
- package/dist/node-evaluator-RMYEWCXZ.js +8 -0
- package/dist/quickjs/index.cjs +92 -0
- package/dist/quickjs/index.d.cts +18 -0
- package/dist/quickjs/index.d.ts +18 -0
- package/dist/quickjs/index.js +90 -0
- package/dist/roundtrip/index.cjs +1375 -0
- package/dist/roundtrip/index.d.cts +287 -0
- package/dist/roundtrip/index.d.ts +287 -0
- package/dist/roundtrip/index.js +1328 -0
- package/dist/types-Dr2Fn1Ax.d.cts +225 -0
- package/dist/types-Dr2Fn1Ax.d.ts +225 -0
- package/package.json +117 -4
- package/schema/ir-v2.schema.json +655 -0
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
import { J as Json, a as JsonObject, m as WorkflowNode, l as WorkflowEdge, d as ConnectionRef, L as LegacyCredentialRef, R as RetryConfig, g as NodeTimeout, f as NodeErrorConfig, e as ExecutionSettings, k as WorkflowConfig, b as WorkflowInterface, j as WorkflowCode, P as Position, i as WorkflowAuthoring, W as WorkflowDefinition } from './types-Dr2Fn1Ax.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Node operation descriptors: what a builder call needs to know about the node
|
|
5
|
+
* it emits. Generated clients (`.fluidgrids/nodes.ts`) are lists of these;
|
|
6
|
+
* the built-in internal nodes and triggers ship here so `nodes.internal.*` and
|
|
7
|
+
* `triggers.*` work without a registry.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** A file reference in node inputs and outputs. */
|
|
11
|
+
interface FileRef {
|
|
12
|
+
fileId: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
mimeType?: string;
|
|
15
|
+
size?: number;
|
|
16
|
+
}
|
|
17
|
+
declare const OPERATION_TYPES: unique symbol;
|
|
18
|
+
/** One node operation. `In` and `Out` type the arguments and the output. */
|
|
19
|
+
interface Operation<In = Record<string, Json>, Out = Json> {
|
|
20
|
+
readonly kind: 'operation';
|
|
21
|
+
readonly nodeType: string;
|
|
22
|
+
/** Written as the node's `version` unless the call overrides it. */
|
|
23
|
+
readonly version?: string;
|
|
24
|
+
/** Written as the node's `operation_name` unless the call overrides it. */
|
|
25
|
+
readonly operation?: string;
|
|
26
|
+
readonly role?: 'trigger';
|
|
27
|
+
/** Type-level only; never present at run time. */
|
|
28
|
+
readonly [OPERATION_TYPES]?: {
|
|
29
|
+
input: In;
|
|
30
|
+
output: Out;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** A trigger operation. */
|
|
34
|
+
type TriggerOperation<In = Record<string, Json>, Out = Json> = Operation<In, Out> & {
|
|
35
|
+
readonly role: 'trigger';
|
|
36
|
+
};
|
|
37
|
+
/** Describe a node operation (generated clients call this). */
|
|
38
|
+
declare function op<In = Record<string, Json>, Out = Json>(nodeType: string, version?: string, operation?: string): Operation<In, Out>;
|
|
39
|
+
/** Describe a trigger operation (generated clients call this). */
|
|
40
|
+
declare function trigger<In = Record<string, Json>, Out = Json>(nodeType: string, version?: string, operation?: string): TriggerOperation<In, Out>;
|
|
41
|
+
/** True for a value made by {@link op} or {@link trigger}. */
|
|
42
|
+
declare function isOperation(value: unknown): value is Operation<unknown, unknown>;
|
|
43
|
+
/** Built-in trigger nodes (`wspace-workflow-svc` `triggers/manifests`). */
|
|
44
|
+
declare const triggers: {
|
|
45
|
+
readonly api: TriggerOperation<Record<string, Json>, Json>;
|
|
46
|
+
readonly manual: TriggerOperation<Record<string, Json>, Json>;
|
|
47
|
+
readonly schedule: TriggerOperation<Record<string, Json>, Json>;
|
|
48
|
+
readonly webhook: TriggerOperation<Record<string, Json>, Json>;
|
|
49
|
+
readonly form: TriggerOperation<Record<string, Json>, Json>;
|
|
50
|
+
readonly errorTrigger: TriggerOperation<Record<string, Json>, Json>;
|
|
51
|
+
readonly workflowCall: TriggerOperation<Record<string, Json>, Json>;
|
|
52
|
+
readonly rssFeed: TriggerOperation<Record<string, Json>, Json>;
|
|
53
|
+
readonly httpPoll: TriggerOperation<Record<string, Json>, Json>;
|
|
54
|
+
readonly databasePoll: TriggerOperation<Record<string, Json>, Json>;
|
|
55
|
+
readonly emailImap: TriggerOperation<Record<string, Json>, Json>;
|
|
56
|
+
readonly fileUpload: TriggerOperation<Record<string, Json>, Json>;
|
|
57
|
+
readonly recordChange: TriggerOperation<Record<string, Json>, Json>;
|
|
58
|
+
readonly stateChange: TriggerOperation<Record<string, Json>, Json>;
|
|
59
|
+
};
|
|
60
|
+
/** Built-in internal nodes (`wspace-workflow-svc` `internalnodes/manifests`, plus the two IR v2 nodes). */
|
|
61
|
+
declare const internalNodes: {
|
|
62
|
+
readonly merge: Operation<Record<string, Json>, Json>;
|
|
63
|
+
readonly if: Operation<Record<string, Json>, Json>;
|
|
64
|
+
readonly switch: Operation<Record<string, Json>, Json>;
|
|
65
|
+
readonly loop: Operation<Record<string, Json>, Json>;
|
|
66
|
+
readonly set: Operation<Record<string, Json>, Json>;
|
|
67
|
+
readonly filter: Operation<Record<string, Json>, Json>;
|
|
68
|
+
readonly aggregate: Operation<Record<string, Json>, Json>;
|
|
69
|
+
readonly wait: Operation<Record<string, Json>, Json>;
|
|
70
|
+
readonly noop: Operation<Record<string, Json>, Json>;
|
|
71
|
+
readonly code: Operation<Record<string, Json>, Json>;
|
|
72
|
+
readonly http: Operation<Record<string, Json>, Json>;
|
|
73
|
+
readonly transform: Operation<Record<string, Json>, Json>;
|
|
74
|
+
readonly validate: Operation<Record<string, Json>, Json>;
|
|
75
|
+
readonly log: Operation<Record<string, Json>, Json>;
|
|
76
|
+
readonly error: Operation<Record<string, Json>, Json>;
|
|
77
|
+
readonly subworkflow: Operation<Record<string, Json>, Json>;
|
|
78
|
+
readonly compareDatasets: Operation<Record<string, Json>, Json>;
|
|
79
|
+
readonly splitOut: Operation<Record<string, Json>, Json>;
|
|
80
|
+
readonly limit: Operation<Record<string, Json>, Json>;
|
|
81
|
+
readonly dedupe: Operation<Record<string, Json>, Json>;
|
|
82
|
+
readonly sort: Operation<Record<string, Json>, Json>;
|
|
83
|
+
readonly dataTable: Operation<Record<string, Json>, Json>;
|
|
84
|
+
readonly respondToWebhook: Operation<Record<string, Json>, Json>;
|
|
85
|
+
readonly sendAndWait: Operation<Record<string, Json>, Json>;
|
|
86
|
+
readonly codeWorkflow: Operation<Record<string, Json>, Json>;
|
|
87
|
+
readonly waitForSignal: Operation<Record<string, Json>, Json>;
|
|
88
|
+
};
|
|
89
|
+
/** Node clients that need no registry: the internal nodes and `custom()`. */
|
|
90
|
+
declare const nodes: {
|
|
91
|
+
readonly internal: {
|
|
92
|
+
readonly merge: Operation<Record<string, Json>, Json>;
|
|
93
|
+
readonly if: Operation<Record<string, Json>, Json>;
|
|
94
|
+
readonly switch: Operation<Record<string, Json>, Json>;
|
|
95
|
+
readonly loop: Operation<Record<string, Json>, Json>;
|
|
96
|
+
readonly set: Operation<Record<string, Json>, Json>;
|
|
97
|
+
readonly filter: Operation<Record<string, Json>, Json>;
|
|
98
|
+
readonly aggregate: Operation<Record<string, Json>, Json>;
|
|
99
|
+
readonly wait: Operation<Record<string, Json>, Json>;
|
|
100
|
+
readonly noop: Operation<Record<string, Json>, Json>;
|
|
101
|
+
readonly code: Operation<Record<string, Json>, Json>;
|
|
102
|
+
readonly http: Operation<Record<string, Json>, Json>;
|
|
103
|
+
readonly transform: Operation<Record<string, Json>, Json>;
|
|
104
|
+
readonly validate: Operation<Record<string, Json>, Json>;
|
|
105
|
+
readonly log: Operation<Record<string, Json>, Json>;
|
|
106
|
+
readonly error: Operation<Record<string, Json>, Json>;
|
|
107
|
+
readonly subworkflow: Operation<Record<string, Json>, Json>;
|
|
108
|
+
readonly compareDatasets: Operation<Record<string, Json>, Json>;
|
|
109
|
+
readonly splitOut: Operation<Record<string, Json>, Json>;
|
|
110
|
+
readonly limit: Operation<Record<string, Json>, Json>;
|
|
111
|
+
readonly dedupe: Operation<Record<string, Json>, Json>;
|
|
112
|
+
readonly sort: Operation<Record<string, Json>, Json>;
|
|
113
|
+
readonly dataTable: Operation<Record<string, Json>, Json>;
|
|
114
|
+
readonly respondToWebhook: Operation<Record<string, Json>, Json>;
|
|
115
|
+
readonly sendAndWait: Operation<Record<string, Json>, Json>;
|
|
116
|
+
readonly codeWorkflow: Operation<Record<string, Json>, Json>;
|
|
117
|
+
readonly waitForSignal: Operation<Record<string, Json>, Json>;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Any node type, including ones the registry snapshot does not know. Typed
|
|
121
|
+
* as JSON in and out.
|
|
122
|
+
*/
|
|
123
|
+
readonly custom: (nodeType: string, operation?: string, version?: string) => Operation<Record<string, Json>, Json>;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Typed references and predicates for the tier-1 builder (spec 02 §3).
|
|
128
|
+
*
|
|
129
|
+
* A reference is a proxy that records a path. Reading a property extends the
|
|
130
|
+
* path; using the reference as an argument value lowers it to
|
|
131
|
+
* `{{ $node["<id>"].item.<path> }}` (or `$json`, `$vars`, `$now`,
|
|
132
|
+
* `$execution`). Calling one of the comparison methods (`gte`, `eq`, …) turns
|
|
133
|
+
* the path before the method name into a condition rule for `internal:if`.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
declare const PREDICATE: unique symbol;
|
|
137
|
+
/** A literal a condition rule can compare against. */
|
|
138
|
+
type RuleValue = string | number | boolean | null;
|
|
139
|
+
/** One rule of a condition tree, as `internal:if` evaluates it. */
|
|
140
|
+
interface ConditionRule {
|
|
141
|
+
type: 'rule';
|
|
142
|
+
field: string;
|
|
143
|
+
operator: string;
|
|
144
|
+
value?: RuleValue;
|
|
145
|
+
}
|
|
146
|
+
/** A group of rules. */
|
|
147
|
+
interface ConditionGroup {
|
|
148
|
+
type: 'group';
|
|
149
|
+
combinator: 'AND' | 'OR';
|
|
150
|
+
children: Array<ConditionRule | ConditionGroup>;
|
|
151
|
+
}
|
|
152
|
+
/** A typed condition: one rule or a group built with {@link and} / {@link or}. */
|
|
153
|
+
interface Predicate {
|
|
154
|
+
readonly [PREDICATE]: ConditionRule | ConditionGroup;
|
|
155
|
+
}
|
|
156
|
+
/** The comparison methods every reference has. */
|
|
157
|
+
interface PredicateMethods {
|
|
158
|
+
eq(value: RuleValue): Predicate;
|
|
159
|
+
neq(value: RuleValue): Predicate;
|
|
160
|
+
gt(value: RuleValue): Predicate;
|
|
161
|
+
gte(value: RuleValue): Predicate;
|
|
162
|
+
lt(value: RuleValue): Predicate;
|
|
163
|
+
lte(value: RuleValue): Predicate;
|
|
164
|
+
contains(value: RuleValue): Predicate;
|
|
165
|
+
notContains(value: RuleValue): Predicate;
|
|
166
|
+
startsWith(value: RuleValue): Predicate;
|
|
167
|
+
endsWith(value: RuleValue): Predicate;
|
|
168
|
+
matches(pattern: string): Predicate;
|
|
169
|
+
hasProperty(name: string): Predicate;
|
|
170
|
+
isEmpty(): Predicate;
|
|
171
|
+
isNotEmpty(): Predicate;
|
|
172
|
+
isNull(): Predicate;
|
|
173
|
+
isNotNull(): Predicate;
|
|
174
|
+
isTrue(): Predicate;
|
|
175
|
+
isFalse(): Predicate;
|
|
176
|
+
/** Any operator the condition tree evaluates, with or without a value. */
|
|
177
|
+
is(operator: string, value?: RuleValue): Predicate;
|
|
178
|
+
}
|
|
179
|
+
/** A reference to a value of unknown shape. Any property is another reference. */
|
|
180
|
+
type AnyRef = {
|
|
181
|
+
readonly [key: string]: AnyRef;
|
|
182
|
+
} & PredicateMethods;
|
|
183
|
+
/** A reference typed by the shape of the value it points at. */
|
|
184
|
+
type OutputRef<T> = AnyRef & (T extends readonly unknown[] ? {
|
|
185
|
+
readonly [index: number]: OutputRef<T[number]>;
|
|
186
|
+
} : T extends object ? {
|
|
187
|
+
readonly [K in keyof T]-?: OutputRef<T[K]>;
|
|
188
|
+
} : unknown);
|
|
189
|
+
/**
|
|
190
|
+
* The operator each method writes. These are the operators the builder's
|
|
191
|
+
* condition editor writes (`fluidgrids-fe-sdk` `condition-builder.tsx`), so a
|
|
192
|
+
* typed condition and one made on the canvas are the same tree.
|
|
193
|
+
*/
|
|
194
|
+
declare const PREDICATE_OPERATORS: Readonly<Record<string, {
|
|
195
|
+
operator: string;
|
|
196
|
+
unary: boolean;
|
|
197
|
+
}>>;
|
|
198
|
+
declare class BuilderError extends Error {
|
|
199
|
+
constructor(message: string);
|
|
200
|
+
}
|
|
201
|
+
/** All conditions must hold. */
|
|
202
|
+
declare function and(...predicates: Predicate[]): Predicate;
|
|
203
|
+
/** At least one condition must hold. */
|
|
204
|
+
declare function or(...predicates: Predicate[]): Predicate;
|
|
205
|
+
/**
|
|
206
|
+
* Tagged template for strings with references:
|
|
207
|
+
* `` expr`New lead: ${enrich.output.person.fullName}` `` lowers to
|
|
208
|
+
* `"New lead: {{ $node[\"enrich\"].item.person.fullName }}"`. Interpolated
|
|
209
|
+
* strings and numbers are inserted as they are.
|
|
210
|
+
*/
|
|
211
|
+
declare function expr(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
212
|
+
|
|
213
|
+
declare const RECORDING_FORMAT = "fluidgrids.tier1-recording";
|
|
214
|
+
declare const RECORDING_FORMAT_VERSION = 1;
|
|
215
|
+
declare const WORKFLOW_MARKER = "fluidgrids.tier1-workflow";
|
|
216
|
+
/** A handle on a node: an output port that edges leave from. */
|
|
217
|
+
interface HandleRef {
|
|
218
|
+
readonly kind: 'handle';
|
|
219
|
+
readonly nodeId: string;
|
|
220
|
+
readonly handle: string;
|
|
221
|
+
}
|
|
222
|
+
/** What `wf.*` returns for a node. */
|
|
223
|
+
interface NodeRef<Out = Json> {
|
|
224
|
+
readonly kind: 'node';
|
|
225
|
+
readonly id: string;
|
|
226
|
+
/** The node's output, as a typed reference. */
|
|
227
|
+
readonly output: OutputRef<Out>;
|
|
228
|
+
/** One of the node's output handles. */
|
|
229
|
+
handle(name: string): HandleRef;
|
|
230
|
+
}
|
|
231
|
+
/** An `internal:if` node. */
|
|
232
|
+
interface IfRef extends NodeRef {
|
|
233
|
+
readonly true: HandleRef;
|
|
234
|
+
readonly false: HandleRef;
|
|
235
|
+
}
|
|
236
|
+
/** An `internal:switch` node. */
|
|
237
|
+
interface SwitchRef extends NodeRef {
|
|
238
|
+
case(handle: string): HandleRef;
|
|
239
|
+
readonly default: HandleRef;
|
|
240
|
+
}
|
|
241
|
+
/** An `internal:loop` node. */
|
|
242
|
+
interface LoopRef extends NodeRef {
|
|
243
|
+
/** The `loop` handle: each batch leaves here. */
|
|
244
|
+
readonly body: HandleRef;
|
|
245
|
+
/** The `done` handle: leaves once every batch is processed. */
|
|
246
|
+
readonly done: HandleRef;
|
|
247
|
+
}
|
|
248
|
+
/** An `internal:validate` node. */
|
|
249
|
+
interface ValidateRef extends NodeRef {
|
|
250
|
+
readonly valid: HandleRef;
|
|
251
|
+
readonly invalid: HandleRef;
|
|
252
|
+
}
|
|
253
|
+
/** An `internal:send-and-wait` node. */
|
|
254
|
+
interface ApprovalRef extends NodeRef {
|
|
255
|
+
readonly approved: HandleRef;
|
|
256
|
+
readonly declined: HandleRef;
|
|
257
|
+
readonly timedOut: HandleRef;
|
|
258
|
+
}
|
|
259
|
+
/** An `internal:wait-for-signal` node. */
|
|
260
|
+
interface SignalWaitRef extends NodeRef {
|
|
261
|
+
readonly received: HandleRef;
|
|
262
|
+
readonly timedOut: HandleRef;
|
|
263
|
+
}
|
|
264
|
+
/** An `internal:compare-datasets` node. */
|
|
265
|
+
interface CompareRef extends NodeRef {
|
|
266
|
+
readonly inAOnly: HandleRef;
|
|
267
|
+
readonly inBOnly: HandleRef;
|
|
268
|
+
readonly same: HandleRef;
|
|
269
|
+
readonly different: HandleRef;
|
|
270
|
+
}
|
|
271
|
+
/** Options of an explicit edge, made with {@link edge}. */
|
|
272
|
+
interface EdgeOptions {
|
|
273
|
+
/** Edge id. Default: `e-<source>-<target>[-<sourceHandle>][-<targetHandle>]`; `false` writes none. */
|
|
274
|
+
id?: string | false;
|
|
275
|
+
/** Edge type. Default `deletable` (what the canvas writes); `false` writes none. */
|
|
276
|
+
type?: string | false;
|
|
277
|
+
targetHandle?: string;
|
|
278
|
+
label?: string;
|
|
279
|
+
data?: JsonObject;
|
|
280
|
+
/** Legacy `${…}` edge mapping, kept verbatim. */
|
|
281
|
+
mapping?: JsonObject;
|
|
282
|
+
/** Other edge fields, copied verbatim. */
|
|
283
|
+
extra?: JsonObject;
|
|
284
|
+
}
|
|
285
|
+
/** Where an edge starts: a node, a handle, or a node id (for nodes declared later). */
|
|
286
|
+
type EdgeSource = NodeRef<unknown> | HandleRef | string;
|
|
287
|
+
/** An incoming edge with options. */
|
|
288
|
+
interface EdgeSpec extends EdgeOptions {
|
|
289
|
+
readonly kind: 'edge';
|
|
290
|
+
readonly from: EdgeSource;
|
|
291
|
+
}
|
|
292
|
+
/** One entry of `after`. */
|
|
293
|
+
type AfterInput = EdgeSource | EdgeSpec;
|
|
294
|
+
/** An incoming edge with options: `after: [edge(prev, { id: 'e1' })]`. */
|
|
295
|
+
declare function edge(from: EdgeSource, options?: EdgeOptions): EdgeSpec;
|
|
296
|
+
/** A value a node argument can hold: JSON, references and nested structures of them. */
|
|
297
|
+
type ArgValue = string | number | boolean | null | AnyRef | readonly ArgValue[] | {
|
|
298
|
+
readonly [key: string]: ArgValue;
|
|
299
|
+
};
|
|
300
|
+
/** Arguments typed by the operation input, open to further keys. */
|
|
301
|
+
type ArgsOf<In> = {
|
|
302
|
+
[K in keyof In]: In[K] | AnyRef | ArgValue;
|
|
303
|
+
} & {
|
|
304
|
+
readonly [key: string]: ArgValue;
|
|
305
|
+
};
|
|
306
|
+
/** Error routing sugar: `stop`, `continue`, or a branch to a node id. */
|
|
307
|
+
type OnErrorOption = 'stop' | 'continue' | {
|
|
308
|
+
branch: string;
|
|
309
|
+
};
|
|
310
|
+
/** Options every node method accepts. */
|
|
311
|
+
interface NodeOptions<In = Record<string, Json>> {
|
|
312
|
+
/** Node id. Required (stable ids keep layout and pinned data across builds). */
|
|
313
|
+
id?: string;
|
|
314
|
+
label?: string;
|
|
315
|
+
after?: AfterInput | readonly AfterInput[];
|
|
316
|
+
args?: ArgsOf<In>;
|
|
317
|
+
/** `operation_name` override; `false` writes none. */
|
|
318
|
+
operation?: string | false;
|
|
319
|
+
/** Node package `version` override; `false` writes none. */
|
|
320
|
+
version?: string | false;
|
|
321
|
+
/** Connection name(s), resolved to connection ids at push time. */
|
|
322
|
+
connection?: string | readonly string[];
|
|
323
|
+
/** Connection references by id, written as they are. */
|
|
324
|
+
connections?: readonly ConnectionRef[];
|
|
325
|
+
/** Legacy credential references (`args.credentials`), written as they are. */
|
|
326
|
+
credentials?: readonly LegacyCredentialRef[];
|
|
327
|
+
/** `args.context`, written as it is. */
|
|
328
|
+
context?: JsonObject;
|
|
329
|
+
retry?: RetryConfig;
|
|
330
|
+
timeout?: NodeTimeout;
|
|
331
|
+
onError?: OnErrorOption;
|
|
332
|
+
/** The whole error policy, written as it is (instead of retry / timeout / onError). */
|
|
333
|
+
errorConfig?: NodeErrorConfig;
|
|
334
|
+
executionSettings?: ExecutionSettings;
|
|
335
|
+
disabled?: boolean;
|
|
336
|
+
/** Other node fields, deep-merged into the node verbatim. */
|
|
337
|
+
extra?: JsonObject;
|
|
338
|
+
}
|
|
339
|
+
/** Options of {@link defineWorkflow}. */
|
|
340
|
+
interface WorkflowOptions {
|
|
341
|
+
key: string;
|
|
342
|
+
name?: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
config?: WorkflowConfig;
|
|
345
|
+
interface?: WorkflowInterface;
|
|
346
|
+
code?: WorkflowCode;
|
|
347
|
+
tags?: readonly Json[];
|
|
348
|
+
meta?: JsonObject;
|
|
349
|
+
/** Derive missing node ids from labels (quick scripts only; `validate --strict` rejects pushes made this way). */
|
|
350
|
+
autoIds?: boolean;
|
|
351
|
+
/** Other top-level fields, deep-merged into the document verbatim. */
|
|
352
|
+
extra?: JsonObject;
|
|
353
|
+
}
|
|
354
|
+
/** A sticky note. */
|
|
355
|
+
interface NoteOptions {
|
|
356
|
+
id: string;
|
|
357
|
+
color?: string;
|
|
358
|
+
/** Place the note above this node. */
|
|
359
|
+
near?: NodeRef<unknown> | string;
|
|
360
|
+
}
|
|
361
|
+
/** One node in a recording. */
|
|
362
|
+
interface RecordedNode {
|
|
363
|
+
node: WorkflowNode;
|
|
364
|
+
connectionNames?: string[];
|
|
365
|
+
}
|
|
366
|
+
/** One sticky note in a recording, placed at assembly. */
|
|
367
|
+
interface RecordedNote {
|
|
368
|
+
note: JsonObject;
|
|
369
|
+
near?: string;
|
|
370
|
+
}
|
|
371
|
+
/** Everything a `defineWorkflow` callback recorded. Plain JSON. */
|
|
372
|
+
interface Tier1Recording {
|
|
373
|
+
format: typeof RECORDING_FORMAT;
|
|
374
|
+
formatVersion: typeof RECORDING_FORMAT_VERSION;
|
|
375
|
+
key: string;
|
|
376
|
+
document: JsonObject;
|
|
377
|
+
nodes: RecordedNode[];
|
|
378
|
+
edges: WorkflowEdge[];
|
|
379
|
+
edgeOrder?: Array<string | number>;
|
|
380
|
+
notes: RecordedNote[];
|
|
381
|
+
}
|
|
382
|
+
/** The value `defineWorkflow` returns. */
|
|
383
|
+
interface Tier1Workflow {
|
|
384
|
+
readonly __fluidgrids: typeof WORKFLOW_MARKER;
|
|
385
|
+
readonly key: string;
|
|
386
|
+
readonly recording: Tier1Recording;
|
|
387
|
+
}
|
|
388
|
+
/** True for a value returned by {@link defineWorkflow}. */
|
|
389
|
+
declare function isTier1Workflow(value: unknown): value is Tier1Workflow;
|
|
390
|
+
/** Default edge id, the scheme the AI draft generator uses. */
|
|
391
|
+
declare function defaultEdgeId(source: string, target: string, sourceHandle?: string, targetHandle?: string): string;
|
|
392
|
+
/** Options of `wf.if`. */
|
|
393
|
+
interface IfOptions extends NodeOptions {
|
|
394
|
+
/** A typed condition (→ `conditionTree`) or a JavaScript condition string (→ `condition`). */
|
|
395
|
+
condition?: Predicate | string;
|
|
396
|
+
}
|
|
397
|
+
/** Options of `wf.switch`. */
|
|
398
|
+
interface SwitchOptions extends NodeOptions {
|
|
399
|
+
/** `switchValue`. */
|
|
400
|
+
value?: ArgValue;
|
|
401
|
+
/** `cases`: case value → handle id. */
|
|
402
|
+
cases?: Readonly<Record<string, string>>;
|
|
403
|
+
}
|
|
404
|
+
/** Options of `wf.loop`. */
|
|
405
|
+
interface LoopOptions extends NodeOptions {
|
|
406
|
+
/** `sourceArray`. */
|
|
407
|
+
items?: ArgValue;
|
|
408
|
+
batchSize?: number;
|
|
409
|
+
}
|
|
410
|
+
/** Options of `wf.merge`. */
|
|
411
|
+
interface MergeOptions extends NodeOptions {
|
|
412
|
+
/** Branches in order; each enters on `input-<n>`. */
|
|
413
|
+
inputs?: readonly EdgeSource[];
|
|
414
|
+
mode?: 'append' | 'combine' | 'multiplex' | 'keepSeparate' | 'chooseBranch' | string;
|
|
415
|
+
}
|
|
416
|
+
/** Options of `wf.waitForSignal`. */
|
|
417
|
+
interface WaitForSignalOptions extends NodeOptions {
|
|
418
|
+
/** `signalName`. */
|
|
419
|
+
name?: string;
|
|
420
|
+
/** `limitWait` as `{ amount, unit }`, or a duration such as `'2d'`. */
|
|
421
|
+
limit?: string | {
|
|
422
|
+
amount: number;
|
|
423
|
+
unit: string;
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/** Options of `wf.subworkflow`. */
|
|
427
|
+
interface SubworkflowOptions extends NodeOptions {
|
|
428
|
+
/** `workflowKey`. */
|
|
429
|
+
key?: string;
|
|
430
|
+
/** The child workflow version (`args.state.version`), distinct from the node package `version`. */
|
|
431
|
+
targetVersion?: string;
|
|
432
|
+
/** `inputMapping`. */
|
|
433
|
+
input?: ArgValue;
|
|
434
|
+
}
|
|
435
|
+
/** The recording builder passed to the `defineWorkflow` callback. */
|
|
436
|
+
declare class WorkflowBuilder {
|
|
437
|
+
private readonly autoIds;
|
|
438
|
+
/** `$json`: the current item's JSON. */
|
|
439
|
+
readonly json: AnyRef;
|
|
440
|
+
/** `$vars`: workflow variables. */
|
|
441
|
+
readonly vars: AnyRef;
|
|
442
|
+
/** `$now`. */
|
|
443
|
+
readonly now: AnyRef;
|
|
444
|
+
/** `$execution`: run metadata. */
|
|
445
|
+
readonly execution: AnyRef;
|
|
446
|
+
private readonly nodes;
|
|
447
|
+
private readonly edges;
|
|
448
|
+
private readonly notes;
|
|
449
|
+
private readonly ids;
|
|
450
|
+
private readonly edgeIds;
|
|
451
|
+
private edgeOrder;
|
|
452
|
+
constructor(autoIds: boolean);
|
|
453
|
+
/** A reference to a node by id, for nodes declared later in the source. */
|
|
454
|
+
ref(id: string): NodeRef;
|
|
455
|
+
/** A trigger node. */
|
|
456
|
+
trigger<In, Out>(operation: Operation<In, Out>, options?: NodeOptions<NoInfer<In>>): NodeRef<Out>;
|
|
457
|
+
/** A store or internal node. */
|
|
458
|
+
step<In, Out>(operation: Operation<In, Out>, options?: NodeOptions<NoInfer<In>>): NodeRef<Out>;
|
|
459
|
+
/** `internal:if`. */
|
|
460
|
+
if(options: IfOptions): IfRef;
|
|
461
|
+
/** `internal:switch`. */
|
|
462
|
+
switch(options: SwitchOptions): SwitchRef;
|
|
463
|
+
/**
|
|
464
|
+
* `internal:loop`. With a body callback, the nodes the callback declares
|
|
465
|
+
* after `batch` form the loop body and the builder adds the return edge from
|
|
466
|
+
* the node the callback returns.
|
|
467
|
+
*/
|
|
468
|
+
loop(options: LoopOptions, body?: (batch: HandleRef) => EdgeSource | undefined): LoopRef;
|
|
469
|
+
/** `internal:merge`. */
|
|
470
|
+
merge(options: MergeOptions): NodeRef;
|
|
471
|
+
/** `internal:wait`. */
|
|
472
|
+
wait(options: NodeOptions): NodeRef;
|
|
473
|
+
/** `internal:wait-for-signal` (IR v2). */
|
|
474
|
+
waitForSignal(options: WaitForSignalOptions): SignalWaitRef;
|
|
475
|
+
/** `internal:send-and-wait`. */
|
|
476
|
+
sendAndWait(options: NodeOptions): ApprovalRef;
|
|
477
|
+
/** `internal:subworkflow`. */
|
|
478
|
+
subworkflow(options: SubworkflowOptions): NodeRef;
|
|
479
|
+
/** `internal:validate`. */
|
|
480
|
+
validate(options: NodeOptions): ValidateRef;
|
|
481
|
+
/** `internal:compare-datasets`. */
|
|
482
|
+
compareDatasets(options: NodeOptions): CompareRef;
|
|
483
|
+
/** `internal:set`. */
|
|
484
|
+
set(options: NodeOptions): NodeRef;
|
|
485
|
+
/** `internal:filter`. */
|
|
486
|
+
filter(options: NodeOptions): NodeRef;
|
|
487
|
+
/** `internal:aggregate`. */
|
|
488
|
+
aggregate(options: NodeOptions): NodeRef;
|
|
489
|
+
/** `internal:split-out`. */
|
|
490
|
+
splitOut(options: NodeOptions): NodeRef;
|
|
491
|
+
/** `internal:limit`. */
|
|
492
|
+
limit(options: NodeOptions): NodeRef;
|
|
493
|
+
/** `internal:dedupe`. */
|
|
494
|
+
dedupe(options: NodeOptions): NodeRef;
|
|
495
|
+
/** `internal:sort`. */
|
|
496
|
+
sort(options: NodeOptions): NodeRef;
|
|
497
|
+
/** `internal:datatable`. */
|
|
498
|
+
dataTable(options: NodeOptions): NodeRef;
|
|
499
|
+
/** `internal:http`. */
|
|
500
|
+
http(options: NodeOptions): NodeRef;
|
|
501
|
+
/** `internal:code`. The code is a string (`args.code`), so it round-trips byte for byte. */
|
|
502
|
+
code(options: NodeOptions): NodeRef;
|
|
503
|
+
/** `internal:transform`. */
|
|
504
|
+
transform(options: NodeOptions): NodeRef;
|
|
505
|
+
/** `internal:log`. */
|
|
506
|
+
log(options: NodeOptions): NodeRef;
|
|
507
|
+
/** `internal:respond-to-webhook`. */
|
|
508
|
+
respondToWebhook(options: NodeOptions): NodeRef;
|
|
509
|
+
/** `internal:error` (stop and error). */
|
|
510
|
+
stopAndError(options: NodeOptions): NodeRef;
|
|
511
|
+
/** `internal:noop`. */
|
|
512
|
+
noop(options: NodeOptions): NodeRef;
|
|
513
|
+
/** A sticky note on the canvas. */
|
|
514
|
+
note(content: string, options: NoteOptions): void;
|
|
515
|
+
/** An edge added outside `after`, for example a loop's return edge. */
|
|
516
|
+
connect(from: EdgeSource, to: NodeRef<unknown> | string, options?: EdgeOptions): void;
|
|
517
|
+
/**
|
|
518
|
+
* Put `data.edges` in this exact order. Each entry names one edge, by id or,
|
|
519
|
+
* for an edge without an id, by its position in declaration order; every edge
|
|
520
|
+
* appears once. The lifter emits this when a stored definition's edge order
|
|
521
|
+
* differs from the order the code declares its edges in.
|
|
522
|
+
*/
|
|
523
|
+
edgeOrderIs(order: ReadonlyArray<string | number>): void;
|
|
524
|
+
/** The recording, once the callback has returned. */
|
|
525
|
+
finish(key: string, document: JsonObject): Tier1Recording;
|
|
526
|
+
private claimId;
|
|
527
|
+
private resolveId;
|
|
528
|
+
private addEdge;
|
|
529
|
+
private add;
|
|
530
|
+
}
|
|
531
|
+
/** Define a tier-1 workflow. The callback runs once, immediately. */
|
|
532
|
+
declare function defineWorkflow(options: WorkflowOptions, build: (wf: WorkflowBuilder) => void): Tier1Workflow;
|
|
533
|
+
|
|
534
|
+
declare const LAYOUT_FORMAT = "fluidgrids.layout";
|
|
535
|
+
declare const LAYOUT_FORMAT_VERSION = 1;
|
|
536
|
+
/**
|
|
537
|
+
* The layout sidecar (`workflows/<key>.layout.json`): canvas positions, sticky
|
|
538
|
+
* notes and `meta.layout`, kept out of the code so it stays readable.
|
|
539
|
+
*/
|
|
540
|
+
interface LayoutSidecar {
|
|
541
|
+
format: typeof LAYOUT_FORMAT;
|
|
542
|
+
formatVersion: typeof LAYOUT_FORMAT_VERSION;
|
|
543
|
+
positions: Record<string, Position>;
|
|
544
|
+
stickyNotes?: JsonObject[];
|
|
545
|
+
metaLayout?: JsonObject;
|
|
546
|
+
}
|
|
547
|
+
/** How connection names in code resolve to connection references. */
|
|
548
|
+
type ConnectionResolver = Readonly<Record<string, ConnectionRef>> | ((name: string) => ConnectionRef | undefined);
|
|
549
|
+
interface AssembleOptions {
|
|
550
|
+
layout?: LayoutSidecar;
|
|
551
|
+
connections?: ConnectionResolver;
|
|
552
|
+
/** TEST-only pinned data (`workflows/<key>.pinned.json`). */
|
|
553
|
+
pinnedData?: JsonObject;
|
|
554
|
+
/** Provenance; defaults to `{ mode: 'canvas', generator: 'sdk-ts', generatorVersion }`. */
|
|
555
|
+
authoring?: WorkflowAuthoring;
|
|
556
|
+
}
|
|
557
|
+
/** Connection names used in code that the target workspace does not have. */
|
|
558
|
+
declare class UnresolvedConnectionsError extends Error {
|
|
559
|
+
readonly names: string[];
|
|
560
|
+
constructor(names: string[]);
|
|
561
|
+
}
|
|
562
|
+
/** Validate a parsed layout sidecar. */
|
|
563
|
+
declare function parseLayoutSidecar(value: unknown): LayoutSidecar;
|
|
564
|
+
/** Assemble IR v2 from a recording. */
|
|
565
|
+
declare function assembleRecording(recording: Tier1Recording, options?: AssembleOptions): WorkflowDefinition;
|
|
566
|
+
/** Lower a tier-1 workflow to IR v2 (spec 10 §1 `toIR`). */
|
|
567
|
+
declare function toIR(workflow: Tier1Workflow, options?: AssembleOptions): WorkflowDefinition;
|
|
568
|
+
|
|
569
|
+
export { defineWorkflow as $, type AfterInput as A, BuilderError as B, type CompareRef as C, type SwitchOptions as D, type EdgeOptions as E, type FileRef as F, type SwitchRef as G, type HandleRef as H, type IfOptions as I, type Tier1Workflow as J, type TriggerOperation as K, LAYOUT_FORMAT as L, type MergeOptions as M, type NodeOptions as N, type OnErrorOption as O, PREDICATE_OPERATORS as P, WorkflowBuilder as Q, RECORDING_FORMAT as R, type SignalWaitRef as S, type Tier1Recording as T, UnresolvedConnectionsError as U, type ValidateRef as V, type WaitForSignalOptions as W, type WorkflowOptions as X, and as Y, assembleRecording as Z, defaultEdgeId as _, type AnyRef as a, edge as a0, expr as a1, internalNodes as a2, isOperation as a3, isTier1Workflow as a4, nodes as a5, op as a6, or as a7, parseLayoutSidecar as a8, toIR as a9, trigger as aa, triggers as ab, type ApprovalRef as b, type ArgValue as c, type ArgsOf as d, type AssembleOptions as e, type ConditionGroup as f, type ConditionRule as g, type ConnectionResolver as h, type EdgeSource as i, type EdgeSpec as j, type IfRef as k, LAYOUT_FORMAT_VERSION as l, type LayoutSidecar as m, type LoopOptions as n, type LoopRef as o, type NodeRef as p, type NoteOptions as q, type Operation as r, type OutputRef as s, type Predicate as t, type PredicateMethods as u, RECORDING_FORMAT_VERSION as v, type RecordedNode as w, type RecordedNote as x, type RuleValue as y, type SubworkflowOptions as z };
|