@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { durationMs } from './chunk-LNUQE6D6.js';
|
|
2
|
-
import { explicitRunRetryPolicy, explicitRetryPolicy } from './chunk-
|
|
2
|
+
import { explicitRunRetryPolicy, explicitRetryPolicy, ACTIVITY_NAME_PATTERN, TASK_QUEUE_NAME_PATTERN } from './chunk-5HIVIV53.js';
|
|
3
3
|
|
|
4
4
|
// src/durable/durations.ts
|
|
5
5
|
function toMs(value, what = "duration") {
|
|
@@ -47,6 +47,17 @@ function workflow(name, optionsOrFn, maybeFn) {
|
|
|
47
47
|
checkRunOptions(name, options);
|
|
48
48
|
return Object.freeze({ __fluidgrids: DURABLE_MARKER, name, options, fn });
|
|
49
49
|
}
|
|
50
|
+
function dynamicWorkflow(name, optionsOrFn, maybeFn) {
|
|
51
|
+
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
52
|
+
const options = typeof optionsOrFn === "function" ? {} : optionsOrFn ?? {};
|
|
53
|
+
if (typeof fn !== "function") throw new TypeError(`dynamicWorkflow("${name}") needs a function`);
|
|
54
|
+
const declared = workflow(
|
|
55
|
+
name,
|
|
56
|
+
options,
|
|
57
|
+
(ctx, input) => fn(ctx, ctx.info.workflowFn, input)
|
|
58
|
+
);
|
|
59
|
+
return Object.freeze({ ...declared, dynamic: true });
|
|
60
|
+
}
|
|
50
61
|
function isDurableWorkflow(value) {
|
|
51
62
|
return typeof value === "object" && value !== null && value.__fluidgrids === DURABLE_MARKER && typeof value.fn === "function";
|
|
52
63
|
}
|
|
@@ -100,6 +111,14 @@ function interfaceOf(definition) {
|
|
|
100
111
|
for (const update of updates)
|
|
101
112
|
out.updates[update.name] = update.description !== void 0 ? { description: update.description } : {};
|
|
102
113
|
}
|
|
114
|
+
const open = definition.options.open;
|
|
115
|
+
if (open !== void 0) {
|
|
116
|
+
const flags = {};
|
|
117
|
+
if (open.signals === true) flags.signals = true;
|
|
118
|
+
if (open.queries === true) flags.queries = true;
|
|
119
|
+
if (open.updates === true) flags.updates = true;
|
|
120
|
+
if (Object.keys(flags).length > 0) out.open = flags;
|
|
121
|
+
}
|
|
103
122
|
return out;
|
|
104
123
|
}
|
|
105
124
|
var RUN_RETRY_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -149,6 +168,126 @@ function continueAsNewRetryOf(retry) {
|
|
|
149
168
|
}
|
|
150
169
|
|
|
151
170
|
// src/generated/version.ts
|
|
152
|
-
var SDK_VERSION = "2026.
|
|
171
|
+
var SDK_VERSION = "2026.1030.1";
|
|
172
|
+
|
|
173
|
+
// src/durable/interceptors.ts
|
|
174
|
+
var INTERCEPTORS_MARKER = "fluidgrids.workflow-interceptors";
|
|
175
|
+
function workflowInterceptors(factory) {
|
|
176
|
+
if (typeof factory !== "function")
|
|
177
|
+
throw new TypeError("workflowInterceptors() needs a factory function");
|
|
178
|
+
return Object.freeze({ __fluidgrids: INTERCEPTORS_MARKER, factory });
|
|
179
|
+
}
|
|
180
|
+
function interceptorsFactoryOf(value) {
|
|
181
|
+
if (typeof value === "function") {
|
|
182
|
+
return value;
|
|
183
|
+
}
|
|
184
|
+
if (typeof value === "object" && value !== null && value.__fluidgrids === INTERCEPTORS_MARKER && typeof value.factory === "function")
|
|
185
|
+
return value.factory;
|
|
186
|
+
return void 0;
|
|
187
|
+
}
|
|
188
|
+
function resolveWorkflowInterceptors(factories) {
|
|
189
|
+
const inbound = [];
|
|
190
|
+
const outbound = [];
|
|
191
|
+
for (const factory of factories) {
|
|
192
|
+
const made = factory();
|
|
193
|
+
if (typeof made !== "object" || made === null)
|
|
194
|
+
throw new TypeError("An interceptors factory must return { inbound?, outbound? }");
|
|
195
|
+
const lists = made;
|
|
196
|
+
if (lists.inbound !== void 0) {
|
|
197
|
+
if (!Array.isArray(lists.inbound))
|
|
198
|
+
throw new TypeError("interceptors.inbound must be an array");
|
|
199
|
+
inbound.push(...lists.inbound);
|
|
200
|
+
}
|
|
201
|
+
if (lists.outbound !== void 0) {
|
|
202
|
+
if (!Array.isArray(lists.outbound))
|
|
203
|
+
throw new TypeError("interceptors.outbound must be an array");
|
|
204
|
+
outbound.push(...lists.outbound);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return { inbound, outbound };
|
|
208
|
+
}
|
|
209
|
+
function compose(interceptors, method, terminal) {
|
|
210
|
+
let next = terminal;
|
|
211
|
+
for (let index = interceptors.length - 1; index >= 0; index--) {
|
|
212
|
+
const interceptor = interceptors[index];
|
|
213
|
+
const fn = interceptor?.[method];
|
|
214
|
+
if (typeof fn !== "function") continue;
|
|
215
|
+
const inner = next;
|
|
216
|
+
const call = fn;
|
|
217
|
+
next = (input) => call.call(interceptor, input, inner);
|
|
218
|
+
}
|
|
219
|
+
return next;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// src/durable/activities.ts
|
|
223
|
+
var ACTIVITY_MARKER = "fluidgrids.activity";
|
|
224
|
+
var ACTIVITY_IMPL_MARKER = "fluidgrids.activity-impl";
|
|
225
|
+
var ACTIVITY_NAME = new RegExp(ACTIVITY_NAME_PATTERN);
|
|
226
|
+
var TASK_QUEUE_NAME = new RegExp(TASK_QUEUE_NAME_PATTERN);
|
|
227
|
+
var DYNAMIC_ACTIVITY_NAME = "*";
|
|
228
|
+
function checkActivityName(name) {
|
|
229
|
+
if (typeof name !== "string" || !ACTIVITY_NAME.test(name))
|
|
230
|
+
throw new TypeError(
|
|
231
|
+
`An activity name must match ${ACTIVITY_NAME_PATTERN} (got "${String(name)}")`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
function checkTaskQueueName(queue, what = "taskQueue") {
|
|
235
|
+
if (typeof queue !== "string" || !TASK_QUEUE_NAME.test(queue))
|
|
236
|
+
throw new TypeError(`${what} must match ${TASK_QUEUE_NAME_PATTERN} (got "${String(queue)}")`);
|
|
237
|
+
}
|
|
238
|
+
function declareActivity(name, options = {}) {
|
|
239
|
+
checkActivityName(name);
|
|
240
|
+
if (options.taskQueue !== void 0) checkTaskQueueName(options.taskQueue);
|
|
241
|
+
return Object.freeze({ __fluidgrids: ACTIVITY_MARKER, name, options: { ...options } });
|
|
242
|
+
}
|
|
243
|
+
function implementActivity(definition, fn) {
|
|
244
|
+
if (!isActivityDefinition(definition))
|
|
245
|
+
throw new TypeError("implementActivity() needs a declareActivity() value");
|
|
246
|
+
if (typeof fn !== "function") throw new TypeError("implementActivity() needs a function");
|
|
247
|
+
return Object.freeze({
|
|
248
|
+
__fluidgrids: ACTIVITY_MARKER,
|
|
249
|
+
name: definition.name,
|
|
250
|
+
options: definition.options,
|
|
251
|
+
implementation: ACTIVITY_IMPL_MARKER,
|
|
252
|
+
fn,
|
|
253
|
+
dynamic: false
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function defineActivity(name, optionsOrFn, maybeFn) {
|
|
257
|
+
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
258
|
+
const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
|
|
259
|
+
if (typeof fn !== "function") throw new TypeError(`defineActivity("${name}") needs a function`);
|
|
260
|
+
return implementActivity(declareActivity(name, options), fn);
|
|
261
|
+
}
|
|
262
|
+
function dynamicActivity(fn, options = {}) {
|
|
263
|
+
if (typeof fn !== "function") throw new TypeError("dynamicActivity() needs a function");
|
|
264
|
+
if (options.taskQueue !== void 0) checkTaskQueueName(options.taskQueue);
|
|
265
|
+
return Object.freeze({
|
|
266
|
+
__fluidgrids: ACTIVITY_MARKER,
|
|
267
|
+
name: DYNAMIC_ACTIVITY_NAME,
|
|
268
|
+
options: { ...options },
|
|
269
|
+
implementation: ACTIVITY_IMPL_MARKER,
|
|
270
|
+
fn,
|
|
271
|
+
dynamic: true
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function isActivityDefinition(value) {
|
|
275
|
+
return typeof value === "object" && value !== null && value.__fluidgrids === ACTIVITY_MARKER && typeof value.name === "string";
|
|
276
|
+
}
|
|
277
|
+
function isActivityImplementation(value) {
|
|
278
|
+
return isActivityDefinition(value) && value.implementation === ACTIVITY_IMPL_MARKER && typeof value.fn === "function";
|
|
279
|
+
}
|
|
280
|
+
function findActivityImplementation(implementations, name) {
|
|
281
|
+
return implementations.find((impl) => !impl.dynamic && impl.name === name) ?? implementations.find((impl) => impl.dynamic);
|
|
282
|
+
}
|
|
283
|
+
function executeActivity(implementation, ctx, args, interceptors = []) {
|
|
284
|
+
const fn = implementation.fn;
|
|
285
|
+
const run = compose(
|
|
286
|
+
interceptors,
|
|
287
|
+
"execute",
|
|
288
|
+
async (input) => fn(ctx, input.args)
|
|
289
|
+
);
|
|
290
|
+
return run({ args, headers: ctx.info.headers, info: ctx.info });
|
|
291
|
+
}
|
|
153
292
|
|
|
154
|
-
export { DURABLE_MARKER, MAX_WORKFLOW_TASK_TIMEOUT_MS, SDK_VERSION, continueAsNewRetryOf, interfaceOf, isDurableWorkflow, jsonSchemaOf, optionalMs, runRetryPolicyOf, toMs, workflow };
|
|
293
|
+
export { ACTIVITY_IMPL_MARKER, ACTIVITY_MARKER, DURABLE_MARKER, DYNAMIC_ACTIVITY_NAME, INTERCEPTORS_MARKER, MAX_WORKFLOW_TASK_TIMEOUT_MS, SDK_VERSION, checkActivityName, checkTaskQueueName, compose, continueAsNewRetryOf, declareActivity, defineActivity, dynamicActivity, dynamicWorkflow, executeActivity, findActivityImplementation, implementActivity, interceptorsFactoryOf, interfaceOf, isActivityDefinition, isActivityImplementation, isDurableWorkflow, jsonSchemaOf, optionalMs, resolveWorkflowInterceptors, runRetryPolicyOf, toMs, workflow, workflowInterceptors };
|