@milaboratories/pl-middle-layer 1.14.25 → 1.14.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1389 -1254
- package/dist/index.mjs.map +1 -1
- package/dist/network_check.d.ts +14 -0
- package/dist/network_check.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/index.ts +2 -0
- package/src/network_check.test.ts +15 -0
- package/src/network_check.ts +236 -0
package/dist/index.mjs
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (
|
|
4
|
-
import { executePSpecPredicate as
|
|
1
|
+
var zt = Object.defineProperty;
|
|
2
|
+
var Yt = (o, e, t) => e in o ? zt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var d = (o, e, t) => Yt(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { executePSpecPredicate as qt, mapPObjectData as Z, mapValueInVOE as Qt, mapPTableDef as ht, isFunctionHandle as ft, normalizeBlockConfig as Ie, DefaultNavigationState as Zt } from "@platforma-sdk/model";
|
|
5
5
|
export * from "@platforma-sdk/model";
|
|
6
|
-
import { blockPackIdEquals as
|
|
6
|
+
import { blockPackIdEquals as ve } from "@milaboratories/pl-model-middle-layer";
|
|
7
7
|
export * from "@milaboratories/pl-model-middle-layer";
|
|
8
|
-
import { request as
|
|
9
|
-
import { RegistryV1 as _, tryLoadPackDescription as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { assertNever as D, notEmpty as w, ConsoleLoggerAdapter as
|
|
14
|
-
import * as
|
|
15
|
-
import { tryResolve as
|
|
16
|
-
import { resourceTypesEqual as
|
|
8
|
+
import { request as M, RetryAgent as Xt } from "undici";
|
|
9
|
+
import { RegistryV1 as _, tryLoadPackDescription as mt, BlockPackMetaEmbedAbsoluteBytes as er, RegistryV2Reader as tr, folderReaderByUrl as rr, loadPackDescription as qe } from "@platforma-sdk/block-tools";
|
|
10
|
+
import A from "node:fs";
|
|
11
|
+
import T from "node:path";
|
|
12
|
+
import sr from "yaml";
|
|
13
|
+
import { assertNever as D, notEmpty as w, ConsoleLoggerAdapter as or, ConcurrencyLimitingExecutor as nr, HmacSha256Signer as vt } from "@milaboratories/ts-helpers";
|
|
14
|
+
import * as yt from "node:fs/promises";
|
|
15
|
+
import { tryResolve as ir } from "@milaboratories/resolve-helper";
|
|
16
|
+
import { resourceTypesEqual as $, field as S, Pl as b, PlClient as ar, isNullResourceId as ue, ensureResourceIdNotNull as Pe, isResource as cr, isResourceRef as ur, isNotNullResourceId as Qe, resourceType as se, resourceTypeToString as lr, resourceIdToString as bt, isNotFoundError as dr, isTimeoutOrCancelError as pr, toGlobalResourceId as gr, plAddressToConfig as hr, UnauthenticatedPlClient as Ze } from "@milaboratories/pl-client";
|
|
17
17
|
export * from "@milaboratories/pl-client";
|
|
18
|
-
import { SynchronizedTreeState as
|
|
19
|
-
import { Computable as F, ChangeSource as
|
|
20
|
-
import { randomUUID as
|
|
21
|
-
import
|
|
22
|
-
import { Templates as
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import { Scope as
|
|
26
|
-
import { setTimeout as
|
|
27
|
-
import { createDownloadClient as
|
|
28
|
-
import { PFrame as
|
|
29
|
-
import { LRUCache as
|
|
30
|
-
async function
|
|
18
|
+
import { SynchronizedTreeState as wt, PlError as fr } from "@milaboratories/pl-tree";
|
|
19
|
+
import { Computable as F, ChangeSource as Xe, PollComputablePool as mr, WatchableValue as vr } from "@milaboratories/computable";
|
|
20
|
+
import { randomUUID as ee, createHash as he } from "node:crypto";
|
|
21
|
+
import St from "denque";
|
|
22
|
+
import { Templates as yr } from "@platforma-sdk/workflow-tengo";
|
|
23
|
+
import Ve from "canonicalize";
|
|
24
|
+
import br from "node:assert";
|
|
25
|
+
import { Scope as Fe, getQuickJS as wr } from "quickjs-emscripten";
|
|
26
|
+
import { setTimeout as kt } from "node:timers/promises";
|
|
27
|
+
import { createDownloadClient as Sr, createLogsClient as kr, createUploadBlobClient as Cr, createUploadProgressClient as Pr, DownloadDriver as Fr, UploadDriver as Rr, LogsStreamDriver as Br, LogsDriver as Or, LsDriver as Dr, DownloadUrlDriver as xr } from "@milaboratories/pl-drivers";
|
|
28
|
+
import { PFrame as jr } from "@milaboratories/pframes-node";
|
|
29
|
+
import { LRUCache as Tr } from "lru-cache";
|
|
30
|
+
async function et(o) {
|
|
31
31
|
try {
|
|
32
|
-
return await
|
|
32
|
+
return await yt.stat(o, { bigint: !0 });
|
|
33
33
|
} catch (e) {
|
|
34
34
|
if (e.code === "ENOENT")
|
|
35
35
|
return;
|
|
36
36
|
throw e;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
const Er = [_.PlPackageYamlConfigFile], Ar = [_.PlPackageJsonConfigFile], Ne = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Le = ["config", "dist", "config.json"], Ct = ["frontend", "dist"], tt = "block-model/dist/config.json", Ir = "block-ui/package.json", Vr = [
|
|
40
|
+
Ne,
|
|
41
|
+
Le,
|
|
42
|
+
Er,
|
|
43
|
+
Ar,
|
|
44
|
+
Ct
|
|
45
45
|
];
|
|
46
|
-
async function
|
|
47
|
-
return await
|
|
46
|
+
async function Nr(o) {
|
|
47
|
+
return await et(T.join(o, ...Le)) !== void 0 || await et(T.join(o, ...Ne)) !== void 0;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const t =
|
|
51
|
-
if (t === void 0) throw new Error(`Can't resolve ${e} against ${
|
|
49
|
+
function ye(o, e) {
|
|
50
|
+
const t = ir(o, e);
|
|
51
|
+
if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
|
|
52
52
|
return t;
|
|
53
53
|
}
|
|
54
|
-
async function
|
|
55
|
-
if (
|
|
54
|
+
async function rt(o, e) {
|
|
55
|
+
if (T.isAbsolute(o) || (o = T.resolve(o)), await Nr(o))
|
|
56
56
|
return {
|
|
57
|
-
workflow:
|
|
58
|
-
config:
|
|
59
|
-
ui:
|
|
57
|
+
workflow: T.join(o, ...Ne),
|
|
58
|
+
config: T.join(o, ...Le),
|
|
59
|
+
ui: T.join(o, ...Ct)
|
|
60
60
|
};
|
|
61
61
|
{
|
|
62
|
-
const t =
|
|
63
|
-
return { workflow: t, config: r, ui:
|
|
62
|
+
const t = ye(o, tt), r = ye(o, tt), s = ye(o, Ir);
|
|
63
|
+
return { workflow: t, config: r, ui: T.resolve(s, "..", "dist") };
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
async function
|
|
66
|
+
async function Lr(o) {
|
|
67
67
|
try {
|
|
68
|
-
return await
|
|
68
|
+
return await A.promises.readFile(o, "utf8");
|
|
69
69
|
} catch (e) {
|
|
70
70
|
if (e.code === "ENOENT")
|
|
71
71
|
return;
|
|
72
72
|
throw e;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
async function
|
|
75
|
+
async function Jr(o) {
|
|
76
76
|
try {
|
|
77
|
-
return await
|
|
77
|
+
return await A.promises.stat(o, { bigint: !0 });
|
|
78
78
|
} catch (e) {
|
|
79
79
|
if (e.code === "ENOENT")
|
|
80
80
|
return;
|
|
81
81
|
throw e;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
async function
|
|
84
|
+
async function Pt(o) {
|
|
85
85
|
let e = 0n;
|
|
86
|
-
for (const t of
|
|
87
|
-
const r =
|
|
88
|
-
|
|
86
|
+
for (const t of Vr) {
|
|
87
|
+
const r = T.join(o, ...t), s = await Jr(r);
|
|
88
|
+
s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
|
|
89
89
|
}
|
|
90
90
|
return e.toString();
|
|
91
91
|
}
|
|
92
|
-
async function
|
|
93
|
-
const e = await
|
|
92
|
+
async function Je(o) {
|
|
93
|
+
const e = await A.promises.stat(o.components.workflow.main.file, {
|
|
94
94
|
bigint: !0
|
|
95
|
-
}), t = await
|
|
95
|
+
}), t = await A.promises.stat(o.components.model.file, { bigint: !0 });
|
|
96
96
|
return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class dn {
|
|
99
99
|
constructor(e, t, r) {
|
|
100
100
|
this.v2Provider = e, this.registries = t, this.http = r;
|
|
101
101
|
}
|
|
@@ -103,19 +103,19 @@ class oi {
|
|
|
103
103
|
const t = [], r = e.spec;
|
|
104
104
|
switch (r.type) {
|
|
105
105
|
case "remote-v1":
|
|
106
|
-
const
|
|
106
|
+
const s = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await M(
|
|
107
107
|
`${r.url}/${_.GlobalOverviewPath}`,
|
|
108
|
-
|
|
108
|
+
s
|
|
109
109
|
)).body.json();
|
|
110
|
-
for (const a of
|
|
111
|
-
const { organization: c, package: u, latestMeta: l, latestVersion: p } = a,
|
|
110
|
+
for (const a of i) {
|
|
111
|
+
const { organization: c, package: u, latestMeta: l, latestVersion: p } = a, g = {
|
|
112
112
|
organization: c,
|
|
113
113
|
name: u,
|
|
114
114
|
version: p
|
|
115
115
|
};
|
|
116
116
|
t.push({
|
|
117
117
|
registryId: e.id,
|
|
118
|
-
id:
|
|
118
|
+
id: g,
|
|
119
119
|
meta: {
|
|
120
120
|
title: l.title ?? "No title",
|
|
121
121
|
description: l.description ?? "No Description",
|
|
@@ -126,7 +126,7 @@ class oi {
|
|
|
126
126
|
},
|
|
127
127
|
spec: {
|
|
128
128
|
type: "from-registry-v1",
|
|
129
|
-
id:
|
|
129
|
+
id: g,
|
|
130
130
|
registryUrl: r.url
|
|
131
131
|
},
|
|
132
132
|
otherVersions: a.allVersions
|
|
@@ -139,20 +139,20 @@ class oi {
|
|
|
139
139
|
registryId: e.id
|
|
140
140
|
}));
|
|
141
141
|
case "local-dev":
|
|
142
|
-
for (const a of await
|
|
142
|
+
for (const a of await A.promises.readdir(r.path, { withFileTypes: !0 })) {
|
|
143
143
|
if (!a.isDirectory()) continue;
|
|
144
|
-
const c =
|
|
145
|
-
|
|
144
|
+
const c = T.join(r.path, a.name), u = await Lr(
|
|
145
|
+
T.join(c, _.PlPackageYamlConfigFile)
|
|
146
146
|
);
|
|
147
147
|
if (u !== void 0) {
|
|
148
|
-
const l = _.PlPackageConfigData.parse(
|
|
148
|
+
const l = _.PlPackageConfigData.parse(sr.parse(u)), p = await Pt(c), g = {
|
|
149
149
|
organization: l.organization,
|
|
150
150
|
name: l.package,
|
|
151
151
|
version: "DEV"
|
|
152
152
|
};
|
|
153
153
|
t.push({
|
|
154
154
|
registryId: e.id,
|
|
155
|
-
id:
|
|
155
|
+
id: g,
|
|
156
156
|
meta: {
|
|
157
157
|
title: l.meta.title ?? "No title",
|
|
158
158
|
description: l.meta.description ?? "No Description",
|
|
@@ -169,13 +169,13 @@ class oi {
|
|
|
169
169
|
otherVersions: []
|
|
170
170
|
});
|
|
171
171
|
} else {
|
|
172
|
-
const l = await
|
|
172
|
+
const l = await mt(c);
|
|
173
173
|
if (l !== void 0) {
|
|
174
|
-
const p = await
|
|
174
|
+
const p = await Je(l);
|
|
175
175
|
t.push({
|
|
176
176
|
registryId: e.id,
|
|
177
177
|
id: l.id,
|
|
178
|
-
meta: await
|
|
178
|
+
meta: await er.parseAsync(l.meta),
|
|
179
179
|
spec: {
|
|
180
180
|
type: "dev-v2",
|
|
181
181
|
folder: c,
|
|
@@ -198,7 +198,7 @@ class oi {
|
|
|
198
198
|
return { registries: t, blockPacks: e };
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
class
|
|
201
|
+
class Mr {
|
|
202
202
|
constructor(e) {
|
|
203
203
|
d(this, "registries", /* @__PURE__ */ new Map());
|
|
204
204
|
this.http = e;
|
|
@@ -206,164 +206,164 @@ class Tr {
|
|
|
206
206
|
getRegistry(e) {
|
|
207
207
|
const t = this.registries.get(e);
|
|
208
208
|
if (t) return t;
|
|
209
|
-
const r = new
|
|
209
|
+
const r = new tr(rr(e, this.http));
|
|
210
210
|
return this.registries.set(e, r), r;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const pn = {
|
|
214
214
|
type: "remote-v2",
|
|
215
215
|
url: "https://blocks.pl-open.science/"
|
|
216
|
-
},
|
|
216
|
+
}, gn = {
|
|
217
217
|
type: "remote-v1",
|
|
218
218
|
url: "https://block.registry.platforma.bio/releases"
|
|
219
|
-
},
|
|
219
|
+
}, hn = {
|
|
220
220
|
type: "remote-v1",
|
|
221
221
|
url: "https://block.registry.platforma.bio/dev"
|
|
222
|
-
},
|
|
222
|
+
}, Ur = {
|
|
223
223
|
groups: [{ id: "default", label: "Default", blocks: [] }]
|
|
224
|
-
},
|
|
224
|
+
}, Kr = {
|
|
225
225
|
stagingRefreshTimestamp: 0,
|
|
226
226
|
blocksInLimbo: []
|
|
227
|
-
},
|
|
227
|
+
}, $r = {
|
|
228
228
|
label: "New Project"
|
|
229
|
-
},
|
|
230
|
-
function
|
|
231
|
-
return `${
|
|
229
|
+
}, Gr = { name: "UserProject", version: "2" }, Ft = "SchemaVersion", Rt = "1", Me = "ProjectCreated", te = "ProjectLastModified", re = "ProjectMeta", W = "ProjectStructure", le = "BlockRenderingState", Hr = "BlockFrontendState/", _r = /^BlockFrontendState\/(?<blockid>.*)$/;
|
|
230
|
+
function Re(o) {
|
|
231
|
+
return `${Hr}${o}`;
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
235
|
-
return `${
|
|
233
|
+
const Wr = "BlockArgsAuthor/";
|
|
234
|
+
function Be(o) {
|
|
235
|
+
return `${Wr}${o}`;
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
239
|
-
const e =
|
|
237
|
+
const Oe = "ProjectStructureAuthor";
|
|
238
|
+
function zr(o) {
|
|
239
|
+
const e = o.match(_r);
|
|
240
240
|
if (e !== null)
|
|
241
241
|
return e.groups.blockid;
|
|
242
242
|
}
|
|
243
|
-
const
|
|
244
|
-
function
|
|
245
|
-
return `${
|
|
243
|
+
const Yr = "__serviceTemplate_";
|
|
244
|
+
function De(o) {
|
|
245
|
+
return `${Yr}${o}`;
|
|
246
246
|
}
|
|
247
|
-
function P(
|
|
248
|
-
return `${
|
|
247
|
+
function P(o, e) {
|
|
248
|
+
return `${o}-${e}`;
|
|
249
249
|
}
|
|
250
|
-
const
|
|
251
|
-
function
|
|
252
|
-
const e =
|
|
250
|
+
const qr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
|
|
251
|
+
function Qr(o) {
|
|
252
|
+
const e = o.match(qr);
|
|
253
253
|
if (e === null) return;
|
|
254
254
|
const { blockId: t, fieldName: r } = e.groups;
|
|
255
255
|
return { blockId: t, fieldName: r };
|
|
256
256
|
}
|
|
257
|
-
const
|
|
258
|
-
async function
|
|
259
|
-
const
|
|
260
|
-
|
|
257
|
+
const Zr = "projects", Bt = { name: "Projects", version: "1" }, Xr = (o) => $(o.type, Bt) ? o.fields : [];
|
|
258
|
+
async function es(o, e, t, r) {
|
|
259
|
+
const s = await wt.init(
|
|
260
|
+
o,
|
|
261
261
|
e,
|
|
262
262
|
{
|
|
263
263
|
...r.ops.defaultTreeOptions,
|
|
264
|
-
pruning:
|
|
264
|
+
pruning: Xr
|
|
265
265
|
},
|
|
266
266
|
r.logger
|
|
267
267
|
);
|
|
268
|
-
return { computable: F.make((
|
|
269
|
-
const a =
|
|
268
|
+
return { computable: F.make((i) => {
|
|
269
|
+
const a = i.accessor(s.entry()).node(), c = t.getValue(i);
|
|
270
270
|
if (a === void 0) return;
|
|
271
271
|
const u = [];
|
|
272
272
|
for (const l of a.listDynamicFields()) {
|
|
273
273
|
const p = a.traverse(l);
|
|
274
274
|
if (p === void 0) continue;
|
|
275
|
-
const
|
|
275
|
+
const g = w(p.getKeyValueAsJson(re)), m = w(p.getKeyValueAsJson(Me)), h = w(p.getKeyValueAsJson(te));
|
|
276
276
|
u.push({
|
|
277
277
|
id: l,
|
|
278
278
|
rid: p.id,
|
|
279
|
-
created: new Date(
|
|
280
|
-
lastModified: new Date(
|
|
279
|
+
created: new Date(m),
|
|
280
|
+
lastModified: new Date(h),
|
|
281
281
|
opened: c.indexOf(p.id) >= 0,
|
|
282
|
-
meta:
|
|
282
|
+
meta: g
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
return u.sort((l) => -l.lastModified.valueOf()), u;
|
|
286
|
-
}).withStableType(), tree:
|
|
286
|
+
}).withStableType(), tree: s };
|
|
287
287
|
}
|
|
288
|
-
const
|
|
288
|
+
const ts = {
|
|
289
289
|
name: "EphRenderTemplate",
|
|
290
290
|
version: "1"
|
|
291
|
-
},
|
|
291
|
+
}, rs = {
|
|
292
292
|
name: "RenderTemplate",
|
|
293
293
|
version: "1"
|
|
294
294
|
};
|
|
295
|
-
function
|
|
296
|
-
if (
|
|
297
|
-
const
|
|
298
|
-
return
|
|
295
|
+
function Ot(o, e, t, r, s) {
|
|
296
|
+
if (s.length === 0) throw new Error("Zero output names provided");
|
|
297
|
+
const n = t ? o.createEphemeral(ts) : o.createStruct(rs), i = S(n, "template"), a = S(n, "inputs");
|
|
298
|
+
return o.createField(i, "Input", e), o.createField(a, "Input", b.createPlMap(o, r, t)), o.lockInputs(n), b.futureRecord(o, n, s, "Output", "outputs/");
|
|
299
299
|
}
|
|
300
|
-
const
|
|
301
|
-
function
|
|
302
|
-
return
|
|
300
|
+
const ss = { name: "BContextEnd", version: "1" }, os = { name: "BContext", version: "1" }, ns = "id", is = "parent/", as = ["context", "result"];
|
|
301
|
+
function st(o, e, t) {
|
|
302
|
+
return Ot(o, e, !0, t, as);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
const e =
|
|
306
|
-
return
|
|
304
|
+
function cs(o) {
|
|
305
|
+
const e = o.createEphemeral(ss);
|
|
306
|
+
return o.lock(e), e;
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
if (e.length === 0) return
|
|
308
|
+
function us(o, e) {
|
|
309
|
+
if (e.length === 0) return cs(o);
|
|
310
310
|
if (e.length === 1) return e[0];
|
|
311
|
-
const t =
|
|
312
|
-
|
|
311
|
+
const t = o.createEphemeral(os);
|
|
312
|
+
o.createField(S(t, ns), "Input", b.createPlString(o, ee()));
|
|
313
313
|
for (let r = 0; r < e.length; r++)
|
|
314
|
-
|
|
315
|
-
return
|
|
314
|
+
o.createField(S(t, `${is}${r}`), "Input", e[r]);
|
|
315
|
+
return o.lock(t), t;
|
|
316
316
|
}
|
|
317
|
-
const
|
|
317
|
+
const ls = { name: "TengoTemplateGet", version: "1" }, ds = "registry", ps = "templateURI", gs = "template", hs = { name: "TengoTemplatePack", version: "1" }, fs = {
|
|
318
318
|
name: "TengoTemplatePackConvert",
|
|
319
319
|
version: "1"
|
|
320
|
-
},
|
|
321
|
-
async function
|
|
322
|
-
switch (
|
|
320
|
+
}, ms = "templatePack", vs = "template";
|
|
321
|
+
async function ys(o) {
|
|
322
|
+
switch (o.type) {
|
|
323
323
|
case "from-file":
|
|
324
324
|
return {
|
|
325
325
|
type: "explicit",
|
|
326
|
-
content: await
|
|
326
|
+
content: await A.promises.readFile(o.path)
|
|
327
327
|
};
|
|
328
328
|
case "from-registry":
|
|
329
329
|
case "explicit":
|
|
330
|
-
return
|
|
330
|
+
return o;
|
|
331
331
|
default:
|
|
332
|
-
return D(
|
|
332
|
+
return D(o);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
const t =
|
|
337
|
-
return
|
|
335
|
+
function bs(o, e) {
|
|
336
|
+
const t = o.createStruct(ls), r = S(t, ds), s = S(t, ps), n = S(t, gs);
|
|
337
|
+
return o.setField(r, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.registry)))), o.setField(s, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.path)))), n;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
const t =
|
|
341
|
-
return
|
|
339
|
+
function ws(o, e) {
|
|
340
|
+
const t = o.createValue(hs, e.content), r = o.createStruct(fs), s = S(r, ms), n = S(r, vs);
|
|
341
|
+
return o.setField(s, t), n;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Ue(o, e) {
|
|
344
344
|
switch (e.type) {
|
|
345
345
|
case "from-registry":
|
|
346
|
-
return
|
|
346
|
+
return bs(o, e);
|
|
347
347
|
case "explicit":
|
|
348
|
-
return
|
|
348
|
+
return ws(o, e);
|
|
349
349
|
default:
|
|
350
350
|
return D(e);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
const
|
|
353
|
+
const Dt = { name: "Frontend/FromUrl", version: "1" }, xt = {
|
|
354
354
|
name: "Frontend/FromFolder",
|
|
355
355
|
version: "1"
|
|
356
356
|
};
|
|
357
|
-
function
|
|
357
|
+
function Ss(o, e) {
|
|
358
358
|
switch (e.type) {
|
|
359
359
|
case "url":
|
|
360
|
-
return
|
|
361
|
-
|
|
360
|
+
return o.createValue(
|
|
361
|
+
Dt,
|
|
362
362
|
JSON.stringify({ url: e.url })
|
|
363
363
|
);
|
|
364
364
|
case "local":
|
|
365
|
-
return
|
|
366
|
-
|
|
365
|
+
return o.createValue(
|
|
366
|
+
xt,
|
|
367
367
|
JSON.stringify({
|
|
368
368
|
path: e.path,
|
|
369
369
|
signature: e.signature
|
|
@@ -373,11 +373,11 @@ function mo(s, e) {
|
|
|
373
373
|
return D(e);
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
function
|
|
378
|
-
return
|
|
376
|
+
const ks = { name: "BlockPackCustom", version: "1" }, jt = "template", Tt = "frontend";
|
|
377
|
+
function ot(o) {
|
|
378
|
+
return o.endsWith("/") ? o : `${o}/`;
|
|
379
379
|
}
|
|
380
|
-
class
|
|
380
|
+
class Cs {
|
|
381
381
|
constructor(e, t, r) {
|
|
382
382
|
this.v2RegistryProvider = e, this.signer = t, this.http = r;
|
|
383
383
|
}
|
|
@@ -386,22 +386,22 @@ class yo {
|
|
|
386
386
|
case "explicit":
|
|
387
387
|
return e.config;
|
|
388
388
|
case "dev-v1": {
|
|
389
|
-
const t = await
|
|
389
|
+
const t = await rt(e.folder), r = await A.promises.readFile(t.config, { encoding: "utf-8" });
|
|
390
390
|
return JSON.parse(r);
|
|
391
391
|
}
|
|
392
392
|
case "dev-v2": {
|
|
393
|
-
const t = await
|
|
393
|
+
const t = await qe(e.folder), r = await A.promises.readFile(t.components.model.file, {
|
|
394
394
|
encoding: "utf-8"
|
|
395
395
|
});
|
|
396
396
|
return JSON.parse(r);
|
|
397
397
|
}
|
|
398
398
|
case "from-registry-v1": {
|
|
399
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${
|
|
400
|
-
return await (await
|
|
399
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${ot(e.registryUrl)}${_.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
|
|
400
|
+
return await (await M(`${r}/config.json`, t)).body.json();
|
|
401
401
|
}
|
|
402
402
|
case "from-registry-v2": {
|
|
403
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {},
|
|
404
|
-
return await (await
|
|
403
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
|
|
404
|
+
return await (await M(s.model.url, t)).body.json();
|
|
405
405
|
}
|
|
406
406
|
default:
|
|
407
407
|
return D(e);
|
|
@@ -412,59 +412,59 @@ class yo {
|
|
|
412
412
|
case "explicit":
|
|
413
413
|
return e;
|
|
414
414
|
case "dev-v1": {
|
|
415
|
-
const t = await
|
|
416
|
-
await
|
|
417
|
-
),
|
|
415
|
+
const t = await rt(e.folder), r = await A.promises.readFile(t.workflow), s = JSON.parse(
|
|
416
|
+
await A.promises.readFile(t.config, "utf-8")
|
|
417
|
+
), n = t.ui;
|
|
418
418
|
return {
|
|
419
419
|
type: "explicit",
|
|
420
420
|
template: {
|
|
421
421
|
type: "explicit",
|
|
422
422
|
content: r
|
|
423
423
|
},
|
|
424
|
-
config:
|
|
424
|
+
config: s,
|
|
425
425
|
frontend: {
|
|
426
426
|
type: "local",
|
|
427
|
-
path:
|
|
428
|
-
signature: this.signer.sign(
|
|
427
|
+
path: n,
|
|
428
|
+
signature: this.signer.sign(n)
|
|
429
429
|
},
|
|
430
430
|
source: e
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
433
|
case "dev-v2": {
|
|
434
|
-
const t = await
|
|
435
|
-
await
|
|
434
|
+
const t = await qe(e.folder), r = JSON.parse(
|
|
435
|
+
await A.promises.readFile(t.components.model.file, {
|
|
436
436
|
encoding: "utf-8"
|
|
437
437
|
})
|
|
438
|
-
),
|
|
438
|
+
), s = await A.promises.readFile(
|
|
439
439
|
t.components.workflow.main.file
|
|
440
|
-
),
|
|
441
|
-
return e.mtime === void 0 && (
|
|
440
|
+
), n = t.components.ui.folder, i = { ...e };
|
|
441
|
+
return e.mtime === void 0 && (i.mtime = await Je(t)), {
|
|
442
442
|
type: "explicit",
|
|
443
443
|
template: {
|
|
444
444
|
type: "explicit",
|
|
445
|
-
content:
|
|
445
|
+
content: s
|
|
446
446
|
},
|
|
447
447
|
config: r,
|
|
448
448
|
frontend: {
|
|
449
449
|
type: "local",
|
|
450
|
-
path:
|
|
451
|
-
signature: this.signer.sign(
|
|
450
|
+
path: n,
|
|
451
|
+
signature: this.signer.sign(n)
|
|
452
452
|
},
|
|
453
|
-
source:
|
|
453
|
+
source: i
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
456
|
case "from-registry-v1": {
|
|
457
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${
|
|
458
|
-
if (
|
|
457
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${ot(e.registryUrl)}${_.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, n = await M(s, t);
|
|
458
|
+
if (n.statusCode !== 200)
|
|
459
459
|
throw new Error(
|
|
460
|
-
`Block not found in registry (url = ${
|
|
460
|
+
`Block not found in registry (url = ${s} ; code = ${n.statusCode}): ` + JSON.stringify(e)
|
|
461
461
|
);
|
|
462
|
-
const
|
|
462
|
+
const i = new Uint8Array(await n.body.arrayBuffer()), c = await (await M(`${r}/config.json`, t)).body.json();
|
|
463
463
|
return {
|
|
464
464
|
type: "explicit",
|
|
465
465
|
template: {
|
|
466
466
|
type: "explicit",
|
|
467
|
-
content:
|
|
467
|
+
content: i
|
|
468
468
|
},
|
|
469
469
|
config: c,
|
|
470
470
|
frontend: {
|
|
@@ -475,7 +475,7 @@ class yo {
|
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
case "from-registry-v2": {
|
|
478
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {},
|
|
478
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await M(s.model.url, t)).body.json(), i = async () => await (await M(s.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([n(), i()]);
|
|
479
479
|
return {
|
|
480
480
|
type: "explicit",
|
|
481
481
|
template: {
|
|
@@ -485,7 +485,7 @@ class yo {
|
|
|
485
485
|
config: a,
|
|
486
486
|
frontend: {
|
|
487
487
|
type: "url",
|
|
488
|
-
url:
|
|
488
|
+
url: s.ui.url
|
|
489
489
|
},
|
|
490
490
|
source: e
|
|
491
491
|
};
|
|
@@ -495,25 +495,25 @@ class yo {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
const t = { config: e.config, source: e.source }, r =
|
|
500
|
-
return
|
|
498
|
+
function Ps(o, e) {
|
|
499
|
+
const t = { config: e.config, source: e.source }, r = o.createStruct(ks, JSON.stringify(t));
|
|
500
|
+
return o.createField(S(r, jt), "Input", Ue(o, e.template)), o.createField(S(r, Tt), "Input", Ss(o, e.frontend)), o.lock(r), r;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function nt(o, e) {
|
|
503
503
|
switch (e.type) {
|
|
504
504
|
case "explicit":
|
|
505
|
-
return
|
|
505
|
+
return Ps(o, e);
|
|
506
506
|
default:
|
|
507
507
|
return D(e.type);
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
function ie(
|
|
511
|
-
return { __isRef: !0, blockId:
|
|
510
|
+
function ie(o, e) {
|
|
511
|
+
return { __isRef: !0, blockId: o, name: e };
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
return typeof
|
|
513
|
+
function Fs(o) {
|
|
514
|
+
return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function xe(o, e, t) {
|
|
517
517
|
const r = typeof e;
|
|
518
518
|
switch (r) {
|
|
519
519
|
case "function":
|
|
@@ -526,30 +526,30 @@ function Re(s, e, t) {
|
|
|
526
526
|
return;
|
|
527
527
|
case "object":
|
|
528
528
|
if (e === null) return;
|
|
529
|
-
if (
|
|
530
|
-
t === void 0 || t.has(e.blockId) ?
|
|
529
|
+
if (Fs(e))
|
|
530
|
+
t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
|
|
531
531
|
else if (Array.isArray(e))
|
|
532
|
-
for (const
|
|
532
|
+
for (const s of e) xe(o, s, t);
|
|
533
533
|
else
|
|
534
|
-
for (const [,
|
|
535
|
-
|
|
534
|
+
for (const [, s] of Object.entries(e))
|
|
535
|
+
xe(o, s, t);
|
|
536
536
|
return;
|
|
537
537
|
default:
|
|
538
538
|
D(r);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function Rs(o, e) {
|
|
542
542
|
const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
|
|
543
|
-
return
|
|
543
|
+
return xe(t, o, e), t;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function N(o) {
|
|
546
546
|
return {
|
|
547
547
|
*[Symbol.iterator]() {
|
|
548
|
-
for (const e of
|
|
548
|
+
for (const e of o.groups) for (const t of e.blocks) yield t;
|
|
549
549
|
}
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
|
-
class
|
|
552
|
+
class Et {
|
|
553
553
|
constructor(e) {
|
|
554
554
|
/** Nodes are stored in the map in topological order */
|
|
555
555
|
d(this, "nodes");
|
|
@@ -557,104 +557,104 @@ class Rt {
|
|
|
557
557
|
}
|
|
558
558
|
traverseIds(e, ...t) {
|
|
559
559
|
const r = /* @__PURE__ */ new Set();
|
|
560
|
-
return this.traverse(e, t, (
|
|
560
|
+
return this.traverse(e, t, (s) => r.add(s.id)), r;
|
|
561
561
|
}
|
|
562
562
|
traverseIdsExcludingRoots(e, ...t) {
|
|
563
563
|
const r = this.traverseIds(e, ...t);
|
|
564
|
-
for (const
|
|
564
|
+
for (const s of t) r.delete(s);
|
|
565
565
|
return r;
|
|
566
566
|
}
|
|
567
567
|
traverse(e, t, r) {
|
|
568
|
-
let
|
|
569
|
-
const
|
|
570
|
-
for (;
|
|
571
|
-
let
|
|
572
|
-
for (const a of
|
|
568
|
+
let s = [...t];
|
|
569
|
+
const n = new Set(s);
|
|
570
|
+
for (; s.length > 0; ) {
|
|
571
|
+
let i = [];
|
|
572
|
+
for (const a of s) {
|
|
573
573
|
const c = this.nodes.get(a);
|
|
574
574
|
r(c), c[e].forEach((u) => {
|
|
575
|
-
|
|
575
|
+
n.has(u) || (n.add(u), i.push(u));
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
|
-
|
|
578
|
+
s = i;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
function
|
|
582
|
+
function je(o) {
|
|
583
583
|
const e = /* @__PURE__ */ new Map();
|
|
584
584
|
let t;
|
|
585
|
-
for (const { id: r } of
|
|
586
|
-
const
|
|
585
|
+
for (const { id: r } of N(o)) {
|
|
586
|
+
const s = {
|
|
587
587
|
id: r,
|
|
588
588
|
missingReferences: !1
|
|
589
589
|
};
|
|
590
|
-
e.set(r,
|
|
590
|
+
e.set(r, s), t === void 0 ? s.upstream = /* @__PURE__ */ new Set() : (s.upstream = /* @__PURE__ */ new Set([t.id]), t.downstream = /* @__PURE__ */ new Set([s.id])), t = s;
|
|
591
591
|
}
|
|
592
|
-
return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new
|
|
592
|
+
return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Et(e);
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function ae(o, e) {
|
|
595
595
|
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
596
|
-
for (const { id:
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
599
|
-
const
|
|
600
|
-
id:
|
|
601
|
-
missingReferences:
|
|
602
|
-
upstream:
|
|
596
|
+
for (const { id: s } of N(o)) {
|
|
597
|
+
const n = e(s);
|
|
598
|
+
if (n === void 0) continue;
|
|
599
|
+
const i = Rs(n, r), a = {
|
|
600
|
+
id: s,
|
|
601
|
+
missingReferences: i.missingReferences,
|
|
602
|
+
upstream: i.upstreams,
|
|
603
603
|
downstream: /* @__PURE__ */ new Set()
|
|
604
604
|
// will be populated from downstream blocks
|
|
605
605
|
};
|
|
606
|
-
t.set(
|
|
606
|
+
t.set(s, a), i.upstreams.forEach((c) => t.get(c).downstream.add(s)), r.add(s);
|
|
607
607
|
}
|
|
608
|
-
return new
|
|
608
|
+
return new Et(t);
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
if (
|
|
612
|
-
for (const t of
|
|
610
|
+
function Bs(o, e) {
|
|
611
|
+
if (o.size !== e.size) return !1;
|
|
612
|
+
for (const t of o) if (!e.has(t)) return !1;
|
|
613
613
|
return !0;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
616
|
-
if (
|
|
617
|
-
for (const t of
|
|
615
|
+
function Te(o, e) {
|
|
616
|
+
if (o.size > e.size) return Te(e, o);
|
|
617
|
+
for (const t of o) if (e.has(t)) return !0;
|
|
618
618
|
return !1;
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(),
|
|
622
|
-
return
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
}), e.nodes.forEach((
|
|
626
|
-
|
|
627
|
-
}), { onlyInA: t, onlyInB: r, different:
|
|
628
|
-
}
|
|
629
|
-
let
|
|
630
|
-
async function
|
|
631
|
-
if (
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
const e = he("sha256").update(
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
return
|
|
638
|
-
}
|
|
639
|
-
function
|
|
640
|
-
return
|
|
641
|
-
}
|
|
642
|
-
function
|
|
643
|
-
let t = !1, r,
|
|
620
|
+
function it(o, e) {
|
|
621
|
+
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
622
|
+
return o.nodes.forEach((n) => {
|
|
623
|
+
const i = e.nodes.get(n.id);
|
|
624
|
+
i === void 0 ? t.add(n.id) : (!Bs(n.upstream, i.upstream) || Te(n.upstream, s)) && s.add(n.id);
|
|
625
|
+
}), e.nodes.forEach((n) => {
|
|
626
|
+
o.nodes.has(n.id) ? Te(n.upstream, s) && s.add(n.id) : r.add(n.id);
|
|
627
|
+
}), { onlyInA: t, onlyInB: r, different: s };
|
|
628
|
+
}
|
|
629
|
+
let be;
|
|
630
|
+
async function At() {
|
|
631
|
+
if (be === void 0) {
|
|
632
|
+
const o = await ys(yr["pframes.export-pframe"]);
|
|
633
|
+
if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
|
|
634
|
+
const e = he("sha256").update(o.content).digest("hex");
|
|
635
|
+
be = { spec: o, hash: e };
|
|
636
|
+
}
|
|
637
|
+
return be;
|
|
638
|
+
}
|
|
639
|
+
function Os(o, e, t) {
|
|
640
|
+
return Ot(o, e, !0, { pf: t }, ["result"]).result;
|
|
641
|
+
}
|
|
642
|
+
function we(o, e) {
|
|
643
|
+
let t = !1, r, s;
|
|
644
644
|
return () => {
|
|
645
645
|
if (!t)
|
|
646
|
-
return t = !0, r =
|
|
647
|
-
const
|
|
648
|
-
return r !==
|
|
646
|
+
return t = !0, r = o(), s = e(), s;
|
|
647
|
+
const n = o();
|
|
648
|
+
return r !== n && (r = n, s = e()), e();
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
|
-
class
|
|
651
|
+
class at {
|
|
652
652
|
constructor(e, t) {
|
|
653
|
-
d(this, "currentInputsC",
|
|
653
|
+
d(this, "currentInputsC", we(
|
|
654
654
|
() => this.fields.currentArgs.modCount,
|
|
655
655
|
() => JSON.parse(Buffer.from(this.fields.currentArgs.value).toString())
|
|
656
656
|
));
|
|
657
|
-
d(this, "actualProductionInputsC",
|
|
657
|
+
d(this, "actualProductionInputsC", we(
|
|
658
658
|
() => {
|
|
659
659
|
var e;
|
|
660
660
|
return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
|
|
@@ -666,7 +666,7 @@ class rt {
|
|
|
666
666
|
return JSON.parse(Buffer.from(e).toString());
|
|
667
667
|
}
|
|
668
668
|
));
|
|
669
|
-
d(this, "productionStaleC",
|
|
669
|
+
d(this, "productionStaleC", we(
|
|
670
670
|
() => {
|
|
671
671
|
var e;
|
|
672
672
|
return `${this.fields.currentArgs.modCount}_${(e = this.fields.prodArgs) == null ? void 0 : e.modCount}`;
|
|
@@ -707,17 +707,17 @@ class rt {
|
|
|
707
707
|
}
|
|
708
708
|
getTemplate(e) {
|
|
709
709
|
return e.getFutureFieldValue(
|
|
710
|
-
|
|
711
|
-
|
|
710
|
+
b.unwrapHolder(e, this.fields.blockPack.ref),
|
|
711
|
+
jt,
|
|
712
712
|
"Input"
|
|
713
713
|
);
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
const
|
|
717
|
-
throw new Error(`No new block info for ${
|
|
716
|
+
const Ds = (o) => {
|
|
717
|
+
throw new Error(`No new block info for ${o}`);
|
|
718
718
|
};
|
|
719
|
-
class
|
|
720
|
-
constructor(e, t, r,
|
|
719
|
+
class de {
|
|
720
|
+
constructor(e, t, r, s, n, i, a, c, u, l, p, g) {
|
|
721
721
|
d(this, "globalModCount", 0);
|
|
722
722
|
d(this, "fieldsChanged", !1);
|
|
723
723
|
//
|
|
@@ -736,7 +736,7 @@ class le {
|
|
|
736
736
|
d(this, "stagingGraph");
|
|
737
737
|
d(this, "pendingProductionGraph");
|
|
738
738
|
d(this, "actualProductionGraph");
|
|
739
|
-
this.rid = e, this.tx = t, this.author = r, this.schema =
|
|
739
|
+
this.rid = e, this.tx = t, this.author = r, this.schema = s, this.lastModified = n, this.meta = i, this.struct = a, this.renderingState = c, this.blocksInLimbo = u, this.blockInfos = l, this.blockFrontendStates = p, this.ctxExportTplHolder = g;
|
|
740
740
|
}
|
|
741
741
|
fixProblems() {
|
|
742
742
|
this.blockInfos.forEach((e) => {
|
|
@@ -750,16 +750,16 @@ class le {
|
|
|
750
750
|
return JSON.parse(JSON.stringify(this.struct));
|
|
751
751
|
}
|
|
752
752
|
getStagingGraph() {
|
|
753
|
-
return this.stagingGraph === void 0 && (this.stagingGraph =
|
|
753
|
+
return this.stagingGraph === void 0 && (this.stagingGraph = je(this.struct)), this.stagingGraph;
|
|
754
754
|
}
|
|
755
755
|
getPendingProductionGraph() {
|
|
756
|
-
return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph =
|
|
756
|
+
return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ae(
|
|
757
757
|
this.struct,
|
|
758
758
|
(e) => this.getBlockInfo(e).currentInputs
|
|
759
759
|
)), this.pendingProductionGraph;
|
|
760
760
|
}
|
|
761
761
|
getActualProductionGraph() {
|
|
762
|
-
return this.actualProductionGraph === void 0 && (this.actualProductionGraph =
|
|
762
|
+
return this.actualProductionGraph === void 0 && (this.actualProductionGraph = ae(
|
|
763
763
|
this.struct,
|
|
764
764
|
(e) => this.getBlockInfo(e).actualProductionInputs
|
|
765
765
|
)), this.actualProductionGraph;
|
|
@@ -771,26 +771,26 @@ class le {
|
|
|
771
771
|
return w(this.blockInfos.get(e));
|
|
772
772
|
}
|
|
773
773
|
getBlock(e) {
|
|
774
|
-
for (const t of
|
|
774
|
+
for (const t of N(this.struct)) if (t.id === e) return t;
|
|
775
775
|
throw new Error("block not found");
|
|
776
776
|
}
|
|
777
777
|
setBlockFieldObj(e, t, r) {
|
|
778
|
-
const
|
|
778
|
+
const s = S(this.rid, P(e, t));
|
|
779
779
|
if (r.ref === void 0) throw new Error("Can't set value with empty ref");
|
|
780
|
-
this.getBlockInfo(e).fields[t] === void 0 ? this.tx.createField(
|
|
780
|
+
this.getBlockInfo(e).fields[t] === void 0 ? this.tx.createField(s, "Dynamic", r.ref) : this.tx.setField(s, r.ref), this.getBlockInfo(e).fields[t] = {
|
|
781
781
|
modCount: this.globalModCount++,
|
|
782
782
|
...r
|
|
783
783
|
}, this.fieldsChanged = !0;
|
|
784
784
|
}
|
|
785
|
-
setBlockField(e, t, r,
|
|
786
|
-
this.setBlockFieldObj(e, t, { ref: r, status:
|
|
785
|
+
setBlockField(e, t, r, s, n) {
|
|
786
|
+
this.setBlockFieldObj(e, t, { ref: r, status: s, value: n });
|
|
787
787
|
}
|
|
788
788
|
deleteBlockFields(e, ...t) {
|
|
789
789
|
let r = !1;
|
|
790
|
-
const
|
|
791
|
-
for (const
|
|
792
|
-
const
|
|
793
|
-
|
|
790
|
+
const s = this.getBlockInfo(e);
|
|
791
|
+
for (const n of t) {
|
|
792
|
+
const i = s.fields;
|
|
793
|
+
n in i && (this.tx.removeField(S(this.rid, P(e, n))), delete i[n], this.fieldsChanged = !0, r = !0);
|
|
794
794
|
}
|
|
795
795
|
return r;
|
|
796
796
|
}
|
|
@@ -804,32 +804,32 @@ class le {
|
|
|
804
804
|
this.renderingState.stagingRefreshTimestamp = Date.now(), this.renderingStateChanged = !0;
|
|
805
805
|
}
|
|
806
806
|
resetStaging(e) {
|
|
807
|
-
var r,
|
|
807
|
+
var r, s, n;
|
|
808
808
|
const t = this.getBlockInfo(e).fields;
|
|
809
|
-
((r = t.stagingOutput) == null ? void 0 : r.status) === "Ready" && ((
|
|
809
|
+
((r = t.stagingOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.stagingCtx) == null ? void 0 : s.status) === "Ready" && ((n = t.stagingUiCtx) == null ? void 0 : n.status) === "Ready" && (this.setBlockFieldObj(e, "stagingOutputPrevious", t.stagingOutput), this.setBlockFieldObj(e, "stagingCtxPrevious", t.stagingCtx), this.setBlockFieldObj(e, "stagingUiCtxPrevious", t.stagingUiCtx)), this.deleteBlockFields(e, "stagingOutput", "stagingCtx", "stagingUiCtx") && this.resetStagingRefreshTimestamp();
|
|
810
810
|
}
|
|
811
811
|
resetProduction(e) {
|
|
812
|
-
var r,
|
|
812
|
+
var r, s, n;
|
|
813
813
|
const t = this.getBlockInfo(e).fields;
|
|
814
|
-
((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((
|
|
814
|
+
((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.prodCtx) == null ? void 0 : s.status) === "Ready" && ((n = t.prodUiCtx) == null ? void 0 : n.status) === "Ready" && (this.setBlockFieldObj(e, "prodOutputPrevious", t.prodOutput), this.setBlockFieldObj(e, "prodCtxPrevious", t.prodCtx), this.setBlockFieldObj(e, "prodUiCtxPrevious", t.prodUiCtx)), this.deleteBlockFields(e, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs");
|
|
815
815
|
}
|
|
816
816
|
/** Running blocks are reset, already computed moved to limbo. Returns if
|
|
817
817
|
* either of the actions were actually performed. */
|
|
818
818
|
resetOrLimboProduction(e) {
|
|
819
|
-
var r,
|
|
819
|
+
var r, s;
|
|
820
820
|
const t = this.getBlockInfo(e).fields;
|
|
821
|
-
return ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((
|
|
821
|
+
return ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.prodCtx) == null ? void 0 : s.status) === "Ready" ? this.blocksInLimbo.has(e) ? !1 : (this.blocksInLimbo.add(e), this.renderingStateChanged = !0, this.deleteBlockFields(e, "prodOutputPrevious", "prodCtxPrevious", "prodUiCtxPrevious"), !0) : this.deleteBlockFields(e, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs");
|
|
822
822
|
}
|
|
823
823
|
/** Optimally sets inputs for multiple blocks in one go */
|
|
824
824
|
setArgs(e) {
|
|
825
825
|
const t = [];
|
|
826
|
-
for (const { blockId: r, args:
|
|
827
|
-
const
|
|
828
|
-
JSON.parse(
|
|
829
|
-
const
|
|
830
|
-
if (Buffer.compare(
|
|
831
|
-
const a = this.tx.createValue(
|
|
832
|
-
this.setBlockField(r, "currentArgs", a, "Ready",
|
|
826
|
+
for (const { blockId: r, args: s } of e) {
|
|
827
|
+
const n = this.getBlockInfo(r);
|
|
828
|
+
JSON.parse(s);
|
|
829
|
+
const i = Buffer.from(s);
|
|
830
|
+
if (Buffer.compare(n.fields.currentArgs.value, i) === 0) continue;
|
|
831
|
+
const a = this.tx.createValue(b.JsonObject, i);
|
|
832
|
+
this.setBlockField(r, "currentArgs", a, "Ready", i), this.blocksWithChangedInputs.add(r), t.push(r);
|
|
833
833
|
}
|
|
834
834
|
this.getStagingGraph().traverse("downstream", t, ({ id: r }) => this.resetStaging(r)), t.length > 0 && this.updateLastModified();
|
|
835
835
|
}
|
|
@@ -840,43 +840,43 @@ class le {
|
|
|
840
840
|
/** Update block label */
|
|
841
841
|
setBlockLabel(e, t) {
|
|
842
842
|
const r = this.structure;
|
|
843
|
-
let
|
|
844
|
-
for (const
|
|
845
|
-
if (
|
|
846
|
-
|
|
843
|
+
let s = !1;
|
|
844
|
+
for (const n of N(r))
|
|
845
|
+
if (n.id === e) {
|
|
846
|
+
n.label = t, s = !0;
|
|
847
847
|
break;
|
|
848
848
|
}
|
|
849
|
-
if (!
|
|
849
|
+
if (!s) throw new Error(`block ${e} not found`);
|
|
850
850
|
this.updateStructure(r), this.updateLastModified();
|
|
851
851
|
}
|
|
852
852
|
createCtx(e, t) {
|
|
853
853
|
const r = [];
|
|
854
|
-
return e.forEach((
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
854
|
+
return e.forEach((s) => {
|
|
855
|
+
const n = this.getBlockInfo(s);
|
|
856
|
+
if (n.fields[t] === void 0 || n.fields[t].ref === void 0)
|
|
857
857
|
throw new Error("One of the upstreams staging is not rendered.");
|
|
858
|
-
r.push(
|
|
859
|
-
}),
|
|
858
|
+
r.push(b.unwrapHolder(this.tx, n.fields[t].ref));
|
|
859
|
+
}), us(this.tx, r);
|
|
860
860
|
}
|
|
861
861
|
exportCtx(e) {
|
|
862
|
-
return
|
|
862
|
+
return Os(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
|
|
863
863
|
}
|
|
864
864
|
renderStagingFor(e) {
|
|
865
865
|
this.resetStaging(e);
|
|
866
866
|
const t = this.getBlockInfo(e), r = this.createCtx(this.getStagingGraph().nodes.get(e).upstream, "stagingCtx");
|
|
867
867
|
if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
|
|
868
|
-
const
|
|
868
|
+
const s = t.getTemplate(this.tx), n = st(this.tx, s, {
|
|
869
869
|
args: t.fields.currentArgs.ref,
|
|
870
|
-
blockId: this.tx.createValue(
|
|
871
|
-
isProduction: this.tx.createValue(
|
|
870
|
+
blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
|
|
871
|
+
isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
|
|
872
872
|
context: r
|
|
873
873
|
});
|
|
874
874
|
this.setBlockField(
|
|
875
875
|
e,
|
|
876
876
|
"stagingCtx",
|
|
877
|
-
|
|
877
|
+
b.wrapInEphHolder(this.tx, n.context),
|
|
878
878
|
"NotReady"
|
|
879
|
-
), this.setBlockField(e, "stagingUiCtx", this.exportCtx(
|
|
879
|
+
), this.setBlockField(e, "stagingUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "stagingOutput", n.result, "NotReady");
|
|
880
880
|
}
|
|
881
881
|
renderProductionFor(e) {
|
|
882
882
|
this.resetProduction(e);
|
|
@@ -886,45 +886,45 @@ class le {
|
|
|
886
886
|
);
|
|
887
887
|
if (this.getBlock(e).renderingMode === "Light")
|
|
888
888
|
throw new Error("Can't render production for light block.");
|
|
889
|
-
const
|
|
889
|
+
const s = t.getTemplate(this.tx), n = st(this.tx, s, {
|
|
890
890
|
args: t.fields.currentArgs.ref,
|
|
891
|
-
blockId: this.tx.createValue(
|
|
892
|
-
isProduction: this.tx.createValue(
|
|
891
|
+
blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
|
|
892
|
+
isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
|
|
893
893
|
context: r
|
|
894
894
|
});
|
|
895
895
|
this.setBlockField(
|
|
896
896
|
e,
|
|
897
897
|
"prodCtx",
|
|
898
|
-
|
|
898
|
+
b.wrapInEphHolder(this.tx, n.context),
|
|
899
899
|
"NotReady"
|
|
900
|
-
), this.setBlockField(e, "prodUiCtx", this.exportCtx(
|
|
900
|
+
), this.setBlockField(e, "prodUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "prodOutput", n.result, "NotReady"), this.setBlockFieldObj(e, "prodArgs", t.fields.currentArgs), this.blocksInLimbo.delete(e) && (this.renderingStateChanged = !0);
|
|
901
901
|
}
|
|
902
902
|
//
|
|
903
903
|
// Structure changes
|
|
904
904
|
//
|
|
905
905
|
/** Very generic method, better check for more specialized case-specific methods first. */
|
|
906
|
-
updateStructure(e, t =
|
|
907
|
-
const r = this.getStagingGraph(),
|
|
906
|
+
updateStructure(e, t = Ds) {
|
|
907
|
+
const r = this.getStagingGraph(), s = this.getActualProductionGraph(), n = je(e), i = ae(
|
|
908
908
|
e,
|
|
909
909
|
(u) => {
|
|
910
910
|
var l;
|
|
911
911
|
return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
|
|
912
912
|
}
|
|
913
|
-
), a =
|
|
913
|
+
), a = it(r, n), c = it(s, i);
|
|
914
914
|
for (const u of a.onlyInA) {
|
|
915
915
|
const { fields: l } = this.getBlockInfo(u);
|
|
916
916
|
this.deleteBlockFields(u, ...Object.keys(l)), this.blockInfos.delete(u), this.blocksInLimbo.delete(u) && (this.renderingStateChanged = !0), this.blockFrontendStates.delete(u) && this.changedBlockFrontendStates.add(u);
|
|
917
917
|
}
|
|
918
918
|
for (const u of a.onlyInB) {
|
|
919
|
-
const l = new
|
|
919
|
+
const l = new at(u, {});
|
|
920
920
|
this.blockInfos.set(u, l);
|
|
921
|
-
const p = t(u),
|
|
922
|
-
this.setBlockField(u, "blockPack",
|
|
923
|
-
const
|
|
924
|
-
this.setBlockField(u, "currentArgs",
|
|
921
|
+
const p = t(u), g = nt(this.tx, p.blockPack);
|
|
922
|
+
this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
|
|
923
|
+
const m = Buffer.from(p.args), h = this.tx.createValue(b.JsonObject, m);
|
|
924
|
+
this.setBlockField(u, "currentArgs", h, "Ready", m), l.check();
|
|
925
925
|
}
|
|
926
926
|
for (const u of a.different) this.resetStaging(u);
|
|
927
|
-
|
|
927
|
+
s.traverse("downstream", [...c.different], (u) => {
|
|
928
928
|
this.resetOrLimboProduction(u.id);
|
|
929
929
|
}), (a.onlyInB.size > 0 || a.onlyInA.size > 0 || a.different.size > 0) && this.resetStagingRefreshTimestamp(), this.struct = e, this.structureChanged = !0, this.stagingGraph = void 0, this.pendingProductionGraph = void 0, this.actualProductionGraph = void 0, this.updateLastModified();
|
|
930
930
|
}
|
|
@@ -932,32 +932,32 @@ class le {
|
|
|
932
932
|
// Structure change helpers
|
|
933
933
|
//
|
|
934
934
|
addBlock(e, t, r) {
|
|
935
|
-
const
|
|
935
|
+
const s = this.structure;
|
|
936
936
|
if (r === void 0)
|
|
937
|
-
|
|
937
|
+
s.groups[s.groups.length - 1].blocks.push(e);
|
|
938
938
|
else {
|
|
939
|
-
let
|
|
940
|
-
for (const
|
|
941
|
-
const a =
|
|
939
|
+
let n = !1;
|
|
940
|
+
for (const i of s.groups) {
|
|
941
|
+
const a = i.blocks.findIndex((c) => c.id === r);
|
|
942
942
|
if (!(a < 0)) {
|
|
943
|
-
|
|
943
|
+
i.blocks.splice(a, 0, e), n = !0;
|
|
944
944
|
break;
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
|
-
if (!
|
|
947
|
+
if (!n) throw new Error(`Can't find element with id: ${r}`);
|
|
948
948
|
}
|
|
949
|
-
this.updateStructure(
|
|
950
|
-
if (
|
|
949
|
+
this.updateStructure(s, (n) => {
|
|
950
|
+
if (n !== e.id) throw new Error("Unexpected");
|
|
951
951
|
return t;
|
|
952
952
|
});
|
|
953
953
|
}
|
|
954
954
|
deleteBlock(e) {
|
|
955
955
|
const t = this.structure;
|
|
956
956
|
let r = !1;
|
|
957
|
-
for (const
|
|
958
|
-
const
|
|
959
|
-
if (!(
|
|
960
|
-
|
|
957
|
+
for (const s of t.groups) {
|
|
958
|
+
const n = s.blocks.findIndex((i) => i.id === e);
|
|
959
|
+
if (!(n < 0)) {
|
|
960
|
+
s.blocks.splice(n, 1), r = !0;
|
|
961
961
|
break;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
@@ -968,85 +968,85 @@ class le {
|
|
|
968
968
|
// Block-pack migration
|
|
969
969
|
//
|
|
970
970
|
migrateBlockPack(e, t, r) {
|
|
971
|
-
const
|
|
971
|
+
const s = this.getBlockInfo(e);
|
|
972
972
|
this.setBlockField(
|
|
973
973
|
e,
|
|
974
974
|
"blockPack",
|
|
975
|
-
|
|
975
|
+
b.wrapInHolder(this.tx, nt(this.tx, t)),
|
|
976
976
|
"NotReady"
|
|
977
|
-
), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id:
|
|
977
|
+
), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: n }) => this.resetStaging(n)), s.productionRendered && this.getActualProductionGraph().traverse(
|
|
978
978
|
"downstream",
|
|
979
979
|
[e],
|
|
980
|
-
({ id:
|
|
980
|
+
({ id: n }) => this.resetOrLimboProduction(n)
|
|
981
981
|
), this.updateLastModified();
|
|
982
982
|
}
|
|
983
983
|
//
|
|
984
984
|
// Render
|
|
985
985
|
//
|
|
986
986
|
renderProduction(e, t = !1) {
|
|
987
|
-
const r = new Set(e),
|
|
987
|
+
const r = new Set(e), s = this.getPendingProductionGraph();
|
|
988
988
|
if (t)
|
|
989
|
-
|
|
990
|
-
r.add(
|
|
989
|
+
s.traverse("upstream", e, (i) => {
|
|
990
|
+
r.add(i.id);
|
|
991
991
|
});
|
|
992
992
|
else
|
|
993
|
-
for (const
|
|
994
|
-
const a =
|
|
995
|
-
if (a === void 0) throw new Error(`Can't find block with id: ${
|
|
993
|
+
for (const i of r) {
|
|
994
|
+
const a = s.nodes.get(i);
|
|
995
|
+
if (a === void 0) throw new Error(`Can't find block with id: ${i}`);
|
|
996
996
|
for (const c of a.upstream)
|
|
997
997
|
if (!r.has(c))
|
|
998
998
|
throw new Error("Can't render blocks not including all upstreams.");
|
|
999
999
|
}
|
|
1000
|
-
const
|
|
1001
|
-
for (const
|
|
1002
|
-
if (!r.has(
|
|
1003
|
-
let a = this.getBlockInfo(
|
|
1000
|
+
const n = /* @__PURE__ */ new Set();
|
|
1001
|
+
for (const i of N(this.structure)) {
|
|
1002
|
+
if (!r.has(i.id)) continue;
|
|
1003
|
+
let a = this.getBlockInfo(i.id).requireProductionRendering || this.blocksInLimbo.has(i.id);
|
|
1004
1004
|
if (!a) {
|
|
1005
|
-
for (const c of
|
|
1006
|
-
if (
|
|
1005
|
+
for (const c of s.nodes.get(i.id).upstream)
|
|
1006
|
+
if (n.has(c)) {
|
|
1007
1007
|
a = !0;
|
|
1008
1008
|
break;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
a && (this.renderProductionFor(
|
|
1011
|
+
a && (this.renderProductionFor(i.id), n.add(i.id));
|
|
1012
1012
|
}
|
|
1013
|
-
return
|
|
1014
|
-
|
|
1015
|
-
}),
|
|
1013
|
+
return s.traverse("downstream", [...n], (i) => {
|
|
1014
|
+
n.has(i.id) || this.resetOrLimboProduction(i.id);
|
|
1015
|
+
}), n.size > 0 && this.updateLastModified(), n;
|
|
1016
1016
|
}
|
|
1017
1017
|
/** Stops running blocks from the list and modify states of other blocks
|
|
1018
1018
|
* accordingly */
|
|
1019
1019
|
stopProduction(...e) {
|
|
1020
|
-
var
|
|
1021
|
-
const t = this.getActualProductionGraph(), r = new
|
|
1020
|
+
var i, a;
|
|
1021
|
+
const t = this.getActualProductionGraph(), r = new St(e), s = new Set(e), n = [];
|
|
1022
1022
|
for (; !r.isEmpty(); ) {
|
|
1023
1023
|
const c = r.shift(), u = this.getBlockInfo(c).fields;
|
|
1024
|
-
if (!(((
|
|
1025
|
-
|
|
1024
|
+
if (!(((i = u.prodOutput) == null ? void 0 : i.status) === "Ready" && ((a = u.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
|
|
1025
|
+
n.push(c);
|
|
1026
1026
|
for (const l of t.traverseIdsExcludingRoots("downstream", c))
|
|
1027
|
-
|
|
1027
|
+
s.has(l) || (r.push(l), s.add(l));
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
|
-
for (const c of t.traverseIdsExcludingRoots("downstream", ...
|
|
1030
|
+
for (const c of t.traverseIdsExcludingRoots("downstream", ...n))
|
|
1031
1031
|
this.resetOrLimboProduction(c);
|
|
1032
1032
|
}
|
|
1033
1033
|
traverseWithStagingLag(e) {
|
|
1034
1034
|
const t = /* @__PURE__ */ new Map();
|
|
1035
|
-
this.getStagingGraph().nodes.forEach((
|
|
1036
|
-
let
|
|
1037
|
-
|
|
1035
|
+
this.getStagingGraph().nodes.forEach((s) => {
|
|
1036
|
+
let i = this.getBlockInfo(s.id).stagingRendered ? 0 : 1;
|
|
1037
|
+
s.upstream.forEach((a) => {
|
|
1038
1038
|
const c = t.get(a);
|
|
1039
|
-
c !== 0 && (
|
|
1040
|
-
}), e(
|
|
1039
|
+
c !== 0 && (i = Math.max(c + 1, i));
|
|
1040
|
+
}), e(s.id, i), t.set(s.id, i);
|
|
1041
1041
|
});
|
|
1042
1042
|
}
|
|
1043
1043
|
/** @param stagingRenderingRate rate in blocks per second */
|
|
1044
1044
|
refreshStagings(e) {
|
|
1045
1045
|
const t = Date.now() - this.renderingState.stagingRefreshTimestamp, r = e === void 0 ? void 0 : 1 + Math.max(0, t * e / 1e3);
|
|
1046
|
-
let
|
|
1047
|
-
this.traverseWithStagingLag((
|
|
1048
|
-
|
|
1049
|
-
}),
|
|
1046
|
+
let s = 0;
|
|
1047
|
+
this.traverseWithStagingLag((n, i) => {
|
|
1048
|
+
i !== 0 && (r === void 0 || i <= r) && (this.renderStagingFor(n), s++);
|
|
1049
|
+
}), s > 0 && this.resetStagingRefreshTimestamp();
|
|
1050
1050
|
}
|
|
1051
1051
|
//
|
|
1052
1052
|
// Meta
|
|
@@ -1061,13 +1061,13 @@ class le {
|
|
|
1061
1061
|
/** @param stagingRenderingRate rate in blocks per second */
|
|
1062
1062
|
doRefresh(e) {
|
|
1063
1063
|
this.refreshStagings(e), this.blockInfos.forEach((t) => {
|
|
1064
|
-
var r,
|
|
1065
|
-
((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((
|
|
1064
|
+
var r, s, n, i;
|
|
1065
|
+
((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((s = t.fields.prodOutput) == null ? void 0 : s.status) === "Ready" && this.deleteBlockFields(
|
|
1066
1066
|
t.id,
|
|
1067
1067
|
"prodOutputPrevious",
|
|
1068
1068
|
"prodCtxPrevious",
|
|
1069
1069
|
"prodUiCtxPrevious"
|
|
1070
|
-
), ((
|
|
1070
|
+
), ((n = t.fields.stagingCtx) == null ? void 0 : n.status) === "Ready" && ((i = t.fields.stagingOutput) == null ? void 0 : i.status) === "Ready" && this.deleteBlockFields(
|
|
1071
1071
|
t.id,
|
|
1072
1072
|
"stagingOutputPrevious",
|
|
1073
1073
|
"stagingCtxPrevious",
|
|
@@ -1078,215 +1078,215 @@ class le {
|
|
|
1078
1078
|
assignAuthorMarkers() {
|
|
1079
1079
|
const e = this.author ? JSON.stringify(this.author) : void 0;
|
|
1080
1080
|
for (const t of this.blocksWithChangedInputs)
|
|
1081
|
-
e === void 0 ? this.tx.deleteKValue(this.rid,
|
|
1082
|
-
(this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid,
|
|
1081
|
+
e === void 0 ? this.tx.deleteKValue(this.rid, Be(t)) : this.tx.setKValue(this.rid, Be(t), e);
|
|
1082
|
+
(this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Oe) : this.tx.setKValue(this.rid, Oe, e));
|
|
1083
1083
|
}
|
|
1084
1084
|
save() {
|
|
1085
1085
|
if (this.wasModified) {
|
|
1086
|
-
this.lastModifiedChanged && this.tx.setKValue(this.rid,
|
|
1086
|
+
this.lastModifiedChanged && this.tx.setKValue(this.rid, te, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, W, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
|
|
1087
1087
|
this.rid,
|
|
1088
|
-
|
|
1088
|
+
le,
|
|
1089
1089
|
JSON.stringify({
|
|
1090
1090
|
...this.renderingState,
|
|
1091
1091
|
blocksInLimbo: [...this.blocksInLimbo]
|
|
1092
1092
|
})
|
|
1093
|
-
), this.metaChanged && this.tx.setKValue(this.rid,
|
|
1093
|
+
), this.metaChanged && this.tx.setKValue(this.rid, re, JSON.stringify(this.meta));
|
|
1094
1094
|
for (const e of this.changedBlockFrontendStates) {
|
|
1095
1095
|
const t = this.blockFrontendStates.get(e);
|
|
1096
|
-
t === void 0 ? this.tx.deleteKValue(this.rid,
|
|
1096
|
+
t === void 0 ? this.tx.deleteKValue(this.rid, Re(e)) : this.tx.setKValue(this.rid, Re(e), t);
|
|
1097
1097
|
}
|
|
1098
1098
|
this.assignAuthorMarkers();
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
static async load(e, t, r) {
|
|
1102
|
-
const
|
|
1102
|
+
const s = e.getResourceData(t, !0), n = e.getKValueJson(t, Ft), i = e.getKValueJson(t, te), a = e.getKValueJson(t, re), c = e.getKValueJson(t, W), u = e.getKValueJson(t, le), l = e.listKeyValuesString(t), [
|
|
1103
1103
|
p,
|
|
1104
|
+
g,
|
|
1105
|
+
m,
|
|
1104
1106
|
h,
|
|
1105
|
-
f,
|
|
1106
|
-
b,
|
|
1107
1107
|
C,
|
|
1108
|
-
{ stagingRefreshTimestamp: I, blocksInLimbo:
|
|
1109
|
-
|
|
1108
|
+
{ stagingRefreshTimestamp: I, blocksInLimbo: G },
|
|
1109
|
+
U
|
|
1110
1110
|
] = await Promise.all([
|
|
1111
|
-
|
|
1112
|
-
i,
|
|
1111
|
+
s,
|
|
1113
1112
|
n,
|
|
1113
|
+
i,
|
|
1114
1114
|
a,
|
|
1115
1115
|
c,
|
|
1116
1116
|
u,
|
|
1117
1117
|
l
|
|
1118
1118
|
]);
|
|
1119
|
-
if (
|
|
1119
|
+
if (g !== Rt)
|
|
1120
1120
|
throw new Error(
|
|
1121
|
-
`Can't act on this project resource because it has a wrong schema version: ${
|
|
1121
|
+
`Can't act on this project resource because it has a wrong schema version: ${g}`
|
|
1122
1122
|
);
|
|
1123
|
-
const
|
|
1124
|
-
for (const
|
|
1125
|
-
const O =
|
|
1123
|
+
const H = /* @__PURE__ */ new Map();
|
|
1124
|
+
for (const y of p.fields) {
|
|
1125
|
+
const O = Qr(y.name);
|
|
1126
1126
|
if (O === void 0) continue;
|
|
1127
|
-
let
|
|
1128
|
-
|
|
1127
|
+
let R = H.get(O.blockId);
|
|
1128
|
+
R === void 0 && (R = {
|
|
1129
1129
|
id: O.blockId,
|
|
1130
1130
|
fields: {}
|
|
1131
|
-
},
|
|
1131
|
+
}, H.set(O.blockId, R)), R.fields[O.fieldName] = ue(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
|
|
1132
1132
|
}
|
|
1133
|
-
const z = await
|
|
1134
|
-
(
|
|
1133
|
+
const z = await At(), oe = De(z.hash), k = p.fields.find(
|
|
1134
|
+
(y) => y.name === oe
|
|
1135
1135
|
);
|
|
1136
1136
|
let J;
|
|
1137
|
-
k !== void 0 ? J =
|
|
1138
|
-
S(t,
|
|
1137
|
+
k !== void 0 ? J = Pe(k.value) : (J = b.wrapInHolder(e, Ue(e, z.spec)), e.createField(
|
|
1138
|
+
S(t, De(z.hash)),
|
|
1139
1139
|
"Dynamic",
|
|
1140
1140
|
J
|
|
1141
1141
|
));
|
|
1142
|
-
const Y = { stagingRefreshTimestamp: I },
|
|
1143
|
-
for (const
|
|
1144
|
-
const O =
|
|
1145
|
-
O !== void 0 && x.set(O,
|
|
1142
|
+
const Y = { stagingRefreshTimestamp: I }, E = new Set(G), x = /* @__PURE__ */ new Map();
|
|
1143
|
+
for (const y of U) {
|
|
1144
|
+
const O = zr(y.key);
|
|
1145
|
+
O !== void 0 && x.set(O, y.value);
|
|
1146
1146
|
}
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
for (const [,
|
|
1150
|
-
if (
|
|
1151
|
-
if (!
|
|
1147
|
+
const B = [];
|
|
1148
|
+
H.forEach(({ id: y, fields: O }) => {
|
|
1149
|
+
for (const [, R] of Object.entries(O))
|
|
1150
|
+
if (R.ref !== void 0) {
|
|
1151
|
+
if (!cr(R.ref) || ur(R.ref))
|
|
1152
1152
|
throw new Error("unexpected behaviour");
|
|
1153
|
-
|
|
1153
|
+
B.push([R, e.getResourceData(R.ref, !1)]);
|
|
1154
1154
|
}
|
|
1155
1155
|
});
|
|
1156
|
-
for (const [
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1156
|
+
for (const [y, O] of B) {
|
|
1157
|
+
const R = await O;
|
|
1158
|
+
y.value = R.data, Qe(R.error) ? y.status = "Error" : R.resourceReady || Qe(R.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
|
|
1159
1159
|
}
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
const
|
|
1163
|
-
for (const
|
|
1164
|
-
if (!
|
|
1165
|
-
throw new Error(`Inconsistent project structure: no inputs for ${
|
|
1166
|
-
|
|
1160
|
+
const K = /* @__PURE__ */ new Map();
|
|
1161
|
+
H.forEach(({ id: y, fields: O }) => K.set(y, new at(y, O)));
|
|
1162
|
+
const L = /* @__PURE__ */ new Set();
|
|
1163
|
+
for (const y of N(C)) {
|
|
1164
|
+
if (!K.has(y.id))
|
|
1165
|
+
throw new Error(`Inconsistent project structure: no inputs for ${y.id}`);
|
|
1166
|
+
L.add(y.id);
|
|
1167
1167
|
}
|
|
1168
|
-
|
|
1169
|
-
if (!
|
|
1170
|
-
throw new Error(`Inconsistent project structure: no structure entry for ${
|
|
1171
|
-
|
|
1168
|
+
K.forEach((y) => {
|
|
1169
|
+
if (!L.has(y.id))
|
|
1170
|
+
throw new Error(`Inconsistent project structure: no structure entry for ${y.id}`);
|
|
1171
|
+
y.check();
|
|
1172
1172
|
});
|
|
1173
|
-
const
|
|
1173
|
+
const ne = new de(
|
|
1174
1174
|
t,
|
|
1175
1175
|
e,
|
|
1176
1176
|
r,
|
|
1177
|
+
g,
|
|
1178
|
+
m,
|
|
1177
1179
|
h,
|
|
1178
|
-
f,
|
|
1179
|
-
b,
|
|
1180
1180
|
C,
|
|
1181
1181
|
Y,
|
|
1182
|
-
|
|
1183
|
-
|
|
1182
|
+
E,
|
|
1183
|
+
K,
|
|
1184
1184
|
x,
|
|
1185
1185
|
J
|
|
1186
1186
|
);
|
|
1187
|
-
return
|
|
1187
|
+
return ne.fixProblems(), ne;
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
|
-
async function
|
|
1191
|
-
const t =
|
|
1192
|
-
|
|
1190
|
+
async function xs(o, e = $r) {
|
|
1191
|
+
const t = o.createEphemeral(Gr);
|
|
1192
|
+
o.lock(t);
|
|
1193
1193
|
const r = String(Date.now());
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1196
|
-
return
|
|
1197
|
-
S(t,
|
|
1194
|
+
o.setKValue(t, Ft, JSON.stringify(Rt)), o.setKValue(t, Me, r), o.setKValue(t, te, r), o.setKValue(t, re, JSON.stringify(e)), o.setKValue(t, W, JSON.stringify(Ur)), o.setKValue(t, le, JSON.stringify(Kr));
|
|
1195
|
+
const s = await At();
|
|
1196
|
+
return o.createField(
|
|
1197
|
+
S(t, De(s.hash)),
|
|
1198
1198
|
"Dynamic",
|
|
1199
|
-
|
|
1199
|
+
b.wrapInHolder(o, Ue(o, s.spec))
|
|
1200
1200
|
), t;
|
|
1201
1201
|
}
|
|
1202
|
-
async function
|
|
1203
|
-
return V(
|
|
1202
|
+
async function Se(o, e, t) {
|
|
1203
|
+
return V(o, e, void 0, t);
|
|
1204
1204
|
}
|
|
1205
|
-
async function V(
|
|
1206
|
-
if (
|
|
1207
|
-
return await
|
|
1208
|
-
const
|
|
1209
|
-
return
|
|
1205
|
+
async function V(o, e, t, r) {
|
|
1206
|
+
if (o instanceof ar)
|
|
1207
|
+
return await o.withWriteTx("ProjectAction", async (s) => {
|
|
1208
|
+
const n = await de.load(s, e, t), i = await r(n);
|
|
1209
|
+
return n.wasModified && (n.save(), await s.commit()), i;
|
|
1210
1210
|
});
|
|
1211
1211
|
{
|
|
1212
|
-
const
|
|
1213
|
-
return
|
|
1212
|
+
const s = await de.load(o, e, t), n = await r(s);
|
|
1213
|
+
return s.save(), n;
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
|
-
function*
|
|
1217
|
-
switch (
|
|
1216
|
+
function* js(o) {
|
|
1217
|
+
switch (o.type) {
|
|
1218
1218
|
case "Json":
|
|
1219
1219
|
return;
|
|
1220
1220
|
case "JsonPartitioned":
|
|
1221
|
-
for (const [, e] of Object.entries(
|
|
1221
|
+
for (const [, e] of Object.entries(o.parts)) yield e;
|
|
1222
1222
|
return;
|
|
1223
1223
|
case "BinaryPartitioned":
|
|
1224
|
-
for (const [, { index: e, values: t }] of Object.entries(
|
|
1224
|
+
for (const [, { index: e, values: t }] of Object.entries(o.parts))
|
|
1225
1225
|
yield e, yield t;
|
|
1226
1226
|
return;
|
|
1227
1227
|
default:
|
|
1228
|
-
D(
|
|
1228
|
+
D(o);
|
|
1229
1229
|
}
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function ct(o, e) {
|
|
1232
1232
|
return Object.fromEntries(
|
|
1233
|
-
Object.entries(
|
|
1233
|
+
Object.entries(o).map(([t, r]) => [t, e(r, t)])
|
|
1234
1234
|
);
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1237
|
-
switch (
|
|
1236
|
+
function Ts(o, e) {
|
|
1237
|
+
switch (o.type) {
|
|
1238
1238
|
case "Json":
|
|
1239
|
-
return { ...
|
|
1239
|
+
return { ...o };
|
|
1240
1240
|
case "JsonPartitioned":
|
|
1241
|
-
return { ...
|
|
1241
|
+
return { ...o, parts: ct(o.parts, e) };
|
|
1242
1242
|
case "BinaryPartitioned":
|
|
1243
1243
|
return {
|
|
1244
|
-
...
|
|
1245
|
-
parts:
|
|
1244
|
+
...o,
|
|
1245
|
+
parts: ct(o.parts, (t) => ({
|
|
1246
1246
|
index: e(t.index),
|
|
1247
1247
|
values: e(t.values)
|
|
1248
1248
|
}))
|
|
1249
1249
|
};
|
|
1250
1250
|
default:
|
|
1251
|
-
D(
|
|
1251
|
+
D(o);
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1254
|
+
const Es = se("PColumnData/JsonPartitioned", "1"), As = se(
|
|
1255
1255
|
"PColumnData/Partitioned/JsonPartitioned",
|
|
1256
1256
|
"1"
|
|
1257
|
-
),
|
|
1257
|
+
), Is = se("PColumnData/BinaryPartitioned", "1"), Vs = se(
|
|
1258
1258
|
"PColumnData/Partitioned/BinaryPartitioned",
|
|
1259
1259
|
"1"
|
|
1260
|
-
),
|
|
1261
|
-
function
|
|
1262
|
-
if (!
|
|
1263
|
-
const e =
|
|
1260
|
+
), Ns = se("PColumnData/Json", "1");
|
|
1261
|
+
function Ls(o) {
|
|
1262
|
+
if (!o.getIsReadyOrError()) throw new Error("Data not ready.");
|
|
1263
|
+
const e = o.getDataAsJson();
|
|
1264
1264
|
if (e === void 0)
|
|
1265
1265
|
throw new Error("unexpected data info structure, no resource data");
|
|
1266
|
-
if (
|
|
1266
|
+
if ($(o.resourceType, Ns)) {
|
|
1267
1267
|
const t = e;
|
|
1268
1268
|
return {
|
|
1269
1269
|
type: "Json",
|
|
1270
1270
|
keyLength: t.keyLength,
|
|
1271
1271
|
data: t.data
|
|
1272
1272
|
};
|
|
1273
|
-
} else if (
|
|
1273
|
+
} else if ($(o.resourceType, Es)) {
|
|
1274
1274
|
const t = e, r = Object.fromEntries(
|
|
1275
|
-
|
|
1275
|
+
o.listInputFields().map((s) => [s, o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo])
|
|
1276
1276
|
);
|
|
1277
1277
|
return {
|
|
1278
1278
|
type: "JsonPartitioned",
|
|
1279
1279
|
partitionKeyLength: t.partitionKeyLength,
|
|
1280
1280
|
parts: r
|
|
1281
1281
|
};
|
|
1282
|
-
} else if (
|
|
1282
|
+
} else if ($(o.resourceType, As)) {
|
|
1283
1283
|
const t = e, r = {};
|
|
1284
|
-
for (const
|
|
1285
|
-
const
|
|
1286
|
-
if (
|
|
1287
|
-
for (const a of
|
|
1288
|
-
const c = JSON.stringify([...JSON.parse(
|
|
1289
|
-
r[c] =
|
|
1284
|
+
for (const s of o.listInputFields()) {
|
|
1285
|
+
const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
|
|
1286
|
+
if (i === void 0) throw new Error(`no partition keys for super key ${s}`);
|
|
1287
|
+
for (const a of i) {
|
|
1288
|
+
const c = JSON.stringify([...JSON.parse(s), ...JSON.parse(a)]);
|
|
1289
|
+
r[c] = n.traverse({ field: a, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
1292
|
return {
|
|
@@ -1294,44 +1294,44 @@ function Ao(s) {
|
|
|
1294
1294
|
partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
|
|
1295
1295
|
parts: r
|
|
1296
1296
|
};
|
|
1297
|
-
} else if (
|
|
1297
|
+
} else if ($(o.resourceType, Is)) {
|
|
1298
1298
|
const t = e, r = {};
|
|
1299
|
-
for (const
|
|
1300
|
-
if (
|
|
1301
|
-
const
|
|
1302
|
-
let
|
|
1303
|
-
|
|
1304
|
-
} else if (
|
|
1305
|
-
const
|
|
1306
|
-
let
|
|
1307
|
-
|
|
1308
|
-
} else throw new Error(`unrecognized part field name: ${
|
|
1309
|
-
for (const [
|
|
1310
|
-
if (
|
|
1311
|
-
if (
|
|
1299
|
+
for (const s of o.listInputFields())
|
|
1300
|
+
if (s.endsWith(".index")) {
|
|
1301
|
+
const n = s.slice(0, s.length - 6);
|
|
1302
|
+
let i = r[n];
|
|
1303
|
+
i === void 0 && (i = {}, r[n] = i), i.index = o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1304
|
+
} else if (s.endsWith(".values")) {
|
|
1305
|
+
const n = s.slice(0, s.length - 7);
|
|
1306
|
+
let i = r[n];
|
|
1307
|
+
i === void 0 && (i = {}, r[n] = i), i.values = o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1308
|
+
} else throw new Error(`unrecognized part field name: ${s}`);
|
|
1309
|
+
for (const [s, n] of Object.entries(r)) {
|
|
1310
|
+
if (n.index === void 0) throw new Error(`no index for part ${s}`);
|
|
1311
|
+
if (n.values === void 0) throw new Error(`no values for part ${s}`);
|
|
1312
1312
|
}
|
|
1313
1313
|
return {
|
|
1314
1314
|
type: "BinaryPartitioned",
|
|
1315
1315
|
partitionKeyLength: t.partitionKeyLength,
|
|
1316
1316
|
parts: r
|
|
1317
1317
|
};
|
|
1318
|
-
} else if (
|
|
1318
|
+
} else if ($(o.resourceType, Vs)) {
|
|
1319
1319
|
const t = e, r = {};
|
|
1320
|
-
for (const
|
|
1321
|
-
const
|
|
1322
|
-
if (
|
|
1323
|
-
for (const a of
|
|
1320
|
+
for (const s of o.listInputFields()) {
|
|
1321
|
+
const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
|
|
1322
|
+
if (i === void 0) throw new Error(`no partition keys for super key ${s}`);
|
|
1323
|
+
for (const a of i)
|
|
1324
1324
|
if (a.endsWith(".index")) {
|
|
1325
|
-
const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(
|
|
1325
|
+
const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
|
|
1326
1326
|
let l = r[u];
|
|
1327
|
-
l === void 0 && (l = {}, r[u] = l), r[u].index =
|
|
1327
|
+
l === void 0 && (l = {}, r[u] = l), r[u].index = n.traverse({
|
|
1328
1328
|
field: a,
|
|
1329
1329
|
errorIfFieldNotSet: !0
|
|
1330
1330
|
}).resourceInfo;
|
|
1331
1331
|
} else if (a.endsWith(".values")) {
|
|
1332
|
-
const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(
|
|
1332
|
+
const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
|
|
1333
1333
|
let l = r[u];
|
|
1334
|
-
l === void 0 && (l = {}, r[u] = l), r[u].values =
|
|
1334
|
+
l === void 0 && (l = {}, r[u] = l), r[u].values = n.traverse({
|
|
1335
1335
|
field: a,
|
|
1336
1336
|
errorIfFieldNotSet: !0
|
|
1337
1337
|
}).resourceInfo;
|
|
@@ -1343,39 +1343,39 @@ function Ao(s) {
|
|
|
1343
1343
|
parts: r
|
|
1344
1344
|
};
|
|
1345
1345
|
}
|
|
1346
|
-
throw new Error(`unsupported resource type: ${
|
|
1346
|
+
throw new Error(`unsupported resource type: ${lr(o.resourceType)}`);
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1348
|
+
function It(o, e) {
|
|
1349
1349
|
const t = he("sha256");
|
|
1350
|
-
return t.update(
|
|
1350
|
+
return t.update(Ve(o)), t.update(String(ue(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
|
|
1351
1351
|
}
|
|
1352
|
-
function
|
|
1352
|
+
function Vt(o, e = !0, t = !1, r = "") {
|
|
1353
1353
|
var a, c, u;
|
|
1354
|
-
const
|
|
1355
|
-
for (const l of
|
|
1356
|
-
const p = l.match(
|
|
1354
|
+
const s = /^(?<name>.*)\.(?<type>spec|data)$/, n = /* @__PURE__ */ new Map();
|
|
1355
|
+
for (const l of o.listInputFields()) {
|
|
1356
|
+
const p = l.match(s);
|
|
1357
1357
|
if (!p) {
|
|
1358
1358
|
if (e) throw new Error(`unexpected field name ${l}`);
|
|
1359
1359
|
continue;
|
|
1360
1360
|
}
|
|
1361
|
-
let
|
|
1362
|
-
if (!
|
|
1361
|
+
let g = w((a = p.groups) == null ? void 0 : a.name);
|
|
1362
|
+
if (!g.startsWith(r)) {
|
|
1363
1363
|
if (e) throw new Error(`unexpected field name ${l}`);
|
|
1364
1364
|
continue;
|
|
1365
1365
|
}
|
|
1366
|
-
|
|
1367
|
-
const
|
|
1368
|
-
let
|
|
1369
|
-
switch (
|
|
1366
|
+
g = g.slice(r.length);
|
|
1367
|
+
const m = w((c = p.groups) == null ? void 0 : c.type);
|
|
1368
|
+
let h = n.get(g);
|
|
1369
|
+
switch (h === void 0 && (h = {}, n.set(g, h)), m) {
|
|
1370
1370
|
case "spec":
|
|
1371
|
-
|
|
1371
|
+
h.spec = (u = o.traverse({
|
|
1372
1372
|
field: l,
|
|
1373
1373
|
ignoreError: t,
|
|
1374
1374
|
pureFieldErrorToUndefined: t
|
|
1375
1375
|
})) == null ? void 0 : u.getDataAsJson();
|
|
1376
1376
|
break;
|
|
1377
1377
|
case "data":
|
|
1378
|
-
|
|
1378
|
+
h.hasData = !0, h.data = () => o.traverseOrError({
|
|
1379
1379
|
field: l,
|
|
1380
1380
|
ignoreError: t
|
|
1381
1381
|
});
|
|
@@ -1383,45 +1383,45 @@ function xt(s, e = !0, t = !1, r = "") {
|
|
|
1383
1383
|
continue;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
const
|
|
1387
|
-
if (
|
|
1388
|
-
for (const [, l] of
|
|
1389
|
-
return { locked:
|
|
1390
|
-
}
|
|
1391
|
-
function
|
|
1392
|
-
if (!
|
|
1393
|
-
const r =
|
|
1394
|
-
|
|
1395
|
-
const
|
|
1396
|
-
for (const [
|
|
1397
|
-
if (
|
|
1398
|
-
if (
|
|
1399
|
-
throw new Error(`no data for key ${
|
|
1400
|
-
const a =
|
|
1401
|
-
if (a === void 0) throw new Error(`no data for key ${
|
|
1402
|
-
if (!a.ok) throw new
|
|
1403
|
-
|
|
1404
|
-
id:
|
|
1405
|
-
spec:
|
|
1386
|
+
const i = o.getInputsLocked();
|
|
1387
|
+
if (i)
|
|
1388
|
+
for (const [, l] of n) l.data === void 0 && (l.hasData = !1);
|
|
1389
|
+
return { locked: i, results: n };
|
|
1390
|
+
}
|
|
1391
|
+
function Js(o, e = !0, t = "") {
|
|
1392
|
+
if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
|
|
1393
|
+
const r = Vt(o, e, !1, t);
|
|
1394
|
+
br(r.locked);
|
|
1395
|
+
const s = {};
|
|
1396
|
+
for (const [n, i] of r.results) {
|
|
1397
|
+
if (i.spec === void 0) throw new Error(`no spec for key ${n}`);
|
|
1398
|
+
if (i.hasData !== !0 || i.data === void 0)
|
|
1399
|
+
throw new Error(`no data for key ${n}`);
|
|
1400
|
+
const a = i.data();
|
|
1401
|
+
if (a === void 0) throw new Error(`no data for key ${n}`);
|
|
1402
|
+
if (!a.ok) throw new fr(a.error);
|
|
1403
|
+
s[n] = {
|
|
1404
|
+
id: It(i.spec, a.value),
|
|
1405
|
+
spec: i.spec,
|
|
1406
1406
|
data: a.value
|
|
1407
1407
|
};
|
|
1408
1408
|
}
|
|
1409
|
-
return
|
|
1409
|
+
return s;
|
|
1410
1410
|
}
|
|
1411
|
-
class
|
|
1411
|
+
class Ke {
|
|
1412
1412
|
constructor(e, t) {
|
|
1413
1413
|
d(this, "allSpecsAvailable");
|
|
1414
1414
|
this.ctx = e, this.blocks = t;
|
|
1415
1415
|
let r = !0;
|
|
1416
|
-
e: for (const
|
|
1417
|
-
for (const
|
|
1418
|
-
if (
|
|
1419
|
-
if (!
|
|
1416
|
+
e: for (const s of t.values())
|
|
1417
|
+
for (const n of [s.prod, s.staging])
|
|
1418
|
+
if (n !== void 0) {
|
|
1419
|
+
if (!n.locked) {
|
|
1420
1420
|
r = !1;
|
|
1421
1421
|
break e;
|
|
1422
1422
|
}
|
|
1423
|
-
for (const
|
|
1424
|
-
if (
|
|
1423
|
+
for (const i of n.results.values())
|
|
1424
|
+
if (i.spec === void 0) {
|
|
1425
1425
|
r = !1;
|
|
1426
1426
|
break e;
|
|
1427
1427
|
}
|
|
@@ -1452,32 +1452,32 @@ class Ne {
|
|
|
1452
1452
|
getDataWithErrors() {
|
|
1453
1453
|
const e = [];
|
|
1454
1454
|
let t = !0, r;
|
|
1455
|
-
const
|
|
1456
|
-
r === void 0 && (r =
|
|
1457
|
-
},
|
|
1455
|
+
const s = (i) => {
|
|
1456
|
+
r === void 0 && (r = i), t = !1;
|
|
1457
|
+
}, n = (i, a, c) => {
|
|
1458
1458
|
if (c.spec !== void 0 && c.hasData === !0 && c.data !== void 0) {
|
|
1459
1459
|
const u = c.data();
|
|
1460
1460
|
u !== void 0 ? e.push({
|
|
1461
|
-
ref: ie(
|
|
1461
|
+
ref: ie(i, a),
|
|
1462
1462
|
obj: {
|
|
1463
|
-
id: u.ok ?
|
|
1463
|
+
id: u.ok ? It(c.spec, u.value) : void 0,
|
|
1464
1464
|
spec: c.spec,
|
|
1465
1465
|
data: u
|
|
1466
1466
|
}
|
|
1467
|
-
}) :
|
|
1467
|
+
}) : s(`no_data:${i}:${a}`);
|
|
1468
1468
|
}
|
|
1469
1469
|
};
|
|
1470
|
-
for (const [
|
|
1470
|
+
for (const [i, a] of this.blocks) {
|
|
1471
1471
|
const c = /* @__PURE__ */ new Set();
|
|
1472
1472
|
if (a.prod !== void 0) {
|
|
1473
|
-
a.prod.locked ||
|
|
1473
|
+
a.prod.locked || s(`prod_not_locked:${i}`);
|
|
1474
1474
|
for (const [u, l] of a.prod.results)
|
|
1475
|
-
c.add(u), i
|
|
1475
|
+
c.add(u), n(i, u, l);
|
|
1476
1476
|
}
|
|
1477
1477
|
if (a.staging !== void 0) {
|
|
1478
|
-
a.staging.locked ||
|
|
1478
|
+
a.staging.locked || s(`staging_not_locked:${i}`);
|
|
1479
1479
|
for (const [u, l] of a.staging.results)
|
|
1480
|
-
c.has(u) || i
|
|
1480
|
+
c.has(u) || n(i, u, l);
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
1483
|
return { entries: e, isComplete: t, instabilityMarker: r };
|
|
@@ -1485,24 +1485,24 @@ class Ne {
|
|
|
1485
1485
|
getSpecs() {
|
|
1486
1486
|
const e = [];
|
|
1487
1487
|
let t = !0, r;
|
|
1488
|
-
const
|
|
1489
|
-
r === void 0 && (r =
|
|
1488
|
+
const s = (n) => {
|
|
1489
|
+
r === void 0 && (r = n), t = !1;
|
|
1490
1490
|
};
|
|
1491
|
-
for (const [
|
|
1491
|
+
for (const [n, i] of this.blocks) {
|
|
1492
1492
|
const a = /* @__PURE__ */ new Set();
|
|
1493
|
-
if (
|
|
1494
|
-
|
|
1495
|
-
for (const [c, u] of
|
|
1493
|
+
if (i.staging !== void 0) {
|
|
1494
|
+
i.staging.locked || s(`staging_not_locked:${n}`);
|
|
1495
|
+
for (const [c, u] of i.staging.results)
|
|
1496
1496
|
u.spec !== void 0 && (e.push({
|
|
1497
|
-
ref: ie(
|
|
1497
|
+
ref: ie(n, c),
|
|
1498
1498
|
obj: u.spec
|
|
1499
1499
|
}), a.add(c));
|
|
1500
|
-
} else
|
|
1501
|
-
if (
|
|
1502
|
-
|
|
1503
|
-
for (const [c, u] of
|
|
1500
|
+
} else s(`staging_not_rendered:${n}`);
|
|
1501
|
+
if (i.prod !== void 0) {
|
|
1502
|
+
i.prod.locked || s(`prod_not_locked:${n}`);
|
|
1503
|
+
for (const [c, u] of i.prod.results)
|
|
1504
1504
|
a.has(c) || u.spec !== void 0 && e.push({
|
|
1505
|
-
ref: ie(
|
|
1505
|
+
ref: ie(n, c),
|
|
1506
1506
|
obj: u.spec
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
@@ -1512,116 +1512,116 @@ class Ne {
|
|
|
1512
1512
|
calculateOptions(e) {
|
|
1513
1513
|
const t = [];
|
|
1514
1514
|
for (const r of this.blocks.values()) {
|
|
1515
|
-
const
|
|
1516
|
-
for (const [a, c] of
|
|
1517
|
-
|
|
1515
|
+
const s = /* @__PURE__ */ new Set(), n = (i) => {
|
|
1516
|
+
for (const [a, c] of i.results)
|
|
1517
|
+
s.has(a) || c.spec === void 0 || (s.add(a), qt(e, c.spec) && t.push({
|
|
1518
1518
|
label: r.info.label + " / " + a,
|
|
1519
1519
|
ref: ie(r.info.id, a),
|
|
1520
1520
|
spec: c.spec
|
|
1521
1521
|
}));
|
|
1522
1522
|
};
|
|
1523
|
-
r.staging !== void 0 &&
|
|
1523
|
+
r.staging !== void 0 && n(r.staging), r.prod !== void 0 && n(r.prod);
|
|
1524
1524
|
}
|
|
1525
1525
|
return t;
|
|
1526
1526
|
}
|
|
1527
1527
|
static create(e, t, r) {
|
|
1528
|
-
const
|
|
1529
|
-
for (const u of
|
|
1528
|
+
const s = e.accessor(t).node(), n = w(s.getKeyValueAsJson(W)), a = je(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
|
|
1529
|
+
for (const u of N(n)) {
|
|
1530
1530
|
if (!a.has(u.id)) continue;
|
|
1531
|
-
const l =
|
|
1532
|
-
|
|
1531
|
+
const l = ut(
|
|
1532
|
+
s.traverse({
|
|
1533
1533
|
field: P(u.id, "prodCtx"),
|
|
1534
1534
|
ignoreError: !0,
|
|
1535
1535
|
pureFieldErrorToUndefined: !0,
|
|
1536
1536
|
stableIfNotFound: !0
|
|
1537
1537
|
}) !== void 0,
|
|
1538
|
-
|
|
1538
|
+
s.traverseOrError({
|
|
1539
1539
|
field: P(u.id, "prodUiCtx"),
|
|
1540
1540
|
stableIfNotFound: !0
|
|
1541
1541
|
})
|
|
1542
|
-
), p =
|
|
1543
|
-
|
|
1542
|
+
), p = ut(
|
|
1543
|
+
s.traverse({
|
|
1544
1544
|
field: P(u.id, "stagingCtx"),
|
|
1545
1545
|
ignoreError: !0,
|
|
1546
1546
|
pureFieldErrorToUndefined: !0
|
|
1547
1547
|
}) !== void 0,
|
|
1548
|
-
|
|
1548
|
+
s.traverseOrError({
|
|
1549
1549
|
field: P(u.id, "stagingUiCtx")
|
|
1550
1550
|
})
|
|
1551
1551
|
);
|
|
1552
1552
|
c.set(u.id, { info: u, prod: l, staging: p });
|
|
1553
1553
|
}
|
|
1554
|
-
return new
|
|
1554
|
+
return new Ke(e, c);
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function ut(o, e) {
|
|
1558
1558
|
if (e === void 0)
|
|
1559
|
-
return
|
|
1560
|
-
if (e.ok) return
|
|
1559
|
+
return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
|
|
1560
|
+
if (e.ok) return Vt(e.value, !1, !0);
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1563
|
-
const t =
|
|
1564
|
-
|
|
1562
|
+
function $e(o, e) {
|
|
1563
|
+
const t = o.persist(), r = w(
|
|
1564
|
+
o.traverse({
|
|
1565
1565
|
field: P(e, "currentArgs"),
|
|
1566
1566
|
errorIfFieldNotSet: !0
|
|
1567
1567
|
}).getDataAsString()
|
|
1568
|
-
),
|
|
1568
|
+
), s = o.getKeyValueAsString(Re(e));
|
|
1569
1569
|
return {
|
|
1570
1570
|
blockId: e,
|
|
1571
1571
|
args: r,
|
|
1572
|
-
uiState:
|
|
1573
|
-
blockMeta: (
|
|
1574
|
-
const
|
|
1575
|
-
for (const u of
|
|
1572
|
+
uiState: s,
|
|
1573
|
+
blockMeta: (n) => {
|
|
1574
|
+
const i = n.accessor(t).node(), a = w(i.getKeyValueAsJson(W)), c = /* @__PURE__ */ new Map();
|
|
1575
|
+
for (const u of N(a)) c.set(u.id, u);
|
|
1576
1576
|
return c;
|
|
1577
1577
|
}
|
|
1578
1578
|
};
|
|
1579
1579
|
}
|
|
1580
|
-
function
|
|
1581
|
-
const t =
|
|
1580
|
+
function Nt(o, e) {
|
|
1581
|
+
const t = o.persist();
|
|
1582
1582
|
return {
|
|
1583
|
-
|
|
1583
|
+
...$e(o, e),
|
|
1584
1584
|
prod: (r) => {
|
|
1585
|
-
var
|
|
1586
|
-
return (
|
|
1585
|
+
var s;
|
|
1586
|
+
return (s = r.accessor(t).node({ ignoreError: !0 }).traverse({
|
|
1587
1587
|
field: P(e, "prodOutput"),
|
|
1588
1588
|
stableIfNotFound: !0,
|
|
1589
1589
|
ignoreError: !0
|
|
1590
|
-
})) == null ? void 0 :
|
|
1590
|
+
})) == null ? void 0 : s.persist();
|
|
1591
1591
|
},
|
|
1592
1592
|
staging: (r) => {
|
|
1593
|
-
var
|
|
1594
|
-
const
|
|
1593
|
+
var n;
|
|
1594
|
+
const s = (n = r.accessor(t).node({ ignoreError: !0 }).traverse({
|
|
1595
1595
|
field: P(e, "stagingOutput"),
|
|
1596
1596
|
ignoreError: !0
|
|
1597
|
-
})) == null ? void 0 :
|
|
1598
|
-
return
|
|
1597
|
+
})) == null ? void 0 : n.persist();
|
|
1598
|
+
return s === void 0 && r.markUnstable("staging_not_rendered"), s;
|
|
1599
1599
|
},
|
|
1600
|
-
getResultsPool: (r) =>
|
|
1600
|
+
getResultsPool: (r) => Ke.create(r, t, e)
|
|
1601
1601
|
};
|
|
1602
1602
|
}
|
|
1603
|
-
function* j(
|
|
1604
|
-
switch (yield
|
|
1603
|
+
function* j(o, e) {
|
|
1604
|
+
switch (yield o, o.type) {
|
|
1605
1605
|
case "GetFromCtx":
|
|
1606
1606
|
case "Immediate":
|
|
1607
1607
|
return;
|
|
1608
1608
|
case "Isolate":
|
|
1609
|
-
yield* j(
|
|
1609
|
+
yield* j(o.cfg);
|
|
1610
1610
|
return;
|
|
1611
1611
|
case "MakeObject":
|
|
1612
|
-
for (const [, t] of Object.entries(
|
|
1612
|
+
for (const [, t] of Object.entries(o.template)) yield* j(t);
|
|
1613
1613
|
return;
|
|
1614
1614
|
case "MakeArray":
|
|
1615
|
-
for (const t of
|
|
1615
|
+
for (const t of o.template) yield* j(t);
|
|
1616
1616
|
return;
|
|
1617
1617
|
case "GetJsonField":
|
|
1618
1618
|
case "GetResourceField":
|
|
1619
|
-
yield* j(
|
|
1619
|
+
yield* j(o.source), yield* j(o.field);
|
|
1620
1620
|
return;
|
|
1621
1621
|
case "MapRecordValues":
|
|
1622
1622
|
case "MapArrayValues":
|
|
1623
1623
|
case "MapResourceFields":
|
|
1624
|
-
yield* j(
|
|
1624
|
+
yield* j(o.source), yield* j(o.mapping);
|
|
1625
1625
|
return;
|
|
1626
1626
|
case "Flatten":
|
|
1627
1627
|
case "GetResourceValueAsJson":
|
|
@@ -1634,153 +1634,153 @@ function* j(s, e) {
|
|
|
1634
1634
|
case "GetLastLogs":
|
|
1635
1635
|
case "GetProgressLog":
|
|
1636
1636
|
case "GetLogHandle":
|
|
1637
|
-
yield* j(
|
|
1637
|
+
yield* j(o.source);
|
|
1638
1638
|
return;
|
|
1639
1639
|
case "IsEmpty":
|
|
1640
|
-
yield* j(
|
|
1640
|
+
yield* j(o.arg);
|
|
1641
1641
|
return;
|
|
1642
1642
|
case "Not":
|
|
1643
|
-
yield* j(
|
|
1643
|
+
yield* j(o.operand);
|
|
1644
1644
|
return;
|
|
1645
1645
|
case "And":
|
|
1646
1646
|
case "Or":
|
|
1647
|
-
yield* j(
|
|
1647
|
+
yield* j(o.operand1), yield* j(o.operand2);
|
|
1648
1648
|
return;
|
|
1649
1649
|
default:
|
|
1650
|
-
D(
|
|
1650
|
+
D(o);
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
|
-
function
|
|
1653
|
+
function Ms(o, e) {
|
|
1654
1654
|
const t = {};
|
|
1655
|
-
for (const [r,
|
|
1655
|
+
for (const [r, s] of Object.entries(o)) t[r] = e(s);
|
|
1656
1656
|
return t;
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1659
|
-
return
|
|
1658
|
+
function pe(o, e) {
|
|
1659
|
+
return o === void 0 ? void 0 : e(o);
|
|
1660
1660
|
}
|
|
1661
|
-
function
|
|
1662
|
-
switch (
|
|
1661
|
+
function Us(o) {
|
|
1662
|
+
switch (o.type) {
|
|
1663
1663
|
case "GetImportProgress":
|
|
1664
1664
|
return !0;
|
|
1665
1665
|
default:
|
|
1666
1666
|
return !1;
|
|
1667
1667
|
}
|
|
1668
1668
|
}
|
|
1669
|
-
function
|
|
1670
|
-
for (const e of j(
|
|
1669
|
+
function Ks(o) {
|
|
1670
|
+
for (const e of j(o)) if (Us(e)) return !0;
|
|
1671
1671
|
return !1;
|
|
1672
1672
|
}
|
|
1673
|
-
function
|
|
1673
|
+
function fe(o) {
|
|
1674
1674
|
return {
|
|
1675
1675
|
type: "ReturnResult",
|
|
1676
|
-
result:
|
|
1676
|
+
result: o
|
|
1677
1677
|
};
|
|
1678
1678
|
}
|
|
1679
|
-
function
|
|
1680
|
-
return () =>
|
|
1679
|
+
function f(o) {
|
|
1680
|
+
return () => fe(o);
|
|
1681
1681
|
}
|
|
1682
|
-
const
|
|
1682
|
+
const $s = (o) => {
|
|
1683
1683
|
const e = {};
|
|
1684
|
-
for (const [t, r] of Object.entries(
|
|
1685
|
-
return
|
|
1686
|
-
},
|
|
1687
|
-
const e =
|
|
1688
|
-
if (e === void 0) return
|
|
1684
|
+
for (const [t, r] of Object.entries(o)) e[t] = r;
|
|
1685
|
+
return f(e);
|
|
1686
|
+
}, Gs = (o) => {
|
|
1687
|
+
const e = o.source;
|
|
1688
|
+
if (e === void 0) return f(void 0);
|
|
1689
1689
|
const t = [];
|
|
1690
1690
|
for (const r of e)
|
|
1691
1691
|
r instanceof Array ? t.push(...r) : t.push(r);
|
|
1692
|
-
return
|
|
1693
|
-
},
|
|
1694
|
-
const e =
|
|
1695
|
-
return e === void 0 || t === void 0 ?
|
|
1696
|
-
var
|
|
1697
|
-
return
|
|
1692
|
+
return f(t);
|
|
1693
|
+
}, Hs = (o) => {
|
|
1694
|
+
const e = o.source, t = o.field;
|
|
1695
|
+
return e === void 0 || t === void 0 ? f(void 0) : ({ cCtx: r }) => {
|
|
1696
|
+
var s;
|
|
1697
|
+
return fe((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
|
|
1698
1698
|
};
|
|
1699
1699
|
};
|
|
1700
|
-
function
|
|
1701
|
-
const t = {}, r =
|
|
1702
|
-
for (let
|
|
1700
|
+
function Lt(o, e) {
|
|
1701
|
+
const t = {}, r = o.length;
|
|
1702
|
+
for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
|
|
1703
1703
|
return t;
|
|
1704
1704
|
}
|
|
1705
|
-
function
|
|
1705
|
+
function _s(o, e) {
|
|
1706
1706
|
return (t) => {
|
|
1707
1707
|
const r = t.source;
|
|
1708
|
-
return r === void 0 ?
|
|
1708
|
+
return r === void 0 ? f(void 0) : () => ({
|
|
1709
1709
|
type: "ScheduleSubroutine",
|
|
1710
|
-
subroutine:
|
|
1711
|
-
args:
|
|
1710
|
+
subroutine: Jt(r.length),
|
|
1711
|
+
args: Lt(r, (s) => v({ ...o, [e.itVar]: s }, e.mapping))
|
|
1712
1712
|
});
|
|
1713
1713
|
};
|
|
1714
1714
|
}
|
|
1715
|
-
function
|
|
1715
|
+
function Jt(o) {
|
|
1716
1716
|
return (e) => {
|
|
1717
1717
|
const t = [];
|
|
1718
|
-
for (let r = 0; r <
|
|
1719
|
-
return
|
|
1718
|
+
for (let r = 0; r < o; r++) t.push(e[String(r)]);
|
|
1719
|
+
return f(t);
|
|
1720
1720
|
};
|
|
1721
1721
|
}
|
|
1722
|
-
function
|
|
1722
|
+
function Ws(o, e) {
|
|
1723
1723
|
return (t) => {
|
|
1724
1724
|
const r = t.source;
|
|
1725
|
-
if (r === void 0) return
|
|
1726
|
-
const
|
|
1727
|
-
for (const [
|
|
1728
|
-
const a = { ...
|
|
1729
|
-
|
|
1725
|
+
if (r === void 0) return f(void 0);
|
|
1726
|
+
const s = {};
|
|
1727
|
+
for (const [n, i] of Object.entries(r)) {
|
|
1728
|
+
const a = { ...o, [e.itVar]: i };
|
|
1729
|
+
s[n] = v(a, e.mapping);
|
|
1730
1730
|
}
|
|
1731
1731
|
return () => ({
|
|
1732
1732
|
type: "ScheduleSubroutine",
|
|
1733
|
-
subroutine:
|
|
1734
|
-
args:
|
|
1733
|
+
subroutine: zs,
|
|
1734
|
+
args: s
|
|
1735
1735
|
});
|
|
1736
1736
|
};
|
|
1737
1737
|
}
|
|
1738
|
-
const
|
|
1739
|
-
const e =
|
|
1740
|
-
return
|
|
1741
|
-
},
|
|
1742
|
-
const e =
|
|
1743
|
-
return
|
|
1744
|
-
},
|
|
1745
|
-
const e =
|
|
1746
|
-
return
|
|
1747
|
-
},
|
|
1748
|
-
const e =
|
|
1749
|
-
return
|
|
1750
|
-
},
|
|
1751
|
-
const e =
|
|
1752
|
-
return e === void 0 ?
|
|
1738
|
+
const zs = (o) => f(o), Ys = (o) => {
|
|
1739
|
+
const e = o.arg;
|
|
1740
|
+
return f(e === void 0 ? void 0 : e.length === 0);
|
|
1741
|
+
}, qs = (o) => {
|
|
1742
|
+
const e = o.operand;
|
|
1743
|
+
return f(e === void 0 ? void 0 : !e);
|
|
1744
|
+
}, Qs = (o) => {
|
|
1745
|
+
const e = o.operand1, t = o.operand2;
|
|
1746
|
+
return f(e === void 0 || t === void 0 ? void 0 : e && t);
|
|
1747
|
+
}, Zs = (o) => {
|
|
1748
|
+
const e = o.operand1, t = o.operand2;
|
|
1749
|
+
return f(e === void 0 || t === void 0 ? void 0 : e || t);
|
|
1750
|
+
}, Xs = (o) => {
|
|
1751
|
+
const e = o.source;
|
|
1752
|
+
return e === void 0 ? f(void 0) : ({ cCtx: t }) => {
|
|
1753
1753
|
var r;
|
|
1754
|
-
return
|
|
1754
|
+
return fe((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
|
|
1755
1755
|
};
|
|
1756
|
-
},
|
|
1757
|
-
const e =
|
|
1758
|
-
return
|
|
1756
|
+
}, eo = (o) => {
|
|
1757
|
+
const e = o.source, t = o.field;
|
|
1758
|
+
return f(e === void 0 || t === void 0 ? void 0 : e[t]);
|
|
1759
1759
|
};
|
|
1760
|
-
function
|
|
1760
|
+
function to(o, e) {
|
|
1761
1761
|
return (t) => {
|
|
1762
1762
|
const r = t.source;
|
|
1763
|
-
return r === void 0 ?
|
|
1764
|
-
const
|
|
1765
|
-
for (const a of
|
|
1766
|
-
const c =
|
|
1767
|
-
if (c === void 0)
|
|
1763
|
+
return r === void 0 ? f(void 0) : ({ cCtx: s }) => {
|
|
1764
|
+
const n = s.accessor(r).node(), i = {};
|
|
1765
|
+
for (const a of n.listInputFields()) {
|
|
1766
|
+
const c = n.traverse(a);
|
|
1767
|
+
if (c === void 0) i[a] = f(void 0);
|
|
1768
1768
|
else {
|
|
1769
|
-
const u = { ...
|
|
1770
|
-
|
|
1769
|
+
const u = { ...o, [e.itVar]: c.persist() };
|
|
1770
|
+
i[a] = v(u, e.mapping);
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
1773
|
return {
|
|
1774
1774
|
type: "ScheduleSubroutine",
|
|
1775
|
-
subroutine:
|
|
1776
|
-
args:
|
|
1775
|
+
subroutine: ro,
|
|
1776
|
+
args: i
|
|
1777
1777
|
};
|
|
1778
1778
|
};
|
|
1779
1779
|
};
|
|
1780
1780
|
}
|
|
1781
|
-
const
|
|
1782
|
-
const e =
|
|
1783
|
-
return e === void 0 ?
|
|
1781
|
+
const ro = (o) => f(o), so = (o) => {
|
|
1782
|
+
const e = o.source;
|
|
1783
|
+
return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
|
|
1784
1784
|
type: "ScheduleComputable",
|
|
1785
1785
|
computable: F.make(
|
|
1786
1786
|
(r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
|
|
@@ -1792,308 +1792,308 @@ const Qo = (s) => g(s), Zo = (s) => {
|
|
|
1792
1792
|
}
|
|
1793
1793
|
)
|
|
1794
1794
|
});
|
|
1795
|
-
},
|
|
1796
|
-
const e =
|
|
1797
|
-
return e === void 0 ?
|
|
1798
|
-
const
|
|
1795
|
+
}, oo = (o) => {
|
|
1796
|
+
const e = o.source;
|
|
1797
|
+
return e === void 0 ? f(void 0) : ({ cCtx: t, drivers: r }) => {
|
|
1798
|
+
const s = t.accessor(e).node().resourceInfo;
|
|
1799
1799
|
return {
|
|
1800
1800
|
type: "ScheduleComputable",
|
|
1801
|
-
computable: F.make(() => r.blobDriver.getDownloadedBlob(
|
|
1802
|
-
postprocessValue: async (
|
|
1801
|
+
computable: F.make(() => r.blobDriver.getDownloadedBlob(s), {
|
|
1802
|
+
postprocessValue: async (n) => n === void 0 ? void 0 : (await r.blobDriver.getContent(n.handle)).toString()
|
|
1803
1803
|
})
|
|
1804
1804
|
};
|
|
1805
1805
|
};
|
|
1806
|
-
},
|
|
1807
|
-
const e =
|
|
1808
|
-
return e === void 0 ?
|
|
1806
|
+
}, no = (o) => {
|
|
1807
|
+
const e = o.source;
|
|
1808
|
+
return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
|
|
1809
1809
|
type: "ScheduleComputable",
|
|
1810
1810
|
computable: F.make(
|
|
1811
1811
|
(r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
|
|
1812
1812
|
{
|
|
1813
1813
|
postprocessValue: async (r) => {
|
|
1814
1814
|
if (r == null) return;
|
|
1815
|
-
const
|
|
1816
|
-
if (
|
|
1817
|
-
return JSON.parse(Buffer.from(
|
|
1815
|
+
const s = await t.blobDriver.getContent(r.handle);
|
|
1816
|
+
if (s != null)
|
|
1817
|
+
return JSON.parse(Buffer.from(s).toString());
|
|
1818
1818
|
}
|
|
1819
1819
|
}
|
|
1820
1820
|
)
|
|
1821
1821
|
});
|
|
1822
|
-
},
|
|
1823
|
-
const e =
|
|
1824
|
-
return e === void 0 ?
|
|
1822
|
+
}, io = (o) => {
|
|
1823
|
+
const e = o.source;
|
|
1824
|
+
return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
|
|
1825
1825
|
type: "ScheduleComputable",
|
|
1826
1826
|
computable: t.blobDriver.getDownloadedBlob(e)
|
|
1827
1827
|
});
|
|
1828
|
-
},
|
|
1829
|
-
const e =
|
|
1830
|
-
return e === void 0 ?
|
|
1828
|
+
}, ao = (o) => {
|
|
1829
|
+
const e = o.source;
|
|
1830
|
+
return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
|
|
1831
1831
|
type: "ScheduleComputable",
|
|
1832
1832
|
computable: t.blobDriver.getOnDemandBlob(e)
|
|
1833
1833
|
});
|
|
1834
|
-
},
|
|
1835
|
-
const e =
|
|
1836
|
-
return e === void 0 ?
|
|
1834
|
+
}, co = (o) => {
|
|
1835
|
+
const e = o.source;
|
|
1836
|
+
return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
|
|
1837
1837
|
type: "ScheduleComputable",
|
|
1838
1838
|
computable: t.uploadDriver.getProgressId(e)
|
|
1839
1839
|
});
|
|
1840
|
-
},
|
|
1840
|
+
}, uo = (o) => (e) => {
|
|
1841
1841
|
const t = e.source;
|
|
1842
|
-
return t === void 0 ?
|
|
1842
|
+
return t === void 0 ? f(void 0) : ({ drivers: r }) => ({
|
|
1843
1843
|
type: "ScheduleComputable",
|
|
1844
|
-
computable: r.logDriver.getLastLogs(t,
|
|
1844
|
+
computable: r.logDriver.getLastLogs(t, o)
|
|
1845
1845
|
});
|
|
1846
|
-
},
|
|
1846
|
+
}, lo = (o) => (e) => {
|
|
1847
1847
|
const t = e.source;
|
|
1848
|
-
return t === void 0 ?
|
|
1848
|
+
return t === void 0 ? f(void 0) : ({ drivers: r }) => ({
|
|
1849
1849
|
type: "ScheduleComputable",
|
|
1850
|
-
computable: r.logDriver.getProgressLog(t,
|
|
1850
|
+
computable: r.logDriver.getProgressLog(t, o)
|
|
1851
1851
|
});
|
|
1852
|
-
},
|
|
1853
|
-
const e =
|
|
1854
|
-
return e === void 0 ?
|
|
1852
|
+
}, po = (o) => {
|
|
1853
|
+
const e = o.source;
|
|
1854
|
+
return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
|
|
1855
1855
|
type: "ScheduleComputable",
|
|
1856
1856
|
computable: t.logDriver.getLogHandle(e)
|
|
1857
1857
|
});
|
|
1858
1858
|
};
|
|
1859
|
-
function
|
|
1859
|
+
function v(o, e) {
|
|
1860
1860
|
switch (e.type) {
|
|
1861
1861
|
case "GetFromCtx":
|
|
1862
|
-
const t =
|
|
1863
|
-
return typeof t == "function" ? (r) =>
|
|
1862
|
+
const t = o[e.variable];
|
|
1863
|
+
return typeof t == "function" ? (r) => fe(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), f(t));
|
|
1864
1864
|
case "Isolate":
|
|
1865
1865
|
return ({ drivers: r }) => ({
|
|
1866
1866
|
type: "ScheduleComputable",
|
|
1867
|
-
computable:
|
|
1867
|
+
computable: $t(r, o, e.cfg)
|
|
1868
1868
|
});
|
|
1869
1869
|
case "Immediate":
|
|
1870
|
-
return
|
|
1870
|
+
return f(e.value);
|
|
1871
1871
|
case "GetJsonField":
|
|
1872
1872
|
return () => ({
|
|
1873
1873
|
type: "ScheduleSubroutine",
|
|
1874
|
-
subroutine:
|
|
1874
|
+
subroutine: eo,
|
|
1875
1875
|
args: {
|
|
1876
|
-
source:
|
|
1877
|
-
field:
|
|
1876
|
+
source: v(o, e.source),
|
|
1877
|
+
field: v(o, e.field)
|
|
1878
1878
|
}
|
|
1879
1879
|
});
|
|
1880
1880
|
case "MapArrayValues":
|
|
1881
1881
|
return () => ({
|
|
1882
1882
|
type: "ScheduleSubroutine",
|
|
1883
|
-
subroutine:
|
|
1883
|
+
subroutine: _s(o, e),
|
|
1884
1884
|
args: {
|
|
1885
|
-
source:
|
|
1885
|
+
source: v(o, e.source)
|
|
1886
1886
|
}
|
|
1887
1887
|
});
|
|
1888
1888
|
case "MapRecordValues":
|
|
1889
1889
|
return () => ({
|
|
1890
1890
|
type: "ScheduleSubroutine",
|
|
1891
|
-
subroutine:
|
|
1891
|
+
subroutine: Ws(o, e),
|
|
1892
1892
|
args: {
|
|
1893
|
-
source:
|
|
1893
|
+
source: v(o, e.source)
|
|
1894
1894
|
}
|
|
1895
1895
|
});
|
|
1896
1896
|
case "MakeObject":
|
|
1897
1897
|
return () => ({
|
|
1898
1898
|
type: "ScheduleSubroutine",
|
|
1899
|
-
subroutine:
|
|
1900
|
-
args:
|
|
1899
|
+
subroutine: $s,
|
|
1900
|
+
args: Ms(e.template, (r) => v(o, r))
|
|
1901
1901
|
});
|
|
1902
1902
|
case "MakeArray":
|
|
1903
1903
|
return () => ({
|
|
1904
1904
|
type: "ScheduleSubroutine",
|
|
1905
|
-
subroutine:
|
|
1906
|
-
args:
|
|
1905
|
+
subroutine: Jt(e.template.length),
|
|
1906
|
+
args: Lt(e.template, (r) => v(o, r))
|
|
1907
1907
|
});
|
|
1908
1908
|
case "Flatten":
|
|
1909
1909
|
return () => ({
|
|
1910
1910
|
type: "ScheduleSubroutine",
|
|
1911
|
-
subroutine:
|
|
1911
|
+
subroutine: Gs,
|
|
1912
1912
|
args: {
|
|
1913
|
-
source:
|
|
1913
|
+
source: v(o, e.source)
|
|
1914
1914
|
}
|
|
1915
1915
|
});
|
|
1916
1916
|
case "IsEmpty":
|
|
1917
1917
|
return () => ({
|
|
1918
1918
|
type: "ScheduleSubroutine",
|
|
1919
|
-
subroutine:
|
|
1919
|
+
subroutine: Ys,
|
|
1920
1920
|
args: {
|
|
1921
|
-
arg:
|
|
1921
|
+
arg: v(o, e.arg)
|
|
1922
1922
|
}
|
|
1923
1923
|
});
|
|
1924
1924
|
case "Not":
|
|
1925
1925
|
return () => ({
|
|
1926
1926
|
type: "ScheduleSubroutine",
|
|
1927
|
-
subroutine:
|
|
1927
|
+
subroutine: qs,
|
|
1928
1928
|
args: {
|
|
1929
|
-
operand:
|
|
1929
|
+
operand: v(o, e.operand)
|
|
1930
1930
|
}
|
|
1931
1931
|
});
|
|
1932
1932
|
case "And":
|
|
1933
1933
|
return () => ({
|
|
1934
1934
|
type: "ScheduleSubroutine",
|
|
1935
|
-
subroutine:
|
|
1935
|
+
subroutine: Qs,
|
|
1936
1936
|
args: {
|
|
1937
|
-
operand1:
|
|
1938
|
-
operand2:
|
|
1937
|
+
operand1: v(o, e.operand1),
|
|
1938
|
+
operand2: v(o, e.operand2)
|
|
1939
1939
|
}
|
|
1940
1940
|
});
|
|
1941
1941
|
case "Or":
|
|
1942
1942
|
return () => ({
|
|
1943
1943
|
type: "ScheduleSubroutine",
|
|
1944
|
-
subroutine:
|
|
1944
|
+
subroutine: Zs,
|
|
1945
1945
|
args: {
|
|
1946
|
-
operand1:
|
|
1947
|
-
operand2:
|
|
1946
|
+
operand1: v(o, e.operand1),
|
|
1947
|
+
operand2: v(o, e.operand2)
|
|
1948
1948
|
}
|
|
1949
1949
|
});
|
|
1950
1950
|
case "MapResourceFields":
|
|
1951
1951
|
return () => ({
|
|
1952
1952
|
type: "ScheduleSubroutine",
|
|
1953
|
-
subroutine:
|
|
1953
|
+
subroutine: to(o, e),
|
|
1954
1954
|
args: {
|
|
1955
|
-
source:
|
|
1955
|
+
source: v(o, e.source)
|
|
1956
1956
|
}
|
|
1957
1957
|
});
|
|
1958
1958
|
case "GetResourceField":
|
|
1959
1959
|
return () => ({
|
|
1960
1960
|
type: "ScheduleSubroutine",
|
|
1961
|
-
subroutine:
|
|
1961
|
+
subroutine: Hs,
|
|
1962
1962
|
args: {
|
|
1963
|
-
source:
|
|
1964
|
-
field:
|
|
1963
|
+
source: v(o, e.source),
|
|
1964
|
+
field: v(o, e.field)
|
|
1965
1965
|
}
|
|
1966
1966
|
});
|
|
1967
1967
|
case "GetResourceValueAsJson":
|
|
1968
1968
|
return () => ({
|
|
1969
1969
|
type: "ScheduleSubroutine",
|
|
1970
|
-
subroutine:
|
|
1970
|
+
subroutine: Xs,
|
|
1971
1971
|
args: {
|
|
1972
|
-
source:
|
|
1972
|
+
source: v(o, e.source)
|
|
1973
1973
|
}
|
|
1974
1974
|
});
|
|
1975
1975
|
case "GetBlobContent":
|
|
1976
1976
|
return () => ({
|
|
1977
1977
|
type: "ScheduleSubroutine",
|
|
1978
|
-
subroutine:
|
|
1978
|
+
subroutine: so,
|
|
1979
1979
|
args: {
|
|
1980
|
-
source:
|
|
1980
|
+
source: v(o, e.source)
|
|
1981
1981
|
}
|
|
1982
1982
|
});
|
|
1983
1983
|
case "GetBlobContentAsString":
|
|
1984
1984
|
return () => ({
|
|
1985
1985
|
type: "ScheduleSubroutine",
|
|
1986
|
-
subroutine:
|
|
1986
|
+
subroutine: oo,
|
|
1987
1987
|
args: {
|
|
1988
|
-
source:
|
|
1988
|
+
source: v(o, e.source)
|
|
1989
1989
|
}
|
|
1990
1990
|
});
|
|
1991
1991
|
case "GetBlobContentAsJson":
|
|
1992
1992
|
return () => ({
|
|
1993
1993
|
type: "ScheduleSubroutine",
|
|
1994
|
-
subroutine:
|
|
1994
|
+
subroutine: no,
|
|
1995
1995
|
args: {
|
|
1996
|
-
source:
|
|
1996
|
+
source: v(o, e.source)
|
|
1997
1997
|
}
|
|
1998
1998
|
});
|
|
1999
1999
|
case "GetDownloadedBlobContent":
|
|
2000
2000
|
return () => ({
|
|
2001
2001
|
type: "ScheduleSubroutine",
|
|
2002
|
-
subroutine:
|
|
2002
|
+
subroutine: io,
|
|
2003
2003
|
args: {
|
|
2004
|
-
source:
|
|
2004
|
+
source: v(o, e.source)
|
|
2005
2005
|
}
|
|
2006
2006
|
});
|
|
2007
2007
|
case "GetOnDemandBlobContent":
|
|
2008
2008
|
return () => ({
|
|
2009
2009
|
type: "ScheduleSubroutine",
|
|
2010
|
-
subroutine:
|
|
2010
|
+
subroutine: ao,
|
|
2011
2011
|
args: {
|
|
2012
|
-
source:
|
|
2012
|
+
source: v(o, e.source)
|
|
2013
2013
|
}
|
|
2014
2014
|
});
|
|
2015
2015
|
case "GetImportProgress":
|
|
2016
2016
|
return () => ({
|
|
2017
2017
|
type: "ScheduleSubroutine",
|
|
2018
|
-
subroutine:
|
|
2018
|
+
subroutine: co,
|
|
2019
2019
|
args: {
|
|
2020
|
-
source:
|
|
2020
|
+
source: v(o, e.source)
|
|
2021
2021
|
}
|
|
2022
2022
|
});
|
|
2023
2023
|
case "GetLastLogs":
|
|
2024
2024
|
return () => ({
|
|
2025
2025
|
type: "ScheduleSubroutine",
|
|
2026
|
-
subroutine:
|
|
2026
|
+
subroutine: uo(e.lines),
|
|
2027
2027
|
args: {
|
|
2028
|
-
source:
|
|
2028
|
+
source: v(o, e.source)
|
|
2029
2029
|
}
|
|
2030
2030
|
});
|
|
2031
2031
|
case "GetProgressLog":
|
|
2032
2032
|
return () => ({
|
|
2033
2033
|
type: "ScheduleSubroutine",
|
|
2034
|
-
subroutine:
|
|
2034
|
+
subroutine: lo(e.patternToSearch),
|
|
2035
2035
|
args: {
|
|
2036
|
-
source:
|
|
2036
|
+
source: v(o, e.source)
|
|
2037
2037
|
}
|
|
2038
2038
|
});
|
|
2039
2039
|
case "GetLogHandle":
|
|
2040
2040
|
return () => ({
|
|
2041
2041
|
type: "ScheduleSubroutine",
|
|
2042
|
-
subroutine:
|
|
2042
|
+
subroutine: po,
|
|
2043
2043
|
args: {
|
|
2044
|
-
source:
|
|
2044
|
+
source: v(o, e.source)
|
|
2045
2045
|
}
|
|
2046
2046
|
});
|
|
2047
2047
|
default:
|
|
2048
2048
|
return D(e);
|
|
2049
2049
|
}
|
|
2050
2050
|
}
|
|
2051
|
-
const
|
|
2052
|
-
function
|
|
2051
|
+
const go = ["$prod", "$staging"];
|
|
2052
|
+
function ho(o) {
|
|
2053
2053
|
return {
|
|
2054
|
-
$blockId:
|
|
2055
|
-
$args: JSON.parse(
|
|
2056
|
-
$ui:
|
|
2057
|
-
$prod:
|
|
2058
|
-
$staging:
|
|
2054
|
+
$blockId: o.blockId,
|
|
2055
|
+
$args: JSON.parse(o.args),
|
|
2056
|
+
$ui: o.uiState !== void 0 ? JSON.parse(o.uiState) : void 0,
|
|
2057
|
+
$prod: o.prod,
|
|
2058
|
+
$staging: o.staging
|
|
2059
2059
|
};
|
|
2060
2060
|
}
|
|
2061
|
-
const
|
|
2062
|
-
function
|
|
2063
|
-
return
|
|
2061
|
+
const Mt = Symbol(), Ut = "return", fo = { op: Mt, arg: Ut };
|
|
2062
|
+
function mo(o) {
|
|
2063
|
+
return o.op == Mt && o.arg == Ut;
|
|
2064
2064
|
}
|
|
2065
|
-
function
|
|
2065
|
+
function vo() {
|
|
2066
2066
|
return { pendingSubroutines: /* @__PURE__ */ new Map() };
|
|
2067
2067
|
}
|
|
2068
|
-
function
|
|
2069
|
-
const
|
|
2070
|
-
if (
|
|
2068
|
+
function lt(o, e, t, r) {
|
|
2069
|
+
const s = new St(t), n = (a, c) => {
|
|
2070
|
+
if (mo(a))
|
|
2071
2071
|
return e.result = c, !1;
|
|
2072
2072
|
const u = w(e.pendingSubroutines.get(a.op));
|
|
2073
2073
|
if (a.arg in u.args) throw new Error("argument already set");
|
|
2074
|
-
return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op),
|
|
2074
|
+
return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op), s.push({
|
|
2075
2075
|
destination: u.destination,
|
|
2076
2076
|
operation: u.subroutine(u.args)
|
|
2077
2077
|
})), !0;
|
|
2078
|
-
},
|
|
2079
|
-
e: for (;
|
|
2080
|
-
const a =
|
|
2078
|
+
}, i = [];
|
|
2079
|
+
e: for (; s.length > 0; ) {
|
|
2080
|
+
const a = s.shift(), c = a.operation(o);
|
|
2081
2081
|
switch (c.type) {
|
|
2082
2082
|
case "ReturnResult":
|
|
2083
|
-
if (!
|
|
2083
|
+
if (!n(a.destination, c.result)) break e;
|
|
2084
2084
|
break;
|
|
2085
2085
|
case "ScheduleSubroutine":
|
|
2086
2086
|
const u = Symbol(), l = Object.entries(c.args), p = l.length;
|
|
2087
2087
|
if (p === 0)
|
|
2088
|
-
|
|
2088
|
+
s.push({
|
|
2089
2089
|
destination: a.destination,
|
|
2090
2090
|
operation: c.subroutine({})
|
|
2091
2091
|
});
|
|
2092
2092
|
else {
|
|
2093
|
-
for (const [
|
|
2094
|
-
|
|
2095
|
-
destination: { op: u, arg:
|
|
2096
|
-
operation:
|
|
2093
|
+
for (const [g, m] of l)
|
|
2094
|
+
s.push({
|
|
2095
|
+
destination: { op: u, arg: g },
|
|
2096
|
+
operation: m
|
|
2097
2097
|
});
|
|
2098
2098
|
e.pendingSubroutines.set(u, {
|
|
2099
2099
|
argCounter: p,
|
|
@@ -2106,7 +2106,7 @@ function it(s, e, t, r) {
|
|
|
2106
2106
|
case "ScheduleComputable":
|
|
2107
2107
|
if (!r)
|
|
2108
2108
|
throw new Error("asynchronous operations are forbidden in this context");
|
|
2109
|
-
|
|
2109
|
+
i.push({
|
|
2110
2110
|
destination: a.destination,
|
|
2111
2111
|
computable: c.computable
|
|
2112
2112
|
});
|
|
@@ -2115,27 +2115,27 @@ function it(s, e, t, r) {
|
|
|
2115
2115
|
D(c);
|
|
2116
2116
|
}
|
|
2117
2117
|
}
|
|
2118
|
-
return
|
|
2118
|
+
return i;
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2121
|
-
return
|
|
2120
|
+
function Kt(o, e, t, r = {}) {
|
|
2121
|
+
return $t(o, ho(e), t, r);
|
|
2122
2122
|
}
|
|
2123
|
-
function
|
|
2124
|
-
const
|
|
2125
|
-
ctx: Object.fromEntries(Object.entries(e).filter(([
|
|
2123
|
+
function $t(o, e, t, r = {}) {
|
|
2124
|
+
const s = Ve({
|
|
2125
|
+
ctx: Object.fromEntries(Object.entries(e).filter(([n]) => go.indexOf(n) === -1)),
|
|
2126
2126
|
cfg: t
|
|
2127
2127
|
});
|
|
2128
2128
|
return F.makeRaw(
|
|
2129
|
-
(
|
|
2130
|
-
const
|
|
2129
|
+
(n) => {
|
|
2130
|
+
const i = { drivers: o, cCtx: n }, a = vo();
|
|
2131
2131
|
return {
|
|
2132
|
-
ir:
|
|
2133
|
-
|
|
2132
|
+
ir: lt(
|
|
2133
|
+
i,
|
|
2134
2134
|
a,
|
|
2135
2135
|
[
|
|
2136
2136
|
{
|
|
2137
|
-
destination:
|
|
2138
|
-
operation:
|
|
2137
|
+
destination: fo,
|
|
2138
|
+
operation: v(e, t)
|
|
2139
2139
|
}
|
|
2140
2140
|
],
|
|
2141
2141
|
!0
|
|
@@ -2143,36 +2143,36 @@ function Lt(s, e, t, r = {}) {
|
|
|
2143
2143
|
async postprocessValue(u, l) {
|
|
2144
2144
|
const p = [];
|
|
2145
2145
|
for (const C of u)
|
|
2146
|
-
p.push({ destination: C.destination, operation:
|
|
2147
|
-
const
|
|
2148
|
-
drivers:
|
|
2146
|
+
p.push({ destination: C.destination, operation: f(C.computable) });
|
|
2147
|
+
const g = {
|
|
2148
|
+
drivers: o,
|
|
2149
2149
|
get cCtx() {
|
|
2150
2150
|
throw new Error("asynchronous operations are forbidden in this context");
|
|
2151
2151
|
}
|
|
2152
|
-
},
|
|
2152
|
+
}, m = /* @__PURE__ */ new Map();
|
|
2153
2153
|
for (const [C, I] of a.pendingSubroutines)
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2154
|
+
m.set(C, { ...I, args: { ...I.args } });
|
|
2155
|
+
const h = {
|
|
2156
2156
|
result: a.result,
|
|
2157
|
-
pendingSubroutines:
|
|
2157
|
+
pendingSubroutines: m
|
|
2158
2158
|
};
|
|
2159
|
-
if (
|
|
2159
|
+
if (lt(g, h, p, !1), !("result" in h))
|
|
2160
2160
|
throw new Error("illegal cfg rendering stack state, no result");
|
|
2161
|
-
return
|
|
2161
|
+
return h.result;
|
|
2162
2162
|
}
|
|
2163
2163
|
};
|
|
2164
2164
|
},
|
|
2165
|
-
{ ...r, key:
|
|
2165
|
+
{ ...r, key: s }
|
|
2166
2166
|
);
|
|
2167
2167
|
}
|
|
2168
|
-
function
|
|
2169
|
-
return
|
|
2168
|
+
function yo(o) {
|
|
2169
|
+
return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
|
|
2170
2170
|
}
|
|
2171
|
-
function
|
|
2172
|
-
return
|
|
2171
|
+
function dt(o) {
|
|
2172
|
+
return o !== void 0 ? Buffer.from(o).toString("base64") : void 0;
|
|
2173
2173
|
}
|
|
2174
|
-
class
|
|
2175
|
-
constructor(e, t, r,
|
|
2174
|
+
class ge {
|
|
2175
|
+
constructor(e, t, r, s, n) {
|
|
2176
2176
|
d(this, "callbackRegistry");
|
|
2177
2177
|
d(this, "fnJSONStringify");
|
|
2178
2178
|
d(this, "fnJSONParse");
|
|
@@ -2184,14 +2184,14 @@ class pe {
|
|
|
2184
2184
|
// Result Pool
|
|
2185
2185
|
//
|
|
2186
2186
|
d(this, "_resultPool");
|
|
2187
|
-
if (this.scope = e, this.vm = t, this.blockCtx = r, this.env =
|
|
2188
|
-
t.getProp(t.global, "JSON").consume((
|
|
2187
|
+
if (this.scope = e, this.vm = t, this.blockCtx = r, this.env = s, this.computableCtx = n, this.callbackRegistry = this.scope.manage(this.vm.newObject()), this.fnJSONStringify = e.manage(
|
|
2188
|
+
t.getProp(t.global, "JSON").consume((i) => t.getProp(i, "stringify"))
|
|
2189
2189
|
), t.typeof(this.fnJSONStringify) !== "function")
|
|
2190
2190
|
throw new Error("JSON.stringify() not found.");
|
|
2191
2191
|
if (this.fnJSONParse = e.manage(
|
|
2192
|
-
t.getProp(t.global, "JSON").consume((
|
|
2192
|
+
t.getProp(t.global, "JSON").consume((i) => t.getProp(i, "parse"))
|
|
2193
2193
|
), t.typeof(this.fnJSONParse) !== "function") throw new Error("JSON.parse() not found.");
|
|
2194
|
-
this.meta = r.blockMeta(
|
|
2194
|
+
this.meta = r.blockMeta(n), this.injectCtx();
|
|
2195
2195
|
}
|
|
2196
2196
|
resetComputableCtx() {
|
|
2197
2197
|
this.computableCtx = void 0, this.accessors.clear();
|
|
@@ -2203,27 +2203,27 @@ class pe {
|
|
|
2203
2203
|
try {
|
|
2204
2204
|
this.vm.unwrapResult(this.vm.evalCode(e, "bundle.js", { type: "global" })).dispose();
|
|
2205
2205
|
} catch (t) {
|
|
2206
|
-
throw
|
|
2206
|
+
throw ge.cleanErrorContext(t), t;
|
|
2207
2207
|
}
|
|
2208
2208
|
}
|
|
2209
2209
|
runCallback(e, ...t) {
|
|
2210
2210
|
try {
|
|
2211
|
-
return
|
|
2212
|
-
const
|
|
2213
|
-
if (this.vm.typeof(
|
|
2211
|
+
return Fe.withScope((r) => {
|
|
2212
|
+
const s = r.manage(this.vm.getProp(this.callbackRegistry, e));
|
|
2213
|
+
if (this.vm.typeof(s) !== "function")
|
|
2214
2214
|
throw new Error(`No such callback: ${e}`);
|
|
2215
2215
|
return this.scope.manage(
|
|
2216
2216
|
this.vm.unwrapResult(
|
|
2217
2217
|
this.vm.callFunction(
|
|
2218
|
-
|
|
2218
|
+
s,
|
|
2219
2219
|
this.vm.undefined,
|
|
2220
|
-
...t.map((
|
|
2220
|
+
...t.map((n) => this.exportObjectUniversal(n, r))
|
|
2221
2221
|
)
|
|
2222
2222
|
)
|
|
2223
2223
|
);
|
|
2224
2224
|
});
|
|
2225
2225
|
} catch (r) {
|
|
2226
|
-
throw
|
|
2226
|
+
throw ge.cleanErrorContext(r), r;
|
|
2227
2227
|
}
|
|
2228
2228
|
}
|
|
2229
2229
|
//
|
|
@@ -2232,12 +2232,12 @@ class pe {
|
|
|
2232
2232
|
getAccessorHandleByName(e) {
|
|
2233
2233
|
if (this.computableCtx === void 0)
|
|
2234
2234
|
throw new Error("Accessors can't be used in this context");
|
|
2235
|
-
const t = (r,
|
|
2235
|
+
const t = (r, s) => {
|
|
2236
2236
|
if (!this.accessors.has(r)) {
|
|
2237
|
-
const
|
|
2238
|
-
if (
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2237
|
+
const n = this.blockCtx[s];
|
|
2238
|
+
if (n === void 0) throw new Error("Staging context not available");
|
|
2239
|
+
const i = n(this.computableCtx);
|
|
2240
|
+
i ? this.accessors.set(r, this.computableCtx.accessor(i).node({ ignoreError: !0 })) : this.accessors.set(r, void 0);
|
|
2241
2241
|
}
|
|
2242
2242
|
return this.accessors.get(r) ? r : void 0;
|
|
2243
2243
|
};
|
|
@@ -2278,13 +2278,13 @@ class pe {
|
|
|
2278
2278
|
return this.getAccessor(e).listDynamicFields();
|
|
2279
2279
|
}
|
|
2280
2280
|
getKeyValueBase64(e, t) {
|
|
2281
|
-
return
|
|
2281
|
+
return dt(this.getAccessor(e).getKeyValue(t));
|
|
2282
2282
|
}
|
|
2283
2283
|
getKeyValueAsString(e, t) {
|
|
2284
2284
|
return this.getAccessor(e).getKeyValueAsString(t);
|
|
2285
2285
|
}
|
|
2286
2286
|
getDataBase64(e) {
|
|
2287
|
-
return
|
|
2287
|
+
return dt(this.getAccessor(e).getData());
|
|
2288
2288
|
}
|
|
2289
2289
|
getDataAsString(e) {
|
|
2290
2290
|
return this.getAccessor(e).getDataAsString();
|
|
@@ -2293,18 +2293,18 @@ class pe {
|
|
|
2293
2293
|
// Accessor helpers
|
|
2294
2294
|
//
|
|
2295
2295
|
parsePObjectCollection(e, t, r) {
|
|
2296
|
-
const
|
|
2297
|
-
if (!
|
|
2298
|
-
const
|
|
2299
|
-
for (const [a, c] of Object.entries(
|
|
2300
|
-
|
|
2301
|
-
return
|
|
2296
|
+
const s = this.getAccessor(e);
|
|
2297
|
+
if (!s.getIsReadyOrError()) return;
|
|
2298
|
+
const n = Js(s, t, r), i = {};
|
|
2299
|
+
for (const [a, c] of Object.entries(n))
|
|
2300
|
+
i[a] = Z(c, (u) => this.wrapAccessor(u));
|
|
2301
|
+
return i;
|
|
2302
2302
|
}
|
|
2303
2303
|
//
|
|
2304
2304
|
// Blobs
|
|
2305
2305
|
//
|
|
2306
2306
|
registerComputable(e, t) {
|
|
2307
|
-
const r = `${e}_${
|
|
2307
|
+
const r = `${e}_${ee()}`;
|
|
2308
2308
|
return this.computablesToResolve[r] = t, r;
|
|
2309
2309
|
}
|
|
2310
2310
|
getBlobContentAsString(e) {
|
|
@@ -2413,7 +2413,7 @@ class pe {
|
|
|
2413
2413
|
isComplete: e.isComplete,
|
|
2414
2414
|
entries: e.entries.map((t) => ({
|
|
2415
2415
|
ref: t.ref,
|
|
2416
|
-
obj:
|
|
2416
|
+
obj: Z(t.obj, (r) => this.wrapAccessor(r))
|
|
2417
2417
|
}))
|
|
2418
2418
|
};
|
|
2419
2419
|
}
|
|
@@ -2426,7 +2426,7 @@ class pe {
|
|
|
2426
2426
|
obj: {
|
|
2427
2427
|
id: t.obj.id,
|
|
2428
2428
|
spec: t.obj.spec,
|
|
2429
|
-
data:
|
|
2429
|
+
data: Qt(t.obj.data, (r) => this.wrapAccessor(r))
|
|
2430
2430
|
}
|
|
2431
2431
|
}))
|
|
2432
2432
|
};
|
|
@@ -2444,7 +2444,7 @@ class pe {
|
|
|
2444
2444
|
"can't instantiate PFrames from this context (most porbably called from the future mapper)"
|
|
2445
2445
|
);
|
|
2446
2446
|
return this.env.driverKit.pFrameDriver.createPFrame(
|
|
2447
|
-
e.map((t) =>
|
|
2447
|
+
e.map((t) => Z(t, (r) => this.getAccessor(r))),
|
|
2448
2448
|
this.computableCtx
|
|
2449
2449
|
);
|
|
2450
2450
|
}
|
|
@@ -2454,7 +2454,7 @@ class pe {
|
|
|
2454
2454
|
"can't instantiate PTable from this context (most porbably called from the future mapper)"
|
|
2455
2455
|
);
|
|
2456
2456
|
return this.env.driverKit.pFrameDriver.createPTable(
|
|
2457
|
-
|
|
2457
|
+
ht(e, (t) => Z(t, (r) => this.getAccessor(r))),
|
|
2458
2458
|
this.computableCtx
|
|
2459
2459
|
);
|
|
2460
2460
|
}
|
|
@@ -2468,7 +2468,7 @@ class pe {
|
|
|
2468
2468
|
}
|
|
2469
2469
|
wrapAccessor(e) {
|
|
2470
2470
|
if (e !== void 0) {
|
|
2471
|
-
const t =
|
|
2471
|
+
const t = ee();
|
|
2472
2472
|
return this.accessors.set(t, e), t;
|
|
2473
2473
|
}
|
|
2474
2474
|
}
|
|
@@ -2481,13 +2481,13 @@ class pe {
|
|
|
2481
2481
|
return r;
|
|
2482
2482
|
}
|
|
2483
2483
|
tryExportSingleValue(e, t) {
|
|
2484
|
-
let r,
|
|
2484
|
+
let r, s = !1;
|
|
2485
2485
|
switch (typeof e) {
|
|
2486
2486
|
case "string":
|
|
2487
|
-
r = this.vm.newString(e),
|
|
2487
|
+
r = this.vm.newString(e), s = !0;
|
|
2488
2488
|
break;
|
|
2489
2489
|
case "number":
|
|
2490
|
-
r = this.vm.newNumber(e),
|
|
2490
|
+
r = this.vm.newNumber(e), s = !0;
|
|
2491
2491
|
break;
|
|
2492
2492
|
case "undefined":
|
|
2493
2493
|
r = this.vm.undefined;
|
|
@@ -2500,13 +2500,13 @@ class pe {
|
|
|
2500
2500
|
r = this.vm.null;
|
|
2501
2501
|
break;
|
|
2502
2502
|
}
|
|
2503
|
-
if (
|
|
2504
|
-
r = this.vm.newArrayBuffer(e),
|
|
2503
|
+
if (yo(e)) {
|
|
2504
|
+
r = this.vm.newArrayBuffer(e), s = !0;
|
|
2505
2505
|
break;
|
|
2506
2506
|
}
|
|
2507
2507
|
return;
|
|
2508
2508
|
}
|
|
2509
|
-
return
|
|
2509
|
+
return s && t != null ? t.manage(r) : r;
|
|
2510
2510
|
}
|
|
2511
2511
|
exportObjectUniversal(e, t) {
|
|
2512
2512
|
const r = this.tryExportSingleValue(e, t);
|
|
@@ -2514,7 +2514,7 @@ class pe {
|
|
|
2514
2514
|
}
|
|
2515
2515
|
exportObjectViaJson(e, t) {
|
|
2516
2516
|
const r = this.vm.newString(JSON.stringify(e)).consume(
|
|
2517
|
-
(
|
|
2517
|
+
(s) => this.vm.unwrapResult(this.vm.callFunction(this.fnJSONParse, this.vm.undefined, s))
|
|
2518
2518
|
);
|
|
2519
2519
|
return t !== void 0 ? t.manage(r) : r;
|
|
2520
2520
|
}
|
|
@@ -2536,233 +2536,233 @@ class pe {
|
|
|
2536
2536
|
return JSON.parse(t);
|
|
2537
2537
|
}
|
|
2538
2538
|
injectCtx() {
|
|
2539
|
-
|
|
2539
|
+
Fe.withScope((e) => {
|
|
2540
2540
|
const t = e.manage(this.vm.newObject());
|
|
2541
2541
|
this.vm.setProp(t, "args", e.manage(this.vm.newString(this.blockCtx.args))), this.blockCtx.uiState !== void 0 && this.vm.setProp(
|
|
2542
2542
|
t,
|
|
2543
2543
|
"uiState",
|
|
2544
2544
|
e.manage(this.vm.newString(this.blockCtx.uiState))
|
|
2545
2545
|
), this.vm.setProp(t, "callbackRegistry", this.callbackRegistry);
|
|
2546
|
-
const r = (
|
|
2547
|
-
this.vm.newFunction(
|
|
2546
|
+
const r = (s, n) => {
|
|
2547
|
+
this.vm.newFunction(s, n).consume((i) => this.vm.setProp(t, s, i));
|
|
2548
2548
|
};
|
|
2549
|
-
r("getAccessorHandleByName", (
|
|
2550
|
-
this.getAccessorHandleByName(this.vm.getString(
|
|
2549
|
+
r("getAccessorHandleByName", (s) => this.exportSingleValue(
|
|
2550
|
+
this.getAccessorHandleByName(this.vm.getString(s)),
|
|
2551
2551
|
void 0
|
|
2552
|
-
)), r("resolveWithCommon", (
|
|
2552
|
+
)), r("resolveWithCommon", (s, n, ...i) => this.exportSingleValue(
|
|
2553
2553
|
this.resolveWithCommon(
|
|
2554
|
-
this.vm.getString(
|
|
2555
|
-
this.importObjectViaJson(
|
|
2556
|
-
...
|
|
2554
|
+
this.vm.getString(s),
|
|
2555
|
+
this.importObjectViaJson(n),
|
|
2556
|
+
...i.map(
|
|
2557
2557
|
(a) => this.importObjectViaJson(a)
|
|
2558
2558
|
)
|
|
2559
2559
|
),
|
|
2560
2560
|
void 0
|
|
2561
|
-
)), r("getResourceType", (
|
|
2562
|
-
this.getKeyValueBase64(this.vm.getString(
|
|
2561
|
+
)), r("getResourceType", (s) => this.exportObjectViaJson(this.getResourceType(this.vm.getString(s)), void 0)), r("getInputsLocked", (s) => this.exportSingleValue(this.getInputsLocked(this.vm.getString(s)), void 0)), r("getOutputsLocked", (s) => this.exportSingleValue(this.getOutputsLocked(this.vm.getString(s)), void 0)), r("getIsReadyOrError", (s) => this.exportSingleValue(this.getIsReadyOrError(this.vm.getString(s)), void 0)), r("getIsFinal", (s) => this.exportSingleValue(this.getIsFinal(this.vm.getString(s)), void 0)), r("getError", (s) => this.exportSingleValue(this.getError(this.vm.getString(s)), void 0)), r("listInputFields", (s) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(s)), void 0)), r("listOutputFields", (s) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(s)), void 0)), r("listDynamicFields", (s) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(s)), void 0)), r("getKeyValueBase64", (s, n) => this.exportSingleValue(
|
|
2562
|
+
this.getKeyValueBase64(this.vm.getString(s), this.vm.getString(n)),
|
|
2563
2563
|
void 0
|
|
2564
|
-
)), r("getKeyValueAsString", (
|
|
2565
|
-
this.getKeyValueAsString(this.vm.getString(
|
|
2564
|
+
)), r("getKeyValueAsString", (s, n) => this.exportSingleValue(
|
|
2565
|
+
this.getKeyValueAsString(this.vm.getString(s), this.vm.getString(n)),
|
|
2566
2566
|
void 0
|
|
2567
|
-
)), r("getDataBase64", (
|
|
2567
|
+
)), r("getDataBase64", (s) => this.exportSingleValue(this.getDataBase64(this.vm.getString(s)), void 0)), r("getDataAsString", (s) => this.exportSingleValue(this.getDataAsString(this.vm.getString(s)), void 0)), r("parsePObjectCollection", (s, n, i) => this.exportObjectUniversal(
|
|
2568
2568
|
this.parsePObjectCollection(
|
|
2569
|
-
this.vm.getString(
|
|
2570
|
-
this.vm.dump(
|
|
2571
|
-
this.vm.getString(
|
|
2569
|
+
this.vm.getString(s),
|
|
2570
|
+
this.vm.dump(n),
|
|
2571
|
+
this.vm.getString(i)
|
|
2572
2572
|
),
|
|
2573
2573
|
void 0
|
|
2574
|
-
)), r("getBlobContentAsBase64", (
|
|
2575
|
-
this.getBlobContentAsBase64(this.vm.getString(
|
|
2574
|
+
)), r("getBlobContentAsBase64", (s) => this.exportSingleValue(
|
|
2575
|
+
this.getBlobContentAsBase64(this.vm.getString(s)),
|
|
2576
2576
|
void 0
|
|
2577
|
-
)), r("getBlobContentAsString", (
|
|
2578
|
-
this.getBlobContentAsString(this.vm.getString(
|
|
2577
|
+
)), r("getBlobContentAsString", (s) => this.exportSingleValue(
|
|
2578
|
+
this.getBlobContentAsString(this.vm.getString(s)),
|
|
2579
2579
|
void 0
|
|
2580
|
-
)), r("getDownloadedBlobContentHandle", (
|
|
2581
|
-
this.getDownloadedBlobContentHandle(this.vm.getString(
|
|
2580
|
+
)), r("getDownloadedBlobContentHandle", (s) => this.exportSingleValue(
|
|
2581
|
+
this.getDownloadedBlobContentHandle(this.vm.getString(s)),
|
|
2582
2582
|
void 0
|
|
2583
|
-
)), r("getOnDemandBlobContentHandle", (
|
|
2584
|
-
this.getOnDemandBlobContentHandle(this.vm.getString(
|
|
2583
|
+
)), r("getOnDemandBlobContentHandle", (s) => this.exportSingleValue(
|
|
2584
|
+
this.getOnDemandBlobContentHandle(this.vm.getString(s)),
|
|
2585
2585
|
void 0
|
|
2586
|
-
)), r("getImportProgress", (
|
|
2587
|
-
this.getLastLogs(this.vm.getString(
|
|
2586
|
+
)), r("getImportProgress", (s) => this.exportSingleValue(this.getImportProgress(this.vm.getString(s)), void 0)), r("getLastLogs", (s, n) => this.exportSingleValue(
|
|
2587
|
+
this.getLastLogs(this.vm.getString(s), this.vm.getNumber(n)),
|
|
2588
2588
|
void 0
|
|
2589
|
-
)), r("getProgressLog", (
|
|
2590
|
-
this.getProgressLog(this.vm.getString(
|
|
2589
|
+
)), r("getProgressLog", (s, n) => this.exportSingleValue(
|
|
2590
|
+
this.getProgressLog(this.vm.getString(s), this.vm.getString(n)),
|
|
2591
2591
|
void 0
|
|
2592
|
-
)), r("getLogHandle", (
|
|
2593
|
-
this.calculateOptions(this.importObjectViaJson(
|
|
2592
|
+
)), r("getLogHandle", (s) => this.exportSingleValue(this.getLogHandle(this.vm.getString(s)), void 0)), r("getBlockLabel", (s) => this.exportSingleValue(this.getBlockLabel(this.vm.getString(s)), void 0)), r("getDataFromResultPool", (s) => this.exportObjectUniversal(this.getDataFromResultPool(), void 0)), r("getDataWithErrorsFromResultPool", (s) => this.exportObjectUniversal(this.getDataWithErrorsFromResultPool(), void 0)), r("getSpecsFromResultPool", (s) => this.exportObjectUniversal(this.getSpecsFromResultPool(), void 0)), r("calculateOptions", (s) => this.exportObjectUniversal(
|
|
2593
|
+
this.calculateOptions(this.importObjectViaJson(s)),
|
|
2594
2594
|
void 0
|
|
2595
|
-
)), r("createPFrame", (
|
|
2596
|
-
this.createPFrame(this.importObjectViaJson(
|
|
2595
|
+
)), r("createPFrame", (s) => this.exportSingleValue(
|
|
2596
|
+
this.createPFrame(this.importObjectViaJson(s)),
|
|
2597
2597
|
void 0
|
|
2598
|
-
)), r("createPTable", (
|
|
2599
|
-
this.createPTable(this.importObjectViaJson(
|
|
2598
|
+
)), r("createPTable", (s) => this.exportSingleValue(
|
|
2599
|
+
this.createPTable(this.importObjectViaJson(s)),
|
|
2600
2600
|
void 0
|
|
2601
2601
|
)), this.vm.setProp(this.vm.global, "cfgRenderCtx", t);
|
|
2602
2602
|
});
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
2605
|
-
function
|
|
2606
|
-
return F.makeRaw((
|
|
2607
|
-
const
|
|
2608
|
-
|
|
2609
|
-
const a =
|
|
2605
|
+
function bo(o, e, t, r, s = {}) {
|
|
2606
|
+
return F.makeRaw((n) => {
|
|
2607
|
+
const i = new Fe();
|
|
2608
|
+
n.addOnDestroy(() => i.dispose());
|
|
2609
|
+
const a = i.manage(o.quickJs.newRuntime());
|
|
2610
2610
|
a.setMemoryLimit(1024 * 640), a.setMaxStackSize(1024 * 320);
|
|
2611
|
-
const c =
|
|
2611
|
+
const c = i.manage(a.newContext()), u = new ge(i, c, e, o, n);
|
|
2612
2612
|
u.evaluateBundle(r.content);
|
|
2613
2613
|
const l = u.runCallback(t);
|
|
2614
2614
|
return u.resetComputableCtx(), {
|
|
2615
2615
|
ir: u.computablesToResolve,
|
|
2616
2616
|
postprocessValue: async (p) => {
|
|
2617
|
-
for (const [
|
|
2617
|
+
for (const [g, m] of Object.entries(p)) u.runCallback(g, m);
|
|
2618
2618
|
return u.importObjectUniversal(l);
|
|
2619
2619
|
}
|
|
2620
2620
|
};
|
|
2621
|
-
},
|
|
2621
|
+
}, s);
|
|
2622
2622
|
}
|
|
2623
|
-
function
|
|
2624
|
-
if (
|
|
2623
|
+
function Ee(o, e, t, r, s = {}) {
|
|
2624
|
+
if (ft(t)) {
|
|
2625
2625
|
if (r === void 0) throw new Error("No code bundle.");
|
|
2626
|
-
return
|
|
2627
|
-
} else return
|
|
2626
|
+
return bo(o, e, t, r, s);
|
|
2627
|
+
} else return Kt(o.driverKit, e, t, s);
|
|
2628
2628
|
}
|
|
2629
|
-
function
|
|
2629
|
+
function wo(o, e, t) {
|
|
2630
2630
|
return F.make(
|
|
2631
2631
|
(r) => {
|
|
2632
|
-
var
|
|
2633
|
-
const
|
|
2634
|
-
|
|
2632
|
+
var h, C, I, G, U, H, z, oe;
|
|
2633
|
+
const s = r.accessor(o).node(), n = w(s.getKeyValueAsJson(Me)), i = w(s.getKeyValueAsJson(te)), a = w(s.getKeyValueAsJson(re)), c = w(s.getKeyValueAsJson(W)), u = w(
|
|
2634
|
+
s.getKeyValueAsJson(le)
|
|
2635
2635
|
), l = /* @__PURE__ */ new Map();
|
|
2636
|
-
for (const { id: k } of
|
|
2637
|
-
const J =
|
|
2636
|
+
for (const { id: k } of N(c)) {
|
|
2637
|
+
const J = s.traverse({
|
|
2638
2638
|
field: P(k, "currentArgs"),
|
|
2639
2639
|
assertFieldType: "Dynamic",
|
|
2640
2640
|
errorIfFieldNotSet: !0
|
|
2641
2641
|
});
|
|
2642
2642
|
let Y;
|
|
2643
|
-
const
|
|
2643
|
+
const E = s.traverse({
|
|
2644
2644
|
field: P(k, "prodArgs"),
|
|
2645
2645
|
assertFieldType: "Dynamic",
|
|
2646
2646
|
stableIfNotFound: !0
|
|
2647
2647
|
});
|
|
2648
|
-
if (
|
|
2649
|
-
const x =
|
|
2648
|
+
if (E !== void 0) {
|
|
2649
|
+
const x = s.getField({
|
|
2650
2650
|
field: P(k, "prodOutput"),
|
|
2651
2651
|
assertFieldType: "Dynamic",
|
|
2652
2652
|
errorIfFieldNotFound: !0
|
|
2653
|
-
}),
|
|
2653
|
+
}), B = s.getField({
|
|
2654
2654
|
field: P(k, "prodUiCtx"),
|
|
2655
2655
|
assertFieldType: "Dynamic",
|
|
2656
2656
|
errorIfFieldNotFound: !0
|
|
2657
2657
|
});
|
|
2658
2658
|
Y = {
|
|
2659
|
-
arguments:
|
|
2660
|
-
stale: J.id !==
|
|
2661
|
-
outputError: x.error !== void 0 ||
|
|
2662
|
-
outputsError: ((I = x.error) == null ? void 0 : I.getDataAsString()) ?? ((
|
|
2663
|
-
exportsError: ((
|
|
2664
|
-
finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (
|
|
2659
|
+
arguments: E.getDataAsJson(),
|
|
2660
|
+
stale: J.id !== E.id,
|
|
2661
|
+
outputError: x.error !== void 0 || B.error !== void 0 || ((h = x.value) == null ? void 0 : h.getError()) !== void 0 || ((C = B.value) == null ? void 0 : C.getError()) !== void 0,
|
|
2662
|
+
outputsError: ((I = x.error) == null ? void 0 : I.getDataAsString()) ?? ((U = (G = x.value) == null ? void 0 : G.getError()) == null ? void 0 : U.getDataAsString()),
|
|
2663
|
+
exportsError: ((H = B.error) == null ? void 0 : H.getDataAsString()) ?? ((oe = (z = B.value) == null ? void 0 : z.getError()) == null ? void 0 : oe.getDataAsString()),
|
|
2664
|
+
finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
|
|
2665
2665
|
};
|
|
2666
2666
|
}
|
|
2667
2667
|
l.set(k, { currentArguments: J.getDataAsJson(), prod: Y });
|
|
2668
2668
|
}
|
|
2669
|
-
const p =
|
|
2670
|
-
var
|
|
2671
|
-
const
|
|
2672
|
-
let
|
|
2673
|
-
|
|
2674
|
-
const
|
|
2669
|
+
const p = ae(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), m = [...N(c)].map(({ id: k, label: J, renderingMode: Y }) => {
|
|
2670
|
+
var He, _e, We, ze;
|
|
2671
|
+
const E = w(l.get(k)), x = w(p.nodes.get(k));
|
|
2672
|
+
let B = "NotCalculated";
|
|
2673
|
+
E.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = E.prod.finished ? "Done" : "Running");
|
|
2674
|
+
const K = s.traverse(
|
|
2675
2675
|
{
|
|
2676
2676
|
field: P(k, "blockPack"),
|
|
2677
2677
|
assertFieldType: "Dynamic",
|
|
2678
2678
|
errorIfFieldNotSet: !0
|
|
2679
2679
|
},
|
|
2680
|
-
{ field:
|
|
2681
|
-
),
|
|
2682
|
-
const q =
|
|
2680
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2681
|
+
), L = K == null ? void 0 : K.getDataAsJson(), { sections: ne, inputsValid: y, sdkVersion: O } = pe(L == null ? void 0 : L.config, (me) => {
|
|
2682
|
+
const q = Ie(me), Ye = $e(s, k);
|
|
2683
2683
|
return {
|
|
2684
|
-
sections:
|
|
2684
|
+
sections: Ee(
|
|
2685
2685
|
t,
|
|
2686
|
-
|
|
2686
|
+
Ye,
|
|
2687
2687
|
q.sections,
|
|
2688
2688
|
q.code
|
|
2689
2689
|
),
|
|
2690
|
-
inputsValid:
|
|
2690
|
+
inputsValid: Ee(
|
|
2691
2691
|
t,
|
|
2692
|
-
|
|
2692
|
+
Ye,
|
|
2693
2693
|
q.inputsValid,
|
|
2694
2694
|
q.code
|
|
2695
2695
|
),
|
|
2696
2696
|
sdkVersion: q.sdkVersion
|
|
2697
2697
|
};
|
|
2698
|
-
}) || {},
|
|
2699
|
-
|
|
2700
|
-
(
|
|
2698
|
+
}) || {}, R = pe(
|
|
2699
|
+
L,
|
|
2700
|
+
(me) => t.blockUpdateWatcher.get(me.source)
|
|
2701
2701
|
);
|
|
2702
2702
|
return {
|
|
2703
2703
|
id: k,
|
|
2704
2704
|
label: J,
|
|
2705
2705
|
renderingMode: Y,
|
|
2706
|
-
stale: ((
|
|
2706
|
+
stale: ((He = E.prod) == null ? void 0 : He.stale) !== !1 || B === "Limbo",
|
|
2707
2707
|
missingReference: x.missingReferences,
|
|
2708
2708
|
upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
|
|
2709
2709
|
downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
|
|
2710
|
-
calculationStatus:
|
|
2711
|
-
outputErrors: ((
|
|
2712
|
-
outputsError: (
|
|
2713
|
-
exportsError: (
|
|
2714
|
-
sections:
|
|
2715
|
-
inputsValid:
|
|
2716
|
-
currentBlockPack:
|
|
2717
|
-
updatedBlockPack:
|
|
2710
|
+
calculationStatus: B,
|
|
2711
|
+
outputErrors: ((_e = E.prod) == null ? void 0 : _e.outputError) === !0,
|
|
2712
|
+
outputsError: (We = E.prod) == null ? void 0 : We.outputsError,
|
|
2713
|
+
exportsError: (ze = E.prod) == null ? void 0 : ze.exportsError,
|
|
2714
|
+
sections: ne,
|
|
2715
|
+
inputsValid: y,
|
|
2716
|
+
currentBlockPack: L == null ? void 0 : L.source,
|
|
2717
|
+
updatedBlockPack: R,
|
|
2718
2718
|
sdkVersion: O,
|
|
2719
2719
|
navigationState: e.getState(k)
|
|
2720
2720
|
};
|
|
2721
2721
|
});
|
|
2722
2722
|
return {
|
|
2723
2723
|
meta: a,
|
|
2724
|
-
created: new Date(
|
|
2725
|
-
lastModified: new Date(
|
|
2726
|
-
authorMarker:
|
|
2727
|
-
blocks:
|
|
2724
|
+
created: new Date(n),
|
|
2725
|
+
lastModified: new Date(i),
|
|
2726
|
+
authorMarker: s.getKeyValueAsJson(Oe),
|
|
2727
|
+
blocks: m
|
|
2728
2728
|
};
|
|
2729
2729
|
},
|
|
2730
2730
|
{
|
|
2731
2731
|
postprocessValue: (r) => {
|
|
2732
|
-
const
|
|
2732
|
+
const s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2733
2733
|
return {
|
|
2734
2734
|
...r,
|
|
2735
|
-
blocks: r.blocks.map((
|
|
2736
|
-
|
|
2737
|
-
const a =
|
|
2738
|
-
return { ...
|
|
2735
|
+
blocks: r.blocks.map((i) => {
|
|
2736
|
+
i.inputsValid || s.add(i.id), i.stale && n.add(i.id);
|
|
2737
|
+
const a = i.stale || i.upstreams.findIndex((u) => n.has(u)) !== -1, c = (a || i.outputErrors) && !!i.inputsValid && !i.missingReference && i.upstreams.findIndex((u) => s.has(u)) === -1;
|
|
2738
|
+
return { ...i, canRun: c, stale: a };
|
|
2739
2739
|
})
|
|
2740
2740
|
};
|
|
2741
2741
|
}
|
|
2742
2742
|
}
|
|
2743
2743
|
).withStableType();
|
|
2744
2744
|
}
|
|
2745
|
-
function
|
|
2745
|
+
function Gt(o, e) {
|
|
2746
2746
|
var t, r;
|
|
2747
|
-
return
|
|
2748
|
-
(r = (t =
|
|
2747
|
+
return pe(
|
|
2748
|
+
(r = (t = o.traverse(
|
|
2749
2749
|
{
|
|
2750
2750
|
field: P(e, "blockPack"),
|
|
2751
2751
|
assertFieldType: "Dynamic",
|
|
2752
2752
|
errorIfFieldNotSet: !0
|
|
2753
2753
|
},
|
|
2754
|
-
{ field:
|
|
2754
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2755
2755
|
)) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
|
|
2756
|
-
(
|
|
2756
|
+
(s) => Ie(s)
|
|
2757
2757
|
);
|
|
2758
2758
|
}
|
|
2759
|
-
function
|
|
2760
|
-
const t =
|
|
2761
|
-
if (
|
|
2759
|
+
function So(o, e) {
|
|
2760
|
+
const t = o.node();
|
|
2761
|
+
if ($(t.resourceType, Dt)) {
|
|
2762
2762
|
const r = t.getDataAsJson();
|
|
2763
2763
|
if (r === void 0) throw new Error("No resource data.");
|
|
2764
2764
|
return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
|
|
2765
|
-
} else if (
|
|
2765
|
+
} else if ($(t.resourceType, xt)) {
|
|
2766
2766
|
const r = t.getDataAsJson();
|
|
2767
2767
|
if (r === void 0) throw new Error("No resource data.");
|
|
2768
2768
|
return e.signer.verify(
|
|
@@ -2773,10 +2773,10 @@ function fs(s, e) {
|
|
|
2773
2773
|
} else
|
|
2774
2774
|
throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
|
|
2775
2775
|
}
|
|
2776
|
-
function
|
|
2777
|
-
if (
|
|
2776
|
+
function ko(o, e) {
|
|
2777
|
+
if (o !== void 0)
|
|
2778
2778
|
return F.make(
|
|
2779
|
-
(t) =>
|
|
2779
|
+
(t) => So(t.accessor(o), e),
|
|
2780
2780
|
{
|
|
2781
2781
|
postprocessValue: (t) => {
|
|
2782
2782
|
if (t !== void 0) {
|
|
@@ -2788,89 +2788,89 @@ function ms(s, e) {
|
|
|
2788
2788
|
}
|
|
2789
2789
|
).withStableType();
|
|
2790
2790
|
}
|
|
2791
|
-
function
|
|
2791
|
+
function Co(o, e, t) {
|
|
2792
2792
|
return F.make(
|
|
2793
2793
|
(r) => {
|
|
2794
2794
|
var a;
|
|
2795
|
-
const
|
|
2795
|
+
const s = r.accessor(o).node(), n = Gt(s, e), i = (a = s.traverse(
|
|
2796
2796
|
{
|
|
2797
2797
|
field: P(e, "blockPack"),
|
|
2798
2798
|
assertFieldType: "Dynamic"
|
|
2799
2799
|
},
|
|
2800
|
-
{ field:
|
|
2801
|
-
{ field:
|
|
2800
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
|
|
2801
|
+
{ field: Tt, assertFieldType: "Input" }
|
|
2802
2802
|
)) == null ? void 0 : a.persist();
|
|
2803
|
-
return { path:
|
|
2803
|
+
return { path: ko(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
|
|
2804
2804
|
},
|
|
2805
2805
|
{ mode: "StableOnlyLive" }
|
|
2806
2806
|
);
|
|
2807
2807
|
}
|
|
2808
|
-
function
|
|
2808
|
+
function Po(o, e, t) {
|
|
2809
2809
|
return F.make(
|
|
2810
2810
|
(r) => {
|
|
2811
|
-
const
|
|
2811
|
+
const s = r.accessor(o).node(), n = $e(s, e);
|
|
2812
2812
|
return {
|
|
2813
|
-
author:
|
|
2814
|
-
args: JSON.parse(
|
|
2815
|
-
ui:
|
|
2813
|
+
author: s.getKeyValueAsJson(Be(e)),
|
|
2814
|
+
args: JSON.parse(n.args),
|
|
2815
|
+
ui: n.uiState !== void 0 ? JSON.parse(n.uiState) : void 0
|
|
2816
2816
|
};
|
|
2817
2817
|
},
|
|
2818
|
-
{ key: "inputs#" +
|
|
2818
|
+
{ key: "inputs#" + bt(o.rid) + e }
|
|
2819
2819
|
);
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function Fo(o, e, t) {
|
|
2822
2822
|
return F.make(
|
|
2823
2823
|
(r) => {
|
|
2824
|
-
const
|
|
2825
|
-
return
|
|
2824
|
+
const s = r.accessor(o).node(), n = Nt(s, e), i = Gt(s, e);
|
|
2825
|
+
return pe(i, (a) => {
|
|
2826
2826
|
const c = {};
|
|
2827
2827
|
for (const [u, l] of Object.entries(a.outputs))
|
|
2828
2828
|
c[u] = F.wrapError(
|
|
2829
|
-
|
|
2829
|
+
Ee(t, n, l, a.code)
|
|
2830
2830
|
);
|
|
2831
2831
|
return c;
|
|
2832
2832
|
});
|
|
2833
2833
|
},
|
|
2834
|
-
{ key: "outputs#" +
|
|
2834
|
+
{ key: "outputs#" + bt(o.rid) + e }
|
|
2835
2835
|
).withStableType();
|
|
2836
2836
|
}
|
|
2837
|
-
function
|
|
2837
|
+
function Ro(o, e) {
|
|
2838
2838
|
return F.make((t) => {
|
|
2839
|
-
const r = t.accessor(
|
|
2840
|
-
for (const { id:
|
|
2839
|
+
const r = t.accessor(o).node(), s = w(r.getKeyValueAsJson(W)), n = [];
|
|
2840
|
+
for (const { id: i, renderingMode: a } of N(s)) {
|
|
2841
2841
|
const c = r.traverse(
|
|
2842
2842
|
{
|
|
2843
|
-
field: P(
|
|
2843
|
+
field: P(i, "blockPack"),
|
|
2844
2844
|
assertFieldType: "Dynamic",
|
|
2845
2845
|
errorIfFieldNotSet: !0
|
|
2846
2846
|
},
|
|
2847
|
-
{ field:
|
|
2847
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2848
2848
|
), u = c == null ? void 0 : c.getDataAsJson();
|
|
2849
2849
|
if ((u == null ? void 0 : u.config) === void 0) continue;
|
|
2850
|
-
const l =
|
|
2850
|
+
const l = Ie(u.config), p = Object.entries(l.outputs).map(([, m]) => m).filter((m) => !ft(m) && Ks(m)).map((m) => m);
|
|
2851
2851
|
if (p.length === 0) continue;
|
|
2852
|
-
const
|
|
2853
|
-
for (const
|
|
2854
|
-
|
|
2852
|
+
const g = Nt(r, i);
|
|
2853
|
+
for (const m of p)
|
|
2854
|
+
n.push(F.wrapError(Kt(e.driverKit, g, m)));
|
|
2855
2855
|
}
|
|
2856
|
-
return
|
|
2856
|
+
return n;
|
|
2857
2857
|
});
|
|
2858
2858
|
}
|
|
2859
|
-
class
|
|
2859
|
+
class Bo {
|
|
2860
2860
|
constructor() {
|
|
2861
2861
|
d(this, "states", /* @__PURE__ */ new Map());
|
|
2862
2862
|
}
|
|
2863
2863
|
setState(e, t) {
|
|
2864
2864
|
const r = this.states.get(e);
|
|
2865
2865
|
if (r === void 0) {
|
|
2866
|
-
this.states.set(e, { state: t, change: new
|
|
2866
|
+
this.states.set(e, { state: t, change: new Xe() });
|
|
2867
2867
|
return;
|
|
2868
2868
|
}
|
|
2869
2869
|
r.state = { ...t }, r.change.markChanged();
|
|
2870
2870
|
}
|
|
2871
2871
|
readState(e, t) {
|
|
2872
2872
|
let r = this.states.get(t);
|
|
2873
|
-
return r === void 0 && (r = { state: { ...
|
|
2873
|
+
return r === void 0 && (r = { state: { ...Zt }, change: new Xe() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
|
|
2874
2874
|
}
|
|
2875
2875
|
getState(e) {
|
|
2876
2876
|
return F.make(
|
|
@@ -2883,38 +2883,38 @@ class Ss {
|
|
|
2883
2883
|
t !== void 0 && (this.states.delete(e), t.change.markChanged());
|
|
2884
2884
|
}
|
|
2885
2885
|
}
|
|
2886
|
-
class
|
|
2886
|
+
class Ge {
|
|
2887
2887
|
constructor(e, t, r) {
|
|
2888
2888
|
/** Underlying pl resource id */
|
|
2889
2889
|
d(this, "rid");
|
|
2890
2890
|
/** Data for the left panel, contain basic information about block status. */
|
|
2891
2891
|
d(this, "overview");
|
|
2892
|
-
d(this, "navigationStates", new
|
|
2892
|
+
d(this, "navigationStates", new Bo());
|
|
2893
2893
|
d(this, "blockComputables", /* @__PURE__ */ new Map());
|
|
2894
2894
|
d(this, "blockFrontends", /* @__PURE__ */ new Map());
|
|
2895
2895
|
d(this, "activeConfigs");
|
|
2896
2896
|
d(this, "refreshLoopResult");
|
|
2897
2897
|
d(this, "abortController", new AbortController());
|
|
2898
2898
|
d(this, "destroyed", !1);
|
|
2899
|
-
this.env = e, this.projectTree = r, this.overview =
|
|
2899
|
+
this.env = e, this.projectTree = r, this.overview = wo(
|
|
2900
2900
|
r.entry(),
|
|
2901
2901
|
this.navigationStates,
|
|
2902
2902
|
e
|
|
2903
|
-
).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs =
|
|
2903
|
+
).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = Ro(r.entry(), e);
|
|
2904
2904
|
}
|
|
2905
2905
|
async refreshLoop() {
|
|
2906
2906
|
for (; !this.destroyed; )
|
|
2907
2907
|
try {
|
|
2908
|
-
await
|
|
2908
|
+
await Se(this.env.pl, this.rid, (e) => {
|
|
2909
2909
|
e.doRefresh(this.env.ops.stagingRenderingRate);
|
|
2910
|
-
}), await this.activeConfigs.getValue(), await
|
|
2910
|
+
}), await this.activeConfigs.getValue(), await kt(this.env.ops.projectRefreshInterval, this.abortController.signal);
|
|
2911
2911
|
} catch (e) {
|
|
2912
|
-
if (
|
|
2912
|
+
if (dr(e)) {
|
|
2913
2913
|
console.warn(
|
|
2914
2914
|
"project refresh routine terminated, because project was externally deleted"
|
|
2915
2915
|
);
|
|
2916
2916
|
break;
|
|
2917
|
-
} else if (!
|
|
2917
|
+
} else if (!pr(e))
|
|
2918
2918
|
throw new Error("Unexpected exception", { cause: e });
|
|
2919
2919
|
}
|
|
2920
2920
|
}
|
|
@@ -2929,40 +2929,40 @@ class Ke {
|
|
|
2929
2929
|
*
|
|
2930
2930
|
* @return returns newly created block id
|
|
2931
2931
|
* */
|
|
2932
|
-
async addBlock(e, t, r,
|
|
2933
|
-
const
|
|
2932
|
+
async addBlock(e, t, r, s = void 0, n = ee()) {
|
|
2933
|
+
const i = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfig(t);
|
|
2934
2934
|
return await V(
|
|
2935
2935
|
this.env.pl,
|
|
2936
2936
|
this.rid,
|
|
2937
|
-
|
|
2937
|
+
s,
|
|
2938
2938
|
(c) => c.addBlock(
|
|
2939
2939
|
{
|
|
2940
|
-
id:
|
|
2940
|
+
id: n,
|
|
2941
2941
|
label: e,
|
|
2942
2942
|
renderingMode: a.renderingMode
|
|
2943
2943
|
},
|
|
2944
2944
|
{
|
|
2945
2945
|
args: JSON.stringify(a.initialArgs),
|
|
2946
|
-
blockPack:
|
|
2946
|
+
blockPack: i
|
|
2947
2947
|
},
|
|
2948
2948
|
r
|
|
2949
2949
|
)
|
|
2950
|
-
), await this.projectTree.refreshState(),
|
|
2950
|
+
), await this.projectTree.refreshState(), n;
|
|
2951
2951
|
}
|
|
2952
2952
|
/**
|
|
2953
2953
|
* Update block to new block pack, optionally resetting args and ui state to
|
|
2954
2954
|
* initial values
|
|
2955
2955
|
* */
|
|
2956
|
-
async updateBlockPack(e, t, r = !1,
|
|
2957
|
-
const
|
|
2956
|
+
async updateBlockPack(e, t, r = !1, s) {
|
|
2957
|
+
const n = await this.env.bpPreparer.prepare(t), i = await this.env.bpPreparer.getBlockConfig(t);
|
|
2958
2958
|
await V(
|
|
2959
2959
|
this.env.pl,
|
|
2960
2960
|
this.rid,
|
|
2961
|
-
|
|
2961
|
+
s,
|
|
2962
2962
|
(a) => a.migrateBlockPack(
|
|
2963
2963
|
e,
|
|
2964
|
-
|
|
2965
|
-
r ? JSON.stringify(
|
|
2964
|
+
n,
|
|
2965
|
+
r ? JSON.stringify(i.initialArgs) : void 0
|
|
2966
2966
|
)
|
|
2967
2967
|
), await this.projectTree.refreshState();
|
|
2968
2968
|
}
|
|
@@ -2978,27 +2978,27 @@ class Ke {
|
|
|
2978
2978
|
*/
|
|
2979
2979
|
async reorderBlocks(e, t) {
|
|
2980
2980
|
await V(this.env.pl, this.rid, t, (r) => {
|
|
2981
|
-
const
|
|
2982
|
-
if (
|
|
2981
|
+
const s = r.structure;
|
|
2982
|
+
if (s.groups.length !== 1)
|
|
2983
2983
|
throw new Error("Unexpected project structure, non-sinular block group");
|
|
2984
|
-
const
|
|
2985
|
-
if (
|
|
2986
|
-
throw new Error(`Lengh mismatch: ${
|
|
2984
|
+
const n = s.groups[0];
|
|
2985
|
+
if (n.blocks.length !== e.length)
|
|
2986
|
+
throw new Error(`Lengh mismatch: ${n.blocks.length} !== ${e.length}`);
|
|
2987
2987
|
if (new Set(e).size !== e.length) throw new Error("Repeated block ids");
|
|
2988
|
-
const
|
|
2988
|
+
const i = {
|
|
2989
2989
|
groups: [
|
|
2990
2990
|
{
|
|
2991
|
-
id:
|
|
2992
|
-
label:
|
|
2991
|
+
id: n.id,
|
|
2992
|
+
label: n.label,
|
|
2993
2993
|
blocks: e.map((a) => {
|
|
2994
|
-
const c =
|
|
2994
|
+
const c = n.blocks.find((u) => u.id === a);
|
|
2995
2995
|
if (c === void 0) throw new Error(`Can't find block: ${a}`);
|
|
2996
2996
|
return c;
|
|
2997
2997
|
})
|
|
2998
2998
|
}
|
|
2999
2999
|
]
|
|
3000
3000
|
};
|
|
3001
|
-
r.updateStructure(
|
|
3001
|
+
r.updateStructure(i);
|
|
3002
3002
|
}), await this.projectTree.refreshState();
|
|
3003
3003
|
}
|
|
3004
3004
|
/**
|
|
@@ -3007,7 +3007,7 @@ class Ke {
|
|
|
3007
3007
|
* stale state.
|
|
3008
3008
|
* */
|
|
3009
3009
|
async runBlock(e) {
|
|
3010
|
-
await
|
|
3010
|
+
await Se(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
|
|
3011
3011
|
}
|
|
3012
3012
|
/**
|
|
3013
3013
|
* Stops the block if it is running by destroying its production state. All
|
|
@@ -3015,12 +3015,12 @@ class Ke {
|
|
|
3015
3015
|
* calculated.
|
|
3016
3016
|
* */
|
|
3017
3017
|
async stopBlock(e) {
|
|
3018
|
-
await
|
|
3018
|
+
await Se(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
|
|
3019
3019
|
}
|
|
3020
3020
|
/** Update block label. */
|
|
3021
3021
|
async setBlockLabel(e, t, r) {
|
|
3022
|
-
await V(this.env.pl, this.rid, r, (
|
|
3023
|
-
|
|
3022
|
+
await V(this.env.pl, this.rid, r, (s) => {
|
|
3023
|
+
s.setBlockLabel(e, t);
|
|
3024
3024
|
}), await this.projectTree.refreshState();
|
|
3025
3025
|
}
|
|
3026
3026
|
/**
|
|
@@ -3034,7 +3034,7 @@ class Ke {
|
|
|
3034
3034
|
this.env.pl,
|
|
3035
3035
|
this.rid,
|
|
3036
3036
|
r,
|
|
3037
|
-
(
|
|
3037
|
+
(s) => s.setArgs([{ blockId: e, args: JSON.stringify(t) }])
|
|
3038
3038
|
), await this.projectTree.refreshState();
|
|
3039
3039
|
}
|
|
3040
3040
|
/**
|
|
@@ -3048,7 +3048,7 @@ class Ke {
|
|
|
3048
3048
|
this.env.pl,
|
|
3049
3049
|
this.rid,
|
|
3050
3050
|
r,
|
|
3051
|
-
(
|
|
3051
|
+
(s) => s.setUiState(e, t === void 0 ? void 0 : JSON.stringify(t))
|
|
3052
3052
|
), await this.projectTree.refreshState();
|
|
3053
3053
|
}
|
|
3054
3054
|
/**
|
|
@@ -3063,20 +3063,20 @@ class Ke {
|
|
|
3063
3063
|
* transactionally associated with the block, to facilitate conflict resolution
|
|
3064
3064
|
* in collaborative editing scenario.
|
|
3065
3065
|
* */
|
|
3066
|
-
async setBlockArgsAndUiState(e, t, r,
|
|
3067
|
-
await V(this.env.pl, this.rid,
|
|
3068
|
-
|
|
3066
|
+
async setBlockArgsAndUiState(e, t, r, s) {
|
|
3067
|
+
await V(this.env.pl, this.rid, s, (n) => {
|
|
3068
|
+
n.setArgs([{ blockId: e, args: JSON.stringify(t) }]), n.setUiState(e, JSON.stringify(r));
|
|
3069
3069
|
}), await this.projectTree.refreshState();
|
|
3070
3070
|
}
|
|
3071
3071
|
/** Resets arguments and ui state of the block to initial state */
|
|
3072
3072
|
async resetBlockArgsAndUiState(e, t) {
|
|
3073
3073
|
await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
|
|
3074
|
-
const
|
|
3074
|
+
const s = Pe(
|
|
3075
3075
|
(await r.getField(S(this.rid, P(e, "blockPack")))).value
|
|
3076
|
-
),
|
|
3077
|
-
(await r.getField(S(
|
|
3078
|
-
),
|
|
3079
|
-
Buffer.from(w(
|
|
3076
|
+
), n = Pe(
|
|
3077
|
+
(await r.getField(S(s, b.HolderRefField))).value
|
|
3078
|
+
), i = await r.getResourceData(n, !1), a = JSON.parse(
|
|
3079
|
+
Buffer.from(w(i.data)).toString("utf-8")
|
|
3080
3080
|
);
|
|
3081
3081
|
await V(r, this.rid, t, (c) => {
|
|
3082
3082
|
c.setArgs([{ blockId: e, args: JSON.stringify(a.config.initialArgs) }]), c.setUiState(e, void 0);
|
|
@@ -3086,23 +3086,23 @@ class Ke {
|
|
|
3086
3086
|
getBlockComputables(e) {
|
|
3087
3087
|
const t = this.blockComputables.get(e);
|
|
3088
3088
|
if (t === void 0) {
|
|
3089
|
-
const r =
|
|
3089
|
+
const r = Fo(this.projectTree.entry(), e, this.env), n = {
|
|
3090
3090
|
fullState: F.make(
|
|
3091
|
-
(
|
|
3092
|
-
argsAndUiState:
|
|
3091
|
+
(i) => ({
|
|
3092
|
+
argsAndUiState: Po(this.projectTree.entry(), e),
|
|
3093
3093
|
outputs: r,
|
|
3094
3094
|
navigationState: this.navigationStates.getState(e)
|
|
3095
3095
|
}),
|
|
3096
3096
|
{
|
|
3097
|
-
postprocessValue: (
|
|
3098
|
-
...
|
|
3099
|
-
outputs:
|
|
3100
|
-
navigationState:
|
|
3097
|
+
postprocessValue: (i) => ({
|
|
3098
|
+
...i.argsAndUiState,
|
|
3099
|
+
outputs: i.outputs,
|
|
3100
|
+
navigationState: i.navigationState
|
|
3101
3101
|
})
|
|
3102
3102
|
}
|
|
3103
3103
|
).withPreCalculatedValueTree()
|
|
3104
3104
|
};
|
|
3105
|
-
return this.blockComputables.set(e,
|
|
3105
|
+
return this.blockComputables.set(e, n), n;
|
|
3106
3106
|
}
|
|
3107
3107
|
return t;
|
|
3108
3108
|
}
|
|
@@ -3120,7 +3120,7 @@ class Ke {
|
|
|
3120
3120
|
getBlockFrontend(e) {
|
|
3121
3121
|
const t = this.blockFrontends.get(e);
|
|
3122
3122
|
if (t === void 0) {
|
|
3123
|
-
const r =
|
|
3123
|
+
const r = Co(
|
|
3124
3124
|
this.projectTree.entry(),
|
|
3125
3125
|
e,
|
|
3126
3126
|
this.env
|
|
@@ -3140,32 +3140,32 @@ class Ke {
|
|
|
3140
3140
|
await this.destroy();
|
|
3141
3141
|
}
|
|
3142
3142
|
static async init(e, t) {
|
|
3143
|
-
const r = await
|
|
3143
|
+
const r = await wt.init(
|
|
3144
3144
|
e.pl,
|
|
3145
3145
|
t,
|
|
3146
3146
|
{
|
|
3147
3147
|
...e.ops.defaultTreeOptions,
|
|
3148
|
-
pruning:
|
|
3148
|
+
pruning: Oo
|
|
3149
3149
|
},
|
|
3150
3150
|
e.logger
|
|
3151
3151
|
);
|
|
3152
|
-
return new
|
|
3152
|
+
return new Ge(e, t, r);
|
|
3153
3153
|
}
|
|
3154
3154
|
}
|
|
3155
|
-
function
|
|
3156
|
-
switch (
|
|
3155
|
+
function Oo(o) {
|
|
3156
|
+
switch (o.type.name) {
|
|
3157
3157
|
case "BlockPackCustom":
|
|
3158
|
-
return
|
|
3158
|
+
return o.fields.filter((e) => e.name !== "template");
|
|
3159
3159
|
case "UserProject":
|
|
3160
|
-
return
|
|
3160
|
+
return o.fields.filter((e) => !e.name.startsWith("__serviceTemplate"));
|
|
3161
3161
|
case "Blob":
|
|
3162
3162
|
return [];
|
|
3163
3163
|
default:
|
|
3164
|
-
return
|
|
3164
|
+
return o.fields;
|
|
3165
3165
|
}
|
|
3166
3166
|
}
|
|
3167
|
-
const
|
|
3168
|
-
logger: new
|
|
3167
|
+
const Ht = {
|
|
3168
|
+
logger: new or(),
|
|
3169
3169
|
blobDriverOps: {
|
|
3170
3170
|
cacheSoftSizeBytes: 100 * 1024 * 1024,
|
|
3171
3171
|
// 100MB
|
|
@@ -3183,13 +3183,13 @@ const Jt = {
|
|
|
3183
3183
|
stopPollingDelay: 1e3
|
|
3184
3184
|
}
|
|
3185
3185
|
};
|
|
3186
|
-
function
|
|
3186
|
+
function _t(o) {
|
|
3187
3187
|
return {
|
|
3188
|
-
blobDownloadPath:
|
|
3188
|
+
blobDownloadPath: T.join(o, "download")
|
|
3189
3189
|
};
|
|
3190
3190
|
}
|
|
3191
|
-
const
|
|
3192
|
-
...
|
|
3191
|
+
const Do = {
|
|
3192
|
+
...Ht,
|
|
3193
3193
|
defaultTreeOptions: {
|
|
3194
3194
|
pollingInterval: 350,
|
|
3195
3195
|
stopPollingDelay: 2500
|
|
@@ -3198,20 +3198,20 @@ const Cs = {
|
|
|
3198
3198
|
projectRefreshInterval: 700,
|
|
3199
3199
|
stagingRenderingRate: 5
|
|
3200
3200
|
};
|
|
3201
|
-
function
|
|
3201
|
+
function xo(o) {
|
|
3202
3202
|
return {
|
|
3203
|
-
...
|
|
3204
|
-
frontendDownloadPath:
|
|
3203
|
+
..._t(o),
|
|
3204
|
+
frontendDownloadPath: T.join(o, "frontend")
|
|
3205
3205
|
};
|
|
3206
3206
|
}
|
|
3207
|
-
const
|
|
3207
|
+
const jo = {
|
|
3208
3208
|
minDelay: 1500
|
|
3209
|
-
},
|
|
3210
|
-
class
|
|
3211
|
-
constructor(t, r,
|
|
3212
|
-
super({ ...
|
|
3209
|
+
}, To = "__no_updates__";
|
|
3210
|
+
class Eo extends mr {
|
|
3211
|
+
constructor(t, r, s = {}) {
|
|
3212
|
+
super({ ...s, ...jo }, r);
|
|
3213
3213
|
d(this, "http");
|
|
3214
|
-
this.registryProvider = t, this.http =
|
|
3214
|
+
this.registryProvider = t, this.http = s.http;
|
|
3215
3215
|
}
|
|
3216
3216
|
getKey(t) {
|
|
3217
3217
|
switch (t.type) {
|
|
@@ -3222,7 +3222,7 @@ class Rs extends ur {
|
|
|
3222
3222
|
case "from-registry-v2":
|
|
3223
3223
|
return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
|
|
3224
3224
|
default:
|
|
3225
|
-
return
|
|
3225
|
+
return To;
|
|
3226
3226
|
}
|
|
3227
3227
|
}
|
|
3228
3228
|
async readValue(t) {
|
|
@@ -3231,42 +3231,42 @@ class Rs extends ur {
|
|
|
3231
3231
|
switch (t.type) {
|
|
3232
3232
|
case "dev-v1":
|
|
3233
3233
|
try {
|
|
3234
|
-
const
|
|
3235
|
-
return
|
|
3236
|
-
} catch (
|
|
3237
|
-
this.logger.warn(
|
|
3234
|
+
const s = await Pt(t.folder);
|
|
3235
|
+
return s === t.mtime ? void 0 : { ...t, mtime: s };
|
|
3236
|
+
} catch (s) {
|
|
3237
|
+
this.logger.warn(s);
|
|
3238
3238
|
return;
|
|
3239
3239
|
}
|
|
3240
3240
|
case "dev-v2":
|
|
3241
3241
|
try {
|
|
3242
|
-
const
|
|
3243
|
-
if (
|
|
3244
|
-
const
|
|
3245
|
-
return
|
|
3246
|
-
} catch (
|
|
3247
|
-
this.logger.warn(
|
|
3242
|
+
const s = await mt(t.folder, this.logger);
|
|
3243
|
+
if (s === void 0) return;
|
|
3244
|
+
const n = await Je(s);
|
|
3245
|
+
return n === t.mtime ? void 0 : { ...t, mtime: n };
|
|
3246
|
+
} catch (s) {
|
|
3247
|
+
this.logger.warn(s);
|
|
3248
3248
|
return;
|
|
3249
3249
|
}
|
|
3250
3250
|
case "from-registry-v2":
|
|
3251
3251
|
try {
|
|
3252
|
-
const
|
|
3253
|
-
if ((
|
|
3254
|
-
return
|
|
3252
|
+
const s = this.registryProvider.getRegistry(t.registryUrl), n = (r = await s.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
|
|
3253
|
+
if ((n == null ? void 0 : n.type) !== "from-registry-v2") throw new Error("Unexpected");
|
|
3254
|
+
return ve(n.id, t.id) ? void 0 : ((async () => {
|
|
3255
3255
|
try {
|
|
3256
|
-
await
|
|
3257
|
-
} catch (
|
|
3258
|
-
this.logger.warn(
|
|
3256
|
+
await s.getComponents(n.id);
|
|
3257
|
+
} catch (i) {
|
|
3258
|
+
this.logger.warn(i);
|
|
3259
3259
|
}
|
|
3260
|
-
})(),
|
|
3261
|
-
} catch (
|
|
3262
|
-
this.logger.warn(
|
|
3260
|
+
})(), n);
|
|
3261
|
+
} catch (s) {
|
|
3262
|
+
this.logger.warn(s);
|
|
3263
3263
|
return;
|
|
3264
3264
|
}
|
|
3265
3265
|
default:
|
|
3266
3266
|
return;
|
|
3267
3267
|
}
|
|
3268
|
-
} catch (
|
|
3269
|
-
this.logger.warn(
|
|
3268
|
+
} catch (s) {
|
|
3269
|
+
this.logger.warn(s);
|
|
3270
3270
|
return;
|
|
3271
3271
|
}
|
|
3272
3272
|
}
|
|
@@ -3275,9 +3275,9 @@ class Rs extends ur {
|
|
|
3275
3275
|
if (t === void 0 || r === void 0 || t.type !== r.type) return !1;
|
|
3276
3276
|
switch (t.type) {
|
|
3277
3277
|
case "from-registry-v1":
|
|
3278
|
-
return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl &&
|
|
3278
|
+
return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && ve(t.id, r.id);
|
|
3279
3279
|
case "from-registry-v2":
|
|
3280
|
-
return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl &&
|
|
3280
|
+
return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && ve(t.id, r.id);
|
|
3281
3281
|
case "dev-v1":
|
|
3282
3282
|
return r.type !== "dev-v1" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
|
|
3283
3283
|
case "dev-v2":
|
|
@@ -3287,7 +3287,7 @@ class Rs extends ur {
|
|
|
3287
3287
|
}
|
|
3288
3288
|
}
|
|
3289
3289
|
}
|
|
3290
|
-
class
|
|
3290
|
+
class pt {
|
|
3291
3291
|
constructor() {
|
|
3292
3292
|
d(this, "resources", /* @__PURE__ */ new Map());
|
|
3293
3293
|
}
|
|
@@ -3304,12 +3304,12 @@ class at {
|
|
|
3304
3304
|
const t = this.calculateParamsKey(e);
|
|
3305
3305
|
let r = this.resources.get(t);
|
|
3306
3306
|
r === void 0 && (r = { refCount: 0, resource: this.createNewResource(e) }, this.resources.set(t, r)), r.refCount++;
|
|
3307
|
-
let
|
|
3307
|
+
let s = !1;
|
|
3308
3308
|
return {
|
|
3309
3309
|
resource: r.resource,
|
|
3310
3310
|
key: t,
|
|
3311
3311
|
unref: () => {
|
|
3312
|
-
|
|
3312
|
+
s || (r.refCount--, s = !0, this.check(t));
|
|
3313
3313
|
}
|
|
3314
3314
|
};
|
|
3315
3315
|
}
|
|
@@ -3322,12 +3322,12 @@ class at {
|
|
|
3322
3322
|
return (t = this.resources.get(e)) == null ? void 0 : t.resource;
|
|
3323
3323
|
}
|
|
3324
3324
|
}
|
|
3325
|
-
function
|
|
3326
|
-
return String(
|
|
3325
|
+
function gt(o) {
|
|
3326
|
+
return String(o.id);
|
|
3327
3327
|
}
|
|
3328
|
-
class
|
|
3328
|
+
class Ao {
|
|
3329
3329
|
constructor(e, t, r) {
|
|
3330
|
-
d(this, "pFrame", new
|
|
3330
|
+
d(this, "pFrame", new jr());
|
|
3331
3331
|
d(this, "blobIdToResource", /* @__PURE__ */ new Map());
|
|
3332
3332
|
d(this, "blobHandleComputables", /* @__PURE__ */ new Map());
|
|
3333
3333
|
d(this, "preloadBlob", async (e) => {
|
|
@@ -3343,14 +3343,14 @@ class Os {
|
|
|
3343
3343
|
return await this.blobContentCache.forceFetch(r);
|
|
3344
3344
|
});
|
|
3345
3345
|
this.blobDriver = e, this.blobContentCache = t, this.columns = r, this.pFrame.setDataSource(this);
|
|
3346
|
-
for (const
|
|
3347
|
-
for (const
|
|
3348
|
-
const
|
|
3346
|
+
for (const s of r) {
|
|
3347
|
+
for (const i of js(s.data)) this.blobIdToResource.set(gt(i), i);
|
|
3348
|
+
const n = Ts(s.data, gt);
|
|
3349
3349
|
try {
|
|
3350
|
-
this.pFrame.addColumnSpec(
|
|
3351
|
-
} catch (
|
|
3350
|
+
this.pFrame.addColumnSpec(s.id, s.spec), this.pFrame.setColumnData(s.id, n);
|
|
3351
|
+
} catch (i) {
|
|
3352
3352
|
throw new Error(
|
|
3353
|
-
`Adding column ${
|
|
3353
|
+
`Adding column ${s.id} to PFrame failed: ${i}; Spec: ${s.spec}, DataInfo: ${n}.`
|
|
3354
3354
|
);
|
|
3355
3355
|
}
|
|
3356
3356
|
}
|
|
@@ -3367,7 +3367,7 @@ class Os {
|
|
|
3367
3367
|
this.pFrame.dispose();
|
|
3368
3368
|
}
|
|
3369
3369
|
}
|
|
3370
|
-
class
|
|
3370
|
+
class Io {
|
|
3371
3371
|
constructor(e) {
|
|
3372
3372
|
d(this, "pFrames");
|
|
3373
3373
|
d(this, "pTables");
|
|
@@ -3375,37 +3375,37 @@ class Ds {
|
|
|
3375
3375
|
/** Limits concurrent requests to PFrame API to prevent deadlock with Node's IO threads */
|
|
3376
3376
|
d(this, "concurrencyLimiter");
|
|
3377
3377
|
this.blobDriver = e;
|
|
3378
|
-
const t = new
|
|
3378
|
+
const t = new Tr({
|
|
3379
3379
|
maxSize: 1e9,
|
|
3380
3380
|
// 1Gb
|
|
3381
|
-
fetchMethod: async (
|
|
3382
|
-
sizeCalculation: (
|
|
3383
|
-
}), r = new
|
|
3384
|
-
this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends
|
|
3385
|
-
constructor(
|
|
3386
|
-
super(), this.blobDriver =
|
|
3381
|
+
fetchMethod: async (s) => await yt.readFile(s),
|
|
3382
|
+
sizeCalculation: (s) => s.length
|
|
3383
|
+
}), r = new nr(1);
|
|
3384
|
+
this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends pt {
|
|
3385
|
+
constructor(s) {
|
|
3386
|
+
super(), this.blobDriver = s;
|
|
3387
3387
|
}
|
|
3388
|
-
createNewResource(
|
|
3389
|
-
return new
|
|
3388
|
+
createNewResource(s) {
|
|
3389
|
+
return new Ao(this.blobDriver, t, s);
|
|
3390
3390
|
}
|
|
3391
|
-
calculateParamsKey(
|
|
3392
|
-
return
|
|
3391
|
+
calculateParamsKey(s) {
|
|
3392
|
+
return No(s);
|
|
3393
3393
|
}
|
|
3394
|
-
}(this.blobDriver), this.pTables = new class extends
|
|
3395
|
-
constructor(
|
|
3396
|
-
super(), this.pFrames =
|
|
3394
|
+
}(this.blobDriver), this.pTables = new class extends pt {
|
|
3395
|
+
constructor(s) {
|
|
3396
|
+
super(), this.pFrames = s;
|
|
3397
3397
|
}
|
|
3398
|
-
async createNewResource(
|
|
3399
|
-
const
|
|
3400
|
-
async () => await
|
|
3401
|
-
src:
|
|
3402
|
-
filters:
|
|
3398
|
+
async createNewResource(s) {
|
|
3399
|
+
const n = this.pFrames.getByKey(s.pFrameHandle), i = await r.run(
|
|
3400
|
+
async () => await n.pFrame.createTable({
|
|
3401
|
+
src: X(s.def.src),
|
|
3402
|
+
filters: s.def.filters
|
|
3403
3403
|
})
|
|
3404
3404
|
);
|
|
3405
|
-
return
|
|
3405
|
+
return s.def.sorting.length !== 0 ? i.sort(s.def.sorting) : i;
|
|
3406
3406
|
}
|
|
3407
|
-
calculateParamsKey(
|
|
3408
|
-
return
|
|
3407
|
+
calculateParamsKey(s) {
|
|
3408
|
+
return Vo(s);
|
|
3409
3409
|
}
|
|
3410
3410
|
}(this.pFrames);
|
|
3411
3411
|
}
|
|
@@ -3413,12 +3413,12 @@ class Ds {
|
|
|
3413
3413
|
// Internal / Config API Methods
|
|
3414
3414
|
//
|
|
3415
3415
|
createPFrame(e, t) {
|
|
3416
|
-
const r = e.map((
|
|
3417
|
-
return t.addOnDestroy(
|
|
3416
|
+
const r = e.map((n) => Z(n, (i) => Ls(i))), s = this.pFrames.acquire(r);
|
|
3417
|
+
return t.addOnDestroy(s.unref), s.key;
|
|
3418
3418
|
}
|
|
3419
3419
|
createPTable(e, t) {
|
|
3420
|
-
const r = this.createPFrame(
|
|
3421
|
-
return t.addOnDestroy(
|
|
3420
|
+
const r = this.createPFrame(Lo(e.src), t), s = ht(e, (i) => i.id), n = this.pTables.acquire({ def: s, pFrameHandle: r });
|
|
3421
|
+
return t.addOnDestroy(n.unref), n.key;
|
|
3422
3422
|
}
|
|
3423
3423
|
//
|
|
3424
3424
|
// PFrame istance methods
|
|
@@ -3431,7 +3431,7 @@ class Ds {
|
|
|
3431
3431
|
return {
|
|
3432
3432
|
hits: (await this.concurrencyLimiter.run(
|
|
3433
3433
|
async () => await this.pFrames.getByKey(e).pFrame.findColumns(r)
|
|
3434
|
-
)).hits.map((
|
|
3434
|
+
)).hits.map((s) => s.hit)
|
|
3435
3435
|
};
|
|
3436
3436
|
}
|
|
3437
3437
|
async getColumnSpec(e, t) {
|
|
@@ -3447,22 +3447,22 @@ class Ds {
|
|
|
3447
3447
|
async calculateTableData(e, t) {
|
|
3448
3448
|
let r = await this.concurrencyLimiter.run(
|
|
3449
3449
|
async () => await this.pFrames.getByKey(e).pFrame.createTable({
|
|
3450
|
-
src:
|
|
3450
|
+
src: X(t.src),
|
|
3451
3451
|
filters: t.filters
|
|
3452
3452
|
})
|
|
3453
3453
|
);
|
|
3454
3454
|
if (t.sorting.length > 0) {
|
|
3455
|
-
const
|
|
3455
|
+
const i = await this.concurrencyLimiter.run(
|
|
3456
3456
|
async () => await r.sort(t.sorting)
|
|
3457
3457
|
);
|
|
3458
|
-
r.dispose(), r =
|
|
3458
|
+
r.dispose(), r = i;
|
|
3459
3459
|
}
|
|
3460
|
-
const
|
|
3461
|
-
async () => await r.getData([...
|
|
3460
|
+
const s = r.getSpec(), n = await this.concurrencyLimiter.run(
|
|
3461
|
+
async () => await r.getData([...s.keys()])
|
|
3462
3462
|
);
|
|
3463
|
-
return r.dispose(),
|
|
3464
|
-
spec:
|
|
3465
|
-
data:
|
|
3463
|
+
return r.dispose(), s.map((i, a) => ({
|
|
3464
|
+
spec: i,
|
|
3465
|
+
data: n[a]
|
|
3466
3466
|
}));
|
|
3467
3467
|
}
|
|
3468
3468
|
async getUniqueValues(e, t) {
|
|
@@ -3480,105 +3480,105 @@ class Ds {
|
|
|
3480
3480
|
return (await this.pTables.getByKey(e)).getSpec();
|
|
3481
3481
|
}
|
|
3482
3482
|
async getData(e, t, r) {
|
|
3483
|
-
const
|
|
3483
|
+
const s = await this.pTables.getByKey(e);
|
|
3484
3484
|
return await this.concurrencyLimiter.run(
|
|
3485
|
-
async () => await
|
|
3485
|
+
async () => await s.getData(t, r)
|
|
3486
3486
|
);
|
|
3487
3487
|
}
|
|
3488
3488
|
}
|
|
3489
|
-
function
|
|
3490
|
-
switch (
|
|
3489
|
+
function X(o) {
|
|
3490
|
+
switch (o.type) {
|
|
3491
3491
|
case "column":
|
|
3492
3492
|
return {
|
|
3493
3493
|
type: "column",
|
|
3494
|
-
columnId:
|
|
3494
|
+
columnId: o.column,
|
|
3495
3495
|
qualifications: []
|
|
3496
3496
|
};
|
|
3497
3497
|
case "inner":
|
|
3498
3498
|
case "full":
|
|
3499
3499
|
return {
|
|
3500
|
-
type:
|
|
3501
|
-
entries:
|
|
3500
|
+
type: o.type,
|
|
3501
|
+
entries: o.entries.map((e) => X(e))
|
|
3502
3502
|
};
|
|
3503
3503
|
case "outer":
|
|
3504
3504
|
return {
|
|
3505
3505
|
type: "outer",
|
|
3506
|
-
primary:
|
|
3507
|
-
secondary:
|
|
3506
|
+
primary: X(o.primary),
|
|
3507
|
+
secondary: o.secondary.map((e) => X(e))
|
|
3508
3508
|
};
|
|
3509
3509
|
default:
|
|
3510
|
-
D(
|
|
3510
|
+
D(o);
|
|
3511
3511
|
}
|
|
3512
3512
|
}
|
|
3513
|
-
function
|
|
3513
|
+
function Vo(o) {
|
|
3514
3514
|
const e = he("sha256");
|
|
3515
|
-
return e.update(
|
|
3515
|
+
return e.update(o.pFrameHandle), e.update(Ve(o.def)), e.digest().toString("hex");
|
|
3516
3516
|
}
|
|
3517
|
-
function
|
|
3518
|
-
const e =
|
|
3517
|
+
function No(o) {
|
|
3518
|
+
const e = o.map((s) => s.id).sort(), t = he("sha256");
|
|
3519
3519
|
let r = "";
|
|
3520
|
-
for (const
|
|
3521
|
-
r !==
|
|
3520
|
+
for (const s of e)
|
|
3521
|
+
r !== s && (t.update(s), r = s);
|
|
3522
3522
|
return t.digest().toString("hex");
|
|
3523
3523
|
}
|
|
3524
|
-
function
|
|
3524
|
+
function Lo(o) {
|
|
3525
3525
|
const e = /* @__PURE__ */ new Map();
|
|
3526
|
-
return
|
|
3526
|
+
return ce(o, e), [...e.values()];
|
|
3527
3527
|
}
|
|
3528
|
-
function
|
|
3529
|
-
switch (
|
|
3528
|
+
function ce(o, e) {
|
|
3529
|
+
switch (o.type) {
|
|
3530
3530
|
case "column":
|
|
3531
|
-
e.set(
|
|
3531
|
+
e.set(o.column.id, o.column);
|
|
3532
3532
|
return;
|
|
3533
3533
|
case "full":
|
|
3534
3534
|
case "inner":
|
|
3535
|
-
for (const t of
|
|
3535
|
+
for (const t of o.entries) ce(t, e);
|
|
3536
3536
|
return;
|
|
3537
3537
|
case "outer":
|
|
3538
|
-
|
|
3539
|
-
for (const t of
|
|
3538
|
+
ce(o.primary, e);
|
|
3539
|
+
for (const t of o.secondary) ce(t, e);
|
|
3540
3540
|
return;
|
|
3541
3541
|
default:
|
|
3542
|
-
D(
|
|
3542
|
+
D(o);
|
|
3543
3543
|
}
|
|
3544
3544
|
}
|
|
3545
|
-
async function
|
|
3545
|
+
async function Jo(o, e, t) {
|
|
3546
3546
|
const r = {
|
|
3547
|
-
...
|
|
3548
|
-
...
|
|
3547
|
+
...Ht,
|
|
3548
|
+
..._t(e),
|
|
3549
3549
|
...t
|
|
3550
|
-
},
|
|
3550
|
+
}, s = new vt(r.localSecret), n = Sr(r.logger, o, r.localProjections), i = kr(o, r.logger), a = Cr(o, r.logger), c = Pr(o, r.logger), u = new Fr(
|
|
3551
3551
|
r.logger,
|
|
3552
|
-
i,
|
|
3553
3552
|
n,
|
|
3553
|
+
i,
|
|
3554
3554
|
r.blobDownloadPath,
|
|
3555
|
-
|
|
3555
|
+
s,
|
|
3556
3556
|
r.blobDriverOps
|
|
3557
|
-
), l = new
|
|
3557
|
+
), l = new Rr(
|
|
3558
3558
|
r.logger,
|
|
3559
|
-
|
|
3559
|
+
s,
|
|
3560
3560
|
a,
|
|
3561
3561
|
c,
|
|
3562
3562
|
r.uploadDriverOps
|
|
3563
|
-
), p = new
|
|
3563
|
+
), p = new Br(r.logger, i, r.logStreamDriverOps), g = new Or(r.logger, p, u), m = await Dr.init(
|
|
3564
3564
|
r.logger,
|
|
3565
|
-
s,
|
|
3566
3565
|
o,
|
|
3566
|
+
s,
|
|
3567
3567
|
r.localProjections,
|
|
3568
3568
|
r.openFileDialogCallback,
|
|
3569
3569
|
r.virtualLocalStoragesOverride
|
|
3570
|
-
),
|
|
3570
|
+
), h = new Io(u);
|
|
3571
3571
|
return {
|
|
3572
3572
|
blobDriver: u,
|
|
3573
|
-
logDriver:
|
|
3574
|
-
lsDriver:
|
|
3575
|
-
signer:
|
|
3573
|
+
logDriver: g,
|
|
3574
|
+
lsDriver: m,
|
|
3575
|
+
signer: s,
|
|
3576
3576
|
uploadDriver: l,
|
|
3577
|
-
pFrameDriver:
|
|
3577
|
+
pFrameDriver: h
|
|
3578
3578
|
};
|
|
3579
3579
|
}
|
|
3580
|
-
class
|
|
3581
|
-
constructor(e, t, r,
|
|
3580
|
+
class Wt {
|
|
3581
|
+
constructor(e, t, r, s, n, i, a, c) {
|
|
3582
3582
|
d(this, "pl");
|
|
3583
3583
|
/** Contains a reactive list of projects along with their meta information. */
|
|
3584
3584
|
d(this, "projectList");
|
|
@@ -3586,7 +3586,7 @@ class Mt {
|
|
|
3586
3586
|
// Projects
|
|
3587
3587
|
//
|
|
3588
3588
|
d(this, "openedProjectsByRid", /* @__PURE__ */ new Map());
|
|
3589
|
-
this.env = e, this.driverKit = t, this.signer = r, this.projectListResourceId =
|
|
3589
|
+
this.env = e, this.driverKit = t, this.signer = r, this.projectListResourceId = s, this.openedProjectsList = n, this.projectListTree = i, this.blockRegistryProvider = a, this.projectList = c, this.pl = this.env.pl;
|
|
3590
3590
|
}
|
|
3591
3591
|
/** Returns extended API driver kit used internally by middle layer. */
|
|
3592
3592
|
get internalDriverKit() {
|
|
@@ -3596,17 +3596,17 @@ class Mt {
|
|
|
3596
3596
|
// Project List Manipulation
|
|
3597
3597
|
//
|
|
3598
3598
|
/** Creates a project with initial state and adds it to project list. */
|
|
3599
|
-
async createProject(e, t =
|
|
3600
|
-
const r = await this.pl.withWriteTx("MLCreateProject", async (
|
|
3601
|
-
const
|
|
3602
|
-
return
|
|
3599
|
+
async createProject(e, t = ee()) {
|
|
3600
|
+
const r = await this.pl.withWriteTx("MLCreateProject", async (s) => {
|
|
3601
|
+
const n = await xs(s, e);
|
|
3602
|
+
return s.createField(S(this.projectListResourceId, t), "Dynamic", n), await s.commit(), await gr(n);
|
|
3603
3603
|
});
|
|
3604
3604
|
return await this.projectListTree.refreshState(), r;
|
|
3605
3605
|
}
|
|
3606
3606
|
/** Updates project metadata */
|
|
3607
3607
|
async setProjectMeta(e, t, r) {
|
|
3608
|
-
await V(this.pl, e, r, async (
|
|
3609
|
-
|
|
3608
|
+
await V(this.pl, e, r, async (s) => {
|
|
3609
|
+
s.setMeta(t);
|
|
3610
3610
|
}), await this.projectListTree.refreshState();
|
|
3611
3611
|
}
|
|
3612
3612
|
/** Permanently deletes project from the project list, this will result in
|
|
@@ -3619,7 +3619,7 @@ class Mt {
|
|
|
3619
3619
|
async projectIdToResourceId(e) {
|
|
3620
3620
|
return await this.pl.withReadTx("Project id to resource id", async (t) => {
|
|
3621
3621
|
const r = (await t.getField(S(this.projectListResourceId, e))).value;
|
|
3622
|
-
if (
|
|
3622
|
+
if (ue(r)) throw new Error("Unexpected project list structure.");
|
|
3623
3623
|
return r;
|
|
3624
3624
|
});
|
|
3625
3625
|
}
|
|
@@ -3630,7 +3630,7 @@ class Mt {
|
|
|
3630
3630
|
async openProject(e) {
|
|
3631
3631
|
const t = await this.ensureProjectRid(e);
|
|
3632
3632
|
if (this.openedProjectsByRid.has(t)) throw new Error(`Project ${t} already opened`);
|
|
3633
|
-
this.openedProjectsByRid.set(t, await
|
|
3633
|
+
this.openedProjectsByRid.set(t, await Ge.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
|
|
3634
3634
|
}
|
|
3635
3635
|
/** Closes the project, and deallocate all corresponding resources. */
|
|
3636
3636
|
async closeProject(e) {
|
|
@@ -3658,91 +3658,226 @@ class Mt {
|
|
|
3658
3658
|
/** Generates sufficiently random string to be used as local secret for the
|
|
3659
3659
|
* middle layer */
|
|
3660
3660
|
static generateLocalSecret() {
|
|
3661
|
-
return
|
|
3661
|
+
return vt.generateSecret();
|
|
3662
3662
|
}
|
|
3663
3663
|
/** Initialize middle layer */
|
|
3664
3664
|
static async init(e, t, r) {
|
|
3665
|
-
const
|
|
3666
|
-
...
|
|
3667
|
-
...
|
|
3665
|
+
const s = {
|
|
3666
|
+
...Do,
|
|
3667
|
+
...xo(t),
|
|
3668
3668
|
...r
|
|
3669
3669
|
};
|
|
3670
|
-
process.env.MI_LOG_TREE_STAT && (
|
|
3671
|
-
const
|
|
3672
|
-
const I = S(C.clientRoot,
|
|
3670
|
+
process.env.MI_LOG_TREE_STAT && (s.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
|
|
3671
|
+
const n = await e.withWriteTx("MLInitialization", async (C) => {
|
|
3672
|
+
const I = S(C.clientRoot, Zr);
|
|
3673
3673
|
C.createField(I, "Dynamic");
|
|
3674
|
-
const
|
|
3675
|
-
if (
|
|
3676
|
-
const
|
|
3677
|
-
return C.lock(
|
|
3674
|
+
const G = await C.getField(I);
|
|
3675
|
+
if (ue(G.value)) {
|
|
3676
|
+
const U = C.createEphemeral(Bt);
|
|
3677
|
+
return C.lock(U), C.setField(I, U), await C.commit(), await U.globalId;
|
|
3678
3678
|
} else
|
|
3679
|
-
return
|
|
3680
|
-
}),
|
|
3679
|
+
return G.value;
|
|
3680
|
+
}), i = s.logger, a = await Jo(e, t, s), c = new Xt(e.httpDispatcher, {
|
|
3681
3681
|
minTimeout: 250,
|
|
3682
3682
|
maxRetries: 4
|
|
3683
|
-
}), u = new
|
|
3683
|
+
}), u = new Mr(c), l = new Cs(
|
|
3684
3684
|
u,
|
|
3685
3685
|
a.signer,
|
|
3686
3686
|
c
|
|
3687
|
-
), p = new
|
|
3688
|
-
|
|
3687
|
+
), p = new xr(
|
|
3688
|
+
i,
|
|
3689
3689
|
e.httpDispatcher,
|
|
3690
|
-
|
|
3691
|
-
),
|
|
3690
|
+
s.frontendDownloadPath
|
|
3691
|
+
), g = {
|
|
3692
3692
|
pl: e,
|
|
3693
3693
|
signer: a.signer,
|
|
3694
|
-
logger:
|
|
3694
|
+
logger: i,
|
|
3695
3695
|
httpDispatcher: e.httpDispatcher,
|
|
3696
3696
|
retryHttpDispatcher: c,
|
|
3697
|
-
ops:
|
|
3697
|
+
ops: s,
|
|
3698
3698
|
bpPreparer: l,
|
|
3699
3699
|
frontendDownloadDriver: p,
|
|
3700
3700
|
driverKit: a,
|
|
3701
|
-
blockUpdateWatcher: new
|
|
3702
|
-
minDelay:
|
|
3701
|
+
blockUpdateWatcher: new Eo(u, i, {
|
|
3702
|
+
minDelay: s.devBlockUpdateRecheckInterval,
|
|
3703
3703
|
http: c
|
|
3704
3704
|
}),
|
|
3705
|
-
quickJs: await
|
|
3706
|
-
},
|
|
3707
|
-
return new
|
|
3708
|
-
|
|
3705
|
+
quickJs: await wr()
|
|
3706
|
+
}, m = new vr([]), h = await es(e, n, m, g);
|
|
3707
|
+
return new Wt(
|
|
3708
|
+
g,
|
|
3709
3709
|
a,
|
|
3710
3710
|
a.signer,
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3711
|
+
n,
|
|
3712
|
+
m,
|
|
3713
|
+
h.tree,
|
|
3714
3714
|
u,
|
|
3715
|
-
|
|
3715
|
+
h.computable
|
|
3716
3716
|
);
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
|
+
async function fn(o, e = {}) {
|
|
3720
|
+
const t = {
|
|
3721
|
+
pingCheckDurationMs: 1e4,
|
|
3722
|
+
pingTimeoutMs: 3e3,
|
|
3723
|
+
maxPingsPerSecond: 50,
|
|
3724
|
+
httpTimeoutMs: 3e3,
|
|
3725
|
+
blockRegistryDurationMs: 5e3,
|
|
3726
|
+
maxRegistryChecksPerSecond: 1,
|
|
3727
|
+
blockRegistryUrl: "https://blocks.pl-open.science/v2/overview.json",
|
|
3728
|
+
autoUpdateCdnDurationMs: 5e3,
|
|
3729
|
+
maxAutoUpdateCdnChecksPerSecond: 1,
|
|
3730
|
+
autoUpdateCdnUrl: "https://cdn.platforma.bio/software/platforma-desktop-v2/windows/amd64/latest.yml",
|
|
3731
|
+
...e
|
|
3732
|
+
}, r = {
|
|
3733
|
+
plPings: [],
|
|
3734
|
+
blockRegistryChecks: [],
|
|
3735
|
+
autoUpdateCdnChecks: []
|
|
3736
|
+
}, s = hr(
|
|
3737
|
+
o,
|
|
3738
|
+
{ defaultRequestTimeout: t.pingTimeoutMs }
|
|
3739
|
+
);
|
|
3740
|
+
r.plPings = await ke(
|
|
3741
|
+
t.pingCheckDurationMs,
|
|
3742
|
+
t.maxPingsPerSecond,
|
|
3743
|
+
async () => {
|
|
3744
|
+
const c = await new Ze(s).ping();
|
|
3745
|
+
return JSON.stringify(c).slice(0, 100) + "...";
|
|
3746
|
+
}
|
|
3747
|
+
);
|
|
3748
|
+
const i = new Ze(s).ll.httpDispatcher;
|
|
3749
|
+
return r.blockRegistryChecks = await ke(
|
|
3750
|
+
t.blockRegistryDurationMs,
|
|
3751
|
+
t.maxRegistryChecksPerSecond,
|
|
3752
|
+
async () => {
|
|
3753
|
+
const { body: a, statusCode: c } = await M(t.blockRegistryUrl, {
|
|
3754
|
+
dispatcher: i,
|
|
3755
|
+
bodyTimeout: t.httpTimeoutMs
|
|
3756
|
+
}), u = await a.text();
|
|
3757
|
+
return {
|
|
3758
|
+
statusCode: c,
|
|
3759
|
+
beginningOfBody: u.slice(0, 100) + "..."
|
|
3760
|
+
};
|
|
3761
|
+
}
|
|
3762
|
+
), r.autoUpdateCdnChecks = await ke(
|
|
3763
|
+
t.autoUpdateCdnDurationMs,
|
|
3764
|
+
t.maxAutoUpdateCdnChecksPerSecond,
|
|
3765
|
+
async () => {
|
|
3766
|
+
const { body: a, statusCode: c } = await M(t.autoUpdateCdnUrl, {
|
|
3767
|
+
dispatcher: i,
|
|
3768
|
+
bodyTimeout: t.httpTimeoutMs
|
|
3769
|
+
}), u = await a.text();
|
|
3770
|
+
return {
|
|
3771
|
+
statusCode: c,
|
|
3772
|
+
beginningOfBody: u.slice(0, 100) + "..."
|
|
3773
|
+
};
|
|
3774
|
+
}
|
|
3775
|
+
), Mo(r, o, t);
|
|
3776
|
+
}
|
|
3777
|
+
async function ke(o, e, t) {
|
|
3778
|
+
const r = Ae(), s = [];
|
|
3779
|
+
for (; Q(r) < o; ) {
|
|
3780
|
+
const n = Ae();
|
|
3781
|
+
try {
|
|
3782
|
+
const i = await t();
|
|
3783
|
+
s.push({
|
|
3784
|
+
elapsedMs: Q(n),
|
|
3785
|
+
response: { ok: !0, value: i }
|
|
3786
|
+
});
|
|
3787
|
+
} catch (i) {
|
|
3788
|
+
s.push({
|
|
3789
|
+
elapsedMs: Q(n),
|
|
3790
|
+
response: { ok: !1, error: i }
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
Q(n) < 1e3 / e && await kt(1e3 / e - Q(n));
|
|
3794
|
+
}
|
|
3795
|
+
return s;
|
|
3796
|
+
}
|
|
3797
|
+
function Mo(o, e, t) {
|
|
3798
|
+
const r = o.plPings.filter((h) => h.response.ok), s = o.plPings.filter((h) => !h.response.ok), { mean: n, median: i } = Ce(o.plPings), a = [...new Set(r.map((h) => JSON.stringify(h.response.value)))], c = o.blockRegistryChecks.filter((h) => h.response.ok).length, { mean: u, median: l } = Ce(o.blockRegistryChecks), p = o.autoUpdateCdnChecks.filter((h) => h.response.ok).length, { mean: g, median: m } = Ce(o.autoUpdateCdnChecks);
|
|
3799
|
+
return `
|
|
3800
|
+
Network report:
|
|
3801
|
+
pl endpoint: ${e};
|
|
3802
|
+
options: ${JSON.stringify(t, null, 2)}.
|
|
3803
|
+
|
|
3804
|
+
Platforma pings:
|
|
3805
|
+
total: ${o.plPings.length};
|
|
3806
|
+
successes: ${r.length};
|
|
3807
|
+
errors: ${o.plPings.length - r.length};
|
|
3808
|
+
mean in ms: ${n};
|
|
3809
|
+
median in ms: ${i};
|
|
3810
|
+
|
|
3811
|
+
Block registry responses:
|
|
3812
|
+
total: ${o.blockRegistryChecks.length};
|
|
3813
|
+
successes: ${c};
|
|
3814
|
+
errors: ${o.blockRegistryChecks.length - c};
|
|
3815
|
+
mean in ms: ${u};
|
|
3816
|
+
median in ms: ${l};
|
|
3817
|
+
|
|
3818
|
+
Auto-update CDN responses:
|
|
3819
|
+
total: ${o.autoUpdateCdnChecks.length};
|
|
3820
|
+
successes: ${p};
|
|
3821
|
+
errors: ${o.autoUpdateCdnChecks.length - p};
|
|
3822
|
+
mean in ms: ${g};
|
|
3823
|
+
median in ms: ${m};
|
|
3824
|
+
|
|
3825
|
+
Block registry dumps:
|
|
3826
|
+
${JSON.stringify(o.blockRegistryChecks, null, 2)}
|
|
3827
|
+
|
|
3828
|
+
Auto-update CDN dumps:
|
|
3829
|
+
${JSON.stringify(o.autoUpdateCdnChecks, null, 2)}
|
|
3830
|
+
|
|
3831
|
+
Platforma pings error dumps:
|
|
3832
|
+
${JSON.stringify(s, null, 2)}
|
|
3833
|
+
|
|
3834
|
+
Platforma pings success dump examples:
|
|
3835
|
+
${JSON.stringify(a, null, 2)}
|
|
3836
|
+
`;
|
|
3837
|
+
}
|
|
3838
|
+
function Ce(o) {
|
|
3839
|
+
const e = o.map((s) => s.elapsedMs), t = e.reduce((s, n) => s + n) / e.length;
|
|
3840
|
+
let r;
|
|
3841
|
+
if (e.length > 0) {
|
|
3842
|
+
const s = Math.floor(e.length / 2);
|
|
3843
|
+
r = e.length % 2 ? e[s] : (e[s - 1] + e[s]) / 2;
|
|
3844
|
+
}
|
|
3845
|
+
return { mean: t, median: r };
|
|
3846
|
+
}
|
|
3847
|
+
function Ae() {
|
|
3848
|
+
return Date.now();
|
|
3849
|
+
}
|
|
3850
|
+
function Q(o) {
|
|
3851
|
+
return Ae() - o;
|
|
3852
|
+
}
|
|
3719
3853
|
export {
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3854
|
+
dn as BlockPackRegistry,
|
|
3855
|
+
pn as CentralBlockRegistry,
|
|
3856
|
+
_t as DefaultDriverKitOpsPaths,
|
|
3857
|
+
Ht as DefaultDriverKitOpsSettings,
|
|
3858
|
+
xo as DefaultMiddleLayerOpsPaths,
|
|
3859
|
+
Do as DefaultMiddleLayerOpsSettings,
|
|
3860
|
+
xt as FrontendFromFolderResourceType,
|
|
3861
|
+
Dt as FrontendFromUrlResourceType,
|
|
3862
|
+
Wt as MiddleLayer,
|
|
3863
|
+
Ge as Project,
|
|
3864
|
+
ls as TengoTemplateGet,
|
|
3865
|
+
ds as TengoTemplateGetRegistry,
|
|
3866
|
+
gs as TengoTemplateGetTemplate,
|
|
3867
|
+
ps as TengoTemplateGetTemplateURI,
|
|
3868
|
+
hs as TengoTemplatePack,
|
|
3869
|
+
fs as TengoTemplatePackConvert,
|
|
3870
|
+
vs as TengoTemplatePackConvertTemplate,
|
|
3871
|
+
ms as TengoTemplatePackConvertTemplatePack,
|
|
3872
|
+
hn as V1CentralDevSnapshotRegistry,
|
|
3873
|
+
gn as V1CentralRegistry,
|
|
3874
|
+
Mr as V2RegistryProvider,
|
|
3875
|
+
fn as checkNetwork,
|
|
3876
|
+
Ot as createRenderTemplate,
|
|
3877
|
+
Pt as getDevV1PacketMtime,
|
|
3878
|
+
Je as getDevV2PacketMtime,
|
|
3879
|
+
Jo as initDriverKit,
|
|
3880
|
+
Ue as loadTemplate,
|
|
3881
|
+
ys as prepareTemplateSpec
|
|
3747
3882
|
};
|
|
3748
3883
|
//# sourceMappingURL=index.mjs.map
|