@milaboratories/pl-model-common 1.24.2 → 1.24.4

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 (276) 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 +40 -40
  86. package/dist/drivers/pframe/query/query_common.d.ts.map +1 -1
  87. package/dist/drivers/pframe/query/query_data.d.ts +2 -2
  88. package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
  89. package/dist/drivers/pframe/query/query_spec.d.ts +3 -3
  90. package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
  91. package/dist/drivers/pframe/spec/anchored.cjs +6 -6
  92. package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
  93. package/dist/drivers/pframe/spec/anchored.d.ts +4 -4
  94. package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
  95. package/dist/drivers/pframe/spec/anchored.js +6 -6
  96. package/dist/drivers/pframe/spec/anchored.js.map +1 -1
  97. package/dist/drivers/pframe/spec/filtered_column.cjs +1 -1
  98. package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
  99. package/dist/drivers/pframe/spec/filtered_column.d.ts +1 -1
  100. package/dist/drivers/pframe/spec/filtered_column.js +1 -1
  101. package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
  102. package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
  103. package/dist/drivers/pframe/spec/ids.d.ts +5 -5
  104. package/dist/drivers/pframe/spec/ids.js.map +1 -1
  105. package/dist/drivers/pframe/spec/index.d.ts +6 -6
  106. package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
  107. package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
  108. package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
  109. package/dist/drivers/pframe/spec/native_id.js.map +1 -1
  110. package/dist/drivers/pframe/spec/selectors.cjs +1 -1
  111. package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
  112. package/dist/drivers/pframe/spec/selectors.d.ts +4 -4
  113. package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
  114. package/dist/drivers/pframe/spec/selectors.js +1 -1
  115. package/dist/drivers/pframe/spec/selectors.js.map +1 -1
  116. package/dist/drivers/pframe/spec/spec.cjs +64 -59
  117. package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
  118. package/dist/drivers/pframe/spec/spec.d.ts +15 -15
  119. package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
  120. package/dist/drivers/pframe/spec/spec.js +64 -59
  121. package/dist/drivers/pframe/spec/spec.js.map +1 -1
  122. package/dist/drivers/pframe/table.d.ts +2 -2
  123. package/dist/drivers/pframe/table_calculate.cjs +11 -11
  124. package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
  125. package/dist/drivers/pframe/table_calculate.d.ts +30 -30
  126. package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
  127. package/dist/drivers/pframe/table_calculate.js +11 -11
  128. package/dist/drivers/pframe/table_calculate.js.map +1 -1
  129. package/dist/drivers/pframe/table_common.cjs +4 -4
  130. package/dist/drivers/pframe/table_common.cjs.map +1 -1
  131. package/dist/drivers/pframe/table_common.d.ts +6 -6
  132. package/dist/drivers/pframe/table_common.js +4 -4
  133. package/dist/drivers/pframe/table_common.js.map +1 -1
  134. package/dist/drivers/pframe/type_util.d.ts.map +1 -1
  135. package/dist/drivers/pframe/unique_values.d.ts +4 -4
  136. package/dist/drivers/urls.cjs +2 -2
  137. package/dist/drivers/urls.cjs.map +1 -1
  138. package/dist/drivers/urls.d.ts +1 -1
  139. package/dist/drivers/urls.js +2 -2
  140. package/dist/drivers/urls.js.map +1 -1
  141. package/dist/errors.cjs +12 -12
  142. package/dist/errors.cjs.map +1 -1
  143. package/dist/errors.d.ts +1 -1
  144. package/dist/errors.d.ts.map +1 -1
  145. package/dist/errors.js +12 -12
  146. package/dist/errors.js.map +1 -1
  147. package/dist/flags/block_flags.cjs +2 -2
  148. package/dist/flags/block_flags.cjs.map +1 -1
  149. package/dist/flags/block_flags.d.ts.map +1 -1
  150. package/dist/flags/block_flags.js +2 -2
  151. package/dist/flags/block_flags.js.map +1 -1
  152. package/dist/flags/flag_utils.cjs +31 -29
  153. package/dist/flags/flag_utils.cjs.map +1 -1
  154. package/dist/flags/flag_utils.d.ts +33 -33
  155. package/dist/flags/flag_utils.d.ts.map +1 -1
  156. package/dist/flags/flag_utils.js +31 -29
  157. package/dist/flags/flag_utils.js.map +1 -1
  158. package/dist/flags/index.d.ts +3 -3
  159. package/dist/flags/type_utils.d.ts +1 -1
  160. package/dist/flags/type_utils.d.ts.map +1 -1
  161. package/dist/httpAuth.cjs +4 -5
  162. package/dist/httpAuth.cjs.map +1 -1
  163. package/dist/httpAuth.d.ts +1 -1
  164. package/dist/httpAuth.d.ts.map +1 -1
  165. package/dist/httpAuth.js +4 -5
  166. package/dist/httpAuth.js.map +1 -1
  167. package/dist/index.d.ts +19 -19
  168. package/dist/json.cjs +1 -1
  169. package/dist/json.cjs.map +1 -1
  170. package/dist/json.d.ts.map +1 -1
  171. package/dist/json.js +1 -1
  172. package/dist/json.js.map +1 -1
  173. package/dist/navigation.cjs +1 -1
  174. package/dist/navigation.cjs.map +1 -1
  175. package/dist/navigation.d.ts +3 -3
  176. package/dist/navigation.js +1 -1
  177. package/dist/navigation.js.map +1 -1
  178. package/dist/plid.cjs +4 -4
  179. package/dist/plid.cjs.map +1 -1
  180. package/dist/plid.d.ts +1 -1
  181. package/dist/plid.js +4 -4
  182. package/dist/plid.js.map +1 -1
  183. package/dist/pool/entry.d.ts +1 -1
  184. package/dist/pool/index.d.ts +3 -3
  185. package/dist/pool/query.cjs +23 -23
  186. package/dist/pool/query.cjs.map +1 -1
  187. package/dist/pool/query.d.ts +9 -9
  188. package/dist/pool/query.d.ts.map +1 -1
  189. package/dist/pool/query.js +23 -23
  190. package/dist/pool/query.js.map +1 -1
  191. package/dist/pool/spec.cjs +9 -9
  192. package/dist/pool/spec.cjs.map +1 -1
  193. package/dist/pool/spec.d.ts +4 -4
  194. package/dist/pool/spec.d.ts.map +1 -1
  195. package/dist/pool/spec.js +9 -9
  196. package/dist/pool/spec.js.map +1 -1
  197. package/dist/ref.cjs +20 -18
  198. package/dist/ref.cjs.map +1 -1
  199. package/dist/ref.d.ts +1 -1
  200. package/dist/ref.d.ts.map +1 -1
  201. package/dist/ref.js +20 -18
  202. package/dist/ref.js.map +1 -1
  203. package/dist/utag.d.ts +1 -1
  204. package/dist/util.cjs +1 -1
  205. package/dist/util.cjs.map +1 -1
  206. package/dist/util.js +1 -1
  207. package/dist/util.js.map +1 -1
  208. package/dist/value_or_error.cjs.map +1 -1
  209. package/dist/value_or_error.d.ts.map +1 -1
  210. package/dist/value_or_error.js.map +1 -1
  211. package/package.json +18 -17
  212. package/src/base32_encode.ts +12 -12
  213. package/src/base64.ts +12 -8
  214. package/src/block_state.ts +3 -3
  215. package/src/bmodel/block_config.ts +12 -6
  216. package/src/bmodel/code.ts +3 -3
  217. package/src/bmodel/container.ts +5 -5
  218. package/src/bmodel/index.ts +5 -5
  219. package/src/bmodel/normalization.ts +33 -25
  220. package/src/bmodel/types.ts +1 -1
  221. package/src/branding.ts +2 -2
  222. package/src/common_types.ts +1 -1
  223. package/src/driver_kit.ts +1 -1
  224. package/src/drivers/ChunkedStreamReader.ts +16 -14
  225. package/src/drivers/blob.ts +7 -11
  226. package/src/drivers/index.ts +8 -8
  227. package/src/drivers/log.ts +3 -3
  228. package/src/drivers/ls.ts +18 -18
  229. package/src/drivers/pframe/column_filter.ts +1 -1
  230. package/src/drivers/pframe/data_info.ts +146 -146
  231. package/src/drivers/pframe/data_types.ts +56 -36
  232. package/src/drivers/pframe/driver.ts +20 -36
  233. package/src/drivers/pframe/find_columns.ts +2 -2
  234. package/src/drivers/pframe/index.ts +14 -14
  235. package/src/drivers/pframe/linker_columns.test.ts +280 -273
  236. package/src/drivers/pframe/linker_columns.ts +65 -39
  237. package/src/drivers/pframe/pframe.ts +6 -9
  238. package/src/drivers/pframe/query/index.ts +2 -2
  239. package/src/drivers/pframe/query/query_common.ts +50 -40
  240. package/src/drivers/pframe/query/query_data.ts +17 -10
  241. package/src/drivers/pframe/query/query_spec.ts +18 -10
  242. package/src/drivers/pframe/spec/anchored.ts +44 -33
  243. package/src/drivers/pframe/spec/filtered_column.ts +2 -2
  244. package/src/drivers/pframe/spec/ids.ts +6 -6
  245. package/src/drivers/pframe/spec/index.ts +6 -6
  246. package/src/drivers/pframe/spec/native_id.ts +7 -9
  247. package/src/drivers/pframe/spec/selectors.test.ts +170 -146
  248. package/src/drivers/pframe/spec/selectors.ts +22 -31
  249. package/src/drivers/pframe/spec/spec.test.ts +163 -176
  250. package/src/drivers/pframe/spec/spec.ts +132 -117
  251. package/src/drivers/pframe/table.ts +2 -2
  252. package/src/drivers/pframe/table_calculate.ts +44 -50
  253. package/src/drivers/pframe/table_common.ts +10 -10
  254. package/src/drivers/pframe/type_util.ts +2 -7
  255. package/src/drivers/pframe/unique_values.ts +4 -4
  256. package/src/drivers/urls.ts +3 -3
  257. package/src/errors.test.ts +20 -20
  258. package/src/errors.ts +24 -20
  259. package/src/flags/block_flags.ts +8 -7
  260. package/src/flags/flag_utils.test.ts +94 -73
  261. package/src/flags/flag_utils.ts +73 -50
  262. package/src/flags/index.ts +3 -3
  263. package/src/flags/type_utils.ts +10 -7
  264. package/src/httpAuth.ts +5 -6
  265. package/src/index.ts +19 -19
  266. package/src/json.ts +28 -17
  267. package/src/navigation.ts +4 -4
  268. package/src/plid.ts +6 -6
  269. package/src/pool/entry.ts +1 -1
  270. package/src/pool/index.ts +3 -3
  271. package/src/pool/query.ts +52 -56
  272. package/src/pool/spec.ts +20 -17
  273. package/src/ref.ts +25 -19
  274. package/src/utag.ts +1 -1
  275. package/src/util.ts +1 -1
  276. package/src/value_or_error.ts +6 -6
@@ -1,8 +1,4 @@
1
- import {
2
- canonicalizeJson,
3
- parseJson,
4
- type CanonicalizedJson,
5
- } from '../../json';
1
+ import { canonicalizeJson, parseJson, type CanonicalizedJson } from "../../json";
6
2
  import {
7
3
  Annotation,
8
4
  readAnnotationJson,
@@ -14,7 +10,7 @@ import {
14
10
  getNormalizedAxesList,
15
11
  getArrayFromAxisTree,
16
12
  getAxesTree,
17
- } from './spec/spec';
13
+ } from "./spec/spec";
18
14
 
19
15
  type LinkerKey = CanonicalizedJson<AxisId[]>;
20
16
  export type CompositeLinkerMap = Map<
@@ -46,7 +42,9 @@ export class LinkerMap implements LinkersData {
46
42
 
47
43
  static fromColumns(columns: PColumnIdAndSpec[]) {
48
44
  const result: CompositeLinkerMap = new Map();
49
- for (const linker of columns.filter((l) => !!readAnnotationJson(l.spec, Annotation.IsLinkerColumn))) {
45
+ for (const linker of columns.filter(
46
+ (l) => !!readAnnotationJson(l.spec, Annotation.IsLinkerColumn),
47
+ )) {
50
48
  const groups = LinkerMap.getAxesGroups(getNormalizedAxesList(linker.spec.axesSpec)); // split input axes into groups by parent links from annotation
51
49
 
52
50
  if (groups.length !== 2) {
@@ -63,12 +61,16 @@ export class LinkerMap implements LinkersData {
63
61
  // \_ B _ D
64
62
  // and
65
63
  // E - B - D
66
- const leftKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(left).map((axis) => {
67
- const axes = getArrayFromAxisTree(getAxesTree(axis));
68
- const key = canonicalizeJson(axes.map(getAxisId));
69
- return [key, axes];
70
- });
71
- const rightKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(right).map((axis) => {
64
+ const leftKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(left).map(
65
+ (axis) => {
66
+ const axes = getArrayFromAxisTree(getAxesTree(axis));
67
+ const key = canonicalizeJson(axes.map(getAxisId));
68
+ return [key, axes];
69
+ },
70
+ );
71
+ const rightKeyVariants: [LinkerKey, AxisSpecNormalized[]][] = LinkerMap.getAxesRoots(
72
+ right,
73
+ ).map((axis) => {
72
74
  const axes = getArrayFromAxisTree(getAxesTree(axis));
73
75
  const key = canonicalizeJson(axes.map(getAxisId));
74
76
  return [key, axes];
@@ -157,7 +159,7 @@ export class LinkerMap implements LinkersData {
157
159
  to: AxisSpecNormalized[];
158
160
  throwWhenNoLinkExists?: boolean;
159
161
  }): PColumnIdAndSpec[] {
160
- // 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)
162
+ // 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)
161
163
  const startKeys: LinkerKey[] = sourceAxes.map(LinkerMap.getLinkerKeyFromAxisSpec);
162
164
 
163
165
  return Array.from(
@@ -167,8 +169,13 @@ export class LinkerMap implements LinkersData {
167
169
  .flatMap((targetKey) => {
168
170
  const linkers = startKeys
169
171
  .map((startKey) => this.searchLinkerPath(startKey, targetKey))
170
- .reduce((shortestPath, path) => (shortestPath.length && shortestPath.length < path.length) || !path.length ? shortestPath : path,
171
- [] as PColumnIdAndSpec[])
172
+ .reduce(
173
+ (shortestPath, path) =>
174
+ (shortestPath.length && shortestPath.length < path.length) || !path.length
175
+ ? shortestPath
176
+ : path,
177
+ [] as PColumnIdAndSpec[],
178
+ )
172
179
  .map((linker) => [linker.columnId, linker] as const);
173
180
  if (!linkers.length && throwWhenNoLinkExists) {
174
181
  throw Error(`Unable to find linker column for ${targetKey}`);
@@ -183,7 +190,8 @@ export class LinkerMap implements LinkersData {
183
190
  getAxesListFromKeysList(keys: LinkerKey[]): AxisSpecNormalized[] {
184
191
  return Array.from(
185
192
  new Map(
186
- keys.flatMap((key) => this.data.get(key)?.keyAxesSpec ?? [])
193
+ keys
194
+ .flatMap((key) => this.data.get(key)?.keyAxesSpec ?? [])
187
195
  .map((axis) => [canonicalizeJson(getAxisId(axis)), axis]),
188
196
  ).values(),
189
197
  );
@@ -205,7 +213,12 @@ export class LinkerMap implements LinkersData {
205
213
  const targetKey = targetKeys[idx];
206
214
  return !startKeys.some((startKey) => this.searchLinkerPath(startKey, targetKey).length);
207
215
  })
208
- .flatMap((axis) => getArrayFromAxisTree(getAxesTree(axis)).map((axis) => [canonicalizeJson(getAxisId(axis)), axis])),
216
+ .flatMap((axis) =>
217
+ getArrayFromAxisTree(getAxesTree(axis)).map((axis) => [
218
+ canonicalizeJson(getAxisId(axis)),
219
+ axis,
220
+ ]),
221
+ ),
209
222
  ).values(),
210
223
  );
211
224
  return axes;
@@ -219,11 +232,13 @@ export class LinkerMap implements LinkersData {
219
232
  let startKeys: CanonicalizedJson<AxisId[]>[] = [];
220
233
 
221
234
  if (matchAxisIdFn) {
222
- const sourceAxisIdsGrouped: AxisId[][] = sourceAxes.map((axis) => getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));
235
+ const sourceAxisIdsGrouped: AxisId[][] = sourceAxes.map((axis) =>
236
+ getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId),
237
+ );
223
238
  for (const sourceAxisIdsGroup of sourceAxisIdsGrouped) {
224
- const matched = this.keyAxesIds.find(
225
- (keyIds: AxisId[]) => keyIds.every(
226
- (linkerKeyAxisId) => sourceAxisIdsGroup.find((sourceAxisId) => matchAxisIdFn(linkerKeyAxisId, sourceAxisId)),
239
+ const matched = this.keyAxesIds.find((keyIds: AxisId[]) =>
240
+ keyIds.every((linkerKeyAxisId) =>
241
+ sourceAxisIdsGroup.find((sourceAxisId) => matchAxisIdFn(linkerKeyAxisId, sourceAxisId)),
227
242
  ),
228
243
  );
229
244
  if (matched) {
@@ -242,7 +257,10 @@ export class LinkerMap implements LinkersData {
242
257
  sourceAxes: AxisSpec[],
243
258
  matchAxisIdFn?: (axisIdOfLinker: AxisId, axisIdOfSource: AxisId) => boolean,
244
259
  ): AxisSpecNormalized[] {
245
- return this.getReachableByLinkersAxesFromAxesNormalized(getNormalizedAxesList(sourceAxes), matchAxisIdFn);
260
+ return this.getReachableByLinkersAxesFromAxesNormalized(
261
+ getNormalizedAxesList(sourceAxes),
262
+ matchAxisIdFn,
263
+ );
246
264
  }
247
265
 
248
266
  static getLinkerKeyFromAxisSpec(axis: AxisSpecNormalized): LinkerKey {
@@ -253,24 +271,30 @@ export class LinkerMap implements LinkersData {
253
271
  There are no order inside every group. */
254
272
  static getAxesGroups(axesSpec: AxisSpecNormalized[]): AxisSpecNormalized[][] {
255
273
  switch (axesSpec.length) {
256
- case 0: return [];
257
- case 1: return [[axesSpec[0]]];
258
- default: break;
274
+ case 0:
275
+ return [];
276
+ case 1:
277
+ return [[axesSpec[0]]];
278
+ default:
279
+ break;
259
280
  }
260
281
 
261
282
  const axisKeys = axesSpec.map((spec) => canonicalizeJson(getAxisId(spec)));
262
283
  const axisParentsIdxs = axesSpec.map(
263
- (spec) => new Set(
264
- spec.parentAxesSpec
265
- .map((spec) => canonicalizeJson(getAxisId(spec)))
266
- .map((el) => {
267
- const idx = axisKeys.indexOf(el);
268
- if (idx === -1) {
269
- throw new Error(`malformed axesSpec: ${JSON.stringify(axesSpec)}, unable to locate parent ${el}`);
270
- }
271
- return idx;
272
- }),
273
- ),
284
+ (spec) =>
285
+ new Set(
286
+ spec.parentAxesSpec
287
+ .map((spec) => canonicalizeJson(getAxisId(spec)))
288
+ .map((el) => {
289
+ const idx = axisKeys.indexOf(el);
290
+ if (idx === -1) {
291
+ throw new Error(
292
+ `malformed axesSpec: ${JSON.stringify(axesSpec)}, unable to locate parent ${el}`,
293
+ );
294
+ }
295
+ return idx;
296
+ }),
297
+ ),
274
298
  );
275
299
 
276
300
  const allIdxs = [...axesSpec.keys()];
@@ -304,14 +328,16 @@ export class LinkerMap implements LinkersData {
304
328
 
305
329
  groups.push([...currentGroup]);
306
330
  nextFreeEl = allIdxs.find((idx) => !usedIdxs.has(idx));
307
- };
331
+ }
308
332
 
309
333
  return groups.map((group) => group.map((idx) => axesSpec[idx]));
310
334
  }
311
335
 
312
336
  /** Get all axes that are not parents of any other axis */
313
337
  static getAxesRoots(axes: AxisSpecNormalized[]): AxisSpecNormalized[] {
314
- const parentsSet = new Set(axes.flatMap((axis) => axis.parentAxesSpec).map((spec) => canonicalizeJson(getAxisId(spec))));
338
+ const parentsSet = new Set(
339
+ axes.flatMap((axis) => axis.parentAxesSpec).map((spec) => canonicalizeJson(getAxisId(spec))),
340
+ );
315
341
  return axes.filter((axis) => !parentsSet.has(canonicalizeJson(getAxisId(axis))));
316
342
  }
317
343
  }
@@ -1,12 +1,9 @@
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 {
6
- CalculateTableDataRequest,
7
- CalculateTableDataResponse,
8
- } from './table_calculate';
9
- import type { UniqueValuesRequest, UniqueValuesResponse } from './unique_values';
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";
10
7
 
11
8
  /** Read interface exposed by PFrames library */
12
9
  export interface PFrame {
@@ -1,2 +1,2 @@
1
- export * from './query_spec';
2
- export * from './query_data';
1
+ export * from "./query_spec";
2
+ export * from "./query_data";
@@ -1,6 +1,6 @@
1
- import type { PObjectId } from '../../../pool';
2
- import type { JsonDataInfo } from '../data_info';
3
- import type { AxisValueType, ColumnValueType } from '../spec';
1
+ import type { PObjectId } from "../../../pool";
2
+ import type { JsonDataInfo } from "../data_info";
3
+ import type { AxisValueType, ColumnValueType } from "../spec";
4
4
 
5
5
  // ============ Type Spec Types ============
6
6
 
@@ -37,7 +37,17 @@ export type TypeSpec = {
37
37
  * - `exp` - Exponential function (e^x)
38
38
  * - `negate` - Negation (-x)
39
39
  */
40
- export type NumericUnaryOperand = 'abs' | 'ceil' | 'floor' | 'round' | 'sqrt' | 'log' | 'log2' | 'log10' | 'exp' | 'negate';
40
+ export type NumericUnaryOperand =
41
+ | "abs"
42
+ | "ceil"
43
+ | "floor"
44
+ | "round"
45
+ | "sqrt"
46
+ | "log"
47
+ | "log2"
48
+ | "log10"
49
+ | "exp"
50
+ | "negate";
41
51
 
42
52
  /**
43
53
  * Binary mathematical operation kinds.
@@ -52,7 +62,7 @@ export type NumericUnaryOperand = 'abs' | 'ceil' | 'floor' | 'round' | 'sqrt' |
52
62
  * - `div` - Division: left / right (division by zero returns Infinity or NaN)
53
63
  * - `mod` - Modulo: left % right
54
64
  */
55
- export type NumericBinaryOperand = 'add' | 'sub' | 'mul' | 'div' | 'mod';
65
+ export type NumericBinaryOperand = "add" | "sub" | "mul" | "div" | "mod";
56
66
 
57
67
  /**
58
68
  * Numeric comparison operation kinds.
@@ -68,7 +78,7 @@ export type NumericBinaryOperand = 'add' | 'sub' | 'mul' | 'div' | 'mod';
68
78
  * - `gt` - Greater than: left > right
69
79
  * - `ge` - Greater or equal: left >= right
70
80
  */
71
- export type NumericComparisonOperand = 'eq' | 'ne' | 'lt' | 'le' | 'gt' | 'ge';
81
+ export type NumericComparisonOperand = "eq" | "ne" | "lt" | "le" | "gt" | "ge";
72
82
 
73
83
  // ============ Geometric Types ============
74
84
 
@@ -103,7 +113,7 @@ export type Point2D = {
103
113
  * { type: 'constant', value: true }
104
114
  */
105
115
  export type ExprConstant = {
106
- type: 'constant';
116
+ type: "constant";
107
117
  value: string | number | boolean;
108
118
  };
109
119
 
@@ -130,7 +140,7 @@ export type ExprConstant = {
130
140
  * @see NumericUnaryOperand for available operations
131
141
  */
132
142
  export interface ExprNumericUnary<I> {
133
- type: 'numericUnary';
143
+ type: "numericUnary";
134
144
  /** The mathematical operation to apply */
135
145
  operand: NumericUnaryOperand;
136
146
  /** Input expression (must evaluate to numeric) */
@@ -157,7 +167,7 @@ export interface ExprNumericUnary<I> {
157
167
  * @see NumericBinaryOperand for available operations
158
168
  */
159
169
  export interface ExprNumericBinary<I> {
160
- type: 'numericBinary';
170
+ type: "numericBinary";
161
171
  /** The arithmetic operation to apply */
162
172
  operand: NumericBinaryOperand;
163
173
  /** Left operand expression */
@@ -192,7 +202,7 @@ export interface ExprNumericBinary<I> {
192
202
  * @see NumericComparisonOperand for available operations
193
203
  */
194
204
  export interface ExprNumericComparison<I> {
195
- type: 'numericComparison';
205
+ type: "numericComparison";
196
206
  /** The comparison operation to apply */
197
207
  operand: NumericComparisonOperand;
198
208
  /** Left operand expression */
@@ -222,7 +232,7 @@ export interface ExprNumericComparison<I> {
222
232
  * { type: 'stringEquals', input: nameColumn, value: 'John', caseInsensitive: true }
223
233
  */
224
234
  export interface ExprStringEquals<I> {
225
- type: 'stringEquals';
235
+ type: "stringEquals";
226
236
  /** Input expression (must evaluate to string) */
227
237
  input: I;
228
238
  /** Reference string to compare against */
@@ -251,7 +261,7 @@ export interface ExprStringEquals<I> {
251
261
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions | MDN Regular Expressions Guide}
252
262
  */
253
263
  export interface ExprStringRegex<I> {
254
- type: 'stringRegex';
264
+ type: "stringRegex";
255
265
  /** Input expression (must evaluate to string) */
256
266
  input: I;
257
267
  /** Regular expression pattern */
@@ -276,7 +286,7 @@ export interface ExprStringRegex<I> {
276
286
  * { type: 'stringContains', input: descColumn, value: 'ERROR', caseInsensitive: true }
277
287
  */
278
288
  export interface ExprStringContains<I> {
279
- type: 'stringContains';
289
+ type: "stringContains";
280
290
  /** Input expression (must evaluate to string) */
281
291
  input: I;
282
292
  /** Substring to search for */
@@ -320,7 +330,7 @@ export interface ExprStringContains<I> {
320
330
  * }
321
331
  */
322
332
  export interface ExprStringContainsFuzzy<I> {
323
- type: 'stringContainsFuzzy';
333
+ type: "stringContainsFuzzy";
324
334
  /** Input expression (must evaluate to string) */
325
335
  input: I;
326
336
  /** Pattern to match against */
@@ -360,7 +370,7 @@ export interface ExprStringContainsFuzzy<I> {
360
370
  * { type: 'not', input: comparisonExpr }
361
371
  */
362
372
  export interface ExprLogicalUnary<I> {
363
- type: 'not';
373
+ type: "not";
364
374
  /** Input boolean expression to negate */
365
375
  input: I;
366
376
  }
@@ -387,7 +397,7 @@ export interface ExprLogicalUnary<I> {
387
397
  */
388
398
  export interface ExprLogicalVariadic<I> {
389
399
  /** Logical operation: 'and' or 'or' */
390
- type: 'and' | 'or';
400
+ type: "and" | "or";
391
401
  /** Array of boolean expressions to combine (minimum 2 elements) */
392
402
  input: I[];
393
403
  }
@@ -412,7 +422,7 @@ export interface ExprLogicalVariadic<I> {
412
422
  * }
413
423
  */
414
424
  export interface ExprIsIn<I, T extends string | number> {
415
- type: 'isIn';
425
+ type: "isIn";
416
426
  /** Input expression to test */
417
427
  input: I;
418
428
  /** Set of allowed values */
@@ -437,7 +447,7 @@ export interface ExprIsIn<I, T extends string | number> {
437
447
  * { type: 'axisRef', value: 0 }
438
448
  */
439
449
  export interface ExprAxisRef<A> {
440
- type: 'axisRef';
450
+ type: "axisRef";
441
451
  /** Axis identifier (selector or index depending on context) */
442
452
  value: A;
443
453
  }
@@ -458,20 +468,20 @@ export interface ExprAxisRef<A> {
458
468
  * { type: 'columnRef', value: 0 }
459
469
  */
460
470
  export interface ExprColumnRef<C> {
461
- type: 'columnRef';
471
+ type: "columnRef";
462
472
  /** Column identifier (ID or index depending on context) */
463
473
  value: C;
464
474
  }
465
475
 
466
476
  export type InferBooleanExpressionUnion<E> = [
467
- E extends ExprNumericComparison<unknown> ? Extract<E, { type: 'numericComparison' }> : never,
468
- E extends ExprStringEquals<unknown> ? Extract<E, { type: 'stringEquals' }> : never,
469
- E extends ExprStringContains<unknown> ? Extract<E, { type: 'stringContains' }> : never,
470
- E extends ExprStringContainsFuzzy<unknown> ? Extract<E, { type: 'stringContainsFuzzy' }> : never,
471
- E extends ExprStringRegex<unknown> ? Extract<E, { type: 'stringRegex' }> : never,
472
- E extends ExprLogicalUnary<unknown> ? Extract<E, { type: 'not' }> : never,
473
- E extends ExprLogicalVariadic<unknown> ? Extract<E, { type: 'and' | 'or' }> : never,
474
- E extends ExprIsIn<unknown, string | number> ? Extract<E, { type: 'isIn' }> : never,
477
+ E extends ExprNumericComparison<unknown> ? Extract<E, { type: "numericComparison" }> : never,
478
+ E extends ExprStringEquals<unknown> ? Extract<E, { type: "stringEquals" }> : never,
479
+ E extends ExprStringContains<unknown> ? Extract<E, { type: "stringContains" }> : never,
480
+ E extends ExprStringContainsFuzzy<unknown> ? Extract<E, { type: "stringContainsFuzzy" }> : never,
481
+ E extends ExprStringRegex<unknown> ? Extract<E, { type: "stringRegex" }> : never,
482
+ E extends ExprLogicalUnary<unknown> ? Extract<E, { type: "not" }> : never,
483
+ E extends ExprLogicalVariadic<unknown> ? Extract<E, { type: "and" | "or" }> : never,
484
+ E extends ExprIsIn<unknown, string | number> ? Extract<E, { type: "isIn" }> : never,
475
485
  ][number];
476
486
 
477
487
  // ============ Generic Query Types ============
@@ -496,7 +506,7 @@ export type InferBooleanExpressionUnion<E> = [
496
506
  * { type: 'axis', id: 0 }
497
507
  */
498
508
  export interface QueryAxisSelector<A> {
499
- type: 'axis';
509
+ type: "axis";
500
510
  /** Axis identifier (name or index depending on context) */
501
511
  id: A;
502
512
  }
@@ -519,7 +529,7 @@ export interface QueryAxisSelector<A> {
519
529
  * { type: 'column', id: 0 }
520
530
  */
521
531
  export interface QueryColumnSelector<C> {
522
- type: 'column';
532
+ type: "column";
523
533
  /** Column identifier (name or index depending on context) */
524
534
  id: C;
525
535
  }
@@ -551,7 +561,7 @@ export interface QueryColumnSelector<C> {
551
561
  * // Result has all samples; annotations/metadata are null where not available
552
562
  */
553
563
  export interface QueryOuterJoin<JE extends QueryJoinEntry<unknown>> {
554
- type: 'outerJoin';
564
+ type: "outerJoin";
555
565
  /** Primary query - all its records are preserved */
556
566
  primary: JE;
557
567
  /** Secondary queries - joined where keys match, null where they don't */
@@ -584,7 +594,7 @@ export interface QueryOuterJoin<JE extends QueryJoinEntry<unknown>> {
584
594
  * }
585
595
  */
586
596
  export interface QuerySliceAxes<Q, A extends QueryAxisSelector<unknown>> {
587
- type: 'sliceAxes';
597
+ type: "sliceAxes";
588
598
  /** Input query to slice */
589
599
  input: Q;
590
600
  /** List of axis filters to apply (at least one required) */
@@ -617,18 +627,18 @@ export interface QuerySliceAxes<Q, A extends QueryAxisSelector<unknown>> {
617
627
  * type: 'sort',
618
628
  * input: dataQuery,
619
629
  * sortBy: [
620
- * { axisOrColumn: { type: 'column', id: 'score' }, ascending: false, nullsFirst: null },
621
- * { axisOrColumn: { type: 'axis', id: 'name' }, ascending: true, nullsFirst: null }
630
+ * { expression: { type: 'columnRef', value: 'score' }, ascending: false, nullsFirst: null },
631
+ * { expression: { type: 'axisRef', value: { name: 'name' } }, ascending: true, nullsFirst: null }
622
632
  * ]
623
633
  * }
624
634
  */
625
635
  export interface QuerySort<Q, E> {
626
- type: 'sort';
636
+ type: "sort";
627
637
  /** Input query to sort */
628
638
  input: Q;
629
639
  /** Sort criteria in priority order (at least one required) */
630
640
  sortBy: {
631
- data: E;
641
+ expression: E;
632
642
  /** If true, sort ascending (A-Z, 0-9); if false, descending */
633
643
  ascending: boolean;
634
644
  /**
@@ -674,7 +684,7 @@ export interface QuerySort<Q, E> {
674
684
  * }
675
685
  */
676
686
  export interface QueryFilter<Q, E> {
677
- type: 'filter';
687
+ type: "filter";
678
688
  /** Input query to filter */
679
689
  input: Q;
680
690
  /** Boolean predicate expression - only true records pass */
@@ -695,7 +705,7 @@ export interface QueryFilter<Q, E> {
695
705
  * { type: 'column', columnId: 'col_abc123' }
696
706
  */
697
707
  export interface QueryColumn {
698
- type: 'column';
708
+ type: "column";
699
709
  /** Unique identifier of the column to reference */
700
710
  columnId: PObjectId;
701
711
  }
@@ -720,7 +730,7 @@ export interface QueryColumn {
720
730
  * }
721
731
  */
722
732
  export interface QueryInlineColumn<T> {
723
- type: 'inlineColumn';
733
+ type: "inlineColumn";
724
734
  /** Type specification defining axes and column types */
725
735
  spec: T;
726
736
  /** Data information containing or referencing the actual values */
@@ -753,7 +763,7 @@ export interface QueryInlineColumn<T> {
753
763
  * }
754
764
  */
755
765
  export interface QuerySparseToDenseColumn<SO> {
756
- type: 'sparseToDenseColumn';
766
+ type: "sparseToDenseColumn";
757
767
  /** ID of the column to cross-join */
758
768
  columnId: PObjectId;
759
769
  /** Optional override for the column specification */
@@ -797,7 +807,7 @@ export interface QuerySparseToDenseColumn<SO> {
797
807
  */
798
808
  export interface QuerySymmetricJoin<JE extends QueryJoinEntry<unknown>> {
799
809
  /** 'innerJoin' for intersection, 'fullJoin' for union with nulls */
800
- type: 'innerJoin' | 'fullJoin';
810
+ type: "innerJoin" | "fullJoin";
801
811
  /** Queries to join (at least one required) */
802
812
  entries: JE[];
803
813
  }
@@ -1,4 +1,4 @@
1
- import type { PObjectId } from '../../../pool';
1
+ import type { PObjectId } from "../../../pool";
2
2
  import type {
3
3
  ExprAxisRef,
4
4
  ExprColumnRef,
@@ -13,7 +13,8 @@ import type {
13
13
  ExprStringRegex,
14
14
  ExprNumericUnary,
15
15
  QueryAxisSelector,
16
- QueryColumn, QuerySparseToDenseColumn,
16
+ QueryColumn,
17
+ QuerySparseToDenseColumn,
17
18
  QueryFilter,
18
19
  QueryInlineColumn,
19
20
  QueryJoinEntry,
@@ -23,7 +24,7 @@ import type {
23
24
  QuerySymmetricJoin,
24
25
  TypeSpec,
25
26
  InferBooleanExpressionUnion,
26
- } from './query_common';
27
+ } from "./query_common";
27
28
 
28
29
  /**
29
30
  * Column identifier with type specification.
@@ -99,12 +100,18 @@ export type ExprAxisRefData = ExprAxisRef<number>;
99
100
  export type ExprColumnRefData = ExprColumnRef<number>;
100
101
 
101
102
  export type QueryExpressionData =
102
- | ExprColumnRefData | ExprAxisRefData | ExprConstant
103
- | ExprNumericBinary<QueryExpressionData> | ExprNumericUnary<QueryExpressionData>
104
- | ExprStringEquals<QueryExpressionData> | ExprStringContains<QueryExpressionData>
105
- | ExprStringRegex<QueryExpressionData> | ExprStringContainsFuzzy<QueryExpressionData>
106
- | ExprLogicalUnary<QueryExpressionData> | ExprLogicalVariadic<QueryExpressionData>
107
- | ExprIsIn<QueryExpressionData, string> | ExprIsIn<QueryExpressionData, number>
108
- ;
103
+ | ExprColumnRefData
104
+ | ExprAxisRefData
105
+ | ExprConstant
106
+ | ExprNumericBinary<QueryExpressionData>
107
+ | ExprNumericUnary<QueryExpressionData>
108
+ | ExprStringEquals<QueryExpressionData>
109
+ | ExprStringContains<QueryExpressionData>
110
+ | ExprStringRegex<QueryExpressionData>
111
+ | ExprStringContainsFuzzy<QueryExpressionData>
112
+ | ExprLogicalUnary<QueryExpressionData>
113
+ | ExprLogicalVariadic<QueryExpressionData>
114
+ | ExprIsIn<QueryExpressionData, string>
115
+ | ExprIsIn<QueryExpressionData, number>;
109
116
 
110
117
  export type QueryBooleanExpressionData = InferBooleanExpressionUnion<QueryExpressionData>;
@@ -1,4 +1,4 @@
1
- import type { PObjectId } from '../../../pool';
1
+ import type { PObjectId } from "../../../pool";
2
2
  import type {
3
3
  ExprAxisRef,
4
4
  ExprColumnRef,
@@ -13,7 +13,8 @@ import type {
13
13
  ExprStringRegex,
14
14
  ExprNumericUnary,
15
15
  QueryAxisSelector,
16
- QueryColumn, QuerySparseToDenseColumn,
16
+ QueryColumn,
17
+ QuerySparseToDenseColumn,
17
18
  QueryFilter,
18
19
  QueryInlineColumn,
19
20
  QueryJoinEntry,
@@ -22,8 +23,8 @@ import type {
22
23
  QuerySort,
23
24
  QuerySymmetricJoin,
24
25
  InferBooleanExpressionUnion,
25
- } from './query_common';
26
- import type { Domain, PColumnIdAndSpec, PColumnSpec, SingleAxisSelector } from '../spec';
26
+ } from "./query_common";
27
+ import type { Domain, PColumnIdAndSpec, PColumnSpec, SingleAxisSelector } from "../spec";
27
28
 
28
29
  /**
29
30
  * Column identifier with specification.
@@ -108,11 +109,18 @@ export type ExprAxisRefSpec = ExprAxisRef<SingleAxisSelector>;
108
109
  export type ExprColumnRefSpec = ExprColumnRef<PObjectId>;
109
110
 
110
111
  export type QueryExpressionSpec =
111
- | ExprColumnRefSpec | ExprAxisRefSpec | ExprConstant
112
- | ExprNumericBinary<QueryExpressionSpec> | ExprNumericUnary<QueryExpressionSpec>
113
- | ExprStringEquals<QueryExpressionSpec> | ExprStringContains<QueryExpressionSpec>
114
- | ExprStringRegex<QueryExpressionSpec> | ExprStringContainsFuzzy<QueryExpressionSpec>
115
- | ExprLogicalUnary<QueryExpressionSpec> | ExprLogicalVariadic<QueryExpressionSpec>
116
- | ExprIsIn<QueryExpressionSpec, string> | ExprIsIn<QueryExpressionSpec, number>;
112
+ | ExprColumnRefSpec
113
+ | ExprAxisRefSpec
114
+ | ExprConstant
115
+ | ExprNumericBinary<QueryExpressionSpec>
116
+ | ExprNumericUnary<QueryExpressionSpec>
117
+ | ExprStringEquals<QueryExpressionSpec>
118
+ | ExprStringContains<QueryExpressionSpec>
119
+ | ExprStringRegex<QueryExpressionSpec>
120
+ | ExprStringContainsFuzzy<QueryExpressionSpec>
121
+ | ExprLogicalUnary<QueryExpressionSpec>
122
+ | ExprLogicalVariadic<QueryExpressionSpec>
123
+ | ExprIsIn<QueryExpressionSpec, string>
124
+ | ExprIsIn<QueryExpressionSpec, number>;
117
125
 
118
126
  export type QueryBooleanExpressionSpec = InferBooleanExpressionUnion<QueryExpressionSpec>;