@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,4 +1,4 @@
1
- import { flatten, uniq } from 'es-toolkit';
1
+ import { flatten, uniq } from "es-toolkit";
2
2
 
3
3
  import type {
4
4
  AxisSpec,
@@ -16,10 +16,17 @@ import type {
16
16
  PObjectId,
17
17
  PTableRecordSingleValueFilterV2,
18
18
  ValueType,
19
- } from '@milaboratories/pl-model-common';
20
- import { pTableValue, Annotation, canonicalizeAxisId, getAxisId, readAnnotation, PColumnName } from '@milaboratories/pl-model-common';
21
-
22
- export * from './columns';
19
+ } from "@milaboratories/pl-model-common";
20
+ import {
21
+ pTableValue,
22
+ Annotation,
23
+ canonicalizeAxisId,
24
+ getAxisId,
25
+ readAnnotation,
26
+ PColumnName,
27
+ } from "@milaboratories/pl-model-common";
28
+
29
+ export * from "./columns";
23
30
 
24
31
  // Types
25
32
  type PValue = string | number | null;
@@ -62,7 +69,7 @@ type GetColumnsFullParams = {
62
69
  strictlyCompatible: boolean;
63
70
  types?: ValueType[];
64
71
  names?: string[];
65
- annotations?: FindColumnsRequest['columnFilter']['annotationValue'];
72
+ annotations?: FindColumnsRequest["columnFilter"]["annotationValue"];
66
73
  annotationsNotEmpty?: string[];
67
74
  };
68
75
 
@@ -71,10 +78,14 @@ const UNIQUE_VALUES_LIMIT = 1000000;
71
78
 
72
79
  // Helper functions
73
80
  const sortValuesPredicate = (a: { label: string }, b: { label: string }) =>
74
- a.label.localeCompare(b.label, 'en', { numeric: true });
75
-
76
- function convertColumnData(type: ValueType, response: PTableVector, absentValue: number | null = null): PValue[] {
77
- if (type === 'String') {
81
+ a.label.localeCompare(b.label, "en", { numeric: true });
82
+
83
+ function convertColumnData(
84
+ type: ValueType,
85
+ response: PTableVector,
86
+ absentValue: number | null = null,
87
+ ): PValue[] {
88
+ if (type === "String") {
78
89
  return response.data as PValue[];
79
90
  }
80
91
  const res: PValue[] = new Array(response.data.length);
@@ -89,13 +100,13 @@ function createSearchFilter(
89
100
  substring: string,
90
101
  ): PTableRecordSingleValueFilterV2 {
91
102
  return {
92
- type: 'bySingleColumnV2',
103
+ type: "bySingleColumnV2",
93
104
  column: {
94
- type: 'column',
105
+ type: "column",
95
106
  id: columnId,
96
107
  },
97
108
  predicate: {
98
- operator: 'StringIContains',
109
+ operator: "StringIContains",
99
110
  substring,
100
111
  },
101
112
  };
@@ -106,16 +117,16 @@ function createAxisSearchFilter(
106
117
  substring: string,
107
118
  ): PTableRecordSingleValueFilterV2 {
108
119
  return {
109
- type: 'bySingleColumnV2',
120
+ type: "bySingleColumnV2",
110
121
  column: {
111
- type: 'axis',
122
+ type: "axis",
112
123
  id: {
113
124
  type: axisSpec.type,
114
125
  name: axisSpec.name,
115
126
  },
116
127
  },
117
128
  predicate: {
118
- operator: 'StringIContains',
129
+ operator: "StringIContains",
119
130
  substring,
120
131
  },
121
132
  };
@@ -126,22 +137,25 @@ function mapValuesToSuggestions(values: string[]): { value: string; label: strin
126
137
  }
127
138
 
128
139
  function getPFrameDriver() {
129
- if (typeof platforma === 'undefined') {
130
- throw new Error('Platforma instance is not available');
140
+ if (typeof platforma === "undefined") {
141
+ throw new Error("Platforma instance is not available");
131
142
  }
132
- if (typeof platforma.pFrameDriver === 'undefined') {
133
- throw new Error('PFrame driver is not available in the current Platforma instance');
143
+ if (typeof platforma.pFrameDriver === "undefined") {
144
+ throw new Error("PFrame driver is not available in the current Platforma instance");
134
145
  }
135
146
  return platforma.pFrameDriver;
136
147
  }
137
148
 
138
149
  // Core functions
139
- export async function getColumnSpecById(handle: PFrameHandle, id: PObjectId): Promise<PColumnSpec | null> {
150
+ export async function getColumnSpecById(
151
+ handle: PFrameHandle,
152
+ id: PObjectId,
153
+ ): Promise<PColumnSpec | null> {
140
154
  try {
141
155
  const response = await getPFrameDriver().getColumnSpec(handle, id);
142
156
  return response ?? null;
143
157
  } catch (err) {
144
- console.error('PFrame: get single column error', err);
158
+ console.error("PFrame: get single column error", err);
145
159
  return null;
146
160
  }
147
161
  }
@@ -154,15 +168,15 @@ export async function getSingleColumnData(
154
168
  try {
155
169
  const response: FullPTableColumnData[] = await getPFrameDriver().calculateTableData(handle, {
156
170
  src: {
157
- type: 'column',
171
+ type: "column",
158
172
  column: id,
159
173
  },
160
174
  filters,
161
175
  sorting: [],
162
176
  } as CalculateTableDataRequest<PObjectId>);
163
177
 
164
- const axes = response.filter((item) => item.spec.type === 'axis');
165
- const columns = response.filter((item) => item.spec.type === 'column');
178
+ const axes = response.filter((item) => item.spec.type === "axis");
179
+ const columns = response.filter((item) => item.spec.type === "column");
166
180
 
167
181
  return {
168
182
  axesData: axes.reduce((res: Record<string, PValue[]>, item) => {
@@ -173,7 +187,7 @@ export async function getSingleColumnData(
173
187
  data: columns.length ? convertColumnData(columns[0].data.type, columns[0].data) : [],
174
188
  };
175
189
  } catch (err) {
176
- console.error('PFrame: calculateTableData error');
190
+ console.error("PFrame: calculateTableData error");
177
191
  throw err;
178
192
  }
179
193
  }
@@ -200,7 +214,7 @@ export async function getColumnUniqueValues(
200
214
  overflow: response.overflow,
201
215
  };
202
216
  } catch (err) {
203
- console.error('PFrame: getUniqueValues for column error');
217
+ console.error("PFrame: getUniqueValues for column error");
204
218
  throw err;
205
219
  }
206
220
  }
@@ -214,14 +228,14 @@ export async function getAxisUniqueValues(
214
228
 
215
229
  const parentsSpecs = (await Promise.all(parentColumnIds.map((p) => getColumnSpecById(handle, p))))
216
230
  .flatMap((spec, i): [PObjectId, PColumnSpec][] =>
217
- spec != null && spec.kind === 'PColumn' ? [[parentColumnIds[i], spec]] : [],
231
+ spec != null && spec.kind === "PColumn" ? [[parentColumnIds[i], spec]] : [],
218
232
  )
219
233
  .filter(([_, spec]) =>
220
234
  spec.axesSpec.some((axisSpec) => canonicalizeAxisId(getAxisId(axisSpec)) === strAxisId),
221
235
  );
222
236
 
223
237
  if (parentsSpecs.length === 0) {
224
- console.warn('Axis unique values requested without parent columns');
238
+ console.warn("Axis unique values requested without parent columns");
225
239
  return { values: [], overflow: false };
226
240
  }
227
241
 
@@ -240,14 +254,12 @@ export async function getAxisUniqueValues(
240
254
  const overflow = responses.some((r) => r.overflow);
241
255
  return {
242
256
  values: uniq(
243
- flatten(responses.map((r) =>
244
- Array.from(r.values.data as ArrayLike<unknown>).map(String),
245
- )),
257
+ flatten(responses.map((r) => Array.from(r.values.data as ArrayLike<unknown>).map(String))),
246
258
  ),
247
259
  overflow,
248
260
  };
249
261
  } catch (err) {
250
- console.error('PFrame: getUniqueValues for axis error', err);
262
+ console.error("PFrame: getUniqueValues for axis error", err);
251
263
  return { values: [], overflow: false };
252
264
  }
253
265
  }
@@ -259,7 +271,7 @@ export async function getRequestColumnsFromSelectedSources(
259
271
  const result: AxisId[] = [];
260
272
  for (const item of sources) {
261
273
  const spec = await getColumnSpecById(handle, item);
262
- if (spec?.kind === 'PColumn') {
274
+ if (spec?.kind === "PColumn") {
263
275
  result.push(...spec.axesSpec.map((spec) => getAxisId(spec)));
264
276
  }
265
277
  }
@@ -270,7 +282,8 @@ export async function getColumnsFull(
270
282
  handle: PFrameHandle,
271
283
  params: GetColumnsFullParams,
272
284
  ): Promise<PColumnIdAndSpec[]> {
273
- const { selectedSources, strictlyCompatible, types, names, annotations, annotationsNotEmpty } = params;
285
+ const { selectedSources, strictlyCompatible, types, names, annotations, annotationsNotEmpty } =
286
+ params;
274
287
 
275
288
  try {
276
289
  const request: FindColumnsRequest = {
@@ -278,10 +291,13 @@ export async function getColumnsFull(
278
291
  type: types,
279
292
  name: names,
280
293
  annotationValue: annotations,
281
- annotationPattern: annotationsNotEmpty?.reduce((res, v) => {
282
- res[v] = '.+';
283
- return res;
284
- }, {} as Record<string, string>),
294
+ annotationPattern: annotationsNotEmpty?.reduce(
295
+ (res, v) => {
296
+ res[v] = ".+";
297
+ return res;
298
+ },
299
+ {} as Record<string, string>,
300
+ ),
285
301
  },
286
302
  compatibleWith: await getRequestColumnsFromSelectedSources(handle, selectedSources),
287
303
  strictlyCompatible,
@@ -290,7 +306,7 @@ export async function getColumnsFull(
290
306
  const response: FindColumnsResponse = await getPFrameDriver().findColumns(handle, request);
291
307
  return response.hits;
292
308
  } catch (err) {
293
- console.error('PFrame: findColumns error');
309
+ console.error("PFrame: findColumns error");
294
310
  throw err;
295
311
  }
296
312
  }
@@ -319,7 +335,9 @@ function getDiscreteValuesFromAnnotation(columnSpec: PColumnSpec): undefined | S
319
335
  }
320
336
 
321
337
  try {
322
- const discreteValues: string[] = (JSON.parse(discreteValuesStr) as (string | number)[]).map((v) => String(v));
338
+ const discreteValues: string[] = (JSON.parse(discreteValuesStr) as (string | number)[]).map(
339
+ (v) => String(v),
340
+ );
323
341
  const values = discreteValues.map((v) => ({ value: v, label: v })).sort(sortValuesPredicate);
324
342
  return { values, overflow: false };
325
343
  } catch {
@@ -352,7 +370,11 @@ async function getAxisValuesWithLabels(
352
370
  filters = [createAxisSearchFilter(axisSpec, searchQueryValue)];
353
371
  }
354
372
 
355
- const { data: dataValues, axesData } = await getSingleColumnData(handle, labelsColumnId, filters);
373
+ const { data: dataValues, axesData } = await getSingleColumnData(
374
+ handle,
375
+ labelsColumnId,
376
+ filters,
377
+ );
356
378
  const axisKeys = axesData[strAxisId];
357
379
  const values: { value: string; label: string }[] = [];
358
380
 
@@ -408,7 +430,7 @@ export async function getUniqueSourceValuesWithLabels(
408
430
  const { columnId, axisIdx, limit, searchQuery, searchQueryValue } = params;
409
431
 
410
432
  const selectedSourceSpec = await getColumnSpecById(handle, columnId);
411
- if (selectedSourceSpec == null || selectedSourceSpec.kind !== 'PColumn') {
433
+ if (selectedSourceSpec == null || selectedSourceSpec.kind !== "PColumn") {
412
434
  return { values: [], overflow: false };
413
435
  }
414
436
 
package/src/platforma.ts CHANGED
@@ -1,18 +1,26 @@
1
- import type { BlockApiV1 } from './block_api_v1';
2
- import type { BlockApiV2 } from './block_api_v2';
3
- import type { BlockApiV3 } from './block_api_v3';
4
- import type { BlockOutputsBase, BlockStateV3, DriverKit, OutputWithStatus } from '@milaboratories/pl-model-common';
5
- import type { SdkInfo } from './sdk_info';
6
- import type { BlockStatePatch } from './block_state_patch';
1
+ import type { BlockApiV1 } from "./block_api_v1";
2
+ import type { BlockApiV2 } from "./block_api_v2";
3
+ import type { BlockApiV3 } from "./block_api_v3";
4
+ import type {
5
+ BlockOutputsBase,
6
+ BlockStateV3,
7
+ DriverKit,
8
+ OutputWithStatus,
9
+ } from "@milaboratories/pl-model-common";
10
+ import type { SdkInfo } from "./sdk_info";
11
+ import type { BlockStatePatch } from "./block_state_patch";
7
12
 
8
13
  /** Defines all methods to interact with the platform environment from within a block UI. @deprecated */
9
14
  export interface PlatformaV1<
10
15
  Args = unknown,
11
- Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,
16
+ Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
17
+ string,
18
+ OutputWithStatus<unknown>
19
+ >,
12
20
  UiState = unknown,
13
21
  Href extends `/${string}` = `/${string}`,
14
- > extends BlockApiV1<Args, Outputs, UiState, Href>,
15
- DriverKit {
22
+ >
23
+ extends BlockApiV1<Args, Outputs, UiState, Href>, DriverKit {
16
24
  /** Information about SDK version current platforma environment was compiled with. */
17
25
  readonly sdkInfo: SdkInfo;
18
26
  readonly apiVersion?: 1;
@@ -21,11 +29,14 @@ export interface PlatformaV1<
21
29
  /** V2 version based on effective json patches pulling API */
22
30
  export interface PlatformaV2<
23
31
  Args = unknown,
24
- Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,
32
+ Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
33
+ string,
34
+ OutputWithStatus<unknown>
35
+ >,
25
36
  UiState = unknown,
26
37
  Href extends `/${string}` = `/${string}`,
27
- > extends BlockApiV2<Args, Outputs, UiState, Href>,
28
- DriverKit {
38
+ >
39
+ extends BlockApiV2<Args, Outputs, UiState, Href>, DriverKit {
29
40
  /** Information about SDK version current platforma environment was compiled with. */
30
41
  readonly sdkInfo: SdkInfo;
31
42
  readonly apiVersion: 2;
@@ -33,11 +44,14 @@ export interface PlatformaV2<
33
44
 
34
45
  export interface PlatformaV3<
35
46
  Args = unknown,
36
- Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,
47
+ Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
48
+ string,
49
+ OutputWithStatus<unknown>
50
+ >,
37
51
  Data = unknown,
38
52
  Href extends `/${string}` = `/${string}`,
39
- > extends BlockApiV3<Args, Outputs, Data, Href>,
40
- DriverKit {
53
+ >
54
+ extends BlockApiV3<Args, Outputs, Data, Href>, DriverKit {
41
55
  /** Information about SDK version current platforma environment was compiled with. */
42
56
  readonly sdkInfo: SdkInfo;
43
57
  readonly apiVersion: 3;
@@ -45,22 +59,31 @@ export interface PlatformaV3<
45
59
 
46
60
  export type Platforma<
47
61
  Args = unknown,
48
- Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,
62
+ Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
63
+ string,
64
+ OutputWithStatus<unknown>
65
+ >,
49
66
  UiState = unknown,
50
67
  Href extends `/${string}` = `/${string}`,
51
- > = PlatformaV1<Args, Outputs, UiState, Href> | PlatformaV2<Args, Outputs, UiState, Href> | PlatformaV3<Args, Outputs, UiState, Href>;
68
+ > =
69
+ | PlatformaV1<Args, Outputs, UiState, Href>
70
+ | PlatformaV2<Args, Outputs, UiState, Href>
71
+ | PlatformaV3<Args, Outputs, UiState, Href>;
52
72
 
53
73
  export type PlatformaExtended<Pl extends Platforma = Platforma> = Pl & {
54
74
  blockModelInfo: BlockModelInfo;
55
75
  };
56
76
 
57
77
  export type BlockModelInfo = {
58
- outputs: Record<string, {
59
- withStatus: boolean;
60
- }>;
78
+ outputs: Record<
79
+ string,
80
+ {
81
+ withStatus: boolean;
82
+ }
83
+ >;
61
84
  };
62
85
 
63
- export type PlatformaApiVersion = Platforma['apiVersion'];
86
+ export type PlatformaApiVersion = Platforma["apiVersion"];
64
87
 
65
88
  export type InferArgsType<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
66
89
 
@@ -1,8 +1,8 @@
1
- import type { OutputWithStatus } from '@milaboratories/pl-model-common';
2
- import {} from './global';
3
- import { getPlatformaInstance } from './internal';
4
- import type { Platforma, PlatformaApiVersion } from './platforma';
5
- import { PlatformaSDKVersion } from './version';
1
+ import type { OutputWithStatus } from "@milaboratories/pl-model-common";
2
+ import {} from "./global";
3
+ import { getPlatformaInstance } from "./internal";
4
+ import type { Platforma, PlatformaApiVersion } from "./platforma";
5
+ import { PlatformaSDKVersion } from "./version";
6
6
 
7
7
  export function getPlatformaApiVersion(): PlatformaApiVersion {
8
8
  return platformaApiVersion ?? 1; // undefined means 1 for backward compatibility
@@ -10,11 +10,17 @@ export function getPlatformaApiVersion(): PlatformaApiVersion {
10
10
 
11
11
  export function getRawPlatformaInstance<
12
12
  Args = unknown,
13
- Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,
13
+ Outputs extends Record<string, OutputWithStatus<unknown>> = Record<
14
+ string,
15
+ OutputWithStatus<unknown>
16
+ >,
14
17
  UiState = unknown,
15
18
  Href extends `/${string}` = `/${string}`,
16
19
  >(): Platforma<Args, Outputs, UiState, Href> {
17
- return getPlatformaInstance<Args, Outputs, UiState, Href>({ sdkVersion: PlatformaSDKVersion, apiVersion: platformaApiVersion });
20
+ return getPlatformaInstance<Args, Outputs, UiState, Href>({
21
+ sdkVersion: PlatformaSDKVersion,
22
+ apiVersion: platformaApiVersion,
23
+ });
18
24
  }
19
25
 
20
26
  /** Returns a global platforma instance or a provided fallback if it's not available. */
package/src/ref_util.ts CHANGED
@@ -1,17 +1,17 @@
1
- import type { TypedConfig } from './config';
2
- import { getJsonField, makeObject } from './config';
1
+ import type { TypedConfig } from "./config";
2
+ import { getJsonField, makeObject } from "./config";
3
3
 
4
4
  export function fromPlRef<Source extends TypedConfig>(source: Source) {
5
5
  return makeObject({
6
6
  __isRef: true,
7
- blockId: getJsonField(source, 'blockId'),
8
- name: getJsonField(source, 'name'),
7
+ blockId: getJsonField(source, "blockId"),
8
+ name: getJsonField(source, "name"),
9
9
  });
10
10
  }
11
11
 
12
12
  export function fromPlOption<Source extends TypedConfig>(source: Source) {
13
13
  return makeObject({
14
- ref: fromPlRef(getJsonField(source, 'ref')),
15
- label: getJsonField(source, 'label'),
14
+ ref: fromPlRef(getJsonField(source, "ref")),
15
+ label: getJsonField(source, "label"),
16
16
  });
17
17
  }
@@ -9,15 +9,12 @@ import type {
9
9
  ArchiveFormat,
10
10
  ProgressLogWithInfo,
11
11
  RangeBytes,
12
- } from '@milaboratories/pl-model-common';
13
- import {
14
- isPColumn,
15
- mapPObjectData,
16
- } from '@milaboratories/pl-model-common';
17
- import { getCfgRenderCtx } from '../internal';
18
- import { FutureRef } from './future';
19
- import type { AccessorHandle } from './internal';
20
- import type { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';
12
+ } from "@milaboratories/pl-model-common";
13
+ import { isPColumn, mapPObjectData } from "@milaboratories/pl-model-common";
14
+ import { getCfgRenderCtx } from "../internal";
15
+ import { FutureRef } from "./future";
16
+ import type { AccessorHandle } from "./internal";
17
+ import type { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from "./traversal_ops";
21
18
 
22
19
  export function ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {
23
20
  return value === undefined ? undefined : cb(value);
@@ -28,7 +25,7 @@ type FieldMapOps = {
28
25
  * Type of fields to iterate over.
29
26
  * (default 'Input')
30
27
  * */
31
- readonly fieldType?: 'Input' | 'Output' | 'Dynamic';
28
+ readonly fieldType?: "Input" | "Output" | "Dynamic";
32
29
  /**
33
30
  * If not locked, `undefined` value will be returned. Do nothing if mapping `Dynamic` fields.
34
31
  * (default true)
@@ -51,7 +48,7 @@ export class TreeNodeAccessor {
51
48
  /** Shortcut for {@link resolveInput} */
52
49
  public resolve(
53
50
  ...steps: [
54
- Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {
51
+ Omit<FieldTraversalStep, "errorIfFieldNotSet"> & {
55
52
  errorIfFieldNotAssigned: true;
56
53
  },
57
54
  ]
@@ -62,8 +59,8 @@ export class TreeNodeAccessor {
62
59
  const transformedSteps = steps.map(
63
60
  (s) =>
64
61
  ({
65
- assertFieldType: 'Input',
66
- ...(typeof s === 'string' ? { field: s } : s),
62
+ assertFieldType: "Input",
63
+ ...(typeof s === "string" ? { field: s } : s),
67
64
  }) satisfies FieldTraversalStep,
68
65
  );
69
66
  return this.resolveWithCommon({}, ...transformedSteps);
@@ -72,7 +69,7 @@ export class TreeNodeAccessor {
72
69
  /** If field type assertion is not specified for the step, default is Output. */
73
70
  public resolveOutput(
74
71
  ...steps: [
75
- Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {
72
+ Omit<FieldTraversalStep, "errorIfFieldNotSet"> & {
76
73
  errorIfFieldNotAssigned: true;
77
74
  },
78
75
  ]
@@ -83,8 +80,8 @@ export class TreeNodeAccessor {
83
80
  const transformedSteps = steps.map(
84
81
  (s) =>
85
82
  ({
86
- assertFieldType: 'Output',
87
- ...(typeof s === 'string' ? { field: s } : s),
83
+ assertFieldType: "Output",
84
+ ...(typeof s === "string" ? { field: s } : s),
88
85
  }) satisfies FieldTraversalStep,
89
86
  );
90
87
  return this.resolveWithCommon({}, ...transformedSteps);
@@ -93,7 +90,7 @@ export class TreeNodeAccessor {
93
90
  /** If field type assertion is not specified for the step, default is Input. */
94
91
  public resolveInput(
95
92
  ...steps: [
96
- Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {
93
+ Omit<FieldTraversalStep, "errorIfFieldNotSet"> & {
97
94
  errorIfFieldNotAssigned: true;
98
95
  },
99
96
  ]
@@ -104,8 +101,8 @@ export class TreeNodeAccessor {
104
101
  const transformedSteps = steps.map(
105
102
  (s) =>
106
103
  ({
107
- assertFieldType: 'Input',
108
- ...(typeof s === 'string' ? { field: s } : s),
104
+ assertFieldType: "Input",
105
+ ...(typeof s === "string" ? { field: s } : s),
109
106
  }) satisfies FieldTraversalStep,
110
107
  );
111
108
  return this.resolveWithCommon({}, ...transformedSteps);
@@ -113,7 +110,7 @@ export class TreeNodeAccessor {
113
110
 
114
111
  public resolveAny(
115
112
  ...steps: [
116
- Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {
113
+ Omit<FieldTraversalStep, "errorIfFieldNotSet"> & {
117
114
  errorIfFieldNotAssigned: true;
118
115
  },
119
116
  ]
@@ -129,7 +126,7 @@ export class TreeNodeAccessor {
129
126
  ): TreeNodeAccessor | undefined {
130
127
  const resolvePath = [
131
128
  ...this.resolvePath,
132
- ...steps.map((step) => typeof step === 'string' ? step : step.field),
129
+ ...steps.map((step) => (typeof step === "string" ? step : step.field)),
133
130
  ];
134
131
  return ifDef(
135
132
  getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps),
@@ -158,7 +155,7 @@ export class TreeNodeAccessor {
158
155
  }
159
156
 
160
157
  public getError(): TreeNodeAccessor | undefined {
161
- const resolvePath = [...this.resolvePath, 'error'];
158
+ const resolvePath = [...this.resolvePath, "error"];
162
159
  return ifDef(
163
160
  getCfgRenderCtx().getError(this.handle),
164
161
  (accsessor) => new TreeNodeAccessor(accsessor, resolvePath),
@@ -187,7 +184,7 @@ export class TreeNodeAccessor {
187
184
 
188
185
  public getKeyValueAsJson<T>(key: string): T {
189
186
  const content = this.getKeyValueAsString(key);
190
- if (content == undefined) throw new Error('Resource has no content.');
187
+ if (content == undefined) throw new Error("Resource has no content.");
191
188
  return JSON.parse(content);
192
189
  }
193
190
 
@@ -201,7 +198,7 @@ export class TreeNodeAccessor {
201
198
 
202
199
  public getDataAsJson<T>(): T {
203
200
  const content = this.getDataAsString();
204
- if (content == undefined) throw new Error('Resource has no content.');
201
+ if (content == undefined) throw new Error("Resource has no content.");
205
202
  return JSON.parse(content);
206
203
  }
207
204
 
@@ -210,7 +207,7 @@ export class TreeNodeAccessor {
210
207
  */
211
208
  public getPColumns(
212
209
  errorOnUnknownField: boolean = false,
213
- prefix: string = '',
210
+ prefix: string = "",
214
211
  ): PColumn<TreeNodeAccessor>[] | undefined {
215
212
  const result = this.parsePObjectCollection(errorOnUnknownField, prefix);
216
213
  if (result === undefined) return undefined;
@@ -228,7 +225,7 @@ export class TreeNodeAccessor {
228
225
  */
229
226
  public parsePObjectCollection(
230
227
  errorOnUnknownField: boolean = false,
231
- prefix: string = '',
228
+ prefix: string = "",
232
229
  ): Record<string, PObject<TreeNodeAccessor>> | undefined {
233
230
  const pObjects = getCfgRenderCtx().parsePObjectCollection(
234
231
  this.handle,
@@ -320,7 +317,9 @@ export class TreeNodeAccessor {
320
317
  return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));
321
318
  }
322
319
 
323
- public getProgressLogWithInfo(patternToSearch: string): FutureRef<ProgressLogWithInfo | undefined> {
320
+ public getProgressLogWithInfo(
321
+ patternToSearch: string,
322
+ ): FutureRef<ProgressLogWithInfo | undefined> {
324
323
  return new FutureRef(getCfgRenderCtx().getProgressLogWithInfo(this.handle, patternToSearch));
325
324
  }
326
325
 
@@ -328,20 +327,20 @@ export class TreeNodeAccessor {
328
327
  return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));
329
328
  }
330
329
 
331
- public allFieldsResolved(fieldType: 'Input' | 'Output' = 'Input'): boolean {
330
+ public allFieldsResolved(fieldType: "Input" | "Output" = "Input"): boolean {
332
331
  switch (fieldType) {
333
- case 'Input':
332
+ case "Input":
334
333
  return (
335
- this.getInputsLocked()
336
- && this.listInputFields().every(
337
- (field) => this.resolve({ field, assertFieldType: 'Input' }) !== undefined,
334
+ this.getInputsLocked() &&
335
+ this.listInputFields().every(
336
+ (field) => this.resolve({ field, assertFieldType: "Input" }) !== undefined,
338
337
  )
339
338
  );
340
- case 'Output':
339
+ case "Output":
341
340
  return (
342
- this.getOutputsLocked()
343
- && this.listOutputFields().every(
344
- (field) => this.resolve({ field, assertFieldType: 'Output' }) !== undefined,
341
+ this.getOutputsLocked() &&
342
+ this.listOutputFields().every(
343
+ (field) => this.resolve({ field, assertFieldType: "Output" }) !== undefined,
345
344
  )
346
345
  );
347
346
  }
@@ -349,31 +348,31 @@ export class TreeNodeAccessor {
349
348
 
350
349
  public mapFields<T>(
351
350
  _mapping: (name: string, value: TreeNodeAccessor) => T,
352
- _ops: FieldMapOps & { skipUnresolved: true }
351
+ _ops: FieldMapOps & { skipUnresolved: true },
353
352
  ): T[] | undefined;
354
353
  public mapFields<T>(
355
354
  _mapping: (name: string, value: TreeNodeAccessor | undefined) => T,
356
- _ops?: FieldMapOps
355
+ _ops?: FieldMapOps,
357
356
  ): T[] | undefined;
358
357
  public mapFields<T>(
359
358
  _mapping: (name: string, value: TreeNodeAccessor) => T,
360
359
  _ops?: FieldMapOps,
361
360
  ): T[] | undefined {
362
361
  const { fieldType, requireLocked, skipUnresolved } = {
363
- fieldType: 'Input' as const,
362
+ fieldType: "Input" as const,
364
363
  requireLocked: true,
365
364
  skipUnresolved: false,
366
365
  ..._ops,
367
366
  };
368
367
  const mapping = _mapping as (name: string, value: TreeNodeAccessor | undefined) => T;
369
368
  if (requireLocked) {
370
- if (fieldType === 'Input' && !this.getInputsLocked()) return undefined;
371
- if (fieldType === 'Output' && !this.getOutputsLocked()) return undefined;
369
+ if (fieldType === "Input" && !this.getInputsLocked()) return undefined;
370
+ if (fieldType === "Output" && !this.getOutputsLocked()) return undefined;
372
371
  }
373
- const fieldList
374
- = fieldType === 'Input'
372
+ const fieldList =
373
+ fieldType === "Input"
375
374
  ? this.listInputFields()
376
- : fieldType === 'Output'
375
+ : fieldType === "Output"
377
376
  ? this.listOutputFields()
378
377
  : this.listDynamicFields();
379
378
  let fieldEntries = fieldList.map(