@finos/legend-application-repl 1.0.34 → 1.0.36

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 (56) hide show
  1. package/lib/__lib__/LegendREPLSetting.d.ts +2 -5
  2. package/lib/__lib__/LegendREPLSetting.d.ts.map +1 -1
  3. package/lib/__lib__/LegendREPLSetting.js +4 -7
  4. package/lib/__lib__/LegendREPLSetting.js.map +1 -1
  5. package/lib/application/LegendREPL.js +1 -1
  6. package/lib/application/LegendREPL.js.map +1 -1
  7. package/lib/application/LegendREPLNavigation.d.ts +1 -1
  8. package/lib/application/LegendREPLNavigation.js +1 -1
  9. package/lib/components/LegendREPLDataCubeHeader.d.ts +2 -4
  10. package/lib/components/LegendREPLDataCubeHeader.d.ts.map +1 -1
  11. package/lib/components/LegendREPLDataCubeHeader.js +25 -9
  12. package/lib/components/LegendREPLDataCubeHeader.js.map +1 -1
  13. package/lib/components/LegendREPLFramworkProvider.d.ts.map +1 -1
  14. package/lib/components/LegendREPLFramworkProvider.js +2 -2
  15. package/lib/components/LegendREPLFramworkProvider.js.map +1 -1
  16. package/lib/components/LegendREPLPublishDataCubeAlert.js +1 -1
  17. package/lib/components/LegendREPLPublishDataCubeAlert.js.map +1 -1
  18. package/lib/components/{LegendREPLApplication.d.ts → LegendREPLWebApplication.d.ts} +1 -1
  19. package/lib/components/LegendREPLWebApplication.d.ts.map +1 -0
  20. package/lib/components/LegendREPLWebApplication.js +84 -0
  21. package/lib/components/LegendREPLWebApplication.js.map +1 -0
  22. package/lib/index.css +1 -1
  23. package/lib/package.json +1 -1
  24. package/lib/stores/LegendREPLBaseStore.d.ts +15 -6
  25. package/lib/stores/LegendREPLBaseStore.d.ts.map +1 -1
  26. package/lib/stores/LegendREPLBaseStore.js +75 -33
  27. package/lib/stores/LegendREPLBaseStore.js.map +1 -1
  28. package/lib/stores/LegendREPLDataCubeEngine.d.ts +16 -22
  29. package/lib/stores/LegendREPLDataCubeEngine.d.ts.map +1 -1
  30. package/lib/stores/LegendREPLDataCubeEngine.js +89 -88
  31. package/lib/stores/LegendREPLDataCubeEngine.js.map +1 -1
  32. package/lib/stores/LegendREPLDataCubeSource.d.ts +14 -2
  33. package/lib/stores/LegendREPLDataCubeSource.d.ts.map +1 -1
  34. package/lib/stores/LegendREPLDataCubeSource.js +24 -0
  35. package/lib/stores/LegendREPLDataCubeSource.js.map +1 -1
  36. package/lib/stores/LegendREPLServerClient.d.ts +5 -17
  37. package/lib/stores/LegendREPLServerClient.d.ts.map +1 -1
  38. package/lib/stores/LegendREPLServerClient.js +1 -26
  39. package/lib/stores/LegendREPLServerClient.js.map +1 -1
  40. package/package.json +6 -6
  41. package/src/__lib__/LegendREPLSetting.ts +2 -5
  42. package/src/application/LegendREPL.tsx +1 -1
  43. package/src/application/LegendREPLNavigation.ts +1 -1
  44. package/src/components/LegendREPLDataCubeHeader.tsx +15 -12
  45. package/src/components/LegendREPLFramworkProvider.tsx +2 -4
  46. package/src/components/LegendREPLPublishDataCubeAlert.tsx +1 -1
  47. package/src/components/LegendREPLWebApplication.tsx +157 -0
  48. package/src/stores/LegendREPLBaseStore.tsx +104 -40
  49. package/src/stores/LegendREPLDataCubeEngine.ts +135 -139
  50. package/src/stores/LegendREPLDataCubeSource.ts +35 -2
  51. package/src/stores/LegendREPLServerClient.ts +3 -39
  52. package/tsconfig.json +1 -1
  53. package/lib/components/LegendREPLApplication.d.ts.map +0 -1
  54. package/lib/components/LegendREPLApplication.js +0 -67
  55. package/lib/components/LegendREPLApplication.js.map +0 -1
  56. package/src/components/LegendREPLApplication.tsx +0 -125
@@ -14,11 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import {
18
- deserializeREPLQuerySource,
19
- REPL_DATA_CUBE_SOURCE_TYPE,
20
- type LegendREPLServerClient,
21
- } from './LegendREPLServerClient.js';
17
+ import { type LegendREPLServerClient } from './LegendREPLServerClient.js';
22
18
  import {
23
19
  _elementPtr,
24
20
  _function,
@@ -26,168 +22,147 @@ import {
26
22
  DataCubeEngine,
27
23
  DataCubeFunction,
28
24
  type DataCubeSource,
29
- type DataCubeAPI,
30
- DataCubeQuery,
25
+ type DataCubeExecutionOptions,
26
+ _deserializeValueSpecification,
27
+ _serializeValueSpecification,
31
28
  } from '@finos/legend-data-cube';
32
29
  import {
33
30
  TDSExecutionResult,
34
31
  type V1_AppliedFunction,
35
32
  V1_buildExecutionResult,
36
- V1_deserializeValueSpecification,
37
- V1_serializeExecutionResult,
38
- V1_serializeValueSpecification,
33
+ V1_deserializeExecutionResult,
39
34
  type V1_Lambda,
40
35
  type V1_ValueSpecification,
41
36
  V1_buildEngineError,
42
37
  V1_EngineError,
38
+ V1_getGenericTypeFullPath,
39
+ V1_relationTypeModelSchema,
43
40
  } from '@finos/legend-graph';
44
41
  import {
45
42
  assertErrorThrown,
46
- type DocumentationEntry,
47
43
  guaranteeType,
48
44
  HttpStatus,
49
45
  isNonNullable,
50
46
  LogEvent,
51
47
  NetworkClientError,
52
48
  type PlainObject,
49
+ UnsupportedOperationError,
53
50
  } from '@finos/legend-shared';
54
- import { LegendREPLDataCubeSource } from './LegendREPLDataCubeSource.js';
55
- import type { LegendREPLApplicationStore } from '../application/LegendREPLApplicationStore.js';
56
51
  import {
57
- APPLICATION_EVENT,
58
- shouldDisplayVirtualAssistantDocumentationEntry,
59
- } from '@finos/legend-application';
60
- import type { LegendREPLBaseStore } from './LegendREPLBaseStore.js';
52
+ LegendREPLDataCubeSource,
53
+ RawLegendREPLDataCubeSource,
54
+ REPL_DATA_CUBE_SOURCE_TYPE,
55
+ } from './LegendREPLDataCubeSource.js';
56
+ import type { LegendREPLApplicationStore } from '../application/LegendREPLApplicationStore.js';
57
+ import { APPLICATION_EVENT } from '@finos/legend-application';
58
+ import { deserialize } from 'serializr';
61
59
 
62
60
  export class LegendREPLDataCubeEngine extends DataCubeEngine {
63
- readonly application: LegendREPLApplicationStore;
64
- readonly baseStore: LegendREPLBaseStore;
65
- readonly client: LegendREPLServerClient;
66
-
67
- constructor(baseStore: LegendREPLBaseStore) {
68
- super();
69
-
70
- this.application = baseStore.application;
71
- this.baseStore = baseStore;
72
- this.client = baseStore.client;
73
- }
61
+ private readonly _application: LegendREPLApplicationStore;
62
+ private readonly _client: LegendREPLServerClient;
74
63
 
75
- blockNavigation(
76
- blockCheckers: (() => boolean)[],
77
- onBlock?: ((onProceed: () => void) => void) | undefined,
78
- onNativePlatformNavigationBlock?: (() => void) | undefined,
64
+ constructor(
65
+ application: LegendREPLApplicationStore,
66
+ client: LegendREPLServerClient,
79
67
  ) {
80
- this.application.navigationService.navigator.blockNavigation(
81
- blockCheckers,
82
- onBlock,
83
- onNativePlatformNavigationBlock,
84
- );
85
- }
86
-
87
- unblockNavigation() {
88
- this.application.navigationService.navigator.unblockNavigation();
89
- }
68
+ super();
90
69
 
91
- persistSettingValue(
92
- key: string,
93
- value: string | number | boolean | object | undefined,
94
- ): void {
95
- this.application.settingService.persistValue(key, value);
70
+ this._application = application;
71
+ this._client = client;
96
72
  }
97
73
 
98
74
  // ---------------------------------- IMPLEMENTATION ----------------------------------
99
75
 
100
- override async fetchConfiguration() {
101
- const info = await this.client.getInfrastructureInfo();
102
- this.baseStore.currentUser = info.currentUser;
103
- this.baseStore.queryServerBaseUrl = info.queryServerBaseUrl;
104
- this.baseStore.hostedApplicationBaseUrl = info.hostedApplicationBaseUrl;
105
- return {
106
- gridClientLicense: info.gridClientLicense,
107
- };
108
- }
109
-
110
- async getBaseQuery() {
111
- return DataCubeQuery.serialization.fromJson(
112
- await this.client.getBaseQuery(),
113
- );
114
- }
115
-
116
- async processQuerySource(value: PlainObject) {
117
- const _source = deserializeREPLQuerySource(value);
118
- this.baseStore.sourceQuery = _source.query;
119
- if (value._type !== REPL_DATA_CUBE_SOURCE_TYPE) {
120
- throw new Error(
121
- `Can't process query source of type '${value._type}'. Only type '${REPL_DATA_CUBE_SOURCE_TYPE}' is supported.`,
122
- );
76
+ override async processQuerySource(value: PlainObject) {
77
+ switch (value._type) {
78
+ case REPL_DATA_CUBE_SOURCE_TYPE: {
79
+ const rawSource =
80
+ RawLegendREPLDataCubeSource.serialization.fromJson(value);
81
+ const source = new LegendREPLDataCubeSource();
82
+ source.query = await this.parseValueSpecification(
83
+ rawSource.query,
84
+ false,
85
+ );
86
+ try {
87
+ source.columns = (
88
+ await this._getQueryRelationType(_lambda([], [source.query]))
89
+ ).columns;
90
+ } catch (error) {
91
+ assertErrorThrown(error);
92
+ throw new Error(
93
+ `Can't get query result columns. Make sure the source query return a relation (i.e. typed TDS). Error: ${error.message}`,
94
+ );
95
+ }
96
+ source.runtime = rawSource.runtime;
97
+
98
+ source.mapping = rawSource.mapping;
99
+ source.timestamp = rawSource.timestamp;
100
+ source.model = rawSource.model;
101
+ source.isLocal = rawSource.isLocal;
102
+ source.isPersistenceSupported = rawSource.isPersistenceSupported;
103
+
104
+ return source;
105
+ }
106
+ default: {
107
+ throw new UnsupportedOperationError(
108
+ `Can't process query source of type '${value._type}'.`,
109
+ );
110
+ }
123
111
  }
124
-
125
- const source = new LegendREPLDataCubeSource();
126
- source.query = await this.parseValueSpecification(_source.query, false);
127
- source.sourceColumns = (
128
- await this.getQueryRelationType(_lambda([], [source.query]), source)
129
- ).columns;
130
- source.runtime = _source.runtime;
131
-
132
- source.mapping = _source.mapping;
133
- source.timestamp = _source.timestamp;
134
- source.model = _source.model;
135
- source.isLocal = _source.isLocal;
136
- source.isPersistenceSupported = _source.isPersistenceSupported;
137
-
138
- return source;
139
112
  }
140
113
 
141
- async parseValueSpecification(
114
+ override async parseValueSpecification(
142
115
  code: string,
143
116
  returnSourceInformation?: boolean,
144
117
  ) {
145
- return V1_deserializeValueSpecification(
146
- await this.client.parseValueSpecification({
118
+ return _deserializeValueSpecification(
119
+ await this._client.parseValueSpecification({
147
120
  code,
148
121
  returnSourceInformation,
149
122
  }),
150
- [],
151
123
  );
152
124
  }
153
125
 
154
- override getValueSpecificationCode(
126
+ override async getValueSpecificationCode(
155
127
  value: V1_ValueSpecification,
156
128
  pretty?: boolean,
157
129
  ) {
158
- return this.client.getValueSpecificationCode({
159
- value: V1_serializeValueSpecification(value, []),
130
+ return this._client.getValueSpecificationCode({
131
+ value: _serializeValueSpecification(value),
160
132
  pretty,
161
133
  });
162
134
  }
163
135
 
164
- async getQueryTypeahead(
136
+ override async getQueryTypeahead(
165
137
  code: string,
166
138
  baseQuery: V1_Lambda,
167
139
  source: DataCubeSource,
168
140
  ) {
169
- return this.client.getQueryTypeahead({
141
+ return this._client.getQueryTypeahead({
170
142
  code,
171
- baseQuery: V1_serializeValueSpecification(baseQuery, []),
143
+ baseQuery: _serializeValueSpecification(baseQuery),
172
144
  });
173
145
  }
174
146
 
175
- async getQueryRelationType(query: V1_Lambda, source: DataCubeSource) {
176
- return this.client.getQueryRelationReturnType({
177
- query: V1_serializeValueSpecification(query, []),
178
- });
179
- }
180
-
181
- async getQueryCodeRelationReturnType(
147
+ override async getQueryCodeRelationReturnType(
182
148
  code: string,
183
149
  baseQuery: V1_ValueSpecification,
184
150
  source: DataCubeSource,
185
151
  ) {
186
152
  try {
187
- return await this.client.getQueryCodeRelationReturnType({
188
- code,
189
- baseQuery: V1_serializeValueSpecification(baseQuery, []),
190
- });
153
+ const relationType = deserialize(
154
+ V1_relationTypeModelSchema,
155
+ await this._client.getQueryCodeRelationReturnType({
156
+ code,
157
+ baseQuery: _serializeValueSpecification(baseQuery),
158
+ }),
159
+ );
160
+ return {
161
+ columns: relationType.columns.map((column) => ({
162
+ name: column.name,
163
+ type: V1_getGenericTypeFullPath(column.genericType),
164
+ })),
165
+ };
191
166
  } catch (error) {
192
167
  assertErrorThrown(error);
193
168
  if (
@@ -204,19 +179,19 @@ export class LegendREPLDataCubeEngine extends DataCubeEngine {
204
179
  }
205
180
  }
206
181
 
207
- async executeQuery(
182
+ override async executeQuery(
208
183
  query: V1_Lambda,
209
184
  source: DataCubeSource,
210
- api: DataCubeAPI,
185
+ options?: DataCubeExecutionOptions | undefined,
211
186
  ) {
212
- const result = await this.client.executeQuery({
213
- query: V1_serializeValueSpecification(query, []),
214
- debug: api.getSettings().enableDebugMode,
187
+ const result = await this._client.executeQuery({
188
+ query: _serializeValueSpecification(query),
189
+ debug: options?.debug,
215
190
  });
216
191
  return {
217
192
  result: guaranteeType(
218
193
  V1_buildExecutionResult(
219
- V1_serializeExecutionResult(JSON.parse(result.result)),
194
+ V1_deserializeExecutionResult(JSON.parse(result.result)),
220
195
  ),
221
196
  TDSExecutionResult,
222
197
  ),
@@ -240,28 +215,27 @@ export class LegendREPLDataCubeEngine extends DataCubeEngine {
240
215
  return undefined;
241
216
  }
242
217
 
243
- override getDocumentationURL(): string | undefined {
244
- return this.application.documentationService.url;
245
- }
246
-
247
- override getDocumentationEntry(key: string) {
248
- return this.application.documentationService.getDocEntry(key);
249
- }
218
+ // ---------------------------------- UTILITIES ----------------------------------
250
219
 
251
- override shouldDisplayDocumentationEntry(entry: DocumentationEntry) {
252
- return shouldDisplayVirtualAssistantDocumentationEntry(entry);
253
- }
254
-
255
- override openLink(url: string) {
256
- this.application.navigationService.navigator.visitAddress(url);
220
+ private async _getQueryRelationType(query: V1_Lambda) {
221
+ const relationType = deserialize(
222
+ V1_relationTypeModelSchema,
223
+ await this._client.getQueryRelationReturnType({
224
+ query: _serializeValueSpecification(query),
225
+ }),
226
+ );
227
+ return {
228
+ columns: relationType.columns.map((column) => ({
229
+ name: column.name,
230
+ type: V1_getGenericTypeFullPath(column.genericType),
231
+ })),
232
+ };
257
233
  }
258
234
 
259
- override sendTelemetry(event: string, data: PlainObject) {
260
- this.application.telemetryService.logEvent(event, data);
261
- }
235
+ // ---------------------------------- APPLICATION ----------------------------------
262
236
 
263
237
  override logDebug(message: string, ...data: unknown[]) {
264
- this.application.logService.debug(
238
+ this._application.logService.debug(
265
239
  LogEvent.create(APPLICATION_EVENT.DEBUG),
266
240
  message,
267
241
  ...data,
@@ -269,28 +243,38 @@ export class LegendREPLDataCubeEngine extends DataCubeEngine {
269
243
  }
270
244
 
271
245
  override debugProcess(processName: string, ...data: [string, unknown][]) {
272
- this.application.logService.debug(
273
- LogEvent.create(APPLICATION_EVENT.DEBUG),
274
- `\n------ START DEBUG PROCESS: ${processName} ------`,
275
- ...data.flatMap(([key, value]) => [`\n[${key.toUpperCase()}]:`, value]),
276
- `\n------- END DEBUG PROCESS: ${processName} -------\n\n`,
277
- );
246
+ // eslint-disable-next-line no-process-env
247
+ if (process.env.NODE_ENV === 'development') {
248
+ this._application.logService.info(
249
+ LogEvent.create(APPLICATION_EVENT.DEBUG),
250
+ `\n------ START DEBUG PROCESS: ${processName} ------`,
251
+ ...data.flatMap(([key, value]) => [`\n[${key.toUpperCase()}]:`, value]),
252
+ `\n------- END DEBUG PROCESS: ${processName} -------\n\n`,
253
+ );
254
+ } else {
255
+ this._application.logService.debug(
256
+ LogEvent.create(APPLICATION_EVENT.DEBUG),
257
+ `\n------ START DEBUG PROCESS: ${processName} ------`,
258
+ ...data.flatMap(([key, value]) => [`\n[${key.toUpperCase()}]:`, value]),
259
+ `\n------- END DEBUG PROCESS: ${processName} -------\n\n`,
260
+ );
261
+ }
278
262
  }
279
263
 
280
264
  override logInfo(event: LogEvent, ...data: unknown[]) {
281
- this.application.logService.info(event, ...data);
265
+ this._application.logService.info(event, ...data);
282
266
  }
283
267
 
284
268
  override logWarning(event: LogEvent, ...data: unknown[]) {
285
- this.application.logService.warn(event, ...data);
269
+ this._application.logService.warn(event, ...data);
286
270
  }
287
271
 
288
272
  override logError(event: LogEvent, ...data: unknown[]) {
289
- this.application.logService.error(event, ...data);
273
+ this._application.logService.error(event, ...data);
290
274
  }
291
275
 
292
276
  override logUnhandledError(error: Error) {
293
- this.application.logUnhandledError(error);
277
+ this._application.logUnhandledError(error);
294
278
  }
295
279
 
296
280
  override logIllegalStateError(message: string, error?: Error) {
@@ -300,4 +284,16 @@ export class LegendREPLDataCubeEngine extends DataCubeEngine {
300
284
  error,
301
285
  );
302
286
  }
287
+
288
+ override getDocumentationEntry(key: string) {
289
+ return this._application.documentationService.getDocEntry(key);
290
+ }
291
+
292
+ override openLink(url: string) {
293
+ this._application.navigationService.navigator.visitAddress(url);
294
+ }
295
+
296
+ override sendTelemetry(event: string, data: PlainObject) {
297
+ this._application.telemetryService.logEvent(event, data);
298
+ }
303
299
  }
@@ -14,8 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { DataCubeSource } from '@finos/legend-data-cube';
18
- import type { PlainObject } from '@finos/legend-shared';
17
+ import { DataCubeSource, type DataCubeColumn } from '@finos/legend-data-cube';
18
+ import {
19
+ SerializationFactory,
20
+ usingConstantValueSchema,
21
+ type PlainObject,
22
+ } from '@finos/legend-shared';
23
+ import { createModelSchema, list, optional, primitive, raw } from 'serializr';
19
24
 
20
25
  export class LegendREPLDataCubeSource extends DataCubeSource {
21
26
  runtime!: string;
@@ -26,3 +31,31 @@ export class LegendREPLDataCubeSource extends DataCubeSource {
26
31
  isLocal!: boolean;
27
32
  isPersistenceSupported!: boolean;
28
33
  }
34
+
35
+ export const REPL_DATA_CUBE_SOURCE_TYPE = 'repl';
36
+
37
+ export class RawLegendREPLDataCubeSource {
38
+ query!: string;
39
+ runtime!: string;
40
+ model?: PlainObject | undefined;
41
+
42
+ mapping?: string | undefined;
43
+ timestamp!: number;
44
+ isLocal!: boolean;
45
+ isPersistenceSupported!: boolean;
46
+ columns: DataCubeColumn[] = [];
47
+
48
+ static readonly serialization = new SerializationFactory(
49
+ createModelSchema(RawLegendREPLDataCubeSource, {
50
+ _type: usingConstantValueSchema(REPL_DATA_CUBE_SOURCE_TYPE),
51
+ columns: list(raw()),
52
+ isLocal: primitive(),
53
+ isPersistenceSupported: primitive(),
54
+ mapping: optional(primitive()),
55
+ model: optional(raw()),
56
+ query: primitive(),
57
+ runtime: primitive(),
58
+ timestamp: primitive(),
59
+ }),
60
+ );
61
+ }
@@ -18,22 +18,19 @@ import {
18
18
  ContentType,
19
19
  guaranteeNonNullable,
20
20
  HttpHeader,
21
- SerializationFactory,
22
- usingConstantValueSchema,
23
21
  type NetworkClient,
24
22
  type PlainObject,
25
23
  } from '@finos/legend-shared';
26
24
  import {
27
25
  type DataCubeQuery,
28
26
  type CompletionItem,
29
- type RelationType,
30
27
  } from '@finos/legend-data-cube';
31
28
  import {
29
+ type V1_RelationType,
32
30
  type PersistentDataCubeQuery,
33
31
  type V1_Lambda,
34
32
  type V1_ValueSpecification,
35
33
  } from '@finos/legend-graph';
36
- import { createModelSchema, optional, primitive, raw } from 'serializr';
37
34
 
38
35
  type GetValueSpecificationCodeInput = {
39
36
  value: PlainObject<V1_ValueSpecification>;
@@ -77,39 +74,6 @@ type InfrastructureInfo = {
77
74
  hostedApplicationBaseUrl?: string | undefined;
78
75
  };
79
76
 
80
- export const REPL_DATA_CUBE_SOURCE_TYPE = 'repl';
81
-
82
- class REPLBaseDataCubeQuerySource {
83
- query!: string;
84
- runtime!: string;
85
- model?: PlainObject | undefined;
86
-
87
- mapping?: string | undefined;
88
- timestamp!: number;
89
- isLocal!: boolean;
90
- isPersistenceSupported!: boolean;
91
- // columns // we don't need this analytics, we will get this from the query directly
92
-
93
- static readonly serialization = new SerializationFactory(
94
- createModelSchema(REPLBaseDataCubeQuerySource, {
95
- _type: usingConstantValueSchema(REPL_DATA_CUBE_SOURCE_TYPE),
96
- isLocal: primitive(),
97
- isPersistenceSupported: primitive(),
98
- mapping: optional(primitive()),
99
- model: optional(raw()),
100
- query: primitive(),
101
- runtime: primitive(),
102
- timestamp: primitive(),
103
- }),
104
- );
105
- }
106
-
107
- export function deserializeREPLQuerySource(
108
- value: PlainObject<REPLBaseDataCubeQuerySource>,
109
- ) {
110
- return REPLBaseDataCubeQuerySource.serialization.fromJson(value);
111
- }
112
-
113
77
  export class LegendREPLServerClient {
114
78
  private readonly networkClient: NetworkClient;
115
79
 
@@ -164,7 +128,7 @@ export class LegendREPLServerClient {
164
128
 
165
129
  async getQueryRelationReturnType(
166
130
  input: GetQueryRelationReturnTypeInput,
167
- ): Promise<RelationType> {
131
+ ): Promise<PlainObject<V1_RelationType>> {
168
132
  return this.networkClient.post(
169
133
  `${this.dataCube}/getRelationReturnType`,
170
134
  input,
@@ -173,7 +137,7 @@ export class LegendREPLServerClient {
173
137
 
174
138
  async getQueryCodeRelationReturnType(
175
139
  input: GetQueryCodeRelationReturnTypeInput,
176
- ): Promise<RelationType> {
140
+ ): Promise<PlainObject<V1_RelationType>> {
177
141
  return this.networkClient.post(
178
142
  `${this.dataCube}/getRelationReturnType/code`,
179
143
  input,
package/tsconfig.json CHANGED
@@ -60,10 +60,10 @@
60
60
  "./src/stores/LegendREPLServerClient.ts",
61
61
  "./src/index.tsx",
62
62
  "./src/application/LegendREPL.tsx",
63
- "./src/components/LegendREPLApplication.tsx",
64
63
  "./src/components/LegendREPLDataCubeHeader.tsx",
65
64
  "./src/components/LegendREPLFramworkProvider.tsx",
66
65
  "./src/components/LegendREPLPublishDataCubeAlert.tsx",
66
+ "./src/components/LegendREPLWebApplication.tsx",
67
67
  "./src/stores/LegendREPLBaseStore.tsx"
68
68
  ],
69
69
  "include": [
@@ -1 +0,0 @@
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"}
@@ -1,67 +0,0 @@
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 { BrowserEnvironmentProvider, Route, Routes, } from '@finos/legend-application/browser';
18
- import { observer } from 'mobx-react-lite';
19
- import { useEffect, useMemo } from 'react';
20
- import { formatDate, LogEvent } from '@finos/legend-shared';
21
- import { LegendREPLDataCubeEngine } from '../stores/LegendREPLDataCubeEngine.js';
22
- import { DataCube, DataCubeSettingKey } from '@finos/legend-data-cube';
23
- import { APPLICATION_EVENT } from '@finos/legend-application';
24
- import { LegendREPLDataCubeSource } from '../stores/LegendREPLDataCubeSource.js';
25
- import { LegendREPLDataCubeHeader } from './LegendREPLDataCubeHeader.js';
26
- import { LegendREPLFrameworkProvider, useLegendREPLBaseStore, } from './LegendREPLFramworkProvider.js';
27
- const LegendREPLDataCube = observer(() => {
28
- const baseStore = useLegendREPLBaseStore();
29
- const engine = useMemo(() => new LegendREPLDataCubeEngine(baseStore), [baseStore]);
30
- const application = baseStore.application;
31
- useEffect(() => {
32
- engine.blockNavigation(
33
- // Only block navigation in production
34
- // eslint-disable-next-line no-process-env
35
- [() => process.env.NODE_ENV === 'production'], undefined, () => {
36
- engine.logWarning(LogEvent.create(APPLICATION_EVENT.NAVIGATION_BLOCKED), `Navigation from the application is blocked`);
37
- });
38
- return () => {
39
- engine.unblockNavigation();
40
- };
41
- }, [engine]);
42
- return (_jsx(DataCube, { engine: engine, options: {
43
- onNameChanged(name, source) {
44
- const timestamp = source instanceof LegendREPLDataCubeSource
45
- ? source.timestamp
46
- : undefined;
47
- application.layoutService.setWindowTitle(`\u229E ${name}${timestamp ? ` - ${formatDate(new Date(timestamp), 'HH:mm:ss EEE MMM dd yyyy')}` : ''}`);
48
- },
49
- onSettingChanged(key, value) {
50
- engine.persistSettingValue(key, value);
51
- },
52
- enableDebugMode: application.settingService.getBooleanValue(DataCubeSettingKey.ENABLE_DEBUG_MODE),
53
- gridClientRowBuffer: application.settingService.getNumericValue(DataCubeSettingKey.GRID_CLIENT_ROW_BUFFER),
54
- gridClientPurgeClosedRowNodes: application.settingService.getBooleanValue(DataCubeSettingKey.GRID_CLIENT_PURGE_CLOSED_ROW_NODES),
55
- gridClientSuppressLargeDatasetWarning: application.settingService.getBooleanValue(DataCubeSettingKey.GRID_CLIENT_SUPPRESS_LARGE_DATASET_WARNING),
56
- innerHeaderComponent: (dataCube) => (_jsx(LegendREPLDataCubeHeader, { dataCube: dataCube })),
57
- } }));
58
- });
59
- export const LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN = Object.freeze({
60
- DATA_CUBE: `/dataCube`,
61
- });
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, {}) }) }) })));
63
- export const LegendREPLWebApplication = (props) => {
64
- const { baseUrl } = props;
65
- return (_jsx(BrowserEnvironmentProvider, { baseUrl: baseUrl, children: _jsx(LegendREPLFrameworkProvider, { children: _jsx(LegendREPLRouter, {}) }) }));
66
- };
67
- //# sourceMappingURL=LegendREPLApplication.js.map
@@ -1 +0,0 @@
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,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,kBA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