@platforma-sdk/model 1.53.10 → 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 +23 -21
  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,127 +1,139 @@
1
- import { assertNever } from '@milaboratories/pl-model-common';
2
- import { and, col, lit, or, rank, type Expression, type ExpressionImpl } from '@milaboratories/ptabler-expression-js';
3
- import type { FilterSpec } from '../filters';
1
+ import { assertNever } from "@milaboratories/pl-model-common";
2
+ import {
3
+ and,
4
+ col,
5
+ lit,
6
+ or,
7
+ rank,
8
+ type Expression,
9
+ type ExpressionImpl,
10
+ } from "@milaboratories/ptabler-expression-js";
11
+ import type { FilterSpec } from "../filters";
4
12
 
5
13
  export function convertFilterUiToExpressionImpl(value: FilterSpec): ExpressionImpl {
6
- if (value.type === 'or') {
7
- const expressions = value.filters.filter((f) => f.type !== undefined).map(convertFilterUiToExpressionImpl);
14
+ if (value.type === "or") {
15
+ const expressions = value.filters
16
+ .filter((f) => f.type !== undefined)
17
+ .map(convertFilterUiToExpressionImpl);
8
18
  if (expressions.length === 0) {
9
- throw new Error('OR filter requires at least one operand');
19
+ throw new Error("OR filter requires at least one operand");
10
20
  }
11
21
  return or(...expressions);
12
22
  }
13
23
 
14
- if (value.type === 'and') {
15
- const expressions = value.filters.filter((f) => f.type !== undefined).map(convertFilterUiToExpressionImpl);
24
+ if (value.type === "and") {
25
+ const expressions = value.filters
26
+ .filter((f) => f.type !== undefined)
27
+ .map(convertFilterUiToExpressionImpl);
16
28
  if (expressions.length === 0) {
17
- throw new Error('AND filter requires at least one operand');
29
+ throw new Error("AND filter requires at least one operand");
18
30
  }
19
31
  return and(...expressions);
20
32
  }
21
33
 
22
- if (value.type === 'not') {
34
+ if (value.type === "not") {
23
35
  return convertFilterUiToExpressionImpl(value.filter).not();
24
36
  }
25
37
 
26
- if (value.type === 'isNA') {
38
+ if (value.type === "isNA") {
27
39
  return col(value.column).isNull();
28
40
  }
29
41
 
30
- if (value.type === 'isNotNA') {
42
+ if (value.type === "isNotNA") {
31
43
  return col(value.column).isNotNull();
32
44
  }
33
45
 
34
- if (value.type === 'patternEquals') {
46
+ if (value.type === "patternEquals") {
35
47
  return col(value.column).eq(lit(value.value));
36
48
  }
37
49
 
38
- if (value.type === 'patternNotEquals') {
50
+ if (value.type === "patternNotEquals") {
39
51
  return col(value.column).neq(lit(value.value));
40
52
  }
41
53
 
42
- if (value.type === 'patternContainSubsequence') {
54
+ if (value.type === "patternContainSubsequence") {
43
55
  return col(value.column).strContains(value.value, false, true);
44
56
  }
45
57
 
46
- if (value.type === 'patternNotContainSubsequence') {
58
+ if (value.type === "patternNotContainSubsequence") {
47
59
  return col(value.column).strContains(value.value, false, true).not();
48
60
  }
49
61
 
50
- if (value.type === 'equal') {
62
+ if (value.type === "equal") {
51
63
  return col(value.column).eq(lit(value.x));
52
64
  }
53
65
 
54
- if (value.type === 'notEqual') {
66
+ if (value.type === "notEqual") {
55
67
  return col(value.column).neq(lit(value.x));
56
68
  }
57
69
 
58
- if (value.type === 'lessThan') {
70
+ if (value.type === "lessThan") {
59
71
  return col(value.column).lt(lit(value.x));
60
72
  }
61
73
 
62
- if (value.type === 'greaterThan') {
74
+ if (value.type === "greaterThan") {
63
75
  return col(value.column).gt(lit(value.x));
64
76
  }
65
77
 
66
- if (value.type === 'lessThanOrEqual') {
78
+ if (value.type === "lessThanOrEqual") {
67
79
  return col(value.column).le(lit(value.x));
68
80
  }
69
81
 
70
- if (value.type === 'greaterThanOrEqual') {
82
+ if (value.type === "greaterThanOrEqual") {
71
83
  return col(value.column).ge(lit(value.x));
72
84
  }
73
85
 
74
- if (value.type === 'equalToColumn') {
86
+ if (value.type === "equalToColumn") {
75
87
  return col(value.column).eq(col(value.rhs));
76
88
  }
77
89
 
78
- if (value.type === 'greaterThanColumn') {
90
+ if (value.type === "greaterThanColumn") {
79
91
  if (value.minDiff !== undefined && value.minDiff !== 0) {
80
92
  return col(value.column).plus(lit(value.minDiff)).gt(col(value.rhs));
81
93
  }
82
94
  return col(value.column).gt(col(value.rhs));
83
95
  }
84
96
 
85
- if (value.type === 'lessThanColumn') {
97
+ if (value.type === "lessThanColumn") {
86
98
  if (value.minDiff !== undefined && value.minDiff !== 0) {
87
99
  return col(value.column).plus(lit(value.minDiff)).lt(col(value.rhs));
88
100
  }
89
101
  return col(value.column).lt(col(value.rhs));
90
102
  }
91
103
 
92
- if (value.type === 'greaterThanColumnOrEqual') {
104
+ if (value.type === "greaterThanColumnOrEqual") {
93
105
  if (value.minDiff !== undefined && value.minDiff !== 0) {
94
106
  return col(value.column).plus(lit(value.minDiff)).ge(col(value.rhs));
95
107
  }
96
108
  return col(value.column).ge(col(value.rhs));
97
109
  }
98
110
 
99
- if (value.type === 'lessThanColumnOrEqual') {
111
+ if (value.type === "lessThanColumnOrEqual") {
100
112
  if (value.minDiff !== undefined && value.minDiff !== 0) {
101
113
  return col(value.column).plus(lit(value.minDiff)).le(col(value.rhs));
102
114
  }
103
115
  return col(value.column).le(col(value.rhs));
104
116
  }
105
117
 
106
- if (value.type === 'topN') {
118
+ if (value.type === "topN") {
107
119
  return rank(col(value.column), true).over([]).le(lit(value.n));
108
120
  }
109
121
 
110
- if (value.type === 'bottomN') {
122
+ if (value.type === "bottomN") {
111
123
  return rank(col(value.column), false).over([]).le(lit(value.n));
112
124
  }
113
125
 
114
126
  if (
115
- value.type === 'patternMatchesRegularExpression'
116
- || value.type === 'patternFuzzyContainSubsequence'
117
- || value.type === 'inSet'
118
- || value.type === 'notInSet'
127
+ value.type === "patternMatchesRegularExpression" ||
128
+ value.type === "patternFuzzyContainSubsequence" ||
129
+ value.type === "inSet" ||
130
+ value.type === "notInSet"
119
131
  ) {
120
- throw new Error('Not implemented filter type: ' + value.type);
132
+ throw new Error("Not implemented filter type: " + value.type);
121
133
  }
122
134
 
123
135
  if (value.type === undefined) {
124
- throw new Error('Filter type is undefined, this should not happen');
136
+ throw new Error("Filter type is undefined, this should not happen");
125
137
  }
126
138
 
127
139
  assertNever(value);
@@ -1,2 +1,2 @@
1
- export * from './converter';
2
- export * from './types';
1
+ export * from "./converter";
2
+ export * from "./types";
@@ -1,6 +1,6 @@
1
- import type { PColumnSpec, SUniversalPColumnId } from '@milaboratories/pl-model-common';
1
+ import type { PColumnSpec, SUniversalPColumnId } from "@milaboratories/pl-model-common";
2
2
 
3
- export type SimplifiedPColumnSpec = Pick<PColumnSpec, 'valueType' | 'annotations'>;
3
+ export type SimplifiedPColumnSpec = Pick<PColumnSpec, "valueType" | "annotations">;
4
4
 
5
5
  export type SimplifiedUniversalPColumnEntry = {
6
6
  id: SUniversalPColumnId;
@@ -9,45 +9,50 @@ export type SimplifiedUniversalPColumnEntry = {
9
9
  };
10
10
 
11
11
  export type FilterSpecNode<Leaf, CommonNode = {}, CommonLeaf = {}> =
12
- | CommonLeaf & Leaf
13
- | CommonNode & { type: 'not'; filter: FilterSpecNode<Leaf, CommonNode, CommonLeaf> }
14
- | CommonNode & { type: 'or'; filters: FilterSpecNode<Leaf, CommonNode, CommonLeaf>[] }
15
- | CommonNode & { type: 'and'; filters: FilterSpecNode<Leaf, CommonNode, CommonLeaf>[] };
12
+ | (CommonLeaf & Leaf)
13
+ | (CommonNode & { type: "not"; filter: FilterSpecNode<Leaf, CommonNode, CommonLeaf> })
14
+ | (CommonNode & { type: "or"; filters: FilterSpecNode<Leaf, CommonNode, CommonLeaf>[] })
15
+ | (CommonNode & { type: "and"; filters: FilterSpecNode<Leaf, CommonNode, CommonLeaf>[] });
16
16
 
17
17
  export type FilterSpecLeaf<T = SUniversalPColumnId> =
18
18
  | { type: undefined }
19
- | { type: 'isNA'; column: T }
20
- | { type: 'isNotNA'; column: T }
21
-
22
- | { type: 'patternEquals'; column: T; value: string }
23
- | { type: 'patternNotEquals'; column: T; value: string }
24
- | { type: 'patternContainSubsequence'; column: T; value: string }
25
- | { type: 'patternNotContainSubsequence'; column: T; value: string }
26
- | { type: 'patternMatchesRegularExpression'; column: T; value: string }
27
- | { type: 'patternFuzzyContainSubsequence'; column: T; value: string; maxEdits?: number; substitutionsOnly?: boolean; wildcard?: string }
28
-
29
- | { type: 'inSet'; column: T; value: string[] }
30
- | { type: 'notInSet'; column: T; value: string[] }
31
-
32
- | { type: 'topN'; column: T; n: number }
33
- | { type: 'bottomN'; column: T; n: number }
34
-
35
- | { type: 'equal'; column: T; x: number }
36
- | { type: 'notEqual'; column: T; x: number }
37
- | { type: 'lessThan'; column: T; x: number }
38
- | { type: 'greaterThan'; column: T; x: number }
39
- | { type: 'lessThanOrEqual'; column: T; x: number }
40
- | { type: 'greaterThanOrEqual'; column: T; x: number }
41
-
42
- | { type: 'equalToColumn'; column: T; rhs: T }
43
- | { type: 'lessThanColumn'; column: T; rhs: T; minDiff?: number }
44
- | { type: 'greaterThanColumn'; column: T; rhs: T; minDiff?: number }
45
- | { type: 'lessThanColumnOrEqual'; column: T; rhs: T; minDiff?: number }
46
- | { type: 'greaterThanColumnOrEqual'; column: T; rhs: T; minDiff?: number };
47
-
48
- export type FilterSpec<Leaf extends FilterSpecLeaf<unknown> = FilterSpecLeaf<SUniversalPColumnId>, CommonNode = {}, CommonLeaf = CommonNode> =
49
- FilterSpecNode<Leaf, CommonNode, CommonLeaf>;
50
-
51
- export type FilterSpecType = Exclude<FilterSpec, { type: undefined }>['type'];
19
+ | { type: "isNA"; column: T }
20
+ | { type: "isNotNA"; column: T }
21
+ | { type: "patternEquals"; column: T; value: string }
22
+ | { type: "patternNotEquals"; column: T; value: string }
23
+ | { type: "patternContainSubsequence"; column: T; value: string }
24
+ | { type: "patternNotContainSubsequence"; column: T; value: string }
25
+ | { type: "patternMatchesRegularExpression"; column: T; value: string }
26
+ | {
27
+ type: "patternFuzzyContainSubsequence";
28
+ column: T;
29
+ value: string;
30
+ maxEdits?: number;
31
+ substitutionsOnly?: boolean;
32
+ wildcard?: string;
33
+ }
34
+ | { type: "inSet"; column: T; value: string[] }
35
+ | { type: "notInSet"; column: T; value: string[] }
36
+ | { type: "topN"; column: T; n: number }
37
+ | { type: "bottomN"; column: T; n: number }
38
+ | { type: "equal"; column: T; x: number }
39
+ | { type: "notEqual"; column: T; x: number }
40
+ | { type: "lessThan"; column: T; x: number }
41
+ | { type: "greaterThan"; column: T; x: number }
42
+ | { type: "lessThanOrEqual"; column: T; x: number }
43
+ | { type: "greaterThanOrEqual"; column: T; x: number }
44
+ | { type: "equalToColumn"; column: T; rhs: T }
45
+ | { type: "lessThanColumn"; column: T; rhs: T; minDiff?: number }
46
+ | { type: "greaterThanColumn"; column: T; rhs: T; minDiff?: number }
47
+ | { type: "lessThanColumnOrEqual"; column: T; rhs: T; minDiff?: number }
48
+ | { type: "greaterThanColumnOrEqual"; column: T; rhs: T; minDiff?: number };
49
+
50
+ export type FilterSpec<
51
+ Leaf extends FilterSpecLeaf<unknown> = FilterSpecLeaf<SUniversalPColumnId>,
52
+ CommonNode = {},
53
+ CommonLeaf = CommonNode,
54
+ > = FilterSpecNode<Leaf, CommonNode, CommonLeaf>;
55
+
56
+ export type FilterSpecType = Exclude<FilterSpec, { type: undefined }>["type"];
52
57
 
53
58
  export type FilterSpecOfType<T extends FilterSpecType> = Extract<FilterSpec, { type: T }>;
package/src/global.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Platforma, PlatformaApiVersion } from './platforma';
1
+ import type { Platforma, PlatformaApiVersion } from "./platforma";
2
2
 
3
3
  declare global {
4
4
  /** Global factory method returning platforma instance */
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from './block_state_patch';
2
- export * from './block_state_util';
3
- export * from './block_storage';
4
- export * from './builder';
5
- export { BlockModelV3 } from './block_model';
1
+ export * from "./block_state_patch";
2
+ export * from "./block_state_util";
3
+ export * from "./block_storage";
4
+ export * from "./builder";
5
+ export { BlockModelV3 } from "./block_model";
6
6
  export {
7
7
  DataModel,
8
8
  DataModelBuilder,
@@ -11,25 +11,25 @@ export {
11
11
  defineDataVersions,
12
12
  defaultRecover,
13
13
  makeDataVersioned,
14
- } from './block_migrations';
15
- export * from './bconfig';
16
- export * from './components';
17
- export * from './config';
18
- export * from './pframe';
19
- export * from './platforma';
20
- export * from './ref_util';
21
- export * from './render';
22
- export * from './sdk_info';
23
- export * from './raw_globals';
24
- export * from './block_api_v1';
25
- export * from './block_api_v2';
26
- export * from './filters';
27
- export * from './annotations';
28
- export * from './pframe_utils';
14
+ } from "./block_migrations";
15
+ export * from "./bconfig";
16
+ export * from "./components";
17
+ export * from "./config";
18
+ export * from "./pframe";
19
+ export * from "./platforma";
20
+ export * from "./ref_util";
21
+ export * from "./render";
22
+ export * from "./sdk_info";
23
+ export * from "./raw_globals";
24
+ export * from "./block_api_v1";
25
+ export * from "./block_api_v2";
26
+ export * from "./filters";
27
+ export * from "./annotations";
28
+ export * from "./pframe_utils";
29
29
 
30
30
  // reexporting everything from SDK model
31
- export * from '@milaboratories/pl-model-common';
32
- export * from '@milaboratories/pl-error-like';
31
+ export * from "@milaboratories/pl-model-common";
32
+ export * from "@milaboratories/pl-error-like";
33
33
 
34
- export * as JsRenderInternal from './render/internal';
35
- export { getEnvironmentValue } from './env_value';
34
+ export * as JsRenderInternal from "./render/internal";
35
+ export { getEnvironmentValue } from "./env_value";
package/src/internal.ts CHANGED
@@ -1,37 +1,44 @@
1
- import type { OutputWithStatus } from '@milaboratories/pl-model-common';
2
- import { } from './global';
3
- import type { Platforma, PlatformaApiVersion } from './platforma';
4
- import type { FutureHandle, GlobalCfgRenderCtx } from './render/internal';
5
- import type { ConfigRenderLambda, ConfigRenderLambdaFlags } from './bconfig';
1
+ import type { OutputWithStatus } from "@milaboratories/pl-model-common";
2
+ import {} from "./global";
3
+ import type { Platforma, PlatformaApiVersion } from "./platforma";
4
+ import type { FutureHandle, GlobalCfgRenderCtx } from "./render/internal";
5
+ import type { ConfigRenderLambda, ConfigRenderLambdaFlags } from "./bconfig";
6
6
 
7
7
  /** Utility code helping to identify whether the code is running in actual UI environment */
8
8
  export function isInUI() {
9
9
  return (
10
- typeof globalThis.getPlatforma !== 'undefined' || typeof globalThis.platforma !== 'undefined'
10
+ typeof globalThis.getPlatforma !== "undefined" || typeof globalThis.platforma !== "undefined"
11
11
  );
12
12
  }
13
13
 
14
14
  /** Utility code helping to retrieve a platforma instance form the environment */
15
15
  export function getPlatformaInstance<
16
16
  Args = unknown,
17
- Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,
17
+ Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
18
+ string,
19
+ OutputWithStatus<unknown>
20
+ >,
18
21
  UiState = unknown,
19
22
  Href extends `/${string}` = `/${string}`,
20
- >(config?: { sdkVersion: string; apiVersion: PlatformaApiVersion }): Platforma<Args, Outputs, UiState, Href> {
21
- if (config && typeof globalThis.getPlatforma === 'function')
23
+ >(config?: {
24
+ sdkVersion: string;
25
+ apiVersion: PlatformaApiVersion;
26
+ }): Platforma<Args, Outputs, UiState, Href> {
27
+ if (config && typeof globalThis.getPlatforma === "function")
22
28
  return globalThis.getPlatforma(config);
23
- else if (typeof globalThis.platforma !== 'undefined') return globalThis.platforma as Platforma<Args, Outputs, UiState, Href>;
24
- else throw new Error('Can\'t get platforma instance.');
29
+ else if (typeof globalThis.platforma !== "undefined")
30
+ return globalThis.platforma as Platforma<Args, Outputs, UiState, Href>;
31
+ else throw new Error("Can't get platforma instance.");
25
32
  }
26
33
 
27
34
  export function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {
28
- if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;
35
+ if (typeof globalThis.cfgRenderCtx !== "undefined") return globalThis.cfgRenderCtx;
29
36
  else return undefined;
30
37
  }
31
38
 
32
39
  export function getCfgRenderCtx(): GlobalCfgRenderCtx {
33
- if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;
34
- else throw new Error('Not in config rendering context');
40
+ if (typeof globalThis.cfgRenderCtx !== "undefined") return globalThis.cfgRenderCtx;
41
+ else throw new Error("Not in config rendering context");
35
42
  }
36
43
 
37
44
  export function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean {
@@ -78,9 +85,12 @@ export function createRenderLambda<T = unknown>(opts: CreateLambdaOptions): Conf
78
85
  }
79
86
 
80
87
  /** Registers a callback and returns a ConfigRenderLambda descriptor. */
81
- export function createAndRegisterRenderLambda<T = unknown>(opts: CreateLambdaOptions & {
82
- lambda: (...args: any[]) => any;
83
- }, replace?: boolean): ConfigRenderLambda<T> {
88
+ export function createAndRegisterRenderLambda<T = unknown>(
89
+ opts: CreateLambdaOptions & {
90
+ lambda: (...args: any[]) => any;
91
+ },
92
+ replace?: boolean,
93
+ ): ConfigRenderLambda<T> {
84
94
  const { handle, lambda, ...flags } = opts;
85
95
 
86
96
  if (replace) {
package/src/pframe.ts CHANGED
@@ -11,8 +11,8 @@ import type {
11
11
  TableRange,
12
12
  UniqueValuesRequest,
13
13
  UniqueValuesResponse,
14
- } from '@milaboratories/pl-model-common';
15
- import { patchInSetFilters } from './render/util/pframe_upgraders';
14
+ } from "@milaboratories/pl-model-common";
15
+ import { patchInSetFilters } from "./render/util/pframe_upgraders";
16
16
 
17
17
  export class PFrameImpl implements PFrame {
18
18
  constructor(private readonly handle: PFrameHandle) {}
@@ -48,7 +48,7 @@ export class PFrameImpl implements PFrame {
48
48
 
49
49
  private getPlatforma() {
50
50
  if (platforma === undefined) {
51
- throw new Error('Platforma instance is not available in the current context.');
51
+ throw new Error("Platforma instance is not available in the current context.");
52
52
  }
53
53
  return platforma;
54
54
  }
@@ -1,24 +1,38 @@
1
- import type { PColumn, PColumnSpec, PColumnLazy, PFrameDef } from '@milaboratories/pl-model-common';
2
- import { getNormalizedAxesList, getAxisId, canonicalizeJson, isLinkerColumn, matchAxisId, isLabelColumn } from '@milaboratories/pl-model-common';
3
- import type { AxesVault } from '../components';
4
- import { enrichCompatible, getAvailableWithLinkersAxes } from '../components';
5
- import type { RenderCtxBase, PColumnDataUniversal } from '../render';
6
- import { PColumnCollection } from '../render';
1
+ import type { PColumn, PColumnSpec, PColumnLazy, PFrameDef } from "@milaboratories/pl-model-common";
2
+ import {
3
+ getNormalizedAxesList,
4
+ getAxisId,
5
+ canonicalizeJson,
6
+ isLinkerColumn,
7
+ matchAxisId,
8
+ isLabelColumn,
9
+ } from "@milaboratories/pl-model-common";
10
+ import type { AxesVault } from "../components";
11
+ import { enrichCompatible, getAvailableWithLinkersAxes } from "../components";
12
+ import type { RenderCtxBase, PColumnDataUniversal } from "../render";
13
+ import { PColumnCollection } from "../render";
7
14
 
8
15
  export function getAllRelatedColumns<A, U>(
9
- ctx: RenderCtxBase<A, U>, predicate: (spec: PColumnSpec) => boolean,
16
+ ctx: RenderCtxBase<A, U>,
17
+ predicate: (spec: PColumnSpec) => boolean,
10
18
  ): PFrameDef<PColumn<PColumnDataUniversal> | PColumnLazy<undefined | PColumnDataUniversal>> {
11
19
  // if current block doesn't produce own columns then use all columns from result pool
12
20
  const columns = new PColumnCollection();
13
21
  columns.addColumnProvider(ctx.resultPool);
14
- const allColumns = columns.getColumns(predicate, { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];
22
+ const allColumns =
23
+ columns.getColumns(predicate, {
24
+ dontWaitAllData: true,
25
+ overrideLabelAnnotation: false,
26
+ }) ?? [];
15
27
 
16
- const allAxes: AxesVault = new Map(allColumns
17
- .flatMap((column) => getNormalizedAxesList(column.spec.axesSpec))
18
- .map((axisSpec) => {
19
- const axisId = getAxisId(axisSpec);
20
- return [canonicalizeJson(axisId), axisSpec];
21
- }));
28
+ const allAxes: AxesVault = new Map(
29
+ allColumns
30
+ .flatMap((column) => getNormalizedAxesList(column.spec.axesSpec))
31
+ .map((axisSpec) => {
32
+ const axisId = getAxisId(axisSpec);
33
+ return [canonicalizeJson(axisId), axisSpec];
34
+ }),
35
+ );
22
36
 
23
37
  // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match
24
38
  const extendedColumns = enrichCompatible(allAxes, allColumns);
@@ -26,10 +40,16 @@ export function getAllRelatedColumns<A, U>(
26
40
  return extendedColumns;
27
41
  }
28
42
 
29
- export function getRelatedColumns<A, U>(ctx: RenderCtxBase<A, U>, { columns: rootColumns, predicate }: {
30
- columns: PColumn<PColumnDataUniversal>[];
31
- predicate: (spec: PColumnSpec) => boolean;
32
- }): PFrameDef<PColumn<PColumnDataUniversal> | PColumnLazy<undefined | PColumnDataUniversal>> {
43
+ export function getRelatedColumns<A, U>(
44
+ ctx: RenderCtxBase<A, U>,
45
+ {
46
+ columns: rootColumns,
47
+ predicate,
48
+ }: {
49
+ columns: PColumn<PColumnDataUniversal>[];
50
+ predicate: (spec: PColumnSpec) => boolean;
51
+ },
52
+ ): PFrameDef<PColumn<PColumnDataUniversal> | PColumnLazy<undefined | PColumnDataUniversal>> {
33
53
  // if current block has its own columns then take from result pool only compatible with them
34
54
  const columns = new PColumnCollection();
35
55
  columns.addColumnProvider(ctx.resultPool);
@@ -48,7 +68,10 @@ export function getRelatedColumns<A, U>(ctx: RenderCtxBase<A, U>, { columns: roo
48
68
  }
49
69
 
50
70
  // all linker columns always go to pFrame - even it's impossible to use some of them they all are hidden
51
- const linkerColumns = columns.getColumns((spec) => predicate(spec) && isLinkerColumn(spec), { dontWaitAllData: true }) ?? [];
71
+ const linkerColumns =
72
+ columns.getColumns((spec) => predicate(spec) && isLinkerColumn(spec), {
73
+ dontWaitAllData: true,
74
+ }) ?? [];
52
75
  const availableWithLinkersAxes = getAvailableWithLinkersAxes(linkerColumns, blockAxes);
53
76
 
54
77
  // all possible axes from connected linkers
@@ -59,10 +82,19 @@ export function getRelatedColumns<A, U>(ctx: RenderCtxBase<A, U>, { columns: roo
59
82
 
60
83
  const blockAxesArr = Array.from(blockAxes.values());
61
84
  // all compatible with block columns but without label columns
62
- let compatibleWithoutLabels = (columns.getColumns((spec) => predicate(spec) && spec.axesSpec.some((axisSpec) => {
63
- const axisId = getAxisId(axisSpec);
64
- return blockAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
65
- }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
85
+ let compatibleWithoutLabels = (
86
+ columns.getColumns(
87
+ (spec) =>
88
+ predicate(spec) &&
89
+ spec.axesSpec.some((axisSpec) => {
90
+ const axisId = getAxisId(axisSpec);
91
+ return blockAxesArr.some((selectorAxisSpec) =>
92
+ matchAxisId(getAxisId(selectorAxisSpec), axisId),
93
+ );
94
+ }),
95
+ { dontWaitAllData: true, overrideLabelAnnotation: false },
96
+ ) ?? []
97
+ ).filter((column) => !isLabelColumn(column.spec));
66
98
 
67
99
  // extend axes set for label columns request
68
100
  for (const c of compatibleWithoutLabels) {
@@ -74,16 +106,34 @@ export function getRelatedColumns<A, U>(ctx: RenderCtxBase<A, U>, { columns: roo
74
106
 
75
107
  const allAxesArr = Array.from(allAxes.values());
76
108
  // extend allowed columns - add columns thad doesn't have axes from block, but have all axes in 'allAxes' list (that means all axes from linkers or from 'hanging' of other selected columns)
77
- compatibleWithoutLabels = (columns.getColumns((spec) => predicate(spec) && spec.axesSpec.every((axisSpec) => {
78
- const axisId = getAxisId(axisSpec);
79
- return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
80
- }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
109
+ compatibleWithoutLabels = (
110
+ columns.getColumns(
111
+ (spec) =>
112
+ predicate(spec) &&
113
+ spec.axesSpec.every((axisSpec) => {
114
+ const axisId = getAxisId(axisSpec);
115
+ return allAxesArr.some((selectorAxisSpec) =>
116
+ matchAxisId(getAxisId(selectorAxisSpec), axisId),
117
+ );
118
+ }),
119
+ { dontWaitAllData: true, overrideLabelAnnotation: false },
120
+ ) ?? []
121
+ ).filter((column) => !isLabelColumn(column.spec));
81
122
 
82
123
  // label columns must be compatible with full set of axes - block axes and axes from compatible columns from result pool
83
- const compatibleLabels = (columns.getColumns((spec) => predicate(spec) && spec.axesSpec.some((axisSpec) => {
84
- const axisId = getAxisId(axisSpec);
85
- return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
86
- }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => isLabelColumn(column.spec));
124
+ const compatibleLabels = (
125
+ columns.getColumns(
126
+ (spec) =>
127
+ predicate(spec) &&
128
+ spec.axesSpec.some((axisSpec) => {
129
+ const axisId = getAxisId(axisSpec);
130
+ return allAxesArr.some((selectorAxisSpec) =>
131
+ matchAxisId(getAxisId(selectorAxisSpec), axisId),
132
+ );
133
+ }),
134
+ { dontWaitAllData: true, overrideLabelAnnotation: false },
135
+ ) ?? []
136
+ ).filter((column) => isLabelColumn(column.spec));
87
137
 
88
138
  const compatible = [...compatibleWithoutLabels, ...compatibleLabels];
89
139