rivetkit 0.0.0-skip-ready-wait-flatten-client-options.1cae221 → 0.0.0-sqlite-uds.4e59a38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.d.ts +561 -89
- package/dist/browser/client.js +1063 -430
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +22 -2
- package/dist/browser/inspector/client.js +1036 -232
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -74
- package/dist/tsup/actor/errors.d.ts +1 -74
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +2218 -2082
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +556 -85
- package/dist/tsup/agent-os/index.d.ts +556 -85
- package/dist/tsup/agent-os/index.js +2220 -2084
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-NFC5VU36.cjs → chunk-3GC3EP6D.cjs} +18 -10
- package/dist/tsup/chunk-3GC3EP6D.cjs.map +1 -0
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-3GLNEWGY.js} +78 -6
- package/dist/tsup/chunk-3GLNEWGY.js.map +1 -0
- package/dist/tsup/{chunk-V3QNBJ7N.cjs → chunk-4FC7TVS6.cjs} +35 -10
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-POTPHU3P.cjs → chunk-62LSMTP2.cjs} +3 -3
- package/dist/tsup/{chunk-POTPHU3P.cjs.map → chunk-62LSMTP2.cjs.map} +1 -1
- package/dist/tsup/{chunk-OIKOPSXQ.js → chunk-7IVUT2JT.js} +12 -4
- package/dist/tsup/chunk-7IVUT2JT.js.map +1 -0
- package/dist/tsup/{chunk-22XU3BVY.cjs → chunk-GEYQLGXC.cjs} +925 -328
- package/dist/tsup/chunk-GEYQLGXC.cjs.map +1 -0
- package/dist/tsup/{chunk-D2TLG75Y.cjs → chunk-GMN45CQ6.cjs} +10 -10
- package/dist/tsup/chunk-GMN45CQ6.cjs.map +1 -0
- package/dist/tsup/{chunk-3BFYSYRU.js → chunk-HXUEHHJF.js} +3 -2
- package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
- package/dist/tsup/{chunk-IOYKCB6Y.cjs → chunk-I336PMWT.cjs} +44 -9
- package/dist/tsup/chunk-I336PMWT.cjs.map +1 -0
- package/dist/tsup/{chunk-RZEJJJKU.js → chunk-IB73AMGJ.js} +42 -7
- package/dist/tsup/chunk-IB73AMGJ.js.map +1 -0
- package/dist/tsup/{chunk-4ZIWB4CQ.js → chunk-ITWJ6Y7G.js} +2 -2
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
- package/dist/tsup/{chunk-W54QCENI.js → chunk-KTNBYGRU.js} +134 -20
- package/dist/tsup/chunk-KTNBYGRU.js.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-OAPVVVTX.cjs} +79 -7
- package/dist/tsup/chunk-OAPVVVTX.cjs.map +1 -0
- package/dist/tsup/{chunk-TPBHXFB2.cjs → chunk-OUDV3ITX.cjs} +138 -24
- package/dist/tsup/chunk-OUDV3ITX.cjs.map +1 -0
- package/dist/tsup/{chunk-XNZR7UD2.cjs → chunk-PRXTIERO.cjs} +90 -65
- package/dist/tsup/chunk-PRXTIERO.cjs.map +1 -0
- package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-VE2X4KMG.cjs} +3 -2
- package/dist/tsup/chunk-VE2X4KMG.cjs.map +1 -0
- package/dist/tsup/{chunk-KSG2COSQ.js → chunk-WRZEVVLL.js} +6 -6
- package/dist/tsup/chunk-WRZEVVLL.js.map +1 -0
- package/dist/tsup/{chunk-LNMB25HW.js → chunk-XAIMHUPG.js} +780 -183
- package/dist/tsup/chunk-XAIMHUPG.js.map +1 -0
- package/dist/tsup/{chunk-D4TSTM6C.js → chunk-XZ62SWSC.js} +83 -58
- package/dist/tsup/chunk-XZ62SWSC.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
- package/dist/tsup/{chunk-K34B3OVG.js → chunk-ZZ3WBRPD.js} +34 -9
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +8 -9
- package/dist/tsup/client/mod.d.ts +8 -9
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-CRdGwwbr.d.cts → config-CxG53eQo.d.cts} +577 -36
- package/dist/tsup/{config-kxXbtrJU.d.ts → config-DLOxy81E.d.cts} +5 -5
- package/dist/tsup/{config-kxXbtrJU.d.cts → config-DLOxy81E.d.ts} +5 -5
- package/dist/tsup/{config-DIpBWm5C.d.ts → config-Ds6DCRhV.d.ts} +577 -36
- package/dist/tsup/context-8KlcOYIs.d.cts +129 -0
- package/dist/tsup/context-Cfbm4QLr.d.ts +129 -0
- package/dist/tsup/db/drizzle.cjs +151 -79
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +2 -2
- package/dist/tsup/db/drizzle.d.ts +2 -2
- package/dist/tsup/db/drizzle.js +151 -79
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +79 -24
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +78 -23
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +37 -0
- package/dist/tsup/dynamic/mod.d.ts +37 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +37 -15
- package/dist/tsup/inspector/mod.d.ts +37 -15
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +240 -0
- package/dist/tsup/inspector-tab/mod.d.ts +240 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +1078 -479
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -6
- package/dist/tsup/mod.d.ts +5 -6
- package/dist/tsup/mod.js +996 -397
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +21 -18
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -5
- package/dist/tsup/test/mod.d.ts +4 -5
- package/dist/tsup/test/mod.js +18 -15
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils-CqDnC_PS.d.cts +104 -0
- package/dist/tsup/utils-CqDnC_PS.d.ts +104 -0
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +386 -322
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -9
- package/dist/tsup/workflow/mod.d.ts +8 -9
- package/dist/tsup/workflow/mod.js +363 -299
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +35 -14
- package/src/actor/config.ts +188 -59
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +17 -19
- package/src/actor/driver.ts +3 -3
- package/src/actor/errors.ts +70 -7
- package/src/actor/instance/mod.ts +39 -56
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +22 -20
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/index.ts +38 -18
- package/src/agent-os/actor/preview.ts +1 -2
- package/src/agent-os/actor/session.ts +2 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/client/actor-common.ts +88 -62
- package/src/client/actor-conn.ts +58 -63
- package/src/client/actor-handle.ts +125 -71
- package/src/client/actor-query.ts +5 -5
- package/src/client/config.ts +3 -3
- package/src/client/errors.ts +2 -1
- package/src/client/lifecycle-errors.ts +2 -4
- package/src/client/query.ts +1 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +10 -10
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +34 -10
- package/src/common/actor-router-consts.ts +7 -4
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/client-protocol/v4.ts +599 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +176 -67
- package/src/common/client-protocol-zod.ts +7 -0
- package/src/common/client-protocol.ts +1 -1
- package/src/common/database/config.ts +16 -5
- package/src/common/database/mod.test.ts +83 -16
- package/src/common/database/mod.ts +86 -30
- package/src/common/database/native-database.test.ts +35 -22
- package/src/common/database/native-database.ts +26 -10
- package/src/common/database/shared.ts +1 -0
- package/src/common/encoding.ts +250 -16
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/log.ts +15 -8
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +10 -202
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.ts +173 -96
- package/src/db/mod.ts +1 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/drivers/engine/actor-driver.ts +76 -73
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +66 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +6 -9
- package/src/engine-client/actor-websocket-client.ts +14 -13
- package/src/engine-client/api-endpoints.ts +51 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +3 -4
- package/src/engine-client/mod.ts +17 -10
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +66 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector-tab/mod.ts +300 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +46 -20
- package/src/registry/index.ts +364 -87
- package/src/registry/napi-runtime.ts +97 -8
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +592 -343
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/runtime.ts +85 -6
- package/src/registry/wasm-runtime.ts +72 -3
- package/src/registry/write-through-proxy.ts +40 -0
- package/src/serde.ts +2 -2
- package/src/serverless/configure.ts +19 -8
- package/src/test/mod.ts +11 -8
- package/src/utils/crypto.ts +14 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +37 -0
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +1 -2
- package/src/workflow/context.ts +703 -240
- package/src/workflow/driver.ts +23 -12
- package/src/workflow/inspector.ts +12 -3
- package/src/workflow/mod.ts +37 -23
- package/dist/tsup/chunk-22XU3BVY.cjs.map +0 -1
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
- package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
- package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
- package/dist/tsup/chunk-D2TLG75Y.cjs.map +0 -1
- package/dist/tsup/chunk-D4TSTM6C.js.map +0 -1
- package/dist/tsup/chunk-IOYKCB6Y.cjs.map +0 -1
- package/dist/tsup/chunk-K34B3OVG.js.map +0 -1
- package/dist/tsup/chunk-KSG2COSQ.js.map +0 -1
- package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
- package/dist/tsup/chunk-LNMB25HW.js.map +0 -1
- package/dist/tsup/chunk-NFC5VU36.cjs.map +0 -1
- package/dist/tsup/chunk-OIKOPSXQ.js.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-RZEJJJKU.js.map +0 -1
- package/dist/tsup/chunk-TPBHXFB2.cjs.map +0 -1
- package/dist/tsup/chunk-V3QNBJ7N.cjs.map +0 -1
- package/dist/tsup/chunk-W54QCENI.js.map +0 -1
- package/dist/tsup/chunk-XNZR7UD2.cjs.map +0 -1
- package/dist/tsup/context-B7G6sk7x.d.ts +0 -92
- package/dist/tsup/context-DzMRHkjC.d.cts +0 -92
- package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
- package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-4ZIWB4CQ.js.map → chunk-ITWJ6Y7G.js.map} +0 -0
|
@@ -1,697 +1,849 @@
|
|
|
1
1
|
// Vendored BARE codec. Keep the wire format compatible with the existing runtime.
|
|
2
|
-
import * as bare from "@rivetkit/bare-ts"
|
|
2
|
+
import * as bare from "@rivetkit/bare-ts";
|
|
3
3
|
|
|
4
|
-
const config = /* @__PURE__ */ bare.Config({})
|
|
4
|
+
const config = /* @__PURE__ */ bare.Config({});
|
|
5
5
|
|
|
6
|
-
export type u32 = number
|
|
7
|
-
export type u64 = bigint
|
|
6
|
+
export type u32 = number;
|
|
7
|
+
export type u64 = bigint;
|
|
8
8
|
|
|
9
|
-
export type WorkflowCbor = ArrayBuffer
|
|
9
|
+
export type WorkflowCbor = ArrayBuffer;
|
|
10
10
|
|
|
11
11
|
export function readWorkflowCbor(bc: bare.ByteCursor): WorkflowCbor {
|
|
12
|
-
|
|
12
|
+
return bare.readData(bc);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function writeWorkflowCbor(bc: bare.ByteCursor, x: WorkflowCbor): void {
|
|
16
|
-
|
|
16
|
+
bare.writeData(bc, x);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export type WorkflowNameIndex = u32
|
|
19
|
+
export type WorkflowNameIndex = u32;
|
|
20
20
|
|
|
21
21
|
export function readWorkflowNameIndex(bc: bare.ByteCursor): WorkflowNameIndex {
|
|
22
|
-
|
|
22
|
+
return bare.readU32(bc);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function writeWorkflowNameIndex(
|
|
26
|
-
|
|
25
|
+
export function writeWorkflowNameIndex(
|
|
26
|
+
bc: bare.ByteCursor,
|
|
27
|
+
x: WorkflowNameIndex,
|
|
28
|
+
): void {
|
|
29
|
+
bare.writeU32(bc, x);
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
export type WorkflowLoopIterationMarker = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
+
readonly loop: WorkflowNameIndex;
|
|
34
|
+
readonly iteration: u32;
|
|
35
|
+
};
|
|
33
36
|
|
|
34
|
-
export function readWorkflowLoopIterationMarker(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
export function readWorkflowLoopIterationMarker(
|
|
38
|
+
bc: bare.ByteCursor,
|
|
39
|
+
): WorkflowLoopIterationMarker {
|
|
40
|
+
return {
|
|
41
|
+
loop: readWorkflowNameIndex(bc),
|
|
42
|
+
iteration: bare.readU32(bc),
|
|
43
|
+
};
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
export function writeWorkflowLoopIterationMarker(
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
export function writeWorkflowLoopIterationMarker(
|
|
47
|
+
bc: bare.ByteCursor,
|
|
48
|
+
x: WorkflowLoopIterationMarker,
|
|
49
|
+
): void {
|
|
50
|
+
writeWorkflowNameIndex(bc, x.loop);
|
|
51
|
+
bare.writeU32(bc, x.iteration);
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
export type WorkflowPathSegment =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
| { readonly tag: "WorkflowNameIndex"; readonly val: WorkflowNameIndex }
|
|
56
|
+
| {
|
|
57
|
+
readonly tag: "WorkflowLoopIterationMarker";
|
|
58
|
+
readonly val: WorkflowLoopIterationMarker;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export function readWorkflowPathSegment(
|
|
62
|
+
bc: bare.ByteCursor,
|
|
63
|
+
): WorkflowPathSegment {
|
|
64
|
+
const offset = bc.offset;
|
|
65
|
+
const tag = bare.readU8(bc);
|
|
66
|
+
switch (tag) {
|
|
67
|
+
case 0:
|
|
68
|
+
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
69
|
+
case 1:
|
|
70
|
+
return {
|
|
71
|
+
tag: "WorkflowLoopIterationMarker",
|
|
72
|
+
val: readWorkflowLoopIterationMarker(bc),
|
|
73
|
+
};
|
|
74
|
+
default: {
|
|
75
|
+
bc.offset = offset;
|
|
76
|
+
throw new bare.BareError(offset, "invalid tag");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function writeWorkflowPathSegment(
|
|
82
|
+
bc: bare.ByteCursor,
|
|
83
|
+
x: WorkflowPathSegment,
|
|
84
|
+
): void {
|
|
85
|
+
switch (x.tag) {
|
|
86
|
+
case "WorkflowNameIndex": {
|
|
87
|
+
bare.writeU8(bc, 0);
|
|
88
|
+
writeWorkflowNameIndex(bc, x.val);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case "WorkflowLoopIterationMarker": {
|
|
92
|
+
bare.writeU8(bc, 1);
|
|
93
|
+
writeWorkflowLoopIterationMarker(bc, x.val);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type WorkflowLocation = readonly WorkflowPathSegment[];
|
|
81
100
|
|
|
82
101
|
export function readWorkflowLocation(bc: bare.ByteCursor): WorkflowLocation {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
const len = bare.readUintSafe(bc);
|
|
103
|
+
if (len === 0) {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
const result = [readWorkflowPathSegment(bc)];
|
|
107
|
+
for (let i = 1; i < len; i++) {
|
|
108
|
+
result[i] = readWorkflowPathSegment(bc);
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function writeWorkflowLocation(
|
|
114
|
+
bc: bare.ByteCursor,
|
|
115
|
+
x: WorkflowLocation,
|
|
116
|
+
): void {
|
|
117
|
+
bare.writeUintSafe(bc, x.length);
|
|
118
|
+
for (let i = 0; i < x.length; i++) {
|
|
119
|
+
writeWorkflowPathSegment(bc, x[i]);
|
|
120
|
+
}
|
|
97
121
|
}
|
|
98
122
|
|
|
99
123
|
export enum WorkflowEntryStatus {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function readWorkflowEntryStatus(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
124
|
+
PENDING = "PENDING",
|
|
125
|
+
RUNNING = "RUNNING",
|
|
126
|
+
COMPLETED = "COMPLETED",
|
|
127
|
+
FAILED = "FAILED",
|
|
128
|
+
EXHAUSTED = "EXHAUSTED",
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function readWorkflowEntryStatus(
|
|
132
|
+
bc: bare.ByteCursor,
|
|
133
|
+
): WorkflowEntryStatus {
|
|
134
|
+
const offset = bc.offset;
|
|
135
|
+
const tag = bare.readU8(bc);
|
|
136
|
+
switch (tag) {
|
|
137
|
+
case 0:
|
|
138
|
+
return WorkflowEntryStatus.PENDING;
|
|
139
|
+
case 1:
|
|
140
|
+
return WorkflowEntryStatus.RUNNING;
|
|
141
|
+
case 2:
|
|
142
|
+
return WorkflowEntryStatus.COMPLETED;
|
|
143
|
+
case 3:
|
|
144
|
+
return WorkflowEntryStatus.FAILED;
|
|
145
|
+
case 4:
|
|
146
|
+
return WorkflowEntryStatus.EXHAUSTED;
|
|
147
|
+
default: {
|
|
148
|
+
bc.offset = offset;
|
|
149
|
+
throw new bare.BareError(offset, "invalid tag");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function writeWorkflowEntryStatus(
|
|
155
|
+
bc: bare.ByteCursor,
|
|
156
|
+
x: WorkflowEntryStatus,
|
|
157
|
+
): void {
|
|
158
|
+
switch (x) {
|
|
159
|
+
case WorkflowEntryStatus.PENDING: {
|
|
160
|
+
bare.writeU8(bc, 0);
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case WorkflowEntryStatus.RUNNING: {
|
|
164
|
+
bare.writeU8(bc, 1);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
case WorkflowEntryStatus.COMPLETED: {
|
|
168
|
+
bare.writeU8(bc, 2);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case WorkflowEntryStatus.FAILED: {
|
|
172
|
+
bare.writeU8(bc, 3);
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
case WorkflowEntryStatus.EXHAUSTED: {
|
|
176
|
+
bare.writeU8(bc, 4);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
151
180
|
}
|
|
152
181
|
|
|
153
182
|
export enum WorkflowSleepState {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function readWorkflowSleepState(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
PENDING = "PENDING",
|
|
184
|
+
COMPLETED = "COMPLETED",
|
|
185
|
+
INTERRUPTED = "INTERRUPTED",
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function readWorkflowSleepState(
|
|
189
|
+
bc: bare.ByteCursor,
|
|
190
|
+
): WorkflowSleepState {
|
|
191
|
+
const offset = bc.offset;
|
|
192
|
+
const tag = bare.readU8(bc);
|
|
193
|
+
switch (tag) {
|
|
194
|
+
case 0:
|
|
195
|
+
return WorkflowSleepState.PENDING;
|
|
196
|
+
case 1:
|
|
197
|
+
return WorkflowSleepState.COMPLETED;
|
|
198
|
+
case 2:
|
|
199
|
+
return WorkflowSleepState.INTERRUPTED;
|
|
200
|
+
default: {
|
|
201
|
+
bc.offset = offset;
|
|
202
|
+
throw new bare.BareError(offset, "invalid tag");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function writeWorkflowSleepState(
|
|
208
|
+
bc: bare.ByteCursor,
|
|
209
|
+
x: WorkflowSleepState,
|
|
210
|
+
): void {
|
|
211
|
+
switch (x) {
|
|
212
|
+
case WorkflowSleepState.PENDING: {
|
|
213
|
+
bare.writeU8(bc, 0);
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
case WorkflowSleepState.COMPLETED: {
|
|
217
|
+
bare.writeU8(bc, 1);
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
case WorkflowSleepState.INTERRUPTED: {
|
|
221
|
+
bare.writeU8(bc, 2);
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
191
225
|
}
|
|
192
226
|
|
|
193
227
|
export enum WorkflowBranchStatusType {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export function readWorkflowBranchStatusType(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
228
|
+
PENDING = "PENDING",
|
|
229
|
+
RUNNING = "RUNNING",
|
|
230
|
+
COMPLETED = "COMPLETED",
|
|
231
|
+
FAILED = "FAILED",
|
|
232
|
+
CANCELLED = "CANCELLED",
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export function readWorkflowBranchStatusType(
|
|
236
|
+
bc: bare.ByteCursor,
|
|
237
|
+
): WorkflowBranchStatusType {
|
|
238
|
+
const offset = bc.offset;
|
|
239
|
+
const tag = bare.readU8(bc);
|
|
240
|
+
switch (tag) {
|
|
241
|
+
case 0:
|
|
242
|
+
return WorkflowBranchStatusType.PENDING;
|
|
243
|
+
case 1:
|
|
244
|
+
return WorkflowBranchStatusType.RUNNING;
|
|
245
|
+
case 2:
|
|
246
|
+
return WorkflowBranchStatusType.COMPLETED;
|
|
247
|
+
case 3:
|
|
248
|
+
return WorkflowBranchStatusType.FAILED;
|
|
249
|
+
case 4:
|
|
250
|
+
return WorkflowBranchStatusType.CANCELLED;
|
|
251
|
+
default: {
|
|
252
|
+
bc.offset = offset;
|
|
253
|
+
throw new bare.BareError(offset, "invalid tag");
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export function writeWorkflowBranchStatusType(
|
|
259
|
+
bc: bare.ByteCursor,
|
|
260
|
+
x: WorkflowBranchStatusType,
|
|
261
|
+
): void {
|
|
262
|
+
switch (x) {
|
|
263
|
+
case WorkflowBranchStatusType.PENDING: {
|
|
264
|
+
bare.writeU8(bc, 0);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
case WorkflowBranchStatusType.RUNNING: {
|
|
268
|
+
bare.writeU8(bc, 1);
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
case WorkflowBranchStatusType.COMPLETED: {
|
|
272
|
+
bare.writeU8(bc, 2);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case WorkflowBranchStatusType.FAILED: {
|
|
276
|
+
bare.writeU8(bc, 3);
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case WorkflowBranchStatusType.CANCELLED: {
|
|
280
|
+
bare.writeU8(bc, 4);
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
245
284
|
}
|
|
246
285
|
|
|
247
286
|
function read0(bc: bare.ByteCursor): WorkflowCbor | null {
|
|
248
|
-
|
|
249
|
-
? readWorkflowCbor(bc)
|
|
250
|
-
: null
|
|
287
|
+
return bare.readBool(bc) ? readWorkflowCbor(bc) : null;
|
|
251
288
|
}
|
|
252
289
|
|
|
253
290
|
function write0(bc: bare.ByteCursor, x: WorkflowCbor | null): void {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
291
|
+
bare.writeBool(bc, x !== null);
|
|
292
|
+
if (x !== null) {
|
|
293
|
+
writeWorkflowCbor(bc, x);
|
|
294
|
+
}
|
|
258
295
|
}
|
|
259
296
|
|
|
260
297
|
function read1(bc: bare.ByteCursor): string | null {
|
|
261
|
-
|
|
262
|
-
? bare.readString(bc)
|
|
263
|
-
: null
|
|
298
|
+
return bare.readBool(bc) ? bare.readString(bc) : null;
|
|
264
299
|
}
|
|
265
300
|
|
|
266
301
|
function write1(bc: bare.ByteCursor, x: string | null): void {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
302
|
+
bare.writeBool(bc, x !== null);
|
|
303
|
+
if (x !== null) {
|
|
304
|
+
bare.writeString(bc, x);
|
|
305
|
+
}
|
|
271
306
|
}
|
|
272
307
|
|
|
273
308
|
export type WorkflowStepEntry = {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
309
|
+
readonly output: WorkflowCbor | null;
|
|
310
|
+
readonly error: string | null;
|
|
311
|
+
};
|
|
277
312
|
|
|
278
313
|
export function readWorkflowStepEntry(bc: bare.ByteCursor): WorkflowStepEntry {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
314
|
+
return {
|
|
315
|
+
output: read0(bc),
|
|
316
|
+
error: read1(bc),
|
|
317
|
+
};
|
|
283
318
|
}
|
|
284
319
|
|
|
285
|
-
export function writeWorkflowStepEntry(
|
|
286
|
-
|
|
287
|
-
|
|
320
|
+
export function writeWorkflowStepEntry(
|
|
321
|
+
bc: bare.ByteCursor,
|
|
322
|
+
x: WorkflowStepEntry,
|
|
323
|
+
): void {
|
|
324
|
+
write0(bc, x.output);
|
|
325
|
+
write1(bc, x.error);
|
|
288
326
|
}
|
|
289
327
|
|
|
290
328
|
export type WorkflowLoopEntry = {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
329
|
+
readonly state: WorkflowCbor;
|
|
330
|
+
readonly iteration: u32;
|
|
331
|
+
readonly output: WorkflowCbor | null;
|
|
332
|
+
};
|
|
295
333
|
|
|
296
334
|
export function readWorkflowLoopEntry(bc: bare.ByteCursor): WorkflowLoopEntry {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
335
|
+
return {
|
|
336
|
+
state: readWorkflowCbor(bc),
|
|
337
|
+
iteration: bare.readU32(bc),
|
|
338
|
+
output: read0(bc),
|
|
339
|
+
};
|
|
302
340
|
}
|
|
303
341
|
|
|
304
|
-
export function writeWorkflowLoopEntry(
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
342
|
+
export function writeWorkflowLoopEntry(
|
|
343
|
+
bc: bare.ByteCursor,
|
|
344
|
+
x: WorkflowLoopEntry,
|
|
345
|
+
): void {
|
|
346
|
+
writeWorkflowCbor(bc, x.state);
|
|
347
|
+
bare.writeU32(bc, x.iteration);
|
|
348
|
+
write0(bc, x.output);
|
|
308
349
|
}
|
|
309
350
|
|
|
310
351
|
export type WorkflowSleepEntry = {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
352
|
+
readonly deadline: u64;
|
|
353
|
+
readonly state: WorkflowSleepState;
|
|
354
|
+
};
|
|
314
355
|
|
|
315
|
-
export function readWorkflowSleepEntry(
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
356
|
+
export function readWorkflowSleepEntry(
|
|
357
|
+
bc: bare.ByteCursor,
|
|
358
|
+
): WorkflowSleepEntry {
|
|
359
|
+
return {
|
|
360
|
+
deadline: bare.readU64(bc),
|
|
361
|
+
state: readWorkflowSleepState(bc),
|
|
362
|
+
};
|
|
320
363
|
}
|
|
321
364
|
|
|
322
|
-
export function writeWorkflowSleepEntry(
|
|
323
|
-
|
|
324
|
-
|
|
365
|
+
export function writeWorkflowSleepEntry(
|
|
366
|
+
bc: bare.ByteCursor,
|
|
367
|
+
x: WorkflowSleepEntry,
|
|
368
|
+
): void {
|
|
369
|
+
bare.writeU64(bc, x.deadline);
|
|
370
|
+
writeWorkflowSleepState(bc, x.state);
|
|
325
371
|
}
|
|
326
372
|
|
|
327
373
|
export type WorkflowMessageEntry = {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
374
|
+
readonly name: string;
|
|
375
|
+
readonly messageData: WorkflowCbor;
|
|
376
|
+
};
|
|
331
377
|
|
|
332
|
-
export function readWorkflowMessageEntry(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
378
|
+
export function readWorkflowMessageEntry(
|
|
379
|
+
bc: bare.ByteCursor,
|
|
380
|
+
): WorkflowMessageEntry {
|
|
381
|
+
return {
|
|
382
|
+
name: bare.readString(bc),
|
|
383
|
+
messageData: readWorkflowCbor(bc),
|
|
384
|
+
};
|
|
337
385
|
}
|
|
338
386
|
|
|
339
|
-
export function writeWorkflowMessageEntry(
|
|
340
|
-
|
|
341
|
-
|
|
387
|
+
export function writeWorkflowMessageEntry(
|
|
388
|
+
bc: bare.ByteCursor,
|
|
389
|
+
x: WorkflowMessageEntry,
|
|
390
|
+
): void {
|
|
391
|
+
bare.writeString(bc, x.name);
|
|
392
|
+
writeWorkflowCbor(bc, x.messageData);
|
|
342
393
|
}
|
|
343
394
|
|
|
344
395
|
export type WorkflowRollbackCheckpointEntry = {
|
|
345
|
-
|
|
346
|
-
}
|
|
396
|
+
readonly name: string;
|
|
397
|
+
};
|
|
347
398
|
|
|
348
|
-
export function readWorkflowRollbackCheckpointEntry(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
399
|
+
export function readWorkflowRollbackCheckpointEntry(
|
|
400
|
+
bc: bare.ByteCursor,
|
|
401
|
+
): WorkflowRollbackCheckpointEntry {
|
|
402
|
+
return {
|
|
403
|
+
name: bare.readString(bc),
|
|
404
|
+
};
|
|
352
405
|
}
|
|
353
406
|
|
|
354
|
-
export function writeWorkflowRollbackCheckpointEntry(
|
|
355
|
-
|
|
407
|
+
export function writeWorkflowRollbackCheckpointEntry(
|
|
408
|
+
bc: bare.ByteCursor,
|
|
409
|
+
x: WorkflowRollbackCheckpointEntry,
|
|
410
|
+
): void {
|
|
411
|
+
bare.writeString(bc, x.name);
|
|
356
412
|
}
|
|
357
413
|
|
|
358
414
|
export type WorkflowBranchStatus = {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
export function readWorkflowBranchStatus(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
415
|
+
readonly status: WorkflowBranchStatusType;
|
|
416
|
+
readonly output: WorkflowCbor | null;
|
|
417
|
+
readonly error: string | null;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
export function readWorkflowBranchStatus(
|
|
421
|
+
bc: bare.ByteCursor,
|
|
422
|
+
): WorkflowBranchStatus {
|
|
423
|
+
return {
|
|
424
|
+
status: readWorkflowBranchStatusType(bc),
|
|
425
|
+
output: read0(bc),
|
|
426
|
+
error: read1(bc),
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export function writeWorkflowBranchStatus(
|
|
431
|
+
bc: bare.ByteCursor,
|
|
432
|
+
x: WorkflowBranchStatus,
|
|
433
|
+
): void {
|
|
434
|
+
writeWorkflowBranchStatusType(bc, x.status);
|
|
435
|
+
write0(bc, x.output);
|
|
436
|
+
write1(bc, x.error);
|
|
376
437
|
}
|
|
377
438
|
|
|
378
439
|
function read2(bc: bare.ByteCursor): ReadonlyMap<string, WorkflowBranchStatus> {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function write2(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
440
|
+
const len = bare.readUintSafe(bc);
|
|
441
|
+
const result = new Map<string, WorkflowBranchStatus>();
|
|
442
|
+
for (let i = 0; i < len; i++) {
|
|
443
|
+
const offset = bc.offset;
|
|
444
|
+
const key = bare.readString(bc);
|
|
445
|
+
if (result.has(key)) {
|
|
446
|
+
bc.offset = offset;
|
|
447
|
+
throw new bare.BareError(offset, "duplicated key");
|
|
448
|
+
}
|
|
449
|
+
result.set(key, readWorkflowBranchStatus(bc));
|
|
450
|
+
}
|
|
451
|
+
return result;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function write2(
|
|
455
|
+
bc: bare.ByteCursor,
|
|
456
|
+
x: ReadonlyMap<string, WorkflowBranchStatus>,
|
|
457
|
+
): void {
|
|
458
|
+
bare.writeUintSafe(bc, x.size);
|
|
459
|
+
for (const kv of x) {
|
|
460
|
+
bare.writeString(bc, kv[0]);
|
|
461
|
+
writeWorkflowBranchStatus(bc, kv[1]);
|
|
462
|
+
}
|
|
399
463
|
}
|
|
400
464
|
|
|
401
465
|
export type WorkflowJoinEntry = {
|
|
402
|
-
|
|
403
|
-
}
|
|
466
|
+
readonly branches: ReadonlyMap<string, WorkflowBranchStatus>;
|
|
467
|
+
};
|
|
404
468
|
|
|
405
469
|
export function readWorkflowJoinEntry(bc: bare.ByteCursor): WorkflowJoinEntry {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
470
|
+
return {
|
|
471
|
+
branches: read2(bc),
|
|
472
|
+
};
|
|
409
473
|
}
|
|
410
474
|
|
|
411
|
-
export function writeWorkflowJoinEntry(
|
|
412
|
-
|
|
475
|
+
export function writeWorkflowJoinEntry(
|
|
476
|
+
bc: bare.ByteCursor,
|
|
477
|
+
x: WorkflowJoinEntry,
|
|
478
|
+
): void {
|
|
479
|
+
write2(bc, x.branches);
|
|
413
480
|
}
|
|
414
481
|
|
|
415
482
|
export type WorkflowRaceEntry = {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
483
|
+
readonly winner: string | null;
|
|
484
|
+
readonly branches: ReadonlyMap<string, WorkflowBranchStatus>;
|
|
485
|
+
};
|
|
419
486
|
|
|
420
487
|
export function readWorkflowRaceEntry(bc: bare.ByteCursor): WorkflowRaceEntry {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
488
|
+
return {
|
|
489
|
+
winner: read1(bc),
|
|
490
|
+
branches: read2(bc),
|
|
491
|
+
};
|
|
425
492
|
}
|
|
426
493
|
|
|
427
|
-
export function writeWorkflowRaceEntry(
|
|
428
|
-
|
|
429
|
-
|
|
494
|
+
export function writeWorkflowRaceEntry(
|
|
495
|
+
bc: bare.ByteCursor,
|
|
496
|
+
x: WorkflowRaceEntry,
|
|
497
|
+
): void {
|
|
498
|
+
write1(bc, x.winner);
|
|
499
|
+
write2(bc, x.branches);
|
|
430
500
|
}
|
|
431
501
|
|
|
432
502
|
export type WorkflowRemovedEntry = {
|
|
433
|
-
|
|
434
|
-
|
|
503
|
+
readonly originalType: string;
|
|
504
|
+
readonly originalName: string | null;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export function readWorkflowRemovedEntry(
|
|
508
|
+
bc: bare.ByteCursor,
|
|
509
|
+
): WorkflowRemovedEntry {
|
|
510
|
+
return {
|
|
511
|
+
originalType: bare.readString(bc),
|
|
512
|
+
originalName: read1(bc),
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export function writeWorkflowRemovedEntry(
|
|
517
|
+
bc: bare.ByteCursor,
|
|
518
|
+
x: WorkflowRemovedEntry,
|
|
519
|
+
): void {
|
|
520
|
+
bare.writeString(bc, x.originalType);
|
|
521
|
+
write1(bc, x.originalName);
|
|
435
522
|
}
|
|
436
523
|
|
|
437
|
-
export
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
524
|
+
export type WorkflowVersionCheckEntry = {
|
|
525
|
+
readonly resolved: u32;
|
|
526
|
+
readonly latest: u32;
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
export function readWorkflowVersionCheckEntry(
|
|
530
|
+
bc: bare.ByteCursor,
|
|
531
|
+
): WorkflowVersionCheckEntry {
|
|
532
|
+
return {
|
|
533
|
+
resolved: bare.readU32(bc),
|
|
534
|
+
latest: bare.readU32(bc),
|
|
535
|
+
};
|
|
442
536
|
}
|
|
443
537
|
|
|
444
|
-
export function
|
|
445
|
-
|
|
446
|
-
|
|
538
|
+
export function writeWorkflowVersionCheckEntry(
|
|
539
|
+
bc: bare.ByteCursor,
|
|
540
|
+
x: WorkflowVersionCheckEntry,
|
|
541
|
+
): void {
|
|
542
|
+
bare.writeU32(bc, x.resolved);
|
|
543
|
+
bare.writeU32(bc, x.latest);
|
|
447
544
|
}
|
|
448
545
|
|
|
449
546
|
export type WorkflowEntryKind =
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
547
|
+
| { readonly tag: "WorkflowStepEntry"; readonly val: WorkflowStepEntry }
|
|
548
|
+
| { readonly tag: "WorkflowLoopEntry"; readonly val: WorkflowLoopEntry }
|
|
549
|
+
| { readonly tag: "WorkflowSleepEntry"; readonly val: WorkflowSleepEntry }
|
|
550
|
+
| {
|
|
551
|
+
readonly tag: "WorkflowMessageEntry";
|
|
552
|
+
readonly val: WorkflowMessageEntry;
|
|
553
|
+
}
|
|
554
|
+
| {
|
|
555
|
+
readonly tag: "WorkflowRollbackCheckpointEntry";
|
|
556
|
+
readonly val: WorkflowRollbackCheckpointEntry;
|
|
557
|
+
}
|
|
558
|
+
| { readonly tag: "WorkflowJoinEntry"; readonly val: WorkflowJoinEntry }
|
|
559
|
+
| { readonly tag: "WorkflowRaceEntry"; readonly val: WorkflowRaceEntry }
|
|
560
|
+
| {
|
|
561
|
+
readonly tag: "WorkflowRemovedEntry";
|
|
562
|
+
readonly val: WorkflowRemovedEntry;
|
|
563
|
+
}
|
|
564
|
+
| {
|
|
565
|
+
readonly tag: "WorkflowVersionCheckEntry";
|
|
566
|
+
readonly val: WorkflowVersionCheckEntry;
|
|
567
|
+
};
|
|
458
568
|
|
|
459
569
|
export function readWorkflowEntryKind(bc: bare.ByteCursor): WorkflowEntryKind {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
570
|
+
const offset = bc.offset;
|
|
571
|
+
const tag = bare.readU8(bc);
|
|
572
|
+
switch (tag) {
|
|
573
|
+
case 0:
|
|
574
|
+
return { tag: "WorkflowStepEntry", val: readWorkflowStepEntry(bc) };
|
|
575
|
+
case 1:
|
|
576
|
+
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
577
|
+
case 2:
|
|
578
|
+
return {
|
|
579
|
+
tag: "WorkflowSleepEntry",
|
|
580
|
+
val: readWorkflowSleepEntry(bc),
|
|
581
|
+
};
|
|
582
|
+
case 3:
|
|
583
|
+
return {
|
|
584
|
+
tag: "WorkflowMessageEntry",
|
|
585
|
+
val: readWorkflowMessageEntry(bc),
|
|
586
|
+
};
|
|
587
|
+
case 4:
|
|
588
|
+
return {
|
|
589
|
+
tag: "WorkflowRollbackCheckpointEntry",
|
|
590
|
+
val: readWorkflowRollbackCheckpointEntry(bc),
|
|
591
|
+
};
|
|
592
|
+
case 5:
|
|
593
|
+
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
594
|
+
case 6:
|
|
595
|
+
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
596
|
+
case 7:
|
|
597
|
+
return {
|
|
598
|
+
tag: "WorkflowRemovedEntry",
|
|
599
|
+
val: readWorkflowRemovedEntry(bc),
|
|
600
|
+
};
|
|
601
|
+
case 8:
|
|
602
|
+
return {
|
|
603
|
+
tag: "WorkflowVersionCheckEntry",
|
|
604
|
+
val: readWorkflowVersionCheckEntry(bc),
|
|
605
|
+
};
|
|
606
|
+
default: {
|
|
607
|
+
bc.offset = offset;
|
|
608
|
+
throw new bare.BareError(offset, "invalid tag");
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
export function writeWorkflowEntryKind(
|
|
614
|
+
bc: bare.ByteCursor,
|
|
615
|
+
x: WorkflowEntryKind,
|
|
616
|
+
): void {
|
|
617
|
+
switch (x.tag) {
|
|
618
|
+
case "WorkflowStepEntry": {
|
|
619
|
+
bare.writeU8(bc, 0);
|
|
620
|
+
writeWorkflowStepEntry(bc, x.val);
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
case "WorkflowLoopEntry": {
|
|
624
|
+
bare.writeU8(bc, 1);
|
|
625
|
+
writeWorkflowLoopEntry(bc, x.val);
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
case "WorkflowSleepEntry": {
|
|
629
|
+
bare.writeU8(bc, 2);
|
|
630
|
+
writeWorkflowSleepEntry(bc, x.val);
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
case "WorkflowMessageEntry": {
|
|
634
|
+
bare.writeU8(bc, 3);
|
|
635
|
+
writeWorkflowMessageEntry(bc, x.val);
|
|
636
|
+
break;
|
|
637
|
+
}
|
|
638
|
+
case "WorkflowRollbackCheckpointEntry": {
|
|
639
|
+
bare.writeU8(bc, 4);
|
|
640
|
+
writeWorkflowRollbackCheckpointEntry(bc, x.val);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
case "WorkflowJoinEntry": {
|
|
644
|
+
bare.writeU8(bc, 5);
|
|
645
|
+
writeWorkflowJoinEntry(bc, x.val);
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
case "WorkflowRaceEntry": {
|
|
649
|
+
bare.writeU8(bc, 6);
|
|
650
|
+
writeWorkflowRaceEntry(bc, x.val);
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
653
|
+
case "WorkflowRemovedEntry": {
|
|
654
|
+
bare.writeU8(bc, 7);
|
|
655
|
+
writeWorkflowRemovedEntry(bc, x.val);
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
case "WorkflowVersionCheckEntry": {
|
|
659
|
+
bare.writeU8(bc, 8);
|
|
660
|
+
writeWorkflowVersionCheckEntry(bc, x.val);
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
529
664
|
}
|
|
530
665
|
|
|
531
666
|
export type WorkflowEntry = {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
667
|
+
readonly id: string;
|
|
668
|
+
readonly location: WorkflowLocation;
|
|
669
|
+
readonly kind: WorkflowEntryKind;
|
|
670
|
+
};
|
|
536
671
|
|
|
537
672
|
export function readWorkflowEntry(bc: bare.ByteCursor): WorkflowEntry {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
673
|
+
return {
|
|
674
|
+
id: bare.readString(bc),
|
|
675
|
+
location: readWorkflowLocation(bc),
|
|
676
|
+
kind: readWorkflowEntryKind(bc),
|
|
677
|
+
};
|
|
543
678
|
}
|
|
544
679
|
|
|
545
|
-
export function writeWorkflowEntry(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
680
|
+
export function writeWorkflowEntry(
|
|
681
|
+
bc: bare.ByteCursor,
|
|
682
|
+
x: WorkflowEntry,
|
|
683
|
+
): void {
|
|
684
|
+
bare.writeString(bc, x.id);
|
|
685
|
+
writeWorkflowLocation(bc, x.location);
|
|
686
|
+
writeWorkflowEntryKind(bc, x.kind);
|
|
549
687
|
}
|
|
550
688
|
|
|
551
689
|
function read3(bc: bare.ByteCursor): u64 | null {
|
|
552
|
-
|
|
553
|
-
? bare.readU64(bc)
|
|
554
|
-
: null
|
|
690
|
+
return bare.readBool(bc) ? bare.readU64(bc) : null;
|
|
555
691
|
}
|
|
556
692
|
|
|
557
693
|
function write3(bc: bare.ByteCursor, x: u64 | null): void {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
694
|
+
bare.writeBool(bc, x !== null);
|
|
695
|
+
if (x !== null) {
|
|
696
|
+
bare.writeU64(bc, x);
|
|
697
|
+
}
|
|
562
698
|
}
|
|
563
699
|
|
|
564
700
|
export type WorkflowEntryMetadata = {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
export function readWorkflowEntryMetadata(
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
701
|
+
readonly status: WorkflowEntryStatus;
|
|
702
|
+
readonly error: string | null;
|
|
703
|
+
readonly attempts: u32;
|
|
704
|
+
readonly lastAttemptAt: u64;
|
|
705
|
+
readonly createdAt: u64;
|
|
706
|
+
readonly completedAt: u64 | null;
|
|
707
|
+
readonly rollbackCompletedAt: u64 | null;
|
|
708
|
+
readonly rollbackError: string | null;
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
export function readWorkflowEntryMetadata(
|
|
712
|
+
bc: bare.ByteCursor,
|
|
713
|
+
): WorkflowEntryMetadata {
|
|
714
|
+
return {
|
|
715
|
+
status: readWorkflowEntryStatus(bc),
|
|
716
|
+
error: read1(bc),
|
|
717
|
+
attempts: bare.readU32(bc),
|
|
718
|
+
lastAttemptAt: bare.readU64(bc),
|
|
719
|
+
createdAt: bare.readU64(bc),
|
|
720
|
+
completedAt: read3(bc),
|
|
721
|
+
rollbackCompletedAt: read3(bc),
|
|
722
|
+
rollbackError: read1(bc),
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
export function writeWorkflowEntryMetadata(
|
|
727
|
+
bc: bare.ByteCursor,
|
|
728
|
+
x: WorkflowEntryMetadata,
|
|
729
|
+
): void {
|
|
730
|
+
writeWorkflowEntryStatus(bc, x.status);
|
|
731
|
+
write1(bc, x.error);
|
|
732
|
+
bare.writeU32(bc, x.attempts);
|
|
733
|
+
bare.writeU64(bc, x.lastAttemptAt);
|
|
734
|
+
bare.writeU64(bc, x.createdAt);
|
|
735
|
+
write3(bc, x.completedAt);
|
|
736
|
+
write3(bc, x.rollbackCompletedAt);
|
|
737
|
+
write1(bc, x.rollbackError);
|
|
597
738
|
}
|
|
598
739
|
|
|
599
740
|
function read4(bc: bare.ByteCursor): readonly string[] {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
741
|
+
const len = bare.readUintSafe(bc);
|
|
742
|
+
if (len === 0) {
|
|
743
|
+
return [];
|
|
744
|
+
}
|
|
745
|
+
const result = [bare.readString(bc)];
|
|
746
|
+
for (let i = 1; i < len; i++) {
|
|
747
|
+
result[i] = bare.readString(bc);
|
|
748
|
+
}
|
|
749
|
+
return result;
|
|
607
750
|
}
|
|
608
751
|
|
|
609
752
|
function write4(bc: bare.ByteCursor, x: readonly string[]): void {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
753
|
+
bare.writeUintSafe(bc, x.length);
|
|
754
|
+
for (let i = 0; i < x.length; i++) {
|
|
755
|
+
bare.writeString(bc, x[i]);
|
|
756
|
+
}
|
|
614
757
|
}
|
|
615
758
|
|
|
616
759
|
function read5(bc: bare.ByteCursor): readonly WorkflowEntry[] {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
760
|
+
const len = bare.readUintSafe(bc);
|
|
761
|
+
if (len === 0) {
|
|
762
|
+
return [];
|
|
763
|
+
}
|
|
764
|
+
const result = [readWorkflowEntry(bc)];
|
|
765
|
+
for (let i = 1; i < len; i++) {
|
|
766
|
+
result[i] = readWorkflowEntry(bc);
|
|
767
|
+
}
|
|
768
|
+
return result;
|
|
624
769
|
}
|
|
625
770
|
|
|
626
771
|
function write5(bc: bare.ByteCursor, x: readonly WorkflowEntry[]): void {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
function read6(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
772
|
+
bare.writeUintSafe(bc, x.length);
|
|
773
|
+
for (let i = 0; i < x.length; i++) {
|
|
774
|
+
writeWorkflowEntry(bc, x[i]);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
function read6(
|
|
779
|
+
bc: bare.ByteCursor,
|
|
780
|
+
): ReadonlyMap<string, WorkflowEntryMetadata> {
|
|
781
|
+
const len = bare.readUintSafe(bc);
|
|
782
|
+
const result = new Map<string, WorkflowEntryMetadata>();
|
|
783
|
+
for (let i = 0; i < len; i++) {
|
|
784
|
+
const offset = bc.offset;
|
|
785
|
+
const key = bare.readString(bc);
|
|
786
|
+
if (result.has(key)) {
|
|
787
|
+
bc.offset = offset;
|
|
788
|
+
throw new bare.BareError(offset, "duplicated key");
|
|
789
|
+
}
|
|
790
|
+
result.set(key, readWorkflowEntryMetadata(bc));
|
|
791
|
+
}
|
|
792
|
+
return result;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function write6(
|
|
796
|
+
bc: bare.ByteCursor,
|
|
797
|
+
x: ReadonlyMap<string, WorkflowEntryMetadata>,
|
|
798
|
+
): void {
|
|
799
|
+
bare.writeUintSafe(bc, x.size);
|
|
800
|
+
for (const kv of x) {
|
|
801
|
+
bare.writeString(bc, kv[0]);
|
|
802
|
+
writeWorkflowEntryMetadata(bc, kv[1]);
|
|
803
|
+
}
|
|
654
804
|
}
|
|
655
805
|
|
|
656
806
|
export type WorkflowHistory = {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
807
|
+
readonly nameRegistry: readonly string[];
|
|
808
|
+
readonly entries: readonly WorkflowEntry[];
|
|
809
|
+
readonly entryMetadata: ReadonlyMap<string, WorkflowEntryMetadata>;
|
|
810
|
+
};
|
|
661
811
|
|
|
662
812
|
export function readWorkflowHistory(bc: bare.ByteCursor): WorkflowHistory {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
813
|
+
return {
|
|
814
|
+
nameRegistry: read4(bc),
|
|
815
|
+
entries: read5(bc),
|
|
816
|
+
entryMetadata: read6(bc),
|
|
817
|
+
};
|
|
668
818
|
}
|
|
669
819
|
|
|
670
|
-
export function writeWorkflowHistory(
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
820
|
+
export function writeWorkflowHistory(
|
|
821
|
+
bc: bare.ByteCursor,
|
|
822
|
+
x: WorkflowHistory,
|
|
823
|
+
): void {
|
|
824
|
+
write4(bc, x.nameRegistry);
|
|
825
|
+
write5(bc, x.entries);
|
|
826
|
+
write6(bc, x.entryMetadata);
|
|
674
827
|
}
|
|
675
828
|
|
|
676
829
|
export function encodeWorkflowHistory(x: WorkflowHistory): Uint8Array {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
830
|
+
const bc = new bare.ByteCursor(
|
|
831
|
+
new Uint8Array(config.initialBufferLength),
|
|
832
|
+
config,
|
|
833
|
+
);
|
|
834
|
+
writeWorkflowHistory(bc, x);
|
|
835
|
+
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
683
836
|
}
|
|
684
837
|
|
|
685
838
|
export function decodeWorkflowHistory(bytes: Uint8Array): WorkflowHistory {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
839
|
+
const bc = new bare.ByteCursor(bytes, config);
|
|
840
|
+
const result = readWorkflowHistory(bc);
|
|
841
|
+
if (bc.offset < bc.view.byteLength) {
|
|
842
|
+
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
843
|
+
}
|
|
844
|
+
return result;
|
|
692
845
|
}
|
|
693
846
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
if (!condition) throw new Error(message ?? "Assertion failed")
|
|
847
|
+
function _assert(condition: boolean, message?: string): asserts condition {
|
|
848
|
+
if (!condition) throw new Error(message ?? "Assertion failed");
|
|
697
849
|
}
|