@milaboratories/pl-middle-layer 1.15.6 → 1.15.7
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/cfg_render/executor.d.ts.map +1 -1
- package/dist/cfg_render/renderer.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1067 -1067
- package/dist/index.mjs.map +1 -1
- package/dist/js_render/context.d.ts.map +1 -1
- package/dist/js_render/index.d.ts.map +1 -1
- package/dist/middle_layer/block.d.ts +2 -2
- package/dist/middle_layer/block.d.ts.map +1 -1
- package/dist/middle_layer/block_ctx.d.ts +5 -5
- package/dist/middle_layer/block_ctx.d.ts.map +1 -1
- package/dist/middle_layer/block_ctx_unsafe.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/cfg_render/executor.ts +8 -4
- package/src/cfg_render/renderer.ts +1 -4
- package/src/js_render/context.ts +5 -7
- package/src/js_render/index.ts +10 -3
- package/src/middle_layer/active_cfg.ts +1 -1
- package/src/middle_layer/block.ts +23 -21
- package/src/middle_layer/block_ctx.ts +18 -16
- package/src/middle_layer/block_ctx_unsafe.ts +5 -2
- package/src/middle_layer/project_overview.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (
|
|
4
|
-
import { mapValueInVOE as yt, executePSpecPredicate as
|
|
1
|
+
var Xt = Object.defineProperty;
|
|
2
|
+
var er = (o, e, t) => e in o ? Xt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var p = (o, e, t) => er(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { mapValueInVOE as yt, executePSpecPredicate as tr, mapPObjectData as X, mapPTableDef as bt, extractConfig as ye, isConfigLambda as wt, DefaultNavigationState as rr } from "@platforma-sdk/model";
|
|
5
5
|
export * from "@platforma-sdk/model";
|
|
6
|
-
import { blockPackIdEquals as
|
|
6
|
+
import { blockPackIdEquals as Ce } from "@milaboratories/pl-model-middle-layer";
|
|
7
7
|
export * from "@milaboratories/pl-model-middle-layer";
|
|
8
|
-
import { request as K, RetryAgent as
|
|
9
|
-
import { RegistryV1 as W, tryLoadPackDescription as
|
|
10
|
-
import
|
|
8
|
+
import { request as K, RetryAgent as or } from "undici";
|
|
9
|
+
import { RegistryV1 as W, tryLoadPackDescription as Oe, BlockPackMetaEmbedAbsoluteBytes as sr, RegistryV2Reader as ir, folderReaderByUrl as nr, loadPackDescription as Xe } from "@platforma-sdk/block-tools";
|
|
10
|
+
import I from "node:fs";
|
|
11
11
|
import x from "node:path";
|
|
12
|
-
import
|
|
13
|
-
import { assertNever as D, notEmpty as
|
|
12
|
+
import ar from "yaml";
|
|
13
|
+
import { assertNever as D, notEmpty as k, ConsoleLoggerAdapter as cr, ConcurrencyLimitingExecutor as ur, HmacSha256Signer as St } from "@milaboratories/ts-helpers";
|
|
14
14
|
import * as kt from "node:fs/promises";
|
|
15
|
-
import { tryResolve as
|
|
16
|
-
import { resourceTypesEqual as G, field as w, Pl as b, PlClient as
|
|
15
|
+
import { tryResolve as lr } from "@milaboratories/resolve-helper";
|
|
16
|
+
import { resourceTypesEqual as G, field as w, Pl as b, PlClient as dr, isNullResourceId as he, ensureResourceIdNotNull as De, isResource as pr, isResourceRef as gr, isNotNullResourceId as et, resourceType as ae, resourceTypeToString as hr, resourceIdToString as Ct, isNotFoundError as fr, isTimeoutOrCancelError as mr, toGlobalResourceId as vr, plAddressToConfig as yr, UnauthenticatedPlClient as tt } from "@milaboratories/pl-client";
|
|
17
17
|
export * from "@milaboratories/pl-client";
|
|
18
|
-
import { SynchronizedTreeState as Pt, PlError as
|
|
19
|
-
import { Computable as R, ChangeSource as
|
|
20
|
-
import { randomUUID as se, createHash as
|
|
18
|
+
import { SynchronizedTreeState as Pt, PlError as br } from "@milaboratories/pl-tree";
|
|
19
|
+
import { Computable as R, ChangeSource as rt, PollComputablePool as wr, WatchableValue as Sr } from "@milaboratories/computable";
|
|
20
|
+
import { randomUUID as se, createHash as be } from "node:crypto";
|
|
21
21
|
import Rt from "denque";
|
|
22
|
-
import { Templates as
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import { Scope as
|
|
22
|
+
import { Templates as kr } from "@platforma-sdk/workflow-tengo";
|
|
23
|
+
import Ue from "canonicalize";
|
|
24
|
+
import Cr from "node:assert";
|
|
25
|
+
import { Scope as xe, getQuickJS as Pr } from "quickjs-emscripten";
|
|
26
26
|
import { setTimeout as Ft } from "node:timers/promises";
|
|
27
|
-
import { createDownloadClient as
|
|
28
|
-
import { PFrame as
|
|
29
|
-
import { LRUCache as
|
|
30
|
-
import { channel as
|
|
31
|
-
async function
|
|
27
|
+
import { createDownloadClient as Rr, createLogsClient as Fr, createUploadBlobClient as Br, createUploadProgressClient as Or, DownloadDriver as Dr, UploadDriver as xr, LogsStreamDriver as Ar, LogsDriver as Tr, LsDriver as jr, DownloadUrlDriver as Er } from "@milaboratories/pl-drivers";
|
|
28
|
+
import { PFrame as Ir } from "@milaboratories/pframes-node";
|
|
29
|
+
import { LRUCache as Nr } from "lru-cache";
|
|
30
|
+
import { channel as Vr } from "node:diagnostics_channel";
|
|
31
|
+
async function ot(o) {
|
|
32
32
|
try {
|
|
33
|
-
return await kt.stat(
|
|
33
|
+
return await kt.stat(o, { bigint: !0 });
|
|
34
34
|
} catch (e) {
|
|
35
35
|
if (e.code === "ENOENT")
|
|
36
36
|
return;
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
Ue,
|
|
40
|
+
const Lr = [W.PlPackageYamlConfigFile], Jr = [W.PlPackageJsonConfigFile], Me = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], $e = ["config", "dist", "config.json"], Bt = ["frontend", "dist"], st = "block-model/dist/config.json", Ur = "block-ui/package.json", Mr = [
|
|
42
41
|
Me,
|
|
43
|
-
|
|
42
|
+
$e,
|
|
44
43
|
Lr,
|
|
44
|
+
Jr,
|
|
45
45
|
Bt
|
|
46
46
|
];
|
|
47
|
-
async function
|
|
48
|
-
return await
|
|
47
|
+
async function $r(o) {
|
|
48
|
+
return await ot(x.join(o, ...$e)) !== void 0 || await ot(x.join(o, ...Me)) !== void 0;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const t =
|
|
52
|
-
if (t === void 0) throw new Error(`Can't resolve ${e} against ${
|
|
50
|
+
function Pe(o, e) {
|
|
51
|
+
const t = lr(o, e);
|
|
52
|
+
if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
|
|
53
53
|
return t;
|
|
54
54
|
}
|
|
55
|
-
async function
|
|
56
|
-
if (x.isAbsolute(
|
|
55
|
+
async function it(o, e) {
|
|
56
|
+
if (x.isAbsolute(o) || (o = x.resolve(o)), await $r(o))
|
|
57
57
|
return {
|
|
58
|
-
workflow: x.join(
|
|
59
|
-
config: x.join(
|
|
60
|
-
ui: x.join(
|
|
58
|
+
workflow: x.join(o, ...Me),
|
|
59
|
+
config: x.join(o, ...$e),
|
|
60
|
+
ui: x.join(o, ...Bt)
|
|
61
61
|
};
|
|
62
62
|
{
|
|
63
|
-
const t =
|
|
64
|
-
return { workflow: t, config: r, ui: x.resolve(
|
|
63
|
+
const t = Pe(o, st), r = Pe(o, st), s = Pe(o, Ur);
|
|
64
|
+
return { workflow: t, config: r, ui: x.resolve(s, "..", "dist") };
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
async function
|
|
67
|
+
async function Kr(o) {
|
|
68
68
|
try {
|
|
69
|
-
return await
|
|
69
|
+
return await I.promises.readFile(o, "utf8");
|
|
70
70
|
} catch (e) {
|
|
71
71
|
if (e.code === "ENOENT")
|
|
72
72
|
return;
|
|
73
73
|
throw e;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
async function
|
|
76
|
+
async function Gr(o) {
|
|
77
77
|
try {
|
|
78
|
-
return await
|
|
78
|
+
return await I.promises.stat(o, { bigint: !0 });
|
|
79
79
|
} catch (e) {
|
|
80
80
|
if (e.code === "ENOENT")
|
|
81
81
|
return;
|
|
82
82
|
throw e;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
async function Ot(
|
|
85
|
+
async function Ot(o) {
|
|
86
86
|
let e = 0n;
|
|
87
|
-
for (const t of
|
|
88
|
-
const r = x.join(
|
|
89
|
-
|
|
87
|
+
for (const t of Mr) {
|
|
88
|
+
const r = x.join(o, ...t), s = await Gr(r);
|
|
89
|
+
s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
|
|
90
90
|
}
|
|
91
91
|
return e.toString();
|
|
92
92
|
}
|
|
93
|
-
async function
|
|
94
|
-
const e = await
|
|
93
|
+
async function Ke(o) {
|
|
94
|
+
const e = await I.promises.stat(o.components.workflow.main.file, {
|
|
95
95
|
bigint: !0
|
|
96
|
-
}), t = await
|
|
96
|
+
}), t = await I.promises.stat(o.components.model.file, { bigint: !0 });
|
|
97
97
|
return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
|
|
98
98
|
}
|
|
99
99
|
class bi {
|
|
@@ -104,9 +104,9 @@ class bi {
|
|
|
104
104
|
const t = [], r = e.spec;
|
|
105
105
|
switch (r.type) {
|
|
106
106
|
case "remote-v1":
|
|
107
|
-
const
|
|
107
|
+
const s = this.http !== void 0 ? { dispatcher: this.http } : {}, n = await (await K(
|
|
108
108
|
`${r.url}/${W.GlobalOverviewPath}`,
|
|
109
|
-
|
|
109
|
+
s
|
|
110
110
|
)).body.json();
|
|
111
111
|
for (const a of n) {
|
|
112
112
|
const { organization: c, package: u, latestMeta: l, latestVersion: d } = a, g = {
|
|
@@ -140,13 +140,13 @@ class bi {
|
|
|
140
140
|
registryId: e.id
|
|
141
141
|
}));
|
|
142
142
|
case "local-dev":
|
|
143
|
-
for (const a of await
|
|
143
|
+
for (const a of await I.promises.readdir(r.path, { withFileTypes: !0 })) {
|
|
144
144
|
if (!a.isDirectory()) continue;
|
|
145
|
-
const c = x.join(r.path, a.name), u = await
|
|
145
|
+
const c = x.join(r.path, a.name), u = await Kr(
|
|
146
146
|
x.join(c, W.PlPackageYamlConfigFile)
|
|
147
147
|
);
|
|
148
148
|
if (u !== void 0) {
|
|
149
|
-
const l = W.PlPackageConfigData.parse(
|
|
149
|
+
const l = W.PlPackageConfigData.parse(ar.parse(u)), d = await Ot(c), g = {
|
|
150
150
|
organization: l.organization,
|
|
151
151
|
name: l.package,
|
|
152
152
|
version: "DEV"
|
|
@@ -170,17 +170,17 @@ class bi {
|
|
|
170
170
|
otherVersions: []
|
|
171
171
|
});
|
|
172
172
|
} else {
|
|
173
|
-
let l = c, d = await
|
|
173
|
+
let l = c, d = await Oe(l);
|
|
174
174
|
if (d === void 0) {
|
|
175
175
|
for (const g of ["block", "meta"])
|
|
176
|
-
if (l = x.join(c, g), d = await
|
|
176
|
+
if (l = x.join(c, g), d = await Oe(l), d !== void 0) break;
|
|
177
177
|
}
|
|
178
178
|
if (d !== void 0) {
|
|
179
|
-
const g = await
|
|
179
|
+
const g = await Ke(d);
|
|
180
180
|
t.push({
|
|
181
181
|
registryId: e.id,
|
|
182
182
|
id: d.id,
|
|
183
|
-
meta: await
|
|
183
|
+
meta: await sr.parseAsync(d.meta),
|
|
184
184
|
spec: {
|
|
185
185
|
type: "dev-v2",
|
|
186
186
|
folder: l,
|
|
@@ -203,7 +203,7 @@ class bi {
|
|
|
203
203
|
return { registries: t, blockPacks: e };
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
class
|
|
206
|
+
class _r {
|
|
207
207
|
constructor(e) {
|
|
208
208
|
p(this, "registries", /* @__PURE__ */ new Map());
|
|
209
209
|
this.http = e;
|
|
@@ -211,7 +211,7 @@ class Gr {
|
|
|
211
211
|
getRegistry(e) {
|
|
212
212
|
const t = this.registries.get(e);
|
|
213
213
|
if (t) return t;
|
|
214
|
-
const r = new
|
|
214
|
+
const r = new ir(nr(e, this.http));
|
|
215
215
|
return this.registries.set(e, r), r;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -224,150 +224,150 @@ const wi = {
|
|
|
224
224
|
}, ki = {
|
|
225
225
|
type: "remote-v1",
|
|
226
226
|
url: "https://block.registry.platforma.bio/dev"
|
|
227
|
-
}, _r = {
|
|
228
|
-
groups: [{ id: "default", label: "Default", blocks: [] }]
|
|
229
227
|
}, Hr = {
|
|
228
|
+
groups: [{ id: "default", label: "Default", blocks: [] }]
|
|
229
|
+
}, Wr = {
|
|
230
230
|
stagingRefreshTimestamp: 0,
|
|
231
231
|
blocksInLimbo: []
|
|
232
|
-
},
|
|
232
|
+
}, zr = {
|
|
233
233
|
label: "New Project"
|
|
234
|
-
},
|
|
235
|
-
function
|
|
236
|
-
return `${
|
|
234
|
+
}, qr = { name: "UserProject", version: "2" }, Dt = "SchemaVersion", xt = "1", Ge = "ProjectCreated", ie = "ProjectLastModified", ne = "ProjectMeta", z = "ProjectStructure", fe = "BlockRenderingState", Yr = "BlockFrontendState/", Qr = /^BlockFrontendState\/(?<blockid>.*)$/;
|
|
235
|
+
function Ae(o) {
|
|
236
|
+
return `${Yr}${o}`;
|
|
237
237
|
}
|
|
238
|
-
const
|
|
239
|
-
function
|
|
240
|
-
return `${
|
|
238
|
+
const Zr = "BlockArgsAuthor/";
|
|
239
|
+
function Te(o) {
|
|
240
|
+
return `${Zr}${o}`;
|
|
241
241
|
}
|
|
242
242
|
const je = "ProjectStructureAuthor";
|
|
243
|
-
function
|
|
244
|
-
const e =
|
|
243
|
+
function Xr(o) {
|
|
244
|
+
const e = o.match(Qr);
|
|
245
245
|
if (e !== null)
|
|
246
246
|
return e.groups.blockid;
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
function
|
|
250
|
-
return `${
|
|
248
|
+
const eo = "__serviceTemplate_";
|
|
249
|
+
function Ee(o) {
|
|
250
|
+
return `${eo}${o}`;
|
|
251
251
|
}
|
|
252
|
-
function P(
|
|
253
|
-
return `${
|
|
252
|
+
function P(o, e) {
|
|
253
|
+
return `${o}-${e}`;
|
|
254
254
|
}
|
|
255
|
-
const
|
|
256
|
-
function
|
|
257
|
-
const e =
|
|
255
|
+
const to = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
|
|
256
|
+
function ro(o) {
|
|
257
|
+
const e = o.match(to);
|
|
258
258
|
if (e === null) return;
|
|
259
259
|
const { blockId: t, fieldName: r } = e.groups;
|
|
260
260
|
return { blockId: t, fieldName: r };
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
async function
|
|
264
|
-
const
|
|
265
|
-
|
|
262
|
+
const oo = "projects", At = { name: "Projects", version: "1" }, so = (o) => G(o.type, At) ? o.fields : [];
|
|
263
|
+
async function io(o, e, t, r) {
|
|
264
|
+
const s = await Pt.init(
|
|
265
|
+
o,
|
|
266
266
|
e,
|
|
267
267
|
{
|
|
268
268
|
...r.ops.defaultTreeOptions,
|
|
269
|
-
pruning:
|
|
269
|
+
pruning: so
|
|
270
270
|
},
|
|
271
271
|
r.logger
|
|
272
272
|
);
|
|
273
273
|
return { computable: R.make((n) => {
|
|
274
|
-
const a = n.accessor(
|
|
274
|
+
const a = n.accessor(s.entry()).node(), c = t.getValue(n);
|
|
275
275
|
if (a === void 0) return;
|
|
276
276
|
const u = [];
|
|
277
277
|
for (const l of a.listDynamicFields()) {
|
|
278
278
|
const d = a.traverse(l);
|
|
279
279
|
if (d === void 0) continue;
|
|
280
|
-
const g =
|
|
280
|
+
const g = k(d.getKeyValueAsJson(ne)), f = k(d.getKeyValueAsJson(Ge)), y = k(d.getKeyValueAsJson(ie));
|
|
281
281
|
u.push({
|
|
282
282
|
id: l,
|
|
283
283
|
rid: d.id,
|
|
284
284
|
created: new Date(f),
|
|
285
|
-
lastModified: new Date(
|
|
285
|
+
lastModified: new Date(y),
|
|
286
286
|
opened: c.indexOf(d.id) >= 0,
|
|
287
287
|
meta: g
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
290
|
return u.sort((l) => -l.lastModified.valueOf()), u;
|
|
291
|
-
}).withStableType(), tree:
|
|
291
|
+
}).withStableType(), tree: s };
|
|
292
292
|
}
|
|
293
|
-
const
|
|
293
|
+
const no = {
|
|
294
294
|
name: "EphRenderTemplate",
|
|
295
295
|
version: "1"
|
|
296
|
-
},
|
|
296
|
+
}, ao = {
|
|
297
297
|
name: "RenderTemplate",
|
|
298
298
|
version: "1"
|
|
299
299
|
};
|
|
300
|
-
function
|
|
301
|
-
if (
|
|
302
|
-
const i = t ?
|
|
303
|
-
return
|
|
300
|
+
function Tt(o, e, t, r, s) {
|
|
301
|
+
if (s.length === 0) throw new Error("Zero output names provided");
|
|
302
|
+
const i = t ? o.createEphemeral(no) : o.createStruct(ao), n = w(i, "template"), a = w(i, "inputs");
|
|
303
|
+
return o.createField(n, "Input", e), o.createField(a, "Input", b.createPlMap(o, r, t)), o.lockInputs(i), b.futureRecord(o, i, s, "Output", "outputs/");
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
function
|
|
307
|
-
return
|
|
305
|
+
const co = { name: "BContextEnd", version: "1" }, uo = { name: "BContext", version: "1" }, lo = "id", po = "parent/", go = ["context", "result"];
|
|
306
|
+
function nt(o, e, t) {
|
|
307
|
+
return Tt(o, e, !0, t, go);
|
|
308
308
|
}
|
|
309
|
-
function
|
|
310
|
-
const e =
|
|
311
|
-
return
|
|
309
|
+
function ho(o) {
|
|
310
|
+
const e = o.createEphemeral(co);
|
|
311
|
+
return o.lock(e), e;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
if (e.length === 0) return
|
|
313
|
+
function fo(o, e) {
|
|
314
|
+
if (e.length === 0) return ho(o);
|
|
315
315
|
if (e.length === 1) return e[0];
|
|
316
|
-
const t =
|
|
317
|
-
|
|
316
|
+
const t = o.createEphemeral(uo);
|
|
317
|
+
o.createField(w(t, lo), "Input", b.createPlString(o, se()));
|
|
318
318
|
for (let r = 0; r < e.length; r++)
|
|
319
|
-
|
|
320
|
-
return
|
|
319
|
+
o.createField(w(t, `${po}${r}`), "Input", e[r]);
|
|
320
|
+
return o.lock(t), t;
|
|
321
321
|
}
|
|
322
|
-
const
|
|
322
|
+
const mo = { name: "TengoTemplateGet", version: "1" }, vo = "registry", yo = "templateURI", bo = "template", wo = { name: "TengoTemplatePack", version: "1" }, So = {
|
|
323
323
|
name: "TengoTemplatePackConvert",
|
|
324
324
|
version: "1"
|
|
325
|
-
},
|
|
326
|
-
async function
|
|
327
|
-
switch (
|
|
325
|
+
}, ko = "templatePack", Co = "template";
|
|
326
|
+
async function Po(o) {
|
|
327
|
+
switch (o.type) {
|
|
328
328
|
case "from-file":
|
|
329
329
|
return {
|
|
330
330
|
type: "explicit",
|
|
331
|
-
content: await
|
|
331
|
+
content: await I.promises.readFile(o.path)
|
|
332
332
|
};
|
|
333
333
|
case "from-registry":
|
|
334
334
|
case "explicit":
|
|
335
|
-
return
|
|
335
|
+
return o;
|
|
336
336
|
default:
|
|
337
|
-
return D(
|
|
337
|
+
return D(o);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
const t =
|
|
342
|
-
return
|
|
340
|
+
function Ro(o, e) {
|
|
341
|
+
const t = o.createStruct(mo), r = w(t, vo), s = w(t, yo), i = w(t, bo);
|
|
342
|
+
return o.setField(r, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.registry)))), o.setField(s, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.path)))), i;
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
const t =
|
|
346
|
-
return
|
|
344
|
+
function Fo(o, e) {
|
|
345
|
+
const t = o.createValue(wo, e.content), r = o.createStruct(So), s = w(r, ko), i = w(r, Co);
|
|
346
|
+
return o.setField(s, t), i;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function _e(o, e) {
|
|
349
349
|
switch (e.type) {
|
|
350
350
|
case "from-registry":
|
|
351
|
-
return
|
|
351
|
+
return Ro(o, e);
|
|
352
352
|
case "explicit":
|
|
353
|
-
return
|
|
353
|
+
return Fo(o, e);
|
|
354
354
|
default:
|
|
355
355
|
return D(e);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
const
|
|
358
|
+
const jt = { name: "Frontend/FromUrl", version: "1" }, Et = {
|
|
359
359
|
name: "Frontend/FromFolder",
|
|
360
360
|
version: "1"
|
|
361
361
|
};
|
|
362
|
-
function
|
|
362
|
+
function Bo(o, e) {
|
|
363
363
|
switch (e.type) {
|
|
364
364
|
case "url":
|
|
365
|
-
return
|
|
366
|
-
|
|
365
|
+
return o.createValue(
|
|
366
|
+
jt,
|
|
367
367
|
JSON.stringify({ url: e.url })
|
|
368
368
|
);
|
|
369
369
|
case "local":
|
|
370
|
-
return
|
|
370
|
+
return o.createValue(
|
|
371
371
|
Et,
|
|
372
372
|
JSON.stringify({
|
|
373
373
|
path: e.path,
|
|
@@ -378,11 +378,11 @@ function Fo(s, e) {
|
|
|
378
378
|
return D(e);
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
const
|
|
382
|
-
function
|
|
383
|
-
return
|
|
381
|
+
const Oo = { name: "BlockPackCustom", version: "1" }, It = "template", Nt = "frontend";
|
|
382
|
+
function at(o) {
|
|
383
|
+
return o.endsWith("/") ? o : `${o}/`;
|
|
384
384
|
}
|
|
385
|
-
class
|
|
385
|
+
class Do {
|
|
386
386
|
constructor(e, t, r) {
|
|
387
387
|
this.v2RegistryProvider = e, this.signer = t, this.http = r;
|
|
388
388
|
}
|
|
@@ -391,22 +391,22 @@ class Oo {
|
|
|
391
391
|
case "explicit":
|
|
392
392
|
return e.config;
|
|
393
393
|
case "dev-v1": {
|
|
394
|
-
const t = await
|
|
394
|
+
const t = await it(e.folder), r = await I.promises.readFile(t.config, { encoding: "utf-8" });
|
|
395
395
|
return JSON.parse(r);
|
|
396
396
|
}
|
|
397
397
|
case "dev-v2": {
|
|
398
|
-
const t = await
|
|
398
|
+
const t = await Xe(e.folder), r = await I.promises.readFile(t.components.model.file, {
|
|
399
399
|
encoding: "utf-8"
|
|
400
400
|
});
|
|
401
401
|
return JSON.parse(r);
|
|
402
402
|
}
|
|
403
403
|
case "from-registry-v1": {
|
|
404
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${
|
|
404
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${at(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
|
|
405
405
|
return await (await K(`${r}/config.json`, t)).body.json();
|
|
406
406
|
}
|
|
407
407
|
case "from-registry-v2": {
|
|
408
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {},
|
|
409
|
-
return await (await K(
|
|
408
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
|
|
409
|
+
return await (await K(s.model.url, t)).body.json();
|
|
410
410
|
}
|
|
411
411
|
default:
|
|
412
412
|
return D(e);
|
|
@@ -417,8 +417,8 @@ class Oo {
|
|
|
417
417
|
case "explicit":
|
|
418
418
|
return e;
|
|
419
419
|
case "dev-v1": {
|
|
420
|
-
const t = await
|
|
421
|
-
await
|
|
420
|
+
const t = await it(e.folder), r = await I.promises.readFile(t.workflow), s = JSON.parse(
|
|
421
|
+
await I.promises.readFile(t.config, "utf-8")
|
|
422
422
|
), i = t.ui;
|
|
423
423
|
return {
|
|
424
424
|
type: "explicit",
|
|
@@ -426,7 +426,7 @@ class Oo {
|
|
|
426
426
|
type: "explicit",
|
|
427
427
|
content: r
|
|
428
428
|
},
|
|
429
|
-
config:
|
|
429
|
+
config: s,
|
|
430
430
|
frontend: {
|
|
431
431
|
type: "local",
|
|
432
432
|
path: i,
|
|
@@ -436,18 +436,18 @@ class Oo {
|
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
438
|
case "dev-v2": {
|
|
439
|
-
const t = await
|
|
440
|
-
await
|
|
439
|
+
const t = await Xe(e.folder), r = JSON.parse(
|
|
440
|
+
await I.promises.readFile(t.components.model.file, {
|
|
441
441
|
encoding: "utf-8"
|
|
442
442
|
})
|
|
443
|
-
),
|
|
443
|
+
), s = await I.promises.readFile(
|
|
444
444
|
t.components.workflow.main.file
|
|
445
445
|
), i = t.components.ui.folder, n = { ...e };
|
|
446
|
-
return e.mtime === void 0 && (n.mtime = await
|
|
446
|
+
return e.mtime === void 0 && (n.mtime = await Ke(t)), {
|
|
447
447
|
type: "explicit",
|
|
448
448
|
template: {
|
|
449
449
|
type: "explicit",
|
|
450
|
-
content:
|
|
450
|
+
content: s
|
|
451
451
|
},
|
|
452
452
|
config: r,
|
|
453
453
|
frontend: {
|
|
@@ -459,10 +459,10 @@ class Oo {
|
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
461
|
case "from-registry-v1": {
|
|
462
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${
|
|
462
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${at(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, i = await K(s, t);
|
|
463
463
|
if (i.statusCode !== 200)
|
|
464
464
|
throw new Error(
|
|
465
|
-
`Block not found in registry (url = ${
|
|
465
|
+
`Block not found in registry (url = ${s} ; code = ${i.statusCode}): ` + JSON.stringify(e)
|
|
466
466
|
);
|
|
467
467
|
const n = new Uint8Array(await i.body.arrayBuffer()), c = await (await K(`${r}/config.json`, t)).body.json();
|
|
468
468
|
return {
|
|
@@ -480,7 +480,7 @@ class Oo {
|
|
|
480
480
|
};
|
|
481
481
|
}
|
|
482
482
|
case "from-registry-v2": {
|
|
483
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {},
|
|
483
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), i = async () => await (await K(s.model.url, t)).body.json(), n = async () => await (await K(s.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([i(), n()]);
|
|
484
484
|
return {
|
|
485
485
|
type: "explicit",
|
|
486
486
|
template: {
|
|
@@ -490,7 +490,7 @@ class Oo {
|
|
|
490
490
|
config: a,
|
|
491
491
|
frontend: {
|
|
492
492
|
type: "url",
|
|
493
|
-
url:
|
|
493
|
+
url: s.ui.url
|
|
494
494
|
},
|
|
495
495
|
source: e
|
|
496
496
|
};
|
|
@@ -500,25 +500,25 @@ class Oo {
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
const t = { config: e.config, source: e.source }, r =
|
|
505
|
-
return
|
|
503
|
+
function xo(o, e) {
|
|
504
|
+
const t = { config: e.config, source: e.source }, r = o.createStruct(Oo, JSON.stringify(t));
|
|
505
|
+
return o.createField(w(r, It), "Input", _e(o, e.template)), o.createField(w(r, Nt), "Input", Bo(o, e.frontend)), o.lock(r), r;
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function ct(o, e) {
|
|
508
508
|
switch (e.type) {
|
|
509
509
|
case "explicit":
|
|
510
|
-
return
|
|
510
|
+
return xo(o, e);
|
|
511
511
|
default:
|
|
512
512
|
return D(e.type);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function le(
|
|
516
|
-
return { __isRef: !0, blockId:
|
|
515
|
+
function le(o, e) {
|
|
516
|
+
return { __isRef: !0, blockId: o, name: e };
|
|
517
517
|
}
|
|
518
|
-
function
|
|
519
|
-
return typeof
|
|
518
|
+
function Ao(o) {
|
|
519
|
+
return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function Ie(o, e, t) {
|
|
522
522
|
const r = typeof e;
|
|
523
523
|
switch (r) {
|
|
524
524
|
case "function":
|
|
@@ -531,26 +531,26 @@ function Ee(s, e, t) {
|
|
|
531
531
|
return;
|
|
532
532
|
case "object":
|
|
533
533
|
if (e === null) return;
|
|
534
|
-
if (
|
|
535
|
-
t === void 0 || t.has(e.blockId) ?
|
|
534
|
+
if (Ao(e))
|
|
535
|
+
t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
|
|
536
536
|
else if (Array.isArray(e))
|
|
537
|
-
for (const
|
|
537
|
+
for (const s of e) Ie(o, s, t);
|
|
538
538
|
else
|
|
539
|
-
for (const [,
|
|
540
|
-
|
|
539
|
+
for (const [, s] of Object.entries(e))
|
|
540
|
+
Ie(o, s, t);
|
|
541
541
|
return;
|
|
542
542
|
default:
|
|
543
543
|
D(r);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function To(o, e) {
|
|
547
547
|
const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
|
|
548
|
-
return
|
|
548
|
+
return Ie(t, o, e), t;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function U(o) {
|
|
551
551
|
return {
|
|
552
552
|
*[Symbol.iterator]() {
|
|
553
|
-
for (const e of
|
|
553
|
+
for (const e of o.groups) for (const t of e.blocks) yield t;
|
|
554
554
|
}
|
|
555
555
|
};
|
|
556
556
|
}
|
|
@@ -562,104 +562,104 @@ class Vt {
|
|
|
562
562
|
}
|
|
563
563
|
traverseIds(e, ...t) {
|
|
564
564
|
const r = /* @__PURE__ */ new Set();
|
|
565
|
-
return this.traverse(e, t, (
|
|
565
|
+
return this.traverse(e, t, (s) => r.add(s.id)), r;
|
|
566
566
|
}
|
|
567
567
|
traverseIdsExcludingRoots(e, ...t) {
|
|
568
568
|
const r = this.traverseIds(e, ...t);
|
|
569
|
-
for (const
|
|
569
|
+
for (const s of t) r.delete(s);
|
|
570
570
|
return r;
|
|
571
571
|
}
|
|
572
572
|
traverse(e, t, r) {
|
|
573
|
-
let
|
|
574
|
-
const i = new Set(
|
|
575
|
-
for (;
|
|
573
|
+
let s = [...t];
|
|
574
|
+
const i = new Set(s);
|
|
575
|
+
for (; s.length > 0; ) {
|
|
576
576
|
let n = [];
|
|
577
|
-
for (const a of
|
|
577
|
+
for (const a of s) {
|
|
578
578
|
const c = this.nodes.get(a);
|
|
579
579
|
r(c), c[e].forEach((u) => {
|
|
580
580
|
i.has(u) || (i.add(u), n.push(u));
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
s = n;
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Ne(o) {
|
|
588
588
|
const e = /* @__PURE__ */ new Map();
|
|
589
589
|
let t;
|
|
590
|
-
for (const { id: r } of
|
|
591
|
-
const
|
|
590
|
+
for (const { id: r } of U(o)) {
|
|
591
|
+
const s = {
|
|
592
592
|
id: r,
|
|
593
593
|
missingReferences: !1
|
|
594
594
|
};
|
|
595
|
-
e.set(r,
|
|
595
|
+
e.set(r, s), t === void 0 ? s.upstream = /* @__PURE__ */ new Set() : (s.upstream = /* @__PURE__ */ new Set([t.id]), t.downstream = /* @__PURE__ */ new Set([s.id])), t = s;
|
|
596
596
|
}
|
|
597
597
|
return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Vt(e);
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function pe(o, e) {
|
|
600
600
|
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
601
|
-
for (const { id:
|
|
602
|
-
const i = e(
|
|
601
|
+
for (const { id: s } of U(o)) {
|
|
602
|
+
const i = e(s);
|
|
603
603
|
if (i === void 0) continue;
|
|
604
|
-
const n =
|
|
605
|
-
id:
|
|
604
|
+
const n = To(i, r), a = {
|
|
605
|
+
id: s,
|
|
606
606
|
missingReferences: n.missingReferences,
|
|
607
607
|
upstream: n.upstreams,
|
|
608
608
|
downstream: /* @__PURE__ */ new Set()
|
|
609
609
|
// will be populated from downstream blocks
|
|
610
610
|
};
|
|
611
|
-
t.set(
|
|
611
|
+
t.set(s, a), n.upstreams.forEach((c) => t.get(c).downstream.add(s)), r.add(s);
|
|
612
612
|
}
|
|
613
613
|
return new Vt(t);
|
|
614
614
|
}
|
|
615
|
-
function jo(
|
|
616
|
-
if (
|
|
617
|
-
for (const t of
|
|
615
|
+
function jo(o, e) {
|
|
616
|
+
if (o.size !== e.size) return !1;
|
|
617
|
+
for (const t of o) if (!e.has(t)) return !1;
|
|
618
618
|
return !0;
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
if (
|
|
622
|
-
for (const t of
|
|
620
|
+
function Ve(o, e) {
|
|
621
|
+
if (o.size > e.size) return Ve(e, o);
|
|
622
|
+
for (const t of o) if (e.has(t)) return !0;
|
|
623
623
|
return !1;
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(),
|
|
627
|
-
return
|
|
625
|
+
function ut(o, e) {
|
|
626
|
+
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
627
|
+
return o.nodes.forEach((i) => {
|
|
628
628
|
const n = e.nodes.get(i.id);
|
|
629
|
-
n === void 0 ? t.add(i.id) : (!jo(i.upstream, n.upstream) ||
|
|
629
|
+
n === void 0 ? t.add(i.id) : (!jo(i.upstream, n.upstream) || Ve(i.upstream, s)) && s.add(i.id);
|
|
630
630
|
}), e.nodes.forEach((i) => {
|
|
631
|
-
|
|
632
|
-
}), { onlyInA: t, onlyInB: r, different:
|
|
631
|
+
o.nodes.has(i.id) ? Ve(i.upstream, s) && s.add(i.id) : r.add(i.id);
|
|
632
|
+
}), { onlyInA: t, onlyInB: r, different: s };
|
|
633
633
|
}
|
|
634
|
-
let
|
|
634
|
+
let Re;
|
|
635
635
|
async function Lt() {
|
|
636
|
-
if (
|
|
637
|
-
const
|
|
638
|
-
if (
|
|
639
|
-
const e =
|
|
640
|
-
|
|
636
|
+
if (Re === void 0) {
|
|
637
|
+
const o = await Po(kr["pframes.export-pframe"]);
|
|
638
|
+
if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
|
|
639
|
+
const e = be("sha256").update(o.content).digest("hex");
|
|
640
|
+
Re = { spec: o, hash: e };
|
|
641
641
|
}
|
|
642
|
-
return
|
|
642
|
+
return Re;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
644
|
+
function Eo(o, e, t) {
|
|
645
|
+
return Tt(o, e, !0, { pf: t }, ["result"]).result;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
let t = !1, r,
|
|
647
|
+
function Fe(o, e) {
|
|
648
|
+
let t = !1, r, s;
|
|
649
649
|
return () => {
|
|
650
650
|
if (!t)
|
|
651
|
-
return t = !0, r =
|
|
652
|
-
const i =
|
|
653
|
-
return r !== i && (r = i,
|
|
651
|
+
return t = !0, r = o(), s = e(), s;
|
|
652
|
+
const i = o();
|
|
653
|
+
return r !== i && (r = i, s = e()), e();
|
|
654
654
|
};
|
|
655
655
|
}
|
|
656
|
-
class
|
|
656
|
+
class lt {
|
|
657
657
|
constructor(e, t) {
|
|
658
|
-
p(this, "currentInputsC",
|
|
658
|
+
p(this, "currentInputsC", Fe(
|
|
659
659
|
() => this.fields.currentArgs.modCount,
|
|
660
660
|
() => JSON.parse(Buffer.from(this.fields.currentArgs.value).toString())
|
|
661
661
|
));
|
|
662
|
-
p(this, "actualProductionInputsC",
|
|
662
|
+
p(this, "actualProductionInputsC", Fe(
|
|
663
663
|
() => {
|
|
664
664
|
var e;
|
|
665
665
|
return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
|
|
@@ -671,7 +671,7 @@ class ut {
|
|
|
671
671
|
return JSON.parse(Buffer.from(e).toString());
|
|
672
672
|
}
|
|
673
673
|
));
|
|
674
|
-
p(this, "productionStaleC",
|
|
674
|
+
p(this, "productionStaleC", Fe(
|
|
675
675
|
() => {
|
|
676
676
|
var e;
|
|
677
677
|
return `${this.fields.currentArgs.modCount}_${(e = this.fields.prodArgs) == null ? void 0 : e.modCount}`;
|
|
@@ -718,11 +718,11 @@ class ut {
|
|
|
718
718
|
);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
const
|
|
722
|
-
throw new Error(`No new block info for ${
|
|
721
|
+
const Io = (o) => {
|
|
722
|
+
throw new Error(`No new block info for ${o}`);
|
|
723
723
|
};
|
|
724
|
-
class
|
|
725
|
-
constructor(e, t, r,
|
|
724
|
+
class me {
|
|
725
|
+
constructor(e, t, r, s, i, n, a, c, u, l, d, g) {
|
|
726
726
|
p(this, "globalModCount", 0);
|
|
727
727
|
p(this, "fieldsChanged", !1);
|
|
728
728
|
//
|
|
@@ -741,7 +741,7 @@ class fe {
|
|
|
741
741
|
p(this, "stagingGraph");
|
|
742
742
|
p(this, "pendingProductionGraph");
|
|
743
743
|
p(this, "actualProductionGraph");
|
|
744
|
-
this.rid = e, this.tx = t, this.author = r, this.schema =
|
|
744
|
+
this.rid = e, this.tx = t, this.author = r, this.schema = s, this.lastModified = i, this.meta = n, this.struct = a, this.renderingState = c, this.blocksInLimbo = u, this.blockInfos = l, this.blockFrontendStates = d, this.ctxExportTplHolder = g;
|
|
745
745
|
}
|
|
746
746
|
fixProblems() {
|
|
747
747
|
this.blockInfos.forEach((e) => {
|
|
@@ -755,16 +755,16 @@ class fe {
|
|
|
755
755
|
return JSON.parse(JSON.stringify(this.struct));
|
|
756
756
|
}
|
|
757
757
|
getStagingGraph() {
|
|
758
|
-
return this.stagingGraph === void 0 && (this.stagingGraph =
|
|
758
|
+
return this.stagingGraph === void 0 && (this.stagingGraph = Ne(this.struct)), this.stagingGraph;
|
|
759
759
|
}
|
|
760
760
|
getPendingProductionGraph() {
|
|
761
|
-
return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph =
|
|
761
|
+
return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = pe(
|
|
762
762
|
this.struct,
|
|
763
763
|
(e) => this.getBlockInfo(e).currentInputs
|
|
764
764
|
)), this.pendingProductionGraph;
|
|
765
765
|
}
|
|
766
766
|
getActualProductionGraph() {
|
|
767
|
-
return this.actualProductionGraph === void 0 && (this.actualProductionGraph =
|
|
767
|
+
return this.actualProductionGraph === void 0 && (this.actualProductionGraph = pe(
|
|
768
768
|
this.struct,
|
|
769
769
|
(e) => this.getBlockInfo(e).actualProductionInputs
|
|
770
770
|
)), this.actualProductionGraph;
|
|
@@ -773,28 +773,28 @@ class fe {
|
|
|
773
773
|
// Generic helpers to interact with project state
|
|
774
774
|
//
|
|
775
775
|
getBlockInfo(e) {
|
|
776
|
-
return
|
|
776
|
+
return k(this.blockInfos.get(e));
|
|
777
777
|
}
|
|
778
778
|
getBlock(e) {
|
|
779
|
-
for (const t of
|
|
779
|
+
for (const t of U(this.struct)) if (t.id === e) return t;
|
|
780
780
|
throw new Error("block not found");
|
|
781
781
|
}
|
|
782
782
|
setBlockFieldObj(e, t, r) {
|
|
783
|
-
const
|
|
783
|
+
const s = w(this.rid, P(e, t));
|
|
784
784
|
if (r.ref === void 0) throw new Error("Can't set value with empty ref");
|
|
785
|
-
this.getBlockInfo(e).fields[t] === void 0 ? this.tx.createField(
|
|
785
|
+
this.getBlockInfo(e).fields[t] === void 0 ? this.tx.createField(s, "Dynamic", r.ref) : this.tx.setField(s, r.ref), this.getBlockInfo(e).fields[t] = {
|
|
786
786
|
modCount: this.globalModCount++,
|
|
787
787
|
...r
|
|
788
788
|
}, this.fieldsChanged = !0;
|
|
789
789
|
}
|
|
790
|
-
setBlockField(e, t, r,
|
|
791
|
-
this.setBlockFieldObj(e, t, { ref: r, status:
|
|
790
|
+
setBlockField(e, t, r, s, i) {
|
|
791
|
+
this.setBlockFieldObj(e, t, { ref: r, status: s, value: i });
|
|
792
792
|
}
|
|
793
793
|
deleteBlockFields(e, ...t) {
|
|
794
794
|
let r = !1;
|
|
795
|
-
const
|
|
795
|
+
const s = this.getBlockInfo(e);
|
|
796
796
|
for (const i of t) {
|
|
797
|
-
const n =
|
|
797
|
+
const n = s.fields;
|
|
798
798
|
i in n && (this.tx.removeField(w(this.rid, P(e, i))), delete n[i], this.fieldsChanged = !0, r = !0);
|
|
799
799
|
}
|
|
800
800
|
return r;
|
|
@@ -809,29 +809,29 @@ class fe {
|
|
|
809
809
|
this.renderingState.stagingRefreshTimestamp = Date.now(), this.renderingStateChanged = !0;
|
|
810
810
|
}
|
|
811
811
|
resetStaging(e) {
|
|
812
|
-
var r,
|
|
812
|
+
var r, s, i;
|
|
813
813
|
const t = this.getBlockInfo(e).fields;
|
|
814
|
-
((r = t.stagingOutput) == null ? void 0 : r.status) === "Ready" && ((
|
|
814
|
+
((r = t.stagingOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.stagingCtx) == null ? void 0 : s.status) === "Ready" && ((i = t.stagingUiCtx) == null ? void 0 : i.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();
|
|
815
815
|
}
|
|
816
816
|
resetProduction(e) {
|
|
817
|
-
var r,
|
|
817
|
+
var r, s, i;
|
|
818
818
|
const t = this.getBlockInfo(e).fields;
|
|
819
|
-
((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((
|
|
819
|
+
((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.prodCtx) == null ? void 0 : s.status) === "Ready" && ((i = t.prodUiCtx) == null ? void 0 : i.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");
|
|
820
820
|
}
|
|
821
821
|
/** Running blocks are reset, already computed moved to limbo. Returns if
|
|
822
822
|
* either of the actions were actually performed. */
|
|
823
823
|
resetOrLimboProduction(e) {
|
|
824
|
-
var r,
|
|
824
|
+
var r, s;
|
|
825
825
|
const t = this.getBlockInfo(e).fields;
|
|
826
|
-
return ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((
|
|
826
|
+
return ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.prodCtx) == null ? void 0 : s.status) === "Ready" ? this.blocksInLimbo.has(e) ? !1 : (this.blocksInLimbo.add(e), this.renderingStateChanged = !0, this.deleteBlockFields(e, "prodOutputPrevious", "prodCtxPrevious", "prodUiCtxPrevious"), !0) : this.deleteBlockFields(e, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs");
|
|
827
827
|
}
|
|
828
828
|
/** Optimally sets inputs for multiple blocks in one go */
|
|
829
829
|
setArgs(e) {
|
|
830
830
|
const t = [];
|
|
831
|
-
for (const { blockId: r, args:
|
|
831
|
+
for (const { blockId: r, args: s } of e) {
|
|
832
832
|
const i = this.getBlockInfo(r);
|
|
833
|
-
JSON.parse(
|
|
834
|
-
const n = Buffer.from(
|
|
833
|
+
JSON.parse(s);
|
|
834
|
+
const n = Buffer.from(s);
|
|
835
835
|
if (Buffer.compare(i.fields.currentArgs.value, n) === 0) continue;
|
|
836
836
|
const a = this.tx.createValue(b.JsonObject, n);
|
|
837
837
|
this.setBlockField(r, "currentArgs", a, "Ready", n), this.blocksWithChangedInputs.add(r), t.push(r);
|
|
@@ -858,21 +858,21 @@ class fe {
|
|
|
858
858
|
// }
|
|
859
859
|
createCtx(e, t) {
|
|
860
860
|
const r = [];
|
|
861
|
-
return e.forEach((
|
|
862
|
-
const i = this.getBlockInfo(
|
|
861
|
+
return e.forEach((s) => {
|
|
862
|
+
const i = this.getBlockInfo(s);
|
|
863
863
|
if (i.fields[t] === void 0 || i.fields[t].ref === void 0)
|
|
864
864
|
throw new Error("One of the upstreams staging is not rendered.");
|
|
865
865
|
r.push(b.unwrapHolder(this.tx, i.fields[t].ref));
|
|
866
|
-
}),
|
|
866
|
+
}), fo(this.tx, r);
|
|
867
867
|
}
|
|
868
868
|
exportCtx(e) {
|
|
869
|
-
return
|
|
869
|
+
return Eo(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
|
|
870
870
|
}
|
|
871
871
|
renderStagingFor(e) {
|
|
872
872
|
this.resetStaging(e);
|
|
873
873
|
const t = this.getBlockInfo(e), r = this.createCtx(this.getStagingGraph().nodes.get(e).upstream, "stagingCtx");
|
|
874
874
|
if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
|
|
875
|
-
const
|
|
875
|
+
const s = t.getTemplate(this.tx), i = nt(this.tx, s, {
|
|
876
876
|
args: t.fields.currentArgs.ref,
|
|
877
877
|
blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
|
|
878
878
|
isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
|
|
@@ -893,7 +893,7 @@ class fe {
|
|
|
893
893
|
);
|
|
894
894
|
if (this.getBlock(e).renderingMode === "Light")
|
|
895
895
|
throw new Error("Can't render production for light block.");
|
|
896
|
-
const
|
|
896
|
+
const s = t.getTemplate(this.tx), i = nt(this.tx, s, {
|
|
897
897
|
args: t.fields.currentArgs.ref,
|
|
898
898
|
blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
|
|
899
899
|
isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
|
|
@@ -910,28 +910,28 @@ class fe {
|
|
|
910
910
|
// Structure changes
|
|
911
911
|
//
|
|
912
912
|
/** Very generic method, better check for more specialized case-specific methods first. */
|
|
913
|
-
updateStructure(e, t =
|
|
914
|
-
const r = this.getStagingGraph(),
|
|
913
|
+
updateStructure(e, t = Io) {
|
|
914
|
+
const r = this.getStagingGraph(), s = this.getActualProductionGraph(), i = Ne(e), n = pe(
|
|
915
915
|
e,
|
|
916
916
|
(u) => {
|
|
917
917
|
var l;
|
|
918
918
|
return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
|
|
919
919
|
}
|
|
920
|
-
), a =
|
|
920
|
+
), a = ut(r, i), c = ut(s, n);
|
|
921
921
|
for (const u of a.onlyInA) {
|
|
922
922
|
const { fields: l } = this.getBlockInfo(u);
|
|
923
923
|
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);
|
|
924
924
|
}
|
|
925
925
|
for (const u of a.onlyInB) {
|
|
926
|
-
const l = new
|
|
926
|
+
const l = new lt(u, {});
|
|
927
927
|
this.blockInfos.set(u, l);
|
|
928
|
-
const d = t(u), g =
|
|
928
|
+
const d = t(u), g = ct(this.tx, d.blockPack);
|
|
929
929
|
this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
|
|
930
|
-
const f = Buffer.from(d.args),
|
|
931
|
-
this.setBlockField(u, "currentArgs",
|
|
930
|
+
const f = Buffer.from(d.args), y = this.tx.createValue(b.JsonObject, f);
|
|
931
|
+
this.setBlockField(u, "currentArgs", y, "Ready", f), d.uiState && (this.blockFrontendStates.set(u, d.uiState), this.changedBlockFrontendStates.add(u)), l.check();
|
|
932
932
|
}
|
|
933
933
|
for (const u of a.different) this.resetStaging(u);
|
|
934
|
-
|
|
934
|
+
s.traverse("downstream", [...c.different], (u) => {
|
|
935
935
|
this.resetOrLimboProduction(u.id);
|
|
936
936
|
}), (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();
|
|
937
937
|
}
|
|
@@ -939,12 +939,12 @@ class fe {
|
|
|
939
939
|
// Structure change helpers
|
|
940
940
|
//
|
|
941
941
|
addBlock(e, t, r) {
|
|
942
|
-
const
|
|
942
|
+
const s = this.structure;
|
|
943
943
|
if (r === void 0)
|
|
944
|
-
|
|
944
|
+
s.groups[s.groups.length - 1].blocks.push(e);
|
|
945
945
|
else {
|
|
946
946
|
let i = !1;
|
|
947
|
-
for (const n of
|
|
947
|
+
for (const n of s.groups) {
|
|
948
948
|
const a = n.blocks.findIndex((c) => c.id === r);
|
|
949
949
|
if (!(a < 0)) {
|
|
950
950
|
n.blocks.splice(a, 0, e), i = !0;
|
|
@@ -953,7 +953,7 @@ class fe {
|
|
|
953
953
|
}
|
|
954
954
|
if (!i) throw new Error(`Can't find element with id: ${r}`);
|
|
955
955
|
}
|
|
956
|
-
this.updateStructure(
|
|
956
|
+
this.updateStructure(s, (i) => {
|
|
957
957
|
if (i !== e.id) throw new Error("Unexpected");
|
|
958
958
|
return t;
|
|
959
959
|
});
|
|
@@ -961,10 +961,10 @@ class fe {
|
|
|
961
961
|
deleteBlock(e) {
|
|
962
962
|
const t = this.structure;
|
|
963
963
|
let r = !1;
|
|
964
|
-
for (const
|
|
965
|
-
const i =
|
|
964
|
+
for (const s of t.groups) {
|
|
965
|
+
const i = s.blocks.findIndex((n) => n.id === e);
|
|
966
966
|
if (!(i < 0)) {
|
|
967
|
-
|
|
967
|
+
s.blocks.splice(i, 1), r = !0;
|
|
968
968
|
break;
|
|
969
969
|
}
|
|
970
970
|
}
|
|
@@ -975,13 +975,13 @@ class fe {
|
|
|
975
975
|
// Block-pack migration
|
|
976
976
|
//
|
|
977
977
|
migrateBlockPack(e, t, r) {
|
|
978
|
-
const
|
|
978
|
+
const s = this.getBlockInfo(e);
|
|
979
979
|
this.setBlockField(
|
|
980
980
|
e,
|
|
981
981
|
"blockPack",
|
|
982
|
-
b.wrapInHolder(this.tx,
|
|
982
|
+
b.wrapInHolder(this.tx, ct(this.tx, t)),
|
|
983
983
|
"NotReady"
|
|
984
|
-
), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: i }) => this.resetStaging(i)),
|
|
984
|
+
), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: i }) => this.resetStaging(i)), s.productionRendered && this.getActualProductionGraph().traverse(
|
|
985
985
|
"downstream",
|
|
986
986
|
[e],
|
|
987
987
|
({ id: i }) => this.resetOrLimboProduction(i)
|
|
@@ -991,25 +991,25 @@ class fe {
|
|
|
991
991
|
// Render
|
|
992
992
|
//
|
|
993
993
|
renderProduction(e, t = !1) {
|
|
994
|
-
const r = new Set(e),
|
|
994
|
+
const r = new Set(e), s = this.getPendingProductionGraph();
|
|
995
995
|
if (t)
|
|
996
|
-
|
|
996
|
+
s.traverse("upstream", e, (n) => {
|
|
997
997
|
r.add(n.id);
|
|
998
998
|
});
|
|
999
999
|
else
|
|
1000
1000
|
for (const n of r) {
|
|
1001
|
-
const a =
|
|
1001
|
+
const a = s.nodes.get(n);
|
|
1002
1002
|
if (a === void 0) throw new Error(`Can't find block with id: ${n}`);
|
|
1003
1003
|
for (const c of a.upstream)
|
|
1004
1004
|
if (!r.has(c))
|
|
1005
1005
|
throw new Error("Can't render blocks not including all upstreams.");
|
|
1006
1006
|
}
|
|
1007
1007
|
const i = /* @__PURE__ */ new Set();
|
|
1008
|
-
for (const n of
|
|
1008
|
+
for (const n of U(this.structure)) {
|
|
1009
1009
|
if (!r.has(n.id)) continue;
|
|
1010
1010
|
let a = this.getBlockInfo(n.id).requireProductionRendering || this.blocksInLimbo.has(n.id);
|
|
1011
1011
|
if (!a) {
|
|
1012
|
-
for (const c of
|
|
1012
|
+
for (const c of s.nodes.get(n.id).upstream)
|
|
1013
1013
|
if (i.has(c)) {
|
|
1014
1014
|
a = !0;
|
|
1015
1015
|
break;
|
|
@@ -1017,7 +1017,7 @@ class fe {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
a && (this.renderProductionFor(n.id), i.add(n.id));
|
|
1019
1019
|
}
|
|
1020
|
-
return
|
|
1020
|
+
return s.traverse("downstream", [...i], (n) => {
|
|
1021
1021
|
i.has(n.id) || this.resetOrLimboProduction(n.id);
|
|
1022
1022
|
}), i.size > 0 && this.updateLastModified(), i;
|
|
1023
1023
|
}
|
|
@@ -1025,13 +1025,13 @@ class fe {
|
|
|
1025
1025
|
* accordingly */
|
|
1026
1026
|
stopProduction(...e) {
|
|
1027
1027
|
var n, a;
|
|
1028
|
-
const t = this.getActualProductionGraph(), r = new Rt(e),
|
|
1028
|
+
const t = this.getActualProductionGraph(), r = new Rt(e), s = new Set(e), i = [];
|
|
1029
1029
|
for (; !r.isEmpty(); ) {
|
|
1030
1030
|
const c = r.shift(), u = this.getBlockInfo(c).fields;
|
|
1031
1031
|
if (!(((n = u.prodOutput) == null ? void 0 : n.status) === "Ready" && ((a = u.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
|
|
1032
1032
|
i.push(c);
|
|
1033
1033
|
for (const l of t.traverseIdsExcludingRoots("downstream", c))
|
|
1034
|
-
|
|
1034
|
+
s.has(l) || (r.push(l), s.add(l));
|
|
1035
1035
|
}
|
|
1036
1036
|
}
|
|
1037
1037
|
for (const c of t.traverseIdsExcludingRoots("downstream", ...i))
|
|
@@ -1039,21 +1039,21 @@ class fe {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
traverseWithStagingLag(e) {
|
|
1041
1041
|
const t = /* @__PURE__ */ new Map();
|
|
1042
|
-
this.getStagingGraph().nodes.forEach((
|
|
1043
|
-
let n = this.getBlockInfo(
|
|
1044
|
-
|
|
1042
|
+
this.getStagingGraph().nodes.forEach((s) => {
|
|
1043
|
+
let n = this.getBlockInfo(s.id).stagingRendered ? 0 : 1;
|
|
1044
|
+
s.upstream.forEach((a) => {
|
|
1045
1045
|
const c = t.get(a);
|
|
1046
1046
|
c !== 0 && (n = Math.max(c + 1, n));
|
|
1047
|
-
}), e(
|
|
1047
|
+
}), e(s.id, n), t.set(s.id, n);
|
|
1048
1048
|
});
|
|
1049
1049
|
}
|
|
1050
1050
|
/** @param stagingRenderingRate rate in blocks per second */
|
|
1051
1051
|
refreshStagings(e) {
|
|
1052
1052
|
const t = Date.now() - this.renderingState.stagingRefreshTimestamp, r = e === void 0 ? void 0 : 1 + Math.max(0, t * e / 1e3);
|
|
1053
|
-
let
|
|
1053
|
+
let s = 0;
|
|
1054
1054
|
this.traverseWithStagingLag((i, n) => {
|
|
1055
|
-
n !== 0 && (r === void 0 || n <= r) && (this.renderStagingFor(i),
|
|
1056
|
-
}),
|
|
1055
|
+
n !== 0 && (r === void 0 || n <= r) && (this.renderStagingFor(i), s++);
|
|
1056
|
+
}), s > 0 && this.resetStagingRefreshTimestamp();
|
|
1057
1057
|
}
|
|
1058
1058
|
//
|
|
1059
1059
|
// Meta
|
|
@@ -1068,8 +1068,8 @@ class fe {
|
|
|
1068
1068
|
/** @param stagingRenderingRate rate in blocks per second */
|
|
1069
1069
|
doRefresh(e) {
|
|
1070
1070
|
this.refreshStagings(e), this.blockInfos.forEach((t) => {
|
|
1071
|
-
var r,
|
|
1072
|
-
((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((
|
|
1071
|
+
var r, s, i, n;
|
|
1072
|
+
((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((s = t.fields.prodOutput) == null ? void 0 : s.status) === "Ready" && this.deleteBlockFields(
|
|
1073
1073
|
t.id,
|
|
1074
1074
|
"prodOutputPrevious",
|
|
1075
1075
|
"prodCtxPrevious",
|
|
@@ -1085,14 +1085,14 @@ class fe {
|
|
|
1085
1085
|
assignAuthorMarkers() {
|
|
1086
1086
|
const e = this.author ? JSON.stringify(this.author) : void 0;
|
|
1087
1087
|
for (const t of this.blocksWithChangedInputs)
|
|
1088
|
-
e === void 0 ? this.tx.deleteKValue(this.rid,
|
|
1088
|
+
e === void 0 ? this.tx.deleteKValue(this.rid, Te(t)) : this.tx.setKValue(this.rid, Te(t), e);
|
|
1089
1089
|
(this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, je) : this.tx.setKValue(this.rid, je, e));
|
|
1090
1090
|
}
|
|
1091
1091
|
save() {
|
|
1092
1092
|
if (this.wasModified) {
|
|
1093
1093
|
this.lastModifiedChanged && this.tx.setKValue(this.rid, ie, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, z, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
|
|
1094
1094
|
this.rid,
|
|
1095
|
-
|
|
1095
|
+
fe,
|
|
1096
1096
|
JSON.stringify({
|
|
1097
1097
|
...this.renderingState,
|
|
1098
1098
|
blocksInLimbo: [...this.blocksInLimbo]
|
|
@@ -1100,22 +1100,22 @@ class fe {
|
|
|
1100
1100
|
), this.metaChanged && this.tx.setKValue(this.rid, ne, JSON.stringify(this.meta));
|
|
1101
1101
|
for (const e of this.changedBlockFrontendStates) {
|
|
1102
1102
|
const t = this.blockFrontendStates.get(e);
|
|
1103
|
-
t === void 0 ? this.tx.deleteKValue(this.rid,
|
|
1103
|
+
t === void 0 ? this.tx.deleteKValue(this.rid, Ae(e)) : this.tx.setKValue(this.rid, Ae(e), t);
|
|
1104
1104
|
}
|
|
1105
1105
|
this.assignAuthorMarkers();
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
1108
|
static async load(e, t, r) {
|
|
1109
|
-
const
|
|
1109
|
+
const s = e.getResourceData(t, !0), i = e.getKValueJson(t, Dt), n = e.getKValueJson(t, ie), a = e.getKValueJson(t, ne), c = e.getKValueJson(t, z), u = e.getKValueJson(t, fe), l = e.listKeyValuesString(t), [
|
|
1110
1110
|
d,
|
|
1111
1111
|
g,
|
|
1112
1112
|
f,
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
{ stagingRefreshTimestamp:
|
|
1116
|
-
|
|
1113
|
+
y,
|
|
1114
|
+
C,
|
|
1115
|
+
{ stagingRefreshTimestamp: j, blocksInLimbo: M },
|
|
1116
|
+
N
|
|
1117
1117
|
] = await Promise.all([
|
|
1118
|
-
|
|
1118
|
+
s,
|
|
1119
1119
|
i,
|
|
1120
1120
|
n,
|
|
1121
1121
|
a,
|
|
@@ -1128,171 +1128,171 @@ class fe {
|
|
|
1128
1128
|
`Can't act on this project resource because it has a wrong schema version: ${g}`
|
|
1129
1129
|
);
|
|
1130
1130
|
const _ = /* @__PURE__ */ new Map();
|
|
1131
|
-
for (const
|
|
1132
|
-
const O =
|
|
1131
|
+
for (const v of d.fields) {
|
|
1132
|
+
const O = ro(v.name);
|
|
1133
1133
|
if (O === void 0) continue;
|
|
1134
1134
|
let F = _.get(O.blockId);
|
|
1135
1135
|
F === void 0 && (F = {
|
|
1136
1136
|
id: O.blockId,
|
|
1137
1137
|
fields: {}
|
|
1138
|
-
}, _.set(O.blockId, F)), F.fields[O.fieldName] =
|
|
1138
|
+
}, _.set(O.blockId, F)), F.fields[O.fieldName] = he(v.value) ? { modCount: 0 } : { modCount: 0, ref: v.value };
|
|
1139
1139
|
}
|
|
1140
|
-
const q = await Lt(), ce =
|
|
1141
|
-
(
|
|
1140
|
+
const q = await Lt(), ce = Ee(q.hash), S = d.fields.find(
|
|
1141
|
+
(v) => v.name === ce
|
|
1142
1142
|
);
|
|
1143
|
-
let
|
|
1144
|
-
|
|
1145
|
-
w(t,
|
|
1143
|
+
let V;
|
|
1144
|
+
S !== void 0 ? V = De(S.value) : (V = b.wrapInHolder(e, _e(e, q.spec)), e.createField(
|
|
1145
|
+
w(t, Ee(q.hash)),
|
|
1146
1146
|
"Dynamic",
|
|
1147
|
-
|
|
1147
|
+
V
|
|
1148
1148
|
));
|
|
1149
|
-
const Y = { stagingRefreshTimestamp:
|
|
1150
|
-
for (const
|
|
1151
|
-
const O =
|
|
1152
|
-
O !== void 0 && A.set(O,
|
|
1149
|
+
const Y = { stagingRefreshTimestamp: j }, E = new Set(M), A = /* @__PURE__ */ new Map();
|
|
1150
|
+
for (const v of N) {
|
|
1151
|
+
const O = Xr(v.key);
|
|
1152
|
+
O !== void 0 && A.set(O, v.value);
|
|
1153
1153
|
}
|
|
1154
1154
|
const B = [];
|
|
1155
|
-
_.forEach(({ id:
|
|
1155
|
+
_.forEach(({ id: v, fields: O }) => {
|
|
1156
1156
|
for (const [, F] of Object.entries(O))
|
|
1157
1157
|
if (F.ref !== void 0) {
|
|
1158
|
-
if (!
|
|
1158
|
+
if (!pr(F.ref) || gr(F.ref))
|
|
1159
1159
|
throw new Error("unexpected behaviour");
|
|
1160
1160
|
B.push([F, e.getResourceData(F.ref, !1)]);
|
|
1161
1161
|
}
|
|
1162
1162
|
});
|
|
1163
|
-
for (const [
|
|
1163
|
+
for (const [v, O] of B) {
|
|
1164
1164
|
const F = await O;
|
|
1165
|
-
|
|
1165
|
+
v.value = F.data, et(F.error) ? v.status = "Error" : F.resourceReady || et(F.originalResourceId) ? v.status = "Ready" : v.status = "NotReady";
|
|
1166
1166
|
}
|
|
1167
1167
|
const $ = /* @__PURE__ */ new Map();
|
|
1168
|
-
_.forEach(({ id:
|
|
1169
|
-
const
|
|
1170
|
-
for (const
|
|
1171
|
-
if (!$.has(
|
|
1172
|
-
throw new Error(`Inconsistent project structure: no inputs for ${
|
|
1173
|
-
|
|
1168
|
+
_.forEach(({ id: v, fields: O }) => $.set(v, new lt(v, O)));
|
|
1169
|
+
const L = /* @__PURE__ */ new Set();
|
|
1170
|
+
for (const v of U(C)) {
|
|
1171
|
+
if (!$.has(v.id))
|
|
1172
|
+
throw new Error(`Inconsistent project structure: no inputs for ${v.id}`);
|
|
1173
|
+
L.add(v.id);
|
|
1174
1174
|
}
|
|
1175
|
-
$.forEach((
|
|
1176
|
-
if (!
|
|
1177
|
-
throw new Error(`Inconsistent project structure: no structure entry for ${
|
|
1178
|
-
|
|
1175
|
+
$.forEach((v) => {
|
|
1176
|
+
if (!L.has(v.id))
|
|
1177
|
+
throw new Error(`Inconsistent project structure: no structure entry for ${v.id}`);
|
|
1178
|
+
v.check();
|
|
1179
1179
|
});
|
|
1180
|
-
const ue = new
|
|
1180
|
+
const ue = new me(
|
|
1181
1181
|
t,
|
|
1182
1182
|
e,
|
|
1183
1183
|
r,
|
|
1184
1184
|
g,
|
|
1185
1185
|
f,
|
|
1186
|
-
|
|
1187
|
-
|
|
1186
|
+
y,
|
|
1187
|
+
C,
|
|
1188
1188
|
Y,
|
|
1189
|
-
|
|
1189
|
+
E,
|
|
1190
1190
|
$,
|
|
1191
1191
|
A,
|
|
1192
|
-
|
|
1192
|
+
V
|
|
1193
1193
|
);
|
|
1194
1194
|
return ue.fixProblems(), ue;
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
|
-
async function
|
|
1198
|
-
const t =
|
|
1199
|
-
|
|
1197
|
+
async function No(o, e = zr) {
|
|
1198
|
+
const t = o.createEphemeral(qr);
|
|
1199
|
+
o.lock(t);
|
|
1200
1200
|
const r = String(Date.now());
|
|
1201
|
-
|
|
1202
|
-
const
|
|
1203
|
-
return
|
|
1204
|
-
w(t,
|
|
1201
|
+
o.setKValue(t, Dt, JSON.stringify(xt)), o.setKValue(t, Ge, r), o.setKValue(t, ie, r), o.setKValue(t, ne, JSON.stringify(e)), o.setKValue(t, z, JSON.stringify(Hr)), o.setKValue(t, fe, JSON.stringify(Wr));
|
|
1202
|
+
const s = await Lt();
|
|
1203
|
+
return o.createField(
|
|
1204
|
+
w(t, Ee(s.hash)),
|
|
1205
1205
|
"Dynamic",
|
|
1206
|
-
b.wrapInHolder(
|
|
1206
|
+
b.wrapInHolder(o, _e(o, s.spec))
|
|
1207
1207
|
), t;
|
|
1208
1208
|
}
|
|
1209
|
-
async function
|
|
1210
|
-
return
|
|
1209
|
+
async function Be(o, e, t) {
|
|
1210
|
+
return J(o, e, void 0, t);
|
|
1211
1211
|
}
|
|
1212
|
-
async function
|
|
1213
|
-
if (
|
|
1214
|
-
return await
|
|
1215
|
-
const i = await
|
|
1216
|
-
return i.wasModified && (i.save(), await
|
|
1212
|
+
async function J(o, e, t, r) {
|
|
1213
|
+
if (o instanceof dr)
|
|
1214
|
+
return await o.withWriteTx("ProjectAction", async (s) => {
|
|
1215
|
+
const i = await me.load(s, e, t), n = await r(i);
|
|
1216
|
+
return i.wasModified && (i.save(), await s.commit()), n;
|
|
1217
1217
|
});
|
|
1218
1218
|
{
|
|
1219
|
-
const
|
|
1220
|
-
return
|
|
1219
|
+
const s = await me.load(o, e, t), i = await r(s);
|
|
1220
|
+
return s.save(), i;
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
|
-
function*
|
|
1224
|
-
switch (
|
|
1223
|
+
function* Vo(o) {
|
|
1224
|
+
switch (o.type) {
|
|
1225
1225
|
case "Json":
|
|
1226
1226
|
return;
|
|
1227
1227
|
case "JsonPartitioned":
|
|
1228
|
-
for (const [, e] of Object.entries(
|
|
1228
|
+
for (const [, e] of Object.entries(o.parts)) yield e;
|
|
1229
1229
|
return;
|
|
1230
1230
|
case "BinaryPartitioned":
|
|
1231
|
-
for (const [, { index: e, values: t }] of Object.entries(
|
|
1231
|
+
for (const [, { index: e, values: t }] of Object.entries(o.parts))
|
|
1232
1232
|
yield e, yield t;
|
|
1233
1233
|
return;
|
|
1234
1234
|
default:
|
|
1235
|
-
D(
|
|
1235
|
+
D(o);
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function dt(o, e) {
|
|
1239
1239
|
return Object.fromEntries(
|
|
1240
|
-
Object.entries(
|
|
1240
|
+
Object.entries(o).map(([t, r]) => [t, e(r, t)])
|
|
1241
1241
|
);
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
switch (
|
|
1243
|
+
function Lo(o, e) {
|
|
1244
|
+
switch (o.type) {
|
|
1245
1245
|
case "Json":
|
|
1246
|
-
return { ...
|
|
1246
|
+
return { ...o };
|
|
1247
1247
|
case "JsonPartitioned":
|
|
1248
|
-
return { ...
|
|
1248
|
+
return { ...o, parts: dt(o.parts, e) };
|
|
1249
1249
|
case "BinaryPartitioned":
|
|
1250
1250
|
return {
|
|
1251
|
-
...
|
|
1252
|
-
parts:
|
|
1251
|
+
...o,
|
|
1252
|
+
parts: dt(o.parts, (t) => ({
|
|
1253
1253
|
index: e(t.index),
|
|
1254
1254
|
values: e(t.values)
|
|
1255
1255
|
}))
|
|
1256
1256
|
};
|
|
1257
1257
|
default:
|
|
1258
|
-
D(
|
|
1258
|
+
D(o);
|
|
1259
1259
|
}
|
|
1260
1260
|
}
|
|
1261
|
-
const
|
|
1261
|
+
const Jo = ae("PColumnData/JsonPartitioned", "1"), Uo = ae(
|
|
1262
1262
|
"PColumnData/Partitioned/JsonPartitioned",
|
|
1263
1263
|
"1"
|
|
1264
|
-
),
|
|
1264
|
+
), Mo = ae("PColumnData/BinaryPartitioned", "1"), $o = ae(
|
|
1265
1265
|
"PColumnData/Partitioned/BinaryPartitioned",
|
|
1266
1266
|
"1"
|
|
1267
|
-
),
|
|
1268
|
-
function
|
|
1269
|
-
if (!
|
|
1270
|
-
const e =
|
|
1267
|
+
), Ko = ae("PColumnData/Json", "1");
|
|
1268
|
+
function Go(o) {
|
|
1269
|
+
if (!o.getIsReadyOrError()) throw new Error("Data not ready.");
|
|
1270
|
+
const e = o.getDataAsJson();
|
|
1271
1271
|
if (e === void 0)
|
|
1272
1272
|
throw new Error("unexpected data info structure, no resource data");
|
|
1273
|
-
if (G(
|
|
1273
|
+
if (G(o.resourceType, Ko)) {
|
|
1274
1274
|
const t = e;
|
|
1275
1275
|
return {
|
|
1276
1276
|
type: "Json",
|
|
1277
1277
|
keyLength: t.keyLength,
|
|
1278
1278
|
data: t.data
|
|
1279
1279
|
};
|
|
1280
|
-
} else if (G(
|
|
1280
|
+
} else if (G(o.resourceType, Jo)) {
|
|
1281
1281
|
const t = e, r = Object.fromEntries(
|
|
1282
|
-
|
|
1282
|
+
o.listInputFields().map((s) => [s, o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo])
|
|
1283
1283
|
);
|
|
1284
1284
|
return {
|
|
1285
1285
|
type: "JsonPartitioned",
|
|
1286
1286
|
partitionKeyLength: t.partitionKeyLength,
|
|
1287
1287
|
parts: r
|
|
1288
1288
|
};
|
|
1289
|
-
} else if (G(
|
|
1289
|
+
} else if (G(o.resourceType, Uo)) {
|
|
1290
1290
|
const t = e, r = {};
|
|
1291
|
-
for (const
|
|
1292
|
-
const i =
|
|
1293
|
-
if (n === void 0) throw new Error(`no partition keys for super key ${
|
|
1291
|
+
for (const s of o.listInputFields()) {
|
|
1292
|
+
const i = o.traverse({ field: s, errorIfFieldNotSet: !0 }), n = i.listInputFields();
|
|
1293
|
+
if (n === void 0) throw new Error(`no partition keys for super key ${s}`);
|
|
1294
1294
|
for (const a of n) {
|
|
1295
|
-
const c = JSON.stringify([...JSON.parse(
|
|
1295
|
+
const c = JSON.stringify([...JSON.parse(s), ...JSON.parse(a)]);
|
|
1296
1296
|
r[c] = i.traverse({ field: a, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
@@ -1301,42 +1301,42 @@ function Ko(s) {
|
|
|
1301
1301
|
partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
|
|
1302
1302
|
parts: r
|
|
1303
1303
|
};
|
|
1304
|
-
} else if (G(
|
|
1304
|
+
} else if (G(o.resourceType, Mo)) {
|
|
1305
1305
|
const t = e, r = {};
|
|
1306
|
-
for (const
|
|
1307
|
-
if (
|
|
1308
|
-
const i =
|
|
1306
|
+
for (const s of o.listInputFields())
|
|
1307
|
+
if (s.endsWith(".index")) {
|
|
1308
|
+
const i = s.slice(0, s.length - 6);
|
|
1309
1309
|
let n = r[i];
|
|
1310
|
-
n === void 0 && (n = {}, r[i] = n), n.index =
|
|
1311
|
-
} else if (
|
|
1312
|
-
const i =
|
|
1310
|
+
n === void 0 && (n = {}, r[i] = n), n.index = o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1311
|
+
} else if (s.endsWith(".values")) {
|
|
1312
|
+
const i = s.slice(0, s.length - 7);
|
|
1313
1313
|
let n = r[i];
|
|
1314
|
-
n === void 0 && (n = {}, r[i] = n), n.values =
|
|
1315
|
-
} else throw new Error(`unrecognized part field name: ${
|
|
1316
|
-
for (const [
|
|
1317
|
-
if (i.index === void 0) throw new Error(`no index for part ${
|
|
1318
|
-
if (i.values === void 0) throw new Error(`no values for part ${
|
|
1314
|
+
n === void 0 && (n = {}, r[i] = n), n.values = o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1315
|
+
} else throw new Error(`unrecognized part field name: ${s}`);
|
|
1316
|
+
for (const [s, i] of Object.entries(r)) {
|
|
1317
|
+
if (i.index === void 0) throw new Error(`no index for part ${s}`);
|
|
1318
|
+
if (i.values === void 0) throw new Error(`no values for part ${s}`);
|
|
1319
1319
|
}
|
|
1320
1320
|
return {
|
|
1321
1321
|
type: "BinaryPartitioned",
|
|
1322
1322
|
partitionKeyLength: t.partitionKeyLength,
|
|
1323
1323
|
parts: r
|
|
1324
1324
|
};
|
|
1325
|
-
} else if (G(
|
|
1325
|
+
} else if (G(o.resourceType, $o)) {
|
|
1326
1326
|
const t = e, r = {};
|
|
1327
|
-
for (const
|
|
1328
|
-
const i =
|
|
1329
|
-
if (n === void 0) throw new Error(`no partition keys for super key ${
|
|
1327
|
+
for (const s of o.listInputFields()) {
|
|
1328
|
+
const i = o.traverse({ field: s, errorIfFieldNotSet: !0 }), n = i.listInputFields();
|
|
1329
|
+
if (n === void 0) throw new Error(`no partition keys for super key ${s}`);
|
|
1330
1330
|
for (const a of n)
|
|
1331
1331
|
if (a.endsWith(".index")) {
|
|
1332
|
-
const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(
|
|
1332
|
+
const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
|
|
1333
1333
|
let l = r[u];
|
|
1334
1334
|
l === void 0 && (l = {}, r[u] = l), r[u].index = i.traverse({
|
|
1335
1335
|
field: a,
|
|
1336
1336
|
errorIfFieldNotSet: !0
|
|
1337
1337
|
}).resourceInfo;
|
|
1338
1338
|
} else if (a.endsWith(".values")) {
|
|
1339
|
-
const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(
|
|
1339
|
+
const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
|
|
1340
1340
|
let l = r[u];
|
|
1341
1341
|
l === void 0 && (l = {}, r[u] = l), r[u].values = i.traverse({
|
|
1342
1342
|
field: a,
|
|
@@ -1350,39 +1350,39 @@ function Ko(s) {
|
|
|
1350
1350
|
parts: r
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
|
-
throw new Error(`unsupported resource type: ${
|
|
1353
|
+
throw new Error(`unsupported resource type: ${hr(o.resourceType)}`);
|
|
1354
1354
|
}
|
|
1355
|
-
function
|
|
1356
|
-
const t =
|
|
1357
|
-
return t.update(
|
|
1355
|
+
function Le(o, e) {
|
|
1356
|
+
const t = be("sha256");
|
|
1357
|
+
return t.update(Ue(o)), t.update(String(he(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
|
|
1358
1358
|
}
|
|
1359
|
-
function Jt(
|
|
1359
|
+
function Jt(o, e = !0, t = !1, r = "") {
|
|
1360
1360
|
var a, c, u;
|
|
1361
|
-
const
|
|
1362
|
-
for (const l of
|
|
1363
|
-
const d = l.match(
|
|
1361
|
+
const s = /^(?<name>.*)\.(?<type>spec|data)$/, i = /* @__PURE__ */ new Map();
|
|
1362
|
+
for (const l of o.listInputFields()) {
|
|
1363
|
+
const d = l.match(s);
|
|
1364
1364
|
if (!d) {
|
|
1365
1365
|
if (e) throw new Error(`unexpected field name ${l}`);
|
|
1366
1366
|
continue;
|
|
1367
1367
|
}
|
|
1368
|
-
let g =
|
|
1368
|
+
let g = k((a = d.groups) == null ? void 0 : a.name);
|
|
1369
1369
|
if (!g.startsWith(r)) {
|
|
1370
1370
|
if (e) throw new Error(`unexpected field name ${l}`);
|
|
1371
1371
|
continue;
|
|
1372
1372
|
}
|
|
1373
1373
|
g = g.slice(r.length);
|
|
1374
|
-
const f =
|
|
1375
|
-
let
|
|
1376
|
-
switch (
|
|
1374
|
+
const f = k((c = d.groups) == null ? void 0 : c.type);
|
|
1375
|
+
let y = i.get(g);
|
|
1376
|
+
switch (y === void 0 && (y = {}, i.set(g, y)), f) {
|
|
1377
1377
|
case "spec":
|
|
1378
|
-
|
|
1378
|
+
y.spec = (u = o.traverse({
|
|
1379
1379
|
field: l,
|
|
1380
1380
|
ignoreError: t,
|
|
1381
1381
|
pureFieldErrorToUndefined: t
|
|
1382
1382
|
})) == null ? void 0 : u.getDataAsJson();
|
|
1383
1383
|
break;
|
|
1384
1384
|
case "data":
|
|
1385
|
-
|
|
1385
|
+
y.hasData = !0, y.data = () => o.traverseOrError({
|
|
1386
1386
|
field: l,
|
|
1387
1387
|
ignoreError: t
|
|
1388
1388
|
});
|
|
@@ -1390,38 +1390,38 @@ function Jt(s, e = !0, t = !1, r = "") {
|
|
|
1390
1390
|
continue;
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
|
-
const n =
|
|
1393
|
+
const n = o.getInputsLocked();
|
|
1394
1394
|
if (n)
|
|
1395
1395
|
for (const [, l] of i) l.data === void 0 && (l.hasData = !1);
|
|
1396
1396
|
return { locked: n, results: i };
|
|
1397
1397
|
}
|
|
1398
|
-
function
|
|
1399
|
-
if (!
|
|
1400
|
-
const r = Jt(
|
|
1401
|
-
|
|
1402
|
-
const
|
|
1398
|
+
function _o(o, e = !0, t = "") {
|
|
1399
|
+
if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
|
|
1400
|
+
const r = Jt(o, e, !1, t);
|
|
1401
|
+
Cr(r.locked);
|
|
1402
|
+
const s = {};
|
|
1403
1403
|
for (const [i, n] of r.results) {
|
|
1404
1404
|
if (n.spec === void 0) throw new Error(`no spec for key ${i}`);
|
|
1405
1405
|
if (n.hasData !== !0 || n.data === void 0)
|
|
1406
1406
|
throw new Error(`no data for key ${i}`);
|
|
1407
1407
|
const a = n.data();
|
|
1408
1408
|
if (a === void 0) throw new Error(`no data for key ${i}`);
|
|
1409
|
-
if (!a.ok) throw new
|
|
1410
|
-
|
|
1411
|
-
id:
|
|
1409
|
+
if (!a.ok) throw new br(a.error);
|
|
1410
|
+
s[i] = {
|
|
1411
|
+
id: Le(n.spec, a.value),
|
|
1412
1412
|
spec: n.spec,
|
|
1413
1413
|
data: a.value
|
|
1414
1414
|
};
|
|
1415
1415
|
}
|
|
1416
|
-
return
|
|
1416
|
+
return s;
|
|
1417
1417
|
}
|
|
1418
|
-
class
|
|
1418
|
+
class He {
|
|
1419
1419
|
constructor(e, t) {
|
|
1420
1420
|
p(this, "allSpecsAvailable");
|
|
1421
1421
|
this.ctx = e, this.blocks = t;
|
|
1422
1422
|
let r = !0;
|
|
1423
|
-
e: for (const
|
|
1424
|
-
for (const i of [
|
|
1423
|
+
e: for (const s of t.values())
|
|
1424
|
+
for (const i of [s.prod, s.staging])
|
|
1425
1425
|
if (i !== void 0) {
|
|
1426
1426
|
if (!i.locked) {
|
|
1427
1427
|
r = !1;
|
|
@@ -1439,22 +1439,22 @@ class _e {
|
|
|
1439
1439
|
var i, n, a, c, u, l;
|
|
1440
1440
|
const r = this.blocks.get(e);
|
|
1441
1441
|
if (r === void 0) return;
|
|
1442
|
-
let
|
|
1443
|
-
if (
|
|
1442
|
+
let s = (a = (n = (i = r.prod) == null ? void 0 : i.results) == null ? void 0 : n.get(t)) == null ? void 0 : a.spec;
|
|
1443
|
+
if (s !== void 0 || (s = (l = (u = (c = r.staging) == null ? void 0 : c.results) == null ? void 0 : u.get(t)) == null ? void 0 : l.spec, s !== void 0)) return s;
|
|
1444
1444
|
r.staging === void 0 ? this.ctx.markUnstable(`staging_not_rendered:${e}`) : r.staging.locked ? r.prod !== void 0 && !r.prod.locked && this.ctx.markUnstable(`prod_not_locked:${e}`) : this.ctx.markUnstable(`staging_not_locked:${e}`);
|
|
1445
1445
|
}
|
|
1446
1446
|
getDataOrErrorByRef(e, t) {
|
|
1447
1447
|
var n, a, c;
|
|
1448
1448
|
const r = this.blocks.get(e);
|
|
1449
1449
|
if (r === void 0) return;
|
|
1450
|
-
let
|
|
1451
|
-
if (
|
|
1450
|
+
let s = (a = (n = r.prod) == null ? void 0 : n.results) == null ? void 0 : a.get(t), i = (c = s == null ? void 0 : s.data) == null ? void 0 : c.call(s);
|
|
1451
|
+
if (s !== void 0 && s.spec !== void 0 && i !== void 0)
|
|
1452
1452
|
return yt(i, (u) => ({
|
|
1453
|
-
id:
|
|
1454
|
-
spec:
|
|
1453
|
+
id: Le(s.spec, u),
|
|
1454
|
+
spec: s.spec,
|
|
1455
1455
|
data: u
|
|
1456
1456
|
}));
|
|
1457
|
-
|
|
1457
|
+
s !== void 0 && this.ctx.markUnstable(`no_data:${e}:${t}`), r.prod !== void 0 && !r.prod.locked && this.ctx.markUnstable(`prod_not_locked:${e}`);
|
|
1458
1458
|
}
|
|
1459
1459
|
getDataByRef(e, t) {
|
|
1460
1460
|
const r = this.getDataOrErrorByRef(e, t);
|
|
@@ -1481,7 +1481,7 @@ class _e {
|
|
|
1481
1481
|
getDataWithErrors() {
|
|
1482
1482
|
const e = [];
|
|
1483
1483
|
let t = !0, r;
|
|
1484
|
-
const
|
|
1484
|
+
const s = (n) => {
|
|
1485
1485
|
r === void 0 && (r = n), t = !1;
|
|
1486
1486
|
}, i = (n, a, c) => {
|
|
1487
1487
|
if (c.spec !== void 0 && c.hasData === !0 && c.data !== void 0) {
|
|
@@ -1489,22 +1489,22 @@ class _e {
|
|
|
1489
1489
|
u !== void 0 ? e.push({
|
|
1490
1490
|
ref: le(n, a),
|
|
1491
1491
|
obj: {
|
|
1492
|
-
id: u.ok ?
|
|
1492
|
+
id: u.ok ? Le(c.spec, u.value) : void 0,
|
|
1493
1493
|
spec: c.spec,
|
|
1494
1494
|
data: u
|
|
1495
1495
|
}
|
|
1496
|
-
}) :
|
|
1496
|
+
}) : s(`no_data:${n}:${a}`);
|
|
1497
1497
|
}
|
|
1498
1498
|
};
|
|
1499
1499
|
for (const [n, a] of this.blocks) {
|
|
1500
1500
|
const c = /* @__PURE__ */ new Set();
|
|
1501
1501
|
if (a.prod !== void 0) {
|
|
1502
|
-
a.prod.locked ||
|
|
1502
|
+
a.prod.locked || s(`prod_not_locked:${n}`);
|
|
1503
1503
|
for (const [u, l] of a.prod.results)
|
|
1504
1504
|
c.add(u), i(n, u, l);
|
|
1505
1505
|
}
|
|
1506
1506
|
if (a.staging !== void 0) {
|
|
1507
|
-
a.staging.locked ||
|
|
1507
|
+
a.staging.locked || s(`staging_not_locked:${n}`);
|
|
1508
1508
|
for (const [u, l] of a.staging.results)
|
|
1509
1509
|
c.has(u) || i(n, u, l);
|
|
1510
1510
|
}
|
|
@@ -1514,21 +1514,21 @@ class _e {
|
|
|
1514
1514
|
getSpecs() {
|
|
1515
1515
|
const e = [];
|
|
1516
1516
|
let t = !0, r;
|
|
1517
|
-
const
|
|
1517
|
+
const s = (i) => {
|
|
1518
1518
|
r === void 0 && (r = i), t = !1;
|
|
1519
1519
|
};
|
|
1520
1520
|
for (const [i, n] of this.blocks) {
|
|
1521
1521
|
const a = /* @__PURE__ */ new Set();
|
|
1522
1522
|
if (n.staging !== void 0) {
|
|
1523
|
-
n.staging.locked ||
|
|
1523
|
+
n.staging.locked || s(`staging_not_locked:${i}`);
|
|
1524
1524
|
for (const [c, u] of n.staging.results)
|
|
1525
1525
|
u.spec !== void 0 && (e.push({
|
|
1526
1526
|
ref: le(i, c),
|
|
1527
1527
|
obj: u.spec
|
|
1528
1528
|
}), a.add(c));
|
|
1529
|
-
} else
|
|
1529
|
+
} else s(`staging_not_rendered:${i}`);
|
|
1530
1530
|
if (n.prod !== void 0) {
|
|
1531
|
-
n.prod.locked ||
|
|
1531
|
+
n.prod.locked || s(`prod_not_locked:${i}`);
|
|
1532
1532
|
for (const [c, u] of n.prod.results)
|
|
1533
1533
|
a.has(c) || u.spec !== void 0 && e.push({
|
|
1534
1534
|
ref: le(i, c),
|
|
@@ -1541,9 +1541,9 @@ class _e {
|
|
|
1541
1541
|
calculateOptions(e) {
|
|
1542
1542
|
const t = [];
|
|
1543
1543
|
for (const r of this.blocks.values()) {
|
|
1544
|
-
const
|
|
1544
|
+
const s = /* @__PURE__ */ new Set(), i = (n) => {
|
|
1545
1545
|
for (const [a, c] of n.results)
|
|
1546
|
-
|
|
1546
|
+
s.has(a) || c.spec === void 0 || (s.add(a), tr(e, c.spec) && t.push({
|
|
1547
1547
|
label: r.info.label + " / " + a,
|
|
1548
1548
|
ref: le(r.info.id, a),
|
|
1549
1549
|
spec: c.spec
|
|
@@ -1554,103 +1554,101 @@ class _e {
|
|
|
1554
1554
|
return t;
|
|
1555
1555
|
}
|
|
1556
1556
|
static create(e, t, r) {
|
|
1557
|
-
const
|
|
1558
|
-
for (const u of
|
|
1557
|
+
const s = e.accessor(t).node(), i = k(s.getKeyValueAsJson(z)), a = Ne(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
|
|
1558
|
+
for (const u of U(i)) {
|
|
1559
1559
|
if (!a.has(u.id)) continue;
|
|
1560
|
-
const l =
|
|
1561
|
-
|
|
1560
|
+
const l = pt(
|
|
1561
|
+
s.traverse({
|
|
1562
1562
|
field: P(u.id, "prodCtx"),
|
|
1563
1563
|
ignoreError: !0,
|
|
1564
1564
|
pureFieldErrorToUndefined: !0,
|
|
1565
1565
|
stableIfNotFound: !0
|
|
1566
1566
|
}) !== void 0,
|
|
1567
|
-
|
|
1567
|
+
s.traverseOrError({
|
|
1568
1568
|
field: P(u.id, "prodUiCtx"),
|
|
1569
1569
|
stableIfNotFound: !0
|
|
1570
1570
|
})
|
|
1571
|
-
), d =
|
|
1572
|
-
|
|
1571
|
+
), d = pt(
|
|
1572
|
+
s.traverse({
|
|
1573
1573
|
field: P(u.id, "stagingCtx"),
|
|
1574
1574
|
ignoreError: !0,
|
|
1575
1575
|
pureFieldErrorToUndefined: !0
|
|
1576
1576
|
}) !== void 0,
|
|
1577
|
-
|
|
1577
|
+
s.traverseOrError({
|
|
1578
1578
|
field: P(u.id, "stagingUiCtx")
|
|
1579
1579
|
})
|
|
1580
1580
|
);
|
|
1581
1581
|
c.set(u.id, { info: u, prod: l, staging: d });
|
|
1582
1582
|
}
|
|
1583
|
-
return new
|
|
1583
|
+
return new He(e, c);
|
|
1584
1584
|
}
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1586
|
+
function pt(o, e) {
|
|
1587
1587
|
if (e === void 0)
|
|
1588
|
-
return
|
|
1588
|
+
return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
|
|
1589
1589
|
if (e.ok) return Jt(e.value, !1, !0);
|
|
1590
1590
|
}
|
|
1591
|
-
function
|
|
1592
|
-
const t = s.persist(), r = C(
|
|
1593
|
-
s.traverse({
|
|
1594
|
-
field: P(e, "currentArgs"),
|
|
1595
|
-
errorIfFieldNotSet: !0
|
|
1596
|
-
}).getDataAsString()
|
|
1597
|
-
), o = s.getKeyValueAsString(xe(e));
|
|
1591
|
+
function We(o, e) {
|
|
1598
1592
|
return {
|
|
1599
1593
|
blockId: e,
|
|
1600
|
-
args:
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1594
|
+
args: (s) => k(
|
|
1595
|
+
s.accessor(o).node().traverse({
|
|
1596
|
+
field: P(e, "currentArgs"),
|
|
1597
|
+
errorIfFieldNotSet: !0
|
|
1598
|
+
}).getDataAsString()
|
|
1599
|
+
),
|
|
1600
|
+
uiState: (s) => s.accessor(o).node().getKeyValueAsString(Ae(e)),
|
|
1601
|
+
blockMeta: (s) => {
|
|
1602
|
+
const i = s.accessor(o).node(), n = k(i.getKeyValueAsJson(z)), a = /* @__PURE__ */ new Map();
|
|
1603
|
+
for (const c of U(n)) a.set(c.id, c);
|
|
1604
|
+
return a;
|
|
1606
1605
|
}
|
|
1607
1606
|
};
|
|
1608
1607
|
}
|
|
1609
|
-
function Ut(
|
|
1610
|
-
const t = s.persist();
|
|
1608
|
+
function Ut(o, e) {
|
|
1611
1609
|
return {
|
|
1612
|
-
...
|
|
1613
|
-
prod: (
|
|
1614
|
-
var
|
|
1615
|
-
return (
|
|
1610
|
+
...We(o, e),
|
|
1611
|
+
prod: (t) => {
|
|
1612
|
+
var r;
|
|
1613
|
+
return (r = t.accessor(o).node({ ignoreError: !0 }).traverse({
|
|
1616
1614
|
field: P(e, "prodOutput"),
|
|
1617
1615
|
stableIfNotFound: !0,
|
|
1618
1616
|
ignoreError: !0
|
|
1619
|
-
})) == null ? void 0 :
|
|
1617
|
+
})) == null ? void 0 : r.persist();
|
|
1620
1618
|
},
|
|
1621
|
-
staging: (
|
|
1622
|
-
var
|
|
1623
|
-
const
|
|
1619
|
+
staging: (t) => {
|
|
1620
|
+
var s;
|
|
1621
|
+
const r = (s = t.accessor(o).node({ ignoreError: !0 }).traverse({
|
|
1624
1622
|
field: P(e, "stagingOutput"),
|
|
1625
1623
|
ignoreError: !0
|
|
1626
|
-
})) == null ? void 0 :
|
|
1627
|
-
return
|
|
1624
|
+
})) == null ? void 0 : s.persist();
|
|
1625
|
+
return r === void 0 && t.markUnstable("staging_not_rendered"), r;
|
|
1628
1626
|
},
|
|
1629
|
-
getResultsPool: (
|
|
1627
|
+
getResultsPool: (t) => He.create(t, o, e)
|
|
1630
1628
|
};
|
|
1631
1629
|
}
|
|
1632
|
-
function*
|
|
1633
|
-
switch (yield
|
|
1630
|
+
function* T(o, e) {
|
|
1631
|
+
switch (yield o, o.type) {
|
|
1634
1632
|
case "GetFromCtx":
|
|
1635
1633
|
case "Immediate":
|
|
1636
1634
|
return;
|
|
1637
1635
|
case "Isolate":
|
|
1638
|
-
yield*
|
|
1636
|
+
yield* T(o.cfg);
|
|
1639
1637
|
return;
|
|
1640
1638
|
case "MakeObject":
|
|
1641
|
-
for (const [, t] of Object.entries(
|
|
1639
|
+
for (const [, t] of Object.entries(o.template)) yield* T(t);
|
|
1642
1640
|
return;
|
|
1643
1641
|
case "MakeArray":
|
|
1644
|
-
for (const t of
|
|
1642
|
+
for (const t of o.template) yield* T(t);
|
|
1645
1643
|
return;
|
|
1646
1644
|
case "GetJsonField":
|
|
1647
1645
|
case "GetResourceField":
|
|
1648
|
-
yield*
|
|
1646
|
+
yield* T(o.source), yield* T(o.field);
|
|
1649
1647
|
return;
|
|
1650
1648
|
case "MapRecordValues":
|
|
1651
1649
|
case "MapArrayValues":
|
|
1652
1650
|
case "MapResourceFields":
|
|
1653
|
-
yield*
|
|
1651
|
+
yield* T(o.source), yield* T(o.mapping);
|
|
1654
1652
|
return;
|
|
1655
1653
|
case "Flatten":
|
|
1656
1654
|
case "GetResourceValueAsJson":
|
|
@@ -1663,152 +1661,152 @@ function* j(s, e) {
|
|
|
1663
1661
|
case "GetLastLogs":
|
|
1664
1662
|
case "GetProgressLog":
|
|
1665
1663
|
case "GetLogHandle":
|
|
1666
|
-
yield*
|
|
1664
|
+
yield* T(o.source);
|
|
1667
1665
|
return;
|
|
1668
1666
|
case "IsEmpty":
|
|
1669
|
-
yield*
|
|
1667
|
+
yield* T(o.arg);
|
|
1670
1668
|
return;
|
|
1671
1669
|
case "Not":
|
|
1672
|
-
yield*
|
|
1670
|
+
yield* T(o.operand);
|
|
1673
1671
|
return;
|
|
1674
1672
|
case "And":
|
|
1675
1673
|
case "Or":
|
|
1676
|
-
yield*
|
|
1674
|
+
yield* T(o.operand1), yield* T(o.operand2);
|
|
1677
1675
|
return;
|
|
1678
1676
|
default:
|
|
1679
|
-
D(
|
|
1677
|
+
D(o);
|
|
1680
1678
|
}
|
|
1681
1679
|
}
|
|
1682
|
-
function
|
|
1680
|
+
function Ho(o, e) {
|
|
1683
1681
|
const t = {};
|
|
1684
|
-
for (const [r,
|
|
1682
|
+
for (const [r, s] of Object.entries(o)) t[r] = e(s);
|
|
1685
1683
|
return t;
|
|
1686
1684
|
}
|
|
1687
|
-
function te(
|
|
1688
|
-
return
|
|
1685
|
+
function te(o, e) {
|
|
1686
|
+
return o === void 0 ? void 0 : e(o);
|
|
1689
1687
|
}
|
|
1690
|
-
function
|
|
1691
|
-
switch (
|
|
1688
|
+
function Wo(o) {
|
|
1689
|
+
switch (o.type) {
|
|
1692
1690
|
case "GetImportProgress":
|
|
1693
1691
|
return !0;
|
|
1694
1692
|
default:
|
|
1695
1693
|
return !1;
|
|
1696
1694
|
}
|
|
1697
1695
|
}
|
|
1698
|
-
function
|
|
1699
|
-
for (const e of
|
|
1696
|
+
function zo(o) {
|
|
1697
|
+
for (const e of T(o)) if (Wo(e)) return !0;
|
|
1700
1698
|
return !1;
|
|
1701
1699
|
}
|
|
1702
|
-
function
|
|
1700
|
+
function we(o) {
|
|
1703
1701
|
return {
|
|
1704
1702
|
type: "ReturnResult",
|
|
1705
|
-
result:
|
|
1703
|
+
result: o
|
|
1706
1704
|
};
|
|
1707
1705
|
}
|
|
1708
|
-
function h(
|
|
1709
|
-
return () =>
|
|
1706
|
+
function h(o) {
|
|
1707
|
+
return () => we(o);
|
|
1710
1708
|
}
|
|
1711
|
-
const
|
|
1709
|
+
const qo = (o) => {
|
|
1712
1710
|
const e = {};
|
|
1713
|
-
for (const [t, r] of Object.entries(
|
|
1711
|
+
for (const [t, r] of Object.entries(o)) e[t] = r;
|
|
1714
1712
|
return h(e);
|
|
1715
|
-
},
|
|
1716
|
-
const e =
|
|
1713
|
+
}, Yo = (o) => {
|
|
1714
|
+
const e = o.source;
|
|
1717
1715
|
if (e === void 0) return h(void 0);
|
|
1718
1716
|
const t = [];
|
|
1719
1717
|
for (const r of e)
|
|
1720
1718
|
r instanceof Array ? t.push(...r) : t.push(r);
|
|
1721
1719
|
return h(t);
|
|
1722
|
-
},
|
|
1723
|
-
const e =
|
|
1720
|
+
}, Qo = (o) => {
|
|
1721
|
+
const e = o.source, t = o.field;
|
|
1724
1722
|
return e === void 0 || t === void 0 ? h(void 0) : ({ cCtx: r }) => {
|
|
1725
|
-
var
|
|
1726
|
-
return
|
|
1723
|
+
var s;
|
|
1724
|
+
return we((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
|
|
1727
1725
|
};
|
|
1728
1726
|
};
|
|
1729
|
-
function Mt(
|
|
1730
|
-
const t = {}, r =
|
|
1731
|
-
for (let
|
|
1727
|
+
function Mt(o, e) {
|
|
1728
|
+
const t = {}, r = o.length;
|
|
1729
|
+
for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
|
|
1732
1730
|
return t;
|
|
1733
1731
|
}
|
|
1734
|
-
function
|
|
1732
|
+
function Zo(o, e) {
|
|
1735
1733
|
return (t) => {
|
|
1736
1734
|
const r = t.source;
|
|
1737
1735
|
return r === void 0 ? h(void 0) : () => ({
|
|
1738
1736
|
type: "ScheduleSubroutine",
|
|
1739
1737
|
subroutine: $t(r.length),
|
|
1740
|
-
args: Mt(r, (
|
|
1738
|
+
args: Mt(r, (s) => m({ ...o, [e.itVar]: s }, e.mapping))
|
|
1741
1739
|
});
|
|
1742
1740
|
};
|
|
1743
1741
|
}
|
|
1744
|
-
function $t(
|
|
1742
|
+
function $t(o) {
|
|
1745
1743
|
return (e) => {
|
|
1746
1744
|
const t = [];
|
|
1747
|
-
for (let r = 0; r <
|
|
1745
|
+
for (let r = 0; r < o; r++) t.push(e[String(r)]);
|
|
1748
1746
|
return h(t);
|
|
1749
1747
|
};
|
|
1750
1748
|
}
|
|
1751
|
-
function
|
|
1749
|
+
function Xo(o, e) {
|
|
1752
1750
|
return (t) => {
|
|
1753
1751
|
const r = t.source;
|
|
1754
1752
|
if (r === void 0) return h(void 0);
|
|
1755
|
-
const
|
|
1753
|
+
const s = {};
|
|
1756
1754
|
for (const [i, n] of Object.entries(r)) {
|
|
1757
|
-
const a = { ...
|
|
1758
|
-
|
|
1755
|
+
const a = { ...o, [e.itVar]: n };
|
|
1756
|
+
s[i] = m(a, e.mapping);
|
|
1759
1757
|
}
|
|
1760
1758
|
return () => ({
|
|
1761
1759
|
type: "ScheduleSubroutine",
|
|
1762
|
-
subroutine:
|
|
1763
|
-
args:
|
|
1760
|
+
subroutine: es,
|
|
1761
|
+
args: s
|
|
1764
1762
|
});
|
|
1765
1763
|
};
|
|
1766
1764
|
}
|
|
1767
|
-
const
|
|
1768
|
-
const e =
|
|
1765
|
+
const es = (o) => h(o), ts = (o) => {
|
|
1766
|
+
const e = o.arg;
|
|
1769
1767
|
return h(e === void 0 ? void 0 : e.length === 0);
|
|
1770
|
-
},
|
|
1771
|
-
const e =
|
|
1768
|
+
}, rs = (o) => {
|
|
1769
|
+
const e = o.operand;
|
|
1772
1770
|
return h(e === void 0 ? void 0 : !e);
|
|
1773
|
-
},
|
|
1774
|
-
const e =
|
|
1771
|
+
}, os = (o) => {
|
|
1772
|
+
const e = o.operand1, t = o.operand2;
|
|
1775
1773
|
return h(e === void 0 || t === void 0 ? void 0 : e && t);
|
|
1776
|
-
},
|
|
1777
|
-
const e =
|
|
1774
|
+
}, ss = (o) => {
|
|
1775
|
+
const e = o.operand1, t = o.operand2;
|
|
1778
1776
|
return h(e === void 0 || t === void 0 ? void 0 : e || t);
|
|
1779
|
-
},
|
|
1780
|
-
const e =
|
|
1777
|
+
}, is = (o) => {
|
|
1778
|
+
const e = o.source;
|
|
1781
1779
|
return e === void 0 ? h(void 0) : ({ cCtx: t }) => {
|
|
1782
1780
|
var r;
|
|
1783
|
-
return
|
|
1781
|
+
return we((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
|
|
1784
1782
|
};
|
|
1785
|
-
},
|
|
1786
|
-
const e =
|
|
1783
|
+
}, ns = (o) => {
|
|
1784
|
+
const e = o.source, t = o.field;
|
|
1787
1785
|
return h(e === void 0 || t === void 0 ? void 0 : e[t]);
|
|
1788
1786
|
};
|
|
1789
|
-
function
|
|
1787
|
+
function as(o, e) {
|
|
1790
1788
|
return (t) => {
|
|
1791
1789
|
const r = t.source;
|
|
1792
|
-
return r === void 0 ? h(void 0) : ({ cCtx:
|
|
1793
|
-
const i =
|
|
1790
|
+
return r === void 0 ? h(void 0) : ({ cCtx: s }) => {
|
|
1791
|
+
const i = s.accessor(r).node(), n = {};
|
|
1794
1792
|
for (const a of i.listInputFields()) {
|
|
1795
1793
|
const c = i.traverse(a);
|
|
1796
1794
|
if (c === void 0) n[a] = h(void 0);
|
|
1797
1795
|
else {
|
|
1798
|
-
const u = { ...
|
|
1796
|
+
const u = { ...o, [e.itVar]: c.persist() };
|
|
1799
1797
|
n[a] = m(u, e.mapping);
|
|
1800
1798
|
}
|
|
1801
1799
|
}
|
|
1802
1800
|
return {
|
|
1803
1801
|
type: "ScheduleSubroutine",
|
|
1804
|
-
subroutine:
|
|
1802
|
+
subroutine: cs,
|
|
1805
1803
|
args: n
|
|
1806
1804
|
};
|
|
1807
1805
|
};
|
|
1808
1806
|
};
|
|
1809
1807
|
}
|
|
1810
|
-
const
|
|
1811
|
-
const e =
|
|
1808
|
+
const cs = (o) => h(o), us = (o) => {
|
|
1809
|
+
const e = o.source;
|
|
1812
1810
|
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1813
1811
|
type: "ScheduleComputable",
|
|
1814
1812
|
computable: R.make(
|
|
@@ -1821,19 +1819,19 @@ const as = (s) => h(s), cs = (s) => {
|
|
|
1821
1819
|
}
|
|
1822
1820
|
)
|
|
1823
1821
|
});
|
|
1824
|
-
},
|
|
1825
|
-
const e =
|
|
1822
|
+
}, ls = (o) => {
|
|
1823
|
+
const e = o.source;
|
|
1826
1824
|
return e === void 0 ? h(void 0) : ({ cCtx: t, drivers: r }) => {
|
|
1827
|
-
const
|
|
1825
|
+
const s = t.accessor(e).node().resourceInfo;
|
|
1828
1826
|
return {
|
|
1829
1827
|
type: "ScheduleComputable",
|
|
1830
|
-
computable: R.make(() => r.blobDriver.getDownloadedBlob(
|
|
1828
|
+
computable: R.make(() => r.blobDriver.getDownloadedBlob(s), {
|
|
1831
1829
|
postprocessValue: async (i) => i === void 0 ? void 0 : (await r.blobDriver.getContent(i.handle)).toString()
|
|
1832
1830
|
})
|
|
1833
1831
|
};
|
|
1834
1832
|
};
|
|
1835
|
-
},
|
|
1836
|
-
const e =
|
|
1833
|
+
}, ds = (o) => {
|
|
1834
|
+
const e = o.source;
|
|
1837
1835
|
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1838
1836
|
type: "ScheduleComputable",
|
|
1839
1837
|
computable: R.make(
|
|
@@ -1841,272 +1839,275 @@ const as = (s) => h(s), cs = (s) => {
|
|
|
1841
1839
|
{
|
|
1842
1840
|
postprocessValue: async (r) => {
|
|
1843
1841
|
if (r == null) return;
|
|
1844
|
-
const
|
|
1845
|
-
if (
|
|
1846
|
-
return JSON.parse(Buffer.from(
|
|
1842
|
+
const s = await t.blobDriver.getContent(r.handle);
|
|
1843
|
+
if (s != null)
|
|
1844
|
+
return JSON.parse(Buffer.from(s).toString());
|
|
1847
1845
|
}
|
|
1848
1846
|
}
|
|
1849
1847
|
)
|
|
1850
1848
|
});
|
|
1851
|
-
},
|
|
1852
|
-
const e =
|
|
1849
|
+
}, ps = (o) => {
|
|
1850
|
+
const e = o.source;
|
|
1853
1851
|
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1854
1852
|
type: "ScheduleComputable",
|
|
1855
1853
|
computable: t.blobDriver.getDownloadedBlob(e)
|
|
1856
1854
|
});
|
|
1857
|
-
},
|
|
1858
|
-
const e =
|
|
1855
|
+
}, gs = (o) => {
|
|
1856
|
+
const e = o.source;
|
|
1859
1857
|
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1860
1858
|
type: "ScheduleComputable",
|
|
1861
1859
|
computable: t.blobDriver.getOnDemandBlob(e)
|
|
1862
1860
|
});
|
|
1863
|
-
},
|
|
1864
|
-
const e =
|
|
1861
|
+
}, hs = (o) => {
|
|
1862
|
+
const e = o.source;
|
|
1865
1863
|
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1866
1864
|
type: "ScheduleComputable",
|
|
1867
1865
|
computable: t.uploadDriver.getProgressId(e)
|
|
1868
1866
|
});
|
|
1869
|
-
},
|
|
1867
|
+
}, fs = (o) => (e) => {
|
|
1870
1868
|
const t = e.source;
|
|
1871
1869
|
return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
|
|
1872
1870
|
type: "ScheduleComputable",
|
|
1873
|
-
computable: r.logDriver.getLastLogs(t,
|
|
1871
|
+
computable: r.logDriver.getLastLogs(t, o)
|
|
1874
1872
|
});
|
|
1875
|
-
},
|
|
1873
|
+
}, ms = (o) => (e) => {
|
|
1876
1874
|
const t = e.source;
|
|
1877
1875
|
return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
|
|
1878
1876
|
type: "ScheduleComputable",
|
|
1879
|
-
computable: r.logDriver.getProgressLog(t,
|
|
1877
|
+
computable: r.logDriver.getProgressLog(t, o)
|
|
1880
1878
|
});
|
|
1881
|
-
},
|
|
1882
|
-
const e =
|
|
1879
|
+
}, vs = (o) => {
|
|
1880
|
+
const e = o.source;
|
|
1883
1881
|
return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
|
|
1884
1882
|
type: "ScheduleComputable",
|
|
1885
1883
|
computable: t.logDriver.getLogHandle(e)
|
|
1886
1884
|
});
|
|
1887
1885
|
};
|
|
1888
|
-
function m(
|
|
1886
|
+
function m(o, e) {
|
|
1889
1887
|
switch (e.type) {
|
|
1890
1888
|
case "GetFromCtx":
|
|
1891
|
-
const t =
|
|
1892
|
-
return typeof t == "function" ? (r) =>
|
|
1889
|
+
const t = o[e.variable];
|
|
1890
|
+
return typeof t == "function" ? (r) => we(t(r.cCtx)) : h(t);
|
|
1893
1891
|
case "Isolate":
|
|
1894
1892
|
return ({ drivers: r }) => ({
|
|
1895
1893
|
type: "ScheduleComputable",
|
|
1896
|
-
computable: _t(r,
|
|
1894
|
+
computable: _t(r, o, e.cfg)
|
|
1897
1895
|
});
|
|
1898
1896
|
case "Immediate":
|
|
1899
1897
|
return h(e.value);
|
|
1900
1898
|
case "GetJsonField":
|
|
1901
1899
|
return () => ({
|
|
1902
1900
|
type: "ScheduleSubroutine",
|
|
1903
|
-
subroutine:
|
|
1901
|
+
subroutine: ns,
|
|
1904
1902
|
args: {
|
|
1905
|
-
source: m(
|
|
1906
|
-
field: m(
|
|
1903
|
+
source: m(o, e.source),
|
|
1904
|
+
field: m(o, e.field)
|
|
1907
1905
|
}
|
|
1908
1906
|
});
|
|
1909
1907
|
case "MapArrayValues":
|
|
1910
1908
|
return () => ({
|
|
1911
1909
|
type: "ScheduleSubroutine",
|
|
1912
|
-
subroutine:
|
|
1910
|
+
subroutine: Zo(o, e),
|
|
1913
1911
|
args: {
|
|
1914
|
-
source: m(
|
|
1912
|
+
source: m(o, e.source)
|
|
1915
1913
|
}
|
|
1916
1914
|
});
|
|
1917
1915
|
case "MapRecordValues":
|
|
1918
1916
|
return () => ({
|
|
1919
1917
|
type: "ScheduleSubroutine",
|
|
1920
|
-
subroutine:
|
|
1918
|
+
subroutine: Xo(o, e),
|
|
1921
1919
|
args: {
|
|
1922
|
-
source: m(
|
|
1920
|
+
source: m(o, e.source)
|
|
1923
1921
|
}
|
|
1924
1922
|
});
|
|
1925
1923
|
case "MakeObject":
|
|
1926
1924
|
return () => ({
|
|
1927
1925
|
type: "ScheduleSubroutine",
|
|
1928
|
-
subroutine:
|
|
1929
|
-
args:
|
|
1926
|
+
subroutine: qo,
|
|
1927
|
+
args: Ho(e.template, (r) => m(o, r))
|
|
1930
1928
|
});
|
|
1931
1929
|
case "MakeArray":
|
|
1932
1930
|
return () => ({
|
|
1933
1931
|
type: "ScheduleSubroutine",
|
|
1934
1932
|
subroutine: $t(e.template.length),
|
|
1935
|
-
args: Mt(e.template, (r) => m(
|
|
1933
|
+
args: Mt(e.template, (r) => m(o, r))
|
|
1936
1934
|
});
|
|
1937
1935
|
case "Flatten":
|
|
1938
1936
|
return () => ({
|
|
1939
1937
|
type: "ScheduleSubroutine",
|
|
1940
|
-
subroutine:
|
|
1938
|
+
subroutine: Yo,
|
|
1941
1939
|
args: {
|
|
1942
|
-
source: m(
|
|
1940
|
+
source: m(o, e.source)
|
|
1943
1941
|
}
|
|
1944
1942
|
});
|
|
1945
1943
|
case "IsEmpty":
|
|
1946
1944
|
return () => ({
|
|
1947
1945
|
type: "ScheduleSubroutine",
|
|
1948
|
-
subroutine:
|
|
1946
|
+
subroutine: ts,
|
|
1949
1947
|
args: {
|
|
1950
|
-
arg: m(
|
|
1948
|
+
arg: m(o, e.arg)
|
|
1951
1949
|
}
|
|
1952
1950
|
});
|
|
1953
1951
|
case "Not":
|
|
1954
1952
|
return () => ({
|
|
1955
1953
|
type: "ScheduleSubroutine",
|
|
1956
|
-
subroutine:
|
|
1954
|
+
subroutine: rs,
|
|
1957
1955
|
args: {
|
|
1958
|
-
operand: m(
|
|
1956
|
+
operand: m(o, e.operand)
|
|
1959
1957
|
}
|
|
1960
1958
|
});
|
|
1961
1959
|
case "And":
|
|
1962
1960
|
return () => ({
|
|
1963
1961
|
type: "ScheduleSubroutine",
|
|
1964
|
-
subroutine:
|
|
1962
|
+
subroutine: os,
|
|
1965
1963
|
args: {
|
|
1966
|
-
operand1: m(
|
|
1967
|
-
operand2: m(
|
|
1964
|
+
operand1: m(o, e.operand1),
|
|
1965
|
+
operand2: m(o, e.operand2)
|
|
1968
1966
|
}
|
|
1969
1967
|
});
|
|
1970
1968
|
case "Or":
|
|
1971
1969
|
return () => ({
|
|
1972
1970
|
type: "ScheduleSubroutine",
|
|
1973
|
-
subroutine:
|
|
1971
|
+
subroutine: ss,
|
|
1974
1972
|
args: {
|
|
1975
|
-
operand1: m(
|
|
1976
|
-
operand2: m(
|
|
1973
|
+
operand1: m(o, e.operand1),
|
|
1974
|
+
operand2: m(o, e.operand2)
|
|
1977
1975
|
}
|
|
1978
1976
|
});
|
|
1979
1977
|
case "MapResourceFields":
|
|
1980
1978
|
return () => ({
|
|
1981
1979
|
type: "ScheduleSubroutine",
|
|
1982
|
-
subroutine:
|
|
1980
|
+
subroutine: as(o, e),
|
|
1983
1981
|
args: {
|
|
1984
|
-
source: m(
|
|
1982
|
+
source: m(o, e.source)
|
|
1985
1983
|
}
|
|
1986
1984
|
});
|
|
1987
1985
|
case "GetResourceField":
|
|
1988
1986
|
return () => ({
|
|
1989
1987
|
type: "ScheduleSubroutine",
|
|
1990
|
-
subroutine:
|
|
1988
|
+
subroutine: Qo,
|
|
1991
1989
|
args: {
|
|
1992
|
-
source: m(
|
|
1993
|
-
field: m(
|
|
1990
|
+
source: m(o, e.source),
|
|
1991
|
+
field: m(o, e.field)
|
|
1994
1992
|
}
|
|
1995
1993
|
});
|
|
1996
1994
|
case "GetResourceValueAsJson":
|
|
1997
1995
|
return () => ({
|
|
1998
1996
|
type: "ScheduleSubroutine",
|
|
1999
|
-
subroutine:
|
|
1997
|
+
subroutine: is,
|
|
2000
1998
|
args: {
|
|
2001
|
-
source: m(
|
|
1999
|
+
source: m(o, e.source)
|
|
2002
2000
|
}
|
|
2003
2001
|
});
|
|
2004
2002
|
case "GetBlobContent":
|
|
2005
2003
|
return () => ({
|
|
2006
2004
|
type: "ScheduleSubroutine",
|
|
2007
|
-
subroutine:
|
|
2005
|
+
subroutine: us,
|
|
2008
2006
|
args: {
|
|
2009
|
-
source: m(
|
|
2007
|
+
source: m(o, e.source)
|
|
2010
2008
|
}
|
|
2011
2009
|
});
|
|
2012
2010
|
case "GetBlobContentAsString":
|
|
2013
2011
|
return () => ({
|
|
2014
2012
|
type: "ScheduleSubroutine",
|
|
2015
|
-
subroutine:
|
|
2013
|
+
subroutine: ls,
|
|
2016
2014
|
args: {
|
|
2017
|
-
source: m(
|
|
2015
|
+
source: m(o, e.source)
|
|
2018
2016
|
}
|
|
2019
2017
|
});
|
|
2020
2018
|
case "GetBlobContentAsJson":
|
|
2021
2019
|
return () => ({
|
|
2022
2020
|
type: "ScheduleSubroutine",
|
|
2023
|
-
subroutine:
|
|
2021
|
+
subroutine: ds,
|
|
2024
2022
|
args: {
|
|
2025
|
-
source: m(
|
|
2023
|
+
source: m(o, e.source)
|
|
2026
2024
|
}
|
|
2027
2025
|
});
|
|
2028
2026
|
case "GetDownloadedBlobContent":
|
|
2029
2027
|
return () => ({
|
|
2030
2028
|
type: "ScheduleSubroutine",
|
|
2031
|
-
subroutine:
|
|
2029
|
+
subroutine: ps,
|
|
2032
2030
|
args: {
|
|
2033
|
-
source: m(
|
|
2031
|
+
source: m(o, e.source)
|
|
2034
2032
|
}
|
|
2035
2033
|
});
|
|
2036
2034
|
case "GetOnDemandBlobContent":
|
|
2037
2035
|
return () => ({
|
|
2038
2036
|
type: "ScheduleSubroutine",
|
|
2039
|
-
subroutine:
|
|
2037
|
+
subroutine: gs,
|
|
2040
2038
|
args: {
|
|
2041
|
-
source: m(
|
|
2039
|
+
source: m(o, e.source)
|
|
2042
2040
|
}
|
|
2043
2041
|
});
|
|
2044
2042
|
case "GetImportProgress":
|
|
2045
2043
|
return () => ({
|
|
2046
2044
|
type: "ScheduleSubroutine",
|
|
2047
|
-
subroutine:
|
|
2045
|
+
subroutine: hs,
|
|
2048
2046
|
args: {
|
|
2049
|
-
source: m(
|
|
2047
|
+
source: m(o, e.source)
|
|
2050
2048
|
}
|
|
2051
2049
|
});
|
|
2052
2050
|
case "GetLastLogs":
|
|
2053
2051
|
return () => ({
|
|
2054
2052
|
type: "ScheduleSubroutine",
|
|
2055
|
-
subroutine:
|
|
2053
|
+
subroutine: fs(e.lines),
|
|
2056
2054
|
args: {
|
|
2057
|
-
source: m(
|
|
2055
|
+
source: m(o, e.source)
|
|
2058
2056
|
}
|
|
2059
2057
|
});
|
|
2060
2058
|
case "GetProgressLog":
|
|
2061
2059
|
return () => ({
|
|
2062
2060
|
type: "ScheduleSubroutine",
|
|
2063
|
-
subroutine:
|
|
2061
|
+
subroutine: ms(e.patternToSearch),
|
|
2064
2062
|
args: {
|
|
2065
|
-
source: m(
|
|
2063
|
+
source: m(o, e.source)
|
|
2066
2064
|
}
|
|
2067
2065
|
});
|
|
2068
2066
|
case "GetLogHandle":
|
|
2069
2067
|
return () => ({
|
|
2070
2068
|
type: "ScheduleSubroutine",
|
|
2071
|
-
subroutine:
|
|
2069
|
+
subroutine: vs,
|
|
2072
2070
|
args: {
|
|
2073
|
-
source: m(
|
|
2071
|
+
source: m(o, e.source)
|
|
2074
2072
|
}
|
|
2075
2073
|
});
|
|
2076
2074
|
default:
|
|
2077
2075
|
return D(e);
|
|
2078
2076
|
}
|
|
2079
2077
|
}
|
|
2080
|
-
const
|
|
2081
|
-
function
|
|
2078
|
+
const ys = ["$prod", "$staging"];
|
|
2079
|
+
function bs(o) {
|
|
2082
2080
|
return {
|
|
2083
|
-
$blockId:
|
|
2084
|
-
$args: JSON.parse(
|
|
2085
|
-
$ui:
|
|
2086
|
-
|
|
2087
|
-
|
|
2081
|
+
$blockId: o.blockId,
|
|
2082
|
+
$args: (e) => JSON.parse(o.args(e)),
|
|
2083
|
+
$ui: (e) => {
|
|
2084
|
+
const t = o.uiState(e);
|
|
2085
|
+
return t !== void 0 ? JSON.parse(t) : void 0;
|
|
2086
|
+
},
|
|
2087
|
+
$prod: o.prod,
|
|
2088
|
+
$staging: o.staging
|
|
2088
2089
|
};
|
|
2089
2090
|
}
|
|
2090
|
-
const Kt = Symbol(), Gt = "return",
|
|
2091
|
-
function
|
|
2092
|
-
return
|
|
2091
|
+
const Kt = Symbol(), Gt = "return", ws = { op: Kt, arg: Gt };
|
|
2092
|
+
function Ss(o) {
|
|
2093
|
+
return o.op == Kt && o.arg == Gt;
|
|
2093
2094
|
}
|
|
2094
|
-
function
|
|
2095
|
+
function ks() {
|
|
2095
2096
|
return { pendingSubroutines: /* @__PURE__ */ new Map() };
|
|
2096
2097
|
}
|
|
2097
|
-
function
|
|
2098
|
-
const
|
|
2099
|
-
if (
|
|
2098
|
+
function gt(o, e, t, r) {
|
|
2099
|
+
const s = new Rt(t), i = (a, c) => {
|
|
2100
|
+
if (Ss(a))
|
|
2100
2101
|
return e.result = c, !1;
|
|
2101
|
-
const u =
|
|
2102
|
+
const u = k(e.pendingSubroutines.get(a.op));
|
|
2102
2103
|
if (a.arg in u.args) throw new Error("argument already set");
|
|
2103
|
-
return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op),
|
|
2104
|
+
return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op), s.push({
|
|
2104
2105
|
destination: u.destination,
|
|
2105
2106
|
operation: u.subroutine(u.args)
|
|
2106
2107
|
})), !0;
|
|
2107
2108
|
}, n = [];
|
|
2108
|
-
e: for (;
|
|
2109
|
-
const a =
|
|
2109
|
+
e: for (; s.length > 0; ) {
|
|
2110
|
+
const a = s.shift(), c = a.operation(o);
|
|
2110
2111
|
switch (c.type) {
|
|
2111
2112
|
case "ReturnResult":
|
|
2112
2113
|
if (!i(a.destination, c.result)) break e;
|
|
@@ -2114,13 +2115,13 @@ function pt(s, e, t, r) {
|
|
|
2114
2115
|
case "ScheduleSubroutine":
|
|
2115
2116
|
const u = Symbol(), l = Object.entries(c.args), d = l.length;
|
|
2116
2117
|
if (d === 0)
|
|
2117
|
-
|
|
2118
|
+
s.push({
|
|
2118
2119
|
destination: a.destination,
|
|
2119
2120
|
operation: c.subroutine({})
|
|
2120
2121
|
});
|
|
2121
2122
|
else {
|
|
2122
2123
|
for (const [g, f] of l)
|
|
2123
|
-
|
|
2124
|
+
s.push({
|
|
2124
2125
|
destination: { op: u, arg: g },
|
|
2125
2126
|
operation: f
|
|
2126
2127
|
});
|
|
@@ -2146,24 +2147,26 @@ function pt(s, e, t, r) {
|
|
|
2146
2147
|
}
|
|
2147
2148
|
return n;
|
|
2148
2149
|
}
|
|
2149
|
-
function
|
|
2150
|
-
return _t(
|
|
2150
|
+
function Cs(o, e, t, r = {}) {
|
|
2151
|
+
return _t(o, bs(e), t, r);
|
|
2151
2152
|
}
|
|
2152
|
-
function _t(
|
|
2153
|
-
const
|
|
2154
|
-
ctx: Object.fromEntries(
|
|
2153
|
+
function _t(o, e, t, r = {}) {
|
|
2154
|
+
const s = `${e.blockId}#` + Ue({
|
|
2155
|
+
ctx: Object.fromEntries(
|
|
2156
|
+
Object.entries(e).filter(([i]) => ys.indexOf(i) === -1)
|
|
2157
|
+
),
|
|
2155
2158
|
cfg: t
|
|
2156
2159
|
});
|
|
2157
2160
|
return R.makeRaw(
|
|
2158
2161
|
(i) => {
|
|
2159
|
-
const n = { drivers:
|
|
2162
|
+
const n = { drivers: o, cCtx: i }, a = ks();
|
|
2160
2163
|
return {
|
|
2161
|
-
ir:
|
|
2164
|
+
ir: gt(
|
|
2162
2165
|
n,
|
|
2163
2166
|
a,
|
|
2164
2167
|
[
|
|
2165
2168
|
{
|
|
2166
|
-
destination:
|
|
2169
|
+
destination: ws,
|
|
2167
2170
|
operation: m(e, t)
|
|
2168
2171
|
}
|
|
2169
2172
|
],
|
|
@@ -2171,37 +2174,37 @@ function _t(s, e, t, r = {}) {
|
|
|
2171
2174
|
),
|
|
2172
2175
|
async postprocessValue(u) {
|
|
2173
2176
|
const l = [];
|
|
2174
|
-
for (const
|
|
2175
|
-
l.push({ destination:
|
|
2177
|
+
for (const y of u)
|
|
2178
|
+
l.push({ destination: y.destination, operation: h(y.computable) });
|
|
2176
2179
|
const d = {
|
|
2177
|
-
drivers:
|
|
2180
|
+
drivers: o,
|
|
2178
2181
|
get cCtx() {
|
|
2179
2182
|
throw new Error("asynchronous operations are forbidden in this context");
|
|
2180
2183
|
}
|
|
2181
2184
|
}, g = /* @__PURE__ */ new Map();
|
|
2182
|
-
for (const [
|
|
2183
|
-
g.set(
|
|
2185
|
+
for (const [y, C] of a.pendingSubroutines)
|
|
2186
|
+
g.set(y, { ...C, args: { ...C.args } });
|
|
2184
2187
|
const f = {
|
|
2185
2188
|
result: a.result,
|
|
2186
2189
|
pendingSubroutines: g
|
|
2187
2190
|
};
|
|
2188
|
-
if (
|
|
2191
|
+
if (gt(d, f, l, !1), !("result" in f))
|
|
2189
2192
|
throw new Error("illegal cfg rendering stack state, no result");
|
|
2190
2193
|
return f.result;
|
|
2191
2194
|
}
|
|
2192
2195
|
};
|
|
2193
2196
|
},
|
|
2194
|
-
{ ...r, key:
|
|
2197
|
+
{ ...r, key: s }
|
|
2195
2198
|
);
|
|
2196
2199
|
}
|
|
2197
|
-
function
|
|
2198
|
-
return
|
|
2200
|
+
function Ps(o) {
|
|
2201
|
+
return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
|
|
2199
2202
|
}
|
|
2200
|
-
function
|
|
2201
|
-
return
|
|
2203
|
+
function ht(o) {
|
|
2204
|
+
return o !== void 0 ? Buffer.from(o).toString("base64") : void 0;
|
|
2202
2205
|
}
|
|
2203
|
-
class
|
|
2204
|
-
constructor(e, t, r,
|
|
2206
|
+
class ve {
|
|
2207
|
+
constructor(e, t, r, s, i) {
|
|
2205
2208
|
p(this, "callbackRegistry");
|
|
2206
2209
|
p(this, "fnJSONStringify");
|
|
2207
2210
|
p(this, "fnJSONParse");
|
|
@@ -2213,7 +2216,7 @@ class me {
|
|
|
2213
2216
|
// Result Pool
|
|
2214
2217
|
//
|
|
2215
2218
|
p(this, "_resultPool");
|
|
2216
|
-
if (this.scope = e, this.vm = t, this.blockCtx = r, this.env =
|
|
2219
|
+
if (this.scope = e, this.vm = t, this.blockCtx = r, this.env = s, this.computableCtx = i, this.callbackRegistry = this.scope.manage(this.vm.newObject()), this.fnJSONStringify = e.manage(
|
|
2217
2220
|
t.getProp(t.global, "JSON").consume((n) => t.getProp(n, "stringify"))
|
|
2218
2221
|
), t.typeof(this.fnJSONStringify) !== "function")
|
|
2219
2222
|
throw new Error("JSON.stringify() not found.");
|
|
@@ -2232,19 +2235,19 @@ class me {
|
|
|
2232
2235
|
try {
|
|
2233
2236
|
this.vm.unwrapResult(this.vm.evalCode(e, "bundle.js", { type: "global" })).dispose();
|
|
2234
2237
|
} catch (t) {
|
|
2235
|
-
throw
|
|
2238
|
+
throw ve.cleanErrorContext(t), t;
|
|
2236
2239
|
}
|
|
2237
2240
|
}
|
|
2238
2241
|
runCallback(e, ...t) {
|
|
2239
2242
|
try {
|
|
2240
|
-
return
|
|
2241
|
-
const
|
|
2242
|
-
if (this.vm.typeof(
|
|
2243
|
+
return xe.withScope((r) => {
|
|
2244
|
+
const s = r.manage(this.vm.getProp(this.callbackRegistry, e));
|
|
2245
|
+
if (this.vm.typeof(s) !== "function")
|
|
2243
2246
|
throw new Error(`No such callback: ${e}`);
|
|
2244
2247
|
return this.scope.manage(
|
|
2245
2248
|
this.vm.unwrapResult(
|
|
2246
2249
|
this.vm.callFunction(
|
|
2247
|
-
|
|
2250
|
+
s,
|
|
2248
2251
|
this.vm.undefined,
|
|
2249
2252
|
...t.map((i) => this.exportObjectUniversal(i, r))
|
|
2250
2253
|
)
|
|
@@ -2252,7 +2255,7 @@ class me {
|
|
|
2252
2255
|
);
|
|
2253
2256
|
});
|
|
2254
2257
|
} catch (r) {
|
|
2255
|
-
throw
|
|
2258
|
+
throw ve.cleanErrorContext(r), r;
|
|
2256
2259
|
}
|
|
2257
2260
|
}
|
|
2258
2261
|
//
|
|
@@ -2261,9 +2264,9 @@ class me {
|
|
|
2261
2264
|
getAccessorHandleByName(e) {
|
|
2262
2265
|
if (this.computableCtx === void 0)
|
|
2263
2266
|
throw new Error("Accessors can't be used in this context");
|
|
2264
|
-
const t = (r,
|
|
2267
|
+
const t = (r, s) => {
|
|
2265
2268
|
if (!this.accessors.has(r)) {
|
|
2266
|
-
const i = this.blockCtx[
|
|
2269
|
+
const i = this.blockCtx[s];
|
|
2267
2270
|
if (i === void 0) throw new Error("Staging context not available");
|
|
2268
2271
|
const n = i(this.computableCtx);
|
|
2269
2272
|
n ? this.accessors.set(r, this.computableCtx.accessor(n).node({ ignoreError: !0 })) : this.accessors.set(r, void 0);
|
|
@@ -2307,13 +2310,13 @@ class me {
|
|
|
2307
2310
|
return this.getAccessor(e).listDynamicFields();
|
|
2308
2311
|
}
|
|
2309
2312
|
getKeyValueBase64(e, t) {
|
|
2310
|
-
return
|
|
2313
|
+
return ht(this.getAccessor(e).getKeyValue(t));
|
|
2311
2314
|
}
|
|
2312
2315
|
getKeyValueAsString(e, t) {
|
|
2313
2316
|
return this.getAccessor(e).getKeyValueAsString(t);
|
|
2314
2317
|
}
|
|
2315
2318
|
getDataBase64(e) {
|
|
2316
|
-
return
|
|
2319
|
+
return ht(this.getAccessor(e).getData());
|
|
2317
2320
|
}
|
|
2318
2321
|
getDataAsString(e) {
|
|
2319
2322
|
return this.getAccessor(e).getDataAsString();
|
|
@@ -2322,9 +2325,9 @@ class me {
|
|
|
2322
2325
|
// Accessor helpers
|
|
2323
2326
|
//
|
|
2324
2327
|
parsePObjectCollection(e, t, r) {
|
|
2325
|
-
const
|
|
2326
|
-
if (!
|
|
2327
|
-
const i =
|
|
2328
|
+
const s = this.getAccessor(e);
|
|
2329
|
+
if (!s.getIsReadyOrError()) return;
|
|
2330
|
+
const i = _o(s, t, r), n = {};
|
|
2328
2331
|
for (const [a, c] of Object.entries(i))
|
|
2329
2332
|
n[a] = X(c, (u) => this.wrapAccessor(u));
|
|
2330
2333
|
return n;
|
|
@@ -2426,7 +2429,7 @@ class me {
|
|
|
2426
2429
|
throw new Error(
|
|
2427
2430
|
"can't use result pool in this context (most porbably called from the future mapper)"
|
|
2428
2431
|
);
|
|
2429
|
-
this._resultPool =
|
|
2432
|
+
this._resultPool = k(
|
|
2430
2433
|
this.blockCtx.getResultsPool,
|
|
2431
2434
|
"getResultsPool"
|
|
2432
2435
|
)(this.computableCtx);
|
|
@@ -2526,13 +2529,13 @@ class me {
|
|
|
2526
2529
|
return r;
|
|
2527
2530
|
}
|
|
2528
2531
|
tryExportSingleValue(e, t) {
|
|
2529
|
-
let r,
|
|
2532
|
+
let r, s = !1;
|
|
2530
2533
|
switch (typeof e) {
|
|
2531
2534
|
case "string":
|
|
2532
|
-
r = this.vm.newString(e),
|
|
2535
|
+
r = this.vm.newString(e), s = !0;
|
|
2533
2536
|
break;
|
|
2534
2537
|
case "number":
|
|
2535
|
-
r = this.vm.newNumber(e),
|
|
2538
|
+
r = this.vm.newNumber(e), s = !0;
|
|
2536
2539
|
break;
|
|
2537
2540
|
case "undefined":
|
|
2538
2541
|
r = this.vm.undefined;
|
|
@@ -2545,13 +2548,13 @@ class me {
|
|
|
2545
2548
|
r = this.vm.null;
|
|
2546
2549
|
break;
|
|
2547
2550
|
}
|
|
2548
|
-
if (
|
|
2549
|
-
r = this.vm.newArrayBuffer(e),
|
|
2551
|
+
if (Ps(e)) {
|
|
2552
|
+
r = this.vm.newArrayBuffer(e), s = !0;
|
|
2550
2553
|
break;
|
|
2551
2554
|
}
|
|
2552
2555
|
return;
|
|
2553
2556
|
}
|
|
2554
|
-
return
|
|
2557
|
+
return s && t != null ? t.manage(r) : r;
|
|
2555
2558
|
}
|
|
2556
2559
|
exportObjectUniversal(e, t) {
|
|
2557
2560
|
const r = this.tryExportSingleValue(e, t);
|
|
@@ -2559,7 +2562,7 @@ class me {
|
|
|
2559
2562
|
}
|
|
2560
2563
|
exportObjectViaJson(e, t) {
|
|
2561
2564
|
const r = this.vm.newString(JSON.stringify(e)).consume(
|
|
2562
|
-
(
|
|
2565
|
+
(s) => this.vm.unwrapResult(this.vm.callFunction(this.fnJSONParse, this.vm.undefined, s))
|
|
2563
2566
|
);
|
|
2564
2567
|
return t !== void 0 ? t.manage(r) : r;
|
|
2565
2568
|
}
|
|
@@ -2581,88 +2584,84 @@ class me {
|
|
|
2581
2584
|
return JSON.parse(t);
|
|
2582
2585
|
}
|
|
2583
2586
|
injectCtx() {
|
|
2584
|
-
|
|
2585
|
-
const t = e.manage(this.vm.newObject());
|
|
2586
|
-
this.vm.setProp(t, "args", e.manage(this.vm.newString(
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
e.manage(this.vm.newString(this.blockCtx.uiState))
|
|
2590
|
-
), this.vm.setProp(t, "callbackRegistry", this.callbackRegistry);
|
|
2591
|
-
const r = (o, i) => {
|
|
2592
|
-
this.vm.newFunction(o, i).consume((n) => this.vm.setProp(t, o, n));
|
|
2587
|
+
xe.withScope((e) => {
|
|
2588
|
+
const t = e.manage(this.vm.newObject()), r = this.blockCtx.args(this.computableCtx), s = this.blockCtx.uiState(this.computableCtx);
|
|
2589
|
+
this.vm.setProp(t, "args", e.manage(this.vm.newString(r))), s !== void 0 && this.vm.setProp(t, "uiState", e.manage(this.vm.newString(s))), this.vm.setProp(t, "callbackRegistry", this.callbackRegistry);
|
|
2590
|
+
const i = (n, a) => {
|
|
2591
|
+
this.vm.newFunction(n, a).consume((c) => this.vm.setProp(t, n, c));
|
|
2593
2592
|
};
|
|
2594
|
-
|
|
2595
|
-
this.getAccessorHandleByName(this.vm.getString(
|
|
2593
|
+
i("getAccessorHandleByName", (n) => this.exportSingleValue(
|
|
2594
|
+
this.getAccessorHandleByName(this.vm.getString(n)),
|
|
2596
2595
|
void 0
|
|
2597
|
-
)),
|
|
2596
|
+
)), i("resolveWithCommon", (n, a, ...c) => this.exportSingleValue(
|
|
2598
2597
|
this.resolveWithCommon(
|
|
2599
|
-
this.vm.getString(
|
|
2600
|
-
this.importObjectViaJson(
|
|
2601
|
-
...
|
|
2602
|
-
(
|
|
2598
|
+
this.vm.getString(n),
|
|
2599
|
+
this.importObjectViaJson(a),
|
|
2600
|
+
...c.map(
|
|
2601
|
+
(u) => this.importObjectViaJson(u)
|
|
2603
2602
|
)
|
|
2604
2603
|
),
|
|
2605
2604
|
void 0
|
|
2606
|
-
)),
|
|
2607
|
-
this.getKeyValueBase64(this.vm.getString(
|
|
2605
|
+
)), i("getResourceType", (n) => this.exportObjectViaJson(this.getResourceType(this.vm.getString(n)), void 0)), i("getInputsLocked", (n) => this.exportSingleValue(this.getInputsLocked(this.vm.getString(n)), void 0)), i("getOutputsLocked", (n) => this.exportSingleValue(this.getOutputsLocked(this.vm.getString(n)), void 0)), i("getIsReadyOrError", (n) => this.exportSingleValue(this.getIsReadyOrError(this.vm.getString(n)), void 0)), i("getIsFinal", (n) => this.exportSingleValue(this.getIsFinal(this.vm.getString(n)), void 0)), i("getError", (n) => this.exportSingleValue(this.getError(this.vm.getString(n)), void 0)), i("listInputFields", (n) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(n)), void 0)), i("listOutputFields", (n) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(n)), void 0)), i("listDynamicFields", (n) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(n)), void 0)), i("getKeyValueBase64", (n, a) => this.exportSingleValue(
|
|
2606
|
+
this.getKeyValueBase64(this.vm.getString(n), this.vm.getString(a)),
|
|
2608
2607
|
void 0
|
|
2609
|
-
)),
|
|
2610
|
-
this.getKeyValueAsString(this.vm.getString(
|
|
2608
|
+
)), i("getKeyValueAsString", (n, a) => this.exportSingleValue(
|
|
2609
|
+
this.getKeyValueAsString(this.vm.getString(n), this.vm.getString(a)),
|
|
2611
2610
|
void 0
|
|
2612
|
-
)),
|
|
2611
|
+
)), i("getDataBase64", (n) => this.exportSingleValue(this.getDataBase64(this.vm.getString(n)), void 0)), i("getDataAsString", (n) => this.exportSingleValue(this.getDataAsString(this.vm.getString(n)), void 0)), i("parsePObjectCollection", (n, a, c) => this.exportObjectUniversal(
|
|
2613
2612
|
this.parsePObjectCollection(
|
|
2614
|
-
this.vm.getString(
|
|
2615
|
-
this.vm.dump(
|
|
2616
|
-
this.vm.getString(
|
|
2613
|
+
this.vm.getString(n),
|
|
2614
|
+
this.vm.dump(a),
|
|
2615
|
+
this.vm.getString(c)
|
|
2617
2616
|
),
|
|
2618
2617
|
void 0
|
|
2619
|
-
)),
|
|
2620
|
-
this.getBlobContentAsBase64(this.vm.getString(
|
|
2618
|
+
)), i("getBlobContentAsBase64", (n) => this.exportSingleValue(
|
|
2619
|
+
this.getBlobContentAsBase64(this.vm.getString(n)),
|
|
2621
2620
|
void 0
|
|
2622
|
-
)),
|
|
2623
|
-
this.getBlobContentAsString(this.vm.getString(
|
|
2621
|
+
)), i("getBlobContentAsString", (n) => this.exportSingleValue(
|
|
2622
|
+
this.getBlobContentAsString(this.vm.getString(n)),
|
|
2624
2623
|
void 0
|
|
2625
|
-
)),
|
|
2626
|
-
this.getDownloadedBlobContentHandle(this.vm.getString(
|
|
2624
|
+
)), i("getDownloadedBlobContentHandle", (n) => this.exportSingleValue(
|
|
2625
|
+
this.getDownloadedBlobContentHandle(this.vm.getString(n)),
|
|
2627
2626
|
void 0
|
|
2628
|
-
)),
|
|
2629
|
-
this.getOnDemandBlobContentHandle(this.vm.getString(
|
|
2627
|
+
)), i("getOnDemandBlobContentHandle", (n) => this.exportSingleValue(
|
|
2628
|
+
this.getOnDemandBlobContentHandle(this.vm.getString(n)),
|
|
2630
2629
|
void 0
|
|
2631
|
-
)),
|
|
2632
|
-
this.getLastLogs(this.vm.getString(
|
|
2630
|
+
)), i("getImportProgress", (n) => this.exportSingleValue(this.getImportProgress(this.vm.getString(n)), void 0)), i("getLastLogs", (n, a) => this.exportSingleValue(
|
|
2631
|
+
this.getLastLogs(this.vm.getString(n), this.vm.getNumber(a)),
|
|
2633
2632
|
void 0
|
|
2634
|
-
)),
|
|
2635
|
-
this.getProgressLog(this.vm.getString(
|
|
2633
|
+
)), i("getProgressLog", (n, a) => this.exportSingleValue(
|
|
2634
|
+
this.getProgressLog(this.vm.getString(n), this.vm.getString(a)),
|
|
2636
2635
|
void 0
|
|
2637
|
-
)),
|
|
2638
|
-
this.calculateOptions(this.importObjectViaJson(
|
|
2636
|
+
)), i("getLogHandle", (n) => this.exportSingleValue(this.getLogHandle(this.vm.getString(n)), void 0)), i("getBlockLabel", (n) => this.exportSingleValue(this.getBlockLabel(this.vm.getString(n)), void 0)), i("getDataFromResultPool", (n) => this.exportObjectUniversal(this.getDataFromResultPool(), void 0)), i("getDataWithErrorsFromResultPool", (n) => this.exportObjectUniversal(this.getDataWithErrorsFromResultPool(), void 0)), i("getSpecsFromResultPool", (n) => this.exportObjectUniversal(this.getSpecsFromResultPool(), void 0)), i("calculateOptions", (n) => this.exportObjectUniversal(
|
|
2637
|
+
this.calculateOptions(this.importObjectViaJson(n)),
|
|
2639
2638
|
void 0
|
|
2640
|
-
)),
|
|
2639
|
+
)), i("getSpecFromResultPoolByRef", (n, a) => this.exportObjectUniversal(
|
|
2641
2640
|
this.getSpecFromResultPoolByRef(
|
|
2642
|
-
this.vm.getString(
|
|
2643
|
-
this.vm.getString(
|
|
2641
|
+
this.vm.getString(n),
|
|
2642
|
+
this.vm.getString(a)
|
|
2644
2643
|
),
|
|
2645
2644
|
void 0
|
|
2646
|
-
)),
|
|
2645
|
+
)), i("getDataFromResultPoolByRef", (n, a) => this.exportObjectUniversal(
|
|
2647
2646
|
this.getDataFromResultPoolByRef(
|
|
2648
|
-
this.vm.getString(
|
|
2649
|
-
this.vm.getString(
|
|
2647
|
+
this.vm.getString(n),
|
|
2648
|
+
this.vm.getString(a)
|
|
2650
2649
|
),
|
|
2651
2650
|
void 0
|
|
2652
|
-
)),
|
|
2653
|
-
this.createPFrame(this.importObjectViaJson(
|
|
2651
|
+
)), i("createPFrame", (n) => this.exportSingleValue(
|
|
2652
|
+
this.createPFrame(this.importObjectViaJson(n)),
|
|
2654
2653
|
void 0
|
|
2655
|
-
)),
|
|
2656
|
-
this.createPTable(this.importObjectViaJson(
|
|
2654
|
+
)), i("createPTable", (n) => this.exportSingleValue(
|
|
2655
|
+
this.createPTable(this.importObjectViaJson(n)),
|
|
2657
2656
|
void 0
|
|
2658
|
-
)),
|
|
2657
|
+
)), i("getCurrentUnstableMarker", () => this.exportSingleValue(this.getCurrentUnstableMarker(), void 0)), this.vm.setProp(this.vm.global, "cfgRenderCtx", t);
|
|
2659
2658
|
});
|
|
2660
2659
|
}
|
|
2661
2660
|
}
|
|
2662
|
-
function Ht(
|
|
2661
|
+
function Ht(o, e) {
|
|
2663
2662
|
var t, r;
|
|
2664
2663
|
return te(
|
|
2665
|
-
(r = (t =
|
|
2664
|
+
(r = (t = o.traverse(
|
|
2666
2665
|
{
|
|
2667
2666
|
field: P(e, "blockPack"),
|
|
2668
2667
|
assertFieldType: "Dynamic",
|
|
@@ -2670,160 +2669,162 @@ function Ht(s, e) {
|
|
|
2670
2669
|
},
|
|
2671
2670
|
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2672
2671
|
)) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
|
|
2673
|
-
(
|
|
2672
|
+
(s) => ye(s)
|
|
2674
2673
|
);
|
|
2675
2674
|
}
|
|
2676
|
-
const
|
|
2677
|
-
function
|
|
2678
|
-
const i =
|
|
2679
|
-
return
|
|
2680
|
-
const a = new
|
|
2675
|
+
const de = process.env.MI_LOG_OUTPUT_STATUS;
|
|
2676
|
+
function Rs(o, e, t, r, s = {}) {
|
|
2677
|
+
const i = `${e.blockId}#lambda#${t.handle}`;
|
|
2678
|
+
return s = { ...s, key: i }, s.mode === void 0 && t.retentive === !0 && (s.mode = "StableOnlyRetentive"), R.makeRaw((n) => {
|
|
2679
|
+
const a = new xe();
|
|
2681
2680
|
n.addOnDestroy(() => a.dispose());
|
|
2682
|
-
const c = a.manage(
|
|
2681
|
+
const c = a.manage(o.quickJs.newRuntime());
|
|
2683
2682
|
c.setMemoryLimit(1024 * 640), c.setMaxStackSize(1024 * 320);
|
|
2684
|
-
const u = a.manage(c.newContext()), l = new
|
|
2683
|
+
const u = a.manage(c.newContext()), l = new ve(a, u, e, o, n);
|
|
2685
2684
|
l.evaluateBundle(r.content);
|
|
2686
2685
|
const d = l.runCallback(t.handle);
|
|
2687
|
-
|
|
2686
|
+
l.resetComputableCtx();
|
|
2687
|
+
let g = 0;
|
|
2688
|
+
return de && de !== "unstable-only" && console.log(`Output ${t.handle} scaffold calculated.`), {
|
|
2688
2689
|
ir: l.computablesToResolve,
|
|
2689
|
-
postprocessValue: async (
|
|
2690
|
-
for (const [
|
|
2691
|
-
const
|
|
2692
|
-
return
|
|
2693
|
-
|
|
2694
|
-
),
|
|
2690
|
+
postprocessValue: async (f, { unstableMarker: y, stable: C }) => {
|
|
2691
|
+
for (const [M, N] of Object.entries(f)) l.runCallback(M, N);
|
|
2692
|
+
const j = l.importObjectUniversal(d);
|
|
2693
|
+
return g++, de && (de !== "unstable-only" || !C) && console.log(
|
|
2694
|
+
C ? `Stable output ${t.handle} calculated ${j !== void 0 ? "defined" : "undefined"}; (#${g})` : `Unstable output ${t.handle}; marker = ${y}; ${j !== void 0 ? "defined" : "undefined"} (#${g})`
|
|
2695
|
+
), j;
|
|
2695
2696
|
}
|
|
2696
2697
|
};
|
|
2697
|
-
},
|
|
2698
|
+
}, s);
|
|
2698
2699
|
}
|
|
2699
|
-
function
|
|
2700
|
-
return wt(
|
|
2700
|
+
function Fs(o) {
|
|
2701
|
+
return wt(o) ? o.isActive === !0 : zo(o);
|
|
2701
2702
|
}
|
|
2702
|
-
function re(
|
|
2703
|
+
function re(o, e, t, r, s = {}) {
|
|
2703
2704
|
if (wt(t)) {
|
|
2704
2705
|
if (r === void 0) throw new Error("No code bundle.");
|
|
2705
|
-
return
|
|
2706
|
-
} else return
|
|
2706
|
+
return Rs(o, e, t, r, s);
|
|
2707
|
+
} else return Cs(o.driverKit, e, t, s);
|
|
2707
2708
|
}
|
|
2708
|
-
function
|
|
2709
|
+
function Bs(o, e, t) {
|
|
2709
2710
|
return R.make(
|
|
2710
2711
|
(r) => {
|
|
2711
|
-
var
|
|
2712
|
-
const
|
|
2713
|
-
|
|
2712
|
+
var y, C, j, M, N, _, q, ce;
|
|
2713
|
+
const s = r.accessor(o).node(), i = k(s.getKeyValueAsJson(Ge)), n = k(s.getKeyValueAsJson(ie)), a = k(s.getKeyValueAsJson(ne)), c = k(s.getKeyValueAsJson(z)), u = k(
|
|
2714
|
+
s.getKeyValueAsJson(fe)
|
|
2714
2715
|
), l = /* @__PURE__ */ new Map();
|
|
2715
|
-
for (const { id:
|
|
2716
|
-
const
|
|
2717
|
-
field: P(
|
|
2716
|
+
for (const { id: S } of U(c)) {
|
|
2717
|
+
const V = s.traverse({
|
|
2718
|
+
field: P(S, "currentArgs"),
|
|
2718
2719
|
assertFieldType: "Dynamic",
|
|
2719
2720
|
errorIfFieldNotSet: !0
|
|
2720
2721
|
});
|
|
2721
2722
|
let Y;
|
|
2722
|
-
const
|
|
2723
|
-
field: P(
|
|
2723
|
+
const E = s.traverse({
|
|
2724
|
+
field: P(S, "prodArgs"),
|
|
2724
2725
|
assertFieldType: "Dynamic",
|
|
2725
2726
|
stableIfNotFound: !0
|
|
2726
2727
|
});
|
|
2727
|
-
if (
|
|
2728
|
-
const A =
|
|
2729
|
-
field: P(
|
|
2728
|
+
if (E !== void 0) {
|
|
2729
|
+
const A = s.getField({
|
|
2730
|
+
field: P(S, "prodOutput"),
|
|
2730
2731
|
assertFieldType: "Dynamic",
|
|
2731
2732
|
errorIfFieldNotFound: !0
|
|
2732
|
-
}), B =
|
|
2733
|
-
field: P(
|
|
2733
|
+
}), B = s.getField({
|
|
2734
|
+
field: P(S, "prodUiCtx"),
|
|
2734
2735
|
assertFieldType: "Dynamic",
|
|
2735
2736
|
errorIfFieldNotFound: !0
|
|
2736
2737
|
});
|
|
2737
2738
|
Y = {
|
|
2738
|
-
arguments:
|
|
2739
|
-
stale:
|
|
2740
|
-
outputError: A.error !== void 0 || B.error !== void 0 || ((
|
|
2741
|
-
outputsError: ((
|
|
2739
|
+
arguments: E.getDataAsJson(),
|
|
2740
|
+
stale: V.id !== E.id,
|
|
2741
|
+
outputError: A.error !== void 0 || B.error !== void 0 || ((y = A.value) == null ? void 0 : y.getError()) !== void 0 || ((C = B.value) == null ? void 0 : C.getError()) !== void 0,
|
|
2742
|
+
outputsError: ((j = A.error) == null ? void 0 : j.getDataAsString()) ?? ((N = (M = A.value) == null ? void 0 : M.getError()) == null ? void 0 : N.getDataAsString()),
|
|
2742
2743
|
exportsError: ((_ = B.error) == null ? void 0 : _.getDataAsString()) ?? ((ce = (q = B.value) == null ? void 0 : q.getError()) == null ? void 0 : ce.getDataAsString()),
|
|
2743
2744
|
finished: (A.value !== void 0 && A.value.getIsReadyOrError() || A.error !== void 0 && A.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
|
|
2744
2745
|
};
|
|
2745
2746
|
}
|
|
2746
|
-
l.set(
|
|
2747
|
+
l.set(S, { currentArguments: V.getDataAsJson(), prod: Y });
|
|
2747
2748
|
}
|
|
2748
|
-
const d =
|
|
2749
|
-
var
|
|
2750
|
-
const
|
|
2749
|
+
const d = pe(c, (S) => l.get(S).currentArguments), g = new Set(u.blocksInLimbo), f = [...U(c)].map(({ id: S, label: V, renderingMode: Y }) => {
|
|
2750
|
+
var qe, Ye, Qe, Ze;
|
|
2751
|
+
const E = k(l.get(S)), A = k(d.nodes.get(S));
|
|
2751
2752
|
let B = "NotCalculated";
|
|
2752
|
-
|
|
2753
|
-
const $ =
|
|
2753
|
+
E.prod !== void 0 && (g.has(S) ? B = "Limbo" : B = E.prod.finished ? "Done" : "Running");
|
|
2754
|
+
const $ = s.traverse(
|
|
2754
2755
|
{
|
|
2755
|
-
field: P(
|
|
2756
|
+
field: P(S, "blockPack"),
|
|
2756
2757
|
assertFieldType: "Dynamic",
|
|
2757
2758
|
errorIfFieldNotSet: !0
|
|
2758
2759
|
},
|
|
2759
2760
|
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2760
|
-
),
|
|
2761
|
-
const H =
|
|
2761
|
+
), L = $ == null ? void 0 : $.getDataAsJson(), { sections: ue, title: v, inputsValid: O, sdkVersion: F } = te(L == null ? void 0 : L.config, (Se) => {
|
|
2762
|
+
const H = ye(Se), ke = We(o, S);
|
|
2762
2763
|
return {
|
|
2763
2764
|
sections: re(
|
|
2764
2765
|
t,
|
|
2765
|
-
|
|
2766
|
+
ke,
|
|
2766
2767
|
H.sections,
|
|
2767
2768
|
H.code
|
|
2768
2769
|
),
|
|
2769
2770
|
title: te(
|
|
2770
2771
|
H.title,
|
|
2771
|
-
(
|
|
2772
|
+
(Zt) => re(
|
|
2772
2773
|
t,
|
|
2773
|
-
|
|
2774
|
-
|
|
2774
|
+
ke,
|
|
2775
|
+
Zt,
|
|
2775
2776
|
H.code
|
|
2776
2777
|
)
|
|
2777
2778
|
),
|
|
2778
2779
|
inputsValid: re(
|
|
2779
2780
|
t,
|
|
2780
|
-
|
|
2781
|
+
ke,
|
|
2781
2782
|
H.inputsValid,
|
|
2782
2783
|
H.code
|
|
2783
2784
|
),
|
|
2784
2785
|
sdkVersion: H.sdkVersion
|
|
2785
2786
|
};
|
|
2786
|
-
}) || {},
|
|
2787
|
-
|
|
2788
|
-
(
|
|
2787
|
+
}) || {}, Qt = te(
|
|
2788
|
+
L,
|
|
2789
|
+
(Se) => t.blockUpdateWatcher.get(Se.source)
|
|
2789
2790
|
);
|
|
2790
2791
|
return {
|
|
2791
|
-
id:
|
|
2792
|
-
label:
|
|
2793
|
-
title:
|
|
2792
|
+
id: S,
|
|
2793
|
+
label: v ?? V,
|
|
2794
|
+
title: v ?? V,
|
|
2794
2795
|
renderingMode: Y,
|
|
2795
|
-
stale: ((
|
|
2796
|
+
stale: ((qe = E.prod) == null ? void 0 : qe.stale) !== !1 || B === "Limbo",
|
|
2796
2797
|
missingReference: A.missingReferences,
|
|
2797
|
-
upstreams: [...d.traverseIdsExcludingRoots("upstream",
|
|
2798
|
-
downstreams: [...d.traverseIdsExcludingRoots("downstream",
|
|
2798
|
+
upstreams: [...d.traverseIdsExcludingRoots("upstream", S)],
|
|
2799
|
+
downstreams: [...d.traverseIdsExcludingRoots("downstream", S)],
|
|
2799
2800
|
calculationStatus: B,
|
|
2800
|
-
outputErrors: ((
|
|
2801
|
-
outputsError: (
|
|
2802
|
-
exportsError: (
|
|
2801
|
+
outputErrors: ((Ye = E.prod) == null ? void 0 : Ye.outputError) === !0,
|
|
2802
|
+
outputsError: (Qe = E.prod) == null ? void 0 : Qe.outputsError,
|
|
2803
|
+
exportsError: (Ze = E.prod) == null ? void 0 : Ze.exportsError,
|
|
2803
2804
|
sections: ue,
|
|
2804
2805
|
inputsValid: O,
|
|
2805
|
-
currentBlockPack:
|
|
2806
|
-
updatedBlockPack:
|
|
2806
|
+
currentBlockPack: L == null ? void 0 : L.source,
|
|
2807
|
+
updatedBlockPack: Qt,
|
|
2807
2808
|
sdkVersion: F,
|
|
2808
|
-
navigationState: e.getState(
|
|
2809
|
+
navigationState: e.getState(S)
|
|
2809
2810
|
};
|
|
2810
2811
|
});
|
|
2811
2812
|
return {
|
|
2812
2813
|
meta: a,
|
|
2813
2814
|
created: new Date(i),
|
|
2814
2815
|
lastModified: new Date(n),
|
|
2815
|
-
authorMarker:
|
|
2816
|
+
authorMarker: s.getKeyValueAsJson(je),
|
|
2816
2817
|
blocks: f
|
|
2817
2818
|
};
|
|
2818
2819
|
},
|
|
2819
2820
|
{
|
|
2820
2821
|
postprocessValue: (r) => {
|
|
2821
|
-
const
|
|
2822
|
+
const s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
2822
2823
|
return {
|
|
2823
2824
|
...r,
|
|
2824
2825
|
blocks: r.blocks.map((n) => {
|
|
2825
|
-
n.inputsValid ||
|
|
2826
|
-
const a = n.stale || n.upstreams.findIndex((u) => i.has(u)) !== -1, c = (a || n.outputErrors) && !!n.inputsValid && !n.missingReference && n.upstreams.findIndex((u) =>
|
|
2826
|
+
n.inputsValid || s.add(n.id), n.stale && i.add(n.id);
|
|
2827
|
+
const a = n.stale || n.upstreams.findIndex((u) => i.has(u)) !== -1, c = (a || n.outputErrors) && !!n.inputsValid && !n.missingReference && n.upstreams.findIndex((u) => s.has(u)) === -1;
|
|
2827
2828
|
return { ...n, canRun: c, stale: a };
|
|
2828
2829
|
})
|
|
2829
2830
|
};
|
|
@@ -2831,9 +2832,9 @@ function Fs(s, e, t) {
|
|
|
2831
2832
|
}
|
|
2832
2833
|
).withStableType();
|
|
2833
2834
|
}
|
|
2834
|
-
function
|
|
2835
|
-
const t =
|
|
2836
|
-
if (G(t.resourceType,
|
|
2835
|
+
function Os(o, e) {
|
|
2836
|
+
const t = o.node();
|
|
2837
|
+
if (G(t.resourceType, jt)) {
|
|
2837
2838
|
const r = t.getDataAsJson();
|
|
2838
2839
|
if (r === void 0) throw new Error("No resource data.");
|
|
2839
2840
|
return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
|
|
@@ -2848,10 +2849,10 @@ function Bs(s, e) {
|
|
|
2848
2849
|
} else
|
|
2849
2850
|
throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
|
|
2850
2851
|
}
|
|
2851
|
-
function
|
|
2852
|
-
if (
|
|
2852
|
+
function Ds(o, e) {
|
|
2853
|
+
if (o !== void 0)
|
|
2853
2854
|
return R.make(
|
|
2854
|
-
(t) =>
|
|
2855
|
+
(t) => Os(t.accessor(o), e),
|
|
2855
2856
|
{
|
|
2856
2857
|
postprocessValue: (t) => {
|
|
2857
2858
|
if (t !== void 0) {
|
|
@@ -2863,11 +2864,11 @@ function Os(s, e) {
|
|
|
2863
2864
|
}
|
|
2864
2865
|
).withStableType();
|
|
2865
2866
|
}
|
|
2866
|
-
function
|
|
2867
|
+
function xs(o, e, t) {
|
|
2867
2868
|
return R.make(
|
|
2868
2869
|
(r) => {
|
|
2869
2870
|
var a;
|
|
2870
|
-
const
|
|
2871
|
+
const s = r.accessor(o).node(), i = Ht(s, e), n = (a = s.traverse(
|
|
2871
2872
|
{
|
|
2872
2873
|
field: P(e, "blockPack"),
|
|
2873
2874
|
assertFieldType: "Dynamic"
|
|
@@ -2875,44 +2876,43 @@ function Ds(s, e, t) {
|
|
|
2875
2876
|
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
|
|
2876
2877
|
{ field: Nt, assertFieldType: "Input" }
|
|
2877
2878
|
)) == null ? void 0 : a.persist();
|
|
2878
|
-
return { path:
|
|
2879
|
+
return { path: Ds(n, t), sdkVersion: i == null ? void 0 : i.sdkVersion };
|
|
2879
2880
|
},
|
|
2880
2881
|
{ mode: "StableOnlyLive" }
|
|
2881
2882
|
);
|
|
2882
2883
|
}
|
|
2883
|
-
function
|
|
2884
|
-
|
|
2885
|
-
(
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
);
|
|
2884
|
+
function Wt(o, e, t) {
|
|
2885
|
+
if (t === void 0)
|
|
2886
|
+
return R.make((n) => Wt(o, e, n), {
|
|
2887
|
+
key: `inputs#${Ct(o.rid)}#${e}`
|
|
2888
|
+
});
|
|
2889
|
+
const r = t.accessor(o).node(), s = We(o, e), i = s.uiState(t);
|
|
2890
|
+
return {
|
|
2891
|
+
author: r.getKeyValueAsJson(Te(e)),
|
|
2892
|
+
args: JSON.parse(s.args(t)),
|
|
2893
|
+
ui: i !== void 0 ? JSON.parse(i) : void 0
|
|
2894
|
+
};
|
|
2895
2895
|
}
|
|
2896
|
-
function As(
|
|
2896
|
+
function As(o, e, t) {
|
|
2897
2897
|
return R.make(
|
|
2898
2898
|
(r) => {
|
|
2899
|
-
const
|
|
2899
|
+
const s = r.accessor(o).node(), i = Ut(o, e), n = Ht(s, e);
|
|
2900
2900
|
return te(n, (a) => {
|
|
2901
2901
|
const c = {};
|
|
2902
|
-
for (const [u, l] of Object.entries(a.outputs))
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2902
|
+
for (const [u, l] of Object.entries(a.outputs)) {
|
|
2903
|
+
const d = re(t, i, l, a.code);
|
|
2904
|
+
c[u] = R.wrapError(d), console.log(`${u}: ${d.___wrapped_kernel___.key}`);
|
|
2905
|
+
}
|
|
2906
2906
|
return c;
|
|
2907
2907
|
});
|
|
2908
2908
|
},
|
|
2909
|
-
{ key: "outputs#" + Ct(
|
|
2909
|
+
{ key: "outputs#" + Ct(o.rid) + "#" + e }
|
|
2910
2910
|
).withStableType();
|
|
2911
2911
|
}
|
|
2912
|
-
function
|
|
2912
|
+
function Ts(o, e) {
|
|
2913
2913
|
return R.make((t) => {
|
|
2914
|
-
const r = t.accessor(
|
|
2915
|
-
for (const { id: n, renderingMode: a } of
|
|
2914
|
+
const r = t.accessor(o).node(), s = k(r.getKeyValueAsJson(z)), i = [];
|
|
2915
|
+
for (const { id: n, renderingMode: a } of U(s)) {
|
|
2916
2916
|
const c = r.traverse(
|
|
2917
2917
|
{
|
|
2918
2918
|
field: P(n, "blockPack"),
|
|
@@ -2922,30 +2922,30 @@ function js(s, e) {
|
|
|
2922
2922
|
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2923
2923
|
), u = c == null ? void 0 : c.getDataAsJson();
|
|
2924
2924
|
if ((u == null ? void 0 : u.config) === void 0) continue;
|
|
2925
|
-
const l =
|
|
2925
|
+
const l = ye(u.config), d = Object.entries(l.outputs).map(([, f]) => f).filter((f) => Fs(f)).map((f) => f);
|
|
2926
2926
|
if (d.length === 0) continue;
|
|
2927
|
-
const g = Ut(r, n);
|
|
2927
|
+
const g = Ut(r.persist(), n);
|
|
2928
2928
|
for (const f of d)
|
|
2929
2929
|
i.push(R.wrapError(re(e, g, f, l.code)));
|
|
2930
2930
|
}
|
|
2931
2931
|
return i;
|
|
2932
2932
|
});
|
|
2933
2933
|
}
|
|
2934
|
-
class
|
|
2934
|
+
class js {
|
|
2935
2935
|
constructor() {
|
|
2936
2936
|
p(this, "states", /* @__PURE__ */ new Map());
|
|
2937
2937
|
}
|
|
2938
2938
|
setState(e, t) {
|
|
2939
2939
|
const r = this.states.get(e);
|
|
2940
2940
|
if (r === void 0) {
|
|
2941
|
-
this.states.set(e, { state: t, change: new
|
|
2941
|
+
this.states.set(e, { state: t, change: new rt() });
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
2944
2944
|
r.state = { ...t }, r.change.markChanged();
|
|
2945
2945
|
}
|
|
2946
2946
|
readState(e, t) {
|
|
2947
2947
|
let r = this.states.get(t);
|
|
2948
|
-
return r === void 0 && (r = { state: { ...
|
|
2948
|
+
return r === void 0 && (r = { state: { ...rr }, change: new rt() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
|
|
2949
2949
|
}
|
|
2950
2950
|
getState(e) {
|
|
2951
2951
|
return R.make(
|
|
@@ -2958,38 +2958,38 @@ class Ts {
|
|
|
2958
2958
|
t !== void 0 && (this.states.delete(e), t.change.markChanged());
|
|
2959
2959
|
}
|
|
2960
2960
|
}
|
|
2961
|
-
class
|
|
2961
|
+
class ze {
|
|
2962
2962
|
constructor(e, t, r) {
|
|
2963
2963
|
/** Underlying pl resource id */
|
|
2964
2964
|
p(this, "rid");
|
|
2965
2965
|
/** Data for the left panel, contain basic information about block status. */
|
|
2966
2966
|
p(this, "overview");
|
|
2967
|
-
p(this, "navigationStates", new
|
|
2967
|
+
p(this, "navigationStates", new js());
|
|
2968
2968
|
p(this, "blockComputables", /* @__PURE__ */ new Map());
|
|
2969
2969
|
p(this, "blockFrontends", /* @__PURE__ */ new Map());
|
|
2970
2970
|
p(this, "activeConfigs");
|
|
2971
2971
|
p(this, "refreshLoopResult");
|
|
2972
2972
|
p(this, "abortController", new AbortController());
|
|
2973
2973
|
p(this, "destroyed", !1);
|
|
2974
|
-
this.env = e, this.projectTree = r, this.overview =
|
|
2974
|
+
this.env = e, this.projectTree = r, this.overview = Bs(
|
|
2975
2975
|
r.entry(),
|
|
2976
2976
|
this.navigationStates,
|
|
2977
2977
|
e
|
|
2978
|
-
).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs =
|
|
2978
|
+
).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = Ts(r.entry(), e);
|
|
2979
2979
|
}
|
|
2980
2980
|
async refreshLoop() {
|
|
2981
2981
|
for (; !this.destroyed; )
|
|
2982
2982
|
try {
|
|
2983
|
-
await
|
|
2983
|
+
await Be(this.env.pl, this.rid, (e) => {
|
|
2984
2984
|
e.doRefresh(this.env.ops.stagingRenderingRate);
|
|
2985
2985
|
}), await this.activeConfigs.getValue(), await Ft(this.env.ops.projectRefreshInterval, this.abortController.signal);
|
|
2986
2986
|
} catch (e) {
|
|
2987
|
-
if (
|
|
2987
|
+
if (fr(e)) {
|
|
2988
2988
|
console.warn(
|
|
2989
2989
|
"project refresh routine terminated, because project was externally deleted"
|
|
2990
2990
|
);
|
|
2991
2991
|
break;
|
|
2992
|
-
} else if (!
|
|
2992
|
+
} else if (!mr(e))
|
|
2993
2993
|
throw new Error("Unexpected exception", { cause: e });
|
|
2994
2994
|
}
|
|
2995
2995
|
}
|
|
@@ -3004,12 +3004,12 @@ class We {
|
|
|
3004
3004
|
*
|
|
3005
3005
|
* @return returns newly created block id
|
|
3006
3006
|
* */
|
|
3007
|
-
async addBlock(e, t, r,
|
|
3008
|
-
const n = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c =
|
|
3009
|
-
return await
|
|
3007
|
+
async addBlock(e, t, r, s = void 0, i = se()) {
|
|
3008
|
+
const n = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c = ye(a);
|
|
3009
|
+
return await J(
|
|
3010
3010
|
this.env.pl,
|
|
3011
3011
|
this.rid,
|
|
3012
|
-
|
|
3012
|
+
s,
|
|
3013
3013
|
(u) => u.addBlock(
|
|
3014
3014
|
{
|
|
3015
3015
|
id: i,
|
|
@@ -3029,12 +3029,12 @@ class We {
|
|
|
3029
3029
|
* Update block to new block pack, optionally resetting args and ui state to
|
|
3030
3030
|
* initial values
|
|
3031
3031
|
* */
|
|
3032
|
-
async updateBlockPack(e, t, r = !1,
|
|
3032
|
+
async updateBlockPack(e, t, r = !1, s) {
|
|
3033
3033
|
const i = await this.env.bpPreparer.prepare(t), n = await this.env.bpPreparer.getBlockConfigContainer(t);
|
|
3034
|
-
await
|
|
3034
|
+
await J(
|
|
3035
3035
|
this.env.pl,
|
|
3036
3036
|
this.rid,
|
|
3037
|
-
|
|
3037
|
+
s,
|
|
3038
3038
|
(a) => a.migrateBlockPack(
|
|
3039
3039
|
e,
|
|
3040
3040
|
i,
|
|
@@ -3044,7 +3044,7 @@ class We {
|
|
|
3044
3044
|
}
|
|
3045
3045
|
/** Deletes a block with all associated data. */
|
|
3046
3046
|
async deleteBlock(e, t) {
|
|
3047
|
-
await
|
|
3047
|
+
await J(this.env.pl, this.rid, t, (r) => r.deleteBlock(e)), this.navigationStates.deleteBlock(e), await this.projectTree.refreshState();
|
|
3048
3048
|
}
|
|
3049
3049
|
/**
|
|
3050
3050
|
* Updates block order according to the given array of block ids.
|
|
@@ -3053,11 +3053,11 @@ class We {
|
|
|
3053
3053
|
* an error will be thrown instead.
|
|
3054
3054
|
*/
|
|
3055
3055
|
async reorderBlocks(e, t) {
|
|
3056
|
-
await
|
|
3057
|
-
const
|
|
3058
|
-
if (
|
|
3056
|
+
await J(this.env.pl, this.rid, t, (r) => {
|
|
3057
|
+
const s = r.structure;
|
|
3058
|
+
if (s.groups.length !== 1)
|
|
3059
3059
|
throw new Error("Unexpected project structure, non-sinular block group");
|
|
3060
|
-
const i =
|
|
3060
|
+
const i = s.groups[0];
|
|
3061
3061
|
if (i.blocks.length !== e.length)
|
|
3062
3062
|
throw new Error(`Lengh mismatch: ${i.blocks.length} !== ${e.length}`);
|
|
3063
3063
|
if (new Set(e).size !== e.length) throw new Error("Repeated block ids");
|
|
@@ -3083,7 +3083,7 @@ class We {
|
|
|
3083
3083
|
* stale state.
|
|
3084
3084
|
* */
|
|
3085
3085
|
async runBlock(e) {
|
|
3086
|
-
await
|
|
3086
|
+
await Be(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
|
|
3087
3087
|
}
|
|
3088
3088
|
/**
|
|
3089
3089
|
* Stops the block if it is running by destroying its production state. All
|
|
@@ -3091,7 +3091,7 @@ class We {
|
|
|
3091
3091
|
* calculated.
|
|
3092
3092
|
* */
|
|
3093
3093
|
async stopBlock(e) {
|
|
3094
|
-
await
|
|
3094
|
+
await Be(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
|
|
3095
3095
|
}
|
|
3096
3096
|
// /** Update block label. */
|
|
3097
3097
|
// public async setBlockLabel(blockId: string, label: string, author?: AuthorMarker) {
|
|
@@ -3107,11 +3107,11 @@ class We {
|
|
|
3107
3107
|
* in collaborative editing scenario.
|
|
3108
3108
|
* */
|
|
3109
3109
|
async setBlockArgs(e, t, r) {
|
|
3110
|
-
await
|
|
3110
|
+
await J(
|
|
3111
3111
|
this.env.pl,
|
|
3112
3112
|
this.rid,
|
|
3113
3113
|
r,
|
|
3114
|
-
(
|
|
3114
|
+
(s) => s.setArgs([{ blockId: e, args: JSON.stringify(t) }])
|
|
3115
3115
|
), await this.projectTree.refreshState();
|
|
3116
3116
|
}
|
|
3117
3117
|
/**
|
|
@@ -3121,11 +3121,11 @@ class We {
|
|
|
3121
3121
|
* in collaborative editing scenario.
|
|
3122
3122
|
* */
|
|
3123
3123
|
async setUiState(e, t, r) {
|
|
3124
|
-
await
|
|
3124
|
+
await J(
|
|
3125
3125
|
this.env.pl,
|
|
3126
3126
|
this.rid,
|
|
3127
3127
|
r,
|
|
3128
|
-
(
|
|
3128
|
+
(s) => s.setUiState(e, t === void 0 ? void 0 : JSON.stringify(t))
|
|
3129
3129
|
), await this.projectTree.refreshState();
|
|
3130
3130
|
}
|
|
3131
3131
|
/**
|
|
@@ -3140,22 +3140,22 @@ class We {
|
|
|
3140
3140
|
* transactionally associated with the block, to facilitate conflict resolution
|
|
3141
3141
|
* in collaborative editing scenario.
|
|
3142
3142
|
* */
|
|
3143
|
-
async setBlockArgsAndUiState(e, t, r,
|
|
3144
|
-
await
|
|
3143
|
+
async setBlockArgsAndUiState(e, t, r, s) {
|
|
3144
|
+
await J(this.env.pl, this.rid, s, (i) => {
|
|
3145
3145
|
i.setArgs([{ blockId: e, args: JSON.stringify(t) }]), i.setUiState(e, JSON.stringify(r));
|
|
3146
3146
|
}), await this.projectTree.refreshState();
|
|
3147
3147
|
}
|
|
3148
3148
|
/** Resets arguments and ui state of the block to initial state */
|
|
3149
3149
|
async resetBlockArgsAndUiState(e, t) {
|
|
3150
3150
|
await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
|
|
3151
|
-
const
|
|
3151
|
+
const s = De(
|
|
3152
3152
|
(await r.getField(w(this.rid, P(e, "blockPack")))).value
|
|
3153
|
-
), i =
|
|
3154
|
-
(await r.getField(w(
|
|
3153
|
+
), i = De(
|
|
3154
|
+
(await r.getField(w(s, b.HolderRefField))).value
|
|
3155
3155
|
), n = await r.getResourceData(i, !1), a = JSON.parse(
|
|
3156
|
-
Buffer.from(
|
|
3156
|
+
Buffer.from(k(n.data)).toString("utf-8")
|
|
3157
3157
|
);
|
|
3158
|
-
await
|
|
3158
|
+
await J(r, this.rid, t, (c) => {
|
|
3159
3159
|
c.setArgs([{ blockId: e, args: JSON.stringify(a.config.initialArgs) }]), c.setUiState(e, void 0);
|
|
3160
3160
|
}), await r.commit();
|
|
3161
3161
|
}), await this.projectTree.refreshState();
|
|
@@ -3166,7 +3166,7 @@ class We {
|
|
|
3166
3166
|
const r = As(this.projectTree.entry(), e, this.env), i = {
|
|
3167
3167
|
fullState: R.make(
|
|
3168
3168
|
(n) => ({
|
|
3169
|
-
argsAndUiState:
|
|
3169
|
+
argsAndUiState: Wt(this.projectTree.entry(), e, n),
|
|
3170
3170
|
outputs: r,
|
|
3171
3171
|
navigationState: this.navigationStates.getState(e)
|
|
3172
3172
|
}),
|
|
@@ -3197,7 +3197,7 @@ class We {
|
|
|
3197
3197
|
getBlockFrontend(e) {
|
|
3198
3198
|
const t = this.blockFrontends.get(e);
|
|
3199
3199
|
if (t === void 0) {
|
|
3200
|
-
const r =
|
|
3200
|
+
const r = xs(
|
|
3201
3201
|
this.projectTree.entry(),
|
|
3202
3202
|
e,
|
|
3203
3203
|
this.env
|
|
@@ -3226,23 +3226,23 @@ class We {
|
|
|
3226
3226
|
},
|
|
3227
3227
|
e.logger
|
|
3228
3228
|
);
|
|
3229
|
-
return new
|
|
3229
|
+
return new ze(e, t, r);
|
|
3230
3230
|
}
|
|
3231
3231
|
}
|
|
3232
|
-
function Es(
|
|
3233
|
-
switch (
|
|
3232
|
+
function Es(o) {
|
|
3233
|
+
switch (o.type.name) {
|
|
3234
3234
|
case "BlockPackCustom":
|
|
3235
|
-
return
|
|
3235
|
+
return o.fields.filter((e) => e.name !== "template");
|
|
3236
3236
|
case "UserProject":
|
|
3237
|
-
return
|
|
3237
|
+
return o.fields.filter((e) => !e.name.startsWith("__serviceTemplate"));
|
|
3238
3238
|
case "Blob":
|
|
3239
3239
|
return [];
|
|
3240
3240
|
default:
|
|
3241
|
-
return
|
|
3241
|
+
return o.fields;
|
|
3242
3242
|
}
|
|
3243
3243
|
}
|
|
3244
|
-
const
|
|
3245
|
-
logger: new
|
|
3244
|
+
const zt = {
|
|
3245
|
+
logger: new cr(),
|
|
3246
3246
|
blobDriverOps: {
|
|
3247
3247
|
cacheSoftSizeBytes: 100 * 1024 * 1024,
|
|
3248
3248
|
// 100MB
|
|
@@ -3260,13 +3260,13 @@ const Wt = {
|
|
|
3260
3260
|
stopPollingDelay: 1e3
|
|
3261
3261
|
}
|
|
3262
3262
|
};
|
|
3263
|
-
function
|
|
3263
|
+
function qt(o) {
|
|
3264
3264
|
return {
|
|
3265
|
-
blobDownloadPath: x.join(
|
|
3265
|
+
blobDownloadPath: x.join(o, "download")
|
|
3266
3266
|
};
|
|
3267
3267
|
}
|
|
3268
3268
|
const Is = {
|
|
3269
|
-
...
|
|
3269
|
+
...zt,
|
|
3270
3270
|
defaultTreeOptions: {
|
|
3271
3271
|
pollingInterval: 350,
|
|
3272
3272
|
stopPollingDelay: 2500
|
|
@@ -3275,20 +3275,20 @@ const Is = {
|
|
|
3275
3275
|
projectRefreshInterval: 700,
|
|
3276
3276
|
stagingRenderingRate: 5
|
|
3277
3277
|
};
|
|
3278
|
-
function Ns(
|
|
3278
|
+
function Ns(o) {
|
|
3279
3279
|
return {
|
|
3280
|
-
...
|
|
3281
|
-
frontendDownloadPath: x.join(
|
|
3280
|
+
...qt(o),
|
|
3281
|
+
frontendDownloadPath: x.join(o, "frontend")
|
|
3282
3282
|
};
|
|
3283
3283
|
}
|
|
3284
3284
|
const Vs = {
|
|
3285
3285
|
minDelay: 1500
|
|
3286
3286
|
}, Ls = "__no_updates__";
|
|
3287
|
-
class Js extends
|
|
3288
|
-
constructor(t, r,
|
|
3289
|
-
super({ ...
|
|
3287
|
+
class Js extends wr {
|
|
3288
|
+
constructor(t, r, s = {}) {
|
|
3289
|
+
super({ ...s, ...Vs }, r);
|
|
3290
3290
|
p(this, "http");
|
|
3291
|
-
this.registryProvider = t, this.http =
|
|
3291
|
+
this.registryProvider = t, this.http = s.http;
|
|
3292
3292
|
}
|
|
3293
3293
|
getKey(t) {
|
|
3294
3294
|
switch (t.type) {
|
|
@@ -3308,42 +3308,42 @@ class Js extends br {
|
|
|
3308
3308
|
switch (t.type) {
|
|
3309
3309
|
case "dev-v1":
|
|
3310
3310
|
try {
|
|
3311
|
-
const
|
|
3312
|
-
return
|
|
3313
|
-
} catch (
|
|
3314
|
-
this.logger.warn(
|
|
3311
|
+
const s = await Ot(t.folder);
|
|
3312
|
+
return s === t.mtime ? void 0 : { ...t, mtime: s };
|
|
3313
|
+
} catch (s) {
|
|
3314
|
+
this.logger.warn(s);
|
|
3315
3315
|
return;
|
|
3316
3316
|
}
|
|
3317
3317
|
case "dev-v2":
|
|
3318
3318
|
try {
|
|
3319
|
-
const
|
|
3320
|
-
if (
|
|
3321
|
-
const i = await
|
|
3319
|
+
const s = await Oe(t.folder, this.logger);
|
|
3320
|
+
if (s === void 0) return;
|
|
3321
|
+
const i = await Ke(s);
|
|
3322
3322
|
return i === t.mtime ? void 0 : { ...t, mtime: i };
|
|
3323
|
-
} catch (
|
|
3324
|
-
this.logger.warn(
|
|
3323
|
+
} catch (s) {
|
|
3324
|
+
this.logger.warn(s);
|
|
3325
3325
|
return;
|
|
3326
3326
|
}
|
|
3327
3327
|
case "from-registry-v2":
|
|
3328
3328
|
try {
|
|
3329
|
-
const
|
|
3329
|
+
const s = this.registryProvider.getRegistry(t.registryUrl), i = (r = await s.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
|
|
3330
3330
|
if ((i == null ? void 0 : i.type) !== "from-registry-v2") throw new Error("Unexpected");
|
|
3331
|
-
return
|
|
3331
|
+
return Ce(i.id, t.id) ? void 0 : ((async () => {
|
|
3332
3332
|
try {
|
|
3333
|
-
await
|
|
3333
|
+
await s.getComponents(i.id);
|
|
3334
3334
|
} catch (n) {
|
|
3335
3335
|
this.logger.warn(n);
|
|
3336
3336
|
}
|
|
3337
3337
|
})(), i);
|
|
3338
|
-
} catch (
|
|
3339
|
-
this.logger.warn(
|
|
3338
|
+
} catch (s) {
|
|
3339
|
+
this.logger.warn(s);
|
|
3340
3340
|
return;
|
|
3341
3341
|
}
|
|
3342
3342
|
default:
|
|
3343
3343
|
return;
|
|
3344
3344
|
}
|
|
3345
|
-
} catch (
|
|
3346
|
-
this.logger.warn(
|
|
3345
|
+
} catch (s) {
|
|
3346
|
+
this.logger.warn(s);
|
|
3347
3347
|
return;
|
|
3348
3348
|
}
|
|
3349
3349
|
}
|
|
@@ -3352,9 +3352,9 @@ class Js extends br {
|
|
|
3352
3352
|
if (t === void 0 || r === void 0 || t.type !== r.type) return !1;
|
|
3353
3353
|
switch (t.type) {
|
|
3354
3354
|
case "from-registry-v1":
|
|
3355
|
-
return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl &&
|
|
3355
|
+
return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && Ce(t.id, r.id);
|
|
3356
3356
|
case "from-registry-v2":
|
|
3357
|
-
return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl &&
|
|
3357
|
+
return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && Ce(t.id, r.id);
|
|
3358
3358
|
case "dev-v1":
|
|
3359
3359
|
return r.type !== "dev-v1" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
|
|
3360
3360
|
case "dev-v2":
|
|
@@ -3381,12 +3381,12 @@ class ft {
|
|
|
3381
3381
|
const t = this.calculateParamsKey(e);
|
|
3382
3382
|
let r = this.resources.get(t);
|
|
3383
3383
|
r === void 0 && (r = { refCount: 0, resource: this.createNewResource(e) }, this.resources.set(t, r)), r.refCount++;
|
|
3384
|
-
let
|
|
3384
|
+
let s = !1;
|
|
3385
3385
|
return {
|
|
3386
3386
|
resource: r.resource,
|
|
3387
3387
|
key: t,
|
|
3388
3388
|
unref: () => {
|
|
3389
|
-
|
|
3389
|
+
s || (r.refCount--, s = !0, this.check(t));
|
|
3390
3390
|
}
|
|
3391
3391
|
};
|
|
3392
3392
|
}
|
|
@@ -3399,12 +3399,12 @@ class ft {
|
|
|
3399
3399
|
return (t = this.resources.get(e)) == null ? void 0 : t.resource;
|
|
3400
3400
|
}
|
|
3401
3401
|
}
|
|
3402
|
-
function mt(
|
|
3403
|
-
return String(
|
|
3402
|
+
function mt(o) {
|
|
3403
|
+
return String(o.id);
|
|
3404
3404
|
}
|
|
3405
3405
|
class Us {
|
|
3406
3406
|
constructor(e, t, r) {
|
|
3407
|
-
p(this, "pFrame", new
|
|
3407
|
+
p(this, "pFrame", new Ir());
|
|
3408
3408
|
p(this, "blobIdToResource", /* @__PURE__ */ new Map());
|
|
3409
3409
|
p(this, "blobHandleComputables", /* @__PURE__ */ new Map());
|
|
3410
3410
|
p(this, "preloadBlob", async (e) => {
|
|
@@ -3420,14 +3420,14 @@ class Us {
|
|
|
3420
3420
|
return await this.blobContentCache.forceFetch(r);
|
|
3421
3421
|
});
|
|
3422
3422
|
this.blobDriver = e, this.blobContentCache = t, this.columns = r, this.pFrame.setDataSource(this);
|
|
3423
|
-
for (const
|
|
3424
|
-
for (const n of
|
|
3425
|
-
const i =
|
|
3423
|
+
for (const s of r) {
|
|
3424
|
+
for (const n of Vo(s.data)) this.blobIdToResource.set(mt(n), n);
|
|
3425
|
+
const i = Lo(s.data, mt);
|
|
3426
3426
|
try {
|
|
3427
|
-
this.pFrame.addColumnSpec(
|
|
3427
|
+
this.pFrame.addColumnSpec(s.id, s.spec), this.pFrame.setColumnData(s.id, i);
|
|
3428
3428
|
} catch (n) {
|
|
3429
3429
|
throw new Error(
|
|
3430
|
-
`Adding column ${
|
|
3430
|
+
`Adding column ${s.id} to PFrame failed: ${n}; Spec: ${s.spec}, DataInfo: ${i}.`
|
|
3431
3431
|
);
|
|
3432
3432
|
}
|
|
3433
3433
|
}
|
|
@@ -3452,37 +3452,37 @@ class Ms {
|
|
|
3452
3452
|
/** Limits concurrent requests to PFrame API to prevent deadlock with Node's IO threads */
|
|
3453
3453
|
p(this, "concurrencyLimiter");
|
|
3454
3454
|
this.blobDriver = e;
|
|
3455
|
-
const t = new
|
|
3455
|
+
const t = new Nr({
|
|
3456
3456
|
maxSize: 1e9,
|
|
3457
3457
|
// 1Gb
|
|
3458
|
-
fetchMethod: async (
|
|
3459
|
-
sizeCalculation: (
|
|
3460
|
-
}), r = new
|
|
3458
|
+
fetchMethod: async (s) => await kt.readFile(s),
|
|
3459
|
+
sizeCalculation: (s) => s.length
|
|
3460
|
+
}), r = new ur(1);
|
|
3461
3461
|
this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends ft {
|
|
3462
|
-
constructor(
|
|
3463
|
-
super(), this.blobDriver =
|
|
3462
|
+
constructor(s) {
|
|
3463
|
+
super(), this.blobDriver = s;
|
|
3464
3464
|
}
|
|
3465
|
-
createNewResource(
|
|
3466
|
-
return new Us(this.blobDriver, t,
|
|
3465
|
+
createNewResource(s) {
|
|
3466
|
+
return new Us(this.blobDriver, t, s);
|
|
3467
3467
|
}
|
|
3468
|
-
calculateParamsKey(
|
|
3469
|
-
return Ks(
|
|
3468
|
+
calculateParamsKey(s) {
|
|
3469
|
+
return Ks(s);
|
|
3470
3470
|
}
|
|
3471
3471
|
}(this.blobDriver), this.pTables = new class extends ft {
|
|
3472
|
-
constructor(
|
|
3473
|
-
super(), this.pFrames =
|
|
3472
|
+
constructor(s) {
|
|
3473
|
+
super(), this.pFrames = s;
|
|
3474
3474
|
}
|
|
3475
|
-
async createNewResource(
|
|
3476
|
-
const i = this.pFrames.getByKey(
|
|
3475
|
+
async createNewResource(s) {
|
|
3476
|
+
const i = this.pFrames.getByKey(s.pFrameHandle), n = await r.run(
|
|
3477
3477
|
async () => await i.pFrame.createTable({
|
|
3478
|
-
src: oe(
|
|
3479
|
-
filters:
|
|
3478
|
+
src: oe(s.def.src),
|
|
3479
|
+
filters: s.def.filters
|
|
3480
3480
|
})
|
|
3481
3481
|
);
|
|
3482
|
-
return
|
|
3482
|
+
return s.def.sorting.length !== 0 ? n.sort(s.def.sorting) : n;
|
|
3483
3483
|
}
|
|
3484
|
-
calculateParamsKey(
|
|
3485
|
-
return $s(
|
|
3484
|
+
calculateParamsKey(s) {
|
|
3485
|
+
return $s(s);
|
|
3486
3486
|
}
|
|
3487
3487
|
}(this.pFrames);
|
|
3488
3488
|
}
|
|
@@ -3490,11 +3490,11 @@ class Ms {
|
|
|
3490
3490
|
// Internal / Config API Methods
|
|
3491
3491
|
//
|
|
3492
3492
|
createPFrame(e, t) {
|
|
3493
|
-
const r = e.map((i) => X(i, (n) =>
|
|
3494
|
-
return t.addOnDestroy(
|
|
3493
|
+
const r = e.map((i) => X(i, (n) => Go(n))), s = this.pFrames.acquire(r);
|
|
3494
|
+
return t.addOnDestroy(s.unref), s.key;
|
|
3495
3495
|
}
|
|
3496
3496
|
createPTable(e, t) {
|
|
3497
|
-
const r = this.createPFrame(Gs(e.src), t),
|
|
3497
|
+
const r = this.createPFrame(Gs(e.src), t), s = bt(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
|
|
3498
3498
|
return t.addOnDestroy(i.unref), i.key;
|
|
3499
3499
|
}
|
|
3500
3500
|
//
|
|
@@ -3508,7 +3508,7 @@ class Ms {
|
|
|
3508
3508
|
return {
|
|
3509
3509
|
hits: (await this.concurrencyLimiter.run(
|
|
3510
3510
|
async () => await this.pFrames.getByKey(e).pFrame.findColumns(r)
|
|
3511
|
-
)).hits.map((
|
|
3511
|
+
)).hits.map((s) => s.hit)
|
|
3512
3512
|
};
|
|
3513
3513
|
}
|
|
3514
3514
|
async getColumnSpec(e, t) {
|
|
@@ -3534,10 +3534,10 @@ class Ms {
|
|
|
3534
3534
|
);
|
|
3535
3535
|
r.dispose(), r = n;
|
|
3536
3536
|
}
|
|
3537
|
-
const
|
|
3538
|
-
async () => await r.getData([...
|
|
3537
|
+
const s = r.getSpec(), i = await this.concurrencyLimiter.run(
|
|
3538
|
+
async () => await r.getData([...s.keys()])
|
|
3539
3539
|
);
|
|
3540
|
-
return r.dispose(),
|
|
3540
|
+
return r.dispose(), s.map((n, a) => ({
|
|
3541
3541
|
spec: n,
|
|
3542
3542
|
data: i[a]
|
|
3543
3543
|
}));
|
|
@@ -3557,105 +3557,105 @@ class Ms {
|
|
|
3557
3557
|
return (await this.pTables.getByKey(e)).getSpec();
|
|
3558
3558
|
}
|
|
3559
3559
|
async getData(e, t, r) {
|
|
3560
|
-
const
|
|
3560
|
+
const s = await this.pTables.getByKey(e);
|
|
3561
3561
|
return await this.concurrencyLimiter.run(
|
|
3562
|
-
async () => await
|
|
3562
|
+
async () => await s.getData(t, r)
|
|
3563
3563
|
);
|
|
3564
3564
|
}
|
|
3565
3565
|
}
|
|
3566
|
-
function oe(
|
|
3567
|
-
switch (
|
|
3566
|
+
function oe(o) {
|
|
3567
|
+
switch (o.type) {
|
|
3568
3568
|
case "column":
|
|
3569
3569
|
return {
|
|
3570
3570
|
type: "column",
|
|
3571
|
-
columnId:
|
|
3571
|
+
columnId: o.column,
|
|
3572
3572
|
qualifications: []
|
|
3573
3573
|
};
|
|
3574
3574
|
case "inner":
|
|
3575
3575
|
case "full":
|
|
3576
3576
|
return {
|
|
3577
|
-
type:
|
|
3578
|
-
entries:
|
|
3577
|
+
type: o.type,
|
|
3578
|
+
entries: o.entries.map((e) => oe(e))
|
|
3579
3579
|
};
|
|
3580
3580
|
case "outer":
|
|
3581
3581
|
return {
|
|
3582
3582
|
type: "outer",
|
|
3583
|
-
primary: oe(
|
|
3584
|
-
secondary:
|
|
3583
|
+
primary: oe(o.primary),
|
|
3584
|
+
secondary: o.secondary.map((e) => oe(e))
|
|
3585
3585
|
};
|
|
3586
3586
|
default:
|
|
3587
|
-
D(
|
|
3587
|
+
D(o);
|
|
3588
3588
|
}
|
|
3589
3589
|
}
|
|
3590
|
-
function $s(
|
|
3591
|
-
const e =
|
|
3592
|
-
return e.update(
|
|
3590
|
+
function $s(o) {
|
|
3591
|
+
const e = be("sha256");
|
|
3592
|
+
return e.update(o.pFrameHandle), e.update(Ue(o.def)), e.digest().toString("hex");
|
|
3593
3593
|
}
|
|
3594
|
-
function Ks(
|
|
3595
|
-
const e =
|
|
3594
|
+
function Ks(o) {
|
|
3595
|
+
const e = o.map((s) => s.id).sort(), t = be("sha256");
|
|
3596
3596
|
let r = "";
|
|
3597
|
-
for (const
|
|
3598
|
-
r !==
|
|
3597
|
+
for (const s of e)
|
|
3598
|
+
r !== s && (t.update(s), r = s);
|
|
3599
3599
|
return t.digest().toString("hex");
|
|
3600
3600
|
}
|
|
3601
|
-
function Gs(
|
|
3601
|
+
function Gs(o) {
|
|
3602
3602
|
const e = /* @__PURE__ */ new Map();
|
|
3603
|
-
return
|
|
3603
|
+
return ge(o, e), [...e.values()];
|
|
3604
3604
|
}
|
|
3605
|
-
function
|
|
3606
|
-
switch (
|
|
3605
|
+
function ge(o, e) {
|
|
3606
|
+
switch (o.type) {
|
|
3607
3607
|
case "column":
|
|
3608
|
-
e.set(
|
|
3608
|
+
e.set(o.column.id, o.column);
|
|
3609
3609
|
return;
|
|
3610
3610
|
case "full":
|
|
3611
3611
|
case "inner":
|
|
3612
|
-
for (const t of
|
|
3612
|
+
for (const t of o.entries) ge(t, e);
|
|
3613
3613
|
return;
|
|
3614
3614
|
case "outer":
|
|
3615
|
-
|
|
3616
|
-
for (const t of
|
|
3615
|
+
ge(o.primary, e);
|
|
3616
|
+
for (const t of o.secondary) ge(t, e);
|
|
3617
3617
|
return;
|
|
3618
3618
|
default:
|
|
3619
|
-
D(
|
|
3619
|
+
D(o);
|
|
3620
3620
|
}
|
|
3621
3621
|
}
|
|
3622
|
-
async function _s(
|
|
3622
|
+
async function _s(o, e, t) {
|
|
3623
3623
|
const r = {
|
|
3624
|
-
...
|
|
3625
|
-
...
|
|
3624
|
+
...zt,
|
|
3625
|
+
...qt(e),
|
|
3626
3626
|
...t
|
|
3627
|
-
},
|
|
3627
|
+
}, s = new St(r.localSecret), i = Rr(r.logger, o, r.localProjections), n = Fr(o, r.logger), a = Br(o, r.logger), c = Or(o, r.logger), u = new Dr(
|
|
3628
3628
|
r.logger,
|
|
3629
3629
|
i,
|
|
3630
3630
|
n,
|
|
3631
3631
|
r.blobDownloadPath,
|
|
3632
|
-
|
|
3632
|
+
s,
|
|
3633
3633
|
r.blobDriverOps
|
|
3634
|
-
), l = new
|
|
3634
|
+
), l = new xr(
|
|
3635
3635
|
r.logger,
|
|
3636
|
-
|
|
3636
|
+
s,
|
|
3637
3637
|
a,
|
|
3638
3638
|
c,
|
|
3639
3639
|
r.uploadDriverOps
|
|
3640
|
-
), d = new
|
|
3640
|
+
), d = new Ar(r.logger, n, r.logStreamDriverOps), g = new Tr(r.logger, d, u), f = await jr.init(
|
|
3641
3641
|
r.logger,
|
|
3642
|
-
s,
|
|
3643
3642
|
o,
|
|
3643
|
+
s,
|
|
3644
3644
|
r.localProjections,
|
|
3645
3645
|
r.openFileDialogCallback,
|
|
3646
3646
|
r.virtualLocalStoragesOverride
|
|
3647
|
-
),
|
|
3647
|
+
), y = new Ms(u);
|
|
3648
3648
|
return {
|
|
3649
3649
|
blobDriver: u,
|
|
3650
3650
|
logDriver: g,
|
|
3651
3651
|
lsDriver: f,
|
|
3652
|
-
signer:
|
|
3652
|
+
signer: s,
|
|
3653
3653
|
uploadDriver: l,
|
|
3654
|
-
pFrameDriver:
|
|
3654
|
+
pFrameDriver: y
|
|
3655
3655
|
};
|
|
3656
3656
|
}
|
|
3657
|
-
class
|
|
3658
|
-
constructor(e, t, r,
|
|
3657
|
+
class Yt {
|
|
3658
|
+
constructor(e, t, r, s, i, n, a, c) {
|
|
3659
3659
|
p(this, "pl");
|
|
3660
3660
|
/** Contains a reactive list of projects along with their meta information. */
|
|
3661
3661
|
p(this, "projectList");
|
|
@@ -3663,7 +3663,7 @@ class qt {
|
|
|
3663
3663
|
// Projects
|
|
3664
3664
|
//
|
|
3665
3665
|
p(this, "openedProjectsByRid", /* @__PURE__ */ new Map());
|
|
3666
|
-
this.env = e, this.driverKit = t, this.signer = r, this.projectListResourceId =
|
|
3666
|
+
this.env = e, this.driverKit = t, this.signer = r, this.projectListResourceId = s, this.openedProjectsList = i, this.projectListTree = n, this.blockRegistryProvider = a, this.projectList = c, this.pl = this.env.pl;
|
|
3667
3667
|
}
|
|
3668
3668
|
/** Returns extended API driver kit used internally by middle layer. */
|
|
3669
3669
|
get internalDriverKit() {
|
|
@@ -3674,16 +3674,16 @@ class qt {
|
|
|
3674
3674
|
//
|
|
3675
3675
|
/** Creates a project with initial state and adds it to project list. */
|
|
3676
3676
|
async createProject(e, t = se()) {
|
|
3677
|
-
const r = await this.pl.withWriteTx("MLCreateProject", async (
|
|
3678
|
-
const i = await
|
|
3679
|
-
return
|
|
3677
|
+
const r = await this.pl.withWriteTx("MLCreateProject", async (s) => {
|
|
3678
|
+
const i = await No(s, e);
|
|
3679
|
+
return s.createField(w(this.projectListResourceId, t), "Dynamic", i), await s.commit(), await vr(i);
|
|
3680
3680
|
});
|
|
3681
3681
|
return await this.projectListTree.refreshState(), r;
|
|
3682
3682
|
}
|
|
3683
3683
|
/** Updates project metadata */
|
|
3684
3684
|
async setProjectMeta(e, t, r) {
|
|
3685
|
-
await
|
|
3686
|
-
|
|
3685
|
+
await J(this.pl, e, r, async (s) => {
|
|
3686
|
+
s.setMeta(t);
|
|
3687
3687
|
}), await this.projectListTree.refreshState();
|
|
3688
3688
|
}
|
|
3689
3689
|
/** Permanently deletes project from the project list, this will result in
|
|
@@ -3696,7 +3696,7 @@ class qt {
|
|
|
3696
3696
|
async projectIdToResourceId(e) {
|
|
3697
3697
|
return await this.pl.withReadTx("Project id to resource id", async (t) => {
|
|
3698
3698
|
const r = (await t.getField(w(this.projectListResourceId, e))).value;
|
|
3699
|
-
if (
|
|
3699
|
+
if (he(r)) throw new Error("Unexpected project list structure.");
|
|
3700
3700
|
return r;
|
|
3701
3701
|
});
|
|
3702
3702
|
}
|
|
@@ -3707,7 +3707,7 @@ class qt {
|
|
|
3707
3707
|
async openProject(e) {
|
|
3708
3708
|
const t = await this.ensureProjectRid(e);
|
|
3709
3709
|
if (this.openedProjectsByRid.has(t)) throw new Error(`Project ${t} already opened`);
|
|
3710
|
-
this.openedProjectsByRid.set(t, await
|
|
3710
|
+
this.openedProjectsByRid.set(t, await ze.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
|
|
3711
3711
|
}
|
|
3712
3712
|
/** Closes the project, and deallocate all corresponding resources. */
|
|
3713
3713
|
async closeProject(e) {
|
|
@@ -3739,57 +3739,57 @@ class qt {
|
|
|
3739
3739
|
}
|
|
3740
3740
|
/** Initialize middle layer */
|
|
3741
3741
|
static async init(e, t, r) {
|
|
3742
|
-
const
|
|
3742
|
+
const s = {
|
|
3743
3743
|
...Is,
|
|
3744
3744
|
...Ns(t),
|
|
3745
3745
|
...r
|
|
3746
3746
|
};
|
|
3747
|
-
process.env.MI_LOG_TREE_STAT && (
|
|
3748
|
-
const i = await e.withWriteTx("MLInitialization", async (
|
|
3749
|
-
const
|
|
3750
|
-
|
|
3751
|
-
const
|
|
3752
|
-
if (
|
|
3753
|
-
const
|
|
3754
|
-
return
|
|
3747
|
+
process.env.MI_LOG_TREE_STAT && (s.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
|
|
3748
|
+
const i = await e.withWriteTx("MLInitialization", async (C) => {
|
|
3749
|
+
const j = w(C.clientRoot, oo);
|
|
3750
|
+
C.createField(j, "Dynamic");
|
|
3751
|
+
const M = await C.getField(j);
|
|
3752
|
+
if (he(M.value)) {
|
|
3753
|
+
const N = C.createEphemeral(At);
|
|
3754
|
+
return C.lock(N), C.setField(j, N), await C.commit(), await N.globalId;
|
|
3755
3755
|
} else
|
|
3756
|
-
return
|
|
3757
|
-
}), n =
|
|
3756
|
+
return M.value;
|
|
3757
|
+
}), n = s.logger, a = await _s(e, t, s), c = new or(e.httpDispatcher, {
|
|
3758
3758
|
minTimeout: 250,
|
|
3759
3759
|
maxRetries: 4
|
|
3760
|
-
}), u = new
|
|
3760
|
+
}), u = new _r(c), l = new Do(
|
|
3761
3761
|
u,
|
|
3762
3762
|
a.signer,
|
|
3763
3763
|
c
|
|
3764
|
-
), d = new
|
|
3764
|
+
), d = new Er(
|
|
3765
3765
|
n,
|
|
3766
3766
|
e.httpDispatcher,
|
|
3767
|
-
|
|
3767
|
+
s.frontendDownloadPath
|
|
3768
3768
|
), g = {
|
|
3769
3769
|
pl: e,
|
|
3770
3770
|
signer: a.signer,
|
|
3771
3771
|
logger: n,
|
|
3772
3772
|
httpDispatcher: e.httpDispatcher,
|
|
3773
3773
|
retryHttpDispatcher: c,
|
|
3774
|
-
ops:
|
|
3774
|
+
ops: s,
|
|
3775
3775
|
bpPreparer: l,
|
|
3776
3776
|
frontendDownloadDriver: d,
|
|
3777
3777
|
driverKit: a,
|
|
3778
3778
|
blockUpdateWatcher: new Js(u, n, {
|
|
3779
|
-
minDelay:
|
|
3779
|
+
minDelay: s.devBlockUpdateRecheckInterval,
|
|
3780
3780
|
http: c
|
|
3781
3781
|
}),
|
|
3782
|
-
quickJs: await
|
|
3783
|
-
}, f = new
|
|
3784
|
-
return new
|
|
3782
|
+
quickJs: await Pr()
|
|
3783
|
+
}, f = new Sr([]), y = await io(e, i, f, g);
|
|
3784
|
+
return new Yt(
|
|
3785
3785
|
g,
|
|
3786
3786
|
a,
|
|
3787
3787
|
a.signer,
|
|
3788
3788
|
i,
|
|
3789
3789
|
f,
|
|
3790
|
-
|
|
3790
|
+
y.tree,
|
|
3791
3791
|
u,
|
|
3792
|
-
|
|
3792
|
+
y.computable
|
|
3793
3793
|
);
|
|
3794
3794
|
}
|
|
3795
3795
|
}
|
|
@@ -3831,7 +3831,7 @@ const Hs = [
|
|
|
3831
3831
|
"undici:dispatcher:retry"
|
|
3832
3832
|
// When a dispatcher retries a request
|
|
3833
3833
|
];
|
|
3834
|
-
async function Ci(
|
|
3834
|
+
async function Ci(o, e = {}) {
|
|
3835
3835
|
const t = {
|
|
3836
3836
|
pingCheckDurationMs: 1e4,
|
|
3837
3837
|
pingTimeoutMs: 3e3,
|
|
@@ -3850,7 +3850,7 @@ async function Ci(s, e = {}) {
|
|
|
3850
3850
|
...e
|
|
3851
3851
|
}, r = [];
|
|
3852
3852
|
Hs.forEach((c) => {
|
|
3853
|
-
|
|
3853
|
+
Vr(c).subscribe((l) => {
|
|
3854
3854
|
var g;
|
|
3855
3855
|
const d = (/* @__PURE__ */ new Date()).toISOString();
|
|
3856
3856
|
(g = l == null ? void 0 : l.response) != null && g.headers && (l.response.headers = l.response.headers.map((f) => f.toString())), r.push(
|
|
@@ -3862,45 +3862,45 @@ async function Ci(s, e = {}) {
|
|
|
3862
3862
|
);
|
|
3863
3863
|
});
|
|
3864
3864
|
});
|
|
3865
|
-
const
|
|
3865
|
+
const s = {
|
|
3866
3866
|
plPings: [],
|
|
3867
3867
|
blockRegistryOverviewChecks: [],
|
|
3868
3868
|
blockGARegistryOverviewChecks: [],
|
|
3869
3869
|
blockRegistryUiChecks: [],
|
|
3870
3870
|
blockGARegistryUiChecks: [],
|
|
3871
3871
|
autoUpdateCdnChecks: []
|
|
3872
|
-
}, i =
|
|
3873
|
-
|
|
3874
|
-
const u = await new
|
|
3872
|
+
}, i = yr(o, { defaultRequestTimeout: t.pingTimeoutMs });
|
|
3873
|
+
s.plPings = await Q(t.pingCheckDurationMs, t.maxPingsPerSecond, async () => {
|
|
3874
|
+
const u = await new tt(i).ping();
|
|
3875
3875
|
return JSON.stringify(u).slice(0, t.bodyLimit) + "...";
|
|
3876
3876
|
});
|
|
3877
|
-
const a = new
|
|
3878
|
-
return
|
|
3877
|
+
const a = new tt(i).ll.httpDispatcher;
|
|
3878
|
+
return s.blockRegistryOverviewChecks = await Q(
|
|
3879
3879
|
t.blockRegistryDurationMs,
|
|
3880
3880
|
t.maxRegistryChecksPerSecond,
|
|
3881
3881
|
async () => await ee(new URL(t.blockOverviewPath, t.blockRegistryUrl), t, a)
|
|
3882
|
-
),
|
|
3882
|
+
), s.blockGARegistryOverviewChecks = await Q(
|
|
3883
3883
|
t.blockRegistryDurationMs,
|
|
3884
3884
|
t.maxRegistryChecksPerSecond,
|
|
3885
3885
|
async () => await ee(new URL(t.blockOverviewPath, t.blockGARegistryUrl), t, a)
|
|
3886
|
-
),
|
|
3886
|
+
), s.blockRegistryUiChecks = await Q(
|
|
3887
3887
|
t.blockRegistryDurationMs,
|
|
3888
3888
|
t.maxRegistryChecksPerSecond,
|
|
3889
3889
|
async () => await ee(new URL(t.blockUiPath, t.blockRegistryUrl), t, a)
|
|
3890
|
-
),
|
|
3890
|
+
), s.blockGARegistryUiChecks = await Q(
|
|
3891
3891
|
t.blockRegistryDurationMs,
|
|
3892
3892
|
t.maxRegistryChecksPerSecond,
|
|
3893
3893
|
async () => await ee(new URL(t.blockUiPath, t.blockGARegistryUrl), t, a)
|
|
3894
|
-
),
|
|
3894
|
+
), s.autoUpdateCdnChecks = await Q(
|
|
3895
3895
|
t.autoUpdateCdnDurationMs,
|
|
3896
3896
|
t.maxAutoUpdateCdnChecksPerSecond,
|
|
3897
3897
|
async () => await ee(t.autoUpdateCdnUrl, t, a)
|
|
3898
|
-
), Ws(
|
|
3898
|
+
), Ws(s, o, t, r);
|
|
3899
3899
|
}
|
|
3900
|
-
async function Q(
|
|
3901
|
-
const r =
|
|
3902
|
-
for (; vt(r) <
|
|
3903
|
-
const i =
|
|
3900
|
+
async function Q(o, e, t) {
|
|
3901
|
+
const r = Je(), s = [];
|
|
3902
|
+
for (; vt(r) < o; ) {
|
|
3903
|
+
const i = Je();
|
|
3904
3904
|
let n;
|
|
3905
3905
|
try {
|
|
3906
3906
|
n = { ok: !0, value: await t() };
|
|
@@ -3908,61 +3908,61 @@ async function Q(s, e, t) {
|
|
|
3908
3908
|
n = { ok: !1, error: u };
|
|
3909
3909
|
}
|
|
3910
3910
|
const a = vt(i);
|
|
3911
|
-
|
|
3911
|
+
s.push({
|
|
3912
3912
|
elapsedMs: a,
|
|
3913
3913
|
response: n
|
|
3914
3914
|
});
|
|
3915
3915
|
const c = 1e3 / e - a;
|
|
3916
3916
|
c > 0 && await Ft(c);
|
|
3917
3917
|
}
|
|
3918
|
-
return
|
|
3918
|
+
return s;
|
|
3919
3919
|
}
|
|
3920
|
-
async function ee(
|
|
3921
|
-
const { body: r, statusCode:
|
|
3920
|
+
async function ee(o, e, t) {
|
|
3921
|
+
const { body: r, statusCode: s } = await K(o, {
|
|
3922
3922
|
dispatcher: t,
|
|
3923
3923
|
headersTimeout: e.httpTimeoutMs,
|
|
3924
3924
|
bodyTimeout: e.httpTimeoutMs
|
|
3925
3925
|
}), i = await r.text();
|
|
3926
3926
|
return {
|
|
3927
|
-
statusCode:
|
|
3927
|
+
statusCode: s,
|
|
3928
3928
|
beginningOfBody: i.slice(0, e.bodyLimit) + "..."
|
|
3929
3929
|
};
|
|
3930
3930
|
}
|
|
3931
|
-
function Ws(
|
|
3932
|
-
const
|
|
3933
|
-
...new Set(
|
|
3931
|
+
function Ws(o, e, t, r) {
|
|
3932
|
+
const s = o.plPings.filter((a) => a.response.ok), i = o.plPings.filter((a) => !a.response.ok), n = [
|
|
3933
|
+
...new Set(s.map((a) => JSON.stringify(a.response.value)))
|
|
3934
3934
|
];
|
|
3935
3935
|
return `
|
|
3936
3936
|
Network report:
|
|
3937
3937
|
pl endpoint: ${e};
|
|
3938
3938
|
options: ${JSON.stringify(t, null, 2)}.
|
|
3939
3939
|
|
|
3940
|
-
Platforma pings: ${Z(
|
|
3940
|
+
Platforma pings: ${Z(o.plPings)}
|
|
3941
3941
|
|
|
3942
|
-
Block registry overview responses: ${Z(
|
|
3942
|
+
Block registry overview responses: ${Z(o.blockRegistryOverviewChecks)}
|
|
3943
3943
|
|
|
3944
|
-
Block ga registry overview responses: ${Z(
|
|
3944
|
+
Block ga registry overview responses: ${Z(o.blockGARegistryOverviewChecks)}
|
|
3945
3945
|
|
|
3946
|
-
Block registry ui responses: ${Z(
|
|
3946
|
+
Block registry ui responses: ${Z(o.blockRegistryUiChecks)}
|
|
3947
3947
|
|
|
3948
|
-
Block ga registry ui responses: ${Z(
|
|
3948
|
+
Block ga registry ui responses: ${Z(o.blockGARegistryUiChecks)}
|
|
3949
3949
|
|
|
3950
|
-
Auto-update CDN responses: ${Z(
|
|
3950
|
+
Auto-update CDN responses: ${Z(o.autoUpdateCdnChecks)}
|
|
3951
3951
|
|
|
3952
3952
|
Block registry overview dumps:
|
|
3953
|
-
${JSON.stringify(
|
|
3953
|
+
${JSON.stringify(o.blockRegistryOverviewChecks, null, 2)}
|
|
3954
3954
|
|
|
3955
3955
|
Block ga registry overview dumps:
|
|
3956
|
-
${JSON.stringify(
|
|
3956
|
+
${JSON.stringify(o.blockGARegistryOverviewChecks, null, 2)}
|
|
3957
3957
|
|
|
3958
3958
|
Block registry ui dumps:
|
|
3959
|
-
${JSON.stringify(
|
|
3959
|
+
${JSON.stringify(o.blockRegistryUiChecks, null, 2)}
|
|
3960
3960
|
|
|
3961
3961
|
Block ga registry ui dumps:
|
|
3962
|
-
${JSON.stringify(
|
|
3962
|
+
${JSON.stringify(o.blockGARegistryUiChecks, null, 2)}
|
|
3963
3963
|
|
|
3964
3964
|
Auto-update CDN dumps:
|
|
3965
|
-
${JSON.stringify(
|
|
3965
|
+
${JSON.stringify(o.autoUpdateCdnChecks, null, 2)}
|
|
3966
3966
|
|
|
3967
3967
|
Platforma pings error dumps:
|
|
3968
3968
|
${JSON.stringify(i, null, 2)}
|
|
@@ -3975,59 +3975,59 @@ ${r.join(`
|
|
|
3975
3975
|
`)}
|
|
3976
3976
|
`;
|
|
3977
3977
|
}
|
|
3978
|
-
function Z(
|
|
3979
|
-
const e =
|
|
3978
|
+
function Z(o) {
|
|
3979
|
+
const e = o.filter((s) => s.response.ok), { mean: t, median: r } = zs(o);
|
|
3980
3980
|
return `
|
|
3981
|
-
total: ${
|
|
3981
|
+
total: ${o.length};
|
|
3982
3982
|
successes: ${e.length};
|
|
3983
|
-
errors: ${
|
|
3983
|
+
errors: ${o.length - e.length};
|
|
3984
3984
|
mean in ms: ${t};
|
|
3985
3985
|
median in ms: ${r};
|
|
3986
3986
|
`;
|
|
3987
3987
|
}
|
|
3988
|
-
function zs(
|
|
3989
|
-
const e =
|
|
3988
|
+
function zs(o) {
|
|
3989
|
+
const e = o.map((s) => s.elapsedMs), t = e.reduce((s, i) => s + i) / e.length;
|
|
3990
3990
|
let r;
|
|
3991
3991
|
if (e.length > 0) {
|
|
3992
|
-
const
|
|
3993
|
-
r = e.length % 2 ? e[
|
|
3992
|
+
const s = Math.floor(e.length / 2);
|
|
3993
|
+
r = e.length % 2 ? e[s] : (e[s - 1] + e[s]) / 2;
|
|
3994
3994
|
}
|
|
3995
3995
|
return { mean: t, median: r };
|
|
3996
3996
|
}
|
|
3997
|
-
function
|
|
3997
|
+
function Je() {
|
|
3998
3998
|
return Date.now();
|
|
3999
3999
|
}
|
|
4000
|
-
function vt(
|
|
4001
|
-
return
|
|
4000
|
+
function vt(o) {
|
|
4001
|
+
return Je() - o;
|
|
4002
4002
|
}
|
|
4003
4003
|
export {
|
|
4004
4004
|
bi as BlockPackRegistry,
|
|
4005
4005
|
wi as CentralBlockRegistry,
|
|
4006
|
-
|
|
4007
|
-
|
|
4006
|
+
qt as DefaultDriverKitOpsPaths,
|
|
4007
|
+
zt as DefaultDriverKitOpsSettings,
|
|
4008
4008
|
Ns as DefaultMiddleLayerOpsPaths,
|
|
4009
4009
|
Is as DefaultMiddleLayerOpsSettings,
|
|
4010
4010
|
Et as FrontendFromFolderResourceType,
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4011
|
+
jt as FrontendFromUrlResourceType,
|
|
4012
|
+
Yt as MiddleLayer,
|
|
4013
|
+
ze as Project,
|
|
4014
|
+
mo as TengoTemplateGet,
|
|
4015
|
+
vo as TengoTemplateGetRegistry,
|
|
4016
|
+
bo as TengoTemplateGetTemplate,
|
|
4017
|
+
yo as TengoTemplateGetTemplateURI,
|
|
4018
|
+
wo as TengoTemplatePack,
|
|
4019
|
+
So as TengoTemplatePackConvert,
|
|
4020
|
+
Co as TengoTemplatePackConvertTemplate,
|
|
4021
|
+
ko as TengoTemplatePackConvertTemplatePack,
|
|
4022
4022
|
ki as V1CentralDevSnapshotRegistry,
|
|
4023
4023
|
Si as V1CentralRegistry,
|
|
4024
|
-
|
|
4024
|
+
_r as V2RegistryProvider,
|
|
4025
4025
|
Ci as checkNetwork,
|
|
4026
|
-
|
|
4026
|
+
Tt as createRenderTemplate,
|
|
4027
4027
|
Ot as getDevV1PacketMtime,
|
|
4028
|
-
|
|
4028
|
+
Ke as getDevV2PacketMtime,
|
|
4029
4029
|
_s as initDriverKit,
|
|
4030
|
-
|
|
4031
|
-
|
|
4030
|
+
_e as loadTemplate,
|
|
4031
|
+
Po as prepareTemplateSpec
|
|
4032
4032
|
};
|
|
4033
4033
|
//# sourceMappingURL=index.mjs.map
|