@platforma-open/milaboratories.vj-usage.model 2.0.1 → 2.1.1
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/.turbo/turbo-build.log +14 -14
- package/CHANGELOG.md +12 -0
- package/dist/bundle.js +2534 -1544
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +48 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -14
- package/dist/index.d.ts +30 -14
- package/dist/index.js +49 -40
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +4 -4
- package/src/index.ts +52 -49
package/dist/bundle.js
CHANGED
|
@@ -1,59 +1,67 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.model = {}));
|
|
3
3
|
})(this, function(exports2) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
"use strict";var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
|
|
8
|
+
function getImmediate(value) {
|
|
9
|
+
return { type: "Immediate", value };
|
|
10
|
+
}
|
|
11
|
+
function isInUI() {
|
|
12
|
+
return typeof globalThis.getPlatforma !== "undefined" || typeof globalThis.platforma !== "undefined";
|
|
13
|
+
}
|
|
14
|
+
function getPlatformaInstance(config) {
|
|
15
|
+
if (config && typeof globalThis.getPlatforma === "function")
|
|
16
|
+
return globalThis.getPlatforma(config);
|
|
17
|
+
else if (typeof globalThis.platforma !== "undefined")
|
|
18
|
+
return globalThis.platforma;
|
|
19
|
+
else
|
|
20
|
+
throw new Error("Can't get platforma instance.");
|
|
21
|
+
}
|
|
22
|
+
function tryGetCfgRenderCtx() {
|
|
23
|
+
if (typeof globalThis.cfgRenderCtx !== "undefined")
|
|
24
|
+
return globalThis.cfgRenderCtx;
|
|
25
|
+
else
|
|
26
|
+
return void 0;
|
|
7
27
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
|
|
30
|
-
return `${t}${comma}${serialize(value)}`;
|
|
31
|
-
}, "");
|
|
32
|
-
return `[${values2}]`;
|
|
33
|
-
}
|
|
34
|
-
const values = Object.keys(object).sort().reduce((t, cv) => {
|
|
35
|
-
if (object[cv] === void 0 || typeof object[cv] === "symbol") {
|
|
36
|
-
return t;
|
|
28
|
+
function getCfgRenderCtx() {
|
|
29
|
+
if (typeof globalThis.cfgRenderCtx !== "undefined")
|
|
30
|
+
return globalThis.cfgRenderCtx;
|
|
31
|
+
else
|
|
32
|
+
throw new Error("Not in config rendering context");
|
|
33
|
+
}
|
|
34
|
+
function tryRegisterCallback(key, callback) {
|
|
35
|
+
const ctx = tryGetCfgRenderCtx();
|
|
36
|
+
if (ctx === void 0)
|
|
37
|
+
return false;
|
|
38
|
+
if (key in ctx.callbackRegistry)
|
|
39
|
+
throw new Error(`Callback with key ${key} already registered.`);
|
|
40
|
+
ctx.callbackRegistry[key] = callback;
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
const futureResolves = /* @__PURE__ */ new Map();
|
|
44
|
+
function registerFutureAwait(handle, onResolve) {
|
|
45
|
+
if (!(handle in getCfgRenderCtx().callbackRegistry)) {
|
|
46
|
+
getCfgRenderCtx().callbackRegistry[handle] = (value) => {
|
|
47
|
+
for (const res of futureResolves.get(handle)) {
|
|
48
|
+
res(value);
|
|
37
49
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
return canonicalize;
|
|
50
|
+
};
|
|
51
|
+
futureResolves.set(handle, []);
|
|
52
|
+
}
|
|
53
|
+
futureResolves.get(handle).push(onResolve);
|
|
44
54
|
}
|
|
45
|
-
var canonicalizeExports = requireCanonicalize();
|
|
46
|
-
const _e = /* @__PURE__ */ getDefaultExportFromCjs(canonicalizeExports);
|
|
47
55
|
var util;
|
|
48
56
|
(function(util2) {
|
|
49
57
|
util2.assertEqual = (val) => val;
|
|
50
58
|
function assertIs(_arg) {
|
|
51
59
|
}
|
|
52
60
|
util2.assertIs = assertIs;
|
|
53
|
-
function
|
|
61
|
+
function assertNever2(_x) {
|
|
54
62
|
throw new Error();
|
|
55
63
|
}
|
|
56
|
-
util2.assertNever =
|
|
64
|
+
util2.assertNever = assertNever2;
|
|
57
65
|
util2.arrayToEnum = (items) => {
|
|
58
66
|
const obj = {};
|
|
59
67
|
for (const item of items) {
|
|
@@ -62,10 +70,10 @@
|
|
|
62
70
|
return obj;
|
|
63
71
|
};
|
|
64
72
|
util2.getValidEnumValues = (obj) => {
|
|
65
|
-
const validKeys = util2.objectKeys(obj).filter((
|
|
73
|
+
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
66
74
|
const filtered = {};
|
|
67
|
-
for (const
|
|
68
|
-
filtered[
|
|
75
|
+
for (const k of validKeys) {
|
|
76
|
+
filtered[k] = obj[k];
|
|
69
77
|
}
|
|
70
78
|
return util2.objectValues(filtered);
|
|
71
79
|
};
|
|
@@ -410,7 +418,7 @@
|
|
|
410
418
|
};
|
|
411
419
|
}
|
|
412
420
|
let errorMessage = "";
|
|
413
|
-
const maps = errorMaps.filter((
|
|
421
|
+
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
414
422
|
for (const map of maps) {
|
|
415
423
|
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
416
424
|
}
|
|
@@ -433,7 +441,7 @@
|
|
|
433
441
|
overrideMap,
|
|
434
442
|
overrideMap === errorMap ? void 0 : errorMap
|
|
435
443
|
// then global default map
|
|
436
|
-
].filter((
|
|
444
|
+
].filter((x) => !!x)
|
|
437
445
|
});
|
|
438
446
|
ctx.common.issues.push(issue);
|
|
439
447
|
}
|
|
@@ -451,12 +459,12 @@
|
|
|
451
459
|
}
|
|
452
460
|
static mergeArray(status, results) {
|
|
453
461
|
const arrayValue = [];
|
|
454
|
-
for (const
|
|
455
|
-
if (
|
|
462
|
+
for (const s of results) {
|
|
463
|
+
if (s.status === "aborted")
|
|
456
464
|
return INVALID;
|
|
457
|
-
if (
|
|
465
|
+
if (s.status === "dirty")
|
|
458
466
|
status.dirty();
|
|
459
|
-
arrayValue.push(
|
|
467
|
+
arrayValue.push(s.value);
|
|
460
468
|
}
|
|
461
469
|
return { status: status.value, value: arrayValue };
|
|
462
470
|
}
|
|
@@ -496,15 +504,15 @@
|
|
|
496
504
|
});
|
|
497
505
|
const DIRTY = (value) => ({ status: "dirty", value });
|
|
498
506
|
const OK = (value) => ({ status: "valid", value });
|
|
499
|
-
const isAborted = (
|
|
500
|
-
const isDirty = (
|
|
501
|
-
const isValid = (
|
|
502
|
-
const isAsync = (
|
|
503
|
-
function __classPrivateFieldGet(receiver, state, kind,
|
|
507
|
+
const isAborted = (x) => x.status === "aborted";
|
|
508
|
+
const isDirty = (x) => x.status === "dirty";
|
|
509
|
+
const isValid = (x) => x.status === "valid";
|
|
510
|
+
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
511
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
504
512
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
505
513
|
return state.get(receiver);
|
|
506
514
|
}
|
|
507
|
-
function __classPrivateFieldSet(receiver, state, value, kind,
|
|
515
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
508
516
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
509
517
|
return state.set(receiver, value), value;
|
|
510
518
|
}
|
|
@@ -858,11 +866,11 @@
|
|
|
858
866
|
regex = `${regex}(${opts.join("|")})`;
|
|
859
867
|
return new RegExp(`^${regex}$`);
|
|
860
868
|
}
|
|
861
|
-
function isValidIP(ip,
|
|
862
|
-
if ((
|
|
869
|
+
function isValidIP(ip, version2) {
|
|
870
|
+
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
|
863
871
|
return true;
|
|
864
872
|
}
|
|
865
|
-
if ((
|
|
873
|
+
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
|
866
874
|
return true;
|
|
867
875
|
}
|
|
868
876
|
return false;
|
|
@@ -2829,7 +2837,7 @@
|
|
|
2829
2837
|
if (!schema)
|
|
2830
2838
|
return null;
|
|
2831
2839
|
return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
2832
|
-
}).filter((
|
|
2840
|
+
}).filter((x) => !!x);
|
|
2833
2841
|
if (ctx.common.async) {
|
|
2834
2842
|
return Promise.all(items).then((results) => {
|
|
2835
2843
|
return ParseStatus.mergeArray(status, results);
|
|
@@ -3087,7 +3095,7 @@
|
|
|
3087
3095
|
ctx.schemaErrorMap,
|
|
3088
3096
|
getErrorMap(),
|
|
3089
3097
|
errorMap
|
|
3090
|
-
].filter((
|
|
3098
|
+
].filter((x) => !!x),
|
|
3091
3099
|
issueData: {
|
|
3092
3100
|
code: ZodIssueCode.invalid_arguments,
|
|
3093
3101
|
argumentsError: error
|
|
@@ -3103,7 +3111,7 @@
|
|
|
3103
3111
|
ctx.schemaErrorMap,
|
|
3104
3112
|
getErrorMap(),
|
|
3105
3113
|
errorMap
|
|
3106
|
-
].filter((
|
|
3114
|
+
].filter((x) => !!x),
|
|
3107
3115
|
issueData: {
|
|
3108
3116
|
code: ZodIssueCode.invalid_return_type,
|
|
3109
3117
|
returnTypeError: error
|
|
@@ -3739,10 +3747,10 @@
|
|
|
3739
3747
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3740
3748
|
var _a, _b;
|
|
3741
3749
|
if (!check(data)) {
|
|
3742
|
-
const
|
|
3743
|
-
const _fatal = (_b = (_a =
|
|
3744
|
-
const
|
|
3745
|
-
ctx.addIssue({ code: "custom", ...
|
|
3750
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3751
|
+
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
3752
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3753
|
+
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
3746
3754
|
}
|
|
3747
3755
|
});
|
|
3748
3756
|
return ZodAny.create();
|
|
@@ -3840,7 +3848,7 @@
|
|
|
3840
3848
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3841
3849
|
};
|
|
3842
3850
|
const NEVER = INVALID;
|
|
3843
|
-
var z
|
|
3851
|
+
var z = /* @__PURE__ */ Object.freeze({
|
|
3844
3852
|
__proto__: null,
|
|
3845
3853
|
defaultErrorMap: errorMap,
|
|
3846
3854
|
setErrorMap,
|
|
@@ -3956,235 +3964,588 @@
|
|
|
3956
3964
|
quotelessJson,
|
|
3957
3965
|
ZodError
|
|
3958
3966
|
});
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
}
|
|
3965
|
-
function
|
|
3966
|
-
|
|
3967
|
+
z.object({
|
|
3968
|
+
/** Included left border. */
|
|
3969
|
+
from: z.number(),
|
|
3970
|
+
/** Excluded right border. */
|
|
3971
|
+
to: z.number()
|
|
3972
|
+
});
|
|
3973
|
+
function assertNever(x) {
|
|
3974
|
+
throw new Error("Unexpected object: " + x);
|
|
3975
|
+
}
|
|
3976
|
+
function isDataInfo(value) {
|
|
3977
|
+
if (!value || typeof value !== "object") {
|
|
3967
3978
|
return false;
|
|
3968
|
-
|
|
3969
|
-
|
|
3979
|
+
}
|
|
3980
|
+
const data = value;
|
|
3981
|
+
if (!("type" in data)) {
|
|
3970
3982
|
return false;
|
|
3971
|
-
|
|
3983
|
+
}
|
|
3984
|
+
switch (data.type) {
|
|
3972
3985
|
case "Json":
|
|
3973
|
-
return typeof
|
|
3986
|
+
return typeof data.keyLength === "number" && data.data !== void 0 && typeof data.data === "object";
|
|
3974
3987
|
case "JsonPartitioned":
|
|
3975
|
-
return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
|
|
3976
3988
|
case "BinaryPartitioned":
|
|
3977
|
-
|
|
3989
|
+
case "ParquetPartitioned":
|
|
3990
|
+
return typeof data.partitionKeyLength === "number" && data.parts !== void 0 && typeof data.parts === "object";
|
|
3978
3991
|
default:
|
|
3979
3992
|
return false;
|
|
3980
3993
|
}
|
|
3981
3994
|
}
|
|
3982
|
-
function
|
|
3983
|
-
if (
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
parts: e
|
|
3994
|
-
};
|
|
3995
|
+
function mapDataInfo(dataInfo, mapFn) {
|
|
3996
|
+
if (dataInfo === void 0) {
|
|
3997
|
+
return void 0;
|
|
3998
|
+
}
|
|
3999
|
+
switch (dataInfo.type) {
|
|
4000
|
+
case "Json":
|
|
4001
|
+
return dataInfo;
|
|
4002
|
+
case "JsonPartitioned": {
|
|
4003
|
+
const newParts = {};
|
|
4004
|
+
for (const [key, blob] of Object.entries(dataInfo.parts)) {
|
|
4005
|
+
newParts[key] = mapFn(blob);
|
|
3995
4006
|
}
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4007
|
+
return {
|
|
4008
|
+
...dataInfo,
|
|
4009
|
+
parts: newParts
|
|
4010
|
+
};
|
|
4011
|
+
}
|
|
4012
|
+
case "BinaryPartitioned": {
|
|
4013
|
+
const newParts = {};
|
|
4014
|
+
for (const [key, chunk] of Object.entries(dataInfo.parts)) {
|
|
4015
|
+
newParts[key] = {
|
|
4016
|
+
index: mapFn(chunk.index),
|
|
4017
|
+
values: mapFn(chunk.values)
|
|
4006
4018
|
};
|
|
4007
4019
|
}
|
|
4020
|
+
return {
|
|
4021
|
+
...dataInfo,
|
|
4022
|
+
parts: newParts
|
|
4023
|
+
};
|
|
4024
|
+
}
|
|
4025
|
+
case "ParquetPartitioned": {
|
|
4026
|
+
const newParts = {};
|
|
4027
|
+
for (const [key, blob] of Object.entries(dataInfo.parts)) {
|
|
4028
|
+
newParts[key] = mapFn(blob);
|
|
4029
|
+
}
|
|
4030
|
+
return {
|
|
4031
|
+
...dataInfo,
|
|
4032
|
+
parts: newParts
|
|
4033
|
+
};
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
function visitDataInfo(dataInfo, cb) {
|
|
4038
|
+
switch (dataInfo.type) {
|
|
4039
|
+
case "Json":
|
|
4040
|
+
break;
|
|
4041
|
+
case "JsonPartitioned": {
|
|
4042
|
+
Object.values(dataInfo.parts).forEach(cb);
|
|
4043
|
+
break;
|
|
4044
|
+
}
|
|
4045
|
+
case "BinaryPartitioned": {
|
|
4046
|
+
Object.values(dataInfo.parts).forEach((chunk) => {
|
|
4047
|
+
cb(chunk.index);
|
|
4048
|
+
cb(chunk.values);
|
|
4049
|
+
});
|
|
4050
|
+
break;
|
|
4008
4051
|
}
|
|
4052
|
+
case "ParquetPartitioned": {
|
|
4053
|
+
Object.values(dataInfo.parts).forEach(cb);
|
|
4054
|
+
break;
|
|
4055
|
+
}
|
|
4056
|
+
}
|
|
4009
4057
|
}
|
|
4010
|
-
function
|
|
4011
|
-
if (!
|
|
4058
|
+
function isDataInfoEntries(value) {
|
|
4059
|
+
if (!value || typeof value !== "object") {
|
|
4012
4060
|
return false;
|
|
4013
|
-
|
|
4014
|
-
|
|
4061
|
+
}
|
|
4062
|
+
const data = value;
|
|
4063
|
+
if (!("type" in data)) {
|
|
4015
4064
|
return false;
|
|
4016
|
-
|
|
4065
|
+
}
|
|
4066
|
+
switch (data.type) {
|
|
4017
4067
|
case "Json":
|
|
4018
|
-
return typeof
|
|
4068
|
+
return typeof data.keyLength === "number" && Array.isArray(data.data);
|
|
4019
4069
|
case "JsonPartitioned":
|
|
4020
|
-
return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
|
|
4021
4070
|
case "BinaryPartitioned":
|
|
4022
|
-
|
|
4071
|
+
case "ParquetPartitioned":
|
|
4072
|
+
return typeof data.partitionKeyLength === "number" && Array.isArray(data.parts);
|
|
4023
4073
|
default:
|
|
4024
4074
|
return false;
|
|
4025
4075
|
}
|
|
4026
4076
|
}
|
|
4027
|
-
function
|
|
4028
|
-
|
|
4077
|
+
function isPartitionedDataInfoEntries(value) {
|
|
4078
|
+
if (!isDataInfoEntries(value))
|
|
4079
|
+
return false;
|
|
4080
|
+
switch (value.type) {
|
|
4081
|
+
case "JsonPartitioned":
|
|
4082
|
+
case "BinaryPartitioned":
|
|
4083
|
+
case "ParquetPartitioned":
|
|
4084
|
+
return true;
|
|
4085
|
+
default:
|
|
4086
|
+
return false;
|
|
4087
|
+
}
|
|
4029
4088
|
}
|
|
4030
|
-
function
|
|
4031
|
-
switch (
|
|
4032
|
-
case "Json":
|
|
4033
|
-
const t = Object.entries(n2.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
|
|
4089
|
+
function dataInfoToEntries(dataInfo) {
|
|
4090
|
+
switch (dataInfo.type) {
|
|
4091
|
+
case "Json":
|
|
4034
4092
|
return {
|
|
4035
4093
|
type: "Json",
|
|
4036
|
-
keyLength:
|
|
4037
|
-
data:
|
|
4094
|
+
keyLength: dataInfo.keyLength,
|
|
4095
|
+
data: Object.entries(dataInfo.data).map(([keyStr, value]) => {
|
|
4096
|
+
const key = JSON.parse(keyStr);
|
|
4097
|
+
return { key, value };
|
|
4098
|
+
})
|
|
4038
4099
|
};
|
|
4039
|
-
|
|
4040
|
-
case "JsonPartitioned": {
|
|
4041
|
-
const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
|
|
4100
|
+
case "JsonPartitioned":
|
|
4042
4101
|
return {
|
|
4043
4102
|
type: "JsonPartitioned",
|
|
4044
|
-
partitionKeyLength:
|
|
4045
|
-
parts:
|
|
4103
|
+
partitionKeyLength: dataInfo.partitionKeyLength,
|
|
4104
|
+
parts: Object.entries(dataInfo.parts).map(([keyStr, blob]) => {
|
|
4105
|
+
const key = JSON.parse(keyStr);
|
|
4106
|
+
return { key, value: blob };
|
|
4107
|
+
})
|
|
4046
4108
|
};
|
|
4047
|
-
|
|
4048
|
-
case "BinaryPartitioned": {
|
|
4049
|
-
const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
|
|
4109
|
+
case "BinaryPartitioned":
|
|
4050
4110
|
return {
|
|
4051
4111
|
type: "BinaryPartitioned",
|
|
4052
|
-
partitionKeyLength:
|
|
4053
|
-
parts:
|
|
4112
|
+
partitionKeyLength: dataInfo.partitionKeyLength,
|
|
4113
|
+
parts: Object.entries(dataInfo.parts).map(([keyStr, chunk]) => {
|
|
4114
|
+
const key = JSON.parse(keyStr);
|
|
4115
|
+
return { key, value: chunk };
|
|
4116
|
+
})
|
|
4054
4117
|
};
|
|
4055
|
-
|
|
4118
|
+
case "ParquetPartitioned":
|
|
4119
|
+
return {
|
|
4120
|
+
type: "ParquetPartitioned",
|
|
4121
|
+
partitionKeyLength: dataInfo.partitionKeyLength,
|
|
4122
|
+
parts: Object.entries(dataInfo.parts).map(([keyStr, blob]) => {
|
|
4123
|
+
const key = JSON.parse(keyStr);
|
|
4124
|
+
return { key, value: blob };
|
|
4125
|
+
})
|
|
4126
|
+
};
|
|
4127
|
+
default:
|
|
4128
|
+
assertNever(dataInfo);
|
|
4056
4129
|
}
|
|
4057
4130
|
}
|
|
4058
|
-
function
|
|
4059
|
-
switch (
|
|
4060
|
-
case "Json":
|
|
4061
|
-
const t = {};
|
|
4062
|
-
for (const e of n2.data)
|
|
4063
|
-
t[JSON.stringify(e.key)] = e.value;
|
|
4131
|
+
function entriesToDataInfo(dataInfoEntries) {
|
|
4132
|
+
switch (dataInfoEntries.type) {
|
|
4133
|
+
case "Json":
|
|
4064
4134
|
return {
|
|
4065
4135
|
type: "Json",
|
|
4066
|
-
keyLength:
|
|
4067
|
-
data:
|
|
4136
|
+
keyLength: dataInfoEntries.keyLength,
|
|
4137
|
+
data: Object.fromEntries(dataInfoEntries.data.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4068
4138
|
};
|
|
4069
|
-
|
|
4070
|
-
case "JsonPartitioned": {
|
|
4071
|
-
const t = {};
|
|
4072
|
-
for (const e of n2.parts)
|
|
4073
|
-
t[JSON.stringify(e.key)] = e.value;
|
|
4139
|
+
case "JsonPartitioned":
|
|
4074
4140
|
return {
|
|
4075
4141
|
type: "JsonPartitioned",
|
|
4076
|
-
partitionKeyLength:
|
|
4077
|
-
parts:
|
|
4142
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength,
|
|
4143
|
+
parts: Object.fromEntries(dataInfoEntries.parts.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4078
4144
|
};
|
|
4079
|
-
|
|
4080
|
-
case "BinaryPartitioned": {
|
|
4081
|
-
const t = {};
|
|
4082
|
-
for (const e of n2.parts)
|
|
4083
|
-
t[JSON.stringify(e.key)] = e.value;
|
|
4145
|
+
case "BinaryPartitioned":
|
|
4084
4146
|
return {
|
|
4085
4147
|
type: "BinaryPartitioned",
|
|
4086
|
-
partitionKeyLength:
|
|
4087
|
-
parts:
|
|
4148
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength,
|
|
4149
|
+
parts: Object.fromEntries(dataInfoEntries.parts.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4150
|
+
};
|
|
4151
|
+
case "ParquetPartitioned":
|
|
4152
|
+
return {
|
|
4153
|
+
type: "ParquetPartitioned",
|
|
4154
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength,
|
|
4155
|
+
parts: Object.fromEntries(dataInfoEntries.parts.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4088
4156
|
};
|
|
4157
|
+
default:
|
|
4158
|
+
assertNever(dataInfoEntries);
|
|
4159
|
+
}
|
|
4160
|
+
}
|
|
4161
|
+
function stringifyValue(value) {
|
|
4162
|
+
if (typeof value === "string") {
|
|
4163
|
+
return `String value was thrown: ${value}`;
|
|
4164
|
+
}
|
|
4165
|
+
if (value && typeof value === "object") {
|
|
4166
|
+
try {
|
|
4167
|
+
return `Plain object was thrown: ${JSON.stringify(value)}`;
|
|
4168
|
+
} catch (jsonError) {
|
|
4169
|
+
const errorMessage = jsonError instanceof Error ? jsonError.message : String(jsonError);
|
|
4170
|
+
return `Non-serializable object was thrown (JSON.stringify failed: ${errorMessage}): ${String(value)}`;
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
return String(`Non-Error value (${typeof value}) was thrown: ${value}`);
|
|
4174
|
+
}
|
|
4175
|
+
function ensureError(value) {
|
|
4176
|
+
if (value instanceof Error) {
|
|
4177
|
+
return value;
|
|
4178
|
+
}
|
|
4179
|
+
return new Error(stringifyValue(value));
|
|
4180
|
+
}
|
|
4181
|
+
function getDefaultExportFromCjs(x) {
|
|
4182
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4183
|
+
}
|
|
4184
|
+
var canonicalize$1;
|
|
4185
|
+
var hasRequiredCanonicalize;
|
|
4186
|
+
function requireCanonicalize() {
|
|
4187
|
+
if (hasRequiredCanonicalize) return canonicalize$1;
|
|
4188
|
+
hasRequiredCanonicalize = 1;
|
|
4189
|
+
canonicalize$1 = function serialize(object) {
|
|
4190
|
+
if (typeof object === "number" && isNaN(object)) {
|
|
4191
|
+
throw new Error("NaN is not allowed");
|
|
4192
|
+
}
|
|
4193
|
+
if (typeof object === "number" && !isFinite(object)) {
|
|
4194
|
+
throw new Error("Infinity is not allowed");
|
|
4089
4195
|
}
|
|
4196
|
+
if (object === null || typeof object !== "object") {
|
|
4197
|
+
return JSON.stringify(object);
|
|
4198
|
+
}
|
|
4199
|
+
if (object.toJSON instanceof Function) {
|
|
4200
|
+
return serialize(object.toJSON());
|
|
4201
|
+
}
|
|
4202
|
+
if (Array.isArray(object)) {
|
|
4203
|
+
const values2 = object.reduce((t, cv, ci) => {
|
|
4204
|
+
const comma = ci === 0 ? "" : ",";
|
|
4205
|
+
const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
|
|
4206
|
+
return `${t}${comma}${serialize(value)}`;
|
|
4207
|
+
}, "");
|
|
4208
|
+
return `[${values2}]`;
|
|
4209
|
+
}
|
|
4210
|
+
const values = Object.keys(object).sort().reduce((t, cv) => {
|
|
4211
|
+
if (object[cv] === void 0 || typeof object[cv] === "symbol") {
|
|
4212
|
+
return t;
|
|
4213
|
+
}
|
|
4214
|
+
const comma = t.length === 0 ? "" : ",";
|
|
4215
|
+
return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;
|
|
4216
|
+
}, "");
|
|
4217
|
+
return `{${values}}`;
|
|
4218
|
+
};
|
|
4219
|
+
return canonicalize$1;
|
|
4220
|
+
}
|
|
4221
|
+
var canonicalizeExports = requireCanonicalize();
|
|
4222
|
+
const canonicalize = /* @__PURE__ */ getDefaultExportFromCjs(canonicalizeExports);
|
|
4223
|
+
function stringifyJson(value) {
|
|
4224
|
+
return JSON.stringify(value);
|
|
4225
|
+
}
|
|
4226
|
+
function canonicalizeJson(value) {
|
|
4227
|
+
return canonicalize(value);
|
|
4228
|
+
}
|
|
4229
|
+
function parseJson(value) {
|
|
4230
|
+
return JSON.parse(value);
|
|
4231
|
+
}
|
|
4232
|
+
const ValueType = {
|
|
4233
|
+
Int: "Int",
|
|
4234
|
+
Long: "Long",
|
|
4235
|
+
Float: "Float",
|
|
4236
|
+
Double: "Double",
|
|
4237
|
+
String: "String",
|
|
4238
|
+
Bytes: "Bytes"
|
|
4239
|
+
};
|
|
4240
|
+
function readMetadata(metadata, key) {
|
|
4241
|
+
return metadata == null ? void 0 : metadata[key];
|
|
4242
|
+
}
|
|
4243
|
+
function readMetadataJsonOrThrow(metadata, metadataJson, key, methodNameInError = "readMetadataJsonOrThrow") {
|
|
4244
|
+
const json = readMetadata(metadata, key);
|
|
4245
|
+
if (json === void 0)
|
|
4246
|
+
return void 0;
|
|
4247
|
+
const schema = metadataJson[key];
|
|
4248
|
+
try {
|
|
4249
|
+
const value = JSON.parse(json);
|
|
4250
|
+
return schema.parse(value);
|
|
4251
|
+
} catch (error) {
|
|
4252
|
+
throw new Error(`${methodNameInError} failed, key: ${String(key)}, value: ${json}, error: ${ensureError(error)}`);
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
function readMetadataJson(metadata, metadataJson, key) {
|
|
4256
|
+
try {
|
|
4257
|
+
return readMetadataJsonOrThrow(metadata, metadataJson, key);
|
|
4258
|
+
} catch {
|
|
4259
|
+
return void 0;
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
const Annotation = {
|
|
4263
|
+
DiscreteValues: "pl7.app/discreteValues",
|
|
4264
|
+
Graph: {
|
|
4265
|
+
IsVirtual: "pl7.app/graph/isVirtual"
|
|
4266
|
+
},
|
|
4267
|
+
HideDataFromUi: "pl7.app/hideDataFromUi",
|
|
4268
|
+
IsLinkerColumn: "pl7.app/isLinkerColumn",
|
|
4269
|
+
Label: "pl7.app/label",
|
|
4270
|
+
Max: "pl7.app/max",
|
|
4271
|
+
Min: "pl7.app/min",
|
|
4272
|
+
Parents: "pl7.app/parents",
|
|
4273
|
+
Sequence: {
|
|
4274
|
+
Annotation: {
|
|
4275
|
+
Mapping: "pl7.app/sequence/annotation/mapping"
|
|
4276
|
+
},
|
|
4277
|
+
IsAnnotation: "pl7.app/sequence/isAnnotation"
|
|
4278
|
+
},
|
|
4279
|
+
Table: {
|
|
4280
|
+
OrderPriority: "pl7.app/table/orderPriority"
|
|
4281
|
+
},
|
|
4282
|
+
Trace: "pl7.app/trace"
|
|
4283
|
+
};
|
|
4284
|
+
const AxisSpec = z.object({
|
|
4285
|
+
type: z.nativeEnum(ValueType),
|
|
4286
|
+
name: z.string(),
|
|
4287
|
+
domain: z.record(z.string(), z.string()).optional(),
|
|
4288
|
+
annotations: z.record(z.string(), z.string()).optional(),
|
|
4289
|
+
parentAxes: z.array(z.number()).optional()
|
|
4290
|
+
}).passthrough();
|
|
4291
|
+
const AnnotationJson = {
|
|
4292
|
+
[Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),
|
|
4293
|
+
[Annotation.Graph.IsVirtual]: z.boolean(),
|
|
4294
|
+
[Annotation.HideDataFromUi]: z.boolean(),
|
|
4295
|
+
[Annotation.IsLinkerColumn]: z.boolean(),
|
|
4296
|
+
[Annotation.Max]: z.number(),
|
|
4297
|
+
[Annotation.Min]: z.number(),
|
|
4298
|
+
[Annotation.Parents]: z.array(AxisSpec),
|
|
4299
|
+
[Annotation.Sequence.Annotation.Mapping]: z.record(z.string(), z.string()),
|
|
4300
|
+
[Annotation.Sequence.IsAnnotation]: z.boolean(),
|
|
4301
|
+
[Annotation.Table.OrderPriority]: z.number(),
|
|
4302
|
+
[Annotation.Trace]: z.record(z.string(), z.unknown())
|
|
4303
|
+
};
|
|
4304
|
+
function readAnnotation(spec, key) {
|
|
4305
|
+
return readMetadata(spec == null ? void 0 : spec.annotations, key);
|
|
4306
|
+
}
|
|
4307
|
+
function readAnnotationJson(spec, key) {
|
|
4308
|
+
return readMetadataJson(spec == null ? void 0 : spec.annotations, AnnotationJson, key);
|
|
4309
|
+
}
|
|
4310
|
+
function makeAxisTree(axis) {
|
|
4311
|
+
return { axis, children: [] };
|
|
4312
|
+
}
|
|
4313
|
+
function getAxesTree(rootAxis) {
|
|
4314
|
+
const root = makeAxisTree(rootAxis);
|
|
4315
|
+
let nodesQ = [root];
|
|
4316
|
+
while (nodesQ.length) {
|
|
4317
|
+
const nextNodes = [];
|
|
4318
|
+
for (const node of nodesQ) {
|
|
4319
|
+
node.children = node.axis.parentAxesSpec.map(makeAxisTree);
|
|
4320
|
+
nextNodes.push(...node.children);
|
|
4321
|
+
}
|
|
4322
|
+
nodesQ = nextNodes;
|
|
4323
|
+
}
|
|
4324
|
+
return root;
|
|
4325
|
+
}
|
|
4326
|
+
function getArrayFromAxisTree(tree) {
|
|
4327
|
+
const res = [tree.axis];
|
|
4328
|
+
let nodesQ = [tree];
|
|
4329
|
+
while (nodesQ.length) {
|
|
4330
|
+
const nextNodes = [];
|
|
4331
|
+
for (const node of nodesQ) {
|
|
4332
|
+
for (const parent of node.children) {
|
|
4333
|
+
res.push(parent.axis);
|
|
4334
|
+
nextNodes.push(parent);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
nodesQ = nextNodes;
|
|
4338
|
+
}
|
|
4339
|
+
return res;
|
|
4340
|
+
}
|
|
4341
|
+
function canonicalizeAxisWithParents(axis) {
|
|
4342
|
+
return canonicalizeJson(getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));
|
|
4343
|
+
}
|
|
4344
|
+
function normalizingAxesComparator(axis1, axis2) {
|
|
4345
|
+
if (axis1.name !== axis2.name) {
|
|
4346
|
+
return axis1.name < axis2.name ? 1 : -1;
|
|
4347
|
+
}
|
|
4348
|
+
if (axis1.type !== axis2.type) {
|
|
4349
|
+
return axis1.type < axis2.type ? 1 : -1;
|
|
4350
|
+
}
|
|
4351
|
+
const domain1 = canonicalizeJson(axis1.domain ?? {});
|
|
4352
|
+
const domain2 = canonicalizeJson(axis2.domain ?? {});
|
|
4353
|
+
if (domain1 !== domain2) {
|
|
4354
|
+
return domain1 < domain2 ? 1 : -1;
|
|
4355
|
+
}
|
|
4356
|
+
const parents1 = canonicalizeAxisWithParents(axis1);
|
|
4357
|
+
const parents2 = canonicalizeAxisWithParents(axis2);
|
|
4358
|
+
if (parents1 !== parents2) {
|
|
4359
|
+
return parents1 < parents2 ? 1 : -1;
|
|
4360
|
+
}
|
|
4361
|
+
const annotation1 = canonicalizeJson(axis1.annotations ?? {});
|
|
4362
|
+
const annotation2 = canonicalizeJson(axis2.annotations ?? {});
|
|
4363
|
+
if (annotation1 !== annotation2) {
|
|
4364
|
+
return annotation1 < annotation2 ? 1 : -1;
|
|
4365
|
+
}
|
|
4366
|
+
return 0;
|
|
4367
|
+
}
|
|
4368
|
+
function parseParentsFromAnnotations(axis) {
|
|
4369
|
+
const parentsList = readAnnotationJson(axis, Annotation.Parents);
|
|
4370
|
+
if (parentsList === void 0) {
|
|
4371
|
+
return [];
|
|
4372
|
+
}
|
|
4373
|
+
return parentsList;
|
|
4374
|
+
}
|
|
4375
|
+
function sortParentsDeep(axisSpec) {
|
|
4376
|
+
axisSpec.parentAxesSpec.forEach(sortParentsDeep);
|
|
4377
|
+
axisSpec.parentAxesSpec.sort(normalizingAxesComparator);
|
|
4378
|
+
}
|
|
4379
|
+
function hasCycleOfParents(axisSpec) {
|
|
4380
|
+
const root = makeAxisTree(axisSpec);
|
|
4381
|
+
let nodesQ = [root];
|
|
4382
|
+
const ancestors = new Set(canonicalizeJson(getAxisId(axisSpec)));
|
|
4383
|
+
while (nodesQ.length) {
|
|
4384
|
+
const nextNodes = [];
|
|
4385
|
+
const levelIds = /* @__PURE__ */ new Set();
|
|
4386
|
+
for (const node of nodesQ) {
|
|
4387
|
+
node.children = node.axis.parentAxesSpec.map(makeAxisTree);
|
|
4388
|
+
for (const child of node.children) {
|
|
4389
|
+
const childId = canonicalizeJson(getAxisId(child.axis));
|
|
4390
|
+
if (!levelIds.has(childId)) {
|
|
4391
|
+
nextNodes.push(child);
|
|
4392
|
+
levelIds.add(childId);
|
|
4393
|
+
if (ancestors.has(childId)) {
|
|
4394
|
+
return true;
|
|
4395
|
+
}
|
|
4396
|
+
ancestors.add(childId);
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
nodesQ = nextNodes;
|
|
4401
|
+
}
|
|
4402
|
+
return false;
|
|
4403
|
+
}
|
|
4404
|
+
function getNormalizedAxesList(axes) {
|
|
4405
|
+
if (!axes.length) {
|
|
4406
|
+
return [];
|
|
4407
|
+
}
|
|
4408
|
+
const modifiedAxes = axes.map((axis) => {
|
|
4409
|
+
const { parentAxes: _, ...copiedRest } = axis;
|
|
4410
|
+
return { ...copiedRest, annotations: { ...copiedRest.annotations }, parentAxesSpec: [] };
|
|
4411
|
+
});
|
|
4412
|
+
axes.forEach((axis, idx) => {
|
|
4413
|
+
var _a;
|
|
4414
|
+
const modifiedAxis = modifiedAxes[idx];
|
|
4415
|
+
if (axis.parentAxes) {
|
|
4416
|
+
modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx2) => modifiedAxes[idx2]);
|
|
4417
|
+
} else {
|
|
4418
|
+
modifiedAxis.parentAxesSpec = getNormalizedAxesList(parseParentsFromAnnotations(axis));
|
|
4419
|
+
(_a = modifiedAxis.annotations) == null ? true : delete _a[Annotation.Parents];
|
|
4420
|
+
}
|
|
4421
|
+
});
|
|
4422
|
+
if (modifiedAxes.some(hasCycleOfParents)) {
|
|
4423
|
+
modifiedAxes.forEach((axis) => {
|
|
4424
|
+
axis.parentAxesSpec = [];
|
|
4425
|
+
});
|
|
4426
|
+
} else {
|
|
4427
|
+
modifiedAxes.forEach((axis) => {
|
|
4428
|
+
sortParentsDeep(axis);
|
|
4429
|
+
});
|
|
4090
4430
|
}
|
|
4431
|
+
return modifiedAxes;
|
|
4091
4432
|
}
|
|
4092
|
-
|
|
4433
|
+
const PColumnName = {
|
|
4434
|
+
Label: "pl7.app/label"
|
|
4435
|
+
};
|
|
4436
|
+
function getColumnIdAndSpec(column) {
|
|
4093
4437
|
return {
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
name: n2.name,
|
|
4097
|
-
domain: n2.domain,
|
|
4098
|
-
parentAxes: n2.parentAxes,
|
|
4099
|
-
axesId: z(n2.axesSpec)
|
|
4438
|
+
columnId: column.id,
|
|
4439
|
+
spec: column.spec
|
|
4100
4440
|
};
|
|
4101
4441
|
}
|
|
4102
|
-
function
|
|
4103
|
-
const { type
|
|
4104
|
-
|
|
4442
|
+
function getAxisId(spec) {
|
|
4443
|
+
const { type, name, domain } = spec;
|
|
4444
|
+
const result = { type, name };
|
|
4445
|
+
if (domain && Object.entries(domain).length > 0) {
|
|
4446
|
+
Object.assign(result, { domain });
|
|
4447
|
+
}
|
|
4448
|
+
return result;
|
|
4105
4449
|
}
|
|
4106
|
-
function
|
|
4107
|
-
return
|
|
4450
|
+
function getAxesId(spec) {
|
|
4451
|
+
return spec.map(getAxisId);
|
|
4108
4452
|
}
|
|
4109
|
-
function
|
|
4110
|
-
return
|
|
4453
|
+
function canonicalizeAxisId(id) {
|
|
4454
|
+
return canonicalizeJson(getAxisId(id));
|
|
4111
4455
|
}
|
|
4112
|
-
function
|
|
4113
|
-
if (
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4456
|
+
function matchDomain$1(query, target) {
|
|
4457
|
+
if (query === void 0)
|
|
4458
|
+
return target === void 0;
|
|
4459
|
+
if (target === void 0)
|
|
4460
|
+
return true;
|
|
4461
|
+
for (const k in target) {
|
|
4462
|
+
if (query[k] !== target[k])
|
|
4463
|
+
return false;
|
|
4464
|
+
}
|
|
4117
4465
|
return true;
|
|
4118
4466
|
}
|
|
4119
|
-
function
|
|
4120
|
-
return
|
|
4467
|
+
function matchAxisId(query, target) {
|
|
4468
|
+
return query.name === target.name && matchDomain$1(query.domain, target.domain);
|
|
4121
4469
|
}
|
|
4122
|
-
function
|
|
4123
|
-
return { ...
|
|
4470
|
+
function mapPTableDef(def, cb) {
|
|
4471
|
+
return { ...def, src: mapJoinEntry(def.src, cb) };
|
|
4124
4472
|
}
|
|
4125
|
-
function
|
|
4126
|
-
switch (
|
|
4473
|
+
function mapJoinEntry(entry, cb) {
|
|
4474
|
+
switch (entry.type) {
|
|
4127
4475
|
case "column":
|
|
4128
4476
|
return {
|
|
4129
4477
|
type: "column",
|
|
4130
|
-
column:
|
|
4478
|
+
column: cb(entry.column)
|
|
4131
4479
|
};
|
|
4132
4480
|
case "slicedColumn":
|
|
4133
4481
|
return {
|
|
4134
4482
|
type: "slicedColumn",
|
|
4135
|
-
column:
|
|
4136
|
-
newId:
|
|
4137
|
-
axisFilters:
|
|
4483
|
+
column: cb(entry.column),
|
|
4484
|
+
newId: entry.newId,
|
|
4485
|
+
axisFilters: entry.axisFilters
|
|
4138
4486
|
};
|
|
4487
|
+
case "inlineColumn":
|
|
4488
|
+
return entry;
|
|
4139
4489
|
case "inner":
|
|
4140
4490
|
case "full":
|
|
4141
4491
|
return {
|
|
4142
|
-
type:
|
|
4143
|
-
entries:
|
|
4492
|
+
type: entry.type,
|
|
4493
|
+
entries: entry.entries.map((col) => mapJoinEntry(col, cb))
|
|
4144
4494
|
};
|
|
4145
4495
|
case "outer":
|
|
4146
4496
|
return {
|
|
4147
4497
|
type: "outer",
|
|
4148
|
-
primary:
|
|
4149
|
-
secondary:
|
|
4498
|
+
primary: mapJoinEntry(entry.primary, cb),
|
|
4499
|
+
secondary: entry.secondary.map((col) => mapJoinEntry(col, cb))
|
|
4150
4500
|
};
|
|
4151
4501
|
default:
|
|
4152
|
-
|
|
4502
|
+
assertNever(entry);
|
|
4153
4503
|
}
|
|
4154
4504
|
}
|
|
4155
|
-
function
|
|
4156
|
-
return
|
|
4505
|
+
function stringifyColumnId(id) {
|
|
4506
|
+
return canonicalize(id);
|
|
4157
4507
|
}
|
|
4158
|
-
function
|
|
4159
|
-
return
|
|
4508
|
+
function axisKey(axis) {
|
|
4509
|
+
return canonicalize(getAxisId(axis));
|
|
4160
4510
|
}
|
|
4161
|
-
function
|
|
4162
|
-
return JSON.stringify([
|
|
4511
|
+
function domainKey(key, value) {
|
|
4512
|
+
return JSON.stringify([key, value]);
|
|
4163
4513
|
}
|
|
4164
|
-
class
|
|
4514
|
+
class AnchoredIdDeriver {
|
|
4165
4515
|
/**
|
|
4166
4516
|
* Creates a new anchor context from a set of anchor column specifications
|
|
4167
4517
|
* @param anchors Record of anchor column specifications indexed by anchor ID
|
|
4168
4518
|
*/
|
|
4169
|
-
constructor(
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4519
|
+
constructor(anchors) {
|
|
4520
|
+
__publicField(this, "anchors");
|
|
4521
|
+
__publicField(this, "domains", /* @__PURE__ */ new Map());
|
|
4522
|
+
__publicField(this, "axes", /* @__PURE__ */ new Map());
|
|
4523
|
+
/**
|
|
4524
|
+
* Domain packs are used to group domain keys that can be anchored to the same anchor
|
|
4525
|
+
* This is used to optimize the lookup of domain anchors
|
|
4526
|
+
*/
|
|
4527
|
+
__publicField(this, "domainPacks", []);
|
|
4528
|
+
/**
|
|
4529
|
+
* Maps domain packs to anchors
|
|
4530
|
+
*/
|
|
4531
|
+
__publicField(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
|
|
4532
|
+
this.anchors = anchors;
|
|
4533
|
+
const anchorEntries = Object.entries(anchors);
|
|
4534
|
+
anchorEntries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
4535
|
+
for (const [anchorId, spec] of anchorEntries) {
|
|
4536
|
+
for (let axisIdx = 0; axisIdx < spec.axesSpec.length; axisIdx++) {
|
|
4537
|
+
const axis = spec.axesSpec[axisIdx];
|
|
4538
|
+
const key = axisKey(axis);
|
|
4539
|
+
this.axes.set(key, { anchor: anchorId, idx: axisIdx });
|
|
4181
4540
|
}
|
|
4182
|
-
if (
|
|
4183
|
-
const
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4541
|
+
if (spec.domain !== void 0) {
|
|
4542
|
+
const domainEntries = Object.entries(spec.domain);
|
|
4543
|
+
domainEntries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
4544
|
+
this.domainPackToAnchor.set(JSON.stringify(domainEntries), anchorId);
|
|
4545
|
+
this.domainPacks.push(domainEntries.map(([dKey]) => dKey));
|
|
4546
|
+
for (const [dKey, dValue] of domainEntries) {
|
|
4547
|
+
const key = domainKey(dKey, dValue);
|
|
4548
|
+
this.domains.set(key, anchorId);
|
|
4188
4549
|
}
|
|
4189
4550
|
}
|
|
4190
4551
|
}
|
|
@@ -4192,57 +4553,69 @@
|
|
|
4192
4553
|
/**
|
|
4193
4554
|
* Implementation of derive method
|
|
4194
4555
|
*/
|
|
4195
|
-
derive(
|
|
4196
|
-
const
|
|
4197
|
-
name:
|
|
4556
|
+
derive(spec, axisFilters) {
|
|
4557
|
+
const result = {
|
|
4558
|
+
name: spec.name,
|
|
4198
4559
|
axes: []
|
|
4199
4560
|
};
|
|
4200
|
-
let
|
|
4201
|
-
if (
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
}
|
|
4561
|
+
let skipDomains = void 0;
|
|
4562
|
+
if (spec.domain !== void 0) {
|
|
4563
|
+
outer: for (const domainPack of this.domainPacks) {
|
|
4564
|
+
const dAnchor = [];
|
|
4565
|
+
for (const domainKey2 of domainPack) {
|
|
4566
|
+
const dValue = spec.domain[domainKey2];
|
|
4567
|
+
if (dValue !== void 0)
|
|
4568
|
+
dAnchor.push([domainKey2, dValue]);
|
|
4569
|
+
else
|
|
4570
|
+
break outer;
|
|
4571
|
+
}
|
|
4572
|
+
const domainAnchor = this.domainPackToAnchor.get(JSON.stringify(dAnchor));
|
|
4573
|
+
if (domainAnchor !== void 0) {
|
|
4574
|
+
result.domainAnchor = domainAnchor;
|
|
4575
|
+
skipDomains = new Set(domainPack);
|
|
4576
|
+
break;
|
|
4217
4577
|
}
|
|
4218
|
-
|
|
4219
|
-
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
4580
|
+
for (const [dKey, dValue] of Object.entries(spec.domain ?? {})) {
|
|
4581
|
+
if (skipDomains !== void 0 && skipDomains.has(dKey))
|
|
4220
4582
|
continue;
|
|
4221
|
-
const
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4583
|
+
const key = domainKey(dKey, dValue);
|
|
4584
|
+
const anchorId = this.domains.get(key);
|
|
4585
|
+
result.domain ?? (result.domain = {});
|
|
4586
|
+
result.domain[dKey] = anchorId ? { anchor: anchorId } : dValue;
|
|
4587
|
+
}
|
|
4588
|
+
result.axes = spec.axesSpec.map((axis) => {
|
|
4589
|
+
const key = axisKey(axis);
|
|
4590
|
+
const anchorAxisRef = this.axes.get(key);
|
|
4591
|
+
if (anchorAxisRef === void 0)
|
|
4592
|
+
return getAxisId(axis);
|
|
4593
|
+
else
|
|
4594
|
+
return anchorAxisRef;
|
|
4595
|
+
});
|
|
4596
|
+
if (!axisFilters || axisFilters.length === 0) {
|
|
4597
|
+
return result;
|
|
4598
|
+
}
|
|
4599
|
+
const resolvedFilters = [];
|
|
4600
|
+
for (const filter of axisFilters) {
|
|
4601
|
+
const [axisIdOrIndex, value] = filter;
|
|
4602
|
+
if (typeof axisIdOrIndex === "number") {
|
|
4603
|
+
if (axisIdOrIndex < 0 || axisIdOrIndex >= spec.axesSpec.length) {
|
|
4604
|
+
throw new Error(`Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`);
|
|
4605
|
+
}
|
|
4606
|
+
resolvedFilters.push([axisIdOrIndex, value]);
|
|
4236
4607
|
} else {
|
|
4237
|
-
const
|
|
4238
|
-
if (
|
|
4239
|
-
throw new Error(`Axis with name "${
|
|
4240
|
-
|
|
4608
|
+
const axisIndex = spec.axesSpec.findIndex((axis) => axis.name === axisIdOrIndex);
|
|
4609
|
+
if (axisIndex === -1) {
|
|
4610
|
+
throw new Error(`Axis with name "${axisIdOrIndex}" not found in the column specification`);
|
|
4611
|
+
}
|
|
4612
|
+
resolvedFilters.push([axisIndex, value]);
|
|
4241
4613
|
}
|
|
4242
4614
|
}
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4615
|
+
resolvedFilters.sort((a, b) => a[0] - b[0]);
|
|
4616
|
+
return {
|
|
4617
|
+
source: result,
|
|
4618
|
+
axisFilters: resolvedFilters
|
|
4246
4619
|
};
|
|
4247
4620
|
}
|
|
4248
4621
|
/**
|
|
@@ -4251,446 +4624,580 @@
|
|
|
4251
4624
|
* @param axisFilters Optional axis filters to apply to the column
|
|
4252
4625
|
* @returns A canonicalized string representation of the anchored column identifier
|
|
4253
4626
|
*/
|
|
4254
|
-
deriveS(
|
|
4255
|
-
return
|
|
4256
|
-
}
|
|
4257
|
-
}
|
|
4258
|
-
function
|
|
4259
|
-
const
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
if (!
|
|
4277
|
-
|
|
4278
|
-
|
|
4627
|
+
deriveS(spec, axisFilters) {
|
|
4628
|
+
return stringifyColumnId(this.derive(spec, axisFilters));
|
|
4629
|
+
}
|
|
4630
|
+
}
|
|
4631
|
+
function resolveAnchors(anchors, matcher, options) {
|
|
4632
|
+
const result = { ...matcher };
|
|
4633
|
+
const ignoreMissingDomains = (options == null ? void 0 : options.ignoreMissingDomains) ?? false;
|
|
4634
|
+
if (result.domainAnchor !== void 0) {
|
|
4635
|
+
const anchorSpec = anchors[result.domainAnchor];
|
|
4636
|
+
if (!anchorSpec)
|
|
4637
|
+
throw new Error(`Anchor "${result.domainAnchor}" not found`);
|
|
4638
|
+
const anchorDomains = anchorSpec.domain || {};
|
|
4639
|
+
result.domain = { ...anchorDomains, ...result.domain };
|
|
4640
|
+
delete result.domainAnchor;
|
|
4641
|
+
}
|
|
4642
|
+
if (result.domain) {
|
|
4643
|
+
const resolvedDomain = {};
|
|
4644
|
+
for (const [key, value] of Object.entries(result.domain)) {
|
|
4645
|
+
if (typeof value === "string") {
|
|
4646
|
+
resolvedDomain[key] = value;
|
|
4647
|
+
} else {
|
|
4648
|
+
const anchorSpec = anchors[value.anchor];
|
|
4649
|
+
if (!anchorSpec)
|
|
4650
|
+
throw new Error(`Anchor "${value.anchor}" not found for domain key "${key}"`);
|
|
4651
|
+
if (!anchorSpec.domain || anchorSpec.domain[key] === void 0) {
|
|
4652
|
+
if (!ignoreMissingDomains)
|
|
4653
|
+
throw new Error(`Domain key "${key}" not found in anchor "${value.anchor}"`);
|
|
4279
4654
|
continue;
|
|
4280
4655
|
}
|
|
4281
|
-
|
|
4656
|
+
resolvedDomain[key] = anchorSpec.domain[key];
|
|
4282
4657
|
}
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
if (!
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
return
|
|
4326
|
-
}
|
|
4327
|
-
function
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4658
|
+
}
|
|
4659
|
+
result.domain = resolvedDomain;
|
|
4660
|
+
}
|
|
4661
|
+
if (result.axes)
|
|
4662
|
+
result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));
|
|
4663
|
+
return result;
|
|
4664
|
+
}
|
|
4665
|
+
function resolveAxisReference(anchors, axisRef) {
|
|
4666
|
+
if (!isAnchorAxisRef(axisRef))
|
|
4667
|
+
return axisRef;
|
|
4668
|
+
const anchorId = axisRef.anchor;
|
|
4669
|
+
const anchorSpec = anchors[anchorId];
|
|
4670
|
+
if (!anchorSpec)
|
|
4671
|
+
throw new Error(`Anchor "${anchorId}" not found for axis reference`);
|
|
4672
|
+
if ("idx" in axisRef) {
|
|
4673
|
+
if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)
|
|
4674
|
+
throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor "${anchorId}"`);
|
|
4675
|
+
return anchorSpec.axesSpec[axisRef.idx];
|
|
4676
|
+
} else if ("name" in axisRef) {
|
|
4677
|
+
const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);
|
|
4678
|
+
if (matches.length > 1)
|
|
4679
|
+
throw new Error(`Multiple axes with name "${axisRef.name}" found in anchor "${anchorId}"`);
|
|
4680
|
+
if (matches.length === 0)
|
|
4681
|
+
throw new Error(`Axis with name "${axisRef.name}" not found in anchor "${anchorId}"`);
|
|
4682
|
+
return matches[0];
|
|
4683
|
+
} else if ("id" in axisRef) {
|
|
4684
|
+
const matches = anchorSpec.axesSpec.filter((axis) => matchAxisId(axisRef.id, getAxisId(axis)));
|
|
4685
|
+
if (matches.length > 1)
|
|
4686
|
+
throw new Error(`Multiple matching axes found for matcher in anchor "${anchorId}"`);
|
|
4687
|
+
if (matches.length === 0)
|
|
4688
|
+
throw new Error(`No matching axis found for matcher in anchor "${anchorId}"`);
|
|
4689
|
+
return matches[0];
|
|
4690
|
+
}
|
|
4691
|
+
throw new Error(`Unsupported axis reference type`);
|
|
4692
|
+
}
|
|
4693
|
+
function isAnchorAxisRef(value) {
|
|
4694
|
+
return typeof value === "object" && "anchor" in value;
|
|
4695
|
+
}
|
|
4696
|
+
function isPColumnSpec(spec) {
|
|
4697
|
+
return spec.kind === "PColumn";
|
|
4698
|
+
}
|
|
4699
|
+
function isPColumn(obj) {
|
|
4700
|
+
return isPColumnSpec(obj.spec);
|
|
4701
|
+
}
|
|
4702
|
+
function ensurePColumn(obj) {
|
|
4703
|
+
if (!isPColumn(obj))
|
|
4704
|
+
throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);
|
|
4705
|
+
return obj;
|
|
4706
|
+
}
|
|
4707
|
+
function mapPObjectData(pObj, cb) {
|
|
4708
|
+
return pObj === void 0 ? void 0 : {
|
|
4709
|
+
...pObj,
|
|
4710
|
+
data: cb(pObj.data)
|
|
4331
4711
|
};
|
|
4332
4712
|
}
|
|
4333
|
-
function
|
|
4334
|
-
const
|
|
4335
|
-
|
|
4713
|
+
function extractAllColumns(entry) {
|
|
4714
|
+
const columns = /* @__PURE__ */ new Map();
|
|
4715
|
+
const addAllColumns = (entry2) => {
|
|
4716
|
+
switch (entry2.type) {
|
|
4336
4717
|
case "column":
|
|
4337
|
-
|
|
4718
|
+
columns.set(entry2.column.id, entry2.column);
|
|
4338
4719
|
return;
|
|
4339
4720
|
case "slicedColumn":
|
|
4340
|
-
|
|
4721
|
+
columns.set(entry2.column.id, entry2.column);
|
|
4722
|
+
return;
|
|
4723
|
+
case "inlineColumn":
|
|
4341
4724
|
return;
|
|
4342
4725
|
case "full":
|
|
4343
4726
|
case "inner":
|
|
4344
|
-
for (const
|
|
4727
|
+
for (const e of entry2.entries)
|
|
4728
|
+
addAllColumns(e);
|
|
4345
4729
|
return;
|
|
4346
4730
|
case "outer":
|
|
4347
|
-
|
|
4348
|
-
for (const
|
|
4731
|
+
addAllColumns(entry2.primary);
|
|
4732
|
+
for (const e of entry2.secondary)
|
|
4733
|
+
addAllColumns(e);
|
|
4349
4734
|
return;
|
|
4350
4735
|
default:
|
|
4351
|
-
|
|
4736
|
+
assertNever(entry2);
|
|
4352
4737
|
}
|
|
4353
4738
|
};
|
|
4354
|
-
|
|
4739
|
+
addAllColumns(entry);
|
|
4740
|
+
return [...columns.values()];
|
|
4355
4741
|
}
|
|
4356
|
-
function
|
|
4357
|
-
if (
|
|
4742
|
+
function matchAxis(selector, axis) {
|
|
4743
|
+
if (selector.name !== void 0 && selector.name !== axis.name)
|
|
4358
4744
|
return false;
|
|
4359
|
-
if (
|
|
4360
|
-
if (Array.isArray(
|
|
4361
|
-
if (!
|
|
4745
|
+
if (selector.type !== void 0) {
|
|
4746
|
+
if (Array.isArray(selector.type)) {
|
|
4747
|
+
if (!selector.type.includes(axis.type))
|
|
4362
4748
|
return false;
|
|
4363
|
-
} else if (
|
|
4749
|
+
} else if (selector.type !== axis.type) {
|
|
4364
4750
|
return false;
|
|
4751
|
+
}
|
|
4365
4752
|
}
|
|
4366
|
-
if (
|
|
4367
|
-
const
|
|
4368
|
-
for (const [
|
|
4369
|
-
if (
|
|
4753
|
+
if (selector.domain !== void 0) {
|
|
4754
|
+
const axisDomain = axis.domain || {};
|
|
4755
|
+
for (const [key, value] of Object.entries(selector.domain))
|
|
4756
|
+
if (axisDomain[key] !== value)
|
|
4370
4757
|
return false;
|
|
4371
4758
|
}
|
|
4372
4759
|
return true;
|
|
4373
4760
|
}
|
|
4374
|
-
function
|
|
4375
|
-
if (
|
|
4761
|
+
function matchPColumn(pcolumn, selector) {
|
|
4762
|
+
if (selector.name !== void 0 && pcolumn.name !== selector.name)
|
|
4376
4763
|
return false;
|
|
4377
|
-
if (
|
|
4378
|
-
|
|
4379
|
-
|
|
4764
|
+
if (selector.namePattern !== void 0 && !new RegExp(selector.namePattern).test(pcolumn.name))
|
|
4765
|
+
return false;
|
|
4766
|
+
if (selector.type !== void 0) {
|
|
4767
|
+
if (Array.isArray(selector.type)) {
|
|
4768
|
+
if (!selector.type.includes(pcolumn.valueType))
|
|
4380
4769
|
return false;
|
|
4381
|
-
} else if (
|
|
4770
|
+
} else if (selector.type !== pcolumn.valueType) {
|
|
4382
4771
|
return false;
|
|
4772
|
+
}
|
|
4383
4773
|
}
|
|
4384
|
-
if (
|
|
4385
|
-
const
|
|
4386
|
-
for (const [
|
|
4387
|
-
if (
|
|
4774
|
+
if (selector.domain !== void 0) {
|
|
4775
|
+
const columnDomain = pcolumn.domain || {};
|
|
4776
|
+
for (const [key, value] of Object.entries(selector.domain))
|
|
4777
|
+
if (columnDomain[key] !== value)
|
|
4388
4778
|
return false;
|
|
4389
4779
|
}
|
|
4390
|
-
if (
|
|
4391
|
-
const
|
|
4392
|
-
if (
|
|
4393
|
-
for (const
|
|
4394
|
-
if (!
|
|
4780
|
+
if (selector.axes !== void 0) {
|
|
4781
|
+
const pcolumnAxes = pcolumn.axesSpec.map(getAxisId);
|
|
4782
|
+
if (selector.partialAxesMatch) {
|
|
4783
|
+
for (const selectorAxis of selector.axes)
|
|
4784
|
+
if (!pcolumnAxes.some((columnAxis) => matchAxis(selectorAxis, columnAxis)))
|
|
4395
4785
|
return false;
|
|
4396
4786
|
} else {
|
|
4397
|
-
if (
|
|
4787
|
+
if (pcolumnAxes.length !== selector.axes.length)
|
|
4398
4788
|
return false;
|
|
4399
|
-
for (let
|
|
4400
|
-
if (!
|
|
4789
|
+
for (let i = 0; i < selector.axes.length; i++)
|
|
4790
|
+
if (!matchAxis(selector.axes[i], pcolumnAxes[i]))
|
|
4401
4791
|
return false;
|
|
4402
4792
|
}
|
|
4403
4793
|
}
|
|
4404
|
-
if (
|
|
4405
|
-
const
|
|
4406
|
-
for (const [
|
|
4407
|
-
if (
|
|
4794
|
+
if (selector.annotations !== void 0) {
|
|
4795
|
+
const columnAnnotations = pcolumn.annotations || {};
|
|
4796
|
+
for (const [key, value] of Object.entries(selector.annotations))
|
|
4797
|
+
if (columnAnnotations[key] !== value)
|
|
4408
4798
|
return false;
|
|
4409
4799
|
}
|
|
4410
|
-
if (
|
|
4411
|
-
const
|
|
4412
|
-
for (const [
|
|
4413
|
-
const
|
|
4414
|
-
if (
|
|
4800
|
+
if (selector.annotationPatterns !== void 0) {
|
|
4801
|
+
const columnAnnotations = pcolumn.annotations || {};
|
|
4802
|
+
for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {
|
|
4803
|
+
const value = columnAnnotations[key];
|
|
4804
|
+
if (value === void 0 || !new RegExp(pattern).test(value))
|
|
4415
4805
|
return false;
|
|
4416
4806
|
}
|
|
4417
4807
|
}
|
|
4418
4808
|
return true;
|
|
4419
4809
|
}
|
|
4420
|
-
function
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
blockId: z$1.string().describe("Upstream block id"),
|
|
4426
|
-
name: z$1.string().describe("Name of the output provided to the upstream block's output context")
|
|
4427
|
-
}).describe(
|
|
4428
|
-
"Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees."
|
|
4429
|
-
).strict().readonly();
|
|
4430
|
-
function Tn(n2) {
|
|
4431
|
-
return typeof n2 == "object" && n2 !== null && "__isRef" in n2 && n2.__isRef === true && "blockId" in n2 && "name" in n2;
|
|
4432
|
-
}
|
|
4433
|
-
function _n$1(n2, t) {
|
|
4434
|
-
return n2.ok ? { ok: true, value: t(n2.value) } : n2;
|
|
4810
|
+
function selectorsToPredicate(predicateOrSelectors) {
|
|
4811
|
+
if (Array.isArray(predicateOrSelectors))
|
|
4812
|
+
return (spec) => predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));
|
|
4813
|
+
else
|
|
4814
|
+
return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);
|
|
4435
4815
|
}
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
(function(module2, exports3) {
|
|
4447
|
-
exports3 = module2.exports = stringify2;
|
|
4448
|
-
exports3.getSerialize = serializer;
|
|
4449
|
-
function stringify2(obj, replacer, spaces, cycleReplacer) {
|
|
4450
|
-
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
|
|
4451
|
-
}
|
|
4452
|
-
function serializer(replacer, cycleReplacer) {
|
|
4453
|
-
var stack = [], keys = [];
|
|
4454
|
-
if (cycleReplacer == null) cycleReplacer = function(key, value) {
|
|
4455
|
-
if (stack[0] === value) return "[Circular ~]";
|
|
4456
|
-
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
4457
|
-
};
|
|
4458
|
-
return function(key, value) {
|
|
4459
|
-
if (stack.length > 0) {
|
|
4460
|
-
var thisPos = stack.indexOf(this);
|
|
4461
|
-
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
4462
|
-
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
4463
|
-
if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value);
|
|
4464
|
-
} else stack.push(value);
|
|
4465
|
-
return replacer == null ? value : replacer.call(this, key, value);
|
|
4466
|
-
};
|
|
4467
|
-
}
|
|
4468
|
-
})(stringify, stringify.exports);
|
|
4469
|
-
return stringify.exports;
|
|
4816
|
+
function deriveNativeId(spec) {
|
|
4817
|
+
const result = {
|
|
4818
|
+
kind: spec.kind,
|
|
4819
|
+
name: spec.name
|
|
4820
|
+
};
|
|
4821
|
+
if (spec.domain !== void 0)
|
|
4822
|
+
result.domain = spec.domain;
|
|
4823
|
+
if (isPColumnSpec(spec))
|
|
4824
|
+
result.axesSpec = getAxesId(spec.axesSpec);
|
|
4825
|
+
return canonicalize(result);
|
|
4470
4826
|
}
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
/** The message with all details needed for SDK developers. */
|
|
4477
|
-
fullMessage: z$1.string().optional(),
|
|
4478
|
-
stack: z$1.string().optional()
|
|
4479
|
-
}), c = l.extend({
|
|
4480
|
-
cause: z$1.lazy(() => s).optional(),
|
|
4481
|
-
errors: z$1.lazy(() => s.array()).optional()
|
|
4482
|
-
}), m$1 = z$1.object({
|
|
4483
|
-
type: z$1.literal("StandardError"),
|
|
4484
|
-
name: z$1.string(),
|
|
4485
|
-
message: z$1.string(),
|
|
4486
|
-
stack: z$1.string().optional()
|
|
4487
|
-
}), p = m$1.extend({
|
|
4488
|
-
cause: z$1.lazy(() => s).optional(),
|
|
4489
|
-
errors: z$1.lazy(() => s.array()).optional()
|
|
4490
|
-
}), s = z$1.union([p, c]);
|
|
4491
|
-
const u = z$1.object({
|
|
4492
|
-
name: z$1.string(),
|
|
4493
|
-
message: z$1.string(),
|
|
4494
|
-
fullMessage: z$1.string().optional(),
|
|
4495
|
-
stack: z$1.string().optional()
|
|
4496
|
-
}), n = u.extend({
|
|
4497
|
-
cause: z$1.lazy(() => n).optional(),
|
|
4498
|
-
errors: z$1.lazy(() => n.array()).optional()
|
|
4499
|
-
});
|
|
4500
|
-
var Ue = Object.defineProperty;
|
|
4501
|
-
var Me = (t, e, n2) => e in t ? Ue(t, e, { enumerable: true, configurable: true, writable: true, value: n2 }) : t[e] = n2;
|
|
4502
|
-
var L = (t, e, n2) => Me(t, typeof e != "symbol" ? e + "" : e, n2);
|
|
4503
|
-
function Z(t) {
|
|
4504
|
-
return { type: "Immediate", value: t };
|
|
4505
|
-
}
|
|
4506
|
-
function it() {
|
|
4507
|
-
return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
|
|
4508
|
-
}
|
|
4509
|
-
function Te(t) {
|
|
4510
|
-
if (t && typeof globalThis.getPlatforma == "function")
|
|
4511
|
-
return globalThis.getPlatforma(t);
|
|
4512
|
-
if (typeof globalThis.platforma < "u") return globalThis.platforma;
|
|
4513
|
-
throw new Error("Can't get platforma instance.");
|
|
4514
|
-
}
|
|
4515
|
-
function st() {
|
|
4516
|
-
if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
|
|
4517
|
-
}
|
|
4518
|
-
function m() {
|
|
4519
|
-
if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
|
|
4520
|
-
throw new Error("Not in config rendering context");
|
|
4521
|
-
}
|
|
4522
|
-
function Y(t, e) {
|
|
4523
|
-
const n2 = st();
|
|
4524
|
-
if (n2 === void 0) return false;
|
|
4525
|
-
if (t in n2.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
|
|
4526
|
-
return n2.callbackRegistry[t] = e, true;
|
|
4527
|
-
}
|
|
4528
|
-
const ae = /* @__PURE__ */ new Map();
|
|
4529
|
-
function ot(t, e) {
|
|
4530
|
-
t in m().callbackRegistry || (m().callbackRegistry[t] = (n2) => {
|
|
4531
|
-
for (const r of ae.get(t))
|
|
4532
|
-
r(n2);
|
|
4533
|
-
}, ae.set(t, [])), ae.get(t).push(e);
|
|
4534
|
-
}
|
|
4535
|
-
class S {
|
|
4536
|
-
constructor(e, n2 = (r) => r) {
|
|
4537
|
-
L(this, "isResolved", false);
|
|
4538
|
-
L(this, "resolvedValue");
|
|
4539
|
-
this.handle = e, this.postProcess = n2, ot(e, (r) => {
|
|
4540
|
-
this.resolvedValue = n2(r), this.isResolved = true;
|
|
4541
|
-
});
|
|
4827
|
+
class LinkerMap {
|
|
4828
|
+
constructor(linkerMap) {
|
|
4829
|
+
/** Graph of linkers connected by axes (single or grouped by parents) */
|
|
4830
|
+
__publicField(this, "data");
|
|
4831
|
+
this.data = linkerMap;
|
|
4542
4832
|
}
|
|
4543
|
-
|
|
4544
|
-
return
|
|
4833
|
+
get keys() {
|
|
4834
|
+
return this.data.keys();
|
|
4545
4835
|
}
|
|
4546
|
-
|
|
4547
|
-
return
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4836
|
+
get keyAxesIds() {
|
|
4837
|
+
return [...this.data.keys()].map(parseJson);
|
|
4838
|
+
}
|
|
4839
|
+
static fromColumns(columns) {
|
|
4840
|
+
var _a, _b;
|
|
4841
|
+
const result = /* @__PURE__ */ new Map();
|
|
4842
|
+
for (const linker of columns.filter((l) => !!readAnnotationJson(l.spec, Annotation.IsLinkerColumn))) {
|
|
4843
|
+
const groups = LinkerMap.getAxesGroups(getNormalizedAxesList(linker.spec.axesSpec));
|
|
4844
|
+
if (groups.length !== 2) {
|
|
4845
|
+
continue;
|
|
4846
|
+
}
|
|
4847
|
+
const [left, right] = groups;
|
|
4848
|
+
const leftKeyVariants = LinkerMap.getAxesRoots(left).map((axis) => {
|
|
4849
|
+
const axes = getArrayFromAxisTree(getAxesTree(axis));
|
|
4850
|
+
const key = canonicalizeJson(axes.map(getAxisId));
|
|
4851
|
+
return [key, axes];
|
|
4852
|
+
});
|
|
4853
|
+
const rightKeyVariants = LinkerMap.getAxesRoots(right).map((axis) => {
|
|
4854
|
+
const axes = getArrayFromAxisTree(getAxesTree(axis));
|
|
4855
|
+
const key = canonicalizeJson(axes.map(getAxisId));
|
|
4856
|
+
return [key, axes];
|
|
4857
|
+
});
|
|
4858
|
+
for (const [keyLeft, spec] of leftKeyVariants) {
|
|
4859
|
+
if (!result.has(keyLeft)) {
|
|
4860
|
+
result.set(keyLeft, { keyAxesSpec: spec, linkWith: /* @__PURE__ */ new Map() });
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
for (const [keyRight, spec] of rightKeyVariants) {
|
|
4864
|
+
if (!result.has(keyRight)) {
|
|
4865
|
+
result.set(keyRight, { keyAxesSpec: spec, linkWith: /* @__PURE__ */ new Map() });
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
for (const [keyLeft] of leftKeyVariants) {
|
|
4869
|
+
for (const [keyRight] of rightKeyVariants) {
|
|
4870
|
+
(_a = result.get(keyLeft)) == null ? void 0 : _a.linkWith.set(keyRight, linker);
|
|
4871
|
+
(_b = result.get(keyRight)) == null ? void 0 : _b.linkWith.set(keyLeft, linker);
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
4875
|
+
return new this(result);
|
|
4876
|
+
}
|
|
4877
|
+
/** Get all available nodes of linker graphs if start from sourceAxesKeys */
|
|
4878
|
+
searchAvailableAxesKeys(sourceAxesKeys) {
|
|
4879
|
+
const startKeys = new Set(sourceAxesKeys);
|
|
4880
|
+
const allAvailableKeys = /* @__PURE__ */ new Set();
|
|
4881
|
+
let nextKeys = sourceAxesKeys;
|
|
4882
|
+
while (nextKeys.length) {
|
|
4883
|
+
const next = [];
|
|
4884
|
+
for (const key of nextKeys) {
|
|
4885
|
+
const node = this.data.get(key);
|
|
4886
|
+
if (!node)
|
|
4887
|
+
continue;
|
|
4888
|
+
for (const availableKey of node.linkWith.keys()) {
|
|
4889
|
+
if (!allAvailableKeys.has(availableKey) && !startKeys.has(availableKey)) {
|
|
4890
|
+
next.push(availableKey);
|
|
4891
|
+
allAvailableKeys.add(availableKey);
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
}
|
|
4895
|
+
nextKeys = next;
|
|
4896
|
+
}
|
|
4897
|
+
return allAvailableKeys;
|
|
4898
|
+
}
|
|
4899
|
+
/** Get all linker columns that are necessary to reach endKey from startKey */
|
|
4900
|
+
searchLinkerPath(startKey, endKey) {
|
|
4901
|
+
const previous = {};
|
|
4902
|
+
let nextIds = /* @__PURE__ */ new Set([startKey]);
|
|
4903
|
+
const visited = /* @__PURE__ */ new Set([startKey]);
|
|
4904
|
+
while (nextIds.size) {
|
|
4905
|
+
const next = /* @__PURE__ */ new Set();
|
|
4906
|
+
for (const nextId of nextIds) {
|
|
4907
|
+
const node = this.data.get(nextId);
|
|
4908
|
+
if (!node)
|
|
4909
|
+
continue;
|
|
4910
|
+
for (const availableId of node.linkWith.keys()) {
|
|
4911
|
+
previous[availableId] = nextId;
|
|
4912
|
+
if (availableId === endKey) {
|
|
4913
|
+
const ids = [];
|
|
4914
|
+
let current = endKey;
|
|
4915
|
+
while (previous[current] !== startKey) {
|
|
4916
|
+
ids.push(current);
|
|
4917
|
+
current = previous[current];
|
|
4918
|
+
}
|
|
4919
|
+
ids.push(current);
|
|
4920
|
+
return ids.map((id) => this.data.get(id).linkWith.get(previous[id]));
|
|
4921
|
+
} else if (!visited.has(availableId)) {
|
|
4922
|
+
next.add(availableId);
|
|
4923
|
+
visited.add(availableId);
|
|
4924
|
+
}
|
|
4925
|
+
}
|
|
4926
|
+
}
|
|
4927
|
+
nextIds = next;
|
|
4928
|
+
}
|
|
4929
|
+
return [];
|
|
4930
|
+
}
|
|
4931
|
+
getLinkerColumnsForAxes({ from: sourceAxes, to: targetAxes, throwWhenNoLinkExists = true }) {
|
|
4932
|
+
const startKeys = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);
|
|
4933
|
+
return Array.from(new Map(LinkerMap.getAxesRoots(targetAxes).map(LinkerMap.getLinkerKeyFromAxisSpec).flatMap((targetKey) => {
|
|
4934
|
+
const linkers = startKeys.map((startKey) => this.searchLinkerPath(startKey, targetKey)).reduce((shortestPath, path) => shortestPath.length && shortestPath.length < path.length || !path.length ? shortestPath : path, []).map((linker) => [linker.columnId, linker]);
|
|
4935
|
+
if (!linkers.length && throwWhenNoLinkExists) {
|
|
4936
|
+
throw Error(`Unable to find linker column for ${targetKey}`);
|
|
4937
|
+
}
|
|
4938
|
+
return linkers;
|
|
4939
|
+
})).values());
|
|
4940
|
+
}
|
|
4941
|
+
/** Get list of axisSpecs from keys of linker columns map */
|
|
4942
|
+
getAxesListFromKeysList(keys) {
|
|
4943
|
+
return Array.from(new Map(keys.flatMap((key) => {
|
|
4944
|
+
var _a;
|
|
4945
|
+
return ((_a = this.data.get(key)) == null ? void 0 : _a.keyAxesSpec) ?? [];
|
|
4946
|
+
}).map((axis) => [canonicalizeJson(getAxisId(axis)), axis])).values());
|
|
4947
|
+
}
|
|
4948
|
+
/** Get axes of target axes that are impossible to be linked to source axes with current linker map */
|
|
4949
|
+
getNonLinkableAxes(sourceAxes, targetAxes) {
|
|
4950
|
+
const startKeys = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);
|
|
4951
|
+
const targetKeys = targetAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);
|
|
4952
|
+
const axes = Array.from(new Map(targetAxes.filter((_targetAxis, idx) => {
|
|
4953
|
+
const targetKey = targetKeys[idx];
|
|
4954
|
+
return !startKeys.some((startKey) => this.searchLinkerPath(startKey, targetKey).length);
|
|
4955
|
+
}).flatMap((axis) => getArrayFromAxisTree(getAxesTree(axis)).map((axis2) => [canonicalizeJson(getAxisId(axis2)), axis2]))).values());
|
|
4956
|
+
return axes;
|
|
4957
|
+
}
|
|
4958
|
+
/** Get all axes that can be connected to sourceAxes by linkers */
|
|
4959
|
+
getReachableByLinkersAxesFromAxes(sourceAxes) {
|
|
4960
|
+
const startKeys = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);
|
|
4961
|
+
const availableKeys = this.searchAvailableAxesKeys(startKeys);
|
|
4962
|
+
return this.getAxesListFromKeysList([...availableKeys]);
|
|
4963
|
+
}
|
|
4964
|
+
static getLinkerKeyFromAxisSpec(axis) {
|
|
4965
|
+
return canonicalizeJson(getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));
|
|
4966
|
+
}
|
|
4967
|
+
/** Split array of axes into several arrays by parents: axes of one group are parents for each other.
|
|
4968
|
+
There are no order inside every group. */
|
|
4969
|
+
static getAxesGroups(axesSpec) {
|
|
4970
|
+
switch (axesSpec.length) {
|
|
4971
|
+
case 0:
|
|
4972
|
+
return [];
|
|
4973
|
+
case 1:
|
|
4974
|
+
return [[axesSpec[0]]];
|
|
4975
|
+
}
|
|
4976
|
+
const axisKeys = axesSpec.map((spec) => canonicalizeJson(getAxisId(spec)));
|
|
4977
|
+
const axisParentsIdxs = axesSpec.map((spec) => new Set(spec.parentAxesSpec.map((spec2) => canonicalizeJson(getAxisId(spec2))).map((el) => {
|
|
4978
|
+
const idx = axisKeys.indexOf(el);
|
|
4979
|
+
if (idx === -1) {
|
|
4980
|
+
throw new Error(`malformed axesSpec: ${JSON.stringify(axesSpec)}, unable to locate parent ${el}`);
|
|
4981
|
+
}
|
|
4982
|
+
return idx;
|
|
4983
|
+
})));
|
|
4984
|
+
const allIdxs = [...axesSpec.keys()];
|
|
4985
|
+
const groups = [];
|
|
4986
|
+
const usedIdxs = /* @__PURE__ */ new Set();
|
|
4987
|
+
let nextFreeEl = allIdxs.find((idx) => !usedIdxs.has(idx));
|
|
4988
|
+
while (nextFreeEl !== void 0) {
|
|
4989
|
+
const currentGroup = [nextFreeEl];
|
|
4990
|
+
usedIdxs.add(nextFreeEl);
|
|
4991
|
+
let nextElsOfCurrentGroup = [nextFreeEl];
|
|
4992
|
+
while (nextElsOfCurrentGroup.length) {
|
|
4993
|
+
const next = /* @__PURE__ */ new Set();
|
|
4994
|
+
for (const groupIdx of nextElsOfCurrentGroup) {
|
|
4995
|
+
const groupElementParents = axisParentsIdxs[groupIdx];
|
|
4996
|
+
allIdxs.forEach((idx) => {
|
|
4997
|
+
if (idx === groupIdx || usedIdxs.has(idx)) {
|
|
4998
|
+
return;
|
|
4999
|
+
}
|
|
5000
|
+
const parents = axisParentsIdxs[idx];
|
|
5001
|
+
if (parents.has(groupIdx) || groupElementParents.has(idx)) {
|
|
5002
|
+
currentGroup.push(idx);
|
|
5003
|
+
next.add(idx);
|
|
5004
|
+
usedIdxs.add(idx);
|
|
5005
|
+
}
|
|
5006
|
+
});
|
|
5007
|
+
}
|
|
5008
|
+
nextElsOfCurrentGroup = [...next];
|
|
5009
|
+
}
|
|
5010
|
+
groups.push([...currentGroup]);
|
|
5011
|
+
nextFreeEl = allIdxs.find((idx) => !usedIdxs.has(idx));
|
|
5012
|
+
}
|
|
5013
|
+
return groups.map((group) => group.map((idx) => axesSpec[idx]));
|
|
5014
|
+
}
|
|
5015
|
+
/** Get all axes that are not parents of any other axis */
|
|
5016
|
+
static getAxesRoots(axes) {
|
|
5017
|
+
const parentsSet = new Set(axes.flatMap((axis) => axis.parentAxesSpec).map((spec) => canonicalizeJson(getAxisId(spec))));
|
|
5018
|
+
return axes.filter((axis) => !parentsSet.has(canonicalizeJson(getAxisId(axis))));
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
const PlIdLength = 24;
|
|
5022
|
+
z.string().length(PlIdLength).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
|
|
5023
|
+
z.object({
|
|
5024
|
+
__isRef: z.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
|
|
5025
|
+
blockId: z.string().describe("Upstream block id"),
|
|
5026
|
+
name: z.string().describe("Name of the output provided to the upstream block's output context"),
|
|
5027
|
+
requireEnrichments: z.literal(true).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")
|
|
5028
|
+
}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();
|
|
5029
|
+
function isPlRef(value) {
|
|
5030
|
+
return typeof value === "object" && value !== null && "__isRef" in value && value.__isRef === true && "blockId" in value && "name" in value;
|
|
5031
|
+
}
|
|
5032
|
+
function withEnrichments(ref, requireEnrichments = true) {
|
|
5033
|
+
if (requireEnrichments)
|
|
5034
|
+
return {
|
|
5035
|
+
...ref,
|
|
5036
|
+
requireEnrichments: true
|
|
5037
|
+
};
|
|
5038
|
+
else {
|
|
5039
|
+
const { requireEnrichments: _, ...rest } = ref;
|
|
5040
|
+
return rest;
|
|
5041
|
+
}
|
|
5042
|
+
}
|
|
5043
|
+
function mapValueInVOE(voe, cb) {
|
|
5044
|
+
return voe.ok ? { ok: true, value: cb(voe.value) } : voe;
|
|
5045
|
+
}
|
|
5046
|
+
class FutureRef {
|
|
5047
|
+
constructor(handle, postProcess = (v) => v) {
|
|
5048
|
+
__publicField(this, "handle");
|
|
5049
|
+
__publicField(this, "postProcess");
|
|
5050
|
+
__publicField(this, "isResolved", false);
|
|
5051
|
+
__publicField(this, "resolvedValue");
|
|
5052
|
+
this.handle = handle;
|
|
5053
|
+
this.postProcess = postProcess;
|
|
5054
|
+
registerFutureAwait(handle, (value) => {
|
|
5055
|
+
this.resolvedValue = postProcess(value);
|
|
5056
|
+
this.isResolved = true;
|
|
5057
|
+
});
|
|
5058
|
+
}
|
|
5059
|
+
map(mapping) {
|
|
5060
|
+
return new FutureRef(this.handle, (v) => mapping(this.postProcess(v)));
|
|
5061
|
+
}
|
|
5062
|
+
mapDefined(mapping) {
|
|
5063
|
+
return new FutureRef(this.handle, (v) => {
|
|
5064
|
+
const vv = this.postProcess(v);
|
|
5065
|
+
return vv ? mapping(vv) : void 0;
|
|
5066
|
+
});
|
|
4551
5067
|
}
|
|
4552
5068
|
toJSON() {
|
|
4553
5069
|
return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
|
|
4554
5070
|
}
|
|
4555
5071
|
}
|
|
4556
|
-
function
|
|
4557
|
-
return
|
|
5072
|
+
function ifDef(value, cb) {
|
|
5073
|
+
return value === void 0 ? void 0 : cb(value);
|
|
4558
5074
|
}
|
|
4559
|
-
class
|
|
4560
|
-
constructor(
|
|
4561
|
-
this
|
|
5075
|
+
class TreeNodeAccessor {
|
|
5076
|
+
constructor(handle, resolvePath) {
|
|
5077
|
+
__publicField(this, "handle");
|
|
5078
|
+
__publicField(this, "resolvePath");
|
|
5079
|
+
this.handle = handle;
|
|
5080
|
+
this.resolvePath = resolvePath;
|
|
4562
5081
|
}
|
|
4563
|
-
resolve(...
|
|
4564
|
-
const
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
);
|
|
4570
|
-
return this.resolveWithCommon({}, ...n2);
|
|
4571
|
-
}
|
|
4572
|
-
resolveOutput(...e) {
|
|
4573
|
-
const n2 = e.map(
|
|
4574
|
-
(r) => ({
|
|
4575
|
-
assertFieldType: "Output",
|
|
4576
|
-
...typeof r == "string" ? { field: r } : r
|
|
4577
|
-
})
|
|
4578
|
-
);
|
|
4579
|
-
return this.resolveWithCommon({}, ...n2);
|
|
4580
|
-
}
|
|
4581
|
-
resolveInput(...e) {
|
|
4582
|
-
const n2 = e.map(
|
|
4583
|
-
(r) => ({
|
|
4584
|
-
assertFieldType: "Input",
|
|
4585
|
-
...typeof r == "string" ? { field: r } : r
|
|
4586
|
-
})
|
|
4587
|
-
);
|
|
4588
|
-
return this.resolveWithCommon({}, ...n2);
|
|
5082
|
+
resolve(...steps) {
|
|
5083
|
+
const transformedSteps = steps.map((s) => ({
|
|
5084
|
+
assertFieldType: "Input",
|
|
5085
|
+
...typeof s === "string" ? { field: s } : s
|
|
5086
|
+
}));
|
|
5087
|
+
return this.resolveWithCommon({}, ...transformedSteps);
|
|
4589
5088
|
}
|
|
4590
|
-
|
|
4591
|
-
|
|
5089
|
+
resolveOutput(...steps) {
|
|
5090
|
+
const transformedSteps = steps.map((s) => ({
|
|
5091
|
+
assertFieldType: "Output",
|
|
5092
|
+
...typeof s === "string" ? { field: s } : s
|
|
5093
|
+
}));
|
|
5094
|
+
return this.resolveWithCommon({}, ...transformedSteps);
|
|
4592
5095
|
}
|
|
4593
|
-
|
|
4594
|
-
const
|
|
5096
|
+
resolveInput(...steps) {
|
|
5097
|
+
const transformedSteps = steps.map((s) => ({
|
|
5098
|
+
assertFieldType: "Input",
|
|
5099
|
+
...typeof s === "string" ? { field: s } : s
|
|
5100
|
+
}));
|
|
5101
|
+
return this.resolveWithCommon({}, ...transformedSteps);
|
|
5102
|
+
}
|
|
5103
|
+
resolveAny(...steps) {
|
|
5104
|
+
return this.resolveWithCommon({}, ...steps);
|
|
5105
|
+
}
|
|
5106
|
+
resolveWithCommon(commonOptions, ...steps) {
|
|
5107
|
+
const resolvePath = [
|
|
4595
5108
|
...this.resolvePath,
|
|
4596
|
-
...
|
|
5109
|
+
...steps.map((step) => typeof step === "string" ? step : step.field)
|
|
4597
5110
|
];
|
|
4598
|
-
return
|
|
4599
|
-
m().resolveWithCommon(this.handle, e, ...n2),
|
|
4600
|
-
(i) => new I(i, r)
|
|
4601
|
-
);
|
|
5111
|
+
return ifDef(getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps), (accessor) => new TreeNodeAccessor(accessor, resolvePath));
|
|
4602
5112
|
}
|
|
4603
5113
|
get resourceType() {
|
|
4604
|
-
return
|
|
5114
|
+
return getCfgRenderCtx().getResourceType(this.handle);
|
|
4605
5115
|
}
|
|
4606
5116
|
getInputsLocked() {
|
|
4607
|
-
return
|
|
5117
|
+
return getCfgRenderCtx().getInputsLocked(this.handle);
|
|
4608
5118
|
}
|
|
4609
5119
|
getOutputsLocked() {
|
|
4610
|
-
return
|
|
5120
|
+
return getCfgRenderCtx().getOutputsLocked(this.handle);
|
|
4611
5121
|
}
|
|
4612
5122
|
getIsReadyOrError() {
|
|
4613
|
-
return
|
|
5123
|
+
return getCfgRenderCtx().getIsReadyOrError(this.handle);
|
|
4614
5124
|
}
|
|
4615
5125
|
getIsFinal() {
|
|
4616
|
-
return
|
|
5126
|
+
return getCfgRenderCtx().getIsFinal(this.handle);
|
|
4617
5127
|
}
|
|
4618
5128
|
getError() {
|
|
4619
|
-
const
|
|
4620
|
-
return
|
|
4621
|
-
m().getError(this.handle),
|
|
4622
|
-
(n2) => new I(n2, e)
|
|
4623
|
-
);
|
|
5129
|
+
const resolvePath = [...this.resolvePath, "error"];
|
|
5130
|
+
return ifDef(getCfgRenderCtx().getError(this.handle), (accsessor) => new TreeNodeAccessor(accsessor, resolvePath));
|
|
4624
5131
|
}
|
|
4625
5132
|
listInputFields() {
|
|
4626
|
-
return
|
|
5133
|
+
return getCfgRenderCtx().listInputFields(this.handle);
|
|
4627
5134
|
}
|
|
4628
5135
|
listOutputFields() {
|
|
4629
|
-
return
|
|
5136
|
+
return getCfgRenderCtx().listOutputFields(this.handle);
|
|
4630
5137
|
}
|
|
4631
5138
|
listDynamicFields() {
|
|
4632
|
-
return
|
|
5139
|
+
return getCfgRenderCtx().listDynamicFields(this.handle);
|
|
4633
5140
|
}
|
|
4634
|
-
getKeyValueBase64(
|
|
4635
|
-
return
|
|
5141
|
+
getKeyValueBase64(key) {
|
|
5142
|
+
return getCfgRenderCtx().getKeyValueBase64(this.handle, key);
|
|
4636
5143
|
}
|
|
4637
|
-
getKeyValueAsString(
|
|
4638
|
-
return
|
|
5144
|
+
getKeyValueAsString(key) {
|
|
5145
|
+
return getCfgRenderCtx().getKeyValueAsString(this.handle, key);
|
|
4639
5146
|
}
|
|
4640
|
-
getKeyValueAsJson(
|
|
4641
|
-
const
|
|
4642
|
-
if (
|
|
4643
|
-
|
|
5147
|
+
getKeyValueAsJson(key) {
|
|
5148
|
+
const content = this.getKeyValueAsString(key);
|
|
5149
|
+
if (content == void 0)
|
|
5150
|
+
throw new Error("Resource has no content.");
|
|
5151
|
+
return JSON.parse(content);
|
|
4644
5152
|
}
|
|
4645
5153
|
getDataBase64() {
|
|
4646
|
-
return
|
|
5154
|
+
return getCfgRenderCtx().getDataBase64(this.handle);
|
|
4647
5155
|
}
|
|
4648
5156
|
getDataAsString() {
|
|
4649
|
-
return
|
|
5157
|
+
return getCfgRenderCtx().getDataAsString(this.handle);
|
|
4650
5158
|
}
|
|
4651
5159
|
getDataAsJson() {
|
|
4652
|
-
const
|
|
4653
|
-
if (
|
|
4654
|
-
|
|
5160
|
+
const content = this.getDataAsString();
|
|
5161
|
+
if (content == void 0)
|
|
5162
|
+
throw new Error("Resource has no content.");
|
|
5163
|
+
return JSON.parse(content);
|
|
4655
5164
|
}
|
|
4656
5165
|
/**
|
|
4657
5166
|
*
|
|
4658
5167
|
*/
|
|
4659
|
-
getPColumns(
|
|
4660
|
-
const
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
5168
|
+
getPColumns(errorOnUnknownField = false, prefix = "") {
|
|
5169
|
+
const result = this.parsePObjectCollection(errorOnUnknownField, prefix);
|
|
5170
|
+
if (result === void 0)
|
|
5171
|
+
return void 0;
|
|
5172
|
+
const pf = Object.entries(result).map(([, obj]) => {
|
|
5173
|
+
if (!isPColumn(obj))
|
|
5174
|
+
throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);
|
|
5175
|
+
return obj;
|
|
4664
5176
|
});
|
|
5177
|
+
return pf;
|
|
4665
5178
|
}
|
|
4666
5179
|
/**
|
|
4667
5180
|
*
|
|
4668
5181
|
*/
|
|
4669
|
-
parsePObjectCollection(
|
|
4670
|
-
const
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
return new S(m().getBlobContentAsString(this.handle));
|
|
4689
|
-
}
|
|
4690
|
-
getFileContentAsJson() {
|
|
4691
|
-
return new S(
|
|
4692
|
-
m().getBlobContentAsString(this.handle)
|
|
4693
|
-
).mapDefined((e) => JSON.parse(e));
|
|
5182
|
+
parsePObjectCollection(errorOnUnknownField = false, prefix = "") {
|
|
5183
|
+
const pObjects = getCfgRenderCtx().parsePObjectCollection(this.handle, errorOnUnknownField, prefix, ...this.resolvePath);
|
|
5184
|
+
if (pObjects === void 0)
|
|
5185
|
+
return void 0;
|
|
5186
|
+
const result = {};
|
|
5187
|
+
for (const [key, value] of Object.entries(pObjects)) {
|
|
5188
|
+
const resolvePath = [...this.resolvePath, key];
|
|
5189
|
+
result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c, resolvePath));
|
|
5190
|
+
}
|
|
5191
|
+
return result;
|
|
5192
|
+
}
|
|
5193
|
+
getFileContentAsBase64(range) {
|
|
5194
|
+
return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle, range));
|
|
5195
|
+
}
|
|
5196
|
+
getFileContentAsString(range) {
|
|
5197
|
+
return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle, range));
|
|
5198
|
+
}
|
|
5199
|
+
getFileContentAsJson(range) {
|
|
5200
|
+
return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle, range)).mapDefined((v) => JSON.parse(v));
|
|
4694
5201
|
}
|
|
4695
5202
|
/**
|
|
4696
5203
|
* @deprecated use getFileContentAsBase64
|
|
@@ -4708,7 +5215,7 @@
|
|
|
4708
5215
|
* @returns downloaded file handle
|
|
4709
5216
|
*/
|
|
4710
5217
|
getFileHandle() {
|
|
4711
|
-
return new
|
|
5218
|
+
return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));
|
|
4712
5219
|
}
|
|
4713
5220
|
/**
|
|
4714
5221
|
* @deprecated use getFileHandle
|
|
@@ -4720,7 +5227,7 @@
|
|
|
4720
5227
|
* @returns downloaded file handle
|
|
4721
5228
|
*/
|
|
4722
5229
|
getRemoteFileHandle() {
|
|
4723
|
-
return new
|
|
5230
|
+
return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));
|
|
4724
5231
|
}
|
|
4725
5232
|
/**
|
|
4726
5233
|
* @deprecated use getRemoteFileHandle
|
|
@@ -4731,629 +5238,898 @@
|
|
|
4731
5238
|
/**
|
|
4732
5239
|
* @returns the url to the extracted folder
|
|
4733
5240
|
*/
|
|
4734
|
-
extractArchiveAndGetURL(
|
|
4735
|
-
return new
|
|
5241
|
+
extractArchiveAndGetURL(format) {
|
|
5242
|
+
return new FutureRef(getCfgRenderCtx().extractArchiveAndGetURL(this.handle, format));
|
|
4736
5243
|
}
|
|
4737
5244
|
getImportProgress() {
|
|
4738
|
-
return new
|
|
5245
|
+
return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));
|
|
4739
5246
|
}
|
|
4740
|
-
getLastLogs(
|
|
4741
|
-
return new
|
|
5247
|
+
getLastLogs(nLines) {
|
|
5248
|
+
return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));
|
|
4742
5249
|
}
|
|
4743
|
-
getProgressLog(
|
|
4744
|
-
return new
|
|
5250
|
+
getProgressLog(patternToSearch) {
|
|
5251
|
+
return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));
|
|
4745
5252
|
}
|
|
4746
|
-
getProgressLogWithInfo(
|
|
4747
|
-
return new
|
|
5253
|
+
getProgressLogWithInfo(patternToSearch) {
|
|
5254
|
+
return new FutureRef(getCfgRenderCtx().getProgressLogWithInfo(this.handle, patternToSearch));
|
|
4748
5255
|
}
|
|
4749
5256
|
getLogHandle() {
|
|
4750
|
-
return new
|
|
5257
|
+
return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));
|
|
4751
5258
|
}
|
|
4752
|
-
allFieldsResolved(
|
|
4753
|
-
switch (
|
|
5259
|
+
allFieldsResolved(fieldType = "Input") {
|
|
5260
|
+
switch (fieldType) {
|
|
4754
5261
|
case "Input":
|
|
4755
|
-
return this.getInputsLocked() && this.listInputFields().every(
|
|
4756
|
-
(n2) => this.resolve({ field: n2, assertFieldType: "Input" }) !== void 0
|
|
4757
|
-
);
|
|
5262
|
+
return this.getInputsLocked() && this.listInputFields().every((field) => this.resolve({ field, assertFieldType: "Input" }) !== void 0);
|
|
4758
5263
|
case "Output":
|
|
4759
|
-
return this.getOutputsLocked() && this.listOutputFields().every(
|
|
4760
|
-
(n2) => this.resolve({ field: n2, assertFieldType: "Output" }) !== void 0
|
|
4761
|
-
);
|
|
5264
|
+
return this.getOutputsLocked() && this.listOutputFields().every((field) => this.resolve({ field, assertFieldType: "Output" }) !== void 0);
|
|
4762
5265
|
}
|
|
4763
5266
|
}
|
|
4764
|
-
mapFields(
|
|
4765
|
-
const { fieldType
|
|
5267
|
+
mapFields(_mapping, _ops) {
|
|
5268
|
+
const { fieldType, requireLocked, skipUnresolved } = {
|
|
4766
5269
|
fieldType: "Input",
|
|
4767
5270
|
requireLocked: true,
|
|
4768
5271
|
skipUnresolved: false,
|
|
4769
|
-
...
|
|
4770
|
-
}
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
5272
|
+
..._ops
|
|
5273
|
+
};
|
|
5274
|
+
const mapping = _mapping;
|
|
5275
|
+
if (requireLocked) {
|
|
5276
|
+
if (fieldType === "Input" && !this.getInputsLocked())
|
|
5277
|
+
return void 0;
|
|
5278
|
+
if (fieldType === "Output" && !this.getOutputsLocked())
|
|
5279
|
+
return void 0;
|
|
5280
|
+
}
|
|
5281
|
+
const fieldList = fieldType === "Input" ? this.listInputFields() : fieldType === "Output" ? this.listOutputFields() : this.listDynamicFields();
|
|
5282
|
+
let fieldEntries = fieldList.map((field) => [field, this.resolve({ field, assertFieldType: fieldType })]);
|
|
5283
|
+
if (skipUnresolved)
|
|
5284
|
+
fieldEntries = fieldEntries.filter((e) => e[1] !== void 0);
|
|
5285
|
+
return fieldEntries.map(([name, value]) => mapping(name, value));
|
|
5286
|
+
}
|
|
5287
|
+
}
|
|
5288
|
+
const StagingAccessorName = "staging";
|
|
5289
|
+
const MainAccessorName = "main";
|
|
5290
|
+
const TraceEntry = z.object({
|
|
5291
|
+
type: z.string(),
|
|
5292
|
+
importance: z.number().optional(),
|
|
5293
|
+
id: z.string().optional(),
|
|
5294
|
+
label: z.string()
|
|
5295
|
+
});
|
|
5296
|
+
const Trace = z.array(TraceEntry);
|
|
5297
|
+
const DistancePenalty = 1e-3;
|
|
5298
|
+
const LabelType = "__LABEL__";
|
|
5299
|
+
const LabelTypeFull = "__LABEL__@1";
|
|
5300
|
+
function deriveLabels(values, specExtractor, ops = {}) {
|
|
5301
|
+
const importances = /* @__PURE__ */ new Map();
|
|
5302
|
+
const forceTraceElements = ops.forceTraceElements !== void 0 && ops.forceTraceElements.length > 0 ? new Set(ops.forceTraceElements) : void 0;
|
|
5303
|
+
const numberOfRecordsWithType = /* @__PURE__ */ new Map();
|
|
5304
|
+
const enrichedRecords = values.map((value) => {
|
|
5305
|
+
const extractorResult = specExtractor(value);
|
|
5306
|
+
let spec;
|
|
5307
|
+
let prefixTrace;
|
|
5308
|
+
let suffixTrace;
|
|
5309
|
+
if ("spec" in extractorResult && typeof extractorResult.spec === "object") {
|
|
5310
|
+
spec = extractorResult.spec;
|
|
5311
|
+
prefixTrace = extractorResult.prefixTrace;
|
|
5312
|
+
suffixTrace = extractorResult.suffixTrace;
|
|
5313
|
+
} else {
|
|
5314
|
+
spec = extractorResult;
|
|
5315
|
+
}
|
|
5316
|
+
const label = readAnnotation(spec, Annotation.Label);
|
|
5317
|
+
const traceStr = readAnnotation(spec, Annotation.Trace);
|
|
5318
|
+
const baseTrace = (traceStr ? Trace.safeParse(parseJson(traceStr)).data : void 0) ?? [];
|
|
5319
|
+
const trace = [
|
|
5320
|
+
...prefixTrace ?? [],
|
|
5321
|
+
...baseTrace,
|
|
5322
|
+
...suffixTrace ?? []
|
|
4796
5323
|
];
|
|
4797
|
-
if (
|
|
4798
|
-
const
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
5324
|
+
if (label !== void 0) {
|
|
5325
|
+
const labelEntry = { label, type: LabelType, importance: -2 };
|
|
5326
|
+
if (ops.addLabelAsSuffix)
|
|
5327
|
+
trace.push(labelEntry);
|
|
5328
|
+
else
|
|
5329
|
+
trace.splice(0, 0, labelEntry);
|
|
5330
|
+
}
|
|
5331
|
+
const fullTrace = [];
|
|
5332
|
+
const occurrences = /* @__PURE__ */ new Map();
|
|
5333
|
+
for (let i = trace.length - 1; i >= 0; --i) {
|
|
5334
|
+
const { type: typeName } = trace[i];
|
|
5335
|
+
const importance = trace[i].importance ?? 0;
|
|
5336
|
+
const occurrenceIndex = (occurrences.get(typeName) ?? 0) + 1;
|
|
5337
|
+
occurrences.set(typeName, occurrenceIndex);
|
|
5338
|
+
const fullType = `${typeName}@${occurrenceIndex}`;
|
|
5339
|
+
numberOfRecordsWithType.set(fullType, (numberOfRecordsWithType.get(fullType) ?? 0) + 1);
|
|
5340
|
+
importances.set(fullType, Math.max(importances.get(fullType) ?? Number.NEGATIVE_INFINITY, importance - (trace.length - i) * DistancePenalty));
|
|
5341
|
+
fullTrace.push({ ...trace[i], fullType, occurrenceIndex });
|
|
5342
|
+
}
|
|
5343
|
+
fullTrace.reverse();
|
|
5344
|
+
return {
|
|
5345
|
+
value,
|
|
5346
|
+
spec,
|
|
5347
|
+
label,
|
|
5348
|
+
fullTrace
|
|
4819
5349
|
};
|
|
4820
|
-
})
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
5350
|
+
});
|
|
5351
|
+
const mainTypes = [];
|
|
5352
|
+
const secondaryTypes = [];
|
|
5353
|
+
const allTypeRecords = [...importances];
|
|
5354
|
+
allTypeRecords.sort(([, i1], [, i2]) => i2 - i1);
|
|
5355
|
+
for (const [typeName] of allTypeRecords) {
|
|
5356
|
+
if (typeName.endsWith("@1") || numberOfRecordsWithType.get(typeName) === values.length)
|
|
5357
|
+
mainTypes.push(typeName);
|
|
5358
|
+
else
|
|
5359
|
+
secondaryTypes.push(typeName);
|
|
5360
|
+
}
|
|
5361
|
+
const calculate = (includedTypes2, force = false) => {
|
|
5362
|
+
const result = [];
|
|
5363
|
+
for (let i = 0; i < enrichedRecords.length; i++) {
|
|
5364
|
+
const r = enrichedRecords[i];
|
|
5365
|
+
const includedTrace = r.fullTrace.filter((fm) => includedTypes2.has(fm.fullType) || forceTraceElements && forceTraceElements.has(fm.type));
|
|
5366
|
+
if (includedTrace.length === 0) {
|
|
5367
|
+
if (force)
|
|
5368
|
+
result.push({
|
|
5369
|
+
label: "Unlabeled",
|
|
5370
|
+
value: r.value
|
|
5371
|
+
});
|
|
5372
|
+
else
|
|
5373
|
+
return void 0;
|
|
5374
|
+
}
|
|
5375
|
+
const labelSet = includedTrace.map((fm) => fm.label);
|
|
5376
|
+
const sep = ops.separator ?? " / ";
|
|
5377
|
+
result.push({
|
|
5378
|
+
label: labelSet.join(sep),
|
|
5379
|
+
value: r.value
|
|
4834
5380
|
});
|
|
4835
5381
|
}
|
|
4836
|
-
return
|
|
5382
|
+
return result;
|
|
4837
5383
|
};
|
|
4838
|
-
if (
|
|
4839
|
-
if (
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
let
|
|
4845
|
-
|
|
4846
|
-
const
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
if (
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
5384
|
+
if (mainTypes.length === 0) {
|
|
5385
|
+
if (secondaryTypes.length !== 0)
|
|
5386
|
+
throw new Error("Non-empty secondary types list while main types list is empty.");
|
|
5387
|
+
return calculate(new Set(LabelTypeFull), true);
|
|
5388
|
+
}
|
|
5389
|
+
let includedTypes = 0;
|
|
5390
|
+
let additionalType = -1;
|
|
5391
|
+
while (includedTypes < mainTypes.length) {
|
|
5392
|
+
const currentSet = /* @__PURE__ */ new Set();
|
|
5393
|
+
if (ops.includeNativeLabel)
|
|
5394
|
+
currentSet.add(LabelTypeFull);
|
|
5395
|
+
for (let i = 0; i < includedTypes; ++i)
|
|
5396
|
+
currentSet.add(mainTypes[i]);
|
|
5397
|
+
if (additionalType >= 0)
|
|
5398
|
+
currentSet.add(mainTypes[additionalType]);
|
|
5399
|
+
const candidateResult = calculate(currentSet);
|
|
5400
|
+
if (candidateResult !== void 0 && new Set(candidateResult.map((c) => c.label)).size === values.length)
|
|
5401
|
+
return candidateResult;
|
|
5402
|
+
additionalType++;
|
|
5403
|
+
if (additionalType >= mainTypes.length) {
|
|
5404
|
+
includedTypes++;
|
|
5405
|
+
additionalType = includedTypes;
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
return calculate(/* @__PURE__ */ new Set([...mainTypes, ...secondaryTypes]), true);
|
|
5409
|
+
}
|
|
5410
|
+
const PCD_PREFIX = "PColumnData/";
|
|
5411
|
+
const RT_RESOURCE_MAP = PCD_PREFIX + "ResourceMap";
|
|
5412
|
+
const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX + "Partitioned/ResourceMap";
|
|
5413
|
+
const RT_JSON_PARTITIONED = PCD_PREFIX + "JsonPartitioned";
|
|
5414
|
+
const RT_BINARY_PARTITIONED = PCD_PREFIX + "BinaryPartitioned";
|
|
5415
|
+
const PCD_SUP_PREFIX = PCD_PREFIX + "Partitioned/";
|
|
5416
|
+
const RT_JSON_SUPER_PARTITIONED = PCD_SUP_PREFIX + "JsonPartitioned";
|
|
5417
|
+
const RT_BINARY_SUPER_PARTITIONED = PCD_SUP_PREFIX + "BinaryPartitioned";
|
|
5418
|
+
const removeIndexSuffix = (keyStr) => {
|
|
5419
|
+
if (keyStr.endsWith(".index")) {
|
|
5420
|
+
return { baseKey: keyStr.substring(0, keyStr.length - 6), type: "index" };
|
|
5421
|
+
} else if (keyStr.endsWith(".values")) {
|
|
5422
|
+
return { baseKey: keyStr.substring(0, keyStr.length - 7), type: "values" };
|
|
5423
|
+
} else {
|
|
5424
|
+
throw new Error(`key must ends on .index/.values for binary p-column, got: ${keyStr}`);
|
|
5425
|
+
}
|
|
4865
5426
|
};
|
|
4866
|
-
function
|
|
4867
|
-
if (!
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
5427
|
+
function getPartitionKeysList(acc) {
|
|
5428
|
+
if (!acc)
|
|
5429
|
+
return void 0;
|
|
5430
|
+
const rt = acc.resourceType.name;
|
|
5431
|
+
const meta = acc.getDataAsJson();
|
|
5432
|
+
const data = [];
|
|
5433
|
+
let keyLength = 0;
|
|
5434
|
+
switch (rt) {
|
|
5435
|
+
case RT_RESOURCE_MAP:
|
|
5436
|
+
keyLength = meta["keyLength"];
|
|
4873
5437
|
break;
|
|
4874
|
-
case
|
|
4875
|
-
|
|
5438
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
5439
|
+
keyLength = meta["partitionKeyLength"] + meta["keyLength"];
|
|
4876
5440
|
break;
|
|
4877
|
-
case
|
|
4878
|
-
case
|
|
4879
|
-
|
|
5441
|
+
case RT_JSON_PARTITIONED:
|
|
5442
|
+
case RT_BINARY_PARTITIONED:
|
|
5443
|
+
keyLength = meta["partitionKeyLength"];
|
|
4880
5444
|
break;
|
|
4881
|
-
case
|
|
4882
|
-
case
|
|
4883
|
-
|
|
5445
|
+
case RT_BINARY_SUPER_PARTITIONED:
|
|
5446
|
+
case RT_JSON_SUPER_PARTITIONED:
|
|
5447
|
+
keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
|
|
4884
5448
|
break;
|
|
4885
5449
|
}
|
|
4886
|
-
switch (
|
|
4887
|
-
case
|
|
4888
|
-
case
|
|
4889
|
-
case
|
|
4890
|
-
for (let
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
5450
|
+
switch (rt) {
|
|
5451
|
+
case RT_RESOURCE_MAP:
|
|
5452
|
+
case RT_JSON_PARTITIONED:
|
|
5453
|
+
case RT_BINARY_PARTITIONED:
|
|
5454
|
+
for (let keyStr of acc.listInputFields()) {
|
|
5455
|
+
if (rt === RT_BINARY_PARTITIONED) {
|
|
5456
|
+
keyStr = removeIndexSuffix(keyStr).baseKey;
|
|
5457
|
+
}
|
|
5458
|
+
const key = [...JSON.parse(keyStr)];
|
|
5459
|
+
data.push(key);
|
|
4894
5460
|
}
|
|
4895
5461
|
break;
|
|
4896
|
-
case
|
|
4897
|
-
case
|
|
4898
|
-
case
|
|
4899
|
-
for (const
|
|
4900
|
-
const
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
5462
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
5463
|
+
case RT_BINARY_SUPER_PARTITIONED:
|
|
5464
|
+
case RT_JSON_SUPER_PARTITIONED:
|
|
5465
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
5466
|
+
const keyPrefix = [...JSON.parse(supKeyStr)];
|
|
5467
|
+
const value = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
5468
|
+
if (value !== void 0) {
|
|
5469
|
+
for (let keyStr of value.listInputFields()) {
|
|
5470
|
+
if (rt === RT_BINARY_SUPER_PARTITIONED) {
|
|
5471
|
+
keyStr = removeIndexSuffix(keyStr).baseKey;
|
|
5472
|
+
}
|
|
5473
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
5474
|
+
data.push(key);
|
|
4906
5475
|
}
|
|
5476
|
+
}
|
|
4907
5477
|
}
|
|
4908
5478
|
break;
|
|
4909
5479
|
}
|
|
4910
|
-
return { data
|
|
4911
|
-
}
|
|
4912
|
-
function
|
|
4913
|
-
if (
|
|
4914
|
-
throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${
|
|
4915
|
-
const { parts
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
}
|
|
4929
|
-
return
|
|
4930
|
-
}
|
|
4931
|
-
function
|
|
4932
|
-
if (
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
5480
|
+
return { data, keyLength };
|
|
5481
|
+
}
|
|
5482
|
+
function getUniquePartitionKeysForDataEntries(list) {
|
|
5483
|
+
if (list.type !== "JsonPartitioned" && list.type !== "BinaryPartitioned")
|
|
5484
|
+
throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${list.type}`);
|
|
5485
|
+
const { parts, partitionKeyLength } = list;
|
|
5486
|
+
const result = [];
|
|
5487
|
+
for (let i = 0; i < partitionKeyLength; ++i) {
|
|
5488
|
+
result.push(/* @__PURE__ */ new Set());
|
|
5489
|
+
}
|
|
5490
|
+
for (const part of parts) {
|
|
5491
|
+
const key = part.key;
|
|
5492
|
+
if (key.length !== partitionKeyLength) {
|
|
5493
|
+
throw new Error(`Key length (${key.length}) does not match partition length (${partitionKeyLength}) for key: ${JSON.stringify(key)}`);
|
|
5494
|
+
}
|
|
5495
|
+
for (let i = 0; i < partitionKeyLength; ++i) {
|
|
5496
|
+
result[i].add(key[i]);
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
return result.map((s) => Array.from(s.values()));
|
|
5500
|
+
}
|
|
5501
|
+
function getUniquePartitionKeys(acc) {
|
|
5502
|
+
if (acc === void 0)
|
|
5503
|
+
return void 0;
|
|
5504
|
+
if (isDataInfoEntries(acc))
|
|
5505
|
+
return getUniquePartitionKeysForDataEntries(acc);
|
|
5506
|
+
const list = getPartitionKeysList(acc);
|
|
5507
|
+
if (!list)
|
|
5508
|
+
return void 0;
|
|
5509
|
+
const { data, keyLength } = list;
|
|
5510
|
+
const result = [];
|
|
5511
|
+
for (let i = 0; i < keyLength; ++i) {
|
|
5512
|
+
result.push(/* @__PURE__ */ new Set());
|
|
5513
|
+
}
|
|
5514
|
+
for (const l of data) {
|
|
5515
|
+
if (l.length !== keyLength) {
|
|
4942
5516
|
throw new Error("key length does not match partition length");
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
if (
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
5517
|
+
}
|
|
5518
|
+
for (let i = 0; i < keyLength; ++i) {
|
|
5519
|
+
result[i].add(l[i]);
|
|
5520
|
+
}
|
|
5521
|
+
}
|
|
5522
|
+
return result.map((s) => Array.from(s.values()));
|
|
5523
|
+
}
|
|
5524
|
+
function parsePColumnData(acc, keyPrefix = []) {
|
|
5525
|
+
if (acc === void 0)
|
|
5526
|
+
return void 0;
|
|
5527
|
+
if (!acc.getIsReadyOrError())
|
|
5528
|
+
return void 0;
|
|
5529
|
+
const resourceType = acc.resourceType.name;
|
|
5530
|
+
const meta = acc.getDataAsJson();
|
|
5531
|
+
if (keyPrefix.length > 0 && (resourceType === RT_JSON_SUPER_PARTITIONED || resourceType === RT_BINARY_SUPER_PARTITIONED)) {
|
|
5532
|
+
throw new Error(`Unexpected nested super-partitioned resource: ${resourceType}`);
|
|
5533
|
+
}
|
|
5534
|
+
switch (resourceType) {
|
|
5535
|
+
case RT_RESOURCE_MAP:
|
|
5536
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
5537
|
+
throw new Error(`Only data columns are supported, got: ${resourceType}`);
|
|
5538
|
+
case RT_JSON_PARTITIONED: {
|
|
5539
|
+
if (typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5540
|
+
throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
5541
|
+
}
|
|
5542
|
+
const parts = [];
|
|
5543
|
+
for (const keyStr of acc.listInputFields()) {
|
|
5544
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
5545
|
+
if (value === void 0)
|
|
5546
|
+
return void 0;
|
|
5547
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
5548
|
+
parts.push({ key, value });
|
|
4966
5549
|
}
|
|
4967
5550
|
return {
|
|
4968
5551
|
type: "JsonPartitioned",
|
|
4969
|
-
partitionKeyLength:
|
|
4970
|
-
parts
|
|
5552
|
+
partitionKeyLength: meta.partitionKeyLength,
|
|
5553
|
+
parts
|
|
4971
5554
|
};
|
|
4972
5555
|
}
|
|
4973
|
-
case
|
|
4974
|
-
if (typeof (
|
|
4975
|
-
throw new Error(`Missing partitionKeyLength in metadata for ${
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
5556
|
+
case RT_BINARY_PARTITIONED: {
|
|
5557
|
+
if (typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5558
|
+
throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
5559
|
+
}
|
|
5560
|
+
const parts = [];
|
|
5561
|
+
const baseKeys = /* @__PURE__ */ new Map();
|
|
5562
|
+
for (const keyStr of acc.listInputFields()) {
|
|
5563
|
+
const suffix = removeIndexSuffix(keyStr);
|
|
5564
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
5565
|
+
if (value === void 0)
|
|
5566
|
+
return void 0;
|
|
5567
|
+
let entry = baseKeys.get(suffix.baseKey);
|
|
5568
|
+
if (!entry) {
|
|
5569
|
+
entry = {};
|
|
5570
|
+
baseKeys.set(suffix.baseKey, entry);
|
|
5571
|
+
}
|
|
5572
|
+
if (suffix.type === "index") {
|
|
5573
|
+
entry.index = value;
|
|
5574
|
+
} else {
|
|
5575
|
+
entry.values = value;
|
|
5576
|
+
}
|
|
4982
5577
|
}
|
|
4983
|
-
for (const [
|
|
4984
|
-
if (!
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
5578
|
+
for (const [baseKeyStr, entry] of baseKeys.entries()) {
|
|
5579
|
+
if (!entry.index || !entry.values)
|
|
5580
|
+
return void 0;
|
|
5581
|
+
const key = [...keyPrefix, ...JSON.parse(baseKeyStr)];
|
|
5582
|
+
parts.push({
|
|
5583
|
+
key,
|
|
4988
5584
|
value: {
|
|
4989
|
-
index:
|
|
4990
|
-
values:
|
|
5585
|
+
index: entry.index,
|
|
5586
|
+
values: entry.values
|
|
4991
5587
|
}
|
|
4992
5588
|
});
|
|
4993
5589
|
}
|
|
4994
5590
|
return {
|
|
4995
5591
|
type: "BinaryPartitioned",
|
|
4996
|
-
partitionKeyLength:
|
|
4997
|
-
parts
|
|
5592
|
+
partitionKeyLength: meta.partitionKeyLength,
|
|
5593
|
+
parts
|
|
4998
5594
|
};
|
|
4999
5595
|
}
|
|
5000
|
-
case
|
|
5001
|
-
if (typeof (
|
|
5002
|
-
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
if (
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5596
|
+
case RT_JSON_SUPER_PARTITIONED: {
|
|
5597
|
+
if (typeof (meta == null ? void 0 : meta.superPartitionKeyLength) !== "number" || typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5598
|
+
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
5599
|
+
}
|
|
5600
|
+
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
5601
|
+
const parts = [];
|
|
5602
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
5603
|
+
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
5604
|
+
if (superPartition === void 0)
|
|
5605
|
+
return void 0;
|
|
5606
|
+
if (superPartition.resourceType.name !== RT_JSON_PARTITIONED) {
|
|
5607
|
+
throw new Error(`Expected ${RT_JSON_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
5608
|
+
}
|
|
5609
|
+
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
5610
|
+
if (innerResult === void 0)
|
|
5611
|
+
return void 0;
|
|
5612
|
+
if (innerResult.type !== "JsonPartitioned")
|
|
5613
|
+
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
5614
|
+
parts.push(...innerResult.parts);
|
|
5014
5615
|
}
|
|
5015
5616
|
return {
|
|
5016
5617
|
type: "JsonPartitioned",
|
|
5017
|
-
partitionKeyLength:
|
|
5018
|
-
parts
|
|
5618
|
+
partitionKeyLength: totalKeyLength,
|
|
5619
|
+
parts
|
|
5019
5620
|
};
|
|
5020
5621
|
}
|
|
5021
|
-
case
|
|
5022
|
-
if (typeof (
|
|
5023
|
-
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
if (
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5622
|
+
case RT_BINARY_SUPER_PARTITIONED: {
|
|
5623
|
+
if (typeof (meta == null ? void 0 : meta.superPartitionKeyLength) !== "number" || typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5624
|
+
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
5625
|
+
}
|
|
5626
|
+
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
5627
|
+
const parts = [];
|
|
5628
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
5629
|
+
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
5630
|
+
if (superPartition === void 0)
|
|
5631
|
+
return void 0;
|
|
5632
|
+
if (superPartition.resourceType.name !== RT_BINARY_PARTITIONED) {
|
|
5633
|
+
throw new Error(`Expected ${RT_BINARY_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
5634
|
+
}
|
|
5635
|
+
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
5636
|
+
if (innerResult === void 0)
|
|
5637
|
+
return void 0;
|
|
5638
|
+
if (innerResult.type !== "BinaryPartitioned")
|
|
5639
|
+
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
5640
|
+
parts.push(...innerResult.parts);
|
|
5035
5641
|
}
|
|
5036
5642
|
return {
|
|
5037
5643
|
type: "BinaryPartitioned",
|
|
5038
|
-
partitionKeyLength:
|
|
5039
|
-
parts
|
|
5644
|
+
partitionKeyLength: totalKeyLength,
|
|
5645
|
+
parts
|
|
5040
5646
|
};
|
|
5041
5647
|
}
|
|
5042
5648
|
default:
|
|
5043
|
-
throw new Error(`Unknown resource type: ${
|
|
5044
|
-
}
|
|
5045
|
-
}
|
|
5046
|
-
function
|
|
5047
|
-
if (
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5649
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
5650
|
+
}
|
|
5651
|
+
}
|
|
5652
|
+
function convertOrParsePColumnData(acc) {
|
|
5653
|
+
if (acc === void 0)
|
|
5654
|
+
return void 0;
|
|
5655
|
+
if (isDataInfoEntries(acc))
|
|
5656
|
+
return acc;
|
|
5657
|
+
if (isDataInfo(acc))
|
|
5658
|
+
return dataInfoToEntries(acc);
|
|
5659
|
+
if (acc instanceof TreeNodeAccessor)
|
|
5660
|
+
return parsePColumnData(acc);
|
|
5661
|
+
throw new Error(`Unexpected input type: ${typeof acc}`);
|
|
5662
|
+
}
|
|
5663
|
+
function filterDataInfoEntries(dataInfoEntries, axisFilters) {
|
|
5664
|
+
const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
|
|
5665
|
+
const { type } = dataInfoEntries;
|
|
5666
|
+
switch (type) {
|
|
5667
|
+
case "Json": {
|
|
5668
|
+
const { keyLength } = dataInfoEntries;
|
|
5669
|
+
for (const [axisIdx] of axisFilters)
|
|
5670
|
+
if (axisIdx >= keyLength)
|
|
5671
|
+
throw new Error(`Can't filter on non-data axis ${axisIdx}. Must be >= ${keyLength}`);
|
|
5672
|
+
break;
|
|
5673
|
+
}
|
|
5674
|
+
case "JsonPartitioned":
|
|
5675
|
+
case "BinaryPartitioned":
|
|
5676
|
+
case "ParquetPartitioned": {
|
|
5677
|
+
const { partitionKeyLength } = dataInfoEntries;
|
|
5678
|
+
for (const [axisIdx] of axisFilters)
|
|
5679
|
+
if (axisIdx >= partitionKeyLength)
|
|
5680
|
+
throw new Error(`Can't filter on non-partitioned axis ${axisIdx}. Must be >= ${partitionKeyLength}`);
|
|
5681
|
+
break;
|
|
5682
|
+
}
|
|
5683
|
+
default:
|
|
5684
|
+
throw new Error(`Unsupported data info type: ${type}`);
|
|
5685
|
+
}
|
|
5686
|
+
const keyMatchesFilters = (key) => {
|
|
5687
|
+
for (const [axisIdx, axisValue] of sortedFilters)
|
|
5688
|
+
if (key[axisIdx] !== axisValue)
|
|
5070
5689
|
return false;
|
|
5071
5690
|
return true;
|
|
5072
|
-
}, i = (s2) => {
|
|
5073
|
-
const o = [...s2];
|
|
5074
|
-
for (const [a] of n2)
|
|
5075
|
-
o.splice(a, 1);
|
|
5076
|
-
return o;
|
|
5077
5691
|
};
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5692
|
+
const removeFilteredAxes = (key) => {
|
|
5693
|
+
const newKey = [...key];
|
|
5694
|
+
for (const [axisIdx] of sortedFilters)
|
|
5695
|
+
newKey.splice(axisIdx, 1);
|
|
5696
|
+
return newKey;
|
|
5697
|
+
};
|
|
5698
|
+
switch (dataInfoEntries.type) {
|
|
5699
|
+
case "Json":
|
|
5084
5700
|
return {
|
|
5085
5701
|
type: "Json",
|
|
5086
|
-
keyLength:
|
|
5087
|
-
data:
|
|
5702
|
+
keyLength: dataInfoEntries.keyLength - axisFilters.length,
|
|
5703
|
+
data: dataInfoEntries.data.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5704
|
+
key: removeFilteredAxes(entry.key),
|
|
5705
|
+
value: entry.value
|
|
5706
|
+
}))
|
|
5088
5707
|
};
|
|
5089
|
-
|
|
5090
|
-
case "JsonPartitioned": {
|
|
5091
|
-
const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
|
|
5092
|
-
key: i(o.key),
|
|
5093
|
-
value: o.value
|
|
5094
|
-
}));
|
|
5708
|
+
case "JsonPartitioned":
|
|
5095
5709
|
return {
|
|
5096
5710
|
type: "JsonPartitioned",
|
|
5097
|
-
partitionKeyLength:
|
|
5098
|
-
parts:
|
|
5711
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
5712
|
+
parts: dataInfoEntries.parts.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5713
|
+
key: removeFilteredAxes(entry.key),
|
|
5714
|
+
value: entry.value
|
|
5715
|
+
}))
|
|
5099
5716
|
};
|
|
5100
|
-
|
|
5101
|
-
case "BinaryPartitioned": {
|
|
5102
|
-
const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
|
|
5103
|
-
key: i(o.key),
|
|
5104
|
-
value: o.value
|
|
5105
|
-
}));
|
|
5717
|
+
case "BinaryPartitioned":
|
|
5106
5718
|
return {
|
|
5107
5719
|
type: "BinaryPartitioned",
|
|
5108
|
-
partitionKeyLength:
|
|
5109
|
-
parts:
|
|
5720
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
5721
|
+
parts: dataInfoEntries.parts.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5722
|
+
key: removeFilteredAxes(entry.key),
|
|
5723
|
+
value: entry.value
|
|
5724
|
+
}))
|
|
5725
|
+
};
|
|
5726
|
+
case "ParquetPartitioned":
|
|
5727
|
+
return {
|
|
5728
|
+
type: "ParquetPartitioned",
|
|
5729
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
5730
|
+
parts: dataInfoEntries.parts.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5731
|
+
key: removeFilteredAxes(entry.key),
|
|
5732
|
+
value: entry.value
|
|
5733
|
+
}))
|
|
5110
5734
|
};
|
|
5111
|
-
}
|
|
5112
5735
|
}
|
|
5113
5736
|
}
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5737
|
+
function isPColumnValues(value) {
|
|
5738
|
+
if (!Array.isArray(value))
|
|
5739
|
+
return false;
|
|
5740
|
+
if (value.length === 0)
|
|
5741
|
+
return true;
|
|
5742
|
+
const first = value[0];
|
|
5743
|
+
return typeof first === "object" && first !== null && "key" in first && "val" in first;
|
|
5744
|
+
}
|
|
5745
|
+
class ArrayColumnProvider {
|
|
5746
|
+
constructor(columns) {
|
|
5747
|
+
__publicField(this, "columns");
|
|
5748
|
+
this.columns = columns;
|
|
5117
5749
|
}
|
|
5118
|
-
selectColumns(
|
|
5119
|
-
const
|
|
5120
|
-
return this.columns.filter((
|
|
5750
|
+
selectColumns(selectors) {
|
|
5751
|
+
const predicate = typeof selectors === "function" ? selectors : selectorsToPredicate(selectors);
|
|
5752
|
+
return this.columns.filter((column) => predicate(column.spec));
|
|
5121
5753
|
}
|
|
5122
5754
|
}
|
|
5123
|
-
function
|
|
5124
|
-
if (
|
|
5125
|
-
return
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5755
|
+
function splitFiltersToTrace(splitFilters) {
|
|
5756
|
+
if (!splitFilters)
|
|
5757
|
+
return void 0;
|
|
5758
|
+
return splitFilters.map((filter) => ({
|
|
5759
|
+
type: `split:${canonicalizeAxisId(filter.axisId)}`,
|
|
5760
|
+
label: filter.label,
|
|
5761
|
+
importance: 1e6
|
|
5762
|
+
// High importance for split filters in labels
|
|
5763
|
+
}));
|
|
5764
|
+
}
|
|
5765
|
+
function splitFiltersToAxisFilter(splitFilters) {
|
|
5766
|
+
if (!splitFilters)
|
|
5767
|
+
return void 0;
|
|
5768
|
+
return splitFilters.map((filter) => [filter.axisIdx, filter.value]);
|
|
5135
5769
|
}
|
|
5136
|
-
function
|
|
5137
|
-
if (!
|
|
5138
|
-
|
|
5139
|
-
|
|
5770
|
+
function fallbackIdDeriver(originalId, axisFilters) {
|
|
5771
|
+
if (!axisFilters || axisFilters.length === 0)
|
|
5772
|
+
return originalId;
|
|
5773
|
+
const filtersToCanonicalize = [...axisFilters].sort((a, b) => a[0] - b[0]);
|
|
5774
|
+
return canonicalize({ id: originalId, axisFilters: filtersToCanonicalize });
|
|
5140
5775
|
}
|
|
5141
|
-
function
|
|
5142
|
-
if (!
|
|
5143
|
-
|
|
5144
|
-
|
|
5776
|
+
function hasAnchors(selector) {
|
|
5777
|
+
if (!selector || typeof selector !== "object")
|
|
5778
|
+
return false;
|
|
5779
|
+
const potentialAnchored = selector;
|
|
5780
|
+
const domainHasAnchors = potentialAnchored["domain"] && typeof potentialAnchored["domain"] === "object" && Object.values(potentialAnchored["domain"]).some((v) => typeof v === "object" && v !== null && "anchor" in v);
|
|
5781
|
+
const axesHaveAnchors = potentialAnchored["axes"] && Array.isArray(potentialAnchored["axes"]) && potentialAnchored["axes"].some((a) => typeof a === "object" && a !== null && "anchor" in a);
|
|
5782
|
+
return !!potentialAnchored["domainAnchor"] || domainHasAnchors || axesHaveAnchors;
|
|
5145
5783
|
}
|
|
5146
|
-
function
|
|
5147
|
-
if (typeof
|
|
5784
|
+
function getSplitAxisIndices(selector) {
|
|
5785
|
+
if (typeof selector !== "object" || !("axes" in selector) || selector.axes === void 0) {
|
|
5148
5786
|
return [];
|
|
5149
|
-
|
|
5150
|
-
|
|
5787
|
+
}
|
|
5788
|
+
const splitIndices = selector.axes.map((axis, index) => typeof axis === "object" && "split" in axis && axis.split === true ? index : -1).filter((index) => index !== -1);
|
|
5789
|
+
if (splitIndices.length > 0 && selector.partialAxesMatch !== void 0) {
|
|
5151
5790
|
throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");
|
|
5152
|
-
|
|
5791
|
+
}
|
|
5792
|
+
splitIndices.sort((a, b) => a - b);
|
|
5793
|
+
return splitIndices;
|
|
5153
5794
|
}
|
|
5154
|
-
class
|
|
5795
|
+
class PColumnCollection {
|
|
5155
5796
|
constructor() {
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5797
|
+
__publicField(this, "defaultProviderStore", []);
|
|
5798
|
+
__publicField(this, "providers", [new ArrayColumnProvider(this.defaultProviderStore)]);
|
|
5799
|
+
__publicField(this, "axisLabelProviders", []);
|
|
5159
5800
|
}
|
|
5160
|
-
addColumnProvider(
|
|
5161
|
-
|
|
5801
|
+
addColumnProvider(provider) {
|
|
5802
|
+
this.providers.push(provider);
|
|
5803
|
+
return this;
|
|
5162
5804
|
}
|
|
5163
|
-
addAxisLabelProvider(
|
|
5164
|
-
|
|
5805
|
+
addAxisLabelProvider(provider) {
|
|
5806
|
+
this.axisLabelProviders.push(provider);
|
|
5807
|
+
return this;
|
|
5165
5808
|
}
|
|
5166
|
-
addColumns(
|
|
5167
|
-
|
|
5809
|
+
addColumns(columns) {
|
|
5810
|
+
this.defaultProviderStore.push(...columns);
|
|
5811
|
+
return this;
|
|
5168
5812
|
}
|
|
5169
|
-
addColumn(
|
|
5170
|
-
|
|
5813
|
+
addColumn(column) {
|
|
5814
|
+
this.defaultProviderStore.push(column);
|
|
5815
|
+
return this;
|
|
5171
5816
|
}
|
|
5172
5817
|
/** Fetches labels for a given axis from the registered providers */
|
|
5173
|
-
findLabels(
|
|
5174
|
-
for (const
|
|
5175
|
-
const
|
|
5176
|
-
if (
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5818
|
+
findLabels(axis) {
|
|
5819
|
+
for (const provider of this.axisLabelProviders) {
|
|
5820
|
+
const labels = provider.findLabels(axis);
|
|
5821
|
+
if (labels)
|
|
5822
|
+
return labels;
|
|
5823
|
+
}
|
|
5824
|
+
return void 0;
|
|
5825
|
+
}
|
|
5826
|
+
getUniversalEntries(predicateOrSelectors, opts) {
|
|
5827
|
+
const { anchorCtx, labelOps: rawLabelOps, dontWaitAllData = false, overrideLabelAnnotation = false, exclude } = opts ?? {};
|
|
5828
|
+
const labelOps = {
|
|
5829
|
+
...overrideLabelAnnotation && (rawLabelOps == null ? void 0 : rawLabelOps.includeNativeLabel) !== false ? { includeNativeLabel: true } : {},
|
|
5830
|
+
...rawLabelOps ?? {}
|
|
5831
|
+
};
|
|
5832
|
+
let excludePredicate = () => false;
|
|
5833
|
+
if (exclude) {
|
|
5834
|
+
const excludePredicartes = (Array.isArray(exclude) ? exclude : [exclude]).map((selector) => {
|
|
5835
|
+
if (hasAnchors(selector)) {
|
|
5836
|
+
if (!anchorCtx)
|
|
5837
|
+
throw new Error("Anchored selectors in exclude require an AnchoredIdDeriver to be provided in options.");
|
|
5838
|
+
return selectorsToPredicate(resolveAnchors(anchorCtx.anchors, selector, opts));
|
|
5839
|
+
} else
|
|
5840
|
+
return selectorsToPredicate(selector);
|
|
5841
|
+
});
|
|
5842
|
+
excludePredicate = (spec) => excludePredicartes.some((predicate) => predicate(spec));
|
|
5843
|
+
}
|
|
5844
|
+
const selectorsArray = typeof predicateOrSelectors === "function" ? [predicateOrSelectors] : Array.isArray(predicateOrSelectors) ? predicateOrSelectors : [predicateOrSelectors];
|
|
5845
|
+
const intermediateResults = [];
|
|
5846
|
+
const selectedNativeIds = /* @__PURE__ */ new Set();
|
|
5847
|
+
for (const rawSelector of selectorsArray) {
|
|
5848
|
+
const usesAnchors = hasAnchors(rawSelector);
|
|
5849
|
+
let currentSelector;
|
|
5850
|
+
if (usesAnchors) {
|
|
5851
|
+
if (!anchorCtx)
|
|
5189
5852
|
throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");
|
|
5190
|
-
|
|
5853
|
+
currentSelector = resolveAnchors(anchorCtx.anchors, rawSelector, opts);
|
|
5191
5854
|
} else
|
|
5192
|
-
|
|
5193
|
-
const
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5855
|
+
currentSelector = rawSelector;
|
|
5856
|
+
const selectedIds = /* @__PURE__ */ new Set();
|
|
5857
|
+
const selectedColumns = [];
|
|
5858
|
+
for (const provider of this.providers) {
|
|
5859
|
+
const providerColumns = provider.selectColumns(currentSelector);
|
|
5860
|
+
for (const col of providerColumns) {
|
|
5861
|
+
if (excludePredicate(col.spec))
|
|
5862
|
+
continue;
|
|
5863
|
+
if (selectedIds.has(col.id))
|
|
5864
|
+
throw new Error(`Duplicate column id ${col.id} in provider ${provider.constructor.name}`);
|
|
5865
|
+
const nativeId = deriveNativeId(col.spec);
|
|
5866
|
+
if (selectedNativeIds.has(nativeId))
|
|
5867
|
+
continue;
|
|
5868
|
+
selectedIds.add(col.id);
|
|
5869
|
+
selectedNativeIds.add(nativeId);
|
|
5870
|
+
selectedColumns.push(col);
|
|
5199
5871
|
}
|
|
5200
5872
|
}
|
|
5201
|
-
if (
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
if (
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5873
|
+
if (selectedColumns.length === 0)
|
|
5874
|
+
continue;
|
|
5875
|
+
const splitAxisIdxs = getSplitAxisIndices(rawSelector);
|
|
5876
|
+
const needsSplitting = splitAxisIdxs.length > 0;
|
|
5877
|
+
for (const column of selectedColumns) {
|
|
5878
|
+
if (!isPColumnSpec(column.spec))
|
|
5879
|
+
continue;
|
|
5880
|
+
const originalSpec = column.spec;
|
|
5881
|
+
if (needsSplitting) {
|
|
5882
|
+
if (isPColumnValues(column.data))
|
|
5883
|
+
throw new Error(`Splitting is not supported for PColumns with PColumnValues data format. Column id: ${column.id}`);
|
|
5884
|
+
const dataEntries = convertOrParsePColumnData(column.data);
|
|
5885
|
+
if (!dataEntries) {
|
|
5886
|
+
if (dontWaitAllData)
|
|
5887
|
+
continue;
|
|
5888
|
+
return void 0;
|
|
5211
5889
|
}
|
|
5212
|
-
if (!
|
|
5213
|
-
throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${
|
|
5214
|
-
const
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5890
|
+
if (!isPartitionedDataInfoEntries(dataEntries))
|
|
5891
|
+
throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${dataEntries.type} for column ${column.id}`);
|
|
5892
|
+
const uniqueKeys = getUniquePartitionKeys(dataEntries);
|
|
5893
|
+
const maxSplitIdx = splitAxisIdxs[splitAxisIdxs.length - 1];
|
|
5894
|
+
if (maxSplitIdx >= dataEntries.partitionKeyLength)
|
|
5895
|
+
throw new Error(`Not enough partition keys (${dataEntries.partitionKeyLength}) for requested split axes (max index ${maxSplitIdx}) in column ${originalSpec.name}`);
|
|
5896
|
+
const axesLabels = splitAxisIdxs.map((idx) => this.findLabels(getAxisId(originalSpec.axesSpec[idx])));
|
|
5897
|
+
const keyCombinations = [];
|
|
5898
|
+
const generateCombinations = (currentCombo, sAxisIdx) => {
|
|
5899
|
+
if (sAxisIdx >= splitAxisIdxs.length) {
|
|
5900
|
+
keyCombinations.push([...currentCombo]);
|
|
5901
|
+
if (keyCombinations.length > 1e4)
|
|
5220
5902
|
throw new Error("Too many key combinations, aborting.");
|
|
5221
5903
|
return;
|
|
5222
5904
|
}
|
|
5223
|
-
const
|
|
5224
|
-
if (
|
|
5225
|
-
throw new Error(`Axis index ${
|
|
5226
|
-
const
|
|
5227
|
-
if (!
|
|
5228
|
-
|
|
5905
|
+
const axisIdx = splitAxisIdxs[sAxisIdx];
|
|
5906
|
+
if (axisIdx >= uniqueKeys.length)
|
|
5907
|
+
throw new Error(`Axis index ${axisIdx} out of bounds for unique keys array (length ${uniqueKeys.length}) during split key generation for column ${column.id}`);
|
|
5908
|
+
const axisValues = uniqueKeys[axisIdx];
|
|
5909
|
+
if (!axisValues || axisValues.length === 0) {
|
|
5910
|
+
keyCombinations.length = 0;
|
|
5229
5911
|
return;
|
|
5230
5912
|
}
|
|
5231
|
-
for (const
|
|
5232
|
-
|
|
5913
|
+
for (const val of axisValues) {
|
|
5914
|
+
currentCombo.push(val);
|
|
5915
|
+
generateCombinations(currentCombo, sAxisIdx + 1);
|
|
5916
|
+
currentCombo.pop();
|
|
5917
|
+
}
|
|
5233
5918
|
};
|
|
5234
|
-
|
|
5919
|
+
generateCombinations([], 0);
|
|
5920
|
+
if (keyCombinations.length === 0)
|
|
5235
5921
|
continue;
|
|
5236
|
-
const
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5922
|
+
const newAxesSpec = [...originalSpec.axesSpec];
|
|
5923
|
+
const splitAxisOriginalIdxs = splitAxisIdxs.map((idx) => idx);
|
|
5924
|
+
for (let i = splitAxisIdxs.length - 1; i >= 0; i--) {
|
|
5925
|
+
newAxesSpec.splice(splitAxisIdxs[i], 1);
|
|
5926
|
+
}
|
|
5927
|
+
const adjustedSpec = { ...originalSpec, axesSpec: newAxesSpec };
|
|
5928
|
+
for (const keyCombo of keyCombinations) {
|
|
5929
|
+
const splitFilters = keyCombo.map((value, sAxisIdx) => {
|
|
5930
|
+
const axisIdx = splitAxisOriginalIdxs[sAxisIdx];
|
|
5931
|
+
const axisId = getAxisId(originalSpec.axesSpec[axisIdx]);
|
|
5932
|
+
const axisLabelMap = axesLabels[sAxisIdx];
|
|
5933
|
+
const label = (axisLabelMap == null ? void 0 : axisLabelMap[value]) ?? String(value);
|
|
5934
|
+
return { axisIdx, axisId, value, label };
|
|
5244
5935
|
});
|
|
5245
|
-
|
|
5936
|
+
intermediateResults.push({
|
|
5246
5937
|
type: "split",
|
|
5247
|
-
originalColumn:
|
|
5248
|
-
spec:
|
|
5249
|
-
adjustedSpec
|
|
5250
|
-
dataEntries
|
|
5251
|
-
axisFilters:
|
|
5938
|
+
originalColumn: column,
|
|
5939
|
+
spec: originalSpec,
|
|
5940
|
+
adjustedSpec,
|
|
5941
|
+
dataEntries,
|
|
5942
|
+
axisFilters: splitFilters
|
|
5252
5943
|
});
|
|
5253
5944
|
}
|
|
5254
|
-
} else
|
|
5255
|
-
|
|
5945
|
+
} else {
|
|
5946
|
+
intermediateResults.push({
|
|
5256
5947
|
type: "direct",
|
|
5257
|
-
originalColumn:
|
|
5258
|
-
spec:
|
|
5259
|
-
adjustedSpec:
|
|
5948
|
+
originalColumn: column,
|
|
5949
|
+
spec: originalSpec,
|
|
5950
|
+
adjustedSpec: originalSpec
|
|
5260
5951
|
});
|
|
5952
|
+
}
|
|
5261
5953
|
}
|
|
5262
5954
|
}
|
|
5263
|
-
if (
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
const
|
|
5274
|
-
let
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5955
|
+
if (intermediateResults.length === 0)
|
|
5956
|
+
return [];
|
|
5957
|
+
const labeledResults = deriveLabels(intermediateResults, (entry) => ({
|
|
5958
|
+
spec: entry.spec,
|
|
5959
|
+
suffixTrace: entry.type === "split" ? splitFiltersToTrace(entry.axisFilters) : void 0
|
|
5960
|
+
}), labelOps);
|
|
5961
|
+
const result = [];
|
|
5962
|
+
for (const { value: entry, label } of labeledResults) {
|
|
5963
|
+
const { originalColumn, spec: originalSpec } = entry;
|
|
5964
|
+
const axisFilters = entry.type === "split" ? entry.axisFilters : void 0;
|
|
5965
|
+
const axisFiltersTuple = splitFiltersToAxisFilter(axisFilters);
|
|
5966
|
+
let finalId;
|
|
5967
|
+
if (anchorCtx)
|
|
5968
|
+
finalId = anchorCtx.deriveS(originalSpec, axisFiltersTuple);
|
|
5969
|
+
else
|
|
5970
|
+
finalId = fallbackIdDeriver(originalColumn.id, axisFiltersTuple);
|
|
5971
|
+
let finalSpec = { ...entry.adjustedSpec };
|
|
5972
|
+
if (overrideLabelAnnotation) {
|
|
5973
|
+
finalSpec = {
|
|
5974
|
+
...finalSpec,
|
|
5975
|
+
annotations: {
|
|
5976
|
+
...finalSpec.annotations ?? {},
|
|
5977
|
+
[Annotation.Label]: label
|
|
5978
|
+
}
|
|
5979
|
+
};
|
|
5980
|
+
}
|
|
5981
|
+
result.push({
|
|
5982
|
+
id: finalId,
|
|
5983
|
+
spec: finalSpec,
|
|
5984
|
+
data: () => entry.type === "split" ? entriesToDataInfo(filterDataInfoEntries(entry.dataEntries, axisFiltersTuple)) : entry.originalColumn.data,
|
|
5985
|
+
label
|
|
5288
5986
|
});
|
|
5289
5987
|
}
|
|
5290
|
-
return
|
|
5988
|
+
return result;
|
|
5291
5989
|
}
|
|
5292
|
-
getColumns(
|
|
5293
|
-
const
|
|
5990
|
+
getColumns(predicateOrSelectors, opts) {
|
|
5991
|
+
const entries = this.getUniversalEntries(predicateOrSelectors, {
|
|
5294
5992
|
overrideLabelAnnotation: true,
|
|
5295
5993
|
// default for getColumns
|
|
5296
|
-
...
|
|
5994
|
+
...opts ?? {}
|
|
5297
5995
|
});
|
|
5298
|
-
if (!
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5996
|
+
if (!entries)
|
|
5997
|
+
return void 0;
|
|
5998
|
+
const columns = [];
|
|
5999
|
+
for (const entry of entries) {
|
|
6000
|
+
const data = entry.data();
|
|
6001
|
+
if (!data) {
|
|
6002
|
+
if (opts == null ? void 0 : opts.dontWaitAllData)
|
|
6003
|
+
continue;
|
|
6004
|
+
return void 0;
|
|
5305
6005
|
}
|
|
5306
|
-
|
|
5307
|
-
id:
|
|
5308
|
-
spec:
|
|
5309
|
-
data
|
|
6006
|
+
columns.push({
|
|
6007
|
+
id: entry.id,
|
|
6008
|
+
spec: entry.spec,
|
|
6009
|
+
data
|
|
5310
6010
|
});
|
|
5311
6011
|
}
|
|
5312
|
-
return
|
|
6012
|
+
return columns;
|
|
5313
6013
|
}
|
|
5314
6014
|
}
|
|
5315
|
-
function
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
6015
|
+
function patchInSetFilters(filters) {
|
|
6016
|
+
const inSetToOrEqual = (predicate) => {
|
|
6017
|
+
if (predicate.operator !== "InSet")
|
|
6018
|
+
return predicate;
|
|
6019
|
+
return {
|
|
6020
|
+
operator: "Or",
|
|
6021
|
+
operands: predicate.references.map((reference) => ({
|
|
6022
|
+
operator: "Equal",
|
|
6023
|
+
reference
|
|
6024
|
+
}))
|
|
6025
|
+
};
|
|
6026
|
+
};
|
|
6027
|
+
const mapSingleValuePredicate = (filter, cb) => {
|
|
6028
|
+
const operator = filter.operator;
|
|
6029
|
+
switch (operator) {
|
|
6030
|
+
case "And":
|
|
6031
|
+
return {
|
|
6032
|
+
...filter,
|
|
6033
|
+
operands: filter.operands.map((operand) => mapSingleValuePredicate(operand, cb))
|
|
6034
|
+
};
|
|
6035
|
+
case "Or":
|
|
6036
|
+
return {
|
|
6037
|
+
...filter,
|
|
6038
|
+
operands: filter.operands.map((operand) => mapSingleValuePredicate(operand, cb))
|
|
6039
|
+
};
|
|
6040
|
+
case "Not":
|
|
6041
|
+
return {
|
|
6042
|
+
...filter,
|
|
6043
|
+
operand: mapSingleValuePredicate(filter.operand, cb)
|
|
6044
|
+
};
|
|
6045
|
+
default:
|
|
6046
|
+
return cb(filter);
|
|
6047
|
+
}
|
|
6048
|
+
};
|
|
6049
|
+
const mapFilter = (filter, cb) => {
|
|
6050
|
+
return {
|
|
6051
|
+
...filter,
|
|
6052
|
+
predicate: mapSingleValuePredicate(filter.predicate, cb)
|
|
6053
|
+
};
|
|
6054
|
+
};
|
|
6055
|
+
return filters.map((filter) => mapFilter(filter, inSetToOrEqual));
|
|
6056
|
+
}
|
|
6057
|
+
function matchDomain(query, target) {
|
|
6058
|
+
if (query === void 0)
|
|
6059
|
+
return target === void 0;
|
|
6060
|
+
if (target === void 0)
|
|
6061
|
+
return true;
|
|
6062
|
+
for (const k in target) {
|
|
6063
|
+
if (query[k] !== target[k])
|
|
6064
|
+
return false;
|
|
6065
|
+
}
|
|
5320
6066
|
return true;
|
|
5321
6067
|
}
|
|
5322
|
-
function
|
|
5323
|
-
return
|
|
6068
|
+
function transformPColumnData(data) {
|
|
6069
|
+
return mapPObjectData(data, (d) => {
|
|
6070
|
+
if (d instanceof TreeNodeAccessor) {
|
|
6071
|
+
return d.handle;
|
|
6072
|
+
} else if (isDataInfo(d)) {
|
|
6073
|
+
return mapDataInfo(d, (accessor) => accessor.handle);
|
|
6074
|
+
} else {
|
|
6075
|
+
return d;
|
|
6076
|
+
}
|
|
6077
|
+
});
|
|
5324
6078
|
}
|
|
5325
|
-
class
|
|
6079
|
+
class ResultPool {
|
|
5326
6080
|
constructor() {
|
|
5327
|
-
|
|
6081
|
+
__publicField(this, "ctx", getCfgRenderCtx());
|
|
5328
6082
|
}
|
|
5329
6083
|
/**
|
|
5330
6084
|
* @deprecated use getOptions()
|
|
5331
6085
|
*/
|
|
5332
|
-
calculateOptions(
|
|
5333
|
-
return this.ctx.calculateOptions(
|
|
5334
|
-
}
|
|
5335
|
-
getOptions(
|
|
5336
|
-
const
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
6086
|
+
calculateOptions(predicate) {
|
|
6087
|
+
return this.ctx.calculateOptions(predicate);
|
|
6088
|
+
}
|
|
6089
|
+
getOptions(predicateOrSelector, opts) {
|
|
6090
|
+
const predicate = typeof predicateOrSelector === "function" ? predicateOrSelector : selectorsToPredicate(predicateOrSelector);
|
|
6091
|
+
const filtered = this.getSpecs().entries.filter((s) => predicate(s.obj));
|
|
6092
|
+
let labelOps = {};
|
|
6093
|
+
let refsWithEnrichments = false;
|
|
6094
|
+
if (typeof opts !== "undefined") {
|
|
6095
|
+
if (typeof opts === "function") {
|
|
6096
|
+
labelOps = opts;
|
|
6097
|
+
} else if (typeof opts === "object") {
|
|
6098
|
+
if ("includeNativeLabel" in opts || "separator" in opts || "addLabelAsSuffix" in opts) {
|
|
6099
|
+
labelOps = opts;
|
|
6100
|
+
} else {
|
|
6101
|
+
opts = opts;
|
|
6102
|
+
labelOps = opts.label ?? {};
|
|
6103
|
+
refsWithEnrichments = opts.refsWithEnrichments ?? false;
|
|
6104
|
+
}
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6107
|
+
if (typeof labelOps === "object")
|
|
6108
|
+
return deriveLabels(filtered, (o) => o.obj, labelOps ?? {}).map(({ value: { ref }, label }) => ({
|
|
6109
|
+
ref: withEnrichments(ref, refsWithEnrichments),
|
|
6110
|
+
label
|
|
6111
|
+
}));
|
|
6112
|
+
else
|
|
6113
|
+
return filtered.map(({ ref, obj }) => ({
|
|
6114
|
+
ref: withEnrichments(ref, refsWithEnrichments),
|
|
6115
|
+
label: labelOps(obj, ref)
|
|
6116
|
+
}));
|
|
5344
6117
|
}
|
|
5345
|
-
resolveAnchorCtx(
|
|
5346
|
-
if (
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
6118
|
+
resolveAnchorCtx(anchorsOrCtx) {
|
|
6119
|
+
if (anchorsOrCtx instanceof AnchoredIdDeriver)
|
|
6120
|
+
return anchorsOrCtx;
|
|
6121
|
+
const resolvedAnchors = {};
|
|
6122
|
+
for (const [key, value] of Object.entries(anchorsOrCtx)) {
|
|
6123
|
+
if (isPlRef(value)) {
|
|
6124
|
+
const resolvedSpec = this.getPColumnSpecByRef(value);
|
|
6125
|
+
if (!resolvedSpec)
|
|
6126
|
+
return void 0;
|
|
6127
|
+
resolvedAnchors[key] = resolvedSpec;
|
|
6128
|
+
} else {
|
|
6129
|
+
resolvedAnchors[key] = value;
|
|
6130
|
+
}
|
|
6131
|
+
}
|
|
6132
|
+
return new AnchoredIdDeriver(resolvedAnchors);
|
|
5357
6133
|
}
|
|
5358
6134
|
/**
|
|
5359
6135
|
* Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
|
|
@@ -5363,13 +6139,14 @@
|
|
|
5363
6139
|
* @param opts - Optional configuration for label generation and data waiting
|
|
5364
6140
|
* @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
|
|
5365
6141
|
*/
|
|
5366
|
-
getAnchoredPColumns(
|
|
5367
|
-
const
|
|
5368
|
-
if (
|
|
5369
|
-
return
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
6142
|
+
getAnchoredPColumns(anchorsOrCtx, predicateOrSelectors, opts) {
|
|
6143
|
+
const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
|
|
6144
|
+
if (!anchorCtx)
|
|
6145
|
+
return void 0;
|
|
6146
|
+
return new PColumnCollection().addColumnProvider(this).addAxisLabelProvider(this).getColumns(predicateOrSelectors, {
|
|
6147
|
+
...opts,
|
|
6148
|
+
anchorCtx
|
|
6149
|
+
});
|
|
5373
6150
|
}
|
|
5374
6151
|
/**
|
|
5375
6152
|
* Calculates anchored identifier options for columns matching a given predicate and returns their
|
|
@@ -5400,18 +6177,20 @@
|
|
|
5400
6177
|
* @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
|
|
5401
6178
|
* or undefined if any PlRef resolution fails.
|
|
5402
6179
|
*/
|
|
5403
|
-
getCanonicalOptions(
|
|
5404
|
-
const
|
|
5405
|
-
if (!
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
6180
|
+
getCanonicalOptions(anchorsOrCtx, predicateOrSelectors, opts) {
|
|
6181
|
+
const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
|
|
6182
|
+
if (!anchorCtx)
|
|
6183
|
+
return void 0;
|
|
6184
|
+
const entries = new PColumnCollection().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(predicateOrSelectors, {
|
|
6185
|
+
...opts,
|
|
6186
|
+
anchorCtx
|
|
5409
6187
|
});
|
|
5410
|
-
if (
|
|
5411
|
-
return
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
6188
|
+
if (!entries)
|
|
6189
|
+
return void 0;
|
|
6190
|
+
return entries.map((item) => ({
|
|
6191
|
+
value: item.id,
|
|
6192
|
+
label: item.label
|
|
6193
|
+
}));
|
|
5415
6194
|
}
|
|
5416
6195
|
/**
|
|
5417
6196
|
* @deprecated use getData()
|
|
@@ -5420,14 +6199,14 @@
|
|
|
5420
6199
|
return this.getData();
|
|
5421
6200
|
}
|
|
5422
6201
|
getData() {
|
|
5423
|
-
const
|
|
6202
|
+
const result = this.ctx.getDataFromResultPool();
|
|
5424
6203
|
return {
|
|
5425
|
-
isComplete:
|
|
5426
|
-
entries:
|
|
5427
|
-
ref:
|
|
6204
|
+
isComplete: result.isComplete,
|
|
6205
|
+
entries: result.entries.map((e) => ({
|
|
6206
|
+
ref: e.ref,
|
|
5428
6207
|
obj: {
|
|
5429
|
-
...
|
|
5430
|
-
data: new
|
|
6208
|
+
...e.obj,
|
|
6209
|
+
data: new TreeNodeAccessor(e.obj.data, [e.ref.blockId, e.ref.name])
|
|
5431
6210
|
}
|
|
5432
6211
|
}))
|
|
5433
6212
|
};
|
|
@@ -5439,17 +6218,14 @@
|
|
|
5439
6218
|
return this.getDataWithErrors();
|
|
5440
6219
|
}
|
|
5441
6220
|
getDataWithErrors() {
|
|
5442
|
-
const
|
|
6221
|
+
const result = this.ctx.getDataWithErrorsFromResultPool();
|
|
5443
6222
|
return {
|
|
5444
|
-
isComplete:
|
|
5445
|
-
entries:
|
|
5446
|
-
ref:
|
|
6223
|
+
isComplete: result.isComplete,
|
|
6224
|
+
entries: result.entries.map((e) => ({
|
|
6225
|
+
ref: e.ref,
|
|
5447
6226
|
obj: {
|
|
5448
|
-
...
|
|
5449
|
-
data:
|
|
5450
|
-
n2.obj.data,
|
|
5451
|
-
(r) => new I(r, [n2.ref.blockId, n2.ref.name])
|
|
5452
|
-
)
|
|
6227
|
+
...e.obj,
|
|
6228
|
+
data: mapValueInVOE(e.obj.data, (handle) => new TreeNodeAccessor(handle, [e.ref.blockId, e.ref.name]))
|
|
5453
6229
|
}
|
|
5454
6230
|
}))
|
|
5455
6231
|
};
|
|
@@ -5467,89 +6243,106 @@
|
|
|
5467
6243
|
* @param ref a Ref
|
|
5468
6244
|
* @returns data associated with the ref
|
|
5469
6245
|
*/
|
|
5470
|
-
getDataByRef(
|
|
5471
|
-
var
|
|
5472
|
-
if (typeof this.ctx.getDataFromResultPoolByRef
|
|
5473
|
-
return (
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
return Fn(
|
|
5479
|
-
n2,
|
|
5480
|
-
(i) => new I(i, [e.blockId, e.name])
|
|
5481
|
-
);
|
|
6246
|
+
getDataByRef(ref) {
|
|
6247
|
+
var _a;
|
|
6248
|
+
if (typeof this.ctx.getDataFromResultPoolByRef === "undefined")
|
|
6249
|
+
return (_a = this.getData().entries.find((f) => f.ref.blockId === ref.blockId && f.ref.name === ref.name)) == null ? void 0 : _a.obj;
|
|
6250
|
+
const data = this.ctx.getDataFromResultPoolByRef(ref.blockId, ref.name);
|
|
6251
|
+
if (!data)
|
|
6252
|
+
return void 0;
|
|
6253
|
+
return mapPObjectData(data, (handle) => new TreeNodeAccessor(handle, [ref.blockId, ref.name]));
|
|
5482
6254
|
}
|
|
5483
6255
|
/**
|
|
5484
6256
|
* Returns data associated with the ref ensuring that it is a p-column.
|
|
5485
6257
|
* @param ref a Ref
|
|
5486
6258
|
* @returns p-column associated with the ref
|
|
5487
6259
|
*/
|
|
5488
|
-
getPColumnByRef(
|
|
5489
|
-
const
|
|
5490
|
-
if (
|
|
5491
|
-
return
|
|
6260
|
+
getPColumnByRef(ref) {
|
|
6261
|
+
const data = this.getDataByRef(ref);
|
|
6262
|
+
if (!data)
|
|
6263
|
+
return void 0;
|
|
6264
|
+
return ensurePColumn(data);
|
|
5492
6265
|
}
|
|
5493
6266
|
/**
|
|
5494
6267
|
* Returns spec associated with the ref ensuring that it is a p-column spec.
|
|
5495
6268
|
* @param ref a Ref
|
|
5496
6269
|
* @returns p-column spec associated with the ref
|
|
5497
6270
|
*/
|
|
5498
|
-
getPColumnSpecByRef(
|
|
5499
|
-
const
|
|
5500
|
-
if (
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
6271
|
+
getPColumnSpecByRef(ref) {
|
|
6272
|
+
const spec = this.getSpecByRef(ref);
|
|
6273
|
+
if (!spec)
|
|
6274
|
+
return void 0;
|
|
6275
|
+
if (!isPColumnSpec(spec))
|
|
6276
|
+
throw new Error(`not a PColumn spec (kind = ${spec.kind})`);
|
|
6277
|
+
return spec;
|
|
5504
6278
|
}
|
|
5505
6279
|
/**
|
|
5506
6280
|
* @param ref a Ref
|
|
5507
6281
|
* @returns object spec associated with the ref
|
|
5508
6282
|
*/
|
|
5509
|
-
getSpecByRef(
|
|
5510
|
-
return this.ctx.getSpecFromResultPoolByRef(
|
|
6283
|
+
getSpecByRef(ref) {
|
|
6284
|
+
return this.ctx.getSpecFromResultPoolByRef(ref.blockId, ref.name);
|
|
5511
6285
|
}
|
|
5512
6286
|
/**
|
|
5513
6287
|
* @param spec object specification
|
|
5514
6288
|
* @returns array of data objects with compatible specs
|
|
5515
6289
|
* @deprecated delete this method after Jan 1, 2025
|
|
5516
6290
|
*/
|
|
5517
|
-
findDataWithCompatibleSpec(
|
|
5518
|
-
const
|
|
5519
|
-
|
|
5520
|
-
if (!
|
|
6291
|
+
findDataWithCompatibleSpec(spec) {
|
|
6292
|
+
const result = [];
|
|
6293
|
+
out: for (const data of this.getData().entries) {
|
|
6294
|
+
if (!isPColumnSpec(data.obj.spec)) {
|
|
6295
|
+
continue;
|
|
6296
|
+
}
|
|
6297
|
+
const oth = data.obj.spec;
|
|
6298
|
+
if (spec.name !== oth.name) {
|
|
5521
6299
|
continue;
|
|
5522
|
-
|
|
5523
|
-
if (
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
6300
|
+
}
|
|
6301
|
+
if (spec.valueType !== oth.valueType) {
|
|
6302
|
+
continue;
|
|
6303
|
+
}
|
|
6304
|
+
if (spec.axesSpec.length !== oth.axesSpec.length) {
|
|
6305
|
+
continue;
|
|
6306
|
+
}
|
|
6307
|
+
if (!matchDomain(spec.domain, oth.domain)) {
|
|
6308
|
+
continue;
|
|
6309
|
+
}
|
|
6310
|
+
for (let i = 0; i < spec.axesSpec.length; ++i) {
|
|
6311
|
+
const qAx = spec.axesSpec[i];
|
|
6312
|
+
const tAx = oth.axesSpec[i];
|
|
6313
|
+
if (qAx.name !== tAx.name) {
|
|
6314
|
+
continue out;
|
|
6315
|
+
}
|
|
6316
|
+
if (qAx.type !== tAx.type) {
|
|
6317
|
+
continue out;
|
|
6318
|
+
}
|
|
6319
|
+
if (!matchDomain(qAx.domain, tAx.domain)) {
|
|
6320
|
+
continue out;
|
|
5528
6321
|
}
|
|
5529
|
-
n2.push(r.obj);
|
|
5530
6322
|
}
|
|
6323
|
+
result.push(data.obj);
|
|
5531
6324
|
}
|
|
5532
|
-
return
|
|
6325
|
+
return result;
|
|
5533
6326
|
}
|
|
5534
6327
|
/**
|
|
5535
6328
|
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
5536
6329
|
* @returns a map of axis value => label
|
|
5537
6330
|
*/
|
|
5538
|
-
findLabels(
|
|
5539
|
-
const
|
|
5540
|
-
for (const
|
|
5541
|
-
if (!
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
);
|
|
6331
|
+
findLabels(axis) {
|
|
6332
|
+
const dataPool = this.getData();
|
|
6333
|
+
for (const column of dataPool.entries) {
|
|
6334
|
+
if (!isPColumn(column.obj))
|
|
6335
|
+
continue;
|
|
6336
|
+
const spec = column.obj.spec;
|
|
6337
|
+
if (spec.name === PColumnName.Label && spec.axesSpec.length === 1 && spec.axesSpec[0].name === axis.name && spec.axesSpec[0].type === axis.type && matchDomain(axis.domain, spec.axesSpec[0].domain)) {
|
|
6338
|
+
if (column.obj.data.resourceType.name !== "PColumnData/Json") {
|
|
6339
|
+
throw Error(`Expected JSON column for labels, got: ${column.obj.data.resourceType.name}`);
|
|
6340
|
+
}
|
|
6341
|
+
const labels = Object.fromEntries(Object.entries(column.obj.data.getDataAsJson().data).map((e) => [JSON.parse(e[0])[0], e[1]]));
|
|
6342
|
+
return labels;
|
|
5551
6343
|
}
|
|
5552
6344
|
}
|
|
6345
|
+
return void 0;
|
|
5553
6346
|
}
|
|
5554
6347
|
/**
|
|
5555
6348
|
* Selects columns based on the provided selectors, returning PColumn objects
|
|
@@ -5558,18 +6351,27 @@
|
|
|
5558
6351
|
* @param selectors - A predicate function, a single selector, or an array of selectors.
|
|
5559
6352
|
* @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
|
|
5560
6353
|
*/
|
|
5561
|
-
selectColumns(
|
|
5562
|
-
const
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
6354
|
+
selectColumns(selectors) {
|
|
6355
|
+
const predicate = typeof selectors === "function" ? selectors : selectorsToPredicate(selectors);
|
|
6356
|
+
const matchedSpecs = this.getSpecs().entries.filter(({ obj: spec }) => {
|
|
6357
|
+
if (!isPColumnSpec(spec))
|
|
6358
|
+
return false;
|
|
6359
|
+
return predicate(spec);
|
|
6360
|
+
});
|
|
6361
|
+
return matchedSpecs.map(({ ref, obj: spec }) => {
|
|
6362
|
+
const pcolumnSpec = spec;
|
|
6363
|
+
let _cachedData = null;
|
|
6364
|
+
const self2 = this;
|
|
5567
6365
|
return {
|
|
5568
|
-
id:
|
|
5569
|
-
spec:
|
|
6366
|
+
id: canonicalize(ref),
|
|
6367
|
+
spec: pcolumnSpec,
|
|
5570
6368
|
get data() {
|
|
5571
|
-
var
|
|
5572
|
-
|
|
6369
|
+
var _a;
|
|
6370
|
+
if (_cachedData !== null) {
|
|
6371
|
+
return _cachedData;
|
|
6372
|
+
}
|
|
6373
|
+
_cachedData = (_a = self2.getPColumnByRef(ref)) == null ? void 0 : _a.data;
|
|
6374
|
+
return _cachedData;
|
|
5573
6375
|
}
|
|
5574
6376
|
};
|
|
5575
6377
|
});
|
|
@@ -5578,458 +6380,646 @@
|
|
|
5578
6380
|
* Find labels data for a given axis id of a p-column.
|
|
5579
6381
|
* @returns a map of axis value => label
|
|
5580
6382
|
*/
|
|
5581
|
-
findLabelsForColumnAxis(
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
const
|
|
5586
|
-
if (
|
|
5587
|
-
const
|
|
5588
|
-
return Object.fromEntries(
|
|
5589
|
-
|
|
5590
|
-
|
|
6383
|
+
findLabelsForColumnAxis(column, axisIdx) {
|
|
6384
|
+
const labels = this.findLabels(column.axesSpec[axisIdx]);
|
|
6385
|
+
if (!labels)
|
|
6386
|
+
return void 0;
|
|
6387
|
+
const axisKeys = readAnnotation(column, `pl7.app/axisKeys/${axisIdx}`);
|
|
6388
|
+
if (axisKeys !== void 0) {
|
|
6389
|
+
const keys = JSON.parse(axisKeys);
|
|
6390
|
+
return Object.fromEntries(keys.map((key) => {
|
|
6391
|
+
return [key, labels[key] ?? "Unlabelled"];
|
|
6392
|
+
}));
|
|
6393
|
+
} else {
|
|
6394
|
+
return labels;
|
|
6395
|
+
}
|
|
5591
6396
|
}
|
|
5592
6397
|
}
|
|
5593
|
-
class
|
|
6398
|
+
class RenderCtx {
|
|
5594
6399
|
constructor() {
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
this
|
|
6400
|
+
__publicField(this, "ctx");
|
|
6401
|
+
__publicField(this, "_argsCache");
|
|
6402
|
+
__publicField(this, "_uiStateCache");
|
|
6403
|
+
// lazy rendering because this feature is rarely used
|
|
6404
|
+
__publicField(this, "_activeArgsCache");
|
|
6405
|
+
__publicField(this, "resultPool", new ResultPool());
|
|
6406
|
+
this.ctx = getCfgRenderCtx();
|
|
6407
|
+
}
|
|
6408
|
+
get args() {
|
|
6409
|
+
if (this._argsCache === void 0) {
|
|
6410
|
+
const raw = this.ctx.args;
|
|
6411
|
+
const value = typeof raw === "function" ? raw() : raw;
|
|
6412
|
+
this._argsCache = { v: JSON.parse(value) };
|
|
6413
|
+
}
|
|
6414
|
+
return this._argsCache.v;
|
|
6415
|
+
}
|
|
6416
|
+
get uiState() {
|
|
6417
|
+
if (this._uiStateCache === void 0) {
|
|
6418
|
+
const raw = this.ctx.uiState;
|
|
6419
|
+
const value = typeof raw === "function" ? raw() : raw;
|
|
6420
|
+
this._uiStateCache = { v: value ? JSON.parse(value) : {} };
|
|
6421
|
+
}
|
|
6422
|
+
return this._uiStateCache.v;
|
|
5601
6423
|
}
|
|
5602
6424
|
/**
|
|
5603
6425
|
* Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
|
|
5604
6426
|
* Returns undefined, if block was never executed or stopped mid-way execution, so that the result was cleared.
|
|
5605
6427
|
* */
|
|
5606
6428
|
get activeArgs() {
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
6429
|
+
if (this._activeArgsCache === void 0) {
|
|
6430
|
+
const raw = this.ctx.activeArgs;
|
|
6431
|
+
const value = typeof raw === "function" ? raw() : raw;
|
|
6432
|
+
this._activeArgsCache = {
|
|
6433
|
+
v: value ? JSON.parse(value) : void 0
|
|
6434
|
+
};
|
|
6435
|
+
}
|
|
6436
|
+
return this._activeArgsCache.v;
|
|
5610
6437
|
}
|
|
5611
6438
|
// /** Can be used to determine features provided by the desktop instance. */
|
|
5612
6439
|
// public get featureFlags() {
|
|
5613
6440
|
// return this.ctx.featureFlags;
|
|
5614
6441
|
// }
|
|
5615
|
-
getNamedAccessor(
|
|
5616
|
-
return
|
|
5617
|
-
this.ctx.getAccessorHandleByName(e),
|
|
5618
|
-
(n2) => new I(n2, [e])
|
|
5619
|
-
);
|
|
6442
|
+
getNamedAccessor(name) {
|
|
6443
|
+
return ifDef(this.ctx.getAccessorHandleByName(name), (accessor) => new TreeNodeAccessor(accessor, [name]));
|
|
5620
6444
|
}
|
|
5621
6445
|
get prerun() {
|
|
5622
|
-
return this.getNamedAccessor(
|
|
6446
|
+
return this.getNamedAccessor(StagingAccessorName);
|
|
5623
6447
|
}
|
|
5624
6448
|
get outputs() {
|
|
5625
|
-
return this.getNamedAccessor(
|
|
6449
|
+
return this.getNamedAccessor(MainAccessorName);
|
|
5626
6450
|
}
|
|
5627
6451
|
/**
|
|
5628
6452
|
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
5629
6453
|
* @returns a map of axis value => label
|
|
5630
6454
|
* @deprecated Use resultPool.findLabels instead
|
|
5631
6455
|
*/
|
|
5632
|
-
findLabels(
|
|
5633
|
-
return this.resultPool.findLabels(
|
|
6456
|
+
findLabels(axis) {
|
|
6457
|
+
return this.resultPool.findLabels(axis);
|
|
5634
6458
|
}
|
|
5635
|
-
verifyInlineAndExplicitColumnsSupport(
|
|
5636
|
-
var
|
|
5637
|
-
const
|
|
5638
|
-
|
|
6459
|
+
verifyInlineAndExplicitColumnsSupport(columns) {
|
|
6460
|
+
var _a;
|
|
6461
|
+
const hasInlineColumns = columns.some((c) => !(c.data instanceof TreeNodeAccessor) || isDataInfo(c.data));
|
|
6462
|
+
const inlineColumnsSupport = ((_a = this.ctx.featureFlags) == null ? void 0 : _a.inlineColumnsSupport) === true;
|
|
6463
|
+
if (hasInlineColumns && !inlineColumnsSupport)
|
|
6464
|
+
throw Error(`Inline or explicit columns not supported`);
|
|
6465
|
+
}
|
|
6466
|
+
patchPTableDef(def) {
|
|
6467
|
+
var _a, _b;
|
|
6468
|
+
if (!((_a = this.ctx.featureFlags) == null ? void 0 : _a.pTablePartitionFiltersSupport)) {
|
|
6469
|
+
def = {
|
|
6470
|
+
...def,
|
|
6471
|
+
partitionFilters: [],
|
|
6472
|
+
filters: [...def.partitionFilters, ...def.filters]
|
|
6473
|
+
};
|
|
6474
|
+
}
|
|
6475
|
+
if (!((_b = this.ctx.featureFlags) == null ? void 0 : _b.pFrameInSetFilterSupport)) {
|
|
6476
|
+
def = {
|
|
6477
|
+
...def,
|
|
6478
|
+
partitionFilters: patchInSetFilters(def.partitionFilters),
|
|
6479
|
+
filters: patchInSetFilters(def.filters)
|
|
6480
|
+
};
|
|
6481
|
+
}
|
|
6482
|
+
return def;
|
|
5639
6483
|
}
|
|
5640
6484
|
// TODO remove all non-PColumn fields
|
|
5641
|
-
createPFrame(
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
6485
|
+
createPFrame(def) {
|
|
6486
|
+
this.verifyInlineAndExplicitColumnsSupport(def);
|
|
6487
|
+
return this.ctx.createPFrame(def.map((c) => transformPColumnData(c)));
|
|
6488
|
+
}
|
|
6489
|
+
createPTable(def) {
|
|
6490
|
+
let rawDef;
|
|
6491
|
+
if ("columns" in def) {
|
|
6492
|
+
rawDef = this.patchPTableDef({
|
|
6493
|
+
src: {
|
|
6494
|
+
type: "full",
|
|
6495
|
+
entries: def.columns.map((c) => ({ type: "column", column: c }))
|
|
6496
|
+
},
|
|
6497
|
+
partitionFilters: def.filters ?? [],
|
|
6498
|
+
filters: [],
|
|
6499
|
+
sorting: def.sorting ?? []
|
|
6500
|
+
});
|
|
6501
|
+
} else {
|
|
6502
|
+
rawDef = this.patchPTableDef(def);
|
|
6503
|
+
}
|
|
6504
|
+
this.verifyInlineAndExplicitColumnsSupport(extractAllColumns(rawDef.src));
|
|
6505
|
+
return this.ctx.createPTable(mapPTableDef(rawDef, (po) => transformPColumnData(po)));
|
|
5658
6506
|
}
|
|
5659
6507
|
/** @deprecated scheduled for removal from SDK */
|
|
5660
|
-
getBlockLabel(
|
|
5661
|
-
return this.ctx.getBlockLabel(
|
|
6508
|
+
getBlockLabel(blockId) {
|
|
6509
|
+
return this.ctx.getBlockLabel(blockId);
|
|
5662
6510
|
}
|
|
5663
6511
|
getCurrentUnstableMarker() {
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
}
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
6512
|
+
return this.ctx.getCurrentUnstableMarker();
|
|
6513
|
+
}
|
|
6514
|
+
logInfo(msg) {
|
|
6515
|
+
this.ctx.logInfo(msg);
|
|
6516
|
+
}
|
|
6517
|
+
logWarn(msg) {
|
|
6518
|
+
this.ctx.logWarn(msg);
|
|
6519
|
+
}
|
|
6520
|
+
logError(msg) {
|
|
6521
|
+
this.ctx.logError(msg);
|
|
6522
|
+
}
|
|
6523
|
+
}
|
|
6524
|
+
var version = "1.42.20";
|
|
6525
|
+
const PlatformaSDKVersion = version;
|
|
6526
|
+
function isConfigLambda(cfgOrFh) {
|
|
6527
|
+
return cfgOrFh.__renderLambda === true;
|
|
6528
|
+
}
|
|
6529
|
+
function downgradeCfgOrLambda(data) {
|
|
6530
|
+
if (data === void 0)
|
|
6531
|
+
return void 0;
|
|
6532
|
+
if (isConfigLambda(data))
|
|
6533
|
+
return data.handle;
|
|
6534
|
+
return data;
|
|
6535
|
+
}
|
|
6536
|
+
const _BlockModel = class _BlockModel {
|
|
6537
|
+
constructor(_renderingMode, _initialArgs, _initialUiState, _outputs, _inputsValid, _sections, _title, _enrichmentTargets, _featureFlags) {
|
|
6538
|
+
__publicField(this, "_renderingMode");
|
|
6539
|
+
__publicField(this, "_initialArgs");
|
|
6540
|
+
__publicField(this, "_initialUiState");
|
|
6541
|
+
__publicField(this, "_outputs");
|
|
6542
|
+
__publicField(this, "_inputsValid");
|
|
6543
|
+
__publicField(this, "_sections");
|
|
6544
|
+
__publicField(this, "_title");
|
|
6545
|
+
__publicField(this, "_enrichmentTargets");
|
|
6546
|
+
__publicField(this, "_featureFlags");
|
|
6547
|
+
this._renderingMode = _renderingMode;
|
|
6548
|
+
this._initialArgs = _initialArgs;
|
|
6549
|
+
this._initialUiState = _initialUiState;
|
|
6550
|
+
this._outputs = _outputs;
|
|
6551
|
+
this._inputsValid = _inputsValid;
|
|
6552
|
+
this._sections = _sections;
|
|
6553
|
+
this._title = _title;
|
|
6554
|
+
this._enrichmentTargets = _enrichmentTargets;
|
|
6555
|
+
this._featureFlags = _featureFlags;
|
|
6556
|
+
}
|
|
6557
|
+
static create(renderingMode = "Heavy") {
|
|
6558
|
+
return new _BlockModel(renderingMode, void 0, {}, {}, getImmediate(true), getImmediate([]), void 0, void 0, { ..._BlockModel.INITIAL_BLOCK_FEATURE_FLAGS });
|
|
6559
|
+
}
|
|
6560
|
+
output(key, cfgOrRf, flags = {}) {
|
|
6561
|
+
if (typeof cfgOrRf === "function") {
|
|
6562
|
+
const handle = `output#${key}`;
|
|
6563
|
+
tryRegisterCallback(handle, () => cfgOrRf(new RenderCtx()));
|
|
6564
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
|
|
6565
|
+
...this._outputs,
|
|
6566
|
+
[key]: {
|
|
6567
|
+
__renderLambda: true,
|
|
6568
|
+
handle,
|
|
6569
|
+
...flags
|
|
6570
|
+
}
|
|
6571
|
+
}, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5710
6572
|
} else
|
|
5711
|
-
return new
|
|
5712
|
-
this.
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
{
|
|
5716
|
-
...this._outputs,
|
|
5717
|
-
[e]: n2
|
|
5718
|
-
},
|
|
5719
|
-
this._inputsValid,
|
|
5720
|
-
this._sections,
|
|
5721
|
-
this._title
|
|
5722
|
-
);
|
|
6573
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
|
|
6574
|
+
...this._outputs,
|
|
6575
|
+
[key]: cfgOrRf
|
|
6576
|
+
}, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5723
6577
|
}
|
|
5724
6578
|
/** Shortcut for {@link output} with retentive flag set to true. */
|
|
5725
|
-
retentiveOutput(
|
|
5726
|
-
return this.output(
|
|
5727
|
-
}
|
|
5728
|
-
argsValid(
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
this._initialArgs,
|
|
5732
|
-
this._initialUiState,
|
|
5733
|
-
this._outputs,
|
|
5734
|
-
{
|
|
6579
|
+
retentiveOutput(key, rf) {
|
|
6580
|
+
return this.output(key, rf, { retentive: true });
|
|
6581
|
+
}
|
|
6582
|
+
argsValid(cfgOrRf) {
|
|
6583
|
+
if (typeof cfgOrRf === "function") {
|
|
6584
|
+
tryRegisterCallback("inputsValid", () => cfgOrRf(new RenderCtx()));
|
|
6585
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, {
|
|
5735
6586
|
__renderLambda: true,
|
|
5736
6587
|
handle: "inputsValid"
|
|
5737
|
-
},
|
|
5738
|
-
|
|
5739
|
-
this._title
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
this.
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
this.
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
}
|
|
5750
|
-
sections(e) {
|
|
5751
|
-
return Array.isArray(e) ? this.sections(Z(e)) : typeof e == "function" ? (Y("sections", () => e(new X())), new T(
|
|
5752
|
-
this._renderingMode,
|
|
5753
|
-
this._initialArgs,
|
|
5754
|
-
this._initialUiState,
|
|
5755
|
-
this._outputs,
|
|
5756
|
-
this._inputsValid,
|
|
5757
|
-
{ __renderLambda: true, handle: "sections" },
|
|
5758
|
-
this._title
|
|
5759
|
-
)) : new T(
|
|
5760
|
-
this._renderingMode,
|
|
5761
|
-
this._initialArgs,
|
|
5762
|
-
this._initialUiState,
|
|
5763
|
-
this._outputs,
|
|
5764
|
-
this._inputsValid,
|
|
5765
|
-
e,
|
|
5766
|
-
this._title
|
|
5767
|
-
);
|
|
6588
|
+
}, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6589
|
+
} else
|
|
6590
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, cfgOrRf, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6591
|
+
}
|
|
6592
|
+
sections(arrOrCfgOrRf) {
|
|
6593
|
+
if (Array.isArray(arrOrCfgOrRf)) {
|
|
6594
|
+
return this.sections(getImmediate(arrOrCfgOrRf));
|
|
6595
|
+
} else if (typeof arrOrCfgOrRf === "function") {
|
|
6596
|
+
tryRegisterCallback("sections", () => arrOrCfgOrRf(new RenderCtx()));
|
|
6597
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, { __renderLambda: true, handle: "sections" }, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6598
|
+
} else
|
|
6599
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, arrOrCfgOrRf, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5768
6600
|
}
|
|
5769
6601
|
/** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
|
|
5770
|
-
title(
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
this._initialArgs,
|
|
5774
|
-
this._initialUiState,
|
|
5775
|
-
this._outputs,
|
|
5776
|
-
this._inputsValid,
|
|
5777
|
-
this._sections,
|
|
5778
|
-
{ __renderLambda: true, handle: "title" }
|
|
5779
|
-
);
|
|
6602
|
+
title(rf) {
|
|
6603
|
+
tryRegisterCallback("title", () => rf(new RenderCtx()));
|
|
6604
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, { __renderLambda: true, handle: "title" }, this._enrichmentTargets, this._featureFlags);
|
|
5780
6605
|
}
|
|
5781
6606
|
/**
|
|
5782
6607
|
* Sets initial args for the block, this value must be specified.
|
|
5783
6608
|
* @deprecated use {@link withArgs}
|
|
5784
6609
|
* */
|
|
5785
|
-
initialArgs(
|
|
5786
|
-
return new
|
|
5787
|
-
this._renderingMode,
|
|
5788
|
-
e,
|
|
5789
|
-
this._initialUiState,
|
|
5790
|
-
this._outputs,
|
|
5791
|
-
this._inputsValid,
|
|
5792
|
-
this._sections,
|
|
5793
|
-
this._title
|
|
5794
|
-
);
|
|
6610
|
+
initialArgs(value) {
|
|
6611
|
+
return new _BlockModel(this._renderingMode, value, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5795
6612
|
}
|
|
5796
6613
|
/** Sets initial args for the block, this value must be specified. */
|
|
5797
|
-
withArgs(
|
|
5798
|
-
return new
|
|
5799
|
-
this._renderingMode,
|
|
5800
|
-
e,
|
|
5801
|
-
this._initialUiState,
|
|
5802
|
-
this._outputs,
|
|
5803
|
-
this._inputsValid,
|
|
5804
|
-
this._sections,
|
|
5805
|
-
this._title
|
|
5806
|
-
);
|
|
6614
|
+
withArgs(initialValue) {
|
|
6615
|
+
return new _BlockModel(this._renderingMode, initialValue, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5807
6616
|
}
|
|
5808
6617
|
/** Defines type and sets initial value for block UiState. */
|
|
5809
|
-
withUiState(
|
|
5810
|
-
return new
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
6618
|
+
withUiState(initialValue) {
|
|
6619
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, initialValue, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6620
|
+
}
|
|
6621
|
+
/** Sets or overrides feature flags for the block. */
|
|
6622
|
+
withFeatureFlags(flags) {
|
|
6623
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, { ...this._featureFlags, ...flags });
|
|
6624
|
+
}
|
|
6625
|
+
/**
|
|
6626
|
+
* Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
|
|
6627
|
+
* Influences dependency graph construction.
|
|
6628
|
+
*/
|
|
6629
|
+
enriches(lambda) {
|
|
6630
|
+
tryRegisterCallback("enrichmentTargets", lambda);
|
|
6631
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, { __renderLambda: true, handle: "enrichmentTargets" }, this._featureFlags);
|
|
5819
6632
|
}
|
|
5820
6633
|
/** Renders all provided block settings into a pre-configured platforma API
|
|
5821
6634
|
* instance, that can be used in frontend to interact with block state, and
|
|
5822
6635
|
* other features provided by the platforma to the block. */
|
|
5823
|
-
done() {
|
|
5824
|
-
|
|
5825
|
-
|
|
6636
|
+
done(apiVersion) {
|
|
6637
|
+
const requiresUIAPIVersion = apiVersion ?? 1;
|
|
6638
|
+
return this.withFeatureFlags({
|
|
6639
|
+
...this._featureFlags,
|
|
6640
|
+
requiresUIAPIVersion
|
|
6641
|
+
})._done(requiresUIAPIVersion);
|
|
6642
|
+
}
|
|
6643
|
+
_done(apiVersion) {
|
|
6644
|
+
if (this._initialArgs === void 0)
|
|
6645
|
+
throw new Error("Initial arguments not set.");
|
|
6646
|
+
const config = {
|
|
5826
6647
|
v3: {
|
|
5827
|
-
sdkVersion:
|
|
6648
|
+
sdkVersion: PlatformaSDKVersion,
|
|
5828
6649
|
renderingMode: this._renderingMode,
|
|
5829
6650
|
initialArgs: this._initialArgs,
|
|
5830
6651
|
initialUiState: this._initialUiState,
|
|
5831
6652
|
inputsValid: this._inputsValid,
|
|
5832
6653
|
sections: this._sections,
|
|
5833
6654
|
title: this._title,
|
|
5834
|
-
outputs: this._outputs
|
|
6655
|
+
outputs: this._outputs,
|
|
6656
|
+
enrichmentTargets: this._enrichmentTargets,
|
|
6657
|
+
featureFlags: this._featureFlags
|
|
5835
6658
|
},
|
|
5836
6659
|
// fields below are added to allow previous desktop versions read generated configs
|
|
5837
|
-
sdkVersion:
|
|
6660
|
+
sdkVersion: PlatformaSDKVersion,
|
|
5838
6661
|
renderingMode: this._renderingMode,
|
|
5839
6662
|
initialArgs: this._initialArgs,
|
|
5840
|
-
inputsValid:
|
|
5841
|
-
sections:
|
|
5842
|
-
outputs: Object.fromEntries(
|
|
5843
|
-
Object.entries(this._outputs).map(([n2, r]) => [n2, ue(r)])
|
|
5844
|
-
)
|
|
6663
|
+
inputsValid: downgradeCfgOrLambda(this._inputsValid),
|
|
6664
|
+
sections: downgradeCfgOrLambda(this._sections),
|
|
6665
|
+
outputs: Object.fromEntries(Object.entries(this._outputs).map(([key, value]) => [key, downgradeCfgOrLambda(value)]))
|
|
5845
6666
|
};
|
|
5846
|
-
|
|
6667
|
+
globalThis.platformaApiVersion = apiVersion;
|
|
6668
|
+
if (!isInUI())
|
|
6669
|
+
return { config };
|
|
6670
|
+
else
|
|
6671
|
+
return getPlatformaInstance({ sdkVersion: PlatformaSDKVersion, apiVersion: platformaApiVersion });
|
|
5847
6672
|
}
|
|
5848
|
-
}
|
|
5849
|
-
const Et = (t, e) => {
|
|
5850
|
-
let n2 = t.toString();
|
|
5851
|
-
return e == null || e.forEach((r) => {
|
|
5852
|
-
if (r)
|
|
5853
|
-
for (const [i, s2] of Object.entries(r))
|
|
5854
|
-
n2 += i, n2 += s2;
|
|
5855
|
-
}), n2;
|
|
5856
6673
|
};
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
if (
|
|
5880
|
-
return [];
|
|
5881
|
-
if (!Je(t, e))
|
|
6674
|
+
__publicField(_BlockModel, "INITIAL_BLOCK_FEATURE_FLAGS", {
|
|
6675
|
+
supportsLazyState: true,
|
|
6676
|
+
requiresUIAPIVersion: 1,
|
|
6677
|
+
requiresModelAPIVersion: 1
|
|
6678
|
+
});
|
|
6679
|
+
let BlockModel = _BlockModel;
|
|
6680
|
+
function isLabelColumn(column) {
|
|
6681
|
+
return column.axesSpec.length === 1 && column.name === PColumnName.Label;
|
|
6682
|
+
}
|
|
6683
|
+
const colId = (id, domains) => {
|
|
6684
|
+
let wid = id.toString();
|
|
6685
|
+
domains == null ? void 0 : domains.forEach((domain) => {
|
|
6686
|
+
if (domain) {
|
|
6687
|
+
for (const [k, v] of Object.entries(domain)) {
|
|
6688
|
+
wid += k;
|
|
6689
|
+
wid += v;
|
|
6690
|
+
}
|
|
6691
|
+
}
|
|
6692
|
+
});
|
|
6693
|
+
return wid;
|
|
6694
|
+
};
|
|
6695
|
+
function getKeysCombinations(idsLists) {
|
|
6696
|
+
if (!idsLists.length) {
|
|
5882
6697
|
return [];
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
6698
|
+
}
|
|
6699
|
+
let result = [[]];
|
|
6700
|
+
idsLists.forEach((list) => {
|
|
6701
|
+
const nextResult = [];
|
|
6702
|
+
list.forEach((key) => {
|
|
6703
|
+
nextResult.push(...result.map((resultItem) => [...resultItem, key]));
|
|
6704
|
+
});
|
|
6705
|
+
result = nextResult;
|
|
6706
|
+
});
|
|
6707
|
+
return result;
|
|
6708
|
+
}
|
|
6709
|
+
function isLinkerColumn(column) {
|
|
6710
|
+
return !!readAnnotationJson(column, Annotation.IsLinkerColumn);
|
|
6711
|
+
}
|
|
6712
|
+
function getAvailableWithLinkersAxes(linkerColumns, blockAxes) {
|
|
6713
|
+
const linkerMap = LinkerMap.fromColumns(linkerColumns.map(getColumnIdAndSpec));
|
|
6714
|
+
const startKeys = [];
|
|
6715
|
+
const blockAxesGrouped = [...blockAxes.values()].map((axis) => getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));
|
|
6716
|
+
for (const axesGroupBlock of blockAxesGrouped) {
|
|
6717
|
+
const matched = linkerMap.keyAxesIds.find((keyIds) => keyIds.every((keySourceAxis) => axesGroupBlock.find((axisSpecFromBlock) => matchAxisId(axisSpecFromBlock, keySourceAxis))));
|
|
6718
|
+
if (matched) {
|
|
6719
|
+
startKeys.push(canonicalizeJson(matched));
|
|
6720
|
+
}
|
|
6721
|
+
}
|
|
6722
|
+
const availableKeys = linkerMap.searchAvailableAxesKeys(startKeys);
|
|
6723
|
+
const availableAxes = linkerMap.getAxesListFromKeysList([...availableKeys]);
|
|
6724
|
+
return new Map(availableAxes.map((axisSpec) => {
|
|
6725
|
+
const id = getAxisId(axisSpec);
|
|
6726
|
+
return [canonicalizeJson(id), axisSpec];
|
|
6727
|
+
}));
|
|
6728
|
+
}
|
|
6729
|
+
function enrichCompatible(blockAxes, columns) {
|
|
6730
|
+
const result = [];
|
|
6731
|
+
columns.forEach((column) => {
|
|
6732
|
+
result.push(...getAdditionalColumnsForColumn(blockAxes, column));
|
|
6733
|
+
});
|
|
6734
|
+
return result;
|
|
6735
|
+
}
|
|
6736
|
+
function getAdditionalColumnsForColumn(blockAxes, column) {
|
|
6737
|
+
const columnAxesIds = column.spec.axesSpec.map(getAxisId);
|
|
6738
|
+
if (columnAxesIds.every((id) => blockAxes.has(canonicalizeJson(id)))) {
|
|
6739
|
+
return [column];
|
|
6740
|
+
}
|
|
6741
|
+
const secondaryIdsOptions = columnAxesIds.map((id) => {
|
|
6742
|
+
const result = [];
|
|
6743
|
+
for (const [_, mainId] of blockAxes) {
|
|
6744
|
+
if (matchAxisId(mainId, id) && !matchAxisId(id, mainId)) {
|
|
6745
|
+
result.push(mainId);
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
return result;
|
|
6749
|
+
});
|
|
6750
|
+
const secondaryIdsVariants = getKeysCombinations(secondaryIdsOptions);
|
|
6751
|
+
const allAddedDomainValues = /* @__PURE__ */ new Set();
|
|
6752
|
+
const addedNotToAllVariantsDomainValues = /* @__PURE__ */ new Set();
|
|
6753
|
+
const addedByVariantsDomainValues = secondaryIdsVariants.map((idsList) => {
|
|
6754
|
+
const addedSet = /* @__PURE__ */ new Set();
|
|
6755
|
+
idsList.map((axisId, idx) => {
|
|
6756
|
+
const d1 = column.spec.axesSpec[idx].domain;
|
|
6757
|
+
const d2 = axisId.domain;
|
|
6758
|
+
Object.entries(d2 ?? {}).forEach(([key, value]) => {
|
|
6759
|
+
if ((d1 == null ? void 0 : d1[key]) === void 0) {
|
|
6760
|
+
const item = JSON.stringify([key, value]);
|
|
6761
|
+
addedSet.add(item);
|
|
6762
|
+
allAddedDomainValues.add(item);
|
|
5891
6763
|
}
|
|
5892
|
-
})
|
|
5893
|
-
|
|
5894
|
-
|
|
6764
|
+
});
|
|
6765
|
+
return {
|
|
6766
|
+
...axisId,
|
|
6767
|
+
annotations: column.spec.axesSpec[idx].annotations
|
|
5895
6768
|
};
|
|
5896
|
-
})
|
|
6769
|
+
});
|
|
6770
|
+
return addedSet;
|
|
6771
|
+
});
|
|
6772
|
+
[...allAddedDomainValues].forEach((addedPart) => {
|
|
6773
|
+
if (addedByVariantsDomainValues.some((s) => !s.has(addedPart))) {
|
|
6774
|
+
addedNotToAllVariantsDomainValues.add(addedPart);
|
|
6775
|
+
}
|
|
5897
6776
|
});
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
...
|
|
5907
|
-
[
|
|
6777
|
+
const additionalColumns = secondaryIdsVariants.map((idsList, idx) => {
|
|
6778
|
+
const id = colId(column.id, idsList.map((id2) => id2.domain));
|
|
6779
|
+
const label = readAnnotation(column.spec, Annotation.Label) ?? "";
|
|
6780
|
+
const labelDomainPart = [...addedByVariantsDomainValues[idx]].filter((str) => addedNotToAllVariantsDomainValues.has(str)).sort().map((v) => {
|
|
6781
|
+
var _a;
|
|
6782
|
+
return (_a = JSON.parse(v)) == null ? void 0 : _a[1];
|
|
6783
|
+
}).join(" / ");
|
|
6784
|
+
const annotations = {
|
|
6785
|
+
...column.spec.annotations,
|
|
6786
|
+
[Annotation.Graph.IsVirtual]: stringifyJson(true)
|
|
5908
6787
|
};
|
|
5909
|
-
|
|
5910
|
-
|
|
6788
|
+
if (label || labelDomainPart) {
|
|
6789
|
+
annotations[Annotation.Label] = label && labelDomainPart ? label + " / " + labelDomainPart : label + labelDomainPart;
|
|
6790
|
+
}
|
|
6791
|
+
return {
|
|
6792
|
+
id,
|
|
5911
6793
|
spec: {
|
|
5912
|
-
...
|
|
5913
|
-
axesSpec:
|
|
5914
|
-
...
|
|
5915
|
-
annotations:
|
|
6794
|
+
...column.spec,
|
|
6795
|
+
axesSpec: idsList.map((axisId, idx2) => ({
|
|
6796
|
+
...axisId,
|
|
6797
|
+
annotations: column.spec.axesSpec[idx2].annotations
|
|
5916
6798
|
})),
|
|
5917
|
-
annotations
|
|
6799
|
+
annotations
|
|
5918
6800
|
},
|
|
5919
|
-
data:
|
|
6801
|
+
data: column.data
|
|
5920
6802
|
};
|
|
5921
6803
|
});
|
|
6804
|
+
return [column, ...additionalColumns];
|
|
6805
|
+
}
|
|
6806
|
+
function isColumnReady(c) {
|
|
6807
|
+
let ready = true;
|
|
6808
|
+
if (c.data instanceof TreeNodeAccessor) {
|
|
6809
|
+
ready = ready && c.data.getIsReadyOrError();
|
|
6810
|
+
} else if (isDataInfo(c.data)) {
|
|
6811
|
+
visitDataInfo(c.data, (v) => {
|
|
6812
|
+
ready = ready && v.getIsReadyOrError();
|
|
6813
|
+
});
|
|
6814
|
+
}
|
|
6815
|
+
return ready;
|
|
5922
6816
|
}
|
|
5923
|
-
function
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
return e;
|
|
5934
|
-
}
|
|
5935
|
-
function kt(t, e) {
|
|
5936
|
-
const n2 = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
5937
|
-
t.forEach((s2) => {
|
|
5938
|
-
n2.add(s2.id), r.set(Xn(En(s2.spec)), s2);
|
|
5939
|
-
});
|
|
5940
|
-
const i = /* @__PURE__ */ new Map();
|
|
5941
|
-
for (const s2 of e) {
|
|
5942
|
-
if (n2.has(s2.id)) continue;
|
|
5943
|
-
const o = Xn(En(s2.spec));
|
|
5944
|
-
if (!r.has(o)) {
|
|
5945
|
-
for (const a of r.values())
|
|
5946
|
-
if (Je(a, s2)) {
|
|
5947
|
-
i.set(o, s2);
|
|
5948
|
-
break;
|
|
5949
|
-
}
|
|
6817
|
+
function allColumnsReady(columns) {
|
|
6818
|
+
return columns.every(isColumnReady);
|
|
6819
|
+
}
|
|
6820
|
+
function createPFrameForGraphs(ctx, blockColumns) {
|
|
6821
|
+
if (!blockColumns) {
|
|
6822
|
+
const columns2 = new PColumnCollection();
|
|
6823
|
+
columns2.addColumnProvider(ctx.resultPool);
|
|
6824
|
+
const allColumns = columns2.getColumns(() => true, { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];
|
|
6825
|
+
if (!allColumnsReady(allColumns)) {
|
|
6826
|
+
return void 0;
|
|
5950
6827
|
}
|
|
6828
|
+
const allAxes2 = new Map(allColumns.flatMap((column) => getNormalizedAxesList(column.spec.axesSpec)).map((axisSpec) => {
|
|
6829
|
+
const axisId = getAxisId(axisSpec);
|
|
6830
|
+
return [canonicalizeJson(axisId), axisSpec];
|
|
6831
|
+
}));
|
|
6832
|
+
const extendedColumns2 = enrichCompatible(allAxes2, allColumns);
|
|
6833
|
+
return ctx.createPFrame(extendedColumns2);
|
|
6834
|
+
}
|
|
6835
|
+
if (!allColumnsReady(blockColumns)) {
|
|
6836
|
+
return void 0;
|
|
5951
6837
|
}
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
const
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
6838
|
+
const columns = new PColumnCollection();
|
|
6839
|
+
columns.addColumnProvider(ctx.resultPool);
|
|
6840
|
+
columns.addColumns(blockColumns);
|
|
6841
|
+
const blockAxes = /* @__PURE__ */ new Map();
|
|
6842
|
+
const allAxes = /* @__PURE__ */ new Map();
|
|
6843
|
+
for (const c of blockColumns) {
|
|
6844
|
+
for (const spec of getNormalizedAxesList(c.spec.axesSpec)) {
|
|
6845
|
+
const aid = getAxisId(spec);
|
|
6846
|
+
blockAxes.set(canonicalizeJson(aid), spec);
|
|
6847
|
+
allAxes.set(canonicalizeJson(aid), spec);
|
|
6848
|
+
}
|
|
6849
|
+
}
|
|
6850
|
+
const linkerColumns = columns.getColumns((spec) => isLinkerColumn(spec)) ?? [];
|
|
6851
|
+
const availableWithLinkersAxes = getAvailableWithLinkersAxes(linkerColumns, blockAxes);
|
|
6852
|
+
for (const item of availableWithLinkersAxes) {
|
|
6853
|
+
blockAxes.set(...item);
|
|
6854
|
+
allAxes.set(...item);
|
|
6855
|
+
}
|
|
6856
|
+
const compatibleWithoutLabels = (columns.getColumns((spec) => spec.axesSpec.some((axisSpec) => {
|
|
6857
|
+
const axisId = getAxisId(axisSpec);
|
|
6858
|
+
for (const selectorAxisSpec of blockAxes.values()) {
|
|
6859
|
+
if (matchAxisId(getAxisId(selectorAxisSpec), axisId)) {
|
|
6860
|
+
return true;
|
|
6861
|
+
}
|
|
6862
|
+
}
|
|
6863
|
+
return false;
|
|
6864
|
+
}), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
|
|
6865
|
+
if (!allColumnsReady(compatibleWithoutLabels)) {
|
|
6866
|
+
return void 0;
|
|
6867
|
+
}
|
|
6868
|
+
for (const c of compatibleWithoutLabels) {
|
|
6869
|
+
for (const spec of getNormalizedAxesList(c.spec.axesSpec)) {
|
|
6870
|
+
const aid = getAxisId(spec);
|
|
6871
|
+
allAxes.set(canonicalizeJson(aid), spec);
|
|
6872
|
+
}
|
|
6873
|
+
}
|
|
6874
|
+
const compatibleLabels = (columns.getColumns((spec) => spec.axesSpec.some((axisSpec) => {
|
|
6875
|
+
const axisId = getAxisId(axisSpec);
|
|
6876
|
+
for (const selectorAxisSpec of allAxes.values()) {
|
|
6877
|
+
if (matchAxisId(getAxisId(selectorAxisSpec), axisId)) {
|
|
6878
|
+
return true;
|
|
6879
|
+
}
|
|
6880
|
+
}
|
|
6881
|
+
return false;
|
|
6882
|
+
}), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => isLabelColumn(column.spec));
|
|
6883
|
+
if (!allColumnsReady(compatibleLabels)) {
|
|
6884
|
+
return void 0;
|
|
6885
|
+
}
|
|
6886
|
+
const compatible = [...compatibleWithoutLabels, ...compatibleLabels];
|
|
6887
|
+
const extendedColumns = enrichCompatible(blockAxes, compatible);
|
|
6888
|
+
return ctx.createPFrame(extendedColumns);
|
|
6889
|
+
}
|
|
6890
|
+
var stringify = { exports: {} };
|
|
6891
|
+
var hasRequiredStringify;
|
|
6892
|
+
function requireStringify() {
|
|
6893
|
+
if (hasRequiredStringify) return stringify.exports;
|
|
6894
|
+
hasRequiredStringify = 1;
|
|
6895
|
+
(function(module2, exports3) {
|
|
6896
|
+
exports3 = module2.exports = stringify2;
|
|
6897
|
+
exports3.getSerialize = serializer;
|
|
6898
|
+
function stringify2(obj, replacer, spaces, cycleReplacer) {
|
|
6899
|
+
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
|
|
6900
|
+
}
|
|
6901
|
+
function serializer(replacer, cycleReplacer) {
|
|
6902
|
+
var stack = [], keys = [];
|
|
6903
|
+
if (cycleReplacer == null) cycleReplacer = function(key, value) {
|
|
6904
|
+
if (stack[0] === value) return "[Circular ~]";
|
|
6905
|
+
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
6906
|
+
};
|
|
6907
|
+
return function(key, value) {
|
|
6908
|
+
if (stack.length > 0) {
|
|
6909
|
+
var thisPos = stack.indexOf(this);
|
|
6910
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
6911
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
6912
|
+
if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value);
|
|
6913
|
+
} else stack.push(value);
|
|
6914
|
+
return replacer == null ? value : replacer.call(this, key, value);
|
|
6915
|
+
};
|
|
6916
|
+
}
|
|
6917
|
+
})(stringify, stringify.exports);
|
|
6918
|
+
return stringify.exports;
|
|
6919
|
+
}
|
|
6920
|
+
requireStringify();
|
|
6921
|
+
const BasePlErrorLike = z.object({
|
|
6922
|
+
type: z.literal("PlError"),
|
|
6923
|
+
name: z.string(),
|
|
6924
|
+
message: z.string(),
|
|
6925
|
+
/** The message with all details needed for SDK developers. */
|
|
6926
|
+
fullMessage: z.string().optional(),
|
|
6927
|
+
stack: z.string().optional()
|
|
6928
|
+
});
|
|
6929
|
+
const PlErrorLike = BasePlErrorLike.extend({
|
|
6930
|
+
cause: z.lazy(() => ErrorLike).optional(),
|
|
6931
|
+
errors: z.lazy(() => ErrorLike.array()).optional()
|
|
6932
|
+
});
|
|
6933
|
+
const BaseStandardErrorLike = z.object({
|
|
6934
|
+
type: z.literal("StandardError"),
|
|
6935
|
+
name: z.string(),
|
|
6936
|
+
message: z.string(),
|
|
6937
|
+
stack: z.string().optional()
|
|
6938
|
+
});
|
|
6939
|
+
const StandardErrorLike = BaseStandardErrorLike.extend({
|
|
6940
|
+
cause: z.lazy(() => ErrorLike).optional(),
|
|
6941
|
+
errors: z.lazy(() => ErrorLike.array()).optional()
|
|
6942
|
+
});
|
|
6943
|
+
const ErrorLike = z.union([StandardErrorLike, PlErrorLike]);
|
|
6944
|
+
const baseErrorShape = z.object({
|
|
6945
|
+
name: z.string(),
|
|
6946
|
+
message: z.string(),
|
|
6947
|
+
fullMessage: z.string().optional(),
|
|
6948
|
+
stack: z.string().optional()
|
|
6949
|
+
});
|
|
6950
|
+
const ErrorShape = baseErrorShape.extend({
|
|
6951
|
+
cause: z.lazy(() => ErrorShape).optional(),
|
|
6952
|
+
errors: z.lazy(() => ErrorShape.array()).optional()
|
|
6953
|
+
});
|
|
6954
|
+
const model = BlockModel.create().withArgs({
|
|
6955
|
+
scChain: "A",
|
|
6956
|
+
allele: false
|
|
6957
|
+
}).withUiState({
|
|
5971
6958
|
blockTitle: "V/J Usage",
|
|
5972
6959
|
weightedFlag: true,
|
|
5973
6960
|
vUsagePlotState: {
|
|
5974
6961
|
title: "V Usage",
|
|
5975
|
-
template: "
|
|
5976
|
-
currentTab: "settings"
|
|
6962
|
+
template: "heatmapClustered",
|
|
6963
|
+
currentTab: "settings",
|
|
6964
|
+
layersSettings: {
|
|
6965
|
+
heatmapClustered: {
|
|
6966
|
+
normalizationDirection: null
|
|
6967
|
+
}
|
|
6968
|
+
}
|
|
5977
6969
|
},
|
|
5978
6970
|
jUsagePlotState: {
|
|
5979
6971
|
title: "V Usage",
|
|
5980
|
-
template: "
|
|
5981
|
-
currentTab: null
|
|
6972
|
+
template: "heatmapClustered",
|
|
6973
|
+
currentTab: null,
|
|
6974
|
+
layersSettings: {
|
|
6975
|
+
heatmapClustered: {
|
|
6976
|
+
normalizationDirection: null
|
|
6977
|
+
}
|
|
6978
|
+
}
|
|
5982
6979
|
},
|
|
5983
6980
|
vjUsagePlotState: {
|
|
5984
6981
|
title: "V/J Usage",
|
|
5985
|
-
template: "
|
|
5986
|
-
currentTab: null
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
).output("vGeneOptions", (ctx) => ctx.resultPool.getOptions(
|
|
5991
|
-
(c2) => {
|
|
5992
|
-
var _a;
|
|
5993
|
-
return f(c2) && c2.valueType === "String" && (c2.name === "pl7.app/vdj/geneHit" || c2.name === "pl7.app/vdj/geneHitWithAllele") && ((_a = c2.domain) == null ? void 0 : _a["pl7.app/vdj/reference"]) === "VGene";
|
|
5994
|
-
}
|
|
5995
|
-
)).output("jGeneOptions", (ctx) => {
|
|
5996
|
-
const inputRef = ctx.args.vGeneRef;
|
|
5997
|
-
if (inputRef === void 0) return void 0;
|
|
5998
|
-
const vGeneSpec = ctx.resultPool.getPColumnSpecByRef(inputRef);
|
|
5999
|
-
if (vGeneSpec === void 0) return void 0;
|
|
6000
|
-
return ctx.resultPool.getCanonicalOptions({ main: inputRef }, [
|
|
6001
|
-
{
|
|
6002
|
-
axes: [{ anchor: "main", idx: 0 }],
|
|
6003
|
-
name: vGeneSpec.name,
|
|
6004
|
-
domain: {
|
|
6005
|
-
"pl7.app/vdj/reference": "JGene",
|
|
6006
|
-
"pl7.app/vdj/scClonotypeChain": { anchor: "main" },
|
|
6007
|
-
"pl7.app/vdj/scClonotypeChain/index": { anchor: "main" }
|
|
6982
|
+
template: "heatmapClustered",
|
|
6983
|
+
currentTab: null,
|
|
6984
|
+
layersSettings: {
|
|
6985
|
+
heatmapClustered: {
|
|
6986
|
+
normalizationDirection: null
|
|
6008
6987
|
}
|
|
6009
6988
|
}
|
|
6010
|
-
|
|
6011
|
-
}).
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6989
|
+
}
|
|
6990
|
+
}).argsValid((ctx) => ctx.args.datasetRef !== void 0).output(
|
|
6991
|
+
"datasetOptions",
|
|
6992
|
+
(ctx) => ctx.resultPool.getOptions(
|
|
6993
|
+
[{
|
|
6994
|
+
axes: [
|
|
6995
|
+
{ name: "pl7.app/sampleId" },
|
|
6996
|
+
{ name: "pl7.app/vdj/clonotypeKey" }
|
|
6997
|
+
],
|
|
6998
|
+
annotations: { "pl7.app/isAnchor": "true" }
|
|
6999
|
+
}, {
|
|
7000
|
+
axes: [
|
|
7001
|
+
{ name: "pl7.app/sampleId" },
|
|
7002
|
+
{ name: "pl7.app/vdj/scClonotypeKey" }
|
|
7003
|
+
],
|
|
7004
|
+
annotations: { "pl7.app/isAnchor": "true" }
|
|
7005
|
+
}],
|
|
6016
7006
|
{
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
}, { anchor: "main", idx: 0 }],
|
|
6020
|
-
annotations: {
|
|
6021
|
-
"pl7.app/isAbundance": "true",
|
|
6022
|
-
"pl7.app/abundance/normalized": "false"
|
|
6023
|
-
}
|
|
7007
|
+
// suppress native label of the column (e.g. "Number of Reads") to show only the dataset label
|
|
7008
|
+
label: { includeNativeLabel: false }
|
|
6024
7009
|
}
|
|
6025
|
-
)
|
|
7010
|
+
)
|
|
7011
|
+
).output("datasetSpec", (ctx) => {
|
|
7012
|
+
if (ctx.args.datasetRef === void 0) {
|
|
7013
|
+
return void 0;
|
|
7014
|
+
}
|
|
7015
|
+
return ctx.resultPool.getPColumnSpecByRef(ctx.args.datasetRef);
|
|
6026
7016
|
}).output("pf", (ctx) => {
|
|
6027
7017
|
var _a, _b;
|
|
6028
7018
|
const pCols = (_b = (_a = ctx.outputs) == null ? void 0 : _a.resolve("pf")) == null ? void 0 : _b.getPColumns();
|
|
6029
7019
|
if (pCols === void 0) {
|
|
6030
7020
|
return void 0;
|
|
6031
7021
|
}
|
|
6032
|
-
return
|
|
7022
|
+
return createPFrameForGraphs(ctx, pCols);
|
|
6033
7023
|
}).output("isRunning", (ctx) => {
|
|
6034
7024
|
var _a;
|
|
6035
7025
|
return ((_a = ctx.outputs) == null ? void 0 : _a.getIsReadyOrError()) === false;
|