@platforma-open/milaboratories.immune-assay-data.model 1.3.0 → 1.4.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 +13 -13
- package/CHANGELOG.md +12 -0
- package/dist/bundle.js +2134 -1551
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +6 -6
- package/src/index.ts +2 -2
package/dist/bundle.js
CHANGED
|
@@ -1,17 +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";
|
|
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;
|
|
27
|
+
}
|
|
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);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
futureResolves.set(handle, []);
|
|
52
|
+
}
|
|
53
|
+
futureResolves.get(handle).push(onResolve);
|
|
54
|
+
}
|
|
5
55
|
var util;
|
|
6
56
|
(function(util2) {
|
|
7
57
|
util2.assertEqual = (val) => val;
|
|
8
58
|
function assertIs(_arg) {
|
|
9
59
|
}
|
|
10
60
|
util2.assertIs = assertIs;
|
|
11
|
-
function
|
|
61
|
+
function assertNever2(_x) {
|
|
12
62
|
throw new Error();
|
|
13
63
|
}
|
|
14
|
-
util2.assertNever =
|
|
64
|
+
util2.assertNever = assertNever2;
|
|
15
65
|
util2.arrayToEnum = (items) => {
|
|
16
66
|
const obj = {};
|
|
17
67
|
for (const item of items) {
|
|
@@ -20,10 +70,10 @@
|
|
|
20
70
|
return obj;
|
|
21
71
|
};
|
|
22
72
|
util2.getValidEnumValues = (obj) => {
|
|
23
|
-
const validKeys = util2.objectKeys(obj).filter((
|
|
73
|
+
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
24
74
|
const filtered = {};
|
|
25
|
-
for (const
|
|
26
|
-
filtered[
|
|
75
|
+
for (const k of validKeys) {
|
|
76
|
+
filtered[k] = obj[k];
|
|
27
77
|
}
|
|
28
78
|
return util2.objectValues(filtered);
|
|
29
79
|
};
|
|
@@ -368,7 +418,7 @@
|
|
|
368
418
|
};
|
|
369
419
|
}
|
|
370
420
|
let errorMessage = "";
|
|
371
|
-
const maps = errorMaps.filter((
|
|
421
|
+
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
372
422
|
for (const map of maps) {
|
|
373
423
|
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
374
424
|
}
|
|
@@ -409,12 +459,12 @@
|
|
|
409
459
|
}
|
|
410
460
|
static mergeArray(status, results) {
|
|
411
461
|
const arrayValue = [];
|
|
412
|
-
for (const
|
|
413
|
-
if (
|
|
462
|
+
for (const s of results) {
|
|
463
|
+
if (s.status === "aborted")
|
|
414
464
|
return INVALID;
|
|
415
|
-
if (
|
|
465
|
+
if (s.status === "dirty")
|
|
416
466
|
status.dirty();
|
|
417
|
-
arrayValue.push(
|
|
467
|
+
arrayValue.push(s.value);
|
|
418
468
|
}
|
|
419
469
|
return { status: status.value, value: arrayValue };
|
|
420
470
|
}
|
|
@@ -458,11 +508,11 @@
|
|
|
458
508
|
const isDirty = (x) => x.status === "dirty";
|
|
459
509
|
const isValid = (x) => x.status === "valid";
|
|
460
510
|
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
461
|
-
function __classPrivateFieldGet(receiver, state, kind,
|
|
511
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
462
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");
|
|
463
513
|
return state.get(receiver);
|
|
464
514
|
}
|
|
465
|
-
function __classPrivateFieldSet(receiver, state, value, kind,
|
|
515
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
466
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");
|
|
467
517
|
return state.set(receiver, value), value;
|
|
468
518
|
}
|
|
@@ -816,11 +866,11 @@
|
|
|
816
866
|
regex = `${regex}(${opts.join("|")})`;
|
|
817
867
|
return new RegExp(`^${regex}$`);
|
|
818
868
|
}
|
|
819
|
-
function isValidIP(ip,
|
|
820
|
-
if ((
|
|
869
|
+
function isValidIP(ip, version2) {
|
|
870
|
+
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
|
821
871
|
return true;
|
|
822
872
|
}
|
|
823
|
-
if ((
|
|
873
|
+
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
|
824
874
|
return true;
|
|
825
875
|
}
|
|
826
876
|
return false;
|
|
@@ -3069,7 +3119,7 @@
|
|
|
3069
3119
|
});
|
|
3070
3120
|
}
|
|
3071
3121
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
3072
|
-
const
|
|
3122
|
+
const fn = ctx.data;
|
|
3073
3123
|
if (this._def.returns instanceof ZodPromise) {
|
|
3074
3124
|
const me = this;
|
|
3075
3125
|
return OK(async function(...args) {
|
|
@@ -3078,7 +3128,7 @@
|
|
|
3078
3128
|
error.addIssue(makeArgsIssue(args, e));
|
|
3079
3129
|
throw error;
|
|
3080
3130
|
});
|
|
3081
|
-
const result = await Reflect.apply(
|
|
3131
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3082
3132
|
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
3083
3133
|
error.addIssue(makeReturnsIssue(result, e));
|
|
3084
3134
|
throw error;
|
|
@@ -3092,7 +3142,7 @@
|
|
|
3092
3142
|
if (!parsedArgs.success) {
|
|
3093
3143
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
3094
3144
|
}
|
|
3095
|
-
const result = Reflect.apply(
|
|
3145
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3096
3146
|
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
3097
3147
|
if (!parsedReturns.success) {
|
|
3098
3148
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
@@ -3697,10 +3747,10 @@
|
|
|
3697
3747
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3698
3748
|
var _a, _b;
|
|
3699
3749
|
if (!check(data)) {
|
|
3700
|
-
const
|
|
3701
|
-
const _fatal = (_b = (_a =
|
|
3702
|
-
const
|
|
3703
|
-
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 });
|
|
3704
3754
|
}
|
|
3705
3755
|
});
|
|
3706
3756
|
return ZodAny.create();
|
|
@@ -3798,7 +3848,7 @@
|
|
|
3798
3848
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3799
3849
|
};
|
|
3800
3850
|
const NEVER = INVALID;
|
|
3801
|
-
var z
|
|
3851
|
+
var z = /* @__PURE__ */ Object.freeze({
|
|
3802
3852
|
__proto__: null,
|
|
3803
3853
|
defaultErrorMap: errorMap,
|
|
3804
3854
|
setErrorMap,
|
|
@@ -3914,281 +3964,439 @@
|
|
|
3914
3964
|
quotelessJson,
|
|
3915
3965
|
ZodError
|
|
3916
3966
|
});
|
|
3917
|
-
|
|
3918
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
3919
|
-
}
|
|
3920
|
-
var canonicalize;
|
|
3921
|
-
var hasRequiredCanonicalize;
|
|
3922
|
-
function requireCanonicalize() {
|
|
3923
|
-
if (hasRequiredCanonicalize) return canonicalize;
|
|
3924
|
-
hasRequiredCanonicalize = 1;
|
|
3925
|
-
canonicalize = function serialize(object) {
|
|
3926
|
-
if (typeof object === "number" && isNaN(object)) {
|
|
3927
|
-
throw new Error("NaN is not allowed");
|
|
3928
|
-
}
|
|
3929
|
-
if (typeof object === "number" && !isFinite(object)) {
|
|
3930
|
-
throw new Error("Infinity is not allowed");
|
|
3931
|
-
}
|
|
3932
|
-
if (object === null || typeof object !== "object") {
|
|
3933
|
-
return JSON.stringify(object);
|
|
3934
|
-
}
|
|
3935
|
-
if (object.toJSON instanceof Function) {
|
|
3936
|
-
return serialize(object.toJSON());
|
|
3937
|
-
}
|
|
3938
|
-
if (Array.isArray(object)) {
|
|
3939
|
-
const values2 = object.reduce((t, cv, ci) => {
|
|
3940
|
-
const comma = ci === 0 ? "" : ",";
|
|
3941
|
-
const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
|
|
3942
|
-
return `${t}${comma}${serialize(value)}`;
|
|
3943
|
-
}, "");
|
|
3944
|
-
return `[${values2}]`;
|
|
3945
|
-
}
|
|
3946
|
-
const values = Object.keys(object).sort().reduce((t, cv) => {
|
|
3947
|
-
if (object[cv] === void 0 || typeof object[cv] === "symbol") {
|
|
3948
|
-
return t;
|
|
3949
|
-
}
|
|
3950
|
-
const comma = t.length === 0 ? "" : ",";
|
|
3951
|
-
return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;
|
|
3952
|
-
}, "");
|
|
3953
|
-
return `{${values}}`;
|
|
3954
|
-
};
|
|
3955
|
-
return canonicalize;
|
|
3956
|
-
}
|
|
3957
|
-
var canonicalizeExports = requireCanonicalize();
|
|
3958
|
-
const Re = /* @__PURE__ */ getDefaultExportFromCjs(canonicalizeExports);
|
|
3959
|
-
var B$1 = Object.defineProperty;
|
|
3960
|
-
var j = (n2, e, t) => e in n2 ? B$1(n2, e, { enumerable: true, configurable: true, writable: true, value: t }) : n2[e] = t;
|
|
3961
|
-
var l$1 = (n2, e, t) => j(n2, typeof e != "symbol" ? e + "" : e, t);
|
|
3962
|
-
z$1.object({
|
|
3967
|
+
z.object({
|
|
3963
3968
|
/** Included left border. */
|
|
3964
|
-
from: z
|
|
3969
|
+
from: z.number().min(0),
|
|
3965
3970
|
/** Excluded right border. */
|
|
3966
|
-
to: z
|
|
3971
|
+
to: z.number().min(1)
|
|
3967
3972
|
});
|
|
3968
|
-
function
|
|
3969
|
-
throw new Error("Unexpected object: " +
|
|
3973
|
+
function assertNever(x) {
|
|
3974
|
+
throw new Error("Unexpected object: " + x);
|
|
3975
|
+
}
|
|
3976
|
+
function uniqueBy(array, makeId) {
|
|
3977
|
+
return [...new Map(array.map((e) => [makeId(e), e])).values()];
|
|
3970
3978
|
}
|
|
3971
|
-
function
|
|
3972
|
-
if (!
|
|
3979
|
+
function isDataInfo(value) {
|
|
3980
|
+
if (!value || typeof value !== "object") {
|
|
3973
3981
|
return false;
|
|
3974
|
-
|
|
3975
|
-
|
|
3982
|
+
}
|
|
3983
|
+
const data = value;
|
|
3984
|
+
if (!("type" in data)) {
|
|
3976
3985
|
return false;
|
|
3977
|
-
|
|
3986
|
+
}
|
|
3987
|
+
switch (data.type) {
|
|
3978
3988
|
case "Json":
|
|
3979
|
-
return typeof
|
|
3989
|
+
return typeof data.keyLength === "number" && data.data !== void 0 && typeof data.data === "object";
|
|
3980
3990
|
case "JsonPartitioned":
|
|
3981
|
-
return typeof e.partitionKeyLength == "number" && e.parts !== void 0 && typeof e.parts == "object";
|
|
3982
3991
|
case "BinaryPartitioned":
|
|
3983
|
-
|
|
3992
|
+
case "ParquetPartitioned":
|
|
3993
|
+
return typeof data.partitionKeyLength === "number" && data.parts !== void 0 && typeof data.parts === "object";
|
|
3984
3994
|
default:
|
|
3985
3995
|
return false;
|
|
3986
3996
|
}
|
|
3987
3997
|
}
|
|
3988
|
-
function
|
|
3989
|
-
if (
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
parts: t
|
|
4000
|
-
};
|
|
3998
|
+
function mapDataInfo(dataInfo, mapFn) {
|
|
3999
|
+
if (dataInfo === void 0) {
|
|
4000
|
+
return void 0;
|
|
4001
|
+
}
|
|
4002
|
+
switch (dataInfo.type) {
|
|
4003
|
+
case "Json":
|
|
4004
|
+
return dataInfo;
|
|
4005
|
+
case "JsonPartitioned": {
|
|
4006
|
+
const newParts = {};
|
|
4007
|
+
for (const [key, blob] of Object.entries(dataInfo.parts)) {
|
|
4008
|
+
newParts[key] = mapFn(blob);
|
|
4001
4009
|
}
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4010
|
+
return {
|
|
4011
|
+
...dataInfo,
|
|
4012
|
+
parts: newParts
|
|
4013
|
+
};
|
|
4014
|
+
}
|
|
4015
|
+
case "BinaryPartitioned": {
|
|
4016
|
+
const newParts = {};
|
|
4017
|
+
for (const [key, chunk] of Object.entries(dataInfo.parts)) {
|
|
4018
|
+
newParts[key] = {
|
|
4019
|
+
index: mapFn(chunk.index),
|
|
4020
|
+
values: mapFn(chunk.values)
|
|
4012
4021
|
};
|
|
4013
4022
|
}
|
|
4023
|
+
return {
|
|
4024
|
+
...dataInfo,
|
|
4025
|
+
parts: newParts
|
|
4026
|
+
};
|
|
4014
4027
|
}
|
|
4028
|
+
case "ParquetPartitioned": {
|
|
4029
|
+
const newParts = {};
|
|
4030
|
+
for (const [key, blob] of Object.entries(dataInfo.parts)) {
|
|
4031
|
+
newParts[key] = mapFn(blob);
|
|
4032
|
+
}
|
|
4033
|
+
return {
|
|
4034
|
+
...dataInfo,
|
|
4035
|
+
parts: newParts
|
|
4036
|
+
};
|
|
4037
|
+
}
|
|
4038
|
+
}
|
|
4015
4039
|
}
|
|
4016
|
-
function
|
|
4017
|
-
if (!
|
|
4040
|
+
function isDataInfoEntries(value) {
|
|
4041
|
+
if (!value || typeof value !== "object") {
|
|
4018
4042
|
return false;
|
|
4019
|
-
|
|
4020
|
-
|
|
4043
|
+
}
|
|
4044
|
+
const data = value;
|
|
4045
|
+
if (!("type" in data)) {
|
|
4021
4046
|
return false;
|
|
4022
|
-
|
|
4047
|
+
}
|
|
4048
|
+
switch (data.type) {
|
|
4023
4049
|
case "Json":
|
|
4024
|
-
return typeof
|
|
4050
|
+
return typeof data.keyLength === "number" && Array.isArray(data.data);
|
|
4025
4051
|
case "JsonPartitioned":
|
|
4026
|
-
return typeof e.partitionKeyLength == "number" && Array.isArray(e.parts);
|
|
4027
4052
|
case "BinaryPartitioned":
|
|
4028
|
-
|
|
4053
|
+
case "ParquetPartitioned":
|
|
4054
|
+
return typeof data.partitionKeyLength === "number" && Array.isArray(data.parts);
|
|
4029
4055
|
default:
|
|
4030
4056
|
return false;
|
|
4031
4057
|
}
|
|
4032
4058
|
}
|
|
4033
|
-
function
|
|
4034
|
-
|
|
4059
|
+
function isPartitionedDataInfoEntries(value) {
|
|
4060
|
+
if (!isDataInfoEntries(value))
|
|
4061
|
+
return false;
|
|
4062
|
+
switch (value.type) {
|
|
4063
|
+
case "JsonPartitioned":
|
|
4064
|
+
case "BinaryPartitioned":
|
|
4065
|
+
case "ParquetPartitioned":
|
|
4066
|
+
return true;
|
|
4067
|
+
default:
|
|
4068
|
+
return false;
|
|
4069
|
+
}
|
|
4035
4070
|
}
|
|
4036
|
-
function
|
|
4037
|
-
switch (
|
|
4038
|
-
case "Json":
|
|
4039
|
-
const e = Object.entries(n2.data).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
|
|
4071
|
+
function dataInfoToEntries(dataInfo) {
|
|
4072
|
+
switch (dataInfo.type) {
|
|
4073
|
+
case "Json":
|
|
4040
4074
|
return {
|
|
4041
4075
|
type: "Json",
|
|
4042
|
-
keyLength:
|
|
4043
|
-
data:
|
|
4076
|
+
keyLength: dataInfo.keyLength,
|
|
4077
|
+
data: Object.entries(dataInfo.data).map(([keyStr, value]) => {
|
|
4078
|
+
const key = JSON.parse(keyStr);
|
|
4079
|
+
return { key, value };
|
|
4080
|
+
})
|
|
4044
4081
|
};
|
|
4045
|
-
|
|
4046
|
-
case "JsonPartitioned": {
|
|
4047
|
-
const e = Object.entries(n2.parts).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
|
|
4082
|
+
case "JsonPartitioned":
|
|
4048
4083
|
return {
|
|
4049
4084
|
type: "JsonPartitioned",
|
|
4050
|
-
partitionKeyLength:
|
|
4051
|
-
parts:
|
|
4085
|
+
partitionKeyLength: dataInfo.partitionKeyLength,
|
|
4086
|
+
parts: Object.entries(dataInfo.parts).map(([keyStr, blob]) => {
|
|
4087
|
+
const key = JSON.parse(keyStr);
|
|
4088
|
+
return { key, value: blob };
|
|
4089
|
+
})
|
|
4052
4090
|
};
|
|
4053
|
-
|
|
4054
|
-
case "BinaryPartitioned": {
|
|
4055
|
-
const e = Object.entries(n2.parts).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
|
|
4091
|
+
case "BinaryPartitioned":
|
|
4056
4092
|
return {
|
|
4057
4093
|
type: "BinaryPartitioned",
|
|
4058
|
-
partitionKeyLength:
|
|
4059
|
-
parts:
|
|
4094
|
+
partitionKeyLength: dataInfo.partitionKeyLength,
|
|
4095
|
+
parts: Object.entries(dataInfo.parts).map(([keyStr, chunk]) => {
|
|
4096
|
+
const key = JSON.parse(keyStr);
|
|
4097
|
+
return { key, value: chunk };
|
|
4098
|
+
})
|
|
4060
4099
|
};
|
|
4061
|
-
|
|
4100
|
+
case "ParquetPartitioned":
|
|
4101
|
+
return {
|
|
4102
|
+
type: "ParquetPartitioned",
|
|
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
|
+
})
|
|
4108
|
+
};
|
|
4109
|
+
default:
|
|
4110
|
+
assertNever(dataInfo);
|
|
4062
4111
|
}
|
|
4063
4112
|
}
|
|
4064
|
-
function
|
|
4065
|
-
switch (
|
|
4066
|
-
case "Json":
|
|
4067
|
-
const e = {};
|
|
4068
|
-
for (const t of n2.data)
|
|
4069
|
-
e[JSON.stringify(t.key)] = t.value;
|
|
4113
|
+
function entriesToDataInfo(dataInfoEntries) {
|
|
4114
|
+
switch (dataInfoEntries.type) {
|
|
4115
|
+
case "Json":
|
|
4070
4116
|
return {
|
|
4071
4117
|
type: "Json",
|
|
4072
|
-
keyLength:
|
|
4073
|
-
data:
|
|
4118
|
+
keyLength: dataInfoEntries.keyLength,
|
|
4119
|
+
data: Object.fromEntries(dataInfoEntries.data.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4074
4120
|
};
|
|
4075
|
-
|
|
4076
|
-
case "JsonPartitioned": {
|
|
4077
|
-
const e = {};
|
|
4078
|
-
for (const t of n2.parts)
|
|
4079
|
-
e[JSON.stringify(t.key)] = t.value;
|
|
4121
|
+
case "JsonPartitioned":
|
|
4080
4122
|
return {
|
|
4081
4123
|
type: "JsonPartitioned",
|
|
4082
|
-
partitionKeyLength:
|
|
4083
|
-
parts:
|
|
4124
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength,
|
|
4125
|
+
parts: Object.fromEntries(dataInfoEntries.parts.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4084
4126
|
};
|
|
4085
|
-
|
|
4086
|
-
case "BinaryPartitioned": {
|
|
4087
|
-
const e = {};
|
|
4088
|
-
for (const t of n2.parts)
|
|
4089
|
-
e[JSON.stringify(t.key)] = t.value;
|
|
4127
|
+
case "BinaryPartitioned":
|
|
4090
4128
|
return {
|
|
4091
4129
|
type: "BinaryPartitioned",
|
|
4092
|
-
partitionKeyLength:
|
|
4093
|
-
parts:
|
|
4130
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength,
|
|
4131
|
+
parts: Object.fromEntries(dataInfoEntries.parts.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4132
|
+
};
|
|
4133
|
+
case "ParquetPartitioned":
|
|
4134
|
+
return {
|
|
4135
|
+
type: "ParquetPartitioned",
|
|
4136
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength,
|
|
4137
|
+
parts: Object.fromEntries(dataInfoEntries.parts.map(({ key, value }) => [JSON.stringify(key), value]))
|
|
4094
4138
|
};
|
|
4139
|
+
default:
|
|
4140
|
+
assertNever(dataInfoEntries);
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
function stringifyValue(value) {
|
|
4144
|
+
if (typeof value === "string") {
|
|
4145
|
+
return `String value was thrown: ${value}`;
|
|
4146
|
+
}
|
|
4147
|
+
if (value && typeof value === "object") {
|
|
4148
|
+
try {
|
|
4149
|
+
return `Plain object was thrown: ${JSON.stringify(value)}`;
|
|
4150
|
+
} catch (jsonError) {
|
|
4151
|
+
const errorMessage = jsonError instanceof Error ? jsonError.message : String(jsonError);
|
|
4152
|
+
return `Non-serializable object was thrown (JSON.stringify failed: ${errorMessage}): ${String(value)}`;
|
|
4095
4153
|
}
|
|
4096
4154
|
}
|
|
4155
|
+
return String(`Non-Error value (${typeof value}) was thrown: ${value}`);
|
|
4097
4156
|
}
|
|
4098
|
-
function
|
|
4157
|
+
function ensureError(value) {
|
|
4158
|
+
if (value instanceof Error) {
|
|
4159
|
+
return value;
|
|
4160
|
+
}
|
|
4161
|
+
return new Error(stringifyValue(value));
|
|
4162
|
+
}
|
|
4163
|
+
function getDefaultExportFromCjs(x) {
|
|
4164
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4165
|
+
}
|
|
4166
|
+
var canonicalize$1;
|
|
4167
|
+
var hasRequiredCanonicalize;
|
|
4168
|
+
function requireCanonicalize() {
|
|
4169
|
+
if (hasRequiredCanonicalize) return canonicalize$1;
|
|
4170
|
+
hasRequiredCanonicalize = 1;
|
|
4171
|
+
canonicalize$1 = function serialize(object) {
|
|
4172
|
+
if (typeof object === "number" && isNaN(object)) {
|
|
4173
|
+
throw new Error("NaN is not allowed");
|
|
4174
|
+
}
|
|
4175
|
+
if (typeof object === "number" && !isFinite(object)) {
|
|
4176
|
+
throw new Error("Infinity is not allowed");
|
|
4177
|
+
}
|
|
4178
|
+
if (object === null || typeof object !== "object") {
|
|
4179
|
+
return JSON.stringify(object);
|
|
4180
|
+
}
|
|
4181
|
+
if (object.toJSON instanceof Function) {
|
|
4182
|
+
return serialize(object.toJSON());
|
|
4183
|
+
}
|
|
4184
|
+
if (Array.isArray(object)) {
|
|
4185
|
+
const values2 = object.reduce((t, cv, ci) => {
|
|
4186
|
+
const comma = ci === 0 ? "" : ",";
|
|
4187
|
+
const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
|
|
4188
|
+
return `${t}${comma}${serialize(value)}`;
|
|
4189
|
+
}, "");
|
|
4190
|
+
return `[${values2}]`;
|
|
4191
|
+
}
|
|
4192
|
+
const values = Object.keys(object).sort().reduce((t, cv) => {
|
|
4193
|
+
if (object[cv] === void 0 || typeof object[cv] === "symbol") {
|
|
4194
|
+
return t;
|
|
4195
|
+
}
|
|
4196
|
+
const comma = t.length === 0 ? "" : ",";
|
|
4197
|
+
return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;
|
|
4198
|
+
}, "");
|
|
4199
|
+
return `{${values}}`;
|
|
4200
|
+
};
|
|
4201
|
+
return canonicalize$1;
|
|
4202
|
+
}
|
|
4203
|
+
var canonicalizeExports = requireCanonicalize();
|
|
4204
|
+
const canonicalize = /* @__PURE__ */ getDefaultExportFromCjs(canonicalizeExports);
|
|
4205
|
+
function canonicalizeJson(value) {
|
|
4206
|
+
return canonicalize(value);
|
|
4207
|
+
}
|
|
4208
|
+
function parseJson(value) {
|
|
4209
|
+
return JSON.parse(value);
|
|
4210
|
+
}
|
|
4211
|
+
function readMetadata(metadata, key) {
|
|
4212
|
+
return metadata == null ? void 0 : metadata[key];
|
|
4213
|
+
}
|
|
4214
|
+
function readMetadataJsonOrThrow(metadata, metadataJson, key, methodNameInError = "readMetadataJsonOrThrow") {
|
|
4215
|
+
const json = readMetadata(metadata, key);
|
|
4216
|
+
if (json === void 0)
|
|
4217
|
+
return void 0;
|
|
4218
|
+
const schema = metadataJson[key];
|
|
4219
|
+
try {
|
|
4220
|
+
const value = JSON.parse(json);
|
|
4221
|
+
return schema.parse(value);
|
|
4222
|
+
} catch (error) {
|
|
4223
|
+
throw new Error(`${methodNameInError} failed, key: ${String(key)}, value: ${json}, error: ${ensureError(error)}`);
|
|
4224
|
+
}
|
|
4225
|
+
}
|
|
4226
|
+
function readMetadataJson(metadata, metadataJson, key) {
|
|
4227
|
+
try {
|
|
4228
|
+
return readMetadataJsonOrThrow(metadata, metadataJson, key);
|
|
4229
|
+
} catch {
|
|
4230
|
+
return void 0;
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
const Annotation = {
|
|
4234
|
+
DiscreteValues: "pl7.app/discreteValues",
|
|
4235
|
+
Graph: {
|
|
4236
|
+
IsVirtual: "pl7.app/graph/isVirtual"
|
|
4237
|
+
},
|
|
4238
|
+
HideDataFromUi: "pl7.app/hideDataFromUi",
|
|
4239
|
+
HideDataFromGraphs: "pl7.app/hideDataFromGraphs",
|
|
4240
|
+
IsLinkerColumn: "pl7.app/isLinkerColumn",
|
|
4241
|
+
Label: "pl7.app/label",
|
|
4242
|
+
Max: "pl7.app/max",
|
|
4243
|
+
Min: "pl7.app/min",
|
|
4244
|
+
Parents: "pl7.app/parents",
|
|
4245
|
+
Sequence: {
|
|
4246
|
+
Annotation: {
|
|
4247
|
+
Mapping: "pl7.app/sequence/annotation/mapping"
|
|
4248
|
+
},
|
|
4249
|
+
IsAnnotation: "pl7.app/sequence/isAnnotation"
|
|
4250
|
+
},
|
|
4251
|
+
Table: {
|
|
4252
|
+
OrderPriority: "pl7.app/table/orderPriority",
|
|
4253
|
+
Visibility: "pl7.app/table/visibility"
|
|
4254
|
+
},
|
|
4255
|
+
Trace: "pl7.app/trace"
|
|
4256
|
+
};
|
|
4257
|
+
const AnnotationJson = {
|
|
4258
|
+
[Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),
|
|
4259
|
+
[Annotation.Graph.IsVirtual]: z.boolean(),
|
|
4260
|
+
[Annotation.HideDataFromUi]: z.boolean(),
|
|
4261
|
+
[Annotation.HideDataFromGraphs]: z.boolean(),
|
|
4262
|
+
[Annotation.IsLinkerColumn]: z.boolean(),
|
|
4263
|
+
[Annotation.Max]: z.number(),
|
|
4264
|
+
[Annotation.Min]: z.number(),
|
|
4265
|
+
[Annotation.Parents]: z.array(z.string()),
|
|
4266
|
+
[Annotation.Sequence.Annotation.Mapping]: z.record(z.string(), z.string()),
|
|
4267
|
+
[Annotation.Sequence.IsAnnotation]: z.boolean(),
|
|
4268
|
+
[Annotation.Table.OrderPriority]: z.number(),
|
|
4269
|
+
[Annotation.Trace]: z.record(z.string(), z.unknown())
|
|
4270
|
+
};
|
|
4271
|
+
function readAnnotation(spec, key) {
|
|
4272
|
+
return readMetadata(spec == null ? void 0 : spec.annotations, key);
|
|
4273
|
+
}
|
|
4274
|
+
function readAnnotationJson(spec, key) {
|
|
4275
|
+
return readMetadataJson(spec == null ? void 0 : spec.annotations, AnnotationJson, key);
|
|
4276
|
+
}
|
|
4277
|
+
const PColumnName = {
|
|
4278
|
+
Label: "pl7.app/label"
|
|
4279
|
+
};
|
|
4280
|
+
function getColumnIdAndSpec(column) {
|
|
4099
4281
|
return {
|
|
4100
|
-
columnId:
|
|
4101
|
-
spec:
|
|
4282
|
+
columnId: column.id,
|
|
4283
|
+
spec: column.spec
|
|
4102
4284
|
};
|
|
4103
4285
|
}
|
|
4104
|
-
function
|
|
4105
|
-
const { type
|
|
4106
|
-
|
|
4286
|
+
function getAxisId(spec) {
|
|
4287
|
+
const { type, name, domain } = spec;
|
|
4288
|
+
const result = { type, name };
|
|
4289
|
+
if (domain && Object.entries(domain).length > 0) {
|
|
4290
|
+
Object.assign(result, { domain });
|
|
4291
|
+
}
|
|
4292
|
+
return result;
|
|
4107
4293
|
}
|
|
4108
|
-
function
|
|
4109
|
-
return
|
|
4294
|
+
function getAxesId(spec) {
|
|
4295
|
+
return spec.map(getAxisId);
|
|
4110
4296
|
}
|
|
4111
|
-
function
|
|
4112
|
-
return
|
|
4297
|
+
function canonicalizeAxisId(id) {
|
|
4298
|
+
return canonicalizeJson(getAxisId(id));
|
|
4113
4299
|
}
|
|
4114
|
-
function
|
|
4115
|
-
if (
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4300
|
+
function matchDomain$1(query, target) {
|
|
4301
|
+
if (query === void 0)
|
|
4302
|
+
return target === void 0;
|
|
4303
|
+
if (target === void 0)
|
|
4304
|
+
return true;
|
|
4305
|
+
for (const k in target) {
|
|
4306
|
+
if (query[k] !== target[k])
|
|
4307
|
+
return false;
|
|
4308
|
+
}
|
|
4119
4309
|
return true;
|
|
4120
4310
|
}
|
|
4121
|
-
function
|
|
4122
|
-
return
|
|
4311
|
+
function matchAxisId(query, target) {
|
|
4312
|
+
return query.name === target.name && matchDomain$1(query.domain, target.domain);
|
|
4123
4313
|
}
|
|
4124
|
-
function
|
|
4125
|
-
return { ...
|
|
4314
|
+
function mapPTableDef(def, cb) {
|
|
4315
|
+
return { ...def, src: mapJoinEntry(def.src, cb) };
|
|
4126
4316
|
}
|
|
4127
|
-
function
|
|
4128
|
-
switch (
|
|
4317
|
+
function mapJoinEntry(entry, cb) {
|
|
4318
|
+
switch (entry.type) {
|
|
4129
4319
|
case "column":
|
|
4130
4320
|
return {
|
|
4131
4321
|
type: "column",
|
|
4132
|
-
column:
|
|
4322
|
+
column: cb(entry.column)
|
|
4133
4323
|
};
|
|
4134
4324
|
case "slicedColumn":
|
|
4135
4325
|
return {
|
|
4136
4326
|
type: "slicedColumn",
|
|
4137
|
-
column:
|
|
4138
|
-
newId:
|
|
4139
|
-
axisFilters:
|
|
4327
|
+
column: cb(entry.column),
|
|
4328
|
+
newId: entry.newId,
|
|
4329
|
+
axisFilters: entry.axisFilters
|
|
4330
|
+
};
|
|
4331
|
+
case "artificialColumn":
|
|
4332
|
+
return {
|
|
4333
|
+
type: "artificialColumn",
|
|
4334
|
+
column: cb(entry.column),
|
|
4335
|
+
newId: entry.newId,
|
|
4336
|
+
axesIndices: entry.axesIndices
|
|
4140
4337
|
};
|
|
4141
4338
|
case "inlineColumn":
|
|
4142
|
-
return
|
|
4339
|
+
return entry;
|
|
4143
4340
|
case "inner":
|
|
4144
4341
|
case "full":
|
|
4145
4342
|
return {
|
|
4146
|
-
type:
|
|
4147
|
-
entries:
|
|
4343
|
+
type: entry.type,
|
|
4344
|
+
entries: entry.entries.map((col) => mapJoinEntry(col, cb))
|
|
4148
4345
|
};
|
|
4149
4346
|
case "outer":
|
|
4150
4347
|
return {
|
|
4151
4348
|
type: "outer",
|
|
4152
|
-
primary:
|
|
4153
|
-
secondary:
|
|
4349
|
+
primary: mapJoinEntry(entry.primary, cb),
|
|
4350
|
+
secondary: entry.secondary.map((col) => mapJoinEntry(col, cb))
|
|
4154
4351
|
};
|
|
4155
4352
|
default:
|
|
4156
|
-
|
|
4353
|
+
assertNever(entry);
|
|
4157
4354
|
}
|
|
4158
4355
|
}
|
|
4159
|
-
function
|
|
4160
|
-
return
|
|
4356
|
+
function stringifyColumnId(id) {
|
|
4357
|
+
return canonicalize(id);
|
|
4161
4358
|
}
|
|
4162
|
-
function
|
|
4163
|
-
return
|
|
4359
|
+
function axisKey(axis) {
|
|
4360
|
+
return canonicalize(getAxisId(axis));
|
|
4164
4361
|
}
|
|
4165
|
-
function
|
|
4166
|
-
return JSON.stringify([
|
|
4362
|
+
function domainKey(key, value) {
|
|
4363
|
+
return JSON.stringify([key, value]);
|
|
4167
4364
|
}
|
|
4168
|
-
class
|
|
4365
|
+
class AnchoredIdDeriver {
|
|
4169
4366
|
/**
|
|
4170
4367
|
* Creates a new anchor context from a set of anchor column specifications
|
|
4171
4368
|
* @param anchors Record of anchor column specifications indexed by anchor ID
|
|
4172
4369
|
*/
|
|
4173
|
-
constructor(
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4370
|
+
constructor(anchors) {
|
|
4371
|
+
__publicField(this, "anchors");
|
|
4372
|
+
__publicField(this, "domains", /* @__PURE__ */ new Map());
|
|
4373
|
+
__publicField(this, "axes", /* @__PURE__ */ new Map());
|
|
4374
|
+
/**
|
|
4375
|
+
* Domain packs are used to group domain keys that can be anchored to the same anchor
|
|
4376
|
+
* This is used to optimize the lookup of domain anchors
|
|
4377
|
+
*/
|
|
4378
|
+
__publicField(this, "domainPacks", []);
|
|
4379
|
+
/**
|
|
4380
|
+
* Maps domain packs to anchors
|
|
4381
|
+
*/
|
|
4382
|
+
__publicField(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
|
|
4383
|
+
this.anchors = anchors;
|
|
4384
|
+
const anchorEntries = Object.entries(anchors);
|
|
4385
|
+
anchorEntries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
4386
|
+
for (const [anchorId, spec] of anchorEntries) {
|
|
4387
|
+
for (let axisIdx = 0; axisIdx < spec.axesSpec.length; axisIdx++) {
|
|
4388
|
+
const axis = spec.axesSpec[axisIdx];
|
|
4389
|
+
const key = axisKey(axis);
|
|
4390
|
+
this.axes.set(key, { anchor: anchorId, idx: axisIdx });
|
|
4185
4391
|
}
|
|
4186
|
-
if (
|
|
4187
|
-
const
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4392
|
+
if (spec.domain !== void 0) {
|
|
4393
|
+
const domainEntries = Object.entries(spec.domain);
|
|
4394
|
+
domainEntries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
4395
|
+
this.domainPackToAnchor.set(JSON.stringify(domainEntries), anchorId);
|
|
4396
|
+
this.domainPacks.push(domainEntries.map(([dKey]) => dKey));
|
|
4397
|
+
for (const [dKey, dValue] of domainEntries) {
|
|
4398
|
+
const key = domainKey(dKey, dValue);
|
|
4399
|
+
this.domains.set(key, anchorId);
|
|
4192
4400
|
}
|
|
4193
4401
|
}
|
|
4194
4402
|
}
|
|
@@ -4196,57 +4404,69 @@
|
|
|
4196
4404
|
/**
|
|
4197
4405
|
* Implementation of derive method
|
|
4198
4406
|
*/
|
|
4199
|
-
derive(
|
|
4200
|
-
const
|
|
4201
|
-
name:
|
|
4407
|
+
derive(spec, axisFilters) {
|
|
4408
|
+
const result = {
|
|
4409
|
+
name: spec.name,
|
|
4202
4410
|
axes: []
|
|
4203
4411
|
};
|
|
4204
|
-
let
|
|
4205
|
-
if (
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
}
|
|
4412
|
+
let skipDomains = void 0;
|
|
4413
|
+
if (spec.domain !== void 0) {
|
|
4414
|
+
outer: for (const domainPack of this.domainPacks) {
|
|
4415
|
+
const dAnchor = [];
|
|
4416
|
+
for (const domainKey2 of domainPack) {
|
|
4417
|
+
const dValue = spec.domain[domainKey2];
|
|
4418
|
+
if (dValue !== void 0)
|
|
4419
|
+
dAnchor.push([domainKey2, dValue]);
|
|
4420
|
+
else
|
|
4421
|
+
break outer;
|
|
4422
|
+
}
|
|
4423
|
+
const domainAnchor = this.domainPackToAnchor.get(JSON.stringify(dAnchor));
|
|
4424
|
+
if (domainAnchor !== void 0) {
|
|
4425
|
+
result.domainAnchor = domainAnchor;
|
|
4426
|
+
skipDomains = new Set(domainPack);
|
|
4427
|
+
break;
|
|
4221
4428
|
}
|
|
4222
|
-
|
|
4223
|
-
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
for (const [dKey, dValue] of Object.entries(spec.domain ?? {})) {
|
|
4432
|
+
if (skipDomains !== void 0 && skipDomains.has(dKey))
|
|
4224
4433
|
continue;
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4434
|
+
const key = domainKey(dKey, dValue);
|
|
4435
|
+
const anchorId = this.domains.get(key);
|
|
4436
|
+
result.domain ?? (result.domain = {});
|
|
4437
|
+
result.domain[dKey] = anchorId ? { anchor: anchorId } : dValue;
|
|
4438
|
+
}
|
|
4439
|
+
result.axes = spec.axesSpec.map((axis) => {
|
|
4440
|
+
const key = axisKey(axis);
|
|
4441
|
+
const anchorAxisRef = this.axes.get(key);
|
|
4442
|
+
if (anchorAxisRef === void 0)
|
|
4443
|
+
return getAxisId(axis);
|
|
4444
|
+
else
|
|
4445
|
+
return anchorAxisRef;
|
|
4446
|
+
});
|
|
4447
|
+
if (!axisFilters || axisFilters.length === 0) {
|
|
4448
|
+
return result;
|
|
4449
|
+
}
|
|
4450
|
+
const resolvedFilters = [];
|
|
4451
|
+
for (const filter of axisFilters) {
|
|
4452
|
+
const [axisIdOrIndex, value] = filter;
|
|
4453
|
+
if (typeof axisIdOrIndex === "number") {
|
|
4454
|
+
if (axisIdOrIndex < 0 || axisIdOrIndex >= spec.axesSpec.length) {
|
|
4455
|
+
throw new Error(`Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`);
|
|
4456
|
+
}
|
|
4457
|
+
resolvedFilters.push([axisIdOrIndex, value]);
|
|
4240
4458
|
} else {
|
|
4241
|
-
const
|
|
4242
|
-
if (
|
|
4243
|
-
throw new Error(`Axis with name "${
|
|
4244
|
-
|
|
4459
|
+
const axisIndex = spec.axesSpec.findIndex((axis) => axis.name === axisIdOrIndex);
|
|
4460
|
+
if (axisIndex === -1) {
|
|
4461
|
+
throw new Error(`Axis with name "${axisIdOrIndex}" not found in the column specification`);
|
|
4462
|
+
}
|
|
4463
|
+
resolvedFilters.push([axisIndex, value]);
|
|
4245
4464
|
}
|
|
4246
4465
|
}
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4466
|
+
resolvedFilters.sort((a, b) => a[0] - b[0]);
|
|
4467
|
+
return {
|
|
4468
|
+
source: result,
|
|
4469
|
+
axisFilters: resolvedFilters
|
|
4250
4470
|
};
|
|
4251
4471
|
}
|
|
4252
4472
|
/**
|
|
@@ -4255,467 +4475,389 @@
|
|
|
4255
4475
|
* @param axisFilters Optional axis filters to apply to the column
|
|
4256
4476
|
* @returns A canonicalized string representation of the anchored column identifier
|
|
4257
4477
|
*/
|
|
4258
|
-
deriveS(
|
|
4259
|
-
return
|
|
4260
|
-
}
|
|
4261
|
-
}
|
|
4262
|
-
function
|
|
4263
|
-
const
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
if (!
|
|
4281
|
-
|
|
4282
|
-
|
|
4478
|
+
deriveS(spec, axisFilters) {
|
|
4479
|
+
return stringifyColumnId(this.derive(spec, axisFilters));
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
function resolveAnchors(anchors, matcher, options) {
|
|
4483
|
+
const result = { ...matcher };
|
|
4484
|
+
const ignoreMissingDomains = (options == null ? void 0 : options.ignoreMissingDomains) ?? false;
|
|
4485
|
+
if (result.domainAnchor !== void 0) {
|
|
4486
|
+
const anchorSpec = anchors[result.domainAnchor];
|
|
4487
|
+
if (!anchorSpec)
|
|
4488
|
+
throw new Error(`Anchor "${result.domainAnchor}" not found`);
|
|
4489
|
+
const anchorDomains = anchorSpec.domain || {};
|
|
4490
|
+
result.domain = { ...anchorDomains, ...result.domain };
|
|
4491
|
+
delete result.domainAnchor;
|
|
4492
|
+
}
|
|
4493
|
+
if (result.domain) {
|
|
4494
|
+
const resolvedDomain = {};
|
|
4495
|
+
for (const [key, value] of Object.entries(result.domain)) {
|
|
4496
|
+
if (typeof value === "string") {
|
|
4497
|
+
resolvedDomain[key] = value;
|
|
4498
|
+
} else {
|
|
4499
|
+
const anchorSpec = anchors[value.anchor];
|
|
4500
|
+
if (!anchorSpec)
|
|
4501
|
+
throw new Error(`Anchor "${value.anchor}" not found for domain key "${key}"`);
|
|
4502
|
+
if (!anchorSpec.domain || anchorSpec.domain[key] === void 0) {
|
|
4503
|
+
if (!ignoreMissingDomains)
|
|
4504
|
+
throw new Error(`Domain key "${key}" not found in anchor "${value.anchor}"`);
|
|
4283
4505
|
continue;
|
|
4284
4506
|
}
|
|
4285
|
-
|
|
4507
|
+
resolvedDomain[key] = anchorSpec.domain[key];
|
|
4286
4508
|
}
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
if (!
|
|
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
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
return
|
|
4330
|
-
}
|
|
4331
|
-
function
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4509
|
+
}
|
|
4510
|
+
result.domain = resolvedDomain;
|
|
4511
|
+
}
|
|
4512
|
+
if (result.axes)
|
|
4513
|
+
result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));
|
|
4514
|
+
return result;
|
|
4515
|
+
}
|
|
4516
|
+
function resolveAxisReference(anchors, axisRef) {
|
|
4517
|
+
if (!isAnchorAxisRef(axisRef))
|
|
4518
|
+
return axisRef;
|
|
4519
|
+
const anchorId = axisRef.anchor;
|
|
4520
|
+
const anchorSpec = anchors[anchorId];
|
|
4521
|
+
if (!anchorSpec)
|
|
4522
|
+
throw new Error(`Anchor "${anchorId}" not found for axis reference`);
|
|
4523
|
+
if ("idx" in axisRef) {
|
|
4524
|
+
if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)
|
|
4525
|
+
throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor "${anchorId}"`);
|
|
4526
|
+
return anchorSpec.axesSpec[axisRef.idx];
|
|
4527
|
+
} else if ("name" in axisRef) {
|
|
4528
|
+
const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);
|
|
4529
|
+
if (matches.length > 1)
|
|
4530
|
+
throw new Error(`Multiple axes with name "${axisRef.name}" found in anchor "${anchorId}"`);
|
|
4531
|
+
if (matches.length === 0)
|
|
4532
|
+
throw new Error(`Axis with name "${axisRef.name}" not found in anchor "${anchorId}"`);
|
|
4533
|
+
return matches[0];
|
|
4534
|
+
} else if ("id" in axisRef) {
|
|
4535
|
+
const matches = anchorSpec.axesSpec.filter((axis) => matchAxisId(axisRef.id, getAxisId(axis)));
|
|
4536
|
+
if (matches.length > 1)
|
|
4537
|
+
throw new Error(`Multiple matching axes found for matcher in anchor "${anchorId}"`);
|
|
4538
|
+
if (matches.length === 0)
|
|
4539
|
+
throw new Error(`No matching axis found for matcher in anchor "${anchorId}"`);
|
|
4540
|
+
return matches[0];
|
|
4541
|
+
}
|
|
4542
|
+
throw new Error(`Unsupported axis reference type`);
|
|
4543
|
+
}
|
|
4544
|
+
function isAnchorAxisRef(value) {
|
|
4545
|
+
return typeof value === "object" && "anchor" in value;
|
|
4546
|
+
}
|
|
4547
|
+
function isPColumnSpec(spec) {
|
|
4548
|
+
return spec.kind === "PColumn";
|
|
4549
|
+
}
|
|
4550
|
+
function isPColumn(obj) {
|
|
4551
|
+
return isPColumnSpec(obj.spec);
|
|
4552
|
+
}
|
|
4553
|
+
function ensurePColumn(obj) {
|
|
4554
|
+
if (!isPColumn(obj))
|
|
4555
|
+
throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);
|
|
4556
|
+
return obj;
|
|
4557
|
+
}
|
|
4558
|
+
function mapPObjectData(pObj, cb) {
|
|
4559
|
+
return pObj === void 0 ? void 0 : {
|
|
4560
|
+
...pObj,
|
|
4561
|
+
data: cb(pObj.data)
|
|
4335
4562
|
};
|
|
4336
4563
|
}
|
|
4337
|
-
function
|
|
4338
|
-
const
|
|
4339
|
-
|
|
4564
|
+
function extractAllColumns(entry) {
|
|
4565
|
+
const columns = /* @__PURE__ */ new Map();
|
|
4566
|
+
const addAllColumns = (entry2) => {
|
|
4567
|
+
switch (entry2.type) {
|
|
4340
4568
|
case "column":
|
|
4341
|
-
|
|
4569
|
+
columns.set(entry2.column.id, entry2.column);
|
|
4342
4570
|
return;
|
|
4343
4571
|
case "slicedColumn":
|
|
4344
|
-
|
|
4572
|
+
columns.set(entry2.column.id, entry2.column);
|
|
4573
|
+
return;
|
|
4574
|
+
case "artificialColumn":
|
|
4575
|
+
columns.set(entry2.column.id, entry2.column);
|
|
4345
4576
|
return;
|
|
4346
4577
|
case "inlineColumn":
|
|
4347
4578
|
return;
|
|
4348
4579
|
case "full":
|
|
4349
4580
|
case "inner":
|
|
4350
|
-
for (const
|
|
4581
|
+
for (const e of entry2.entries)
|
|
4582
|
+
addAllColumns(e);
|
|
4351
4583
|
return;
|
|
4352
4584
|
case "outer":
|
|
4353
|
-
|
|
4354
|
-
for (const
|
|
4585
|
+
addAllColumns(entry2.primary);
|
|
4586
|
+
for (const e of entry2.secondary)
|
|
4587
|
+
addAllColumns(e);
|
|
4355
4588
|
return;
|
|
4356
4589
|
default:
|
|
4357
|
-
|
|
4590
|
+
assertNever(entry2);
|
|
4358
4591
|
}
|
|
4359
4592
|
};
|
|
4360
|
-
|
|
4593
|
+
addAllColumns(entry);
|
|
4594
|
+
return [...columns.values()];
|
|
4361
4595
|
}
|
|
4362
|
-
function
|
|
4363
|
-
if (
|
|
4596
|
+
function matchAxis(selector, axis) {
|
|
4597
|
+
if (selector.name !== void 0 && selector.name !== axis.name)
|
|
4364
4598
|
return false;
|
|
4365
|
-
if (
|
|
4366
|
-
if (Array.isArray(
|
|
4367
|
-
if (!
|
|
4599
|
+
if (selector.type !== void 0) {
|
|
4600
|
+
if (Array.isArray(selector.type)) {
|
|
4601
|
+
if (!selector.type.includes(axis.type))
|
|
4368
4602
|
return false;
|
|
4369
|
-
} else if (
|
|
4603
|
+
} else if (selector.type !== axis.type) {
|
|
4370
4604
|
return false;
|
|
4605
|
+
}
|
|
4371
4606
|
}
|
|
4372
|
-
if (
|
|
4373
|
-
const
|
|
4374
|
-
for (const [
|
|
4375
|
-
if (
|
|
4607
|
+
if (selector.domain !== void 0) {
|
|
4608
|
+
const axisDomain = axis.domain || {};
|
|
4609
|
+
for (const [key, value] of Object.entries(selector.domain))
|
|
4610
|
+
if (axisDomain[key] !== value)
|
|
4376
4611
|
return false;
|
|
4377
4612
|
}
|
|
4378
4613
|
return true;
|
|
4379
4614
|
}
|
|
4380
|
-
function
|
|
4381
|
-
if (
|
|
4615
|
+
function matchPColumn(pcolumn, selector) {
|
|
4616
|
+
if (selector.name !== void 0 && pcolumn.name !== selector.name)
|
|
4382
4617
|
return false;
|
|
4383
|
-
if (
|
|
4384
|
-
|
|
4385
|
-
|
|
4618
|
+
if (selector.namePattern !== void 0 && !new RegExp(selector.namePattern).test(pcolumn.name))
|
|
4619
|
+
return false;
|
|
4620
|
+
if (selector.type !== void 0) {
|
|
4621
|
+
if (Array.isArray(selector.type)) {
|
|
4622
|
+
if (!selector.type.includes(pcolumn.valueType))
|
|
4386
4623
|
return false;
|
|
4387
|
-
} else if (
|
|
4624
|
+
} else if (selector.type !== pcolumn.valueType) {
|
|
4388
4625
|
return false;
|
|
4626
|
+
}
|
|
4389
4627
|
}
|
|
4390
|
-
if (
|
|
4391
|
-
const
|
|
4392
|
-
for (const [
|
|
4393
|
-
if (
|
|
4628
|
+
if (selector.domain !== void 0) {
|
|
4629
|
+
const columnDomain = pcolumn.domain || {};
|
|
4630
|
+
for (const [key, value] of Object.entries(selector.domain))
|
|
4631
|
+
if (columnDomain[key] !== value)
|
|
4394
4632
|
return false;
|
|
4395
4633
|
}
|
|
4396
|
-
if (
|
|
4397
|
-
const
|
|
4398
|
-
if (
|
|
4399
|
-
for (const
|
|
4400
|
-
if (!
|
|
4634
|
+
if (selector.axes !== void 0) {
|
|
4635
|
+
const pcolumnAxes = pcolumn.axesSpec.map(getAxisId);
|
|
4636
|
+
if (selector.partialAxesMatch) {
|
|
4637
|
+
for (const selectorAxis of selector.axes)
|
|
4638
|
+
if (!pcolumnAxes.some((columnAxis) => matchAxis(selectorAxis, columnAxis)))
|
|
4401
4639
|
return false;
|
|
4402
4640
|
} else {
|
|
4403
|
-
if (
|
|
4641
|
+
if (pcolumnAxes.length !== selector.axes.length)
|
|
4404
4642
|
return false;
|
|
4405
|
-
for (let
|
|
4406
|
-
if (!
|
|
4643
|
+
for (let i = 0; i < selector.axes.length; i++)
|
|
4644
|
+
if (!matchAxis(selector.axes[i], pcolumnAxes[i]))
|
|
4407
4645
|
return false;
|
|
4408
4646
|
}
|
|
4409
4647
|
}
|
|
4410
|
-
if (
|
|
4411
|
-
const
|
|
4412
|
-
for (const [
|
|
4413
|
-
if (
|
|
4648
|
+
if (selector.annotations !== void 0) {
|
|
4649
|
+
const columnAnnotations = pcolumn.annotations || {};
|
|
4650
|
+
for (const [key, value] of Object.entries(selector.annotations))
|
|
4651
|
+
if (columnAnnotations[key] !== value)
|
|
4414
4652
|
return false;
|
|
4415
4653
|
}
|
|
4416
|
-
if (
|
|
4417
|
-
const
|
|
4418
|
-
for (const [
|
|
4419
|
-
const
|
|
4420
|
-
if (
|
|
4654
|
+
if (selector.annotationPatterns !== void 0) {
|
|
4655
|
+
const columnAnnotations = pcolumn.annotations || {};
|
|
4656
|
+
for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {
|
|
4657
|
+
const value = columnAnnotations[key];
|
|
4658
|
+
if (value === void 0 || !new RegExp(pattern).test(value))
|
|
4421
4659
|
return false;
|
|
4422
4660
|
}
|
|
4423
4661
|
}
|
|
4424
4662
|
return true;
|
|
4425
4663
|
}
|
|
4426
|
-
function
|
|
4427
|
-
|
|
4664
|
+
function selectorsToPredicate(predicateOrSelectors) {
|
|
4665
|
+
if (Array.isArray(predicateOrSelectors))
|
|
4666
|
+
return (spec) => predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));
|
|
4667
|
+
else
|
|
4668
|
+
return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);
|
|
4428
4669
|
}
|
|
4429
|
-
function
|
|
4430
|
-
const
|
|
4431
|
-
kind:
|
|
4432
|
-
name:
|
|
4670
|
+
function deriveNativeId(spec) {
|
|
4671
|
+
const result = {
|
|
4672
|
+
kind: spec.kind,
|
|
4673
|
+
name: spec.name
|
|
4433
4674
|
};
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4675
|
+
if (spec.domain !== void 0)
|
|
4676
|
+
result.domain = spec.domain;
|
|
4677
|
+
if (isPColumnSpec(spec))
|
|
4678
|
+
result.axesSpec = getAxesId(spec.axesSpec);
|
|
4679
|
+
return canonicalize(result);
|
|
4680
|
+
}
|
|
4681
|
+
const PlIdLength = 24;
|
|
4682
|
+
z.string().length(PlIdLength).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
|
|
4683
|
+
z.object({
|
|
4684
|
+
__isRef: z.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
|
|
4685
|
+
blockId: z.string().describe("Upstream block id"),
|
|
4686
|
+
name: z.string().describe("Name of the output provided to the upstream block's output context"),
|
|
4687
|
+
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")
|
|
4688
|
+
}).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();
|
|
4689
|
+
function isPlRef(value) {
|
|
4690
|
+
return typeof value === "object" && value !== null && "__isRef" in value && value.__isRef === true && "blockId" in value && "name" in value;
|
|
4691
|
+
}
|
|
4692
|
+
function withEnrichments(ref, requireEnrichments = true) {
|
|
4693
|
+
if (requireEnrichments)
|
|
4449
4694
|
return {
|
|
4450
|
-
...
|
|
4695
|
+
...ref,
|
|
4451
4696
|
requireEnrichments: true
|
|
4452
4697
|
};
|
|
4453
|
-
{
|
|
4454
|
-
const { requireEnrichments:
|
|
4455
|
-
return
|
|
4456
|
-
}
|
|
4457
|
-
}
|
|
4458
|
-
function
|
|
4459
|
-
return
|
|
4460
|
-
}
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
exports3 = module2.exports = stringify2;
|
|
4473
|
-
exports3.getSerialize = serializer;
|
|
4474
|
-
function stringify2(obj, replacer, spaces, cycleReplacer) {
|
|
4475
|
-
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
|
|
4476
|
-
}
|
|
4477
|
-
function serializer(replacer, cycleReplacer) {
|
|
4478
|
-
var stack = [], keys = [];
|
|
4479
|
-
if (cycleReplacer == null) cycleReplacer = function(key, value) {
|
|
4480
|
-
if (stack[0] === value) return "[Circular ~]";
|
|
4481
|
-
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
4482
|
-
};
|
|
4483
|
-
return function(key, value) {
|
|
4484
|
-
if (stack.length > 0) {
|
|
4485
|
-
var thisPos = stack.indexOf(this);
|
|
4486
|
-
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
4487
|
-
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
4488
|
-
if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value);
|
|
4489
|
-
} else stack.push(value);
|
|
4490
|
-
return replacer == null ? value : replacer.call(this, key, value);
|
|
4491
|
-
};
|
|
4492
|
-
}
|
|
4493
|
-
})(stringify, stringify.exports);
|
|
4494
|
-
return stringify.exports;
|
|
4495
|
-
}
|
|
4496
|
-
requireStringify();
|
|
4497
|
-
const l = z$1.object({
|
|
4498
|
-
type: z$1.literal("PlError"),
|
|
4499
|
-
name: z$1.string(),
|
|
4500
|
-
message: z$1.string(),
|
|
4501
|
-
/** The message with all details needed for SDK developers. */
|
|
4502
|
-
fullMessage: z$1.string().optional(),
|
|
4503
|
-
stack: z$1.string().optional()
|
|
4504
|
-
}), c = l.extend({
|
|
4505
|
-
cause: z$1.lazy(() => s).optional(),
|
|
4506
|
-
errors: z$1.lazy(() => s.array()).optional()
|
|
4507
|
-
}), m = z$1.object({
|
|
4508
|
-
type: z$1.literal("StandardError"),
|
|
4509
|
-
name: z$1.string(),
|
|
4510
|
-
message: z$1.string(),
|
|
4511
|
-
stack: z$1.string().optional()
|
|
4512
|
-
}), p = m.extend({
|
|
4513
|
-
cause: z$1.lazy(() => s).optional(),
|
|
4514
|
-
errors: z$1.lazy(() => s.array()).optional()
|
|
4515
|
-
}), s = z$1.union([p, c]);
|
|
4516
|
-
const u = z$1.object({
|
|
4517
|
-
name: z$1.string(),
|
|
4518
|
-
message: z$1.string(),
|
|
4519
|
-
fullMessage: z$1.string().optional(),
|
|
4520
|
-
stack: z$1.string().optional()
|
|
4521
|
-
}), n = u.extend({
|
|
4522
|
-
cause: z$1.lazy(() => n).optional(),
|
|
4523
|
-
errors: z$1.lazy(() => n.array()).optional()
|
|
4524
|
-
});
|
|
4525
|
-
var Ye = Object.defineProperty;
|
|
4526
|
-
var Xe = (t, e, n2) => e in t ? Ye(t, e, { enumerable: true, configurable: true, writable: true, value: n2 }) : t[e] = n2;
|
|
4527
|
-
var k = (t, e, n2) => Xe(t, typeof e != "symbol" ? e + "" : e, n2);
|
|
4528
|
-
function re(t) {
|
|
4529
|
-
return { type: "Immediate", value: t };
|
|
4530
|
-
}
|
|
4531
|
-
function ht() {
|
|
4532
|
-
return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
|
|
4533
|
-
}
|
|
4534
|
-
function Ke(t) {
|
|
4535
|
-
if (t && typeof globalThis.getPlatforma == "function")
|
|
4536
|
-
return globalThis.getPlatforma(t);
|
|
4537
|
-
if (typeof globalThis.platforma < "u") return globalThis.platforma;
|
|
4538
|
-
throw new Error("Can't get platforma instance.");
|
|
4539
|
-
}
|
|
4540
|
-
function gt() {
|
|
4541
|
-
if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
|
|
4542
|
-
}
|
|
4543
|
-
function y() {
|
|
4544
|
-
if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
|
|
4545
|
-
throw new Error("Not in config rendering context");
|
|
4546
|
-
}
|
|
4547
|
-
function H(t, e) {
|
|
4548
|
-
const n2 = gt();
|
|
4549
|
-
if (n2 === void 0) return false;
|
|
4550
|
-
if (t in n2.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
|
|
4551
|
-
return n2.callbackRegistry[t] = e, true;
|
|
4552
|
-
}
|
|
4553
|
-
const de = /* @__PURE__ */ new Map();
|
|
4554
|
-
function mt(t, e) {
|
|
4555
|
-
t in y().callbackRegistry || (y().callbackRegistry[t] = (n2) => {
|
|
4556
|
-
for (const r of de.get(t))
|
|
4557
|
-
r(n2);
|
|
4558
|
-
}, de.set(t, [])), de.get(t).push(e);
|
|
4559
|
-
}
|
|
4560
|
-
class I {
|
|
4561
|
-
constructor(e, n2 = (r) => r) {
|
|
4562
|
-
k(this, "isResolved", false);
|
|
4563
|
-
k(this, "resolvedValue");
|
|
4564
|
-
this.handle = e, this.postProcess = n2, mt(e, (r) => {
|
|
4565
|
-
this.resolvedValue = n2(r), this.isResolved = true;
|
|
4698
|
+
else {
|
|
4699
|
+
const { requireEnrichments: _, ...rest } = ref;
|
|
4700
|
+
return rest;
|
|
4701
|
+
}
|
|
4702
|
+
}
|
|
4703
|
+
function mapValueInVOE(voe, cb) {
|
|
4704
|
+
return voe.ok ? { ok: true, value: cb(voe.value) } : voe;
|
|
4705
|
+
}
|
|
4706
|
+
class FutureRef {
|
|
4707
|
+
constructor(handle, postProcess = (v) => v) {
|
|
4708
|
+
__publicField(this, "handle");
|
|
4709
|
+
__publicField(this, "postProcess");
|
|
4710
|
+
__publicField(this, "isResolved", false);
|
|
4711
|
+
__publicField(this, "resolvedValue");
|
|
4712
|
+
this.handle = handle;
|
|
4713
|
+
this.postProcess = postProcess;
|
|
4714
|
+
registerFutureAwait(handle, (value) => {
|
|
4715
|
+
this.resolvedValue = postProcess(value);
|
|
4716
|
+
this.isResolved = true;
|
|
4566
4717
|
});
|
|
4567
4718
|
}
|
|
4568
|
-
map(
|
|
4569
|
-
return new
|
|
4719
|
+
map(mapping) {
|
|
4720
|
+
return new FutureRef(this.handle, (v) => mapping(this.postProcess(v)));
|
|
4570
4721
|
}
|
|
4571
|
-
mapDefined(
|
|
4572
|
-
return new
|
|
4573
|
-
const
|
|
4574
|
-
return
|
|
4722
|
+
mapDefined(mapping) {
|
|
4723
|
+
return new FutureRef(this.handle, (v) => {
|
|
4724
|
+
const vv = this.postProcess(v);
|
|
4725
|
+
return vv ? mapping(vv) : void 0;
|
|
4575
4726
|
});
|
|
4576
4727
|
}
|
|
4577
4728
|
toJSON() {
|
|
4578
4729
|
return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
|
|
4579
4730
|
}
|
|
4580
4731
|
}
|
|
4581
|
-
function
|
|
4582
|
-
return
|
|
4732
|
+
function ifDef(value, cb) {
|
|
4733
|
+
return value === void 0 ? void 0 : cb(value);
|
|
4583
4734
|
}
|
|
4584
|
-
class
|
|
4585
|
-
constructor(
|
|
4586
|
-
this
|
|
4735
|
+
class TreeNodeAccessor {
|
|
4736
|
+
constructor(handle, resolvePath) {
|
|
4737
|
+
__publicField(this, "handle");
|
|
4738
|
+
__publicField(this, "resolvePath");
|
|
4739
|
+
this.handle = handle;
|
|
4740
|
+
this.resolvePath = resolvePath;
|
|
4587
4741
|
}
|
|
4588
|
-
resolve(...
|
|
4589
|
-
const
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
...typeof r == "string" ? { field: r } : r
|
|
4602
|
-
})
|
|
4603
|
-
);
|
|
4604
|
-
return this.resolveWithCommon({}, ...n2);
|
|
4605
|
-
}
|
|
4606
|
-
resolveInput(...e) {
|
|
4607
|
-
const n2 = e.map(
|
|
4608
|
-
(r) => ({
|
|
4609
|
-
assertFieldType: "Input",
|
|
4610
|
-
...typeof r == "string" ? { field: r } : r
|
|
4611
|
-
})
|
|
4612
|
-
);
|
|
4613
|
-
return this.resolveWithCommon({}, ...n2);
|
|
4742
|
+
resolve(...steps) {
|
|
4743
|
+
const transformedSteps = steps.map((s) => ({
|
|
4744
|
+
assertFieldType: "Input",
|
|
4745
|
+
...typeof s === "string" ? { field: s } : s
|
|
4746
|
+
}));
|
|
4747
|
+
return this.resolveWithCommon({}, ...transformedSteps);
|
|
4748
|
+
}
|
|
4749
|
+
resolveOutput(...steps) {
|
|
4750
|
+
const transformedSteps = steps.map((s) => ({
|
|
4751
|
+
assertFieldType: "Output",
|
|
4752
|
+
...typeof s === "string" ? { field: s } : s
|
|
4753
|
+
}));
|
|
4754
|
+
return this.resolveWithCommon({}, ...transformedSteps);
|
|
4614
4755
|
}
|
|
4615
|
-
|
|
4616
|
-
|
|
4756
|
+
resolveInput(...steps) {
|
|
4757
|
+
const transformedSteps = steps.map((s) => ({
|
|
4758
|
+
assertFieldType: "Input",
|
|
4759
|
+
...typeof s === "string" ? { field: s } : s
|
|
4760
|
+
}));
|
|
4761
|
+
return this.resolveWithCommon({}, ...transformedSteps);
|
|
4762
|
+
}
|
|
4763
|
+
resolveAny(...steps) {
|
|
4764
|
+
return this.resolveWithCommon({}, ...steps);
|
|
4617
4765
|
}
|
|
4618
|
-
resolveWithCommon(
|
|
4619
|
-
const
|
|
4766
|
+
resolveWithCommon(commonOptions, ...steps) {
|
|
4767
|
+
const resolvePath = [
|
|
4620
4768
|
...this.resolvePath,
|
|
4621
|
-
...
|
|
4769
|
+
...steps.map((step) => typeof step === "string" ? step : step.field)
|
|
4622
4770
|
];
|
|
4623
|
-
return
|
|
4624
|
-
y().resolveWithCommon(this.handle, e, ...n2),
|
|
4625
|
-
(i) => new E(i, r)
|
|
4626
|
-
);
|
|
4771
|
+
return ifDef(getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps), (accessor) => new TreeNodeAccessor(accessor, resolvePath));
|
|
4627
4772
|
}
|
|
4628
4773
|
get resourceType() {
|
|
4629
|
-
return
|
|
4774
|
+
return getCfgRenderCtx().getResourceType(this.handle);
|
|
4630
4775
|
}
|
|
4631
4776
|
getInputsLocked() {
|
|
4632
|
-
return
|
|
4777
|
+
return getCfgRenderCtx().getInputsLocked(this.handle);
|
|
4633
4778
|
}
|
|
4634
4779
|
getOutputsLocked() {
|
|
4635
|
-
return
|
|
4780
|
+
return getCfgRenderCtx().getOutputsLocked(this.handle);
|
|
4636
4781
|
}
|
|
4637
4782
|
getIsReadyOrError() {
|
|
4638
|
-
return
|
|
4783
|
+
return getCfgRenderCtx().getIsReadyOrError(this.handle);
|
|
4639
4784
|
}
|
|
4640
4785
|
getIsFinal() {
|
|
4641
|
-
return
|
|
4786
|
+
return getCfgRenderCtx().getIsFinal(this.handle);
|
|
4642
4787
|
}
|
|
4643
4788
|
getError() {
|
|
4644
|
-
const
|
|
4645
|
-
return
|
|
4646
|
-
y().getError(this.handle),
|
|
4647
|
-
(n2) => new E(n2, e)
|
|
4648
|
-
);
|
|
4789
|
+
const resolvePath = [...this.resolvePath, "error"];
|
|
4790
|
+
return ifDef(getCfgRenderCtx().getError(this.handle), (accsessor) => new TreeNodeAccessor(accsessor, resolvePath));
|
|
4649
4791
|
}
|
|
4650
4792
|
listInputFields() {
|
|
4651
|
-
return
|
|
4793
|
+
return getCfgRenderCtx().listInputFields(this.handle);
|
|
4652
4794
|
}
|
|
4653
4795
|
listOutputFields() {
|
|
4654
|
-
return
|
|
4796
|
+
return getCfgRenderCtx().listOutputFields(this.handle);
|
|
4655
4797
|
}
|
|
4656
4798
|
listDynamicFields() {
|
|
4657
|
-
return
|
|
4799
|
+
return getCfgRenderCtx().listDynamicFields(this.handle);
|
|
4658
4800
|
}
|
|
4659
|
-
getKeyValueBase64(
|
|
4660
|
-
return
|
|
4801
|
+
getKeyValueBase64(key) {
|
|
4802
|
+
return getCfgRenderCtx().getKeyValueBase64(this.handle, key);
|
|
4661
4803
|
}
|
|
4662
|
-
getKeyValueAsString(
|
|
4663
|
-
return
|
|
4804
|
+
getKeyValueAsString(key) {
|
|
4805
|
+
return getCfgRenderCtx().getKeyValueAsString(this.handle, key);
|
|
4664
4806
|
}
|
|
4665
|
-
getKeyValueAsJson(
|
|
4666
|
-
const
|
|
4667
|
-
if (
|
|
4668
|
-
|
|
4807
|
+
getKeyValueAsJson(key) {
|
|
4808
|
+
const content = this.getKeyValueAsString(key);
|
|
4809
|
+
if (content == void 0)
|
|
4810
|
+
throw new Error("Resource has no content.");
|
|
4811
|
+
return JSON.parse(content);
|
|
4669
4812
|
}
|
|
4670
4813
|
getDataBase64() {
|
|
4671
|
-
return
|
|
4814
|
+
return getCfgRenderCtx().getDataBase64(this.handle);
|
|
4672
4815
|
}
|
|
4673
4816
|
getDataAsString() {
|
|
4674
|
-
return
|
|
4817
|
+
return getCfgRenderCtx().getDataAsString(this.handle);
|
|
4675
4818
|
}
|
|
4676
4819
|
getDataAsJson() {
|
|
4677
|
-
const
|
|
4678
|
-
if (
|
|
4679
|
-
|
|
4820
|
+
const content = this.getDataAsString();
|
|
4821
|
+
if (content == void 0)
|
|
4822
|
+
throw new Error("Resource has no content.");
|
|
4823
|
+
return JSON.parse(content);
|
|
4680
4824
|
}
|
|
4681
4825
|
/**
|
|
4682
4826
|
*
|
|
4683
4827
|
*/
|
|
4684
|
-
getPColumns(
|
|
4685
|
-
const
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4828
|
+
getPColumns(errorOnUnknownField = false, prefix = "") {
|
|
4829
|
+
const result = this.parsePObjectCollection(errorOnUnknownField, prefix);
|
|
4830
|
+
if (result === void 0)
|
|
4831
|
+
return void 0;
|
|
4832
|
+
const pf = Object.entries(result).map(([, obj]) => {
|
|
4833
|
+
if (!isPColumn(obj))
|
|
4834
|
+
throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);
|
|
4835
|
+
return obj;
|
|
4689
4836
|
});
|
|
4837
|
+
return pf;
|
|
4690
4838
|
}
|
|
4691
4839
|
/**
|
|
4692
4840
|
*
|
|
4693
4841
|
*/
|
|
4694
|
-
parsePObjectCollection(
|
|
4695
|
-
const
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
return new I(y().getBlobContentAsString(this.handle, e));
|
|
4714
|
-
}
|
|
4715
|
-
getFileContentAsJson(e) {
|
|
4716
|
-
return new I(
|
|
4717
|
-
y().getBlobContentAsString(this.handle, e)
|
|
4718
|
-
).mapDefined((n2) => JSON.parse(n2));
|
|
4842
|
+
parsePObjectCollection(errorOnUnknownField = false, prefix = "") {
|
|
4843
|
+
const pObjects = getCfgRenderCtx().parsePObjectCollection(this.handle, errorOnUnknownField, prefix, ...this.resolvePath);
|
|
4844
|
+
if (pObjects === void 0)
|
|
4845
|
+
return void 0;
|
|
4846
|
+
const result = {};
|
|
4847
|
+
for (const [key, value] of Object.entries(pObjects)) {
|
|
4848
|
+
const resolvePath = [...this.resolvePath, key];
|
|
4849
|
+
result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c, resolvePath));
|
|
4850
|
+
}
|
|
4851
|
+
return result;
|
|
4852
|
+
}
|
|
4853
|
+
getFileContentAsBase64(range) {
|
|
4854
|
+
return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle, range));
|
|
4855
|
+
}
|
|
4856
|
+
getFileContentAsString(range) {
|
|
4857
|
+
return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle, range));
|
|
4858
|
+
}
|
|
4859
|
+
getFileContentAsJson(range) {
|
|
4860
|
+
return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle, range)).mapDefined((v) => JSON.parse(v));
|
|
4719
4861
|
}
|
|
4720
4862
|
/**
|
|
4721
4863
|
* @deprecated use getFileContentAsBase64
|
|
@@ -4733,7 +4875,7 @@
|
|
|
4733
4875
|
* @returns downloaded file handle
|
|
4734
4876
|
*/
|
|
4735
4877
|
getFileHandle() {
|
|
4736
|
-
return new
|
|
4878
|
+
return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));
|
|
4737
4879
|
}
|
|
4738
4880
|
/**
|
|
4739
4881
|
* @deprecated use getFileHandle
|
|
@@ -4745,7 +4887,7 @@
|
|
|
4745
4887
|
* @returns downloaded file handle
|
|
4746
4888
|
*/
|
|
4747
4889
|
getRemoteFileHandle() {
|
|
4748
|
-
return new
|
|
4890
|
+
return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));
|
|
4749
4891
|
}
|
|
4750
4892
|
/**
|
|
4751
4893
|
* @deprecated use getRemoteFileHandle
|
|
@@ -4756,655 +4898,898 @@
|
|
|
4756
4898
|
/**
|
|
4757
4899
|
* @returns the url to the extracted folder
|
|
4758
4900
|
*/
|
|
4759
|
-
extractArchiveAndGetURL(
|
|
4760
|
-
return new
|
|
4901
|
+
extractArchiveAndGetURL(format) {
|
|
4902
|
+
return new FutureRef(getCfgRenderCtx().extractArchiveAndGetURL(this.handle, format));
|
|
4761
4903
|
}
|
|
4762
4904
|
getImportProgress() {
|
|
4763
|
-
return new
|
|
4905
|
+
return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));
|
|
4764
4906
|
}
|
|
4765
|
-
getLastLogs(
|
|
4766
|
-
return new
|
|
4907
|
+
getLastLogs(nLines) {
|
|
4908
|
+
return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));
|
|
4767
4909
|
}
|
|
4768
|
-
getProgressLog(
|
|
4769
|
-
return new
|
|
4910
|
+
getProgressLog(patternToSearch) {
|
|
4911
|
+
return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));
|
|
4770
4912
|
}
|
|
4771
|
-
getProgressLogWithInfo(
|
|
4772
|
-
return new
|
|
4913
|
+
getProgressLogWithInfo(patternToSearch) {
|
|
4914
|
+
return new FutureRef(getCfgRenderCtx().getProgressLogWithInfo(this.handle, patternToSearch));
|
|
4773
4915
|
}
|
|
4774
4916
|
getLogHandle() {
|
|
4775
|
-
return new
|
|
4917
|
+
return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));
|
|
4776
4918
|
}
|
|
4777
|
-
allFieldsResolved(
|
|
4778
|
-
switch (
|
|
4919
|
+
allFieldsResolved(fieldType = "Input") {
|
|
4920
|
+
switch (fieldType) {
|
|
4779
4921
|
case "Input":
|
|
4780
|
-
return this.getInputsLocked() && this.listInputFields().every(
|
|
4781
|
-
(n2) => this.resolve({ field: n2, assertFieldType: "Input" }) !== void 0
|
|
4782
|
-
);
|
|
4922
|
+
return this.getInputsLocked() && this.listInputFields().every((field) => this.resolve({ field, assertFieldType: "Input" }) !== void 0);
|
|
4783
4923
|
case "Output":
|
|
4784
|
-
return this.getOutputsLocked() && this.listOutputFields().every(
|
|
4785
|
-
(n2) => this.resolve({ field: n2, assertFieldType: "Output" }) !== void 0
|
|
4786
|
-
);
|
|
4924
|
+
return this.getOutputsLocked() && this.listOutputFields().every((field) => this.resolve({ field, assertFieldType: "Output" }) !== void 0);
|
|
4787
4925
|
}
|
|
4788
4926
|
}
|
|
4789
|
-
mapFields(
|
|
4790
|
-
const { fieldType
|
|
4927
|
+
mapFields(_mapping, _ops) {
|
|
4928
|
+
const { fieldType, requireLocked, skipUnresolved } = {
|
|
4791
4929
|
fieldType: "Input",
|
|
4792
4930
|
requireLocked: true,
|
|
4793
4931
|
skipUnresolved: false,
|
|
4794
|
-
...
|
|
4795
|
-
}
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4932
|
+
..._ops
|
|
4933
|
+
};
|
|
4934
|
+
const mapping = _mapping;
|
|
4935
|
+
if (requireLocked) {
|
|
4936
|
+
if (fieldType === "Input" && !this.getInputsLocked())
|
|
4937
|
+
return void 0;
|
|
4938
|
+
if (fieldType === "Output" && !this.getOutputsLocked())
|
|
4939
|
+
return void 0;
|
|
4940
|
+
}
|
|
4941
|
+
const fieldList = fieldType === "Input" ? this.listInputFields() : fieldType === "Output" ? this.listOutputFields() : this.listDynamicFields();
|
|
4942
|
+
let fieldEntries = fieldList.map((field) => [field, this.resolve({ field, assertFieldType: fieldType })]);
|
|
4943
|
+
if (skipUnresolved)
|
|
4944
|
+
fieldEntries = fieldEntries.filter((e) => e[1] !== void 0);
|
|
4945
|
+
return fieldEntries.map(([name, value]) => mapping(name, value));
|
|
4946
|
+
}
|
|
4947
|
+
}
|
|
4948
|
+
const StagingAccessorName = "staging";
|
|
4949
|
+
const MainAccessorName = "main";
|
|
4950
|
+
const TraceEntry = z.object({
|
|
4951
|
+
type: z.string(),
|
|
4952
|
+
importance: z.number().optional(),
|
|
4953
|
+
id: z.string().optional(),
|
|
4954
|
+
label: z.string()
|
|
4955
|
+
});
|
|
4956
|
+
const Trace = z.array(TraceEntry);
|
|
4957
|
+
const DistancePenalty = 1e-3;
|
|
4958
|
+
const LabelType = "__LABEL__";
|
|
4959
|
+
const LabelTypeFull = "__LABEL__@1";
|
|
4960
|
+
function deriveLabels(values, specExtractor, ops = {}) {
|
|
4961
|
+
const importances = /* @__PURE__ */ new Map();
|
|
4962
|
+
const forceTraceElements = ops.forceTraceElements !== void 0 && ops.forceTraceElements.length > 0 ? new Set(ops.forceTraceElements) : void 0;
|
|
4963
|
+
const numberOfRecordsWithType = /* @__PURE__ */ new Map();
|
|
4964
|
+
const enrichedRecords = values.map((value) => {
|
|
4965
|
+
const extractorResult = specExtractor(value);
|
|
4966
|
+
let spec;
|
|
4967
|
+
let prefixTrace;
|
|
4968
|
+
let suffixTrace;
|
|
4969
|
+
if ("spec" in extractorResult && typeof extractorResult.spec === "object") {
|
|
4970
|
+
spec = extractorResult.spec;
|
|
4971
|
+
prefixTrace = extractorResult.prefixTrace;
|
|
4972
|
+
suffixTrace = extractorResult.suffixTrace;
|
|
4973
|
+
} else {
|
|
4974
|
+
spec = extractorResult;
|
|
4975
|
+
}
|
|
4976
|
+
const label = readAnnotation(spec, Annotation.Label);
|
|
4977
|
+
const traceStr = readAnnotation(spec, Annotation.Trace);
|
|
4978
|
+
const baseTrace = (traceStr ? Trace.safeParse(parseJson(traceStr)).data : void 0) ?? [];
|
|
4979
|
+
const trace = [
|
|
4980
|
+
...prefixTrace ?? [],
|
|
4981
|
+
...baseTrace,
|
|
4982
|
+
...suffixTrace ?? []
|
|
4821
4983
|
];
|
|
4822
|
-
if (
|
|
4823
|
-
const
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4984
|
+
if (label !== void 0) {
|
|
4985
|
+
const labelEntry = { label, type: LabelType, importance: -2 };
|
|
4986
|
+
if (ops.addLabelAsSuffix)
|
|
4987
|
+
trace.push(labelEntry);
|
|
4988
|
+
else
|
|
4989
|
+
trace.splice(0, 0, labelEntry);
|
|
4990
|
+
}
|
|
4991
|
+
const fullTrace = [];
|
|
4992
|
+
const occurrences = /* @__PURE__ */ new Map();
|
|
4993
|
+
for (let i = trace.length - 1; i >= 0; --i) {
|
|
4994
|
+
const { type: typeName } = trace[i];
|
|
4995
|
+
const importance = trace[i].importance ?? 0;
|
|
4996
|
+
const occurrenceIndex = (occurrences.get(typeName) ?? 0) + 1;
|
|
4997
|
+
occurrences.set(typeName, occurrenceIndex);
|
|
4998
|
+
const fullType = `${typeName}@${occurrenceIndex}`;
|
|
4999
|
+
numberOfRecordsWithType.set(fullType, (numberOfRecordsWithType.get(fullType) ?? 0) + 1);
|
|
5000
|
+
importances.set(fullType, Math.max(importances.get(fullType) ?? Number.NEGATIVE_INFINITY, importance - (trace.length - i) * DistancePenalty));
|
|
5001
|
+
fullTrace.push({ ...trace[i], fullType, occurrenceIndex });
|
|
5002
|
+
}
|
|
5003
|
+
fullTrace.reverse();
|
|
5004
|
+
return {
|
|
5005
|
+
value,
|
|
5006
|
+
spec,
|
|
5007
|
+
label,
|
|
5008
|
+
fullTrace
|
|
4844
5009
|
};
|
|
4845
|
-
})
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
5010
|
+
});
|
|
5011
|
+
const mainTypes = [];
|
|
5012
|
+
const secondaryTypes = [];
|
|
5013
|
+
const allTypeRecords = [...importances];
|
|
5014
|
+
allTypeRecords.sort(([, i1], [, i2]) => i2 - i1);
|
|
5015
|
+
for (const [typeName] of allTypeRecords) {
|
|
5016
|
+
if (typeName.endsWith("@1") || numberOfRecordsWithType.get(typeName) === values.length)
|
|
5017
|
+
mainTypes.push(typeName);
|
|
5018
|
+
else
|
|
5019
|
+
secondaryTypes.push(typeName);
|
|
5020
|
+
}
|
|
5021
|
+
const calculate = (includedTypes2, force = false) => {
|
|
5022
|
+
const result = [];
|
|
5023
|
+
for (let i = 0; i < enrichedRecords.length; i++) {
|
|
5024
|
+
const r = enrichedRecords[i];
|
|
5025
|
+
const includedTrace = r.fullTrace.filter((fm) => includedTypes2.has(fm.fullType) || forceTraceElements && forceTraceElements.has(fm.type));
|
|
5026
|
+
if (includedTrace.length === 0) {
|
|
5027
|
+
if (force)
|
|
5028
|
+
result.push({
|
|
4856
5029
|
label: "Unlabeled",
|
|
4857
|
-
value:
|
|
5030
|
+
value: r.value
|
|
4858
5031
|
});
|
|
4859
|
-
else
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
5032
|
+
else
|
|
5033
|
+
return void 0;
|
|
5034
|
+
}
|
|
5035
|
+
const labelSet = includedTrace.map((fm) => fm.label);
|
|
5036
|
+
const sep = ops.separator ?? " / ";
|
|
5037
|
+
result.push({
|
|
5038
|
+
label: labelSet.join(sep),
|
|
5039
|
+
value: r.value
|
|
4864
5040
|
});
|
|
4865
5041
|
}
|
|
4866
|
-
return
|
|
5042
|
+
return result;
|
|
4867
5043
|
};
|
|
4868
|
-
if (
|
|
4869
|
-
if (
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
5044
|
+
if (mainTypes.length === 0) {
|
|
5045
|
+
if (secondaryTypes.length !== 0)
|
|
5046
|
+
throw new Error("Non-empty secondary types list while main types list is empty.");
|
|
5047
|
+
return calculate(new Set(LabelTypeFull), true);
|
|
5048
|
+
}
|
|
5049
|
+
let includedTypes = 0;
|
|
5050
|
+
let additionalType = -1;
|
|
5051
|
+
while (includedTypes < mainTypes.length) {
|
|
5052
|
+
const currentSet = /* @__PURE__ */ new Set();
|
|
5053
|
+
if (ops.includeNativeLabel)
|
|
5054
|
+
currentSet.add(LabelTypeFull);
|
|
5055
|
+
for (let i = 0; i < includedTypes; ++i)
|
|
5056
|
+
currentSet.add(mainTypes[i]);
|
|
5057
|
+
if (additionalType >= 0)
|
|
5058
|
+
currentSet.add(mainTypes[additionalType]);
|
|
5059
|
+
const candidateResult = calculate(currentSet);
|
|
5060
|
+
if (candidateResult !== void 0 && new Set(candidateResult.map((c) => c.label)).size === values.length)
|
|
5061
|
+
return candidateResult;
|
|
5062
|
+
additionalType++;
|
|
5063
|
+
if (additionalType >= mainTypes.length) {
|
|
5064
|
+
includedTypes++;
|
|
5065
|
+
additionalType = includedTypes;
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5068
|
+
return calculate(/* @__PURE__ */ new Set([...mainTypes, ...secondaryTypes]), true);
|
|
5069
|
+
}
|
|
5070
|
+
const PCD_PREFIX = "PColumnData/";
|
|
5071
|
+
const RT_RESOURCE_MAP = PCD_PREFIX + "ResourceMap";
|
|
5072
|
+
const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX + "Partitioned/ResourceMap";
|
|
5073
|
+
const RT_JSON_PARTITIONED = PCD_PREFIX + "JsonPartitioned";
|
|
5074
|
+
const RT_BINARY_PARTITIONED = PCD_PREFIX + "BinaryPartitioned";
|
|
5075
|
+
const PCD_SUP_PREFIX = PCD_PREFIX + "Partitioned/";
|
|
5076
|
+
const RT_JSON_SUPER_PARTITIONED = PCD_SUP_PREFIX + "JsonPartitioned";
|
|
5077
|
+
const RT_BINARY_SUPER_PARTITIONED = PCD_SUP_PREFIX + "BinaryPartitioned";
|
|
5078
|
+
const removeIndexSuffix = (keyStr) => {
|
|
5079
|
+
if (keyStr.endsWith(".index")) {
|
|
5080
|
+
return { baseKey: keyStr.substring(0, keyStr.length - 6), type: "index" };
|
|
5081
|
+
} else if (keyStr.endsWith(".values")) {
|
|
5082
|
+
return { baseKey: keyStr.substring(0, keyStr.length - 7), type: "values" };
|
|
5083
|
+
} else {
|
|
5084
|
+
throw new Error(`key must ends on .index/.values for binary p-column, got: ${keyStr}`);
|
|
5085
|
+
}
|
|
4891
5086
|
};
|
|
4892
|
-
function
|
|
4893
|
-
if (!
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
5087
|
+
function getPartitionKeysList(acc) {
|
|
5088
|
+
if (!acc)
|
|
5089
|
+
return void 0;
|
|
5090
|
+
const rt = acc.resourceType.name;
|
|
5091
|
+
const meta = acc.getDataAsJson();
|
|
5092
|
+
const data = [];
|
|
5093
|
+
let keyLength = 0;
|
|
5094
|
+
switch (rt) {
|
|
5095
|
+
case RT_RESOURCE_MAP:
|
|
5096
|
+
keyLength = meta["keyLength"];
|
|
4899
5097
|
break;
|
|
4900
|
-
case
|
|
4901
|
-
|
|
5098
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
5099
|
+
keyLength = meta["partitionKeyLength"] + meta["keyLength"];
|
|
4902
5100
|
break;
|
|
4903
|
-
case
|
|
4904
|
-
case
|
|
4905
|
-
|
|
5101
|
+
case RT_JSON_PARTITIONED:
|
|
5102
|
+
case RT_BINARY_PARTITIONED:
|
|
5103
|
+
keyLength = meta["partitionKeyLength"];
|
|
4906
5104
|
break;
|
|
4907
|
-
case
|
|
4908
|
-
case
|
|
4909
|
-
|
|
5105
|
+
case RT_BINARY_SUPER_PARTITIONED:
|
|
5106
|
+
case RT_JSON_SUPER_PARTITIONED:
|
|
5107
|
+
keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
|
|
4910
5108
|
break;
|
|
4911
5109
|
}
|
|
4912
|
-
switch (
|
|
4913
|
-
case
|
|
4914
|
-
case
|
|
4915
|
-
case
|
|
4916
|
-
for (let
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
5110
|
+
switch (rt) {
|
|
5111
|
+
case RT_RESOURCE_MAP:
|
|
5112
|
+
case RT_JSON_PARTITIONED:
|
|
5113
|
+
case RT_BINARY_PARTITIONED:
|
|
5114
|
+
for (let keyStr of acc.listInputFields()) {
|
|
5115
|
+
if (rt === RT_BINARY_PARTITIONED) {
|
|
5116
|
+
keyStr = removeIndexSuffix(keyStr).baseKey;
|
|
5117
|
+
}
|
|
5118
|
+
const key = [...JSON.parse(keyStr)];
|
|
5119
|
+
data.push(key);
|
|
4920
5120
|
}
|
|
4921
5121
|
break;
|
|
4922
|
-
case
|
|
4923
|
-
case
|
|
4924
|
-
case
|
|
4925
|
-
for (const
|
|
4926
|
-
const
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
5122
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
5123
|
+
case RT_BINARY_SUPER_PARTITIONED:
|
|
5124
|
+
case RT_JSON_SUPER_PARTITIONED:
|
|
5125
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
5126
|
+
const keyPrefix = [...JSON.parse(supKeyStr)];
|
|
5127
|
+
const value = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
5128
|
+
if (value !== void 0) {
|
|
5129
|
+
for (let keyStr of value.listInputFields()) {
|
|
5130
|
+
if (rt === RT_BINARY_SUPER_PARTITIONED) {
|
|
5131
|
+
keyStr = removeIndexSuffix(keyStr).baseKey;
|
|
5132
|
+
}
|
|
5133
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
5134
|
+
data.push(key);
|
|
4932
5135
|
}
|
|
5136
|
+
}
|
|
4933
5137
|
}
|
|
4934
5138
|
break;
|
|
4935
5139
|
}
|
|
4936
|
-
return { data
|
|
4937
|
-
}
|
|
4938
|
-
function
|
|
4939
|
-
if (
|
|
4940
|
-
throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${
|
|
4941
|
-
const { parts
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
}
|
|
4955
|
-
return
|
|
4956
|
-
}
|
|
4957
|
-
function
|
|
4958
|
-
if (
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
5140
|
+
return { data, keyLength };
|
|
5141
|
+
}
|
|
5142
|
+
function getUniquePartitionKeysForDataEntries(list) {
|
|
5143
|
+
if (list.type !== "JsonPartitioned" && list.type !== "BinaryPartitioned")
|
|
5144
|
+
throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${list.type}`);
|
|
5145
|
+
const { parts, partitionKeyLength } = list;
|
|
5146
|
+
const result = [];
|
|
5147
|
+
for (let i = 0; i < partitionKeyLength; ++i) {
|
|
5148
|
+
result.push(/* @__PURE__ */ new Set());
|
|
5149
|
+
}
|
|
5150
|
+
for (const part of parts) {
|
|
5151
|
+
const key = part.key;
|
|
5152
|
+
if (key.length !== partitionKeyLength) {
|
|
5153
|
+
throw new Error(`Key length (${key.length}) does not match partition length (${partitionKeyLength}) for key: ${JSON.stringify(key)}`);
|
|
5154
|
+
}
|
|
5155
|
+
for (let i = 0; i < partitionKeyLength; ++i) {
|
|
5156
|
+
result[i].add(key[i]);
|
|
5157
|
+
}
|
|
5158
|
+
}
|
|
5159
|
+
return result.map((s) => Array.from(s.values()));
|
|
5160
|
+
}
|
|
5161
|
+
function getUniquePartitionKeys(acc) {
|
|
5162
|
+
if (acc === void 0)
|
|
5163
|
+
return void 0;
|
|
5164
|
+
if (isDataInfoEntries(acc))
|
|
5165
|
+
return getUniquePartitionKeysForDataEntries(acc);
|
|
5166
|
+
const list = getPartitionKeysList(acc);
|
|
5167
|
+
if (!list)
|
|
5168
|
+
return void 0;
|
|
5169
|
+
const { data, keyLength } = list;
|
|
5170
|
+
const result = [];
|
|
5171
|
+
for (let i = 0; i < keyLength; ++i) {
|
|
5172
|
+
result.push(/* @__PURE__ */ new Set());
|
|
5173
|
+
}
|
|
5174
|
+
for (const l of data) {
|
|
5175
|
+
if (l.length !== keyLength) {
|
|
4968
5176
|
throw new Error("key length does not match partition length");
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
if (
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
5177
|
+
}
|
|
5178
|
+
for (let i = 0; i < keyLength; ++i) {
|
|
5179
|
+
result[i].add(l[i]);
|
|
5180
|
+
}
|
|
5181
|
+
}
|
|
5182
|
+
return result.map((s) => Array.from(s.values()));
|
|
5183
|
+
}
|
|
5184
|
+
function parsePColumnData(acc, keyPrefix = []) {
|
|
5185
|
+
if (acc === void 0)
|
|
5186
|
+
return void 0;
|
|
5187
|
+
if (!acc.getIsReadyOrError())
|
|
5188
|
+
return void 0;
|
|
5189
|
+
const resourceType = acc.resourceType.name;
|
|
5190
|
+
const meta = acc.getDataAsJson();
|
|
5191
|
+
if (keyPrefix.length > 0 && (resourceType === RT_JSON_SUPER_PARTITIONED || resourceType === RT_BINARY_SUPER_PARTITIONED)) {
|
|
5192
|
+
throw new Error(`Unexpected nested super-partitioned resource: ${resourceType}`);
|
|
5193
|
+
}
|
|
5194
|
+
switch (resourceType) {
|
|
5195
|
+
case RT_RESOURCE_MAP:
|
|
5196
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
5197
|
+
throw new Error(`Only data columns are supported, got: ${resourceType}`);
|
|
5198
|
+
case RT_JSON_PARTITIONED: {
|
|
5199
|
+
if (typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5200
|
+
throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
5201
|
+
}
|
|
5202
|
+
const parts = [];
|
|
5203
|
+
for (const keyStr of acc.listInputFields()) {
|
|
5204
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
5205
|
+
if (value === void 0)
|
|
5206
|
+
return void 0;
|
|
5207
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
5208
|
+
parts.push({ key, value });
|
|
4992
5209
|
}
|
|
4993
5210
|
return {
|
|
4994
5211
|
type: "JsonPartitioned",
|
|
4995
|
-
partitionKeyLength:
|
|
4996
|
-
parts
|
|
5212
|
+
partitionKeyLength: meta.partitionKeyLength,
|
|
5213
|
+
parts
|
|
4997
5214
|
};
|
|
4998
5215
|
}
|
|
4999
|
-
case
|
|
5000
|
-
if (typeof (
|
|
5001
|
-
throw new Error(`Missing partitionKeyLength in metadata for ${
|
|
5002
|
-
const i = [], s2 = /* @__PURE__ */ new Map();
|
|
5003
|
-
for (const o of t.listInputFields()) {
|
|
5004
|
-
const a = ye(o), l2 = t.resolve({ field: o, assertFieldType: "Input" });
|
|
5005
|
-
if (l2 === void 0) return;
|
|
5006
|
-
let u2 = s2.get(a.baseKey);
|
|
5007
|
-
u2 || (u2 = {}, s2.set(a.baseKey, u2)), a.type === "index" ? u2.index = l2 : u2.values = l2;
|
|
5216
|
+
case RT_BINARY_PARTITIONED: {
|
|
5217
|
+
if (typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5218
|
+
throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
5008
5219
|
}
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5220
|
+
const parts = [];
|
|
5221
|
+
const baseKeys = /* @__PURE__ */ new Map();
|
|
5222
|
+
for (const keyStr of acc.listInputFields()) {
|
|
5223
|
+
const suffix = removeIndexSuffix(keyStr);
|
|
5224
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
5225
|
+
if (value === void 0)
|
|
5226
|
+
return void 0;
|
|
5227
|
+
let entry = baseKeys.get(suffix.baseKey);
|
|
5228
|
+
if (!entry) {
|
|
5229
|
+
entry = {};
|
|
5230
|
+
baseKeys.set(suffix.baseKey, entry);
|
|
5231
|
+
}
|
|
5232
|
+
if (suffix.type === "index") {
|
|
5233
|
+
entry.index = value;
|
|
5234
|
+
} else {
|
|
5235
|
+
entry.values = value;
|
|
5236
|
+
}
|
|
5237
|
+
}
|
|
5238
|
+
for (const [baseKeyStr, entry] of baseKeys.entries()) {
|
|
5239
|
+
if (!entry.index || !entry.values)
|
|
5240
|
+
return void 0;
|
|
5241
|
+
const key = [...keyPrefix, ...JSON.parse(baseKeyStr)];
|
|
5242
|
+
parts.push({
|
|
5243
|
+
key,
|
|
5014
5244
|
value: {
|
|
5015
|
-
index:
|
|
5016
|
-
values:
|
|
5245
|
+
index: entry.index,
|
|
5246
|
+
values: entry.values
|
|
5017
5247
|
}
|
|
5018
5248
|
});
|
|
5019
5249
|
}
|
|
5020
5250
|
return {
|
|
5021
5251
|
type: "BinaryPartitioned",
|
|
5022
|
-
partitionKeyLength:
|
|
5023
|
-
parts
|
|
5252
|
+
partitionKeyLength: meta.partitionKeyLength,
|
|
5253
|
+
parts
|
|
5024
5254
|
};
|
|
5025
5255
|
}
|
|
5026
|
-
case
|
|
5027
|
-
if (typeof (
|
|
5028
|
-
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
if (
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5256
|
+
case RT_JSON_SUPER_PARTITIONED: {
|
|
5257
|
+
if (typeof (meta == null ? void 0 : meta.superPartitionKeyLength) !== "number" || typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5258
|
+
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
5259
|
+
}
|
|
5260
|
+
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
5261
|
+
const parts = [];
|
|
5262
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
5263
|
+
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
5264
|
+
if (superPartition === void 0)
|
|
5265
|
+
return void 0;
|
|
5266
|
+
if (superPartition.resourceType.name !== RT_JSON_PARTITIONED) {
|
|
5267
|
+
throw new Error(`Expected ${RT_JSON_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
5268
|
+
}
|
|
5269
|
+
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
5270
|
+
if (innerResult === void 0)
|
|
5271
|
+
return void 0;
|
|
5272
|
+
if (innerResult.type !== "JsonPartitioned")
|
|
5273
|
+
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
5274
|
+
parts.push(...innerResult.parts);
|
|
5040
5275
|
}
|
|
5041
5276
|
return {
|
|
5042
5277
|
type: "JsonPartitioned",
|
|
5043
|
-
partitionKeyLength:
|
|
5044
|
-
parts
|
|
5278
|
+
partitionKeyLength: totalKeyLength,
|
|
5279
|
+
parts
|
|
5045
5280
|
};
|
|
5046
5281
|
}
|
|
5047
|
-
case
|
|
5048
|
-
if (typeof (
|
|
5049
|
-
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
if (
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5282
|
+
case RT_BINARY_SUPER_PARTITIONED: {
|
|
5283
|
+
if (typeof (meta == null ? void 0 : meta.superPartitionKeyLength) !== "number" || typeof (meta == null ? void 0 : meta.partitionKeyLength) !== "number") {
|
|
5284
|
+
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
5285
|
+
}
|
|
5286
|
+
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
5287
|
+
const parts = [];
|
|
5288
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
5289
|
+
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
5290
|
+
if (superPartition === void 0)
|
|
5291
|
+
return void 0;
|
|
5292
|
+
if (superPartition.resourceType.name !== RT_BINARY_PARTITIONED) {
|
|
5293
|
+
throw new Error(`Expected ${RT_BINARY_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
5294
|
+
}
|
|
5295
|
+
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
5296
|
+
if (innerResult === void 0)
|
|
5297
|
+
return void 0;
|
|
5298
|
+
if (innerResult.type !== "BinaryPartitioned")
|
|
5299
|
+
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
5300
|
+
parts.push(...innerResult.parts);
|
|
5061
5301
|
}
|
|
5062
5302
|
return {
|
|
5063
5303
|
type: "BinaryPartitioned",
|
|
5064
|
-
partitionKeyLength:
|
|
5065
|
-
parts
|
|
5304
|
+
partitionKeyLength: totalKeyLength,
|
|
5305
|
+
parts
|
|
5066
5306
|
};
|
|
5067
5307
|
}
|
|
5068
5308
|
default:
|
|
5069
|
-
throw new Error(`Unknown resource type: ${
|
|
5070
|
-
}
|
|
5071
|
-
}
|
|
5072
|
-
function
|
|
5073
|
-
if (
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5309
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
function convertOrParsePColumnData(acc) {
|
|
5313
|
+
if (acc === void 0)
|
|
5314
|
+
return void 0;
|
|
5315
|
+
if (isDataInfoEntries(acc))
|
|
5316
|
+
return acc;
|
|
5317
|
+
if (isDataInfo(acc))
|
|
5318
|
+
return dataInfoToEntries(acc);
|
|
5319
|
+
if (acc instanceof TreeNodeAccessor)
|
|
5320
|
+
return parsePColumnData(acc);
|
|
5321
|
+
throw new Error(`Unexpected input type: ${typeof acc}`);
|
|
5322
|
+
}
|
|
5323
|
+
function filterDataInfoEntries(dataInfoEntries, axisFilters) {
|
|
5324
|
+
const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
|
|
5325
|
+
const { type } = dataInfoEntries;
|
|
5326
|
+
switch (type) {
|
|
5327
|
+
case "Json": {
|
|
5328
|
+
const { keyLength } = dataInfoEntries;
|
|
5329
|
+
for (const [axisIdx] of axisFilters)
|
|
5330
|
+
if (axisIdx >= keyLength)
|
|
5331
|
+
throw new Error(`Can't filter on non-data axis ${axisIdx}. Must be >= ${keyLength}`);
|
|
5332
|
+
break;
|
|
5333
|
+
}
|
|
5334
|
+
case "JsonPartitioned":
|
|
5335
|
+
case "BinaryPartitioned":
|
|
5336
|
+
case "ParquetPartitioned": {
|
|
5337
|
+
const { partitionKeyLength } = dataInfoEntries;
|
|
5338
|
+
for (const [axisIdx] of axisFilters)
|
|
5339
|
+
if (axisIdx >= partitionKeyLength)
|
|
5340
|
+
throw new Error(`Can't filter on non-partitioned axis ${axisIdx}. Must be >= ${partitionKeyLength}`);
|
|
5341
|
+
break;
|
|
5342
|
+
}
|
|
5343
|
+
default:
|
|
5344
|
+
throw new Error(`Unsupported data info type: ${type}`);
|
|
5345
|
+
}
|
|
5346
|
+
const keyMatchesFilters = (key) => {
|
|
5347
|
+
for (const [axisIdx, axisValue] of sortedFilters)
|
|
5348
|
+
if (key[axisIdx] !== axisValue)
|
|
5096
5349
|
return false;
|
|
5097
5350
|
return true;
|
|
5098
|
-
}, i = (s2) => {
|
|
5099
|
-
const o = [...s2];
|
|
5100
|
-
for (const [a] of n2)
|
|
5101
|
-
o.splice(a, 1);
|
|
5102
|
-
return o;
|
|
5103
5351
|
};
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5352
|
+
const removeFilteredAxes = (key) => {
|
|
5353
|
+
const newKey = [...key];
|
|
5354
|
+
for (const [axisIdx] of sortedFilters)
|
|
5355
|
+
newKey.splice(axisIdx, 1);
|
|
5356
|
+
return newKey;
|
|
5357
|
+
};
|
|
5358
|
+
switch (dataInfoEntries.type) {
|
|
5359
|
+
case "Json":
|
|
5110
5360
|
return {
|
|
5111
5361
|
type: "Json",
|
|
5112
|
-
keyLength:
|
|
5113
|
-
data:
|
|
5362
|
+
keyLength: dataInfoEntries.keyLength - axisFilters.length,
|
|
5363
|
+
data: dataInfoEntries.data.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5364
|
+
key: removeFilteredAxes(entry.key),
|
|
5365
|
+
value: entry.value
|
|
5366
|
+
}))
|
|
5114
5367
|
};
|
|
5115
|
-
|
|
5116
|
-
case "JsonPartitioned": {
|
|
5117
|
-
const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
|
|
5118
|
-
key: i(o.key),
|
|
5119
|
-
value: o.value
|
|
5120
|
-
}));
|
|
5368
|
+
case "JsonPartitioned":
|
|
5121
5369
|
return {
|
|
5122
5370
|
type: "JsonPartitioned",
|
|
5123
|
-
partitionKeyLength:
|
|
5124
|
-
parts:
|
|
5371
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
5372
|
+
parts: dataInfoEntries.parts.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5373
|
+
key: removeFilteredAxes(entry.key),
|
|
5374
|
+
value: entry.value
|
|
5375
|
+
}))
|
|
5125
5376
|
};
|
|
5126
|
-
|
|
5127
|
-
case "BinaryPartitioned": {
|
|
5128
|
-
const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
|
|
5129
|
-
key: i(o.key),
|
|
5130
|
-
value: o.value
|
|
5131
|
-
}));
|
|
5377
|
+
case "BinaryPartitioned":
|
|
5132
5378
|
return {
|
|
5133
5379
|
type: "BinaryPartitioned",
|
|
5134
|
-
partitionKeyLength:
|
|
5135
|
-
parts:
|
|
5380
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
5381
|
+
parts: dataInfoEntries.parts.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5382
|
+
key: removeFilteredAxes(entry.key),
|
|
5383
|
+
value: entry.value
|
|
5384
|
+
}))
|
|
5385
|
+
};
|
|
5386
|
+
case "ParquetPartitioned":
|
|
5387
|
+
return {
|
|
5388
|
+
type: "ParquetPartitioned",
|
|
5389
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
5390
|
+
parts: dataInfoEntries.parts.filter((entry) => keyMatchesFilters(entry.key)).map((entry) => ({
|
|
5391
|
+
key: removeFilteredAxes(entry.key),
|
|
5392
|
+
value: entry.value
|
|
5393
|
+
}))
|
|
5136
5394
|
};
|
|
5137
|
-
}
|
|
5138
5395
|
}
|
|
5139
5396
|
}
|
|
5140
|
-
function
|
|
5141
|
-
if (!Array.isArray(
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5397
|
+
function isPColumnValues(value) {
|
|
5398
|
+
if (!Array.isArray(value))
|
|
5399
|
+
return false;
|
|
5400
|
+
if (value.length === 0)
|
|
5401
|
+
return true;
|
|
5402
|
+
const first = value[0];
|
|
5403
|
+
return typeof first === "object" && first !== null && "key" in first && "val" in first;
|
|
5145
5404
|
}
|
|
5146
|
-
class
|
|
5147
|
-
constructor(
|
|
5148
|
-
this
|
|
5405
|
+
class ArrayColumnProvider {
|
|
5406
|
+
constructor(columns) {
|
|
5407
|
+
__publicField(this, "columns");
|
|
5408
|
+
this.columns = columns;
|
|
5149
5409
|
}
|
|
5150
|
-
selectColumns(
|
|
5151
|
-
const
|
|
5152
|
-
return this.columns.filter((
|
|
5410
|
+
selectColumns(selectors) {
|
|
5411
|
+
const predicate = typeof selectors === "function" ? selectors : selectorsToPredicate(selectors);
|
|
5412
|
+
return this.columns.filter((column) => predicate(column.spec));
|
|
5153
5413
|
}
|
|
5154
5414
|
}
|
|
5155
|
-
function
|
|
5156
|
-
if (
|
|
5157
|
-
return
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5415
|
+
function splitFiltersToTrace(splitFilters) {
|
|
5416
|
+
if (!splitFilters)
|
|
5417
|
+
return void 0;
|
|
5418
|
+
return splitFilters.map((filter) => ({
|
|
5419
|
+
type: `split:${canonicalizeAxisId(filter.axisId)}`,
|
|
5420
|
+
label: filter.label,
|
|
5421
|
+
importance: 1e6
|
|
5422
|
+
// High importance for split filters in labels
|
|
5423
|
+
}));
|
|
5424
|
+
}
|
|
5425
|
+
function splitFiltersToAxisFilter(splitFilters) {
|
|
5426
|
+
if (!splitFilters)
|
|
5427
|
+
return void 0;
|
|
5428
|
+
return splitFilters.map((filter) => [filter.axisIdx, filter.value]);
|
|
5167
5429
|
}
|
|
5168
|
-
function
|
|
5169
|
-
if (!
|
|
5170
|
-
|
|
5171
|
-
|
|
5430
|
+
function fallbackIdDeriver(originalId, axisFilters) {
|
|
5431
|
+
if (!axisFilters || axisFilters.length === 0)
|
|
5432
|
+
return originalId;
|
|
5433
|
+
const filtersToCanonicalize = [...axisFilters].sort((a, b) => a[0] - b[0]);
|
|
5434
|
+
return canonicalize({ id: originalId, axisFilters: filtersToCanonicalize });
|
|
5172
5435
|
}
|
|
5173
|
-
function
|
|
5174
|
-
if (!
|
|
5175
|
-
|
|
5176
|
-
|
|
5436
|
+
function hasAnchors(selector) {
|
|
5437
|
+
if (!selector || typeof selector !== "object")
|
|
5438
|
+
return false;
|
|
5439
|
+
const potentialAnchored = selector;
|
|
5440
|
+
const domainHasAnchors = potentialAnchored["domain"] && typeof potentialAnchored["domain"] === "object" && Object.values(potentialAnchored["domain"]).some((v) => typeof v === "object" && v !== null && "anchor" in v);
|
|
5441
|
+
const axesHaveAnchors = potentialAnchored["axes"] && Array.isArray(potentialAnchored["axes"]) && potentialAnchored["axes"].some((a) => typeof a === "object" && a !== null && "anchor" in a);
|
|
5442
|
+
return !!potentialAnchored["domainAnchor"] || domainHasAnchors || axesHaveAnchors;
|
|
5177
5443
|
}
|
|
5178
|
-
function
|
|
5179
|
-
if (typeof
|
|
5444
|
+
function getSplitAxisIndices(selector) {
|
|
5445
|
+
if (typeof selector !== "object" || !("axes" in selector) || selector.axes === void 0) {
|
|
5180
5446
|
return [];
|
|
5181
|
-
|
|
5182
|
-
|
|
5447
|
+
}
|
|
5448
|
+
const splitIndices = selector.axes.map((axis, index) => typeof axis === "object" && "split" in axis && axis.split === true ? index : -1).filter((index) => index !== -1);
|
|
5449
|
+
if (splitIndices.length > 0 && selector.partialAxesMatch !== void 0) {
|
|
5183
5450
|
throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");
|
|
5184
|
-
|
|
5451
|
+
}
|
|
5452
|
+
splitIndices.sort((a, b) => a - b);
|
|
5453
|
+
return splitIndices;
|
|
5185
5454
|
}
|
|
5186
|
-
class
|
|
5455
|
+
class PColumnCollection {
|
|
5187
5456
|
constructor() {
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5457
|
+
__publicField(this, "defaultProviderStore", []);
|
|
5458
|
+
__publicField(this, "providers", [new ArrayColumnProvider(this.defaultProviderStore)]);
|
|
5459
|
+
__publicField(this, "axisLabelProviders", []);
|
|
5191
5460
|
}
|
|
5192
|
-
addColumnProvider(
|
|
5193
|
-
|
|
5461
|
+
addColumnProvider(provider) {
|
|
5462
|
+
this.providers.push(provider);
|
|
5463
|
+
return this;
|
|
5194
5464
|
}
|
|
5195
|
-
addAxisLabelProvider(
|
|
5196
|
-
|
|
5465
|
+
addAxisLabelProvider(provider) {
|
|
5466
|
+
this.axisLabelProviders.push(provider);
|
|
5467
|
+
return this;
|
|
5197
5468
|
}
|
|
5198
|
-
addColumns(
|
|
5199
|
-
|
|
5469
|
+
addColumns(columns) {
|
|
5470
|
+
this.defaultProviderStore.push(...columns);
|
|
5471
|
+
return this;
|
|
5200
5472
|
}
|
|
5201
|
-
addColumn(
|
|
5202
|
-
|
|
5473
|
+
addColumn(column) {
|
|
5474
|
+
this.defaultProviderStore.push(column);
|
|
5475
|
+
return this;
|
|
5203
5476
|
}
|
|
5204
5477
|
/** Fetches labels for a given axis from the registered providers */
|
|
5205
|
-
findLabels(
|
|
5206
|
-
for (const
|
|
5207
|
-
const
|
|
5208
|
-
if (
|
|
5478
|
+
findLabels(axis) {
|
|
5479
|
+
for (const provider of this.axisLabelProviders) {
|
|
5480
|
+
const labels = provider.findLabels(axis);
|
|
5481
|
+
if (labels)
|
|
5482
|
+
return labels;
|
|
5209
5483
|
}
|
|
5484
|
+
return void 0;
|
|
5210
5485
|
}
|
|
5211
|
-
getUniversalEntries(
|
|
5212
|
-
const { anchorCtx
|
|
5213
|
-
|
|
5214
|
-
...
|
|
5486
|
+
getUniversalEntries(predicateOrSelectors, opts) {
|
|
5487
|
+
const { anchorCtx, labelOps: rawLabelOps, dontWaitAllData = false, overrideLabelAnnotation = false, exclude } = opts ?? {};
|
|
5488
|
+
const labelOps = {
|
|
5489
|
+
...overrideLabelAnnotation && (rawLabelOps == null ? void 0 : rawLabelOps.includeNativeLabel) !== false ? { includeNativeLabel: true } : {},
|
|
5490
|
+
...rawLabelOps ?? {}
|
|
5215
5491
|
};
|
|
5216
|
-
let
|
|
5217
|
-
if (
|
|
5218
|
-
const
|
|
5219
|
-
if (
|
|
5220
|
-
if (!
|
|
5492
|
+
let excludePredicate = () => false;
|
|
5493
|
+
if (exclude) {
|
|
5494
|
+
const excludePredicartes = (Array.isArray(exclude) ? exclude : [exclude]).map((selector) => {
|
|
5495
|
+
if (hasAnchors(selector)) {
|
|
5496
|
+
if (!anchorCtx)
|
|
5221
5497
|
throw new Error("Anchored selectors in exclude require an AnchoredIdDeriver to be provided in options.");
|
|
5222
|
-
return
|
|
5498
|
+
return selectorsToPredicate(resolveAnchors(anchorCtx.anchors, selector, opts));
|
|
5223
5499
|
} else
|
|
5224
|
-
return
|
|
5500
|
+
return selectorsToPredicate(selector);
|
|
5225
5501
|
});
|
|
5226
|
-
|
|
5227
|
-
}
|
|
5228
|
-
const
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5502
|
+
excludePredicate = (spec) => excludePredicartes.some((predicate) => predicate(spec));
|
|
5503
|
+
}
|
|
5504
|
+
const selectorsArray = typeof predicateOrSelectors === "function" ? [predicateOrSelectors] : Array.isArray(predicateOrSelectors) ? predicateOrSelectors : [predicateOrSelectors];
|
|
5505
|
+
const intermediateResults = [];
|
|
5506
|
+
const selectedNativeIds = /* @__PURE__ */ new Set();
|
|
5507
|
+
for (const rawSelector of selectorsArray) {
|
|
5508
|
+
const usesAnchors = hasAnchors(rawSelector);
|
|
5509
|
+
let currentSelector;
|
|
5510
|
+
if (usesAnchors) {
|
|
5511
|
+
if (!anchorCtx)
|
|
5234
5512
|
throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");
|
|
5235
|
-
|
|
5513
|
+
currentSelector = resolveAnchors(anchorCtx.anchors, rawSelector, opts);
|
|
5236
5514
|
} else
|
|
5237
|
-
|
|
5238
|
-
const
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
if (
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5515
|
+
currentSelector = rawSelector;
|
|
5516
|
+
const selectedIds = /* @__PURE__ */ new Set();
|
|
5517
|
+
const selectedColumns = [];
|
|
5518
|
+
for (const provider of this.providers) {
|
|
5519
|
+
const providerColumns = provider.selectColumns(currentSelector);
|
|
5520
|
+
for (const col of providerColumns) {
|
|
5521
|
+
if (excludePredicate(col.spec))
|
|
5522
|
+
continue;
|
|
5523
|
+
if (selectedIds.has(col.id))
|
|
5524
|
+
throw new Error(`Duplicate column id ${col.id} in provider ${provider.constructor.name}`);
|
|
5525
|
+
const nativeId = deriveNativeId(col.spec);
|
|
5526
|
+
if (selectedNativeIds.has(nativeId))
|
|
5527
|
+
continue;
|
|
5528
|
+
selectedIds.add(col.id);
|
|
5529
|
+
selectedNativeIds.add(nativeId);
|
|
5530
|
+
selectedColumns.push(col);
|
|
5247
5531
|
}
|
|
5248
5532
|
}
|
|
5249
|
-
if (
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
if (
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
if (
|
|
5259
|
-
|
|
5260
|
-
|
|
5533
|
+
if (selectedColumns.length === 0)
|
|
5534
|
+
continue;
|
|
5535
|
+
const splitAxisIdxs = getSplitAxisIndices(rawSelector);
|
|
5536
|
+
const needsSplitting = splitAxisIdxs.length > 0;
|
|
5537
|
+
for (const column of selectedColumns) {
|
|
5538
|
+
if (!isPColumnSpec(column.spec))
|
|
5539
|
+
continue;
|
|
5540
|
+
const originalSpec = column.spec;
|
|
5541
|
+
if (needsSplitting) {
|
|
5542
|
+
if (isPColumnValues(column.data))
|
|
5543
|
+
throw new Error(`Splitting is not supported for PColumns with PColumnValues data format. Column id: ${column.id}`);
|
|
5544
|
+
const dataEntries = convertOrParsePColumnData(column.data);
|
|
5545
|
+
if (!dataEntries) {
|
|
5546
|
+
if (dontWaitAllData)
|
|
5547
|
+
continue;
|
|
5548
|
+
return void 0;
|
|
5261
5549
|
}
|
|
5262
|
-
if (!
|
|
5263
|
-
throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${
|
|
5264
|
-
const
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5550
|
+
if (!isPartitionedDataInfoEntries(dataEntries))
|
|
5551
|
+
throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${dataEntries.type} for column ${column.id}`);
|
|
5552
|
+
const uniqueKeys = getUniquePartitionKeys(dataEntries);
|
|
5553
|
+
const maxSplitIdx = splitAxisIdxs[splitAxisIdxs.length - 1];
|
|
5554
|
+
if (maxSplitIdx >= dataEntries.partitionKeyLength)
|
|
5555
|
+
throw new Error(`Not enough partition keys (${dataEntries.partitionKeyLength}) for requested split axes (max index ${maxSplitIdx}) in column ${originalSpec.name}`);
|
|
5556
|
+
const axesLabels = splitAxisIdxs.map((idx) => this.findLabels(getAxisId(originalSpec.axesSpec[idx])));
|
|
5557
|
+
const keyCombinations = [];
|
|
5558
|
+
const generateCombinations = (currentCombo, sAxisIdx) => {
|
|
5559
|
+
if (sAxisIdx >= splitAxisIdxs.length) {
|
|
5560
|
+
keyCombinations.push([...currentCombo]);
|
|
5561
|
+
if (keyCombinations.length > 1e4)
|
|
5270
5562
|
throw new Error("Too many key combinations, aborting.");
|
|
5271
5563
|
return;
|
|
5272
5564
|
}
|
|
5273
|
-
const
|
|
5274
|
-
if (
|
|
5275
|
-
throw new Error(`Axis index ${
|
|
5276
|
-
const
|
|
5277
|
-
if (!
|
|
5278
|
-
|
|
5565
|
+
const axisIdx = splitAxisIdxs[sAxisIdx];
|
|
5566
|
+
if (axisIdx >= uniqueKeys.length)
|
|
5567
|
+
throw new Error(`Axis index ${axisIdx} out of bounds for unique keys array (length ${uniqueKeys.length}) during split key generation for column ${column.id}`);
|
|
5568
|
+
const axisValues = uniqueKeys[axisIdx];
|
|
5569
|
+
if (!axisValues || axisValues.length === 0) {
|
|
5570
|
+
keyCombinations.length = 0;
|
|
5279
5571
|
return;
|
|
5280
5572
|
}
|
|
5281
|
-
for (const
|
|
5282
|
-
|
|
5573
|
+
for (const val of axisValues) {
|
|
5574
|
+
currentCombo.push(val);
|
|
5575
|
+
generateCombinations(currentCombo, sAxisIdx + 1);
|
|
5576
|
+
currentCombo.pop();
|
|
5577
|
+
}
|
|
5283
5578
|
};
|
|
5284
|
-
|
|
5579
|
+
generateCombinations([], 0);
|
|
5580
|
+
if (keyCombinations.length === 0)
|
|
5285
5581
|
continue;
|
|
5286
|
-
const
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5582
|
+
const newAxesSpec = [...originalSpec.axesSpec];
|
|
5583
|
+
const splitAxisOriginalIdxs = splitAxisIdxs.map((idx) => idx);
|
|
5584
|
+
for (let i = splitAxisIdxs.length - 1; i >= 0; i--) {
|
|
5585
|
+
newAxesSpec.splice(splitAxisIdxs[i], 1);
|
|
5586
|
+
}
|
|
5587
|
+
const adjustedSpec = { ...originalSpec, axesSpec: newAxesSpec };
|
|
5588
|
+
for (const keyCombo of keyCombinations) {
|
|
5589
|
+
const splitFilters = keyCombo.map((value, sAxisIdx) => {
|
|
5590
|
+
const axisIdx = splitAxisOriginalIdxs[sAxisIdx];
|
|
5591
|
+
const axisId = getAxisId(originalSpec.axesSpec[axisIdx]);
|
|
5592
|
+
const axisLabelMap = axesLabels[sAxisIdx];
|
|
5593
|
+
const label = (axisLabelMap == null ? void 0 : axisLabelMap[value]) ?? String(value);
|
|
5594
|
+
return { axisIdx, axisId, value, label };
|
|
5294
5595
|
});
|
|
5295
|
-
|
|
5596
|
+
intermediateResults.push({
|
|
5296
5597
|
type: "split",
|
|
5297
|
-
originalColumn:
|
|
5298
|
-
spec:
|
|
5299
|
-
adjustedSpec
|
|
5300
|
-
dataEntries
|
|
5301
|
-
axisFilters:
|
|
5598
|
+
originalColumn: column,
|
|
5599
|
+
spec: originalSpec,
|
|
5600
|
+
adjustedSpec,
|
|
5601
|
+
dataEntries,
|
|
5602
|
+
axisFilters: splitFilters
|
|
5302
5603
|
});
|
|
5303
5604
|
}
|
|
5304
|
-
} else
|
|
5305
|
-
|
|
5605
|
+
} else {
|
|
5606
|
+
intermediateResults.push({
|
|
5306
5607
|
type: "direct",
|
|
5307
|
-
originalColumn:
|
|
5308
|
-
spec:
|
|
5309
|
-
adjustedSpec:
|
|
5608
|
+
originalColumn: column,
|
|
5609
|
+
spec: originalSpec,
|
|
5610
|
+
adjustedSpec: originalSpec
|
|
5310
5611
|
});
|
|
5612
|
+
}
|
|
5311
5613
|
}
|
|
5312
5614
|
}
|
|
5313
|
-
if (
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
const
|
|
5324
|
-
let
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5615
|
+
if (intermediateResults.length === 0)
|
|
5616
|
+
return [];
|
|
5617
|
+
const labeledResults = deriveLabels(intermediateResults, (entry) => ({
|
|
5618
|
+
spec: entry.spec,
|
|
5619
|
+
suffixTrace: entry.type === "split" ? splitFiltersToTrace(entry.axisFilters) : void 0
|
|
5620
|
+
}), labelOps);
|
|
5621
|
+
const result = [];
|
|
5622
|
+
for (const { value: entry, label } of labeledResults) {
|
|
5623
|
+
const { originalColumn, spec: originalSpec } = entry;
|
|
5624
|
+
const axisFilters = entry.type === "split" ? entry.axisFilters : void 0;
|
|
5625
|
+
const axisFiltersTuple = splitFiltersToAxisFilter(axisFilters);
|
|
5626
|
+
let finalId;
|
|
5627
|
+
if (anchorCtx)
|
|
5628
|
+
finalId = anchorCtx.deriveS(originalSpec, axisFiltersTuple);
|
|
5629
|
+
else
|
|
5630
|
+
finalId = fallbackIdDeriver(originalColumn.id, axisFiltersTuple);
|
|
5631
|
+
let finalSpec = { ...entry.adjustedSpec };
|
|
5632
|
+
if (overrideLabelAnnotation) {
|
|
5633
|
+
finalSpec = {
|
|
5634
|
+
...finalSpec,
|
|
5635
|
+
annotations: {
|
|
5636
|
+
...finalSpec.annotations ?? {},
|
|
5637
|
+
[Annotation.Label]: label
|
|
5638
|
+
}
|
|
5639
|
+
};
|
|
5640
|
+
}
|
|
5641
|
+
result.push({
|
|
5642
|
+
id: finalId,
|
|
5643
|
+
spec: finalSpec,
|
|
5644
|
+
data: () => entry.type === "split" ? entriesToDataInfo(filterDataInfoEntries(entry.dataEntries, axisFiltersTuple)) : entry.originalColumn.data,
|
|
5645
|
+
label
|
|
5338
5646
|
});
|
|
5339
5647
|
}
|
|
5340
|
-
return
|
|
5648
|
+
return result;
|
|
5341
5649
|
}
|
|
5342
|
-
getColumns(
|
|
5343
|
-
const
|
|
5650
|
+
getColumns(predicateOrSelectors, opts) {
|
|
5651
|
+
const entries = this.getUniversalEntries(predicateOrSelectors, {
|
|
5344
5652
|
overrideLabelAnnotation: true,
|
|
5345
5653
|
// default for getColumns
|
|
5346
|
-
...
|
|
5654
|
+
...opts ?? {}
|
|
5347
5655
|
});
|
|
5348
|
-
if (!
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5656
|
+
if (!entries)
|
|
5657
|
+
return void 0;
|
|
5658
|
+
const columns = [];
|
|
5659
|
+
for (const entry of entries) {
|
|
5660
|
+
const data = entry.data();
|
|
5661
|
+
if (!data) {
|
|
5662
|
+
if (opts == null ? void 0 : opts.dontWaitAllData)
|
|
5663
|
+
continue;
|
|
5664
|
+
return void 0;
|
|
5355
5665
|
}
|
|
5356
|
-
|
|
5357
|
-
id:
|
|
5358
|
-
spec:
|
|
5359
|
-
data
|
|
5666
|
+
columns.push({
|
|
5667
|
+
id: entry.id,
|
|
5668
|
+
spec: entry.spec,
|
|
5669
|
+
data
|
|
5360
5670
|
});
|
|
5361
5671
|
}
|
|
5362
|
-
return
|
|
5672
|
+
return columns;
|
|
5363
5673
|
}
|
|
5364
5674
|
}
|
|
5365
|
-
function
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5675
|
+
function patchInSetFilters(filters) {
|
|
5676
|
+
const inSetToOrEqual = (predicate) => {
|
|
5677
|
+
if (predicate.operator !== "InSet")
|
|
5678
|
+
return predicate;
|
|
5679
|
+
return {
|
|
5680
|
+
operator: "Or",
|
|
5681
|
+
operands: predicate.references.map((reference) => ({
|
|
5682
|
+
operator: "Equal",
|
|
5683
|
+
reference
|
|
5684
|
+
}))
|
|
5685
|
+
};
|
|
5686
|
+
};
|
|
5687
|
+
const mapSingleValuePredicate = (filter, cb) => {
|
|
5688
|
+
const operator = filter.operator;
|
|
5689
|
+
switch (operator) {
|
|
5690
|
+
case "And":
|
|
5691
|
+
return {
|
|
5692
|
+
...filter,
|
|
5693
|
+
operands: filter.operands.map((operand) => mapSingleValuePredicate(operand, cb))
|
|
5694
|
+
};
|
|
5695
|
+
case "Or":
|
|
5696
|
+
return {
|
|
5697
|
+
...filter,
|
|
5698
|
+
operands: filter.operands.map((operand) => mapSingleValuePredicate(operand, cb))
|
|
5699
|
+
};
|
|
5700
|
+
case "Not":
|
|
5701
|
+
return {
|
|
5702
|
+
...filter,
|
|
5703
|
+
operand: mapSingleValuePredicate(filter.operand, cb)
|
|
5704
|
+
};
|
|
5705
|
+
default:
|
|
5706
|
+
return cb(filter);
|
|
5707
|
+
}
|
|
5708
|
+
};
|
|
5709
|
+
const mapFilter = (filter, cb) => {
|
|
5710
|
+
return {
|
|
5711
|
+
...filter,
|
|
5712
|
+
predicate: mapSingleValuePredicate(filter.predicate, cb)
|
|
5713
|
+
};
|
|
5714
|
+
};
|
|
5715
|
+
return filters.map((filter) => mapFilter(filter, inSetToOrEqual));
|
|
5716
|
+
}
|
|
5717
|
+
function matchDomain(query, target) {
|
|
5718
|
+
if (query === void 0)
|
|
5719
|
+
return target === void 0;
|
|
5720
|
+
if (target === void 0)
|
|
5721
|
+
return true;
|
|
5722
|
+
for (const k in target) {
|
|
5723
|
+
if (query[k] !== target[k])
|
|
5724
|
+
return false;
|
|
5725
|
+
}
|
|
5370
5726
|
return true;
|
|
5371
5727
|
}
|
|
5372
|
-
function
|
|
5373
|
-
return
|
|
5728
|
+
function transformPColumnData(data) {
|
|
5729
|
+
return mapPObjectData(data, (d) => {
|
|
5730
|
+
if (d instanceof TreeNodeAccessor) {
|
|
5731
|
+
return d.handle;
|
|
5732
|
+
} else if (isDataInfo(d)) {
|
|
5733
|
+
return mapDataInfo(d, (accessor) => accessor.handle);
|
|
5734
|
+
} else {
|
|
5735
|
+
return d;
|
|
5736
|
+
}
|
|
5737
|
+
});
|
|
5374
5738
|
}
|
|
5375
|
-
class
|
|
5739
|
+
class ResultPool {
|
|
5376
5740
|
constructor() {
|
|
5377
|
-
|
|
5741
|
+
__publicField(this, "ctx", getCfgRenderCtx());
|
|
5378
5742
|
}
|
|
5379
5743
|
/**
|
|
5380
5744
|
* @deprecated use getOptions()
|
|
5381
5745
|
*/
|
|
5382
|
-
calculateOptions(
|
|
5383
|
-
return this.ctx.calculateOptions(
|
|
5384
|
-
}
|
|
5385
|
-
getOptions(
|
|
5386
|
-
const
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5746
|
+
calculateOptions(predicate) {
|
|
5747
|
+
return this.ctx.calculateOptions(predicate);
|
|
5748
|
+
}
|
|
5749
|
+
getOptions(predicateOrSelector, opts) {
|
|
5750
|
+
const predicate = typeof predicateOrSelector === "function" ? predicateOrSelector : selectorsToPredicate(predicateOrSelector);
|
|
5751
|
+
const filtered = this.getSpecs().entries.filter((s) => predicate(s.obj));
|
|
5752
|
+
let labelOps = {};
|
|
5753
|
+
let refsWithEnrichments = false;
|
|
5754
|
+
if (typeof opts !== "undefined") {
|
|
5755
|
+
if (typeof opts === "function") {
|
|
5756
|
+
labelOps = opts;
|
|
5757
|
+
} else if (typeof opts === "object") {
|
|
5758
|
+
if ("includeNativeLabel" in opts || "separator" in opts || "addLabelAsSuffix" in opts) {
|
|
5759
|
+
labelOps = opts;
|
|
5760
|
+
} else {
|
|
5761
|
+
opts = opts;
|
|
5762
|
+
labelOps = opts.label ?? {};
|
|
5763
|
+
refsWithEnrichments = opts.refsWithEnrichments ?? false;
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
if (typeof labelOps === "object")
|
|
5768
|
+
return deriveLabels(filtered, (o) => o.obj, labelOps ?? {}).map(({ value: { ref }, label }) => ({
|
|
5769
|
+
ref: withEnrichments(ref, refsWithEnrichments),
|
|
5770
|
+
label
|
|
5771
|
+
}));
|
|
5772
|
+
else
|
|
5773
|
+
return filtered.map(({ ref, obj }) => ({
|
|
5774
|
+
ref: withEnrichments(ref, refsWithEnrichments),
|
|
5775
|
+
label: labelOps(obj, ref)
|
|
5776
|
+
}));
|
|
5395
5777
|
}
|
|
5396
|
-
resolveAnchorCtx(
|
|
5397
|
-
if (
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5778
|
+
resolveAnchorCtx(anchorsOrCtx) {
|
|
5779
|
+
if (anchorsOrCtx instanceof AnchoredIdDeriver)
|
|
5780
|
+
return anchorsOrCtx;
|
|
5781
|
+
const resolvedAnchors = {};
|
|
5782
|
+
for (const [key, value] of Object.entries(anchorsOrCtx)) {
|
|
5783
|
+
if (isPlRef(value)) {
|
|
5784
|
+
const resolvedSpec = this.getPColumnSpecByRef(value);
|
|
5785
|
+
if (!resolvedSpec)
|
|
5786
|
+
return void 0;
|
|
5787
|
+
resolvedAnchors[key] = resolvedSpec;
|
|
5788
|
+
} else {
|
|
5789
|
+
resolvedAnchors[key] = value;
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
return new AnchoredIdDeriver(resolvedAnchors);
|
|
5408
5793
|
}
|
|
5409
5794
|
/**
|
|
5410
5795
|
* Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
|
|
@@ -5414,13 +5799,14 @@
|
|
|
5414
5799
|
* @param opts - Optional configuration for label generation and data waiting
|
|
5415
5800
|
* @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
|
|
5416
5801
|
*/
|
|
5417
|
-
getAnchoredPColumns(
|
|
5418
|
-
const
|
|
5419
|
-
if (
|
|
5420
|
-
return
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5802
|
+
getAnchoredPColumns(anchorsOrCtx, predicateOrSelectors, opts) {
|
|
5803
|
+
const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
|
|
5804
|
+
if (!anchorCtx)
|
|
5805
|
+
return void 0;
|
|
5806
|
+
return new PColumnCollection().addColumnProvider(this).addAxisLabelProvider(this).getColumns(predicateOrSelectors, {
|
|
5807
|
+
...opts,
|
|
5808
|
+
anchorCtx
|
|
5809
|
+
});
|
|
5424
5810
|
}
|
|
5425
5811
|
/**
|
|
5426
5812
|
* Calculates anchored identifier options for columns matching a given predicate and returns their
|
|
@@ -5451,18 +5837,20 @@
|
|
|
5451
5837
|
* @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
|
|
5452
5838
|
* or undefined if any PlRef resolution fails.
|
|
5453
5839
|
*/
|
|
5454
|
-
getCanonicalOptions(
|
|
5455
|
-
const
|
|
5456
|
-
if (!
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5840
|
+
getCanonicalOptions(anchorsOrCtx, predicateOrSelectors, opts) {
|
|
5841
|
+
const anchorCtx = this.resolveAnchorCtx(anchorsOrCtx);
|
|
5842
|
+
if (!anchorCtx)
|
|
5843
|
+
return void 0;
|
|
5844
|
+
const entries = new PColumnCollection().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(predicateOrSelectors, {
|
|
5845
|
+
...opts,
|
|
5846
|
+
anchorCtx
|
|
5460
5847
|
});
|
|
5461
|
-
if (
|
|
5462
|
-
return
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5848
|
+
if (!entries)
|
|
5849
|
+
return void 0;
|
|
5850
|
+
return entries.map((item) => ({
|
|
5851
|
+
value: item.id,
|
|
5852
|
+
label: item.label
|
|
5853
|
+
}));
|
|
5466
5854
|
}
|
|
5467
5855
|
/**
|
|
5468
5856
|
* @deprecated use getData()
|
|
@@ -5471,14 +5859,14 @@
|
|
|
5471
5859
|
return this.getData();
|
|
5472
5860
|
}
|
|
5473
5861
|
getData() {
|
|
5474
|
-
const
|
|
5862
|
+
const result = this.ctx.getDataFromResultPool();
|
|
5475
5863
|
return {
|
|
5476
|
-
isComplete:
|
|
5477
|
-
entries:
|
|
5478
|
-
ref:
|
|
5864
|
+
isComplete: result.isComplete,
|
|
5865
|
+
entries: result.entries.map((e) => ({
|
|
5866
|
+
ref: e.ref,
|
|
5479
5867
|
obj: {
|
|
5480
|
-
...
|
|
5481
|
-
data: new
|
|
5868
|
+
...e.obj,
|
|
5869
|
+
data: new TreeNodeAccessor(e.obj.data, [e.ref.blockId, e.ref.name])
|
|
5482
5870
|
}
|
|
5483
5871
|
}))
|
|
5484
5872
|
};
|
|
@@ -5490,17 +5878,14 @@
|
|
|
5490
5878
|
return this.getDataWithErrors();
|
|
5491
5879
|
}
|
|
5492
5880
|
getDataWithErrors() {
|
|
5493
|
-
const
|
|
5881
|
+
const result = this.ctx.getDataWithErrorsFromResultPool();
|
|
5494
5882
|
return {
|
|
5495
|
-
isComplete:
|
|
5496
|
-
entries:
|
|
5497
|
-
ref:
|
|
5883
|
+
isComplete: result.isComplete,
|
|
5884
|
+
entries: result.entries.map((e) => ({
|
|
5885
|
+
ref: e.ref,
|
|
5498
5886
|
obj: {
|
|
5499
|
-
...
|
|
5500
|
-
data:
|
|
5501
|
-
n2.obj.data,
|
|
5502
|
-
(r) => new E(r, [n2.ref.blockId, n2.ref.name])
|
|
5503
|
-
)
|
|
5887
|
+
...e.obj,
|
|
5888
|
+
data: mapValueInVOE(e.obj.data, (handle) => new TreeNodeAccessor(handle, [e.ref.blockId, e.ref.name]))
|
|
5504
5889
|
}
|
|
5505
5890
|
}))
|
|
5506
5891
|
};
|
|
@@ -5518,89 +5903,106 @@
|
|
|
5518
5903
|
* @param ref a Ref
|
|
5519
5904
|
* @returns data associated with the ref
|
|
5520
5905
|
*/
|
|
5521
|
-
getDataByRef(
|
|
5522
|
-
var
|
|
5523
|
-
if (typeof this.ctx.getDataFromResultPoolByRef
|
|
5524
|
-
return (
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
return Wn(
|
|
5530
|
-
n2,
|
|
5531
|
-
(i) => new E(i, [e.blockId, e.name])
|
|
5532
|
-
);
|
|
5906
|
+
getDataByRef(ref) {
|
|
5907
|
+
var _a;
|
|
5908
|
+
if (typeof this.ctx.getDataFromResultPoolByRef === "undefined")
|
|
5909
|
+
return (_a = this.getData().entries.find((f) => f.ref.blockId === ref.blockId && f.ref.name === ref.name)) == null ? void 0 : _a.obj;
|
|
5910
|
+
const data = this.ctx.getDataFromResultPoolByRef(ref.blockId, ref.name);
|
|
5911
|
+
if (!data)
|
|
5912
|
+
return void 0;
|
|
5913
|
+
return mapPObjectData(data, (handle) => new TreeNodeAccessor(handle, [ref.blockId, ref.name]));
|
|
5533
5914
|
}
|
|
5534
5915
|
/**
|
|
5535
5916
|
* Returns data associated with the ref ensuring that it is a p-column.
|
|
5536
5917
|
* @param ref a Ref
|
|
5537
5918
|
* @returns p-column associated with the ref
|
|
5538
5919
|
*/
|
|
5539
|
-
getPColumnByRef(
|
|
5540
|
-
const
|
|
5541
|
-
if (
|
|
5542
|
-
return
|
|
5920
|
+
getPColumnByRef(ref) {
|
|
5921
|
+
const data = this.getDataByRef(ref);
|
|
5922
|
+
if (!data)
|
|
5923
|
+
return void 0;
|
|
5924
|
+
return ensurePColumn(data);
|
|
5543
5925
|
}
|
|
5544
5926
|
/**
|
|
5545
5927
|
* Returns spec associated with the ref ensuring that it is a p-column spec.
|
|
5546
5928
|
* @param ref a Ref
|
|
5547
5929
|
* @returns p-column spec associated with the ref
|
|
5548
5930
|
*/
|
|
5549
|
-
getPColumnSpecByRef(
|
|
5550
|
-
const
|
|
5551
|
-
if (
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5931
|
+
getPColumnSpecByRef(ref) {
|
|
5932
|
+
const spec = this.getSpecByRef(ref);
|
|
5933
|
+
if (!spec)
|
|
5934
|
+
return void 0;
|
|
5935
|
+
if (!isPColumnSpec(spec))
|
|
5936
|
+
throw new Error(`not a PColumn spec (kind = ${spec.kind})`);
|
|
5937
|
+
return spec;
|
|
5555
5938
|
}
|
|
5556
5939
|
/**
|
|
5557
5940
|
* @param ref a Ref
|
|
5558
5941
|
* @returns object spec associated with the ref
|
|
5559
5942
|
*/
|
|
5560
|
-
getSpecByRef(
|
|
5561
|
-
return this.ctx.getSpecFromResultPoolByRef(
|
|
5943
|
+
getSpecByRef(ref) {
|
|
5944
|
+
return this.ctx.getSpecFromResultPoolByRef(ref.blockId, ref.name);
|
|
5562
5945
|
}
|
|
5563
5946
|
/**
|
|
5564
5947
|
* @param spec object specification
|
|
5565
5948
|
* @returns array of data objects with compatible specs
|
|
5566
5949
|
* @deprecated delete this method after Jan 1, 2025
|
|
5567
5950
|
*/
|
|
5568
|
-
findDataWithCompatibleSpec(
|
|
5569
|
-
const
|
|
5570
|
-
|
|
5571
|
-
if (!
|
|
5951
|
+
findDataWithCompatibleSpec(spec) {
|
|
5952
|
+
const result = [];
|
|
5953
|
+
out: for (const data of this.getData().entries) {
|
|
5954
|
+
if (!isPColumnSpec(data.obj.spec)) {
|
|
5572
5955
|
continue;
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5956
|
+
}
|
|
5957
|
+
const oth = data.obj.spec;
|
|
5958
|
+
if (spec.name !== oth.name) {
|
|
5959
|
+
continue;
|
|
5960
|
+
}
|
|
5961
|
+
if (spec.valueType !== oth.valueType) {
|
|
5962
|
+
continue;
|
|
5963
|
+
}
|
|
5964
|
+
if (spec.axesSpec.length !== oth.axesSpec.length) {
|
|
5965
|
+
continue;
|
|
5966
|
+
}
|
|
5967
|
+
if (!matchDomain(spec.domain, oth.domain)) {
|
|
5968
|
+
continue;
|
|
5969
|
+
}
|
|
5970
|
+
for (let i = 0; i < spec.axesSpec.length; ++i) {
|
|
5971
|
+
const qAx = spec.axesSpec[i];
|
|
5972
|
+
const tAx = oth.axesSpec[i];
|
|
5973
|
+
if (qAx.name !== tAx.name) {
|
|
5974
|
+
continue out;
|
|
5975
|
+
}
|
|
5976
|
+
if (qAx.type !== tAx.type) {
|
|
5977
|
+
continue out;
|
|
5978
|
+
}
|
|
5979
|
+
if (!matchDomain(qAx.domain, tAx.domain)) {
|
|
5980
|
+
continue out;
|
|
5579
5981
|
}
|
|
5580
|
-
n2.push(r.obj);
|
|
5581
5982
|
}
|
|
5983
|
+
result.push(data.obj);
|
|
5582
5984
|
}
|
|
5583
|
-
return
|
|
5985
|
+
return result;
|
|
5584
5986
|
}
|
|
5585
5987
|
/**
|
|
5586
5988
|
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
5587
5989
|
* @returns a map of axis value => label
|
|
5588
5990
|
*/
|
|
5589
|
-
findLabels(
|
|
5590
|
-
const
|
|
5591
|
-
for (const
|
|
5592
|
-
if (!
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
);
|
|
5991
|
+
findLabels(axis) {
|
|
5992
|
+
const dataPool = this.getData();
|
|
5993
|
+
for (const column of dataPool.entries) {
|
|
5994
|
+
if (!isPColumn(column.obj))
|
|
5995
|
+
continue;
|
|
5996
|
+
const spec = column.obj.spec;
|
|
5997
|
+
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)) {
|
|
5998
|
+
if (column.obj.data.resourceType.name !== "PColumnData/Json") {
|
|
5999
|
+
throw Error(`Expected JSON column for labels, got: ${column.obj.data.resourceType.name}`);
|
|
6000
|
+
}
|
|
6001
|
+
const labels = Object.fromEntries(Object.entries(column.obj.data.getDataAsJson().data).map((e) => [JSON.parse(e[0])[0], e[1]]));
|
|
6002
|
+
return labels;
|
|
5602
6003
|
}
|
|
5603
6004
|
}
|
|
6005
|
+
return void 0;
|
|
5604
6006
|
}
|
|
5605
6007
|
/**
|
|
5606
6008
|
* Selects columns based on the provided selectors, returning PColumn objects
|
|
@@ -5609,18 +6011,27 @@
|
|
|
5609
6011
|
* @param selectors - A predicate function, a single selector, or an array of selectors.
|
|
5610
6012
|
* @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
|
|
5611
6013
|
*/
|
|
5612
|
-
selectColumns(
|
|
5613
|
-
const
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
6014
|
+
selectColumns(selectors) {
|
|
6015
|
+
const predicate = typeof selectors === "function" ? selectors : selectorsToPredicate(selectors);
|
|
6016
|
+
const matchedSpecs = this.getSpecs().entries.filter(({ obj: spec }) => {
|
|
6017
|
+
if (!isPColumnSpec(spec))
|
|
6018
|
+
return false;
|
|
6019
|
+
return predicate(spec);
|
|
6020
|
+
});
|
|
6021
|
+
return matchedSpecs.map(({ ref, obj: spec }) => {
|
|
6022
|
+
const pcolumnSpec = spec;
|
|
6023
|
+
let _cachedData = null;
|
|
6024
|
+
const self2 = this;
|
|
5618
6025
|
return {
|
|
5619
|
-
id:
|
|
5620
|
-
spec:
|
|
6026
|
+
id: canonicalize(ref),
|
|
6027
|
+
spec: pcolumnSpec,
|
|
5621
6028
|
get data() {
|
|
5622
|
-
var
|
|
5623
|
-
|
|
6029
|
+
var _a;
|
|
6030
|
+
if (_cachedData !== null) {
|
|
6031
|
+
return _cachedData;
|
|
6032
|
+
}
|
|
6033
|
+
_cachedData = (_a = self2.getPColumnByRef(ref)) == null ? void 0 : _a.data;
|
|
6034
|
+
return _cachedData;
|
|
5624
6035
|
}
|
|
5625
6036
|
};
|
|
5626
6037
|
});
|
|
@@ -5629,288 +6040,272 @@
|
|
|
5629
6040
|
* Find labels data for a given axis id of a p-column.
|
|
5630
6041
|
* @returns a map of axis value => label
|
|
5631
6042
|
*/
|
|
5632
|
-
findLabelsForColumnAxis(
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
const
|
|
5637
|
-
if (
|
|
5638
|
-
const
|
|
5639
|
-
return Object.fromEntries(
|
|
5640
|
-
|
|
5641
|
-
|
|
6043
|
+
findLabelsForColumnAxis(column, axisIdx) {
|
|
6044
|
+
const labels = this.findLabels(column.axesSpec[axisIdx]);
|
|
6045
|
+
if (!labels)
|
|
6046
|
+
return void 0;
|
|
6047
|
+
const axisKeys = readAnnotation(column, `pl7.app/axisKeys/${axisIdx}`);
|
|
6048
|
+
if (axisKeys !== void 0) {
|
|
6049
|
+
const keys = JSON.parse(axisKeys);
|
|
6050
|
+
return Object.fromEntries(keys.map((key) => {
|
|
6051
|
+
return [key, labels[key] ?? "Unlabelled"];
|
|
6052
|
+
}));
|
|
6053
|
+
} else {
|
|
6054
|
+
return labels;
|
|
6055
|
+
}
|
|
5642
6056
|
}
|
|
5643
6057
|
}
|
|
5644
|
-
class
|
|
6058
|
+
class RenderCtx {
|
|
5645
6059
|
constructor() {
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
this
|
|
6060
|
+
__publicField(this, "ctx");
|
|
6061
|
+
__publicField(this, "_argsCache");
|
|
6062
|
+
__publicField(this, "_uiStateCache");
|
|
6063
|
+
// lazy rendering because this feature is rarely used
|
|
6064
|
+
__publicField(this, "_activeArgsCache");
|
|
6065
|
+
__publicField(this, "resultPool", new ResultPool());
|
|
6066
|
+
this.ctx = getCfgRenderCtx();
|
|
6067
|
+
}
|
|
6068
|
+
get args() {
|
|
6069
|
+
if (this._argsCache === void 0) {
|
|
6070
|
+
const raw = this.ctx.args;
|
|
6071
|
+
const value = typeof raw === "function" ? raw() : raw;
|
|
6072
|
+
this._argsCache = { v: JSON.parse(value) };
|
|
6073
|
+
}
|
|
6074
|
+
return this._argsCache.v;
|
|
6075
|
+
}
|
|
6076
|
+
get uiState() {
|
|
6077
|
+
if (this._uiStateCache === void 0) {
|
|
6078
|
+
const raw = this.ctx.uiState;
|
|
6079
|
+
const value = typeof raw === "function" ? raw() : raw;
|
|
6080
|
+
this._uiStateCache = { v: value ? JSON.parse(value) : {} };
|
|
6081
|
+
}
|
|
6082
|
+
return this._uiStateCache.v;
|
|
5652
6083
|
}
|
|
5653
6084
|
/**
|
|
5654
6085
|
* Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
|
|
5655
6086
|
* Returns undefined, if block was never executed or stopped mid-way execution, so that the result was cleared.
|
|
5656
6087
|
* */
|
|
5657
6088
|
get activeArgs() {
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
6089
|
+
if (this._activeArgsCache === void 0) {
|
|
6090
|
+
const raw = this.ctx.activeArgs;
|
|
6091
|
+
const value = typeof raw === "function" ? raw() : raw;
|
|
6092
|
+
this._activeArgsCache = {
|
|
6093
|
+
v: value ? JSON.parse(value) : void 0
|
|
6094
|
+
};
|
|
6095
|
+
}
|
|
6096
|
+
return this._activeArgsCache.v;
|
|
5661
6097
|
}
|
|
5662
6098
|
// /** Can be used to determine features provided by the desktop instance. */
|
|
5663
6099
|
// public get featureFlags() {
|
|
5664
6100
|
// return this.ctx.featureFlags;
|
|
5665
6101
|
// }
|
|
5666
|
-
getNamedAccessor(
|
|
5667
|
-
return
|
|
5668
|
-
this.ctx.getAccessorHandleByName(e),
|
|
5669
|
-
(n2) => new E(n2, [e])
|
|
5670
|
-
);
|
|
6102
|
+
getNamedAccessor(name) {
|
|
6103
|
+
return ifDef(this.ctx.getAccessorHandleByName(name), (accessor) => new TreeNodeAccessor(accessor, [name]));
|
|
5671
6104
|
}
|
|
5672
6105
|
get prerun() {
|
|
5673
|
-
return this.getNamedAccessor(
|
|
6106
|
+
return this.getNamedAccessor(StagingAccessorName);
|
|
5674
6107
|
}
|
|
5675
6108
|
get outputs() {
|
|
5676
|
-
return this.getNamedAccessor(
|
|
6109
|
+
return this.getNamedAccessor(MainAccessorName);
|
|
5677
6110
|
}
|
|
5678
6111
|
/**
|
|
5679
6112
|
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
5680
6113
|
* @returns a map of axis value => label
|
|
5681
6114
|
* @deprecated Use resultPool.findLabels instead
|
|
5682
6115
|
*/
|
|
5683
|
-
findLabels(
|
|
5684
|
-
return this.resultPool.findLabels(
|
|
6116
|
+
findLabels(axis) {
|
|
6117
|
+
return this.resultPool.findLabels(axis);
|
|
6118
|
+
}
|
|
6119
|
+
verifyInlineAndExplicitColumnsSupport(columns) {
|
|
6120
|
+
var _a;
|
|
6121
|
+
const hasInlineColumns = columns.some((c) => !(c.data instanceof TreeNodeAccessor) || isDataInfo(c.data));
|
|
6122
|
+
const inlineColumnsSupport = ((_a = this.ctx.featureFlags) == null ? void 0 : _a.inlineColumnsSupport) === true;
|
|
6123
|
+
if (hasInlineColumns && !inlineColumnsSupport)
|
|
6124
|
+
throw Error(`Inline or explicit columns not supported`);
|
|
5685
6125
|
}
|
|
5686
|
-
|
|
5687
|
-
var
|
|
5688
|
-
|
|
5689
|
-
|
|
6126
|
+
patchPTableDef(def) {
|
|
6127
|
+
var _a, _b;
|
|
6128
|
+
if (!((_a = this.ctx.featureFlags) == null ? void 0 : _a.pTablePartitionFiltersSupport)) {
|
|
6129
|
+
def = {
|
|
6130
|
+
...def,
|
|
6131
|
+
partitionFilters: [],
|
|
6132
|
+
filters: [...def.partitionFilters, ...def.filters]
|
|
6133
|
+
};
|
|
6134
|
+
}
|
|
6135
|
+
if (!((_b = this.ctx.featureFlags) == null ? void 0 : _b.pFrameInSetFilterSupport)) {
|
|
6136
|
+
def = {
|
|
6137
|
+
...def,
|
|
6138
|
+
partitionFilters: patchInSetFilters(def.partitionFilters),
|
|
6139
|
+
filters: patchInSetFilters(def.filters)
|
|
6140
|
+
};
|
|
6141
|
+
}
|
|
6142
|
+
return def;
|
|
5690
6143
|
}
|
|
5691
6144
|
// TODO remove all non-PColumn fields
|
|
5692
|
-
createPFrame(
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
6145
|
+
createPFrame(def) {
|
|
6146
|
+
this.verifyInlineAndExplicitColumnsSupport(def);
|
|
6147
|
+
return this.ctx.createPFrame(def.map((c) => transformPColumnData(c)));
|
|
6148
|
+
}
|
|
6149
|
+
createPTable(def) {
|
|
6150
|
+
let rawDef;
|
|
6151
|
+
if ("columns" in def) {
|
|
6152
|
+
rawDef = this.patchPTableDef({
|
|
6153
|
+
src: {
|
|
6154
|
+
type: "full",
|
|
6155
|
+
entries: def.columns.map((c) => ({ type: "column", column: c }))
|
|
6156
|
+
},
|
|
6157
|
+
partitionFilters: def.filters ?? [],
|
|
6158
|
+
filters: [],
|
|
6159
|
+
sorting: def.sorting ?? []
|
|
6160
|
+
});
|
|
6161
|
+
} else {
|
|
6162
|
+
rawDef = this.patchPTableDef(def);
|
|
6163
|
+
}
|
|
6164
|
+
this.verifyInlineAndExplicitColumnsSupport(extractAllColumns(rawDef.src));
|
|
6165
|
+
return this.ctx.createPTable(mapPTableDef(rawDef, (po) => transformPColumnData(po)));
|
|
5709
6166
|
}
|
|
5710
6167
|
/** @deprecated scheduled for removal from SDK */
|
|
5711
|
-
getBlockLabel(
|
|
5712
|
-
return this.ctx.getBlockLabel(
|
|
6168
|
+
getBlockLabel(blockId) {
|
|
6169
|
+
return this.ctx.getBlockLabel(blockId);
|
|
5713
6170
|
}
|
|
5714
6171
|
getCurrentUnstableMarker() {
|
|
5715
6172
|
return this.ctx.getCurrentUnstableMarker();
|
|
5716
6173
|
}
|
|
5717
|
-
logInfo(
|
|
5718
|
-
this.ctx.logInfo(
|
|
5719
|
-
}
|
|
5720
|
-
logWarn(
|
|
5721
|
-
this.ctx.logWarn(
|
|
5722
|
-
}
|
|
5723
|
-
logError(
|
|
5724
|
-
this.ctx.logError(
|
|
5725
|
-
}
|
|
5726
|
-
}
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
);
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
this.
|
|
5769
|
-
|
|
5770
|
-
|
|
6174
|
+
logInfo(msg) {
|
|
6175
|
+
this.ctx.logInfo(msg);
|
|
6176
|
+
}
|
|
6177
|
+
logWarn(msg) {
|
|
6178
|
+
this.ctx.logWarn(msg);
|
|
6179
|
+
}
|
|
6180
|
+
logError(msg) {
|
|
6181
|
+
this.ctx.logError(msg);
|
|
6182
|
+
}
|
|
6183
|
+
}
|
|
6184
|
+
var version = "1.43.2";
|
|
6185
|
+
const PlatformaSDKVersion = version;
|
|
6186
|
+
function isConfigLambda(cfgOrFh) {
|
|
6187
|
+
return cfgOrFh.__renderLambda === true;
|
|
6188
|
+
}
|
|
6189
|
+
function downgradeCfgOrLambda(data) {
|
|
6190
|
+
if (data === void 0)
|
|
6191
|
+
return void 0;
|
|
6192
|
+
if (isConfigLambda(data))
|
|
6193
|
+
return data.handle;
|
|
6194
|
+
return data;
|
|
6195
|
+
}
|
|
6196
|
+
const _BlockModel = class _BlockModel {
|
|
6197
|
+
constructor(_renderingMode, _initialArgs, _initialUiState, _outputs, _inputsValid, _sections, _title, _enrichmentTargets, _featureFlags) {
|
|
6198
|
+
__publicField(this, "_renderingMode");
|
|
6199
|
+
__publicField(this, "_initialArgs");
|
|
6200
|
+
__publicField(this, "_initialUiState");
|
|
6201
|
+
__publicField(this, "_outputs");
|
|
6202
|
+
__publicField(this, "_inputsValid");
|
|
6203
|
+
__publicField(this, "_sections");
|
|
6204
|
+
__publicField(this, "_title");
|
|
6205
|
+
__publicField(this, "_enrichmentTargets");
|
|
6206
|
+
__publicField(this, "_featureFlags");
|
|
6207
|
+
this._renderingMode = _renderingMode;
|
|
6208
|
+
this._initialArgs = _initialArgs;
|
|
6209
|
+
this._initialUiState = _initialUiState;
|
|
6210
|
+
this._outputs = _outputs;
|
|
6211
|
+
this._inputsValid = _inputsValid;
|
|
6212
|
+
this._sections = _sections;
|
|
6213
|
+
this._title = _title;
|
|
6214
|
+
this._enrichmentTargets = _enrichmentTargets;
|
|
6215
|
+
this._featureFlags = _featureFlags;
|
|
6216
|
+
}
|
|
6217
|
+
static create(renderingMode = "Heavy") {
|
|
6218
|
+
return new _BlockModel(renderingMode, void 0, {}, {}, getImmediate(true), getImmediate([]), void 0, void 0, { ..._BlockModel.INITIAL_BLOCK_FEATURE_FLAGS });
|
|
6219
|
+
}
|
|
6220
|
+
output(key, cfgOrRf, flags = {}) {
|
|
6221
|
+
if (typeof cfgOrRf === "function") {
|
|
6222
|
+
const handle = `output#${key}`;
|
|
6223
|
+
tryRegisterCallback(handle, () => cfgOrRf(new RenderCtx()));
|
|
6224
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
|
|
6225
|
+
...this._outputs,
|
|
6226
|
+
[key]: {
|
|
6227
|
+
__renderLambda: true,
|
|
6228
|
+
handle,
|
|
6229
|
+
...flags
|
|
6230
|
+
}
|
|
6231
|
+
}, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5771
6232
|
} else
|
|
5772
|
-
return new
|
|
5773
|
-
this.
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
{
|
|
5777
|
-
...this._outputs,
|
|
5778
|
-
[e]: n2
|
|
5779
|
-
},
|
|
5780
|
-
this._inputsValid,
|
|
5781
|
-
this._sections,
|
|
5782
|
-
this._title,
|
|
5783
|
-
this._enrichmentTargets
|
|
5784
|
-
);
|
|
6233
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
|
|
6234
|
+
...this._outputs,
|
|
6235
|
+
[key]: cfgOrRf
|
|
6236
|
+
}, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5785
6237
|
}
|
|
5786
6238
|
/** Shortcut for {@link output} with retentive flag set to true. */
|
|
5787
|
-
retentiveOutput(
|
|
5788
|
-
return this.output(
|
|
5789
|
-
}
|
|
5790
|
-
argsValid(
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
this._initialArgs,
|
|
5794
|
-
this._initialUiState,
|
|
5795
|
-
this._outputs,
|
|
5796
|
-
{
|
|
6239
|
+
retentiveOutput(key, rf) {
|
|
6240
|
+
return this.output(key, rf, { retentive: true });
|
|
6241
|
+
}
|
|
6242
|
+
argsValid(cfgOrRf) {
|
|
6243
|
+
if (typeof cfgOrRf === "function") {
|
|
6244
|
+
tryRegisterCallback("inputsValid", () => cfgOrRf(new RenderCtx()));
|
|
6245
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, {
|
|
5797
6246
|
__renderLambda: true,
|
|
5798
6247
|
handle: "inputsValid"
|
|
5799
|
-
},
|
|
5800
|
-
|
|
5801
|
-
this._title,
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
this.
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
this._title,
|
|
5811
|
-
this._enrichmentTargets
|
|
5812
|
-
);
|
|
5813
|
-
}
|
|
5814
|
-
sections(e) {
|
|
5815
|
-
return Array.isArray(e) ? this.sections(re(e)) : typeof e == "function" ? (H("sections", () => e(new te())), new L(
|
|
5816
|
-
this._renderingMode,
|
|
5817
|
-
this._initialArgs,
|
|
5818
|
-
this._initialUiState,
|
|
5819
|
-
this._outputs,
|
|
5820
|
-
this._inputsValid,
|
|
5821
|
-
{ __renderLambda: true, handle: "sections" },
|
|
5822
|
-
this._title,
|
|
5823
|
-
this._enrichmentTargets
|
|
5824
|
-
)) : new L(
|
|
5825
|
-
this._renderingMode,
|
|
5826
|
-
this._initialArgs,
|
|
5827
|
-
this._initialUiState,
|
|
5828
|
-
this._outputs,
|
|
5829
|
-
this._inputsValid,
|
|
5830
|
-
e,
|
|
5831
|
-
this._title,
|
|
5832
|
-
this._enrichmentTargets
|
|
5833
|
-
);
|
|
6248
|
+
}, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6249
|
+
} else
|
|
6250
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, cfgOrRf, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6251
|
+
}
|
|
6252
|
+
sections(arrOrCfgOrRf) {
|
|
6253
|
+
if (Array.isArray(arrOrCfgOrRf)) {
|
|
6254
|
+
return this.sections(getImmediate(arrOrCfgOrRf));
|
|
6255
|
+
} else if (typeof arrOrCfgOrRf === "function") {
|
|
6256
|
+
tryRegisterCallback("sections", () => arrOrCfgOrRf(new RenderCtx()));
|
|
6257
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, { __renderLambda: true, handle: "sections" }, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6258
|
+
} else
|
|
6259
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, arrOrCfgOrRf, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5834
6260
|
}
|
|
5835
6261
|
/** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
|
|
5836
|
-
title(
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
this._initialArgs,
|
|
5840
|
-
this._initialUiState,
|
|
5841
|
-
this._outputs,
|
|
5842
|
-
this._inputsValid,
|
|
5843
|
-
this._sections,
|
|
5844
|
-
{ __renderLambda: true, handle: "title" },
|
|
5845
|
-
this._enrichmentTargets
|
|
5846
|
-
);
|
|
6262
|
+
title(rf) {
|
|
6263
|
+
tryRegisterCallback("title", () => rf(new RenderCtx()));
|
|
6264
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, { __renderLambda: true, handle: "title" }, this._enrichmentTargets, this._featureFlags);
|
|
5847
6265
|
}
|
|
5848
6266
|
/**
|
|
5849
6267
|
* Sets initial args for the block, this value must be specified.
|
|
5850
6268
|
* @deprecated use {@link withArgs}
|
|
5851
6269
|
* */
|
|
5852
|
-
initialArgs(
|
|
5853
|
-
return new
|
|
5854
|
-
this._renderingMode,
|
|
5855
|
-
e,
|
|
5856
|
-
this._initialUiState,
|
|
5857
|
-
this._outputs,
|
|
5858
|
-
this._inputsValid,
|
|
5859
|
-
this._sections,
|
|
5860
|
-
this._title,
|
|
5861
|
-
this._enrichmentTargets
|
|
5862
|
-
);
|
|
6270
|
+
initialArgs(value) {
|
|
6271
|
+
return new _BlockModel(this._renderingMode, value, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5863
6272
|
}
|
|
5864
6273
|
/** Sets initial args for the block, this value must be specified. */
|
|
5865
|
-
withArgs(
|
|
5866
|
-
return new
|
|
5867
|
-
this._renderingMode,
|
|
5868
|
-
e,
|
|
5869
|
-
this._initialUiState,
|
|
5870
|
-
this._outputs,
|
|
5871
|
-
this._inputsValid,
|
|
5872
|
-
this._sections,
|
|
5873
|
-
this._title,
|
|
5874
|
-
this._enrichmentTargets
|
|
5875
|
-
);
|
|
6274
|
+
withArgs(initialValue) {
|
|
6275
|
+
return new _BlockModel(this._renderingMode, initialValue, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
5876
6276
|
}
|
|
5877
6277
|
/** Defines type and sets initial value for block UiState. */
|
|
5878
|
-
withUiState(
|
|
5879
|
-
return new
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
this._inputsValid,
|
|
5885
|
-
this._sections,
|
|
5886
|
-
this._title,
|
|
5887
|
-
this._enrichmentTargets
|
|
5888
|
-
);
|
|
6278
|
+
withUiState(initialValue) {
|
|
6279
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, initialValue, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
|
|
6280
|
+
}
|
|
6281
|
+
/** Sets or overrides feature flags for the block. */
|
|
6282
|
+
withFeatureFlags(flags) {
|
|
6283
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, { ...this._featureFlags, ...flags });
|
|
5889
6284
|
}
|
|
5890
6285
|
/**
|
|
5891
6286
|
* Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
|
|
5892
6287
|
* Influences dependency graph construction.
|
|
5893
6288
|
*/
|
|
5894
|
-
enriches(
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
this._initialArgs,
|
|
5898
|
-
this._initialUiState,
|
|
5899
|
-
this._outputs,
|
|
5900
|
-
this._inputsValid,
|
|
5901
|
-
this._sections,
|
|
5902
|
-
this._title,
|
|
5903
|
-
{ __renderLambda: true, handle: "enrichmentTargets" }
|
|
5904
|
-
);
|
|
6289
|
+
enriches(lambda) {
|
|
6290
|
+
tryRegisterCallback("enrichmentTargets", lambda);
|
|
6291
|
+
return new _BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, { __renderLambda: true, handle: "enrichmentTargets" }, this._featureFlags);
|
|
5905
6292
|
}
|
|
5906
6293
|
/** Renders all provided block settings into a pre-configured platforma API
|
|
5907
6294
|
* instance, that can be used in frontend to interact with block state, and
|
|
5908
6295
|
* other features provided by the platforma to the block. */
|
|
5909
|
-
done() {
|
|
5910
|
-
|
|
5911
|
-
|
|
6296
|
+
done(apiVersion) {
|
|
6297
|
+
const requiresUIAPIVersion = apiVersion ?? 1;
|
|
6298
|
+
return this.withFeatureFlags({
|
|
6299
|
+
...this._featureFlags,
|
|
6300
|
+
requiresUIAPIVersion
|
|
6301
|
+
})._done(requiresUIAPIVersion);
|
|
6302
|
+
}
|
|
6303
|
+
_done(apiVersion) {
|
|
6304
|
+
if (this._initialArgs === void 0)
|
|
6305
|
+
throw new Error("Initial arguments not set.");
|
|
6306
|
+
const config = {
|
|
5912
6307
|
v3: {
|
|
5913
|
-
sdkVersion:
|
|
6308
|
+
sdkVersion: PlatformaSDKVersion,
|
|
5914
6309
|
renderingMode: this._renderingMode,
|
|
5915
6310
|
initialArgs: this._initialArgs,
|
|
5916
6311
|
initialUiState: this._initialUiState,
|
|
@@ -5918,152 +6313,340 @@
|
|
|
5918
6313
|
sections: this._sections,
|
|
5919
6314
|
title: this._title,
|
|
5920
6315
|
outputs: this._outputs,
|
|
5921
|
-
enrichmentTargets: this._enrichmentTargets
|
|
6316
|
+
enrichmentTargets: this._enrichmentTargets,
|
|
6317
|
+
featureFlags: this._featureFlags
|
|
5922
6318
|
},
|
|
5923
6319
|
// fields below are added to allow previous desktop versions read generated configs
|
|
5924
|
-
sdkVersion:
|
|
6320
|
+
sdkVersion: PlatformaSDKVersion,
|
|
5925
6321
|
renderingMode: this._renderingMode,
|
|
5926
6322
|
initialArgs: this._initialArgs,
|
|
5927
|
-
inputsValid:
|
|
5928
|
-
sections:
|
|
5929
|
-
outputs: Object.fromEntries(
|
|
5930
|
-
Object.entries(this._outputs).map(([n2, r]) => [n2, fe(r)])
|
|
5931
|
-
)
|
|
6323
|
+
inputsValid: downgradeCfgOrLambda(this._inputsValid),
|
|
6324
|
+
sections: downgradeCfgOrLambda(this._sections),
|
|
6325
|
+
outputs: Object.fromEntries(Object.entries(this._outputs).map(([key, value]) => [key, downgradeCfgOrLambda(value)]))
|
|
5932
6326
|
};
|
|
5933
|
-
|
|
6327
|
+
globalThis.platformaApiVersion = apiVersion;
|
|
6328
|
+
if (!isInUI())
|
|
6329
|
+
return { config };
|
|
6330
|
+
else
|
|
6331
|
+
return getPlatformaInstance({ sdkVersion: PlatformaSDKVersion, apiVersion: platformaApiVersion });
|
|
5934
6332
|
}
|
|
6333
|
+
};
|
|
6334
|
+
__publicField(_BlockModel, "INITIAL_BLOCK_FEATURE_FLAGS", {
|
|
6335
|
+
supportsLazyState: true,
|
|
6336
|
+
requiresUIAPIVersion: 1,
|
|
6337
|
+
requiresModelAPIVersion: 1
|
|
6338
|
+
});
|
|
6339
|
+
let BlockModel = _BlockModel;
|
|
6340
|
+
function makeDefaultPTableParams() {
|
|
6341
|
+
return {
|
|
6342
|
+
sourceId: null,
|
|
6343
|
+
hiddenColIds: null,
|
|
6344
|
+
partitionFilters: [],
|
|
6345
|
+
filters: [],
|
|
6346
|
+
sorting: []
|
|
6347
|
+
};
|
|
5935
6348
|
}
|
|
5936
|
-
function
|
|
6349
|
+
function createPlDataTableStateV2() {
|
|
5937
6350
|
return {
|
|
5938
|
-
version:
|
|
6351
|
+
version: 4,
|
|
5939
6352
|
stateCache: [],
|
|
5940
|
-
pTableParams:
|
|
5941
|
-
sorting: [],
|
|
5942
|
-
filters: [],
|
|
5943
|
-
hiddenColIds: null
|
|
5944
|
-
}
|
|
6353
|
+
pTableParams: makeDefaultPTableParams()
|
|
5945
6354
|
};
|
|
5946
6355
|
}
|
|
5947
|
-
function
|
|
5948
|
-
|
|
6356
|
+
function upgradePlDataTableStateV2(state) {
|
|
6357
|
+
if (!state) {
|
|
6358
|
+
return createPlDataTableStateV2();
|
|
6359
|
+
}
|
|
6360
|
+
if (!("version" in state)) {
|
|
6361
|
+
state = createPlDataTableStateV2();
|
|
6362
|
+
}
|
|
6363
|
+
if (state.version === 2) {
|
|
6364
|
+
state = {
|
|
6365
|
+
version: 3,
|
|
6366
|
+
stateCache: state.stateCache.map((entry) => ({
|
|
6367
|
+
...entry,
|
|
6368
|
+
filtersState: []
|
|
6369
|
+
})),
|
|
6370
|
+
pTableParams: makeDefaultPTableParams()
|
|
6371
|
+
};
|
|
6372
|
+
}
|
|
6373
|
+
if (state.version === 3) {
|
|
6374
|
+
state = createPlDataTableStateV2();
|
|
6375
|
+
}
|
|
6376
|
+
return state;
|
|
5949
6377
|
}
|
|
5950
|
-
function
|
|
5951
|
-
return
|
|
6378
|
+
function isLabelColumn(column) {
|
|
6379
|
+
return column.axesSpec.length === 1 && column.name === PColumnName.Label;
|
|
5952
6380
|
}
|
|
5953
|
-
function
|
|
5954
|
-
return new
|
|
5955
|
-
name:
|
|
6381
|
+
function getAllLabelColumns(resultPool) {
|
|
6382
|
+
return new PColumnCollection().addAxisLabelProvider(resultPool).addColumnProvider(resultPool).getColumns({
|
|
6383
|
+
name: PColumnName.Label,
|
|
5956
6384
|
axes: [{}]
|
|
5957
6385
|
// exactly one axis
|
|
5958
6386
|
}, { dontWaitAllData: true });
|
|
5959
6387
|
}
|
|
5960
|
-
function
|
|
5961
|
-
const
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
}
|
|
6388
|
+
function getMatchingLabelColumns(columns, allLabelColumns) {
|
|
6389
|
+
const inputLabelColumns = [];
|
|
6390
|
+
const inputValueColumns = [];
|
|
6391
|
+
for (const column of columns) {
|
|
6392
|
+
if (isLabelColumn(column.spec)) {
|
|
6393
|
+
inputLabelColumns.push(column);
|
|
6394
|
+
} else {
|
|
6395
|
+
inputValueColumns.push(column);
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
const unlabeledAxes = [];
|
|
6399
|
+
for (const column of inputValueColumns) {
|
|
6400
|
+
for (const axis of column.spec.axesSpec) {
|
|
6401
|
+
const axisId = getAxisId(axis);
|
|
6402
|
+
if (!unlabeledAxes.some((id) => matchAxisId(id, axisId))) {
|
|
6403
|
+
unlabeledAxes.push(axisId);
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
}
|
|
6407
|
+
for (const labelColumn of inputLabelColumns) {
|
|
6408
|
+
const labelAxisId = getAxisId(labelColumn.spec.axesSpec[0]);
|
|
6409
|
+
const labelMatch = unlabeledAxes.findIndex((axisId) => matchAxisId(axisId, labelAxisId));
|
|
6410
|
+
if (labelMatch !== -1) {
|
|
6411
|
+
unlabeledAxes.splice(labelMatch, 1);
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
const colId = (id, domain) => {
|
|
6415
|
+
let wid = id.toString();
|
|
6416
|
+
if (domain) {
|
|
6417
|
+
for (const k in domain) {
|
|
6418
|
+
wid += k;
|
|
6419
|
+
wid += domain[k];
|
|
6420
|
+
}
|
|
6421
|
+
}
|
|
6422
|
+
return wid;
|
|
6423
|
+
};
|
|
6424
|
+
const labelColumns = [];
|
|
6425
|
+
for (const labelColumn of allLabelColumns) {
|
|
6426
|
+
const labelAxis = labelColumn.spec.axesSpec[0];
|
|
6427
|
+
const labelAxisId = getAxisId(labelAxis);
|
|
6428
|
+
const labelMatch = unlabeledAxes.findIndex((axisId) => matchAxisId(axisId, labelAxisId));
|
|
6429
|
+
if (labelMatch !== -1) {
|
|
6430
|
+
const axisId = unlabeledAxes[labelMatch];
|
|
6431
|
+
const dataDomainLen = Object.keys(axisId.domain ?? {}).length;
|
|
6432
|
+
const labelDomainLen = Object.keys(labelAxis.domain ?? {}).length;
|
|
6433
|
+
if (dataDomainLen > labelDomainLen) {
|
|
6434
|
+
labelColumns.push({
|
|
6435
|
+
id: colId(labelColumn.id, axisId.domain),
|
|
6436
|
+
spec: {
|
|
6437
|
+
...labelColumn.spec,
|
|
6438
|
+
axesSpec: [{ ...axisId, annotations: labelAxis.annotations }]
|
|
6439
|
+
},
|
|
6440
|
+
data: labelColumn.data
|
|
6441
|
+
});
|
|
6442
|
+
} else {
|
|
6443
|
+
labelColumns.push(labelColumn);
|
|
6444
|
+
}
|
|
6445
|
+
unlabeledAxes.splice(labelMatch, 1);
|
|
5993
6446
|
}
|
|
5994
6447
|
}
|
|
5995
|
-
return
|
|
6448
|
+
return labelColumns;
|
|
5996
6449
|
}
|
|
5997
|
-
function
|
|
5998
|
-
const
|
|
5999
|
-
|
|
6000
|
-
|
|
6450
|
+
function allColumnsComputed(columns) {
|
|
6451
|
+
const isValues = (d) => Array.isArray(d);
|
|
6452
|
+
const isAccessor = (d) => d instanceof TreeNodeAccessor;
|
|
6453
|
+
const isDataInfo2 = (d) => typeof d === "object" && "type" in d;
|
|
6454
|
+
return columns.map((c) => c.data).every((d) => {
|
|
6455
|
+
if (isValues(d)) {
|
|
6001
6456
|
return true;
|
|
6002
|
-
if (
|
|
6003
|
-
return
|
|
6004
|
-
if (
|
|
6005
|
-
|
|
6457
|
+
} else if (isAccessor(d)) {
|
|
6458
|
+
return d.getIsReadyOrError();
|
|
6459
|
+
} else if (isDataInfo2(d)) {
|
|
6460
|
+
const type = d.type;
|
|
6461
|
+
switch (type) {
|
|
6006
6462
|
case "Json":
|
|
6007
6463
|
return true;
|
|
6008
6464
|
case "JsonPartitioned":
|
|
6009
|
-
return Object.values(
|
|
6465
|
+
return Object.values(d.parts).every((p) => p.getIsReadyOrError());
|
|
6010
6466
|
case "BinaryPartitioned":
|
|
6011
|
-
return Object.values(
|
|
6467
|
+
return Object.values(d.parts).every((p) => p.index.getIsReadyOrError() && p.values.getIsReadyOrError());
|
|
6468
|
+
case "ParquetPartitioned":
|
|
6469
|
+
return Object.values(d.parts).every((p) => p.getIsReadyOrError());
|
|
6012
6470
|
}
|
|
6013
|
-
else
|
|
6014
|
-
throw Error(`unsupported column data type: ${
|
|
6471
|
+
} else {
|
|
6472
|
+
throw Error(`unsupported column data type: ${d}`);
|
|
6473
|
+
}
|
|
6015
6474
|
});
|
|
6016
6475
|
}
|
|
6017
|
-
function
|
|
6018
|
-
let
|
|
6019
|
-
const
|
|
6020
|
-
|
|
6476
|
+
function createPTableDef(params) {
|
|
6477
|
+
let coreColumns = params.columns;
|
|
6478
|
+
const secondaryColumns = [];
|
|
6479
|
+
if (params.coreColumnPredicate) {
|
|
6480
|
+
coreColumns = [];
|
|
6481
|
+
for (const c of params.columns)
|
|
6482
|
+
if (params.coreColumnPredicate(c.spec))
|
|
6483
|
+
coreColumns.push(c);
|
|
6484
|
+
else
|
|
6485
|
+
secondaryColumns.push(c);
|
|
6486
|
+
}
|
|
6487
|
+
secondaryColumns.push(...params.labelColumns);
|
|
6488
|
+
return {
|
|
6021
6489
|
src: {
|
|
6022
6490
|
type: "outer",
|
|
6023
6491
|
primary: {
|
|
6024
|
-
type:
|
|
6025
|
-
entries:
|
|
6492
|
+
type: params.coreJoinType,
|
|
6493
|
+
entries: coreColumns.map((c) => ({ type: "column", column: c }))
|
|
6026
6494
|
},
|
|
6027
|
-
secondary:
|
|
6495
|
+
secondary: secondaryColumns.map((c) => ({ type: "column", column: c }))
|
|
6028
6496
|
},
|
|
6029
|
-
|
|
6030
|
-
|
|
6497
|
+
partitionFilters: params.partitionFilters,
|
|
6498
|
+
filters: params.filters,
|
|
6499
|
+
sorting: params.sorting
|
|
6031
6500
|
};
|
|
6032
6501
|
}
|
|
6033
|
-
function
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6502
|
+
function isColumnHidden(spec) {
|
|
6503
|
+
return readAnnotation(spec, Annotation.Table.Visibility) === "hidden";
|
|
6504
|
+
}
|
|
6505
|
+
function isColumnOptional(spec) {
|
|
6506
|
+
return readAnnotation(spec, Annotation.Table.Visibility) === "optional";
|
|
6507
|
+
}
|
|
6508
|
+
function createPlDataTableV2(ctx, inputColumns, tableState, ops) {
|
|
6509
|
+
if (inputColumns.length === 0)
|
|
6510
|
+
return void 0;
|
|
6511
|
+
const columns = inputColumns.filter((c) => isLinkerColumn(c.spec) || !isColumnHidden(c.spec));
|
|
6512
|
+
const tableStateNormalized = upgradePlDataTableStateV2(tableState);
|
|
6513
|
+
const allLabelColumns = getAllLabelColumns(ctx.resultPool);
|
|
6514
|
+
if (!allLabelColumns)
|
|
6515
|
+
return void 0;
|
|
6516
|
+
const fullLabelColumns = getMatchingLabelColumns(columns.map(getColumnIdAndSpec), allLabelColumns);
|
|
6517
|
+
const fullColumns = [...columns, ...fullLabelColumns];
|
|
6518
|
+
const fullColumnsAxes = uniqueBy([...fullColumns.flatMap((c) => c.spec.axesSpec.map((a) => getAxisId(a)))], (a) => canonicalizeJson(a));
|
|
6519
|
+
const fullColumnsIds = [
|
|
6520
|
+
...fullColumnsAxes.map((a) => ({ type: "axis", id: a })),
|
|
6521
|
+
...fullColumns.map((c) => ({ type: "column", id: c.id }))
|
|
6522
|
+
];
|
|
6523
|
+
const fullColumnsIdsSet = new Set(fullColumnsIds.map((c) => canonicalizeJson(c)));
|
|
6524
|
+
const isValidColumnId = (id) => fullColumnsIdsSet.has(canonicalizeJson(id));
|
|
6525
|
+
const coreJoinType = "full";
|
|
6526
|
+
const partitionFilters = tableStateNormalized.pTableParams.partitionFilters.filter((f) => {
|
|
6527
|
+
const valid = isValidColumnId(f.column);
|
|
6528
|
+
if (!valid)
|
|
6529
|
+
ctx.logWarn(`Partition filter ${JSON.stringify(f)} does not match provided columns, skipping`);
|
|
6530
|
+
return valid;
|
|
6531
|
+
});
|
|
6532
|
+
const filters = uniqueBy([...[], ...tableStateNormalized.pTableParams.filters], (f) => canonicalizeJson(f.column)).filter((f) => {
|
|
6533
|
+
const valid = isValidColumnId(f.column);
|
|
6534
|
+
if (!valid)
|
|
6535
|
+
ctx.logWarn(`Filter ${JSON.stringify(f)} does not match provided columns, skipping`);
|
|
6536
|
+
return valid;
|
|
6537
|
+
});
|
|
6538
|
+
const sorting = uniqueBy([...[], ...tableStateNormalized.pTableParams.sorting], (s) => canonicalizeJson(s.column)).filter((s) => {
|
|
6539
|
+
const valid = isValidColumnId(s.column);
|
|
6540
|
+
if (!valid)
|
|
6541
|
+
ctx.logWarn(`Sorting ${JSON.stringify(s)} does not match provided columns, skipping`);
|
|
6542
|
+
return valid;
|
|
6543
|
+
});
|
|
6544
|
+
const fullDef = createPTableDef({
|
|
6545
|
+
columns,
|
|
6546
|
+
labelColumns: fullLabelColumns,
|
|
6547
|
+
coreJoinType,
|
|
6548
|
+
partitionFilters,
|
|
6549
|
+
filters,
|
|
6550
|
+
sorting,
|
|
6551
|
+
coreColumnPredicate: ops == null ? void 0 : ops.coreColumnPredicate
|
|
6552
|
+
});
|
|
6553
|
+
const fullHandle = ctx.createPTable(fullDef);
|
|
6554
|
+
const hiddenColumns = new Set((() => {
|
|
6555
|
+
const hiddenColIds = tableStateNormalized.pTableParams.hiddenColIds;
|
|
6556
|
+
if (hiddenColIds)
|
|
6557
|
+
return hiddenColIds;
|
|
6558
|
+
return columns.filter((c) => isColumnOptional(c.spec)).map((c) => c.id);
|
|
6056
6559
|
})());
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
const
|
|
6560
|
+
columns.filter((c) => isLinkerColumn(c.spec)).forEach((c) => hiddenColumns.delete(c.id));
|
|
6561
|
+
[...partitionFilters.map((f) => f.column), ...filters.map((f) => f.column), ...sorting.map((s) => s.column)].filter((c) => c.type === "column").forEach((c) => hiddenColumns.delete(c.id));
|
|
6562
|
+
const visibleColumns = columns.filter((c) => !hiddenColumns.has(c.id));
|
|
6563
|
+
const visibleLabelColumns = getMatchingLabelColumns(visibleColumns.map(getColumnIdAndSpec), allLabelColumns);
|
|
6564
|
+
if (!allColumnsComputed([...visibleColumns, ...visibleLabelColumns]))
|
|
6565
|
+
return void 0;
|
|
6566
|
+
const visibleDef = createPTableDef({
|
|
6567
|
+
columns: visibleColumns,
|
|
6568
|
+
labelColumns: visibleLabelColumns,
|
|
6569
|
+
coreJoinType,
|
|
6570
|
+
partitionFilters,
|
|
6571
|
+
filters,
|
|
6572
|
+
sorting,
|
|
6573
|
+
coreColumnPredicate: ops == null ? void 0 : ops.coreColumnPredicate
|
|
6574
|
+
});
|
|
6575
|
+
const visibleHandle = ctx.createPTable(visibleDef);
|
|
6061
6576
|
return {
|
|
6062
|
-
|
|
6063
|
-
|
|
6577
|
+
sourceId: tableStateNormalized.pTableParams.sourceId,
|
|
6578
|
+
fullTableHandle: fullHandle,
|
|
6579
|
+
visibleTableHandle: visibleHandle
|
|
6064
6580
|
};
|
|
6065
6581
|
}
|
|
6066
|
-
|
|
6582
|
+
function isLinkerColumn(column) {
|
|
6583
|
+
return !!readAnnotationJson(column, Annotation.IsLinkerColumn);
|
|
6584
|
+
}
|
|
6585
|
+
var stringify = { exports: {} };
|
|
6586
|
+
var hasRequiredStringify;
|
|
6587
|
+
function requireStringify() {
|
|
6588
|
+
if (hasRequiredStringify) return stringify.exports;
|
|
6589
|
+
hasRequiredStringify = 1;
|
|
6590
|
+
(function(module2, exports3) {
|
|
6591
|
+
exports3 = module2.exports = stringify2;
|
|
6592
|
+
exports3.getSerialize = serializer;
|
|
6593
|
+
function stringify2(obj, replacer, spaces, cycleReplacer) {
|
|
6594
|
+
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
|
|
6595
|
+
}
|
|
6596
|
+
function serializer(replacer, cycleReplacer) {
|
|
6597
|
+
var stack = [], keys = [];
|
|
6598
|
+
if (cycleReplacer == null) cycleReplacer = function(key, value) {
|
|
6599
|
+
if (stack[0] === value) return "[Circular ~]";
|
|
6600
|
+
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
6601
|
+
};
|
|
6602
|
+
return function(key, value) {
|
|
6603
|
+
if (stack.length > 0) {
|
|
6604
|
+
var thisPos = stack.indexOf(this);
|
|
6605
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
6606
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
6607
|
+
if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value);
|
|
6608
|
+
} else stack.push(value);
|
|
6609
|
+
return replacer == null ? value : replacer.call(this, key, value);
|
|
6610
|
+
};
|
|
6611
|
+
}
|
|
6612
|
+
})(stringify, stringify.exports);
|
|
6613
|
+
return stringify.exports;
|
|
6614
|
+
}
|
|
6615
|
+
requireStringify();
|
|
6616
|
+
const BasePlErrorLike = z.object({
|
|
6617
|
+
type: z.literal("PlError"),
|
|
6618
|
+
name: z.string(),
|
|
6619
|
+
message: z.string(),
|
|
6620
|
+
/** The message with all details needed for SDK developers. */
|
|
6621
|
+
fullMessage: z.string().optional(),
|
|
6622
|
+
stack: z.string().optional()
|
|
6623
|
+
});
|
|
6624
|
+
const PlErrorLike = BasePlErrorLike.extend({
|
|
6625
|
+
cause: z.lazy(() => ErrorLike).optional(),
|
|
6626
|
+
errors: z.lazy(() => ErrorLike.array()).optional()
|
|
6627
|
+
});
|
|
6628
|
+
const BaseStandardErrorLike = z.object({
|
|
6629
|
+
type: z.literal("StandardError"),
|
|
6630
|
+
name: z.string(),
|
|
6631
|
+
message: z.string(),
|
|
6632
|
+
stack: z.string().optional()
|
|
6633
|
+
});
|
|
6634
|
+
const StandardErrorLike = BaseStandardErrorLike.extend({
|
|
6635
|
+
cause: z.lazy(() => ErrorLike).optional(),
|
|
6636
|
+
errors: z.lazy(() => ErrorLike.array()).optional()
|
|
6637
|
+
});
|
|
6638
|
+
const ErrorLike = z.union([StandardErrorLike, PlErrorLike]);
|
|
6639
|
+
const baseErrorShape = z.object({
|
|
6640
|
+
name: z.string(),
|
|
6641
|
+
message: z.string(),
|
|
6642
|
+
fullMessage: z.string().optional(),
|
|
6643
|
+
stack: z.string().optional()
|
|
6644
|
+
});
|
|
6645
|
+
const ErrorShape = baseErrorShape.extend({
|
|
6646
|
+
cause: z.lazy(() => ErrorShape).optional(),
|
|
6647
|
+
errors: z.lazy(() => ErrorShape.array()).optional()
|
|
6648
|
+
});
|
|
6649
|
+
const model = BlockModel.create().withArgs({
|
|
6067
6650
|
settings: {
|
|
6068
6651
|
coverageThreshold: 0.95,
|
|
6069
6652
|
// default value matching MMseqs2 default
|
|
@@ -6073,7 +6656,7 @@
|
|
|
6073
6656
|
selectedColumns: []
|
|
6074
6657
|
}).withUiState({
|
|
6075
6658
|
title: "Immune Assay Data",
|
|
6076
|
-
tableState:
|
|
6659
|
+
tableState: createPlDataTableStateV2()
|
|
6077
6660
|
}).argsValid(
|
|
6078
6661
|
(ctx) => ctx.args.datasetRef !== void 0 && ctx.args.fileHandle !== void 0 && ctx.args.importColumns !== void 0 && ctx.args.sequenceColumnHeader !== void 0 && ctx.args.targetRef !== void 0 && ctx.uiState.fileImportError === void 0
|
|
6079
6662
|
).output(
|
|
@@ -6140,7 +6723,7 @@
|
|
|
6140
6723
|
const cols = (_d = (_c = ctx.outputs) == null ? void 0 : _c.resolve("table")) == null ? void 0 : _d.getPColumns();
|
|
6141
6724
|
if (cols === void 0)
|
|
6142
6725
|
return void 0;
|
|
6143
|
-
return
|
|
6726
|
+
return createPlDataTableV2(
|
|
6144
6727
|
ctx,
|
|
6145
6728
|
cols,
|
|
6146
6729
|
ctx.uiState.tableState
|
|
@@ -6150,7 +6733,7 @@
|
|
|
6150
6733
|
return ((_a = ctx.outputs) == null ? void 0 : _a.getIsReadyOrError()) === false;
|
|
6151
6734
|
}).title((ctx) => ctx.uiState.title).sections((_ctx) => [
|
|
6152
6735
|
{ type: "link", href: "/", label: "Main" }
|
|
6153
|
-
]).done();
|
|
6736
|
+
]).done(2);
|
|
6154
6737
|
exports2.model = model;
|
|
6155
6738
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
6156
6739
|
});
|