@milaboratories/pl-middle-layer 1.11.6 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,33 +1,33 @@
1
1
  var Gt = Object.defineProperty;
2
2
  var Ht = (o, e, t) => e in o ? Gt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
3
  var d = (o, e, t) => Ht(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { executePSpecPredicate as _t, mapPObjectData as Q, mapValueInVOE as Wt, mapPTableDef as dt, isFunctionHandle as pt, normalizeBlockConfig as Ee, DefaultNavigationState as zt } from "@platforma-sdk/model";
4
+ import { executePSpecPredicate as _t, mapPObjectData as Q, mapValueInVOE as Wt, mapPTableDef as dt, isFunctionHandle as pt, normalizeBlockConfig as Te, DefaultNavigationState as zt } from "@platforma-sdk/model";
5
5
  export * from "@platforma-sdk/model";
6
6
  import { blockPackIdEquals as ve } from "@milaboratories/pl-model-middle-layer";
7
7
  export * from "@milaboratories/pl-model-middle-layer";
8
8
  import { request as G, RetryAgent as Yt } from "undici";
9
9
  import { RegistryV1 as H, tryLoadPackDescription as ht, BlockPackMetaEmbedAbsoluteBytes as qt, RegistryV2Reader as Qt, folderReaderByUrl as Zt, loadPackDescription as ze } from "@platforma-sdk/block-tools";
10
- import E from "node:fs";
10
+ import T from "node:fs";
11
11
  import I from "node:path";
12
12
  import Xt from "yaml";
13
- import { assertNever as O, notEmpty as w, ConsoleLoggerAdapter as er, HmacSha256Signer as gt } from "@milaboratories/ts-helpers";
13
+ import { assertNever as O, notEmpty as w, ConsoleLoggerAdapter as er, ConcurrencyLimitingExecutor as tr, HmacSha256Signer as gt } from "@milaboratories/ts-helpers";
14
14
  import * as ft from "node:fs/promises";
15
- import { tryResolve as tr } from "@milaboratories/resolve-helper";
16
- import { resourceTypesEqual as U, field as S, Pl as b, PlClient as rr, isNullResourceId as Y, ensureResourceIdNotNull as ke, isResource as or, isResourceRef as sr, isNotNullResourceId as ue, resourceType as re, resourceTypeToString as nr, resourceIdToString as mt, isNotFoundError as ir, isTimeoutOrCancelError as ar, toGlobalResourceId as cr } from "@milaboratories/pl-client";
15
+ import { tryResolve as rr } from "@milaboratories/resolve-helper";
16
+ import { resourceTypesEqual as U, field as S, Pl as b, PlClient as or, isNullResourceId as Y, ensureResourceIdNotNull as ke, isResource as sr, isResourceRef as nr, isNotNullResourceId as ue, resourceType as re, resourceTypeToString as ir, resourceIdToString as mt, isNotFoundError as ar, isTimeoutOrCancelError as cr, toGlobalResourceId as ur } from "@milaboratories/pl-client";
17
17
  export * from "@milaboratories/pl-client";
18
- import { SynchronizedTreeState as vt, PlError as ur } from "@milaboratories/pl-tree";
19
- import { Computable as P, ChangeSource as Ye, PollComputablePool as lr, WatchableValue as dr } from "@milaboratories/computable";
18
+ import { SynchronizedTreeState as vt, PlError as lr } from "@milaboratories/pl-tree";
19
+ import { Computable as P, ChangeSource as Ye, PollComputablePool as dr, WatchableValue as pr } from "@milaboratories/computable";
20
20
  import { randomUUID as X, createHash as ge } from "node:crypto";
21
21
  import yt from "denque";
22
- import { Templates as pr } from "@platforma-sdk/workflow-tengo";
22
+ import { Templates as hr } from "@platforma-sdk/workflow-tengo";
23
23
  import Ae from "canonicalize";
24
- import hr from "node:assert";
25
- import { Scope as Ce, getQuickJS as gr } from "quickjs-emscripten";
26
- import { setTimeout as fr } from "node:timers/promises";
24
+ import gr from "node:assert";
25
+ import { Scope as Ce, getQuickJS as fr } from "quickjs-emscripten";
26
+ import { setTimeout as mr } from "node:timers/promises";
27
27
  import * as bt from "node:os";
28
- import { createDownloadClient as mr, createLogsClient as vr, createUploadBlobClient as yr, createUploadProgressClient as br, createLsFilesClient as wr, DownloadDriver as Sr, UploadDriver as kr, LogsStreamDriver as Cr, LogsDriver as Pr, LsDriver as Fr, DownloadUrlDriver as Br } from "@milaboratories/pl-drivers";
29
- import { PFrame as Rr } from "@milaboratories/pframes-node";
30
- import { LRUCache as Or } from "lru-cache";
28
+ import { createDownloadClient as vr, createLogsClient as yr, createUploadBlobClient as br, createUploadProgressClient as wr, createLsFilesClient as Sr, DownloadDriver as kr, UploadDriver as Cr, LogsStreamDriver as Pr, LogsDriver as Fr, LsDriver as Br, DownloadUrlDriver as Rr } from "@milaboratories/pl-drivers";
29
+ import { PFrame as Or } from "@milaboratories/pframes-node";
30
+ import { LRUCache as Dr } from "lru-cache";
31
31
  async function qe(o) {
32
32
  try {
33
33
  return await ft.stat(o, { bigint: !0 });
@@ -37,45 +37,45 @@ async function qe(o) {
37
37
  throw e;
38
38
  }
39
39
  }
40
- const Dr = [H.PlPackageYamlConfigFile], xr = [H.PlPackageJsonConfigFile], Ie = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ne = ["config", "dist", "config.json"], wt = ["frontend", "dist"], Qe = "block-model/dist/config.json", jr = "block-ui/package.json", Tr = [
40
+ const xr = [H.PlPackageYamlConfigFile], jr = [H.PlPackageJsonConfigFile], Ie = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ne = ["config", "dist", "config.json"], wt = ["frontend", "dist"], Qe = "block-model/dist/config.json", Er = "block-ui/package.json", Tr = [
41
41
  Ie,
42
42
  Ne,
43
- Dr,
44
43
  xr,
44
+ jr,
45
45
  wt
46
46
  ];
47
- async function Er(o) {
47
+ async function Ar(o) {
48
48
  return await qe(I.join(o, ...Ne)) !== void 0 || await qe(I.join(o, ...Ie)) !== void 0;
49
49
  }
50
50
  function ye(o, e) {
51
- const t = tr(o, e);
51
+ const t = rr(o, e);
52
52
  if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
53
53
  return t;
54
54
  }
55
55
  async function Ze(o, e) {
56
- if (I.isAbsolute(o) || (o = I.resolve(o)), await Er(o))
56
+ if (I.isAbsolute(o) || (o = I.resolve(o)), await Ar(o))
57
57
  return {
58
58
  workflow: I.join(o, ...Ie),
59
59
  config: I.join(o, ...Ne),
60
60
  ui: I.join(o, ...wt)
61
61
  };
62
62
  {
63
- const t = ye(o, Qe), r = ye(o, Qe), s = ye(o, jr);
63
+ const t = ye(o, Qe), r = ye(o, Qe), s = ye(o, Er);
64
64
  return { workflow: t, config: r, ui: I.resolve(s, "..", "dist") };
65
65
  }
66
66
  }
67
- async function Ar(o) {
67
+ async function Ir(o) {
68
68
  try {
69
- return await E.promises.readFile(o, "utf8");
69
+ return await T.promises.readFile(o, "utf8");
70
70
  } catch (e) {
71
71
  if (e.code === "ENOENT")
72
72
  return;
73
73
  throw e;
74
74
  }
75
75
  }
76
- async function Ir(o) {
76
+ async function Nr(o) {
77
77
  try {
78
- return await E.promises.stat(o, { bigint: !0 });
78
+ return await T.promises.stat(o, { bigint: !0 });
79
79
  } catch (e) {
80
80
  if (e.code === "ENOENT")
81
81
  return;
@@ -85,18 +85,18 @@ async function Ir(o) {
85
85
  async function St(o) {
86
86
  let e = 0n;
87
87
  for (const t of Tr) {
88
- const r = I.join(o, ...t), s = await Ir(r);
88
+ const r = I.join(o, ...t), s = await Nr(r);
89
89
  s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
90
90
  }
91
91
  return e.toString();
92
92
  }
93
93
  async function Ve(o) {
94
- const e = await E.promises.stat(o.components.workflow.main.file, {
94
+ const e = await T.promises.stat(o.components.workflow.main.file, {
95
95
  bigint: !0
96
- }), t = await E.promises.stat(o.components.model.file, { bigint: !0 });
96
+ }), t = await T.promises.stat(o.components.model.file, { bigint: !0 });
97
97
  return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
98
98
  }
99
- class cn {
99
+ class un {
100
100
  constructor(e, t, r) {
101
101
  this.v2Provider = e, this.registries = t, this.http = r;
102
102
  }
@@ -140,9 +140,9 @@ class cn {
140
140
  registryId: e.id
141
141
  }));
142
142
  case "local-dev":
143
- for (const a of await E.promises.readdir(r.path, { withFileTypes: !0 })) {
143
+ for (const a of await T.promises.readdir(r.path, { withFileTypes: !0 })) {
144
144
  if (!a.isDirectory()) continue;
145
- const c = I.join(r.path, a.name), u = await Ar(
145
+ const c = I.join(r.path, a.name), u = await Ir(
146
146
  I.join(c, H.PlPackageYamlConfigFile)
147
147
  );
148
148
  if (u !== void 0) {
@@ -199,7 +199,7 @@ class cn {
199
199
  return { registries: t, blockPacks: e };
200
200
  }
201
201
  }
202
- class Nr {
202
+ class Vr {
203
203
  constructor(e) {
204
204
  d(this, "registries", /* @__PURE__ */ new Map());
205
205
  this.http = e;
@@ -211,58 +211,58 @@ class Nr {
211
211
  return this.registries.set(e, r), r;
212
212
  }
213
213
  }
214
- const un = {
214
+ const ln = {
215
215
  type: "remote-v2",
216
216
  url: "https://blocks.pl-open.science/"
217
- }, ln = {
217
+ }, dn = {
218
218
  type: "remote-v1",
219
219
  url: "https://block.registry.platforma.bio/releases"
220
- }, dn = {
220
+ }, pn = {
221
221
  type: "remote-v1",
222
222
  url: "https://block.registry.platforma.bio/dev"
223
- }, Vr = {
224
- groups: [{ id: "default", label: "Default", blocks: [] }]
225
223
  }, Lr = {
224
+ groups: [{ id: "default", label: "Default", blocks: [] }]
225
+ }, Jr = {
226
226
  stagingRefreshTimestamp: 0,
227
227
  blocksInLimbo: []
228
- }, Jr = {
228
+ }, Mr = {
229
229
  label: "New Project"
230
- }, Mr = { name: "UserProject", version: "2" }, kt = "SchemaVersion", Ct = "1", Le = "ProjectCreated", ee = "ProjectLastModified", te = "ProjectMeta", _ = "ProjectStructure", le = "BlockRenderingState", Kr = "BlockFrontendState/", Ur = /^BlockFrontendState\/(?<blockid>.*)$/;
230
+ }, Kr = { name: "UserProject", version: "2" }, kt = "SchemaVersion", Ct = "1", Le = "ProjectCreated", ee = "ProjectLastModified", te = "ProjectMeta", _ = "ProjectStructure", le = "BlockRenderingState", Ur = "BlockFrontendState/", $r = /^BlockFrontendState\/(?<blockid>.*)$/;
231
231
  function Pe(o) {
232
- return `${Kr}${o}`;
232
+ return `${Ur}${o}`;
233
233
  }
234
- const $r = "BlockArgsAuthor/";
234
+ const Gr = "BlockArgsAuthor/";
235
235
  function Fe(o) {
236
- return `${$r}${o}`;
236
+ return `${Gr}${o}`;
237
237
  }
238
238
  const Be = "ProjectStructureAuthor";
239
- function Gr(o) {
240
- const e = o.match(Ur);
239
+ function Hr(o) {
240
+ const e = o.match($r);
241
241
  if (e !== null)
242
242
  return e.groups.blockid;
243
243
  }
244
- const Hr = "__serviceTemplate_";
244
+ const _r = "__serviceTemplate_";
245
245
  function Re(o) {
246
- return `${Hr}${o}`;
246
+ return `${_r}${o}`;
247
247
  }
248
248
  function C(o, e) {
249
249
  return `${o}-${e}`;
250
250
  }
251
- const _r = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
252
- function Wr(o) {
253
- const e = o.match(_r);
251
+ const Wr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
252
+ function zr(o) {
253
+ const e = o.match(Wr);
254
254
  if (e === null) return;
255
255
  const { blockId: t, fieldName: r } = e.groups;
256
256
  return { blockId: t, fieldName: r };
257
257
  }
258
- const zr = "projects", Pt = { name: "Projects", version: "1" }, Yr = (o) => U(o.type, Pt) ? o.fields : [];
259
- async function qr(o, e, t, r) {
258
+ const Yr = "projects", Pt = { name: "Projects", version: "1" }, qr = (o) => U(o.type, Pt) ? o.fields : [];
259
+ async function Qr(o, e, t, r) {
260
260
  const s = await vt.init(
261
261
  o,
262
262
  e,
263
263
  {
264
264
  ...r.ops.defaultTreeOptions,
265
- pruning: Yr
265
+ pruning: qr
266
266
  },
267
267
  r.logger
268
268
  );
@@ -286,45 +286,45 @@ async function qr(o, e, t, r) {
286
286
  return u.sort((l) => -l.lastModified.valueOf()), u;
287
287
  }).withStableType(), tree: s };
288
288
  }
289
- const Qr = {
289
+ const Zr = {
290
290
  name: "EphRenderTemplate",
291
291
  version: "1"
292
- }, Zr = {
292
+ }, Xr = {
293
293
  name: "RenderTemplate",
294
294
  version: "1"
295
295
  };
296
296
  function Ft(o, e, t, r, s) {
297
297
  if (s.length === 0) throw new Error("Zero output names provided");
298
- const n = t ? o.createEphemeral(Qr) : o.createStruct(Zr), i = S(n, "template"), a = S(n, "inputs");
298
+ const n = t ? o.createEphemeral(Zr) : o.createStruct(Xr), i = S(n, "template"), a = S(n, "inputs");
299
299
  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/");
300
300
  }
301
- const Xr = { name: "BContextEnd", version: "1" }, eo = { name: "BContext", version: "1" }, to = "id", ro = "parent/", oo = ["context", "result"];
301
+ const eo = { name: "BContextEnd", version: "1" }, to = { name: "BContext", version: "1" }, ro = "id", oo = "parent/", so = ["context", "result"];
302
302
  function Xe(o, e, t) {
303
- return Ft(o, e, !0, t, oo);
303
+ return Ft(o, e, !0, t, so);
304
304
  }
305
- function so(o) {
306
- const e = o.createEphemeral(Xr);
305
+ function no(o) {
306
+ const e = o.createEphemeral(eo);
307
307
  return o.lock(e), e;
308
308
  }
309
- function no(o, e) {
310
- if (e.length === 0) return so(o);
309
+ function io(o, e) {
310
+ if (e.length === 0) return no(o);
311
311
  if (e.length === 1) return e[0];
312
- const t = o.createEphemeral(eo);
313
- o.createField(S(t, to), "Input", b.createPlString(o, X()));
312
+ const t = o.createEphemeral(to);
313
+ o.createField(S(t, ro), "Input", b.createPlString(o, X()));
314
314
  for (let r = 0; r < e.length; r++)
315
- o.createField(S(t, `${ro}${r}`), "Input", e[r]);
315
+ o.createField(S(t, `${oo}${r}`), "Input", e[r]);
316
316
  return o.lock(t), t;
317
317
  }
318
- const io = { name: "TengoTemplateGet", version: "1" }, ao = "registry", co = "templateURI", uo = "template", lo = { name: "TengoTemplatePack", version: "1" }, po = {
318
+ const ao = { name: "TengoTemplateGet", version: "1" }, co = "registry", uo = "templateURI", lo = "template", po = { name: "TengoTemplatePack", version: "1" }, ho = {
319
319
  name: "TengoTemplatePackConvert",
320
320
  version: "1"
321
- }, ho = "templatePack", go = "template";
322
- async function fo(o) {
321
+ }, go = "templatePack", fo = "template";
322
+ async function mo(o) {
323
323
  switch (o.type) {
324
324
  case "from-file":
325
325
  return {
326
326
  type: "explicit",
327
- content: await E.promises.readFile(o.path)
327
+ content: await T.promises.readFile(o.path)
328
328
  };
329
329
  case "from-registry":
330
330
  case "explicit":
@@ -333,20 +333,20 @@ async function fo(o) {
333
333
  return O(o);
334
334
  }
335
335
  }
336
- function mo(o, e) {
337
- const t = o.createStruct(io), r = S(t, ao), s = S(t, co), n = S(t, uo);
336
+ function vo(o, e) {
337
+ const t = o.createStruct(ao), r = S(t, co), s = S(t, uo), n = S(t, lo);
338
338
  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;
339
339
  }
340
- function vo(o, e) {
341
- const t = o.createValue(lo, e.content), r = o.createStruct(po), s = S(r, ho), n = S(r, go);
340
+ function yo(o, e) {
341
+ const t = o.createValue(po, e.content), r = o.createStruct(ho), s = S(r, go), n = S(r, fo);
342
342
  return o.setField(s, t), n;
343
343
  }
344
344
  function Je(o, e) {
345
345
  switch (e.type) {
346
346
  case "from-registry":
347
- return mo(o, e);
348
- case "explicit":
349
347
  return vo(o, e);
348
+ case "explicit":
349
+ return yo(o, e);
350
350
  default:
351
351
  return O(e);
352
352
  }
@@ -355,7 +355,7 @@ const Bt = { name: "Frontend/FromUrl", version: "1" }, Rt = {
355
355
  name: "Frontend/FromFolder",
356
356
  version: "1"
357
357
  };
358
- function yo(o, e) {
358
+ function bo(o, e) {
359
359
  switch (e.type) {
360
360
  case "url":
361
361
  return o.createValue(
@@ -374,11 +374,11 @@ function yo(o, e) {
374
374
  return O(e);
375
375
  }
376
376
  }
377
- const bo = { name: "BlockPackCustom", version: "1" }, Ot = "template", Dt = "frontend";
377
+ const wo = { name: "BlockPackCustom", version: "1" }, Ot = "template", Dt = "frontend";
378
378
  function et(o) {
379
379
  return o.endsWith("/") ? o : `${o}/`;
380
380
  }
381
- class wo {
381
+ class So {
382
382
  constructor(e, t, r) {
383
383
  this.v2RegistryProvider = e, this.signer = t, this.http = r;
384
384
  }
@@ -387,11 +387,11 @@ class wo {
387
387
  case "explicit":
388
388
  return e.config;
389
389
  case "dev-v1": {
390
- const t = await Ze(e.folder), r = await E.promises.readFile(t.config, { encoding: "utf-8" });
390
+ const t = await Ze(e.folder), r = await T.promises.readFile(t.config, { encoding: "utf-8" });
391
391
  return JSON.parse(r);
392
392
  }
393
393
  case "dev-v2": {
394
- const t = await ze(e.folder), r = await E.promises.readFile(t.components.model.file, {
394
+ const t = await ze(e.folder), r = await T.promises.readFile(t.components.model.file, {
395
395
  encoding: "utf-8"
396
396
  });
397
397
  return JSON.parse(r);
@@ -413,8 +413,8 @@ class wo {
413
413
  case "explicit":
414
414
  return e;
415
415
  case "dev-v1": {
416
- const t = await Ze(e.folder), r = await E.promises.readFile(t.workflow), s = JSON.parse(
417
- await E.promises.readFile(t.config, "utf-8")
416
+ const t = await Ze(e.folder), r = await T.promises.readFile(t.workflow), s = JSON.parse(
417
+ await T.promises.readFile(t.config, "utf-8")
418
418
  ), n = t.ui;
419
419
  return {
420
420
  type: "explicit",
@@ -433,10 +433,10 @@ class wo {
433
433
  }
434
434
  case "dev-v2": {
435
435
  const t = await ze(e.folder), r = JSON.parse(
436
- await E.promises.readFile(t.components.model.file, {
436
+ await T.promises.readFile(t.components.model.file, {
437
437
  encoding: "utf-8"
438
438
  })
439
- ), s = await E.promises.readFile(
439
+ ), s = await T.promises.readFile(
440
440
  t.components.workflow.main.file
441
441
  ), n = t.components.ui.folder, i = { ...e };
442
442
  return e.mtime === void 0 && (i.mtime = await Ve(t)), {
@@ -496,14 +496,14 @@ class wo {
496
496
  }
497
497
  }
498
498
  }
499
- function So(o, e) {
500
- const t = { config: e.config, source: e.source }, r = o.createStruct(bo, JSON.stringify(t));
501
- return o.createField(S(r, Ot), "Input", Je(o, e.template)), o.createField(S(r, Dt), "Input", yo(o, e.frontend)), o.lock(r), r;
499
+ function ko(o, e) {
500
+ const t = { config: e.config, source: e.source }, r = o.createStruct(wo, JSON.stringify(t));
501
+ return o.createField(S(r, Ot), "Input", Je(o, e.template)), o.createField(S(r, Dt), "Input", bo(o, e.frontend)), o.lock(r), r;
502
502
  }
503
503
  function tt(o, e) {
504
504
  switch (e.type) {
505
505
  case "explicit":
506
- return So(o, e);
506
+ return ko(o, e);
507
507
  default:
508
508
  return O(e.type);
509
509
  }
@@ -511,7 +511,7 @@ function tt(o, e) {
511
511
  function ie(o, e) {
512
512
  return { __isRef: !0, blockId: o, name: e };
513
513
  }
514
- function ko(o) {
514
+ function Co(o) {
515
515
  return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
516
516
  }
517
517
  function Oe(o, e, t) {
@@ -527,7 +527,7 @@ function Oe(o, e, t) {
527
527
  return;
528
528
  case "object":
529
529
  if (e === null) return;
530
- if (ko(e))
530
+ if (Co(e))
531
531
  t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
532
532
  else if (Array.isArray(e))
533
533
  for (const s of e) Oe(o, s, t);
@@ -539,7 +539,7 @@ function Oe(o, e, t) {
539
539
  O(r);
540
540
  }
541
541
  }
542
- function Co(o, e) {
542
+ function Po(o, e) {
543
543
  const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
544
544
  return Oe(t, o, e), t;
545
545
  }
@@ -597,7 +597,7 @@ function ae(o, e) {
597
597
  for (const { id: s } of N(o)) {
598
598
  const n = e(s);
599
599
  if (n === void 0) continue;
600
- const i = Co(n, r), a = {
600
+ const i = Po(n, r), a = {
601
601
  id: s,
602
602
  missingReferences: i.missingReferences,
603
603
  upstream: i.upstreams,
@@ -608,7 +608,7 @@ function ae(o, e) {
608
608
  }
609
609
  return new xt(t);
610
610
  }
611
- function Po(o, e) {
611
+ function Fo(o, e) {
612
612
  if (o.size !== e.size) return !1;
613
613
  for (const t of o) if (!e.has(t)) return !1;
614
614
  return !0;
@@ -622,7 +622,7 @@ function rt(o, e) {
622
622
  const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
623
623
  return o.nodes.forEach((n) => {
624
624
  const i = e.nodes.get(n.id);
625
- i === void 0 ? t.add(n.id) : (!Po(n.upstream, i.upstream) || xe(n.upstream, s)) && s.add(n.id);
625
+ i === void 0 ? t.add(n.id) : (!Fo(n.upstream, i.upstream) || xe(n.upstream, s)) && s.add(n.id);
626
626
  }), e.nodes.forEach((n) => {
627
627
  o.nodes.has(n.id) ? xe(n.upstream, s) && s.add(n.id) : r.add(n.id);
628
628
  }), { onlyInA: t, onlyInB: r, different: s };
@@ -630,14 +630,14 @@ function rt(o, e) {
630
630
  let be;
631
631
  async function jt() {
632
632
  if (be === void 0) {
633
- const o = await fo(pr["pframes.export-pframe"]);
633
+ const o = await mo(hr["pframes.export-pframe"]);
634
634
  if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
635
635
  const e = ge("sha256").update(o.content).digest("hex");
636
636
  be = { spec: o, hash: e };
637
637
  }
638
638
  return be;
639
639
  }
640
- function Fo(o, e, t) {
640
+ function Bo(o, e, t) {
641
641
  return Ft(o, e, !0, { pf: t }, ["result"]).result;
642
642
  }
643
643
  function we(o, e) {
@@ -714,7 +714,7 @@ class ot {
714
714
  );
715
715
  }
716
716
  }
717
- const Bo = (o) => {
717
+ const Ro = (o) => {
718
718
  throw new Error(`No new block info for ${o}`);
719
719
  };
720
720
  class de {
@@ -857,10 +857,10 @@ class de {
857
857
  if (n.fields[t] === void 0 || n.fields[t].ref === void 0)
858
858
  throw new Error("One of the upstreams staging is not rendered.");
859
859
  r.push(b.unwrapHolder(this.tx, n.fields[t].ref));
860
- }), no(this.tx, r);
860
+ }), io(this.tx, r);
861
861
  }
862
862
  exportCtx(e) {
863
- return Fo(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
863
+ return Bo(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
864
864
  }
865
865
  renderStagingFor(e) {
866
866
  this.resetStaging(e);
@@ -904,7 +904,7 @@ class de {
904
904
  // Structure changes
905
905
  //
906
906
  /** Very generic method, better check for more specialized case-specific methods first. */
907
- updateStructure(e, t = Bo) {
907
+ updateStructure(e, t = Ro) {
908
908
  const r = this.getStagingGraph(), s = this.getActualProductionGraph(), n = De(e), i = ae(
909
909
  e,
910
910
  (u) => {
@@ -1123,7 +1123,7 @@ class de {
1123
1123
  );
1124
1124
  const $ = /* @__PURE__ */ new Map();
1125
1125
  for (const y of p.fields) {
1126
- const R = Wr(y.name);
1126
+ const R = zr(y.name);
1127
1127
  if (R === void 0) continue;
1128
1128
  let F = $.get(R.blockId);
1129
1129
  F === void 0 && (F = {
@@ -1140,16 +1140,16 @@ class de {
1140
1140
  "Dynamic",
1141
1141
  J
1142
1142
  ));
1143
- const z = { stagingRefreshTimestamp: V }, T = new Set(M), x = /* @__PURE__ */ new Map();
1143
+ const z = { stagingRefreshTimestamp: V }, E = new Set(M), x = /* @__PURE__ */ new Map();
1144
1144
  for (const y of oe) {
1145
- const R = Gr(y.key);
1145
+ const R = Hr(y.key);
1146
1146
  R !== void 0 && x.set(R, y.value);
1147
1147
  }
1148
1148
  const B = [];
1149
1149
  $.forEach(({ id: y, fields: R }) => {
1150
1150
  for (const [, F] of Object.entries(R))
1151
1151
  if (F.ref !== void 0) {
1152
- if (!or(F.ref) || sr(F.ref))
1152
+ if (!sr(F.ref) || nr(F.ref))
1153
1153
  throw new Error("unexpected behaviour");
1154
1154
  B.push([F, e.getResourceData(F.ref, !1)]);
1155
1155
  }
@@ -1180,7 +1180,7 @@ class de {
1180
1180
  v,
1181
1181
  D,
1182
1182
  z,
1183
- T,
1183
+ E,
1184
1184
  K,
1185
1185
  x,
1186
1186
  J
@@ -1188,11 +1188,11 @@ class de {
1188
1188
  return ne.fixProblems(), ne;
1189
1189
  }
1190
1190
  }
1191
- async function Ro(o, e = Jr) {
1192
- const t = o.createEphemeral(Mr);
1191
+ async function Oo(o, e = Mr) {
1192
+ const t = o.createEphemeral(Kr);
1193
1193
  o.lock(t);
1194
1194
  const r = String(Date.now());
1195
- o.setKValue(t, kt, JSON.stringify(Ct)), o.setKValue(t, Le, r), o.setKValue(t, ee, r), o.setKValue(t, te, JSON.stringify(e)), o.setKValue(t, _, JSON.stringify(Vr)), o.setKValue(t, le, JSON.stringify(Lr));
1195
+ o.setKValue(t, kt, JSON.stringify(Ct)), o.setKValue(t, Le, r), o.setKValue(t, ee, r), o.setKValue(t, te, JSON.stringify(e)), o.setKValue(t, _, JSON.stringify(Lr)), o.setKValue(t, le, JSON.stringify(Jr));
1196
1196
  const s = await jt();
1197
1197
  return o.createField(
1198
1198
  S(t, Re(s.hash)),
@@ -1204,7 +1204,7 @@ async function Se(o, e, t) {
1204
1204
  return A(o, e, void 0, t);
1205
1205
  }
1206
1206
  async function A(o, e, t, r) {
1207
- if (o instanceof rr)
1207
+ if (o instanceof or)
1208
1208
  return await o.withWriteTx("ProjectAction", async (s) => {
1209
1209
  const n = await de.load(s, e, t), i = await r(n);
1210
1210
  return n.wasModified && (n.save(), await s.commit()), i;
@@ -1214,7 +1214,7 @@ async function A(o, e, t, r) {
1214
1214
  return s.save(), n;
1215
1215
  }
1216
1216
  }
1217
- function* Oo(o) {
1217
+ function* Do(o) {
1218
1218
  switch (o.type) {
1219
1219
  case "Json":
1220
1220
  return;
@@ -1234,7 +1234,7 @@ function st(o, e) {
1234
1234
  Object.entries(o).map(([t, r]) => [t, e(r, t)])
1235
1235
  );
1236
1236
  }
1237
- function Do(o, e) {
1237
+ function xo(o, e) {
1238
1238
  switch (o.type) {
1239
1239
  case "Json":
1240
1240
  return { ...o };
@@ -1252,26 +1252,26 @@ function Do(o, e) {
1252
1252
  O(o);
1253
1253
  }
1254
1254
  }
1255
- const xo = re("PColumnData/JsonPartitioned", "1"), jo = re(
1255
+ const jo = re("PColumnData/JsonPartitioned", "1"), Eo = re(
1256
1256
  "PColumnData/Partitioned/JsonPartitioned",
1257
1257
  "1"
1258
- ), To = re("PColumnData/BinaryPartitioned", "1"), Eo = re(
1258
+ ), To = re("PColumnData/BinaryPartitioned", "1"), Ao = re(
1259
1259
  "PColumnData/Partitioned/BinaryPartitioned",
1260
1260
  "1"
1261
- ), Ao = re("PColumnData/Json", "1");
1262
- function Io(o) {
1261
+ ), Io = re("PColumnData/Json", "1");
1262
+ function No(o) {
1263
1263
  if (!o.getIsReadyOrError()) throw new Error("Data not ready.");
1264
1264
  const e = o.getDataAsJson();
1265
1265
  if (e === void 0)
1266
1266
  throw new Error("unexpected data info structure, no resource data");
1267
- if (U(o.resourceType, Ao)) {
1267
+ if (U(o.resourceType, Io)) {
1268
1268
  const t = e;
1269
1269
  return {
1270
1270
  type: "Json",
1271
1271
  keyLength: t.keyLength,
1272
1272
  data: t.data
1273
1273
  };
1274
- } else if (U(o.resourceType, xo)) {
1274
+ } else if (U(o.resourceType, jo)) {
1275
1275
  const t = e, r = Object.fromEntries(
1276
1276
  o.listInputFields().map((s) => [s, o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo])
1277
1277
  );
@@ -1280,7 +1280,7 @@ function Io(o) {
1280
1280
  partitionKeyLength: t.partitionKeyLength,
1281
1281
  parts: r
1282
1282
  };
1283
- } else if (U(o.resourceType, jo)) {
1283
+ } else if (U(o.resourceType, Eo)) {
1284
1284
  const t = e, r = {};
1285
1285
  for (const s of o.listInputFields()) {
1286
1286
  const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
@@ -1316,7 +1316,7 @@ function Io(o) {
1316
1316
  partitionKeyLength: t.partitionKeyLength,
1317
1317
  parts: r
1318
1318
  };
1319
- } else if (U(o.resourceType, Eo)) {
1319
+ } else if (U(o.resourceType, Ao)) {
1320
1320
  const t = e, r = {};
1321
1321
  for (const s of o.listInputFields()) {
1322
1322
  const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
@@ -1344,13 +1344,13 @@ function Io(o) {
1344
1344
  parts: r
1345
1345
  };
1346
1346
  }
1347
- throw new Error(`unsupported resource type: ${nr(o.resourceType)}`);
1347
+ throw new Error(`unsupported resource type: ${ir(o.resourceType)}`);
1348
1348
  }
1349
- function Tt(o, e) {
1349
+ function Et(o, e) {
1350
1350
  const t = ge("sha256");
1351
1351
  return t.update(Ae(o)), t.update(String(Y(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1352
1352
  }
1353
- function Et(o, e = !0, t = !1, r = "") {
1353
+ function Tt(o, e = !0, t = !1, r = "") {
1354
1354
  var a, c, u;
1355
1355
  const s = /^(?<name>.*)\.(?<type>spec|data)$/, n = /* @__PURE__ */ new Map();
1356
1356
  for (const l of o.listInputFields()) {
@@ -1389,10 +1389,10 @@ function Et(o, e = !0, t = !1, r = "") {
1389
1389
  for (const [, l] of n) l.data === void 0 && (l.hasData = !1);
1390
1390
  return { locked: i, results: n };
1391
1391
  }
1392
- function No(o, e = !0, t = "") {
1392
+ function Vo(o, e = !0, t = "") {
1393
1393
  if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
1394
- const r = Et(o, e, !1, t);
1395
- hr(r.locked);
1394
+ const r = Tt(o, e, !1, t);
1395
+ gr(r.locked);
1396
1396
  const s = {};
1397
1397
  for (const [n, i] of r.results) {
1398
1398
  if (i.spec === void 0) throw new Error(`no spec for key ${n}`);
@@ -1400,9 +1400,9 @@ function No(o, e = !0, t = "") {
1400
1400
  throw new Error(`no data for key ${n}`);
1401
1401
  const a = i.data();
1402
1402
  if (a === void 0) throw new Error(`no data for key ${n}`);
1403
- if (!a.ok) throw new ur(a.error);
1403
+ if (!a.ok) throw new lr(a.error);
1404
1404
  s[n] = {
1405
- id: Tt(i.spec, a.value),
1405
+ id: Et(i.spec, a.value),
1406
1406
  spec: i.spec,
1407
1407
  data: a.value
1408
1408
  };
@@ -1461,7 +1461,7 @@ class Me {
1461
1461
  u !== void 0 ? e.push({
1462
1462
  ref: ie(i, a),
1463
1463
  obj: {
1464
- id: u.ok ? Tt(c.spec, u.value) : void 0,
1464
+ id: u.ok ? Et(c.spec, u.value) : void 0,
1465
1465
  spec: c.spec,
1466
1466
  data: u
1467
1467
  }
@@ -1558,7 +1558,7 @@ class Me {
1558
1558
  function nt(o, e) {
1559
1559
  if (e === void 0)
1560
1560
  return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1561
- if (e.ok) return Et(e.value, !1, !0);
1561
+ if (e.ok) return Tt(e.value, !1, !0);
1562
1562
  }
1563
1563
  function Ke(o, e) {
1564
1564
  const t = o.persist(), r = w(
@@ -1651,7 +1651,7 @@ function* j(o, e) {
1651
1651
  O(o);
1652
1652
  }
1653
1653
  }
1654
- function Vo(o, e) {
1654
+ function Lo(o, e) {
1655
1655
  const t = {};
1656
1656
  for (const [r, s] of Object.entries(o)) t[r] = e(s);
1657
1657
  return t;
@@ -1659,7 +1659,7 @@ function Vo(o, e) {
1659
1659
  function pe(o, e) {
1660
1660
  return o === void 0 ? void 0 : e(o);
1661
1661
  }
1662
- function Lo(o) {
1662
+ function Jo(o) {
1663
1663
  switch (o.type) {
1664
1664
  case "GetImportProgress":
1665
1665
  return !0;
@@ -1667,8 +1667,8 @@ function Lo(o) {
1667
1667
  return !1;
1668
1668
  }
1669
1669
  }
1670
- function Jo(o) {
1671
- for (const e of j(o)) if (Lo(e)) return !0;
1670
+ function Mo(o) {
1671
+ for (const e of j(o)) if (Jo(e)) return !0;
1672
1672
  return !1;
1673
1673
  }
1674
1674
  function fe(o) {
@@ -1680,18 +1680,18 @@ function fe(o) {
1680
1680
  function g(o) {
1681
1681
  return () => fe(o);
1682
1682
  }
1683
- const Mo = (o) => {
1683
+ const Ko = (o) => {
1684
1684
  const e = {};
1685
1685
  for (const [t, r] of Object.entries(o)) e[t] = r;
1686
1686
  return g(e);
1687
- }, Ko = (o) => {
1687
+ }, Uo = (o) => {
1688
1688
  const e = o.source;
1689
1689
  if (e === void 0) return g(void 0);
1690
1690
  const t = [];
1691
1691
  for (const r of e)
1692
1692
  r instanceof Array ? t.push(...r) : t.push(r);
1693
1693
  return g(t);
1694
- }, Uo = (o) => {
1694
+ }, $o = (o) => {
1695
1695
  const e = o.source, t = o.field;
1696
1696
  return e === void 0 || t === void 0 ? g(void 0) : ({ cCtx: r }) => {
1697
1697
  var s;
@@ -1703,7 +1703,7 @@ function It(o, e) {
1703
1703
  for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
1704
1704
  return t;
1705
1705
  }
1706
- function $o(o, e) {
1706
+ function Go(o, e) {
1707
1707
  return (t) => {
1708
1708
  const r = t.source;
1709
1709
  return r === void 0 ? g(void 0) : () => ({
@@ -1720,7 +1720,7 @@ function Nt(o) {
1720
1720
  return g(t);
1721
1721
  };
1722
1722
  }
1723
- function Go(o, e) {
1723
+ function Ho(o, e) {
1724
1724
  return (t) => {
1725
1725
  const r = t.source;
1726
1726
  if (r === void 0) return g(void 0);
@@ -1731,34 +1731,34 @@ function Go(o, e) {
1731
1731
  }
1732
1732
  return () => ({
1733
1733
  type: "ScheduleSubroutine",
1734
- subroutine: Ho,
1734
+ subroutine: _o,
1735
1735
  args: s
1736
1736
  });
1737
1737
  };
1738
1738
  }
1739
- const Ho = (o) => g(o), _o = (o) => {
1739
+ const _o = (o) => g(o), Wo = (o) => {
1740
1740
  const e = o.arg;
1741
1741
  return g(e === void 0 ? void 0 : e.length === 0);
1742
- }, Wo = (o) => {
1742
+ }, zo = (o) => {
1743
1743
  const e = o.operand;
1744
1744
  return g(e === void 0 ? void 0 : !e);
1745
- }, zo = (o) => {
1745
+ }, Yo = (o) => {
1746
1746
  const e = o.operand1, t = o.operand2;
1747
1747
  return g(e === void 0 || t === void 0 ? void 0 : e && t);
1748
- }, Yo = (o) => {
1748
+ }, qo = (o) => {
1749
1749
  const e = o.operand1, t = o.operand2;
1750
1750
  return g(e === void 0 || t === void 0 ? void 0 : e || t);
1751
- }, qo = (o) => {
1751
+ }, Qo = (o) => {
1752
1752
  const e = o.source;
1753
1753
  return e === void 0 ? g(void 0) : ({ cCtx: t }) => {
1754
1754
  var r;
1755
1755
  return fe((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1756
1756
  };
1757
- }, Qo = (o) => {
1757
+ }, Zo = (o) => {
1758
1758
  const e = o.source, t = o.field;
1759
1759
  return g(e === void 0 || t === void 0 ? void 0 : e[t]);
1760
1760
  };
1761
- function Zo(o, e) {
1761
+ function Xo(o, e) {
1762
1762
  return (t) => {
1763
1763
  const r = t.source;
1764
1764
  return r === void 0 ? g(void 0) : ({ cCtx: s }) => {
@@ -1773,13 +1773,13 @@ function Zo(o, e) {
1773
1773
  }
1774
1774
  return {
1775
1775
  type: "ScheduleSubroutine",
1776
- subroutine: Xo,
1776
+ subroutine: es,
1777
1777
  args: i
1778
1778
  };
1779
1779
  };
1780
1780
  };
1781
1781
  }
1782
- const Xo = (o) => g(o), es = (o) => {
1782
+ const es = (o) => g(o), ts = (o) => {
1783
1783
  const e = o.source;
1784
1784
  return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
1785
1785
  type: "ScheduleComputable",
@@ -1793,7 +1793,7 @@ const Xo = (o) => g(o), es = (o) => {
1793
1793
  }
1794
1794
  )
1795
1795
  });
1796
- }, ts = (o) => {
1796
+ }, rs = (o) => {
1797
1797
  const e = o.source;
1798
1798
  return e === void 0 ? g(void 0) : ({ cCtx: t, drivers: r }) => {
1799
1799
  const s = t.accessor(e).node().resourceInfo;
@@ -1804,7 +1804,7 @@ const Xo = (o) => g(o), es = (o) => {
1804
1804
  })
1805
1805
  };
1806
1806
  };
1807
- }, rs = (o) => {
1807
+ }, os = (o) => {
1808
1808
  const e = o.source;
1809
1809
  return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
1810
1810
  type: "ScheduleComputable",
@@ -1820,37 +1820,37 @@ const Xo = (o) => g(o), es = (o) => {
1820
1820
  }
1821
1821
  )
1822
1822
  });
1823
- }, os = (o) => {
1823
+ }, ss = (o) => {
1824
1824
  const e = o.source;
1825
1825
  return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
1826
1826
  type: "ScheduleComputable",
1827
1827
  computable: t.blobDriver.getDownloadedBlob(e)
1828
1828
  });
1829
- }, ss = (o) => {
1829
+ }, ns = (o) => {
1830
1830
  const e = o.source;
1831
1831
  return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
1832
1832
  type: "ScheduleComputable",
1833
1833
  computable: t.blobDriver.getOnDemandBlob(e)
1834
1834
  });
1835
- }, ns = (o) => {
1835
+ }, is = (o) => {
1836
1836
  const e = o.source;
1837
1837
  return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
1838
1838
  type: "ScheduleComputable",
1839
1839
  computable: t.uploadDriver.getProgressId(e)
1840
1840
  });
1841
- }, is = (o) => (e) => {
1841
+ }, as = (o) => (e) => {
1842
1842
  const t = e.source;
1843
1843
  return t === void 0 ? g(void 0) : ({ drivers: r }) => ({
1844
1844
  type: "ScheduleComputable",
1845
1845
  computable: r.logDriver.getLastLogs(t, o)
1846
1846
  });
1847
- }, as = (o) => (e) => {
1847
+ }, cs = (o) => (e) => {
1848
1848
  const t = e.source;
1849
1849
  return t === void 0 ? g(void 0) : ({ drivers: r }) => ({
1850
1850
  type: "ScheduleComputable",
1851
1851
  computable: r.logDriver.getProgressLog(t, o)
1852
1852
  });
1853
- }, cs = (o) => {
1853
+ }, us = (o) => {
1854
1854
  const e = o.source;
1855
1855
  return e === void 0 ? g(void 0) : ({ drivers: t }) => ({
1856
1856
  type: "ScheduleComputable",
@@ -1872,7 +1872,7 @@ function m(o, e) {
1872
1872
  case "GetJsonField":
1873
1873
  return () => ({
1874
1874
  type: "ScheduleSubroutine",
1875
- subroutine: Qo,
1875
+ subroutine: Zo,
1876
1876
  args: {
1877
1877
  source: m(o, e.source),
1878
1878
  field: m(o, e.field)
@@ -1881,7 +1881,7 @@ function m(o, e) {
1881
1881
  case "MapArrayValues":
1882
1882
  return () => ({
1883
1883
  type: "ScheduleSubroutine",
1884
- subroutine: $o(o, e),
1884
+ subroutine: Go(o, e),
1885
1885
  args: {
1886
1886
  source: m(o, e.source)
1887
1887
  }
@@ -1889,7 +1889,7 @@ function m(o, e) {
1889
1889
  case "MapRecordValues":
1890
1890
  return () => ({
1891
1891
  type: "ScheduleSubroutine",
1892
- subroutine: Go(o, e),
1892
+ subroutine: Ho(o, e),
1893
1893
  args: {
1894
1894
  source: m(o, e.source)
1895
1895
  }
@@ -1897,8 +1897,8 @@ function m(o, e) {
1897
1897
  case "MakeObject":
1898
1898
  return () => ({
1899
1899
  type: "ScheduleSubroutine",
1900
- subroutine: Mo,
1901
- args: Vo(e.template, (r) => m(o, r))
1900
+ subroutine: Ko,
1901
+ args: Lo(e.template, (r) => m(o, r))
1902
1902
  });
1903
1903
  case "MakeArray":
1904
1904
  return () => ({
@@ -1909,7 +1909,7 @@ function m(o, e) {
1909
1909
  case "Flatten":
1910
1910
  return () => ({
1911
1911
  type: "ScheduleSubroutine",
1912
- subroutine: Ko,
1912
+ subroutine: Uo,
1913
1913
  args: {
1914
1914
  source: m(o, e.source)
1915
1915
  }
@@ -1917,7 +1917,7 @@ function m(o, e) {
1917
1917
  case "IsEmpty":
1918
1918
  return () => ({
1919
1919
  type: "ScheduleSubroutine",
1920
- subroutine: _o,
1920
+ subroutine: Wo,
1921
1921
  args: {
1922
1922
  arg: m(o, e.arg)
1923
1923
  }
@@ -1925,7 +1925,7 @@ function m(o, e) {
1925
1925
  case "Not":
1926
1926
  return () => ({
1927
1927
  type: "ScheduleSubroutine",
1928
- subroutine: Wo,
1928
+ subroutine: zo,
1929
1929
  args: {
1930
1930
  operand: m(o, e.operand)
1931
1931
  }
@@ -1933,7 +1933,7 @@ function m(o, e) {
1933
1933
  case "And":
1934
1934
  return () => ({
1935
1935
  type: "ScheduleSubroutine",
1936
- subroutine: zo,
1936
+ subroutine: Yo,
1937
1937
  args: {
1938
1938
  operand1: m(o, e.operand1),
1939
1939
  operand2: m(o, e.operand2)
@@ -1942,7 +1942,7 @@ function m(o, e) {
1942
1942
  case "Or":
1943
1943
  return () => ({
1944
1944
  type: "ScheduleSubroutine",
1945
- subroutine: Yo,
1945
+ subroutine: qo,
1946
1946
  args: {
1947
1947
  operand1: m(o, e.operand1),
1948
1948
  operand2: m(o, e.operand2)
@@ -1951,7 +1951,7 @@ function m(o, e) {
1951
1951
  case "MapResourceFields":
1952
1952
  return () => ({
1953
1953
  type: "ScheduleSubroutine",
1954
- subroutine: Zo(o, e),
1954
+ subroutine: Xo(o, e),
1955
1955
  args: {
1956
1956
  source: m(o, e.source)
1957
1957
  }
@@ -1959,7 +1959,7 @@ function m(o, e) {
1959
1959
  case "GetResourceField":
1960
1960
  return () => ({
1961
1961
  type: "ScheduleSubroutine",
1962
- subroutine: Uo,
1962
+ subroutine: $o,
1963
1963
  args: {
1964
1964
  source: m(o, e.source),
1965
1965
  field: m(o, e.field)
@@ -1968,7 +1968,7 @@ function m(o, e) {
1968
1968
  case "GetResourceValueAsJson":
1969
1969
  return () => ({
1970
1970
  type: "ScheduleSubroutine",
1971
- subroutine: qo,
1971
+ subroutine: Qo,
1972
1972
  args: {
1973
1973
  source: m(o, e.source)
1974
1974
  }
@@ -1976,7 +1976,7 @@ function m(o, e) {
1976
1976
  case "GetBlobContent":
1977
1977
  return () => ({
1978
1978
  type: "ScheduleSubroutine",
1979
- subroutine: es,
1979
+ subroutine: ts,
1980
1980
  args: {
1981
1981
  source: m(o, e.source)
1982
1982
  }
@@ -1984,7 +1984,7 @@ function m(o, e) {
1984
1984
  case "GetBlobContentAsString":
1985
1985
  return () => ({
1986
1986
  type: "ScheduleSubroutine",
1987
- subroutine: ts,
1987
+ subroutine: rs,
1988
1988
  args: {
1989
1989
  source: m(o, e.source)
1990
1990
  }
@@ -1992,7 +1992,7 @@ function m(o, e) {
1992
1992
  case "GetBlobContentAsJson":
1993
1993
  return () => ({
1994
1994
  type: "ScheduleSubroutine",
1995
- subroutine: rs,
1995
+ subroutine: os,
1996
1996
  args: {
1997
1997
  source: m(o, e.source)
1998
1998
  }
@@ -2000,7 +2000,7 @@ function m(o, e) {
2000
2000
  case "GetDownloadedBlobContent":
2001
2001
  return () => ({
2002
2002
  type: "ScheduleSubroutine",
2003
- subroutine: os,
2003
+ subroutine: ss,
2004
2004
  args: {
2005
2005
  source: m(o, e.source)
2006
2006
  }
@@ -2008,7 +2008,7 @@ function m(o, e) {
2008
2008
  case "GetOnDemandBlobContent":
2009
2009
  return () => ({
2010
2010
  type: "ScheduleSubroutine",
2011
- subroutine: ss,
2011
+ subroutine: ns,
2012
2012
  args: {
2013
2013
  source: m(o, e.source)
2014
2014
  }
@@ -2016,7 +2016,7 @@ function m(o, e) {
2016
2016
  case "GetImportProgress":
2017
2017
  return () => ({
2018
2018
  type: "ScheduleSubroutine",
2019
- subroutine: ns,
2019
+ subroutine: is,
2020
2020
  args: {
2021
2021
  source: m(o, e.source)
2022
2022
  }
@@ -2024,7 +2024,7 @@ function m(o, e) {
2024
2024
  case "GetLastLogs":
2025
2025
  return () => ({
2026
2026
  type: "ScheduleSubroutine",
2027
- subroutine: is(e.lines),
2027
+ subroutine: as(e.lines),
2028
2028
  args: {
2029
2029
  source: m(o, e.source)
2030
2030
  }
@@ -2032,7 +2032,7 @@ function m(o, e) {
2032
2032
  case "GetProgressLog":
2033
2033
  return () => ({
2034
2034
  type: "ScheduleSubroutine",
2035
- subroutine: as(e.patternToSearch),
2035
+ subroutine: cs(e.patternToSearch),
2036
2036
  args: {
2037
2037
  source: m(o, e.source)
2038
2038
  }
@@ -2040,7 +2040,7 @@ function m(o, e) {
2040
2040
  case "GetLogHandle":
2041
2041
  return () => ({
2042
2042
  type: "ScheduleSubroutine",
2043
- subroutine: cs,
2043
+ subroutine: us,
2044
2044
  args: {
2045
2045
  source: m(o, e.source)
2046
2046
  }
@@ -2049,8 +2049,8 @@ function m(o, e) {
2049
2049
  return O(e);
2050
2050
  }
2051
2051
  }
2052
- const us = ["$prod", "$staging"];
2053
- function ls(o) {
2052
+ const ls = ["$prod", "$staging"];
2053
+ function ds(o) {
2054
2054
  return {
2055
2055
  $blockId: o.blockId,
2056
2056
  $args: JSON.parse(o.args),
@@ -2059,16 +2059,16 @@ function ls(o) {
2059
2059
  $staging: o.staging
2060
2060
  };
2061
2061
  }
2062
- const Vt = Symbol(), Lt = "return", ds = { op: Vt, arg: Lt };
2063
- function ps(o) {
2062
+ const Vt = Symbol(), Lt = "return", ps = { op: Vt, arg: Lt };
2063
+ function hs(o) {
2064
2064
  return o.op == Vt && o.arg == Lt;
2065
2065
  }
2066
- function hs() {
2066
+ function gs() {
2067
2067
  return { pendingSubroutines: /* @__PURE__ */ new Map() };
2068
2068
  }
2069
2069
  function it(o, e, t, r) {
2070
2070
  const s = new yt(t), n = (a, c) => {
2071
- if (ps(a))
2071
+ if (hs(a))
2072
2072
  return e.result = c, !1;
2073
2073
  const u = w(e.pendingSubroutines.get(a.op));
2074
2074
  if (a.arg in u.args) throw new Error("argument already set");
@@ -2119,23 +2119,23 @@ function it(o, e, t, r) {
2119
2119
  return i;
2120
2120
  }
2121
2121
  function Jt(o, e, t, r = {}) {
2122
- return Mt(o, ls(e), t, r);
2122
+ return Mt(o, ds(e), t, r);
2123
2123
  }
2124
2124
  function Mt(o, e, t, r = {}) {
2125
2125
  const s = Ae({
2126
- ctx: Object.fromEntries(Object.entries(e).filter(([n]) => us.indexOf(n) === -1)),
2126
+ ctx: Object.fromEntries(Object.entries(e).filter(([n]) => ls.indexOf(n) === -1)),
2127
2127
  cfg: t
2128
2128
  });
2129
2129
  return P.makeRaw(
2130
2130
  (n) => {
2131
- const i = { drivers: o, cCtx: n }, a = hs();
2131
+ const i = { drivers: o, cCtx: n }, a = gs();
2132
2132
  return {
2133
2133
  ir: it(
2134
2134
  i,
2135
2135
  a,
2136
2136
  [
2137
2137
  {
2138
- destination: ds,
2138
+ destination: ps,
2139
2139
  operation: m(e, t)
2140
2140
  }
2141
2141
  ],
@@ -2166,7 +2166,7 @@ function Mt(o, e, t, r = {}) {
2166
2166
  { ...r, key: s }
2167
2167
  );
2168
2168
  }
2169
- function gs(o) {
2169
+ function fs(o) {
2170
2170
  return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
2171
2171
  }
2172
2172
  function at(o) {
@@ -2296,7 +2296,7 @@ class he {
2296
2296
  parsePObjectCollection(e, t, r) {
2297
2297
  const s = this.getAccessor(e);
2298
2298
  if (!s.getIsReadyOrError()) return;
2299
- const n = No(s, t, r), i = {};
2299
+ const n = Vo(s, t, r), i = {};
2300
2300
  for (const [a, c] of Object.entries(n))
2301
2301
  i[a] = Q(c, (u) => this.wrapAccessor(u));
2302
2302
  return i;
@@ -2501,7 +2501,7 @@ class he {
2501
2501
  r = this.vm.null;
2502
2502
  break;
2503
2503
  }
2504
- if (gs(e)) {
2504
+ if (fs(e)) {
2505
2505
  r = this.vm.newArrayBuffer(e), s = !0;
2506
2506
  break;
2507
2507
  }
@@ -2603,7 +2603,7 @@ class he {
2603
2603
  });
2604
2604
  }
2605
2605
  }
2606
- function fs(o, e, t, r, s = {}) {
2606
+ function ms(o, e, t, r, s = {}) {
2607
2607
  return P.makeRaw((n) => {
2608
2608
  const i = new Ce();
2609
2609
  n.addOnDestroy(() => i.dispose());
@@ -2624,10 +2624,10 @@ function fs(o, e, t, r, s = {}) {
2624
2624
  function je(o, e, t, r, s = {}) {
2625
2625
  if (pt(t)) {
2626
2626
  if (r === void 0) throw new Error("No code bundle.");
2627
- return fs(o, e, t, r, s);
2627
+ return ms(o, e, t, r, s);
2628
2628
  } else return Jt(o.driverKit, e, t, s);
2629
2629
  }
2630
- function ms(o, e, t) {
2630
+ function vs(o, e, t) {
2631
2631
  return P.make(
2632
2632
  (r) => {
2633
2633
  var v, D, V, M, oe, $, W, se;
@@ -2641,12 +2641,12 @@ function ms(o, e, t) {
2641
2641
  errorIfFieldNotSet: !0
2642
2642
  });
2643
2643
  let z;
2644
- const T = s.traverse({
2644
+ const E = s.traverse({
2645
2645
  field: C(k, "prodArgs"),
2646
2646
  assertFieldType: "Dynamic",
2647
2647
  stableIfNotFound: !0
2648
2648
  });
2649
- if (T !== void 0) {
2649
+ if (E !== void 0) {
2650
2650
  const x = s.getField({
2651
2651
  field: C(k, "prodOutput"),
2652
2652
  assertFieldType: "Dynamic",
@@ -2657,8 +2657,8 @@ function ms(o, e, t) {
2657
2657
  errorIfFieldNotFound: !0
2658
2658
  });
2659
2659
  z = {
2660
- arguments: T.getDataAsJson(),
2661
- stale: J.id !== T.id,
2660
+ arguments: E.getDataAsJson(),
2661
+ stale: J.id !== E.id,
2662
2662
  outputError: x.error !== void 0 || B.error !== void 0 || ((v = x.value) == null ? void 0 : v.getError()) !== void 0 || ((D = B.value) == null ? void 0 : D.getError()) !== void 0,
2663
2663
  outputsError: ((V = x.error) == null ? void 0 : V.getDataAsString()) ?? ((oe = (M = x.value) == null ? void 0 : M.getError()) == null ? void 0 : oe.getDataAsString()),
2664
2664
  exportsError: (($ = B.error) == null ? void 0 : $.getDataAsString()) ?? ((se = (W = B.value) == null ? void 0 : W.getError()) == null ? void 0 : se.getDataAsString()),
@@ -2669,9 +2669,9 @@ function ms(o, e, t) {
2669
2669
  }
2670
2670
  const p = ae(c, (k) => l.get(k).currentArguments), h = new Set(u.blocksInLimbo), f = [...N(c)].map(({ id: k, label: J, renderingMode: z }) => {
2671
2671
  var $e, Ge, He, _e;
2672
- const T = w(l.get(k)), x = w(p.nodes.get(k));
2672
+ const E = w(l.get(k)), x = w(p.nodes.get(k));
2673
2673
  let B = "NotCalculated";
2674
- T.prod !== void 0 && (h.has(k) ? B = "Limbo" : B = T.prod.finished ? "Done" : "Running");
2674
+ E.prod !== void 0 && (h.has(k) ? B = "Limbo" : B = E.prod.finished ? "Done" : "Running");
2675
2675
  const K = s.traverse(
2676
2676
  {
2677
2677
  field: C(k, "blockPack"),
@@ -2680,7 +2680,7 @@ function ms(o, e, t) {
2680
2680
  },
2681
2681
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2682
2682
  ), L = K == null ? void 0 : K.getDataAsJson(), { sections: ne, inputsValid: y, sdkVersion: R } = pe(L == null ? void 0 : L.config, (me) => {
2683
- const q = Ee(me), We = Ke(s, k);
2683
+ const q = Te(me), We = Ke(s, k);
2684
2684
  return {
2685
2685
  sections: je(
2686
2686
  t,
@@ -2704,14 +2704,14 @@ function ms(o, e, t) {
2704
2704
  id: k,
2705
2705
  label: J,
2706
2706
  renderingMode: z,
2707
- stale: (($e = T.prod) == null ? void 0 : $e.stale) !== !1 || B === "Limbo",
2707
+ stale: (($e = E.prod) == null ? void 0 : $e.stale) !== !1 || B === "Limbo",
2708
2708
  missingReference: x.missingReferences,
2709
2709
  upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
2710
2710
  downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
2711
2711
  calculationStatus: B,
2712
- outputErrors: ((Ge = T.prod) == null ? void 0 : Ge.outputError) === !0,
2713
- outputsError: (He = T.prod) == null ? void 0 : He.outputsError,
2714
- exportsError: (_e = T.prod) == null ? void 0 : _e.exportsError,
2712
+ outputErrors: ((Ge = E.prod) == null ? void 0 : Ge.outputError) === !0,
2713
+ outputsError: (He = E.prod) == null ? void 0 : He.outputsError,
2714
+ exportsError: (_e = E.prod) == null ? void 0 : _e.exportsError,
2715
2715
  sections: ne,
2716
2716
  inputsValid: y,
2717
2717
  currentBlockPack: L == null ? void 0 : L.source,
@@ -2754,10 +2754,10 @@ function Kt(o, e) {
2754
2754
  },
2755
2755
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2756
2756
  )) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
2757
- (s) => Ee(s)
2757
+ (s) => Te(s)
2758
2758
  );
2759
2759
  }
2760
- function vs(o, e) {
2760
+ function ys(o, e) {
2761
2761
  const t = o.node();
2762
2762
  if (U(t.resourceType, Bt)) {
2763
2763
  const r = t.getDataAsJson();
@@ -2774,10 +2774,10 @@ function vs(o, e) {
2774
2774
  } else
2775
2775
  throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
2776
2776
  }
2777
- function ys(o, e) {
2777
+ function bs(o, e) {
2778
2778
  if (o !== void 0)
2779
2779
  return P.make(
2780
- (t) => vs(t.accessor(o), e),
2780
+ (t) => ys(t.accessor(o), e),
2781
2781
  {
2782
2782
  postprocessValue: (t) => {
2783
2783
  if (t !== void 0) {
@@ -2789,7 +2789,7 @@ function ys(o, e) {
2789
2789
  }
2790
2790
  ).withStableType();
2791
2791
  }
2792
- function bs(o, e, t) {
2792
+ function ws(o, e, t) {
2793
2793
  return P.make(
2794
2794
  (r) => {
2795
2795
  var a;
@@ -2801,12 +2801,12 @@ function bs(o, e, t) {
2801
2801
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2802
2802
  { field: Dt, assertFieldType: "Input" }
2803
2803
  )) == null ? void 0 : a.persist();
2804
- return { path: ys(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
2804
+ return { path: bs(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
2805
2805
  },
2806
2806
  { mode: "StableOnlyLive" }
2807
2807
  );
2808
2808
  }
2809
- function ws(o, e, t) {
2809
+ function Ss(o, e, t) {
2810
2810
  return P.make(
2811
2811
  (r) => {
2812
2812
  const s = r.accessor(o).node(), n = Ke(s, e);
@@ -2819,7 +2819,7 @@ function ws(o, e, t) {
2819
2819
  { key: "inputs#" + mt(o.rid) + e }
2820
2820
  );
2821
2821
  }
2822
- function Ss(o, e, t) {
2822
+ function ks(o, e, t) {
2823
2823
  return P.make(
2824
2824
  (r) => {
2825
2825
  const s = r.accessor(o).node(), n = At(s, e), i = Kt(s, e);
@@ -2835,7 +2835,7 @@ function Ss(o, e, t) {
2835
2835
  { key: "outputs#" + mt(o.rid) + e }
2836
2836
  ).withStableType();
2837
2837
  }
2838
- function ks(o, e) {
2838
+ function Cs(o, e) {
2839
2839
  return P.make((t) => {
2840
2840
  const r = t.accessor(o).node(), s = w(r.getKeyValueAsJson(_)), n = [];
2841
2841
  for (const { id: i, renderingMode: a } of N(s)) {
@@ -2848,7 +2848,7 @@ function ks(o, e) {
2848
2848
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2849
2849
  ), u = c == null ? void 0 : c.getDataAsJson();
2850
2850
  if ((u == null ? void 0 : u.config) === void 0) continue;
2851
- const l = Ee(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !pt(f) && Jo(f)).map((f) => f);
2851
+ const l = Te(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !pt(f) && Mo(f)).map((f) => f);
2852
2852
  if (p.length === 0) continue;
2853
2853
  const h = At(r, i);
2854
2854
  for (const f of p)
@@ -2857,7 +2857,7 @@ function ks(o, e) {
2857
2857
  return n;
2858
2858
  });
2859
2859
  }
2860
- class Cs {
2860
+ class Ps {
2861
2861
  constructor() {
2862
2862
  d(this, "states", /* @__PURE__ */ new Map());
2863
2863
  }
@@ -2890,32 +2890,32 @@ class Ue {
2890
2890
  d(this, "rid");
2891
2891
  /** Data for the left panel, contain basic information about block status. */
2892
2892
  d(this, "overview");
2893
- d(this, "navigationStates", new Cs());
2893
+ d(this, "navigationStates", new Ps());
2894
2894
  d(this, "blockComputables", /* @__PURE__ */ new Map());
2895
2895
  d(this, "blockFrontends", /* @__PURE__ */ new Map());
2896
2896
  d(this, "activeConfigs");
2897
2897
  d(this, "refreshLoopResult");
2898
2898
  d(this, "abortController", new AbortController());
2899
2899
  d(this, "destroyed", !1);
2900
- this.env = e, this.projectTree = r, this.overview = ms(
2900
+ this.env = e, this.projectTree = r, this.overview = vs(
2901
2901
  r.entry(),
2902
2902
  this.navigationStates,
2903
2903
  e
2904
- ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = ks(r.entry(), e);
2904
+ ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = Cs(r.entry(), e);
2905
2905
  }
2906
2906
  async refreshLoop() {
2907
2907
  for (; !this.destroyed; )
2908
2908
  try {
2909
2909
  await Se(this.env.pl, this.rid, (e) => {
2910
2910
  e.doRefresh(this.env.ops.stagingRenderingRate);
2911
- }), await this.activeConfigs.getValue(), await fr(this.env.ops.projectRefreshInterval, this.abortController.signal);
2911
+ }), await this.activeConfigs.getValue(), await mr(this.env.ops.projectRefreshInterval, this.abortController.signal);
2912
2912
  } catch (e) {
2913
- if (ir(e)) {
2913
+ if (ar(e)) {
2914
2914
  console.warn(
2915
2915
  "project refresh routine terminated, because project was externally deleted"
2916
2916
  );
2917
2917
  break;
2918
- } else if (!ar(e))
2918
+ } else if (!cr(e))
2919
2919
  throw new Error("Unexpected exception", { cause: e });
2920
2920
  }
2921
2921
  }
@@ -3087,10 +3087,10 @@ class Ue {
3087
3087
  getBlockComputables(e) {
3088
3088
  const t = this.blockComputables.get(e);
3089
3089
  if (t === void 0) {
3090
- const r = Ss(this.projectTree.entry(), e, this.env), n = {
3090
+ const r = ks(this.projectTree.entry(), e, this.env), n = {
3091
3091
  fullState: P.make(
3092
3092
  (i) => ({
3093
- argsAndUiState: ws(this.projectTree.entry(), e),
3093
+ argsAndUiState: Ss(this.projectTree.entry(), e),
3094
3094
  outputs: r,
3095
3095
  navigationState: this.navigationStates.getState(e)
3096
3096
  }),
@@ -3121,7 +3121,7 @@ class Ue {
3121
3121
  getBlockFrontend(e) {
3122
3122
  const t = this.blockFrontends.get(e);
3123
3123
  if (t === void 0) {
3124
- const r = bs(
3124
+ const r = ws(
3125
3125
  this.projectTree.entry(),
3126
3126
  e,
3127
3127
  this.env
@@ -3146,15 +3146,15 @@ class Ue {
3146
3146
  t,
3147
3147
  {
3148
3148
  ...e.ops.defaultTreeOptions,
3149
- finalPredicate: Bs,
3150
- pruning: Ps
3149
+ finalPredicate: Rs,
3150
+ pruning: Fs
3151
3151
  },
3152
3152
  e.logger
3153
3153
  );
3154
3154
  return new Ue(e, t, r);
3155
3155
  }
3156
3156
  }
3157
- function Ps(o) {
3157
+ function Fs(o) {
3158
3158
  switch (o.type.name) {
3159
3159
  case "BlockPackCustom":
3160
3160
  return o.fields.filter((e) => e.name !== "template");
@@ -3166,17 +3166,17 @@ function Ps(o) {
3166
3166
  return o.fields;
3167
3167
  }
3168
3168
  }
3169
- function Te(o) {
3169
+ function Ee(o) {
3170
3170
  return o.resourceReady || ue(o.originalResourceId) || ue(o.error);
3171
3171
  }
3172
- function Fs(o) {
3173
- if (!Te(o) || !o.outputsLocked) return !1;
3172
+ function Bs(o) {
3173
+ if (!Ee(o) || !o.outputsLocked) return !1;
3174
3174
  for (const [, e] of o.fields)
3175
3175
  if (Y(e.error) && Y(e.value)) return !1;
3176
3176
  return !0;
3177
3177
  }
3178
3178
  const ct = /* @__PURE__ */ new Set();
3179
- function Bs(o) {
3179
+ function Rs(o) {
3180
3180
  switch (o.type.name) {
3181
3181
  case "StdMap":
3182
3182
  case "std/map":
@@ -3194,7 +3194,7 @@ function Bs(o) {
3194
3194
  case "TengoLib":
3195
3195
  case "SoftwareInfo":
3196
3196
  case "Dummy":
3197
- return Te(o);
3197
+ return Ee(o);
3198
3198
  case "json/resourceError":
3199
3199
  return o.type.version === "1";
3200
3200
  case "json/object":
@@ -3211,9 +3211,9 @@ function Bs(o) {
3211
3211
  default:
3212
3212
  if (o.type.name.startsWith("Blob/")) return !0;
3213
3213
  if (o.type.name.startsWith("BlobUpload/"))
3214
- return Fs(o);
3214
+ return Bs(o);
3215
3215
  if (o.type.name.startsWith("PColumnData/"))
3216
- return Te(o);
3216
+ return Ee(o);
3217
3217
  ct.has(o.type.name) || (console.log("UNKNOWN RESOURCE TYPE: " + o.type.name), ct.add(o.type.name));
3218
3218
  }
3219
3219
  return !1;
@@ -3238,7 +3238,7 @@ const Ut = {
3238
3238
  pollingInterval: 1e3,
3239
3239
  stopPollingDelay: 1e3
3240
3240
  }
3241
- }, Rs = {
3241
+ }, Os = {
3242
3242
  ...Ut,
3243
3243
  defaultTreeOptions: {
3244
3244
  pollingInterval: 350,
@@ -3247,12 +3247,12 @@ const Ut = {
3247
3247
  devBlockUpdateRecheckInterval: 1e3,
3248
3248
  projectRefreshInterval: 700,
3249
3249
  stagingRenderingRate: 5
3250
- }, Os = {
3250
+ }, Ds = {
3251
3251
  minDelay: 1500
3252
- }, Ds = "__no_updates__";
3253
- class xs extends lr {
3252
+ }, xs = "__no_updates__";
3253
+ class js extends dr {
3254
3254
  constructor(t, r, s = {}) {
3255
- super({ ...s, ...Os }, r);
3255
+ super({ ...s, ...Ds }, r);
3256
3256
  d(this, "http");
3257
3257
  this.registryProvider = t, this.http = s.http;
3258
3258
  }
@@ -3265,7 +3265,7 @@ class xs extends lr {
3265
3265
  case "from-registry-v2":
3266
3266
  return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
3267
3267
  default:
3268
- return Ds;
3268
+ return xs;
3269
3269
  }
3270
3270
  }
3271
3271
  async readValue(t) {
@@ -3362,9 +3362,9 @@ class ut {
3362
3362
  function lt(o) {
3363
3363
  return String(o.id);
3364
3364
  }
3365
- class js {
3365
+ class Es {
3366
3366
  constructor(e, t, r) {
3367
- d(this, "pFrame", new Rr());
3367
+ d(this, "pFrame", new Or());
3368
3368
  d(this, "blobIdToResource", /* @__PURE__ */ new Map());
3369
3369
  d(this, "blobHandleComputables", /* @__PURE__ */ new Map());
3370
3370
  d(this, "preloadBlob", async (e) => {
@@ -3381,8 +3381,8 @@ class js {
3381
3381
  });
3382
3382
  this.blobDriver = e, this.blobContentCache = t, this.columns = r, this.pFrame.setDataSource(this);
3383
3383
  for (const s of r) {
3384
- for (const i of Oo(s.data)) this.blobIdToResource.set(lt(i), i);
3385
- const n = Do(s.data, lt);
3384
+ for (const i of Do(s.data)) this.blobIdToResource.set(lt(i), i);
3385
+ const n = xo(s.data, lt);
3386
3386
  try {
3387
3387
  this.pFrame.addColumnSpec(s.id, s.spec), this.pFrame.setColumnData(s.id, n);
3388
3388
  } catch (i) {
@@ -3409,36 +3409,40 @@ class Ts {
3409
3409
  d(this, "pFrames");
3410
3410
  d(this, "pTables");
3411
3411
  d(this, "blobContentCache");
3412
+ /** Limits concurrent requests to PFrame API to prevent deadlock with Node's IO threads */
3413
+ d(this, "concurrencyLimiter");
3412
3414
  this.blobDriver = e;
3413
- const t = new Or({
3415
+ const t = new Dr({
3414
3416
  maxSize: 1e9,
3415
3417
  // 1Gb
3416
- fetchMethod: async (r) => await ft.readFile(r),
3417
- sizeCalculation: (r) => r.length
3418
- });
3419
- this.blobContentCache = t, this.pFrames = new class extends ut {
3420
- constructor(r) {
3421
- super(), this.blobDriver = r;
3418
+ fetchMethod: async (s) => await ft.readFile(s),
3419
+ sizeCalculation: (s) => s.length
3420
+ }), r = new tr(2);
3421
+ this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends ut {
3422
+ constructor(s) {
3423
+ super(), this.blobDriver = s;
3422
3424
  }
3423
- createNewResource(r) {
3424
- return new js(this.blobDriver, t, r);
3425
+ createNewResource(s) {
3426
+ return new Es(this.blobDriver, t, s);
3425
3427
  }
3426
- calculateParamsKey(r) {
3427
- return As(r);
3428
+ calculateParamsKey(s) {
3429
+ return Is(s);
3428
3430
  }
3429
3431
  }(this.blobDriver), this.pTables = new class extends ut {
3430
- constructor(r) {
3431
- super(), this.pFrames = r;
3432
+ constructor(s) {
3433
+ super(), this.pFrames = s;
3432
3434
  }
3433
- async createNewResource(r) {
3434
- const n = await this.pFrames.getByKey(r.pFrameHandle).pFrame.createTable({
3435
- src: Z(r.def.src),
3436
- filters: r.def.filters
3437
- });
3438
- return r.def.sorting.length !== 0 ? n.sort(r.def.sorting) : n;
3435
+ async createNewResource(s) {
3436
+ const n = this.pFrames.getByKey(s.pFrameHandle), i = await r.run(
3437
+ async () => await n.pFrame.createTable({
3438
+ src: Z(s.def.src),
3439
+ filters: s.def.filters
3440
+ })
3441
+ );
3442
+ return s.def.sorting.length !== 0 ? i.sort(s.def.sorting) : i;
3439
3443
  }
3440
- calculateParamsKey(r) {
3441
- return Es(r);
3444
+ calculateParamsKey(s) {
3445
+ return As(s);
3442
3446
  }
3443
3447
  }(this.pFrames);
3444
3448
  }
@@ -3446,11 +3450,11 @@ class Ts {
3446
3450
  // Internal / Config API Methods
3447
3451
  //
3448
3452
  createPFrame(e, t) {
3449
- const r = e.map((n) => Q(n, (i) => Io(i))), s = this.pFrames.acquire(r);
3453
+ const r = e.map((n) => Q(n, (i) => No(i))), s = this.pFrames.acquire(r);
3450
3454
  return t.addOnDestroy(s.unref), s.key;
3451
3455
  }
3452
3456
  createPTable(e, t) {
3453
- const r = this.createPFrame(Is(e.src), t), s = dt(e, (i) => i.id), n = this.pTables.acquire({ def: s, pFrameHandle: r });
3457
+ const r = this.createPFrame(Ns(e.src), t), s = dt(e, (i) => i.id), n = this.pTables.acquire({ def: s, pFrameHandle: r });
3454
3458
  return t.addOnDestroy(n.unref), n.key;
3455
3459
  }
3456
3460
  //
@@ -3462,34 +3466,46 @@ class Ts {
3462
3466
  compatibleWith: t.compatibleWith.length !== 0 ? [{ axesSpec: t.compatibleWith, qualifications: [] }] : []
3463
3467
  };
3464
3468
  return {
3465
- hits: (await this.pFrames.getByKey(e).pFrame.findColumns(r)).hits.map(
3466
- (s) => s.hit
3467
- )
3469
+ hits: (await this.concurrencyLimiter.run(
3470
+ async () => await this.pFrames.getByKey(e).pFrame.findColumns(r)
3471
+ )).hits.map((s) => s.hit)
3468
3472
  };
3469
3473
  }
3470
3474
  async getColumnSpec(e, t) {
3471
- return this.pFrames.getByKey(e).pFrame.getColumnSpec(t);
3475
+ return await this.concurrencyLimiter.run(
3476
+ async () => await this.pFrames.getByKey(e).pFrame.getColumnSpec(t)
3477
+ );
3472
3478
  }
3473
3479
  async listColumns(e) {
3474
- return this.pFrames.getByKey(e).pFrame.listColumns();
3480
+ return await this.concurrencyLimiter.run(
3481
+ async () => await this.pFrames.getByKey(e).pFrame.listColumns()
3482
+ );
3475
3483
  }
3476
3484
  async calculateTableData(e, t) {
3477
- let r = await this.pFrames.getByKey(e).pFrame.createTable({
3478
- src: Z(t.src),
3479
- filters: t.filters
3480
- });
3485
+ let r = await this.concurrencyLimiter.run(
3486
+ async () => await this.pFrames.getByKey(e).pFrame.createTable({
3487
+ src: Z(t.src),
3488
+ filters: t.filters
3489
+ })
3490
+ );
3481
3491
  if (t.sorting.length > 0) {
3482
- const i = await r.sort(t.sorting);
3492
+ const i = await this.concurrencyLimiter.run(
3493
+ async () => await r.sort(t.sorting)
3494
+ );
3483
3495
  r.dispose(), r = i;
3484
3496
  }
3485
- const s = r.getSpec(), n = await r.getData([...s.keys()]);
3497
+ const s = r.getSpec(), n = await this.concurrencyLimiter.run(
3498
+ async () => await r.getData([...s.keys()])
3499
+ );
3486
3500
  return r.dispose(), s.map((i, a) => ({
3487
3501
  spec: i,
3488
3502
  data: n[a]
3489
3503
  }));
3490
3504
  }
3491
3505
  async getUniqueValues(e, t) {
3492
- return await this.pFrames.getByKey(e).pFrame.getUniqueValues(t);
3506
+ return await this.concurrencyLimiter.run(
3507
+ async () => await this.pFrames.getByKey(e).pFrame.getUniqueValues(t)
3508
+ );
3493
3509
  }
3494
3510
  //
3495
3511
  // PTable istance methods
@@ -3501,7 +3517,10 @@ class Ts {
3501
3517
  return (await this.pTables.getByKey(e)).getSpec();
3502
3518
  }
3503
3519
  async getData(e, t, r) {
3504
- return (await this.pTables.getByKey(e)).getData(t, r);
3520
+ const s = await this.pTables.getByKey(e);
3521
+ return await this.concurrencyLimiter.run(
3522
+ async () => await s.getData(t, r)
3523
+ );
3505
3524
  }
3506
3525
  }
3507
3526
  function Z(o) {
@@ -3528,18 +3547,18 @@ function Z(o) {
3528
3547
  O(o);
3529
3548
  }
3530
3549
  }
3531
- function Es(o) {
3550
+ function As(o) {
3532
3551
  const e = ge("sha256");
3533
3552
  return e.update(o.pFrameHandle), e.update(Ae(o.def)), e.digest().toString("hex");
3534
3553
  }
3535
- function As(o) {
3554
+ function Is(o) {
3536
3555
  const e = o.map((s) => s.id).sort(), t = ge("sha256");
3537
3556
  let r = "";
3538
3557
  for (const s of e)
3539
3558
  r !== s && (t.update(s), r = s);
3540
3559
  return t.digest().toString("hex");
3541
3560
  }
3542
- function Is(o) {
3561
+ function Ns(o) {
3543
3562
  const e = /* @__PURE__ */ new Map();
3544
3563
  return ce(o, e), [...e.values()];
3545
3564
  }
@@ -3560,23 +3579,23 @@ function ce(o, e) {
3560
3579
  O(o);
3561
3580
  }
3562
3581
  }
3563
- async function Ns(o, e) {
3582
+ async function Vs(o, e) {
3564
3583
  const t = { ...Ut, ...e };
3565
- Vs(t.logger, t);
3566
- const r = new gt(t.localSecret), s = mr(t.logger, o, t.platformLocalStorageNameToPath), n = vr(o, t.logger), i = yr(o, t.logger), a = br(o, t.logger), c = wr(o, t.logger), u = new Sr(
3584
+ Ls(t.logger, t);
3585
+ const r = new gt(t.localSecret), s = vr(t.logger, o, t.platformLocalStorageNameToPath), n = yr(o, t.logger), i = br(o, t.logger), a = wr(o, t.logger), c = Sr(o, t.logger), u = new kr(
3567
3586
  t.logger,
3568
3587
  s,
3569
3588
  n,
3570
3589
  t.blobDownloadPath,
3571
3590
  r,
3572
3591
  t.blobDriverOps
3573
- ), l = new kr(
3592
+ ), l = new Cr(
3574
3593
  t.logger,
3575
3594
  r,
3576
3595
  i,
3577
3596
  a,
3578
3597
  t.uploadDriverOps
3579
- ), p = new Cr(n, t.logStreamDriverOps), h = new Pr(p, u), f = new Fr(t.logger, c, o, r, t.localStorageNameToPath), v = new Ts(u);
3598
+ ), p = new Pr(n, t.logStreamDriverOps), h = new Fr(p, u), f = new Br(t.logger, c, o, r, t.localStorageNameToPath), v = new Ts(u);
3580
3599
  return {
3581
3600
  blobDriver: u,
3582
3601
  logDriver: h,
@@ -3586,7 +3605,7 @@ async function Ns(o, e) {
3586
3605
  pFrameDriver: v
3587
3606
  };
3588
3607
  }
3589
- function Vs(o, e) {
3608
+ function Ls(o, e) {
3590
3609
  e.localStorageNameToPath.local != bt.homedir() && o.info(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
3591
3610
  const t = Object.keys(e.platformLocalStorageNameToPath), r = Object.keys(e.localStorageNameToPath).find(
3592
3611
  (s) => t.includes(s)
@@ -3617,8 +3636,8 @@ class $t {
3617
3636
  /** Creates a project with initial state and adds it to project list. */
3618
3637
  async createProject(e, t = X()) {
3619
3638
  const r = await this.pl.withWriteTx("MLCreateProject", async (s) => {
3620
- const n = await Ro(s, e);
3621
- return s.createField(S(this.projectListResourceId, t), "Dynamic", n), await s.commit(), await cr(n);
3639
+ const n = await Oo(s, e);
3640
+ return s.createField(S(this.projectListResourceId, t), "Dynamic", n), await s.commit(), await ur(n);
3622
3641
  });
3623
3642
  return await this.projectListTree.refreshState(), r;
3624
3643
  }
@@ -3681,10 +3700,10 @@ class $t {
3681
3700
  }
3682
3701
  /** Initialize middle layer */
3683
3702
  static async init(e, t) {
3684
- const r = { ...Rs, ...t };
3703
+ const r = { ...Os, ...t };
3685
3704
  process.env.MI_LOG_TREE_STAT && (r.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3686
3705
  const s = await e.withWriteTx("MLInitialization", async (v) => {
3687
- const D = S(v.clientRoot, zr);
3706
+ const D = S(v.clientRoot, Yr);
3688
3707
  v.createField(D, "Dynamic");
3689
3708
  const V = await v.getField(D);
3690
3709
  if (Y(V.value)) {
@@ -3692,14 +3711,14 @@ class $t {
3692
3711
  return v.lock(M), v.setField(D, M), await v.commit(), await M.globalId;
3693
3712
  } else
3694
3713
  return V.value;
3695
- }), n = r.logger, i = await Ns(e, r), a = new Yt(e.httpDispatcher, {
3714
+ }), n = r.logger, i = await Vs(e, r), a = new Yt(e.httpDispatcher, {
3696
3715
  minTimeout: 250,
3697
3716
  maxRetries: 4
3698
- }), c = new Nr(a), u = new wo(
3717
+ }), c = new Vr(a), u = new So(
3699
3718
  c,
3700
3719
  i.signer,
3701
3720
  a
3702
- ), l = new Br(
3721
+ ), l = new Rr(
3703
3722
  n,
3704
3723
  e.httpDispatcher,
3705
3724
  r.frontendDownloadPath
@@ -3713,12 +3732,12 @@ class $t {
3713
3732
  bpPreparer: u,
3714
3733
  frontendDownloadDriver: l,
3715
3734
  driverKit: i,
3716
- blockUpdateWatcher: new xs(c, n, {
3735
+ blockUpdateWatcher: new js(c, n, {
3717
3736
  minDelay: r.devBlockUpdateRecheckInterval,
3718
3737
  http: a
3719
3738
  }),
3720
- quickJs: await gr()
3721
- }, h = new dr([]), f = await qr(e, s, h, p);
3739
+ quickJs: await fr()
3740
+ }, h = new pr([]), f = await Qr(e, s, h, p);
3722
3741
  return new $t(
3723
3742
  p,
3724
3743
  i,
@@ -3732,30 +3751,30 @@ class $t {
3732
3751
  }
3733
3752
  }
3734
3753
  export {
3735
- cn as BlockPackRegistry,
3736
- un as CentralBlockRegistry,
3754
+ un as BlockPackRegistry,
3755
+ ln as CentralBlockRegistry,
3737
3756
  Ut as DefaultDriverKitOps,
3738
- Rs as DefaultMiddleLayerOps,
3757
+ Os as DefaultMiddleLayerOps,
3739
3758
  Rt as FrontendFromFolderResourceType,
3740
3759
  Bt as FrontendFromUrlResourceType,
3741
3760
  $t as MiddleLayer,
3742
3761
  Ue as Project,
3743
- io as TengoTemplateGet,
3744
- ao as TengoTemplateGetRegistry,
3745
- uo as TengoTemplateGetTemplate,
3746
- co as TengoTemplateGetTemplateURI,
3747
- lo as TengoTemplatePack,
3748
- po as TengoTemplatePackConvert,
3749
- go as TengoTemplatePackConvertTemplate,
3750
- ho as TengoTemplatePackConvertTemplatePack,
3751
- dn as V1CentralDevSnapshotRegistry,
3752
- ln as V1CentralRegistry,
3753
- Nr as V2RegistryProvider,
3762
+ ao as TengoTemplateGet,
3763
+ co as TengoTemplateGetRegistry,
3764
+ lo as TengoTemplateGetTemplate,
3765
+ uo as TengoTemplateGetTemplateURI,
3766
+ po as TengoTemplatePack,
3767
+ ho as TengoTemplatePackConvert,
3768
+ fo as TengoTemplatePackConvertTemplate,
3769
+ go as TengoTemplatePackConvertTemplatePack,
3770
+ pn as V1CentralDevSnapshotRegistry,
3771
+ dn as V1CentralRegistry,
3772
+ Vr as V2RegistryProvider,
3754
3773
  Ft as createRenderTemplate,
3755
3774
  St as getDevV1PacketMtime,
3756
3775
  Ve as getDevV2PacketMtime,
3757
- Ns as initDriverKit,
3776
+ Vs as initDriverKit,
3758
3777
  Je as loadTemplate,
3759
- fo as prepareTemplateSpec
3778
+ mo as prepareTemplateSpec
3760
3779
  };
3761
3780
  //# sourceMappingURL=index.mjs.map