@milaboratories/pl-middle-layer 1.12.3 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +436 -420
- package/dist/index.mjs.map +1 -1
- package/dist/middle_layer/driver_kit.d.ts +1 -1
- package/dist/middle_layer/driver_kit.d.ts.map +1 -1
- package/dist/middle_layer/middle_layer.d.ts +2 -2
- package/dist/middle_layer/middle_layer.d.ts.map +1 -1
- package/dist/middle_layer/ops.d.ts +40 -24
- package/dist/middle_layer/ops.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/middle_layer/driver_kit.ts +22 -22
- package/src/middle_layer/middle_layer.test.ts +7 -9
- package/src/middle_layer/middle_layer.ts +18 -6
- package/src/middle_layer/ops.ts +91 -42
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
var Ut = Object.defineProperty;
|
|
2
2
|
var $t = (s, e, t) => e in s ? Ut(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
3
|
var d = (s, e, t) => $t(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { executePSpecPredicate as Gt, mapPObjectData as
|
|
4
|
+
import { executePSpecPredicate as Gt, mapPObjectData as Q, mapValueInVOE as Ht, mapPTableDef as ut, isFunctionHandle as lt, normalizeBlockConfig as je, DefaultNavigationState as _t } from "@platforma-sdk/model";
|
|
5
5
|
export * from "@platforma-sdk/model";
|
|
6
6
|
import { blockPackIdEquals as me } from "@milaboratories/pl-model-middle-layer";
|
|
7
7
|
export * from "@milaboratories/pl-model-middle-layer";
|
|
8
|
-
import { request as
|
|
9
|
-
import { RegistryV1 as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
8
|
+
import { request as H, RetryAgent as Wt } from "undici";
|
|
9
|
+
import { RegistryV1 as _, tryLoadPackDescription as dt, BlockPackMetaEmbedAbsoluteBytes as zt, RegistryV2Reader as Yt, folderReaderByUrl as qt, loadPackDescription as _e } from "@platforma-sdk/block-tools";
|
|
10
|
+
import T from "node:fs";
|
|
11
|
+
import E from "node:path";
|
|
12
12
|
import Qt from "yaml";
|
|
13
|
-
import { assertNever as
|
|
13
|
+
import { assertNever as D, notEmpty as w, ConsoleLoggerAdapter as Zt, ConcurrencyLimitingExecutor as Xt, HmacSha256Signer as pt } from "@milaboratories/ts-helpers";
|
|
14
14
|
import * as ht from "node:fs/promises";
|
|
15
15
|
import { tryResolve as er } from "@milaboratories/resolve-helper";
|
|
16
|
-
import { resourceTypesEqual as U, field as S, Pl as
|
|
16
|
+
import { resourceTypesEqual as U, field as S, Pl as y, PlClient as tr, isNullResourceId as ce, ensureResourceIdNotNull as Se, isResource as rr, isResourceRef as or, isNotNullResourceId as We, resourceType as re, resourceTypeToString as sr, resourceIdToString as gt, isNotFoundError as ir, isTimeoutOrCancelError as nr, toGlobalResourceId as ar } from "@milaboratories/pl-client";
|
|
17
17
|
export * from "@milaboratories/pl-client";
|
|
18
18
|
import { SynchronizedTreeState as ft, PlError as cr } from "@milaboratories/pl-tree";
|
|
19
|
-
import { Computable as
|
|
20
|
-
import { randomUUID as
|
|
19
|
+
import { Computable as F, ChangeSource as ze, PollComputablePool as ur, WatchableValue as lr } from "@milaboratories/computable";
|
|
20
|
+
import { randomUUID as X, createHash as he } from "node:crypto";
|
|
21
21
|
import mt from "denque";
|
|
22
22
|
import { Templates as dr } from "@platforma-sdk/workflow-tengo";
|
|
23
|
-
import
|
|
23
|
+
import Ee from "canonicalize";
|
|
24
24
|
import pr from "node:assert";
|
|
25
25
|
import { Scope as ke, getQuickJS as hr } from "quickjs-emscripten";
|
|
26
26
|
import { setTimeout as gr } from "node:timers/promises";
|
|
27
|
-
import
|
|
28
|
-
import { createDownloadClient as fr, createLogsClient as mr, createUploadBlobClient as vr, createUploadProgressClient as yr, createLsFilesClient as br, DownloadDriver as wr, UploadDriver as Sr, LogsStreamDriver as kr, LogsDriver as Cr, LsDriver as Pr, DownloadUrlDriver as Fr } from "@milaboratories/pl-drivers";
|
|
27
|
+
import { DefaultVirtualLocalStorages as fr, createDownloadClient as mr, createLogsClient as vr, createUploadBlobClient as yr, createUploadProgressClient as br, DownloadDriver as wr, UploadDriver as Sr, LogsStreamDriver as kr, LogsDriver as Cr, LsDriver as Pr, DownloadUrlDriver as Fr } from "@milaboratories/pl-drivers";
|
|
29
28
|
import { PFrame as Br } from "@milaboratories/pframes-node";
|
|
30
29
|
import { LRUCache as Rr } from "lru-cache";
|
|
31
30
|
async function Ye(s) {
|
|
@@ -37,15 +36,15 @@ async function Ye(s) {
|
|
|
37
36
|
throw e;
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
const Or = [
|
|
41
|
-
Ee,
|
|
39
|
+
const Or = [_.PlPackageYamlConfigFile], Dr = [_.PlPackageJsonConfigFile], Ae = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Te = ["config", "dist", "config.json"], vt = ["frontend", "dist"], qe = "block-model/dist/config.json", xr = "block-ui/package.json", jr = [
|
|
42
40
|
Ae,
|
|
41
|
+
Te,
|
|
43
42
|
Or,
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
Dr,
|
|
44
|
+
vt
|
|
46
45
|
];
|
|
47
|
-
async function
|
|
48
|
-
return await Ye(
|
|
46
|
+
async function Er(s) {
|
|
47
|
+
return await Ye(E.join(s, ...Te)) !== void 0 || await Ye(E.join(s, ...Ae)) !== void 0;
|
|
49
48
|
}
|
|
50
49
|
function ve(s, e) {
|
|
51
50
|
const t = er(s, e);
|
|
@@ -53,47 +52,47 @@ function ve(s, e) {
|
|
|
53
52
|
return t;
|
|
54
53
|
}
|
|
55
54
|
async function Qe(s, e) {
|
|
56
|
-
if (
|
|
55
|
+
if (E.isAbsolute(s) || (s = E.resolve(s)), await Er(s))
|
|
57
56
|
return {
|
|
58
|
-
workflow:
|
|
59
|
-
config:
|
|
60
|
-
ui:
|
|
57
|
+
workflow: E.join(s, ...Ae),
|
|
58
|
+
config: E.join(s, ...Te),
|
|
59
|
+
ui: E.join(s, ...vt)
|
|
61
60
|
};
|
|
62
61
|
{
|
|
63
|
-
const t = ve(s, qe), r = ve(s, qe), o = ve(s,
|
|
64
|
-
return { workflow: t, config: r, ui:
|
|
62
|
+
const t = ve(s, qe), r = ve(s, qe), o = ve(s, xr);
|
|
63
|
+
return { workflow: t, config: r, ui: E.resolve(o, "..", "dist") };
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
async function
|
|
66
|
+
async function Ar(s) {
|
|
68
67
|
try {
|
|
69
|
-
return await
|
|
68
|
+
return await T.promises.readFile(s, "utf8");
|
|
70
69
|
} catch (e) {
|
|
71
70
|
if (e.code === "ENOENT")
|
|
72
71
|
return;
|
|
73
72
|
throw e;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
async function
|
|
75
|
+
async function Tr(s) {
|
|
77
76
|
try {
|
|
78
|
-
return await
|
|
77
|
+
return await T.promises.stat(s, { bigint: !0 });
|
|
79
78
|
} catch (e) {
|
|
80
79
|
if (e.code === "ENOENT")
|
|
81
80
|
return;
|
|
82
81
|
throw e;
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
async function
|
|
84
|
+
async function yt(s) {
|
|
86
85
|
let e = 0n;
|
|
87
86
|
for (const t of jr) {
|
|
88
|
-
const r =
|
|
87
|
+
const r = E.join(s, ...t), o = await Tr(r);
|
|
89
88
|
o !== void 0 && e < o.mtimeNs && (e = o.mtimeNs);
|
|
90
89
|
}
|
|
91
90
|
return e.toString();
|
|
92
91
|
}
|
|
93
92
|
async function Ie(s) {
|
|
94
|
-
const e = await
|
|
93
|
+
const e = await T.promises.stat(s.components.workflow.main.file, {
|
|
95
94
|
bigint: !0
|
|
96
|
-
}), t = await
|
|
95
|
+
}), t = await T.promises.stat(s.components.model.file, { bigint: !0 });
|
|
97
96
|
return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
|
|
98
97
|
}
|
|
99
98
|
class si {
|
|
@@ -104,8 +103,8 @@ class si {
|
|
|
104
103
|
const t = [], r = e.spec;
|
|
105
104
|
switch (r.type) {
|
|
106
105
|
case "remote-v1":
|
|
107
|
-
const o = this.http !== void 0 ? { dispatcher: this.http } : {}, n = await (await
|
|
108
|
-
`${r.url}/${
|
|
106
|
+
const o = this.http !== void 0 ? { dispatcher: this.http } : {}, n = await (await H(
|
|
107
|
+
`${r.url}/${_.GlobalOverviewPath}`,
|
|
109
108
|
o
|
|
110
109
|
)).body.json();
|
|
111
110
|
for (const a of n) {
|
|
@@ -140,13 +139,13 @@ class si {
|
|
|
140
139
|
registryId: e.id
|
|
141
140
|
}));
|
|
142
141
|
case "local-dev":
|
|
143
|
-
for (const a of await
|
|
142
|
+
for (const a of await T.promises.readdir(r.path, { withFileTypes: !0 })) {
|
|
144
143
|
if (!a.isDirectory()) continue;
|
|
145
|
-
const c =
|
|
146
|
-
|
|
144
|
+
const c = E.join(r.path, a.name), u = await Ar(
|
|
145
|
+
E.join(c, _.PlPackageYamlConfigFile)
|
|
147
146
|
);
|
|
148
147
|
if (u !== void 0) {
|
|
149
|
-
const l =
|
|
148
|
+
const l = _.PlPackageConfigData.parse(Qt.parse(u)), p = await yt(c), h = {
|
|
150
149
|
organization: l.organization,
|
|
151
150
|
name: l.package,
|
|
152
151
|
version: "DEV"
|
|
@@ -189,7 +188,7 @@ class si {
|
|
|
189
188
|
}
|
|
190
189
|
return t;
|
|
191
190
|
default:
|
|
192
|
-
return
|
|
191
|
+
return D(r);
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
194
|
async listBlockPacks() {
|
|
@@ -222,12 +221,12 @@ const ii = {
|
|
|
222
221
|
url: "https://block.registry.platforma.bio/dev"
|
|
223
222
|
}, Vr = {
|
|
224
223
|
groups: [{ id: "default", label: "Default", blocks: [] }]
|
|
225
|
-
},
|
|
224
|
+
}, Lr = {
|
|
226
225
|
stagingRefreshTimestamp: 0,
|
|
227
226
|
blocksInLimbo: []
|
|
228
|
-
},
|
|
227
|
+
}, Nr = {
|
|
229
228
|
label: "New Project"
|
|
230
|
-
}, Jr = { name: "UserProject", version: "2" },
|
|
229
|
+
}, Jr = { name: "UserProject", version: "2" }, bt = "SchemaVersion", wt = "1", Ve = "ProjectCreated", ee = "ProjectLastModified", te = "ProjectMeta", W = "ProjectStructure", ue = "BlockRenderingState", Kr = "BlockFrontendState/", Mr = /^BlockFrontendState\/(?<blockid>.*)$/;
|
|
231
230
|
function Ce(s) {
|
|
232
231
|
return `${Kr}${s}`;
|
|
233
232
|
}
|
|
@@ -245,7 +244,7 @@ const Gr = "__serviceTemplate_";
|
|
|
245
244
|
function Be(s) {
|
|
246
245
|
return `${Gr}${s}`;
|
|
247
246
|
}
|
|
248
|
-
function
|
|
247
|
+
function P(s, e) {
|
|
249
248
|
return `${s}-${e}`;
|
|
250
249
|
}
|
|
251
250
|
const Hr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
|
|
@@ -255,7 +254,7 @@ function _r(s) {
|
|
|
255
254
|
const { blockId: t, fieldName: r } = e.groups;
|
|
256
255
|
return { blockId: t, fieldName: r };
|
|
257
256
|
}
|
|
258
|
-
const Wr = "projects",
|
|
257
|
+
const Wr = "projects", St = { name: "Projects", version: "1" }, zr = (s) => U(s.type, St) ? s.fields : [];
|
|
259
258
|
async function Yr(s, e, t, r) {
|
|
260
259
|
const o = await ft.init(
|
|
261
260
|
s,
|
|
@@ -266,19 +265,19 @@ async function Yr(s, e, t, r) {
|
|
|
266
265
|
},
|
|
267
266
|
r.logger
|
|
268
267
|
);
|
|
269
|
-
return { computable:
|
|
268
|
+
return { computable: F.make((n) => {
|
|
270
269
|
const a = n.accessor(o.entry()).node(), c = t.getValue(n);
|
|
271
270
|
if (a === void 0) return;
|
|
272
271
|
const u = [];
|
|
273
272
|
for (const l of a.listDynamicFields()) {
|
|
274
273
|
const p = a.traverse(l);
|
|
275
274
|
if (p === void 0) continue;
|
|
276
|
-
const h = w(p.getKeyValueAsJson(
|
|
275
|
+
const h = w(p.getKeyValueAsJson(te)), f = w(p.getKeyValueAsJson(Ve)), b = w(p.getKeyValueAsJson(ee));
|
|
277
276
|
u.push({
|
|
278
277
|
id: l,
|
|
279
278
|
rid: p.id,
|
|
280
279
|
created: new Date(f),
|
|
281
|
-
lastModified: new Date(
|
|
280
|
+
lastModified: new Date(b),
|
|
282
281
|
opened: c.indexOf(p.id) >= 0,
|
|
283
282
|
meta: h
|
|
284
283
|
});
|
|
@@ -293,14 +292,14 @@ const qr = {
|
|
|
293
292
|
name: "RenderTemplate",
|
|
294
293
|
version: "1"
|
|
295
294
|
};
|
|
296
|
-
function
|
|
295
|
+
function kt(s, e, t, r, o) {
|
|
297
296
|
if (o.length === 0) throw new Error("Zero output names provided");
|
|
298
297
|
const i = t ? s.createEphemeral(qr) : s.createStruct(Qr), n = S(i, "template"), a = S(i, "inputs");
|
|
299
|
-
return s.createField(n, "Input", e), s.createField(a, "Input",
|
|
298
|
+
return s.createField(n, "Input", e), s.createField(a, "Input", y.createPlMap(s, r, t)), s.lockInputs(i), y.futureRecord(s, i, o, "Output", "outputs/");
|
|
300
299
|
}
|
|
301
300
|
const Zr = { name: "BContextEnd", version: "1" }, Xr = { name: "BContext", version: "1" }, eo = "id", to = "parent/", ro = ["context", "result"];
|
|
302
301
|
function Ze(s, e, t) {
|
|
303
|
-
return
|
|
302
|
+
return kt(s, e, !0, t, ro);
|
|
304
303
|
}
|
|
305
304
|
function oo(s) {
|
|
306
305
|
const e = s.createEphemeral(Zr);
|
|
@@ -310,7 +309,7 @@ function so(s, e) {
|
|
|
310
309
|
if (e.length === 0) return oo(s);
|
|
311
310
|
if (e.length === 1) return e[0];
|
|
312
311
|
const t = s.createEphemeral(Xr);
|
|
313
|
-
s.createField(S(t, eo), "Input",
|
|
312
|
+
s.createField(S(t, eo), "Input", y.createPlString(s, X()));
|
|
314
313
|
for (let r = 0; r < e.length; r++)
|
|
315
314
|
s.createField(S(t, `${to}${r}`), "Input", e[r]);
|
|
316
315
|
return s.lock(t), t;
|
|
@@ -324,34 +323,34 @@ async function go(s) {
|
|
|
324
323
|
case "from-file":
|
|
325
324
|
return {
|
|
326
325
|
type: "explicit",
|
|
327
|
-
content: await
|
|
326
|
+
content: await T.promises.readFile(s.path)
|
|
328
327
|
};
|
|
329
328
|
case "from-registry":
|
|
330
329
|
case "explicit":
|
|
331
330
|
return s;
|
|
332
331
|
default:
|
|
333
|
-
return
|
|
332
|
+
return D(s);
|
|
334
333
|
}
|
|
335
334
|
}
|
|
336
335
|
function fo(s, e) {
|
|
337
336
|
const t = s.createStruct(io), r = S(t, no), o = S(t, ao), i = S(t, co);
|
|
338
|
-
return s.setField(r, s.createValue(
|
|
337
|
+
return s.setField(r, s.createValue(y.JsonString, Buffer.from(JSON.stringify(e.registry)))), s.setField(o, s.createValue(y.JsonString, Buffer.from(JSON.stringify(e.path)))), i;
|
|
339
338
|
}
|
|
340
339
|
function mo(s, e) {
|
|
341
340
|
const t = s.createValue(uo, e.content), r = s.createStruct(lo), o = S(r, po), i = S(r, ho);
|
|
342
341
|
return s.setField(o, t), i;
|
|
343
342
|
}
|
|
344
|
-
function
|
|
343
|
+
function Le(s, e) {
|
|
345
344
|
switch (e.type) {
|
|
346
345
|
case "from-registry":
|
|
347
346
|
return fo(s, e);
|
|
348
347
|
case "explicit":
|
|
349
348
|
return mo(s, e);
|
|
350
349
|
default:
|
|
351
|
-
return
|
|
350
|
+
return D(e);
|
|
352
351
|
}
|
|
353
352
|
}
|
|
354
|
-
const
|
|
353
|
+
const Ct = { name: "Frontend/FromUrl", version: "1" }, Pt = {
|
|
355
354
|
name: "Frontend/FromFolder",
|
|
356
355
|
version: "1"
|
|
357
356
|
};
|
|
@@ -359,22 +358,22 @@ function vo(s, e) {
|
|
|
359
358
|
switch (e.type) {
|
|
360
359
|
case "url":
|
|
361
360
|
return s.createValue(
|
|
362
|
-
|
|
361
|
+
Ct,
|
|
363
362
|
JSON.stringify({ url: e.url })
|
|
364
363
|
);
|
|
365
364
|
case "local":
|
|
366
365
|
return s.createValue(
|
|
367
|
-
|
|
366
|
+
Pt,
|
|
368
367
|
JSON.stringify({
|
|
369
368
|
path: e.path,
|
|
370
369
|
signature: e.signature
|
|
371
370
|
})
|
|
372
371
|
);
|
|
373
372
|
default:
|
|
374
|
-
return
|
|
373
|
+
return D(e);
|
|
375
374
|
}
|
|
376
375
|
}
|
|
377
|
-
const yo = { name: "BlockPackCustom", version: "1" },
|
|
376
|
+
const yo = { name: "BlockPackCustom", version: "1" }, Ft = "template", Bt = "frontend";
|
|
378
377
|
function Xe(s) {
|
|
379
378
|
return s.endsWith("/") ? s : `${s}/`;
|
|
380
379
|
}
|
|
@@ -387,25 +386,25 @@ class bo {
|
|
|
387
386
|
case "explicit":
|
|
388
387
|
return e.config;
|
|
389
388
|
case "dev-v1": {
|
|
390
|
-
const t = await Qe(e.folder), r = await
|
|
389
|
+
const t = await Qe(e.folder), r = await T.promises.readFile(t.config, { encoding: "utf-8" });
|
|
391
390
|
return JSON.parse(r);
|
|
392
391
|
}
|
|
393
392
|
case "dev-v2": {
|
|
394
|
-
const t = await _e(e.folder), r = await
|
|
393
|
+
const t = await _e(e.folder), r = await T.promises.readFile(t.components.model.file, {
|
|
395
394
|
encoding: "utf-8"
|
|
396
395
|
});
|
|
397
396
|
return JSON.parse(r);
|
|
398
397
|
}
|
|
399
398
|
case "from-registry-v1": {
|
|
400
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${
|
|
401
|
-
return await (await
|
|
399
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${_.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
|
|
400
|
+
return await (await H(`${r}/config.json`, t)).body.json();
|
|
402
401
|
}
|
|
403
402
|
case "from-registry-v2": {
|
|
404
403
|
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
|
|
405
|
-
return await (await
|
|
404
|
+
return await (await H(o.model.url, t)).body.json();
|
|
406
405
|
}
|
|
407
406
|
default:
|
|
408
|
-
return
|
|
407
|
+
return D(e);
|
|
409
408
|
}
|
|
410
409
|
}
|
|
411
410
|
async prepare(e) {
|
|
@@ -413,8 +412,8 @@ class bo {
|
|
|
413
412
|
case "explicit":
|
|
414
413
|
return e;
|
|
415
414
|
case "dev-v1": {
|
|
416
|
-
const t = await Qe(e.folder), r = await
|
|
417
|
-
await
|
|
415
|
+
const t = await Qe(e.folder), r = await T.promises.readFile(t.workflow), o = JSON.parse(
|
|
416
|
+
await T.promises.readFile(t.config, "utf-8")
|
|
418
417
|
), i = t.ui;
|
|
419
418
|
return {
|
|
420
419
|
type: "explicit",
|
|
@@ -433,10 +432,10 @@ class bo {
|
|
|
433
432
|
}
|
|
434
433
|
case "dev-v2": {
|
|
435
434
|
const t = await _e(e.folder), r = JSON.parse(
|
|
436
|
-
await
|
|
435
|
+
await T.promises.readFile(t.components.model.file, {
|
|
437
436
|
encoding: "utf-8"
|
|
438
437
|
})
|
|
439
|
-
), o = await
|
|
438
|
+
), o = await T.promises.readFile(
|
|
440
439
|
t.components.workflow.main.file
|
|
441
440
|
), i = t.components.ui.folder, n = { ...e };
|
|
442
441
|
return e.mtime === void 0 && (n.mtime = await Ie(t)), {
|
|
@@ -455,12 +454,12 @@ class bo {
|
|
|
455
454
|
};
|
|
456
455
|
}
|
|
457
456
|
case "from-registry-v1": {
|
|
458
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${
|
|
457
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${_.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, o = `${r}/template.plj.gz`, i = await H(o, t);
|
|
459
458
|
if (i.statusCode !== 200)
|
|
460
459
|
throw new Error(
|
|
461
460
|
`Block not found in registry (url = ${o} ; code = ${i.statusCode}): ` + JSON.stringify(e)
|
|
462
461
|
);
|
|
463
|
-
const n = new Uint8Array(await i.body.arrayBuffer()), c = await (await
|
|
462
|
+
const n = new Uint8Array(await i.body.arrayBuffer()), c = await (await H(`${r}/config.json`, t)).body.json();
|
|
464
463
|
return {
|
|
465
464
|
type: "explicit",
|
|
466
465
|
template: {
|
|
@@ -476,7 +475,7 @@ class bo {
|
|
|
476
475
|
};
|
|
477
476
|
}
|
|
478
477
|
case "from-registry-v2": {
|
|
479
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), i = async () => await (await
|
|
478
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), i = async () => await (await H(o.model.url, t)).body.json(), n = async () => await (await H(o.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([i(), n()]);
|
|
480
479
|
return {
|
|
481
480
|
type: "explicit",
|
|
482
481
|
template: {
|
|
@@ -492,20 +491,20 @@ class bo {
|
|
|
492
491
|
};
|
|
493
492
|
}
|
|
494
493
|
default:
|
|
495
|
-
return
|
|
494
|
+
return D(e);
|
|
496
495
|
}
|
|
497
496
|
}
|
|
498
497
|
}
|
|
499
498
|
function wo(s, e) {
|
|
500
499
|
const t = { config: e.config, source: e.source }, r = s.createStruct(yo, JSON.stringify(t));
|
|
501
|
-
return s.createField(S(r,
|
|
500
|
+
return s.createField(S(r, Ft), "Input", Le(s, e.template)), s.createField(S(r, Bt), "Input", vo(s, e.frontend)), s.lock(r), r;
|
|
502
501
|
}
|
|
503
502
|
function et(s, e) {
|
|
504
503
|
switch (e.type) {
|
|
505
504
|
case "explicit":
|
|
506
505
|
return wo(s, e);
|
|
507
506
|
default:
|
|
508
|
-
return
|
|
507
|
+
return D(e.type);
|
|
509
508
|
}
|
|
510
509
|
}
|
|
511
510
|
function ie(s, e) {
|
|
@@ -536,21 +535,21 @@ function Re(s, e, t) {
|
|
|
536
535
|
Re(s, o, t);
|
|
537
536
|
return;
|
|
538
537
|
default:
|
|
539
|
-
|
|
538
|
+
D(r);
|
|
540
539
|
}
|
|
541
540
|
}
|
|
542
541
|
function ko(s, e) {
|
|
543
542
|
const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
|
|
544
543
|
return Re(t, s, e), t;
|
|
545
544
|
}
|
|
546
|
-
function
|
|
545
|
+
function L(s) {
|
|
547
546
|
return {
|
|
548
547
|
*[Symbol.iterator]() {
|
|
549
548
|
for (const e of s.groups) for (const t of e.blocks) yield t;
|
|
550
549
|
}
|
|
551
550
|
};
|
|
552
551
|
}
|
|
553
|
-
class
|
|
552
|
+
class Rt {
|
|
554
553
|
constructor(e) {
|
|
555
554
|
/** Nodes are stored in the map in topological order */
|
|
556
555
|
d(this, "nodes");
|
|
@@ -583,18 +582,18 @@ class Ot {
|
|
|
583
582
|
function Oe(s) {
|
|
584
583
|
const e = /* @__PURE__ */ new Map();
|
|
585
584
|
let t;
|
|
586
|
-
for (const { id: r } of
|
|
585
|
+
for (const { id: r } of L(s)) {
|
|
587
586
|
const o = {
|
|
588
587
|
id: r,
|
|
589
588
|
missingReferences: !1
|
|
590
589
|
};
|
|
591
590
|
e.set(r, o), t === void 0 ? o.upstream = /* @__PURE__ */ new Set() : (o.upstream = /* @__PURE__ */ new Set([t.id]), t.downstream = /* @__PURE__ */ new Set([o.id])), t = o;
|
|
592
591
|
}
|
|
593
|
-
return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new
|
|
592
|
+
return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Rt(e);
|
|
594
593
|
}
|
|
595
594
|
function ne(s, e) {
|
|
596
595
|
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
597
|
-
for (const { id: o } of
|
|
596
|
+
for (const { id: o } of L(s)) {
|
|
598
597
|
const i = e(o);
|
|
599
598
|
if (i === void 0) continue;
|
|
600
599
|
const n = ko(i, r), a = {
|
|
@@ -606,15 +605,15 @@ function ne(s, e) {
|
|
|
606
605
|
};
|
|
607
606
|
t.set(o, a), n.upstreams.forEach((c) => t.get(c).downstream.add(o)), r.add(o);
|
|
608
607
|
}
|
|
609
|
-
return new
|
|
608
|
+
return new Rt(t);
|
|
610
609
|
}
|
|
611
610
|
function Co(s, e) {
|
|
612
611
|
if (s.size !== e.size) return !1;
|
|
613
612
|
for (const t of s) if (!e.has(t)) return !1;
|
|
614
613
|
return !0;
|
|
615
614
|
}
|
|
616
|
-
function
|
|
617
|
-
if (s.size > e.size) return
|
|
615
|
+
function De(s, e) {
|
|
616
|
+
if (s.size > e.size) return De(e, s);
|
|
618
617
|
for (const t of s) if (e.has(t)) return !0;
|
|
619
618
|
return !1;
|
|
620
619
|
}
|
|
@@ -622,13 +621,13 @@ function tt(s, e) {
|
|
|
622
621
|
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
623
622
|
return s.nodes.forEach((i) => {
|
|
624
623
|
const n = e.nodes.get(i.id);
|
|
625
|
-
n === void 0 ? t.add(i.id) : (!Co(i.upstream, n.upstream) ||
|
|
624
|
+
n === void 0 ? t.add(i.id) : (!Co(i.upstream, n.upstream) || De(i.upstream, o)) && o.add(i.id);
|
|
626
625
|
}), e.nodes.forEach((i) => {
|
|
627
|
-
s.nodes.has(i.id) ?
|
|
626
|
+
s.nodes.has(i.id) ? De(i.upstream, o) && o.add(i.id) : r.add(i.id);
|
|
628
627
|
}), { onlyInA: t, onlyInB: r, different: o };
|
|
629
628
|
}
|
|
630
629
|
let ye;
|
|
631
|
-
async function
|
|
630
|
+
async function Ot() {
|
|
632
631
|
if (ye === void 0) {
|
|
633
632
|
const s = await go(dr["pframes.export-pframe"]);
|
|
634
633
|
if (s.type !== "explicit") throw new Error("Unexpected prepared template type.");
|
|
@@ -638,7 +637,7 @@ async function xt() {
|
|
|
638
637
|
return ye;
|
|
639
638
|
}
|
|
640
639
|
function Po(s, e, t) {
|
|
641
|
-
return
|
|
640
|
+
return kt(s, e, !0, { pf: t }, ["result"]).result;
|
|
642
641
|
}
|
|
643
642
|
function be(s, e) {
|
|
644
643
|
let t = !1, r, o;
|
|
@@ -708,8 +707,8 @@ class rt {
|
|
|
708
707
|
}
|
|
709
708
|
getTemplate(e) {
|
|
710
709
|
return e.getFutureFieldValue(
|
|
711
|
-
|
|
712
|
-
|
|
710
|
+
y.unwrapHolder(e, this.fields.blockPack.ref),
|
|
711
|
+
Ft,
|
|
713
712
|
"Input"
|
|
714
713
|
);
|
|
715
714
|
}
|
|
@@ -772,11 +771,11 @@ class le {
|
|
|
772
771
|
return w(this.blockInfos.get(e));
|
|
773
772
|
}
|
|
774
773
|
getBlock(e) {
|
|
775
|
-
for (const t of
|
|
774
|
+
for (const t of L(this.struct)) if (t.id === e) return t;
|
|
776
775
|
throw new Error("block not found");
|
|
777
776
|
}
|
|
778
777
|
setBlockFieldObj(e, t, r) {
|
|
779
|
-
const o = S(this.rid,
|
|
778
|
+
const o = S(this.rid, P(e, t));
|
|
780
779
|
if (r.ref === void 0) throw new Error("Can't set value with empty ref");
|
|
781
780
|
this.getBlockInfo(e).fields[t] === void 0 ? this.tx.createField(o, "Dynamic", r.ref) : this.tx.setField(o, r.ref), this.getBlockInfo(e).fields[t] = {
|
|
782
781
|
modCount: this.globalModCount++,
|
|
@@ -791,7 +790,7 @@ class le {
|
|
|
791
790
|
const o = this.getBlockInfo(e);
|
|
792
791
|
for (const i of t) {
|
|
793
792
|
const n = o.fields;
|
|
794
|
-
i in n && (this.tx.removeField(S(this.rid,
|
|
793
|
+
i in n && (this.tx.removeField(S(this.rid, P(e, i))), delete n[i], this.fieldsChanged = !0, r = !0);
|
|
795
794
|
}
|
|
796
795
|
return r;
|
|
797
796
|
}
|
|
@@ -829,7 +828,7 @@ class le {
|
|
|
829
828
|
JSON.parse(o);
|
|
830
829
|
const n = Buffer.from(o);
|
|
831
830
|
if (Buffer.compare(i.fields.currentArgs.value, n) === 0) continue;
|
|
832
|
-
const a = this.tx.createValue(
|
|
831
|
+
const a = this.tx.createValue(y.JsonObject, n);
|
|
833
832
|
this.setBlockField(r, "currentArgs", a, "Ready", n), this.blocksWithChangedInputs.add(r), t.push(r);
|
|
834
833
|
}
|
|
835
834
|
this.getStagingGraph().traverse("downstream", t, ({ id: r }) => this.resetStaging(r)), t.length > 0 && this.updateLastModified();
|
|
@@ -842,7 +841,7 @@ class le {
|
|
|
842
841
|
setBlockLabel(e, t) {
|
|
843
842
|
const r = this.structure;
|
|
844
843
|
let o = !1;
|
|
845
|
-
for (const i of
|
|
844
|
+
for (const i of L(r))
|
|
846
845
|
if (i.id === e) {
|
|
847
846
|
i.label = t, o = !0;
|
|
848
847
|
break;
|
|
@@ -856,11 +855,11 @@ class le {
|
|
|
856
855
|
const i = this.getBlockInfo(o);
|
|
857
856
|
if (i.fields[t] === void 0 || i.fields[t].ref === void 0)
|
|
858
857
|
throw new Error("One of the upstreams staging is not rendered.");
|
|
859
|
-
r.push(
|
|
858
|
+
r.push(y.unwrapHolder(this.tx, i.fields[t].ref));
|
|
860
859
|
}), so(this.tx, r);
|
|
861
860
|
}
|
|
862
861
|
exportCtx(e) {
|
|
863
|
-
return Po(this.tx,
|
|
862
|
+
return Po(this.tx, y.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
|
|
864
863
|
}
|
|
865
864
|
renderStagingFor(e) {
|
|
866
865
|
this.resetStaging(e);
|
|
@@ -868,14 +867,14 @@ class le {
|
|
|
868
867
|
if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
|
|
869
868
|
const o = t.getTemplate(this.tx), i = Ze(this.tx, o, {
|
|
870
869
|
args: t.fields.currentArgs.ref,
|
|
871
|
-
blockId: this.tx.createValue(
|
|
872
|
-
isProduction: this.tx.createValue(
|
|
870
|
+
blockId: this.tx.createValue(y.JsonString, JSON.stringify(e)),
|
|
871
|
+
isProduction: this.tx.createValue(y.JsonBool, JSON.stringify(!1)),
|
|
873
872
|
context: r
|
|
874
873
|
});
|
|
875
874
|
this.setBlockField(
|
|
876
875
|
e,
|
|
877
876
|
"stagingCtx",
|
|
878
|
-
|
|
877
|
+
y.wrapInEphHolder(this.tx, i.context),
|
|
879
878
|
"NotReady"
|
|
880
879
|
), this.setBlockField(e, "stagingUiCtx", this.exportCtx(i.context), "NotReady"), this.setBlockField(e, "stagingOutput", i.result, "NotReady");
|
|
881
880
|
}
|
|
@@ -889,14 +888,14 @@ class le {
|
|
|
889
888
|
throw new Error("Can't render production for light block.");
|
|
890
889
|
const o = t.getTemplate(this.tx), i = Ze(this.tx, o, {
|
|
891
890
|
args: t.fields.currentArgs.ref,
|
|
892
|
-
blockId: this.tx.createValue(
|
|
893
|
-
isProduction: this.tx.createValue(
|
|
891
|
+
blockId: this.tx.createValue(y.JsonString, JSON.stringify(e)),
|
|
892
|
+
isProduction: this.tx.createValue(y.JsonBool, JSON.stringify(!0)),
|
|
894
893
|
context: r
|
|
895
894
|
});
|
|
896
895
|
this.setBlockField(
|
|
897
896
|
e,
|
|
898
897
|
"prodCtx",
|
|
899
|
-
|
|
898
|
+
y.wrapInEphHolder(this.tx, i.context),
|
|
900
899
|
"NotReady"
|
|
901
900
|
), this.setBlockField(e, "prodUiCtx", this.exportCtx(i.context), "NotReady"), this.setBlockField(e, "prodOutput", i.result, "NotReady"), this.setBlockFieldObj(e, "prodArgs", t.fields.currentArgs), this.blocksInLimbo.delete(e) && (this.renderingStateChanged = !0);
|
|
902
901
|
}
|
|
@@ -920,9 +919,9 @@ class le {
|
|
|
920
919
|
const l = new rt(u, {});
|
|
921
920
|
this.blockInfos.set(u, l);
|
|
922
921
|
const p = t(u), h = et(this.tx, p.blockPack);
|
|
923
|
-
this.setBlockField(u, "blockPack",
|
|
924
|
-
const f = Buffer.from(p.args),
|
|
925
|
-
this.setBlockField(u, "currentArgs",
|
|
922
|
+
this.setBlockField(u, "blockPack", y.wrapInHolder(this.tx, h), "NotReady");
|
|
923
|
+
const f = Buffer.from(p.args), b = this.tx.createValue(y.JsonObject, f);
|
|
924
|
+
this.setBlockField(u, "currentArgs", b, "Ready", f), l.check();
|
|
926
925
|
}
|
|
927
926
|
for (const u of a.different) this.resetStaging(u);
|
|
928
927
|
o.traverse("downstream", [...c.different], (u) => {
|
|
@@ -973,7 +972,7 @@ class le {
|
|
|
973
972
|
this.setBlockField(
|
|
974
973
|
e,
|
|
975
974
|
"blockPack",
|
|
976
|
-
|
|
975
|
+
y.wrapInHolder(this.tx, et(this.tx, t)),
|
|
977
976
|
"NotReady"
|
|
978
977
|
), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: i }) => this.resetStaging(i)), o.productionRendered && this.getActualProductionGraph().traverse(
|
|
979
978
|
"downstream",
|
|
@@ -999,7 +998,7 @@ class le {
|
|
|
999
998
|
throw new Error("Can't render blocks not including all upstreams.");
|
|
1000
999
|
}
|
|
1001
1000
|
const i = /* @__PURE__ */ new Set();
|
|
1002
|
-
for (const n of
|
|
1001
|
+
for (const n of L(this.structure)) {
|
|
1003
1002
|
if (!r.has(n.id)) continue;
|
|
1004
1003
|
let a = this.getBlockInfo(n.id).requireProductionRendering || this.blocksInLimbo.has(n.id);
|
|
1005
1004
|
if (!a) {
|
|
@@ -1084,14 +1083,14 @@ class le {
|
|
|
1084
1083
|
}
|
|
1085
1084
|
save() {
|
|
1086
1085
|
if (this.wasModified) {
|
|
1087
|
-
this.lastModifiedChanged && this.tx.setKValue(this.rid,
|
|
1086
|
+
this.lastModifiedChanged && this.tx.setKValue(this.rid, ee, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, W, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
|
|
1088
1087
|
this.rid,
|
|
1089
1088
|
ue,
|
|
1090
1089
|
JSON.stringify({
|
|
1091
1090
|
...this.renderingState,
|
|
1092
1091
|
blocksInLimbo: [...this.blocksInLimbo]
|
|
1093
1092
|
})
|
|
1094
|
-
), this.metaChanged && this.tx.setKValue(this.rid,
|
|
1093
|
+
), this.metaChanged && this.tx.setKValue(this.rid, te, JSON.stringify(this.meta));
|
|
1095
1094
|
for (const e of this.changedBlockFrontendStates) {
|
|
1096
1095
|
const t = this.blockFrontendStates.get(e);
|
|
1097
1096
|
t === void 0 ? this.tx.deleteKValue(this.rid, Ce(e)) : this.tx.setKValue(this.rid, Ce(e), t);
|
|
@@ -1100,14 +1099,14 @@ class le {
|
|
|
1100
1099
|
}
|
|
1101
1100
|
}
|
|
1102
1101
|
static async load(e, t, r) {
|
|
1103
|
-
const o = e.getResourceData(t, !0), i = e.getKValueJson(t,
|
|
1102
|
+
const o = e.getResourceData(t, !0), i = e.getKValueJson(t, bt), n = e.getKValueJson(t, ee), a = e.getKValueJson(t, te), c = e.getKValueJson(t, W), u = e.getKValueJson(t, ue), l = e.listKeyValuesString(t), [
|
|
1104
1103
|
p,
|
|
1105
1104
|
h,
|
|
1106
1105
|
f,
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
{ stagingRefreshTimestamp:
|
|
1110
|
-
|
|
1106
|
+
b,
|
|
1107
|
+
C,
|
|
1108
|
+
{ stagingRefreshTimestamp: I, blocksInLimbo: $ },
|
|
1109
|
+
K
|
|
1111
1110
|
] = await Promise.all([
|
|
1112
1111
|
o,
|
|
1113
1112
|
i,
|
|
@@ -1117,59 +1116,59 @@ class le {
|
|
|
1117
1116
|
u,
|
|
1118
1117
|
l
|
|
1119
1118
|
]);
|
|
1120
|
-
if (h !==
|
|
1119
|
+
if (h !== wt)
|
|
1121
1120
|
throw new Error(
|
|
1122
1121
|
`Can't act on this project resource because it has a wrong schema version: ${h}`
|
|
1123
1122
|
);
|
|
1124
|
-
const
|
|
1125
|
-
for (const
|
|
1126
|
-
const
|
|
1127
|
-
if (
|
|
1128
|
-
let
|
|
1129
|
-
|
|
1130
|
-
id:
|
|
1123
|
+
const G = /* @__PURE__ */ new Map();
|
|
1124
|
+
for (const v of p.fields) {
|
|
1125
|
+
const O = _r(v.name);
|
|
1126
|
+
if (O === void 0) continue;
|
|
1127
|
+
let B = G.get(O.blockId);
|
|
1128
|
+
B === void 0 && (B = {
|
|
1129
|
+
id: O.blockId,
|
|
1131
1130
|
fields: {}
|
|
1132
|
-
},
|
|
1131
|
+
}, G.set(O.blockId, B)), B.fields[O.fieldName] = ce(v.value) ? { modCount: 0 } : { modCount: 0, ref: v.value };
|
|
1133
1132
|
}
|
|
1134
|
-
const
|
|
1135
|
-
(
|
|
1133
|
+
const z = await Ot(), oe = Be(z.hash), k = p.fields.find(
|
|
1134
|
+
(v) => v.name === oe
|
|
1136
1135
|
);
|
|
1137
1136
|
let J;
|
|
1138
|
-
k !== void 0 ? J = Se(k.value) : (J =
|
|
1139
|
-
S(t, Be(
|
|
1137
|
+
k !== void 0 ? J = Se(k.value) : (J = y.wrapInHolder(e, Le(e, z.spec)), e.createField(
|
|
1138
|
+
S(t, Be(z.hash)),
|
|
1140
1139
|
"Dynamic",
|
|
1141
1140
|
J
|
|
1142
1141
|
));
|
|
1143
|
-
const
|
|
1144
|
-
for (const
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1142
|
+
const Y = { stagingRefreshTimestamp: I }, A = new Set($), x = /* @__PURE__ */ new Map();
|
|
1143
|
+
for (const v of K) {
|
|
1144
|
+
const O = $r(v.key);
|
|
1145
|
+
O !== void 0 && x.set(O, v.value);
|
|
1147
1146
|
}
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1150
|
-
for (const [,
|
|
1151
|
-
if (
|
|
1152
|
-
if (!rr(
|
|
1147
|
+
const R = [];
|
|
1148
|
+
G.forEach(({ id: v, fields: O }) => {
|
|
1149
|
+
for (const [, B] of Object.entries(O))
|
|
1150
|
+
if (B.ref !== void 0) {
|
|
1151
|
+
if (!rr(B.ref) || or(B.ref))
|
|
1153
1152
|
throw new Error("unexpected behaviour");
|
|
1154
|
-
|
|
1153
|
+
R.push([B, e.getResourceData(B.ref, !1)]);
|
|
1155
1154
|
}
|
|
1156
1155
|
});
|
|
1157
|
-
for (const [
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1156
|
+
for (const [v, O] of R) {
|
|
1157
|
+
const B = await O;
|
|
1158
|
+
v.value = B.data, We(B.error) ? v.status = "Error" : B.resourceReady || We(B.originalResourceId) ? v.status = "Ready" : v.status = "NotReady";
|
|
1160
1159
|
}
|
|
1161
1160
|
const M = /* @__PURE__ */ new Map();
|
|
1162
|
-
|
|
1163
|
-
const
|
|
1164
|
-
for (const
|
|
1165
|
-
if (!M.has(
|
|
1166
|
-
throw new Error(`Inconsistent project structure: no inputs for ${
|
|
1167
|
-
|
|
1161
|
+
G.forEach(({ id: v, fields: O }) => M.set(v, new rt(v, O)));
|
|
1162
|
+
const N = /* @__PURE__ */ new Set();
|
|
1163
|
+
for (const v of L(C)) {
|
|
1164
|
+
if (!M.has(v.id))
|
|
1165
|
+
throw new Error(`Inconsistent project structure: no inputs for ${v.id}`);
|
|
1166
|
+
N.add(v.id);
|
|
1168
1167
|
}
|
|
1169
|
-
M.forEach((
|
|
1170
|
-
if (!
|
|
1171
|
-
throw new Error(`Inconsistent project structure: no structure entry for ${
|
|
1172
|
-
|
|
1168
|
+
M.forEach((v) => {
|
|
1169
|
+
if (!N.has(v.id))
|
|
1170
|
+
throw new Error(`Inconsistent project structure: no structure entry for ${v.id}`);
|
|
1171
|
+
v.check();
|
|
1173
1172
|
});
|
|
1174
1173
|
const se = new le(
|
|
1175
1174
|
t,
|
|
@@ -1177,33 +1176,33 @@ class le {
|
|
|
1177
1176
|
r,
|
|
1178
1177
|
h,
|
|
1179
1178
|
f,
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1179
|
+
b,
|
|
1180
|
+
C,
|
|
1181
|
+
Y,
|
|
1182
|
+
A,
|
|
1184
1183
|
M,
|
|
1185
|
-
|
|
1184
|
+
x,
|
|
1186
1185
|
J
|
|
1187
1186
|
);
|
|
1188
1187
|
return se.fixProblems(), se;
|
|
1189
1188
|
}
|
|
1190
1189
|
}
|
|
1191
|
-
async function Bo(s, e =
|
|
1190
|
+
async function Bo(s, e = Nr) {
|
|
1192
1191
|
const t = s.createEphemeral(Jr);
|
|
1193
1192
|
s.lock(t);
|
|
1194
1193
|
const r = String(Date.now());
|
|
1195
|
-
s.setKValue(t,
|
|
1196
|
-
const o = await
|
|
1194
|
+
s.setKValue(t, bt, JSON.stringify(wt)), s.setKValue(t, Ve, r), s.setKValue(t, ee, r), s.setKValue(t, te, JSON.stringify(e)), s.setKValue(t, W, JSON.stringify(Vr)), s.setKValue(t, ue, JSON.stringify(Lr));
|
|
1195
|
+
const o = await Ot();
|
|
1197
1196
|
return s.createField(
|
|
1198
1197
|
S(t, Be(o.hash)),
|
|
1199
1198
|
"Dynamic",
|
|
1200
|
-
|
|
1199
|
+
y.wrapInHolder(s, Le(s, o.spec))
|
|
1201
1200
|
), t;
|
|
1202
1201
|
}
|
|
1203
1202
|
async function we(s, e, t) {
|
|
1204
|
-
return
|
|
1203
|
+
return V(s, e, void 0, t);
|
|
1205
1204
|
}
|
|
1206
|
-
async function
|
|
1205
|
+
async function V(s, e, t, r) {
|
|
1207
1206
|
if (s instanceof tr)
|
|
1208
1207
|
return await s.withWriteTx("ProjectAction", async (o) => {
|
|
1209
1208
|
const i = await le.load(o, e, t), n = await r(i);
|
|
@@ -1226,7 +1225,7 @@ function* Ro(s) {
|
|
|
1226
1225
|
yield e, yield t;
|
|
1227
1226
|
return;
|
|
1228
1227
|
default:
|
|
1229
|
-
|
|
1228
|
+
D(s);
|
|
1230
1229
|
}
|
|
1231
1230
|
}
|
|
1232
1231
|
function ot(s, e) {
|
|
@@ -1249,29 +1248,29 @@ function Oo(s, e) {
|
|
|
1249
1248
|
}))
|
|
1250
1249
|
};
|
|
1251
1250
|
default:
|
|
1252
|
-
|
|
1251
|
+
D(s);
|
|
1253
1252
|
}
|
|
1254
1253
|
}
|
|
1255
|
-
const
|
|
1254
|
+
const Do = re("PColumnData/JsonPartitioned", "1"), xo = re(
|
|
1256
1255
|
"PColumnData/Partitioned/JsonPartitioned",
|
|
1257
1256
|
"1"
|
|
1258
|
-
), jo =
|
|
1257
|
+
), jo = re("PColumnData/BinaryPartitioned", "1"), Eo = re(
|
|
1259
1258
|
"PColumnData/Partitioned/BinaryPartitioned",
|
|
1260
1259
|
"1"
|
|
1261
|
-
),
|
|
1262
|
-
function
|
|
1260
|
+
), Ao = re("PColumnData/Json", "1");
|
|
1261
|
+
function To(s) {
|
|
1263
1262
|
if (!s.getIsReadyOrError()) throw new Error("Data not ready.");
|
|
1264
1263
|
const e = s.getDataAsJson();
|
|
1265
1264
|
if (e === void 0)
|
|
1266
1265
|
throw new Error("unexpected data info structure, no resource data");
|
|
1267
|
-
if (U(s.resourceType,
|
|
1266
|
+
if (U(s.resourceType, Ao)) {
|
|
1268
1267
|
const t = e;
|
|
1269
1268
|
return {
|
|
1270
1269
|
type: "Json",
|
|
1271
1270
|
keyLength: t.keyLength,
|
|
1272
1271
|
data: t.data
|
|
1273
1272
|
};
|
|
1274
|
-
} else if (U(s.resourceType,
|
|
1273
|
+
} else if (U(s.resourceType, Do)) {
|
|
1275
1274
|
const t = e, r = Object.fromEntries(
|
|
1276
1275
|
s.listInputFields().map((o) => [o, s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo])
|
|
1277
1276
|
);
|
|
@@ -1280,7 +1279,7 @@ function Ao(s) {
|
|
|
1280
1279
|
partitionKeyLength: t.partitionKeyLength,
|
|
1281
1280
|
parts: r
|
|
1282
1281
|
};
|
|
1283
|
-
} else if (U(s.resourceType,
|
|
1282
|
+
} else if (U(s.resourceType, xo)) {
|
|
1284
1283
|
const t = e, r = {};
|
|
1285
1284
|
for (const o of s.listInputFields()) {
|
|
1286
1285
|
const i = s.traverse({ field: o, errorIfFieldNotSet: !0 }), n = i.listInputFields();
|
|
@@ -1316,7 +1315,7 @@ function Ao(s) {
|
|
|
1316
1315
|
partitionKeyLength: t.partitionKeyLength,
|
|
1317
1316
|
parts: r
|
|
1318
1317
|
};
|
|
1319
|
-
} else if (U(s.resourceType,
|
|
1318
|
+
} else if (U(s.resourceType, Eo)) {
|
|
1320
1319
|
const t = e, r = {};
|
|
1321
1320
|
for (const o of s.listInputFields()) {
|
|
1322
1321
|
const i = s.traverse({ field: o, errorIfFieldNotSet: !0 }), n = i.listInputFields();
|
|
@@ -1348,9 +1347,9 @@ function Ao(s) {
|
|
|
1348
1347
|
}
|
|
1349
1348
|
function Dt(s, e) {
|
|
1350
1349
|
const t = he("sha256");
|
|
1351
|
-
return t.update(
|
|
1350
|
+
return t.update(Ee(s)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
|
|
1352
1351
|
}
|
|
1353
|
-
function
|
|
1352
|
+
function xt(s, e = !0, t = !1, r = "") {
|
|
1354
1353
|
var a, c, u;
|
|
1355
1354
|
const o = /^(?<name>.*)\.(?<type>spec|data)$/, i = /* @__PURE__ */ new Map();
|
|
1356
1355
|
for (const l of s.listInputFields()) {
|
|
@@ -1366,17 +1365,17 @@ function jt(s, e = !0, t = !1, r = "") {
|
|
|
1366
1365
|
}
|
|
1367
1366
|
h = h.slice(r.length);
|
|
1368
1367
|
const f = w((c = p.groups) == null ? void 0 : c.type);
|
|
1369
|
-
let
|
|
1370
|
-
switch (
|
|
1368
|
+
let b = i.get(h);
|
|
1369
|
+
switch (b === void 0 && (b = {}, i.set(h, b)), f) {
|
|
1371
1370
|
case "spec":
|
|
1372
|
-
|
|
1371
|
+
b.spec = (u = s.traverse({
|
|
1373
1372
|
field: l,
|
|
1374
1373
|
ignoreError: t,
|
|
1375
1374
|
pureFieldErrorToUndefined: t
|
|
1376
1375
|
})) == null ? void 0 : u.getDataAsJson();
|
|
1377
1376
|
break;
|
|
1378
1377
|
case "data":
|
|
1379
|
-
|
|
1378
|
+
b.hasData = !0, b.data = () => s.traverseOrError({
|
|
1380
1379
|
field: l,
|
|
1381
1380
|
ignoreError: t
|
|
1382
1381
|
});
|
|
@@ -1391,7 +1390,7 @@ function jt(s, e = !0, t = !1, r = "") {
|
|
|
1391
1390
|
}
|
|
1392
1391
|
function Io(s, e = !0, t = "") {
|
|
1393
1392
|
if (!s.getIsReadyOrError()) throw new Error("resource is not ready");
|
|
1394
|
-
const r =
|
|
1393
|
+
const r = xt(s, e, !1, t);
|
|
1395
1394
|
pr(r.locked);
|
|
1396
1395
|
const o = {};
|
|
1397
1396
|
for (const [i, n] of r.results) {
|
|
@@ -1409,7 +1408,7 @@ function Io(s, e = !0, t = "") {
|
|
|
1409
1408
|
}
|
|
1410
1409
|
return o;
|
|
1411
1410
|
}
|
|
1412
|
-
class
|
|
1411
|
+
class Ne {
|
|
1413
1412
|
constructor(e, t) {
|
|
1414
1413
|
d(this, "allSpecsAvailable");
|
|
1415
1414
|
this.ctx = e, this.blocks = t;
|
|
@@ -1526,44 +1525,44 @@ class Le {
|
|
|
1526
1525
|
return t;
|
|
1527
1526
|
}
|
|
1528
1527
|
static create(e, t, r) {
|
|
1529
|
-
const o = e.accessor(t).node(), i = w(o.getKeyValueAsJson(
|
|
1530
|
-
for (const u of
|
|
1528
|
+
const o = e.accessor(t).node(), i = w(o.getKeyValueAsJson(W)), a = Oe(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
|
|
1529
|
+
for (const u of L(i)) {
|
|
1531
1530
|
if (!a.has(u.id)) continue;
|
|
1532
1531
|
const l = st(
|
|
1533
1532
|
o.traverse({
|
|
1534
|
-
field:
|
|
1533
|
+
field: P(u.id, "prodCtx"),
|
|
1535
1534
|
ignoreError: !0,
|
|
1536
1535
|
pureFieldErrorToUndefined: !0,
|
|
1537
1536
|
stableIfNotFound: !0
|
|
1538
1537
|
}) !== void 0,
|
|
1539
1538
|
o.traverseOrError({
|
|
1540
|
-
field:
|
|
1539
|
+
field: P(u.id, "prodUiCtx"),
|
|
1541
1540
|
stableIfNotFound: !0
|
|
1542
1541
|
})
|
|
1543
1542
|
), p = st(
|
|
1544
1543
|
o.traverse({
|
|
1545
|
-
field:
|
|
1544
|
+
field: P(u.id, "stagingCtx"),
|
|
1546
1545
|
ignoreError: !0,
|
|
1547
1546
|
pureFieldErrorToUndefined: !0
|
|
1548
1547
|
}) !== void 0,
|
|
1549
1548
|
o.traverseOrError({
|
|
1550
|
-
field:
|
|
1549
|
+
field: P(u.id, "stagingUiCtx")
|
|
1551
1550
|
})
|
|
1552
1551
|
);
|
|
1553
1552
|
c.set(u.id, { info: u, prod: l, staging: p });
|
|
1554
1553
|
}
|
|
1555
|
-
return new
|
|
1554
|
+
return new Ne(e, c);
|
|
1556
1555
|
}
|
|
1557
1556
|
}
|
|
1558
1557
|
function st(s, e) {
|
|
1559
1558
|
if (e === void 0)
|
|
1560
1559
|
return s ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
|
|
1561
|
-
if (e.ok) return
|
|
1560
|
+
if (e.ok) return xt(e.value, !1, !0);
|
|
1562
1561
|
}
|
|
1563
1562
|
function Je(s, e) {
|
|
1564
1563
|
const t = s.persist(), r = w(
|
|
1565
1564
|
s.traverse({
|
|
1566
|
-
field:
|
|
1565
|
+
field: P(e, "currentArgs"),
|
|
1567
1566
|
errorIfFieldNotSet: !0
|
|
1568
1567
|
}).getDataAsString()
|
|
1569
1568
|
), o = s.getKeyValueAsString(Ce(e));
|
|
@@ -1572,20 +1571,20 @@ function Je(s, e) {
|
|
|
1572
1571
|
args: r,
|
|
1573
1572
|
uiState: o,
|
|
1574
1573
|
blockMeta: (i) => {
|
|
1575
|
-
const n = i.accessor(t).node(), a = w(n.getKeyValueAsJson(
|
|
1576
|
-
for (const u of
|
|
1574
|
+
const n = i.accessor(t).node(), a = w(n.getKeyValueAsJson(W)), c = /* @__PURE__ */ new Map();
|
|
1575
|
+
for (const u of L(a)) c.set(u.id, u);
|
|
1577
1576
|
return c;
|
|
1578
1577
|
}
|
|
1579
1578
|
};
|
|
1580
1579
|
}
|
|
1581
|
-
function
|
|
1580
|
+
function jt(s, e) {
|
|
1582
1581
|
const t = s.persist();
|
|
1583
1582
|
return {
|
|
1584
1583
|
...Je(s, e),
|
|
1585
1584
|
prod: (r) => {
|
|
1586
1585
|
var o;
|
|
1587
1586
|
return (o = r.accessor(t).node({ ignoreError: !0 }).traverse({
|
|
1588
|
-
field:
|
|
1587
|
+
field: P(e, "prodOutput"),
|
|
1589
1588
|
stableIfNotFound: !0,
|
|
1590
1589
|
ignoreError: !0
|
|
1591
1590
|
})) == null ? void 0 : o.persist();
|
|
@@ -1593,12 +1592,12 @@ function Tt(s, e) {
|
|
|
1593
1592
|
staging: (r) => {
|
|
1594
1593
|
var i;
|
|
1595
1594
|
const o = (i = r.accessor(t).node({ ignoreError: !0 }).traverse({
|
|
1596
|
-
field:
|
|
1595
|
+
field: P(e, "stagingOutput"),
|
|
1597
1596
|
ignoreError: !0
|
|
1598
1597
|
})) == null ? void 0 : i.persist();
|
|
1599
1598
|
return o === void 0 && r.markUnstable("staging_not_rendered"), o;
|
|
1600
1599
|
},
|
|
1601
|
-
getResultsPool: (r) =>
|
|
1600
|
+
getResultsPool: (r) => Ne.create(r, t, e)
|
|
1602
1601
|
};
|
|
1603
1602
|
}
|
|
1604
1603
|
function* j(s, e) {
|
|
@@ -1648,7 +1647,7 @@ function* j(s, e) {
|
|
|
1648
1647
|
yield* j(s.operand1), yield* j(s.operand2);
|
|
1649
1648
|
return;
|
|
1650
1649
|
default:
|
|
1651
|
-
|
|
1650
|
+
D(s);
|
|
1652
1651
|
}
|
|
1653
1652
|
}
|
|
1654
1653
|
function Vo(s, e) {
|
|
@@ -1659,7 +1658,7 @@ function Vo(s, e) {
|
|
|
1659
1658
|
function de(s, e) {
|
|
1660
1659
|
return s === void 0 ? void 0 : e(s);
|
|
1661
1660
|
}
|
|
1662
|
-
function
|
|
1661
|
+
function Lo(s) {
|
|
1663
1662
|
switch (s.type) {
|
|
1664
1663
|
case "GetImportProgress":
|
|
1665
1664
|
return !0;
|
|
@@ -1667,8 +1666,8 @@ function No(s) {
|
|
|
1667
1666
|
return !1;
|
|
1668
1667
|
}
|
|
1669
1668
|
}
|
|
1670
|
-
function
|
|
1671
|
-
for (const e of j(s)) if (
|
|
1669
|
+
function No(s) {
|
|
1670
|
+
for (const e of j(s)) if (Lo(e)) return !0;
|
|
1672
1671
|
return !1;
|
|
1673
1672
|
}
|
|
1674
1673
|
function ge(s) {
|
|
@@ -1783,7 +1782,7 @@ const Zo = (s) => g(s), Xo = (s) => {
|
|
|
1783
1782
|
const e = s.source;
|
|
1784
1783
|
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1785
1784
|
type: "ScheduleComputable",
|
|
1786
|
-
computable:
|
|
1785
|
+
computable: F.make(
|
|
1787
1786
|
(r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
|
|
1788
1787
|
{
|
|
1789
1788
|
postprocessValue: async (r) => {
|
|
@@ -1799,7 +1798,7 @@ const Zo = (s) => g(s), Xo = (s) => {
|
|
|
1799
1798
|
const o = t.accessor(e).node().resourceInfo;
|
|
1800
1799
|
return {
|
|
1801
1800
|
type: "ScheduleComputable",
|
|
1802
|
-
computable:
|
|
1801
|
+
computable: F.make(() => r.blobDriver.getDownloadedBlob(o), {
|
|
1803
1802
|
postprocessValue: async (i) => i === void 0 ? void 0 : (await r.blobDriver.getContent(i.handle)).toString()
|
|
1804
1803
|
})
|
|
1805
1804
|
};
|
|
@@ -1808,7 +1807,7 @@ const Zo = (s) => g(s), Xo = (s) => {
|
|
|
1808
1807
|
const e = s.source;
|
|
1809
1808
|
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1810
1809
|
type: "ScheduleComputable",
|
|
1811
|
-
computable:
|
|
1810
|
+
computable: F.make(
|
|
1812
1811
|
(r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
|
|
1813
1812
|
{
|
|
1814
1813
|
postprocessValue: async (r) => {
|
|
@@ -2046,7 +2045,7 @@ function m(s, e) {
|
|
|
2046
2045
|
}
|
|
2047
2046
|
});
|
|
2048
2047
|
default:
|
|
2049
|
-
return
|
|
2048
|
+
return D(e);
|
|
2050
2049
|
}
|
|
2051
2050
|
}
|
|
2052
2051
|
const cs = ["$prod", "$staging"];
|
|
@@ -2059,9 +2058,9 @@ function us(s) {
|
|
|
2059
2058
|
$staging: s.staging
|
|
2060
2059
|
};
|
|
2061
2060
|
}
|
|
2062
|
-
const
|
|
2061
|
+
const Tt = Symbol(), It = "return", ls = { op: Tt, arg: It };
|
|
2063
2062
|
function ds(s) {
|
|
2064
|
-
return s.op ==
|
|
2063
|
+
return s.op == Tt && s.arg == It;
|
|
2065
2064
|
}
|
|
2066
2065
|
function ps() {
|
|
2067
2066
|
return { pendingSubroutines: /* @__PURE__ */ new Map() };
|
|
@@ -2113,20 +2112,20 @@ function it(s, e, t, r) {
|
|
|
2113
2112
|
});
|
|
2114
2113
|
break;
|
|
2115
2114
|
default:
|
|
2116
|
-
|
|
2115
|
+
D(c);
|
|
2117
2116
|
}
|
|
2118
2117
|
}
|
|
2119
2118
|
return n;
|
|
2120
2119
|
}
|
|
2121
|
-
function
|
|
2120
|
+
function Vt(s, e, t, r = {}) {
|
|
2122
2121
|
return Lt(s, us(e), t, r);
|
|
2123
2122
|
}
|
|
2124
2123
|
function Lt(s, e, t, r = {}) {
|
|
2125
|
-
const o =
|
|
2124
|
+
const o = Ee({
|
|
2126
2125
|
ctx: Object.fromEntries(Object.entries(e).filter(([i]) => cs.indexOf(i) === -1)),
|
|
2127
2126
|
cfg: t
|
|
2128
2127
|
});
|
|
2129
|
-
return
|
|
2128
|
+
return F.makeRaw(
|
|
2130
2129
|
(i) => {
|
|
2131
2130
|
const n = { drivers: s, cCtx: i }, a = ps();
|
|
2132
2131
|
return {
|
|
@@ -2143,23 +2142,23 @@ function Lt(s, e, t, r = {}) {
|
|
|
2143
2142
|
),
|
|
2144
2143
|
async postprocessValue(u, l) {
|
|
2145
2144
|
const p = [];
|
|
2146
|
-
for (const
|
|
2147
|
-
p.push({ destination:
|
|
2145
|
+
for (const C of u)
|
|
2146
|
+
p.push({ destination: C.destination, operation: g(C.computable) });
|
|
2148
2147
|
const h = {
|
|
2149
2148
|
drivers: s,
|
|
2150
2149
|
get cCtx() {
|
|
2151
2150
|
throw new Error("asynchronous operations are forbidden in this context");
|
|
2152
2151
|
}
|
|
2153
2152
|
}, f = /* @__PURE__ */ new Map();
|
|
2154
|
-
for (const [
|
|
2155
|
-
f.set(
|
|
2156
|
-
const
|
|
2153
|
+
for (const [C, I] of a.pendingSubroutines)
|
|
2154
|
+
f.set(C, { ...I, args: { ...I.args } });
|
|
2155
|
+
const b = {
|
|
2157
2156
|
result: a.result,
|
|
2158
2157
|
pendingSubroutines: f
|
|
2159
2158
|
};
|
|
2160
|
-
if (it(h,
|
|
2159
|
+
if (it(h, b, p, !1), !("result" in b))
|
|
2161
2160
|
throw new Error("illegal cfg rendering stack state, no result");
|
|
2162
|
-
return
|
|
2161
|
+
return b.result;
|
|
2163
2162
|
}
|
|
2164
2163
|
};
|
|
2165
2164
|
},
|
|
@@ -2298,21 +2297,21 @@ class pe {
|
|
|
2298
2297
|
if (!o.getIsReadyOrError()) return;
|
|
2299
2298
|
const i = Io(o, t, r), n = {};
|
|
2300
2299
|
for (const [a, c] of Object.entries(i))
|
|
2301
|
-
n[a] =
|
|
2300
|
+
n[a] = Q(c, (u) => this.wrapAccessor(u));
|
|
2302
2301
|
return n;
|
|
2303
2302
|
}
|
|
2304
2303
|
//
|
|
2305
2304
|
// Blobs
|
|
2306
2305
|
//
|
|
2307
2306
|
registerComputable(e, t) {
|
|
2308
|
-
const r = `${e}_${
|
|
2307
|
+
const r = `${e}_${X()}`;
|
|
2309
2308
|
return this.computablesToResolve[r] = t, r;
|
|
2310
2309
|
}
|
|
2311
2310
|
getBlobContentAsString(e) {
|
|
2312
2311
|
const t = this.getAccessor(e).resourceInfo;
|
|
2313
2312
|
return this.registerComputable(
|
|
2314
2313
|
"getBlobContentAsString",
|
|
2315
|
-
|
|
2314
|
+
F.make((r) => this.env.driverKit.blobDriver.getDownloadedBlob(t, r), {
|
|
2316
2315
|
postprocessValue: async (r) => {
|
|
2317
2316
|
if (r !== void 0)
|
|
2318
2317
|
return Buffer.from(await this.env.driverKit.blobDriver.getContent(r.handle)).toString(
|
|
@@ -2326,7 +2325,7 @@ class pe {
|
|
|
2326
2325
|
const t = this.getAccessor(e).resourceInfo;
|
|
2327
2326
|
return this.registerComputable(
|
|
2328
2327
|
"getBlobContentAsBase64",
|
|
2329
|
-
|
|
2328
|
+
F.make((r) => this.env.driverKit.blobDriver.getDownloadedBlob(t, r), {
|
|
2330
2329
|
postprocessValue: async (r) => {
|
|
2331
2330
|
if (r !== void 0)
|
|
2332
2331
|
return Buffer.from(await this.env.driverKit.blobDriver.getContent(r.handle)).toString(
|
|
@@ -2414,7 +2413,7 @@ class pe {
|
|
|
2414
2413
|
isComplete: e.isComplete,
|
|
2415
2414
|
entries: e.entries.map((t) => ({
|
|
2416
2415
|
ref: t.ref,
|
|
2417
|
-
obj:
|
|
2416
|
+
obj: Q(t.obj, (r) => this.wrapAccessor(r))
|
|
2418
2417
|
}))
|
|
2419
2418
|
};
|
|
2420
2419
|
}
|
|
@@ -2445,7 +2444,7 @@ class pe {
|
|
|
2445
2444
|
"can't instantiate PFrames from this context (most porbably called from the future mapper)"
|
|
2446
2445
|
);
|
|
2447
2446
|
return this.env.driverKit.pFrameDriver.createPFrame(
|
|
2448
|
-
e.map((t) =>
|
|
2447
|
+
e.map((t) => Q(t, (r) => this.getAccessor(r))),
|
|
2449
2448
|
this.computableCtx
|
|
2450
2449
|
);
|
|
2451
2450
|
}
|
|
@@ -2455,7 +2454,7 @@ class pe {
|
|
|
2455
2454
|
"can't instantiate PTable from this context (most porbably called from the future mapper)"
|
|
2456
2455
|
);
|
|
2457
2456
|
return this.env.driverKit.pFrameDriver.createPTable(
|
|
2458
|
-
ut(e, (t) =>
|
|
2457
|
+
ut(e, (t) => Q(t, (r) => this.getAccessor(r))),
|
|
2459
2458
|
this.computableCtx
|
|
2460
2459
|
);
|
|
2461
2460
|
}
|
|
@@ -2469,7 +2468,7 @@ class pe {
|
|
|
2469
2468
|
}
|
|
2470
2469
|
wrapAccessor(e) {
|
|
2471
2470
|
if (e !== void 0) {
|
|
2472
|
-
const t =
|
|
2471
|
+
const t = X();
|
|
2473
2472
|
return this.accessors.set(t, e), t;
|
|
2474
2473
|
}
|
|
2475
2474
|
}
|
|
@@ -2604,7 +2603,7 @@ class pe {
|
|
|
2604
2603
|
}
|
|
2605
2604
|
}
|
|
2606
2605
|
function gs(s, e, t, r, o = {}) {
|
|
2607
|
-
return
|
|
2606
|
+
return F.makeRaw((i) => {
|
|
2608
2607
|
const n = new ke();
|
|
2609
2608
|
i.addOnDestroy(() => n.dispose());
|
|
2610
2609
|
const a = n.manage(s.quickJs.newRuntime());
|
|
@@ -2621,102 +2620,102 @@ function gs(s, e, t, r, o = {}) {
|
|
|
2621
2620
|
};
|
|
2622
2621
|
}, o);
|
|
2623
2622
|
}
|
|
2624
|
-
function
|
|
2623
|
+
function xe(s, e, t, r, o = {}) {
|
|
2625
2624
|
if (lt(t)) {
|
|
2626
2625
|
if (r === void 0) throw new Error("No code bundle.");
|
|
2627
2626
|
return gs(s, e, t, r, o);
|
|
2628
|
-
} else return
|
|
2627
|
+
} else return Vt(s.driverKit, e, t, o);
|
|
2629
2628
|
}
|
|
2630
2629
|
function fs(s, e, t) {
|
|
2631
|
-
return
|
|
2630
|
+
return F.make(
|
|
2632
2631
|
(r) => {
|
|
2633
|
-
var
|
|
2634
|
-
const o = r.accessor(s).node(), i = w(o.getKeyValueAsJson(Ve)), n = w(o.getKeyValueAsJson(
|
|
2632
|
+
var b, C, I, $, K, G, z, oe;
|
|
2633
|
+
const o = r.accessor(s).node(), i = w(o.getKeyValueAsJson(Ve)), n = w(o.getKeyValueAsJson(ee)), a = w(o.getKeyValueAsJson(te)), c = w(o.getKeyValueAsJson(W)), u = w(
|
|
2635
2634
|
o.getKeyValueAsJson(ue)
|
|
2636
2635
|
), l = /* @__PURE__ */ new Map();
|
|
2637
|
-
for (const { id: k } of
|
|
2636
|
+
for (const { id: k } of L(c)) {
|
|
2638
2637
|
const J = o.traverse({
|
|
2639
|
-
field:
|
|
2638
|
+
field: P(k, "currentArgs"),
|
|
2640
2639
|
assertFieldType: "Dynamic",
|
|
2641
2640
|
errorIfFieldNotSet: !0
|
|
2642
2641
|
});
|
|
2643
|
-
let
|
|
2644
|
-
const
|
|
2645
|
-
field:
|
|
2642
|
+
let Y;
|
|
2643
|
+
const A = o.traverse({
|
|
2644
|
+
field: P(k, "prodArgs"),
|
|
2646
2645
|
assertFieldType: "Dynamic",
|
|
2647
2646
|
stableIfNotFound: !0
|
|
2648
2647
|
});
|
|
2649
|
-
if (
|
|
2650
|
-
const
|
|
2651
|
-
field:
|
|
2648
|
+
if (A !== void 0) {
|
|
2649
|
+
const x = o.getField({
|
|
2650
|
+
field: P(k, "prodOutput"),
|
|
2652
2651
|
assertFieldType: "Dynamic",
|
|
2653
2652
|
errorIfFieldNotFound: !0
|
|
2654
|
-
}),
|
|
2655
|
-
field:
|
|
2653
|
+
}), R = o.getField({
|
|
2654
|
+
field: P(k, "prodUiCtx"),
|
|
2656
2655
|
assertFieldType: "Dynamic",
|
|
2657
2656
|
errorIfFieldNotFound: !0
|
|
2658
2657
|
});
|
|
2659
|
-
|
|
2660
|
-
arguments:
|
|
2661
|
-
stale: J.id !==
|
|
2662
|
-
outputError:
|
|
2663
|
-
outputsError: ((
|
|
2664
|
-
exportsError: ((
|
|
2665
|
-
finished: (
|
|
2658
|
+
Y = {
|
|
2659
|
+
arguments: A.getDataAsJson(),
|
|
2660
|
+
stale: J.id !== A.id,
|
|
2661
|
+
outputError: x.error !== void 0 || R.error !== void 0 || ((b = x.value) == null ? void 0 : b.getError()) !== void 0 || ((C = R.value) == null ? void 0 : C.getError()) !== void 0,
|
|
2662
|
+
outputsError: ((I = x.error) == null ? void 0 : I.getDataAsString()) ?? ((K = ($ = x.value) == null ? void 0 : $.getError()) == null ? void 0 : K.getDataAsString()),
|
|
2663
|
+
exportsError: ((G = R.error) == null ? void 0 : G.getDataAsString()) ?? ((oe = (z = R.value) == null ? void 0 : z.getError()) == null ? void 0 : oe.getDataAsString()),
|
|
2664
|
+
finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (R.value !== void 0 && R.value.getIsReadyOrError() || R.error !== void 0 && R.error.getIsReadyOrError())
|
|
2666
2665
|
};
|
|
2667
2666
|
}
|
|
2668
|
-
l.set(k, { currentArguments: J.getDataAsJson(), prod:
|
|
2667
|
+
l.set(k, { currentArguments: J.getDataAsJson(), prod: Y });
|
|
2669
2668
|
}
|
|
2670
|
-
const p = ne(c, (k) => l.get(k).currentArguments), h = new Set(u.blocksInLimbo), f = [...
|
|
2669
|
+
const p = ne(c, (k) => l.get(k).currentArguments), h = new Set(u.blocksInLimbo), f = [...L(c)].map(({ id: k, label: J, renderingMode: Y }) => {
|
|
2671
2670
|
var Me, Ue, $e, Ge;
|
|
2672
|
-
const
|
|
2673
|
-
let
|
|
2674
|
-
|
|
2671
|
+
const A = w(l.get(k)), x = w(p.nodes.get(k));
|
|
2672
|
+
let R = "NotCalculated";
|
|
2673
|
+
A.prod !== void 0 && (h.has(k) ? R = "Limbo" : R = A.prod.finished ? "Done" : "Running");
|
|
2675
2674
|
const M = o.traverse(
|
|
2676
2675
|
{
|
|
2677
|
-
field:
|
|
2676
|
+
field: P(k, "blockPack"),
|
|
2678
2677
|
assertFieldType: "Dynamic",
|
|
2679
2678
|
errorIfFieldNotSet: !0
|
|
2680
2679
|
},
|
|
2681
|
-
{ field:
|
|
2682
|
-
),
|
|
2683
|
-
const
|
|
2680
|
+
{ field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2681
|
+
), N = M == null ? void 0 : M.getDataAsJson(), { sections: se, inputsValid: v, sdkVersion: O } = de(N == null ? void 0 : N.config, (fe) => {
|
|
2682
|
+
const q = je(fe), He = Je(o, k);
|
|
2684
2683
|
return {
|
|
2685
|
-
sections:
|
|
2684
|
+
sections: xe(
|
|
2686
2685
|
t,
|
|
2687
2686
|
He,
|
|
2688
|
-
|
|
2689
|
-
|
|
2687
|
+
q.sections,
|
|
2688
|
+
q.code
|
|
2690
2689
|
),
|
|
2691
|
-
inputsValid:
|
|
2690
|
+
inputsValid: xe(
|
|
2692
2691
|
t,
|
|
2693
2692
|
He,
|
|
2694
|
-
|
|
2695
|
-
|
|
2693
|
+
q.inputsValid,
|
|
2694
|
+
q.code
|
|
2696
2695
|
),
|
|
2697
|
-
sdkVersion:
|
|
2696
|
+
sdkVersion: q.sdkVersion
|
|
2698
2697
|
};
|
|
2699
|
-
}) || {},
|
|
2700
|
-
|
|
2698
|
+
}) || {}, B = de(
|
|
2699
|
+
N,
|
|
2701
2700
|
(fe) => t.blockUpdateWatcher.get(fe.source)
|
|
2702
2701
|
);
|
|
2703
2702
|
return {
|
|
2704
2703
|
id: k,
|
|
2705
2704
|
label: J,
|
|
2706
|
-
renderingMode:
|
|
2707
|
-
stale: ((Me =
|
|
2708
|
-
missingReference:
|
|
2705
|
+
renderingMode: Y,
|
|
2706
|
+
stale: ((Me = A.prod) == null ? void 0 : Me.stale) !== !1 || R === "Limbo",
|
|
2707
|
+
missingReference: x.missingReferences,
|
|
2709
2708
|
upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
|
|
2710
2709
|
downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
|
|
2711
|
-
calculationStatus:
|
|
2712
|
-
outputErrors: ((Ue =
|
|
2713
|
-
outputsError: ($e =
|
|
2714
|
-
exportsError: (Ge =
|
|
2710
|
+
calculationStatus: R,
|
|
2711
|
+
outputErrors: ((Ue = A.prod) == null ? void 0 : Ue.outputError) === !0,
|
|
2712
|
+
outputsError: ($e = A.prod) == null ? void 0 : $e.outputsError,
|
|
2713
|
+
exportsError: (Ge = A.prod) == null ? void 0 : Ge.exportsError,
|
|
2715
2714
|
sections: se,
|
|
2716
|
-
inputsValid:
|
|
2717
|
-
currentBlockPack:
|
|
2718
|
-
updatedBlockPack:
|
|
2719
|
-
sdkVersion:
|
|
2715
|
+
inputsValid: v,
|
|
2716
|
+
currentBlockPack: N == null ? void 0 : N.source,
|
|
2717
|
+
updatedBlockPack: B,
|
|
2718
|
+
sdkVersion: O,
|
|
2720
2719
|
navigationState: e.getState(k)
|
|
2721
2720
|
};
|
|
2722
2721
|
});
|
|
@@ -2743,27 +2742,27 @@ function fs(s, e, t) {
|
|
|
2743
2742
|
}
|
|
2744
2743
|
).withStableType();
|
|
2745
2744
|
}
|
|
2746
|
-
function
|
|
2745
|
+
function Nt(s, e) {
|
|
2747
2746
|
var t, r;
|
|
2748
2747
|
return de(
|
|
2749
2748
|
(r = (t = s.traverse(
|
|
2750
2749
|
{
|
|
2751
|
-
field:
|
|
2750
|
+
field: P(e, "blockPack"),
|
|
2752
2751
|
assertFieldType: "Dynamic",
|
|
2753
2752
|
errorIfFieldNotSet: !0
|
|
2754
2753
|
},
|
|
2755
|
-
{ field:
|
|
2754
|
+
{ field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2756
2755
|
)) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
|
|
2757
2756
|
(o) => je(o)
|
|
2758
2757
|
);
|
|
2759
2758
|
}
|
|
2760
2759
|
function ms(s, e) {
|
|
2761
2760
|
const t = s.node();
|
|
2762
|
-
if (U(t.resourceType,
|
|
2761
|
+
if (U(t.resourceType, Ct)) {
|
|
2763
2762
|
const r = t.getDataAsJson();
|
|
2764
2763
|
if (r === void 0) throw new Error("No resource data.");
|
|
2765
2764
|
return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
|
|
2766
|
-
} else if (U(t.resourceType,
|
|
2765
|
+
} else if (U(t.resourceType, Pt)) {
|
|
2767
2766
|
const r = t.getDataAsJson();
|
|
2768
2767
|
if (r === void 0) throw new Error("No resource data.");
|
|
2769
2768
|
return e.signer.verify(
|
|
@@ -2776,7 +2775,7 @@ function ms(s, e) {
|
|
|
2776
2775
|
}
|
|
2777
2776
|
function vs(s, e) {
|
|
2778
2777
|
if (s !== void 0)
|
|
2779
|
-
return
|
|
2778
|
+
return F.make(
|
|
2780
2779
|
(t) => ms(t.accessor(s), e),
|
|
2781
2780
|
{
|
|
2782
2781
|
postprocessValue: (t) => {
|
|
@@ -2790,16 +2789,16 @@ function vs(s, e) {
|
|
|
2790
2789
|
).withStableType();
|
|
2791
2790
|
}
|
|
2792
2791
|
function ys(s, e, t) {
|
|
2793
|
-
return
|
|
2792
|
+
return F.make(
|
|
2794
2793
|
(r) => {
|
|
2795
2794
|
var a;
|
|
2796
|
-
const o = r.accessor(s).node(), i =
|
|
2795
|
+
const o = r.accessor(s).node(), i = Nt(o, e), n = (a = o.traverse(
|
|
2797
2796
|
{
|
|
2798
|
-
field:
|
|
2797
|
+
field: P(e, "blockPack"),
|
|
2799
2798
|
assertFieldType: "Dynamic"
|
|
2800
2799
|
},
|
|
2801
|
-
{ field:
|
|
2802
|
-
{ field:
|
|
2800
|
+
{ field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
|
|
2801
|
+
{ field: Bt, assertFieldType: "Input" }
|
|
2803
2802
|
)) == null ? void 0 : a.persist();
|
|
2804
2803
|
return { path: vs(n, t), sdkVersion: i == null ? void 0 : i.sdkVersion };
|
|
2805
2804
|
},
|
|
@@ -2807,7 +2806,7 @@ function ys(s, e, t) {
|
|
|
2807
2806
|
);
|
|
2808
2807
|
}
|
|
2809
2808
|
function bs(s, e, t) {
|
|
2810
|
-
return
|
|
2809
|
+
return F.make(
|
|
2811
2810
|
(r) => {
|
|
2812
2811
|
const o = r.accessor(s).node(), i = Je(o, e);
|
|
2813
2812
|
return {
|
|
@@ -2820,14 +2819,14 @@ function bs(s, e, t) {
|
|
|
2820
2819
|
);
|
|
2821
2820
|
}
|
|
2822
2821
|
function ws(s, e, t) {
|
|
2823
|
-
return
|
|
2822
|
+
return F.make(
|
|
2824
2823
|
(r) => {
|
|
2825
|
-
const o = r.accessor(s).node(), i =
|
|
2824
|
+
const o = r.accessor(s).node(), i = jt(o, e), n = Nt(o, e);
|
|
2826
2825
|
return de(n, (a) => {
|
|
2827
2826
|
const c = {};
|
|
2828
2827
|
for (const [u, l] of Object.entries(a.outputs))
|
|
2829
|
-
c[u] =
|
|
2830
|
-
|
|
2828
|
+
c[u] = F.wrapError(
|
|
2829
|
+
xe(t, i, l, a.code)
|
|
2831
2830
|
);
|
|
2832
2831
|
return c;
|
|
2833
2832
|
});
|
|
@@ -2836,23 +2835,23 @@ function ws(s, e, t) {
|
|
|
2836
2835
|
).withStableType();
|
|
2837
2836
|
}
|
|
2838
2837
|
function Ss(s, e) {
|
|
2839
|
-
return
|
|
2840
|
-
const r = t.accessor(s).node(), o = w(r.getKeyValueAsJson(
|
|
2841
|
-
for (const { id: n, renderingMode: a } of
|
|
2838
|
+
return F.make((t) => {
|
|
2839
|
+
const r = t.accessor(s).node(), o = w(r.getKeyValueAsJson(W)), i = [];
|
|
2840
|
+
for (const { id: n, renderingMode: a } of L(o)) {
|
|
2842
2841
|
const c = r.traverse(
|
|
2843
2842
|
{
|
|
2844
|
-
field:
|
|
2843
|
+
field: P(n, "blockPack"),
|
|
2845
2844
|
assertFieldType: "Dynamic",
|
|
2846
2845
|
errorIfFieldNotSet: !0
|
|
2847
2846
|
},
|
|
2848
|
-
{ field:
|
|
2847
|
+
{ field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2849
2848
|
), u = c == null ? void 0 : c.getDataAsJson();
|
|
2850
2849
|
if ((u == null ? void 0 : u.config) === void 0) continue;
|
|
2851
|
-
const l = je(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !lt(f) &&
|
|
2850
|
+
const l = je(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !lt(f) && No(f)).map((f) => f);
|
|
2852
2851
|
if (p.length === 0) continue;
|
|
2853
|
-
const h =
|
|
2852
|
+
const h = jt(r, n);
|
|
2854
2853
|
for (const f of p)
|
|
2855
|
-
i.push(
|
|
2854
|
+
i.push(F.wrapError(Vt(e.driverKit, h, f)));
|
|
2856
2855
|
}
|
|
2857
2856
|
return i;
|
|
2858
2857
|
});
|
|
@@ -2874,7 +2873,7 @@ class ks {
|
|
|
2874
2873
|
return r === void 0 && (r = { state: { ..._t }, change: new ze() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
|
|
2875
2874
|
}
|
|
2876
2875
|
getState(e) {
|
|
2877
|
-
return
|
|
2876
|
+
return F.make(
|
|
2878
2877
|
(t) => this.readState(t, e),
|
|
2879
2878
|
{ key: `navigationState#${e}` }
|
|
2880
2879
|
);
|
|
@@ -2930,9 +2929,9 @@ class Ke {
|
|
|
2930
2929
|
*
|
|
2931
2930
|
* @return returns newly created block id
|
|
2932
2931
|
* */
|
|
2933
|
-
async addBlock(e, t, r, o = void 0, i =
|
|
2932
|
+
async addBlock(e, t, r, o = void 0, i = X()) {
|
|
2934
2933
|
const n = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfig(t);
|
|
2935
|
-
return await
|
|
2934
|
+
return await V(
|
|
2936
2935
|
this.env.pl,
|
|
2937
2936
|
this.rid,
|
|
2938
2937
|
o,
|
|
@@ -2956,7 +2955,7 @@ class Ke {
|
|
|
2956
2955
|
* */
|
|
2957
2956
|
async updateBlockPack(e, t, r = !1, o) {
|
|
2958
2957
|
const i = await this.env.bpPreparer.prepare(t), n = await this.env.bpPreparer.getBlockConfig(t);
|
|
2959
|
-
await
|
|
2958
|
+
await V(
|
|
2960
2959
|
this.env.pl,
|
|
2961
2960
|
this.rid,
|
|
2962
2961
|
o,
|
|
@@ -2969,7 +2968,7 @@ class Ke {
|
|
|
2969
2968
|
}
|
|
2970
2969
|
/** Deletes a block with all associated data. */
|
|
2971
2970
|
async deleteBlock(e, t) {
|
|
2972
|
-
await
|
|
2971
|
+
await V(this.env.pl, this.rid, t, (r) => r.deleteBlock(e)), this.navigationStates.deleteBlock(e), await this.projectTree.refreshState();
|
|
2973
2972
|
}
|
|
2974
2973
|
/**
|
|
2975
2974
|
* Updates block order according to the given array of block ids.
|
|
@@ -2978,7 +2977,7 @@ class Ke {
|
|
|
2978
2977
|
* an error will be thrown instead.
|
|
2979
2978
|
*/
|
|
2980
2979
|
async reorderBlocks(e, t) {
|
|
2981
|
-
await
|
|
2980
|
+
await V(this.env.pl, this.rid, t, (r) => {
|
|
2982
2981
|
const o = r.structure;
|
|
2983
2982
|
if (o.groups.length !== 1)
|
|
2984
2983
|
throw new Error("Unexpected project structure, non-sinular block group");
|
|
@@ -3020,7 +3019,7 @@ class Ke {
|
|
|
3020
3019
|
}
|
|
3021
3020
|
/** Update block label. */
|
|
3022
3021
|
async setBlockLabel(e, t, r) {
|
|
3023
|
-
await
|
|
3022
|
+
await V(this.env.pl, this.rid, r, (o) => {
|
|
3024
3023
|
o.setBlockLabel(e, t);
|
|
3025
3024
|
}), await this.projectTree.refreshState();
|
|
3026
3025
|
}
|
|
@@ -3031,7 +3030,7 @@ class Ke {
|
|
|
3031
3030
|
* in collaborative editing scenario.
|
|
3032
3031
|
* */
|
|
3033
3032
|
async setBlockArgs(e, t, r) {
|
|
3034
|
-
await
|
|
3033
|
+
await V(
|
|
3035
3034
|
this.env.pl,
|
|
3036
3035
|
this.rid,
|
|
3037
3036
|
r,
|
|
@@ -3045,7 +3044,7 @@ class Ke {
|
|
|
3045
3044
|
* in collaborative editing scenario.
|
|
3046
3045
|
* */
|
|
3047
3046
|
async setUiState(e, t, r) {
|
|
3048
|
-
await
|
|
3047
|
+
await V(
|
|
3049
3048
|
this.env.pl,
|
|
3050
3049
|
this.rid,
|
|
3051
3050
|
r,
|
|
@@ -3065,7 +3064,7 @@ class Ke {
|
|
|
3065
3064
|
* in collaborative editing scenario.
|
|
3066
3065
|
* */
|
|
3067
3066
|
async setBlockArgsAndUiState(e, t, r, o) {
|
|
3068
|
-
await
|
|
3067
|
+
await V(this.env.pl, this.rid, o, (i) => {
|
|
3069
3068
|
i.setArgs([{ blockId: e, args: JSON.stringify(t) }]), i.setUiState(e, JSON.stringify(r));
|
|
3070
3069
|
}), await this.projectTree.refreshState();
|
|
3071
3070
|
}
|
|
@@ -3073,13 +3072,13 @@ class Ke {
|
|
|
3073
3072
|
async resetBlockArgsAndUiState(e, t) {
|
|
3074
3073
|
await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
|
|
3075
3074
|
const o = Se(
|
|
3076
|
-
(await r.getField(S(this.rid,
|
|
3075
|
+
(await r.getField(S(this.rid, P(e, "blockPack")))).value
|
|
3077
3076
|
), i = Se(
|
|
3078
|
-
(await r.getField(S(o,
|
|
3077
|
+
(await r.getField(S(o, y.HolderRefField))).value
|
|
3079
3078
|
), n = await r.getResourceData(i, !1), a = JSON.parse(
|
|
3080
3079
|
Buffer.from(w(n.data)).toString("utf-8")
|
|
3081
3080
|
);
|
|
3082
|
-
await
|
|
3081
|
+
await V(r, this.rid, t, (c) => {
|
|
3083
3082
|
c.setArgs([{ blockId: e, args: JSON.stringify(a.config.initialArgs) }]), c.setUiState(e, void 0);
|
|
3084
3083
|
}), await r.commit();
|
|
3085
3084
|
}), await this.projectTree.refreshState();
|
|
@@ -3088,7 +3087,7 @@ class Ke {
|
|
|
3088
3087
|
const t = this.blockComputables.get(e);
|
|
3089
3088
|
if (t === void 0) {
|
|
3090
3089
|
const r = ws(this.projectTree.entry(), e, this.env), i = {
|
|
3091
|
-
fullState:
|
|
3090
|
+
fullState: F.make(
|
|
3092
3091
|
(n) => ({
|
|
3093
3092
|
argsAndUiState: bs(this.projectTree.entry(), e),
|
|
3094
3093
|
outputs: r,
|
|
@@ -3165,10 +3164,8 @@ function Cs(s) {
|
|
|
3165
3164
|
return s.fields;
|
|
3166
3165
|
}
|
|
3167
3166
|
}
|
|
3168
|
-
const
|
|
3167
|
+
const Jt = {
|
|
3169
3168
|
logger: new Zt(),
|
|
3170
|
-
platformLocalStorageNameToPath: {},
|
|
3171
|
-
localStorageNameToPath: { local: vt.homedir() },
|
|
3172
3169
|
blobDriverOps: {
|
|
3173
3170
|
cacheSoftSizeBytes: 100 * 1024 * 1024,
|
|
3174
3171
|
// 100MB
|
|
@@ -3185,8 +3182,15 @@ const Kt = {
|
|
|
3185
3182
|
pollingInterval: 1e3,
|
|
3186
3183
|
stopPollingDelay: 1e3
|
|
3187
3184
|
}
|
|
3188
|
-
}
|
|
3189
|
-
|
|
3185
|
+
};
|
|
3186
|
+
function Kt(s) {
|
|
3187
|
+
return {
|
|
3188
|
+
blobDownloadPath: E.join(s, "download"),
|
|
3189
|
+
virtualLocalStorages: fr()
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
const Ps = {
|
|
3193
|
+
...Jt,
|
|
3190
3194
|
defaultTreeOptions: {
|
|
3191
3195
|
pollingInterval: 350,
|
|
3192
3196
|
stopPollingDelay: 2500
|
|
@@ -3194,12 +3198,19 @@ const Kt = {
|
|
|
3194
3198
|
devBlockUpdateRecheckInterval: 1e3,
|
|
3195
3199
|
projectRefreshInterval: 700,
|
|
3196
3200
|
stagingRenderingRate: 5
|
|
3197
|
-
}
|
|
3201
|
+
};
|
|
3202
|
+
function Fs(s) {
|
|
3203
|
+
return {
|
|
3204
|
+
...Kt(s),
|
|
3205
|
+
frontendDownloadPath: E.join(s, "frontend")
|
|
3206
|
+
};
|
|
3207
|
+
}
|
|
3208
|
+
const Bs = {
|
|
3198
3209
|
minDelay: 1500
|
|
3199
|
-
},
|
|
3200
|
-
class
|
|
3210
|
+
}, Rs = "__no_updates__";
|
|
3211
|
+
class Os extends ur {
|
|
3201
3212
|
constructor(t, r, o = {}) {
|
|
3202
|
-
super({ ...o, ...
|
|
3213
|
+
super({ ...o, ...Bs }, r);
|
|
3203
3214
|
d(this, "http");
|
|
3204
3215
|
this.registryProvider = t, this.http = o.http;
|
|
3205
3216
|
}
|
|
@@ -3212,7 +3223,7 @@ class Rs extends ur {
|
|
|
3212
3223
|
case "from-registry-v2":
|
|
3213
3224
|
return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
|
|
3214
3225
|
default:
|
|
3215
|
-
return
|
|
3226
|
+
return Rs;
|
|
3216
3227
|
}
|
|
3217
3228
|
}
|
|
3218
3229
|
async readValue(t) {
|
|
@@ -3221,7 +3232,7 @@ class Rs extends ur {
|
|
|
3221
3232
|
switch (t.type) {
|
|
3222
3233
|
case "dev-v1":
|
|
3223
3234
|
try {
|
|
3224
|
-
const o = await
|
|
3235
|
+
const o = await yt(t.folder);
|
|
3225
3236
|
return o === t.mtime ? void 0 : { ...t, mtime: o };
|
|
3226
3237
|
} catch (o) {
|
|
3227
3238
|
this.logger.warn(o);
|
|
@@ -3273,7 +3284,7 @@ class Rs extends ur {
|
|
|
3273
3284
|
case "dev-v2":
|
|
3274
3285
|
return r.type !== "dev-v2" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
|
|
3275
3286
|
default:
|
|
3276
|
-
|
|
3287
|
+
D(t);
|
|
3277
3288
|
}
|
|
3278
3289
|
}
|
|
3279
3290
|
}
|
|
@@ -3315,7 +3326,7 @@ class at {
|
|
|
3315
3326
|
function ct(s) {
|
|
3316
3327
|
return String(s.id);
|
|
3317
3328
|
}
|
|
3318
|
-
class
|
|
3329
|
+
class Ds {
|
|
3319
3330
|
constructor(e, t, r) {
|
|
3320
3331
|
d(this, "pFrame", new Br());
|
|
3321
3332
|
d(this, "blobIdToResource", /* @__PURE__ */ new Map());
|
|
@@ -3376,10 +3387,10 @@ class xs {
|
|
|
3376
3387
|
super(), this.blobDriver = o;
|
|
3377
3388
|
}
|
|
3378
3389
|
createNewResource(o) {
|
|
3379
|
-
return new
|
|
3390
|
+
return new Ds(this.blobDriver, t, o);
|
|
3380
3391
|
}
|
|
3381
3392
|
calculateParamsKey(o) {
|
|
3382
|
-
return
|
|
3393
|
+
return Es(o);
|
|
3383
3394
|
}
|
|
3384
3395
|
}(this.blobDriver), this.pTables = new class extends at {
|
|
3385
3396
|
constructor(o) {
|
|
@@ -3388,14 +3399,14 @@ class xs {
|
|
|
3388
3399
|
async createNewResource(o) {
|
|
3389
3400
|
const i = this.pFrames.getByKey(o.pFrameHandle), n = await r.run(
|
|
3390
3401
|
async () => await i.pFrame.createTable({
|
|
3391
|
-
src:
|
|
3402
|
+
src: Z(o.def.src),
|
|
3392
3403
|
filters: o.def.filters
|
|
3393
3404
|
})
|
|
3394
3405
|
);
|
|
3395
3406
|
return o.def.sorting.length !== 0 ? n.sort(o.def.sorting) : n;
|
|
3396
3407
|
}
|
|
3397
3408
|
calculateParamsKey(o) {
|
|
3398
|
-
return
|
|
3409
|
+
return js(o);
|
|
3399
3410
|
}
|
|
3400
3411
|
}(this.pFrames);
|
|
3401
3412
|
}
|
|
@@ -3403,11 +3414,11 @@ class xs {
|
|
|
3403
3414
|
// Internal / Config API Methods
|
|
3404
3415
|
//
|
|
3405
3416
|
createPFrame(e, t) {
|
|
3406
|
-
const r = e.map((i) =>
|
|
3417
|
+
const r = e.map((i) => Q(i, (n) => To(n))), o = this.pFrames.acquire(r);
|
|
3407
3418
|
return t.addOnDestroy(o.unref), o.key;
|
|
3408
3419
|
}
|
|
3409
3420
|
createPTable(e, t) {
|
|
3410
|
-
const r = this.createPFrame(
|
|
3421
|
+
const r = this.createPFrame(As(e.src), t), o = ut(e, (n) => n.id), i = this.pTables.acquire({ def: o, pFrameHandle: r });
|
|
3411
3422
|
return t.addOnDestroy(i.unref), i.key;
|
|
3412
3423
|
}
|
|
3413
3424
|
//
|
|
@@ -3437,7 +3448,7 @@ class xs {
|
|
|
3437
3448
|
async calculateTableData(e, t) {
|
|
3438
3449
|
let r = await this.concurrencyLimiter.run(
|
|
3439
3450
|
async () => await this.pFrames.getByKey(e).pFrame.createTable({
|
|
3440
|
-
src:
|
|
3451
|
+
src: Z(t.src),
|
|
3441
3452
|
filters: t.filters
|
|
3442
3453
|
})
|
|
3443
3454
|
);
|
|
@@ -3476,7 +3487,7 @@ class xs {
|
|
|
3476
3487
|
);
|
|
3477
3488
|
}
|
|
3478
3489
|
}
|
|
3479
|
-
function
|
|
3490
|
+
function Z(s) {
|
|
3480
3491
|
switch (s.type) {
|
|
3481
3492
|
case "column":
|
|
3482
3493
|
return {
|
|
@@ -3488,30 +3499,30 @@ function Q(s) {
|
|
|
3488
3499
|
case "full":
|
|
3489
3500
|
return {
|
|
3490
3501
|
type: s.type,
|
|
3491
|
-
entries: s.entries.map((e) =>
|
|
3502
|
+
entries: s.entries.map((e) => Z(e))
|
|
3492
3503
|
};
|
|
3493
3504
|
case "outer":
|
|
3494
3505
|
return {
|
|
3495
3506
|
type: "outer",
|
|
3496
|
-
primary:
|
|
3497
|
-
secondary: s.secondary.map((e) =>
|
|
3507
|
+
primary: Z(s.primary),
|
|
3508
|
+
secondary: s.secondary.map((e) => Z(e))
|
|
3498
3509
|
};
|
|
3499
3510
|
default:
|
|
3500
|
-
|
|
3511
|
+
D(s);
|
|
3501
3512
|
}
|
|
3502
3513
|
}
|
|
3503
|
-
function
|
|
3514
|
+
function js(s) {
|
|
3504
3515
|
const e = he("sha256");
|
|
3505
|
-
return e.update(s.pFrameHandle), e.update(
|
|
3516
|
+
return e.update(s.pFrameHandle), e.update(Ee(s.def)), e.digest().toString("hex");
|
|
3506
3517
|
}
|
|
3507
|
-
function
|
|
3518
|
+
function Es(s) {
|
|
3508
3519
|
const e = s.map((o) => o.id).sort(), t = he("sha256");
|
|
3509
3520
|
let r = "";
|
|
3510
3521
|
for (const o of e)
|
|
3511
3522
|
r !== o && (t.update(o), r = o);
|
|
3512
3523
|
return t.digest().toString("hex");
|
|
3513
3524
|
}
|
|
3514
|
-
function
|
|
3525
|
+
function As(s) {
|
|
3515
3526
|
const e = /* @__PURE__ */ new Map();
|
|
3516
3527
|
return ae(s, e), [...e.values()];
|
|
3517
3528
|
}
|
|
@@ -3529,45 +3540,44 @@ function ae(s, e) {
|
|
|
3529
3540
|
for (const t of s.secondary) ae(t, e);
|
|
3530
3541
|
return;
|
|
3531
3542
|
default:
|
|
3532
|
-
|
|
3543
|
+
D(s);
|
|
3533
3544
|
}
|
|
3534
3545
|
}
|
|
3535
|
-
async function
|
|
3536
|
-
const
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
t
|
|
3540
|
-
|
|
3546
|
+
async function Ts(s, e, t) {
|
|
3547
|
+
const r = {
|
|
3548
|
+
...Jt,
|
|
3549
|
+
...Kt(e),
|
|
3550
|
+
...t
|
|
3551
|
+
}, o = new pt(r.localSecret), i = mr(r.logger, s, r.localProjections), n = vr(s, r.logger), a = yr(s, r.logger), c = br(s, r.logger), u = new wr(
|
|
3552
|
+
r.logger,
|
|
3541
3553
|
i,
|
|
3542
|
-
t.blobDownloadPath,
|
|
3543
|
-
r,
|
|
3544
|
-
t.blobDriverOps
|
|
3545
|
-
), l = new Sr(
|
|
3546
|
-
t.logger,
|
|
3547
|
-
r,
|
|
3548
3554
|
n,
|
|
3555
|
+
r.blobDownloadPath,
|
|
3556
|
+
o,
|
|
3557
|
+
r.blobDriverOps
|
|
3558
|
+
), l = new Sr(
|
|
3559
|
+
r.logger,
|
|
3560
|
+
o,
|
|
3549
3561
|
a,
|
|
3550
|
-
|
|
3551
|
-
|
|
3562
|
+
c,
|
|
3563
|
+
r.uploadDriverOps
|
|
3564
|
+
), p = new kr(n, r.logStreamDriverOps), h = new Cr(p, u), f = await Pr.init(
|
|
3565
|
+
r.logger,
|
|
3566
|
+
s,
|
|
3567
|
+
o,
|
|
3568
|
+
r.virtualLocalStorages,
|
|
3569
|
+
r.localProjections,
|
|
3570
|
+
r.openFileDialogCallback
|
|
3571
|
+
), b = new xs(u);
|
|
3552
3572
|
return {
|
|
3553
3573
|
blobDriver: u,
|
|
3554
3574
|
logDriver: h,
|
|
3555
3575
|
lsDriver: f,
|
|
3556
|
-
signer:
|
|
3576
|
+
signer: o,
|
|
3557
3577
|
uploadDriver: l,
|
|
3558
|
-
pFrameDriver:
|
|
3578
|
+
pFrameDriver: b
|
|
3559
3579
|
};
|
|
3560
3580
|
}
|
|
3561
|
-
function As(s, e) {
|
|
3562
|
-
e.localStorageNameToPath.local != vt.homedir() && s.info(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
|
|
3563
|
-
const t = Object.keys(e.platformLocalStorageNameToPath), r = Object.keys(e.localStorageNameToPath).find(
|
|
3564
|
-
(o) => t.includes(o)
|
|
3565
|
-
);
|
|
3566
|
-
if (r)
|
|
3567
|
-
throw new Error(
|
|
3568
|
-
`Platform local storages include one or more local storages: ${r}. Note that we automatically included 'local' storage with user's home directory.`
|
|
3569
|
-
);
|
|
3570
|
-
}
|
|
3571
3581
|
class Mt {
|
|
3572
3582
|
constructor(e, t, r, o, i, n, a, c) {
|
|
3573
3583
|
d(this, "pl");
|
|
@@ -3587,7 +3597,7 @@ class Mt {
|
|
|
3587
3597
|
// Project List Manipulation
|
|
3588
3598
|
//
|
|
3589
3599
|
/** Creates a project with initial state and adds it to project list. */
|
|
3590
|
-
async createProject(e, t =
|
|
3600
|
+
async createProject(e, t = X()) {
|
|
3591
3601
|
const r = await this.pl.withWriteTx("MLCreateProject", async (o) => {
|
|
3592
3602
|
const i = await Bo(o, e);
|
|
3593
3603
|
return o.createField(S(this.projectListResourceId, t), "Dynamic", i), await o.commit(), await ar(i);
|
|
@@ -3596,7 +3606,7 @@ class Mt {
|
|
|
3596
3606
|
}
|
|
3597
3607
|
/** Updates project metadata */
|
|
3598
3608
|
async setProjectMeta(e, t, r) {
|
|
3599
|
-
await
|
|
3609
|
+
await V(this.pl, e, r, async (o) => {
|
|
3600
3610
|
o.setMeta(t);
|
|
3601
3611
|
}), await this.projectListTree.refreshState();
|
|
3602
3612
|
}
|
|
@@ -3652,64 +3662,70 @@ class Mt {
|
|
|
3652
3662
|
return pt.generateSecret();
|
|
3653
3663
|
}
|
|
3654
3664
|
/** Initialize middle layer */
|
|
3655
|
-
static async init(e, t) {
|
|
3656
|
-
const
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
+
static async init(e, t, r) {
|
|
3666
|
+
const o = {
|
|
3667
|
+
...Ps,
|
|
3668
|
+
...Fs(t),
|
|
3669
|
+
...r
|
|
3670
|
+
};
|
|
3671
|
+
process.env.MI_LOG_TREE_STAT && (o.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
|
|
3672
|
+
const i = await e.withWriteTx("MLInitialization", async (C) => {
|
|
3673
|
+
const I = S(C.clientRoot, Wr);
|
|
3674
|
+
C.createField(I, "Dynamic");
|
|
3675
|
+
const $ = await C.getField(I);
|
|
3676
|
+
if (ce($.value)) {
|
|
3677
|
+
const K = C.createEphemeral(St);
|
|
3678
|
+
return C.lock(K), C.setField(I, K), await C.commit(), await K.globalId;
|
|
3665
3679
|
} else
|
|
3666
|
-
return
|
|
3667
|
-
}),
|
|
3680
|
+
return $.value;
|
|
3681
|
+
}), n = o.logger, a = await Ts(e, t, o), c = new Wt(e.httpDispatcher, {
|
|
3668
3682
|
minTimeout: 250,
|
|
3669
3683
|
maxRetries: 4
|
|
3670
|
-
}),
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
),
|
|
3675
|
-
|
|
3684
|
+
}), u = new Ir(c), l = new bo(
|
|
3685
|
+
u,
|
|
3686
|
+
a.signer,
|
|
3687
|
+
c
|
|
3688
|
+
), p = new Fr(
|
|
3689
|
+
n,
|
|
3676
3690
|
e.httpDispatcher,
|
|
3677
|
-
|
|
3678
|
-
),
|
|
3691
|
+
o.frontendDownloadPath
|
|
3692
|
+
), h = {
|
|
3679
3693
|
pl: e,
|
|
3680
|
-
signer:
|
|
3681
|
-
logger:
|
|
3694
|
+
signer: a.signer,
|
|
3695
|
+
logger: n,
|
|
3682
3696
|
httpDispatcher: e.httpDispatcher,
|
|
3683
|
-
retryHttpDispatcher:
|
|
3684
|
-
ops:
|
|
3685
|
-
bpPreparer:
|
|
3686
|
-
frontendDownloadDriver:
|
|
3687
|
-
driverKit:
|
|
3688
|
-
blockUpdateWatcher: new
|
|
3689
|
-
minDelay:
|
|
3690
|
-
http:
|
|
3697
|
+
retryHttpDispatcher: c,
|
|
3698
|
+
ops: o,
|
|
3699
|
+
bpPreparer: l,
|
|
3700
|
+
frontendDownloadDriver: p,
|
|
3701
|
+
driverKit: a,
|
|
3702
|
+
blockUpdateWatcher: new Os(u, n, {
|
|
3703
|
+
minDelay: o.devBlockUpdateRecheckInterval,
|
|
3704
|
+
http: c
|
|
3691
3705
|
}),
|
|
3692
3706
|
quickJs: await hr()
|
|
3693
|
-
},
|
|
3707
|
+
}, f = new lr([]), b = await Yr(e, i, f, h);
|
|
3694
3708
|
return new Mt(
|
|
3695
|
-
p,
|
|
3696
|
-
n,
|
|
3697
|
-
n.signer,
|
|
3698
|
-
o,
|
|
3699
3709
|
h,
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3710
|
+
a,
|
|
3711
|
+
a.signer,
|
|
3712
|
+
i,
|
|
3713
|
+
f,
|
|
3714
|
+
b.tree,
|
|
3715
|
+
u,
|
|
3716
|
+
b.computable
|
|
3703
3717
|
);
|
|
3704
3718
|
}
|
|
3705
3719
|
}
|
|
3706
3720
|
export {
|
|
3707
3721
|
si as BlockPackRegistry,
|
|
3708
3722
|
ii as CentralBlockRegistry,
|
|
3709
|
-
Kt as
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3723
|
+
Kt as DefaultDriverKitOpsPaths,
|
|
3724
|
+
Jt as DefaultDriverKitOpsSettings,
|
|
3725
|
+
Fs as DefaultMiddleLayerOpsPaths,
|
|
3726
|
+
Ps as DefaultMiddleLayerOpsSettings,
|
|
3727
|
+
Pt as FrontendFromFolderResourceType,
|
|
3728
|
+
Ct as FrontendFromUrlResourceType,
|
|
3713
3729
|
Mt as MiddleLayer,
|
|
3714
3730
|
Ke as Project,
|
|
3715
3731
|
io as TengoTemplateGet,
|
|
@@ -3723,11 +3739,11 @@ export {
|
|
|
3723
3739
|
ai as V1CentralDevSnapshotRegistry,
|
|
3724
3740
|
ni as V1CentralRegistry,
|
|
3725
3741
|
Ir as V2RegistryProvider,
|
|
3726
|
-
|
|
3727
|
-
|
|
3742
|
+
kt as createRenderTemplate,
|
|
3743
|
+
yt as getDevV1PacketMtime,
|
|
3728
3744
|
Ie as getDevV2PacketMtime,
|
|
3729
|
-
|
|
3730
|
-
|
|
3745
|
+
Ts as initDriverKit,
|
|
3746
|
+
Le as loadTemplate,
|
|
3731
3747
|
go as prepareTemplateSpec
|
|
3732
3748
|
};
|
|
3733
3749
|
//# sourceMappingURL=index.mjs.map
|