@platforma-sdk/model 1.2.27 → 1.2.29

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,18 +1,18 @@
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 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";
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
11
  function L(e) {
12
- if (!e.ok) throw new B(e.errors, e.moreErrors);
12
+ if (!e.ok) throw new E(e.errors, e.moreErrors);
13
13
  return e.value;
14
14
  }
15
- function T(e) {
15
+ function K(e) {
16
16
  return new Proxy(e, {
17
17
  get(t, n) {
18
18
  return L(t[n]);
@@ -25,17 +25,17 @@ function i(e) {
25
25
  function g(e) {
26
26
  return { type: "GetFromCtx", variable: e };
27
27
  }
28
- function K(e) {
28
+ function W(e) {
29
29
  return {
30
30
  type: "Isolate",
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");
34
+ const z = g("$args"), U = g("$it"), q = g("$prod"), Q = g("$staging"), X = g("$ui");
35
35
  function p(e) {
36
36
  return { type: "Immediate", value: e };
37
37
  }
38
- function C(e) {
38
+ function _(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 C(e) {
43
43
  template: t
44
44
  };
45
45
  }
46
- function X(...e) {
46
+ function Y(...e) {
47
47
  const t = [];
48
48
  for (const n of e) t.push(i(n));
49
49
  return {
@@ -58,7 +58,7 @@ function h(e, t) {
58
58
  field: i(t)
59
59
  };
60
60
  }
61
- function Y(e, t, n = "$it") {
61
+ function Z(e, t, n = "$it") {
62
62
  return {
63
63
  type: "MapRecordValues",
64
64
  source: e,
@@ -66,7 +66,7 @@ function Y(e, t, n = "$it") {
66
66
  itVar: n
67
67
  };
68
68
  }
69
- function Z(e, t, n = "$it") {
69
+ function tt(e, t, n = "$it") {
70
70
  return {
71
71
  type: "MapArrayValues",
72
72
  source: e,
@@ -74,46 +74,46 @@ function Z(e, t, n = "$it") {
74
74
  itVar: n
75
75
  };
76
76
  }
77
- function tt(e) {
77
+ function et(e) {
78
78
  return {
79
79
  type: "Flatten",
80
80
  source: e
81
81
  };
82
82
  }
83
- function et(e) {
83
+ function nt(e) {
84
84
  return {
85
85
  type: "IsEmpty",
86
86
  arg: e
87
87
  };
88
88
  }
89
- function nt(e) {
89
+ function rt(e) {
90
90
  return {
91
91
  type: "Not",
92
92
  operand: e
93
93
  };
94
94
  }
95
- function rt(e, t) {
95
+ function st(e, t) {
96
96
  return {
97
97
  type: "And",
98
98
  operand1: e,
99
99
  operand2: t
100
100
  };
101
101
  }
102
- function st(e, t) {
102
+ function it(e, t) {
103
103
  return {
104
104
  type: "Or",
105
105
  operand1: e,
106
106
  operand2: t
107
107
  };
108
108
  }
109
- function it(e, t) {
109
+ function ot(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 ot() {
116
+ function at() {
117
117
  return function(e) {
118
118
  return {
119
119
  type: "GetResourceValueAsJson",
@@ -121,7 +121,7 @@ function ot() {
121
121
  };
122
122
  };
123
123
  }
124
- function at(e, t, n = "$it") {
124
+ function ut(e, t, n = "$it") {
125
125
  return {
126
126
  type: "MapResourceFields",
127
127
  source: e,
@@ -129,19 +129,19 @@ function at(e, t, n = "$it") {
129
129
  itVar: n
130
130
  };
131
131
  }
132
- function ut(e) {
132
+ function lt(e) {
133
133
  return {
134
134
  type: "GetBlobContent",
135
135
  source: i(e)
136
136
  };
137
137
  }
138
- function lt(e) {
138
+ function ct(e) {
139
139
  return {
140
140
  type: "GetBlobContentAsString",
141
141
  source: i(e)
142
142
  };
143
143
  }
144
- function ct() {
144
+ function dt() {
145
145
  return function(e) {
146
146
  return {
147
147
  type: "GetBlobContentAsJson",
@@ -149,53 +149,53 @@ 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 pt(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 ft(e, t) {
171
171
  return {
172
172
  type: "GetLastLogs",
173
173
  source: i(e),
174
174
  lines: t
175
175
  };
176
176
  }
177
- function ft(e, t) {
177
+ function mt(e, t) {
178
178
  return {
179
179
  type: "GetProgressLog",
180
180
  source: i(e),
181
181
  patternToSearch: t
182
182
  };
183
183
  }
184
- function mt(e) {
184
+ function yt(e) {
185
185
  return {
186
186
  type: "GetLogHandle",
187
187
  source: i(e)
188
188
  };
189
189
  }
190
- function E() {
190
+ function k() {
191
191
  return typeof getPlatforma < "u" || typeof platforma < "u";
192
192
  }
193
- function k(e) {
193
+ function j(e) {
194
194
  if (typeof getPlatforma == "function") return getPlatforma(e);
195
195
  if (typeof platforma < "u") return platforma;
196
196
  throw new Error("Can't get platforma instance.");
197
197
  }
198
- function j() {
198
+ function H() {
199
199
  if (typeof cfgRenderCtx < "u") return cfgRenderCtx;
200
200
  }
201
201
  function s() {
@@ -203,13 +203,13 @@ function s() {
203
203
  throw new Error("Not in config rendering context");
204
204
  }
205
205
  function f(e, t) {
206
- const n = j();
206
+ const n = H();
207
207
  if (n === void 0) return !1;
208
208
  if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
209
209
  return n.callbackRegistry[e] = t, !0;
210
210
  }
211
211
  const m = /* @__PURE__ */ new Map();
212
- function H(e, t) {
212
+ function J(e, t) {
213
213
  e in s().callbackRegistry || (s().callbackRegistry[e] = (n) => {
214
214
  for (const r of m.get(e))
215
215
  r(n);
@@ -219,7 +219,7 @@ class a {
219
219
  constructor(t, n = (r) => r) {
220
220
  l(this, "isResolved", !1);
221
221
  l(this, "resolvedValue");
222
- this.handle = t, this.postProcess = n, H(t, (r) => {
222
+ this.handle = t, this.postProcess = n, J(t, (r) => {
223
223
  this.resolvedValue = n(r), this.isResolved = !0;
224
224
  });
225
225
  }
@@ -304,7 +304,7 @@ class d {
304
304
  getPColumns(t = !1, n = "") {
305
305
  const r = this.parsePObjectCollection(t, n);
306
306
  return r === void 0 ? void 0 : Object.entries(r).map(([, c]) => {
307
- if (!O(c)) throw new Error(`not a PColumn (kind = ${c.spec.kind})`);
307
+ if (!x(c)) throw new Error(`not a PColumn (kind = ${c.spec.kind})`);
308
308
  return c;
309
309
  });
310
310
  }
@@ -319,8 +319,8 @@ class d {
319
319
  );
320
320
  if (r === void 0) return;
321
321
  const o = {};
322
- for (const [c, R] of Object.entries(r))
323
- o[c] = w(R, (V) => new d(V));
322
+ for (const [c, V] of Object.entries(r))
323
+ o[c] = w(V, (R) => new d(R));
324
324
  return o;
325
325
  }
326
326
  getFileContentAsBase64() {
@@ -383,32 +383,32 @@ class d {
383
383
  return new a(s().getLogHandle(this.handle));
384
384
  }
385
385
  }
386
- const _ = "staging", F = "main";
387
- function P(e) {
386
+ const F = "staging", P = "main";
387
+ function v(e) {
388
388
  return typeof e == "object" && e !== null && "__awaited_futures__" in e;
389
389
  }
390
390
  function A(e, t, n) {
391
391
  if (t.has(n)) return;
392
392
  if (t.add(n), typeof n === "object")
393
- if (P(n)) n.__awaited_futures__.forEach((o) => e.add(o));
393
+ if (v(n)) n.__awaited_futures__.forEach((o) => e.add(o));
394
394
  else if (Array.isArray(n))
395
395
  for (const o of n) A(e, t, o);
396
396
  else
397
397
  for (const [, o] of Object.entries(n))
398
398
  o !== n && A(e, t, o);
399
399
  }
400
- function J(e) {
400
+ function G(e) {
401
401
  const t = /* @__PURE__ */ new Set();
402
402
  return A(t, /* @__PURE__ */ new Set(), e), t;
403
403
  }
404
- const yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
404
+ const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
405
405
  __proto__: null,
406
- MainAccessorName: F,
407
- StagingAccessorName: _,
408
- getAllFutureAwaits: J,
409
- isFutureAwait: P
406
+ MainAccessorName: P,
407
+ StagingAccessorName: F,
408
+ getAllFutureAwaits: G,
409
+ isFutureAwait: v
410
410
  }, Symbol.toStringTag, { value: "Module" }));
411
- class G {
411
+ class N {
412
412
  constructor() {
413
413
  l(this, "ctx", s());
414
414
  }
@@ -436,7 +436,7 @@ class G {
436
436
  ref: n.ref,
437
437
  obj: {
438
438
  ...n.obj,
439
- data: x(n.obj.data, (r) => new d(r))
439
+ data: I(n.obj.data, (r) => new d(r))
440
440
  }
441
441
  }))
442
442
  };
@@ -450,7 +450,7 @@ class y {
450
450
  l(this, "ctx");
451
451
  l(this, "args");
452
452
  l(this, "uiState");
453
- l(this, "resultPool", new G());
453
+ l(this, "resultPool", new N());
454
454
  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
455
  }
456
456
  getNamedAccessor(t) {
@@ -458,7 +458,7 @@ class y {
458
458
  return n ? new d(n) : void 0;
459
459
  }
460
460
  get prerun() {
461
- return this.getNamedAccessor(_);
461
+ return this.getNamedAccessor(F);
462
462
  }
463
463
  /**
464
464
  * @deprecated use prerun
@@ -473,7 +473,7 @@ class y {
473
473
  return this.precalc;
474
474
  }
475
475
  get outputs() {
476
- return this.getNamedAccessor(F);
476
+ return this.getNamedAccessor(P);
477
477
  }
478
478
  /**
479
479
  * @deprecated use outputs
@@ -493,17 +493,17 @@ class y {
493
493
  },
494
494
  filters: t.filters ?? [],
495
495
  sorting: t.sorting ?? []
496
- } : n = t, this.ctx.createPTable(I(n, (r) => w(r, (o) => o.handle)));
496
+ } : n = t, this.ctx.createPTable(B(n, (r) => w(r, (o) => o.handle)));
497
497
  }
498
498
  getBlockLabel(t) {
499
499
  return this.ctx.getBlockLabel(t);
500
500
  }
501
501
  }
502
- const S = "1.2.27";
503
- function wt(e) {
502
+ const S = "1.2.29";
503
+ function At(e) {
504
504
  return typeof e == "string";
505
505
  }
506
- function At(e) {
506
+ function bt(e) {
507
507
  if (e.inputsValid !== void 0) return e;
508
508
  {
509
509
  if (e.canRun === void 0)
@@ -611,10 +611,10 @@ class u {
611
611
  sections: this._sections,
612
612
  outputs: this._outputs
613
613
  };
614
- return E() ? k(t) : { config: t };
614
+ return k() ? j(t) : { config: t };
615
615
  }
616
616
  }
617
- class bt {
617
+ class Ct {
618
618
  constructor(t) {
619
619
  this.handle = t;
620
620
  }
@@ -634,67 +634,72 @@ class bt {
634
634
  return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
635
635
  }
636
636
  }
637
- function N(e) {
638
- return C({
637
+ function $(e) {
638
+ return _({
639
639
  __isRef: !0,
640
640
  blockId: h(e, "blockId"),
641
641
  name: h(e, "name")
642
642
  });
643
643
  }
644
- function Ct(e) {
645
- return C({
646
- ref: N(h(e, "ref")),
644
+ function _t(e) {
645
+ return _({
646
+ ref: $(h(e, "ref")),
647
647
  label: h(e, "label")
648
648
  });
649
649
  }
650
- const _t = {
650
+ const Ft = {
651
651
  sdkVersion: S
652
652
  };
653
+ function C(e) {
654
+ if (typeof C == "function")
655
+ return C();
656
+ }
653
657
  export {
654
- W as Args,
658
+ z as Args,
655
659
  u as BlockModel,
656
- _t as CurrentSdkInfo,
660
+ Ft as CurrentSdkInfo,
657
661
  a as FutureRef,
658
- z as It,
659
- yt as JsRenderInternal,
660
- U as MainOutputs,
661
- B as OutputError,
662
- bt as PFrameImpl,
662
+ U as It,
663
+ wt as JsRenderInternal,
664
+ q as MainOutputs,
665
+ E as OutputError,
666
+ Ct as PFrameImpl,
663
667
  y as RenderCtx,
664
- G as ResultPool,
665
- q as StagingOutputs,
668
+ N as ResultPool,
669
+ Q as StagingOutputs,
666
670
  d as TreeNodeAccessor,
667
- Q as UiState,
668
- rt as and,
669
- tt as flatten,
670
- Ct as fromPlOption,
671
- N as fromPlRef,
672
- ut as getBlobContent,
673
- ct as getBlobContentAsJson,
674
- lt as getBlobContentAsString,
675
- dt as getDownloadedBlobContent,
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,
679
+ gt as getDownloadedBlobContent,
680
+ C as getEnvironmentValue,
676
681
  g as getFromCfg,
677
682
  p as getImmediate,
678
- pt as getImportProgress,
683
+ ht as getImportProgress,
679
684
  h as getJsonField,
680
- ht as getLastLogs,
681
- mt as getLogHandle,
682
- gt as getOnDemandBlobContent,
683
- ft as getProgressLog,
684
- it as getResourceField,
685
- ot as getResourceValueAsJson,
686
- et as isEmpty,
687
- wt as isFunctionHandle,
688
- K as isolate,
689
- X as makeArray,
690
- C as makeObject,
691
- Z as mapArrayValues,
692
- Y as mapRecordValues,
693
- at as mapResourceFields,
694
- At as normalizeBlockConfig,
695
- nt as not,
696
- st as or,
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,
699
+ bt as normalizeBlockConfig,
700
+ rt as not,
701
+ it as or,
697
702
  L as readOutput,
698
- T as wrapOutputs
703
+ K as wrapOutputs
699
704
  };
700
705
  //# sourceMappingURL=index.mjs.map