@platforma-sdk/model 1.10.12 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/PlDataTable.d.ts +18 -2
- package/dist/components/PlDataTable.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +531 -331
- package/dist/index.mjs.map +1 -1
- package/dist/render/api.d.ts +15 -2
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/util/label.d.ts +48 -0
- package/dist/render/util/label.d.ts.map +1 -0
- package/dist/render/util/resource_map.d.ts +16 -2
- package/dist/render/util/resource_map.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/PlDataTable.ts +49 -6
- package/src/render/api.ts +63 -6
- package/src/render/util/label.test.ts +98 -0
- package/src/render/util/label.ts +147 -0
- package/src/render/util/resource_map.ts +141 -6
package/dist/index.mjs
CHANGED
|
@@ -1,64 +1,65 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { isPColumn as
|
|
1
|
+
var ct = Object.defineProperty;
|
|
2
|
+
var dt = (e, t, n) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var _ = (e, t, n) => dt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { isPColumn as W, mapPObjectData as L, mapValueInVOE as pt, ensurePColumn as ft, isPColumnSpec as ht, mapPTableDef as gt, getAxisId as J, matchAxisId as mt } from "@milaboratories/pl-model-common";
|
|
5
5
|
export * from "@milaboratories/pl-model-common";
|
|
6
|
-
|
|
6
|
+
import { z as P } from "zod";
|
|
7
|
+
class yt extends Error {
|
|
7
8
|
constructor(t, n) {
|
|
8
9
|
super(`${t.length}${n ? "+" : ""} errors, first error: ` + t[0]), this.errors = t, this.moreErrors = n;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
if (!e.ok) throw new
|
|
12
|
+
function bt(e) {
|
|
13
|
+
if (!e.ok) throw new yt(e.errors, e.moreErrors);
|
|
13
14
|
return e.value;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
+
function jt(e) {
|
|
16
17
|
return new Proxy(e, {
|
|
17
18
|
get(t, n) {
|
|
18
|
-
return
|
|
19
|
+
return bt(t[n]);
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ?
|
|
23
|
+
function p(e) {
|
|
24
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? k(e) : e;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function T(e) {
|
|
26
27
|
return { type: "GetFromCtx", variable: e };
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function Nt(e) {
|
|
29
30
|
return {
|
|
30
31
|
type: "Isolate",
|
|
31
32
|
cfg: e
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
35
|
+
const Mt = T("$args"), Bt = T("$it"), Ut = T("$prod"), Jt = T("$staging"), $t = T("$ui");
|
|
36
|
+
function k(e) {
|
|
36
37
|
return { type: "Immediate", value: e };
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function nt(e) {
|
|
39
40
|
const t = {};
|
|
40
|
-
for (const [n,
|
|
41
|
+
for (const [n, r] of Object.entries(e)) t[n] = p(r);
|
|
41
42
|
return {
|
|
42
43
|
type: "MakeObject",
|
|
43
44
|
template: t
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function Kt(...e) {
|
|
47
48
|
const t = [];
|
|
48
|
-
for (const n of e) t.push(
|
|
49
|
+
for (const n of e) t.push(p(n));
|
|
49
50
|
return {
|
|
50
51
|
type: "MakeArray",
|
|
51
52
|
template: t
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function x(e, t) {
|
|
55
56
|
return {
|
|
56
57
|
type: "GetJsonField",
|
|
57
|
-
source:
|
|
58
|
-
field:
|
|
58
|
+
source: p(e),
|
|
59
|
+
field: p(t)
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function Gt(e, t, n = "$it") {
|
|
62
63
|
return {
|
|
63
64
|
type: "MapRecordValues",
|
|
64
65
|
source: e,
|
|
@@ -66,7 +67,7 @@ function dt(e, t, n = "$it") {
|
|
|
66
67
|
itVar: n
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function Ht(e, t, n = "$it") {
|
|
70
71
|
return {
|
|
71
72
|
type: "MapArrayValues",
|
|
72
73
|
source: e,
|
|
@@ -74,54 +75,54 @@ function pt(e, t, n = "$it") {
|
|
|
74
75
|
itVar: n
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function Wt(e) {
|
|
78
79
|
return {
|
|
79
80
|
type: "Flatten",
|
|
80
81
|
source: e
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
+
function qt(e) {
|
|
84
85
|
return {
|
|
85
86
|
type: "IsEmpty",
|
|
86
87
|
arg: e
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function zt(e) {
|
|
90
91
|
return {
|
|
91
92
|
type: "Not",
|
|
92
93
|
operand: e
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
+
function Yt(e, t) {
|
|
96
97
|
return {
|
|
97
98
|
type: "And",
|
|
98
99
|
operand1: e,
|
|
99
100
|
operand2: t
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
+
function Xt(e, t) {
|
|
103
104
|
return {
|
|
104
105
|
type: "Or",
|
|
105
106
|
operand1: e,
|
|
106
107
|
operand2: t
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
+
function Qt(e, t) {
|
|
110
111
|
return {
|
|
111
112
|
type: "GetResourceField",
|
|
112
|
-
source:
|
|
113
|
-
field:
|
|
113
|
+
source: p(e),
|
|
114
|
+
field: p(t)
|
|
114
115
|
};
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function Zt() {
|
|
117
118
|
return function(e) {
|
|
118
119
|
return {
|
|
119
120
|
type: "GetResourceValueAsJson",
|
|
120
|
-
source:
|
|
121
|
+
source: p(e)
|
|
121
122
|
};
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
|
-
function
|
|
125
|
+
function te(e, t, n = "$it") {
|
|
125
126
|
return {
|
|
126
127
|
type: "MapResourceFields",
|
|
127
128
|
source: e,
|
|
@@ -129,144 +130,144 @@ function _t(e, t, n = "$it") {
|
|
|
129
130
|
itVar: n
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function ee(e) {
|
|
133
134
|
return {
|
|
134
135
|
type: "GetBlobContent",
|
|
135
|
-
source:
|
|
136
|
+
source: p(e)
|
|
136
137
|
};
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
+
function ne(e) {
|
|
139
140
|
return {
|
|
140
141
|
type: "GetBlobContentAsString",
|
|
141
|
-
source:
|
|
142
|
+
source: p(e)
|
|
142
143
|
};
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function re() {
|
|
145
146
|
return function(e) {
|
|
146
147
|
return {
|
|
147
148
|
type: "GetBlobContentAsJson",
|
|
148
|
-
source:
|
|
149
|
+
source: p(e)
|
|
149
150
|
};
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
function se(e) {
|
|
153
154
|
return {
|
|
154
155
|
type: "GetDownloadedBlobContent",
|
|
155
|
-
source:
|
|
156
|
+
source: p(e)
|
|
156
157
|
};
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
+
function ie(e) {
|
|
159
160
|
return {
|
|
160
161
|
type: "GetOnDemandBlobContent",
|
|
161
|
-
source:
|
|
162
|
+
source: p(e)
|
|
162
163
|
};
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function oe(e) {
|
|
165
166
|
return {
|
|
166
167
|
type: "GetImportProgress",
|
|
167
|
-
source:
|
|
168
|
+
source: p(e)
|
|
168
169
|
};
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
+
function ae(e, t) {
|
|
171
172
|
return {
|
|
172
173
|
type: "GetLastLogs",
|
|
173
|
-
source:
|
|
174
|
+
source: p(e),
|
|
174
175
|
lines: t
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
+
function le(e, t) {
|
|
178
179
|
return {
|
|
179
180
|
type: "GetProgressLog",
|
|
180
|
-
source:
|
|
181
|
+
source: p(e),
|
|
181
182
|
patternToSearch: t
|
|
182
183
|
};
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
+
function ue(e) {
|
|
185
186
|
return {
|
|
186
187
|
type: "GetLogHandle",
|
|
187
|
-
source:
|
|
188
|
+
source: p(e)
|
|
188
189
|
};
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
+
function _t() {
|
|
191
192
|
return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
+
function rt(e) {
|
|
194
195
|
if (e && typeof globalThis.getPlatforma == "function")
|
|
195
196
|
return globalThis.getPlatforma(e);
|
|
196
197
|
if (typeof globalThis.platforma < "u") return globalThis.platforma;
|
|
197
198
|
throw new Error("Can't get platforma instance.");
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
+
function vt() {
|
|
200
201
|
if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
|
|
201
202
|
}
|
|
202
|
-
function
|
|
203
|
+
function u() {
|
|
203
204
|
if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
|
|
204
205
|
throw new Error("Not in config rendering context");
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
-
const n =
|
|
207
|
+
function O(e, t) {
|
|
208
|
+
const n = vt();
|
|
208
209
|
if (n === void 0) return !1;
|
|
209
210
|
if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
|
|
210
211
|
return n.callbackRegistry[e] = t, !0;
|
|
211
212
|
}
|
|
212
|
-
const
|
|
213
|
-
function
|
|
214
|
-
e in
|
|
215
|
-
for (const
|
|
216
|
-
|
|
217
|
-
},
|
|
213
|
+
const N = /* @__PURE__ */ new Map();
|
|
214
|
+
function wt(e, t) {
|
|
215
|
+
e in u().callbackRegistry || (u().callbackRegistry[e] = (n) => {
|
|
216
|
+
for (const r of N.get(e))
|
|
217
|
+
r(n);
|
|
218
|
+
}, N.set(e, [])), N.get(e).push(t);
|
|
218
219
|
}
|
|
219
|
-
class
|
|
220
|
-
constructor(t, n = (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
this.handle = t, this.postProcess = n,
|
|
224
|
-
this.resolvedValue = n(
|
|
220
|
+
class g {
|
|
221
|
+
constructor(t, n = (r) => r) {
|
|
222
|
+
_(this, "isResolved", !1);
|
|
223
|
+
_(this, "resolvedValue");
|
|
224
|
+
this.handle = t, this.postProcess = n, wt(t, (r) => {
|
|
225
|
+
this.resolvedValue = n(r), this.isResolved = !0;
|
|
225
226
|
});
|
|
226
227
|
}
|
|
227
228
|
map(t) {
|
|
228
|
-
return new
|
|
229
|
+
return new g(this.handle, (n) => t(this.postProcess(n)));
|
|
229
230
|
}
|
|
230
231
|
mapDefined(t) {
|
|
231
|
-
return new
|
|
232
|
-
const
|
|
233
|
-
return
|
|
232
|
+
return new g(this.handle, (n) => {
|
|
233
|
+
const r = this.postProcess(n);
|
|
234
|
+
return r ? t(r) : void 0;
|
|
234
235
|
});
|
|
235
236
|
}
|
|
236
237
|
toJSON() {
|
|
237
238
|
return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
|
-
function
|
|
241
|
-
return e === void 0 ? void 0 : new
|
|
241
|
+
function X(e) {
|
|
242
|
+
return e === void 0 ? void 0 : new w(e);
|
|
242
243
|
}
|
|
243
|
-
class
|
|
244
|
+
class w {
|
|
244
245
|
constructor(t) {
|
|
245
246
|
this.handle = t;
|
|
246
247
|
}
|
|
247
248
|
resolve(...t) {
|
|
248
249
|
const n = t.map(
|
|
249
|
-
(
|
|
250
|
+
(r) => ({
|
|
250
251
|
assertFieldType: "Input",
|
|
251
|
-
...typeof
|
|
252
|
+
...typeof r == "string" ? { field: r } : r
|
|
252
253
|
})
|
|
253
254
|
);
|
|
254
255
|
return this.resolveWithCommon({}, ...n);
|
|
255
256
|
}
|
|
256
257
|
resolveOutput(...t) {
|
|
257
258
|
const n = t.map(
|
|
258
|
-
(
|
|
259
|
+
(r) => ({
|
|
259
260
|
assertFieldType: "Output",
|
|
260
|
-
...typeof
|
|
261
|
+
...typeof r == "string" ? { field: r } : r
|
|
261
262
|
})
|
|
262
263
|
);
|
|
263
264
|
return this.resolveWithCommon({}, ...n);
|
|
264
265
|
}
|
|
265
266
|
resolveInput(...t) {
|
|
266
267
|
const n = t.map(
|
|
267
|
-
(
|
|
268
|
+
(r) => ({
|
|
268
269
|
assertFieldType: "Input",
|
|
269
|
-
...typeof
|
|
270
|
+
...typeof r == "string" ? { field: r } : r
|
|
270
271
|
})
|
|
271
272
|
);
|
|
272
273
|
return this.resolveWithCommon({}, ...n);
|
|
@@ -275,40 +276,40 @@ class m {
|
|
|
275
276
|
return this.resolveWithCommon({}, ...t);
|
|
276
277
|
}
|
|
277
278
|
resolveWithCommon(t, ...n) {
|
|
278
|
-
return
|
|
279
|
+
return X(u().resolveWithCommon(this.handle, t, ...n));
|
|
279
280
|
}
|
|
280
281
|
get resourceType() {
|
|
281
|
-
return
|
|
282
|
+
return u().getResourceType(this.handle);
|
|
282
283
|
}
|
|
283
284
|
getInputsLocked() {
|
|
284
|
-
return
|
|
285
|
+
return u().getInputsLocked(this.handle);
|
|
285
286
|
}
|
|
286
287
|
getOutputsLocked() {
|
|
287
|
-
return
|
|
288
|
+
return u().getOutputsLocked(this.handle);
|
|
288
289
|
}
|
|
289
290
|
getIsReadyOrError() {
|
|
290
|
-
return
|
|
291
|
+
return u().getIsReadyOrError(this.handle);
|
|
291
292
|
}
|
|
292
293
|
getIsFinal() {
|
|
293
|
-
return
|
|
294
|
+
return u().getIsFinal(this.handle);
|
|
294
295
|
}
|
|
295
296
|
getError() {
|
|
296
|
-
return
|
|
297
|
+
return X(u().getError(this.handle));
|
|
297
298
|
}
|
|
298
299
|
listInputFields() {
|
|
299
|
-
return
|
|
300
|
+
return u().listInputFields(this.handle);
|
|
300
301
|
}
|
|
301
302
|
listOutputFields() {
|
|
302
|
-
return
|
|
303
|
+
return u().listOutputFields(this.handle);
|
|
303
304
|
}
|
|
304
305
|
listDynamicFields() {
|
|
305
|
-
return
|
|
306
|
+
return u().listDynamicFields(this.handle);
|
|
306
307
|
}
|
|
307
308
|
getKeyValueBase64(t) {
|
|
308
|
-
return
|
|
309
|
+
return u().getKeyValueBase64(this.handle, t);
|
|
309
310
|
}
|
|
310
311
|
getKeyValueAsString(t) {
|
|
311
|
-
return
|
|
312
|
+
return u().getKeyValueAsString(this.handle, t);
|
|
312
313
|
}
|
|
313
314
|
getKeyValueAsJson(t) {
|
|
314
315
|
const n = this.getKeyValueAsString(t);
|
|
@@ -316,10 +317,10 @@ class m {
|
|
|
316
317
|
return JSON.parse(n);
|
|
317
318
|
}
|
|
318
319
|
getDataBase64() {
|
|
319
|
-
return
|
|
320
|
+
return u().getDataBase64(this.handle);
|
|
320
321
|
}
|
|
321
322
|
getDataAsString() {
|
|
322
|
-
return
|
|
323
|
+
return u().getDataAsString(this.handle);
|
|
323
324
|
}
|
|
324
325
|
getDataAsJson() {
|
|
325
326
|
const t = this.getDataAsString();
|
|
@@ -330,36 +331,36 @@ class m {
|
|
|
330
331
|
*
|
|
331
332
|
*/
|
|
332
333
|
getPColumns(t = !1, n = "") {
|
|
333
|
-
const
|
|
334
|
-
return
|
|
335
|
-
if (!
|
|
336
|
-
return
|
|
334
|
+
const r = this.parsePObjectCollection(t, n);
|
|
335
|
+
return r === void 0 ? void 0 : Object.entries(r).map(([, i]) => {
|
|
336
|
+
if (!W(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
|
|
337
|
+
return i;
|
|
337
338
|
});
|
|
338
339
|
}
|
|
339
340
|
/**
|
|
340
341
|
*
|
|
341
342
|
*/
|
|
342
343
|
parsePObjectCollection(t = !1, n = "") {
|
|
343
|
-
const
|
|
344
|
+
const r = u().parsePObjectCollection(
|
|
344
345
|
this.handle,
|
|
345
346
|
t,
|
|
346
347
|
n
|
|
347
348
|
);
|
|
348
|
-
if (
|
|
349
|
-
const
|
|
350
|
-
for (const [
|
|
351
|
-
|
|
352
|
-
return
|
|
349
|
+
if (r === void 0) return;
|
|
350
|
+
const s = {};
|
|
351
|
+
for (const [i, o] of Object.entries(r))
|
|
352
|
+
s[i] = L(o, (a) => new w(a));
|
|
353
|
+
return s;
|
|
353
354
|
}
|
|
354
355
|
getFileContentAsBase64() {
|
|
355
|
-
return new
|
|
356
|
+
return new g(u().getBlobContentAsBase64(this.handle));
|
|
356
357
|
}
|
|
357
358
|
getFileContentAsString() {
|
|
358
|
-
return new
|
|
359
|
+
return new g(u().getBlobContentAsString(this.handle));
|
|
359
360
|
}
|
|
360
361
|
getFileContentAsJson() {
|
|
361
|
-
return new
|
|
362
|
-
|
|
362
|
+
return new g(
|
|
363
|
+
u().getBlobContentAsString(this.handle)
|
|
363
364
|
).mapDefined((t) => JSON.parse(t));
|
|
364
365
|
}
|
|
365
366
|
/**
|
|
@@ -378,7 +379,7 @@ class m {
|
|
|
378
379
|
* @returns downloaded file handle
|
|
379
380
|
*/
|
|
380
381
|
getFileHandle() {
|
|
381
|
-
return new
|
|
382
|
+
return new g(u().getDownloadedBlobContentHandle(this.handle));
|
|
382
383
|
}
|
|
383
384
|
/**
|
|
384
385
|
* @deprecated use getFileHandle
|
|
@@ -390,7 +391,7 @@ class m {
|
|
|
390
391
|
* @returns downloaded file handle
|
|
391
392
|
*/
|
|
392
393
|
getRemoteFileHandle() {
|
|
393
|
-
return new
|
|
394
|
+
return new g(u().getOnDemandBlobContentHandle(this.handle));
|
|
394
395
|
}
|
|
395
396
|
/**
|
|
396
397
|
* @deprecated use getRemoteFileHandle
|
|
@@ -399,16 +400,16 @@ class m {
|
|
|
399
400
|
return this.getRemoteFileHandle();
|
|
400
401
|
}
|
|
401
402
|
getImportProgress() {
|
|
402
|
-
return new
|
|
403
|
+
return new g(u().getImportProgress(this.handle));
|
|
403
404
|
}
|
|
404
405
|
getLastLogs(t) {
|
|
405
|
-
return new
|
|
406
|
+
return new g(u().getLastLogs(this.handle, t));
|
|
406
407
|
}
|
|
407
408
|
getProgressLog(t) {
|
|
408
|
-
return new
|
|
409
|
+
return new g(u().getProgressLog(this.handle, t));
|
|
409
410
|
}
|
|
410
411
|
getLogHandle() {
|
|
411
|
-
return new
|
|
412
|
+
return new g(u().getLogHandle(this.handle));
|
|
412
413
|
}
|
|
413
414
|
allFieldsResolved(t = "Input") {
|
|
414
415
|
switch (t) {
|
|
@@ -423,51 +424,107 @@ class m {
|
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
mapFields(t, n) {
|
|
426
|
-
const { fieldType:
|
|
427
|
+
const { fieldType: r, requireLocked: s, skipUnresolved: i } = {
|
|
427
428
|
fieldType: "Input",
|
|
428
429
|
requireLocked: !0,
|
|
429
430
|
skipUnresolved: !1,
|
|
430
431
|
...n
|
|
431
|
-
},
|
|
432
|
-
if (
|
|
432
|
+
}, o = t;
|
|
433
|
+
if (s && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
|
|
433
434
|
return;
|
|
434
|
-
let
|
|
435
|
-
(
|
|
435
|
+
let l = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
|
|
436
|
+
(c) => [c, this.resolve({ field: c, assertFieldType: r })]
|
|
436
437
|
);
|
|
437
|
-
return
|
|
438
|
+
return i && (l = l.filter((c) => c[1] !== void 0)), l.map(([c, f]) => o(c, f));
|
|
438
439
|
}
|
|
439
440
|
}
|
|
440
|
-
const
|
|
441
|
-
function
|
|
441
|
+
const st = "staging", it = "main";
|
|
442
|
+
function ot(e) {
|
|
442
443
|
return typeof e == "object" && e !== null && "__awaited_futures__" in e;
|
|
443
444
|
}
|
|
444
|
-
function
|
|
445
|
+
function $(e, t, n) {
|
|
445
446
|
if (t.has(n)) return;
|
|
446
447
|
if (t.add(n), typeof n === "object")
|
|
447
|
-
if (
|
|
448
|
+
if (ot(n)) n.__awaited_futures__.forEach((s) => e.add(s));
|
|
448
449
|
else if (Array.isArray(n))
|
|
449
|
-
for (const
|
|
450
|
+
for (const s of n) $(e, t, s);
|
|
450
451
|
else
|
|
451
|
-
for (const [,
|
|
452
|
-
|
|
452
|
+
for (const [, s] of Object.entries(n))
|
|
453
|
+
s !== n && $(e, t, s);
|
|
453
454
|
}
|
|
454
|
-
function
|
|
455
|
+
function St(e) {
|
|
455
456
|
const t = /* @__PURE__ */ new Set();
|
|
456
|
-
return
|
|
457
|
+
return $(t, /* @__PURE__ */ new Set(), e), t;
|
|
457
458
|
}
|
|
458
|
-
const
|
|
459
|
+
const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
459
460
|
__proto__: null,
|
|
460
|
-
MainAccessorName:
|
|
461
|
-
StagingAccessorName:
|
|
462
|
-
getAllFutureAwaits:
|
|
463
|
-
isFutureAwait:
|
|
464
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
465
|
-
|
|
461
|
+
MainAccessorName: it,
|
|
462
|
+
StagingAccessorName: st,
|
|
463
|
+
getAllFutureAwaits: St,
|
|
464
|
+
isFutureAwait: ot
|
|
465
|
+
}, Symbol.toStringTag, { value: "Module" })), At = "pl7.app/label", Pt = "pl7.app/trace", It = P.object({
|
|
466
|
+
type: P.string(),
|
|
467
|
+
importance: P.number().optional(),
|
|
468
|
+
id: P.string().optional(),
|
|
469
|
+
label: P.string()
|
|
470
|
+
}), Ct = P.array(It), Tt = 1e-3, Rt = "__LABEL__", Q = "__LABEL__@1";
|
|
471
|
+
function Ft(e, t, n = {}) {
|
|
472
|
+
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = e.map((d) => {
|
|
473
|
+
var z, Y;
|
|
474
|
+
const m = t(d), y = (z = m.annotations) == null ? void 0 : z[At], F = (Y = m.annotations) == null ? void 0 : Y[Pt], b = (F ? Ct.safeParse(JSON.parse(F)).data : void 0) ?? [];
|
|
475
|
+
y && b.splice(0, 0, { label: y, type: Rt, importance: -2 });
|
|
476
|
+
const V = [], q = /* @__PURE__ */ new Map();
|
|
477
|
+
for (let S = b.length - 1; S >= 0; --S) {
|
|
478
|
+
const { type: E } = b[S], ut = b[S].importance ?? 0, j = (q.get(E) ?? 0) + 1;
|
|
479
|
+
q.set(E, j);
|
|
480
|
+
const I = `${E}@${j}`;
|
|
481
|
+
s.set(I, (s.get(I) ?? 0) + 1), r.set(
|
|
482
|
+
I,
|
|
483
|
+
Math.max(
|
|
484
|
+
r.get(I) ?? Number.NEGATIVE_INFINITY,
|
|
485
|
+
ut - (b.length - S) * Tt
|
|
486
|
+
)
|
|
487
|
+
), V.push({ ...b[S], fullType: I, occurenceIndex: j });
|
|
488
|
+
}
|
|
489
|
+
return V.reverse(), {
|
|
490
|
+
value: d,
|
|
491
|
+
spec: m,
|
|
492
|
+
label: y,
|
|
493
|
+
fullTrace: V
|
|
494
|
+
};
|
|
495
|
+
}), o = [], a = [], l = [...r];
|
|
496
|
+
l.sort(([, d], [, m]) => m - d);
|
|
497
|
+
for (const [d] of l)
|
|
498
|
+
d.endsWith("@1") || s.get(d) === e.length ? o.push(d) : a.push(d);
|
|
499
|
+
const c = (d) => i.map((m) => {
|
|
500
|
+
const y = m.fullTrace.filter((b) => d.has(b.fullType)).map((b) => b.label), F = n.separator ?? " / ";
|
|
501
|
+
return {
|
|
502
|
+
label: y.join(F),
|
|
503
|
+
value: m.value
|
|
504
|
+
};
|
|
505
|
+
});
|
|
506
|
+
if (o.length === 0) {
|
|
507
|
+
if (a.length !== 0) throw new Error("Assertion error.");
|
|
508
|
+
return c(new Set(Q));
|
|
509
|
+
}
|
|
510
|
+
let f = 0, v = 0;
|
|
511
|
+
for (; f < o.length; ) {
|
|
512
|
+
const d = /* @__PURE__ */ new Set();
|
|
513
|
+
for (let y = 0; y < f; ++y) d.add(o[y]);
|
|
514
|
+
d.add(o[v]);
|
|
515
|
+
const m = c(d);
|
|
516
|
+
if (new Set(m.map((y) => y.label)).size === e.length)
|
|
517
|
+
return n.includeNativeLabel ? (d.add(Q), c(d)) : m;
|
|
518
|
+
v++, v == o.length && (f++, v = f);
|
|
519
|
+
}
|
|
520
|
+
return c(/* @__PURE__ */ new Set([...o, ...a]));
|
|
521
|
+
}
|
|
522
|
+
class Ot {
|
|
466
523
|
constructor() {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
var
|
|
470
|
-
return ((
|
|
524
|
+
_(this, "ctx", u());
|
|
525
|
+
_(this, "defaultLabelFn", (t, n) => {
|
|
526
|
+
var r;
|
|
527
|
+
return ((r = t.annotations) == null ? void 0 : r["pl7.app/label"]) ?? "Unlabelled";
|
|
471
528
|
});
|
|
472
529
|
}
|
|
473
530
|
/**
|
|
@@ -476,10 +533,16 @@ class Q {
|
|
|
476
533
|
calculateOptions(t) {
|
|
477
534
|
return this.ctx.calculateOptions(t);
|
|
478
535
|
}
|
|
479
|
-
getOptions(t, n
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
label:
|
|
536
|
+
getOptions(t, n) {
|
|
537
|
+
const r = this.getSpecs().entries.filter((s) => t(s.obj));
|
|
538
|
+
return typeof n == "object" || typeof n > "u" ? Ft(r, (s) => s.obj, n ?? {}).map(
|
|
539
|
+
({ value: { ref: s }, label: i }) => ({
|
|
540
|
+
ref: s,
|
|
541
|
+
label: i
|
|
542
|
+
})
|
|
543
|
+
) : r.map((s) => ({
|
|
544
|
+
ref: s.ref,
|
|
545
|
+
label: n(s.obj, s.ref)
|
|
483
546
|
}));
|
|
484
547
|
}
|
|
485
548
|
/**
|
|
@@ -496,7 +559,7 @@ class Q {
|
|
|
496
559
|
ref: n.ref,
|
|
497
560
|
obj: {
|
|
498
561
|
...n.obj,
|
|
499
|
-
data: new
|
|
562
|
+
data: new w(n.obj.data)
|
|
500
563
|
}
|
|
501
564
|
}))
|
|
502
565
|
};
|
|
@@ -515,7 +578,7 @@ class Q {
|
|
|
515
578
|
ref: n.ref,
|
|
516
579
|
obj: {
|
|
517
580
|
...n.obj,
|
|
518
|
-
data:
|
|
581
|
+
data: pt(n.obj.data, (r) => new w(r))
|
|
519
582
|
}
|
|
520
583
|
}))
|
|
521
584
|
};
|
|
@@ -536,12 +599,22 @@ class Q {
|
|
|
536
599
|
getDataByRef(t) {
|
|
537
600
|
var n;
|
|
538
601
|
return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
|
|
539
|
-
(
|
|
540
|
-
)) == null ? void 0 : n.obj :
|
|
602
|
+
(r) => r.ref.blockId === t.blockId && r.ref.name === t.name
|
|
603
|
+
)) == null ? void 0 : n.obj : L(
|
|
541
604
|
this.ctx.getDataFromResultPoolByRef(t.blockId, t.name),
|
|
542
|
-
(
|
|
605
|
+
(r) => new w(r)
|
|
543
606
|
);
|
|
544
607
|
}
|
|
608
|
+
/**
|
|
609
|
+
* Returns data associated with the ref ensuring that it is a p-column.
|
|
610
|
+
* @param ref a Ref
|
|
611
|
+
* @returns p-column associated with the ref
|
|
612
|
+
*/
|
|
613
|
+
getPColumnByRef(t) {
|
|
614
|
+
const n = this.getDataByRef(t);
|
|
615
|
+
if (n)
|
|
616
|
+
return ft(n);
|
|
617
|
+
}
|
|
545
618
|
/**
|
|
546
619
|
* @param ref a Ref
|
|
547
620
|
* @returns object spec associated with the ref
|
|
@@ -549,52 +622,53 @@ class Q {
|
|
|
549
622
|
getSpecByRef(t) {
|
|
550
623
|
var n;
|
|
551
624
|
return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
|
|
552
|
-
(
|
|
625
|
+
(r) => r.ref.blockId === t.blockId && r.ref.name === t.name
|
|
553
626
|
)) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(t.blockId, t.name);
|
|
554
627
|
}
|
|
555
628
|
/**
|
|
556
629
|
* @param spec object specification
|
|
557
630
|
* @returns array of data objects with compatible specs
|
|
631
|
+
* @deprecated delete this method after Jan 1, 2025
|
|
558
632
|
*/
|
|
559
633
|
findDataWithCompatibleSpec(t) {
|
|
560
634
|
const n = [];
|
|
561
|
-
t: for (const
|
|
562
|
-
if (
|
|
635
|
+
t: for (const r of this.getData().entries) {
|
|
636
|
+
if (!ht(r.obj.spec))
|
|
563
637
|
continue;
|
|
564
|
-
const
|
|
565
|
-
if (t.name ===
|
|
566
|
-
for (let
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
638
|
+
const s = r.obj.spec;
|
|
639
|
+
if (t.name === s.name && t.valueType === s.valueType && t.axesSpec.length === s.axesSpec.length && K(t.domain, s.domain)) {
|
|
640
|
+
for (let i = 0; i < t.axesSpec.length; ++i) {
|
|
641
|
+
const o = t.axesSpec[i], a = s.axesSpec[i];
|
|
642
|
+
if (o.name !== a.name || o.type !== a.type || !K(o.domain, a.domain))
|
|
569
643
|
continue t;
|
|
570
644
|
}
|
|
571
|
-
n.push(
|
|
645
|
+
n.push(r.obj);
|
|
572
646
|
}
|
|
573
647
|
}
|
|
574
648
|
return n;
|
|
575
649
|
}
|
|
576
650
|
}
|
|
577
|
-
function
|
|
651
|
+
function K(e, t) {
|
|
578
652
|
if (e === void 0) return t === void 0;
|
|
579
653
|
if (t === void 0) return !0;
|
|
580
654
|
for (const n in t)
|
|
581
655
|
if (e[n] !== t[n]) return !1;
|
|
582
656
|
return !0;
|
|
583
657
|
}
|
|
584
|
-
class
|
|
658
|
+
class D {
|
|
585
659
|
constructor() {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
this.ctx =
|
|
660
|
+
_(this, "ctx");
|
|
661
|
+
_(this, "args");
|
|
662
|
+
_(this, "uiState");
|
|
663
|
+
_(this, "resultPool", new Ot());
|
|
664
|
+
this.ctx = u(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
|
|
591
665
|
}
|
|
592
666
|
getNamedAccessor(t) {
|
|
593
667
|
const n = this.ctx.getAccessorHandleByName(t);
|
|
594
|
-
return n ? new
|
|
668
|
+
return n ? new w(n) : void 0;
|
|
595
669
|
}
|
|
596
670
|
get prerun() {
|
|
597
|
-
return this.getNamedAccessor(
|
|
671
|
+
return this.getNamedAccessor(st);
|
|
598
672
|
}
|
|
599
673
|
/**
|
|
600
674
|
* @deprecated use prerun
|
|
@@ -609,7 +683,7 @@ class w {
|
|
|
609
683
|
return this.precalc;
|
|
610
684
|
}
|
|
611
685
|
get outputs() {
|
|
612
|
-
return this.getNamedAccessor(
|
|
686
|
+
return this.getNamedAccessor(it);
|
|
613
687
|
}
|
|
614
688
|
/**
|
|
615
689
|
* @deprecated use outputs
|
|
@@ -617,19 +691,39 @@ class w {
|
|
|
617
691
|
get mainOutput() {
|
|
618
692
|
return this.outputs;
|
|
619
693
|
}
|
|
694
|
+
/**
|
|
695
|
+
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
696
|
+
* @returns a map of axis value => label
|
|
697
|
+
*/
|
|
698
|
+
findLabels(t) {
|
|
699
|
+
const n = this.resultPool.getData();
|
|
700
|
+
for (const r of n.entries) {
|
|
701
|
+
if (!W(r.obj)) continue;
|
|
702
|
+
const s = r.obj.spec;
|
|
703
|
+
if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === t.name && s.axesSpec[0].type === t.type && K(t.domain, s.axesSpec[0].domain)) {
|
|
704
|
+
if (r.obj.data.resourceType.name !== "PColumnData/Json")
|
|
705
|
+
throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
|
|
706
|
+
return new Map(
|
|
707
|
+
Object.entries(
|
|
708
|
+
r.obj.data.getDataAsJson().data
|
|
709
|
+
).map((o) => [JSON.parse(o[0])[0], o[1]])
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
620
714
|
createPFrame(t) {
|
|
621
|
-
return this.ctx.createPFrame(t.map((n) =>
|
|
715
|
+
return this.ctx.createPFrame(t.map((n) => L(n, (r) => r.handle)));
|
|
622
716
|
}
|
|
623
717
|
createPTable(t) {
|
|
624
718
|
var n;
|
|
625
719
|
return "columns" in t ? n = {
|
|
626
720
|
src: {
|
|
627
|
-
type: "
|
|
628
|
-
entries: t.columns.map((
|
|
721
|
+
type: "full",
|
|
722
|
+
entries: t.columns.map((r) => ({ type: "column", column: r }))
|
|
629
723
|
},
|
|
630
724
|
filters: t.filters ?? [],
|
|
631
725
|
sorting: t.sorting ?? []
|
|
632
|
-
} : n = t, this.ctx.createPTable(
|
|
726
|
+
} : n = t, this.ctx.createPTable(gt(n, (r) => L(r, (s) => s.handle)));
|
|
633
727
|
}
|
|
634
728
|
/** @deprecated scheduled for removal from SDK */
|
|
635
729
|
getBlockLabel(t) {
|
|
@@ -640,106 +734,187 @@ class w {
|
|
|
640
734
|
return this.ctx.getCurrentUnstableMarker();
|
|
641
735
|
}
|
|
642
736
|
}
|
|
643
|
-
const
|
|
644
|
-
function
|
|
737
|
+
const R = "PColumnData/", G = R + "ResourceMap", H = R + "Partitioned/ResourceMap", Z = R + "JsonPartitioned", M = R + "BinaryPartitioned", at = R + "Partitioned/", tt = at + "JsonPartitioned", B = at + "BinaryPartitioned";
|
|
738
|
+
function lt(e, t, n, r = [], s) {
|
|
645
739
|
if (e === void 0) return !1;
|
|
646
740
|
switch (e.resourceType.name) {
|
|
647
|
-
case
|
|
648
|
-
let
|
|
649
|
-
for (const
|
|
650
|
-
const a = e.resolve({ field:
|
|
651
|
-
|
|
741
|
+
case G: {
|
|
742
|
+
let i = e.getInputsLocked();
|
|
743
|
+
for (const o of e.listInputFields()) {
|
|
744
|
+
const a = e.resolve({ field: o, assertFieldType: "Input" }), l = [...r, ...JSON.parse(o)], c = a === void 0 ? void 0 : t(a);
|
|
745
|
+
c === void 0 && (i = !1), (c !== void 0 || s) && n.push({ key: l, value: c });
|
|
652
746
|
}
|
|
653
|
-
return
|
|
747
|
+
return i;
|
|
654
748
|
}
|
|
655
|
-
case
|
|
656
|
-
let
|
|
657
|
-
for (const
|
|
658
|
-
const a = e.resolve({ field:
|
|
659
|
-
if (a === void 0)
|
|
749
|
+
case H: {
|
|
750
|
+
let i = e.getInputsLocked();
|
|
751
|
+
for (const o of e.listInputFields()) {
|
|
752
|
+
const a = e.resolve({ field: o, assertFieldType: "Input" });
|
|
753
|
+
if (a === void 0) i = !1;
|
|
660
754
|
else {
|
|
661
|
-
const
|
|
662
|
-
|
|
755
|
+
const l = [...r, ...JSON.parse(o)], c = lt(
|
|
756
|
+
a,
|
|
757
|
+
t,
|
|
758
|
+
n,
|
|
759
|
+
l,
|
|
760
|
+
s
|
|
761
|
+
);
|
|
762
|
+
i = i && c;
|
|
663
763
|
}
|
|
664
764
|
}
|
|
665
|
-
return
|
|
765
|
+
return i;
|
|
666
766
|
}
|
|
667
767
|
default:
|
|
668
768
|
throw new Error(`Unknown resource type: ${e.resourceType.name}`);
|
|
669
769
|
}
|
|
670
770
|
}
|
|
671
|
-
function
|
|
672
|
-
const
|
|
673
|
-
return { isComplete:
|
|
771
|
+
function de(e, t, n = !1) {
|
|
772
|
+
const r = [];
|
|
773
|
+
return { isComplete: lt(e, t, r, [], n), data: r };
|
|
674
774
|
}
|
|
675
|
-
const
|
|
676
|
-
|
|
775
|
+
const et = (e) => {
|
|
776
|
+
if (!e.endsWith(".index")) {
|
|
777
|
+
if (e.endsWith(".values"))
|
|
778
|
+
return e.substring(0, e.length - 7);
|
|
779
|
+
throw Error(`key must ends on .index/.values for binary p-column, got: ${e}`);
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
function Dt(e) {
|
|
783
|
+
if (!e) return;
|
|
784
|
+
const t = e.resourceType.name, n = e.getDataAsJson(), r = [];
|
|
785
|
+
let s = 0;
|
|
786
|
+
switch (t) {
|
|
787
|
+
case G:
|
|
788
|
+
s = n.keyLength;
|
|
789
|
+
break;
|
|
790
|
+
case H:
|
|
791
|
+
s = n.partitionKeyLength + n.keyLength;
|
|
792
|
+
break;
|
|
793
|
+
case Z:
|
|
794
|
+
case M:
|
|
795
|
+
s = n.partitionKeyLength;
|
|
796
|
+
break;
|
|
797
|
+
case B:
|
|
798
|
+
case tt:
|
|
799
|
+
s = n.superPartitionKeyLength + n.partitionKeyLength;
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
switch (t) {
|
|
803
|
+
case G:
|
|
804
|
+
case Z:
|
|
805
|
+
case M:
|
|
806
|
+
for (let i of e.listInputFields()) {
|
|
807
|
+
if (t === M) {
|
|
808
|
+
const a = et(i);
|
|
809
|
+
if (a) i = a;
|
|
810
|
+
else continue;
|
|
811
|
+
}
|
|
812
|
+
const o = [...JSON.parse(i)];
|
|
813
|
+
r.push(o);
|
|
814
|
+
}
|
|
815
|
+
break;
|
|
816
|
+
case H:
|
|
817
|
+
case B:
|
|
818
|
+
case tt:
|
|
819
|
+
for (const i of e.listInputFields()) {
|
|
820
|
+
const o = [...JSON.parse(i)], a = e.resolve({ field: i, assertFieldType: "Input" });
|
|
821
|
+
if (a !== void 0)
|
|
822
|
+
for (let l of a.listInputFields()) {
|
|
823
|
+
if (t === B) {
|
|
824
|
+
const f = et(l);
|
|
825
|
+
if (f) l = f;
|
|
826
|
+
else continue;
|
|
827
|
+
}
|
|
828
|
+
const c = [...o, ...JSON.parse(l)];
|
|
829
|
+
r.push(c);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
return { data: r, keyLength: s };
|
|
835
|
+
}
|
|
836
|
+
function pe(e) {
|
|
837
|
+
const t = Dt(e);
|
|
838
|
+
if (!t) return;
|
|
839
|
+
const { data: n, keyLength: r } = t, s = [];
|
|
840
|
+
for (let i = 0; i < r; ++i)
|
|
841
|
+
s.push(/* @__PURE__ */ new Set());
|
|
842
|
+
for (const i of n) {
|
|
843
|
+
if (i.length !== r)
|
|
844
|
+
throw new Error("key length does not match partition length");
|
|
845
|
+
for (let o = 0; o < r; ++o)
|
|
846
|
+
s[o].add(i[o]);
|
|
847
|
+
}
|
|
848
|
+
return s.map((i) => Array.from(i.values()));
|
|
849
|
+
}
|
|
850
|
+
const C = "1.13.0";
|
|
851
|
+
function kt(e) {
|
|
677
852
|
return e.__renderLambda === !0;
|
|
678
853
|
}
|
|
679
|
-
function
|
|
854
|
+
function U(e) {
|
|
680
855
|
if (e !== void 0)
|
|
681
|
-
return
|
|
856
|
+
return kt(e) ? e.handle : e;
|
|
682
857
|
}
|
|
683
|
-
function
|
|
858
|
+
function A(e) {
|
|
684
859
|
if (e !== void 0)
|
|
685
860
|
return typeof e == "string" ? { __renderLambda: !0, handle: e, retentive: !1 } : e;
|
|
686
861
|
}
|
|
687
|
-
function
|
|
862
|
+
function fe(e) {
|
|
688
863
|
if (e.v3 !== void 0) {
|
|
689
864
|
const {
|
|
690
865
|
initialArgs: t,
|
|
691
866
|
initialUiState: n,
|
|
692
|
-
inputsValid:
|
|
693
|
-
outputs:
|
|
694
|
-
renderingMode:
|
|
695
|
-
sdkVersion:
|
|
867
|
+
inputsValid: r,
|
|
868
|
+
outputs: s,
|
|
869
|
+
renderingMode: i,
|
|
870
|
+
sdkVersion: o,
|
|
696
871
|
sections: a,
|
|
697
|
-
title:
|
|
698
|
-
} = e.v3, { code:
|
|
872
|
+
title: l
|
|
873
|
+
} = e.v3, { code: c } = e;
|
|
699
874
|
return {
|
|
700
875
|
initialArgs: t,
|
|
701
876
|
initialUiState: n,
|
|
702
|
-
inputsValid:
|
|
703
|
-
outputs:
|
|
704
|
-
renderingMode:
|
|
705
|
-
sdkVersion:
|
|
877
|
+
inputsValid: r,
|
|
878
|
+
outputs: s,
|
|
879
|
+
renderingMode: i,
|
|
880
|
+
sdkVersion: o,
|
|
706
881
|
sections: a,
|
|
707
|
-
title:
|
|
708
|
-
code:
|
|
882
|
+
title: l,
|
|
883
|
+
code: c
|
|
709
884
|
};
|
|
710
885
|
} else if (e.inputsValid !== void 0) {
|
|
711
|
-
const { sdkVersion: t, renderingMode: n, outputs:
|
|
712
|
-
if (t === void 0 || n === void 0 ||
|
|
886
|
+
const { sdkVersion: t, renderingMode: n, outputs: r, inputsValid: s, sections: i, initialArgs: o, code: a } = e, l = Object.keys(e);
|
|
887
|
+
if (t === void 0 || n === void 0 || r === void 0 || s === void 0 || i === void 0 || o === void 0)
|
|
713
888
|
throw new Error(
|
|
714
|
-
`Malformed config v2. SDK version ${t}; Fields = ${
|
|
889
|
+
`Malformed config v2. SDK version ${t}; Fields = ${l.join(", ")}`
|
|
715
890
|
);
|
|
716
891
|
return {
|
|
717
892
|
sdkVersion: t,
|
|
718
893
|
renderingMode: n,
|
|
719
|
-
initialArgs:
|
|
894
|
+
initialArgs: o,
|
|
720
895
|
outputs: Object.fromEntries(
|
|
721
|
-
Object.entries(
|
|
896
|
+
Object.entries(r).map(([c, f]) => [c, A(f)])
|
|
722
897
|
),
|
|
723
|
-
inputsValid:
|
|
724
|
-
sections:
|
|
898
|
+
inputsValid: A(s),
|
|
899
|
+
sections: A(i),
|
|
725
900
|
initialUiState: void 0,
|
|
726
901
|
code: a
|
|
727
902
|
};
|
|
728
903
|
} else if (e.renderingMode !== void 0) {
|
|
729
|
-
const { sdkVersion: t, canRun: n, renderingMode:
|
|
730
|
-
if (
|
|
904
|
+
const { sdkVersion: t, canRun: n, renderingMode: r, outputs: s, sections: i, initialArgs: o, code: a } = e, l = Object.keys(e);
|
|
905
|
+
if (r === void 0 || s === void 0 || n === void 0 || i === void 0 || o === void 0)
|
|
731
906
|
throw new Error(
|
|
732
|
-
`Malformed config v1. SDK version ${t}; Fields = ${
|
|
907
|
+
`Malformed config v1. SDK version ${t}; Fields = ${l.join(", ")}`
|
|
733
908
|
);
|
|
734
909
|
return {
|
|
735
910
|
sdkVersion: t ?? "unknown",
|
|
736
|
-
renderingMode:
|
|
737
|
-
initialArgs:
|
|
911
|
+
renderingMode: r,
|
|
912
|
+
initialArgs: o,
|
|
738
913
|
outputs: Object.fromEntries(
|
|
739
|
-
Object.entries(
|
|
914
|
+
Object.entries(s).map(([c, f]) => [c, A(f)])
|
|
740
915
|
),
|
|
741
|
-
inputsValid:
|
|
742
|
-
sections:
|
|
916
|
+
inputsValid: A(n),
|
|
917
|
+
sections: A(i),
|
|
743
918
|
initialUiState: void 0,
|
|
744
919
|
code: a
|
|
745
920
|
};
|
|
@@ -750,25 +925,25 @@ function kt(e) {
|
|
|
750
925
|
);
|
|
751
926
|
}
|
|
752
927
|
}
|
|
753
|
-
class
|
|
754
|
-
constructor(t, n,
|
|
755
|
-
this._renderingMode = t, this._initialArgs = n, this._initialUiState =
|
|
928
|
+
class h {
|
|
929
|
+
constructor(t, n, r, s, i, o, a) {
|
|
930
|
+
this._renderingMode = t, this._initialArgs = n, this._initialUiState = r, this._outputs = s, this._inputsValid = i, this._sections = o, this._title = a;
|
|
756
931
|
}
|
|
757
932
|
static create(t = "Heavy") {
|
|
758
|
-
return new
|
|
933
|
+
return new h(
|
|
759
934
|
t,
|
|
760
935
|
void 0,
|
|
761
936
|
{},
|
|
762
937
|
{},
|
|
763
|
-
|
|
764
|
-
|
|
938
|
+
k(!0),
|
|
939
|
+
k([]),
|
|
765
940
|
void 0
|
|
766
941
|
);
|
|
767
942
|
}
|
|
768
|
-
output(t, n,
|
|
943
|
+
output(t, n, r = {}) {
|
|
769
944
|
if (typeof n == "function") {
|
|
770
|
-
const
|
|
771
|
-
return
|
|
945
|
+
const s = `output#${t}`;
|
|
946
|
+
return O(s, () => n(new D())), new h(
|
|
772
947
|
this._renderingMode,
|
|
773
948
|
this._initialArgs,
|
|
774
949
|
this._initialUiState,
|
|
@@ -776,8 +951,8 @@ class p {
|
|
|
776
951
|
...this._outputs,
|
|
777
952
|
[t]: {
|
|
778
953
|
__renderLambda: !0,
|
|
779
|
-
handle:
|
|
780
|
-
...
|
|
954
|
+
handle: s,
|
|
955
|
+
...r
|
|
781
956
|
}
|
|
782
957
|
},
|
|
783
958
|
this._inputsValid,
|
|
@@ -785,7 +960,7 @@ class p {
|
|
|
785
960
|
this._title
|
|
786
961
|
);
|
|
787
962
|
} else
|
|
788
|
-
return new
|
|
963
|
+
return new h(
|
|
789
964
|
this._renderingMode,
|
|
790
965
|
this._initialArgs,
|
|
791
966
|
this._initialUiState,
|
|
@@ -807,7 +982,7 @@ class p {
|
|
|
807
982
|
return this.inputsValid(t);
|
|
808
983
|
}
|
|
809
984
|
argsValid(t) {
|
|
810
|
-
return typeof t == "function" ? (
|
|
985
|
+
return typeof t == "function" ? (O("inputsValid", () => t(new D())), new h(
|
|
811
986
|
this._renderingMode,
|
|
812
987
|
this._initialArgs,
|
|
813
988
|
this._initialUiState,
|
|
@@ -818,7 +993,7 @@ class p {
|
|
|
818
993
|
},
|
|
819
994
|
this._sections,
|
|
820
995
|
this._title
|
|
821
|
-
)) : new
|
|
996
|
+
)) : new h(
|
|
822
997
|
this._renderingMode,
|
|
823
998
|
this._initialArgs,
|
|
824
999
|
this._initialUiState,
|
|
@@ -832,7 +1007,7 @@ class p {
|
|
|
832
1007
|
return this.argsValid(t);
|
|
833
1008
|
}
|
|
834
1009
|
sections(t) {
|
|
835
|
-
return Array.isArray(t) ? this.sections(
|
|
1010
|
+
return Array.isArray(t) ? this.sections(k(t)) : typeof t == "function" ? (O("sections", () => t(new D())), new h(
|
|
836
1011
|
this._renderingMode,
|
|
837
1012
|
this._initialArgs,
|
|
838
1013
|
this._initialUiState,
|
|
@@ -840,7 +1015,7 @@ class p {
|
|
|
840
1015
|
this._inputsValid,
|
|
841
1016
|
{ __renderLambda: !0, handle: "sections" },
|
|
842
1017
|
this._title
|
|
843
|
-
)) : new
|
|
1018
|
+
)) : new h(
|
|
844
1019
|
this._renderingMode,
|
|
845
1020
|
this._initialArgs,
|
|
846
1021
|
this._initialUiState,
|
|
@@ -851,7 +1026,7 @@ class p {
|
|
|
851
1026
|
);
|
|
852
1027
|
}
|
|
853
1028
|
title(t) {
|
|
854
|
-
return
|
|
1029
|
+
return O("title", () => t(new D())), new h(
|
|
855
1030
|
this._renderingMode,
|
|
856
1031
|
this._initialArgs,
|
|
857
1032
|
this._initialUiState,
|
|
@@ -866,7 +1041,7 @@ class p {
|
|
|
866
1041
|
* @deprecated use {@link withArgs}
|
|
867
1042
|
* */
|
|
868
1043
|
initialArgs(t) {
|
|
869
|
-
return new
|
|
1044
|
+
return new h(
|
|
870
1045
|
this._renderingMode,
|
|
871
1046
|
t,
|
|
872
1047
|
this._initialUiState,
|
|
@@ -878,7 +1053,7 @@ class p {
|
|
|
878
1053
|
}
|
|
879
1054
|
/** Sets initial args for the block, this value must be specified. */
|
|
880
1055
|
withArgs(t) {
|
|
881
|
-
return new
|
|
1056
|
+
return new h(
|
|
882
1057
|
this._renderingMode,
|
|
883
1058
|
t,
|
|
884
1059
|
this._initialUiState,
|
|
@@ -890,7 +1065,7 @@ class p {
|
|
|
890
1065
|
}
|
|
891
1066
|
/** Defines type and sets initial value for block UiState. */
|
|
892
1067
|
withUiState(t) {
|
|
893
|
-
return new
|
|
1068
|
+
return new h(
|
|
894
1069
|
this._renderingMode,
|
|
895
1070
|
this._initialArgs,
|
|
896
1071
|
t,
|
|
@@ -907,7 +1082,7 @@ class p {
|
|
|
907
1082
|
if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
|
|
908
1083
|
const t = {
|
|
909
1084
|
v3: {
|
|
910
|
-
sdkVersion:
|
|
1085
|
+
sdkVersion: C,
|
|
911
1086
|
renderingMode: this._renderingMode,
|
|
912
1087
|
initialArgs: this._initialArgs,
|
|
913
1088
|
initialUiState: this._initialUiState,
|
|
@@ -917,34 +1092,52 @@ class p {
|
|
|
917
1092
|
outputs: this._outputs
|
|
918
1093
|
},
|
|
919
1094
|
// fields below are added to allow previous desktop versions read generated configs
|
|
920
|
-
sdkVersion:
|
|
1095
|
+
sdkVersion: C,
|
|
921
1096
|
renderingMode: this._renderingMode,
|
|
922
1097
|
initialArgs: this._initialArgs,
|
|
923
|
-
inputsValid:
|
|
924
|
-
sections:
|
|
1098
|
+
inputsValid: U(this._inputsValid),
|
|
1099
|
+
sections: U(this._sections),
|
|
925
1100
|
outputs: Object.fromEntries(
|
|
926
|
-
Object.entries(this._outputs).map(([n,
|
|
1101
|
+
Object.entries(this._outputs).map(([n, r]) => [n, U(r)])
|
|
927
1102
|
)
|
|
928
1103
|
};
|
|
929
|
-
return
|
|
1104
|
+
return _t() ? rt({ sdkVersion: C }) : { config: t };
|
|
930
1105
|
}
|
|
931
1106
|
}
|
|
932
|
-
function
|
|
933
|
-
var
|
|
934
|
-
const
|
|
935
|
-
for (const
|
|
936
|
-
for (const
|
|
937
|
-
const
|
|
938
|
-
for (const
|
|
939
|
-
|
|
1107
|
+
function he(e, t, n, r) {
|
|
1108
|
+
var o, a;
|
|
1109
|
+
const s = e.resultPool.getData().entries.map((l) => l.obj).filter(W).filter((l) => l.spec.name === "pl7.app/label" && l.spec.axesSpec.length === 1), i = /* @__PURE__ */ new Map();
|
|
1110
|
+
for (const l of t)
|
|
1111
|
+
for (const c of l.spec.axesSpec) {
|
|
1112
|
+
const f = J(c);
|
|
1113
|
+
for (const v of s)
|
|
1114
|
+
mt(f, J(v.spec.axesSpec[0])) && i.set(v.id, v);
|
|
940
1115
|
}
|
|
941
1116
|
return e.createPTable({
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1117
|
+
src: {
|
|
1118
|
+
type: "outer",
|
|
1119
|
+
primary: {
|
|
1120
|
+
type: "full",
|
|
1121
|
+
entries: t.map((l) => ({ type: "column", column: l }))
|
|
1122
|
+
},
|
|
1123
|
+
secondary: Array.from(i.values()).map((l) => ({ type: "column", column: l }))
|
|
1124
|
+
},
|
|
1125
|
+
filters: [...((o = n == null ? void 0 : n.pTableParams) == null ? void 0 : o.filters) ?? [], ...r ?? []],
|
|
1126
|
+
sorting: ((a = n == null ? void 0 : n.pTableParams) == null ? void 0 : a.sorting) ?? []
|
|
945
1127
|
});
|
|
946
1128
|
}
|
|
947
|
-
|
|
1129
|
+
function ge(e, t, n) {
|
|
1130
|
+
const r = e.findLabels(t);
|
|
1131
|
+
return {
|
|
1132
|
+
axis: J(t),
|
|
1133
|
+
options: n.map((s) => ({
|
|
1134
|
+
value: s,
|
|
1135
|
+
label: (r == null ? void 0 : r.get(s)) ?? s.toString()
|
|
1136
|
+
})),
|
|
1137
|
+
defaultValue: n[0]
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
class me {
|
|
948
1141
|
constructor(t) {
|
|
949
1142
|
this.handle = t;
|
|
950
1143
|
}
|
|
@@ -964,81 +1157,88 @@ class Lt {
|
|
|
964
1157
|
return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
|
|
965
1158
|
}
|
|
966
1159
|
}
|
|
967
|
-
function
|
|
968
|
-
return
|
|
1160
|
+
function Lt(e) {
|
|
1161
|
+
return nt({
|
|
969
1162
|
__isRef: !0,
|
|
970
|
-
blockId:
|
|
971
|
-
name:
|
|
1163
|
+
blockId: x(e, "blockId"),
|
|
1164
|
+
name: x(e, "name")
|
|
972
1165
|
});
|
|
973
1166
|
}
|
|
974
|
-
function
|
|
975
|
-
return
|
|
976
|
-
ref:
|
|
977
|
-
label:
|
|
1167
|
+
function ye(e) {
|
|
1168
|
+
return nt({
|
|
1169
|
+
ref: Lt(x(e, "ref")),
|
|
1170
|
+
label: x(e, "label")
|
|
978
1171
|
});
|
|
979
1172
|
}
|
|
980
|
-
const
|
|
981
|
-
sdkVersion:
|
|
1173
|
+
const be = {
|
|
1174
|
+
sdkVersion: C
|
|
982
1175
|
};
|
|
983
|
-
function
|
|
984
|
-
return
|
|
1176
|
+
function _e() {
|
|
1177
|
+
return rt({ sdkVersion: C });
|
|
985
1178
|
}
|
|
986
|
-
function
|
|
1179
|
+
function ve(e) {
|
|
987
1180
|
if (typeof globalThis.getEnvironmentValue == "function")
|
|
988
1181
|
return globalThis.getEnvironmentValue(e);
|
|
989
1182
|
}
|
|
990
1183
|
export {
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1184
|
+
Mt as Args,
|
|
1185
|
+
h as BlockModel,
|
|
1186
|
+
be as CurrentSdkInfo,
|
|
1187
|
+
g as FutureRef,
|
|
1188
|
+
Bt as It,
|
|
1189
|
+
ce as JsRenderInternal,
|
|
1190
|
+
Ut as MainOutputs,
|
|
1191
|
+
yt as OutputError,
|
|
1192
|
+
me as PFrameImpl,
|
|
1193
|
+
M as RT_BINARY_PARTITIONED,
|
|
1194
|
+
B as RT_BINARY_SUPER_PARTITIONED,
|
|
1195
|
+
Z as RT_JSON_PARTITIONED,
|
|
1196
|
+
tt as RT_JSON_SUPER_PARTITIONED,
|
|
1197
|
+
G as RT_RESOURCE_MAP,
|
|
1198
|
+
H as RT_RESOURCE_MAP_PARTITIONED,
|
|
1199
|
+
D as RenderCtx,
|
|
1200
|
+
Ot as ResultPool,
|
|
1201
|
+
Jt as StagingOutputs,
|
|
1202
|
+
w as TreeNodeAccessor,
|
|
1203
|
+
$t as UiState,
|
|
1204
|
+
Yt as and,
|
|
1205
|
+
he as createPlDataTable,
|
|
1206
|
+
ge as createPlDataTableSheet,
|
|
1207
|
+
U as downgradeCfgOrLambda,
|
|
1208
|
+
fe as extractConfig,
|
|
1209
|
+
Wt as flatten,
|
|
1210
|
+
ye as fromPlOption,
|
|
1211
|
+
Lt as fromPlRef,
|
|
1212
|
+
ee as getBlobContent,
|
|
1213
|
+
re as getBlobContentAsJson,
|
|
1214
|
+
ne as getBlobContentAsString,
|
|
1215
|
+
se as getDownloadedBlobContent,
|
|
1216
|
+
ve as getEnvironmentValue,
|
|
1217
|
+
T as getFromCfg,
|
|
1218
|
+
k as getImmediate,
|
|
1219
|
+
oe as getImportProgress,
|
|
1220
|
+
x as getJsonField,
|
|
1221
|
+
ae as getLastLogs,
|
|
1222
|
+
ue as getLogHandle,
|
|
1223
|
+
ie as getOnDemandBlobContent,
|
|
1224
|
+
Dt as getPartitionKeysList,
|
|
1225
|
+
le as getProgressLog,
|
|
1226
|
+
_e as getRawPlatformaInstance,
|
|
1227
|
+
Qt as getResourceField,
|
|
1228
|
+
Zt as getResourceValueAsJson,
|
|
1229
|
+
pe as getUniquePartitionKeys,
|
|
1230
|
+
kt as isConfigLambda,
|
|
1231
|
+
qt as isEmpty,
|
|
1232
|
+
Nt as isolate,
|
|
1233
|
+
Kt as makeArray,
|
|
1234
|
+
nt as makeObject,
|
|
1235
|
+
Ht as mapArrayValues,
|
|
1236
|
+
Gt as mapRecordValues,
|
|
1237
|
+
te as mapResourceFields,
|
|
1238
|
+
zt as not,
|
|
1239
|
+
Xt as or,
|
|
1240
|
+
de as parseResourceMap,
|
|
1241
|
+
bt as readOutput,
|
|
1242
|
+
jt as wrapOutputs
|
|
1043
1243
|
};
|
|
1044
1244
|
//# sourceMappingURL=index.mjs.map
|