@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.
- package/docs/adding-an-operation.md +4 -2
- package/docs/demo/README.md +1 -1
- package/docs/hosting.md +40 -9
- package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -1
- package/lib/__lib__/LegendCubeHelpText.js +3 -1
- package/lib/__lib__/LegendCubeHelpText.js.map +1 -1
- package/lib/__lib__/LegendCubeLabels.d.ts +34 -5
- package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -1
- package/lib/__lib__/LegendCubeLabels.js +45 -8
- package/lib/__lib__/LegendCubeLabels.js.map +1 -1
- package/lib/__lib__/LegendCubeNavigation.d.ts +23 -0
- package/lib/__lib__/LegendCubeNavigation.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeNavigation.js +33 -0
- package/lib/__lib__/LegendCubeNavigation.js.map +1 -0
- package/lib/__lib__/LegendCubeTesting.d.ts +3 -1
- package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -1
- package/lib/__lib__/LegendCubeTesting.js +2 -0
- package/lib/__lib__/LegendCubeTesting.js.map +1 -1
- package/lib/__lib__/LegendCubeTour.d.ts +62 -0
- package/lib/__lib__/LegendCubeTour.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeTour.js +149 -0
- package/lib/__lib__/LegendCubeTour.js.map +1 -0
- package/lib/__test-utils__/CubeExampleTestUtils.d.ts +34 -0
- package/lib/__test-utils__/CubeExampleTestUtils.d.ts.map +1 -0
- package/lib/__test-utils__/CubeExampleTestUtils.js +72 -0
- package/lib/__test-utils__/CubeExampleTestUtils.js.map +1 -0
- package/lib/__test-utils__/CubeVariantTestUtils.d.ts +16 -0
- package/lib/__test-utils__/CubeVariantTestUtils.d.ts.map +1 -0
- package/lib/__test-utils__/CubeVariantTestUtils.js +66 -0
- package/lib/__test-utils__/CubeVariantTestUtils.js.map +1 -0
- package/lib/components/CubeAddItems.d.ts.map +1 -1
- package/lib/components/CubeAddItems.js +2 -1
- package/lib/components/CubeAddItems.js.map +1 -1
- package/lib/components/CubeEditor.d.ts.map +1 -1
- package/lib/components/CubeEditor.js +11 -5
- package/lib/components/CubeEditor.js.map +1 -1
- package/lib/components/CubeFileMenu.d.ts.map +1 -1
- package/lib/components/CubeFileMenu.js +2 -1
- package/lib/components/CubeFileMenu.js.map +1 -1
- package/lib/components/CubeNodeIcon.d.ts.map +1 -1
- package/lib/components/CubeNodeIcon.js +2 -1
- package/lib/components/CubeNodeIcon.js.map +1 -1
- package/lib/components/canvas/CubeCanvas.d.ts.map +1 -1
- package/lib/components/canvas/CubeCanvas.js +3 -2
- package/lib/components/canvas/CubeCanvas.js.map +1 -1
- package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -1
- package/lib/components/canvas/CubeCanvasNode.js +4 -1
- package/lib/components/canvas/CubeCanvasNode.js.map +1 -1
- package/lib/components/dev-settings/CubeDevSettings.d.ts +2 -2
- package/lib/components/dev-settings/CubeDevSettings.d.ts.map +1 -1
- package/lib/components/dev-settings/CubeDevSettings.js +12 -8
- package/lib/components/dev-settings/CubeDevSettings.js.map +1 -1
- package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -1
- package/lib/components/editors/CubeColumnPicker.js +3 -1
- package/lib/components/editors/CubeColumnPicker.js.map +1 -1
- package/lib/components/editors/CubeExplodeEditor.d.ts +26 -0
- package/lib/components/editors/CubeExplodeEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeExplodeEditor.js +61 -0
- package/lib/components/editors/CubeExplodeEditor.js.map +1 -0
- package/lib/components/editors/CubeExpressionFilterEditor.d.ts.map +1 -1
- package/lib/components/editors/CubeExpressionFilterEditor.js +8 -5
- package/lib/components/editors/CubeExpressionFilterEditor.js.map +1 -1
- package/lib/components/editors/CubeExtendEditor.d.ts +0 -2
- package/lib/components/editors/CubeExtendEditor.d.ts.map +1 -1
- package/lib/components/editors/CubeExtendEditor.js +12 -11
- package/lib/components/editors/CubeExtendEditor.js.map +1 -1
- package/lib/components/editors/CubeJsonFieldsTree.d.ts +46 -0
- package/lib/components/editors/CubeJsonFieldsTree.d.ts.map +1 -0
- package/lib/components/editors/CubeJsonFieldsTree.js +93 -0
- package/lib/components/editors/CubeJsonFieldsTree.js.map +1 -0
- package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -1
- package/lib/components/editors/CubeNodeEditorRegistry.js +3 -1
- package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -1
- package/lib/components/grid/CubeGridRegion.d.ts.map +1 -1
- package/lib/components/grid/CubeGridRegion.js +5 -4
- package/lib/components/grid/CubeGridRegion.js.map +1 -1
- package/lib/components/grid/CubeGridValues.d.ts +5 -3
- package/lib/components/grid/CubeGridValues.d.ts.map +1 -1
- package/lib/components/grid/CubeGridValues.js +8 -3
- package/lib/components/grid/CubeGridValues.js.map +1 -1
- package/lib/components/grid/CubeJsonExplorerDialog.d.ts +27 -0
- package/lib/components/grid/CubeJsonExplorerDialog.d.ts.map +1 -0
- package/lib/components/grid/CubeJsonExplorerDialog.js +102 -0
- package/lib/components/grid/CubeJsonExplorerDialog.js.map +1 -0
- package/lib/components/grid/CubeJsonViewerDialog.d.ts +27 -0
- package/lib/components/grid/CubeJsonViewerDialog.d.ts.map +1 -0
- package/lib/components/grid/CubeJsonViewerDialog.js +68 -0
- package/lib/components/grid/CubeJsonViewerDialog.js.map +1 -0
- package/lib/components/grid/CubeResultGrid.d.ts +15 -3
- package/lib/components/grid/CubeResultGrid.d.ts.map +1 -1
- package/lib/components/grid/CubeResultGrid.js +95 -3
- package/lib/components/grid/CubeResultGrid.js.map +1 -1
- package/lib/components/grid/CubeServerSideGrid.d.ts.map +1 -1
- package/lib/components/grid/CubeServerSideGrid.js +4 -2
- package/lib/components/grid/CubeServerSideGrid.js.map +1 -1
- package/lib/components/palette/CubePalette.d.ts.map +1 -1
- package/lib/components/palette/CubePalette.js +4 -1
- package/lib/components/palette/CubePalette.js.map +1 -1
- package/lib/components/source-picker/CubeIngestTab.d.ts +2 -2
- package/lib/components/source-picker/CubeIngestTab.d.ts.map +1 -1
- package/lib/components/source-picker/CubeIngestTab.js +19 -13
- package/lib/components/source-picker/CubeIngestTab.js.map +1 -1
- package/lib/components/tour/CubeTour.d.ts +36 -0
- package/lib/components/tour/CubeTour.d.ts.map +1 -0
- package/lib/components/tour/CubeTour.js +183 -0
- package/lib/components/tour/CubeTour.js.map +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/stores/CubeEditorState.d.ts +17 -1
- package/lib/stores/CubeEditorState.d.ts.map +1 -1
- package/lib/stores/CubeEditorState.js +35 -5
- package/lib/stores/CubeEditorState.js.map +1 -1
- package/lib/stores/CubeExamples.d.ts.map +1 -1
- package/lib/stores/CubeExamples.js +101 -4
- package/lib/stores/CubeExamples.js.map +1 -1
- package/lib/stores/CubeExamplesState.d.ts.map +1 -1
- package/lib/stores/CubeExamplesState.js +4 -1
- package/lib/stores/CubeExamplesState.js.map +1 -1
- package/lib/stores/CubeGridQuickActions.d.ts +7 -0
- package/lib/stores/CubeGridQuickActions.d.ts.map +1 -1
- package/lib/stores/CubeGridQuickActions.js +20 -11
- package/lib/stores/CubeGridQuickActions.js.map +1 -1
- package/lib/stores/CubePureText.d.ts +20 -0
- package/lib/stores/CubePureText.d.ts.map +1 -0
- package/lib/stores/CubePureText.js +24 -0
- package/lib/stores/CubePureText.js.map +1 -0
- package/lib/stores/CubeTourState.d.ts +49 -0
- package/lib/stores/CubeTourState.d.ts.map +1 -0
- package/lib/stores/CubeTourState.js +92 -0
- package/lib/stores/CubeTourState.js.map +1 -0
- package/lib/stores/LegendCubeHost.d.ts +88 -0
- package/lib/stores/LegendCubeHost.d.ts.map +1 -0
- package/lib/stores/LegendCubeHost.js +149 -0
- package/lib/stores/LegendCubeHost.js.map +1 -0
- package/lib/stores/editors/CubeExplodeDraft.d.ts +87 -0
- package/lib/stores/editors/CubeExplodeDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeExplodeDraft.js +221 -0
- package/lib/stores/editors/CubeExplodeDraft.js.map +1 -0
- package/lib/stores/editors/CubeExpressionFilterDraft.d.ts +3 -0
- package/lib/stores/editors/CubeExpressionFilterDraft.d.ts.map +1 -1
- package/lib/stores/editors/CubeExpressionFilterDraft.js +4 -0
- package/lib/stores/editors/CubeExpressionFilterDraft.js.map +1 -1
- package/lib/stores/editors/CubeExtendDraft.d.ts +9 -0
- package/lib/stores/editors/CubeExtendDraft.d.ts.map +1 -1
- package/lib/stores/editors/CubeExtendDraft.js +26 -0
- package/lib/stores/editors/CubeExtendDraft.js.map +1 -1
- package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -1
- package/lib/stores/editors/CubeNodeDraftRegistry.js +6 -1
- package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -1
- package/lib/stores/fixtures/CubeSalesDuckDbModel.d.ts +1 -0
- package/lib/stores/fixtures/CubeSalesDuckDbModel.d.ts.map +1 -1
- package/lib/stores/fixtures/CubeSalesDuckDbModel.js +8 -2
- package/lib/stores/fixtures/CubeSalesDuckDbModel.js.map +1 -1
- package/lib/stores/source-picker/CubeIngestTabState.d.ts +48 -14
- package/lib/stores/source-picker/CubeIngestTabState.d.ts.map +1 -1
- package/lib/stores/source-picker/CubeIngestTabState.js +159 -62
- package/lib/stores/source-picker/CubeIngestTabState.js.map +1 -1
- package/lib/stores/variant/CubeJson.d.ts +48 -0
- package/lib/stores/variant/CubeJson.d.ts.map +1 -0
- package/lib/stores/variant/CubeJson.js +207 -0
- package/lib/stores/variant/CubeJson.js.map +1 -0
- package/lib/stores/variant/CubeJsonExplorerState.d.ts +88 -0
- package/lib/stores/variant/CubeJsonExplorerState.d.ts.map +1 -0
- package/lib/stores/variant/CubeJsonExplorerState.js +297 -0
- package/lib/stores/variant/CubeJsonExplorerState.js.map +1 -0
- package/lib/stores/variant/CubeJsonFieldsState.d.ts +83 -0
- package/lib/stores/variant/CubeJsonFieldsState.d.ts.map +1 -0
- package/lib/stores/variant/CubeJsonFieldsState.js +207 -0
- package/lib/stores/variant/CubeJsonFieldsState.js.map +1 -0
- package/lib/stores/variant/CubeJsonOffers.d.ts +76 -0
- package/lib/stores/variant/CubeJsonOffers.d.ts.map +1 -0
- package/lib/stores/variant/CubeJsonOffers.js +250 -0
- package/lib/stores/variant/CubeJsonOffers.js.map +1 -0
- package/lib/stores/variant/CubeJsonParse.d.ts +28 -0
- package/lib/stores/variant/CubeJsonParse.d.ts.map +1 -0
- package/lib/stores/variant/CubeJsonParse.js +53 -0
- package/lib/stores/variant/CubeJsonParse.js.map +1 -0
- package/lib/stores/variant/CubeJsonSampling.d.ts +41 -0
- package/lib/stores/variant/CubeJsonSampling.d.ts.map +1 -0
- package/lib/stores/variant/CubeJsonSampling.js +59 -0
- package/lib/stores/variant/CubeJsonSampling.js.map +1 -0
- package/lib/stores/variant/CubeJsonShape.d.ts +87 -0
- package/lib/stores/variant/CubeJsonShape.d.ts.map +1 -0
- package/lib/stores/variant/CubeJsonShape.js +209 -0
- package/lib/stores/variant/CubeJsonShape.js.map +1 -0
- package/lib/stores/variant/CubeJsonViewerState.d.ts +33 -0
- package/lib/stores/variant/CubeJsonViewerState.d.ts.map +1 -0
- package/lib/stores/variant/CubeJsonViewerState.js +53 -0
- package/lib/stores/variant/CubeJsonViewerState.js.map +1 -0
- package/package.json +2 -2
- package/src/__lib__/LegendCubeHelpText.ts +4 -0
- package/src/__lib__/LegendCubeLabels.ts +60 -8
- package/src/__lib__/LegendCubeNavigation.ts +48 -0
- package/src/__lib__/LegendCubeTesting.ts +2 -0
- package/src/__lib__/LegendCubeTour.ts +173 -0
- package/src/__test-utils__/CubeExampleTestUtils.ts +119 -0
- package/src/__test-utils__/CubeVariantTestUtils.ts +103 -0
- package/src/components/CubeAddItems.tsx +2 -0
- package/src/components/CubeEditor.tsx +15 -0
- package/src/components/CubeFileMenu.tsx +2 -0
- package/src/components/CubeNodeIcon.tsx +2 -0
- package/src/components/canvas/CubeCanvas.tsx +17 -1
- package/src/components/canvas/CubeCanvasNode.tsx +7 -0
- package/src/components/dev-settings/CubeDevSettings.tsx +17 -2
- package/src/components/editors/CubeColumnPicker.tsx +3 -0
- package/src/components/editors/CubeExplodeEditor.tsx +207 -0
- package/src/components/editors/CubeExpressionFilterEditor.tsx +25 -8
- package/src/components/editors/CubeExtendEditor.tsx +32 -19
- package/src/components/editors/CubeJsonFieldsTree.tsx +316 -0
- package/src/components/editors/CubeNodeEditorRegistry.ts +3 -0
- package/src/components/grid/CubeGridRegion.tsx +21 -3
- package/src/components/grid/CubeGridValues.ts +8 -3
- package/src/components/grid/CubeJsonExplorerDialog.tsx +304 -0
- package/src/components/grid/CubeJsonViewerDialog.tsx +190 -0
- package/src/components/grid/CubeResultGrid.tsx +144 -2
- package/src/components/grid/CubeServerSideGrid.tsx +13 -0
- package/src/components/palette/CubePalette.tsx +9 -0
- package/src/components/source-picker/CubeIngestTab.tsx +62 -30
- package/src/components/tour/CubeTour.tsx +317 -0
- package/src/index.ts +7 -0
- package/src/stores/CubeEditorState.ts +36 -5
- package/src/stores/CubeExamples.ts +120 -2
- package/src/stores/CubeExamplesState.ts +9 -1
- package/src/stores/CubeGridQuickActions.ts +23 -12
- package/src/stores/CubePureText.ts +28 -0
- package/src/stores/CubeTourState.ts +116 -0
- package/src/stores/LegendCubeHost.ts +243 -0
- package/src/stores/editors/CubeExplodeDraft.ts +272 -0
- package/src/stores/editors/CubeExpressionFilterDraft.ts +4 -0
- package/src/stores/editors/CubeExtendDraft.ts +29 -0
- package/src/stores/editors/CubeNodeDraftRegistry.ts +7 -0
- package/src/stores/fixtures/CubeSalesDuckDbModel.ts +8 -2
- package/src/stores/source-picker/CubeIngestTabState.ts +253 -102
- package/src/stores/variant/CubeJson.ts +229 -0
- package/src/stores/variant/CubeJsonExplorerState.ts +378 -0
- package/src/stores/variant/CubeJsonFieldsState.ts +252 -0
- package/src/stores/variant/CubeJsonOffers.ts +359 -0
- package/src/stores/variant/CubeJsonParse.ts +75 -0
- package/src/stores/variant/CubeJsonSampling.ts +90 -0
- package/src/stores/variant/CubeJsonShape.ts +279 -0
- package/src/stores/variant/CubeJsonViewerState.ts +59 -0
- package/tsconfig.json +22 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeJsonExplorerState.js","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonExplorerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,OAAO,EACP,MAAM,EAEN,yBAAyB,GAG1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAoB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,cAAc,EACd,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAGL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,6CAA6C;AAC7C,MAAM,OAAO,GAAG,CAAC,IAAuB,EAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAE1E,+CAA+C;AAC/C,MAAM,QAAQ,GAAG,CAAC,IAAuB,EAAE,KAAoB,EAAU,EAAE,CACzE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;AAElC;;;;;;;;;GASG;AACH,MAAM,OAAO,qBAAqB;IACvB,WAAW,CAAkB;IAEtC,oDAAoD;IACpD,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AAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK;gBACR,KAAK,YAAY,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QACvE,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 Schema, type SchemaColumn } from '@finos/legend-cube';
|
|
17
|
+
import { type GeneratorFn } from '@finos/legend-shared';
|
|
18
|
+
import type { CubeEditorState } from '../CubeEditorState.js';
|
|
19
|
+
import { type CubeJsonField } from './CubeJsonOffers.js';
|
|
20
|
+
import type { CubeJsonSample } from './CubeJsonShape.js';
|
|
21
|
+
/**
|
|
22
|
+
* A Variant input column's fields in an expression editor, Extend's or
|
|
23
|
+
* Filter by Expression's (PLAN §11.20, V.9): opened from the column's chip,
|
|
24
|
+
* read from a sample of the column just before the node being edited, so no
|
|
25
|
+
* run of the cube is needed and stale rows don't matter. The sample is read
|
|
26
|
+
* as Explore JSON reads one (listed in Runs, and it can be stopped); a field
|
|
27
|
+
* clicked writes its expression into the editor's.
|
|
28
|
+
*/
|
|
29
|
+
export declare class CubeJsonFieldsState {
|
|
30
|
+
readonly editorState: CubeEditorState;
|
|
31
|
+
/** The node being edited, whose input is read */
|
|
32
|
+
readonly nodeId: string;
|
|
33
|
+
/** The column whose fields are open; `undefined` while closed */
|
|
34
|
+
column: SchemaColumn | undefined;
|
|
35
|
+
/** What was read, and of which column */
|
|
36
|
+
sample: {
|
|
37
|
+
readonly column: string;
|
|
38
|
+
readonly sample: CubeJsonSample;
|
|
39
|
+
} | undefined;
|
|
40
|
+
isReading: boolean;
|
|
41
|
+
/** Why the column couldn't be read */
|
|
42
|
+
error: string | undefined;
|
|
43
|
+
search: string;
|
|
44
|
+
/** The fields folded, by path; every field starts open */
|
|
45
|
+
readonly folded: import("mobx").ObservableSet<string>;
|
|
46
|
+
/** The field whose other forms show, by path */
|
|
47
|
+
formsOf: string | undefined;
|
|
48
|
+
private controller;
|
|
49
|
+
constructor(editorState: CubeEditorState, nodeId: string);
|
|
50
|
+
/** The node's input: its id and schema, once known */
|
|
51
|
+
get input(): {
|
|
52
|
+
id: string;
|
|
53
|
+
schema: Schema;
|
|
54
|
+
} | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Why the fields can't be read: the database the node's input runs on has
|
|
57
|
+
* no Variant functions; `undefined` when they can, or it isn't known yet
|
|
58
|
+
*/
|
|
59
|
+
get databaseProblem(): string | undefined;
|
|
60
|
+
/** The open column's fields, from what was read of it */
|
|
61
|
+
get fields(): CubeJsonField | undefined;
|
|
62
|
+
/** The fields matching the search, with the fields they are in */
|
|
63
|
+
get shownFields(): CubeJsonField | undefined;
|
|
64
|
+
isOpen(column: string): boolean;
|
|
65
|
+
isFolded(path: readonly string[]): boolean;
|
|
66
|
+
areFormsShown(path: readonly string[]): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Opens a column's fields, reading its first values unless they were read
|
|
69
|
+
* already, or closes them if open. The model's databases are loaded first:
|
|
70
|
+
* a database without JSON functions is refused, with the reason.
|
|
71
|
+
*/
|
|
72
|
+
toggle(column: SchemaColumn): GeneratorFn<void>;
|
|
73
|
+
/** Reads the open column's first values, or every row, before the node */
|
|
74
|
+
read(everyRow: boolean): GeneratorFn<void>;
|
|
75
|
+
/** Stops a read in flight, keeping what was read before it */
|
|
76
|
+
stop(): void;
|
|
77
|
+
/** Closes the fields, keeping what was read for when they open again */
|
|
78
|
+
close(): void;
|
|
79
|
+
setSearch(search: string): void;
|
|
80
|
+
toggleFolded(path: readonly string[]): void;
|
|
81
|
+
toggleForms(path: readonly string[]): void;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=CubeJsonFieldsState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeJsonFieldsState.d.ts","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonFieldsState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAU3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB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,QAAQ,EAAE,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;IAsC3C,8DAA8D;IAC9D,IAAI,IAAI,IAAI;IAMZ,wEAAwE;IACxE,KAAK,IAAI,IAAI;IAOb,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAS3C,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;CAI3C"}
|
|
@@ -0,0 +1,207 @@
|
|
|
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 { getVariantDatabaseProblem, } from '@finos/legend-cube';
|
|
17
|
+
import { assertErrorThrown } from '@finos/legend-shared';
|
|
18
|
+
import { action, computed, flow, flowResult, makeObservable, observable, } from 'mobx';
|
|
19
|
+
import { CubeEngineError } from '../../graph-manager/CubeEngine.js';
|
|
20
|
+
import { CubeQueryRunAborted } from '../CubeQueryRun.js';
|
|
21
|
+
import { filterCubeJsonFields, getCubeJsonFields, } from './CubeJsonOffers.js';
|
|
22
|
+
import { readCubeJsonSample } from './CubeJsonSampling.js';
|
|
23
|
+
/** A field's path as one key */
|
|
24
|
+
const pathKey = (path) => JSON.stringify(path);
|
|
25
|
+
/**
|
|
26
|
+
* A Variant input column's fields in an expression editor, Extend's or
|
|
27
|
+
* Filter by Expression's (PLAN §11.20, V.9): opened from the column's chip,
|
|
28
|
+
* read from a sample of the column just before the node being edited, so no
|
|
29
|
+
* run of the cube is needed and stale rows don't matter. The sample is read
|
|
30
|
+
* as Explore JSON reads one (listed in Runs, and it can be stopped); a field
|
|
31
|
+
* clicked writes its expression into the editor's.
|
|
32
|
+
*/
|
|
33
|
+
export class CubeJsonFieldsState {
|
|
34
|
+
editorState;
|
|
35
|
+
/** The node being edited, whose input is read */
|
|
36
|
+
nodeId;
|
|
37
|
+
/** The column whose fields are open; `undefined` while closed */
|
|
38
|
+
column;
|
|
39
|
+
/** What was read, and of which column */
|
|
40
|
+
sample;
|
|
41
|
+
isReading = false;
|
|
42
|
+
/** Why the column couldn't be read */
|
|
43
|
+
error;
|
|
44
|
+
search = '';
|
|
45
|
+
/** The fields folded, by path; every field starts open */
|
|
46
|
+
folded = observable.set();
|
|
47
|
+
/** The field whose other forms show, by path */
|
|
48
|
+
formsOf;
|
|
49
|
+
controller;
|
|
50
|
+
constructor(editorState, nodeId) {
|
|
51
|
+
makeObservable(this, {
|
|
52
|
+
column: observable.ref,
|
|
53
|
+
sample: observable.ref,
|
|
54
|
+
isReading: observable,
|
|
55
|
+
error: observable,
|
|
56
|
+
search: observable,
|
|
57
|
+
formsOf: observable,
|
|
58
|
+
input: computed,
|
|
59
|
+
databaseProblem: computed,
|
|
60
|
+
fields: computed,
|
|
61
|
+
shownFields: computed,
|
|
62
|
+
toggle: flow,
|
|
63
|
+
read: flow,
|
|
64
|
+
stop: action,
|
|
65
|
+
close: action,
|
|
66
|
+
setSearch: action,
|
|
67
|
+
toggleFolded: action,
|
|
68
|
+
toggleForms: action,
|
|
69
|
+
});
|
|
70
|
+
this.editorState = editorState;
|
|
71
|
+
this.nodeId = nodeId;
|
|
72
|
+
}
|
|
73
|
+
/** The node's input: its id and schema, once known */
|
|
74
|
+
get input() {
|
|
75
|
+
const [id] = this.editorState.document.query.getInputIds(this.nodeId);
|
|
76
|
+
const schema = id === undefined ? undefined : this.editorState.analysis.schemas.get(id);
|
|
77
|
+
return id === undefined || !schema ? undefined : { id, schema };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Why the fields can't be read: the database the node's input runs on has
|
|
81
|
+
* no Variant functions; `undefined` when they can, or it isn't known yet
|
|
82
|
+
*/
|
|
83
|
+
get databaseProblem() {
|
|
84
|
+
const { editorState, input } = this;
|
|
85
|
+
const { context, query } = editorState.document;
|
|
86
|
+
return input === undefined || context?.runtime === undefined
|
|
87
|
+
? undefined
|
|
88
|
+
: getVariantDatabaseProblem(editorState.getRunDatabaseType(query, input.id, context.model, context.runtime));
|
|
89
|
+
}
|
|
90
|
+
/** The open column's fields, from what was read of it */
|
|
91
|
+
get fields() {
|
|
92
|
+
const { column, sample } = this;
|
|
93
|
+
return column && sample?.column === column.name
|
|
94
|
+
? getCubeJsonFields(column.name, sample.sample)
|
|
95
|
+
: undefined;
|
|
96
|
+
}
|
|
97
|
+
/** The fields matching the search, with the fields they are in */
|
|
98
|
+
get shownFields() {
|
|
99
|
+
return this.fields && filterCubeJsonFields(this.fields, this.search);
|
|
100
|
+
}
|
|
101
|
+
isOpen(column) {
|
|
102
|
+
return this.column?.name === column;
|
|
103
|
+
}
|
|
104
|
+
isFolded(path) {
|
|
105
|
+
return this.folded.has(pathKey(path));
|
|
106
|
+
}
|
|
107
|
+
areFormsShown(path) {
|
|
108
|
+
return this.formsOf === pathKey(path);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Opens a column's fields, reading its first values unless they were read
|
|
112
|
+
* already, or closes them if open. The model's databases are loaded first:
|
|
113
|
+
* a database without JSON functions is refused, with the reason.
|
|
114
|
+
*/
|
|
115
|
+
*toggle(column) {
|
|
116
|
+
if (this.isOpen(column.name)) {
|
|
117
|
+
this.close();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.stop();
|
|
121
|
+
this.column = column;
|
|
122
|
+
this.error = undefined;
|
|
123
|
+
this.search = '';
|
|
124
|
+
this.formsOf = undefined;
|
|
125
|
+
if (this.sample?.column === column.name) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const { context } = this.editorState.document;
|
|
129
|
+
if (context) {
|
|
130
|
+
yield flowResult(this.editorState.loadModelOutline(context.model));
|
|
131
|
+
}
|
|
132
|
+
const problem = this.databaseProblem;
|
|
133
|
+
if (problem) {
|
|
134
|
+
this.error = problem;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
yield flowResult(this.read(false));
|
|
138
|
+
}
|
|
139
|
+
/** Reads the open column's first values, or every row, before the node */
|
|
140
|
+
*read(everyRow) {
|
|
141
|
+
const { editorState, column, input } = this;
|
|
142
|
+
if (!column || !input || this.isReading) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const controller = new AbortController();
|
|
146
|
+
this.controller = controller;
|
|
147
|
+
this.isReading = true;
|
|
148
|
+
this.error = undefined;
|
|
149
|
+
try {
|
|
150
|
+
const sample = (yield readCubeJsonSample(editorState, {
|
|
151
|
+
document: editorState.document,
|
|
152
|
+
afterId: input.id,
|
|
153
|
+
column,
|
|
154
|
+
everyRow,
|
|
155
|
+
abortController: controller,
|
|
156
|
+
}));
|
|
157
|
+
if (this.controller === controller && sample) {
|
|
158
|
+
this.sample = { column: column.name, sample };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (this.controller !== controller ||
|
|
163
|
+
error instanceof CubeQueryRunAborted) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
assertErrorThrown(error);
|
|
167
|
+
this.error =
|
|
168
|
+
error instanceof CubeEngineError ? error.firstLine : error.message;
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
if (this.controller === controller) {
|
|
172
|
+
this.controller = undefined;
|
|
173
|
+
this.isReading = false;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** Stops a read in flight, keeping what was read before it */
|
|
178
|
+
stop() {
|
|
179
|
+
this.controller?.abort();
|
|
180
|
+
this.controller = undefined;
|
|
181
|
+
this.isReading = false;
|
|
182
|
+
}
|
|
183
|
+
/** Closes the fields, keeping what was read for when they open again */
|
|
184
|
+
close() {
|
|
185
|
+
this.stop();
|
|
186
|
+
this.column = undefined;
|
|
187
|
+
this.error = undefined;
|
|
188
|
+
this.formsOf = undefined;
|
|
189
|
+
}
|
|
190
|
+
setSearch(search) {
|
|
191
|
+
this.search = search;
|
|
192
|
+
}
|
|
193
|
+
toggleFolded(path) {
|
|
194
|
+
const key = pathKey(path);
|
|
195
|
+
if (this.folded.has(key)) {
|
|
196
|
+
this.folded.delete(key);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
this.folded.add(key);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
toggleForms(path) {
|
|
203
|
+
const key = pathKey(path);
|
|
204
|
+
this.formsOf = this.formsOf === key ? undefined : key;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=CubeJsonFieldsState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeJsonFieldsState.js","sourceRoot":"","sources":["../../../src/stores/variant/CubeJsonFieldsState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,yBAAyB,GAG1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAoB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,cAAc,EACd,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAEL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,qBAAqB,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,CAAC;gBAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,8DAA8D;IAC9D,IAAI;QACF,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAED,wEAAwE;IACxE,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC3B,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,YAAY,CAAC,IAAuB;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,WAAW,CAAC,IAAuB;QACjC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;IACxD,CAAC;CACF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 CubeJsonSample } from './CubeJsonShape.js';
|
|
17
|
+
/** One column a field can become */
|
|
18
|
+
export interface CubeJsonOffer {
|
|
19
|
+
/** Unique among the field's offers, e.g. `value`, `count`, `contains:FR` */
|
|
20
|
+
readonly key: string;
|
|
21
|
+
/** What the dialog shows, e.g. `the value, as Integer` */
|
|
22
|
+
readonly label: string;
|
|
23
|
+
/** The column's default name, e.g. `payload_user_tier` */
|
|
24
|
+
readonly name: string;
|
|
25
|
+
/** The Pure type it should take, `Variant` for JSON: a suggestion, the engine types the column */
|
|
26
|
+
readonly type: string;
|
|
27
|
+
/** An Extend column's text, `x | …`; `undefined` for an explode */
|
|
28
|
+
readonly code: string | undefined;
|
|
29
|
+
/** One row per element of the array at this path: an Explode Array node */
|
|
30
|
+
readonly explode?: {
|
|
31
|
+
readonly column: string;
|
|
32
|
+
readonly path: readonly string[];
|
|
33
|
+
} | undefined;
|
|
34
|
+
}
|
|
35
|
+
/** A position in the documents, and what it can become */
|
|
36
|
+
export interface CubeJsonField {
|
|
37
|
+
/** The keys from the column to it; empty for the column itself */
|
|
38
|
+
readonly path: readonly string[];
|
|
39
|
+
/** What it held, e.g. `text`, `list of object` */
|
|
40
|
+
readonly description: string;
|
|
41
|
+
/** Its share, 0 to 1, of the places it could be: the rows read, or its object's occurrences */
|
|
42
|
+
readonly presence: number;
|
|
43
|
+
/** Its most frequent values, for a scalar */
|
|
44
|
+
readonly topValues: readonly string[];
|
|
45
|
+
readonly offers: readonly CubeJsonOffer[];
|
|
46
|
+
readonly children: readonly CubeJsonField[];
|
|
47
|
+
}
|
|
48
|
+
/** The default name of an array's element, as Explode Array makes it: its last key's, or its column's, then `_element` */
|
|
49
|
+
export declare const getCubeJsonElementName: (column: string, path: readonly string[]) => string;
|
|
50
|
+
/**
|
|
51
|
+
* A column's fields, from a sample of its documents: the column itself, its
|
|
52
|
+
* object's fields, theirs, and so on, each with what it held, how often it was
|
|
53
|
+
* there and what it can become. An array's elements' fields are reached
|
|
54
|
+
* through the array's offers (first element's, total of), not as fields.
|
|
55
|
+
*/
|
|
56
|
+
export declare const getCubeJsonFields: (column: string, sample: CubeJsonSample) => CubeJsonField;
|
|
57
|
+
/** A name no taken column has, compared folded: `name`, else `name_2`, `name_3`, … */
|
|
58
|
+
export declare const getFreeCubeColumnName: (name: string, taken: readonly string[]) => string;
|
|
59
|
+
/** An offer's expression of the row, as an editor writes it: its text without `x | ` */
|
|
60
|
+
export declare const getCubeJsonOfferExpression: (offer: CubeJsonOffer) => string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* What clicking a field in an expression editor writes (PLAN §11.20, V.9):
|
|
63
|
+
* a value as its suggested type, anything else as JSON (the column itself
|
|
64
|
+
* for its root); and the column "+ column" would add, but for the root,
|
|
65
|
+
* which is the column already
|
|
66
|
+
*/
|
|
67
|
+
export declare const getCubeJsonFieldDefault: (column: string, field: CubeJsonField) => {
|
|
68
|
+
expression: string;
|
|
69
|
+
column?: {
|
|
70
|
+
name: string;
|
|
71
|
+
code: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/** The fields whose keys match a search, with the fields they are in; all without a search */
|
|
75
|
+
export declare const filterCubeJsonFields: (field: CubeJsonField, search: string) => CubeJsonField | undefined;
|
|
76
|
+
//# sourceMappingURL=CubeJsonOffers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeJsonOffers.d.ts","sourceRoot":"","sources":["../../../src/stores/variant/CubeJ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,EACd,QAAQ,cAAc,KACrB,aAmBF,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,EACZ,OAAO,SAAS,MAAM,EAAE,KACvB,MAUF,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,0BAA0B,GACrC,OAAO,aAAa,KACnB,MAAM,GAAG,SAA+C,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,EACd,OAAO,aAAa,KACnB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAS/D,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,oBAAoB,GAC/B,OAAO,aAAa,EACpB,QAAQ,MAAM,KACb,aAAa,GAAG,SAYlB,CAAC"}
|
|
@@ -0,0 +1,250 @@
|
|
|
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 { foldColumnName } from '@finos/legend-cube';
|
|
17
|
+
import { columnAccessOf, pureStringLiteral } from '../CubePureText.js';
|
|
18
|
+
import { CUBE_JSON_PURE_TYPE, CubeJsonScalarKind, describeCubeJsonShape, getCubeJsonScalarType, getCubeJsonTopValues, isCubeJsonScalarShape, } from './CubeJsonShape.js';
|
|
19
|
+
// The fields of a Variant column's documents, and the columns each can become
|
|
20
|
+
// (PLAN §11.20), after legend-lite's Data Cube: picking one writes the Pure
|
|
21
|
+
// text of an Extend column, which the engine parses and types like any typed
|
|
22
|
+
// there. Only forms run on legend-engine are offered: `contains` goes through
|
|
23
|
+
// `toMany(@Variant)->map(…to(@T))`, since `toMany(@String)->contains` writes
|
|
24
|
+
// invalid SQL on DuckDB; no `exists` (an engine error); no tuple explode
|
|
25
|
+
// (`toVariant(newMap(…))`, nested maps excluded on Snowflake and DuckDB).
|
|
26
|
+
/** The Variant type, as an expression names it */
|
|
27
|
+
const VARIANT = 'Variant';
|
|
28
|
+
/** How many of an array's top values get a "contains" offer */
|
|
29
|
+
const CONTAINS_OFFERS = 8;
|
|
30
|
+
/** A column name from parts: joined by `_`, letters, digits and `_` only */
|
|
31
|
+
const nameOf = (parts) => parts
|
|
32
|
+
.join('_')
|
|
33
|
+
.replace(/[^A-Za-z0-9_]+/gu, '_')
|
|
34
|
+
.replace(/_+/gu, '_')
|
|
35
|
+
.replace(/^_|_$/gu, '') || 'value';
|
|
36
|
+
/** The default name of an array's element, as Explode Array makes it: its last key's, or its column's, then `_element` */
|
|
37
|
+
export const getCubeJsonElementName = (column, path) => nameOf([path[path.length - 1] ?? column, 'element']);
|
|
38
|
+
/** `$x.c->get('a')->get('b')` */
|
|
39
|
+
const pathOf = (column, path) => path.reduce((expression, key) => `${expression}->get(${pureStringLiteral(key)})`, columnAccessOf(column));
|
|
40
|
+
/** A function of the row */
|
|
41
|
+
const ofRow = (body) => `x | ${body}`;
|
|
42
|
+
/**
|
|
43
|
+
* A seen value as a Pure literal of the kind it is read as: a number in a
|
|
44
|
+
* Float list with a point (`2.0`); `undefined` for a number Pure can't write
|
|
45
|
+
* as a literal (an exponent)
|
|
46
|
+
*/
|
|
47
|
+
const literalOf = (kind, text) => kind === CubeJsonScalarKind.INTEGER || kind === CubeJsonScalarKind.FLOAT
|
|
48
|
+
? !/^-?\d+(?:\.\d+)?$/u.test(text)
|
|
49
|
+
? undefined
|
|
50
|
+
: kind === CubeJsonScalarKind.FLOAT && !text.includes('.')
|
|
51
|
+
? `${text}.0`
|
|
52
|
+
: text
|
|
53
|
+
: kind === CubeJsonScalarKind.BOOLEAN
|
|
54
|
+
? String(text === 'true')
|
|
55
|
+
: pureStringLiteral(text);
|
|
56
|
+
/** The kinds "contains" compares as typed literals: text, numbers and booleans */
|
|
57
|
+
const COMPARABLE_KINDS = new Set([
|
|
58
|
+
CubeJsonScalarKind.TEXT,
|
|
59
|
+
CubeJsonScalarKind.INTEGER,
|
|
60
|
+
CubeJsonScalarKind.FLOAT,
|
|
61
|
+
CubeJsonScalarKind.BOOLEAN,
|
|
62
|
+
]);
|
|
63
|
+
const arrayOffers = (column, path, shape) => {
|
|
64
|
+
const array = pathOf(column, path);
|
|
65
|
+
const names = [column, ...path];
|
|
66
|
+
const many = `${array}->toMany(@${VARIANT})`;
|
|
67
|
+
const offers = [
|
|
68
|
+
{
|
|
69
|
+
key: 'explode',
|
|
70
|
+
label: 'one row per element',
|
|
71
|
+
name: getCubeJsonElementName(column, path),
|
|
72
|
+
type: VARIANT,
|
|
73
|
+
code: undefined,
|
|
74
|
+
explode: { column, path },
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: 'count',
|
|
78
|
+
label: 'number of elements',
|
|
79
|
+
name: nameOf([...names, 'count']),
|
|
80
|
+
type: 'Integer',
|
|
81
|
+
code: ofRow(`${many}->size()`),
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
const { element } = shape;
|
|
85
|
+
if (!element) {
|
|
86
|
+
return offers;
|
|
87
|
+
}
|
|
88
|
+
const elementKind = getCubeJsonScalarType(element);
|
|
89
|
+
if (elementKind && isCubeJsonScalarShape(element)) {
|
|
90
|
+
offers.push({
|
|
91
|
+
key: 'list',
|
|
92
|
+
label: 'all values, as text',
|
|
93
|
+
name: nameOf([...names, 'list']),
|
|
94
|
+
type: 'String',
|
|
95
|
+
code: ofRow(`${many}->map(e | $e->to(@String))->joinStrings(', ')`),
|
|
96
|
+
});
|
|
97
|
+
if (COMPARABLE_KINDS.has(elementKind)) {
|
|
98
|
+
const type = CUBE_JSON_PURE_TYPE[elementKind];
|
|
99
|
+
getCubeJsonTopValues(element, CONTAINS_OFFERS).forEach((value) => {
|
|
100
|
+
const literal = literalOf(elementKind, value);
|
|
101
|
+
if (literal !== undefined) {
|
|
102
|
+
offers.push({
|
|
103
|
+
key: `contains:${value}`,
|
|
104
|
+
label: `contains ${value}`,
|
|
105
|
+
name: nameOf([...names, 'has', value]),
|
|
106
|
+
type: 'Boolean',
|
|
107
|
+
code: ofRow(`${many}->map(e | $e->to(@${type}))->contains(${literal})`),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (element.objects > 0) {
|
|
114
|
+
offers.push({
|
|
115
|
+
key: 'first',
|
|
116
|
+
label: 'first element, as JSON',
|
|
117
|
+
name: nameOf([...names, 'first']),
|
|
118
|
+
type: VARIANT,
|
|
119
|
+
code: ofRow(`${array}->get(0)`),
|
|
120
|
+
});
|
|
121
|
+
[...element.fields.entries()]
|
|
122
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
123
|
+
.forEach(([key, field]) => {
|
|
124
|
+
const kind = getCubeJsonScalarType(field);
|
|
125
|
+
if (!kind || !isCubeJsonScalarShape(field)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const type = CUBE_JSON_PURE_TYPE[kind];
|
|
129
|
+
offers.push({
|
|
130
|
+
key: `first:${key}`,
|
|
131
|
+
label: `first element's ${key}`,
|
|
132
|
+
name: nameOf([...names, 'first', key]),
|
|
133
|
+
type,
|
|
134
|
+
code: ofRow(`${array}->get(0)->get(${pureStringLiteral(key)})->to(@${type})`),
|
|
135
|
+
});
|
|
136
|
+
if (kind === CubeJsonScalarKind.INTEGER ||
|
|
137
|
+
kind === CubeJsonScalarKind.FLOAT) {
|
|
138
|
+
offers.push({
|
|
139
|
+
key: `total:${key}`,
|
|
140
|
+
label: `total of ${key}`,
|
|
141
|
+
name: nameOf([...names, key, 'total']),
|
|
142
|
+
type,
|
|
143
|
+
code: ofRow(`${many}->map(e | $e->get(${pureStringLiteral(key)})->to(@${type}))->sum()`),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return offers;
|
|
149
|
+
};
|
|
150
|
+
const offersOf = (column, path, shape) => {
|
|
151
|
+
const names = [column, ...path];
|
|
152
|
+
const offers = [];
|
|
153
|
+
const kind = getCubeJsonScalarType(shape);
|
|
154
|
+
if (kind && isCubeJsonScalarShape(shape)) {
|
|
155
|
+
const type = CUBE_JSON_PURE_TYPE[kind];
|
|
156
|
+
offers.push({
|
|
157
|
+
key: 'value',
|
|
158
|
+
label: `the value, as ${type}`,
|
|
159
|
+
name: nameOf(path.length ? names : [...names, 'value']),
|
|
160
|
+
type,
|
|
161
|
+
code: ofRow(`${pathOf(column, path)}->to(@${type})`),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// a nested object or array, as a Variant column of its own, to explore again
|
|
165
|
+
if (path.length > 0 && (shape.objects > 0 || shape.arrays > 0)) {
|
|
166
|
+
offers.push({
|
|
167
|
+
key: 'json',
|
|
168
|
+
label: 'as JSON',
|
|
169
|
+
name: nameOf(names),
|
|
170
|
+
type: VARIANT,
|
|
171
|
+
code: ofRow(pathOf(column, path)),
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (shape.objects > 0) {
|
|
175
|
+
offers.push({
|
|
176
|
+
key: 'keys',
|
|
177
|
+
label: 'its keys, as text',
|
|
178
|
+
name: nameOf([...names, 'keys']),
|
|
179
|
+
type: 'String',
|
|
180
|
+
code: ofRow(`${pathOf(column, path)}->to(@Map<String, ${VARIANT}>)->toOne()->keys()->joinStrings(', ')`),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (shape.arrays > 0) {
|
|
184
|
+
offers.push(...arrayOffers(column, path, shape));
|
|
185
|
+
}
|
|
186
|
+
return offers;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* A column's fields, from a sample of its documents: the column itself, its
|
|
190
|
+
* object's fields, theirs, and so on, each with what it held, how often it was
|
|
191
|
+
* there and what it can become. An array's elements' fields are reached
|
|
192
|
+
* through the array's offers (first element's, total of), not as fields.
|
|
193
|
+
*/
|
|
194
|
+
export const getCubeJsonFields = (column, sample) => {
|
|
195
|
+
const build = (shape, path, places) => ({
|
|
196
|
+
path,
|
|
197
|
+
description: describeCubeJsonShape(shape),
|
|
198
|
+
presence: Math.min(1, (shape.present - shape.nulls) / Math.max(1, places)),
|
|
199
|
+
topValues: isCubeJsonScalarShape(shape) ? getCubeJsonTopValues(shape) : [],
|
|
200
|
+
offers: offersOf(column, path, shape),
|
|
201
|
+
children: shape.objects > 0
|
|
202
|
+
? [...shape.fields.entries()]
|
|
203
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
204
|
+
.map(([key, field]) => build(field, [...path, key], shape.objects))
|
|
205
|
+
: [],
|
|
206
|
+
});
|
|
207
|
+
return build(sample.shape, [], sample.rows);
|
|
208
|
+
};
|
|
209
|
+
/** A name no taken column has, compared folded: `name`, else `name_2`, `name_3`, … */
|
|
210
|
+
export const getFreeCubeColumnName = (name, taken) => {
|
|
211
|
+
const folded = new Set(taken.map(foldColumnName));
|
|
212
|
+
if (!folded.has(foldColumnName(name))) {
|
|
213
|
+
return name;
|
|
214
|
+
}
|
|
215
|
+
let index = 2;
|
|
216
|
+
while (folded.has(foldColumnName(`${name}_${index}`))) {
|
|
217
|
+
index += 1;
|
|
218
|
+
}
|
|
219
|
+
return `${name}_${index}`;
|
|
220
|
+
};
|
|
221
|
+
/** An offer's expression of the row, as an editor writes it: its text without `x | ` */
|
|
222
|
+
export const getCubeJsonOfferExpression = (offer) => offer.code?.replace(/^x \| /u, '');
|
|
223
|
+
/**
|
|
224
|
+
* What clicking a field in an expression editor writes (PLAN §11.20, V.9):
|
|
225
|
+
* a value as its suggested type, anything else as JSON (the column itself
|
|
226
|
+
* for its root); and the column "+ column" would add, but for the root,
|
|
227
|
+
* which is the column already
|
|
228
|
+
*/
|
|
229
|
+
export const getCubeJsonFieldDefault = (column, field) => {
|
|
230
|
+
const offer = field.offers.find(({ key }) => key === 'value' || key === 'json');
|
|
231
|
+
const expression = (offer && getCubeJsonOfferExpression(offer)) ?? pathOf(column, field.path);
|
|
232
|
+
return offer?.code && field.path.length
|
|
233
|
+
? { expression, column: { name: offer.name, code: offer.code } }
|
|
234
|
+
: { expression };
|
|
235
|
+
};
|
|
236
|
+
/** The fields whose keys match a search, with the fields they are in; all without a search */
|
|
237
|
+
export const filterCubeJsonFields = (field, search) => {
|
|
238
|
+
const needle = search.trim().toLowerCase();
|
|
239
|
+
if (!needle) {
|
|
240
|
+
return field;
|
|
241
|
+
}
|
|
242
|
+
const children = field.children
|
|
243
|
+
.map((child) => filterCubeJsonFields(child, search))
|
|
244
|
+
.filter((child) => child !== undefined);
|
|
245
|
+
return children.length ||
|
|
246
|
+
field.path.some((key) => key.toLowerCase().includes(needle))
|
|
247
|
+
? { ...field, children }
|
|
248
|
+
: undefined;
|
|
249
|
+
};
|
|
250
|
+
//# sourceMappingURL=CubeJsonOffers.js.map
|