@finos/legend-cube-builder 0.0.5 → 0.0.6

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 (245) hide show
  1. package/docs/adding-an-operation.md +4 -2
  2. package/docs/demo/README.md +1 -1
  3. package/docs/hosting.md +40 -9
  4. package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -1
  5. package/lib/__lib__/LegendCubeHelpText.js +3 -1
  6. package/lib/__lib__/LegendCubeHelpText.js.map +1 -1
  7. package/lib/__lib__/LegendCubeLabels.d.ts +34 -5
  8. package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -1
  9. package/lib/__lib__/LegendCubeLabels.js +45 -8
  10. package/lib/__lib__/LegendCubeLabels.js.map +1 -1
  11. package/lib/__lib__/LegendCubeNavigation.d.ts +23 -0
  12. package/lib/__lib__/LegendCubeNavigation.d.ts.map +1 -0
  13. package/lib/__lib__/LegendCubeNavigation.js +33 -0
  14. package/lib/__lib__/LegendCubeNavigation.js.map +1 -0
  15. package/lib/__lib__/LegendCubeTesting.d.ts +3 -1
  16. package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -1
  17. package/lib/__lib__/LegendCubeTesting.js +2 -0
  18. package/lib/__lib__/LegendCubeTesting.js.map +1 -1
  19. package/lib/__lib__/LegendCubeTour.d.ts +62 -0
  20. package/lib/__lib__/LegendCubeTour.d.ts.map +1 -0
  21. package/lib/__lib__/LegendCubeTour.js +149 -0
  22. package/lib/__lib__/LegendCubeTour.js.map +1 -0
  23. package/lib/__test-utils__/CubeExampleTestUtils.d.ts +34 -0
  24. package/lib/__test-utils__/CubeExampleTestUtils.d.ts.map +1 -0
  25. package/lib/__test-utils__/CubeExampleTestUtils.js +72 -0
  26. package/lib/__test-utils__/CubeExampleTestUtils.js.map +1 -0
  27. package/lib/__test-utils__/CubeVariantTestUtils.d.ts +16 -0
  28. package/lib/__test-utils__/CubeVariantTestUtils.d.ts.map +1 -0
  29. package/lib/__test-utils__/CubeVariantTestUtils.js +66 -0
  30. package/lib/__test-utils__/CubeVariantTestUtils.js.map +1 -0
  31. package/lib/components/CubeAddItems.d.ts.map +1 -1
  32. package/lib/components/CubeAddItems.js +2 -1
  33. package/lib/components/CubeAddItems.js.map +1 -1
  34. package/lib/components/CubeEditor.d.ts.map +1 -1
  35. package/lib/components/CubeEditor.js +11 -5
  36. package/lib/components/CubeEditor.js.map +1 -1
  37. package/lib/components/CubeFileMenu.d.ts.map +1 -1
  38. package/lib/components/CubeFileMenu.js +2 -1
  39. package/lib/components/CubeFileMenu.js.map +1 -1
  40. package/lib/components/CubeNodeIcon.d.ts.map +1 -1
  41. package/lib/components/CubeNodeIcon.js +2 -1
  42. package/lib/components/CubeNodeIcon.js.map +1 -1
  43. package/lib/components/canvas/CubeCanvas.d.ts.map +1 -1
  44. package/lib/components/canvas/CubeCanvas.js +3 -2
  45. package/lib/components/canvas/CubeCanvas.js.map +1 -1
  46. package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -1
  47. package/lib/components/canvas/CubeCanvasNode.js +4 -1
  48. package/lib/components/canvas/CubeCanvasNode.js.map +1 -1
  49. package/lib/components/dev-settings/CubeDevSettings.d.ts +2 -2
  50. package/lib/components/dev-settings/CubeDevSettings.d.ts.map +1 -1
  51. package/lib/components/dev-settings/CubeDevSettings.js +12 -8
  52. package/lib/components/dev-settings/CubeDevSettings.js.map +1 -1
  53. package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -1
  54. package/lib/components/editors/CubeColumnPicker.js +3 -1
  55. package/lib/components/editors/CubeColumnPicker.js.map +1 -1
  56. package/lib/components/editors/CubeExplodeEditor.d.ts +26 -0
  57. package/lib/components/editors/CubeExplodeEditor.d.ts.map +1 -0
  58. package/lib/components/editors/CubeExplodeEditor.js +61 -0
  59. package/lib/components/editors/CubeExplodeEditor.js.map +1 -0
  60. package/lib/components/editors/CubeExpressionFilterEditor.d.ts.map +1 -1
  61. package/lib/components/editors/CubeExpressionFilterEditor.js +8 -5
  62. package/lib/components/editors/CubeExpressionFilterEditor.js.map +1 -1
  63. package/lib/components/editors/CubeExtendEditor.d.ts +0 -2
  64. package/lib/components/editors/CubeExtendEditor.d.ts.map +1 -1
  65. package/lib/components/editors/CubeExtendEditor.js +12 -11
  66. package/lib/components/editors/CubeExtendEditor.js.map +1 -1
  67. package/lib/components/editors/CubeJsonFieldsTree.d.ts +46 -0
  68. package/lib/components/editors/CubeJsonFieldsTree.d.ts.map +1 -0
  69. package/lib/components/editors/CubeJsonFieldsTree.js +93 -0
  70. package/lib/components/editors/CubeJsonFieldsTree.js.map +1 -0
  71. package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -1
  72. package/lib/components/editors/CubeNodeEditorRegistry.js +3 -1
  73. package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -1
  74. package/lib/components/grid/CubeGridRegion.d.ts.map +1 -1
  75. package/lib/components/grid/CubeGridRegion.js +5 -4
  76. package/lib/components/grid/CubeGridRegion.js.map +1 -1
  77. package/lib/components/grid/CubeGridValues.d.ts +5 -3
  78. package/lib/components/grid/CubeGridValues.d.ts.map +1 -1
  79. package/lib/components/grid/CubeGridValues.js +8 -3
  80. package/lib/components/grid/CubeGridValues.js.map +1 -1
  81. package/lib/components/grid/CubeJsonExplorerDialog.d.ts +27 -0
  82. package/lib/components/grid/CubeJsonExplorerDialog.d.ts.map +1 -0
  83. package/lib/components/grid/CubeJsonExplorerDialog.js +102 -0
  84. package/lib/components/grid/CubeJsonExplorerDialog.js.map +1 -0
  85. package/lib/components/grid/CubeJsonViewerDialog.d.ts +27 -0
  86. package/lib/components/grid/CubeJsonViewerDialog.d.ts.map +1 -0
  87. package/lib/components/grid/CubeJsonViewerDialog.js +68 -0
  88. package/lib/components/grid/CubeJsonViewerDialog.js.map +1 -0
  89. package/lib/components/grid/CubeResultGrid.d.ts +15 -3
  90. package/lib/components/grid/CubeResultGrid.d.ts.map +1 -1
  91. package/lib/components/grid/CubeResultGrid.js +95 -3
  92. package/lib/components/grid/CubeResultGrid.js.map +1 -1
  93. package/lib/components/grid/CubeServerSideGrid.d.ts.map +1 -1
  94. package/lib/components/grid/CubeServerSideGrid.js +4 -2
  95. package/lib/components/grid/CubeServerSideGrid.js.map +1 -1
  96. package/lib/components/palette/CubePalette.d.ts.map +1 -1
  97. package/lib/components/palette/CubePalette.js +4 -1
  98. package/lib/components/palette/CubePalette.js.map +1 -1
  99. package/lib/components/source-picker/CubeIngestTab.d.ts +2 -2
  100. package/lib/components/source-picker/CubeIngestTab.d.ts.map +1 -1
  101. package/lib/components/source-picker/CubeIngestTab.js +19 -13
  102. package/lib/components/source-picker/CubeIngestTab.js.map +1 -1
  103. package/lib/components/tour/CubeTour.d.ts +36 -0
  104. package/lib/components/tour/CubeTour.d.ts.map +1 -0
  105. package/lib/components/tour/CubeTour.js +183 -0
  106. package/lib/components/tour/CubeTour.js.map +1 -0
  107. package/lib/index.css +1 -1
  108. package/lib/index.d.ts +1 -0
  109. package/lib/index.d.ts.map +1 -1
  110. package/lib/index.js +1 -0
  111. package/lib/index.js.map +1 -1
  112. package/lib/stores/CubeEditorState.d.ts +17 -1
  113. package/lib/stores/CubeEditorState.d.ts.map +1 -1
  114. package/lib/stores/CubeEditorState.js +35 -5
  115. package/lib/stores/CubeEditorState.js.map +1 -1
  116. package/lib/stores/CubeExamples.d.ts.map +1 -1
  117. package/lib/stores/CubeExamples.js +101 -4
  118. package/lib/stores/CubeExamples.js.map +1 -1
  119. package/lib/stores/CubeExamplesState.d.ts.map +1 -1
  120. package/lib/stores/CubeExamplesState.js +4 -1
  121. package/lib/stores/CubeExamplesState.js.map +1 -1
  122. package/lib/stores/CubeGridQuickActions.d.ts +7 -0
  123. package/lib/stores/CubeGridQuickActions.d.ts.map +1 -1
  124. package/lib/stores/CubeGridQuickActions.js +20 -11
  125. package/lib/stores/CubeGridQuickActions.js.map +1 -1
  126. package/lib/stores/CubePureText.d.ts +20 -0
  127. package/lib/stores/CubePureText.d.ts.map +1 -0
  128. package/lib/stores/CubePureText.js +24 -0
  129. package/lib/stores/CubePureText.js.map +1 -0
  130. package/lib/stores/CubeTourState.d.ts +49 -0
  131. package/lib/stores/CubeTourState.d.ts.map +1 -0
  132. package/lib/stores/CubeTourState.js +92 -0
  133. package/lib/stores/CubeTourState.js.map +1 -0
  134. package/lib/stores/LegendCubeHost.d.ts +88 -0
  135. package/lib/stores/LegendCubeHost.d.ts.map +1 -0
  136. package/lib/stores/LegendCubeHost.js +149 -0
  137. package/lib/stores/LegendCubeHost.js.map +1 -0
  138. package/lib/stores/editors/CubeExplodeDraft.d.ts +87 -0
  139. package/lib/stores/editors/CubeExplodeDraft.d.ts.map +1 -0
  140. package/lib/stores/editors/CubeExplodeDraft.js +221 -0
  141. package/lib/stores/editors/CubeExplodeDraft.js.map +1 -0
  142. package/lib/stores/editors/CubeExpressionFilterDraft.d.ts +3 -0
  143. package/lib/stores/editors/CubeExpressionFilterDraft.d.ts.map +1 -1
  144. package/lib/stores/editors/CubeExpressionFilterDraft.js +4 -0
  145. package/lib/stores/editors/CubeExpressionFilterDraft.js.map +1 -1
  146. package/lib/stores/editors/CubeExtendDraft.d.ts +9 -0
  147. package/lib/stores/editors/CubeExtendDraft.d.ts.map +1 -1
  148. package/lib/stores/editors/CubeExtendDraft.js +26 -0
  149. package/lib/stores/editors/CubeExtendDraft.js.map +1 -1
  150. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -1
  151. package/lib/stores/editors/CubeNodeDraftRegistry.js +6 -1
  152. package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -1
  153. package/lib/stores/fixtures/CubeSalesDuckDbModel.d.ts +1 -0
  154. package/lib/stores/fixtures/CubeSalesDuckDbModel.d.ts.map +1 -1
  155. package/lib/stores/fixtures/CubeSalesDuckDbModel.js +8 -2
  156. package/lib/stores/fixtures/CubeSalesDuckDbModel.js.map +1 -1
  157. package/lib/stores/source-picker/CubeIngestTabState.d.ts +48 -14
  158. package/lib/stores/source-picker/CubeIngestTabState.d.ts.map +1 -1
  159. package/lib/stores/source-picker/CubeIngestTabState.js +159 -62
  160. package/lib/stores/source-picker/CubeIngestTabState.js.map +1 -1
  161. package/lib/stores/variant/CubeJson.d.ts +48 -0
  162. package/lib/stores/variant/CubeJson.d.ts.map +1 -0
  163. package/lib/stores/variant/CubeJson.js +207 -0
  164. package/lib/stores/variant/CubeJson.js.map +1 -0
  165. package/lib/stores/variant/CubeJsonExplorerState.d.ts +88 -0
  166. package/lib/stores/variant/CubeJsonExplorerState.d.ts.map +1 -0
  167. package/lib/stores/variant/CubeJsonExplorerState.js +297 -0
  168. package/lib/stores/variant/CubeJsonExplorerState.js.map +1 -0
  169. package/lib/stores/variant/CubeJsonFieldsState.d.ts +83 -0
  170. package/lib/stores/variant/CubeJsonFieldsState.d.ts.map +1 -0
  171. package/lib/stores/variant/CubeJsonFieldsState.js +207 -0
  172. package/lib/stores/variant/CubeJsonFieldsState.js.map +1 -0
  173. package/lib/stores/variant/CubeJsonOffers.d.ts +76 -0
  174. package/lib/stores/variant/CubeJsonOffers.d.ts.map +1 -0
  175. package/lib/stores/variant/CubeJsonOffers.js +250 -0
  176. package/lib/stores/variant/CubeJsonOffers.js.map +1 -0
  177. package/lib/stores/variant/CubeJsonParse.d.ts +28 -0
  178. package/lib/stores/variant/CubeJsonParse.d.ts.map +1 -0
  179. package/lib/stores/variant/CubeJsonParse.js +53 -0
  180. package/lib/stores/variant/CubeJsonParse.js.map +1 -0
  181. package/lib/stores/variant/CubeJsonSampling.d.ts +41 -0
  182. package/lib/stores/variant/CubeJsonSampling.d.ts.map +1 -0
  183. package/lib/stores/variant/CubeJsonSampling.js +59 -0
  184. package/lib/stores/variant/CubeJsonSampling.js.map +1 -0
  185. package/lib/stores/variant/CubeJsonShape.d.ts +87 -0
  186. package/lib/stores/variant/CubeJsonShape.d.ts.map +1 -0
  187. package/lib/stores/variant/CubeJsonShape.js +209 -0
  188. package/lib/stores/variant/CubeJsonShape.js.map +1 -0
  189. package/lib/stores/variant/CubeJsonViewerState.d.ts +33 -0
  190. package/lib/stores/variant/CubeJsonViewerState.d.ts.map +1 -0
  191. package/lib/stores/variant/CubeJsonViewerState.js +53 -0
  192. package/lib/stores/variant/CubeJsonViewerState.js.map +1 -0
  193. package/package.json +2 -2
  194. package/src/__lib__/LegendCubeHelpText.ts +4 -0
  195. package/src/__lib__/LegendCubeLabels.ts +60 -8
  196. package/src/__lib__/LegendCubeNavigation.ts +48 -0
  197. package/src/__lib__/LegendCubeTesting.ts +2 -0
  198. package/src/__lib__/LegendCubeTour.ts +173 -0
  199. package/src/__test-utils__/CubeExampleTestUtils.ts +119 -0
  200. package/src/__test-utils__/CubeVariantTestUtils.ts +103 -0
  201. package/src/components/CubeAddItems.tsx +2 -0
  202. package/src/components/CubeEditor.tsx +15 -0
  203. package/src/components/CubeFileMenu.tsx +2 -0
  204. package/src/components/CubeNodeIcon.tsx +2 -0
  205. package/src/components/canvas/CubeCanvas.tsx +17 -1
  206. package/src/components/canvas/CubeCanvasNode.tsx +7 -0
  207. package/src/components/dev-settings/CubeDevSettings.tsx +17 -2
  208. package/src/components/editors/CubeColumnPicker.tsx +3 -0
  209. package/src/components/editors/CubeExplodeEditor.tsx +207 -0
  210. package/src/components/editors/CubeExpressionFilterEditor.tsx +25 -8
  211. package/src/components/editors/CubeExtendEditor.tsx +32 -19
  212. package/src/components/editors/CubeJsonFieldsTree.tsx +316 -0
  213. package/src/components/editors/CubeNodeEditorRegistry.ts +3 -0
  214. package/src/components/grid/CubeGridRegion.tsx +21 -3
  215. package/src/components/grid/CubeGridValues.ts +8 -3
  216. package/src/components/grid/CubeJsonExplorerDialog.tsx +304 -0
  217. package/src/components/grid/CubeJsonViewerDialog.tsx +190 -0
  218. package/src/components/grid/CubeResultGrid.tsx +144 -2
  219. package/src/components/grid/CubeServerSideGrid.tsx +13 -0
  220. package/src/components/palette/CubePalette.tsx +9 -0
  221. package/src/components/source-picker/CubeIngestTab.tsx +62 -30
  222. package/src/components/tour/CubeTour.tsx +317 -0
  223. package/src/index.ts +7 -0
  224. package/src/stores/CubeEditorState.ts +36 -5
  225. package/src/stores/CubeExamples.ts +120 -2
  226. package/src/stores/CubeExamplesState.ts +9 -1
  227. package/src/stores/CubeGridQuickActions.ts +23 -12
  228. package/src/stores/CubePureText.ts +28 -0
  229. package/src/stores/CubeTourState.ts +116 -0
  230. package/src/stores/LegendCubeHost.ts +243 -0
  231. package/src/stores/editors/CubeExplodeDraft.ts +272 -0
  232. package/src/stores/editors/CubeExpressionFilterDraft.ts +4 -0
  233. package/src/stores/editors/CubeExtendDraft.ts +29 -0
  234. package/src/stores/editors/CubeNodeDraftRegistry.ts +7 -0
  235. package/src/stores/fixtures/CubeSalesDuckDbModel.ts +8 -2
  236. package/src/stores/source-picker/CubeIngestTabState.ts +253 -102
  237. package/src/stores/variant/CubeJson.ts +229 -0
  238. package/src/stores/variant/CubeJsonExplorerState.ts +378 -0
  239. package/src/stores/variant/CubeJsonFieldsState.ts +252 -0
  240. package/src/stores/variant/CubeJsonOffers.ts +359 -0
  241. package/src/stores/variant/CubeJsonParse.ts +75 -0
  242. package/src/stores/variant/CubeJsonSampling.ts +90 -0
  243. package/src/stores/variant/CubeJsonShape.ts +279 -0
  244. package/src/stores/variant/CubeJsonViewerState.ts +59 -0
  245. package/tsconfig.json +22 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonOffers.js","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonOffers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAGlB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,8EAA8E;AAC9E,4EAA4E;AAC5E,6E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,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5D,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE;QACxB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CubeEditorState } from '../CubeEditorState.js';
17
+ /** The column a text column's documents become: `<name>_json` */
18
+ export declare const getCubeJsonParseName: (column: string) => string;
19
+ /** The Extend column's text: the text read as a document (`fromJson` takes one value) */
20
+ export declare const getCubeJsonParseCode: (column: string) => string;
21
+ /** Whether a text cell holds a JSON object or array, which Parse as JSON is offered on */
22
+ export declare const isCubeJsonDocumentText: (text: string) => boolean;
23
+ /**
24
+ * Adds Parse as JSON's column after the node that ran, as one undo step, once
25
+ * the engine parses its text; nothing if the cube changed meanwhile
26
+ */
27
+ export declare const addCubeJsonParseColumn: (editorState: CubeEditorState, column: string) => Promise<void>;
28
+ //# sourceMappingURL=CubeJsonParse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonParse.d.ts","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAU7D,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,KAAG,MACpC,CAAC;AAEnB,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,KAAG,MACA,CAAC;AAEvD,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,KAAG,OAGrD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,aAAa,eAAe,EAC5B,QAAQ,MAAM,KACb,OAAO,CAAC,IAAI,CA0Bd,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Extend } from '@finos/legend-cube';
17
+ import { columnAccessOf } from '../CubePureText.js';
18
+ import { readCubeJson } from './CubeJson.js';
19
+ import { getFreeCubeColumnName } from './CubeJsonOffers.js';
20
+ // Parse as JSON (PLAN §11.20): a text column holding JSON documents read as a
21
+ // Variant column, `fromJson()`, so Explore JSON and Explode Array work on it.
22
+ // JSON stored as text is common, and it is the only way to a Variant column on
23
+ // a local source: H2 has none, and a direct connection hides a JSON column.
24
+ /** The column a text column's documents become: `<name>_json` */
25
+ export const getCubeJsonParseName = (column) => `${column}_json`;
26
+ /** The Extend column's text: the text read as a document (`fromJson` takes one value) */
27
+ export const getCubeJsonParseCode = (column) => `x | ${columnAccessOf(column)}->toOne()->fromJson()`;
28
+ /** Whether a text cell holds a JSON object or array, which Parse as JSON is offered on */
29
+ export const isCubeJsonDocumentText = (text) => {
30
+ const node = readCubeJson(text);
31
+ return node?.kind === 'object' || node?.kind === 'array';
32
+ };
33
+ /**
34
+ * Adds Parse as JSON's column after the node that ran, as one undo step, once
35
+ * the engine parses its text; nothing if the cube changed meanwhile
36
+ */
37
+ export const addCubeJsonParseColumn = async (editorState, column) => {
38
+ const { document } = editorState;
39
+ const { query } = document;
40
+ const afterId = query.selected;
41
+ if (afterId === undefined) {
42
+ return;
43
+ }
44
+ const extendId = query.generateId(Extend.TYPE);
45
+ const code = getCubeJsonParseCode(column);
46
+ const name = getFreeCubeColumnName(getCubeJsonParseName(column), (editorState.analysis.schemas.get(afterId)?.columns ?? []).map(({ name: taken }) => taken));
47
+ const { lambda } = await editorState.host.engine.parseExpression(code, `${extendId}:0`);
48
+ // as the menu found it: nothing changed while the engine parsed
49
+ if (editorState.document === document) {
50
+ editorState.addConfiguredNode(new Extend(extendId, [{ name, code, lambda }]), afterId);
51
+ }
52
+ };
53
+ //# sourceMappingURL=CubeJsonParse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonParse.js","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAE5E,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAU,EAAE,CAC7D,GAAG,MAAM,OAAO,CAAC;AAEnB,yFAAyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAU,EAAE,CAC7D,OAAO,cAAc,CAAC,M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AC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,EAC9C,OAAO,CACR,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { type CubeDocument, type SchemaColumn } from '@finos/legend-cube';
17
+ import type { CubeEditorState } from '../CubeEditorState.js';
18
+ import { type CubeJsonSample } from './CubeJsonShape.js';
19
+ /** How many values Explore JSON reads first (user, 2026-10-14) */
20
+ export declare const CUBE_JSON_SAMPLE_SIZE = 1000;
21
+ /** The runs that read a Variant column's documents, as Runs lists them */
22
+ export declare const CUBE_JSON_RUN_LABEL: {
23
+ sample: (column: string) => string;
24
+ everyRow: (column: string) => string;
25
+ };
26
+ /**
27
+ * Reads a Variant column's documents (PLAN §11.20) through the cube's own
28
+ * query path, so the read is listed in Runs and can be stopped: the query up
29
+ * to a node, then the column alone and its non-empty values, its first
30
+ * `CUBE_JSON_SAMPLE_SIZE` or every row. Explore JSON reads after the node
31
+ * that ran, the Explode Array editor after its input. `undefined` for a cube
32
+ * with no runtime; a failed or stopped run throws, as `runCubeQuery` does.
33
+ */
34
+ export declare const readCubeJsonSample: (editorState: CubeEditorState, options: {
35
+ document: CubeDocument;
36
+ afterId: string;
37
+ column: SchemaColumn;
38
+ everyRow: boolean;
39
+ abortController: AbortController;
40
+ }) => Promise<CubeJsonSample | undefined>;
41
+ //# sourceMappingURL=CubeJsonSampling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonSampling.d.ts","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonSampling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,KAAK,YAAY,EAKjB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,oBAAoB,CAAC;AAE7E,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAK1C,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB;qBACb,MAAM,KAAG,MAAM;uBACb,MAAM,KAAG,MAAM;CACnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,eAAe,EAC5B,SAAS;IACP,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;CAClC,KACA,OAAO,CAAC,cAAc,GAAG,SAAS,CA+BpC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ColumnComparisonFilter, Filter, FilterOperator, Restrict, Schema, } from '@finos/legend-cube';
17
+ import { runCubeQuery } from '../CubeQueryRun.js';
18
+ import { inferCubeJsonShape } from './CubeJsonShape.js';
19
+ /** How many values Explore JSON reads first (user, 2026-10-14) */
20
+ export const CUBE_JSON_SAMPLE_SIZE = 1000;
21
+ /** No limit: Read every row (the run's `limit(rowLimit + 1)` then takes them all) */
22
+ const EVERY_ROW = Number.MAX_SAFE_INTEGER;
23
+ /** The runs that read a Variant column's documents, as Runs lists them */
24
+ export const CUBE_JSON_RUN_LABEL = {
25
+ sample: (column) => `Sample of ${column}`,
26
+ everyRow: (column) => `Every value of ${column}`,
27
+ };
28
+ /**
29
+ * Reads a Variant column's documents (PLAN §11.20) through the cube's own
30
+ * query path, so the read is listed in Runs and can be stopped: the query up
31
+ * to a node, then the column alone and its non-empty values, its first
32
+ * `CUBE_JSON_SAMPLE_SIZE` or every row. Explore JSON reads after the node
33
+ * that ran, the Explode Array editor after its input. `undefined` for a cube
34
+ * with no runtime; a failed or stopped run throws, as `runCubeQuery` does.
35
+ */
36
+ export const readCubeJsonSample = async (editorState, options) => {
37
+ const { document, afterId, column, everyRow, abortController } = options;
38
+ const { context, query } = document;
39
+ if (context?.runtime === undefined) {
40
+ return undefined;
41
+ }
42
+ // each after the one before; the query isn't kept
43
+ const restrict = new Restrict(query.generateId(Restrict.TYPE), [column.name]);
44
+ const nonEmpty = new Filter(query.generateId(Filter.TYPE), new ColumnComparisonFilter(column.name, FilterOperator.IS_NOT_EMPTY));
45
+ const values = [restrict, nonEmpty].reduce((built, node) => built.add(node, built.selected), query.selected === afterId ? query : query.select(afterId));
46
+ const result = await runCubeQuery(editorState, {
47
+ query: values,
48
+ model: context.model,
49
+ runtime: context.runtime,
50
+ schema: new Schema([column]),
51
+ rowLimit: everyRow ? EVERY_ROW : CUBE_JSON_SAMPLE_SIZE,
52
+ abortController,
53
+ label: everyRow
54
+ ? CUBE_JSON_RUN_LABEL.everyRow(column.name)
55
+ : CUBE_JSON_RUN_LABEL.sample(column.name),
56
+ });
57
+ return inferCubeJsonShape(result.rows.map((row) => row[0] ?? null), !result.limited);
58
+ };
59
+ //# sourceMappingURL=CubeJsonSampling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonSampling.js","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonSampling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,sBAAsB,EAEtB,MAAM,EACN,cAAc,EACd,QAAQ,EACR,MAAM,GAEP,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAuB,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,kEAAkE;AAClE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,qFAAqF;AACrF,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE1C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,CAAC,MAAc,EAAU,EAAE,CAAC,aAAa,MAAM,EAAE;IACzD,QAAQ,EAAE,CAAC,MAAc,EAAU,EAAE,CAAC,kBAAkB,MAAM,EAAE;CACjE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,WAA4B,EAC5B,OAMC,EACoC,EAAE;IACvC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IACzE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;IACpC,IAAI,OAAO,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,kDAAkD;IAClD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC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sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CubeResultValue } from '../../graph-manager/CubeEngine.js';
17
+ /** What a scalar looked like, which picks its `to(@T)` */
18
+ export declare enum CubeJsonScalarKind {
19
+ INTEGER = "integer",
20
+ FLOAT = "float",
21
+ BOOLEAN = "boolean",
22
+ DATE = "date",
23
+ DATETIME = "datetime",
24
+ TEXT = "text"
25
+ }
26
+ /** The Pure type each kind is read as */
27
+ export declare const CUBE_JSON_PURE_TYPE: Record<CubeJsonScalarKind, string>;
28
+ /** A kind as the dialog names it */
29
+ export declare const CUBE_JSON_KIND_LABEL: Record<CubeJsonScalarKind, string>;
30
+ /** Everything seen at one position of the documents */
31
+ export interface CubeJsonShape {
32
+ /** Times the position was there, empty included */
33
+ present: number;
34
+ /** Times it held null */
35
+ nulls: number;
36
+ /** The kinds of scalar seen, and how often */
37
+ readonly scalars: Map<CubeJsonScalarKind, number>;
38
+ /** Distinct scalar values and how often, up to `MAX_VALUES` of them */
39
+ readonly values: Map<string, number>;
40
+ /** Times it held an object */
41
+ objects: number;
42
+ /** The objects' fields, in the order first seen */
43
+ readonly fields: Map<string, CubeJsonShape>;
44
+ /** Times it held an array */
45
+ arrays: number;
46
+ /** Every element of every array seen here */
47
+ element: CubeJsonShape | undefined;
48
+ minLength: number;
49
+ maxLength: number;
50
+ }
51
+ /** What a sample of a column showed */
52
+ export interface CubeJsonSample {
53
+ /** The shape of the column's documents */
54
+ readonly shape: CubeJsonShape;
55
+ /** Cells read, empty ones included */
56
+ readonly rows: number;
57
+ /** Cells that couldn't be read as JSON */
58
+ readonly unreadable: number;
59
+ /** Every row of the column was read: the shape is the whole column's */
60
+ readonly complete: boolean;
61
+ }
62
+ /** A column's shape, built as its cells arrive */
63
+ export declare class CubeJsonShapeReader {
64
+ private readonly shape;
65
+ private rows;
66
+ private unreadable;
67
+ /** A cell as the grid receives it: the document's JSON text, or null */
68
+ add(cell: CubeResultValue): void;
69
+ result(complete: boolean): CubeJsonSample;
70
+ }
71
+ /** The shape of a sample of a column's cells */
72
+ export declare const inferCubeJsonShape: (cells: readonly CubeResultValue[], complete?: boolean) => CubeJsonSample;
73
+ /**
74
+ * The one scalar type a position is read as, picked so a wrong guess can't
75
+ * give wrong rows: one kind is that kind; whole numbers and fractions
76
+ * together are numbers (`Float`); any other mix, dates with date-times
77
+ * included, is text, which every value reads as. `undefined` when no scalar
78
+ * was seen.
79
+ */
80
+ export declare const getCubeJsonScalarType: (shape: CubeJsonShape) => CubeJsonScalarKind | undefined;
81
+ /** A position holds only scalars (and nulls): no object or array */
82
+ export declare const isCubeJsonScalarShape: (shape: CubeJsonShape) => boolean;
83
+ /** A position's most frequent values, most frequent first, then by text */
84
+ export declare const getCubeJsonTopValues: (shape: CubeJsonShape, count?: number) => string[];
85
+ /** What a position held, e.g. `text`, `object`, `list of object`, `number or object`; `always empty` for nothing but nulls */
86
+ export declare const describeCubeJsonShape: (shape: CubeJsonShape) => string;
87
+ //# sourceMappingURL=CubeJsonShape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonShape.d.ts","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonShape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAWzE,0DAA0D;AAC1D,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SA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EvB,wEAAwE;IACxE,GAAG,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAahC,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,cAAc;CAQ1C;AAED,gDAAgD;AAChD,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,eAAe,EAAE,EACjC,kBAAgB,KACf,cAIF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,aAAa,KACnB,kBAAkB,GAAG,SAWvB,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,GAAI,OAAO,aAAa,KAAG,OACQ,CAAC;AAEtE,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,GAC/B,OAAO,aAAa,EACpB,cAAU,KACT,MAAM,EAMmB,CAAC;AAE7B,8HAA8H;AAC9H,eAAO,MAAM,qBAAqB,GAAI,OAAO,aAAa,KAAG,MAgB5D,CAAC"}
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { readCubeJson } from './CubeJson.js';
17
+ // What a Variant column's documents hold (PLAN §11.20), inferred from a
18
+ // sample of them, as legend-lite's Data Cube does: nothing in the model says,
19
+ // since the column is declared only SEMISTRUCTURED. The inferred type only
20
+ // picks the `to(@T)` an offer writes; the engine then types the column. A
21
+ // wrong pick isn't always an error, though: on Snowflake, DuckDB, Postgres
22
+ // and Databricks `to(@Integer)` of `1.5` returns a value, so the type is
23
+ // picked conservatively (`getCubeJsonScalarType`).
24
+ /** What a scalar looked like, which picks its `to(@T)` */
25
+ export var CubeJsonScalarKind;
26
+ (function (CubeJsonScalarKind) {
27
+ CubeJsonScalarKind["INTEGER"] = "integer";
28
+ CubeJsonScalarKind["FLOAT"] = "float";
29
+ CubeJsonScalarKind["BOOLEAN"] = "boolean";
30
+ CubeJsonScalarKind["DATE"] = "date";
31
+ CubeJsonScalarKind["DATETIME"] = "datetime";
32
+ CubeJsonScalarKind["TEXT"] = "text";
33
+ })(CubeJsonScalarKind || (CubeJsonScalarKind = {}));
34
+ /** The Pure type each kind is read as */
35
+ export const CUBE_JSON_PURE_TYPE = {
36
+ [CubeJsonScalarKind.INTEGER]: 'Integer',
37
+ [CubeJsonScalarKind.FLOAT]: 'Float',
38
+ [CubeJsonScalarKind.BOOLEAN]: 'Boolean',
39
+ [CubeJsonScalarKind.DATE]: 'StrictDate',
40
+ [CubeJsonScalarKind.DATETIME]: 'DateTime',
41
+ [CubeJsonScalarKind.TEXT]: 'String',
42
+ };
43
+ /** A kind as the dialog names it */
44
+ export const CUBE_JSON_KIND_LABEL = {
45
+ [CubeJsonScalarKind.INTEGER]: 'whole number',
46
+ [CubeJsonScalarKind.FLOAT]: 'number',
47
+ [CubeJsonScalarKind.BOOLEAN]: 'true or false',
48
+ [CubeJsonScalarKind.DATE]: 'date',
49
+ [CubeJsonScalarKind.DATETIME]: 'date and time',
50
+ [CubeJsonScalarKind.TEXT]: 'text',
51
+ };
52
+ const DATE = /^\d{4}-\d{2}-\d{2}$/u;
53
+ const DATETIME = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/u;
54
+ const WHOLE_NUMBER = /^-?\d+$/u;
55
+ /** The largest whole number a 64-bit `to(@Integer)` holds */
56
+ const MAX_INTEGER = 9223372036854775807n;
57
+ /** At most this many distinct values of a position are counted */
58
+ const MAX_VALUES = 50;
59
+ const kindOf = (node) => {
60
+ switch (node.kind) {
61
+ case 'number':
62
+ // a whole number past 64 bits would overflow `to(@Integer)`: text
63
+ return WHOLE_NUMBER.test(node.text)
64
+ ? BigInt(node.text) <= MAX_INTEGER && BigInt(node.text) >= -MAX_INTEGER
65
+ ? CubeJsonScalarKind.INTEGER
66
+ : CubeJsonScalarKind.TEXT
67
+ : CubeJsonScalarKind.FLOAT;
68
+ case 'boolean':
69
+ return CubeJsonScalarKind.BOOLEAN;
70
+ case 'string':
71
+ return DATE.test(node.value)
72
+ ? CubeJsonScalarKind.DATE
73
+ : DATETIME.test(node.value)
74
+ ? CubeJsonScalarKind.DATETIME
75
+ : CubeJsonScalarKind.TEXT;
76
+ default:
77
+ return undefined;
78
+ }
79
+ };
80
+ /** A scalar's text, as it is shown and counted */
81
+ const textOf = (node) => node.kind === 'number'
82
+ ? node.text
83
+ : node.kind === 'string'
84
+ ? node.value
85
+ : node.kind === 'boolean'
86
+ ? String(node.value)
87
+ : '';
88
+ const emptyShape = () => ({
89
+ present: 0,
90
+ nulls: 0,
91
+ scalars: new Map(),
92
+ values: new Map(),
93
+ objects: 0,
94
+ fields: new Map(),
95
+ arrays: 0,
96
+ element: undefined,
97
+ minLength: Infinity,
98
+ maxLength: 0,
99
+ });
100
+ const observe = (shape, node) => {
101
+ shape.present += 1;
102
+ if (node.kind === 'null') {
103
+ shape.nulls += 1;
104
+ return;
105
+ }
106
+ if (node.kind === 'object') {
107
+ shape.objects += 1;
108
+ node.entries.forEach(([key, value]) => {
109
+ let field = shape.fields.get(key);
110
+ if (!field) {
111
+ field = emptyShape();
112
+ shape.fields.set(key, field);
113
+ }
114
+ observe(field, value);
115
+ });
116
+ return;
117
+ }
118
+ if (node.kind === 'array') {
119
+ shape.arrays += 1;
120
+ shape.minLength = Math.min(shape.minLength, node.items.length);
121
+ shape.maxLength = Math.max(shape.maxLength, node.items.length);
122
+ const element = shape.element ?? emptyShape();
123
+ shape.element = element;
124
+ node.items.forEach((item) => observe(element, item));
125
+ return;
126
+ }
127
+ const kind = kindOf(node);
128
+ if (kind) {
129
+ shape.scalars.set(kind, (shape.scalars.get(kind) ?? 0) + 1);
130
+ }
131
+ const text = textOf(node);
132
+ if (shape.values.has(text) || shape.values.size < MAX_VALUES) {
133
+ shape.values.set(text, (shape.values.get(text) ?? 0) + 1);
134
+ }
135
+ };
136
+ /** A column's shape, built as its cells arrive */
137
+ export class CubeJsonShapeReader {
138
+ shape = emptyShape();
139
+ rows = 0;
140
+ unreadable = 0;
141
+ /** A cell as the grid receives it: the document's JSON text, or null */
142
+ add(cell) {
143
+ this.rows += 1;
144
+ if (cell === null) {
145
+ return;
146
+ }
147
+ const node = readCubeJson(String(cell));
148
+ if (node) {
149
+ observe(this.shape, node);
150
+ }
151
+ else {
152
+ this.unreadable += 1;
153
+ }
154
+ }
155
+ result(complete) {
156
+ return {
157
+ shape: this.shape,
158
+ rows: this.rows,
159
+ unreadable: this.unreadable,
160
+ complete,
161
+ };
162
+ }
163
+ }
164
+ /** The shape of a sample of a column's cells */
165
+ export const inferCubeJsonShape = (cells, complete = false) => {
166
+ const reader = new CubeJsonShapeReader();
167
+ cells.forEach((cell) => reader.add(cell));
168
+ return reader.result(complete);
169
+ };
170
+ /**
171
+ * The one scalar type a position is read as, picked so a wrong guess can't
172
+ * give wrong rows: one kind is that kind; whole numbers and fractions
173
+ * together are numbers (`Float`); any other mix, dates with date-times
174
+ * included, is text, which every value reads as. `undefined` when no scalar
175
+ * was seen.
176
+ */
177
+ export const getCubeJsonScalarType = (shape) => {
178
+ const kinds = [...shape.scalars.keys()];
179
+ if (kinds.length <= 1) {
180
+ return kinds[0];
181
+ }
182
+ return kinds.every((kind) => kind === CubeJsonScalarKind.INTEGER || kind === CubeJsonScalarKind.FLOAT)
183
+ ? CubeJsonScalarKind.FLOAT
184
+ : CubeJsonScalarKind.TEXT;
185
+ };
186
+ /** A position holds only scalars (and nulls): no object or array */
187
+ export const isCubeJsonScalarShape = (shape) => shape.objects === 0 && shape.arrays === 0 && shape.scalars.size > 0;
188
+ /** A position's most frequent values, most frequent first, then by text */
189
+ export const getCubeJsonTopValues = (shape, count = 12) => [...shape.values.entries()]
190
+ .sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0]))
191
+ .slice(0, count)
192
+ .map(([value]) => value);
193
+ /** What a position held, e.g. `text`, `object`, `list of object`, `number or object`; `always empty` for nothing but nulls */
194
+ export const describeCubeJsonShape = (shape) => {
195
+ const parts = [];
196
+ const scalar = getCubeJsonScalarType(shape);
197
+ if (scalar) {
198
+ parts.push(CUBE_JSON_KIND_LABEL[scalar]);
199
+ }
200
+ if (shape.objects > 0) {
201
+ parts.push('object');
202
+ }
203
+ if (shape.arrays > 0) {
204
+ const { element } = shape;
205
+ parts.push(`list of ${!element || element.present === element.nulls ? 'nothing' : describeCubeJsonShape(element)}`);
206
+ }
207
+ return parts.length ? parts.join(' or ') : 'always empty';
208
+ };
209
+ //# sourceMappingURL=CubeJsonShape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonShape.js","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonShape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAEhE,wEAAwE;AACxE,8EAA8E;AAC9E,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,mDAAmD;AAEnD,0DAA0D;AAC1D,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,yCAAmB,CAAA;IACnB,mCAAa,CAAA;IACb,2CAAqB,CAAA;IACrB,mCAAa,CAAA;AACf,CAAC,EAPW,kBAAkB,KAAlB,kBAAkB,QAO7B;AAED,yCAAyC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAuC;IACrE,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,SAAS;IACvC,CAAC,kBAAkB,CAAC,K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+1,33 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { type CubeJsonNode } from './CubeJson.js';
17
+ /**
18
+ * Open JSON (PLAN §11.20): one Variant cell's document, shown as a tree in a
19
+ * dialog, from the cell's menu
20
+ */
21
+ export declare class CubeJsonViewerState {
22
+ /** The cell's column, for the title; `undefined` while closed */
23
+ column: string | undefined;
24
+ /** The cell's text, as the engine sent it */
25
+ text: string | undefined;
26
+ constructor();
27
+ get isOpen(): boolean;
28
+ /** The document; `undefined` for text that isn't JSON, shown as it is */
29
+ get document(): CubeJsonNode | undefined;
30
+ open(column: string, text: string): void;
31
+ close(): void;
32
+ }
33
+ //# sourceMappingURL=CubeJsonViewerState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonViewerState.d.ts","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonViewerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,eAAe,CAAC;AAEhE;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,iEAAiE;IACjE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;;IAazB,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,yEAAyE;IACzE,IAAI,QAAQ,IAAI,YAAY,GAAG,SAAS,CAEvC;IAED,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxC,KAAK,IAAI,IAAI;CAId"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { action, computed, makeObservable, observable } from 'mobx';
17
+ import { readCubeJson } from './CubeJson.js';
18
+ /**
19
+ * Open JSON (PLAN §11.20): one Variant cell's document, shown as a tree in a
20
+ * dialog, from the cell's menu
21
+ */
22
+ export class CubeJsonViewerState {
23
+ /** The cell's column, for the title; `undefined` while closed */
24
+ column;
25
+ /** The cell's text, as the engine sent it */
26
+ text;
27
+ constructor() {
28
+ makeObservable(this, {
29
+ column: observable,
30
+ text: observable,
31
+ isOpen: computed,
32
+ document: computed,
33
+ open: action,
34
+ close: action,
35
+ });
36
+ }
37
+ get isOpen() {
38
+ return this.text !== undefined;
39
+ }
40
+ /** The document; `undefined` for text that isn't JSON, shown as it is */
41
+ get document() {
42
+ return this.text === undefined ? undefined : readCubeJson(this.text);
43
+ }
44
+ open(column, text) {
45
+ this.column = column;
46
+ this.text = text;
47
+ }
48
+ close() {
49
+ this.column = undefined;
50
+ this.text = undefined;
51
+ }
52
+ }
53
+ //# sourceMappingURL=CubeJsonViewerState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeJsonViewerState.js","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonViewerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAEhE;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC9B,iEAAiE;IACjE,MAAM,CAAqB;IAC3B,6CAA6C;IAC7C,IAAI,CAAqB;IAEzB;QACE,cAAc,CAAC,IAAI,EAAE;YACnB,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,QAAQ;YAChB,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;IACjC,CAAC;IAED,yEAAyE;IACzE,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,IAAI,CAAC,MAAc,EAAE,IAAY;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACxB,CAAC;CACF"}