@milaboratories/pl-model-common 1.24.3 → 1.24.5
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/base32_encode.cjs +11 -11
- package/dist/base32_encode.cjs.map +1 -1
- package/dist/base32_encode.d.ts +1 -1
- package/dist/base32_encode.js +11 -11
- package/dist/base32_encode.js.map +1 -1
- package/dist/base64.cjs +2 -2
- package/dist/base64.cjs.map +1 -1
- package/dist/base64.d.ts +1 -1
- package/dist/base64.d.ts.map +1 -1
- package/dist/base64.js +2 -2
- package/dist/base64.js.map +1 -1
- package/dist/block_state.d.ts +3 -3
- package/dist/bmodel/block_config.cjs +1 -1
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +3 -3
- package/dist/bmodel/block_config.d.ts.map +1 -1
- package/dist/bmodel/block_config.js +1 -1
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/code.cjs +1 -1
- package/dist/bmodel/code.cjs.map +1 -1
- package/dist/bmodel/code.d.ts +2 -2
- package/dist/bmodel/code.js +1 -1
- package/dist/bmodel/code.js.map +1 -1
- package/dist/bmodel/container.d.ts +5 -5
- package/dist/bmodel/index.d.ts +5 -5
- package/dist/bmodel/normalization.cjs +17 -17
- package/dist/bmodel/normalization.cjs.map +1 -1
- package/dist/bmodel/normalization.d.ts +2 -2
- package/dist/bmodel/normalization.d.ts.map +1 -1
- package/dist/bmodel/normalization.js +17 -17
- package/dist/bmodel/normalization.js.map +1 -1
- package/dist/bmodel/types.d.ts +1 -1
- package/dist/branding.d.ts +2 -2
- package/dist/common_types.d.ts +1 -1
- package/dist/driver_kit.d.ts +1 -1
- package/dist/drivers/ChunkedStreamReader.cjs +13 -12
- package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
- package/dist/drivers/ChunkedStreamReader.d.ts +2 -2
- package/dist/drivers/ChunkedStreamReader.d.ts.map +1 -1
- package/dist/drivers/ChunkedStreamReader.js +13 -12
- package/dist/drivers/ChunkedStreamReader.js.map +1 -1
- package/dist/drivers/blob.cjs +1 -1
- package/dist/drivers/blob.cjs.map +1 -1
- package/dist/drivers/blob.d.ts +4 -4
- package/dist/drivers/blob.d.ts.map +1 -1
- package/dist/drivers/blob.js +1 -1
- package/dist/drivers/blob.js.map +1 -1
- package/dist/drivers/index.d.ts +8 -8
- package/dist/drivers/log.cjs +1 -1
- package/dist/drivers/log.cjs.map +1 -1
- package/dist/drivers/log.js +1 -1
- package/dist/drivers/log.js.map +1 -1
- package/dist/drivers/ls.cjs +3 -3
- package/dist/drivers/ls.cjs.map +1 -1
- package/dist/drivers/ls.d.ts +6 -6
- package/dist/drivers/ls.d.ts.map +1 -1
- package/dist/drivers/ls.js +3 -3
- package/dist/drivers/ls.js.map +1 -1
- package/dist/drivers/pframe/column_filter.d.ts +1 -1
- package/dist/drivers/pframe/data_info.cjs +119 -110
- package/dist/drivers/pframe/data_info.cjs.map +1 -1
- package/dist/drivers/pframe/data_info.d.ts +10 -10
- package/dist/drivers/pframe/data_info.d.ts.map +1 -1
- package/dist/drivers/pframe/data_info.js +119 -110
- package/dist/drivers/pframe/data_info.js.map +1 -1
- package/dist/drivers/pframe/data_types.cjs +7 -4
- package/dist/drivers/pframe/data_types.cjs.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +2 -2
- package/dist/drivers/pframe/data_types.d.ts.map +1 -1
- package/dist/drivers/pframe/data_types.js +7 -4
- package/dist/drivers/pframe/data_types.js.map +1 -1
- package/dist/drivers/pframe/driver.d.ts +10 -10
- package/dist/drivers/pframe/driver.d.ts.map +1 -1
- package/dist/drivers/pframe/find_columns.d.ts +2 -2
- package/dist/drivers/pframe/index.d.ts +14 -14
- package/dist/drivers/pframe/linker_columns.cjs +13 -5
- package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
- package/dist/drivers/pframe/linker_columns.d.ts +2 -2
- package/dist/drivers/pframe/linker_columns.d.ts.map +1 -1
- package/dist/drivers/pframe/linker_columns.js +13 -5
- package/dist/drivers/pframe/linker_columns.js.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +6 -6
- package/dist/drivers/pframe/pframe.d.ts.map +1 -1
- package/dist/drivers/pframe/query/index.d.ts +2 -2
- package/dist/drivers/pframe/query/query_common.d.ts +37 -37
- package/dist/drivers/pframe/query/query_data.d.ts +2 -2
- package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
- package/dist/drivers/pframe/query/query_spec.d.ts +3 -3
- package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored.cjs +6 -6
- package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +4 -4
- package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored.js +6 -6
- package/dist/drivers/pframe/spec/anchored.js.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts +1 -1
- package/dist/drivers/pframe/spec/filtered_column.js +1 -1
- package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
- package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
- package/dist/drivers/pframe/spec/ids.d.ts +5 -5
- package/dist/drivers/pframe/spec/ids.js.map +1 -1
- package/dist/drivers/pframe/spec/index.d.ts +6 -6
- package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
- package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
- package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/native_id.js.map +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +4 -4
- package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/selectors.js +1 -1
- package/dist/drivers/pframe/spec/selectors.js.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +64 -59
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +15 -15
- package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.js +64 -59
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/drivers/pframe/table.d.ts +2 -2
- package/dist/drivers/pframe/table_calculate.cjs +11 -11
- package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
- package/dist/drivers/pframe/table_calculate.d.ts +30 -30
- package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
- package/dist/drivers/pframe/table_calculate.js +11 -11
- package/dist/drivers/pframe/table_calculate.js.map +1 -1
- package/dist/drivers/pframe/table_common.cjs +4 -4
- package/dist/drivers/pframe/table_common.cjs.map +1 -1
- package/dist/drivers/pframe/table_common.d.ts +6 -6
- package/dist/drivers/pframe/table_common.js +4 -4
- package/dist/drivers/pframe/table_common.js.map +1 -1
- package/dist/drivers/pframe/type_util.d.ts.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +4 -4
- package/dist/drivers/urls.cjs +2 -2
- package/dist/drivers/urls.cjs.map +1 -1
- package/dist/drivers/urls.d.ts +1 -1
- package/dist/drivers/urls.js +2 -2
- package/dist/drivers/urls.js.map +1 -1
- package/dist/errors.cjs +12 -12
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -12
- package/dist/errors.js.map +1 -1
- package/dist/flags/block_flags.cjs +2 -2
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts.map +1 -1
- package/dist/flags/block_flags.js +2 -2
- package/dist/flags/block_flags.js.map +1 -1
- package/dist/flags/flag_utils.cjs +31 -29
- package/dist/flags/flag_utils.cjs.map +1 -1
- package/dist/flags/flag_utils.d.ts +33 -33
- package/dist/flags/flag_utils.d.ts.map +1 -1
- package/dist/flags/flag_utils.js +31 -29
- package/dist/flags/flag_utils.js.map +1 -1
- package/dist/flags/index.d.ts +3 -3
- package/dist/flags/type_utils.d.ts +1 -1
- package/dist/flags/type_utils.d.ts.map +1 -1
- package/dist/httpAuth.cjs +4 -5
- package/dist/httpAuth.cjs.map +1 -1
- package/dist/httpAuth.d.ts +1 -1
- package/dist/httpAuth.d.ts.map +1 -1
- package/dist/httpAuth.js +4 -5
- package/dist/httpAuth.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/json.cjs +1 -1
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +1 -1
- package/dist/json.js.map +1 -1
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.ts +3 -3
- package/dist/navigation.js +1 -1
- package/dist/navigation.js.map +1 -1
- package/dist/plid.cjs +4 -4
- package/dist/plid.cjs.map +1 -1
- package/dist/plid.d.ts +1 -1
- package/dist/plid.js +4 -4
- package/dist/plid.js.map +1 -1
- package/dist/pool/entry.d.ts +1 -1
- package/dist/pool/index.d.ts +3 -3
- package/dist/pool/query.cjs +23 -23
- package/dist/pool/query.cjs.map +1 -1
- package/dist/pool/query.d.ts +9 -9
- package/dist/pool/query.d.ts.map +1 -1
- package/dist/pool/query.js +23 -23
- package/dist/pool/query.js.map +1 -1
- package/dist/pool/spec.cjs +9 -9
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +4 -4
- package/dist/pool/spec.d.ts.map +1 -1
- package/dist/pool/spec.js +9 -9
- package/dist/pool/spec.js.map +1 -1
- package/dist/ref.cjs +20 -18
- package/dist/ref.cjs.map +1 -1
- package/dist/ref.d.ts +1 -1
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +20 -18
- package/dist/ref.js.map +1 -1
- package/dist/utag.d.ts +1 -1
- package/dist/util.cjs +1 -1
- package/dist/util.cjs.map +1 -1
- package/dist/util.js +1 -1
- package/dist/util.js.map +1 -1
- package/dist/value_or_error.cjs.map +1 -1
- package/dist/value_or_error.d.ts.map +1 -1
- package/dist/value_or_error.js.map +1 -1
- package/package.json +18 -17
- package/src/base32_encode.ts +12 -12
- package/src/base64.ts +12 -8
- package/src/block_state.ts +3 -3
- package/src/bmodel/block_config.ts +12 -6
- package/src/bmodel/code.ts +3 -3
- package/src/bmodel/container.ts +5 -5
- package/src/bmodel/index.ts +5 -5
- package/src/bmodel/normalization.ts +33 -25
- package/src/bmodel/types.ts +1 -1
- package/src/branding.ts +2 -2
- package/src/common_types.ts +1 -1
- package/src/driver_kit.ts +1 -1
- package/src/drivers/ChunkedStreamReader.ts +16 -14
- package/src/drivers/blob.ts +7 -11
- package/src/drivers/index.ts +8 -8
- package/src/drivers/log.ts +3 -3
- package/src/drivers/ls.ts +18 -18
- package/src/drivers/pframe/column_filter.ts +1 -1
- package/src/drivers/pframe/data_info.ts +146 -146
- package/src/drivers/pframe/data_types.ts +56 -36
- package/src/drivers/pframe/driver.ts +20 -36
- package/src/drivers/pframe/find_columns.ts +2 -2
- package/src/drivers/pframe/index.ts +14 -14
- package/src/drivers/pframe/linker_columns.test.ts +280 -273
- package/src/drivers/pframe/linker_columns.ts +65 -39
- package/src/drivers/pframe/pframe.ts +6 -9
- package/src/drivers/pframe/query/index.ts +2 -2
- package/src/drivers/pframe/query/query_common.ts +46 -46
- package/src/drivers/pframe/query/query_data.ts +17 -10
- package/src/drivers/pframe/query/query_spec.ts +18 -10
- package/src/drivers/pframe/spec/anchored.ts +44 -33
- package/src/drivers/pframe/spec/filtered_column.ts +2 -2
- package/src/drivers/pframe/spec/ids.ts +6 -6
- package/src/drivers/pframe/spec/index.ts +6 -6
- package/src/drivers/pframe/spec/native_id.ts +7 -9
- package/src/drivers/pframe/spec/selectors.test.ts +170 -146
- package/src/drivers/pframe/spec/selectors.ts +22 -31
- package/src/drivers/pframe/spec/spec.test.ts +163 -176
- package/src/drivers/pframe/spec/spec.ts +132 -117
- package/src/drivers/pframe/table.ts +2 -2
- package/src/drivers/pframe/table_calculate.ts +44 -50
- package/src/drivers/pframe/table_common.ts +10 -10
- package/src/drivers/pframe/type_util.ts +2 -7
- package/src/drivers/pframe/unique_values.ts +4 -4
- package/src/drivers/urls.ts +3 -3
- package/src/errors.test.ts +20 -20
- package/src/errors.ts +24 -20
- package/src/flags/block_flags.ts +8 -7
- package/src/flags/flag_utils.test.ts +94 -73
- package/src/flags/flag_utils.ts +73 -50
- package/src/flags/index.ts +3 -3
- package/src/flags/type_utils.ts +10 -7
- package/src/httpAuth.ts +5 -6
- package/src/index.ts +19 -19
- package/src/json.ts +28 -17
- package/src/navigation.ts +4 -4
- package/src/plid.ts +6 -6
- package/src/pool/entry.ts +1 -1
- package/src/pool/index.ts +3 -3
- package/src/pool/query.ts +52 -56
- package/src/pool/spec.ts +20 -17
- package/src/ref.ts +25 -19
- package/src/utag.ts +1 -1
- package/src/util.ts +1 -1
- package/src/value_or_error.ts +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker_columns.js","sources":["../../../src/drivers/pframe/linker_columns.ts"],"sourcesContent":["import {\n canonicalizeJson,\n parseJson,\n type CanonicalizedJson,\n} from '../../json';\nimport {\n Annotation,\n readAnnotationJson,\n type AxisSpec,\n type PColumnIdAndSpec,\n type AxisSpecNormalized,\n type AxisId,\n getAxisId,\n getNormalizedAxesList,\n getArrayFromAxisTree,\n getAxesTree,\n} from './spec/spec';\n\ntype LinkerKey = CanonicalizedJson<AxisId[]>;\nexport type CompositeLinkerMap = Map<\n LinkerKey,\n {\n keyAxesSpec: AxisSpecNormalized[]; // axis specs - source for the key\n linkWith: Map<LinkerKey, PColumnIdAndSpec>; // for every axis (possibly in group with parents - available by linkers another axes and corresponding linkers)\n }\n>;\n\ninterface LinkersData {\n data: CompositeLinkerMap;\n}\nexport class LinkerMap implements LinkersData {\n /** Graph of linkers connected by axes (single or grouped by parents) */\n readonly data: CompositeLinkerMap;\n\n constructor(linkerMap: CompositeLinkerMap) {\n this.data = linkerMap;\n }\n\n get keys() {\n return this.data.keys();\n }\n\n get keyAxesIds() {\n return [...this.data.keys()].map(parseJson);\n }\n\n static fromColumns(columns: PColumnIdAndSpec[]) {\n const result: CompositeLinkerMap = new Map();\n for (const linker of columns.filter((l) => !!readAnnotationJson(l.spec, Annotation.IsLinkerColumn))) {\n const groups = LinkerMap.getAxesGroups(getNormalizedAxesList(linker.spec.axesSpec)); // split input axes into groups by parent links from annotation\n\n if (groups.length !== 2) {\n continue; // not a valid linker column\n }\n const [left, right] = groups;\n\n // In case of group:\n // A - C\n // \\_ B _ D\n // E/\n // put 2 variants as keys:\n // A - C\n // \\_ B _ D\n // and\n // E - B - D\n const leftKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(left).map((axis) => {\n const axes = getArrayFromAxisTree(getAxesTree(axis));\n const key = canonicalizeJson(axes.map(getAxisId));\n return [key, axes];\n });\n const rightKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(right).map((axis) => {\n const axes = getArrayFromAxisTree(getAxesTree(axis));\n const key = canonicalizeJson(axes.map(getAxisId));\n return [key, axes];\n });\n\n for (const [keyLeft, spec] of leftKeyVariants) {\n if (!result.has(keyLeft)) {\n result.set(keyLeft, { keyAxesSpec: spec, linkWith: new Map() });\n }\n }\n for (const [keyRight, spec] of rightKeyVariants) {\n if (!result.has(keyRight)) {\n result.set(keyRight, { keyAxesSpec: spec, linkWith: new Map() });\n }\n }\n for (const [keyLeft] of leftKeyVariants) {\n for (const [keyRight] of rightKeyVariants) {\n result.get(keyLeft)?.linkWith.set(keyRight, linker);\n result.get(keyRight)?.linkWith.set(keyLeft, linker);\n }\n }\n }\n return new this(result);\n }\n\n /** Get all available nodes of linker graphs if start from sourceAxesKeys */\n searchAvailableAxesKeys(sourceAxesKeys: LinkerKey[]): Set<LinkerKey> {\n const startKeys = new Set(sourceAxesKeys);\n const allAvailableKeys = new Set<LinkerKey>();\n let nextKeys = sourceAxesKeys;\n while (nextKeys.length) {\n const next: LinkerKey[] = [];\n for (const key of nextKeys) {\n const node = this.data.get(key);\n if (!node) continue;\n for (const availableKey of node.linkWith.keys()) {\n if (!allAvailableKeys.has(availableKey) && !startKeys.has(availableKey)) {\n next.push(availableKey);\n allAvailableKeys.add(availableKey);\n }\n }\n }\n nextKeys = next;\n }\n return allAvailableKeys;\n }\n\n /** Get all linker columns that are necessary to reach endKey from startKey */\n searchLinkerPath(startKey: LinkerKey, endKey: LinkerKey): PColumnIdAndSpec[] {\n const previous: Record<LinkerKey, LinkerKey> = {};\n let nextIds = new Set([startKey]);\n const visited = new Set([startKey]);\n while (nextIds.size) {\n const next = new Set<LinkerKey>();\n for (const nextId of nextIds) {\n const node = this.data.get(nextId);\n if (!node) continue;\n for (const availableId of node.linkWith.keys()) {\n previous[availableId] = nextId;\n if (availableId === endKey) {\n const ids: LinkerKey[] = [];\n let current = endKey;\n while (previous[current] !== startKey) {\n ids.push(current);\n current = previous[current];\n }\n ids.push(current);\n return ids.map((id: LinkerKey) => this.data.get(id)!.linkWith.get(previous[id])!);\n } else if (!visited.has(availableId)) {\n next.add(availableId);\n visited.add(availableId);\n }\n }\n }\n nextIds = next;\n }\n return [];\n }\n\n getLinkerColumnsForAxes({\n from: sourceAxes,\n to: targetAxes,\n throwWhenNoLinkExists = true,\n }: {\n from: AxisSpecNormalized[];\n to: AxisSpecNormalized[];\n throwWhenNoLinkExists?: boolean;\n }): PColumnIdAndSpec[] {\n // start keys - all possible keys in linker map using sourceAxes (for example, all axes of block's columns or all axes of columns in data-inputs)\n const startKeys: LinkerKey[] = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n\n return Array.from(\n new Map(\n LinkerMap.getAxesRoots(targetAxes)\n .map(LinkerMap.getLinkerKeyFromAxisSpec) // target keys contain all axes to be linked; if some of target axes has parents they must be in the key\n .flatMap((targetKey) => {\n const linkers = startKeys\n .map((startKey) => this.searchLinkerPath(startKey, targetKey))\n .reduce((shortestPath, path) => (shortestPath.length && shortestPath.length < path.length) || !path.length ? shortestPath : path,\n [] as PColumnIdAndSpec[])\n .map((linker) => [linker.columnId, linker] as const);\n if (!linkers.length && throwWhenNoLinkExists) {\n throw Error(`Unable to find linker column for ${targetKey}`);\n }\n return linkers;\n }),\n ).values(),\n );\n }\n\n /** Get list of axisSpecs from keys of linker columns map */\n getAxesListFromKeysList(keys: LinkerKey[]): AxisSpecNormalized[] {\n return Array.from(\n new Map(\n keys.flatMap((key) => this.data.get(key)?.keyAxesSpec ?? [])\n .map((axis) => [canonicalizeJson(getAxisId(axis)), axis]),\n ).values(),\n );\n }\n\n /** Get axes of target axes that are impossible to be linked to source axes with current linker map */\n getNonLinkableAxes(\n sourceAxes: AxisSpecNormalized[],\n targetAxes: AxisSpecNormalized[],\n ): AxisSpecNormalized[] {\n const startKeys = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n // target keys contain all axes to be linked; if some of target axes has parents they must be in the key\n const targetKeys = targetAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n\n const axes = Array.from(\n new Map(\n targetAxes\n .filter((_targetAxis, idx) => {\n const targetKey = targetKeys[idx];\n return !startKeys.some((startKey) => this.searchLinkerPath(startKey, targetKey).length);\n })\n .flatMap((axis) => getArrayFromAxisTree(getAxesTree(axis)).map((axis) => [canonicalizeJson(getAxisId(axis)), axis])),\n ).values(),\n );\n return axes;\n }\n\n /** Get all axes that can be connected to sourceAxes by linkers */\n getReachableByLinkersAxesFromAxesNormalized(\n sourceAxes: AxisSpecNormalized[],\n matchAxisIdFn?: (axisIdOfLinker: AxisId, axisIdOfSource: AxisId) => boolean,\n ): AxisSpecNormalized[] {\n let startKeys: CanonicalizedJson<AxisId[]>[] = [];\n\n if (matchAxisIdFn) {\n const sourceAxisIdsGrouped: AxisId[][] = sourceAxes.map((axis) => getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));\n for (const sourceAxisIdsGroup of sourceAxisIdsGrouped) {\n const matched = this.keyAxesIds.find(\n (keyIds: AxisId[]) => keyIds.every(\n (linkerKeyAxisId) => sourceAxisIdsGroup.find((sourceAxisId) => matchAxisIdFn(linkerKeyAxisId, sourceAxisId)),\n ),\n );\n if (matched) {\n startKeys.push(canonicalizeJson(matched));\n }\n }\n } else {\n startKeys = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n }\n\n const availableKeys = this.searchAvailableAxesKeys(startKeys);\n return this.getAxesListFromKeysList([...availableKeys]);\n }\n\n getReachableByLinkersAxesFromAxes(\n sourceAxes: AxisSpec[],\n matchAxisIdFn?: (axisIdOfLinker: AxisId, axisIdOfSource: AxisId) => boolean,\n ): AxisSpecNormalized[] {\n return this.getReachableByLinkersAxesFromAxesNormalized(getNormalizedAxesList(sourceAxes), matchAxisIdFn);\n }\n\n static getLinkerKeyFromAxisSpec(axis: AxisSpecNormalized): LinkerKey {\n return canonicalizeJson(getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));\n }\n\n /** Split array of axes into several arrays by parents: axes of one group are parents for each other.\n There are no order inside every group. */\n static getAxesGroups(axesSpec: AxisSpecNormalized[]): AxisSpecNormalized[][] {\n switch (axesSpec.length) {\n case 0: return [];\n case 1: return [[axesSpec[0]]];\n default: break;\n }\n\n const axisKeys = axesSpec.map((spec) => canonicalizeJson(getAxisId(spec)));\n const axisParentsIdxs = axesSpec.map(\n (spec) => new Set(\n spec.parentAxesSpec\n .map((spec) => canonicalizeJson(getAxisId(spec)))\n .map((el) => {\n const idx = axisKeys.indexOf(el);\n if (idx === -1) {\n throw new Error(`malformed axesSpec: ${JSON.stringify(axesSpec)}, unable to locate parent ${el}`);\n }\n return idx;\n }),\n ),\n );\n\n const allIdxs = [...axesSpec.keys()];\n const groups: number[][] = []; // groups of axis indexes\n\n const usedIdxs = new Set<number>();\n let nextFreeEl = allIdxs.find((idx) => !usedIdxs.has(idx));\n while (nextFreeEl !== undefined) {\n const currentGroup = [nextFreeEl];\n usedIdxs.add(nextFreeEl);\n\n let nextElsOfCurrentGroup = [nextFreeEl];\n while (nextElsOfCurrentGroup.length) {\n const next = new Set<number>();\n for (const groupIdx of nextElsOfCurrentGroup) {\n const groupElementParents = axisParentsIdxs[groupIdx];\n allIdxs.forEach((idx) => {\n if (idx === groupIdx || usedIdxs.has(idx)) {\n return;\n }\n const parents = axisParentsIdxs[idx];\n if (parents.has(groupIdx) || groupElementParents.has(idx)) {\n currentGroup.push(idx);\n next.add(idx);\n usedIdxs.add(idx);\n }\n });\n }\n nextElsOfCurrentGroup = [...next];\n }\n\n groups.push([...currentGroup]);\n nextFreeEl = allIdxs.find((idx) => !usedIdxs.has(idx));\n };\n\n return groups.map((group) => group.map((idx) => axesSpec[idx]));\n }\n\n /** Get all axes that are not parents of any other axis */\n static getAxesRoots(axes: AxisSpecNormalized[]): AxisSpecNormalized[] {\n const parentsSet = new Set(axes.flatMap((axis) => axis.parentAxesSpec).map((spec) => canonicalizeJson(getAxisId(spec))));\n return axes.filter((axis) => !parentsSet.has(canonicalizeJson(getAxisId(axis))));\n }\n}\n"],"names":[],"mappings":";;;MA8Ba,SAAS,CAAA;;AAEX,IAAA,IAAI;AAEb,IAAA,WAAA,CAAY,SAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,IAAI,GAAG,SAAS;IACvB;AAEA,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;IACzB;AAEA,IAAA,IAAI,UAAU,GAAA;AACZ,QAAA,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;IAC7C;IAEA,OAAO,WAAW,CAAC,OAA2B,EAAA;AAC5C,QAAA,MAAM,MAAM,GAAuB,IAAI,GAAG,EAAE;QAC5C,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,kB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C5C,QAAA,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxH,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClF;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"linker_columns.js","sources":["../../../src/drivers/pframe/linker_columns.ts"],"sourcesContent":["import { canonicalizeJson, parseJson, type CanonicalizedJson } from \"../../json\";\nimport {\n Annotation,\n readAnnotationJson,\n type AxisSpec,\n type PColumnIdAndSpec,\n type AxisSpecNormalized,\n type AxisId,\n getAxisId,\n getNormalizedAxesList,\n getArrayFromAxisTree,\n getAxesTree,\n} from \"./spec/spec\";\n\ntype LinkerKey = CanonicalizedJson<AxisId[]>;\nexport type CompositeLinkerMap = Map<\n LinkerKey,\n {\n keyAxesSpec: AxisSpecNormalized[]; // axis specs - source for the key\n linkWith: Map<LinkerKey, PColumnIdAndSpec>; // for every axis (possibly in group with parents - available by linkers another axes and corresponding linkers)\n }\n>;\n\ninterface LinkersData {\n data: CompositeLinkerMap;\n}\nexport class LinkerMap implements LinkersData {\n /** Graph of linkers connected by axes (single or grouped by parents) */\n readonly data: CompositeLinkerMap;\n\n constructor(linkerMap: CompositeLinkerMap) {\n this.data = linkerMap;\n }\n\n get keys() {\n return this.data.keys();\n }\n\n get keyAxesIds() {\n return [...this.data.keys()].map(parseJson);\n }\n\n static fromColumns(columns: PColumnIdAndSpec[]) {\n const result: CompositeLinkerMap = new Map();\n for (const linker of columns.filter(\n (l) => !!readAnnotationJson(l.spec, Annotation.IsLinkerColumn),\n )) {\n const groups = LinkerMap.getAxesGroups(getNormalizedAxesList(linker.spec.axesSpec)); // split input axes into groups by parent links from annotation\n\n if (groups.length !== 2) {\n continue; // not a valid linker column\n }\n const [left, right] = groups;\n\n // In case of group:\n // A - C\n // \\_ B _ D\n // E/\n // put 2 variants as keys:\n // A - C\n // \\_ B _ D\n // and\n // E - B - D\n const leftKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(left).map(\n (axis) => {\n const axes = getArrayFromAxisTree(getAxesTree(axis));\n const key = canonicalizeJson(axes.map(getAxisId));\n return [key, axes];\n },\n );\n const rightKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(\n right,\n ).map((axis) => {\n const axes = getArrayFromAxisTree(getAxesTree(axis));\n const key = canonicalizeJson(axes.map(getAxisId));\n return [key, axes];\n });\n\n for (const [keyLeft, spec] of leftKeyVariants) {\n if (!result.has(keyLeft)) {\n result.set(keyLeft, { keyAxesSpec: spec, linkWith: new Map() });\n }\n }\n for (const [keyRight, spec] of rightKeyVariants) {\n if (!result.has(keyRight)) {\n result.set(keyRight, { keyAxesSpec: spec, linkWith: new Map() });\n }\n }\n for (const [keyLeft] of leftKeyVariants) {\n for (const [keyRight] of rightKeyVariants) {\n result.get(keyLeft)?.linkWith.set(keyRight, linker);\n result.get(keyRight)?.linkWith.set(keyLeft, linker);\n }\n }\n }\n return new this(result);\n }\n\n /** Get all available nodes of linker graphs if start from sourceAxesKeys */\n searchAvailableAxesKeys(sourceAxesKeys: LinkerKey[]): Set<LinkerKey> {\n const startKeys = new Set(sourceAxesKeys);\n const allAvailableKeys = new Set<LinkerKey>();\n let nextKeys = sourceAxesKeys;\n while (nextKeys.length) {\n const next: LinkerKey[] = [];\n for (const key of nextKeys) {\n const node = this.data.get(key);\n if (!node) continue;\n for (const availableKey of node.linkWith.keys()) {\n if (!allAvailableKeys.has(availableKey) && !startKeys.has(availableKey)) {\n next.push(availableKey);\n allAvailableKeys.add(availableKey);\n }\n }\n }\n nextKeys = next;\n }\n return allAvailableKeys;\n }\n\n /** Get all linker columns that are necessary to reach endKey from startKey */\n searchLinkerPath(startKey: LinkerKey, endKey: LinkerKey): PColumnIdAndSpec[] {\n const previous: Record<LinkerKey, LinkerKey> = {};\n let nextIds = new Set([startKey]);\n const visited = new Set([startKey]);\n while (nextIds.size) {\n const next = new Set<LinkerKey>();\n for (const nextId of nextIds) {\n const node = this.data.get(nextId);\n if (!node) continue;\n for (const availableId of node.linkWith.keys()) {\n previous[availableId] = nextId;\n if (availableId === endKey) {\n const ids: LinkerKey[] = [];\n let current = endKey;\n while (previous[current] !== startKey) {\n ids.push(current);\n current = previous[current];\n }\n ids.push(current);\n return ids.map((id: LinkerKey) => this.data.get(id)!.linkWith.get(previous[id])!);\n } else if (!visited.has(availableId)) {\n next.add(availableId);\n visited.add(availableId);\n }\n }\n }\n nextIds = next;\n }\n return [];\n }\n\n getLinkerColumnsForAxes({\n from: sourceAxes,\n to: targetAxes,\n throwWhenNoLinkExists = true,\n }: {\n from: AxisSpecNormalized[];\n to: AxisSpecNormalized[];\n throwWhenNoLinkExists?: boolean;\n }): PColumnIdAndSpec[] {\n // start keys - all possible keys in linker map using sourceAxes (for example, all axes of block's columns or all axes of columns in data-inputs)\n const startKeys: LinkerKey[] = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n\n return Array.from(\n new Map(\n LinkerMap.getAxesRoots(targetAxes)\n .map(LinkerMap.getLinkerKeyFromAxisSpec) // target keys contain all axes to be linked; if some of target axes has parents they must be in the key\n .flatMap((targetKey) => {\n const linkers = startKeys\n .map((startKey) => this.searchLinkerPath(startKey, targetKey))\n .reduce(\n (shortestPath, path) =>\n (shortestPath.length && shortestPath.length < path.length) || !path.length\n ? shortestPath\n : path,\n [] as PColumnIdAndSpec[],\n )\n .map((linker) => [linker.columnId, linker] as const);\n if (!linkers.length && throwWhenNoLinkExists) {\n throw Error(`Unable to find linker column for ${targetKey}`);\n }\n return linkers;\n }),\n ).values(),\n );\n }\n\n /** Get list of axisSpecs from keys of linker columns map */\n getAxesListFromKeysList(keys: LinkerKey[]): AxisSpecNormalized[] {\n return Array.from(\n new Map(\n keys\n .flatMap((key) => this.data.get(key)?.keyAxesSpec ?? [])\n .map((axis) => [canonicalizeJson(getAxisId(axis)), axis]),\n ).values(),\n );\n }\n\n /** Get axes of target axes that are impossible to be linked to source axes with current linker map */\n getNonLinkableAxes(\n sourceAxes: AxisSpecNormalized[],\n targetAxes: AxisSpecNormalized[],\n ): AxisSpecNormalized[] {\n const startKeys = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n // target keys contain all axes to be linked; if some of target axes has parents they must be in the key\n const targetKeys = targetAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n\n const axes = Array.from(\n new Map(\n targetAxes\n .filter((_targetAxis, idx) => {\n const targetKey = targetKeys[idx];\n return !startKeys.some((startKey) => this.searchLinkerPath(startKey, targetKey).length);\n })\n .flatMap((axis) =>\n getArrayFromAxisTree(getAxesTree(axis)).map((axis) => [\n canonicalizeJson(getAxisId(axis)),\n axis,\n ]),\n ),\n ).values(),\n );\n return axes;\n }\n\n /** Get all axes that can be connected to sourceAxes by linkers */\n getReachableByLinkersAxesFromAxesNormalized(\n sourceAxes: AxisSpecNormalized[],\n matchAxisIdFn?: (axisIdOfLinker: AxisId, axisIdOfSource: AxisId) => boolean,\n ): AxisSpecNormalized[] {\n let startKeys: CanonicalizedJson<AxisId[]>[] = [];\n\n if (matchAxisIdFn) {\n const sourceAxisIdsGrouped: AxisId[][] = sourceAxes.map((axis) =>\n getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId),\n );\n for (const sourceAxisIdsGroup of sourceAxisIdsGrouped) {\n const matched = this.keyAxesIds.find((keyIds: AxisId[]) =>\n keyIds.every((linkerKeyAxisId) =>\n sourceAxisIdsGroup.find((sourceAxisId) => matchAxisIdFn(linkerKeyAxisId, sourceAxisId)),\n ),\n );\n if (matched) {\n startKeys.push(canonicalizeJson(matched));\n }\n }\n } else {\n startKeys = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);\n }\n\n const availableKeys = this.searchAvailableAxesKeys(startKeys);\n return this.getAxesListFromKeysList([...availableKeys]);\n }\n\n getReachableByLinkersAxesFromAxes(\n sourceAxes: AxisSpec[],\n matchAxisIdFn?: (axisIdOfLinker: AxisId, axisIdOfSource: AxisId) => boolean,\n ): AxisSpecNormalized[] {\n return this.getReachableByLinkersAxesFromAxesNormalized(\n getNormalizedAxesList(sourceAxes),\n matchAxisIdFn,\n );\n }\n\n static getLinkerKeyFromAxisSpec(axis: AxisSpecNormalized): LinkerKey {\n return canonicalizeJson(getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));\n }\n\n /** Split array of axes into several arrays by parents: axes of one group are parents for each other.\n There are no order inside every group. */\n static getAxesGroups(axesSpec: AxisSpecNormalized[]): AxisSpecNormalized[][] {\n switch (axesSpec.length) {\n case 0:\n return [];\n case 1:\n return [[axesSpec[0]]];\n default:\n break;\n }\n\n const axisKeys = axesSpec.map((spec) => canonicalizeJson(getAxisId(spec)));\n const axisParentsIdxs = axesSpec.map(\n (spec) =>\n new Set(\n spec.parentAxesSpec\n .map((spec) => canonicalizeJson(getAxisId(spec)))\n .map((el) => {\n const idx = axisKeys.indexOf(el);\n if (idx === -1) {\n throw new Error(\n `malformed axesSpec: ${JSON.stringify(axesSpec)}, unable to locate parent ${el}`,\n );\n }\n return idx;\n }),\n ),\n );\n\n const allIdxs = [...axesSpec.keys()];\n const groups: number[][] = []; // groups of axis indexes\n\n const usedIdxs = new Set<number>();\n let nextFreeEl = allIdxs.find((idx) => !usedIdxs.has(idx));\n while (nextFreeEl !== undefined) {\n const currentGroup = [nextFreeEl];\n usedIdxs.add(nextFreeEl);\n\n let nextElsOfCurrentGroup = [nextFreeEl];\n while (nextElsOfCurrentGroup.length) {\n const next = new Set<number>();\n for (const groupIdx of nextElsOfCurrentGroup) {\n const groupElementParents = axisParentsIdxs[groupIdx];\n allIdxs.forEach((idx) => {\n if (idx === groupIdx || usedIdxs.has(idx)) {\n return;\n }\n const parents = axisParentsIdxs[idx];\n if (parents.has(groupIdx) || groupElementParents.has(idx)) {\n currentGroup.push(idx);\n next.add(idx);\n usedIdxs.add(idx);\n }\n });\n }\n nextElsOfCurrentGroup = [...next];\n }\n\n groups.push([...currentGroup]);\n nextFreeEl = allIdxs.find((idx) => !usedIdxs.has(idx));\n }\n\n return groups.map((group) => group.map((idx) => axesSpec[idx]));\n }\n\n /** Get all axes that are not parents of any other axis */\n static getAxesRoots(axes: AxisSpecNormalized[]): AxisSpecNormalized[] {\n const parentsSet = new Set(\n axes.flatMap((axis) => axis.parentAxesSpec).map((spec) => canonicalizeJson(getAxisId(spec))),\n );\n return axes.filter((axis) => !parentsSet.has(canonicalizeJson(getAxisId(axis))));\n }\n}\n"],"names":[],"mappings":";;;MA0Ba,SAAS,CAAA;;AAEX,IAAA,IAAI;AAEb,IAAA,WAAA,CAAY,SAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,IAAI,GAAG,SAAS;IACvB;AAEA,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;IACzB;AAEA,IAAA,IAAI,UAAU,GAAA;AACZ,QAAA,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;IAC7C;IAEA,OAAO,WAAW,CAAC,OAA2B,EAAA;AAC5C,QAAA,MAAM,MAAM,GAAuB,IAAI,GAAG,EAAE;QAC5C,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,CACjC,CAAC,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAC/D,EAAE;AACD,YAAA,MAAM,MAAM,GAAG,SAAS,CAAC,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE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AC7F;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClF;AACD;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { PObjectId } from
|
|
2
|
-
import type { TableRange } from
|
|
3
|
-
import type { FindColumnsRequest, FindColumnsResponse } from
|
|
4
|
-
import type { PColumnIdAndSpec, PColumnSpec } from
|
|
5
|
-
import type { CalculateTableDataRequest, CalculateTableDataResponse } from
|
|
6
|
-
import type { UniqueValuesRequest, UniqueValuesResponse } from
|
|
1
|
+
import type { PObjectId } from "../../pool";
|
|
2
|
+
import type { TableRange } from "./data_types";
|
|
3
|
+
import type { FindColumnsRequest, FindColumnsResponse } from "./find_columns";
|
|
4
|
+
import type { PColumnIdAndSpec, PColumnSpec } from "./spec/spec";
|
|
5
|
+
import type { CalculateTableDataRequest, CalculateTableDataResponse } from "./table_calculate";
|
|
6
|
+
import type { UniqueValuesRequest, UniqueValuesResponse } from "./unique_values";
|
|
7
7
|
/** Read interface exposed by PFrames library */
|
|
8
8
|
export interface PFrame {
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pframe.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/pframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pframe.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/pframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,gDAAgD;AAChD,MAAM,WAAW,MAAM;IACrB;;;SAGK;IACL,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEvE,kCAAkC;IAClC,aAAa,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhE,2EAA2E;IAC3E,WAAW,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAE3C,mFAAmF;IACnF,kBAAkB,CAChB,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAC7C,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAEvC,yFAAyF;IACzF,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC9E;AAED,oDAAoD;AACpD,MAAM,MAAM,SAAS,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./query_spec";
|
|
2
|
+
export * from "./query_data";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PObjectId } from
|
|
2
|
-
import type { JsonDataInfo } from
|
|
3
|
-
import type { AxisValueType, ColumnValueType } from
|
|
1
|
+
import type { PObjectId } from "../../../pool";
|
|
2
|
+
import type { JsonDataInfo } from "../data_info";
|
|
3
|
+
import type { AxisValueType, ColumnValueType } from "../spec";
|
|
4
4
|
/**
|
|
5
5
|
* Specification of column/frame structure.
|
|
6
6
|
*
|
|
@@ -31,7 +31,7 @@ export type TypeSpec = {
|
|
|
31
31
|
* - `exp` - Exponential function (e^x)
|
|
32
32
|
* - `negate` - Negation (-x)
|
|
33
33
|
*/
|
|
34
|
-
export type NumericUnaryOperand =
|
|
34
|
+
export type NumericUnaryOperand = "abs" | "ceil" | "floor" | "round" | "sqrt" | "log" | "log2" | "log10" | "exp" | "negate";
|
|
35
35
|
/**
|
|
36
36
|
* Binary mathematical operation kinds.
|
|
37
37
|
*
|
|
@@ -45,7 +45,7 @@ export type NumericUnaryOperand = 'abs' | 'ceil' | 'floor' | 'round' | 'sqrt' |
|
|
|
45
45
|
* - `div` - Division: left / right (division by zero returns Infinity or NaN)
|
|
46
46
|
* - `mod` - Modulo: left % right
|
|
47
47
|
*/
|
|
48
|
-
export type NumericBinaryOperand =
|
|
48
|
+
export type NumericBinaryOperand = "add" | "sub" | "mul" | "div" | "mod";
|
|
49
49
|
/**
|
|
50
50
|
* Numeric comparison operation kinds.
|
|
51
51
|
*
|
|
@@ -60,7 +60,7 @@ export type NumericBinaryOperand = 'add' | 'sub' | 'mul' | 'div' | 'mod';
|
|
|
60
60
|
* - `gt` - Greater than: left > right
|
|
61
61
|
* - `ge` - Greater or equal: left >= right
|
|
62
62
|
*/
|
|
63
|
-
export type NumericComparisonOperand =
|
|
63
|
+
export type NumericComparisonOperand = "eq" | "ne" | "lt" | "le" | "gt" | "ge";
|
|
64
64
|
/**
|
|
65
65
|
* 2D point coordinates.
|
|
66
66
|
*
|
|
@@ -89,7 +89,7 @@ export type Point2D = {
|
|
|
89
89
|
* { type: 'constant', value: true }
|
|
90
90
|
*/
|
|
91
91
|
export type ExprConstant = {
|
|
92
|
-
type:
|
|
92
|
+
type: "constant";
|
|
93
93
|
value: string | number | boolean;
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
@@ -112,7 +112,7 @@ export type ExprConstant = {
|
|
|
112
112
|
* @see NumericUnaryOperand for available operations
|
|
113
113
|
*/
|
|
114
114
|
export interface ExprNumericUnary<I> {
|
|
115
|
-
type:
|
|
115
|
+
type: "numericUnary";
|
|
116
116
|
/** The mathematical operation to apply */
|
|
117
117
|
operand: NumericUnaryOperand;
|
|
118
118
|
/** Input expression (must evaluate to numeric) */
|
|
@@ -138,7 +138,7 @@ export interface ExprNumericUnary<I> {
|
|
|
138
138
|
* @see NumericBinaryOperand for available operations
|
|
139
139
|
*/
|
|
140
140
|
export interface ExprNumericBinary<I> {
|
|
141
|
-
type:
|
|
141
|
+
type: "numericBinary";
|
|
142
142
|
/** The arithmetic operation to apply */
|
|
143
143
|
operand: NumericBinaryOperand;
|
|
144
144
|
/** Left operand expression */
|
|
@@ -172,7 +172,7 @@ export interface ExprNumericBinary<I> {
|
|
|
172
172
|
* @see NumericComparisonOperand for available operations
|
|
173
173
|
*/
|
|
174
174
|
export interface ExprNumericComparison<I> {
|
|
175
|
-
type:
|
|
175
|
+
type: "numericComparison";
|
|
176
176
|
/** The comparison operation to apply */
|
|
177
177
|
operand: NumericComparisonOperand;
|
|
178
178
|
/** Left operand expression */
|
|
@@ -201,7 +201,7 @@ export interface ExprNumericComparison<I> {
|
|
|
201
201
|
* { type: 'stringEquals', input: nameColumn, value: 'John', caseInsensitive: true }
|
|
202
202
|
*/
|
|
203
203
|
export interface ExprStringEquals<I> {
|
|
204
|
-
type:
|
|
204
|
+
type: "stringEquals";
|
|
205
205
|
/** Input expression (must evaluate to string) */
|
|
206
206
|
input: I;
|
|
207
207
|
/** Reference string to compare against */
|
|
@@ -229,7 +229,7 @@ export interface ExprStringEquals<I> {
|
|
|
229
229
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions | MDN Regular Expressions Guide}
|
|
230
230
|
*/
|
|
231
231
|
export interface ExprStringRegex<I> {
|
|
232
|
-
type:
|
|
232
|
+
type: "stringRegex";
|
|
233
233
|
/** Input expression (must evaluate to string) */
|
|
234
234
|
input: I;
|
|
235
235
|
/** Regular expression pattern */
|
|
@@ -253,7 +253,7 @@ export interface ExprStringRegex<I> {
|
|
|
253
253
|
* { type: 'stringContains', input: descColumn, value: 'ERROR', caseInsensitive: true }
|
|
254
254
|
*/
|
|
255
255
|
export interface ExprStringContains<I> {
|
|
256
|
-
type:
|
|
256
|
+
type: "stringContains";
|
|
257
257
|
/** Input expression (must evaluate to string) */
|
|
258
258
|
input: I;
|
|
259
259
|
/** Substring to search for */
|
|
@@ -296,7 +296,7 @@ export interface ExprStringContains<I> {
|
|
|
296
296
|
* }
|
|
297
297
|
*/
|
|
298
298
|
export interface ExprStringContainsFuzzy<I> {
|
|
299
|
-
type:
|
|
299
|
+
type: "stringContainsFuzzy";
|
|
300
300
|
/** Input expression (must evaluate to string) */
|
|
301
301
|
input: I;
|
|
302
302
|
/** Pattern to match against */
|
|
@@ -335,7 +335,7 @@ export interface ExprStringContainsFuzzy<I> {
|
|
|
335
335
|
* { type: 'not', input: comparisonExpr }
|
|
336
336
|
*/
|
|
337
337
|
export interface ExprLogicalUnary<I> {
|
|
338
|
-
type:
|
|
338
|
+
type: "not";
|
|
339
339
|
/** Input boolean expression to negate */
|
|
340
340
|
input: I;
|
|
341
341
|
}
|
|
@@ -361,7 +361,7 @@ export interface ExprLogicalUnary<I> {
|
|
|
361
361
|
*/
|
|
362
362
|
export interface ExprLogicalVariadic<I> {
|
|
363
363
|
/** Logical operation: 'and' or 'or' */
|
|
364
|
-
type:
|
|
364
|
+
type: "and" | "or";
|
|
365
365
|
/** Array of boolean expressions to combine (minimum 2 elements) */
|
|
366
366
|
input: I[];
|
|
367
367
|
}
|
|
@@ -385,7 +385,7 @@ export interface ExprLogicalVariadic<I> {
|
|
|
385
385
|
* }
|
|
386
386
|
*/
|
|
387
387
|
export interface ExprIsIn<I, T extends string | number> {
|
|
388
|
-
type:
|
|
388
|
+
type: "isIn";
|
|
389
389
|
/** Input expression to test */
|
|
390
390
|
input: I;
|
|
391
391
|
/** Set of allowed values */
|
|
@@ -407,7 +407,7 @@ export interface ExprIsIn<I, T extends string | number> {
|
|
|
407
407
|
* { type: 'axisRef', value: 0 }
|
|
408
408
|
*/
|
|
409
409
|
export interface ExprAxisRef<A> {
|
|
410
|
-
type:
|
|
410
|
+
type: "axisRef";
|
|
411
411
|
/** Axis identifier (selector or index depending on context) */
|
|
412
412
|
value: A;
|
|
413
413
|
}
|
|
@@ -427,34 +427,34 @@ export interface ExprAxisRef<A> {
|
|
|
427
427
|
* { type: 'columnRef', value: 0 }
|
|
428
428
|
*/
|
|
429
429
|
export interface ExprColumnRef<C> {
|
|
430
|
-
type:
|
|
430
|
+
type: "columnRef";
|
|
431
431
|
/** Column identifier (ID or index depending on context) */
|
|
432
432
|
value: C;
|
|
433
433
|
}
|
|
434
434
|
export type InferBooleanExpressionUnion<E> = [
|
|
435
435
|
E extends ExprNumericComparison<unknown> ? Extract<E, {
|
|
436
|
-
type:
|
|
436
|
+
type: "numericComparison";
|
|
437
437
|
}> : never,
|
|
438
438
|
E extends ExprStringEquals<unknown> ? Extract<E, {
|
|
439
|
-
type:
|
|
439
|
+
type: "stringEquals";
|
|
440
440
|
}> : never,
|
|
441
441
|
E extends ExprStringContains<unknown> ? Extract<E, {
|
|
442
|
-
type:
|
|
442
|
+
type: "stringContains";
|
|
443
443
|
}> : never,
|
|
444
444
|
E extends ExprStringContainsFuzzy<unknown> ? Extract<E, {
|
|
445
|
-
type:
|
|
445
|
+
type: "stringContainsFuzzy";
|
|
446
446
|
}> : never,
|
|
447
447
|
E extends ExprStringRegex<unknown> ? Extract<E, {
|
|
448
|
-
type:
|
|
448
|
+
type: "stringRegex";
|
|
449
449
|
}> : never,
|
|
450
450
|
E extends ExprLogicalUnary<unknown> ? Extract<E, {
|
|
451
|
-
type:
|
|
451
|
+
type: "not";
|
|
452
452
|
}> : never,
|
|
453
453
|
E extends ExprLogicalVariadic<unknown> ? Extract<E, {
|
|
454
|
-
type:
|
|
454
|
+
type: "and" | "or";
|
|
455
455
|
}> : never,
|
|
456
456
|
E extends ExprIsIn<unknown, string | number> ? Extract<E, {
|
|
457
|
-
type:
|
|
457
|
+
type: "isIn";
|
|
458
458
|
}> : never
|
|
459
459
|
][number];
|
|
460
460
|
/**
|
|
@@ -475,7 +475,7 @@ export type InferBooleanExpressionUnion<E> = [
|
|
|
475
475
|
* { type: 'axis', id: 0 }
|
|
476
476
|
*/
|
|
477
477
|
export interface QueryAxisSelector<A> {
|
|
478
|
-
type:
|
|
478
|
+
type: "axis";
|
|
479
479
|
/** Axis identifier (name or index depending on context) */
|
|
480
480
|
id: A;
|
|
481
481
|
}
|
|
@@ -497,7 +497,7 @@ export interface QueryAxisSelector<A> {
|
|
|
497
497
|
* { type: 'column', id: 0 }
|
|
498
498
|
*/
|
|
499
499
|
export interface QueryColumnSelector<C> {
|
|
500
|
-
type:
|
|
500
|
+
type: "column";
|
|
501
501
|
/** Column identifier (name or index depending on context) */
|
|
502
502
|
id: C;
|
|
503
503
|
}
|
|
@@ -528,7 +528,7 @@ export interface QueryColumnSelector<C> {
|
|
|
528
528
|
* // Result has all samples; annotations/metadata are null where not available
|
|
529
529
|
*/
|
|
530
530
|
export interface QueryOuterJoin<JE extends QueryJoinEntry<unknown>> {
|
|
531
|
-
type:
|
|
531
|
+
type: "outerJoin";
|
|
532
532
|
/** Primary query - all its records are preserved */
|
|
533
533
|
primary: JE;
|
|
534
534
|
/** Secondary queries - joined where keys match, null where they don't */
|
|
@@ -560,7 +560,7 @@ export interface QueryOuterJoin<JE extends QueryJoinEntry<unknown>> {
|
|
|
560
560
|
* }
|
|
561
561
|
*/
|
|
562
562
|
export interface QuerySliceAxes<Q, A extends QueryAxisSelector<unknown>> {
|
|
563
|
-
type:
|
|
563
|
+
type: "sliceAxes";
|
|
564
564
|
/** Input query to slice */
|
|
565
565
|
input: Q;
|
|
566
566
|
/** List of axis filters to apply (at least one required) */
|
|
@@ -598,7 +598,7 @@ export interface QuerySliceAxes<Q, A extends QueryAxisSelector<unknown>> {
|
|
|
598
598
|
* }
|
|
599
599
|
*/
|
|
600
600
|
export interface QuerySort<Q, E> {
|
|
601
|
-
type:
|
|
601
|
+
type: "sort";
|
|
602
602
|
/** Input query to sort */
|
|
603
603
|
input: Q;
|
|
604
604
|
/** Sort criteria in priority order (at least one required) */
|
|
@@ -648,7 +648,7 @@ export interface QuerySort<Q, E> {
|
|
|
648
648
|
* }
|
|
649
649
|
*/
|
|
650
650
|
export interface QueryFilter<Q, E> {
|
|
651
|
-
type:
|
|
651
|
+
type: "filter";
|
|
652
652
|
/** Input query to filter */
|
|
653
653
|
input: Q;
|
|
654
654
|
/** Boolean predicate expression - only true records pass */
|
|
@@ -668,7 +668,7 @@ export interface QueryFilter<Q, E> {
|
|
|
668
668
|
* { type: 'column', columnId: 'col_abc123' }
|
|
669
669
|
*/
|
|
670
670
|
export interface QueryColumn {
|
|
671
|
-
type:
|
|
671
|
+
type: "column";
|
|
672
672
|
/** Unique identifier of the column to reference */
|
|
673
673
|
columnId: PObjectId;
|
|
674
674
|
}
|
|
@@ -692,7 +692,7 @@ export interface QueryColumn {
|
|
|
692
692
|
* }
|
|
693
693
|
*/
|
|
694
694
|
export interface QueryInlineColumn<T> {
|
|
695
|
-
type:
|
|
695
|
+
type: "inlineColumn";
|
|
696
696
|
/** Type specification defining axes and column types */
|
|
697
697
|
spec: T;
|
|
698
698
|
/** Data information containing or referencing the actual values */
|
|
@@ -724,7 +724,7 @@ export interface QueryInlineColumn<T> {
|
|
|
724
724
|
* }
|
|
725
725
|
*/
|
|
726
726
|
export interface QuerySparseToDenseColumn<SO> {
|
|
727
|
-
type:
|
|
727
|
+
type: "sparseToDenseColumn";
|
|
728
728
|
/** ID of the column to cross-join */
|
|
729
729
|
columnId: PObjectId;
|
|
730
730
|
/** Optional override for the column specification */
|
|
@@ -767,7 +767,7 @@ export interface QuerySparseToDenseColumn<SO> {
|
|
|
767
767
|
*/
|
|
768
768
|
export interface QuerySymmetricJoin<JE extends QueryJoinEntry<unknown>> {
|
|
769
769
|
/** 'innerJoin' for intersection, 'fullJoin' for union with nulls */
|
|
770
|
-
type:
|
|
770
|
+
type: "innerJoin" | "fullJoin";
|
|
771
771
|
/** Queries to join (at least one required) */
|
|
772
772
|
entries: JE[];
|
|
773
773
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PObjectId } from
|
|
2
|
-
import type { ExprAxisRef, ExprColumnRef, ExprNumericBinary, ExprConstant, ExprIsIn, ExprLogicalUnary, ExprLogicalVariadic, ExprStringContains, ExprStringContainsFuzzy, ExprStringEquals, ExprStringRegex, ExprNumericUnary, QueryAxisSelector, QueryColumn, QuerySparseToDenseColumn, QueryFilter, QueryInlineColumn, QueryJoinEntry, QueryOuterJoin, QuerySliceAxes, QuerySort, QuerySymmetricJoin, TypeSpec, InferBooleanExpressionUnion } from
|
|
1
|
+
import type { PObjectId } from "../../../pool";
|
|
2
|
+
import type { ExprAxisRef, ExprColumnRef, ExprNumericBinary, ExprConstant, ExprIsIn, ExprLogicalUnary, ExprLogicalVariadic, ExprStringContains, ExprStringContainsFuzzy, ExprStringEquals, ExprStringRegex, ExprNumericUnary, QueryAxisSelector, QueryColumn, QuerySparseToDenseColumn, QueryFilter, QueryInlineColumn, QueryJoinEntry, QueryOuterJoin, QuerySliceAxes, QuerySort, QuerySymmetricJoin, TypeSpec, InferBooleanExpressionUnion } from "./query_common";
|
|
3
3
|
/**
|
|
4
4
|
* Column identifier with type specification.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query_data.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/query/query_data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,
|
|
1
|
+
{"version":3,"file":"query_data.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/query/query_data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,QAAQ,EACR,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,KAAK,mBAAmB,GAAG;IACzB,sCAAsC;IACtC,EAAE,EAAE,SAAS,CAAC;IACd,wDAAwD;IACxD,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,SAAS,CAAC;IACnE,yDAAyD;IACzD,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,uBAAuB;AACvB,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAC1C,6BAA6B;AAC7B,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AAC3E,oCAAoC;AACpC,MAAM,MAAM,4BAA4B,GAAG,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;AACzF,8B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,2BAA2B,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PObjectId } from
|
|
2
|
-
import type { ExprAxisRef, ExprColumnRef, ExprNumericBinary, ExprConstant, ExprIsIn, ExprLogicalUnary, ExprLogicalVariadic, ExprStringContains, ExprStringContainsFuzzy, ExprStringEquals, ExprStringRegex, ExprNumericUnary, QueryAxisSelector, QueryColumn, QuerySparseToDenseColumn, QueryFilter, QueryInlineColumn, QueryJoinEntry, QueryOuterJoin, QuerySliceAxes, QuerySort, QuerySymmetricJoin, InferBooleanExpressionUnion } from
|
|
3
|
-
import type { Domain, PColumnIdAndSpec, PColumnSpec, SingleAxisSelector } from
|
|
1
|
+
import type { PObjectId } from "../../../pool";
|
|
2
|
+
import type { ExprAxisRef, ExprColumnRef, ExprNumericBinary, ExprConstant, ExprIsIn, ExprLogicalUnary, ExprLogicalVariadic, ExprStringContains, ExprStringContainsFuzzy, ExprStringEquals, ExprStringRegex, ExprNumericUnary, QueryAxisSelector, QueryColumn, QuerySparseToDenseColumn, QueryFilter, QueryInlineColumn, QueryJoinEntry, QueryOuterJoin, QuerySliceAxes, QuerySort, QuerySymmetricJoin, InferBooleanExpressionUnion } from "./query_common";
|
|
3
|
+
import type { Domain, PColumnIdAndSpec, PColumnSpec, SingleAxisSelector } from "../spec";
|
|
4
4
|
/**
|
|
5
5
|
* Column identifier with specification.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query_spec.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/query/query_spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,
|
|
1
|
+
{"version":3,"file":"query_spec.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/query/query_spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,KAAK,eAAe,GAAG;IACrB,sCAAsC;IACtC,EAAE,EAAE,SAAS,CAAC;IACd,8DAA8D;IAC9D,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG;IAC3D,6DAA6D;IAC7D,cAAc,EAAE;QACd,sDAAsD;QACtD,IAAI,EAAE,kBAAkB,CAAC;QACzB,kDAAkD;QAClD,iBAAiB,EAAE,MAAM,CAAC;KAC3B,EAAE,CAAC;CACL,CAAC;AAEF,uBAAuB;AACvB,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAC1C,6BAA6B;AAC7B,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC;AACvE,oCAAoC;AACpC,MAAM,MAAM,4BAA4B,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;AACtF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A0B,GAAG,2BAA2B,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -108,7 +108,7 @@ class AnchoredIdDeriver {
|
|
|
108
108
|
for (const filter of axisFilters) {
|
|
109
109
|
const [axisIdOrIndex, value] = filter;
|
|
110
110
|
// If it's already a numeric index, validate it
|
|
111
|
-
if (typeof axisIdOrIndex ===
|
|
111
|
+
if (typeof axisIdOrIndex === "number") {
|
|
112
112
|
if (axisIdOrIndex < 0 || axisIdOrIndex >= spec$1.axesSpec.length) {
|
|
113
113
|
throw new Error(`Axis index ${axisIdOrIndex} is out of bounds (0-${spec$1.axesSpec.length - 1})`);
|
|
114
114
|
}
|
|
@@ -163,7 +163,7 @@ function resolveAnchors(anchors, matcher, options) {
|
|
|
163
163
|
if (result.domain) {
|
|
164
164
|
const resolvedDomain = {};
|
|
165
165
|
for (const [key, value] of Object.entries(result.domain)) {
|
|
166
|
-
if (typeof value ===
|
|
166
|
+
if (typeof value === "string") {
|
|
167
167
|
resolvedDomain[key] = value;
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
@@ -196,13 +196,13 @@ function resolveAxisReference(anchors, axisRef) {
|
|
|
196
196
|
const anchorSpec = anchors[anchorId];
|
|
197
197
|
if (!anchorSpec)
|
|
198
198
|
throw new Error(`Anchor "${anchorId}" not found for axis reference`);
|
|
199
|
-
if (
|
|
199
|
+
if ("idx" in axisRef) {
|
|
200
200
|
// AnchorAxisRefByIdx
|
|
201
201
|
if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)
|
|
202
202
|
throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor "${anchorId}"`);
|
|
203
203
|
return anchorSpec.axesSpec[axisRef.idx];
|
|
204
204
|
}
|
|
205
|
-
else if (
|
|
205
|
+
else if ("name" in axisRef) {
|
|
206
206
|
// AnchorAxisRefByName
|
|
207
207
|
const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);
|
|
208
208
|
if (matches.length > 1)
|
|
@@ -211,7 +211,7 @@ function resolveAxisReference(anchors, axisRef) {
|
|
|
211
211
|
throw new Error(`Axis with name "${axisRef.name}" not found in anchor "${anchorId}"`);
|
|
212
212
|
return matches[0];
|
|
213
213
|
}
|
|
214
|
-
else if (
|
|
214
|
+
else if ("id" in axisRef) {
|
|
215
215
|
// AnchorAxisRefByMatcher
|
|
216
216
|
const matches = anchorSpec.axesSpec.filter((axis) => spec.matchAxisId(axisRef.id, spec.getAxisId(axis)));
|
|
217
217
|
if (matches.length > 1)
|
|
@@ -226,7 +226,7 @@ function resolveAxisReference(anchors, axisRef) {
|
|
|
226
226
|
* Type guard to check if a value is an anchored axis reference
|
|
227
227
|
*/
|
|
228
228
|
function isAnchorAxisRef(value) {
|
|
229
|
-
return typeof value ===
|
|
229
|
+
return typeof value === "object" && "anchor" in value;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
exports.AnchoredIdDeriver = AnchoredIdDeriver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchored.cjs","sources":["../../../../src/drivers/pframe/spec/anchored.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\nimport type { AxisFilter, AxisFilterValue } from './filtered_column';\nimport type { SUniversalPColumnId, UniversalPColumnId } from './ids';\nimport { stringifyColumnId } from './ids';\nimport type { AAxisSelector, AnchorAxisRef, AnchorAxisRefByIdx, AnchoredPColumnId, AnchoredPColumnSelector, AxisSelector, PColumnSelector } from './selectors';\nimport type { AxisId, PColumnSpec } from './spec';\nimport { getAxisId, matchAxisId } from './spec';\n\n//\n// Helper functions\n//\n\nfunction axisKey(axis: AxisId): string {\n return canonicalize(getAxisId(axis))!;\n}\n\nfunction domainKey(key: string, value: string): string {\n return JSON.stringify([key, value]);\n}\n\n/**\n * Context for resolving and generating anchored references to columns and axes\n * Maintains maps of known domain values and axes that can be referenced by anchors\n */\nexport class AnchoredIdDeriver {\n private readonly domains = new Map<string, string>();\n private readonly axes = new Map<string, AnchorAxisRefByIdx>();\n /**\n * Domain packs are used to group domain keys that can be anchored to the same anchor\n * This is used to optimize the lookup of domain anchors\n */\n private readonly domainPacks: string[][] = [];\n /**\n * Maps domain packs to anchors\n */\n private readonly domainPackToAnchor = new Map<string, string>();\n\n /**\n * Creates a new anchor context from a set of anchor column specifications\n * @param anchors Record of anchor column specifications indexed by anchor ID\n */\n constructor(public readonly anchors: Record<string, PColumnSpec>) {\n const anchorEntries = Object.entries(anchors);\n anchorEntries.sort((a, b) => a[0].localeCompare(b[0]));\n for (const [anchorId, spec] of anchorEntries) {\n for (let axisIdx = 0; axisIdx < spec.axesSpec.length; axisIdx++) {\n const axis = spec.axesSpec[axisIdx];\n const key = axisKey(axis);\n this.axes.set(key, { anchor: anchorId, idx: axisIdx });\n }\n if (spec.domain !== undefined) {\n const domainEntries = Object.entries(spec.domain);\n domainEntries.sort((a, b) => a[0].localeCompare(b[0]));\n\n this.domainPackToAnchor.set(JSON.stringify(domainEntries), anchorId);\n this.domainPacks.push(domainEntries.map(([dKey]) => dKey));\n\n for (const [dKey, dValue] of domainEntries) {\n const key = domainKey(dKey, dValue);\n this.domains.set(key, anchorId);\n }\n }\n }\n }\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @returns An anchored column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec): AnchoredPColumnId;\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @param axisFilters Axis filters to apply to the column\n * @returns An anchored and sliced column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId;\n\n /**\n * Implementation of derive method\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId {\n const result: AnchoredPColumnId = {\n name: spec.name,\n axes: [],\n };\n\n let skipDomains: Set<string> | undefined = undefined;\n if (spec.domain !== undefined) {\n outer:\n for (const domainPack of this.domainPacks) {\n const dAnchor: string[][] = [];\n for (const domainKey of domainPack) {\n const dValue = spec.domain[domainKey];\n if (dValue !== undefined)\n dAnchor.push([domainKey, dValue]);\n else\n break outer;\n }\n const domainAnchor = this.domainPackToAnchor.get(JSON.stringify(dAnchor));\n if (domainAnchor !== undefined) {\n result.domainAnchor = domainAnchor;\n skipDomains = new Set(domainPack);\n break;\n }\n }\n }\n\n for (const [dKey, dValue] of Object.entries(spec.domain ?? {})) {\n if (skipDomains !== undefined && skipDomains.has(dKey))\n continue;\n const key = domainKey(dKey, dValue);\n const anchorId = this.domains.get(key);\n result.domain ??= {};\n result.domain[dKey] = anchorId ? { anchor: anchorId } : dValue;\n }\n\n result.axes = spec.axesSpec.map((axis) => {\n const key = axisKey(axis);\n const anchorAxisRef = this.axes.get(key);\n if (anchorAxisRef === undefined) return getAxisId(axis);\n else return anchorAxisRef;\n });\n\n // If no axis filters are provided, return the anchored ID as is\n if (!axisFilters || axisFilters.length === 0) {\n return result;\n }\n\n // Process axis filters and create a sliced column ID\n const resolvedFilters: [number, AxisFilterValue][] = [];\n\n for (const filter of axisFilters) {\n const [axisIdOrIndex, value] = filter;\n\n // If it's already a numeric index, validate it\n if (typeof axisIdOrIndex === 'number') {\n if (axisIdOrIndex < 0 || axisIdOrIndex >= spec.axesSpec.length) {\n throw new Error(`Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`);\n }\n resolvedFilters.push([axisIdOrIndex, value]);\n } else {\n // If it's a string (axis name), resolve it to an index\n const axisIndex = spec.axesSpec.findIndex((axis) => axis.name === axisIdOrIndex);\n if (axisIndex === -1) {\n throw new Error(`Axis with name \"${axisIdOrIndex}\" not found in the column specification`);\n }\n resolvedFilters.push([axisIndex, value]);\n }\n }\n\n // Sort filters by axis index to ensure consistency\n resolvedFilters.sort((a, b) => a[0] - b[0]);\n\n return {\n source: result,\n axisFilters: resolvedFilters,\n };\n }\n\n /**\n * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column\n * @param spec Column specification to anchor\n * @param axisFilters Optional axis filters to apply to the column\n * @returns A canonicalized string representation of the anchored column identifier\n */\n deriveS(spec: PColumnSpec, axisFilters?: AxisFilter[]): SUniversalPColumnId {\n return stringifyColumnId(this.derive(spec, axisFilters));\n }\n}\n\n/**\n * Options for the resolveAnchors function\n */\nexport type ResolveAnchorsOptions = {\n /**\n * If true, missing domain keys in anchors will be ignored.\n * If false (default), an error will be thrown.\n */\n ignoreMissingDomains?: boolean;\n};\n\n/**\n * Resolves anchored references in a column matcher to create a non-anchored matcher.\n * Doing an opposite operation to {@link AnchorIdDeriver.derive()}.\n *\n * @param anchors - Record of anchor column specifications indexed by anchor id\n * @param matcher - An anchored column matcher (or id, which is subtype of it) containing references that need to be resolved\n * @param options - Options for resolving anchors\n * @returns A non-anchored column matcher with all references resolved to actual values\n */\nexport function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: AnchoredPColumnSelector, options?: ResolveAnchorsOptions): PColumnSelector {\n const result = { ...matcher };\n const ignoreMissingDomains = options?.ignoreMissingDomains ?? false;\n\n if (result.domainAnchor !== undefined) {\n const anchorSpec = anchors[result.domainAnchor];\n if (!anchorSpec)\n throw new Error(`Anchor \"${result.domainAnchor}\" not found`);\n\n const anchorDomains = anchorSpec.domain || {};\n result.domain = { ...anchorDomains, ...result.domain };\n delete result.domainAnchor;\n }\n\n if (result.domain) {\n const resolvedDomain: Record<string, string> = {};\n for (const [key, value] of Object.entries(result.domain)) {\n if (typeof value === 'string') {\n resolvedDomain[key] = value;\n } else {\n // It's an AnchorDomainRef\n const anchorSpec = anchors[value.anchor];\n if (!anchorSpec)\n throw new Error(`Anchor \"${value.anchor}\" not found for domain key \"${key}\"`);\n\n if (!anchorSpec.domain || anchorSpec.domain[key] === undefined) {\n if (!ignoreMissingDomains)\n throw new Error(`Domain key \"${key}\" not found in anchor \"${value.anchor}\"`);\n continue;\n }\n\n resolvedDomain[key] = anchorSpec.domain[key];\n }\n }\n result.domain = resolvedDomain;\n }\n\n if (result.axes)\n result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));\n\n return result as PColumnSelector;\n}\n\n/**\n * Resolves an anchored axis reference to a concrete AxisId\n */\nfunction resolveAxisReference(anchors: Record<string, PColumnSpec>, axisRef: AAxisSelector): AxisSelector {\n if (!isAnchorAxisRef(axisRef))\n return axisRef;\n\n // It's an anchored reference\n const anchorId = axisRef.anchor;\n const anchorSpec = anchors[anchorId];\n if (!anchorSpec)\n throw new Error(`Anchor \"${anchorId}\" not found for axis reference`);\n\n if ('idx' in axisRef) {\n // AnchorAxisRefByIdx\n if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)\n throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor \"${anchorId}\"`);\n return anchorSpec.axesSpec[axisRef.idx];\n } else if ('name' in axisRef) {\n // AnchorAxisRefByName\n const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);\n if (matches.length > 1)\n throw new Error(`Multiple axes with name \"${axisRef.name}\" found in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`Axis with name \"${axisRef.name}\" not found in anchor \"${anchorId}\"`);\n return matches[0];\n } else if ('id' in axisRef) {\n // AnchorAxisRefByMatcher\n const matches = anchorSpec.axesSpec.filter((axis) => matchAxisId(axisRef.id, getAxisId(axis)));\n if (matches.length > 1)\n throw new Error(`Multiple matching axes found for matcher in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`No matching axis found for matcher in anchor \"${anchorId}\"`);\n return matches[0];\n }\n\n throw new Error(`Unsupported axis reference type`);\n}\n\n/**\n * Type guard to check if a value is an anchored axis reference\n */\nfunction isAnchorAxisRef(value: AAxisSelector): value is AnchorAxisRef {\n return typeof value === 'object' && 'anchor' in value;\n}\n"],"names":["getAxisId","spec","stringifyColumnId","matchAxisId"],"mappings":";;;;;;AAQA;AACA;AACA;AAEA,SAAS,OAAO,CAAC,IAAY,EAAA;AAC3B,IAAA,OAAO,YAAY,CAACA,cAAS,CAAC,IAAI,CAAC,CAAE;AACvC;AAEA,S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,OAAO,CAAC,IAAI,CAAC;AAChF,QAAA,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,OAAO,CAAC,IAAI,CAAA,mBAAA,EAAsB,QAAQ,CAAA,CAAA,CAAG,CAAC;AAC5F,QAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,CAAA,gBAAA,EAAmB,OAAO,CAAC,IAAI,CAAA,uBAAA,EAA0B,QAAQ,CAAA,CAAA,CAAG,CAAC;AACvF,QAAA,OAAO,OAAO,CAAC,CAAC,CAAC;IACnB;AAAO,SAAA,IAAI,IAAI,IAAI,OAAO,EAAE;;QAE1B,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,KAAKC,gBAAW,CAAC,OAAO,CAAC,EAAE,EAAEH,cAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9F,QAAA,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;AACpB,YAAA,MAAM,IAAI,KAAK,CAAC,uDAAuD,QAAQ,CAAA,CAAA,CAAG,CAAC;AACrF,QAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,QAAQ,CAAA,CAAA,CAAG,CAAC;AAC/E,QAAA,OAAO,OAAO,CAAC,CAAC,CAAC;IACnB;AAEA,IAAA,MAAM,IAAI,KAAK,CAAC,CAAA,+BAAA,CAAiC,CAAC;AACpD;AAEA;;AAEG;AACH,SAAS,eAAe,CAAC,KAAoB,EAAA;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK;AACvD;;;;;"}
|
|
1
|
+
{"version":3,"file":"anchored.cjs","sources":["../../../../src/drivers/pframe/spec/anchored.ts"],"sourcesContent":["import canonicalize from \"canonicalize\";\nimport type { AxisFilter, AxisFilterValue } from \"./filtered_column\";\nimport type { SUniversalPColumnId, UniversalPColumnId } from \"./ids\";\nimport { stringifyColumnId } from \"./ids\";\nimport type {\n AAxisSelector,\n AnchorAxisRef,\n AnchorAxisRefByIdx,\n AnchoredPColumnId,\n AnchoredPColumnSelector,\n AxisSelector,\n PColumnSelector,\n} from \"./selectors\";\nimport type { AxisId, PColumnSpec } from \"./spec\";\nimport { getAxisId, matchAxisId } from \"./spec\";\n\n//\n// Helper functions\n//\n\nfunction axisKey(axis: AxisId): string {\n return canonicalize(getAxisId(axis))!;\n}\n\nfunction domainKey(key: string, value: string): string {\n return JSON.stringify([key, value]);\n}\n\n/**\n * Context for resolving and generating anchored references to columns and axes\n * Maintains maps of known domain values and axes that can be referenced by anchors\n */\nexport class AnchoredIdDeriver {\n private readonly domains = new Map<string, string>();\n private readonly axes = new Map<string, AnchorAxisRefByIdx>();\n /**\n * Domain packs are used to group domain keys that can be anchored to the same anchor\n * This is used to optimize the lookup of domain anchors\n */\n private readonly domainPacks: string[][] = [];\n /**\n * Maps domain packs to anchors\n */\n private readonly domainPackToAnchor = new Map<string, string>();\n\n /**\n * Creates a new anchor context from a set of anchor column specifications\n * @param anchors Record of anchor column specifications indexed by anchor ID\n */\n constructor(public readonly anchors: Record<string, PColumnSpec>) {\n const anchorEntries = Object.entries(anchors);\n anchorEntries.sort((a, b) => a[0].localeCompare(b[0]));\n for (const [anchorId, spec] of anchorEntries) {\n for (let axisIdx = 0; axisIdx < spec.axesSpec.length; axisIdx++) {\n const axis = spec.axesSpec[axisIdx];\n const key = axisKey(axis);\n this.axes.set(key, { anchor: anchorId, idx: axisIdx });\n }\n if (spec.domain !== undefined) {\n const domainEntries = Object.entries(spec.domain);\n domainEntries.sort((a, b) => a[0].localeCompare(b[0]));\n\n this.domainPackToAnchor.set(JSON.stringify(domainEntries), anchorId);\n this.domainPacks.push(domainEntries.map(([dKey]) => dKey));\n\n for (const [dKey, dValue] of domainEntries) {\n const key = domainKey(dKey, dValue);\n this.domains.set(key, anchorId);\n }\n }\n }\n }\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @returns An anchored column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec): AnchoredPColumnId;\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @param axisFilters Axis filters to apply to the column\n * @returns An anchored and sliced column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId;\n\n /**\n * Implementation of derive method\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId {\n const result: AnchoredPColumnId = {\n name: spec.name,\n axes: [],\n };\n\n let skipDomains: Set<string> | undefined = undefined;\n if (spec.domain !== undefined) {\n outer: for (const domainPack of this.domainPacks) {\n const dAnchor: string[][] = [];\n for (const domainKey of domainPack) {\n const dValue = spec.domain[domainKey];\n if (dValue !== undefined) dAnchor.push([domainKey, dValue]);\n else break outer;\n }\n const domainAnchor = this.domainPackToAnchor.get(JSON.stringify(dAnchor));\n if (domainAnchor !== undefined) {\n result.domainAnchor = domainAnchor;\n skipDomains = new Set(domainPack);\n break;\n }\n }\n }\n\n for (const [dKey, dValue] of Object.entries(spec.domain ?? {})) {\n if (skipDomains !== undefined && skipDomains.has(dKey)) continue;\n const key = domainKey(dKey, dValue);\n const anchorId = this.domains.get(key);\n result.domain ??= {};\n result.domain[dKey] = anchorId ? { anchor: anchorId } : dValue;\n }\n\n result.axes = spec.axesSpec.map((axis) => {\n const key = axisKey(axis);\n const anchorAxisRef = this.axes.get(key);\n if (anchorAxisRef === undefined) return getAxisId(axis);\n else return anchorAxisRef;\n });\n\n // If no axis filters are provided, return the anchored ID as is\n if (!axisFilters || axisFilters.length === 0) {\n return result;\n }\n\n // Process axis filters and create a sliced column ID\n const resolvedFilters: [number, AxisFilterValue][] = [];\n\n for (const filter of axisFilters) {\n const [axisIdOrIndex, value] = filter;\n\n // If it's already a numeric index, validate it\n if (typeof axisIdOrIndex === \"number\") {\n if (axisIdOrIndex < 0 || axisIdOrIndex >= spec.axesSpec.length) {\n throw new Error(\n `Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`,\n );\n }\n resolvedFilters.push([axisIdOrIndex, value]);\n } else {\n // If it's a string (axis name), resolve it to an index\n const axisIndex = spec.axesSpec.findIndex((axis) => axis.name === axisIdOrIndex);\n if (axisIndex === -1) {\n throw new Error(\n `Axis with name \"${axisIdOrIndex}\" not found in the column specification`,\n );\n }\n resolvedFilters.push([axisIndex, value]);\n }\n }\n\n // Sort filters by axis index to ensure consistency\n resolvedFilters.sort((a, b) => a[0] - b[0]);\n\n return {\n source: result,\n axisFilters: resolvedFilters,\n };\n }\n\n /**\n * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column\n * @param spec Column specification to anchor\n * @param axisFilters Optional axis filters to apply to the column\n * @returns A canonicalized string representation of the anchored column identifier\n */\n deriveS(spec: PColumnSpec, axisFilters?: AxisFilter[]): SUniversalPColumnId {\n return stringifyColumnId(this.derive(spec, axisFilters));\n }\n}\n\n/**\n * Options for the resolveAnchors function\n */\nexport type ResolveAnchorsOptions = {\n /**\n * If true, missing domain keys in anchors will be ignored.\n * If false (default), an error will be thrown.\n */\n ignoreMissingDomains?: boolean;\n};\n\n/**\n * Resolves anchored references in a column matcher to create a non-anchored matcher.\n * Doing an opposite operation to {@link AnchorIdDeriver.derive()}.\n *\n * @param anchors - Record of anchor column specifications indexed by anchor id\n * @param matcher - An anchored column matcher (or id, which is subtype of it) containing references that need to be resolved\n * @param options - Options for resolving anchors\n * @returns A non-anchored column matcher with all references resolved to actual values\n */\nexport function resolveAnchors(\n anchors: Record<string, PColumnSpec>,\n matcher: AnchoredPColumnSelector,\n options?: ResolveAnchorsOptions,\n): PColumnSelector {\n const result = { ...matcher };\n const ignoreMissingDomains = options?.ignoreMissingDomains ?? false;\n\n if (result.domainAnchor !== undefined) {\n const anchorSpec = anchors[result.domainAnchor];\n if (!anchorSpec) throw new Error(`Anchor \"${result.domainAnchor}\" not found`);\n\n const anchorDomains = anchorSpec.domain || {};\n result.domain = { ...anchorDomains, ...result.domain };\n delete result.domainAnchor;\n }\n\n if (result.domain) {\n const resolvedDomain: Record<string, string> = {};\n for (const [key, value] of Object.entries(result.domain)) {\n if (typeof value === \"string\") {\n resolvedDomain[key] = value;\n } else {\n // It's an AnchorDomainRef\n const anchorSpec = anchors[value.anchor];\n if (!anchorSpec)\n throw new Error(`Anchor \"${value.anchor}\" not found for domain key \"${key}\"`);\n\n if (!anchorSpec.domain || anchorSpec.domain[key] === undefined) {\n if (!ignoreMissingDomains)\n throw new Error(`Domain key \"${key}\" not found in anchor \"${value.anchor}\"`);\n continue;\n }\n\n resolvedDomain[key] = anchorSpec.domain[key];\n }\n }\n result.domain = resolvedDomain;\n }\n\n if (result.axes) result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));\n\n return result as PColumnSelector;\n}\n\n/**\n * Resolves an anchored axis reference to a concrete AxisId\n */\nfunction resolveAxisReference(\n anchors: Record<string, PColumnSpec>,\n axisRef: AAxisSelector,\n): AxisSelector {\n if (!isAnchorAxisRef(axisRef)) return axisRef;\n\n // It's an anchored reference\n const anchorId = axisRef.anchor;\n const anchorSpec = anchors[anchorId];\n if (!anchorSpec) throw new Error(`Anchor \"${anchorId}\" not found for axis reference`);\n\n if (\"idx\" in axisRef) {\n // AnchorAxisRefByIdx\n if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)\n throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor \"${anchorId}\"`);\n return anchorSpec.axesSpec[axisRef.idx];\n } else if (\"name\" in axisRef) {\n // AnchorAxisRefByName\n const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);\n if (matches.length > 1)\n throw new Error(`Multiple axes with name \"${axisRef.name}\" found in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`Axis with name \"${axisRef.name}\" not found in anchor \"${anchorId}\"`);\n return matches[0];\n } else if (\"id\" in axisRef) {\n // AnchorAxisRefByMatcher\n const matches = anchorSpec.axesSpec.filter((axis) => matchAxisId(axisRef.id, getAxisId(axis)));\n if (matches.length > 1)\n throw new Error(`Multiple matching axes found for matcher in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`No matching axis found for matcher in anchor \"${anchorId}\"`);\n return matches[0];\n }\n\n throw new Error(`Unsupported axis reference type`);\n}\n\n/**\n * Type guard to check if a value is an anchored axis reference\n */\nfunction isAnchorAxisRef(value: AAxisSelector): value is AnchorAxisRef {\n return typeof value === \"object\" && \"anchor\" in value;\n}\n"],"names":["getAxisId","spec","stringifyColumnId","matchAxisId"],"mappings":";;;;;;AAgBA;AACA;AACA;AAEA,SAAS,OAAO,CAAC,IAAY,EAAA;AAC3B,IAAA,OAAO,YAAY,CAACA,cAAS,CAAC,IAAI,CAAC,CAAE;AACvC;AAEA,SAAS,SAAS,CAAC,GAAW,EAAE,KAAa,EAAA;IAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACrC;AAEA;;;AAGG;MACU,iBAAiB,CAAA;AAiBA,IAAA,OAAA;AAhBX,IAAA,OAAO,GAAG,IAAI,GAAG,EAAkB;AACnC,IAAA,IAAI,GAAG,IAAI,GAAG,EAA8B;AAC7D;;;AAGG;IACc,WAAW,GAAe,EAAE;AAC7C;;AAEG;AACc,IAAA,kBAAkB,GAAG,IAAI,GAAG,EAAkB;AAE/D;;;AAGG;AACH,IAAA,WAAA,CAA4B,OAAoC,EAAA;QAApC,IAAA,CAAA,OAAO,GAAP,OAAO;QACjC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7C,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACt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M,GAAG,CAAC;AACpB,YAAA,MAAM,IAAI,KAAK,CAAC,uDAAuD,QAAQ,CAAA,CAAA,CAAG,CAAC;AACrF,QAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,QAAQ,CAAA,CAAA,CAAG,CAAC;AAC/E,QAAA,OAAO,OAAO,CAAC,CAAC,CAAC;IACnB;AAEA,IAAA,MAAM,IAAI,KAAK,CAAC,CAAA,+BAAA,CAAiC,CAAC;AACpD;AAEA;;AAEG;AACH,SAAS,eAAe,CAAC,KAAoB,EAAA;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK;AACvD;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AxisFilter } from
|
|
2
|
-
import type { SUniversalPColumnId, UniversalPColumnId } from
|
|
3
|
-
import type { AnchoredPColumnId, AnchoredPColumnSelector, PColumnSelector } from
|
|
4
|
-
import type { PColumnSpec } from
|
|
1
|
+
import type { AxisFilter } from "./filtered_column";
|
|
2
|
+
import type { SUniversalPColumnId, UniversalPColumnId } from "./ids";
|
|
3
|
+
import type { AnchoredPColumnId, AnchoredPColumnSelector, PColumnSelector } from "./selectors";
|
|
4
|
+
import type { PColumnSpec } from "./spec";
|
|
5
5
|
/**
|
|
6
6
|
* Context for resolving and generating anchored references to columns and axes
|
|
7
7
|
* Maintains maps of known domain values and axes that can be referenced by anchors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchored.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/anchored.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"anchored.d.ts","sourceRoot":"","sources":["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