@platforma-sdk/model 1.2.29 → 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,41 +1,41 @@
1
1
  var D = Object.defineProperty;
2
- var O = (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) => O(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { isPColumn as x, mapPObjectData as w, mapValueInVOE as I, mapPTableDef as B } from "@milaboratories/pl-model-common";
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
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) {
11
+ function T(e) {
12
12
  if (!e.ok) throw new E(e.errors, e.moreErrors);
13
13
  return e.value;
14
14
  }
15
- function K(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
- function W(e) {
28
+ function K(e) {
29
29
  return {
30
30
  type: "Isolate",
31
31
  cfg: e
32
32
  };
33
33
  }
34
- const z = g("$args"), U = g("$it"), q = g("$prod"), Q = g("$staging"), X = 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
- function _(e) {
38
+ function C(e) {
39
39
  const t = {};
40
40
  for (const [n, r] of Object.entries(e)) t[n] = i(r);
41
41
  return {
@@ -43,7 +43,7 @@ function _(e) {
43
43
  template: t
44
44
  };
45
45
  }
46
- function Y(...e) {
46
+ function X(...e) {
47
47
  const t = [];
48
48
  for (const n of e) t.push(i(n));
49
49
  return {
@@ -51,14 +51,14 @@ function Y(...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),
58
58
  field: i(t)
59
59
  };
60
60
  }
61
- function Z(e, t, n = "$it") {
61
+ function Y(e, t, n = "$it") {
62
62
  return {
63
63
  type: "MapRecordValues",
64
64
  source: e,
@@ -66,7 +66,7 @@ function Z(e, t, n = "$it") {
66
66
  itVar: n
67
67
  };
68
68
  }
69
- function tt(e, t, n = "$it") {
69
+ function Z(e, t, n = "$it") {
70
70
  return {
71
71
  type: "MapArrayValues",
72
72
  source: e,
@@ -74,46 +74,46 @@ function tt(e, t, n = "$it") {
74
74
  itVar: n
75
75
  };
76
76
  }
77
- function et(e) {
77
+ function tt(e) {
78
78
  return {
79
79
  type: "Flatten",
80
80
  source: e
81
81
  };
82
82
  }
83
- function nt(e) {
83
+ function et(e) {
84
84
  return {
85
85
  type: "IsEmpty",
86
86
  arg: e
87
87
  };
88
88
  }
89
- function rt(e) {
89
+ function nt(e) {
90
90
  return {
91
91
  type: "Not",
92
92
  operand: e
93
93
  };
94
94
  }
95
- function st(e, t) {
95
+ function rt(e, t) {
96
96
  return {
97
97
  type: "And",
98
98
  operand1: e,
99
99
  operand2: t
100
100
  };
101
101
  }
102
- function it(e, t) {
102
+ function st(e, t) {
103
103
  return {
104
104
  type: "Or",
105
105
  operand1: e,
106
106
  operand2: t
107
107
  };
108
108
  }
109
- function ot(e, t) {
109
+ function it(e, t) {
110
110
  return {
111
111
  type: "GetResourceField",
112
112
  source: i(e),
113
113
  field: i(t)
114
114
  };
115
115
  }
116
- function at() {
116
+ function ot() {
117
117
  return function(e) {
118
118
  return {
119
119
  type: "GetResourceValueAsJson",
@@ -121,7 +121,7 @@ function at() {
121
121
  };
122
122
  };
123
123
  }
124
- function ut(e, t, n = "$it") {
124
+ function at(e, t, n = "$it") {
125
125
  return {
126
126
  type: "MapResourceFields",
127
127
  source: e,
@@ -129,19 +129,19 @@ function ut(e, t, n = "$it") {
129
129
  itVar: n
130
130
  };
131
131
  }
132
- function lt(e) {
132
+ function ut(e) {
133
133
  return {
134
134
  type: "GetBlobContent",
135
135
  source: i(e)
136
136
  };
137
137
  }
138
- function ct(e) {
138
+ function lt(e) {
139
139
  return {
140
140
  type: "GetBlobContentAsString",
141
141
  source: i(e)
142
142
  };
143
143
  }
144
- function dt() {
144
+ function ct() {
145
145
  return function(e) {
146
146
  return {
147
147
  type: "GetBlobContentAsJson",
@@ -155,7 +155,7 @@ function gt(e) {
155
155
  source: i(e)
156
156
  };
157
157
  }
158
- function pt(e) {
158
+ function dt(e) {
159
159
  return {
160
160
  type: "GetOnDemandBlobContent",
161
161
  source: i(e)
@@ -167,49 +167,50 @@ function ht(e) {
167
167
  source: i(e)
168
168
  };
169
169
  }
170
- function ft(e, t) {
170
+ function pt(e, t) {
171
171
  return {
172
172
  type: "GetLastLogs",
173
173
  source: i(e),
174
174
  lines: t
175
175
  };
176
176
  }
177
- function mt(e, t) {
177
+ function ft(e, t) {
178
178
  return {
179
179
  type: "GetProgressLog",
180
180
  source: i(e),
181
181
  patternToSearch: t
182
182
  };
183
183
  }
184
- function yt(e) {
184
+ function mt(e) {
185
185
  return {
186
186
  type: "GetLogHandle",
187
187
  source: i(e)
188
188
  };
189
189
  }
190
- function k() {
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 j(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 H() {
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 = H();
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 J(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, J(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);
@@ -304,7 +305,7 @@ class d {
304
305
  getPColumns(t = !1, n = "") {
305
306
  const r = this.parsePObjectCollection(t, n);
306
307
  return r === void 0 ? void 0 : Object.entries(r).map(([, c]) => {
307
- if (!x(c)) throw new Error(`not a PColumn (kind = ${c.spec.kind})`);
308
+ if (!O(c)) throw new Error(`not a PColumn (kind = ${c.spec.kind})`);
308
309
  return c;
309
310
  });
310
311
  }
@@ -319,8 +320,8 @@ class d {
319
320
  );
320
321
  if (r === void 0) return;
321
322
  const o = {};
322
- for (const [c, V] of Object.entries(r))
323
- o[c] = w(V, (R) => new d(R));
323
+ for (const [c, R] of Object.entries(r))
324
+ o[c] = w(R, (S) => new g(S));
324
325
  return o;
325
326
  }
326
327
  getFileContentAsBase64() {
@@ -387,28 +388,28 @@ const F = "staging", P = "main";
387
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
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 G(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
- const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
405
+ const yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
405
406
  __proto__: null,
406
407
  MainAccessorName: P,
407
408
  StagingAccessorName: F,
408
- getAllFutureAwaits: G,
409
+ getAllFutureAwaits: H,
409
410
  isFutureAwait: v
410
411
  }, Symbol.toStringTag, { value: "Module" }));
411
- class N {
412
+ class J {
412
413
  constructor() {
413
414
  l(this, "ctx", s());
414
415
  }
@@ -423,7 +424,7 @@ class N {
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 N {
436
437
  ref: n.ref,
437
438
  obj: {
438
439
  ...n.obj,
439
- data: I(n.obj.data, (r) => new d(r))
440
+ data: x(n.obj.data, (r) => new g(r))
440
441
  }
441
442
  }))
442
443
  };
@@ -450,12 +451,12 @@ class y {
450
451
  l(this, "ctx");
451
452
  l(this, "args");
452
453
  l(this, "uiState");
453
- l(this, "resultPool", new N());
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
462
  return this.getNamedAccessor(F);
@@ -499,8 +500,8 @@ class y {
499
500
  return this.ctx.getBlockLabel(t);
500
501
  }
501
502
  }
502
- const S = "1.2.29";
503
- function At(e) {
503
+ const V = "1.2.30";
504
+ function wt(e) {
504
505
  return typeof e == "string";
505
506
  }
506
507
  function bt(e) {
@@ -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 k() ? j(t) : { config: t };
615
+ return L() ? _(t) : { config: t };
615
616
  }
616
617
  }
617
- class Ct {
618
+ class At {
618
619
  constructor(t) {
619
620
  this.handle = t;
620
621
  }
@@ -634,72 +635,76 @@ class Ct {
634
635
  return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
635
636
  }
636
637
  }
637
- function $(e) {
638
- return _({
638
+ function G(e) {
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
- function _t(e) {
645
- return _({
646
- ref: $(h(e, "ref")),
647
- label: h(e, "label")
645
+ function Ct(e) {
646
+ return C({
647
+ ref: G(p(e, "ref")),
648
+ label: p(e, "label")
648
649
  });
649
650
  }
650
- const Ft = {
651
- sdkVersion: S
651
+ const _t = {
652
+ sdkVersion: V
652
653
  };
653
- function C(e) {
654
- if (typeof C == "function")
655
- return C();
654
+ function Ft() {
655
+ return _();
656
+ }
657
+ function Pt(e) {
658
+ if (typeof globalThis.getEnvironmentValue == "function")
659
+ return globalThis.getEnvironmentValue(e);
656
660
  }
657
661
  export {
658
- z as Args,
662
+ W as Args,
659
663
  u as BlockModel,
660
- Ft as CurrentSdkInfo,
664
+ _t as CurrentSdkInfo,
661
665
  a as FutureRef,
662
- U as It,
663
- wt as JsRenderInternal,
664
- q as MainOutputs,
666
+ z as It,
667
+ yt as JsRenderInternal,
668
+ U as MainOutputs,
665
669
  E as OutputError,
666
- Ct as PFrameImpl,
670
+ At as PFrameImpl,
667
671
  y as RenderCtx,
668
- N as ResultPool,
669
- Q as StagingOutputs,
670
- d as TreeNodeAccessor,
671
- X as UiState,
672
- st as and,
673
- et as flatten,
674
- _t as fromPlOption,
675
- $ as fromPlRef,
676
- lt as getBlobContent,
677
- dt as getBlobContentAsJson,
678
- ct as getBlobContentAsString,
672
+ J as ResultPool,
673
+ q as StagingOutputs,
674
+ g as TreeNodeAccessor,
675
+ Q as UiState,
676
+ rt as and,
677
+ tt as flatten,
678
+ Ct as fromPlOption,
679
+ G as fromPlRef,
680
+ ut as getBlobContent,
681
+ ct as getBlobContentAsJson,
682
+ lt as getBlobContentAsString,
679
683
  gt as getDownloadedBlobContent,
680
- C as getEnvironmentValue,
681
- g as getFromCfg,
682
- p as getImmediate,
684
+ Pt as getEnvironmentValue,
685
+ d as getFromCfg,
686
+ h as getImmediate,
683
687
  ht as getImportProgress,
684
- h as getJsonField,
685
- ft as getLastLogs,
686
- yt as getLogHandle,
687
- pt as getOnDemandBlobContent,
688
- mt as getProgressLog,
689
- ot as getResourceField,
690
- at as getResourceValueAsJson,
691
- nt as isEmpty,
692
- At as isFunctionHandle,
693
- W as isolate,
694
- Y as makeArray,
695
- _ as makeObject,
696
- tt as mapArrayValues,
697
- Z as mapRecordValues,
698
- ut as mapResourceFields,
688
+ p as getJsonField,
689
+ pt as getLastLogs,
690
+ mt as getLogHandle,
691
+ dt as getOnDemandBlobContent,
692
+ ft as getProgressLog,
693
+ Ft as getRawPlatformaInstance,
694
+ it as getResourceField,
695
+ ot as getResourceValueAsJson,
696
+ et as isEmpty,
697
+ wt as isFunctionHandle,
698
+ K as isolate,
699
+ X as makeArray,
700
+ C as makeObject,
701
+ Z as mapArrayValues,
702
+ Y as mapRecordValues,
703
+ at as mapResourceFields,
699
704
  bt as normalizeBlockConfig,
700
- rt as not,
701
- it as or,
702
- L as readOutput,
703
- K as wrapOutputs
705
+ nt as not,
706
+ st as or,
707
+ T as readOutput,
708
+ M as wrapOutputs
704
709
  };
705
710
  //# sourceMappingURL=index.mjs.map