@milaboratories/pl-middle-layer 1.15.0 → 1.15.2

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
@@ -5,26 +5,26 @@ import { mapValueInVOE as vt, executePSpecPredicate as Xt, mapPObjectData as Q,
5
5
  export * from "@platforma-sdk/model";
6
6
  import { blockPackIdEquals as be } from "@milaboratories/pl-model-middle-layer";
7
7
  export * from "@milaboratories/pl-model-middle-layer";
8
- import { request as J, RetryAgent as tr } from "undici";
9
- import { RegistryV1 as W, tryLoadPackDescription as Re, BlockPackMetaEmbedAbsoluteBytes as rr, RegistryV2Reader as or, folderReaderByUrl as sr, loadPackDescription as Qe } from "@platforma-sdk/block-tools";
8
+ import { request as U, RetryAgent as tr } from "undici";
9
+ import { RegistryV1 as W, tryLoadPackDescription as Fe, BlockPackMetaEmbedAbsoluteBytes as rr, RegistryV2Reader as or, folderReaderByUrl as sr, loadPackDescription as Qe } from "@platforma-sdk/block-tools";
10
10
  import E from "node:fs";
11
11
  import x from "node:path";
12
12
  import nr from "yaml";
13
- import { assertNever as D, notEmpty as k, ConsoleLoggerAdapter as ir, ConcurrencyLimitingExecutor as ar, HmacSha256Signer as wt } from "@milaboratories/ts-helpers";
13
+ import { assertNever as D, notEmpty as C, ConsoleLoggerAdapter as ir, ConcurrencyLimitingExecutor as ar, HmacSha256Signer as wt } from "@milaboratories/ts-helpers";
14
14
  import * as St from "node:fs/promises";
15
15
  import { tryResolve as cr } from "@milaboratories/resolve-helper";
16
- import { resourceTypesEqual as $, field as w, Pl as b, PlClient as ur, isNullResourceId as le, ensureResourceIdNotNull as Be, isResource as lr, isResourceRef as dr, isNotNullResourceId as Ze, resourceType as se, resourceTypeToString as pr, resourceIdToString as kt, isNotFoundError as gr, isTimeoutOrCancelError as hr, toGlobalResourceId as fr, plAddressToConfig as mr, UnauthenticatedPlClient as Xe } from "@milaboratories/pl-client";
16
+ import { resourceTypesEqual as G, field as w, Pl as b, PlClient as ur, isNullResourceId as le, ensureResourceIdNotNull as Be, isResource as lr, isResourceRef as dr, isNotNullResourceId as Ze, resourceType as se, resourceTypeToString as pr, resourceIdToString as kt, isNotFoundError as gr, isTimeoutOrCancelError as hr, toGlobalResourceId as fr, plAddressToConfig as mr, UnauthenticatedPlClient as Xe } from "@milaboratories/pl-client";
17
17
  export * from "@milaboratories/pl-client";
18
18
  import { SynchronizedTreeState as Ct, PlError as vr } from "@milaboratories/pl-tree";
19
- import { Computable as F, ChangeSource as et, PollComputablePool as yr, WatchableValue as br } from "@milaboratories/computable";
19
+ import { Computable as R, ChangeSource as et, PollComputablePool as yr, WatchableValue as br } from "@milaboratories/computable";
20
20
  import { randomUUID as te, createHash as fe } from "node:crypto";
21
21
  import Pt from "denque";
22
22
  import { Templates as wr } from "@platforma-sdk/workflow-tengo";
23
23
  import Le from "canonicalize";
24
24
  import Sr from "node:assert";
25
25
  import { Scope as Oe, getQuickJS as kr } from "quickjs-emscripten";
26
- import { setTimeout as Ft } from "node:timers/promises";
27
- import { createDownloadClient as Cr, createLogsClient as Pr, createUploadBlobClient as Fr, createUploadProgressClient as Rr, DownloadDriver as Br, UploadDriver as Or, LogsStreamDriver as Dr, LogsDriver as xr, LsDriver as Tr, DownloadUrlDriver as jr } from "@milaboratories/pl-drivers";
26
+ import { setTimeout as Rt } from "node:timers/promises";
27
+ import { createDownloadClient as Cr, createLogsClient as Pr, createUploadBlobClient as Rr, createUploadProgressClient as Fr, DownloadDriver as Br, UploadDriver as Or, LogsStreamDriver as Dr, LogsDriver as xr, LsDriver as Tr, DownloadUrlDriver as jr } from "@milaboratories/pl-drivers";
28
28
  import { PFrame as Ar } from "@milaboratories/pframes-node";
29
29
  import { LRUCache as Er } from "lru-cache";
30
30
  async function tt(s) {
@@ -36,12 +36,12 @@ async function tt(s) {
36
36
  throw e;
37
37
  }
38
38
  }
39
- const Ir = [W.PlPackageYamlConfigFile], Vr = [W.PlPackageJsonConfigFile], Je = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Me = ["config", "dist", "config.json"], Rt = ["frontend", "dist"], rt = "block-model/dist/config.json", Nr = "block-ui/package.json", Lr = [
39
+ const Ir = [W.PlPackageYamlConfigFile], Vr = [W.PlPackageJsonConfigFile], Je = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Me = ["config", "dist", "config.json"], Ft = ["frontend", "dist"], rt = "block-model/dist/config.json", Nr = "block-ui/package.json", Lr = [
40
40
  Je,
41
41
  Me,
42
42
  Ir,
43
43
  Vr,
44
- Rt
44
+ Ft
45
45
  ];
46
46
  async function Jr(s) {
47
47
  return await tt(x.join(s, ...Me)) !== void 0 || await tt(x.join(s, ...Je)) !== void 0;
@@ -56,7 +56,7 @@ async function ot(s, e) {
56
56
  return {
57
57
  workflow: x.join(s, ...Je),
58
58
  config: x.join(s, ...Me),
59
- ui: x.join(s, ...Rt)
59
+ ui: x.join(s, ...Ft)
60
60
  };
61
61
  {
62
62
  const t = we(s, rt), r = we(s, rt), o = we(s, Nr);
@@ -103,7 +103,7 @@ class mn {
103
103
  const t = [], r = e.spec;
104
104
  switch (r.type) {
105
105
  case "remote-v1":
106
- const o = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await J(
106
+ const o = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await U(
107
107
  `${r.url}/${W.GlobalOverviewPath}`,
108
108
  o
109
109
  )).body.json();
@@ -169,10 +169,10 @@ class mn {
169
169
  otherVersions: []
170
170
  });
171
171
  } else {
172
- let l = c, d = await Re(l);
172
+ let l = c, d = await Fe(l);
173
173
  if (d === void 0) {
174
174
  for (const g of ["block", "meta"])
175
- if (l = x.join(c, g), d = await Re(l), d !== void 0) break;
175
+ if (l = x.join(c, g), d = await Fe(l), d !== void 0) break;
176
176
  }
177
177
  if (d !== void 0) {
178
178
  const g = await Ue(d);
@@ -202,7 +202,7 @@ class mn {
202
202
  return { registries: t, blockPacks: e };
203
203
  }
204
204
  }
205
- class Kr {
205
+ class $r {
206
206
  constructor(e) {
207
207
  p(this, "registries", /* @__PURE__ */ new Map());
208
208
  this.http = e;
@@ -223,14 +223,14 @@ const vn = {
223
223
  }, bn = {
224
224
  type: "remote-v1",
225
225
  url: "https://block.registry.platforma.bio/dev"
226
- }, $r = {
226
+ }, Kr = {
227
227
  groups: [{ id: "default", label: "Default", blocks: [] }]
228
228
  }, Gr = {
229
229
  stagingRefreshTimestamp: 0,
230
230
  blocksInLimbo: []
231
231
  }, _r = {
232
232
  label: "New Project"
233
- }, Hr = { name: "UserProject", version: "2" }, Ot = "SchemaVersion", Dt = "1", Ke = "ProjectCreated", re = "ProjectLastModified", oe = "ProjectMeta", z = "ProjectStructure", de = "BlockRenderingState", Wr = "BlockFrontendState/", zr = /^BlockFrontendState\/(?<blockid>.*)$/;
233
+ }, Hr = { name: "UserProject", version: "2" }, Ot = "SchemaVersion", Dt = "1", $e = "ProjectCreated", re = "ProjectLastModified", oe = "ProjectMeta", z = "ProjectStructure", de = "BlockRenderingState", Wr = "BlockFrontendState/", zr = /^BlockFrontendState\/(?<blockid>.*)$/;
234
234
  function De(s) {
235
235
  return `${Wr}${s}`;
236
236
  }
@@ -258,7 +258,7 @@ function Xr(s) {
258
258
  const { blockId: t, fieldName: r } = e.groups;
259
259
  return { blockId: t, fieldName: r };
260
260
  }
261
- const eo = "projects", xt = { name: "Projects", version: "1" }, to = (s) => $(s.type, xt) ? s.fields : [];
261
+ const eo = "projects", xt = { name: "Projects", version: "1" }, to = (s) => G(s.type, xt) ? s.fields : [];
262
262
  async function ro(s, e, t, r) {
263
263
  const o = await Ct.init(
264
264
  s,
@@ -269,19 +269,19 @@ async function ro(s, e, t, r) {
269
269
  },
270
270
  r.logger
271
271
  );
272
- return { computable: F.make((i) => {
272
+ return { computable: R.make((i) => {
273
273
  const a = i.accessor(o.entry()).node(), c = t.getValue(i);
274
274
  if (a === void 0) return;
275
275
  const u = [];
276
276
  for (const l of a.listDynamicFields()) {
277
277
  const d = a.traverse(l);
278
278
  if (d === void 0) continue;
279
- const g = k(d.getKeyValueAsJson(oe)), f = k(d.getKeyValueAsJson(Ke)), y = k(d.getKeyValueAsJson(re));
279
+ const g = C(d.getKeyValueAsJson(oe)), f = C(d.getKeyValueAsJson($e)), v = C(d.getKeyValueAsJson(re));
280
280
  u.push({
281
281
  id: l,
282
282
  rid: d.id,
283
283
  created: new Date(f),
284
- lastModified: new Date(y),
284
+ lastModified: new Date(v),
285
285
  opened: c.indexOf(d.id) >= 0,
286
286
  meta: g
287
287
  });
@@ -344,7 +344,7 @@ function Co(s, e) {
344
344
  const t = s.createValue(vo, e.content), r = s.createStruct(yo), o = w(r, bo), n = w(r, wo);
345
345
  return s.setField(o, t), n;
346
346
  }
347
- function $e(s, e) {
347
+ function Ke(s, e) {
348
348
  switch (e.type) {
349
349
  case "from-registry":
350
350
  return ko(s, e);
@@ -377,11 +377,11 @@ function Po(s, e) {
377
377
  return D(e);
378
378
  }
379
379
  }
380
- const Fo = { name: "BlockPackCustom", version: "1" }, Et = "template", It = "frontend";
380
+ const Ro = { name: "BlockPackCustom", version: "1" }, Et = "template", It = "frontend";
381
381
  function nt(s) {
382
382
  return s.endsWith("/") ? s : `${s}/`;
383
383
  }
384
- class Ro {
384
+ class Fo {
385
385
  constructor(e, t, r) {
386
386
  this.v2RegistryProvider = e, this.signer = t, this.http = r;
387
387
  }
@@ -401,11 +401,11 @@ class Ro {
401
401
  }
402
402
  case "from-registry-v1": {
403
403
  const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${nt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
404
- return await (await J(`${r}/config.json`, t)).body.json();
404
+ return await (await U(`${r}/config.json`, t)).body.json();
405
405
  }
406
406
  case "from-registry-v2": {
407
407
  const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
408
- return await (await J(o.model.url, t)).body.json();
408
+ return await (await U(o.model.url, t)).body.json();
409
409
  }
410
410
  default:
411
411
  return D(e);
@@ -458,12 +458,12 @@ class Ro {
458
458
  };
459
459
  }
460
460
  case "from-registry-v1": {
461
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${nt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, o = `${r}/template.plj.gz`, n = await J(o, t);
461
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${nt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, o = `${r}/template.plj.gz`, n = await U(o, t);
462
462
  if (n.statusCode !== 200)
463
463
  throw new Error(
464
464
  `Block not found in registry (url = ${o} ; code = ${n.statusCode}): ` + JSON.stringify(e)
465
465
  );
466
- const i = new Uint8Array(await n.body.arrayBuffer()), c = await (await J(`${r}/config.json`, t)).body.json();
466
+ const i = new Uint8Array(await n.body.arrayBuffer()), c = await (await U(`${r}/config.json`, t)).body.json();
467
467
  return {
468
468
  type: "explicit",
469
469
  template: {
@@ -479,7 +479,7 @@ class Ro {
479
479
  };
480
480
  }
481
481
  case "from-registry-v2": {
482
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await J(o.model.url, t)).body.json(), i = async () => await (await J(o.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([n(), i()]);
482
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await U(o.model.url, t)).body.json(), i = async () => await (await U(o.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([n(), i()]);
483
483
  return {
484
484
  type: "explicit",
485
485
  template: {
@@ -500,8 +500,8 @@ class Ro {
500
500
  }
501
501
  }
502
502
  function Bo(s, e) {
503
- const t = { config: e.config, source: e.source }, r = s.createStruct(Fo, JSON.stringify(t));
504
- return s.createField(w(r, Et), "Input", $e(s, e.template)), s.createField(w(r, It), "Input", Po(s, e.frontend)), s.lock(r), r;
503
+ const t = { config: e.config, source: e.source }, r = s.createStruct(Ro, JSON.stringify(t));
504
+ return s.createField(w(r, Et), "Input", Ke(s, e.template)), s.createField(w(r, It), "Input", Po(s, e.frontend)), s.lock(r), r;
505
505
  }
506
506
  function it(s, e) {
507
507
  switch (e.type) {
@@ -546,7 +546,7 @@ function Do(s, e) {
546
546
  const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
547
547
  return Ae(t, s, e), t;
548
548
  }
549
- function L(s) {
549
+ function J(s) {
550
550
  return {
551
551
  *[Symbol.iterator]() {
552
552
  for (const e of s.groups) for (const t of e.blocks) yield t;
@@ -586,7 +586,7 @@ class Vt {
586
586
  function Ee(s) {
587
587
  const e = /* @__PURE__ */ new Map();
588
588
  let t;
589
- for (const { id: r } of L(s)) {
589
+ for (const { id: r } of J(s)) {
590
590
  const o = {
591
591
  id: r,
592
592
  missingReferences: !1
@@ -597,7 +597,7 @@ function Ee(s) {
597
597
  }
598
598
  function ce(s, e) {
599
599
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
600
- for (const { id: o } of L(s)) {
600
+ for (const { id: o } of J(s)) {
601
601
  const n = e(o);
602
602
  if (n === void 0) continue;
603
603
  const i = Do(n, r), a = {
@@ -772,10 +772,10 @@ class pe {
772
772
  // Generic helpers to interact with project state
773
773
  //
774
774
  getBlockInfo(e) {
775
- return k(this.blockInfos.get(e));
775
+ return C(this.blockInfos.get(e));
776
776
  }
777
777
  getBlock(e) {
778
- for (const t of L(this.struct)) if (t.id === e) return t;
778
+ for (const t of J(this.struct)) if (t.id === e) return t;
779
779
  throw new Error("block not found");
780
780
  }
781
781
  setBlockFieldObj(e, t, r) {
@@ -926,8 +926,8 @@ class pe {
926
926
  this.blockInfos.set(u, l);
927
927
  const d = t(u), g = it(this.tx, d.blockPack);
928
928
  this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
929
- const f = Buffer.from(d.args), y = this.tx.createValue(b.JsonObject, f);
930
- this.setBlockField(u, "currentArgs", y, "Ready", f), d.uiState && (this.blockFrontendStates.set(u, d.uiState), this.changedBlockFrontendStates.add(u)), l.check();
929
+ const f = Buffer.from(d.args), v = this.tx.createValue(b.JsonObject, f);
930
+ this.setBlockField(u, "currentArgs", v, "Ready", f), d.uiState && (this.blockFrontendStates.set(u, d.uiState), this.changedBlockFrontendStates.add(u)), l.check();
931
931
  }
932
932
  for (const u of a.different) this.resetStaging(u);
933
933
  o.traverse("downstream", [...c.different], (u) => {
@@ -1004,7 +1004,7 @@ class pe {
1004
1004
  throw new Error("Can't render blocks not including all upstreams.");
1005
1005
  }
1006
1006
  const n = /* @__PURE__ */ new Set();
1007
- for (const i of L(this.structure)) {
1007
+ for (const i of J(this.structure)) {
1008
1008
  if (!r.has(i.id)) continue;
1009
1009
  let a = this.getBlockInfo(i.id).requireProductionRendering || this.blocksInLimbo.has(i.id);
1010
1010
  if (!a) {
@@ -1109,10 +1109,10 @@ class pe {
1109
1109
  d,
1110
1110
  g,
1111
1111
  f,
1112
- y,
1113
- C,
1114
- { stagingRefreshTimestamp: M, blocksInLimbo: G },
1115
- U
1112
+ v,
1113
+ S,
1114
+ { stagingRefreshTimestamp: I, blocksInLimbo: M },
1115
+ $
1116
1116
  ] = await Promise.all([
1117
1117
  o,
1118
1118
  n,
@@ -1127,54 +1127,54 @@ class pe {
1127
1127
  `Can't act on this project resource because it has a wrong schema version: ${g}`
1128
1128
  );
1129
1129
  const _ = /* @__PURE__ */ new Map();
1130
- for (const v of d.fields) {
1131
- const O = Xr(v.name);
1130
+ for (const y of d.fields) {
1131
+ const O = Xr(y.name);
1132
1132
  if (O === void 0) continue;
1133
- let R = _.get(O.blockId);
1134
- R === void 0 && (R = {
1133
+ let F = _.get(O.blockId);
1134
+ F === void 0 && (F = {
1135
1135
  id: O.blockId,
1136
1136
  fields: {}
1137
- }, _.set(O.blockId, R)), R.fields[O.fieldName] = le(v.value) ? { modCount: 0 } : { modCount: 0, ref: v.value };
1137
+ }, _.set(O.blockId, F)), F.fields[O.fieldName] = le(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1138
1138
  }
1139
- const Y = await Nt(), ne = je(Y.hash), S = d.fields.find(
1140
- (v) => v.name === ne
1139
+ const Y = await Nt(), ne = je(Y.hash), k = d.fields.find(
1140
+ (y) => y.name === ne
1141
1141
  );
1142
- let I;
1143
- S !== void 0 ? I = Be(S.value) : (I = b.wrapInHolder(e, $e(e, Y.spec)), e.createField(
1142
+ let V;
1143
+ k !== void 0 ? V = Be(k.value) : (V = b.wrapInHolder(e, Ke(e, Y.spec)), e.createField(
1144
1144
  w(t, je(Y.hash)),
1145
1145
  "Dynamic",
1146
- I
1146
+ V
1147
1147
  ));
1148
- const q = { stagingRefreshTimestamp: M }, A = new Set(G), T = /* @__PURE__ */ new Map();
1149
- for (const v of U) {
1150
- const O = qr(v.key);
1151
- O !== void 0 && T.set(O, v.value);
1148
+ const q = { stagingRefreshTimestamp: I }, A = new Set(M), T = /* @__PURE__ */ new Map();
1149
+ for (const y of $) {
1150
+ const O = qr(y.key);
1151
+ O !== void 0 && T.set(O, y.value);
1152
1152
  }
1153
1153
  const B = [];
1154
- _.forEach(({ id: v, fields: O }) => {
1155
- for (const [, R] of Object.entries(O))
1156
- if (R.ref !== void 0) {
1157
- if (!lr(R.ref) || dr(R.ref))
1154
+ _.forEach(({ id: y, fields: O }) => {
1155
+ for (const [, F] of Object.entries(O))
1156
+ if (F.ref !== void 0) {
1157
+ if (!lr(F.ref) || dr(F.ref))
1158
1158
  throw new Error("unexpected behaviour");
1159
- B.push([R, e.getResourceData(R.ref, !1)]);
1159
+ B.push([F, e.getResourceData(F.ref, !1)]);
1160
1160
  }
1161
1161
  });
1162
- for (const [v, O] of B) {
1163
- const R = await O;
1164
- v.value = R.data, Ze(R.error) ? v.status = "Error" : R.resourceReady || Ze(R.originalResourceId) ? v.status = "Ready" : v.status = "NotReady";
1162
+ for (const [y, O] of B) {
1163
+ const F = await O;
1164
+ y.value = F.data, Ze(F.error) ? y.status = "Error" : F.resourceReady || Ze(F.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1165
1165
  }
1166
1166
  const K = /* @__PURE__ */ new Map();
1167
- _.forEach(({ id: v, fields: O }) => K.set(v, new ct(v, O)));
1168
- const V = /* @__PURE__ */ new Set();
1169
- for (const v of L(C)) {
1170
- if (!K.has(v.id))
1171
- throw new Error(`Inconsistent project structure: no inputs for ${v.id}`);
1172
- V.add(v.id);
1167
+ _.forEach(({ id: y, fields: O }) => K.set(y, new ct(y, O)));
1168
+ const N = /* @__PURE__ */ new Set();
1169
+ for (const y of J(S)) {
1170
+ if (!K.has(y.id))
1171
+ throw new Error(`Inconsistent project structure: no inputs for ${y.id}`);
1172
+ N.add(y.id);
1173
1173
  }
1174
- K.forEach((v) => {
1175
- if (!V.has(v.id))
1176
- throw new Error(`Inconsistent project structure: no structure entry for ${v.id}`);
1177
- v.check();
1174
+ K.forEach((y) => {
1175
+ if (!N.has(y.id))
1176
+ throw new Error(`Inconsistent project structure: no structure entry for ${y.id}`);
1177
+ y.check();
1178
1178
  });
1179
1179
  const ie = new pe(
1180
1180
  t,
@@ -1182,13 +1182,13 @@ class pe {
1182
1182
  r,
1183
1183
  g,
1184
1184
  f,
1185
- y,
1186
- C,
1185
+ v,
1186
+ S,
1187
1187
  q,
1188
1188
  A,
1189
1189
  K,
1190
1190
  T,
1191
- I
1191
+ V
1192
1192
  );
1193
1193
  return ie.fixProblems(), ie;
1194
1194
  }
@@ -1197,18 +1197,18 @@ async function Ao(s, e = _r) {
1197
1197
  const t = s.createEphemeral(Hr);
1198
1198
  s.lock(t);
1199
1199
  const r = String(Date.now());
1200
- s.setKValue(t, Ot, JSON.stringify(Dt)), s.setKValue(t, Ke, r), s.setKValue(t, re, r), s.setKValue(t, oe, JSON.stringify(e)), s.setKValue(t, z, JSON.stringify($r)), s.setKValue(t, de, JSON.stringify(Gr));
1200
+ s.setKValue(t, Ot, JSON.stringify(Dt)), s.setKValue(t, $e, r), s.setKValue(t, re, r), s.setKValue(t, oe, JSON.stringify(e)), s.setKValue(t, z, JSON.stringify(Kr)), s.setKValue(t, de, JSON.stringify(Gr));
1201
1201
  const o = await Nt();
1202
1202
  return s.createField(
1203
1203
  w(t, je(o.hash)),
1204
1204
  "Dynamic",
1205
- b.wrapInHolder(s, $e(s, o.spec))
1205
+ b.wrapInHolder(s, Ke(s, o.spec))
1206
1206
  ), t;
1207
1207
  }
1208
1208
  async function Ce(s, e, t) {
1209
- return N(s, e, void 0, t);
1209
+ return L(s, e, void 0, t);
1210
1210
  }
1211
- async function N(s, e, t, r) {
1211
+ async function L(s, e, t, r) {
1212
1212
  if (s instanceof ur)
1213
1213
  return await s.withWriteTx("ProjectAction", async (o) => {
1214
1214
  const n = await pe.load(o, e, t), i = await r(n);
@@ -1269,14 +1269,14 @@ function Uo(s) {
1269
1269
  const e = s.getDataAsJson();
1270
1270
  if (e === void 0)
1271
1271
  throw new Error("unexpected data info structure, no resource data");
1272
- if ($(s.resourceType, Mo)) {
1272
+ if (G(s.resourceType, Mo)) {
1273
1273
  const t = e;
1274
1274
  return {
1275
1275
  type: "Json",
1276
1276
  keyLength: t.keyLength,
1277
1277
  data: t.data
1278
1278
  };
1279
- } else if ($(s.resourceType, Vo)) {
1279
+ } else if (G(s.resourceType, Vo)) {
1280
1280
  const t = e, r = Object.fromEntries(
1281
1281
  s.listInputFields().map((o) => [o, s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo])
1282
1282
  );
@@ -1285,7 +1285,7 @@ function Uo(s) {
1285
1285
  partitionKeyLength: t.partitionKeyLength,
1286
1286
  parts: r
1287
1287
  };
1288
- } else if ($(s.resourceType, No)) {
1288
+ } else if (G(s.resourceType, No)) {
1289
1289
  const t = e, r = {};
1290
1290
  for (const o of s.listInputFields()) {
1291
1291
  const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
@@ -1300,7 +1300,7 @@ function Uo(s) {
1300
1300
  partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
1301
1301
  parts: r
1302
1302
  };
1303
- } else if ($(s.resourceType, Lo)) {
1303
+ } else if (G(s.resourceType, Lo)) {
1304
1304
  const t = e, r = {};
1305
1305
  for (const o of s.listInputFields())
1306
1306
  if (o.endsWith(".index")) {
@@ -1321,7 +1321,7 @@ function Uo(s) {
1321
1321
  partitionKeyLength: t.partitionKeyLength,
1322
1322
  parts: r
1323
1323
  };
1324
- } else if ($(s.resourceType, Jo)) {
1324
+ } else if (G(s.resourceType, Jo)) {
1325
1325
  const t = e, r = {};
1326
1326
  for (const o of s.listInputFields()) {
1327
1327
  const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
@@ -1364,24 +1364,24 @@ function Lt(s, e = !0, t = !1, r = "") {
1364
1364
  if (e) throw new Error(`unexpected field name ${l}`);
1365
1365
  continue;
1366
1366
  }
1367
- let g = k((a = d.groups) == null ? void 0 : a.name);
1367
+ let g = C((a = d.groups) == null ? void 0 : a.name);
1368
1368
  if (!g.startsWith(r)) {
1369
1369
  if (e) throw new Error(`unexpected field name ${l}`);
1370
1370
  continue;
1371
1371
  }
1372
1372
  g = g.slice(r.length);
1373
- const f = k((c = d.groups) == null ? void 0 : c.type);
1374
- let y = n.get(g);
1375
- switch (y === void 0 && (y = {}, n.set(g, y)), f) {
1373
+ const f = C((c = d.groups) == null ? void 0 : c.type);
1374
+ let v = n.get(g);
1375
+ switch (v === void 0 && (v = {}, n.set(g, v)), f) {
1376
1376
  case "spec":
1377
- y.spec = (u = s.traverse({
1377
+ v.spec = (u = s.traverse({
1378
1378
  field: l,
1379
1379
  ignoreError: t,
1380
1380
  pureFieldErrorToUndefined: t
1381
1381
  })) == null ? void 0 : u.getDataAsJson();
1382
1382
  break;
1383
1383
  case "data":
1384
- y.hasData = !0, y.data = () => s.traverseOrError({
1384
+ v.hasData = !0, v.data = () => s.traverseOrError({
1385
1385
  field: l,
1386
1386
  ignoreError: t
1387
1387
  });
@@ -1394,7 +1394,7 @@ function Lt(s, e = !0, t = !1, r = "") {
1394
1394
  for (const [, l] of n) l.data === void 0 && (l.hasData = !1);
1395
1395
  return { locked: i, results: n };
1396
1396
  }
1397
- function Ko(s, e = !0, t = "") {
1397
+ function $o(s, e = !0, t = "") {
1398
1398
  if (!s.getIsReadyOrError()) throw new Error("resource is not ready");
1399
1399
  const r = Lt(s, e, !1, t);
1400
1400
  Sr(r.locked);
@@ -1553,8 +1553,8 @@ class Ge {
1553
1553
  return t;
1554
1554
  }
1555
1555
  static create(e, t, r) {
1556
- const o = e.accessor(t).node(), n = k(o.getKeyValueAsJson(z)), a = Ee(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1557
- for (const u of L(n)) {
1556
+ const o = e.accessor(t).node(), n = C(o.getKeyValueAsJson(z)), a = Ee(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1557
+ for (const u of J(n)) {
1558
1558
  if (!a.has(u.id)) continue;
1559
1559
  const l = lt(
1560
1560
  o.traverse({
@@ -1588,7 +1588,7 @@ function lt(s, e) {
1588
1588
  if (e.ok) return Lt(e.value, !1, !0);
1589
1589
  }
1590
1590
  function _e(s, e) {
1591
- const t = s.persist(), r = k(
1591
+ const t = s.persist(), r = C(
1592
1592
  s.traverse({
1593
1593
  field: P(e, "currentArgs"),
1594
1594
  errorIfFieldNotSet: !0
@@ -1599,8 +1599,8 @@ function _e(s, e) {
1599
1599
  args: r,
1600
1600
  uiState: o,
1601
1601
  blockMeta: (n) => {
1602
- const i = n.accessor(t).node(), a = k(i.getKeyValueAsJson(z)), c = /* @__PURE__ */ new Map();
1603
- for (const u of L(a)) c.set(u.id, u);
1602
+ const i = n.accessor(t).node(), a = C(i.getKeyValueAsJson(z)), c = /* @__PURE__ */ new Map();
1603
+ for (const u of J(a)) c.set(u.id, u);
1604
1604
  return c;
1605
1605
  }
1606
1606
  };
@@ -1678,7 +1678,7 @@ function* j(s, e) {
1678
1678
  D(s);
1679
1679
  }
1680
1680
  }
1681
- function $o(s, e) {
1681
+ function Ko(s, e) {
1682
1682
  const t = {};
1683
1683
  for (const [r, o] of Object.entries(s)) t[r] = e(o);
1684
1684
  return t;
@@ -1810,7 +1810,7 @@ const ns = (s) => h(s), is = (s) => {
1810
1810
  const e = s.source;
1811
1811
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1812
1812
  type: "ScheduleComputable",
1813
- computable: F.make(
1813
+ computable: R.make(
1814
1814
  (r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
1815
1815
  {
1816
1816
  postprocessValue: async (r) => {
@@ -1826,7 +1826,7 @@ const ns = (s) => h(s), is = (s) => {
1826
1826
  const o = t.accessor(e).node().resourceInfo;
1827
1827
  return {
1828
1828
  type: "ScheduleComputable",
1829
- computable: F.make(() => r.blobDriver.getDownloadedBlob(o), {
1829
+ computable: R.make(() => r.blobDriver.getDownloadedBlob(o), {
1830
1830
  postprocessValue: async (n) => n === void 0 ? void 0 : (await r.blobDriver.getContent(n.handle)).toString()
1831
1831
  })
1832
1832
  };
@@ -1835,7 +1835,7 @@ const ns = (s) => h(s), is = (s) => {
1835
1835
  const e = s.source;
1836
1836
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1837
1837
  type: "ScheduleComputable",
1838
- computable: F.make(
1838
+ computable: R.make(
1839
1839
  (r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
1840
1840
  {
1841
1841
  postprocessValue: async (r) => {
@@ -1925,7 +1925,7 @@ function m(s, e) {
1925
1925
  return () => ({
1926
1926
  type: "ScheduleSubroutine",
1927
1927
  subroutine: Ho,
1928
- args: $o(e.template, (r) => m(s, r))
1928
+ args: Ko(e.template, (r) => m(s, r))
1929
1929
  });
1930
1930
  case "MakeArray":
1931
1931
  return () => ({
@@ -2086,9 +2086,9 @@ function ms(s) {
2086
2086
  $staging: s.staging
2087
2087
  };
2088
2088
  }
2089
- const Kt = Symbol(), $t = "return", vs = { op: Kt, arg: $t };
2089
+ const $t = Symbol(), Kt = "return", vs = { op: $t, arg: Kt };
2090
2090
  function ys(s) {
2091
- return s.op == Kt && s.arg == $t;
2091
+ return s.op == $t && s.arg == Kt;
2092
2092
  }
2093
2093
  function bs() {
2094
2094
  return { pendingSubroutines: /* @__PURE__ */ new Map() };
@@ -2097,7 +2097,7 @@ function dt(s, e, t, r) {
2097
2097
  const o = new Pt(t), n = (a, c) => {
2098
2098
  if (ys(a))
2099
2099
  return e.result = c, !1;
2100
- const u = k(e.pendingSubroutines.get(a.op));
2100
+ const u = C(e.pendingSubroutines.get(a.op));
2101
2101
  if (a.arg in u.args) throw new Error("argument already set");
2102
2102
  return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op), o.push({
2103
2103
  destination: u.destination,
@@ -2153,7 +2153,7 @@ function Gt(s, e, t, r = {}) {
2153
2153
  ctx: Object.fromEntries(Object.entries(e).filter(([n]) => fs.indexOf(n) === -1)),
2154
2154
  cfg: t
2155
2155
  });
2156
- return F.makeRaw(
2156
+ return R.makeRaw(
2157
2157
  (n) => {
2158
2158
  const i = { drivers: s, cCtx: n }, a = bs();
2159
2159
  return {
@@ -2170,16 +2170,16 @@ function Gt(s, e, t, r = {}) {
2170
2170
  ),
2171
2171
  async postprocessValue(u) {
2172
2172
  const l = [];
2173
- for (const y of u)
2174
- l.push({ destination: y.destination, operation: h(y.computable) });
2173
+ for (const v of u)
2174
+ l.push({ destination: v.destination, operation: h(v.computable) });
2175
2175
  const d = {
2176
2176
  drivers: s,
2177
2177
  get cCtx() {
2178
2178
  throw new Error("asynchronous operations are forbidden in this context");
2179
2179
  }
2180
2180
  }, g = /* @__PURE__ */ new Map();
2181
- for (const [y, C] of a.pendingSubroutines)
2182
- g.set(y, { ...C, args: { ...C.args } });
2181
+ for (const [v, S] of a.pendingSubroutines)
2182
+ g.set(v, { ...S, args: { ...S.args } });
2183
2183
  const f = {
2184
2184
  result: a.result,
2185
2185
  pendingSubroutines: g
@@ -2323,7 +2323,7 @@ class ge {
2323
2323
  parsePObjectCollection(e, t, r) {
2324
2324
  const o = this.getAccessor(e);
2325
2325
  if (!o.getIsReadyOrError()) return;
2326
- const n = Ko(o, t, r), i = {};
2326
+ const n = $o(o, t, r), i = {};
2327
2327
  for (const [a, c] of Object.entries(n))
2328
2328
  i[a] = Q(c, (u) => this.wrapAccessor(u));
2329
2329
  return i;
@@ -2339,7 +2339,7 @@ class ge {
2339
2339
  const t = this.getAccessor(e).resourceInfo;
2340
2340
  return this.registerComputable(
2341
2341
  "getBlobContentAsString",
2342
- F.make((r) => this.env.driverKit.blobDriver.getDownloadedBlob(t, r), {
2342
+ R.make((r) => this.env.driverKit.blobDriver.getDownloadedBlob(t, r), {
2343
2343
  postprocessValue: async (r) => {
2344
2344
  if (r !== void 0)
2345
2345
  return Buffer.from(await this.env.driverKit.blobDriver.getContent(r.handle)).toString(
@@ -2353,7 +2353,7 @@ class ge {
2353
2353
  const t = this.getAccessor(e).resourceInfo;
2354
2354
  return this.registerComputable(
2355
2355
  "getBlobContentAsBase64",
2356
- F.make((r) => this.env.driverKit.blobDriver.getDownloadedBlob(t, r), {
2356
+ R.make((r) => this.env.driverKit.blobDriver.getDownloadedBlob(t, r), {
2357
2357
  postprocessValue: async (r) => {
2358
2358
  if (r !== void 0)
2359
2359
  return Buffer.from(await this.env.driverKit.blobDriver.getContent(r.handle)).toString(
@@ -2425,7 +2425,7 @@ class ge {
2425
2425
  throw new Error(
2426
2426
  "can't use result pool in this context (most porbably called from the future mapper)"
2427
2427
  );
2428
- this._resultPool = k(
2428
+ this._resultPool = C(
2429
2429
  this.blockCtx.getResultsPool,
2430
2430
  "getResultsPool"
2431
2431
  )(this.computableCtx);
@@ -2674,20 +2674,23 @@ function _t(s, e) {
2674
2674
  }
2675
2675
  const gt = process.env.MI_LOG_OUTPUT_STATUS;
2676
2676
  function ks(s, e, t, r, o = {}) {
2677
- return o = { ...o }, o.mode === void 0 && t.retentive === !0 && (o.mode = "StableOnlyRetentive"), F.makeRaw((n) => {
2678
- const i = new Oe();
2679
- n.addOnDestroy(() => i.dispose());
2680
- const a = i.manage(s.quickJs.newRuntime());
2681
- a.setMemoryLimit(1024 * 640), a.setMaxStackSize(1024 * 320);
2682
- const c = i.manage(a.newContext()), u = new ge(i, c, e, s, n);
2683
- u.evaluateBundle(r.content);
2684
- const l = u.runCallback(t.handle);
2685
- return u.resetComputableCtx(), {
2686
- ir: u.computablesToResolve,
2687
- postprocessValue: async (d, { unstableMarker: g, stable: f }) => {
2688
- gt && (gt !== "unstable-only" || !f) && console.log(f ? `Stable output ${t.handle} calculated.` : `Unstable output ${t.handle}; marker = ${g}`);
2689
- for (const [y, C] of Object.entries(d)) u.runCallback(y, C);
2690
- return u.importObjectUniversal(l);
2677
+ const n = `lambda#${t.handle}`;
2678
+ return o = { ...o, key: n }, o.mode === void 0 && t.retentive === !0 && (o.mode = "StableOnlyRetentive"), R.makeRaw((i) => {
2679
+ const a = new Oe();
2680
+ i.addOnDestroy(() => a.dispose());
2681
+ const c = a.manage(s.quickJs.newRuntime());
2682
+ c.setMemoryLimit(1024 * 640), c.setMaxStackSize(1024 * 320);
2683
+ const u = a.manage(c.newContext()), l = new ge(a, u, e, s, i);
2684
+ l.evaluateBundle(r.content);
2685
+ const d = l.runCallback(t.handle);
2686
+ return l.resetComputableCtx(), {
2687
+ ir: l.computablesToResolve,
2688
+ postprocessValue: async (g, { unstableMarker: f, stable: v }) => {
2689
+ for (const [I, M] of Object.entries(g)) l.runCallback(I, M);
2690
+ const S = l.importObjectUniversal(d);
2691
+ return gt && (gt !== "unstable-only" || !v) && console.log(
2692
+ v ? `Stable output ${t.handle} calculated ${S !== void 0 ? "defined" : "undefined"}` : `Unstable output ${t.handle}; marker = ${f}; ${S !== void 0 ? "defined" : "undefined"}`
2693
+ ), S;
2691
2694
  }
2692
2695
  };
2693
2696
  }, o);
@@ -2702,59 +2705,59 @@ function X(s, e, t, r, o = {}) {
2702
2705
  } else return ws(s.driverKit, e, t, o);
2703
2706
  }
2704
2707
  function Ps(s, e, t) {
2705
- return F.make(
2708
+ return R.make(
2706
2709
  (r) => {
2707
- var y, C, M, G, U, _, Y, ne;
2708
- const o = r.accessor(s).node(), n = k(o.getKeyValueAsJson(Ke)), i = k(o.getKeyValueAsJson(re)), a = k(o.getKeyValueAsJson(oe)), c = k(o.getKeyValueAsJson(z)), u = k(
2710
+ var v, S, I, M, $, _, Y, ne;
2711
+ const o = r.accessor(s).node(), n = C(o.getKeyValueAsJson($e)), i = C(o.getKeyValueAsJson(re)), a = C(o.getKeyValueAsJson(oe)), c = C(o.getKeyValueAsJson(z)), u = C(
2709
2712
  o.getKeyValueAsJson(de)
2710
2713
  ), l = /* @__PURE__ */ new Map();
2711
- for (const { id: S } of L(c)) {
2712
- const I = o.traverse({
2713
- field: P(S, "currentArgs"),
2714
+ for (const { id: k } of J(c)) {
2715
+ const V = o.traverse({
2716
+ field: P(k, "currentArgs"),
2714
2717
  assertFieldType: "Dynamic",
2715
2718
  errorIfFieldNotSet: !0
2716
2719
  });
2717
2720
  let q;
2718
2721
  const A = o.traverse({
2719
- field: P(S, "prodArgs"),
2722
+ field: P(k, "prodArgs"),
2720
2723
  assertFieldType: "Dynamic",
2721
2724
  stableIfNotFound: !0
2722
2725
  });
2723
2726
  if (A !== void 0) {
2724
2727
  const T = o.getField({
2725
- field: P(S, "prodOutput"),
2728
+ field: P(k, "prodOutput"),
2726
2729
  assertFieldType: "Dynamic",
2727
2730
  errorIfFieldNotFound: !0
2728
2731
  }), B = o.getField({
2729
- field: P(S, "prodUiCtx"),
2732
+ field: P(k, "prodUiCtx"),
2730
2733
  assertFieldType: "Dynamic",
2731
2734
  errorIfFieldNotFound: !0
2732
2735
  });
2733
2736
  q = {
2734
2737
  arguments: A.getDataAsJson(),
2735
- stale: I.id !== A.id,
2736
- outputError: T.error !== void 0 || B.error !== void 0 || ((y = T.value) == null ? void 0 : y.getError()) !== void 0 || ((C = B.value) == null ? void 0 : C.getError()) !== void 0,
2737
- outputsError: ((M = T.error) == null ? void 0 : M.getDataAsString()) ?? ((U = (G = T.value) == null ? void 0 : G.getError()) == null ? void 0 : U.getDataAsString()),
2738
+ stale: V.id !== A.id,
2739
+ outputError: T.error !== void 0 || B.error !== void 0 || ((v = T.value) == null ? void 0 : v.getError()) !== void 0 || ((S = B.value) == null ? void 0 : S.getError()) !== void 0,
2740
+ outputsError: ((I = T.error) == null ? void 0 : I.getDataAsString()) ?? (($ = (M = T.value) == null ? void 0 : M.getError()) == null ? void 0 : $.getDataAsString()),
2738
2741
  exportsError: ((_ = B.error) == null ? void 0 : _.getDataAsString()) ?? ((ne = (Y = B.value) == null ? void 0 : Y.getError()) == null ? void 0 : ne.getDataAsString()),
2739
2742
  finished: (T.value !== void 0 && T.value.getIsReadyOrError() || T.error !== void 0 && T.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
2740
2743
  };
2741
2744
  }
2742
- l.set(S, { currentArguments: I.getDataAsJson(), prod: q });
2745
+ l.set(k, { currentArguments: V.getDataAsJson(), prod: q });
2743
2746
  }
2744
- const d = ce(c, (S) => l.get(S).currentArguments), g = new Set(u.blocksInLimbo), f = [...L(c)].map(({ id: S, label: I, renderingMode: q }) => {
2747
+ const d = ce(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...J(c)].map(({ id: k, label: V, renderingMode: q }) => {
2745
2748
  var We, ze, Ye, qe;
2746
- const A = k(l.get(S)), T = k(d.nodes.get(S));
2749
+ const A = C(l.get(k)), T = C(d.nodes.get(k));
2747
2750
  let B = "NotCalculated";
2748
- A.prod !== void 0 && (g.has(S) ? B = "Limbo" : B = A.prod.finished ? "Done" : "Running");
2751
+ A.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = A.prod.finished ? "Done" : "Running");
2749
2752
  const K = o.traverse(
2750
2753
  {
2751
- field: P(S, "blockPack"),
2754
+ field: P(k, "blockPack"),
2752
2755
  assertFieldType: "Dynamic",
2753
2756
  errorIfFieldNotSet: !0
2754
2757
  },
2755
2758
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2756
- ), V = K == null ? void 0 : K.getDataAsJson(), { sections: ie, title: v, inputsValid: O, sdkVersion: R } = Z(V == null ? void 0 : V.config, (ve) => {
2757
- const H = he(ve), ye = _e(o, S);
2759
+ ), N = K == null ? void 0 : K.getDataAsJson(), { sections: ie, title: y, inputsValid: O, sdkVersion: F } = Z(N == null ? void 0 : N.config, (ve) => {
2760
+ const H = he(ve), ye = _e(o, k);
2758
2761
  return {
2759
2762
  sections: X(
2760
2763
  t,
@@ -2780,28 +2783,28 @@ function Ps(s, e, t) {
2780
2783
  sdkVersion: H.sdkVersion
2781
2784
  };
2782
2785
  }) || {}, Yt = Z(
2783
- V,
2786
+ N,
2784
2787
  (ve) => t.blockUpdateWatcher.get(ve.source)
2785
2788
  );
2786
2789
  return {
2787
- id: S,
2788
- label: v ?? I,
2789
- title: v ?? I,
2790
+ id: k,
2791
+ label: y ?? V,
2792
+ title: y ?? V,
2790
2793
  renderingMode: q,
2791
2794
  stale: ((We = A.prod) == null ? void 0 : We.stale) !== !1 || B === "Limbo",
2792
2795
  missingReference: T.missingReferences,
2793
- upstreams: [...d.traverseIdsExcludingRoots("upstream", S)],
2794
- downstreams: [...d.traverseIdsExcludingRoots("downstream", S)],
2796
+ upstreams: [...d.traverseIdsExcludingRoots("upstream", k)],
2797
+ downstreams: [...d.traverseIdsExcludingRoots("downstream", k)],
2795
2798
  calculationStatus: B,
2796
2799
  outputErrors: ((ze = A.prod) == null ? void 0 : ze.outputError) === !0,
2797
2800
  outputsError: (Ye = A.prod) == null ? void 0 : Ye.outputsError,
2798
2801
  exportsError: (qe = A.prod) == null ? void 0 : qe.exportsError,
2799
2802
  sections: ie,
2800
2803
  inputsValid: O,
2801
- currentBlockPack: V == null ? void 0 : V.source,
2804
+ currentBlockPack: N == null ? void 0 : N.source,
2802
2805
  updatedBlockPack: Yt,
2803
- sdkVersion: R,
2804
- navigationState: e.getState(S)
2806
+ sdkVersion: F,
2807
+ navigationState: e.getState(k)
2805
2808
  };
2806
2809
  });
2807
2810
  return {
@@ -2827,13 +2830,13 @@ function Ps(s, e, t) {
2827
2830
  }
2828
2831
  ).withStableType();
2829
2832
  }
2830
- function Fs(s, e) {
2833
+ function Rs(s, e) {
2831
2834
  const t = s.node();
2832
- if ($(t.resourceType, jt)) {
2835
+ if (G(t.resourceType, jt)) {
2833
2836
  const r = t.getDataAsJson();
2834
2837
  if (r === void 0) throw new Error("No resource data.");
2835
2838
  return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
2836
- } else if ($(t.resourceType, At)) {
2839
+ } else if (G(t.resourceType, At)) {
2837
2840
  const r = t.getDataAsJson();
2838
2841
  if (r === void 0) throw new Error("No resource data.");
2839
2842
  return e.signer.verify(
@@ -2844,10 +2847,10 @@ function Fs(s, e) {
2844
2847
  } else
2845
2848
  throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
2846
2849
  }
2847
- function Rs(s, e) {
2850
+ function Fs(s, e) {
2848
2851
  if (s !== void 0)
2849
- return F.make(
2850
- (t) => Fs(t.accessor(s), e),
2852
+ return R.make(
2853
+ (t) => Rs(t.accessor(s), e),
2851
2854
  {
2852
2855
  postprocessValue: (t) => {
2853
2856
  if (t !== void 0) {
@@ -2860,7 +2863,7 @@ function Rs(s, e) {
2860
2863
  ).withStableType();
2861
2864
  }
2862
2865
  function Bs(s, e, t) {
2863
- return F.make(
2866
+ return R.make(
2864
2867
  (r) => {
2865
2868
  var a;
2866
2869
  const o = r.accessor(s).node(), n = _t(o, e), i = (a = o.traverse(
@@ -2871,13 +2874,13 @@ function Bs(s, e, t) {
2871
2874
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2872
2875
  { field: It, assertFieldType: "Input" }
2873
2876
  )) == null ? void 0 : a.persist();
2874
- return { path: Rs(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
2877
+ return { path: Fs(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
2875
2878
  },
2876
2879
  { mode: "StableOnlyLive" }
2877
2880
  );
2878
2881
  }
2879
2882
  function Os(s, e, t) {
2880
- return F.make(
2883
+ return R.make(
2881
2884
  (r) => {
2882
2885
  const o = r.accessor(s).node(), n = _e(o, e);
2883
2886
  return {
@@ -2890,25 +2893,25 @@ function Os(s, e, t) {
2890
2893
  );
2891
2894
  }
2892
2895
  function Ds(s, e, t) {
2893
- return F.make(
2896
+ return R.make(
2894
2897
  (r) => {
2895
2898
  const o = r.accessor(s).node(), n = Jt(o, e), i = _t(o, e);
2896
2899
  return Z(i, (a) => {
2897
2900
  const c = {};
2898
2901
  for (const [u, l] of Object.entries(a.outputs))
2899
- c[u] = F.wrapError(
2902
+ c[u] = R.wrapError(
2900
2903
  X(t, n, l, a.code)
2901
2904
  );
2902
2905
  return c;
2903
2906
  });
2904
2907
  },
2905
- { key: "outputs#" + kt(s.rid) + e }
2908
+ { key: "outputs#" + kt(s.rid) + "#" + e }
2906
2909
  ).withStableType();
2907
2910
  }
2908
2911
  function xs(s, e) {
2909
- return F.make((t) => {
2910
- const r = t.accessor(s).node(), o = k(r.getKeyValueAsJson(z)), n = [];
2911
- for (const { id: i, renderingMode: a } of L(o)) {
2912
+ return R.make((t) => {
2913
+ const r = t.accessor(s).node(), o = C(r.getKeyValueAsJson(z)), n = [];
2914
+ for (const { id: i, renderingMode: a } of J(o)) {
2912
2915
  const c = r.traverse(
2913
2916
  {
2914
2917
  field: P(i, "blockPack"),
@@ -2922,7 +2925,7 @@ function xs(s, e) {
2922
2925
  if (d.length === 0) continue;
2923
2926
  const g = Jt(r, i);
2924
2927
  for (const f of d)
2925
- n.push(F.wrapError(X(e, g, f, l.code)));
2928
+ n.push(R.wrapError(X(e, g, f, l.code)));
2926
2929
  }
2927
2930
  return n;
2928
2931
  });
@@ -2944,7 +2947,7 @@ class Ts {
2944
2947
  return r === void 0 && (r = { state: { ...er }, change: new et() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2945
2948
  }
2946
2949
  getState(e) {
2947
- return F.make(
2950
+ return R.make(
2948
2951
  (t) => this.readState(t, e),
2949
2952
  { key: `navigationState#${e}` }
2950
2953
  );
@@ -2978,7 +2981,7 @@ class He {
2978
2981
  try {
2979
2982
  await Ce(this.env.pl, this.rid, (e) => {
2980
2983
  e.doRefresh(this.env.ops.stagingRenderingRate);
2981
- }), await this.activeConfigs.getValue(), await Ft(this.env.ops.projectRefreshInterval, this.abortController.signal);
2984
+ }), await this.activeConfigs.getValue(), await Rt(this.env.ops.projectRefreshInterval, this.abortController.signal);
2982
2985
  } catch (e) {
2983
2986
  if (gr(e)) {
2984
2987
  console.warn(
@@ -3002,7 +3005,7 @@ class He {
3002
3005
  * */
3003
3006
  async addBlock(e, t, r, o = void 0, n = te()) {
3004
3007
  const i = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c = he(a);
3005
- return await N(
3008
+ return await L(
3006
3009
  this.env.pl,
3007
3010
  this.rid,
3008
3011
  o,
@@ -3027,7 +3030,7 @@ class He {
3027
3030
  * */
3028
3031
  async updateBlockPack(e, t, r = !1, o) {
3029
3032
  const n = await this.env.bpPreparer.prepare(t), i = await this.env.bpPreparer.getBlockConfigContainer(t);
3030
- await N(
3033
+ await L(
3031
3034
  this.env.pl,
3032
3035
  this.rid,
3033
3036
  o,
@@ -3040,7 +3043,7 @@ class He {
3040
3043
  }
3041
3044
  /** Deletes a block with all associated data. */
3042
3045
  async deleteBlock(e, t) {
3043
- await N(this.env.pl, this.rid, t, (r) => r.deleteBlock(e)), this.navigationStates.deleteBlock(e), await this.projectTree.refreshState();
3046
+ await L(this.env.pl, this.rid, t, (r) => r.deleteBlock(e)), this.navigationStates.deleteBlock(e), await this.projectTree.refreshState();
3044
3047
  }
3045
3048
  /**
3046
3049
  * Updates block order according to the given array of block ids.
@@ -3049,7 +3052,7 @@ class He {
3049
3052
  * an error will be thrown instead.
3050
3053
  */
3051
3054
  async reorderBlocks(e, t) {
3052
- await N(this.env.pl, this.rid, t, (r) => {
3055
+ await L(this.env.pl, this.rid, t, (r) => {
3053
3056
  const o = r.structure;
3054
3057
  if (o.groups.length !== 1)
3055
3058
  throw new Error("Unexpected project structure, non-sinular block group");
@@ -3103,7 +3106,7 @@ class He {
3103
3106
  * in collaborative editing scenario.
3104
3107
  * */
3105
3108
  async setBlockArgs(e, t, r) {
3106
- await N(
3109
+ await L(
3107
3110
  this.env.pl,
3108
3111
  this.rid,
3109
3112
  r,
@@ -3117,7 +3120,7 @@ class He {
3117
3120
  * in collaborative editing scenario.
3118
3121
  * */
3119
3122
  async setUiState(e, t, r) {
3120
- await N(
3123
+ await L(
3121
3124
  this.env.pl,
3122
3125
  this.rid,
3123
3126
  r,
@@ -3137,7 +3140,7 @@ class He {
3137
3140
  * in collaborative editing scenario.
3138
3141
  * */
3139
3142
  async setBlockArgsAndUiState(e, t, r, o) {
3140
- await N(this.env.pl, this.rid, o, (n) => {
3143
+ await L(this.env.pl, this.rid, o, (n) => {
3141
3144
  n.setArgs([{ blockId: e, args: JSON.stringify(t) }]), n.setUiState(e, JSON.stringify(r));
3142
3145
  }), await this.projectTree.refreshState();
3143
3146
  }
@@ -3149,9 +3152,9 @@ class He {
3149
3152
  ), n = Be(
3150
3153
  (await r.getField(w(o, b.HolderRefField))).value
3151
3154
  ), i = await r.getResourceData(n, !1), a = JSON.parse(
3152
- Buffer.from(k(i.data)).toString("utf-8")
3155
+ Buffer.from(C(i.data)).toString("utf-8")
3153
3156
  );
3154
- await N(r, this.rid, t, (c) => {
3157
+ await L(r, this.rid, t, (c) => {
3155
3158
  c.setArgs([{ blockId: e, args: JSON.stringify(a.config.initialArgs) }]), c.setUiState(e, void 0);
3156
3159
  }), await r.commit();
3157
3160
  }), await this.projectTree.refreshState();
@@ -3160,7 +3163,7 @@ class He {
3160
3163
  const t = this.blockComputables.get(e);
3161
3164
  if (t === void 0) {
3162
3165
  const r = Ds(this.projectTree.entry(), e, this.env), n = {
3163
- fullState: F.make(
3166
+ fullState: R.make(
3164
3167
  (i) => ({
3165
3168
  argsAndUiState: Os(this.projectTree.entry(), e),
3166
3169
  outputs: r,
@@ -3312,7 +3315,7 @@ class Ns extends yr {
3312
3315
  }
3313
3316
  case "dev-v2":
3314
3317
  try {
3315
- const o = await Re(t.folder, this.logger);
3318
+ const o = await Fe(t.folder, this.logger);
3316
3319
  if (o === void 0) return;
3317
3320
  const n = await Ue(o);
3318
3321
  return n === t.mtime ? void 0 : { ...t, mtime: n };
@@ -3490,7 +3493,7 @@ class Js {
3490
3493
  return t.addOnDestroy(o.unref), o.key;
3491
3494
  }
3492
3495
  createPTable(e, t) {
3493
- const r = this.createPFrame(Ks(e.src), t), o = yt(e, (i) => i.id), n = this.pTables.acquire({ def: o, pFrameHandle: r });
3496
+ const r = this.createPFrame($s(e.src), t), o = yt(e, (i) => i.id), n = this.pTables.acquire({ def: o, pFrameHandle: r });
3494
3497
  return t.addOnDestroy(n.unref), n.key;
3495
3498
  }
3496
3499
  //
@@ -3594,7 +3597,7 @@ function Us(s) {
3594
3597
  r !== o && (t.update(o), r = o);
3595
3598
  return t.digest().toString("hex");
3596
3599
  }
3597
- function Ks(s) {
3600
+ function $s(s) {
3598
3601
  const e = /* @__PURE__ */ new Map();
3599
3602
  return ue(s, e), [...e.values()];
3600
3603
  }
@@ -3615,12 +3618,12 @@ function ue(s, e) {
3615
3618
  D(s);
3616
3619
  }
3617
3620
  }
3618
- async function $s(s, e, t) {
3621
+ async function Ks(s, e, t) {
3619
3622
  const r = {
3620
3623
  ...Ht,
3621
3624
  ...Wt(e),
3622
3625
  ...t
3623
- }, o = new wt(r.localSecret), n = Cr(r.logger, s, r.localProjections), i = Pr(s, r.logger), a = Fr(s, r.logger), c = Rr(s, r.logger), u = new Br(
3626
+ }, o = new wt(r.localSecret), n = Cr(r.logger, s, r.localProjections), i = Pr(s, r.logger), a = Rr(s, r.logger), c = Fr(s, r.logger), u = new Br(
3624
3627
  r.logger,
3625
3628
  n,
3626
3629
  i,
@@ -3640,14 +3643,14 @@ async function $s(s, e, t) {
3640
3643
  r.localProjections,
3641
3644
  r.openFileDialogCallback,
3642
3645
  r.virtualLocalStoragesOverride
3643
- ), y = new Js(u);
3646
+ ), v = new Js(u);
3644
3647
  return {
3645
3648
  blobDriver: u,
3646
3649
  logDriver: g,
3647
3650
  lsDriver: f,
3648
3651
  signer: o,
3649
3652
  uploadDriver: l,
3650
- pFrameDriver: y
3653
+ pFrameDriver: v
3651
3654
  };
3652
3655
  }
3653
3656
  class zt {
@@ -3678,7 +3681,7 @@ class zt {
3678
3681
  }
3679
3682
  /** Updates project metadata */
3680
3683
  async setProjectMeta(e, t, r) {
3681
- await N(this.pl, e, r, async (o) => {
3684
+ await L(this.pl, e, r, async (o) => {
3682
3685
  o.setMeta(t);
3683
3686
  }), await this.projectListTree.refreshState();
3684
3687
  }
@@ -3741,19 +3744,19 @@ class zt {
3741
3744
  ...r
3742
3745
  };
3743
3746
  process.env.MI_LOG_TREE_STAT && (o.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3744
- const n = await e.withWriteTx("MLInitialization", async (C) => {
3745
- const M = w(C.clientRoot, eo);
3746
- C.createField(M, "Dynamic");
3747
- const G = await C.getField(M);
3748
- if (le(G.value)) {
3749
- const U = C.createEphemeral(xt);
3750
- return C.lock(U), C.setField(M, U), await C.commit(), await U.globalId;
3747
+ const n = await e.withWriteTx("MLInitialization", async (S) => {
3748
+ const I = w(S.clientRoot, eo);
3749
+ S.createField(I, "Dynamic");
3750
+ const M = await S.getField(I);
3751
+ if (le(M.value)) {
3752
+ const $ = S.createEphemeral(xt);
3753
+ return S.lock($), S.setField(I, $), await S.commit(), await $.globalId;
3751
3754
  } else
3752
- return G.value;
3753
- }), i = o.logger, a = await $s(e, t, o), c = new tr(e.httpDispatcher, {
3755
+ return M.value;
3756
+ }), i = o.logger, a = await Ks(e, t, o), c = new tr(e.httpDispatcher, {
3754
3757
  minTimeout: 250,
3755
3758
  maxRetries: 4
3756
- }), u = new Kr(c), l = new Ro(
3759
+ }), u = new $r(c), l = new Fo(
3757
3760
  u,
3758
3761
  a.signer,
3759
3762
  c
@@ -3776,16 +3779,16 @@ class zt {
3776
3779
  http: c
3777
3780
  }),
3778
3781
  quickJs: await kr()
3779
- }, f = new br([]), y = await ro(e, n, f, g);
3782
+ }, f = new br([]), v = await ro(e, n, f, g);
3780
3783
  return new zt(
3781
3784
  g,
3782
3785
  a,
3783
3786
  a.signer,
3784
3787
  n,
3785
3788
  f,
3786
- y.tree,
3789
+ v.tree,
3787
3790
  u,
3788
- y.computable
3791
+ v.computable
3789
3792
  );
3790
3793
  }
3791
3794
  }
@@ -3816,7 +3819,7 @@ async function wn(s, e = {}) {
3816
3819
  t.blockRegistryDurationMs,
3817
3820
  t.maxRegistryChecksPerSecond,
3818
3821
  async () => {
3819
- const { body: a, statusCode: c } = await J(t.blockRegistryUrl, {
3822
+ const { body: a, statusCode: c } = await U(t.blockRegistryUrl, {
3820
3823
  dispatcher: i,
3821
3824
  headersTimeout: t.httpTimeoutMs,
3822
3825
  bodyTimeout: t.httpTimeoutMs
@@ -3830,7 +3833,7 @@ async function wn(s, e = {}) {
3830
3833
  t.autoUpdateCdnDurationMs,
3831
3834
  t.maxAutoUpdateCdnChecksPerSecond,
3832
3835
  async () => {
3833
- const { body: a, statusCode: c } = await J(t.autoUpdateCdnUrl, {
3836
+ const { body: a, statusCode: c } = await U(t.autoUpdateCdnUrl, {
3834
3837
  dispatcher: i,
3835
3838
  headersTimeout: t.httpTimeoutMs,
3836
3839
  bodyTimeout: t.httpTimeoutMs
@@ -3858,7 +3861,7 @@ async function Pe(s, e, t) {
3858
3861
  response: i
3859
3862
  });
3860
3863
  const c = 1e3 / e - a;
3861
- c > 0 && await Ft(c);
3864
+ c > 0 && await Rt(c);
3862
3865
  }
3863
3866
  return o;
3864
3867
  }
@@ -3871,11 +3874,11 @@ Network report:
3871
3874
  pl endpoint: ${e};
3872
3875
  options: ${JSON.stringify(t, null, 2)}.
3873
3876
 
3874
- Platforma pings: ${Fe(s.plPings)}
3877
+ Platforma pings: ${Re(s.plPings)}
3875
3878
 
3876
- Block registry responses: ${Fe(s.blockRegistryChecks)}
3879
+ Block registry responses: ${Re(s.blockRegistryChecks)}
3877
3880
 
3878
- Auto-update CDN responses: ${Fe(s.autoUpdateCdnChecks)}
3881
+ Auto-update CDN responses: ${Re(s.autoUpdateCdnChecks)}
3879
3882
 
3880
3883
  Block registry dumps:
3881
3884
  ${JSON.stringify(s.blockRegistryChecks, null, 2)}
@@ -3890,7 +3893,7 @@ Platforma pings success dump examples:
3890
3893
  ${JSON.stringify(n, null, 2)}
3891
3894
  `;
3892
3895
  }
3893
- function Fe(s) {
3896
+ function Re(s) {
3894
3897
  const e = s.filter((o) => o.response.ok), { mean: t, median: r } = _s(s);
3895
3898
  return `
3896
3899
  total: ${s.length};
@@ -3936,13 +3939,13 @@ export {
3936
3939
  bo as TengoTemplatePackConvertTemplatePack,
3937
3940
  bn as V1CentralDevSnapshotRegistry,
3938
3941
  yn as V1CentralRegistry,
3939
- Kr as V2RegistryProvider,
3942
+ $r as V2RegistryProvider,
3940
3943
  wn as checkNetwork,
3941
3944
  Tt as createRenderTemplate,
3942
3945
  Bt as getDevV1PacketMtime,
3943
3946
  Ue as getDevV2PacketMtime,
3944
- $s as initDriverKit,
3945
- $e as loadTemplate,
3947
+ Ks as initDriverKit,
3948
+ Ke as loadTemplate,
3946
3949
  So as prepareTemplateSpec
3947
3950
  };
3948
3951
  //# sourceMappingURL=index.mjs.map