@platforma-sdk/model 1.10.2 → 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,64 +1,65 @@
1
- var M = Object.defineProperty;
2
- var U = (e, t, n) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var f = (e, t, n) => U(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { isPColumn as D, mapPObjectData as A, mapValueInVOE as B, isPColumnSpec as $, mapPTableDef as J, getAxisId as O, matchAxisId as N } from "@milaboratories/pl-model-common";
1
+ var et = Object.defineProperty;
2
+ var nt = (e, t, n) => t in e ? et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var _ = (e, t, n) => nt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { isPColumn as K, mapPObjectData as D, mapValueInVOE as it, isPColumnSpec as rt, mapPTableDef as st, getAxisId as J, matchAxisId as ot } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
- class G extends Error {
6
+ import { z as A } from "zod";
7
+ class at extends Error {
7
8
  constructor(t, n) {
8
9
  super(`${t.length}${n ? "+" : ""} errors, first error: ` + t[0]), this.errors = t, this.moreErrors = n;
9
10
  }
10
11
  }
11
- function H(e) {
12
- if (!e.ok) throw new G(e.errors, e.moreErrors);
12
+ function lt(e) {
13
+ if (!e.ok) throw new at(e.errors, e.moreErrors);
13
14
  return e.value;
14
15
  }
15
- function it(e) {
16
+ function Rt(e) {
16
17
  return new Proxy(e, {
17
18
  get(t, n) {
18
- return H(t[n]);
19
+ return lt(t[n]);
19
20
  }
20
21
  });
21
22
  }
22
- function c(e) {
23
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? C(e) : e;
23
+ function p(e) {
24
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? V(e) : e;
24
25
  }
25
- function v(e) {
26
+ function I(e) {
26
27
  return { type: "GetFromCtx", variable: e };
27
28
  }
28
- function rt(e) {
29
+ function Pt(e) {
29
30
  return {
30
31
  type: "Isolate",
31
32
  cfg: e
32
33
  };
33
34
  }
34
- const st = v("$args"), ot = v("$it"), at = v("$prod"), ut = v("$staging"), lt = v("$ui");
35
- function C(e) {
35
+ const Ot = I("$args"), Vt = I("$it"), Dt = I("$prod"), Lt = I("$staging"), kt = I("$ui");
36
+ function V(e) {
36
37
  return { type: "Immediate", value: e };
37
38
  }
38
- function k(e) {
39
+ function z(e) {
39
40
  const t = {};
40
- for (const [n, i] of Object.entries(e)) t[n] = c(i);
41
+ for (const [n, i] of Object.entries(e)) t[n] = p(i);
41
42
  return {
42
43
  type: "MakeObject",
43
44
  template: t
44
45
  };
45
46
  }
46
- function ct(...e) {
47
+ function xt(...e) {
47
48
  const t = [];
48
- for (const n of e) t.push(c(n));
49
+ for (const n of e) t.push(p(n));
49
50
  return {
50
51
  type: "MakeArray",
51
52
  template: t
52
53
  };
53
54
  }
54
- function S(e, t) {
55
+ function L(e, t) {
55
56
  return {
56
57
  type: "GetJsonField",
57
- source: c(e),
58
- field: c(t)
58
+ source: p(e),
59
+ field: p(t)
59
60
  };
60
61
  }
61
- function dt(e, t, n = "$it") {
62
+ function jt(e, t, n = "$it") {
62
63
  return {
63
64
  type: "MapRecordValues",
64
65
  source: e,
@@ -66,7 +67,7 @@ function dt(e, t, n = "$it") {
66
67
  itVar: n
67
68
  };
68
69
  }
69
- function pt(e, t, n = "$it") {
70
+ function Et(e, t, n = "$it") {
70
71
  return {
71
72
  type: "MapArrayValues",
72
73
  source: e,
@@ -74,54 +75,54 @@ function pt(e, t, n = "$it") {
74
75
  itVar: n
75
76
  };
76
77
  }
77
- function ht(e) {
78
+ function Mt(e) {
78
79
  return {
79
80
  type: "Flatten",
80
81
  source: e
81
82
  };
82
83
  }
83
- function ft(e) {
84
+ function Bt(e) {
84
85
  return {
85
86
  type: "IsEmpty",
86
87
  arg: e
87
88
  };
88
89
  }
89
- function gt(e) {
90
+ function Ut(e) {
90
91
  return {
91
92
  type: "Not",
92
93
  operand: e
93
94
  };
94
95
  }
95
- function mt(e, t) {
96
+ function Nt(e, t) {
96
97
  return {
97
98
  type: "And",
98
99
  operand1: e,
99
100
  operand2: t
100
101
  };
101
102
  }
102
- function yt(e, t) {
103
+ function $t(e, t) {
103
104
  return {
104
105
  type: "Or",
105
106
  operand1: e,
106
107
  operand2: t
107
108
  };
108
109
  }
109
- function bt(e, t) {
110
+ function Jt(e, t) {
110
111
  return {
111
112
  type: "GetResourceField",
112
- source: c(e),
113
- field: c(t)
113
+ source: p(e),
114
+ field: p(t)
114
115
  };
115
116
  }
116
- function vt() {
117
+ function Gt() {
117
118
  return function(e) {
118
119
  return {
119
120
  type: "GetResourceValueAsJson",
120
- source: c(e)
121
+ source: p(e)
121
122
  };
122
123
  };
123
124
  }
124
- function _t(e, t, n = "$it") {
125
+ function Ht(e, t, n = "$it") {
125
126
  return {
126
127
  type: "MapResourceFields",
127
128
  source: e,
@@ -129,106 +130,106 @@ function _t(e, t, n = "$it") {
129
130
  itVar: n
130
131
  };
131
132
  }
132
- function wt(e) {
133
+ function Wt(e) {
133
134
  return {
134
135
  type: "GetBlobContent",
135
- source: c(e)
136
+ source: p(e)
136
137
  };
137
138
  }
138
- function Ct(e) {
139
+ function Kt(e) {
139
140
  return {
140
141
  type: "GetBlobContentAsString",
141
- source: c(e)
142
+ source: p(e)
142
143
  };
143
144
  }
144
- function At() {
145
+ function zt() {
145
146
  return function(e) {
146
147
  return {
147
148
  type: "GetBlobContentAsJson",
148
- source: c(e)
149
+ source: p(e)
149
150
  };
150
151
  };
151
152
  }
152
- function St(e) {
153
+ function qt(e) {
153
154
  return {
154
155
  type: "GetDownloadedBlobContent",
155
- source: c(e)
156
+ source: p(e)
156
157
  };
157
158
  }
158
- function Ft(e) {
159
+ function Yt(e) {
159
160
  return {
160
161
  type: "GetOnDemandBlobContent",
161
- source: c(e)
162
+ source: p(e)
162
163
  };
163
164
  }
164
- function It(e) {
165
+ function Qt(e) {
165
166
  return {
166
167
  type: "GetImportProgress",
167
- source: c(e)
168
+ source: p(e)
168
169
  };
169
170
  }
170
- function Rt(e, t) {
171
+ function Xt(e, t) {
171
172
  return {
172
173
  type: "GetLastLogs",
173
- source: c(e),
174
+ source: p(e),
174
175
  lines: t
175
176
  };
176
177
  }
177
- function Ot(e, t) {
178
+ function Zt(e, t) {
178
179
  return {
179
180
  type: "GetProgressLog",
180
- source: c(e),
181
+ source: p(e),
181
182
  patternToSearch: t
182
183
  };
183
184
  }
184
- function Vt(e) {
185
+ function te(e) {
185
186
  return {
186
187
  type: "GetLogHandle",
187
- source: c(e)
188
+ source: p(e)
188
189
  };
189
190
  }
190
- function K() {
191
+ function ut() {
191
192
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
192
193
  }
193
- function x(e) {
194
+ function q(e) {
194
195
  if (e && typeof globalThis.getPlatforma == "function")
195
196
  return globalThis.getPlatforma(e);
196
197
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
197
198
  throw new Error("Can't get platforma instance.");
198
199
  }
199
- function W() {
200
+ function ct() {
200
201
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
201
202
  }
202
- function o() {
203
+ function l() {
203
204
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
204
205
  throw new Error("Not in config rendering context");
205
206
  }
206
- function _(e, t) {
207
- const n = W();
207
+ function P(e, t) {
208
+ const n = ct();
208
209
  if (n === void 0) return !1;
209
210
  if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
210
211
  return n.callbackRegistry[e] = t, !0;
211
212
  }
212
- const F = /* @__PURE__ */ new Map();
213
- function q(e, t) {
214
- e in o().callbackRegistry || (o().callbackRegistry[e] = (n) => {
215
- for (const i of F.get(e))
213
+ const E = /* @__PURE__ */ new Map();
214
+ function dt(e, t) {
215
+ e in l().callbackRegistry || (l().callbackRegistry[e] = (n) => {
216
+ for (const i of E.get(e))
216
217
  i(n);
217
- }, F.set(e, [])), F.get(e).push(t);
218
+ }, E.set(e, [])), E.get(e).push(t);
218
219
  }
219
- class h {
220
+ class g {
220
221
  constructor(t, n = (i) => i) {
221
- f(this, "isResolved", !1);
222
- f(this, "resolvedValue");
223
- this.handle = t, this.postProcess = n, q(t, (i) => {
222
+ _(this, "isResolved", !1);
223
+ _(this, "resolvedValue");
224
+ this.handle = t, this.postProcess = n, dt(t, (i) => {
224
225
  this.resolvedValue = n(i), this.isResolved = !0;
225
226
  });
226
227
  }
227
228
  map(t) {
228
- return new h(this.handle, (n) => t(this.postProcess(n)));
229
+ return new g(this.handle, (n) => t(this.postProcess(n)));
229
230
  }
230
231
  mapDefined(t) {
231
- return new h(this.handle, (n) => {
232
+ return new g(this.handle, (n) => {
232
233
  const i = this.postProcess(n);
233
234
  return i ? t(i) : void 0;
234
235
  });
@@ -237,10 +238,10 @@ class h {
237
238
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
238
239
  }
239
240
  }
240
- function V(e) {
241
- return e === void 0 ? void 0 : new m(e);
241
+ function G(e) {
242
+ return e === void 0 ? void 0 : new v(e);
242
243
  }
243
- class m {
244
+ class v {
244
245
  constructor(t) {
245
246
  this.handle = t;
246
247
  }
@@ -275,40 +276,40 @@ class m {
275
276
  return this.resolveWithCommon({}, ...t);
276
277
  }
277
278
  resolveWithCommon(t, ...n) {
278
- return V(o().resolveWithCommon(this.handle, t, ...n));
279
+ return G(l().resolveWithCommon(this.handle, t, ...n));
279
280
  }
280
281
  get resourceType() {
281
- return o().getResourceType(this.handle);
282
+ return l().getResourceType(this.handle);
282
283
  }
283
284
  getInputsLocked() {
284
- return o().getInputsLocked(this.handle);
285
+ return l().getInputsLocked(this.handle);
285
286
  }
286
287
  getOutputsLocked() {
287
- return o().getOutputsLocked(this.handle);
288
+ return l().getOutputsLocked(this.handle);
288
289
  }
289
290
  getIsReadyOrError() {
290
- return o().getIsReadyOrError(this.handle);
291
+ return l().getIsReadyOrError(this.handle);
291
292
  }
292
293
  getIsFinal() {
293
- return o().getIsFinal(this.handle);
294
+ return l().getIsFinal(this.handle);
294
295
  }
295
296
  getError() {
296
- return V(o().getError(this.handle));
297
+ return G(l().getError(this.handle));
297
298
  }
298
299
  listInputFields() {
299
- return o().listInputFields(this.handle);
300
+ return l().listInputFields(this.handle);
300
301
  }
301
302
  listOutputFields() {
302
- return o().listOutputFields(this.handle);
303
+ return l().listOutputFields(this.handle);
303
304
  }
304
305
  listDynamicFields() {
305
- return o().listDynamicFields(this.handle);
306
+ return l().listDynamicFields(this.handle);
306
307
  }
307
308
  getKeyValueBase64(t) {
308
- return o().getKeyValueBase64(this.handle, t);
309
+ return l().getKeyValueBase64(this.handle, t);
309
310
  }
310
311
  getKeyValueAsString(t) {
311
- return o().getKeyValueAsString(this.handle, t);
312
+ return l().getKeyValueAsString(this.handle, t);
312
313
  }
313
314
  getKeyValueAsJson(t) {
314
315
  const n = this.getKeyValueAsString(t);
@@ -316,10 +317,10 @@ class m {
316
317
  return JSON.parse(n);
317
318
  }
318
319
  getDataBase64() {
319
- return o().getDataBase64(this.handle);
320
+ return l().getDataBase64(this.handle);
320
321
  }
321
322
  getDataAsString() {
322
- return o().getDataAsString(this.handle);
323
+ return l().getDataAsString(this.handle);
323
324
  }
324
325
  getDataAsJson() {
325
326
  const t = this.getDataAsString();
@@ -332,7 +333,7 @@ class m {
332
333
  getPColumns(t = !1, n = "") {
333
334
  const i = this.parsePObjectCollection(t, n);
334
335
  return i === void 0 ? void 0 : Object.entries(i).map(([, s]) => {
335
- if (!D(s)) throw new Error(`not a PColumn (kind = ${s.spec.kind})`);
336
+ if (!K(s)) throw new Error(`not a PColumn (kind = ${s.spec.kind})`);
336
337
  return s;
337
338
  });
338
339
  }
@@ -340,26 +341,26 @@ class m {
340
341
  *
341
342
  */
342
343
  parsePObjectCollection(t = !1, n = "") {
343
- const i = o().parsePObjectCollection(
344
+ const i = l().parsePObjectCollection(
344
345
  this.handle,
345
346
  t,
346
347
  n
347
348
  );
348
349
  if (i === void 0) return;
349
350
  const r = {};
350
- for (const [s, u] of Object.entries(i))
351
- r[s] = A(u, (a) => new m(a));
351
+ for (const [s, o] of Object.entries(i))
352
+ r[s] = D(o, (a) => new v(a));
352
353
  return r;
353
354
  }
354
355
  getFileContentAsBase64() {
355
- return new h(o().getBlobContentAsBase64(this.handle));
356
+ return new g(l().getBlobContentAsBase64(this.handle));
356
357
  }
357
358
  getFileContentAsString() {
358
- return new h(o().getBlobContentAsString(this.handle));
359
+ return new g(l().getBlobContentAsString(this.handle));
359
360
  }
360
361
  getFileContentAsJson() {
361
- return new h(
362
- o().getBlobContentAsString(this.handle)
362
+ return new g(
363
+ l().getBlobContentAsString(this.handle)
363
364
  ).mapDefined((t) => JSON.parse(t));
364
365
  }
365
366
  /**
@@ -378,7 +379,7 @@ class m {
378
379
  * @returns downloaded file handle
379
380
  */
380
381
  getFileHandle() {
381
- return new h(o().getDownloadedBlobContentHandle(this.handle));
382
+ return new g(l().getDownloadedBlobContentHandle(this.handle));
382
383
  }
383
384
  /**
384
385
  * @deprecated use getFileHandle
@@ -390,7 +391,7 @@ class m {
390
391
  * @returns downloaded file handle
391
392
  */
392
393
  getRemoteFileHandle() {
393
- return new h(o().getOnDemandBlobContentHandle(this.handle));
394
+ return new g(l().getOnDemandBlobContentHandle(this.handle));
394
395
  }
395
396
  /**
396
397
  * @deprecated use getRemoteFileHandle
@@ -399,16 +400,16 @@ class m {
399
400
  return this.getRemoteFileHandle();
400
401
  }
401
402
  getImportProgress() {
402
- return new h(o().getImportProgress(this.handle));
403
+ return new g(l().getImportProgress(this.handle));
403
404
  }
404
405
  getLastLogs(t) {
405
- return new h(o().getLastLogs(this.handle, t));
406
+ return new g(l().getLastLogs(this.handle, t));
406
407
  }
407
408
  getProgressLog(t) {
408
- return new h(o().getProgressLog(this.handle, t));
409
+ return new g(l().getProgressLog(this.handle, t));
409
410
  }
410
411
  getLogHandle() {
411
- return new h(o().getLogHandle(this.handle));
412
+ return new g(l().getLogHandle(this.handle));
412
413
  }
413
414
  allFieldsResolved(t = "Input") {
414
415
  switch (t) {
@@ -428,44 +429,100 @@ class m {
428
429
  requireLocked: !0,
429
430
  skipUnresolved: !1,
430
431
  ...n
431
- }, u = t;
432
+ }, o = t;
432
433
  if (r && (i === "Input" && !this.getInputsLocked() || i === "Output" && !this.getOutputsLocked()))
433
434
  return;
434
- let d = (i === "Input" ? this.listInputFields() : i === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
435
- (l) => [l, this.resolve({ field: l, assertFieldType: i })]
435
+ let c = (i === "Input" ? this.listInputFields() : i === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
436
+ (u) => [u, this.resolve({ field: u, assertFieldType: i })]
436
437
  );
437
- return s && (d = d.filter((l) => l[1] !== void 0)), d.map(([l, g]) => u(l, g));
438
+ return s && (c = c.filter((u) => u[1] !== void 0)), c.map(([u, h]) => o(u, h));
438
439
  }
439
440
  }
440
- const L = "staging", T = "main";
441
- function j(e) {
441
+ const Y = "staging", Q = "main";
442
+ function X(e) {
442
443
  return typeof e == "object" && e !== null && "__awaited_futures__" in e;
443
444
  }
444
- function R(e, t, n) {
445
+ function B(e, t, n) {
445
446
  if (t.has(n)) return;
446
447
  if (t.add(n), typeof n === "object")
447
- if (j(n)) n.__awaited_futures__.forEach((r) => e.add(r));
448
+ if (X(n)) n.__awaited_futures__.forEach((r) => e.add(r));
448
449
  else if (Array.isArray(n))
449
- for (const r of n) R(e, t, r);
450
+ for (const r of n) B(e, t, r);
450
451
  else
451
452
  for (const [, r] of Object.entries(n))
452
- r !== n && R(e, t, r);
453
+ r !== n && B(e, t, r);
453
454
  }
454
- function z(e) {
455
+ function pt(e) {
455
456
  const t = /* @__PURE__ */ new Set();
456
- return R(t, /* @__PURE__ */ new Set(), e), t;
457
+ return B(t, /* @__PURE__ */ new Set(), e), t;
457
458
  }
458
- const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
459
+ const ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
459
460
  __proto__: null,
460
- MainAccessorName: T,
461
- StagingAccessorName: L,
462
- getAllFutureAwaits: z,
463
- isFutureAwait: j
464
- }, Symbol.toStringTag, { value: "Module" }));
465
- class Q {
461
+ MainAccessorName: Q,
462
+ StagingAccessorName: Y,
463
+ getAllFutureAwaits: pt,
464
+ isFutureAwait: X
465
+ }, Symbol.toStringTag, { value: "Module" })), ht = "pl7.app/label", ft = "pl7.app/trace", gt = A.object({
466
+ type: A.string(),
467
+ importance: A.number().optional(),
468
+ id: A.string().optional(),
469
+ label: A.string()
470
+ }), mt = A.array(gt), yt = 1e-3, bt = "__LABEL__", H = "__LABEL__@1";
471
+ function _t(e, t, n = {}) {
472
+ const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = e.map((d) => {
473
+ var N, $;
474
+ const m = t(d), y = (N = m.annotations) == null ? void 0 : N[ht], R = ($ = m.annotations) == null ? void 0 : $[ft], b = (R ? mt.safeParse(JSON.parse(R)).data : void 0) ?? [];
475
+ y && b.splice(0, 0, { label: y, type: bt, importance: -2 });
476
+ const k = [], U = /* @__PURE__ */ new Map();
477
+ for (let w = b.length - 1; w >= 0; --w) {
478
+ const { type: x } = b[w], tt = b[w].importance ?? 0, j = (U.get(x) ?? 0) + 1;
479
+ U.set(x, j);
480
+ const C = `${x}@${j}`;
481
+ r.set(C, (r.get(C) ?? 0) + 1), i.set(
482
+ C,
483
+ Math.max(
484
+ i.get(C) ?? Number.NEGATIVE_INFINITY,
485
+ tt - (b.length - w) * yt
486
+ )
487
+ ), k.push({ ...b[w], fullType: C, occurenceIndex: j });
488
+ }
489
+ return k.reverse(), {
490
+ value: d,
491
+ spec: m,
492
+ label: y,
493
+ fullTrace: k
494
+ };
495
+ }), o = [], a = [], c = [...i];
496
+ c.sort(([, d], [, m]) => m - d);
497
+ for (const [d] of c)
498
+ d.endsWith("@1") || r.get(d) === e.length ? o.push(d) : a.push(d);
499
+ const u = (d) => s.map((m) => {
500
+ const y = m.fullTrace.filter((b) => d.has(b.fullType)).map((b) => b.label), R = n.separator ?? " / ";
501
+ return {
502
+ label: y.join(R),
503
+ value: m.value
504
+ };
505
+ });
506
+ if (o.length === 0) {
507
+ if (a.length !== 0) throw new Error("Assertion error.");
508
+ return u(new Set(H));
509
+ }
510
+ let h = 0, T = 0;
511
+ for (; h < o.length; ) {
512
+ const d = /* @__PURE__ */ new Set();
513
+ for (let y = 0; y < h; ++y) d.add(o[y]);
514
+ d.add(o[T]);
515
+ const m = u(d);
516
+ if (new Set(m.map((y) => y.label)).size === e.length)
517
+ return n.includeNativeLabel ? (d.add(H), u(d)) : m;
518
+ T++, T == o.length && (h++, T = h);
519
+ }
520
+ return u(/* @__PURE__ */ new Set([...o, ...a]));
521
+ }
522
+ class vt {
466
523
  constructor() {
467
- f(this, "ctx", o());
468
- f(this, "defaultLabelFn", (t, n) => {
524
+ _(this, "ctx", l());
525
+ _(this, "defaultLabelFn", (t, n) => {
469
526
  var i;
470
527
  return ((i = t.annotations) == null ? void 0 : i["pl7.app/label"]) ?? "Unlabelled";
471
528
  });
@@ -476,10 +533,16 @@ class Q {
476
533
  calculateOptions(t) {
477
534
  return this.ctx.calculateOptions(t);
478
535
  }
479
- getOptions(t, n = this.defaultLabelFn) {
480
- return this.getSpecs().entries.filter((i) => t(i.obj)).map((i) => ({
481
- ref: i.ref,
482
- label: n(i.obj, i.ref)
536
+ getOptions(t, n) {
537
+ const i = this.getSpecs().entries.filter((r) => t(r.obj));
538
+ return typeof n == "object" || typeof n > "u" ? _t(i, (r) => r.obj, n ?? {}).map(
539
+ ({ value: { ref: r }, label: s }) => ({
540
+ ref: r,
541
+ label: s
542
+ })
543
+ ) : i.map((r) => ({
544
+ ref: r.ref,
545
+ label: n(r.obj, r.ref)
483
546
  }));
484
547
  }
485
548
  /**
@@ -496,7 +559,7 @@ class Q {
496
559
  ref: n.ref,
497
560
  obj: {
498
561
  ...n.obj,
499
- data: new m(n.obj.data)
562
+ data: new v(n.obj.data)
500
563
  }
501
564
  }))
502
565
  };
@@ -515,7 +578,7 @@ class Q {
515
578
  ref: n.ref,
516
579
  obj: {
517
580
  ...n.obj,
518
- data: B(n.obj.data, (i) => new m(i))
581
+ data: it(n.obj.data, (i) => new v(i))
519
582
  }
520
583
  }))
521
584
  };
@@ -537,9 +600,9 @@ class Q {
537
600
  var n;
538
601
  return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
539
602
  (i) => i.ref.blockId === t.blockId && i.ref.name === t.name
540
- )) == null ? void 0 : n.obj : A(
603
+ )) == null ? void 0 : n.obj : D(
541
604
  this.ctx.getDataFromResultPoolByRef(t.blockId, t.name),
542
- (i) => new m(i)
605
+ (i) => new v(i)
543
606
  );
544
607
  }
545
608
  /**
@@ -559,13 +622,13 @@ class Q {
559
622
  findDataWithCompatibleSpec(t) {
560
623
  const n = [];
561
624
  t: for (const i of this.getData().entries) {
562
- if (!$(i.obj.spec))
625
+ if (!rt(i.obj.spec))
563
626
  continue;
564
627
  const r = i.obj.spec;
565
- if (t.name === r.name && t.valueType === r.valueType && t.axesSpec.length === r.axesSpec.length && P(t.domain, r.domain)) {
628
+ if (t.name === r.name && t.valueType === r.valueType && t.axesSpec.length === r.axesSpec.length && W(t.domain, r.domain)) {
566
629
  for (let s = 0; s < t.axesSpec.length; ++s) {
567
- const u = t.axesSpec[s], a = r.axesSpec[s];
568
- if (u.name !== a.name || u.type !== a.type || !P(u.domain, a.domain))
630
+ const o = t.axesSpec[s], a = r.axesSpec[s];
631
+ if (o.name !== a.name || o.type !== a.type || !W(o.domain, a.domain))
569
632
  continue t;
570
633
  }
571
634
  n.push(i.obj);
@@ -574,27 +637,27 @@ class Q {
574
637
  return n;
575
638
  }
576
639
  }
577
- function P(e, t) {
640
+ function W(e, t) {
578
641
  if (e === void 0) return t === void 0;
579
642
  if (t === void 0) return !0;
580
643
  for (const n in t)
581
644
  if (e[n] !== t[n]) return !1;
582
645
  return !0;
583
646
  }
584
- class w {
647
+ class O {
585
648
  constructor() {
586
- f(this, "ctx");
587
- f(this, "args");
588
- f(this, "uiState");
589
- f(this, "resultPool", new Q());
590
- this.ctx = o(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
649
+ _(this, "ctx");
650
+ _(this, "args");
651
+ _(this, "uiState");
652
+ _(this, "resultPool", new vt());
653
+ this.ctx = l(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
591
654
  }
592
655
  getNamedAccessor(t) {
593
656
  const n = this.ctx.getAccessorHandleByName(t);
594
- return n ? new m(n) : void 0;
657
+ return n ? new v(n) : void 0;
595
658
  }
596
659
  get prerun() {
597
- return this.getNamedAccessor(L);
660
+ return this.getNamedAccessor(Y);
598
661
  }
599
662
  /**
600
663
  * @deprecated use prerun
@@ -609,7 +672,7 @@ class w {
609
672
  return this.precalc;
610
673
  }
611
674
  get outputs() {
612
- return this.getNamedAccessor(T);
675
+ return this.getNamedAccessor(Q);
613
676
  }
614
677
  /**
615
678
  * @deprecated use outputs
@@ -618,7 +681,7 @@ class w {
618
681
  return this.outputs;
619
682
  }
620
683
  createPFrame(t) {
621
- return this.ctx.createPFrame(t.map((n) => A(n, (i) => i.handle)));
684
+ return this.ctx.createPFrame(t.map((n) => D(n, (i) => i.handle)));
622
685
  }
623
686
  createPTable(t) {
624
687
  var n;
@@ -629,7 +692,7 @@ class w {
629
692
  },
630
693
  filters: t.filters ?? [],
631
694
  sorting: t.sorting ?? []
632
- } : n = t, this.ctx.createPTable(J(n, (i) => A(i, (r) => r.handle)));
695
+ } : n = t, this.ctx.createPTable(st(n, (i) => D(i, (r) => r.handle)));
633
696
  }
634
697
  /** @deprecated scheduled for removal from SDK */
635
698
  getBlockLabel(t) {
@@ -640,26 +703,26 @@ class w {
640
703
  return this.ctx.getCurrentUnstableMarker();
641
704
  }
642
705
  }
643
- const X = "PColumnData/ResourceMap", Y = "PColumnData/Partitioned/ResourceMap";
644
- function E(e, t, n, i = [], r) {
706
+ const wt = "PColumnData/ResourceMap", St = "PColumnData/Partitioned/ResourceMap";
707
+ function Z(e, t, n, i = [], r) {
645
708
  if (e === void 0) return !1;
646
709
  switch (e.resourceType.name) {
647
- case X: {
710
+ case wt: {
648
711
  let s = e.getInputsLocked();
649
- for (const u of e.listInputFields()) {
650
- const a = e.resolve({ field: u, assertFieldType: "Input" }), d = [...i, ...JSON.parse(u)], l = a === void 0 ? void 0 : t(a);
651
- l === void 0 && (s = !1), (l !== void 0 || r) && n.push({ key: d, value: l });
712
+ for (const o of e.listInputFields()) {
713
+ const a = e.resolve({ field: o, assertFieldType: "Input" }), c = [...i, ...JSON.parse(o)], u = a === void 0 ? void 0 : t(a);
714
+ u === void 0 && (s = !1), (u !== void 0 || r) && n.push({ key: c, value: u });
652
715
  }
653
716
  return s;
654
717
  }
655
- case Y: {
718
+ case St: {
656
719
  let s = e.getInputsLocked();
657
- for (const u of e.listInputFields()) {
658
- const a = e.resolve({ field: u, assertFieldType: "Input" });
720
+ for (const o of e.listInputFields()) {
721
+ const a = e.resolve({ field: o, assertFieldType: "Input" });
659
722
  if (a === void 0) s = !1;
660
723
  else {
661
- const d = [...i, ...JSON.parse(u)], l = E(a, t, n, d, r);
662
- s = s && l;
724
+ const c = [...i, ...JSON.parse(o)], u = Z(a, t, n, c, r);
725
+ s = s && u;
663
726
  }
664
727
  }
665
728
  return s;
@@ -668,23 +731,23 @@ function E(e, t, n, i = [], r) {
668
731
  throw new Error(`Unknown resource type: ${e.resourceType.name}`);
669
732
  }
670
733
  }
671
- function Dt(e, t, n = !1) {
734
+ function ne(e, t, n = !1) {
672
735
  const i = [];
673
- return { isComplete: E(e, t, i, [], n), data: i };
736
+ return { isComplete: Z(e, t, i, [], n), data: i };
674
737
  }
675
- const b = "1.10.2";
676
- function Z(e) {
738
+ const F = "1.12.0";
739
+ function At(e) {
677
740
  return e.__renderLambda === !0;
678
741
  }
679
- function I(e) {
742
+ function M(e) {
680
743
  if (e !== void 0)
681
- return Z(e) ? e.handle : e;
744
+ return At(e) ? e.handle : e;
682
745
  }
683
- function y(e) {
746
+ function S(e) {
684
747
  if (e !== void 0)
685
748
  return typeof e == "string" ? { __renderLambda: !0, handle: e, retentive: !1 } : e;
686
749
  }
687
- function kt(e) {
750
+ function ie(e) {
688
751
  if (e.v3 !== void 0) {
689
752
  const {
690
753
  initialArgs: t,
@@ -692,54 +755,54 @@ function kt(e) {
692
755
  inputsValid: i,
693
756
  outputs: r,
694
757
  renderingMode: s,
695
- sdkVersion: u,
758
+ sdkVersion: o,
696
759
  sections: a,
697
- title: d
698
- } = e.v3, { code: l } = e;
760
+ title: c
761
+ } = e.v3, { code: u } = e;
699
762
  return {
700
763
  initialArgs: t,
701
764
  initialUiState: n,
702
765
  inputsValid: i,
703
766
  outputs: r,
704
767
  renderingMode: s,
705
- sdkVersion: u,
768
+ sdkVersion: o,
706
769
  sections: a,
707
- title: d,
708
- code: l
770
+ title: c,
771
+ code: u
709
772
  };
710
773
  } else if (e.inputsValid !== void 0) {
711
- const { sdkVersion: t, renderingMode: n, outputs: i, inputsValid: r, sections: s, initialArgs: u, code: a } = e, d = Object.keys(e);
712
- if (t === void 0 || n === void 0 || i === void 0 || r === void 0 || s === void 0 || u === void 0)
774
+ const { sdkVersion: t, renderingMode: n, outputs: i, inputsValid: r, sections: s, initialArgs: o, code: a } = e, c = Object.keys(e);
775
+ if (t === void 0 || n === void 0 || i === void 0 || r === void 0 || s === void 0 || o === void 0)
713
776
  throw new Error(
714
- `Malformed config v2. SDK version ${t}; Fields = ${d.join(", ")}`
777
+ `Malformed config v2. SDK version ${t}; Fields = ${c.join(", ")}`
715
778
  );
716
779
  return {
717
780
  sdkVersion: t,
718
781
  renderingMode: n,
719
- initialArgs: u,
782
+ initialArgs: o,
720
783
  outputs: Object.fromEntries(
721
- Object.entries(i).map(([l, g]) => [l, y(g)])
784
+ Object.entries(i).map(([u, h]) => [u, S(h)])
722
785
  ),
723
- inputsValid: y(r),
724
- sections: y(s),
786
+ inputsValid: S(r),
787
+ sections: S(s),
725
788
  initialUiState: void 0,
726
789
  code: a
727
790
  };
728
791
  } else if (e.renderingMode !== void 0) {
729
- const { sdkVersion: t, canRun: n, renderingMode: i, outputs: r, sections: s, initialArgs: u, code: a } = e, d = Object.keys(e);
730
- if (i === void 0 || r === void 0 || n === void 0 || s === void 0 || u === void 0)
792
+ const { sdkVersion: t, canRun: n, renderingMode: i, outputs: r, sections: s, initialArgs: o, code: a } = e, c = Object.keys(e);
793
+ if (i === void 0 || r === void 0 || n === void 0 || s === void 0 || o === void 0)
731
794
  throw new Error(
732
- `Malformed config v1. SDK version ${t}; Fields = ${d.join(", ")}`
795
+ `Malformed config v1. SDK version ${t}; Fields = ${c.join(", ")}`
733
796
  );
734
797
  return {
735
798
  sdkVersion: t ?? "unknown",
736
799
  renderingMode: i,
737
- initialArgs: u,
800
+ initialArgs: o,
738
801
  outputs: Object.fromEntries(
739
- Object.entries(r).map(([l, g]) => [l, y(g)])
802
+ Object.entries(r).map(([u, h]) => [u, S(h)])
740
803
  ),
741
- inputsValid: y(n),
742
- sections: y(s),
804
+ inputsValid: S(n),
805
+ sections: S(s),
743
806
  initialUiState: void 0,
744
807
  code: a
745
808
  };
@@ -750,25 +813,25 @@ function kt(e) {
750
813
  );
751
814
  }
752
815
  }
753
- class p {
754
- constructor(t, n, i, r, s, u, a) {
755
- this._renderingMode = t, this._initialArgs = n, this._initialUiState = i, this._outputs = r, this._inputsValid = s, this._sections = u, this._title = a;
816
+ class f {
817
+ constructor(t, n, i, r, s, o, a) {
818
+ this._renderingMode = t, this._initialArgs = n, this._initialUiState = i, this._outputs = r, this._inputsValid = s, this._sections = o, this._title = a;
756
819
  }
757
820
  static create(t = "Heavy") {
758
- return new p(
821
+ return new f(
759
822
  t,
760
823
  void 0,
761
824
  {},
762
825
  {},
763
- C(!0),
764
- C([]),
826
+ V(!0),
827
+ V([]),
765
828
  void 0
766
829
  );
767
830
  }
768
831
  output(t, n, i = {}) {
769
832
  if (typeof n == "function") {
770
833
  const r = `output#${t}`;
771
- return _(r, () => n(new w())), new p(
834
+ return P(r, () => n(new O())), new f(
772
835
  this._renderingMode,
773
836
  this._initialArgs,
774
837
  this._initialUiState,
@@ -785,7 +848,7 @@ class p {
785
848
  this._title
786
849
  );
787
850
  } else
788
- return new p(
851
+ return new f(
789
852
  this._renderingMode,
790
853
  this._initialArgs,
791
854
  this._initialUiState,
@@ -807,7 +870,7 @@ class p {
807
870
  return this.inputsValid(t);
808
871
  }
809
872
  argsValid(t) {
810
- return typeof t == "function" ? (_("inputsValid", () => t(new w())), new p(
873
+ return typeof t == "function" ? (P("inputsValid", () => t(new O())), new f(
811
874
  this._renderingMode,
812
875
  this._initialArgs,
813
876
  this._initialUiState,
@@ -818,7 +881,7 @@ class p {
818
881
  },
819
882
  this._sections,
820
883
  this._title
821
- )) : new p(
884
+ )) : new f(
822
885
  this._renderingMode,
823
886
  this._initialArgs,
824
887
  this._initialUiState,
@@ -832,7 +895,7 @@ class p {
832
895
  return this.argsValid(t);
833
896
  }
834
897
  sections(t) {
835
- return Array.isArray(t) ? this.sections(C(t)) : typeof t == "function" ? (_("sections", () => t(new w())), new p(
898
+ return Array.isArray(t) ? this.sections(V(t)) : typeof t == "function" ? (P("sections", () => t(new O())), new f(
836
899
  this._renderingMode,
837
900
  this._initialArgs,
838
901
  this._initialUiState,
@@ -840,7 +903,7 @@ class p {
840
903
  this._inputsValid,
841
904
  { __renderLambda: !0, handle: "sections" },
842
905
  this._title
843
- )) : new p(
906
+ )) : new f(
844
907
  this._renderingMode,
845
908
  this._initialArgs,
846
909
  this._initialUiState,
@@ -851,7 +914,7 @@ class p {
851
914
  );
852
915
  }
853
916
  title(t) {
854
- return _("title", () => t(new w())), new p(
917
+ return P("title", () => t(new O())), new f(
855
918
  this._renderingMode,
856
919
  this._initialArgs,
857
920
  this._initialUiState,
@@ -866,7 +929,7 @@ class p {
866
929
  * @deprecated use {@link withArgs}
867
930
  * */
868
931
  initialArgs(t) {
869
- return new p(
932
+ return new f(
870
933
  this._renderingMode,
871
934
  t,
872
935
  this._initialUiState,
@@ -878,7 +941,7 @@ class p {
878
941
  }
879
942
  /** Sets initial args for the block, this value must be specified. */
880
943
  withArgs(t) {
881
- return new p(
944
+ return new f(
882
945
  this._renderingMode,
883
946
  t,
884
947
  this._initialUiState,
@@ -890,7 +953,7 @@ class p {
890
953
  }
891
954
  /** Defines type and sets initial value for block UiState. */
892
955
  withUiState(t) {
893
- return new p(
956
+ return new f(
894
957
  this._renderingMode,
895
958
  this._initialArgs,
896
959
  t,
@@ -907,7 +970,7 @@ class p {
907
970
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
908
971
  const t = {
909
972
  v3: {
910
- sdkVersion: b,
973
+ sdkVersion: F,
911
974
  renderingMode: this._renderingMode,
912
975
  initialArgs: this._initialArgs,
913
976
  initialUiState: this._initialUiState,
@@ -917,34 +980,34 @@ class p {
917
980
  outputs: this._outputs
918
981
  },
919
982
  // fields below are added to allow previous desktop versions read generated configs
920
- sdkVersion: b,
983
+ sdkVersion: F,
921
984
  renderingMode: this._renderingMode,
922
985
  initialArgs: this._initialArgs,
923
- inputsValid: I(this._inputsValid),
924
- sections: I(this._sections),
986
+ inputsValid: M(this._inputsValid),
987
+ sections: M(this._sections),
925
988
  outputs: Object.fromEntries(
926
- Object.entries(this._outputs).map(([n, i]) => [n, I(i)])
989
+ Object.entries(this._outputs).map(([n, i]) => [n, M(i)])
927
990
  )
928
991
  };
929
- return K() ? x({ sdkVersion: b }) : { config: t };
992
+ return ut() ? q({ sdkVersion: F }) : { config: t };
930
993
  }
931
994
  }
932
- function xt(e, t, n) {
933
- var s, u;
934
- const i = e.resultPool.getData().entries.map((a) => a.obj).filter(D).filter((a) => a.spec.name === "pl7.app/label" && a.spec.axesSpec.length === 1), r = [];
995
+ function re(e, t, n) {
996
+ var s, o;
997
+ const i = e.resultPool.getData().entries.map((a) => a.obj).filter(K).filter((a) => a.spec.name === "pl7.app/label" && a.spec.axesSpec.length === 1), r = [];
935
998
  for (const a of t)
936
- for (const d of a.spec.axesSpec) {
937
- const l = O(d);
938
- for (const g of i)
939
- N(l, O(g.spec.axesSpec[0])) && r.push(g);
999
+ for (const c of a.spec.axesSpec) {
1000
+ const u = J(c);
1001
+ for (const h of i)
1002
+ ot(u, J(h.spec.axesSpec[0])) && r.push(h);
940
1003
  }
941
1004
  return e.createPTable({
942
1005
  columns: [...t, ...r],
943
1006
  filters: (s = n == null ? void 0 : n.pTableParams) == null ? void 0 : s.filters,
944
- sorting: (u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.sorting
1007
+ sorting: (o = n == null ? void 0 : n.pTableParams) == null ? void 0 : o.sorting
945
1008
  });
946
1009
  }
947
- class Lt {
1010
+ class se {
948
1011
  constructor(t) {
949
1012
  this.handle = t;
950
1013
  }
@@ -964,81 +1027,81 @@ class Lt {
964
1027
  return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
965
1028
  }
966
1029
  }
967
- function tt(e) {
968
- return k({
1030
+ function Ct(e) {
1031
+ return z({
969
1032
  __isRef: !0,
970
- blockId: S(e, "blockId"),
971
- name: S(e, "name")
1033
+ blockId: L(e, "blockId"),
1034
+ name: L(e, "name")
972
1035
  });
973
1036
  }
974
- function Tt(e) {
975
- return k({
976
- ref: tt(S(e, "ref")),
977
- label: S(e, "label")
1037
+ function oe(e) {
1038
+ return z({
1039
+ ref: Ct(L(e, "ref")),
1040
+ label: L(e, "label")
978
1041
  });
979
1042
  }
980
- const jt = {
981
- sdkVersion: b
1043
+ const ae = {
1044
+ sdkVersion: F
982
1045
  };
983
- function Et() {
984
- return x({ sdkVersion: b });
1046
+ function le() {
1047
+ return q({ sdkVersion: F });
985
1048
  }
986
- function Mt(e) {
1049
+ function ue(e) {
987
1050
  if (typeof globalThis.getEnvironmentValue == "function")
988
1051
  return globalThis.getEnvironmentValue(e);
989
1052
  }
990
1053
  export {
991
- st as Args,
992
- p as BlockModel,
993
- jt as CurrentSdkInfo,
994
- h as FutureRef,
995
- ot as It,
996
- Pt as JsRenderInternal,
997
- at as MainOutputs,
998
- G as OutputError,
999
- Lt as PFrameImpl,
1000
- w as RenderCtx,
1001
- Y as ResourceMapResourcePartitionedTypeName,
1002
- X as ResourceMapResourceTypeName,
1003
- Q as ResultPool,
1004
- ut as StagingOutputs,
1005
- m as TreeNodeAccessor,
1006
- lt as UiState,
1007
- mt as and,
1008
- xt as createPlDataTable,
1009
- I as downgradeCfgOrLambda,
1010
- kt as extractConfig,
1011
- ht as flatten,
1012
- Tt as fromPlOption,
1013
- tt as fromPlRef,
1014
- wt as getBlobContent,
1015
- At as getBlobContentAsJson,
1016
- Ct as getBlobContentAsString,
1017
- St as getDownloadedBlobContent,
1018
- Mt as getEnvironmentValue,
1019
- v as getFromCfg,
1020
- C as getImmediate,
1021
- It as getImportProgress,
1022
- S as getJsonField,
1023
- Rt as getLastLogs,
1024
- Vt as getLogHandle,
1025
- Ft as getOnDemandBlobContent,
1026
- Ot as getProgressLog,
1027
- Et as getRawPlatformaInstance,
1028
- bt as getResourceField,
1029
- vt as getResourceValueAsJson,
1030
- Z as isConfigLambda,
1031
- ft as isEmpty,
1032
- rt as isolate,
1033
- ct as makeArray,
1034
- k as makeObject,
1035
- pt as mapArrayValues,
1036
- dt as mapRecordValues,
1037
- _t as mapResourceFields,
1038
- gt as not,
1039
- yt as or,
1040
- Dt as parseResourceMap,
1041
- H as readOutput,
1042
- it as wrapOutputs
1054
+ Ot as Args,
1055
+ f as BlockModel,
1056
+ ae as CurrentSdkInfo,
1057
+ g as FutureRef,
1058
+ Vt as It,
1059
+ ee as JsRenderInternal,
1060
+ Dt as MainOutputs,
1061
+ at as OutputError,
1062
+ se as PFrameImpl,
1063
+ O as RenderCtx,
1064
+ St as ResourceMapResourcePartitionedTypeName,
1065
+ wt as ResourceMapResourceTypeName,
1066
+ vt as ResultPool,
1067
+ Lt as StagingOutputs,
1068
+ v as TreeNodeAccessor,
1069
+ kt as UiState,
1070
+ Nt as and,
1071
+ re as createPlDataTable,
1072
+ M as downgradeCfgOrLambda,
1073
+ ie as extractConfig,
1074
+ Mt as flatten,
1075
+ oe as fromPlOption,
1076
+ Ct as fromPlRef,
1077
+ Wt as getBlobContent,
1078
+ zt as getBlobContentAsJson,
1079
+ Kt as getBlobContentAsString,
1080
+ qt as getDownloadedBlobContent,
1081
+ ue as getEnvironmentValue,
1082
+ I as getFromCfg,
1083
+ V as getImmediate,
1084
+ Qt as getImportProgress,
1085
+ L as getJsonField,
1086
+ Xt as getLastLogs,
1087
+ te as getLogHandle,
1088
+ Yt as getOnDemandBlobContent,
1089
+ Zt as getProgressLog,
1090
+ le as getRawPlatformaInstance,
1091
+ Jt as getResourceField,
1092
+ Gt as getResourceValueAsJson,
1093
+ At as isConfigLambda,
1094
+ Bt as isEmpty,
1095
+ Pt as isolate,
1096
+ xt as makeArray,
1097
+ z as makeObject,
1098
+ Et as mapArrayValues,
1099
+ jt as mapRecordValues,
1100
+ Ht as mapResourceFields,
1101
+ Ut as not,
1102
+ $t as or,
1103
+ ne as parseResourceMap,
1104
+ lt as readOutput,
1105
+ Rt as wrapOutputs
1043
1106
  };
1044
1107
  //# sourceMappingURL=index.mjs.map