@blue-labs/document-processor 3.10.0 → 4.0.0-rc.0
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/api/document-processor.d.ts.map +1 -1
- package/dist/constants/processor-contract-constants.d.ts +1 -1
- package/dist/engine/checkpoint-manager.d.ts.map +1 -1
- package/dist/engine/composite-channel-validation.d.ts.map +1 -1
- package/dist/engine/contract-loader.d.ts +1 -0
- package/dist/engine/contract-loader.d.ts.map +1 -1
- package/dist/engine/processor-engine.d.ts.map +1 -1
- package/dist/engine/scope-executor.d.ts.map +1 -1
- package/dist/engine/termination-service.d.ts.map +1 -1
- package/dist/index.js +1529 -1344
- package/dist/model/channels/composite-timeline-channel.d.ts +4 -4
- package/dist/model/channels/document-update-channel.d.ts +4 -4
- package/dist/model/channels/embedded-node-channel.d.ts +4 -4
- package/dist/model/channels/lifecycle-channel.d.ts +4 -4
- package/dist/model/channels/myos-timeline-channel.d.ts +4 -4
- package/dist/model/channels/timeline-channel.d.ts +4 -4
- package/dist/model/channels/triggered-event-channel.d.ts +4 -4
- package/dist/model/handlers/sequential-workflow-operation.d.ts +6 -6
- package/dist/model/handlers/sequential-workflow.d.ts +6 -6
- package/dist/model/markers/actor-policy.d.ts +89 -0
- package/dist/model/markers/actor-policy.d.ts.map +1 -0
- package/dist/model/markers/channel-event-checkpoint.d.ts +2 -2
- package/dist/model/markers/document-anchors.d.ts +2 -2
- package/dist/model/markers/document-links.d.ts +2 -2
- package/dist/model/markers/index.d.ts +1 -0
- package/dist/model/markers/index.d.ts.map +1 -1
- package/dist/model/markers/initialization-marker.d.ts +2 -2
- package/dist/model/markers/myos-participants-orchestration.d.ts +2 -2
- package/dist/model/markers/myos-session-interaction.d.ts +2 -2
- package/dist/model/markers/myos-worker-agency.d.ts +2 -2
- package/dist/model/markers/operation.d.ts +2 -2
- package/dist/model/markers/process-embedded.d.ts +2 -2
- package/dist/model/markers/processing-terminated-marker.d.ts +4 -4
- package/dist/model/shared/channel-contract-base.d.ts +4 -4
- package/dist/model/shared/handler-contract-base.d.ts +4 -4
- package/dist/model/shared/marker-contract-base.d.ts +2 -2
- package/dist/model/types.d.ts +2 -2
- package/dist/model/types.d.ts.map +1 -1
- package/dist/registry/contract-processor-registry-builder.d.ts.map +1 -1
- package/dist/registry/processors/actor-policy-marker-processor.d.ts +74 -0
- package/dist/registry/processors/actor-policy-marker-processor.d.ts.map +1 -0
- package/dist/registry/processors/composite-timeline-channel-processor.d.ts +4 -4
- package/dist/registry/processors/composite-timeline-channel-processor.d.ts.map +1 -1
- package/dist/registry/processors/generic-marker-processor.d.ts +2 -2
- package/dist/registry/processors/generic-marker-processor.d.ts.map +1 -1
- package/dist/registry/processors/myos-timeline-channel-processor.d.ts +4 -4
- package/dist/registry/processors/myos-timeline-channel-processor.d.ts.map +1 -1
- package/dist/registry/processors/operation-marker-processor.d.ts +2 -2
- package/dist/registry/processors/operation-marker-processor.d.ts.map +1 -1
- package/dist/registry/processors/sequential-workflow-operation-processor.d.ts +6 -6
- package/dist/registry/processors/sequential-workflow-operation-processor.d.ts.map +1 -1
- package/dist/registry/processors/sequential-workflow-processor.d.ts +6 -6
- package/dist/registry/processors/sequential-workflow-processor.d.ts.map +1 -1
- package/dist/registry/processors/timeline-channel-processor.d.ts +4 -4
- package/dist/registry/processors/timeline-channel-processor.d.ts.map +1 -1
- package/dist/registry/processors/utils/operation-utils.d.ts.map +1 -1
- package/dist/registry/processors/workflow/actor-policy.d.ts +4 -0
- package/dist/registry/processors/workflow/actor-policy.d.ts.map +1 -0
- package/dist/registry/processors/workflow/operation-matcher.d.ts.map +1 -1
- package/dist/repository/semantic-repository.d.ts +176 -0
- package/dist/repository/semantic-repository.d.ts.map +1 -0
- package/dist/test-support/blue.d.ts +7 -0
- package/dist/test-support/blue.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,165 +1,353 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
function
|
|
10
|
-
return { ok: !0, value:
|
|
1
|
+
import { repository as xt } from "@blue-repository/types";
|
|
2
|
+
import { BlueNode as p, MergingProcessors as L, reindexRepositoryForSemanticStorage as Ft, withTypeBlueId as m, blueNodeField as I, Properties as Ne, Blue as $t } from "@blue-labs/language";
|
|
3
|
+
import Ae from "picomatch";
|
|
4
|
+
import { evaluate as Ut } from "@blue-quickjs/quickjs-runtime";
|
|
5
|
+
import { validateDv as zt, DV_LIMIT_DEFAULTS as Vt } from "@blue-quickjs/dv";
|
|
6
|
+
import { HOST_V1_MANIFEST as Ht, HOST_V1_HASH as Kt } from "@blue-quickjs/abi-manifest";
|
|
7
|
+
import { z as l, ZodError as ve } from "zod";
|
|
8
|
+
import { isNullable as ge } from "@blue-labs/shared-utils";
|
|
9
|
+
function Wt(o) {
|
|
10
|
+
return { ok: !0, value: o };
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return { ok: !1, error:
|
|
12
|
+
function qt(o) {
|
|
13
|
+
return { ok: !1, error: o };
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function Oi(o) {
|
|
16
|
+
return o.ok;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return !
|
|
18
|
+
function Ni(o) {
|
|
19
|
+
return !o.ok;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function Ai(o, e) {
|
|
22
|
+
return o.ok ? Wt(e(o.value)) : o;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function Bi(o, e) {
|
|
25
|
+
return o.ok ? o : qt(e(o.error));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function Di(o, e) {
|
|
28
|
+
return o.ok ? e(o.value) : o;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function _i(o, e) {
|
|
31
|
+
return o.ok ? o.value : e;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
33
|
+
function Li(o, e) {
|
|
34
|
+
return o.ok ? o.value : e(o.error);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
36
|
+
function xi(o, e) {
|
|
37
|
+
return o.ok ? e.ok(o.value) : e.err(o.error);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
capabilityFailure(
|
|
41
|
-
return { kind: "CapabilityFailure", capability:
|
|
39
|
+
const C = {
|
|
40
|
+
capabilityFailure(o, e, t) {
|
|
41
|
+
return { kind: "CapabilityFailure", capability: o, reason: e, details: t };
|
|
42
42
|
},
|
|
43
|
-
boundaryViolation(
|
|
44
|
-
return { kind: "BoundaryViolation", pointer:
|
|
43
|
+
boundaryViolation(o, e) {
|
|
44
|
+
return { kind: "BoundaryViolation", pointer: o, reason: e };
|
|
45
45
|
},
|
|
46
|
-
runtimeFatal(
|
|
47
|
-
return { kind: "RuntimeFatal", reason:
|
|
46
|
+
runtimeFatal(o, e) {
|
|
47
|
+
return { kind: "RuntimeFatal", reason: o, cause: e };
|
|
48
48
|
},
|
|
49
|
-
invalidContract(
|
|
50
|
-
return { kind: "InvalidContract", contractId:
|
|
49
|
+
invalidContract(o, e, t, n) {
|
|
50
|
+
return { kind: "InvalidContract", contractId: o, reason: e, pointer: t, details: n };
|
|
51
51
|
},
|
|
52
|
-
illegalState(
|
|
53
|
-
return { kind: "IllegalState", reason:
|
|
52
|
+
illegalState(o) {
|
|
53
|
+
return { kind: "IllegalState", reason: o };
|
|
54
54
|
},
|
|
55
|
-
unsupported(
|
|
56
|
-
return { kind: "UnsupportedOp", operation:
|
|
55
|
+
unsupported(o, e) {
|
|
56
|
+
return { kind: "UnsupportedOp", operation: o, reason: e };
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
function
|
|
60
|
-
return Object.freeze([...
|
|
59
|
+
function Gt(o) {
|
|
60
|
+
return Object.freeze([...o]);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
of(
|
|
62
|
+
const jt = {
|
|
63
|
+
of(o, e, t) {
|
|
64
64
|
return {
|
|
65
|
-
document:
|
|
66
|
-
triggeredEvents:
|
|
65
|
+
document: o,
|
|
66
|
+
triggeredEvents: Gt(e),
|
|
67
67
|
totalGas: t,
|
|
68
68
|
capabilityFailure: !1,
|
|
69
69
|
failureReason: null
|
|
70
70
|
};
|
|
71
71
|
},
|
|
72
|
-
capabilityFailure(
|
|
72
|
+
capabilityFailure(o, e) {
|
|
73
73
|
return {
|
|
74
|
-
document:
|
|
74
|
+
document: o,
|
|
75
75
|
triggeredEvents: Object.freeze([]),
|
|
76
76
|
totalGas: 0,
|
|
77
77
|
capabilityFailure: !0,
|
|
78
78
|
failureReason: e ?? null
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
}, Ze = jt, Be = 120;
|
|
82
|
+
function Jt(o) {
|
|
83
|
+
return o.length <= Be ? o : `${o.slice(0, Be - 3)}...`;
|
|
84
|
+
}
|
|
85
|
+
class Xe extends Error {
|
|
86
|
+
constructor(e, t) {
|
|
87
|
+
super(`Failed to evaluate code block: ${Jt(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const Qt = 1700, Ee = BigInt(
|
|
91
|
+
Qt
|
|
92
|
+
), Yt = BigInt(Number.MAX_SAFE_INTEGER), Zt = 4e4, Xt = 4e4;
|
|
93
|
+
function en(o) {
|
|
94
|
+
let e;
|
|
95
|
+
if (typeof o == "bigint")
|
|
96
|
+
e = o;
|
|
97
|
+
else {
|
|
98
|
+
if (!Number.isFinite(o) || o <= 0)
|
|
99
|
+
return 0;
|
|
100
|
+
e = BigInt(Math.trunc(o));
|
|
101
|
+
}
|
|
102
|
+
if (e <= 0n)
|
|
103
|
+
return 0;
|
|
104
|
+
const t = (e + Ee - 1n) / Ee;
|
|
105
|
+
return t > Yt ? Number.MAX_SAFE_INTEGER : Number(t);
|
|
106
|
+
}
|
|
107
|
+
function et(o) {
|
|
108
|
+
const e = BigInt(Math.max(0, Math.trunc(o)));
|
|
109
|
+
return e <= 0n ? 0n : e * Ee;
|
|
110
|
+
}
|
|
111
|
+
const tt = et(
|
|
112
|
+
Zt
|
|
113
|
+
), tn = et(
|
|
114
|
+
Xt
|
|
115
|
+
), nt = /^\$\{([\s\S]*)\}$/, nn = /\$\{([\s\S]+?)\}/, rn = /\$\{([\s\S]+?)\}/g;
|
|
116
|
+
function ne(o) {
|
|
117
|
+
if (typeof o != "string" || !nt.test(o))
|
|
118
|
+
return !1;
|
|
119
|
+
const e = o.indexOf("${"), t = o.lastIndexOf("${");
|
|
120
|
+
return e === t;
|
|
121
|
+
}
|
|
122
|
+
function on(o) {
|
|
123
|
+
return typeof o != "string" ? !1 : nt.test(o) ? !0 : nn.test(o);
|
|
124
|
+
}
|
|
125
|
+
function sn(o) {
|
|
126
|
+
if (!ne(o))
|
|
127
|
+
throw new Error(`Invalid expression: ${o}`);
|
|
128
|
+
return o.slice(2, -1);
|
|
129
|
+
}
|
|
130
|
+
async function rt(o, e, t, n, r) {
|
|
131
|
+
const i = `return (${e});`;
|
|
132
|
+
try {
|
|
133
|
+
return await o.evaluate({
|
|
134
|
+
code: i,
|
|
135
|
+
bindings: t,
|
|
136
|
+
wasmGasLimit: n,
|
|
137
|
+
onWasmGasUsed: r
|
|
138
|
+
});
|
|
139
|
+
} catch (s) {
|
|
140
|
+
throw new Xe(e, s);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function an(o, e, t, n, r) {
|
|
144
|
+
let i = "", s = 0;
|
|
145
|
+
for (const a of e.matchAll(rn)) {
|
|
146
|
+
const c = a[0], u = a[1], h = a.index ?? 0;
|
|
147
|
+
i += e.slice(s, h);
|
|
148
|
+
const d = await rt(
|
|
149
|
+
o,
|
|
150
|
+
u,
|
|
151
|
+
t,
|
|
152
|
+
n,
|
|
153
|
+
r
|
|
154
|
+
);
|
|
155
|
+
i += d == null ? "" : String(d), s = h + c.length;
|
|
156
|
+
}
|
|
157
|
+
return i += e.slice(s), i;
|
|
158
|
+
}
|
|
159
|
+
function ot({
|
|
160
|
+
include: o,
|
|
161
|
+
exclude: e = [],
|
|
162
|
+
options: t
|
|
163
|
+
}) {
|
|
164
|
+
const n = { dot: !0, ...t ?? {} }, r = o.map(
|
|
165
|
+
(s) => Ae(s, n)
|
|
166
|
+
), i = e.map(
|
|
167
|
+
(s) => Ae(s, n)
|
|
168
|
+
);
|
|
169
|
+
return (s) => r.some((a) => a(s)) && !i.some((a) => a(s));
|
|
170
|
+
}
|
|
171
|
+
async function re(o) {
|
|
172
|
+
const {
|
|
173
|
+
evaluator: e,
|
|
174
|
+
node: t,
|
|
175
|
+
bindings: n,
|
|
176
|
+
shouldResolve: r,
|
|
177
|
+
shouldDescend: i = () => !0,
|
|
178
|
+
context: s,
|
|
179
|
+
pointer: a = "/"
|
|
180
|
+
} = o, c = tn, u = ({
|
|
181
|
+
used: g
|
|
182
|
+
}) => {
|
|
183
|
+
s.gasMeter().chargeWasmGas(g);
|
|
184
|
+
}, h = t.clone();
|
|
185
|
+
if (!i(a, h))
|
|
186
|
+
return h;
|
|
187
|
+
const d = h.getValue();
|
|
188
|
+
if (d !== void 0) {
|
|
189
|
+
if (typeof d == "string" && r(a)) {
|
|
190
|
+
if (ne(d)) {
|
|
191
|
+
const g = sn(d), y = await rt(
|
|
192
|
+
e,
|
|
193
|
+
g,
|
|
194
|
+
n,
|
|
195
|
+
c,
|
|
196
|
+
u
|
|
197
|
+
);
|
|
198
|
+
return s.blue.jsonValueToNode(y ?? null);
|
|
199
|
+
} else if (on(d)) {
|
|
200
|
+
const g = await an(
|
|
201
|
+
e,
|
|
202
|
+
d,
|
|
203
|
+
n,
|
|
204
|
+
c,
|
|
205
|
+
u
|
|
206
|
+
);
|
|
207
|
+
return new p().setValue(g);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return h;
|
|
211
|
+
}
|
|
212
|
+
const v = h.getItems?.();
|
|
213
|
+
if (Array.isArray(v)) {
|
|
214
|
+
const g = await Promise.all(
|
|
215
|
+
v.map(
|
|
216
|
+
(y, O) => re({
|
|
217
|
+
...o,
|
|
218
|
+
node: y,
|
|
219
|
+
pointer: `${a}/${O}`
|
|
220
|
+
})
|
|
221
|
+
)
|
|
222
|
+
);
|
|
223
|
+
return h.setItems(g), h;
|
|
224
|
+
}
|
|
225
|
+
const f = h.getProperties?.();
|
|
226
|
+
if (f) {
|
|
227
|
+
const g = {};
|
|
228
|
+
for (const [y, O] of Object.entries(f)) {
|
|
229
|
+
const _ = a === "/" ? `/${y}` : `${a}/${y}`;
|
|
230
|
+
g[y] = await re({
|
|
231
|
+
...o,
|
|
232
|
+
node: O,
|
|
233
|
+
pointer: _
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
h.setProperties(g);
|
|
237
|
+
}
|
|
238
|
+
return h;
|
|
239
|
+
}
|
|
240
|
+
class it {
|
|
241
|
+
process(e, t) {
|
|
242
|
+
const n = t.getValue();
|
|
243
|
+
if (ne(n)) {
|
|
244
|
+
const r = t.clone();
|
|
245
|
+
return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
|
|
246
|
+
}
|
|
247
|
+
return e;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Post-process to ensure expressions aren't overridden by subsequent processors
|
|
251
|
+
*/
|
|
252
|
+
postProcess(e, t) {
|
|
253
|
+
const n = t.getValue();
|
|
254
|
+
if (ne(n) && e.getValue() !== n && n !== void 0) {
|
|
255
|
+
const r = e.clone();
|
|
256
|
+
return r.setValue(n), r;
|
|
257
|
+
}
|
|
258
|
+
return e;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function st() {
|
|
262
|
+
return new L.SequentialMergingProcessor([
|
|
263
|
+
new L.ValuePropagator(),
|
|
264
|
+
new it(),
|
|
265
|
+
new L.TypeAssigner(),
|
|
266
|
+
new L.ListProcessor(),
|
|
267
|
+
new L.DictionaryProcessor(),
|
|
268
|
+
new L.MetadataPropagator(),
|
|
269
|
+
new L.BasicTypesVerifier()
|
|
270
|
+
]);
|
|
271
|
+
}
|
|
272
|
+
const at = Ft(
|
|
273
|
+
xt,
|
|
274
|
+
{
|
|
275
|
+
mergingProcessor: st()
|
|
276
|
+
}
|
|
277
|
+
), S = we("core"), b = we("conversation"), q = we("myos");
|
|
278
|
+
function we(o) {
|
|
279
|
+
const e = at.packages[o];
|
|
280
|
+
if (!e)
|
|
281
|
+
throw new Error(
|
|
282
|
+
`Missing reindexed Blue repository package ${o}.`
|
|
283
|
+
);
|
|
284
|
+
return e.aliases;
|
|
285
|
+
}
|
|
286
|
+
const cn = [
|
|
99
287
|
"embedded",
|
|
100
288
|
"initialized",
|
|
101
289
|
"terminated",
|
|
102
290
|
"checkpoint"
|
|
103
|
-
],
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
],
|
|
109
|
-
|
|
110
|
-
),
|
|
111
|
-
function
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
116
|
-
|
|
291
|
+
], ln = [
|
|
292
|
+
S["Core/Document Update Channel"],
|
|
293
|
+
S["Core/Triggered Event Channel"],
|
|
294
|
+
S["Core/Lifecycle Event Channel"],
|
|
295
|
+
S["Core/Embedded Node Channel"]
|
|
296
|
+
], ct = "embedded", lt = "initialized", ut = "terminated", D = "checkpoint", be = new Set(
|
|
297
|
+
cn
|
|
298
|
+
), Ie = new Set(ln);
|
|
299
|
+
function un(o) {
|
|
300
|
+
return o != null && be.has(o);
|
|
301
|
+
}
|
|
302
|
+
function ht(o) {
|
|
303
|
+
return o != null && Ie.has(
|
|
304
|
+
o
|
|
117
305
|
);
|
|
118
306
|
}
|
|
119
|
-
const
|
|
120
|
-
KEY_EMBEDDED:
|
|
121
|
-
KEY_INITIALIZED:
|
|
122
|
-
KEY_TERMINATED:
|
|
123
|
-
KEY_CHECKPOINT:
|
|
124
|
-
RESERVED_CONTRACT_KEYS:
|
|
125
|
-
PROCESSOR_MANAGED_CHANNEL_BLUE_IDS:
|
|
126
|
-
isReservedContractKey:
|
|
127
|
-
isProcessorManagedChannelBlueId:
|
|
128
|
-
},
|
|
129
|
-
function
|
|
130
|
-
return `${
|
|
131
|
-
}
|
|
132
|
-
function
|
|
133
|
-
return `${
|
|
134
|
-
}
|
|
135
|
-
function
|
|
136
|
-
return `${
|
|
137
|
-
}
|
|
138
|
-
const
|
|
139
|
-
RELATIVE_CONTRACTS:
|
|
140
|
-
RELATIVE_INITIALIZED:
|
|
141
|
-
RELATIVE_TERMINATED:
|
|
142
|
-
RELATIVE_EMBEDDED:
|
|
143
|
-
RELATIVE_CHECKPOINT:
|
|
144
|
-
LAST_EVENTS_SUFFIX:
|
|
145
|
-
LAST_SIGNATURES_SUFFIX:
|
|
146
|
-
relativeContractsEntry:
|
|
147
|
-
relativeCheckpointLastEvent:
|
|
148
|
-
relativeCheckpointLastSignature:
|
|
307
|
+
const Fi = {
|
|
308
|
+
KEY_EMBEDDED: ct,
|
|
309
|
+
KEY_INITIALIZED: lt,
|
|
310
|
+
KEY_TERMINATED: ut,
|
|
311
|
+
KEY_CHECKPOINT: D,
|
|
312
|
+
RESERVED_CONTRACT_KEYS: be,
|
|
313
|
+
PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: Ie,
|
|
314
|
+
isReservedContractKey: un,
|
|
315
|
+
isProcessorManagedChannelBlueId: ht
|
|
316
|
+
}, G = "/contracts", ye = `${G}/${lt}`, dt = `${G}/${ut}`, hn = `${G}/${ct}`, pt = `${G}/${D}`, ft = "/lastEvents", mt = "/lastSignatures";
|
|
317
|
+
function ae(o) {
|
|
318
|
+
return `${G}/${o}`;
|
|
319
|
+
}
|
|
320
|
+
function gt(o, e) {
|
|
321
|
+
return `${ae(o)}${ft}/${e}`;
|
|
322
|
+
}
|
|
323
|
+
function Et(o, e) {
|
|
324
|
+
return `${ae(o)}${mt}/${e}`;
|
|
325
|
+
}
|
|
326
|
+
const $i = {
|
|
327
|
+
RELATIVE_CONTRACTS: G,
|
|
328
|
+
RELATIVE_INITIALIZED: ye,
|
|
329
|
+
RELATIVE_TERMINATED: dt,
|
|
330
|
+
RELATIVE_EMBEDDED: hn,
|
|
331
|
+
RELATIVE_CHECKPOINT: pt,
|
|
332
|
+
LAST_EVENTS_SUFFIX: ft,
|
|
333
|
+
LAST_SIGNATURES_SUFFIX: mt,
|
|
334
|
+
relativeContractsEntry: ae,
|
|
335
|
+
relativeCheckpointLastEvent: gt,
|
|
336
|
+
relativeCheckpointLastSignature: Et
|
|
149
337
|
};
|
|
150
|
-
function
|
|
151
|
-
return
|
|
338
|
+
function yt(o) {
|
|
339
|
+
return o == null || o.length === 0;
|
|
152
340
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
341
|
+
function w(o) {
|
|
342
|
+
return yt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
|
|
155
343
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
344
|
+
function R(o) {
|
|
345
|
+
return yt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
|
|
158
346
|
}
|
|
159
|
-
function
|
|
160
|
-
if (
|
|
347
|
+
function De(o) {
|
|
348
|
+
if (o == null)
|
|
161
349
|
return "";
|
|
162
|
-
let e =
|
|
350
|
+
let e = o.trim();
|
|
163
351
|
if (e.length === 0)
|
|
164
352
|
return "";
|
|
165
353
|
for (; e.startsWith("/"); )
|
|
@@ -168,16 +356,16 @@ function Me(i) {
|
|
|
168
356
|
e = e.substring(0, e.length - 1);
|
|
169
357
|
return e;
|
|
170
358
|
}
|
|
171
|
-
function
|
|
172
|
-
const t =
|
|
359
|
+
function Ui(o, e) {
|
|
360
|
+
const t = De(o), n = De(e);
|
|
173
361
|
return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
|
|
174
362
|
}
|
|
175
|
-
function
|
|
176
|
-
const t =
|
|
363
|
+
function k(o, e) {
|
|
364
|
+
const t = w(o), n = R(e);
|
|
177
365
|
return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
|
|
178
366
|
}
|
|
179
|
-
function
|
|
180
|
-
const t =
|
|
367
|
+
function dn(o, e) {
|
|
368
|
+
const t = w(o), n = R(e);
|
|
181
369
|
if (t === "/" || !n.startsWith(t))
|
|
182
370
|
return n;
|
|
183
371
|
if (n.length === t.length)
|
|
@@ -185,66 +373,41 @@ function Ft(i, e) {
|
|
|
185
373
|
const r = n.substring(t.length);
|
|
186
374
|
return r.length === 0 ? "/" : r.startsWith("/") ? r : `/${r}`;
|
|
187
375
|
}
|
|
188
|
-
function
|
|
189
|
-
return
|
|
376
|
+
function pn(o) {
|
|
377
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
190
378
|
}
|
|
191
|
-
var
|
|
192
|
-
function
|
|
193
|
-
return
|
|
379
|
+
var he, _e;
|
|
380
|
+
function fn() {
|
|
381
|
+
return _e || (_e = 1, he = function o(e) {
|
|
194
382
|
if (typeof e == "number" && isNaN(e))
|
|
195
383
|
throw new Error("NaN is not allowed");
|
|
196
384
|
if (typeof e == "number" && !isFinite(e))
|
|
197
385
|
throw new Error("Infinity is not allowed");
|
|
198
|
-
return e === null || typeof e != "object" ? JSON.stringify(e) : e.toJSON instanceof Function ?
|
|
386
|
+
return e === null || typeof e != "object" ? JSON.stringify(e) : e.toJSON instanceof Function ? o(e.toJSON()) : Array.isArray(e) ? `[${e.reduce((r, i, s) => `${r}${s === 0 ? "" : ","}${o(i === void 0 || typeof i == "symbol" ? null : i)}`, "")}]` : `{${Object.keys(e).sort().reduce((n, r) => {
|
|
199
387
|
if (e[r] === void 0 || typeof e[r] == "symbol")
|
|
200
388
|
return n;
|
|
201
|
-
const
|
|
202
|
-
return `${n}${
|
|
389
|
+
const i = n.length === 0 ? "" : ",";
|
|
390
|
+
return `${n}${i}${o(r)}:${o(e[r])}`;
|
|
203
391
|
}, "")}}`;
|
|
204
|
-
}),
|
|
392
|
+
}), he;
|
|
205
393
|
}
|
|
206
|
-
var
|
|
207
|
-
const
|
|
208
|
-
function
|
|
209
|
-
return
|
|
394
|
+
var mn = fn();
|
|
395
|
+
const gn = /* @__PURE__ */ pn(mn);
|
|
396
|
+
function En(o, e) {
|
|
397
|
+
return o.nodeToJson(e, "official");
|
|
210
398
|
}
|
|
211
|
-
function
|
|
212
|
-
const t =
|
|
213
|
-
return
|
|
399
|
+
function yn(o, e) {
|
|
400
|
+
const t = En(o, e);
|
|
401
|
+
return gn(t);
|
|
214
402
|
}
|
|
215
|
-
function
|
|
216
|
-
return e ?
|
|
403
|
+
function Ct(o, e) {
|
|
404
|
+
return e ? yn(o, e) : null;
|
|
217
405
|
}
|
|
218
|
-
function
|
|
219
|
-
const t =
|
|
406
|
+
function Le(o, e) {
|
|
407
|
+
const t = Ct(o, e);
|
|
220
408
|
return t == null ? 0 : new TextEncoder().encode(t).length;
|
|
221
409
|
}
|
|
222
|
-
const
|
|
223
|
-
Wt
|
|
224
|
-
), Gt = BigInt(Number.MAX_SAFE_INTEGER), qt = 4e4, jt = 4e4;
|
|
225
|
-
function Jt(i) {
|
|
226
|
-
let e;
|
|
227
|
-
if (typeof i == "bigint")
|
|
228
|
-
e = i;
|
|
229
|
-
else {
|
|
230
|
-
if (!Number.isFinite(i) || i <= 0)
|
|
231
|
-
return 0;
|
|
232
|
-
e = BigInt(Math.trunc(i));
|
|
233
|
-
}
|
|
234
|
-
if (e <= 0n)
|
|
235
|
-
return 0;
|
|
236
|
-
const t = (e + fe - 1n) / fe;
|
|
237
|
-
return t > Gt ? Number.MAX_SAFE_INTEGER : Number(t);
|
|
238
|
-
}
|
|
239
|
-
function rt(i) {
|
|
240
|
-
const e = BigInt(Math.max(0, Math.trunc(i)));
|
|
241
|
-
return e <= 0n ? 0n : e * fe;
|
|
242
|
-
}
|
|
243
|
-
const it = rt(
|
|
244
|
-
qt
|
|
245
|
-
), Qt = rt(
|
|
246
|
-
jt
|
|
247
|
-
), O = 1, Zt = /* @__PURE__ */ new Set([
|
|
410
|
+
const B = 1, Cn = /* @__PURE__ */ new Set([
|
|
248
411
|
"event",
|
|
249
412
|
"eventCanonical",
|
|
250
413
|
"steps",
|
|
@@ -253,13 +416,13 @@ const it = rt(
|
|
|
253
416
|
"currentContract",
|
|
254
417
|
"currentContractCanonical"
|
|
255
418
|
]);
|
|
256
|
-
class
|
|
419
|
+
class ke {
|
|
257
420
|
// Serialize evaluations to avoid races when updating host handler bindings.
|
|
258
421
|
evaluationQueue = Promise.resolve();
|
|
259
422
|
handlerState = {
|
|
260
|
-
documentGet: () => ({ ok: null, units:
|
|
261
|
-
documentGetCanonical: () => ({ ok: null, units:
|
|
262
|
-
emit: () => ({ ok: null, units:
|
|
423
|
+
documentGet: () => ({ ok: null, units: B }),
|
|
424
|
+
documentGetCanonical: () => ({ ok: null, units: B }),
|
|
425
|
+
emit: () => ({ ok: null, units: B })
|
|
263
426
|
};
|
|
264
427
|
handlers = {
|
|
265
428
|
document: {
|
|
@@ -283,57 +446,57 @@ class ve {
|
|
|
283
446
|
wasmGasLimit: n,
|
|
284
447
|
onWasmGasUsed: r
|
|
285
448
|
}) {
|
|
286
|
-
const
|
|
449
|
+
const i = this.prepareBindings(t), s = n ?? tt, a = {
|
|
287
450
|
code: this.wrapCode(e),
|
|
288
451
|
abiId: "Host.v1",
|
|
289
452
|
abiVersion: 1,
|
|
290
|
-
abiManifestHash:
|
|
453
|
+
abiManifestHash: Kt
|
|
291
454
|
};
|
|
292
455
|
try {
|
|
293
|
-
const c = await
|
|
456
|
+
const c = await Ut({
|
|
294
457
|
program: a,
|
|
295
|
-
input:
|
|
458
|
+
input: i,
|
|
296
459
|
gasLimit: s,
|
|
297
|
-
manifest:
|
|
460
|
+
manifest: Ht,
|
|
298
461
|
handlers: this.handlers
|
|
299
462
|
});
|
|
300
463
|
if (n !== void 0 && r && r({
|
|
301
464
|
used: c.gasUsed,
|
|
302
465
|
remaining: c.gasRemaining
|
|
303
466
|
}), !c.ok)
|
|
304
|
-
throw
|
|
305
|
-
return
|
|
467
|
+
throw wn(c);
|
|
468
|
+
return oe(c.value);
|
|
306
469
|
} catch (c) {
|
|
307
|
-
throw
|
|
470
|
+
throw bn(c);
|
|
308
471
|
}
|
|
309
472
|
}
|
|
310
473
|
prepareBindings(e) {
|
|
311
474
|
const t = e ?? {};
|
|
312
|
-
|
|
313
|
-
const n =
|
|
475
|
+
Sn(t);
|
|
476
|
+
const n = j(t.event, null, "event"), r = j(
|
|
314
477
|
t.eventCanonical ?? n,
|
|
315
478
|
n,
|
|
316
479
|
"eventCanonical"
|
|
317
|
-
),
|
|
480
|
+
), i = j(t.steps, [], "steps"), s = j(
|
|
318
481
|
t.currentContract,
|
|
319
482
|
null,
|
|
320
483
|
"currentContract"
|
|
321
|
-
), a =
|
|
484
|
+
), a = j(
|
|
322
485
|
t.currentContractCanonical,
|
|
323
486
|
s,
|
|
324
487
|
"currentContractCanonical"
|
|
325
488
|
), c = {
|
|
326
489
|
event: n,
|
|
327
490
|
eventCanonical: r,
|
|
328
|
-
steps:
|
|
491
|
+
steps: i,
|
|
329
492
|
currentContract: s,
|
|
330
493
|
currentContractCanonical: a
|
|
331
494
|
}, u = this.extractDocumentBinding(t), h = typeof u?.canonical == "function" ? u.canonical : void 0;
|
|
332
|
-
this.handlerState.documentGet =
|
|
495
|
+
this.handlerState.documentGet = xe(u), this.handlerState.documentGetCanonical = xe(
|
|
333
496
|
h ?? u
|
|
334
497
|
);
|
|
335
498
|
const d = this.extractEmitBinding(t);
|
|
336
|
-
return this.handlerState.emit =
|
|
499
|
+
return this.handlerState.emit = vn(d), c;
|
|
337
500
|
}
|
|
338
501
|
extractDocumentBinding(e) {
|
|
339
502
|
if (!Object.prototype.hasOwnProperty.call(e, "document"))
|
|
@@ -363,282 +526,163 @@ ${e}
|
|
|
363
526
|
})()`;
|
|
364
527
|
}
|
|
365
528
|
}
|
|
366
|
-
function
|
|
367
|
-
for (const e of Object.keys(
|
|
368
|
-
if (!
|
|
529
|
+
function Sn(o) {
|
|
530
|
+
for (const e of Object.keys(o))
|
|
531
|
+
if (!Cn.has(e))
|
|
369
532
|
throw new TypeError(`Unsupported QuickJS binding: "${e}"`);
|
|
370
533
|
}
|
|
371
|
-
function
|
|
372
|
-
const n =
|
|
534
|
+
function j(o, e, t) {
|
|
535
|
+
const n = o === void 0 ? e : o;
|
|
373
536
|
try {
|
|
374
|
-
|
|
537
|
+
zt(n, { limits: Vt });
|
|
375
538
|
} catch (r) {
|
|
376
|
-
const
|
|
539
|
+
const i = r instanceof Error ? r.message : String(r);
|
|
377
540
|
throw new TypeError(
|
|
378
|
-
`QuickJS ${t} binding must be valid DV: ${
|
|
541
|
+
`QuickJS ${t} binding must be valid DV: ${i}`
|
|
379
542
|
);
|
|
380
543
|
}
|
|
381
544
|
return n;
|
|
382
545
|
}
|
|
383
|
-
function
|
|
384
|
-
return
|
|
546
|
+
function xe(o) {
|
|
547
|
+
return o ? (e) => {
|
|
385
548
|
try {
|
|
386
|
-
const t =
|
|
549
|
+
const t = o(e);
|
|
387
550
|
return {
|
|
388
551
|
ok: t === void 0 ? null : t,
|
|
389
|
-
units:
|
|
552
|
+
units: B
|
|
390
553
|
};
|
|
391
554
|
} catch {
|
|
392
555
|
return {
|
|
393
556
|
err: { code: "INVALID_PATH", tag: "host/invalid_path" },
|
|
394
|
-
units:
|
|
557
|
+
units: B
|
|
395
558
|
};
|
|
396
559
|
}
|
|
397
|
-
} : () => ({ ok: null, units:
|
|
560
|
+
} : () => ({ ok: null, units: B });
|
|
398
561
|
}
|
|
399
|
-
function
|
|
400
|
-
return
|
|
562
|
+
function vn(o) {
|
|
563
|
+
return o ? (e) => {
|
|
401
564
|
try {
|
|
402
|
-
if (
|
|
565
|
+
if (o(oe(e)) instanceof Promise)
|
|
403
566
|
throw new Error("Async emit handlers are not supported");
|
|
404
|
-
return { ok: null, units:
|
|
567
|
+
return { ok: null, units: B };
|
|
405
568
|
} catch {
|
|
406
569
|
return {
|
|
407
570
|
err: { code: "LIMIT_EXCEEDED", tag: "host/limit" },
|
|
408
|
-
units:
|
|
571
|
+
units: B
|
|
409
572
|
};
|
|
410
573
|
}
|
|
411
|
-
} : () => ({ ok: null, units:
|
|
574
|
+
} : () => ({ ok: null, units: B });
|
|
412
575
|
}
|
|
413
|
-
function
|
|
414
|
-
if (
|
|
415
|
-
return
|
|
416
|
-
if (Array.isArray(
|
|
417
|
-
return
|
|
418
|
-
if (typeof
|
|
419
|
-
const e = Object.getPrototypeOf(
|
|
576
|
+
function oe(o) {
|
|
577
|
+
if (o == null)
|
|
578
|
+
return o;
|
|
579
|
+
if (Array.isArray(o))
|
|
580
|
+
return o.map((e) => oe(e));
|
|
581
|
+
if (typeof o == "object") {
|
|
582
|
+
const e = Object.getPrototypeOf(o);
|
|
420
583
|
if (e !== Object.prototype && e !== null)
|
|
421
|
-
return
|
|
584
|
+
return o;
|
|
422
585
|
const t = {};
|
|
423
|
-
for (const [n, r] of Object.entries(
|
|
424
|
-
t[n] =
|
|
586
|
+
for (const [n, r] of Object.entries(o))
|
|
587
|
+
t[n] = oe(r);
|
|
425
588
|
return t;
|
|
426
589
|
}
|
|
427
|
-
return
|
|
590
|
+
return o;
|
|
428
591
|
}
|
|
429
|
-
function
|
|
430
|
-
if (
|
|
592
|
+
function wn(o) {
|
|
593
|
+
if (o.ok)
|
|
431
594
|
return new Error("Unexpected evaluation result");
|
|
432
|
-
if (
|
|
433
|
-
const r = new Error(
|
|
595
|
+
if (o.type === "invalid-output") {
|
|
596
|
+
const r = new Error(o.message);
|
|
434
597
|
return r.name = "InvalidOutputError", r;
|
|
435
598
|
}
|
|
436
|
-
const e =
|
|
599
|
+
const e = o.error;
|
|
437
600
|
if (e.kind === "out-of-gas") {
|
|
438
601
|
const r = new Error(
|
|
439
602
|
`OutOfGas: ${e.message || "out of gas"}`
|
|
440
603
|
);
|
|
441
604
|
return r.name = "OutOfGasError", r;
|
|
442
605
|
}
|
|
443
|
-
const t = e.message ||
|
|
606
|
+
const t = e.message || o.message, n = new Error(t);
|
|
444
607
|
return e.kind === "js-exception" ? (n.name = e.name || "Error", n) : e.kind === "host-error" ? (n.name = "HostError", n) : e.kind === "manifest-error" ? (n.name = "ManifestError", n) : (e.kind === "unknown" && e.name && (n.name = e.name), n);
|
|
445
608
|
}
|
|
446
|
-
function
|
|
447
|
-
return
|
|
448
|
-
}
|
|
449
|
-
const Ae = 120;
|
|
450
|
-
function nn(i) {
|
|
451
|
-
return i.length <= Ae ? i : `${i.slice(0, Ae - 3)}...`;
|
|
452
|
-
}
|
|
453
|
-
class ot extends Error {
|
|
454
|
-
constructor(e, t) {
|
|
455
|
-
super(`Failed to evaluate code block: ${nn(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
const st = /^\$\{([\s\S]*)\}$/, rn = /\$\{([\s\S]+?)\}/, on = /\$\{([\s\S]+?)\}/g;
|
|
459
|
-
function ee(i) {
|
|
460
|
-
if (typeof i != "string" || !st.test(i))
|
|
461
|
-
return !1;
|
|
462
|
-
const e = i.indexOf("${"), t = i.lastIndexOf("${");
|
|
463
|
-
return e === t;
|
|
464
|
-
}
|
|
465
|
-
function sn(i) {
|
|
466
|
-
return typeof i != "string" ? !1 : st.test(i) ? !0 : rn.test(i);
|
|
467
|
-
}
|
|
468
|
-
function an(i) {
|
|
469
|
-
if (!ee(i))
|
|
470
|
-
throw new Error(`Invalid expression: ${i}`);
|
|
471
|
-
return i.slice(2, -1);
|
|
472
|
-
}
|
|
473
|
-
async function at(i, e, t, n, r) {
|
|
474
|
-
const o = `return (${e});`;
|
|
475
|
-
try {
|
|
476
|
-
return await i.evaluate({
|
|
477
|
-
code: o,
|
|
478
|
-
bindings: t,
|
|
479
|
-
wasmGasLimit: n,
|
|
480
|
-
onWasmGasUsed: r
|
|
481
|
-
});
|
|
482
|
-
} catch (s) {
|
|
483
|
-
throw new ot(e, s);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
async function cn(i, e, t, n, r) {
|
|
487
|
-
let o = "", s = 0;
|
|
488
|
-
for (const a of e.matchAll(on)) {
|
|
489
|
-
const c = a[0], u = a[1], h = a.index ?? 0;
|
|
490
|
-
o += e.slice(s, h);
|
|
491
|
-
const d = await at(
|
|
492
|
-
i,
|
|
493
|
-
u,
|
|
494
|
-
t,
|
|
495
|
-
n,
|
|
496
|
-
r
|
|
497
|
-
);
|
|
498
|
-
o += d == null ? "" : String(d), s = h + c.length;
|
|
499
|
-
}
|
|
500
|
-
return o += e.slice(s), o;
|
|
501
|
-
}
|
|
502
|
-
function ct({
|
|
503
|
-
include: i,
|
|
504
|
-
exclude: e = [],
|
|
505
|
-
options: t
|
|
506
|
-
}) {
|
|
507
|
-
const n = { dot: !0, ...t ?? {} }, r = i.map(
|
|
508
|
-
(s) => Pe(s, n)
|
|
509
|
-
), o = e.map(
|
|
510
|
-
(s) => Pe(s, n)
|
|
511
|
-
);
|
|
512
|
-
return (s) => r.some((a) => a(s)) && !o.some((a) => a(s));
|
|
513
|
-
}
|
|
514
|
-
async function te(i) {
|
|
515
|
-
const {
|
|
516
|
-
evaluator: e,
|
|
517
|
-
node: t,
|
|
518
|
-
bindings: n,
|
|
519
|
-
shouldResolve: r,
|
|
520
|
-
shouldDescend: o = () => !0,
|
|
521
|
-
context: s,
|
|
522
|
-
pointer: a = "/"
|
|
523
|
-
} = i, c = Qt, u = ({
|
|
524
|
-
used: E
|
|
525
|
-
}) => {
|
|
526
|
-
s.gasMeter().chargeWasmGas(E);
|
|
527
|
-
}, h = t.clone();
|
|
528
|
-
if (!o(a, h))
|
|
529
|
-
return h;
|
|
530
|
-
const d = h.getValue();
|
|
531
|
-
if (d !== void 0) {
|
|
532
|
-
if (typeof d == "string" && r(a)) {
|
|
533
|
-
if (ee(d)) {
|
|
534
|
-
const E = an(d), C = await at(
|
|
535
|
-
e,
|
|
536
|
-
E,
|
|
537
|
-
n,
|
|
538
|
-
c,
|
|
539
|
-
u
|
|
540
|
-
);
|
|
541
|
-
return s.blue.jsonValueToNode(C ?? null);
|
|
542
|
-
} else if (sn(d)) {
|
|
543
|
-
const E = await cn(
|
|
544
|
-
e,
|
|
545
|
-
d,
|
|
546
|
-
n,
|
|
547
|
-
c,
|
|
548
|
-
u
|
|
549
|
-
);
|
|
550
|
-
return new p().setValue(E);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
return h;
|
|
554
|
-
}
|
|
555
|
-
const S = h.getItems?.();
|
|
556
|
-
if (Array.isArray(S)) {
|
|
557
|
-
const E = await Promise.all(
|
|
558
|
-
S.map(
|
|
559
|
-
(C, M) => te({
|
|
560
|
-
...i,
|
|
561
|
-
node: C,
|
|
562
|
-
pointer: `${a}/${M}`
|
|
563
|
-
})
|
|
564
|
-
)
|
|
565
|
-
);
|
|
566
|
-
return h.setItems(E), h;
|
|
567
|
-
}
|
|
568
|
-
const f = h.getProperties?.();
|
|
569
|
-
if (f) {
|
|
570
|
-
const E = {};
|
|
571
|
-
for (const [C, M] of Object.entries(f)) {
|
|
572
|
-
const D = a === "/" ? `/${C}` : `${a}/${C}`;
|
|
573
|
-
E[C] = await te({
|
|
574
|
-
...i,
|
|
575
|
-
node: M,
|
|
576
|
-
pointer: D
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
h.setProperties(E);
|
|
580
|
-
}
|
|
581
|
-
return h;
|
|
609
|
+
function bn(o) {
|
|
610
|
+
return o instanceof Error ? o : new Error(String(o ?? "Unknown error"));
|
|
582
611
|
}
|
|
583
|
-
const
|
|
612
|
+
const P = {
|
|
613
|
+
"Core/Channel": "DcoJyCh7XXxy1nR5xjy7qfkUgQ1GiZnKKSxh8DJusBSr",
|
|
614
|
+
"Core/Channel Event Checkpoint": "B7YQeYdQzUNuzaDQ4tNTd2iJqgd4YnVQkgz4QgymDWWU",
|
|
615
|
+
"Core/Contract": "AERp8BWnuUsjoPciAeNXuUWS9fmqPNMdWbxmKn3tcitx",
|
|
616
|
+
"Core/Document Update Channel": "6H1iGrDAcqtFE1qv3iyMTj79jCZsMUMxsNUzqYSJNbyR",
|
|
617
|
+
"Core/Embedded Node Channel": "Fjbu3QpnUaTruDTcTidETCX2N5STyv7KYxT42PCzGHxm",
|
|
618
|
+
"Core/Handler": "9ZE5pGjtSGJgWJG7iAVz4iPEz5CatceX3yb3qp5MpAKJ",
|
|
619
|
+
"Core/Json Patch Entry": "Bz49DbfqKC1yJeCfv5RYPZUKTfb7rtZnmreCaz4RsXn5",
|
|
620
|
+
"Core/Lifecycle Event Channel": "H2aCCTUcLMTJozWkn7HPUjyFBFxamraw1q8DyWk87zxr",
|
|
621
|
+
"Core/Marker": "7QACj919YMRvFCTELCf6jfQTp41RVhtHdE6bPazLUZQ6",
|
|
622
|
+
"Core/Process Embedded": "Hu4XkfvyXLSdfFNUwuXebEu3oJeWcMyhBTcRV9AQyKPC",
|
|
623
|
+
"Core/Processing Initialized Marker": "EVguxFmq5iFtMZaBQgHfjWDojaoesQ1vEXCQFZ59yL28",
|
|
624
|
+
"Core/Processing Terminated Marker": "5NiEhupJ6uF54Q3vs4GwQX4UX4ExtwHpKRVvjKEHtvjR",
|
|
625
|
+
"Core/Triggered Event Channel": "C77W4kVGcxL7Mkx9WL9QESPEFFL2GzWAe647s1Efprt"
|
|
626
|
+
}, ce = m(P["Core/Contract"])(l.object({
|
|
584
627
|
description: l.string().optional(),
|
|
585
628
|
name: l.string().optional(),
|
|
586
629
|
order: l.number().optional()
|
|
587
|
-
})),
|
|
630
|
+
})), Te = ce, $ = m(P["Core/Channel"])(ce.extend({
|
|
588
631
|
description: l.string().optional(),
|
|
589
|
-
event:
|
|
632
|
+
event: I().optional(),
|
|
590
633
|
name: l.string().optional()
|
|
591
|
-
})),
|
|
592
|
-
|
|
634
|
+
})), U = $.merge(
|
|
635
|
+
Te
|
|
593
636
|
).extend({
|
|
594
637
|
path: l.string().optional(),
|
|
595
|
-
definition:
|
|
596
|
-
}),
|
|
638
|
+
definition: I().optional()
|
|
639
|
+
}), St = m(P["Core/Handler"])(ce.extend({
|
|
597
640
|
channel: l.string().optional(),
|
|
598
641
|
description: l.string().optional(),
|
|
599
|
-
event:
|
|
642
|
+
event: I().optional(),
|
|
600
643
|
name: l.string().optional()
|
|
601
|
-
})),
|
|
644
|
+
})), vt = St.merge(Te), z = m(P["Core/Marker"])(ce.extend({
|
|
602
645
|
description: l.string().optional(),
|
|
603
646
|
name: l.string().optional()
|
|
604
|
-
})),
|
|
647
|
+
})), M = z.merge(Te), In = l.object({
|
|
605
648
|
op: l.enum(["ADD", "REPLACE", "REMOVE"]),
|
|
606
649
|
path: l.string(),
|
|
607
|
-
val:
|
|
608
|
-
}),
|
|
609
|
-
|
|
610
|
-
).superRefine((
|
|
611
|
-
|
|
650
|
+
val: I().optional()
|
|
651
|
+
}), zi = m("JsonPatch")(
|
|
652
|
+
In
|
|
653
|
+
).superRefine((o, e) => {
|
|
654
|
+
o.op === "REMOVE" && o.val !== void 0 && e.addIssue({
|
|
612
655
|
code: l.ZodIssueCode.custom,
|
|
613
656
|
message: "REMOVE operations cannot include a value",
|
|
614
657
|
path: ["val"]
|
|
615
|
-
}),
|
|
658
|
+
}), o.op !== "REMOVE" && o.val === void 0 && e.addIssue({
|
|
616
659
|
code: l.ZodIssueCode.custom,
|
|
617
|
-
message: `${
|
|
660
|
+
message: `${o.op} operations must include a value`,
|
|
618
661
|
path: ["val"]
|
|
619
662
|
});
|
|
620
|
-
}),
|
|
663
|
+
}), kn = m(P["Core/Document Update Channel"])($.extend({
|
|
621
664
|
description: l.string().optional(),
|
|
622
665
|
name: l.string().optional(),
|
|
623
666
|
path: l.string().optional()
|
|
624
|
-
})),
|
|
625
|
-
|
|
626
|
-
),
|
|
667
|
+
})), Tn = kn.merge(
|
|
668
|
+
U
|
|
669
|
+
), Pn = m(P["Core/Embedded Node Channel"])($.extend({
|
|
627
670
|
childPath: l.string().optional(),
|
|
628
671
|
description: l.string().optional(),
|
|
629
672
|
name: l.string().optional()
|
|
630
|
-
})),
|
|
631
|
-
|
|
632
|
-
),
|
|
673
|
+
})), Rn = Pn.merge(
|
|
674
|
+
U
|
|
675
|
+
), Mn = m(P["Core/Lifecycle Event Channel"])($.extend({
|
|
633
676
|
description: l.string().optional(),
|
|
634
677
|
name: l.string().optional()
|
|
635
|
-
})),
|
|
636
|
-
|
|
637
|
-
),
|
|
678
|
+
})), On = Mn.merge(
|
|
679
|
+
U
|
|
680
|
+
), Nn = m(P["Core/Triggered Event Channel"])($.extend({
|
|
638
681
|
description: l.string().optional(),
|
|
639
682
|
name: l.string().optional()
|
|
640
|
-
})),
|
|
683
|
+
})), An = Nn.merge(U), T = {
|
|
641
684
|
"Conversation/Actor": "CN5efWVizJbRsMCw8YWRfT2q9vM9XfeGDN9wFvYcvMnQ",
|
|
685
|
+
"Conversation/Actor Policy": "EeWqP1Tw9WXo5nq8kx93FuTw9HRqpv34mbWFjH72nR7o",
|
|
642
686
|
"Conversation/Composite Timeline Channel": "HsNatiPt2YvmkWQoqtfrFCbdp75ZUBLBUkWeq84WTfnr",
|
|
643
687
|
"Conversation/JavaScript Code": "ExZxT61PSpWHpEAtP2WKMXXqxEYN7Z13j7Zv36Dp99kS",
|
|
644
688
|
"Conversation/Operation": "BoAiqVUZv9Fum3wFqaX2JnQMBHJLxJSo2V9U2UBmCfsC",
|
|
@@ -651,13 +695,13 @@ const oe = g(m["Core/Contract"])(l.object({
|
|
|
651
695
|
"Conversation/Timeline Entry": "29tcU8MkrV3KL5HqH6DHJDPPfJMheoqwiKJsaHnrp9hT",
|
|
652
696
|
"Conversation/Trigger Event": "2bSWEoMSZwzf32Hnr4BDVsuq8NRjrWEpnhZvMZAJGhh2",
|
|
653
697
|
"Conversation/Update Document": "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa"
|
|
654
|
-
},
|
|
698
|
+
}, wt = m(T["Conversation/Timeline Channel"])($.extend({
|
|
655
699
|
description: l.string().optional(),
|
|
656
700
|
name: l.string().optional(),
|
|
657
701
|
timelineId: l.string().optional()
|
|
658
|
-
})),
|
|
659
|
-
|
|
660
|
-
),
|
|
702
|
+
})), Bn = wt.merge(
|
|
703
|
+
U
|
|
704
|
+
), A = {
|
|
661
705
|
"MyOS/Document Anchor": "HS9yo34TGEAM2LGcNbLh7XPN4goPRhqdGZQkiyh473Wb",
|
|
662
706
|
"MyOS/Document Anchors": "7Usvk6dZMVqas3yqs23ZEXn1zu1YDPjgYiZFNYaw3puH",
|
|
663
707
|
"MyOS/Document Links": "4cmrbevB6K23ZenjqwmNxpnaw6RF4VB3wkP7XB59V7W5",
|
|
@@ -668,104 +712,169 @@ const oe = g(m["Core/Contract"])(l.object({
|
|
|
668
712
|
"MyOS/MyOS Timeline Channel": "HCF8mXnX3dFjQ8osjxb4Wzm2Nm1DoXnTYuA5sPnV7NTs",
|
|
669
713
|
"MyOS/MyOS Timeline Entry": "F3mQaGQ1B48yMedKZojFTxeKxtee4xU66QBbiyEMvGeZ",
|
|
670
714
|
"MyOS/MyOS Worker Agency": "4Lix4AKXvBDvrwxw2htSdYFKxL4wugEQzqoSEYet5Dh1"
|
|
671
|
-
},
|
|
715
|
+
}, Dn = m(A["MyOS/MyOS Timeline Channel"])(wt.extend({
|
|
672
716
|
accountId: l.string().optional(),
|
|
673
717
|
description: l.string().optional(),
|
|
674
718
|
email: l.string().optional(),
|
|
675
719
|
name: l.string().optional()
|
|
676
|
-
})),
|
|
720
|
+
})), _n = Dn.merge(U), Ln = m(T["Conversation/Composite Timeline Channel"])($.extend({
|
|
677
721
|
channels: l.array(l.string()).optional(),
|
|
678
722
|
description: l.string().optional(),
|
|
679
723
|
name: l.string().optional()
|
|
680
|
-
})),
|
|
724
|
+
})), bt = Ln.merge(U), xn = m(T["Conversation/Actor Policy"])(z.extend({
|
|
681
725
|
description: l.string().optional(),
|
|
682
|
-
|
|
726
|
+
name: l.string().optional(),
|
|
727
|
+
operations: l.record(l.string(), l.object({
|
|
728
|
+
excludeSource: l.string().optional(),
|
|
729
|
+
requiresActor: l.string().optional(),
|
|
730
|
+
requiresSource: l.string().optional()
|
|
731
|
+
})).optional()
|
|
732
|
+
})), It = ["principal", "agent", "any"], kt = [
|
|
733
|
+
"browserSession",
|
|
734
|
+
"apiCall",
|
|
735
|
+
"documentRequest"
|
|
736
|
+
], Fn = l.enum(It), Fe = l.enum(kt), $n = l.object({
|
|
737
|
+
excludeSource: Fe.optional(),
|
|
738
|
+
requiresActor: Fn.optional(),
|
|
739
|
+
requiresSource: Fe.optional()
|
|
740
|
+
}), Tt = xn.merge(
|
|
741
|
+
M
|
|
742
|
+
).extend({
|
|
743
|
+
operations: l.record(l.string(), $n).optional()
|
|
744
|
+
}), Un = new Set(It), $e = new Set(kt);
|
|
745
|
+
class Pt extends Error {
|
|
746
|
+
constructor(e) {
|
|
747
|
+
super(e), this.name = "ActorPolicyLiteralValidationError";
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function zn(o) {
|
|
751
|
+
const e = o.getProperties()?.operations;
|
|
752
|
+
if (!(e instanceof p))
|
|
753
|
+
return;
|
|
754
|
+
const t = e.getProperties();
|
|
755
|
+
if (t)
|
|
756
|
+
for (const [n, r] of Object.entries(t)) {
|
|
757
|
+
if (!(r instanceof p))
|
|
758
|
+
continue;
|
|
759
|
+
const i = r.getProperties();
|
|
760
|
+
i && (de(
|
|
761
|
+
n,
|
|
762
|
+
"requiresActor",
|
|
763
|
+
i.requiresActor,
|
|
764
|
+
Un
|
|
765
|
+
), de(
|
|
766
|
+
n,
|
|
767
|
+
"requiresSource",
|
|
768
|
+
i.requiresSource,
|
|
769
|
+
$e
|
|
770
|
+
), de(
|
|
771
|
+
n,
|
|
772
|
+
"excludeSource",
|
|
773
|
+
i.excludeSource,
|
|
774
|
+
$e
|
|
775
|
+
));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
function de(o, e, t, n) {
|
|
779
|
+
if (!(t instanceof p))
|
|
780
|
+
return;
|
|
781
|
+
const r = t.getValue();
|
|
782
|
+
if (r != null && (typeof r != "string" || !n.has(r)))
|
|
783
|
+
throw new Pt(
|
|
784
|
+
`Actor Policy operation '${o}' declares unsupported ${e} '${String(
|
|
785
|
+
r
|
|
786
|
+
)}'`
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
const Vn = m(P["Core/Channel Event Checkpoint"])(z.extend({
|
|
790
|
+
description: l.string().optional(),
|
|
791
|
+
lastEvents: l.record(l.string(), I()).optional(),
|
|
683
792
|
name: l.string().optional()
|
|
684
|
-
})),
|
|
793
|
+
})), Hn = Vn.merge(M).extend({
|
|
685
794
|
lastSignatures: l.record(l.string()).optional()
|
|
686
|
-
}),
|
|
795
|
+
}), Kn = m(P["Core/Processing Initialized Marker"])(z.extend({
|
|
687
796
|
description: l.string().optional(),
|
|
688
797
|
documentId: l.string().optional(),
|
|
689
798
|
name: l.string().optional()
|
|
690
|
-
})),
|
|
799
|
+
})), Wn = Kn.merge(M), qn = m(P["Core/Process Embedded"])(z.extend({
|
|
691
800
|
description: l.string().optional(),
|
|
692
801
|
name: l.string().optional(),
|
|
693
802
|
paths: l.array(l.string()).optional()
|
|
694
|
-
})),
|
|
695
|
-
|
|
696
|
-
),
|
|
803
|
+
})), Gn = qn.merge(
|
|
804
|
+
M
|
|
805
|
+
), jn = m(P["Core/Processing Terminated Marker"])(z.extend({
|
|
697
806
|
cause: l.string().optional(),
|
|
698
807
|
description: l.string().optional(),
|
|
699
808
|
name: l.string().optional(),
|
|
700
809
|
reason: l.string().optional()
|
|
701
|
-
})),
|
|
810
|
+
})), Jn = jn.merge(M), Z = m(T["Conversation/Operation"])(z.extend({
|
|
702
811
|
channel: l.string().optional(),
|
|
703
812
|
description: l.string().optional(),
|
|
704
813
|
name: l.string().optional(),
|
|
705
|
-
request:
|
|
706
|
-
})),
|
|
707
|
-
|
|
708
|
-
),
|
|
814
|
+
request: I().optional()
|
|
815
|
+
})), Qn = Z.merge(
|
|
816
|
+
M
|
|
817
|
+
), Yn = m(A["MyOS/Document Anchor"])(l.object({
|
|
709
818
|
description: l.string().optional(),
|
|
710
819
|
name: l.string().optional(),
|
|
711
|
-
template:
|
|
712
|
-
})),
|
|
820
|
+
template: I().optional()
|
|
821
|
+
})), Zn = m(A["MyOS/Document Anchors"])(l.object({}).catchall(Yn)), Xn = Zn.merge(M), er = m(A["MyOS/Link"])(l.object({
|
|
713
822
|
anchor: l.string().optional(),
|
|
714
823
|
description: l.string().optional(),
|
|
715
824
|
name: l.string().optional()
|
|
716
|
-
})),
|
|
717
|
-
|
|
718
|
-
),
|
|
825
|
+
})), tr = m(A["MyOS/Document Links"])(l.object({}).catchall(er)), nr = tr.merge(
|
|
826
|
+
M
|
|
827
|
+
), rr = m(A["MyOS/MyOS Participants Orchestration"])(l.object({
|
|
719
828
|
name: l.string().optional()
|
|
720
|
-
})),
|
|
829
|
+
})), or = rr.merge(M), ir = m(A["MyOS/MyOS Session Interaction"])(l.object({
|
|
721
830
|
name: l.string().optional()
|
|
722
|
-
})),
|
|
831
|
+
})), sr = ir.merge(M), ar = m(A["MyOS/MyOS Worker Agency"])(l.object({
|
|
723
832
|
name: l.string().optional()
|
|
724
|
-
})),
|
|
725
|
-
|
|
726
|
-
),
|
|
833
|
+
})), cr = ar.merge(
|
|
834
|
+
M
|
|
835
|
+
), le = m(T["Conversation/Sequential Workflow Step"])(l.object({
|
|
727
836
|
description: l.string().optional(),
|
|
728
837
|
name: l.string().optional()
|
|
729
|
-
})),
|
|
838
|
+
})), Rt = m(T["Conversation/Sequential Workflow"])(St.extend({
|
|
730
839
|
description: l.string().optional(),
|
|
731
840
|
name: l.string().optional(),
|
|
732
|
-
steps: l.array(
|
|
733
|
-
})),
|
|
734
|
-
steps: l.array(
|
|
735
|
-
}),
|
|
841
|
+
steps: l.array(le).optional()
|
|
842
|
+
})), Vi = I(), lr = Rt.merge(vt).extend({
|
|
843
|
+
steps: l.array(I()).optional()
|
|
844
|
+
}), ur = m(T["Conversation/Sequential Workflow Operation"])(Rt.extend({
|
|
736
845
|
description: l.string().optional(),
|
|
737
846
|
name: l.string().optional(),
|
|
738
847
|
operation: l.string().optional()
|
|
739
|
-
})),
|
|
740
|
-
|
|
848
|
+
})), hr = ur.merge(
|
|
849
|
+
vt
|
|
741
850
|
).extend({
|
|
742
|
-
steps: l.array(
|
|
851
|
+
steps: l.array(I()).optional()
|
|
743
852
|
});
|
|
744
|
-
function
|
|
745
|
-
if (!Array.isArray(
|
|
853
|
+
function dr(o) {
|
|
854
|
+
if (!Array.isArray(o.blueIds) || o.blueIds.length === 0)
|
|
746
855
|
throw new Error("Contract processors must declare at least one BlueId");
|
|
747
|
-
for (const e of
|
|
856
|
+
for (const e of o.blueIds)
|
|
748
857
|
if (typeof e != "string" || e.trim().length === 0)
|
|
749
858
|
throw new Error("Contract processor BlueIds must be non-empty strings");
|
|
750
859
|
}
|
|
751
|
-
function
|
|
752
|
-
|
|
753
|
-
for (const t of
|
|
754
|
-
e.set(t,
|
|
860
|
+
function X(o, e) {
|
|
861
|
+
dr(o);
|
|
862
|
+
for (const t of o.blueIds)
|
|
863
|
+
e.set(t, o);
|
|
755
864
|
}
|
|
756
|
-
class
|
|
865
|
+
class pr {
|
|
757
866
|
processorsByBlueId = /* @__PURE__ */ new Map();
|
|
758
867
|
handlerProcessors = /* @__PURE__ */ new Map();
|
|
759
868
|
channelProcessors = /* @__PURE__ */ new Map();
|
|
760
869
|
markerProcessors = /* @__PURE__ */ new Map();
|
|
761
870
|
registerHandler(e) {
|
|
762
|
-
|
|
871
|
+
X(e, this.handlerProcessors), this.registerProcessorMap(e);
|
|
763
872
|
}
|
|
764
873
|
registerChannel(e) {
|
|
765
|
-
|
|
874
|
+
X(e, this.channelProcessors), this.registerProcessorMap(e);
|
|
766
875
|
}
|
|
767
876
|
registerMarker(e) {
|
|
768
|
-
|
|
877
|
+
X(e, this.markerProcessors), this.registerProcessorMap(e);
|
|
769
878
|
}
|
|
770
879
|
register(e) {
|
|
771
880
|
switch (e.kind) {
|
|
@@ -808,15 +917,15 @@ class qn {
|
|
|
808
917
|
return new Map(this.processorsByBlueId);
|
|
809
918
|
}
|
|
810
919
|
registerProcessorMap(e) {
|
|
811
|
-
|
|
920
|
+
X(e, this.processorsByBlueId);
|
|
812
921
|
}
|
|
813
922
|
lookupProcessorForNode(e, t, n) {
|
|
814
923
|
const r = t.getType();
|
|
815
924
|
if (!r)
|
|
816
925
|
return;
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
819
|
-
const c = n.get(
|
|
926
|
+
const i = r.getBlueId();
|
|
927
|
+
if (i) {
|
|
928
|
+
const c = n.get(i);
|
|
820
929
|
if (c)
|
|
821
930
|
return c;
|
|
822
931
|
}
|
|
@@ -853,19 +962,26 @@ class qn {
|
|
|
853
962
|
return { blueId: s.blueId, value: s.value };
|
|
854
963
|
}
|
|
855
964
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
965
|
+
class fr {
|
|
966
|
+
kind = "marker";
|
|
967
|
+
blueIds = [
|
|
968
|
+
b["Conversation/Actor Policy"]
|
|
969
|
+
];
|
|
970
|
+
schema = Tt;
|
|
971
|
+
}
|
|
972
|
+
const mr = "compositeSourceChannelKey";
|
|
973
|
+
function gr(o, e) {
|
|
974
|
+
return `${o}::${e}`;
|
|
859
975
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
976
|
+
function Er(o) {
|
|
977
|
+
return o != null && Object.prototype.hasOwnProperty.call(o, "lastEvents") && Object.prototype.hasOwnProperty.call(o, "lastSignatures");
|
|
862
978
|
}
|
|
863
|
-
class
|
|
979
|
+
class yr {
|
|
864
980
|
kind = "channel";
|
|
865
981
|
blueIds = [
|
|
866
|
-
|
|
982
|
+
b["Conversation/Composite Timeline Channel"]
|
|
867
983
|
];
|
|
868
|
-
schema =
|
|
984
|
+
schema = bt;
|
|
869
985
|
/**
|
|
870
986
|
* Fallback match hook that delegates to {@link evaluate} for consistent behavior.
|
|
871
987
|
*/
|
|
@@ -883,14 +999,14 @@ class Zn {
|
|
|
883
999
|
const r = e.channels?.filter((u) => u.trim().length > 0) ?? [];
|
|
884
1000
|
if (r.length === 0)
|
|
885
1001
|
return { matches: !1 };
|
|
886
|
-
const
|
|
887
|
-
if (!
|
|
1002
|
+
const i = t.resolveChannel, s = t.channelProcessorFor;
|
|
1003
|
+
if (!i || !s)
|
|
888
1004
|
throw new Error(
|
|
889
1005
|
"Composite timeline channel evaluation requires channel resolution helpers"
|
|
890
1006
|
);
|
|
891
1007
|
const a = t.blue.calculateBlueIdSync(n), c = [];
|
|
892
1008
|
for (const u of r) {
|
|
893
|
-
const h =
|
|
1009
|
+
const h = i(u);
|
|
894
1010
|
if (!h)
|
|
895
1011
|
throw new Error(
|
|
896
1012
|
`Composite timeline channel '${t.bindingKey}' references missing channel '${u}'`
|
|
@@ -900,33 +1016,33 @@ class Zn {
|
|
|
900
1016
|
throw new Error(
|
|
901
1017
|
`No processor registered for child channel '${u}' (${h.blueId})`
|
|
902
1018
|
);
|
|
903
|
-
const
|
|
1019
|
+
const v = n.clone(), f = {
|
|
904
1020
|
...t,
|
|
905
|
-
event:
|
|
1021
|
+
event: v,
|
|
906
1022
|
bindingKey: u
|
|
907
|
-
},
|
|
908
|
-
if (
|
|
1023
|
+
}, g = h.contract, y = g.event;
|
|
1024
|
+
if (y && !t.blue.isTypeOfNode(v, y) || !await d.matches(g, f))
|
|
909
1025
|
continue;
|
|
910
|
-
const
|
|
911
|
-
this.enrichEvent(
|
|
912
|
-
const
|
|
1026
|
+
const _ = d.channelize, Me = (_ ? _.call(d, g, f) : void 0) ?? v.clone();
|
|
1027
|
+
this.enrichEvent(Me, u);
|
|
1028
|
+
const Oe = gr(
|
|
913
1029
|
t.bindingKey,
|
|
914
1030
|
u
|
|
915
|
-
),
|
|
1031
|
+
), Lt = await this.shouldProcessChild({
|
|
916
1032
|
childProcessor: d,
|
|
917
|
-
childContract:
|
|
1033
|
+
childContract: g,
|
|
918
1034
|
context: {
|
|
919
1035
|
...f,
|
|
920
1036
|
event: n.clone()
|
|
921
1037
|
},
|
|
922
|
-
checkpointKey:
|
|
1038
|
+
checkpointKey: Oe,
|
|
923
1039
|
markers: t.markers
|
|
924
1040
|
});
|
|
925
1041
|
c.push({
|
|
926
|
-
eventNode:
|
|
1042
|
+
eventNode: Me,
|
|
927
1043
|
eventId: a,
|
|
928
|
-
checkpointKey:
|
|
929
|
-
shouldProcess:
|
|
1044
|
+
checkpointKey: Oe,
|
|
1045
|
+
shouldProcess: Lt
|
|
930
1046
|
});
|
|
931
1047
|
}
|
|
932
1048
|
return {
|
|
@@ -938,17 +1054,17 @@ class Zn {
|
|
|
938
1054
|
* Determine recency by checking whether any child delivery should process.
|
|
939
1055
|
*/
|
|
940
1056
|
async isNewerEvent(e, t, n) {
|
|
941
|
-
const r = await this.evaluate(e, t),
|
|
942
|
-
return !r.matches ||
|
|
1057
|
+
const r = await this.evaluate(e, t), i = r.deliveries ?? [];
|
|
1058
|
+
return !r.matches || i.length === 0 ? !1 : i.some((s) => s.shouldProcess !== !1);
|
|
943
1059
|
}
|
|
944
1060
|
/**
|
|
945
1061
|
* Attach the source child channel key to event metadata for handler logic.
|
|
946
1062
|
*/
|
|
947
1063
|
enrichEvent(e, t) {
|
|
948
|
-
const n = e.getProperties() ?? {}, r = n.meta instanceof p ? n.meta.clone() : new p(),
|
|
1064
|
+
const n = e.getProperties() ?? {}, r = n.meta instanceof p ? n.meta.clone() : new p(), i = r.getProperties() ?? {};
|
|
949
1065
|
r.setProperties({
|
|
950
|
-
...
|
|
951
|
-
[
|
|
1066
|
+
...i,
|
|
1067
|
+
[mr]: new p().setValue(t)
|
|
952
1068
|
}), e.setProperties({ ...n, meta: r });
|
|
953
1069
|
}
|
|
954
1070
|
/**
|
|
@@ -970,75 +1086,75 @@ class Zn {
|
|
|
970
1086
|
* Resolve the checkpoint marker for the current scope, if present.
|
|
971
1087
|
*/
|
|
972
1088
|
resolveCheckpoint(e) {
|
|
973
|
-
const t = e.get(
|
|
974
|
-
return
|
|
1089
|
+
const t = e.get(D);
|
|
1090
|
+
return Er(t) ? t : null;
|
|
975
1091
|
}
|
|
976
1092
|
}
|
|
977
|
-
const
|
|
1093
|
+
const Cr = m(T["Conversation/Actor"])(l.object({
|
|
978
1094
|
description: l.string().optional(),
|
|
979
1095
|
name: l.string().optional()
|
|
980
|
-
})),
|
|
1096
|
+
})), Mt = m(T["Conversation/Timeline"])(l.object({
|
|
981
1097
|
description: l.string().optional(),
|
|
982
1098
|
name: l.string().optional(),
|
|
983
1099
|
timelineId: l.string().optional()
|
|
984
|
-
})), N =
|
|
985
|
-
actor:
|
|
1100
|
+
})), N = m(T["Conversation/Timeline Entry"])(l.object({
|
|
1101
|
+
actor: Cr.optional(),
|
|
986
1102
|
description: l.string().optional(),
|
|
987
|
-
message:
|
|
1103
|
+
message: I().optional(),
|
|
988
1104
|
name: l.string().optional(),
|
|
989
|
-
prevEntry:
|
|
990
|
-
source:
|
|
991
|
-
timeline:
|
|
1105
|
+
prevEntry: I().optional(),
|
|
1106
|
+
source: I().optional(),
|
|
1107
|
+
timeline: Mt.optional(),
|
|
992
1108
|
timestamp: l.number().optional()
|
|
993
|
-
})),
|
|
1109
|
+
})), Sr = m(A["MyOS/MyOS Timeline"])(Mt.extend({
|
|
994
1110
|
accountId: l.string().optional(),
|
|
995
1111
|
description: l.string().optional(),
|
|
996
1112
|
name: l.string().optional()
|
|
997
|
-
})),
|
|
1113
|
+
})), Ue = m(A["MyOS/MyOS Timeline Entry"])(N.extend({
|
|
998
1114
|
description: l.string().optional(),
|
|
999
1115
|
name: l.string().optional(),
|
|
1000
|
-
timeline:
|
|
1116
|
+
timeline: Sr.optional()
|
|
1001
1117
|
}));
|
|
1002
|
-
function
|
|
1003
|
-
return e &&
|
|
1118
|
+
function ze(o, e) {
|
|
1119
|
+
return e && o.isTypeOf(e, N, { checkSchemaExtensions: !0 }) ? o.nodeToSchemaOutput(e, N) : null;
|
|
1004
1120
|
}
|
|
1005
|
-
function
|
|
1006
|
-
const n =
|
|
1121
|
+
function Ot(o, e, t) {
|
|
1122
|
+
const n = ze(o, e), r = ze(o, t);
|
|
1007
1123
|
if (!n || !r)
|
|
1008
1124
|
return !0;
|
|
1009
|
-
const
|
|
1010
|
-
return typeof
|
|
1125
|
+
const i = n.timestamp, s = r.timestamp;
|
|
1126
|
+
return typeof i != "number" || typeof s != "number" ? !0 : i >= s;
|
|
1011
1127
|
}
|
|
1012
|
-
function
|
|
1013
|
-
return
|
|
1128
|
+
function Ve(o, e) {
|
|
1129
|
+
return o.isTypeOf(e, Ue) ? o.nodeToSchemaOutput(e, Ue) : o.isTypeOf(e, N) ? o.nodeToSchemaOutput(e, N) : null;
|
|
1014
1130
|
}
|
|
1015
|
-
class
|
|
1131
|
+
class vr {
|
|
1016
1132
|
kind = "channel";
|
|
1017
|
-
blueIds = [
|
|
1018
|
-
schema =
|
|
1133
|
+
blueIds = [q["MyOS/MyOS Timeline Channel"]];
|
|
1134
|
+
schema = _n;
|
|
1019
1135
|
matches(e, t) {
|
|
1020
1136
|
const { event: n, blue: r } = t;
|
|
1021
1137
|
if (!n)
|
|
1022
1138
|
return !1;
|
|
1023
|
-
const
|
|
1024
|
-
if (!
|
|
1139
|
+
const i = Ve(r, n);
|
|
1140
|
+
if (!i)
|
|
1025
1141
|
return !1;
|
|
1026
|
-
const s =
|
|
1142
|
+
const s = i.timeline?.timelineId;
|
|
1027
1143
|
return !s || !e.timelineId ? !1 : s === e.timelineId;
|
|
1028
1144
|
}
|
|
1029
1145
|
channelize(e, t) {
|
|
1030
1146
|
const { event: n, blue: r } = t;
|
|
1031
|
-
return !n || !
|
|
1147
|
+
return !n || !Ve(r, n) ? null : n.clone();
|
|
1032
1148
|
}
|
|
1033
1149
|
isNewerEvent(e, t, n) {
|
|
1034
|
-
const { event: r, blue:
|
|
1035
|
-
return r ?
|
|
1150
|
+
const { event: r, blue: i } = t;
|
|
1151
|
+
return r ? Ot(i, r, n) : !0;
|
|
1036
1152
|
}
|
|
1037
1153
|
}
|
|
1038
|
-
class
|
|
1154
|
+
class wr {
|
|
1039
1155
|
kind = "channel";
|
|
1040
|
-
blueIds = [
|
|
1041
|
-
schema =
|
|
1156
|
+
blueIds = [b["Conversation/Timeline Channel"]];
|
|
1157
|
+
schema = Bn;
|
|
1042
1158
|
matches(e, t) {
|
|
1043
1159
|
const { event: n, blue: r } = t;
|
|
1044
1160
|
if (!n || !r.isTypeOf(n, N))
|
|
@@ -1051,109 +1167,109 @@ class tr {
|
|
|
1051
1167
|
return !n || !r.isTypeOf(n, N) ? null : n.clone();
|
|
1052
1168
|
}
|
|
1053
1169
|
isNewerEvent(e, t, n) {
|
|
1054
|
-
const { event: r, blue:
|
|
1055
|
-
return r ?
|
|
1170
|
+
const { event: r, blue: i } = t;
|
|
1171
|
+
return r ? Ot(i, r, n) : !0;
|
|
1056
1172
|
}
|
|
1057
1173
|
}
|
|
1058
|
-
const
|
|
1174
|
+
const He = m(T["Conversation/Trigger Event"])(le.extend({
|
|
1059
1175
|
description: l.string().optional(),
|
|
1060
|
-
event:
|
|
1176
|
+
event: I().optional(),
|
|
1061
1177
|
name: l.string().optional()
|
|
1062
1178
|
}));
|
|
1063
|
-
function
|
|
1064
|
-
const { context: e, eventNode: t, stepResults: n, contractNode: r } =
|
|
1179
|
+
function Pe(o) {
|
|
1180
|
+
const { context: e, eventNode: t, stepResults: n, contractNode: r } = o, i = Ir(e), s = r != null ? e.blue.nodeToJson(r, "simple") : null, a = r != null ? e.blue.nodeToJson(r, "official") : s;
|
|
1065
1181
|
return {
|
|
1066
1182
|
event: e.blue.nodeToJson(t, "simple"),
|
|
1067
1183
|
eventCanonical: e.blue.nodeToJson(t, "official"),
|
|
1068
1184
|
steps: n,
|
|
1069
|
-
document:
|
|
1185
|
+
document: i,
|
|
1070
1186
|
currentContract: s,
|
|
1071
1187
|
currentContractCanonical: a
|
|
1072
1188
|
};
|
|
1073
1189
|
}
|
|
1074
|
-
const
|
|
1075
|
-
function
|
|
1076
|
-
const e = (
|
|
1077
|
-
if (
|
|
1190
|
+
const br = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
|
|
1191
|
+
function Ir(o) {
|
|
1192
|
+
const e = (i) => {
|
|
1193
|
+
if (i === "/")
|
|
1078
1194
|
return !1;
|
|
1079
|
-
const s =
|
|
1080
|
-
return
|
|
1081
|
-
}, t = (
|
|
1082
|
-
const s =
|
|
1195
|
+
const s = i.lastIndexOf("/"), a = i.substring(s + 1);
|
|
1196
|
+
return br.has(a);
|
|
1197
|
+
}, t = (i) => {
|
|
1198
|
+
const s = i == null ? "/" : typeof i == "string" ? i : (() => {
|
|
1083
1199
|
throw new TypeError("document() expects a string pointer");
|
|
1084
|
-
})(), a = s.startsWith("/") ? s :
|
|
1085
|
-
return
|
|
1086
|
-
}, n = (
|
|
1087
|
-
const { snapshot: a, normalizedPointer: c } = t(
|
|
1200
|
+
})(), a = s.startsWith("/") ? s : o.resolvePointer(s), c = R(a), u = o.documentAt(c);
|
|
1201
|
+
return o.gasMeter().chargeDocumentSnapshot(c, u), { snapshot: u, normalizedPointer: c };
|
|
1202
|
+
}, n = (i, s) => {
|
|
1203
|
+
const { snapshot: a, normalizedPointer: c } = t(i);
|
|
1088
1204
|
if (a)
|
|
1089
|
-
return e(c) ?
|
|
1090
|
-
}, r = ((
|
|
1091
|
-
return r.canonical = (
|
|
1205
|
+
return e(c) ? o.blue.nodeToJson(a, "simple") : o.blue.nodeToJson(a, s);
|
|
1206
|
+
}, r = ((i) => n(i, "simple"));
|
|
1207
|
+
return r.canonical = (i) => n(i, "official"), r;
|
|
1092
1208
|
}
|
|
1093
|
-
class
|
|
1209
|
+
class kr {
|
|
1094
1210
|
supportedBlueIds = [
|
|
1095
|
-
|
|
1211
|
+
b["Conversation/Trigger Event"]
|
|
1096
1212
|
];
|
|
1097
|
-
evaluator = new
|
|
1213
|
+
evaluator = new ke();
|
|
1098
1214
|
async execute(e) {
|
|
1099
1215
|
const { stepNode: t, context: n } = e;
|
|
1100
|
-
if (!n.blue.isTypeOf(t,
|
|
1216
|
+
if (!n.blue.isTypeOf(t, He))
|
|
1101
1217
|
return n.throwFatal("Trigger Event step payload is invalid");
|
|
1102
1218
|
n.gasMeter().chargeTriggerEventBase();
|
|
1103
|
-
const r = await
|
|
1219
|
+
const r = await re({
|
|
1104
1220
|
evaluator: this.evaluator,
|
|
1105
1221
|
node: t,
|
|
1106
|
-
bindings:
|
|
1107
|
-
shouldResolve:
|
|
1222
|
+
bindings: Pe(e),
|
|
1223
|
+
shouldResolve: ot({
|
|
1108
1224
|
include: ["/event", "/event/**"]
|
|
1109
1225
|
}),
|
|
1110
|
-
shouldDescend:
|
|
1226
|
+
shouldDescend: Tr(),
|
|
1111
1227
|
context: n
|
|
1112
1228
|
}), s = n.blue.nodeToSchemaOutput(
|
|
1113
1229
|
r,
|
|
1114
|
-
|
|
1230
|
+
He
|
|
1115
1231
|
).event;
|
|
1116
|
-
if (
|
|
1232
|
+
if (ge(s))
|
|
1117
1233
|
return n.throwFatal(
|
|
1118
1234
|
"Trigger Event step must declare event payload"
|
|
1119
1235
|
);
|
|
1120
1236
|
n.emitEvent(s.clone());
|
|
1121
1237
|
}
|
|
1122
1238
|
}
|
|
1123
|
-
function
|
|
1124
|
-
return (
|
|
1239
|
+
function Tr() {
|
|
1240
|
+
return (o, e) => o === "/event" || !o.startsWith("/event/") ? !0 : !Pr(e);
|
|
1125
1241
|
}
|
|
1126
|
-
function
|
|
1127
|
-
const e =
|
|
1242
|
+
function Pr(o) {
|
|
1243
|
+
const e = o.getProperties?.();
|
|
1128
1244
|
return e ? !!e.contracts : !1;
|
|
1129
1245
|
}
|
|
1130
|
-
const
|
|
1246
|
+
const Ke = m(T["Conversation/JavaScript Code"])(le.extend({
|
|
1131
1247
|
code: l.string().optional(),
|
|
1132
1248
|
description: l.string().optional(),
|
|
1133
1249
|
name: l.string().optional()
|
|
1134
1250
|
}));
|
|
1135
|
-
class
|
|
1251
|
+
class Rr {
|
|
1136
1252
|
supportedBlueIds = [
|
|
1137
|
-
|
|
1253
|
+
b["Conversation/JavaScript Code"]
|
|
1138
1254
|
];
|
|
1139
|
-
evaluator = new
|
|
1255
|
+
evaluator = new ke();
|
|
1140
1256
|
wasmGasLimit;
|
|
1141
1257
|
constructor(e = {}) {
|
|
1142
|
-
this.wasmGasLimit = e.wasmGasLimit ??
|
|
1258
|
+
this.wasmGasLimit = e.wasmGasLimit ?? tt;
|
|
1143
1259
|
}
|
|
1144
1260
|
async execute(e) {
|
|
1145
1261
|
const { context: t, stepNode: n } = e, { blue: r } = t;
|
|
1146
|
-
if (!r.isTypeOf(n,
|
|
1262
|
+
if (!r.isTypeOf(n, Ke))
|
|
1147
1263
|
return t.throwFatal("JavaScript Code step payload is invalid");
|
|
1148
1264
|
const s = r.nodeToSchemaOutput(
|
|
1149
1265
|
n,
|
|
1150
|
-
|
|
1266
|
+
Ke
|
|
1151
1267
|
).code;
|
|
1152
1268
|
if (!s)
|
|
1153
1269
|
return t.throwFatal(
|
|
1154
1270
|
"JavaScript Code step must include code to execute"
|
|
1155
1271
|
);
|
|
1156
|
-
const a =
|
|
1272
|
+
const a = Pe(e);
|
|
1157
1273
|
try {
|
|
1158
1274
|
const c = await this.evaluator.evaluate({
|
|
1159
1275
|
code: s,
|
|
@@ -1163,7 +1279,7 @@ class ar {
|
|
|
1163
1279
|
});
|
|
1164
1280
|
return this.handleEvents(c, t), c;
|
|
1165
1281
|
} catch (c) {
|
|
1166
|
-
throw new
|
|
1282
|
+
throw new Xe(s, c);
|
|
1167
1283
|
}
|
|
1168
1284
|
}
|
|
1169
1285
|
handleEvents(e, t) {
|
|
@@ -1172,40 +1288,40 @@ class ar {
|
|
|
1172
1288
|
const n = e;
|
|
1173
1289
|
if (Array.isArray(n.events))
|
|
1174
1290
|
for (const r of n.events) {
|
|
1175
|
-
const
|
|
1176
|
-
t.emitEvent(
|
|
1291
|
+
const i = t.blue.jsonValueToNode(r);
|
|
1292
|
+
t.emitEvent(i);
|
|
1177
1293
|
}
|
|
1178
1294
|
}
|
|
1179
1295
|
}
|
|
1180
|
-
const
|
|
1296
|
+
const Mr = m(P["Core/Json Patch Entry"])(l.object({
|
|
1181
1297
|
description: l.string().optional(),
|
|
1182
1298
|
name: l.string().optional(),
|
|
1183
1299
|
op: l.string().optional(),
|
|
1184
1300
|
path: l.string().optional(),
|
|
1185
|
-
val:
|
|
1186
|
-
})),
|
|
1187
|
-
changeset: l.array(
|
|
1301
|
+
val: I().optional()
|
|
1302
|
+
})), We = m(T["Conversation/Update Document"])(le.extend({
|
|
1303
|
+
changeset: l.array(Mr).optional(),
|
|
1188
1304
|
description: l.string().optional(),
|
|
1189
1305
|
name: l.string().optional()
|
|
1190
1306
|
}));
|
|
1191
|
-
class
|
|
1307
|
+
class Or {
|
|
1192
1308
|
supportedBlueIds = [
|
|
1193
|
-
|
|
1309
|
+
b["Conversation/Update Document"]
|
|
1194
1310
|
];
|
|
1195
|
-
evaluator = new
|
|
1311
|
+
evaluator = new ke();
|
|
1196
1312
|
async execute(e) {
|
|
1197
1313
|
const { context: t, stepNode: n } = e, { blue: r } = t;
|
|
1198
|
-
if (!r.isTypeOf(n,
|
|
1314
|
+
if (!r.isTypeOf(n, We))
|
|
1199
1315
|
return t.throwFatal("Update Document step payload is invalid");
|
|
1200
|
-
const
|
|
1316
|
+
const i = await re({
|
|
1201
1317
|
evaluator: this.evaluator,
|
|
1202
1318
|
node: n,
|
|
1203
|
-
bindings:
|
|
1204
|
-
shouldResolve:
|
|
1319
|
+
bindings: Pe(e),
|
|
1320
|
+
shouldResolve: ot({
|
|
1205
1321
|
include: ["/changeset", "/changeset/**"]
|
|
1206
1322
|
}),
|
|
1207
1323
|
context: t
|
|
1208
|
-
}), s = this.extractChanges(
|
|
1324
|
+
}), s = this.extractChanges(i, t);
|
|
1209
1325
|
t.gasMeter().chargeUpdateDocumentBase(s.length);
|
|
1210
1326
|
for (const a of s) {
|
|
1211
1327
|
const c = this.createPatch(a, t);
|
|
@@ -1215,12 +1331,12 @@ class lr {
|
|
|
1215
1331
|
extractChanges(e, t) {
|
|
1216
1332
|
return t.blue.nodeToSchemaOutput(
|
|
1217
1333
|
e,
|
|
1218
|
-
|
|
1334
|
+
We
|
|
1219
1335
|
).changeset ?? [];
|
|
1220
1336
|
}
|
|
1221
1337
|
createPatch(e, t) {
|
|
1222
|
-
const n = this.normalizeOperation(e.op, t), r = this.normalizePath(e.path, t),
|
|
1223
|
-
return n === "REMOVE" ? { op: n, path:
|
|
1338
|
+
const n = this.normalizeOperation(e.op, t), r = this.normalizePath(e.path, t), i = t.resolvePointer(r);
|
|
1339
|
+
return n === "REMOVE" ? { op: n, path: i } : { op: n, path: i, val: e.val };
|
|
1224
1340
|
}
|
|
1225
1341
|
normalizeOperation(e, t) {
|
|
1226
1342
|
const n = typeof e == "string" ? e : void 0, r = (n ?? "REPLACE").toUpperCase();
|
|
@@ -1235,14 +1351,14 @@ class lr {
|
|
|
1235
1351
|
return n.length === 0 ? t.throwFatal("Update Document path cannot be empty") : n;
|
|
1236
1352
|
}
|
|
1237
1353
|
}
|
|
1238
|
-
const
|
|
1239
|
-
new
|
|
1240
|
-
new
|
|
1241
|
-
new
|
|
1354
|
+
const Re = [
|
|
1355
|
+
new kr(),
|
|
1356
|
+
new Rr(),
|
|
1357
|
+
new Or()
|
|
1242
1358
|
];
|
|
1243
|
-
class
|
|
1359
|
+
class Nt {
|
|
1244
1360
|
executorIndex;
|
|
1245
|
-
constructor(e =
|
|
1361
|
+
constructor(e = Re) {
|
|
1246
1362
|
const t = /* @__PURE__ */ new Map();
|
|
1247
1363
|
for (const n of e)
|
|
1248
1364
|
for (const r of n.supportedBlueIds)
|
|
@@ -1250,35 +1366,35 @@ class gt {
|
|
|
1250
1366
|
this.executorIndex = t;
|
|
1251
1367
|
}
|
|
1252
1368
|
async run(e) {
|
|
1253
|
-
const { workflow: t, eventNode: n, context: r, contractNode:
|
|
1369
|
+
const { workflow: t, eventNode: n, context: r, contractNode: i } = e, s = t.steps ?? [];
|
|
1254
1370
|
if (s.length === 0)
|
|
1255
1371
|
return {};
|
|
1256
1372
|
const a = {};
|
|
1257
1373
|
for (const [c, u] of s.entries()) {
|
|
1258
1374
|
const h = u.getType?.()?.getBlueId();
|
|
1259
|
-
if (
|
|
1375
|
+
if (ge(h))
|
|
1260
1376
|
return r.throwFatal(
|
|
1261
1377
|
"Sequential workflow step is missing type metadata"
|
|
1262
1378
|
);
|
|
1263
1379
|
const d = this.executorIndex.get(h);
|
|
1264
|
-
if (
|
|
1265
|
-
const
|
|
1380
|
+
if (ge(d)) {
|
|
1381
|
+
const g = u.getType?.()?.getName?.() ?? h;
|
|
1266
1382
|
return r.throwFatal(
|
|
1267
|
-
`Unsupported workflow step type "${
|
|
1383
|
+
`Unsupported workflow step type "${g}"`
|
|
1268
1384
|
);
|
|
1269
1385
|
}
|
|
1270
|
-
const
|
|
1386
|
+
const v = {
|
|
1271
1387
|
workflow: t,
|
|
1272
1388
|
stepNode: u,
|
|
1273
1389
|
eventNode: n,
|
|
1274
1390
|
context: r,
|
|
1275
1391
|
stepResults: a,
|
|
1276
1392
|
stepIndex: c,
|
|
1277
|
-
contractNode:
|
|
1278
|
-
}, f = await d.execute(
|
|
1393
|
+
contractNode: i
|
|
1394
|
+
}, f = await d.execute(v);
|
|
1279
1395
|
if (f !== void 0) {
|
|
1280
|
-
const
|
|
1281
|
-
a[
|
|
1396
|
+
const g = this.stepResultKey(u, c);
|
|
1397
|
+
a[g] = f;
|
|
1282
1398
|
}
|
|
1283
1399
|
}
|
|
1284
1400
|
return a;
|
|
@@ -1288,15 +1404,15 @@ class gt {
|
|
|
1288
1404
|
return n && typeof n == "string" && n.length > 0 ? n : `Step${t + 1}`;
|
|
1289
1405
|
}
|
|
1290
1406
|
}
|
|
1291
|
-
class
|
|
1407
|
+
class Nr {
|
|
1292
1408
|
kind = "handler";
|
|
1293
1409
|
blueIds = [
|
|
1294
|
-
|
|
1410
|
+
b["Conversation/Sequential Workflow"]
|
|
1295
1411
|
];
|
|
1296
|
-
schema =
|
|
1412
|
+
schema = lr;
|
|
1297
1413
|
runner;
|
|
1298
|
-
constructor(e =
|
|
1299
|
-
this.runner = new
|
|
1414
|
+
constructor(e = Re) {
|
|
1415
|
+
this.runner = new Nt(e);
|
|
1300
1416
|
}
|
|
1301
1417
|
async matches(e, t) {
|
|
1302
1418
|
const n = t.event();
|
|
@@ -1312,26 +1428,26 @@ class ur {
|
|
|
1312
1428
|
});
|
|
1313
1429
|
}
|
|
1314
1430
|
}
|
|
1315
|
-
class
|
|
1431
|
+
class Ar {
|
|
1316
1432
|
kind = "marker";
|
|
1317
|
-
blueIds = [
|
|
1318
|
-
schema =
|
|
1433
|
+
blueIds = [S["Core/Marker"]];
|
|
1434
|
+
schema = M;
|
|
1319
1435
|
}
|
|
1320
|
-
class
|
|
1436
|
+
class Br {
|
|
1321
1437
|
kind = "marker";
|
|
1322
|
-
blueIds = [
|
|
1323
|
-
schema =
|
|
1438
|
+
blueIds = [b["Conversation/Operation"]];
|
|
1439
|
+
schema = Qn;
|
|
1324
1440
|
}
|
|
1325
|
-
const
|
|
1441
|
+
const Ce = m(T["Conversation/Operation Request"])(l.object({
|
|
1326
1442
|
allowNewerVersion: l.boolean().optional(),
|
|
1327
1443
|
description: l.string().optional(),
|
|
1328
|
-
document:
|
|
1444
|
+
document: I().optional(),
|
|
1329
1445
|
name: l.string().optional(),
|
|
1330
1446
|
operation: l.string().optional(),
|
|
1331
|
-
request:
|
|
1447
|
+
request: I().optional()
|
|
1332
1448
|
}));
|
|
1333
|
-
function
|
|
1334
|
-
const e =
|
|
1449
|
+
function At(o) {
|
|
1450
|
+
const e = o.channel;
|
|
1335
1451
|
if (typeof e == "string") {
|
|
1336
1452
|
const t = e.trim();
|
|
1337
1453
|
if (t.length > 0)
|
|
@@ -1339,119 +1455,175 @@ function Et(i) {
|
|
|
1339
1455
|
}
|
|
1340
1456
|
return null;
|
|
1341
1457
|
}
|
|
1342
|
-
function
|
|
1343
|
-
const t =
|
|
1344
|
-
|
|
1458
|
+
function Dr(o, e) {
|
|
1459
|
+
const t = o.getProperties()?.document;
|
|
1460
|
+
if (!(t instanceof p))
|
|
1461
|
+
return null;
|
|
1462
|
+
const n = t.getReferenceBlueId();
|
|
1463
|
+
return n || e.blue.calculateBlueIdSync(t);
|
|
1345
1464
|
}
|
|
1346
|
-
function
|
|
1347
|
-
if (e.isTypeOf(
|
|
1465
|
+
function _r(o, e) {
|
|
1466
|
+
if (e.isTypeOf(o, Ce, {
|
|
1348
1467
|
checkSchemaExtensions: !0
|
|
1349
1468
|
}))
|
|
1350
|
-
return
|
|
1351
|
-
if (e.isTypeOf(
|
|
1469
|
+
return o;
|
|
1470
|
+
if (e.isTypeOf(o, N, {
|
|
1352
1471
|
checkSchemaExtensions: !0
|
|
1353
1472
|
})) {
|
|
1354
|
-
const n = e.nodeToSchemaOutput(
|
|
1355
|
-
if (n && e.isTypeOf(n,
|
|
1473
|
+
const n = e.nodeToSchemaOutput(o, N).message;
|
|
1474
|
+
if (n && e.isTypeOf(n, Ce, {
|
|
1356
1475
|
checkSchemaExtensions: !0
|
|
1357
1476
|
}))
|
|
1358
1477
|
return n;
|
|
1359
1478
|
}
|
|
1360
1479
|
return null;
|
|
1361
1480
|
}
|
|
1362
|
-
function
|
|
1363
|
-
const { blue: r } = n,
|
|
1364
|
-
return !(!
|
|
1481
|
+
function Lr(o, e, t, n) {
|
|
1482
|
+
const { blue: r } = n, i = o.operation;
|
|
1483
|
+
return !(!i || t.operation !== i || o.event && !r.isTypeOfNode(e, o.event));
|
|
1365
1484
|
}
|
|
1366
|
-
function
|
|
1367
|
-
const t =
|
|
1485
|
+
function xr(o, e) {
|
|
1486
|
+
const t = o.operation;
|
|
1368
1487
|
if (!t)
|
|
1369
1488
|
return null;
|
|
1370
1489
|
const n = e.resolvePointer(`/contracts/${t}`), r = e.documentAt(n);
|
|
1371
|
-
if (!r || !e.blue.isTypeOf(r,
|
|
1490
|
+
if (!r || !e.blue.isTypeOf(r, Z, {
|
|
1372
1491
|
checkSchemaExtensions: !0
|
|
1373
1492
|
}))
|
|
1374
1493
|
return null;
|
|
1375
|
-
const
|
|
1494
|
+
const i = e.blue.nodeToSchemaOutput(
|
|
1376
1495
|
r,
|
|
1377
|
-
|
|
1378
|
-
), s =
|
|
1379
|
-
return { operationNode: r, operation:
|
|
1496
|
+
Z
|
|
1497
|
+
), s = At(i);
|
|
1498
|
+
return { operationNode: r, operation: i, channelKey: s };
|
|
1380
1499
|
}
|
|
1381
|
-
function
|
|
1382
|
-
return !(
|
|
1500
|
+
function Fr(o, e) {
|
|
1501
|
+
return !(o && e && o !== e);
|
|
1383
1502
|
}
|
|
1384
|
-
function
|
|
1385
|
-
const n =
|
|
1503
|
+
function $r(o, e, t) {
|
|
1504
|
+
const n = o.getProperties()?.request, r = e.getProperties()?.request;
|
|
1386
1505
|
if (!(n instanceof p) || !(r instanceof p))
|
|
1387
1506
|
return !1;
|
|
1388
1507
|
try {
|
|
1389
|
-
if (!t.isTypeOfNode(n, r)
|
|
1508
|
+
if (!t.isTypeOfNode(n, r) && !qe(
|
|
1509
|
+
n,
|
|
1510
|
+
r,
|
|
1511
|
+
t
|
|
1512
|
+
))
|
|
1390
1513
|
return !1;
|
|
1391
1514
|
} catch {
|
|
1392
|
-
|
|
1515
|
+
if (!qe(n, r, t))
|
|
1516
|
+
return !1;
|
|
1393
1517
|
}
|
|
1394
1518
|
return !0;
|
|
1395
1519
|
}
|
|
1396
|
-
function
|
|
1397
|
-
if (!
|
|
1520
|
+
function qe(o, e, t) {
|
|
1521
|
+
if (!e.isResolved())
|
|
1522
|
+
return !1;
|
|
1523
|
+
const n = e.getType()?.getBlueId();
|
|
1524
|
+
return typeof n == "string" && n.length > 0 && t.isTypeOfBlueId(o, n);
|
|
1525
|
+
}
|
|
1526
|
+
function Ur(o, e, t) {
|
|
1527
|
+
if (!o || o.allowNewerVersion !== !1)
|
|
1398
1528
|
return !0;
|
|
1399
|
-
const n =
|
|
1529
|
+
const n = Dr(e, t);
|
|
1400
1530
|
if (!n)
|
|
1401
1531
|
return !0;
|
|
1402
|
-
const r = t.resolvePointer("/"),
|
|
1403
|
-
if (!
|
|
1532
|
+
const r = t.resolvePointer("/"), i = t.documentAt(r);
|
|
1533
|
+
if (!i)
|
|
1404
1534
|
return !1;
|
|
1405
|
-
const c = (
|
|
1535
|
+
const c = (i.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, u = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(i);
|
|
1406
1536
|
return n === u;
|
|
1407
1537
|
}
|
|
1408
|
-
|
|
1538
|
+
const zr = b["Conversation/Actor Policy"], Vr = b["Conversation/Principal Actor"], Hr = b["Conversation/Agent Actor"], Kr = b["Conversation/Browser Session"], Wr = b["Conversation/API Call"], qr = b["Conversation/Document Request"];
|
|
1539
|
+
function Gr(o, e, t) {
|
|
1540
|
+
const r = jr(t)?.operations?.[o];
|
|
1541
|
+
if (!r)
|
|
1542
|
+
return !0;
|
|
1543
|
+
const i = Jr(e, t), s = Qr(e, t);
|
|
1544
|
+
return Yr(r, i, s);
|
|
1545
|
+
}
|
|
1546
|
+
function jr(o) {
|
|
1547
|
+
const e = o.resolvePointer("/contracts"), n = o.documentAt(e)?.getProperties();
|
|
1548
|
+
if (!n)
|
|
1549
|
+
return null;
|
|
1550
|
+
for (const r of Object.values(n))
|
|
1551
|
+
if (r instanceof p && o.blue.isTypeOfBlueId(r, zr))
|
|
1552
|
+
return o.blue.nodeToSchemaOutput(
|
|
1553
|
+
r,
|
|
1554
|
+
Tt
|
|
1555
|
+
);
|
|
1556
|
+
return null;
|
|
1557
|
+
}
|
|
1558
|
+
function Jr(o, e) {
|
|
1559
|
+
const t = Bt(o, "actor", e);
|
|
1560
|
+
return t ? e.blue.isTypeOfBlueId(t, Hr) ? "agent" : e.blue.isTypeOfBlueId(t, Vr) ? "principal" : null : null;
|
|
1561
|
+
}
|
|
1562
|
+
function Qr(o, e) {
|
|
1563
|
+
const t = Bt(o, "source", e);
|
|
1564
|
+
return t ? e.blue.isTypeOfBlueId(t, Kr) ? "browserSession" : e.blue.isTypeOfBlueId(t, Wr) ? "apiCall" : e.blue.isTypeOfBlueId(t, qr) ? "documentRequest" : null : null;
|
|
1565
|
+
}
|
|
1566
|
+
function Bt(o, e, t) {
|
|
1567
|
+
if (!t.blue.isTypeOf(o, N, {
|
|
1568
|
+
checkSchemaExtensions: !0
|
|
1569
|
+
}))
|
|
1570
|
+
return null;
|
|
1571
|
+
const n = o.getProperties()?.[e];
|
|
1572
|
+
return n instanceof p ? n : null;
|
|
1573
|
+
}
|
|
1574
|
+
function Yr(o, e, t) {
|
|
1575
|
+
return !(o.requiresActor && (!e || o.requiresActor !== "any" && o.requiresActor !== e) || o.requiresSource && (!t || o.requiresSource !== t) || o.excludeSource && (!t || o.excludeSource === t));
|
|
1576
|
+
}
|
|
1577
|
+
class Zr {
|
|
1409
1578
|
kind = "handler";
|
|
1410
1579
|
blueIds = [
|
|
1411
|
-
|
|
1580
|
+
b["Conversation/Sequential Workflow Operation"]
|
|
1412
1581
|
];
|
|
1413
|
-
schema =
|
|
1582
|
+
schema = hr;
|
|
1414
1583
|
runner;
|
|
1415
|
-
constructor(e =
|
|
1416
|
-
this.runner = new
|
|
1584
|
+
constructor(e = Re) {
|
|
1585
|
+
this.runner = new Nt(e);
|
|
1417
1586
|
}
|
|
1418
1587
|
deriveChannel(e, t) {
|
|
1419
1588
|
const n = e.operation;
|
|
1420
1589
|
if (!n)
|
|
1421
1590
|
return null;
|
|
1422
1591
|
const r = t.scopeContracts.get(n);
|
|
1423
|
-
if (!r || !t.blue.isTypeOf(r.node,
|
|
1592
|
+
if (!r || !t.blue.isTypeOf(r.node, Z, {
|
|
1424
1593
|
checkSchemaExtensions: !0
|
|
1425
1594
|
}))
|
|
1426
1595
|
return null;
|
|
1427
|
-
const
|
|
1428
|
-
return
|
|
1596
|
+
const i = t.blue.nodeToSchemaOutput(r.node, Z);
|
|
1597
|
+
return i ? At(i) : null;
|
|
1429
1598
|
}
|
|
1430
1599
|
async matches(e, t) {
|
|
1431
1600
|
const n = t.event();
|
|
1432
1601
|
if (!n)
|
|
1433
1602
|
return !1;
|
|
1434
|
-
const r =
|
|
1603
|
+
const r = _r(
|
|
1435
1604
|
n,
|
|
1436
1605
|
t.blue
|
|
1437
1606
|
);
|
|
1438
1607
|
if (!r)
|
|
1439
1608
|
return !1;
|
|
1440
|
-
const
|
|
1609
|
+
const i = t.blue.nodeToSchemaOutput(
|
|
1441
1610
|
r,
|
|
1442
|
-
|
|
1611
|
+
Ce
|
|
1443
1612
|
);
|
|
1444
|
-
if (!
|
|
1613
|
+
if (!i || !Lr(e, n, i, t))
|
|
1445
1614
|
return !1;
|
|
1446
|
-
const s =
|
|
1615
|
+
const s = xr(e, t);
|
|
1447
1616
|
if (!s)
|
|
1448
1617
|
return !1;
|
|
1449
1618
|
const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
|
|
1450
|
-
|
|
1619
|
+
if (!Fr(s.channelKey, c) || !$r(
|
|
1451
1620
|
r,
|
|
1452
1621
|
s.operationNode,
|
|
1453
1622
|
t.blue
|
|
1454
|
-
) ||
|
|
1623
|
+
) || i?.allowNewerVersion === !1 && !Ur(i, r, t))
|
|
1624
|
+
return !1;
|
|
1625
|
+
const u = e.operation;
|
|
1626
|
+
return !(!u || !Gr(u, n, t));
|
|
1455
1627
|
}
|
|
1456
1628
|
async execute(e, t, n) {
|
|
1457
1629
|
const r = t.event();
|
|
@@ -1463,17 +1635,17 @@ class vr {
|
|
|
1463
1635
|
});
|
|
1464
1636
|
}
|
|
1465
1637
|
}
|
|
1466
|
-
class
|
|
1638
|
+
class ue {
|
|
1467
1639
|
constructor(e) {
|
|
1468
1640
|
this.registry = e;
|
|
1469
1641
|
}
|
|
1470
1642
|
static create() {
|
|
1471
|
-
return new
|
|
1472
|
-
new
|
|
1643
|
+
return new ue(
|
|
1644
|
+
new pr()
|
|
1473
1645
|
);
|
|
1474
1646
|
}
|
|
1475
1647
|
registerDefaults() {
|
|
1476
|
-
return this.registry.register(new
|
|
1648
|
+
return this.registry.register(new yr()), this.registry.register(new vr()), this.registry.register(new wr()), this.registry.register(new Nr()), this.registry.register(new fr()), this.registry.register(new Br()), this.registry.register(new Ar()), this.registry.register(new Zr()), this;
|
|
1477
1649
|
}
|
|
1478
1650
|
register(e) {
|
|
1479
1651
|
return this.registry.register(e), this;
|
|
@@ -1482,11 +1654,11 @@ class ae {
|
|
|
1482
1654
|
return this.registry;
|
|
1483
1655
|
}
|
|
1484
1656
|
}
|
|
1485
|
-
const
|
|
1486
|
-
function
|
|
1487
|
-
return typeof
|
|
1657
|
+
const Se = S["Core/Channel Event Checkpoint"];
|
|
1658
|
+
function Dt(o) {
|
|
1659
|
+
return typeof o.order == "number" ? o.order : 0;
|
|
1488
1660
|
}
|
|
1489
|
-
class
|
|
1661
|
+
class Xr {
|
|
1490
1662
|
constructor(e, t, n, r) {
|
|
1491
1663
|
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
|
|
1492
1664
|
}
|
|
@@ -1503,10 +1675,10 @@ class Sr {
|
|
|
1503
1675
|
return this.bindingNode.clone();
|
|
1504
1676
|
}
|
|
1505
1677
|
order() {
|
|
1506
|
-
return
|
|
1678
|
+
return Dt(this.bindingContract);
|
|
1507
1679
|
}
|
|
1508
1680
|
}
|
|
1509
|
-
class
|
|
1681
|
+
class eo {
|
|
1510
1682
|
constructor(e, t, n, r) {
|
|
1511
1683
|
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
|
|
1512
1684
|
}
|
|
@@ -1523,28 +1695,28 @@ class wr {
|
|
|
1523
1695
|
return this.bindingNode.clone();
|
|
1524
1696
|
}
|
|
1525
1697
|
order() {
|
|
1526
|
-
return
|
|
1698
|
+
return Dt(this.bindingContract);
|
|
1527
1699
|
}
|
|
1528
1700
|
}
|
|
1529
|
-
class
|
|
1530
|
-
constructor(e, t, n, r,
|
|
1531
|
-
this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared =
|
|
1701
|
+
class W {
|
|
1702
|
+
constructor(e, t, n, r, i) {
|
|
1703
|
+
this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared = i;
|
|
1532
1704
|
}
|
|
1533
1705
|
checkpointDeclared;
|
|
1534
|
-
static fromComponents(e, t, n, r,
|
|
1535
|
-
return new
|
|
1706
|
+
static fromComponents(e, t, n, r, i) {
|
|
1707
|
+
return new W(
|
|
1536
1708
|
e,
|
|
1537
1709
|
t,
|
|
1538
1710
|
n,
|
|
1539
1711
|
r,
|
|
1540
|
-
|
|
1712
|
+
i
|
|
1541
1713
|
);
|
|
1542
1714
|
}
|
|
1543
1715
|
static builder() {
|
|
1544
|
-
return new
|
|
1716
|
+
return new to();
|
|
1545
1717
|
}
|
|
1546
1718
|
static empty() {
|
|
1547
|
-
return
|
|
1719
|
+
return W.builder().build();
|
|
1548
1720
|
}
|
|
1549
1721
|
markers() {
|
|
1550
1722
|
return new Map(
|
|
@@ -1574,24 +1746,24 @@ class H {
|
|
|
1574
1746
|
throw new Error(
|
|
1575
1747
|
"Duplicate Channel Event Checkpoint markers detected in same contracts map"
|
|
1576
1748
|
);
|
|
1577
|
-
this.markerStore.set(
|
|
1578
|
-
key:
|
|
1749
|
+
this.markerStore.set(D, {
|
|
1750
|
+
key: D,
|
|
1579
1751
|
contract: e,
|
|
1580
|
-
blueId:
|
|
1752
|
+
blueId: Se
|
|
1581
1753
|
}), this.checkpointDeclared = !0;
|
|
1582
1754
|
}
|
|
1583
1755
|
handlersFor(e) {
|
|
1584
1756
|
const t = this.handlersByChannel.get(e);
|
|
1585
1757
|
return !t || t.length === 0 ? [] : [...t].map(
|
|
1586
|
-
(n) => new
|
|
1758
|
+
(n) => new eo(
|
|
1587
1759
|
n.key,
|
|
1588
1760
|
n.contract,
|
|
1589
1761
|
n.blueId,
|
|
1590
1762
|
n.node
|
|
1591
1763
|
)
|
|
1592
1764
|
).sort((n, r) => {
|
|
1593
|
-
const
|
|
1594
|
-
return
|
|
1765
|
+
const i = n.order() - r.order();
|
|
1766
|
+
return i !== 0 ? i : n.key().localeCompare(r.key());
|
|
1595
1767
|
});
|
|
1596
1768
|
}
|
|
1597
1769
|
channelEntry(e) {
|
|
@@ -1605,20 +1777,20 @@ class H {
|
|
|
1605
1777
|
}
|
|
1606
1778
|
channelsOfType(...e) {
|
|
1607
1779
|
const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
|
|
1608
|
-
(r) => new
|
|
1780
|
+
(r) => new Xr(
|
|
1609
1781
|
r.key,
|
|
1610
1782
|
r.contract,
|
|
1611
1783
|
r.blueId,
|
|
1612
1784
|
r.node
|
|
1613
1785
|
)
|
|
1614
1786
|
);
|
|
1615
|
-
return n.sort((r,
|
|
1616
|
-
const s = r.order() -
|
|
1617
|
-
return s !== 0 ? s : r.key().localeCompare(
|
|
1787
|
+
return n.sort((r, i) => {
|
|
1788
|
+
const s = r.order() - i.order();
|
|
1789
|
+
return s !== 0 ? s : r.key().localeCompare(i.key());
|
|
1618
1790
|
}), n;
|
|
1619
1791
|
}
|
|
1620
1792
|
}
|
|
1621
|
-
class
|
|
1793
|
+
class to {
|
|
1622
1794
|
channels = /* @__PURE__ */ new Map();
|
|
1623
1795
|
handlersByChannel = /* @__PURE__ */ new Map();
|
|
1624
1796
|
markerStore = /* @__PURE__ */ new Map();
|
|
@@ -1629,11 +1801,11 @@ class kr {
|
|
|
1629
1801
|
return this.channels.set(e, { key: e, contract: t, blueId: n, node: r }), this;
|
|
1630
1802
|
}
|
|
1631
1803
|
addHandler(e, t, n, r) {
|
|
1632
|
-
const
|
|
1633
|
-
if (!
|
|
1804
|
+
const i = t.channel;
|
|
1805
|
+
if (!i)
|
|
1634
1806
|
throw new Error(`Handler ${e} must declare channel`);
|
|
1635
|
-
const s = this.handlersByChannel.get(
|
|
1636
|
-
return s.push({ key: e, contract: t, blueId: n, node: r }), this.handlersByChannel.set(
|
|
1807
|
+
const s = this.handlersByChannel.get(i) ?? [];
|
|
1808
|
+
return s.push({ key: e, contract: t, blueId: n, node: r }), this.handlersByChannel.set(i, s), this;
|
|
1637
1809
|
}
|
|
1638
1810
|
setEmbedded(e) {
|
|
1639
1811
|
if (this.embeddedDeclared)
|
|
@@ -1643,12 +1815,12 @@ class kr {
|
|
|
1643
1815
|
return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
|
|
1644
1816
|
}
|
|
1645
1817
|
addMarker(e, t, n) {
|
|
1646
|
-
if (e ===
|
|
1818
|
+
if (e === D && n !== Se)
|
|
1647
1819
|
throw new Error(
|
|
1648
1820
|
"Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
|
|
1649
1821
|
);
|
|
1650
|
-
if (n ===
|
|
1651
|
-
if (e !==
|
|
1822
|
+
if (n === Se) {
|
|
1823
|
+
if (e !== D)
|
|
1652
1824
|
throw new Error(
|
|
1653
1825
|
`Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
|
|
1654
1826
|
);
|
|
@@ -1661,7 +1833,7 @@ class kr {
|
|
|
1661
1833
|
return this.markerStore.set(e, { key: e, contract: t, blueId: n }), this;
|
|
1662
1834
|
}
|
|
1663
1835
|
build() {
|
|
1664
|
-
return
|
|
1836
|
+
return W.fromComponents(
|
|
1665
1837
|
new Map(this.channels),
|
|
1666
1838
|
new Map(
|
|
1667
1839
|
Array.from(this.handlersByChannel.entries(), ([e, t]) => [
|
|
@@ -1675,18 +1847,18 @@ class kr {
|
|
|
1675
1847
|
);
|
|
1676
1848
|
}
|
|
1677
1849
|
}
|
|
1678
|
-
class
|
|
1850
|
+
class E extends Error {
|
|
1679
1851
|
constructor(e, t) {
|
|
1680
1852
|
super(e || "Processor fatal error"), this.processorError = t, this.name = "ProcessorFatalError";
|
|
1681
1853
|
}
|
|
1682
1854
|
}
|
|
1683
|
-
function
|
|
1855
|
+
function te(o, e, t) {
|
|
1684
1856
|
for (const [n, r] of t.entries())
|
|
1685
|
-
if (
|
|
1857
|
+
if (o.isTypeOfBlueId(e, n))
|
|
1686
1858
|
return r;
|
|
1687
1859
|
return null;
|
|
1688
1860
|
}
|
|
1689
|
-
class
|
|
1861
|
+
class no {
|
|
1690
1862
|
constructor(e, t, n) {
|
|
1691
1863
|
this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
|
|
1692
1864
|
}
|
|
@@ -1695,7 +1867,7 @@ class br {
|
|
|
1695
1867
|
key: t,
|
|
1696
1868
|
node: n,
|
|
1697
1869
|
processor: r,
|
|
1698
|
-
blueId:
|
|
1870
|
+
blueId: i,
|
|
1699
1871
|
scopeContracts: s
|
|
1700
1872
|
}) {
|
|
1701
1873
|
try {
|
|
@@ -1709,18 +1881,18 @@ class br {
|
|
|
1709
1881
|
handlerKey: t
|
|
1710
1882
|
}), h = s.get(u);
|
|
1711
1883
|
if (!h)
|
|
1712
|
-
throw new
|
|
1884
|
+
throw new E(
|
|
1713
1885
|
`Handler ${t} references unknown channel '${u}'`,
|
|
1714
|
-
|
|
1715
|
-
|
|
1886
|
+
C.invalidContract(
|
|
1887
|
+
i,
|
|
1716
1888
|
`Channel '${u}' is not declared in this scope`,
|
|
1717
1889
|
`/contracts/${u}`
|
|
1718
1890
|
)
|
|
1719
1891
|
);
|
|
1720
1892
|
if (!this.isRegisteredChannel(h))
|
|
1721
|
-
throw new
|
|
1893
|
+
throw new E(
|
|
1722
1894
|
`Contract '${u}' is not a channel`,
|
|
1723
|
-
|
|
1895
|
+
C.invalidContract(
|
|
1724
1896
|
h.nodeTypeBlueId,
|
|
1725
1897
|
`Contract '${u}' is not a channel`,
|
|
1726
1898
|
`/contracts/${u}`
|
|
@@ -1730,24 +1902,24 @@ class br {
|
|
|
1730
1902
|
this.setContractChannel(d, u), e.addHandler(
|
|
1731
1903
|
t,
|
|
1732
1904
|
{ ...c, channel: u },
|
|
1733
|
-
|
|
1905
|
+
i,
|
|
1734
1906
|
d
|
|
1735
1907
|
);
|
|
1736
1908
|
} catch (a) {
|
|
1737
1909
|
if (this.isZodError(a))
|
|
1738
|
-
throw new
|
|
1910
|
+
throw new E(
|
|
1739
1911
|
"Failed to parse handler contract",
|
|
1740
|
-
|
|
1741
|
-
|
|
1912
|
+
C.invalidContract(
|
|
1913
|
+
i,
|
|
1742
1914
|
"Failed to parse handler contract",
|
|
1743
1915
|
t,
|
|
1744
1916
|
a
|
|
1745
1917
|
)
|
|
1746
1918
|
);
|
|
1747
1919
|
const c = a?.message ?? "Failed to register handler contract";
|
|
1748
|
-
throw new
|
|
1920
|
+
throw new E(
|
|
1749
1921
|
c,
|
|
1750
|
-
|
|
1922
|
+
C.illegalState(c)
|
|
1751
1923
|
);
|
|
1752
1924
|
}
|
|
1753
1925
|
}
|
|
@@ -1757,28 +1929,28 @@ class br {
|
|
|
1757
1929
|
scopeContracts: n,
|
|
1758
1930
|
handlerKey: r
|
|
1759
1931
|
}) {
|
|
1760
|
-
let
|
|
1761
|
-
if (
|
|
1932
|
+
let i = typeof e.channel == "string" ? e.channel.trim() : null;
|
|
1933
|
+
if (i && i.length === 0 && (i = null), !i) {
|
|
1762
1934
|
const s = t.deriveChannel?.call(t, e, {
|
|
1763
1935
|
blue: this.blue,
|
|
1764
1936
|
scopeContracts: n
|
|
1765
1937
|
}) ?? null;
|
|
1766
1938
|
if (typeof s == "string") {
|
|
1767
1939
|
const a = s.trim();
|
|
1768
|
-
a.length > 0 && (
|
|
1940
|
+
a.length > 0 && (i = a);
|
|
1769
1941
|
}
|
|
1770
1942
|
}
|
|
1771
|
-
if (!
|
|
1772
|
-
throw new
|
|
1943
|
+
if (!i)
|
|
1944
|
+
throw new E(
|
|
1773
1945
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`,
|
|
1774
|
-
|
|
1946
|
+
C.illegalState(
|
|
1775
1947
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`
|
|
1776
1948
|
)
|
|
1777
1949
|
);
|
|
1778
|
-
return
|
|
1950
|
+
return i;
|
|
1779
1951
|
}
|
|
1780
1952
|
isRegisteredChannel(e) {
|
|
1781
|
-
return
|
|
1953
|
+
return te(this.blue, e.node, this.builtinChannelSchemas) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
|
|
1782
1954
|
}
|
|
1783
1955
|
setContractChannel(e, t) {
|
|
1784
1956
|
const r = e.getProperties()?.channel;
|
|
@@ -1789,55 +1961,55 @@ class br {
|
|
|
1789
1961
|
e.addProperty("channel", new p().setValue(t));
|
|
1790
1962
|
}
|
|
1791
1963
|
isZodError(e) {
|
|
1792
|
-
return e instanceof
|
|
1964
|
+
return e instanceof ve;
|
|
1793
1965
|
}
|
|
1794
1966
|
}
|
|
1795
|
-
class
|
|
1967
|
+
class F extends Error {
|
|
1796
1968
|
constructor(e) {
|
|
1797
1969
|
super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
|
|
1798
1970
|
}
|
|
1799
1971
|
}
|
|
1800
|
-
const
|
|
1801
|
-
function
|
|
1802
|
-
const { compositeKey: e, contract: t, scopeContracts: n, blueId: r, blue:
|
|
1972
|
+
const ro = b["Conversation/Composite Timeline Channel"];
|
|
1973
|
+
function oo(o) {
|
|
1974
|
+
const { compositeKey: e, contract: t, scopeContracts: n, blueId: r, blue: i } = o, s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), c = [], u = /* @__PURE__ */ new Map([
|
|
1803
1975
|
[e, t]
|
|
1804
|
-
]), h = (f) =>
|
|
1976
|
+
]), h = (f) => i.isTypeOfBlueId(f.node, ro), d = (f) => {
|
|
1805
1977
|
if (u.has(f))
|
|
1806
1978
|
return u.get(f) ?? null;
|
|
1807
|
-
const
|
|
1808
|
-
if (!
|
|
1979
|
+
const g = n.get(f);
|
|
1980
|
+
if (!g || !h(g))
|
|
1809
1981
|
return u.set(f, null), null;
|
|
1810
1982
|
try {
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1813
|
-
|
|
1983
|
+
const y = i.nodeToSchemaOutput(
|
|
1984
|
+
g.node,
|
|
1985
|
+
bt
|
|
1814
1986
|
);
|
|
1815
|
-
return u.set(f,
|
|
1816
|
-
} catch (
|
|
1817
|
-
if (
|
|
1818
|
-
throw new
|
|
1987
|
+
return u.set(f, y), y;
|
|
1988
|
+
} catch (y) {
|
|
1989
|
+
if (io(y))
|
|
1990
|
+
throw new E(
|
|
1819
1991
|
"Failed to parse channel contract",
|
|
1820
|
-
|
|
1821
|
-
|
|
1992
|
+
C.invalidContract(
|
|
1993
|
+
g.nodeTypeBlueId,
|
|
1822
1994
|
"Failed to parse channel contract",
|
|
1823
1995
|
`/contracts/${f}`,
|
|
1824
|
-
|
|
1996
|
+
y
|
|
1825
1997
|
)
|
|
1826
1998
|
);
|
|
1827
|
-
const
|
|
1828
|
-
throw new
|
|
1829
|
-
|
|
1830
|
-
|
|
1999
|
+
const O = y?.message ?? "Failed to parse channel contract";
|
|
2000
|
+
throw new E(
|
|
2001
|
+
O,
|
|
2002
|
+
C.illegalState(O)
|
|
1831
2003
|
);
|
|
1832
2004
|
}
|
|
1833
|
-
},
|
|
2005
|
+
}, v = (f) => {
|
|
1834
2006
|
if (a.has(f)) {
|
|
1835
|
-
const
|
|
1836
|
-
throw new
|
|
1837
|
-
`Composite channel ${e} has a cyclic reference: ${
|
|
1838
|
-
|
|
2007
|
+
const y = c.indexOf(f), _ = [...c.slice(y), f].join(" -> ");
|
|
2008
|
+
throw new E(
|
|
2009
|
+
`Composite channel ${e} has a cyclic reference: ${_}`,
|
|
2010
|
+
C.invalidContract(
|
|
1839
2011
|
r,
|
|
1840
|
-
`Composite channel '${e}' has a cyclic reference: ${
|
|
2012
|
+
`Composite channel '${e}' has a cyclic reference: ${_}`,
|
|
1841
2013
|
`/contracts/${e}`
|
|
1842
2014
|
)
|
|
1843
2015
|
);
|
|
@@ -1845,95 +2017,95 @@ function Tr(i) {
|
|
|
1845
2017
|
if (s.has(f))
|
|
1846
2018
|
return;
|
|
1847
2019
|
a.add(f), c.push(f);
|
|
1848
|
-
const
|
|
1849
|
-
if (
|
|
1850
|
-
for (const
|
|
1851
|
-
const
|
|
1852
|
-
|
|
2020
|
+
const g = d(f);
|
|
2021
|
+
if (g)
|
|
2022
|
+
for (const y of g.channels ?? []) {
|
|
2023
|
+
const O = n.get(y);
|
|
2024
|
+
O && h(O) && v(y);
|
|
1853
2025
|
}
|
|
1854
2026
|
c.pop(), a.delete(f), s.add(f);
|
|
1855
2027
|
};
|
|
1856
|
-
|
|
2028
|
+
v(e);
|
|
1857
2029
|
}
|
|
1858
|
-
function
|
|
1859
|
-
return
|
|
2030
|
+
function io(o) {
|
|
2031
|
+
return o instanceof ve;
|
|
1860
2032
|
}
|
|
1861
|
-
const
|
|
2033
|
+
const so = S["Core/Document Update Channel"], ao = S["Core/Embedded Node Channel"], co = S["Core/Lifecycle Event Channel"], lo = S["Core/Triggered Event Channel"], Ge = S["Core/Process Embedded"], uo = S["Core/Processing Initialized Marker"], ho = S["Core/Processing Terminated Marker"], po = S["Core/Channel Event Checkpoint"], fo = q["MyOS/Document Anchors"], mo = q["MyOS/Document Links"], go = q["MyOS/MyOS Participants Orchestration"], Eo = q["MyOS/MyOS Session Interaction"], yo = q["MyOS/MyOS Worker Agency"], Co = b["Conversation/Composite Timeline Channel"], pe = /* @__PURE__ */ new Map([
|
|
1862
2034
|
[
|
|
1863
|
-
|
|
1864
|
-
|
|
2035
|
+
so,
|
|
2036
|
+
Tn
|
|
1865
2037
|
],
|
|
1866
2038
|
[
|
|
1867
|
-
|
|
1868
|
-
|
|
2039
|
+
ao,
|
|
2040
|
+
Rn
|
|
1869
2041
|
],
|
|
1870
2042
|
[
|
|
1871
|
-
|
|
1872
|
-
|
|
2043
|
+
co,
|
|
2044
|
+
On
|
|
1873
2045
|
],
|
|
1874
2046
|
[
|
|
1875
|
-
|
|
1876
|
-
|
|
2047
|
+
lo,
|
|
2048
|
+
An
|
|
1877
2049
|
]
|
|
1878
|
-
]),
|
|
2050
|
+
]), So = /* @__PURE__ */ new Map([
|
|
1879
2051
|
[
|
|
1880
|
-
|
|
1881
|
-
|
|
2052
|
+
uo,
|
|
2053
|
+
Wn
|
|
1882
2054
|
],
|
|
1883
2055
|
[
|
|
1884
|
-
|
|
1885
|
-
|
|
2056
|
+
ho,
|
|
2057
|
+
Jn
|
|
1886
2058
|
],
|
|
1887
2059
|
[
|
|
1888
|
-
|
|
1889
|
-
|
|
2060
|
+
po,
|
|
2061
|
+
Hn
|
|
1890
2062
|
],
|
|
1891
2063
|
[
|
|
1892
|
-
|
|
1893
|
-
|
|
2064
|
+
fo,
|
|
2065
|
+
Xn
|
|
1894
2066
|
],
|
|
1895
2067
|
[
|
|
1896
|
-
|
|
1897
|
-
|
|
2068
|
+
mo,
|
|
2069
|
+
nr
|
|
1898
2070
|
],
|
|
1899
2071
|
[
|
|
1900
|
-
|
|
1901
|
-
|
|
2072
|
+
go,
|
|
2073
|
+
or
|
|
1902
2074
|
],
|
|
1903
2075
|
[
|
|
1904
|
-
|
|
1905
|
-
|
|
2076
|
+
Eo,
|
|
2077
|
+
sr
|
|
1906
2078
|
],
|
|
1907
2079
|
[
|
|
1908
|
-
|
|
1909
|
-
|
|
2080
|
+
yo,
|
|
2081
|
+
cr
|
|
1910
2082
|
]
|
|
1911
2083
|
]);
|
|
1912
|
-
class
|
|
2084
|
+
class vo {
|
|
1913
2085
|
constructor(e, t) {
|
|
1914
|
-
this.registry = e, this.blue = t, this.handlerRegistration = new
|
|
2086
|
+
this.registry = e, this.blue = t, this.handlerRegistration = new no(
|
|
1915
2087
|
this.blue,
|
|
1916
2088
|
this.registry,
|
|
1917
|
-
|
|
2089
|
+
pe
|
|
1918
2090
|
);
|
|
1919
2091
|
}
|
|
1920
2092
|
handlerRegistration;
|
|
1921
2093
|
load(e, t) {
|
|
1922
2094
|
try {
|
|
1923
|
-
const n =
|
|
2095
|
+
const n = W.builder(), r = e.getContracts();
|
|
1924
2096
|
if (!r)
|
|
1925
2097
|
return n.build();
|
|
1926
|
-
const
|
|
2098
|
+
const i = this.buildScopeContractsIndex(r);
|
|
1927
2099
|
for (const [s, a] of Object.entries(r))
|
|
1928
|
-
a && this.processContract(n, s, a,
|
|
2100
|
+
a && this.processContract(n, s, a, i);
|
|
1929
2101
|
return n.build();
|
|
1930
2102
|
} catch (n) {
|
|
1931
|
-
if (n instanceof
|
|
2103
|
+
if (n instanceof F || n instanceof E)
|
|
1932
2104
|
throw n;
|
|
1933
2105
|
const r = n?.message ?? "Failed to load contracts";
|
|
1934
|
-
throw new
|
|
2106
|
+
throw new E(
|
|
1935
2107
|
`Failed to load contracts for scope ${t}: ${r}`,
|
|
1936
|
-
|
|
2108
|
+
C.runtimeFatal(
|
|
1937
2109
|
`Failed to load contracts for scope ${t}`,
|
|
1938
2110
|
n
|
|
1939
2111
|
)
|
|
@@ -1941,26 +2113,33 @@ class Hr {
|
|
|
1941
2113
|
}
|
|
1942
2114
|
}
|
|
1943
2115
|
processContract(e, t, n, r) {
|
|
1944
|
-
const
|
|
1945
|
-
if (!
|
|
2116
|
+
const i = n.getType()?.getBlueId();
|
|
2117
|
+
if (!i)
|
|
1946
2118
|
return;
|
|
1947
|
-
if (this.blue.isTypeOfBlueId(n,
|
|
2119
|
+
if (this.blue.isTypeOfBlueId(n, Ge)) {
|
|
1948
2120
|
this.handleProcessEmbedded(e, t, n);
|
|
1949
2121
|
return;
|
|
1950
2122
|
}
|
|
1951
|
-
const s =
|
|
2123
|
+
const s = te(
|
|
1952
2124
|
this.blue,
|
|
1953
2125
|
n,
|
|
1954
|
-
|
|
2126
|
+
So
|
|
1955
2127
|
);
|
|
1956
2128
|
if (s) {
|
|
1957
|
-
this.handleMarker(
|
|
2129
|
+
this.handleMarker(
|
|
2130
|
+
e,
|
|
2131
|
+
t,
|
|
2132
|
+
n,
|
|
2133
|
+
s,
|
|
2134
|
+
i,
|
|
2135
|
+
r
|
|
2136
|
+
);
|
|
1958
2137
|
return;
|
|
1959
2138
|
}
|
|
1960
|
-
const a =
|
|
2139
|
+
const a = te(
|
|
1961
2140
|
this.blue,
|
|
1962
2141
|
n,
|
|
1963
|
-
|
|
2142
|
+
pe
|
|
1964
2143
|
);
|
|
1965
2144
|
if (a) {
|
|
1966
2145
|
this.handleChannel(
|
|
@@ -1968,7 +2147,7 @@ class Hr {
|
|
|
1968
2147
|
t,
|
|
1969
2148
|
n,
|
|
1970
2149
|
a,
|
|
1971
|
-
|
|
2150
|
+
i,
|
|
1972
2151
|
r
|
|
1973
2152
|
);
|
|
1974
2153
|
return;
|
|
@@ -1983,7 +2162,7 @@ class Hr {
|
|
|
1983
2162
|
t,
|
|
1984
2163
|
n,
|
|
1985
2164
|
c.schema,
|
|
1986
|
-
|
|
2165
|
+
i,
|
|
1987
2166
|
r
|
|
1988
2167
|
);
|
|
1989
2168
|
return;
|
|
@@ -1998,7 +2177,7 @@ class Hr {
|
|
|
1998
2177
|
key: t,
|
|
1999
2178
|
node: n,
|
|
2000
2179
|
processor: u,
|
|
2001
|
-
blueId:
|
|
2180
|
+
blueId: i,
|
|
2002
2181
|
scopeContracts: r
|
|
2003
2182
|
});
|
|
2004
2183
|
return;
|
|
@@ -2010,100 +2189,101 @@ class Hr {
|
|
|
2010
2189
|
t,
|
|
2011
2190
|
n,
|
|
2012
2191
|
h.schema,
|
|
2013
|
-
|
|
2192
|
+
i,
|
|
2193
|
+
r
|
|
2014
2194
|
);
|
|
2015
2195
|
return;
|
|
2016
2196
|
}
|
|
2017
|
-
throw
|
|
2197
|
+
throw ht(i) ? new E(
|
|
2018
2198
|
"Built-in processor-managed channel is missing schema registration",
|
|
2019
|
-
|
|
2020
|
-
|
|
2199
|
+
C.invalidContract(
|
|
2200
|
+
i,
|
|
2021
2201
|
"Built-in processor-managed channel is missing schema registration",
|
|
2022
2202
|
t
|
|
2023
2203
|
)
|
|
2024
|
-
) : new
|
|
2204
|
+
) : new F(`Unsupported contract type: ${i}`);
|
|
2025
2205
|
}
|
|
2026
2206
|
handleProcessEmbedded(e, t, n) {
|
|
2027
2207
|
try {
|
|
2028
2208
|
const r = this.blue.nodeToSchemaOutput(
|
|
2029
2209
|
n,
|
|
2030
|
-
|
|
2210
|
+
Gn
|
|
2031
2211
|
);
|
|
2032
2212
|
e.setEmbedded(r);
|
|
2033
2213
|
} catch (r) {
|
|
2034
|
-
throw
|
|
2214
|
+
throw fe(r) ? new E(
|
|
2035
2215
|
"Failed to parse ProcessEmbedded marker",
|
|
2036
|
-
|
|
2037
|
-
|
|
2216
|
+
C.invalidContract(
|
|
2217
|
+
Ge,
|
|
2038
2218
|
"Failed to parse ProcessEmbedded marker",
|
|
2039
2219
|
t,
|
|
2040
2220
|
r
|
|
2041
2221
|
)
|
|
2042
|
-
) : new
|
|
2222
|
+
) : new E(
|
|
2043
2223
|
r?.message ?? "Failed to register ProcessEmbedded marker",
|
|
2044
|
-
|
|
2224
|
+
C.illegalState(
|
|
2045
2225
|
r?.message ?? "Failed to register ProcessEmbedded marker"
|
|
2046
2226
|
)
|
|
2047
2227
|
);
|
|
2048
2228
|
}
|
|
2049
2229
|
}
|
|
2050
|
-
handleChannel(e, t, n, r,
|
|
2230
|
+
handleChannel(e, t, n, r, i, s) {
|
|
2051
2231
|
try {
|
|
2052
2232
|
const a = this.blue.nodeToSchemaOutput(
|
|
2053
2233
|
n,
|
|
2054
2234
|
r
|
|
2055
2235
|
);
|
|
2056
|
-
this.blue.isTypeOfBlueId(n,
|
|
2236
|
+
this.blue.isTypeOfBlueId(n, Co) && this.validateCompositeChannel(
|
|
2057
2237
|
t,
|
|
2058
2238
|
a,
|
|
2059
2239
|
s,
|
|
2060
|
-
|
|
2061
|
-
), e.addChannel(t, a,
|
|
2240
|
+
i
|
|
2241
|
+
), e.addChannel(t, a, i, n);
|
|
2062
2242
|
} catch (a) {
|
|
2063
|
-
if (a instanceof
|
|
2243
|
+
if (a instanceof E || a instanceof F)
|
|
2064
2244
|
throw a;
|
|
2065
|
-
if (
|
|
2066
|
-
throw new
|
|
2245
|
+
if (fe(a))
|
|
2246
|
+
throw new E(
|
|
2067
2247
|
"Failed to parse channel contract",
|
|
2068
|
-
|
|
2069
|
-
|
|
2248
|
+
C.invalidContract(
|
|
2249
|
+
i,
|
|
2070
2250
|
"Failed to parse channel contract",
|
|
2071
2251
|
t,
|
|
2072
2252
|
a
|
|
2073
2253
|
)
|
|
2074
2254
|
);
|
|
2075
2255
|
const c = a?.message ?? "Failed to register channel contract";
|
|
2076
|
-
throw new
|
|
2256
|
+
throw new E(
|
|
2077
2257
|
c,
|
|
2078
|
-
|
|
2258
|
+
C.illegalState(c)
|
|
2079
2259
|
);
|
|
2080
2260
|
}
|
|
2081
2261
|
}
|
|
2082
2262
|
validateCompositeChannel(e, t, n, r) {
|
|
2083
|
-
const
|
|
2084
|
-
if (
|
|
2085
|
-
for (const s of
|
|
2263
|
+
const i = t.channels ?? [];
|
|
2264
|
+
if (i.length !== 0) {
|
|
2265
|
+
for (const s of i) {
|
|
2086
2266
|
const a = n.get(s);
|
|
2087
2267
|
if (!a)
|
|
2088
|
-
throw new
|
|
2268
|
+
throw new E(
|
|
2089
2269
|
`Composite channel ${e} references unknown channel '${s}'`,
|
|
2090
|
-
|
|
2270
|
+
C.invalidContract(
|
|
2091
2271
|
r,
|
|
2092
2272
|
`Channel '${s}' is not declared in this scope`,
|
|
2093
2273
|
`/contracts/${s}`
|
|
2094
2274
|
)
|
|
2095
2275
|
);
|
|
2096
2276
|
if (!this.isRegisteredChannel(a))
|
|
2097
|
-
throw new
|
|
2277
|
+
throw new E(
|
|
2098
2278
|
`Contract '${s}' is not a channel`,
|
|
2099
|
-
|
|
2279
|
+
C.invalidContract(
|
|
2100
2280
|
a.nodeTypeBlueId,
|
|
2101
2281
|
`Contract '${s}' is not a channel`,
|
|
2102
2282
|
`/contracts/${s}`
|
|
2103
2283
|
)
|
|
2104
2284
|
);
|
|
2105
2285
|
}
|
|
2106
|
-
|
|
2286
|
+
oo({
|
|
2107
2287
|
compositeKey: e,
|
|
2108
2288
|
contract: t,
|
|
2109
2289
|
scopeContracts: n,
|
|
@@ -2113,67 +2293,92 @@ class Hr {
|
|
|
2113
2293
|
}
|
|
2114
2294
|
}
|
|
2115
2295
|
isRegisteredChannel(e) {
|
|
2116
|
-
return
|
|
2296
|
+
return te(this.blue, e.node, pe) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
|
|
2117
2297
|
}
|
|
2118
|
-
handleMarker(e, t, n, r,
|
|
2298
|
+
handleMarker(e, t, n, r, i, s) {
|
|
2119
2299
|
try {
|
|
2120
|
-
const
|
|
2300
|
+
const a = b["Conversation/Actor Policy"];
|
|
2301
|
+
this.blue.isTypeOfBlueId(n, a) && (this.assertSingleActorPolicyMarker(t, s, i), zn(n));
|
|
2302
|
+
const c = this.blue.nodeToSchemaOutput(
|
|
2121
2303
|
n,
|
|
2122
2304
|
r
|
|
2123
2305
|
);
|
|
2124
|
-
e.addMarker(t,
|
|
2125
|
-
} catch (
|
|
2126
|
-
if (
|
|
2127
|
-
throw
|
|
2306
|
+
e.addMarker(t, c, i);
|
|
2307
|
+
} catch (a) {
|
|
2308
|
+
if (a instanceof E || a instanceof F)
|
|
2309
|
+
throw a;
|
|
2310
|
+
if (a instanceof Pt)
|
|
2311
|
+
throw new E(
|
|
2312
|
+
a.message,
|
|
2313
|
+
C.invalidContract(i, a.message, t, a)
|
|
2314
|
+
);
|
|
2315
|
+
if (fe(a))
|
|
2316
|
+
throw new E(
|
|
2128
2317
|
"Failed to parse marker contract",
|
|
2129
|
-
|
|
2130
|
-
|
|
2318
|
+
C.invalidContract(
|
|
2319
|
+
i,
|
|
2131
2320
|
"Failed to parse marker contract",
|
|
2132
2321
|
t,
|
|
2133
|
-
|
|
2322
|
+
a
|
|
2134
2323
|
)
|
|
2135
2324
|
);
|
|
2136
|
-
const
|
|
2137
|
-
throw new
|
|
2138
|
-
|
|
2139
|
-
|
|
2325
|
+
const c = a?.message ?? "Failed to register marker contract";
|
|
2326
|
+
throw new E(
|
|
2327
|
+
c,
|
|
2328
|
+
C.illegalState(c)
|
|
2140
2329
|
);
|
|
2141
2330
|
}
|
|
2142
2331
|
}
|
|
2332
|
+
assertSingleActorPolicyMarker(e, t, n) {
|
|
2333
|
+
const r = b["Conversation/Actor Policy"], i = Array.from(t.entries()).find(
|
|
2334
|
+
([a, c]) => a !== e && this.blue.isTypeOfBlueId(c.node, r)
|
|
2335
|
+
);
|
|
2336
|
+
if (!i)
|
|
2337
|
+
return;
|
|
2338
|
+
const [s] = i;
|
|
2339
|
+
throw new E(
|
|
2340
|
+
`Multiple Actor Policy markers declared in the same scope: '${e}' conflicts with '${s}'`,
|
|
2341
|
+
C.invalidContract(
|
|
2342
|
+
n,
|
|
2343
|
+
"Multiple Actor Policy markers declared in the same scope",
|
|
2344
|
+
`/contracts/${e}`
|
|
2345
|
+
)
|
|
2346
|
+
);
|
|
2347
|
+
}
|
|
2143
2348
|
buildScopeContractsIndex(e) {
|
|
2144
2349
|
const t = /* @__PURE__ */ new Map();
|
|
2145
2350
|
for (const [n, r] of Object.entries(e)) {
|
|
2146
2351
|
if (!r)
|
|
2147
2352
|
continue;
|
|
2148
|
-
const
|
|
2149
|
-
typeof
|
|
2353
|
+
const i = r.getType()?.getBlueId();
|
|
2354
|
+
typeof i == "string" && i.trim().length > 0 && t.set(n, { node: r, nodeTypeBlueId: i });
|
|
2150
2355
|
}
|
|
2151
2356
|
return t;
|
|
2152
2357
|
}
|
|
2153
2358
|
}
|
|
2154
|
-
function
|
|
2155
|
-
return
|
|
2359
|
+
function fe(o) {
|
|
2360
|
+
return o instanceof ve;
|
|
2156
2361
|
}
|
|
2157
|
-
const
|
|
2158
|
-
function
|
|
2159
|
-
return
|
|
2160
|
-
type: { blueId:
|
|
2362
|
+
const wo = S["Core/Channel Event Checkpoint"];
|
|
2363
|
+
function bo(o) {
|
|
2364
|
+
return o.jsonValueToNode({
|
|
2365
|
+
type: { blueId: wo },
|
|
2161
2366
|
lastEvents: {},
|
|
2162
2367
|
lastSignatures: {}
|
|
2163
2368
|
});
|
|
2164
2369
|
}
|
|
2165
|
-
function
|
|
2370
|
+
function Io() {
|
|
2166
2371
|
return {
|
|
2167
2372
|
lastEvents: {},
|
|
2168
2373
|
lastSignatures: {}
|
|
2169
2374
|
};
|
|
2170
2375
|
}
|
|
2171
|
-
function
|
|
2172
|
-
return
|
|
2376
|
+
function je(o) {
|
|
2377
|
+
return o != null && Object.prototype.hasOwnProperty.call(o, "lastEvents") && Object.prototype.hasOwnProperty.call(o, "lastSignatures");
|
|
2173
2378
|
}
|
|
2174
|
-
class
|
|
2175
|
-
constructor(e, t, n, r,
|
|
2176
|
-
this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature =
|
|
2379
|
+
class ko {
|
|
2380
|
+
constructor(e, t, n, r, i) {
|
|
2381
|
+
this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = i;
|
|
2177
2382
|
}
|
|
2178
2383
|
lastEventNode;
|
|
2179
2384
|
lastEventSignature;
|
|
@@ -2181,28 +2386,28 @@ class Gr {
|
|
|
2181
2386
|
return e != null && e === this.lastEventSignature;
|
|
2182
2387
|
}
|
|
2183
2388
|
}
|
|
2184
|
-
class
|
|
2389
|
+
class To {
|
|
2185
2390
|
constructor(e, t) {
|
|
2186
2391
|
this.runtime = e, this.signatureFn = t;
|
|
2187
2392
|
}
|
|
2188
2393
|
ensureCheckpointMarker(e, t) {
|
|
2189
|
-
const n = t.marker(
|
|
2394
|
+
const n = t.marker(D), r = k(e, pt);
|
|
2190
2395
|
if (!n) {
|
|
2191
|
-
const
|
|
2192
|
-
this.runtime.directWrite(r,
|
|
2396
|
+
const i = bo(this.runtime.blue());
|
|
2397
|
+
this.runtime.directWrite(r, i), t.registerCheckpointMarker(Io());
|
|
2193
2398
|
return;
|
|
2194
2399
|
}
|
|
2195
|
-
if (!
|
|
2400
|
+
if (!je(n))
|
|
2196
2401
|
throw new Error(
|
|
2197
2402
|
`Reserved key 'checkpoint' must contain a Channel Event Checkpoint at ${r}`
|
|
2198
2403
|
);
|
|
2199
2404
|
}
|
|
2200
2405
|
findCheckpoint(e, t) {
|
|
2201
2406
|
for (const [n, r] of e.markerEntries()) {
|
|
2202
|
-
if (!
|
|
2407
|
+
if (!je(r))
|
|
2203
2408
|
continue;
|
|
2204
2409
|
const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
|
|
2205
|
-
return new
|
|
2410
|
+
return new ko(
|
|
2206
2411
|
n,
|
|
2207
2412
|
r,
|
|
2208
2413
|
t,
|
|
@@ -2215,22 +2420,22 @@ class qr {
|
|
|
2215
2420
|
isDuplicate(e, t) {
|
|
2216
2421
|
return e != null && e.matches(t);
|
|
2217
2422
|
}
|
|
2218
|
-
persist(e, t, n, r,
|
|
2423
|
+
persist(e, t, n, r, i) {
|
|
2219
2424
|
if (!n)
|
|
2220
2425
|
return;
|
|
2221
|
-
const s =
|
|
2426
|
+
const s = k(
|
|
2222
2427
|
e,
|
|
2223
|
-
|
|
2224
|
-
), a =
|
|
2428
|
+
gt(n.markerKey, n.channelKey)
|
|
2429
|
+
), a = i?.clone() ?? null;
|
|
2225
2430
|
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;
|
|
2226
|
-
const c =
|
|
2431
|
+
const c = k(
|
|
2227
2432
|
e,
|
|
2228
|
-
|
|
2433
|
+
Et(n.markerKey, n.channelKey)
|
|
2229
2434
|
), u = r == null ? null : new p().setValue(r);
|
|
2230
2435
|
this.runtime.directWrite(c, u), n.checkpoint.lastSignatures || (n.checkpoint.lastSignatures = {}), r == null ? delete n.checkpoint.lastSignatures[n.channelKey] : n.checkpoint.lastSignatures[n.channelKey] = r, n.lastEventSignature = r ?? null;
|
|
2231
2436
|
}
|
|
2232
2437
|
}
|
|
2233
|
-
class
|
|
2438
|
+
class Po {
|
|
2234
2439
|
constructor(e, t, n) {
|
|
2235
2440
|
this.runtime = e, this.checkpointManager = t, this.deps = n;
|
|
2236
2441
|
}
|
|
@@ -2238,7 +2443,7 @@ class jr {
|
|
|
2238
2443
|
if (this.deps.isScopeInactive(e))
|
|
2239
2444
|
return;
|
|
2240
2445
|
this.runtime.gasMeter().chargeChannelMatchAttempt();
|
|
2241
|
-
const
|
|
2446
|
+
const i = r, s = await this.deps.evaluateChannel(
|
|
2242
2447
|
n,
|
|
2243
2448
|
t,
|
|
2244
2449
|
e,
|
|
@@ -2255,12 +2460,12 @@ class jr {
|
|
|
2255
2460
|
const c = this.checkpointManager.findCheckpoint(
|
|
2256
2461
|
t,
|
|
2257
2462
|
n.key()
|
|
2258
|
-
), u = s.eventId ?? this.deps.canonicalSignature(
|
|
2463
|
+
), u = s.eventId ?? this.deps.canonicalSignature(i);
|
|
2259
2464
|
this.checkpointManager.isDuplicate(c, u) || !await this.shouldProcessRelativeToCheckpoint(
|
|
2260
2465
|
e,
|
|
2261
2466
|
t,
|
|
2262
2467
|
n,
|
|
2263
|
-
|
|
2468
|
+
i,
|
|
2264
2469
|
c
|
|
2265
2470
|
) || (await this.runHandlers(
|
|
2266
2471
|
e,
|
|
@@ -2273,11 +2478,11 @@ class jr {
|
|
|
2273
2478
|
t,
|
|
2274
2479
|
c,
|
|
2275
2480
|
u ?? null,
|
|
2276
|
-
|
|
2481
|
+
i
|
|
2277
2482
|
));
|
|
2278
2483
|
}
|
|
2279
|
-
async runDeliveries(e, t, n, r,
|
|
2280
|
-
const s =
|
|
2484
|
+
async runDeliveries(e, t, n, r, i) {
|
|
2485
|
+
const s = i.deliveries ?? [];
|
|
2281
2486
|
if (s.length === 0)
|
|
2282
2487
|
return;
|
|
2283
2488
|
this.checkpointManager.ensureCheckpointMarker(e, t);
|
|
@@ -2314,22 +2519,22 @@ class jr {
|
|
|
2314
2519
|
}
|
|
2315
2520
|
}
|
|
2316
2521
|
}
|
|
2317
|
-
async runHandlers(e, t, n, r,
|
|
2522
|
+
async runHandlers(e, t, n, r, i) {
|
|
2318
2523
|
const s = t.handlersFor(n);
|
|
2319
2524
|
if (s.length !== 0)
|
|
2320
2525
|
for (const a of s) {
|
|
2321
|
-
if (!
|
|
2526
|
+
if (!i && this.deps.isScopeInactive(e))
|
|
2322
2527
|
break;
|
|
2323
2528
|
try {
|
|
2324
2529
|
const c = this.deps.createContext(
|
|
2325
2530
|
e,
|
|
2326
2531
|
t,
|
|
2327
2532
|
r,
|
|
2328
|
-
|
|
2533
|
+
i
|
|
2329
2534
|
);
|
|
2330
2535
|
if (!await this.deps.shouldRunHandler(a, c))
|
|
2331
2536
|
continue;
|
|
2332
|
-
if (this.runtime.gasMeter().chargeHandlerOverhead(), await this.deps.executeHandler(a, c), !
|
|
2537
|
+
if (this.runtime.gasMeter().chargeHandlerOverhead(), await this.deps.executeHandler(a, c), !i && this.deps.isScopeInactive(e))
|
|
2333
2538
|
break;
|
|
2334
2539
|
} catch (c) {
|
|
2335
2540
|
await this.deps.handleHandlerError(e, t, c);
|
|
@@ -2337,8 +2542,8 @@ class jr {
|
|
|
2337
2542
|
}
|
|
2338
2543
|
}
|
|
2339
2544
|
}
|
|
2340
|
-
async shouldProcessRelativeToCheckpoint(e, t, n, r,
|
|
2341
|
-
if (!
|
|
2545
|
+
async shouldProcessRelativeToCheckpoint(e, t, n, r, i) {
|
|
2546
|
+
if (!i?.lastEventNode)
|
|
2342
2547
|
return !0;
|
|
2343
2548
|
const s = this.deps.channelProcessorFor(n.node());
|
|
2344
2549
|
if (!s || typeof s.isNewerEvent != "function")
|
|
@@ -2353,25 +2558,25 @@ class jr {
|
|
|
2353
2558
|
return await s.isNewerEvent(
|
|
2354
2559
|
n.contract(),
|
|
2355
2560
|
a,
|
|
2356
|
-
|
|
2561
|
+
i.lastEventNode.clone()
|
|
2357
2562
|
);
|
|
2358
2563
|
}
|
|
2359
2564
|
}
|
|
2360
|
-
function
|
|
2361
|
-
return e.isResolved() ?
|
|
2565
|
+
function Ro(o, e) {
|
|
2566
|
+
return e.isResolved() ? o.createResolvedNode(e) : o.resolve(e);
|
|
2362
2567
|
}
|
|
2363
|
-
class
|
|
2568
|
+
class K extends E {
|
|
2364
2569
|
constructor(e) {
|
|
2365
|
-
super(e,
|
|
2570
|
+
super(e, C.illegalState(e)), this.name = "IllegalStateException";
|
|
2366
2571
|
}
|
|
2367
2572
|
}
|
|
2368
|
-
class
|
|
2573
|
+
class V extends Error {
|
|
2369
2574
|
constructor(e) {
|
|
2370
2575
|
super(e), this.name = "BoundaryViolationException";
|
|
2371
2576
|
}
|
|
2372
2577
|
}
|
|
2373
|
-
const
|
|
2374
|
-
class
|
|
2578
|
+
const Mo = S["Core/Document Update Channel"], Oo = S["Core/Embedded Node Channel"], No = S["Core/Triggered Event Channel"], Ao = S["Core/Lifecycle Event Channel"], Je = S["Core/Processing Initialized Marker"], Bo = S["Core/Document Processing Initiated"];
|
|
2579
|
+
class Do {
|
|
2375
2580
|
runtime;
|
|
2376
2581
|
contractLoader;
|
|
2377
2582
|
channelRunner;
|
|
@@ -2385,25 +2590,25 @@ class ti {
|
|
|
2385
2590
|
this.runtime = e.runtime, this.contractLoader = e.contractLoader, this.channelRunner = e.channelRunner, this.bundles = e.bundles, this.hooks = e.hooks, this.blueId = e.blueId, this.nodeAt = e.nodeAt, this.createDocumentUpdateEvent = e.createDocumentUpdateEvent, this.matchesDocumentUpdate = e.matchesDocumentUpdate;
|
|
2386
2591
|
}
|
|
2387
2592
|
async initializeScope(e, t) {
|
|
2388
|
-
const n =
|
|
2389
|
-
let
|
|
2593
|
+
const n = w(e), r = /* @__PURE__ */ new Set();
|
|
2594
|
+
let i = null, s = null;
|
|
2390
2595
|
for (t && this.runtime.gasMeter().chargeScopeEntry(n); ; ) {
|
|
2391
2596
|
const d = this.nodeAt(n);
|
|
2392
2597
|
if (!d)
|
|
2393
2598
|
return;
|
|
2394
|
-
s || (s = d.clone()),
|
|
2395
|
-
const
|
|
2396
|
-
if (!
|
|
2599
|
+
s || (s = d.clone()), i = this.loadBundle(d, n), this.bundles.set(n, i);
|
|
2600
|
+
const v = i.embeddedPaths().find((y) => !r.has(y)) ?? null;
|
|
2601
|
+
if (!v)
|
|
2397
2602
|
break;
|
|
2398
|
-
r.add(
|
|
2399
|
-
const f =
|
|
2603
|
+
r.add(v);
|
|
2604
|
+
const f = k(n, v);
|
|
2400
2605
|
this.nodeAt(f) && await this.initializeScope(f, !0);
|
|
2401
2606
|
}
|
|
2402
|
-
if (!
|
|
2607
|
+
if (!i)
|
|
2403
2608
|
return;
|
|
2404
2609
|
const a = this.hasInitializationMarker(n);
|
|
2405
|
-
if (!a &&
|
|
2406
|
-
throw new
|
|
2610
|
+
if (!a && i.hasCheckpoint())
|
|
2611
|
+
throw new K(
|
|
2407
2612
|
`Reserved key 'checkpoint' must not appear before initialization at scope ${n}`
|
|
2408
2613
|
);
|
|
2409
2614
|
if (a)
|
|
@@ -2411,42 +2616,42 @@ class ti {
|
|
|
2411
2616
|
this.runtime.gasMeter().chargeInitialization();
|
|
2412
2617
|
const c = this.blueId(s ?? new p()), u = this.createLifecycleEvent(c), h = this.hooks.createContext(
|
|
2413
2618
|
n,
|
|
2414
|
-
|
|
2619
|
+
i,
|
|
2415
2620
|
u,
|
|
2416
2621
|
!1,
|
|
2417
2622
|
!0
|
|
2418
2623
|
);
|
|
2419
|
-
await this.deliverLifecycle(n,
|
|
2624
|
+
await this.deliverLifecycle(n, i, u, !0), await this.addInitializationMarker(h, c);
|
|
2420
2625
|
}
|
|
2421
2626
|
loadBundles(e) {
|
|
2422
|
-
const t =
|
|
2627
|
+
const t = w(e);
|
|
2423
2628
|
if (this.bundles.has(t))
|
|
2424
2629
|
return;
|
|
2425
|
-
const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) :
|
|
2630
|
+
const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : W.empty();
|
|
2426
2631
|
this.bundles.set(t, r);
|
|
2427
|
-
for (const
|
|
2428
|
-
const s =
|
|
2632
|
+
for (const i of r.embeddedPaths()) {
|
|
2633
|
+
const s = k(t, i);
|
|
2429
2634
|
this.loadBundles(s);
|
|
2430
2635
|
}
|
|
2431
2636
|
}
|
|
2432
2637
|
async processExternalEvent(e, t) {
|
|
2433
|
-
const n =
|
|
2638
|
+
const n = Ro(this.runtime.blue(), t);
|
|
2434
2639
|
await this.processPreparedExternalEvent(e, n);
|
|
2435
2640
|
}
|
|
2436
2641
|
async processPreparedExternalEvent(e, t) {
|
|
2437
|
-
const n =
|
|
2642
|
+
const n = w(e);
|
|
2438
2643
|
if (this.hooks.isScopeInactive(n))
|
|
2439
2644
|
return;
|
|
2440
2645
|
this.runtime.gasMeter().chargeScopeEntry(n);
|
|
2441
2646
|
const r = await this.processEmbeddedChildren(n, t);
|
|
2442
2647
|
if (!r)
|
|
2443
2648
|
return;
|
|
2444
|
-
const
|
|
2445
|
-
if (
|
|
2649
|
+
const i = r.channelsOfType();
|
|
2650
|
+
if (i.length === 0) {
|
|
2446
2651
|
this.finalizeScope(n, r);
|
|
2447
2652
|
return;
|
|
2448
2653
|
}
|
|
2449
|
-
for (const s of
|
|
2654
|
+
for (const s of i) {
|
|
2450
2655
|
if (this.hooks.isScopeInactive(n))
|
|
2451
2656
|
break;
|
|
2452
2657
|
this.isProcessorManagedChannel(s) || await this.channelRunner.runExternalChannel(
|
|
@@ -2467,13 +2672,13 @@ class ti {
|
|
|
2467
2672
|
n,
|
|
2468
2673
|
r
|
|
2469
2674
|
);
|
|
2470
|
-
} catch (
|
|
2471
|
-
if (
|
|
2472
|
-
const s = this.hooks.fatalReason(
|
|
2675
|
+
} catch (i) {
|
|
2676
|
+
if (i instanceof V) {
|
|
2677
|
+
const s = this.hooks.fatalReason(i, "Boundary violation");
|
|
2473
2678
|
await this.hooks.enterFatalTermination(e, t, s);
|
|
2474
2679
|
return;
|
|
2475
2680
|
}
|
|
2476
|
-
throw
|
|
2681
|
+
throw i;
|
|
2477
2682
|
}
|
|
2478
2683
|
try {
|
|
2479
2684
|
switch (n.op) {
|
|
@@ -2487,24 +2692,24 @@ class ti {
|
|
|
2487
2692
|
default:
|
|
2488
2693
|
break;
|
|
2489
2694
|
}
|
|
2490
|
-
const
|
|
2491
|
-
if (!
|
|
2695
|
+
const i = this.runtime.applyPatch(e, n);
|
|
2696
|
+
if (!i)
|
|
2492
2697
|
return;
|
|
2493
|
-
await this.markCutOffChildrenIfNeeded(e, t,
|
|
2494
|
-
for (const s of
|
|
2698
|
+
await this.markCutOffChildrenIfNeeded(e, t, i), this.runtime.gasMeter().chargeCascadeRouting(i.cascadeScopes.length);
|
|
2699
|
+
for (const s of i.cascadeScopes) {
|
|
2495
2700
|
const a = this.bundles.get(s);
|
|
2496
2701
|
if (!a || this.hooks.isScopeInactive(s))
|
|
2497
2702
|
continue;
|
|
2498
|
-
const c = this.createDocumentUpdateEvent(
|
|
2703
|
+
const c = this.createDocumentUpdateEvent(i, s), u = this.channelsMatching(
|
|
2499
2704
|
a,
|
|
2500
|
-
|
|
2705
|
+
Mo
|
|
2501
2706
|
);
|
|
2502
2707
|
for (const h of u) {
|
|
2503
2708
|
const d = h.contract();
|
|
2504
2709
|
if (this.matchesDocumentUpdate(
|
|
2505
2710
|
s,
|
|
2506
2711
|
d.path ?? null,
|
|
2507
|
-
|
|
2712
|
+
i.path
|
|
2508
2713
|
) && (await this.channelRunner.runHandlers(
|
|
2509
2714
|
s,
|
|
2510
2715
|
a,
|
|
@@ -2515,29 +2720,29 @@ class ti {
|
|
|
2515
2720
|
break;
|
|
2516
2721
|
}
|
|
2517
2722
|
}
|
|
2518
|
-
} catch (
|
|
2519
|
-
if (
|
|
2520
|
-
const s = this.hooks.fatalReason(
|
|
2723
|
+
} catch (i) {
|
|
2724
|
+
if (i instanceof V) {
|
|
2725
|
+
const s = this.hooks.fatalReason(i, "Boundary violation");
|
|
2521
2726
|
await this.hooks.enterFatalTermination(e, t, s);
|
|
2522
2727
|
return;
|
|
2523
2728
|
}
|
|
2524
|
-
if (
|
|
2525
|
-
const s = this.hooks.fatalReason(
|
|
2729
|
+
if (i instanceof K || i instanceof Error && !(i instanceof E)) {
|
|
2730
|
+
const s = this.hooks.fatalReason(i, "Runtime fatal");
|
|
2526
2731
|
await this.hooks.enterFatalTermination(e, t, s);
|
|
2527
2732
|
return;
|
|
2528
2733
|
}
|
|
2529
|
-
throw
|
|
2734
|
+
throw i;
|
|
2530
2735
|
}
|
|
2531
2736
|
}
|
|
2532
2737
|
}
|
|
2533
2738
|
async deliverLifecycle(e, t, n, r) {
|
|
2534
2739
|
if (this.runtime.gasMeter().chargeLifecycleDelivery(), await this.hooks.recordLifecycleForBridging(e, n), !t)
|
|
2535
2740
|
return;
|
|
2536
|
-
const
|
|
2741
|
+
const i = this.channelsMatching(
|
|
2537
2742
|
t,
|
|
2538
|
-
|
|
2743
|
+
Ao
|
|
2539
2744
|
);
|
|
2540
|
-
for (const s of
|
|
2745
|
+
for (const s of i)
|
|
2541
2746
|
if (await this.channelRunner.runHandlers(
|
|
2542
2747
|
e,
|
|
2543
2748
|
t,
|
|
@@ -2549,24 +2754,24 @@ class ti {
|
|
|
2549
2754
|
r && await this.finalizeScope(e, t);
|
|
2550
2755
|
}
|
|
2551
2756
|
async processEmbeddedChildren(e, t) {
|
|
2552
|
-
const n =
|
|
2553
|
-
let
|
|
2554
|
-
for (;
|
|
2555
|
-
const s = this.nextEmbeddedPath(
|
|
2757
|
+
const n = w(e), r = /* @__PURE__ */ new Set();
|
|
2758
|
+
let i = this.refreshBundle(n);
|
|
2759
|
+
for (; i; ) {
|
|
2760
|
+
const s = this.nextEmbeddedPath(i, r);
|
|
2556
2761
|
if (!s)
|
|
2557
|
-
return
|
|
2762
|
+
return i;
|
|
2558
2763
|
r.add(s);
|
|
2559
|
-
const a =
|
|
2764
|
+
const a = k(n, s);
|
|
2560
2765
|
if (a === n || this.hooks.isScopeInactive(a)) {
|
|
2561
|
-
|
|
2766
|
+
i = this.refreshBundle(n);
|
|
2562
2767
|
continue;
|
|
2563
2768
|
}
|
|
2564
|
-
this.nodeAt(a) && (await this.initializeScope(a, !1), await this.processPreparedExternalEvent(a, t)),
|
|
2769
|
+
this.nodeAt(a) && (await this.initializeScope(a, !1), await this.processPreparedExternalEvent(a, t)), i = this.refreshBundle(n);
|
|
2565
2770
|
}
|
|
2566
2771
|
return null;
|
|
2567
2772
|
}
|
|
2568
2773
|
refreshBundle(e) {
|
|
2569
|
-
const t =
|
|
2774
|
+
const t = w(e), n = this.nodeAt(t);
|
|
2570
2775
|
if (!n)
|
|
2571
2776
|
return this.bundles.delete(t), null;
|
|
2572
2777
|
const r = this.loadBundle(n, t);
|
|
@@ -2584,12 +2789,12 @@ class ti {
|
|
|
2584
2789
|
try {
|
|
2585
2790
|
return this.contractLoader.load(e, t);
|
|
2586
2791
|
} catch (n) {
|
|
2587
|
-
if (n instanceof
|
|
2792
|
+
if (n instanceof E || n instanceof F)
|
|
2588
2793
|
throw n;
|
|
2589
2794
|
const r = n?.message ?? "Failed to load contracts";
|
|
2590
|
-
throw new
|
|
2795
|
+
throw new E(
|
|
2591
2796
|
r,
|
|
2592
|
-
|
|
2797
|
+
C.runtimeFatal(
|
|
2593
2798
|
`Failed to load contracts for scope ${t}`,
|
|
2594
2799
|
n
|
|
2595
2800
|
)
|
|
@@ -2597,7 +2802,7 @@ class ti {
|
|
|
2597
2802
|
}
|
|
2598
2803
|
}
|
|
2599
2804
|
async addInitializationMarker(e, t) {
|
|
2600
|
-
const n = new p().setType(new p().setBlueId(
|
|
2805
|
+
const n = new p().setType(new p().setBlueId(Je)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(ye);
|
|
2601
2806
|
await e.applyPatch({
|
|
2602
2807
|
op: "ADD",
|
|
2603
2808
|
path: r,
|
|
@@ -2612,17 +2817,17 @@ class ti {
|
|
|
2612
2817
|
return;
|
|
2613
2818
|
const n = this.channelsMatching(
|
|
2614
2819
|
t,
|
|
2615
|
-
|
|
2820
|
+
Oo
|
|
2616
2821
|
);
|
|
2617
2822
|
if (n.length !== 0)
|
|
2618
2823
|
for (const r of t.embeddedPaths()) {
|
|
2619
|
-
const
|
|
2824
|
+
const i = k(e, r), a = this.runtime.scope(i).drainBridgeableEvents();
|
|
2620
2825
|
if (a.length !== 0)
|
|
2621
2826
|
for (const c of a) {
|
|
2622
2827
|
let u = !1;
|
|
2623
2828
|
for (const h of n) {
|
|
2624
|
-
const
|
|
2625
|
-
|
|
2829
|
+
const v = h.contract().childPath ?? "/";
|
|
2830
|
+
k(e, v) === i && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
|
|
2626
2831
|
e,
|
|
2627
2832
|
t,
|
|
2628
2833
|
h.key(),
|
|
@@ -2638,15 +2843,15 @@ class ti {
|
|
|
2638
2843
|
return;
|
|
2639
2844
|
const n = this.runtime.scope(e), r = this.channelsMatching(
|
|
2640
2845
|
t,
|
|
2641
|
-
|
|
2846
|
+
No
|
|
2642
2847
|
);
|
|
2643
2848
|
if (r.length === 0) {
|
|
2644
2849
|
n.clearTriggered();
|
|
2645
2850
|
return;
|
|
2646
2851
|
}
|
|
2647
2852
|
for (; !n.triggeredIsEmpty(); ) {
|
|
2648
|
-
const
|
|
2649
|
-
if (!
|
|
2853
|
+
const i = n.pollTriggered();
|
|
2854
|
+
if (!i)
|
|
2650
2855
|
break;
|
|
2651
2856
|
this.runtime.gasMeter().chargeDrainEvent();
|
|
2652
2857
|
for (const s of r) {
|
|
@@ -2658,7 +2863,7 @@ class ti {
|
|
|
2658
2863
|
e,
|
|
2659
2864
|
t,
|
|
2660
2865
|
s.key(),
|
|
2661
|
-
|
|
2866
|
+
i.clone(),
|
|
2662
2867
|
!1
|
|
2663
2868
|
), this.hooks.isScopeInactive(e)) {
|
|
2664
2869
|
n.clearTriggered();
|
|
@@ -2672,46 +2877,46 @@ class ti {
|
|
|
2672
2877
|
return e.channelsOfType();
|
|
2673
2878
|
const n = this.runtime.blue();
|
|
2674
2879
|
return e.channelsOfType().filter((r) => {
|
|
2675
|
-
const
|
|
2676
|
-
return t.some((s) => n.isTypeOfBlueId(
|
|
2880
|
+
const i = r.node();
|
|
2881
|
+
return t.some((s) => n.isTypeOfBlueId(i, s));
|
|
2677
2882
|
});
|
|
2678
2883
|
}
|
|
2679
2884
|
isProcessorManagedChannel(e) {
|
|
2680
2885
|
const t = this.runtime.blue(), n = e.node();
|
|
2681
|
-
for (const r of
|
|
2886
|
+
for (const r of Ie)
|
|
2682
2887
|
if (t.isTypeOfBlueId(n, r))
|
|
2683
2888
|
return !0;
|
|
2684
2889
|
return !1;
|
|
2685
2890
|
}
|
|
2686
2891
|
validatePatchBoundary(e, t, n) {
|
|
2687
|
-
const r =
|
|
2688
|
-
if (
|
|
2689
|
-
throw new
|
|
2892
|
+
const r = w(e), i = R(n.path);
|
|
2893
|
+
if (i === r)
|
|
2894
|
+
throw new V(
|
|
2690
2895
|
`Self-root mutation is forbidden at scope ${r}`
|
|
2691
2896
|
);
|
|
2692
|
-
if (r !== "/" && !
|
|
2693
|
-
throw new
|
|
2694
|
-
`Patch path ${
|
|
2897
|
+
if (r !== "/" && !i.startsWith(`${r}/`))
|
|
2898
|
+
throw new V(
|
|
2899
|
+
`Patch path ${i} is outside scope ${r}`
|
|
2695
2900
|
);
|
|
2696
2901
|
for (const s of t.embeddedPaths()) {
|
|
2697
|
-
const a =
|
|
2698
|
-
if (
|
|
2699
|
-
throw new
|
|
2700
|
-
`Boundary violation: patch ${
|
|
2902
|
+
const a = k(r, s);
|
|
2903
|
+
if (i.startsWith(`${a}/`))
|
|
2904
|
+
throw new V(
|
|
2905
|
+
`Boundary violation: patch ${i} enters embedded scope ${a}`
|
|
2701
2906
|
);
|
|
2702
2907
|
}
|
|
2703
2908
|
}
|
|
2704
2909
|
enforceReservedKeyWriteProtection(e, t, n) {
|
|
2705
2910
|
if (n)
|
|
2706
2911
|
return;
|
|
2707
|
-
const r =
|
|
2708
|
-
for (const s of
|
|
2709
|
-
const a =
|
|
2912
|
+
const r = w(e), i = R(t.path);
|
|
2913
|
+
for (const s of be) {
|
|
2914
|
+
const a = k(
|
|
2710
2915
|
r,
|
|
2711
|
-
|
|
2916
|
+
ae(s)
|
|
2712
2917
|
);
|
|
2713
|
-
if (
|
|
2714
|
-
throw new
|
|
2918
|
+
if (i === a || i.startsWith(`${a}/`))
|
|
2919
|
+
throw new V(
|
|
2715
2920
|
`Reserved key '${s}' is write-protected at ${a}`
|
|
2716
2921
|
);
|
|
2717
2922
|
}
|
|
@@ -2719,129 +2924,129 @@ class ti {
|
|
|
2719
2924
|
async markCutOffChildrenIfNeeded(e, t, n) {
|
|
2720
2925
|
if (t.embeddedPaths().length === 0)
|
|
2721
2926
|
return;
|
|
2722
|
-
const r =
|
|
2723
|
-
for (const
|
|
2724
|
-
const s =
|
|
2927
|
+
const r = R(n.path);
|
|
2928
|
+
for (const i of t.embeddedPaths()) {
|
|
2929
|
+
const s = k(e, i);
|
|
2725
2930
|
r === s && (n.op === "remove" || n.op === "replace") && await this.hooks.markCutOff(s);
|
|
2726
2931
|
}
|
|
2727
2932
|
}
|
|
2728
2933
|
hasInitializationMarker(e) {
|
|
2729
|
-
const t =
|
|
2934
|
+
const t = k(e, ye), n = this.nodeAt(t);
|
|
2730
2935
|
if (!n)
|
|
2731
2936
|
return !1;
|
|
2732
2937
|
if (!(n instanceof p)) {
|
|
2733
|
-
const
|
|
2734
|
-
throw new
|
|
2938
|
+
const i = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
|
|
2939
|
+
throw new K(i);
|
|
2735
2940
|
}
|
|
2736
|
-
if (n.getType()?.getBlueId() !==
|
|
2737
|
-
const
|
|
2738
|
-
throw new
|
|
2941
|
+
if (n.getType()?.getBlueId() !== Je) {
|
|
2942
|
+
const i = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
|
|
2943
|
+
throw new K(i);
|
|
2739
2944
|
}
|
|
2740
2945
|
return !0;
|
|
2741
2946
|
}
|
|
2742
2947
|
createLifecycleEvent(e) {
|
|
2743
|
-
return new p().setType(new p().setBlueId(
|
|
2948
|
+
return new p().setType(new p().setBlueId(Bo)).setProperties({
|
|
2744
2949
|
type: new p().setValue("Core/Document Processing Initiated"),
|
|
2745
2950
|
documentId: new p().setValue(e)
|
|
2746
2951
|
});
|
|
2747
2952
|
}
|
|
2748
2953
|
}
|
|
2749
|
-
class
|
|
2954
|
+
class ie extends Error {
|
|
2750
2955
|
constructor(e) {
|
|
2751
2956
|
super(
|
|
2752
2957
|
e ? "Processing terminated due to fatal error" : "Processing terminated"
|
|
2753
2958
|
), this.fatal = e, this.name = "RunTerminationError";
|
|
2754
2959
|
}
|
|
2755
2960
|
}
|
|
2756
|
-
const
|
|
2757
|
-
class
|
|
2961
|
+
const _o = S["Core/Processing Terminated Marker"], Lo = S["Core/Document Processing Terminated"];
|
|
2962
|
+
class xo {
|
|
2758
2963
|
constructor(e) {
|
|
2759
2964
|
this.runtime = e;
|
|
2760
2965
|
}
|
|
2761
|
-
async terminateScope(e, t, n, r,
|
|
2762
|
-
e.recordPendingTermination(t, r,
|
|
2763
|
-
const s = e.normalizeScope(t), a =
|
|
2966
|
+
async terminateScope(e, t, n, r, i) {
|
|
2967
|
+
e.recordPendingTermination(t, r, i ?? null);
|
|
2968
|
+
const s = e.normalizeScope(t), a = k(s, dt);
|
|
2764
2969
|
this.runtime.directWrite(
|
|
2765
2970
|
a,
|
|
2766
|
-
|
|
2971
|
+
Fo(this.runtime.blue(), r, i)
|
|
2767
2972
|
), this.runtime.gasMeter().chargeTerminationMarker();
|
|
2768
|
-
const c = n ?? e.bundleForScope(s) ?? null, u =
|
|
2973
|
+
const c = n ?? e.bundleForScope(s) ?? null, u = $o(r, i);
|
|
2769
2974
|
if (await e.deliverLifecycle(
|
|
2770
2975
|
s,
|
|
2771
2976
|
c,
|
|
2772
2977
|
u,
|
|
2773
2978
|
!1
|
|
2774
|
-
), this.runtime.scope(s).finalizeTermination(r,
|
|
2775
|
-
throw this.runtime.markRunTerminated(), new
|
|
2979
|
+
), this.runtime.scope(s).finalizeTermination(r, i ?? null), e.clearPendingTermination(t), r === "FATAL" && this.runtime.gasMeter().chargeFatalTerminationOverhead(), r === "FATAL" && s === "/")
|
|
2980
|
+
throw this.runtime.markRunTerminated(), new ie(!0);
|
|
2776
2981
|
if (r === "GRACEFUL" && s === "/")
|
|
2777
|
-
throw this.runtime.markRunTerminated(), new
|
|
2982
|
+
throw this.runtime.markRunTerminated(), new ie(!1);
|
|
2778
2983
|
}
|
|
2779
2984
|
}
|
|
2780
|
-
function
|
|
2781
|
-
return
|
|
2782
|
-
type: { blueId:
|
|
2985
|
+
function Fo(o, e, t) {
|
|
2986
|
+
return Uo(o, {
|
|
2987
|
+
type: { blueId: _o },
|
|
2783
2988
|
cause: e === "GRACEFUL" ? "graceful" : "fatal",
|
|
2784
2989
|
...t ? { reason: t } : {}
|
|
2785
2990
|
});
|
|
2786
2991
|
}
|
|
2787
|
-
function
|
|
2992
|
+
function $o(o, e) {
|
|
2788
2993
|
const t = new p().setType(
|
|
2789
|
-
new p().setBlueId(
|
|
2994
|
+
new p().setBlueId(Lo)
|
|
2790
2995
|
);
|
|
2791
2996
|
return t.addProperty(
|
|
2792
2997
|
"cause",
|
|
2793
|
-
new p().setValue(
|
|
2998
|
+
new p().setValue(o === "GRACEFUL" ? "graceful" : "fatal")
|
|
2794
2999
|
), e && t.addProperty("reason", new p().setValue(e)), t;
|
|
2795
3000
|
}
|
|
2796
|
-
function
|
|
2797
|
-
return
|
|
3001
|
+
function Uo(o, e) {
|
|
3002
|
+
return o.jsonValueToNode(e);
|
|
2798
3003
|
}
|
|
2799
|
-
const
|
|
2800
|
-
class
|
|
3004
|
+
const Y = "-";
|
|
3005
|
+
class zo {
|
|
2801
3006
|
constructor(e) {
|
|
2802
3007
|
this.document = e;
|
|
2803
3008
|
}
|
|
2804
3009
|
applyPatch(e, t) {
|
|
2805
|
-
const n =
|
|
3010
|
+
const n = w(e), r = R(t.path), i = Ye(r), s = Qe(this.document, i, "before", r);
|
|
2806
3011
|
switch (t.op) {
|
|
2807
3012
|
case "ADD":
|
|
2808
|
-
this.applyAdd(
|
|
3013
|
+
this.applyAdd(i, r, t.val ?? null);
|
|
2809
3014
|
break;
|
|
2810
3015
|
case "REPLACE":
|
|
2811
|
-
this.applyReplace(
|
|
3016
|
+
this.applyReplace(i, r, t.val ?? null);
|
|
2812
3017
|
break;
|
|
2813
3018
|
case "REMOVE":
|
|
2814
|
-
this.applyRemove(
|
|
3019
|
+
this.applyRemove(i, r);
|
|
2815
3020
|
break;
|
|
2816
3021
|
}
|
|
2817
|
-
const a = t.op === "REMOVE" ? null :
|
|
3022
|
+
const a = t.op === "REMOVE" ? null : Qe(this.document, i, "after", r);
|
|
2818
3023
|
return {
|
|
2819
3024
|
path: r,
|
|
2820
3025
|
before: s,
|
|
2821
3026
|
after: a,
|
|
2822
3027
|
op: t.op.toLowerCase(),
|
|
2823
3028
|
originScope: n,
|
|
2824
|
-
cascadeScopes:
|
|
3029
|
+
cascadeScopes: Vo(n)
|
|
2825
3030
|
};
|
|
2826
3031
|
}
|
|
2827
3032
|
directWrite(e, t) {
|
|
2828
|
-
const n =
|
|
3033
|
+
const n = R(e);
|
|
2829
3034
|
if (n === "/")
|
|
2830
3035
|
throw new Error("Direct write cannot target root document");
|
|
2831
|
-
const r =
|
|
2832
|
-
if (s ===
|
|
3036
|
+
const r = Ye(n), { parent: i, leaf: s } = this.resolveParent(r);
|
|
3037
|
+
if (s === Y)
|
|
2833
3038
|
throw new Error(
|
|
2834
3039
|
`Direct write does not support append token '-' for path ${n}`
|
|
2835
3040
|
);
|
|
2836
|
-
const a =
|
|
2837
|
-
if (a &&
|
|
2838
|
-
this.directWriteArray(
|
|
3041
|
+
const a = i.getItems();
|
|
3042
|
+
if (a && H(s)) {
|
|
3043
|
+
this.directWriteArray(i, a, s, t, n);
|
|
2839
3044
|
return;
|
|
2840
3045
|
}
|
|
2841
|
-
this.directWriteObject(
|
|
3046
|
+
this.directWriteObject(i, s, t);
|
|
2842
3047
|
}
|
|
2843
|
-
directWriteArray(e, t, n, r,
|
|
2844
|
-
const s =
|
|
3048
|
+
directWriteArray(e, t, n, r, i) {
|
|
3049
|
+
const s = me(e, t), a = x(n, i);
|
|
2845
3050
|
if (r == null) {
|
|
2846
3051
|
if (a < 0 || a >= s.length)
|
|
2847
3052
|
return;
|
|
@@ -2858,11 +3063,11 @@ class ci {
|
|
|
2858
3063
|
return;
|
|
2859
3064
|
}
|
|
2860
3065
|
throw new Error(
|
|
2861
|
-
`Array index out of bounds for direct write: ${
|
|
3066
|
+
`Array index out of bounds for direct write: ${i}`
|
|
2862
3067
|
);
|
|
2863
3068
|
}
|
|
2864
3069
|
directWriteObject(e, t, n) {
|
|
2865
|
-
const r =
|
|
3070
|
+
const r = ee(e);
|
|
2866
3071
|
if (n == null) {
|
|
2867
3072
|
delete r[t], e.setProperties(
|
|
2868
3073
|
Object.keys(r).length > 0 ? r : void 0
|
|
@@ -2882,55 +3087,55 @@ class ci {
|
|
|
2882
3087
|
return { parent: t, leaf: e[e.length - 1] };
|
|
2883
3088
|
}
|
|
2884
3089
|
getOrCreateChild(e, t, n, r) {
|
|
2885
|
-
if (t ===
|
|
3090
|
+
if (t === Y)
|
|
2886
3091
|
throw new Error(
|
|
2887
|
-
`Append token '-' must be final segment: ${
|
|
3092
|
+
`Append token '-' must be final segment: ${J(n, r)}`
|
|
2888
3093
|
);
|
|
2889
|
-
const
|
|
2890
|
-
if (
|
|
2891
|
-
const c = x(t,
|
|
2892
|
-
if (c < 0 || c >=
|
|
3094
|
+
const i = e.getItems();
|
|
3095
|
+
if (i && H(t)) {
|
|
3096
|
+
const c = x(t, J(n, r));
|
|
3097
|
+
if (c < 0 || c >= i.length)
|
|
2893
3098
|
throw new Error(
|
|
2894
|
-
`Array index out of bounds: ${
|
|
3099
|
+
`Array index out of bounds: ${J(n, r)}`
|
|
2895
3100
|
);
|
|
2896
|
-
const u =
|
|
3101
|
+
const u = i[c];
|
|
2897
3102
|
if (!u)
|
|
2898
3103
|
throw new Error(
|
|
2899
|
-
`Path does not exist: ${
|
|
3104
|
+
`Path does not exist: ${J(n, r)}`
|
|
2900
3105
|
);
|
|
2901
3106
|
return u;
|
|
2902
3107
|
}
|
|
2903
|
-
const s =
|
|
3108
|
+
const s = ee(e);
|
|
2904
3109
|
let a = s[t];
|
|
2905
3110
|
return a || (a = new p(), s[t] = a, e.setProperties(s)), a;
|
|
2906
3111
|
}
|
|
2907
3112
|
applyAdd(e, t, n) {
|
|
2908
3113
|
if (t === "/" || t.length === 0)
|
|
2909
3114
|
throw new Error("ADD operation cannot target document root");
|
|
2910
|
-
const { parent: r, key:
|
|
3115
|
+
const { parent: r, key: i, pointer: s, created: a } = this.resolveParentForPatch(
|
|
2911
3116
|
e,
|
|
2912
3117
|
t,
|
|
2913
3118
|
"ADD"
|
|
2914
3119
|
);
|
|
2915
3120
|
try {
|
|
2916
|
-
if (
|
|
2917
|
-
const u = r.getItems(), h =
|
|
3121
|
+
if (H(i)) {
|
|
3122
|
+
const u = r.getItems(), h = i === Y;
|
|
2918
3123
|
if (!u)
|
|
2919
3124
|
throw new Error(
|
|
2920
3125
|
h ? `Append token '-' requires array at ${s}` : `Array index segment requires array at ${s}`
|
|
2921
3126
|
);
|
|
2922
3127
|
if (h) {
|
|
2923
|
-
|
|
3128
|
+
me(r, u).push(Q(n));
|
|
2924
3129
|
return;
|
|
2925
3130
|
}
|
|
2926
|
-
const d = x(
|
|
3131
|
+
const d = x(i, t);
|
|
2927
3132
|
if (d < 0 || d > u.length)
|
|
2928
3133
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2929
|
-
|
|
3134
|
+
me(r, u).splice(d, 0, Q(n));
|
|
2930
3135
|
return;
|
|
2931
3136
|
}
|
|
2932
|
-
const c =
|
|
2933
|
-
c[
|
|
3137
|
+
const c = ee(r);
|
|
3138
|
+
c[i] = Q(n), r.setProperties(c);
|
|
2934
3139
|
} catch (c) {
|
|
2935
3140
|
throw this.rollbackCreated(a), c;
|
|
2936
3141
|
}
|
|
@@ -2938,24 +3143,24 @@ class ci {
|
|
|
2938
3143
|
applyReplace(e, t, n) {
|
|
2939
3144
|
if (t === "/" || t.length === 0)
|
|
2940
3145
|
throw new Error("REPLACE operation cannot target document root");
|
|
2941
|
-
const { parent: r, key:
|
|
3146
|
+
const { parent: r, key: i, created: s } = this.resolveParentForPatch(
|
|
2942
3147
|
e,
|
|
2943
3148
|
t,
|
|
2944
3149
|
"REPLACE"
|
|
2945
3150
|
);
|
|
2946
3151
|
try {
|
|
2947
|
-
if (
|
|
3152
|
+
if (H(i)) {
|
|
2948
3153
|
const c = r.getItems();
|
|
2949
3154
|
if (!c)
|
|
2950
3155
|
throw new Error(`Array index segment requires array at ${t}`);
|
|
2951
|
-
const u = x(
|
|
3156
|
+
const u = x(i, t);
|
|
2952
3157
|
if (u < 0 || u >= c.length)
|
|
2953
3158
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2954
|
-
c[u] =
|
|
3159
|
+
c[u] = Q(n), r.setItems(c);
|
|
2955
3160
|
return;
|
|
2956
3161
|
}
|
|
2957
|
-
const a =
|
|
2958
|
-
a[
|
|
3162
|
+
const a = ee(r);
|
|
3163
|
+
a[i] = Q(n), r.setProperties(a);
|
|
2959
3164
|
} catch (a) {
|
|
2960
3165
|
throw this.rollbackCreated(s), a;
|
|
2961
3166
|
}
|
|
@@ -2968,7 +3173,7 @@ class ci {
|
|
|
2968
3173
|
t,
|
|
2969
3174
|
"REMOVE"
|
|
2970
3175
|
);
|
|
2971
|
-
if (
|
|
3176
|
+
if (H(r)) {
|
|
2972
3177
|
const a = n.getItems();
|
|
2973
3178
|
if (!a)
|
|
2974
3179
|
throw new Error(`Array index segment requires array at ${t}`);
|
|
@@ -2978,140 +3183,140 @@ class ci {
|
|
|
2978
3183
|
a.splice(c, 1), n.setItems(a);
|
|
2979
3184
|
return;
|
|
2980
3185
|
}
|
|
2981
|
-
const
|
|
2982
|
-
if (!
|
|
3186
|
+
const i = n.getProperties();
|
|
3187
|
+
if (!i || !Object.prototype.hasOwnProperty.call(i, r))
|
|
2983
3188
|
throw new Error(`Path does not exist: ${t}`);
|
|
2984
|
-
const s = { ...
|
|
3189
|
+
const s = { ...i };
|
|
2985
3190
|
delete s[r], n.setProperties(s);
|
|
2986
3191
|
}
|
|
2987
3192
|
resolveParentForPatch(e, t, n) {
|
|
2988
3193
|
if (e.length === 0)
|
|
2989
3194
|
throw new Error(`${n} operation cannot target document root`);
|
|
2990
3195
|
let r = this.document;
|
|
2991
|
-
const
|
|
3196
|
+
const i = [];
|
|
2992
3197
|
for (let a = 0; a < e.length - 1; a += 1) {
|
|
2993
|
-
const c = e[a], u =
|
|
2994
|
-
if (
|
|
2995
|
-
const
|
|
2996
|
-
if (!
|
|
3198
|
+
const c = e[a], u = J(e, a + 1);
|
|
3199
|
+
if (H(c)) {
|
|
3200
|
+
const v = r.getItems();
|
|
3201
|
+
if (!v)
|
|
2997
3202
|
throw new Error(`Array index segment requires array at ${u}`);
|
|
2998
3203
|
const f = x(c, u);
|
|
2999
|
-
if (f < 0 || f >=
|
|
3204
|
+
if (f < 0 || f >= v.length)
|
|
3000
3205
|
throw new Error(`Array index out of bounds in path: ${u}`);
|
|
3001
|
-
const
|
|
3002
|
-
if (!(
|
|
3206
|
+
const g = v[f];
|
|
3207
|
+
if (!(g instanceof p))
|
|
3003
3208
|
throw new Error(`Array index out of bounds in path: ${u}`);
|
|
3004
|
-
r =
|
|
3209
|
+
r = g;
|
|
3005
3210
|
continue;
|
|
3006
3211
|
}
|
|
3007
3212
|
let h = r.getProperties(), d = h?.[c] ?? null;
|
|
3008
3213
|
if (!(d instanceof p)) {
|
|
3009
3214
|
if (n === "REMOVE")
|
|
3010
3215
|
throw new Error(`Path does not exist: ${u}`);
|
|
3011
|
-
d = new p(), h || (h = {}), h[c] = d, r.setProperties(h),
|
|
3216
|
+
d = new p(), h || (h = {}), h[c] = d, r.setProperties(h), i.push({ owner: r, key: c });
|
|
3012
3217
|
}
|
|
3013
3218
|
r = d;
|
|
3014
3219
|
}
|
|
3015
3220
|
const s = e[e.length - 1];
|
|
3016
|
-
return { parent: r, key: s, pointer: t, created:
|
|
3221
|
+
return { parent: r, key: s, pointer: t, created: i };
|
|
3017
3222
|
}
|
|
3018
3223
|
rollbackCreated(e) {
|
|
3019
3224
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
3020
|
-
const { owner: n, key: r } = e[t],
|
|
3021
|
-
|
|
3225
|
+
const { owner: n, key: r } = e[t], i = n.getProperties();
|
|
3226
|
+
i && (delete i[r], Object.keys(i).length === 0 ? n.setProperties(void 0) : n.setProperties(i));
|
|
3022
3227
|
}
|
|
3023
3228
|
}
|
|
3024
3229
|
}
|
|
3025
|
-
function
|
|
3230
|
+
function Vo(o) {
|
|
3026
3231
|
const e = [];
|
|
3027
|
-
let t =
|
|
3232
|
+
let t = o;
|
|
3028
3233
|
for (; e.push(t), t !== "/"; ) {
|
|
3029
3234
|
const n = t.lastIndexOf("/");
|
|
3030
3235
|
t = n <= 0 ? "/" : t.substring(0, n);
|
|
3031
3236
|
}
|
|
3032
3237
|
return e;
|
|
3033
3238
|
}
|
|
3034
|
-
function
|
|
3239
|
+
function Qe(o, e, t, n) {
|
|
3035
3240
|
try {
|
|
3036
3241
|
if (e.length === 0)
|
|
3037
|
-
return
|
|
3038
|
-
const r =
|
|
3242
|
+
return o.clone();
|
|
3243
|
+
const r = Ho(o, e, t, n);
|
|
3039
3244
|
return r ? r.clone() : null;
|
|
3040
3245
|
} catch {
|
|
3041
3246
|
return null;
|
|
3042
3247
|
}
|
|
3043
3248
|
}
|
|
3044
|
-
function
|
|
3045
|
-
let r =
|
|
3046
|
-
for (let
|
|
3047
|
-
const s = e[
|
|
3048
|
-
if (r =
|
|
3249
|
+
function Ho(o, e, t, n) {
|
|
3250
|
+
let r = o;
|
|
3251
|
+
for (let i = 0; i < e.length; i += 1) {
|
|
3252
|
+
const s = e[i] ?? "", a = i === e.length - 1;
|
|
3253
|
+
if (r = Ko(r, s, a, t, n), !r)
|
|
3049
3254
|
return null;
|
|
3050
3255
|
}
|
|
3051
3256
|
return r;
|
|
3052
3257
|
}
|
|
3053
|
-
function
|
|
3054
|
-
if (!
|
|
3258
|
+
function Ko(o, e, t, n, r) {
|
|
3259
|
+
if (!o)
|
|
3055
3260
|
return null;
|
|
3056
|
-
const
|
|
3057
|
-
if (
|
|
3058
|
-
if (e ===
|
|
3261
|
+
const i = o.getItems();
|
|
3262
|
+
if (i) {
|
|
3263
|
+
if (e === Y) {
|
|
3059
3264
|
if (!t)
|
|
3060
3265
|
throw new Error(`Append token '-' must be final segment: ${r}`);
|
|
3061
|
-
return n === "before" ||
|
|
3266
|
+
return n === "before" || i.length === 0 ? null : i[i.length - 1] ?? null;
|
|
3062
3267
|
}
|
|
3063
3268
|
const c = x(e, r);
|
|
3064
|
-
return c < 0 || c >=
|
|
3269
|
+
return c < 0 || c >= i.length ? null : i[c] ?? null;
|
|
3065
3270
|
}
|
|
3066
|
-
const s =
|
|
3271
|
+
const s = o.getProperties();
|
|
3067
3272
|
if (!s)
|
|
3068
3273
|
return null;
|
|
3069
3274
|
const a = s[e];
|
|
3070
3275
|
return a instanceof p ? a : null;
|
|
3071
3276
|
}
|
|
3072
|
-
function
|
|
3073
|
-
if (
|
|
3277
|
+
function Ye(o) {
|
|
3278
|
+
if (o === "/" || o === "")
|
|
3074
3279
|
return [];
|
|
3075
|
-
const e =
|
|
3280
|
+
const e = o.startsWith("/") ? o.slice(1) : o;
|
|
3076
3281
|
return e.length === 0 ? [] : e.split("/");
|
|
3077
3282
|
}
|
|
3078
|
-
function x(
|
|
3079
|
-
const t = Number.parseInt(
|
|
3283
|
+
function x(o, e) {
|
|
3284
|
+
const t = Number.parseInt(o, 10);
|
|
3080
3285
|
if (Number.isNaN(t))
|
|
3081
3286
|
throw new Error(`Expected numeric array index in path: ${e}`);
|
|
3082
3287
|
if (t < 0)
|
|
3083
3288
|
throw new Error(`Negative array index in path: ${e}`);
|
|
3084
3289
|
return t;
|
|
3085
3290
|
}
|
|
3086
|
-
function
|
|
3291
|
+
function J(o, e) {
|
|
3087
3292
|
if (e <= 0)
|
|
3088
3293
|
return "/";
|
|
3089
|
-
const t = Math.min(e,
|
|
3294
|
+
const t = Math.min(e, o.length);
|
|
3090
3295
|
let n = "";
|
|
3091
3296
|
for (let r = 0; r < t; r += 1)
|
|
3092
|
-
n += `/${
|
|
3297
|
+
n += `/${o[r] ?? ""}`;
|
|
3093
3298
|
return n === "" ? "/" : n;
|
|
3094
3299
|
}
|
|
3095
|
-
function
|
|
3300
|
+
function me(o, e) {
|
|
3096
3301
|
const t = [...e];
|
|
3097
|
-
return
|
|
3302
|
+
return o.setItems(t), t;
|
|
3098
3303
|
}
|
|
3099
|
-
function
|
|
3100
|
-
const e =
|
|
3304
|
+
function ee(o) {
|
|
3305
|
+
const e = o.getProperties();
|
|
3101
3306
|
if (!e) {
|
|
3102
3307
|
const n = {};
|
|
3103
|
-
return
|
|
3308
|
+
return o.setProperties(n), n;
|
|
3104
3309
|
}
|
|
3105
3310
|
const t = { ...e };
|
|
3106
|
-
return
|
|
3311
|
+
return o.setProperties(t), t;
|
|
3107
3312
|
}
|
|
3108
|
-
function
|
|
3109
|
-
return
|
|
3313
|
+
function H(o) {
|
|
3314
|
+
return o === Y || /^\d+$/.test(o);
|
|
3110
3315
|
}
|
|
3111
|
-
function
|
|
3112
|
-
return
|
|
3316
|
+
function Q(o) {
|
|
3317
|
+
return o == null ? new p().setValue(null) : o.clone();
|
|
3113
3318
|
}
|
|
3114
|
-
class
|
|
3319
|
+
class Wo {
|
|
3115
3320
|
constructor(e) {
|
|
3116
3321
|
this.path = e;
|
|
3117
3322
|
}
|
|
@@ -3173,7 +3378,7 @@ class di {
|
|
|
3173
3378
|
return this.cutOff;
|
|
3174
3379
|
}
|
|
3175
3380
|
}
|
|
3176
|
-
class
|
|
3381
|
+
class qo {
|
|
3177
3382
|
scopesMap = /* @__PURE__ */ new Map();
|
|
3178
3383
|
rootEmissionList = [];
|
|
3179
3384
|
scopes() {
|
|
@@ -3181,7 +3386,7 @@ class pi {
|
|
|
3181
3386
|
}
|
|
3182
3387
|
scope(e) {
|
|
3183
3388
|
let t = this.scopesMap.get(e);
|
|
3184
|
-
return t || (t = new
|
|
3389
|
+
return t || (t = new Wo(e), this.scopesMap.set(e, t)), t;
|
|
3185
3390
|
}
|
|
3186
3391
|
existingScope(e) {
|
|
3187
3392
|
return this.scopesMap.get(e);
|
|
@@ -3199,33 +3404,33 @@ class pi {
|
|
|
3199
3404
|
this.scopesMap.delete(e);
|
|
3200
3405
|
}
|
|
3201
3406
|
}
|
|
3202
|
-
function
|
|
3203
|
-
return Math.floor((
|
|
3407
|
+
function _t(o) {
|
|
3408
|
+
return Math.floor((o + 99) / 100);
|
|
3204
3409
|
}
|
|
3205
|
-
function
|
|
3206
|
-
const e =
|
|
3410
|
+
function Go(o) {
|
|
3411
|
+
const e = R(o);
|
|
3207
3412
|
return e === "/" ? 0 : e.split("/").length - 1;
|
|
3208
3413
|
}
|
|
3209
|
-
function
|
|
3210
|
-
return 40 + 5 * Math.max(0,
|
|
3414
|
+
function jo(o) {
|
|
3415
|
+
return 40 + 5 * Math.max(0, o);
|
|
3211
3416
|
}
|
|
3212
|
-
function
|
|
3213
|
-
return 8 +
|
|
3417
|
+
function Jo(o, e) {
|
|
3418
|
+
return 8 + Go(o) + _t(e);
|
|
3214
3419
|
}
|
|
3215
|
-
const
|
|
3216
|
-
function
|
|
3217
|
-
return 50 + 10 *
|
|
3420
|
+
const Qo = 1e3, Yo = 5, Zo = 50, Xo = 2, ei = 10, ti = 10, ni = 10, ri = 20, oi = 20, ii = 30, si = 30, ai = 100;
|
|
3421
|
+
function ci(o) {
|
|
3422
|
+
return 50 + 10 * o;
|
|
3218
3423
|
}
|
|
3219
|
-
function
|
|
3220
|
-
return 20 +
|
|
3424
|
+
function li(o) {
|
|
3425
|
+
return 20 + o;
|
|
3221
3426
|
}
|
|
3222
|
-
function
|
|
3223
|
-
return 10 *
|
|
3427
|
+
function ui(o) {
|
|
3428
|
+
return 10 * o;
|
|
3224
3429
|
}
|
|
3225
|
-
function
|
|
3226
|
-
return 20 +
|
|
3430
|
+
function hi(o) {
|
|
3431
|
+
return 20 + o;
|
|
3227
3432
|
}
|
|
3228
|
-
class
|
|
3433
|
+
class di {
|
|
3229
3434
|
constructor(e) {
|
|
3230
3435
|
this.blue = e;
|
|
3231
3436
|
}
|
|
@@ -3237,72 +3442,72 @@ class Di {
|
|
|
3237
3442
|
this.total += e;
|
|
3238
3443
|
}
|
|
3239
3444
|
chargeScopeEntry(e) {
|
|
3240
|
-
this.add(
|
|
3445
|
+
this.add(ci(this.scopeDepth(e)));
|
|
3241
3446
|
}
|
|
3242
3447
|
chargeInitialization() {
|
|
3243
|
-
this.add(
|
|
3448
|
+
this.add(Qo);
|
|
3244
3449
|
}
|
|
3245
3450
|
chargeChannelMatchAttempt() {
|
|
3246
|
-
this.add(
|
|
3451
|
+
this.add(Yo);
|
|
3247
3452
|
}
|
|
3248
3453
|
chargeHandlerOverhead() {
|
|
3249
|
-
this.add(
|
|
3454
|
+
this.add(Zo);
|
|
3250
3455
|
}
|
|
3251
3456
|
chargeBoundaryCheck() {
|
|
3252
|
-
this.add(
|
|
3457
|
+
this.add(Xo);
|
|
3253
3458
|
}
|
|
3254
3459
|
chargePatchAddOrReplace(e) {
|
|
3255
|
-
this.add(
|
|
3460
|
+
this.add(li(this.payloadSizeCharge(e)));
|
|
3256
3461
|
}
|
|
3257
3462
|
chargePatchRemove() {
|
|
3258
|
-
this.add(
|
|
3463
|
+
this.add(ei);
|
|
3259
3464
|
}
|
|
3260
3465
|
chargeCascadeRouting(e) {
|
|
3261
|
-
e > 0 && this.add(
|
|
3466
|
+
e > 0 && this.add(ui(e));
|
|
3262
3467
|
}
|
|
3263
3468
|
chargeEmitEvent(e) {
|
|
3264
|
-
this.add(
|
|
3469
|
+
this.add(hi(this.payloadSizeCharge(e)));
|
|
3265
3470
|
}
|
|
3266
3471
|
chargeBridge() {
|
|
3267
|
-
this.add(
|
|
3472
|
+
this.add(ti);
|
|
3268
3473
|
}
|
|
3269
3474
|
chargeDrainEvent() {
|
|
3270
|
-
this.add(
|
|
3475
|
+
this.add(ni);
|
|
3271
3476
|
}
|
|
3272
3477
|
chargeCheckpointUpdate() {
|
|
3273
|
-
this.add(
|
|
3478
|
+
this.add(ri);
|
|
3274
3479
|
}
|
|
3275
3480
|
chargeTerminationMarker() {
|
|
3276
|
-
this.add(
|
|
3481
|
+
this.add(oi);
|
|
3277
3482
|
}
|
|
3278
3483
|
chargeLifecycleDelivery() {
|
|
3279
|
-
this.add(
|
|
3484
|
+
this.add(ii);
|
|
3280
3485
|
}
|
|
3281
3486
|
chargeFatalTerminationOverhead() {
|
|
3282
|
-
this.add(
|
|
3487
|
+
this.add(ai);
|
|
3283
3488
|
}
|
|
3284
3489
|
chargeTriggerEventBase() {
|
|
3285
|
-
this.add(
|
|
3490
|
+
this.add(si);
|
|
3286
3491
|
}
|
|
3287
3492
|
chargeUpdateDocumentBase(e) {
|
|
3288
|
-
this.add(
|
|
3493
|
+
this.add(jo(e));
|
|
3289
3494
|
}
|
|
3290
3495
|
chargeDocumentSnapshot(e, t) {
|
|
3291
|
-
const n = t ?
|
|
3292
|
-
this.add(
|
|
3496
|
+
const n = t ? Le(this.blue, t) : 0;
|
|
3497
|
+
this.add(Jo(e, n));
|
|
3293
3498
|
}
|
|
3294
3499
|
chargeWasmGas(e) {
|
|
3295
|
-
const t =
|
|
3500
|
+
const t = en(e);
|
|
3296
3501
|
t > 0 && this.add(t);
|
|
3297
3502
|
}
|
|
3298
3503
|
payloadSizeCharge(e) {
|
|
3299
3504
|
if (!e)
|
|
3300
3505
|
return 0;
|
|
3301
|
-
const t =
|
|
3302
|
-
return
|
|
3506
|
+
const t = Le(this.blue, e);
|
|
3507
|
+
return _t(t);
|
|
3303
3508
|
}
|
|
3304
3509
|
scopeDepth(e) {
|
|
3305
|
-
const t =
|
|
3510
|
+
const t = w(e);
|
|
3306
3511
|
if (t === "/" || t.length <= 1)
|
|
3307
3512
|
return 0;
|
|
3308
3513
|
let n = 1;
|
|
@@ -3311,12 +3516,12 @@ class Di {
|
|
|
3311
3516
|
return n;
|
|
3312
3517
|
}
|
|
3313
3518
|
}
|
|
3314
|
-
class
|
|
3519
|
+
class pi {
|
|
3315
3520
|
constructor(e, t) {
|
|
3316
|
-
this.documentRef = e, this.blueRef = t, this.patchEngine = new
|
|
3521
|
+
this.documentRef = e, this.blueRef = t, this.patchEngine = new zo(this.documentRef), this.meter = new di(this.blueRef);
|
|
3317
3522
|
}
|
|
3318
3523
|
patchEngine;
|
|
3319
|
-
emissionRegistry = new
|
|
3524
|
+
emissionRegistry = new qo();
|
|
3320
3525
|
meter;
|
|
3321
3526
|
runTerminated = !1;
|
|
3322
3527
|
document() {
|
|
@@ -3365,15 +3570,15 @@ class Bi {
|
|
|
3365
3570
|
return this.patchEngine.applyPatch(e, t);
|
|
3366
3571
|
}
|
|
3367
3572
|
}
|
|
3368
|
-
const
|
|
3369
|
-
class
|
|
3573
|
+
const fi = S["Core/Processing Initialized Marker"], mi = S["Core/Document Update"];
|
|
3574
|
+
class gi {
|
|
3370
3575
|
constructor(e, t, n, r) {
|
|
3371
|
-
this.contractLoader = e, this.registry = t, this.runtimeRef = new
|
|
3372
|
-
const
|
|
3373
|
-
this.checkpointManager = new
|
|
3576
|
+
this.contractLoader = e, this.registry = t, this.runtimeRef = new pi(r, n);
|
|
3577
|
+
const i = (s) => Ct(this.runtimeRef.blue(), s);
|
|
3578
|
+
this.checkpointManager = new To(
|
|
3374
3579
|
this.runtimeRef,
|
|
3375
|
-
|
|
3376
|
-
), this.terminationService = new
|
|
3580
|
+
i
|
|
3581
|
+
), this.terminationService = new xo(this.runtimeRef), this.channelRunner = new Po(
|
|
3377
3582
|
this.runtimeRef,
|
|
3378
3583
|
this.checkpointManager,
|
|
3379
3584
|
{
|
|
@@ -3390,9 +3595,9 @@ class Li {
|
|
|
3390
3595
|
const c = this.lookupHandlerProcessor(s);
|
|
3391
3596
|
if (!c) {
|
|
3392
3597
|
const h = `No processor registered for handler contract ${s.blueId()}`;
|
|
3393
|
-
throw new
|
|
3598
|
+
throw new E(
|
|
3394
3599
|
h,
|
|
3395
|
-
|
|
3600
|
+
C.illegalState(h)
|
|
3396
3601
|
);
|
|
3397
3602
|
}
|
|
3398
3603
|
const u = c.matches;
|
|
@@ -3400,10 +3605,10 @@ class Li {
|
|
|
3400
3605
|
},
|
|
3401
3606
|
executeHandler: async (s, a) => this.executeHandler(s, a),
|
|
3402
3607
|
handleHandlerError: async (s, a, c) => this.handleHandlerError(s, a, c),
|
|
3403
|
-
canonicalSignature:
|
|
3608
|
+
canonicalSignature: i,
|
|
3404
3609
|
channelProcessorFor: (s) => this.lookupChannelProcessor(s)
|
|
3405
3610
|
}
|
|
3406
|
-
), this.scopeExecutor = new
|
|
3611
|
+
), this.scopeExecutor = new Do({
|
|
3407
3612
|
runtime: this.runtimeRef,
|
|
3408
3613
|
contractLoader: this.contractLoader,
|
|
3409
3614
|
channelRunner: this.channelRunner,
|
|
@@ -3453,19 +3658,19 @@ class Li {
|
|
|
3453
3658
|
r
|
|
3454
3659
|
);
|
|
3455
3660
|
}
|
|
3456
|
-
createContext(e, t, n, r = !1,
|
|
3457
|
-
return new
|
|
3661
|
+
createContext(e, t, n, r = !1, i = !1) {
|
|
3662
|
+
return new Ei(
|
|
3458
3663
|
this,
|
|
3459
3664
|
t,
|
|
3460
3665
|
e,
|
|
3461
3666
|
n.clone(),
|
|
3462
3667
|
r,
|
|
3463
|
-
|
|
3668
|
+
i
|
|
3464
3669
|
);
|
|
3465
3670
|
}
|
|
3466
3671
|
result() {
|
|
3467
3672
|
const e = this.runtimeRef.document().clone(), t = this.runtimeRef.rootEmissions().map((n) => n.clone());
|
|
3468
|
-
return
|
|
3673
|
+
return Ze.of(
|
|
3469
3674
|
e,
|
|
3470
3675
|
t,
|
|
3471
3676
|
this.runtimeRef.totalGas()
|
|
@@ -3475,10 +3680,10 @@ class Li {
|
|
|
3475
3680
|
return this.runtimeRef;
|
|
3476
3681
|
}
|
|
3477
3682
|
bundleForScope(e) {
|
|
3478
|
-
return this.bundles.get(
|
|
3683
|
+
return this.bundles.get(w(e));
|
|
3479
3684
|
}
|
|
3480
3685
|
isScopeInactive(e) {
|
|
3481
|
-
const t =
|
|
3686
|
+
const t = w(e);
|
|
3482
3687
|
return this.cutOffScopes.has(t) || this.pendingTerminations.has(t) || this.runtimeRef.isScopeTerminated(t);
|
|
3483
3688
|
}
|
|
3484
3689
|
async enterGracefulTermination(e, t, n) {
|
|
@@ -3488,13 +3693,13 @@ class Li {
|
|
|
3488
3693
|
await this.terminate(e, t, "FATAL", n);
|
|
3489
3694
|
}
|
|
3490
3695
|
recordPendingTermination(e, t, n) {
|
|
3491
|
-
this.pendingTerminations.set(
|
|
3696
|
+
this.pendingTerminations.set(w(e), { kind: t, reason: n });
|
|
3492
3697
|
}
|
|
3493
3698
|
clearPendingTermination(e) {
|
|
3494
|
-
this.pendingTerminations.delete(
|
|
3699
|
+
this.pendingTerminations.delete(w(e));
|
|
3495
3700
|
}
|
|
3496
3701
|
async markCutOff(e) {
|
|
3497
|
-
const t =
|
|
3702
|
+
const t = w(e);
|
|
3498
3703
|
this.cutOffScopes.add(t) && this.runtimeRef.existingScope(t)?.markCutOff();
|
|
3499
3704
|
}
|
|
3500
3705
|
async deliverLifecycle(e, t, n, r) {
|
|
@@ -3509,14 +3714,14 @@ class Li {
|
|
|
3509
3714
|
this.runtimeRef.scope(e).recordBridgeable(t.clone()), e === "/" && this.runtimeRef.recordRootEmission(t.clone());
|
|
3510
3715
|
}
|
|
3511
3716
|
normalizeScope(e) {
|
|
3512
|
-
return
|
|
3717
|
+
return w(e);
|
|
3513
3718
|
}
|
|
3514
3719
|
resolvePointer(e, t) {
|
|
3515
|
-
return
|
|
3720
|
+
return k(e, t);
|
|
3516
3721
|
}
|
|
3517
3722
|
async terminate(e, t, n, r) {
|
|
3518
|
-
const
|
|
3519
|
-
this.pendingTerminations.has(
|
|
3723
|
+
const i = w(e);
|
|
3724
|
+
this.pendingTerminations.has(i) || this.runtimeRef.isScopeTerminated(i) || (this.pendingTerminations.set(i, { kind: n, reason: r }), await this.terminationService.terminateScope(
|
|
3520
3725
|
this,
|
|
3521
3726
|
e,
|
|
3522
3727
|
t,
|
|
@@ -3525,14 +3730,14 @@ class Li {
|
|
|
3525
3730
|
));
|
|
3526
3731
|
}
|
|
3527
3732
|
nodeAt(e) {
|
|
3528
|
-
const t =
|
|
3529
|
-
return
|
|
3733
|
+
const t = w(e);
|
|
3734
|
+
return se.nodeAt(this.runtimeRef.document(), t, {
|
|
3530
3735
|
calculateBlueId: (n) => this.runtimeRef.blue().calculateBlueIdSync(n)
|
|
3531
3736
|
});
|
|
3532
3737
|
}
|
|
3533
3738
|
async evaluateChannel(e, t, n, r) {
|
|
3534
|
-
const
|
|
3535
|
-
if (!
|
|
3739
|
+
const i = this.lookupChannelProcessor(e.node());
|
|
3740
|
+
if (!i)
|
|
3536
3741
|
return { matches: !1 };
|
|
3537
3742
|
const s = this.runtimeRef.blue().calculateBlueIdSync(r), a = r.clone(), c = e.contract(), u = c.event;
|
|
3538
3743
|
if (u && !this.runtimeRef.blue().isTypeOfNode(a, u))
|
|
@@ -3543,27 +3748,27 @@ class Li {
|
|
|
3543
3748
|
event: a,
|
|
3544
3749
|
markers: t.markers(),
|
|
3545
3750
|
bindingKey: e.key(),
|
|
3546
|
-
resolveChannel: (
|
|
3547
|
-
channelProcessorFor: (
|
|
3548
|
-
}, d =
|
|
3751
|
+
resolveChannel: (y) => t.channelEntry(y),
|
|
3752
|
+
channelProcessorFor: (y) => this.lookupChannelProcessor(y)
|
|
3753
|
+
}, d = i.evaluate;
|
|
3549
3754
|
if (typeof d == "function")
|
|
3550
|
-
return await d.call(
|
|
3551
|
-
if (!await
|
|
3755
|
+
return await d.call(i, c, h);
|
|
3756
|
+
if (!await i.matches(c, h))
|
|
3552
3757
|
return { matches: !1 };
|
|
3553
|
-
const f =
|
|
3758
|
+
const f = i.channelize, g = f ? f.call(i, c, h) : void 0;
|
|
3554
3759
|
return {
|
|
3555
3760
|
matches: !0,
|
|
3556
3761
|
eventId: s,
|
|
3557
|
-
eventNode:
|
|
3762
|
+
eventNode: g ?? a.clone()
|
|
3558
3763
|
};
|
|
3559
3764
|
}
|
|
3560
3765
|
async executeHandler(e, t) {
|
|
3561
3766
|
const n = this.lookupHandlerProcessor(e);
|
|
3562
3767
|
if (!n) {
|
|
3563
3768
|
const r = `No processor registered for handler contract ${e.blueId()}`;
|
|
3564
|
-
throw new
|
|
3769
|
+
throw new E(
|
|
3565
3770
|
r,
|
|
3566
|
-
|
|
3771
|
+
C.illegalState(r)
|
|
3567
3772
|
);
|
|
3568
3773
|
}
|
|
3569
3774
|
await n.execute(e.contract(), t, {
|
|
@@ -3577,7 +3782,7 @@ class Li {
|
|
|
3577
3782
|
* the outer run logic can react according to spec (§22).
|
|
3578
3783
|
*/
|
|
3579
3784
|
async handleHandlerError(e, t, n) {
|
|
3580
|
-
if (n instanceof
|
|
3785
|
+
if (n instanceof ie || n instanceof F)
|
|
3581
3786
|
throw n;
|
|
3582
3787
|
const r = this.fatalReason(n, "Runtime fatal");
|
|
3583
3788
|
await this.enterFatalTermination(e, t, r);
|
|
@@ -3595,30 +3800,30 @@ class Li {
|
|
|
3595
3800
|
return this.registry.lookupChannelForNode(this.runtimeRef.blue(), e) ?? null;
|
|
3596
3801
|
}
|
|
3597
3802
|
createDocumentUpdateEvent(e, t) {
|
|
3598
|
-
const n =
|
|
3599
|
-
new p().setBlueId(
|
|
3803
|
+
const n = dn(t, e.path), r = e.before != null ? e.before.clone() : new p().setValue(null), i = e.after != null ? e.after.clone() : new p().setValue(null), s = new p().setType(
|
|
3804
|
+
new p().setBlueId(mi)
|
|
3600
3805
|
);
|
|
3601
3806
|
return s.setProperties({
|
|
3602
3807
|
op: new p().setValue(e.op),
|
|
3603
3808
|
path: new p().setValue(n),
|
|
3604
3809
|
before: r,
|
|
3605
|
-
after:
|
|
3810
|
+
after: i
|
|
3606
3811
|
}), s;
|
|
3607
3812
|
}
|
|
3608
3813
|
matchesDocumentUpdate(e, t, n) {
|
|
3609
3814
|
if (!t || t.length === 0)
|
|
3610
3815
|
return !1;
|
|
3611
|
-
const r =
|
|
3612
|
-
return r === "/" ||
|
|
3816
|
+
const r = R(k(e, t)), i = R(n);
|
|
3817
|
+
return r === "/" || i === r ? !0 : i.startsWith(`${r}/`);
|
|
3613
3818
|
}
|
|
3614
3819
|
}
|
|
3615
|
-
class
|
|
3820
|
+
class se {
|
|
3616
3821
|
constructor(e, t, n) {
|
|
3617
3822
|
this.contractLoader = e, this.registry = t, this.blue = n;
|
|
3618
3823
|
}
|
|
3619
3824
|
async initializeDocument(e) {
|
|
3620
3825
|
if (this.isInitialized(e))
|
|
3621
|
-
throw new
|
|
3826
|
+
throw new K("Document already initialized");
|
|
3622
3827
|
const t = this.createExecution(e.clone());
|
|
3623
3828
|
return this.run(e, t, async () => {
|
|
3624
3829
|
await t.initializeScope("/", !0);
|
|
@@ -3626,7 +3831,7 @@ class re {
|
|
|
3626
3831
|
}
|
|
3627
3832
|
async processDocument(e, t) {
|
|
3628
3833
|
if (!this.isInitialized(e))
|
|
3629
|
-
throw new
|
|
3834
|
+
throw new K("Document not initialized");
|
|
3630
3835
|
const n = this.createExecution(e.clone()), r = t.clone();
|
|
3631
3836
|
return this.run(e, n, async () => {
|
|
3632
3837
|
n.loadBundles("/"), await n.processExternalEvent("/", r);
|
|
@@ -3636,7 +3841,7 @@ class re {
|
|
|
3636
3841
|
return this.initializationMarker(e) != null;
|
|
3637
3842
|
}
|
|
3638
3843
|
createExecution(e) {
|
|
3639
|
-
return new
|
|
3844
|
+
return new gi(
|
|
3640
3845
|
this.contractLoader,
|
|
3641
3846
|
this.registry,
|
|
3642
3847
|
this.blue,
|
|
@@ -3647,12 +3852,12 @@ class re {
|
|
|
3647
3852
|
try {
|
|
3648
3853
|
await n();
|
|
3649
3854
|
} catch (r) {
|
|
3650
|
-
if (r instanceof
|
|
3855
|
+
if (r instanceof ie)
|
|
3651
3856
|
return t.result();
|
|
3652
|
-
if (r instanceof
|
|
3653
|
-
const
|
|
3654
|
-
return
|
|
3655
|
-
|
|
3857
|
+
if (r instanceof F) {
|
|
3858
|
+
const i = e.clone();
|
|
3859
|
+
return Ze.capabilityFailure(
|
|
3860
|
+
i,
|
|
3656
3861
|
r.message ?? null
|
|
3657
3862
|
);
|
|
3658
3863
|
}
|
|
@@ -3661,20 +3866,20 @@ class re {
|
|
|
3661
3866
|
return t.result();
|
|
3662
3867
|
}
|
|
3663
3868
|
initializationMarker(e) {
|
|
3664
|
-
const n = e.getProperties()?.[
|
|
3869
|
+
const n = e.getProperties()?.[Ne.OBJECT_CONTRACTS]?.getProperties()?.initialized ?? null;
|
|
3665
3870
|
if (!n)
|
|
3666
3871
|
return null;
|
|
3667
3872
|
if (!(n instanceof p))
|
|
3668
|
-
throw new
|
|
3873
|
+
throw new E(
|
|
3669
3874
|
"Initialization Marker must be a BlueNode",
|
|
3670
|
-
|
|
3875
|
+
C.illegalState(
|
|
3671
3876
|
"Initialization Marker must be a BlueNode"
|
|
3672
3877
|
)
|
|
3673
3878
|
);
|
|
3674
|
-
if (n.getType()?.getBlueId() !==
|
|
3675
|
-
throw new
|
|
3879
|
+
if (n.getType()?.getBlueId() !== fi)
|
|
3880
|
+
throw new E(
|
|
3676
3881
|
"Initialization Marker must declare type 'Processing Initialized Marker'",
|
|
3677
|
-
|
|
3882
|
+
C.illegalState(
|
|
3678
3883
|
"Initialization Marker must declare type 'Processing Initialized Marker'"
|
|
3679
3884
|
)
|
|
3680
3885
|
);
|
|
@@ -3683,12 +3888,12 @@ class re {
|
|
|
3683
3888
|
static nodeAt(e, t, n) {
|
|
3684
3889
|
if (!(e instanceof p))
|
|
3685
3890
|
return null;
|
|
3686
|
-
const r =
|
|
3891
|
+
const r = R(t);
|
|
3687
3892
|
if (r === "/")
|
|
3688
3893
|
return e;
|
|
3689
|
-
const
|
|
3894
|
+
const i = r.slice(1).split("/");
|
|
3690
3895
|
let s = e;
|
|
3691
|
-
for (const a of
|
|
3896
|
+
for (const a of i) {
|
|
3692
3897
|
if (!s)
|
|
3693
3898
|
return null;
|
|
3694
3899
|
if (!a)
|
|
@@ -3734,10 +3939,17 @@ class re {
|
|
|
3734
3939
|
return new p().setValue(e.getValue() ?? null);
|
|
3735
3940
|
case "blue":
|
|
3736
3941
|
return e.getBlue() ?? null;
|
|
3737
|
-
case
|
|
3942
|
+
case Ne.OBJECT_CONTRACTS:
|
|
3738
3943
|
return new p().setContracts(e.getContracts());
|
|
3739
3944
|
case "blueId": {
|
|
3740
|
-
const r =
|
|
3945
|
+
const r = n?.calculateBlueId?.(e);
|
|
3946
|
+
if (r === void 0)
|
|
3947
|
+
throw new E(
|
|
3948
|
+
"ProcessorEngine.nodeAt requires a semantic calculateBlueId option for /blueId.",
|
|
3949
|
+
C.illegalState(
|
|
3950
|
+
"ProcessorEngine.nodeAt requires a semantic calculateBlueId option for /blueId."
|
|
3951
|
+
)
|
|
3952
|
+
);
|
|
3741
3953
|
return new p().setValue(r ?? null);
|
|
3742
3954
|
}
|
|
3743
3955
|
default:
|
|
@@ -3745,9 +3957,9 @@ class re {
|
|
|
3745
3957
|
}
|
|
3746
3958
|
}
|
|
3747
3959
|
}
|
|
3748
|
-
class
|
|
3749
|
-
constructor(e, t, n, r,
|
|
3750
|
-
this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork =
|
|
3960
|
+
class Ei {
|
|
3961
|
+
constructor(e, t, n, r, i, s) {
|
|
3962
|
+
this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = i, this.allowReservedMutation = s;
|
|
3751
3963
|
}
|
|
3752
3964
|
get scopePath() {
|
|
3753
3965
|
return this.scopePathValue;
|
|
@@ -3781,7 +3993,7 @@ class Fi {
|
|
|
3781
3993
|
this.shouldSkipTerminatedWork() || this.execution.runtime().addGas(e);
|
|
3782
3994
|
}
|
|
3783
3995
|
throwFatal(e) {
|
|
3784
|
-
throw new
|
|
3996
|
+
throw new E(e, C.runtimeFatal(e));
|
|
3785
3997
|
}
|
|
3786
3998
|
resolvePointer(e) {
|
|
3787
3999
|
return this.execution.resolvePointer(this.scopePathValue, e);
|
|
@@ -3800,7 +4012,7 @@ class Fi {
|
|
|
3800
4012
|
if (!e)
|
|
3801
4013
|
return !1;
|
|
3802
4014
|
try {
|
|
3803
|
-
return
|
|
4015
|
+
return se.nodeAt(
|
|
3804
4016
|
this.execution.runtime().document(),
|
|
3805
4017
|
e,
|
|
3806
4018
|
{
|
|
@@ -3812,7 +4024,7 @@ class Fi {
|
|
|
3812
4024
|
}
|
|
3813
4025
|
}
|
|
3814
4026
|
documentNodeAt(e) {
|
|
3815
|
-
const t =
|
|
4027
|
+
const t = se.nodeAt(
|
|
3816
4028
|
this.execution.runtime().document(),
|
|
3817
4029
|
e,
|
|
3818
4030
|
{
|
|
@@ -3839,16 +4051,17 @@ class Fi {
|
|
|
3839
4051
|
return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
|
|
3840
4052
|
}
|
|
3841
4053
|
}
|
|
3842
|
-
const
|
|
3843
|
-
repositories: [
|
|
4054
|
+
const yi = new $t({
|
|
4055
|
+
repositories: [at],
|
|
4056
|
+
mergingProcessor: st()
|
|
3844
4057
|
});
|
|
3845
|
-
class
|
|
4058
|
+
class Ci {
|
|
3846
4059
|
blue;
|
|
3847
4060
|
registryRef;
|
|
3848
4061
|
contractLoaderRef;
|
|
3849
4062
|
engine;
|
|
3850
4063
|
constructor(e) {
|
|
3851
|
-
this.registryRef = e?.registry ??
|
|
4064
|
+
this.registryRef = e?.registry ?? ue.create().registerDefaults().build(), this.blue = e?.blue ?? yi, this.contractLoaderRef = new vo(this.registryRef, this.blue), this.engine = new se(
|
|
3852
4065
|
this.contractLoaderRef,
|
|
3853
4066
|
this.registryRef,
|
|
3854
4067
|
this.blue
|
|
@@ -3881,14 +4094,14 @@ class Ui {
|
|
|
3881
4094
|
return this.contractLoaderRef;
|
|
3882
4095
|
}
|
|
3883
4096
|
static builder() {
|
|
3884
|
-
return new
|
|
4097
|
+
return new Si();
|
|
3885
4098
|
}
|
|
3886
4099
|
}
|
|
3887
|
-
class
|
|
4100
|
+
class Si {
|
|
3888
4101
|
contractRegistry;
|
|
3889
4102
|
blueInstance;
|
|
3890
4103
|
constructor() {
|
|
3891
|
-
this.contractRegistry =
|
|
4104
|
+
this.contractRegistry = ue.create().registerDefaults().build();
|
|
3892
4105
|
}
|
|
3893
4106
|
withRegistry(e) {
|
|
3894
4107
|
return this.contractRegistry = e, this;
|
|
@@ -3900,145 +4113,117 @@ class zi {
|
|
|
3900
4113
|
return this.blueInstance = e, this;
|
|
3901
4114
|
}
|
|
3902
4115
|
build() {
|
|
3903
|
-
return new
|
|
4116
|
+
return new Ci({
|
|
3904
4117
|
registry: this.contractRegistry,
|
|
3905
4118
|
blue: this.blueInstance
|
|
3906
4119
|
});
|
|
3907
4120
|
}
|
|
3908
4121
|
}
|
|
3909
|
-
|
|
3910
|
-
process(e, t) {
|
|
3911
|
-
const n = t.getValue();
|
|
3912
|
-
if (ee(n)) {
|
|
3913
|
-
const r = t.clone();
|
|
3914
|
-
return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
|
|
3915
|
-
}
|
|
3916
|
-
return e;
|
|
3917
|
-
}
|
|
3918
|
-
/**
|
|
3919
|
-
* Post-process to ensure expressions aren't overridden by subsequent processors
|
|
3920
|
-
*/
|
|
3921
|
-
postProcess(e, t) {
|
|
3922
|
-
const n = t.getValue();
|
|
3923
|
-
if (ee(n) && e.getValue() !== n && n !== void 0) {
|
|
3924
|
-
const r = e.clone();
|
|
3925
|
-
return r.setValue(n), r;
|
|
3926
|
-
}
|
|
3927
|
-
return e;
|
|
3928
|
-
}
|
|
3929
|
-
}
|
|
3930
|
-
const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4122
|
+
const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3931
4123
|
__proto__: null,
|
|
3932
|
-
ExpressionPreserver:
|
|
4124
|
+
ExpressionPreserver: it
|
|
3933
4125
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3934
|
-
function ho() {
|
|
3935
|
-
return new B.SequentialMergingProcessor([
|
|
3936
|
-
new B.ValuePropagator(),
|
|
3937
|
-
new vt(),
|
|
3938
|
-
new B.TypeAssigner(),
|
|
3939
|
-
new B.ListProcessor(),
|
|
3940
|
-
new B.DictionaryProcessor(),
|
|
3941
|
-
new B.MetadataPropagator(),
|
|
3942
|
-
new B.BasicTypesVerifier()
|
|
3943
|
-
]);
|
|
3944
|
-
}
|
|
3945
4126
|
export {
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4127
|
+
Pt as ActorPolicyLiteralValidationError,
|
|
4128
|
+
Xr as ChannelBinding,
|
|
4129
|
+
Po as ChannelRunner,
|
|
4130
|
+
To as CheckpointManager,
|
|
4131
|
+
ko as CheckpointRecord,
|
|
4132
|
+
Xe as CodeBlockEvaluationError,
|
|
4133
|
+
W as ContractBundle,
|
|
4134
|
+
to as ContractBundleBuilder,
|
|
4135
|
+
vo as ContractLoader,
|
|
4136
|
+
pr as ContractProcessorRegistry,
|
|
4137
|
+
ue as ContractProcessorRegistryBuilder,
|
|
4138
|
+
Ze as DocumentProcessingResult,
|
|
4139
|
+
pi as DocumentProcessingRuntime,
|
|
4140
|
+
Ci as DocumentProcessor,
|
|
4141
|
+
Si as DocumentProcessorBuilder,
|
|
4142
|
+
qo as EmissionRegistry,
|
|
4143
|
+
di as GasMeter,
|
|
4144
|
+
eo as HandlerBinding,
|
|
4145
|
+
D as KEY_CHECKPOINT,
|
|
4146
|
+
ct as KEY_EMBEDDED,
|
|
4147
|
+
lt as KEY_INITIALIZED,
|
|
4148
|
+
ut as KEY_TERMINATED,
|
|
4149
|
+
Hi as MergingProcessors,
|
|
4150
|
+
Ie as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
|
|
4151
|
+
zo as PatchEngine,
|
|
4152
|
+
Fi as ProcessorContractConstants,
|
|
4153
|
+
se as ProcessorEngine,
|
|
4154
|
+
C as ProcessorErrors,
|
|
4155
|
+
gi as ProcessorExecution,
|
|
4156
|
+
Ei as ProcessorExecutionContext,
|
|
4157
|
+
E as ProcessorFatalError,
|
|
4158
|
+
$i as ProcessorPointerConstants,
|
|
4159
|
+
ke as QuickJSEvaluator,
|
|
4160
|
+
pt as RELATIVE_CHECKPOINT,
|
|
4161
|
+
G as RELATIVE_CONTRACTS,
|
|
4162
|
+
hn as RELATIVE_EMBEDDED,
|
|
4163
|
+
ye as RELATIVE_INITIALIZED,
|
|
4164
|
+
dt as RELATIVE_TERMINATED,
|
|
4165
|
+
be as RESERVED_CONTRACT_KEYS,
|
|
4166
|
+
ie as RunTerminationError,
|
|
4167
|
+
Do as ScopeExecutor,
|
|
4168
|
+
Wo as ScopeRuntimeContext,
|
|
4169
|
+
xo as TerminationService,
|
|
4170
|
+
Tt as actorPolicyMarkerSchema,
|
|
4171
|
+
$n as actorPolicyRuleSchema,
|
|
4172
|
+
Di as andThen,
|
|
4173
|
+
Ct as canonicalSignature,
|
|
4174
|
+
Le as canonicalSize,
|
|
4175
|
+
U as channelContractBaseSchema,
|
|
4176
|
+
Hn as channelEventCheckpointSchema,
|
|
4177
|
+
bt as compositeTimelineChannelSchema,
|
|
4178
|
+
on as containsExpression,
|
|
4179
|
+
Te as contractBaseSchema,
|
|
4180
|
+
st as createDefaultMergingProcessor,
|
|
4181
|
+
ot as createPicomatchShouldResolve,
|
|
4182
|
+
Xn as documentAnchorsMarkerSchema,
|
|
4183
|
+
nr as documentLinksMarkerSchema,
|
|
4184
|
+
Tn as documentUpdateChannelSchema,
|
|
4185
|
+
Rn as embeddedNodeChannelSchema,
|
|
4186
|
+
qt as err,
|
|
4187
|
+
rt as evaluateQuickJSExpression,
|
|
4188
|
+
sn as extractExpressionContent,
|
|
4189
|
+
vt as handlerContractBaseSchema,
|
|
4190
|
+
Wn as initializationMarkerSchema,
|
|
4191
|
+
Ni as isErr,
|
|
4192
|
+
ne as isExpression,
|
|
4193
|
+
Oi as isOk,
|
|
4194
|
+
ht as isProcessorManagedChannelBlueId,
|
|
4195
|
+
un as isReservedContractKey,
|
|
4196
|
+
Ui as joinRelativePointers,
|
|
4197
|
+
zi as jsonPatchSchema,
|
|
4198
|
+
On as lifecycleChannelSchema,
|
|
4199
|
+
Ai as map,
|
|
4200
|
+
Bi as mapErr,
|
|
4201
|
+
M as markerContractBaseSchema,
|
|
4202
|
+
xi as match,
|
|
4203
|
+
or as myosParticipantsOrchestrationMarkerSchema,
|
|
4204
|
+
sr as myosSessionInteractionMarkerSchema,
|
|
4205
|
+
_n as myosTimelineChannelSchema,
|
|
4206
|
+
cr as myosWorkerAgencyMarkerSchema,
|
|
4207
|
+
R as normalizePointer,
|
|
4208
|
+
w as normalizeScope,
|
|
4209
|
+
Wt as ok,
|
|
4210
|
+
Qn as operationMarkerSchema,
|
|
4211
|
+
Gn as processEmbeddedMarkerSchema,
|
|
4212
|
+
Jn as processingTerminatedMarkerSchema,
|
|
4213
|
+
gt as relativeCheckpointLastEvent,
|
|
4214
|
+
Et as relativeCheckpointLastSignature,
|
|
4215
|
+
ae as relativeContractsEntry,
|
|
4216
|
+
dn as relativizePointer,
|
|
4217
|
+
re as resolveNodeExpressions,
|
|
4218
|
+
k as resolvePointer,
|
|
4219
|
+
an as resolveTemplateString,
|
|
4220
|
+
hr as sequentialWorkflowOperationSchema,
|
|
4221
|
+
lr as sequentialWorkflowSchema,
|
|
4222
|
+
Vi as sequentialWorkflowStepSchema,
|
|
4223
|
+
De as stripSlashes,
|
|
4224
|
+
Bn as timelineChannelSchema,
|
|
4225
|
+
An as triggeredEventChannelSchema,
|
|
4226
|
+
_i as unwrapOr,
|
|
4227
|
+
Li as unwrapOrElse,
|
|
4228
|
+
zn as validateActorPolicyNode
|
|
4044
4229
|
};
|