@platforma-sdk/model 1.53.11 → 1.53.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/annotations/converter.cjs +11 -11
- package/dist/annotations/converter.cjs.map +1 -1
- package/dist/annotations/converter.d.ts +1 -1
- package/dist/annotations/converter.d.ts.map +1 -1
- package/dist/annotations/converter.js +11 -11
- package/dist/annotations/converter.js.map +1 -1
- package/dist/annotations/index.d.ts +2 -2
- package/dist/annotations/types.d.ts +4 -4
- package/dist/bconfig/index.d.ts +5 -5
- package/dist/bconfig/lambdas.d.ts +7 -7
- package/dist/bconfig/lambdas.d.ts.map +1 -1
- package/dist/bconfig/normalization.cjs.map +1 -1
- package/dist/bconfig/normalization.d.ts +3 -3
- package/dist/bconfig/normalization.js.map +1 -1
- package/dist/bconfig/types.cjs.map +1 -1
- package/dist/bconfig/types.d.ts +2 -2
- package/dist/bconfig/types.d.ts.map +1 -1
- package/dist/bconfig/types.js.map +1 -1
- package/dist/bconfig/util.d.ts +4 -4
- package/dist/bconfig/v3.d.ts +3 -3
- package/dist/block_api_v1.d.ts +2 -2
- package/dist/block_api_v1.d.ts.map +1 -1
- package/dist/block_api_v2.d.ts +2 -2
- package/dist/block_api_v2.d.ts.map +1 -1
- package/dist/block_api_v3.d.ts +3 -3
- package/dist/block_migrations.cjs +10 -10
- package/dist/block_migrations.cjs.map +1 -1
- package/dist/block_migrations.d.ts.map +1 -1
- package/dist/block_migrations.js +10 -10
- package/dist/block_migrations.js.map +1 -1
- package/dist/block_model.cjs +11 -11
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts +8 -8
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +11 -11
- package/dist/block_model.js.map +1 -1
- package/dist/block_state_patch.d.ts +2 -2
- package/dist/block_state_util.cjs +1 -1
- package/dist/block_state_util.cjs.map +1 -1
- package/dist/block_state_util.d.ts +3 -3
- package/dist/block_state_util.js +1 -1
- package/dist/block_state_util.js.map +1 -1
- package/dist/block_storage.cjs +10 -10
- package/dist/block_storage.cjs.map +1 -1
- package/dist/block_storage.d.ts +2 -2
- package/dist/block_storage.d.ts.map +1 -1
- package/dist/block_storage.js +10 -10
- package/dist/block_storage.js.map +1 -1
- package/dist/block_storage_vm.cjs +22 -22
- package/dist/block_storage_vm.cjs.map +1 -1
- package/dist/block_storage_vm.d.ts +1 -1
- package/dist/block_storage_vm.d.ts.map +1 -1
- package/dist/block_storage_vm.js +22 -22
- package/dist/block_storage_vm.js.map +1 -1
- package/dist/builder.cjs +32 -23
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.d.ts +7 -7
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +32 -23
- package/dist/builder.js.map +1 -1
- package/dist/components/PFrameForGraphs.cjs +7 -6
- package/dist/components/PFrameForGraphs.cjs.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +4 -4
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/components/PFrameForGraphs.js +7 -6
- package/dist/components/PFrameForGraphs.js.map +1 -1
- package/dist/components/PlAnnotations/filter.d.ts +14 -14
- package/dist/components/PlAnnotations/filter.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.cjs +46 -46
- package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.d.ts +10 -34
- package/dist/components/PlAnnotations/filters_ui.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.js +46 -46
- package/dist/components/PlAnnotations/filters_ui.js.map +1 -1
- package/dist/components/PlAnnotations/index.d.ts +2 -2
- package/dist/components/PlAnnotations/types.d.ts +2 -2
- package/dist/components/PlDataTable.cjs +19 -20
- package/dist/components/PlDataTable.cjs.map +1 -1
- package/dist/components/PlDataTable.d.ts +27 -27
- package/dist/components/PlDataTable.d.ts.map +1 -1
- package/dist/components/PlDataTable.js +19 -20
- package/dist/components/PlDataTable.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.cjs +2 -2
- package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.d.ts +6 -6
- package/dist/components/PlMultiSequenceAlignment.d.ts.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.js +2 -2
- package/dist/components/PlMultiSequenceAlignment.js.map +1 -1
- package/dist/components/PlSelectionModel.cjs.map +1 -1
- package/dist/components/PlSelectionModel.d.ts +1 -1
- package/dist/components/PlSelectionModel.js.map +1 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/config/actions.cjs +39 -39
- package/dist/config/actions.cjs.map +1 -1
- package/dist/config/actions.d.ts +9 -9
- package/dist/config/actions.d.ts.map +1 -1
- package/dist/config/actions.js +39 -39
- package/dist/config/actions.js.map +1 -1
- package/dist/config/actions_kinds.d.ts +30 -30
- package/dist/config/actions_kinds.d.ts.map +1 -1
- package/dist/config/index.d.ts +6 -6
- package/dist/config/model.d.ts +28 -28
- package/dist/config/model_meta.d.ts +1 -1
- package/dist/config/type_engine.d.ts +3 -3
- package/dist/config/type_util.d.ts +2 -2
- package/dist/env_value.cjs +1 -1
- package/dist/env_value.cjs.map +1 -1
- package/dist/env_value.js +1 -1
- package/dist/env_value.js.map +1 -1
- package/dist/filters/converter.cjs +36 -32
- package/dist/filters/converter.cjs.map +1 -1
- package/dist/filters/converter.d.ts +2 -2
- package/dist/filters/converter.d.ts.map +1 -1
- package/dist/filters/converter.js +36 -32
- package/dist/filters/converter.js.map +1 -1
- package/dist/filters/index.d.ts +2 -2
- package/dist/filters/types.d.ts +33 -33
- package/dist/filters/types.d.ts.map +1 -1
- package/dist/index.d.ts +24 -24
- package/dist/internal.cjs +7 -7
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.ts +4 -4
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +7 -7
- package/dist/internal.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/pframe.cjs +1 -1
- package/dist/pframe.cjs.map +1 -1
- package/dist/pframe.d.ts +1 -1
- package/dist/pframe.js +1 -1
- package/dist/pframe.js.map +1 -1
- package/dist/pframe_utils/columns.cjs +23 -15
- package/dist/pframe_utils/columns.cjs.map +1 -1
- package/dist/pframe_utils/columns.d.ts +3 -3
- package/dist/pframe_utils/columns.d.ts.map +1 -1
- package/dist/pframe_utils/columns.js +23 -15
- package/dist/pframe_utils/columns.js.map +1 -1
- package/dist/pframe_utils/index.cjs +25 -25
- package/dist/pframe_utils/index.cjs.map +1 -1
- package/dist/pframe_utils/index.d.ts +3 -3
- package/dist/pframe_utils/index.d.ts.map +1 -1
- package/dist/pframe_utils/index.js +25 -25
- package/dist/pframe_utils/index.js.map +1 -1
- package/dist/platforma.d.ts +7 -7
- package/dist/platforma.d.ts.map +1 -1
- package/dist/raw_globals.cjs +4 -1
- package/dist/raw_globals.cjs.map +1 -1
- package/dist/raw_globals.d.ts +2 -2
- package/dist/raw_globals.d.ts.map +1 -1
- package/dist/raw_globals.js +4 -1
- package/dist/raw_globals.js.map +1 -1
- package/dist/ref_util.cjs +4 -4
- package/dist/ref_util.cjs.map +1 -1
- package/dist/ref_util.d.ts +1 -1
- package/dist/ref_util.js +4 -4
- package/dist/ref_util.js.map +1 -1
- package/dist/render/accessor.cjs +24 -24
- package/dist/render/accessor.cjs.map +1 -1
- package/dist/render/accessor.d.ts +10 -10
- package/dist/render/accessor.d.ts.map +1 -1
- package/dist/render/accessor.js +24 -24
- package/dist/render/accessor.js.map +1 -1
- package/dist/render/api.cjs +23 -23
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +11 -11
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +23 -23
- package/dist/render/api.js.map +1 -1
- package/dist/render/future.cjs.map +1 -1
- package/dist/render/future.d.ts +1 -1
- package/dist/render/future.js.map +1 -1
- package/dist/render/index.d.ts +6 -6
- package/dist/render/internal.cjs +4 -4
- package/dist/render/internal.cjs.map +1 -1
- package/dist/render/internal.d.ts +7 -7
- package/dist/render/internal.d.ts.map +1 -1
- package/dist/render/internal.js +4 -4
- package/dist/render/internal.js.map +1 -1
- package/dist/render/traversal_ops.d.ts +1 -1
- package/dist/render/util/axis_filtering.cjs +48 -44
- package/dist/render/util/axis_filtering.cjs.map +1 -1
- package/dist/render/util/axis_filtering.d.ts +2 -2
- package/dist/render/util/axis_filtering.js +48 -44
- package/dist/render/util/axis_filtering.js.map +1 -1
- package/dist/render/util/column_collection.cjs +42 -35
- package/dist/render/util/column_collection.cjs.map +1 -1
- package/dist/render/util/column_collection.d.ts +4 -4
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/column_collection.js +42 -35
- package/dist/render/util/column_collection.js.map +1 -1
- package/dist/render/util/index.d.ts +4 -4
- package/dist/render/util/label.cjs +15 -21
- package/dist/render/util/label.cjs.map +1 -1
- package/dist/render/util/label.d.ts +2 -2
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/render/util/label.js +15 -21
- package/dist/render/util/label.js.map +1 -1
- package/dist/render/util/pcolumn_data.cjs +56 -54
- package/dist/render/util/pcolumn_data.cjs.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +5 -5
- package/dist/render/util/pcolumn_data.d.ts.map +1 -1
- package/dist/render/util/pcolumn_data.js +56 -54
- package/dist/render/util/pcolumn_data.js.map +1 -1
- package/dist/render/util/pframe_upgraders.cjs +6 -6
- package/dist/render/util/pframe_upgraders.cjs.map +1 -1
- package/dist/render/util/pframe_upgraders.d.ts +1 -1
- package/dist/render/util/pframe_upgraders.d.ts.map +1 -1
- package/dist/render/util/pframe_upgraders.js +6 -6
- package/dist/render/util/pframe_upgraders.js.map +1 -1
- package/dist/render/util/split_selectors.d.ts +1 -1
- package/dist/render/util/split_selectors.d.ts.map +1 -1
- package/dist/sdk_info.cjs.map +1 -1
- package/dist/sdk_info.js.map +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +24 -22
- package/src/annotations/converter.test.ts +98 -101
- package/src/annotations/converter.ts +21 -17
- package/src/annotations/index.ts +2 -2
- package/src/annotations/types.ts +4 -4
- package/src/bconfig/index.ts +5 -5
- package/src/bconfig/lambdas.ts +10 -12
- package/src/bconfig/normalization.ts +5 -5
- package/src/bconfig/types.ts +3 -5
- package/src/bconfig/util.ts +3 -3
- package/src/bconfig/v3.ts +3 -3
- package/src/block_api_v1.ts +7 -3
- package/src/block_api_v2.ts +7 -3
- package/src/block_api_v3.ts +3 -3
- package/src/block_migrations.test.ts +66 -67
- package/src/block_migrations.ts +16 -16
- package/src/block_model.ts +76 -140
- package/src/block_state_patch.ts +2 -2
- package/src/block_state_util.ts +4 -4
- package/src/block_storage.test.ts +106 -99
- package/src/block_storage.ts +22 -25
- package/src/block_storage_vm.ts +41 -35
- package/src/builder.ts +107 -95
- package/src/components/PFrameForGraphs.test.ts +261 -255
- package/src/components/PFrameForGraphs.ts +35 -22
- package/src/components/PlAnnotations/filter.ts +21 -15
- package/src/components/PlAnnotations/filters_ui.test.ts +230 -73
- package/src/components/PlAnnotations/filters_ui.ts +138 -105
- package/src/components/PlAnnotations/index.ts +2 -2
- package/src/components/PlAnnotations/types.ts +2 -2
- package/src/components/PlDataTable.ts +177 -164
- package/src/components/PlMultiSequenceAlignment.ts +11 -18
- package/src/components/PlSelectionModel.ts +1 -1
- package/src/components/index.ts +5 -5
- package/src/config/actions.ts +64 -59
- package/src/config/actions_kinds.ts +38 -34
- package/src/config/index.ts +6 -6
- package/src/config/model.ts +28 -28
- package/src/config/model_meta.ts +1 -1
- package/src/config/type_engine.ts +3 -3
- package/src/config/type_util.ts +2 -2
- package/src/env_value.ts +2 -2
- package/src/filters/converter.test.ts +185 -144
- package/src/filters/converter.ts +47 -35
- package/src/filters/index.ts +2 -2
- package/src/filters/types.ts +44 -39
- package/src/global.d.ts +1 -1
- package/src/index.ts +24 -24
- package/src/internal.ts +27 -17
- package/src/pframe.ts +3 -3
- package/src/pframe_utils/columns.ts +81 -31
- package/src/pframe_utils/index.ts +65 -43
- package/src/platforma.ts +44 -21
- package/src/raw_globals.ts +13 -7
- package/src/ref_util.ts +6 -6
- package/src/render/accessor.ts +43 -44
- package/src/render/api.ts +102 -78
- package/src/render/future.ts +2 -2
- package/src/render/index.ts +6 -6
- package/src/render/internal.ts +11 -12
- package/src/render/traversal_ops.ts +1 -1
- package/src/render/util/axis_filtering.ts +67 -52
- package/src/render/util/column_collection.ts +171 -91
- package/src/render/util/index.ts +4 -4
- package/src/render/util/label.test.ts +139 -139
- package/src/render/util/label.ts +42 -33
- package/src/render/util/pcolumn_data.ts +111 -75
- package/src/render/util/pframe_upgraders.ts +24 -13
- package/src/render/util/split_selectors.ts +6 -1
- package/src/sdk_info.ts +1 -1
- package/src/typing.test.ts +56 -56
- package/src/version.ts +1 -1
package/src/filters/converter.ts
CHANGED
|
@@ -1,127 +1,139 @@
|
|
|
1
|
-
import { assertNever } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { assertNever } from "@milaboratories/pl-model-common";
|
|
2
|
+
import {
|
|
3
|
+
and,
|
|
4
|
+
col,
|
|
5
|
+
lit,
|
|
6
|
+
or,
|
|
7
|
+
rank,
|
|
8
|
+
type Expression,
|
|
9
|
+
type ExpressionImpl,
|
|
10
|
+
} from "@milaboratories/ptabler-expression-js";
|
|
11
|
+
import type { FilterSpec } from "../filters";
|
|
4
12
|
|
|
5
13
|
export function convertFilterUiToExpressionImpl(value: FilterSpec): ExpressionImpl {
|
|
6
|
-
if (value.type ===
|
|
7
|
-
const expressions = value.filters
|
|
14
|
+
if (value.type === "or") {
|
|
15
|
+
const expressions = value.filters
|
|
16
|
+
.filter((f) => f.type !== undefined)
|
|
17
|
+
.map(convertFilterUiToExpressionImpl);
|
|
8
18
|
if (expressions.length === 0) {
|
|
9
|
-
throw new Error(
|
|
19
|
+
throw new Error("OR filter requires at least one operand");
|
|
10
20
|
}
|
|
11
21
|
return or(...expressions);
|
|
12
22
|
}
|
|
13
23
|
|
|
14
|
-
if (value.type ===
|
|
15
|
-
const expressions = value.filters
|
|
24
|
+
if (value.type === "and") {
|
|
25
|
+
const expressions = value.filters
|
|
26
|
+
.filter((f) => f.type !== undefined)
|
|
27
|
+
.map(convertFilterUiToExpressionImpl);
|
|
16
28
|
if (expressions.length === 0) {
|
|
17
|
-
throw new Error(
|
|
29
|
+
throw new Error("AND filter requires at least one operand");
|
|
18
30
|
}
|
|
19
31
|
return and(...expressions);
|
|
20
32
|
}
|
|
21
33
|
|
|
22
|
-
if (value.type ===
|
|
34
|
+
if (value.type === "not") {
|
|
23
35
|
return convertFilterUiToExpressionImpl(value.filter).not();
|
|
24
36
|
}
|
|
25
37
|
|
|
26
|
-
if (value.type ===
|
|
38
|
+
if (value.type === "isNA") {
|
|
27
39
|
return col(value.column).isNull();
|
|
28
40
|
}
|
|
29
41
|
|
|
30
|
-
if (value.type ===
|
|
42
|
+
if (value.type === "isNotNA") {
|
|
31
43
|
return col(value.column).isNotNull();
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
if (value.type ===
|
|
46
|
+
if (value.type === "patternEquals") {
|
|
35
47
|
return col(value.column).eq(lit(value.value));
|
|
36
48
|
}
|
|
37
49
|
|
|
38
|
-
if (value.type ===
|
|
50
|
+
if (value.type === "patternNotEquals") {
|
|
39
51
|
return col(value.column).neq(lit(value.value));
|
|
40
52
|
}
|
|
41
53
|
|
|
42
|
-
if (value.type ===
|
|
54
|
+
if (value.type === "patternContainSubsequence") {
|
|
43
55
|
return col(value.column).strContains(value.value, false, true);
|
|
44
56
|
}
|
|
45
57
|
|
|
46
|
-
if (value.type ===
|
|
58
|
+
if (value.type === "patternNotContainSubsequence") {
|
|
47
59
|
return col(value.column).strContains(value.value, false, true).not();
|
|
48
60
|
}
|
|
49
61
|
|
|
50
|
-
if (value.type ===
|
|
62
|
+
if (value.type === "equal") {
|
|
51
63
|
return col(value.column).eq(lit(value.x));
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
if (value.type ===
|
|
66
|
+
if (value.type === "notEqual") {
|
|
55
67
|
return col(value.column).neq(lit(value.x));
|
|
56
68
|
}
|
|
57
69
|
|
|
58
|
-
if (value.type ===
|
|
70
|
+
if (value.type === "lessThan") {
|
|
59
71
|
return col(value.column).lt(lit(value.x));
|
|
60
72
|
}
|
|
61
73
|
|
|
62
|
-
if (value.type ===
|
|
74
|
+
if (value.type === "greaterThan") {
|
|
63
75
|
return col(value.column).gt(lit(value.x));
|
|
64
76
|
}
|
|
65
77
|
|
|
66
|
-
if (value.type ===
|
|
78
|
+
if (value.type === "lessThanOrEqual") {
|
|
67
79
|
return col(value.column).le(lit(value.x));
|
|
68
80
|
}
|
|
69
81
|
|
|
70
|
-
if (value.type ===
|
|
82
|
+
if (value.type === "greaterThanOrEqual") {
|
|
71
83
|
return col(value.column).ge(lit(value.x));
|
|
72
84
|
}
|
|
73
85
|
|
|
74
|
-
if (value.type ===
|
|
86
|
+
if (value.type === "equalToColumn") {
|
|
75
87
|
return col(value.column).eq(col(value.rhs));
|
|
76
88
|
}
|
|
77
89
|
|
|
78
|
-
if (value.type ===
|
|
90
|
+
if (value.type === "greaterThanColumn") {
|
|
79
91
|
if (value.minDiff !== undefined && value.minDiff !== 0) {
|
|
80
92
|
return col(value.column).plus(lit(value.minDiff)).gt(col(value.rhs));
|
|
81
93
|
}
|
|
82
94
|
return col(value.column).gt(col(value.rhs));
|
|
83
95
|
}
|
|
84
96
|
|
|
85
|
-
if (value.type ===
|
|
97
|
+
if (value.type === "lessThanColumn") {
|
|
86
98
|
if (value.minDiff !== undefined && value.minDiff !== 0) {
|
|
87
99
|
return col(value.column).plus(lit(value.minDiff)).lt(col(value.rhs));
|
|
88
100
|
}
|
|
89
101
|
return col(value.column).lt(col(value.rhs));
|
|
90
102
|
}
|
|
91
103
|
|
|
92
|
-
if (value.type ===
|
|
104
|
+
if (value.type === "greaterThanColumnOrEqual") {
|
|
93
105
|
if (value.minDiff !== undefined && value.minDiff !== 0) {
|
|
94
106
|
return col(value.column).plus(lit(value.minDiff)).ge(col(value.rhs));
|
|
95
107
|
}
|
|
96
108
|
return col(value.column).ge(col(value.rhs));
|
|
97
109
|
}
|
|
98
110
|
|
|
99
|
-
if (value.type ===
|
|
111
|
+
if (value.type === "lessThanColumnOrEqual") {
|
|
100
112
|
if (value.minDiff !== undefined && value.minDiff !== 0) {
|
|
101
113
|
return col(value.column).plus(lit(value.minDiff)).le(col(value.rhs));
|
|
102
114
|
}
|
|
103
115
|
return col(value.column).le(col(value.rhs));
|
|
104
116
|
}
|
|
105
117
|
|
|
106
|
-
if (value.type ===
|
|
118
|
+
if (value.type === "topN") {
|
|
107
119
|
return rank(col(value.column), true).over([]).le(lit(value.n));
|
|
108
120
|
}
|
|
109
121
|
|
|
110
|
-
if (value.type ===
|
|
122
|
+
if (value.type === "bottomN") {
|
|
111
123
|
return rank(col(value.column), false).over([]).le(lit(value.n));
|
|
112
124
|
}
|
|
113
125
|
|
|
114
126
|
if (
|
|
115
|
-
value.type ===
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
value.type === "patternMatchesRegularExpression" ||
|
|
128
|
+
value.type === "patternFuzzyContainSubsequence" ||
|
|
129
|
+
value.type === "inSet" ||
|
|
130
|
+
value.type === "notInSet"
|
|
119
131
|
) {
|
|
120
|
-
throw new Error(
|
|
132
|
+
throw new Error("Not implemented filter type: " + value.type);
|
|
121
133
|
}
|
|
122
134
|
|
|
123
135
|
if (value.type === undefined) {
|
|
124
|
-
throw new Error(
|
|
136
|
+
throw new Error("Filter type is undefined, this should not happen");
|
|
125
137
|
}
|
|
126
138
|
|
|
127
139
|
assertNever(value);
|
package/src/filters/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./converter";
|
|
2
|
+
export * from "./types";
|
package/src/filters/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PColumnSpec, SUniversalPColumnId } from
|
|
1
|
+
import type { PColumnSpec, SUniversalPColumnId } from "@milaboratories/pl-model-common";
|
|
2
2
|
|
|
3
|
-
export type SimplifiedPColumnSpec = Pick<PColumnSpec,
|
|
3
|
+
export type SimplifiedPColumnSpec = Pick<PColumnSpec, "valueType" | "annotations">;
|
|
4
4
|
|
|
5
5
|
export type SimplifiedUniversalPColumnEntry = {
|
|
6
6
|
id: SUniversalPColumnId;
|
|
@@ -9,45 +9,50 @@ export type SimplifiedUniversalPColumnEntry = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export type FilterSpecNode<Leaf, CommonNode = {}, CommonLeaf = {}> =
|
|
12
|
-
| CommonLeaf & Leaf
|
|
13
|
-
| CommonNode & { type:
|
|
14
|
-
| CommonNode & { type:
|
|
15
|
-
| CommonNode & { type:
|
|
12
|
+
| (CommonLeaf & Leaf)
|
|
13
|
+
| (CommonNode & { type: "not"; filter: FilterSpecNode<Leaf, CommonNode, CommonLeaf> })
|
|
14
|
+
| (CommonNode & { type: "or"; filters: FilterSpecNode<Leaf, CommonNode, CommonLeaf>[] })
|
|
15
|
+
| (CommonNode & { type: "and"; filters: FilterSpecNode<Leaf, CommonNode, CommonLeaf>[] });
|
|
16
16
|
|
|
17
17
|
export type FilterSpecLeaf<T = SUniversalPColumnId> =
|
|
18
18
|
| { type: undefined }
|
|
19
|
-
| { type:
|
|
20
|
-
| { type:
|
|
21
|
-
|
|
22
|
-
| { type:
|
|
23
|
-
| { type:
|
|
24
|
-
| { type:
|
|
25
|
-
| { type:
|
|
26
|
-
| {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
| { type:
|
|
36
|
-
| { type:
|
|
37
|
-
| { type:
|
|
38
|
-
| { type:
|
|
39
|
-
| { type:
|
|
40
|
-
| { type:
|
|
41
|
-
|
|
42
|
-
| { type:
|
|
43
|
-
| { type:
|
|
44
|
-
| { type:
|
|
45
|
-
| { type:
|
|
46
|
-
| { type:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
19
|
+
| { type: "isNA"; column: T }
|
|
20
|
+
| { type: "isNotNA"; column: T }
|
|
21
|
+
| { type: "patternEquals"; column: T; value: string }
|
|
22
|
+
| { type: "patternNotEquals"; column: T; value: string }
|
|
23
|
+
| { type: "patternContainSubsequence"; column: T; value: string }
|
|
24
|
+
| { type: "patternNotContainSubsequence"; column: T; value: string }
|
|
25
|
+
| { type: "patternMatchesRegularExpression"; column: T; value: string }
|
|
26
|
+
| {
|
|
27
|
+
type: "patternFuzzyContainSubsequence";
|
|
28
|
+
column: T;
|
|
29
|
+
value: string;
|
|
30
|
+
maxEdits?: number;
|
|
31
|
+
substitutionsOnly?: boolean;
|
|
32
|
+
wildcard?: string;
|
|
33
|
+
}
|
|
34
|
+
| { type: "inSet"; column: T; value: string[] }
|
|
35
|
+
| { type: "notInSet"; column: T; value: string[] }
|
|
36
|
+
| { type: "topN"; column: T; n: number }
|
|
37
|
+
| { type: "bottomN"; column: T; n: number }
|
|
38
|
+
| { type: "equal"; column: T; x: number }
|
|
39
|
+
| { type: "notEqual"; column: T; x: number }
|
|
40
|
+
| { type: "lessThan"; column: T; x: number }
|
|
41
|
+
| { type: "greaterThan"; column: T; x: number }
|
|
42
|
+
| { type: "lessThanOrEqual"; column: T; x: number }
|
|
43
|
+
| { type: "greaterThanOrEqual"; column: T; x: number }
|
|
44
|
+
| { type: "equalToColumn"; column: T; rhs: T }
|
|
45
|
+
| { type: "lessThanColumn"; column: T; rhs: T; minDiff?: number }
|
|
46
|
+
| { type: "greaterThanColumn"; column: T; rhs: T; minDiff?: number }
|
|
47
|
+
| { type: "lessThanColumnOrEqual"; column: T; rhs: T; minDiff?: number }
|
|
48
|
+
| { type: "greaterThanColumnOrEqual"; column: T; rhs: T; minDiff?: number };
|
|
49
|
+
|
|
50
|
+
export type FilterSpec<
|
|
51
|
+
Leaf extends FilterSpecLeaf<unknown> = FilterSpecLeaf<SUniversalPColumnId>,
|
|
52
|
+
CommonNode = {},
|
|
53
|
+
CommonLeaf = CommonNode,
|
|
54
|
+
> = FilterSpecNode<Leaf, CommonNode, CommonLeaf>;
|
|
55
|
+
|
|
56
|
+
export type FilterSpecType = Exclude<FilterSpec, { type: undefined }>["type"];
|
|
52
57
|
|
|
53
58
|
export type FilterSpecOfType<T extends FilterSpecType> = Extract<FilterSpec, { type: T }>;
|
package/src/global.d.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export { BlockModelV3 } from
|
|
1
|
+
export * from "./block_state_patch";
|
|
2
|
+
export * from "./block_state_util";
|
|
3
|
+
export * from "./block_storage";
|
|
4
|
+
export * from "./builder";
|
|
5
|
+
export { BlockModelV3 } from "./block_model";
|
|
6
6
|
export {
|
|
7
7
|
DataModel,
|
|
8
8
|
DataModelBuilder,
|
|
@@ -11,25 +11,25 @@ export {
|
|
|
11
11
|
defineDataVersions,
|
|
12
12
|
defaultRecover,
|
|
13
13
|
makeDataVersioned,
|
|
14
|
-
} from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
27
|
-
export * from
|
|
28
|
-
export * from
|
|
14
|
+
} from "./block_migrations";
|
|
15
|
+
export * from "./bconfig";
|
|
16
|
+
export * from "./components";
|
|
17
|
+
export * from "./config";
|
|
18
|
+
export * from "./pframe";
|
|
19
|
+
export * from "./platforma";
|
|
20
|
+
export * from "./ref_util";
|
|
21
|
+
export * from "./render";
|
|
22
|
+
export * from "./sdk_info";
|
|
23
|
+
export * from "./raw_globals";
|
|
24
|
+
export * from "./block_api_v1";
|
|
25
|
+
export * from "./block_api_v2";
|
|
26
|
+
export * from "./filters";
|
|
27
|
+
export * from "./annotations";
|
|
28
|
+
export * from "./pframe_utils";
|
|
29
29
|
|
|
30
30
|
// reexporting everything from SDK model
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
31
|
+
export * from "@milaboratories/pl-model-common";
|
|
32
|
+
export * from "@milaboratories/pl-error-like";
|
|
33
33
|
|
|
34
|
-
export * as JsRenderInternal from
|
|
35
|
-
export { getEnvironmentValue } from
|
|
34
|
+
export * as JsRenderInternal from "./render/internal";
|
|
35
|
+
export { getEnvironmentValue } from "./env_value";
|
package/src/internal.ts
CHANGED
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
import type { OutputWithStatus } from
|
|
2
|
-
import {
|
|
3
|
-
import type { Platforma, PlatformaApiVersion } from
|
|
4
|
-
import type { FutureHandle, GlobalCfgRenderCtx } from
|
|
5
|
-
import type { ConfigRenderLambda, ConfigRenderLambdaFlags } from
|
|
1
|
+
import type { OutputWithStatus } from "@milaboratories/pl-model-common";
|
|
2
|
+
import {} from "./global";
|
|
3
|
+
import type { Platforma, PlatformaApiVersion } from "./platforma";
|
|
4
|
+
import type { FutureHandle, GlobalCfgRenderCtx } from "./render/internal";
|
|
5
|
+
import type { ConfigRenderLambda, ConfigRenderLambdaFlags } from "./bconfig";
|
|
6
6
|
|
|
7
7
|
/** Utility code helping to identify whether the code is running in actual UI environment */
|
|
8
8
|
export function isInUI() {
|
|
9
9
|
return (
|
|
10
|
-
typeof globalThis.getPlatforma !==
|
|
10
|
+
typeof globalThis.getPlatforma !== "undefined" || typeof globalThis.platforma !== "undefined"
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/** Utility code helping to retrieve a platforma instance form the environment */
|
|
15
15
|
export function getPlatformaInstance<
|
|
16
16
|
Args = unknown,
|
|
17
|
-
Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
|
|
17
|
+
Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
|
|
18
|
+
string,
|
|
19
|
+
OutputWithStatus<unknown>
|
|
20
|
+
>,
|
|
18
21
|
UiState = unknown,
|
|
19
22
|
Href extends `/${string}` = `/${string}`,
|
|
20
|
-
>(config?: {
|
|
21
|
-
|
|
23
|
+
>(config?: {
|
|
24
|
+
sdkVersion: string;
|
|
25
|
+
apiVersion: PlatformaApiVersion;
|
|
26
|
+
}): Platforma<Args, Outputs, UiState, Href> {
|
|
27
|
+
if (config && typeof globalThis.getPlatforma === "function")
|
|
22
28
|
return globalThis.getPlatforma(config);
|
|
23
|
-
else if (typeof globalThis.platforma !==
|
|
24
|
-
|
|
29
|
+
else if (typeof globalThis.platforma !== "undefined")
|
|
30
|
+
return globalThis.platforma as Platforma<Args, Outputs, UiState, Href>;
|
|
31
|
+
else throw new Error("Can't get platforma instance.");
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
export function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {
|
|
28
|
-
if (typeof globalThis.cfgRenderCtx !==
|
|
35
|
+
if (typeof globalThis.cfgRenderCtx !== "undefined") return globalThis.cfgRenderCtx;
|
|
29
36
|
else return undefined;
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
export function getCfgRenderCtx(): GlobalCfgRenderCtx {
|
|
33
|
-
if (typeof globalThis.cfgRenderCtx !==
|
|
34
|
-
else throw new Error(
|
|
40
|
+
if (typeof globalThis.cfgRenderCtx !== "undefined") return globalThis.cfgRenderCtx;
|
|
41
|
+
else throw new Error("Not in config rendering context");
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
export function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean {
|
|
@@ -78,9 +85,12 @@ export function createRenderLambda<T = unknown>(opts: CreateLambdaOptions): Conf
|
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
/** Registers a callback and returns a ConfigRenderLambda descriptor. */
|
|
81
|
-
export function createAndRegisterRenderLambda<T = unknown>(
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
export function createAndRegisterRenderLambda<T = unknown>(
|
|
89
|
+
opts: CreateLambdaOptions & {
|
|
90
|
+
lambda: (...args: any[]) => any;
|
|
91
|
+
},
|
|
92
|
+
replace?: boolean,
|
|
93
|
+
): ConfigRenderLambda<T> {
|
|
84
94
|
const { handle, lambda, ...flags } = opts;
|
|
85
95
|
|
|
86
96
|
if (replace) {
|
package/src/pframe.ts
CHANGED
|
@@ -11,8 +11,8 @@ import type {
|
|
|
11
11
|
TableRange,
|
|
12
12
|
UniqueValuesRequest,
|
|
13
13
|
UniqueValuesResponse,
|
|
14
|
-
} from
|
|
15
|
-
import { patchInSetFilters } from
|
|
14
|
+
} from "@milaboratories/pl-model-common";
|
|
15
|
+
import { patchInSetFilters } from "./render/util/pframe_upgraders";
|
|
16
16
|
|
|
17
17
|
export class PFrameImpl implements PFrame {
|
|
18
18
|
constructor(private readonly handle: PFrameHandle) {}
|
|
@@ -48,7 +48,7 @@ export class PFrameImpl implements PFrame {
|
|
|
48
48
|
|
|
49
49
|
private getPlatforma() {
|
|
50
50
|
if (platforma === undefined) {
|
|
51
|
-
throw new Error(
|
|
51
|
+
throw new Error("Platforma instance is not available in the current context.");
|
|
52
52
|
}
|
|
53
53
|
return platforma;
|
|
54
54
|
}
|
|
@@ -1,24 +1,38 @@
|
|
|
1
|
-
import type { PColumn, PColumnSpec, PColumnLazy, PFrameDef } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { PColumn, PColumnSpec, PColumnLazy, PFrameDef } from "@milaboratories/pl-model-common";
|
|
2
|
+
import {
|
|
3
|
+
getNormalizedAxesList,
|
|
4
|
+
getAxisId,
|
|
5
|
+
canonicalizeJson,
|
|
6
|
+
isLinkerColumn,
|
|
7
|
+
matchAxisId,
|
|
8
|
+
isLabelColumn,
|
|
9
|
+
} from "@milaboratories/pl-model-common";
|
|
10
|
+
import type { AxesVault } from "../components";
|
|
11
|
+
import { enrichCompatible, getAvailableWithLinkersAxes } from "../components";
|
|
12
|
+
import type { RenderCtxBase, PColumnDataUniversal } from "../render";
|
|
13
|
+
import { PColumnCollection } from "../render";
|
|
7
14
|
|
|
8
15
|
export function getAllRelatedColumns<A, U>(
|
|
9
|
-
ctx: RenderCtxBase<A, U>,
|
|
16
|
+
ctx: RenderCtxBase<A, U>,
|
|
17
|
+
predicate: (spec: PColumnSpec) => boolean,
|
|
10
18
|
): PFrameDef<PColumn<PColumnDataUniversal> | PColumnLazy<undefined | PColumnDataUniversal>> {
|
|
11
19
|
// if current block doesn't produce own columns then use all columns from result pool
|
|
12
20
|
const columns = new PColumnCollection();
|
|
13
21
|
columns.addColumnProvider(ctx.resultPool);
|
|
14
|
-
const allColumns =
|
|
22
|
+
const allColumns =
|
|
23
|
+
columns.getColumns(predicate, {
|
|
24
|
+
dontWaitAllData: true,
|
|
25
|
+
overrideLabelAnnotation: false,
|
|
26
|
+
}) ?? [];
|
|
15
27
|
|
|
16
|
-
const allAxes: AxesVault = new Map(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
const allAxes: AxesVault = new Map(
|
|
29
|
+
allColumns
|
|
30
|
+
.flatMap((column) => getNormalizedAxesList(column.spec.axesSpec))
|
|
31
|
+
.map((axisSpec) => {
|
|
32
|
+
const axisId = getAxisId(axisSpec);
|
|
33
|
+
return [canonicalizeJson(axisId), axisSpec];
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
22
36
|
|
|
23
37
|
// additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match
|
|
24
38
|
const extendedColumns = enrichCompatible(allAxes, allColumns);
|
|
@@ -26,10 +40,16 @@ export function getAllRelatedColumns<A, U>(
|
|
|
26
40
|
return extendedColumns;
|
|
27
41
|
}
|
|
28
42
|
|
|
29
|
-
export function getRelatedColumns<A, U>(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
export function getRelatedColumns<A, U>(
|
|
44
|
+
ctx: RenderCtxBase<A, U>,
|
|
45
|
+
{
|
|
46
|
+
columns: rootColumns,
|
|
47
|
+
predicate,
|
|
48
|
+
}: {
|
|
49
|
+
columns: PColumn<PColumnDataUniversal>[];
|
|
50
|
+
predicate: (spec: PColumnSpec) => boolean;
|
|
51
|
+
},
|
|
52
|
+
): PFrameDef<PColumn<PColumnDataUniversal> | PColumnLazy<undefined | PColumnDataUniversal>> {
|
|
33
53
|
// if current block has its own columns then take from result pool only compatible with them
|
|
34
54
|
const columns = new PColumnCollection();
|
|
35
55
|
columns.addColumnProvider(ctx.resultPool);
|
|
@@ -48,7 +68,10 @@ export function getRelatedColumns<A, U>(ctx: RenderCtxBase<A, U>, { columns: roo
|
|
|
48
68
|
}
|
|
49
69
|
|
|
50
70
|
// all linker columns always go to pFrame - even it's impossible to use some of them they all are hidden
|
|
51
|
-
const linkerColumns =
|
|
71
|
+
const linkerColumns =
|
|
72
|
+
columns.getColumns((spec) => predicate(spec) && isLinkerColumn(spec), {
|
|
73
|
+
dontWaitAllData: true,
|
|
74
|
+
}) ?? [];
|
|
52
75
|
const availableWithLinkersAxes = getAvailableWithLinkersAxes(linkerColumns, blockAxes);
|
|
53
76
|
|
|
54
77
|
// all possible axes from connected linkers
|
|
@@ -59,10 +82,19 @@ export function getRelatedColumns<A, U>(ctx: RenderCtxBase<A, U>, { columns: roo
|
|
|
59
82
|
|
|
60
83
|
const blockAxesArr = Array.from(blockAxes.values());
|
|
61
84
|
// all compatible with block columns but without label columns
|
|
62
|
-
let compatibleWithoutLabels = (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
85
|
+
let compatibleWithoutLabels = (
|
|
86
|
+
columns.getColumns(
|
|
87
|
+
(spec) =>
|
|
88
|
+
predicate(spec) &&
|
|
89
|
+
spec.axesSpec.some((axisSpec) => {
|
|
90
|
+
const axisId = getAxisId(axisSpec);
|
|
91
|
+
return blockAxesArr.some((selectorAxisSpec) =>
|
|
92
|
+
matchAxisId(getAxisId(selectorAxisSpec), axisId),
|
|
93
|
+
);
|
|
94
|
+
}),
|
|
95
|
+
{ dontWaitAllData: true, overrideLabelAnnotation: false },
|
|
96
|
+
) ?? []
|
|
97
|
+
).filter((column) => !isLabelColumn(column.spec));
|
|
66
98
|
|
|
67
99
|
// extend axes set for label columns request
|
|
68
100
|
for (const c of compatibleWithoutLabels) {
|
|
@@ -74,16 +106,34 @@ export function getRelatedColumns<A, U>(ctx: RenderCtxBase<A, U>, { columns: roo
|
|
|
74
106
|
|
|
75
107
|
const allAxesArr = Array.from(allAxes.values());
|
|
76
108
|
// extend allowed columns - add columns thad doesn't have axes from block, but have all axes in 'allAxes' list (that means all axes from linkers or from 'hanging' of other selected columns)
|
|
77
|
-
compatibleWithoutLabels = (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
109
|
+
compatibleWithoutLabels = (
|
|
110
|
+
columns.getColumns(
|
|
111
|
+
(spec) =>
|
|
112
|
+
predicate(spec) &&
|
|
113
|
+
spec.axesSpec.every((axisSpec) => {
|
|
114
|
+
const axisId = getAxisId(axisSpec);
|
|
115
|
+
return allAxesArr.some((selectorAxisSpec) =>
|
|
116
|
+
matchAxisId(getAxisId(selectorAxisSpec), axisId),
|
|
117
|
+
);
|
|
118
|
+
}),
|
|
119
|
+
{ dontWaitAllData: true, overrideLabelAnnotation: false },
|
|
120
|
+
) ?? []
|
|
121
|
+
).filter((column) => !isLabelColumn(column.spec));
|
|
81
122
|
|
|
82
123
|
// label columns must be compatible with full set of axes - block axes and axes from compatible columns from result pool
|
|
83
|
-
const compatibleLabels = (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
124
|
+
const compatibleLabels = (
|
|
125
|
+
columns.getColumns(
|
|
126
|
+
(spec) =>
|
|
127
|
+
predicate(spec) &&
|
|
128
|
+
spec.axesSpec.some((axisSpec) => {
|
|
129
|
+
const axisId = getAxisId(axisSpec);
|
|
130
|
+
return allAxesArr.some((selectorAxisSpec) =>
|
|
131
|
+
matchAxisId(getAxisId(selectorAxisSpec), axisId),
|
|
132
|
+
);
|
|
133
|
+
}),
|
|
134
|
+
{ dontWaitAllData: true, overrideLabelAnnotation: false },
|
|
135
|
+
) ?? []
|
|
136
|
+
).filter((column) => isLabelColumn(column.spec));
|
|
87
137
|
|
|
88
138
|
const compatible = [...compatibleWithoutLabels, ...compatibleLabels];
|
|
89
139
|
|