@blue-labs/document-processor 3.0.0 → 3.1.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/index.js +994 -1070
- 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/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/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 +2 -2
- 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/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/steps/javascript-code-step-executor.d.ts +6 -0
- package/dist/registry/processors/steps/javascript-code-step-executor.d.ts.map +1 -1
- package/dist/registry/processors/steps/trigger-event-step-executor.d.ts.map +1 -1
- package/dist/registry/processors/steps/update-document-step-executor.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/types.d.ts.map +1 -1
- package/dist/runtime/gas-helpers.d.ts +0 -3
- package/dist/runtime/gas-helpers.d.ts.map +1 -1
- package/dist/runtime/gas-meter.d.ts +1 -3
- package/dist/runtime/gas-meter.d.ts.map +1 -1
- package/dist/runtime/gas-schedule.d.ts +8 -0
- package/dist/runtime/gas-schedule.d.ts.map +1 -0
- package/dist/util/expression/quickjs-config.d.ts +2 -0
- package/dist/util/expression/quickjs-config.d.ts.map +1 -0
- package/dist/util/expression/quickjs-evaluator.d.ts +23 -22
- package/dist/util/expression/quickjs-evaluator.d.ts.map +1 -1
- package/dist/util/expression/quickjs-expression-utils.d.ts +3 -3
- package/dist/util/expression/quickjs-expression-utils.d.ts.map +1 -1
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { evaluate as Et } from "@blue-quickjs/quickjs-runtime";
|
|
2
|
+
import { validateDv as yt, DV_LIMIT_DEFAULTS as St } from "@blue-quickjs/dv";
|
|
3
|
+
import { HOST_V1_MANIFEST as Ct, HOST_V1_HASH as wt } from "@blue-quickjs/abi-manifest";
|
|
4
|
+
import { BlueNode as h, withTypeBlueId as m, blueNodeField as v, Properties as Ce, BlueIdCalculator as vt, Blue as kt, MergingProcessors as D } from "@blue-labs/language";
|
|
3
5
|
import we from "picomatch";
|
|
4
|
-
import { z as l, ZodError as
|
|
5
|
-
import { isNullable as
|
|
6
|
-
import { repository as
|
|
7
|
-
function
|
|
6
|
+
import { z as l, ZodError as Ue } from "zod";
|
|
7
|
+
import { isNullable as le } from "@blue-labs/shared-utils";
|
|
8
|
+
import { repository as bt } from "@blue-repository/types";
|
|
9
|
+
function It(i) {
|
|
8
10
|
return { ok: !0, value: i };
|
|
9
11
|
}
|
|
10
|
-
function
|
|
12
|
+
function Tt(i) {
|
|
11
13
|
return { ok: !1, error: i };
|
|
12
14
|
}
|
|
13
|
-
function
|
|
15
|
+
function Bi(i) {
|
|
14
16
|
return i.ok;
|
|
15
17
|
}
|
|
16
|
-
function
|
|
18
|
+
function Li(i) {
|
|
17
19
|
return !i.ok;
|
|
18
20
|
}
|
|
19
|
-
function
|
|
20
|
-
return i.ok ?
|
|
21
|
+
function _i(i, e) {
|
|
22
|
+
return i.ok ? It(e(i.value)) : i;
|
|
21
23
|
}
|
|
22
|
-
function
|
|
23
|
-
return i.ok ? i :
|
|
24
|
+
function Fi(i, e) {
|
|
25
|
+
return i.ok ? i : Tt(e(i.error));
|
|
24
26
|
}
|
|
25
|
-
function
|
|
27
|
+
function Ui(i, e) {
|
|
26
28
|
return i.ok ? e(i.value) : i;
|
|
27
29
|
}
|
|
28
|
-
function
|
|
30
|
+
function zi(i, e) {
|
|
29
31
|
return i.ok ? i.value : e;
|
|
30
32
|
}
|
|
31
|
-
function
|
|
33
|
+
function $i(i, e) {
|
|
32
34
|
return i.ok ? i.value : e(i.error);
|
|
33
35
|
}
|
|
34
|
-
function
|
|
36
|
+
function Vi(i, e) {
|
|
35
37
|
return i.ok ? e.ok(i.value) : e.err(i.error);
|
|
36
38
|
}
|
|
37
|
-
const
|
|
39
|
+
const E = {
|
|
38
40
|
capabilityFailure(i, e, t) {
|
|
39
41
|
return { kind: "CapabilityFailure", capability: i, reason: e, details: t };
|
|
40
42
|
},
|
|
@@ -54,14 +56,14 @@ const w = {
|
|
|
54
56
|
return { kind: "UnsupportedOp", operation: i, reason: e };
|
|
55
57
|
}
|
|
56
58
|
};
|
|
57
|
-
function
|
|
59
|
+
function Rt(i) {
|
|
58
60
|
return Object.freeze([...i]);
|
|
59
61
|
}
|
|
60
|
-
const
|
|
62
|
+
const Mt = {
|
|
61
63
|
of(i, e, t) {
|
|
62
64
|
return {
|
|
63
65
|
document: i,
|
|
64
|
-
triggeredEvents:
|
|
66
|
+
triggeredEvents: Rt(e),
|
|
65
67
|
totalGas: t,
|
|
66
68
|
capabilityFailure: !1,
|
|
67
69
|
failureReason: null
|
|
@@ -76,7 +78,7 @@ const wt = {
|
|
|
76
78
|
failureReason: e ?? null
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
|
-
},
|
|
81
|
+
}, ze = Mt, p = {
|
|
80
82
|
"Core/Channel": "DcoJyCh7XXxy1nR5xjy7qfkUgQ1GiZnKKSxh8DJusBSr",
|
|
81
83
|
"Core/Channel Event Checkpoint": "B7YQeYdQzUNuzaDQ4tNTd2iJqgd4YnVQkgz4QgymDWWU",
|
|
82
84
|
"Core/Contract": "AERp8BWnuUsjoPciAeNXuUWS9fmqPNMdWbxmKn3tcitx",
|
|
@@ -93,68 +95,68 @@ const wt = {
|
|
|
93
95
|
"Core/Processing Initialized Marker": "EVguxFmq5iFtMZaBQgHfjWDojaoesQ1vEXCQFZ59yL28",
|
|
94
96
|
"Core/Processing Terminated Marker": "5NiEhupJ6uF54Q3vs4GwQX4UX4ExtwHpKRVvjKEHtvjR",
|
|
95
97
|
"Core/Triggered Event Channel": "C77W4kVGcxL7Mkx9WL9QESPEFFL2GzWAe647s1Efprt"
|
|
96
|
-
},
|
|
98
|
+
}, Pt = [
|
|
97
99
|
"embedded",
|
|
98
100
|
"initialized",
|
|
99
101
|
"terminated",
|
|
100
102
|
"checkpoint"
|
|
101
|
-
],
|
|
103
|
+
], Ot = [
|
|
102
104
|
p["Core/Document Update Channel"],
|
|
103
105
|
p["Core/Triggered Event Channel"],
|
|
104
106
|
p["Core/Lifecycle Event Channel"],
|
|
105
107
|
p["Core/Embedded Node Channel"]
|
|
106
|
-
],
|
|
107
|
-
|
|
108
|
-
),
|
|
109
|
-
function
|
|
110
|
-
return i != null &&
|
|
111
|
-
}
|
|
112
|
-
function
|
|
113
|
-
return i != null &&
|
|
108
|
+
], $e = "embedded", Ve = "initialized", He = "terminated", A = "checkpoint", me = new Set(
|
|
109
|
+
Pt
|
|
110
|
+
), We = new Set(Ot);
|
|
111
|
+
function Nt(i) {
|
|
112
|
+
return i != null && me.has(i);
|
|
113
|
+
}
|
|
114
|
+
function fe(i) {
|
|
115
|
+
return i != null && We.has(
|
|
114
116
|
i
|
|
115
117
|
);
|
|
116
118
|
}
|
|
117
|
-
const
|
|
118
|
-
KEY_EMBEDDED:
|
|
119
|
-
KEY_INITIALIZED:
|
|
120
|
-
KEY_TERMINATED:
|
|
121
|
-
KEY_CHECKPOINT:
|
|
122
|
-
RESERVED_CONTRACT_KEYS:
|
|
123
|
-
PROCESSOR_MANAGED_CHANNEL_BLUE_IDS:
|
|
124
|
-
isReservedContractKey:
|
|
125
|
-
isProcessorManagedChannelBlueId:
|
|
126
|
-
},
|
|
127
|
-
function
|
|
128
|
-
return `${
|
|
129
|
-
}
|
|
130
|
-
function qe(i, e) {
|
|
131
|
-
return `${Z(i)}${We}/${e}`;
|
|
119
|
+
const Hi = {
|
|
120
|
+
KEY_EMBEDDED: $e,
|
|
121
|
+
KEY_INITIALIZED: Ve,
|
|
122
|
+
KEY_TERMINATED: He,
|
|
123
|
+
KEY_CHECKPOINT: A,
|
|
124
|
+
RESERVED_CONTRACT_KEYS: me,
|
|
125
|
+
PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: We,
|
|
126
|
+
isReservedContractKey: Nt,
|
|
127
|
+
isProcessorManagedChannelBlueId: fe
|
|
128
|
+
}, F = "/contracts", ue = `${F}/${Ve}`, Ge = `${F}/${He}`, At = `${F}/${$e}`, Ke = `${F}/${A}`, qe = "/lastEvents", Je = "/lastSignatures";
|
|
129
|
+
function ee(i) {
|
|
130
|
+
return `${F}/${i}`;
|
|
132
131
|
}
|
|
133
132
|
function je(i, e) {
|
|
134
|
-
return `${
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
133
|
+
return `${ee(i)}${qe}/${e}`;
|
|
134
|
+
}
|
|
135
|
+
function Qe(i, e) {
|
|
136
|
+
return `${ee(i)}${Je}/${e}`;
|
|
137
|
+
}
|
|
138
|
+
const Wi = {
|
|
139
|
+
RELATIVE_CONTRACTS: F,
|
|
140
|
+
RELATIVE_INITIALIZED: ue,
|
|
141
|
+
RELATIVE_TERMINATED: Ge,
|
|
142
|
+
RELATIVE_EMBEDDED: At,
|
|
143
|
+
RELATIVE_CHECKPOINT: Ke,
|
|
144
|
+
LAST_EVENTS_SUFFIX: qe,
|
|
145
|
+
LAST_SIGNATURES_SUFFIX: Je,
|
|
146
|
+
relativeContractsEntry: ee,
|
|
147
|
+
relativeCheckpointLastEvent: je,
|
|
148
|
+
relativeCheckpointLastSignature: Qe
|
|
147
149
|
};
|
|
148
|
-
function
|
|
150
|
+
function Xe(i) {
|
|
149
151
|
return i == null || i.length === 0;
|
|
150
152
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
153
|
+
function S(i) {
|
|
154
|
+
return Xe(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
|
|
153
155
|
}
|
|
154
156
|
function T(i) {
|
|
155
|
-
return
|
|
157
|
+
return Xe(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
|
|
156
158
|
}
|
|
157
|
-
function
|
|
159
|
+
function ve(i) {
|
|
158
160
|
if (i == null)
|
|
159
161
|
return "";
|
|
160
162
|
let e = i.trim();
|
|
@@ -166,16 +168,16 @@ function Ce(i) {
|
|
|
166
168
|
e = e.substring(0, e.length - 1);
|
|
167
169
|
return e;
|
|
168
170
|
}
|
|
169
|
-
function
|
|
170
|
-
const t =
|
|
171
|
+
function Gi(i, e) {
|
|
172
|
+
const t = ve(i), n = ve(e);
|
|
171
173
|
return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
|
|
172
174
|
}
|
|
173
|
-
function
|
|
174
|
-
const t =
|
|
175
|
+
function b(i, e) {
|
|
176
|
+
const t = S(i), n = T(e);
|
|
175
177
|
return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
|
|
176
178
|
}
|
|
177
|
-
function
|
|
178
|
-
const t =
|
|
179
|
+
function Dt(i, e) {
|
|
180
|
+
const t = S(i), n = T(e);
|
|
179
181
|
if (t === "/" || !n.startsWith(t))
|
|
180
182
|
return n;
|
|
181
183
|
if (n.length === t.length)
|
|
@@ -183,12 +185,12 @@ function kt(i, e) {
|
|
|
183
185
|
const r = n.substring(t.length);
|
|
184
186
|
return r.length === 0 ? "/" : r.startsWith("/") ? r : `/${r}`;
|
|
185
187
|
}
|
|
186
|
-
function
|
|
188
|
+
function xt(i) {
|
|
187
189
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
188
190
|
}
|
|
189
|
-
var
|
|
190
|
-
function
|
|
191
|
-
return
|
|
191
|
+
var oe, ke;
|
|
192
|
+
function Bt() {
|
|
193
|
+
return ke || (ke = 1, oe = function i(e) {
|
|
192
194
|
if (typeof e == "number" && isNaN(e))
|
|
193
195
|
throw new Error("NaN is not allowed");
|
|
194
196
|
if (typeof e == "number" && !isFinite(e))
|
|
@@ -199,360 +201,293 @@ function It() {
|
|
|
199
201
|
const o = n.length === 0 ? "" : ",";
|
|
200
202
|
return `${n}${o}${i(r)}:${i(e[r])}`;
|
|
201
203
|
}, "")}}`;
|
|
202
|
-
}),
|
|
204
|
+
}), oe;
|
|
203
205
|
}
|
|
204
|
-
var
|
|
205
|
-
const
|
|
206
|
-
function
|
|
206
|
+
var Lt = Bt();
|
|
207
|
+
const _t = /* @__PURE__ */ xt(Lt);
|
|
208
|
+
function Ft(i, e) {
|
|
207
209
|
return i.nodeToJson(e, "official");
|
|
208
210
|
}
|
|
209
|
-
function
|
|
210
|
-
const t =
|
|
211
|
-
return
|
|
211
|
+
function Ut(i, e) {
|
|
212
|
+
const t = Ft(i, e);
|
|
213
|
+
return _t(t);
|
|
212
214
|
}
|
|
213
|
-
function
|
|
214
|
-
return e ?
|
|
215
|
+
function Ye(i, e) {
|
|
216
|
+
return e ? Ut(i, e) : null;
|
|
215
217
|
}
|
|
216
|
-
function
|
|
217
|
-
const t =
|
|
218
|
+
function be(i, e) {
|
|
219
|
+
const t = Ye(i, e);
|
|
218
220
|
return t == null ? 0 : new TextEncoder().encode(t).length;
|
|
219
221
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
function
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
222
|
+
const zt = 1700, de = BigInt(
|
|
223
|
+
zt
|
|
224
|
+
), $t = BigInt(Number.MAX_SAFE_INTEGER), Vt = 4e4, Ht = 4e4;
|
|
225
|
+
function Wt(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 + de - 1n) / de;
|
|
237
|
+
return t > $t ? Number.MAX_SAFE_INTEGER : Number(t);
|
|
238
|
+
}
|
|
239
|
+
function Ze(i) {
|
|
240
|
+
const e = BigInt(Math.max(0, Math.trunc(i)));
|
|
241
|
+
return e <= 0n ? 0n : e * de;
|
|
242
|
+
}
|
|
243
|
+
const et = Ze(
|
|
244
|
+
Vt
|
|
245
|
+
), Gt = Ze(
|
|
246
|
+
Ht
|
|
247
|
+
), O = 1, Kt = /* @__PURE__ */ new Set([
|
|
248
|
+
"event",
|
|
249
|
+
"eventCanonical",
|
|
250
|
+
"steps",
|
|
251
|
+
"document",
|
|
252
|
+
"emit"
|
|
253
|
+
]);
|
|
254
|
+
class ge {
|
|
255
|
+
// Serialize evaluations to avoid races when updating host handler bindings.
|
|
256
|
+
evaluationQueue = Promise.resolve();
|
|
257
|
+
handlerState = {
|
|
258
|
+
documentGet: () => ({ ok: null, units: O }),
|
|
259
|
+
documentGetCanonical: () => ({ ok: null, units: O }),
|
|
260
|
+
emit: () => ({ ok: null, units: O })
|
|
261
|
+
};
|
|
262
|
+
handlers = {
|
|
263
|
+
document: {
|
|
264
|
+
get: (e) => this.handlerState.documentGet(e),
|
|
265
|
+
getCanonical: (e) => this.handlerState.documentGetCanonical(e)
|
|
266
|
+
},
|
|
267
|
+
emit: (e) => this.handlerState.emit(e)
|
|
268
|
+
};
|
|
269
|
+
async evaluate(e) {
|
|
270
|
+
const t = this.evaluationQueue.then(() => this.evaluateOnce(e));
|
|
271
|
+
return this.evaluationQueue = t.then(
|
|
272
|
+
() => {
|
|
273
|
+
},
|
|
274
|
+
() => {
|
|
275
|
+
}
|
|
276
|
+
), t;
|
|
271
277
|
}
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
const Bt = 500, Lt = 32 * 1024 * 1024;
|
|
275
|
-
class pe {
|
|
276
|
-
modulePromise;
|
|
277
|
-
moduleInstance;
|
|
278
|
-
async evaluate({
|
|
278
|
+
async evaluateOnce({
|
|
279
279
|
code: e,
|
|
280
280
|
bindings: t,
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
wasmGasLimit: n,
|
|
282
|
+
onWasmGasUsed: r
|
|
283
283
|
}) {
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
const o = this.prepareBindings(t), s = n ?? et, a = {
|
|
285
|
+
code: this.wrapCode(e),
|
|
286
|
+
abiId: "Host.v1",
|
|
287
|
+
abiVersion: 1,
|
|
288
|
+
abiManifestHash: wt
|
|
289
|
+
};
|
|
289
290
|
try {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
|
|
291
|
+
const c = await Et({
|
|
292
|
+
program: a,
|
|
293
|
+
input: o,
|
|
294
|
+
gasLimit: s,
|
|
295
|
+
manifest: Ct,
|
|
296
|
+
handlers: this.handlers
|
|
297
|
+
});
|
|
298
|
+
if (n !== void 0 && r && r({
|
|
299
|
+
used: c.gasUsed,
|
|
300
|
+
remaining: c.gasRemaining
|
|
301
|
+
}), !c.ok)
|
|
302
|
+
throw jt(c);
|
|
303
|
+
return j(c.value);
|
|
304
|
+
} catch (c) {
|
|
305
|
+
throw Qt(c);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
prepareBindings(e) {
|
|
309
|
+
const t = e ?? {};
|
|
310
|
+
qt(t);
|
|
311
|
+
const n = se(t.event, null, "event"), r = se(
|
|
312
|
+
t.eventCanonical ?? n,
|
|
313
|
+
n,
|
|
314
|
+
"eventCanonical"
|
|
315
|
+
), o = se(t.steps, [], "steps"), s = {
|
|
316
|
+
event: n,
|
|
317
|
+
eventCanonical: r,
|
|
318
|
+
steps: o
|
|
319
|
+
}, a = this.extractDocumentBinding(t), c = typeof a?.canonical == "function" ? a.canonical : void 0;
|
|
320
|
+
this.handlerState.documentGet = Ie(a), this.handlerState.documentGetCanonical = Ie(
|
|
321
|
+
c ?? a
|
|
322
|
+
);
|
|
323
|
+
const u = this.extractEmitBinding(t);
|
|
324
|
+
return this.handlerState.emit = Jt(u), s;
|
|
325
|
+
}
|
|
326
|
+
extractDocumentBinding(e) {
|
|
327
|
+
if (!Object.prototype.hasOwnProperty.call(e, "document"))
|
|
328
|
+
return;
|
|
329
|
+
const t = e.document;
|
|
330
|
+
if (t != null) {
|
|
331
|
+
if (typeof t != "function")
|
|
332
|
+
throw new TypeError("QuickJS document binding must be a function");
|
|
333
|
+
return t;
|
|
305
334
|
}
|
|
306
335
|
}
|
|
307
|
-
|
|
308
|
-
|
|
336
|
+
extractEmitBinding(e) {
|
|
337
|
+
if (!Object.prototype.hasOwnProperty.call(e, "emit"))
|
|
338
|
+
return;
|
|
339
|
+
const t = e.emit;
|
|
340
|
+
if (t != null) {
|
|
341
|
+
if (typeof t != "function")
|
|
342
|
+
throw new TypeError("QuickJS emit binding must be a function");
|
|
343
|
+
return t;
|
|
344
|
+
}
|
|
309
345
|
}
|
|
310
346
|
wrapCode(e) {
|
|
311
|
-
return `(
|
|
347
|
+
return `(() => {
|
|
348
|
+
return (() => {
|
|
312
349
|
${e}
|
|
350
|
+
})()
|
|
313
351
|
})()`;
|
|
314
352
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
installDeterministicGlobals(e) {
|
|
329
|
-
e.setProp(e.global, "Date", e.undefined.dup());
|
|
330
|
-
}
|
|
331
|
-
installCanonNamespace(e) {
|
|
332
|
-
e.newObject().consume((t) => {
|
|
333
|
-
e.newFunction("unwrap", (...n) => {
|
|
334
|
-
try {
|
|
335
|
-
const [r, o] = n, s = r !== void 0 ? e.dump(r) : void 0, a = o === void 0 ? !0 : !!e.dump(o), c = H(s, a);
|
|
336
|
-
return this.createReturnHandle(e, c);
|
|
337
|
-
} catch (r) {
|
|
338
|
-
const o = r instanceof Error ? r.message : String(r);
|
|
339
|
-
return e.newError(o);
|
|
340
|
-
}
|
|
341
|
-
}).consume((n) => e.setProp(t, "unwrap", n)), e.newFunction("at", (...n) => {
|
|
342
|
-
try {
|
|
343
|
-
const [r, o] = n, s = r !== void 0 ? e.dump(r) : void 0;
|
|
344
|
-
if (o === void 0)
|
|
345
|
-
throw new TypeError(
|
|
346
|
-
"canon.at(target, pointer) requires a pointer argument"
|
|
347
|
-
);
|
|
348
|
-
const a = e.dump(o);
|
|
349
|
-
if (typeof a != "string")
|
|
350
|
-
throw new TypeError("canon.at pointer must be a string");
|
|
351
|
-
const c = Dt(s, a);
|
|
352
|
-
return this.createReturnHandle(e, c);
|
|
353
|
-
} catch (r) {
|
|
354
|
-
const o = r instanceof Error ? r.message : String(r);
|
|
355
|
-
return e.newError(o);
|
|
356
|
-
}
|
|
357
|
-
}).consume((n) => e.setProp(t, "at", n)), e.setProp(e.global, "canon", t);
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
installBindings(e, t) {
|
|
361
|
-
if (t)
|
|
362
|
-
for (const [n, r] of Object.entries(t))
|
|
363
|
-
typeof r == "function" ? this.createFunctionHandle(
|
|
364
|
-
e,
|
|
365
|
-
n,
|
|
366
|
-
r
|
|
367
|
-
).consume(
|
|
368
|
-
(s) => e.setProp(e.global, n, s)
|
|
369
|
-
) : r !== void 0 && this.createOwnedHandle(e, r).consume(
|
|
370
|
-
(s) => e.setProp(e.global, n, s)
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
createFunctionHandle(e, t, n) {
|
|
374
|
-
const r = e.newFunction(
|
|
375
|
-
t,
|
|
376
|
-
(...o) => {
|
|
377
|
-
try {
|
|
378
|
-
const s = o.map((c) => e.dump(c)), a = n(...s);
|
|
379
|
-
if (a instanceof Promise)
|
|
380
|
-
throw new TypeError("Async bindings are not supported");
|
|
381
|
-
return this.createReturnHandle(e, a);
|
|
382
|
-
} catch (s) {
|
|
383
|
-
const a = s instanceof Error ? s.message : String(s);
|
|
384
|
-
return e.newError(a);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
);
|
|
388
|
-
return this.applyFunctionProperties(e, r, n), r;
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Copies enumerable properties from a host function onto the QuickJS handle.
|
|
392
|
-
* Nested functions (e.g. `document.canonical = () => {}`) are recursively wrapped
|
|
393
|
-
* so they stay callable inside QuickJS; plain values are serialized via
|
|
394
|
-
* `createOwnedHandle`. This preserves helper namespaces on binding functions.
|
|
395
|
-
*/
|
|
396
|
-
applyFunctionProperties(e, t, n) {
|
|
397
|
-
if (!(n === null || typeof n != "object" && typeof n != "function"))
|
|
398
|
-
for (const [r, o] of Object.entries(
|
|
399
|
-
n
|
|
400
|
-
)) {
|
|
401
|
-
if (o === void 0)
|
|
402
|
-
continue;
|
|
403
|
-
if (typeof o == "function") {
|
|
404
|
-
this.createFunctionHandle(
|
|
405
|
-
e,
|
|
406
|
-
r,
|
|
407
|
-
o
|
|
408
|
-
).consume(
|
|
409
|
-
(c) => e.setProp(t, r, c)
|
|
410
|
-
);
|
|
411
|
-
continue;
|
|
412
|
-
}
|
|
413
|
-
this.createOwnedHandle(e, o).consume(
|
|
414
|
-
(a) => e.setProp(t, r, a)
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
createOwnedHandle(e, t) {
|
|
419
|
-
if (t === void 0)
|
|
420
|
-
return e.undefined.dup();
|
|
421
|
-
if (t === null)
|
|
422
|
-
return e.null.dup();
|
|
423
|
-
if (typeof t == "boolean")
|
|
424
|
-
return (t ? e.true : e.false).dup();
|
|
425
|
-
if (typeof t == "number")
|
|
426
|
-
return e.newNumber(t);
|
|
427
|
-
if (typeof t == "string")
|
|
428
|
-
return e.newString(t);
|
|
429
|
-
if (typeof t == "bigint")
|
|
430
|
-
return e.newBigInt(t);
|
|
431
|
-
if (Array.isArray(t) || typeof t == "object") {
|
|
432
|
-
const n = JSON.stringify(t);
|
|
433
|
-
if (n === void 0)
|
|
434
|
-
return e.undefined.dup();
|
|
435
|
-
const r = e.evalCode(`(${n})`);
|
|
436
|
-
return e.unwrapResult(r);
|
|
437
|
-
}
|
|
353
|
+
}
|
|
354
|
+
function qt(i) {
|
|
355
|
+
for (const e of Object.keys(i))
|
|
356
|
+
if (!Kt.has(e))
|
|
357
|
+
throw new TypeError(`Unsupported QuickJS binding: "${e}"`);
|
|
358
|
+
}
|
|
359
|
+
function se(i, e, t) {
|
|
360
|
+
const n = i === void 0 ? e : i;
|
|
361
|
+
try {
|
|
362
|
+
yt(n, { limits: St });
|
|
363
|
+
} catch (r) {
|
|
364
|
+
const o = r instanceof Error ? r.message : String(r);
|
|
438
365
|
throw new TypeError(
|
|
439
|
-
`
|
|
366
|
+
`QuickJS ${t} binding must be valid DV: ${o}`
|
|
440
367
|
);
|
|
441
368
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
return
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
if (n === void 0)
|
|
458
|
-
return e.undefined;
|
|
459
|
-
const r = e.evalCode(`(${n})`);
|
|
460
|
-
return e.unwrapResult(r);
|
|
369
|
+
return n;
|
|
370
|
+
}
|
|
371
|
+
function Ie(i) {
|
|
372
|
+
return i ? (e) => {
|
|
373
|
+
try {
|
|
374
|
+
const t = i(e);
|
|
375
|
+
return {
|
|
376
|
+
ok: t === void 0 ? null : t,
|
|
377
|
+
units: O
|
|
378
|
+
};
|
|
379
|
+
} catch {
|
|
380
|
+
return {
|
|
381
|
+
err: { code: "INVALID_PATH", tag: "host/invalid_path" },
|
|
382
|
+
units: O
|
|
383
|
+
};
|
|
461
384
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
try {
|
|
476
|
-
c = e.unwrapResult(a);
|
|
477
|
-
} finally {
|
|
478
|
-
a.dispose();
|
|
479
|
-
}
|
|
480
|
-
if (c === 0) {
|
|
481
|
-
if (r !== void 0 && Date.now() > r)
|
|
482
|
-
throw o.dispose(), new Error(
|
|
483
|
-
"QuickJS execution timed out while awaiting Promise"
|
|
484
|
-
);
|
|
485
|
-
await new Promise((u) => setTimeout(u, 0));
|
|
486
|
-
}
|
|
487
|
-
continue;
|
|
488
|
-
}
|
|
489
|
-
if (s.type === "fulfilled") {
|
|
490
|
-
if (s.notAPromise)
|
|
491
|
-
return o;
|
|
492
|
-
o.dispose(), o = s.value;
|
|
493
|
-
continue;
|
|
494
|
-
}
|
|
495
|
-
if (s.type === "rejected")
|
|
496
|
-
try {
|
|
497
|
-
const a = e.dump(s.error);
|
|
498
|
-
throw a instanceof Error ? a : a && typeof a == "object" && "message" in a ? new Error(
|
|
499
|
-
String(a.message)
|
|
500
|
-
) : new Error(
|
|
501
|
-
typeof a == "string" ? a : JSON.stringify(a)
|
|
502
|
-
);
|
|
503
|
-
} finally {
|
|
504
|
-
s.error.dispose(), o.dispose();
|
|
505
|
-
}
|
|
385
|
+
} : () => ({ ok: null, units: O });
|
|
386
|
+
}
|
|
387
|
+
function Jt(i) {
|
|
388
|
+
return i ? (e) => {
|
|
389
|
+
try {
|
|
390
|
+
if (i(j(e)) instanceof Promise)
|
|
391
|
+
throw new Error("Async emit handlers are not supported");
|
|
392
|
+
return { ok: null, units: O };
|
|
393
|
+
} catch {
|
|
394
|
+
return {
|
|
395
|
+
err: { code: "LIMIT_EXCEEDED", tag: "host/limit" },
|
|
396
|
+
units: O
|
|
397
|
+
};
|
|
506
398
|
}
|
|
399
|
+
} : () => ({ ok: null, units: O });
|
|
400
|
+
}
|
|
401
|
+
function j(i) {
|
|
402
|
+
if (i == null)
|
|
403
|
+
return i;
|
|
404
|
+
if (Array.isArray(i))
|
|
405
|
+
return i.map((e) => j(e));
|
|
406
|
+
if (typeof i == "object") {
|
|
407
|
+
const e = Object.getPrototypeOf(i);
|
|
408
|
+
if (e !== Object.prototype && e !== null)
|
|
409
|
+
return i;
|
|
410
|
+
const t = {};
|
|
411
|
+
for (const [n, r] of Object.entries(i))
|
|
412
|
+
t[n] = j(r);
|
|
413
|
+
return t;
|
|
507
414
|
}
|
|
415
|
+
return i;
|
|
508
416
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
417
|
+
function jt(i) {
|
|
418
|
+
if (i.ok)
|
|
419
|
+
return new Error("Unexpected evaluation result");
|
|
420
|
+
if (i.type === "invalid-output") {
|
|
421
|
+
const r = new Error(i.message);
|
|
422
|
+
return r.name = "InvalidOutputError", r;
|
|
423
|
+
}
|
|
424
|
+
const e = i.error;
|
|
425
|
+
if (e.kind === "out-of-gas") {
|
|
426
|
+
const r = new Error(
|
|
427
|
+
`OutOfGas: ${e.message || "out of gas"}`
|
|
428
|
+
);
|
|
429
|
+
return r.name = "OutOfGasError", r;
|
|
430
|
+
}
|
|
431
|
+
const t = e.message || i.message, n = new Error(t);
|
|
432
|
+
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);
|
|
433
|
+
}
|
|
434
|
+
function Qt(i) {
|
|
435
|
+
return i instanceof Error ? i : new Error(String(i ?? "Unknown error"));
|
|
512
436
|
}
|
|
513
|
-
|
|
437
|
+
const Te = 120;
|
|
438
|
+
function Xt(i) {
|
|
439
|
+
return i.length <= Te ? i : `${i.slice(0, Te - 3)}...`;
|
|
440
|
+
}
|
|
441
|
+
class tt extends Error {
|
|
514
442
|
constructor(e, t) {
|
|
515
|
-
super(`Failed to evaluate code block: ${
|
|
443
|
+
super(`Failed to evaluate code block: ${Xt(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
|
|
516
444
|
}
|
|
517
445
|
}
|
|
518
|
-
const
|
|
519
|
-
function
|
|
520
|
-
if (typeof i != "string" || !
|
|
446
|
+
const nt = /^\$\{([\s\S]*)\}$/, Yt = /\$\{([\s\S]+?)\}/, Zt = /\$\{([\s\S]+?)\}/g;
|
|
447
|
+
function Q(i) {
|
|
448
|
+
if (typeof i != "string" || !nt.test(i))
|
|
521
449
|
return !1;
|
|
522
450
|
const e = i.indexOf("${"), t = i.lastIndexOf("${");
|
|
523
451
|
return e === t;
|
|
524
452
|
}
|
|
525
|
-
function
|
|
526
|
-
return typeof i != "string" ? !1 :
|
|
453
|
+
function en(i) {
|
|
454
|
+
return typeof i != "string" ? !1 : nt.test(i) ? !0 : Yt.test(i);
|
|
527
455
|
}
|
|
528
|
-
function
|
|
529
|
-
if (!
|
|
456
|
+
function tn(i) {
|
|
457
|
+
if (!Q(i))
|
|
530
458
|
throw new Error(`Invalid expression: ${i}`);
|
|
531
459
|
return i.slice(2, -1);
|
|
532
460
|
}
|
|
533
|
-
async function
|
|
534
|
-
const
|
|
461
|
+
async function rt(i, e, t, n, r) {
|
|
462
|
+
const o = `return (${e});`;
|
|
535
463
|
try {
|
|
536
|
-
return await i.evaluate({
|
|
537
|
-
|
|
538
|
-
|
|
464
|
+
return await i.evaluate({
|
|
465
|
+
code: o,
|
|
466
|
+
bindings: t,
|
|
467
|
+
wasmGasLimit: n,
|
|
468
|
+
onWasmGasUsed: r
|
|
469
|
+
});
|
|
470
|
+
} catch (s) {
|
|
471
|
+
throw new tt(e, s);
|
|
539
472
|
}
|
|
540
473
|
}
|
|
541
|
-
async function
|
|
542
|
-
let
|
|
543
|
-
for (const
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
const
|
|
474
|
+
async function nn(i, e, t, n, r) {
|
|
475
|
+
let o = "", s = 0;
|
|
476
|
+
for (const a of e.matchAll(Zt)) {
|
|
477
|
+
const c = a[0], u = a[1], d = a.index ?? 0;
|
|
478
|
+
o += e.slice(s, d);
|
|
479
|
+
const f = await rt(
|
|
547
480
|
i,
|
|
548
|
-
|
|
549
|
-
t
|
|
481
|
+
u,
|
|
482
|
+
t,
|
|
483
|
+
n,
|
|
484
|
+
r
|
|
550
485
|
);
|
|
551
|
-
|
|
486
|
+
o += f == null ? "" : String(f), s = d + c.length;
|
|
552
487
|
}
|
|
553
|
-
return
|
|
488
|
+
return o += e.slice(s), o;
|
|
554
489
|
}
|
|
555
|
-
function
|
|
490
|
+
function it({
|
|
556
491
|
include: i,
|
|
557
492
|
exclude: e = [],
|
|
558
493
|
options: t
|
|
@@ -564,7 +499,7 @@ function tt({
|
|
|
564
499
|
);
|
|
565
500
|
return (s) => r.some((a) => a(s)) && !o.some((a) => a(s));
|
|
566
501
|
}
|
|
567
|
-
async function
|
|
502
|
+
async function X(i) {
|
|
568
503
|
const {
|
|
569
504
|
evaluator: e,
|
|
570
505
|
node: t,
|
|
@@ -573,92 +508,93 @@ async function Q(i) {
|
|
|
573
508
|
shouldDescend: o = () => !0,
|
|
574
509
|
context: s,
|
|
575
510
|
pointer: a = "/"
|
|
576
|
-
} = i, c =
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
511
|
+
} = i, c = Gt, u = ({
|
|
512
|
+
used: I
|
|
513
|
+
}) => {
|
|
514
|
+
s.gasMeter().chargeWasmGas(I);
|
|
515
|
+
}, d = t.clone();
|
|
516
|
+
if (!o(a, d))
|
|
517
|
+
return d;
|
|
518
|
+
const f = d.getValue();
|
|
519
|
+
if (f !== void 0) {
|
|
520
|
+
if (typeof f == "string" && r(a)) {
|
|
521
|
+
if (Q(f)) {
|
|
522
|
+
const I = tn(f), P = await rt(
|
|
586
523
|
e,
|
|
587
|
-
|
|
588
|
-
n
|
|
524
|
+
I,
|
|
525
|
+
n,
|
|
526
|
+
c,
|
|
527
|
+
u
|
|
589
528
|
);
|
|
590
|
-
return s.blue.jsonValueToNode(
|
|
591
|
-
} else if (
|
|
592
|
-
const
|
|
593
|
-
let y = 0;
|
|
594
|
-
for (m.lastIndex = 0; m.exec(u); )
|
|
595
|
-
y += 1;
|
|
596
|
-
s.gasMeter().chargeTemplate(y, u);
|
|
597
|
-
const P = await zt(
|
|
529
|
+
return s.blue.jsonValueToNode(P ?? null);
|
|
530
|
+
} else if (en(f)) {
|
|
531
|
+
const I = await nn(
|
|
598
532
|
e,
|
|
599
|
-
|
|
600
|
-
n
|
|
533
|
+
f,
|
|
534
|
+
n,
|
|
535
|
+
c,
|
|
536
|
+
u
|
|
601
537
|
);
|
|
602
|
-
return new h().setValue(
|
|
538
|
+
return new h().setValue(I);
|
|
603
539
|
}
|
|
604
540
|
}
|
|
605
|
-
return
|
|
541
|
+
return d;
|
|
606
542
|
}
|
|
607
|
-
const
|
|
608
|
-
if (Array.isArray(
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
(
|
|
543
|
+
const y = d.getItems?.();
|
|
544
|
+
if (Array.isArray(y)) {
|
|
545
|
+
const I = await Promise.all(
|
|
546
|
+
y.map(
|
|
547
|
+
(P, ie) => X({
|
|
612
548
|
...i,
|
|
613
|
-
node:
|
|
614
|
-
pointer: `${a}/${
|
|
549
|
+
node: P,
|
|
550
|
+
pointer: `${a}/${ie}`
|
|
615
551
|
})
|
|
616
552
|
)
|
|
617
553
|
);
|
|
618
|
-
return
|
|
619
|
-
}
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
const
|
|
623
|
-
for (const [
|
|
624
|
-
const
|
|
625
|
-
|
|
554
|
+
return d.setItems(I), d;
|
|
555
|
+
}
|
|
556
|
+
const w = d.getProperties?.();
|
|
557
|
+
if (w) {
|
|
558
|
+
const I = {};
|
|
559
|
+
for (const [P, ie] of Object.entries(w)) {
|
|
560
|
+
const gt = a === "/" ? `/${P}` : `${a}/${P}`;
|
|
561
|
+
I[P] = await X({
|
|
626
562
|
...i,
|
|
627
|
-
node:
|
|
628
|
-
pointer:
|
|
563
|
+
node: ie,
|
|
564
|
+
pointer: gt
|
|
629
565
|
});
|
|
630
566
|
}
|
|
631
|
-
|
|
567
|
+
d.setProperties(I);
|
|
632
568
|
}
|
|
633
|
-
return
|
|
569
|
+
return d;
|
|
634
570
|
}
|
|
635
|
-
const
|
|
571
|
+
const te = m(p["Core/Contract"])(l.object({
|
|
636
572
|
description: l.string().optional(),
|
|
637
573
|
name: l.string().optional(),
|
|
638
574
|
order: l.number().optional()
|
|
639
|
-
})),
|
|
575
|
+
})), Ee = te, U = m(p["Core/Channel"])(te.extend({
|
|
640
576
|
description: l.string().optional(),
|
|
641
577
|
event: v().optional(),
|
|
642
578
|
name: l.string().optional()
|
|
643
|
-
})),
|
|
644
|
-
|
|
579
|
+
})), z = U.merge(
|
|
580
|
+
Ee
|
|
645
581
|
).extend({
|
|
646
582
|
path: l.string().optional(),
|
|
647
583
|
definition: v().optional()
|
|
648
|
-
}),
|
|
584
|
+
}), ot = m(p["Core/Handler"])(te.extend({
|
|
649
585
|
channel: l.string().optional(),
|
|
650
586
|
description: l.string().optional(),
|
|
651
587
|
event: v().optional(),
|
|
652
588
|
name: l.string().optional()
|
|
653
|
-
})),
|
|
589
|
+
})), st = ot.merge(Ee), $ = m(p["Core/Marker"])(te.extend({
|
|
654
590
|
description: l.string().optional(),
|
|
655
591
|
name: l.string().optional()
|
|
656
|
-
})),
|
|
592
|
+
})), M = $.merge(Ee), rn = l.object({
|
|
657
593
|
op: l.enum(["ADD", "REPLACE", "REMOVE"]),
|
|
658
594
|
path: l.string(),
|
|
659
595
|
val: v().optional()
|
|
660
|
-
}),
|
|
661
|
-
|
|
596
|
+
}), Ki = m("JsonPatch")(
|
|
597
|
+
rn
|
|
662
598
|
).superRefine((i, e) => {
|
|
663
599
|
i.op === "REMOVE" && i.val !== void 0 && e.addIssue({
|
|
664
600
|
code: l.ZodIssueCode.custom,
|
|
@@ -669,27 +605,27 @@ const ee = f(p["Core/Contract"])(l.object({
|
|
|
669
605
|
message: `${i.op} operations must include a value`,
|
|
670
606
|
path: ["val"]
|
|
671
607
|
});
|
|
672
|
-
}),
|
|
608
|
+
}), on = m(p["Core/Document Update Channel"])(U.extend({
|
|
673
609
|
description: l.string().optional(),
|
|
674
610
|
name: l.string().optional(),
|
|
675
611
|
path: l.string().optional()
|
|
676
|
-
})),
|
|
677
|
-
|
|
678
|
-
),
|
|
612
|
+
})), sn = on.merge(
|
|
613
|
+
z
|
|
614
|
+
), an = m(p["Core/Embedded Node Channel"])(U.extend({
|
|
679
615
|
childPath: l.string().optional(),
|
|
680
616
|
description: l.string().optional(),
|
|
681
617
|
name: l.string().optional()
|
|
682
|
-
})),
|
|
683
|
-
|
|
684
|
-
),
|
|
618
|
+
})), cn = an.merge(
|
|
619
|
+
z
|
|
620
|
+
), ln = m(p["Core/Lifecycle Event Channel"])(U.extend({
|
|
685
621
|
description: l.string().optional(),
|
|
686
622
|
name: l.string().optional()
|
|
687
|
-
})),
|
|
688
|
-
|
|
689
|
-
),
|
|
623
|
+
})), un = ln.merge(
|
|
624
|
+
z
|
|
625
|
+
), dn = m(p["Core/Triggered Event Channel"])(U.extend({
|
|
690
626
|
description: l.string().optional(),
|
|
691
627
|
name: l.string().optional()
|
|
692
|
-
})),
|
|
628
|
+
})), hn = dn.merge(z), C = {
|
|
693
629
|
"Conversation/Actor": "CN5efWVizJbRsMCw8YWRfT2q9vM9XfeGDN9wFvYcvMnQ",
|
|
694
630
|
"Conversation/JavaScript Code": "3hYcmWMtMUPAzXBLFLb7BpuG9537tuTJPCr7pxWXvTZK",
|
|
695
631
|
"Conversation/Operation": "BoAiqVUZv9Fum3wFqaX2JnQMBHJLxJSo2V9U2UBmCfsC",
|
|
@@ -702,13 +638,13 @@ const ee = f(p["Core/Contract"])(l.object({
|
|
|
702
638
|
"Conversation/Timeline Entry": "EzDiC9Frs8V5yQBMtDYh1DobVnWtWpFemXDX5fGUULBn",
|
|
703
639
|
"Conversation/Trigger Event": "GxUtWr3eH9a6YQeioQkujEnsPjD5s9RU8ZhEfmsV1vuU",
|
|
704
640
|
"Conversation/Update Document": "BnnNLCnKF49TUJ1bRfZ5rSMaFw8SVfUNfnE4kJFG7HtM"
|
|
705
|
-
},
|
|
641
|
+
}, at = m(C["Conversation/Timeline Channel"])(U.extend({
|
|
706
642
|
description: l.string().optional(),
|
|
707
643
|
name: l.string().optional(),
|
|
708
644
|
timelineId: l.string().optional()
|
|
709
|
-
})),
|
|
710
|
-
|
|
711
|
-
),
|
|
645
|
+
})), pn = at.merge(
|
|
646
|
+
z
|
|
647
|
+
), k = {
|
|
712
648
|
"MyOS/Document Anchor": "HS9yo34TGEAM2LGcNbLh7XPN4goPRhqdGZQkiyh473Wb",
|
|
713
649
|
"MyOS/Document Anchors": "7Usvk6dZMVqas3yqs23ZEXn1zu1YDPjgYiZFNYaw3puH",
|
|
714
650
|
"MyOS/Document Links": "4cmrbevB6K23ZenjqwmNxpnaw6RF4VB3wkP7XB59V7W5",
|
|
@@ -719,100 +655,100 @@ const ee = f(p["Core/Contract"])(l.object({
|
|
|
719
655
|
"MyOS/MyOS Timeline Channel": "HCF8mXnX3dFjQ8osjxb4Wzm2Nm1DoXnTYuA5sPnV7NTs",
|
|
720
656
|
"MyOS/MyOS Timeline Entry": "Furgmg5xcJVMDmaQXZRfZ1XehSf7PWctrioo8etRYJHQ",
|
|
721
657
|
"MyOS/MyOS Worker Agency": "4Lix4AKXvBDvrwxw2htSdYFKxL4wugEQzqoSEYet5Dh1"
|
|
722
|
-
},
|
|
658
|
+
}, mn = m(k["MyOS/MyOS Timeline Channel"])(at.extend({
|
|
723
659
|
accountId: l.string().optional(),
|
|
724
660
|
description: l.string().optional(),
|
|
725
661
|
email: l.string().optional(),
|
|
726
662
|
name: l.string().optional()
|
|
727
|
-
})),
|
|
663
|
+
})), fn = mn.merge(z), gn = m(p["Core/Channel Event Checkpoint"])($.extend({
|
|
728
664
|
description: l.string().optional(),
|
|
729
665
|
lastEvents: l.record(l.string(), v()).optional(),
|
|
730
666
|
name: l.string().optional()
|
|
731
|
-
})),
|
|
667
|
+
})), En = gn.merge(M).extend({
|
|
732
668
|
lastSignatures: l.record(l.string()).optional()
|
|
733
|
-
}),
|
|
669
|
+
}), yn = m(p["Core/Processing Initialized Marker"])($.extend({
|
|
734
670
|
description: l.string().optional(),
|
|
735
671
|
documentId: l.string().optional(),
|
|
736
672
|
name: l.string().optional()
|
|
737
|
-
})),
|
|
673
|
+
})), Sn = yn.merge(M), Cn = m(p["Core/Process Embedded"])($.extend({
|
|
738
674
|
description: l.string().optional(),
|
|
739
675
|
name: l.string().optional(),
|
|
740
676
|
paths: l.array(l.string()).optional()
|
|
741
|
-
})),
|
|
742
|
-
|
|
743
|
-
),
|
|
677
|
+
})), wn = Cn.merge(
|
|
678
|
+
M
|
|
679
|
+
), vn = m(p["Core/Processing Terminated Marker"])($.extend({
|
|
744
680
|
cause: l.string().optional(),
|
|
745
681
|
description: l.string().optional(),
|
|
746
682
|
name: l.string().optional(),
|
|
747
683
|
reason: l.string().optional()
|
|
748
|
-
})),
|
|
684
|
+
})), kn = vn.merge(M), G = m(C["Conversation/Operation"])($.extend({
|
|
749
685
|
channel: l.string().optional(),
|
|
750
686
|
description: l.string().optional(),
|
|
751
687
|
name: l.string().optional(),
|
|
752
688
|
request: v().optional()
|
|
753
|
-
})),
|
|
754
|
-
|
|
755
|
-
),
|
|
689
|
+
})), bn = G.merge(
|
|
690
|
+
M
|
|
691
|
+
), In = m(k["MyOS/Document Anchor"])(l.object({
|
|
756
692
|
description: l.string().optional(),
|
|
757
693
|
name: l.string().optional(),
|
|
758
694
|
template: v().optional()
|
|
759
|
-
})),
|
|
695
|
+
})), Tn = m(k["MyOS/Document Anchors"])(l.object({}).catchall(In)), Rn = Tn.merge(M), Mn = m(k["MyOS/Link"])(l.object({
|
|
760
696
|
anchor: l.string().optional(),
|
|
761
697
|
description: l.string().optional(),
|
|
762
698
|
name: l.string().optional()
|
|
763
|
-
})),
|
|
764
|
-
|
|
765
|
-
),
|
|
699
|
+
})), Pn = m(k["MyOS/Document Links"])(l.object({}).catchall(Mn)), On = Pn.merge(
|
|
700
|
+
M
|
|
701
|
+
), Nn = m(k["MyOS/MyOS Participants Orchestration"])(l.object({
|
|
766
702
|
name: l.string().optional()
|
|
767
|
-
})),
|
|
703
|
+
})), An = Nn.merge(M), Dn = m(k["MyOS/MyOS Session Interaction"])(l.object({
|
|
768
704
|
name: l.string().optional()
|
|
769
|
-
})),
|
|
705
|
+
})), xn = Dn.merge(M), Bn = m(k["MyOS/MyOS Worker Agency"])(l.object({
|
|
770
706
|
name: l.string().optional()
|
|
771
|
-
})),
|
|
772
|
-
|
|
773
|
-
),
|
|
707
|
+
})), Ln = Bn.merge(
|
|
708
|
+
M
|
|
709
|
+
), ne = m(C["Conversation/Sequential Workflow Step"])(l.object({
|
|
774
710
|
description: l.string().optional(),
|
|
775
711
|
name: l.string().optional()
|
|
776
|
-
})),
|
|
712
|
+
})), ct = m(C["Conversation/Sequential Workflow"])(ot.extend({
|
|
777
713
|
description: l.string().optional(),
|
|
778
714
|
name: l.string().optional(),
|
|
779
|
-
steps: l.array(
|
|
780
|
-
})),
|
|
715
|
+
steps: l.array(ne).optional()
|
|
716
|
+
})), qi = v(), _n = ct.merge(st).extend({
|
|
781
717
|
steps: l.array(v()).optional()
|
|
782
|
-
}),
|
|
718
|
+
}), Fn = m(C["Conversation/Sequential Workflow Operation"])(ct.extend({
|
|
783
719
|
description: l.string().optional(),
|
|
784
720
|
name: l.string().optional(),
|
|
785
721
|
operation: l.string().optional()
|
|
786
|
-
})),
|
|
787
|
-
|
|
722
|
+
})), Un = Fn.merge(
|
|
723
|
+
st
|
|
788
724
|
).extend({
|
|
789
725
|
steps: l.array(v()).optional()
|
|
790
726
|
});
|
|
791
|
-
function
|
|
727
|
+
function zn(i) {
|
|
792
728
|
if (!Array.isArray(i.blueIds) || i.blueIds.length === 0)
|
|
793
729
|
throw new Error("Contract processors must declare at least one BlueId");
|
|
794
730
|
for (const e of i.blueIds)
|
|
795
731
|
if (typeof e != "string" || e.trim().length === 0)
|
|
796
732
|
throw new Error("Contract processor BlueIds must be non-empty strings");
|
|
797
733
|
}
|
|
798
|
-
function
|
|
799
|
-
|
|
734
|
+
function q(i, e) {
|
|
735
|
+
zn(i);
|
|
800
736
|
for (const t of i.blueIds)
|
|
801
737
|
e.set(t, i);
|
|
802
738
|
}
|
|
803
|
-
class
|
|
739
|
+
class $n {
|
|
804
740
|
processorsByBlueId = /* @__PURE__ */ new Map();
|
|
805
741
|
handlerProcessors = /* @__PURE__ */ new Map();
|
|
806
742
|
channelProcessors = /* @__PURE__ */ new Map();
|
|
807
743
|
markerProcessors = /* @__PURE__ */ new Map();
|
|
808
744
|
registerHandler(e) {
|
|
809
|
-
|
|
745
|
+
q(e, this.handlerProcessors), this.registerProcessorMap(e);
|
|
810
746
|
}
|
|
811
747
|
registerChannel(e) {
|
|
812
|
-
|
|
748
|
+
q(e, this.channelProcessors), this.registerProcessorMap(e);
|
|
813
749
|
}
|
|
814
750
|
registerMarker(e) {
|
|
815
|
-
|
|
751
|
+
q(e, this.markerProcessors), this.registerProcessorMap(e);
|
|
816
752
|
}
|
|
817
753
|
register(e) {
|
|
818
754
|
switch (e.kind) {
|
|
@@ -846,55 +782,55 @@ class Tn {
|
|
|
846
782
|
return new Map(this.processorsByBlueId);
|
|
847
783
|
}
|
|
848
784
|
registerProcessorMap(e) {
|
|
849
|
-
|
|
785
|
+
q(e, this.processorsByBlueId);
|
|
850
786
|
}
|
|
851
787
|
}
|
|
852
|
-
const
|
|
788
|
+
const Vn = m(C["Conversation/Actor"])(l.object({
|
|
853
789
|
description: l.string().optional(),
|
|
854
790
|
name: l.string().optional()
|
|
855
|
-
})),
|
|
791
|
+
})), lt = m(C["Conversation/Timeline"])(l.object({
|
|
856
792
|
description: l.string().optional(),
|
|
857
793
|
name: l.string().optional(),
|
|
858
794
|
timelineId: l.string().optional()
|
|
859
|
-
})),
|
|
860
|
-
actor:
|
|
795
|
+
})), R = m(C["Conversation/Timeline Entry"])(l.object({
|
|
796
|
+
actor: Vn.optional(),
|
|
861
797
|
description: l.string().optional(),
|
|
862
798
|
message: v().optional(),
|
|
863
799
|
name: l.string().optional(),
|
|
864
800
|
prevEntry: v().optional(),
|
|
865
|
-
timeline:
|
|
801
|
+
timeline: lt.optional(),
|
|
866
802
|
timestamp: l.number().optional()
|
|
867
|
-
})),
|
|
803
|
+
})), Hn = m(k["MyOS/MyOS Timeline"])(lt.extend({
|
|
868
804
|
accountId: l.string().optional(),
|
|
869
805
|
description: l.string().optional(),
|
|
870
806
|
name: l.string().optional()
|
|
871
|
-
})),
|
|
807
|
+
})), Re = m(k["MyOS/MyOS Timeline Entry"])(R.extend({
|
|
872
808
|
description: l.string().optional(),
|
|
873
809
|
name: l.string().optional(),
|
|
874
|
-
timeline:
|
|
810
|
+
timeline: Hn.optional()
|
|
875
811
|
}));
|
|
876
|
-
function
|
|
877
|
-
return e && i.isTypeOf(e,
|
|
812
|
+
function Me(i, e) {
|
|
813
|
+
return e && i.isTypeOf(e, R, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, R) : null;
|
|
878
814
|
}
|
|
879
|
-
function
|
|
880
|
-
const n =
|
|
815
|
+
function ut(i, e, t) {
|
|
816
|
+
const n = Me(i, e), r = Me(i, t);
|
|
881
817
|
if (!n || !r)
|
|
882
818
|
return !0;
|
|
883
819
|
const o = n.timestamp, s = r.timestamp;
|
|
884
820
|
return typeof o != "number" || typeof s != "number" ? !0 : o >= s;
|
|
885
821
|
}
|
|
886
|
-
function
|
|
887
|
-
return i.isTypeOf(e,
|
|
822
|
+
function Pe(i, e) {
|
|
823
|
+
return i.isTypeOf(e, Re) ? i.nodeToSchemaOutput(e, Re) : i.isTypeOf(e, R) ? i.nodeToSchemaOutput(e, R) : null;
|
|
888
824
|
}
|
|
889
|
-
class
|
|
825
|
+
class Wn {
|
|
890
826
|
kind = "channel";
|
|
891
|
-
blueIds = [
|
|
892
|
-
schema =
|
|
827
|
+
blueIds = [k["MyOS/MyOS Timeline Channel"]];
|
|
828
|
+
schema = fn;
|
|
893
829
|
matches(e, t) {
|
|
894
830
|
const { event: n, blue: r } = t;
|
|
895
831
|
if (!n)
|
|
896
832
|
return !1;
|
|
897
|
-
const o =
|
|
833
|
+
const o = Pe(r, n);
|
|
898
834
|
if (!o)
|
|
899
835
|
return !1;
|
|
900
836
|
const s = o.timeline?.timelineId;
|
|
@@ -902,40 +838,40 @@ class Pn {
|
|
|
902
838
|
}
|
|
903
839
|
channelize(e, t) {
|
|
904
840
|
const { event: n, blue: r } = t;
|
|
905
|
-
return !n || !
|
|
841
|
+
return !n || !Pe(r, n) ? null : n.clone();
|
|
906
842
|
}
|
|
907
843
|
isNewerEvent(e, t, n) {
|
|
908
844
|
const { event: r, blue: o } = t;
|
|
909
|
-
return r ?
|
|
845
|
+
return r ? ut(o, r, n) : !0;
|
|
910
846
|
}
|
|
911
847
|
}
|
|
912
|
-
class
|
|
848
|
+
class Gn {
|
|
913
849
|
kind = "channel";
|
|
914
|
-
blueIds = [
|
|
915
|
-
schema =
|
|
850
|
+
blueIds = [C["Conversation/Timeline Channel"]];
|
|
851
|
+
schema = pn;
|
|
916
852
|
matches(e, t) {
|
|
917
853
|
const { event: n, blue: r } = t;
|
|
918
|
-
if (!n || !r.isTypeOf(n,
|
|
854
|
+
if (!n || !r.isTypeOf(n, R))
|
|
919
855
|
return !1;
|
|
920
|
-
const s = r.nodeToSchemaOutput(n,
|
|
856
|
+
const s = r.nodeToSchemaOutput(n, R).timeline?.timelineId;
|
|
921
857
|
return !(!s || !e.timelineId || s !== e.timelineId);
|
|
922
858
|
}
|
|
923
859
|
channelize(e, t) {
|
|
924
860
|
const { event: n, blue: r } = t;
|
|
925
|
-
return !n || !r.isTypeOf(n,
|
|
861
|
+
return !n || !r.isTypeOf(n, R) ? null : n.clone();
|
|
926
862
|
}
|
|
927
863
|
isNewerEvent(e, t, n) {
|
|
928
864
|
const { event: r, blue: o } = t;
|
|
929
|
-
return r ?
|
|
865
|
+
return r ? ut(o, r, n) : !0;
|
|
930
866
|
}
|
|
931
867
|
}
|
|
932
|
-
const
|
|
868
|
+
const Oe = m(C["Conversation/Trigger Event"])(ne.extend({
|
|
933
869
|
description: l.string().optional(),
|
|
934
870
|
event: v().optional(),
|
|
935
871
|
name: l.string().optional()
|
|
936
872
|
}));
|
|
937
|
-
function
|
|
938
|
-
const { context: e, eventNode: t, stepResults: n } = i, r =
|
|
873
|
+
function ye(i) {
|
|
874
|
+
const { context: e, eventNode: t, stepResults: n } = i, r = qn(e);
|
|
939
875
|
return {
|
|
940
876
|
event: e.blue.nodeToJson(t, "simple"),
|
|
941
877
|
eventCanonical: e.blue.nodeToJson(t, "official"),
|
|
@@ -943,13 +879,13 @@ function me(i) {
|
|
|
943
879
|
document: r
|
|
944
880
|
};
|
|
945
881
|
}
|
|
946
|
-
const
|
|
947
|
-
function
|
|
882
|
+
const Kn = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
|
|
883
|
+
function qn(i) {
|
|
948
884
|
const e = (o) => {
|
|
949
885
|
if (o === "/")
|
|
950
886
|
return !1;
|
|
951
887
|
const s = o.lastIndexOf("/"), a = o.substring(s + 1);
|
|
952
|
-
return
|
|
888
|
+
return Kn.has(a);
|
|
953
889
|
}, t = (o) => {
|
|
954
890
|
const s = o == null ? "/" : typeof o == "string" ? o : (() => {
|
|
955
891
|
throw new TypeError("document() expects a string pointer");
|
|
@@ -959,78 +895,83 @@ function On(i) {
|
|
|
959
895
|
const { snapshot: a, normalizedPointer: c } = t(o);
|
|
960
896
|
if (a)
|
|
961
897
|
return e(c) ? i.blue.nodeToJson(a, "simple") : i.blue.nodeToJson(a, s);
|
|
962
|
-
}, r = (o) => n(o, "simple");
|
|
898
|
+
}, r = ((o) => n(o, "simple"));
|
|
963
899
|
return r.canonical = (o) => n(o, "official"), r;
|
|
964
900
|
}
|
|
965
|
-
class
|
|
901
|
+
class Jn {
|
|
966
902
|
supportedBlueIds = [
|
|
967
|
-
|
|
903
|
+
C["Conversation/Trigger Event"]
|
|
968
904
|
];
|
|
969
|
-
evaluator = new
|
|
905
|
+
evaluator = new ge();
|
|
970
906
|
async execute(e) {
|
|
971
907
|
const { stepNode: t, context: n } = e;
|
|
972
|
-
if (!n.blue.isTypeOf(t,
|
|
908
|
+
if (!n.blue.isTypeOf(t, Oe))
|
|
973
909
|
return n.throwFatal("Trigger Event step payload is invalid");
|
|
974
910
|
n.gasMeter().chargeTriggerEventBase();
|
|
975
|
-
const r = await
|
|
911
|
+
const r = await X({
|
|
976
912
|
evaluator: this.evaluator,
|
|
977
913
|
node: t,
|
|
978
|
-
bindings:
|
|
979
|
-
shouldResolve:
|
|
914
|
+
bindings: ye(e),
|
|
915
|
+
shouldResolve: it({
|
|
980
916
|
include: ["/event", "/event/**"]
|
|
981
917
|
}),
|
|
982
|
-
shouldDescend:
|
|
918
|
+
shouldDescend: jn(),
|
|
983
919
|
context: n
|
|
984
920
|
}), s = n.blue.nodeToSchemaOutput(
|
|
985
921
|
r,
|
|
986
|
-
|
|
922
|
+
Oe
|
|
987
923
|
).event;
|
|
988
|
-
if (
|
|
924
|
+
if (le(s))
|
|
989
925
|
return n.throwFatal(
|
|
990
926
|
"Trigger Event step must declare event payload"
|
|
991
927
|
);
|
|
992
928
|
n.emitEvent(s.clone());
|
|
993
929
|
}
|
|
994
930
|
}
|
|
995
|
-
function
|
|
996
|
-
return (i, e) => i === "/event" || !i.startsWith("/event/") ? !0 : !
|
|
931
|
+
function jn() {
|
|
932
|
+
return (i, e) => i === "/event" || !i.startsWith("/event/") ? !0 : !Qn(e);
|
|
997
933
|
}
|
|
998
|
-
function
|
|
934
|
+
function Qn(i) {
|
|
999
935
|
const e = i.getProperties?.();
|
|
1000
936
|
return e ? !!e.contracts : !1;
|
|
1001
937
|
}
|
|
1002
|
-
const
|
|
938
|
+
const Ne = m(C["Conversation/JavaScript Code"])(ne.extend({
|
|
1003
939
|
code: l.string().optional(),
|
|
1004
940
|
description: l.string().optional(),
|
|
1005
941
|
name: l.string().optional()
|
|
1006
942
|
}));
|
|
1007
|
-
class
|
|
943
|
+
class Xn {
|
|
1008
944
|
supportedBlueIds = [
|
|
1009
|
-
|
|
945
|
+
C["Conversation/JavaScript Code"]
|
|
1010
946
|
];
|
|
1011
|
-
evaluator = new
|
|
947
|
+
evaluator = new ge();
|
|
948
|
+
wasmGasLimit;
|
|
949
|
+
constructor(e = {}) {
|
|
950
|
+
this.wasmGasLimit = e.wasmGasLimit ?? et;
|
|
951
|
+
}
|
|
1012
952
|
async execute(e) {
|
|
1013
953
|
const { context: t, stepNode: n } = e, { blue: r } = t;
|
|
1014
|
-
if (!r.isTypeOf(n,
|
|
954
|
+
if (!r.isTypeOf(n, Ne))
|
|
1015
955
|
return t.throwFatal("JavaScript Code step payload is invalid");
|
|
1016
956
|
const s = r.nodeToSchemaOutput(
|
|
1017
957
|
n,
|
|
1018
|
-
|
|
958
|
+
Ne
|
|
1019
959
|
).code;
|
|
1020
960
|
if (!s)
|
|
1021
961
|
return t.throwFatal(
|
|
1022
962
|
"JavaScript Code step must include code to execute"
|
|
1023
963
|
);
|
|
1024
|
-
|
|
1025
|
-
const a = me(e);
|
|
964
|
+
const a = ye(e);
|
|
1026
965
|
try {
|
|
1027
966
|
const c = await this.evaluator.evaluate({
|
|
1028
967
|
code: s,
|
|
1029
|
-
bindings: a
|
|
968
|
+
bindings: a,
|
|
969
|
+
wasmGasLimit: this.wasmGasLimit,
|
|
970
|
+
onWasmGasUsed: ({ used: u }) => t.gasMeter().chargeWasmGas(u)
|
|
1030
971
|
});
|
|
1031
972
|
return this.handleEvents(c, t), c;
|
|
1032
973
|
} catch (c) {
|
|
1033
|
-
throw new
|
|
974
|
+
throw new tt(s, c);
|
|
1034
975
|
}
|
|
1035
976
|
}
|
|
1036
977
|
handleEvents(e, t) {
|
|
@@ -1044,31 +985,31 @@ class Ln {
|
|
|
1044
985
|
}
|
|
1045
986
|
}
|
|
1046
987
|
}
|
|
1047
|
-
const
|
|
988
|
+
const Yn = m(p["Core/Json Patch Entry"])(l.object({
|
|
1048
989
|
description: l.string().optional(),
|
|
1049
990
|
name: l.string().optional(),
|
|
1050
991
|
op: l.string().optional(),
|
|
1051
992
|
path: l.string().optional(),
|
|
1052
993
|
val: v().optional()
|
|
1053
|
-
})),
|
|
1054
|
-
changeset: l.array(
|
|
994
|
+
})), Ae = m(C["Conversation/Update Document"])(ne.extend({
|
|
995
|
+
changeset: l.array(Yn).optional(),
|
|
1055
996
|
description: l.string().optional(),
|
|
1056
997
|
name: l.string().optional()
|
|
1057
998
|
}));
|
|
1058
|
-
class
|
|
999
|
+
class Zn {
|
|
1059
1000
|
supportedBlueIds = [
|
|
1060
|
-
|
|
1001
|
+
C["Conversation/Update Document"]
|
|
1061
1002
|
];
|
|
1062
|
-
evaluator = new
|
|
1003
|
+
evaluator = new ge();
|
|
1063
1004
|
async execute(e) {
|
|
1064
1005
|
const { context: t, stepNode: n } = e, { blue: r } = t;
|
|
1065
|
-
if (!r.isTypeOf(n,
|
|
1006
|
+
if (!r.isTypeOf(n, Ae))
|
|
1066
1007
|
return t.throwFatal("Update Document step payload is invalid");
|
|
1067
|
-
const o = await
|
|
1008
|
+
const o = await X({
|
|
1068
1009
|
evaluator: this.evaluator,
|
|
1069
1010
|
node: n,
|
|
1070
|
-
bindings:
|
|
1071
|
-
shouldResolve:
|
|
1011
|
+
bindings: ye(e),
|
|
1012
|
+
shouldResolve: it({
|
|
1072
1013
|
include: ["/changeset", "/changeset/**"]
|
|
1073
1014
|
}),
|
|
1074
1015
|
context: t
|
|
@@ -1082,7 +1023,7 @@ class _n {
|
|
|
1082
1023
|
extractChanges(e, t) {
|
|
1083
1024
|
return t.blue.nodeToSchemaOutput(
|
|
1084
1025
|
e,
|
|
1085
|
-
|
|
1026
|
+
Ae
|
|
1086
1027
|
).changeset ?? [];
|
|
1087
1028
|
}
|
|
1088
1029
|
createPatch(e, t) {
|
|
@@ -1102,14 +1043,14 @@ class _n {
|
|
|
1102
1043
|
return n.length === 0 ? t.throwFatal("Update Document path cannot be empty") : n;
|
|
1103
1044
|
}
|
|
1104
1045
|
}
|
|
1105
|
-
const
|
|
1106
|
-
new
|
|
1107
|
-
new
|
|
1108
|
-
new
|
|
1046
|
+
const Se = [
|
|
1047
|
+
new Jn(),
|
|
1048
|
+
new Xn(),
|
|
1049
|
+
new Zn()
|
|
1109
1050
|
];
|
|
1110
|
-
class
|
|
1051
|
+
class dt {
|
|
1111
1052
|
executorIndex;
|
|
1112
|
-
constructor(e =
|
|
1053
|
+
constructor(e = Se) {
|
|
1113
1054
|
const t = /* @__PURE__ */ new Map();
|
|
1114
1055
|
for (const n of e)
|
|
1115
1056
|
for (const r of n.supportedBlueIds)
|
|
@@ -1123,28 +1064,28 @@ class ct {
|
|
|
1123
1064
|
const s = {};
|
|
1124
1065
|
for (const [a, c] of o.entries()) {
|
|
1125
1066
|
const u = c.getType?.()?.getBlueId();
|
|
1126
|
-
if (
|
|
1067
|
+
if (le(u))
|
|
1127
1068
|
return r.throwFatal(
|
|
1128
1069
|
"Sequential workflow step is missing type metadata"
|
|
1129
1070
|
);
|
|
1130
1071
|
const d = this.executorIndex.get(u);
|
|
1131
|
-
if (
|
|
1132
|
-
const
|
|
1072
|
+
if (le(d)) {
|
|
1073
|
+
const w = c.getType?.()?.getName?.() ?? u;
|
|
1133
1074
|
return r.throwFatal(
|
|
1134
|
-
`Unsupported workflow step type "${
|
|
1075
|
+
`Unsupported workflow step type "${w}"`
|
|
1135
1076
|
);
|
|
1136
1077
|
}
|
|
1137
|
-
const
|
|
1078
|
+
const f = {
|
|
1138
1079
|
workflow: t,
|
|
1139
1080
|
stepNode: c,
|
|
1140
1081
|
eventNode: n,
|
|
1141
1082
|
context: r,
|
|
1142
1083
|
stepResults: s,
|
|
1143
1084
|
stepIndex: a
|
|
1144
|
-
},
|
|
1145
|
-
if (
|
|
1146
|
-
const
|
|
1147
|
-
s[
|
|
1085
|
+
}, y = await d.execute(f);
|
|
1086
|
+
if (y !== void 0) {
|
|
1087
|
+
const w = this.stepResultKey(c, a);
|
|
1088
|
+
s[w] = y;
|
|
1148
1089
|
}
|
|
1149
1090
|
}
|
|
1150
1091
|
return s;
|
|
@@ -1154,15 +1095,15 @@ class ct {
|
|
|
1154
1095
|
return n && typeof n == "string" && n.length > 0 ? n : `Step${t + 1}`;
|
|
1155
1096
|
}
|
|
1156
1097
|
}
|
|
1157
|
-
class
|
|
1098
|
+
class er {
|
|
1158
1099
|
kind = "handler";
|
|
1159
1100
|
blueIds = [
|
|
1160
|
-
|
|
1101
|
+
C["Conversation/Sequential Workflow"]
|
|
1161
1102
|
];
|
|
1162
|
-
schema =
|
|
1103
|
+
schema = _n;
|
|
1163
1104
|
runner;
|
|
1164
|
-
constructor(e =
|
|
1165
|
-
this.runner = new
|
|
1105
|
+
constructor(e = Se) {
|
|
1106
|
+
this.runner = new dt(e);
|
|
1166
1107
|
}
|
|
1167
1108
|
async matches(e, t) {
|
|
1168
1109
|
const n = t.event();
|
|
@@ -1173,12 +1114,12 @@ class Fn {
|
|
|
1173
1114
|
n && await this.runner.run({ workflow: e, eventNode: n, context: t });
|
|
1174
1115
|
}
|
|
1175
1116
|
}
|
|
1176
|
-
class
|
|
1117
|
+
class tr {
|
|
1177
1118
|
kind = "marker";
|
|
1178
|
-
blueIds = [
|
|
1179
|
-
schema =
|
|
1119
|
+
blueIds = [C["Conversation/Operation"]];
|
|
1120
|
+
schema = bn;
|
|
1180
1121
|
}
|
|
1181
|
-
const
|
|
1122
|
+
const he = m(C["Conversation/Operation Request"])(l.object({
|
|
1182
1123
|
allowNewerVersion: l.boolean().optional(),
|
|
1183
1124
|
description: l.string().optional(),
|
|
1184
1125
|
document: v().optional(),
|
|
@@ -1186,7 +1127,7 @@ const le = f(S["Conversation/Operation Request"])(l.object({
|
|
|
1186
1127
|
operation: l.string().optional(),
|
|
1187
1128
|
request: v().optional()
|
|
1188
1129
|
}));
|
|
1189
|
-
function
|
|
1130
|
+
function ht(i) {
|
|
1190
1131
|
const e = i.channel;
|
|
1191
1132
|
if (typeof e == "string") {
|
|
1192
1133
|
const t = e.trim();
|
|
@@ -1195,47 +1136,47 @@ function lt(i) {
|
|
|
1195
1136
|
}
|
|
1196
1137
|
return null;
|
|
1197
1138
|
}
|
|
1198
|
-
function
|
|
1139
|
+
function nr(i, e) {
|
|
1199
1140
|
const t = i.getProperties()?.document;
|
|
1200
1141
|
return t instanceof h ? e.blue.calculateBlueIdSync(t) : null;
|
|
1201
1142
|
}
|
|
1202
|
-
function
|
|
1203
|
-
if (e.isTypeOf(i,
|
|
1143
|
+
function rr(i, e) {
|
|
1144
|
+
if (e.isTypeOf(i, he, {
|
|
1204
1145
|
checkSchemaExtensions: !0
|
|
1205
1146
|
}))
|
|
1206
1147
|
return i;
|
|
1207
|
-
if (e.isTypeOf(i,
|
|
1148
|
+
if (e.isTypeOf(i, R, {
|
|
1208
1149
|
checkSchemaExtensions: !0
|
|
1209
1150
|
})) {
|
|
1210
|
-
const n = e.nodeToSchemaOutput(i,
|
|
1211
|
-
if (n && e.isTypeOf(n,
|
|
1151
|
+
const n = e.nodeToSchemaOutput(i, R).message;
|
|
1152
|
+
if (n && e.isTypeOf(n, he, {
|
|
1212
1153
|
checkSchemaExtensions: !0
|
|
1213
1154
|
}))
|
|
1214
1155
|
return n;
|
|
1215
1156
|
}
|
|
1216
1157
|
return null;
|
|
1217
1158
|
}
|
|
1218
|
-
function
|
|
1159
|
+
function ir(i, e, t, n) {
|
|
1219
1160
|
const { blue: r } = n, o = i.operation;
|
|
1220
1161
|
return !(!o || t.operation !== o || i.event && !r.isTypeOfNode(e, i.event));
|
|
1221
1162
|
}
|
|
1222
|
-
function
|
|
1163
|
+
function or(i, e) {
|
|
1223
1164
|
const t = i.operation;
|
|
1224
1165
|
if (!t)
|
|
1225
1166
|
return null;
|
|
1226
1167
|
const n = e.resolvePointer(`/contracts/${t}`), r = e.documentAt(n);
|
|
1227
|
-
if (!r || !e.blue.isTypeOf(r,
|
|
1168
|
+
if (!r || !e.blue.isTypeOf(r, G))
|
|
1228
1169
|
return null;
|
|
1229
1170
|
const o = e.blue.nodeToSchemaOutput(
|
|
1230
1171
|
r,
|
|
1231
|
-
|
|
1232
|
-
), s =
|
|
1172
|
+
G
|
|
1173
|
+
), s = ht(o);
|
|
1233
1174
|
return { operationNode: r, operation: o, channelKey: s };
|
|
1234
1175
|
}
|
|
1235
|
-
function
|
|
1176
|
+
function sr(i, e) {
|
|
1236
1177
|
return !(i && e && i !== e);
|
|
1237
1178
|
}
|
|
1238
|
-
function
|
|
1179
|
+
function ar(i, e, t) {
|
|
1239
1180
|
const n = i.getProperties()?.request, r = e.getProperties()?.request;
|
|
1240
1181
|
if (!(n instanceof h) || !(r instanceof h))
|
|
1241
1182
|
return !1;
|
|
@@ -1247,10 +1188,10 @@ function Kn(i, e, t) {
|
|
|
1247
1188
|
}
|
|
1248
1189
|
return !0;
|
|
1249
1190
|
}
|
|
1250
|
-
function
|
|
1191
|
+
function cr(i, e, t) {
|
|
1251
1192
|
if (!i || i.allowNewerVersion !== !1)
|
|
1252
1193
|
return !0;
|
|
1253
|
-
const n =
|
|
1194
|
+
const n = nr(e, t);
|
|
1254
1195
|
if (!n)
|
|
1255
1196
|
return !0;
|
|
1256
1197
|
const r = t.resolvePointer("/"), o = t.documentAt(r);
|
|
@@ -1259,33 +1200,33 @@ function qn(i, e, t) {
|
|
|
1259
1200
|
const c = (o.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, u = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(o);
|
|
1260
1201
|
return n === u;
|
|
1261
1202
|
}
|
|
1262
|
-
class
|
|
1203
|
+
class lr {
|
|
1263
1204
|
kind = "handler";
|
|
1264
1205
|
blueIds = [
|
|
1265
|
-
|
|
1206
|
+
C["Conversation/Sequential Workflow Operation"]
|
|
1266
1207
|
];
|
|
1267
|
-
schema =
|
|
1208
|
+
schema = Un;
|
|
1268
1209
|
runner;
|
|
1269
|
-
constructor(e =
|
|
1270
|
-
this.runner = new
|
|
1210
|
+
constructor(e = Se) {
|
|
1211
|
+
this.runner = new dt(e);
|
|
1271
1212
|
}
|
|
1272
1213
|
deriveChannel(e, t) {
|
|
1273
1214
|
const n = e.operation;
|
|
1274
1215
|
if (!n)
|
|
1275
1216
|
return null;
|
|
1276
1217
|
const r = t.scopeContracts.get(n);
|
|
1277
|
-
if (!r || !t.blue.isTypeOf(r.node,
|
|
1218
|
+
if (!r || !t.blue.isTypeOf(r.node, G, {
|
|
1278
1219
|
checkSchemaExtensions: !0
|
|
1279
1220
|
}))
|
|
1280
1221
|
return null;
|
|
1281
|
-
const o = t.blue.nodeToSchemaOutput(r.node,
|
|
1282
|
-
return o ?
|
|
1222
|
+
const o = t.blue.nodeToSchemaOutput(r.node, G);
|
|
1223
|
+
return o ? ht(o) : null;
|
|
1283
1224
|
}
|
|
1284
1225
|
async matches(e, t) {
|
|
1285
1226
|
const n = t.event();
|
|
1286
1227
|
if (!n)
|
|
1287
1228
|
return !1;
|
|
1288
|
-
const r =
|
|
1229
|
+
const r = rr(
|
|
1289
1230
|
n,
|
|
1290
1231
|
t.blue
|
|
1291
1232
|
);
|
|
@@ -1293,19 +1234,19 @@ class jn {
|
|
|
1293
1234
|
return !1;
|
|
1294
1235
|
const o = t.blue.nodeToSchemaOutput(
|
|
1295
1236
|
r,
|
|
1296
|
-
|
|
1237
|
+
he
|
|
1297
1238
|
);
|
|
1298
|
-
if (!o || !
|
|
1239
|
+
if (!o || !ir(e, n, o, t))
|
|
1299
1240
|
return !1;
|
|
1300
|
-
const s =
|
|
1241
|
+
const s = or(e, t);
|
|
1301
1242
|
if (!s)
|
|
1302
1243
|
return !1;
|
|
1303
1244
|
const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
|
|
1304
|
-
return !(!
|
|
1245
|
+
return !(!sr(s.channelKey, c) || !ar(
|
|
1305
1246
|
r,
|
|
1306
1247
|
s.operationNode,
|
|
1307
1248
|
t.blue
|
|
1308
|
-
) || o?.allowNewerVersion === !1 && !
|
|
1249
|
+
) || o?.allowNewerVersion === !1 && !cr(o, r, t));
|
|
1309
1250
|
}
|
|
1310
1251
|
async execute(e, t) {
|
|
1311
1252
|
const n = t.event();
|
|
@@ -1316,17 +1257,17 @@ class jn {
|
|
|
1316
1257
|
});
|
|
1317
1258
|
}
|
|
1318
1259
|
}
|
|
1319
|
-
class
|
|
1260
|
+
class re {
|
|
1320
1261
|
constructor(e) {
|
|
1321
1262
|
this.registry = e;
|
|
1322
1263
|
}
|
|
1323
1264
|
static create() {
|
|
1324
|
-
return new
|
|
1325
|
-
new
|
|
1265
|
+
return new re(
|
|
1266
|
+
new $n()
|
|
1326
1267
|
);
|
|
1327
1268
|
}
|
|
1328
1269
|
registerDefaults() {
|
|
1329
|
-
return this.registry.register(new
|
|
1270
|
+
return this.registry.register(new Wn()), this.registry.register(new Gn()), this.registry.register(new er()), this.registry.register(new tr()), this.registry.register(new lr()), this;
|
|
1330
1271
|
}
|
|
1331
1272
|
register(e) {
|
|
1332
1273
|
return this.registry.register(e), this;
|
|
@@ -1335,11 +1276,11 @@ class ne {
|
|
|
1335
1276
|
return this.registry;
|
|
1336
1277
|
}
|
|
1337
1278
|
}
|
|
1338
|
-
const
|
|
1339
|
-
function
|
|
1279
|
+
const pe = p["Core/Channel Event Checkpoint"];
|
|
1280
|
+
function pt(i) {
|
|
1340
1281
|
return typeof i.order == "number" ? i.order : 0;
|
|
1341
1282
|
}
|
|
1342
|
-
class
|
|
1283
|
+
class ur {
|
|
1343
1284
|
constructor(e, t, n) {
|
|
1344
1285
|
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
|
|
1345
1286
|
}
|
|
@@ -1353,10 +1294,10 @@ class Jn {
|
|
|
1353
1294
|
return this.bindingBlueId;
|
|
1354
1295
|
}
|
|
1355
1296
|
order() {
|
|
1356
|
-
return
|
|
1297
|
+
return pt(this.bindingContract);
|
|
1357
1298
|
}
|
|
1358
1299
|
}
|
|
1359
|
-
class
|
|
1300
|
+
class dr {
|
|
1360
1301
|
constructor(e, t, n) {
|
|
1361
1302
|
this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
|
|
1362
1303
|
}
|
|
@@ -1370,16 +1311,16 @@ class Gn {
|
|
|
1370
1311
|
return this.bindingBlueId;
|
|
1371
1312
|
}
|
|
1372
1313
|
order() {
|
|
1373
|
-
return
|
|
1314
|
+
return pt(this.bindingContract);
|
|
1374
1315
|
}
|
|
1375
1316
|
}
|
|
1376
|
-
class
|
|
1317
|
+
class _ {
|
|
1377
1318
|
constructor(e, t, n, r, o) {
|
|
1378
1319
|
this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared = o;
|
|
1379
1320
|
}
|
|
1380
1321
|
checkpointDeclared;
|
|
1381
1322
|
static fromComponents(e, t, n, r, o) {
|
|
1382
|
-
return new
|
|
1323
|
+
return new _(
|
|
1383
1324
|
e,
|
|
1384
1325
|
t,
|
|
1385
1326
|
n,
|
|
@@ -1388,10 +1329,10 @@ class L {
|
|
|
1388
1329
|
);
|
|
1389
1330
|
}
|
|
1390
1331
|
static builder() {
|
|
1391
|
-
return new
|
|
1332
|
+
return new hr();
|
|
1392
1333
|
}
|
|
1393
1334
|
static empty() {
|
|
1394
|
-
return
|
|
1335
|
+
return _.builder().build();
|
|
1395
1336
|
}
|
|
1396
1337
|
markers() {
|
|
1397
1338
|
return new Map(
|
|
@@ -1421,16 +1362,16 @@ class L {
|
|
|
1421
1362
|
throw new Error(
|
|
1422
1363
|
"Duplicate Channel Event Checkpoint markers detected in same contracts map"
|
|
1423
1364
|
);
|
|
1424
|
-
this.markerStore.set(
|
|
1425
|
-
key:
|
|
1365
|
+
this.markerStore.set(A, {
|
|
1366
|
+
key: A,
|
|
1426
1367
|
contract: e,
|
|
1427
|
-
blueId:
|
|
1368
|
+
blueId: pe
|
|
1428
1369
|
}), this.checkpointDeclared = !0;
|
|
1429
1370
|
}
|
|
1430
1371
|
handlersFor(e) {
|
|
1431
1372
|
const t = this.handlersByChannel.get(e);
|
|
1432
1373
|
return !t || t.length === 0 ? [] : [...t].map(
|
|
1433
|
-
(n) => new
|
|
1374
|
+
(n) => new dr(n.key, n.contract, n.blueId)
|
|
1434
1375
|
).sort((n, r) => {
|
|
1435
1376
|
const o = n.order() - r.order();
|
|
1436
1377
|
return o !== 0 ? o : n.key().localeCompare(r.key());
|
|
@@ -1438,7 +1379,7 @@ class L {
|
|
|
1438
1379
|
}
|
|
1439
1380
|
channelsOfType(...e) {
|
|
1440
1381
|
const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
|
|
1441
|
-
(r) => new
|
|
1382
|
+
(r) => new ur(r.key, r.contract, r.blueId)
|
|
1442
1383
|
);
|
|
1443
1384
|
return n.sort((r, o) => {
|
|
1444
1385
|
const s = r.order() - o.order();
|
|
@@ -1446,7 +1387,7 @@ class L {
|
|
|
1446
1387
|
}), n;
|
|
1447
1388
|
}
|
|
1448
1389
|
}
|
|
1449
|
-
class
|
|
1390
|
+
class hr {
|
|
1450
1391
|
channels = /* @__PURE__ */ new Map();
|
|
1451
1392
|
handlersByChannel = /* @__PURE__ */ new Map();
|
|
1452
1393
|
markerStore = /* @__PURE__ */ new Map();
|
|
@@ -1471,12 +1412,12 @@ class Qn {
|
|
|
1471
1412
|
return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
|
|
1472
1413
|
}
|
|
1473
1414
|
addMarker(e, t, n) {
|
|
1474
|
-
if (e ===
|
|
1415
|
+
if (e === A && n !== pe)
|
|
1475
1416
|
throw new Error(
|
|
1476
1417
|
"Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
|
|
1477
1418
|
);
|
|
1478
|
-
if (n ===
|
|
1479
|
-
if (e !==
|
|
1419
|
+
if (n === pe) {
|
|
1420
|
+
if (e !== A)
|
|
1480
1421
|
throw new Error(
|
|
1481
1422
|
`Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
|
|
1482
1423
|
);
|
|
@@ -1489,7 +1430,7 @@ class Qn {
|
|
|
1489
1430
|
return this.markerStore.set(e, { key: e, contract: t, blueId: n }), this;
|
|
1490
1431
|
}
|
|
1491
1432
|
build() {
|
|
1492
|
-
return
|
|
1433
|
+
return _.fromComponents(
|
|
1493
1434
|
new Map(this.channels),
|
|
1494
1435
|
new Map(
|
|
1495
1436
|
Array.from(this.handlersByChannel.entries(), ([e, t]) => [
|
|
@@ -1503,12 +1444,12 @@ class Qn {
|
|
|
1503
1444
|
);
|
|
1504
1445
|
}
|
|
1505
1446
|
}
|
|
1506
|
-
class
|
|
1447
|
+
class g extends Error {
|
|
1507
1448
|
constructor(e, t) {
|
|
1508
1449
|
super(e || "Processor fatal error"), this.processorError = t, this.name = "ProcessorFatalError";
|
|
1509
1450
|
}
|
|
1510
1451
|
}
|
|
1511
|
-
class
|
|
1452
|
+
class pr {
|
|
1512
1453
|
constructor(e, t, n) {
|
|
1513
1454
|
this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
|
|
1514
1455
|
}
|
|
@@ -1531,18 +1472,18 @@ class Yn {
|
|
|
1531
1472
|
handlerKey: t
|
|
1532
1473
|
}), d = s.get(u);
|
|
1533
1474
|
if (!d)
|
|
1534
|
-
throw new
|
|
1475
|
+
throw new g(
|
|
1535
1476
|
`Handler ${t} references unknown channel '${u}'`,
|
|
1536
|
-
|
|
1477
|
+
E.invalidContract(
|
|
1537
1478
|
o,
|
|
1538
1479
|
`Channel '${u}' is not declared in this scope`,
|
|
1539
1480
|
`/contracts/${u}`
|
|
1540
1481
|
)
|
|
1541
1482
|
);
|
|
1542
1483
|
if (!this.isRegisteredChannel(d.nodeTypeBlueId))
|
|
1543
|
-
throw new
|
|
1484
|
+
throw new g(
|
|
1544
1485
|
`Contract '${u}' is not a channel`,
|
|
1545
|
-
|
|
1486
|
+
E.invalidContract(
|
|
1546
1487
|
d.nodeTypeBlueId,
|
|
1547
1488
|
`Contract '${u}' is not a channel`,
|
|
1548
1489
|
`/contracts/${u}`
|
|
@@ -1551,9 +1492,9 @@ class Yn {
|
|
|
1551
1492
|
e.addHandler(t, { ...c, channel: u }, o);
|
|
1552
1493
|
} catch (a) {
|
|
1553
1494
|
if (this.isZodError(a))
|
|
1554
|
-
throw new
|
|
1495
|
+
throw new g(
|
|
1555
1496
|
"Failed to parse handler contract",
|
|
1556
|
-
|
|
1497
|
+
E.invalidContract(
|
|
1557
1498
|
o,
|
|
1558
1499
|
"Failed to parse handler contract",
|
|
1559
1500
|
t,
|
|
@@ -1561,9 +1502,9 @@ class Yn {
|
|
|
1561
1502
|
)
|
|
1562
1503
|
);
|
|
1563
1504
|
const c = a?.message ?? "Failed to register handler contract";
|
|
1564
|
-
throw new
|
|
1505
|
+
throw new g(
|
|
1565
1506
|
c,
|
|
1566
|
-
|
|
1507
|
+
E.illegalState(c)
|
|
1567
1508
|
);
|
|
1568
1509
|
}
|
|
1569
1510
|
}
|
|
@@ -1585,9 +1526,9 @@ class Yn {
|
|
|
1585
1526
|
}
|
|
1586
1527
|
}
|
|
1587
1528
|
if (!o)
|
|
1588
|
-
throw new
|
|
1529
|
+
throw new g(
|
|
1589
1530
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`,
|
|
1590
|
-
|
|
1531
|
+
E.illegalState(
|
|
1591
1532
|
`Handler ${r} must declare channel (missing explicit channel and derivation failed)`
|
|
1592
1533
|
)
|
|
1593
1534
|
);
|
|
@@ -1597,7 +1538,7 @@ class Yn {
|
|
|
1597
1538
|
return this.builtinChannelSchemas.has(e) ? !0 : this.registry.lookupChannel(e) != null;
|
|
1598
1539
|
}
|
|
1599
1540
|
isZodError(e) {
|
|
1600
|
-
return e instanceof
|
|
1541
|
+
return e instanceof Ue;
|
|
1601
1542
|
}
|
|
1602
1543
|
}
|
|
1603
1544
|
class K extends Error {
|
|
@@ -1605,69 +1546,69 @@ class K extends Error {
|
|
|
1605
1546
|
super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
|
|
1606
1547
|
}
|
|
1607
1548
|
}
|
|
1608
|
-
const
|
|
1549
|
+
const mr = p["Core/Document Update Channel"], fr = p["Core/Embedded Node Channel"], gr = p["Core/Lifecycle Event Channel"], Er = p["Core/Triggered Event Channel"], De = p["Core/Process Embedded"], yr = p["Core/Processing Initialized Marker"], Sr = p["Core/Processing Terminated Marker"], Cr = p["Core/Channel Event Checkpoint"], wr = k["MyOS/Document Anchors"], vr = k["MyOS/Document Links"], kr = k["MyOS/MyOS Participants Orchestration"], br = k["MyOS/MyOS Session Interaction"], Ir = k["MyOS/MyOS Worker Agency"], xe = /* @__PURE__ */ new Map([
|
|
1609
1550
|
[
|
|
1610
|
-
|
|
1611
|
-
|
|
1551
|
+
mr,
|
|
1552
|
+
sn
|
|
1612
1553
|
],
|
|
1613
1554
|
[
|
|
1614
|
-
|
|
1615
|
-
|
|
1555
|
+
fr,
|
|
1556
|
+
cn
|
|
1616
1557
|
],
|
|
1617
1558
|
[
|
|
1618
|
-
|
|
1619
|
-
|
|
1559
|
+
gr,
|
|
1560
|
+
un
|
|
1620
1561
|
],
|
|
1621
1562
|
[
|
|
1622
|
-
|
|
1623
|
-
|
|
1563
|
+
Er,
|
|
1564
|
+
hn
|
|
1624
1565
|
]
|
|
1625
|
-
]),
|
|
1566
|
+
]), Tr = /* @__PURE__ */ new Map([
|
|
1626
1567
|
[
|
|
1627
|
-
|
|
1628
|
-
|
|
1568
|
+
yr,
|
|
1569
|
+
Sn
|
|
1629
1570
|
],
|
|
1630
1571
|
[
|
|
1631
|
-
|
|
1632
|
-
|
|
1572
|
+
Sr,
|
|
1573
|
+
kn
|
|
1633
1574
|
],
|
|
1634
1575
|
[
|
|
1635
|
-
|
|
1636
|
-
|
|
1576
|
+
Cr,
|
|
1577
|
+
En
|
|
1637
1578
|
],
|
|
1638
1579
|
[
|
|
1639
|
-
|
|
1640
|
-
|
|
1580
|
+
wr,
|
|
1581
|
+
Rn
|
|
1641
1582
|
],
|
|
1642
1583
|
[
|
|
1643
|
-
|
|
1644
|
-
|
|
1584
|
+
vr,
|
|
1585
|
+
On
|
|
1645
1586
|
],
|
|
1646
1587
|
[
|
|
1647
|
-
|
|
1648
|
-
|
|
1588
|
+
kr,
|
|
1589
|
+
An
|
|
1649
1590
|
],
|
|
1650
1591
|
[
|
|
1651
|
-
|
|
1652
|
-
|
|
1592
|
+
br,
|
|
1593
|
+
xn
|
|
1653
1594
|
],
|
|
1654
1595
|
[
|
|
1655
|
-
|
|
1656
|
-
|
|
1596
|
+
Ir,
|
|
1597
|
+
Ln
|
|
1657
1598
|
]
|
|
1658
1599
|
]);
|
|
1659
|
-
class
|
|
1600
|
+
class Rr {
|
|
1660
1601
|
constructor(e, t) {
|
|
1661
|
-
this.registry = e, this.blue = t, this.handlerRegistration = new
|
|
1602
|
+
this.registry = e, this.blue = t, this.handlerRegistration = new pr(
|
|
1662
1603
|
this.blue,
|
|
1663
1604
|
this.registry,
|
|
1664
|
-
|
|
1605
|
+
xe
|
|
1665
1606
|
);
|
|
1666
1607
|
}
|
|
1667
1608
|
handlerRegistration;
|
|
1668
1609
|
load(e, t) {
|
|
1669
1610
|
try {
|
|
1670
|
-
const n =
|
|
1611
|
+
const n = _.builder(), r = e.getContracts();
|
|
1671
1612
|
if (!r)
|
|
1672
1613
|
return n.build();
|
|
1673
1614
|
const o = this.buildScopeContractsIndex(r);
|
|
@@ -1675,12 +1616,12 @@ class dr {
|
|
|
1675
1616
|
a && this.processContract(n, s, a, o);
|
|
1676
1617
|
return n.build();
|
|
1677
1618
|
} catch (n) {
|
|
1678
|
-
if (n instanceof K || n instanceof
|
|
1619
|
+
if (n instanceof K || n instanceof g)
|
|
1679
1620
|
throw n;
|
|
1680
1621
|
const r = n?.message ?? "Failed to load contracts";
|
|
1681
|
-
throw new
|
|
1622
|
+
throw new g(
|
|
1682
1623
|
`Failed to load contracts for scope ${t}: ${r}`,
|
|
1683
|
-
|
|
1624
|
+
E.runtimeFatal(
|
|
1684
1625
|
`Failed to load contracts for scope ${t}`,
|
|
1685
1626
|
n
|
|
1686
1627
|
)
|
|
@@ -1691,16 +1632,16 @@ class dr {
|
|
|
1691
1632
|
const o = n.getType()?.getBlueId();
|
|
1692
1633
|
if (!o)
|
|
1693
1634
|
return;
|
|
1694
|
-
if (o ===
|
|
1635
|
+
if (o === De) {
|
|
1695
1636
|
this.handleProcessEmbedded(e, t, n);
|
|
1696
1637
|
return;
|
|
1697
1638
|
}
|
|
1698
|
-
const s =
|
|
1639
|
+
const s = Tr.get(o);
|
|
1699
1640
|
if (s) {
|
|
1700
1641
|
this.handleMarker(e, t, n, s, o);
|
|
1701
1642
|
return;
|
|
1702
1643
|
}
|
|
1703
|
-
const a =
|
|
1644
|
+
const a = xe.get(o);
|
|
1704
1645
|
if (a) {
|
|
1705
1646
|
this.handleChannel(e, t, n, a, o);
|
|
1706
1647
|
return;
|
|
@@ -1739,9 +1680,9 @@ class dr {
|
|
|
1739
1680
|
);
|
|
1740
1681
|
return;
|
|
1741
1682
|
}
|
|
1742
|
-
throw
|
|
1683
|
+
throw fe(o) ? new g(
|
|
1743
1684
|
"Built-in processor-managed channel is missing schema registration",
|
|
1744
|
-
|
|
1685
|
+
E.invalidContract(
|
|
1745
1686
|
o,
|
|
1746
1687
|
"Built-in processor-managed channel is missing schema registration",
|
|
1747
1688
|
t
|
|
@@ -1752,21 +1693,21 @@ class dr {
|
|
|
1752
1693
|
try {
|
|
1753
1694
|
const r = this.convert(
|
|
1754
1695
|
n,
|
|
1755
|
-
|
|
1696
|
+
wn
|
|
1756
1697
|
);
|
|
1757
1698
|
e.setEmbedded(r);
|
|
1758
1699
|
} catch (r) {
|
|
1759
|
-
throw
|
|
1700
|
+
throw ae(r) ? new g(
|
|
1760
1701
|
"Failed to parse ProcessEmbedded marker",
|
|
1761
|
-
|
|
1762
|
-
|
|
1702
|
+
E.invalidContract(
|
|
1703
|
+
De,
|
|
1763
1704
|
"Failed to parse ProcessEmbedded marker",
|
|
1764
1705
|
t,
|
|
1765
1706
|
r
|
|
1766
1707
|
)
|
|
1767
|
-
) : new
|
|
1708
|
+
) : new g(
|
|
1768
1709
|
r?.message ?? "Failed to register ProcessEmbedded marker",
|
|
1769
|
-
|
|
1710
|
+
E.illegalState(
|
|
1770
1711
|
r?.message ?? "Failed to register ProcessEmbedded marker"
|
|
1771
1712
|
)
|
|
1772
1713
|
);
|
|
@@ -1777,10 +1718,10 @@ class dr {
|
|
|
1777
1718
|
const s = this.convert(n, r);
|
|
1778
1719
|
e.addChannel(t, s, o);
|
|
1779
1720
|
} catch (s) {
|
|
1780
|
-
if (
|
|
1781
|
-
throw new
|
|
1721
|
+
if (ae(s))
|
|
1722
|
+
throw new g(
|
|
1782
1723
|
"Failed to parse channel contract",
|
|
1783
|
-
|
|
1724
|
+
E.invalidContract(
|
|
1784
1725
|
o,
|
|
1785
1726
|
"Failed to parse channel contract",
|
|
1786
1727
|
t,
|
|
@@ -1788,9 +1729,9 @@ class dr {
|
|
|
1788
1729
|
)
|
|
1789
1730
|
);
|
|
1790
1731
|
const a = s?.message ?? "Failed to register channel contract";
|
|
1791
|
-
throw new
|
|
1732
|
+
throw new g(
|
|
1792
1733
|
a,
|
|
1793
|
-
|
|
1734
|
+
E.illegalState(a)
|
|
1794
1735
|
);
|
|
1795
1736
|
}
|
|
1796
1737
|
}
|
|
@@ -1799,10 +1740,10 @@ class dr {
|
|
|
1799
1740
|
const s = this.convert(n, r);
|
|
1800
1741
|
e.addMarker(t, s, o);
|
|
1801
1742
|
} catch (s) {
|
|
1802
|
-
if (
|
|
1803
|
-
throw new
|
|
1743
|
+
if (ae(s))
|
|
1744
|
+
throw new g(
|
|
1804
1745
|
"Failed to parse marker contract",
|
|
1805
|
-
|
|
1746
|
+
E.invalidContract(
|
|
1806
1747
|
o,
|
|
1807
1748
|
"Failed to parse marker contract",
|
|
1808
1749
|
t,
|
|
@@ -1810,9 +1751,9 @@ class dr {
|
|
|
1810
1751
|
)
|
|
1811
1752
|
);
|
|
1812
1753
|
const a = s?.message ?? "Failed to register marker contract";
|
|
1813
|
-
throw new
|
|
1754
|
+
throw new g(
|
|
1814
1755
|
a,
|
|
1815
|
-
|
|
1756
|
+
E.illegalState(a)
|
|
1816
1757
|
);
|
|
1817
1758
|
}
|
|
1818
1759
|
}
|
|
@@ -1830,27 +1771,27 @@ class dr {
|
|
|
1830
1771
|
return this.blue.nodeToSchemaOutput(e, t);
|
|
1831
1772
|
}
|
|
1832
1773
|
}
|
|
1833
|
-
function
|
|
1834
|
-
return i instanceof
|
|
1774
|
+
function ae(i) {
|
|
1775
|
+
return i instanceof Ue;
|
|
1835
1776
|
}
|
|
1836
|
-
const
|
|
1837
|
-
function
|
|
1777
|
+
const Mr = p["Core/Channel Event Checkpoint"];
|
|
1778
|
+
function Pr(i) {
|
|
1838
1779
|
return i.jsonValueToNode({
|
|
1839
|
-
type: { blueId:
|
|
1780
|
+
type: { blueId: Mr },
|
|
1840
1781
|
lastEvents: {},
|
|
1841
1782
|
lastSignatures: {}
|
|
1842
1783
|
});
|
|
1843
1784
|
}
|
|
1844
|
-
function
|
|
1785
|
+
function Or() {
|
|
1845
1786
|
return {
|
|
1846
1787
|
lastEvents: {},
|
|
1847
1788
|
lastSignatures: {}
|
|
1848
1789
|
};
|
|
1849
1790
|
}
|
|
1850
|
-
function
|
|
1791
|
+
function Be(i) {
|
|
1851
1792
|
return i != null && Object.prototype.hasOwnProperty.call(i, "lastEvents") && Object.prototype.hasOwnProperty.call(i, "lastSignatures");
|
|
1852
1793
|
}
|
|
1853
|
-
class
|
|
1794
|
+
class Nr {
|
|
1854
1795
|
constructor(e, t, n, r, o) {
|
|
1855
1796
|
this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = o;
|
|
1856
1797
|
}
|
|
@@ -1860,28 +1801,28 @@ class mr {
|
|
|
1860
1801
|
return e != null && e === this.lastEventSignature;
|
|
1861
1802
|
}
|
|
1862
1803
|
}
|
|
1863
|
-
class
|
|
1804
|
+
class Ar {
|
|
1864
1805
|
constructor(e, t) {
|
|
1865
1806
|
this.runtime = e, this.signatureFn = t;
|
|
1866
1807
|
}
|
|
1867
1808
|
ensureCheckpointMarker(e, t) {
|
|
1868
|
-
const n = t.marker(
|
|
1809
|
+
const n = t.marker(A), r = b(e, Ke);
|
|
1869
1810
|
if (!n) {
|
|
1870
|
-
const o =
|
|
1871
|
-
this.runtime.directWrite(r, o), t.registerCheckpointMarker(
|
|
1811
|
+
const o = Pr(this.runtime.blue());
|
|
1812
|
+
this.runtime.directWrite(r, o), t.registerCheckpointMarker(Or());
|
|
1872
1813
|
return;
|
|
1873
1814
|
}
|
|
1874
|
-
if (!
|
|
1815
|
+
if (!Be(n))
|
|
1875
1816
|
throw new Error(
|
|
1876
1817
|
`Reserved key 'checkpoint' must contain a Channel Event Checkpoint at ${r}`
|
|
1877
1818
|
);
|
|
1878
1819
|
}
|
|
1879
1820
|
findCheckpoint(e, t) {
|
|
1880
1821
|
for (const [n, r] of e.markerEntries()) {
|
|
1881
|
-
if (!
|
|
1822
|
+
if (!Be(r))
|
|
1882
1823
|
continue;
|
|
1883
1824
|
const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
|
|
1884
|
-
return new
|
|
1825
|
+
return new Nr(
|
|
1885
1826
|
n,
|
|
1886
1827
|
r,
|
|
1887
1828
|
t,
|
|
@@ -1897,19 +1838,19 @@ class gr {
|
|
|
1897
1838
|
persist(e, t, n, r, o) {
|
|
1898
1839
|
if (!n)
|
|
1899
1840
|
return;
|
|
1900
|
-
const s =
|
|
1841
|
+
const s = b(
|
|
1901
1842
|
e,
|
|
1902
|
-
|
|
1843
|
+
je(n.markerKey, n.channelKey)
|
|
1903
1844
|
), a = o?.clone() ?? null;
|
|
1904
1845
|
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;
|
|
1905
|
-
const c =
|
|
1846
|
+
const c = b(
|
|
1906
1847
|
e,
|
|
1907
|
-
|
|
1848
|
+
Qe(n.markerKey, n.channelKey)
|
|
1908
1849
|
), u = r == null ? null : new h().setValue(r);
|
|
1909
1850
|
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;
|
|
1910
1851
|
}
|
|
1911
1852
|
}
|
|
1912
|
-
class
|
|
1853
|
+
class Dr {
|
|
1913
1854
|
constructor(e, t, n) {
|
|
1914
1855
|
this.runtime = e, this.checkpointManager = t, this.deps = n;
|
|
1915
1856
|
}
|
|
@@ -1994,21 +1935,21 @@ class yr {
|
|
|
1994
1935
|
);
|
|
1995
1936
|
}
|
|
1996
1937
|
}
|
|
1997
|
-
function
|
|
1938
|
+
function xr(i, e) {
|
|
1998
1939
|
return e.isResolved() ? i.createResolvedNode(e) : i.resolve(e);
|
|
1999
1940
|
}
|
|
2000
|
-
class
|
|
1941
|
+
class L extends g {
|
|
2001
1942
|
constructor(e) {
|
|
2002
|
-
super(e,
|
|
1943
|
+
super(e, E.illegalState(e)), this.name = "IllegalStateException";
|
|
2003
1944
|
}
|
|
2004
1945
|
}
|
|
2005
|
-
class
|
|
1946
|
+
class x extends Error {
|
|
2006
1947
|
constructor(e) {
|
|
2007
1948
|
super(e), this.name = "BoundaryViolationException";
|
|
2008
1949
|
}
|
|
2009
1950
|
}
|
|
2010
|
-
const
|
|
2011
|
-
class
|
|
1951
|
+
const Br = p["Core/Document Update Channel"], Lr = p["Core/Embedded Node Channel"], _r = p["Core/Triggered Event Channel"], Fr = p["Core/Lifecycle Event Channel"], Le = p["Core/Processing Initialized Marker"], Ur = p["Core/Document Processing Initiated"];
|
|
1952
|
+
class zr {
|
|
2012
1953
|
runtime;
|
|
2013
1954
|
contractLoader;
|
|
2014
1955
|
channelRunner;
|
|
@@ -2022,25 +1963,25 @@ class kr {
|
|
|
2022
1963
|
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;
|
|
2023
1964
|
}
|
|
2024
1965
|
async initializeScope(e, t) {
|
|
2025
|
-
const n =
|
|
1966
|
+
const n = S(e), r = /* @__PURE__ */ new Set();
|
|
2026
1967
|
let o = null, s = null;
|
|
2027
1968
|
for (t && this.runtime.gasMeter().chargeScopeEntry(n); ; ) {
|
|
2028
|
-
const
|
|
2029
|
-
if (!
|
|
1969
|
+
const f = this.nodeAt(n);
|
|
1970
|
+
if (!f)
|
|
2030
1971
|
return;
|
|
2031
|
-
s || (s =
|
|
2032
|
-
const
|
|
2033
|
-
if (!
|
|
1972
|
+
s || (s = f.clone()), o = this.loadBundle(f, n), this.bundles.set(n, o);
|
|
1973
|
+
const y = o.embeddedPaths().find((P) => !r.has(P)) ?? null;
|
|
1974
|
+
if (!y)
|
|
2034
1975
|
break;
|
|
2035
|
-
r.add(
|
|
2036
|
-
const
|
|
2037
|
-
this.nodeAt(
|
|
1976
|
+
r.add(y);
|
|
1977
|
+
const w = b(n, y);
|
|
1978
|
+
this.nodeAt(w) && await this.initializeScope(w, !0);
|
|
2038
1979
|
}
|
|
2039
1980
|
if (!o)
|
|
2040
1981
|
return;
|
|
2041
1982
|
const a = this.hasInitializationMarker(n);
|
|
2042
1983
|
if (!a && o.hasCheckpoint())
|
|
2043
|
-
throw new
|
|
1984
|
+
throw new L(
|
|
2044
1985
|
`Reserved key 'checkpoint' must not appear before initialization at scope ${n}`
|
|
2045
1986
|
);
|
|
2046
1987
|
if (a)
|
|
@@ -2056,22 +1997,22 @@ class kr {
|
|
|
2056
1997
|
await this.deliverLifecycle(n, o, u, !0), await this.addInitializationMarker(d, c);
|
|
2057
1998
|
}
|
|
2058
1999
|
loadBundles(e) {
|
|
2059
|
-
const t =
|
|
2000
|
+
const t = S(e);
|
|
2060
2001
|
if (this.bundles.has(t))
|
|
2061
2002
|
return;
|
|
2062
|
-
const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) :
|
|
2003
|
+
const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : _.empty();
|
|
2063
2004
|
this.bundles.set(t, r);
|
|
2064
2005
|
for (const o of r.embeddedPaths()) {
|
|
2065
|
-
const s =
|
|
2006
|
+
const s = b(t, o);
|
|
2066
2007
|
this.loadBundles(s);
|
|
2067
2008
|
}
|
|
2068
2009
|
}
|
|
2069
2010
|
async processExternalEvent(e, t) {
|
|
2070
|
-
const n =
|
|
2011
|
+
const n = xr(this.runtime.blue(), t);
|
|
2071
2012
|
await this.processPreparedExternalEvent(e, n);
|
|
2072
2013
|
}
|
|
2073
2014
|
async processPreparedExternalEvent(e, t) {
|
|
2074
|
-
const n =
|
|
2015
|
+
const n = S(e);
|
|
2075
2016
|
if (this.hooks.isScopeInactive(n))
|
|
2076
2017
|
return;
|
|
2077
2018
|
this.runtime.gasMeter().chargeScopeEntry(n);
|
|
@@ -2086,7 +2027,7 @@ class kr {
|
|
|
2086
2027
|
for (const s of o) {
|
|
2087
2028
|
if (this.hooks.isScopeInactive(n))
|
|
2088
2029
|
break;
|
|
2089
|
-
|
|
2030
|
+
fe(s.blueId()) || await this.channelRunner.runExternalChannel(
|
|
2090
2031
|
n,
|
|
2091
2032
|
r,
|
|
2092
2033
|
s,
|
|
@@ -2105,7 +2046,7 @@ class kr {
|
|
|
2105
2046
|
r
|
|
2106
2047
|
);
|
|
2107
2048
|
} catch (o) {
|
|
2108
|
-
if (o instanceof
|
|
2049
|
+
if (o instanceof x) {
|
|
2109
2050
|
const s = this.hooks.fatalReason(o, "Boundary violation");
|
|
2110
2051
|
await this.hooks.enterFatalTermination(e, t, s);
|
|
2111
2052
|
return;
|
|
@@ -2133,13 +2074,13 @@ class kr {
|
|
|
2133
2074
|
if (!a || this.hooks.isScopeInactive(s))
|
|
2134
2075
|
continue;
|
|
2135
2076
|
const c = this.createDocumentUpdateEvent(o, s), u = a.channelsOfType(
|
|
2136
|
-
|
|
2077
|
+
Br
|
|
2137
2078
|
);
|
|
2138
2079
|
for (const d of u) {
|
|
2139
|
-
const
|
|
2080
|
+
const f = d.contract();
|
|
2140
2081
|
if (this.matchesDocumentUpdate(
|
|
2141
2082
|
s,
|
|
2142
|
-
|
|
2083
|
+
f.path ?? null,
|
|
2143
2084
|
o.path
|
|
2144
2085
|
) && (await this.channelRunner.runHandlers(
|
|
2145
2086
|
s,
|
|
@@ -2152,12 +2093,12 @@ class kr {
|
|
|
2152
2093
|
}
|
|
2153
2094
|
}
|
|
2154
2095
|
} catch (o) {
|
|
2155
|
-
if (o instanceof
|
|
2096
|
+
if (o instanceof x) {
|
|
2156
2097
|
const s = this.hooks.fatalReason(o, "Boundary violation");
|
|
2157
2098
|
await this.hooks.enterFatalTermination(e, t, s);
|
|
2158
2099
|
return;
|
|
2159
2100
|
}
|
|
2160
|
-
if (o instanceof
|
|
2101
|
+
if (o instanceof L || o instanceof Error && !(o instanceof g)) {
|
|
2161
2102
|
const s = this.hooks.fatalReason(o, "Runtime fatal");
|
|
2162
2103
|
await this.hooks.enterFatalTermination(e, t, s);
|
|
2163
2104
|
return;
|
|
@@ -2170,7 +2111,7 @@ class kr {
|
|
|
2170
2111
|
if (this.runtime.gasMeter().chargeLifecycleDelivery(), await this.hooks.recordLifecycleForBridging(e, n), !t)
|
|
2171
2112
|
return;
|
|
2172
2113
|
const o = t.channelsOfType(
|
|
2173
|
-
|
|
2114
|
+
Fr
|
|
2174
2115
|
);
|
|
2175
2116
|
for (const s of o)
|
|
2176
2117
|
if (await this.channelRunner.runHandlers(
|
|
@@ -2184,14 +2125,14 @@ class kr {
|
|
|
2184
2125
|
r && await this.finalizeScope(e, t);
|
|
2185
2126
|
}
|
|
2186
2127
|
async processEmbeddedChildren(e, t) {
|
|
2187
|
-
const n =
|
|
2128
|
+
const n = S(e), r = /* @__PURE__ */ new Set();
|
|
2188
2129
|
let o = this.refreshBundle(n);
|
|
2189
2130
|
for (; o; ) {
|
|
2190
2131
|
const s = this.nextEmbeddedPath(o, r);
|
|
2191
2132
|
if (!s)
|
|
2192
2133
|
return o;
|
|
2193
2134
|
r.add(s);
|
|
2194
|
-
const a =
|
|
2135
|
+
const a = b(n, s);
|
|
2195
2136
|
if (a === n || this.hooks.isScopeInactive(a)) {
|
|
2196
2137
|
o = this.refreshBundle(n);
|
|
2197
2138
|
continue;
|
|
@@ -2201,7 +2142,7 @@ class kr {
|
|
|
2201
2142
|
return null;
|
|
2202
2143
|
}
|
|
2203
2144
|
refreshBundle(e) {
|
|
2204
|
-
const t =
|
|
2145
|
+
const t = S(e), n = this.nodeAt(t);
|
|
2205
2146
|
if (!n)
|
|
2206
2147
|
return this.bundles.delete(t), null;
|
|
2207
2148
|
const r = this.loadBundle(n, t);
|
|
@@ -2219,12 +2160,12 @@ class kr {
|
|
|
2219
2160
|
try {
|
|
2220
2161
|
return this.contractLoader.load(e, t);
|
|
2221
2162
|
} catch (n) {
|
|
2222
|
-
if (n instanceof
|
|
2163
|
+
if (n instanceof g || n instanceof K)
|
|
2223
2164
|
throw n;
|
|
2224
2165
|
const r = n?.message ?? "Failed to load contracts";
|
|
2225
|
-
throw new
|
|
2166
|
+
throw new g(
|
|
2226
2167
|
r,
|
|
2227
|
-
|
|
2168
|
+
E.runtimeFatal(
|
|
2228
2169
|
`Failed to load contracts for scope ${t}`,
|
|
2229
2170
|
n
|
|
2230
2171
|
)
|
|
@@ -2232,7 +2173,7 @@ class kr {
|
|
|
2232
2173
|
}
|
|
2233
2174
|
}
|
|
2234
2175
|
async addInitializationMarker(e, t) {
|
|
2235
|
-
const n = new h().setType(new h().setBlueId(
|
|
2176
|
+
const n = new h().setType(new h().setBlueId(Le)).addProperty("documentId", new h().setValue(t)), r = e.resolvePointer(ue);
|
|
2236
2177
|
await e.applyPatch({
|
|
2237
2178
|
op: "ADD",
|
|
2238
2179
|
path: r,
|
|
@@ -2246,17 +2187,17 @@ class kr {
|
|
|
2246
2187
|
if (this.hooks.isScopeInactive(e) || t.embeddedPaths().length === 0)
|
|
2247
2188
|
return;
|
|
2248
2189
|
const n = t.channelsOfType(
|
|
2249
|
-
|
|
2190
|
+
Lr
|
|
2250
2191
|
);
|
|
2251
2192
|
if (n.length !== 0)
|
|
2252
2193
|
for (const r of t.embeddedPaths()) {
|
|
2253
|
-
const o =
|
|
2194
|
+
const o = b(e, r), a = this.runtime.scope(o).drainBridgeableEvents();
|
|
2254
2195
|
if (a.length !== 0)
|
|
2255
2196
|
for (const c of a) {
|
|
2256
2197
|
let u = !1;
|
|
2257
2198
|
for (const d of n) {
|
|
2258
|
-
const
|
|
2259
|
-
|
|
2199
|
+
const y = d.contract().childPath ?? "/";
|
|
2200
|
+
b(e, y) === o && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
|
|
2260
2201
|
e,
|
|
2261
2202
|
t,
|
|
2262
2203
|
d.key(),
|
|
@@ -2271,7 +2212,7 @@ class kr {
|
|
|
2271
2212
|
if (this.hooks.isScopeInactive(e))
|
|
2272
2213
|
return;
|
|
2273
2214
|
const n = this.runtime.scope(e), r = t.channelsOfType(
|
|
2274
|
-
|
|
2215
|
+
_r
|
|
2275
2216
|
);
|
|
2276
2217
|
if (r.length === 0) {
|
|
2277
2218
|
n.clearTriggered();
|
|
@@ -2301,19 +2242,19 @@ class kr {
|
|
|
2301
2242
|
}
|
|
2302
2243
|
}
|
|
2303
2244
|
validatePatchBoundary(e, t, n) {
|
|
2304
|
-
const r =
|
|
2245
|
+
const r = S(e), o = T(n.path);
|
|
2305
2246
|
if (o === r)
|
|
2306
|
-
throw new
|
|
2247
|
+
throw new x(
|
|
2307
2248
|
`Self-root mutation is forbidden at scope ${r}`
|
|
2308
2249
|
);
|
|
2309
2250
|
if (r !== "/" && !o.startsWith(`${r}/`))
|
|
2310
|
-
throw new
|
|
2251
|
+
throw new x(
|
|
2311
2252
|
`Patch path ${o} is outside scope ${r}`
|
|
2312
2253
|
);
|
|
2313
2254
|
for (const s of t.embeddedPaths()) {
|
|
2314
|
-
const a =
|
|
2255
|
+
const a = b(r, s);
|
|
2315
2256
|
if (o.startsWith(`${a}/`))
|
|
2316
|
-
throw new
|
|
2257
|
+
throw new x(
|
|
2317
2258
|
`Boundary violation: patch ${o} enters embedded scope ${a}`
|
|
2318
2259
|
);
|
|
2319
2260
|
}
|
|
@@ -2321,14 +2262,14 @@ class kr {
|
|
|
2321
2262
|
enforceReservedKeyWriteProtection(e, t, n) {
|
|
2322
2263
|
if (n)
|
|
2323
2264
|
return;
|
|
2324
|
-
const r =
|
|
2325
|
-
for (const s of
|
|
2326
|
-
const a =
|
|
2265
|
+
const r = S(e), o = T(t.path);
|
|
2266
|
+
for (const s of me) {
|
|
2267
|
+
const a = b(
|
|
2327
2268
|
r,
|
|
2328
|
-
|
|
2269
|
+
ee(s)
|
|
2329
2270
|
);
|
|
2330
2271
|
if (o === a || o.startsWith(`${a}/`))
|
|
2331
|
-
throw new
|
|
2272
|
+
throw new x(
|
|
2332
2273
|
`Reserved key '${s}' is write-protected at ${a}`
|
|
2333
2274
|
);
|
|
2334
2275
|
}
|
|
@@ -2338,26 +2279,26 @@ class kr {
|
|
|
2338
2279
|
return;
|
|
2339
2280
|
const r = T(n.path);
|
|
2340
2281
|
for (const o of t.embeddedPaths()) {
|
|
2341
|
-
const s =
|
|
2282
|
+
const s = b(e, o);
|
|
2342
2283
|
r === s && (n.op === "remove" || n.op === "replace") && await this.hooks.markCutOff(s);
|
|
2343
2284
|
}
|
|
2344
2285
|
}
|
|
2345
2286
|
hasInitializationMarker(e) {
|
|
2346
|
-
const t =
|
|
2287
|
+
const t = b(e, ue), n = this.nodeAt(t);
|
|
2347
2288
|
if (!n)
|
|
2348
2289
|
return !1;
|
|
2349
2290
|
if (!(n instanceof h)) {
|
|
2350
2291
|
const o = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
|
|
2351
|
-
throw new
|
|
2292
|
+
throw new L(o);
|
|
2352
2293
|
}
|
|
2353
|
-
if (n.getType()?.getBlueId() !==
|
|
2294
|
+
if (n.getType()?.getBlueId() !== Le) {
|
|
2354
2295
|
const o = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
|
|
2355
|
-
throw new
|
|
2296
|
+
throw new L(o);
|
|
2356
2297
|
}
|
|
2357
2298
|
return !0;
|
|
2358
2299
|
}
|
|
2359
2300
|
createLifecycleEvent(e) {
|
|
2360
|
-
return new h().setType(new h().setBlueId(
|
|
2301
|
+
return new h().setType(new h().setBlueId(Ur)).setProperties({
|
|
2361
2302
|
type: new h().setValue("Core/Document Processing Initiated"),
|
|
2362
2303
|
documentId: new h().setValue(e)
|
|
2363
2304
|
});
|
|
@@ -2370,19 +2311,19 @@ class Y extends Error {
|
|
|
2370
2311
|
), this.fatal = e, this.name = "RunTerminationError";
|
|
2371
2312
|
}
|
|
2372
2313
|
}
|
|
2373
|
-
const
|
|
2374
|
-
class
|
|
2314
|
+
const $r = p["Core/Processing Terminated Marker"], Vr = p["Core/Document Processing Terminated"];
|
|
2315
|
+
class Hr {
|
|
2375
2316
|
constructor(e) {
|
|
2376
2317
|
this.runtime = e;
|
|
2377
2318
|
}
|
|
2378
2319
|
async terminateScope(e, t, n, r, o) {
|
|
2379
2320
|
e.recordPendingTermination(t, r, o ?? null);
|
|
2380
|
-
const s = e.normalizeScope(t), a =
|
|
2321
|
+
const s = e.normalizeScope(t), a = b(s, Ge);
|
|
2381
2322
|
this.runtime.directWrite(
|
|
2382
2323
|
a,
|
|
2383
|
-
|
|
2324
|
+
Wr(this.runtime.blue(), r, o)
|
|
2384
2325
|
), this.runtime.gasMeter().chargeTerminationMarker();
|
|
2385
|
-
const c = n ?? e.bundleForScope(s) ?? null, u =
|
|
2326
|
+
const c = n ?? e.bundleForScope(s) ?? null, u = Gr(r, o);
|
|
2386
2327
|
if (await e.deliverLifecycle(
|
|
2387
2328
|
s,
|
|
2388
2329
|
c,
|
|
@@ -2394,32 +2335,32 @@ class Rr {
|
|
|
2394
2335
|
throw this.runtime.markRunTerminated(), new Y(!1);
|
|
2395
2336
|
}
|
|
2396
2337
|
}
|
|
2397
|
-
function
|
|
2398
|
-
return
|
|
2399
|
-
type: { blueId:
|
|
2338
|
+
function Wr(i, e, t) {
|
|
2339
|
+
return Kr(i, {
|
|
2340
|
+
type: { blueId: $r },
|
|
2400
2341
|
cause: e === "GRACEFUL" ? "graceful" : "fatal",
|
|
2401
2342
|
...t ? { reason: t } : {}
|
|
2402
2343
|
});
|
|
2403
2344
|
}
|
|
2404
|
-
function
|
|
2345
|
+
function Gr(i, e) {
|
|
2405
2346
|
const t = new h().setType(
|
|
2406
|
-
new h().setBlueId(
|
|
2347
|
+
new h().setBlueId(Vr)
|
|
2407
2348
|
);
|
|
2408
2349
|
return t.addProperty(
|
|
2409
2350
|
"cause",
|
|
2410
2351
|
new h().setValue(i === "GRACEFUL" ? "graceful" : "fatal")
|
|
2411
2352
|
), e && t.addProperty("reason", new h().setValue(e)), t;
|
|
2412
2353
|
}
|
|
2413
|
-
function
|
|
2354
|
+
function Kr(i, e) {
|
|
2414
2355
|
return i.jsonValueToNode(e);
|
|
2415
2356
|
}
|
|
2416
|
-
const
|
|
2417
|
-
class
|
|
2357
|
+
const W = "-";
|
|
2358
|
+
class qr {
|
|
2418
2359
|
constructor(e) {
|
|
2419
2360
|
this.document = e;
|
|
2420
2361
|
}
|
|
2421
2362
|
applyPatch(e, t) {
|
|
2422
|
-
const n =
|
|
2363
|
+
const n = S(e), r = T(t.path), o = Fe(r), s = _e(this.document, o, "before", r);
|
|
2423
2364
|
switch (t.op) {
|
|
2424
2365
|
case "ADD":
|
|
2425
2366
|
this.applyAdd(o, r, t.val ?? null);
|
|
@@ -2431,34 +2372,34 @@ class Or {
|
|
|
2431
2372
|
this.applyRemove(o, r);
|
|
2432
2373
|
break;
|
|
2433
2374
|
}
|
|
2434
|
-
const a = t.op === "REMOVE" ? null :
|
|
2375
|
+
const a = t.op === "REMOVE" ? null : _e(this.document, o, "after", r);
|
|
2435
2376
|
return {
|
|
2436
2377
|
path: r,
|
|
2437
2378
|
before: s,
|
|
2438
2379
|
after: a,
|
|
2439
2380
|
op: t.op.toLowerCase(),
|
|
2440
2381
|
originScope: n,
|
|
2441
|
-
cascadeScopes:
|
|
2382
|
+
cascadeScopes: Jr(n)
|
|
2442
2383
|
};
|
|
2443
2384
|
}
|
|
2444
2385
|
directWrite(e, t) {
|
|
2445
2386
|
const n = T(e);
|
|
2446
2387
|
if (n === "/")
|
|
2447
2388
|
throw new Error("Direct write cannot target root document");
|
|
2448
|
-
const r =
|
|
2449
|
-
if (s ===
|
|
2389
|
+
const r = Fe(n), { parent: o, leaf: s } = this.resolveParent(r);
|
|
2390
|
+
if (s === W)
|
|
2450
2391
|
throw new Error(
|
|
2451
2392
|
`Direct write does not support append token '-' for path ${n}`
|
|
2452
2393
|
);
|
|
2453
2394
|
const a = o.getItems();
|
|
2454
|
-
if (a &&
|
|
2395
|
+
if (a && B(s)) {
|
|
2455
2396
|
this.directWriteArray(o, a, s, t, n);
|
|
2456
2397
|
return;
|
|
2457
2398
|
}
|
|
2458
2399
|
this.directWriteObject(o, s, t);
|
|
2459
2400
|
}
|
|
2460
2401
|
directWriteArray(e, t, n, r, o) {
|
|
2461
|
-
const s =
|
|
2402
|
+
const s = ce(e, t), a = N(n, o);
|
|
2462
2403
|
if (r == null) {
|
|
2463
2404
|
if (a < 0 || a >= s.length)
|
|
2464
2405
|
return;
|
|
@@ -2499,21 +2440,21 @@ class Or {
|
|
|
2499
2440
|
return { parent: t, leaf: e[e.length - 1] };
|
|
2500
2441
|
}
|
|
2501
2442
|
getOrCreateChild(e, t, n, r) {
|
|
2502
|
-
if (t ===
|
|
2443
|
+
if (t === W)
|
|
2503
2444
|
throw new Error(
|
|
2504
|
-
`Append token '-' must be final segment: ${
|
|
2445
|
+
`Append token '-' must be final segment: ${V(n, r)}`
|
|
2505
2446
|
);
|
|
2506
2447
|
const o = e.getItems();
|
|
2507
|
-
if (o &&
|
|
2508
|
-
const c =
|
|
2448
|
+
if (o && B(t)) {
|
|
2449
|
+
const c = N(t, V(n, r));
|
|
2509
2450
|
if (c < 0 || c >= o.length)
|
|
2510
2451
|
throw new Error(
|
|
2511
|
-
`Array index out of bounds: ${
|
|
2452
|
+
`Array index out of bounds: ${V(n, r)}`
|
|
2512
2453
|
);
|
|
2513
2454
|
const u = o[c];
|
|
2514
2455
|
if (!u)
|
|
2515
2456
|
throw new Error(
|
|
2516
|
-
`Path does not exist: ${
|
|
2457
|
+
`Path does not exist: ${V(n, r)}`
|
|
2517
2458
|
);
|
|
2518
2459
|
return u;
|
|
2519
2460
|
}
|
|
@@ -2530,24 +2471,24 @@ class Or {
|
|
|
2530
2471
|
"ADD"
|
|
2531
2472
|
);
|
|
2532
2473
|
try {
|
|
2533
|
-
if (
|
|
2534
|
-
const u = r.getItems(), d = o ===
|
|
2474
|
+
if (B(o)) {
|
|
2475
|
+
const u = r.getItems(), d = o === W;
|
|
2535
2476
|
if (!u)
|
|
2536
2477
|
throw new Error(
|
|
2537
2478
|
d ? `Append token '-' requires array at ${s}` : `Array index segment requires array at ${s}`
|
|
2538
2479
|
);
|
|
2539
2480
|
if (d) {
|
|
2540
|
-
|
|
2481
|
+
ce(r, u).push(H(n));
|
|
2541
2482
|
return;
|
|
2542
2483
|
}
|
|
2543
|
-
const
|
|
2544
|
-
if (
|
|
2484
|
+
const f = N(o, t);
|
|
2485
|
+
if (f < 0 || f > u.length)
|
|
2545
2486
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2546
|
-
|
|
2487
|
+
ce(r, u).splice(f, 0, H(n));
|
|
2547
2488
|
return;
|
|
2548
2489
|
}
|
|
2549
2490
|
const c = J(r);
|
|
2550
|
-
c[o] =
|
|
2491
|
+
c[o] = H(n), r.setProperties(c);
|
|
2551
2492
|
} catch (c) {
|
|
2552
2493
|
throw this.rollbackCreated(a), c;
|
|
2553
2494
|
}
|
|
@@ -2561,18 +2502,18 @@ class Or {
|
|
|
2561
2502
|
"REPLACE"
|
|
2562
2503
|
);
|
|
2563
2504
|
try {
|
|
2564
|
-
if (
|
|
2505
|
+
if (B(o)) {
|
|
2565
2506
|
const c = r.getItems();
|
|
2566
2507
|
if (!c)
|
|
2567
2508
|
throw new Error(`Array index segment requires array at ${t}`);
|
|
2568
|
-
const u =
|
|
2509
|
+
const u = N(o, t);
|
|
2569
2510
|
if (u < 0 || u >= c.length)
|
|
2570
2511
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2571
|
-
c[u] =
|
|
2512
|
+
c[u] = H(n), r.setItems(c);
|
|
2572
2513
|
return;
|
|
2573
2514
|
}
|
|
2574
2515
|
const a = J(r);
|
|
2575
|
-
a[o] =
|
|
2516
|
+
a[o] = H(n), r.setProperties(a);
|
|
2576
2517
|
} catch (a) {
|
|
2577
2518
|
throw this.rollbackCreated(s), a;
|
|
2578
2519
|
}
|
|
@@ -2585,11 +2526,11 @@ class Or {
|
|
|
2585
2526
|
t,
|
|
2586
2527
|
"REMOVE"
|
|
2587
2528
|
);
|
|
2588
|
-
if (
|
|
2529
|
+
if (B(r)) {
|
|
2589
2530
|
const a = n.getItems();
|
|
2590
2531
|
if (!a)
|
|
2591
2532
|
throw new Error(`Array index segment requires array at ${t}`);
|
|
2592
|
-
const c =
|
|
2533
|
+
const c = N(r, t);
|
|
2593
2534
|
if (c < 0 || c >= a.length)
|
|
2594
2535
|
throw new Error(`Array index out of bounds in path: ${t}`);
|
|
2595
2536
|
a.splice(c, 1), n.setItems(a);
|
|
@@ -2607,27 +2548,27 @@ class Or {
|
|
|
2607
2548
|
let r = this.document;
|
|
2608
2549
|
const o = [];
|
|
2609
2550
|
for (let a = 0; a < e.length - 1; a += 1) {
|
|
2610
|
-
const c = e[a], u =
|
|
2611
|
-
if (
|
|
2612
|
-
const
|
|
2613
|
-
if (!
|
|
2551
|
+
const c = e[a], u = V(e, a + 1);
|
|
2552
|
+
if (B(c)) {
|
|
2553
|
+
const y = r.getItems();
|
|
2554
|
+
if (!y)
|
|
2614
2555
|
throw new Error(`Array index segment requires array at ${u}`);
|
|
2615
|
-
const
|
|
2616
|
-
if (
|
|
2556
|
+
const w = N(c, u);
|
|
2557
|
+
if (w < 0 || w >= y.length)
|
|
2617
2558
|
throw new Error(`Array index out of bounds in path: ${u}`);
|
|
2618
|
-
const
|
|
2619
|
-
if (!(
|
|
2559
|
+
const I = y[w];
|
|
2560
|
+
if (!(I instanceof h))
|
|
2620
2561
|
throw new Error(`Array index out of bounds in path: ${u}`);
|
|
2621
|
-
r =
|
|
2562
|
+
r = I;
|
|
2622
2563
|
continue;
|
|
2623
2564
|
}
|
|
2624
|
-
let d = r.getProperties(),
|
|
2625
|
-
if (!(
|
|
2565
|
+
let d = r.getProperties(), f = d?.[c] ?? null;
|
|
2566
|
+
if (!(f instanceof h)) {
|
|
2626
2567
|
if (n === "REMOVE")
|
|
2627
2568
|
throw new Error(`Path does not exist: ${u}`);
|
|
2628
|
-
|
|
2569
|
+
f = new h(), d || (d = {}), d[c] = f, r.setProperties(d), o.push({ owner: r, key: c });
|
|
2629
2570
|
}
|
|
2630
|
-
r =
|
|
2571
|
+
r = f;
|
|
2631
2572
|
}
|
|
2632
2573
|
const s = e[e.length - 1];
|
|
2633
2574
|
return { parent: r, key: s, pointer: t, created: o };
|
|
@@ -2639,7 +2580,7 @@ class Or {
|
|
|
2639
2580
|
}
|
|
2640
2581
|
}
|
|
2641
2582
|
}
|
|
2642
|
-
function
|
|
2583
|
+
function Jr(i) {
|
|
2643
2584
|
const e = [];
|
|
2644
2585
|
let t = i;
|
|
2645
2586
|
for (; e.push(t), t !== "/"; ) {
|
|
@@ -2648,36 +2589,36 @@ function Ar(i) {
|
|
|
2648
2589
|
}
|
|
2649
2590
|
return e;
|
|
2650
2591
|
}
|
|
2651
|
-
function
|
|
2592
|
+
function _e(i, e, t, n) {
|
|
2652
2593
|
try {
|
|
2653
2594
|
if (e.length === 0)
|
|
2654
2595
|
return i.clone();
|
|
2655
|
-
const r =
|
|
2596
|
+
const r = jr(i, e, t, n);
|
|
2656
2597
|
return r ? r.clone() : null;
|
|
2657
2598
|
} catch {
|
|
2658
2599
|
return null;
|
|
2659
2600
|
}
|
|
2660
2601
|
}
|
|
2661
|
-
function
|
|
2602
|
+
function jr(i, e, t, n) {
|
|
2662
2603
|
let r = i;
|
|
2663
2604
|
for (let o = 0; o < e.length; o += 1) {
|
|
2664
2605
|
const s = e[o] ?? "", a = o === e.length - 1;
|
|
2665
|
-
if (r =
|
|
2606
|
+
if (r = Qr(r, s, a, t, n), !r)
|
|
2666
2607
|
return null;
|
|
2667
2608
|
}
|
|
2668
2609
|
return r;
|
|
2669
2610
|
}
|
|
2670
|
-
function
|
|
2611
|
+
function Qr(i, e, t, n, r) {
|
|
2671
2612
|
if (!i)
|
|
2672
2613
|
return null;
|
|
2673
2614
|
const o = i.getItems();
|
|
2674
2615
|
if (o) {
|
|
2675
|
-
if (e ===
|
|
2616
|
+
if (e === W) {
|
|
2676
2617
|
if (!t)
|
|
2677
2618
|
throw new Error(`Append token '-' must be final segment: ${r}`);
|
|
2678
2619
|
return n === "before" || o.length === 0 ? null : o[o.length - 1] ?? null;
|
|
2679
2620
|
}
|
|
2680
|
-
const c =
|
|
2621
|
+
const c = N(e, r);
|
|
2681
2622
|
return c < 0 || c >= o.length ? null : o[c] ?? null;
|
|
2682
2623
|
}
|
|
2683
2624
|
const s = i.getProperties();
|
|
@@ -2686,13 +2627,13 @@ function Br(i, e, t, n, r) {
|
|
|
2686
2627
|
const a = s[e];
|
|
2687
2628
|
return a instanceof h ? a : null;
|
|
2688
2629
|
}
|
|
2689
|
-
function
|
|
2630
|
+
function Fe(i) {
|
|
2690
2631
|
if (i === "/" || i === "")
|
|
2691
2632
|
return [];
|
|
2692
2633
|
const e = i.startsWith("/") ? i.slice(1) : i;
|
|
2693
2634
|
return e.length === 0 ? [] : e.split("/");
|
|
2694
2635
|
}
|
|
2695
|
-
function
|
|
2636
|
+
function N(i, e) {
|
|
2696
2637
|
const t = Number.parseInt(i, 10);
|
|
2697
2638
|
if (Number.isNaN(t))
|
|
2698
2639
|
throw new Error(`Expected numeric array index in path: ${e}`);
|
|
@@ -2700,7 +2641,7 @@ function M(i, e) {
|
|
|
2700
2641
|
throw new Error(`Negative array index in path: ${e}`);
|
|
2701
2642
|
return t;
|
|
2702
2643
|
}
|
|
2703
|
-
function
|
|
2644
|
+
function V(i, e) {
|
|
2704
2645
|
if (e <= 0)
|
|
2705
2646
|
return "/";
|
|
2706
2647
|
const t = Math.min(e, i.length);
|
|
@@ -2709,7 +2650,7 @@ function z(i, e) {
|
|
|
2709
2650
|
n += `/${i[r] ?? ""}`;
|
|
2710
2651
|
return n === "" ? "/" : n;
|
|
2711
2652
|
}
|
|
2712
|
-
function
|
|
2653
|
+
function ce(i, e) {
|
|
2713
2654
|
const t = [...e];
|
|
2714
2655
|
return i.setItems(t), t;
|
|
2715
2656
|
}
|
|
@@ -2722,13 +2663,13 @@ function J(i) {
|
|
|
2722
2663
|
const t = { ...e };
|
|
2723
2664
|
return i.setProperties(t), t;
|
|
2724
2665
|
}
|
|
2725
|
-
function
|
|
2726
|
-
return i ===
|
|
2666
|
+
function B(i) {
|
|
2667
|
+
return i === W || /^\d+$/.test(i);
|
|
2727
2668
|
}
|
|
2728
|
-
function
|
|
2669
|
+
function H(i) {
|
|
2729
2670
|
return i == null ? new h().setValue(null) : i.clone();
|
|
2730
2671
|
}
|
|
2731
|
-
class
|
|
2672
|
+
class Xr {
|
|
2732
2673
|
constructor(e) {
|
|
2733
2674
|
this.path = e;
|
|
2734
2675
|
}
|
|
@@ -2790,7 +2731,7 @@ class Lr {
|
|
|
2790
2731
|
return this.cutOff;
|
|
2791
2732
|
}
|
|
2792
2733
|
}
|
|
2793
|
-
class
|
|
2734
|
+
class Yr {
|
|
2794
2735
|
scopesMap = /* @__PURE__ */ new Map();
|
|
2795
2736
|
rootEmissionList = [];
|
|
2796
2737
|
scopes() {
|
|
@@ -2798,7 +2739,7 @@ class xr {
|
|
|
2798
2739
|
}
|
|
2799
2740
|
scope(e) {
|
|
2800
2741
|
let t = this.scopesMap.get(e);
|
|
2801
|
-
return t || (t = new
|
|
2742
|
+
return t || (t = new Xr(e), this.scopesMap.set(e, t)), t;
|
|
2802
2743
|
}
|
|
2803
2744
|
existingScope(e) {
|
|
2804
2745
|
return this.scopesMap.get(e);
|
|
@@ -2816,45 +2757,33 @@ class xr {
|
|
|
2816
2757
|
this.scopesMap.delete(e);
|
|
2817
2758
|
}
|
|
2818
2759
|
}
|
|
2819
|
-
function
|
|
2760
|
+
function mt(i) {
|
|
2820
2761
|
return Math.floor((i + 99) / 100);
|
|
2821
2762
|
}
|
|
2822
|
-
function
|
|
2823
|
-
return new TextEncoder().encode(i).length;
|
|
2824
|
-
}
|
|
2825
|
-
function _r(i) {
|
|
2763
|
+
function Zr(i) {
|
|
2826
2764
|
const e = T(i);
|
|
2827
2765
|
return e === "/" ? 0 : e.split("/").length - 1;
|
|
2828
2766
|
}
|
|
2829
|
-
function
|
|
2830
|
-
return 100 + q(ye(i));
|
|
2831
|
-
}
|
|
2832
|
-
function Ur(i) {
|
|
2767
|
+
function ei(i) {
|
|
2833
2768
|
return 40 + 5 * Math.max(0, i);
|
|
2834
2769
|
}
|
|
2835
|
-
function
|
|
2836
|
-
return
|
|
2837
|
-
}
|
|
2838
|
-
function $r(i, e) {
|
|
2839
|
-
return 3 * Math.max(0, i) + q(ye(e));
|
|
2770
|
+
function ti(i, e) {
|
|
2771
|
+
return 8 + Zr(i) + mt(e);
|
|
2840
2772
|
}
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
}
|
|
2844
|
-
const Vr = 1e3, Wr = 5, Kr = 50, qr = 2, jr = 10, Jr = 10, Gr = 10, Qr = 20, Yr = 20, Xr = 30, Zr = 30, ei = 100;
|
|
2845
|
-
function ti(i) {
|
|
2773
|
+
const ni = 1e3, ri = 5, ii = 50, oi = 2, si = 10, ai = 10, ci = 10, li = 20, ui = 20, di = 30, hi = 30, pi = 100;
|
|
2774
|
+
function mi(i) {
|
|
2846
2775
|
return 50 + 10 * i;
|
|
2847
2776
|
}
|
|
2848
|
-
function
|
|
2777
|
+
function fi(i) {
|
|
2849
2778
|
return 20 + i;
|
|
2850
2779
|
}
|
|
2851
|
-
function
|
|
2780
|
+
function gi(i) {
|
|
2852
2781
|
return 10 * i;
|
|
2853
2782
|
}
|
|
2854
|
-
function
|
|
2783
|
+
function Ei(i) {
|
|
2855
2784
|
return 20 + i;
|
|
2856
2785
|
}
|
|
2857
|
-
class
|
|
2786
|
+
class yi {
|
|
2858
2787
|
constructor(e) {
|
|
2859
2788
|
this.blue = e;
|
|
2860
2789
|
}
|
|
@@ -2866,77 +2795,72 @@ class oi {
|
|
|
2866
2795
|
this.total += e;
|
|
2867
2796
|
}
|
|
2868
2797
|
chargeScopeEntry(e) {
|
|
2869
|
-
this.add(
|
|
2798
|
+
this.add(mi(this.scopeDepth(e)));
|
|
2870
2799
|
}
|
|
2871
2800
|
chargeInitialization() {
|
|
2872
|
-
this.add(
|
|
2801
|
+
this.add(ni);
|
|
2873
2802
|
}
|
|
2874
2803
|
chargeChannelMatchAttempt() {
|
|
2875
|
-
this.add(
|
|
2804
|
+
this.add(ri);
|
|
2876
2805
|
}
|
|
2877
2806
|
chargeHandlerOverhead() {
|
|
2878
|
-
this.add(
|
|
2807
|
+
this.add(ii);
|
|
2879
2808
|
}
|
|
2880
2809
|
chargeBoundaryCheck() {
|
|
2881
|
-
this.add(
|
|
2810
|
+
this.add(oi);
|
|
2882
2811
|
}
|
|
2883
2812
|
chargePatchAddOrReplace(e) {
|
|
2884
|
-
this.add(
|
|
2813
|
+
this.add(fi(this.payloadSizeCharge(e)));
|
|
2885
2814
|
}
|
|
2886
2815
|
chargePatchRemove() {
|
|
2887
|
-
this.add(
|
|
2816
|
+
this.add(si);
|
|
2888
2817
|
}
|
|
2889
2818
|
chargeCascadeRouting(e) {
|
|
2890
|
-
e > 0 && this.add(
|
|
2819
|
+
e > 0 && this.add(gi(e));
|
|
2891
2820
|
}
|
|
2892
2821
|
chargeEmitEvent(e) {
|
|
2893
|
-
this.add(
|
|
2822
|
+
this.add(Ei(this.payloadSizeCharge(e)));
|
|
2894
2823
|
}
|
|
2895
2824
|
chargeBridge() {
|
|
2896
|
-
this.add(
|
|
2825
|
+
this.add(ai);
|
|
2897
2826
|
}
|
|
2898
2827
|
chargeDrainEvent() {
|
|
2899
|
-
this.add(
|
|
2828
|
+
this.add(ci);
|
|
2900
2829
|
}
|
|
2901
2830
|
chargeCheckpointUpdate() {
|
|
2902
|
-
this.add(
|
|
2831
|
+
this.add(li);
|
|
2903
2832
|
}
|
|
2904
2833
|
chargeTerminationMarker() {
|
|
2905
|
-
this.add(
|
|
2834
|
+
this.add(ui);
|
|
2906
2835
|
}
|
|
2907
2836
|
chargeLifecycleDelivery() {
|
|
2908
|
-
this.add(
|
|
2837
|
+
this.add(di);
|
|
2909
2838
|
}
|
|
2910
2839
|
chargeFatalTerminationOverhead() {
|
|
2911
|
-
this.add(
|
|
2912
|
-
}
|
|
2913
|
-
chargeJavaScriptCodeBase(e) {
|
|
2914
|
-
this.add(Fr(e));
|
|
2840
|
+
this.add(pi);
|
|
2915
2841
|
}
|
|
2916
2842
|
chargeTriggerEventBase() {
|
|
2917
|
-
this.add(
|
|
2843
|
+
this.add(hi);
|
|
2918
2844
|
}
|
|
2919
2845
|
chargeUpdateDocumentBase(e) {
|
|
2920
|
-
this.add(
|
|
2921
|
-
}
|
|
2922
|
-
chargeExpression(e) {
|
|
2923
|
-
this.add(zr(e));
|
|
2924
|
-
}
|
|
2925
|
-
chargeTemplate(e, t) {
|
|
2926
|
-
this.add($r(e, t));
|
|
2846
|
+
this.add(ei(e));
|
|
2927
2847
|
}
|
|
2928
2848
|
chargeDocumentSnapshot(e, t) {
|
|
2929
|
-
const n = t ?
|
|
2930
|
-
this.add(
|
|
2849
|
+
const n = t ? be(this.blue, t) : 0;
|
|
2850
|
+
this.add(ti(e, n));
|
|
2851
|
+
}
|
|
2852
|
+
chargeWasmGas(e) {
|
|
2853
|
+
const t = Wt(e);
|
|
2854
|
+
t > 0 && this.add(t);
|
|
2931
2855
|
}
|
|
2932
2856
|
payloadSizeCharge(e) {
|
|
2933
2857
|
if (!e)
|
|
2934
2858
|
return 0;
|
|
2935
|
-
const t =
|
|
2936
|
-
return
|
|
2859
|
+
const t = be(this.blue, e);
|
|
2860
|
+
return mt(t);
|
|
2937
2861
|
}
|
|
2938
2862
|
scopeDepth(e) {
|
|
2939
|
-
const t =
|
|
2863
|
+
const t = S(e);
|
|
2940
2864
|
if (t === "/" || t.length <= 1)
|
|
2941
2865
|
return 0;
|
|
2942
2866
|
let n = 1;
|
|
@@ -2945,12 +2869,12 @@ class oi {
|
|
|
2945
2869
|
return n;
|
|
2946
2870
|
}
|
|
2947
2871
|
}
|
|
2948
|
-
class
|
|
2872
|
+
class Si {
|
|
2949
2873
|
constructor(e, t) {
|
|
2950
|
-
this.documentRef = e, this.blueRef = t, this.patchEngine = new
|
|
2874
|
+
this.documentRef = e, this.blueRef = t, this.patchEngine = new qr(this.documentRef), this.meter = new yi(this.blueRef);
|
|
2951
2875
|
}
|
|
2952
2876
|
patchEngine;
|
|
2953
|
-
emissionRegistry = new
|
|
2877
|
+
emissionRegistry = new Yr();
|
|
2954
2878
|
meter;
|
|
2955
2879
|
runTerminated = !1;
|
|
2956
2880
|
document() {
|
|
@@ -2999,15 +2923,15 @@ class si {
|
|
|
2999
2923
|
return this.patchEngine.applyPatch(e, t);
|
|
3000
2924
|
}
|
|
3001
2925
|
}
|
|
3002
|
-
const
|
|
3003
|
-
class
|
|
2926
|
+
const Ci = p["Core/Processing Initialized Marker"], wi = p["Core/Document Update"];
|
|
2927
|
+
class vi {
|
|
3004
2928
|
constructor(e, t, n, r) {
|
|
3005
|
-
this.contractLoader = e, this.registry = t, this.runtimeRef = new
|
|
3006
|
-
const o = (s) =>
|
|
3007
|
-
this.checkpointManager = new
|
|
2929
|
+
this.contractLoader = e, this.registry = t, this.runtimeRef = new Si(r, n);
|
|
2930
|
+
const o = (s) => Ye(this.runtimeRef.blue(), s);
|
|
2931
|
+
this.checkpointManager = new Ar(
|
|
3008
2932
|
this.runtimeRef,
|
|
3009
2933
|
o
|
|
3010
|
-
), this.terminationService = new
|
|
2934
|
+
), this.terminationService = new Hr(this.runtimeRef), this.channelRunner = new Dr(
|
|
3011
2935
|
this.runtimeRef,
|
|
3012
2936
|
this.checkpointManager,
|
|
3013
2937
|
{
|
|
@@ -3024,9 +2948,9 @@ class li {
|
|
|
3024
2948
|
const c = this.registry.lookupHandler(s.blueId());
|
|
3025
2949
|
if (!c) {
|
|
3026
2950
|
const d = `No processor registered for handler contract ${s.blueId()}`;
|
|
3027
|
-
throw new
|
|
2951
|
+
throw new g(
|
|
3028
2952
|
d,
|
|
3029
|
-
|
|
2953
|
+
E.illegalState(d)
|
|
3030
2954
|
);
|
|
3031
2955
|
}
|
|
3032
2956
|
const u = c.matches;
|
|
@@ -3037,7 +2961,7 @@ class li {
|
|
|
3037
2961
|
canonicalSignature: o,
|
|
3038
2962
|
channelProcessorFor: (s) => this.registry.lookupChannel(s) ?? null
|
|
3039
2963
|
}
|
|
3040
|
-
), this.scopeExecutor = new
|
|
2964
|
+
), this.scopeExecutor = new zr({
|
|
3041
2965
|
runtime: this.runtimeRef,
|
|
3042
2966
|
contractLoader: this.contractLoader,
|
|
3043
2967
|
channelRunner: this.channelRunner,
|
|
@@ -3088,7 +3012,7 @@ class li {
|
|
|
3088
3012
|
);
|
|
3089
3013
|
}
|
|
3090
3014
|
createContext(e, t, n, r = !1, o = !1) {
|
|
3091
|
-
return new
|
|
3015
|
+
return new ki(
|
|
3092
3016
|
this,
|
|
3093
3017
|
t,
|
|
3094
3018
|
e,
|
|
@@ -3099,7 +3023,7 @@ class li {
|
|
|
3099
3023
|
}
|
|
3100
3024
|
result() {
|
|
3101
3025
|
const e = this.runtimeRef.document().clone(), t = this.runtimeRef.rootEmissions().map((n) => n.clone());
|
|
3102
|
-
return
|
|
3026
|
+
return ze.of(
|
|
3103
3027
|
e,
|
|
3104
3028
|
t,
|
|
3105
3029
|
this.runtimeRef.totalGas()
|
|
@@ -3109,10 +3033,10 @@ class li {
|
|
|
3109
3033
|
return this.runtimeRef;
|
|
3110
3034
|
}
|
|
3111
3035
|
bundleForScope(e) {
|
|
3112
|
-
return this.bundles.get(
|
|
3036
|
+
return this.bundles.get(S(e));
|
|
3113
3037
|
}
|
|
3114
3038
|
isScopeInactive(e) {
|
|
3115
|
-
const t =
|
|
3039
|
+
const t = S(e);
|
|
3116
3040
|
return this.cutOffScopes.has(t) || this.pendingTerminations.has(t) || this.runtimeRef.isScopeTerminated(t);
|
|
3117
3041
|
}
|
|
3118
3042
|
async enterGracefulTermination(e, t, n) {
|
|
@@ -3122,13 +3046,13 @@ class li {
|
|
|
3122
3046
|
await this.terminate(e, t, "FATAL", n);
|
|
3123
3047
|
}
|
|
3124
3048
|
recordPendingTermination(e, t, n) {
|
|
3125
|
-
this.pendingTerminations.set(
|
|
3049
|
+
this.pendingTerminations.set(S(e), { kind: t, reason: n });
|
|
3126
3050
|
}
|
|
3127
3051
|
clearPendingTermination(e) {
|
|
3128
|
-
this.pendingTerminations.delete(
|
|
3052
|
+
this.pendingTerminations.delete(S(e));
|
|
3129
3053
|
}
|
|
3130
3054
|
async markCutOff(e) {
|
|
3131
|
-
const t =
|
|
3055
|
+
const t = S(e);
|
|
3132
3056
|
this.cutOffScopes.add(t) && this.runtimeRef.existingScope(t)?.markCutOff();
|
|
3133
3057
|
}
|
|
3134
3058
|
async deliverLifecycle(e, t, n, r) {
|
|
@@ -3143,13 +3067,13 @@ class li {
|
|
|
3143
3067
|
this.runtimeRef.scope(e).recordBridgeable(t.clone()), e === "/" && this.runtimeRef.recordRootEmission(t.clone());
|
|
3144
3068
|
}
|
|
3145
3069
|
normalizeScope(e) {
|
|
3146
|
-
return
|
|
3070
|
+
return S(e);
|
|
3147
3071
|
}
|
|
3148
3072
|
resolvePointer(e, t) {
|
|
3149
|
-
return
|
|
3073
|
+
return b(e, t);
|
|
3150
3074
|
}
|
|
3151
3075
|
async terminate(e, t, n, r) {
|
|
3152
|
-
const o =
|
|
3076
|
+
const o = S(e);
|
|
3153
3077
|
this.pendingTerminations.has(o) || this.runtimeRef.isScopeTerminated(o) || (this.pendingTerminations.set(o, { kind: n, reason: r }), await this.terminationService.terminateScope(
|
|
3154
3078
|
this,
|
|
3155
3079
|
e,
|
|
@@ -3159,8 +3083,8 @@ class li {
|
|
|
3159
3083
|
));
|
|
3160
3084
|
}
|
|
3161
3085
|
nodeAt(e) {
|
|
3162
|
-
const t =
|
|
3163
|
-
return
|
|
3086
|
+
const t = S(e);
|
|
3087
|
+
return Z.nodeAt(this.runtimeRef.document(), t, {
|
|
3164
3088
|
calculateBlueId: (n) => this.runtimeRef.blue().calculateBlueIdSync(n)
|
|
3165
3089
|
});
|
|
3166
3090
|
}
|
|
@@ -3180,20 +3104,20 @@ class li {
|
|
|
3180
3104
|
};
|
|
3181
3105
|
if (!await o.matches(c, d))
|
|
3182
3106
|
return { matches: !1 };
|
|
3183
|
-
const
|
|
3107
|
+
const y = o.channelize, w = y ? y.call(o, c, d) : void 0;
|
|
3184
3108
|
return {
|
|
3185
3109
|
matches: !0,
|
|
3186
3110
|
eventId: s,
|
|
3187
|
-
eventNode:
|
|
3111
|
+
eventNode: w ?? a.clone()
|
|
3188
3112
|
};
|
|
3189
3113
|
}
|
|
3190
3114
|
async executeHandler(e, t) {
|
|
3191
3115
|
const n = this.registry.lookupHandler(e.blueId());
|
|
3192
3116
|
if (!n) {
|
|
3193
3117
|
const r = `No processor registered for handler contract ${e.blueId()}`;
|
|
3194
|
-
throw new
|
|
3118
|
+
throw new g(
|
|
3195
3119
|
r,
|
|
3196
|
-
|
|
3120
|
+
E.illegalState(r)
|
|
3197
3121
|
);
|
|
3198
3122
|
}
|
|
3199
3123
|
await n.execute(e.contract(), t);
|
|
@@ -3213,8 +3137,8 @@ class li {
|
|
|
3213
3137
|
return e instanceof Error && typeof e.message == "string" ? e.message : t;
|
|
3214
3138
|
}
|
|
3215
3139
|
createDocumentUpdateEvent(e, t) {
|
|
3216
|
-
const n =
|
|
3217
|
-
new h().setBlueId(
|
|
3140
|
+
const n = Dt(t, e.path), r = e.before != null ? e.before.clone() : new h().setValue(null), o = e.after != null ? e.after.clone() : new h().setValue(null), s = new h().setType(
|
|
3141
|
+
new h().setBlueId(wi)
|
|
3218
3142
|
);
|
|
3219
3143
|
return s.setProperties({
|
|
3220
3144
|
op: new h().setValue(e.op),
|
|
@@ -3226,17 +3150,17 @@ class li {
|
|
|
3226
3150
|
matchesDocumentUpdate(e, t, n) {
|
|
3227
3151
|
if (!t || t.length === 0)
|
|
3228
3152
|
return !1;
|
|
3229
|
-
const r = T(
|
|
3153
|
+
const r = T(b(e, t)), o = T(n);
|
|
3230
3154
|
return r === "/" || o === r ? !0 : o.startsWith(`${r}/`);
|
|
3231
3155
|
}
|
|
3232
3156
|
}
|
|
3233
|
-
class
|
|
3157
|
+
class Z {
|
|
3234
3158
|
constructor(e, t, n) {
|
|
3235
3159
|
this.contractLoader = e, this.registry = t, this.blue = n;
|
|
3236
3160
|
}
|
|
3237
3161
|
async initializeDocument(e) {
|
|
3238
3162
|
if (this.isInitialized(e))
|
|
3239
|
-
throw new
|
|
3163
|
+
throw new L("Document already initialized");
|
|
3240
3164
|
const t = this.createExecution(e.clone());
|
|
3241
3165
|
return this.run(e, t, async () => {
|
|
3242
3166
|
await t.initializeScope("/", !0);
|
|
@@ -3244,7 +3168,7 @@ class X {
|
|
|
3244
3168
|
}
|
|
3245
3169
|
async processDocument(e, t) {
|
|
3246
3170
|
if (!this.isInitialized(e))
|
|
3247
|
-
throw new
|
|
3171
|
+
throw new L("Document not initialized");
|
|
3248
3172
|
const n = this.createExecution(e.clone()), r = t.clone();
|
|
3249
3173
|
return this.run(e, n, async () => {
|
|
3250
3174
|
n.loadBundles("/"), await n.processExternalEvent("/", r);
|
|
@@ -3254,7 +3178,7 @@ class X {
|
|
|
3254
3178
|
return this.initializationMarker(e) != null;
|
|
3255
3179
|
}
|
|
3256
3180
|
createExecution(e) {
|
|
3257
|
-
return new
|
|
3181
|
+
return new vi(
|
|
3258
3182
|
this.contractLoader,
|
|
3259
3183
|
this.registry,
|
|
3260
3184
|
this.blue,
|
|
@@ -3269,7 +3193,7 @@ class X {
|
|
|
3269
3193
|
return t.result();
|
|
3270
3194
|
if (r instanceof K) {
|
|
3271
3195
|
const o = e.clone();
|
|
3272
|
-
return
|
|
3196
|
+
return ze.capabilityFailure(
|
|
3273
3197
|
o,
|
|
3274
3198
|
r.message ?? null
|
|
3275
3199
|
);
|
|
@@ -3279,20 +3203,20 @@ class X {
|
|
|
3279
3203
|
return t.result();
|
|
3280
3204
|
}
|
|
3281
3205
|
initializationMarker(e) {
|
|
3282
|
-
const n = e.getProperties()?.[
|
|
3206
|
+
const n = e.getProperties()?.[Ce.OBJECT_CONTRACTS]?.getProperties()?.initialized ?? null;
|
|
3283
3207
|
if (!n)
|
|
3284
3208
|
return null;
|
|
3285
3209
|
if (!(n instanceof h))
|
|
3286
|
-
throw new
|
|
3210
|
+
throw new g(
|
|
3287
3211
|
"Initialization Marker must be a BlueNode",
|
|
3288
|
-
|
|
3212
|
+
E.illegalState(
|
|
3289
3213
|
"Initialization Marker must be a BlueNode"
|
|
3290
3214
|
)
|
|
3291
3215
|
);
|
|
3292
|
-
if (n.getType()?.getBlueId() !==
|
|
3293
|
-
throw new
|
|
3216
|
+
if (n.getType()?.getBlueId() !== Ci)
|
|
3217
|
+
throw new g(
|
|
3294
3218
|
"Initialization Marker must declare type 'Processing Initialized Marker'",
|
|
3295
|
-
|
|
3219
|
+
E.illegalState(
|
|
3296
3220
|
"Initialization Marker must declare type 'Processing Initialized Marker'"
|
|
3297
3221
|
)
|
|
3298
3222
|
);
|
|
@@ -3313,16 +3237,16 @@ class X {
|
|
|
3313
3237
|
continue;
|
|
3314
3238
|
const c = s.getItems();
|
|
3315
3239
|
if (c && /^\d+$/.test(a)) {
|
|
3316
|
-
const
|
|
3317
|
-
s = c[
|
|
3240
|
+
const f = Number.parseInt(a, 10);
|
|
3241
|
+
s = c[f] ?? null;
|
|
3318
3242
|
continue;
|
|
3319
3243
|
}
|
|
3320
3244
|
const u = s.getProperties();
|
|
3321
3245
|
if (u && a in u) {
|
|
3322
|
-
const
|
|
3323
|
-
if (!(
|
|
3246
|
+
const f = u[a];
|
|
3247
|
+
if (!(f instanceof h))
|
|
3324
3248
|
return null;
|
|
3325
|
-
s =
|
|
3249
|
+
s = f;
|
|
3326
3250
|
continue;
|
|
3327
3251
|
}
|
|
3328
3252
|
const d = this.specialSegmentNode(s, a, n);
|
|
@@ -3352,10 +3276,10 @@ class X {
|
|
|
3352
3276
|
return new h().setValue(e.getValue() ?? null);
|
|
3353
3277
|
case "blue":
|
|
3354
3278
|
return e.getBlue() ?? null;
|
|
3355
|
-
case
|
|
3279
|
+
case Ce.OBJECT_CONTRACTS:
|
|
3356
3280
|
return new h().setContracts(e.getContracts());
|
|
3357
3281
|
case "blueId": {
|
|
3358
|
-
const r = e.getBlueId() ?? n?.calculateBlueId?.(e) ??
|
|
3282
|
+
const r = e.getBlueId() ?? n?.calculateBlueId?.(e) ?? vt.calculateBlueIdSync(e);
|
|
3359
3283
|
return new h().setValue(r ?? null);
|
|
3360
3284
|
}
|
|
3361
3285
|
default:
|
|
@@ -3363,7 +3287,7 @@ class X {
|
|
|
3363
3287
|
}
|
|
3364
3288
|
}
|
|
3365
3289
|
}
|
|
3366
|
-
class
|
|
3290
|
+
class ki {
|
|
3367
3291
|
constructor(e, t, n, r, o, s) {
|
|
3368
3292
|
this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = o, this.allowReservedMutation = s;
|
|
3369
3293
|
}
|
|
@@ -3399,7 +3323,7 @@ class ui {
|
|
|
3399
3323
|
this.shouldSkipTerminatedWork() || this.execution.runtime().addGas(e);
|
|
3400
3324
|
}
|
|
3401
3325
|
throwFatal(e) {
|
|
3402
|
-
throw new
|
|
3326
|
+
throw new g(e, E.runtimeFatal(e));
|
|
3403
3327
|
}
|
|
3404
3328
|
resolvePointer(e) {
|
|
3405
3329
|
return this.execution.resolvePointer(this.scopePathValue, e);
|
|
@@ -3418,7 +3342,7 @@ class ui {
|
|
|
3418
3342
|
if (!e)
|
|
3419
3343
|
return !1;
|
|
3420
3344
|
try {
|
|
3421
|
-
return
|
|
3345
|
+
return Z.nodeAt(
|
|
3422
3346
|
this.execution.runtime().document(),
|
|
3423
3347
|
e,
|
|
3424
3348
|
{
|
|
@@ -3430,7 +3354,7 @@ class ui {
|
|
|
3430
3354
|
}
|
|
3431
3355
|
}
|
|
3432
3356
|
documentNodeAt(e) {
|
|
3433
|
-
const t =
|
|
3357
|
+
const t = Z.nodeAt(
|
|
3434
3358
|
this.execution.runtime().document(),
|
|
3435
3359
|
e,
|
|
3436
3360
|
{
|
|
@@ -3457,16 +3381,16 @@ class ui {
|
|
|
3457
3381
|
return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
|
|
3458
3382
|
}
|
|
3459
3383
|
}
|
|
3460
|
-
const
|
|
3461
|
-
repositories: [
|
|
3384
|
+
const bi = new kt({
|
|
3385
|
+
repositories: [bt]
|
|
3462
3386
|
});
|
|
3463
|
-
class
|
|
3387
|
+
class Ii {
|
|
3464
3388
|
blue;
|
|
3465
3389
|
registryRef;
|
|
3466
3390
|
contractLoaderRef;
|
|
3467
3391
|
engine;
|
|
3468
3392
|
constructor(e) {
|
|
3469
|
-
this.registryRef = e?.registry ??
|
|
3393
|
+
this.registryRef = e?.registry ?? re.create().registerDefaults().build(), this.blue = e?.blue ?? bi, this.contractLoaderRef = new Rr(this.registryRef, this.blue), this.engine = new Z(
|
|
3470
3394
|
this.contractLoaderRef,
|
|
3471
3395
|
this.registryRef,
|
|
3472
3396
|
this.blue
|
|
@@ -3499,14 +3423,14 @@ class hi {
|
|
|
3499
3423
|
return this.contractLoaderRef;
|
|
3500
3424
|
}
|
|
3501
3425
|
static builder() {
|
|
3502
|
-
return new
|
|
3426
|
+
return new Ti();
|
|
3503
3427
|
}
|
|
3504
3428
|
}
|
|
3505
|
-
class
|
|
3429
|
+
class Ti {
|
|
3506
3430
|
contractRegistry;
|
|
3507
3431
|
blueInstance;
|
|
3508
3432
|
constructor() {
|
|
3509
|
-
this.contractRegistry =
|
|
3433
|
+
this.contractRegistry = re.create().registerDefaults().build();
|
|
3510
3434
|
}
|
|
3511
3435
|
withRegistry(e) {
|
|
3512
3436
|
return this.contractRegistry = e, this;
|
|
@@ -3518,16 +3442,16 @@ class pi {
|
|
|
3518
3442
|
return this.blueInstance = e, this;
|
|
3519
3443
|
}
|
|
3520
3444
|
build() {
|
|
3521
|
-
return new
|
|
3445
|
+
return new Ii({
|
|
3522
3446
|
registry: this.contractRegistry,
|
|
3523
3447
|
blue: this.blueInstance
|
|
3524
3448
|
});
|
|
3525
3449
|
}
|
|
3526
3450
|
}
|
|
3527
|
-
class
|
|
3451
|
+
class ft {
|
|
3528
3452
|
process(e, t) {
|
|
3529
3453
|
const n = t.getValue();
|
|
3530
|
-
if (
|
|
3454
|
+
if (Q(n)) {
|
|
3531
3455
|
const r = t.clone();
|
|
3532
3456
|
return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
|
|
3533
3457
|
}
|
|
@@ -3538,123 +3462,123 @@ class dt {
|
|
|
3538
3462
|
*/
|
|
3539
3463
|
postProcess(e, t) {
|
|
3540
3464
|
const n = t.getValue();
|
|
3541
|
-
if (
|
|
3465
|
+
if (Q(n) && e.getValue() !== n && n !== void 0) {
|
|
3542
3466
|
const r = e.clone();
|
|
3543
3467
|
return r.setValue(n), r;
|
|
3544
3468
|
}
|
|
3545
3469
|
return e;
|
|
3546
3470
|
}
|
|
3547
3471
|
}
|
|
3548
|
-
const
|
|
3472
|
+
const Ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3549
3473
|
__proto__: null,
|
|
3550
|
-
ExpressionPreserver:
|
|
3474
|
+
ExpressionPreserver: ft
|
|
3551
3475
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3552
|
-
function
|
|
3553
|
-
return new
|
|
3554
|
-
new
|
|
3555
|
-
new
|
|
3556
|
-
new
|
|
3557
|
-
new
|
|
3558
|
-
new
|
|
3559
|
-
new
|
|
3476
|
+
function ji() {
|
|
3477
|
+
return new D.SequentialMergingProcessor([
|
|
3478
|
+
new D.ValuePropagator(),
|
|
3479
|
+
new ft(),
|
|
3480
|
+
new D.TypeAssigner(),
|
|
3481
|
+
new D.ListProcessor(),
|
|
3482
|
+
new D.DictionaryProcessor(),
|
|
3483
|
+
new D.BasicTypesVerifier()
|
|
3560
3484
|
]);
|
|
3561
3485
|
}
|
|
3562
3486
|
export {
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3487
|
+
ur as ChannelBinding,
|
|
3488
|
+
Dr as ChannelRunner,
|
|
3489
|
+
Ar as CheckpointManager,
|
|
3490
|
+
Nr as CheckpointRecord,
|
|
3491
|
+
tt as CodeBlockEvaluationError,
|
|
3492
|
+
_ as ContractBundle,
|
|
3493
|
+
hr as ContractBundleBuilder,
|
|
3494
|
+
Rr as ContractLoader,
|
|
3495
|
+
$n as ContractProcessorRegistry,
|
|
3496
|
+
re as ContractProcessorRegistryBuilder,
|
|
3497
|
+
ze as DocumentProcessingResult,
|
|
3498
|
+
Si as DocumentProcessingRuntime,
|
|
3499
|
+
Ii as DocumentProcessor,
|
|
3500
|
+
Ti as DocumentProcessorBuilder,
|
|
3501
|
+
Yr as EmissionRegistry,
|
|
3502
|
+
yi as GasMeter,
|
|
3503
|
+
dr as HandlerBinding,
|
|
3504
|
+
A as KEY_CHECKPOINT,
|
|
3505
|
+
$e as KEY_EMBEDDED,
|
|
3506
|
+
Ve as KEY_INITIALIZED,
|
|
3507
|
+
He as KEY_TERMINATED,
|
|
3508
|
+
Ji as MergingProcessors,
|
|
3509
|
+
We as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
|
|
3510
|
+
qr as PatchEngine,
|
|
3511
|
+
Hi as ProcessorContractConstants,
|
|
3512
|
+
Z as ProcessorEngine,
|
|
3513
|
+
E as ProcessorErrors,
|
|
3514
|
+
vi as ProcessorExecution,
|
|
3515
|
+
ki as ProcessorExecutionContext,
|
|
3516
|
+
g as ProcessorFatalError,
|
|
3517
|
+
Wi as ProcessorPointerConstants,
|
|
3518
|
+
ge as QuickJSEvaluator,
|
|
3519
|
+
Ke as RELATIVE_CHECKPOINT,
|
|
3520
|
+
F as RELATIVE_CONTRACTS,
|
|
3521
|
+
At as RELATIVE_EMBEDDED,
|
|
3522
|
+
ue as RELATIVE_INITIALIZED,
|
|
3523
|
+
Ge as RELATIVE_TERMINATED,
|
|
3524
|
+
me as RESERVED_CONTRACT_KEYS,
|
|
3601
3525
|
Y as RunTerminationError,
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3526
|
+
zr as ScopeExecutor,
|
|
3527
|
+
Xr as ScopeRuntimeContext,
|
|
3528
|
+
Hr as TerminationService,
|
|
3529
|
+
Ui as andThen,
|
|
3530
|
+
Ye as canonicalSignature,
|
|
3531
|
+
be as canonicalSize,
|
|
3532
|
+
z as channelContractBaseSchema,
|
|
3533
|
+
En as channelEventCheckpointSchema,
|
|
3534
|
+
en as containsExpression,
|
|
3535
|
+
Ee as contractBaseSchema,
|
|
3536
|
+
ji as createDefaultMergingProcessor,
|
|
3537
|
+
it as createPicomatchShouldResolve,
|
|
3538
|
+
Rn as documentAnchorsMarkerSchema,
|
|
3539
|
+
On as documentLinksMarkerSchema,
|
|
3540
|
+
sn as documentUpdateChannelSchema,
|
|
3541
|
+
cn as embeddedNodeChannelSchema,
|
|
3542
|
+
Tt as err,
|
|
3543
|
+
rt as evaluateQuickJSExpression,
|
|
3544
|
+
tn as extractExpressionContent,
|
|
3545
|
+
st as handlerContractBaseSchema,
|
|
3546
|
+
Sn as initializationMarkerSchema,
|
|
3547
|
+
Li as isErr,
|
|
3548
|
+
Q as isExpression,
|
|
3549
|
+
Bi as isOk,
|
|
3550
|
+
fe as isProcessorManagedChannelBlueId,
|
|
3551
|
+
Nt as isReservedContractKey,
|
|
3552
|
+
Gi as joinRelativePointers,
|
|
3553
|
+
Ki as jsonPatchSchema,
|
|
3554
|
+
un as lifecycleChannelSchema,
|
|
3555
|
+
_i as map,
|
|
3556
|
+
Fi as mapErr,
|
|
3557
|
+
M as markerContractBaseSchema,
|
|
3558
|
+
Vi as match,
|
|
3559
|
+
An as myosParticipantsOrchestrationMarkerSchema,
|
|
3560
|
+
xn as myosSessionInteractionMarkerSchema,
|
|
3561
|
+
fn as myosTimelineChannelSchema,
|
|
3562
|
+
Ln as myosWorkerAgencyMarkerSchema,
|
|
3639
3563
|
T as normalizePointer,
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3564
|
+
S as normalizeScope,
|
|
3565
|
+
It as ok,
|
|
3566
|
+
bn as operationMarkerSchema,
|
|
3567
|
+
wn as processEmbeddedMarkerSchema,
|
|
3568
|
+
kn as processingTerminatedMarkerSchema,
|
|
3569
|
+
je as relativeCheckpointLastEvent,
|
|
3570
|
+
Qe as relativeCheckpointLastSignature,
|
|
3571
|
+
ee as relativeContractsEntry,
|
|
3572
|
+
Dt as relativizePointer,
|
|
3573
|
+
X as resolveNodeExpressions,
|
|
3574
|
+
b as resolvePointer,
|
|
3575
|
+
nn as resolveTemplateString,
|
|
3576
|
+
Un as sequentialWorkflowOperationSchema,
|
|
3577
|
+
_n as sequentialWorkflowSchema,
|
|
3578
|
+
qi as sequentialWorkflowStepSchema,
|
|
3579
|
+
ve as stripSlashes,
|
|
3580
|
+
pn as timelineChannelSchema,
|
|
3581
|
+
hn as triggeredEventChannelSchema,
|
|
3582
|
+
zi as unwrapOr,
|
|
3583
|
+
$i as unwrapOrElse
|
|
3660
3584
|
};
|