@platforma-sdk/model 1.2.28 → 1.2.30

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,28 +1,28 @@
1
- var v = Object.defineProperty;
2
- var D = (e, t, n) => t in e ? v(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var l = (e, t, n) => D(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { isPColumn as O, mapPObjectData as w, mapValueInVOE as x, mapPTableDef as I } from "@milaboratories/pl-model-common";
1
+ var D = Object.defineProperty;
2
+ var I = (e, t, n) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var l = (e, t, n) => I(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { isPColumn as O, mapPObjectData as w, mapValueInVOE as x, mapPTableDef as B } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
- class B extends Error {
6
+ class E extends Error {
7
7
  constructor(t, n) {
8
8
  super(`${t.length}${n ? "+" : ""} errors, first error: ` + t[0]), this.errors = t, this.moreErrors = n;
9
9
  }
10
10
  }
11
- function L(e) {
12
- if (!e.ok) throw new B(e.errors, e.moreErrors);
11
+ function T(e) {
12
+ if (!e.ok) throw new E(e.errors, e.moreErrors);
13
13
  return e.value;
14
14
  }
15
- function T(e) {
15
+ function M(e) {
16
16
  return new Proxy(e, {
17
17
  get(t, n) {
18
- return L(t[n]);
18
+ return T(t[n]);
19
19
  }
20
20
  });
21
21
  }
22
22
  function i(e) {
23
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? p(e) : e;
23
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? h(e) : e;
24
24
  }
25
- function g(e) {
25
+ function d(e) {
26
26
  return { type: "GetFromCtx", variable: e };
27
27
  }
28
28
  function K(e) {
@@ -31,8 +31,8 @@ function K(e) {
31
31
  cfg: e
32
32
  };
33
33
  }
34
- const W = g("$args"), z = g("$it"), U = g("$prod"), q = g("$staging"), Q = g("$ui");
35
- function p(e) {
34
+ const W = d("$args"), z = d("$it"), U = d("$prod"), q = d("$staging"), Q = d("$ui");
35
+ function h(e) {
36
36
  return { type: "Immediate", value: e };
37
37
  }
38
38
  function C(e) {
@@ -51,7 +51,7 @@ function X(...e) {
51
51
  template: t
52
52
  };
53
53
  }
54
- function h(e, t) {
54
+ function p(e, t) {
55
55
  return {
56
56
  type: "GetJsonField",
57
57
  source: i(e),
@@ -149,25 +149,25 @@ function ct() {
149
149
  };
150
150
  };
151
151
  }
152
- function dt(e) {
152
+ function gt(e) {
153
153
  return {
154
154
  type: "GetDownloadedBlobContent",
155
155
  source: i(e)
156
156
  };
157
157
  }
158
- function gt(e) {
158
+ function dt(e) {
159
159
  return {
160
160
  type: "GetOnDemandBlobContent",
161
161
  source: i(e)
162
162
  };
163
163
  }
164
- function pt(e) {
164
+ function ht(e) {
165
165
  return {
166
166
  type: "GetImportProgress",
167
167
  source: i(e)
168
168
  };
169
169
  }
170
- function ht(e, t) {
170
+ function pt(e, t) {
171
171
  return {
172
172
  type: "GetLastLogs",
173
173
  source: i(e),
@@ -187,29 +187,30 @@ function mt(e) {
187
187
  source: i(e)
188
188
  };
189
189
  }
190
- function E() {
191
- return typeof getPlatforma < "u" || typeof platforma < "u";
190
+ function L() {
191
+ return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
192
192
  }
193
- function k(e) {
194
- if (typeof getPlatforma == "function") return getPlatforma(e);
195
- if (typeof platforma < "u") return platforma;
193
+ function _(e) {
194
+ if (e && typeof globalThis.getPlatforma == "function")
195
+ return globalThis.getPlatforma(e);
196
+ if (typeof globalThis.platforma < "u") return globalThis.platforma;
196
197
  throw new Error("Can't get platforma instance.");
197
198
  }
198
- function j() {
199
- if (typeof cfgRenderCtx < "u") return cfgRenderCtx;
199
+ function k() {
200
+ if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
200
201
  }
201
202
  function s() {
202
- if (typeof cfgRenderCtx < "u") return cfgRenderCtx;
203
+ if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
203
204
  throw new Error("Not in config rendering context");
204
205
  }
205
206
  function f(e, t) {
206
- const n = j();
207
+ const n = k();
207
208
  if (n === void 0) return !1;
208
209
  if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
209
210
  return n.callbackRegistry[e] = t, !0;
210
211
  }
211
212
  const m = /* @__PURE__ */ new Map();
212
- function H(e, t) {
213
+ function j(e, t) {
213
214
  e in s().callbackRegistry || (s().callbackRegistry[e] = (n) => {
214
215
  for (const r of m.get(e))
215
216
  r(n);
@@ -219,7 +220,7 @@ class a {
219
220
  constructor(t, n = (r) => r) {
220
221
  l(this, "isResolved", !1);
221
222
  l(this, "resolvedValue");
222
- this.handle = t, this.postProcess = n, H(t, (r) => {
223
+ this.handle = t, this.postProcess = n, j(t, (r) => {
223
224
  this.resolvedValue = n(r), this.isResolved = !0;
224
225
  });
225
226
  }
@@ -236,10 +237,10 @@ class a {
236
237
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
237
238
  }
238
239
  }
239
- function b(e) {
240
- return e === void 0 ? void 0 : new d(e);
240
+ function A(e) {
241
+ return e === void 0 ? void 0 : new g(e);
241
242
  }
242
- class d {
243
+ class g {
243
244
  constructor(t) {
244
245
  this.handle = t;
245
246
  }
@@ -247,7 +248,7 @@ class d {
247
248
  return this.resolveWithCommon({}, ...t);
248
249
  }
249
250
  resolveWithCommon(t, ...n) {
250
- return b(s().resolveWithCommon(this.handle, t, ...n));
251
+ return A(s().resolveWithCommon(this.handle, t, ...n));
251
252
  }
252
253
  get resourceType() {
253
254
  return s().getResourceType(this.handle);
@@ -265,7 +266,7 @@ class d {
265
266
  return s().getIsFinal(this.handle);
266
267
  }
267
268
  getError() {
268
- return b(s().getError(this.handle));
269
+ return A(s().getError(this.handle));
269
270
  }
270
271
  listInputFields() {
271
272
  return s().listInputFields(this.handle);
@@ -320,7 +321,7 @@ class d {
320
321
  if (r === void 0) return;
321
322
  const o = {};
322
323
  for (const [c, R] of Object.entries(r))
323
- o[c] = w(R, (V) => new d(V));
324
+ o[c] = w(R, (S) => new g(S));
324
325
  return o;
325
326
  }
326
327
  getFileContentAsBase64() {
@@ -383,32 +384,32 @@ class d {
383
384
  return new a(s().getLogHandle(this.handle));
384
385
  }
385
386
  }
386
- const _ = "staging", F = "main";
387
- function P(e) {
387
+ const F = "staging", P = "main";
388
+ function v(e) {
388
389
  return typeof e == "object" && e !== null && "__awaited_futures__" in e;
389
390
  }
390
- function A(e, t, n) {
391
+ function b(e, t, n) {
391
392
  if (t.has(n)) return;
392
393
  if (t.add(n), typeof n === "object")
393
- if (P(n)) n.__awaited_futures__.forEach((o) => e.add(o));
394
+ if (v(n)) n.__awaited_futures__.forEach((o) => e.add(o));
394
395
  else if (Array.isArray(n))
395
- for (const o of n) A(e, t, o);
396
+ for (const o of n) b(e, t, o);
396
397
  else
397
398
  for (const [, o] of Object.entries(n))
398
- o !== n && A(e, t, o);
399
+ o !== n && b(e, t, o);
399
400
  }
400
- function J(e) {
401
+ function H(e) {
401
402
  const t = /* @__PURE__ */ new Set();
402
- return A(t, /* @__PURE__ */ new Set(), e), t;
403
+ return b(t, /* @__PURE__ */ new Set(), e), t;
403
404
  }
404
405
  const yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
405
406
  __proto__: null,
406
- MainAccessorName: F,
407
- StagingAccessorName: _,
408
- getAllFutureAwaits: J,
409
- isFutureAwait: P
407
+ MainAccessorName: P,
408
+ StagingAccessorName: F,
409
+ getAllFutureAwaits: H,
410
+ isFutureAwait: v
410
411
  }, Symbol.toStringTag, { value: "Module" }));
411
- class G {
412
+ class J {
412
413
  constructor() {
413
414
  l(this, "ctx", s());
414
415
  }
@@ -423,7 +424,7 @@ class G {
423
424
  ref: n.ref,
424
425
  obj: {
425
426
  ...n.obj,
426
- data: new d(n.obj.data)
427
+ data: new g(n.obj.data)
427
428
  }
428
429
  }))
429
430
  };
@@ -436,7 +437,7 @@ class G {
436
437
  ref: n.ref,
437
438
  obj: {
438
439
  ...n.obj,
439
- data: x(n.obj.data, (r) => new d(r))
440
+ data: x(n.obj.data, (r) => new g(r))
440
441
  }
441
442
  }))
442
443
  };
@@ -450,15 +451,15 @@ class y {
450
451
  l(this, "ctx");
451
452
  l(this, "args");
452
453
  l(this, "uiState");
453
- l(this, "resultPool", new G());
454
+ l(this, "resultPool", new J());
454
455
  this.ctx = s(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
455
456
  }
456
457
  getNamedAccessor(t) {
457
458
  const n = this.ctx.getAccessorHandleByName(t);
458
- return n ? new d(n) : void 0;
459
+ return n ? new g(n) : void 0;
459
460
  }
460
461
  get prerun() {
461
- return this.getNamedAccessor(_);
462
+ return this.getNamedAccessor(F);
462
463
  }
463
464
  /**
464
465
  * @deprecated use prerun
@@ -473,7 +474,7 @@ class y {
473
474
  return this.precalc;
474
475
  }
475
476
  get outputs() {
476
- return this.getNamedAccessor(F);
477
+ return this.getNamedAccessor(P);
477
478
  }
478
479
  /**
479
480
  * @deprecated use outputs
@@ -493,17 +494,17 @@ class y {
493
494
  },
494
495
  filters: t.filters ?? [],
495
496
  sorting: t.sorting ?? []
496
- } : n = t, this.ctx.createPTable(I(n, (r) => w(r, (o) => o.handle)));
497
+ } : n = t, this.ctx.createPTable(B(n, (r) => w(r, (o) => o.handle)));
497
498
  }
498
499
  getBlockLabel(t) {
499
500
  return this.ctx.getBlockLabel(t);
500
501
  }
501
502
  }
502
- const S = "1.2.28";
503
+ const V = "1.2.30";
503
504
  function wt(e) {
504
505
  return typeof e == "string";
505
506
  }
506
- function At(e) {
507
+ function bt(e) {
507
508
  if (e.inputsValid !== void 0) return e;
508
509
  {
509
510
  if (e.canRun === void 0)
@@ -522,8 +523,8 @@ class u {
522
523
  t,
523
524
  void 0,
524
525
  {},
525
- p(!0),
526
- p([])
526
+ h(!0),
527
+ h([])
527
528
  );
528
529
  }
529
530
  output(t, n) {
@@ -574,7 +575,7 @@ class u {
574
575
  return this.argsValid(t);
575
576
  }
576
577
  sections(t) {
577
- return Array.isArray(t) ? this.sections(p(t)) : typeof t == "function" ? (f("sections", () => t(new y())), new u(
578
+ return Array.isArray(t) ? this.sections(h(t)) : typeof t == "function" ? (f("sections", () => t(new y())), new u(
578
579
  this._renderingMode,
579
580
  this._initialArgs,
580
581
  this._outputs,
@@ -604,17 +605,17 @@ class u {
604
605
  done() {
605
606
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
606
607
  const t = {
607
- sdkVersion: S,
608
+ sdkVersion: V,
608
609
  renderingMode: this._renderingMode,
609
610
  initialArgs: this._initialArgs,
610
611
  inputsValid: this._inputsValid,
611
612
  sections: this._sections,
612
613
  outputs: this._outputs
613
614
  };
614
- return E() ? k(t) : { config: t };
615
+ return L() ? _(t) : { config: t };
615
616
  }
616
617
  }
617
- class bt {
618
+ class At {
618
619
  constructor(t) {
619
620
  this.handle = t;
620
621
  }
@@ -634,22 +635,29 @@ class bt {
634
635
  return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
635
636
  }
636
637
  }
637
- function N(e) {
638
+ function G(e) {
638
639
  return C({
639
640
  __isRef: !0,
640
- blockId: h(e, "blockId"),
641
- name: h(e, "name")
641
+ blockId: p(e, "blockId"),
642
+ name: p(e, "name")
642
643
  });
643
644
  }
644
645
  function Ct(e) {
645
646
  return C({
646
- ref: N(h(e, "ref")),
647
- label: h(e, "label")
647
+ ref: G(p(e, "ref")),
648
+ label: p(e, "label")
648
649
  });
649
650
  }
650
651
  const _t = {
651
- sdkVersion: S
652
+ sdkVersion: V
652
653
  };
654
+ function Ft() {
655
+ return _();
656
+ }
657
+ function Pt(e) {
658
+ if (typeof globalThis.getEnvironmentValue == "function")
659
+ return globalThis.getEnvironmentValue(e);
660
+ }
653
661
  export {
654
662
  W as Args,
655
663
  u as BlockModel,
@@ -658,29 +666,31 @@ export {
658
666
  z as It,
659
667
  yt as JsRenderInternal,
660
668
  U as MainOutputs,
661
- B as OutputError,
662
- bt as PFrameImpl,
669
+ E as OutputError,
670
+ At as PFrameImpl,
663
671
  y as RenderCtx,
664
- G as ResultPool,
672
+ J as ResultPool,
665
673
  q as StagingOutputs,
666
- d as TreeNodeAccessor,
674
+ g as TreeNodeAccessor,
667
675
  Q as UiState,
668
676
  rt as and,
669
677
  tt as flatten,
670
678
  Ct as fromPlOption,
671
- N as fromPlRef,
679
+ G as fromPlRef,
672
680
  ut as getBlobContent,
673
681
  ct as getBlobContentAsJson,
674
682
  lt as getBlobContentAsString,
675
- dt as getDownloadedBlobContent,
676
- g as getFromCfg,
677
- p as getImmediate,
678
- pt as getImportProgress,
679
- h as getJsonField,
680
- ht as getLastLogs,
683
+ gt as getDownloadedBlobContent,
684
+ Pt as getEnvironmentValue,
685
+ d as getFromCfg,
686
+ h as getImmediate,
687
+ ht as getImportProgress,
688
+ p as getJsonField,
689
+ pt as getLastLogs,
681
690
  mt as getLogHandle,
682
- gt as getOnDemandBlobContent,
691
+ dt as getOnDemandBlobContent,
683
692
  ft as getProgressLog,
693
+ Ft as getRawPlatformaInstance,
684
694
  it as getResourceField,
685
695
  ot as getResourceValueAsJson,
686
696
  et as isEmpty,
@@ -691,10 +701,10 @@ export {
691
701
  Z as mapArrayValues,
692
702
  Y as mapRecordValues,
693
703
  at as mapResourceFields,
694
- At as normalizeBlockConfig,
704
+ bt as normalizeBlockConfig,
695
705
  nt as not,
696
706
  st as or,
697
- L as readOutput,
698
- T as wrapOutputs
707
+ T as readOutput,
708
+ M as wrapOutputs
699
709
  };
700
710
  //# sourceMappingURL=index.mjs.map