@platforma-sdk/model 1.53.11 → 1.53.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/dist/annotations/converter.cjs +11 -11
  2. package/dist/annotations/converter.cjs.map +1 -1
  3. package/dist/annotations/converter.d.ts +1 -1
  4. package/dist/annotations/converter.d.ts.map +1 -1
  5. package/dist/annotations/converter.js +11 -11
  6. package/dist/annotations/converter.js.map +1 -1
  7. package/dist/annotations/index.d.ts +2 -2
  8. package/dist/annotations/types.d.ts +4 -4
  9. package/dist/bconfig/index.d.ts +5 -5
  10. package/dist/bconfig/lambdas.d.ts +7 -7
  11. package/dist/bconfig/lambdas.d.ts.map +1 -1
  12. package/dist/bconfig/normalization.cjs.map +1 -1
  13. package/dist/bconfig/normalization.d.ts +3 -3
  14. package/dist/bconfig/normalization.js.map +1 -1
  15. package/dist/bconfig/types.cjs.map +1 -1
  16. package/dist/bconfig/types.d.ts +2 -2
  17. package/dist/bconfig/types.d.ts.map +1 -1
  18. package/dist/bconfig/types.js.map +1 -1
  19. package/dist/bconfig/util.d.ts +4 -4
  20. package/dist/bconfig/v3.d.ts +3 -3
  21. package/dist/block_api_v1.d.ts +2 -2
  22. package/dist/block_api_v1.d.ts.map +1 -1
  23. package/dist/block_api_v2.d.ts +2 -2
  24. package/dist/block_api_v2.d.ts.map +1 -1
  25. package/dist/block_api_v3.d.ts +3 -3
  26. package/dist/block_migrations.cjs +10 -10
  27. package/dist/block_migrations.cjs.map +1 -1
  28. package/dist/block_migrations.d.ts.map +1 -1
  29. package/dist/block_migrations.js +10 -10
  30. package/dist/block_migrations.js.map +1 -1
  31. package/dist/block_model.cjs +11 -11
  32. package/dist/block_model.cjs.map +1 -1
  33. package/dist/block_model.d.ts +8 -8
  34. package/dist/block_model.d.ts.map +1 -1
  35. package/dist/block_model.js +11 -11
  36. package/dist/block_model.js.map +1 -1
  37. package/dist/block_state_patch.d.ts +2 -2
  38. package/dist/block_state_util.cjs +1 -1
  39. package/dist/block_state_util.cjs.map +1 -1
  40. package/dist/block_state_util.d.ts +3 -3
  41. package/dist/block_state_util.js +1 -1
  42. package/dist/block_state_util.js.map +1 -1
  43. package/dist/block_storage.cjs +10 -10
  44. package/dist/block_storage.cjs.map +1 -1
  45. package/dist/block_storage.d.ts +2 -2
  46. package/dist/block_storage.d.ts.map +1 -1
  47. package/dist/block_storage.js +10 -10
  48. package/dist/block_storage.js.map +1 -1
  49. package/dist/block_storage_vm.cjs +22 -22
  50. package/dist/block_storage_vm.cjs.map +1 -1
  51. package/dist/block_storage_vm.d.ts +1 -1
  52. package/dist/block_storage_vm.d.ts.map +1 -1
  53. package/dist/block_storage_vm.js +22 -22
  54. package/dist/block_storage_vm.js.map +1 -1
  55. package/dist/builder.cjs +32 -23
  56. package/dist/builder.cjs.map +1 -1
  57. package/dist/builder.d.ts +7 -7
  58. package/dist/builder.d.ts.map +1 -1
  59. package/dist/builder.js +32 -23
  60. package/dist/builder.js.map +1 -1
  61. package/dist/components/PFrameForGraphs.cjs +7 -6
  62. package/dist/components/PFrameForGraphs.cjs.map +1 -1
  63. package/dist/components/PFrameForGraphs.d.ts +4 -4
  64. package/dist/components/PFrameForGraphs.d.ts.map +1 -1
  65. package/dist/components/PFrameForGraphs.js +7 -6
  66. package/dist/components/PFrameForGraphs.js.map +1 -1
  67. package/dist/components/PlAnnotations/filter.d.ts +14 -14
  68. package/dist/components/PlAnnotations/filter.d.ts.map +1 -1
  69. package/dist/components/PlAnnotations/filters_ui.cjs +46 -46
  70. package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -1
  71. package/dist/components/PlAnnotations/filters_ui.d.ts +10 -34
  72. package/dist/components/PlAnnotations/filters_ui.d.ts.map +1 -1
  73. package/dist/components/PlAnnotations/filters_ui.js +46 -46
  74. package/dist/components/PlAnnotations/filters_ui.js.map +1 -1
  75. package/dist/components/PlAnnotations/index.d.ts +2 -2
  76. package/dist/components/PlAnnotations/types.d.ts +2 -2
  77. package/dist/components/PlDataTable.cjs +19 -20
  78. package/dist/components/PlDataTable.cjs.map +1 -1
  79. package/dist/components/PlDataTable.d.ts +27 -27
  80. package/dist/components/PlDataTable.d.ts.map +1 -1
  81. package/dist/components/PlDataTable.js +19 -20
  82. package/dist/components/PlDataTable.js.map +1 -1
  83. package/dist/components/PlMultiSequenceAlignment.cjs +2 -2
  84. package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -1
  85. package/dist/components/PlMultiSequenceAlignment.d.ts +6 -6
  86. package/dist/components/PlMultiSequenceAlignment.d.ts.map +1 -1
  87. package/dist/components/PlMultiSequenceAlignment.js +2 -2
  88. package/dist/components/PlMultiSequenceAlignment.js.map +1 -1
  89. package/dist/components/PlSelectionModel.cjs.map +1 -1
  90. package/dist/components/PlSelectionModel.d.ts +1 -1
  91. package/dist/components/PlSelectionModel.js.map +1 -1
  92. package/dist/components/index.d.ts +5 -5
  93. package/dist/config/actions.cjs +39 -39
  94. package/dist/config/actions.cjs.map +1 -1
  95. package/dist/config/actions.d.ts +9 -9
  96. package/dist/config/actions.d.ts.map +1 -1
  97. package/dist/config/actions.js +39 -39
  98. package/dist/config/actions.js.map +1 -1
  99. package/dist/config/actions_kinds.d.ts +30 -30
  100. package/dist/config/actions_kinds.d.ts.map +1 -1
  101. package/dist/config/index.d.ts +6 -6
  102. package/dist/config/model.d.ts +28 -28
  103. package/dist/config/model_meta.d.ts +1 -1
  104. package/dist/config/type_engine.d.ts +3 -3
  105. package/dist/config/type_util.d.ts +2 -2
  106. package/dist/env_value.cjs +1 -1
  107. package/dist/env_value.cjs.map +1 -1
  108. package/dist/env_value.js +1 -1
  109. package/dist/env_value.js.map +1 -1
  110. package/dist/filters/converter.cjs +36 -32
  111. package/dist/filters/converter.cjs.map +1 -1
  112. package/dist/filters/converter.d.ts +2 -2
  113. package/dist/filters/converter.d.ts.map +1 -1
  114. package/dist/filters/converter.js +36 -32
  115. package/dist/filters/converter.js.map +1 -1
  116. package/dist/filters/index.d.ts +2 -2
  117. package/dist/filters/types.d.ts +33 -33
  118. package/dist/filters/types.d.ts.map +1 -1
  119. package/dist/index.d.ts +24 -24
  120. package/dist/internal.cjs +7 -7
  121. package/dist/internal.cjs.map +1 -1
  122. package/dist/internal.d.ts +4 -4
  123. package/dist/internal.d.ts.map +1 -1
  124. package/dist/internal.js +7 -7
  125. package/dist/internal.js.map +1 -1
  126. package/dist/package.json.cjs +1 -1
  127. package/dist/package.json.js +1 -1
  128. package/dist/pframe.cjs +1 -1
  129. package/dist/pframe.cjs.map +1 -1
  130. package/dist/pframe.d.ts +1 -1
  131. package/dist/pframe.js +1 -1
  132. package/dist/pframe.js.map +1 -1
  133. package/dist/pframe_utils/columns.cjs +23 -15
  134. package/dist/pframe_utils/columns.cjs.map +1 -1
  135. package/dist/pframe_utils/columns.d.ts +3 -3
  136. package/dist/pframe_utils/columns.d.ts.map +1 -1
  137. package/dist/pframe_utils/columns.js +23 -15
  138. package/dist/pframe_utils/columns.js.map +1 -1
  139. package/dist/pframe_utils/index.cjs +25 -25
  140. package/dist/pframe_utils/index.cjs.map +1 -1
  141. package/dist/pframe_utils/index.d.ts +3 -3
  142. package/dist/pframe_utils/index.d.ts.map +1 -1
  143. package/dist/pframe_utils/index.js +25 -25
  144. package/dist/pframe_utils/index.js.map +1 -1
  145. package/dist/platforma.d.ts +7 -7
  146. package/dist/platforma.d.ts.map +1 -1
  147. package/dist/raw_globals.cjs +4 -1
  148. package/dist/raw_globals.cjs.map +1 -1
  149. package/dist/raw_globals.d.ts +2 -2
  150. package/dist/raw_globals.d.ts.map +1 -1
  151. package/dist/raw_globals.js +4 -1
  152. package/dist/raw_globals.js.map +1 -1
  153. package/dist/ref_util.cjs +4 -4
  154. package/dist/ref_util.cjs.map +1 -1
  155. package/dist/ref_util.d.ts +1 -1
  156. package/dist/ref_util.js +4 -4
  157. package/dist/ref_util.js.map +1 -1
  158. package/dist/render/accessor.cjs +24 -24
  159. package/dist/render/accessor.cjs.map +1 -1
  160. package/dist/render/accessor.d.ts +10 -10
  161. package/dist/render/accessor.d.ts.map +1 -1
  162. package/dist/render/accessor.js +24 -24
  163. package/dist/render/accessor.js.map +1 -1
  164. package/dist/render/api.cjs +23 -23
  165. package/dist/render/api.cjs.map +1 -1
  166. package/dist/render/api.d.ts +11 -11
  167. package/dist/render/api.d.ts.map +1 -1
  168. package/dist/render/api.js +23 -23
  169. package/dist/render/api.js.map +1 -1
  170. package/dist/render/future.cjs.map +1 -1
  171. package/dist/render/future.d.ts +1 -1
  172. package/dist/render/future.js.map +1 -1
  173. package/dist/render/index.d.ts +6 -6
  174. package/dist/render/internal.cjs +4 -4
  175. package/dist/render/internal.cjs.map +1 -1
  176. package/dist/render/internal.d.ts +7 -7
  177. package/dist/render/internal.d.ts.map +1 -1
  178. package/dist/render/internal.js +4 -4
  179. package/dist/render/internal.js.map +1 -1
  180. package/dist/render/traversal_ops.d.ts +1 -1
  181. package/dist/render/util/axis_filtering.cjs +48 -44
  182. package/dist/render/util/axis_filtering.cjs.map +1 -1
  183. package/dist/render/util/axis_filtering.d.ts +2 -2
  184. package/dist/render/util/axis_filtering.js +48 -44
  185. package/dist/render/util/axis_filtering.js.map +1 -1
  186. package/dist/render/util/column_collection.cjs +42 -35
  187. package/dist/render/util/column_collection.cjs.map +1 -1
  188. package/dist/render/util/column_collection.d.ts +4 -4
  189. package/dist/render/util/column_collection.d.ts.map +1 -1
  190. package/dist/render/util/column_collection.js +42 -35
  191. package/dist/render/util/column_collection.js.map +1 -1
  192. package/dist/render/util/index.d.ts +4 -4
  193. package/dist/render/util/label.cjs +15 -21
  194. package/dist/render/util/label.cjs.map +1 -1
  195. package/dist/render/util/label.d.ts +2 -2
  196. package/dist/render/util/label.d.ts.map +1 -1
  197. package/dist/render/util/label.js +15 -21
  198. package/dist/render/util/label.js.map +1 -1
  199. package/dist/render/util/pcolumn_data.cjs +56 -54
  200. package/dist/render/util/pcolumn_data.cjs.map +1 -1
  201. package/dist/render/util/pcolumn_data.d.ts +5 -5
  202. package/dist/render/util/pcolumn_data.d.ts.map +1 -1
  203. package/dist/render/util/pcolumn_data.js +56 -54
  204. package/dist/render/util/pcolumn_data.js.map +1 -1
  205. package/dist/render/util/pframe_upgraders.cjs +6 -6
  206. package/dist/render/util/pframe_upgraders.cjs.map +1 -1
  207. package/dist/render/util/pframe_upgraders.d.ts +1 -1
  208. package/dist/render/util/pframe_upgraders.d.ts.map +1 -1
  209. package/dist/render/util/pframe_upgraders.js +6 -6
  210. package/dist/render/util/pframe_upgraders.js.map +1 -1
  211. package/dist/render/util/split_selectors.d.ts +1 -1
  212. package/dist/render/util/split_selectors.d.ts.map +1 -1
  213. package/dist/sdk_info.cjs.map +1 -1
  214. package/dist/sdk_info.js.map +1 -1
  215. package/dist/version.cjs.map +1 -1
  216. package/dist/version.js.map +1 -1
  217. package/package.json +24 -22
  218. package/src/annotations/converter.test.ts +98 -101
  219. package/src/annotations/converter.ts +21 -17
  220. package/src/annotations/index.ts +2 -2
  221. package/src/annotations/types.ts +4 -4
  222. package/src/bconfig/index.ts +5 -5
  223. package/src/bconfig/lambdas.ts +10 -12
  224. package/src/bconfig/normalization.ts +5 -5
  225. package/src/bconfig/types.ts +3 -5
  226. package/src/bconfig/util.ts +3 -3
  227. package/src/bconfig/v3.ts +3 -3
  228. package/src/block_api_v1.ts +7 -3
  229. package/src/block_api_v2.ts +7 -3
  230. package/src/block_api_v3.ts +3 -3
  231. package/src/block_migrations.test.ts +66 -67
  232. package/src/block_migrations.ts +16 -16
  233. package/src/block_model.ts +76 -140
  234. package/src/block_state_patch.ts +2 -2
  235. package/src/block_state_util.ts +4 -4
  236. package/src/block_storage.test.ts +106 -99
  237. package/src/block_storage.ts +22 -25
  238. package/src/block_storage_vm.ts +41 -35
  239. package/src/builder.ts +107 -95
  240. package/src/components/PFrameForGraphs.test.ts +261 -255
  241. package/src/components/PFrameForGraphs.ts +35 -22
  242. package/src/components/PlAnnotations/filter.ts +21 -15
  243. package/src/components/PlAnnotations/filters_ui.test.ts +230 -73
  244. package/src/components/PlAnnotations/filters_ui.ts +138 -105
  245. package/src/components/PlAnnotations/index.ts +2 -2
  246. package/src/components/PlAnnotations/types.ts +2 -2
  247. package/src/components/PlDataTable.ts +177 -164
  248. package/src/components/PlMultiSequenceAlignment.ts +11 -18
  249. package/src/components/PlSelectionModel.ts +1 -1
  250. package/src/components/index.ts +5 -5
  251. package/src/config/actions.ts +64 -59
  252. package/src/config/actions_kinds.ts +38 -34
  253. package/src/config/index.ts +6 -6
  254. package/src/config/model.ts +28 -28
  255. package/src/config/model_meta.ts +1 -1
  256. package/src/config/type_engine.ts +3 -3
  257. package/src/config/type_util.ts +2 -2
  258. package/src/env_value.ts +2 -2
  259. package/src/filters/converter.test.ts +185 -144
  260. package/src/filters/converter.ts +47 -35
  261. package/src/filters/index.ts +2 -2
  262. package/src/filters/types.ts +44 -39
  263. package/src/global.d.ts +1 -1
  264. package/src/index.ts +24 -24
  265. package/src/internal.ts +27 -17
  266. package/src/pframe.ts +3 -3
  267. package/src/pframe_utils/columns.ts +81 -31
  268. package/src/pframe_utils/index.ts +65 -43
  269. package/src/platforma.ts +44 -21
  270. package/src/raw_globals.ts +13 -7
  271. package/src/ref_util.ts +6 -6
  272. package/src/render/accessor.ts +43 -44
  273. package/src/render/api.ts +102 -78
  274. package/src/render/future.ts +2 -2
  275. package/src/render/index.ts +6 -6
  276. package/src/render/internal.ts +11 -12
  277. package/src/render/traversal_ops.ts +1 -1
  278. package/src/render/util/axis_filtering.ts +67 -52
  279. package/src/render/util/column_collection.ts +171 -91
  280. package/src/render/util/index.ts +4 -4
  281. package/src/render/util/label.test.ts +139 -139
  282. package/src/render/util/label.ts +42 -33
  283. package/src/render/util/pcolumn_data.ts +111 -75
  284. package/src/render/util/pframe_upgraders.ts +24 -13
  285. package/src/render/util/split_selectors.ts +6 -1
  286. package/src/sdk_info.ts +1 -1
  287. package/src/typing.test.ts +56 -56
  288. package/src/version.ts +1 -1
@@ -1,336 +1,377 @@
1
- import type { SUniversalPColumnId } from '@milaboratories/pl-model-common';
2
- import { describe, expect, it } from 'vitest';
3
- import { convertFilterUiToExpressions } from './converter';
4
- import { FilterSpec } from './types';
1
+ import type { SUniversalPColumnId } from "@milaboratories/pl-model-common";
2
+ import { describe, expect, it } from "vitest";
3
+ import { convertFilterUiToExpressions } from "./converter";
4
+ import { FilterSpec } from "./types";
5
5
 
6
- describe('convertFilterUiToExpressions', () => {
6
+ describe("convertFilterUiToExpressions", () => {
7
7
  it('should compile "or" filter to ptabler expression', () => {
8
8
  const uiFilter: FilterSpec = {
9
- type: 'or',
9
+ type: "or",
10
10
  filters: [
11
- { type: 'isNA', column: 'colA' as unknown as SUniversalPColumnId },
12
- { type: 'patternEquals', column: 'colB' as unknown as SUniversalPColumnId, value: 'test' },
11
+ { type: "isNA", column: "colA" as unknown as SUniversalPColumnId },
12
+ { type: "patternEquals", column: "colB" as unknown as SUniversalPColumnId, value: "test" },
13
13
  ],
14
14
  };
15
15
  const result = convertFilterUiToExpressions(uiFilter);
16
- expect(result.type).toBe('or');
16
+ expect(result.type).toBe("or");
17
17
  expect((result as any).operands).toHaveLength(2);
18
- expect((result as any).operands[0].type).toBe('is_na');
19
- expect((result as any).operands[1].type).toBe('eq');
18
+ expect((result as any).operands[0].type).toBe("is_na");
19
+ expect((result as any).operands[1].type).toBe("eq");
20
20
  });
21
21
 
22
22
  it('should compile "and" filter to ptabler expression', () => {
23
23
  const uiFilter: FilterSpec = {
24
- type: 'and',
24
+ type: "and",
25
25
  filters: [
26
- { type: 'isNA', column: 'colA' as unknown as SUniversalPColumnId },
27
- { type: 'greaterThan', column: 'colNum' as unknown as SUniversalPColumnId, x: 10 },
26
+ { type: "isNA", column: "colA" as unknown as SUniversalPColumnId },
27
+ { type: "greaterThan", column: "colNum" as unknown as SUniversalPColumnId, x: 10 },
28
28
  ],
29
29
  };
30
30
  const result = convertFilterUiToExpressions(uiFilter);
31
- expect(result.type).toBe('and');
31
+ expect(result.type).toBe("and");
32
32
  expect((result as any).operands).toHaveLength(2);
33
- expect((result as any).operands[0].type).toBe('is_na');
34
- expect((result as any).operands[1].type).toBe('gt');
33
+ expect((result as any).operands[0].type).toBe("is_na");
34
+ expect((result as any).operands[1].type).toBe("gt");
35
35
  });
36
36
 
37
37
  it('should compile "not" filter to ptabler expression', () => {
38
38
  const uiFilter: FilterSpec = {
39
- type: 'not',
40
- filter: { type: 'isNA', column: 'colA' as unknown as SUniversalPColumnId },
39
+ type: "not",
40
+ filter: { type: "isNA", column: "colA" as unknown as SUniversalPColumnId },
41
41
  };
42
42
  const result = convertFilterUiToExpressions(uiFilter);
43
- expect(result.type).toBe('not');
44
- expect((result as any).value.type).toBe('is_na');
45
- expect((result as any).value.value.type).toBe('col');
46
- expect((result as any).value.value.name).toBe('colA');
43
+ expect(result.type).toBe("not");
44
+ expect((result as any).value.type).toBe("is_na");
45
+ expect((result as any).value.value.type).toBe("col");
46
+ expect((result as any).value.value.name).toBe("colA");
47
47
  });
48
48
 
49
49
  it('should compile "isNA" filter to ptabler expression', () => {
50
- const uiFilter: FilterSpec = { type: 'isNA', column: 'colA' as unknown as SUniversalPColumnId };
50
+ const uiFilter: FilterSpec = { type: "isNA", column: "colA" as unknown as SUniversalPColumnId };
51
51
  const result = convertFilterUiToExpressions(uiFilter);
52
52
  expect(result as any).toEqual({
53
- type: 'is_na',
54
- value: { type: 'col', name: 'colA' },
53
+ type: "is_na",
54
+ value: { type: "col", name: "colA" },
55
55
  });
56
56
  });
57
57
 
58
58
  it('should compile "isNotNA" filter to ptabler expression', () => {
59
- const uiFilter: FilterSpec = { type: 'isNotNA', column: 'colA' as unknown as SUniversalPColumnId };
59
+ const uiFilter: FilterSpec = {
60
+ type: "isNotNA",
61
+ column: "colA" as unknown as SUniversalPColumnId,
62
+ };
60
63
  const result = convertFilterUiToExpressions(uiFilter);
61
64
  expect(result as any).toEqual({
62
- type: 'is_not_na',
63
- value: { type: 'col', name: 'colA' },
65
+ type: "is_not_na",
66
+ value: { type: "col", name: "colA" },
64
67
  });
65
68
  });
66
69
 
67
70
  it('should compile "patternEquals" filter to ptabler expression', () => {
68
- const uiFilter: FilterSpec = { type: 'patternEquals', column: 'colB' as unknown as SUniversalPColumnId, value: 'abc' };
71
+ const uiFilter: FilterSpec = {
72
+ type: "patternEquals",
73
+ column: "colB" as unknown as SUniversalPColumnId,
74
+ value: "abc",
75
+ };
69
76
  const result = convertFilterUiToExpressions(uiFilter);
70
77
  expect(result as any).toEqual({
71
- type: 'eq',
72
- lhs: { type: 'col', name: 'colB' },
73
- rhs: { type: 'const', value: 'abc' },
78
+ type: "eq",
79
+ lhs: { type: "col", name: "colB" },
80
+ rhs: { type: "const", value: "abc" },
74
81
  });
75
82
  });
76
83
 
77
84
  it('should compile "patternNotEquals" filter to ptabler expression', () => {
78
- const uiFilter: FilterSpec = { type: 'patternNotEquals', column: 'colB' as unknown as SUniversalPColumnId, value: 'abc' };
85
+ const uiFilter: FilterSpec = {
86
+ type: "patternNotEquals",
87
+ column: "colB" as unknown as SUniversalPColumnId,
88
+ value: "abc",
89
+ };
79
90
  const result = convertFilterUiToExpressions(uiFilter);
80
91
  expect(result as any).toEqual({
81
- type: 'neq',
82
- lhs: { type: 'col', name: 'colB' },
83
- rhs: { type: 'const', value: 'abc' },
92
+ type: "neq",
93
+ lhs: { type: "col", name: "colB" },
94
+ rhs: { type: "const", value: "abc" },
84
95
  });
85
96
  });
86
97
 
87
98
  it('should compile "patternContainSubsequence" filter to ptabler expression', () => {
88
- const uiFilter: FilterSpec = { type: 'patternContainSubsequence', column: 'colC' as unknown as SUniversalPColumnId, value: 'sub' };
99
+ const uiFilter: FilterSpec = {
100
+ type: "patternContainSubsequence",
101
+ column: "colC" as unknown as SUniversalPColumnId,
102
+ value: "sub",
103
+ };
89
104
  const result = convertFilterUiToExpressions(uiFilter);
90
- expect(result.type).toBe('str_contains');
91
- expect((result as any).value).toEqual({ type: 'col', name: 'colC' });
92
- expect((result as any).pattern).toEqual({ type: 'const', value: 'sub' });
105
+ expect(result.type).toBe("str_contains");
106
+ expect((result as any).value).toEqual({ type: "col", name: "colC" });
107
+ expect((result as any).pattern).toEqual({ type: "const", value: "sub" });
93
108
  });
94
109
 
95
110
  it('should compile "patternNotContainSubsequence" filter to ptabler expression', () => {
96
- const uiFilter: FilterSpec = { type: 'patternNotContainSubsequence', column: 'colC' as unknown as SUniversalPColumnId, value: 'sub' };
111
+ const uiFilter: FilterSpec = {
112
+ type: "patternNotContainSubsequence",
113
+ column: "colC" as unknown as SUniversalPColumnId,
114
+ value: "sub",
115
+ };
97
116
  const result = convertFilterUiToExpressions(uiFilter);
98
- expect(result.type).toBe('not');
99
- expect((result as any).value.type).toBe('str_contains');
100
- expect((result as any).value.value).toEqual({ type: 'col', name: 'colC' });
101
- expect((result as any).value.pattern).toEqual({ type: 'const', value: 'sub' });
117
+ expect(result.type).toBe("not");
118
+ expect((result as any).value.type).toBe("str_contains");
119
+ expect((result as any).value.value).toEqual({ type: "col", name: "colC" });
120
+ expect((result as any).value.pattern).toEqual({ type: "const", value: "sub" });
102
121
  });
103
122
 
104
- it('should compile numerical comparison filters to ptabler expressions', () => {
123
+ it("should compile numerical comparison filters to ptabler expressions", () => {
105
124
  const testCases = [
106
- { type: 'equal' as const, expected: 'eq' },
107
- { type: 'lessThan' as const, expected: 'lt' },
108
- { type: 'greaterThan' as const, expected: 'gt' },
109
- { type: 'lessThanOrEqual' as const, expected: 'le' },
110
- { type: 'greaterThanOrEqual' as const, expected: 'ge' },
125
+ { type: "equal" as const, expected: "eq" },
126
+ { type: "lessThan" as const, expected: "lt" },
127
+ { type: "greaterThan" as const, expected: "gt" },
128
+ { type: "lessThanOrEqual" as const, expected: "le" },
129
+ { type: "greaterThanOrEqual" as const, expected: "ge" },
111
130
  ];
112
131
 
113
132
  testCases.forEach(({ type, expected }) => {
114
- const uiFilter: FilterSpec = { type, column: 'colNum' as unknown as SUniversalPColumnId, x: 10 };
133
+ const uiFilter: FilterSpec = {
134
+ type,
135
+ column: "colNum" as unknown as SUniversalPColumnId,
136
+ x: 10,
137
+ };
115
138
  const result = convertFilterUiToExpressions(uiFilter);
116
139
  expect(result as any).toEqual({
117
140
  type: expected,
118
- lhs: { type: 'col', name: 'colNum' },
119
- rhs: { type: 'const', value: 10 },
141
+ lhs: { type: "col", name: "colNum" },
142
+ rhs: { type: "const", value: 10 },
120
143
  });
121
144
  });
122
145
  });
123
146
 
124
147
  it('should compile "lessThanColumn" filter to ptabler expression', () => {
125
148
  const uiFilter: FilterSpec = {
126
- type: 'lessThanColumn',
127
- column: 'colNum1' as unknown as SUniversalPColumnId,
128
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
149
+ type: "lessThanColumn",
150
+ column: "colNum1" as unknown as SUniversalPColumnId,
151
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
129
152
  };
130
153
  const result = convertFilterUiToExpressions(uiFilter);
131
154
  expect(result as any).toEqual({
132
- type: 'lt',
133
- lhs: { type: 'col', name: 'colNum1' },
134
- rhs: { type: 'col', name: 'colNum2' },
155
+ type: "lt",
156
+ lhs: { type: "col", name: "colNum1" },
157
+ rhs: { type: "col", name: "colNum2" },
135
158
  });
136
159
  });
137
160
 
138
161
  it('should compile "lessThanColumn" filter with minDiff to ptabler expression', () => {
139
162
  const uiFilter: FilterSpec = {
140
- type: 'lessThanColumn',
141
- column: 'colNum1' as unknown as SUniversalPColumnId,
142
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
163
+ type: "lessThanColumn",
164
+ column: "colNum1" as unknown as SUniversalPColumnId,
165
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
143
166
  minDiff: 5,
144
167
  };
145
168
  const result = convertFilterUiToExpressions(uiFilter);
146
169
  expect(result as any).toEqual({
147
- type: 'lt',
170
+ type: "lt",
148
171
  lhs: {
149
- type: 'plus',
150
- lhs: { type: 'col', name: 'colNum1' },
151
- rhs: { type: 'const', value: 5 },
172
+ type: "plus",
173
+ lhs: { type: "col", name: "colNum1" },
174
+ rhs: { type: "const", value: 5 },
152
175
  },
153
- rhs: { type: 'col', name: 'colNum2' },
176
+ rhs: { type: "col", name: "colNum2" },
154
177
  });
155
178
  });
156
179
 
157
180
  it('should compile "greaterThanColumn" filter to ptabler expression', () => {
158
181
  const uiFilter: FilterSpec = {
159
- type: 'greaterThanColumn',
160
- column: 'colNum1' as unknown as SUniversalPColumnId,
161
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
182
+ type: "greaterThanColumn",
183
+ column: "colNum1" as unknown as SUniversalPColumnId,
184
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
162
185
  };
163
186
  const result = convertFilterUiToExpressions(uiFilter);
164
187
  expect(result as any).toEqual({
165
- type: 'gt',
166
- lhs: { type: 'col', name: 'colNum1' },
167
- rhs: { type: 'col', name: 'colNum2' },
188
+ type: "gt",
189
+ lhs: { type: "col", name: "colNum1" },
190
+ rhs: { type: "col", name: "colNum2" },
168
191
  });
169
192
  });
170
193
 
171
194
  it('should compile "greaterThanColumn" filter with minDiff to ptabler expression', () => {
172
195
  const uiFilter: FilterSpec = {
173
- type: 'greaterThanColumn',
174
- column: 'colNum1' as unknown as SUniversalPColumnId,
175
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
196
+ type: "greaterThanColumn",
197
+ column: "colNum1" as unknown as SUniversalPColumnId,
198
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
176
199
  minDiff: 7,
177
200
  };
178
201
  const result = convertFilterUiToExpressions(uiFilter);
179
202
  expect(result as any).toEqual({
180
- type: 'gt',
203
+ type: "gt",
181
204
  lhs: {
182
- type: 'plus',
183
- lhs: { type: 'col', name: 'colNum1' },
184
- rhs: { type: 'const', value: 7 },
205
+ type: "plus",
206
+ lhs: { type: "col", name: "colNum1" },
207
+ rhs: { type: "const", value: 7 },
185
208
  },
186
- rhs: { type: 'col', name: 'colNum2' },
209
+ rhs: { type: "col", name: "colNum2" },
187
210
  });
188
211
  });
189
212
 
190
213
  it('should compile "equalToColumn" filter to ptabler expression', () => {
191
214
  const uiFilter: FilterSpec = {
192
- type: 'equalToColumn',
193
- column: 'colNum1' as unknown as SUniversalPColumnId,
194
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
215
+ type: "equalToColumn",
216
+ column: "colNum1" as unknown as SUniversalPColumnId,
217
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
195
218
  };
196
219
  const result = convertFilterUiToExpressions(uiFilter);
197
220
  expect(result as any).toEqual({
198
- type: 'eq',
199
- lhs: { type: 'col', name: 'colNum1' },
200
- rhs: { type: 'col', name: 'colNum2' },
221
+ type: "eq",
222
+ lhs: { type: "col", name: "colNum1" },
223
+ rhs: { type: "col", name: "colNum2" },
201
224
  });
202
225
  });
203
226
 
204
227
  it('should compile "greaterThanColumnOrEqual" filter to ptabler expression', () => {
205
228
  const uiFilter: FilterSpec = {
206
- type: 'greaterThanColumnOrEqual',
207
- column: 'colNum1' as unknown as SUniversalPColumnId,
208
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
229
+ type: "greaterThanColumnOrEqual",
230
+ column: "colNum1" as unknown as SUniversalPColumnId,
231
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
209
232
  };
210
233
  const result = convertFilterUiToExpressions(uiFilter);
211
234
  expect(result as any).toEqual({
212
- type: 'ge',
213
- lhs: { type: 'col', name: 'colNum1' },
214
- rhs: { type: 'col', name: 'colNum2' },
235
+ type: "ge",
236
+ lhs: { type: "col", name: "colNum1" },
237
+ rhs: { type: "col", name: "colNum2" },
215
238
  });
216
239
  });
217
240
 
218
241
  it('should compile "greaterThanColumnOrEqual" filter with minDiff to ptabler expression', () => {
219
242
  const uiFilter: FilterSpec = {
220
- type: 'greaterThanColumnOrEqual',
221
- column: 'colNum1' as unknown as SUniversalPColumnId,
222
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
243
+ type: "greaterThanColumnOrEqual",
244
+ column: "colNum1" as unknown as SUniversalPColumnId,
245
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
223
246
  minDiff: 2,
224
247
  };
225
248
  const result = convertFilterUiToExpressions(uiFilter);
226
249
  expect(result as any).toEqual({
227
- type: 'ge',
250
+ type: "ge",
228
251
  lhs: {
229
- type: 'plus',
230
- lhs: { type: 'col', name: 'colNum1' },
231
- rhs: { type: 'const', value: 2 },
252
+ type: "plus",
253
+ lhs: { type: "col", name: "colNum1" },
254
+ rhs: { type: "const", value: 2 },
232
255
  },
233
- rhs: { type: 'col', name: 'colNum2' },
256
+ rhs: { type: "col", name: "colNum2" },
234
257
  });
235
258
  });
236
259
 
237
260
  it('should compile "lessThanColumnOrEqual" filter to ptabler expression', () => {
238
261
  const uiFilter: FilterSpec = {
239
- type: 'lessThanColumnOrEqual',
240
- column: 'colNum1' as unknown as SUniversalPColumnId,
241
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
262
+ type: "lessThanColumnOrEqual",
263
+ column: "colNum1" as unknown as SUniversalPColumnId,
264
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
242
265
  };
243
266
  const result = convertFilterUiToExpressions(uiFilter);
244
267
  expect(result as any).toEqual({
245
- type: 'le',
246
- lhs: { type: 'col', name: 'colNum1' },
247
- rhs: { type: 'col', name: 'colNum2' },
268
+ type: "le",
269
+ lhs: { type: "col", name: "colNum1" },
270
+ rhs: { type: "col", name: "colNum2" },
248
271
  });
249
272
  });
250
273
 
251
274
  it('should compile "lessThanColumnOrEqual" filter with minDiff to ptabler expression', () => {
252
275
  const uiFilter: FilterSpec = {
253
- type: 'lessThanColumnOrEqual',
254
- column: 'colNum1' as unknown as SUniversalPColumnId,
255
- rhs: 'colNum2' as unknown as SUniversalPColumnId,
276
+ type: "lessThanColumnOrEqual",
277
+ column: "colNum1" as unknown as SUniversalPColumnId,
278
+ rhs: "colNum2" as unknown as SUniversalPColumnId,
256
279
  minDiff: 3,
257
280
  };
258
281
  const result = convertFilterUiToExpressions(uiFilter);
259
282
  expect(result as any).toEqual({
260
- type: 'le',
283
+ type: "le",
261
284
  lhs: {
262
- type: 'plus',
263
- lhs: { type: 'col', name: 'colNum1' },
264
- rhs: { type: 'const', value: 3 },
285
+ type: "plus",
286
+ lhs: { type: "col", name: "colNum1" },
287
+ rhs: { type: "const", value: 3 },
265
288
  },
266
- rhs: { type: 'col', name: 'colNum2' },
289
+ rhs: { type: "col", name: "colNum2" },
267
290
  });
268
291
  });
269
292
 
270
293
  it('should compile "topN" filter to ptabler expression', () => {
271
- const uiFilter: FilterSpec = { type: 'topN', column: 'colNum' as unknown as SUniversalPColumnId, n: 5 };
294
+ const uiFilter: FilterSpec = {
295
+ type: "topN",
296
+ column: "colNum" as unknown as SUniversalPColumnId,
297
+ n: 5,
298
+ };
272
299
  const result = convertFilterUiToExpressions(uiFilter);
273
300
  expect(result as any).toEqual({
274
- type: 'le',
301
+ type: "le",
275
302
  lhs: {
276
- type: 'rank',
277
- orderBy: [{ type: 'col', name: 'colNum' }],
303
+ type: "rank",
304
+ orderBy: [{ type: "col", name: "colNum" }],
278
305
  partitionBy: [],
279
306
  descending: true,
280
307
  },
281
- rhs: { type: 'const', value: 5 },
308
+ rhs: { type: "const", value: 5 },
282
309
  });
283
310
  });
284
311
 
285
312
  it('should compile "bottomN" filter to ptabler expression', () => {
286
- const uiFilter: FilterSpec = { type: 'bottomN', column: 'colNum' as unknown as SUniversalPColumnId, n: 3 };
313
+ const uiFilter: FilterSpec = {
314
+ type: "bottomN",
315
+ column: "colNum" as unknown as SUniversalPColumnId,
316
+ n: 3,
317
+ };
287
318
  const result = convertFilterUiToExpressions(uiFilter);
288
319
  expect(result as any).toEqual({
289
- type: 'le',
320
+ type: "le",
290
321
  lhs: {
291
- type: 'rank',
292
- orderBy: [{ type: 'col', name: 'colNum' }],
322
+ type: "rank",
323
+ orderBy: [{ type: "col", name: "colNum" }],
293
324
  partitionBy: [],
294
325
  descending: undefined, // ptabler-js sets descending to undefined when false
295
326
  },
296
- rhs: { type: 'const', value: 3 },
327
+ rhs: { type: "const", value: 3 },
297
328
  });
298
329
  });
299
330
 
300
- it('should compile nested filters to ptabler expressions', () => {
331
+ it("should compile nested filters to ptabler expressions", () => {
301
332
  const uiFilter: FilterSpec = {
302
- type: 'and',
333
+ type: "and",
303
334
  filters: [
304
335
  {
305
- type: 'or',
336
+ type: "or",
306
337
  filters: [
307
- { type: 'isNA', column: 'colA' as unknown as SUniversalPColumnId },
308
- { type: 'patternEquals', column: 'colB' as unknown as SUniversalPColumnId, value: 'test' },
338
+ { type: "isNA", column: "colA" as unknown as SUniversalPColumnId },
339
+ {
340
+ type: "patternEquals",
341
+ column: "colB" as unknown as SUniversalPColumnId,
342
+ value: "test",
343
+ },
309
344
  ],
310
345
  },
311
- { type: 'greaterThan', column: 'colNum' as unknown as SUniversalPColumnId, x: 10 },
346
+ { type: "greaterThan", column: "colNum" as unknown as SUniversalPColumnId, x: 10 },
312
347
  ],
313
348
  };
314
349
  const result = convertFilterUiToExpressions(uiFilter);
315
- expect(result.type).toBe('and');
350
+ expect(result.type).toBe("and");
316
351
  expect((result as any).operands).toHaveLength(2);
317
- expect((result as any).operands[0].type).toBe('or');
352
+ expect((result as any).operands[0].type).toBe("or");
318
353
  expect((result as any).operands[0].operands).toHaveLength(2);
319
- expect((result as any).operands[1].type).toBe('gt');
354
+ expect((result as any).operands[1].type).toBe("gt");
320
355
  });
321
356
 
322
- it('should throw error for OR filter with no operands', () => {
323
- const uiFilter: FilterSpec = { type: 'or', filters: [] };
324
- expect(() => convertFilterUiToExpressions(uiFilter)).toThrow('OR filter requires at least one operand');
357
+ it("should throw error for OR filter with no operands", () => {
358
+ const uiFilter: FilterSpec = { type: "or", filters: [] };
359
+ expect(() => convertFilterUiToExpressions(uiFilter)).toThrow(
360
+ "OR filter requires at least one operand",
361
+ );
325
362
  });
326
363
 
327
- it('should throw error for AND filter with no operands', () => {
328
- const uiFilter: FilterSpec = { type: 'and', filters: [] };
329
- expect(() => convertFilterUiToExpressions(uiFilter)).toThrow('AND filter requires at least one operand');
364
+ it("should throw error for AND filter with no operands", () => {
365
+ const uiFilter: FilterSpec = { type: "and", filters: [] };
366
+ expect(() => convertFilterUiToExpressions(uiFilter)).toThrow(
367
+ "AND filter requires at least one operand",
368
+ );
330
369
  });
331
370
 
332
- it('should throw error for undefined filter type', () => {
371
+ it("should throw error for undefined filter type", () => {
333
372
  const uiFilter: FilterSpec = { type: undefined };
334
- expect(() => convertFilterUiToExpressions(uiFilter)).toThrow('Filter type is undefined, this should not happen');
373
+ expect(() => convertFilterUiToExpressions(uiFilter)).toThrow(
374
+ "Filter type is undefined, this should not happen",
375
+ );
335
376
  });
336
377
  });