@milaboratories/pl-middle-layer 1.14.26 → 1.14.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1020 -1028
- package/dist/index.mjs.map +1 -1
- package/dist/network_check.d.ts +12 -1
- package/dist/network_check.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/network_check.test.ts +6 -10
- package/src/network_check.ts +111 -114
package/dist/index.mjs
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
1
|
var zt = Object.defineProperty;
|
|
2
|
-
var Yt = (
|
|
3
|
-
var d = (
|
|
4
|
-
import { executePSpecPredicate as qt, mapPObjectData as
|
|
2
|
+
var Yt = (s, e, t) => e in s ? zt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var d = (s, e, t) => Yt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { executePSpecPredicate as qt, mapPObjectData as Q, mapValueInVOE as Qt, mapPTableDef as ht, isFunctionHandle as ft, normalizeBlockConfig as Ae, DefaultNavigationState as Zt } from "@platforma-sdk/model";
|
|
5
5
|
export * from "@platforma-sdk/model";
|
|
6
|
-
import { blockPackIdEquals as
|
|
6
|
+
import { blockPackIdEquals as me } from "@milaboratories/pl-model-middle-layer";
|
|
7
7
|
export * from "@milaboratories/pl-model-middle-layer";
|
|
8
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
|
|
9
|
+
import { RegistryV1 as _, tryLoadPackDescription as mt, BlockPackMetaEmbedAbsoluteBytes as er, RegistryV2Reader as tr, folderReaderByUrl as rr, loadPackDescription as Ye } from "@platforma-sdk/block-tools";
|
|
10
10
|
import A from "node:fs";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { assertNever as D, notEmpty as w, ConsoleLoggerAdapter as
|
|
11
|
+
import j from "node:path";
|
|
12
|
+
import or from "yaml";
|
|
13
|
+
import { assertNever as D, notEmpty as w, ConsoleLoggerAdapter as sr, ConcurrencyLimitingExecutor as nr, HmacSha256Signer as vt } from "@milaboratories/ts-helpers";
|
|
14
14
|
import * as yt from "node:fs/promises";
|
|
15
15
|
import { tryResolve as ir } from "@milaboratories/resolve-helper";
|
|
16
|
-
import { resourceTypesEqual as $, field as S, Pl as
|
|
16
|
+
import { resourceTypesEqual as $, field as S, Pl as y, PlClient as ar, isNullResourceId as ce, ensureResourceIdNotNull as Ce, isResource as cr, isResourceRef as ur, isNotNullResourceId as qe, resourceType as re, resourceTypeToString as lr, resourceIdToString as bt, isNotFoundError as dr, isTimeoutOrCancelError as pr, toGlobalResourceId as gr, plAddressToConfig as hr, UnauthenticatedPlClient as Qe } from "@milaboratories/pl-client";
|
|
17
17
|
export * from "@milaboratories/pl-client";
|
|
18
18
|
import { SynchronizedTreeState as wt, PlError as fr } from "@milaboratories/pl-tree";
|
|
19
|
-
import { Computable as F, ChangeSource as
|
|
20
|
-
import { randomUUID as
|
|
19
|
+
import { Computable as F, ChangeSource as Ze, PollComputablePool as mr, WatchableValue as vr } from "@milaboratories/computable";
|
|
20
|
+
import { randomUUID as X, createHash as ge } from "node:crypto";
|
|
21
21
|
import St from "denque";
|
|
22
22
|
import { Templates as yr } from "@platforma-sdk/workflow-tengo";
|
|
23
|
-
import
|
|
23
|
+
import Ie from "canonicalize";
|
|
24
24
|
import br from "node:assert";
|
|
25
|
-
import { Scope as
|
|
25
|
+
import { Scope as Pe, getQuickJS as wr } from "quickjs-emscripten";
|
|
26
26
|
import { setTimeout as kt } from "node:timers/promises";
|
|
27
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
|
|
29
|
-
import { LRUCache as
|
|
30
|
-
async function
|
|
28
|
+
import { PFrame as Tr } from "@milaboratories/pframes-node";
|
|
29
|
+
import { LRUCache as jr } from "lru-cache";
|
|
30
|
+
async function Xe(s) {
|
|
31
31
|
try {
|
|
32
|
-
return await yt.stat(
|
|
32
|
+
return await yt.stat(s, { 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 Er = [_.PlPackageYamlConfigFile], Ar = [_.PlPackageJsonConfigFile],
|
|
39
|
+
const Er = [_.PlPackageYamlConfigFile], Ar = [_.PlPackageJsonConfigFile], Ve = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ne = ["config", "dist", "config.json"], Ct = ["frontend", "dist"], et = "block-model/dist/config.json", Ir = "block-ui/package.json", Vr = [
|
|
40
|
+
Ve,
|
|
40
41
|
Ne,
|
|
41
|
-
Le,
|
|
42
42
|
Er,
|
|
43
43
|
Ar,
|
|
44
44
|
Ct
|
|
45
45
|
];
|
|
46
|
-
async function Nr(
|
|
47
|
-
return await
|
|
46
|
+
async function Nr(s) {
|
|
47
|
+
return await Xe(j.join(s, ...Ne)) !== void 0 || await Xe(j.join(s, ...Ve)) !== void 0;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const t = ir(
|
|
51
|
-
if (t === void 0) throw new Error(`Can't resolve ${e} against ${
|
|
49
|
+
function ve(s, e) {
|
|
50
|
+
const t = ir(s, e);
|
|
51
|
+
if (t === void 0) throw new Error(`Can't resolve ${e} against ${s}`);
|
|
52
52
|
return t;
|
|
53
53
|
}
|
|
54
|
-
async function
|
|
55
|
-
if (
|
|
54
|
+
async function tt(s, e) {
|
|
55
|
+
if (j.isAbsolute(s) || (s = j.resolve(s)), await Nr(s))
|
|
56
56
|
return {
|
|
57
|
-
workflow:
|
|
58
|
-
config:
|
|
59
|
-
ui:
|
|
57
|
+
workflow: j.join(s, ...Ve),
|
|
58
|
+
config: j.join(s, ...Ne),
|
|
59
|
+
ui: j.join(s, ...Ct)
|
|
60
60
|
};
|
|
61
61
|
{
|
|
62
|
-
const t =
|
|
63
|
-
return { workflow: t, config: r, ui:
|
|
62
|
+
const t = ve(s, et), r = ve(s, et), o = ve(s, Ir);
|
|
63
|
+
return { workflow: t, config: r, ui: j.resolve(o, "..", "dist") };
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
async function Lr(
|
|
66
|
+
async function Lr(s) {
|
|
67
67
|
try {
|
|
68
|
-
return await A.promises.readFile(
|
|
68
|
+
return await A.promises.readFile(s, "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 Jr(
|
|
75
|
+
async function Jr(s) {
|
|
76
76
|
try {
|
|
77
|
-
return await A.promises.stat(
|
|
77
|
+
return await A.promises.stat(s, { 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 Pt(
|
|
84
|
+
async function Pt(s) {
|
|
85
85
|
let e = 0n;
|
|
86
86
|
for (const t of Vr) {
|
|
87
|
-
const r =
|
|
88
|
-
|
|
87
|
+
const r = j.join(s, ...t), o = await Jr(r);
|
|
88
|
+
o !== void 0 && e < o.mtimeNs && (e = o.mtimeNs);
|
|
89
89
|
}
|
|
90
90
|
return e.toString();
|
|
91
91
|
}
|
|
92
|
-
async function
|
|
93
|
-
const e = await A.promises.stat(
|
|
92
|
+
async function Le(s) {
|
|
93
|
+
const e = await A.promises.stat(s.components.workflow.main.file, {
|
|
94
94
|
bigint: !0
|
|
95
|
-
}), t = await A.promises.stat(
|
|
95
|
+
}), t = await A.promises.stat(s.components.model.file, { bigint: !0 });
|
|
96
96
|
return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class pn {
|
|
99
99
|
constructor(e, t, r) {
|
|
100
100
|
this.v2Provider = e, this.registries = t, this.http = r;
|
|
101
101
|
}
|
|
@@ -103,9 +103,9 @@ class dn {
|
|
|
103
103
|
const t = [], r = e.spec;
|
|
104
104
|
switch (r.type) {
|
|
105
105
|
case "remote-v1":
|
|
106
|
-
const
|
|
106
|
+
const o = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await M(
|
|
107
107
|
`${r.url}/${_.GlobalOverviewPath}`,
|
|
108
|
-
|
|
108
|
+
o
|
|
109
109
|
)).body.json();
|
|
110
110
|
for (const a of i) {
|
|
111
111
|
const { organization: c, package: u, latestMeta: l, latestVersion: p } = a, g = {
|
|
@@ -141,11 +141,11 @@ class dn {
|
|
|
141
141
|
case "local-dev":
|
|
142
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 = j.join(r.path, a.name), u = await Lr(
|
|
145
|
+
j.join(c, _.PlPackageYamlConfigFile)
|
|
146
146
|
);
|
|
147
147
|
if (u !== void 0) {
|
|
148
|
-
const l = _.PlPackageConfigData.parse(
|
|
148
|
+
const l = _.PlPackageConfigData.parse(or.parse(u)), p = await Pt(c), g = {
|
|
149
149
|
organization: l.organization,
|
|
150
150
|
name: l.package,
|
|
151
151
|
version: "DEV"
|
|
@@ -171,7 +171,7 @@ class dn {
|
|
|
171
171
|
} else {
|
|
172
172
|
const l = await mt(c);
|
|
173
173
|
if (l !== void 0) {
|
|
174
|
-
const p = await
|
|
174
|
+
const p = await Le(l);
|
|
175
175
|
t.push({
|
|
176
176
|
registryId: e.id,
|
|
177
177
|
id: l.id,
|
|
@@ -210,54 +210,54 @@ class Mr {
|
|
|
210
210
|
return this.registries.set(e, r), r;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const gn = {
|
|
214
214
|
type: "remote-v2",
|
|
215
215
|
url: "https://blocks.pl-open.science/"
|
|
216
|
-
},
|
|
216
|
+
}, hn = {
|
|
217
217
|
type: "remote-v1",
|
|
218
218
|
url: "https://block.registry.platforma.bio/releases"
|
|
219
|
-
},
|
|
219
|
+
}, fn = {
|
|
220
220
|
type: "remote-v1",
|
|
221
221
|
url: "https://block.registry.platforma.bio/dev"
|
|
222
|
-
}, Ur = {
|
|
223
|
-
groups: [{ id: "default", label: "Default", blocks: [] }]
|
|
224
222
|
}, Kr = {
|
|
223
|
+
groups: [{ id: "default", label: "Default", blocks: [] }]
|
|
224
|
+
}, Ur = {
|
|
225
225
|
stagingRefreshTimestamp: 0,
|
|
226
226
|
blocksInLimbo: []
|
|
227
227
|
}, $r = {
|
|
228
228
|
label: "New Project"
|
|
229
|
-
}, Gr = { name: "UserProject", version: "2" }, Ft = "SchemaVersion", Rt = "1",
|
|
230
|
-
function
|
|
231
|
-
return `${Hr}${
|
|
229
|
+
}, Gr = { name: "UserProject", version: "2" }, Ft = "SchemaVersion", Rt = "1", Je = "ProjectCreated", ee = "ProjectLastModified", te = "ProjectMeta", W = "ProjectStructure", ue = "BlockRenderingState", Hr = "BlockFrontendState/", _r = /^BlockFrontendState\/(?<blockid>.*)$/;
|
|
230
|
+
function Fe(s) {
|
|
231
|
+
return `${Hr}${s}`;
|
|
232
232
|
}
|
|
233
233
|
const Wr = "BlockArgsAuthor/";
|
|
234
|
-
function
|
|
235
|
-
return `${Wr}${
|
|
234
|
+
function Re(s) {
|
|
235
|
+
return `${Wr}${s}`;
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
function zr(
|
|
239
|
-
const e =
|
|
237
|
+
const Be = "ProjectStructureAuthor";
|
|
238
|
+
function zr(s) {
|
|
239
|
+
const e = s.match(_r);
|
|
240
240
|
if (e !== null)
|
|
241
241
|
return e.groups.blockid;
|
|
242
242
|
}
|
|
243
243
|
const Yr = "__serviceTemplate_";
|
|
244
|
-
function
|
|
245
|
-
return `${Yr}${
|
|
244
|
+
function Oe(s) {
|
|
245
|
+
return `${Yr}${s}`;
|
|
246
246
|
}
|
|
247
|
-
function P(
|
|
248
|
-
return `${
|
|
247
|
+
function P(s, e) {
|
|
248
|
+
return `${s}-${e}`;
|
|
249
249
|
}
|
|
250
250
|
const qr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
|
|
251
|
-
function Qr(
|
|
252
|
-
const e =
|
|
251
|
+
function Qr(s) {
|
|
252
|
+
const e = s.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 Zr = "projects", Bt = { name: "Projects", version: "1" }, Xr = (
|
|
258
|
-
async function
|
|
259
|
-
const
|
|
260
|
-
|
|
257
|
+
const Zr = "projects", Bt = { name: "Projects", version: "1" }, Xr = (s) => $(s.type, Bt) ? s.fields : [];
|
|
258
|
+
async function eo(s, e, t, r) {
|
|
259
|
+
const o = await wt.init(
|
|
260
|
+
s,
|
|
261
261
|
e,
|
|
262
262
|
{
|
|
263
263
|
...r.ops.defaultTreeOptions,
|
|
@@ -266,86 +266,86 @@ async function es(o, e, t, r) {
|
|
|
266
266
|
r.logger
|
|
267
267
|
);
|
|
268
268
|
return { computable: F.make((i) => {
|
|
269
|
-
const a = i.accessor(
|
|
269
|
+
const a = i.accessor(o.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 g = w(p.getKeyValueAsJson(
|
|
275
|
+
const g = w(p.getKeyValueAsJson(te)), f = w(p.getKeyValueAsJson(Je)), b = w(p.getKeyValueAsJson(ee));
|
|
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(f),
|
|
280
|
+
lastModified: new Date(b),
|
|
281
281
|
opened: c.indexOf(p.id) >= 0,
|
|
282
282
|
meta: g
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
return u.sort((l) => -l.lastModified.valueOf()), u;
|
|
286
|
-
}).withStableType(), tree:
|
|
286
|
+
}).withStableType(), tree: o };
|
|
287
287
|
}
|
|
288
|
-
const
|
|
288
|
+
const to = {
|
|
289
289
|
name: "EphRenderTemplate",
|
|
290
290
|
version: "1"
|
|
291
|
-
},
|
|
291
|
+
}, ro = {
|
|
292
292
|
name: "RenderTemplate",
|
|
293
293
|
version: "1"
|
|
294
294
|
};
|
|
295
|
-
function Ot(
|
|
296
|
-
if (
|
|
297
|
-
const n = t ?
|
|
298
|
-
return
|
|
295
|
+
function Ot(s, e, t, r, o) {
|
|
296
|
+
if (o.length === 0) throw new Error("Zero output names provided");
|
|
297
|
+
const n = t ? s.createEphemeral(to) : s.createStruct(ro), i = S(n, "template"), a = S(n, "inputs");
|
|
298
|
+
return s.createField(i, "Input", e), s.createField(a, "Input", y.createPlMap(s, r, t)), s.lockInputs(n), y.futureRecord(s, n, o, "Output", "outputs/");
|
|
299
299
|
}
|
|
300
|
-
const
|
|
301
|
-
function
|
|
302
|
-
return Ot(
|
|
300
|
+
const oo = { name: "BContextEnd", version: "1" }, so = { name: "BContext", version: "1" }, no = "id", io = "parent/", ao = ["context", "result"];
|
|
301
|
+
function rt(s, e, t) {
|
|
302
|
+
return Ot(s, e, !0, t, ao);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
const e =
|
|
306
|
-
return
|
|
304
|
+
function co(s) {
|
|
305
|
+
const e = s.createEphemeral(oo);
|
|
306
|
+
return s.lock(e), e;
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
if (e.length === 0) return
|
|
308
|
+
function uo(s, e) {
|
|
309
|
+
if (e.length === 0) return co(s);
|
|
310
310
|
if (e.length === 1) return e[0];
|
|
311
|
-
const t =
|
|
312
|
-
|
|
311
|
+
const t = s.createEphemeral(so);
|
|
312
|
+
s.createField(S(t, no), "Input", y.createPlString(s, X()));
|
|
313
313
|
for (let r = 0; r < e.length; r++)
|
|
314
|
-
|
|
315
|
-
return
|
|
314
|
+
s.createField(S(t, `${io}${r}`), "Input", e[r]);
|
|
315
|
+
return s.lock(t), t;
|
|
316
316
|
}
|
|
317
|
-
const
|
|
317
|
+
const lo = { name: "TengoTemplateGet", version: "1" }, po = "registry", go = "templateURI", ho = "template", fo = { name: "TengoTemplatePack", version: "1" }, mo = {
|
|
318
318
|
name: "TengoTemplatePackConvert",
|
|
319
319
|
version: "1"
|
|
320
|
-
},
|
|
321
|
-
async function
|
|
322
|
-
switch (
|
|
320
|
+
}, vo = "templatePack", yo = "template";
|
|
321
|
+
async function bo(s) {
|
|
322
|
+
switch (s.type) {
|
|
323
323
|
case "from-file":
|
|
324
324
|
return {
|
|
325
325
|
type: "explicit",
|
|
326
|
-
content: await A.promises.readFile(
|
|
326
|
+
content: await A.promises.readFile(s.path)
|
|
327
327
|
};
|
|
328
328
|
case "from-registry":
|
|
329
329
|
case "explicit":
|
|
330
|
-
return
|
|
330
|
+
return s;
|
|
331
331
|
default:
|
|
332
|
-
return D(
|
|
332
|
+
return D(s);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
const t =
|
|
337
|
-
return
|
|
335
|
+
function wo(s, e) {
|
|
336
|
+
const t = s.createStruct(lo), r = S(t, po), o = S(t, go), n = S(t, ho);
|
|
337
|
+
return s.setField(r, s.createValue(y.JsonString, Buffer.from(JSON.stringify(e.registry)))), s.setField(o, s.createValue(y.JsonString, Buffer.from(JSON.stringify(e.path)))), n;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
const t =
|
|
341
|
-
return
|
|
339
|
+
function So(s, e) {
|
|
340
|
+
const t = s.createValue(fo, e.content), r = s.createStruct(mo), o = S(r, vo), n = S(r, yo);
|
|
341
|
+
return s.setField(o, t), n;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Me(s, e) {
|
|
344
344
|
switch (e.type) {
|
|
345
345
|
case "from-registry":
|
|
346
|
-
return
|
|
346
|
+
return wo(s, e);
|
|
347
347
|
case "explicit":
|
|
348
|
-
return
|
|
348
|
+
return So(s, e);
|
|
349
349
|
default:
|
|
350
350
|
return D(e);
|
|
351
351
|
}
|
|
@@ -354,15 +354,15 @@ const Dt = { name: "Frontend/FromUrl", version: "1" }, xt = {
|
|
|
354
354
|
name: "Frontend/FromFolder",
|
|
355
355
|
version: "1"
|
|
356
356
|
};
|
|
357
|
-
function
|
|
357
|
+
function ko(s, e) {
|
|
358
358
|
switch (e.type) {
|
|
359
359
|
case "url":
|
|
360
|
-
return
|
|
360
|
+
return s.createValue(
|
|
361
361
|
Dt,
|
|
362
362
|
JSON.stringify({ url: e.url })
|
|
363
363
|
);
|
|
364
364
|
case "local":
|
|
365
|
-
return
|
|
365
|
+
return s.createValue(
|
|
366
366
|
xt,
|
|
367
367
|
JSON.stringify({
|
|
368
368
|
path: e.path,
|
|
@@ -373,11 +373,11 @@ function Ss(o, e) {
|
|
|
373
373
|
return D(e);
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
function ot(
|
|
378
|
-
return
|
|
376
|
+
const Co = { name: "BlockPackCustom", version: "1" }, Tt = "template", jt = "frontend";
|
|
377
|
+
function ot(s) {
|
|
378
|
+
return s.endsWith("/") ? s : `${s}/`;
|
|
379
379
|
}
|
|
380
|
-
class
|
|
380
|
+
class Po {
|
|
381
381
|
constructor(e, t, r) {
|
|
382
382
|
this.v2RegistryProvider = e, this.signer = t, this.http = r;
|
|
383
383
|
}
|
|
@@ -386,11 +386,11 @@ class Cs {
|
|
|
386
386
|
case "explicit":
|
|
387
387
|
return e.config;
|
|
388
388
|
case "dev-v1": {
|
|
389
|
-
const t = await
|
|
389
|
+
const t = await tt(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 Ye(e.folder), r = await A.promises.readFile(t.components.model.file, {
|
|
394
394
|
encoding: "utf-8"
|
|
395
395
|
});
|
|
396
396
|
return JSON.parse(r);
|
|
@@ -400,8 +400,8 @@ class Cs {
|
|
|
400
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 M(
|
|
403
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
|
|
404
|
+
return await (await M(o.model.url, t)).body.json();
|
|
405
405
|
}
|
|
406
406
|
default:
|
|
407
407
|
return D(e);
|
|
@@ -412,7 +412,7 @@ class Cs {
|
|
|
412
412
|
case "explicit":
|
|
413
413
|
return e;
|
|
414
414
|
case "dev-v1": {
|
|
415
|
-
const t = await
|
|
415
|
+
const t = await tt(e.folder), r = await A.promises.readFile(t.workflow), o = JSON.parse(
|
|
416
416
|
await A.promises.readFile(t.config, "utf-8")
|
|
417
417
|
), n = t.ui;
|
|
418
418
|
return {
|
|
@@ -421,7 +421,7 @@ class Cs {
|
|
|
421
421
|
type: "explicit",
|
|
422
422
|
content: r
|
|
423
423
|
},
|
|
424
|
-
config:
|
|
424
|
+
config: o,
|
|
425
425
|
frontend: {
|
|
426
426
|
type: "local",
|
|
427
427
|
path: n,
|
|
@@ -431,18 +431,18 @@ class Cs {
|
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
433
|
case "dev-v2": {
|
|
434
|
-
const t = await
|
|
434
|
+
const t = await Ye(e.folder), r = JSON.parse(
|
|
435
435
|
await A.promises.readFile(t.components.model.file, {
|
|
436
436
|
encoding: "utf-8"
|
|
437
437
|
})
|
|
438
|
-
),
|
|
438
|
+
), o = await A.promises.readFile(
|
|
439
439
|
t.components.workflow.main.file
|
|
440
440
|
), n = t.components.ui.folder, i = { ...e };
|
|
441
|
-
return e.mtime === void 0 && (i.mtime = await
|
|
441
|
+
return e.mtime === void 0 && (i.mtime = await Le(t)), {
|
|
442
442
|
type: "explicit",
|
|
443
443
|
template: {
|
|
444
444
|
type: "explicit",
|
|
445
|
-
content:
|
|
445
|
+
content: o
|
|
446
446
|
},
|
|
447
447
|
config: r,
|
|
448
448
|
frontend: {
|
|
@@ -454,10 +454,10 @@ class Cs {
|
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
456
|
case "from-registry-v1": {
|
|
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 })}`,
|
|
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 })}`, o = `${r}/template.plj.gz`, n = await M(o, t);
|
|
458
458
|
if (n.statusCode !== 200)
|
|
459
459
|
throw new Error(
|
|
460
|
-
`Block not found in registry (url = ${
|
|
460
|
+
`Block not found in registry (url = ${o} ; code = ${n.statusCode}): ` + JSON.stringify(e)
|
|
461
461
|
);
|
|
462
462
|
const i = new Uint8Array(await n.body.arrayBuffer()), c = await (await M(`${r}/config.json`, t)).body.json();
|
|
463
463
|
return {
|
|
@@ -475,7 +475,7 @@ class Cs {
|
|
|
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 } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await M(o.model.url, t)).body.json(), i = async () => await (await M(o.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 Cs {
|
|
|
485
485
|
config: a,
|
|
486
486
|
frontend: {
|
|
487
487
|
type: "url",
|
|
488
|
-
url:
|
|
488
|
+
url: o.ui.url
|
|
489
489
|
},
|
|
490
490
|
source: e
|
|
491
491
|
};
|
|
@@ -495,25 +495,25 @@ class Cs {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
const t = { config: e.config, source: e.source }, r =
|
|
500
|
-
return
|
|
498
|
+
function Fo(s, e) {
|
|
499
|
+
const t = { config: e.config, source: e.source }, r = s.createStruct(Co, JSON.stringify(t));
|
|
500
|
+
return s.createField(S(r, Tt), "Input", Me(s, e.template)), s.createField(S(r, jt), "Input", ko(s, e.frontend)), s.lock(r), r;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function st(s, e) {
|
|
503
503
|
switch (e.type) {
|
|
504
504
|
case "explicit":
|
|
505
|
-
return
|
|
505
|
+
return Fo(s, e);
|
|
506
506
|
default:
|
|
507
507
|
return D(e.type);
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
return { __isRef: !0, blockId:
|
|
510
|
+
function ne(s, e) {
|
|
511
|
+
return { __isRef: !0, blockId: s, name: e };
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
return typeof
|
|
513
|
+
function Ro(s) {
|
|
514
|
+
return typeof s == "object" && s !== null && s.__isRef === !0 && "blockId" in s && "name" in s;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function De(s, e, t) {
|
|
517
517
|
const r = typeof e;
|
|
518
518
|
switch (r) {
|
|
519
519
|
case "function":
|
|
@@ -526,26 +526,26 @@ function xe(o, 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 (Ro(e))
|
|
530
|
+
t === void 0 || t.has(e.blockId) ? s.upstreams.add(e.blockId) : s.missingReferences = !0;
|
|
531
531
|
else if (Array.isArray(e))
|
|
532
|
-
for (const
|
|
532
|
+
for (const o of e) De(s, o, t);
|
|
533
533
|
else
|
|
534
|
-
for (const [,
|
|
535
|
-
|
|
534
|
+
for (const [, o] of Object.entries(e))
|
|
535
|
+
De(s, o, t);
|
|
536
536
|
return;
|
|
537
537
|
default:
|
|
538
538
|
D(r);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function Bo(s, e) {
|
|
542
542
|
const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
|
|
543
|
-
return
|
|
543
|
+
return De(t, s, e), t;
|
|
544
544
|
}
|
|
545
|
-
function N(
|
|
545
|
+
function N(s) {
|
|
546
546
|
return {
|
|
547
547
|
*[Symbol.iterator]() {
|
|
548
|
-
for (const e of
|
|
548
|
+
for (const e of s.groups) for (const t of e.blocks) yield t;
|
|
549
549
|
}
|
|
550
550
|
};
|
|
551
551
|
}
|
|
@@ -557,104 +557,104 @@ class Et {
|
|
|
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, (o) => r.add(o.id)), r;
|
|
561
561
|
}
|
|
562
562
|
traverseIdsExcludingRoots(e, ...t) {
|
|
563
563
|
const r = this.traverseIds(e, ...t);
|
|
564
|
-
for (const
|
|
564
|
+
for (const o of t) r.delete(o);
|
|
565
565
|
return r;
|
|
566
566
|
}
|
|
567
567
|
traverse(e, t, r) {
|
|
568
|
-
let
|
|
569
|
-
const n = new Set(
|
|
570
|
-
for (;
|
|
568
|
+
let o = [...t];
|
|
569
|
+
const n = new Set(o);
|
|
570
|
+
for (; o.length > 0; ) {
|
|
571
571
|
let i = [];
|
|
572
|
-
for (const a of
|
|
572
|
+
for (const a of o) {
|
|
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
|
+
o = i;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
function
|
|
582
|
+
function xe(s) {
|
|
583
583
|
const e = /* @__PURE__ */ new Map();
|
|
584
584
|
let t;
|
|
585
|
-
for (const { id: r } of N(
|
|
586
|
-
const
|
|
585
|
+
for (const { id: r } of N(s)) {
|
|
586
|
+
const o = {
|
|
587
587
|
id: r,
|
|
588
588
|
missingReferences: !1
|
|
589
589
|
};
|
|
590
|
-
e.set(r,
|
|
590
|
+
e.set(r, o), t === void 0 ? o.upstream = /* @__PURE__ */ new Set() : (o.upstream = /* @__PURE__ */ new Set([t.id]), t.downstream = /* @__PURE__ */ new Set([o.id])), t = o;
|
|
591
591
|
}
|
|
592
592
|
return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Et(e);
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function ie(s, e) {
|
|
595
595
|
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
596
|
-
for (const { id:
|
|
597
|
-
const n = e(
|
|
596
|
+
for (const { id: o } of N(s)) {
|
|
597
|
+
const n = e(o);
|
|
598
598
|
if (n === void 0) continue;
|
|
599
|
-
const i =
|
|
600
|
-
id:
|
|
599
|
+
const i = Bo(n, r), a = {
|
|
600
|
+
id: o,
|
|
601
601
|
missingReferences: i.missingReferences,
|
|
602
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(o, a), i.upstreams.forEach((c) => t.get(c).downstream.add(o)), r.add(o);
|
|
607
607
|
}
|
|
608
608
|
return new Et(t);
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
if (
|
|
612
|
-
for (const t of
|
|
610
|
+
function Oo(s, e) {
|
|
611
|
+
if (s.size !== e.size) return !1;
|
|
612
|
+
for (const t of s) if (!e.has(t)) return !1;
|
|
613
613
|
return !0;
|
|
614
614
|
}
|
|
615
|
-
function Te(
|
|
616
|
-
if (
|
|
617
|
-
for (const t of
|
|
615
|
+
function Te(s, e) {
|
|
616
|
+
if (s.size > e.size) return Te(e, s);
|
|
617
|
+
for (const t of s) 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
|
|
620
|
+
function nt(s, e) {
|
|
621
|
+
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
622
|
+
return s.nodes.forEach((n) => {
|
|
623
623
|
const i = e.nodes.get(n.id);
|
|
624
|
-
i === void 0 ? t.add(n.id) : (!
|
|
624
|
+
i === void 0 ? t.add(n.id) : (!Oo(n.upstream, i.upstream) || Te(n.upstream, o)) && o.add(n.id);
|
|
625
625
|
}), e.nodes.forEach((n) => {
|
|
626
|
-
|
|
627
|
-
}), { onlyInA: t, onlyInB: r, different:
|
|
626
|
+
s.nodes.has(n.id) ? Te(n.upstream, o) && o.add(n.id) : r.add(n.id);
|
|
627
|
+
}), { onlyInA: t, onlyInB: r, different: o };
|
|
628
628
|
}
|
|
629
|
-
let
|
|
629
|
+
let ye;
|
|
630
630
|
async function At() {
|
|
631
|
-
if (
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
const e =
|
|
635
|
-
|
|
631
|
+
if (ye === void 0) {
|
|
632
|
+
const s = await bo(yr["pframes.export-pframe"]);
|
|
633
|
+
if (s.type !== "explicit") throw new Error("Unexpected prepared template type.");
|
|
634
|
+
const e = ge("sha256").update(s.content).digest("hex");
|
|
635
|
+
ye = { spec: s, hash: e };
|
|
636
636
|
}
|
|
637
|
-
return
|
|
637
|
+
return ye;
|
|
638
638
|
}
|
|
639
|
-
function
|
|
640
|
-
return Ot(
|
|
639
|
+
function Do(s, e, t) {
|
|
640
|
+
return Ot(s, e, !0, { pf: t }, ["result"]).result;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
643
|
-
let t = !1, r,
|
|
642
|
+
function be(s, e) {
|
|
643
|
+
let t = !1, r, o;
|
|
644
644
|
return () => {
|
|
645
645
|
if (!t)
|
|
646
|
-
return t = !0, r =
|
|
647
|
-
const n =
|
|
648
|
-
return r !== n && (r = n,
|
|
646
|
+
return t = !0, r = s(), o = e(), o;
|
|
647
|
+
const n = s();
|
|
648
|
+
return r !== n && (r = n, o = e()), e();
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
|
-
class
|
|
651
|
+
class it {
|
|
652
652
|
constructor(e, t) {
|
|
653
|
-
d(this, "currentInputsC",
|
|
653
|
+
d(this, "currentInputsC", be(
|
|
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", be(
|
|
658
658
|
() => {
|
|
659
659
|
var e;
|
|
660
660
|
return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
|
|
@@ -666,7 +666,7 @@ class at {
|
|
|
666
666
|
return JSON.parse(Buffer.from(e).toString());
|
|
667
667
|
}
|
|
668
668
|
));
|
|
669
|
-
d(this, "productionStaleC",
|
|
669
|
+
d(this, "productionStaleC", be(
|
|
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 at {
|
|
|
707
707
|
}
|
|
708
708
|
getTemplate(e) {
|
|
709
709
|
return e.getFutureFieldValue(
|
|
710
|
-
|
|
711
|
-
|
|
710
|
+
y.unwrapHolder(e, this.fields.blockPack.ref),
|
|
711
|
+
Tt,
|
|
712
712
|
"Input"
|
|
713
713
|
);
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
const
|
|
717
|
-
throw new Error(`No new block info for ${
|
|
716
|
+
const xo = (s) => {
|
|
717
|
+
throw new Error(`No new block info for ${s}`);
|
|
718
718
|
};
|
|
719
|
-
class
|
|
720
|
-
constructor(e, t, r,
|
|
719
|
+
class le {
|
|
720
|
+
constructor(e, t, r, o, 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 de {
|
|
|
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 = o, 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 de {
|
|
|
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 = xe(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 = ie(
|
|
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 = ie(
|
|
763
763
|
this.struct,
|
|
764
764
|
(e) => this.getBlockInfo(e).actualProductionInputs
|
|
765
765
|
)), this.actualProductionGraph;
|
|
@@ -775,21 +775,21 @@ class de {
|
|
|
775
775
|
throw new Error("block not found");
|
|
776
776
|
}
|
|
777
777
|
setBlockFieldObj(e, t, r) {
|
|
778
|
-
const
|
|
778
|
+
const o = 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(o, "Dynamic", r.ref) : this.tx.setField(o, 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, o, n) {
|
|
786
|
+
this.setBlockFieldObj(e, t, { ref: r, status: o, value: n });
|
|
787
787
|
}
|
|
788
788
|
deleteBlockFields(e, ...t) {
|
|
789
789
|
let r = !1;
|
|
790
|
-
const
|
|
790
|
+
const o = this.getBlockInfo(e);
|
|
791
791
|
for (const n of t) {
|
|
792
|
-
const i =
|
|
792
|
+
const i = o.fields;
|
|
793
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;
|
|
@@ -804,31 +804,31 @@ class de {
|
|
|
804
804
|
this.renderingState.stagingRefreshTimestamp = Date.now(), this.renderingStateChanged = !0;
|
|
805
805
|
}
|
|
806
806
|
resetStaging(e) {
|
|
807
|
-
var r,
|
|
807
|
+
var r, o, 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" && ((o = t.stagingCtx) == null ? void 0 : o.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, o, 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" && ((o = t.prodCtx) == null ? void 0 : o.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, o;
|
|
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" && ((o = t.prodCtx) == null ? void 0 : o.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:
|
|
826
|
+
for (const { blockId: r, args: o } of e) {
|
|
827
827
|
const n = this.getBlockInfo(r);
|
|
828
|
-
JSON.parse(
|
|
829
|
-
const i = Buffer.from(
|
|
828
|
+
JSON.parse(o);
|
|
829
|
+
const i = Buffer.from(o);
|
|
830
830
|
if (Buffer.compare(n.fields.currentArgs.value, i) === 0) continue;
|
|
831
|
-
const a = this.tx.createValue(
|
|
831
|
+
const a = this.tx.createValue(y.JsonObject, i);
|
|
832
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();
|
|
@@ -840,41 +840,41 @@ class de {
|
|
|
840
840
|
/** Update block label */
|
|
841
841
|
setBlockLabel(e, t) {
|
|
842
842
|
const r = this.structure;
|
|
843
|
-
let
|
|
843
|
+
let o = !1;
|
|
844
844
|
for (const n of N(r))
|
|
845
845
|
if (n.id === e) {
|
|
846
|
-
n.label = t,
|
|
846
|
+
n.label = t, o = !0;
|
|
847
847
|
break;
|
|
848
848
|
}
|
|
849
|
-
if (!
|
|
849
|
+
if (!o) 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 n = this.getBlockInfo(
|
|
854
|
+
return e.forEach((o) => {
|
|
855
|
+
const n = this.getBlockInfo(o);
|
|
856
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(y.unwrapHolder(this.tx, n.fields[t].ref));
|
|
859
|
+
}), uo(this.tx, r);
|
|
860
860
|
}
|
|
861
861
|
exportCtx(e) {
|
|
862
|
-
return
|
|
862
|
+
return Do(this.tx, y.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 o = t.getTemplate(this.tx), n = rt(this.tx, o, {
|
|
869
869
|
args: t.fields.currentArgs.ref,
|
|
870
|
-
blockId: this.tx.createValue(
|
|
871
|
-
isProduction: this.tx.createValue(
|
|
870
|
+
blockId: this.tx.createValue(y.JsonString, JSON.stringify(e)),
|
|
871
|
+
isProduction: this.tx.createValue(y.JsonBool, JSON.stringify(!1)),
|
|
872
872
|
context: r
|
|
873
873
|
});
|
|
874
874
|
this.setBlockField(
|
|
875
875
|
e,
|
|
876
876
|
"stagingCtx",
|
|
877
|
-
|
|
877
|
+
y.wrapInEphHolder(this.tx, n.context),
|
|
878
878
|
"NotReady"
|
|
879
879
|
), this.setBlockField(e, "stagingUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "stagingOutput", n.result, "NotReady");
|
|
880
880
|
}
|
|
@@ -886,16 +886,16 @@ class de {
|
|
|
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 o = t.getTemplate(this.tx), n = rt(this.tx, o, {
|
|
890
890
|
args: t.fields.currentArgs.ref,
|
|
891
|
-
blockId: this.tx.createValue(
|
|
892
|
-
isProduction: this.tx.createValue(
|
|
891
|
+
blockId: this.tx.createValue(y.JsonString, JSON.stringify(e)),
|
|
892
|
+
isProduction: this.tx.createValue(y.JsonBool, JSON.stringify(!0)),
|
|
893
893
|
context: r
|
|
894
894
|
});
|
|
895
895
|
this.setBlockField(
|
|
896
896
|
e,
|
|
897
897
|
"prodCtx",
|
|
898
|
-
|
|
898
|
+
y.wrapInEphHolder(this.tx, n.context),
|
|
899
899
|
"NotReady"
|
|
900
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
|
}
|
|
@@ -903,28 +903,28 @@ class de {
|
|
|
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 = xo) {
|
|
907
|
+
const r = this.getStagingGraph(), o = this.getActualProductionGraph(), n = xe(e), i = ie(
|
|
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 = nt(r, n), c = nt(o, 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 it(u, {});
|
|
920
920
|
this.blockInfos.set(u, l);
|
|
921
|
-
const p = t(u), g =
|
|
922
|
-
this.setBlockField(u, "blockPack",
|
|
923
|
-
const
|
|
924
|
-
this.setBlockField(u, "currentArgs",
|
|
921
|
+
const p = t(u), g = st(this.tx, p.blockPack);
|
|
922
|
+
this.setBlockField(u, "blockPack", y.wrapInHolder(this.tx, g), "NotReady");
|
|
923
|
+
const f = Buffer.from(p.args), b = this.tx.createValue(y.JsonObject, f);
|
|
924
|
+
this.setBlockField(u, "currentArgs", b, "Ready", f), l.check();
|
|
925
925
|
}
|
|
926
926
|
for (const u of a.different) this.resetStaging(u);
|
|
927
|
-
|
|
927
|
+
o.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,12 +932,12 @@ class de {
|
|
|
932
932
|
// Structure change helpers
|
|
933
933
|
//
|
|
934
934
|
addBlock(e, t, r) {
|
|
935
|
-
const
|
|
935
|
+
const o = this.structure;
|
|
936
936
|
if (r === void 0)
|
|
937
|
-
|
|
937
|
+
o.groups[o.groups.length - 1].blocks.push(e);
|
|
938
938
|
else {
|
|
939
939
|
let n = !1;
|
|
940
|
-
for (const i of
|
|
940
|
+
for (const i of o.groups) {
|
|
941
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;
|
|
@@ -946,7 +946,7 @@ class de {
|
|
|
946
946
|
}
|
|
947
947
|
if (!n) throw new Error(`Can't find element with id: ${r}`);
|
|
948
948
|
}
|
|
949
|
-
this.updateStructure(
|
|
949
|
+
this.updateStructure(o, (n) => {
|
|
950
950
|
if (n !== e.id) throw new Error("Unexpected");
|
|
951
951
|
return t;
|
|
952
952
|
});
|
|
@@ -954,10 +954,10 @@ class de {
|
|
|
954
954
|
deleteBlock(e) {
|
|
955
955
|
const t = this.structure;
|
|
956
956
|
let r = !1;
|
|
957
|
-
for (const
|
|
958
|
-
const n =
|
|
957
|
+
for (const o of t.groups) {
|
|
958
|
+
const n = o.blocks.findIndex((i) => i.id === e);
|
|
959
959
|
if (!(n < 0)) {
|
|
960
|
-
|
|
960
|
+
o.blocks.splice(n, 1), r = !0;
|
|
961
961
|
break;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
@@ -968,13 +968,13 @@ class de {
|
|
|
968
968
|
// Block-pack migration
|
|
969
969
|
//
|
|
970
970
|
migrateBlockPack(e, t, r) {
|
|
971
|
-
const
|
|
971
|
+
const o = this.getBlockInfo(e);
|
|
972
972
|
this.setBlockField(
|
|
973
973
|
e,
|
|
974
974
|
"blockPack",
|
|
975
|
-
|
|
975
|
+
y.wrapInHolder(this.tx, st(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: n }) => this.resetStaging(n)),
|
|
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)), o.productionRendered && this.getActualProductionGraph().traverse(
|
|
978
978
|
"downstream",
|
|
979
979
|
[e],
|
|
980
980
|
({ id: n }) => this.resetOrLimboProduction(n)
|
|
@@ -984,14 +984,14 @@ class de {
|
|
|
984
984
|
// Render
|
|
985
985
|
//
|
|
986
986
|
renderProduction(e, t = !1) {
|
|
987
|
-
const r = new Set(e),
|
|
987
|
+
const r = new Set(e), o = this.getPendingProductionGraph();
|
|
988
988
|
if (t)
|
|
989
|
-
|
|
989
|
+
o.traverse("upstream", e, (i) => {
|
|
990
990
|
r.add(i.id);
|
|
991
991
|
});
|
|
992
992
|
else
|
|
993
993
|
for (const i of r) {
|
|
994
|
-
const a =
|
|
994
|
+
const a = o.nodes.get(i);
|
|
995
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))
|
|
@@ -1002,7 +1002,7 @@ class de {
|
|
|
1002
1002
|
if (!r.has(i.id)) continue;
|
|
1003
1003
|
let a = this.getBlockInfo(i.id).requireProductionRendering || this.blocksInLimbo.has(i.id);
|
|
1004
1004
|
if (!a) {
|
|
1005
|
-
for (const c of
|
|
1005
|
+
for (const c of o.nodes.get(i.id).upstream)
|
|
1006
1006
|
if (n.has(c)) {
|
|
1007
1007
|
a = !0;
|
|
1008
1008
|
break;
|
|
@@ -1010,7 +1010,7 @@ class de {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
a && (this.renderProductionFor(i.id), n.add(i.id));
|
|
1012
1012
|
}
|
|
1013
|
-
return
|
|
1013
|
+
return o.traverse("downstream", [...n], (i) => {
|
|
1014
1014
|
n.has(i.id) || this.resetOrLimboProduction(i.id);
|
|
1015
1015
|
}), n.size > 0 && this.updateLastModified(), n;
|
|
1016
1016
|
}
|
|
@@ -1018,13 +1018,13 @@ class de {
|
|
|
1018
1018
|
* accordingly */
|
|
1019
1019
|
stopProduction(...e) {
|
|
1020
1020
|
var i, a;
|
|
1021
|
-
const t = this.getActualProductionGraph(), r = new St(e),
|
|
1021
|
+
const t = this.getActualProductionGraph(), r = new St(e), o = new Set(e), n = [];
|
|
1022
1022
|
for (; !r.isEmpty(); ) {
|
|
1023
1023
|
const c = r.shift(), u = this.getBlockInfo(c).fields;
|
|
1024
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
1025
|
n.push(c);
|
|
1026
1026
|
for (const l of t.traverseIdsExcludingRoots("downstream", c))
|
|
1027
|
-
|
|
1027
|
+
o.has(l) || (r.push(l), o.add(l));
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
for (const c of t.traverseIdsExcludingRoots("downstream", ...n))
|
|
@@ -1032,21 +1032,21 @@ class de {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
traverseWithStagingLag(e) {
|
|
1034
1034
|
const t = /* @__PURE__ */ new Map();
|
|
1035
|
-
this.getStagingGraph().nodes.forEach((
|
|
1036
|
-
let i = this.getBlockInfo(
|
|
1037
|
-
|
|
1035
|
+
this.getStagingGraph().nodes.forEach((o) => {
|
|
1036
|
+
let i = this.getBlockInfo(o.id).stagingRendered ? 0 : 1;
|
|
1037
|
+
o.upstream.forEach((a) => {
|
|
1038
1038
|
const c = t.get(a);
|
|
1039
1039
|
c !== 0 && (i = Math.max(c + 1, i));
|
|
1040
|
-
}), e(
|
|
1040
|
+
}), e(o.id, i), t.set(o.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
|
|
1046
|
+
let o = 0;
|
|
1047
1047
|
this.traverseWithStagingLag((n, i) => {
|
|
1048
|
-
i !== 0 && (r === void 0 || i <= r) && (this.renderStagingFor(n),
|
|
1049
|
-
}),
|
|
1048
|
+
i !== 0 && (r === void 0 || i <= r) && (this.renderStagingFor(n), o++);
|
|
1049
|
+
}), o > 0 && this.resetStagingRefreshTimestamp();
|
|
1050
1050
|
}
|
|
1051
1051
|
//
|
|
1052
1052
|
// Meta
|
|
@@ -1061,8 +1061,8 @@ class de {
|
|
|
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, o, n, i;
|
|
1065
|
+
((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((o = t.fields.prodOutput) == null ? void 0 : o.status) === "Ready" && this.deleteBlockFields(
|
|
1066
1066
|
t.id,
|
|
1067
1067
|
"prodOutputPrevious",
|
|
1068
1068
|
"prodCtxPrevious",
|
|
@@ -1078,37 +1078,37 @@ class de {
|
|
|
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, Re(t)) : this.tx.setKValue(this.rid, Re(t), e);
|
|
1082
|
+
(this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Be) : this.tx.setKValue(this.rid, Be, 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, ee, 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
|
+
ue,
|
|
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, te, 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, Fe(e)) : this.tx.setKValue(this.rid, Fe(e), t);
|
|
1097
1097
|
}
|
|
1098
1098
|
this.assignAuthorMarkers();
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
static async load(e, t, r) {
|
|
1102
|
-
const
|
|
1102
|
+
const o = e.getResourceData(t, !0), n = e.getKValueJson(t, Ft), i = e.getKValueJson(t, ee), a = e.getKValueJson(t, te), c = e.getKValueJson(t, W), u = e.getKValueJson(t, ue), l = e.listKeyValuesString(t), [
|
|
1103
1103
|
p,
|
|
1104
1104
|
g,
|
|
1105
|
-
|
|
1106
|
-
|
|
1105
|
+
f,
|
|
1106
|
+
b,
|
|
1107
1107
|
C,
|
|
1108
1108
|
{ stagingRefreshTimestamp: I, blocksInLimbo: G },
|
|
1109
|
-
|
|
1109
|
+
K
|
|
1110
1110
|
] = await Promise.all([
|
|
1111
|
-
|
|
1111
|
+
o,
|
|
1112
1112
|
n,
|
|
1113
1113
|
i,
|
|
1114
1114
|
a,
|
|
@@ -1121,31 +1121,31 @@ class de {
|
|
|
1121
1121
|
`Can't act on this project resource because it has a wrong schema version: ${g}`
|
|
1122
1122
|
);
|
|
1123
1123
|
const H = /* @__PURE__ */ new Map();
|
|
1124
|
-
for (const
|
|
1125
|
-
const O = Qr(
|
|
1124
|
+
for (const v of p.fields) {
|
|
1125
|
+
const O = Qr(v.name);
|
|
1126
1126
|
if (O === void 0) continue;
|
|
1127
1127
|
let R = H.get(O.blockId);
|
|
1128
1128
|
R === void 0 && (R = {
|
|
1129
1129
|
id: O.blockId,
|
|
1130
1130
|
fields: {}
|
|
1131
|
-
}, H.set(O.blockId, R)), R.fields[O.fieldName] =
|
|
1131
|
+
}, H.set(O.blockId, R)), R.fields[O.fieldName] = ce(v.value) ? { modCount: 0 } : { modCount: 0, ref: v.value };
|
|
1132
1132
|
}
|
|
1133
|
-
const z = await At(), oe =
|
|
1134
|
-
(
|
|
1133
|
+
const z = await At(), oe = Oe(z.hash), k = p.fields.find(
|
|
1134
|
+
(v) => v.name === oe
|
|
1135
1135
|
);
|
|
1136
1136
|
let J;
|
|
1137
|
-
k !== void 0 ? J =
|
|
1138
|
-
S(t,
|
|
1137
|
+
k !== void 0 ? J = Ce(k.value) : (J = y.wrapInHolder(e, Me(e, z.spec)), e.createField(
|
|
1138
|
+
S(t, Oe(z.hash)),
|
|
1139
1139
|
"Dynamic",
|
|
1140
1140
|
J
|
|
1141
1141
|
));
|
|
1142
1142
|
const Y = { stagingRefreshTimestamp: I }, E = new Set(G), x = /* @__PURE__ */ new Map();
|
|
1143
|
-
for (const
|
|
1144
|
-
const O = zr(
|
|
1145
|
-
O !== void 0 && x.set(O,
|
|
1143
|
+
for (const v of K) {
|
|
1144
|
+
const O = zr(v.key);
|
|
1145
|
+
O !== void 0 && x.set(O, v.value);
|
|
1146
1146
|
}
|
|
1147
1147
|
const B = [];
|
|
1148
|
-
H.forEach(({ id:
|
|
1148
|
+
H.forEach(({ id: v, fields: O }) => {
|
|
1149
1149
|
for (const [, R] of Object.entries(O))
|
|
1150
1150
|
if (R.ref !== void 0) {
|
|
1151
1151
|
if (!cr(R.ref) || ur(R.ref))
|
|
@@ -1153,139 +1153,139 @@ class de {
|
|
|
1153
1153
|
B.push([R, e.getResourceData(R.ref, !1)]);
|
|
1154
1154
|
}
|
|
1155
1155
|
});
|
|
1156
|
-
for (const [
|
|
1156
|
+
for (const [v, O] of B) {
|
|
1157
1157
|
const R = await O;
|
|
1158
|
-
|
|
1158
|
+
v.value = R.data, qe(R.error) ? v.status = "Error" : R.resourceReady || qe(R.originalResourceId) ? v.status = "Ready" : v.status = "NotReady";
|
|
1159
1159
|
}
|
|
1160
|
-
const
|
|
1161
|
-
H.forEach(({ id:
|
|
1160
|
+
const U = /* @__PURE__ */ new Map();
|
|
1161
|
+
H.forEach(({ id: v, fields: O }) => U.set(v, new it(v, O)));
|
|
1162
1162
|
const L = /* @__PURE__ */ new Set();
|
|
1163
|
-
for (const
|
|
1164
|
-
if (!
|
|
1165
|
-
throw new Error(`Inconsistent project structure: no inputs for ${
|
|
1166
|
-
L.add(
|
|
1163
|
+
for (const v of N(C)) {
|
|
1164
|
+
if (!U.has(v.id))
|
|
1165
|
+
throw new Error(`Inconsistent project structure: no inputs for ${v.id}`);
|
|
1166
|
+
L.add(v.id);
|
|
1167
1167
|
}
|
|
1168
|
-
|
|
1169
|
-
if (!L.has(
|
|
1170
|
-
throw new Error(`Inconsistent project structure: no structure entry for ${
|
|
1171
|
-
|
|
1168
|
+
U.forEach((v) => {
|
|
1169
|
+
if (!L.has(v.id))
|
|
1170
|
+
throw new Error(`Inconsistent project structure: no structure entry for ${v.id}`);
|
|
1171
|
+
v.check();
|
|
1172
1172
|
});
|
|
1173
|
-
const
|
|
1173
|
+
const se = new le(
|
|
1174
1174
|
t,
|
|
1175
1175
|
e,
|
|
1176
1176
|
r,
|
|
1177
1177
|
g,
|
|
1178
|
-
|
|
1179
|
-
|
|
1178
|
+
f,
|
|
1179
|
+
b,
|
|
1180
1180
|
C,
|
|
1181
1181
|
Y,
|
|
1182
1182
|
E,
|
|
1183
|
-
|
|
1183
|
+
U,
|
|
1184
1184
|
x,
|
|
1185
1185
|
J
|
|
1186
1186
|
);
|
|
1187
|
-
return
|
|
1187
|
+
return se.fixProblems(), se;
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
|
-
async function
|
|
1191
|
-
const t =
|
|
1192
|
-
|
|
1190
|
+
async function To(s, e = $r) {
|
|
1191
|
+
const t = s.createEphemeral(Gr);
|
|
1192
|
+
s.lock(t);
|
|
1193
1193
|
const r = String(Date.now());
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1196
|
-
return
|
|
1197
|
-
S(t,
|
|
1194
|
+
s.setKValue(t, Ft, JSON.stringify(Rt)), s.setKValue(t, Je, r), s.setKValue(t, ee, r), s.setKValue(t, te, JSON.stringify(e)), s.setKValue(t, W, JSON.stringify(Kr)), s.setKValue(t, ue, JSON.stringify(Ur));
|
|
1195
|
+
const o = await At();
|
|
1196
|
+
return s.createField(
|
|
1197
|
+
S(t, Oe(o.hash)),
|
|
1198
1198
|
"Dynamic",
|
|
1199
|
-
|
|
1199
|
+
y.wrapInHolder(s, Me(s, o.spec))
|
|
1200
1200
|
), t;
|
|
1201
1201
|
}
|
|
1202
|
-
async function
|
|
1203
|
-
return V(
|
|
1202
|
+
async function we(s, e, t) {
|
|
1203
|
+
return V(s, e, void 0, t);
|
|
1204
1204
|
}
|
|
1205
|
-
async function V(
|
|
1206
|
-
if (
|
|
1207
|
-
return await
|
|
1208
|
-
const n = await
|
|
1209
|
-
return n.wasModified && (n.save(), await
|
|
1205
|
+
async function V(s, e, t, r) {
|
|
1206
|
+
if (s instanceof ar)
|
|
1207
|
+
return await s.withWriteTx("ProjectAction", async (o) => {
|
|
1208
|
+
const n = await le.load(o, e, t), i = await r(n);
|
|
1209
|
+
return n.wasModified && (n.save(), await o.commit()), i;
|
|
1210
1210
|
});
|
|
1211
1211
|
{
|
|
1212
|
-
const
|
|
1213
|
-
return
|
|
1212
|
+
const o = await le.load(s, e, t), n = await r(o);
|
|
1213
|
+
return o.save(), n;
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
|
-
function*
|
|
1217
|
-
switch (
|
|
1216
|
+
function* jo(s) {
|
|
1217
|
+
switch (s.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(s.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(s.parts))
|
|
1225
1225
|
yield e, yield t;
|
|
1226
1226
|
return;
|
|
1227
1227
|
default:
|
|
1228
|
-
D(
|
|
1228
|
+
D(s);
|
|
1229
1229
|
}
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function at(s, e) {
|
|
1232
1232
|
return Object.fromEntries(
|
|
1233
|
-
Object.entries(
|
|
1233
|
+
Object.entries(s).map(([t, r]) => [t, e(r, t)])
|
|
1234
1234
|
);
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1237
|
-
switch (
|
|
1236
|
+
function Eo(s, e) {
|
|
1237
|
+
switch (s.type) {
|
|
1238
1238
|
case "Json":
|
|
1239
|
-
return { ...
|
|
1239
|
+
return { ...s };
|
|
1240
1240
|
case "JsonPartitioned":
|
|
1241
|
-
return { ...
|
|
1241
|
+
return { ...s, parts: at(s.parts, e) };
|
|
1242
1242
|
case "BinaryPartitioned":
|
|
1243
1243
|
return {
|
|
1244
|
-
...
|
|
1245
|
-
parts:
|
|
1244
|
+
...s,
|
|
1245
|
+
parts: at(s.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(s);
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1254
|
+
const Ao = re("PColumnData/JsonPartitioned", "1"), Io = re(
|
|
1255
1255
|
"PColumnData/Partitioned/JsonPartitioned",
|
|
1256
1256
|
"1"
|
|
1257
|
-
),
|
|
1257
|
+
), Vo = re("PColumnData/BinaryPartitioned", "1"), No = re(
|
|
1258
1258
|
"PColumnData/Partitioned/BinaryPartitioned",
|
|
1259
1259
|
"1"
|
|
1260
|
-
),
|
|
1261
|
-
function
|
|
1262
|
-
if (!
|
|
1263
|
-
const e =
|
|
1260
|
+
), Lo = re("PColumnData/Json", "1");
|
|
1261
|
+
function Jo(s) {
|
|
1262
|
+
if (!s.getIsReadyOrError()) throw new Error("Data not ready.");
|
|
1263
|
+
const e = s.getDataAsJson();
|
|
1264
1264
|
if (e === void 0)
|
|
1265
1265
|
throw new Error("unexpected data info structure, no resource data");
|
|
1266
|
-
if ($(
|
|
1266
|
+
if ($(s.resourceType, Lo)) {
|
|
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 ($(s.resourceType, Ao)) {
|
|
1274
1274
|
const t = e, r = Object.fromEntries(
|
|
1275
|
-
|
|
1275
|
+
s.listInputFields().map((o) => [o, s.traverse({ field: o, 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 ($(s.resourceType, Io)) {
|
|
1283
1283
|
const t = e, r = {};
|
|
1284
|
-
for (const
|
|
1285
|
-
const n =
|
|
1286
|
-
if (i === void 0) throw new Error(`no partition keys for super key ${
|
|
1284
|
+
for (const o of s.listInputFields()) {
|
|
1285
|
+
const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
|
|
1286
|
+
if (i === void 0) throw new Error(`no partition keys for super key ${o}`);
|
|
1287
1287
|
for (const a of i) {
|
|
1288
|
-
const c = JSON.stringify([...JSON.parse(
|
|
1288
|
+
const c = JSON.stringify([...JSON.parse(o), ...JSON.parse(a)]);
|
|
1289
1289
|
r[c] = n.traverse({ field: a, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
@@ -1294,42 +1294,42 @@ function Ls(o) {
|
|
|
1294
1294
|
partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
|
|
1295
1295
|
parts: r
|
|
1296
1296
|
};
|
|
1297
|
-
} else if ($(
|
|
1297
|
+
} else if ($(s.resourceType, Vo)) {
|
|
1298
1298
|
const t = e, r = {};
|
|
1299
|
-
for (const
|
|
1300
|
-
if (
|
|
1301
|
-
const n =
|
|
1299
|
+
for (const o of s.listInputFields())
|
|
1300
|
+
if (o.endsWith(".index")) {
|
|
1301
|
+
const n = o.slice(0, o.length - 6);
|
|
1302
1302
|
let i = r[n];
|
|
1303
|
-
i === void 0 && (i = {}, r[n] = i), i.index =
|
|
1304
|
-
} else if (
|
|
1305
|
-
const n =
|
|
1303
|
+
i === void 0 && (i = {}, r[n] = i), i.index = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1304
|
+
} else if (o.endsWith(".values")) {
|
|
1305
|
+
const n = o.slice(0, o.length - 7);
|
|
1306
1306
|
let i = r[n];
|
|
1307
|
-
i === void 0 && (i = {}, r[n] = i), i.values =
|
|
1308
|
-
} else throw new Error(`unrecognized part field name: ${
|
|
1309
|
-
for (const [
|
|
1310
|
-
if (n.index === void 0) throw new Error(`no index for part ${
|
|
1311
|
-
if (n.values === void 0) throw new Error(`no values for part ${
|
|
1307
|
+
i === void 0 && (i = {}, r[n] = i), i.values = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1308
|
+
} else throw new Error(`unrecognized part field name: ${o}`);
|
|
1309
|
+
for (const [o, n] of Object.entries(r)) {
|
|
1310
|
+
if (n.index === void 0) throw new Error(`no index for part ${o}`);
|
|
1311
|
+
if (n.values === void 0) throw new Error(`no values for part ${o}`);
|
|
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 ($(s.resourceType, No)) {
|
|
1319
1319
|
const t = e, r = {};
|
|
1320
|
-
for (const
|
|
1321
|
-
const n =
|
|
1322
|
-
if (i === void 0) throw new Error(`no partition keys for super key ${
|
|
1320
|
+
for (const o of s.listInputFields()) {
|
|
1321
|
+
const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
|
|
1322
|
+
if (i === void 0) throw new Error(`no partition keys for super key ${o}`);
|
|
1323
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(o), ...JSON.parse(c)]);
|
|
1326
1326
|
let l = r[u];
|
|
1327
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(o), ...JSON.parse(c)]);
|
|
1333
1333
|
let l = r[u];
|
|
1334
1334
|
l === void 0 && (l = {}, r[u] = l), r[u].values = n.traverse({
|
|
1335
1335
|
field: a,
|
|
@@ -1343,17 +1343,17 @@ function Ls(o) {
|
|
|
1343
1343
|
parts: r
|
|
1344
1344
|
};
|
|
1345
1345
|
}
|
|
1346
|
-
throw new Error(`unsupported resource type: ${lr(
|
|
1346
|
+
throw new Error(`unsupported resource type: ${lr(s.resourceType)}`);
|
|
1347
1347
|
}
|
|
1348
|
-
function It(
|
|
1349
|
-
const t =
|
|
1350
|
-
return t.update(
|
|
1348
|
+
function It(s, e) {
|
|
1349
|
+
const t = ge("sha256");
|
|
1350
|
+
return t.update(Ie(s)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
|
|
1351
1351
|
}
|
|
1352
|
-
function Vt(
|
|
1352
|
+
function Vt(s, 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 o = /^(?<name>.*)\.(?<type>spec|data)$/, n = /* @__PURE__ */ new Map();
|
|
1355
|
+
for (const l of s.listInputFields()) {
|
|
1356
|
+
const p = l.match(o);
|
|
1357
1357
|
if (!p) {
|
|
1358
1358
|
if (e) throw new Error(`unexpected field name ${l}`);
|
|
1359
1359
|
continue;
|
|
@@ -1364,18 +1364,18 @@ function Vt(o, e = !0, t = !1, r = "") {
|
|
|
1364
1364
|
continue;
|
|
1365
1365
|
}
|
|
1366
1366
|
g = g.slice(r.length);
|
|
1367
|
-
const
|
|
1368
|
-
let
|
|
1369
|
-
switch (
|
|
1367
|
+
const f = w((c = p.groups) == null ? void 0 : c.type);
|
|
1368
|
+
let b = n.get(g);
|
|
1369
|
+
switch (b === void 0 && (b = {}, n.set(g, b)), f) {
|
|
1370
1370
|
case "spec":
|
|
1371
|
-
|
|
1371
|
+
b.spec = (u = s.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
|
+
b.hasData = !0, b.data = () => s.traverseOrError({
|
|
1379
1379
|
field: l,
|
|
1380
1380
|
ignoreError: t
|
|
1381
1381
|
});
|
|
@@ -1383,16 +1383,16 @@ function Vt(o, e = !0, t = !1, r = "") {
|
|
|
1383
1383
|
continue;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
const i =
|
|
1386
|
+
const i = s.getInputsLocked();
|
|
1387
1387
|
if (i)
|
|
1388
1388
|
for (const [, l] of n) l.data === void 0 && (l.hasData = !1);
|
|
1389
1389
|
return { locked: i, results: n };
|
|
1390
1390
|
}
|
|
1391
|
-
function
|
|
1392
|
-
if (!
|
|
1393
|
-
const r = Vt(
|
|
1391
|
+
function Mo(s, e = !0, t = "") {
|
|
1392
|
+
if (!s.getIsReadyOrError()) throw new Error("resource is not ready");
|
|
1393
|
+
const r = Vt(s, e, !1, t);
|
|
1394
1394
|
br(r.locked);
|
|
1395
|
-
const
|
|
1395
|
+
const o = {};
|
|
1396
1396
|
for (const [n, i] of r.results) {
|
|
1397
1397
|
if (i.spec === void 0) throw new Error(`no spec for key ${n}`);
|
|
1398
1398
|
if (i.hasData !== !0 || i.data === void 0)
|
|
@@ -1400,21 +1400,21 @@ function Js(o, e = !0, t = "") {
|
|
|
1400
1400
|
const a = i.data();
|
|
1401
1401
|
if (a === void 0) throw new Error(`no data for key ${n}`);
|
|
1402
1402
|
if (!a.ok) throw new fr(a.error);
|
|
1403
|
-
|
|
1403
|
+
o[n] = {
|
|
1404
1404
|
id: It(i.spec, a.value),
|
|
1405
1405
|
spec: i.spec,
|
|
1406
1406
|
data: a.value
|
|
1407
1407
|
};
|
|
1408
1408
|
}
|
|
1409
|
-
return
|
|
1409
|
+
return o;
|
|
1410
1410
|
}
|
|
1411
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 n of [
|
|
1416
|
+
e: for (const o of t.values())
|
|
1417
|
+
for (const n of [o.prod, o.staging])
|
|
1418
1418
|
if (n !== void 0) {
|
|
1419
1419
|
if (!n.locked) {
|
|
1420
1420
|
r = !1;
|
|
@@ -1452,30 +1452,30 @@ class Ke {
|
|
|
1452
1452
|
getDataWithErrors() {
|
|
1453
1453
|
const e = [];
|
|
1454
1454
|
let t = !0, r;
|
|
1455
|
-
const
|
|
1455
|
+
const o = (i) => {
|
|
1456
1456
|
r === void 0 && (r = i), t = !1;
|
|
1457
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:
|
|
1461
|
+
ref: ne(i, a),
|
|
1462
1462
|
obj: {
|
|
1463
1463
|
id: u.ok ? It(c.spec, u.value) : void 0,
|
|
1464
1464
|
spec: c.spec,
|
|
1465
1465
|
data: u
|
|
1466
1466
|
}
|
|
1467
|
-
}) :
|
|
1467
|
+
}) : o(`no_data:${i}:${a}`);
|
|
1468
1468
|
}
|
|
1469
1469
|
};
|
|
1470
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 || o(`prod_not_locked:${i}`);
|
|
1474
1474
|
for (const [u, l] of a.prod.results)
|
|
1475
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 || o(`staging_not_locked:${i}`);
|
|
1479
1479
|
for (const [u, l] of a.staging.results)
|
|
1480
1480
|
c.has(u) || n(i, u, l);
|
|
1481
1481
|
}
|
|
@@ -1485,24 +1485,24 @@ class Ke {
|
|
|
1485
1485
|
getSpecs() {
|
|
1486
1486
|
const e = [];
|
|
1487
1487
|
let t = !0, r;
|
|
1488
|
-
const
|
|
1488
|
+
const o = (n) => {
|
|
1489
1489
|
r === void 0 && (r = n), t = !1;
|
|
1490
1490
|
};
|
|
1491
1491
|
for (const [n, i] of this.blocks) {
|
|
1492
1492
|
const a = /* @__PURE__ */ new Set();
|
|
1493
1493
|
if (i.staging !== void 0) {
|
|
1494
|
-
i.staging.locked ||
|
|
1494
|
+
i.staging.locked || o(`staging_not_locked:${n}`);
|
|
1495
1495
|
for (const [c, u] of i.staging.results)
|
|
1496
1496
|
u.spec !== void 0 && (e.push({
|
|
1497
|
-
ref:
|
|
1497
|
+
ref: ne(n, c),
|
|
1498
1498
|
obj: u.spec
|
|
1499
1499
|
}), a.add(c));
|
|
1500
|
-
} else
|
|
1500
|
+
} else o(`staging_not_rendered:${n}`);
|
|
1501
1501
|
if (i.prod !== void 0) {
|
|
1502
|
-
i.prod.locked ||
|
|
1502
|
+
i.prod.locked || o(`prod_not_locked:${n}`);
|
|
1503
1503
|
for (const [c, u] of i.prod.results)
|
|
1504
1504
|
a.has(c) || u.spec !== void 0 && e.push({
|
|
1505
|
-
ref:
|
|
1505
|
+
ref: ne(n, c),
|
|
1506
1506
|
obj: u.spec
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
@@ -1512,11 +1512,11 @@ class Ke {
|
|
|
1512
1512
|
calculateOptions(e) {
|
|
1513
1513
|
const t = [];
|
|
1514
1514
|
for (const r of this.blocks.values()) {
|
|
1515
|
-
const
|
|
1515
|
+
const o = /* @__PURE__ */ new Set(), n = (i) => {
|
|
1516
1516
|
for (const [a, c] of i.results)
|
|
1517
|
-
|
|
1517
|
+
o.has(a) || c.spec === void 0 || (o.add(a), qt(e, c.spec) && t.push({
|
|
1518
1518
|
label: r.info.label + " / " + a,
|
|
1519
|
-
ref:
|
|
1519
|
+
ref: ne(r.info.id, a),
|
|
1520
1520
|
spec: c.spec
|
|
1521
1521
|
}));
|
|
1522
1522
|
};
|
|
@@ -1525,27 +1525,27 @@ class Ke {
|
|
|
1525
1525
|
return t;
|
|
1526
1526
|
}
|
|
1527
1527
|
static create(e, t, r) {
|
|
1528
|
-
const
|
|
1528
|
+
const o = e.accessor(t).node(), n = w(o.getKeyValueAsJson(W)), a = xe(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
|
|
1529
1529
|
for (const u of N(n)) {
|
|
1530
1530
|
if (!a.has(u.id)) continue;
|
|
1531
|
-
const l =
|
|
1532
|
-
|
|
1531
|
+
const l = ct(
|
|
1532
|
+
o.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
|
+
o.traverseOrError({
|
|
1539
1539
|
field: P(u.id, "prodUiCtx"),
|
|
1540
1540
|
stableIfNotFound: !0
|
|
1541
1541
|
})
|
|
1542
|
-
), p =
|
|
1543
|
-
|
|
1542
|
+
), p = ct(
|
|
1543
|
+
o.traverse({
|
|
1544
1544
|
field: P(u.id, "stagingCtx"),
|
|
1545
1545
|
ignoreError: !0,
|
|
1546
1546
|
pureFieldErrorToUndefined: !0
|
|
1547
1547
|
}) !== void 0,
|
|
1548
|
-
|
|
1548
|
+
o.traverseOrError({
|
|
1549
1549
|
field: P(u.id, "stagingUiCtx")
|
|
1550
1550
|
})
|
|
1551
1551
|
);
|
|
@@ -1554,22 +1554,22 @@ class Ke {
|
|
|
1554
1554
|
return new Ke(e, c);
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function ct(s, e) {
|
|
1558
1558
|
if (e === void 0)
|
|
1559
|
-
return
|
|
1559
|
+
return s ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
|
|
1560
1560
|
if (e.ok) return Vt(e.value, !1, !0);
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1563
|
-
const t =
|
|
1564
|
-
|
|
1562
|
+
function Ue(s, e) {
|
|
1563
|
+
const t = s.persist(), r = w(
|
|
1564
|
+
s.traverse({
|
|
1565
1565
|
field: P(e, "currentArgs"),
|
|
1566
1566
|
errorIfFieldNotSet: !0
|
|
1567
1567
|
}).getDataAsString()
|
|
1568
|
-
),
|
|
1568
|
+
), o = s.getKeyValueAsString(Fe(e));
|
|
1569
1569
|
return {
|
|
1570
1570
|
blockId: e,
|
|
1571
1571
|
args: r,
|
|
1572
|
-
uiState:
|
|
1572
|
+
uiState: o,
|
|
1573
1573
|
blockMeta: (n) => {
|
|
1574
1574
|
const i = n.accessor(t).node(), a = w(i.getKeyValueAsJson(W)), c = /* @__PURE__ */ new Map();
|
|
1575
1575
|
for (const u of N(a)) c.set(u.id, u);
|
|
@@ -1577,51 +1577,51 @@ function $e(o, e) {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
};
|
|
1579
1579
|
}
|
|
1580
|
-
function Nt(
|
|
1581
|
-
const t =
|
|
1580
|
+
function Nt(s, e) {
|
|
1581
|
+
const t = s.persist();
|
|
1582
1582
|
return {
|
|
1583
|
-
|
|
1583
|
+
...Ue(s, e),
|
|
1584
1584
|
prod: (r) => {
|
|
1585
|
-
var
|
|
1586
|
-
return (
|
|
1585
|
+
var o;
|
|
1586
|
+
return (o = 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 : o.persist();
|
|
1591
1591
|
},
|
|
1592
1592
|
staging: (r) => {
|
|
1593
1593
|
var n;
|
|
1594
|
-
const
|
|
1594
|
+
const o = (n = r.accessor(t).node({ ignoreError: !0 }).traverse({
|
|
1595
1595
|
field: P(e, "stagingOutput"),
|
|
1596
1596
|
ignoreError: !0
|
|
1597
1597
|
})) == null ? void 0 : n.persist();
|
|
1598
|
-
return
|
|
1598
|
+
return o === void 0 && r.markUnstable("staging_not_rendered"), o;
|
|
1599
1599
|
},
|
|
1600
1600
|
getResultsPool: (r) => Ke.create(r, t, e)
|
|
1601
1601
|
};
|
|
1602
1602
|
}
|
|
1603
|
-
function*
|
|
1604
|
-
switch (yield
|
|
1603
|
+
function* T(s, e) {
|
|
1604
|
+
switch (yield s, s.type) {
|
|
1605
1605
|
case "GetFromCtx":
|
|
1606
1606
|
case "Immediate":
|
|
1607
1607
|
return;
|
|
1608
1608
|
case "Isolate":
|
|
1609
|
-
yield*
|
|
1609
|
+
yield* T(s.cfg);
|
|
1610
1610
|
return;
|
|
1611
1611
|
case "MakeObject":
|
|
1612
|
-
for (const [, t] of Object.entries(
|
|
1612
|
+
for (const [, t] of Object.entries(s.template)) yield* T(t);
|
|
1613
1613
|
return;
|
|
1614
1614
|
case "MakeArray":
|
|
1615
|
-
for (const t of
|
|
1615
|
+
for (const t of s.template) yield* T(t);
|
|
1616
1616
|
return;
|
|
1617
1617
|
case "GetJsonField":
|
|
1618
1618
|
case "GetResourceField":
|
|
1619
|
-
yield*
|
|
1619
|
+
yield* T(s.source), yield* T(s.field);
|
|
1620
1620
|
return;
|
|
1621
1621
|
case "MapRecordValues":
|
|
1622
1622
|
case "MapArrayValues":
|
|
1623
1623
|
case "MapResourceFields":
|
|
1624
|
-
yield*
|
|
1624
|
+
yield* T(s.source), yield* T(s.mapping);
|
|
1625
1625
|
return;
|
|
1626
1626
|
case "Flatten":
|
|
1627
1627
|
case "GetResourceValueAsJson":
|
|
@@ -1634,153 +1634,153 @@ function* j(o, e) {
|
|
|
1634
1634
|
case "GetLastLogs":
|
|
1635
1635
|
case "GetProgressLog":
|
|
1636
1636
|
case "GetLogHandle":
|
|
1637
|
-
yield*
|
|
1637
|
+
yield* T(s.source);
|
|
1638
1638
|
return;
|
|
1639
1639
|
case "IsEmpty":
|
|
1640
|
-
yield*
|
|
1640
|
+
yield* T(s.arg);
|
|
1641
1641
|
return;
|
|
1642
1642
|
case "Not":
|
|
1643
|
-
yield*
|
|
1643
|
+
yield* T(s.operand);
|
|
1644
1644
|
return;
|
|
1645
1645
|
case "And":
|
|
1646
1646
|
case "Or":
|
|
1647
|
-
yield*
|
|
1647
|
+
yield* T(s.operand1), yield* T(s.operand2);
|
|
1648
1648
|
return;
|
|
1649
1649
|
default:
|
|
1650
|
-
D(
|
|
1650
|
+
D(s);
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
|
-
function
|
|
1653
|
+
function Ko(s, e) {
|
|
1654
1654
|
const t = {};
|
|
1655
|
-
for (const [r,
|
|
1655
|
+
for (const [r, o] of Object.entries(s)) t[r] = e(o);
|
|
1656
1656
|
return t;
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1659
|
-
return
|
|
1658
|
+
function de(s, e) {
|
|
1659
|
+
return s === void 0 ? void 0 : e(s);
|
|
1660
1660
|
}
|
|
1661
|
-
function
|
|
1662
|
-
switch (
|
|
1661
|
+
function Uo(s) {
|
|
1662
|
+
switch (s.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
|
|
1669
|
+
function $o(s) {
|
|
1670
|
+
for (const e of T(s)) if (Uo(e)) return !0;
|
|
1671
1671
|
return !1;
|
|
1672
1672
|
}
|
|
1673
|
-
function
|
|
1673
|
+
function he(s) {
|
|
1674
1674
|
return {
|
|
1675
1675
|
type: "ReturnResult",
|
|
1676
|
-
result:
|
|
1676
|
+
result: s
|
|
1677
1677
|
};
|
|
1678
1678
|
}
|
|
1679
|
-
function
|
|
1680
|
-
return () =>
|
|
1679
|
+
function h(s) {
|
|
1680
|
+
return () => he(s);
|
|
1681
1681
|
}
|
|
1682
|
-
const
|
|
1682
|
+
const Go = (s) => {
|
|
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(s)) e[t] = r;
|
|
1685
|
+
return h(e);
|
|
1686
|
+
}, Ho = (s) => {
|
|
1687
|
+
const e = s.source;
|
|
1688
|
+
if (e === void 0) return h(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 h(t);
|
|
1693
|
+
}, _o = (s) => {
|
|
1694
|
+
const e = s.source, t = s.field;
|
|
1695
|
+
return e === void 0 || t === void 0 ? h(void 0) : ({ cCtx: r }) => {
|
|
1696
|
+
var o;
|
|
1697
|
+
return he((o = r.accessor(e).node().traverse(t)) == null ? void 0 : o.persist());
|
|
1698
1698
|
};
|
|
1699
1699
|
};
|
|
1700
|
-
function Lt(
|
|
1701
|
-
const t = {}, r =
|
|
1702
|
-
for (let
|
|
1700
|
+
function Lt(s, e) {
|
|
1701
|
+
const t = {}, r = s.length;
|
|
1702
|
+
for (let o = 0; o < r; o++) t[String(o)] = e(s[o]);
|
|
1703
1703
|
return t;
|
|
1704
1704
|
}
|
|
1705
|
-
function
|
|
1705
|
+
function Wo(s, e) {
|
|
1706
1706
|
return (t) => {
|
|
1707
1707
|
const r = t.source;
|
|
1708
|
-
return r === void 0 ?
|
|
1708
|
+
return r === void 0 ? h(void 0) : () => ({
|
|
1709
1709
|
type: "ScheduleSubroutine",
|
|
1710
1710
|
subroutine: Jt(r.length),
|
|
1711
|
-
args: Lt(r, (
|
|
1711
|
+
args: Lt(r, (o) => m({ ...s, [e.itVar]: o }, e.mapping))
|
|
1712
1712
|
});
|
|
1713
1713
|
};
|
|
1714
1714
|
}
|
|
1715
|
-
function Jt(
|
|
1715
|
+
function Jt(s) {
|
|
1716
1716
|
return (e) => {
|
|
1717
1717
|
const t = [];
|
|
1718
|
-
for (let r = 0; r <
|
|
1719
|
-
return
|
|
1718
|
+
for (let r = 0; r < s; r++) t.push(e[String(r)]);
|
|
1719
|
+
return h(t);
|
|
1720
1720
|
};
|
|
1721
1721
|
}
|
|
1722
|
-
function
|
|
1722
|
+
function zo(s, e) {
|
|
1723
1723
|
return (t) => {
|
|
1724
1724
|
const r = t.source;
|
|
1725
|
-
if (r === void 0) return
|
|
1726
|
-
const
|
|
1725
|
+
if (r === void 0) return h(void 0);
|
|
1726
|
+
const o = {};
|
|
1727
1727
|
for (const [n, i] of Object.entries(r)) {
|
|
1728
|
-
const a = { ...
|
|
1729
|
-
|
|
1728
|
+
const a = { ...s, [e.itVar]: i };
|
|
1729
|
+
o[n] = m(a, e.mapping);
|
|
1730
1730
|
}
|
|
1731
1731
|
return () => ({
|
|
1732
1732
|
type: "ScheduleSubroutine",
|
|
1733
|
-
subroutine:
|
|
1734
|
-
args:
|
|
1733
|
+
subroutine: Yo,
|
|
1734
|
+
args: o
|
|
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 Yo = (s) => h(s), qo = (s) => {
|
|
1739
|
+
const e = s.arg;
|
|
1740
|
+
return h(e === void 0 ? void 0 : e.length === 0);
|
|
1741
|
+
}, Qo = (s) => {
|
|
1742
|
+
const e = s.operand;
|
|
1743
|
+
return h(e === void 0 ? void 0 : !e);
|
|
1744
|
+
}, Zo = (s) => {
|
|
1745
|
+
const e = s.operand1, t = s.operand2;
|
|
1746
|
+
return h(e === void 0 || t === void 0 ? void 0 : e && t);
|
|
1747
|
+
}, Xo = (s) => {
|
|
1748
|
+
const e = s.operand1, t = s.operand2;
|
|
1749
|
+
return h(e === void 0 || t === void 0 ? void 0 : e || t);
|
|
1750
|
+
}, es = (s) => {
|
|
1751
|
+
const e = s.source;
|
|
1752
|
+
return e === void 0 ? h(void 0) : ({ cCtx: t }) => {
|
|
1753
1753
|
var r;
|
|
1754
|
-
return
|
|
1754
|
+
return he((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
|
|
1755
1755
|
};
|
|
1756
|
-
},
|
|
1757
|
-
const e =
|
|
1758
|
-
return
|
|
1756
|
+
}, ts = (s) => {
|
|
1757
|
+
const e = s.source, t = s.field;
|
|
1758
|
+
return h(e === void 0 || t === void 0 ? void 0 : e[t]);
|
|
1759
1759
|
};
|
|
1760
|
-
function
|
|
1760
|
+
function rs(s, e) {
|
|
1761
1761
|
return (t) => {
|
|
1762
1762
|
const r = t.source;
|
|
1763
|
-
return r === void 0 ?
|
|
1764
|
-
const n =
|
|
1763
|
+
return r === void 0 ? h(void 0) : ({ cCtx: o }) => {
|
|
1764
|
+
const n = o.accessor(r).node(), i = {};
|
|
1765
1765
|
for (const a of n.listInputFields()) {
|
|
1766
1766
|
const c = n.traverse(a);
|
|
1767
|
-
if (c === void 0) i[a] =
|
|
1767
|
+
if (c === void 0) i[a] = h(void 0);
|
|
1768
1768
|
else {
|
|
1769
|
-
const u = { ...
|
|
1770
|
-
i[a] =
|
|
1769
|
+
const u = { ...s, [e.itVar]: c.persist() };
|
|
1770
|
+
i[a] = m(u, e.mapping);
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
1773
|
return {
|
|
1774
1774
|
type: "ScheduleSubroutine",
|
|
1775
|
-
subroutine:
|
|
1775
|
+
subroutine: os,
|
|
1776
1776
|
args: i
|
|
1777
1777
|
};
|
|
1778
1778
|
};
|
|
1779
1779
|
};
|
|
1780
1780
|
}
|
|
1781
|
-
const
|
|
1782
|
-
const e =
|
|
1783
|
-
return e === void 0 ?
|
|
1781
|
+
const os = (s) => h(s), ss = (s) => {
|
|
1782
|
+
const e = s.source;
|
|
1783
|
+
return e === void 0 ? h(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,292 +1792,292 @@ const ro = (o) => f(o), so = (o) => {
|
|
|
1792
1792
|
}
|
|
1793
1793
|
)
|
|
1794
1794
|
});
|
|
1795
|
-
},
|
|
1796
|
-
const e =
|
|
1797
|
-
return e === void 0 ?
|
|
1798
|
-
const
|
|
1795
|
+
}, ns = (s) => {
|
|
1796
|
+
const e = s.source;
|
|
1797
|
+
return e === void 0 ? h(void 0) : ({ cCtx: t, drivers: r }) => {
|
|
1798
|
+
const o = t.accessor(e).node().resourceInfo;
|
|
1799
1799
|
return {
|
|
1800
1800
|
type: "ScheduleComputable",
|
|
1801
|
-
computable: F.make(() => r.blobDriver.getDownloadedBlob(
|
|
1801
|
+
computable: F.make(() => r.blobDriver.getDownloadedBlob(o), {
|
|
1802
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
|
+
}, is = (s) => {
|
|
1807
|
+
const e = s.source;
|
|
1808
|
+
return e === void 0 ? h(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 o = await t.blobDriver.getContent(r.handle);
|
|
1816
|
+
if (o != null)
|
|
1817
|
+
return JSON.parse(Buffer.from(o).toString());
|
|
1818
1818
|
}
|
|
1819
1819
|
}
|
|
1820
1820
|
)
|
|
1821
1821
|
});
|
|
1822
|
-
},
|
|
1823
|
-
const e =
|
|
1824
|
-
return e === void 0 ?
|
|
1822
|
+
}, as = (s) => {
|
|
1823
|
+
const e = s.source;
|
|
1824
|
+
return e === void 0 ? h(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
|
+
}, cs = (s) => {
|
|
1829
|
+
const e = s.source;
|
|
1830
|
+
return e === void 0 ? h(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
|
+
}, us = (s) => {
|
|
1835
|
+
const e = s.source;
|
|
1836
|
+
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1837
1837
|
type: "ScheduleComputable",
|
|
1838
1838
|
computable: t.uploadDriver.getProgressId(e)
|
|
1839
1839
|
});
|
|
1840
|
-
},
|
|
1840
|
+
}, ls = (s) => (e) => {
|
|
1841
1841
|
const t = e.source;
|
|
1842
|
-
return t === void 0 ?
|
|
1842
|
+
return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
|
|
1843
1843
|
type: "ScheduleComputable",
|
|
1844
|
-
computable: r.logDriver.getLastLogs(t,
|
|
1844
|
+
computable: r.logDriver.getLastLogs(t, s)
|
|
1845
1845
|
});
|
|
1846
|
-
},
|
|
1846
|
+
}, ds = (s) => (e) => {
|
|
1847
1847
|
const t = e.source;
|
|
1848
|
-
return t === void 0 ?
|
|
1848
|
+
return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
|
|
1849
1849
|
type: "ScheduleComputable",
|
|
1850
|
-
computable: r.logDriver.getProgressLog(t,
|
|
1850
|
+
computable: r.logDriver.getProgressLog(t, s)
|
|
1851
1851
|
});
|
|
1852
|
-
},
|
|
1853
|
-
const e =
|
|
1854
|
-
return e === void 0 ?
|
|
1852
|
+
}, ps = (s) => {
|
|
1853
|
+
const e = s.source;
|
|
1854
|
+
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1855
1855
|
type: "ScheduleComputable",
|
|
1856
1856
|
computable: t.logDriver.getLogHandle(e)
|
|
1857
1857
|
});
|
|
1858
1858
|
};
|
|
1859
|
-
function
|
|
1859
|
+
function m(s, e) {
|
|
1860
1860
|
switch (e.type) {
|
|
1861
1861
|
case "GetFromCtx":
|
|
1862
|
-
const t =
|
|
1863
|
-
return typeof t == "function" ? (r) =>
|
|
1862
|
+
const t = s[e.variable];
|
|
1863
|
+
return typeof t == "function" ? (r) => he(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), h(t));
|
|
1864
1864
|
case "Isolate":
|
|
1865
1865
|
return ({ drivers: r }) => ({
|
|
1866
1866
|
type: "ScheduleComputable",
|
|
1867
|
-
computable: $t(r,
|
|
1867
|
+
computable: $t(r, s, e.cfg)
|
|
1868
1868
|
});
|
|
1869
1869
|
case "Immediate":
|
|
1870
|
-
return
|
|
1870
|
+
return h(e.value);
|
|
1871
1871
|
case "GetJsonField":
|
|
1872
1872
|
return () => ({
|
|
1873
1873
|
type: "ScheduleSubroutine",
|
|
1874
|
-
subroutine:
|
|
1874
|
+
subroutine: ts,
|
|
1875
1875
|
args: {
|
|
1876
|
-
source:
|
|
1877
|
-
field:
|
|
1876
|
+
source: m(s, e.source),
|
|
1877
|
+
field: m(s, e.field)
|
|
1878
1878
|
}
|
|
1879
1879
|
});
|
|
1880
1880
|
case "MapArrayValues":
|
|
1881
1881
|
return () => ({
|
|
1882
1882
|
type: "ScheduleSubroutine",
|
|
1883
|
-
subroutine:
|
|
1883
|
+
subroutine: Wo(s, e),
|
|
1884
1884
|
args: {
|
|
1885
|
-
source:
|
|
1885
|
+
source: m(s, e.source)
|
|
1886
1886
|
}
|
|
1887
1887
|
});
|
|
1888
1888
|
case "MapRecordValues":
|
|
1889
1889
|
return () => ({
|
|
1890
1890
|
type: "ScheduleSubroutine",
|
|
1891
|
-
subroutine:
|
|
1891
|
+
subroutine: zo(s, e),
|
|
1892
1892
|
args: {
|
|
1893
|
-
source:
|
|
1893
|
+
source: m(s, e.source)
|
|
1894
1894
|
}
|
|
1895
1895
|
});
|
|
1896
1896
|
case "MakeObject":
|
|
1897
1897
|
return () => ({
|
|
1898
1898
|
type: "ScheduleSubroutine",
|
|
1899
|
-
subroutine:
|
|
1900
|
-
args:
|
|
1899
|
+
subroutine: Go,
|
|
1900
|
+
args: Ko(e.template, (r) => m(s, r))
|
|
1901
1901
|
});
|
|
1902
1902
|
case "MakeArray":
|
|
1903
1903
|
return () => ({
|
|
1904
1904
|
type: "ScheduleSubroutine",
|
|
1905
1905
|
subroutine: Jt(e.template.length),
|
|
1906
|
-
args: Lt(e.template, (r) =>
|
|
1906
|
+
args: Lt(e.template, (r) => m(s, r))
|
|
1907
1907
|
});
|
|
1908
1908
|
case "Flatten":
|
|
1909
1909
|
return () => ({
|
|
1910
1910
|
type: "ScheduleSubroutine",
|
|
1911
|
-
subroutine:
|
|
1911
|
+
subroutine: Ho,
|
|
1912
1912
|
args: {
|
|
1913
|
-
source:
|
|
1913
|
+
source: m(s, e.source)
|
|
1914
1914
|
}
|
|
1915
1915
|
});
|
|
1916
1916
|
case "IsEmpty":
|
|
1917
1917
|
return () => ({
|
|
1918
1918
|
type: "ScheduleSubroutine",
|
|
1919
|
-
subroutine:
|
|
1919
|
+
subroutine: qo,
|
|
1920
1920
|
args: {
|
|
1921
|
-
arg:
|
|
1921
|
+
arg: m(s, e.arg)
|
|
1922
1922
|
}
|
|
1923
1923
|
});
|
|
1924
1924
|
case "Not":
|
|
1925
1925
|
return () => ({
|
|
1926
1926
|
type: "ScheduleSubroutine",
|
|
1927
|
-
subroutine:
|
|
1927
|
+
subroutine: Qo,
|
|
1928
1928
|
args: {
|
|
1929
|
-
operand:
|
|
1929
|
+
operand: m(s, e.operand)
|
|
1930
1930
|
}
|
|
1931
1931
|
});
|
|
1932
1932
|
case "And":
|
|
1933
1933
|
return () => ({
|
|
1934
1934
|
type: "ScheduleSubroutine",
|
|
1935
|
-
subroutine:
|
|
1935
|
+
subroutine: Zo,
|
|
1936
1936
|
args: {
|
|
1937
|
-
operand1:
|
|
1938
|
-
operand2:
|
|
1937
|
+
operand1: m(s, e.operand1),
|
|
1938
|
+
operand2: m(s, e.operand2)
|
|
1939
1939
|
}
|
|
1940
1940
|
});
|
|
1941
1941
|
case "Or":
|
|
1942
1942
|
return () => ({
|
|
1943
1943
|
type: "ScheduleSubroutine",
|
|
1944
|
-
subroutine:
|
|
1944
|
+
subroutine: Xo,
|
|
1945
1945
|
args: {
|
|
1946
|
-
operand1:
|
|
1947
|
-
operand2:
|
|
1946
|
+
operand1: m(s, e.operand1),
|
|
1947
|
+
operand2: m(s, e.operand2)
|
|
1948
1948
|
}
|
|
1949
1949
|
});
|
|
1950
1950
|
case "MapResourceFields":
|
|
1951
1951
|
return () => ({
|
|
1952
1952
|
type: "ScheduleSubroutine",
|
|
1953
|
-
subroutine:
|
|
1953
|
+
subroutine: rs(s, e),
|
|
1954
1954
|
args: {
|
|
1955
|
-
source:
|
|
1955
|
+
source: m(s, e.source)
|
|
1956
1956
|
}
|
|
1957
1957
|
});
|
|
1958
1958
|
case "GetResourceField":
|
|
1959
1959
|
return () => ({
|
|
1960
1960
|
type: "ScheduleSubroutine",
|
|
1961
|
-
subroutine:
|
|
1961
|
+
subroutine: _o,
|
|
1962
1962
|
args: {
|
|
1963
|
-
source:
|
|
1964
|
-
field:
|
|
1963
|
+
source: m(s, e.source),
|
|
1964
|
+
field: m(s, e.field)
|
|
1965
1965
|
}
|
|
1966
1966
|
});
|
|
1967
1967
|
case "GetResourceValueAsJson":
|
|
1968
1968
|
return () => ({
|
|
1969
1969
|
type: "ScheduleSubroutine",
|
|
1970
|
-
subroutine:
|
|
1970
|
+
subroutine: es,
|
|
1971
1971
|
args: {
|
|
1972
|
-
source:
|
|
1972
|
+
source: m(s, e.source)
|
|
1973
1973
|
}
|
|
1974
1974
|
});
|
|
1975
1975
|
case "GetBlobContent":
|
|
1976
1976
|
return () => ({
|
|
1977
1977
|
type: "ScheduleSubroutine",
|
|
1978
|
-
subroutine:
|
|
1978
|
+
subroutine: ss,
|
|
1979
1979
|
args: {
|
|
1980
|
-
source:
|
|
1980
|
+
source: m(s, e.source)
|
|
1981
1981
|
}
|
|
1982
1982
|
});
|
|
1983
1983
|
case "GetBlobContentAsString":
|
|
1984
1984
|
return () => ({
|
|
1985
1985
|
type: "ScheduleSubroutine",
|
|
1986
|
-
subroutine:
|
|
1986
|
+
subroutine: ns,
|
|
1987
1987
|
args: {
|
|
1988
|
-
source:
|
|
1988
|
+
source: m(s, e.source)
|
|
1989
1989
|
}
|
|
1990
1990
|
});
|
|
1991
1991
|
case "GetBlobContentAsJson":
|
|
1992
1992
|
return () => ({
|
|
1993
1993
|
type: "ScheduleSubroutine",
|
|
1994
|
-
subroutine:
|
|
1994
|
+
subroutine: is,
|
|
1995
1995
|
args: {
|
|
1996
|
-
source:
|
|
1996
|
+
source: m(s, e.source)
|
|
1997
1997
|
}
|
|
1998
1998
|
});
|
|
1999
1999
|
case "GetDownloadedBlobContent":
|
|
2000
2000
|
return () => ({
|
|
2001
2001
|
type: "ScheduleSubroutine",
|
|
2002
|
-
subroutine:
|
|
2002
|
+
subroutine: as,
|
|
2003
2003
|
args: {
|
|
2004
|
-
source:
|
|
2004
|
+
source: m(s, e.source)
|
|
2005
2005
|
}
|
|
2006
2006
|
});
|
|
2007
2007
|
case "GetOnDemandBlobContent":
|
|
2008
2008
|
return () => ({
|
|
2009
2009
|
type: "ScheduleSubroutine",
|
|
2010
|
-
subroutine:
|
|
2010
|
+
subroutine: cs,
|
|
2011
2011
|
args: {
|
|
2012
|
-
source:
|
|
2012
|
+
source: m(s, e.source)
|
|
2013
2013
|
}
|
|
2014
2014
|
});
|
|
2015
2015
|
case "GetImportProgress":
|
|
2016
2016
|
return () => ({
|
|
2017
2017
|
type: "ScheduleSubroutine",
|
|
2018
|
-
subroutine:
|
|
2018
|
+
subroutine: us,
|
|
2019
2019
|
args: {
|
|
2020
|
-
source:
|
|
2020
|
+
source: m(s, e.source)
|
|
2021
2021
|
}
|
|
2022
2022
|
});
|
|
2023
2023
|
case "GetLastLogs":
|
|
2024
2024
|
return () => ({
|
|
2025
2025
|
type: "ScheduleSubroutine",
|
|
2026
|
-
subroutine:
|
|
2026
|
+
subroutine: ls(e.lines),
|
|
2027
2027
|
args: {
|
|
2028
|
-
source:
|
|
2028
|
+
source: m(s, e.source)
|
|
2029
2029
|
}
|
|
2030
2030
|
});
|
|
2031
2031
|
case "GetProgressLog":
|
|
2032
2032
|
return () => ({
|
|
2033
2033
|
type: "ScheduleSubroutine",
|
|
2034
|
-
subroutine:
|
|
2034
|
+
subroutine: ds(e.patternToSearch),
|
|
2035
2035
|
args: {
|
|
2036
|
-
source:
|
|
2036
|
+
source: m(s, e.source)
|
|
2037
2037
|
}
|
|
2038
2038
|
});
|
|
2039
2039
|
case "GetLogHandle":
|
|
2040
2040
|
return () => ({
|
|
2041
2041
|
type: "ScheduleSubroutine",
|
|
2042
|
-
subroutine:
|
|
2042
|
+
subroutine: ps,
|
|
2043
2043
|
args: {
|
|
2044
|
-
source:
|
|
2044
|
+
source: m(s, e.source)
|
|
2045
2045
|
}
|
|
2046
2046
|
});
|
|
2047
2047
|
default:
|
|
2048
2048
|
return D(e);
|
|
2049
2049
|
}
|
|
2050
2050
|
}
|
|
2051
|
-
const
|
|
2052
|
-
function
|
|
2051
|
+
const gs = ["$prod", "$staging"];
|
|
2052
|
+
function hs(s) {
|
|
2053
2053
|
return {
|
|
2054
|
-
$blockId:
|
|
2055
|
-
$args: JSON.parse(
|
|
2056
|
-
$ui:
|
|
2057
|
-
$prod:
|
|
2058
|
-
$staging:
|
|
2054
|
+
$blockId: s.blockId,
|
|
2055
|
+
$args: JSON.parse(s.args),
|
|
2056
|
+
$ui: s.uiState !== void 0 ? JSON.parse(s.uiState) : void 0,
|
|
2057
|
+
$prod: s.prod,
|
|
2058
|
+
$staging: s.staging
|
|
2059
2059
|
};
|
|
2060
2060
|
}
|
|
2061
|
-
const Mt = Symbol(),
|
|
2062
|
-
function
|
|
2063
|
-
return
|
|
2061
|
+
const Mt = Symbol(), Kt = "return", fs = { op: Mt, arg: Kt };
|
|
2062
|
+
function ms(s) {
|
|
2063
|
+
return s.op == Mt && s.arg == Kt;
|
|
2064
2064
|
}
|
|
2065
|
-
function
|
|
2065
|
+
function vs() {
|
|
2066
2066
|
return { pendingSubroutines: /* @__PURE__ */ new Map() };
|
|
2067
2067
|
}
|
|
2068
|
-
function
|
|
2069
|
-
const
|
|
2070
|
-
if (
|
|
2068
|
+
function ut(s, e, t, r) {
|
|
2069
|
+
const o = new St(t), n = (a, c) => {
|
|
2070
|
+
if (ms(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), o.push({
|
|
2075
2075
|
destination: u.destination,
|
|
2076
2076
|
operation: u.subroutine(u.args)
|
|
2077
2077
|
})), !0;
|
|
2078
2078
|
}, i = [];
|
|
2079
|
-
e: for (;
|
|
2080
|
-
const a =
|
|
2079
|
+
e: for (; o.length > 0; ) {
|
|
2080
|
+
const a = o.shift(), c = a.operation(s);
|
|
2081
2081
|
switch (c.type) {
|
|
2082
2082
|
case "ReturnResult":
|
|
2083
2083
|
if (!n(a.destination, c.result)) break e;
|
|
@@ -2085,15 +2085,15 @@ function lt(o, e, t, r) {
|
|
|
2085
2085
|
case "ScheduleSubroutine":
|
|
2086
2086
|
const u = Symbol(), l = Object.entries(c.args), p = l.length;
|
|
2087
2087
|
if (p === 0)
|
|
2088
|
-
|
|
2088
|
+
o.push({
|
|
2089
2089
|
destination: a.destination,
|
|
2090
2090
|
operation: c.subroutine({})
|
|
2091
2091
|
});
|
|
2092
2092
|
else {
|
|
2093
|
-
for (const [g,
|
|
2094
|
-
|
|
2093
|
+
for (const [g, f] of l)
|
|
2094
|
+
o.push({
|
|
2095
2095
|
destination: { op: u, arg: g },
|
|
2096
|
-
operation:
|
|
2096
|
+
operation: f
|
|
2097
2097
|
});
|
|
2098
2098
|
e.pendingSubroutines.set(u, {
|
|
2099
2099
|
argCounter: p,
|
|
@@ -2117,25 +2117,25 @@ function lt(o, e, t, r) {
|
|
|
2117
2117
|
}
|
|
2118
2118
|
return i;
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2121
|
-
return $t(
|
|
2120
|
+
function Ut(s, e, t, r = {}) {
|
|
2121
|
+
return $t(s, hs(e), t, r);
|
|
2122
2122
|
}
|
|
2123
|
-
function $t(
|
|
2124
|
-
const
|
|
2125
|
-
ctx: Object.fromEntries(Object.entries(e).filter(([n]) =>
|
|
2123
|
+
function $t(s, e, t, r = {}) {
|
|
2124
|
+
const o = Ie({
|
|
2125
|
+
ctx: Object.fromEntries(Object.entries(e).filter(([n]) => gs.indexOf(n) === -1)),
|
|
2126
2126
|
cfg: t
|
|
2127
2127
|
});
|
|
2128
2128
|
return F.makeRaw(
|
|
2129
2129
|
(n) => {
|
|
2130
|
-
const i = { drivers:
|
|
2130
|
+
const i = { drivers: s, cCtx: n }, a = vs();
|
|
2131
2131
|
return {
|
|
2132
|
-
ir:
|
|
2132
|
+
ir: ut(
|
|
2133
2133
|
i,
|
|
2134
2134
|
a,
|
|
2135
2135
|
[
|
|
2136
2136
|
{
|
|
2137
|
-
destination:
|
|
2138
|
-
operation:
|
|
2137
|
+
destination: fs,
|
|
2138
|
+
operation: m(e, t)
|
|
2139
2139
|
}
|
|
2140
2140
|
],
|
|
2141
2141
|
!0
|
|
@@ -2143,36 +2143,36 @@ function $t(o, 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:
|
|
2146
|
+
p.push({ destination: C.destination, operation: h(C.computable) });
|
|
2147
2147
|
const g = {
|
|
2148
|
-
drivers:
|
|
2148
|
+
drivers: s,
|
|
2149
2149
|
get cCtx() {
|
|
2150
2150
|
throw new Error("asynchronous operations are forbidden in this context");
|
|
2151
2151
|
}
|
|
2152
|
-
},
|
|
2152
|
+
}, f = /* @__PURE__ */ new Map();
|
|
2153
2153
|
for (const [C, I] of a.pendingSubroutines)
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2154
|
+
f.set(C, { ...I, args: { ...I.args } });
|
|
2155
|
+
const b = {
|
|
2156
2156
|
result: a.result,
|
|
2157
|
-
pendingSubroutines:
|
|
2157
|
+
pendingSubroutines: f
|
|
2158
2158
|
};
|
|
2159
|
-
if (
|
|
2159
|
+
if (ut(g, b, p, !1), !("result" in b))
|
|
2160
2160
|
throw new Error("illegal cfg rendering stack state, no result");
|
|
2161
|
-
return
|
|
2161
|
+
return b.result;
|
|
2162
2162
|
}
|
|
2163
2163
|
};
|
|
2164
2164
|
},
|
|
2165
|
-
{ ...r, key:
|
|
2165
|
+
{ ...r, key: o }
|
|
2166
2166
|
);
|
|
2167
2167
|
}
|
|
2168
|
-
function
|
|
2169
|
-
return
|
|
2168
|
+
function ys(s) {
|
|
2169
|
+
return s instanceof ArrayBuffer || ArrayBuffer.isView(s);
|
|
2170
2170
|
}
|
|
2171
|
-
function
|
|
2172
|
-
return
|
|
2171
|
+
function lt(s) {
|
|
2172
|
+
return s !== void 0 ? Buffer.from(s).toString("base64") : void 0;
|
|
2173
2173
|
}
|
|
2174
|
-
class
|
|
2175
|
-
constructor(e, t, r,
|
|
2174
|
+
class pe {
|
|
2175
|
+
constructor(e, t, r, o, n) {
|
|
2176
2176
|
d(this, "callbackRegistry");
|
|
2177
2177
|
d(this, "fnJSONStringify");
|
|
2178
2178
|
d(this, "fnJSONParse");
|
|
@@ -2184,7 +2184,7 @@ class ge {
|
|
|
2184
2184
|
// Result Pool
|
|
2185
2185
|
//
|
|
2186
2186
|
d(this, "_resultPool");
|
|
2187
|
-
if (this.scope = e, this.vm = t, this.blockCtx = r, this.env =
|
|
2187
|
+
if (this.scope = e, this.vm = t, this.blockCtx = r, this.env = o, this.computableCtx = n, this.callbackRegistry = this.scope.manage(this.vm.newObject()), this.fnJSONStringify = e.manage(
|
|
2188
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.");
|
|
@@ -2203,19 +2203,19 @@ class ge {
|
|
|
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 pe.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 Pe.withScope((r) => {
|
|
2212
|
+
const o = r.manage(this.vm.getProp(this.callbackRegistry, e));
|
|
2213
|
+
if (this.vm.typeof(o) !== "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
|
+
o,
|
|
2219
2219
|
this.vm.undefined,
|
|
2220
2220
|
...t.map((n) => this.exportObjectUniversal(n, r))
|
|
2221
2221
|
)
|
|
@@ -2223,7 +2223,7 @@ class ge {
|
|
|
2223
2223
|
);
|
|
2224
2224
|
});
|
|
2225
2225
|
} catch (r) {
|
|
2226
|
-
throw
|
|
2226
|
+
throw pe.cleanErrorContext(r), r;
|
|
2227
2227
|
}
|
|
2228
2228
|
}
|
|
2229
2229
|
//
|
|
@@ -2232,9 +2232,9 @@ class ge {
|
|
|
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, o) => {
|
|
2236
2236
|
if (!this.accessors.has(r)) {
|
|
2237
|
-
const n = this.blockCtx[
|
|
2237
|
+
const n = this.blockCtx[o];
|
|
2238
2238
|
if (n === void 0) throw new Error("Staging context not available");
|
|
2239
2239
|
const i = n(this.computableCtx);
|
|
2240
2240
|
i ? this.accessors.set(r, this.computableCtx.accessor(i).node({ ignoreError: !0 })) : this.accessors.set(r, void 0);
|
|
@@ -2278,13 +2278,13 @@ class ge {
|
|
|
2278
2278
|
return this.getAccessor(e).listDynamicFields();
|
|
2279
2279
|
}
|
|
2280
2280
|
getKeyValueBase64(e, t) {
|
|
2281
|
-
return
|
|
2281
|
+
return lt(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 lt(this.getAccessor(e).getData());
|
|
2288
2288
|
}
|
|
2289
2289
|
getDataAsString(e) {
|
|
2290
2290
|
return this.getAccessor(e).getDataAsString();
|
|
@@ -2293,18 +2293,18 @@ class ge {
|
|
|
2293
2293
|
// Accessor helpers
|
|
2294
2294
|
//
|
|
2295
2295
|
parsePObjectCollection(e, t, r) {
|
|
2296
|
-
const
|
|
2297
|
-
if (!
|
|
2298
|
-
const n =
|
|
2296
|
+
const o = this.getAccessor(e);
|
|
2297
|
+
if (!o.getIsReadyOrError()) return;
|
|
2298
|
+
const n = Mo(o, t, r), i = {};
|
|
2299
2299
|
for (const [a, c] of Object.entries(n))
|
|
2300
|
-
i[a] =
|
|
2300
|
+
i[a] = Q(c, (u) => this.wrapAccessor(u));
|
|
2301
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}_${X()}`;
|
|
2308
2308
|
return this.computablesToResolve[r] = t, r;
|
|
2309
2309
|
}
|
|
2310
2310
|
getBlobContentAsString(e) {
|
|
@@ -2413,7 +2413,7 @@ class ge {
|
|
|
2413
2413
|
isComplete: e.isComplete,
|
|
2414
2414
|
entries: e.entries.map((t) => ({
|
|
2415
2415
|
ref: t.ref,
|
|
2416
|
-
obj:
|
|
2416
|
+
obj: Q(t.obj, (r) => this.wrapAccessor(r))
|
|
2417
2417
|
}))
|
|
2418
2418
|
};
|
|
2419
2419
|
}
|
|
@@ -2444,7 +2444,7 @@ class ge {
|
|
|
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) => Q(t, (r) => this.getAccessor(r))),
|
|
2448
2448
|
this.computableCtx
|
|
2449
2449
|
);
|
|
2450
2450
|
}
|
|
@@ -2454,7 +2454,7 @@ class ge {
|
|
|
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
|
-
ht(e, (t) =>
|
|
2457
|
+
ht(e, (t) => Q(t, (r) => this.getAccessor(r))),
|
|
2458
2458
|
this.computableCtx
|
|
2459
2459
|
);
|
|
2460
2460
|
}
|
|
@@ -2468,7 +2468,7 @@ class ge {
|
|
|
2468
2468
|
}
|
|
2469
2469
|
wrapAccessor(e) {
|
|
2470
2470
|
if (e !== void 0) {
|
|
2471
|
-
const t =
|
|
2471
|
+
const t = X();
|
|
2472
2472
|
return this.accessors.set(t, e), t;
|
|
2473
2473
|
}
|
|
2474
2474
|
}
|
|
@@ -2481,13 +2481,13 @@ class ge {
|
|
|
2481
2481
|
return r;
|
|
2482
2482
|
}
|
|
2483
2483
|
tryExportSingleValue(e, t) {
|
|
2484
|
-
let r,
|
|
2484
|
+
let r, o = !1;
|
|
2485
2485
|
switch (typeof e) {
|
|
2486
2486
|
case "string":
|
|
2487
|
-
r = this.vm.newString(e),
|
|
2487
|
+
r = this.vm.newString(e), o = !0;
|
|
2488
2488
|
break;
|
|
2489
2489
|
case "number":
|
|
2490
|
-
r = this.vm.newNumber(e),
|
|
2490
|
+
r = this.vm.newNumber(e), o = !0;
|
|
2491
2491
|
break;
|
|
2492
2492
|
case "undefined":
|
|
2493
2493
|
r = this.vm.undefined;
|
|
@@ -2500,13 +2500,13 @@ class ge {
|
|
|
2500
2500
|
r = this.vm.null;
|
|
2501
2501
|
break;
|
|
2502
2502
|
}
|
|
2503
|
-
if (
|
|
2504
|
-
r = this.vm.newArrayBuffer(e),
|
|
2503
|
+
if (ys(e)) {
|
|
2504
|
+
r = this.vm.newArrayBuffer(e), o = !0;
|
|
2505
2505
|
break;
|
|
2506
2506
|
}
|
|
2507
2507
|
return;
|
|
2508
2508
|
}
|
|
2509
|
-
return
|
|
2509
|
+
return o && 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 ge {
|
|
|
2514
2514
|
}
|
|
2515
2515
|
exportObjectViaJson(e, t) {
|
|
2516
2516
|
const r = this.vm.newString(JSON.stringify(e)).consume(
|
|
2517
|
-
(
|
|
2517
|
+
(o) => this.vm.unwrapResult(this.vm.callFunction(this.fnJSONParse, this.vm.undefined, o))
|
|
2518
2518
|
);
|
|
2519
2519
|
return t !== void 0 ? t.manage(r) : r;
|
|
2520
2520
|
}
|
|
@@ -2536,121 +2536,121 @@ class ge {
|
|
|
2536
2536
|
return JSON.parse(t);
|
|
2537
2537
|
}
|
|
2538
2538
|
injectCtx() {
|
|
2539
|
-
|
|
2539
|
+
Pe.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 = (o, n) => {
|
|
2547
|
+
this.vm.newFunction(o, n).consume((i) => this.vm.setProp(t, o, i));
|
|
2548
2548
|
};
|
|
2549
|
-
r("getAccessorHandleByName", (
|
|
2550
|
-
this.getAccessorHandleByName(this.vm.getString(
|
|
2549
|
+
r("getAccessorHandleByName", (o) => this.exportSingleValue(
|
|
2550
|
+
this.getAccessorHandleByName(this.vm.getString(o)),
|
|
2551
2551
|
void 0
|
|
2552
|
-
)), r("resolveWithCommon", (
|
|
2552
|
+
)), r("resolveWithCommon", (o, n, ...i) => this.exportSingleValue(
|
|
2553
2553
|
this.resolveWithCommon(
|
|
2554
|
-
this.vm.getString(
|
|
2554
|
+
this.vm.getString(o),
|
|
2555
2555
|
this.importObjectViaJson(n),
|
|
2556
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", (o) => this.exportObjectViaJson(this.getResourceType(this.vm.getString(o)), void 0)), r("getInputsLocked", (o) => this.exportSingleValue(this.getInputsLocked(this.vm.getString(o)), void 0)), r("getOutputsLocked", (o) => this.exportSingleValue(this.getOutputsLocked(this.vm.getString(o)), void 0)), r("getIsReadyOrError", (o) => this.exportSingleValue(this.getIsReadyOrError(this.vm.getString(o)), void 0)), r("getIsFinal", (o) => this.exportSingleValue(this.getIsFinal(this.vm.getString(o)), void 0)), r("getError", (o) => this.exportSingleValue(this.getError(this.vm.getString(o)), void 0)), r("listInputFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("listOutputFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("listDynamicFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("getKeyValueBase64", (o, n) => this.exportSingleValue(
|
|
2562
|
+
this.getKeyValueBase64(this.vm.getString(o), this.vm.getString(n)),
|
|
2563
2563
|
void 0
|
|
2564
|
-
)), r("getKeyValueAsString", (
|
|
2565
|
-
this.getKeyValueAsString(this.vm.getString(
|
|
2564
|
+
)), r("getKeyValueAsString", (o, n) => this.exportSingleValue(
|
|
2565
|
+
this.getKeyValueAsString(this.vm.getString(o), this.vm.getString(n)),
|
|
2566
2566
|
void 0
|
|
2567
|
-
)), r("getDataBase64", (
|
|
2567
|
+
)), r("getDataBase64", (o) => this.exportSingleValue(this.getDataBase64(this.vm.getString(o)), void 0)), r("getDataAsString", (o) => this.exportSingleValue(this.getDataAsString(this.vm.getString(o)), void 0)), r("parsePObjectCollection", (o, n, i) => this.exportObjectUniversal(
|
|
2568
2568
|
this.parsePObjectCollection(
|
|
2569
|
-
this.vm.getString(
|
|
2569
|
+
this.vm.getString(o),
|
|
2570
2570
|
this.vm.dump(n),
|
|
2571
2571
|
this.vm.getString(i)
|
|
2572
2572
|
),
|
|
2573
2573
|
void 0
|
|
2574
|
-
)), r("getBlobContentAsBase64", (
|
|
2575
|
-
this.getBlobContentAsBase64(this.vm.getString(
|
|
2574
|
+
)), r("getBlobContentAsBase64", (o) => this.exportSingleValue(
|
|
2575
|
+
this.getBlobContentAsBase64(this.vm.getString(o)),
|
|
2576
2576
|
void 0
|
|
2577
|
-
)), r("getBlobContentAsString", (
|
|
2578
|
-
this.getBlobContentAsString(this.vm.getString(
|
|
2577
|
+
)), r("getBlobContentAsString", (o) => this.exportSingleValue(
|
|
2578
|
+
this.getBlobContentAsString(this.vm.getString(o)),
|
|
2579
2579
|
void 0
|
|
2580
|
-
)), r("getDownloadedBlobContentHandle", (
|
|
2581
|
-
this.getDownloadedBlobContentHandle(this.vm.getString(
|
|
2580
|
+
)), r("getDownloadedBlobContentHandle", (o) => this.exportSingleValue(
|
|
2581
|
+
this.getDownloadedBlobContentHandle(this.vm.getString(o)),
|
|
2582
2582
|
void 0
|
|
2583
|
-
)), r("getOnDemandBlobContentHandle", (
|
|
2584
|
-
this.getOnDemandBlobContentHandle(this.vm.getString(
|
|
2583
|
+
)), r("getOnDemandBlobContentHandle", (o) => this.exportSingleValue(
|
|
2584
|
+
this.getOnDemandBlobContentHandle(this.vm.getString(o)),
|
|
2585
2585
|
void 0
|
|
2586
|
-
)), r("getImportProgress", (
|
|
2587
|
-
this.getLastLogs(this.vm.getString(
|
|
2586
|
+
)), r("getImportProgress", (o) => this.exportSingleValue(this.getImportProgress(this.vm.getString(o)), void 0)), r("getLastLogs", (o, n) => this.exportSingleValue(
|
|
2587
|
+
this.getLastLogs(this.vm.getString(o), this.vm.getNumber(n)),
|
|
2588
2588
|
void 0
|
|
2589
|
-
)), r("getProgressLog", (
|
|
2590
|
-
this.getProgressLog(this.vm.getString(
|
|
2589
|
+
)), r("getProgressLog", (o, n) => this.exportSingleValue(
|
|
2590
|
+
this.getProgressLog(this.vm.getString(o), this.vm.getString(n)),
|
|
2591
2591
|
void 0
|
|
2592
|
-
)), r("getLogHandle", (
|
|
2593
|
-
this.calculateOptions(this.importObjectViaJson(
|
|
2592
|
+
)), r("getLogHandle", (o) => this.exportSingleValue(this.getLogHandle(this.vm.getString(o)), void 0)), r("getBlockLabel", (o) => this.exportSingleValue(this.getBlockLabel(this.vm.getString(o)), void 0)), r("getDataFromResultPool", (o) => this.exportObjectUniversal(this.getDataFromResultPool(), void 0)), r("getDataWithErrorsFromResultPool", (o) => this.exportObjectUniversal(this.getDataWithErrorsFromResultPool(), void 0)), r("getSpecsFromResultPool", (o) => this.exportObjectUniversal(this.getSpecsFromResultPool(), void 0)), r("calculateOptions", (o) => this.exportObjectUniversal(
|
|
2593
|
+
this.calculateOptions(this.importObjectViaJson(o)),
|
|
2594
2594
|
void 0
|
|
2595
|
-
)), r("createPFrame", (
|
|
2596
|
-
this.createPFrame(this.importObjectViaJson(
|
|
2595
|
+
)), r("createPFrame", (o) => this.exportSingleValue(
|
|
2596
|
+
this.createPFrame(this.importObjectViaJson(o)),
|
|
2597
2597
|
void 0
|
|
2598
|
-
)), r("createPTable", (
|
|
2599
|
-
this.createPTable(this.importObjectViaJson(
|
|
2598
|
+
)), r("createPTable", (o) => this.exportSingleValue(
|
|
2599
|
+
this.createPTable(this.importObjectViaJson(o)),
|
|
2600
2600
|
void 0
|
|
2601
2601
|
)), this.vm.setProp(this.vm.global, "cfgRenderCtx", t);
|
|
2602
2602
|
});
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
2605
|
-
function
|
|
2605
|
+
function bs(s, e, t, r, o = {}) {
|
|
2606
2606
|
return F.makeRaw((n) => {
|
|
2607
|
-
const i = new
|
|
2607
|
+
const i = new Pe();
|
|
2608
2608
|
n.addOnDestroy(() => i.dispose());
|
|
2609
|
-
const a = i.manage(
|
|
2609
|
+
const a = i.manage(s.quickJs.newRuntime());
|
|
2610
2610
|
a.setMemoryLimit(1024 * 640), a.setMaxStackSize(1024 * 320);
|
|
2611
|
-
const c = i.manage(a.newContext()), u = new
|
|
2611
|
+
const c = i.manage(a.newContext()), u = new pe(i, c, e, s, 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 [g,
|
|
2617
|
+
for (const [g, f] of Object.entries(p)) u.runCallback(g, f);
|
|
2618
2618
|
return u.importObjectUniversal(l);
|
|
2619
2619
|
}
|
|
2620
2620
|
};
|
|
2621
|
-
},
|
|
2621
|
+
}, o);
|
|
2622
2622
|
}
|
|
2623
|
-
function
|
|
2623
|
+
function je(s, e, t, r, o = {}) {
|
|
2624
2624
|
if (ft(t)) {
|
|
2625
2625
|
if (r === void 0) throw new Error("No code bundle.");
|
|
2626
|
-
return
|
|
2627
|
-
} else return
|
|
2626
|
+
return bs(s, e, t, r, o);
|
|
2627
|
+
} else return Ut(s.driverKit, e, t, o);
|
|
2628
2628
|
}
|
|
2629
|
-
function
|
|
2629
|
+
function ws(s, e, t) {
|
|
2630
2630
|
return F.make(
|
|
2631
2631
|
(r) => {
|
|
2632
|
-
var
|
|
2633
|
-
const
|
|
2634
|
-
|
|
2632
|
+
var b, C, I, G, K, H, z, oe;
|
|
2633
|
+
const o = r.accessor(s).node(), n = w(o.getKeyValueAsJson(Je)), i = w(o.getKeyValueAsJson(ee)), a = w(o.getKeyValueAsJson(te)), c = w(o.getKeyValueAsJson(W)), u = w(
|
|
2634
|
+
o.getKeyValueAsJson(ue)
|
|
2635
2635
|
), l = /* @__PURE__ */ new Map();
|
|
2636
2636
|
for (const { id: k } of N(c)) {
|
|
2637
|
-
const J =
|
|
2637
|
+
const J = o.traverse({
|
|
2638
2638
|
field: P(k, "currentArgs"),
|
|
2639
2639
|
assertFieldType: "Dynamic",
|
|
2640
2640
|
errorIfFieldNotSet: !0
|
|
2641
2641
|
});
|
|
2642
2642
|
let Y;
|
|
2643
|
-
const E =
|
|
2643
|
+
const E = o.traverse({
|
|
2644
2644
|
field: P(k, "prodArgs"),
|
|
2645
2645
|
assertFieldType: "Dynamic",
|
|
2646
2646
|
stableIfNotFound: !0
|
|
2647
2647
|
});
|
|
2648
2648
|
if (E !== void 0) {
|
|
2649
|
-
const x =
|
|
2649
|
+
const x = o.getField({
|
|
2650
2650
|
field: P(k, "prodOutput"),
|
|
2651
2651
|
assertFieldType: "Dynamic",
|
|
2652
2652
|
errorIfFieldNotFound: !0
|
|
2653
|
-
}), B =
|
|
2653
|
+
}), B = o.getField({
|
|
2654
2654
|
field: P(k, "prodUiCtx"),
|
|
2655
2655
|
assertFieldType: "Dynamic",
|
|
2656
2656
|
errorIfFieldNotFound: !0
|
|
@@ -2658,61 +2658,61 @@ function wo(o, e, t) {
|
|
|
2658
2658
|
Y = {
|
|
2659
2659
|
arguments: E.getDataAsJson(),
|
|
2660
2660
|
stale: J.id !== E.id,
|
|
2661
|
-
outputError: x.error !== void 0 || B.error !== void 0 || ((
|
|
2662
|
-
outputsError: ((I = x.error) == null ? void 0 : I.getDataAsString()) ?? ((
|
|
2661
|
+
outputError: x.error !== void 0 || B.error !== void 0 || ((b = x.value) == null ? void 0 : b.getError()) !== void 0 || ((C = B.value) == null ? void 0 : C.getError()) !== void 0,
|
|
2662
|
+
outputsError: ((I = x.error) == null ? void 0 : I.getDataAsString()) ?? ((K = (G = x.value) == null ? void 0 : G.getError()) == null ? void 0 : K.getDataAsString()),
|
|
2663
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
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 He, _e, We
|
|
2669
|
+
const p = ie(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...N(c)].map(({ id: k, label: J, renderingMode: Y }) => {
|
|
2670
|
+
var Ge, He, _e, We;
|
|
2671
2671
|
const E = w(l.get(k)), x = w(p.nodes.get(k));
|
|
2672
2672
|
let B = "NotCalculated";
|
|
2673
2673
|
E.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = E.prod.finished ? "Done" : "Running");
|
|
2674
|
-
const
|
|
2674
|
+
const U = o.traverse(
|
|
2675
2675
|
{
|
|
2676
2676
|
field: P(k, "blockPack"),
|
|
2677
2677
|
assertFieldType: "Dynamic",
|
|
2678
2678
|
errorIfFieldNotSet: !0
|
|
2679
2679
|
},
|
|
2680
|
-
{ field:
|
|
2681
|
-
), L =
|
|
2682
|
-
const q =
|
|
2680
|
+
{ field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2681
|
+
), L = U == null ? void 0 : U.getDataAsJson(), { sections: se, inputsValid: v, sdkVersion: O } = de(L == null ? void 0 : L.config, (fe) => {
|
|
2682
|
+
const q = Ae(fe), ze = Ue(o, k);
|
|
2683
2683
|
return {
|
|
2684
|
-
sections:
|
|
2684
|
+
sections: je(
|
|
2685
2685
|
t,
|
|
2686
|
-
|
|
2686
|
+
ze,
|
|
2687
2687
|
q.sections,
|
|
2688
2688
|
q.code
|
|
2689
2689
|
),
|
|
2690
|
-
inputsValid:
|
|
2690
|
+
inputsValid: je(
|
|
2691
2691
|
t,
|
|
2692
|
-
|
|
2692
|
+
ze,
|
|
2693
2693
|
q.inputsValid,
|
|
2694
2694
|
q.code
|
|
2695
2695
|
),
|
|
2696
2696
|
sdkVersion: q.sdkVersion
|
|
2697
2697
|
};
|
|
2698
|
-
}) || {}, R =
|
|
2698
|
+
}) || {}, R = de(
|
|
2699
2699
|
L,
|
|
2700
|
-
(
|
|
2700
|
+
(fe) => t.blockUpdateWatcher.get(fe.source)
|
|
2701
2701
|
);
|
|
2702
2702
|
return {
|
|
2703
2703
|
id: k,
|
|
2704
2704
|
label: J,
|
|
2705
2705
|
renderingMode: Y,
|
|
2706
|
-
stale: ((
|
|
2706
|
+
stale: ((Ge = E.prod) == null ? void 0 : Ge.stale) !== !1 || B === "Limbo",
|
|
2707
2707
|
missingReference: x.missingReferences,
|
|
2708
2708
|
upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
|
|
2709
2709
|
downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
|
|
2710
2710
|
calculationStatus: B,
|
|
2711
|
-
outputErrors: ((
|
|
2712
|
-
outputsError: (
|
|
2713
|
-
exportsError: (
|
|
2714
|
-
sections:
|
|
2715
|
-
inputsValid:
|
|
2711
|
+
outputErrors: ((He = E.prod) == null ? void 0 : He.outputError) === !0,
|
|
2712
|
+
outputsError: (_e = E.prod) == null ? void 0 : _e.outputsError,
|
|
2713
|
+
exportsError: (We = E.prod) == null ? void 0 : We.exportsError,
|
|
2714
|
+
sections: se,
|
|
2715
|
+
inputsValid: v,
|
|
2716
2716
|
currentBlockPack: L == null ? void 0 : L.source,
|
|
2717
2717
|
updatedBlockPack: R,
|
|
2718
2718
|
sdkVersion: O,
|
|
@@ -2723,18 +2723,18 @@ function wo(o, e, t) {
|
|
|
2723
2723
|
meta: a,
|
|
2724
2724
|
created: new Date(n),
|
|
2725
2725
|
lastModified: new Date(i),
|
|
2726
|
-
authorMarker:
|
|
2727
|
-
blocks:
|
|
2726
|
+
authorMarker: o.getKeyValueAsJson(Be),
|
|
2727
|
+
blocks: f
|
|
2728
2728
|
};
|
|
2729
2729
|
},
|
|
2730
2730
|
{
|
|
2731
2731
|
postprocessValue: (r) => {
|
|
2732
|
-
const
|
|
2732
|
+
const o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2733
2733
|
return {
|
|
2734
2734
|
...r,
|
|
2735
2735
|
blocks: r.blocks.map((i) => {
|
|
2736
|
-
i.inputsValid ||
|
|
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) =>
|
|
2736
|
+
i.inputsValid || o.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) => o.has(u)) === -1;
|
|
2738
2738
|
return { ...i, canRun: c, stale: a };
|
|
2739
2739
|
})
|
|
2740
2740
|
};
|
|
@@ -2742,22 +2742,22 @@ function wo(o, e, t) {
|
|
|
2742
2742
|
}
|
|
2743
2743
|
).withStableType();
|
|
2744
2744
|
}
|
|
2745
|
-
function Gt(
|
|
2745
|
+
function Gt(s, e) {
|
|
2746
2746
|
var t, r;
|
|
2747
|
-
return
|
|
2748
|
-
(r = (t =
|
|
2747
|
+
return de(
|
|
2748
|
+
(r = (t = s.traverse(
|
|
2749
2749
|
{
|
|
2750
2750
|
field: P(e, "blockPack"),
|
|
2751
2751
|
assertFieldType: "Dynamic",
|
|
2752
2752
|
errorIfFieldNotSet: !0
|
|
2753
2753
|
},
|
|
2754
|
-
{ field:
|
|
2754
|
+
{ field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2755
2755
|
)) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
|
|
2756
|
-
(
|
|
2756
|
+
(o) => Ae(o)
|
|
2757
2757
|
);
|
|
2758
2758
|
}
|
|
2759
|
-
function
|
|
2760
|
-
const t =
|
|
2759
|
+
function Ss(s, e) {
|
|
2760
|
+
const t = s.node();
|
|
2761
2761
|
if ($(t.resourceType, Dt)) {
|
|
2762
2762
|
const r = t.getDataAsJson();
|
|
2763
2763
|
if (r === void 0) throw new Error("No resource data.");
|
|
@@ -2773,10 +2773,10 @@ function So(o, e) {
|
|
|
2773
2773
|
} else
|
|
2774
2774
|
throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
|
|
2775
2775
|
}
|
|
2776
|
-
function
|
|
2777
|
-
if (
|
|
2776
|
+
function ks(s, e) {
|
|
2777
|
+
if (s !== void 0)
|
|
2778
2778
|
return F.make(
|
|
2779
|
-
(t) =>
|
|
2779
|
+
(t) => Ss(t.accessor(s), e),
|
|
2780
2780
|
{
|
|
2781
2781
|
postprocessValue: (t) => {
|
|
2782
2782
|
if (t !== void 0) {
|
|
@@ -2788,89 +2788,89 @@ function ko(o, e) {
|
|
|
2788
2788
|
}
|
|
2789
2789
|
).withStableType();
|
|
2790
2790
|
}
|
|
2791
|
-
function
|
|
2791
|
+
function Cs(s, e, t) {
|
|
2792
2792
|
return F.make(
|
|
2793
2793
|
(r) => {
|
|
2794
2794
|
var a;
|
|
2795
|
-
const
|
|
2795
|
+
const o = r.accessor(s).node(), n = Gt(o, e), i = (a = o.traverse(
|
|
2796
2796
|
{
|
|
2797
2797
|
field: P(e, "blockPack"),
|
|
2798
2798
|
assertFieldType: "Dynamic"
|
|
2799
2799
|
},
|
|
2800
|
-
{ field:
|
|
2801
|
-
{ field:
|
|
2800
|
+
{ field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
|
|
2801
|
+
{ field: jt, assertFieldType: "Input" }
|
|
2802
2802
|
)) == null ? void 0 : a.persist();
|
|
2803
|
-
return { path:
|
|
2803
|
+
return { path: ks(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
|
|
2804
2804
|
},
|
|
2805
2805
|
{ mode: "StableOnlyLive" }
|
|
2806
2806
|
);
|
|
2807
2807
|
}
|
|
2808
|
-
function
|
|
2808
|
+
function Ps(s, e, t) {
|
|
2809
2809
|
return F.make(
|
|
2810
2810
|
(r) => {
|
|
2811
|
-
const
|
|
2811
|
+
const o = r.accessor(s).node(), n = Ue(o, e);
|
|
2812
2812
|
return {
|
|
2813
|
-
author:
|
|
2813
|
+
author: o.getKeyValueAsJson(Re(e)),
|
|
2814
2814
|
args: JSON.parse(n.args),
|
|
2815
2815
|
ui: n.uiState !== void 0 ? JSON.parse(n.uiState) : void 0
|
|
2816
2816
|
};
|
|
2817
2817
|
},
|
|
2818
|
-
{ key: "inputs#" + bt(
|
|
2818
|
+
{ key: "inputs#" + bt(s.rid) + e }
|
|
2819
2819
|
);
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function Fs(s, e, t) {
|
|
2822
2822
|
return F.make(
|
|
2823
2823
|
(r) => {
|
|
2824
|
-
const
|
|
2825
|
-
return
|
|
2824
|
+
const o = r.accessor(s).node(), n = Nt(o, e), i = Gt(o, e);
|
|
2825
|
+
return de(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
|
+
je(t, n, l, a.code)
|
|
2830
2830
|
);
|
|
2831
2831
|
return c;
|
|
2832
2832
|
});
|
|
2833
2833
|
},
|
|
2834
|
-
{ key: "outputs#" + bt(
|
|
2834
|
+
{ key: "outputs#" + bt(s.rid) + e }
|
|
2835
2835
|
).withStableType();
|
|
2836
2836
|
}
|
|
2837
|
-
function
|
|
2837
|
+
function Rs(s, e) {
|
|
2838
2838
|
return F.make((t) => {
|
|
2839
|
-
const r = t.accessor(
|
|
2840
|
-
for (const { id: i, renderingMode: a } of N(
|
|
2839
|
+
const r = t.accessor(s).node(), o = w(r.getKeyValueAsJson(W)), n = [];
|
|
2840
|
+
for (const { id: i, renderingMode: a } of N(o)) {
|
|
2841
2841
|
const c = r.traverse(
|
|
2842
2842
|
{
|
|
2843
2843
|
field: P(i, "blockPack"),
|
|
2844
2844
|
assertFieldType: "Dynamic",
|
|
2845
2845
|
errorIfFieldNotSet: !0
|
|
2846
2846
|
},
|
|
2847
|
-
{ field:
|
|
2847
|
+
{ field: y.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 = Ae(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !ft(f) && $o(f)).map((f) => f);
|
|
2851
2851
|
if (p.length === 0) continue;
|
|
2852
2852
|
const g = Nt(r, i);
|
|
2853
|
-
for (const
|
|
2854
|
-
n.push(F.wrapError(
|
|
2853
|
+
for (const f of p)
|
|
2854
|
+
n.push(F.wrapError(Ut(e.driverKit, g, f)));
|
|
2855
2855
|
}
|
|
2856
2856
|
return n;
|
|
2857
2857
|
});
|
|
2858
2858
|
}
|
|
2859
|
-
class
|
|
2859
|
+
class Bs {
|
|
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 Ze() });
|
|
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: { ...Zt }, change: new
|
|
2873
|
+
return r === void 0 && (r = { state: { ...Zt }, change: new Ze() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
|
|
2874
2874
|
}
|
|
2875
2875
|
getState(e) {
|
|
2876
2876
|
return F.make(
|
|
@@ -2883,29 +2883,29 @@ class Bo {
|
|
|
2883
2883
|
t !== void 0 && (this.states.delete(e), t.change.markChanged());
|
|
2884
2884
|
}
|
|
2885
2885
|
}
|
|
2886
|
-
class
|
|
2886
|
+
class $e {
|
|
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 Bs());
|
|
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 = ws(
|
|
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 = Rs(r.entry(), e);
|
|
2904
2904
|
}
|
|
2905
2905
|
async refreshLoop() {
|
|
2906
2906
|
for (; !this.destroyed; )
|
|
2907
2907
|
try {
|
|
2908
|
-
await
|
|
2908
|
+
await we(this.env.pl, this.rid, (e) => {
|
|
2909
2909
|
e.doRefresh(this.env.ops.stagingRenderingRate);
|
|
2910
2910
|
}), await this.activeConfigs.getValue(), await kt(this.env.ops.projectRefreshInterval, this.abortController.signal);
|
|
2911
2911
|
} catch (e) {
|
|
@@ -2929,12 +2929,12 @@ class Ge {
|
|
|
2929
2929
|
*
|
|
2930
2930
|
* @return returns newly created block id
|
|
2931
2931
|
* */
|
|
2932
|
-
async addBlock(e, t, r,
|
|
2932
|
+
async addBlock(e, t, r, o = void 0, n = X()) {
|
|
2933
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
|
+
o,
|
|
2938
2938
|
(c) => c.addBlock(
|
|
2939
2939
|
{
|
|
2940
2940
|
id: n,
|
|
@@ -2953,12 +2953,12 @@ class Ge {
|
|
|
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,
|
|
2956
|
+
async updateBlockPack(e, t, r = !1, o) {
|
|
2957
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
|
+
o,
|
|
2962
2962
|
(a) => a.migrateBlockPack(
|
|
2963
2963
|
e,
|
|
2964
2964
|
n,
|
|
@@ -2978,10 +2978,10 @@ class Ge {
|
|
|
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 o = r.structure;
|
|
2982
|
+
if (o.groups.length !== 1)
|
|
2983
2983
|
throw new Error("Unexpected project structure, non-sinular block group");
|
|
2984
|
-
const n =
|
|
2984
|
+
const n = o.groups[0];
|
|
2985
2985
|
if (n.blocks.length !== e.length)
|
|
2986
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");
|
|
@@ -3007,7 +3007,7 @@ class Ge {
|
|
|
3007
3007
|
* stale state.
|
|
3008
3008
|
* */
|
|
3009
3009
|
async runBlock(e) {
|
|
3010
|
-
await
|
|
3010
|
+
await we(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 Ge {
|
|
|
3015
3015
|
* calculated.
|
|
3016
3016
|
* */
|
|
3017
3017
|
async stopBlock(e) {
|
|
3018
|
-
await
|
|
3018
|
+
await we(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, (o) => {
|
|
3023
|
+
o.setBlockLabel(e, t);
|
|
3024
3024
|
}), await this.projectTree.refreshState();
|
|
3025
3025
|
}
|
|
3026
3026
|
/**
|
|
@@ -3034,7 +3034,7 @@ class Ge {
|
|
|
3034
3034
|
this.env.pl,
|
|
3035
3035
|
this.rid,
|
|
3036
3036
|
r,
|
|
3037
|
-
(
|
|
3037
|
+
(o) => o.setArgs([{ blockId: e, args: JSON.stringify(t) }])
|
|
3038
3038
|
), await this.projectTree.refreshState();
|
|
3039
3039
|
}
|
|
3040
3040
|
/**
|
|
@@ -3048,7 +3048,7 @@ class Ge {
|
|
|
3048
3048
|
this.env.pl,
|
|
3049
3049
|
this.rid,
|
|
3050
3050
|
r,
|
|
3051
|
-
(
|
|
3051
|
+
(o) => o.setUiState(e, t === void 0 ? void 0 : JSON.stringify(t))
|
|
3052
3052
|
), await this.projectTree.refreshState();
|
|
3053
3053
|
}
|
|
3054
3054
|
/**
|
|
@@ -3063,18 +3063,18 @@ class Ge {
|
|
|
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,
|
|
3066
|
+
async setBlockArgsAndUiState(e, t, r, o) {
|
|
3067
|
+
await V(this.env.pl, this.rid, o, (n) => {
|
|
3068
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 o = Ce(
|
|
3075
3075
|
(await r.getField(S(this.rid, P(e, "blockPack")))).value
|
|
3076
|
-
), n =
|
|
3077
|
-
(await r.getField(S(
|
|
3076
|
+
), n = Ce(
|
|
3077
|
+
(await r.getField(S(o, y.HolderRefField))).value
|
|
3078
3078
|
), i = await r.getResourceData(n, !1), a = JSON.parse(
|
|
3079
3079
|
Buffer.from(w(i.data)).toString("utf-8")
|
|
3080
3080
|
);
|
|
@@ -3086,10 +3086,10 @@ class Ge {
|
|
|
3086
3086
|
getBlockComputables(e) {
|
|
3087
3087
|
const t = this.blockComputables.get(e);
|
|
3088
3088
|
if (t === void 0) {
|
|
3089
|
-
const r =
|
|
3089
|
+
const r = Fs(this.projectTree.entry(), e, this.env), n = {
|
|
3090
3090
|
fullState: F.make(
|
|
3091
3091
|
(i) => ({
|
|
3092
|
-
argsAndUiState:
|
|
3092
|
+
argsAndUiState: Ps(this.projectTree.entry(), e),
|
|
3093
3093
|
outputs: r,
|
|
3094
3094
|
navigationState: this.navigationStates.getState(e)
|
|
3095
3095
|
}),
|
|
@@ -3120,7 +3120,7 @@ class Ge {
|
|
|
3120
3120
|
getBlockFrontend(e) {
|
|
3121
3121
|
const t = this.blockFrontends.get(e);
|
|
3122
3122
|
if (t === void 0) {
|
|
3123
|
-
const r =
|
|
3123
|
+
const r = Cs(
|
|
3124
3124
|
this.projectTree.entry(),
|
|
3125
3125
|
e,
|
|
3126
3126
|
this.env
|
|
@@ -3145,27 +3145,27 @@ class Ge {
|
|
|
3145
3145
|
t,
|
|
3146
3146
|
{
|
|
3147
3147
|
...e.ops.defaultTreeOptions,
|
|
3148
|
-
pruning:
|
|
3148
|
+
pruning: Os
|
|
3149
3149
|
},
|
|
3150
3150
|
e.logger
|
|
3151
3151
|
);
|
|
3152
|
-
return new
|
|
3152
|
+
return new $e(e, t, r);
|
|
3153
3153
|
}
|
|
3154
3154
|
}
|
|
3155
|
-
function
|
|
3156
|
-
switch (
|
|
3155
|
+
function Os(s) {
|
|
3156
|
+
switch (s.type.name) {
|
|
3157
3157
|
case "BlockPackCustom":
|
|
3158
|
-
return
|
|
3158
|
+
return s.fields.filter((e) => e.name !== "template");
|
|
3159
3159
|
case "UserProject":
|
|
3160
|
-
return
|
|
3160
|
+
return s.fields.filter((e) => !e.name.startsWith("__serviceTemplate"));
|
|
3161
3161
|
case "Blob":
|
|
3162
3162
|
return [];
|
|
3163
3163
|
default:
|
|
3164
|
-
return
|
|
3164
|
+
return s.fields;
|
|
3165
3165
|
}
|
|
3166
3166
|
}
|
|
3167
3167
|
const Ht = {
|
|
3168
|
-
logger: new
|
|
3168
|
+
logger: new sr(),
|
|
3169
3169
|
blobDriverOps: {
|
|
3170
3170
|
cacheSoftSizeBytes: 100 * 1024 * 1024,
|
|
3171
3171
|
// 100MB
|
|
@@ -3183,12 +3183,12 @@ const Ht = {
|
|
|
3183
3183
|
stopPollingDelay: 1e3
|
|
3184
3184
|
}
|
|
3185
3185
|
};
|
|
3186
|
-
function _t(
|
|
3186
|
+
function _t(s) {
|
|
3187
3187
|
return {
|
|
3188
|
-
blobDownloadPath:
|
|
3188
|
+
blobDownloadPath: j.join(s, "download")
|
|
3189
3189
|
};
|
|
3190
3190
|
}
|
|
3191
|
-
const
|
|
3191
|
+
const Ds = {
|
|
3192
3192
|
...Ht,
|
|
3193
3193
|
defaultTreeOptions: {
|
|
3194
3194
|
pollingInterval: 350,
|
|
@@ -3198,20 +3198,20 @@ const Do = {
|
|
|
3198
3198
|
projectRefreshInterval: 700,
|
|
3199
3199
|
stagingRenderingRate: 5
|
|
3200
3200
|
};
|
|
3201
|
-
function
|
|
3201
|
+
function xs(s) {
|
|
3202
3202
|
return {
|
|
3203
|
-
..._t(
|
|
3204
|
-
frontendDownloadPath:
|
|
3203
|
+
..._t(s),
|
|
3204
|
+
frontendDownloadPath: j.join(s, "frontend")
|
|
3205
3205
|
};
|
|
3206
3206
|
}
|
|
3207
|
-
const
|
|
3207
|
+
const Ts = {
|
|
3208
3208
|
minDelay: 1500
|
|
3209
|
-
},
|
|
3210
|
-
class
|
|
3211
|
-
constructor(t, r,
|
|
3212
|
-
super({ ...
|
|
3209
|
+
}, js = "__no_updates__";
|
|
3210
|
+
class Es extends mr {
|
|
3211
|
+
constructor(t, r, o = {}) {
|
|
3212
|
+
super({ ...o, ...Ts }, r);
|
|
3213
3213
|
d(this, "http");
|
|
3214
|
-
this.registryProvider = t, this.http =
|
|
3214
|
+
this.registryProvider = t, this.http = o.http;
|
|
3215
3215
|
}
|
|
3216
3216
|
getKey(t) {
|
|
3217
3217
|
switch (t.type) {
|
|
@@ -3222,7 +3222,7 @@ class Eo extends mr {
|
|
|
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 js;
|
|
3226
3226
|
}
|
|
3227
3227
|
}
|
|
3228
3228
|
async readValue(t) {
|
|
@@ -3231,42 +3231,42 @@ class Eo extends mr {
|
|
|
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 o = await Pt(t.folder);
|
|
3235
|
+
return o === t.mtime ? void 0 : { ...t, mtime: o };
|
|
3236
|
+
} catch (o) {
|
|
3237
|
+
this.logger.warn(o);
|
|
3238
3238
|
return;
|
|
3239
3239
|
}
|
|
3240
3240
|
case "dev-v2":
|
|
3241
3241
|
try {
|
|
3242
|
-
const
|
|
3243
|
-
if (
|
|
3244
|
-
const n = await
|
|
3242
|
+
const o = await mt(t.folder, this.logger);
|
|
3243
|
+
if (o === void 0) return;
|
|
3244
|
+
const n = await Le(o);
|
|
3245
3245
|
return n === t.mtime ? void 0 : { ...t, mtime: n };
|
|
3246
|
-
} catch (
|
|
3247
|
-
this.logger.warn(
|
|
3246
|
+
} catch (o) {
|
|
3247
|
+
this.logger.warn(o);
|
|
3248
3248
|
return;
|
|
3249
3249
|
}
|
|
3250
3250
|
case "from-registry-v2":
|
|
3251
3251
|
try {
|
|
3252
|
-
const
|
|
3252
|
+
const o = this.registryProvider.getRegistry(t.registryUrl), n = (r = await o.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
|
|
3253
3253
|
if ((n == null ? void 0 : n.type) !== "from-registry-v2") throw new Error("Unexpected");
|
|
3254
|
-
return
|
|
3254
|
+
return me(n.id, t.id) ? void 0 : ((async () => {
|
|
3255
3255
|
try {
|
|
3256
|
-
await
|
|
3256
|
+
await o.getComponents(n.id);
|
|
3257
3257
|
} catch (i) {
|
|
3258
3258
|
this.logger.warn(i);
|
|
3259
3259
|
}
|
|
3260
3260
|
})(), n);
|
|
3261
|
-
} catch (
|
|
3262
|
-
this.logger.warn(
|
|
3261
|
+
} catch (o) {
|
|
3262
|
+
this.logger.warn(o);
|
|
3263
3263
|
return;
|
|
3264
3264
|
}
|
|
3265
3265
|
default:
|
|
3266
3266
|
return;
|
|
3267
3267
|
}
|
|
3268
|
-
} catch (
|
|
3269
|
-
this.logger.warn(
|
|
3268
|
+
} catch (o) {
|
|
3269
|
+
this.logger.warn(o);
|
|
3270
3270
|
return;
|
|
3271
3271
|
}
|
|
3272
3272
|
}
|
|
@@ -3275,9 +3275,9 @@ class Eo extends mr {
|
|
|
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 && me(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 && me(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 Eo extends mr {
|
|
|
3287
3287
|
}
|
|
3288
3288
|
}
|
|
3289
3289
|
}
|
|
3290
|
-
class
|
|
3290
|
+
class dt {
|
|
3291
3291
|
constructor() {
|
|
3292
3292
|
d(this, "resources", /* @__PURE__ */ new Map());
|
|
3293
3293
|
}
|
|
@@ -3304,12 +3304,12 @@ class pt {
|
|
|
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 o = !1;
|
|
3308
3308
|
return {
|
|
3309
3309
|
resource: r.resource,
|
|
3310
3310
|
key: t,
|
|
3311
3311
|
unref: () => {
|
|
3312
|
-
|
|
3312
|
+
o || (r.refCount--, o = !0, this.check(t));
|
|
3313
3313
|
}
|
|
3314
3314
|
};
|
|
3315
3315
|
}
|
|
@@ -3322,12 +3322,12 @@ class pt {
|
|
|
3322
3322
|
return (t = this.resources.get(e)) == null ? void 0 : t.resource;
|
|
3323
3323
|
}
|
|
3324
3324
|
}
|
|
3325
|
-
function
|
|
3326
|
-
return String(
|
|
3325
|
+
function pt(s) {
|
|
3326
|
+
return String(s.id);
|
|
3327
3327
|
}
|
|
3328
|
-
class
|
|
3328
|
+
class As {
|
|
3329
3329
|
constructor(e, t, r) {
|
|
3330
|
-
d(this, "pFrame", new
|
|
3330
|
+
d(this, "pFrame", new Tr());
|
|
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 Ao {
|
|
|
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 i of
|
|
3348
|
-
const n =
|
|
3346
|
+
for (const o of r) {
|
|
3347
|
+
for (const i of jo(o.data)) this.blobIdToResource.set(pt(i), i);
|
|
3348
|
+
const n = Eo(o.data, pt);
|
|
3349
3349
|
try {
|
|
3350
|
-
this.pFrame.addColumnSpec(
|
|
3350
|
+
this.pFrame.addColumnSpec(o.id, o.spec), this.pFrame.setColumnData(o.id, n);
|
|
3351
3351
|
} catch (i) {
|
|
3352
3352
|
throw new Error(
|
|
3353
|
-
`Adding column ${
|
|
3353
|
+
`Adding column ${o.id} to PFrame failed: ${i}; Spec: ${o.spec}, DataInfo: ${n}.`
|
|
3354
3354
|
);
|
|
3355
3355
|
}
|
|
3356
3356
|
}
|
|
@@ -3367,7 +3367,7 @@ class Ao {
|
|
|
3367
3367
|
this.pFrame.dispose();
|
|
3368
3368
|
}
|
|
3369
3369
|
}
|
|
3370
|
-
class
|
|
3370
|
+
class Is {
|
|
3371
3371
|
constructor(e) {
|
|
3372
3372
|
d(this, "pFrames");
|
|
3373
3373
|
d(this, "pTables");
|
|
@@ -3375,37 +3375,37 @@ class Io {
|
|
|
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 jr({
|
|
3379
3379
|
maxSize: 1e9,
|
|
3380
3380
|
// 1Gb
|
|
3381
|
-
fetchMethod: async (
|
|
3382
|
-
sizeCalculation: (
|
|
3381
|
+
fetchMethod: async (o) => await yt.readFile(o),
|
|
3382
|
+
sizeCalculation: (o) => o.length
|
|
3383
3383
|
}), r = new nr(1);
|
|
3384
|
-
this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends
|
|
3385
|
-
constructor(
|
|
3386
|
-
super(), this.blobDriver =
|
|
3384
|
+
this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends dt {
|
|
3385
|
+
constructor(o) {
|
|
3386
|
+
super(), this.blobDriver = o;
|
|
3387
3387
|
}
|
|
3388
|
-
createNewResource(
|
|
3389
|
-
return new
|
|
3388
|
+
createNewResource(o) {
|
|
3389
|
+
return new As(this.blobDriver, t, o);
|
|
3390
3390
|
}
|
|
3391
|
-
calculateParamsKey(
|
|
3392
|
-
return
|
|
3391
|
+
calculateParamsKey(o) {
|
|
3392
|
+
return Ns(o);
|
|
3393
3393
|
}
|
|
3394
|
-
}(this.blobDriver), this.pTables = new class extends
|
|
3395
|
-
constructor(
|
|
3396
|
-
super(), this.pFrames =
|
|
3394
|
+
}(this.blobDriver), this.pTables = new class extends dt {
|
|
3395
|
+
constructor(o) {
|
|
3396
|
+
super(), this.pFrames = o;
|
|
3397
3397
|
}
|
|
3398
|
-
async createNewResource(
|
|
3399
|
-
const n = this.pFrames.getByKey(
|
|
3398
|
+
async createNewResource(o) {
|
|
3399
|
+
const n = this.pFrames.getByKey(o.pFrameHandle), i = await r.run(
|
|
3400
3400
|
async () => await n.pFrame.createTable({
|
|
3401
|
-
src:
|
|
3402
|
-
filters:
|
|
3401
|
+
src: Z(o.def.src),
|
|
3402
|
+
filters: o.def.filters
|
|
3403
3403
|
})
|
|
3404
3404
|
);
|
|
3405
|
-
return
|
|
3405
|
+
return o.def.sorting.length !== 0 ? i.sort(o.def.sorting) : i;
|
|
3406
3406
|
}
|
|
3407
|
-
calculateParamsKey(
|
|
3408
|
-
return
|
|
3407
|
+
calculateParamsKey(o) {
|
|
3408
|
+
return Vs(o);
|
|
3409
3409
|
}
|
|
3410
3410
|
}(this.pFrames);
|
|
3411
3411
|
}
|
|
@@ -3413,11 +3413,11 @@ class Io {
|
|
|
3413
3413
|
// Internal / Config API Methods
|
|
3414
3414
|
//
|
|
3415
3415
|
createPFrame(e, t) {
|
|
3416
|
-
const r = e.map((n) =>
|
|
3417
|
-
return t.addOnDestroy(
|
|
3416
|
+
const r = e.map((n) => Q(n, (i) => Jo(i))), o = this.pFrames.acquire(r);
|
|
3417
|
+
return t.addOnDestroy(o.unref), o.key;
|
|
3418
3418
|
}
|
|
3419
3419
|
createPTable(e, t) {
|
|
3420
|
-
const r = this.createPFrame(
|
|
3420
|
+
const r = this.createPFrame(Ls(e.src), t), o = ht(e, (i) => i.id), n = this.pTables.acquire({ def: o, pFrameHandle: r });
|
|
3421
3421
|
return t.addOnDestroy(n.unref), n.key;
|
|
3422
3422
|
}
|
|
3423
3423
|
//
|
|
@@ -3431,7 +3431,7 @@ class Io {
|
|
|
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((o) => o.hit)
|
|
3435
3435
|
};
|
|
3436
3436
|
}
|
|
3437
3437
|
async getColumnSpec(e, t) {
|
|
@@ -3447,7 +3447,7 @@ class Io {
|
|
|
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: Z(t.src),
|
|
3451
3451
|
filters: t.filters
|
|
3452
3452
|
})
|
|
3453
3453
|
);
|
|
@@ -3457,10 +3457,10 @@ class Io {
|
|
|
3457
3457
|
);
|
|
3458
3458
|
r.dispose(), r = i;
|
|
3459
3459
|
}
|
|
3460
|
-
const
|
|
3461
|
-
async () => await r.getData([...
|
|
3460
|
+
const o = r.getSpec(), n = await this.concurrencyLimiter.run(
|
|
3461
|
+
async () => await r.getData([...o.keys()])
|
|
3462
3462
|
);
|
|
3463
|
-
return r.dispose(),
|
|
3463
|
+
return r.dispose(), o.map((i, a) => ({
|
|
3464
3464
|
spec: i,
|
|
3465
3465
|
data: n[a]
|
|
3466
3466
|
}));
|
|
@@ -3480,105 +3480,105 @@ class Io {
|
|
|
3480
3480
|
return (await this.pTables.getByKey(e)).getSpec();
|
|
3481
3481
|
}
|
|
3482
3482
|
async getData(e, t, r) {
|
|
3483
|
-
const
|
|
3483
|
+
const o = await this.pTables.getByKey(e);
|
|
3484
3484
|
return await this.concurrencyLimiter.run(
|
|
3485
|
-
async () => await
|
|
3485
|
+
async () => await o.getData(t, r)
|
|
3486
3486
|
);
|
|
3487
3487
|
}
|
|
3488
3488
|
}
|
|
3489
|
-
function
|
|
3490
|
-
switch (
|
|
3489
|
+
function Z(s) {
|
|
3490
|
+
switch (s.type) {
|
|
3491
3491
|
case "column":
|
|
3492
3492
|
return {
|
|
3493
3493
|
type: "column",
|
|
3494
|
-
columnId:
|
|
3494
|
+
columnId: s.column,
|
|
3495
3495
|
qualifications: []
|
|
3496
3496
|
};
|
|
3497
3497
|
case "inner":
|
|
3498
3498
|
case "full":
|
|
3499
3499
|
return {
|
|
3500
|
-
type:
|
|
3501
|
-
entries:
|
|
3500
|
+
type: s.type,
|
|
3501
|
+
entries: s.entries.map((e) => Z(e))
|
|
3502
3502
|
};
|
|
3503
3503
|
case "outer":
|
|
3504
3504
|
return {
|
|
3505
3505
|
type: "outer",
|
|
3506
|
-
primary:
|
|
3507
|
-
secondary:
|
|
3506
|
+
primary: Z(s.primary),
|
|
3507
|
+
secondary: s.secondary.map((e) => Z(e))
|
|
3508
3508
|
};
|
|
3509
3509
|
default:
|
|
3510
|
-
D(
|
|
3510
|
+
D(s);
|
|
3511
3511
|
}
|
|
3512
3512
|
}
|
|
3513
|
-
function
|
|
3514
|
-
const e =
|
|
3515
|
-
return e.update(
|
|
3513
|
+
function Vs(s) {
|
|
3514
|
+
const e = ge("sha256");
|
|
3515
|
+
return e.update(s.pFrameHandle), e.update(Ie(s.def)), e.digest().toString("hex");
|
|
3516
3516
|
}
|
|
3517
|
-
function
|
|
3518
|
-
const e =
|
|
3517
|
+
function Ns(s) {
|
|
3518
|
+
const e = s.map((o) => o.id).sort(), t = ge("sha256");
|
|
3519
3519
|
let r = "";
|
|
3520
|
-
for (const
|
|
3521
|
-
r !==
|
|
3520
|
+
for (const o of e)
|
|
3521
|
+
r !== o && (t.update(o), r = o);
|
|
3522
3522
|
return t.digest().toString("hex");
|
|
3523
3523
|
}
|
|
3524
|
-
function
|
|
3524
|
+
function Ls(s) {
|
|
3525
3525
|
const e = /* @__PURE__ */ new Map();
|
|
3526
|
-
return
|
|
3526
|
+
return ae(s, e), [...e.values()];
|
|
3527
3527
|
}
|
|
3528
|
-
function
|
|
3529
|
-
switch (
|
|
3528
|
+
function ae(s, e) {
|
|
3529
|
+
switch (s.type) {
|
|
3530
3530
|
case "column":
|
|
3531
|
-
e.set(
|
|
3531
|
+
e.set(s.column.id, s.column);
|
|
3532
3532
|
return;
|
|
3533
3533
|
case "full":
|
|
3534
3534
|
case "inner":
|
|
3535
|
-
for (const t of
|
|
3535
|
+
for (const t of s.entries) ae(t, e);
|
|
3536
3536
|
return;
|
|
3537
3537
|
case "outer":
|
|
3538
|
-
|
|
3539
|
-
for (const t of
|
|
3538
|
+
ae(s.primary, e);
|
|
3539
|
+
for (const t of s.secondary) ae(t, e);
|
|
3540
3540
|
return;
|
|
3541
3541
|
default:
|
|
3542
|
-
D(
|
|
3542
|
+
D(s);
|
|
3543
3543
|
}
|
|
3544
3544
|
}
|
|
3545
|
-
async function
|
|
3545
|
+
async function Js(s, e, t) {
|
|
3546
3546
|
const r = {
|
|
3547
3547
|
...Ht,
|
|
3548
3548
|
..._t(e),
|
|
3549
3549
|
...t
|
|
3550
|
-
},
|
|
3550
|
+
}, o = new vt(r.localSecret), n = Sr(r.logger, s, r.localProjections), i = kr(s, r.logger), a = Cr(s, r.logger), c = Pr(s, r.logger), u = new Fr(
|
|
3551
3551
|
r.logger,
|
|
3552
3552
|
n,
|
|
3553
3553
|
i,
|
|
3554
3554
|
r.blobDownloadPath,
|
|
3555
|
-
|
|
3555
|
+
o,
|
|
3556
3556
|
r.blobDriverOps
|
|
3557
3557
|
), l = new Rr(
|
|
3558
3558
|
r.logger,
|
|
3559
|
-
|
|
3559
|
+
o,
|
|
3560
3560
|
a,
|
|
3561
3561
|
c,
|
|
3562
3562
|
r.uploadDriverOps
|
|
3563
|
-
), p = new Br(r.logger, i, r.logStreamDriverOps), g = new Or(r.logger, p, u),
|
|
3563
|
+
), p = new Br(r.logger, i, r.logStreamDriverOps), g = new Or(r.logger, p, u), f = await Dr.init(
|
|
3564
3564
|
r.logger,
|
|
3565
|
-
o,
|
|
3566
3565
|
s,
|
|
3566
|
+
o,
|
|
3567
3567
|
r.localProjections,
|
|
3568
3568
|
r.openFileDialogCallback,
|
|
3569
3569
|
r.virtualLocalStoragesOverride
|
|
3570
|
-
),
|
|
3570
|
+
), b = new Is(u);
|
|
3571
3571
|
return {
|
|
3572
3572
|
blobDriver: u,
|
|
3573
3573
|
logDriver: g,
|
|
3574
|
-
lsDriver:
|
|
3575
|
-
signer:
|
|
3574
|
+
lsDriver: f,
|
|
3575
|
+
signer: o,
|
|
3576
3576
|
uploadDriver: l,
|
|
3577
|
-
pFrameDriver:
|
|
3577
|
+
pFrameDriver: b
|
|
3578
3578
|
};
|
|
3579
3579
|
}
|
|
3580
3580
|
class Wt {
|
|
3581
|
-
constructor(e, t, r,
|
|
3581
|
+
constructor(e, t, r, o, 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 Wt {
|
|
|
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 = o, 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 Wt {
|
|
|
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 n = await
|
|
3602
|
-
return
|
|
3599
|
+
async createProject(e, t = X()) {
|
|
3600
|
+
const r = await this.pl.withWriteTx("MLCreateProject", async (o) => {
|
|
3601
|
+
const n = await To(o, e);
|
|
3602
|
+
return o.createField(S(this.projectListResourceId, t), "Dynamic", n), await o.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 (o) => {
|
|
3609
|
+
o.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 Wt {
|
|
|
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 (ce(r)) throw new Error("Unexpected project list structure.");
|
|
3623
3623
|
return r;
|
|
3624
3624
|
});
|
|
3625
3625
|
}
|
|
@@ -3630,7 +3630,7 @@ class Wt {
|
|
|
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 $e.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) {
|
|
@@ -3662,61 +3662,61 @@ class Wt {
|
|
|
3662
3662
|
}
|
|
3663
3663
|
/** Initialize middle layer */
|
|
3664
3664
|
static async init(e, t, r) {
|
|
3665
|
-
const
|
|
3666
|
-
...
|
|
3667
|
-
...
|
|
3665
|
+
const o = {
|
|
3666
|
+
...Ds,
|
|
3667
|
+
...xs(t),
|
|
3668
3668
|
...r
|
|
3669
3669
|
};
|
|
3670
|
-
process.env.MI_LOG_TREE_STAT && (
|
|
3670
|
+
process.env.MI_LOG_TREE_STAT && (o.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
|
|
3671
3671
|
const n = await e.withWriteTx("MLInitialization", async (C) => {
|
|
3672
3672
|
const I = S(C.clientRoot, Zr);
|
|
3673
3673
|
C.createField(I, "Dynamic");
|
|
3674
3674
|
const G = await C.getField(I);
|
|
3675
|
-
if (
|
|
3676
|
-
const
|
|
3677
|
-
return C.lock(
|
|
3675
|
+
if (ce(G.value)) {
|
|
3676
|
+
const K = C.createEphemeral(Bt);
|
|
3677
|
+
return C.lock(K), C.setField(I, K), await C.commit(), await K.globalId;
|
|
3678
3678
|
} else
|
|
3679
3679
|
return G.value;
|
|
3680
|
-
}), i =
|
|
3680
|
+
}), i = o.logger, a = await Js(e, t, o), c = new Xt(e.httpDispatcher, {
|
|
3681
3681
|
minTimeout: 250,
|
|
3682
3682
|
maxRetries: 4
|
|
3683
|
-
}), u = new Mr(c), l = new
|
|
3683
|
+
}), u = new Mr(c), l = new Po(
|
|
3684
3684
|
u,
|
|
3685
3685
|
a.signer,
|
|
3686
3686
|
c
|
|
3687
3687
|
), p = new xr(
|
|
3688
3688
|
i,
|
|
3689
3689
|
e.httpDispatcher,
|
|
3690
|
-
|
|
3690
|
+
o.frontendDownloadPath
|
|
3691
3691
|
), g = {
|
|
3692
3692
|
pl: e,
|
|
3693
3693
|
signer: a.signer,
|
|
3694
3694
|
logger: i,
|
|
3695
3695
|
httpDispatcher: e.httpDispatcher,
|
|
3696
3696
|
retryHttpDispatcher: c,
|
|
3697
|
-
ops:
|
|
3697
|
+
ops: o,
|
|
3698
3698
|
bpPreparer: l,
|
|
3699
3699
|
frontendDownloadDriver: p,
|
|
3700
3700
|
driverKit: a,
|
|
3701
|
-
blockUpdateWatcher: new
|
|
3702
|
-
minDelay:
|
|
3701
|
+
blockUpdateWatcher: new Es(u, i, {
|
|
3702
|
+
minDelay: o.devBlockUpdateRecheckInterval,
|
|
3703
3703
|
http: c
|
|
3704
3704
|
}),
|
|
3705
3705
|
quickJs: await wr()
|
|
3706
|
-
},
|
|
3706
|
+
}, f = new vr([]), b = await eo(e, n, f, g);
|
|
3707
3707
|
return new Wt(
|
|
3708
3708
|
g,
|
|
3709
3709
|
a,
|
|
3710
3710
|
a.signer,
|
|
3711
3711
|
n,
|
|
3712
|
-
|
|
3713
|
-
|
|
3712
|
+
f,
|
|
3713
|
+
b.tree,
|
|
3714
3714
|
u,
|
|
3715
|
-
|
|
3715
|
+
b.computable
|
|
3716
3716
|
);
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
|
-
async function
|
|
3719
|
+
async function mn(s, e = {}) {
|
|
3720
3720
|
const t = {
|
|
3721
3721
|
pingCheckDurationMs: 1e4,
|
|
3722
3722
|
pingTimeoutMs: 3e3,
|
|
@@ -3733,25 +3733,19 @@ async function fn(o, e = {}) {
|
|
|
3733
3733
|
plPings: [],
|
|
3734
3734
|
blockRegistryChecks: [],
|
|
3735
3735
|
autoUpdateCdnChecks: []
|
|
3736
|
-
},
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
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(
|
|
3736
|
+
}, o = hr(s, { defaultRequestTimeout: t.pingTimeoutMs });
|
|
3737
|
+
r.plPings = await Se(t.pingCheckDurationMs, t.maxPingsPerSecond, async () => {
|
|
3738
|
+
const c = await new Qe(o).ping();
|
|
3739
|
+
return JSON.stringify(c).slice(0, 100) + "...";
|
|
3740
|
+
});
|
|
3741
|
+
const i = new Qe(o).ll.httpDispatcher;
|
|
3742
|
+
return r.blockRegistryChecks = await Se(
|
|
3750
3743
|
t.blockRegistryDurationMs,
|
|
3751
3744
|
t.maxRegistryChecksPerSecond,
|
|
3752
3745
|
async () => {
|
|
3753
3746
|
const { body: a, statusCode: c } = await M(t.blockRegistryUrl, {
|
|
3754
3747
|
dispatcher: i,
|
|
3748
|
+
headersTimeout: t.httpTimeoutMs,
|
|
3755
3749
|
bodyTimeout: t.httpTimeoutMs
|
|
3756
3750
|
}), u = await a.text();
|
|
3757
3751
|
return {
|
|
@@ -3759,12 +3753,13 @@ async function fn(o, e = {}) {
|
|
|
3759
3753
|
beginningOfBody: u.slice(0, 100) + "..."
|
|
3760
3754
|
};
|
|
3761
3755
|
}
|
|
3762
|
-
), r.autoUpdateCdnChecks = await
|
|
3756
|
+
), r.autoUpdateCdnChecks = await Se(
|
|
3763
3757
|
t.autoUpdateCdnDurationMs,
|
|
3764
3758
|
t.maxAutoUpdateCdnChecksPerSecond,
|
|
3765
3759
|
async () => {
|
|
3766
3760
|
const { body: a, statusCode: c } = await M(t.autoUpdateCdnUrl, {
|
|
3767
3761
|
dispatcher: i,
|
|
3762
|
+
headersTimeout: t.httpTimeoutMs,
|
|
3768
3763
|
bodyTimeout: t.httpTimeoutMs
|
|
3769
3764
|
}), u = await a.text();
|
|
3770
3765
|
return {
|
|
@@ -3772,112 +3767,109 @@ async function fn(o, e = {}) {
|
|
|
3772
3767
|
beginningOfBody: u.slice(0, 100) + "..."
|
|
3773
3768
|
};
|
|
3774
3769
|
}
|
|
3775
|
-
),
|
|
3770
|
+
), Ms(r, s, t);
|
|
3776
3771
|
}
|
|
3777
|
-
async function
|
|
3778
|
-
const r =
|
|
3779
|
-
for (;
|
|
3780
|
-
const n =
|
|
3772
|
+
async function Se(s, e, t) {
|
|
3773
|
+
const r = Ee(), o = [];
|
|
3774
|
+
for (; gt(r) < s; ) {
|
|
3775
|
+
const n = Ee();
|
|
3776
|
+
let i;
|
|
3781
3777
|
try {
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
response: { ok: !0, value: i }
|
|
3786
|
-
});
|
|
3787
|
-
} catch (i) {
|
|
3788
|
-
s.push({
|
|
3789
|
-
elapsedMs: Q(n),
|
|
3790
|
-
response: { ok: !1, error: i }
|
|
3791
|
-
});
|
|
3778
|
+
i = { ok: !0, value: await t() };
|
|
3779
|
+
} catch (u) {
|
|
3780
|
+
i = { ok: !1, error: u };
|
|
3792
3781
|
}
|
|
3793
|
-
|
|
3782
|
+
const a = gt(n);
|
|
3783
|
+
o.push({
|
|
3784
|
+
elapsedMs: a,
|
|
3785
|
+
response: i
|
|
3786
|
+
});
|
|
3787
|
+
const c = 1e3 / e - a;
|
|
3788
|
+
c > 0 && await kt(c);
|
|
3794
3789
|
}
|
|
3795
|
-
return
|
|
3790
|
+
return o;
|
|
3796
3791
|
}
|
|
3797
|
-
function
|
|
3798
|
-
const r =
|
|
3792
|
+
function Ms(s, e, t) {
|
|
3793
|
+
const r = s.plPings.filter((i) => i.response.ok), o = s.plPings.filter((i) => !i.response.ok), n = [
|
|
3794
|
+
...new Set(r.map((i) => JSON.stringify(i.response.value)))
|
|
3795
|
+
];
|
|
3799
3796
|
return `
|
|
3800
3797
|
Network report:
|
|
3801
3798
|
pl endpoint: ${e};
|
|
3802
3799
|
options: ${JSON.stringify(t, null, 2)}.
|
|
3803
3800
|
|
|
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};
|
|
3801
|
+
Platforma pings: ${ke(s.plPings)}
|
|
3810
3802
|
|
|
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};
|
|
3803
|
+
Block registry responses: ${ke(s.blockRegistryChecks)}
|
|
3817
3804
|
|
|
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};
|
|
3805
|
+
Auto-update CDN responses: ${ke(s.autoUpdateCdnChecks)}
|
|
3824
3806
|
|
|
3825
3807
|
Block registry dumps:
|
|
3826
|
-
${JSON.stringify(
|
|
3808
|
+
${JSON.stringify(s.blockRegistryChecks, null, 2)}
|
|
3827
3809
|
|
|
3828
3810
|
Auto-update CDN dumps:
|
|
3829
|
-
${JSON.stringify(
|
|
3811
|
+
${JSON.stringify(s.autoUpdateCdnChecks, null, 2)}
|
|
3830
3812
|
|
|
3831
3813
|
Platforma pings error dumps:
|
|
3832
|
-
${JSON.stringify(
|
|
3814
|
+
${JSON.stringify(o, null, 2)}
|
|
3833
3815
|
|
|
3834
3816
|
Platforma pings success dump examples:
|
|
3835
|
-
${JSON.stringify(
|
|
3817
|
+
${JSON.stringify(n, null, 2)}
|
|
3818
|
+
`;
|
|
3819
|
+
}
|
|
3820
|
+
function ke(s) {
|
|
3821
|
+
const e = s.filter((o) => o.response.ok), { mean: t, median: r } = Ks(s);
|
|
3822
|
+
return `
|
|
3823
|
+
total: ${s.length};
|
|
3824
|
+
successes: ${e.length};
|
|
3825
|
+
errors: ${s.length - e.length};
|
|
3826
|
+
mean in ms: ${t};
|
|
3827
|
+
median in ms: ${r};
|
|
3836
3828
|
`;
|
|
3837
3829
|
}
|
|
3838
|
-
function
|
|
3839
|
-
const e =
|
|
3830
|
+
function Ks(s) {
|
|
3831
|
+
const e = s.map((o) => o.elapsedMs), t = e.reduce((o, n) => o + n) / e.length;
|
|
3840
3832
|
let r;
|
|
3841
3833
|
if (e.length > 0) {
|
|
3842
|
-
const
|
|
3843
|
-
r = e.length % 2 ? e[
|
|
3834
|
+
const o = Math.floor(e.length / 2);
|
|
3835
|
+
r = e.length % 2 ? e[o] : (e[o - 1] + e[o]) / 2;
|
|
3844
3836
|
}
|
|
3845
3837
|
return { mean: t, median: r };
|
|
3846
3838
|
}
|
|
3847
|
-
function
|
|
3839
|
+
function Ee() {
|
|
3848
3840
|
return Date.now();
|
|
3849
3841
|
}
|
|
3850
|
-
function
|
|
3851
|
-
return
|
|
3842
|
+
function gt(s) {
|
|
3843
|
+
return Ee() - s;
|
|
3852
3844
|
}
|
|
3853
3845
|
export {
|
|
3854
|
-
|
|
3855
|
-
|
|
3846
|
+
pn as BlockPackRegistry,
|
|
3847
|
+
gn as CentralBlockRegistry,
|
|
3856
3848
|
_t as DefaultDriverKitOpsPaths,
|
|
3857
3849
|
Ht as DefaultDriverKitOpsSettings,
|
|
3858
|
-
|
|
3859
|
-
|
|
3850
|
+
xs as DefaultMiddleLayerOpsPaths,
|
|
3851
|
+
Ds as DefaultMiddleLayerOpsSettings,
|
|
3860
3852
|
xt as FrontendFromFolderResourceType,
|
|
3861
3853
|
Dt as FrontendFromUrlResourceType,
|
|
3862
3854
|
Wt as MiddleLayer,
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3855
|
+
$e as Project,
|
|
3856
|
+
lo as TengoTemplateGet,
|
|
3857
|
+
po as TengoTemplateGetRegistry,
|
|
3858
|
+
ho as TengoTemplateGetTemplate,
|
|
3859
|
+
go as TengoTemplateGetTemplateURI,
|
|
3860
|
+
fo as TengoTemplatePack,
|
|
3861
|
+
mo as TengoTemplatePackConvert,
|
|
3862
|
+
yo as TengoTemplatePackConvertTemplate,
|
|
3863
|
+
vo as TengoTemplatePackConvertTemplatePack,
|
|
3864
|
+
fn as V1CentralDevSnapshotRegistry,
|
|
3865
|
+
hn as V1CentralRegistry,
|
|
3874
3866
|
Mr as V2RegistryProvider,
|
|
3875
|
-
|
|
3867
|
+
mn as checkNetwork,
|
|
3876
3868
|
Ot as createRenderTemplate,
|
|
3877
3869
|
Pt as getDevV1PacketMtime,
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3870
|
+
Le as getDevV2PacketMtime,
|
|
3871
|
+
Js as initDriverKit,
|
|
3872
|
+
Me as loadTemplate,
|
|
3873
|
+
bo as prepareTemplateSpec
|
|
3882
3874
|
};
|
|
3883
3875
|
//# sourceMappingURL=index.mjs.map
|