@blue-labs/document-processor 1.32.1 → 1.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlueDocumentProcessor.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.mjs +643 -522
- package/dist/processors/BaseChannelProcessor.d.ts.map +1 -1
- package/dist/processors/CompositeTimelineChannelProcessor.d.ts +3 -3
- package/dist/processors/CompositeTimelineChannelProcessor.d.ts.map +1 -1
- package/dist/processors/DocumentUpdateChannelProcessor.d.ts +3 -3
- package/dist/processors/DocumentUpdateChannelProcessor.d.ts.map +1 -1
- package/dist/processors/LifecycleEventChannelProcessor.d.ts +2 -2
- package/dist/processors/LifecycleEventChannelProcessor.d.ts.map +1 -1
- package/dist/processors/OperationProcessor.d.ts +3 -0
- package/dist/processors/OperationProcessor.d.ts.map +1 -1
- package/dist/processors/SequentialWorkflowOperationProcessor.d.ts +1 -1
- package/dist/processors/SequentialWorkflowProcessor/SequentialWorkflowProcessor.d.ts +6 -1
- package/dist/processors/SequentialWorkflowProcessor/SequentialWorkflowProcessor.d.ts.map +1 -1
- package/dist/processors/SequentialWorkflowProcessor/steps/JavaScriptCodeExecutor.d.ts.map +1 -1
- package/dist/processors/SequentialWorkflowProcessor/steps/TriggerEventExecutor.d.ts.map +1 -1
- package/dist/processors/SequentialWorkflowProcessor/steps/UpdateDocumentExecutor.d.ts +1 -0
- package/dist/processors/SequentialWorkflowProcessor/steps/UpdateDocumentExecutor.d.ts.map +1 -1
- package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionEvaluator.d.ts +3 -6
- package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionEvaluator.d.ts.map +1 -1
- package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionResolver.d.ts +8 -0
- package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionResolver.d.ts.map +1 -0
- package/dist/processors/TriggeredEventChannelProcessor.d.ts +12 -0
- package/dist/processors/TriggeredEventChannelProcessor.d.ts.map +1 -0
- package/dist/processors/index.d.ts +1 -0
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/routing/EventRouter.d.ts.map +1 -1
- package/dist/routing/buildContractEntries.d.ts +3 -0
- package/dist/routing/buildContractEntries.d.ts.map +1 -0
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/EventTraceManager.d.ts +1 -0
- package/dist/utils/EventTraceManager.d.ts.map +1 -1
- package/dist/utils/expressionUtils.d.ts +4 -0
- package/dist/utils/expressionUtils.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/utils/fetchText.d.ts +0 -2
- package/dist/utils/fetchText.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (
|
|
4
|
-
import { ProcessEmbeddedSchema as
|
|
5
|
-
import { applyBlueNodePatch as
|
|
6
|
-
import { deepFreeze as Be, isNonNullable as M, deepContains as
|
|
7
|
-
import { blueIds as
|
|
8
|
-
const
|
|
9
|
-
on: (t, n) => ({ end: () => n(null) })
|
|
10
|
-
});
|
|
11
|
-
async function Ae(s) {
|
|
12
|
-
return new Promise((e, t) => {
|
|
13
|
-
qe().on("error", t).end();
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
const v = (...s) => s.map((e, t) => {
|
|
1
|
+
var fe = Object.defineProperty;
|
|
2
|
+
var ge = (a, e, t) => e in a ? fe(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var l = (a, e, t) => ge(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ProcessEmbeddedSchema as W, ChannelEventCheckpointSchema as ye, blueIds as g, InitializedMarkerSchema as Ee, CompositeTimelineChannelSchema as ve, DocumentUpdateChannelSchema as we, EmbeddedNodeChannelSchema as F, LifecycleEventSchema as Te, TimelineEntrySchema as O, OperationSchema as be, OperationRequestSchema as Pe, UpdateDocumentSchema as j, TriggerEventSchema as x, JavaScriptCodeSchema as V, SequentialWorkflowSchema as Se, SequentialWorkflowOperationSchema as Ce, TimelineChannelSchema as Ne } from "@blue-repository/core-dev";
|
|
5
|
+
import { applyBlueNodePatch as te, BlueNode as ke, isBigNumber as L, BlueNodeTypeSchema as P, ResolvedBlueNode as Ie, MergingProcessors as k } from "@blue-labs/language";
|
|
6
|
+
import { deepFreeze as Be, isNonNullable as M, deepContains as Oe, isNullable as _ } from "@blue-labs/shared-utils";
|
|
7
|
+
import { blueIds as ne, MyOSTimelineEntrySchema as oe, MyOSTimelineChannelSchema as Me, MyOSAgentEventSchema as $e, MyOSAgentChannelSchema as qe } from "@blue-repository/myos-dev";
|
|
8
|
+
const b = (...a) => a.map((e, t) => {
|
|
17
9
|
if (typeof e != "string") return "";
|
|
18
10
|
if (t === 0 && e === "/") return "/";
|
|
19
11
|
const n = t > 0 ? e.replace(/^\/+/, "") : e;
|
|
20
|
-
return t <
|
|
12
|
+
return t < a.length - 1 ? n.replace(/\/+$/, "") : n;
|
|
21
13
|
}).filter(Boolean).join("/").replace(/\/{2,}/g, "/");
|
|
22
|
-
class
|
|
14
|
+
class re {
|
|
23
15
|
constructor(e, t, n, o) {
|
|
24
16
|
l(this, "actions", []);
|
|
25
17
|
this.getDocument = e, this.taskInfo = t, this.blue = n, this.onFlush = o;
|
|
26
18
|
}
|
|
27
19
|
get(e) {
|
|
28
|
-
const t = this.getDocument(), n =
|
|
20
|
+
const t = this.getDocument(), n = b(this.taskInfo.nodePath, e);
|
|
29
21
|
return t.get(n);
|
|
30
22
|
}
|
|
31
23
|
addPatch(e) {
|
|
@@ -33,16 +25,18 @@ class oe {
|
|
|
33
25
|
kind: "patch",
|
|
34
26
|
patch: {
|
|
35
27
|
...e,
|
|
36
|
-
path:
|
|
28
|
+
path: b(this.taskInfo.nodePath, e.path)
|
|
37
29
|
}
|
|
38
30
|
});
|
|
39
31
|
}
|
|
40
32
|
emitEvent(e) {
|
|
41
33
|
const t = this.taskInfo.event, n = t.trace ?? [], o = {
|
|
42
34
|
...e,
|
|
35
|
+
source: e.source ?? "internal",
|
|
43
36
|
originNodePath: e.originNodePath ?? this.taskInfo.nodePath,
|
|
44
37
|
rootEvent: e.rootEvent ?? t.rootEvent ?? t,
|
|
45
|
-
trace: [...n]
|
|
38
|
+
trace: [...n],
|
|
39
|
+
emissionType: e.emissionType ?? t.emissionType
|
|
46
40
|
};
|
|
47
41
|
this.actions.push({ kind: "event", event: o });
|
|
48
42
|
}
|
|
@@ -56,7 +50,7 @@ class oe {
|
|
|
56
50
|
return this.taskInfo.nodePath;
|
|
57
51
|
}
|
|
58
52
|
resolvePath(e) {
|
|
59
|
-
return
|
|
53
|
+
return b(this.taskInfo.nodePath, e);
|
|
60
54
|
}
|
|
61
55
|
getTaskInfo() {
|
|
62
56
|
return this.taskInfo;
|
|
@@ -65,16 +59,17 @@ class oe {
|
|
|
65
59
|
return this.blue;
|
|
66
60
|
}
|
|
67
61
|
/* TODO: Move to a separate interface */
|
|
68
|
-
loadExternalModule(
|
|
69
|
-
|
|
70
|
-
throw new Error("Only http/https URLs are allowed");
|
|
71
|
-
return Ae();
|
|
62
|
+
loadExternalModule() {
|
|
63
|
+
throw new Error("Not implemented");
|
|
72
64
|
}
|
|
73
65
|
loadBlueContent(e) {
|
|
74
|
-
|
|
66
|
+
const t = this.blue.getNodeProvider().fetchFirstByBlueId(e);
|
|
67
|
+
if (!t)
|
|
68
|
+
throw new Error(`Blue node not found for blueId: ${e}`);
|
|
69
|
+
return Promise.resolve(JSON.stringify(this.blue.nodeToJson(t)));
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
|
-
class
|
|
72
|
+
class se extends Error {
|
|
78
73
|
constructor(e, t) {
|
|
79
74
|
super(`Cannot apply patch ${JSON.stringify(e)}`), this.patch = e, this.cause = t, this.name = "PatchApplicationError";
|
|
80
75
|
}
|
|
@@ -86,66 +81,66 @@ class ae extends Error {
|
|
|
86
81
|
), this.patch = e, this.offendingPath = t, this.contractNodePath = n, this.name = "EmbeddedDocumentModificationError";
|
|
87
82
|
}
|
|
88
83
|
}
|
|
89
|
-
class
|
|
84
|
+
class Ae extends Error {
|
|
90
85
|
constructor(e, t) {
|
|
91
86
|
super(`Failed to evaluate expression "${e}"`), this.code = e, this.cause = t, this.name = "ExpressionEvaluationError";
|
|
92
87
|
}
|
|
93
88
|
}
|
|
94
|
-
class
|
|
89
|
+
class De extends Error {
|
|
95
90
|
constructor(e, t) {
|
|
96
91
|
super(`Failed to evaluate code block "${e}"`), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
|
|
97
92
|
}
|
|
98
93
|
}
|
|
99
|
-
function I(
|
|
100
|
-
return Be(
|
|
94
|
+
function I(a) {
|
|
95
|
+
return Be(a);
|
|
101
96
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
97
|
+
function $(a) {
|
|
98
|
+
return a.clone();
|
|
104
99
|
}
|
|
105
|
-
function
|
|
106
|
-
const o =
|
|
107
|
-
for (const [r,
|
|
108
|
-
if (e.isTypeOf(
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
100
|
+
function z(a, e, t = "/", n = []) {
|
|
101
|
+
const o = a.getContracts() ?? {};
|
|
102
|
+
for (const [r, s] of Object.entries(o))
|
|
103
|
+
if (e.isTypeOf(s, W)) {
|
|
104
|
+
const d = e.nodeToSchemaOutput(
|
|
105
|
+
s,
|
|
106
|
+
W
|
|
112
107
|
).paths ?? [];
|
|
113
|
-
for (const u of
|
|
108
|
+
for (const u of d)
|
|
114
109
|
n.push({
|
|
115
|
-
absPath:
|
|
116
|
-
contractPath:
|
|
110
|
+
absPath: b(t, u),
|
|
111
|
+
contractPath: b(t, `contracts/${r}`)
|
|
117
112
|
});
|
|
118
113
|
}
|
|
119
|
-
for (const [r,
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
for (const [r, s] of Object.entries(a.getProperties() ?? {}))
|
|
115
|
+
z(
|
|
116
|
+
s,
|
|
122
117
|
e,
|
|
123
|
-
|
|
118
|
+
b(t, r),
|
|
124
119
|
n
|
|
125
120
|
);
|
|
126
121
|
return n;
|
|
127
122
|
}
|
|
128
|
-
function
|
|
129
|
-
return
|
|
123
|
+
function X(a, e) {
|
|
124
|
+
return a === e || a.startsWith(e.endsWith("/") ? e : e + "/");
|
|
130
125
|
}
|
|
131
|
-
function
|
|
132
|
-
if (!e.length) return
|
|
133
|
-
let t =
|
|
126
|
+
function Q(a, e) {
|
|
127
|
+
if (!e.length) return a;
|
|
128
|
+
let t = $(a);
|
|
134
129
|
for (const n of e)
|
|
135
130
|
try {
|
|
136
|
-
t =
|
|
131
|
+
t = te(t, n, !0);
|
|
137
132
|
} catch (o) {
|
|
138
|
-
throw new
|
|
133
|
+
throw new se(n, o);
|
|
139
134
|
}
|
|
140
135
|
return I(t);
|
|
141
136
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
137
|
+
function E(a) {
|
|
138
|
+
return a != null;
|
|
144
139
|
}
|
|
145
|
-
function
|
|
146
|
-
return
|
|
140
|
+
function S(a) {
|
|
141
|
+
return a instanceof ke;
|
|
147
142
|
}
|
|
148
|
-
class
|
|
143
|
+
class je {
|
|
149
144
|
constructor(e = [], t = (n, o) => n < o ? -1 : n > o ? 1 : 0) {
|
|
150
145
|
l(this, "data");
|
|
151
146
|
l(this, "length");
|
|
@@ -167,45 +162,45 @@ class De {
|
|
|
167
162
|
_up(e) {
|
|
168
163
|
const { data: t, compare: n } = this, o = t[e];
|
|
169
164
|
for (; e > 0; ) {
|
|
170
|
-
const r = e - 1 >> 1,
|
|
171
|
-
if (n(o,
|
|
172
|
-
t[e] =
|
|
165
|
+
const r = e - 1 >> 1, s = t[r];
|
|
166
|
+
if (n(o, s) >= 0) break;
|
|
167
|
+
t[e] = s, e = r;
|
|
173
168
|
}
|
|
174
169
|
t[e] = o;
|
|
175
170
|
}
|
|
176
171
|
_down(e) {
|
|
177
172
|
const { data: t, compare: n } = this, o = this.length >> 1, r = t[e];
|
|
178
173
|
for (; e < o; ) {
|
|
179
|
-
let
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
t[e] = t[
|
|
174
|
+
let s = (e << 1) + 1;
|
|
175
|
+
const i = s + 1;
|
|
176
|
+
if (i < this.length && n(t[i], t[s]) < 0 && (s = i), n(t[s], r) >= 0) break;
|
|
177
|
+
t[e] = t[s], e = s;
|
|
183
178
|
}
|
|
184
179
|
t[e] = r;
|
|
185
180
|
}
|
|
186
181
|
}
|
|
187
|
-
const xe = (
|
|
188
|
-
-
|
|
182
|
+
const xe = (a, e, t, n, o, r) => [
|
|
183
|
+
-a,
|
|
189
184
|
e,
|
|
190
185
|
t,
|
|
191
186
|
n,
|
|
192
187
|
o,
|
|
193
188
|
r
|
|
194
|
-
],
|
|
195
|
-
for (let t = 0; t <
|
|
196
|
-
const n =
|
|
189
|
+
], Ve = (a, e) => {
|
|
190
|
+
for (let t = 0; t < a.key.length; t++) {
|
|
191
|
+
const n = a.key[t], o = e.key[t];
|
|
197
192
|
if (n !== o)
|
|
198
193
|
return typeof n == "number" && typeof o == "number" ? n - o : typeof n == "string" && typeof o == "string" ? n.localeCompare(o) : 0;
|
|
199
194
|
}
|
|
200
195
|
return 0;
|
|
201
196
|
};
|
|
202
|
-
class
|
|
197
|
+
class _e {
|
|
203
198
|
/**
|
|
204
199
|
* Creates a new task queue with the task key comparator
|
|
205
200
|
*/
|
|
206
201
|
constructor() {
|
|
207
202
|
l(this, "queue");
|
|
208
|
-
this.queue = new
|
|
203
|
+
this.queue = new je([], Ve);
|
|
209
204
|
}
|
|
210
205
|
/**
|
|
211
206
|
* Adds a task to the queue
|
|
@@ -285,10 +280,10 @@ class We {
|
|
|
285
280
|
return this.processors.values();
|
|
286
281
|
}
|
|
287
282
|
}
|
|
288
|
-
class
|
|
283
|
+
const B = class B {
|
|
289
284
|
constructor() {
|
|
290
285
|
l(this, "isEnabled");
|
|
291
|
-
this.isEnabled = process.env.TRACE_BLUE_ENABLED
|
|
286
|
+
this.isEnabled = process.env.TRACE_BLUE_ENABLED !== "false";
|
|
292
287
|
}
|
|
293
288
|
/**
|
|
294
289
|
* Creates a hop entry for the trace
|
|
@@ -316,13 +311,10 @@ class Je {
|
|
|
316
311
|
addHop(e, t, n) {
|
|
317
312
|
if (!this.shouldTrace())
|
|
318
313
|
return { ...e };
|
|
319
|
-
const o = [
|
|
320
|
-
...e.trace ?? [],
|
|
321
|
-
this.makeHop(t, n)
|
|
322
|
-
];
|
|
314
|
+
const o = e.trace ?? [], s = [...o.length >= B.MAX_TRACE_LENGTH ? o.slice(o.length - (B.MAX_TRACE_LENGTH - 1)) : o, this.makeHop(t, n)];
|
|
323
315
|
return {
|
|
324
316
|
...e,
|
|
325
|
-
trace:
|
|
317
|
+
trace: s
|
|
326
318
|
};
|
|
327
319
|
}
|
|
328
320
|
/**
|
|
@@ -351,9 +343,14 @@ class Je {
|
|
|
351
343
|
isTracingEnabled() {
|
|
352
344
|
return this.isEnabled;
|
|
353
345
|
}
|
|
346
|
+
};
|
|
347
|
+
l(B, "MAX_TRACE_LENGTH", 128);
|
|
348
|
+
let J = B;
|
|
349
|
+
function Le(a) {
|
|
350
|
+
return Object.entries(a.getContracts() ?? {});
|
|
354
351
|
}
|
|
355
|
-
const
|
|
356
|
-
class
|
|
352
|
+
const Je = 64;
|
|
353
|
+
class Ue {
|
|
357
354
|
/**
|
|
358
355
|
* Creates a new event router
|
|
359
356
|
*
|
|
@@ -364,7 +361,7 @@ class Fe {
|
|
|
364
361
|
*/
|
|
365
362
|
constructor(e, t, n, o, r) {
|
|
366
363
|
l(this, "traceManager");
|
|
367
|
-
this.blue = e, this.registry = t, this.queue = n, this.getNextTaskId = o, this.getNextEventSeq = r, this.traceManager = new
|
|
364
|
+
this.blue = e, this.registry = t, this.queue = n, this.getNextTaskId = o, this.getNextEventSeq = r, this.traceManager = new J();
|
|
368
365
|
}
|
|
369
366
|
/**
|
|
370
367
|
* Routes an event to matching contracts in the document
|
|
@@ -376,22 +373,22 @@ class Fe {
|
|
|
376
373
|
* @param inlineDepth - Current adapter recursion depth
|
|
377
374
|
*/
|
|
378
375
|
async route(e, t, n, o, r = 0) {
|
|
379
|
-
var
|
|
376
|
+
var c;
|
|
380
377
|
if (n.seq === void 0 && (n.seq = this.getNextEventSeq()), t.length === 0) {
|
|
381
378
|
if (n.dispatchPath) {
|
|
382
|
-
const
|
|
383
|
-
return delete u.dispatchPath, this.route(e,
|
|
379
|
+
const d = n.dispatchPath.split("/").filter(Boolean), u = { ...n };
|
|
380
|
+
return delete u.dispatchPath, this.route(e, d, u, o, r);
|
|
384
381
|
}
|
|
385
382
|
if (n.source === "channel" && n.originNodePath && n.originNodePath !== "/") {
|
|
386
|
-
const
|
|
387
|
-
return this.route(e,
|
|
383
|
+
const d = ((c = n.originNodePath) == null ? void 0 : c.split("/").filter(Boolean)) ?? [];
|
|
384
|
+
return this.route(e, d, n, o, r);
|
|
388
385
|
}
|
|
389
386
|
}
|
|
390
|
-
const
|
|
391
|
-
|
|
387
|
+
const s = b("/", t.join("/")), i = e.get(s);
|
|
388
|
+
S(i) && await this.traverseContracts({
|
|
392
389
|
doc: e,
|
|
393
|
-
node:
|
|
394
|
-
nodePath:
|
|
390
|
+
node: i,
|
|
391
|
+
nodePath: s,
|
|
395
392
|
event: n,
|
|
396
393
|
afterTaskId: o,
|
|
397
394
|
pathSegments: t,
|
|
@@ -407,48 +404,46 @@ class Fe {
|
|
|
407
404
|
node: n,
|
|
408
405
|
nodePath: o,
|
|
409
406
|
event: r,
|
|
410
|
-
afterTaskId:
|
|
411
|
-
pathSegments:
|
|
412
|
-
inlineDepth:
|
|
407
|
+
afterTaskId: s,
|
|
408
|
+
pathSegments: i,
|
|
409
|
+
inlineDepth: c
|
|
413
410
|
} = e;
|
|
414
411
|
if (!this.shouldSkipForChannel(r, o))
|
|
415
|
-
for (const [
|
|
416
|
-
n.getContracts() ?? {}
|
|
417
|
-
)) {
|
|
412
|
+
for (const [d, u] of Le(n)) {
|
|
418
413
|
if (!u.getType()) continue;
|
|
419
|
-
const
|
|
420
|
-
if (!
|
|
421
|
-
console.warn(`No processor registered for contract: ${
|
|
414
|
+
const h = this.registry.get(u.getType());
|
|
415
|
+
if (!h) {
|
|
416
|
+
console.warn(`No processor registered for contract: ${d}`);
|
|
422
417
|
continue;
|
|
423
418
|
}
|
|
424
419
|
const p = {
|
|
425
420
|
nodePath: o,
|
|
426
|
-
contractName:
|
|
421
|
+
contractName: d,
|
|
427
422
|
contractNode: u,
|
|
428
423
|
event: r
|
|
429
|
-
}, m = new
|
|
430
|
-
if (
|
|
431
|
-
switch (
|
|
424
|
+
}, m = new re(() => t, p, this.blue);
|
|
425
|
+
if (h.supports(r, u, m, d))
|
|
426
|
+
switch (h.role) {
|
|
432
427
|
case "adapter":
|
|
433
428
|
await this.processAdapter({
|
|
434
|
-
cp:
|
|
429
|
+
cp: h,
|
|
435
430
|
event: r,
|
|
436
431
|
contractNode: u,
|
|
437
432
|
ctx: m,
|
|
438
|
-
contractName:
|
|
433
|
+
contractName: d,
|
|
439
434
|
doc: t,
|
|
440
|
-
afterTaskId:
|
|
441
|
-
inlineDepth:
|
|
435
|
+
afterTaskId: s,
|
|
436
|
+
inlineDepth: c
|
|
442
437
|
});
|
|
443
438
|
break;
|
|
444
439
|
case "handler":
|
|
445
440
|
this.scheduleHandler({
|
|
446
441
|
contractNode: u,
|
|
447
|
-
contractName:
|
|
442
|
+
contractName: d,
|
|
448
443
|
nodePath: o,
|
|
449
444
|
event: r,
|
|
450
|
-
depth:
|
|
451
|
-
afterTaskId:
|
|
445
|
+
depth: i.length,
|
|
446
|
+
afterTaskId: s
|
|
452
447
|
});
|
|
453
448
|
break;
|
|
454
449
|
}
|
|
@@ -464,51 +459,62 @@ class Fe {
|
|
|
464
459
|
event: n,
|
|
465
460
|
contractNode: o,
|
|
466
461
|
ctx: r,
|
|
467
|
-
contractName:
|
|
468
|
-
doc:
|
|
469
|
-
afterTaskId:
|
|
470
|
-
inlineDepth:
|
|
462
|
+
contractName: s,
|
|
463
|
+
doc: i,
|
|
464
|
+
afterTaskId: c,
|
|
465
|
+
inlineDepth: d
|
|
471
466
|
} = e;
|
|
472
|
-
if (
|
|
467
|
+
if (d >= Je)
|
|
473
468
|
throw new Error("Adapter recursion limit reached");
|
|
474
469
|
const u = this.traceManager.addHop(
|
|
475
470
|
n,
|
|
476
471
|
((w = r.getTaskInfo()) == null ? void 0 : w.nodePath) ?? "",
|
|
477
|
-
|
|
472
|
+
s
|
|
478
473
|
);
|
|
479
|
-
await t.handle(u, o, r,
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
474
|
+
await t.handle(u, o, r, s);
|
|
475
|
+
const h = await r.flush();
|
|
476
|
+
if (h.find((v) => v.kind === "patch"))
|
|
482
477
|
throw new Error(
|
|
483
|
-
`Contract "${
|
|
478
|
+
`Contract "${s}" (adapter) attempted to patch the document`
|
|
484
479
|
);
|
|
485
|
-
const m =
|
|
486
|
-
for (const
|
|
487
|
-
await this.route(
|
|
480
|
+
const m = h.filter((v) => v.kind === "event");
|
|
481
|
+
for (const v of m)
|
|
482
|
+
await this.route(i, [], v.event, c, d + 1);
|
|
488
483
|
}
|
|
489
484
|
/**
|
|
490
485
|
* Schedules a handler contract for future execution
|
|
491
486
|
*/
|
|
492
487
|
scheduleHandler(e) {
|
|
493
|
-
const { contractNode: t, contractName: n, nodePath: o, event: r, depth:
|
|
494
|
-
if (!
|
|
488
|
+
const { contractNode: t, contractName: n, nodePath: o, event: r, depth: s, afterTaskId: i } = e, c = t.getType();
|
|
489
|
+
if (!c) {
|
|
495
490
|
console.warn(`Contract node type is not defined for: ${n}`);
|
|
496
491
|
return;
|
|
497
492
|
}
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
493
|
+
const d = this.registry.orderOf(c), u = t.get("/order"), h = L(u) ? u.toNumber() : 0, p = this.getNextTaskId() + i, m = r.seq;
|
|
494
|
+
if (m === void 0)
|
|
495
|
+
throw new Error("Event sequence missing");
|
|
496
|
+
const w = xe(
|
|
497
|
+
s,
|
|
498
|
+
m,
|
|
502
499
|
d,
|
|
500
|
+
h,
|
|
503
501
|
n,
|
|
504
502
|
p
|
|
505
|
-
)
|
|
503
|
+
);
|
|
504
|
+
{
|
|
505
|
+
const f = `${o}#${n}`, D = r.trace ?? [];
|
|
506
|
+
if (r.source !== "external" && D.includes(f))
|
|
507
|
+
throw new Error(
|
|
508
|
+
`Loop detected: repeated hop ${f} within the same event chain`
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
const v = this.traceManager.addHop(r, o, n);
|
|
506
512
|
this.queue.push({
|
|
507
|
-
key:
|
|
513
|
+
key: w,
|
|
508
514
|
nodePath: o,
|
|
509
515
|
contractName: n,
|
|
510
516
|
contractNode: t,
|
|
511
|
-
event:
|
|
517
|
+
event: v
|
|
512
518
|
});
|
|
513
519
|
}
|
|
514
520
|
/**
|
|
@@ -518,61 +524,61 @@ class Fe {
|
|
|
518
524
|
return e.source === "channel" && !!e.originNodePath && e.originNodePath !== t;
|
|
519
525
|
}
|
|
520
526
|
}
|
|
521
|
-
const
|
|
522
|
-
(t instanceof
|
|
523
|
-
`[Blue] Failed to apply patches for contract "${
|
|
527
|
+
const ze = (a, e, t) => {
|
|
528
|
+
(t instanceof se || t instanceof ae) && console.error(
|
|
529
|
+
`[Blue] Failed to apply patches for contract "${a}" on event ${JSON.stringify(e)}`,
|
|
524
530
|
t
|
|
525
531
|
);
|
|
526
532
|
};
|
|
527
|
-
function
|
|
528
|
-
const t =
|
|
529
|
-
if (!
|
|
533
|
+
function G(a, e) {
|
|
534
|
+
const t = $(a), n = (o) => {
|
|
535
|
+
if (!S(o)) return;
|
|
530
536
|
const r = o.getContracts();
|
|
531
|
-
(!(r != null && r.checkpoint) || !
|
|
537
|
+
(!(r != null && r.checkpoint) || !P.isTypeOf(
|
|
532
538
|
r.checkpoint,
|
|
533
|
-
|
|
539
|
+
ye
|
|
534
540
|
)) && o.addContract(
|
|
535
541
|
"checkpoint",
|
|
536
542
|
e.jsonValueToNode({
|
|
537
543
|
type: {
|
|
538
544
|
name: "Channel Event Checkpoint",
|
|
539
|
-
blueId:
|
|
545
|
+
blueId: g["Channel Event Checkpoint"]
|
|
540
546
|
},
|
|
541
547
|
lastEvents: {}
|
|
542
548
|
})
|
|
543
549
|
);
|
|
544
550
|
};
|
|
545
551
|
n(t);
|
|
546
|
-
for (const { absPath: o } of
|
|
552
|
+
for (const { absPath: o } of z(t, e)) {
|
|
547
553
|
const r = t.get(o);
|
|
548
|
-
|
|
554
|
+
S(r) && n(r);
|
|
549
555
|
}
|
|
550
556
|
return I(t);
|
|
551
557
|
}
|
|
552
|
-
function
|
|
553
|
-
const t =
|
|
554
|
-
return
|
|
558
|
+
function Re(a, e) {
|
|
559
|
+
const t = $(a);
|
|
560
|
+
return S(t) && (ie(t, e) || t.addContract(
|
|
555
561
|
"initialized",
|
|
556
562
|
e.jsonValueToNode({
|
|
557
563
|
type: {
|
|
558
564
|
name: "Initialized Marker",
|
|
559
|
-
blueId:
|
|
565
|
+
blueId: g["Initialized Marker"]
|
|
560
566
|
}
|
|
561
567
|
})
|
|
562
568
|
)), I(t);
|
|
563
569
|
}
|
|
564
|
-
function
|
|
565
|
-
const t =
|
|
570
|
+
function ie(a, e) {
|
|
571
|
+
const t = a.getContracts();
|
|
566
572
|
return Object.values(t ?? {}).some(
|
|
567
573
|
(n) => e.isTypeOf(n, Ee, {
|
|
568
574
|
checkSchemaExtensions: !0
|
|
569
575
|
})
|
|
570
576
|
);
|
|
571
577
|
}
|
|
572
|
-
class
|
|
578
|
+
class He {
|
|
573
579
|
constructor(e) {
|
|
574
580
|
l(this, "contractType", "Channel Event Checkpoint");
|
|
575
|
-
l(this, "contractBlueId",
|
|
581
|
+
l(this, "contractBlueId", g["Channel Event Checkpoint"]);
|
|
576
582
|
l(this, "role", "handler");
|
|
577
583
|
this.cache = e;
|
|
578
584
|
}
|
|
@@ -587,21 +593,21 @@ class Ue {
|
|
|
587
593
|
throw new Error(
|
|
588
594
|
"Cannot calculate blueId for checkpoint: missing root event payload"
|
|
589
595
|
);
|
|
590
|
-
if (n instanceof
|
|
596
|
+
if (n instanceof Ie) {
|
|
591
597
|
const r = n.getMinimalNode();
|
|
592
598
|
return await t.getBlue().calculateBlueId(r);
|
|
593
599
|
}
|
|
594
600
|
return await t.getBlue().calculateBlueId(n);
|
|
595
601
|
}
|
|
596
602
|
async handle(e, t, n) {
|
|
597
|
-
var
|
|
598
|
-
if (!e.channelName || !((
|
|
603
|
+
var s;
|
|
604
|
+
if (!e.channelName || !((s = e.rootEvent) != null && s.seq)) return;
|
|
599
605
|
const o = await this.getEventBlueId(e, n), r = n.getNodePath().replace(/\/contracts\/checkpoint$/, "");
|
|
600
606
|
this.cache.record(r, e, o);
|
|
601
607
|
}
|
|
602
608
|
}
|
|
603
|
-
const
|
|
604
|
-
class
|
|
609
|
+
const K = (a, e) => a.get(e) !== void 0;
|
|
610
|
+
class Fe {
|
|
605
611
|
constructor() {
|
|
606
612
|
l(this, "firstSeen", /* @__PURE__ */ new Map());
|
|
607
613
|
}
|
|
@@ -614,18 +620,18 @@ class Re {
|
|
|
614
620
|
const t = [];
|
|
615
621
|
for (const { docBase: n, event: o, eventBlueId: r } of this.firstSeen.values()) {
|
|
616
622
|
if (!o.channelName) continue;
|
|
617
|
-
const
|
|
623
|
+
const s = b(
|
|
618
624
|
n,
|
|
619
625
|
"contracts/checkpoint/lastEvents",
|
|
620
626
|
o.channelName
|
|
621
|
-
),
|
|
622
|
-
|
|
623
|
-
op:
|
|
624
|
-
path:
|
|
627
|
+
), i = `${s}/blueId`;
|
|
628
|
+
K(e, s) ? t.push({
|
|
629
|
+
op: K(e, i) ? "replace" : "add",
|
|
630
|
+
path: i,
|
|
625
631
|
val: r
|
|
626
632
|
}) : t.push({
|
|
627
633
|
op: "add",
|
|
628
|
-
path:
|
|
634
|
+
path: s,
|
|
629
635
|
val: { blueId: r }
|
|
630
636
|
});
|
|
631
637
|
}
|
|
@@ -635,7 +641,25 @@ class Re {
|
|
|
635
641
|
this.firstSeen.clear();
|
|
636
642
|
}
|
|
637
643
|
}
|
|
638
|
-
class
|
|
644
|
+
class Xe {
|
|
645
|
+
constructor() {
|
|
646
|
+
l(this, "contractType", "Composite Timeline Channel");
|
|
647
|
+
l(this, "contractBlueId", g["Composite Timeline Channel"]);
|
|
648
|
+
l(this, "role", "adapter");
|
|
649
|
+
}
|
|
650
|
+
supports(e, t, n) {
|
|
651
|
+
const o = n.getBlue().nodeToSchemaOutput(t, ve);
|
|
652
|
+
return !o.channels || !e.channelName ? !1 : o.channels.includes(e.channelName);
|
|
653
|
+
}
|
|
654
|
+
handle(e, t, n, o) {
|
|
655
|
+
n.emitEvent({
|
|
656
|
+
payload: e.payload,
|
|
657
|
+
channelName: o,
|
|
658
|
+
source: "channel"
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
class C {
|
|
639
663
|
constructor() {
|
|
640
664
|
l(this, "role", "adapter");
|
|
641
665
|
}
|
|
@@ -647,15 +671,18 @@ class S {
|
|
|
647
671
|
return e.source !== "channel";
|
|
648
672
|
}
|
|
649
673
|
}
|
|
650
|
-
class
|
|
674
|
+
class Qe extends C {
|
|
651
675
|
constructor() {
|
|
652
676
|
super(...arguments);
|
|
653
|
-
l(this, "contractType", "
|
|
654
|
-
l(this, "contractBlueId",
|
|
677
|
+
l(this, "contractType", "Document Update Channel");
|
|
678
|
+
l(this, "contractBlueId", g["Document Update Channel"]);
|
|
655
679
|
}
|
|
656
680
|
supports(t, n, o) {
|
|
657
|
-
|
|
658
|
-
|
|
681
|
+
if (!this.baseSupports(t) || t.emissionType !== "update") return !1;
|
|
682
|
+
const r = o.getBlue().nodeToSchemaOutput(n, we), s = t.payload.get("/path");
|
|
683
|
+
if (!s) return !1;
|
|
684
|
+
const i = r.path;
|
|
685
|
+
return M(i) && s === o.resolvePath(i);
|
|
659
686
|
}
|
|
660
687
|
handle(t, n, o, r) {
|
|
661
688
|
o.emitEvent({
|
|
@@ -665,52 +692,30 @@ class He extends S {
|
|
|
665
692
|
});
|
|
666
693
|
}
|
|
667
694
|
}
|
|
668
|
-
class
|
|
669
|
-
constructor() {
|
|
670
|
-
super(...arguments);
|
|
671
|
-
l(this, "contractType", "Document Update Channel");
|
|
672
|
-
l(this, "contractBlueId", f["Document Update Channel"]);
|
|
673
|
-
}
|
|
674
|
-
supports(t, n, o, r) {
|
|
675
|
-
if (!this.baseSupports(t)) return !1;
|
|
676
|
-
const a = o.getBlue().nodeToSchemaOutput(n, ve), c = t.payload.get("/path");
|
|
677
|
-
if (!c || t.channelName === r) return !1;
|
|
678
|
-
const i = a.path;
|
|
679
|
-
return M(i) && c === o.resolvePath(i);
|
|
680
|
-
}
|
|
681
|
-
handle(t, n, o, r) {
|
|
682
|
-
const a = t.payload;
|
|
683
|
-
a && o.emitEvent({
|
|
684
|
-
payload: a,
|
|
685
|
-
channelName: r,
|
|
686
|
-
source: "channel"
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
class Ke extends S {
|
|
695
|
+
class Ge extends C {
|
|
691
696
|
constructor() {
|
|
692
697
|
super(...arguments);
|
|
693
698
|
l(this, "contractType", "Embedded Node Channel");
|
|
694
|
-
l(this, "contractBlueId",
|
|
699
|
+
l(this, "contractBlueId", g["Embedded Node Channel"]);
|
|
695
700
|
}
|
|
696
701
|
supports(t, n, o) {
|
|
697
702
|
if (!this.baseSupports(t)) return !1;
|
|
698
|
-
const r = o.getBlue().nodeToSchemaOutput(n,
|
|
699
|
-
return
|
|
703
|
+
const r = o.getBlue().nodeToSchemaOutput(n, F);
|
|
704
|
+
return E(t.originNodePath) && E(r.path) && t.originNodePath === o.resolvePath(r.path);
|
|
700
705
|
}
|
|
701
706
|
handle(t, n, o, r) {
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
payload:
|
|
707
|
+
const s = o.getBlue().nodeToSchemaOutput(n, F), { originNodePath: i, payload: c } = t;
|
|
708
|
+
E(s.path) && i === o.resolvePath(s.path) && o.emitEvent({
|
|
709
|
+
payload: c,
|
|
705
710
|
channelName: r,
|
|
706
711
|
source: "channel"
|
|
707
712
|
});
|
|
708
713
|
}
|
|
709
714
|
}
|
|
710
|
-
class
|
|
715
|
+
class Ke {
|
|
711
716
|
constructor() {
|
|
712
717
|
l(this, "contractType", "Initialized Marker");
|
|
713
|
-
l(this, "contractBlueId",
|
|
718
|
+
l(this, "contractBlueId", g["Initialized Marker"]);
|
|
714
719
|
l(this, "role", "marker");
|
|
715
720
|
}
|
|
716
721
|
supports() {
|
|
@@ -719,20 +724,21 @@ class Xe {
|
|
|
719
724
|
handle() {
|
|
720
725
|
}
|
|
721
726
|
}
|
|
722
|
-
class Ye extends
|
|
727
|
+
class Ye extends C {
|
|
723
728
|
constructor() {
|
|
724
729
|
super(...arguments);
|
|
725
730
|
l(this, "contractType", "Lifecycle Event Channel");
|
|
726
|
-
l(this, "contractBlueId",
|
|
731
|
+
l(this, "contractBlueId", g["Lifecycle Event Channel"]);
|
|
727
732
|
}
|
|
728
733
|
supports(t, n, o) {
|
|
729
|
-
return !this.baseSupports(t) || !this.isLifecycleEvent(t, o) ? !1 : this.isEventPatternMatch(t, n, o);
|
|
734
|
+
return !this.baseSupports(t) || t.emissionType !== "lifecycle" || !this.isLifecycleEvent(t, o) ? !1 : this.isEventPatternMatch(t, n, o);
|
|
730
735
|
}
|
|
731
736
|
handle(t, n, o, r) {
|
|
732
737
|
o.emitEvent({
|
|
733
738
|
payload: t.payload,
|
|
734
739
|
channelName: r,
|
|
735
|
-
source: "channel"
|
|
740
|
+
source: "channel",
|
|
741
|
+
emissionType: t.emissionType
|
|
736
742
|
});
|
|
737
743
|
}
|
|
738
744
|
/**
|
|
@@ -740,7 +746,7 @@ class Ye extends S {
|
|
|
740
746
|
*/
|
|
741
747
|
isLifecycleEvent(t, n) {
|
|
742
748
|
const o = n.getBlue(), r = t.payload;
|
|
743
|
-
return o.isTypeOf(r,
|
|
749
|
+
return o.isTypeOf(r, Te, {
|
|
744
750
|
checkSchemaExtensions: !0
|
|
745
751
|
});
|
|
746
752
|
}
|
|
@@ -748,60 +754,60 @@ class Ye extends S {
|
|
|
748
754
|
* Checks if the event matches the channel's event pattern (if specified)
|
|
749
755
|
*/
|
|
750
756
|
isEventPatternMatch(t, n, o) {
|
|
751
|
-
var
|
|
752
|
-
const r = (
|
|
757
|
+
var s;
|
|
758
|
+
const r = (s = n.getProperties()) == null ? void 0 : s.event;
|
|
753
759
|
if (!r)
|
|
754
760
|
return !0;
|
|
755
761
|
try {
|
|
756
|
-
const
|
|
757
|
-
return
|
|
758
|
-
} catch (
|
|
759
|
-
return console.warn("Error during lifecycle event pattern matching:",
|
|
762
|
+
const i = o.getBlue(), c = i.resolve(t.payload);
|
|
763
|
+
return i.isTypeOfNode(c, r);
|
|
764
|
+
} catch (i) {
|
|
765
|
+
return console.warn("Error during lifecycle event pattern matching:", i), !1;
|
|
760
766
|
}
|
|
761
767
|
}
|
|
762
768
|
}
|
|
763
|
-
const
|
|
769
|
+
const Y = (a, e) => {
|
|
764
770
|
const t = e.getBlue();
|
|
765
|
-
return t.isTypeOf(
|
|
771
|
+
return t.isTypeOf(a.payload, O) || t.isTypeOf(a.payload, oe);
|
|
766
772
|
};
|
|
767
|
-
class Ze extends
|
|
773
|
+
class Ze extends C {
|
|
768
774
|
constructor() {
|
|
769
775
|
super(...arguments);
|
|
770
776
|
l(this, "contractType", "MyOS Timeline Channel");
|
|
771
|
-
l(this, "contractBlueId",
|
|
777
|
+
l(this, "contractBlueId", ne["MyOS Timeline Channel"]);
|
|
772
778
|
}
|
|
773
779
|
supports(t, n, o) {
|
|
774
780
|
var u;
|
|
775
|
-
if (!this.baseSupports(t) || !
|
|
776
|
-
const
|
|
781
|
+
if (!this.baseSupports(t) || !Y(t, o)) return !1;
|
|
782
|
+
const s = o.getBlue().nodeToSchemaOutput(
|
|
777
783
|
t.payload,
|
|
778
|
-
|
|
779
|
-
),
|
|
780
|
-
return
|
|
784
|
+
oe
|
|
785
|
+
), i = o.getBlue().nodeToSchemaOutput(n, Me), c = (u = s.timeline) == null ? void 0 : u.timelineId;
|
|
786
|
+
return E(i.timelineId) && E(c) && c === i.timelineId;
|
|
781
787
|
}
|
|
782
788
|
handle(t, n, o, r) {
|
|
783
|
-
|
|
789
|
+
Y(t, o) && o.emitEvent({
|
|
784
790
|
payload: t.payload,
|
|
785
791
|
channelName: r,
|
|
786
792
|
source: "channel"
|
|
787
793
|
});
|
|
788
794
|
}
|
|
789
795
|
}
|
|
790
|
-
class
|
|
796
|
+
class et extends C {
|
|
791
797
|
constructor() {
|
|
792
798
|
super(...arguments);
|
|
793
799
|
l(this, "contractType", "MyOS Agent Channel");
|
|
794
|
-
l(this, "contractBlueId",
|
|
800
|
+
l(this, "contractBlueId", ne["MyOS Agent Channel"]);
|
|
795
801
|
}
|
|
796
802
|
supports(t, n, o) {
|
|
797
803
|
if (!this.baseSupports(t)) return !1;
|
|
798
804
|
try {
|
|
799
|
-
const { myosAgentEvent: r, myosAgentChannel:
|
|
805
|
+
const { myosAgentEvent: r, myosAgentChannel: s } = this.parseEventAndChannel(
|
|
800
806
|
t,
|
|
801
807
|
n,
|
|
802
808
|
o
|
|
803
809
|
);
|
|
804
|
-
return this.isAgentMatch(r,
|
|
810
|
+
return this.isAgentMatch(r, s) && this.isEventPatternMatch(r, s, o);
|
|
805
811
|
} catch (r) {
|
|
806
812
|
return console.warn("Error in MyOSAgentChannelProcessor.supports:", r), !1;
|
|
807
813
|
}
|
|
@@ -818,14 +824,14 @@ class Ge extends S {
|
|
|
818
824
|
* @throws {Error} If schema validation fails
|
|
819
825
|
*/
|
|
820
826
|
parseEventAndChannel(t, n, o) {
|
|
821
|
-
const r = o.getBlue(),
|
|
827
|
+
const r = o.getBlue(), s = r.nodeToSchemaOutput(
|
|
822
828
|
t.payload,
|
|
823
|
-
Me
|
|
824
|
-
), c = r.nodeToSchemaOutput(
|
|
825
|
-
n,
|
|
826
829
|
$e
|
|
830
|
+
), i = r.nodeToSchemaOutput(
|
|
831
|
+
n,
|
|
832
|
+
qe
|
|
827
833
|
);
|
|
828
|
-
return { myosAgentEvent:
|
|
834
|
+
return { myosAgentEvent: s, myosAgentChannel: i };
|
|
829
835
|
}
|
|
830
836
|
/**
|
|
831
837
|
* Checks if the agent IDs match between event and channel
|
|
@@ -834,9 +840,9 @@ class Ge extends S {
|
|
|
834
840
|
* @returns true if both have valid agent IDs and they match
|
|
835
841
|
*/
|
|
836
842
|
isAgentMatch(t, n) {
|
|
837
|
-
var
|
|
838
|
-
const o = t.agentId, r = (
|
|
839
|
-
return
|
|
843
|
+
var s;
|
|
844
|
+
const o = t.agentId, r = (s = n.agent) == null ? void 0 : s.agentId;
|
|
845
|
+
return E(o) && E(r) && o === r;
|
|
840
846
|
}
|
|
841
847
|
/**
|
|
842
848
|
* Checks if the event pattern matches the channel's event filter
|
|
@@ -855,26 +861,36 @@ class Ge extends S {
|
|
|
855
861
|
const r = n.event;
|
|
856
862
|
if (!r)
|
|
857
863
|
return !0;
|
|
858
|
-
const
|
|
859
|
-
if (!
|
|
864
|
+
const s = t.event;
|
|
865
|
+
if (!s)
|
|
860
866
|
return !1;
|
|
861
867
|
try {
|
|
862
|
-
const
|
|
863
|
-
return
|
|
864
|
-
} catch (
|
|
865
|
-
return console.warn("Error during event pattern matching:",
|
|
868
|
+
const i = o.getBlue(), c = i.nodeToJson(s), d = i.nodeToJson(r);
|
|
869
|
+
return Oe(c, d);
|
|
870
|
+
} catch (i) {
|
|
871
|
+
return console.warn("Error during event pattern matching:", i), !1;
|
|
866
872
|
}
|
|
867
873
|
}
|
|
868
874
|
}
|
|
869
|
-
class
|
|
875
|
+
class tt {
|
|
870
876
|
constructor() {
|
|
871
877
|
l(this, "contractType", "Operation");
|
|
872
|
-
l(this, "contractBlueId",
|
|
878
|
+
l(this, "contractBlueId", g.Operation);
|
|
873
879
|
l(this, "role", "adapter");
|
|
874
880
|
}
|
|
875
881
|
supports(e, t, n, o) {
|
|
876
|
-
const
|
|
877
|
-
|
|
882
|
+
const s = n.getBlue().nodeToSchemaOutput(t, be), i = this.parseEventPayload(e, n), c = this.isOperationNameMatch(
|
|
883
|
+
i,
|
|
884
|
+
o
|
|
885
|
+
), d = this.isOperationChannelMatch(
|
|
886
|
+
e,
|
|
887
|
+
s
|
|
888
|
+
), u = this.isRequestPatternMatch(
|
|
889
|
+
i,
|
|
890
|
+
s,
|
|
891
|
+
n
|
|
892
|
+
);
|
|
893
|
+
return c && d && u;
|
|
878
894
|
}
|
|
879
895
|
async handle(e, t, n, o) {
|
|
880
896
|
n.emitEvent({
|
|
@@ -885,12 +901,12 @@ class et {
|
|
|
885
901
|
}
|
|
886
902
|
parseEventPayload(e, t) {
|
|
887
903
|
const n = t.getBlue();
|
|
888
|
-
if (n.isTypeOf(e.payload,
|
|
904
|
+
if (n.isTypeOf(e.payload, O, {
|
|
889
905
|
checkSchemaExtensions: !0
|
|
890
906
|
})) {
|
|
891
907
|
const o = n.nodeToSchemaOutput(
|
|
892
908
|
e.payload,
|
|
893
|
-
|
|
909
|
+
O
|
|
894
910
|
);
|
|
895
911
|
if (o.message)
|
|
896
912
|
return n.nodeToSchemaOutput(
|
|
@@ -900,18 +916,35 @@ class et {
|
|
|
900
916
|
}
|
|
901
917
|
return null;
|
|
902
918
|
}
|
|
919
|
+
isOperationNameMatch(e, t) {
|
|
920
|
+
return E(e == null ? void 0 : e.operation) && (e == null ? void 0 : e.operation) === t;
|
|
921
|
+
}
|
|
922
|
+
isOperationChannelMatch(e, t) {
|
|
923
|
+
const n = t.channel;
|
|
924
|
+
return _(n) ? !0 : e.source === "channel" && e.channelName === n;
|
|
925
|
+
}
|
|
926
|
+
isRequestPatternMatch(e, t, n) {
|
|
927
|
+
const o = t.request;
|
|
928
|
+
if (_(o))
|
|
929
|
+
return !0;
|
|
930
|
+
const r = n.getBlue(), s = e == null ? void 0 : e.request;
|
|
931
|
+
if (_(s))
|
|
932
|
+
return !1;
|
|
933
|
+
const i = r.resolve(s);
|
|
934
|
+
return r.isTypeOfNode(i, o);
|
|
935
|
+
}
|
|
903
936
|
}
|
|
904
|
-
class
|
|
937
|
+
class nt {
|
|
905
938
|
constructor() {
|
|
906
939
|
l(this, "contractType", "Process Embedded");
|
|
907
940
|
l(this, "role", "adapter");
|
|
908
|
-
l(this, "contractBlueId",
|
|
941
|
+
l(this, "contractBlueId", g["Process Embedded"]);
|
|
909
942
|
}
|
|
910
943
|
supports(e) {
|
|
911
944
|
return e.source !== "channel";
|
|
912
945
|
}
|
|
913
946
|
handle(e, t, n) {
|
|
914
|
-
const o = n.getBlue().nodeToSchemaOutput(t,
|
|
947
|
+
const o = n.getBlue().nodeToSchemaOutput(t, W);
|
|
915
948
|
for (const r of o.paths ?? [])
|
|
916
949
|
n.emitEvent({
|
|
917
950
|
...e,
|
|
@@ -919,20 +952,50 @@ class tt {
|
|
|
919
952
|
});
|
|
920
953
|
}
|
|
921
954
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
try {
|
|
926
|
-
E = require("isolated-vm");
|
|
927
|
-
} catch {
|
|
928
|
-
console.warn("isolated-vm not available, using fallback evaluation method");
|
|
929
|
-
}
|
|
930
|
-
function K(s) {
|
|
931
|
-
return /\bimport\s.+\sfrom\s+['"][^'"]+['"]/.test(s) || /\bexport\s+/.test(s);
|
|
955
|
+
let y = null;
|
|
956
|
+
function ot(a) {
|
|
957
|
+
return /\bimport\s.+\sfrom\s+['"][^'"]+['"]/.test(a) || /\bexport\s+/.test(a);
|
|
932
958
|
}
|
|
933
|
-
class
|
|
959
|
+
class A {
|
|
960
|
+
static getIvmUnavailableMessage() {
|
|
961
|
+
const e = typeof process < "u" && process.version ? process.version : "unknown", t = typeof process < "u" && process.platform ? process.platform : "unknown", n = typeof process < "u" && process.arch ? process.arch : "unknown";
|
|
962
|
+
return [
|
|
963
|
+
"isolated-vm is required for expression evaluation but could not be loaded.",
|
|
964
|
+
"This feature only works in a Node.js environment with the native addon available.",
|
|
965
|
+
"",
|
|
966
|
+
`Detected environment: Node ${e} on ${t}/${n}.`,
|
|
967
|
+
"",
|
|
968
|
+
"Common causes:",
|
|
969
|
+
"- Running in a non-Node environment (browser, edge/runtime without Node).",
|
|
970
|
+
"- 'isolated-vm' is not installed, or failed to build its native addon.",
|
|
971
|
+
"- The module was bundled/stripped by a build tool.",
|
|
972
|
+
"",
|
|
973
|
+
"How to fix:",
|
|
974
|
+
"- Ensure 'isolated-vm' is listed in dependencies (not devDependencies) of the executing package.",
|
|
975
|
+
"- Reinstall or rebuild: npm ci && npm rebuild isolated-vm (or equivalent with your package manager).",
|
|
976
|
+
"- Run this code on a supported Node.js runtime (not browser/edge workers)."
|
|
977
|
+
].join(`
|
|
978
|
+
`);
|
|
979
|
+
}
|
|
980
|
+
static async ensureIvmLoaded() {
|
|
981
|
+
var t;
|
|
982
|
+
if (!(y || !(typeof process < "u" && ((t = process.versions) != null && t.node)))) {
|
|
983
|
+
try {
|
|
984
|
+
if (typeof require == "function") {
|
|
985
|
+
y = require("isolated-vm");
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
} catch {
|
|
989
|
+
}
|
|
990
|
+
try {
|
|
991
|
+
const r = await import("isolated-vm").catch(() => null);
|
|
992
|
+
y = (r == null ? void 0 : r.default) ?? r;
|
|
993
|
+
} catch {
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
934
997
|
/**
|
|
935
|
-
* Main evaluation method -
|
|
998
|
+
* Main evaluation method - evaluates code securely in an isolated VM
|
|
936
999
|
*/
|
|
937
1000
|
static async evaluate({
|
|
938
1001
|
code: e,
|
|
@@ -940,87 +1003,60 @@ class j {
|
|
|
940
1003
|
bindings: n = {},
|
|
941
1004
|
options: o = {}
|
|
942
1005
|
}) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
* Fallback evaluation using Node's Function constructor
|
|
947
|
-
* Used when isolated-vm is not available
|
|
948
|
-
*/
|
|
949
|
-
static async evaluateSimple(e, t, n = {}) {
|
|
950
|
-
if (K(e))
|
|
951
|
-
throw new Error(
|
|
952
|
-
"Static import/export syntax requires isolated-vm – start Node without SKIP_ISOLATED_VM."
|
|
953
|
-
);
|
|
954
|
-
try {
|
|
955
|
-
if (n.isCodeBlock) {
|
|
956
|
-
const o = Object.keys(t);
|
|
957
|
-
return await (await new Function(
|
|
958
|
-
...o,
|
|
959
|
-
`return async function codeBlock(${o.join(
|
|
960
|
-
", "
|
|
961
|
-
)}) { ${e} }`
|
|
962
|
-
)(
|
|
963
|
-
...o.map((c) => t[c])
|
|
964
|
-
))(...o.map((c) => t[c]));
|
|
965
|
-
} else
|
|
966
|
-
return new Function(
|
|
967
|
-
...Object.keys(t),
|
|
968
|
-
`return ${e};`
|
|
969
|
-
)(...Object.values(t));
|
|
970
|
-
} catch (o) {
|
|
971
|
-
throw n.isCodeBlock ? new L(e, o) : new F(e, o);
|
|
972
|
-
}
|
|
1006
|
+
if (await this.ensureIvmLoaded(), !y)
|
|
1007
|
+
throw new Error(this.getIvmUnavailableMessage());
|
|
1008
|
+
return this.evaluateSecure(e, n, t, o);
|
|
973
1009
|
}
|
|
974
1010
|
/**
|
|
975
1011
|
* Secure evaluation using isolated-vm with support for ES modules
|
|
976
1012
|
*/
|
|
977
1013
|
static async evaluateSecure(e, t, n, o = {}) {
|
|
978
|
-
if (!
|
|
979
|
-
const r = new
|
|
1014
|
+
if (!y) throw new Error(this.getIvmUnavailableMessage());
|
|
1015
|
+
const r = new y.Isolate({ memoryLimit: 32 }), s = await r.createContext(), i = s.global;
|
|
980
1016
|
try {
|
|
981
|
-
await this.setupIsolateEnvironment(
|
|
982
|
-
const
|
|
1017
|
+
await this.setupIsolateEnvironment(i, t);
|
|
1018
|
+
const c = /* @__PURE__ */ new Map(), d = this.createModuleResolver(
|
|
983
1019
|
r,
|
|
984
|
-
|
|
985
|
-
|
|
1020
|
+
s,
|
|
1021
|
+
c,
|
|
986
1022
|
n
|
|
987
1023
|
);
|
|
988
1024
|
let u;
|
|
989
|
-
return
|
|
1025
|
+
return ot(e) ? u = await this.evaluateESModule(
|
|
990
1026
|
r,
|
|
991
|
-
|
|
1027
|
+
s,
|
|
992
1028
|
e,
|
|
993
1029
|
o,
|
|
994
|
-
|
|
1030
|
+
d
|
|
995
1031
|
) : u = await this.evaluateSimpleScript(
|
|
996
1032
|
r,
|
|
997
|
-
|
|
1033
|
+
s,
|
|
998
1034
|
e,
|
|
999
1035
|
t,
|
|
1000
1036
|
o
|
|
1001
1037
|
), this.deepClone(u);
|
|
1002
|
-
} catch (
|
|
1003
|
-
throw o.isCodeBlock ? new
|
|
1038
|
+
} catch (c) {
|
|
1039
|
+
throw o.isCodeBlock ? new De(e, c) : new Ae(e, c);
|
|
1004
1040
|
} finally {
|
|
1005
|
-
|
|
1041
|
+
s.release(), r.dispose();
|
|
1006
1042
|
}
|
|
1007
1043
|
}
|
|
1008
1044
|
/**
|
|
1009
1045
|
* Setup the isolated VM environment with necessary host functions and data
|
|
1010
1046
|
*/
|
|
1011
1047
|
static async setupIsolateEnvironment(e, t) {
|
|
1012
|
-
if (!
|
|
1013
|
-
const n = new
|
|
1048
|
+
if (!y) throw new Error("isolated-vm not available");
|
|
1049
|
+
const n = new y.Callback(
|
|
1014
1050
|
(...r) => console.log(...r)
|
|
1015
|
-
), o = new
|
|
1051
|
+
), o = new y.ExternalCopy({
|
|
1016
1052
|
log: n
|
|
1017
1053
|
}).copyInto();
|
|
1018
1054
|
await e.set("console", o);
|
|
1019
|
-
for (const [r,
|
|
1020
|
-
typeof
|
|
1055
|
+
for (const [r, s] of Object.entries(t))
|
|
1056
|
+
typeof s == "function" ? await e.set(
|
|
1021
1057
|
r,
|
|
1022
|
-
new
|
|
1023
|
-
) : await e.set(r, new
|
|
1058
|
+
new y.Callback(s)
|
|
1059
|
+
) : await e.set(r, new y.ExternalCopy(s).copyInto());
|
|
1024
1060
|
}
|
|
1025
1061
|
/**
|
|
1026
1062
|
* Create module resolver function for handling imports
|
|
@@ -1029,30 +1065,30 @@ class j {
|
|
|
1029
1065
|
return async (r) => {
|
|
1030
1066
|
if (n.has(r)) return n.get(r);
|
|
1031
1067
|
if (r.startsWith("blue:")) {
|
|
1032
|
-
const
|
|
1033
|
-
if (typeof
|
|
1068
|
+
const s = r.slice(5), i = o.loadBlueContent;
|
|
1069
|
+
if (typeof i != "function")
|
|
1034
1070
|
throw new Error(
|
|
1035
1071
|
`ProcessingContext is missing a loadBlueContent(blueId) implementation (needed for ${r})`
|
|
1036
1072
|
);
|
|
1037
|
-
const
|
|
1038
|
-
return n.set(r,
|
|
1073
|
+
const c = await i(s), d = await e.compileModule(c);
|
|
1074
|
+
return n.set(r, d), await d.instantiate(
|
|
1039
1075
|
t,
|
|
1040
1076
|
this.createModuleResolver(e, t, n, o)
|
|
1041
|
-
),
|
|
1077
|
+
), d;
|
|
1042
1078
|
}
|
|
1043
1079
|
if (/^https?:\/\//.test(r)) {
|
|
1044
|
-
let
|
|
1080
|
+
let s;
|
|
1045
1081
|
if (typeof o.loadExternalModule == "function")
|
|
1046
|
-
|
|
1082
|
+
s = await o.loadExternalModule(r);
|
|
1047
1083
|
else
|
|
1048
1084
|
throw new Error(
|
|
1049
1085
|
`ProcessingContext is missing a loadExternalModule(url) implementation (needed for ${r})`
|
|
1050
1086
|
);
|
|
1051
|
-
const
|
|
1052
|
-
return n.set(r,
|
|
1087
|
+
const i = await e.compileModule(s);
|
|
1088
|
+
return n.set(r, i), await i.instantiate(
|
|
1053
1089
|
t,
|
|
1054
1090
|
this.createModuleResolver(e, t, n, o)
|
|
1055
|
-
),
|
|
1091
|
+
), i;
|
|
1056
1092
|
}
|
|
1057
1093
|
throw new Error(`Unsupported module specifier "${r}"`);
|
|
1058
1094
|
};
|
|
@@ -1061,8 +1097,8 @@ class j {
|
|
|
1061
1097
|
* Evaluate code as a simple script (no imports/exports)
|
|
1062
1098
|
*/
|
|
1063
1099
|
static async evaluateSimpleScript(e, t, n, o, r) {
|
|
1064
|
-
const
|
|
1065
|
-
return await (await e.compileScript(
|
|
1100
|
+
const s = Object.keys(o).join(", "), i = Object.keys(o).map((u) => u), c = `(async (${s}) => { ${r.isCodeBlock ? n : `return (${n});`} })(${i.join(", ")})`;
|
|
1101
|
+
return await (await e.compileScript(c)).run(t, {
|
|
1066
1102
|
timeout: r.timeout ?? 500,
|
|
1067
1103
|
promise: !0,
|
|
1068
1104
|
copy: !0,
|
|
@@ -1073,27 +1109,27 @@ class j {
|
|
|
1073
1109
|
* Evaluate code as an ES module with import/export support
|
|
1074
1110
|
*/
|
|
1075
1111
|
static async evaluateESModule(e, t, n, o, r) {
|
|
1076
|
-
let
|
|
1112
|
+
let s = n;
|
|
1077
1113
|
if (o.isCodeBlock) {
|
|
1078
|
-
const
|
|
1114
|
+
const d = /^\s*(import\s.+?;|export\s.+?;)/gm, u = (n.match(d) || []).join(
|
|
1079
1115
|
`
|
|
1080
1116
|
`
|
|
1081
|
-
),
|
|
1082
|
-
|
|
1117
|
+
), h = n.replace(d, "").trim();
|
|
1118
|
+
s = `
|
|
1083
1119
|
${u}
|
|
1084
1120
|
const run = function() {
|
|
1085
|
-
${
|
|
1121
|
+
${h}
|
|
1086
1122
|
};
|
|
1087
1123
|
export default run();
|
|
1088
1124
|
`;
|
|
1089
1125
|
}
|
|
1090
|
-
const
|
|
1091
|
-
return await
|
|
1126
|
+
const i = await e.compileModule(s);
|
|
1127
|
+
return await i.instantiate(t, r), await i.evaluate({
|
|
1092
1128
|
timeout: o.timeout ?? 500,
|
|
1093
1129
|
promise: !0,
|
|
1094
1130
|
reference: !0,
|
|
1095
1131
|
release: !0
|
|
1096
|
-
}), await
|
|
1132
|
+
}), await i.namespace.get("default", {
|
|
1097
1133
|
timeout: o.timeout ?? 500,
|
|
1098
1134
|
promise: !0,
|
|
1099
1135
|
copy: !0,
|
|
@@ -1108,197 +1144,242 @@ class j {
|
|
|
1108
1144
|
return typeof e > "u" ? e : JSON.parse(JSON.stringify(e));
|
|
1109
1145
|
}
|
|
1110
1146
|
}
|
|
1111
|
-
class
|
|
1147
|
+
class R {
|
|
1112
1148
|
/**
|
|
1113
1149
|
* Creates standard bindings for workflow step execution
|
|
1114
1150
|
*/
|
|
1115
1151
|
static createStandardBindings(e, t, n) {
|
|
1116
|
-
const o = e.getBlue(), r = o.nodeToJson(t.payload, "simple"),
|
|
1152
|
+
const o = e.getBlue(), r = o.nodeToJson(t.payload, "simple"), s = L(r) ? r.toNumber() : r;
|
|
1117
1153
|
return {
|
|
1118
|
-
document: (
|
|
1119
|
-
const
|
|
1120
|
-
return
|
|
1154
|
+
document: (i) => {
|
|
1155
|
+
const c = e.get(i);
|
|
1156
|
+
return L(c) ? c.toNumber() : S(c) ? o.nodeToJson(c, "original") : c;
|
|
1121
1157
|
},
|
|
1122
|
-
event:
|
|
1158
|
+
event: s,
|
|
1123
1159
|
steps: n
|
|
1124
1160
|
};
|
|
1125
1161
|
}
|
|
1126
1162
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1163
|
+
const rt = /^\$\{([\s\S]*)\}$/, st = /\$\{([\s\S]*?)\}/, T = (a) => typeof a != "string" ? !1 : rt.test(a), U = (a) => typeof a != "string" ? !1 : st.test(a), ce = (a) => {
|
|
1164
|
+
if (!T(a))
|
|
1165
|
+
throw new Error(`Invalid expression: ${a}`);
|
|
1166
|
+
return a.slice(2, -1);
|
|
1167
|
+
};
|
|
1168
|
+
class q {
|
|
1169
|
+
static createBindings(e, t, n) {
|
|
1170
|
+
return R.createStandardBindings(e, t, n);
|
|
1171
|
+
}
|
|
1172
|
+
static async evaluate(e, t, n, o) {
|
|
1173
|
+
const { coerceToString: r } = o;
|
|
1174
|
+
if (T(e)) {
|
|
1175
|
+
const s = ce(e), i = await A.evaluate({
|
|
1176
|
+
code: s,
|
|
1177
|
+
ctx: t,
|
|
1178
|
+
bindings: n
|
|
1179
|
+
});
|
|
1180
|
+
return r ? String(i ?? "") : i;
|
|
1181
|
+
}
|
|
1182
|
+
if (U(e)) {
|
|
1183
|
+
const i = `\`${String(e).replace(/`/g, "\\`")}\``, c = await A.evaluate({
|
|
1184
|
+
code: i,
|
|
1185
|
+
ctx: t,
|
|
1186
|
+
bindings: n
|
|
1187
|
+
});
|
|
1188
|
+
return String(c ?? "");
|
|
1189
|
+
}
|
|
1190
|
+
return r ? String(e) : e;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
function Z(a, e) {
|
|
1194
|
+
const { op: t, path: n, val: o, from: r } = a;
|
|
1129
1195
|
if ((t === "move" || t === "copy") && !r)
|
|
1130
1196
|
throw new Error(`${t} operation requires 'from' path`);
|
|
1131
1197
|
if ((t === "add" || t === "replace") && o === void 0)
|
|
1132
1198
|
throw new Error(`${t} operation requires 'val' property`);
|
|
1133
|
-
const
|
|
1199
|
+
const s = {
|
|
1134
1200
|
type: "Document Update",
|
|
1135
1201
|
op: t,
|
|
1136
1202
|
path: n
|
|
1137
1203
|
};
|
|
1138
|
-
return o !== void 0 && (
|
|
1204
|
+
return o !== void 0 && (s.val = o), r !== void 0 && (s.from = r), e.jsonValueToNode(s);
|
|
1139
1205
|
}
|
|
1140
|
-
function
|
|
1141
|
-
return
|
|
1206
|
+
function at(a) {
|
|
1207
|
+
return a.jsonValueToNode({
|
|
1142
1208
|
type: "Document Processing Initiated"
|
|
1143
1209
|
});
|
|
1144
1210
|
}
|
|
1145
|
-
|
|
1146
|
-
if (!O(s))
|
|
1147
|
-
throw new Error(`Invalid expression: ${s}`);
|
|
1148
|
-
return s.slice(2, -1);
|
|
1149
|
-
};
|
|
1150
|
-
class rt {
|
|
1211
|
+
class it {
|
|
1151
1212
|
constructor() {
|
|
1152
1213
|
l(this, "stepType", "Update Document");
|
|
1153
1214
|
}
|
|
1154
1215
|
supports(e) {
|
|
1155
|
-
return
|
|
1216
|
+
return P.isTypeOf(e, j);
|
|
1156
1217
|
}
|
|
1157
1218
|
async execute(e, t, n, o, r) {
|
|
1158
|
-
const
|
|
1159
|
-
if (!
|
|
1160
|
-
const
|
|
1219
|
+
const s = n.getBlue();
|
|
1220
|
+
if (!P.isTypeOf(e, j)) return;
|
|
1221
|
+
const i = await this.evaluateChangeset(
|
|
1161
1222
|
e.get("/changeset"),
|
|
1162
1223
|
n,
|
|
1163
1224
|
t,
|
|
1164
1225
|
r
|
|
1165
|
-
),
|
|
1226
|
+
), c = te(e, {
|
|
1166
1227
|
op: "replace",
|
|
1167
1228
|
path: "/changeset",
|
|
1168
|
-
val:
|
|
1169
|
-
}),
|
|
1170
|
-
for (const u of
|
|
1229
|
+
val: i
|
|
1230
|
+
}), d = n.getBlue().nodeToSchemaOutput(c, j);
|
|
1231
|
+
for (const u of d.changeset ?? []) {
|
|
1171
1232
|
if (!u.path) continue;
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1233
|
+
const h = await this.evaluateChangePath(
|
|
1234
|
+
u.path,
|
|
1235
|
+
n,
|
|
1236
|
+
t,
|
|
1237
|
+
r
|
|
1238
|
+
), p = u.val;
|
|
1239
|
+
if ((u.op === "replace" || u.op === "add") && M(p)) {
|
|
1240
|
+
const m = await this.evaluateChangeValue(
|
|
1241
|
+
p,
|
|
1176
1242
|
n,
|
|
1177
1243
|
t,
|
|
1178
1244
|
r
|
|
1179
1245
|
);
|
|
1180
1246
|
n.addPatch({
|
|
1181
1247
|
op: u.op,
|
|
1182
|
-
path:
|
|
1183
|
-
val:
|
|
1248
|
+
path: h,
|
|
1249
|
+
val: m
|
|
1184
1250
|
}), n.emitEvent({
|
|
1185
|
-
payload:
|
|
1251
|
+
payload: Z(
|
|
1186
1252
|
{
|
|
1187
1253
|
op: u.op,
|
|
1188
|
-
path: n.resolvePath(
|
|
1189
|
-
val:
|
|
1254
|
+
path: n.resolvePath(h),
|
|
1255
|
+
val: s.nodeToJson(m, "original")
|
|
1190
1256
|
},
|
|
1191
|
-
|
|
1192
|
-
)
|
|
1257
|
+
s
|
|
1258
|
+
),
|
|
1259
|
+
emissionType: "update"
|
|
1193
1260
|
});
|
|
1194
1261
|
}
|
|
1195
|
-
u.op === "remove" && (n.addPatch({ op: u.op, path:
|
|
1196
|
-
payload:
|
|
1262
|
+
u.op === "remove" && (n.addPatch({ op: u.op, path: h }), n.emitEvent({
|
|
1263
|
+
payload: Z(
|
|
1197
1264
|
{
|
|
1198
1265
|
op: u.op,
|
|
1199
|
-
path: n.resolvePath(
|
|
1266
|
+
path: n.resolvePath(h),
|
|
1200
1267
|
val: null
|
|
1201
1268
|
},
|
|
1202
|
-
|
|
1203
|
-
)
|
|
1269
|
+
s
|
|
1270
|
+
),
|
|
1271
|
+
emissionType: "update"
|
|
1204
1272
|
}));
|
|
1205
1273
|
}
|
|
1206
1274
|
}
|
|
1207
1275
|
async evaluateChangeset(e, t, n, o) {
|
|
1208
1276
|
const r = t.getBlue();
|
|
1209
|
-
if (
|
|
1210
|
-
const
|
|
1211
|
-
code:
|
|
1277
|
+
if (T(e)) {
|
|
1278
|
+
const s = ce(e), i = await A.evaluate({
|
|
1279
|
+
code: s,
|
|
1212
1280
|
ctx: t,
|
|
1213
|
-
bindings:
|
|
1281
|
+
bindings: R.createStandardBindings(
|
|
1214
1282
|
t,
|
|
1215
1283
|
n,
|
|
1216
1284
|
o
|
|
1217
1285
|
)
|
|
1218
1286
|
});
|
|
1219
|
-
return r.jsonValueToNode(
|
|
1287
|
+
return r.jsonValueToNode(i ?? null);
|
|
1220
1288
|
}
|
|
1221
|
-
if (
|
|
1289
|
+
if (S(e))
|
|
1222
1290
|
return e;
|
|
1223
1291
|
throw new Error("Invalid changeset: expected a string or document node");
|
|
1224
1292
|
}
|
|
1225
1293
|
async evaluateChangeValue(e, t, n, o) {
|
|
1226
|
-
const r = e.getValue(),
|
|
1227
|
-
if (
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1294
|
+
const r = e.getValue(), s = t.getBlue();
|
|
1295
|
+
if (T(r) || typeof r == "string" && U(r)) {
|
|
1296
|
+
const i = q.createBindings(
|
|
1297
|
+
t,
|
|
1298
|
+
n,
|
|
1299
|
+
o
|
|
1300
|
+
), c = await q.evaluate(
|
|
1301
|
+
String(r),
|
|
1302
|
+
t,
|
|
1303
|
+
i,
|
|
1304
|
+
{ coerceToString: !T(r) }
|
|
1305
|
+
);
|
|
1306
|
+
return s.jsonValueToNode(c ?? null);
|
|
1307
|
+
}
|
|
1308
|
+
return e;
|
|
1309
|
+
}
|
|
1310
|
+
async evaluateChangePath(e, t, n, o) {
|
|
1311
|
+
const r = q.createBindings(t, n, o);
|
|
1312
|
+
if (T(e) || U(e)) {
|
|
1313
|
+
const s = await q.evaluate(e, t, r, {
|
|
1314
|
+
coerceToString: !0
|
|
1236
1315
|
});
|
|
1237
|
-
return
|
|
1316
|
+
return String(s ?? "");
|
|
1238
1317
|
}
|
|
1239
1318
|
return e;
|
|
1240
1319
|
}
|
|
1241
1320
|
}
|
|
1242
|
-
class
|
|
1321
|
+
class ct {
|
|
1243
1322
|
constructor() {
|
|
1244
1323
|
l(this, "stepType", "Trigger Event");
|
|
1245
1324
|
}
|
|
1246
1325
|
supports(e) {
|
|
1247
|
-
return
|
|
1326
|
+
return P.isTypeOf(e, x);
|
|
1248
1327
|
}
|
|
1249
1328
|
async execute(e, t, n) {
|
|
1250
1329
|
const o = n.getBlue();
|
|
1251
|
-
if (!
|
|
1252
|
-
const r = o.nodeToSchemaOutput(e,
|
|
1330
|
+
if (!P.isTypeOf(e, x)) return;
|
|
1331
|
+
const r = o.nodeToSchemaOutput(e, x);
|
|
1253
1332
|
r.event && n.emitEvent({
|
|
1254
|
-
payload: r.event
|
|
1333
|
+
payload: r.event,
|
|
1334
|
+
emissionType: "triggered"
|
|
1255
1335
|
});
|
|
1256
1336
|
}
|
|
1257
1337
|
}
|
|
1258
|
-
class
|
|
1338
|
+
class lt {
|
|
1259
1339
|
constructor() {
|
|
1260
1340
|
l(this, "stepType", "JavaScript Code");
|
|
1261
1341
|
}
|
|
1262
1342
|
supports(e) {
|
|
1263
|
-
return
|
|
1343
|
+
return P.isTypeOf(e, V);
|
|
1264
1344
|
}
|
|
1265
1345
|
async execute(e, t, n, o, r) {
|
|
1266
|
-
if (!
|
|
1267
|
-
const
|
|
1346
|
+
if (!P.isTypeOf(e, V)) return;
|
|
1347
|
+
const s = n.getBlue(), i = s.nodeToSchemaOutput(
|
|
1268
1348
|
e,
|
|
1269
|
-
|
|
1349
|
+
V
|
|
1270
1350
|
);
|
|
1271
|
-
if (!
|
|
1351
|
+
if (!i.code)
|
|
1272
1352
|
throw new Error("JavaScript code is required");
|
|
1273
|
-
const
|
|
1274
|
-
code:
|
|
1353
|
+
const c = await A.evaluate({
|
|
1354
|
+
code: i.code,
|
|
1275
1355
|
ctx: n,
|
|
1276
|
-
bindings:
|
|
1356
|
+
bindings: R.createStandardBindings(n, t, r),
|
|
1277
1357
|
options: {
|
|
1278
1358
|
isCodeBlock: !0,
|
|
1279
1359
|
timeout: 500
|
|
1280
1360
|
}
|
|
1281
1361
|
});
|
|
1282
|
-
if (
|
|
1283
|
-
const
|
|
1284
|
-
if (Array.isArray(
|
|
1285
|
-
for (const u of
|
|
1362
|
+
if (c && typeof c == "object" && "events" in c) {
|
|
1363
|
+
const d = c;
|
|
1364
|
+
if (Array.isArray(d.events))
|
|
1365
|
+
for (const u of d.events)
|
|
1286
1366
|
n.emitEvent({
|
|
1287
|
-
payload:
|
|
1367
|
+
payload: s.jsonValueToNode(u),
|
|
1368
|
+
emissionType: "triggered"
|
|
1288
1369
|
});
|
|
1289
1370
|
}
|
|
1290
|
-
return
|
|
1371
|
+
return c;
|
|
1291
1372
|
}
|
|
1292
1373
|
}
|
|
1293
|
-
const
|
|
1294
|
-
new
|
|
1295
|
-
new
|
|
1296
|
-
new
|
|
1374
|
+
const ut = [
|
|
1375
|
+
new it(),
|
|
1376
|
+
new ct(),
|
|
1377
|
+
new lt()
|
|
1297
1378
|
];
|
|
1298
|
-
class
|
|
1299
|
-
constructor(e =
|
|
1379
|
+
class le {
|
|
1380
|
+
constructor(e = ut) {
|
|
1300
1381
|
l(this, "contractType", "Sequential Workflow");
|
|
1301
|
-
l(this, "contractBlueId",
|
|
1382
|
+
l(this, "contractBlueId", g["Sequential Workflow"]);
|
|
1302
1383
|
l(this, "role", "handler");
|
|
1303
1384
|
l(this, "executors", []);
|
|
1304
1385
|
this.executors = e;
|
|
@@ -1308,48 +1389,67 @@ class ie {
|
|
|
1308
1389
|
this.executors.push(e);
|
|
1309
1390
|
}
|
|
1310
1391
|
supports(e, t, n) {
|
|
1311
|
-
const
|
|
1392
|
+
const r = n.getBlue().nodeToSchemaOutput(
|
|
1312
1393
|
t,
|
|
1313
1394
|
Se
|
|
1314
|
-
).
|
|
1315
|
-
return
|
|
1395
|
+
), s = this.isChannelNameMatch(e, r), i = this.isEventPatternMatch(e, t, n);
|
|
1396
|
+
return s && i;
|
|
1316
1397
|
}
|
|
1317
1398
|
async handle(e, t, n, o) {
|
|
1318
|
-
var
|
|
1319
|
-
const r = {},
|
|
1320
|
-
for (const [
|
|
1321
|
-
const u = this.executors.find((p) => p.supports(
|
|
1399
|
+
var i;
|
|
1400
|
+
const r = {}, s = (i = t.getProperties()) == null ? void 0 : i.steps.getItems();
|
|
1401
|
+
for (const [c, d] of (s ?? []).entries()) {
|
|
1402
|
+
const u = this.executors.find((p) => p.supports(d));
|
|
1322
1403
|
if (!u)
|
|
1323
|
-
throw new Error(`Unsupported workflow step type "${
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1404
|
+
throw new Error(`Unsupported workflow step type "${d.getType()}"`);
|
|
1405
|
+
const h = await u.execute(
|
|
1406
|
+
d,
|
|
1326
1407
|
e,
|
|
1327
1408
|
n,
|
|
1328
1409
|
o,
|
|
1329
1410
|
r
|
|
1330
1411
|
);
|
|
1331
|
-
if (
|
|
1332
|
-
const p =
|
|
1333
|
-
r[m] =
|
|
1412
|
+
if (h !== void 0) {
|
|
1413
|
+
const p = d.getName(), m = typeof p == "string" ? p : `Step${c + 1}`;
|
|
1414
|
+
r[m] = h;
|
|
1334
1415
|
}
|
|
1335
1416
|
await n.flush();
|
|
1336
1417
|
}
|
|
1337
1418
|
}
|
|
1419
|
+
isChannelNameMatch(e, t) {
|
|
1420
|
+
const n = t.channel;
|
|
1421
|
+
return M(n) && e.source === "channel" && e.channelName === n;
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Checks if the event matches the channel's event pattern (if specified)
|
|
1425
|
+
*/
|
|
1426
|
+
isEventPatternMatch(e, t, n) {
|
|
1427
|
+
var r;
|
|
1428
|
+
const o = (r = t.getProperties()) == null ? void 0 : r.event;
|
|
1429
|
+
if (!o)
|
|
1430
|
+
return !0;
|
|
1431
|
+
try {
|
|
1432
|
+
const s = n.getBlue(), i = s.resolve(e.payload);
|
|
1433
|
+
return s.isTypeOfNode(i, o);
|
|
1434
|
+
} catch (s) {
|
|
1435
|
+
return console.warn("Error during event pattern matching:", s), !1;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1338
1438
|
}
|
|
1339
|
-
class
|
|
1439
|
+
class dt {
|
|
1340
1440
|
constructor(e) {
|
|
1341
1441
|
l(this, "contractType", "Sequential Workflow Operation");
|
|
1342
|
-
l(this, "contractBlueId",
|
|
1442
|
+
l(this, "contractBlueId", g["Sequential Workflow Operation"]);
|
|
1343
1443
|
l(this, "role", "handler");
|
|
1344
1444
|
l(this, "sequentialWorkflowProcessor");
|
|
1345
|
-
this.sequentialWorkflowProcessor = e || new
|
|
1445
|
+
this.sequentialWorkflowProcessor = e || new le();
|
|
1346
1446
|
}
|
|
1347
1447
|
supports(e, t, n) {
|
|
1348
|
-
const
|
|
1448
|
+
const s = n.getBlue().nodeToSchemaOutput(
|
|
1349
1449
|
t,
|
|
1350
1450
|
Ce
|
|
1351
|
-
).operation,
|
|
1352
|
-
return e.source === "channel" && M(
|
|
1451
|
+
).operation, i = e.channelName;
|
|
1452
|
+
return e.source === "channel" && M(i) && M(s) && i === s;
|
|
1353
1453
|
}
|
|
1354
1454
|
async handle(e, t, n, o) {
|
|
1355
1455
|
try {
|
|
@@ -1362,68 +1462,86 @@ class it {
|
|
|
1362
1462
|
}
|
|
1363
1463
|
}
|
|
1364
1464
|
}
|
|
1365
|
-
const
|
|
1366
|
-
class
|
|
1465
|
+
const ee = (a) => P.isTypeOf(a.payload, O);
|
|
1466
|
+
class ht extends C {
|
|
1367
1467
|
constructor() {
|
|
1368
1468
|
super(...arguments);
|
|
1369
1469
|
l(this, "contractType", "Timeline Channel");
|
|
1370
|
-
l(this, "contractBlueId",
|
|
1470
|
+
l(this, "contractBlueId", g["Timeline Channel"]);
|
|
1371
1471
|
}
|
|
1372
1472
|
supports(t, n, o) {
|
|
1373
1473
|
var u;
|
|
1374
|
-
if (!this.baseSupports(t) || !
|
|
1375
|
-
const
|
|
1474
|
+
if (!this.baseSupports(t) || !ee(t)) return !1;
|
|
1475
|
+
const s = o.getBlue().nodeToSchemaOutput(
|
|
1376
1476
|
t.payload,
|
|
1377
|
-
|
|
1378
|
-
),
|
|
1379
|
-
return
|
|
1477
|
+
O
|
|
1478
|
+
), i = o.getBlue().nodeToSchemaOutput(n, Ne), c = (u = s.timeline) == null ? void 0 : u.timelineId;
|
|
1479
|
+
return E(i.timelineId) && E(c) && c === i.timelineId;
|
|
1380
1480
|
}
|
|
1381
1481
|
handle(t, n, o, r) {
|
|
1382
|
-
|
|
1482
|
+
ee(t) && o.emitEvent({
|
|
1383
1483
|
payload: t.payload,
|
|
1384
1484
|
channelName: r,
|
|
1385
1485
|
source: "channel"
|
|
1386
1486
|
});
|
|
1387
1487
|
}
|
|
1388
1488
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1489
|
+
class pt extends C {
|
|
1490
|
+
constructor() {
|
|
1491
|
+
super(...arguments);
|
|
1492
|
+
l(this, "contractType", "Triggered Event Channel");
|
|
1493
|
+
l(this, "contractBlueId", g["Triggered Event Channel"]);
|
|
1494
|
+
}
|
|
1495
|
+
supports(t) {
|
|
1496
|
+
return this.baseSupports(t) ? t.emissionType === "triggered" : !1;
|
|
1497
|
+
}
|
|
1498
|
+
handle(t, n, o, r) {
|
|
1499
|
+
o.emitEvent({
|
|
1500
|
+
payload: t.payload,
|
|
1501
|
+
channelName: r,
|
|
1502
|
+
source: "channel"
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
const mt = [
|
|
1507
|
+
new nt(),
|
|
1391
1508
|
// channels
|
|
1392
|
-
new
|
|
1509
|
+
new Ge(),
|
|
1393
1510
|
new Qe(),
|
|
1394
|
-
new
|
|
1511
|
+
new ht(),
|
|
1395
1512
|
new Ze(),
|
|
1396
|
-
new Ge(),
|
|
1397
|
-
new He(),
|
|
1398
|
-
new Ye(),
|
|
1399
1513
|
new et(),
|
|
1514
|
+
new Xe(),
|
|
1515
|
+
new Ye(),
|
|
1516
|
+
new pt(),
|
|
1517
|
+
new tt(),
|
|
1400
1518
|
// sequential workflows
|
|
1401
|
-
new
|
|
1402
|
-
new
|
|
1519
|
+
new le(),
|
|
1520
|
+
new dt(),
|
|
1403
1521
|
// markers
|
|
1404
|
-
new
|
|
1522
|
+
new Ke()
|
|
1405
1523
|
];
|
|
1406
|
-
class
|
|
1524
|
+
class Tt {
|
|
1407
1525
|
/**
|
|
1408
1526
|
* Creates a new document processor
|
|
1409
1527
|
*
|
|
1410
1528
|
* @param processors - Initial list of processors to register
|
|
1411
1529
|
*/
|
|
1412
|
-
constructor(e, t =
|
|
1530
|
+
constructor(e, t = mt) {
|
|
1413
1531
|
l(this, "taskCounter", 0);
|
|
1414
1532
|
l(this, "eventCounter", 0);
|
|
1415
1533
|
l(this, "registry");
|
|
1416
1534
|
l(this, "queue");
|
|
1417
1535
|
l(this, "router");
|
|
1418
|
-
l(this, "checkpointCache", new
|
|
1419
|
-
this.blue = e, this.registry = new We(t), this.queue = new
|
|
1536
|
+
l(this, "checkpointCache", new Fe());
|
|
1537
|
+
this.blue = e, this.registry = new We(t), this.queue = new _e(), this.router = new Ue(
|
|
1420
1538
|
this.blue,
|
|
1421
1539
|
this.registry,
|
|
1422
1540
|
this.queue,
|
|
1423
1541
|
() => ++this.taskCounter,
|
|
1424
1542
|
() => ++this.eventCounter
|
|
1425
1543
|
), this.register(
|
|
1426
|
-
new
|
|
1544
|
+
new He(this.checkpointCache),
|
|
1427
1545
|
9999
|
|
1428
1546
|
);
|
|
1429
1547
|
}
|
|
@@ -1443,13 +1561,15 @@ class gt {
|
|
|
1443
1561
|
* @returns Processing result with final state and emitted events
|
|
1444
1562
|
*/
|
|
1445
1563
|
async initialize(e) {
|
|
1446
|
-
let t =
|
|
1564
|
+
let t = G(I(e), this.blue);
|
|
1447
1565
|
const n = {
|
|
1448
|
-
payload:
|
|
1566
|
+
payload: at(this.blue),
|
|
1567
|
+
source: "internal",
|
|
1568
|
+
emissionType: "lifecycle"
|
|
1449
1569
|
}, o = [n.payload];
|
|
1450
1570
|
await this.router.route(t, [], n, 0);
|
|
1451
1571
|
const r = await this.drainQueue(t);
|
|
1452
|
-
return t = r.state, o.push(...r.emitted), t =
|
|
1572
|
+
return t = r.state, o.push(...r.emitted), t = Re(t, this.blue), { state: $(t), emitted: o };
|
|
1453
1573
|
}
|
|
1454
1574
|
/**
|
|
1455
1575
|
* Processes a batch of events against the document
|
|
@@ -1459,83 +1579,83 @@ class gt {
|
|
|
1459
1579
|
* @returns Processing result with final state and emitted events
|
|
1460
1580
|
*/
|
|
1461
1581
|
async processEvents(e, t) {
|
|
1462
|
-
let n =
|
|
1582
|
+
let n = G(I(e), this.blue);
|
|
1463
1583
|
const o = [];
|
|
1464
|
-
if (!
|
|
1584
|
+
if (!ie(n, this.blue))
|
|
1465
1585
|
throw new Error("Document is not initialized");
|
|
1466
1586
|
for (const r of t)
|
|
1467
1587
|
try {
|
|
1468
|
-
const
|
|
1469
|
-
await this.router.route(n, [],
|
|
1470
|
-
const
|
|
1471
|
-
n =
|
|
1472
|
-
const
|
|
1473
|
-
|
|
1588
|
+
const s = { payload: r, source: "external" };
|
|
1589
|
+
await this.router.route(n, [], s, 0);
|
|
1590
|
+
const i = await this.drainQueue(n);
|
|
1591
|
+
n = i.state, o.push(...i.emitted);
|
|
1592
|
+
const c = this.checkpointCache.flush(n);
|
|
1593
|
+
c.length && (n = Q(n, c));
|
|
1474
1594
|
} finally {
|
|
1475
1595
|
this.checkpointCache.clear();
|
|
1476
1596
|
}
|
|
1477
|
-
return { state:
|
|
1597
|
+
return { state: $(n), emitted: o };
|
|
1478
1598
|
}
|
|
1479
1599
|
/**
|
|
1480
1600
|
* Drains the task queue and applies all actions
|
|
1481
1601
|
*/
|
|
1482
1602
|
async drainQueue(e) {
|
|
1483
|
-
var
|
|
1603
|
+
var s;
|
|
1484
1604
|
let t = e;
|
|
1485
1605
|
const n = [], o = 1e4;
|
|
1486
1606
|
let r = 0;
|
|
1487
1607
|
for (; this.queue.length; ) {
|
|
1488
1608
|
if (++r > o)
|
|
1489
1609
|
throw new Error("Possible cycle – too many iterations");
|
|
1490
|
-
const
|
|
1491
|
-
if (!
|
|
1610
|
+
const i = this.queue.pop(), { nodePath: c, contractName: d, contractNode: u, event: h } = i, p = t.get(c);
|
|
1611
|
+
if (!S(p) || !((s = p.getContracts()) != null && s[d]) || !u.getType()) continue;
|
|
1492
1612
|
const m = this.registry.get(u.getType());
|
|
1493
1613
|
if (!m) {
|
|
1494
|
-
console.warn(`No processor registered for contract: ${
|
|
1614
|
+
console.warn(`No processor registered for contract: ${d}`);
|
|
1495
1615
|
continue;
|
|
1496
1616
|
}
|
|
1497
|
-
const w = new
|
|
1617
|
+
const w = new re(
|
|
1498
1618
|
() => t,
|
|
1499
|
-
|
|
1619
|
+
i,
|
|
1500
1620
|
this.blue,
|
|
1501
|
-
async (
|
|
1502
|
-
for (const
|
|
1503
|
-
if (
|
|
1504
|
-
const
|
|
1621
|
+
async (v) => {
|
|
1622
|
+
for (const f of v)
|
|
1623
|
+
if (f.kind === "patch") {
|
|
1624
|
+
const D = z(
|
|
1505
1625
|
t,
|
|
1506
1626
|
this.blue
|
|
1507
1627
|
);
|
|
1508
|
-
for (const
|
|
1509
|
-
const
|
|
1510
|
-
(
|
|
1511
|
-
), pe =
|
|
1512
|
-
|
|
1513
|
-
|
|
1628
|
+
for (const N of D) {
|
|
1629
|
+
const de = f.patch.op === "move" || f.patch.op === "copy" ? [f.patch.from, f.patch.path] : [f.patch.path], H = w.getNodePath(), he = de.some(
|
|
1630
|
+
(me) => X(me, N.absPath)
|
|
1631
|
+
), pe = X(
|
|
1632
|
+
H,
|
|
1633
|
+
N.absPath
|
|
1514
1634
|
);
|
|
1515
|
-
if (
|
|
1635
|
+
if (he && !pe)
|
|
1516
1636
|
throw new ae(
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1637
|
+
f.patch,
|
|
1638
|
+
N.absPath,
|
|
1639
|
+
H
|
|
1520
1640
|
);
|
|
1521
1641
|
}
|
|
1522
1642
|
try {
|
|
1523
|
-
t =
|
|
1524
|
-
} catch (
|
|
1525
|
-
throw
|
|
1643
|
+
t = Q(t, [f.patch]);
|
|
1644
|
+
} catch (N) {
|
|
1645
|
+
throw ze(d, h, N), N;
|
|
1526
1646
|
}
|
|
1527
|
-
} else
|
|
1647
|
+
} else f.kind === "event" && (n.push(f.event.payload), await this.router.route(t, [], f.event, i.key[5]));
|
|
1528
1648
|
}
|
|
1529
1649
|
);
|
|
1530
|
-
await m.handle(
|
|
1650
|
+
await m.handle(h, u, w, d), await w.flush();
|
|
1531
1651
|
}
|
|
1532
1652
|
return { state: t, emitted: n };
|
|
1533
1653
|
}
|
|
1534
1654
|
}
|
|
1535
|
-
class
|
|
1655
|
+
class ue {
|
|
1536
1656
|
process(e, t) {
|
|
1537
1657
|
const n = t.getValue();
|
|
1538
|
-
if (
|
|
1658
|
+
if (T(n)) {
|
|
1539
1659
|
const o = t.clone();
|
|
1540
1660
|
return o.setValue(n), o.setProperties(void 0), o.setItems(void 0), o.setType(void 0), o;
|
|
1541
1661
|
}
|
|
@@ -1546,21 +1666,21 @@ class le {
|
|
|
1546
1666
|
*/
|
|
1547
1667
|
postProcess(e, t) {
|
|
1548
1668
|
const n = t.getValue();
|
|
1549
|
-
if (
|
|
1669
|
+
if (T(n) && e.getValue() !== n && n !== void 0) {
|
|
1550
1670
|
const o = e.clone();
|
|
1551
1671
|
return o.setValue(n), o;
|
|
1552
1672
|
}
|
|
1553
1673
|
return e;
|
|
1554
1674
|
}
|
|
1555
1675
|
}
|
|
1556
|
-
const
|
|
1676
|
+
const bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1557
1677
|
__proto__: null,
|
|
1558
|
-
ExpressionPreserver:
|
|
1678
|
+
ExpressionPreserver: ue
|
|
1559
1679
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1560
|
-
function
|
|
1680
|
+
function Pt() {
|
|
1561
1681
|
return new k.SequentialMergingProcessor([
|
|
1562
1682
|
new k.ValuePropagator(),
|
|
1563
|
-
new
|
|
1683
|
+
new ue(),
|
|
1564
1684
|
new k.TypeAssigner(),
|
|
1565
1685
|
new k.ListProcessor(),
|
|
1566
1686
|
new k.DictionaryProcessor(),
|
|
@@ -1568,25 +1688,26 @@ function wt() {
|
|
|
1568
1688
|
]);
|
|
1569
1689
|
}
|
|
1570
1690
|
export {
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1691
|
+
Tt as BlueDocumentProcessor,
|
|
1692
|
+
He as ChannelEventCheckpointProcessor,
|
|
1693
|
+
De as CodeBlockEvaluationError,
|
|
1694
|
+
Xe as CompositeTimelineChannelProcessor,
|
|
1575
1695
|
Qe as DocumentUpdateChannelProcessor,
|
|
1576
1696
|
ae as EmbeddedDocumentModificationError,
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1697
|
+
Ge as EmbeddedNodeChannelProcessor,
|
|
1698
|
+
Ae as ExpressionEvaluationError,
|
|
1699
|
+
Ke as InitializedMarkerProcessor,
|
|
1580
1700
|
Ye as LifecycleEventChannelProcessor,
|
|
1581
|
-
|
|
1582
|
-
|
|
1701
|
+
bt as MergingProcessors,
|
|
1702
|
+
et as MyOSAgentChannelProcessor,
|
|
1583
1703
|
Ze as MyOSTimelineChannelProcessor,
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1704
|
+
tt as OperationProcessor,
|
|
1705
|
+
se as PatchApplicationError,
|
|
1706
|
+
nt as ProcessEmbeddedProcessor,
|
|
1707
|
+
dt as SequentialWorkflowOperationProcessor,
|
|
1708
|
+
le as SequentialWorkflowProcessor,
|
|
1709
|
+
ht as TimelineChannelProcessor,
|
|
1710
|
+
pt as TriggeredEventChannelProcessor,
|
|
1711
|
+
z as collectEmbeddedPathSpecs,
|
|
1712
|
+
Pt as createDefaultMergingProcessor
|
|
1592
1713
|
};
|