@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,122 @@
|
|
|
1
|
+
import { a as Json } from './types-V7jEEUaL.cjs';
|
|
2
|
+
import { s as CommandType, ac as RunEventType } from './types-Bv2i4cBX.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Payload fields and the encoded payload form (C-CMD-C, PLAN-C §3.2, 11 §2.9,
|
|
6
|
+
* §2.30). Pure data, no I/O: it runs inside the isolate as well.
|
|
7
|
+
*
|
|
8
|
+
* `PAYLOAD_FIELDS` names, per event type and per command type, the JSON
|
|
9
|
+
* pointers (relative to the event payload or the command) whose values are
|
|
10
|
+
* user payloads: activity args and results, workflow input and output, signal
|
|
11
|
+
* and update payloads, the memo and side-effect values. Two mechanisms use
|
|
12
|
+
* exactly these pointers and nothing else (CWD14):
|
|
13
|
+
*
|
|
14
|
+
* - a self-hosted worker's payload codec encodes them before anything
|
|
15
|
+
* crosses the bridge, and decodes them on the way back;
|
|
16
|
+
* - the service's at-rest KMS envelope (`kms/envelope`) encrypts them in
|
|
17
|
+
* stored events.
|
|
18
|
+
*
|
|
19
|
+
* Failures nest through `cause` (11 §2.30), so they are not listed as plain
|
|
20
|
+
* pointers: `FAILURE_FIELDS` and `COMMAND_FAILURE_FIELDS` point at failure
|
|
21
|
+
* objects, and the user payload of a failure is its `details` at every level
|
|
22
|
+
* of the `cause` chain. {@link mapEventPayloads} and
|
|
23
|
+
* {@link mapCommandPayloads} apply both lists and are what codecs and the
|
|
24
|
+
* envelope should call.
|
|
25
|
+
*
|
|
26
|
+
* Identifiers (ids, names, node types, task queues), failures other than
|
|
27
|
+
* their `details`, and search attributes stay in clear text, so the service can
|
|
28
|
+
* still match, index and query them. The lists are published as
|
|
29
|
+
* `schema/payload-fields.json` for the Python SDK.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** The key that marks an encoded payload (`{"$fgp":1, encoding, metadata, data}`). */
|
|
33
|
+
declare const ENCODED_PAYLOAD_MARKER = "$fgp";
|
|
34
|
+
/** The version of the encoded payload form. */
|
|
35
|
+
declare const ENCODED_PAYLOAD_VERSION = 1;
|
|
36
|
+
/**
|
|
37
|
+
* Payload encodings (11 §2.30). `json/plain` values are never wrapped; every
|
|
38
|
+
* other encoding is carried as an {@link EncodedPayload}. A worker's payload
|
|
39
|
+
* converter may name its own encoding (for example `binary/protobuf`); the
|
|
40
|
+
* engine treats any encoding other than `json/plain` as opaque.
|
|
41
|
+
*/
|
|
42
|
+
declare const PAYLOAD_ENCODINGS: readonly ["json/plain", "binary/plain", "binary/encrypted", "kms/envelope"];
|
|
43
|
+
type KnownPayloadEncoding = (typeof PAYLOAD_ENCODINGS)[number];
|
|
44
|
+
/**
|
|
45
|
+
* A payload that is not plain JSON: bytes in base64 with their encoding and
|
|
46
|
+
* string metadata (content type, key id, codec name). The engine, the canvas
|
|
47
|
+
* and workflow code treat it as an opaque JSON value; only the codec that wrote
|
|
48
|
+
* it (a worker's codec or the codec server, or the service for `kms/envelope`)
|
|
49
|
+
* reads `data`.
|
|
50
|
+
*/
|
|
51
|
+
interface EncodedPayload {
|
|
52
|
+
$fgp: 1;
|
|
53
|
+
encoding: string;
|
|
54
|
+
metadata?: Record<string, string>;
|
|
55
|
+
/** Base64 (RFC 4648, with padding). */
|
|
56
|
+
data: string;
|
|
57
|
+
}
|
|
58
|
+
/** True when `value` is an {@link EncodedPayload}: exactly its keys, each well formed. */
|
|
59
|
+
declare function isEncodedPayload(value: unknown): value is EncodedPayload;
|
|
60
|
+
/** The encoding of a payload value: its own for an encoded payload, else `json/plain`. */
|
|
61
|
+
declare function payloadEncodingOf(value: Json | undefined): string;
|
|
62
|
+
/**
|
|
63
|
+
* Plain payload pointers per event type (relative to the event payload).
|
|
64
|
+
* Types not listed carry none. Failures are in {@link FAILURE_FIELDS}.
|
|
65
|
+
*/
|
|
66
|
+
declare const PAYLOAD_FIELDS: Readonly<Partial<Record<RunEventType, readonly string[]>>>;
|
|
67
|
+
/**
|
|
68
|
+
* Failure pointers per event type (relative to the event payload): every
|
|
69
|
+
* property of the run-event schema that holds a failure. The payload of a
|
|
70
|
+
* failure is its `details`, and the `details` of each `cause` below it.
|
|
71
|
+
*/
|
|
72
|
+
declare const FAILURE_FIELDS: Readonly<Partial<Record<RunEventType, readonly string[]>>>;
|
|
73
|
+
/** Plain payload pointers per command type (relative to the command). Types not listed carry none. */
|
|
74
|
+
declare const COMMAND_PAYLOAD_FIELDS: Readonly<Partial<Record<CommandType, readonly string[]>>>;
|
|
75
|
+
/** Failure pointers per command type (relative to the command); see {@link FAILURE_FIELDS}. */
|
|
76
|
+
declare const COMMAND_FAILURE_FIELDS: Readonly<Partial<Record<CommandType, readonly string[]>>>;
|
|
77
|
+
/** The payload pointers of a failure object (relative to it), at every level of its cause chain. */
|
|
78
|
+
declare const FAILURE_PAYLOAD_FIELDS: readonly string[];
|
|
79
|
+
/** The pointer of a failure's cause (relative to the failure); the rule applies to it again. */
|
|
80
|
+
declare const FAILURE_CAUSE_FIELD = "/cause";
|
|
81
|
+
/** The format tag of `schema/payload-fields.json`. */
|
|
82
|
+
declare const PAYLOAD_FIELDS_FORMAT = "fluidgrids.payload-fields";
|
|
83
|
+
/** `schema/payload-fields.json`: the pointers and the encoded form, for other SDKs. */
|
|
84
|
+
declare const PAYLOAD_FIELDS_DOCUMENT: {
|
|
85
|
+
readonly format: "fluidgrids.payload-fields";
|
|
86
|
+
readonly formatVersion: 2;
|
|
87
|
+
readonly description: "JSON pointers of user payloads per event type (relative to the payload) and per command type (relative to the command). `events` and `commands` are plain payload pointers. `eventFailures` and `commandFailures` point at failure objects: the payloads of a failure are the `failure.payloads` pointers relative to it, and the same rule applies again to the failure at `failure.cause` (recursively, to the end of the cause chain). Payload codecs and the at-rest envelope apply to these pointers only; everything else stays in clear text. A value that is not plain JSON is carried as {\"$fgp\": 1, \"encoding\", \"metadata\"?, \"data\" (base64)}.";
|
|
88
|
+
readonly encodedMarker: "$fgp";
|
|
89
|
+
readonly encodedVersion: 1;
|
|
90
|
+
readonly encodings: readonly ["json/plain", "binary/plain", "binary/encrypted", "kms/envelope"];
|
|
91
|
+
readonly events: Readonly<Partial<Record<"WORKFLOW_STARTED" | "WORKFLOW_TASK_SCHEDULED" | "WORKFLOW_TASK_STARTED" | "WORKFLOW_TASK_COMPLETED" | "WORKFLOW_TASK_FAILED" | "WORKFLOW_TASK_TIMED_OUT" | "ACTIVITY_SCHEDULED" | "ACTIVITY_STARTED" | "ACTIVITY_HEARTBEAT" | "ACTIVITY_COMPLETED" | "ACTIVITY_FAILED" | "ACTIVITY_TIMED_OUT" | "ACTIVITY_CANCEL_REQUESTED" | "ACTIVITY_CANCELLED" | "ACTIVITY_PAUSED" | "ACTIVITY_UNPAUSED" | "ACTIVITY_RESET" | "ACTIVITY_OPTIONS_UPDATED" | "TIMER_STARTED" | "TIMER_FIRED" | "TIMER_CANCELLED" | "SIGNAL_RECEIVED" | "UPDATE_ADMITTED" | "UPDATE_ACCEPTED" | "UPDATE_COMPLETED" | "CHILD_RUN_INITIATED" | "CHILD_RUN_STARTED" | "CHILD_RUN_COMPLETED" | "CHILD_RUN_FAILED" | "CHILD_RUN_CANCELLED" | "CHILD_RUN_TERMINATED" | "CHILD_RUN_TIMED_OUT" | "EXTERNAL_RUN_CANCEL_REQUESTED" | "EXTERNAL_RUN_CANCEL_RESOLVED" | "EXTERNAL_RUN_SIGNALED" | "SIDE_EFFECT_RECORDED" | "LOCAL_ACTIVITY_COMPLETED" | "LOCAL_ACTIVITY_FAILED" | "SEARCH_ATTRIBUTES_UPSERTED" | "CONTEXT_UPSERTED" | "MARKER_RECORDED" | "WORKFLOW_CANCEL_REQUESTED" | "WORKFLOW_RESET" | "VERSIONING_OVERRIDE_SET" | "WORKFLOW_COMPLETED" | "WORKFLOW_FAILED" | "WORKFLOW_CANCELLED" | "WORKFLOW_TERMINATED" | "WORKFLOW_TIMED_OUT" | "WORKFLOW_CONTINUED_AS_NEW", readonly string[]>>>;
|
|
92
|
+
readonly commands: Readonly<Partial<Record<"SCHEDULE_ACTIVITY" | "REQUEST_CANCEL_ACTIVITY" | "START_TIMER" | "CANCEL_TIMER" | "START_CHILD_RUN" | "SIGNAL_RUN" | "RECORD_SIDE_EFFECT" | "RECORD_MARKER" | "COMPLETE_WORKFLOW" | "FAIL_WORKFLOW" | "CANCEL_WORKFLOW" | "UPSERT_CONTEXT" | "RECORD_LOCAL_ACTIVITY" | "CONTINUE_AS_NEW" | "REQUEST_CANCEL_EXTERNAL_RUN" | "UPSERT_SEARCH_ATTRIBUTES" | "ACCEPT_UPDATE" | "REJECT_UPDATE" | "COMPLETE_UPDATE", readonly string[]>>>;
|
|
93
|
+
readonly eventFailures: Readonly<Partial<Record<"WORKFLOW_STARTED" | "WORKFLOW_TASK_SCHEDULED" | "WORKFLOW_TASK_STARTED" | "WORKFLOW_TASK_COMPLETED" | "WORKFLOW_TASK_FAILED" | "WORKFLOW_TASK_TIMED_OUT" | "ACTIVITY_SCHEDULED" | "ACTIVITY_STARTED" | "ACTIVITY_HEARTBEAT" | "ACTIVITY_COMPLETED" | "ACTIVITY_FAILED" | "ACTIVITY_TIMED_OUT" | "ACTIVITY_CANCEL_REQUESTED" | "ACTIVITY_CANCELLED" | "ACTIVITY_PAUSED" | "ACTIVITY_UNPAUSED" | "ACTIVITY_RESET" | "ACTIVITY_OPTIONS_UPDATED" | "TIMER_STARTED" | "TIMER_FIRED" | "TIMER_CANCELLED" | "SIGNAL_RECEIVED" | "UPDATE_ADMITTED" | "UPDATE_ACCEPTED" | "UPDATE_COMPLETED" | "CHILD_RUN_INITIATED" | "CHILD_RUN_STARTED" | "CHILD_RUN_COMPLETED" | "CHILD_RUN_FAILED" | "CHILD_RUN_CANCELLED" | "CHILD_RUN_TERMINATED" | "CHILD_RUN_TIMED_OUT" | "EXTERNAL_RUN_CANCEL_REQUESTED" | "EXTERNAL_RUN_CANCEL_RESOLVED" | "EXTERNAL_RUN_SIGNALED" | "SIDE_EFFECT_RECORDED" | "LOCAL_ACTIVITY_COMPLETED" | "LOCAL_ACTIVITY_FAILED" | "SEARCH_ATTRIBUTES_UPSERTED" | "CONTEXT_UPSERTED" | "MARKER_RECORDED" | "WORKFLOW_CANCEL_REQUESTED" | "WORKFLOW_RESET" | "VERSIONING_OVERRIDE_SET" | "WORKFLOW_COMPLETED" | "WORKFLOW_FAILED" | "WORKFLOW_CANCELLED" | "WORKFLOW_TERMINATED" | "WORKFLOW_TIMED_OUT" | "WORKFLOW_CONTINUED_AS_NEW", readonly string[]>>>;
|
|
94
|
+
readonly commandFailures: Readonly<Partial<Record<"SCHEDULE_ACTIVITY" | "REQUEST_CANCEL_ACTIVITY" | "START_TIMER" | "CANCEL_TIMER" | "START_CHILD_RUN" | "SIGNAL_RUN" | "RECORD_SIDE_EFFECT" | "RECORD_MARKER" | "COMPLETE_WORKFLOW" | "FAIL_WORKFLOW" | "CANCEL_WORKFLOW" | "UPSERT_CONTEXT" | "RECORD_LOCAL_ACTIVITY" | "CONTINUE_AS_NEW" | "REQUEST_CANCEL_EXTERNAL_RUN" | "UPSERT_SEARCH_ATTRIBUTES" | "ACCEPT_UPDATE" | "REJECT_UPDATE" | "COMPLETE_UPDATE", readonly string[]>>>;
|
|
95
|
+
readonly failure: {
|
|
96
|
+
readonly payloads: readonly string[];
|
|
97
|
+
readonly cause: "/cause";
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Apply `fn` to the value at each payload pointer of `record` that is present,
|
|
102
|
+
* and to the payloads of each failure at `failures` (its `details` at every
|
|
103
|
+
* level of its `cause` chain), returning a copy (the input is not changed).
|
|
104
|
+
* `fn` receives the pointer of the value it is given.
|
|
105
|
+
*/
|
|
106
|
+
declare function mapPayloadFields<T extends Record<string, Json | undefined>>(record: T, pointers: readonly string[], fn: (value: Json, pointer: string) => Json, failures?: readonly string[]): T;
|
|
107
|
+
/**
|
|
108
|
+
* Apply `fn` to every user payload of an event payload of type `type`: the
|
|
109
|
+
* {@link PAYLOAD_FIELDS} pointers and the failures of {@link FAILURE_FIELDS}.
|
|
110
|
+
* This is the call a payload codec or the at-rest envelope makes per event.
|
|
111
|
+
*/
|
|
112
|
+
declare function mapEventPayloads<T extends Record<string, Json | undefined>>(type: RunEventType, payload: T, fn: (value: Json, pointer: string) => Json): T;
|
|
113
|
+
/**
|
|
114
|
+
* Apply `fn` to every user payload of a command: the
|
|
115
|
+
* {@link COMMAND_PAYLOAD_FIELDS} pointers and the failures of
|
|
116
|
+
* {@link COMMAND_FAILURE_FIELDS}.
|
|
117
|
+
*/
|
|
118
|
+
declare function mapCommandPayloads<T extends {
|
|
119
|
+
type: CommandType;
|
|
120
|
+
}>(command: T, fn: (value: Json, pointer: string) => Json): T;
|
|
121
|
+
|
|
122
|
+
export { COMMAND_FAILURE_FIELDS as C, ENCODED_PAYLOAD_MARKER as E, FAILURE_CAUSE_FIELD as F, type KnownPayloadEncoding as K, PAYLOAD_ENCODINGS as P, COMMAND_PAYLOAD_FIELDS as a, ENCODED_PAYLOAD_VERSION as b, type EncodedPayload as c, FAILURE_FIELDS as d, FAILURE_PAYLOAD_FIELDS as e, PAYLOAD_FIELDS as f, PAYLOAD_FIELDS_DOCUMENT as g, PAYLOAD_FIELDS_FORMAT as h, isEncodedPayload as i, mapEventPayloads as j, mapPayloadFields as k, mapCommandPayloads as m, payloadEncodingOf as p };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { a as Json } from './types-V7jEEUaL.js';
|
|
2
|
+
import { s as CommandType, ac as RunEventType } from './types-DGx-b9eq.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Payload fields and the encoded payload form (C-CMD-C, PLAN-C §3.2, 11 §2.9,
|
|
6
|
+
* §2.30). Pure data, no I/O: it runs inside the isolate as well.
|
|
7
|
+
*
|
|
8
|
+
* `PAYLOAD_FIELDS` names, per event type and per command type, the JSON
|
|
9
|
+
* pointers (relative to the event payload or the command) whose values are
|
|
10
|
+
* user payloads: activity args and results, workflow input and output, signal
|
|
11
|
+
* and update payloads, the memo and side-effect values. Two mechanisms use
|
|
12
|
+
* exactly these pointers and nothing else (CWD14):
|
|
13
|
+
*
|
|
14
|
+
* - a self-hosted worker's payload codec encodes them before anything
|
|
15
|
+
* crosses the bridge, and decodes them on the way back;
|
|
16
|
+
* - the service's at-rest KMS envelope (`kms/envelope`) encrypts them in
|
|
17
|
+
* stored events.
|
|
18
|
+
*
|
|
19
|
+
* Failures nest through `cause` (11 §2.30), so they are not listed as plain
|
|
20
|
+
* pointers: `FAILURE_FIELDS` and `COMMAND_FAILURE_FIELDS` point at failure
|
|
21
|
+
* objects, and the user payload of a failure is its `details` at every level
|
|
22
|
+
* of the `cause` chain. {@link mapEventPayloads} and
|
|
23
|
+
* {@link mapCommandPayloads} apply both lists and are what codecs and the
|
|
24
|
+
* envelope should call.
|
|
25
|
+
*
|
|
26
|
+
* Identifiers (ids, names, node types, task queues), failures other than
|
|
27
|
+
* their `details`, and search attributes stay in clear text, so the service can
|
|
28
|
+
* still match, index and query them. The lists are published as
|
|
29
|
+
* `schema/payload-fields.json` for the Python SDK.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** The key that marks an encoded payload (`{"$fgp":1, encoding, metadata, data}`). */
|
|
33
|
+
declare const ENCODED_PAYLOAD_MARKER = "$fgp";
|
|
34
|
+
/** The version of the encoded payload form. */
|
|
35
|
+
declare const ENCODED_PAYLOAD_VERSION = 1;
|
|
36
|
+
/**
|
|
37
|
+
* Payload encodings (11 §2.30). `json/plain` values are never wrapped; every
|
|
38
|
+
* other encoding is carried as an {@link EncodedPayload}. A worker's payload
|
|
39
|
+
* converter may name its own encoding (for example `binary/protobuf`); the
|
|
40
|
+
* engine treats any encoding other than `json/plain` as opaque.
|
|
41
|
+
*/
|
|
42
|
+
declare const PAYLOAD_ENCODINGS: readonly ["json/plain", "binary/plain", "binary/encrypted", "kms/envelope"];
|
|
43
|
+
type KnownPayloadEncoding = (typeof PAYLOAD_ENCODINGS)[number];
|
|
44
|
+
/**
|
|
45
|
+
* A payload that is not plain JSON: bytes in base64 with their encoding and
|
|
46
|
+
* string metadata (content type, key id, codec name). The engine, the canvas
|
|
47
|
+
* and workflow code treat it as an opaque JSON value; only the codec that wrote
|
|
48
|
+
* it (a worker's codec or the codec server, or the service for `kms/envelope`)
|
|
49
|
+
* reads `data`.
|
|
50
|
+
*/
|
|
51
|
+
interface EncodedPayload {
|
|
52
|
+
$fgp: 1;
|
|
53
|
+
encoding: string;
|
|
54
|
+
metadata?: Record<string, string>;
|
|
55
|
+
/** Base64 (RFC 4648, with padding). */
|
|
56
|
+
data: string;
|
|
57
|
+
}
|
|
58
|
+
/** True when `value` is an {@link EncodedPayload}: exactly its keys, each well formed. */
|
|
59
|
+
declare function isEncodedPayload(value: unknown): value is EncodedPayload;
|
|
60
|
+
/** The encoding of a payload value: its own for an encoded payload, else `json/plain`. */
|
|
61
|
+
declare function payloadEncodingOf(value: Json | undefined): string;
|
|
62
|
+
/**
|
|
63
|
+
* Plain payload pointers per event type (relative to the event payload).
|
|
64
|
+
* Types not listed carry none. Failures are in {@link FAILURE_FIELDS}.
|
|
65
|
+
*/
|
|
66
|
+
declare const PAYLOAD_FIELDS: Readonly<Partial<Record<RunEventType, readonly string[]>>>;
|
|
67
|
+
/**
|
|
68
|
+
* Failure pointers per event type (relative to the event payload): every
|
|
69
|
+
* property of the run-event schema that holds a failure. The payload of a
|
|
70
|
+
* failure is its `details`, and the `details` of each `cause` below it.
|
|
71
|
+
*/
|
|
72
|
+
declare const FAILURE_FIELDS: Readonly<Partial<Record<RunEventType, readonly string[]>>>;
|
|
73
|
+
/** Plain payload pointers per command type (relative to the command). Types not listed carry none. */
|
|
74
|
+
declare const COMMAND_PAYLOAD_FIELDS: Readonly<Partial<Record<CommandType, readonly string[]>>>;
|
|
75
|
+
/** Failure pointers per command type (relative to the command); see {@link FAILURE_FIELDS}. */
|
|
76
|
+
declare const COMMAND_FAILURE_FIELDS: Readonly<Partial<Record<CommandType, readonly string[]>>>;
|
|
77
|
+
/** The payload pointers of a failure object (relative to it), at every level of its cause chain. */
|
|
78
|
+
declare const FAILURE_PAYLOAD_FIELDS: readonly string[];
|
|
79
|
+
/** The pointer of a failure's cause (relative to the failure); the rule applies to it again. */
|
|
80
|
+
declare const FAILURE_CAUSE_FIELD = "/cause";
|
|
81
|
+
/** The format tag of `schema/payload-fields.json`. */
|
|
82
|
+
declare const PAYLOAD_FIELDS_FORMAT = "fluidgrids.payload-fields";
|
|
83
|
+
/** `schema/payload-fields.json`: the pointers and the encoded form, for other SDKs. */
|
|
84
|
+
declare const PAYLOAD_FIELDS_DOCUMENT: {
|
|
85
|
+
readonly format: "fluidgrids.payload-fields";
|
|
86
|
+
readonly formatVersion: 2;
|
|
87
|
+
readonly description: "JSON pointers of user payloads per event type (relative to the payload) and per command type (relative to the command). `events` and `commands` are plain payload pointers. `eventFailures` and `commandFailures` point at failure objects: the payloads of a failure are the `failure.payloads` pointers relative to it, and the same rule applies again to the failure at `failure.cause` (recursively, to the end of the cause chain). Payload codecs and the at-rest envelope apply to these pointers only; everything else stays in clear text. A value that is not plain JSON is carried as {\"$fgp\": 1, \"encoding\", \"metadata\"?, \"data\" (base64)}.";
|
|
88
|
+
readonly encodedMarker: "$fgp";
|
|
89
|
+
readonly encodedVersion: 1;
|
|
90
|
+
readonly encodings: readonly ["json/plain", "binary/plain", "binary/encrypted", "kms/envelope"];
|
|
91
|
+
readonly events: Readonly<Partial<Record<"WORKFLOW_STARTED" | "WORKFLOW_TASK_SCHEDULED" | "WORKFLOW_TASK_STARTED" | "WORKFLOW_TASK_COMPLETED" | "WORKFLOW_TASK_FAILED" | "WORKFLOW_TASK_TIMED_OUT" | "ACTIVITY_SCHEDULED" | "ACTIVITY_STARTED" | "ACTIVITY_HEARTBEAT" | "ACTIVITY_COMPLETED" | "ACTIVITY_FAILED" | "ACTIVITY_TIMED_OUT" | "ACTIVITY_CANCEL_REQUESTED" | "ACTIVITY_CANCELLED" | "ACTIVITY_PAUSED" | "ACTIVITY_UNPAUSED" | "ACTIVITY_RESET" | "ACTIVITY_OPTIONS_UPDATED" | "TIMER_STARTED" | "TIMER_FIRED" | "TIMER_CANCELLED" | "SIGNAL_RECEIVED" | "UPDATE_ADMITTED" | "UPDATE_ACCEPTED" | "UPDATE_COMPLETED" | "CHILD_RUN_INITIATED" | "CHILD_RUN_STARTED" | "CHILD_RUN_COMPLETED" | "CHILD_RUN_FAILED" | "CHILD_RUN_CANCELLED" | "CHILD_RUN_TERMINATED" | "CHILD_RUN_TIMED_OUT" | "EXTERNAL_RUN_CANCEL_REQUESTED" | "EXTERNAL_RUN_CANCEL_RESOLVED" | "EXTERNAL_RUN_SIGNALED" | "SIDE_EFFECT_RECORDED" | "LOCAL_ACTIVITY_COMPLETED" | "LOCAL_ACTIVITY_FAILED" | "SEARCH_ATTRIBUTES_UPSERTED" | "CONTEXT_UPSERTED" | "MARKER_RECORDED" | "WORKFLOW_CANCEL_REQUESTED" | "WORKFLOW_RESET" | "VERSIONING_OVERRIDE_SET" | "WORKFLOW_COMPLETED" | "WORKFLOW_FAILED" | "WORKFLOW_CANCELLED" | "WORKFLOW_TERMINATED" | "WORKFLOW_TIMED_OUT" | "WORKFLOW_CONTINUED_AS_NEW", readonly string[]>>>;
|
|
92
|
+
readonly commands: Readonly<Partial<Record<"SCHEDULE_ACTIVITY" | "REQUEST_CANCEL_ACTIVITY" | "START_TIMER" | "CANCEL_TIMER" | "START_CHILD_RUN" | "SIGNAL_RUN" | "RECORD_SIDE_EFFECT" | "RECORD_MARKER" | "COMPLETE_WORKFLOW" | "FAIL_WORKFLOW" | "CANCEL_WORKFLOW" | "UPSERT_CONTEXT" | "RECORD_LOCAL_ACTIVITY" | "CONTINUE_AS_NEW" | "REQUEST_CANCEL_EXTERNAL_RUN" | "UPSERT_SEARCH_ATTRIBUTES" | "ACCEPT_UPDATE" | "REJECT_UPDATE" | "COMPLETE_UPDATE", readonly string[]>>>;
|
|
93
|
+
readonly eventFailures: Readonly<Partial<Record<"WORKFLOW_STARTED" | "WORKFLOW_TASK_SCHEDULED" | "WORKFLOW_TASK_STARTED" | "WORKFLOW_TASK_COMPLETED" | "WORKFLOW_TASK_FAILED" | "WORKFLOW_TASK_TIMED_OUT" | "ACTIVITY_SCHEDULED" | "ACTIVITY_STARTED" | "ACTIVITY_HEARTBEAT" | "ACTIVITY_COMPLETED" | "ACTIVITY_FAILED" | "ACTIVITY_TIMED_OUT" | "ACTIVITY_CANCEL_REQUESTED" | "ACTIVITY_CANCELLED" | "ACTIVITY_PAUSED" | "ACTIVITY_UNPAUSED" | "ACTIVITY_RESET" | "ACTIVITY_OPTIONS_UPDATED" | "TIMER_STARTED" | "TIMER_FIRED" | "TIMER_CANCELLED" | "SIGNAL_RECEIVED" | "UPDATE_ADMITTED" | "UPDATE_ACCEPTED" | "UPDATE_COMPLETED" | "CHILD_RUN_INITIATED" | "CHILD_RUN_STARTED" | "CHILD_RUN_COMPLETED" | "CHILD_RUN_FAILED" | "CHILD_RUN_CANCELLED" | "CHILD_RUN_TERMINATED" | "CHILD_RUN_TIMED_OUT" | "EXTERNAL_RUN_CANCEL_REQUESTED" | "EXTERNAL_RUN_CANCEL_RESOLVED" | "EXTERNAL_RUN_SIGNALED" | "SIDE_EFFECT_RECORDED" | "LOCAL_ACTIVITY_COMPLETED" | "LOCAL_ACTIVITY_FAILED" | "SEARCH_ATTRIBUTES_UPSERTED" | "CONTEXT_UPSERTED" | "MARKER_RECORDED" | "WORKFLOW_CANCEL_REQUESTED" | "WORKFLOW_RESET" | "VERSIONING_OVERRIDE_SET" | "WORKFLOW_COMPLETED" | "WORKFLOW_FAILED" | "WORKFLOW_CANCELLED" | "WORKFLOW_TERMINATED" | "WORKFLOW_TIMED_OUT" | "WORKFLOW_CONTINUED_AS_NEW", readonly string[]>>>;
|
|
94
|
+
readonly commandFailures: Readonly<Partial<Record<"SCHEDULE_ACTIVITY" | "REQUEST_CANCEL_ACTIVITY" | "START_TIMER" | "CANCEL_TIMER" | "START_CHILD_RUN" | "SIGNAL_RUN" | "RECORD_SIDE_EFFECT" | "RECORD_MARKER" | "COMPLETE_WORKFLOW" | "FAIL_WORKFLOW" | "CANCEL_WORKFLOW" | "UPSERT_CONTEXT" | "RECORD_LOCAL_ACTIVITY" | "CONTINUE_AS_NEW" | "REQUEST_CANCEL_EXTERNAL_RUN" | "UPSERT_SEARCH_ATTRIBUTES" | "ACCEPT_UPDATE" | "REJECT_UPDATE" | "COMPLETE_UPDATE", readonly string[]>>>;
|
|
95
|
+
readonly failure: {
|
|
96
|
+
readonly payloads: readonly string[];
|
|
97
|
+
readonly cause: "/cause";
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Apply `fn` to the value at each payload pointer of `record` that is present,
|
|
102
|
+
* and to the payloads of each failure at `failures` (its `details` at every
|
|
103
|
+
* level of its `cause` chain), returning a copy (the input is not changed).
|
|
104
|
+
* `fn` receives the pointer of the value it is given.
|
|
105
|
+
*/
|
|
106
|
+
declare function mapPayloadFields<T extends Record<string, Json | undefined>>(record: T, pointers: readonly string[], fn: (value: Json, pointer: string) => Json, failures?: readonly string[]): T;
|
|
107
|
+
/**
|
|
108
|
+
* Apply `fn` to every user payload of an event payload of type `type`: the
|
|
109
|
+
* {@link PAYLOAD_FIELDS} pointers and the failures of {@link FAILURE_FIELDS}.
|
|
110
|
+
* This is the call a payload codec or the at-rest envelope makes per event.
|
|
111
|
+
*/
|
|
112
|
+
declare function mapEventPayloads<T extends Record<string, Json | undefined>>(type: RunEventType, payload: T, fn: (value: Json, pointer: string) => Json): T;
|
|
113
|
+
/**
|
|
114
|
+
* Apply `fn` to every user payload of a command: the
|
|
115
|
+
* {@link COMMAND_PAYLOAD_FIELDS} pointers and the failures of
|
|
116
|
+
* {@link COMMAND_FAILURE_FIELDS}.
|
|
117
|
+
*/
|
|
118
|
+
declare function mapCommandPayloads<T extends {
|
|
119
|
+
type: CommandType;
|
|
120
|
+
}>(command: T, fn: (value: Json, pointer: string) => Json): T;
|
|
121
|
+
|
|
122
|
+
export { COMMAND_FAILURE_FIELDS as C, ENCODED_PAYLOAD_MARKER as E, FAILURE_CAUSE_FIELD as F, type KnownPayloadEncoding as K, PAYLOAD_ENCODINGS as P, COMMAND_PAYLOAD_FIELDS as a, ENCODED_PAYLOAD_VERSION as b, type EncodedPayload as c, FAILURE_FIELDS as d, FAILURE_PAYLOAD_FIELDS as e, PAYLOAD_FIELDS as f, PAYLOAD_FIELDS_DOCUMENT as g, PAYLOAD_FIELDS_FORMAT as h, isEncodedPayload as i, mapEventPayloads as j, mapPayloadFields as k, mapCommandPayloads as m, payloadEncodingOf as p };
|
package/dist/quickjs/index.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
7
|
-
var
|
|
3
|
+
var chunkODZ2IAR2_cjs = require('../chunk-ODZ2IAR2.cjs');
|
|
4
|
+
require('../chunk-3U2NU7YC.cjs');
|
|
5
|
+
var chunk672KMMBK_cjs = require('../chunk-672KMMBK.cjs');
|
|
6
|
+
require('../chunk-IQPXHQQQ.cjs');
|
|
7
|
+
var chunk54FLQNUM_cjs = require('../chunk-54FLQNUM.cjs');
|
|
8
8
|
require('../chunk-G4UEPUGO.cjs');
|
|
9
9
|
require('../chunk-GVTZMA5C.cjs');
|
|
10
10
|
require('../chunk-QKZL3ONM.cjs');
|
|
11
11
|
require('../chunk-TBDXTV22.cjs');
|
|
12
12
|
var chunkSAENRNBJ_cjs = require('../chunk-SAENRNBJ.cjs');
|
|
13
13
|
require('../chunk-L24YIZY7.cjs');
|
|
14
|
-
require('../chunk-
|
|
14
|
+
require('../chunk-VA4OFR72.cjs');
|
|
15
15
|
require('../chunk-FR7KYWRO.cjs');
|
|
16
|
-
require('../chunk-
|
|
17
|
-
require('../chunk-
|
|
16
|
+
require('../chunk-A5SXCA62.cjs');
|
|
17
|
+
require('../chunk-TYF56RGB.cjs');
|
|
18
18
|
var chunkZ2Y65YOY_cjs = require('../chunk-Z2Y65YOY.cjs');
|
|
19
19
|
var module$1 = require('module');
|
|
20
20
|
var url = require('url');
|
|
@@ -24,7 +24,7 @@ var worker_threads = require('worker_threads');
|
|
|
24
24
|
var QUICKJS_WORKER_SOURCE = '"use strict";\n\nvar import_node_worker_threads = require("node:worker_threads");\n\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\n\nvar DETERMINISM_VIOLATION = "DeterminismViolation";\nvar DETERMINISM_PRELUDE = `(() => {\n const NAME = ${JSON.stringify(DETERMINISM_VIOLATION)};\n const fail = (what) => {\n const error = new Error(\n what + " is not allowed in workflow code: lowering must give the same IR on every build. Read times and random values at run time instead (for example wf.now)."\n );\n error.name = NAME;\n throw error;\n };\n const lock = (target, key, value) =>\n Object.defineProperty(target, key, { value, writable: false, enumerable: false, configurable: false });\n const RealDate = Date;\n const LockedDate = function Date(...args) {\n if (new.target === undefined) return fail("Date()");\n if (args.length === 0) return fail("new Date()");\n return Reflect.construct(RealDate, args, new.target);\n };\n lock(LockedDate, "prototype", RealDate.prototype);\n lock(RealDate.prototype, "constructor", LockedDate);\n lock(LockedDate, "now", function now() { return fail("Date.now()"); });\n lock(LockedDate, "parse", RealDate.parse);\n lock(LockedDate, "UTC", RealDate.UTC);\n lock(globalThis, "Date", LockedDate);\n lock(Math, "random", function random() { return fail("Math.random()"); });\n const crypto = globalThis.crypto;\n if (crypto !== null && typeof crypto === "object") {\n for (const name of ["getRandomValues", "randomUUID"]) {\n if (typeof crypto[name] === "function") lock(crypto, name, function () { return fail("crypto." + name + "()"); });\n }\n }\n const DateTimeFormat = typeof Intl === "object" && Intl !== null ? Intl.DateTimeFormat : undefined;\n if (typeof DateTimeFormat === "function") {\n const proto = DateTimeFormat.prototype;\n const format = Object.getOwnPropertyDescriptor(proto, "format");\n if (format && typeof format.get === "function") {\n const get = format.get;\n Object.defineProperty(proto, "format", {\n get() {\n const bound = get.call(this);\n return (date) => (date === undefined ? fail("Intl.DateTimeFormat format()") : bound(date));\n },\n enumerable: false,\n configurable: false,\n });\n }\n const formatToParts = proto.formatToParts;\n if (typeof formatToParts === "function") {\n lock(proto, "formatToParts", function (date) {\n return date === undefined ? fail("Intl.DateTimeFormat formatToParts()") : formatToParts.call(this, date);\n });\n }\n }\n})();\n`;\nfunction failure(kind, message) {\n return { ok: false, failure: kind, message };\n}\nfunction failureForErrorName(name) {\n return name === DETERMINISM_VIOLATION ? "determinism" : "error";\n}\n\nfunction isQuickJSApi(value) {\n return isRecord(value) && typeof value["newQuickJSWASMModuleFromVariant"] === "function" && typeof value["newVariant"] === "function" && typeof value["shouldInterruptAfterDeadline"] === "function" && value["RELEASE_SYNC"] !== void 0;\n}\nvar WASM_PAGE_BYTES = 64 * 1024;\nvar ENGINE_HEADROOM_BYTES = 32 * 1024 * 1024;\nvar INITIAL_ENGINE_BYTES = 16 * 1024 * 1024;\nfunction describe(ctx, handle) {\n const dumped = ctx.dump(handle);\n if (isRecord(dumped)) {\n const name = typeof dumped["name"] === "string" ? dumped["name"] : "Error";\n const message = dumped["message"];\n return {\n name,\n message: typeof message === "string" ? message : message === void 0 ? JSON.stringify(dumped) : String(message)\n };\n }\n return { name: "Error", message: String(dumped) };\n}\nasync function evaluateInQuickJS(api, code, limits) {\n const maximum = Math.ceil((limits.memoryLimitBytes + ENGINE_HEADROOM_BYTES) / WASM_PAGE_BYTES);\n const initial = Math.min(maximum, INITIAL_ENGINE_BYTES / WASM_PAGE_BYTES);\n const engine = await api.newQuickJSWASMModuleFromVariant(\n api.newVariant(api.RELEASE_SYNC, { wasmMemory: new WebAssembly.Memory({ initial, maximum }) })\n );\n const runtime = engine.newRuntime();\n const deadline = Date.now() + limits.timeoutMs;\n runtime.setMemoryLimit(limits.memoryLimitBytes);\n runtime.setMaxStackSize(limits.maxStackSizeBytes);\n runtime.setInterruptHandler(api.shouldInterruptAfterDeadline(deadline));\n const ctx = runtime.newContext();\n const handles = [];\n const timedOut = () => failure("timeout", `Evaluating the workflow code timed out after ${limits.timeoutMs} ms`);\n const thrown = (handle) => {\n const { name, message } = describe(ctx, handle);\n handle.dispose();\n if (Date.now() > deadline && /interrupted/.test(message)) return timedOut();\n return failure(failureForErrorName(name), message);\n };\n try {\n const prelude = ctx.evalCode(DETERMINISM_PRELUDE, "determinism-prelude.js", { type: "global" });\n if (prelude.error) return thrown(prelude.error);\n prelude.value.dispose();\n const result = ctx.evalCode(code, "workflow-bundle.mjs", { type: "module" });\n if (result.error) return thrown(result.error);\n let namespace = result.value;\n handles.push(namespace);\n const state = ctx.getPromiseState(namespace);\n if (!(state.type === "fulfilled" && state.notAPromise === true)) {\n if (state.type === "fulfilled") state.value.dispose();\n else if (state.type === "rejected") state.error.dispose();\n while (runtime.hasPendingJob()) {\n if (Date.now() > deadline) return timedOut();\n const jobs = runtime.executePendingJobs();\n if (jobs.error) return thrown(jobs.error);\n }\n const settled = ctx.getPromiseState(namespace);\n if (settled.type === "rejected") return thrown(settled.error);\n if (settled.type === "pending")\n return failure("error", "The workflow module never finished evaluating");\n namespace = settled.value;\n handles.push(namespace);\n }\n const exported = ctx.getProp(namespace, "__fluidgrids");\n handles.push(exported);\n if (ctx.typeof(exported) !== "string")\n return failure("no-collection", "The bundle did not export a workflow collection");\n return { ok: true, value: ctx.getString(exported) };\n } catch (error) {\n return failure("error", error instanceof Error ? error.message : String(error));\n } finally {\n for (const handle of handles.reverse()) if (handle.alive) handle.dispose();\n ctx.dispose();\n runtime.dispose();\n }\n}\n\nprocess.on("unhandledRejection", () => void 0);\nasync function main(input) {\n if (!isRecord(input) || typeof input["code"] !== "string" || typeof input["moduleUrl"] !== "string" || !isRecord(input["limits"]))\n return failure("crashed", "The evaluation worker received no bundle");\n const { timeoutMs, memoryLimitBytes, maxStackSizeBytes } = input["limits"];\n if (typeof timeoutMs !== "number" || typeof memoryLimitBytes !== "number" || typeof maxStackSizeBytes !== "number")\n return failure("crashed", "The evaluation worker received no limits");\n const loaded = await import(input["moduleUrl"]);\n const api = isQuickJSApi(loaded) ? loaded : isRecord(loaded) && isQuickJSApi(loaded["default"]) ? loaded["default"] : void 0;\n if (!api) return failure("crashed", "quickjs-emscripten could not be loaded");\n return evaluateInQuickJS(api, input["code"], {\n timeoutMs,\n memoryLimitBytes,\n maxStackSizeBytes\n });\n}\nmain(import_node_worker_threads.workerData).then(\n (outcome) => import_node_worker_threads.parentPort?.postMessage(outcome),\n (error) => import_node_worker_threads.parentPort?.postMessage(\n failure("crashed", error instanceof Error ? error.message : String(error))\n )\n);\n';
|
|
25
25
|
|
|
26
26
|
// src/generated/quickjs-task-worker-source.ts
|
|
27
|
-
var QUICKJS_TASK_WORKER_SOURCE = '"use strict";\n\nvar import_node_worker_threads = require("node:worker_threads");\n\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\n\nfunction isQuickJSApi(value) {\n return isRecord(value) && typeof value["newQuickJSWASMModuleFromVariant"] === "function" && typeof value["newVariant"] === "function" && typeof value["shouldInterruptAfterDeadline"] === "function" && value["RELEASE_SYNC"] !== void 0;\n}\nvar WASM_PAGE_BYTES = 64 * 1024;\nvar ENGINE_HEADROOM_BYTES = 32 * 1024 * 1024;\nvar INITIAL_ENGINE_BYTES = 16 * 1024 * 1024;\n\nvar HISTORY_PROTOCOL = 1;\nvar DEFAULT_HISTORY_LIMIT = { events: 1e4, bytes: 16 * 1024 * 1024 };\n\nvar SHIM_VIOLATION = "DeterminismViolation";\nvar SHIM_HOOK = "__fluidgridsShims";\nvar TASK_PRELUDE = `(() => {\n const NAME = ${JSON.stringify(SHIM_VIOLATION)};\n const fail = (what) => {\n const error = new Error(what + " is not allowed in workflow code: use ctx.now(), ctx.random(), ctx.sleep() or an activity.");\n error.name = NAME;\n throw error;\n };\n let hooks = null;\n const now = (what) => (hooks !== null ? hooks.now() : fail(what + " outside a workflow task"));\n const lock = (target, key, value) =>\n Object.defineProperty(target, key, { value, writable: false, enumerable: false, configurable: false });\n const RealDate = Date;\n // ---- Built-ins that differ between hosts and engines --------------------\n // Local time is UTC whatever the host\'s TZ, locale formatting is fixed\n // (en-US shapes, no ICU), Intl is absent and garbage collection cannot be\n // observed, so QuickJS and vm on any host run workflow code the same way.\n const proto = RealDate.prototype;\n const hostOffset = proto.getTimezoneOffset;\n const realParse = RealDate.parse;\n const isInvalid = (date) => Number.isNaN(proto.getTime.call(date));\n for (const unit of ["FullYear", "Month", "Date", "Day", "Hours", "Minutes", "Seconds", "Milliseconds"]) {\n lock(proto, "get" + unit, proto["getUTC" + unit]);\n if (unit !== "Day") lock(proto, "set" + unit, proto["setUTC" + unit]);\n }\n lock(proto, "getTimezoneOffset", function getTimezoneOffset() { return isInvalid(this) ? NaN : 0; });\n if (typeof proto.getYear === "function")\n lock(proto, "getYear", function getYear() { return isInvalid(this) ? NaN : this.getUTCFullYear() - 1900; });\n if (typeof proto.setYear === "function")\n lock(proto, "setYear", function setYear(value) {\n const year = Number(value);\n if (Number.isNaN(year)) return this.setTime(NaN);\n const whole = Math.trunc(year);\n const base = new RealDate(isInvalid(this) ? 0 : this.getTime());\n base.setUTCFullYear(whole >= 0 && whole <= 99 ? 1900 + whole : whole);\n return this.setTime(base.getTime());\n });\n const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];\n const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];\n const pad = (value, width) => String(value).padStart(width, "0");\n const yearText = (year) => (year < 0 ? "-" + pad(-year, 6) : pad(year, 4));\n const dateText = (d) =>\n DAYS[d.getUTCDay()] + " " + MONTHS[d.getUTCMonth()] + " " + pad(d.getUTCDate(), 2) + " " + yearText(d.getUTCFullYear());\n const timeText = (d) =>\n pad(d.getUTCHours(), 2) + ":" + pad(d.getUTCMinutes(), 2) + ":" + pad(d.getUTCSeconds(), 2) + " GMT+0000 (Coordinated Universal Time)";\n const localeDate = (d) => d.getUTCMonth() + 1 + "/" + d.getUTCDate() + "/" + d.getUTCFullYear();\n const localeTime = (d) => {\n const hours = d.getUTCHours();\n return ((hours + 11) % 12) + 1 + ":" + pad(d.getUTCMinutes(), 2) + ":" + pad(d.getUTCSeconds(), 2) + (hours < 12 ? " AM" : " PM");\n };\n const formatter = (format) => function () { return isInvalid(this) ? "Invalid Date" : format(this); };\n lock(proto, "toString", formatter((d) => dateText(d) + " " + timeText(d)));\n lock(proto, "toDateString", formatter(dateText));\n lock(proto, "toTimeString", formatter(timeText));\n lock(proto, "toLocaleString", formatter((d) => localeDate(d) + ", " + localeTime(d)));\n lock(proto, "toLocaleDateString", formatter(localeDate));\n lock(proto, "toLocaleTimeString", formatter(localeTime));\n // A date-time without an offset is local time to the host\'s parser; read it as UTC.\n const DATE_ONLY = /^[+-]?\\\\d{4,6}(?:-\\\\d{2}(?:-\\\\d{2})?)?$/;\n const ZONE_AFTER_TIME = /\\\\d:\\\\d{2}(?::\\\\d{2}(?:[.,]\\\\d+)?)?\\\\s*(?:[AP]M\\\\s*)?(?:Z|[+-]\\\\d{2}(?::?\\\\d{2})?|[ECMP][SD]T)\\\\s*(?:\\\\([^)]*\\\\))?\\\\s*$/i;\n const NAMED_ZONE = /\\\\b(?:GMT|UTC|UT)\\\\b(?:\\\\s*[+-]\\\\d{2}:?\\\\d{2})?\\\\s*(?:\\\\([^)]*\\\\))?\\\\s*$/i;\n const parse = function parse(value) {\n const text = String(value);\n const time = realParse(text);\n if (Number.isNaN(time)) return time;\n const trimmed = text.trim();\n if (DATE_ONLY.test(trimmed) || ZONE_AFTER_TIME.test(trimmed) || NAMED_ZONE.test(trimmed)) return time;\n return time - hostOffset.call(new RealDate(time)) * 60000;\n };\n const toTimeValue = (value) => {\n if (value instanceof RealDate) return value.getTime();\n let primitive = value;\n if (typeof value === "object" && value !== null) {\n primitive = value.valueOf();\n if (typeof primitive === "object" && primitive !== null) primitive = String(value);\n }\n return typeof primitive === "string" ? parse(primitive) : primitive;\n };\n // ---- Number, string and array locale methods ----------------------------\n const group = (digits) => digits.replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g, ",");\n lock(Number.prototype, "toLocaleString", function toLocaleString() {\n const x = Number.prototype.valueOf.call(this);\n if (Number.isNaN(x)) return "NaN";\n const sign = x < 0 || Object.is(x, -0) ? "-" : "";\n const abs = Math.abs(x);\n if (abs === Infinity) return sign + "\\\\u221e";\n const fixed = abs < 1e21 ? abs.toFixed(3) : BigInt(abs).toString() + ".000";\n const [whole, fraction] = fixed.split(".");\n const kept = fraction.replace(/0+$/, "");\n return sign + group(whole) + (kept === "" ? "" : "." + kept);\n });\n if (typeof BigInt === "function")\n lock(BigInt.prototype, "toLocaleString", function toLocaleString() {\n const text = BigInt.prototype.toString.call(this);\n return text.startsWith("-") ? "-" + group(text.slice(1)) : group(text);\n });\n lock(String.prototype, "localeCompare", function localeCompare(that) {\n const a = String(this);\n const b = String(that);\n return a < b ? -1 : a > b ? 1 : 0;\n });\n lock(String.prototype, "toLocaleUpperCase", function toLocaleUpperCase() { return String(this).toUpperCase(); });\n lock(String.prototype, "toLocaleLowerCase", function toLocaleLowerCase() { return String(this).toLowerCase(); });\n const listLocale = function toLocaleString() {\n return Array.prototype.map.call(this, (item) => (item === null || item === undefined ? "" : item.toLocaleString())).join(",");\n };\n lock(Array.prototype, "toLocaleString", listLocale);\n lock(Object.getPrototypeOf(Uint8Array.prototype), "toLocaleString", listLocale);\n // ---- Absent or refused ---------------------------------------------------\n if (!Reflect.deleteProperty(globalThis, "Intl")) lock(globalThis, "Intl", undefined);\n for (const name of ["WeakRef", "FinalizationRegistry"]) {\n lock(globalThis, name, function () { return fail(name + " (garbage collection is not deterministic)"); });\n }\n const LockedDate = function Date(...args) {\n if (new.target === undefined) return new RealDate(now("Date()")).toString();\n if (args.length === 0) return Reflect.construct(RealDate, [now("new Date()")], new.target);\n if (args.length === 1) return Reflect.construct(RealDate, [toTimeValue(args[0])], new.target);\n return Reflect.construct(RealDate, [RealDate.UTC(...args)], new.target);\n };\n lock(LockedDate, "prototype", RealDate.prototype);\n lock(RealDate.prototype, "constructor", LockedDate);\n lock(LockedDate, "now", function now_() { return now("Date.now()"); });\n lock(LockedDate, "parse", parse);\n lock(LockedDate, "UTC", RealDate.UTC);\n lock(globalThis, "Date", LockedDate);\n lock(Math, "random", function random() {\n return hooks !== null ? hooks.random() : fail("Math.random() outside a workflow task");\n });\n const crypto = globalThis.crypto;\n if (crypto !== null && typeof crypto === "object") {\n if (typeof crypto.getRandomValues === "function")\n lock(crypto, "getRandomValues", function getRandomValues(array) {\n if (hooks === null) return fail("crypto.getRandomValues() outside a workflow task");\n for (let i = 0; i < array.length; i++) array[i] = Math.floor(hooks.random() * 256);\n return array;\n });\n if (typeof crypto.randomUUID === "function")\n lock(crypto, "randomUUID", function randomUUID() { return fail("crypto.randomUUID(): use ctx.uuid()"); });\n }\n for (const name of ["setTimeout", "setInterval", "setImmediate", "clearTimeout", "clearInterval", "clearImmediate"]) {\n lock(globalThis, name, function () { return fail(name + "(): use ctx.sleep()"); });\n }\n for (const name of ["fetch", "XMLHttpRequest", "WebSocket", "EventSource"]) {\n lock(globalThis, name, function () { return fail(name + ": do I/O in an activity (ctx.run)"); });\n }\n Object.defineProperty(globalThis, ${JSON.stringify(SHIM_HOOK)}, {\n value: Object.freeze({\n attach(next) { hooks = next; },\n detach() { hooks = null; },\n }),\n writable: false,\n enumerable: false,\n configurable: true,\n });\n})();\n`;\n\nvar WASM_PAGE_BYTES2 = 64 * 1024;\nvar HOST_STACK_OVERFLOW = /maximum call stack size exceeded|too much recursion/i;\nvar ENGINE_HEADROOM_BYTES2 = 32 * 1024 * 1024;\nvar INITIAL_ENGINE_BYTES2 = 16 * 1024 * 1024;\nasync function createTaskModule(api, memoryLimitBytes) {\n const maximum = Math.ceil((memoryLimitBytes + ENGINE_HEADROOM_BYTES2) / WASM_PAGE_BYTES2);\n const initial = Math.min(maximum, INITIAL_ENGINE_BYTES2 / WASM_PAGE_BYTES2);\n return api.newQuickJSWASMModuleFromVariant(\n api.newVariant(api.RELEASE_SYNC, { wasmMemory: new WebAssembly.Memory({ initial, maximum }) })\n );\n}\nfunction describe(ctx, handle) {\n const dumped = ctx.dump(handle);\n if (isRecord(dumped)) {\n const name = typeof dumped["name"] === "string" ? dumped["name"] : "Error";\n const message = typeof dumped["message"] === "string" ? dumped["message"] : JSON.stringify(dumped);\n return { name, message };\n }\n return { name: "Error", message: String(dumped) };\n}\nvar TaskError = class extends Error {\n constructor(cause, message, fatal = false) {\n super(message);\n this.cause = cause;\n this.fatal = fatal;\n }\n cause;\n fatal;\n};\nfunction runTaskInQuickJS(api, module2, code, requestJson, limits) {\n const disposed = { failed: false };\n const outcome = runTask(api, module2, code, requestJson, limits, disposed);\n return disposed.failed && outcome.fatal !== true ? { ...outcome, fatal: true } : outcome;\n}\nfunction runTask(api, module2, code, requestJson, limits, disposed) {\n let runtime;\n let ctx;\n const handles = [];\n const deadline = Date.now() + limits.timeoutMs;\n try {\n runtime = module2.newRuntime();\n runtime.setMemoryLimit(limits.memoryLimitBytes);\n runtime.setMaxStackSize(limits.maxStackSizeBytes);\n runtime.setInterruptHandler(api.shouldInterruptAfterDeadline(deadline));\n const rt = runtime;\n const context = rt.newContext();\n ctx = context;\n const fail = (handle, during) => {\n const { name, message } = describe(context, handle);\n handle.dispose();\n if (Date.now() > deadline && /interrupted/i.test(message))\n throw new TaskError(\n "TASK_TIMEOUT",\n `The workflow task ran past its ${limits.timeoutMs} ms budget`\n );\n if (/out of memory/i.test(message) || name === "InternalError" && /memory/i.test(message))\n throw new TaskError("ISOLATE_MEMORY", `The workflow task ran out of memory ${during}`);\n if (name === "DeterminismViolation") throw new TaskError("NON_DETERMINISM", message);\n throw new TaskError("WORKFLOW_CODE_ERROR", `${name}: ${message} (${during})`);\n };\n const drain = (during) => {\n while (rt.hasPendingJob()) {\n if (Date.now() > deadline)\n throw new TaskError(\n "TASK_TIMEOUT",\n `The workflow task ran past its ${limits.timeoutMs} ms budget`\n );\n const jobs = rt.executePendingJobs();\n if (jobs.error) fail(jobs.error, during);\n }\n };\n const prelude = context.evalCode(TASK_PRELUDE, "fluidgrids-task-prelude.js", {\n type: "global"\n });\n if (prelude.error) fail(prelude.error, "in the task prelude");\n else prelude.value.dispose();\n const evaluated = context.evalCode(code, "workflow-bundle.mjs", { type: "module" });\n if (evaluated.error) fail(evaluated.error, "while loading the bundle");\n else {\n handles.push(evaluated.value);\n drain("while loading the bundle");\n const state = context.getPromiseState(evaluated.value);\n if (state.type === "rejected") fail(state.error, "while loading the bundle");\n else if (state.type === "fulfilled" && state.notAPromise !== true) state.value.dispose();\n }\n const abi = context.getProp(context.global, "__fluidgridsRuntime");\n handles.push(abi);\n if (context.typeof(abi) !== "object")\n throw new TaskError(\n "INVALID_REQUEST",\n "The bundle has no workflow runtime (build it with @fluidgrids/workflows 2026.1028 or later)"\n );\n const protocol = context.getProp(abi, "protocol");\n const protocolValue = context.dump(protocol);\n protocol.dispose();\n if (protocolValue !== HISTORY_PROTOCOL)\n throw new TaskError(\n "PROTOCOL_MISMATCH",\n `The bundle speaks runtime protocol ${String(protocolValue)}; this host speaks ${HISTORY_PROTOCOL}`\n );\n const call = (name, args) => {\n const fn = context.getProp(abi, name);\n try {\n const result = context.callFunction(fn, abi, ...args);\n if (result.error) return fail(result.error, `in ${name}()`);\n return result.value;\n } finally {\n fn.dispose();\n }\n };\n const request = context.newString(requestJson);\n handles.push(request);\n call("start", [request]).dispose();\n drain("in the workflow code");\n for (; ; ) {\n const step = call("step", []);\n const value = context.dump(step);\n step.dispose();\n drain("in the workflow code");\n if (value !== "more") break;\n }\n const completed = call("complete", []);\n const resultValue = context.dump(completed);\n completed.dispose();\n if (typeof resultValue !== "string")\n throw new TaskError("INTERNAL", "The runtime returned no result");\n return { ok: true, resultJson: resultValue };\n } catch (error) {\n if (error instanceof TaskError)\n return {\n ok: false,\n cause: error.cause,\n message: error.message,\n ...error.fatal ? { fatal: true } : {}\n };\n const message = error instanceof Error ? error.message : String(error);\n if (HOST_STACK_OVERFLOW.test(message))\n return {\n ok: false,\n cause: "WORKFLOW_CODE_ERROR",\n message: `RangeError: stack overflow (the engine\'s host stack ran out: ${message})`,\n fatal: true\n };\n return {\n ok: false,\n cause: /memory|out of bounds|abort/i.test(message) ? "ISOLATE_MEMORY" : "INTERNAL",\n message,\n fatal: true\n };\n } finally {\n for (const handle of handles.reverse()) if (handle.alive) handle.dispose();\n try {\n ctx?.dispose();\n runtime?.dispose();\n } catch {\n disposed.failed = true;\n }\n }\n}\n\nprocess.on("unhandledRejection", () => void 0);\nasync function main(input) {\n const port = import_node_worker_threads.parentPort;\n if (!port) return;\n if (!isRecord(input) || typeof input["moduleUrl"] !== "string" || typeof input["memoryLimitBytes"] !== "number") {\n port.postMessage({ type: "fatal", message: "The task worker received no configuration" });\n return;\n }\n const loaded = await import(input["moduleUrl"]);\n const api = isQuickJSApi(loaded) ? loaded : isRecord(loaded) && isQuickJSApi(loaded["default"]) ? loaded["default"] : void 0;\n if (!api) {\n port.postMessage({ type: "fatal", message: "quickjs-emscripten could not be loaded" });\n return;\n }\n const module2 = await createTaskModule(api, input["memoryLimitBytes"]);\n port.on("message", (message) => {\n if (!isRecord(message) || message["type"] !== "task") return;\n const id = message["id"];\n const limits = message["limits"];\n let outcome;\n if (typeof message["code"] !== "string" || typeof message["requestJson"] !== "string" || !isRecord(limits) || typeof limits["timeoutMs"] !== "number" || typeof limits["memoryLimitBytes"] !== "number" || typeof limits["maxStackSizeBytes"] !== "number")\n outcome = {\n ok: false,\n cause: "INTERNAL",\n message: "The task worker received a malformed task"\n };\n else\n outcome = runTaskInQuickJS(api, module2, message["code"], message["requestJson"], {\n timeoutMs: limits["timeoutMs"],\n memoryLimitBytes: limits["memoryLimitBytes"],\n maxStackSizeBytes: limits["maxStackSizeBytes"]\n });\n port.postMessage({ type: "result", id, outcome });\n if (outcome.fatal === true) process.exit(1);\n });\n port.postMessage({ type: "ready" });\n}\nmain(import_node_worker_threads.workerData).catch((error) => {\n import_node_worker_threads.parentPort?.postMessage({\n type: "fatal",\n message: error instanceof Error ? error.message : String(error)\n });\n});\n';
|
|
27
|
+
var QUICKJS_TASK_WORKER_SOURCE = '"use strict";\n\nvar import_node_worker_threads = require("node:worker_threads");\n\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\n\nfunction isQuickJSApi(value) {\n return isRecord(value) && typeof value["newQuickJSWASMModuleFromVariant"] === "function" && typeof value["newVariant"] === "function" && typeof value["shouldInterruptAfterDeadline"] === "function" && value["RELEASE_SYNC"] !== void 0;\n}\nvar WASM_PAGE_BYTES = 64 * 1024;\nvar ENGINE_HEADROOM_BYTES = 32 * 1024 * 1024;\nvar INITIAL_ENGINE_BYTES = 16 * 1024 * 1024;\n\nvar HISTORY_PROTOCOL = 1;\nvar MAX_HEADERS_BYTES = 16 * 1024;\nvar DEFAULT_HISTORY_LIMIT = { events: 1e4, bytes: 16 * 1024 * 1024 };\n\nvar SHIM_VIOLATION = "DeterminismViolation";\nvar SHIM_HOOK = "__fluidgridsShims";\nvar TASK_PRELUDE = `(() => {\n const NAME = ${JSON.stringify(SHIM_VIOLATION)};\n const fail = (what) => {\n const error = new Error(what + " is not allowed in workflow code: use ctx.now(), ctx.random(), ctx.sleep() or an activity.");\n error.name = NAME;\n throw error;\n };\n let hooks = null;\n const now = (what) => (hooks !== null ? hooks.now() : fail(what + " outside a workflow task"));\n const lock = (target, key, value) =>\n Object.defineProperty(target, key, { value, writable: false, enumerable: false, configurable: false });\n const RealDate = Date;\n // ---- Built-ins that differ between hosts and engines --------------------\n // Local time is UTC whatever the host\'s TZ, locale formatting is fixed\n // (en-US shapes, no ICU), Intl is absent and garbage collection cannot be\n // observed, so QuickJS and vm on any host run workflow code the same way.\n const proto = RealDate.prototype;\n const hostOffset = proto.getTimezoneOffset;\n const realParse = RealDate.parse;\n const isInvalid = (date) => Number.isNaN(proto.getTime.call(date));\n for (const unit of ["FullYear", "Month", "Date", "Day", "Hours", "Minutes", "Seconds", "Milliseconds"]) {\n lock(proto, "get" + unit, proto["getUTC" + unit]);\n if (unit !== "Day") lock(proto, "set" + unit, proto["setUTC" + unit]);\n }\n lock(proto, "getTimezoneOffset", function getTimezoneOffset() { return isInvalid(this) ? NaN : 0; });\n if (typeof proto.getYear === "function")\n lock(proto, "getYear", function getYear() { return isInvalid(this) ? NaN : this.getUTCFullYear() - 1900; });\n if (typeof proto.setYear === "function")\n lock(proto, "setYear", function setYear(value) {\n const year = Number(value);\n if (Number.isNaN(year)) return this.setTime(NaN);\n const whole = Math.trunc(year);\n const base = new RealDate(isInvalid(this) ? 0 : this.getTime());\n base.setUTCFullYear(whole >= 0 && whole <= 99 ? 1900 + whole : whole);\n return this.setTime(base.getTime());\n });\n const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];\n const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];\n const pad = (value, width) => String(value).padStart(width, "0");\n const yearText = (year) => (year < 0 ? "-" + pad(-year, 6) : pad(year, 4));\n const dateText = (d) =>\n DAYS[d.getUTCDay()] + " " + MONTHS[d.getUTCMonth()] + " " + pad(d.getUTCDate(), 2) + " " + yearText(d.getUTCFullYear());\n const timeText = (d) =>\n pad(d.getUTCHours(), 2) + ":" + pad(d.getUTCMinutes(), 2) + ":" + pad(d.getUTCSeconds(), 2) + " GMT+0000 (Coordinated Universal Time)";\n const localeDate = (d) => d.getUTCMonth() + 1 + "/" + d.getUTCDate() + "/" + d.getUTCFullYear();\n const localeTime = (d) => {\n const hours = d.getUTCHours();\n return ((hours + 11) % 12) + 1 + ":" + pad(d.getUTCMinutes(), 2) + ":" + pad(d.getUTCSeconds(), 2) + (hours < 12 ? " AM" : " PM");\n };\n const formatter = (format) => function () { return isInvalid(this) ? "Invalid Date" : format(this); };\n lock(proto, "toString", formatter((d) => dateText(d) + " " + timeText(d)));\n lock(proto, "toDateString", formatter(dateText));\n lock(proto, "toTimeString", formatter(timeText));\n lock(proto, "toLocaleString", formatter((d) => localeDate(d) + ", " + localeTime(d)));\n lock(proto, "toLocaleDateString", formatter(localeDate));\n lock(proto, "toLocaleTimeString", formatter(localeTime));\n // A date-time without an offset is local time to the host\'s parser; read it as UTC.\n const DATE_ONLY = /^[+-]?\\\\d{4,6}(?:-\\\\d{2}(?:-\\\\d{2})?)?$/;\n const ZONE_AFTER_TIME = /\\\\d:\\\\d{2}(?::\\\\d{2}(?:[.,]\\\\d+)?)?\\\\s*(?:[AP]M\\\\s*)?(?:Z|[+-]\\\\d{2}(?::?\\\\d{2})?|[ECMP][SD]T)\\\\s*(?:\\\\([^)]*\\\\))?\\\\s*$/i;\n const NAMED_ZONE = /\\\\b(?:GMT|UTC|UT)\\\\b(?:\\\\s*[+-]\\\\d{2}:?\\\\d{2})?\\\\s*(?:\\\\([^)]*\\\\))?\\\\s*$/i;\n const parse = function parse(value) {\n const text = String(value);\n const time = realParse(text);\n if (Number.isNaN(time)) return time;\n const trimmed = text.trim();\n if (DATE_ONLY.test(trimmed) || ZONE_AFTER_TIME.test(trimmed) || NAMED_ZONE.test(trimmed)) return time;\n return time - hostOffset.call(new RealDate(time)) * 60000;\n };\n const toTimeValue = (value) => {\n if (value instanceof RealDate) return value.getTime();\n let primitive = value;\n if (typeof value === "object" && value !== null) {\n primitive = value.valueOf();\n if (typeof primitive === "object" && primitive !== null) primitive = String(value);\n }\n return typeof primitive === "string" ? parse(primitive) : primitive;\n };\n // ---- Number, string and array locale methods ----------------------------\n const group = (digits) => digits.replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g, ",");\n lock(Number.prototype, "toLocaleString", function toLocaleString() {\n const x = Number.prototype.valueOf.call(this);\n if (Number.isNaN(x)) return "NaN";\n const sign = x < 0 || Object.is(x, -0) ? "-" : "";\n const abs = Math.abs(x);\n if (abs === Infinity) return sign + "\\\\u221e";\n const fixed = abs < 1e21 ? abs.toFixed(3) : BigInt(abs).toString() + ".000";\n const [whole, fraction] = fixed.split(".");\n const kept = fraction.replace(/0+$/, "");\n return sign + group(whole) + (kept === "" ? "" : "." + kept);\n });\n if (typeof BigInt === "function")\n lock(BigInt.prototype, "toLocaleString", function toLocaleString() {\n const text = BigInt.prototype.toString.call(this);\n return text.startsWith("-") ? "-" + group(text.slice(1)) : group(text);\n });\n lock(String.prototype, "localeCompare", function localeCompare(that) {\n const a = String(this);\n const b = String(that);\n return a < b ? -1 : a > b ? 1 : 0;\n });\n lock(String.prototype, "toLocaleUpperCase", function toLocaleUpperCase() { return String(this).toUpperCase(); });\n lock(String.prototype, "toLocaleLowerCase", function toLocaleLowerCase() { return String(this).toLowerCase(); });\n const listLocale = function toLocaleString() {\n return Array.prototype.map.call(this, (item) => (item === null || item === undefined ? "" : item.toLocaleString())).join(",");\n };\n lock(Array.prototype, "toLocaleString", listLocale);\n lock(Object.getPrototypeOf(Uint8Array.prototype), "toLocaleString", listLocale);\n // ---- Absent or refused ---------------------------------------------------\n if (!Reflect.deleteProperty(globalThis, "Intl")) lock(globalThis, "Intl", undefined);\n for (const name of ["WeakRef", "FinalizationRegistry"]) {\n lock(globalThis, name, function () { return fail(name + " (garbage collection is not deterministic)"); });\n }\n const LockedDate = function Date(...args) {\n if (new.target === undefined) return new RealDate(now("Date()")).toString();\n if (args.length === 0) return Reflect.construct(RealDate, [now("new Date()")], new.target);\n if (args.length === 1) return Reflect.construct(RealDate, [toTimeValue(args[0])], new.target);\n return Reflect.construct(RealDate, [RealDate.UTC(...args)], new.target);\n };\n lock(LockedDate, "prototype", RealDate.prototype);\n lock(RealDate.prototype, "constructor", LockedDate);\n lock(LockedDate, "now", function now_() { return now("Date.now()"); });\n lock(LockedDate, "parse", parse);\n lock(LockedDate, "UTC", RealDate.UTC);\n lock(globalThis, "Date", LockedDate);\n lock(Math, "random", function random() {\n return hooks !== null ? hooks.random() : fail("Math.random() outside a workflow task");\n });\n const crypto = globalThis.crypto;\n if (crypto !== null && typeof crypto === "object") {\n if (typeof crypto.getRandomValues === "function")\n lock(crypto, "getRandomValues", function getRandomValues(array) {\n if (hooks === null) return fail("crypto.getRandomValues() outside a workflow task");\n for (let i = 0; i < array.length; i++) array[i] = Math.floor(hooks.random() * 256);\n return array;\n });\n if (typeof crypto.randomUUID === "function")\n lock(crypto, "randomUUID", function randomUUID() { return fail("crypto.randomUUID(): use ctx.uuid()"); });\n }\n for (const name of ["setTimeout", "setInterval", "setImmediate", "clearTimeout", "clearInterval", "clearImmediate"]) {\n lock(globalThis, name, function () { return fail(name + "(): use ctx.sleep()"); });\n }\n for (const name of ["fetch", "XMLHttpRequest", "WebSocket", "EventSource"]) {\n lock(globalThis, name, function () { return fail(name + ": do I/O in an activity (ctx.run)"); });\n }\n Object.defineProperty(globalThis, ${JSON.stringify(SHIM_HOOK)}, {\n value: Object.freeze({\n attach(next) { hooks = next; },\n detach() { hooks = null; },\n }),\n writable: false,\n enumerable: false,\n configurable: true,\n });\n})();\n`;\n\nvar WASM_PAGE_BYTES2 = 64 * 1024;\nvar HOST_STACK_OVERFLOW = /maximum call stack size exceeded|too much recursion/i;\nvar ENGINE_HEADROOM_BYTES2 = 32 * 1024 * 1024;\nvar INITIAL_ENGINE_BYTES2 = 16 * 1024 * 1024;\nasync function createTaskModule(api, memoryLimitBytes) {\n const maximum = Math.ceil((memoryLimitBytes + ENGINE_HEADROOM_BYTES2) / WASM_PAGE_BYTES2);\n const initial = Math.min(maximum, INITIAL_ENGINE_BYTES2 / WASM_PAGE_BYTES2);\n return api.newQuickJSWASMModuleFromVariant(\n api.newVariant(api.RELEASE_SYNC, { wasmMemory: new WebAssembly.Memory({ initial, maximum }) })\n );\n}\nfunction describe(ctx, handle) {\n const dumped = ctx.dump(handle);\n if (isRecord(dumped)) {\n const name = typeof dumped["name"] === "string" ? dumped["name"] : "Error";\n const message = typeof dumped["message"] === "string" ? dumped["message"] : JSON.stringify(dumped);\n return { name, message };\n }\n return { name: "Error", message: String(dumped) };\n}\nvar TaskError = class extends Error {\n constructor(cause, message, fatal = false) {\n super(message);\n this.cause = cause;\n this.fatal = fatal;\n }\n cause;\n fatal;\n};\nfunction runTaskInQuickJS(api, module2, code, requestJson, limits) {\n const disposed = { failed: false };\n const outcome = runTask(api, module2, code, requestJson, limits, disposed);\n return disposed.failed && outcome.fatal !== true ? { ...outcome, fatal: true } : outcome;\n}\nfunction runTask(api, module2, code, requestJson, limits, disposed) {\n let runtime;\n let ctx;\n const handles = [];\n const deadline = Date.now() + limits.timeoutMs;\n try {\n runtime = module2.newRuntime();\n runtime.setMemoryLimit(limits.memoryLimitBytes);\n runtime.setMaxStackSize(limits.maxStackSizeBytes);\n runtime.setInterruptHandler(api.shouldInterruptAfterDeadline(deadline));\n const rt = runtime;\n const context = rt.newContext();\n ctx = context;\n const fail = (handle, during) => {\n const { name, message } = describe(context, handle);\n handle.dispose();\n if (Date.now() > deadline && /interrupted/i.test(message))\n throw new TaskError(\n "TASK_TIMEOUT",\n `The workflow task ran past its ${limits.timeoutMs} ms budget`\n );\n if (/out of memory/i.test(message) || name === "InternalError" && /memory/i.test(message))\n throw new TaskError("ISOLATE_MEMORY", `The workflow task ran out of memory ${during}`);\n if (name === "DeterminismViolation") throw new TaskError("NON_DETERMINISM", message);\n throw new TaskError("WORKFLOW_CODE_ERROR", `${name}: ${message} (${during})`);\n };\n const drain = (during) => {\n while (rt.hasPendingJob()) {\n if (Date.now() > deadline)\n throw new TaskError(\n "TASK_TIMEOUT",\n `The workflow task ran past its ${limits.timeoutMs} ms budget`\n );\n const jobs = rt.executePendingJobs();\n if (jobs.error) fail(jobs.error, during);\n }\n };\n const prelude = context.evalCode(TASK_PRELUDE, "fluidgrids-task-prelude.js", {\n type: "global"\n });\n if (prelude.error) fail(prelude.error, "in the task prelude");\n else prelude.value.dispose();\n const evaluated = context.evalCode(code, "workflow-bundle.mjs", { type: "module" });\n if (evaluated.error) fail(evaluated.error, "while loading the bundle");\n else {\n handles.push(evaluated.value);\n drain("while loading the bundle");\n const state = context.getPromiseState(evaluated.value);\n if (state.type === "rejected") fail(state.error, "while loading the bundle");\n else if (state.type === "fulfilled" && state.notAPromise !== true) state.value.dispose();\n }\n const abi = context.getProp(context.global, "__fluidgridsRuntime");\n handles.push(abi);\n if (context.typeof(abi) !== "object")\n throw new TaskError(\n "INVALID_REQUEST",\n "The bundle has no workflow runtime (build it with @fluidgrids/workflows 2026.1028 or later)"\n );\n const protocol = context.getProp(abi, "protocol");\n const protocolValue = context.dump(protocol);\n protocol.dispose();\n if (protocolValue !== HISTORY_PROTOCOL)\n throw new TaskError(\n "PROTOCOL_MISMATCH",\n `The bundle speaks runtime protocol ${String(protocolValue)}; this host speaks ${HISTORY_PROTOCOL}`\n );\n const call = (name, args) => {\n const fn = context.getProp(abi, name);\n try {\n const result = context.callFunction(fn, abi, ...args);\n if (result.error) return fail(result.error, `in ${name}()`);\n return result.value;\n } finally {\n fn.dispose();\n }\n };\n const request = context.newString(requestJson);\n handles.push(request);\n call("start", [request]).dispose();\n drain("in the workflow code");\n for (; ; ) {\n const step = call("step", []);\n const value = context.dump(step);\n step.dispose();\n drain("in the workflow code");\n if (value !== "more") break;\n }\n const completed = call("complete", []);\n const resultValue = context.dump(completed);\n completed.dispose();\n if (typeof resultValue !== "string")\n throw new TaskError("INTERNAL", "The runtime returned no result");\n return { ok: true, resultJson: resultValue };\n } catch (error) {\n if (error instanceof TaskError)\n return {\n ok: false,\n cause: error.cause,\n message: error.message,\n ...error.fatal ? { fatal: true } : {}\n };\n const message = error instanceof Error ? error.message : String(error);\n if (HOST_STACK_OVERFLOW.test(message))\n return {\n ok: false,\n cause: "WORKFLOW_CODE_ERROR",\n message: `RangeError: stack overflow (the engine\'s host stack ran out: ${message})`,\n fatal: true\n };\n return {\n ok: false,\n cause: /memory|out of bounds|abort/i.test(message) ? "ISOLATE_MEMORY" : "INTERNAL",\n message,\n fatal: true\n };\n } finally {\n for (const handle of handles.reverse()) if (handle.alive) handle.dispose();\n try {\n ctx?.dispose();\n runtime?.dispose();\n } catch {\n disposed.failed = true;\n }\n }\n}\n\nprocess.on("unhandledRejection", () => void 0);\nasync function main(input) {\n const port = import_node_worker_threads.parentPort;\n if (!port) return;\n if (!isRecord(input) || typeof input["moduleUrl"] !== "string" || typeof input["memoryLimitBytes"] !== "number") {\n port.postMessage({ type: "fatal", message: "The task worker received no configuration" });\n return;\n }\n const loaded = await import(input["moduleUrl"]);\n const api = isQuickJSApi(loaded) ? loaded : isRecord(loaded) && isQuickJSApi(loaded["default"]) ? loaded["default"] : void 0;\n if (!api) {\n port.postMessage({ type: "fatal", message: "quickjs-emscripten could not be loaded" });\n return;\n }\n const module2 = await createTaskModule(api, input["memoryLimitBytes"]);\n port.on("message", (message) => {\n if (!isRecord(message) || message["type"] !== "task") return;\n const id = message["id"];\n const limits = message["limits"];\n let outcome;\n if (typeof message["code"] !== "string" || typeof message["requestJson"] !== "string" || !isRecord(limits) || typeof limits["timeoutMs"] !== "number" || typeof limits["memoryLimitBytes"] !== "number" || typeof limits["maxStackSizeBytes"] !== "number")\n outcome = {\n ok: false,\n cause: "INTERNAL",\n message: "The task worker received a malformed task"\n };\n else\n outcome = runTaskInQuickJS(api, module2, message["code"], message["requestJson"], {\n timeoutMs: limits["timeoutMs"],\n memoryLimitBytes: limits["memoryLimitBytes"],\n maxStackSizeBytes: limits["maxStackSizeBytes"]\n });\n port.postMessage({ type: "result", id, outcome });\n if (outcome.fatal === true) process.exit(1);\n });\n port.postMessage({ type: "ready" });\n}\nmain(import_node_worker_threads.workerData).catch((error) => {\n import_node_worker_threads.parentPort?.postMessage({\n type: "fatal",\n message: error instanceof Error ? error.message : String(error)\n });\n});\n';
|
|
28
28
|
|
|
29
29
|
// src/quickjs/task-runner.ts
|
|
30
30
|
var MAX_START_FAILURES = 3;
|
|
@@ -34,7 +34,7 @@ function quickjsModuleUrl() {
|
|
|
34
34
|
}
|
|
35
35
|
function parseResult(outcome) {
|
|
36
36
|
if (!chunkSAENRNBJ_cjs.isRecord(outcome))
|
|
37
|
-
return
|
|
37
|
+
return chunk672KMMBK_cjs.failedTaskResult("INTERNAL", "The task worker returned no outcome");
|
|
38
38
|
const typed = outcome;
|
|
39
39
|
if (typed.ok === true && typeof typed.resultJson === "string") {
|
|
40
40
|
try {
|
|
@@ -43,11 +43,11 @@ function parseResult(outcome) {
|
|
|
43
43
|
return parsed;
|
|
44
44
|
} catch {
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return chunk672KMMBK_cjs.failedTaskResult("INTERNAL", "The runtime returned an invalid result");
|
|
47
47
|
}
|
|
48
48
|
if (typed.ok === false && typeof typed.cause === "string")
|
|
49
|
-
return
|
|
50
|
-
return
|
|
49
|
+
return chunk672KMMBK_cjs.failedTaskResult(typed.cause, String(typed.message));
|
|
50
|
+
return chunk672KMMBK_cjs.failedTaskResult("INTERNAL", "The task worker returned an invalid outcome");
|
|
51
51
|
}
|
|
52
52
|
function createWorkflowTaskRunner(options = {}) {
|
|
53
53
|
const poolSize = Math.max(1, Math.floor(options.poolSize ?? 4));
|
|
@@ -90,7 +90,7 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
90
90
|
if (slots.some((entry) => entry.ready)) return;
|
|
91
91
|
for (const job of queue.splice(0))
|
|
92
92
|
job.resolve(
|
|
93
|
-
|
|
93
|
+
chunk672KMMBK_cjs.failedTaskResult("INTERNAL", `The workflow task threads could not start: ${reason}`)
|
|
94
94
|
);
|
|
95
95
|
};
|
|
96
96
|
const spawn = () => {
|
|
@@ -122,7 +122,7 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
122
122
|
startFailed(slot, String(message["message"]));
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
if (slot.job) finish(slot,
|
|
125
|
+
if (slot.job) finish(slot, chunk672KMMBK_cjs.failedTaskResult("INTERNAL", String(message["message"])));
|
|
126
126
|
replace(slot);
|
|
127
127
|
}
|
|
128
128
|
});
|
|
@@ -132,7 +132,7 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
132
132
|
if (slot.job)
|
|
133
133
|
finish(
|
|
134
134
|
slot,
|
|
135
|
-
|
|
135
|
+
chunk672KMMBK_cjs.failedTaskResult(
|
|
136
136
|
outOfMemory ? "ISOLATE_MEMORY" : "INTERNAL",
|
|
137
137
|
outOfMemory ? "The workflow task ran out of memory" : `The task thread failed: ${error.message}`
|
|
138
138
|
)
|
|
@@ -145,7 +145,7 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
145
145
|
startFailed(slot, "the thread exited while starting");
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
if (slot.job) finish(slot,
|
|
148
|
+
if (slot.job) finish(slot, chunk672KMMBK_cjs.failedTaskResult("INTERNAL", "The task thread exited"));
|
|
149
149
|
replace(slot);
|
|
150
150
|
});
|
|
151
151
|
};
|
|
@@ -160,7 +160,7 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
160
160
|
slot.timer = setTimeout(() => {
|
|
161
161
|
finish(
|
|
162
162
|
slot,
|
|
163
|
-
|
|
163
|
+
chunk672KMMBK_cjs.failedTaskResult(
|
|
164
164
|
"TASK_TIMEOUT",
|
|
165
165
|
`The workflow task ran past its ${job.timeoutMs} ms budget`
|
|
166
166
|
)
|
|
@@ -183,7 +183,7 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
183
183
|
verified.set(buildId, code);
|
|
184
184
|
return true;
|
|
185
185
|
}
|
|
186
|
-
if (
|
|
186
|
+
if (chunk54FLQNUM_cjs.buildIdOf(code) !== buildId) return false;
|
|
187
187
|
verified.delete(buildId);
|
|
188
188
|
verified.set(buildId, code);
|
|
189
189
|
while (verified.size > cacheEntries) {
|
|
@@ -195,19 +195,19 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
195
195
|
};
|
|
196
196
|
return {
|
|
197
197
|
run(bundle, request, runOptions = {}) {
|
|
198
|
-
if (closed) return Promise.resolve(
|
|
198
|
+
if (closed) return Promise.resolve(chunk672KMMBK_cjs.failedTaskResult("INTERNAL", "The task runner is closed"));
|
|
199
199
|
const code = typeof bundle === "string" ? bundle : bundle.code;
|
|
200
200
|
const buildId = typeof bundle === "string" ? void 0 : bundle.buildId;
|
|
201
201
|
if (buildId !== void 0 && !verify(code, buildId))
|
|
202
202
|
return Promise.resolve(
|
|
203
|
-
|
|
203
|
+
chunk672KMMBK_cjs.failedTaskResult("BUNDLE_INTEGRITY", `The bundle does not hash to ${buildId}`)
|
|
204
204
|
);
|
|
205
205
|
let requestJson;
|
|
206
206
|
try {
|
|
207
207
|
requestJson = JSON.stringify(request);
|
|
208
208
|
} catch (error) {
|
|
209
209
|
return Promise.resolve(
|
|
210
|
-
|
|
210
|
+
chunk672KMMBK_cjs.failedTaskResult(
|
|
211
211
|
"INVALID_REQUEST",
|
|
212
212
|
error instanceof Error ? error.message : String(error)
|
|
213
213
|
)
|
|
@@ -227,10 +227,10 @@ function createWorkflowTaskRunner(options = {}) {
|
|
|
227
227
|
async close() {
|
|
228
228
|
closed = true;
|
|
229
229
|
for (const job of queue.splice(0))
|
|
230
|
-
job.resolve(
|
|
230
|
+
job.resolve(chunk672KMMBK_cjs.failedTaskResult("INTERNAL", "The task runner is closed"));
|
|
231
231
|
const all = slots.splice(0);
|
|
232
232
|
for (const slot of all)
|
|
233
|
-
if (slot.job) finish(slot,
|
|
233
|
+
if (slot.job) finish(slot, chunk672KMMBK_cjs.failedTaskResult("INTERNAL", "The task runner is closed"));
|
|
234
234
|
await Promise.all(all.map((slot) => slot.worker.terminate()));
|
|
235
235
|
}
|
|
236
236
|
};
|
|
@@ -241,7 +241,7 @@ function quickjsModuleUrl2() {
|
|
|
241
241
|
try {
|
|
242
242
|
return url.pathToFileURL(module$1.createRequire(chunkZ2Y65YOY_cjs.importMetaUrl).resolve("quickjs-emscripten")).href;
|
|
243
243
|
} catch (error) {
|
|
244
|
-
throw new
|
|
244
|
+
throw new chunkODZ2IAR2_cjs.LowerError(
|
|
245
245
|
`quickjs-emscripten cannot be resolved: ${error instanceof Error ? error.message : String(error)}`,
|
|
246
246
|
"crashed"
|
|
247
247
|
);
|
|
@@ -256,12 +256,12 @@ function createQuickJSEvaluator(options = {}) {
|
|
|
256
256
|
return {
|
|
257
257
|
format: "esm",
|
|
258
258
|
async evaluate(code) {
|
|
259
|
-
const outcome = await
|
|
259
|
+
const outcome = await chunkODZ2IAR2_cjs.runIsolateWorker({
|
|
260
260
|
source: QUICKJS_WORKER_SOURCE,
|
|
261
261
|
workerData: { code, limits, moduleUrl: quickjsModuleUrl2() },
|
|
262
262
|
timeoutMs: limits.timeoutMs
|
|
263
263
|
});
|
|
264
|
-
return
|
|
264
|
+
return chunkODZ2IAR2_cjs.outcomeToCollection(outcome);
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
}
|
package/dist/quickjs/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as Evaluator } from '../lower-
|
|
2
|
-
import {
|
|
1
|
+
import { E as Evaluator } from '../lower-BtRfIW2A.cjs';
|
|
2
|
+
import { az as WorkflowTaskRequest, aA as WorkflowTaskResult } from '../types-Bv2i4cBX.cjs';
|
|
3
3
|
import '../hash-CZkTXPCX.cjs';
|
|
4
|
-
import '../types-
|
|
5
|
-
import '../collect-
|
|
6
|
-
import '../workflow-
|
|
7
|
-
import '../workflow-
|
|
4
|
+
import '../types-V7jEEUaL.cjs';
|
|
5
|
+
import '../collect-CcTCKqx6.cjs';
|
|
6
|
+
import '../workflow-BJPFv3cp.cjs';
|
|
7
|
+
import '../workflow-DS32Gtws.cjs';
|
|
8
8
|
import '../lower-types-DQNBfWQn.cjs';
|
|
9
9
|
import 'esbuild';
|
|
10
10
|
|
package/dist/quickjs/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as Evaluator } from '../lower-
|
|
2
|
-
import {
|
|
1
|
+
import { E as Evaluator } from '../lower-CpsMFOFX.js';
|
|
2
|
+
import { az as WorkflowTaskRequest, aA as WorkflowTaskResult } from '../types-DGx-b9eq.js';
|
|
3
3
|
import '../hash-CZkTXPCX.js';
|
|
4
|
-
import '../types-
|
|
5
|
-
import '../collect-
|
|
6
|
-
import '../workflow-
|
|
7
|
-
import '../workflow-
|
|
4
|
+
import '../types-V7jEEUaL.js';
|
|
5
|
+
import '../collect-6NIEufHd.js';
|
|
6
|
+
import '../workflow-B18OeF7g.js';
|
|
7
|
+
import '../workflow-BGnv8SS6.js';
|
|
8
8
|
import '../lower-types-DQNBfWQn.js';
|
|
9
9
|
import 'esbuild';
|
|
10
10
|
|