@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.
Files changed (275) hide show
  1. package/dist/base32_encode.cjs +11 -11
  2. package/dist/base32_encode.cjs.map +1 -1
  3. package/dist/base32_encode.d.ts +1 -1
  4. package/dist/base32_encode.js +11 -11
  5. package/dist/base32_encode.js.map +1 -1
  6. package/dist/base64.cjs +2 -2
  7. package/dist/base64.cjs.map +1 -1
  8. package/dist/base64.d.ts +1 -1
  9. package/dist/base64.d.ts.map +1 -1
  10. package/dist/base64.js +2 -2
  11. package/dist/base64.js.map +1 -1
  12. package/dist/block_state.d.ts +3 -3
  13. package/dist/bmodel/block_config.cjs +1 -1
  14. package/dist/bmodel/block_config.cjs.map +1 -1
  15. package/dist/bmodel/block_config.d.ts +3 -3
  16. package/dist/bmodel/block_config.d.ts.map +1 -1
  17. package/dist/bmodel/block_config.js +1 -1
  18. package/dist/bmodel/block_config.js.map +1 -1
  19. package/dist/bmodel/code.cjs +1 -1
  20. package/dist/bmodel/code.cjs.map +1 -1
  21. package/dist/bmodel/code.d.ts +2 -2
  22. package/dist/bmodel/code.js +1 -1
  23. package/dist/bmodel/code.js.map +1 -1
  24. package/dist/bmodel/container.d.ts +5 -5
  25. package/dist/bmodel/index.d.ts +5 -5
  26. package/dist/bmodel/normalization.cjs +17 -17
  27. package/dist/bmodel/normalization.cjs.map +1 -1
  28. package/dist/bmodel/normalization.d.ts +2 -2
  29. package/dist/bmodel/normalization.d.ts.map +1 -1
  30. package/dist/bmodel/normalization.js +17 -17
  31. package/dist/bmodel/normalization.js.map +1 -1
  32. package/dist/bmodel/types.d.ts +1 -1
  33. package/dist/branding.d.ts +2 -2
  34. package/dist/common_types.d.ts +1 -1
  35. package/dist/driver_kit.d.ts +1 -1
  36. package/dist/drivers/ChunkedStreamReader.cjs +13 -12
  37. package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
  38. package/dist/drivers/ChunkedStreamReader.d.ts +2 -2
  39. package/dist/drivers/ChunkedStreamReader.d.ts.map +1 -1
  40. package/dist/drivers/ChunkedStreamReader.js +13 -12
  41. package/dist/drivers/ChunkedStreamReader.js.map +1 -1
  42. package/dist/drivers/blob.cjs +1 -1
  43. package/dist/drivers/blob.cjs.map +1 -1
  44. package/dist/drivers/blob.d.ts +4 -4
  45. package/dist/drivers/blob.d.ts.map +1 -1
  46. package/dist/drivers/blob.js +1 -1
  47. package/dist/drivers/blob.js.map +1 -1
  48. package/dist/drivers/index.d.ts +8 -8
  49. package/dist/drivers/log.cjs +1 -1
  50. package/dist/drivers/log.cjs.map +1 -1
  51. package/dist/drivers/log.js +1 -1
  52. package/dist/drivers/log.js.map +1 -1
  53. package/dist/drivers/ls.cjs +3 -3
  54. package/dist/drivers/ls.cjs.map +1 -1
  55. package/dist/drivers/ls.d.ts +6 -6
  56. package/dist/drivers/ls.d.ts.map +1 -1
  57. package/dist/drivers/ls.js +3 -3
  58. package/dist/drivers/ls.js.map +1 -1
  59. package/dist/drivers/pframe/column_filter.d.ts +1 -1
  60. package/dist/drivers/pframe/data_info.cjs +119 -110
  61. package/dist/drivers/pframe/data_info.cjs.map +1 -1
  62. package/dist/drivers/pframe/data_info.d.ts +10 -10
  63. package/dist/drivers/pframe/data_info.d.ts.map +1 -1
  64. package/dist/drivers/pframe/data_info.js +119 -110
  65. package/dist/drivers/pframe/data_info.js.map +1 -1
  66. package/dist/drivers/pframe/data_types.cjs +7 -4
  67. package/dist/drivers/pframe/data_types.cjs.map +1 -1
  68. package/dist/drivers/pframe/data_types.d.ts +2 -2
  69. package/dist/drivers/pframe/data_types.d.ts.map +1 -1
  70. package/dist/drivers/pframe/data_types.js +7 -4
  71. package/dist/drivers/pframe/data_types.js.map +1 -1
  72. package/dist/drivers/pframe/driver.d.ts +10 -10
  73. package/dist/drivers/pframe/driver.d.ts.map +1 -1
  74. package/dist/drivers/pframe/find_columns.d.ts +2 -2
  75. package/dist/drivers/pframe/index.d.ts +14 -14
  76. package/dist/drivers/pframe/linker_columns.cjs +13 -5
  77. package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
  78. package/dist/drivers/pframe/linker_columns.d.ts +2 -2
  79. package/dist/drivers/pframe/linker_columns.d.ts.map +1 -1
  80. package/dist/drivers/pframe/linker_columns.js +13 -5
  81. package/dist/drivers/pframe/linker_columns.js.map +1 -1
  82. package/dist/drivers/pframe/pframe.d.ts +6 -6
  83. package/dist/drivers/pframe/pframe.d.ts.map +1 -1
  84. package/dist/drivers/pframe/query/index.d.ts +2 -2
  85. package/dist/drivers/pframe/query/query_common.d.ts +37 -37
  86. package/dist/drivers/pframe/query/query_data.d.ts +2 -2
  87. package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
  88. package/dist/drivers/pframe/query/query_spec.d.ts +3 -3
  89. package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
  90. package/dist/drivers/pframe/spec/anchored.cjs +6 -6
  91. package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
  92. package/dist/drivers/pframe/spec/anchored.d.ts +4 -4
  93. package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
  94. package/dist/drivers/pframe/spec/anchored.js +6 -6
  95. package/dist/drivers/pframe/spec/anchored.js.map +1 -1
  96. package/dist/drivers/pframe/spec/filtered_column.cjs +1 -1
  97. package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
  98. package/dist/drivers/pframe/spec/filtered_column.d.ts +1 -1
  99. package/dist/drivers/pframe/spec/filtered_column.js +1 -1
  100. package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
  101. package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
  102. package/dist/drivers/pframe/spec/ids.d.ts +5 -5
  103. package/dist/drivers/pframe/spec/ids.js.map +1 -1
  104. package/dist/drivers/pframe/spec/index.d.ts +6 -6
  105. package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
  106. package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
  107. package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
  108. package/dist/drivers/pframe/spec/native_id.js.map +1 -1
  109. package/dist/drivers/pframe/spec/selectors.cjs +1 -1
  110. package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
  111. package/dist/drivers/pframe/spec/selectors.d.ts +4 -4
  112. package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
  113. package/dist/drivers/pframe/spec/selectors.js +1 -1
  114. package/dist/drivers/pframe/spec/selectors.js.map +1 -1
  115. package/dist/drivers/pframe/spec/spec.cjs +64 -59
  116. package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
  117. package/dist/drivers/pframe/spec/spec.d.ts +15 -15
  118. package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
  119. package/dist/drivers/pframe/spec/spec.js +64 -59
  120. package/dist/drivers/pframe/spec/spec.js.map +1 -1
  121. package/dist/drivers/pframe/table.d.ts +2 -2
  122. package/dist/drivers/pframe/table_calculate.cjs +11 -11
  123. package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
  124. package/dist/drivers/pframe/table_calculate.d.ts +30 -30
  125. package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
  126. package/dist/drivers/pframe/table_calculate.js +11 -11
  127. package/dist/drivers/pframe/table_calculate.js.map +1 -1
  128. package/dist/drivers/pframe/table_common.cjs +4 -4
  129. package/dist/drivers/pframe/table_common.cjs.map +1 -1
  130. package/dist/drivers/pframe/table_common.d.ts +6 -6
  131. package/dist/drivers/pframe/table_common.js +4 -4
  132. package/dist/drivers/pframe/table_common.js.map +1 -1
  133. package/dist/drivers/pframe/type_util.d.ts.map +1 -1
  134. package/dist/drivers/pframe/unique_values.d.ts +4 -4
  135. package/dist/drivers/urls.cjs +2 -2
  136. package/dist/drivers/urls.cjs.map +1 -1
  137. package/dist/drivers/urls.d.ts +1 -1
  138. package/dist/drivers/urls.js +2 -2
  139. package/dist/drivers/urls.js.map +1 -1
  140. package/dist/errors.cjs +12 -12
  141. package/dist/errors.cjs.map +1 -1
  142. package/dist/errors.d.ts +1 -1
  143. package/dist/errors.d.ts.map +1 -1
  144. package/dist/errors.js +12 -12
  145. package/dist/errors.js.map +1 -1
  146. package/dist/flags/block_flags.cjs +2 -2
  147. package/dist/flags/block_flags.cjs.map +1 -1
  148. package/dist/flags/block_flags.d.ts.map +1 -1
  149. package/dist/flags/block_flags.js +2 -2
  150. package/dist/flags/block_flags.js.map +1 -1
  151. package/dist/flags/flag_utils.cjs +31 -29
  152. package/dist/flags/flag_utils.cjs.map +1 -1
  153. package/dist/flags/flag_utils.d.ts +33 -33
  154. package/dist/flags/flag_utils.d.ts.map +1 -1
  155. package/dist/flags/flag_utils.js +31 -29
  156. package/dist/flags/flag_utils.js.map +1 -1
  157. package/dist/flags/index.d.ts +3 -3
  158. package/dist/flags/type_utils.d.ts +1 -1
  159. package/dist/flags/type_utils.d.ts.map +1 -1
  160. package/dist/httpAuth.cjs +4 -5
  161. package/dist/httpAuth.cjs.map +1 -1
  162. package/dist/httpAuth.d.ts +1 -1
  163. package/dist/httpAuth.d.ts.map +1 -1
  164. package/dist/httpAuth.js +4 -5
  165. package/dist/httpAuth.js.map +1 -1
  166. package/dist/index.d.ts +19 -19
  167. package/dist/json.cjs +1 -1
  168. package/dist/json.cjs.map +1 -1
  169. package/dist/json.d.ts.map +1 -1
  170. package/dist/json.js +1 -1
  171. package/dist/json.js.map +1 -1
  172. package/dist/navigation.cjs +1 -1
  173. package/dist/navigation.cjs.map +1 -1
  174. package/dist/navigation.d.ts +3 -3
  175. package/dist/navigation.js +1 -1
  176. package/dist/navigation.js.map +1 -1
  177. package/dist/plid.cjs +4 -4
  178. package/dist/plid.cjs.map +1 -1
  179. package/dist/plid.d.ts +1 -1
  180. package/dist/plid.js +4 -4
  181. package/dist/plid.js.map +1 -1
  182. package/dist/pool/entry.d.ts +1 -1
  183. package/dist/pool/index.d.ts +3 -3
  184. package/dist/pool/query.cjs +23 -23
  185. package/dist/pool/query.cjs.map +1 -1
  186. package/dist/pool/query.d.ts +9 -9
  187. package/dist/pool/query.d.ts.map +1 -1
  188. package/dist/pool/query.js +23 -23
  189. package/dist/pool/query.js.map +1 -1
  190. package/dist/pool/spec.cjs +9 -9
  191. package/dist/pool/spec.cjs.map +1 -1
  192. package/dist/pool/spec.d.ts +4 -4
  193. package/dist/pool/spec.d.ts.map +1 -1
  194. package/dist/pool/spec.js +9 -9
  195. package/dist/pool/spec.js.map +1 -1
  196. package/dist/ref.cjs +20 -18
  197. package/dist/ref.cjs.map +1 -1
  198. package/dist/ref.d.ts +1 -1
  199. package/dist/ref.d.ts.map +1 -1
  200. package/dist/ref.js +20 -18
  201. package/dist/ref.js.map +1 -1
  202. package/dist/utag.d.ts +1 -1
  203. package/dist/util.cjs +1 -1
  204. package/dist/util.cjs.map +1 -1
  205. package/dist/util.js +1 -1
  206. package/dist/util.js.map +1 -1
  207. package/dist/value_or_error.cjs.map +1 -1
  208. package/dist/value_or_error.d.ts.map +1 -1
  209. package/dist/value_or_error.js.map +1 -1
  210. package/package.json +18 -17
  211. package/src/base32_encode.ts +12 -12
  212. package/src/base64.ts +12 -8
  213. package/src/block_state.ts +3 -3
  214. package/src/bmodel/block_config.ts +12 -6
  215. package/src/bmodel/code.ts +3 -3
  216. package/src/bmodel/container.ts +5 -5
  217. package/src/bmodel/index.ts +5 -5
  218. package/src/bmodel/normalization.ts +33 -25
  219. package/src/bmodel/types.ts +1 -1
  220. package/src/branding.ts +2 -2
  221. package/src/common_types.ts +1 -1
  222. package/src/driver_kit.ts +1 -1
  223. package/src/drivers/ChunkedStreamReader.ts +16 -14
  224. package/src/drivers/blob.ts +7 -11
  225. package/src/drivers/index.ts +8 -8
  226. package/src/drivers/log.ts +3 -3
  227. package/src/drivers/ls.ts +18 -18
  228. package/src/drivers/pframe/column_filter.ts +1 -1
  229. package/src/drivers/pframe/data_info.ts +146 -146
  230. package/src/drivers/pframe/data_types.ts +56 -36
  231. package/src/drivers/pframe/driver.ts +20 -36
  232. package/src/drivers/pframe/find_columns.ts +2 -2
  233. package/src/drivers/pframe/index.ts +14 -14
  234. package/src/drivers/pframe/linker_columns.test.ts +280 -273
  235. package/src/drivers/pframe/linker_columns.ts +65 -39
  236. package/src/drivers/pframe/pframe.ts +6 -9
  237. package/src/drivers/pframe/query/index.ts +2 -2
  238. package/src/drivers/pframe/query/query_common.ts +46 -46
  239. package/src/drivers/pframe/query/query_data.ts +17 -10
  240. package/src/drivers/pframe/query/query_spec.ts +18 -10
  241. package/src/drivers/pframe/spec/anchored.ts +44 -33
  242. package/src/drivers/pframe/spec/filtered_column.ts +2 -2
  243. package/src/drivers/pframe/spec/ids.ts +6 -6
  244. package/src/drivers/pframe/spec/index.ts +6 -6
  245. package/src/drivers/pframe/spec/native_id.ts +7 -9
  246. package/src/drivers/pframe/spec/selectors.test.ts +170 -146
  247. package/src/drivers/pframe/spec/selectors.ts +22 -31
  248. package/src/drivers/pframe/spec/spec.test.ts +163 -176
  249. package/src/drivers/pframe/spec/spec.ts +132 -117
  250. package/src/drivers/pframe/table.ts +2 -2
  251. package/src/drivers/pframe/table_calculate.ts +44 -50
  252. package/src/drivers/pframe/table_common.ts +10 -10
  253. package/src/drivers/pframe/type_util.ts +2 -7
  254. package/src/drivers/pframe/unique_values.ts +4 -4
  255. package/src/drivers/urls.ts +3 -3
  256. package/src/errors.test.ts +20 -20
  257. package/src/errors.ts +24 -20
  258. package/src/flags/block_flags.ts +8 -7
  259. package/src/flags/flag_utils.test.ts +94 -73
  260. package/src/flags/flag_utils.ts +73 -50
  261. package/src/flags/index.ts +3 -3
  262. package/src/flags/type_utils.ts +10 -7
  263. package/src/httpAuth.ts +5 -6
  264. package/src/index.ts +19 -19
  265. package/src/json.ts +28 -17
  266. package/src/navigation.ts +4 -4
  267. package/src/plid.ts +6 -6
  268. package/src/pool/entry.ts +1 -1
  269. package/src/pool/index.ts +3 -3
  270. package/src/pool/query.ts +52 -56
  271. package/src/pool/spec.ts +20 -17
  272. package/src/ref.ts +25 -19
  273. package/src/utag.ts +1 -1
  274. package/src/util.ts +1 -1
  275. package/src/value_or_error.ts +6 -6
@@ -1,10 +1,18 @@
1
- import canonicalize from 'canonicalize';
2
- import type { AxisFilter, AxisFilterValue } from './filtered_column';
3
- import type { SUniversalPColumnId, UniversalPColumnId } from './ids';
4
- import { stringifyColumnId } from './ids';
5
- import type { AAxisSelector, AnchorAxisRef, AnchorAxisRefByIdx, AnchoredPColumnId, AnchoredPColumnSelector, AxisSelector, PColumnSelector } from './selectors';
6
- import type { AxisId, PColumnSpec } from './spec';
7
- import { getAxisId, matchAxisId } from './spec';
1
+ import canonicalize from "canonicalize";
2
+ import type { AxisFilter, AxisFilterValue } from "./filtered_column";
3
+ import type { SUniversalPColumnId, UniversalPColumnId } from "./ids";
4
+ import { stringifyColumnId } from "./ids";
5
+ import type {
6
+ AAxisSelector,
7
+ AnchorAxisRef,
8
+ AnchorAxisRefByIdx,
9
+ AnchoredPColumnId,
10
+ AnchoredPColumnSelector,
11
+ AxisSelector,
12
+ PColumnSelector,
13
+ } from "./selectors";
14
+ import type { AxisId, PColumnSpec } from "./spec";
15
+ import { getAxisId, matchAxisId } from "./spec";
8
16
 
9
17
  //
10
18
  // Helper functions
@@ -89,15 +97,12 @@ export class AnchoredIdDeriver {
89
97
 
90
98
  let skipDomains: Set<string> | undefined = undefined;
91
99
  if (spec.domain !== undefined) {
92
- outer:
93
- for (const domainPack of this.domainPacks) {
100
+ outer: for (const domainPack of this.domainPacks) {
94
101
  const dAnchor: string[][] = [];
95
102
  for (const domainKey of domainPack) {
96
103
  const dValue = spec.domain[domainKey];
97
- if (dValue !== undefined)
98
- dAnchor.push([domainKey, dValue]);
99
- else
100
- break outer;
104
+ if (dValue !== undefined) dAnchor.push([domainKey, dValue]);
105
+ else break outer;
101
106
  }
102
107
  const domainAnchor = this.domainPackToAnchor.get(JSON.stringify(dAnchor));
103
108
  if (domainAnchor !== undefined) {
@@ -109,8 +114,7 @@ export class AnchoredIdDeriver {
109
114
  }
110
115
 
111
116
  for (const [dKey, dValue] of Object.entries(spec.domain ?? {})) {
112
- if (skipDomains !== undefined && skipDomains.has(dKey))
113
- continue;
117
+ if (skipDomains !== undefined && skipDomains.has(dKey)) continue;
114
118
  const key = domainKey(dKey, dValue);
115
119
  const anchorId = this.domains.get(key);
116
120
  result.domain ??= {};
@@ -136,16 +140,20 @@ export class AnchoredIdDeriver {
136
140
  const [axisIdOrIndex, value] = filter;
137
141
 
138
142
  // If it's already a numeric index, validate it
139
- if (typeof axisIdOrIndex === 'number') {
143
+ if (typeof axisIdOrIndex === "number") {
140
144
  if (axisIdOrIndex < 0 || axisIdOrIndex >= spec.axesSpec.length) {
141
- throw new Error(`Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`);
145
+ throw new Error(
146
+ `Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`,
147
+ );
142
148
  }
143
149
  resolvedFilters.push([axisIdOrIndex, value]);
144
150
  } else {
145
151
  // If it's a string (axis name), resolve it to an index
146
152
  const axisIndex = spec.axesSpec.findIndex((axis) => axis.name === axisIdOrIndex);
147
153
  if (axisIndex === -1) {
148
- throw new Error(`Axis with name "${axisIdOrIndex}" not found in the column specification`);
154
+ throw new Error(
155
+ `Axis with name "${axisIdOrIndex}" not found in the column specification`,
156
+ );
149
157
  }
150
158
  resolvedFilters.push([axisIndex, value]);
151
159
  }
@@ -191,14 +199,17 @@ export type ResolveAnchorsOptions = {
191
199
  * @param options - Options for resolving anchors
192
200
  * @returns A non-anchored column matcher with all references resolved to actual values
193
201
  */
194
- export function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: AnchoredPColumnSelector, options?: ResolveAnchorsOptions): PColumnSelector {
202
+ export function resolveAnchors(
203
+ anchors: Record<string, PColumnSpec>,
204
+ matcher: AnchoredPColumnSelector,
205
+ options?: ResolveAnchorsOptions,
206
+ ): PColumnSelector {
195
207
  const result = { ...matcher };
196
208
  const ignoreMissingDomains = options?.ignoreMissingDomains ?? false;
197
209
 
198
210
  if (result.domainAnchor !== undefined) {
199
211
  const anchorSpec = anchors[result.domainAnchor];
200
- if (!anchorSpec)
201
- throw new Error(`Anchor "${result.domainAnchor}" not found`);
212
+ if (!anchorSpec) throw new Error(`Anchor "${result.domainAnchor}" not found`);
202
213
 
203
214
  const anchorDomains = anchorSpec.domain || {};
204
215
  result.domain = { ...anchorDomains, ...result.domain };
@@ -208,7 +219,7 @@ export function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: An
208
219
  if (result.domain) {
209
220
  const resolvedDomain: Record<string, string> = {};
210
221
  for (const [key, value] of Object.entries(result.domain)) {
211
- if (typeof value === 'string') {
222
+ if (typeof value === "string") {
212
223
  resolvedDomain[key] = value;
213
224
  } else {
214
225
  // It's an AnchorDomainRef
@@ -228,8 +239,7 @@ export function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: An
228
239
  result.domain = resolvedDomain;
229
240
  }
230
241
 
231
- if (result.axes)
232
- result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));
242
+ if (result.axes) result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));
233
243
 
234
244
  return result as PColumnSelector;
235
245
  }
@@ -237,22 +247,23 @@ export function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: An
237
247
  /**
238
248
  * Resolves an anchored axis reference to a concrete AxisId
239
249
  */
240
- function resolveAxisReference(anchors: Record<string, PColumnSpec>, axisRef: AAxisSelector): AxisSelector {
241
- if (!isAnchorAxisRef(axisRef))
242
- return axisRef;
250
+ function resolveAxisReference(
251
+ anchors: Record<string, PColumnSpec>,
252
+ axisRef: AAxisSelector,
253
+ ): AxisSelector {
254
+ if (!isAnchorAxisRef(axisRef)) return axisRef;
243
255
 
244
256
  // It's an anchored reference
245
257
  const anchorId = axisRef.anchor;
246
258
  const anchorSpec = anchors[anchorId];
247
- if (!anchorSpec)
248
- throw new Error(`Anchor "${anchorId}" not found for axis reference`);
259
+ if (!anchorSpec) throw new Error(`Anchor "${anchorId}" not found for axis reference`);
249
260
 
250
- if ('idx' in axisRef) {
261
+ if ("idx" in axisRef) {
251
262
  // AnchorAxisRefByIdx
252
263
  if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)
253
264
  throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor "${anchorId}"`);
254
265
  return anchorSpec.axesSpec[axisRef.idx];
255
- } else if ('name' in axisRef) {
266
+ } else if ("name" in axisRef) {
256
267
  // AnchorAxisRefByName
257
268
  const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);
258
269
  if (matches.length > 1)
@@ -260,7 +271,7 @@ function resolveAxisReference(anchors: Record<string, PColumnSpec>, axisRef: AAx
260
271
  if (matches.length === 0)
261
272
  throw new Error(`Axis with name "${axisRef.name}" not found in anchor "${anchorId}"`);
262
273
  return matches[0];
263
- } else if ('id' in axisRef) {
274
+ } else if ("id" in axisRef) {
264
275
  // AnchorAxisRefByMatcher
265
276
  const matches = anchorSpec.axesSpec.filter((axis) => matchAxisId(axisRef.id, getAxisId(axis)));
266
277
  if (matches.length > 1)
@@ -277,5 +288,5 @@ function resolveAxisReference(anchors: Record<string, PColumnSpec>, axisRef: AAx
277
288
  * Type guard to check if a value is an anchored axis reference
278
289
  */
279
290
  function isAnchorAxisRef(value: AAxisSelector): value is AnchorAxisRef {
280
- return typeof value === 'object' && 'anchor' in value;
291
+ return typeof value === "object" && "anchor" in value;
281
292
  }
@@ -1,4 +1,4 @@
1
- import type { AnchoredPColumnId } from './selectors';
1
+ import type { AnchoredPColumnId } from "./selectors";
2
2
 
3
3
  /** Value of an axis filter */
4
4
  export type AxisFilterValue = number | string;
@@ -37,5 +37,5 @@ export type FilteredPColumnId = FilteredPColumn<AnchoredPColumnId, AxisFilterByI
37
37
  * @returns True if the value is a FilteredPColumn, false otherwise
38
38
  */
39
39
  export function isFilteredPColumn(id: unknown): id is FilteredPColumn {
40
- return typeof id === 'object' && id !== null && 'source' in id && 'axisFilters' in id;
40
+ return typeof id === "object" && id !== null && "source" in id && "axisFilters" in id;
41
41
  }
@@ -1,8 +1,8 @@
1
- import type { Branded } from '../../../branding';
2
- import type { AnchoredPColumnId } from './selectors';
3
- import type { FilteredPColumnId } from './filtered_column';
4
- import canonicalize from 'canonicalize';
5
- import type { PObjectId } from '../../../pool';
1
+ import type { Branded } from "../../../branding";
2
+ import type { AnchoredPColumnId } from "./selectors";
3
+ import type { FilteredPColumnId } from "./filtered_column";
4
+ import canonicalize from "canonicalize";
5
+ import type { PObjectId } from "../../../pool";
6
6
  /**
7
7
  * Universal column identifier optionally anchored and optionally filtered.
8
8
  */
@@ -11,7 +11,7 @@ export type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;
11
11
  /**
12
12
  * Canonically serialized {@link UniversalPColumnId}.
13
13
  */
14
- export type SUniversalPColumnId = Branded<PObjectId, 'SUniversalPColumnId', '__pl_model_brand_2__'>;
14
+ export type SUniversalPColumnId = Branded<PObjectId, "SUniversalPColumnId", "__pl_model_brand_2__">;
15
15
 
16
16
  /**
17
17
  * Canonically serializes a {@link UniversalPColumnId} to a string.
@@ -1,6 +1,6 @@
1
- export * from './anchored';
2
- export * from './ids';
3
- export * from './filtered_column';
4
- export * from './spec';
5
- export * from './selectors';
6
- export * from './native_id';
1
+ export * from "./anchored";
2
+ export * from "./ids";
3
+ export * from "./filtered_column";
4
+ export * from "./spec";
5
+ export * from "./selectors";
6
+ export * from "./native_id";
@@ -1,17 +1,15 @@
1
- import type { Branded } from '../../../branding';
2
- import { isPColumnSpec, type PObjectSpec } from '../../../pool';
3
- import { getAxesId } from './spec';
4
- import canonicalize from 'canonicalize';
5
- export type NativePObjectId = Branded<string, 'NativePObjectId'>;
1
+ import type { Branded } from "../../../branding";
2
+ import { isPColumnSpec, type PObjectSpec } from "../../../pool";
3
+ import { getAxesId } from "./spec";
4
+ import canonicalize from "canonicalize";
5
+ export type NativePObjectId = Branded<string, "NativePObjectId">;
6
6
 
7
7
  export function deriveNativeId(spec: PObjectSpec): NativePObjectId {
8
8
  const result: Record<string, unknown> = {
9
9
  kind: spec.kind,
10
10
  name: spec.name,
11
11
  };
12
- if (spec.domain !== undefined)
13
- result.domain = spec.domain;
14
- if (isPColumnSpec(spec))
15
- result.axesSpec = getAxesId(spec.axesSpec);
12
+ if (spec.domain !== undefined) result.domain = spec.domain;
13
+ if (isPColumnSpec(spec)) result.axesSpec = getAxesId(spec.axesSpec);
16
14
  return canonicalize(result) as NativePObjectId;
17
15
  }
@@ -1,209 +1,233 @@
1
- import { describe, test, expect } from 'vitest';
2
- import { matchPColumn, matchAxis } from './selectors';
3
- import type { PColumnSpec, AxisSpec, AxisId } from './spec';
1
+ import { describe, test, expect } from "vitest";
2
+ import { matchPColumn, matchAxis } from "./selectors";
3
+ import type { PColumnSpec, AxisSpec, AxisId } from "./spec";
4
4
 
5
- describe('matchPColumn', () => {
5
+ describe("matchPColumn", () => {
6
6
  // Test data
7
7
  const testColumn: PColumnSpec = {
8
- kind: 'PColumn',
9
- name: 'testColumn',
10
- valueType: 'Int',
8
+ kind: "PColumn",
9
+ name: "testColumn",
10
+ valueType: "Int",
11
11
  domain: {
12
- domain1: 'value1',
13
- domain2: 'value2',
12
+ domain1: "value1",
13
+ domain2: "value2",
14
14
  },
15
15
  axesSpec: [
16
16
  {
17
- name: 'x',
18
- type: 'String',
17
+ name: "x",
18
+ type: "String",
19
19
  domain: {
20
- key: 'xDomain',
20
+ key: "xDomain",
21
21
  },
22
22
  } as AxisSpec,
23
23
  {
24
- name: 'y',
25
- type: 'String',
24
+ name: "y",
25
+ type: "String",
26
26
  domain: {
27
- key: 'yDomain',
27
+ key: "yDomain",
28
28
  },
29
29
  } as AxisSpec,
30
30
  ],
31
31
  annotations: {
32
- anno1: 'value1',
33
- anno2: 'value2',
32
+ anno1: "value1",
33
+ anno2: "value2",
34
34
  },
35
35
  };
36
36
 
37
- test('matches on name', () => {
38
- expect(matchPColumn(testColumn, { name: 'testColumn' })).toBe(true);
39
- expect(matchPColumn(testColumn, { name: 'wrongName' })).toBe(false);
37
+ test("matches on name", () => {
38
+ expect(matchPColumn(testColumn, { name: "testColumn" })).toBe(true);
39
+ expect(matchPColumn(testColumn, { name: "wrongName" })).toBe(false);
40
40
  });
41
41
 
42
- test('matches on name pattern', () => {
43
- expect(matchPColumn(testColumn, { namePattern: 'test.*' })).toBe(true);
44
- expect(matchPColumn(testColumn, { namePattern: 'wrong.*' })).toBe(false);
42
+ test("matches on name pattern", () => {
43
+ expect(matchPColumn(testColumn, { namePattern: "test.*" })).toBe(true);
44
+ expect(matchPColumn(testColumn, { namePattern: "wrong.*" })).toBe(false);
45
45
  });
46
46
 
47
- test('matches on value type', () => {
48
- expect(matchPColumn(testColumn, { type: 'Int' })).toBe(true);
49
- expect(matchPColumn(testColumn, { type: 'String' })).toBe(false);
50
- expect(matchPColumn(testColumn, { type: ['Int', 'Double'] })).toBe(true);
51
- expect(matchPColumn(testColumn, { type: ['String', 'Float'] })).toBe(false);
47
+ test("matches on value type", () => {
48
+ expect(matchPColumn(testColumn, { type: "Int" })).toBe(true);
49
+ expect(matchPColumn(testColumn, { type: "String" })).toBe(false);
50
+ expect(matchPColumn(testColumn, { type: ["Int", "Double"] })).toBe(true);
51
+ expect(matchPColumn(testColumn, { type: ["String", "Float"] })).toBe(false);
52
52
  });
53
53
 
54
- test('matches on domain', () => {
55
- expect(matchPColumn(testColumn, { domain: { domain1: 'value1' } })).toBe(true);
56
- expect(matchPColumn(testColumn, { domain: { domain1: 'wrongValue' } })).toBe(false);
57
- expect(matchPColumn(testColumn, { domain: { nonExistentDomain: 'value' } })).toBe(false);
54
+ test("matches on domain", () => {
55
+ expect(matchPColumn(testColumn, { domain: { domain1: "value1" } })).toBe(true);
56
+ expect(matchPColumn(testColumn, { domain: { domain1: "wrongValue" } })).toBe(false);
57
+ expect(matchPColumn(testColumn, { domain: { nonExistentDomain: "value" } })).toBe(false);
58
58
  });
59
59
 
60
- test('matches on axes', () => {
61
- expect(matchPColumn(testColumn, {
62
- axes: [
63
- {
64
- name: 'x',
65
- type: 'String',
66
- domain: {
67
- key: 'xDomain',
60
+ test("matches on axes", () => {
61
+ expect(
62
+ matchPColumn(testColumn, {
63
+ axes: [
64
+ {
65
+ name: "x",
66
+ type: "String",
67
+ domain: {
68
+ key: "xDomain",
69
+ },
68
70
  },
69
- },
70
- {
71
- name: 'y',
72
- type: 'String',
73
- domain: {
74
- key: 'yDomain',
71
+ {
72
+ name: "y",
73
+ type: "String",
74
+ domain: {
75
+ key: "yDomain",
76
+ },
75
77
  },
76
- },
77
- ],
78
- })).toBe(true);
78
+ ],
79
+ }),
80
+ ).toBe(true);
79
81
 
80
82
  // Test partial match
81
- expect(matchPColumn(testColumn, {
82
- axes: [{
83
- name: 'x',
84
- domain: {
85
- key: 'xDomain',
86
- },
87
- }],
88
- partialAxesMatch: true,
89
- })).toBe(true);
83
+ expect(
84
+ matchPColumn(testColumn, {
85
+ axes: [
86
+ {
87
+ name: "x",
88
+ domain: {
89
+ key: "xDomain",
90
+ },
91
+ },
92
+ ],
93
+ partialAxesMatch: true,
94
+ }),
95
+ ).toBe(true);
90
96
 
91
97
  // Test failed match (wrong axis)
92
- expect(matchPColumn(testColumn, {
93
- axes: [{
94
- name: 'z',
95
- type: 'String',
96
- domain: {
97
- key: 'zDomain',
98
- },
99
- }],
100
- partialAxesMatch: true,
101
- })).toBe(false);
98
+ expect(
99
+ matchPColumn(testColumn, {
100
+ axes: [
101
+ {
102
+ name: "z",
103
+ type: "String",
104
+ domain: {
105
+ key: "zDomain",
106
+ },
107
+ },
108
+ ],
109
+ partialAxesMatch: true,
110
+ }),
111
+ ).toBe(false);
102
112
 
103
113
  // Test failed match (count mismatch with exact matching)
104
- expect(matchPColumn(testColumn, {
105
- axes: [{
106
- name: 'x',
107
- type: 'String',
108
- domain: {
109
- key: 'xDomain',
110
- },
111
- }],
112
- })).toBe(false);
114
+ expect(
115
+ matchPColumn(testColumn, {
116
+ axes: [
117
+ {
118
+ name: "x",
119
+ type: "String",
120
+ domain: {
121
+ key: "xDomain",
122
+ },
123
+ },
124
+ ],
125
+ }),
126
+ ).toBe(false);
113
127
  });
114
128
 
115
- test('matches on annotations', () => {
116
- expect(matchPColumn(testColumn, { annotations: { anno1: 'value1' } })).toBe(true);
117
- expect(matchPColumn(testColumn, { annotations: { anno1: 'wrongValue' } })).toBe(false);
118
- expect(matchPColumn(testColumn, { annotations: { nonExistentAnno: 'value' } })).toBe(false);
129
+ test("matches on annotations", () => {
130
+ expect(matchPColumn(testColumn, { annotations: { anno1: "value1" } })).toBe(true);
131
+ expect(matchPColumn(testColumn, { annotations: { anno1: "wrongValue" } })).toBe(false);
132
+ expect(matchPColumn(testColumn, { annotations: { nonExistentAnno: "value" } })).toBe(false);
119
133
  });
120
134
 
121
- test('matches on annotation patterns', () => {
122
- expect(matchPColumn(testColumn, { annotationPatterns: { anno1: 'value\\d' } })).toBe(true);
123
- expect(matchPColumn(testColumn, { annotationPatterns: { anno1: 'wrong.*' } })).toBe(false);
124
- expect(matchPColumn(testColumn, { annotationPatterns: { nonExistentAnno: '.*' } })).toBe(false);
135
+ test("matches on annotation patterns", () => {
136
+ expect(matchPColumn(testColumn, { annotationPatterns: { anno1: "value\\d" } })).toBe(true);
137
+ expect(matchPColumn(testColumn, { annotationPatterns: { anno1: "wrong.*" } })).toBe(false);
138
+ expect(matchPColumn(testColumn, { annotationPatterns: { nonExistentAnno: ".*" } })).toBe(false);
125
139
  });
126
140
 
127
- test('matches on multiple criteria', () => {
128
- expect(matchPColumn(testColumn, {
129
- name: 'testColumn',
130
- type: 'Int',
131
- domain: { domain1: 'value1' },
132
- annotations: { anno1: 'value1' },
133
- })).toBe(true);
134
-
135
- expect(matchPColumn(testColumn, {
136
- name: 'testColumn',
137
- type: 'Int',
138
- domain: { domain1: 'wrongValue' }, // This will fail
139
- annotations: { anno1: 'value1' },
140
- })).toBe(false);
141
+ test("matches on multiple criteria", () => {
142
+ expect(
143
+ matchPColumn(testColumn, {
144
+ name: "testColumn",
145
+ type: "Int",
146
+ domain: { domain1: "value1" },
147
+ annotations: { anno1: "value1" },
148
+ }),
149
+ ).toBe(true);
150
+
151
+ expect(
152
+ matchPColumn(testColumn, {
153
+ name: "testColumn",
154
+ type: "Int",
155
+ domain: { domain1: "wrongValue" }, // This will fail
156
+ annotations: { anno1: "value1" },
157
+ }),
158
+ ).toBe(false);
141
159
  });
142
160
  });
143
161
 
144
- describe('matchAxis', () => {
162
+ describe("matchAxis", () => {
145
163
  // Test data
146
164
  const testAxis: AxisId = {
147
- name: 'testAxis',
148
- type: 'String',
165
+ name: "testAxis",
166
+ type: "String",
149
167
  domain: {
150
- key1: 'value1',
151
- key2: 'value2',
168
+ key1: "value1",
169
+ key2: "value2",
152
170
  },
153
171
  };
154
172
 
155
- test('matches on axis name', () => {
156
- expect(matchAxis({ name: 'testAxis' }, testAxis)).toBe(true);
157
- expect(matchAxis({ name: 'wrongAxis' }, testAxis)).toBe(false);
173
+ test("matches on axis name", () => {
174
+ expect(matchAxis({ name: "testAxis" }, testAxis)).toBe(true);
175
+ expect(matchAxis({ name: "wrongAxis" }, testAxis)).toBe(false);
158
176
  });
159
177
 
160
- test('matches on axis type', () => {
161
- expect(matchAxis({ type: 'String' }, testAxis)).toBe(true);
162
- expect(matchAxis({ type: 'Int' }, testAxis)).toBe(false);
163
- expect(matchAxis({ type: ['String', 'Int'] }, testAxis)).toBe(true);
164
- expect(matchAxis({ type: ['Int', 'Double'] }, testAxis)).toBe(false);
178
+ test("matches on axis type", () => {
179
+ expect(matchAxis({ type: "String" }, testAxis)).toBe(true);
180
+ expect(matchAxis({ type: "Int" }, testAxis)).toBe(false);
181
+ expect(matchAxis({ type: ["String", "Int"] }, testAxis)).toBe(true);
182
+ expect(matchAxis({ type: ["Int", "Double"] }, testAxis)).toBe(false);
165
183
  });
166
184
 
167
- test('matches on axis domain', () => {
168
- expect(matchAxis({ domain: { key1: 'value1' } }, testAxis)).toBe(true);
169
- expect(matchAxis({ domain: { key1: 'wrongValue' } }, testAxis)).toBe(false);
170
- expect(matchAxis({ domain: { nonExistentKey: 'value' } }, testAxis)).toBe(false);
185
+ test("matches on axis domain", () => {
186
+ expect(matchAxis({ domain: { key1: "value1" } }, testAxis)).toBe(true);
187
+ expect(matchAxis({ domain: { key1: "wrongValue" } }, testAxis)).toBe(false);
188
+ expect(matchAxis({ domain: { nonExistentKey: "value" } }, testAxis)).toBe(false);
171
189
  });
172
190
 
173
- test('matches on multiple axis criteria', () => {
174
- expect(matchAxis(
175
- {
176
- name: 'testAxis',
177
- type: 'String',
178
- domain: { key1: 'value1' },
179
- },
180
- testAxis,
181
- )).toBe(true);
182
-
183
- expect(matchAxis(
184
- {
185
- name: 'testAxis',
186
- type: 'String',
187
- domain: { key1: 'wrongValue' }, // This will fail
188
- },
189
- testAxis,
190
- )).toBe(false);
191
-
192
- expect(matchAxis(
193
- {
194
- name: 'testAxis',
195
- type: 'Int', // This will fail
196
- domain: { key1: 'value1' },
197
- },
198
- testAxis,
199
- )).toBe(false);
191
+ test("matches on multiple axis criteria", () => {
192
+ expect(
193
+ matchAxis(
194
+ {
195
+ name: "testAxis",
196
+ type: "String",
197
+ domain: { key1: "value1" },
198
+ },
199
+ testAxis,
200
+ ),
201
+ ).toBe(true);
202
+
203
+ expect(
204
+ matchAxis(
205
+ {
206
+ name: "testAxis",
207
+ type: "String",
208
+ domain: { key1: "wrongValue" }, // This will fail
209
+ },
210
+ testAxis,
211
+ ),
212
+ ).toBe(false);
213
+
214
+ expect(
215
+ matchAxis(
216
+ {
217
+ name: "testAxis",
218
+ type: "Int", // This will fail
219
+ domain: { key1: "value1" },
220
+ },
221
+ testAxis,
222
+ ),
223
+ ).toBe(false);
200
224
  });
201
225
 
202
- test('matches with empty domain criteria', () => {
226
+ test("matches with empty domain criteria", () => {
203
227
  expect(matchAxis({ domain: {} }, testAxis)).toBe(true);
204
228
  });
205
229
 
206
- test('matches with partial domain criteria', () => {
207
- expect(matchAxis({ domain: { key1: 'value1' } }, testAxis)).toBe(true);
230
+ test("matches with partial domain criteria", () => {
231
+ expect(matchAxis({ domain: { key1: "value1" } }, testAxis)).toBe(true);
208
232
  });
209
233
  });