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