@milaboratories/pl-model-common 1.25.1 → 1.25.3
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/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/author_marker.d.ts +9 -6
- package/dist/base32_encode.cjs +40 -46
- package/dist/base32_encode.cjs.map +1 -1
- package/dist/base32_encode.js +40 -45
- package/dist/base32_encode.js.map +1 -1
- package/dist/base64.cjs +5 -4
- package/dist/base64.cjs.map +1 -1
- package/dist/base64.d.ts +10 -6
- package/dist/base64.js +5 -3
- package/dist/base64.js.map +1 -1
- package/dist/block_state.d.ts +21 -23
- package/dist/bmodel/block_config.cjs +9 -10
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +53 -72
- package/dist/bmodel/block_config.js +9 -9
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/code.cjs +7 -6
- package/dist/bmodel/code.cjs.map +1 -1
- package/dist/bmodel/code.d.ts +17 -13
- package/dist/bmodel/code.js +6 -4
- package/dist/bmodel/code.js.map +1 -1
- package/dist/bmodel/container.d.ts +46 -44
- package/dist/bmodel/index.cjs +3 -0
- package/dist/bmodel/index.d.ts +5 -6
- package/dist/bmodel/index.js +3 -0
- package/dist/bmodel/normalization.cjs +90 -106
- package/dist/bmodel/normalization.cjs.map +1 -1
- package/dist/bmodel/normalization.d.ts +7 -3
- package/dist/bmodel/normalization.js +90 -105
- package/dist/bmodel/normalization.js.map +1 -1
- package/dist/bmodel/types.d.ts +4 -1
- package/dist/branding.d.ts +5 -5
- package/dist/common_types.d.ts +19 -15
- package/dist/driver_kit.d.ts +25 -17
- package/dist/drivers/ChunkedStreamReader.cjs +168 -203
- package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
- package/dist/drivers/ChunkedStreamReader.d.ts +104 -100
- package/dist/drivers/ChunkedStreamReader.js +168 -202
- package/dist/drivers/ChunkedStreamReader.js.map +1 -1
- package/dist/drivers/blob.cjs +15 -17
- package/dist/drivers/blob.cjs.map +1 -1
- package/dist/drivers/blob.d.ts +35 -35
- package/dist/drivers/blob.js +14 -15
- package/dist/drivers/blob.js.map +1 -1
- package/dist/drivers/index.cjs +18 -0
- package/dist/drivers/index.d.ts +29 -9
- package/dist/drivers/index.js +18 -0
- package/dist/drivers/interfaces.d.ts +17 -14
- package/dist/drivers/log.cjs +4 -3
- package/dist/drivers/log.cjs.map +1 -1
- package/dist/drivers/log.d.ts +52 -49
- package/dist/drivers/log.js +4 -2
- package/dist/drivers/log.js.map +1 -1
- package/dist/drivers/ls.cjs +16 -19
- package/dist/drivers/ls.cjs.map +1 -1
- package/dist/drivers/ls.d.ts +73 -76
- package/dist/drivers/ls.js +16 -17
- package/dist/drivers/ls.js.map +1 -1
- package/dist/drivers/pframe/column_filter.d.ts +19 -15
- package/dist/drivers/pframe/data_info.cjs +201 -252
- package/dist/drivers/pframe/data_info.cjs.map +1 -1
- package/dist/drivers/pframe/data_info.d.ts +84 -109
- package/dist/drivers/pframe/data_info.js +201 -250
- package/dist/drivers/pframe/data_info.js.map +1 -1
- package/dist/drivers/pframe/data_types.cjs +38 -63
- package/dist/drivers/pframe/data_types.cjs.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +91 -93
- package/dist/drivers/pframe/data_types.js +38 -61
- package/dist/drivers/pframe/data_types.js.map +1 -1
- package/dist/drivers/pframe/driver.cjs +7 -0
- package/dist/drivers/pframe/driver.cjs.map +1 -0
- package/dist/drivers/pframe/driver.d.ts +50 -45
- package/dist/drivers/pframe/driver.js +6 -0
- package/dist/drivers/pframe/driver.js.map +1 -0
- package/dist/drivers/pframe/filter_spec.d.ts +127 -123
- package/dist/drivers/pframe/find_columns.d.ts +21 -17
- package/dist/drivers/pframe/index.cjs +15 -0
- package/dist/drivers/pframe/index.d.ts +23 -16
- package/dist/drivers/pframe/index.js +15 -0
- package/dist/drivers/pframe/linker_columns.cjs +184 -238
- package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
- package/dist/drivers/pframe/linker_columns.d.ts +45 -38
- package/dist/drivers/pframe/linker_columns.js +184 -236
- package/dist/drivers/pframe/linker_columns.js.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +26 -21
- package/dist/drivers/pframe/query/index.cjs +1 -0
- package/dist/drivers/pframe/query/index.d.ts +3 -4
- package/dist/drivers/pframe/query/index.js +1 -0
- package/dist/drivers/pframe/query/query_common.d.ts +205 -247
- package/dist/drivers/pframe/query/query_data.d.ts +25 -23
- package/dist/drivers/pframe/query/query_spec.d.ts +30 -29
- package/dist/drivers/pframe/query/utils.cjs +164 -183
- package/dist/drivers/pframe/query/utils.cjs.map +1 -1
- package/dist/drivers/pframe/query/utils.d.ts +13 -12
- package/dist/drivers/pframe/query/utils.js +164 -181
- package/dist/drivers/pframe/query/utils.js.map +1 -1
- package/dist/drivers/pframe/spec/anchored.cjs +178 -216
- package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +53 -49
- package/dist/drivers/pframe/spec/anchored.js +176 -214
- package/dist/drivers/pframe/spec/anchored.js.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs +8 -7
- package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts +20 -17
- package/dist/drivers/pframe/spec/filtered_column.js +8 -6
- package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
- package/dist/drivers/pframe/spec/ids.cjs +16 -14
- package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
- package/dist/drivers/pframe/spec/ids.d.ts +13 -8
- package/dist/drivers/pframe/spec/ids.js +14 -12
- package/dist/drivers/pframe/spec/ids.js.map +1 -1
- package/dist/drivers/pframe/spec/index.cjs +6 -0
- package/dist/drivers/pframe/spec/index.d.ts +6 -7
- package/dist/drivers/pframe/spec/index.js +6 -0
- package/dist/drivers/pframe/spec/native_id.cjs +16 -16
- package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
- package/dist/drivers/pframe/spec/native_id.d.ts +9 -4
- package/dist/drivers/pframe/spec/native_id.js +13 -13
- package/dist/drivers/pframe/spec/native_id.js.map +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs +72 -112
- package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +99 -94
- package/dist/drivers/pframe/spec/selectors.js +72 -110
- package/dist/drivers/pframe/spec/selectors.js.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +282 -324
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +263 -272
- package/dist/drivers/pframe/spec/spec.js +281 -322
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/drivers/pframe/table.d.ts +28 -24
- package/dist/drivers/pframe/table_calculate.cjs +117 -147
- package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
- package/dist/drivers/pframe/table_calculate.d.ts +219 -220
- package/dist/drivers/pframe/table_calculate.js +117 -145
- package/dist/drivers/pframe/table_calculate.js.map +1 -1
- package/dist/drivers/pframe/table_common.cjs +13 -14
- package/dist/drivers/pframe/table_common.cjs.map +1 -1
- package/dist/drivers/pframe/table_common.d.ts +24 -19
- package/dist/drivers/pframe/table_common.js +13 -13
- package/dist/drivers/pframe/table_common.js.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +23 -18
- package/dist/drivers/upload.d.ts +21 -18
- package/dist/drivers/urls.cjs +5 -6
- package/dist/drivers/urls.cjs.map +1 -1
- package/dist/drivers/urls.d.ts +12 -9
- package/dist/drivers/urls.js +5 -5
- package/dist/drivers/urls.js.map +1 -1
- package/dist/errors.cjs +65 -86
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +36 -33
- package/dist/errors.js +65 -85
- package/dist/errors.js.map +1 -1
- package/dist/flags/block_flags.cjs +7 -6
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts +12 -8
- package/dist/flags/block_flags.js +7 -5
- package/dist/flags/block_flags.js.map +1 -1
- package/dist/flags/flag_utils.cjs +69 -108
- package/dist/flags/flag_utils.cjs.map +1 -1
- package/dist/flags/flag_utils.d.ts +40 -42
- package/dist/flags/flag_utils.js +70 -107
- package/dist/flags/flag_utils.js.map +1 -1
- package/dist/flags/type_utils.d.ts +12 -11
- package/dist/httpAuth.cjs +16 -20
- package/dist/httpAuth.cjs.map +1 -1
- package/dist/httpAuth.d.ts +10 -7
- package/dist/httpAuth.js +16 -19
- package/dist/httpAuth.js.map +1 -1
- package/dist/index.cjs +176 -179
- package/dist/index.d.ts +58 -20
- package/dist/index.js +37 -34
- package/dist/json.cjs +10 -8
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts +18 -18
- package/dist/json.js +8 -6
- package/dist/json.js.map +1 -1
- package/dist/navigation.cjs +3 -2
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.ts +18 -21
- package/dist/navigation.js +3 -1
- package/dist/navigation.js.map +1 -1
- package/dist/plid.cjs +16 -20
- package/dist/plid.cjs.map +1 -1
- package/dist/plid.d.ts +11 -7
- package/dist/plid.js +15 -18
- package/dist/plid.js.map +1 -1
- package/dist/pool/entry.d.ts +11 -11
- package/dist/pool/index.d.ts +3 -4
- package/dist/pool/query.cjs +21 -43
- package/dist/pool/query.cjs.map +1 -1
- package/dist/pool/query.d.ts +25 -20
- package/dist/pool/query.js +20 -40
- package/dist/pool/query.js.map +1 -1
- package/dist/pool/spec.cjs +40 -47
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +33 -31
- package/dist/pool/spec.js +40 -45
- package/dist/pool/spec.js.map +1 -1
- package/dist/ref.cjs +51 -71
- package/dist/ref.cjs.map +1 -1
- package/dist/ref.d.ts +36 -33
- package/dist/ref.js +50 -69
- package/dist/ref.js.map +1 -1
- package/dist/utag.d.ts +18 -14
- package/dist/util.cjs +8 -7
- package/dist/util.cjs.map +1 -1
- package/dist/util.d.ts +5 -2
- package/dist/util.js +8 -6
- package/dist/util.js.map +1 -1
- package/dist/value_or_error.cjs +7 -3
- package/dist/value_or_error.cjs.map +1 -1
- package/dist/value_or_error.d.ts +9 -6
- package/dist/value_or_error.js +7 -2
- package/dist/value_or_error.js.map +1 -1
- package/package.json +6 -6
- package/src/flags/block_flags.ts +2 -1
- package/src/flags/flag_utils.ts +0 -22
- package/dist/author_marker.d.ts.map +0 -1
- package/dist/base32_encode.d.ts +0 -8
- package/dist/base32_encode.d.ts.map +0 -1
- package/dist/base64.d.ts.map +0 -1
- package/dist/block_state.d.ts.map +0 -1
- package/dist/bmodel/block_config.d.ts.map +0 -1
- package/dist/bmodel/code.d.ts.map +0 -1
- package/dist/bmodel/container.d.ts.map +0 -1
- package/dist/bmodel/index.d.ts.map +0 -1
- package/dist/bmodel/normalization.d.ts.map +0 -1
- package/dist/bmodel/types.d.ts.map +0 -1
- package/dist/branding.d.ts.map +0 -1
- package/dist/common_types.d.ts.map +0 -1
- package/dist/driver_kit.d.ts.map +0 -1
- package/dist/drivers/ChunkedStreamReader.d.ts.map +0 -1
- package/dist/drivers/blob.d.ts.map +0 -1
- package/dist/drivers/index.d.ts.map +0 -1
- package/dist/drivers/interfaces.d.ts.map +0 -1
- package/dist/drivers/log.d.ts.map +0 -1
- package/dist/drivers/ls.d.ts.map +0 -1
- package/dist/drivers/pframe/column_filter.d.ts.map +0 -1
- package/dist/drivers/pframe/data_info.d.ts.map +0 -1
- package/dist/drivers/pframe/data_types.d.ts.map +0 -1
- package/dist/drivers/pframe/driver.d.ts.map +0 -1
- package/dist/drivers/pframe/filter_spec.d.ts.map +0 -1
- package/dist/drivers/pframe/find_columns.d.ts.map +0 -1
- package/dist/drivers/pframe/index.d.ts.map +0 -1
- package/dist/drivers/pframe/linker_columns.d.ts.map +0 -1
- package/dist/drivers/pframe/pframe.d.ts.map +0 -1
- package/dist/drivers/pframe/query/index.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_common.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_data.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_spec.d.ts.map +0 -1
- package/dist/drivers/pframe/query/utils.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/anchored.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/ids.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/index.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/native_id.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/selectors.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/spec.d.ts.map +0 -1
- package/dist/drivers/pframe/table.d.ts.map +0 -1
- package/dist/drivers/pframe/table_calculate.d.ts.map +0 -1
- package/dist/drivers/pframe/table_common.d.ts.map +0 -1
- package/dist/drivers/pframe/type_util.d.ts +0 -5
- package/dist/drivers/pframe/type_util.d.ts.map +0 -1
- package/dist/drivers/pframe/unique_values.d.ts.map +0 -1
- package/dist/drivers/upload.d.ts.map +0 -1
- package/dist/drivers/urls.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/flags/block_flags.d.ts.map +0 -1
- package/dist/flags/flag_utils.d.ts.map +0 -1
- package/dist/flags/index.d.ts +0 -4
- package/dist/flags/index.d.ts.map +0 -1
- package/dist/flags/type_utils.d.ts.map +0 -1
- package/dist/httpAuth.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json.d.ts.map +0 -1
- package/dist/navigation.d.ts.map +0 -1
- package/dist/plid.d.ts.map +0 -1
- package/dist/pool/entry.d.ts.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/query.d.ts.map +0 -1
- package/dist/pool/spec.d.ts.map +0 -1
- package/dist/ref.d.ts.map +0 -1
- package/dist/utag.d.ts.map +0 -1
- package/dist/util.d.ts.map +0 -1
- package/dist/value_or_error.d.ts.map +0 -1
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let canonicalize = require("canonicalize");
|
|
3
|
+
canonicalize = require_runtime.__toESM(canonicalize);
|
|
4
4
|
|
|
5
|
+
//#region src/drivers/pframe/spec/ids.ts
|
|
5
6
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* Canonically serializes a {@link UniversalPColumnId} to a string.
|
|
8
|
+
* @param id - The column identifier to serialize
|
|
9
|
+
* @returns The canonically serialized string
|
|
10
|
+
*/
|
|
10
11
|
function stringifyColumnId(id) {
|
|
11
|
-
|
|
12
|
+
return (0, canonicalize.default)(id);
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
* Parses a canonically serialized {@link UniversalPColumnId} from a string.
|
|
16
|
+
* @param str - The string to parse
|
|
17
|
+
* @returns The parsed column identifier
|
|
18
|
+
*/
|
|
18
19
|
function parseColumnId(str) {
|
|
19
|
-
|
|
20
|
+
return JSON.parse(str);
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
//#endregion
|
|
22
24
|
exports.parseColumnId = parseColumnId;
|
|
23
25
|
exports.stringifyColumnId = stringifyColumnId;
|
|
24
|
-
//# sourceMappingURL=ids.cjs.map
|
|
26
|
+
//# sourceMappingURL=ids.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.cjs","sources":["../../../../src/drivers/pframe/spec/ids.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport type { AnchoredPColumnId } from \"./selectors\";\nimport type { FilteredPColumnId } from \"./filtered_column\";\nimport canonicalize from \"canonicalize\";\nimport type { PObjectId } from \"../../../pool\";\n/**\n * Universal column identifier optionally anchored and optionally filtered.\n */\nexport type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;\n\n/**\n * Canonically serialized {@link UniversalPColumnId}.\n */\nexport type SUniversalPColumnId = Branded<PObjectId, \"SUniversalPColumnId\", \"__pl_model_brand_2__\">;\n\n/**\n * Canonically serializes a {@link UniversalPColumnId} to a string.\n * @param id - The column identifier to serialize\n * @returns The canonically serialized string\n */\nexport function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId {\n return canonicalize(id)! as SUniversalPColumnId;\n}\n\n/**\n * Parses a canonically serialized {@link UniversalPColumnId} from a string.\n * @param str - The string to parse\n * @returns The parsed column identifier\n */\nexport function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId {\n return JSON.parse(str) as UniversalPColumnId;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"ids.cjs","names":[],"sources":["../../../../src/drivers/pframe/spec/ids.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport type { AnchoredPColumnId } from \"./selectors\";\nimport type { FilteredPColumnId } from \"./filtered_column\";\nimport canonicalize from \"canonicalize\";\nimport type { PObjectId } from \"../../../pool\";\n/**\n * Universal column identifier optionally anchored and optionally filtered.\n */\nexport type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;\n\n/**\n * Canonically serialized {@link UniversalPColumnId}.\n */\nexport type SUniversalPColumnId = Branded<PObjectId, \"SUniversalPColumnId\", \"__pl_model_brand_2__\">;\n\n/**\n * Canonically serializes a {@link UniversalPColumnId} to a string.\n * @param id - The column identifier to serialize\n * @returns The canonically serialized string\n */\nexport function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId {\n return canonicalize(id)! as SUniversalPColumnId;\n}\n\n/**\n * Parses a canonically serialized {@link UniversalPColumnId} from a string.\n * @param str - The string to parse\n * @returns The parsed column identifier\n */\nexport function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId {\n return JSON.parse(str) as UniversalPColumnId;\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAgB,kBAAkB,IAA6C;AAC7E,kCAAoB,GAAG;;;;;;;AAQzB,SAAgB,cAAc,KAA8C;AAC1E,QAAO,KAAK,MAAM,IAAI"}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Branded } from "../../../branding.js";
|
|
2
|
+
import { PObjectId } from "../../../pool/spec.js";
|
|
3
|
+
import "../../../pool/index.js";
|
|
4
|
+
import { AnchoredPColumnId } from "./selectors.js";
|
|
5
|
+
import { FilteredPColumnId } from "./filtered_column.js";
|
|
6
|
+
|
|
7
|
+
//#region src/drivers/pframe/spec/ids.d.ts
|
|
5
8
|
/**
|
|
6
9
|
* Universal column identifier optionally anchored and optionally filtered.
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;
|
|
9
12
|
/**
|
|
10
13
|
* Canonically serialized {@link UniversalPColumnId}.
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
type SUniversalPColumnId = Branded<PObjectId, "SUniversalPColumnId", "__pl_model_brand_2__">;
|
|
13
16
|
/**
|
|
14
17
|
* Canonically serializes a {@link UniversalPColumnId} to a string.
|
|
15
18
|
* @param id - The column identifier to serialize
|
|
16
19
|
* @returns The canonically serialized string
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
declare function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId;
|
|
19
22
|
/**
|
|
20
23
|
* Parses a canonically serialized {@link UniversalPColumnId} from a string.
|
|
21
24
|
* @param str - The string to parse
|
|
22
25
|
* @returns The parsed column identifier
|
|
23
26
|
*/
|
|
24
|
-
|
|
27
|
+
declare function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { SUniversalPColumnId, UniversalPColumnId, parseColumnId, stringifyColumnId };
|
|
25
30
|
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import canonicalize from
|
|
1
|
+
import canonicalize from "canonicalize";
|
|
2
2
|
|
|
3
|
+
//#region src/drivers/pframe/spec/ids.ts
|
|
3
4
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
* Canonically serializes a {@link UniversalPColumnId} to a string.
|
|
6
|
+
* @param id - The column identifier to serialize
|
|
7
|
+
* @returns The canonically serialized string
|
|
8
|
+
*/
|
|
8
9
|
function stringifyColumnId(id) {
|
|
9
|
-
|
|
10
|
+
return canonicalize(id);
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
* Parses a canonically serialized {@link UniversalPColumnId} from a string.
|
|
14
|
+
* @param str - The string to parse
|
|
15
|
+
* @returns The parsed column identifier
|
|
16
|
+
*/
|
|
16
17
|
function parseColumnId(str) {
|
|
17
|
-
|
|
18
|
+
return JSON.parse(str);
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
//#endregion
|
|
20
22
|
export { parseColumnId, stringifyColumnId };
|
|
21
|
-
//# sourceMappingURL=ids.js.map
|
|
23
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sources":["../../../../src/drivers/pframe/spec/ids.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport type { AnchoredPColumnId } from \"./selectors\";\nimport type { FilteredPColumnId } from \"./filtered_column\";\nimport canonicalize from \"canonicalize\";\nimport type { PObjectId } from \"../../../pool\";\n/**\n * Universal column identifier optionally anchored and optionally filtered.\n */\nexport type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;\n\n/**\n * Canonically serialized {@link UniversalPColumnId}.\n */\nexport type SUniversalPColumnId = Branded<PObjectId, \"SUniversalPColumnId\", \"__pl_model_brand_2__\">;\n\n/**\n * Canonically serializes a {@link UniversalPColumnId} to a string.\n * @param id - The column identifier to serialize\n * @returns The canonically serialized string\n */\nexport function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId {\n return canonicalize(id)! as SUniversalPColumnId;\n}\n\n/**\n * Parses a canonically serialized {@link UniversalPColumnId} from a string.\n * @param str - The string to parse\n * @returns The parsed column identifier\n */\nexport function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId {\n return JSON.parse(str) as UniversalPColumnId;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"ids.js","names":[],"sources":["../../../../src/drivers/pframe/spec/ids.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport type { AnchoredPColumnId } from \"./selectors\";\nimport type { FilteredPColumnId } from \"./filtered_column\";\nimport canonicalize from \"canonicalize\";\nimport type { PObjectId } from \"../../../pool\";\n/**\n * Universal column identifier optionally anchored and optionally filtered.\n */\nexport type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;\n\n/**\n * Canonically serialized {@link UniversalPColumnId}.\n */\nexport type SUniversalPColumnId = Branded<PObjectId, \"SUniversalPColumnId\", \"__pl_model_brand_2__\">;\n\n/**\n * Canonically serializes a {@link UniversalPColumnId} to a string.\n * @param id - The column identifier to serialize\n * @returns The canonically serialized string\n */\nexport function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId {\n return canonicalize(id)! as SUniversalPColumnId;\n}\n\n/**\n * Parses a canonically serialized {@link UniversalPColumnId} from a string.\n * @param str - The string to parse\n * @returns The parsed column identifier\n */\nexport function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId {\n return JSON.parse(str) as UniversalPColumnId;\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,kBAAkB,IAA6C;AAC7E,QAAO,aAAa,GAAG;;;;;;;AAQzB,SAAgB,cAAc,KAA8C;AAC1E,QAAO,KAAK,MAAM,IAAI"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const require_spec = require('./spec.cjs');
|
|
2
|
+
const require_ids = require('./ids.cjs');
|
|
3
|
+
const require_anchored = require('./anchored.cjs');
|
|
4
|
+
const require_filtered_column = require('./filtered_column.cjs');
|
|
5
|
+
const require_selectors = require('./selectors.cjs');
|
|
6
|
+
const require_native_id = require('./native_id.cjs');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { Annotation, AnnotationJson, AxesId, AxesSpec, AxisId, AxisSpec, AxisSpecNormalized, AxisTree, AxisValueType, ColumnValueType, Domain, DomainJson, Metadata, MetadataJson, PAxisName, PColumn, PColumnIdAndSpec, PColumnInfo, PColumnLazy, PColumnName, PColumnSpec, PColumnSpecId, PDataColumnSpec, PUniversalColumnSpec, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow } from "./spec.js";
|
|
2
|
+
import { AAxisSelector, ADomain, AnchorAxisIdOrRefBasic, AnchorAxisRef, AnchorAxisRefByIdx, AnchorAxisRefByMatcher, AnchorAxisRefByName, AnchorDomainRef, AnchoredColumnMatchStrategy, AnchoredPColumnId, AnchoredPColumnSelector, AxisSelector, PColumnSelector, SingleAxisSelector, isAnchoredPColumnId, matchAxis, matchPColumn, selectorsToPredicate } from "./selectors.js";
|
|
3
|
+
import { AxisFilter, AxisFilterByIdx, AxisFilterByName, AxisFilterValue, FilteredPColumn, FilteredPColumnId, isFilteredPColumn } from "./filtered_column.js";
|
|
4
|
+
import { SUniversalPColumnId, UniversalPColumnId, parseColumnId, stringifyColumnId } from "./ids.js";
|
|
5
|
+
import { AnchoredIdDeriver, ResolveAnchorsOptions, resolveAnchors } from "./anchored.js";
|
|
6
|
+
import { NativePObjectId, deriveNativeId } from "./native_id.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Annotation, AnnotationJson, Domain, DomainJson, PAxisName, PColumnName, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow } from "./spec.js";
|
|
2
|
+
import { parseColumnId, stringifyColumnId } from "./ids.js";
|
|
3
|
+
import { AnchoredIdDeriver, resolveAnchors } from "./anchored.js";
|
|
4
|
+
import { isFilteredPColumn } from "./filtered_column.js";
|
|
5
|
+
import { isAnchoredPColumnId, matchAxis, matchPColumn, selectorsToPredicate } from "./selectors.js";
|
|
6
|
+
import { deriveNativeId } from "./native_id.js";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_spec = require('./spec.cjs');
|
|
3
|
+
const require_spec$1 = require('../../../pool/spec.cjs');
|
|
4
|
+
let canonicalize = require("canonicalize");
|
|
5
|
+
canonicalize = require_runtime.__toESM(canonicalize);
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (spec$2.domain !== undefined)
|
|
13
|
-
result.domain = spec$2.domain;
|
|
14
|
-
if (spec.isPColumnSpec(spec$2))
|
|
15
|
-
result.axesSpec = spec$1.getAxesId(spec$2.axesSpec);
|
|
16
|
-
return canonicalize(result);
|
|
7
|
+
//#region src/drivers/pframe/spec/native_id.ts
|
|
8
|
+
function deriveNativeId(spec) {
|
|
9
|
+
const result = {
|
|
10
|
+
kind: spec.kind,
|
|
11
|
+
name: spec.name
|
|
12
|
+
};
|
|
13
|
+
if (spec.domain !== void 0) result.domain = spec.domain;
|
|
14
|
+
if (require_spec$1.isPColumnSpec(spec)) result.axesSpec = require_spec.getAxesId(spec.axesSpec);
|
|
15
|
+
return (0, canonicalize.default)(result);
|
|
17
16
|
}
|
|
18
17
|
|
|
18
|
+
//#endregion
|
|
19
19
|
exports.deriveNativeId = deriveNativeId;
|
|
20
|
-
//# sourceMappingURL=native_id.cjs.map
|
|
20
|
+
//# sourceMappingURL=native_id.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native_id.cjs","sources":["../../../../src/drivers/pframe/spec/native_id.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport { isPColumnSpec, type PObjectSpec } from \"../../../pool\";\nimport { getAxesId } from \"./spec\";\nimport canonicalize from \"canonicalize\";\nexport type NativePObjectId = Branded<string, \"NativePObjectId\">;\n\nexport function deriveNativeId(spec: PObjectSpec): NativePObjectId {\n const result: Record<string, unknown> = {\n kind: spec.kind,\n name: spec.name,\n };\n if (spec.domain !== undefined) result.domain = spec.domain;\n if (isPColumnSpec(spec)) result.axesSpec = getAxesId(spec.axesSpec);\n return canonicalize(result) as NativePObjectId;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"native_id.cjs","names":["isPColumnSpec","getAxesId"],"sources":["../../../../src/drivers/pframe/spec/native_id.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport { isPColumnSpec, type PObjectSpec } from \"../../../pool\";\nimport { getAxesId } from \"./spec\";\nimport canonicalize from \"canonicalize\";\nexport type NativePObjectId = Branded<string, \"NativePObjectId\">;\n\nexport function deriveNativeId(spec: PObjectSpec): NativePObjectId {\n const result: Record<string, unknown> = {\n kind: spec.kind,\n name: spec.name,\n };\n if (spec.domain !== undefined) result.domain = spec.domain;\n if (isPColumnSpec(spec)) result.axesSpec = getAxesId(spec.axesSpec);\n return canonicalize(result) as NativePObjectId;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,eAAe,MAAoC;CACjE,MAAM,SAAkC;EACtC,MAAM,KAAK;EACX,MAAM,KAAK;EACZ;AACD,KAAI,KAAK,WAAW,OAAW,QAAO,SAAS,KAAK;AACpD,KAAIA,6BAAc,KAAK,CAAE,QAAO,WAAWC,uBAAU,KAAK,SAAS;AACnE,kCAAoB,OAAO"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Branded } from "../../../branding.js";
|
|
2
|
+
import { PObjectSpec } from "../../../pool/spec.js";
|
|
3
|
+
import "../../../pool/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/drivers/pframe/spec/native_id.d.ts
|
|
6
|
+
type NativePObjectId = Branded<string, "NativePObjectId">;
|
|
7
|
+
declare function deriveNativeId(spec: PObjectSpec): NativePObjectId;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { NativePObjectId, deriveNativeId };
|
|
5
10
|
//# sourceMappingURL=native_id.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import canonicalize from
|
|
1
|
+
import { getAxesId } from "./spec.js";
|
|
2
|
+
import { isPColumnSpec } from "../../../pool/spec.js";
|
|
3
|
+
import canonicalize from "canonicalize";
|
|
4
4
|
|
|
5
|
+
//#region src/drivers/pframe/spec/native_id.ts
|
|
5
6
|
function deriveNativeId(spec) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
result.axesSpec = getAxesId(spec.axesSpec);
|
|
14
|
-
return canonicalize(result);
|
|
7
|
+
const result = {
|
|
8
|
+
kind: spec.kind,
|
|
9
|
+
name: spec.name
|
|
10
|
+
};
|
|
11
|
+
if (spec.domain !== void 0) result.domain = spec.domain;
|
|
12
|
+
if (isPColumnSpec(spec)) result.axesSpec = getAxesId(spec.axesSpec);
|
|
13
|
+
return canonicalize(result);
|
|
15
14
|
}
|
|
16
15
|
|
|
16
|
+
//#endregion
|
|
17
17
|
export { deriveNativeId };
|
|
18
|
-
//# sourceMappingURL=native_id.js.map
|
|
18
|
+
//# sourceMappingURL=native_id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native_id.js","sources":["../../../../src/drivers/pframe/spec/native_id.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport { isPColumnSpec, type PObjectSpec } from \"../../../pool\";\nimport { getAxesId } from \"./spec\";\nimport canonicalize from \"canonicalize\";\nexport type NativePObjectId = Branded<string, \"NativePObjectId\">;\n\nexport function deriveNativeId(spec: PObjectSpec): NativePObjectId {\n const result: Record<string, unknown> = {\n kind: spec.kind,\n name: spec.name,\n };\n if (spec.domain !== undefined) result.domain = spec.domain;\n if (isPColumnSpec(spec)) result.axesSpec = getAxesId(spec.axesSpec);\n return canonicalize(result) as NativePObjectId;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"native_id.js","names":[],"sources":["../../../../src/drivers/pframe/spec/native_id.ts"],"sourcesContent":["import type { Branded } from \"../../../branding\";\nimport { isPColumnSpec, type PObjectSpec } from \"../../../pool\";\nimport { getAxesId } from \"./spec\";\nimport canonicalize from \"canonicalize\";\nexport type NativePObjectId = Branded<string, \"NativePObjectId\">;\n\nexport function deriveNativeId(spec: PObjectSpec): NativePObjectId {\n const result: Record<string, unknown> = {\n kind: spec.kind,\n name: spec.name,\n };\n if (spec.domain !== undefined) result.domain = spec.domain;\n if (isPColumnSpec(spec)) result.axesSpec = getAxesId(spec.axesSpec);\n return canonicalize(result) as NativePObjectId;\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAe,MAAoC;CACjE,MAAM,SAAkC;EACtC,MAAM,KAAK;EACX,MAAM,KAAK;EACZ;AACD,KAAI,KAAK,WAAW,OAAW,QAAO,SAAS,KAAK;AACpD,KAAI,cAAc,KAAK,CAAE,QAAO,WAAW,UAAU,KAAK,SAAS;AACnE,QAAO,aAAa,OAAO"}
|
|
@@ -1,130 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var spec$1 = require('../../../pool/spec.cjs');
|
|
4
|
-
var spec = require('./spec.cjs');
|
|
1
|
+
const require_spec = require('./spec.cjs');
|
|
2
|
+
const require_spec$1 = require('../../../pool/spec.cjs');
|
|
5
3
|
|
|
4
|
+
//#region src/drivers/pframe/spec/selectors.ts
|
|
6
5
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
* Checks if a given value is an anchored column identifier
|
|
7
|
+
* @param id - The value to check
|
|
8
|
+
* @returns True if the value is an anchored column identifier, false otherwise
|
|
9
|
+
*/
|
|
11
10
|
function isAnchoredPColumnId(id) {
|
|
12
|
-
|
|
13
|
-
return typeof id === "object" && id !== null && "name" in id && "axes" in id;
|
|
11
|
+
return typeof id === "object" && id !== null && "name" in id && "axes" in id;
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
* Determines if an axis ID matches an axis selector.
|
|
15
|
+
*
|
|
16
|
+
* @param selector - The selector with criteria to match against
|
|
17
|
+
* @param axis - The AxisId to check against the selector
|
|
18
|
+
* @returns true if the AxisId matches all specified criteria in the selector, false otherwise
|
|
19
|
+
*/
|
|
22
20
|
function matchAxis(selector, axis) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
// Match domain if specified - using existing logic from matchAxisId
|
|
37
|
-
if (selector.domain !== undefined) {
|
|
38
|
-
const axisDomain = axis.domain || {};
|
|
39
|
-
for (const [key, value] of Object.entries(selector.domain))
|
|
40
|
-
if (axisDomain[key] !== value)
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
21
|
+
if (selector.name !== void 0 && selector.name !== axis.name) return false;
|
|
22
|
+
if (selector.type !== void 0) {
|
|
23
|
+
if (Array.isArray(selector.type)) {
|
|
24
|
+
if (!selector.type.includes(axis.type)) return false;
|
|
25
|
+
} else if (selector.type !== axis.type) return false;
|
|
26
|
+
}
|
|
27
|
+
if (selector.domain !== void 0) {
|
|
28
|
+
const axisDomain = axis.domain || {};
|
|
29
|
+
for (const [key, value] of Object.entries(selector.domain)) if (axisDomain[key] !== value) return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
44
32
|
}
|
|
45
33
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
* Determines if a given PColumnSpec matches a selector.
|
|
35
|
+
*
|
|
36
|
+
* @param pcolumn - The PColumnSpec to check against the selector
|
|
37
|
+
* @param selector - The selector criteria to match against
|
|
38
|
+
* @returns true if the PColumnSpec matches all criteria in the selector, false otherwise
|
|
39
|
+
*/
|
|
52
40
|
function matchPColumn(pcolumn, selector) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
else {
|
|
86
|
-
// For exact matching, column must have the same number of axes and all must match
|
|
87
|
-
if (pcolumnAxes.length !== selector.axes.length)
|
|
88
|
-
return false;
|
|
89
|
-
// Each selector axis must match a corresponding column axis
|
|
90
|
-
for (let i = 0; i < selector.axes.length; i++)
|
|
91
|
-
if (!matchAxis(selector.axes[i], pcolumnAxes[i]))
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// Match annotations if specified
|
|
96
|
-
if (selector.annotations !== undefined) {
|
|
97
|
-
const columnAnnotations = pcolumn.annotations || {};
|
|
98
|
-
for (const [key, value] of Object.entries(selector.annotations))
|
|
99
|
-
if (columnAnnotations[key] !== value)
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
// Match annotation patterns if specified
|
|
103
|
-
if (selector.annotationPatterns !== undefined) {
|
|
104
|
-
const columnAnnotations = pcolumn.annotations || {};
|
|
105
|
-
for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {
|
|
106
|
-
const value = columnAnnotations[key];
|
|
107
|
-
if (value === undefined || !new RegExp(pattern).test(value))
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return true;
|
|
41
|
+
if (selector.name !== void 0 && pcolumn.name !== selector.name) return false;
|
|
42
|
+
if (selector.namePattern !== void 0 && !new RegExp(selector.namePattern).test(pcolumn.name)) return false;
|
|
43
|
+
if (selector.type !== void 0) {
|
|
44
|
+
if (Array.isArray(selector.type)) {
|
|
45
|
+
if (!selector.type.includes(pcolumn.valueType)) return false;
|
|
46
|
+
} else if (selector.type !== pcolumn.valueType) return false;
|
|
47
|
+
}
|
|
48
|
+
if (selector.domain !== void 0) {
|
|
49
|
+
const columnDomain = pcolumn.domain || {};
|
|
50
|
+
for (const [key, value] of Object.entries(selector.domain)) if (columnDomain[key] !== value) return false;
|
|
51
|
+
}
|
|
52
|
+
if (selector.axes !== void 0) {
|
|
53
|
+
const pcolumnAxes = pcolumn.axesSpec.map(require_spec.getAxisId);
|
|
54
|
+
if (selector.partialAxesMatch) {
|
|
55
|
+
for (const selectorAxis of selector.axes) if (!pcolumnAxes.some((columnAxis) => matchAxis(selectorAxis, columnAxis))) return false;
|
|
56
|
+
} else {
|
|
57
|
+
if (pcolumnAxes.length !== selector.axes.length) return false;
|
|
58
|
+
for (let i = 0; i < selector.axes.length; i++) if (!matchAxis(selector.axes[i], pcolumnAxes[i])) return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (selector.annotations !== void 0) {
|
|
62
|
+
const columnAnnotations = pcolumn.annotations || {};
|
|
63
|
+
for (const [key, value] of Object.entries(selector.annotations)) if (columnAnnotations[key] !== value) return false;
|
|
64
|
+
}
|
|
65
|
+
if (selector.annotationPatterns !== void 0) {
|
|
66
|
+
const columnAnnotations = pcolumn.annotations || {};
|
|
67
|
+
for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {
|
|
68
|
+
const value = columnAnnotations[key];
|
|
69
|
+
if (value === void 0 || !new RegExp(pattern).test(value)) return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
112
73
|
}
|
|
113
74
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
75
|
+
* Convert a predicate or array of selectors to a single predicate function
|
|
76
|
+
* @param predicateOrSelectors - Either a function that takes a PColumnSpec and returns a boolean,
|
|
77
|
+
* or an array of PColumnSelectors, or a single PColumnSelector
|
|
78
|
+
* @returns A function that takes a PColumnSpec and returns a boolean
|
|
79
|
+
*/
|
|
119
80
|
function selectorsToPredicate(predicateOrSelectors) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
else
|
|
123
|
-
return (spec) => spec$1.isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);
|
|
81
|
+
if (Array.isArray(predicateOrSelectors)) return (spec) => predicateOrSelectors.some((selector) => require_spec$1.isPColumnSpec(spec) && matchPColumn(spec, selector));
|
|
82
|
+
else return (spec) => require_spec$1.isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);
|
|
124
83
|
}
|
|
125
84
|
|
|
85
|
+
//#endregion
|
|
126
86
|
exports.isAnchoredPColumnId = isAnchoredPColumnId;
|
|
127
87
|
exports.matchAxis = matchAxis;
|
|
128
88
|
exports.matchPColumn = matchPColumn;
|
|
129
89
|
exports.selectorsToPredicate = selectorsToPredicate;
|
|
130
|
-
//# sourceMappingURL=selectors.cjs.map
|
|
90
|
+
//# sourceMappingURL=selectors.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.cjs","sources":["../../../../src/drivers/pframe/spec/selectors.ts"],"sourcesContent":["import { isPColumnSpec, type PObjectSpec } from \"../../../pool\";\nimport type { AxisId, AxisValueType, Domain, PColumnSpec, ValueType } from \"./spec\";\nimport { getAxisId } from \"./spec\";\n\n/**\n * Defines a pattern for matching axes within the PFrame data model.\n *\n * AxisSelector provides a flexible way to identify axes based on their\n * properties. All fields are optional, allowing for partial matching.\n * When multiple properties are specified, all must match for an axis\n * to be selected (logical AND).\n *\n * This interface is used in various selection and matching operations\n * throughout the PFrame system, such as column queries and axis lookups.\n */\nexport interface AxisSelector {\n /**\n * Optional value type to match against.\n * When specified, only axes with this exact type will match.\n * Can be a single type or an array of types to match against any of them.\n * Valid types include: 'Int', 'Long', 'Float', 'Double', 'String', 'Bytes'.\n */\n type?: ValueType | ValueType[];\n\n /**\n * Optional name to match against.\n * When specified, only axes with this exact name will match.\n */\n name?: string;\n\n /**\n * Optional domain key-value pairs to match against.\n * Domains provide additional context to uniquely identify an axis beyond its name and type.\n * When specified, an axis will match only if it contains all the key-value pairs defined here.\n * An axis with additional domain entries not present in this selector will still match.\n */\n domain?: Record<string, string>;\n}\n\n/** Single axis selector */\nexport interface SingleAxisSelector {\n /** Axis name (required) */\n name: string;\n /** Axis type (optional) */\n type?: AxisValueType;\n /** Domain requirements (optional) */\n domain?: Domain;\n /** Parent axes requirements (optional) */\n parentAxes?: SingleAxisSelector[];\n}\n\n/**\n * Reference to an axis by its numerical index within the anchor column's axes array\n * Format: [anchorId, axisIndex]\n */\nexport type AnchorAxisRefByIdx = { anchor: string; idx: number };\n\n/**\n * Reference to an axis by its name within the anchor column\n * Format: [anchorId, axisName]\n */\nexport type AnchorAxisRefByName = { anchor: string; name: string };\n\n/**\n * Reference to an axis using an AxisId matcher within the anchor\n * Format: [anchorId, axisMatcher]\n */\nexport type AnchorAxisRefByMatcher = { anchor: string; id: AxisId };\n\n/**\n * Basic anchor axis reference that can be either by index or a direct AxisId\n */\nexport type AnchorAxisIdOrRefBasic = AnchorAxisRefByIdx | AxisId;\n\n/** Union of all possible ways to reference an axis in an anchored context */\nexport type AnchorAxisRef = AnchorAxisRefByIdx | AnchorAxisRefByName | AnchorAxisRefByMatcher;\n\n/** Reference to a domain value through an anchor */\nexport type AnchorDomainRef = { anchor: string };\n\n/**\n * Domain value that can be either a direct string value or a reference to a domain through an anchor\n * Used to establish domain context that can be resolved relative to other anchored columns\n */\nexport type ADomain = string | AnchorDomainRef;\n/**\n * Axis identifier that can be either a direct AxisId or a reference to an axis through an anchor\n * Allows referring to axes in a way that can be resolved in different contexts\n */\nexport type AAxisSelector = AxisSelector | AnchorAxisRef;\n\n/**\n * Match resolution strategy for PColumns\n * Specifies how to handle when multiple columns match the criteria\n * (default is \"expectSingle\")\n */\nexport type AnchoredColumnMatchStrategy = \"expectSingle\" | \"expectMultiple\" | \"takeFirst\";\n\n/**\n * Matcher for PColumns in an anchored context\n * Supports partial matching on axes, allowing for flexible column discovery\n */\nexport interface AnchoredPColumnSelector {\n /** Optional name of the column to match; can't be used together with namePattern */\n name?: string;\n /** Optional regexp pattern for column name matching; can't be used together with name */\n namePattern?: string;\n /** Optional value type to match. If an array is provided, matches if the column's type is any of the specified types */\n type?: ValueType | ValueType[];\n /** If specified, the domain values must be anchored to this anchor */\n domainAnchor?: string;\n /** Optional domain values to match, can include anchored references, if domainAnchor is specified,\n * interpreted as additional domains to domain from the anchor */\n domain?: Record<string, ADomain>;\n /** Optional axes to match, can include anchored references */\n axes?: AAxisSelector[];\n /** When true, allows matching if only a subset of axes match */\n partialAxesMatch?: boolean;\n /** Optional annotations to match with exact values */\n annotations?: Record<string, string>;\n /** Optional annotation patterns to match with regex patterns */\n annotationPatterns?: Record<string, string>;\n /** Match resolution strategy, default is \"expectSingle\" */\n matchStrategy?: AnchoredColumnMatchStrategy;\n}\n\n/**\n * Matcher for PColumns in a non-anchored context\n */\nexport interface PColumnSelector extends AnchoredPColumnSelector {\n domainAnchor?: never;\n domain?: Record<string, string>;\n axes?: AxisSelector[];\n}\n\n/**\n * Strict identifier for PColumns in an anchored context\n * Unlike APColumnMatcher, this requires exact matches on domain and axes\n */\nexport interface AnchoredPColumnId extends AnchoredPColumnSelector {\n /** Name is required for exact column identification */\n name: string;\n /** No namePattern in ID */\n namePattern?: never;\n /** Type is not used in exact column identification */\n type?: never;\n /** Full axes specification using only basic references */\n axes: AnchorAxisIdOrRefBasic[];\n /** Partial axes matching is not allowed for exact identification */\n partialAxesMatch?: never;\n /** Annotations are not used in exact column identification */\n annotations?: never;\n /** Annotation patterns are not used in exact column identification */\n annotationPatterns?: never;\n /** \"Id\" implies single match strategy */\n matchStrategy?: never;\n}\n\n/**\n * Checks if a given value is an anchored column identifier\n * @param id - The value to check\n * @returns True if the value is an anchored column identifier, false otherwise\n */\nexport function isAnchoredPColumnId(id: unknown): id is AnchoredPColumnId {\n // basic check, can be extended if needed\n return typeof id === \"object\" && id !== null && \"name\" in id && \"axes\" in id;\n}\n\n/**\n * Determines if an axis ID matches an axis selector.\n *\n * @param selector - The selector with criteria to match against\n * @param axis - The AxisId to check against the selector\n * @returns true if the AxisId matches all specified criteria in the selector, false otherwise\n */\nexport function matchAxis(selector: AxisSelector, axis: AxisId): boolean {\n // Match name if specified\n if (selector.name !== undefined && selector.name !== axis.name) return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(axis.type)) return false;\n } else if (selector.type !== axis.type) {\n return false;\n }\n }\n\n // Match domain if specified - using existing logic from matchAxisId\n if (selector.domain !== undefined) {\n const axisDomain = axis.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (axisDomain[key] !== value) return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a given PColumnSpec matches a selector.\n *\n * @param pcolumn - The PColumnSpec to check against the selector\n * @param selector - The selector criteria to match against\n * @returns true if the PColumnSpec matches all criteria in the selector, false otherwise\n */\nexport function matchPColumn(pcolumn: PColumnSpec, selector: PColumnSelector): boolean {\n // Match name if specified\n if (selector.name !== undefined && pcolumn.name !== selector.name) return false;\n\n // Match name pattern if specified\n if (selector.namePattern !== undefined && !new RegExp(selector.namePattern).test(pcolumn.name))\n return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(pcolumn.valueType)) return false;\n } else if (selector.type !== pcolumn.valueType) {\n return false;\n }\n }\n\n // Match domain if specified\n if (selector.domain !== undefined) {\n const columnDomain = pcolumn.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (columnDomain[key] !== value) return false;\n }\n\n // Match axes if specified\n if (selector.axes !== undefined) {\n const pcolumnAxes = pcolumn.axesSpec.map(getAxisId);\n\n if (selector.partialAxesMatch) {\n // For partial matching, all selector axes must match at least one column axis\n for (const selectorAxis of selector.axes)\n if (!pcolumnAxes.some((columnAxis) => matchAxis(selectorAxis, columnAxis))) return false;\n } else {\n // For exact matching, column must have the same number of axes and all must match\n if (pcolumnAxes.length !== selector.axes.length) return false;\n\n // Each selector axis must match a corresponding column axis\n for (let i = 0; i < selector.axes.length; i++)\n if (!matchAxis(selector.axes[i], pcolumnAxes[i])) return false;\n }\n }\n\n // Match annotations if specified\n if (selector.annotations !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, value] of Object.entries(selector.annotations))\n if (columnAnnotations[key] !== value) return false;\n }\n\n // Match annotation patterns if specified\n if (selector.annotationPatterns !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {\n const value = columnAnnotations[key];\n if (value === undefined || !new RegExp(pattern).test(value)) return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert a predicate or array of selectors to a single predicate function\n * @param predicateOrSelectors - Either a function that takes a PColumnSpec and returns a boolean,\n * or an array of PColumnSelectors, or a single PColumnSelector\n * @returns A function that takes a PColumnSpec and returns a boolean\n */\nexport function selectorsToPredicate(\n predicateOrSelectors: PColumnSelector | PColumnSelector[],\n): (spec: PObjectSpec) => boolean {\n if (Array.isArray(predicateOrSelectors))\n return (spec) =>\n predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));\n else return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);\n}\n"],"names":["getAxisId","isPColumnSpec"],"mappings":";;;;;AA8JA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,EAAW,EAAA;;AAE7C,IAAA,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,IAAI,EAAE,IAAI,MAAM,IAAI,EAAE;AAC9E;AAEA;;;;;;AAMG;AACG,SAAU,SAAS,CAAC,QAAsB,EAAE,IAAY,EAAA;;AAE5D,IAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,KAAK;;AAG5E,IAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE;QAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAChC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;AAAE,gBAAA,OAAO,KAAK;QACtD;aAAO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AAE,gBAAA,OAAO,KAAK;IACtD;;AAGA,IAAA,IAAI,QAAQ,CAAC,kBAAkB,KAAK,SAAS,EAAE;AAC7C,QAAA,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE;AACnD,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;AACxE,YAAA,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC;AACpC,YAAA,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AAAE,gBAAA,OAAO,KAAK;QAC3E;IACF;AAEA,IAAA,OAAO,IAAI;AACb;AAEA;;;;;AAKG;AACG,SAAU,oBAAoB,CAClC,oBAAyD,EAAA;AAEzD,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC;QACrC,OAAO,CAAC,IAAI,KACV,oBAAoB,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAKC,oBAAa,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;;AAC3F,QAAA,OAAO,CAAC,IAAI,KAAKA,oBAAa,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,oBAAoB,CAAC;AACvF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"selectors.cjs","names":["getAxisId","isPColumnSpec"],"sources":["../../../../src/drivers/pframe/spec/selectors.ts"],"sourcesContent":["import { isPColumnSpec, type PObjectSpec } from \"../../../pool\";\nimport type { AxisId, AxisValueType, Domain, PColumnSpec, ValueType } from \"./spec\";\nimport { getAxisId } from \"./spec\";\n\n/**\n * Defines a pattern for matching axes within the PFrame data model.\n *\n * AxisSelector provides a flexible way to identify axes based on their\n * properties. All fields are optional, allowing for partial matching.\n * When multiple properties are specified, all must match for an axis\n * to be selected (logical AND).\n *\n * This interface is used in various selection and matching operations\n * throughout the PFrame system, such as column queries and axis lookups.\n */\nexport interface AxisSelector {\n /**\n * Optional value type to match against.\n * When specified, only axes with this exact type will match.\n * Can be a single type or an array of types to match against any of them.\n * Valid types include: 'Int', 'Long', 'Float', 'Double', 'String', 'Bytes'.\n */\n type?: ValueType | ValueType[];\n\n /**\n * Optional name to match against.\n * When specified, only axes with this exact name will match.\n */\n name?: string;\n\n /**\n * Optional domain key-value pairs to match against.\n * Domains provide additional context to uniquely identify an axis beyond its name and type.\n * When specified, an axis will match only if it contains all the key-value pairs defined here.\n * An axis with additional domain entries not present in this selector will still match.\n */\n domain?: Record<string, string>;\n}\n\n/** Single axis selector */\nexport interface SingleAxisSelector {\n /** Axis name (required) */\n name: string;\n /** Axis type (optional) */\n type?: AxisValueType;\n /** Domain requirements (optional) */\n domain?: Domain;\n /** Parent axes requirements (optional) */\n parentAxes?: SingleAxisSelector[];\n}\n\n/**\n * Reference to an axis by its numerical index within the anchor column's axes array\n * Format: [anchorId, axisIndex]\n */\nexport type AnchorAxisRefByIdx = { anchor: string; idx: number };\n\n/**\n * Reference to an axis by its name within the anchor column\n * Format: [anchorId, axisName]\n */\nexport type AnchorAxisRefByName = { anchor: string; name: string };\n\n/**\n * Reference to an axis using an AxisId matcher within the anchor\n * Format: [anchorId, axisMatcher]\n */\nexport type AnchorAxisRefByMatcher = { anchor: string; id: AxisId };\n\n/**\n * Basic anchor axis reference that can be either by index or a direct AxisId\n */\nexport type AnchorAxisIdOrRefBasic = AnchorAxisRefByIdx | AxisId;\n\n/** Union of all possible ways to reference an axis in an anchored context */\nexport type AnchorAxisRef = AnchorAxisRefByIdx | AnchorAxisRefByName | AnchorAxisRefByMatcher;\n\n/** Reference to a domain value through an anchor */\nexport type AnchorDomainRef = { anchor: string };\n\n/**\n * Domain value that can be either a direct string value or a reference to a domain through an anchor\n * Used to establish domain context that can be resolved relative to other anchored columns\n */\nexport type ADomain = string | AnchorDomainRef;\n/**\n * Axis identifier that can be either a direct AxisId or a reference to an axis through an anchor\n * Allows referring to axes in a way that can be resolved in different contexts\n */\nexport type AAxisSelector = AxisSelector | AnchorAxisRef;\n\n/**\n * Match resolution strategy for PColumns\n * Specifies how to handle when multiple columns match the criteria\n * (default is \"expectSingle\")\n */\nexport type AnchoredColumnMatchStrategy = \"expectSingle\" | \"expectMultiple\" | \"takeFirst\";\n\n/**\n * Matcher for PColumns in an anchored context\n * Supports partial matching on axes, allowing for flexible column discovery\n */\nexport interface AnchoredPColumnSelector {\n /** Optional name of the column to match; can't be used together with namePattern */\n name?: string;\n /** Optional regexp pattern for column name matching; can't be used together with name */\n namePattern?: string;\n /** Optional value type to match. If an array is provided, matches if the column's type is any of the specified types */\n type?: ValueType | ValueType[];\n /** If specified, the domain values must be anchored to this anchor */\n domainAnchor?: string;\n /** Optional domain values to match, can include anchored references, if domainAnchor is specified,\n * interpreted as additional domains to domain from the anchor */\n domain?: Record<string, ADomain>;\n /** Optional axes to match, can include anchored references */\n axes?: AAxisSelector[];\n /** When true, allows matching if only a subset of axes match */\n partialAxesMatch?: boolean;\n /** Optional annotations to match with exact values */\n annotations?: Record<string, string>;\n /** Optional annotation patterns to match with regex patterns */\n annotationPatterns?: Record<string, string>;\n /** Match resolution strategy, default is \"expectSingle\" */\n matchStrategy?: AnchoredColumnMatchStrategy;\n}\n\n/**\n * Matcher for PColumns in a non-anchored context\n */\nexport interface PColumnSelector extends AnchoredPColumnSelector {\n domainAnchor?: never;\n domain?: Record<string, string>;\n axes?: AxisSelector[];\n}\n\n/**\n * Strict identifier for PColumns in an anchored context\n * Unlike APColumnMatcher, this requires exact matches on domain and axes\n */\nexport interface AnchoredPColumnId extends AnchoredPColumnSelector {\n /** Name is required for exact column identification */\n name: string;\n /** No namePattern in ID */\n namePattern?: never;\n /** Type is not used in exact column identification */\n type?: never;\n /** Full axes specification using only basic references */\n axes: AnchorAxisIdOrRefBasic[];\n /** Partial axes matching is not allowed for exact identification */\n partialAxesMatch?: never;\n /** Annotations are not used in exact column identification */\n annotations?: never;\n /** Annotation patterns are not used in exact column identification */\n annotationPatterns?: never;\n /** \"Id\" implies single match strategy */\n matchStrategy?: never;\n}\n\n/**\n * Checks if a given value is an anchored column identifier\n * @param id - The value to check\n * @returns True if the value is an anchored column identifier, false otherwise\n */\nexport function isAnchoredPColumnId(id: unknown): id is AnchoredPColumnId {\n // basic check, can be extended if needed\n return typeof id === \"object\" && id !== null && \"name\" in id && \"axes\" in id;\n}\n\n/**\n * Determines if an axis ID matches an axis selector.\n *\n * @param selector - The selector with criteria to match against\n * @param axis - The AxisId to check against the selector\n * @returns true if the AxisId matches all specified criteria in the selector, false otherwise\n */\nexport function matchAxis(selector: AxisSelector, axis: AxisId): boolean {\n // Match name if specified\n if (selector.name !== undefined && selector.name !== axis.name) return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(axis.type)) return false;\n } else if (selector.type !== axis.type) {\n return false;\n }\n }\n\n // Match domain if specified - using existing logic from matchAxisId\n if (selector.domain !== undefined) {\n const axisDomain = axis.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (axisDomain[key] !== value) return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a given PColumnSpec matches a selector.\n *\n * @param pcolumn - The PColumnSpec to check against the selector\n * @param selector - The selector criteria to match against\n * @returns true if the PColumnSpec matches all criteria in the selector, false otherwise\n */\nexport function matchPColumn(pcolumn: PColumnSpec, selector: PColumnSelector): boolean {\n // Match name if specified\n if (selector.name !== undefined && pcolumn.name !== selector.name) return false;\n\n // Match name pattern if specified\n if (selector.namePattern !== undefined && !new RegExp(selector.namePattern).test(pcolumn.name))\n return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(pcolumn.valueType)) return false;\n } else if (selector.type !== pcolumn.valueType) {\n return false;\n }\n }\n\n // Match domain if specified\n if (selector.domain !== undefined) {\n const columnDomain = pcolumn.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (columnDomain[key] !== value) return false;\n }\n\n // Match axes if specified\n if (selector.axes !== undefined) {\n const pcolumnAxes = pcolumn.axesSpec.map(getAxisId);\n\n if (selector.partialAxesMatch) {\n // For partial matching, all selector axes must match at least one column axis\n for (const selectorAxis of selector.axes)\n if (!pcolumnAxes.some((columnAxis) => matchAxis(selectorAxis, columnAxis))) return false;\n } else {\n // For exact matching, column must have the same number of axes and all must match\n if (pcolumnAxes.length !== selector.axes.length) return false;\n\n // Each selector axis must match a corresponding column axis\n for (let i = 0; i < selector.axes.length; i++)\n if (!matchAxis(selector.axes[i], pcolumnAxes[i])) return false;\n }\n }\n\n // Match annotations if specified\n if (selector.annotations !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, value] of Object.entries(selector.annotations))\n if (columnAnnotations[key] !== value) return false;\n }\n\n // Match annotation patterns if specified\n if (selector.annotationPatterns !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {\n const value = columnAnnotations[key];\n if (value === undefined || !new RegExp(pattern).test(value)) return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert a predicate or array of selectors to a single predicate function\n * @param predicateOrSelectors - Either a function that takes a PColumnSpec and returns a boolean,\n * or an array of PColumnSelectors, or a single PColumnSelector\n * @returns A function that takes a PColumnSpec and returns a boolean\n */\nexport function selectorsToPredicate(\n predicateOrSelectors: PColumnSelector | PColumnSelector[],\n): (spec: PObjectSpec) => boolean {\n if (Array.isArray(predicateOrSelectors))\n return (spec) =>\n predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));\n else return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);\n}\n"],"mappings":";;;;;;;;;AAmKA,SAAgB,oBAAoB,IAAsC;AAExE,QAAO,OAAO,OAAO,YAAY,OAAO,QAAQ,UAAU,MAAM,UAAU;;;;;;;;;AAU5E,SA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