@blue-labs/document-processor 2.0.0-rc.2 → 2.0.0-rc.4
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/engine/channel-runner.d.ts +2 -2
- package/dist/engine/channel-runner.d.ts.map +1 -1
- package/dist/engine/external-event.d.ts +3 -0
- package/dist/engine/external-event.d.ts.map +1 -0
- package/dist/engine/processor-engine.d.ts.map +1 -1
- package/dist/engine/scope-executor.d.ts +1 -0
- package/dist/engine/scope-executor.d.ts.map +1 -1
- package/dist/index.js +561 -536
- package/dist/registry/processors/steps/trigger-event-step-executor.d.ts.map +1 -1
- package/dist/test-support/blue.d.ts.map +1 -1
- package/dist/util/expression/quickjs-expression-utils.d.ts +2 -0
- package/dist/util/expression/quickjs-expression-utils.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { blueIds as
|
|
1
|
+
import { blueIds as m, ContractSchema as Xe, ChannelSchema as et, HandlerSchema as tt, MarkerSchema as nt, DocumentUpdateChannelSchema as rt, EmbeddedNodeChannelSchema as it, LifecycleEventChannelSchema as st, TriggeredEventChannelSchema as ot, ChannelEventCheckpointSchema as at, ProcessingInitializedMarkerSchema as ct, ProcessEmbeddedSchema as lt, ProcessingTerminatedMarkerSchema as ut, repository as dt } from "@blue-repository/core";
|
|
2
2
|
import { getQuickJS as ht } from "quickjs-emscripten";
|
|
3
|
-
import { BlueNode as d, blueNodeField as z, withTypeBlueId as ft, Blue as pt, MergingProcessors as
|
|
4
|
-
import
|
|
5
|
-
import { z as S, ZodError as
|
|
6
|
-
import { TimelineChannelSchema as mt, OperationSchema as x, SequentialWorkflowSchema as gt, SequentialWorkflowOperationSchema as Et, TimelineEntrySchema as k, blueIds as
|
|
7
|
-
import { MyOSTimelineChannelSchema as wt, blueIds as bt, MyOSTimelineEntrySchema as
|
|
8
|
-
import { isNullable as
|
|
3
|
+
import { BlueNode as d, blueNodeField as z, withTypeBlueId as ft, Blue as pt, MergingProcessors as T } from "@blue-labs/language";
|
|
4
|
+
import he from "picomatch";
|
|
5
|
+
import { z as S, ZodError as Pe } from "zod";
|
|
6
|
+
import { TimelineChannelSchema as mt, OperationSchema as x, SequentialWorkflowSchema as gt, SequentialWorkflowOperationSchema as Et, TimelineEntrySchema as k, blueIds as R, TriggerEventSchema as fe, JavaScriptCodeSchema as pe, UpdateDocumentSchema as me, OperationRequestSchema as te, repository as yt } from "@blue-repository/conversation";
|
|
7
|
+
import { MyOSTimelineChannelSchema as wt, blueIds as bt, MyOSTimelineEntrySchema as ge, repository as St } from "@blue-repository/myos";
|
|
8
|
+
import { isNullable as ne } from "@blue-labs/shared-utils";
|
|
9
9
|
function Ct(i) {
|
|
10
10
|
return { ok: !0, value: i };
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function vt(i) {
|
|
13
13
|
return { ok: !1, error: i };
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function Yr(i) {
|
|
16
16
|
return i.ok;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Zr(i) {
|
|
19
19
|
return !i.ok;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Xr(i, e) {
|
|
22
22
|
return i.ok ? Ct(e(i.value)) : i;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return i.ok ? i :
|
|
24
|
+
function ei(i, e) {
|
|
25
|
+
return i.ok ? i : vt(e(i.error));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function ti(i, e) {
|
|
28
28
|
return i.ok ? e(i.value) : i;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function ni(i, e) {
|
|
31
31
|
return i.ok ? i.value : e;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ri(i, e) {
|
|
34
34
|
return i.ok ? i.value : e(i.error);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function ii(i, e) {
|
|
37
37
|
return i.ok ? e.ok(i.value) : e.err(i.error);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const E = {
|
|
40
40
|
capabilityFailure(i, e, t) {
|
|
41
41
|
return { kind: "CapabilityFailure", capability: i, reason: e, details: t };
|
|
42
42
|
},
|
|
@@ -56,14 +56,14 @@ const g = {
|
|
|
56
56
|
return { kind: "UnsupportedOp", operation: i, reason: e };
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
function
|
|
59
|
+
function kt(i) {
|
|
60
60
|
return Object.freeze([...i]);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const It = {
|
|
63
63
|
of(i, e, t) {
|
|
64
64
|
return {
|
|
65
65
|
document: i,
|
|
66
|
-
triggeredEvents:
|
|
66
|
+
triggeredEvents: kt(e),
|
|
67
67
|
totalGas: t,
|
|
68
68
|
capabilityFailure: !1,
|
|
69
69
|
failureReason: null
|
|
@@ -78,68 +78,68 @@ const vt = {
|
|
|
78
78
|
failureReason: e ?? null
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
},
|
|
81
|
+
}, Ne = It, Rt = [
|
|
82
82
|
"embedded",
|
|
83
83
|
"initialized",
|
|
84
84
|
"terminated",
|
|
85
85
|
"checkpoint"
|
|
86
86
|
], Tt = [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
],
|
|
87
|
+
m["Document Update Channel"],
|
|
88
|
+
m["Triggered Event Channel"],
|
|
89
|
+
m["Lifecycle Event Channel"],
|
|
90
|
+
m["Embedded Node Channel"]
|
|
91
|
+
], Me = "embedded", Ae = "initialized", De = "terminated", I = "checkpoint", se = new Set(
|
|
92
92
|
Rt
|
|
93
93
|
), Oe = new Set(Tt);
|
|
94
94
|
function Pt(i) {
|
|
95
|
-
return i != null &&
|
|
95
|
+
return i != null && se.has(i);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function oe(i) {
|
|
98
98
|
return i != null && Oe.has(
|
|
99
99
|
i
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
KEY_EMBEDDED:
|
|
104
|
-
KEY_INITIALIZED:
|
|
105
|
-
KEY_TERMINATED:
|
|
102
|
+
const si = {
|
|
103
|
+
KEY_EMBEDDED: Me,
|
|
104
|
+
KEY_INITIALIZED: Ae,
|
|
105
|
+
KEY_TERMINATED: De,
|
|
106
106
|
KEY_CHECKPOINT: I,
|
|
107
|
-
RESERVED_CONTRACT_KEYS:
|
|
107
|
+
RESERVED_CONTRACT_KEYS: se,
|
|
108
108
|
PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: Oe,
|
|
109
109
|
isReservedContractKey: Pt,
|
|
110
|
-
isProcessorManagedChannelBlueId:
|
|
111
|
-
},
|
|
110
|
+
isProcessorManagedChannelBlueId: oe
|
|
111
|
+
}, D = "/contracts", re = `${D}/${Ae}`, Be = `${D}/${De}`, Nt = `${D}/${Me}`, Le = `${D}/${I}`, _e = "/lastEvents", $e = "/lastSignatures";
|
|
112
112
|
function J(i) {
|
|
113
|
-
return `${
|
|
114
|
-
}
|
|
115
|
-
function $e(i, e) {
|
|
116
|
-
return `${J(i)}${Le}/${e}`;
|
|
113
|
+
return `${D}/${i}`;
|
|
117
114
|
}
|
|
118
115
|
function xe(i, e) {
|
|
119
116
|
return `${J(i)}${_e}/${e}`;
|
|
120
117
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
function Fe(i, e) {
|
|
119
|
+
return `${J(i)}${$e}/${e}`;
|
|
120
|
+
}
|
|
121
|
+
const oi = {
|
|
122
|
+
RELATIVE_CONTRACTS: D,
|
|
123
|
+
RELATIVE_INITIALIZED: re,
|
|
124
|
+
RELATIVE_TERMINATED: Be,
|
|
125
125
|
RELATIVE_EMBEDDED: Nt,
|
|
126
|
-
RELATIVE_CHECKPOINT:
|
|
127
|
-
LAST_EVENTS_SUFFIX:
|
|
128
|
-
LAST_SIGNATURES_SUFFIX:
|
|
126
|
+
RELATIVE_CHECKPOINT: Le,
|
|
127
|
+
LAST_EVENTS_SUFFIX: _e,
|
|
128
|
+
LAST_SIGNATURES_SUFFIX: $e,
|
|
129
129
|
relativeContractsEntry: J,
|
|
130
|
-
relativeCheckpointLastEvent:
|
|
131
|
-
relativeCheckpointLastSignature:
|
|
130
|
+
relativeCheckpointLastEvent: xe,
|
|
131
|
+
relativeCheckpointLastSignature: Fe
|
|
132
132
|
};
|
|
133
|
-
function
|
|
133
|
+
function ze(i) {
|
|
134
134
|
return i == null || i.length === 0;
|
|
135
135
|
}
|
|
136
136
|
function y(i) {
|
|
137
|
-
return
|
|
137
|
+
return ze(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
|
|
138
138
|
}
|
|
139
139
|
function b(i) {
|
|
140
|
-
return
|
|
140
|
+
return ze(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Ee(i) {
|
|
143
143
|
if (i == null)
|
|
144
144
|
return "";
|
|
145
145
|
let e = i.trim();
|
|
@@ -151,8 +151,8 @@ function ge(i) {
|
|
|
151
151
|
e = e.substring(0, e.length - 1);
|
|
152
152
|
return e;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
const t =
|
|
154
|
+
function ai(i, e) {
|
|
155
|
+
const t = Ee(i), n = Ee(e);
|
|
156
156
|
return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
|
|
157
157
|
}
|
|
158
158
|
function w(i, e) {
|
|
@@ -171,9 +171,9 @@ function Mt(i, e) {
|
|
|
171
171
|
function At(i) {
|
|
172
172
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
173
173
|
}
|
|
174
|
-
var
|
|
175
|
-
function
|
|
176
|
-
return
|
|
174
|
+
var Z, ye;
|
|
175
|
+
function Dt() {
|
|
176
|
+
return ye || (ye = 1, Z = function i(e) {
|
|
177
177
|
if (typeof e == "number" && isNaN(e))
|
|
178
178
|
throw new Error("NaN is not allowed");
|
|
179
179
|
if (typeof e == "number" && !isFinite(e))
|
|
@@ -184,10 +184,10 @@ function Ot() {
|
|
|
184
184
|
const s = n.length === 0 ? "" : ",";
|
|
185
185
|
return `${n}${s}${i(r)}:${i(e[r])}`;
|
|
186
186
|
}, "")}}`;
|
|
187
|
-
}),
|
|
187
|
+
}), Z;
|
|
188
188
|
}
|
|
189
|
-
var
|
|
190
|
-
const Bt = /* @__PURE__ */ At(
|
|
189
|
+
var Ot = Dt();
|
|
190
|
+
const Bt = /* @__PURE__ */ At(Ot);
|
|
191
191
|
function Lt(i, e) {
|
|
192
192
|
return i.nodeToJson(e, "official");
|
|
193
193
|
}
|
|
@@ -195,14 +195,14 @@ function _t(i, e) {
|
|
|
195
195
|
const t = Lt(i, e);
|
|
196
196
|
return Bt(t);
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function He(i, e) {
|
|
199
199
|
return e ? _t(i, e) : null;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
const t =
|
|
201
|
+
function we(i, e) {
|
|
202
|
+
const t = He(i, e);
|
|
203
203
|
return t == null ? 0 : new TextEncoder().encode(t).length;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Ue(i) {
|
|
206
206
|
return typeof i == "object" && i !== null && !Array.isArray(i);
|
|
207
207
|
}
|
|
208
208
|
function $t(i) {
|
|
@@ -217,7 +217,7 @@ function xt(i) {
|
|
|
217
217
|
function _(i, e = !0) {
|
|
218
218
|
if (Array.isArray(i))
|
|
219
219
|
return e ? i.map((r) => _(r, !0)) : i.slice();
|
|
220
|
-
if (!
|
|
220
|
+
if (!Ue(i))
|
|
221
221
|
return i;
|
|
222
222
|
if (Object.prototype.hasOwnProperty.call(i, "value")) {
|
|
223
223
|
const r = i.value;
|
|
@@ -248,7 +248,7 @@ function Ft(i, e) {
|
|
|
248
248
|
n = n[s];
|
|
249
249
|
continue;
|
|
250
250
|
}
|
|
251
|
-
if (
|
|
251
|
+
if (Ue(n)) {
|
|
252
252
|
n = n[r];
|
|
253
253
|
continue;
|
|
254
254
|
}
|
|
@@ -257,7 +257,7 @@ function Ft(i, e) {
|
|
|
257
257
|
return n;
|
|
258
258
|
}
|
|
259
259
|
const zt = 500, Ht = 32 * 1024 * 1024;
|
|
260
|
-
class
|
|
260
|
+
class ae {
|
|
261
261
|
modulePromise;
|
|
262
262
|
moduleInstance;
|
|
263
263
|
async evaluate({
|
|
@@ -273,17 +273,17 @@ class oe {
|
|
|
273
273
|
const c = o.newContext();
|
|
274
274
|
try {
|
|
275
275
|
this.installConsole(c), this.installDeterministicGlobals(c), this.installCanonNamespace(c), this.installBindings(c, t);
|
|
276
|
-
const l = this.wrapCode(e), u = c.evalCode(l),
|
|
277
|
-
let
|
|
276
|
+
const l = this.wrapCode(e), u = c.evalCode(l), f = c.unwrapResult(u);
|
|
277
|
+
let h = null;
|
|
278
278
|
try {
|
|
279
|
-
return
|
|
279
|
+
return h = await this.resolveHandle(
|
|
280
280
|
c,
|
|
281
281
|
o,
|
|
282
|
-
|
|
282
|
+
f,
|
|
283
283
|
a
|
|
284
|
-
), c.dump(
|
|
284
|
+
), c.dump(h);
|
|
285
285
|
} finally {
|
|
286
|
-
|
|
286
|
+
h ? h.dispose() : f.dispose();
|
|
287
287
|
}
|
|
288
288
|
} finally {
|
|
289
289
|
c.dispose(), o.removeInterruptHandler?.(), o.dispose();
|
|
@@ -491,44 +491,44 @@ ${e}
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
const
|
|
494
|
+
const be = 120;
|
|
495
495
|
function Ut(i) {
|
|
496
|
-
return i.length <=
|
|
496
|
+
return i.length <= be ? i : `${i.slice(0, be - 3)}...`;
|
|
497
497
|
}
|
|
498
|
-
class
|
|
498
|
+
class Ve extends Error {
|
|
499
499
|
constructor(e, t) {
|
|
500
500
|
super(`Failed to evaluate code block: ${Ut(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
const
|
|
503
|
+
const Ke = /^\$\{([\s\S]*)\}$/, Vt = /\$\{([\s\S]+?)\}/, We = /\$\{([\s\S]+?)\}/g;
|
|
504
504
|
function W(i) {
|
|
505
|
-
if (typeof i != "string" || !
|
|
505
|
+
if (typeof i != "string" || !Ke.test(i))
|
|
506
506
|
return !1;
|
|
507
507
|
const e = i.indexOf("${"), t = i.lastIndexOf("${");
|
|
508
508
|
return e === t;
|
|
509
509
|
}
|
|
510
510
|
function Kt(i) {
|
|
511
|
-
return typeof i != "string" ? !1 :
|
|
511
|
+
return typeof i != "string" ? !1 : Ke.test(i) ? !0 : Vt.test(i);
|
|
512
512
|
}
|
|
513
513
|
function Wt(i) {
|
|
514
514
|
if (!W(i))
|
|
515
515
|
throw new Error(`Invalid expression: ${i}`);
|
|
516
516
|
return i.slice(2, -1);
|
|
517
517
|
}
|
|
518
|
-
async function
|
|
518
|
+
async function Ge(i, e, t) {
|
|
519
519
|
const n = `return await (${e});`;
|
|
520
520
|
try {
|
|
521
521
|
return await i.evaluate({ code: n, bindings: t });
|
|
522
522
|
} catch (r) {
|
|
523
|
-
throw new
|
|
523
|
+
throw new Ve(e, r);
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
async function Gt(i, e, t) {
|
|
527
527
|
let n = "", r = 0;
|
|
528
|
-
for (const s of e.matchAll(
|
|
528
|
+
for (const s of e.matchAll(We)) {
|
|
529
529
|
const o = s[0], a = s[1], c = s.index ?? 0;
|
|
530
530
|
n += e.slice(r, c);
|
|
531
|
-
const l = await
|
|
531
|
+
const l = await Ge(
|
|
532
532
|
i,
|
|
533
533
|
a,
|
|
534
534
|
t
|
|
@@ -537,15 +537,15 @@ async function Gt(i, e, t) {
|
|
|
537
537
|
}
|
|
538
538
|
return n += e.slice(r), n;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function qe({
|
|
541
541
|
include: i,
|
|
542
542
|
exclude: e = [],
|
|
543
543
|
options: t
|
|
544
544
|
}) {
|
|
545
545
|
const n = { dot: !0, ...t ?? {} }, r = i.map(
|
|
546
|
-
(o) =>
|
|
546
|
+
(o) => he(o, n)
|
|
547
547
|
), s = e.map(
|
|
548
|
-
(o) =>
|
|
548
|
+
(o) => he(o, n)
|
|
549
549
|
);
|
|
550
550
|
return (o) => r.some((a) => a(o)) && !s.some((a) => a(o));
|
|
551
551
|
}
|
|
@@ -555,74 +555,78 @@ async function G(i) {
|
|
|
555
555
|
node: t,
|
|
556
556
|
bindings: n,
|
|
557
557
|
shouldResolve: r,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
558
|
+
shouldDescend: s = () => !0,
|
|
559
|
+
context: o,
|
|
560
|
+
pointer: a = "/"
|
|
561
|
+
} = i, c = t.clone();
|
|
562
|
+
if (!s(a, c))
|
|
563
|
+
return c;
|
|
564
|
+
const l = c.getValue();
|
|
565
|
+
if (l !== void 0) {
|
|
566
|
+
if (typeof l == "string" && r(a)) {
|
|
567
|
+
if (W(l)) {
|
|
568
|
+
const h = Wt(l);
|
|
569
|
+
o.gasMeter().chargeExpression(h);
|
|
570
|
+
const p = await Ge(
|
|
567
571
|
e,
|
|
568
572
|
h,
|
|
569
573
|
n
|
|
570
574
|
);
|
|
571
|
-
return
|
|
572
|
-
} else if (Kt(
|
|
573
|
-
const h = new RegExp(
|
|
574
|
-
let
|
|
575
|
-
for (h.lastIndex = 0; h.exec(
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
const
|
|
575
|
+
return o.blue.jsonValueToNode(p ?? null);
|
|
576
|
+
} else if (Kt(l)) {
|
|
577
|
+
const h = new RegExp(We);
|
|
578
|
+
let p = 0;
|
|
579
|
+
for (h.lastIndex = 0; h.exec(l); )
|
|
580
|
+
p += 1;
|
|
581
|
+
o.gasMeter().chargeTemplate(p, l);
|
|
582
|
+
const C = await Gt(
|
|
579
583
|
e,
|
|
580
|
-
|
|
584
|
+
l,
|
|
581
585
|
n
|
|
582
586
|
);
|
|
583
|
-
return new d().setValue(
|
|
587
|
+
return new d().setValue(C);
|
|
584
588
|
}
|
|
585
589
|
}
|
|
586
|
-
return
|
|
590
|
+
return c;
|
|
587
591
|
}
|
|
588
|
-
const
|
|
589
|
-
if (Array.isArray(
|
|
592
|
+
const u = c.getItems?.();
|
|
593
|
+
if (Array.isArray(u)) {
|
|
590
594
|
const h = await Promise.all(
|
|
591
|
-
|
|
592
|
-
(
|
|
595
|
+
u.map(
|
|
596
|
+
(p, C) => G({
|
|
593
597
|
...i,
|
|
594
|
-
node:
|
|
595
|
-
pointer: `${
|
|
598
|
+
node: p,
|
|
599
|
+
pointer: `${a}/${C}`
|
|
596
600
|
})
|
|
597
601
|
)
|
|
598
602
|
);
|
|
599
|
-
return
|
|
603
|
+
return c.setItems(h), c;
|
|
600
604
|
}
|
|
601
|
-
const
|
|
602
|
-
if (
|
|
605
|
+
const f = c.getProperties?.();
|
|
606
|
+
if (f) {
|
|
603
607
|
const h = {};
|
|
604
|
-
for (const [
|
|
605
|
-
const
|
|
606
|
-
h[
|
|
608
|
+
for (const [p, C] of Object.entries(f)) {
|
|
609
|
+
const Y = a === "/" ? `/${p}` : `${a}/${p}`;
|
|
610
|
+
h[p] = await G({
|
|
607
611
|
...i,
|
|
608
|
-
node:
|
|
609
|
-
pointer:
|
|
612
|
+
node: C,
|
|
613
|
+
pointer: Y
|
|
610
614
|
});
|
|
611
615
|
}
|
|
612
|
-
|
|
616
|
+
c.setProperties(h);
|
|
613
617
|
}
|
|
614
|
-
return
|
|
618
|
+
return c;
|
|
615
619
|
}
|
|
616
|
-
const
|
|
617
|
-
|
|
620
|
+
const ce = Xe, O = et.merge(
|
|
621
|
+
ce
|
|
618
622
|
).extend({
|
|
619
623
|
path: S.string().optional(),
|
|
620
624
|
definition: z().optional()
|
|
621
|
-
}),
|
|
625
|
+
}), je = tt.merge(ce), H = nt.merge(ce), qt = S.object({
|
|
622
626
|
op: S.enum(["ADD", "REPLACE", "REMOVE"]),
|
|
623
627
|
path: S.string(),
|
|
624
628
|
val: z().optional()
|
|
625
|
-
}),
|
|
629
|
+
}), ci = ft("JsonPatch")(
|
|
626
630
|
qt
|
|
627
631
|
).superRefine((i, e) => {
|
|
628
632
|
i.op === "REMOVE" && i.val !== void 0 && e.addIssue({
|
|
@@ -648,10 +652,10 @@ const ae = Xe, O = et.merge(
|
|
|
648
652
|
H
|
|
649
653
|
), rn = ut.merge(H), sn = x.merge(
|
|
650
654
|
H
|
|
651
|
-
),
|
|
655
|
+
), li = z(), on = gt.merge(je).extend({
|
|
652
656
|
steps: S.array(z()).optional()
|
|
653
657
|
}), an = Et.merge(
|
|
654
|
-
|
|
658
|
+
je
|
|
655
659
|
).extend({
|
|
656
660
|
steps: S.array(z()).optional()
|
|
657
661
|
});
|
|
@@ -716,8 +720,8 @@ class ln {
|
|
|
716
720
|
V(e, this.processorsByBlueId);
|
|
717
721
|
}
|
|
718
722
|
}
|
|
719
|
-
function
|
|
720
|
-
return i.isTypeOf(e,
|
|
723
|
+
function Se(i, e) {
|
|
724
|
+
return i.isTypeOf(e, ge) ? i.nodeToSchemaOutput(e, ge) : i.isTypeOf(e, k) ? i.nodeToSchemaOutput(e, k) : null;
|
|
721
725
|
}
|
|
722
726
|
class un {
|
|
723
727
|
kind = "channel";
|
|
@@ -727,7 +731,7 @@ class un {
|
|
|
727
731
|
const { event: n, blue: r } = t;
|
|
728
732
|
if (!n)
|
|
729
733
|
return !1;
|
|
730
|
-
const s =
|
|
734
|
+
const s = Se(r, n);
|
|
731
735
|
if (!s)
|
|
732
736
|
return !1;
|
|
733
737
|
const o = s.timeline?.timelineId;
|
|
@@ -735,12 +739,12 @@ class un {
|
|
|
735
739
|
}
|
|
736
740
|
channelize(e, t) {
|
|
737
741
|
const { event: n, blue: r } = t;
|
|
738
|
-
return !n || !
|
|
742
|
+
return !n || !Se(r, n) ? null : n.clone();
|
|
739
743
|
}
|
|
740
744
|
}
|
|
741
745
|
class dn {
|
|
742
746
|
kind = "channel";
|
|
743
|
-
blueIds = [
|
|
747
|
+
blueIds = [R["Timeline Channel"]];
|
|
744
748
|
schema = Zt;
|
|
745
749
|
matches(e, t) {
|
|
746
750
|
const { event: n, blue: r } = t;
|
|
@@ -754,7 +758,7 @@ class dn {
|
|
|
754
758
|
return !n || !r.isTypeOf(n, k) ? null : n.clone();
|
|
755
759
|
}
|
|
756
760
|
}
|
|
757
|
-
function
|
|
761
|
+
function le(i) {
|
|
758
762
|
const { context: e, eventNode: t, stepResults: n } = i, r = hn(e);
|
|
759
763
|
return {
|
|
760
764
|
event: e.blue.nodeToJson(t, "simple"),
|
|
@@ -777,49 +781,57 @@ function hn(i) {
|
|
|
777
781
|
return n.canonical = (r) => t(r, "official"), n;
|
|
778
782
|
}
|
|
779
783
|
class fn {
|
|
780
|
-
supportedBlueIds = [
|
|
781
|
-
evaluator = new
|
|
784
|
+
supportedBlueIds = [R["Trigger Event"]];
|
|
785
|
+
evaluator = new ae();
|
|
782
786
|
async execute(e) {
|
|
783
787
|
const { stepNode: t, context: n } = e;
|
|
784
|
-
if (!n.blue.isTypeOf(t,
|
|
788
|
+
if (!n.blue.isTypeOf(t, fe))
|
|
785
789
|
return n.throwFatal("Trigger Event step payload is invalid");
|
|
786
790
|
n.gasMeter().chargeTriggerEventBase();
|
|
787
791
|
const r = await G({
|
|
788
792
|
evaluator: this.evaluator,
|
|
789
793
|
node: t,
|
|
790
|
-
bindings:
|
|
791
|
-
shouldResolve:
|
|
794
|
+
bindings: le(e),
|
|
795
|
+
shouldResolve: qe({
|
|
792
796
|
include: ["/event", "/event/**"]
|
|
793
797
|
}),
|
|
798
|
+
shouldDescend: pn(),
|
|
794
799
|
context: n
|
|
795
800
|
}), o = n.blue.nodeToSchemaOutput(
|
|
796
801
|
r,
|
|
797
|
-
|
|
802
|
+
fe
|
|
798
803
|
).event;
|
|
799
|
-
if (
|
|
804
|
+
if (ne(o))
|
|
800
805
|
return n.throwFatal(
|
|
801
806
|
"Trigger Event step must declare event payload"
|
|
802
807
|
);
|
|
803
808
|
n.emitEvent(o.clone());
|
|
804
809
|
}
|
|
805
810
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
811
|
+
function pn() {
|
|
812
|
+
return (i, e) => i === "/event" || !i.startsWith("/event/") ? !0 : !mn(e);
|
|
813
|
+
}
|
|
814
|
+
function mn(i) {
|
|
815
|
+
const e = i.getProperties?.();
|
|
816
|
+
return e ? !!e.contracts : !1;
|
|
817
|
+
}
|
|
818
|
+
class gn {
|
|
819
|
+
supportedBlueIds = [R["JavaScript Code"]];
|
|
820
|
+
evaluator = new ae();
|
|
809
821
|
async execute(e) {
|
|
810
822
|
const { context: t, stepNode: n } = e, { blue: r } = t;
|
|
811
|
-
if (!r.isTypeOf(n,
|
|
823
|
+
if (!r.isTypeOf(n, pe))
|
|
812
824
|
return t.throwFatal("JavaScript Code step payload is invalid");
|
|
813
825
|
const o = r.nodeToSchemaOutput(
|
|
814
826
|
n,
|
|
815
|
-
|
|
827
|
+
pe
|
|
816
828
|
).code;
|
|
817
829
|
if (!o)
|
|
818
830
|
return t.throwFatal(
|
|
819
831
|
"JavaScript Code step must include code to execute"
|
|
820
832
|
);
|
|
821
833
|
t.gasMeter().chargeJavaScriptCodeBase(o);
|
|
822
|
-
const a =
|
|
834
|
+
const a = le(e);
|
|
823
835
|
try {
|
|
824
836
|
const c = await this.evaluator.evaluate({
|
|
825
837
|
code: o,
|
|
@@ -827,7 +839,7 @@ class pn {
|
|
|
827
839
|
});
|
|
828
840
|
return this.handleEvents(c, t), c;
|
|
829
841
|
} catch (c) {
|
|
830
|
-
throw new
|
|
842
|
+
throw new Ve(o, c);
|
|
831
843
|
}
|
|
832
844
|
}
|
|
833
845
|
handleEvents(e, t) {
|
|
@@ -841,18 +853,18 @@ class pn {
|
|
|
841
853
|
}
|
|
842
854
|
}
|
|
843
855
|
}
|
|
844
|
-
class
|
|
845
|
-
supportedBlueIds = [
|
|
846
|
-
evaluator = new
|
|
856
|
+
class En {
|
|
857
|
+
supportedBlueIds = [R["Update Document"]];
|
|
858
|
+
evaluator = new ae();
|
|
847
859
|
async execute(e) {
|
|
848
860
|
const { context: t, stepNode: n } = e, { blue: r } = t;
|
|
849
|
-
if (!r.isTypeOf(n,
|
|
861
|
+
if (!r.isTypeOf(n, me))
|
|
850
862
|
return t.throwFatal("Update Document step payload is invalid");
|
|
851
863
|
const s = await G({
|
|
852
864
|
evaluator: this.evaluator,
|
|
853
865
|
node: n,
|
|
854
|
-
bindings:
|
|
855
|
-
shouldResolve:
|
|
866
|
+
bindings: le(e),
|
|
867
|
+
shouldResolve: qe({
|
|
856
868
|
include: ["/changeset", "/changeset/**"]
|
|
857
869
|
}),
|
|
858
870
|
context: t
|
|
@@ -866,7 +878,7 @@ class mn {
|
|
|
866
878
|
extractChanges(e, t) {
|
|
867
879
|
return t.blue.nodeToSchemaOutput(
|
|
868
880
|
e,
|
|
869
|
-
|
|
881
|
+
me
|
|
870
882
|
).changeset ?? [];
|
|
871
883
|
}
|
|
872
884
|
createPatch(e, t) {
|
|
@@ -886,14 +898,14 @@ class mn {
|
|
|
886
898
|
return n.length === 0 ? t.throwFatal("Update Document path cannot be empty") : n;
|
|
887
899
|
}
|
|
888
900
|
}
|
|
889
|
-
const
|
|
901
|
+
const ue = [
|
|
890
902
|
new fn(),
|
|
891
|
-
new
|
|
892
|
-
new
|
|
903
|
+
new gn(),
|
|
904
|
+
new En()
|
|
893
905
|
];
|
|
894
|
-
class
|
|
906
|
+
class Je {
|
|
895
907
|
executorIndex;
|
|
896
|
-
constructor(e =
|
|
908
|
+
constructor(e = ue) {
|
|
897
909
|
const t = /* @__PURE__ */ new Map();
|
|
898
910
|
for (const n of e)
|
|
899
911
|
for (const r of n.supportedBlueIds)
|
|
@@ -907,28 +919,28 @@ class je {
|
|
|
907
919
|
const o = {};
|
|
908
920
|
for (const [a, c] of s.entries()) {
|
|
909
921
|
const l = c.getType?.()?.getBlueId();
|
|
910
|
-
if (
|
|
922
|
+
if (ne(l))
|
|
911
923
|
return r.throwFatal(
|
|
912
924
|
"Sequential workflow step is missing type metadata"
|
|
913
925
|
);
|
|
914
926
|
const u = this.executorIndex.get(l);
|
|
915
|
-
if (
|
|
916
|
-
const
|
|
927
|
+
if (ne(u)) {
|
|
928
|
+
const p = c.getType?.()?.getName?.() ?? l;
|
|
917
929
|
return r.throwFatal(
|
|
918
|
-
`Unsupported workflow step type "${
|
|
930
|
+
`Unsupported workflow step type "${p}"`
|
|
919
931
|
);
|
|
920
932
|
}
|
|
921
|
-
const
|
|
933
|
+
const f = {
|
|
922
934
|
workflow: t,
|
|
923
935
|
stepNode: c,
|
|
924
936
|
eventNode: n,
|
|
925
937
|
context: r,
|
|
926
938
|
stepResults: o,
|
|
927
939
|
stepIndex: a
|
|
928
|
-
},
|
|
929
|
-
if (
|
|
930
|
-
const
|
|
931
|
-
o[
|
|
940
|
+
}, h = await u.execute(f);
|
|
941
|
+
if (h !== void 0) {
|
|
942
|
+
const p = this.stepResultKey(c, a);
|
|
943
|
+
o[p] = h;
|
|
932
944
|
}
|
|
933
945
|
}
|
|
934
946
|
return o;
|
|
@@ -938,13 +950,13 @@ class je {
|
|
|
938
950
|
return n && typeof n == "string" && n.length > 0 ? n : `Step${t + 1}`;
|
|
939
951
|
}
|
|
940
952
|
}
|
|
941
|
-
class
|
|
953
|
+
class yn {
|
|
942
954
|
kind = "handler";
|
|
943
|
-
blueIds = [
|
|
955
|
+
blueIds = [R["Sequential Workflow"]];
|
|
944
956
|
schema = on;
|
|
945
957
|
runner;
|
|
946
|
-
constructor(e =
|
|
947
|
-
this.runner = new
|
|
958
|
+
constructor(e = ue) {
|
|
959
|
+
this.runner = new Je(e);
|
|
948
960
|
}
|
|
949
961
|
async matches(e, t) {
|
|
950
962
|
const n = t.event();
|
|
@@ -955,12 +967,12 @@ class gn {
|
|
|
955
967
|
n && await this.runner.run({ workflow: e, eventNode: n, context: t });
|
|
956
968
|
}
|
|
957
969
|
}
|
|
958
|
-
class
|
|
970
|
+
class wn {
|
|
959
971
|
kind = "marker";
|
|
960
|
-
blueIds = [
|
|
972
|
+
blueIds = [R.Operation];
|
|
961
973
|
schema = sn;
|
|
962
974
|
}
|
|
963
|
-
function
|
|
975
|
+
function Qe(i) {
|
|
964
976
|
const e = i.channel;
|
|
965
977
|
if (typeof e == "string") {
|
|
966
978
|
const t = e.trim();
|
|
@@ -969,12 +981,12 @@ function Je(i) {
|
|
|
969
981
|
}
|
|
970
982
|
return null;
|
|
971
983
|
}
|
|
972
|
-
function
|
|
984
|
+
function bn(i, e) {
|
|
973
985
|
const t = i.getProperties()?.document;
|
|
974
986
|
return t instanceof d ? e.blue.calculateBlueIdSync(t) : null;
|
|
975
987
|
}
|
|
976
|
-
function
|
|
977
|
-
if (e.isTypeOf(i,
|
|
988
|
+
function Sn(i, e) {
|
|
989
|
+
if (e.isTypeOf(i, te, {
|
|
978
990
|
checkSchemaExtensions: !0
|
|
979
991
|
}))
|
|
980
992
|
return i;
|
|
@@ -982,18 +994,18 @@ function wn(i, e) {
|
|
|
982
994
|
checkSchemaExtensions: !0
|
|
983
995
|
})) {
|
|
984
996
|
const n = e.nodeToSchemaOutput(i, k).message;
|
|
985
|
-
if (n && e.isTypeOf(n,
|
|
997
|
+
if (n && e.isTypeOf(n, te, {
|
|
986
998
|
checkSchemaExtensions: !0
|
|
987
999
|
}))
|
|
988
1000
|
return n;
|
|
989
1001
|
}
|
|
990
1002
|
return null;
|
|
991
1003
|
}
|
|
992
|
-
function
|
|
1004
|
+
function Cn(i, e, t, n) {
|
|
993
1005
|
const { blue: r } = n, s = i.operation;
|
|
994
1006
|
return !(!s || t.operation !== s || i.event && !r.isTypeOfNode(e, i.event));
|
|
995
1007
|
}
|
|
996
|
-
function
|
|
1008
|
+
function vn(i, e) {
|
|
997
1009
|
const t = i.operation;
|
|
998
1010
|
if (!t)
|
|
999
1011
|
return null;
|
|
@@ -1003,13 +1015,13 @@ function Sn(i, e) {
|
|
|
1003
1015
|
const s = e.blue.nodeToSchemaOutput(
|
|
1004
1016
|
r,
|
|
1005
1017
|
x
|
|
1006
|
-
), o =
|
|
1018
|
+
), o = Qe(s);
|
|
1007
1019
|
return { operationNode: r, operation: s, channelKey: o };
|
|
1008
1020
|
}
|
|
1009
|
-
function
|
|
1021
|
+
function kn(i, e) {
|
|
1010
1022
|
return !(i && e && i !== e);
|
|
1011
1023
|
}
|
|
1012
|
-
function
|
|
1024
|
+
function In(i, e, t) {
|
|
1013
1025
|
const n = i.getProperties()?.request, r = e.getProperties()?.request;
|
|
1014
1026
|
if (!(n instanceof d) || !(r instanceof d))
|
|
1015
1027
|
return !1;
|
|
@@ -1021,10 +1033,10 @@ function kn(i, e, t) {
|
|
|
1021
1033
|
}
|
|
1022
1034
|
return !0;
|
|
1023
1035
|
}
|
|
1024
|
-
function
|
|
1036
|
+
function Rn(i, e, t) {
|
|
1025
1037
|
if (!i || i.allowNewerVersion !== !1)
|
|
1026
1038
|
return !0;
|
|
1027
|
-
const n =
|
|
1039
|
+
const n = bn(e, t);
|
|
1028
1040
|
if (!n)
|
|
1029
1041
|
return !0;
|
|
1030
1042
|
const r = t.resolvePointer("/"), s = t.documentAt(r);
|
|
@@ -1033,15 +1045,15 @@ function In(i, e, t) {
|
|
|
1033
1045
|
const c = (s.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, l = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(s);
|
|
1034
1046
|
return n === l;
|
|
1035
1047
|
}
|
|
1036
|
-
class
|
|
1048
|
+
class Tn {
|
|
1037
1049
|
kind = "handler";
|
|
1038
1050
|
blueIds = [
|
|
1039
|
-
|
|
1051
|
+
R["Sequential Workflow Operation"]
|
|
1040
1052
|
];
|
|
1041
1053
|
schema = an;
|
|
1042
1054
|
runner;
|
|
1043
|
-
constructor(e =
|
|
1044
|
-
this.runner = new
|
|
1055
|
+
constructor(e = ue) {
|
|
1056
|
+
this.runner = new Je(e);
|
|
1045
1057
|
}
|
|
1046
1058
|
deriveChannel(e, t) {
|
|
1047
1059
|
const n = e.operation;
|
|
@@ -1053,13 +1065,13 @@ class vn {
|
|
|
1053
1065
|
}))
|
|
1054
1066
|
return null;
|
|
1055
1067
|
const s = t.blue.nodeToSchemaOutput(r.node, x);
|
|
1056
|
-
return s ?
|
|
1068
|
+
return s ? Qe(s) : null;
|
|
1057
1069
|
}
|
|
1058
1070
|
async matches(e, t) {
|
|
1059
1071
|
const n = t.event();
|
|
1060
1072
|
if (!n)
|
|
1061
1073
|
return !1;
|
|
1062
|
-
const r =
|
|
1074
|
+
const r = Sn(
|
|
1063
1075
|
n,
|
|
1064
1076
|
t.blue
|
|
1065
1077
|
);
|
|
@@ -1067,19 +1079,19 @@ class vn {
|
|
|
1067
1079
|
return !1;
|
|
1068
1080
|
const s = t.blue.nodeToSchemaOutput(
|
|
1069
1081
|
r,
|
|
1070
|
-
|
|
1082
|
+
te
|
|
1071
1083
|
);
|
|
1072
|
-
if (!s || !
|
|
1084
|
+
if (!s || !Cn(e, n, s, t))
|
|
1073
1085
|
return !1;
|
|
1074
|
-
const o =
|
|
1086
|
+
const o = vn(e, t);
|
|
1075
1087
|
if (!o)
|
|
1076
1088
|
return !1;
|
|
1077
1089
|
const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
|
|
1078
|
-
return !(!
|
|
1090
|
+
return !(!kn(o.channelKey, c) || !In(
|
|
1079
1091
|
r,
|
|
1080
1092
|
o.operationNode,
|
|
1081
1093
|
t.blue
|
|
1082
|
-
) || s?.allowNewerVersion === !1 && !
|
|
1094
|
+
) || s?.allowNewerVersion === !1 && !Rn(s, r, t));
|
|
1083
1095
|
}
|
|
1084
1096
|
async execute(e, t) {
|
|
1085
1097
|
const n = t.event();
|
|
@@ -1100,7 +1112,7 @@ class Q {
|
|
|
1100
1112
|
);
|
|
1101
1113
|
}
|
|
1102
1114
|
registerDefaults() {
|
|
1103
|
-
return this.registry.register(new un()), this.registry.register(new dn()), this.registry.register(new
|
|
1115
|
+
return this.registry.register(new un()), this.registry.register(new dn()), this.registry.register(new yn()), this.registry.register(new wn()), this.registry.register(new Tn()), this;
|
|
1104
1116
|
}
|
|
1105
1117
|
register(e) {
|
|
1106
1118
|
return this.registry.register(e), this;
|
|
@@ -1109,11 +1121,11 @@ class Q {
|
|
|
1109
1121
|
return this.registry;
|
|
1110
1122
|
}
|
|
1111
1123
|
}
|
|
1112
|
-
const
|
|
1113
|
-
function
|
|
1124
|
+
const ie = m["Channel Event Checkpoint"];
|
|
1125
|
+
function Ye(i) {
|
|
1114
1126
|
return typeof i.order == "number" ? i.order : 0;
|
|
1115
1127
|
}
|
|
1116
|
-
class
|
|
1128
|
+
class Pn {
|
|
1117
1129
|
constructor(e, t, n) {
|
|
1118
1130
|
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
|
|
1119
1131
|
}
|
|
@@ -1127,10 +1139,10 @@ class Rn {
|
|
|
1127
1139
|
return this.bindingBlueId;
|
|
1128
1140
|
}
|
|
1129
1141
|
order() {
|
|
1130
|
-
return
|
|
1142
|
+
return Ye(this.bindingContract);
|
|
1131
1143
|
}
|
|
1132
1144
|
}
|
|
1133
|
-
class
|
|
1145
|
+
class Nn {
|
|
1134
1146
|
constructor(e, t, n) {
|
|
1135
1147
|
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
|
|
1136
1148
|
}
|
|
@@ -1144,16 +1156,16 @@ class Tn {
|
|
|
1144
1156
|
return this.bindingBlueId;
|
|
1145
1157
|
}
|
|
1146
1158
|
order() {
|
|
1147
|
-
return
|
|
1159
|
+
return Ye(this.bindingContract);
|
|
1148
1160
|
}
|
|
1149
1161
|
}
|
|
1150
|
-
class
|
|
1162
|
+
class A {
|
|
1151
1163
|
constructor(e, t, n, r, s) {
|
|
1152
1164
|
this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared = s;
|
|
1153
1165
|
}
|
|
1154
1166
|
checkpointDeclared;
|
|
1155
1167
|
static fromComponents(e, t, n, r, s) {
|
|
1156
|
-
return new
|
|
1168
|
+
return new A(
|
|
1157
1169
|
e,
|
|
1158
1170
|
t,
|
|
1159
1171
|
n,
|
|
@@ -1162,10 +1174,10 @@ class M {
|
|
|
1162
1174
|
);
|
|
1163
1175
|
}
|
|
1164
1176
|
static builder() {
|
|
1165
|
-
return new
|
|
1177
|
+
return new Mn();
|
|
1166
1178
|
}
|
|
1167
1179
|
static empty() {
|
|
1168
|
-
return
|
|
1180
|
+
return A.builder().build();
|
|
1169
1181
|
}
|
|
1170
1182
|
markers() {
|
|
1171
1183
|
return new Map(
|
|
@@ -1198,13 +1210,13 @@ class M {
|
|
|
1198
1210
|
this.markerStore.set(I, {
|
|
1199
1211
|
key: I,
|
|
1200
1212
|
contract: e,
|
|
1201
|
-
blueId:
|
|
1213
|
+
blueId: ie
|
|
1202
1214
|
}), this.checkpointDeclared = !0;
|
|
1203
1215
|
}
|
|
1204
1216
|
handlersFor(e) {
|
|
1205
1217
|
const t = this.handlersByChannel.get(e);
|
|
1206
1218
|
return !t || t.length === 0 ? [] : [...t].map(
|
|
1207
|
-
(n) => new
|
|
1219
|
+
(n) => new Nn(n.key, n.contract, n.blueId)
|
|
1208
1220
|
).sort((n, r) => {
|
|
1209
1221
|
const s = n.order() - r.order();
|
|
1210
1222
|
return s !== 0 ? s : n.key().localeCompare(r.key());
|
|
@@ -1212,7 +1224,7 @@ class M {
|
|
|
1212
1224
|
}
|
|
1213
1225
|
channelsOfType(...e) {
|
|
1214
1226
|
const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
|
|
1215
|
-
(r) => new
|
|
1227
|
+
(r) => new Pn(r.key, r.contract, r.blueId)
|
|
1216
1228
|
);
|
|
1217
1229
|
return n.sort((r, s) => {
|
|
1218
1230
|
const o = r.order() - s.order();
|
|
@@ -1220,7 +1232,7 @@ class M {
|
|
|
1220
1232
|
}), n;
|
|
1221
1233
|
}
|
|
1222
1234
|
}
|
|
1223
|
-
class
|
|
1235
|
+
class Mn {
|
|
1224
1236
|
channels = /* @__PURE__ */ new Map();
|
|
1225
1237
|
handlersByChannel = /* @__PURE__ */ new Map();
|
|
1226
1238
|
markerStore = /* @__PURE__ */ new Map();
|
|
@@ -1245,11 +1257,11 @@ class Pn {
|
|
|
1245
1257
|
return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
|
|
1246
1258
|
}
|
|
1247
1259
|
addMarker(e, t, n) {
|
|
1248
|
-
if (e === I && n !==
|
|
1260
|
+
if (e === I && n !== ie)
|
|
1249
1261
|
throw new Error(
|
|
1250
1262
|
"Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
|
|
1251
1263
|
);
|
|
1252
|
-
if (n ===
|
|
1264
|
+
if (n === ie) {
|
|
1253
1265
|
if (e !== I)
|
|
1254
1266
|
throw new Error(
|
|
1255
1267
|
`Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
|
|
@@ -1263,7 +1275,7 @@ class Pn {
|
|
|
1263
1275
|
return this.markerStore.set(e, { key: e, contract: t, blueId: n }), this;
|
|
1264
1276
|
}
|
|
1265
1277
|
build() {
|
|
1266
|
-
return
|
|
1278
|
+
return A.fromComponents(
|
|
1267
1279
|
new Map(this.channels),
|
|
1268
1280
|
new Map(
|
|
1269
1281
|
Array.from(this.handlersByChannel.entries(), ([e, t]) => [
|
|
@@ -1277,12 +1289,12 @@ class Pn {
|
|
|
1277
1289
|
);
|
|
1278
1290
|
}
|
|
1279
1291
|
}
|
|
1280
|
-
class
|
|
1292
|
+
class g extends Error {
|
|
1281
1293
|
constructor(e, t) {
|
|
1282
1294
|
super(e || "Processor fatal error"), this.processorError = t, this.name = "ProcessorFatalError";
|
|
1283
1295
|
}
|
|
1284
1296
|
}
|
|
1285
|
-
class
|
|
1297
|
+
class An {
|
|
1286
1298
|
constructor(e, t, n) {
|
|
1287
1299
|
this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
|
|
1288
1300
|
}
|
|
@@ -1305,18 +1317,18 @@ class Nn {
|
|
|
1305
1317
|
handlerKey: t
|
|
1306
1318
|
}), u = o.get(l);
|
|
1307
1319
|
if (!u)
|
|
1308
|
-
throw new
|
|
1320
|
+
throw new g(
|
|
1309
1321
|
`Handler ${t} references unknown channel '${l}'`,
|
|
1310
|
-
|
|
1322
|
+
E.invalidContract(
|
|
1311
1323
|
s,
|
|
1312
1324
|
`Channel '${l}' is not declared in this scope`,
|
|
1313
1325
|
`/contracts/${l}`
|
|
1314
1326
|
)
|
|
1315
1327
|
);
|
|
1316
1328
|
if (!this.isRegisteredChannel(u.nodeTypeBlueId))
|
|
1317
|
-
throw new
|
|
1329
|
+
throw new g(
|
|
1318
1330
|
`Contract '${l}' is not a channel`,
|
|
1319
|
-
|
|
1331
|
+
E.invalidContract(
|
|
1320
1332
|
u.nodeTypeBlueId,
|
|
1321
1333
|
`Contract '${l}' is not a channel`,
|
|
1322
1334
|
`/contracts/${l}`
|
|
@@ -1325,9 +1337,9 @@ class Nn {
|
|
|
1325
1337
|
e.addHandler(t, { ...c, channel: l }, s);
|
|
1326
1338
|
} catch (a) {
|
|
1327
1339
|
if (this.isZodError(a))
|
|
1328
|
-
throw new
|
|
1340
|
+
throw new g(
|
|
1329
1341
|
"Failed to parse handler contract",
|
|
1330
|
-
|
|
1342
|
+
E.invalidContract(
|
|
1331
1343
|
s,
|
|
1332
1344
|
"Failed to parse handler contract",
|
|
1333
1345
|
t,
|
|
@@ -1335,9 +1347,9 @@ class Nn {
|
|
|
1335
1347
|
)
|
|
1336
1348
|
);
|
|
1337
1349
|
const c = a?.message ?? "Failed to register handler contract";
|
|
1338
|
-
throw new
|
|
1350
|
+
throw new g(
|
|
1339
1351
|
c,
|
|
1340
|
-
|
|
1352
|
+
E.illegalState(c)
|
|
1341
1353
|
);
|
|
1342
1354
|
}
|
|
1343
1355
|
}
|
|
@@ -1359,9 +1371,9 @@ class Nn {
|
|
|
1359
1371
|
}
|
|
1360
1372
|
}
|
|
1361
1373
|
if (!s)
|
|
1362
|
-
throw new
|
|
1374
|
+
throw new g(
|
|
1363
1375
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`,
|
|
1364
|
-
|
|
1376
|
+
E.illegalState(
|
|
1365
1377
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`
|
|
1366
1378
|
)
|
|
1367
1379
|
);
|
|
@@ -1371,7 +1383,7 @@ class Nn {
|
|
|
1371
1383
|
return this.builtinChannelSchemas.has(e) ? !0 : this.registry.lookupChannel(e) != null;
|
|
1372
1384
|
}
|
|
1373
1385
|
isZodError(e) {
|
|
1374
|
-
return e instanceof
|
|
1386
|
+
return e instanceof Pe;
|
|
1375
1387
|
}
|
|
1376
1388
|
}
|
|
1377
1389
|
class F extends Error {
|
|
@@ -1379,49 +1391,49 @@ class F extends Error {
|
|
|
1379
1391
|
super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
|
|
1380
1392
|
}
|
|
1381
1393
|
}
|
|
1382
|
-
const
|
|
1394
|
+
const Dn = m["Document Update Channel"], On = m["Embedded Node Channel"], Bn = m["Lifecycle Event Channel"], Ln = m["Triggered Event Channel"], Ce = m["Process Embedded"], _n = m["Processing Initialized Marker"], $n = m["Processing Terminated Marker"], xn = m["Channel Event Checkpoint"], ve = /* @__PURE__ */ new Map([
|
|
1383
1395
|
[
|
|
1384
|
-
|
|
1396
|
+
Dn,
|
|
1385
1397
|
jt
|
|
1386
1398
|
],
|
|
1387
1399
|
[
|
|
1388
|
-
|
|
1400
|
+
On,
|
|
1389
1401
|
Jt
|
|
1390
1402
|
],
|
|
1391
1403
|
[
|
|
1392
|
-
|
|
1404
|
+
Bn,
|
|
1393
1405
|
Qt
|
|
1394
1406
|
],
|
|
1395
1407
|
[
|
|
1396
|
-
|
|
1408
|
+
Ln,
|
|
1397
1409
|
Yt
|
|
1398
1410
|
]
|
|
1399
|
-
]),
|
|
1411
|
+
]), Fn = /* @__PURE__ */ new Map([
|
|
1400
1412
|
[
|
|
1401
|
-
|
|
1413
|
+
_n,
|
|
1402
1414
|
tn
|
|
1403
1415
|
],
|
|
1404
1416
|
[
|
|
1405
|
-
|
|
1417
|
+
$n,
|
|
1406
1418
|
rn
|
|
1407
1419
|
],
|
|
1408
1420
|
[
|
|
1409
|
-
|
|
1421
|
+
xn,
|
|
1410
1422
|
en
|
|
1411
1423
|
]
|
|
1412
1424
|
]);
|
|
1413
|
-
class
|
|
1425
|
+
class zn {
|
|
1414
1426
|
constructor(e, t) {
|
|
1415
|
-
this.registry = e, this.blue = t, this.handlerRegistration = new
|
|
1427
|
+
this.registry = e, this.blue = t, this.handlerRegistration = new An(
|
|
1416
1428
|
this.blue,
|
|
1417
1429
|
this.registry,
|
|
1418
|
-
|
|
1430
|
+
ve
|
|
1419
1431
|
);
|
|
1420
1432
|
}
|
|
1421
1433
|
handlerRegistration;
|
|
1422
1434
|
load(e, t) {
|
|
1423
1435
|
try {
|
|
1424
|
-
const n =
|
|
1436
|
+
const n = A.builder(), r = e.getContracts();
|
|
1425
1437
|
if (!r)
|
|
1426
1438
|
return n.build();
|
|
1427
1439
|
const s = this.buildScopeContractsIndex(r);
|
|
@@ -1429,12 +1441,12 @@ class xn {
|
|
|
1429
1441
|
a && this.processContract(n, o, a, s);
|
|
1430
1442
|
return n.build();
|
|
1431
1443
|
} catch (n) {
|
|
1432
|
-
if (n instanceof F || n instanceof
|
|
1444
|
+
if (n instanceof F || n instanceof g)
|
|
1433
1445
|
throw n;
|
|
1434
1446
|
const r = n?.message ?? "Failed to load contracts";
|
|
1435
|
-
throw new
|
|
1447
|
+
throw new g(
|
|
1436
1448
|
`Failed to load contracts for scope ${t}: ${r}`,
|
|
1437
|
-
|
|
1449
|
+
E.runtimeFatal(
|
|
1438
1450
|
`Failed to load contracts for scope ${t}`,
|
|
1439
1451
|
n
|
|
1440
1452
|
)
|
|
@@ -1445,16 +1457,16 @@ class xn {
|
|
|
1445
1457
|
const s = n.getType()?.getBlueId();
|
|
1446
1458
|
if (!s)
|
|
1447
1459
|
return;
|
|
1448
|
-
if (s ===
|
|
1460
|
+
if (s === Ce) {
|
|
1449
1461
|
this.handleProcessEmbedded(e, t, n);
|
|
1450
1462
|
return;
|
|
1451
1463
|
}
|
|
1452
|
-
const o =
|
|
1464
|
+
const o = Fn.get(s);
|
|
1453
1465
|
if (o) {
|
|
1454
1466
|
this.handleMarker(e, t, n, o, s);
|
|
1455
1467
|
return;
|
|
1456
1468
|
}
|
|
1457
|
-
const a =
|
|
1469
|
+
const a = ve.get(s);
|
|
1458
1470
|
if (a) {
|
|
1459
1471
|
this.handleChannel(e, t, n, a, s);
|
|
1460
1472
|
return;
|
|
@@ -1493,9 +1505,9 @@ class xn {
|
|
|
1493
1505
|
);
|
|
1494
1506
|
return;
|
|
1495
1507
|
}
|
|
1496
|
-
throw
|
|
1508
|
+
throw oe(s) ? new g(
|
|
1497
1509
|
"Built-in processor-managed channel is missing schema registration",
|
|
1498
|
-
|
|
1510
|
+
E.invalidContract(
|
|
1499
1511
|
s,
|
|
1500
1512
|
"Built-in processor-managed channel is missing schema registration",
|
|
1501
1513
|
t
|
|
@@ -1510,17 +1522,17 @@ class xn {
|
|
|
1510
1522
|
);
|
|
1511
1523
|
e.setEmbedded(r);
|
|
1512
1524
|
} catch (r) {
|
|
1513
|
-
throw
|
|
1525
|
+
throw X(r) ? new g(
|
|
1514
1526
|
"Failed to parse ProcessEmbedded marker",
|
|
1515
|
-
|
|
1516
|
-
|
|
1527
|
+
E.invalidContract(
|
|
1528
|
+
Ce,
|
|
1517
1529
|
"Failed to parse ProcessEmbedded marker",
|
|
1518
1530
|
t,
|
|
1519
1531
|
r
|
|
1520
1532
|
)
|
|
1521
|
-
) : new
|
|
1533
|
+
) : new g(
|
|
1522
1534
|
r?.message ?? "Failed to register ProcessEmbedded marker",
|
|
1523
|
-
|
|
1535
|
+
E.illegalState(
|
|
1524
1536
|
r?.message ?? "Failed to register ProcessEmbedded marker"
|
|
1525
1537
|
)
|
|
1526
1538
|
);
|
|
@@ -1531,10 +1543,10 @@ class xn {
|
|
|
1531
1543
|
const o = this.convert(n, r);
|
|
1532
1544
|
e.addChannel(t, o, s);
|
|
1533
1545
|
} catch (o) {
|
|
1534
|
-
if (
|
|
1535
|
-
throw new
|
|
1546
|
+
if (X(o))
|
|
1547
|
+
throw new g(
|
|
1536
1548
|
"Failed to parse channel contract",
|
|
1537
|
-
|
|
1549
|
+
E.invalidContract(
|
|
1538
1550
|
s,
|
|
1539
1551
|
"Failed to parse channel contract",
|
|
1540
1552
|
t,
|
|
@@ -1542,9 +1554,9 @@ class xn {
|
|
|
1542
1554
|
)
|
|
1543
1555
|
);
|
|
1544
1556
|
const a = o?.message ?? "Failed to register channel contract";
|
|
1545
|
-
throw new
|
|
1557
|
+
throw new g(
|
|
1546
1558
|
a,
|
|
1547
|
-
|
|
1559
|
+
E.illegalState(a)
|
|
1548
1560
|
);
|
|
1549
1561
|
}
|
|
1550
1562
|
}
|
|
@@ -1553,10 +1565,10 @@ class xn {
|
|
|
1553
1565
|
const o = this.convert(n, r);
|
|
1554
1566
|
e.addMarker(t, o, s);
|
|
1555
1567
|
} catch (o) {
|
|
1556
|
-
if (
|
|
1557
|
-
throw new
|
|
1568
|
+
if (X(o))
|
|
1569
|
+
throw new g(
|
|
1558
1570
|
"Failed to parse marker contract",
|
|
1559
|
-
|
|
1571
|
+
E.invalidContract(
|
|
1560
1572
|
s,
|
|
1561
1573
|
"Failed to parse marker contract",
|
|
1562
1574
|
t,
|
|
@@ -1564,9 +1576,9 @@ class xn {
|
|
|
1564
1576
|
)
|
|
1565
1577
|
);
|
|
1566
1578
|
const a = o?.message ?? "Failed to register marker contract";
|
|
1567
|
-
throw new
|
|
1579
|
+
throw new g(
|
|
1568
1580
|
a,
|
|
1569
|
-
|
|
1581
|
+
E.illegalState(a)
|
|
1570
1582
|
);
|
|
1571
1583
|
}
|
|
1572
1584
|
}
|
|
@@ -1584,18 +1596,18 @@ class xn {
|
|
|
1584
1596
|
return this.blue.nodeToSchemaOutput(e, t);
|
|
1585
1597
|
}
|
|
1586
1598
|
}
|
|
1587
|
-
function
|
|
1588
|
-
return i instanceof
|
|
1599
|
+
function X(i) {
|
|
1600
|
+
return i instanceof Pe;
|
|
1589
1601
|
}
|
|
1590
|
-
const
|
|
1591
|
-
function
|
|
1602
|
+
const Hn = m["Channel Event Checkpoint"];
|
|
1603
|
+
function Un(i) {
|
|
1592
1604
|
return i.jsonValueToNode({
|
|
1593
|
-
type: { blueId:
|
|
1605
|
+
type: { blueId: Hn },
|
|
1594
1606
|
lastEvents: {},
|
|
1595
1607
|
lastSignatures: {}
|
|
1596
1608
|
});
|
|
1597
1609
|
}
|
|
1598
|
-
function
|
|
1610
|
+
function Vn() {
|
|
1599
1611
|
return {
|
|
1600
1612
|
lastEvents: {},
|
|
1601
1613
|
lastSignatures: {}
|
|
@@ -1604,7 +1616,7 @@ function Hn() {
|
|
|
1604
1616
|
function ke(i) {
|
|
1605
1617
|
return i != null && Object.prototype.hasOwnProperty.call(i, "lastEvents") && Object.prototype.hasOwnProperty.call(i, "lastSignatures");
|
|
1606
1618
|
}
|
|
1607
|
-
class
|
|
1619
|
+
class Kn {
|
|
1608
1620
|
constructor(e, t, n, r, s) {
|
|
1609
1621
|
this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = s;
|
|
1610
1622
|
}
|
|
@@ -1614,15 +1626,15 @@ class Un {
|
|
|
1614
1626
|
return e != null && e === this.lastEventSignature;
|
|
1615
1627
|
}
|
|
1616
1628
|
}
|
|
1617
|
-
class
|
|
1629
|
+
class Wn {
|
|
1618
1630
|
constructor(e, t) {
|
|
1619
1631
|
this.runtime = e, this.signatureFn = t;
|
|
1620
1632
|
}
|
|
1621
1633
|
ensureCheckpointMarker(e, t) {
|
|
1622
|
-
const n = t.marker(I), r = w(e,
|
|
1634
|
+
const n = t.marker(I), r = w(e, Le);
|
|
1623
1635
|
if (!n) {
|
|
1624
|
-
const s =
|
|
1625
|
-
this.runtime.directWrite(r, s), t.registerCheckpointMarker(
|
|
1636
|
+
const s = Un(this.runtime.blue());
|
|
1637
|
+
this.runtime.directWrite(r, s), t.registerCheckpointMarker(Vn());
|
|
1626
1638
|
return;
|
|
1627
1639
|
}
|
|
1628
1640
|
if (!ke(n))
|
|
@@ -1635,7 +1647,7 @@ class Vn {
|
|
|
1635
1647
|
if (!ke(r))
|
|
1636
1648
|
continue;
|
|
1637
1649
|
const o = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(o);
|
|
1638
|
-
return new
|
|
1650
|
+
return new Kn(
|
|
1639
1651
|
n,
|
|
1640
1652
|
r,
|
|
1641
1653
|
t,
|
|
@@ -1653,17 +1665,17 @@ class Vn {
|
|
|
1653
1665
|
return;
|
|
1654
1666
|
const o = w(
|
|
1655
1667
|
e,
|
|
1656
|
-
|
|
1668
|
+
xe(n.markerKey, n.channelKey)
|
|
1657
1669
|
), a = s?.clone() ?? null;
|
|
1658
1670
|
this.runtime.gasMeter().chargeCheckpointUpdate(), this.runtime.directWrite(o, a), n.checkpoint.lastEvents || (n.checkpoint.lastEvents = {}), a ? n.checkpoint.lastEvents[n.channelKey] = a.clone() ?? null : delete n.checkpoint.lastEvents[n.channelKey], n.lastEventNode = a?.clone() ?? null;
|
|
1659
1671
|
const c = w(
|
|
1660
1672
|
e,
|
|
1661
|
-
|
|
1673
|
+
Fe(n.markerKey, n.channelKey)
|
|
1662
1674
|
), l = r == null ? null : new d().setValue(r);
|
|
1663
1675
|
this.runtime.directWrite(c, l), n.checkpoint.lastSignatures || (n.checkpoint.lastSignatures = {}), r == null ? delete n.checkpoint.lastSignatures[n.channelKey] : n.checkpoint.lastSignatures[n.channelKey] = r, n.lastEventSignature = r ?? null;
|
|
1664
1676
|
}
|
|
1665
1677
|
}
|
|
1666
|
-
class
|
|
1678
|
+
class Gn {
|
|
1667
1679
|
constructor(e, t, n) {
|
|
1668
1680
|
this.runtime = e, this.checkpointManager = t, this.deps = n;
|
|
1669
1681
|
}
|
|
@@ -1671,32 +1683,32 @@ class Kn {
|
|
|
1671
1683
|
if (this.deps.isScopeInactive(e))
|
|
1672
1684
|
return;
|
|
1673
1685
|
this.runtime.gasMeter().chargeChannelMatchAttempt();
|
|
1674
|
-
const s = await this.deps.evaluateChannel(
|
|
1686
|
+
const s = r, o = await this.deps.evaluateChannel(
|
|
1675
1687
|
n,
|
|
1676
1688
|
t,
|
|
1677
1689
|
e,
|
|
1678
1690
|
r
|
|
1679
1691
|
);
|
|
1680
|
-
if (!
|
|
1692
|
+
if (!o.matches)
|
|
1681
1693
|
return;
|
|
1682
|
-
const
|
|
1694
|
+
const a = o.eventNode ?? r;
|
|
1683
1695
|
this.checkpointManager.ensureCheckpointMarker(e, t);
|
|
1684
1696
|
const c = this.checkpointManager.findCheckpoint(
|
|
1685
1697
|
t,
|
|
1686
1698
|
n.key()
|
|
1687
|
-
), l =
|
|
1699
|
+
), l = o.eventId ?? this.deps.canonicalSignature(s);
|
|
1688
1700
|
this.checkpointManager.isDuplicate(c, l) || (await this.runHandlers(
|
|
1689
1701
|
e,
|
|
1690
1702
|
t,
|
|
1691
1703
|
n.key(),
|
|
1692
|
-
|
|
1704
|
+
a,
|
|
1693
1705
|
!1
|
|
1694
1706
|
), !this.deps.isScopeInactive(e) && this.checkpointManager.persist(
|
|
1695
1707
|
e,
|
|
1696
1708
|
t,
|
|
1697
1709
|
c,
|
|
1698
1710
|
l ?? null,
|
|
1699
|
-
|
|
1711
|
+
s
|
|
1700
1712
|
));
|
|
1701
1713
|
}
|
|
1702
1714
|
async runHandlers(e, t, n, r, s) {
|
|
@@ -1723,18 +1735,21 @@ class Kn {
|
|
|
1723
1735
|
}
|
|
1724
1736
|
}
|
|
1725
1737
|
}
|
|
1726
|
-
|
|
1738
|
+
function qn(i, e) {
|
|
1739
|
+
return e.isResolved() ? i.createResolvedNode(e) : i.resolve(e);
|
|
1740
|
+
}
|
|
1741
|
+
class M extends g {
|
|
1727
1742
|
constructor(e) {
|
|
1728
|
-
super(e,
|
|
1743
|
+
super(e, E.illegalState(e)), this.name = "IllegalStateException";
|
|
1729
1744
|
}
|
|
1730
1745
|
}
|
|
1731
|
-
class
|
|
1746
|
+
class P extends Error {
|
|
1732
1747
|
constructor(e) {
|
|
1733
1748
|
super(e), this.name = "BoundaryViolationException";
|
|
1734
1749
|
}
|
|
1735
1750
|
}
|
|
1736
|
-
const
|
|
1737
|
-
class
|
|
1751
|
+
const jn = m["Document Update Channel"], Jn = m["Embedded Node Channel"], Qn = m["Triggered Event Channel"], Yn = m["Lifecycle Event Channel"], Ie = m["Processing Initialized Marker"], Zn = m["Document Processing Initiated"];
|
|
1752
|
+
class Xn {
|
|
1738
1753
|
runtime;
|
|
1739
1754
|
contractLoader;
|
|
1740
1755
|
channelRunner;
|
|
@@ -1751,22 +1766,22 @@ class Qn {
|
|
|
1751
1766
|
const n = y(e), r = /* @__PURE__ */ new Set();
|
|
1752
1767
|
let s = null, o = null;
|
|
1753
1768
|
for (t && this.runtime.gasMeter().chargeScopeEntry(n); ; ) {
|
|
1754
|
-
const
|
|
1755
|
-
if (!h)
|
|
1756
|
-
return;
|
|
1757
|
-
o || (o = h.clone()), s = this.loadBundle(h, n), this.bundles.set(n, s);
|
|
1758
|
-
const f = s.embeddedPaths().find((Ze) => !r.has(Ze)) ?? null;
|
|
1769
|
+
const f = this.nodeAt(n);
|
|
1759
1770
|
if (!f)
|
|
1771
|
+
return;
|
|
1772
|
+
o || (o = f.clone()), s = this.loadBundle(f, n), this.bundles.set(n, s);
|
|
1773
|
+
const h = s.embeddedPaths().find((Y) => !r.has(Y)) ?? null;
|
|
1774
|
+
if (!h)
|
|
1760
1775
|
break;
|
|
1761
|
-
r.add(
|
|
1762
|
-
const
|
|
1763
|
-
this.nodeAt(
|
|
1776
|
+
r.add(h);
|
|
1777
|
+
const p = w(n, h);
|
|
1778
|
+
this.nodeAt(p) && await this.initializeScope(p, !0);
|
|
1764
1779
|
}
|
|
1765
1780
|
if (!s)
|
|
1766
1781
|
return;
|
|
1767
1782
|
const a = this.hasInitializationMarker(n);
|
|
1768
1783
|
if (!a && s.hasCheckpoint())
|
|
1769
|
-
throw new
|
|
1784
|
+
throw new M(
|
|
1770
1785
|
`Reserved key 'checkpoint' must not appear before initialization at scope ${n}`
|
|
1771
1786
|
);
|
|
1772
1787
|
if (a)
|
|
@@ -1785,7 +1800,7 @@ class Qn {
|
|
|
1785
1800
|
const t = y(e);
|
|
1786
1801
|
if (this.bundles.has(t))
|
|
1787
1802
|
return;
|
|
1788
|
-
const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) :
|
|
1803
|
+
const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : A.empty();
|
|
1789
1804
|
this.bundles.set(t, r);
|
|
1790
1805
|
for (const s of r.embeddedPaths()) {
|
|
1791
1806
|
const o = w(t, s);
|
|
@@ -1793,6 +1808,10 @@ class Qn {
|
|
|
1793
1808
|
}
|
|
1794
1809
|
}
|
|
1795
1810
|
async processExternalEvent(e, t) {
|
|
1811
|
+
const n = qn(this.runtime.blue(), t);
|
|
1812
|
+
await this.processPreparedExternalEvent(e, n);
|
|
1813
|
+
}
|
|
1814
|
+
async processPreparedExternalEvent(e, t) {
|
|
1796
1815
|
const n = y(e);
|
|
1797
1816
|
if (this.hooks.isScopeInactive(n))
|
|
1798
1817
|
return;
|
|
@@ -1808,7 +1827,7 @@ class Qn {
|
|
|
1808
1827
|
for (const o of s) {
|
|
1809
1828
|
if (this.hooks.isScopeInactive(n))
|
|
1810
1829
|
break;
|
|
1811
|
-
|
|
1830
|
+
oe(o.blueId()) || await this.channelRunner.runExternalChannel(
|
|
1812
1831
|
n,
|
|
1813
1832
|
r,
|
|
1814
1833
|
o,
|
|
@@ -1827,7 +1846,7 @@ class Qn {
|
|
|
1827
1846
|
r
|
|
1828
1847
|
);
|
|
1829
1848
|
} catch (s) {
|
|
1830
|
-
if (s instanceof
|
|
1849
|
+
if (s instanceof P) {
|
|
1831
1850
|
const o = this.hooks.fatalReason(s, "Boundary violation");
|
|
1832
1851
|
await this.hooks.enterFatalTermination(e, t, o);
|
|
1833
1852
|
return;
|
|
@@ -1855,13 +1874,13 @@ class Qn {
|
|
|
1855
1874
|
if (!a || this.hooks.isScopeInactive(o))
|
|
1856
1875
|
continue;
|
|
1857
1876
|
const c = this.createDocumentUpdateEvent(s, o), l = a.channelsOfType(
|
|
1858
|
-
|
|
1877
|
+
jn
|
|
1859
1878
|
);
|
|
1860
1879
|
for (const u of l) {
|
|
1861
|
-
const
|
|
1880
|
+
const f = u.contract();
|
|
1862
1881
|
if (this.matchesDocumentUpdate(
|
|
1863
1882
|
o,
|
|
1864
|
-
|
|
1883
|
+
f.path ?? null,
|
|
1865
1884
|
s.path
|
|
1866
1885
|
) && (await this.channelRunner.runHandlers(
|
|
1867
1886
|
o,
|
|
@@ -1874,12 +1893,12 @@ class Qn {
|
|
|
1874
1893
|
}
|
|
1875
1894
|
}
|
|
1876
1895
|
} catch (s) {
|
|
1877
|
-
if (s instanceof
|
|
1896
|
+
if (s instanceof P) {
|
|
1878
1897
|
const o = this.hooks.fatalReason(s, "Boundary violation");
|
|
1879
1898
|
await this.hooks.enterFatalTermination(e, t, o);
|
|
1880
1899
|
return;
|
|
1881
1900
|
}
|
|
1882
|
-
if (s instanceof
|
|
1901
|
+
if (s instanceof M || s instanceof Error && !(s instanceof g)) {
|
|
1883
1902
|
const o = this.hooks.fatalReason(s, "Runtime fatal");
|
|
1884
1903
|
await this.hooks.enterFatalTermination(e, t, o);
|
|
1885
1904
|
return;
|
|
@@ -1892,7 +1911,7 @@ class Qn {
|
|
|
1892
1911
|
if (this.runtime.gasMeter().chargeLifecycleDelivery(), await this.hooks.recordLifecycleForBridging(e, n), !t)
|
|
1893
1912
|
return;
|
|
1894
1913
|
const s = t.channelsOfType(
|
|
1895
|
-
|
|
1914
|
+
Yn
|
|
1896
1915
|
);
|
|
1897
1916
|
for (const o of s)
|
|
1898
1917
|
if (await this.channelRunner.runHandlers(
|
|
@@ -1918,7 +1937,7 @@ class Qn {
|
|
|
1918
1937
|
s = this.refreshBundle(n);
|
|
1919
1938
|
continue;
|
|
1920
1939
|
}
|
|
1921
|
-
this.nodeAt(a) && (await this.initializeScope(a, !1), await this.
|
|
1940
|
+
this.nodeAt(a) && (await this.initializeScope(a, !1), await this.processPreparedExternalEvent(a, t)), s = this.refreshBundle(n);
|
|
1922
1941
|
}
|
|
1923
1942
|
return null;
|
|
1924
1943
|
}
|
|
@@ -1941,12 +1960,12 @@ class Qn {
|
|
|
1941
1960
|
try {
|
|
1942
1961
|
return this.contractLoader.load(e, t);
|
|
1943
1962
|
} catch (n) {
|
|
1944
|
-
if (n instanceof
|
|
1963
|
+
if (n instanceof g || n instanceof F)
|
|
1945
1964
|
throw n;
|
|
1946
1965
|
const r = n?.message ?? "Failed to load contracts";
|
|
1947
|
-
throw new
|
|
1966
|
+
throw new g(
|
|
1948
1967
|
r,
|
|
1949
|
-
|
|
1968
|
+
E.runtimeFatal(
|
|
1950
1969
|
`Failed to load contracts for scope ${t}`,
|
|
1951
1970
|
n
|
|
1952
1971
|
)
|
|
@@ -1954,7 +1973,7 @@ class Qn {
|
|
|
1954
1973
|
}
|
|
1955
1974
|
}
|
|
1956
1975
|
async addInitializationMarker(e, t) {
|
|
1957
|
-
const n = new d().setType(new d().setBlueId(Ie)).addProperty("documentId", new d().setValue(t)), r = e.resolvePointer(
|
|
1976
|
+
const n = new d().setType(new d().setBlueId(Ie)).addProperty("documentId", new d().setValue(t)), r = e.resolvePointer(re);
|
|
1958
1977
|
await e.applyPatch({
|
|
1959
1978
|
op: "ADD",
|
|
1960
1979
|
path: r,
|
|
@@ -1968,7 +1987,7 @@ class Qn {
|
|
|
1968
1987
|
if (this.hooks.isScopeInactive(e) || t.embeddedPaths().length === 0)
|
|
1969
1988
|
return;
|
|
1970
1989
|
const n = t.channelsOfType(
|
|
1971
|
-
|
|
1990
|
+
Jn
|
|
1972
1991
|
);
|
|
1973
1992
|
if (n.length !== 0)
|
|
1974
1993
|
for (const r of t.embeddedPaths()) {
|
|
@@ -1977,8 +1996,8 @@ class Qn {
|
|
|
1977
1996
|
for (const c of a) {
|
|
1978
1997
|
let l = !1;
|
|
1979
1998
|
for (const u of n) {
|
|
1980
|
-
const
|
|
1981
|
-
w(e,
|
|
1999
|
+
const h = u.contract().childPath ?? "/";
|
|
2000
|
+
w(e, h) === s && (l || (this.runtime.gasMeter().chargeBridge(), l = !0), await this.channelRunner.runHandlers(
|
|
1982
2001
|
e,
|
|
1983
2002
|
t,
|
|
1984
2003
|
u.key(),
|
|
@@ -1993,7 +2012,7 @@ class Qn {
|
|
|
1993
2012
|
if (this.hooks.isScopeInactive(e))
|
|
1994
2013
|
return;
|
|
1995
2014
|
const n = this.runtime.scope(e), r = t.channelsOfType(
|
|
1996
|
-
|
|
2015
|
+
Qn
|
|
1997
2016
|
);
|
|
1998
2017
|
if (r.length === 0) {
|
|
1999
2018
|
n.clearTriggered();
|
|
@@ -2025,17 +2044,17 @@ class Qn {
|
|
|
2025
2044
|
validatePatchBoundary(e, t, n) {
|
|
2026
2045
|
const r = y(e), s = b(n.path);
|
|
2027
2046
|
if (s === r)
|
|
2028
|
-
throw new
|
|
2047
|
+
throw new P(
|
|
2029
2048
|
`Self-root mutation is forbidden at scope ${r}`
|
|
2030
2049
|
);
|
|
2031
2050
|
if (r !== "/" && !s.startsWith(`${r}/`))
|
|
2032
|
-
throw new
|
|
2051
|
+
throw new P(
|
|
2033
2052
|
`Patch path ${s} is outside scope ${r}`
|
|
2034
2053
|
);
|
|
2035
2054
|
for (const o of t.embeddedPaths()) {
|
|
2036
2055
|
const a = w(r, o);
|
|
2037
2056
|
if (s.startsWith(`${a}/`))
|
|
2038
|
-
throw new
|
|
2057
|
+
throw new P(
|
|
2039
2058
|
`Boundary violation: patch ${s} enters embedded scope ${a}`
|
|
2040
2059
|
);
|
|
2041
2060
|
}
|
|
@@ -2044,13 +2063,13 @@ class Qn {
|
|
|
2044
2063
|
if (n)
|
|
2045
2064
|
return;
|
|
2046
2065
|
const r = y(e), s = b(t.path);
|
|
2047
|
-
for (const o of
|
|
2066
|
+
for (const o of se) {
|
|
2048
2067
|
const a = w(
|
|
2049
2068
|
r,
|
|
2050
2069
|
J(o)
|
|
2051
2070
|
);
|
|
2052
2071
|
if (s === a || s.startsWith(`${a}/`))
|
|
2053
|
-
throw new
|
|
2072
|
+
throw new P(
|
|
2054
2073
|
`Reserved key '${o}' is write-protected at ${a}`
|
|
2055
2074
|
);
|
|
2056
2075
|
}
|
|
@@ -2065,21 +2084,21 @@ class Qn {
|
|
|
2065
2084
|
}
|
|
2066
2085
|
}
|
|
2067
2086
|
hasInitializationMarker(e) {
|
|
2068
|
-
const t = w(e,
|
|
2087
|
+
const t = w(e, re), n = this.nodeAt(t);
|
|
2069
2088
|
if (!n)
|
|
2070
2089
|
return !1;
|
|
2071
2090
|
if (!(n instanceof d)) {
|
|
2072
2091
|
const s = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
|
|
2073
|
-
throw new
|
|
2092
|
+
throw new M(s);
|
|
2074
2093
|
}
|
|
2075
2094
|
if (n.getType()?.getBlueId() !== Ie) {
|
|
2076
2095
|
const s = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
|
|
2077
|
-
throw new
|
|
2096
|
+
throw new M(s);
|
|
2078
2097
|
}
|
|
2079
2098
|
return !0;
|
|
2080
2099
|
}
|
|
2081
2100
|
createLifecycleEvent(e) {
|
|
2082
|
-
return new d().setType(new d().setBlueId(
|
|
2101
|
+
return new d().setType(new d().setBlueId(Zn)).setProperties({
|
|
2083
2102
|
type: new d().setValue("Document Processing Initiated"),
|
|
2084
2103
|
documentId: new d().setValue(e)
|
|
2085
2104
|
});
|
|
@@ -2092,19 +2111,19 @@ class q extends Error {
|
|
|
2092
2111
|
), this.fatal = e, this.name = "RunTerminationError";
|
|
2093
2112
|
}
|
|
2094
2113
|
}
|
|
2095
|
-
const
|
|
2096
|
-
class
|
|
2114
|
+
const er = m["Processing Terminated Marker"], tr = m["Document Processing Terminated"];
|
|
2115
|
+
class nr {
|
|
2097
2116
|
constructor(e) {
|
|
2098
2117
|
this.runtime = e;
|
|
2099
2118
|
}
|
|
2100
2119
|
async terminateScope(e, t, n, r, s) {
|
|
2101
2120
|
e.recordPendingTermination(t, r, s ?? null);
|
|
2102
|
-
const o = e.normalizeScope(t), a = w(o,
|
|
2121
|
+
const o = e.normalizeScope(t), a = w(o, Be);
|
|
2103
2122
|
this.runtime.directWrite(
|
|
2104
2123
|
a,
|
|
2105
|
-
|
|
2124
|
+
rr(this.runtime.blue(), r, s)
|
|
2106
2125
|
), this.runtime.gasMeter().chargeTerminationMarker();
|
|
2107
|
-
const c = n ?? e.bundleForScope(o) ?? null, l =
|
|
2126
|
+
const c = n ?? e.bundleForScope(o) ?? null, l = ir(r, s);
|
|
2108
2127
|
if (await e.deliverLifecycle(
|
|
2109
2128
|
o,
|
|
2110
2129
|
c,
|
|
@@ -2116,32 +2135,32 @@ class Xn {
|
|
|
2116
2135
|
throw this.runtime.markRunTerminated(), new q(!1);
|
|
2117
2136
|
}
|
|
2118
2137
|
}
|
|
2119
|
-
function
|
|
2120
|
-
return
|
|
2121
|
-
type: { blueId:
|
|
2138
|
+
function rr(i, e, t) {
|
|
2139
|
+
return sr(i, {
|
|
2140
|
+
type: { blueId: er },
|
|
2122
2141
|
cause: e === "GRACEFUL" ? "graceful" : "fatal",
|
|
2123
2142
|
...t ? { reason: t } : {}
|
|
2124
2143
|
});
|
|
2125
2144
|
}
|
|
2126
|
-
function
|
|
2145
|
+
function ir(i, e) {
|
|
2127
2146
|
const t = new d().setType(
|
|
2128
|
-
new d().setBlueId(
|
|
2147
|
+
new d().setBlueId(tr)
|
|
2129
2148
|
);
|
|
2130
2149
|
return t.addProperty(
|
|
2131
2150
|
"cause",
|
|
2132
2151
|
new d().setValue(i === "GRACEFUL" ? "graceful" : "fatal")
|
|
2133
2152
|
), e && t.addProperty("reason", new d().setValue(e)), t;
|
|
2134
2153
|
}
|
|
2135
|
-
function
|
|
2154
|
+
function sr(i, e) {
|
|
2136
2155
|
return i.jsonValueToNode(e);
|
|
2137
2156
|
}
|
|
2138
2157
|
const $ = "-";
|
|
2139
|
-
class
|
|
2158
|
+
class or {
|
|
2140
2159
|
constructor(e) {
|
|
2141
2160
|
this.document = e;
|
|
2142
2161
|
}
|
|
2143
2162
|
applyPatch(e, t) {
|
|
2144
|
-
const n = y(e), r = b(t.path), s =
|
|
2163
|
+
const n = y(e), r = b(t.path), s = Te(r), o = Re(this.document, s, "before", r);
|
|
2145
2164
|
switch (t.op) {
|
|
2146
2165
|
case "ADD":
|
|
2147
2166
|
this.applyAdd(s, r, t.val ?? null);
|
|
@@ -2153,34 +2172,34 @@ class rr {
|
|
|
2153
2172
|
this.applyRemove(s, r);
|
|
2154
2173
|
break;
|
|
2155
2174
|
}
|
|
2156
|
-
const a = t.op === "REMOVE" ? null :
|
|
2175
|
+
const a = t.op === "REMOVE" ? null : Re(this.document, s, "after", r);
|
|
2157
2176
|
return {
|
|
2158
2177
|
path: r,
|
|
2159
2178
|
before: o,
|
|
2160
2179
|
after: a,
|
|
2161
2180
|
op: t.op.toLowerCase(),
|
|
2162
2181
|
originScope: n,
|
|
2163
|
-
cascadeScopes:
|
|
2182
|
+
cascadeScopes: ar(n)
|
|
2164
2183
|
};
|
|
2165
2184
|
}
|
|
2166
2185
|
directWrite(e, t) {
|
|
2167
2186
|
const n = b(e);
|
|
2168
2187
|
if (n === "/")
|
|
2169
2188
|
throw new Error("Direct write cannot target root document");
|
|
2170
|
-
const r =
|
|
2189
|
+
const r = Te(n), { parent: s, leaf: o } = this.resolveParent(r);
|
|
2171
2190
|
if (o === $)
|
|
2172
2191
|
throw new Error(
|
|
2173
2192
|
`Direct write does not support append token '-' for path ${n}`
|
|
2174
2193
|
);
|
|
2175
2194
|
const a = s.getItems();
|
|
2176
|
-
if (a &&
|
|
2195
|
+
if (a && N(o)) {
|
|
2177
2196
|
this.directWriteArray(s, a, o, t, n);
|
|
2178
2197
|
return;
|
|
2179
2198
|
}
|
|
2180
2199
|
this.directWriteObject(s, o, t);
|
|
2181
2200
|
}
|
|
2182
2201
|
directWriteArray(e, t, n, r, s) {
|
|
2183
|
-
const o =
|
|
2202
|
+
const o = ee(e, t), a = v(n, s);
|
|
2184
2203
|
if (r == null) {
|
|
2185
2204
|
if (a < 0 || a >= o.length)
|
|
2186
2205
|
return;
|
|
@@ -2226,8 +2245,8 @@ class rr {
|
|
|
2226
2245
|
`Append token '-' must be final segment: ${B(n, r)}`
|
|
2227
2246
|
);
|
|
2228
2247
|
const s = e.getItems();
|
|
2229
|
-
if (s &&
|
|
2230
|
-
const c =
|
|
2248
|
+
if (s && N(t)) {
|
|
2249
|
+
const c = v(t, B(n, r));
|
|
2231
2250
|
if (c < 0 || c >= s.length)
|
|
2232
2251
|
throw new Error(
|
|
2233
2252
|
`Array index out of bounds: ${B(n, r)}`
|
|
@@ -2252,20 +2271,20 @@ class rr {
|
|
|
2252
2271
|
"ADD"
|
|
2253
2272
|
);
|
|
2254
2273
|
try {
|
|
2255
|
-
if (
|
|
2274
|
+
if (N(s)) {
|
|
2256
2275
|
const l = r.getItems(), u = s === $;
|
|
2257
2276
|
if (!l)
|
|
2258
2277
|
throw new Error(
|
|
2259
2278
|
u ? `Append token '-' requires array at ${o}` : `Array index segment requires array at ${o}`
|
|
2260
2279
|
);
|
|
2261
2280
|
if (u) {
|
|
2262
|
-
|
|
2281
|
+
ee(r, l).push(L(n));
|
|
2263
2282
|
return;
|
|
2264
2283
|
}
|
|
2265
|
-
const
|
|
2266
|
-
if (
|
|
2284
|
+
const f = v(s, t);
|
|
2285
|
+
if (f < 0 || f > l.length)
|
|
2267
2286
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2268
|
-
|
|
2287
|
+
ee(r, l).splice(f, 0, L(n));
|
|
2269
2288
|
return;
|
|
2270
2289
|
}
|
|
2271
2290
|
const c = K(r);
|
|
@@ -2283,11 +2302,11 @@ class rr {
|
|
|
2283
2302
|
"REPLACE"
|
|
2284
2303
|
);
|
|
2285
2304
|
try {
|
|
2286
|
-
if (
|
|
2305
|
+
if (N(s)) {
|
|
2287
2306
|
const c = r.getItems();
|
|
2288
2307
|
if (!c)
|
|
2289
2308
|
throw new Error(`Array index segment requires array at ${t}`);
|
|
2290
|
-
const l =
|
|
2309
|
+
const l = v(s, t);
|
|
2291
2310
|
if (l < 0 || l >= c.length)
|
|
2292
2311
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2293
2312
|
c[l] = L(n), r.setItems(c);
|
|
@@ -2307,11 +2326,11 @@ class rr {
|
|
|
2307
2326
|
t,
|
|
2308
2327
|
"REMOVE"
|
|
2309
2328
|
);
|
|
2310
|
-
if (
|
|
2329
|
+
if (N(r)) {
|
|
2311
2330
|
const a = n.getItems();
|
|
2312
2331
|
if (!a)
|
|
2313
2332
|
throw new Error(`Array index segment requires array at ${t}`);
|
|
2314
|
-
const c =
|
|
2333
|
+
const c = v(r, t);
|
|
2315
2334
|
if (c < 0 || c >= a.length)
|
|
2316
2335
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2317
2336
|
a.splice(c, 1), n.setItems(a);
|
|
@@ -2330,26 +2349,26 @@ class rr {
|
|
|
2330
2349
|
const s = [];
|
|
2331
2350
|
for (let a = 0; a < e.length - 1; a += 1) {
|
|
2332
2351
|
const c = e[a], l = B(e, a + 1);
|
|
2333
|
-
if (
|
|
2334
|
-
const
|
|
2335
|
-
if (!
|
|
2352
|
+
if (N(c)) {
|
|
2353
|
+
const h = r.getItems();
|
|
2354
|
+
if (!h)
|
|
2336
2355
|
throw new Error(`Array index segment requires array at ${l}`);
|
|
2337
|
-
const
|
|
2338
|
-
if (
|
|
2356
|
+
const p = v(c, l);
|
|
2357
|
+
if (p < 0 || p >= h.length)
|
|
2339
2358
|
throw new Error(`Array index out of bounds in path: ${l}`);
|
|
2340
|
-
const
|
|
2341
|
-
if (!(
|
|
2359
|
+
const C = h[p];
|
|
2360
|
+
if (!(C instanceof d))
|
|
2342
2361
|
throw new Error(`Array index out of bounds in path: ${l}`);
|
|
2343
|
-
r =
|
|
2362
|
+
r = C;
|
|
2344
2363
|
continue;
|
|
2345
2364
|
}
|
|
2346
|
-
let u = r.getProperties(),
|
|
2347
|
-
if (!(
|
|
2365
|
+
let u = r.getProperties(), f = u?.[c] ?? null;
|
|
2366
|
+
if (!(f instanceof d)) {
|
|
2348
2367
|
if (n === "REMOVE")
|
|
2349
2368
|
throw new Error(`Path does not exist: ${l}`);
|
|
2350
|
-
|
|
2369
|
+
f = new d(), u || (u = {}), u[c] = f, r.setProperties(u), s.push({ owner: r, key: c });
|
|
2351
2370
|
}
|
|
2352
|
-
r =
|
|
2371
|
+
r = f;
|
|
2353
2372
|
}
|
|
2354
2373
|
const o = e[e.length - 1];
|
|
2355
2374
|
return { parent: r, key: o, pointer: t, created: s };
|
|
@@ -2361,7 +2380,7 @@ class rr {
|
|
|
2361
2380
|
}
|
|
2362
2381
|
}
|
|
2363
2382
|
}
|
|
2364
|
-
function
|
|
2383
|
+
function ar(i) {
|
|
2365
2384
|
const e = [];
|
|
2366
2385
|
let t = i;
|
|
2367
2386
|
for (; e.push(t), t !== "/"; ) {
|
|
@@ -2370,26 +2389,26 @@ function ir(i) {
|
|
|
2370
2389
|
}
|
|
2371
2390
|
return e;
|
|
2372
2391
|
}
|
|
2373
|
-
function
|
|
2392
|
+
function Re(i, e, t, n) {
|
|
2374
2393
|
try {
|
|
2375
2394
|
if (e.length === 0)
|
|
2376
2395
|
return i.clone();
|
|
2377
|
-
const r =
|
|
2396
|
+
const r = cr(i, e, t, n);
|
|
2378
2397
|
return r ? r.clone() : null;
|
|
2379
2398
|
} catch {
|
|
2380
2399
|
return null;
|
|
2381
2400
|
}
|
|
2382
2401
|
}
|
|
2383
|
-
function
|
|
2402
|
+
function cr(i, e, t, n) {
|
|
2384
2403
|
let r = i;
|
|
2385
2404
|
for (let s = 0; s < e.length; s += 1) {
|
|
2386
2405
|
const o = e[s] ?? "", a = s === e.length - 1;
|
|
2387
|
-
if (r =
|
|
2406
|
+
if (r = lr(r, o, a, t, n), !r)
|
|
2388
2407
|
return null;
|
|
2389
2408
|
}
|
|
2390
2409
|
return r;
|
|
2391
2410
|
}
|
|
2392
|
-
function
|
|
2411
|
+
function lr(i, e, t, n, r) {
|
|
2393
2412
|
if (!i)
|
|
2394
2413
|
return null;
|
|
2395
2414
|
const s = i.getItems();
|
|
@@ -2399,7 +2418,7 @@ function or(i, e, t, n, r) {
|
|
|
2399
2418
|
throw new Error(`Append token '-' must be final segment: ${r}`);
|
|
2400
2419
|
return n === "before" || s.length === 0 ? null : s[s.length - 1] ?? null;
|
|
2401
2420
|
}
|
|
2402
|
-
const c =
|
|
2421
|
+
const c = v(e, r);
|
|
2403
2422
|
return c < 0 || c >= s.length ? null : s[c] ?? null;
|
|
2404
2423
|
}
|
|
2405
2424
|
const o = i.getProperties();
|
|
@@ -2408,13 +2427,13 @@ function or(i, e, t, n, r) {
|
|
|
2408
2427
|
const a = o[e];
|
|
2409
2428
|
return a instanceof d ? a : null;
|
|
2410
2429
|
}
|
|
2411
|
-
function
|
|
2430
|
+
function Te(i) {
|
|
2412
2431
|
if (i === "/" || i === "")
|
|
2413
2432
|
return [];
|
|
2414
2433
|
const e = i.startsWith("/") ? i.slice(1) : i;
|
|
2415
2434
|
return e.length === 0 ? [] : e.split("/");
|
|
2416
2435
|
}
|
|
2417
|
-
function
|
|
2436
|
+
function v(i, e) {
|
|
2418
2437
|
const t = Number.parseInt(i, 10);
|
|
2419
2438
|
if (Number.isNaN(t))
|
|
2420
2439
|
throw new Error(`Expected numeric array index in path: ${e}`);
|
|
@@ -2431,7 +2450,7 @@ function B(i, e) {
|
|
|
2431
2450
|
n += `/${i[r] ?? ""}`;
|
|
2432
2451
|
return n === "" ? "/" : n;
|
|
2433
2452
|
}
|
|
2434
|
-
function
|
|
2453
|
+
function ee(i, e) {
|
|
2435
2454
|
const t = [...e];
|
|
2436
2455
|
return i.setItems(t), t;
|
|
2437
2456
|
}
|
|
@@ -2444,13 +2463,13 @@ function K(i) {
|
|
|
2444
2463
|
const t = { ...e };
|
|
2445
2464
|
return i.setProperties(t), t;
|
|
2446
2465
|
}
|
|
2447
|
-
function
|
|
2466
|
+
function N(i) {
|
|
2448
2467
|
return i === $ || /^\d+$/.test(i);
|
|
2449
2468
|
}
|
|
2450
2469
|
function L(i) {
|
|
2451
2470
|
return i == null ? new d().setValue(null) : i.clone();
|
|
2452
2471
|
}
|
|
2453
|
-
class
|
|
2472
|
+
class ur {
|
|
2454
2473
|
constructor(e) {
|
|
2455
2474
|
this.path = e;
|
|
2456
2475
|
}
|
|
@@ -2512,7 +2531,7 @@ class ar {
|
|
|
2512
2531
|
return this.cutOff;
|
|
2513
2532
|
}
|
|
2514
2533
|
}
|
|
2515
|
-
class
|
|
2534
|
+
class dr {
|
|
2516
2535
|
scopesMap = /* @__PURE__ */ new Map();
|
|
2517
2536
|
rootEmissionList = [];
|
|
2518
2537
|
scopes() {
|
|
@@ -2520,7 +2539,7 @@ class cr {
|
|
|
2520
2539
|
}
|
|
2521
2540
|
scope(e) {
|
|
2522
2541
|
let t = this.scopesMap.get(e);
|
|
2523
|
-
return t || (t = new
|
|
2542
|
+
return t || (t = new ur(e), this.scopesMap.set(e, t)), t;
|
|
2524
2543
|
}
|
|
2525
2544
|
existingScope(e) {
|
|
2526
2545
|
return this.scopesMap.get(e);
|
|
@@ -2541,42 +2560,42 @@ class cr {
|
|
|
2541
2560
|
function U(i) {
|
|
2542
2561
|
return Math.floor((i + 99) / 100);
|
|
2543
2562
|
}
|
|
2544
|
-
function
|
|
2563
|
+
function de(i) {
|
|
2545
2564
|
return new TextEncoder().encode(i).length;
|
|
2546
2565
|
}
|
|
2547
|
-
function
|
|
2566
|
+
function hr(i) {
|
|
2548
2567
|
const e = b(i);
|
|
2549
2568
|
return e === "/" ? 0 : e.split("/").length - 1;
|
|
2550
2569
|
}
|
|
2551
|
-
function
|
|
2552
|
-
return 100 + U(
|
|
2570
|
+
function fr(i) {
|
|
2571
|
+
return 100 + U(de(i));
|
|
2553
2572
|
}
|
|
2554
|
-
function
|
|
2573
|
+
function pr(i) {
|
|
2555
2574
|
return 40 + 5 * Math.max(0, i);
|
|
2556
2575
|
}
|
|
2557
|
-
function
|
|
2558
|
-
return 5 + U(
|
|
2576
|
+
function mr(i) {
|
|
2577
|
+
return 5 + U(de(i));
|
|
2559
2578
|
}
|
|
2560
|
-
function
|
|
2561
|
-
return 3 * Math.max(0, i) + U(
|
|
2579
|
+
function gr(i, e) {
|
|
2580
|
+
return 3 * Math.max(0, i) + U(de(e));
|
|
2562
2581
|
}
|
|
2563
|
-
function
|
|
2564
|
-
return 8 +
|
|
2582
|
+
function Er(i, e) {
|
|
2583
|
+
return 8 + hr(i) + U(e);
|
|
2565
2584
|
}
|
|
2566
|
-
const
|
|
2567
|
-
function
|
|
2585
|
+
const yr = 1e3, wr = 5, br = 50, Sr = 2, Cr = 10, vr = 10, kr = 10, Ir = 20, Rr = 20, Tr = 30, Pr = 30, Nr = 100;
|
|
2586
|
+
function Mr(i) {
|
|
2568
2587
|
return 50 + 10 * i;
|
|
2569
2588
|
}
|
|
2570
|
-
function
|
|
2589
|
+
function Ar(i) {
|
|
2571
2590
|
return 20 + i;
|
|
2572
2591
|
}
|
|
2573
|
-
function
|
|
2592
|
+
function Dr(i) {
|
|
2574
2593
|
return 10 * i;
|
|
2575
2594
|
}
|
|
2576
|
-
function
|
|
2595
|
+
function Or(i) {
|
|
2577
2596
|
return 20 + i;
|
|
2578
2597
|
}
|
|
2579
|
-
class
|
|
2598
|
+
class Br {
|
|
2580
2599
|
constructor(e) {
|
|
2581
2600
|
this.blue = e;
|
|
2582
2601
|
}
|
|
@@ -2588,73 +2607,73 @@ class Ar {
|
|
|
2588
2607
|
this.total += e;
|
|
2589
2608
|
}
|
|
2590
2609
|
chargeScopeEntry(e) {
|
|
2591
|
-
this.add(
|
|
2610
|
+
this.add(Mr(this.scopeDepth(e)));
|
|
2592
2611
|
}
|
|
2593
2612
|
chargeInitialization() {
|
|
2594
|
-
this.add(
|
|
2613
|
+
this.add(yr);
|
|
2595
2614
|
}
|
|
2596
2615
|
chargeChannelMatchAttempt() {
|
|
2597
|
-
this.add(
|
|
2616
|
+
this.add(wr);
|
|
2598
2617
|
}
|
|
2599
2618
|
chargeHandlerOverhead() {
|
|
2600
|
-
this.add(
|
|
2619
|
+
this.add(br);
|
|
2601
2620
|
}
|
|
2602
2621
|
chargeBoundaryCheck() {
|
|
2603
|
-
this.add(
|
|
2622
|
+
this.add(Sr);
|
|
2604
2623
|
}
|
|
2605
2624
|
chargePatchAddOrReplace(e) {
|
|
2606
|
-
this.add(
|
|
2625
|
+
this.add(Ar(this.payloadSizeCharge(e)));
|
|
2607
2626
|
}
|
|
2608
2627
|
chargePatchRemove() {
|
|
2609
|
-
this.add(
|
|
2628
|
+
this.add(Cr);
|
|
2610
2629
|
}
|
|
2611
2630
|
chargeCascadeRouting(e) {
|
|
2612
|
-
e > 0 && this.add(
|
|
2631
|
+
e > 0 && this.add(Dr(e));
|
|
2613
2632
|
}
|
|
2614
2633
|
chargeEmitEvent(e) {
|
|
2615
|
-
this.add(
|
|
2634
|
+
this.add(Or(this.payloadSizeCharge(e)));
|
|
2616
2635
|
}
|
|
2617
2636
|
chargeBridge() {
|
|
2618
|
-
this.add(
|
|
2637
|
+
this.add(vr);
|
|
2619
2638
|
}
|
|
2620
2639
|
chargeDrainEvent() {
|
|
2621
|
-
this.add(
|
|
2640
|
+
this.add(kr);
|
|
2622
2641
|
}
|
|
2623
2642
|
chargeCheckpointUpdate() {
|
|
2624
|
-
this.add(
|
|
2643
|
+
this.add(Ir);
|
|
2625
2644
|
}
|
|
2626
2645
|
chargeTerminationMarker() {
|
|
2627
|
-
this.add(
|
|
2646
|
+
this.add(Rr);
|
|
2628
2647
|
}
|
|
2629
2648
|
chargeLifecycleDelivery() {
|
|
2630
|
-
this.add(
|
|
2649
|
+
this.add(Tr);
|
|
2631
2650
|
}
|
|
2632
2651
|
chargeFatalTerminationOverhead() {
|
|
2633
|
-
this.add(
|
|
2652
|
+
this.add(Nr);
|
|
2634
2653
|
}
|
|
2635
2654
|
chargeJavaScriptCodeBase(e) {
|
|
2636
|
-
this.add(
|
|
2655
|
+
this.add(fr(e));
|
|
2637
2656
|
}
|
|
2638
2657
|
chargeTriggerEventBase() {
|
|
2639
|
-
this.add(
|
|
2658
|
+
this.add(Pr);
|
|
2640
2659
|
}
|
|
2641
2660
|
chargeUpdateDocumentBase(e) {
|
|
2642
|
-
this.add(
|
|
2661
|
+
this.add(pr(e));
|
|
2643
2662
|
}
|
|
2644
2663
|
chargeExpression(e) {
|
|
2645
|
-
this.add(
|
|
2664
|
+
this.add(mr(e));
|
|
2646
2665
|
}
|
|
2647
2666
|
chargeTemplate(e, t) {
|
|
2648
|
-
this.add(
|
|
2667
|
+
this.add(gr(e, t));
|
|
2649
2668
|
}
|
|
2650
2669
|
chargeDocumentSnapshot(e, t) {
|
|
2651
|
-
const n = t ?
|
|
2652
|
-
this.add(
|
|
2670
|
+
const n = t ? we(this.blue, t) : 0;
|
|
2671
|
+
this.add(Er(e, n));
|
|
2653
2672
|
}
|
|
2654
2673
|
payloadSizeCharge(e) {
|
|
2655
2674
|
if (!e)
|
|
2656
2675
|
return 0;
|
|
2657
|
-
const t =
|
|
2676
|
+
const t = we(this.blue, e);
|
|
2658
2677
|
return U(t);
|
|
2659
2678
|
}
|
|
2660
2679
|
scopeDepth(e) {
|
|
@@ -2667,12 +2686,12 @@ class Ar {
|
|
|
2667
2686
|
return n;
|
|
2668
2687
|
}
|
|
2669
2688
|
}
|
|
2670
|
-
class
|
|
2689
|
+
class Lr {
|
|
2671
2690
|
constructor(e, t) {
|
|
2672
|
-
this.documentRef = e, this.blueRef = t, this.patchEngine = new
|
|
2691
|
+
this.documentRef = e, this.blueRef = t, this.patchEngine = new or(this.documentRef), this.meter = new Br(this.blueRef);
|
|
2673
2692
|
}
|
|
2674
2693
|
patchEngine;
|
|
2675
|
-
emissionRegistry = new
|
|
2694
|
+
emissionRegistry = new dr();
|
|
2676
2695
|
meter;
|
|
2677
2696
|
runTerminated = !1;
|
|
2678
2697
|
document() {
|
|
@@ -2721,15 +2740,15 @@ class Or {
|
|
|
2721
2740
|
return this.patchEngine.applyPatch(e, t);
|
|
2722
2741
|
}
|
|
2723
2742
|
}
|
|
2724
|
-
const
|
|
2725
|
-
class
|
|
2743
|
+
const _r = m["Processing Initialized Marker"], $r = m["Document Update"];
|
|
2744
|
+
class xr {
|
|
2726
2745
|
constructor(e, t, n, r) {
|
|
2727
|
-
this.contractLoader = e, this.registry = t, this.runtimeRef = new
|
|
2728
|
-
const s = (o) =>
|
|
2729
|
-
this.checkpointManager = new
|
|
2746
|
+
this.contractLoader = e, this.registry = t, this.runtimeRef = new Lr(r, n);
|
|
2747
|
+
const s = (o) => He(this.runtimeRef.blue(), o);
|
|
2748
|
+
this.checkpointManager = new Wn(
|
|
2730
2749
|
this.runtimeRef,
|
|
2731
2750
|
s
|
|
2732
|
-
), this.terminationService = new
|
|
2751
|
+
), this.terminationService = new nr(this.runtimeRef), this.channelRunner = new Gn(
|
|
2733
2752
|
this.runtimeRef,
|
|
2734
2753
|
this.checkpointManager,
|
|
2735
2754
|
{
|
|
@@ -2746,9 +2765,9 @@ class Lr {
|
|
|
2746
2765
|
const c = this.registry.lookupHandler(o.blueId());
|
|
2747
2766
|
if (!c) {
|
|
2748
2767
|
const u = `No processor registered for handler contract ${o.blueId()}`;
|
|
2749
|
-
throw new
|
|
2768
|
+
throw new g(
|
|
2750
2769
|
u,
|
|
2751
|
-
|
|
2770
|
+
E.illegalState(u)
|
|
2752
2771
|
);
|
|
2753
2772
|
}
|
|
2754
2773
|
const l = c.matches;
|
|
@@ -2758,7 +2777,7 @@ class Lr {
|
|
|
2758
2777
|
handleHandlerError: async (o, a, c) => this.handleHandlerError(o, a, c),
|
|
2759
2778
|
canonicalSignature: s
|
|
2760
2779
|
}
|
|
2761
|
-
), this.scopeExecutor = new
|
|
2780
|
+
), this.scopeExecutor = new Xn({
|
|
2762
2781
|
runtime: this.runtimeRef,
|
|
2763
2782
|
contractLoader: this.contractLoader,
|
|
2764
2783
|
channelRunner: this.channelRunner,
|
|
@@ -2809,7 +2828,7 @@ class Lr {
|
|
|
2809
2828
|
);
|
|
2810
2829
|
}
|
|
2811
2830
|
createContext(e, t, n, r = !1, s = !1) {
|
|
2812
|
-
return new
|
|
2831
|
+
return new Fr(
|
|
2813
2832
|
this,
|
|
2814
2833
|
t,
|
|
2815
2834
|
e,
|
|
@@ -2820,7 +2839,7 @@ class Lr {
|
|
|
2820
2839
|
}
|
|
2821
2840
|
result() {
|
|
2822
2841
|
const e = this.runtimeRef.document().clone(), t = this.runtimeRef.rootEmissions().map((n) => n.clone());
|
|
2823
|
-
return
|
|
2842
|
+
return Ne.of(
|
|
2824
2843
|
e,
|
|
2825
2844
|
t,
|
|
2826
2845
|
this.runtimeRef.totalGas()
|
|
@@ -2899,20 +2918,20 @@ class Lr {
|
|
|
2899
2918
|
c
|
|
2900
2919
|
))
|
|
2901
2920
|
return { matches: !1 };
|
|
2902
|
-
const u = s.channelize,
|
|
2921
|
+
const u = s.channelize, f = u ? u.call(s, e.contract(), c) : void 0;
|
|
2903
2922
|
return {
|
|
2904
2923
|
matches: !0,
|
|
2905
2924
|
eventId: o,
|
|
2906
|
-
eventNode:
|
|
2925
|
+
eventNode: f ?? a.clone()
|
|
2907
2926
|
};
|
|
2908
2927
|
}
|
|
2909
2928
|
async executeHandler(e, t) {
|
|
2910
2929
|
const n = this.registry.lookupHandler(e.blueId());
|
|
2911
2930
|
if (!n) {
|
|
2912
2931
|
const r = `No processor registered for handler contract ${e.blueId()}`;
|
|
2913
|
-
throw new
|
|
2932
|
+
throw new g(
|
|
2914
2933
|
r,
|
|
2915
|
-
|
|
2934
|
+
E.illegalState(r)
|
|
2916
2935
|
);
|
|
2917
2936
|
}
|
|
2918
2937
|
await n.execute(e.contract(), t);
|
|
@@ -2933,7 +2952,7 @@ class Lr {
|
|
|
2933
2952
|
}
|
|
2934
2953
|
createDocumentUpdateEvent(e, t) {
|
|
2935
2954
|
const n = Mt(t, e.path), r = e.before != null ? e.before.clone() : new d().setValue(null), s = e.after != null ? e.after.clone() : new d().setValue(null), o = new d().setType(
|
|
2936
|
-
new d().setBlueId(
|
|
2955
|
+
new d().setBlueId($r)
|
|
2937
2956
|
);
|
|
2938
2957
|
return o.setProperties({
|
|
2939
2958
|
op: new d().setValue(e.op),
|
|
@@ -2955,7 +2974,7 @@ class j {
|
|
|
2955
2974
|
}
|
|
2956
2975
|
async initializeDocument(e) {
|
|
2957
2976
|
if (this.isInitialized(e))
|
|
2958
|
-
throw new
|
|
2977
|
+
throw new M("Document already initialized");
|
|
2959
2978
|
const t = this.createExecution(e.clone());
|
|
2960
2979
|
return this.run(e, t, async () => {
|
|
2961
2980
|
await t.initializeScope("/", !0);
|
|
@@ -2963,7 +2982,7 @@ class j {
|
|
|
2963
2982
|
}
|
|
2964
2983
|
async processDocument(e, t) {
|
|
2965
2984
|
if (!this.isInitialized(e))
|
|
2966
|
-
throw new
|
|
2985
|
+
throw new M("Document not initialized");
|
|
2967
2986
|
const n = this.createExecution(e.clone()), r = t.clone();
|
|
2968
2987
|
return this.run(e, n, async () => {
|
|
2969
2988
|
n.loadBundles("/"), await n.processExternalEvent("/", r);
|
|
@@ -2973,7 +2992,7 @@ class j {
|
|
|
2973
2992
|
return this.initializationMarker(e) != null;
|
|
2974
2993
|
}
|
|
2975
2994
|
createExecution(e) {
|
|
2976
|
-
return new
|
|
2995
|
+
return new xr(
|
|
2977
2996
|
this.contractLoader,
|
|
2978
2997
|
this.registry,
|
|
2979
2998
|
this.blue,
|
|
@@ -2988,7 +3007,7 @@ class j {
|
|
|
2988
3007
|
return t.result();
|
|
2989
3008
|
if (r instanceof F) {
|
|
2990
3009
|
const s = e.clone();
|
|
2991
|
-
return
|
|
3010
|
+
return Ne.capabilityFailure(
|
|
2992
3011
|
s,
|
|
2993
3012
|
r.message ?? null
|
|
2994
3013
|
);
|
|
@@ -3002,16 +3021,16 @@ class j {
|
|
|
3002
3021
|
if (!n)
|
|
3003
3022
|
return null;
|
|
3004
3023
|
if (!(n instanceof d))
|
|
3005
|
-
throw new
|
|
3024
|
+
throw new g(
|
|
3006
3025
|
"Initialization Marker must be a BlueNode",
|
|
3007
|
-
|
|
3026
|
+
E.illegalState(
|
|
3008
3027
|
"Initialization Marker must be a BlueNode"
|
|
3009
3028
|
)
|
|
3010
3029
|
);
|
|
3011
|
-
if (n.getType()?.getBlueId() !==
|
|
3012
|
-
throw new
|
|
3030
|
+
if (n.getType()?.getBlueId() !== _r)
|
|
3031
|
+
throw new g(
|
|
3013
3032
|
"Initialization Marker must declare type 'Processing Initialized Marker'",
|
|
3014
|
-
|
|
3033
|
+
E.illegalState(
|
|
3015
3034
|
"Initialization Marker must declare type 'Processing Initialized Marker'"
|
|
3016
3035
|
)
|
|
3017
3036
|
);
|
|
@@ -3032,22 +3051,28 @@ class j {
|
|
|
3032
3051
|
continue;
|
|
3033
3052
|
const a = s.getItems();
|
|
3034
3053
|
if (a && /^\d+$/.test(o)) {
|
|
3035
|
-
const
|
|
3036
|
-
s = a[
|
|
3054
|
+
const l = Number.parseInt(o, 10);
|
|
3055
|
+
s = a[l] ?? null;
|
|
3037
3056
|
continue;
|
|
3038
3057
|
}
|
|
3039
3058
|
const c = s.getProperties();
|
|
3040
|
-
if (
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3059
|
+
if (c && o in c) {
|
|
3060
|
+
const l = c[o];
|
|
3061
|
+
if (!(l instanceof d))
|
|
3062
|
+
return null;
|
|
3063
|
+
s = l;
|
|
3064
|
+
continue;
|
|
3065
|
+
}
|
|
3066
|
+
if (o === "blueId") {
|
|
3067
|
+
s = new d().setValue(s.getBlueId() ?? null);
|
|
3068
|
+
continue;
|
|
3069
|
+
}
|
|
3070
|
+
return null;
|
|
3046
3071
|
}
|
|
3047
3072
|
return s;
|
|
3048
3073
|
}
|
|
3049
3074
|
}
|
|
3050
|
-
class
|
|
3075
|
+
class Fr {
|
|
3051
3076
|
constructor(e, t, n, r, s, o) {
|
|
3052
3077
|
this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = s, this.allowReservedMutation = o;
|
|
3053
3078
|
}
|
|
@@ -3083,7 +3108,7 @@ class _r {
|
|
|
3083
3108
|
this.shouldSkipTerminatedWork() || this.execution.runtime().addGas(e);
|
|
3084
3109
|
}
|
|
3085
3110
|
throwFatal(e) {
|
|
3086
|
-
throw new
|
|
3111
|
+
throw new g(e, E.runtimeFatal(e));
|
|
3087
3112
|
}
|
|
3088
3113
|
resolvePointer(e) {
|
|
3089
3114
|
return this.execution.resolvePointer(this.scopePathValue, e);
|
|
@@ -3135,16 +3160,16 @@ class _r {
|
|
|
3135
3160
|
return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
|
|
3136
3161
|
}
|
|
3137
3162
|
}
|
|
3138
|
-
const
|
|
3163
|
+
const zr = new pt({
|
|
3139
3164
|
repositories: [dt, yt, St]
|
|
3140
3165
|
});
|
|
3141
|
-
class
|
|
3166
|
+
class Hr {
|
|
3142
3167
|
blue;
|
|
3143
3168
|
registryRef;
|
|
3144
3169
|
contractLoaderRef;
|
|
3145
3170
|
engine;
|
|
3146
3171
|
constructor(e) {
|
|
3147
|
-
this.registryRef = e?.registry ?? Q.create().registerDefaults().build(), this.blue = e?.blue ??
|
|
3172
|
+
this.registryRef = e?.registry ?? Q.create().registerDefaults().build(), this.blue = e?.blue ?? zr, this.contractLoaderRef = new zn(this.registryRef, this.blue), this.engine = new j(
|
|
3148
3173
|
this.contractLoaderRef,
|
|
3149
3174
|
this.registryRef,
|
|
3150
3175
|
this.blue
|
|
@@ -3177,10 +3202,10 @@ class xr {
|
|
|
3177
3202
|
return this.contractLoaderRef;
|
|
3178
3203
|
}
|
|
3179
3204
|
static builder() {
|
|
3180
|
-
return new
|
|
3205
|
+
return new Ur();
|
|
3181
3206
|
}
|
|
3182
3207
|
}
|
|
3183
|
-
class
|
|
3208
|
+
class Ur {
|
|
3184
3209
|
contractRegistry;
|
|
3185
3210
|
blueInstance;
|
|
3186
3211
|
constructor() {
|
|
@@ -3196,13 +3221,13 @@ class Fr {
|
|
|
3196
3221
|
return this.blueInstance = e, this;
|
|
3197
3222
|
}
|
|
3198
3223
|
build() {
|
|
3199
|
-
return new
|
|
3224
|
+
return new Hr({
|
|
3200
3225
|
registry: this.contractRegistry,
|
|
3201
3226
|
blue: this.blueInstance
|
|
3202
3227
|
});
|
|
3203
3228
|
}
|
|
3204
3229
|
}
|
|
3205
|
-
class
|
|
3230
|
+
class Ze {
|
|
3206
3231
|
process(e, t) {
|
|
3207
3232
|
const n = t.getValue();
|
|
3208
3233
|
if (W(n)) {
|
|
@@ -3223,91 +3248,91 @@ class Ye {
|
|
|
3223
3248
|
return e;
|
|
3224
3249
|
}
|
|
3225
3250
|
}
|
|
3226
|
-
const
|
|
3251
|
+
const ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3227
3252
|
__proto__: null,
|
|
3228
|
-
ExpressionPreserver:
|
|
3253
|
+
ExpressionPreserver: Ze
|
|
3229
3254
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3230
|
-
function
|
|
3231
|
-
return new
|
|
3232
|
-
new
|
|
3233
|
-
new
|
|
3234
|
-
new
|
|
3235
|
-
new
|
|
3236
|
-
new
|
|
3237
|
-
new
|
|
3255
|
+
function di() {
|
|
3256
|
+
return new T.SequentialMergingProcessor([
|
|
3257
|
+
new T.ValuePropagator(),
|
|
3258
|
+
new Ze(),
|
|
3259
|
+
new T.TypeAssigner(),
|
|
3260
|
+
new T.ListProcessor(),
|
|
3261
|
+
new T.DictionaryProcessor(),
|
|
3262
|
+
new T.BasicTypesVerifier()
|
|
3238
3263
|
]);
|
|
3239
3264
|
}
|
|
3240
3265
|
export {
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3266
|
+
Pn as ChannelBinding,
|
|
3267
|
+
Gn as ChannelRunner,
|
|
3268
|
+
Wn as CheckpointManager,
|
|
3269
|
+
Kn as CheckpointRecord,
|
|
3270
|
+
Ve as CodeBlockEvaluationError,
|
|
3271
|
+
A as ContractBundle,
|
|
3272
|
+
Mn as ContractBundleBuilder,
|
|
3273
|
+
zn as ContractLoader,
|
|
3249
3274
|
ln as ContractProcessorRegistry,
|
|
3250
3275
|
Q as ContractProcessorRegistryBuilder,
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3276
|
+
Ne as DocumentProcessingResult,
|
|
3277
|
+
Lr as DocumentProcessingRuntime,
|
|
3278
|
+
Hr as DocumentProcessor,
|
|
3279
|
+
Ur as DocumentProcessorBuilder,
|
|
3280
|
+
dr as EmissionRegistry,
|
|
3281
|
+
Br as GasMeter,
|
|
3282
|
+
Nn as HandlerBinding,
|
|
3258
3283
|
I as KEY_CHECKPOINT,
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3284
|
+
Me as KEY_EMBEDDED,
|
|
3285
|
+
Ae as KEY_INITIALIZED,
|
|
3286
|
+
De as KEY_TERMINATED,
|
|
3287
|
+
ui as MergingProcessors,
|
|
3263
3288
|
Oe as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
|
|
3264
|
-
|
|
3265
|
-
|
|
3289
|
+
or as PatchEngine,
|
|
3290
|
+
si as ProcessorContractConstants,
|
|
3266
3291
|
j as ProcessorEngine,
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3292
|
+
E as ProcessorErrors,
|
|
3293
|
+
xr as ProcessorExecution,
|
|
3294
|
+
Fr as ProcessorExecutionContext,
|
|
3295
|
+
g as ProcessorFatalError,
|
|
3296
|
+
oi as ProcessorPointerConstants,
|
|
3297
|
+
ae as QuickJSEvaluator,
|
|
3298
|
+
Le as RELATIVE_CHECKPOINT,
|
|
3299
|
+
D as RELATIVE_CONTRACTS,
|
|
3275
3300
|
Nt as RELATIVE_EMBEDDED,
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3301
|
+
re as RELATIVE_INITIALIZED,
|
|
3302
|
+
Be as RELATIVE_TERMINATED,
|
|
3303
|
+
se as RESERVED_CONTRACT_KEYS,
|
|
3279
3304
|
q as RunTerminationError,
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3305
|
+
Xn as ScopeExecutor,
|
|
3306
|
+
ur as ScopeRuntimeContext,
|
|
3307
|
+
nr as TerminationService,
|
|
3308
|
+
ti as andThen,
|
|
3309
|
+
He as canonicalSignature,
|
|
3310
|
+
we as canonicalSize,
|
|
3286
3311
|
O as channelContractBaseSchema,
|
|
3287
3312
|
en as channelEventCheckpointSchema,
|
|
3288
3313
|
Kt as containsExpression,
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3314
|
+
ce as contractBaseSchema,
|
|
3315
|
+
di as createDefaultMergingProcessor,
|
|
3316
|
+
qe as createPicomatchShouldResolve,
|
|
3292
3317
|
jt as documentUpdateChannelSchema,
|
|
3293
3318
|
Jt as embeddedNodeChannelSchema,
|
|
3294
|
-
|
|
3295
|
-
|
|
3319
|
+
vt as err,
|
|
3320
|
+
Ge as evaluateQuickJSExpression,
|
|
3296
3321
|
Wt as extractExpressionContent,
|
|
3297
|
-
|
|
3322
|
+
je as handlerContractBaseSchema,
|
|
3298
3323
|
tn as initializationMarkerSchema,
|
|
3299
|
-
|
|
3324
|
+
Zr as isErr,
|
|
3300
3325
|
W as isExpression,
|
|
3301
|
-
|
|
3302
|
-
|
|
3326
|
+
Yr as isOk,
|
|
3327
|
+
oe as isProcessorManagedChannelBlueId,
|
|
3303
3328
|
Pt as isReservedContractKey,
|
|
3304
|
-
|
|
3305
|
-
|
|
3329
|
+
ai as joinRelativePointers,
|
|
3330
|
+
ci as jsonPatchSchema,
|
|
3306
3331
|
Qt as lifecycleChannelSchema,
|
|
3307
|
-
|
|
3308
|
-
|
|
3332
|
+
Xr as map,
|
|
3333
|
+
ei as mapErr,
|
|
3309
3334
|
H as markerContractBaseSchema,
|
|
3310
|
-
|
|
3335
|
+
ii as match,
|
|
3311
3336
|
Xt as myosTimelineChannelSchema,
|
|
3312
3337
|
b as normalizePointer,
|
|
3313
3338
|
y as normalizeScope,
|
|
@@ -3315,8 +3340,8 @@ export {
|
|
|
3315
3340
|
sn as operationMarkerSchema,
|
|
3316
3341
|
nn as processEmbeddedMarkerSchema,
|
|
3317
3342
|
rn as processingTerminatedMarkerSchema,
|
|
3318
|
-
|
|
3319
|
-
|
|
3343
|
+
xe as relativeCheckpointLastEvent,
|
|
3344
|
+
Fe as relativeCheckpointLastSignature,
|
|
3320
3345
|
J as relativeContractsEntry,
|
|
3321
3346
|
Mt as relativizePointer,
|
|
3322
3347
|
G as resolveNodeExpressions,
|
|
@@ -3324,10 +3349,10 @@ export {
|
|
|
3324
3349
|
Gt as resolveTemplateString,
|
|
3325
3350
|
an as sequentialWorkflowOperationSchema,
|
|
3326
3351
|
on as sequentialWorkflowSchema,
|
|
3327
|
-
|
|
3328
|
-
|
|
3352
|
+
li as sequentialWorkflowStepSchema,
|
|
3353
|
+
Ee as stripSlashes,
|
|
3329
3354
|
Zt as timelineChannelSchema,
|
|
3330
3355
|
Yt as triggeredEventChannelSchema,
|
|
3331
|
-
|
|
3332
|
-
|
|
3356
|
+
ni as unwrapOr,
|
|
3357
|
+
ri as unwrapOrElse
|
|
3333
3358
|
};
|