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