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