@platforma-sdk/model 1.2.22 → 1.2.24
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/README.md +3 -0
- package/dist/block_api.d.ts +62 -0
- package/dist/block_api.d.ts.map +1 -0
- package/dist/block_state_patch.d.ts +5 -0
- package/dist/block_state_patch.d.ts.map +1 -0
- package/dist/block_state_util.d.ts +16 -0
- package/dist/block_state_util.d.ts.map +1 -0
- package/dist/branding.d.ts +7 -0
- package/dist/branding.d.ts.map +1 -0
- package/dist/builder.d.ts +111 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/components/PlDataTable.d.ts +36 -0
- package/dist/components/PlDataTable.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/config/actions.d.ts +45 -0
- package/dist/config/actions.d.ts.map +1 -0
- package/dist/config/actions_kinds.d.ts +114 -0
- package/dist/config/actions_kinds.d.ts.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/model.d.ts +116 -0
- package/dist/config/model.d.ts.map +1 -0
- package/dist/config/model_meta.d.ts +6 -0
- package/dist/config/model_meta.d.ts.map +1 -0
- package/dist/config/type_engine.d.ts +36 -0
- package/dist/config/type_engine.d.ts.map +1 -0
- package/dist/config/type_util.d.ts +12 -0
- package/dist/config/type_util.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -727
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +697 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal.d.ts +19 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/pframe.d.ts +11 -0
- package/dist/pframe.d.ts.map +1 -0
- package/dist/platforma.d.ts +18 -0
- package/dist/platforma.d.ts.map +1 -0
- package/dist/ref_util.d.ts +15 -0
- package/dist/ref_util.d.ts.map +1 -0
- package/dist/render/accessor.d.ts +71 -0
- package/dist/render/accessor.d.ts.map +1 -0
- package/dist/render/api.d.ts +48 -0
- package/dist/render/api.d.ts.map +1 -0
- package/dist/render/future.d.ts +13 -0
- package/dist/render/future.d.ts.map +1 -0
- package/dist/render/index.d.ts +6 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/internal.d.ts +53 -0
- package/dist/render/internal.d.ts.map +1 -0
- package/dist/render/traversal_ops.d.ts +46 -0
- package/dist/render/traversal_ops.d.ts.map +1 -0
- package/dist/sdk_info.d.ts +5 -0
- package/dist/sdk_info.d.ts.map +1 -0
- package/dist/unionize.d.ts +12 -0
- package/dist/unionize.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +14 -11
- package/src/config/index.ts +1 -1
- package/src/render/index.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/index.cjs +0 -779
- package/dist/index.cjs.map +0 -1
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var V = (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) => V(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";
|
|
5
|
+
export * from "@milaboratories/pl-model-common";
|
|
6
|
+
class B extends Error {
|
|
7
|
+
constructor(t, n) {
|
|
8
|
+
super(`${t.length}${n ? "+" : ""} errors, first error: ` + t[0]), this.errors = t, this.moreErrors = n;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function L(e) {
|
|
12
|
+
if (!e.ok) throw new B(e.errors, e.moreErrors);
|
|
13
|
+
return e.value;
|
|
14
|
+
}
|
|
15
|
+
function T(e) {
|
|
16
|
+
return new Proxy(e, {
|
|
17
|
+
get(t, n) {
|
|
18
|
+
return L(t[n]);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function i(e) {
|
|
23
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? p(e) : e;
|
|
24
|
+
}
|
|
25
|
+
function g(e) {
|
|
26
|
+
return { type: "GetFromCtx", variable: e };
|
|
27
|
+
}
|
|
28
|
+
function K(e) {
|
|
29
|
+
return {
|
|
30
|
+
type: "Isolate",
|
|
31
|
+
cfg: e
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const W = g("$args"), z = g("$it"), U = g("$prod"), q = g("$staging"), Q = g("$ui");
|
|
35
|
+
function p(e) {
|
|
36
|
+
return { type: "Immediate", value: e };
|
|
37
|
+
}
|
|
38
|
+
function C(e) {
|
|
39
|
+
const t = {};
|
|
40
|
+
for (const [n, r] of Object.entries(e)) t[n] = i(r);
|
|
41
|
+
return {
|
|
42
|
+
type: "MakeObject",
|
|
43
|
+
template: t
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function X(...e) {
|
|
47
|
+
const t = [];
|
|
48
|
+
for (const n of e) t.push(i(n));
|
|
49
|
+
return {
|
|
50
|
+
type: "MakeArray",
|
|
51
|
+
template: t
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function h(e, t) {
|
|
55
|
+
return {
|
|
56
|
+
type: "GetJsonField",
|
|
57
|
+
source: i(e),
|
|
58
|
+
field: i(t)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function Y(e, t, n = "$it") {
|
|
62
|
+
return {
|
|
63
|
+
type: "MapRecordValues",
|
|
64
|
+
source: e,
|
|
65
|
+
mapping: t,
|
|
66
|
+
itVar: n
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function Z(e, t, n = "$it") {
|
|
70
|
+
return {
|
|
71
|
+
type: "MapArrayValues",
|
|
72
|
+
source: e,
|
|
73
|
+
mapping: t,
|
|
74
|
+
itVar: n
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function tt(e) {
|
|
78
|
+
return {
|
|
79
|
+
type: "Flatten",
|
|
80
|
+
source: e
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function et(e) {
|
|
84
|
+
return {
|
|
85
|
+
type: "IsEmpty",
|
|
86
|
+
arg: e
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function nt(e) {
|
|
90
|
+
return {
|
|
91
|
+
type: "Not",
|
|
92
|
+
operand: e
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function rt(e, t) {
|
|
96
|
+
return {
|
|
97
|
+
type: "And",
|
|
98
|
+
operand1: e,
|
|
99
|
+
operand2: t
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function st(e, t) {
|
|
103
|
+
return {
|
|
104
|
+
type: "Or",
|
|
105
|
+
operand1: e,
|
|
106
|
+
operand2: t
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function it(e, t) {
|
|
110
|
+
return {
|
|
111
|
+
type: "GetResourceField",
|
|
112
|
+
source: i(e),
|
|
113
|
+
field: i(t)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function ot() {
|
|
117
|
+
return function(e) {
|
|
118
|
+
return {
|
|
119
|
+
type: "GetResourceValueAsJson",
|
|
120
|
+
source: i(e)
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function at(e, t, n = "$it") {
|
|
125
|
+
return {
|
|
126
|
+
type: "MapResourceFields",
|
|
127
|
+
source: e,
|
|
128
|
+
mapping: t,
|
|
129
|
+
itVar: n
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function ut(e) {
|
|
133
|
+
return {
|
|
134
|
+
type: "GetBlobContent",
|
|
135
|
+
source: i(e)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function lt(e) {
|
|
139
|
+
return {
|
|
140
|
+
type: "GetBlobContentAsString",
|
|
141
|
+
source: i(e)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function ct() {
|
|
145
|
+
return function(e) {
|
|
146
|
+
return {
|
|
147
|
+
type: "GetBlobContentAsJson",
|
|
148
|
+
source: i(e)
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function dt(e) {
|
|
153
|
+
return {
|
|
154
|
+
type: "GetDownloadedBlobContent",
|
|
155
|
+
source: i(e)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function gt(e) {
|
|
159
|
+
return {
|
|
160
|
+
type: "GetOnDemandBlobContent",
|
|
161
|
+
source: i(e)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function pt(e) {
|
|
165
|
+
return {
|
|
166
|
+
type: "GetImportProgress",
|
|
167
|
+
source: i(e)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function ht(e, t) {
|
|
171
|
+
return {
|
|
172
|
+
type: "GetLastLogs",
|
|
173
|
+
source: i(e),
|
|
174
|
+
lines: t
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function ft(e, t) {
|
|
178
|
+
return {
|
|
179
|
+
type: "GetProgressLog",
|
|
180
|
+
source: i(e),
|
|
181
|
+
patternToSearch: t
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function mt(e) {
|
|
185
|
+
return {
|
|
186
|
+
type: "GetLogHandle",
|
|
187
|
+
source: i(e)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function E() {
|
|
191
|
+
return typeof getPlatforma < "u" || typeof platforma < "u";
|
|
192
|
+
}
|
|
193
|
+
function k(e) {
|
|
194
|
+
if (typeof getPlatforma == "function") return getPlatforma(e);
|
|
195
|
+
if (typeof platforma < "u") return platforma;
|
|
196
|
+
throw new Error("Can't get platforma instance.");
|
|
197
|
+
}
|
|
198
|
+
function j() {
|
|
199
|
+
if (typeof cfgRenderCtx < "u") return cfgRenderCtx;
|
|
200
|
+
}
|
|
201
|
+
function s() {
|
|
202
|
+
if (typeof cfgRenderCtx < "u") return cfgRenderCtx;
|
|
203
|
+
throw new Error("Not in config rendering context");
|
|
204
|
+
}
|
|
205
|
+
function f(e, t) {
|
|
206
|
+
const n = j();
|
|
207
|
+
if (n === void 0) return !1;
|
|
208
|
+
if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
|
|
209
|
+
return n.callbackRegistry[e] = t, !0;
|
|
210
|
+
}
|
|
211
|
+
const m = /* @__PURE__ */ new Map();
|
|
212
|
+
function J(e, t) {
|
|
213
|
+
e in s().callbackRegistry || (s().callbackRegistry[e] = (n) => {
|
|
214
|
+
for (const r of m.get(e))
|
|
215
|
+
r(n);
|
|
216
|
+
}, m.set(e, [])), m.get(e).push(t);
|
|
217
|
+
}
|
|
218
|
+
class a {
|
|
219
|
+
constructor(t, n = (r) => r) {
|
|
220
|
+
l(this, "isResolved", !1);
|
|
221
|
+
l(this, "resolvedValue");
|
|
222
|
+
this.handle = t, this.postProcess = n, J(t, (r) => {
|
|
223
|
+
this.resolvedValue = n(r), this.isResolved = !0;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
map(t) {
|
|
227
|
+
return new a(this.handle, (n) => t(this.postProcess(n)));
|
|
228
|
+
}
|
|
229
|
+
mapDefined(t) {
|
|
230
|
+
return new a(this.handle, (n) => {
|
|
231
|
+
const r = this.postProcess(n);
|
|
232
|
+
return r ? t(r) : void 0;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
toJSON() {
|
|
236
|
+
return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function b(e) {
|
|
240
|
+
return e === void 0 ? void 0 : new d(e);
|
|
241
|
+
}
|
|
242
|
+
class d {
|
|
243
|
+
constructor(t) {
|
|
244
|
+
this.handle = t;
|
|
245
|
+
}
|
|
246
|
+
resolve(...t) {
|
|
247
|
+
return this.resolveWithCommon({}, ...t);
|
|
248
|
+
}
|
|
249
|
+
resolveWithCommon(t, ...n) {
|
|
250
|
+
return b(s().resolveWithCommon(this.handle, t, ...n));
|
|
251
|
+
}
|
|
252
|
+
get resourceType() {
|
|
253
|
+
return s().getResourceType(this.handle);
|
|
254
|
+
}
|
|
255
|
+
getInputsLocked() {
|
|
256
|
+
return s().getInputsLocked(this.handle);
|
|
257
|
+
}
|
|
258
|
+
getOutputsLocked() {
|
|
259
|
+
return s().getOutputsLocked(this.handle);
|
|
260
|
+
}
|
|
261
|
+
getIsReadyOrError() {
|
|
262
|
+
return s().getIsReadyOrError(this.handle);
|
|
263
|
+
}
|
|
264
|
+
getIsFinal() {
|
|
265
|
+
return s().getIsFinal(this.handle);
|
|
266
|
+
}
|
|
267
|
+
getError() {
|
|
268
|
+
return b(s().getError(this.handle));
|
|
269
|
+
}
|
|
270
|
+
listInputFields() {
|
|
271
|
+
return s().listInputFields(this.handle);
|
|
272
|
+
}
|
|
273
|
+
listOutputFields() {
|
|
274
|
+
return s().listOutputFields(this.handle);
|
|
275
|
+
}
|
|
276
|
+
listDynamicFields() {
|
|
277
|
+
return s().listDynamicFields(this.handle);
|
|
278
|
+
}
|
|
279
|
+
getKeyValueBase64(t) {
|
|
280
|
+
return s().getKeyValueBase64(this.handle, t);
|
|
281
|
+
}
|
|
282
|
+
getKeyValueAsString(t) {
|
|
283
|
+
return s().getKeyValueAsString(this.handle, t);
|
|
284
|
+
}
|
|
285
|
+
getKeyValueAsJson(t) {
|
|
286
|
+
const n = this.getKeyValueAsString(t);
|
|
287
|
+
if (n == null) throw new Error("Resource has no content.");
|
|
288
|
+
return JSON.parse(n);
|
|
289
|
+
}
|
|
290
|
+
getDataBase64() {
|
|
291
|
+
return s().getDataBase64(this.handle);
|
|
292
|
+
}
|
|
293
|
+
getDataAsString() {
|
|
294
|
+
return s().getDataAsString(this.handle);
|
|
295
|
+
}
|
|
296
|
+
getDataAsJson() {
|
|
297
|
+
const t = this.getDataAsString();
|
|
298
|
+
if (t == null) throw new Error("Resource has no content.");
|
|
299
|
+
return JSON.parse(t);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
*
|
|
303
|
+
*/
|
|
304
|
+
getPColumns(t = !1, n = "") {
|
|
305
|
+
const r = this.parsePObjectCollection(t, n);
|
|
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})`);
|
|
308
|
+
return c;
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
*
|
|
313
|
+
*/
|
|
314
|
+
parsePObjectCollection(t = !1, n = "") {
|
|
315
|
+
const r = s().parsePObjectCollection(
|
|
316
|
+
this.handle,
|
|
317
|
+
t,
|
|
318
|
+
n
|
|
319
|
+
);
|
|
320
|
+
if (r === void 0) return;
|
|
321
|
+
const o = {};
|
|
322
|
+
for (const [c, R] of Object.entries(r))
|
|
323
|
+
o[c] = w(R, (v) => new d(v));
|
|
324
|
+
return o;
|
|
325
|
+
}
|
|
326
|
+
getFileContentAsBase64() {
|
|
327
|
+
return new a(s().getBlobContentAsBase64(this.handle));
|
|
328
|
+
}
|
|
329
|
+
getFileContentAsString() {
|
|
330
|
+
return new a(s().getBlobContentAsString(this.handle));
|
|
331
|
+
}
|
|
332
|
+
getFileContentAsJson() {
|
|
333
|
+
return new a(
|
|
334
|
+
s().getBlobContentAsString(this.handle)
|
|
335
|
+
).mapDefined((t) => JSON.parse(t));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* @deprecated use getFileContentAsBase64
|
|
339
|
+
*/
|
|
340
|
+
getBlobContentAsBase64() {
|
|
341
|
+
return this.getFileContentAsBase64();
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* @deprecated use getFileContentAsString
|
|
345
|
+
*/
|
|
346
|
+
getBlobContentAsString() {
|
|
347
|
+
return this.getFileContentAsString();
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* @returns downloaded file handle
|
|
351
|
+
*/
|
|
352
|
+
getFileHandle() {
|
|
353
|
+
return new a(s().getDownloadedBlobContentHandle(this.handle));
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* @deprecated use getFileHandle
|
|
357
|
+
*/
|
|
358
|
+
getDownloadedBlobHandle() {
|
|
359
|
+
return this.getFileHandle();
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* @returns downloaded file handle
|
|
363
|
+
*/
|
|
364
|
+
getRemoteFileHandle() {
|
|
365
|
+
return new a(s().getOnDemandBlobContentHandle(this.handle));
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* @deprecated use getRemoteFileHandle
|
|
369
|
+
*/
|
|
370
|
+
getOnDemandBlobHandle() {
|
|
371
|
+
return this.getRemoteFileHandle();
|
|
372
|
+
}
|
|
373
|
+
getImportProgress() {
|
|
374
|
+
return new a(s().getImportProgress(this.handle));
|
|
375
|
+
}
|
|
376
|
+
getLastLogs(t) {
|
|
377
|
+
return new a(s().getLastLogs(this.handle, t));
|
|
378
|
+
}
|
|
379
|
+
getProgressLog(t) {
|
|
380
|
+
return new a(s().getProgressLog(this.handle, t));
|
|
381
|
+
}
|
|
382
|
+
getLogHandle() {
|
|
383
|
+
return new a(s().getLogHandle(this.handle));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const _ = "staging", F = "main";
|
|
387
|
+
function P(e) {
|
|
388
|
+
return typeof e == "object" && e !== null && "__awaited_futures__" in e;
|
|
389
|
+
}
|
|
390
|
+
function A(e, t, n) {
|
|
391
|
+
if (t.has(n)) return;
|
|
392
|
+
if (t.add(n), typeof n === "object")
|
|
393
|
+
if (P(n)) n.__awaited_futures__.forEach((o) => e.add(o));
|
|
394
|
+
else if (Array.isArray(n))
|
|
395
|
+
for (const o of n) A(e, t, o);
|
|
396
|
+
else
|
|
397
|
+
for (const [, o] of Object.entries(n))
|
|
398
|
+
o !== n && A(e, t, o);
|
|
399
|
+
}
|
|
400
|
+
function H(e) {
|
|
401
|
+
const t = /* @__PURE__ */ new Set();
|
|
402
|
+
return A(t, /* @__PURE__ */ new Set(), e), t;
|
|
403
|
+
}
|
|
404
|
+
const yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
405
|
+
__proto__: null,
|
|
406
|
+
MainAccessorName: F,
|
|
407
|
+
StagingAccessorName: _,
|
|
408
|
+
getAllFutureAwaits: H,
|
|
409
|
+
isFutureAwait: P
|
|
410
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
411
|
+
class G {
|
|
412
|
+
constructor() {
|
|
413
|
+
l(this, "ctx", s());
|
|
414
|
+
}
|
|
415
|
+
calculateOptions(t) {
|
|
416
|
+
return this.ctx.calculateOptions(t);
|
|
417
|
+
}
|
|
418
|
+
getDataFromResultPool() {
|
|
419
|
+
const t = this.ctx.getDataFromResultPool();
|
|
420
|
+
return {
|
|
421
|
+
isComplete: t.isComplete,
|
|
422
|
+
entries: t.entries.map((n) => ({
|
|
423
|
+
ref: n.ref,
|
|
424
|
+
obj: {
|
|
425
|
+
...n.obj,
|
|
426
|
+
data: new d(n.obj.data)
|
|
427
|
+
}
|
|
428
|
+
}))
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
getDataWithErrorsFromResultPool() {
|
|
432
|
+
const t = this.ctx.getDataWithErrorsFromResultPool();
|
|
433
|
+
return {
|
|
434
|
+
isComplete: t.isComplete,
|
|
435
|
+
entries: t.entries.map((n) => ({
|
|
436
|
+
ref: n.ref,
|
|
437
|
+
obj: {
|
|
438
|
+
...n.obj,
|
|
439
|
+
data: x(n.obj.data, (r) => new d(r))
|
|
440
|
+
}
|
|
441
|
+
}))
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
getSpecsFromResultPool() {
|
|
445
|
+
return this.ctx.getSpecsFromResultPool();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
class y {
|
|
449
|
+
constructor() {
|
|
450
|
+
l(this, "ctx");
|
|
451
|
+
l(this, "args");
|
|
452
|
+
l(this, "uiState");
|
|
453
|
+
l(this, "resultPool", new G());
|
|
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
|
+
}
|
|
456
|
+
getNamedAccessor(t) {
|
|
457
|
+
const n = this.ctx.getAccessorHandleByName(t);
|
|
458
|
+
return n ? new d(n) : void 0;
|
|
459
|
+
}
|
|
460
|
+
get prerun() {
|
|
461
|
+
return this.getNamedAccessor(_);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* @deprecated use prerun
|
|
465
|
+
*/
|
|
466
|
+
get precalc() {
|
|
467
|
+
return this.prerun;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* @deprecated use prerun
|
|
471
|
+
*/
|
|
472
|
+
get stagingOutput() {
|
|
473
|
+
return this.precalc;
|
|
474
|
+
}
|
|
475
|
+
get outputs() {
|
|
476
|
+
return this.getNamedAccessor(F);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* @deprecated use outputs
|
|
480
|
+
*/
|
|
481
|
+
get mainOutput() {
|
|
482
|
+
return this.outputs;
|
|
483
|
+
}
|
|
484
|
+
createPFrame(t) {
|
|
485
|
+
return this.ctx.createPFrame(t.map((n) => w(n, (r) => r.handle)));
|
|
486
|
+
}
|
|
487
|
+
createPTable(t) {
|
|
488
|
+
var n;
|
|
489
|
+
return "columns" in t ? n = {
|
|
490
|
+
src: {
|
|
491
|
+
type: "inner",
|
|
492
|
+
entries: t.columns.map((r) => ({ type: "column", column: r }))
|
|
493
|
+
},
|
|
494
|
+
filters: t.filters ?? [],
|
|
495
|
+
sorting: t.sorting ?? []
|
|
496
|
+
} : n = t, this.ctx.createPTable(I(n, (r) => w(r, (o) => o.handle)));
|
|
497
|
+
}
|
|
498
|
+
getBlockLabel(t) {
|
|
499
|
+
return this.ctx.getBlockLabel(t);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const S = "1.2.24";
|
|
503
|
+
function wt(e) {
|
|
504
|
+
return typeof e == "string";
|
|
505
|
+
}
|
|
506
|
+
function At(e) {
|
|
507
|
+
if (e.inputsValid !== void 0) return e;
|
|
508
|
+
{
|
|
509
|
+
if (e.canRun === void 0)
|
|
510
|
+
throw new Error(`Malformed config, SDK version ${e.sdkVersion}`);
|
|
511
|
+
const t = { ...e, inputsValid: e.canRun };
|
|
512
|
+
return delete t.canRun, t;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
class u {
|
|
516
|
+
constructor(t, n, r, o, c) {
|
|
517
|
+
this._renderingMode = t, this._initialArgs = n, this._outputs = r, this._inputsValid = o, this._sections = c;
|
|
518
|
+
}
|
|
519
|
+
/** Initiates configuration builder */
|
|
520
|
+
static create(t) {
|
|
521
|
+
return new u(
|
|
522
|
+
t,
|
|
523
|
+
void 0,
|
|
524
|
+
{},
|
|
525
|
+
p(!0),
|
|
526
|
+
p([])
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
output(t, n) {
|
|
530
|
+
if (typeof n == "function") {
|
|
531
|
+
const r = `output#${t}`;
|
|
532
|
+
return f(r, () => n(new y())), new u(
|
|
533
|
+
this._renderingMode,
|
|
534
|
+
this._initialArgs,
|
|
535
|
+
{
|
|
536
|
+
...this._outputs,
|
|
537
|
+
[t]: r
|
|
538
|
+
},
|
|
539
|
+
this._inputsValid,
|
|
540
|
+
this._sections
|
|
541
|
+
);
|
|
542
|
+
} else
|
|
543
|
+
return new u(
|
|
544
|
+
this._renderingMode,
|
|
545
|
+
this._initialArgs,
|
|
546
|
+
{
|
|
547
|
+
...this._outputs,
|
|
548
|
+
[t]: n
|
|
549
|
+
},
|
|
550
|
+
this._inputsValid,
|
|
551
|
+
this._sections
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
/** @deprecated */
|
|
555
|
+
canRun(t) {
|
|
556
|
+
return this.inputsValid(t);
|
|
557
|
+
}
|
|
558
|
+
inputsValid(t) {
|
|
559
|
+
return typeof t == "function" ? (f("inputsValid", () => t(new y())), new u(
|
|
560
|
+
this._renderingMode,
|
|
561
|
+
this._initialArgs,
|
|
562
|
+
this._outputs,
|
|
563
|
+
"inputsValid",
|
|
564
|
+
this._sections
|
|
565
|
+
)) : new u(
|
|
566
|
+
this._renderingMode,
|
|
567
|
+
this._initialArgs,
|
|
568
|
+
this._outputs,
|
|
569
|
+
t,
|
|
570
|
+
this._sections
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
sections(t) {
|
|
574
|
+
return Array.isArray(t) ? this.sections(p(t)) : typeof t == "function" ? (f("sections", () => t(new y())), new u(
|
|
575
|
+
this._renderingMode,
|
|
576
|
+
this._initialArgs,
|
|
577
|
+
this._outputs,
|
|
578
|
+
this._inputsValid,
|
|
579
|
+
"sections"
|
|
580
|
+
)) : new u(
|
|
581
|
+
this._renderingMode,
|
|
582
|
+
this._initialArgs,
|
|
583
|
+
this._outputs,
|
|
584
|
+
this._inputsValid,
|
|
585
|
+
t
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
/** Sets initial args for the block, this value must be specified. */
|
|
589
|
+
initialArgs(t) {
|
|
590
|
+
return new u(
|
|
591
|
+
this._renderingMode,
|
|
592
|
+
t,
|
|
593
|
+
this._outputs,
|
|
594
|
+
this._inputsValid,
|
|
595
|
+
this._sections
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
/** Renders all provided block settings into a pre-configured platforma API
|
|
599
|
+
* instance, that can be used in frontend to interact with block state, and
|
|
600
|
+
* other features provided by the platforma to the block. */
|
|
601
|
+
done() {
|
|
602
|
+
if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
|
|
603
|
+
const t = {
|
|
604
|
+
sdkVersion: S,
|
|
605
|
+
renderingMode: this._renderingMode,
|
|
606
|
+
initialArgs: this._initialArgs,
|
|
607
|
+
inputsValid: this._inputsValid,
|
|
608
|
+
sections: this._sections,
|
|
609
|
+
outputs: this._outputs
|
|
610
|
+
};
|
|
611
|
+
return E() ? k(t) : { config: t };
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
class bt {
|
|
615
|
+
constructor(t) {
|
|
616
|
+
this.handle = t;
|
|
617
|
+
}
|
|
618
|
+
async findColumns(t) {
|
|
619
|
+
return await platforma.pFrameDriver.findColumns(this.handle, t);
|
|
620
|
+
}
|
|
621
|
+
async getColumnSpec(t) {
|
|
622
|
+
return await platforma.pFrameDriver.getColumnSpec(this.handle, t);
|
|
623
|
+
}
|
|
624
|
+
async listColumns() {
|
|
625
|
+
return await platforma.pFrameDriver.listColumns(this.handle);
|
|
626
|
+
}
|
|
627
|
+
async calculateTableData(t) {
|
|
628
|
+
return await platforma.pFrameDriver.calculateTableData(this.handle, t);
|
|
629
|
+
}
|
|
630
|
+
async getUniqueValues(t) {
|
|
631
|
+
return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function N(e) {
|
|
635
|
+
return C({
|
|
636
|
+
__isRef: !0,
|
|
637
|
+
blockId: h(e, "blockId"),
|
|
638
|
+
name: h(e, "name")
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
function Ct(e) {
|
|
642
|
+
return C({
|
|
643
|
+
ref: N(h(e, "ref")),
|
|
644
|
+
label: h(e, "label")
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
const _t = {
|
|
648
|
+
sdkVersion: S
|
|
649
|
+
};
|
|
650
|
+
export {
|
|
651
|
+
W as Args,
|
|
652
|
+
u as BlockModel,
|
|
653
|
+
_t as CurrentSdkInfo,
|
|
654
|
+
a as FutureRef,
|
|
655
|
+
z as It,
|
|
656
|
+
yt as JsRenderInternal,
|
|
657
|
+
U as MainOutputs,
|
|
658
|
+
B as OutputError,
|
|
659
|
+
bt as PFrameImpl,
|
|
660
|
+
y as RenderCtx,
|
|
661
|
+
G as ResultPool,
|
|
662
|
+
q as StagingOutputs,
|
|
663
|
+
d as TreeNodeAccessor,
|
|
664
|
+
Q as UiState,
|
|
665
|
+
rt as and,
|
|
666
|
+
tt as flatten,
|
|
667
|
+
Ct as fromPlOption,
|
|
668
|
+
N as fromPlRef,
|
|
669
|
+
ut as getBlobContent,
|
|
670
|
+
ct as getBlobContentAsJson,
|
|
671
|
+
lt as getBlobContentAsString,
|
|
672
|
+
dt as getDownloadedBlobContent,
|
|
673
|
+
g as getFromCfg,
|
|
674
|
+
p as getImmediate,
|
|
675
|
+
pt as getImportProgress,
|
|
676
|
+
h as getJsonField,
|
|
677
|
+
ht as getLastLogs,
|
|
678
|
+
mt as getLogHandle,
|
|
679
|
+
gt as getOnDemandBlobContent,
|
|
680
|
+
ft as getProgressLog,
|
|
681
|
+
it as getResourceField,
|
|
682
|
+
ot as getResourceValueAsJson,
|
|
683
|
+
et as isEmpty,
|
|
684
|
+
wt as isFunctionHandle,
|
|
685
|
+
K as isolate,
|
|
686
|
+
X as makeArray,
|
|
687
|
+
C as makeObject,
|
|
688
|
+
Z as mapArrayValues,
|
|
689
|
+
Y as mapRecordValues,
|
|
690
|
+
at as mapResourceFields,
|
|
691
|
+
At as normalizeBlockConfig,
|
|
692
|
+
nt as not,
|
|
693
|
+
st as or,
|
|
694
|
+
L as readOutput,
|
|
695
|
+
T as wrapOutputs
|
|
696
|
+
};
|
|
697
|
+
//# sourceMappingURL=index.mjs.map
|