@blue-labs/document-processor 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/contract-bundle.d.ts +5 -2
- package/dist/engine/contract-bundle.d.ts.map +1 -1
- package/dist/engine/handler-registration-service.d.ts +2 -1
- package/dist/engine/handler-registration-service.d.ts.map +1 -1
- package/dist/engine/processor-engine.d.ts.map +1 -1
- package/dist/index.js +363 -317
- package/dist/registry/processors/sequential-workflow-operation-processor.d.ts +2 -2
- package/dist/registry/processors/sequential-workflow-operation-processor.d.ts.map +1 -1
- package/dist/registry/processors/sequential-workflow-processor.d.ts +2 -2
- package/dist/registry/processors/sequential-workflow-processor.d.ts.map +1 -1
- package/dist/registry/processors/steps/quickjs-step-bindings.d.ts.map +1 -1
- package/dist/registry/processors/workflow/step-runner.d.ts +2 -0
- package/dist/registry/processors/workflow/step-runner.d.ts.map +1 -1
- package/dist/registry/types.d.ts +5 -1
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/test-support/workflow.d.ts +1 -0
- package/dist/test-support/workflow.d.ts.map +1 -1
- package/dist/types/handler-contract-entry.d.ts +2 -0
- package/dist/types/handler-contract-entry.d.ts.map +1 -1
- package/dist/util/expression/quickjs-evaluator.d.ts +2 -0
- package/dist/util/expression/quickjs-evaluator.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { evaluate as wt } from "@blue-quickjs/quickjs-runtime";
|
|
2
2
|
import { validateDv as kt, DV_LIMIT_DEFAULTS as bt } from "@blue-quickjs/dv";
|
|
3
|
-
import { HOST_V1_MANIFEST as
|
|
4
|
-
import { BlueNode as p, withTypeBlueId as g, blueNodeField as b, Properties as
|
|
5
|
-
import
|
|
3
|
+
import { HOST_V1_MANIFEST as Tt, HOST_V1_HASH as It } from "@blue-quickjs/abi-manifest";
|
|
4
|
+
import { BlueNode as p, withTypeBlueId as g, blueNodeField as b, Properties as Te, BlueIdCalculator as Pt, Blue as Rt, MergingProcessors as L } from "@blue-labs/language";
|
|
5
|
+
import Ie from "picomatch";
|
|
6
6
|
import { z as l, ZodError as ge } from "zod";
|
|
7
7
|
import { isNullable as he } from "@blue-labs/shared-utils";
|
|
8
8
|
import { repository as Mt } from "@blue-repository/types";
|
|
@@ -36,7 +36,7 @@ function eo(i, e) {
|
|
|
36
36
|
function to(i, e) {
|
|
37
37
|
return i.ok ? e.ok(i.value) : e.err(i.error);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const S = {
|
|
40
40
|
capabilityFailure(i, e, t) {
|
|
41
41
|
return { kind: "CapabilityFailure", capability: i, reason: e, details: t };
|
|
42
42
|
},
|
|
@@ -78,7 +78,7 @@ const Dt = {
|
|
|
78
78
|
failureReason: e ?? null
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
}, Ke = Dt,
|
|
81
|
+
}, Ke = Dt, m = {
|
|
82
82
|
"Core/Channel": "DcoJyCh7XXxy1nR5xjy7qfkUgQ1GiZnKKSxh8DJusBSr",
|
|
83
83
|
"Core/Channel Event Checkpoint": "B7YQeYdQzUNuzaDQ4tNTd2iJqgd4YnVQkgz4QgymDWWU",
|
|
84
84
|
"Core/Contract": "AERp8BWnuUsjoPciAeNXuUWS9fmqPNMdWbxmKn3tcitx",
|
|
@@ -101,10 +101,10 @@ const Dt = {
|
|
|
101
101
|
"terminated",
|
|
102
102
|
"checkpoint"
|
|
103
103
|
], xt = [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
m["Core/Document Update Channel"],
|
|
105
|
+
m["Core/Triggered Event Channel"],
|
|
106
|
+
m["Core/Lifecycle Event Channel"],
|
|
107
|
+
m["Core/Embedded Node Channel"]
|
|
108
108
|
], We = "embedded", Ge = "initialized", qe = "terminated", A = "checkpoint", Ee = new Set(
|
|
109
109
|
Bt
|
|
110
110
|
), je = new Set(xt);
|
|
@@ -126,14 +126,14 @@ const no = {
|
|
|
126
126
|
isReservedContractKey: _t,
|
|
127
127
|
isProcessorManagedChannelBlueId: ye
|
|
128
128
|
}, H = "/contracts", de = `${H}/${Ge}`, Je = `${H}/${qe}`, Lt = `${H}/${We}`, Qe = `${H}/${A}`, Xe = "/lastEvents", Ye = "/lastSignatures";
|
|
129
|
-
function
|
|
129
|
+
function re(i) {
|
|
130
130
|
return `${H}/${i}`;
|
|
131
131
|
}
|
|
132
132
|
function Ze(i, e) {
|
|
133
|
-
return `${
|
|
133
|
+
return `${re(i)}${Xe}/${e}`;
|
|
134
134
|
}
|
|
135
135
|
function et(i, e) {
|
|
136
|
-
return `${
|
|
136
|
+
return `${re(i)}${Ye}/${e}`;
|
|
137
137
|
}
|
|
138
138
|
const ro = {
|
|
139
139
|
RELATIVE_CONTRACTS: H,
|
|
@@ -143,7 +143,7 @@ const ro = {
|
|
|
143
143
|
RELATIVE_CHECKPOINT: Qe,
|
|
144
144
|
LAST_EVENTS_SUFFIX: Xe,
|
|
145
145
|
LAST_SIGNATURES_SUFFIX: Ye,
|
|
146
|
-
relativeContractsEntry:
|
|
146
|
+
relativeContractsEntry: re,
|
|
147
147
|
relativeCheckpointLastEvent: Ze,
|
|
148
148
|
relativeCheckpointLastSignature: et
|
|
149
149
|
};
|
|
@@ -153,10 +153,10 @@ function tt(i) {
|
|
|
153
153
|
function k(i) {
|
|
154
154
|
return tt(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function P(i) {
|
|
157
157
|
return tt(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function Pe(i) {
|
|
160
160
|
if (i == null)
|
|
161
161
|
return "";
|
|
162
162
|
let e = i.trim();
|
|
@@ -169,15 +169,15 @@ function Re(i) {
|
|
|
169
169
|
return e;
|
|
170
170
|
}
|
|
171
171
|
function io(i, e) {
|
|
172
|
-
const t =
|
|
172
|
+
const t = Pe(i), n = Pe(e);
|
|
173
173
|
return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
const t = k(i), n =
|
|
175
|
+
function I(i, e) {
|
|
176
|
+
const t = k(i), n = P(e);
|
|
177
177
|
return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
|
|
178
178
|
}
|
|
179
179
|
function Ft(i, e) {
|
|
180
|
-
const t = k(i), n =
|
|
180
|
+
const t = k(i), n = P(e);
|
|
181
181
|
if (t === "/" || !n.startsWith(t))
|
|
182
182
|
return n;
|
|
183
183
|
if (n.length === t.length)
|
|
@@ -188,9 +188,9 @@ function Ft(i, e) {
|
|
|
188
188
|
function Ut(i) {
|
|
189
189
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
190
190
|
}
|
|
191
|
-
var
|
|
191
|
+
var ae, Re;
|
|
192
192
|
function $t() {
|
|
193
|
-
return
|
|
193
|
+
return Re || (Re = 1, ae = function i(e) {
|
|
194
194
|
if (typeof e == "number" && isNaN(e))
|
|
195
195
|
throw new Error("NaN is not allowed");
|
|
196
196
|
if (typeof e == "number" && !isFinite(e))
|
|
@@ -201,7 +201,7 @@ function $t() {
|
|
|
201
201
|
const o = n.length === 0 ? "" : ",";
|
|
202
202
|
return `${n}${o}${i(r)}:${i(e[r])}`;
|
|
203
203
|
}, "")}}`;
|
|
204
|
-
}),
|
|
204
|
+
}), ae;
|
|
205
205
|
}
|
|
206
206
|
var zt = $t();
|
|
207
207
|
const Vt = /* @__PURE__ */ Ut(zt);
|
|
@@ -249,7 +249,9 @@ const it = rt(
|
|
|
249
249
|
"eventCanonical",
|
|
250
250
|
"steps",
|
|
251
251
|
"document",
|
|
252
|
-
"emit"
|
|
252
|
+
"emit",
|
|
253
|
+
"currentContract",
|
|
254
|
+
"currentContractCanonical"
|
|
253
255
|
]);
|
|
254
256
|
class Ce {
|
|
255
257
|
// Serialize evaluations to avoid races when updating host handler bindings.
|
|
@@ -285,14 +287,14 @@ class Ce {
|
|
|
285
287
|
code: this.wrapCode(e),
|
|
286
288
|
abiId: "Host.v1",
|
|
287
289
|
abiVersion: 1,
|
|
288
|
-
abiManifestHash:
|
|
290
|
+
abiManifestHash: It
|
|
289
291
|
};
|
|
290
292
|
try {
|
|
291
293
|
const c = await wt({
|
|
292
294
|
program: a,
|
|
293
295
|
input: o,
|
|
294
296
|
gasLimit: s,
|
|
295
|
-
manifest:
|
|
297
|
+
manifest: Tt,
|
|
296
298
|
handlers: this.handlers
|
|
297
299
|
});
|
|
298
300
|
if (n !== void 0 && r && r({
|
|
@@ -300,7 +302,7 @@ class Ce {
|
|
|
300
302
|
remaining: c.gasRemaining
|
|
301
303
|
}), !c.ok)
|
|
302
304
|
throw en(c);
|
|
303
|
-
return
|
|
305
|
+
return Y(c.value);
|
|
304
306
|
} catch (c) {
|
|
305
307
|
throw tn(c);
|
|
306
308
|
}
|
|
@@ -308,20 +310,30 @@ class Ce {
|
|
|
308
310
|
prepareBindings(e) {
|
|
309
311
|
const t = e ?? {};
|
|
310
312
|
Yt(t);
|
|
311
|
-
const n =
|
|
313
|
+
const n = W(t.event, null, "event"), r = W(
|
|
312
314
|
t.eventCanonical ?? n,
|
|
313
315
|
n,
|
|
314
316
|
"eventCanonical"
|
|
315
|
-
), o =
|
|
317
|
+
), o = W(t.steps, [], "steps"), s = W(
|
|
318
|
+
t.currentContract,
|
|
319
|
+
null,
|
|
320
|
+
"currentContract"
|
|
321
|
+
), a = W(
|
|
322
|
+
t.currentContractCanonical,
|
|
323
|
+
s,
|
|
324
|
+
"currentContractCanonical"
|
|
325
|
+
), c = {
|
|
316
326
|
event: n,
|
|
317
327
|
eventCanonical: r,
|
|
318
|
-
steps: o
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
328
|
+
steps: o,
|
|
329
|
+
currentContract: s,
|
|
330
|
+
currentContractCanonical: a
|
|
331
|
+
}, u = this.extractDocumentBinding(t), h = typeof u?.canonical == "function" ? u.canonical : void 0;
|
|
332
|
+
this.handlerState.documentGet = Ne(u), this.handlerState.documentGetCanonical = Ne(
|
|
333
|
+
h ?? u
|
|
322
334
|
);
|
|
323
|
-
const
|
|
324
|
-
return this.handlerState.emit = Zt(
|
|
335
|
+
const d = this.extractEmitBinding(t);
|
|
336
|
+
return this.handlerState.emit = Zt(d), c;
|
|
325
337
|
}
|
|
326
338
|
extractDocumentBinding(e) {
|
|
327
339
|
if (!Object.prototype.hasOwnProperty.call(e, "document"))
|
|
@@ -356,7 +368,7 @@ function Yt(i) {
|
|
|
356
368
|
if (!Xt.has(e))
|
|
357
369
|
throw new TypeError(`Unsupported QuickJS binding: "${e}"`);
|
|
358
370
|
}
|
|
359
|
-
function
|
|
371
|
+
function W(i, e, t) {
|
|
360
372
|
const n = i === void 0 ? e : i;
|
|
361
373
|
try {
|
|
362
374
|
kt(n, { limits: bt });
|
|
@@ -387,7 +399,7 @@ function Ne(i) {
|
|
|
387
399
|
function Zt(i) {
|
|
388
400
|
return i ? (e) => {
|
|
389
401
|
try {
|
|
390
|
-
if (i(
|
|
402
|
+
if (i(Y(e)) instanceof Promise)
|
|
391
403
|
throw new Error("Async emit handlers are not supported");
|
|
392
404
|
return { ok: null, units: O };
|
|
393
405
|
} catch {
|
|
@@ -398,18 +410,18 @@ function Zt(i) {
|
|
|
398
410
|
}
|
|
399
411
|
} : () => ({ ok: null, units: O });
|
|
400
412
|
}
|
|
401
|
-
function
|
|
413
|
+
function Y(i) {
|
|
402
414
|
if (i == null)
|
|
403
415
|
return i;
|
|
404
416
|
if (Array.isArray(i))
|
|
405
|
-
return i.map((e) =>
|
|
417
|
+
return i.map((e) => Y(e));
|
|
406
418
|
if (typeof i == "object") {
|
|
407
419
|
const e = Object.getPrototypeOf(i);
|
|
408
420
|
if (e !== Object.prototype && e !== null)
|
|
409
421
|
return i;
|
|
410
422
|
const t = {};
|
|
411
423
|
for (const [n, r] of Object.entries(i))
|
|
412
|
-
t[n] =
|
|
424
|
+
t[n] = Y(r);
|
|
413
425
|
return t;
|
|
414
426
|
}
|
|
415
427
|
return i;
|
|
@@ -444,7 +456,7 @@ class ot extends Error {
|
|
|
444
456
|
}
|
|
445
457
|
}
|
|
446
458
|
const st = /^\$\{([\s\S]*)\}$/, rn = /\$\{([\s\S]+?)\}/, on = /\$\{([\s\S]+?)\}/g;
|
|
447
|
-
function
|
|
459
|
+
function Z(i) {
|
|
448
460
|
if (typeof i != "string" || !st.test(i))
|
|
449
461
|
return !1;
|
|
450
462
|
const e = i.indexOf("${"), t = i.lastIndexOf("${");
|
|
@@ -454,7 +466,7 @@ function sn(i) {
|
|
|
454
466
|
return typeof i != "string" ? !1 : st.test(i) ? !0 : rn.test(i);
|
|
455
467
|
}
|
|
456
468
|
function an(i) {
|
|
457
|
-
if (!
|
|
469
|
+
if (!Z(i))
|
|
458
470
|
throw new Error(`Invalid expression: ${i}`);
|
|
459
471
|
return i.slice(2, -1);
|
|
460
472
|
}
|
|
@@ -493,13 +505,13 @@ function ct({
|
|
|
493
505
|
options: t
|
|
494
506
|
}) {
|
|
495
507
|
const n = { dot: !0, ...t ?? {} }, r = i.map(
|
|
496
|
-
(s) =>
|
|
508
|
+
(s) => Ie(s, n)
|
|
497
509
|
), o = e.map(
|
|
498
|
-
(s) =>
|
|
510
|
+
(s) => Ie(s, n)
|
|
499
511
|
);
|
|
500
512
|
return (s) => r.some((a) => a(s)) && !o.some((a) => a(s));
|
|
501
513
|
}
|
|
502
|
-
async function
|
|
514
|
+
async function ee(i) {
|
|
503
515
|
const {
|
|
504
516
|
evaluator: e,
|
|
505
517
|
node: t,
|
|
@@ -518,7 +530,7 @@ async function Z(i) {
|
|
|
518
530
|
const d = h.getValue();
|
|
519
531
|
if (d !== void 0) {
|
|
520
532
|
if (typeof d == "string" && r(a)) {
|
|
521
|
-
if (
|
|
533
|
+
if (Z(d)) {
|
|
522
534
|
const E = an(d), C = await at(
|
|
523
535
|
e,
|
|
524
536
|
E,
|
|
@@ -540,27 +552,27 @@ async function Z(i) {
|
|
|
540
552
|
}
|
|
541
553
|
return h;
|
|
542
554
|
}
|
|
543
|
-
const
|
|
544
|
-
if (Array.isArray(
|
|
555
|
+
const v = h.getItems?.();
|
|
556
|
+
if (Array.isArray(v)) {
|
|
545
557
|
const E = await Promise.all(
|
|
546
|
-
|
|
547
|
-
(C,
|
|
558
|
+
v.map(
|
|
559
|
+
(C, R) => ee({
|
|
548
560
|
...i,
|
|
549
561
|
node: C,
|
|
550
|
-
pointer: `${a}/${
|
|
562
|
+
pointer: `${a}/${R}`
|
|
551
563
|
})
|
|
552
564
|
)
|
|
553
565
|
);
|
|
554
566
|
return h.setItems(E), h;
|
|
555
567
|
}
|
|
556
|
-
const
|
|
557
|
-
if (
|
|
568
|
+
const f = h.getProperties?.();
|
|
569
|
+
if (f) {
|
|
558
570
|
const E = {};
|
|
559
|
-
for (const [C,
|
|
571
|
+
for (const [C, R] of Object.entries(f)) {
|
|
560
572
|
const D = a === "/" ? `/${C}` : `${a}/${C}`;
|
|
561
|
-
E[C] = await
|
|
573
|
+
E[C] = await ee({
|
|
562
574
|
...i,
|
|
563
|
-
node:
|
|
575
|
+
node: R,
|
|
564
576
|
pointer: D
|
|
565
577
|
});
|
|
566
578
|
}
|
|
@@ -568,11 +580,11 @@ async function Z(i) {
|
|
|
568
580
|
}
|
|
569
581
|
return h;
|
|
570
582
|
}
|
|
571
|
-
const
|
|
583
|
+
const ie = g(m["Core/Contract"])(l.object({
|
|
572
584
|
description: l.string().optional(),
|
|
573
585
|
name: l.string().optional(),
|
|
574
586
|
order: l.number().optional()
|
|
575
|
-
})), Se =
|
|
587
|
+
})), Se = ie, x = g(m["Core/Channel"])(ie.extend({
|
|
576
588
|
description: l.string().optional(),
|
|
577
589
|
event: b().optional(),
|
|
578
590
|
name: l.string().optional()
|
|
@@ -581,12 +593,12 @@ const re = g(f["Core/Contract"])(l.object({
|
|
|
581
593
|
).extend({
|
|
582
594
|
path: l.string().optional(),
|
|
583
595
|
definition: b().optional()
|
|
584
|
-
}), lt = g(
|
|
596
|
+
}), lt = g(m["Core/Handler"])(ie.extend({
|
|
585
597
|
channel: l.string().optional(),
|
|
586
598
|
description: l.string().optional(),
|
|
587
599
|
event: b().optional(),
|
|
588
600
|
name: l.string().optional()
|
|
589
|
-
})), ut = lt.merge(Se), K = g(
|
|
601
|
+
})), ut = lt.merge(Se), K = g(m["Core/Marker"])(ie.extend({
|
|
590
602
|
description: l.string().optional(),
|
|
591
603
|
name: l.string().optional()
|
|
592
604
|
})), N = K.merge(Se), ln = l.object({
|
|
@@ -605,24 +617,24 @@ const re = g(f["Core/Contract"])(l.object({
|
|
|
605
617
|
message: `${i.op} operations must include a value`,
|
|
606
618
|
path: ["val"]
|
|
607
619
|
});
|
|
608
|
-
}), un = g(
|
|
620
|
+
}), un = g(m["Core/Document Update Channel"])(x.extend({
|
|
609
621
|
description: l.string().optional(),
|
|
610
622
|
name: l.string().optional(),
|
|
611
623
|
path: l.string().optional()
|
|
612
624
|
})), hn = un.merge(
|
|
613
625
|
_
|
|
614
|
-
), dn = g(
|
|
626
|
+
), dn = g(m["Core/Embedded Node Channel"])(x.extend({
|
|
615
627
|
childPath: l.string().optional(),
|
|
616
628
|
description: l.string().optional(),
|
|
617
629
|
name: l.string().optional()
|
|
618
630
|
})), pn = dn.merge(
|
|
619
631
|
_
|
|
620
|
-
),
|
|
632
|
+
), fn = g(m["Core/Lifecycle Event Channel"])(x.extend({
|
|
621
633
|
description: l.string().optional(),
|
|
622
634
|
name: l.string().optional()
|
|
623
|
-
})),
|
|
635
|
+
})), mn = fn.merge(
|
|
624
636
|
_
|
|
625
|
-
), gn = g(
|
|
637
|
+
), gn = g(m["Core/Triggered Event Channel"])(x.extend({
|
|
626
638
|
description: l.string().optional(),
|
|
627
639
|
name: l.string().optional()
|
|
628
640
|
})), En = gn.merge(_), w = {
|
|
@@ -645,7 +657,7 @@ const re = g(f["Core/Contract"])(l.object({
|
|
|
645
657
|
timelineId: l.string().optional()
|
|
646
658
|
})), yn = ht.merge(
|
|
647
659
|
_
|
|
648
|
-
),
|
|
660
|
+
), T = {
|
|
649
661
|
"MyOS/Document Anchor": "HS9yo34TGEAM2LGcNbLh7XPN4goPRhqdGZQkiyh473Wb",
|
|
650
662
|
"MyOS/Document Anchors": "7Usvk6dZMVqas3yqs23ZEXn1zu1YDPjgYiZFNYaw3puH",
|
|
651
663
|
"MyOS/Document Links": "4cmrbevB6K23ZenjqwmNxpnaw6RF4VB3wkP7XB59V7W5",
|
|
@@ -656,7 +668,7 @@ const re = g(f["Core/Contract"])(l.object({
|
|
|
656
668
|
"MyOS/MyOS Timeline Channel": "HCF8mXnX3dFjQ8osjxb4Wzm2Nm1DoXnTYuA5sPnV7NTs",
|
|
657
669
|
"MyOS/MyOS Timeline Entry": "Furgmg5xcJVMDmaQXZRfZ1XehSf7PWctrioo8etRYJHQ",
|
|
658
670
|
"MyOS/MyOS Worker Agency": "4Lix4AKXvBDvrwxw2htSdYFKxL4wugEQzqoSEYet5Dh1"
|
|
659
|
-
}, Cn = g(
|
|
671
|
+
}, Cn = g(T["MyOS/MyOS Timeline Channel"])(ht.extend({
|
|
660
672
|
accountId: l.string().optional(),
|
|
661
673
|
description: l.string().optional(),
|
|
662
674
|
email: l.string().optional(),
|
|
@@ -665,59 +677,59 @@ const re = g(f["Core/Contract"])(l.object({
|
|
|
665
677
|
channels: l.array(l.string()).optional(),
|
|
666
678
|
description: l.string().optional(),
|
|
667
679
|
name: l.string().optional()
|
|
668
|
-
})), dt = vn.merge(_), wn = g(
|
|
680
|
+
})), dt = vn.merge(_), wn = g(m["Core/Channel Event Checkpoint"])(K.extend({
|
|
669
681
|
description: l.string().optional(),
|
|
670
682
|
lastEvents: l.record(l.string(), b()).optional(),
|
|
671
683
|
name: l.string().optional()
|
|
672
684
|
})), kn = wn.merge(N).extend({
|
|
673
685
|
lastSignatures: l.record(l.string()).optional()
|
|
674
|
-
}), bn = g(
|
|
686
|
+
}), bn = g(m["Core/Processing Initialized Marker"])(K.extend({
|
|
675
687
|
description: l.string().optional(),
|
|
676
688
|
documentId: l.string().optional(),
|
|
677
689
|
name: l.string().optional()
|
|
678
|
-
})),
|
|
690
|
+
})), Tn = bn.merge(N), In = g(m["Core/Process Embedded"])(K.extend({
|
|
679
691
|
description: l.string().optional(),
|
|
680
692
|
name: l.string().optional(),
|
|
681
693
|
paths: l.array(l.string()).optional()
|
|
682
|
-
})),
|
|
694
|
+
})), Pn = In.merge(
|
|
683
695
|
N
|
|
684
|
-
),
|
|
696
|
+
), Rn = g(m["Core/Processing Terminated Marker"])(K.extend({
|
|
685
697
|
cause: l.string().optional(),
|
|
686
698
|
description: l.string().optional(),
|
|
687
699
|
name: l.string().optional(),
|
|
688
700
|
reason: l.string().optional()
|
|
689
|
-
})), Mn =
|
|
701
|
+
})), Mn = Rn.merge(N), J = g(w["Conversation/Operation"])(K.extend({
|
|
690
702
|
channel: l.string().optional(),
|
|
691
703
|
description: l.string().optional(),
|
|
692
704
|
name: l.string().optional(),
|
|
693
705
|
request: b().optional()
|
|
694
|
-
})), Nn =
|
|
706
|
+
})), Nn = J.merge(
|
|
695
707
|
N
|
|
696
|
-
), On = g(
|
|
708
|
+
), On = g(T["MyOS/Document Anchor"])(l.object({
|
|
697
709
|
description: l.string().optional(),
|
|
698
710
|
name: l.string().optional(),
|
|
699
711
|
template: b().optional()
|
|
700
|
-
})), An = g(
|
|
712
|
+
})), An = g(T["MyOS/Document Anchors"])(l.object({}).catchall(On)), Dn = An.merge(N), Bn = g(T["MyOS/Link"])(l.object({
|
|
701
713
|
anchor: l.string().optional(),
|
|
702
714
|
description: l.string().optional(),
|
|
703
715
|
name: l.string().optional()
|
|
704
|
-
})), xn = g(
|
|
716
|
+
})), xn = g(T["MyOS/Document Links"])(l.object({}).catchall(Bn)), _n = xn.merge(
|
|
705
717
|
N
|
|
706
|
-
), Ln = g(
|
|
718
|
+
), Ln = g(T["MyOS/MyOS Participants Orchestration"])(l.object({
|
|
707
719
|
name: l.string().optional()
|
|
708
|
-
})), Fn = Ln.merge(N), Un = g(
|
|
720
|
+
})), Fn = Ln.merge(N), Un = g(T["MyOS/MyOS Session Interaction"])(l.object({
|
|
709
721
|
name: l.string().optional()
|
|
710
|
-
})), $n = Un.merge(N), zn = g(
|
|
722
|
+
})), $n = Un.merge(N), zn = g(T["MyOS/MyOS Worker Agency"])(l.object({
|
|
711
723
|
name: l.string().optional()
|
|
712
724
|
})), Vn = zn.merge(
|
|
713
725
|
N
|
|
714
|
-
),
|
|
726
|
+
), oe = g(w["Conversation/Sequential Workflow Step"])(l.object({
|
|
715
727
|
description: l.string().optional(),
|
|
716
728
|
name: l.string().optional()
|
|
717
729
|
})), pt = g(w["Conversation/Sequential Workflow"])(lt.extend({
|
|
718
730
|
description: l.string().optional(),
|
|
719
731
|
name: l.string().optional(),
|
|
720
|
-
steps: l.array(
|
|
732
|
+
steps: l.array(oe).optional()
|
|
721
733
|
})), so = b(), Hn = pt.merge(ut).extend({
|
|
722
734
|
steps: l.array(b()).optional()
|
|
723
735
|
}), Kn = g(w["Conversation/Sequential Workflow Operation"])(pt.extend({
|
|
@@ -736,7 +748,7 @@ function Gn(i) {
|
|
|
736
748
|
if (typeof e != "string" || e.trim().length === 0)
|
|
737
749
|
throw new Error("Contract processor BlueIds must be non-empty strings");
|
|
738
750
|
}
|
|
739
|
-
function
|
|
751
|
+
function Q(i, e) {
|
|
740
752
|
Gn(i);
|
|
741
753
|
for (const t of i.blueIds)
|
|
742
754
|
e.set(t, i);
|
|
@@ -747,13 +759,13 @@ class qn {
|
|
|
747
759
|
channelProcessors = /* @__PURE__ */ new Map();
|
|
748
760
|
markerProcessors = /* @__PURE__ */ new Map();
|
|
749
761
|
registerHandler(e) {
|
|
750
|
-
|
|
762
|
+
Q(e, this.handlerProcessors), this.registerProcessorMap(e);
|
|
751
763
|
}
|
|
752
764
|
registerChannel(e) {
|
|
753
|
-
|
|
765
|
+
Q(e, this.channelProcessors), this.registerProcessorMap(e);
|
|
754
766
|
}
|
|
755
767
|
registerMarker(e) {
|
|
756
|
-
|
|
768
|
+
Q(e, this.markerProcessors), this.registerProcessorMap(e);
|
|
757
769
|
}
|
|
758
770
|
register(e) {
|
|
759
771
|
switch (e.kind) {
|
|
@@ -787,7 +799,7 @@ class qn {
|
|
|
787
799
|
return new Map(this.processorsByBlueId);
|
|
788
800
|
}
|
|
789
801
|
registerProcessorMap(e) {
|
|
790
|
-
|
|
802
|
+
Q(e, this.processorsByBlueId);
|
|
791
803
|
}
|
|
792
804
|
}
|
|
793
805
|
const jn = "compositeSourceChannelKey";
|
|
@@ -837,14 +849,14 @@ class Xn {
|
|
|
837
849
|
throw new Error(
|
|
838
850
|
`No processor registered for child channel '${u}' (${h.blueId})`
|
|
839
851
|
);
|
|
840
|
-
const
|
|
852
|
+
const v = n.clone(), f = {
|
|
841
853
|
...t,
|
|
842
|
-
event:
|
|
854
|
+
event: v,
|
|
843
855
|
bindingKey: u
|
|
844
856
|
}, E = h.contract, C = E.event;
|
|
845
|
-
if (C && !t.blue.isTypeOfNode(
|
|
857
|
+
if (C && !t.blue.isTypeOfNode(v, C) || !await d.matches(E, f))
|
|
846
858
|
continue;
|
|
847
|
-
const D = d.channelize, ke = (D ? D.call(d, E,
|
|
859
|
+
const D = d.channelize, ke = (D ? D.call(d, E, f) : void 0) ?? v.clone();
|
|
848
860
|
this.enrichEvent(ke, u);
|
|
849
861
|
const be = Jn(
|
|
850
862
|
t.bindingKey,
|
|
@@ -853,7 +865,7 @@ class Xn {
|
|
|
853
865
|
childProcessor: d,
|
|
854
866
|
childContract: E,
|
|
855
867
|
context: {
|
|
856
|
-
...
|
|
868
|
+
...f,
|
|
857
869
|
event: n.clone()
|
|
858
870
|
},
|
|
859
871
|
checkpointKey: be,
|
|
@@ -914,7 +926,7 @@ class Xn {
|
|
|
914
926
|
const Yn = g(w["Conversation/Actor"])(l.object({
|
|
915
927
|
description: l.string().optional(),
|
|
916
928
|
name: l.string().optional()
|
|
917
|
-
})),
|
|
929
|
+
})), ft = g(w["Conversation/Timeline"])(l.object({
|
|
918
930
|
description: l.string().optional(),
|
|
919
931
|
name: l.string().optional(),
|
|
920
932
|
timelineId: l.string().optional()
|
|
@@ -924,13 +936,13 @@ const Yn = g(w["Conversation/Actor"])(l.object({
|
|
|
924
936
|
message: b().optional(),
|
|
925
937
|
name: l.string().optional(),
|
|
926
938
|
prevEntry: b().optional(),
|
|
927
|
-
timeline:
|
|
939
|
+
timeline: ft.optional(),
|
|
928
940
|
timestamp: l.number().optional()
|
|
929
|
-
})), Zn = g(
|
|
941
|
+
})), Zn = g(T["MyOS/MyOS Timeline"])(ft.extend({
|
|
930
942
|
accountId: l.string().optional(),
|
|
931
943
|
description: l.string().optional(),
|
|
932
944
|
name: l.string().optional()
|
|
933
|
-
})), Ae = g(
|
|
945
|
+
})), Ae = g(T["MyOS/MyOS Timeline Entry"])(M.extend({
|
|
934
946
|
description: l.string().optional(),
|
|
935
947
|
name: l.string().optional(),
|
|
936
948
|
timeline: Zn.optional()
|
|
@@ -938,7 +950,7 @@ const Yn = g(w["Conversation/Actor"])(l.object({
|
|
|
938
950
|
function De(i, e) {
|
|
939
951
|
return e && i.isTypeOf(e, M, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, M) : null;
|
|
940
952
|
}
|
|
941
|
-
function
|
|
953
|
+
function mt(i, e, t) {
|
|
942
954
|
const n = De(i, e), r = De(i, t);
|
|
943
955
|
if (!n || !r)
|
|
944
956
|
return !0;
|
|
@@ -950,7 +962,7 @@ function Be(i, e) {
|
|
|
950
962
|
}
|
|
951
963
|
class er {
|
|
952
964
|
kind = "channel";
|
|
953
|
-
blueIds = [
|
|
965
|
+
blueIds = [T["MyOS/MyOS Timeline Channel"]];
|
|
954
966
|
schema = Sn;
|
|
955
967
|
matches(e, t) {
|
|
956
968
|
const { event: n, blue: r } = t;
|
|
@@ -968,7 +980,7 @@ class er {
|
|
|
968
980
|
}
|
|
969
981
|
isNewerEvent(e, t, n) {
|
|
970
982
|
const { event: r, blue: o } = t;
|
|
971
|
-
return r ?
|
|
983
|
+
return r ? mt(o, r, n) : !0;
|
|
972
984
|
}
|
|
973
985
|
}
|
|
974
986
|
class tr {
|
|
@@ -988,21 +1000,23 @@ class tr {
|
|
|
988
1000
|
}
|
|
989
1001
|
isNewerEvent(e, t, n) {
|
|
990
1002
|
const { event: r, blue: o } = t;
|
|
991
|
-
return r ?
|
|
1003
|
+
return r ? mt(o, r, n) : !0;
|
|
992
1004
|
}
|
|
993
1005
|
}
|
|
994
|
-
const xe = g(w["Conversation/Trigger Event"])(
|
|
1006
|
+
const xe = g(w["Conversation/Trigger Event"])(oe.extend({
|
|
995
1007
|
description: l.string().optional(),
|
|
996
1008
|
event: b().optional(),
|
|
997
1009
|
name: l.string().optional()
|
|
998
1010
|
}));
|
|
999
1011
|
function ve(i) {
|
|
1000
|
-
const { context: e, eventNode: t, stepResults: n } = i,
|
|
1012
|
+
const { context: e, eventNode: t, stepResults: n, contractNode: r } = i, o = rr(e), s = r != null ? e.blue.nodeToJson(r, "simple") : null, a = r != null ? e.blue.nodeToJson(r, "official") : s;
|
|
1001
1013
|
return {
|
|
1002
1014
|
event: e.blue.nodeToJson(t, "simple"),
|
|
1003
1015
|
eventCanonical: e.blue.nodeToJson(t, "official"),
|
|
1004
1016
|
steps: n,
|
|
1005
|
-
document:
|
|
1017
|
+
document: o,
|
|
1018
|
+
currentContract: s,
|
|
1019
|
+
currentContractCanonical: a
|
|
1006
1020
|
};
|
|
1007
1021
|
}
|
|
1008
1022
|
const nr = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
|
|
@@ -1015,7 +1029,7 @@ function rr(i) {
|
|
|
1015
1029
|
}, t = (o) => {
|
|
1016
1030
|
const s = o == null ? "/" : typeof o == "string" ? o : (() => {
|
|
1017
1031
|
throw new TypeError("document() expects a string pointer");
|
|
1018
|
-
})(), a = s.startsWith("/") ? s : i.resolvePointer(s), c =
|
|
1032
|
+
})(), a = s.startsWith("/") ? s : i.resolvePointer(s), c = P(a), u = i.documentAt(c);
|
|
1019
1033
|
return i.gasMeter().chargeDocumentSnapshot(c, u), { snapshot: u, normalizedPointer: c };
|
|
1020
1034
|
}, n = (o, s) => {
|
|
1021
1035
|
const { snapshot: a, normalizedPointer: c } = t(o);
|
|
@@ -1034,7 +1048,7 @@ class ir {
|
|
|
1034
1048
|
if (!n.blue.isTypeOf(t, xe))
|
|
1035
1049
|
return n.throwFatal("Trigger Event step payload is invalid");
|
|
1036
1050
|
n.gasMeter().chargeTriggerEventBase();
|
|
1037
|
-
const r = await
|
|
1051
|
+
const r = await ee({
|
|
1038
1052
|
evaluator: this.evaluator,
|
|
1039
1053
|
node: t,
|
|
1040
1054
|
bindings: ve(e),
|
|
@@ -1061,7 +1075,7 @@ function sr(i) {
|
|
|
1061
1075
|
const e = i.getProperties?.();
|
|
1062
1076
|
return e ? !!e.contracts : !1;
|
|
1063
1077
|
}
|
|
1064
|
-
const _e = g(w["Conversation/JavaScript Code"])(
|
|
1078
|
+
const _e = g(w["Conversation/JavaScript Code"])(oe.extend({
|
|
1065
1079
|
code: l.string().optional(),
|
|
1066
1080
|
description: l.string().optional(),
|
|
1067
1081
|
name: l.string().optional()
|
|
@@ -1111,13 +1125,13 @@ class ar {
|
|
|
1111
1125
|
}
|
|
1112
1126
|
}
|
|
1113
1127
|
}
|
|
1114
|
-
const cr = g(
|
|
1128
|
+
const cr = g(m["Core/Json Patch Entry"])(l.object({
|
|
1115
1129
|
description: l.string().optional(),
|
|
1116
1130
|
name: l.string().optional(),
|
|
1117
1131
|
op: l.string().optional(),
|
|
1118
1132
|
path: l.string().optional(),
|
|
1119
1133
|
val: b().optional()
|
|
1120
|
-
})), Le = g(w["Conversation/Update Document"])(
|
|
1134
|
+
})), Le = g(w["Conversation/Update Document"])(oe.extend({
|
|
1121
1135
|
changeset: l.array(cr).optional(),
|
|
1122
1136
|
description: l.string().optional(),
|
|
1123
1137
|
name: l.string().optional()
|
|
@@ -1131,7 +1145,7 @@ class lr {
|
|
|
1131
1145
|
const { context: t, stepNode: n } = e, { blue: r } = t;
|
|
1132
1146
|
if (!r.isTypeOf(n, Le))
|
|
1133
1147
|
return t.throwFatal("Update Document step payload is invalid");
|
|
1134
|
-
const o = await
|
|
1148
|
+
const o = await ee({
|
|
1135
1149
|
evaluator: this.evaluator,
|
|
1136
1150
|
node: n,
|
|
1137
1151
|
bindings: ve(e),
|
|
@@ -1184,37 +1198,38 @@ class gt {
|
|
|
1184
1198
|
this.executorIndex = t;
|
|
1185
1199
|
}
|
|
1186
1200
|
async run(e) {
|
|
1187
|
-
const { workflow: t, eventNode: n, context: r } = e,
|
|
1188
|
-
if (
|
|
1201
|
+
const { workflow: t, eventNode: n, context: r, contractNode: o } = e, s = t.steps ?? [];
|
|
1202
|
+
if (s.length === 0)
|
|
1189
1203
|
return {};
|
|
1190
|
-
const
|
|
1191
|
-
for (const [
|
|
1192
|
-
const
|
|
1193
|
-
if (he(
|
|
1204
|
+
const a = {};
|
|
1205
|
+
for (const [c, u] of s.entries()) {
|
|
1206
|
+
const h = u.getType?.()?.getBlueId();
|
|
1207
|
+
if (he(h))
|
|
1194
1208
|
return r.throwFatal(
|
|
1195
1209
|
"Sequential workflow step is missing type metadata"
|
|
1196
1210
|
);
|
|
1197
|
-
const
|
|
1198
|
-
if (he(
|
|
1199
|
-
const
|
|
1211
|
+
const d = this.executorIndex.get(h);
|
|
1212
|
+
if (he(d)) {
|
|
1213
|
+
const E = u.getType?.()?.getName?.() ?? h;
|
|
1200
1214
|
return r.throwFatal(
|
|
1201
|
-
`Unsupported workflow step type "${
|
|
1215
|
+
`Unsupported workflow step type "${E}"`
|
|
1202
1216
|
);
|
|
1203
1217
|
}
|
|
1204
|
-
const
|
|
1218
|
+
const v = {
|
|
1205
1219
|
workflow: t,
|
|
1206
|
-
stepNode:
|
|
1220
|
+
stepNode: u,
|
|
1207
1221
|
eventNode: n,
|
|
1208
1222
|
context: r,
|
|
1209
|
-
stepResults:
|
|
1210
|
-
stepIndex:
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1223
|
+
stepResults: a,
|
|
1224
|
+
stepIndex: c,
|
|
1225
|
+
contractNode: o
|
|
1226
|
+
}, f = await d.execute(v);
|
|
1227
|
+
if (f !== void 0) {
|
|
1228
|
+
const E = this.stepResultKey(u, c);
|
|
1229
|
+
a[E] = f;
|
|
1215
1230
|
}
|
|
1216
1231
|
}
|
|
1217
|
-
return
|
|
1232
|
+
return a;
|
|
1218
1233
|
}
|
|
1219
1234
|
stepResultKey(e, t) {
|
|
1220
1235
|
const n = e.getName?.();
|
|
@@ -1235,9 +1250,14 @@ class ur {
|
|
|
1235
1250
|
const n = t.event();
|
|
1236
1251
|
return !(!n || e.event && !t.blue.isTypeOfNode(n, e.event));
|
|
1237
1252
|
}
|
|
1238
|
-
async execute(e, t) {
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1253
|
+
async execute(e, t, n) {
|
|
1254
|
+
const r = t.event();
|
|
1255
|
+
r && await this.runner.run({
|
|
1256
|
+
workflow: e,
|
|
1257
|
+
eventNode: r,
|
|
1258
|
+
context: t,
|
|
1259
|
+
contractNode: n?.contractNode ?? null
|
|
1260
|
+
});
|
|
1241
1261
|
}
|
|
1242
1262
|
}
|
|
1243
1263
|
class hr {
|
|
@@ -1245,7 +1265,7 @@ class hr {
|
|
|
1245
1265
|
blueIds = [w["Conversation/Operation"]];
|
|
1246
1266
|
schema = Nn;
|
|
1247
1267
|
}
|
|
1248
|
-
const
|
|
1268
|
+
const fe = g(w["Conversation/Operation Request"])(l.object({
|
|
1249
1269
|
allowNewerVersion: l.boolean().optional(),
|
|
1250
1270
|
description: l.string().optional(),
|
|
1251
1271
|
document: b().optional(),
|
|
@@ -1267,7 +1287,7 @@ function dr(i, e) {
|
|
|
1267
1287
|
return t instanceof p ? e.blue.calculateBlueIdSync(t) : null;
|
|
1268
1288
|
}
|
|
1269
1289
|
function pr(i, e) {
|
|
1270
|
-
if (e.isTypeOf(i,
|
|
1290
|
+
if (e.isTypeOf(i, fe, {
|
|
1271
1291
|
checkSchemaExtensions: !0
|
|
1272
1292
|
}))
|
|
1273
1293
|
return i;
|
|
@@ -1275,27 +1295,27 @@ function pr(i, e) {
|
|
|
1275
1295
|
checkSchemaExtensions: !0
|
|
1276
1296
|
})) {
|
|
1277
1297
|
const n = e.nodeToSchemaOutput(i, M).message;
|
|
1278
|
-
if (n && e.isTypeOf(n,
|
|
1298
|
+
if (n && e.isTypeOf(n, fe, {
|
|
1279
1299
|
checkSchemaExtensions: !0
|
|
1280
1300
|
}))
|
|
1281
1301
|
return n;
|
|
1282
1302
|
}
|
|
1283
1303
|
return null;
|
|
1284
1304
|
}
|
|
1285
|
-
function
|
|
1305
|
+
function fr(i, e, t, n) {
|
|
1286
1306
|
const { blue: r } = n, o = i.operation;
|
|
1287
1307
|
return !(!o || t.operation !== o || i.event && !r.isTypeOfNode(e, i.event));
|
|
1288
1308
|
}
|
|
1289
|
-
function
|
|
1309
|
+
function mr(i, e) {
|
|
1290
1310
|
const t = i.operation;
|
|
1291
1311
|
if (!t)
|
|
1292
1312
|
return null;
|
|
1293
1313
|
const n = e.resolvePointer(`/contracts/${t}`), r = e.documentAt(n);
|
|
1294
|
-
if (!r || !e.blue.isTypeOf(r,
|
|
1314
|
+
if (!r || !e.blue.isTypeOf(r, J))
|
|
1295
1315
|
return null;
|
|
1296
1316
|
const o = e.blue.nodeToSchemaOutput(
|
|
1297
1317
|
r,
|
|
1298
|
-
|
|
1318
|
+
J
|
|
1299
1319
|
), s = Et(o);
|
|
1300
1320
|
return { operationNode: r, operation: o, channelKey: s };
|
|
1301
1321
|
}
|
|
@@ -1341,11 +1361,11 @@ class Cr {
|
|
|
1341
1361
|
if (!n)
|
|
1342
1362
|
return null;
|
|
1343
1363
|
const r = t.scopeContracts.get(n);
|
|
1344
|
-
if (!r || !t.blue.isTypeOf(r.node,
|
|
1364
|
+
if (!r || !t.blue.isTypeOf(r.node, J, {
|
|
1345
1365
|
checkSchemaExtensions: !0
|
|
1346
1366
|
}))
|
|
1347
1367
|
return null;
|
|
1348
|
-
const o = t.blue.nodeToSchemaOutput(r.node,
|
|
1368
|
+
const o = t.blue.nodeToSchemaOutput(r.node, J);
|
|
1349
1369
|
return o ? Et(o) : null;
|
|
1350
1370
|
}
|
|
1351
1371
|
async matches(e, t) {
|
|
@@ -1360,11 +1380,11 @@ class Cr {
|
|
|
1360
1380
|
return !1;
|
|
1361
1381
|
const o = t.blue.nodeToSchemaOutput(
|
|
1362
1382
|
r,
|
|
1363
|
-
|
|
1383
|
+
fe
|
|
1364
1384
|
);
|
|
1365
|
-
if (!o || !
|
|
1385
|
+
if (!o || !fr(e, n, o, t))
|
|
1366
1386
|
return !1;
|
|
1367
|
-
const s =
|
|
1387
|
+
const s = mr(e, t);
|
|
1368
1388
|
if (!s)
|
|
1369
1389
|
return !1;
|
|
1370
1390
|
const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
|
|
@@ -1374,21 +1394,22 @@ class Cr {
|
|
|
1374
1394
|
t.blue
|
|
1375
1395
|
) || o?.allowNewerVersion === !1 && !yr(o, r, t));
|
|
1376
1396
|
}
|
|
1377
|
-
async execute(e, t) {
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1397
|
+
async execute(e, t, n) {
|
|
1398
|
+
const r = t.event();
|
|
1399
|
+
r && await this.runner.run({
|
|
1380
1400
|
workflow: e,
|
|
1381
|
-
eventNode:
|
|
1382
|
-
context: t
|
|
1401
|
+
eventNode: r,
|
|
1402
|
+
context: t,
|
|
1403
|
+
contractNode: n?.contractNode ?? null
|
|
1383
1404
|
});
|
|
1384
1405
|
}
|
|
1385
1406
|
}
|
|
1386
|
-
class
|
|
1407
|
+
class se {
|
|
1387
1408
|
constructor(e) {
|
|
1388
1409
|
this.registry = e;
|
|
1389
1410
|
}
|
|
1390
1411
|
static create() {
|
|
1391
|
-
return new
|
|
1412
|
+
return new se(
|
|
1392
1413
|
new qn()
|
|
1393
1414
|
);
|
|
1394
1415
|
}
|
|
@@ -1402,7 +1423,7 @@ class oe {
|
|
|
1402
1423
|
return this.registry;
|
|
1403
1424
|
}
|
|
1404
1425
|
}
|
|
1405
|
-
const
|
|
1426
|
+
const me = m["Core/Channel Event Checkpoint"];
|
|
1406
1427
|
function yt(i) {
|
|
1407
1428
|
return typeof i.order == "number" ? i.order : 0;
|
|
1408
1429
|
}
|
|
@@ -1424,8 +1445,8 @@ class Sr {
|
|
|
1424
1445
|
}
|
|
1425
1446
|
}
|
|
1426
1447
|
class vr {
|
|
1427
|
-
constructor(e, t, n) {
|
|
1428
|
-
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
|
|
1448
|
+
constructor(e, t, n, r) {
|
|
1449
|
+
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
|
|
1429
1450
|
}
|
|
1430
1451
|
key() {
|
|
1431
1452
|
return this.bindingKey;
|
|
@@ -1436,6 +1457,9 @@ class vr {
|
|
|
1436
1457
|
blueId() {
|
|
1437
1458
|
return this.bindingBlueId;
|
|
1438
1459
|
}
|
|
1460
|
+
node() {
|
|
1461
|
+
return this.bindingNode.clone();
|
|
1462
|
+
}
|
|
1439
1463
|
order() {
|
|
1440
1464
|
return yt(this.bindingContract);
|
|
1441
1465
|
}
|
|
@@ -1491,13 +1515,18 @@ class V {
|
|
|
1491
1515
|
this.markerStore.set(A, {
|
|
1492
1516
|
key: A,
|
|
1493
1517
|
contract: e,
|
|
1494
|
-
blueId:
|
|
1518
|
+
blueId: me
|
|
1495
1519
|
}), this.checkpointDeclared = !0;
|
|
1496
1520
|
}
|
|
1497
1521
|
handlersFor(e) {
|
|
1498
1522
|
const t = this.handlersByChannel.get(e);
|
|
1499
1523
|
return !t || t.length === 0 ? [] : [...t].map(
|
|
1500
|
-
(n) => new vr(
|
|
1524
|
+
(n) => new vr(
|
|
1525
|
+
n.key,
|
|
1526
|
+
n.contract,
|
|
1527
|
+
n.blueId,
|
|
1528
|
+
n.node
|
|
1529
|
+
)
|
|
1501
1530
|
).sort((n, r) => {
|
|
1502
1531
|
const o = n.order() - r.order();
|
|
1503
1532
|
return o !== 0 ? o : n.key().localeCompare(r.key());
|
|
@@ -1527,12 +1556,12 @@ class wr {
|
|
|
1527
1556
|
addChannel(e, t, n) {
|
|
1528
1557
|
return this.channels.set(e, { key: e, contract: t, blueId: n }), this;
|
|
1529
1558
|
}
|
|
1530
|
-
addHandler(e, t, n) {
|
|
1531
|
-
const
|
|
1532
|
-
if (!
|
|
1559
|
+
addHandler(e, t, n, r) {
|
|
1560
|
+
const o = t.channel;
|
|
1561
|
+
if (!o)
|
|
1533
1562
|
throw new Error(`Handler ${e} must declare channel`);
|
|
1534
|
-
const
|
|
1535
|
-
return
|
|
1563
|
+
const s = this.handlersByChannel.get(o) ?? [];
|
|
1564
|
+
return s.push({ key: e, contract: t, blueId: n, node: r }), this.handlersByChannel.set(o, s), this;
|
|
1536
1565
|
}
|
|
1537
1566
|
setEmbedded(e) {
|
|
1538
1567
|
if (this.embeddedDeclared)
|
|
@@ -1542,11 +1571,11 @@ class wr {
|
|
|
1542
1571
|
return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
|
|
1543
1572
|
}
|
|
1544
1573
|
addMarker(e, t, n) {
|
|
1545
|
-
if (e === A && n !==
|
|
1574
|
+
if (e === A && n !== me)
|
|
1546
1575
|
throw new Error(
|
|
1547
1576
|
"Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
|
|
1548
1577
|
);
|
|
1549
|
-
if (n ===
|
|
1578
|
+
if (n === me) {
|
|
1550
1579
|
if (e !== A)
|
|
1551
1580
|
throw new Error(
|
|
1552
1581
|
`Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
|
|
@@ -1604,7 +1633,7 @@ class kr {
|
|
|
1604
1633
|
if (!h)
|
|
1605
1634
|
throw new y(
|
|
1606
1635
|
`Handler ${t} references unknown channel '${u}'`,
|
|
1607
|
-
|
|
1636
|
+
S.invalidContract(
|
|
1608
1637
|
o,
|
|
1609
1638
|
`Channel '${u}' is not declared in this scope`,
|
|
1610
1639
|
`/contracts/${u}`
|
|
@@ -1613,18 +1642,24 @@ class kr {
|
|
|
1613
1642
|
if (!this.isRegisteredChannel(h.nodeTypeBlueId))
|
|
1614
1643
|
throw new y(
|
|
1615
1644
|
`Contract '${u}' is not a channel`,
|
|
1616
|
-
|
|
1645
|
+
S.invalidContract(
|
|
1617
1646
|
h.nodeTypeBlueId,
|
|
1618
1647
|
`Contract '${u}' is not a channel`,
|
|
1619
1648
|
`/contracts/${u}`
|
|
1620
1649
|
)
|
|
1621
1650
|
);
|
|
1622
|
-
|
|
1651
|
+
const d = n.clone();
|
|
1652
|
+
this.setContractChannel(d, u), e.addHandler(
|
|
1653
|
+
t,
|
|
1654
|
+
{ ...c, channel: u },
|
|
1655
|
+
o,
|
|
1656
|
+
d
|
|
1657
|
+
);
|
|
1623
1658
|
} catch (a) {
|
|
1624
1659
|
if (this.isZodError(a))
|
|
1625
1660
|
throw new y(
|
|
1626
1661
|
"Failed to parse handler contract",
|
|
1627
|
-
|
|
1662
|
+
S.invalidContract(
|
|
1628
1663
|
o,
|
|
1629
1664
|
"Failed to parse handler contract",
|
|
1630
1665
|
t,
|
|
@@ -1634,7 +1669,7 @@ class kr {
|
|
|
1634
1669
|
const c = a?.message ?? "Failed to register handler contract";
|
|
1635
1670
|
throw new y(
|
|
1636
1671
|
c,
|
|
1637
|
-
|
|
1672
|
+
S.illegalState(c)
|
|
1638
1673
|
);
|
|
1639
1674
|
}
|
|
1640
1675
|
}
|
|
@@ -1658,7 +1693,7 @@ class kr {
|
|
|
1658
1693
|
if (!o)
|
|
1659
1694
|
throw new y(
|
|
1660
1695
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`,
|
|
1661
|
-
|
|
1696
|
+
S.illegalState(
|
|
1662
1697
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`
|
|
1663
1698
|
)
|
|
1664
1699
|
);
|
|
@@ -1667,6 +1702,14 @@ class kr {
|
|
|
1667
1702
|
isRegisteredChannel(e) {
|
|
1668
1703
|
return this.builtinChannelSchemas.has(e) ? !0 : this.registry.lookupChannel(e) != null;
|
|
1669
1704
|
}
|
|
1705
|
+
setContractChannel(e, t) {
|
|
1706
|
+
const r = e.getProperties()?.channel;
|
|
1707
|
+
if (r instanceof p) {
|
|
1708
|
+
r.setValue(t);
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
e.addProperty("channel", new p().setValue(t));
|
|
1712
|
+
}
|
|
1670
1713
|
isZodError(e) {
|
|
1671
1714
|
return e instanceof ge;
|
|
1672
1715
|
}
|
|
@@ -1686,75 +1729,75 @@ function br(i) {
|
|
|
1686
1729
|
compositeChannelBlueId: s
|
|
1687
1730
|
} = i, a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), u = [], h = /* @__PURE__ */ new Map([
|
|
1688
1731
|
[e, t]
|
|
1689
|
-
]), d = (
|
|
1690
|
-
if (h.has(
|
|
1691
|
-
return h.get(
|
|
1692
|
-
const E = n.get(
|
|
1732
|
+
]), d = (f) => {
|
|
1733
|
+
if (h.has(f))
|
|
1734
|
+
return h.get(f) ?? null;
|
|
1735
|
+
const E = n.get(f);
|
|
1693
1736
|
if (!E || E.nodeTypeBlueId !== s)
|
|
1694
|
-
return h.set(
|
|
1737
|
+
return h.set(f, null), null;
|
|
1695
1738
|
try {
|
|
1696
1739
|
const C = o.nodeToSchemaOutput(
|
|
1697
1740
|
E.node,
|
|
1698
1741
|
dt
|
|
1699
1742
|
);
|
|
1700
|
-
return h.set(
|
|
1743
|
+
return h.set(f, C), C;
|
|
1701
1744
|
} catch (C) {
|
|
1702
|
-
if (
|
|
1745
|
+
if (Tr(C))
|
|
1703
1746
|
throw new y(
|
|
1704
1747
|
"Failed to parse channel contract",
|
|
1705
|
-
|
|
1748
|
+
S.invalidContract(
|
|
1706
1749
|
E.nodeTypeBlueId,
|
|
1707
1750
|
"Failed to parse channel contract",
|
|
1708
|
-
`/contracts/${
|
|
1751
|
+
`/contracts/${f}`,
|
|
1709
1752
|
C
|
|
1710
1753
|
)
|
|
1711
1754
|
);
|
|
1712
|
-
const
|
|
1755
|
+
const R = C?.message ?? "Failed to parse channel contract";
|
|
1713
1756
|
throw new y(
|
|
1714
|
-
|
|
1715
|
-
|
|
1757
|
+
R,
|
|
1758
|
+
S.illegalState(R)
|
|
1716
1759
|
);
|
|
1717
1760
|
}
|
|
1718
|
-
},
|
|
1719
|
-
if (c.has(
|
|
1720
|
-
const C = u.indexOf(
|
|
1761
|
+
}, v = (f) => {
|
|
1762
|
+
if (c.has(f)) {
|
|
1763
|
+
const C = u.indexOf(f), D = [...u.slice(C), f].join(" -> ");
|
|
1721
1764
|
throw new y(
|
|
1722
1765
|
`Composite channel ${e} has a cyclic reference: ${D}`,
|
|
1723
|
-
|
|
1766
|
+
S.invalidContract(
|
|
1724
1767
|
r,
|
|
1725
1768
|
`Composite channel '${e}' has a cyclic reference: ${D}`,
|
|
1726
1769
|
`/contracts/${e}`
|
|
1727
1770
|
)
|
|
1728
1771
|
);
|
|
1729
1772
|
}
|
|
1730
|
-
if (a.has(
|
|
1773
|
+
if (a.has(f))
|
|
1731
1774
|
return;
|
|
1732
|
-
c.add(
|
|
1733
|
-
const E = d(
|
|
1775
|
+
c.add(f), u.push(f);
|
|
1776
|
+
const E = d(f);
|
|
1734
1777
|
if (E)
|
|
1735
1778
|
for (const C of E.channels ?? []) {
|
|
1736
|
-
const
|
|
1737
|
-
|
|
1779
|
+
const R = n.get(C);
|
|
1780
|
+
R && R.nodeTypeBlueId === s && v(C);
|
|
1738
1781
|
}
|
|
1739
|
-
u.pop(), c.delete(
|
|
1782
|
+
u.pop(), c.delete(f), a.add(f);
|
|
1740
1783
|
};
|
|
1741
|
-
|
|
1784
|
+
v(e);
|
|
1742
1785
|
}
|
|
1743
|
-
function
|
|
1786
|
+
function Tr(i) {
|
|
1744
1787
|
return i instanceof ge;
|
|
1745
1788
|
}
|
|
1746
|
-
const
|
|
1789
|
+
const Ir = m["Core/Document Update Channel"], Pr = m["Core/Embedded Node Channel"], Rr = m["Core/Lifecycle Event Channel"], Mr = m["Core/Triggered Event Channel"], Fe = m["Core/Process Embedded"], Nr = m["Core/Processing Initialized Marker"], Or = m["Core/Processing Terminated Marker"], Ar = m["Core/Channel Event Checkpoint"], Dr = T["MyOS/Document Anchors"], Br = T["MyOS/Document Links"], xr = T["MyOS/MyOS Participants Orchestration"], _r = T["MyOS/MyOS Session Interaction"], Lr = T["MyOS/MyOS Worker Agency"], Ue = w["Conversation/Composite Timeline Channel"], ce = /* @__PURE__ */ new Map([
|
|
1747
1790
|
[
|
|
1748
|
-
|
|
1791
|
+
Ir,
|
|
1749
1792
|
hn
|
|
1750
1793
|
],
|
|
1751
1794
|
[
|
|
1752
|
-
|
|
1795
|
+
Pr,
|
|
1753
1796
|
pn
|
|
1754
1797
|
],
|
|
1755
1798
|
[
|
|
1756
|
-
|
|
1757
|
-
|
|
1799
|
+
Rr,
|
|
1800
|
+
mn
|
|
1758
1801
|
],
|
|
1759
1802
|
[
|
|
1760
1803
|
Mr,
|
|
@@ -1763,7 +1806,7 @@ const Tr = f["Core/Document Update Channel"], Rr = f["Core/Embedded Node Channel
|
|
|
1763
1806
|
]), Fr = /* @__PURE__ */ new Map([
|
|
1764
1807
|
[
|
|
1765
1808
|
Nr,
|
|
1766
|
-
|
|
1809
|
+
Tn
|
|
1767
1810
|
],
|
|
1768
1811
|
[
|
|
1769
1812
|
Or,
|
|
@@ -1818,7 +1861,7 @@ class Ur {
|
|
|
1818
1861
|
const r = n?.message ?? "Failed to load contracts";
|
|
1819
1862
|
throw new y(
|
|
1820
1863
|
`Failed to load contracts for scope ${t}: ${r}`,
|
|
1821
|
-
|
|
1864
|
+
S.runtimeFatal(
|
|
1822
1865
|
`Failed to load contracts for scope ${t}`,
|
|
1823
1866
|
n
|
|
1824
1867
|
)
|
|
@@ -1887,7 +1930,7 @@ class Ur {
|
|
|
1887
1930
|
}
|
|
1888
1931
|
throw ye(o) ? new y(
|
|
1889
1932
|
"Built-in processor-managed channel is missing schema registration",
|
|
1890
|
-
|
|
1933
|
+
S.invalidContract(
|
|
1891
1934
|
o,
|
|
1892
1935
|
"Built-in processor-managed channel is missing schema registration",
|
|
1893
1936
|
t
|
|
@@ -1898,13 +1941,13 @@ class Ur {
|
|
|
1898
1941
|
try {
|
|
1899
1942
|
const r = this.blue.nodeToSchemaOutput(
|
|
1900
1943
|
n,
|
|
1901
|
-
|
|
1944
|
+
Pn
|
|
1902
1945
|
);
|
|
1903
1946
|
e.setEmbedded(r);
|
|
1904
1947
|
} catch (r) {
|
|
1905
1948
|
throw le(r) ? new y(
|
|
1906
1949
|
"Failed to parse ProcessEmbedded marker",
|
|
1907
|
-
|
|
1950
|
+
S.invalidContract(
|
|
1908
1951
|
Fe,
|
|
1909
1952
|
"Failed to parse ProcessEmbedded marker",
|
|
1910
1953
|
t,
|
|
@@ -1912,7 +1955,7 @@ class Ur {
|
|
|
1912
1955
|
)
|
|
1913
1956
|
) : new y(
|
|
1914
1957
|
r?.message ?? "Failed to register ProcessEmbedded marker",
|
|
1915
|
-
|
|
1958
|
+
S.illegalState(
|
|
1916
1959
|
r?.message ?? "Failed to register ProcessEmbedded marker"
|
|
1917
1960
|
)
|
|
1918
1961
|
);
|
|
@@ -1936,7 +1979,7 @@ class Ur {
|
|
|
1936
1979
|
if (le(a))
|
|
1937
1980
|
throw new y(
|
|
1938
1981
|
"Failed to parse channel contract",
|
|
1939
|
-
|
|
1982
|
+
S.invalidContract(
|
|
1940
1983
|
o,
|
|
1941
1984
|
"Failed to parse channel contract",
|
|
1942
1985
|
t,
|
|
@@ -1946,7 +1989,7 @@ class Ur {
|
|
|
1946
1989
|
const c = a?.message ?? "Failed to register channel contract";
|
|
1947
1990
|
throw new y(
|
|
1948
1991
|
c,
|
|
1949
|
-
|
|
1992
|
+
S.illegalState(c)
|
|
1950
1993
|
);
|
|
1951
1994
|
}
|
|
1952
1995
|
}
|
|
@@ -1958,7 +2001,7 @@ class Ur {
|
|
|
1958
2001
|
if (!a)
|
|
1959
2002
|
throw new y(
|
|
1960
2003
|
`Composite channel ${e} references unknown channel '${s}'`,
|
|
1961
|
-
|
|
2004
|
+
S.invalidContract(
|
|
1962
2005
|
r,
|
|
1963
2006
|
`Channel '${s}' is not declared in this scope`,
|
|
1964
2007
|
`/contracts/${s}`
|
|
@@ -1967,7 +2010,7 @@ class Ur {
|
|
|
1967
2010
|
if (!this.isRegisteredChannel(a.nodeTypeBlueId))
|
|
1968
2011
|
throw new y(
|
|
1969
2012
|
`Contract '${s}' is not a channel`,
|
|
1970
|
-
|
|
2013
|
+
S.invalidContract(
|
|
1971
2014
|
a.nodeTypeBlueId,
|
|
1972
2015
|
`Contract '${s}' is not a channel`,
|
|
1973
2016
|
`/contracts/${s}`
|
|
@@ -1998,7 +2041,7 @@ class Ur {
|
|
|
1998
2041
|
if (le(s))
|
|
1999
2042
|
throw new y(
|
|
2000
2043
|
"Failed to parse marker contract",
|
|
2001
|
-
|
|
2044
|
+
S.invalidContract(
|
|
2002
2045
|
o,
|
|
2003
2046
|
"Failed to parse marker contract",
|
|
2004
2047
|
t,
|
|
@@ -2008,7 +2051,7 @@ class Ur {
|
|
|
2008
2051
|
const a = s?.message ?? "Failed to register marker contract";
|
|
2009
2052
|
throw new y(
|
|
2010
2053
|
a,
|
|
2011
|
-
|
|
2054
|
+
S.illegalState(a)
|
|
2012
2055
|
);
|
|
2013
2056
|
}
|
|
2014
2057
|
}
|
|
@@ -2026,7 +2069,7 @@ class Ur {
|
|
|
2026
2069
|
function le(i) {
|
|
2027
2070
|
return i instanceof ge;
|
|
2028
2071
|
}
|
|
2029
|
-
const $r =
|
|
2072
|
+
const $r = m["Core/Channel Event Checkpoint"];
|
|
2030
2073
|
function zr(i) {
|
|
2031
2074
|
return i.jsonValueToNode({
|
|
2032
2075
|
type: { blueId: $r },
|
|
@@ -2058,7 +2101,7 @@ class Kr {
|
|
|
2058
2101
|
this.runtime = e, this.signatureFn = t;
|
|
2059
2102
|
}
|
|
2060
2103
|
ensureCheckpointMarker(e, t) {
|
|
2061
|
-
const n = t.marker(A), r =
|
|
2104
|
+
const n = t.marker(A), r = I(e, Qe);
|
|
2062
2105
|
if (!n) {
|
|
2063
2106
|
const o = zr(this.runtime.blue());
|
|
2064
2107
|
this.runtime.directWrite(r, o), t.registerCheckpointMarker(Vr());
|
|
@@ -2090,12 +2133,12 @@ class Kr {
|
|
|
2090
2133
|
persist(e, t, n, r, o) {
|
|
2091
2134
|
if (!n)
|
|
2092
2135
|
return;
|
|
2093
|
-
const s =
|
|
2136
|
+
const s = I(
|
|
2094
2137
|
e,
|
|
2095
2138
|
Ze(n.markerKey, n.channelKey)
|
|
2096
2139
|
), a = o?.clone() ?? null;
|
|
2097
2140
|
this.runtime.gasMeter().chargeCheckpointUpdate(), this.runtime.directWrite(s, 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;
|
|
2098
|
-
const c =
|
|
2141
|
+
const c = I(
|
|
2099
2142
|
e,
|
|
2100
2143
|
et(n.markerKey, n.channelKey)
|
|
2101
2144
|
), u = r == null ? null : new p().setValue(r);
|
|
@@ -2234,7 +2277,7 @@ function Gr(i, e) {
|
|
|
2234
2277
|
}
|
|
2235
2278
|
class $ extends y {
|
|
2236
2279
|
constructor(e) {
|
|
2237
|
-
super(e,
|
|
2280
|
+
super(e, S.illegalState(e)), this.name = "IllegalStateException";
|
|
2238
2281
|
}
|
|
2239
2282
|
}
|
|
2240
2283
|
class F extends Error {
|
|
@@ -2242,7 +2285,7 @@ class F extends Error {
|
|
|
2242
2285
|
super(e), this.name = "BoundaryViolationException";
|
|
2243
2286
|
}
|
|
2244
2287
|
}
|
|
2245
|
-
const qr =
|
|
2288
|
+
const qr = m["Core/Document Update Channel"], jr = m["Core/Embedded Node Channel"], Jr = m["Core/Triggered Event Channel"], Qr = m["Core/Lifecycle Event Channel"], ze = m["Core/Processing Initialized Marker"], Xr = m["Core/Document Processing Initiated"];
|
|
2246
2289
|
class Yr {
|
|
2247
2290
|
runtime;
|
|
2248
2291
|
contractLoader;
|
|
@@ -2264,12 +2307,12 @@ class Yr {
|
|
|
2264
2307
|
if (!d)
|
|
2265
2308
|
return;
|
|
2266
2309
|
s || (s = d.clone()), o = this.loadBundle(d, n), this.bundles.set(n, o);
|
|
2267
|
-
const
|
|
2268
|
-
if (!
|
|
2310
|
+
const v = o.embeddedPaths().find((C) => !r.has(C)) ?? null;
|
|
2311
|
+
if (!v)
|
|
2269
2312
|
break;
|
|
2270
|
-
r.add(
|
|
2271
|
-
const
|
|
2272
|
-
this.nodeAt(
|
|
2313
|
+
r.add(v);
|
|
2314
|
+
const f = I(n, v);
|
|
2315
|
+
this.nodeAt(f) && await this.initializeScope(f, !0);
|
|
2273
2316
|
}
|
|
2274
2317
|
if (!o)
|
|
2275
2318
|
return;
|
|
@@ -2297,7 +2340,7 @@ class Yr {
|
|
|
2297
2340
|
const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : V.empty();
|
|
2298
2341
|
this.bundles.set(t, r);
|
|
2299
2342
|
for (const o of r.embeddedPaths()) {
|
|
2300
|
-
const s =
|
|
2343
|
+
const s = I(t, o);
|
|
2301
2344
|
this.loadBundles(s);
|
|
2302
2345
|
}
|
|
2303
2346
|
}
|
|
@@ -2426,7 +2469,7 @@ class Yr {
|
|
|
2426
2469
|
if (!s)
|
|
2427
2470
|
return o;
|
|
2428
2471
|
r.add(s);
|
|
2429
|
-
const a =
|
|
2472
|
+
const a = I(n, s);
|
|
2430
2473
|
if (a === n || this.hooks.isScopeInactive(a)) {
|
|
2431
2474
|
o = this.refreshBundle(n);
|
|
2432
2475
|
continue;
|
|
@@ -2459,7 +2502,7 @@ class Yr {
|
|
|
2459
2502
|
const r = n?.message ?? "Failed to load contracts";
|
|
2460
2503
|
throw new y(
|
|
2461
2504
|
r,
|
|
2462
|
-
|
|
2505
|
+
S.runtimeFatal(
|
|
2463
2506
|
`Failed to load contracts for scope ${t}`,
|
|
2464
2507
|
n
|
|
2465
2508
|
)
|
|
@@ -2485,13 +2528,13 @@ class Yr {
|
|
|
2485
2528
|
);
|
|
2486
2529
|
if (n.length !== 0)
|
|
2487
2530
|
for (const r of t.embeddedPaths()) {
|
|
2488
|
-
const o =
|
|
2531
|
+
const o = I(e, r), a = this.runtime.scope(o).drainBridgeableEvents();
|
|
2489
2532
|
if (a.length !== 0)
|
|
2490
2533
|
for (const c of a) {
|
|
2491
2534
|
let u = !1;
|
|
2492
2535
|
for (const h of n) {
|
|
2493
|
-
const
|
|
2494
|
-
|
|
2536
|
+
const v = h.contract().childPath ?? "/";
|
|
2537
|
+
I(e, v) === o && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
|
|
2495
2538
|
e,
|
|
2496
2539
|
t,
|
|
2497
2540
|
h.key(),
|
|
@@ -2536,7 +2579,7 @@ class Yr {
|
|
|
2536
2579
|
}
|
|
2537
2580
|
}
|
|
2538
2581
|
validatePatchBoundary(e, t, n) {
|
|
2539
|
-
const r = k(e), o =
|
|
2582
|
+
const r = k(e), o = P(n.path);
|
|
2540
2583
|
if (o === r)
|
|
2541
2584
|
throw new F(
|
|
2542
2585
|
`Self-root mutation is forbidden at scope ${r}`
|
|
@@ -2546,7 +2589,7 @@ class Yr {
|
|
|
2546
2589
|
`Patch path ${o} is outside scope ${r}`
|
|
2547
2590
|
);
|
|
2548
2591
|
for (const s of t.embeddedPaths()) {
|
|
2549
|
-
const a =
|
|
2592
|
+
const a = I(r, s);
|
|
2550
2593
|
if (o.startsWith(`${a}/`))
|
|
2551
2594
|
throw new F(
|
|
2552
2595
|
`Boundary violation: patch ${o} enters embedded scope ${a}`
|
|
@@ -2556,11 +2599,11 @@ class Yr {
|
|
|
2556
2599
|
enforceReservedKeyWriteProtection(e, t, n) {
|
|
2557
2600
|
if (n)
|
|
2558
2601
|
return;
|
|
2559
|
-
const r = k(e), o =
|
|
2602
|
+
const r = k(e), o = P(t.path);
|
|
2560
2603
|
for (const s of Ee) {
|
|
2561
|
-
const a =
|
|
2604
|
+
const a = I(
|
|
2562
2605
|
r,
|
|
2563
|
-
|
|
2606
|
+
re(s)
|
|
2564
2607
|
);
|
|
2565
2608
|
if (o === a || o.startsWith(`${a}/`))
|
|
2566
2609
|
throw new F(
|
|
@@ -2571,14 +2614,14 @@ class Yr {
|
|
|
2571
2614
|
async markCutOffChildrenIfNeeded(e, t, n) {
|
|
2572
2615
|
if (t.embeddedPaths().length === 0)
|
|
2573
2616
|
return;
|
|
2574
|
-
const r =
|
|
2617
|
+
const r = P(n.path);
|
|
2575
2618
|
for (const o of t.embeddedPaths()) {
|
|
2576
|
-
const s =
|
|
2619
|
+
const s = I(e, o);
|
|
2577
2620
|
r === s && (n.op === "remove" || n.op === "replace") && await this.hooks.markCutOff(s);
|
|
2578
2621
|
}
|
|
2579
2622
|
}
|
|
2580
2623
|
hasInitializationMarker(e) {
|
|
2581
|
-
const t =
|
|
2624
|
+
const t = I(e, de), n = this.nodeAt(t);
|
|
2582
2625
|
if (!n)
|
|
2583
2626
|
return !1;
|
|
2584
2627
|
if (!(n instanceof p)) {
|
|
@@ -2598,21 +2641,21 @@ class Yr {
|
|
|
2598
2641
|
});
|
|
2599
2642
|
}
|
|
2600
2643
|
}
|
|
2601
|
-
class
|
|
2644
|
+
class te extends Error {
|
|
2602
2645
|
constructor(e) {
|
|
2603
2646
|
super(
|
|
2604
2647
|
e ? "Processing terminated due to fatal error" : "Processing terminated"
|
|
2605
2648
|
), this.fatal = e, this.name = "RunTerminationError";
|
|
2606
2649
|
}
|
|
2607
2650
|
}
|
|
2608
|
-
const Zr =
|
|
2651
|
+
const Zr = m["Core/Processing Terminated Marker"], ei = m["Core/Document Processing Terminated"];
|
|
2609
2652
|
class ti {
|
|
2610
2653
|
constructor(e) {
|
|
2611
2654
|
this.runtime = e;
|
|
2612
2655
|
}
|
|
2613
2656
|
async terminateScope(e, t, n, r, o) {
|
|
2614
2657
|
e.recordPendingTermination(t, r, o ?? null);
|
|
2615
|
-
const s = e.normalizeScope(t), a =
|
|
2658
|
+
const s = e.normalizeScope(t), a = I(s, Je);
|
|
2616
2659
|
this.runtime.directWrite(
|
|
2617
2660
|
a,
|
|
2618
2661
|
ni(this.runtime.blue(), r, o)
|
|
@@ -2624,9 +2667,9 @@ class ti {
|
|
|
2624
2667
|
u,
|
|
2625
2668
|
!1
|
|
2626
2669
|
), this.runtime.scope(s).finalizeTermination(r, o ?? null), e.clearPendingTermination(t), r === "FATAL" && this.runtime.gasMeter().chargeFatalTerminationOverhead(), r === "FATAL" && s === "/")
|
|
2627
|
-
throw this.runtime.markRunTerminated(), new
|
|
2670
|
+
throw this.runtime.markRunTerminated(), new te(!0);
|
|
2628
2671
|
if (r === "GRACEFUL" && s === "/")
|
|
2629
|
-
throw this.runtime.markRunTerminated(), new
|
|
2672
|
+
throw this.runtime.markRunTerminated(), new te(!1);
|
|
2630
2673
|
}
|
|
2631
2674
|
}
|
|
2632
2675
|
function ni(i, e, t) {
|
|
@@ -2648,13 +2691,13 @@ function ri(i, e) {
|
|
|
2648
2691
|
function ii(i, e) {
|
|
2649
2692
|
return i.jsonValueToNode(e);
|
|
2650
2693
|
}
|
|
2651
|
-
const
|
|
2694
|
+
const j = "-";
|
|
2652
2695
|
class oi {
|
|
2653
2696
|
constructor(e) {
|
|
2654
2697
|
this.document = e;
|
|
2655
2698
|
}
|
|
2656
2699
|
applyPatch(e, t) {
|
|
2657
|
-
const n = k(e), r =
|
|
2700
|
+
const n = k(e), r = P(t.path), o = He(r), s = Ve(this.document, o, "before", r);
|
|
2658
2701
|
switch (t.op) {
|
|
2659
2702
|
case "ADD":
|
|
2660
2703
|
this.applyAdd(o, r, t.val ?? null);
|
|
@@ -2677,11 +2720,11 @@ class oi {
|
|
|
2677
2720
|
};
|
|
2678
2721
|
}
|
|
2679
2722
|
directWrite(e, t) {
|
|
2680
|
-
const n =
|
|
2723
|
+
const n = P(e);
|
|
2681
2724
|
if (n === "/")
|
|
2682
2725
|
throw new Error("Direct write cannot target root document");
|
|
2683
2726
|
const r = He(n), { parent: o, leaf: s } = this.resolveParent(r);
|
|
2684
|
-
if (s ===
|
|
2727
|
+
if (s === j)
|
|
2685
2728
|
throw new Error(
|
|
2686
2729
|
`Direct write does not support append token '-' for path ${n}`
|
|
2687
2730
|
);
|
|
@@ -2714,7 +2757,7 @@ class oi {
|
|
|
2714
2757
|
);
|
|
2715
2758
|
}
|
|
2716
2759
|
directWriteObject(e, t, n) {
|
|
2717
|
-
const r =
|
|
2760
|
+
const r = X(e);
|
|
2718
2761
|
if (n == null) {
|
|
2719
2762
|
delete r[t], e.setProperties(
|
|
2720
2763
|
Object.keys(r).length > 0 ? r : void 0
|
|
@@ -2734,25 +2777,25 @@ class oi {
|
|
|
2734
2777
|
return { parent: t, leaf: e[e.length - 1] };
|
|
2735
2778
|
}
|
|
2736
2779
|
getOrCreateChild(e, t, n, r) {
|
|
2737
|
-
if (t ===
|
|
2780
|
+
if (t === j)
|
|
2738
2781
|
throw new Error(
|
|
2739
|
-
`Append token '-' must be final segment: ${
|
|
2782
|
+
`Append token '-' must be final segment: ${G(n, r)}`
|
|
2740
2783
|
);
|
|
2741
2784
|
const o = e.getItems();
|
|
2742
2785
|
if (o && U(t)) {
|
|
2743
|
-
const c = B(t,
|
|
2786
|
+
const c = B(t, G(n, r));
|
|
2744
2787
|
if (c < 0 || c >= o.length)
|
|
2745
2788
|
throw new Error(
|
|
2746
|
-
`Array index out of bounds: ${
|
|
2789
|
+
`Array index out of bounds: ${G(n, r)}`
|
|
2747
2790
|
);
|
|
2748
2791
|
const u = o[c];
|
|
2749
2792
|
if (!u)
|
|
2750
2793
|
throw new Error(
|
|
2751
|
-
`Path does not exist: ${
|
|
2794
|
+
`Path does not exist: ${G(n, r)}`
|
|
2752
2795
|
);
|
|
2753
2796
|
return u;
|
|
2754
2797
|
}
|
|
2755
|
-
const s =
|
|
2798
|
+
const s = X(e);
|
|
2756
2799
|
let a = s[t];
|
|
2757
2800
|
return a || (a = new p(), s[t] = a, e.setProperties(s)), a;
|
|
2758
2801
|
}
|
|
@@ -2766,23 +2809,23 @@ class oi {
|
|
|
2766
2809
|
);
|
|
2767
2810
|
try {
|
|
2768
2811
|
if (U(o)) {
|
|
2769
|
-
const u = r.getItems(), h = o ===
|
|
2812
|
+
const u = r.getItems(), h = o === j;
|
|
2770
2813
|
if (!u)
|
|
2771
2814
|
throw new Error(
|
|
2772
2815
|
h ? `Append token '-' requires array at ${s}` : `Array index segment requires array at ${s}`
|
|
2773
2816
|
);
|
|
2774
2817
|
if (h) {
|
|
2775
|
-
ue(r, u).push(
|
|
2818
|
+
ue(r, u).push(q(n));
|
|
2776
2819
|
return;
|
|
2777
2820
|
}
|
|
2778
2821
|
const d = B(o, t);
|
|
2779
2822
|
if (d < 0 || d > u.length)
|
|
2780
2823
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2781
|
-
ue(r, u).splice(d, 0,
|
|
2824
|
+
ue(r, u).splice(d, 0, q(n));
|
|
2782
2825
|
return;
|
|
2783
2826
|
}
|
|
2784
|
-
const c =
|
|
2785
|
-
c[o] =
|
|
2827
|
+
const c = X(r);
|
|
2828
|
+
c[o] = q(n), r.setProperties(c);
|
|
2786
2829
|
} catch (c) {
|
|
2787
2830
|
throw this.rollbackCreated(a), c;
|
|
2788
2831
|
}
|
|
@@ -2803,11 +2846,11 @@ class oi {
|
|
|
2803
2846
|
const u = B(o, t);
|
|
2804
2847
|
if (u < 0 || u >= c.length)
|
|
2805
2848
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2806
|
-
c[u] =
|
|
2849
|
+
c[u] = q(n), r.setItems(c);
|
|
2807
2850
|
return;
|
|
2808
2851
|
}
|
|
2809
|
-
const a =
|
|
2810
|
-
a[o] =
|
|
2852
|
+
const a = X(r);
|
|
2853
|
+
a[o] = q(n), r.setProperties(a);
|
|
2811
2854
|
} catch (a) {
|
|
2812
2855
|
throw this.rollbackCreated(s), a;
|
|
2813
2856
|
}
|
|
@@ -2842,15 +2885,15 @@ class oi {
|
|
|
2842
2885
|
let r = this.document;
|
|
2843
2886
|
const o = [];
|
|
2844
2887
|
for (let a = 0; a < e.length - 1; a += 1) {
|
|
2845
|
-
const c = e[a], u =
|
|
2888
|
+
const c = e[a], u = G(e, a + 1);
|
|
2846
2889
|
if (U(c)) {
|
|
2847
|
-
const
|
|
2848
|
-
if (!
|
|
2890
|
+
const v = r.getItems();
|
|
2891
|
+
if (!v)
|
|
2849
2892
|
throw new Error(`Array index segment requires array at ${u}`);
|
|
2850
|
-
const
|
|
2851
|
-
if (
|
|
2893
|
+
const f = B(c, u);
|
|
2894
|
+
if (f < 0 || f >= v.length)
|
|
2852
2895
|
throw new Error(`Array index out of bounds in path: ${u}`);
|
|
2853
|
-
const E =
|
|
2896
|
+
const E = v[f];
|
|
2854
2897
|
if (!(E instanceof p))
|
|
2855
2898
|
throw new Error(`Array index out of bounds in path: ${u}`);
|
|
2856
2899
|
r = E;
|
|
@@ -2907,7 +2950,7 @@ function ci(i, e, t, n, r) {
|
|
|
2907
2950
|
return null;
|
|
2908
2951
|
const o = i.getItems();
|
|
2909
2952
|
if (o) {
|
|
2910
|
-
if (e ===
|
|
2953
|
+
if (e === j) {
|
|
2911
2954
|
if (!t)
|
|
2912
2955
|
throw new Error(`Append token '-' must be final segment: ${r}`);
|
|
2913
2956
|
return n === "before" || o.length === 0 ? null : o[o.length - 1] ?? null;
|
|
@@ -2935,7 +2978,7 @@ function B(i, e) {
|
|
|
2935
2978
|
throw new Error(`Negative array index in path: ${e}`);
|
|
2936
2979
|
return t;
|
|
2937
2980
|
}
|
|
2938
|
-
function
|
|
2981
|
+
function G(i, e) {
|
|
2939
2982
|
if (e <= 0)
|
|
2940
2983
|
return "/";
|
|
2941
2984
|
const t = Math.min(e, i.length);
|
|
@@ -2948,7 +2991,7 @@ function ue(i, e) {
|
|
|
2948
2991
|
const t = [...e];
|
|
2949
2992
|
return i.setItems(t), t;
|
|
2950
2993
|
}
|
|
2951
|
-
function
|
|
2994
|
+
function X(i) {
|
|
2952
2995
|
const e = i.getProperties();
|
|
2953
2996
|
if (!e) {
|
|
2954
2997
|
const n = {};
|
|
@@ -2958,9 +3001,9 @@ function Q(i) {
|
|
|
2958
3001
|
return i.setProperties(t), t;
|
|
2959
3002
|
}
|
|
2960
3003
|
function U(i) {
|
|
2961
|
-
return i ===
|
|
3004
|
+
return i === j || /^\d+$/.test(i);
|
|
2962
3005
|
}
|
|
2963
|
-
function
|
|
3006
|
+
function q(i) {
|
|
2964
3007
|
return i == null ? new p().setValue(null) : i.clone();
|
|
2965
3008
|
}
|
|
2966
3009
|
class li {
|
|
@@ -3055,7 +3098,7 @@ function Ct(i) {
|
|
|
3055
3098
|
return Math.floor((i + 99) / 100);
|
|
3056
3099
|
}
|
|
3057
3100
|
function hi(i) {
|
|
3058
|
-
const e =
|
|
3101
|
+
const e = P(i);
|
|
3059
3102
|
return e === "/" ? 0 : e.split("/").length - 1;
|
|
3060
3103
|
}
|
|
3061
3104
|
function di(i) {
|
|
@@ -3064,14 +3107,14 @@ function di(i) {
|
|
|
3064
3107
|
function pi(i, e) {
|
|
3065
3108
|
return 8 + hi(i) + Ct(e);
|
|
3066
3109
|
}
|
|
3067
|
-
const
|
|
3068
|
-
function
|
|
3110
|
+
const fi = 1e3, mi = 5, gi = 50, Ei = 2, yi = 10, Ci = 10, Si = 10, vi = 20, wi = 20, ki = 30, bi = 30, Ti = 100;
|
|
3111
|
+
function Ii(i) {
|
|
3069
3112
|
return 50 + 10 * i;
|
|
3070
3113
|
}
|
|
3071
|
-
function
|
|
3114
|
+
function Pi(i) {
|
|
3072
3115
|
return 20 + i;
|
|
3073
3116
|
}
|
|
3074
|
-
function
|
|
3117
|
+
function Ri(i) {
|
|
3075
3118
|
return 10 * i;
|
|
3076
3119
|
}
|
|
3077
3120
|
function Mi(i) {
|
|
@@ -3089,13 +3132,13 @@ class Ni {
|
|
|
3089
3132
|
this.total += e;
|
|
3090
3133
|
}
|
|
3091
3134
|
chargeScopeEntry(e) {
|
|
3092
|
-
this.add(
|
|
3135
|
+
this.add(Ii(this.scopeDepth(e)));
|
|
3093
3136
|
}
|
|
3094
3137
|
chargeInitialization() {
|
|
3095
|
-
this.add(
|
|
3138
|
+
this.add(fi);
|
|
3096
3139
|
}
|
|
3097
3140
|
chargeChannelMatchAttempt() {
|
|
3098
|
-
this.add(
|
|
3141
|
+
this.add(mi);
|
|
3099
3142
|
}
|
|
3100
3143
|
chargeHandlerOverhead() {
|
|
3101
3144
|
this.add(gi);
|
|
@@ -3104,13 +3147,13 @@ class Ni {
|
|
|
3104
3147
|
this.add(Ei);
|
|
3105
3148
|
}
|
|
3106
3149
|
chargePatchAddOrReplace(e) {
|
|
3107
|
-
this.add(
|
|
3150
|
+
this.add(Pi(this.payloadSizeCharge(e)));
|
|
3108
3151
|
}
|
|
3109
3152
|
chargePatchRemove() {
|
|
3110
3153
|
this.add(yi);
|
|
3111
3154
|
}
|
|
3112
3155
|
chargeCascadeRouting(e) {
|
|
3113
|
-
e > 0 && this.add(
|
|
3156
|
+
e > 0 && this.add(Ri(e));
|
|
3114
3157
|
}
|
|
3115
3158
|
chargeEmitEvent(e) {
|
|
3116
3159
|
this.add(Mi(this.payloadSizeCharge(e)));
|
|
@@ -3131,7 +3174,7 @@ class Ni {
|
|
|
3131
3174
|
this.add(ki);
|
|
3132
3175
|
}
|
|
3133
3176
|
chargeFatalTerminationOverhead() {
|
|
3134
|
-
this.add(
|
|
3177
|
+
this.add(Ti);
|
|
3135
3178
|
}
|
|
3136
3179
|
chargeTriggerEventBase() {
|
|
3137
3180
|
this.add(bi);
|
|
@@ -3217,7 +3260,7 @@ class Oi {
|
|
|
3217
3260
|
return this.patchEngine.applyPatch(e, t);
|
|
3218
3261
|
}
|
|
3219
3262
|
}
|
|
3220
|
-
const Ai =
|
|
3263
|
+
const Ai = m["Core/Processing Initialized Marker"], Di = m["Core/Document Update"];
|
|
3221
3264
|
class Bi {
|
|
3222
3265
|
constructor(e, t, n, r) {
|
|
3223
3266
|
this.contractLoader = e, this.registry = t, this.runtimeRef = new Oi(r, n);
|
|
@@ -3244,7 +3287,7 @@ class Bi {
|
|
|
3244
3287
|
const h = `No processor registered for handler contract ${s.blueId()}`;
|
|
3245
3288
|
throw new y(
|
|
3246
3289
|
h,
|
|
3247
|
-
|
|
3290
|
+
S.illegalState(h)
|
|
3248
3291
|
);
|
|
3249
3292
|
}
|
|
3250
3293
|
const u = c.matches;
|
|
@@ -3364,7 +3407,7 @@ class Bi {
|
|
|
3364
3407
|
return k(e);
|
|
3365
3408
|
}
|
|
3366
3409
|
resolvePointer(e, t) {
|
|
3367
|
-
return
|
|
3410
|
+
return I(e, t);
|
|
3368
3411
|
}
|
|
3369
3412
|
async terminate(e, t, n, r) {
|
|
3370
3413
|
const o = k(e);
|
|
@@ -3378,7 +3421,7 @@ class Bi {
|
|
|
3378
3421
|
}
|
|
3379
3422
|
nodeAt(e) {
|
|
3380
3423
|
const t = k(e);
|
|
3381
|
-
return
|
|
3424
|
+
return ne.nodeAt(this.runtimeRef.document(), t, {
|
|
3382
3425
|
calculateBlueId: (n) => this.runtimeRef.blue().calculateBlueIdSync(n)
|
|
3383
3426
|
});
|
|
3384
3427
|
}
|
|
@@ -3402,7 +3445,7 @@ class Bi {
|
|
|
3402
3445
|
return await d.call(o, c, h);
|
|
3403
3446
|
if (!await o.matches(c, h))
|
|
3404
3447
|
return { matches: !1 };
|
|
3405
|
-
const
|
|
3448
|
+
const f = o.channelize, E = f ? f.call(o, c, h) : void 0;
|
|
3406
3449
|
return {
|
|
3407
3450
|
matches: !0,
|
|
3408
3451
|
eventId: s,
|
|
@@ -3415,10 +3458,13 @@ class Bi {
|
|
|
3415
3458
|
const r = `No processor registered for handler contract ${e.blueId()}`;
|
|
3416
3459
|
throw new y(
|
|
3417
3460
|
r,
|
|
3418
|
-
|
|
3461
|
+
S.illegalState(r)
|
|
3419
3462
|
);
|
|
3420
3463
|
}
|
|
3421
|
-
await n.execute(e.contract(), t
|
|
3464
|
+
await n.execute(e.contract(), t, {
|
|
3465
|
+
contractKey: e.key(),
|
|
3466
|
+
contractNode: e.node()
|
|
3467
|
+
});
|
|
3422
3468
|
}
|
|
3423
3469
|
/**
|
|
3424
3470
|
* Converts unexpected handler failures into fatal terminations while allowing
|
|
@@ -3426,7 +3472,7 @@ class Bi {
|
|
|
3426
3472
|
* the outer run logic can react according to spec (§22).
|
|
3427
3473
|
*/
|
|
3428
3474
|
async handleHandlerError(e, t, n) {
|
|
3429
|
-
if (n instanceof
|
|
3475
|
+
if (n instanceof te || n instanceof z)
|
|
3430
3476
|
throw n;
|
|
3431
3477
|
const r = this.fatalReason(n, "Runtime fatal");
|
|
3432
3478
|
await this.enterFatalTermination(e, t, r);
|
|
@@ -3448,11 +3494,11 @@ class Bi {
|
|
|
3448
3494
|
matchesDocumentUpdate(e, t, n) {
|
|
3449
3495
|
if (!t || t.length === 0)
|
|
3450
3496
|
return !1;
|
|
3451
|
-
const r =
|
|
3497
|
+
const r = P(I(e, t)), o = P(n);
|
|
3452
3498
|
return r === "/" || o === r ? !0 : o.startsWith(`${r}/`);
|
|
3453
3499
|
}
|
|
3454
3500
|
}
|
|
3455
|
-
class
|
|
3501
|
+
class ne {
|
|
3456
3502
|
constructor(e, t, n) {
|
|
3457
3503
|
this.contractLoader = e, this.registry = t, this.blue = n;
|
|
3458
3504
|
}
|
|
@@ -3487,7 +3533,7 @@ class te {
|
|
|
3487
3533
|
try {
|
|
3488
3534
|
await n();
|
|
3489
3535
|
} catch (r) {
|
|
3490
|
-
if (r instanceof
|
|
3536
|
+
if (r instanceof te)
|
|
3491
3537
|
return t.result();
|
|
3492
3538
|
if (r instanceof z) {
|
|
3493
3539
|
const o = e.clone();
|
|
@@ -3501,20 +3547,20 @@ class te {
|
|
|
3501
3547
|
return t.result();
|
|
3502
3548
|
}
|
|
3503
3549
|
initializationMarker(e) {
|
|
3504
|
-
const n = e.getProperties()?.[
|
|
3550
|
+
const n = e.getProperties()?.[Te.OBJECT_CONTRACTS]?.getProperties()?.initialized ?? null;
|
|
3505
3551
|
if (!n)
|
|
3506
3552
|
return null;
|
|
3507
3553
|
if (!(n instanceof p))
|
|
3508
3554
|
throw new y(
|
|
3509
3555
|
"Initialization Marker must be a BlueNode",
|
|
3510
|
-
|
|
3556
|
+
S.illegalState(
|
|
3511
3557
|
"Initialization Marker must be a BlueNode"
|
|
3512
3558
|
)
|
|
3513
3559
|
);
|
|
3514
3560
|
if (n.getType()?.getBlueId() !== Ai)
|
|
3515
3561
|
throw new y(
|
|
3516
3562
|
"Initialization Marker must declare type 'Processing Initialized Marker'",
|
|
3517
|
-
|
|
3563
|
+
S.illegalState(
|
|
3518
3564
|
"Initialization Marker must declare type 'Processing Initialized Marker'"
|
|
3519
3565
|
)
|
|
3520
3566
|
);
|
|
@@ -3523,7 +3569,7 @@ class te {
|
|
|
3523
3569
|
static nodeAt(e, t, n) {
|
|
3524
3570
|
if (!(e instanceof p))
|
|
3525
3571
|
return null;
|
|
3526
|
-
const r =
|
|
3572
|
+
const r = P(t);
|
|
3527
3573
|
if (r === "/")
|
|
3528
3574
|
return e;
|
|
3529
3575
|
const o = r.slice(1).split("/");
|
|
@@ -3574,10 +3620,10 @@ class te {
|
|
|
3574
3620
|
return new p().setValue(e.getValue() ?? null);
|
|
3575
3621
|
case "blue":
|
|
3576
3622
|
return e.getBlue() ?? null;
|
|
3577
|
-
case
|
|
3623
|
+
case Te.OBJECT_CONTRACTS:
|
|
3578
3624
|
return new p().setContracts(e.getContracts());
|
|
3579
3625
|
case "blueId": {
|
|
3580
|
-
const r = e.getBlueId() ?? n?.calculateBlueId?.(e) ??
|
|
3626
|
+
const r = e.getBlueId() ?? n?.calculateBlueId?.(e) ?? Pt.calculateBlueIdSync(e);
|
|
3581
3627
|
return new p().setValue(r ?? null);
|
|
3582
3628
|
}
|
|
3583
3629
|
default:
|
|
@@ -3621,7 +3667,7 @@ class xi {
|
|
|
3621
3667
|
this.shouldSkipTerminatedWork() || this.execution.runtime().addGas(e);
|
|
3622
3668
|
}
|
|
3623
3669
|
throwFatal(e) {
|
|
3624
|
-
throw new y(e,
|
|
3670
|
+
throw new y(e, S.runtimeFatal(e));
|
|
3625
3671
|
}
|
|
3626
3672
|
resolvePointer(e) {
|
|
3627
3673
|
return this.execution.resolvePointer(this.scopePathValue, e);
|
|
@@ -3640,7 +3686,7 @@ class xi {
|
|
|
3640
3686
|
if (!e)
|
|
3641
3687
|
return !1;
|
|
3642
3688
|
try {
|
|
3643
|
-
return
|
|
3689
|
+
return ne.nodeAt(
|
|
3644
3690
|
this.execution.runtime().document(),
|
|
3645
3691
|
e,
|
|
3646
3692
|
{
|
|
@@ -3652,7 +3698,7 @@ class xi {
|
|
|
3652
3698
|
}
|
|
3653
3699
|
}
|
|
3654
3700
|
documentNodeAt(e) {
|
|
3655
|
-
const t =
|
|
3701
|
+
const t = ne.nodeAt(
|
|
3656
3702
|
this.execution.runtime().document(),
|
|
3657
3703
|
e,
|
|
3658
3704
|
{
|
|
@@ -3679,7 +3725,7 @@ class xi {
|
|
|
3679
3725
|
return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
|
|
3680
3726
|
}
|
|
3681
3727
|
}
|
|
3682
|
-
const _i = new
|
|
3728
|
+
const _i = new Rt({
|
|
3683
3729
|
repositories: [Mt]
|
|
3684
3730
|
});
|
|
3685
3731
|
class Li {
|
|
@@ -3688,7 +3734,7 @@ class Li {
|
|
|
3688
3734
|
contractLoaderRef;
|
|
3689
3735
|
engine;
|
|
3690
3736
|
constructor(e) {
|
|
3691
|
-
this.registryRef = e?.registry ??
|
|
3737
|
+
this.registryRef = e?.registry ?? se.create().registerDefaults().build(), this.blue = e?.blue ?? _i, this.contractLoaderRef = new Ur(this.registryRef, this.blue), this.engine = new ne(
|
|
3692
3738
|
this.contractLoaderRef,
|
|
3693
3739
|
this.registryRef,
|
|
3694
3740
|
this.blue
|
|
@@ -3728,7 +3774,7 @@ class Fi {
|
|
|
3728
3774
|
contractRegistry;
|
|
3729
3775
|
blueInstance;
|
|
3730
3776
|
constructor() {
|
|
3731
|
-
this.contractRegistry =
|
|
3777
|
+
this.contractRegistry = se.create().registerDefaults().build();
|
|
3732
3778
|
}
|
|
3733
3779
|
withRegistry(e) {
|
|
3734
3780
|
return this.contractRegistry = e, this;
|
|
@@ -3749,7 +3795,7 @@ class Fi {
|
|
|
3749
3795
|
class St {
|
|
3750
3796
|
process(e, t) {
|
|
3751
3797
|
const n = t.getValue();
|
|
3752
|
-
if (
|
|
3798
|
+
if (Z(n)) {
|
|
3753
3799
|
const r = t.clone();
|
|
3754
3800
|
return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
|
|
3755
3801
|
}
|
|
@@ -3760,7 +3806,7 @@ class St {
|
|
|
3760
3806
|
*/
|
|
3761
3807
|
postProcess(e, t) {
|
|
3762
3808
|
const n = t.getValue();
|
|
3763
|
-
if (
|
|
3809
|
+
if (Z(n) && e.getValue() !== n && n !== void 0) {
|
|
3764
3810
|
const r = e.clone();
|
|
3765
3811
|
return r.setValue(n), r;
|
|
3766
3812
|
}
|
|
@@ -3791,7 +3837,7 @@ export {
|
|
|
3791
3837
|
wr as ContractBundleBuilder,
|
|
3792
3838
|
Ur as ContractLoader,
|
|
3793
3839
|
qn as ContractProcessorRegistry,
|
|
3794
|
-
|
|
3840
|
+
se as ContractProcessorRegistryBuilder,
|
|
3795
3841
|
Ke as DocumentProcessingResult,
|
|
3796
3842
|
Oi as DocumentProcessingRuntime,
|
|
3797
3843
|
Li as DocumentProcessor,
|
|
@@ -3807,8 +3853,8 @@ export {
|
|
|
3807
3853
|
je as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
|
|
3808
3854
|
oi as PatchEngine,
|
|
3809
3855
|
no as ProcessorContractConstants,
|
|
3810
|
-
|
|
3811
|
-
|
|
3856
|
+
ne as ProcessorEngine,
|
|
3857
|
+
S as ProcessorErrors,
|
|
3812
3858
|
Bi as ProcessorExecution,
|
|
3813
3859
|
xi as ProcessorExecutionContext,
|
|
3814
3860
|
y as ProcessorFatalError,
|
|
@@ -3820,7 +3866,7 @@ export {
|
|
|
3820
3866
|
de as RELATIVE_INITIALIZED,
|
|
3821
3867
|
Je as RELATIVE_TERMINATED,
|
|
3822
3868
|
Ee as RESERVED_CONTRACT_KEYS,
|
|
3823
|
-
|
|
3869
|
+
te as RunTerminationError,
|
|
3824
3870
|
Yr as ScopeExecutor,
|
|
3825
3871
|
li as ScopeRuntimeContext,
|
|
3826
3872
|
ti as TerminationService,
|
|
@@ -3842,15 +3888,15 @@ export {
|
|
|
3842
3888
|
at as evaluateQuickJSExpression,
|
|
3843
3889
|
an as extractExpressionContent,
|
|
3844
3890
|
ut as handlerContractBaseSchema,
|
|
3845
|
-
|
|
3891
|
+
Tn as initializationMarkerSchema,
|
|
3846
3892
|
Ji as isErr,
|
|
3847
|
-
|
|
3893
|
+
Z as isExpression,
|
|
3848
3894
|
ji as isOk,
|
|
3849
3895
|
ye as isProcessorManagedChannelBlueId,
|
|
3850
3896
|
_t as isReservedContractKey,
|
|
3851
3897
|
io as joinRelativePointers,
|
|
3852
3898
|
oo as jsonPatchSchema,
|
|
3853
|
-
|
|
3899
|
+
mn as lifecycleChannelSchema,
|
|
3854
3900
|
Qi as map,
|
|
3855
3901
|
Xi as mapErr,
|
|
3856
3902
|
N as markerContractBaseSchema,
|
|
@@ -3859,23 +3905,23 @@ export {
|
|
|
3859
3905
|
$n as myosSessionInteractionMarkerSchema,
|
|
3860
3906
|
Sn as myosTimelineChannelSchema,
|
|
3861
3907
|
Vn as myosWorkerAgencyMarkerSchema,
|
|
3862
|
-
|
|
3908
|
+
P as normalizePointer,
|
|
3863
3909
|
k as normalizeScope,
|
|
3864
3910
|
Nt as ok,
|
|
3865
3911
|
Nn as operationMarkerSchema,
|
|
3866
|
-
|
|
3912
|
+
Pn as processEmbeddedMarkerSchema,
|
|
3867
3913
|
Mn as processingTerminatedMarkerSchema,
|
|
3868
3914
|
Ze as relativeCheckpointLastEvent,
|
|
3869
3915
|
et as relativeCheckpointLastSignature,
|
|
3870
|
-
|
|
3916
|
+
re as relativeContractsEntry,
|
|
3871
3917
|
Ft as relativizePointer,
|
|
3872
|
-
|
|
3873
|
-
|
|
3918
|
+
ee as resolveNodeExpressions,
|
|
3919
|
+
I as resolvePointer,
|
|
3874
3920
|
cn as resolveTemplateString,
|
|
3875
3921
|
Wn as sequentialWorkflowOperationSchema,
|
|
3876
3922
|
Hn as sequentialWorkflowSchema,
|
|
3877
3923
|
so as sequentialWorkflowStepSchema,
|
|
3878
|
-
|
|
3924
|
+
Pe as stripSlashes,
|
|
3879
3925
|
yn as timelineChannelSchema,
|
|
3880
3926
|
En as triggeredEventChannelSchema,
|
|
3881
3927
|
Zi as unwrapOr,
|