@finos/legend-application-repl 1.0.30 → 1.0.32

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 (48) hide show
  1. package/lib/application/LegendREPLNavigation.d.ts +20 -0
  2. package/lib/application/LegendREPLNavigation.d.ts.map +1 -0
  3. package/lib/application/LegendREPLNavigation.js +20 -0
  4. package/lib/application/LegendREPLNavigation.js.map +1 -0
  5. package/lib/components/LegendREPLApplication.d.ts.map +1 -1
  6. package/lib/components/LegendREPLApplication.js +9 -12
  7. package/lib/components/LegendREPLApplication.js.map +1 -1
  8. package/lib/components/LegendREPLDataCubeHeader.d.ts +22 -0
  9. package/lib/components/LegendREPLDataCubeHeader.d.ts.map +1 -0
  10. package/lib/components/LegendREPLDataCubeHeader.js +21 -0
  11. package/lib/components/LegendREPLDataCubeHeader.js.map +1 -0
  12. package/lib/components/LegendREPLFramworkProvider.d.ts +21 -0
  13. package/lib/components/LegendREPLFramworkProvider.d.ts.map +1 -0
  14. package/lib/components/LegendREPLFramworkProvider.js +31 -0
  15. package/lib/components/LegendREPLFramworkProvider.js.map +1 -0
  16. package/lib/components/LegendREPLPublishDataCubeAlert.d.ts +20 -0
  17. package/lib/components/LegendREPLPublishDataCubeAlert.d.ts.map +1 -0
  18. package/lib/components/LegendREPLPublishDataCubeAlert.js +36 -0
  19. package/lib/components/LegendREPLPublishDataCubeAlert.js.map +1 -0
  20. package/lib/index.css +1 -1
  21. package/lib/package.json +1 -1
  22. package/lib/stores/LegendREPLBaseStore.d.ts +31 -0
  23. package/lib/stores/LegendREPLBaseStore.d.ts.map +1 -0
  24. package/lib/stores/LegendREPLBaseStore.js +94 -0
  25. package/lib/stores/LegendREPLBaseStore.js.map +1 -0
  26. package/lib/stores/LegendREPLDataCubeEngine.d.ts +6 -6
  27. package/lib/stores/LegendREPLDataCubeEngine.d.ts.map +1 -1
  28. package/lib/stores/LegendREPLDataCubeEngine.js +43 -21
  29. package/lib/stores/LegendREPLDataCubeEngine.js.map +1 -1
  30. package/lib/stores/LegendREPLDataCubeSource.d.ts +4 -0
  31. package/lib/stores/LegendREPLDataCubeSource.d.ts.map +1 -1
  32. package/lib/stores/LegendREPLDataCubeSource.js +3 -0
  33. package/lib/stores/LegendREPLDataCubeSource.js.map +1 -1
  34. package/lib/stores/LegendREPLServerClient.d.ts +15 -11
  35. package/lib/stores/LegendREPLServerClient.d.ts.map +1 -1
  36. package/lib/stores/LegendREPLServerClient.js +22 -25
  37. package/lib/stores/LegendREPLServerClient.js.map +1 -1
  38. package/package.json +6 -6
  39. package/src/application/LegendREPLNavigation.ts +23 -0
  40. package/src/components/LegendREPLApplication.tsx +16 -35
  41. package/src/components/LegendREPLDataCubeHeader.tsx +53 -0
  42. package/src/components/LegendREPLFramworkProvider.tsx +62 -0
  43. package/src/components/LegendREPLPublishDataCubeAlert.tsx +103 -0
  44. package/src/stores/LegendREPLBaseStore.tsx +135 -0
  45. package/src/stores/LegendREPLDataCubeEngine.ts +60 -26
  46. package/src/stores/LegendREPLDataCubeSource.ts +5 -0
  47. package/src/stores/LegendREPLServerClient.ts +37 -41
  48. package/tsconfig.json +6 -1
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2020-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
+ /**
17
+ * @external_application_navigation This depends on Legend Data Cube routing and is hardcoded so it's potentially brittle
18
+ */
19
+ export declare const EXTERNAL_APPLICATION_NAVIGATION__generateDataCubeViewUrl: (hostedApplicationBaseUrl: string, id: string) => string;
20
+ //# sourceMappingURL=LegendREPLNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLNavigation.d.ts","sourceRoot":"","sources":["../../src/application/LegendREPLNavigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,eAAO,MAAM,wDAAwD,6BACzC,MAAM,MAC5B,MAAM,KACT,MAA6C,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2020-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
+ /**
17
+ * @external_application_navigation This depends on Legend Data Cube routing and is hardcoded so it's potentially brittle
18
+ */
19
+ export const EXTERNAL_APPLICATION_NAVIGATION__generateDataCubeViewUrl = (hostedApplicationBaseUrl, id) => `${hostedApplicationBaseUrl}/${id}`;
20
+ //# sourceMappingURL=LegendREPLNavigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLNavigation.js","sourceRoot":"","sources":["../../src/application/LegendREPLNavigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,wDAAwD,GAAG,CACtE,wBAAgC,EAChC,EAAU,EACF,EAAE,CAAC,GAAG,wBAAwB,IAAI,EAAE,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LegendREPLApplication.d.ts","sourceRoot":"","sources":["../../src/components/LegendREPLApplication.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAwGH,eAAO,MAAM,qCAAqC;;EAEhD,CAAC;AAEH,eAAO,MAAM,gBAAgB;;CAS3B,CAAC;AAEH,eAAO,MAAM,wBAAwB,UAAW;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,4CAUlE,CAAC"}
1
+ {"version":3,"file":"LegendREPLApplication.d.ts","sourceRoot":"","sources":["../../src/components/LegendREPLApplication.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqFH,eAAO,MAAM,qCAAqC;;EAEhD,CAAC;AAEH,eAAO,MAAM,gBAAgB;;CAS3B,CAAC;AAEH,eAAO,MAAM,wBAAwB,UAAW;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,4CAUlE,CAAC"}
@@ -17,21 +17,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
17
17
  import { BrowserEnvironmentProvider, Route, Routes, } from '@finos/legend-application/browser';
18
18
  import { observer } from 'mobx-react-lite';
19
19
  import { useEffect, useMemo } from 'react';
20
- import { formatDate, guaranteeNonNullable, LogEvent, NetworkClient, } from '@finos/legend-shared';
21
- import { LegendREPLServerClient } from '../stores/LegendREPLServerClient.js';
20
+ import { formatDate, LogEvent } from '@finos/legend-shared';
22
21
  import { LegendREPLDataCubeEngine } from '../stores/LegendREPLDataCubeEngine.js';
23
22
  import { DataCube, DataCubeSettingKey } from '@finos/legend-data-cube';
24
- import { APPLICATION_EVENT, ApplicationFrameworkProvider, useApplicationStore, } from '@finos/legend-application';
23
+ import { APPLICATION_EVENT } from '@finos/legend-application';
25
24
  import { LegendREPLDataCubeSource } from '../stores/LegendREPLDataCubeSource.js';
25
+ import { LegendREPLDataCubeHeader } from './LegendREPLDataCubeHeader.js';
26
+ import { LegendREPLFrameworkProvider, useLegendREPLBaseStore, } from './LegendREPLFramworkProvider.js';
26
27
  const LegendREPLDataCube = observer(() => {
27
- const application = useApplicationStore();
28
- const config = application.config;
29
- const engine = useMemo(() => new LegendREPLDataCubeEngine(application, new LegendREPLServerClient(new NetworkClient({
30
- baseUrl: config.useDynamicREPLServer
31
- ? window.location.origin +
32
- guaranteeNonNullable(config.baseAddress).replace('/repl/', '')
33
- : config.replUrl,
34
- }))), [application, config]);
28
+ const baseStore = useLegendREPLBaseStore();
29
+ const engine = useMemo(() => new LegendREPLDataCubeEngine(baseStore), [baseStore]);
30
+ const application = baseStore.application;
35
31
  useEffect(() => {
36
32
  engine.blockNavigation(
37
33
  // Only block navigation in production
@@ -57,6 +53,7 @@ const LegendREPLDataCube = observer(() => {
57
53
  gridClientRowBuffer: application.settingService.getNumericValue(DataCubeSettingKey.GRID_CLIENT_ROW_BUFFER),
58
54
  gridClientPurgeClosedRowNodes: application.settingService.getBooleanValue(DataCubeSettingKey.GRID_CLIENT_PURGE_CLOSED_ROW_NODES),
59
55
  gridClientSuppressLargeDatasetWarning: application.settingService.getBooleanValue(DataCubeSettingKey.GRID_CLIENT_SUPPRESS_LARGE_DATASET_WARNING),
56
+ innerHeaderComponent: (dataCube) => (_jsx(LegendREPLDataCubeHeader, { dataCube: dataCube })),
60
57
  } }));
61
58
  });
62
59
  export const LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN = Object.freeze({
@@ -65,6 +62,6 @@ export const LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN = Object.freeze({
65
62
  export const LegendREPLRouter = observer(() => (_jsx("div", { className: "h-full", children: _jsx(Routes, { children: _jsx(Route, { path: LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN.DATA_CUBE, element: _jsx(LegendREPLDataCube, {}) }) }) })));
66
63
  export const LegendREPLWebApplication = (props) => {
67
64
  const { baseUrl } = props;
68
- return (_jsx(BrowserEnvironmentProvider, { baseUrl: baseUrl, children: _jsx(ApplicationFrameworkProvider, { simple: true, children: _jsx(LegendREPLRouter, {}) }) }));
65
+ return (_jsx(BrowserEnvironmentProvider, { baseUrl: baseUrl, children: _jsx(LegendREPLFrameworkProvider, { children: _jsx(LegendREPLRouter, {}) }) }));
69
66
  };
70
67
  //# sourceMappingURL=LegendREPLApplication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LegendREPLApplication.js","sourceRoot":"","sources":["../../src/components/LegendREPLApplication.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,0BAA0B,EAC1B,KAAK,EACL,MAAM,GACP,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,mBAAmB,GAGpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,MAAM,kBAAkB,GAAG,QAAQ,CAAC,GAAG,EAAE;IACvC,MAAM,WAAW,GAAG,mBAAmB,EAGpC,CAAC;IACJ,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAClC,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CACH,IAAI,wBAAwB,CAC1B,WAAW,EACX,IAAI,sBAAsB,CACxB,IAAI,aAAa,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC,oBAAoB;YAClC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM;gBACtB,oBAAoB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;YAChE,CAAC,CAAC,MAAM,CAAC,OAAO;KACnB,CAAC,CACH,CACF,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B,GAAG,CAAC,KAA0B,EAAE,EAAE;IACrE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,OAAO,CACL,KAAC,0BAA0B,IAAC,OAAO,EAAE,OAAO,YAC1C,KAAC,2BAA2B,cAC1B,KAAC,gBAAgB,KAAG,GACQ,GACH,CAC9B,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) 2020-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 { DataCubeState } from '@finos/legend-data-cube';
17
+ export declare const LegendREPLDataCubeHeader: ((props: {
18
+ dataCube: DataCubeState;
19
+ }) => import("react/jsx-runtime").JSX.Element | null) & {
20
+ displayName: string;
21
+ };
22
+ //# sourceMappingURL=LegendREPLDataCubeHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLDataCubeHeader.d.ts","sourceRoot":"","sources":["../../src/components/LegendREPLDataCubeHeader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D,eAAO,MAAM,wBAAwB,WAC3B;IAAE,QAAQ,EAAE,aAAa,CAAA;CAAE;;CA8BpC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { observer } from 'mobx-react-lite';
3
+ import { LegendREPLDataCubeSource } from '../stores/LegendREPLDataCubeSource.js';
4
+ import { useLegendREPLBaseStore } from './LegendREPLFramworkProvider.js';
5
+ export const LegendREPLDataCubeHeader = observer((props) => {
6
+ const { dataCube } = props;
7
+ const store = useLegendREPLBaseStore();
8
+ if (!dataCube.view.isSourceProcessed || !store.queryServerBaseUrl) {
9
+ return null;
10
+ }
11
+ const isPublishAllowed = dataCube.view.source instanceof LegendREPLDataCubeSource &&
12
+ dataCube.view.source.isPersistenceSupported &&
13
+ // eslint-disable-next-line no-process-env
14
+ (process.env.NODE_ENV === 'development' || !dataCube.view.source.isLocal);
15
+ return (_jsx("div", { className: "flex h-full items-center", children: _jsx("button", { disabled: !isPublishAllowed || store.publishState.isInProgress, onClick: () => {
16
+ store
17
+ .publishDataCube(dataCube)
18
+ .catch((error) => dataCube.engine.logUnhandledError(error));
19
+ }, className: "h- w-20 border border-neutral-400 bg-neutral-300 px-2 hover:brightness-95 disabled:cursor-not-allowed disabled:border-neutral-300 disabled:text-neutral-400 disabled:hover:brightness-100", children: "Publish" }) }));
20
+ });
21
+ //# sourceMappingURL=LegendREPLDataCubeHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLDataCubeHeader.js","sourceRoot":"","sources":["../../src/components/LegendREPLDataCubeHeader.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAC9C,CAAC,KAAkC,EAAE,EAAE;IACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IAEvC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,gBAAgB,GACpB,QAAQ,CAAC,IAAI,CAAC,MAAM,YAAY,wBAAwB;QACxD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB;QAC3C,0CAA0C;QAC1C,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE5E,OAAO,CACL,cAAK,SAAS,EAAC,0BAA0B,YACvC,iBACE,QAAQ,EAAE,CAAC,gBAAgB,IAAI,KAAK,CAAC,YAAY,CAAC,YAAY,EAC9D,OAAO,EAAE,GAAG,EAAE;gBACZ,KAAK;qBACF,eAAe,CAAC,QAAQ,CAAC;qBACzB,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YAChE,CAAC,EACD,SAAS,EAAC,2LAA2L,wBAG9L,GACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2020-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 { LegendREPLBaseStore } from '../stores/LegendREPLBaseStore.js';
17
+ export declare const useLegendREPLBaseStore: () => LegendREPLBaseStore;
18
+ export declare const LegendREPLFrameworkProvider: React.FC<{
19
+ children: React.ReactNode;
20
+ }>;
21
+ //# sourceMappingURL=LegendREPLFramworkProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLFramworkProvider.d.ts","sourceRoot":"","sources":["../../src/components/LegendREPLFramworkProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AA+BvE,eAAO,MAAM,sBAAsB,QAAO,mBAIvC,CAAC;AAEJ,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAIA,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) 2020-present, Goldman Sachs
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { createContext, useContext } from 'react';
18
+ import { useLocalObservable } from 'mobx-react-lite';
19
+ import { LegendREPLBaseStore } from '../stores/LegendREPLBaseStore.js';
20
+ import { guaranteeNonNullable } from '@finos/legend-shared';
21
+ import {} from '../application/LegendREPLApplicationConfig.js';
22
+ import { useApplicationStore, ApplicationFrameworkProvider, } from '@finos/legend-application';
23
+ const LegendREPLBaseStoreContext = createContext(undefined);
24
+ const LegendREPLBaseStoreProvider = ({ children }) => {
25
+ const applicationStore = useApplicationStore();
26
+ const store = useLocalObservable(() => new LegendREPLBaseStore(applicationStore));
27
+ return (_jsx(LegendREPLBaseStoreContext.Provider, { value: store, children: children }));
28
+ };
29
+ export const useLegendREPLBaseStore = () => guaranteeNonNullable(useContext(LegendREPLBaseStoreContext), `Can't find Legend Query base store in context`);
30
+ export const LegendREPLFrameworkProvider = ({ children }) => (_jsx(ApplicationFrameworkProvider, { simple: true, children: _jsx(LegendREPLBaseStoreProvider, { children: children }) }));
31
+ //# sourceMappingURL=LegendREPLFramworkProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLFramworkProvider.js","sourceRoot":"","sources":["../../src/components/LegendREPLFramworkProvider.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAoC,MAAM,+CAA+C,CAAC;AACjG,OAAO,EACL,mBAAmB,EACnB,4BAA4B,GAG7B,MAAM,2BAA2B,CAAC;AAEnC,MAAM,0BAA0B,GAAG,aAAa,CAE9C,SAAS,CAAC,CAAC;AAEb,MAAM,2BAA2B,GAE5B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpB,MAAM,gBAAgB,GAAG,mBAAmB,EAGzC,CAAC;IACJ,MAAM,KAAK,GAAG,kBAAkB,CAC9B,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,gBAAgB,CAAC,CAChD,CAAC;IACF,OAAO,CACL,KAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC9C,QAAQ,GAC2B,CACvC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAwB,EAAE,CAC9D,oBAAoB,CAClB,UAAU,CAAC,0BAA0B,CAAC,EACtC,+CAA+C,CAChD,CAAC;AAEJ,MAAM,CAAC,MAAM,2BAA2B,GAEnC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,4BAA4B,IAAC,MAAM,EAAE,IAAI,YACxC,KAAC,2BAA2B,cAAE,QAAQ,GAA+B,GACxC,CAChC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2020-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 { PersistentDataCubeQuery } from '@finos/legend-graph';
17
+ export declare const LegendREPLPublishDataCubeAlert: (props: {
18
+ query: PersistentDataCubeQuery;
19
+ }) => import("react/jsx-runtime").JSX.Element;
20
+ //# sourceMappingURL=LegendREPLPublishDataCubeAlert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLPublishDataCubeAlert.d.ts","sourceRoot":"","sources":["../../src/components/LegendREPLPublishDataCubeAlert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAInE,eAAO,MAAM,8BAA8B,UAAW;IACpD,KAAK,EAAE,uBAAuB,CAAC;CAChC,4CA+EA,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) 2020-present, Goldman Sachs
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { useLegendREPLBaseStore } from './LegendREPLFramworkProvider.js';
18
+ import { EXTERNAL_APPLICATION_NAVIGATION__generateDataCubeViewUrl } from '../application/LegendREPLNavigation.js';
19
+ import { DataCubeIcon } from '@finos/legend-art';
20
+ export const LegendREPLPublishDataCubeAlert = (props) => {
21
+ const { query } = props;
22
+ const store = useLegendREPLBaseStore();
23
+ const link = store.hostedApplicationBaseUrl
24
+ ? EXTERNAL_APPLICATION_NAVIGATION__generateDataCubeViewUrl(store.hostedApplicationBaseUrl, query.id)
25
+ : undefined;
26
+ return (_jsxs("div", { className: "h-full w-full p-6", children: [_jsxs("div", { className: "flex w-full overflow-auto", children: [_jsx("div", { className: "mr-3", children: _jsx(DataCubeIcon.AlertInfo, { className: "flex-shrink-0 stroke-[0.5px] text-[40px] text-sky-500" }) }), _jsxs("div", { children: [_jsx("div", { className: "whitespace-break-spaces text-lg", children: "Published query successfully!" }), link && (_jsx("div", { className: "mt-1 whitespace-break-spaces text-neutral-500", children: "To view or share the published query, use the link below." })), !link && (_jsx("div", { className: "mt-1 whitespace-break-spaces text-neutral-500", children: "See the published query ID below." }))] })] }), link && (_jsxs("div", { className: "mt-3 flex h-6 w-full", children: [_jsx("div", { className: "flex h-full w-[calc(100%_-_20px)] items-center border border-r-0 border-neutral-400 bg-neutral-200 px-1.5", children: _jsx("a", { href: link, target: "_blank", rel: "noopener noreferrer", className: "overflow-hidden overflow-ellipsis whitespace-nowrap", children: link }) }), _jsx("button", { className: "flex aspect-square h-full w-6 items-center justify-center border border-neutral-400 bg-neutral-300 hover:brightness-95", onClick: () => {
27
+ store.application.clipboardService
28
+ .copyTextToClipboard(link)
29
+ .catch(store.application.alertUnhandledError);
30
+ }, title: "Copy Link", children: _jsx(DataCubeIcon.Clipboard, {}) })] })), !link && (_jsxs("div", { className: "mt-3 flex h-6 w-full", children: [_jsx("div", { className: "flex h-full w-[calc(100%_-_20px)] items-center border border-r-0 border-neutral-400 bg-neutral-200 px-1.5", children: _jsx("div", { className: "overflow-hidden overflow-ellipsis whitespace-nowrap", children: query.id }) }), _jsx("button", { className: "flex aspect-square h-full w-6 items-center justify-center border border-neutral-400 bg-neutral-300 hover:brightness-95", onClick: () => {
31
+ store.application.clipboardService
32
+ .copyTextToClipboard(query.id)
33
+ .catch(store.application.alertUnhandledError);
34
+ }, title: "Copy ID", children: _jsx(DataCubeIcon.Clipboard, {}) })] }))] }));
35
+ };
36
+ //# sourceMappingURL=LegendREPLPublishDataCubeAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLPublishDataCubeAlert.js","sourceRoot":"","sources":["../../src/components/LegendREPLPublishDataCubeAlert.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,wDAAwD,EAAE,MAAM,wCAAwC,CAAC;AAClH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,KAE9C,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,wBAAwB;QACzC,CAAC,CAAC,wDAAwD,CACtD,KAAK,CAAC,wBAAwB,EAC9B,KAAK,CAAC,EAAE,CACT;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,CACL,eAAK,SAAS,EAAC,mBAAmB,aAChC,eAAK,SAAS,EAAC,2BAA2B,aACxC,cAAK,SAAS,EAAC,MAAM,YACnB,KAAC,YAAY,CAAC,SAAS,IAAC,SAAS,EAAC,uDAAuD,GAAG,GACxF,EACN,0BACE,cAAK,SAAS,EAAC,iCAAiC,8CAE1C,EACL,IAAI,IAAI,CACP,cAAK,SAAS,EAAC,+CAA+C,0EAExD,CACP,EACA,CAAC,IAAI,IAAI,CACR,cAAK,SAAS,EAAC,+CAA+C,kDAExD,CACP,IACG,IACF,EACL,IAAI,IAAI,CACP,eAAK,SAAS,EAAC,sBAAsB,aACnC,cAAK,SAAS,EAAC,2GAA2G,YACxH,YACE,IAAI,EAAE,IAAI,EACV,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,qDAAqD,YAE9D,IAAI,GACH,GACA,EACN,iBACE,SAAS,EAAC,wHAAwH,EAClI,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,CAAC,WAAW,CAAC,gBAAgB;iCAC/B,mBAAmB,CAAC,IAAI,CAAC;iCACzB,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;wBAClD,CAAC,EACD,KAAK,EAAC,WAAW,YAEjB,KAAC,YAAY,CAAC,SAAS,KAAG,GACnB,IACL,CACP,EACA,CAAC,IAAI,IAAI,CACR,eAAK,SAAS,EAAC,sBAAsB,aACnC,cAAK,SAAS,EAAC,2GAA2G,YACxH,cAAK,SAAS,EAAC,qDAAqD,YACjE,KAAK,CAAC,EAAE,GACL,GACF,EACN,iBACE,SAAS,EAAC,wHAAwH,EAClI,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,CAAC,WAAW,CAAC,gBAAgB;iCAC/B,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;iCAC7B,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;wBAClD,CAAC,EACD,KAAK,EAAC,SAAS,YAEf,KAAC,YAAY,CAAC,SAAS,KAAG,GACnB,IACL,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
package/lib/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /** @license @finos/legend-application-repl v1.0.30
1
+ /** @license @finos/legend-application-repl v1.0.32
2
2
  * Copyright (c) 2020-present, Goldman Sachs
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application-repl",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Legend REPL Grid client application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) 2020-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 { ActionState } from '@finos/legend-shared';
17
+ import type { LegendREPLApplicationStore } from '../application/LegendREPLApplicationStore.js';
18
+ import { LegendREPLServerClient } from './LegendREPLServerClient.js';
19
+ import { type DataCubeState } from '@finos/legend-data-cube';
20
+ export declare class LegendREPLBaseStore {
21
+ readonly application: LegendREPLApplicationStore;
22
+ readonly client: LegendREPLServerClient;
23
+ readonly publishState: ActionState;
24
+ sourceQuery?: string | undefined;
25
+ currentUser?: string | undefined;
26
+ queryServerBaseUrl?: string | undefined;
27
+ hostedApplicationBaseUrl?: string | undefined;
28
+ constructor(application: LegendREPLApplicationStore);
29
+ publishDataCube(dataCube: DataCubeState): Promise<void>;
30
+ }
31
+ //# sourceMappingURL=LegendREPLBaseStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLBaseStore.d.ts","sourceRoot":"","sources":["../../src/stores/LegendREPLBaseStore.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,WAAW,EAKZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAKjC,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,YAAY,cAAwB;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;gBAElC,WAAW,EAAE,0BAA0B;IAe7C,eAAe,CAAC,QAAQ,EAAE,aAAa;CAyE9C"}
@@ -0,0 +1,94 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) 2020-present, Goldman Sachs
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ActionState, NetworkClient, assertErrorThrown, guaranteeNonNullable, uuid, } from '@finos/legend-shared';
18
+ import { LegendREPLServerClient } from './LegendREPLServerClient.js';
19
+ import { DataCubeConfiguration, DataCubeQuery, LayoutConfiguration, WindowState, } from '@finos/legend-data-cube';
20
+ import { LegendREPLDataCubeSource } from './LegendREPLDataCubeSource.js';
21
+ import { PersistentDataCubeQuery } from '@finos/legend-graph';
22
+ import { LegendREPLPublishDataCubeAlert } from '../components/LegendREPLPublishDataCubeAlert.js';
23
+ export class LegendREPLBaseStore {
24
+ application;
25
+ client;
26
+ publishState = ActionState.create();
27
+ sourceQuery;
28
+ currentUser;
29
+ queryServerBaseUrl;
30
+ hostedApplicationBaseUrl;
31
+ constructor(application) {
32
+ this.application = application;
33
+ this.client = new LegendREPLServerClient(new NetworkClient({
34
+ baseUrl: application.config.useDynamicREPLServer
35
+ ? window.location.origin +
36
+ guaranteeNonNullable(application.config.baseAddress).replace('/repl/', '')
37
+ : application.config.replUrl,
38
+ }));
39
+ }
40
+ async publishDataCube(dataCube) {
41
+ const isPublishAllowed = dataCube.view.source instanceof LegendREPLDataCubeSource &&
42
+ dataCube.view.source.isPersistenceSupported &&
43
+ // eslint-disable-next-line no-process-env
44
+ (process.env.NODE_ENV === 'development' || !dataCube.view.source.isLocal);
45
+ if (!this.sourceQuery ||
46
+ !dataCube.view.isSourceProcessed ||
47
+ !this.queryServerBaseUrl ||
48
+ !isPublishAllowed) {
49
+ return;
50
+ }
51
+ this.publishState.inProgress();
52
+ const task = dataCube.view.newTask('Validate query');
53
+ try {
54
+ const query = new DataCubeQuery();
55
+ query.query = await dataCube.engine.getValueSpecificationCode(dataCube.engine.generateInitialQuery(dataCube.view.snapshotManager.currentSnapshot));
56
+ query.source = {
57
+ // TODO: I can't think of a better name for now, but this form should be
58
+ // moved to the common module potentially
59
+ _type: 'basicQuery',
60
+ query: this.sourceQuery,
61
+ runtime: dataCube.view.source.runtime,
62
+ columns: dataCube.view.source.sourceColumns,
63
+ model: dataCube.view.source.model,
64
+ };
65
+ const newQuery = new PersistentDataCubeQuery();
66
+ newQuery.id = uuid();
67
+ newQuery.name = DataCubeConfiguration.serialization.fromJson(dataCube.view.snapshotManager.currentSnapshot.data.configuration).name;
68
+ newQuery.content = DataCubeQuery.serialization.toJson(query);
69
+ newQuery.owner = this.currentUser;
70
+ const publishedQuery = PersistentDataCubeQuery.serialization.fromJson(await this.client.publishQuery(PersistentDataCubeQuery.serialization.toJson(newQuery), this.queryServerBaseUrl));
71
+ const window = new WindowState(new LayoutConfiguration('Publish Query', () => (_jsx(LegendREPLPublishDataCubeAlert, { query: publishedQuery }))));
72
+ window.configuration.window = {
73
+ width: 420,
74
+ height: 150,
75
+ minWidth: 300,
76
+ minHeight: 100,
77
+ center: true,
78
+ };
79
+ dataCube.engine.layout.newWindow(window);
80
+ }
81
+ catch (error) {
82
+ assertErrorThrown(error);
83
+ dataCube.view.engine.alertError(error, {
84
+ message: `Persistence Failure: Can't publish query.`,
85
+ text: `Error: ${error.message}`,
86
+ });
87
+ }
88
+ finally {
89
+ dataCube.view.endTask(task);
90
+ this.publishState.complete();
91
+ }
92
+ }
93
+ }
94
+ //# sourceMappingURL=LegendREPLBaseStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendREPLBaseStore.js","sourceRoot":"","sources":["../../src/stores/LegendREPLBaseStore.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,IAAI,GACL,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,WAAW,GAEZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAEjG,MAAM,OAAO,mBAAmB;IACrB,WAAW,CAA6B;IACxC,MAAM,CAAyB;IAC/B,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;IAE7C,WAAW,CAAsB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;gBAC5B,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;gBACX,QAAQ,EAAE,GAAG;gBACb,SAAS,EAAE,GAAG;gBACd,MAAM,EAAE,IAAI;aACb,CAAC;YACF,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE;gBACrC,OAAO,EAAE,2CAA2C;gBACpD,IAAI,EAAE,UAAU,KAAK,CAAC,OAAO,EAAE;aAChC,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
@@ -14,25 +14,25 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { type LegendREPLServerClient } from './LegendREPLServerClient.js';
17
- import { DataCubeEngine, type DataCubeAPI, type DataCubeSource } from '@finos/legend-data-cube';
17
+ import { DataCubeEngine, type DataCubeSource, type DataCubeAPI, DataCubeQuery } from '@finos/legend-data-cube';
18
18
  import { TDSExecutionResult, type V1_AppliedFunction, type V1_Lambda, type V1_ValueSpecification } from '@finos/legend-graph';
19
19
  import { type DocumentationEntry, LogEvent, type PlainObject } from '@finos/legend-shared';
20
20
  import { LegendREPLDataCubeSource } from './LegendREPLDataCubeSource.js';
21
21
  import type { LegendREPLApplicationStore } from '../application/LegendREPLApplicationStore.js';
22
+ import type { LegendREPLBaseStore } from './LegendREPLBaseStore.js';
22
23
  export declare class LegendREPLDataCubeEngine extends DataCubeEngine {
23
24
  readonly application: LegendREPLApplicationStore;
25
+ readonly baseStore: LegendREPLBaseStore;
24
26
  readonly client: LegendREPLServerClient;
25
- constructor(application: LegendREPLApplicationStore, client: LegendREPLServerClient);
27
+ constructor(baseStore: LegendREPLBaseStore);
26
28
  blockNavigation(blockCheckers: (() => boolean)[], onBlock?: ((onProceed: () => void) => void) | undefined, onNativePlatformNavigationBlock?: (() => void) | undefined): void;
27
29
  unblockNavigation(): void;
28
30
  persistSettingValue(key: string, value: string | number | boolean | object | undefined): void;
29
31
  fetchConfiguration(): Promise<{
30
32
  gridClientLicense: string | undefined;
31
33
  }>;
32
- getInitialInput(): Promise<{
33
- query: import("@finos/legend-data-cube").DataCubeQuery;
34
- source: LegendREPLDataCubeSource;
35
- }>;
34
+ getBaseQuery(): Promise<DataCubeQuery>;
35
+ processQuerySource(value: PlainObject): Promise<LegendREPLDataCubeSource>;
36
36
  parseValueSpecification(code: string, returnSourceInformation?: boolean): Promise<V1_ValueSpecification>;
37
37
  getValueSpecificationCode(value: V1_ValueSpecification, pretty?: boolean): Promise<string>;
38
38
  getQueryTypeahead(code: string, baseQuery: V1_Lambda, source: DataCubeSource): Promise<import("@finos/legend-data-cube").CompletionItem[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"LegendREPLDataCubeEngine.d.ts","sourceRoot":"","sources":["../../src/stores/LegendREPLDataCubeEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAIL,cAAc,EAEd,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,EAKvB,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,kBAAkB,EAGvB,QAAQ,EACR,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,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AkBT,qBAAqB,CAC5B,MAAM,EAAE,cAAc,GACrB,kBAAkB,GAAG,SAAS;IAaxB,mBAAmB,IAAI,MAAM,GAAG,SAAS;IAIzC,qBAAqB,CAAC,GAAG,EAAE,MAAM;IAIjC,+BAA+B,CAAC,KAAK,EAAE,kBAAkB;IAIzD,QAAQ,CAAC,GAAG,EAAE,MAAM;IAIpB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;IAI9C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAQ5C,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAS9D,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI3C,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI9C,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAI9B,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAO7D"}
@@ -13,19 +13,21 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { GetBaseQueryResult, } from './LegendREPLServerClient.js';
17
- import { _elementPtr, _function, _lambda, DataCubeEngine, DataCubeFunction, } from '@finos/legend-data-cube';
18
- import { TDSExecutionResult, V1_buildExecutionResult, V1_deserializeValueSpecification, V1_serializeExecutionResult, V1_serializeValueSpecification, } from '@finos/legend-graph';
19
- import { guaranteeType, isNonNullable, LogEvent, } from '@finos/legend-shared';
16
+ import { deserializeREPLQuerySource, REPL_DATA_CUBE_SOURCE_TYPE, } from './LegendREPLServerClient.js';
17
+ import { _elementPtr, _function, _lambda, DataCubeEngine, DataCubeFunction, DataCubeQuery, } from '@finos/legend-data-cube';
18
+ import { TDSExecutionResult, V1_buildExecutionResult, V1_deserializeValueSpecification, V1_serializeExecutionResult, V1_serializeValueSpecification, V1_buildEngineError, V1_EngineError, } from '@finos/legend-graph';
19
+ import { assertErrorThrown, guaranteeType, HttpStatus, isNonNullable, LogEvent, NetworkClientError, } from '@finos/legend-shared';
20
20
  import { LegendREPLDataCubeSource } from './LegendREPLDataCubeSource.js';
21
21
  import { APPLICATION_EVENT, shouldDisplayVirtualAssistantDocumentationEntry, } from '@finos/legend-application';
22
22
  export class LegendREPLDataCubeEngine extends DataCubeEngine {
23
23
  application;
24
+ baseStore;
24
25
  client;
25
- constructor(application, client) {
26
+ constructor(baseStore) {
26
27
  super();
27
- this.application = application;
28
- this.client = client;
28
+ this.application = baseStore.application;
29
+ this.baseStore = baseStore;
30
+ this.client = baseStore.client;
29
31
  }
30
32
  blockNavigation(blockCheckers, onBlock, onNativePlatformNavigationBlock) {
31
33
  this.application.navigationService.navigator.blockNavigation(blockCheckers, onBlock, onNativePlatformNavigationBlock);
@@ -39,22 +41,32 @@ export class LegendREPLDataCubeEngine extends DataCubeEngine {
39
41
  // ---------------------------------- IMPLEMENTATION ----------------------------------
40
42
  async fetchConfiguration() {
41
43
  const info = await this.client.getInfrastructureInfo();
44
+ this.baseStore.currentUser = info.currentUser;
45
+ this.baseStore.queryServerBaseUrl = info.queryServerBaseUrl;
46
+ this.baseStore.hostedApplicationBaseUrl = info.hostedApplicationBaseUrl;
42
47
  return {
43
48
  gridClientLicense: info.gridClientLicense,
44
49
  };
45
50
  }
46
- async getInitialInput() {
47
- const baseQuery = GetBaseQueryResult.serialization.fromJson(await this.client.getBaseQuery());
51
+ async getBaseQuery() {
52
+ return DataCubeQuery.serialization.fromJson(await this.client.getBaseQuery());
53
+ }
54
+ async processQuerySource(value) {
55
+ const _source = deserializeREPLQuerySource(value);
56
+ this.baseStore.sourceQuery = _source.query;
57
+ if (value._type !== REPL_DATA_CUBE_SOURCE_TYPE) {
58
+ throw new Error(`Can't process query source of type '${value._type}'. Only type '${REPL_DATA_CUBE_SOURCE_TYPE}' is supported.`);
59
+ }
48
60
  const source = new LegendREPLDataCubeSource();
49
- source.mapping = baseQuery.source.mapping;
50
- source.query = await this.parseValueSpecification(baseQuery.source.query, false);
51
- source.runtime = baseQuery.source.runtime;
52
- source.timestamp = baseQuery.source.timestamp;
61
+ source.query = await this.parseValueSpecification(_source.query, false);
53
62
  source.sourceColumns = (await this.getQueryRelationType(_lambda([], [source.query]), source)).columns;
54
- return {
55
- query: baseQuery.query,
56
- source,
57
- };
63
+ source.runtime = _source.runtime;
64
+ source.mapping = _source.mapping;
65
+ source.timestamp = _source.timestamp;
66
+ source.model = _source.model;
67
+ source.isLocal = _source.isLocal;
68
+ source.isPersistenceSupported = _source.isPersistenceSupported;
69
+ return source;
58
70
  }
59
71
  async parseValueSpecification(code, returnSourceInformation) {
60
72
  return V1_deserializeValueSpecification(await this.client.parseValueSpecification({
@@ -80,10 +92,20 @@ export class LegendREPLDataCubeEngine extends DataCubeEngine {
80
92
  });
81
93
  }
82
94
  async getQueryCodeRelationReturnType(code, baseQuery, source) {
83
- return this.client.getQueryCodeRelationReturnType({
84
- code,
85
- baseQuery: V1_serializeValueSpecification(baseQuery, []),
86
- });
95
+ try {
96
+ return await this.client.getQueryCodeRelationReturnType({
97
+ code,
98
+ baseQuery: V1_serializeValueSpecification(baseQuery, []),
99
+ });
100
+ }
101
+ catch (error) {
102
+ assertErrorThrown(error);
103
+ if (error instanceof NetworkClientError &&
104
+ error.response.status === HttpStatus.BAD_REQUEST) {
105
+ throw V1_buildEngineError(V1_EngineError.serialization.fromJson(error.payload));
106
+ }
107
+ throw error;
108
+ }
87
109
  }
88
110
  async executeQuery(query, source, api) {
89
111
  const result = await this.client.executeQuery({