@platforma-sdk/model 1.53.10 → 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 +23 -21
- 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
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
PColumn,
|
|
5
5
|
PColumnLazy,
|
|
6
6
|
PColumnValues,
|
|
7
|
-
} from
|
|
7
|
+
} from "@milaboratories/pl-model-common";
|
|
8
8
|
import {
|
|
9
9
|
dataInfoToEntries,
|
|
10
10
|
isDataInfo,
|
|
@@ -14,23 +14,23 @@ import {
|
|
|
14
14
|
type DataInfoEntries,
|
|
15
15
|
type PColumnDataEntry,
|
|
16
16
|
type PColumnKey,
|
|
17
|
-
} from
|
|
18
|
-
import { TreeNodeAccessor } from
|
|
19
|
-
import type { PColumnDataUniversal } from
|
|
17
|
+
} from "@milaboratories/pl-model-common";
|
|
18
|
+
import { TreeNodeAccessor } from "../accessor";
|
|
19
|
+
import type { PColumnDataUniversal } from "../api";
|
|
20
20
|
|
|
21
|
-
const PCD_PREFIX =
|
|
21
|
+
const PCD_PREFIX = "PColumnData/";
|
|
22
22
|
|
|
23
|
-
export const RT_RESOURCE_MAP = PCD_PREFIX +
|
|
24
|
-
export const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX +
|
|
23
|
+
export const RT_RESOURCE_MAP = PCD_PREFIX + "ResourceMap";
|
|
24
|
+
export const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX + "Partitioned/ResourceMap";
|
|
25
25
|
|
|
26
|
-
export const RT_JSON_PARTITIONED = PCD_PREFIX +
|
|
27
|
-
export const RT_BINARY_PARTITIONED = PCD_PREFIX +
|
|
28
|
-
export const RT_PARQUET_PARTITIONED = PCD_PREFIX +
|
|
26
|
+
export const RT_JSON_PARTITIONED = PCD_PREFIX + "JsonPartitioned";
|
|
27
|
+
export const RT_BINARY_PARTITIONED = PCD_PREFIX + "BinaryPartitioned";
|
|
28
|
+
export const RT_PARQUET_PARTITIONED = PCD_PREFIX + "ParquetPartitioned";
|
|
29
29
|
|
|
30
|
-
const PCD_SUP_PREFIX = PCD_PREFIX +
|
|
31
|
-
export const RT_JSON_SUPER_PARTITIONED = PCD_SUP_PREFIX +
|
|
32
|
-
export const RT_BINARY_SUPER_PARTITIONED = PCD_SUP_PREFIX +
|
|
33
|
-
export const RT_PARQUET_SUPER_PARTITIONED = PCD_SUP_PREFIX +
|
|
30
|
+
const PCD_SUP_PREFIX = PCD_PREFIX + "Partitioned/";
|
|
31
|
+
export const RT_JSON_SUPER_PARTITIONED = PCD_SUP_PREFIX + "JsonPartitioned";
|
|
32
|
+
export const RT_BINARY_SUPER_PARTITIONED = PCD_SUP_PREFIX + "BinaryPartitioned";
|
|
33
|
+
export const RT_PARQUET_SUPER_PARTITIONED = PCD_SUP_PREFIX + "ParquetPartitioned";
|
|
34
34
|
|
|
35
35
|
export type PColumnResourceMapEntry<T> = {
|
|
36
36
|
key: PColumnKey;
|
|
@@ -54,7 +54,7 @@ function populateResourceMapData<T>(
|
|
|
54
54
|
case RT_RESOURCE_MAP: {
|
|
55
55
|
let isComplete = acc.getInputsLocked();
|
|
56
56
|
for (const keyStr of acc.listInputFields()) {
|
|
57
|
-
const value = acc.resolve({ field: keyStr, assertFieldType:
|
|
57
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
58
58
|
const key = [...keyPrefix, ...JSON.parse(keyStr)] as PColumnKey;
|
|
59
59
|
const converted = value === undefined ? undefined : resourceParser(value);
|
|
60
60
|
if (converted === undefined) isComplete = false;
|
|
@@ -65,7 +65,7 @@ function populateResourceMapData<T>(
|
|
|
65
65
|
case RT_RESOURCE_MAP_PARTITIONED: {
|
|
66
66
|
let isComplete = acc.getInputsLocked();
|
|
67
67
|
for (const keyStr of acc.listInputFields()) {
|
|
68
|
-
const value = acc.resolve({ field: keyStr, assertFieldType:
|
|
68
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
69
69
|
if (value === undefined) isComplete = false;
|
|
70
70
|
else {
|
|
71
71
|
const key = [...keyPrefix, ...JSON.parse(keyStr)] as PColumnKey;
|
|
@@ -89,12 +89,12 @@ function populateResourceMapData<T>(
|
|
|
89
89
|
export function parseResourceMap<T>(
|
|
90
90
|
acc: TreeNodeAccessor | undefined,
|
|
91
91
|
resourceParser: (acc: TreeNodeAccessor) => T | undefined,
|
|
92
|
-
addEntriesWithNoData: false
|
|
92
|
+
addEntriesWithNoData: false,
|
|
93
93
|
): PColumnResourceMapData<NonNullable<T>>;
|
|
94
94
|
export function parseResourceMap<T>(
|
|
95
95
|
acc: TreeNodeAccessor | undefined,
|
|
96
96
|
resourceParser: (acc: TreeNodeAccessor) => T | undefined,
|
|
97
|
-
addEntriesWithNoData: true
|
|
97
|
+
addEntriesWithNoData: true,
|
|
98
98
|
): PColumnResourceMapData<T | undefined>;
|
|
99
99
|
export function parseResourceMap<T>(
|
|
100
100
|
acc: TreeNodeAccessor | undefined,
|
|
@@ -113,11 +113,11 @@ export type PColumnKeyList = {
|
|
|
113
113
|
keyLength: number;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
const removeIndexSuffix = (keyStr: string): { baseKey: string; type:
|
|
117
|
-
if (keyStr.endsWith(
|
|
118
|
-
return { baseKey: keyStr.substring(0, keyStr.length - 6), type:
|
|
119
|
-
} else if (keyStr.endsWith(
|
|
120
|
-
return { baseKey: keyStr.substring(0, keyStr.length - 7), type:
|
|
116
|
+
const removeIndexSuffix = (keyStr: string): { baseKey: string; type: "index" | "values" } => {
|
|
117
|
+
if (keyStr.endsWith(".index")) {
|
|
118
|
+
return { baseKey: keyStr.substring(0, keyStr.length - 6), type: "index" };
|
|
119
|
+
} else if (keyStr.endsWith(".values")) {
|
|
120
|
+
return { baseKey: keyStr.substring(0, keyStr.length - 7), type: "values" };
|
|
121
121
|
} else {
|
|
122
122
|
throw new Error(`key must ends on .index/.values for binary p-column, got: ${keyStr}`);
|
|
123
123
|
}
|
|
@@ -138,23 +138,23 @@ export function getPartitionKeysList(
|
|
|
138
138
|
// @TODO validate meta shape
|
|
139
139
|
switch (rt) {
|
|
140
140
|
case RT_RESOURCE_MAP:
|
|
141
|
-
keyLength = meta[
|
|
141
|
+
keyLength = meta["keyLength"];
|
|
142
142
|
break;
|
|
143
143
|
|
|
144
144
|
case RT_RESOURCE_MAP_PARTITIONED:
|
|
145
|
-
keyLength = meta[
|
|
145
|
+
keyLength = meta["partitionKeyLength"] + meta["keyLength"];
|
|
146
146
|
break;
|
|
147
147
|
|
|
148
148
|
case RT_JSON_PARTITIONED:
|
|
149
149
|
case RT_BINARY_PARTITIONED:
|
|
150
150
|
case RT_PARQUET_PARTITIONED:
|
|
151
|
-
keyLength = meta[
|
|
151
|
+
keyLength = meta["partitionKeyLength"];
|
|
152
152
|
break;
|
|
153
153
|
|
|
154
154
|
case RT_BINARY_SUPER_PARTITIONED:
|
|
155
155
|
case RT_JSON_SUPER_PARTITIONED:
|
|
156
156
|
case RT_PARQUET_SUPER_PARTITIONED:
|
|
157
|
-
keyLength = meta[
|
|
157
|
+
keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
|
|
158
158
|
break;
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -180,7 +180,7 @@ export function getPartitionKeysList(
|
|
|
180
180
|
for (const supKeyStr of acc.listInputFields()) {
|
|
181
181
|
const keyPrefix = [...JSON.parse(supKeyStr)] as PColumnKey;
|
|
182
182
|
|
|
183
|
-
const value = acc.resolve({ field: supKeyStr, assertFieldType:
|
|
183
|
+
const value = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
184
184
|
if (value !== undefined) {
|
|
185
185
|
for (let keyStr of value.listInputFields()) {
|
|
186
186
|
if (rt === RT_BINARY_SUPER_PARTITIONED) {
|
|
@@ -197,8 +197,14 @@ export function getPartitionKeysList(
|
|
|
197
197
|
return { data, keyLength };
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
function getUniquePartitionKeysForDataEntries(
|
|
201
|
-
|
|
200
|
+
function getUniquePartitionKeysForDataEntries(
|
|
201
|
+
list: DataInfoEntries<unknown>,
|
|
202
|
+
): (string | number)[][] {
|
|
203
|
+
if (
|
|
204
|
+
list.type !== "JsonPartitioned" &&
|
|
205
|
+
list.type !== "BinaryPartitioned" &&
|
|
206
|
+
list.type !== "ParquetPartitioned"
|
|
207
|
+
)
|
|
202
208
|
throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${list.type}`);
|
|
203
209
|
|
|
204
210
|
const { parts, partitionKeyLength } = list;
|
|
@@ -227,14 +233,15 @@ function getUniquePartitionKeysForDataEntries(list: DataInfoEntries<unknown>): (
|
|
|
227
233
|
|
|
228
234
|
/** Returns an array of unique partition keys for each column: the i-th element in the resulting 2d array contains all unique values of i-th partition axis. */
|
|
229
235
|
export function getUniquePartitionKeys(acc: DataInfoEntries<unknown>): (string | number)[][];
|
|
230
|
-
export function getUniquePartitionKeys(
|
|
236
|
+
export function getUniquePartitionKeys(
|
|
237
|
+
acc: DataInfoEntries<unknown> | TreeNodeAccessor | undefined,
|
|
238
|
+
): (string | number)[][] | undefined;
|
|
231
239
|
export function getUniquePartitionKeys(
|
|
232
240
|
acc: TreeNodeAccessor | DataInfoEntries<unknown> | undefined,
|
|
233
241
|
): (string | number)[][] | undefined {
|
|
234
242
|
if (acc === undefined) return undefined;
|
|
235
243
|
|
|
236
|
-
if (isDataInfoEntries(acc))
|
|
237
|
-
return getUniquePartitionKeysForDataEntries(acc);
|
|
244
|
+
if (isDataInfoEntries(acc)) return getUniquePartitionKeysForDataEntries(acc);
|
|
238
245
|
|
|
239
246
|
const list = getPartitionKeysList(acc);
|
|
240
247
|
if (!list) return undefined;
|
|
@@ -249,7 +256,7 @@ export function getUniquePartitionKeys(
|
|
|
249
256
|
|
|
250
257
|
for (const l of data) {
|
|
251
258
|
if (l.length !== keyLength) {
|
|
252
|
-
throw new Error(
|
|
259
|
+
throw new Error("key length does not match partition length");
|
|
253
260
|
}
|
|
254
261
|
for (let i = 0; i < keyLength; ++i) {
|
|
255
262
|
result[i].add(l[i]);
|
|
@@ -280,10 +287,12 @@ export function parsePColumnData(
|
|
|
280
287
|
const meta = acc.getDataAsJson<Record<string, number>>();
|
|
281
288
|
|
|
282
289
|
// Prevent recursive super-partitioned resources
|
|
283
|
-
if (
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
290
|
+
if (
|
|
291
|
+
keyPrefix.length > 0 &&
|
|
292
|
+
(resourceType === RT_JSON_SUPER_PARTITIONED ||
|
|
293
|
+
resourceType === RT_BINARY_SUPER_PARTITIONED ||
|
|
294
|
+
resourceType === RT_PARQUET_SUPER_PARTITIONED)
|
|
295
|
+
) {
|
|
287
296
|
throw new Error(`Unexpected nested super-partitioned resource: ${resourceType}`);
|
|
288
297
|
}
|
|
289
298
|
|
|
@@ -293,13 +302,13 @@ export function parsePColumnData(
|
|
|
293
302
|
throw new Error(`Only data columns are supported, got: ${resourceType}`);
|
|
294
303
|
|
|
295
304
|
case RT_JSON_PARTITIONED: {
|
|
296
|
-
if (typeof meta?.partitionKeyLength !==
|
|
305
|
+
if (typeof meta?.partitionKeyLength !== "number") {
|
|
297
306
|
throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
298
307
|
}
|
|
299
308
|
|
|
300
309
|
const parts: PColumnDataEntry<TreeNodeAccessor>[] = [];
|
|
301
310
|
for (const keyStr of acc.listInputFields()) {
|
|
302
|
-
const value = acc.resolve({ field: keyStr, assertFieldType:
|
|
311
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
303
312
|
if (value === undefined) return undefined;
|
|
304
313
|
|
|
305
314
|
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
@@ -307,14 +316,14 @@ export function parsePColumnData(
|
|
|
307
316
|
}
|
|
308
317
|
|
|
309
318
|
return {
|
|
310
|
-
type:
|
|
319
|
+
type: "JsonPartitioned",
|
|
311
320
|
partitionKeyLength: meta.partitionKeyLength,
|
|
312
321
|
parts,
|
|
313
322
|
};
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
case RT_BINARY_PARTITIONED: {
|
|
317
|
-
if (typeof meta?.partitionKeyLength !==
|
|
326
|
+
if (typeof meta?.partitionKeyLength !== "number") {
|
|
318
327
|
throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
319
328
|
}
|
|
320
329
|
|
|
@@ -325,7 +334,7 @@ export function parsePColumnData(
|
|
|
325
334
|
for (const keyStr of acc.listInputFields()) {
|
|
326
335
|
const suffix = removeIndexSuffix(keyStr);
|
|
327
336
|
|
|
328
|
-
const value = acc.resolve({ field: keyStr, assertFieldType:
|
|
337
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
329
338
|
if (value === undefined) return undefined;
|
|
330
339
|
|
|
331
340
|
let entry = baseKeys.get(suffix.baseKey);
|
|
@@ -334,7 +343,7 @@ export function parsePColumnData(
|
|
|
334
343
|
baseKeys.set(suffix.baseKey, entry);
|
|
335
344
|
}
|
|
336
345
|
|
|
337
|
-
if (suffix.type ===
|
|
346
|
+
if (suffix.type === "index") {
|
|
338
347
|
entry.index = value;
|
|
339
348
|
} else {
|
|
340
349
|
entry.values = value;
|
|
@@ -356,20 +365,20 @@ export function parsePColumnData(
|
|
|
356
365
|
}
|
|
357
366
|
|
|
358
367
|
return {
|
|
359
|
-
type:
|
|
368
|
+
type: "BinaryPartitioned",
|
|
360
369
|
partitionKeyLength: meta.partitionKeyLength,
|
|
361
370
|
parts,
|
|
362
371
|
};
|
|
363
372
|
}
|
|
364
373
|
|
|
365
374
|
case RT_PARQUET_PARTITIONED: {
|
|
366
|
-
if (typeof meta?.partitionKeyLength !==
|
|
375
|
+
if (typeof meta?.partitionKeyLength !== "number") {
|
|
367
376
|
throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
368
377
|
}
|
|
369
378
|
|
|
370
379
|
const parts: PColumnDataEntry<TreeNodeAccessor>[] = [];
|
|
371
380
|
for (const keyStr of acc.listInputFields()) {
|
|
372
|
-
const value = acc.resolve({ field: keyStr, assertFieldType:
|
|
381
|
+
const value = acc.resolve({ field: keyStr, assertFieldType: "Input" });
|
|
373
382
|
if (value === undefined) return undefined;
|
|
374
383
|
|
|
375
384
|
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
@@ -377,16 +386,20 @@ export function parsePColumnData(
|
|
|
377
386
|
}
|
|
378
387
|
|
|
379
388
|
return {
|
|
380
|
-
type:
|
|
389
|
+
type: "ParquetPartitioned",
|
|
381
390
|
partitionKeyLength: meta.partitionKeyLength,
|
|
382
391
|
parts,
|
|
383
392
|
};
|
|
384
393
|
}
|
|
385
394
|
|
|
386
395
|
case RT_JSON_SUPER_PARTITIONED: {
|
|
387
|
-
if (
|
|
388
|
-
|
|
389
|
-
|
|
396
|
+
if (
|
|
397
|
+
typeof meta?.superPartitionKeyLength !== "number" ||
|
|
398
|
+
typeof meta?.partitionKeyLength !== "number"
|
|
399
|
+
) {
|
|
400
|
+
throw new Error(
|
|
401
|
+
`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`,
|
|
402
|
+
);
|
|
390
403
|
}
|
|
391
404
|
|
|
392
405
|
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
@@ -394,35 +407,41 @@ export function parsePColumnData(
|
|
|
394
407
|
|
|
395
408
|
// Process all super partitions
|
|
396
409
|
for (const supKeyStr of acc.listInputFields()) {
|
|
397
|
-
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType:
|
|
410
|
+
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
398
411
|
if (superPartition === undefined) return undefined;
|
|
399
412
|
|
|
400
413
|
// Validate inner type
|
|
401
414
|
if (superPartition.resourceType.name !== RT_JSON_PARTITIONED) {
|
|
402
|
-
throw new Error(
|
|
415
|
+
throw new Error(
|
|
416
|
+
`Expected ${RT_JSON_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`,
|
|
417
|
+
);
|
|
403
418
|
}
|
|
404
419
|
|
|
405
420
|
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr) as PColumnKey);
|
|
406
421
|
|
|
407
422
|
if (innerResult === undefined) return undefined;
|
|
408
423
|
|
|
409
|
-
if (innerResult.type !==
|
|
424
|
+
if (innerResult.type !== "JsonPartitioned")
|
|
410
425
|
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
411
426
|
|
|
412
427
|
parts.push(...innerResult.parts);
|
|
413
428
|
}
|
|
414
429
|
|
|
415
430
|
return {
|
|
416
|
-
type:
|
|
431
|
+
type: "JsonPartitioned",
|
|
417
432
|
partitionKeyLength: totalKeyLength,
|
|
418
433
|
parts,
|
|
419
434
|
};
|
|
420
435
|
}
|
|
421
436
|
|
|
422
437
|
case RT_BINARY_SUPER_PARTITIONED: {
|
|
423
|
-
if (
|
|
424
|
-
|
|
425
|
-
|
|
438
|
+
if (
|
|
439
|
+
typeof meta?.superPartitionKeyLength !== "number" ||
|
|
440
|
+
typeof meta?.partitionKeyLength !== "number"
|
|
441
|
+
) {
|
|
442
|
+
throw new Error(
|
|
443
|
+
`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`,
|
|
444
|
+
);
|
|
426
445
|
}
|
|
427
446
|
|
|
428
447
|
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
@@ -430,35 +449,41 @@ export function parsePColumnData(
|
|
|
430
449
|
|
|
431
450
|
// Process all super partitions
|
|
432
451
|
for (const supKeyStr of acc.listInputFields()) {
|
|
433
|
-
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType:
|
|
452
|
+
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
434
453
|
if (superPartition === undefined) return undefined;
|
|
435
454
|
|
|
436
455
|
// Validate inner type
|
|
437
456
|
if (superPartition.resourceType.name !== RT_BINARY_PARTITIONED) {
|
|
438
|
-
throw new Error(
|
|
457
|
+
throw new Error(
|
|
458
|
+
`Expected ${RT_BINARY_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`,
|
|
459
|
+
);
|
|
439
460
|
}
|
|
440
461
|
|
|
441
462
|
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr) as PColumnKey);
|
|
442
463
|
|
|
443
464
|
if (innerResult === undefined) return undefined;
|
|
444
465
|
|
|
445
|
-
if (innerResult.type !==
|
|
466
|
+
if (innerResult.type !== "BinaryPartitioned")
|
|
446
467
|
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
447
468
|
|
|
448
469
|
parts.push(...innerResult.parts);
|
|
449
470
|
}
|
|
450
471
|
|
|
451
472
|
return {
|
|
452
|
-
type:
|
|
473
|
+
type: "BinaryPartitioned",
|
|
453
474
|
partitionKeyLength: totalKeyLength,
|
|
454
475
|
parts,
|
|
455
476
|
};
|
|
456
477
|
}
|
|
457
478
|
|
|
458
479
|
case RT_PARQUET_SUPER_PARTITIONED: {
|
|
459
|
-
if (
|
|
460
|
-
|
|
461
|
-
|
|
480
|
+
if (
|
|
481
|
+
typeof meta?.superPartitionKeyLength !== "number" ||
|
|
482
|
+
typeof meta?.partitionKeyLength !== "number"
|
|
483
|
+
) {
|
|
484
|
+
throw new Error(
|
|
485
|
+
`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`,
|
|
486
|
+
);
|
|
462
487
|
}
|
|
463
488
|
|
|
464
489
|
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
@@ -466,26 +491,28 @@ export function parsePColumnData(
|
|
|
466
491
|
|
|
467
492
|
// Process all super partitions
|
|
468
493
|
for (const supKeyStr of acc.listInputFields()) {
|
|
469
|
-
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType:
|
|
494
|
+
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
470
495
|
if (superPartition === undefined) return undefined;
|
|
471
496
|
|
|
472
497
|
// Validate inner type
|
|
473
498
|
if (superPartition.resourceType.name !== RT_PARQUET_PARTITIONED) {
|
|
474
|
-
throw new Error(
|
|
499
|
+
throw new Error(
|
|
500
|
+
`Expected ${RT_PARQUET_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`,
|
|
501
|
+
);
|
|
475
502
|
}
|
|
476
503
|
|
|
477
504
|
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr) as PColumnKey);
|
|
478
505
|
|
|
479
506
|
if (innerResult === undefined) return undefined;
|
|
480
507
|
|
|
481
|
-
if (innerResult.type !==
|
|
508
|
+
if (innerResult.type !== "ParquetPartitioned")
|
|
482
509
|
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
483
510
|
|
|
484
511
|
parts.push(...innerResult.parts);
|
|
485
512
|
}
|
|
486
513
|
|
|
487
514
|
return {
|
|
488
|
-
type:
|
|
515
|
+
type: "ParquetPartitioned",
|
|
489
516
|
partitionKeyLength: totalKeyLength,
|
|
490
517
|
parts,
|
|
491
518
|
};
|
|
@@ -503,7 +530,11 @@ export function parsePColumnData(
|
|
|
503
530
|
* @returns The data in DataInfoEntries format, or undefined if the input was undefined or data is not ready.
|
|
504
531
|
*/
|
|
505
532
|
export function convertOrParsePColumnData(
|
|
506
|
-
acc:
|
|
533
|
+
acc:
|
|
534
|
+
| TreeNodeAccessor
|
|
535
|
+
| DataInfoEntries<TreeNodeAccessor>
|
|
536
|
+
| DataInfo<TreeNodeAccessor>
|
|
537
|
+
| undefined,
|
|
507
538
|
): DataInfoEntries<TreeNodeAccessor> | undefined {
|
|
508
539
|
if (acc === undefined) return undefined;
|
|
509
540
|
|
|
@@ -514,18 +545,21 @@ export function convertOrParsePColumnData(
|
|
|
514
545
|
throw new Error(`Unexpected input type: ${typeof acc}`);
|
|
515
546
|
}
|
|
516
547
|
|
|
517
|
-
export function isPColumnReady(
|
|
548
|
+
export function isPColumnReady(
|
|
549
|
+
c: PColumn<PColumnDataUniversal> | PColumnLazy<undefined | PColumnDataUniversal>,
|
|
550
|
+
): c is PColumn<PColumnDataUniversal> | PColumnLazy<PColumnDataUniversal> {
|
|
518
551
|
const isValues = (d: PColumnDataUniversal): d is PColumnValues => Array.isArray(d);
|
|
519
|
-
const isAccessor = (d: PColumnDataUniversal): d is TreeNodeAccessor =>
|
|
552
|
+
const isAccessor = (d: PColumnDataUniversal): d is TreeNodeAccessor =>
|
|
553
|
+
d instanceof TreeNodeAccessor;
|
|
520
554
|
|
|
521
555
|
let ready = true;
|
|
522
|
-
const data = typeof c.data ===
|
|
556
|
+
const data = typeof c.data === "function" ? c.data() : c.data;
|
|
523
557
|
if (data == null) {
|
|
524
558
|
return false;
|
|
525
559
|
} else if (isAccessor(data)) {
|
|
526
560
|
ready &&= data.getIsReadyOrError();
|
|
527
561
|
} else if (isDataInfo(data)) {
|
|
528
|
-
visitDataInfo(data, (v) => ready &&= v.getIsReadyOrError());
|
|
562
|
+
visitDataInfo(data, (v) => (ready &&= v.getIsReadyOrError()));
|
|
529
563
|
} else if (!isValues(data)) {
|
|
530
564
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
531
565
|
throw Error(`unsupported column data type: ${data satisfies never}`);
|
|
@@ -533,6 +567,8 @@ export function isPColumnReady(c: (PColumn<PColumnDataUniversal> | PColumnLazy<u
|
|
|
533
567
|
return ready;
|
|
534
568
|
}
|
|
535
569
|
|
|
536
|
-
export function allPColumnsReady(
|
|
570
|
+
export function allPColumnsReady(
|
|
571
|
+
columns: (PColumn<PColumnDataUniversal> | PColumnLazy<undefined | PColumnDataUniversal>)[],
|
|
572
|
+
): columns is (PColumn<PColumnDataUniversal> | PColumnLazy<PColumnDataUniversal>)[] {
|
|
537
573
|
return columns.every(isPColumnReady);
|
|
538
574
|
}
|
|
@@ -6,34 +6,42 @@ import {
|
|
|
6
6
|
type SingleValueNotPredicateV2,
|
|
7
7
|
type PTableRecordSingleValueFilterV2,
|
|
8
8
|
type PTableRecordFilter,
|
|
9
|
-
} from
|
|
9
|
+
} from "@milaboratories/pl-model-common";
|
|
10
10
|
|
|
11
|
-
export function patchInSetFilters(
|
|
11
|
+
export function patchInSetFilters(
|
|
12
|
+
filters: PTableRecordSingleValueFilterV2[],
|
|
13
|
+
): PTableRecordFilter[] {
|
|
12
14
|
const inSetToOrEqual = (predicate: SingleValuePredicateV2): SingleValuePredicateV2 => {
|
|
13
|
-
if (predicate.operator !==
|
|
15
|
+
if (predicate.operator !== "InSet") return predicate;
|
|
14
16
|
return {
|
|
15
|
-
operator:
|
|
16
|
-
operands: predicate.references.map(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
operator: "Or",
|
|
18
|
+
operands: predicate.references.map(
|
|
19
|
+
(reference) =>
|
|
20
|
+
({
|
|
21
|
+
operator: "Equal",
|
|
22
|
+
reference,
|
|
23
|
+
}) satisfies SingleValueEqualPredicate,
|
|
24
|
+
),
|
|
20
25
|
} satisfies SingleValueOrPredicateV2;
|
|
21
26
|
};
|
|
22
27
|
|
|
23
|
-
const mapSingleValuePredicate = (
|
|
28
|
+
const mapSingleValuePredicate = (
|
|
29
|
+
filter: SingleValuePredicateV2,
|
|
30
|
+
cb: (predicate: SingleValuePredicateV2) => SingleValuePredicateV2,
|
|
31
|
+
): SingleValuePredicateV2 => {
|
|
24
32
|
const operator = filter.operator;
|
|
25
33
|
switch (operator) {
|
|
26
|
-
case
|
|
34
|
+
case "And":
|
|
27
35
|
return {
|
|
28
36
|
...filter,
|
|
29
37
|
operands: filter.operands.map((operand) => mapSingleValuePredicate(operand, cb)),
|
|
30
38
|
} satisfies SingleValueAndPredicateV2;
|
|
31
|
-
case
|
|
39
|
+
case "Or":
|
|
32
40
|
return {
|
|
33
41
|
...filter,
|
|
34
42
|
operands: filter.operands.map((operand) => mapSingleValuePredicate(operand, cb)),
|
|
35
43
|
} satisfies SingleValueOrPredicateV2;
|
|
36
|
-
case
|
|
44
|
+
case "Not":
|
|
37
45
|
return {
|
|
38
46
|
...filter,
|
|
39
47
|
operand: mapSingleValuePredicate(filter.operand, cb),
|
|
@@ -43,7 +51,10 @@ export function patchInSetFilters(filters: PTableRecordSingleValueFilterV2[]): P
|
|
|
43
51
|
}
|
|
44
52
|
};
|
|
45
53
|
|
|
46
|
-
const mapFilter = (
|
|
54
|
+
const mapFilter = (
|
|
55
|
+
filter: PTableRecordSingleValueFilterV2,
|
|
56
|
+
cb: (predicate: SingleValuePredicateV2) => SingleValuePredicateV2,
|
|
57
|
+
): PTableRecordSingleValueFilterV2 => {
|
|
47
58
|
return {
|
|
48
59
|
...filter,
|
|
49
60
|
predicate: mapSingleValuePredicate(filter.predicate, cb),
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AAxisSelector,
|
|
3
|
+
AnchoredPColumnSelector,
|
|
4
|
+
AxisSelector,
|
|
5
|
+
PColumnSelector,
|
|
6
|
+
} from "@milaboratories/pl-model-common";
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* AAxisSelector with an optional split flag
|
package/src/sdk_info.ts
CHANGED