@milaboratories/pl-middle-layer 1.10.23 → 1.10.25
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/block_registry/index.d.ts +1 -0
- package/dist/block_registry/index.d.ts.map +1 -1
- package/dist/block_registry/registry.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +691 -658
- package/dist/index.mjs.map +1 -1
- package/dist/middle_layer/middle_layer.d.ts.map +1 -1
- package/dist/mutator/block-pack/block_pack.d.ts +3 -1
- package/dist/mutator/block-pack/block_pack.d.ts.map +1 -1
- package/dist/test/block_packs.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/block_registry/index.ts +1 -0
- package/src/block_registry/registry-v2-provider.ts +1 -1
- package/src/block_registry/registry.test.ts +3 -3
- package/src/block_registry/registry.ts +0 -1
- package/src/block_registry/well_known_registries.ts +1 -1
- package/src/middle_layer/middle_layer.ts +8 -1
- package/src/mutator/block-pack/block_pack.test.ts +6 -1
- package/src/mutator/block-pack/block_pack.ts +31 -2
- package/src/test/block_packs.ts +3 -0
- package/src/test/known_templates.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
var Kt = Object.defineProperty;
|
|
2
2
|
var Mt = (o, e, t) => e in o ? Kt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
3
|
var d = (o, e, t) => Mt(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { executePSpecPredicate as
|
|
4
|
+
import { executePSpecPredicate as Ut, mapPObjectData as q, mapValueInVOE as $t, mapPTableDef as ct, isFunctionHandle as ut, normalizeBlockConfig as xe, DefaultNavigationState as Gt } from "@platforma-sdk/model";
|
|
5
5
|
export * from "@platforma-sdk/model";
|
|
6
6
|
export * from "@milaboratories/pl-model-middle-layer";
|
|
7
|
-
import { request as
|
|
8
|
-
import { RegistryV1 as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { assertNever as D, notEmpty as w, HmacSha256Signer as dt, ConsoleLoggerAdapter as
|
|
13
|
-
import * as
|
|
14
|
-
import { tryResolve as
|
|
15
|
-
import { resourceTypesEqual as
|
|
7
|
+
import { request as $ } from "undici";
|
|
8
|
+
import { RegistryV1 as G, tryLoadPackDescription as lt, BlockPackMetaEmbedAbsoluteBytes as Ht, RegistryV2Reader as Wt, folderReaderByUrl as _t, loadPackDescription as He } from "@platforma-sdk/block-tools";
|
|
9
|
+
import T from "node:fs";
|
|
10
|
+
import V from "node:path";
|
|
11
|
+
import zt from "yaml";
|
|
12
|
+
import { assertNever as D, notEmpty as w, HmacSha256Signer as dt, ConsoleLoggerAdapter as qt } from "@milaboratories/ts-helpers";
|
|
13
|
+
import * as Yt from "node:fs/promises";
|
|
14
|
+
import { tryResolve as Qt } from "@milaboratories/resolve-helper";
|
|
15
|
+
import { resourceTypesEqual as M, field as S, Pl as b, PlClient as Zt, isNullResourceId as ce, ensureResourceIdNotNull as we, isResource as Xt, isResourceRef as er, isNotNullResourceId as We, resourceType as ee, resourceTypeToString as tr, resourceIdToString as pt, isNotFoundError as rr, isTimeoutOrCancelError as or, toGlobalResourceId as sr } from "@milaboratories/pl-client";
|
|
16
16
|
export * from "@milaboratories/pl-client";
|
|
17
|
-
import { SynchronizedTreeState as ht, PlError as
|
|
18
|
-
import { Computable as P, ChangeSource as
|
|
19
|
-
import { randomUUID as
|
|
17
|
+
import { SynchronizedTreeState as ht, PlError as nr } from "@milaboratories/pl-tree";
|
|
18
|
+
import { Computable as P, ChangeSource as _e, PollComputablePool as ir, WatchableValue as ar } from "@milaboratories/computable";
|
|
19
|
+
import { randomUUID as Q, createHash as he } from "node:crypto";
|
|
20
20
|
import ft from "denque";
|
|
21
|
-
import { Templates as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import { Scope as Se, getQuickJS as
|
|
25
|
-
import { setTimeout as
|
|
21
|
+
import { Templates as cr } from "@platforma-sdk/workflow-tengo";
|
|
22
|
+
import je from "canonicalize";
|
|
23
|
+
import ur from "node:assert";
|
|
24
|
+
import { Scope as Se, getQuickJS as lr } from "quickjs-emscripten";
|
|
25
|
+
import { setTimeout as dr } from "node:timers/promises";
|
|
26
26
|
import * as gt from "node:os";
|
|
27
|
-
import { createDownloadClient as
|
|
28
|
-
import { PFrame as
|
|
27
|
+
import { createDownloadClient as pr, createLogsClient as hr, createUploadBlobClient as fr, createUploadProgressClient as gr, createLsFilesClient as mr, DownloadDriver as vr, UploadDriver as yr, LogsStreamDriver as br, LogsDriver as wr, LsDriver as Sr, DownloadUrlDriver as kr } from "@milaboratories/pl-drivers";
|
|
28
|
+
import { PFrame as Cr } from "@milaboratories/pframes-node";
|
|
29
29
|
async function ze(o) {
|
|
30
30
|
try {
|
|
31
|
-
return await
|
|
31
|
+
return await Yt.stat(o, { bigint: !0 });
|
|
32
32
|
} catch (e) {
|
|
33
33
|
if (e.code === "ENOENT")
|
|
34
34
|
return;
|
|
35
35
|
throw e;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const Pr = [G.PlPackageYamlConfigFile], Fr = [G.PlPackageJsonConfigFile], Ee = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Te = ["config", "dist", "config.json"], mt = ["frontend", "dist"], qe = "block-model/dist/config.json", Br = "block-ui/package.json", Rr = [
|
|
39
|
+
Ee,
|
|
39
40
|
Te,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Cr,
|
|
41
|
+
Pr,
|
|
42
|
+
Fr,
|
|
43
43
|
mt
|
|
44
44
|
];
|
|
45
|
-
async function
|
|
46
|
-
return await ze(
|
|
45
|
+
async function Or(o) {
|
|
46
|
+
return await ze(V.join(o, ...Te)) !== void 0 || await ze(V.join(o, ...Ee)) !== void 0;
|
|
47
47
|
}
|
|
48
48
|
function me(o, e) {
|
|
49
|
-
const t =
|
|
49
|
+
const t = Qt(o, e);
|
|
50
50
|
if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
|
|
51
51
|
return t;
|
|
52
52
|
}
|
|
53
53
|
async function Ye(o, e) {
|
|
54
|
-
if (
|
|
54
|
+
if (V.isAbsolute(o) || (o = V.resolve(o)), await Or(o))
|
|
55
55
|
return {
|
|
56
|
-
workflow:
|
|
57
|
-
config:
|
|
58
|
-
ui:
|
|
56
|
+
workflow: V.join(o, ...Ee),
|
|
57
|
+
config: V.join(o, ...Te),
|
|
58
|
+
ui: V.join(o, ...mt)
|
|
59
59
|
};
|
|
60
60
|
{
|
|
61
|
-
const t = me(o, qe), r = me(o, qe), s = me(o,
|
|
62
|
-
return { workflow: t, config: r, ui:
|
|
61
|
+
const t = me(o, qe), r = me(o, qe), s = me(o, Br);
|
|
62
|
+
return { workflow: t, config: r, ui: V.resolve(s, "..", "dist") };
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
async function
|
|
65
|
+
async function Dr(o) {
|
|
66
66
|
try {
|
|
67
|
-
return await
|
|
67
|
+
return await T.promises.readFile(o, "utf8");
|
|
68
68
|
} catch (e) {
|
|
69
69
|
if (e.code === "ENOENT")
|
|
70
70
|
return;
|
|
71
71
|
throw e;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
async function
|
|
74
|
+
async function xr(o) {
|
|
75
75
|
try {
|
|
76
|
-
return await
|
|
76
|
+
return await T.promises.stat(o, { bigint: !0 });
|
|
77
77
|
} catch (e) {
|
|
78
78
|
if (e.code === "ENOENT")
|
|
79
79
|
return;
|
|
@@ -82,19 +82,19 @@ async function Or(o) {
|
|
|
82
82
|
}
|
|
83
83
|
async function vt(o) {
|
|
84
84
|
let e = 0n;
|
|
85
|
-
for (const t of
|
|
86
|
-
const r =
|
|
85
|
+
for (const t of Rr) {
|
|
86
|
+
const r = V.join(o, ...t), s = await xr(r);
|
|
87
87
|
s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
|
|
88
88
|
}
|
|
89
89
|
return e.toString();
|
|
90
90
|
}
|
|
91
91
|
async function Ae(o) {
|
|
92
|
-
const e = await
|
|
92
|
+
const e = await T.promises.stat(o.components.workflow.main.file, {
|
|
93
93
|
bigint: !0
|
|
94
|
-
}), t = await
|
|
94
|
+
}), t = await T.promises.stat(o.components.model.file, { bigint: !0 });
|
|
95
95
|
return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
|
|
96
96
|
}
|
|
97
|
-
class
|
|
97
|
+
class Qs {
|
|
98
98
|
constructor(e, t, r) {
|
|
99
99
|
this.v2Provider = e, this.registries = t, this.http = r;
|
|
100
100
|
}
|
|
@@ -102,30 +102,30 @@ class zs {
|
|
|
102
102
|
const t = [], r = e.spec;
|
|
103
103
|
switch (r.type) {
|
|
104
104
|
case "remote-v1":
|
|
105
|
-
const s = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await
|
|
106
|
-
`${r.url}/${
|
|
105
|
+
const s = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await $(
|
|
106
|
+
`${r.url}/${G.GlobalOverviewPath}`,
|
|
107
107
|
s
|
|
108
108
|
)).body.json();
|
|
109
109
|
for (const a of i) {
|
|
110
|
-
const { organization:
|
|
111
|
-
organization:
|
|
112
|
-
name:
|
|
110
|
+
const { organization: c, package: u, latestMeta: l, latestVersion: p } = a, f = {
|
|
111
|
+
organization: c,
|
|
112
|
+
name: u,
|
|
113
113
|
version: p
|
|
114
114
|
};
|
|
115
115
|
t.push({
|
|
116
116
|
registryId: e.id,
|
|
117
|
-
id:
|
|
117
|
+
id: f,
|
|
118
118
|
meta: {
|
|
119
119
|
title: l.title ?? "No title",
|
|
120
120
|
description: l.description ?? "No Description",
|
|
121
121
|
organization: {
|
|
122
|
-
name:
|
|
122
|
+
name: c,
|
|
123
123
|
url: "https://unknown.com"
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
spec: {
|
|
127
127
|
type: "from-registry-v1",
|
|
128
|
-
id:
|
|
128
|
+
id: f,
|
|
129
129
|
registryUrl: r.url
|
|
130
130
|
},
|
|
131
131
|
otherVersions: a.allVersions
|
|
@@ -138,20 +138,20 @@ class zs {
|
|
|
138
138
|
registryId: e.id
|
|
139
139
|
}));
|
|
140
140
|
case "local-dev":
|
|
141
|
-
for (const a of await
|
|
141
|
+
for (const a of await T.promises.readdir(r.path, { withFileTypes: !0 })) {
|
|
142
142
|
if (!a.isDirectory()) continue;
|
|
143
|
-
const
|
|
144
|
-
|
|
143
|
+
const c = V.join(r.path, a.name), u = await Dr(
|
|
144
|
+
V.join(c, G.PlPackageYamlConfigFile)
|
|
145
145
|
);
|
|
146
|
-
if (
|
|
147
|
-
const l =
|
|
146
|
+
if (u !== void 0) {
|
|
147
|
+
const l = G.PlPackageConfigData.parse(zt.parse(u)), p = await vt(c), f = {
|
|
148
148
|
organization: l.organization,
|
|
149
149
|
name: l.package,
|
|
150
150
|
version: "DEV"
|
|
151
151
|
};
|
|
152
152
|
t.push({
|
|
153
153
|
registryId: e.id,
|
|
154
|
-
id:
|
|
154
|
+
id: f,
|
|
155
155
|
meta: {
|
|
156
156
|
title: l.meta.title ?? "No title",
|
|
157
157
|
description: l.meta.description ?? "No Description",
|
|
@@ -162,13 +162,13 @@ class zs {
|
|
|
162
162
|
},
|
|
163
163
|
spec: {
|
|
164
164
|
type: "dev-v2",
|
|
165
|
-
folder:
|
|
165
|
+
folder: c,
|
|
166
166
|
mtime: p
|
|
167
167
|
},
|
|
168
168
|
otherVersions: []
|
|
169
169
|
});
|
|
170
170
|
} else {
|
|
171
|
-
const l = await lt(
|
|
171
|
+
const l = await lt(c);
|
|
172
172
|
if (l !== void 0) {
|
|
173
173
|
const p = await Ae(l);
|
|
174
174
|
t.push({
|
|
@@ -177,7 +177,7 @@ class zs {
|
|
|
177
177
|
meta: await Ht.parseAsync(l.meta),
|
|
178
178
|
spec: {
|
|
179
179
|
type: "dev-v2",
|
|
180
|
-
folder:
|
|
180
|
+
folder: c,
|
|
181
181
|
mtime: p
|
|
182
182
|
},
|
|
183
183
|
otherVersions: []
|
|
@@ -197,115 +197,127 @@ class zs {
|
|
|
197
197
|
return { registries: t, blockPacks: e };
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
class jr {
|
|
201
|
+
constructor(e) {
|
|
202
|
+
d(this, "registries", /* @__PURE__ */ new Map());
|
|
203
|
+
this.http = e;
|
|
204
|
+
}
|
|
205
|
+
getRegistry(e) {
|
|
206
|
+
const t = this.registries.get(e);
|
|
207
|
+
if (t) return t;
|
|
208
|
+
const r = new Wt(_t(e, this.http));
|
|
209
|
+
return this.registries.set(e, r), r;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const Zs = {
|
|
201
213
|
type: "remote-v2",
|
|
202
|
-
url: "https://blocks.pl-open.science/
|
|
203
|
-
},
|
|
214
|
+
url: "https://blocks.pl-open.science/"
|
|
215
|
+
}, Xs = {
|
|
204
216
|
type: "remote-v1",
|
|
205
217
|
url: "https://block.registry.platforma.bio/releases"
|
|
206
|
-
},
|
|
218
|
+
}, en = {
|
|
207
219
|
type: "remote-v1",
|
|
208
220
|
url: "https://block.registry.platforma.bio/dev"
|
|
209
|
-
},
|
|
221
|
+
}, Er = {
|
|
210
222
|
groups: [{ id: "default", label: "Default", blocks: [] }]
|
|
211
|
-
},
|
|
223
|
+
}, Tr = {
|
|
212
224
|
stagingRefreshTimestamp: 0,
|
|
213
225
|
blocksInLimbo: []
|
|
214
|
-
},
|
|
226
|
+
}, Ar = {
|
|
215
227
|
label: "New Project"
|
|
216
|
-
},
|
|
228
|
+
}, Ir = { name: "UserProject", version: "2" }, yt = "SchemaVersion", bt = "1", Ie = "ProjectCreated", Z = "ProjectLastModified", X = "ProjectMeta", H = "ProjectStructure", ue = "BlockRenderingState", Vr = "BlockFrontendState/", Nr = /^BlockFrontendState\/(?<blockid>.*)$/;
|
|
217
229
|
function ke(o) {
|
|
218
|
-
return `${
|
|
230
|
+
return `${Vr}${o}`;
|
|
219
231
|
}
|
|
220
|
-
const
|
|
232
|
+
const Lr = "BlockArgsAuthor/";
|
|
221
233
|
function Ce(o) {
|
|
222
|
-
return `${
|
|
234
|
+
return `${Lr}${o}`;
|
|
223
235
|
}
|
|
224
236
|
const Pe = "ProjectStructureAuthor";
|
|
225
|
-
function
|
|
226
|
-
const e = o.match(
|
|
237
|
+
function Jr(o) {
|
|
238
|
+
const e = o.match(Nr);
|
|
227
239
|
if (e !== null)
|
|
228
240
|
return e.groups.blockid;
|
|
229
241
|
}
|
|
230
|
-
const
|
|
242
|
+
const Kr = "__serviceTemplate_";
|
|
231
243
|
function Fe(o) {
|
|
232
|
-
return `${
|
|
244
|
+
return `${Kr}${o}`;
|
|
233
245
|
}
|
|
234
246
|
function C(o, e) {
|
|
235
247
|
return `${o}-${e}`;
|
|
236
248
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
239
|
-
const e = o.match(
|
|
249
|
+
const Mr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
|
|
250
|
+
function Ur(o) {
|
|
251
|
+
const e = o.match(Mr);
|
|
240
252
|
if (e === null) return;
|
|
241
253
|
const { blockId: t, fieldName: r } = e.groups;
|
|
242
254
|
return { blockId: t, fieldName: r };
|
|
243
255
|
}
|
|
244
|
-
const
|
|
245
|
-
async function
|
|
256
|
+
const $r = "projects", wt = { name: "Projects", version: "1" }, Gr = (o) => M(o.type, wt) ? o.fields : [];
|
|
257
|
+
async function Hr(o, e, t, r) {
|
|
246
258
|
const s = await ht.init(o, e, {
|
|
247
259
|
...r.ops.defaultTreeOptions,
|
|
248
|
-
pruning:
|
|
260
|
+
pruning: Gr
|
|
249
261
|
});
|
|
250
262
|
return { computable: P.make((i) => {
|
|
251
|
-
const a = i.accessor(s.entry()).node(),
|
|
263
|
+
const a = i.accessor(s.entry()).node(), c = t.getValue(i);
|
|
252
264
|
if (a === void 0) return;
|
|
253
|
-
const
|
|
265
|
+
const u = [];
|
|
254
266
|
for (const l of a.listDynamicFields()) {
|
|
255
267
|
const p = a.traverse(l);
|
|
256
268
|
if (p === void 0) continue;
|
|
257
|
-
const
|
|
258
|
-
|
|
269
|
+
const f = w(p.getKeyValueAsJson(X)), h = w(p.getKeyValueAsJson(Ie)), y = w(p.getKeyValueAsJson(Z));
|
|
270
|
+
u.push({
|
|
259
271
|
id: l,
|
|
260
272
|
rid: p.id,
|
|
261
|
-
created: new Date(
|
|
262
|
-
lastModified: new Date(
|
|
263
|
-
opened:
|
|
264
|
-
meta:
|
|
273
|
+
created: new Date(h),
|
|
274
|
+
lastModified: new Date(y),
|
|
275
|
+
opened: c.indexOf(p.id) >= 0,
|
|
276
|
+
meta: f
|
|
265
277
|
});
|
|
266
278
|
}
|
|
267
|
-
return
|
|
279
|
+
return u.sort((l) => -l.lastModified.valueOf()), u;
|
|
268
280
|
}).withStableType(), tree: s };
|
|
269
281
|
}
|
|
270
|
-
const
|
|
282
|
+
const Wr = {
|
|
271
283
|
name: "EphRenderTemplate",
|
|
272
284
|
version: "1"
|
|
273
|
-
},
|
|
285
|
+
}, _r = {
|
|
274
286
|
name: "RenderTemplate",
|
|
275
287
|
version: "1"
|
|
276
288
|
};
|
|
277
289
|
function St(o, e, t, r, s) {
|
|
278
290
|
if (s.length === 0) throw new Error("Zero output names provided");
|
|
279
|
-
const n = t ? o.createEphemeral(
|
|
280
|
-
return o.createField(i, "Input", e), o.createField(a, "Input",
|
|
291
|
+
const n = t ? o.createEphemeral(Wr) : o.createStruct(_r), i = S(n, "template"), a = S(n, "inputs");
|
|
292
|
+
return o.createField(i, "Input", e), o.createField(a, "Input", b.createPlMap(o, r, t)), o.lockInputs(n), b.futureRecord(o, n, s, "Output", "outputs/");
|
|
281
293
|
}
|
|
282
|
-
const
|
|
294
|
+
const zr = { name: "BContextEnd", version: "1" }, qr = { name: "BContext", version: "1" }, Yr = "id", Qr = "parent/", Zr = ["context", "result"];
|
|
283
295
|
function Qe(o, e, t) {
|
|
284
|
-
return St(o, e, !0, t,
|
|
296
|
+
return St(o, e, !0, t, Zr);
|
|
285
297
|
}
|
|
286
|
-
function
|
|
287
|
-
const e = o.createEphemeral(
|
|
298
|
+
function Xr(o) {
|
|
299
|
+
const e = o.createEphemeral(zr);
|
|
288
300
|
return o.lock(e), e;
|
|
289
301
|
}
|
|
290
|
-
function
|
|
291
|
-
if (e.length === 0) return
|
|
302
|
+
function eo(o, e) {
|
|
303
|
+
if (e.length === 0) return Xr(o);
|
|
292
304
|
if (e.length === 1) return e[0];
|
|
293
|
-
const t = o.createEphemeral(
|
|
294
|
-
o.createField(S(t,
|
|
305
|
+
const t = o.createEphemeral(qr);
|
|
306
|
+
o.createField(S(t, Yr), "Input", b.createPlString(o, Q()));
|
|
295
307
|
for (let r = 0; r < e.length; r++)
|
|
296
|
-
o.createField(S(t, `${
|
|
308
|
+
o.createField(S(t, `${Qr}${r}`), "Input", e[r]);
|
|
297
309
|
return o.lock(t), t;
|
|
298
310
|
}
|
|
299
|
-
const
|
|
311
|
+
const to = { name: "TengoTemplateGet", version: "1" }, ro = "registry", oo = "templateURI", so = "template", no = { name: "TengoTemplatePack", version: "1" }, io = {
|
|
300
312
|
name: "TengoTemplatePackConvert",
|
|
301
313
|
version: "1"
|
|
302
|
-
},
|
|
303
|
-
async function
|
|
314
|
+
}, ao = "templatePack", co = "template";
|
|
315
|
+
async function uo(o) {
|
|
304
316
|
switch (o.type) {
|
|
305
317
|
case "from-file":
|
|
306
318
|
return {
|
|
307
319
|
type: "explicit",
|
|
308
|
-
content: await
|
|
320
|
+
content: await T.promises.readFile(o.path)
|
|
309
321
|
};
|
|
310
322
|
case "from-registry":
|
|
311
323
|
case "explicit":
|
|
@@ -314,20 +326,20 @@ async function io(o) {
|
|
|
314
326
|
return D(o);
|
|
315
327
|
}
|
|
316
328
|
}
|
|
317
|
-
function
|
|
318
|
-
const t = o.createStruct(
|
|
319
|
-
return o.setField(r, o.createValue(
|
|
329
|
+
function lo(o, e) {
|
|
330
|
+
const t = o.createStruct(to), r = S(t, ro), s = S(t, oo), n = S(t, so);
|
|
331
|
+
return o.setField(r, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.registry)))), o.setField(s, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.path)))), n;
|
|
320
332
|
}
|
|
321
|
-
function
|
|
322
|
-
const t = o.createValue(
|
|
333
|
+
function po(o, e) {
|
|
334
|
+
const t = o.createValue(no, e.content), r = o.createStruct(io), s = S(r, ao), n = S(r, co);
|
|
323
335
|
return o.setField(s, t), n;
|
|
324
336
|
}
|
|
325
337
|
function Ve(o, e) {
|
|
326
338
|
switch (e.type) {
|
|
327
339
|
case "from-registry":
|
|
328
|
-
return
|
|
340
|
+
return lo(o, e);
|
|
329
341
|
case "explicit":
|
|
330
|
-
return
|
|
342
|
+
return po(o, e);
|
|
331
343
|
default:
|
|
332
344
|
return D(e);
|
|
333
345
|
}
|
|
@@ -336,7 +348,7 @@ const kt = { name: "Frontend/FromUrl", version: "1" }, Ct = {
|
|
|
336
348
|
name: "Frontend/FromFolder",
|
|
337
349
|
version: "1"
|
|
338
350
|
};
|
|
339
|
-
function
|
|
351
|
+
function ho(o, e) {
|
|
340
352
|
switch (e.type) {
|
|
341
353
|
case "url":
|
|
342
354
|
return o.createValue(
|
|
@@ -355,34 +367,36 @@ function uo(o, e) {
|
|
|
355
367
|
return D(e);
|
|
356
368
|
}
|
|
357
369
|
}
|
|
358
|
-
const
|
|
370
|
+
const fo = { name: "BlockPackCustom", version: "1" }, Pt = "template", Ft = "frontend";
|
|
359
371
|
function Ze(o) {
|
|
360
372
|
return o.endsWith("/") ? o : `${o}/`;
|
|
361
373
|
}
|
|
362
|
-
class
|
|
363
|
-
constructor(e, t) {
|
|
364
|
-
this.
|
|
374
|
+
class go {
|
|
375
|
+
constructor(e, t, r) {
|
|
376
|
+
this.v2RegistryProvider = e, this.signer = t, this.http = r;
|
|
365
377
|
}
|
|
366
378
|
async getBlockConfig(e) {
|
|
367
379
|
switch (e.type) {
|
|
368
380
|
case "explicit":
|
|
369
381
|
return e.config;
|
|
370
382
|
case "dev-v1": {
|
|
371
|
-
const t = await Ye(e.folder), r = await
|
|
383
|
+
const t = await Ye(e.folder), r = await T.promises.readFile(t.config, { encoding: "utf-8" });
|
|
372
384
|
return JSON.parse(r);
|
|
373
385
|
}
|
|
374
386
|
case "dev-v2": {
|
|
375
|
-
const t = await He(e.folder), r = await
|
|
387
|
+
const t = await He(e.folder), r = await T.promises.readFile(t.components.model.file, {
|
|
376
388
|
encoding: "utf-8"
|
|
377
389
|
});
|
|
378
390
|
return JSON.parse(r);
|
|
379
391
|
}
|
|
380
392
|
case "from-registry-v1": {
|
|
381
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Ze(e.registryUrl)}${
|
|
382
|
-
return await (await
|
|
393
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Ze(e.registryUrl)}${G.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
|
|
394
|
+
return await (await $(`${r}/config.json`, t)).body.json();
|
|
395
|
+
}
|
|
396
|
+
case "from-registry-v2": {
|
|
397
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
|
|
398
|
+
return await (await $(s.model.url, t)).body.json();
|
|
383
399
|
}
|
|
384
|
-
case "from-registry-v2":
|
|
385
|
-
throw new Error("NOT YET SUPPORTED!");
|
|
386
400
|
default:
|
|
387
401
|
return D(e);
|
|
388
402
|
}
|
|
@@ -392,8 +406,8 @@ class po {
|
|
|
392
406
|
case "explicit":
|
|
393
407
|
return e;
|
|
394
408
|
case "dev-v1": {
|
|
395
|
-
const t = await Ye(e.folder), r = await
|
|
396
|
-
await
|
|
409
|
+
const t = await Ye(e.folder), r = await T.promises.readFile(t.workflow), s = JSON.parse(
|
|
410
|
+
await T.promises.readFile(t.config, "utf-8")
|
|
397
411
|
), n = t.ui;
|
|
398
412
|
return {
|
|
399
413
|
type: "explicit",
|
|
@@ -412,10 +426,10 @@ class po {
|
|
|
412
426
|
}
|
|
413
427
|
case "dev-v2": {
|
|
414
428
|
const t = await He(e.folder), r = JSON.parse(
|
|
415
|
-
await
|
|
429
|
+
await T.promises.readFile(t.components.model.file, {
|
|
416
430
|
encoding: "utf-8"
|
|
417
431
|
})
|
|
418
|
-
), s = await
|
|
432
|
+
), s = await T.promises.readFile(
|
|
419
433
|
t.components.workflow.main.file
|
|
420
434
|
), n = t.components.ui.folder, i = { ...e };
|
|
421
435
|
return e.mtime === void 0 && (i.mtime = await Ae(t)), {
|
|
@@ -434,19 +448,19 @@ class po {
|
|
|
434
448
|
};
|
|
435
449
|
}
|
|
436
450
|
case "from-registry-v1": {
|
|
437
|
-
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Ze(e.registryUrl)}${
|
|
451
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Ze(e.registryUrl)}${G.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, n = await $(s, t);
|
|
438
452
|
if (n.statusCode !== 200)
|
|
439
453
|
throw new Error(
|
|
440
454
|
`Block not found in registry (url = ${s} ; code = ${n.statusCode}): ` + JSON.stringify(e)
|
|
441
455
|
);
|
|
442
|
-
const i = new Uint8Array(await n.body.arrayBuffer()),
|
|
456
|
+
const i = new Uint8Array(await n.body.arrayBuffer()), c = await (await $(`${r}/config.json`, t)).body.json();
|
|
443
457
|
return {
|
|
444
458
|
type: "explicit",
|
|
445
459
|
template: {
|
|
446
460
|
type: "explicit",
|
|
447
461
|
content: i
|
|
448
462
|
},
|
|
449
|
-
config:
|
|
463
|
+
config: c,
|
|
450
464
|
frontend: {
|
|
451
465
|
type: "url",
|
|
452
466
|
url: `${r}/frontend.tgz`
|
|
@@ -454,29 +468,43 @@ class po {
|
|
|
454
468
|
source: e
|
|
455
469
|
};
|
|
456
470
|
}
|
|
457
|
-
case "from-registry-v2":
|
|
458
|
-
|
|
471
|
+
case "from-registry-v2": {
|
|
472
|
+
const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await $(s.model.url, t)).body.json(), i = async () => await (await $(s.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([n(), i()]);
|
|
473
|
+
return {
|
|
474
|
+
type: "explicit",
|
|
475
|
+
template: {
|
|
476
|
+
type: "explicit",
|
|
477
|
+
content: Buffer.from(c)
|
|
478
|
+
},
|
|
479
|
+
config: a,
|
|
480
|
+
frontend: {
|
|
481
|
+
type: "url",
|
|
482
|
+
url: s.ui.url
|
|
483
|
+
},
|
|
484
|
+
source: e
|
|
485
|
+
};
|
|
486
|
+
}
|
|
459
487
|
default:
|
|
460
488
|
return D(e);
|
|
461
489
|
}
|
|
462
490
|
}
|
|
463
491
|
}
|
|
464
|
-
function
|
|
465
|
-
const t = { config: e.config, source: e.source }, r = o.createStruct(
|
|
466
|
-
return o.createField(S(r, Pt), "Input", Ve(o, e.template)), o.createField(S(r, Ft), "Input",
|
|
492
|
+
function mo(o, e) {
|
|
493
|
+
const t = { config: e.config, source: e.source }, r = o.createStruct(fo, JSON.stringify(t));
|
|
494
|
+
return o.createField(S(r, Pt), "Input", Ve(o, e.template)), o.createField(S(r, Ft), "Input", ho(o, e.frontend)), o.lock(r), r;
|
|
467
495
|
}
|
|
468
496
|
function Xe(o, e) {
|
|
469
497
|
switch (e.type) {
|
|
470
498
|
case "explicit":
|
|
471
|
-
return
|
|
499
|
+
return mo(o, e);
|
|
472
500
|
default:
|
|
473
501
|
return D(e.type);
|
|
474
502
|
}
|
|
475
503
|
}
|
|
476
|
-
function
|
|
504
|
+
function ne(o, e) {
|
|
477
505
|
return { __isRef: !0, blockId: o, name: e };
|
|
478
506
|
}
|
|
479
|
-
function
|
|
507
|
+
function vo(o) {
|
|
480
508
|
return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
|
|
481
509
|
}
|
|
482
510
|
function Be(o, e, t) {
|
|
@@ -492,7 +520,7 @@ function Be(o, e, t) {
|
|
|
492
520
|
return;
|
|
493
521
|
case "object":
|
|
494
522
|
if (e === null) return;
|
|
495
|
-
if (
|
|
523
|
+
if (vo(e))
|
|
496
524
|
t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
|
|
497
525
|
else if (Array.isArray(e))
|
|
498
526
|
for (const s of e) Be(o, s, t);
|
|
@@ -504,11 +532,11 @@ function Be(o, e, t) {
|
|
|
504
532
|
D(r);
|
|
505
533
|
}
|
|
506
534
|
}
|
|
507
|
-
function
|
|
535
|
+
function yo(o, e) {
|
|
508
536
|
const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
|
|
509
537
|
return Be(t, o, e), t;
|
|
510
538
|
}
|
|
511
|
-
function
|
|
539
|
+
function N(o) {
|
|
512
540
|
return {
|
|
513
541
|
*[Symbol.iterator]() {
|
|
514
542
|
for (const e of o.groups) for (const t of e.blocks) yield t;
|
|
@@ -536,9 +564,9 @@ class Bt {
|
|
|
536
564
|
for (; s.length > 0; ) {
|
|
537
565
|
let i = [];
|
|
538
566
|
for (const a of s) {
|
|
539
|
-
const
|
|
540
|
-
r(
|
|
541
|
-
n.has(
|
|
567
|
+
const c = this.nodes.get(a);
|
|
568
|
+
r(c), c[e].forEach((u) => {
|
|
569
|
+
n.has(u) || (n.add(u), i.push(u));
|
|
542
570
|
});
|
|
543
571
|
}
|
|
544
572
|
s = i;
|
|
@@ -548,7 +576,7 @@ class Bt {
|
|
|
548
576
|
function Re(o) {
|
|
549
577
|
const e = /* @__PURE__ */ new Map();
|
|
550
578
|
let t;
|
|
551
|
-
for (const { id: r } of
|
|
579
|
+
for (const { id: r } of N(o)) {
|
|
552
580
|
const s = {
|
|
553
581
|
id: r,
|
|
554
582
|
missingReferences: !1
|
|
@@ -559,21 +587,21 @@ function Re(o) {
|
|
|
559
587
|
}
|
|
560
588
|
function ie(o, e) {
|
|
561
589
|
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
562
|
-
for (const { id: s } of
|
|
590
|
+
for (const { id: s } of N(o)) {
|
|
563
591
|
const n = e(s);
|
|
564
592
|
if (n === void 0) continue;
|
|
565
|
-
const i =
|
|
593
|
+
const i = yo(n, r), a = {
|
|
566
594
|
id: s,
|
|
567
595
|
missingReferences: i.missingReferences,
|
|
568
596
|
upstream: i.upstreams,
|
|
569
597
|
downstream: /* @__PURE__ */ new Set()
|
|
570
598
|
// will be populated from downstream blocks
|
|
571
599
|
};
|
|
572
|
-
t.set(s, a), i.upstreams.forEach((
|
|
600
|
+
t.set(s, a), i.upstreams.forEach((c) => t.get(c).downstream.add(s)), r.add(s);
|
|
573
601
|
}
|
|
574
602
|
return new Bt(t);
|
|
575
603
|
}
|
|
576
|
-
function
|
|
604
|
+
function bo(o, e) {
|
|
577
605
|
if (o.size !== e.size) return !1;
|
|
578
606
|
for (const t of o) if (!e.has(t)) return !1;
|
|
579
607
|
return !0;
|
|
@@ -587,7 +615,7 @@ function et(o, e) {
|
|
|
587
615
|
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
588
616
|
return o.nodes.forEach((n) => {
|
|
589
617
|
const i = e.nodes.get(n.id);
|
|
590
|
-
i === void 0 ? t.add(n.id) : (!
|
|
618
|
+
i === void 0 ? t.add(n.id) : (!bo(n.upstream, i.upstream) || Oe(n.upstream, s)) && s.add(n.id);
|
|
591
619
|
}), e.nodes.forEach((n) => {
|
|
592
620
|
o.nodes.has(n.id) ? Oe(n.upstream, s) && s.add(n.id) : r.add(n.id);
|
|
593
621
|
}), { onlyInA: t, onlyInB: r, different: s };
|
|
@@ -595,14 +623,14 @@ function et(o, e) {
|
|
|
595
623
|
let ve;
|
|
596
624
|
async function Rt() {
|
|
597
625
|
if (ve === void 0) {
|
|
598
|
-
const o = await
|
|
626
|
+
const o = await uo(cr["pframes.export-pframe"]);
|
|
599
627
|
if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
|
|
600
628
|
const e = he("sha256").update(o.content).digest("hex");
|
|
601
629
|
ve = { spec: o, hash: e };
|
|
602
630
|
}
|
|
603
631
|
return ve;
|
|
604
632
|
}
|
|
605
|
-
function
|
|
633
|
+
function wo(o, e, t) {
|
|
606
634
|
return St(o, e, !0, { pf: t }, ["result"]).result;
|
|
607
635
|
}
|
|
608
636
|
function ye(o, e) {
|
|
@@ -673,17 +701,17 @@ class tt {
|
|
|
673
701
|
}
|
|
674
702
|
getTemplate(e) {
|
|
675
703
|
return e.getFutureFieldValue(
|
|
676
|
-
|
|
704
|
+
b.unwrapHolder(e, this.fields.blockPack.ref),
|
|
677
705
|
Pt,
|
|
678
706
|
"Input"
|
|
679
707
|
);
|
|
680
708
|
}
|
|
681
709
|
}
|
|
682
|
-
const
|
|
710
|
+
const So = (o) => {
|
|
683
711
|
throw new Error(`No new block info for ${o}`);
|
|
684
712
|
};
|
|
685
713
|
class le {
|
|
686
|
-
constructor(e, t, r, s, n, i, a,
|
|
714
|
+
constructor(e, t, r, s, n, i, a, c, u, l, p, f) {
|
|
687
715
|
d(this, "globalModCount", 0);
|
|
688
716
|
d(this, "fieldsChanged", !1);
|
|
689
717
|
//
|
|
@@ -702,7 +730,7 @@ class le {
|
|
|
702
730
|
d(this, "stagingGraph");
|
|
703
731
|
d(this, "pendingProductionGraph");
|
|
704
732
|
d(this, "actualProductionGraph");
|
|
705
|
-
this.rid = e, this.tx = t, this.author = r, this.schema = s, this.lastModified = n, this.meta = i, this.struct = a, this.renderingState =
|
|
733
|
+
this.rid = e, this.tx = t, this.author = r, this.schema = s, this.lastModified = n, this.meta = i, this.struct = a, this.renderingState = c, this.blocksInLimbo = u, this.blockInfos = l, this.blockFrontendStates = p, this.ctxExportTplHolder = f;
|
|
706
734
|
}
|
|
707
735
|
fixProblems() {
|
|
708
736
|
this.blockInfos.forEach((e) => {
|
|
@@ -737,7 +765,7 @@ class le {
|
|
|
737
765
|
return w(this.blockInfos.get(e));
|
|
738
766
|
}
|
|
739
767
|
getBlock(e) {
|
|
740
|
-
for (const t of
|
|
768
|
+
for (const t of N(this.struct)) if (t.id === e) return t;
|
|
741
769
|
throw new Error("block not found");
|
|
742
770
|
}
|
|
743
771
|
setBlockFieldObj(e, t, r) {
|
|
@@ -794,7 +822,7 @@ class le {
|
|
|
794
822
|
JSON.parse(s);
|
|
795
823
|
const i = Buffer.from(s);
|
|
796
824
|
if (Buffer.compare(n.fields.currentArgs.value, i) === 0) continue;
|
|
797
|
-
const a = this.tx.createValue(
|
|
825
|
+
const a = this.tx.createValue(b.JsonObject, i);
|
|
798
826
|
this.setBlockField(r, "currentArgs", a, "Ready", i), this.blocksWithChangedInputs.add(r), t.push(r);
|
|
799
827
|
}
|
|
800
828
|
this.getStagingGraph().traverse("downstream", t, ({ id: r }) => this.resetStaging(r)), t.length > 0 && this.updateLastModified();
|
|
@@ -807,7 +835,7 @@ class le {
|
|
|
807
835
|
setBlockLabel(e, t) {
|
|
808
836
|
const r = this.structure;
|
|
809
837
|
let s = !1;
|
|
810
|
-
for (const n of
|
|
838
|
+
for (const n of N(r))
|
|
811
839
|
if (n.id === e) {
|
|
812
840
|
n.label = t, s = !0;
|
|
813
841
|
break;
|
|
@@ -821,11 +849,11 @@ class le {
|
|
|
821
849
|
const n = this.getBlockInfo(s);
|
|
822
850
|
if (n.fields[t] === void 0 || n.fields[t].ref === void 0)
|
|
823
851
|
throw new Error("One of the upstreams staging is not rendered.");
|
|
824
|
-
r.push(
|
|
825
|
-
}),
|
|
852
|
+
r.push(b.unwrapHolder(this.tx, n.fields[t].ref));
|
|
853
|
+
}), eo(this.tx, r);
|
|
826
854
|
}
|
|
827
855
|
exportCtx(e) {
|
|
828
|
-
return
|
|
856
|
+
return wo(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
|
|
829
857
|
}
|
|
830
858
|
renderStagingFor(e) {
|
|
831
859
|
this.resetStaging(e);
|
|
@@ -833,14 +861,14 @@ class le {
|
|
|
833
861
|
if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
|
|
834
862
|
const s = t.getTemplate(this.tx), n = Qe(this.tx, s, {
|
|
835
863
|
args: t.fields.currentArgs.ref,
|
|
836
|
-
blockId: this.tx.createValue(
|
|
837
|
-
isProduction: this.tx.createValue(
|
|
864
|
+
blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
|
|
865
|
+
isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
|
|
838
866
|
context: r
|
|
839
867
|
});
|
|
840
868
|
this.setBlockField(
|
|
841
869
|
e,
|
|
842
870
|
"stagingCtx",
|
|
843
|
-
|
|
871
|
+
b.wrapInEphHolder(this.tx, n.context),
|
|
844
872
|
"NotReady"
|
|
845
873
|
), this.setBlockField(e, "stagingUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "stagingOutput", n.result, "NotReady");
|
|
846
874
|
}
|
|
@@ -854,14 +882,14 @@ class le {
|
|
|
854
882
|
throw new Error("Can't render production for light block.");
|
|
855
883
|
const s = t.getTemplate(this.tx), n = Qe(this.tx, s, {
|
|
856
884
|
args: t.fields.currentArgs.ref,
|
|
857
|
-
blockId: this.tx.createValue(
|
|
858
|
-
isProduction: this.tx.createValue(
|
|
885
|
+
blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
|
|
886
|
+
isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
|
|
859
887
|
context: r
|
|
860
888
|
});
|
|
861
889
|
this.setBlockField(
|
|
862
890
|
e,
|
|
863
891
|
"prodCtx",
|
|
864
|
-
|
|
892
|
+
b.wrapInEphHolder(this.tx, n.context),
|
|
865
893
|
"NotReady"
|
|
866
894
|
), this.setBlockField(e, "prodUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "prodOutput", n.result, "NotReady"), this.setBlockFieldObj(e, "prodArgs", t.fields.currentArgs), this.blocksInLimbo.delete(e) && (this.renderingStateChanged = !0);
|
|
867
895
|
}
|
|
@@ -869,29 +897,29 @@ class le {
|
|
|
869
897
|
// Structure changes
|
|
870
898
|
//
|
|
871
899
|
/** Very generic method, better check for more specialized case-specific methods first. */
|
|
872
|
-
updateStructure(e, t =
|
|
900
|
+
updateStructure(e, t = So) {
|
|
873
901
|
const r = this.getStagingGraph(), s = this.getActualProductionGraph(), n = Re(e), i = ie(
|
|
874
902
|
e,
|
|
875
|
-
(
|
|
903
|
+
(u) => {
|
|
876
904
|
var l;
|
|
877
|
-
return (l = this.blockInfos.get(
|
|
905
|
+
return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
|
|
878
906
|
}
|
|
879
|
-
), a = et(r, n),
|
|
880
|
-
for (const
|
|
881
|
-
const { fields: l } = this.getBlockInfo(
|
|
882
|
-
this.deleteBlockFields(
|
|
907
|
+
), a = et(r, n), c = et(s, i);
|
|
908
|
+
for (const u of a.onlyInA) {
|
|
909
|
+
const { fields: l } = this.getBlockInfo(u);
|
|
910
|
+
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);
|
|
883
911
|
}
|
|
884
|
-
for (const
|
|
885
|
-
const l = new tt(
|
|
886
|
-
this.blockInfos.set(
|
|
887
|
-
const p = t(
|
|
888
|
-
this.setBlockField(
|
|
889
|
-
const
|
|
890
|
-
this.setBlockField(
|
|
912
|
+
for (const u of a.onlyInB) {
|
|
913
|
+
const l = new tt(u, {});
|
|
914
|
+
this.blockInfos.set(u, l);
|
|
915
|
+
const p = t(u), f = Xe(this.tx, p.blockPack);
|
|
916
|
+
this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, f), "NotReady");
|
|
917
|
+
const h = Buffer.from(p.args), y = this.tx.createValue(b.JsonObject, h);
|
|
918
|
+
this.setBlockField(u, "currentArgs", y, "Ready", h), l.check();
|
|
891
919
|
}
|
|
892
|
-
for (const
|
|
893
|
-
s.traverse("downstream", [...
|
|
894
|
-
this.resetOrLimboProduction(
|
|
920
|
+
for (const u of a.different) this.resetStaging(u);
|
|
921
|
+
s.traverse("downstream", [...c.different], (u) => {
|
|
922
|
+
this.resetOrLimboProduction(u.id);
|
|
895
923
|
}), (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();
|
|
896
924
|
}
|
|
897
925
|
//
|
|
@@ -904,7 +932,7 @@ class le {
|
|
|
904
932
|
else {
|
|
905
933
|
let n = !1;
|
|
906
934
|
for (const i of s.groups) {
|
|
907
|
-
const a = i.blocks.findIndex((
|
|
935
|
+
const a = i.blocks.findIndex((c) => c.id === r);
|
|
908
936
|
if (!(a < 0)) {
|
|
909
937
|
i.blocks.splice(a, 0, e), n = !0;
|
|
910
938
|
break;
|
|
@@ -938,7 +966,7 @@ class le {
|
|
|
938
966
|
this.setBlockField(
|
|
939
967
|
e,
|
|
940
968
|
"blockPack",
|
|
941
|
-
|
|
969
|
+
b.wrapInHolder(this.tx, Xe(this.tx, t)),
|
|
942
970
|
"NotReady"
|
|
943
971
|
), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: n }) => this.resetStaging(n)), s.productionRendered && this.getActualProductionGraph().traverse(
|
|
944
972
|
"downstream",
|
|
@@ -959,17 +987,17 @@ class le {
|
|
|
959
987
|
for (const i of r) {
|
|
960
988
|
const a = s.nodes.get(i);
|
|
961
989
|
if (a === void 0) throw new Error(`Can't find block with id: ${i}`);
|
|
962
|
-
for (const
|
|
963
|
-
if (!r.has(
|
|
990
|
+
for (const c of a.upstream)
|
|
991
|
+
if (!r.has(c))
|
|
964
992
|
throw new Error("Can't render blocks not including all upstreams.");
|
|
965
993
|
}
|
|
966
994
|
const n = /* @__PURE__ */ new Set();
|
|
967
|
-
for (const i of
|
|
995
|
+
for (const i of N(this.structure)) {
|
|
968
996
|
if (!r.has(i.id)) continue;
|
|
969
997
|
let a = this.getBlockInfo(i.id).requireProductionRendering || this.blocksInLimbo.has(i.id);
|
|
970
998
|
if (!a) {
|
|
971
|
-
for (const
|
|
972
|
-
if (n.has(
|
|
999
|
+
for (const c of s.nodes.get(i.id).upstream)
|
|
1000
|
+
if (n.has(c)) {
|
|
973
1001
|
a = !0;
|
|
974
1002
|
break;
|
|
975
1003
|
}
|
|
@@ -986,23 +1014,23 @@ class le {
|
|
|
986
1014
|
var i, a;
|
|
987
1015
|
const t = this.getActualProductionGraph(), r = new ft(e), s = new Set(e), n = [];
|
|
988
1016
|
for (; !r.isEmpty(); ) {
|
|
989
|
-
const
|
|
990
|
-
if (!(((i =
|
|
991
|
-
n.push(
|
|
992
|
-
for (const l of t.traverseIdsExcludingRoots("downstream",
|
|
1017
|
+
const c = r.shift(), u = this.getBlockInfo(c).fields;
|
|
1018
|
+
if (!(((i = u.prodOutput) == null ? void 0 : i.status) === "Ready" && ((a = u.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
|
|
1019
|
+
n.push(c);
|
|
1020
|
+
for (const l of t.traverseIdsExcludingRoots("downstream", c))
|
|
993
1021
|
s.has(l) || (r.push(l), s.add(l));
|
|
994
1022
|
}
|
|
995
1023
|
}
|
|
996
|
-
for (const
|
|
997
|
-
this.resetOrLimboProduction(
|
|
1024
|
+
for (const c of t.traverseIdsExcludingRoots("downstream", ...n))
|
|
1025
|
+
this.resetOrLimboProduction(c);
|
|
998
1026
|
}
|
|
999
1027
|
traverseWithStagingLag(e) {
|
|
1000
1028
|
const t = /* @__PURE__ */ new Map();
|
|
1001
1029
|
this.getStagingGraph().nodes.forEach((s) => {
|
|
1002
1030
|
let i = this.getBlockInfo(s.id).stagingRendered ? 0 : 1;
|
|
1003
1031
|
s.upstream.forEach((a) => {
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1032
|
+
const c = t.get(a);
|
|
1033
|
+
c !== 0 && (i = Math.max(c + 1, i));
|
|
1006
1034
|
}), e(s.id, i), t.set(s.id, i);
|
|
1007
1035
|
});
|
|
1008
1036
|
}
|
|
@@ -1049,14 +1077,14 @@ class le {
|
|
|
1049
1077
|
}
|
|
1050
1078
|
save() {
|
|
1051
1079
|
if (this.wasModified) {
|
|
1052
|
-
this.lastModifiedChanged && this.tx.setKValue(this.rid,
|
|
1080
|
+
this.lastModifiedChanged && this.tx.setKValue(this.rid, Z, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, H, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
|
|
1053
1081
|
this.rid,
|
|
1054
1082
|
ue,
|
|
1055
1083
|
JSON.stringify({
|
|
1056
1084
|
...this.renderingState,
|
|
1057
1085
|
blocksInLimbo: [...this.blocksInLimbo]
|
|
1058
1086
|
})
|
|
1059
|
-
), this.metaChanged && this.tx.setKValue(this.rid,
|
|
1087
|
+
), this.metaChanged && this.tx.setKValue(this.rid, X, JSON.stringify(this.meta));
|
|
1060
1088
|
for (const e of this.changedBlockFrontendStates) {
|
|
1061
1089
|
const t = this.blockFrontendStates.get(e);
|
|
1062
1090
|
t === void 0 ? this.tx.deleteKValue(this.rid, ke(e)) : this.tx.setKValue(this.rid, ke(e), t);
|
|
@@ -1065,111 +1093,111 @@ class le {
|
|
|
1065
1093
|
}
|
|
1066
1094
|
}
|
|
1067
1095
|
static async load(e, t, r) {
|
|
1068
|
-
const s = e.getResourceData(t, !0), n = e.getKValueJson(t, yt), i = e.getKValueJson(t,
|
|
1096
|
+
const s = e.getResourceData(t, !0), n = e.getKValueJson(t, yt), i = e.getKValueJson(t, Z), a = e.getKValueJson(t, X), c = e.getKValueJson(t, H), u = e.getKValueJson(t, ue), l = e.listKeyValuesString(t), [
|
|
1069
1097
|
p,
|
|
1098
|
+
f,
|
|
1070
1099
|
h,
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
te
|
|
1100
|
+
y,
|
|
1101
|
+
O,
|
|
1102
|
+
{ stagingRefreshTimestamp: A, blocksInLimbo: te },
|
|
1103
|
+
re
|
|
1076
1104
|
] = await Promise.all([
|
|
1077
1105
|
s,
|
|
1078
1106
|
n,
|
|
1079
1107
|
i,
|
|
1080
1108
|
a,
|
|
1081
|
-
u,
|
|
1082
1109
|
c,
|
|
1110
|
+
u,
|
|
1083
1111
|
l
|
|
1084
1112
|
]);
|
|
1085
|
-
if (
|
|
1113
|
+
if (f !== bt)
|
|
1086
1114
|
throw new Error(
|
|
1087
|
-
`Can't act on this project resource because it has a wrong schema version: ${
|
|
1115
|
+
`Can't act on this project resource because it has a wrong schema version: ${f}`
|
|
1088
1116
|
);
|
|
1089
|
-
const
|
|
1117
|
+
const U = /* @__PURE__ */ new Map();
|
|
1090
1118
|
for (const v of p.fields) {
|
|
1091
|
-
const
|
|
1092
|
-
if (
|
|
1093
|
-
let F =
|
|
1119
|
+
const R = Ur(v.name);
|
|
1120
|
+
if (R === void 0) continue;
|
|
1121
|
+
let F = U.get(R.blockId);
|
|
1094
1122
|
F === void 0 && (F = {
|
|
1095
|
-
id:
|
|
1123
|
+
id: R.blockId,
|
|
1096
1124
|
fields: {}
|
|
1097
|
-
},
|
|
1125
|
+
}, U.set(R.blockId, F)), F.fields[R.fieldName] = ce(v.value) ? { modCount: 0 } : { modCount: 0, ref: v.value };
|
|
1098
1126
|
}
|
|
1099
|
-
const
|
|
1100
|
-
(v) => v.name ===
|
|
1127
|
+
const W = await Rt(), oe = Fe(W.hash), k = p.fields.find(
|
|
1128
|
+
(v) => v.name === oe
|
|
1101
1129
|
);
|
|
1102
|
-
let
|
|
1103
|
-
k !== void 0 ?
|
|
1104
|
-
S(t, Fe(
|
|
1130
|
+
let J;
|
|
1131
|
+
k !== void 0 ? J = we(k.value) : (J = b.wrapInHolder(e, Ve(e, W.spec)), e.createField(
|
|
1132
|
+
S(t, Fe(W.hash)),
|
|
1105
1133
|
"Dynamic",
|
|
1106
|
-
|
|
1134
|
+
J
|
|
1107
1135
|
));
|
|
1108
|
-
const _ = { stagingRefreshTimestamp:
|
|
1109
|
-
for (const v of
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1136
|
+
const _ = { stagingRefreshTimestamp: A }, E = new Set(te), x = /* @__PURE__ */ new Map();
|
|
1137
|
+
for (const v of re) {
|
|
1138
|
+
const R = Jr(v.key);
|
|
1139
|
+
R !== void 0 && x.set(R, v.value);
|
|
1112
1140
|
}
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
for (const [, F] of Object.entries(
|
|
1141
|
+
const B = [];
|
|
1142
|
+
U.forEach(({ id: v, fields: R }) => {
|
|
1143
|
+
for (const [, F] of Object.entries(R))
|
|
1116
1144
|
if (F.ref !== void 0) {
|
|
1117
|
-
if (!
|
|
1145
|
+
if (!Xt(F.ref) || er(F.ref))
|
|
1118
1146
|
throw new Error("unexpected behaviour");
|
|
1119
|
-
|
|
1147
|
+
B.push([F, e.getResourceData(F.ref, !1)]);
|
|
1120
1148
|
}
|
|
1121
1149
|
});
|
|
1122
|
-
for (const [v,
|
|
1123
|
-
const F = await
|
|
1124
|
-
v.value = F.data,
|
|
1150
|
+
for (const [v, R] of B) {
|
|
1151
|
+
const F = await R;
|
|
1152
|
+
v.value = F.data, We(F.error) ? v.status = "Error" : F.resourceReady || We(F.originalResourceId) ? v.status = "Ready" : v.status = "NotReady";
|
|
1125
1153
|
}
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
const
|
|
1129
|
-
for (const v of
|
|
1130
|
-
if (!
|
|
1154
|
+
const K = /* @__PURE__ */ new Map();
|
|
1155
|
+
U.forEach(({ id: v, fields: R }) => K.set(v, new tt(v, R)));
|
|
1156
|
+
const L = /* @__PURE__ */ new Set();
|
|
1157
|
+
for (const v of N(O)) {
|
|
1158
|
+
if (!K.has(v.id))
|
|
1131
1159
|
throw new Error(`Inconsistent project structure: no inputs for ${v.id}`);
|
|
1132
|
-
|
|
1160
|
+
L.add(v.id);
|
|
1133
1161
|
}
|
|
1134
|
-
|
|
1135
|
-
if (!
|
|
1162
|
+
K.forEach((v) => {
|
|
1163
|
+
if (!L.has(v.id))
|
|
1136
1164
|
throw new Error(`Inconsistent project structure: no structure entry for ${v.id}`);
|
|
1137
1165
|
v.check();
|
|
1138
1166
|
});
|
|
1139
|
-
const
|
|
1167
|
+
const se = new le(
|
|
1140
1168
|
t,
|
|
1141
1169
|
e,
|
|
1142
1170
|
r,
|
|
1171
|
+
f,
|
|
1143
1172
|
h,
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
B,
|
|
1173
|
+
y,
|
|
1174
|
+
O,
|
|
1147
1175
|
_,
|
|
1148
|
-
|
|
1149
|
-
|
|
1176
|
+
E,
|
|
1177
|
+
K,
|
|
1150
1178
|
x,
|
|
1151
|
-
|
|
1179
|
+
J
|
|
1152
1180
|
);
|
|
1153
|
-
return
|
|
1181
|
+
return se.fixProblems(), se;
|
|
1154
1182
|
}
|
|
1155
1183
|
}
|
|
1156
|
-
async function
|
|
1157
|
-
const t = o.createEphemeral(
|
|
1184
|
+
async function ko(o, e = Ar) {
|
|
1185
|
+
const t = o.createEphemeral(Ir);
|
|
1158
1186
|
o.lock(t);
|
|
1159
1187
|
const r = String(Date.now());
|
|
1160
|
-
o.setKValue(t, yt, JSON.stringify(bt)), o.setKValue(t, Ie, r), o.setKValue(t,
|
|
1188
|
+
o.setKValue(t, yt, JSON.stringify(bt)), o.setKValue(t, Ie, r), o.setKValue(t, Z, r), o.setKValue(t, X, JSON.stringify(e)), o.setKValue(t, H, JSON.stringify(Er)), o.setKValue(t, ue, JSON.stringify(Tr));
|
|
1161
1189
|
const s = await Rt();
|
|
1162
1190
|
return o.createField(
|
|
1163
1191
|
S(t, Fe(s.hash)),
|
|
1164
1192
|
"Dynamic",
|
|
1165
|
-
|
|
1193
|
+
b.wrapInHolder(o, Ve(o, s.spec))
|
|
1166
1194
|
), t;
|
|
1167
1195
|
}
|
|
1168
1196
|
async function be(o, e, t) {
|
|
1169
|
-
return
|
|
1197
|
+
return I(o, e, void 0, t);
|
|
1170
1198
|
}
|
|
1171
|
-
async function
|
|
1172
|
-
if (o instanceof
|
|
1199
|
+
async function I(o, e, t, r) {
|
|
1200
|
+
if (o instanceof Zt)
|
|
1173
1201
|
return await o.withWriteTx("ProjectAction", async (s) => {
|
|
1174
1202
|
const n = await le.load(s, e, t), i = await r(n);
|
|
1175
1203
|
return n.wasModified && (n.save(), await s.commit()), i;
|
|
@@ -1179,7 +1207,7 @@ async function A(o, e, t, r) {
|
|
|
1179
1207
|
return s.save(), n;
|
|
1180
1208
|
}
|
|
1181
1209
|
}
|
|
1182
|
-
function*
|
|
1210
|
+
function* Co(o) {
|
|
1183
1211
|
switch (o.type) {
|
|
1184
1212
|
case "Json":
|
|
1185
1213
|
return;
|
|
@@ -1199,7 +1227,7 @@ function rt(o, e) {
|
|
|
1199
1227
|
Object.entries(o).map(([t, r]) => [t, e(r, t)])
|
|
1200
1228
|
);
|
|
1201
1229
|
}
|
|
1202
|
-
function
|
|
1230
|
+
function Po(o, e) {
|
|
1203
1231
|
switch (o.type) {
|
|
1204
1232
|
case "Json":
|
|
1205
1233
|
return { ...o };
|
|
@@ -1217,26 +1245,26 @@ function So(o, e) {
|
|
|
1217
1245
|
D(o);
|
|
1218
1246
|
}
|
|
1219
1247
|
}
|
|
1220
|
-
const
|
|
1248
|
+
const Fo = ee("PColumnData/JsonPartitioned", "1"), Bo = ee(
|
|
1221
1249
|
"PColumnData/Partitioned/JsonPartitioned",
|
|
1222
1250
|
"1"
|
|
1223
|
-
),
|
|
1251
|
+
), Ro = ee("PColumnData/BinaryPartitioned", "1"), Oo = ee(
|
|
1224
1252
|
"PColumnData/Partitioned/BinaryPartitioned",
|
|
1225
1253
|
"1"
|
|
1226
|
-
),
|
|
1227
|
-
function
|
|
1254
|
+
), Do = ee("PColumnData/Json", "1");
|
|
1255
|
+
function xo(o) {
|
|
1228
1256
|
if (!o.getIsReadyOrError()) throw new Error("Data not ready.");
|
|
1229
1257
|
const e = o.getDataAsJson();
|
|
1230
1258
|
if (e === void 0)
|
|
1231
1259
|
throw new Error("unexpected data info structure, no resource data");
|
|
1232
|
-
if (
|
|
1260
|
+
if (M(o.resourceType, Do)) {
|
|
1233
1261
|
const t = e;
|
|
1234
1262
|
return {
|
|
1235
1263
|
type: "Json",
|
|
1236
1264
|
keyLength: t.keyLength,
|
|
1237
1265
|
data: t.data
|
|
1238
1266
|
};
|
|
1239
|
-
} else if (
|
|
1267
|
+
} else if (M(o.resourceType, Fo)) {
|
|
1240
1268
|
const t = e, r = Object.fromEntries(
|
|
1241
1269
|
o.listInputFields().map((s) => [s, o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo])
|
|
1242
1270
|
);
|
|
@@ -1245,14 +1273,14 @@ function Ro(o) {
|
|
|
1245
1273
|
partitionKeyLength: t.partitionKeyLength,
|
|
1246
1274
|
parts: r
|
|
1247
1275
|
};
|
|
1248
|
-
} else if (
|
|
1276
|
+
} else if (M(o.resourceType, Bo)) {
|
|
1249
1277
|
const t = e, r = {};
|
|
1250
1278
|
for (const s of o.listInputFields()) {
|
|
1251
1279
|
const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
|
|
1252
1280
|
if (i === void 0) throw new Error(`no partition keys for super key ${s}`);
|
|
1253
1281
|
for (const a of i) {
|
|
1254
|
-
const
|
|
1255
|
-
r[
|
|
1282
|
+
const c = s.slice(0, s.length - 1) + "," + a.slice(1, a.length);
|
|
1283
|
+
r[c] = n.traverse({ field: a, errorIfFieldNotSet: !0 }).resourceInfo;
|
|
1256
1284
|
}
|
|
1257
1285
|
}
|
|
1258
1286
|
return {
|
|
@@ -1260,7 +1288,7 @@ function Ro(o) {
|
|
|
1260
1288
|
partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
|
|
1261
1289
|
parts: r
|
|
1262
1290
|
};
|
|
1263
|
-
} else if (
|
|
1291
|
+
} else if (M(o.resourceType, Ro)) {
|
|
1264
1292
|
const t = e, r = {};
|
|
1265
1293
|
for (const s of o.listInputFields())
|
|
1266
1294
|
if (s.endsWith(".index")) {
|
|
@@ -1281,23 +1309,23 @@ function Ro(o) {
|
|
|
1281
1309
|
partitionKeyLength: t.partitionKeyLength,
|
|
1282
1310
|
parts: r
|
|
1283
1311
|
};
|
|
1284
|
-
} else if (
|
|
1312
|
+
} else if (M(o.resourceType, Oo)) {
|
|
1285
1313
|
const t = e, r = {};
|
|
1286
1314
|
for (const s of o.listInputFields()) {
|
|
1287
1315
|
const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
|
|
1288
1316
|
if (i === void 0) throw new Error(`no partition keys for super key ${s}`);
|
|
1289
1317
|
for (const a of i)
|
|
1290
1318
|
if (a.endsWith(".index")) {
|
|
1291
|
-
const
|
|
1292
|
-
let l = r[
|
|
1293
|
-
l === void 0 && (l = {}, r[
|
|
1319
|
+
const c = a.slice(0, a.length - 6), u = s.slice(0, s.length - 1) + "," + c.slice(1, c.length);
|
|
1320
|
+
let l = r[u];
|
|
1321
|
+
l === void 0 && (l = {}, r[u] = l), r[u].index = n.traverse({
|
|
1294
1322
|
field: a,
|
|
1295
1323
|
errorIfFieldNotSet: !0
|
|
1296
1324
|
}).resourceInfo;
|
|
1297
1325
|
} else if (a.endsWith(".values")) {
|
|
1298
|
-
const
|
|
1299
|
-
let l = r[
|
|
1300
|
-
l === void 0 && (l = {}, r[
|
|
1326
|
+
const c = a.slice(0, a.length - 7), u = s.slice(0, s.length - 1) + "," + c.slice(1, c.length);
|
|
1327
|
+
let l = r[u];
|
|
1328
|
+
l === void 0 && (l = {}, r[u] = l), r[u].values = n.traverse({
|
|
1301
1329
|
field: a,
|
|
1302
1330
|
errorIfFieldNotSet: !0
|
|
1303
1331
|
}).resourceInfo;
|
|
@@ -1309,14 +1337,14 @@ function Ro(o) {
|
|
|
1309
1337
|
parts: r
|
|
1310
1338
|
};
|
|
1311
1339
|
}
|
|
1312
|
-
throw new Error(`unsupported resource type: ${
|
|
1340
|
+
throw new Error(`unsupported resource type: ${tr(o.resourceType)}`);
|
|
1313
1341
|
}
|
|
1314
1342
|
function Ot(o, e) {
|
|
1315
1343
|
const t = he("sha256");
|
|
1316
|
-
return t.update(
|
|
1344
|
+
return t.update(je(o)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
|
|
1317
1345
|
}
|
|
1318
1346
|
function Dt(o, e = !0, t = !1, r = "") {
|
|
1319
|
-
var a,
|
|
1347
|
+
var a, c, u;
|
|
1320
1348
|
const s = /^(?<name>.*)\.(?<type>spec|data)$/, n = /* @__PURE__ */ new Map();
|
|
1321
1349
|
for (const l of o.listInputFields()) {
|
|
1322
1350
|
const p = l.match(s);
|
|
@@ -1324,24 +1352,24 @@ function Dt(o, e = !0, t = !1, r = "") {
|
|
|
1324
1352
|
if (e) throw new Error(`unexpected field name ${l}`);
|
|
1325
1353
|
continue;
|
|
1326
1354
|
}
|
|
1327
|
-
let
|
|
1328
|
-
if (!
|
|
1355
|
+
let f = w((a = p.groups) == null ? void 0 : a.name);
|
|
1356
|
+
if (!f.startsWith(r)) {
|
|
1329
1357
|
if (e) throw new Error(`unexpected field name ${l}`);
|
|
1330
1358
|
continue;
|
|
1331
1359
|
}
|
|
1332
|
-
|
|
1333
|
-
const
|
|
1334
|
-
let
|
|
1335
|
-
switch (
|
|
1360
|
+
f = f.slice(r.length);
|
|
1361
|
+
const h = w((c = p.groups) == null ? void 0 : c.type);
|
|
1362
|
+
let y = n.get(f);
|
|
1363
|
+
switch (y === void 0 && (y = {}, n.set(f, y)), h) {
|
|
1336
1364
|
case "spec":
|
|
1337
|
-
|
|
1365
|
+
y.spec = (u = o.traverse({
|
|
1338
1366
|
field: l,
|
|
1339
1367
|
ignoreError: t,
|
|
1340
1368
|
pureFieldErrorToUndefined: t
|
|
1341
|
-
})) == null ? void 0 :
|
|
1369
|
+
})) == null ? void 0 : u.getDataAsJson();
|
|
1342
1370
|
break;
|
|
1343
1371
|
case "data":
|
|
1344
|
-
|
|
1372
|
+
y.hasData = !0, y.data = () => o.traverseOrError({
|
|
1345
1373
|
field: l,
|
|
1346
1374
|
ignoreError: t
|
|
1347
1375
|
});
|
|
@@ -1354,10 +1382,10 @@ function Dt(o, e = !0, t = !1, r = "") {
|
|
|
1354
1382
|
for (const [, l] of n) l.data === void 0 && (l.hasData = !1);
|
|
1355
1383
|
return { locked: i, results: n };
|
|
1356
1384
|
}
|
|
1357
|
-
function
|
|
1385
|
+
function jo(o, e = !0, t = "") {
|
|
1358
1386
|
if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
|
|
1359
1387
|
const r = Dt(o, e, !1, t);
|
|
1360
|
-
|
|
1388
|
+
ur(r.locked);
|
|
1361
1389
|
const s = {};
|
|
1362
1390
|
for (const [n, i] of r.results) {
|
|
1363
1391
|
if (i.spec === void 0) throw new Error(`no spec for key ${n}`);
|
|
@@ -1365,7 +1393,7 @@ function Oo(o, e = !0, t = "") {
|
|
|
1365
1393
|
throw new Error(`no data for key ${n}`);
|
|
1366
1394
|
const a = i.data();
|
|
1367
1395
|
if (a === void 0) throw new Error(`no data for key ${n}`);
|
|
1368
|
-
if (!a.ok) throw new
|
|
1396
|
+
if (!a.ok) throw new nr(a.error);
|
|
1369
1397
|
s[n] = {
|
|
1370
1398
|
id: Ot(i.spec, a.value),
|
|
1371
1399
|
spec: i.spec,
|
|
@@ -1420,30 +1448,30 @@ class Ne {
|
|
|
1420
1448
|
let t = !0, r;
|
|
1421
1449
|
const s = (i) => {
|
|
1422
1450
|
r === void 0 && (r = i), t = !1;
|
|
1423
|
-
}, n = (i, a,
|
|
1424
|
-
if (
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
ref:
|
|
1451
|
+
}, n = (i, a, c) => {
|
|
1452
|
+
if (c.spec !== void 0 && c.hasData === !0 && c.data !== void 0) {
|
|
1453
|
+
const u = c.data();
|
|
1454
|
+
u !== void 0 ? e.push({
|
|
1455
|
+
ref: ne(i, a),
|
|
1428
1456
|
obj: {
|
|
1429
|
-
id:
|
|
1430
|
-
spec:
|
|
1431
|
-
data:
|
|
1457
|
+
id: u.ok ? Ot(c.spec, u.value) : void 0,
|
|
1458
|
+
spec: c.spec,
|
|
1459
|
+
data: u
|
|
1432
1460
|
}
|
|
1433
1461
|
}) : s(`no_data:${i}:${a}`);
|
|
1434
1462
|
}
|
|
1435
1463
|
};
|
|
1436
1464
|
for (const [i, a] of this.blocks) {
|
|
1437
|
-
const
|
|
1465
|
+
const c = /* @__PURE__ */ new Set();
|
|
1438
1466
|
if (a.prod !== void 0) {
|
|
1439
1467
|
a.prod.locked || s(`prod_not_locked:${i}`);
|
|
1440
|
-
for (const [
|
|
1441
|
-
|
|
1468
|
+
for (const [u, l] of a.prod.results)
|
|
1469
|
+
c.add(u), n(i, u, l);
|
|
1442
1470
|
}
|
|
1443
1471
|
if (a.staging !== void 0) {
|
|
1444
1472
|
a.staging.locked || s(`staging_not_locked:${i}`);
|
|
1445
|
-
for (const [
|
|
1446
|
-
|
|
1473
|
+
for (const [u, l] of a.staging.results)
|
|
1474
|
+
c.has(u) || n(i, u, l);
|
|
1447
1475
|
}
|
|
1448
1476
|
}
|
|
1449
1477
|
return { entries: e, isComplete: t, instabilityMarker: r };
|
|
@@ -1458,18 +1486,18 @@ class Ne {
|
|
|
1458
1486
|
const a = /* @__PURE__ */ new Set();
|
|
1459
1487
|
if (i.staging !== void 0) {
|
|
1460
1488
|
i.staging.locked || s(`staging_not_locked:${n}`);
|
|
1461
|
-
for (const [
|
|
1462
|
-
|
|
1463
|
-
ref:
|
|
1464
|
-
obj:
|
|
1465
|
-
}), a.add(
|
|
1489
|
+
for (const [c, u] of i.staging.results)
|
|
1490
|
+
u.spec !== void 0 && (e.push({
|
|
1491
|
+
ref: ne(n, c),
|
|
1492
|
+
obj: u.spec
|
|
1493
|
+
}), a.add(c));
|
|
1466
1494
|
} else s(`staging_not_rendered:${n}`);
|
|
1467
1495
|
if (i.prod !== void 0) {
|
|
1468
1496
|
i.prod.locked || s(`prod_not_locked:${n}`);
|
|
1469
|
-
for (const [
|
|
1470
|
-
a.has(
|
|
1471
|
-
ref:
|
|
1472
|
-
obj:
|
|
1497
|
+
for (const [c, u] of i.prod.results)
|
|
1498
|
+
a.has(c) || u.spec !== void 0 && e.push({
|
|
1499
|
+
ref: ne(n, c),
|
|
1500
|
+
obj: u.spec
|
|
1473
1501
|
});
|
|
1474
1502
|
}
|
|
1475
1503
|
}
|
|
@@ -1479,11 +1507,11 @@ class Ne {
|
|
|
1479
1507
|
const t = [];
|
|
1480
1508
|
for (const r of this.blocks.values()) {
|
|
1481
1509
|
const s = /* @__PURE__ */ new Set(), n = (i) => {
|
|
1482
|
-
for (const [a,
|
|
1483
|
-
s.has(a) ||
|
|
1510
|
+
for (const [a, c] of i.results)
|
|
1511
|
+
s.has(a) || c.spec === void 0 || (s.add(a), Ut(e, c.spec) && t.push({
|
|
1484
1512
|
label: r.info.label + " / " + a,
|
|
1485
|
-
ref:
|
|
1486
|
-
spec:
|
|
1513
|
+
ref: ne(r.info.id, a),
|
|
1514
|
+
spec: c.spec
|
|
1487
1515
|
}));
|
|
1488
1516
|
};
|
|
1489
1517
|
r.staging !== void 0 && n(r.staging), r.prod !== void 0 && n(r.prod);
|
|
@@ -1491,33 +1519,33 @@ class Ne {
|
|
|
1491
1519
|
return t;
|
|
1492
1520
|
}
|
|
1493
1521
|
static create(e, t, r) {
|
|
1494
|
-
const s = e.accessor(t).node(), n = w(s.getKeyValueAsJson(
|
|
1495
|
-
for (const
|
|
1496
|
-
if (!a.has(
|
|
1522
|
+
const s = e.accessor(t).node(), n = w(s.getKeyValueAsJson(H)), a = Re(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
|
|
1523
|
+
for (const u of N(n)) {
|
|
1524
|
+
if (!a.has(u.id)) continue;
|
|
1497
1525
|
const l = ot(
|
|
1498
1526
|
s.traverse({
|
|
1499
|
-
field: C(
|
|
1527
|
+
field: C(u.id, "prodCtx"),
|
|
1500
1528
|
ignoreError: !0,
|
|
1501
1529
|
pureFieldErrorToUndefined: !0,
|
|
1502
1530
|
stableIfNotFound: !0
|
|
1503
1531
|
}) !== void 0,
|
|
1504
1532
|
s.traverseOrError({
|
|
1505
|
-
field: C(
|
|
1533
|
+
field: C(u.id, "prodUiCtx"),
|
|
1506
1534
|
stableIfNotFound: !0
|
|
1507
1535
|
})
|
|
1508
1536
|
), p = ot(
|
|
1509
1537
|
s.traverse({
|
|
1510
|
-
field: C(
|
|
1538
|
+
field: C(u.id, "stagingCtx"),
|
|
1511
1539
|
ignoreError: !0,
|
|
1512
1540
|
pureFieldErrorToUndefined: !0
|
|
1513
1541
|
}) !== void 0,
|
|
1514
1542
|
s.traverseOrError({
|
|
1515
|
-
field: C(
|
|
1543
|
+
field: C(u.id, "stagingUiCtx")
|
|
1516
1544
|
})
|
|
1517
1545
|
);
|
|
1518
|
-
|
|
1546
|
+
c.set(u.id, { info: u, prod: l, staging: p });
|
|
1519
1547
|
}
|
|
1520
|
-
return new Ne(e,
|
|
1548
|
+
return new Ne(e, c);
|
|
1521
1549
|
}
|
|
1522
1550
|
}
|
|
1523
1551
|
function ot(o, e) {
|
|
@@ -1537,9 +1565,9 @@ function Le(o, e) {
|
|
|
1537
1565
|
args: r,
|
|
1538
1566
|
uiState: s,
|
|
1539
1567
|
blockMeta: (n) => {
|
|
1540
|
-
const i = n.accessor(t).node(), a = w(i.getKeyValueAsJson(
|
|
1541
|
-
for (const
|
|
1542
|
-
return
|
|
1568
|
+
const i = n.accessor(t).node(), a = w(i.getKeyValueAsJson(H)), c = /* @__PURE__ */ new Map();
|
|
1569
|
+
for (const u of N(a)) c.set(u.id, u);
|
|
1570
|
+
return c;
|
|
1543
1571
|
}
|
|
1544
1572
|
};
|
|
1545
1573
|
}
|
|
@@ -1566,28 +1594,28 @@ function xt(o, e) {
|
|
|
1566
1594
|
getResultsPool: (r) => Ne.create(r, t, e)
|
|
1567
1595
|
};
|
|
1568
1596
|
}
|
|
1569
|
-
function*
|
|
1597
|
+
function* j(o, e) {
|
|
1570
1598
|
switch (yield o, o.type) {
|
|
1571
1599
|
case "GetFromCtx":
|
|
1572
1600
|
case "Immediate":
|
|
1573
1601
|
return;
|
|
1574
1602
|
case "Isolate":
|
|
1575
|
-
yield*
|
|
1603
|
+
yield* j(o.cfg);
|
|
1576
1604
|
return;
|
|
1577
1605
|
case "MakeObject":
|
|
1578
|
-
for (const [, t] of Object.entries(o.template)) yield*
|
|
1606
|
+
for (const [, t] of Object.entries(o.template)) yield* j(t);
|
|
1579
1607
|
return;
|
|
1580
1608
|
case "MakeArray":
|
|
1581
|
-
for (const t of o.template) yield*
|
|
1609
|
+
for (const t of o.template) yield* j(t);
|
|
1582
1610
|
return;
|
|
1583
1611
|
case "GetJsonField":
|
|
1584
1612
|
case "GetResourceField":
|
|
1585
|
-
yield*
|
|
1613
|
+
yield* j(o.source), yield* j(o.field);
|
|
1586
1614
|
return;
|
|
1587
1615
|
case "MapRecordValues":
|
|
1588
1616
|
case "MapArrayValues":
|
|
1589
1617
|
case "MapResourceFields":
|
|
1590
|
-
yield*
|
|
1618
|
+
yield* j(o.source), yield* j(o.mapping);
|
|
1591
1619
|
return;
|
|
1592
1620
|
case "Flatten":
|
|
1593
1621
|
case "GetResourceValueAsJson":
|
|
@@ -1600,23 +1628,23 @@ function* E(o, e) {
|
|
|
1600
1628
|
case "GetLastLogs":
|
|
1601
1629
|
case "GetProgressLog":
|
|
1602
1630
|
case "GetLogHandle":
|
|
1603
|
-
yield*
|
|
1631
|
+
yield* j(o.source);
|
|
1604
1632
|
return;
|
|
1605
1633
|
case "IsEmpty":
|
|
1606
|
-
yield*
|
|
1634
|
+
yield* j(o.arg);
|
|
1607
1635
|
return;
|
|
1608
1636
|
case "Not":
|
|
1609
|
-
yield*
|
|
1637
|
+
yield* j(o.operand);
|
|
1610
1638
|
return;
|
|
1611
1639
|
case "And":
|
|
1612
1640
|
case "Or":
|
|
1613
|
-
yield*
|
|
1641
|
+
yield* j(o.operand1), yield* j(o.operand2);
|
|
1614
1642
|
return;
|
|
1615
1643
|
default:
|
|
1616
1644
|
D(o);
|
|
1617
1645
|
}
|
|
1618
1646
|
}
|
|
1619
|
-
function
|
|
1647
|
+
function Eo(o, e) {
|
|
1620
1648
|
const t = {};
|
|
1621
1649
|
for (const [r, s] of Object.entries(o)) t[r] = e(s);
|
|
1622
1650
|
return t;
|
|
@@ -1624,7 +1652,7 @@ function Do(o, e) {
|
|
|
1624
1652
|
function de(o, e) {
|
|
1625
1653
|
return o === void 0 ? void 0 : e(o);
|
|
1626
1654
|
}
|
|
1627
|
-
function
|
|
1655
|
+
function To(o) {
|
|
1628
1656
|
switch (o.type) {
|
|
1629
1657
|
case "GetImportProgress":
|
|
1630
1658
|
return !0;
|
|
@@ -1632,8 +1660,8 @@ function xo(o) {
|
|
|
1632
1660
|
return !1;
|
|
1633
1661
|
}
|
|
1634
1662
|
}
|
|
1635
|
-
function
|
|
1636
|
-
for (const e of
|
|
1663
|
+
function Ao(o) {
|
|
1664
|
+
for (const e of j(o)) if (To(e)) return !0;
|
|
1637
1665
|
return !1;
|
|
1638
1666
|
}
|
|
1639
1667
|
function fe(o) {
|
|
@@ -1642,53 +1670,53 @@ function fe(o) {
|
|
|
1642
1670
|
result: o
|
|
1643
1671
|
};
|
|
1644
1672
|
}
|
|
1645
|
-
function
|
|
1673
|
+
function g(o) {
|
|
1646
1674
|
return () => fe(o);
|
|
1647
1675
|
}
|
|
1648
|
-
const
|
|
1676
|
+
const Io = (o) => {
|
|
1649
1677
|
const e = {};
|
|
1650
1678
|
for (const [t, r] of Object.entries(o)) e[t] = r;
|
|
1651
|
-
return
|
|
1652
|
-
},
|
|
1679
|
+
return g(e);
|
|
1680
|
+
}, Vo = (o) => {
|
|
1653
1681
|
const e = o.source;
|
|
1654
|
-
if (e === void 0) return
|
|
1682
|
+
if (e === void 0) return g(void 0);
|
|
1655
1683
|
const t = [];
|
|
1656
1684
|
for (const r of e)
|
|
1657
1685
|
r instanceof Array ? t.push(...r) : t.push(r);
|
|
1658
|
-
return
|
|
1659
|
-
},
|
|
1686
|
+
return g(t);
|
|
1687
|
+
}, No = (o) => {
|
|
1660
1688
|
const e = o.source, t = o.field;
|
|
1661
|
-
return e === void 0 || t === void 0 ?
|
|
1689
|
+
return e === void 0 || t === void 0 ? g(void 0) : ({ cCtx: r }) => {
|
|
1662
1690
|
var s;
|
|
1663
1691
|
return fe((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
|
|
1664
1692
|
};
|
|
1665
1693
|
};
|
|
1666
|
-
function
|
|
1694
|
+
function jt(o, e) {
|
|
1667
1695
|
const t = {}, r = o.length;
|
|
1668
1696
|
for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
|
|
1669
1697
|
return t;
|
|
1670
1698
|
}
|
|
1671
|
-
function
|
|
1699
|
+
function Lo(o, e) {
|
|
1672
1700
|
return (t) => {
|
|
1673
1701
|
const r = t.source;
|
|
1674
|
-
return r === void 0 ?
|
|
1702
|
+
return r === void 0 ? g(void 0) : () => ({
|
|
1675
1703
|
type: "ScheduleSubroutine",
|
|
1676
|
-
subroutine:
|
|
1677
|
-
args:
|
|
1704
|
+
subroutine: Et(r.length),
|
|
1705
|
+
args: jt(r, (s) => m({ ...o, [e.itVar]: s }, e.mapping))
|
|
1678
1706
|
});
|
|
1679
1707
|
};
|
|
1680
1708
|
}
|
|
1681
|
-
function
|
|
1709
|
+
function Et(o) {
|
|
1682
1710
|
return (e) => {
|
|
1683
1711
|
const t = [];
|
|
1684
1712
|
for (let r = 0; r < o; r++) t.push(e[String(r)]);
|
|
1685
|
-
return
|
|
1713
|
+
return g(t);
|
|
1686
1714
|
};
|
|
1687
1715
|
}
|
|
1688
|
-
function
|
|
1716
|
+
function Jo(o, e) {
|
|
1689
1717
|
return (t) => {
|
|
1690
1718
|
const r = t.source;
|
|
1691
|
-
if (r === void 0) return
|
|
1719
|
+
if (r === void 0) return g(void 0);
|
|
1692
1720
|
const s = {};
|
|
1693
1721
|
for (const [n, i] of Object.entries(r)) {
|
|
1694
1722
|
const a = { ...o, [e.itVar]: i };
|
|
@@ -1696,57 +1724,57 @@ function Vo(o, e) {
|
|
|
1696
1724
|
}
|
|
1697
1725
|
return () => ({
|
|
1698
1726
|
type: "ScheduleSubroutine",
|
|
1699
|
-
subroutine:
|
|
1727
|
+
subroutine: Ko,
|
|
1700
1728
|
args: s
|
|
1701
1729
|
});
|
|
1702
1730
|
};
|
|
1703
1731
|
}
|
|
1704
|
-
const
|
|
1732
|
+
const Ko = (o) => g(o), Mo = (o) => {
|
|
1705
1733
|
const e = o.arg;
|
|
1706
|
-
return
|
|
1707
|
-
},
|
|
1734
|
+
return g(e === void 0 ? void 0 : e.length === 0);
|
|
1735
|
+
}, Uo = (o) => {
|
|
1708
1736
|
const e = o.operand;
|
|
1709
|
-
return
|
|
1710
|
-
},
|
|
1737
|
+
return g(e === void 0 ? void 0 : !e);
|
|
1738
|
+
}, $o = (o) => {
|
|
1711
1739
|
const e = o.operand1, t = o.operand2;
|
|
1712
|
-
return
|
|
1713
|
-
},
|
|
1740
|
+
return g(e === void 0 || t === void 0 ? void 0 : e && t);
|
|
1741
|
+
}, Go = (o) => {
|
|
1714
1742
|
const e = o.operand1, t = o.operand2;
|
|
1715
|
-
return
|
|
1716
|
-
},
|
|
1743
|
+
return g(e === void 0 || t === void 0 ? void 0 : e || t);
|
|
1744
|
+
}, Ho = (o) => {
|
|
1717
1745
|
const e = o.source;
|
|
1718
|
-
return e === void 0 ?
|
|
1746
|
+
return e === void 0 ? g(void 0) : ({ cCtx: t }) => {
|
|
1719
1747
|
var r;
|
|
1720
1748
|
return fe((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
|
|
1721
1749
|
};
|
|
1722
|
-
},
|
|
1750
|
+
}, Wo = (o) => {
|
|
1723
1751
|
const e = o.source, t = o.field;
|
|
1724
|
-
return
|
|
1752
|
+
return g(e === void 0 || t === void 0 ? void 0 : e[t]);
|
|
1725
1753
|
};
|
|
1726
|
-
function
|
|
1754
|
+
function _o(o, e) {
|
|
1727
1755
|
return (t) => {
|
|
1728
1756
|
const r = t.source;
|
|
1729
|
-
return r === void 0 ?
|
|
1757
|
+
return r === void 0 ? g(void 0) : ({ cCtx: s }) => {
|
|
1730
1758
|
const n = s.accessor(r).node(), i = {};
|
|
1731
1759
|
for (const a of n.listInputFields()) {
|
|
1732
|
-
const
|
|
1733
|
-
if (
|
|
1760
|
+
const c = n.traverse(a);
|
|
1761
|
+
if (c === void 0) i[a] = g(void 0);
|
|
1734
1762
|
else {
|
|
1735
|
-
const
|
|
1736
|
-
i[a] = m(
|
|
1763
|
+
const u = { ...o, [e.itVar]: c.persist() };
|
|
1764
|
+
i[a] = m(u, e.mapping);
|
|
1737
1765
|
}
|
|
1738
1766
|
}
|
|
1739
1767
|
return {
|
|
1740
1768
|
type: "ScheduleSubroutine",
|
|
1741
|
-
subroutine:
|
|
1769
|
+
subroutine: zo,
|
|
1742
1770
|
args: i
|
|
1743
1771
|
};
|
|
1744
1772
|
};
|
|
1745
1773
|
};
|
|
1746
1774
|
}
|
|
1747
|
-
const
|
|
1775
|
+
const zo = (o) => g(o), qo = (o) => {
|
|
1748
1776
|
const e = o.source;
|
|
1749
|
-
return e === void 0 ?
|
|
1777
|
+
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1750
1778
|
type: "ScheduleComputable",
|
|
1751
1779
|
computable: P.make(
|
|
1752
1780
|
(r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
|
|
@@ -1758,9 +1786,9 @@ const Ho = (o) => f(o), _o = (o) => {
|
|
|
1758
1786
|
}
|
|
1759
1787
|
)
|
|
1760
1788
|
});
|
|
1761
|
-
},
|
|
1789
|
+
}, Yo = (o) => {
|
|
1762
1790
|
const e = o.source;
|
|
1763
|
-
return e === void 0 ?
|
|
1791
|
+
return e === void 0 ? g(void 0) : ({ cCtx: t, drivers: r }) => {
|
|
1764
1792
|
const s = t.accessor(e).node().resourceInfo;
|
|
1765
1793
|
return {
|
|
1766
1794
|
type: "ScheduleComputable",
|
|
@@ -1769,9 +1797,9 @@ const Ho = (o) => f(o), _o = (o) => {
|
|
|
1769
1797
|
})
|
|
1770
1798
|
};
|
|
1771
1799
|
};
|
|
1772
|
-
},
|
|
1800
|
+
}, Qo = (o) => {
|
|
1773
1801
|
const e = o.source;
|
|
1774
|
-
return e === void 0 ?
|
|
1802
|
+
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1775
1803
|
type: "ScheduleComputable",
|
|
1776
1804
|
computable: P.make(
|
|
1777
1805
|
(r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
|
|
@@ -1785,39 +1813,39 @@ const Ho = (o) => f(o), _o = (o) => {
|
|
|
1785
1813
|
}
|
|
1786
1814
|
)
|
|
1787
1815
|
});
|
|
1788
|
-
},
|
|
1816
|
+
}, Zo = (o) => {
|
|
1789
1817
|
const e = o.source;
|
|
1790
|
-
return e === void 0 ?
|
|
1818
|
+
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1791
1819
|
type: "ScheduleComputable",
|
|
1792
1820
|
computable: t.blobDriver.getDownloadedBlob(e)
|
|
1793
1821
|
});
|
|
1794
|
-
},
|
|
1822
|
+
}, Xo = (o) => {
|
|
1795
1823
|
const e = o.source;
|
|
1796
|
-
return e === void 0 ?
|
|
1824
|
+
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1797
1825
|
type: "ScheduleComputable",
|
|
1798
1826
|
computable: t.blobDriver.getOnDemandBlob(e)
|
|
1799
1827
|
});
|
|
1800
|
-
},
|
|
1828
|
+
}, es = (o) => {
|
|
1801
1829
|
const e = o.source;
|
|
1802
|
-
return e === void 0 ?
|
|
1830
|
+
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1803
1831
|
type: "ScheduleComputable",
|
|
1804
1832
|
computable: t.uploadDriver.getProgressId(e)
|
|
1805
1833
|
});
|
|
1806
|
-
},
|
|
1834
|
+
}, ts = (o) => (e) => {
|
|
1807
1835
|
const t = e.source;
|
|
1808
|
-
return t === void 0 ?
|
|
1836
|
+
return t === void 0 ? g(void 0) : ({ drivers: r }) => ({
|
|
1809
1837
|
type: "ScheduleComputable",
|
|
1810
1838
|
computable: r.logDriver.getLastLogs(t, o)
|
|
1811
1839
|
});
|
|
1812
|
-
},
|
|
1840
|
+
}, rs = (o) => (e) => {
|
|
1813
1841
|
const t = e.source;
|
|
1814
|
-
return t === void 0 ?
|
|
1842
|
+
return t === void 0 ? g(void 0) : ({ drivers: r }) => ({
|
|
1815
1843
|
type: "ScheduleComputable",
|
|
1816
1844
|
computable: r.logDriver.getProgressLog(t, o)
|
|
1817
1845
|
});
|
|
1818
|
-
},
|
|
1846
|
+
}, os = (o) => {
|
|
1819
1847
|
const e = o.source;
|
|
1820
|
-
return e === void 0 ?
|
|
1848
|
+
return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
|
|
1821
1849
|
type: "ScheduleComputable",
|
|
1822
1850
|
computable: t.logDriver.getLogHandle(e)
|
|
1823
1851
|
});
|
|
@@ -1826,18 +1854,18 @@ function m(o, e) {
|
|
|
1826
1854
|
switch (e.type) {
|
|
1827
1855
|
case "GetFromCtx":
|
|
1828
1856
|
const t = o[e.variable];
|
|
1829
|
-
return typeof t == "function" ? (r) => fe(t(r.cCtx)) : (t === void 0 && console.log("asdasd"),
|
|
1857
|
+
return typeof t == "function" ? (r) => fe(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), g(t));
|
|
1830
1858
|
case "Isolate":
|
|
1831
1859
|
return ({ drivers: r }) => ({
|
|
1832
1860
|
type: "ScheduleComputable",
|
|
1833
1861
|
computable: Vt(r, o, e.cfg)
|
|
1834
1862
|
});
|
|
1835
1863
|
case "Immediate":
|
|
1836
|
-
return
|
|
1864
|
+
return g(e.value);
|
|
1837
1865
|
case "GetJsonField":
|
|
1838
1866
|
return () => ({
|
|
1839
1867
|
type: "ScheduleSubroutine",
|
|
1840
|
-
subroutine:
|
|
1868
|
+
subroutine: Wo,
|
|
1841
1869
|
args: {
|
|
1842
1870
|
source: m(o, e.source),
|
|
1843
1871
|
field: m(o, e.field)
|
|
@@ -1846,7 +1874,7 @@ function m(o, e) {
|
|
|
1846
1874
|
case "MapArrayValues":
|
|
1847
1875
|
return () => ({
|
|
1848
1876
|
type: "ScheduleSubroutine",
|
|
1849
|
-
subroutine:
|
|
1877
|
+
subroutine: Lo(o, e),
|
|
1850
1878
|
args: {
|
|
1851
1879
|
source: m(o, e.source)
|
|
1852
1880
|
}
|
|
@@ -1854,7 +1882,7 @@ function m(o, e) {
|
|
|
1854
1882
|
case "MapRecordValues":
|
|
1855
1883
|
return () => ({
|
|
1856
1884
|
type: "ScheduleSubroutine",
|
|
1857
|
-
subroutine:
|
|
1885
|
+
subroutine: Jo(o, e),
|
|
1858
1886
|
args: {
|
|
1859
1887
|
source: m(o, e.source)
|
|
1860
1888
|
}
|
|
@@ -1862,19 +1890,19 @@ function m(o, e) {
|
|
|
1862
1890
|
case "MakeObject":
|
|
1863
1891
|
return () => ({
|
|
1864
1892
|
type: "ScheduleSubroutine",
|
|
1865
|
-
subroutine:
|
|
1866
|
-
args:
|
|
1893
|
+
subroutine: Io,
|
|
1894
|
+
args: Eo(e.template, (r) => m(o, r))
|
|
1867
1895
|
});
|
|
1868
1896
|
case "MakeArray":
|
|
1869
1897
|
return () => ({
|
|
1870
1898
|
type: "ScheduleSubroutine",
|
|
1871
|
-
subroutine:
|
|
1872
|
-
args:
|
|
1899
|
+
subroutine: Et(e.template.length),
|
|
1900
|
+
args: jt(e.template, (r) => m(o, r))
|
|
1873
1901
|
});
|
|
1874
1902
|
case "Flatten":
|
|
1875
1903
|
return () => ({
|
|
1876
1904
|
type: "ScheduleSubroutine",
|
|
1877
|
-
subroutine:
|
|
1905
|
+
subroutine: Vo,
|
|
1878
1906
|
args: {
|
|
1879
1907
|
source: m(o, e.source)
|
|
1880
1908
|
}
|
|
@@ -1882,7 +1910,7 @@ function m(o, e) {
|
|
|
1882
1910
|
case "IsEmpty":
|
|
1883
1911
|
return () => ({
|
|
1884
1912
|
type: "ScheduleSubroutine",
|
|
1885
|
-
subroutine:
|
|
1913
|
+
subroutine: Mo,
|
|
1886
1914
|
args: {
|
|
1887
1915
|
arg: m(o, e.arg)
|
|
1888
1916
|
}
|
|
@@ -1890,7 +1918,7 @@ function m(o, e) {
|
|
|
1890
1918
|
case "Not":
|
|
1891
1919
|
return () => ({
|
|
1892
1920
|
type: "ScheduleSubroutine",
|
|
1893
|
-
subroutine:
|
|
1921
|
+
subroutine: Uo,
|
|
1894
1922
|
args: {
|
|
1895
1923
|
operand: m(o, e.operand)
|
|
1896
1924
|
}
|
|
@@ -1898,7 +1926,7 @@ function m(o, e) {
|
|
|
1898
1926
|
case "And":
|
|
1899
1927
|
return () => ({
|
|
1900
1928
|
type: "ScheduleSubroutine",
|
|
1901
|
-
subroutine:
|
|
1929
|
+
subroutine: $o,
|
|
1902
1930
|
args: {
|
|
1903
1931
|
operand1: m(o, e.operand1),
|
|
1904
1932
|
operand2: m(o, e.operand2)
|
|
@@ -1907,7 +1935,7 @@ function m(o, e) {
|
|
|
1907
1935
|
case "Or":
|
|
1908
1936
|
return () => ({
|
|
1909
1937
|
type: "ScheduleSubroutine",
|
|
1910
|
-
subroutine:
|
|
1938
|
+
subroutine: Go,
|
|
1911
1939
|
args: {
|
|
1912
1940
|
operand1: m(o, e.operand1),
|
|
1913
1941
|
operand2: m(o, e.operand2)
|
|
@@ -1916,7 +1944,7 @@ function m(o, e) {
|
|
|
1916
1944
|
case "MapResourceFields":
|
|
1917
1945
|
return () => ({
|
|
1918
1946
|
type: "ScheduleSubroutine",
|
|
1919
|
-
subroutine:
|
|
1947
|
+
subroutine: _o(o, e),
|
|
1920
1948
|
args: {
|
|
1921
1949
|
source: m(o, e.source)
|
|
1922
1950
|
}
|
|
@@ -1924,7 +1952,7 @@ function m(o, e) {
|
|
|
1924
1952
|
case "GetResourceField":
|
|
1925
1953
|
return () => ({
|
|
1926
1954
|
type: "ScheduleSubroutine",
|
|
1927
|
-
subroutine:
|
|
1955
|
+
subroutine: No,
|
|
1928
1956
|
args: {
|
|
1929
1957
|
source: m(o, e.source),
|
|
1930
1958
|
field: m(o, e.field)
|
|
@@ -1933,7 +1961,7 @@ function m(o, e) {
|
|
|
1933
1961
|
case "GetResourceValueAsJson":
|
|
1934
1962
|
return () => ({
|
|
1935
1963
|
type: "ScheduleSubroutine",
|
|
1936
|
-
subroutine:
|
|
1964
|
+
subroutine: Ho,
|
|
1937
1965
|
args: {
|
|
1938
1966
|
source: m(o, e.source)
|
|
1939
1967
|
}
|
|
@@ -1941,7 +1969,7 @@ function m(o, e) {
|
|
|
1941
1969
|
case "GetBlobContent":
|
|
1942
1970
|
return () => ({
|
|
1943
1971
|
type: "ScheduleSubroutine",
|
|
1944
|
-
subroutine:
|
|
1972
|
+
subroutine: qo,
|
|
1945
1973
|
args: {
|
|
1946
1974
|
source: m(o, e.source)
|
|
1947
1975
|
}
|
|
@@ -1949,7 +1977,7 @@ function m(o, e) {
|
|
|
1949
1977
|
case "GetBlobContentAsString":
|
|
1950
1978
|
return () => ({
|
|
1951
1979
|
type: "ScheduleSubroutine",
|
|
1952
|
-
subroutine:
|
|
1980
|
+
subroutine: Yo,
|
|
1953
1981
|
args: {
|
|
1954
1982
|
source: m(o, e.source)
|
|
1955
1983
|
}
|
|
@@ -1957,7 +1985,7 @@ function m(o, e) {
|
|
|
1957
1985
|
case "GetBlobContentAsJson":
|
|
1958
1986
|
return () => ({
|
|
1959
1987
|
type: "ScheduleSubroutine",
|
|
1960
|
-
subroutine:
|
|
1988
|
+
subroutine: Qo,
|
|
1961
1989
|
args: {
|
|
1962
1990
|
source: m(o, e.source)
|
|
1963
1991
|
}
|
|
@@ -1965,7 +1993,7 @@ function m(o, e) {
|
|
|
1965
1993
|
case "GetDownloadedBlobContent":
|
|
1966
1994
|
return () => ({
|
|
1967
1995
|
type: "ScheduleSubroutine",
|
|
1968
|
-
subroutine:
|
|
1996
|
+
subroutine: Zo,
|
|
1969
1997
|
args: {
|
|
1970
1998
|
source: m(o, e.source)
|
|
1971
1999
|
}
|
|
@@ -1973,7 +2001,7 @@ function m(o, e) {
|
|
|
1973
2001
|
case "GetOnDemandBlobContent":
|
|
1974
2002
|
return () => ({
|
|
1975
2003
|
type: "ScheduleSubroutine",
|
|
1976
|
-
subroutine:
|
|
2004
|
+
subroutine: Xo,
|
|
1977
2005
|
args: {
|
|
1978
2006
|
source: m(o, e.source)
|
|
1979
2007
|
}
|
|
@@ -1981,7 +2009,7 @@ function m(o, e) {
|
|
|
1981
2009
|
case "GetImportProgress":
|
|
1982
2010
|
return () => ({
|
|
1983
2011
|
type: "ScheduleSubroutine",
|
|
1984
|
-
subroutine:
|
|
2012
|
+
subroutine: es,
|
|
1985
2013
|
args: {
|
|
1986
2014
|
source: m(o, e.source)
|
|
1987
2015
|
}
|
|
@@ -1989,7 +2017,7 @@ function m(o, e) {
|
|
|
1989
2017
|
case "GetLastLogs":
|
|
1990
2018
|
return () => ({
|
|
1991
2019
|
type: "ScheduleSubroutine",
|
|
1992
|
-
subroutine:
|
|
2020
|
+
subroutine: ts(e.lines),
|
|
1993
2021
|
args: {
|
|
1994
2022
|
source: m(o, e.source)
|
|
1995
2023
|
}
|
|
@@ -1997,7 +2025,7 @@ function m(o, e) {
|
|
|
1997
2025
|
case "GetProgressLog":
|
|
1998
2026
|
return () => ({
|
|
1999
2027
|
type: "ScheduleSubroutine",
|
|
2000
|
-
subroutine:
|
|
2028
|
+
subroutine: rs(e.patternToSearch),
|
|
2001
2029
|
args: {
|
|
2002
2030
|
source: m(o, e.source)
|
|
2003
2031
|
}
|
|
@@ -2005,7 +2033,7 @@ function m(o, e) {
|
|
|
2005
2033
|
case "GetLogHandle":
|
|
2006
2034
|
return () => ({
|
|
2007
2035
|
type: "ScheduleSubroutine",
|
|
2008
|
-
subroutine:
|
|
2036
|
+
subroutine: os,
|
|
2009
2037
|
args: {
|
|
2010
2038
|
source: m(o, e.source)
|
|
2011
2039
|
}
|
|
@@ -2014,8 +2042,8 @@ function m(o, e) {
|
|
|
2014
2042
|
return D(e);
|
|
2015
2043
|
}
|
|
2016
2044
|
}
|
|
2017
|
-
const
|
|
2018
|
-
function
|
|
2045
|
+
const ss = ["$prod", "$staging"];
|
|
2046
|
+
function ns(o) {
|
|
2019
2047
|
return {
|
|
2020
2048
|
$blockId: o.blockId,
|
|
2021
2049
|
$args: JSON.parse(o.args),
|
|
@@ -2024,47 +2052,47 @@ function rs(o) {
|
|
|
2024
2052
|
$staging: o.staging
|
|
2025
2053
|
};
|
|
2026
2054
|
}
|
|
2027
|
-
const
|
|
2028
|
-
function
|
|
2029
|
-
return o.op ==
|
|
2055
|
+
const Tt = Symbol(), At = "return", is = { op: Tt, arg: At };
|
|
2056
|
+
function as(o) {
|
|
2057
|
+
return o.op == Tt && o.arg == At;
|
|
2030
2058
|
}
|
|
2031
|
-
function
|
|
2059
|
+
function cs() {
|
|
2032
2060
|
return { pendingSubroutines: /* @__PURE__ */ new Map() };
|
|
2033
2061
|
}
|
|
2034
2062
|
function st(o, e, t, r) {
|
|
2035
|
-
const s = new ft(t), n = (a,
|
|
2036
|
-
if (
|
|
2037
|
-
return e.result =
|
|
2038
|
-
const
|
|
2039
|
-
if (a.arg in
|
|
2040
|
-
return
|
|
2041
|
-
destination:
|
|
2042
|
-
operation:
|
|
2063
|
+
const s = new ft(t), n = (a, c) => {
|
|
2064
|
+
if (as(a))
|
|
2065
|
+
return e.result = c, !1;
|
|
2066
|
+
const u = w(e.pendingSubroutines.get(a.op));
|
|
2067
|
+
if (a.arg in u.args) throw new Error("argument already set");
|
|
2068
|
+
return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op), s.push({
|
|
2069
|
+
destination: u.destination,
|
|
2070
|
+
operation: u.subroutine(u.args)
|
|
2043
2071
|
})), !0;
|
|
2044
2072
|
}, i = [];
|
|
2045
2073
|
e: for (; s.length > 0; ) {
|
|
2046
|
-
const a = s.shift(),
|
|
2047
|
-
switch (
|
|
2074
|
+
const a = s.shift(), c = a.operation(o);
|
|
2075
|
+
switch (c.type) {
|
|
2048
2076
|
case "ReturnResult":
|
|
2049
|
-
if (!n(a.destination,
|
|
2077
|
+
if (!n(a.destination, c.result)) break e;
|
|
2050
2078
|
break;
|
|
2051
2079
|
case "ScheduleSubroutine":
|
|
2052
|
-
const
|
|
2080
|
+
const u = Symbol(), l = Object.entries(c.args), p = l.length;
|
|
2053
2081
|
if (p === 0)
|
|
2054
2082
|
s.push({
|
|
2055
2083
|
destination: a.destination,
|
|
2056
|
-
operation:
|
|
2084
|
+
operation: c.subroutine({})
|
|
2057
2085
|
});
|
|
2058
2086
|
else {
|
|
2059
|
-
for (const [
|
|
2087
|
+
for (const [f, h] of l)
|
|
2060
2088
|
s.push({
|
|
2061
|
-
destination: { op:
|
|
2062
|
-
operation:
|
|
2089
|
+
destination: { op: u, arg: f },
|
|
2090
|
+
operation: h
|
|
2063
2091
|
});
|
|
2064
|
-
e.pendingSubroutines.set(
|
|
2092
|
+
e.pendingSubroutines.set(u, {
|
|
2065
2093
|
argCounter: p,
|
|
2066
2094
|
args: {},
|
|
2067
|
-
subroutine:
|
|
2095
|
+
subroutine: c.subroutine,
|
|
2068
2096
|
destination: a.destination
|
|
2069
2097
|
});
|
|
2070
2098
|
}
|
|
@@ -2074,64 +2102,64 @@ function st(o, e, t, r) {
|
|
|
2074
2102
|
throw new Error("asynchronous operations are forbidden in this context");
|
|
2075
2103
|
i.push({
|
|
2076
2104
|
destination: a.destination,
|
|
2077
|
-
computable:
|
|
2105
|
+
computable: c.computable
|
|
2078
2106
|
});
|
|
2079
2107
|
break;
|
|
2080
2108
|
default:
|
|
2081
|
-
D(
|
|
2109
|
+
D(c);
|
|
2082
2110
|
}
|
|
2083
2111
|
}
|
|
2084
2112
|
return i;
|
|
2085
2113
|
}
|
|
2086
2114
|
function It(o, e, t, r = {}) {
|
|
2087
|
-
return Vt(o,
|
|
2115
|
+
return Vt(o, ns(e), t, r);
|
|
2088
2116
|
}
|
|
2089
2117
|
function Vt(o, e, t, r = {}) {
|
|
2090
|
-
const s =
|
|
2091
|
-
ctx: Object.fromEntries(Object.entries(e).filter(([n]) =>
|
|
2118
|
+
const s = je({
|
|
2119
|
+
ctx: Object.fromEntries(Object.entries(e).filter(([n]) => ss.indexOf(n) === -1)),
|
|
2092
2120
|
cfg: t
|
|
2093
2121
|
});
|
|
2094
2122
|
return P.makeRaw(
|
|
2095
2123
|
(n) => {
|
|
2096
|
-
const i = { drivers: o, cCtx: n }, a =
|
|
2124
|
+
const i = { drivers: o, cCtx: n }, a = cs();
|
|
2097
2125
|
return {
|
|
2098
2126
|
ir: st(
|
|
2099
2127
|
i,
|
|
2100
2128
|
a,
|
|
2101
2129
|
[
|
|
2102
2130
|
{
|
|
2103
|
-
destination:
|
|
2131
|
+
destination: is,
|
|
2104
2132
|
operation: m(e, t)
|
|
2105
2133
|
}
|
|
2106
2134
|
],
|
|
2107
2135
|
!0
|
|
2108
2136
|
),
|
|
2109
|
-
async postprocessValue(
|
|
2137
|
+
async postprocessValue(u, l) {
|
|
2110
2138
|
const p = [];
|
|
2111
|
-
for (const
|
|
2112
|
-
p.push({ destination:
|
|
2113
|
-
const
|
|
2139
|
+
for (const O of u)
|
|
2140
|
+
p.push({ destination: O.destination, operation: g(O.computable) });
|
|
2141
|
+
const f = {
|
|
2114
2142
|
drivers: o,
|
|
2115
2143
|
get cCtx() {
|
|
2116
2144
|
throw new Error("asynchronous operations are forbidden in this context");
|
|
2117
2145
|
}
|
|
2118
|
-
},
|
|
2119
|
-
for (const [
|
|
2120
|
-
|
|
2121
|
-
const
|
|
2146
|
+
}, h = /* @__PURE__ */ new Map();
|
|
2147
|
+
for (const [O, A] of a.pendingSubroutines)
|
|
2148
|
+
h.set(O, { ...A, args: { ...A.args } });
|
|
2149
|
+
const y = {
|
|
2122
2150
|
result: a.result,
|
|
2123
|
-
pendingSubroutines:
|
|
2151
|
+
pendingSubroutines: h
|
|
2124
2152
|
};
|
|
2125
|
-
if (st(
|
|
2153
|
+
if (st(f, y, p, !1), !("result" in y))
|
|
2126
2154
|
throw new Error("illegal cfg rendering stack state, no result");
|
|
2127
|
-
return
|
|
2155
|
+
return y.result;
|
|
2128
2156
|
}
|
|
2129
2157
|
};
|
|
2130
2158
|
},
|
|
2131
2159
|
{ ...r, key: s }
|
|
2132
2160
|
);
|
|
2133
2161
|
}
|
|
2134
|
-
function
|
|
2162
|
+
function us(o) {
|
|
2135
2163
|
return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
|
|
2136
2164
|
}
|
|
2137
2165
|
function nt(o) {
|
|
@@ -2261,16 +2289,16 @@ class pe {
|
|
|
2261
2289
|
parsePObjectCollection(e, t, r) {
|
|
2262
2290
|
const s = this.getAccessor(e);
|
|
2263
2291
|
if (!s.getIsReadyOrError()) return;
|
|
2264
|
-
const n =
|
|
2265
|
-
for (const [a,
|
|
2266
|
-
i[a] =
|
|
2292
|
+
const n = jo(s, t, r), i = {};
|
|
2293
|
+
for (const [a, c] of Object.entries(n))
|
|
2294
|
+
i[a] = q(c, (u) => this.wrapAccessor(u));
|
|
2267
2295
|
return i;
|
|
2268
2296
|
}
|
|
2269
2297
|
//
|
|
2270
2298
|
// Blobs
|
|
2271
2299
|
//
|
|
2272
2300
|
registerComputable(e, t) {
|
|
2273
|
-
const r = `${e}_${
|
|
2301
|
+
const r = `${e}_${Q()}`;
|
|
2274
2302
|
return this.computablesToResolve[r] = t, r;
|
|
2275
2303
|
}
|
|
2276
2304
|
getBlobContentAsString(e) {
|
|
@@ -2379,7 +2407,7 @@ class pe {
|
|
|
2379
2407
|
isComplete: e.isComplete,
|
|
2380
2408
|
entries: e.entries.map((t) => ({
|
|
2381
2409
|
ref: t.ref,
|
|
2382
|
-
obj:
|
|
2410
|
+
obj: q(t.obj, (r) => this.wrapAccessor(r))
|
|
2383
2411
|
}))
|
|
2384
2412
|
};
|
|
2385
2413
|
}
|
|
@@ -2392,7 +2420,7 @@ class pe {
|
|
|
2392
2420
|
obj: {
|
|
2393
2421
|
id: t.obj.id,
|
|
2394
2422
|
spec: t.obj.spec,
|
|
2395
|
-
data:
|
|
2423
|
+
data: $t(t.obj.data, (r) => this.wrapAccessor(r))
|
|
2396
2424
|
}
|
|
2397
2425
|
}))
|
|
2398
2426
|
};
|
|
@@ -2410,7 +2438,7 @@ class pe {
|
|
|
2410
2438
|
"can't instantiate PFrames from this context (most porbably called from the future mapper)"
|
|
2411
2439
|
);
|
|
2412
2440
|
return this.env.driverKit.pFrameDriver.createPFrame(
|
|
2413
|
-
e.map((t) =>
|
|
2441
|
+
e.map((t) => q(t, (r) => this.getAccessor(r))),
|
|
2414
2442
|
this.computableCtx
|
|
2415
2443
|
);
|
|
2416
2444
|
}
|
|
@@ -2420,7 +2448,7 @@ class pe {
|
|
|
2420
2448
|
"can't instantiate PTable from this context (most porbably called from the future mapper)"
|
|
2421
2449
|
);
|
|
2422
2450
|
return this.env.driverKit.pFrameDriver.createPTable(
|
|
2423
|
-
ct(e, (t) =>
|
|
2451
|
+
ct(e, (t) => q(t, (r) => this.getAccessor(r))),
|
|
2424
2452
|
this.computableCtx
|
|
2425
2453
|
);
|
|
2426
2454
|
}
|
|
@@ -2434,7 +2462,7 @@ class pe {
|
|
|
2434
2462
|
}
|
|
2435
2463
|
wrapAccessor(e) {
|
|
2436
2464
|
if (e !== void 0) {
|
|
2437
|
-
const t =
|
|
2465
|
+
const t = Q();
|
|
2438
2466
|
return this.accessors.set(t, e), t;
|
|
2439
2467
|
}
|
|
2440
2468
|
}
|
|
@@ -2466,7 +2494,7 @@ class pe {
|
|
|
2466
2494
|
r = this.vm.null;
|
|
2467
2495
|
break;
|
|
2468
2496
|
}
|
|
2469
|
-
if (
|
|
2497
|
+
if (us(e)) {
|
|
2470
2498
|
r = this.vm.newArrayBuffer(e), s = !0;
|
|
2471
2499
|
break;
|
|
2472
2500
|
}
|
|
@@ -2568,20 +2596,20 @@ class pe {
|
|
|
2568
2596
|
});
|
|
2569
2597
|
}
|
|
2570
2598
|
}
|
|
2571
|
-
function
|
|
2599
|
+
function ls(o, e, t, r, s = {}) {
|
|
2572
2600
|
return P.makeRaw((n) => {
|
|
2573
2601
|
const i = new Se();
|
|
2574
2602
|
n.addOnDestroy(() => i.dispose());
|
|
2575
2603
|
const a = i.manage(o.quickJs.newRuntime());
|
|
2576
2604
|
a.setMemoryLimit(1024 * 640), a.setMaxStackSize(1024 * 320);
|
|
2577
|
-
const
|
|
2578
|
-
|
|
2579
|
-
const l =
|
|
2580
|
-
return
|
|
2581
|
-
ir:
|
|
2605
|
+
const c = i.manage(a.newContext()), u = new pe(i, c, e, o, n);
|
|
2606
|
+
u.evaluateBundle(r.content);
|
|
2607
|
+
const l = u.runCallback(t);
|
|
2608
|
+
return u.resetComputableCtx(), {
|
|
2609
|
+
ir: u.computablesToResolve,
|
|
2582
2610
|
postprocessValue: async (p) => {
|
|
2583
|
-
for (const [
|
|
2584
|
-
return
|
|
2611
|
+
for (const [f, h] of Object.entries(p)) u.runCallback(f, h);
|
|
2612
|
+
return u.importObjectUniversal(l);
|
|
2585
2613
|
}
|
|
2586
2614
|
};
|
|
2587
2615
|
}, s);
|
|
@@ -2589,99 +2617,99 @@ function as(o, e, t, r, s = {}) {
|
|
|
2589
2617
|
function De(o, e, t, r, s = {}) {
|
|
2590
2618
|
if (ut(t)) {
|
|
2591
2619
|
if (r === void 0) throw new Error("No code bundle.");
|
|
2592
|
-
return
|
|
2620
|
+
return ls(o, e, t, r, s);
|
|
2593
2621
|
} else return It(o.driverKit, e, t, s);
|
|
2594
2622
|
}
|
|
2595
|
-
function
|
|
2623
|
+
function ds(o, e, t) {
|
|
2596
2624
|
return P.make(
|
|
2597
2625
|
(r) => {
|
|
2598
|
-
var
|
|
2599
|
-
const s = r.accessor(o).node(), n = w(s.getKeyValueAsJson(Ie)), i = w(s.getKeyValueAsJson(
|
|
2626
|
+
var y, O, A, te, re, U, W, oe;
|
|
2627
|
+
const s = r.accessor(o).node(), n = w(s.getKeyValueAsJson(Ie)), i = w(s.getKeyValueAsJson(Z)), a = w(s.getKeyValueAsJson(X)), c = w(s.getKeyValueAsJson(H)), u = w(
|
|
2600
2628
|
s.getKeyValueAsJson(ue)
|
|
2601
2629
|
), l = /* @__PURE__ */ new Map();
|
|
2602
|
-
for (const { id: k } of
|
|
2603
|
-
const
|
|
2630
|
+
for (const { id: k } of N(c)) {
|
|
2631
|
+
const J = s.traverse({
|
|
2604
2632
|
field: C(k, "currentArgs"),
|
|
2605
2633
|
assertFieldType: "Dynamic",
|
|
2606
2634
|
errorIfFieldNotSet: !0
|
|
2607
2635
|
});
|
|
2608
2636
|
let _;
|
|
2609
|
-
const
|
|
2637
|
+
const E = s.traverse({
|
|
2610
2638
|
field: C(k, "prodArgs"),
|
|
2611
2639
|
assertFieldType: "Dynamic",
|
|
2612
2640
|
stableIfNotFound: !0
|
|
2613
2641
|
});
|
|
2614
|
-
if (
|
|
2642
|
+
if (E !== void 0) {
|
|
2615
2643
|
const x = s.getField({
|
|
2616
2644
|
field: C(k, "prodOutput"),
|
|
2617
2645
|
assertFieldType: "Dynamic",
|
|
2618
2646
|
errorIfFieldNotFound: !0
|
|
2619
|
-
}),
|
|
2647
|
+
}), B = s.getField({
|
|
2620
2648
|
field: C(k, "prodUiCtx"),
|
|
2621
2649
|
assertFieldType: "Dynamic",
|
|
2622
2650
|
errorIfFieldNotFound: !0
|
|
2623
2651
|
});
|
|
2624
2652
|
_ = {
|
|
2625
|
-
arguments:
|
|
2626
|
-
stale:
|
|
2627
|
-
outputError: x.error !== void 0 ||
|
|
2628
|
-
outputsError: ((
|
|
2629
|
-
exportsError: ((
|
|
2630
|
-
finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (
|
|
2653
|
+
arguments: E.getDataAsJson(),
|
|
2654
|
+
stale: J.id !== E.id,
|
|
2655
|
+
outputError: x.error !== void 0 || B.error !== void 0 || ((y = x.value) == null ? void 0 : y.getError()) !== void 0 || ((O = B.value) == null ? void 0 : O.getError()) !== void 0,
|
|
2656
|
+
outputsError: ((A = x.error) == null ? void 0 : A.getDataAsString()) ?? ((re = (te = x.value) == null ? void 0 : te.getError()) == null ? void 0 : re.getDataAsString()),
|
|
2657
|
+
exportsError: ((U = B.error) == null ? void 0 : U.getDataAsString()) ?? ((oe = (W = B.value) == null ? void 0 : W.getError()) == null ? void 0 : oe.getDataAsString()),
|
|
2658
|
+
finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
|
|
2631
2659
|
};
|
|
2632
2660
|
}
|
|
2633
|
-
l.set(k, { currentArguments:
|
|
2661
|
+
l.set(k, { currentArguments: J.getDataAsJson(), prod: _ });
|
|
2634
2662
|
}
|
|
2635
|
-
const p = ie(
|
|
2636
|
-
var Ke, Me, $e
|
|
2637
|
-
const
|
|
2638
|
-
let
|
|
2639
|
-
|
|
2640
|
-
const
|
|
2663
|
+
const p = ie(c, (k) => l.get(k).currentArguments), f = new Set(u.blocksInLimbo), h = [...N(c)].map(({ id: k, label: J, renderingMode: _ }) => {
|
|
2664
|
+
var Ke, Me, Ue, $e;
|
|
2665
|
+
const E = w(l.get(k)), x = w(p.nodes.get(k));
|
|
2666
|
+
let B = "NotCalculated";
|
|
2667
|
+
E.prod !== void 0 && (f.has(k) ? B = "Limbo" : B = E.prod.finished ? "Done" : "Running");
|
|
2668
|
+
const K = s.traverse(
|
|
2641
2669
|
{
|
|
2642
2670
|
field: C(k, "blockPack"),
|
|
2643
2671
|
assertFieldType: "Dynamic",
|
|
2644
2672
|
errorIfFieldNotSet: !0
|
|
2645
2673
|
},
|
|
2646
|
-
{ field:
|
|
2647
|
-
),
|
|
2648
|
-
const
|
|
2674
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2675
|
+
), L = K == null ? void 0 : K.getDataAsJson(), { sections: se, inputsValid: v, sdkVersion: R } = de(L == null ? void 0 : L.config, (ge) => {
|
|
2676
|
+
const z = xe(ge), Ge = Le(s, k);
|
|
2649
2677
|
return {
|
|
2650
2678
|
sections: De(
|
|
2651
2679
|
t,
|
|
2652
2680
|
Ge,
|
|
2653
|
-
|
|
2654
|
-
|
|
2681
|
+
z.sections,
|
|
2682
|
+
z.code
|
|
2655
2683
|
),
|
|
2656
2684
|
inputsValid: De(
|
|
2657
2685
|
t,
|
|
2658
2686
|
Ge,
|
|
2659
|
-
|
|
2660
|
-
|
|
2687
|
+
z.inputsValid,
|
|
2688
|
+
z.code
|
|
2661
2689
|
),
|
|
2662
|
-
sdkVersion:
|
|
2690
|
+
sdkVersion: z.sdkVersion
|
|
2663
2691
|
};
|
|
2664
2692
|
}) || {}, F = de(
|
|
2665
|
-
|
|
2693
|
+
L,
|
|
2666
2694
|
(ge) => t.blockUpdateWatcher.get(ge.source, r)
|
|
2667
2695
|
);
|
|
2668
2696
|
return {
|
|
2669
2697
|
id: k,
|
|
2670
|
-
label:
|
|
2698
|
+
label: J,
|
|
2671
2699
|
renderingMode: _,
|
|
2672
|
-
stale: ((Ke =
|
|
2700
|
+
stale: ((Ke = E.prod) == null ? void 0 : Ke.stale) !== !1 || B === "Limbo",
|
|
2673
2701
|
missingReference: x.missingReferences,
|
|
2674
2702
|
upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
|
|
2675
2703
|
downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
|
|
2676
|
-
calculationStatus:
|
|
2677
|
-
outputErrors: ((Me =
|
|
2678
|
-
outputsError: (
|
|
2679
|
-
exportsError: (
|
|
2680
|
-
sections:
|
|
2704
|
+
calculationStatus: B,
|
|
2705
|
+
outputErrors: ((Me = E.prod) == null ? void 0 : Me.outputError) === !0,
|
|
2706
|
+
outputsError: (Ue = E.prod) == null ? void 0 : Ue.outputsError,
|
|
2707
|
+
exportsError: ($e = E.prod) == null ? void 0 : $e.exportsError,
|
|
2708
|
+
sections: se,
|
|
2681
2709
|
inputsValid: v,
|
|
2682
|
-
currentBlockPack:
|
|
2710
|
+
currentBlockPack: L == null ? void 0 : L.source,
|
|
2683
2711
|
updatedBlockPack: F,
|
|
2684
|
-
sdkVersion:
|
|
2712
|
+
sdkVersion: R,
|
|
2685
2713
|
navigationState: e.getState(k)
|
|
2686
2714
|
};
|
|
2687
2715
|
});
|
|
@@ -2690,7 +2718,7 @@ function cs(o, e, t) {
|
|
|
2690
2718
|
created: new Date(n),
|
|
2691
2719
|
lastModified: new Date(i),
|
|
2692
2720
|
authorMarker: s.getKeyValueAsJson(Pe),
|
|
2693
|
-
blocks:
|
|
2721
|
+
blocks: h
|
|
2694
2722
|
};
|
|
2695
2723
|
},
|
|
2696
2724
|
{
|
|
@@ -2700,8 +2728,8 @@ function cs(o, e, t) {
|
|
|
2700
2728
|
...r,
|
|
2701
2729
|
blocks: r.blocks.map((i) => {
|
|
2702
2730
|
i.inputsValid || s.add(i.id), i.stale && n.add(i.id);
|
|
2703
|
-
const a = i.stale || i.upstreams.findIndex((
|
|
2704
|
-
return { ...i, canRun:
|
|
2731
|
+
const a = i.stale || i.upstreams.findIndex((u) => n.has(u)) !== -1, c = a && !!i.inputsValid && !i.missingReference && i.upstreams.findIndex((u) => s.has(u)) === -1;
|
|
2732
|
+
return { ...i, canRun: c, stale: a };
|
|
2705
2733
|
})
|
|
2706
2734
|
};
|
|
2707
2735
|
}
|
|
@@ -2717,18 +2745,18 @@ function Nt(o, e) {
|
|
|
2717
2745
|
assertFieldType: "Dynamic",
|
|
2718
2746
|
errorIfFieldNotSet: !0
|
|
2719
2747
|
},
|
|
2720
|
-
{ field:
|
|
2748
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2721
2749
|
)) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
|
|
2722
2750
|
(s) => xe(s)
|
|
2723
2751
|
);
|
|
2724
2752
|
}
|
|
2725
|
-
function
|
|
2753
|
+
function ps(o, e) {
|
|
2726
2754
|
const t = o.node();
|
|
2727
|
-
if (
|
|
2755
|
+
if (M(t.resourceType, kt)) {
|
|
2728
2756
|
const r = t.getDataAsJson();
|
|
2729
2757
|
if (r === void 0) throw new Error("No resource data.");
|
|
2730
2758
|
return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
|
|
2731
|
-
} else if (
|
|
2759
|
+
} else if (M(t.resourceType, Ct)) {
|
|
2732
2760
|
const r = t.getDataAsJson();
|
|
2733
2761
|
if (r === void 0) throw new Error("No resource data.");
|
|
2734
2762
|
return e.signer.verify(
|
|
@@ -2739,10 +2767,10 @@ function us(o, e) {
|
|
|
2739
2767
|
} else
|
|
2740
2768
|
throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
|
|
2741
2769
|
}
|
|
2742
|
-
function
|
|
2770
|
+
function hs(o, e) {
|
|
2743
2771
|
if (o !== void 0)
|
|
2744
2772
|
return P.make(
|
|
2745
|
-
(t) =>
|
|
2773
|
+
(t) => ps(t.accessor(o), e),
|
|
2746
2774
|
{
|
|
2747
2775
|
postprocessValue: (t) => {
|
|
2748
2776
|
if (t !== void 0) {
|
|
@@ -2754,7 +2782,7 @@ function ls(o, e) {
|
|
|
2754
2782
|
}
|
|
2755
2783
|
).withStableType();
|
|
2756
2784
|
}
|
|
2757
|
-
function
|
|
2785
|
+
function fs(o, e, t) {
|
|
2758
2786
|
return P.make(
|
|
2759
2787
|
(r) => {
|
|
2760
2788
|
var a;
|
|
@@ -2763,15 +2791,15 @@ function ds(o, e, t) {
|
|
|
2763
2791
|
field: C(e, "blockPack"),
|
|
2764
2792
|
assertFieldType: "Dynamic"
|
|
2765
2793
|
},
|
|
2766
|
-
{ field:
|
|
2794
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
|
|
2767
2795
|
{ field: Ft, assertFieldType: "Input" }
|
|
2768
2796
|
)) == null ? void 0 : a.persist();
|
|
2769
|
-
return { path:
|
|
2797
|
+
return { path: hs(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
|
|
2770
2798
|
},
|
|
2771
2799
|
{ mode: "StableOnlyLive" }
|
|
2772
2800
|
);
|
|
2773
2801
|
}
|
|
2774
|
-
function
|
|
2802
|
+
function gs(o, e, t) {
|
|
2775
2803
|
return P.make(
|
|
2776
2804
|
(r) => {
|
|
2777
2805
|
const s = r.accessor(o).node(), n = Le(s, e);
|
|
@@ -2784,59 +2812,59 @@ function ps(o, e, t) {
|
|
|
2784
2812
|
{ key: "inputs#" + pt(o.rid) + e }
|
|
2785
2813
|
);
|
|
2786
2814
|
}
|
|
2787
|
-
function
|
|
2815
|
+
function ms(o, e, t) {
|
|
2788
2816
|
return P.make(
|
|
2789
2817
|
(r) => {
|
|
2790
2818
|
const s = r.accessor(o).node(), n = xt(s, e), i = Nt(s, e);
|
|
2791
2819
|
return de(i, (a) => {
|
|
2792
|
-
const
|
|
2793
|
-
for (const [
|
|
2794
|
-
u
|
|
2820
|
+
const c = {};
|
|
2821
|
+
for (const [u, l] of Object.entries(a.outputs))
|
|
2822
|
+
c[u] = P.wrapError(
|
|
2795
2823
|
De(t, n, l, a.code)
|
|
2796
2824
|
);
|
|
2797
|
-
return
|
|
2825
|
+
return c;
|
|
2798
2826
|
});
|
|
2799
2827
|
},
|
|
2800
2828
|
{ key: "outputs#" + pt(o.rid) + e }
|
|
2801
2829
|
).withStableType();
|
|
2802
2830
|
}
|
|
2803
|
-
function
|
|
2831
|
+
function vs(o, e) {
|
|
2804
2832
|
return P.make((t) => {
|
|
2805
|
-
const r = t.accessor(o).node(), s = w(r.getKeyValueAsJson(
|
|
2806
|
-
for (const { id: i, renderingMode: a } of
|
|
2807
|
-
const
|
|
2833
|
+
const r = t.accessor(o).node(), s = w(r.getKeyValueAsJson(H)), n = [];
|
|
2834
|
+
for (const { id: i, renderingMode: a } of N(s)) {
|
|
2835
|
+
const c = r.traverse(
|
|
2808
2836
|
{
|
|
2809
2837
|
field: C(i, "blockPack"),
|
|
2810
2838
|
assertFieldType: "Dynamic",
|
|
2811
2839
|
errorIfFieldNotSet: !0
|
|
2812
2840
|
},
|
|
2813
|
-
{ field:
|
|
2814
|
-
),
|
|
2815
|
-
if ((
|
|
2816
|
-
const l = xe(
|
|
2841
|
+
{ field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
|
|
2842
|
+
), u = c == null ? void 0 : c.getDataAsJson();
|
|
2843
|
+
if ((u == null ? void 0 : u.config) === void 0) continue;
|
|
2844
|
+
const l = xe(u.config), p = Object.entries(l.outputs).map(([, h]) => h).filter((h) => !ut(h) && Ao(h)).map((h) => h);
|
|
2817
2845
|
if (p.length === 0) continue;
|
|
2818
|
-
const
|
|
2819
|
-
for (const
|
|
2820
|
-
n.push(P.wrapError(It(e.driverKit,
|
|
2846
|
+
const f = xt(r, i);
|
|
2847
|
+
for (const h of p)
|
|
2848
|
+
n.push(P.wrapError(It(e.driverKit, f, h)));
|
|
2821
2849
|
}
|
|
2822
2850
|
return n;
|
|
2823
2851
|
});
|
|
2824
2852
|
}
|
|
2825
|
-
class
|
|
2853
|
+
class ys {
|
|
2826
2854
|
constructor() {
|
|
2827
2855
|
d(this, "states", /* @__PURE__ */ new Map());
|
|
2828
2856
|
}
|
|
2829
2857
|
setState(e, t) {
|
|
2830
2858
|
const r = this.states.get(e);
|
|
2831
2859
|
if (r === void 0) {
|
|
2832
|
-
this.states.set(e, { state: t, change: new
|
|
2860
|
+
this.states.set(e, { state: t, change: new _e() });
|
|
2833
2861
|
return;
|
|
2834
2862
|
}
|
|
2835
2863
|
r.state = { ...t }, r.change.markChanged();
|
|
2836
2864
|
}
|
|
2837
2865
|
readState(e, t) {
|
|
2838
2866
|
let r = this.states.get(t);
|
|
2839
|
-
return r === void 0 && (r = { state: { ...Gt }, change: new
|
|
2867
|
+
return r === void 0 && (r = { state: { ...Gt }, change: new _e() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
|
|
2840
2868
|
}
|
|
2841
2869
|
getState(e) {
|
|
2842
2870
|
return P.make(
|
|
@@ -2855,32 +2883,32 @@ class Je {
|
|
|
2855
2883
|
d(this, "rid");
|
|
2856
2884
|
/** Data for the left panel, contain basic information about block status. */
|
|
2857
2885
|
d(this, "overview");
|
|
2858
|
-
d(this, "navigationStates", new
|
|
2886
|
+
d(this, "navigationStates", new ys());
|
|
2859
2887
|
d(this, "blockComputables", /* @__PURE__ */ new Map());
|
|
2860
2888
|
d(this, "blockFrontends", /* @__PURE__ */ new Map());
|
|
2861
2889
|
d(this, "activeConfigs");
|
|
2862
2890
|
d(this, "refreshLoopResult");
|
|
2863
2891
|
d(this, "abortController", new AbortController());
|
|
2864
2892
|
d(this, "destroyed", !1);
|
|
2865
|
-
this.env = e, this.projectTree = r, this.overview =
|
|
2893
|
+
this.env = e, this.projectTree = r, this.overview = ds(
|
|
2866
2894
|
r.entry(),
|
|
2867
2895
|
this.navigationStates,
|
|
2868
2896
|
e
|
|
2869
|
-
).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs =
|
|
2897
|
+
).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = vs(r.entry(), e);
|
|
2870
2898
|
}
|
|
2871
2899
|
async refreshLoop() {
|
|
2872
2900
|
for (; !this.destroyed; )
|
|
2873
2901
|
try {
|
|
2874
2902
|
await be(this.env.pl, this.rid, (e) => {
|
|
2875
2903
|
e.doRefresh(this.env.ops.stagingRenderingRate);
|
|
2876
|
-
}), await this.activeConfigs.getValue(), await
|
|
2904
|
+
}), await this.activeConfigs.getValue(), await dr(this.env.ops.projectRefreshInterval, this.abortController.signal);
|
|
2877
2905
|
} catch (e) {
|
|
2878
|
-
if (
|
|
2906
|
+
if (rr(e)) {
|
|
2879
2907
|
console.warn(
|
|
2880
2908
|
"project refresh routine terminated, because project was externally deleted"
|
|
2881
2909
|
);
|
|
2882
2910
|
break;
|
|
2883
|
-
} else if (!
|
|
2911
|
+
} else if (!or(e))
|
|
2884
2912
|
throw new Error("Unexpected exception", { cause: e });
|
|
2885
2913
|
}
|
|
2886
2914
|
}
|
|
@@ -2895,13 +2923,13 @@ class Je {
|
|
|
2895
2923
|
*
|
|
2896
2924
|
* @return returns newly created block id
|
|
2897
2925
|
* */
|
|
2898
|
-
async addBlock(e, t, r, s = void 0, n =
|
|
2926
|
+
async addBlock(e, t, r, s = void 0, n = Q()) {
|
|
2899
2927
|
const i = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfig(t);
|
|
2900
|
-
return await
|
|
2928
|
+
return await I(
|
|
2901
2929
|
this.env.pl,
|
|
2902
2930
|
this.rid,
|
|
2903
2931
|
s,
|
|
2904
|
-
(
|
|
2932
|
+
(c) => c.addBlock(
|
|
2905
2933
|
{
|
|
2906
2934
|
id: n,
|
|
2907
2935
|
label: e,
|
|
@@ -2921,7 +2949,7 @@ class Je {
|
|
|
2921
2949
|
* */
|
|
2922
2950
|
async updateBlockPack(e, t, r = !1, s) {
|
|
2923
2951
|
const n = await this.env.bpPreparer.prepare(t), i = await this.env.bpPreparer.getBlockConfig(t);
|
|
2924
|
-
await
|
|
2952
|
+
await I(
|
|
2925
2953
|
this.env.pl,
|
|
2926
2954
|
this.rid,
|
|
2927
2955
|
s,
|
|
@@ -2934,7 +2962,7 @@ class Je {
|
|
|
2934
2962
|
}
|
|
2935
2963
|
/** Deletes a block with all associated data. */
|
|
2936
2964
|
async deleteBlock(e, t) {
|
|
2937
|
-
await
|
|
2965
|
+
await I(this.env.pl, this.rid, t, (r) => r.deleteBlock(e)), this.navigationStates.deleteBlock(e), await this.projectTree.refreshState();
|
|
2938
2966
|
}
|
|
2939
2967
|
/**
|
|
2940
2968
|
* Updates block order according to the given array of block ids.
|
|
@@ -2943,7 +2971,7 @@ class Je {
|
|
|
2943
2971
|
* an error will be thrown instead.
|
|
2944
2972
|
*/
|
|
2945
2973
|
async reorderBlocks(e, t) {
|
|
2946
|
-
await
|
|
2974
|
+
await I(this.env.pl, this.rid, t, (r) => {
|
|
2947
2975
|
const s = r.structure;
|
|
2948
2976
|
if (s.groups.length !== 1)
|
|
2949
2977
|
throw new Error("Unexpected project structure, non-sinular block group");
|
|
@@ -2957,9 +2985,9 @@ class Je {
|
|
|
2957
2985
|
id: n.id,
|
|
2958
2986
|
label: n.label,
|
|
2959
2987
|
blocks: e.map((a) => {
|
|
2960
|
-
const
|
|
2961
|
-
if (
|
|
2962
|
-
return
|
|
2988
|
+
const c = n.blocks.find((u) => u.id === a);
|
|
2989
|
+
if (c === void 0) throw new Error(`Can't find block: ${a}`);
|
|
2990
|
+
return c;
|
|
2963
2991
|
})
|
|
2964
2992
|
}
|
|
2965
2993
|
]
|
|
@@ -2985,7 +3013,7 @@ class Je {
|
|
|
2985
3013
|
}
|
|
2986
3014
|
/** Update block label. */
|
|
2987
3015
|
async setBlockLabel(e, t, r) {
|
|
2988
|
-
await
|
|
3016
|
+
await I(this.env.pl, this.rid, r, (s) => {
|
|
2989
3017
|
s.setBlockLabel(e, t);
|
|
2990
3018
|
}), await this.projectTree.refreshState();
|
|
2991
3019
|
}
|
|
@@ -2996,7 +3024,7 @@ class Je {
|
|
|
2996
3024
|
* in collaborative editing scenario.
|
|
2997
3025
|
* */
|
|
2998
3026
|
async setBlockArgs(e, t, r) {
|
|
2999
|
-
await
|
|
3027
|
+
await I(
|
|
3000
3028
|
this.env.pl,
|
|
3001
3029
|
this.rid,
|
|
3002
3030
|
r,
|
|
@@ -3010,7 +3038,7 @@ class Je {
|
|
|
3010
3038
|
* in collaborative editing scenario.
|
|
3011
3039
|
* */
|
|
3012
3040
|
async setUiState(e, t, r) {
|
|
3013
|
-
await
|
|
3041
|
+
await I(
|
|
3014
3042
|
this.env.pl,
|
|
3015
3043
|
this.rid,
|
|
3016
3044
|
r,
|
|
@@ -3030,7 +3058,7 @@ class Je {
|
|
|
3030
3058
|
* in collaborative editing scenario.
|
|
3031
3059
|
* */
|
|
3032
3060
|
async setBlockArgsAndUiState(e, t, r, s) {
|
|
3033
|
-
await
|
|
3061
|
+
await I(this.env.pl, this.rid, s, (n) => {
|
|
3034
3062
|
n.setArgs([{ blockId: e, args: JSON.stringify(t) }]), n.setUiState(e, JSON.stringify(r));
|
|
3035
3063
|
}), await this.projectTree.refreshState();
|
|
3036
3064
|
}
|
|
@@ -3040,22 +3068,22 @@ class Je {
|
|
|
3040
3068
|
const s = we(
|
|
3041
3069
|
(await r.getField(S(this.rid, C(e, "blockPack")))).value
|
|
3042
3070
|
), n = we(
|
|
3043
|
-
(await r.getField(S(s,
|
|
3071
|
+
(await r.getField(S(s, b.HolderRefField))).value
|
|
3044
3072
|
), i = await r.getResourceData(n, !1), a = JSON.parse(
|
|
3045
3073
|
Buffer.from(w(i.data)).toString("utf-8")
|
|
3046
3074
|
);
|
|
3047
|
-
await
|
|
3048
|
-
|
|
3075
|
+
await I(r, this.rid, t, (c) => {
|
|
3076
|
+
c.setArgs([{ blockId: e, args: JSON.stringify(a.config.initialArgs) }]), c.setUiState(e, void 0);
|
|
3049
3077
|
}), await r.commit();
|
|
3050
3078
|
}), await this.projectTree.refreshState();
|
|
3051
3079
|
}
|
|
3052
3080
|
getBlockComputables(e) {
|
|
3053
3081
|
const t = this.blockComputables.get(e);
|
|
3054
3082
|
if (t === void 0) {
|
|
3055
|
-
const r =
|
|
3083
|
+
const r = ms(this.projectTree.entry(), e, this.env), n = {
|
|
3056
3084
|
fullState: P.make(
|
|
3057
3085
|
(i) => ({
|
|
3058
|
-
argsAndUiState:
|
|
3086
|
+
argsAndUiState: gs(this.projectTree.entry(), e),
|
|
3059
3087
|
outputs: r,
|
|
3060
3088
|
navigationState: this.navigationStates.getState(e)
|
|
3061
3089
|
}),
|
|
@@ -3086,7 +3114,7 @@ class Je {
|
|
|
3086
3114
|
getBlockFrontend(e) {
|
|
3087
3115
|
const t = this.blockFrontends.get(e);
|
|
3088
3116
|
if (t === void 0) {
|
|
3089
|
-
const r =
|
|
3117
|
+
const r = fs(
|
|
3090
3118
|
this.projectTree.entry(),
|
|
3091
3119
|
e,
|
|
3092
3120
|
this.env
|
|
@@ -3129,7 +3157,7 @@ const Lt = {
|
|
|
3129
3157
|
pollingInterval: 1e3,
|
|
3130
3158
|
stopPollingDelay: 1e3
|
|
3131
3159
|
}
|
|
3132
|
-
},
|
|
3160
|
+
}, bs = {
|
|
3133
3161
|
...Lt,
|
|
3134
3162
|
defaultTreeOptions: {
|
|
3135
3163
|
pollingInterval: 350,
|
|
@@ -3138,12 +3166,12 @@ const Lt = {
|
|
|
3138
3166
|
devBlockUpdateRecheckInterval: 1e3,
|
|
3139
3167
|
projectRefreshInterval: 700,
|
|
3140
3168
|
stagingRenderingRate: 5
|
|
3141
|
-
},
|
|
3169
|
+
}, ws = {
|
|
3142
3170
|
minDelay: 1500
|
|
3143
|
-
},
|
|
3144
|
-
class
|
|
3171
|
+
}, Ss = "__no_updates__";
|
|
3172
|
+
class ks extends ir {
|
|
3145
3173
|
constructor(t = {}) {
|
|
3146
|
-
super({ ...t, ...
|
|
3174
|
+
super({ ...t, ...ws });
|
|
3147
3175
|
d(this, "http");
|
|
3148
3176
|
this.http = t.http;
|
|
3149
3177
|
}
|
|
@@ -3154,7 +3182,7 @@ class bs extends sr {
|
|
|
3154
3182
|
case "dev-v2":
|
|
3155
3183
|
return `dev_2_${t.folder}_${t.mtime}`;
|
|
3156
3184
|
default:
|
|
3157
|
-
return
|
|
3185
|
+
return Ss;
|
|
3158
3186
|
}
|
|
3159
3187
|
}
|
|
3160
3188
|
async readValue(t) {
|
|
@@ -3223,9 +3251,9 @@ class it {
|
|
|
3223
3251
|
function at(o) {
|
|
3224
3252
|
return String(o.id);
|
|
3225
3253
|
}
|
|
3226
|
-
class
|
|
3254
|
+
class Cs {
|
|
3227
3255
|
constructor(e, t) {
|
|
3228
|
-
d(this, "pFrame", new
|
|
3256
|
+
d(this, "pFrame", new Cr());
|
|
3229
3257
|
d(this, "blobIdToResource", /* @__PURE__ */ new Map());
|
|
3230
3258
|
d(this, "blobHandleComputables", /* @__PURE__ */ new Map());
|
|
3231
3259
|
d(this, "preloadBlob", async (e) => {
|
|
@@ -3238,8 +3266,8 @@ class ws {
|
|
|
3238
3266
|
});
|
|
3239
3267
|
this.blobDriver = e, this.columns = t, this.pFrame.setDataSource(this);
|
|
3240
3268
|
for (const r of t) {
|
|
3241
|
-
for (const n of
|
|
3242
|
-
const s =
|
|
3269
|
+
for (const n of Co(r.data)) this.blobIdToResource.set(at(n), n);
|
|
3270
|
+
const s = Po(r.data, at);
|
|
3243
3271
|
try {
|
|
3244
3272
|
this.pFrame.addColumnSpec(r.id, r.spec), this.pFrame.setColumnData(r.id, s);
|
|
3245
3273
|
} catch (n) {
|
|
@@ -3261,7 +3289,7 @@ class ws {
|
|
|
3261
3289
|
this.pFrame.dispose();
|
|
3262
3290
|
}
|
|
3263
3291
|
}
|
|
3264
|
-
class
|
|
3292
|
+
class Ps {
|
|
3265
3293
|
constructor(e) {
|
|
3266
3294
|
d(this, "pFrames");
|
|
3267
3295
|
d(this, "pTables");
|
|
@@ -3270,10 +3298,10 @@ class Ss {
|
|
|
3270
3298
|
super(), this.blobDriver = t;
|
|
3271
3299
|
}
|
|
3272
3300
|
createNewResource(t) {
|
|
3273
|
-
return new
|
|
3301
|
+
return new Cs(this.blobDriver, t);
|
|
3274
3302
|
}
|
|
3275
3303
|
calculateParamsKey(t) {
|
|
3276
|
-
return
|
|
3304
|
+
return Bs(t);
|
|
3277
3305
|
}
|
|
3278
3306
|
}(this.blobDriver), this.pTables = new class extends it {
|
|
3279
3307
|
constructor(t) {
|
|
@@ -3281,13 +3309,13 @@ class Ss {
|
|
|
3281
3309
|
}
|
|
3282
3310
|
async createNewResource(t) {
|
|
3283
3311
|
const s = await this.pFrames.getByKey(t.pFrameHandle).pFrame.createTable({
|
|
3284
|
-
src:
|
|
3312
|
+
src: Y(t.def.src),
|
|
3285
3313
|
filters: t.def.filters
|
|
3286
3314
|
});
|
|
3287
3315
|
return t.def.sorting.length !== 0 ? s.sort(t.def.sorting) : s;
|
|
3288
3316
|
}
|
|
3289
3317
|
calculateParamsKey(t) {
|
|
3290
|
-
return
|
|
3318
|
+
return Fs(t);
|
|
3291
3319
|
}
|
|
3292
3320
|
}(this.pFrames);
|
|
3293
3321
|
}
|
|
@@ -3295,11 +3323,11 @@ class Ss {
|
|
|
3295
3323
|
// Internal / Config API Methods
|
|
3296
3324
|
//
|
|
3297
3325
|
createPFrame(e, t) {
|
|
3298
|
-
const r = e.map((n) =>
|
|
3326
|
+
const r = e.map((n) => q(n, (i) => xo(i))), s = this.pFrames.acquire(r);
|
|
3299
3327
|
return t.addOnDestroy(s.unref), s.key;
|
|
3300
3328
|
}
|
|
3301
3329
|
createPTable(e, t) {
|
|
3302
|
-
const r = this.createPFrame(
|
|
3330
|
+
const r = this.createPFrame(Rs(e.src), t), s = ct(e, (i) => i.id), n = this.pTables.acquire({ def: s, pFrameHandle: r });
|
|
3303
3331
|
return t.addOnDestroy(n.unref), n.key;
|
|
3304
3332
|
}
|
|
3305
3333
|
//
|
|
@@ -3324,7 +3352,7 @@ class Ss {
|
|
|
3324
3352
|
}
|
|
3325
3353
|
async calculateTableData(e, t) {
|
|
3326
3354
|
let r = await this.pFrames.getByKey(e).pFrame.createTable({
|
|
3327
|
-
src:
|
|
3355
|
+
src: Y(t.src),
|
|
3328
3356
|
filters: t.filters
|
|
3329
3357
|
});
|
|
3330
3358
|
if (t.sorting.length > 0) {
|
|
@@ -3353,7 +3381,7 @@ class Ss {
|
|
|
3353
3381
|
return (await this.pTables.getByKey(e)).getData(t, r);
|
|
3354
3382
|
}
|
|
3355
3383
|
}
|
|
3356
|
-
function
|
|
3384
|
+
function Y(o) {
|
|
3357
3385
|
switch (o.type) {
|
|
3358
3386
|
case "column":
|
|
3359
3387
|
return {
|
|
@@ -3365,30 +3393,30 @@ function q(o) {
|
|
|
3365
3393
|
case "full":
|
|
3366
3394
|
return {
|
|
3367
3395
|
type: o.type,
|
|
3368
|
-
entries: o.entries.map((e) =>
|
|
3396
|
+
entries: o.entries.map((e) => Y(e))
|
|
3369
3397
|
};
|
|
3370
3398
|
case "outer":
|
|
3371
3399
|
return {
|
|
3372
3400
|
type: "outer",
|
|
3373
|
-
primary:
|
|
3374
|
-
secondary: o.secondary.map((e) =>
|
|
3401
|
+
primary: Y(o.primary),
|
|
3402
|
+
secondary: o.secondary.map((e) => Y(e))
|
|
3375
3403
|
};
|
|
3376
3404
|
default:
|
|
3377
3405
|
D(o);
|
|
3378
3406
|
}
|
|
3379
3407
|
}
|
|
3380
|
-
function
|
|
3408
|
+
function Fs(o) {
|
|
3381
3409
|
const e = he("sha256");
|
|
3382
|
-
return e.update(o.pFrameHandle), e.update(
|
|
3410
|
+
return e.update(o.pFrameHandle), e.update(je(o.def)), e.digest().toString("hex");
|
|
3383
3411
|
}
|
|
3384
|
-
function
|
|
3412
|
+
function Bs(o) {
|
|
3385
3413
|
const e = o.map((s) => s.id).sort(), t = he("sha256");
|
|
3386
3414
|
let r = "";
|
|
3387
3415
|
for (const s of e)
|
|
3388
3416
|
r !== s && (t.update(s), r = s);
|
|
3389
3417
|
return t.digest().toString("hex");
|
|
3390
3418
|
}
|
|
3391
|
-
function
|
|
3419
|
+
function Rs(o) {
|
|
3392
3420
|
const e = /* @__PURE__ */ new Map();
|
|
3393
3421
|
return ae(o, e), [...e.values()];
|
|
3394
3422
|
}
|
|
@@ -3409,33 +3437,33 @@ function ae(o, e) {
|
|
|
3409
3437
|
D(o);
|
|
3410
3438
|
}
|
|
3411
3439
|
}
|
|
3412
|
-
async function
|
|
3440
|
+
async function Os(o, e, t) {
|
|
3413
3441
|
const r = { ...Lt, ...t };
|
|
3414
|
-
|
|
3415
|
-
const s = new dt(r.localSecret), n =
|
|
3442
|
+
Ds(e, r);
|
|
3443
|
+
const s = new dt(r.localSecret), n = pr(e, o, r.platformLocalStorageNameToPath), i = hr(o, e), a = fr(o, e), c = gr(o, e), u = mr(o, e), l = new vr(
|
|
3416
3444
|
e,
|
|
3417
3445
|
n,
|
|
3418
3446
|
i,
|
|
3419
3447
|
r.blobDownloadPath,
|
|
3420
3448
|
s,
|
|
3421
3449
|
r.blobDriverOps
|
|
3422
|
-
), p = new
|
|
3450
|
+
), p = new yr(
|
|
3423
3451
|
e,
|
|
3424
3452
|
s,
|
|
3425
3453
|
a,
|
|
3426
|
-
|
|
3454
|
+
c,
|
|
3427
3455
|
r.uploadDriverOps
|
|
3428
|
-
),
|
|
3456
|
+
), f = new br(i, r.logStreamDriverOps), h = new wr(f, l), y = new Sr(e, u, o, s, r.localStorageNameToPath), O = new Ps(l);
|
|
3429
3457
|
return {
|
|
3430
3458
|
blobDriver: l,
|
|
3431
|
-
logDriver:
|
|
3432
|
-
lsDriver:
|
|
3459
|
+
logDriver: h,
|
|
3460
|
+
lsDriver: y,
|
|
3433
3461
|
signer: s,
|
|
3434
3462
|
uploadDriver: p,
|
|
3435
|
-
pFrameDriver:
|
|
3463
|
+
pFrameDriver: O
|
|
3436
3464
|
};
|
|
3437
3465
|
}
|
|
3438
|
-
function
|
|
3466
|
+
function Ds(o, e) {
|
|
3439
3467
|
e.localStorageNameToPath.local != gt.homedir() && o.warn(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
|
|
3440
3468
|
const t = Object.keys(e.platformLocalStorageNameToPath), r = Object.keys(e.localStorageNameToPath).find(
|
|
3441
3469
|
(s) => t.includes(s)
|
|
@@ -3464,16 +3492,16 @@ class Jt {
|
|
|
3464
3492
|
// Project List Manipulation
|
|
3465
3493
|
//
|
|
3466
3494
|
/** Creates a project with initial state and adds it to project list. */
|
|
3467
|
-
async createProject(e, t =
|
|
3495
|
+
async createProject(e, t = Q()) {
|
|
3468
3496
|
const r = await this.pl.withWriteTx("MLCreateProject", async (s) => {
|
|
3469
|
-
const n = await
|
|
3470
|
-
return s.createField(S(this.projectListResourceId, t), "Dynamic", n), await s.commit(), await
|
|
3497
|
+
const n = await ko(s, e);
|
|
3498
|
+
return s.createField(S(this.projectListResourceId, t), "Dynamic", n), await s.commit(), await sr(n);
|
|
3471
3499
|
});
|
|
3472
3500
|
return await this.projectListTree.refreshState(), r;
|
|
3473
3501
|
}
|
|
3474
3502
|
/** Updates project metadata */
|
|
3475
3503
|
async setProjectMeta(e, t, r) {
|
|
3476
|
-
await
|
|
3504
|
+
await I(this.pl, e, r, async (s) => {
|
|
3477
3505
|
s.setMeta(t);
|
|
3478
3506
|
}), await this.projectListTree.refreshState();
|
|
3479
3507
|
}
|
|
@@ -3530,67 +3558,72 @@ class Jt {
|
|
|
3530
3558
|
}
|
|
3531
3559
|
/** Initialize middle layer */
|
|
3532
3560
|
static async init(e, t) {
|
|
3533
|
-
const r = { ...
|
|
3534
|
-
const
|
|
3535
|
-
h.createField(
|
|
3536
|
-
const
|
|
3537
|
-
if (ce(
|
|
3538
|
-
const
|
|
3539
|
-
return h.lock(
|
|
3561
|
+
const r = { ...bs, ...t }, s = await e.withWriteTx("MLInitialization", async (h) => {
|
|
3562
|
+
const y = S(h.clientRoot, $r);
|
|
3563
|
+
h.createField(y, "Dynamic");
|
|
3564
|
+
const O = await h.getField(y);
|
|
3565
|
+
if (ce(O.value)) {
|
|
3566
|
+
const A = h.createEphemeral(wt);
|
|
3567
|
+
return h.lock(A), h.setField(y, A), await h.commit(), await A.globalId;
|
|
3540
3568
|
} else
|
|
3541
|
-
return
|
|
3542
|
-
}), n = new
|
|
3569
|
+
return O.value;
|
|
3570
|
+
}), n = new qt(console), i = await Os(e, n, r), a = new jr(e.httpDispatcher), c = new go(
|
|
3571
|
+
a,
|
|
3572
|
+
i.signer,
|
|
3573
|
+
e.httpDispatcher
|
|
3574
|
+
), u = new kr(
|
|
3543
3575
|
n,
|
|
3544
3576
|
e.httpDispatcher,
|
|
3545
3577
|
r.frontendDownloadPath
|
|
3546
|
-
),
|
|
3578
|
+
), l = {
|
|
3547
3579
|
pl: e,
|
|
3548
3580
|
signer: i.signer,
|
|
3549
3581
|
ops: r,
|
|
3550
|
-
bpPreparer:
|
|
3582
|
+
bpPreparer: c,
|
|
3551
3583
|
frontendDownloadDriver: u,
|
|
3552
3584
|
driverKit: i,
|
|
3553
|
-
blockUpdateWatcher: new
|
|
3585
|
+
blockUpdateWatcher: new ks({
|
|
3554
3586
|
minDelay: r.devBlockUpdateRecheckInterval,
|
|
3555
3587
|
http: e.httpDispatcher
|
|
3556
3588
|
}),
|
|
3557
|
-
quickJs: await
|
|
3558
|
-
},
|
|
3589
|
+
quickJs: await lr()
|
|
3590
|
+
}, p = new ar([]), f = await Hr(e, s, p, l);
|
|
3559
3591
|
return new Jt(
|
|
3560
|
-
|
|
3592
|
+
l,
|
|
3561
3593
|
i,
|
|
3562
3594
|
i.signer,
|
|
3563
3595
|
s,
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3596
|
+
p,
|
|
3597
|
+
f.tree,
|
|
3598
|
+
f.computable
|
|
3567
3599
|
);
|
|
3568
3600
|
}
|
|
3569
3601
|
}
|
|
3570
3602
|
export {
|
|
3571
|
-
|
|
3572
|
-
|
|
3603
|
+
Qs as BlockPackRegistry,
|
|
3604
|
+
Zs as CentralBlockRegistry,
|
|
3573
3605
|
Lt as DefaultDriverKitOps,
|
|
3574
|
-
|
|
3606
|
+
bs as DefaultMiddleLayerOps,
|
|
3575
3607
|
Ct as FrontendFromFolderResourceType,
|
|
3576
3608
|
kt as FrontendFromUrlResourceType,
|
|
3577
3609
|
Jt as MiddleLayer,
|
|
3578
3610
|
Je as Project,
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3611
|
+
to as TengoTemplateGet,
|
|
3612
|
+
ro as TengoTemplateGetRegistry,
|
|
3613
|
+
so as TengoTemplateGetTemplate,
|
|
3614
|
+
oo as TengoTemplateGetTemplateURI,
|
|
3615
|
+
no as TengoTemplatePack,
|
|
3616
|
+
io as TengoTemplatePackConvert,
|
|
3617
|
+
co as TengoTemplatePackConvertTemplate,
|
|
3618
|
+
ao as TengoTemplatePackConvertTemplatePack,
|
|
3619
|
+
en as V1CentralDevSnapshotRegistry,
|
|
3620
|
+
Xs as V1CentralRegistry,
|
|
3621
|
+
jr as V2RegistryProvider,
|
|
3589
3622
|
St as createRenderTemplate,
|
|
3590
3623
|
vt as getDevV1PacketMtime,
|
|
3591
3624
|
Ae as getDevV2PacketMtime,
|
|
3592
|
-
|
|
3625
|
+
Os as initDriverKit,
|
|
3593
3626
|
Ve as loadTemplate,
|
|
3594
|
-
|
|
3627
|
+
uo as prepareTemplateSpec
|
|
3595
3628
|
};
|
|
3596
3629
|
//# sourceMappingURL=index.mjs.map
|