@finos/legend-graph 31.10.65 → 32.0.0

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 (86) hide show
  1. package/lib/graph/helpers/ValueSpecificationHelper.d.ts +2 -2
  2. package/lib/graph/helpers/ValueSpecificationHelper.d.ts.map +1 -1
  3. package/lib/graph/helpers/ValueSpecificationHelper.js +4 -4
  4. package/lib/graph/helpers/ValueSpecificationHelper.js.map +1 -1
  5. package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_Relation.d.ts → Relation.d.ts} +2 -2
  6. package/lib/graph/metamodel/pure/packageableElements/relation/Relation.d.ts.map +1 -0
  7. package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_Relation.js → Relation.js} +2 -2
  8. package/lib/graph/metamodel/pure/packageableElements/relation/Relation.js.map +1 -0
  9. package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_RelationType.d.ts → RelationType.d.ts} +4 -4
  10. package/lib/graph/metamodel/pure/packageableElements/relation/RelationType.d.ts.map +1 -0
  11. package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_RelationType.js → RelationType.js} +3 -3
  12. package/lib/graph/metamodel/pure/packageableElements/relation/RelationType.js.map +1 -0
  13. package/lib/graph-manager/AbstractPureGraphManager.d.ts +5 -2
  14. package/lib/graph-manager/AbstractPureGraphManager.d.ts.map +1 -1
  15. package/lib/graph-manager/AbstractPureGraphManager.js.map +1 -1
  16. package/lib/graph-manager/action/query/PersistentDataCubeQuery.d.ts +11 -0
  17. package/lib/graph-manager/action/query/PersistentDataCubeQuery.d.ts.map +1 -1
  18. package/lib/graph-manager/action/query/PersistentDataCubeQuery.js +21 -0
  19. package/lib/graph-manager/action/query/PersistentDataCubeQuery.js.map +1 -1
  20. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +5 -2
  21. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  22. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +19 -11
  23. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
  24. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts +1 -0
  25. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts.map +1 -1
  26. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.js +5 -1
  27. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.js.map +1 -1
  28. package/lib/graph-manager/protocol/pure/v1/engine/V1_GraphManagerEngine.d.ts +10 -7
  29. package/lib/graph-manager/protocol/pure/v1/engine/V1_GraphManagerEngine.d.ts.map +1 -1
  30. package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.d.ts +10 -7
  31. package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.d.ts.map +1 -1
  32. package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.js +31 -20
  33. package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.js.map +1 -1
  34. package/lib/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.d.ts +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.d.ts.map +1 -1
  36. package/lib/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.js.map +1 -1
  37. package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.d.ts +1 -1
  38. package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.d.ts.map +1 -1
  39. package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.js +1 -1
  40. package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.js.map +1 -1
  41. package/lib/graph-manager/protocol/pure/v1/helpers/V1_DomainHelper.js +2 -2
  42. package/lib/graph-manager/protocol/pure/v1/helpers/V1_DomainHelper.js.map +1 -1
  43. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.d.ts +3 -4
  44. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.d.ts.map +1 -1
  45. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.js +7 -11
  46. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.js.map +1 -1
  47. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.js +2 -2
  48. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.js.map +1 -1
  49. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js +2 -2
  50. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js.map +1 -1
  51. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.js +4 -4
  52. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.d.ts +4 -2
  53. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.d.ts.map +1 -1
  54. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js +49 -38
  55. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js.map +1 -1
  56. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js +3 -3
  57. package/lib/index.d.ts +7 -6
  58. package/lib/index.d.ts.map +1 -1
  59. package/lib/index.js +7 -6
  60. package/lib/index.js.map +1 -1
  61. package/lib/package.json +1 -1
  62. package/package.json +3 -3
  63. package/src/graph/helpers/ValueSpecificationHelper.ts +5 -5
  64. package/src/graph/metamodel/pure/packageableElements/relation/{Relation_Relation.ts → Relation.ts} +1 -1
  65. package/src/graph/metamodel/pure/packageableElements/relation/{Relation_RelationType.ts → RelationType.ts} +5 -3
  66. package/src/graph-manager/AbstractPureGraphManager.ts +15 -3
  67. package/src/graph-manager/action/query/PersistentDataCubeQuery.ts +30 -0
  68. package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +42 -13
  69. package/src/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.ts +8 -0
  70. package/src/graph-manager/protocol/pure/v1/engine/V1_GraphManagerEngine.ts +24 -9
  71. package/src/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.ts +66 -22
  72. package/src/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.ts +1 -1
  73. package/src/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.ts +1 -1
  74. package/src/graph-manager/protocol/pure/v1/helpers/V1_DomainHelper.ts +2 -2
  75. package/src/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.ts +8 -24
  76. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.ts +2 -2
  77. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.ts +2 -2
  78. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.ts +4 -4
  79. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.ts +70 -52
  80. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.ts +3 -3
  81. package/src/index.ts +15 -8
  82. package/tsconfig.json +2 -2
  83. package/lib/graph/metamodel/pure/packageableElements/relation/Relation_Relation.d.ts.map +0 -1
  84. package/lib/graph/metamodel/pure/packageableElements/relation/Relation_Relation.js.map +0 -1
  85. package/lib/graph/metamodel/pure/packageableElements/relation/Relation_RelationType.d.ts.map +0 -1
  86. package/lib/graph/metamodel/pure/packageableElements/relation/Relation_RelationType.js.map +0 -1
@@ -91,7 +91,10 @@ import type { RelationTypeMetadata } from '../../../../action/relation/RelationT
91
91
  import type { V1_CompleteCodeInput } from './compilation/V1_CompleteCodeInput.js';
92
92
  import type { CodeCompletionResult } from '../../../../action/compilation/Completion.js';
93
93
  import type { DeploymentResult } from '../../../../action/DeploymentResult.js';
94
- import type { PersistentDataCubeQuery } from '../../../../action/query/PersistentDataCubeQuery.js';
94
+ import type {
95
+ LightPersistentDataCubeQuery,
96
+ PersistentDataCubeQuery,
97
+ } from '../../../../action/query/PersistentDataCubeQuery.js';
95
98
 
96
99
  export interface V1_GraphManagerEngine {
97
100
  config: TEMPORARY__AbstractEngineConfig;
@@ -106,12 +109,12 @@ export interface V1_GraphManagerEngine {
106
109
 
107
110
  // ------------------------------------------- Grammar -------------------------------------------
108
111
 
109
- pureModelContextDataToPureCode: (
112
+ transformPureModelContextDataToCode: (
110
113
  graph: V1_PureModelContextData,
111
114
  pretty: boolean,
112
115
  ) => Promise<string>;
113
116
 
114
- pureCodeToPureModelContextData: (
117
+ transformCodeToPureModelContextData: (
115
118
  code: string,
116
119
  options?: {
117
120
  sourceInformationIndex?: Map<string, V1_SourceInformation> | undefined;
@@ -125,22 +128,22 @@ export interface V1_GraphManagerEngine {
125
128
  plugins: PureProtocolProcessorPlugin[],
126
129
  ) => Promise<Map<string, string>>;
127
130
 
128
- transformValueSpecsToCode: (
131
+ transformValueSpecificationsToCode: (
129
132
  input: Record<string, PlainObject<V1_ValueSpecification>>,
130
133
  pretty: boolean,
131
134
  ) => Promise<Map<string, string>>;
132
135
 
133
- transformValueSpecToCode: (
136
+ transformValueSpecificationToCode: (
134
137
  input: PlainObject<V1_ValueSpecification>,
135
138
  pretty: boolean,
136
139
  ) => Promise<string>;
137
140
 
138
- transformCodeToValueSpeces: (
141
+ transformCodeToValueSpecifications: (
139
142
  input: Record<string, V1_GrammarParserBatchInputEntry>,
140
143
  ) => Promise<Map<string, PlainObject>>;
141
144
 
142
- transformCodeToValueSpec: (
143
- input: string,
145
+ transformCodeToValueSpecification: (
146
+ code: string,
144
147
  returnSourceInformation?: boolean,
145
148
  ) => Promise<PlainObject<V1_ValueSpecification>>;
146
149
 
@@ -338,7 +341,15 @@ export interface V1_GraphManagerEngine {
338
341
 
339
342
  getCurrentUserId: () => string | undefined;
340
343
 
341
- // ------------------------------------------- Data Cube Querys -------------------------------------------
344
+ // ------------------------------------------- DataCube Query -------------------------------------------
345
+
346
+ searchDataCubeQueries: (
347
+ searchSpecification: V1_QuerySearchSpecification,
348
+ ) => Promise<LightPersistentDataCubeQuery[]>;
349
+
350
+ getDataCubeQueries: (
351
+ queryIds: string[],
352
+ ) => Promise<LightPersistentDataCubeQuery[]>;
342
353
 
343
354
  getDataCubeQuery: (id: string) => Promise<PersistentDataCubeQuery>;
344
355
 
@@ -346,6 +357,10 @@ export interface V1_GraphManagerEngine {
346
357
  query: PersistentDataCubeQuery,
347
358
  ) => Promise<PersistentDataCubeQuery>;
348
359
 
360
+ updateDataCubeQuery: (
361
+ query: PersistentDataCubeQuery,
362
+ ) => Promise<PersistentDataCubeQuery>;
363
+
349
364
  deleteDataCubeQuery: (id: string) => Promise<void>;
350
365
 
351
366
  // ------------------------------------------ Analysis ------------------------------------------
@@ -127,7 +127,7 @@ import {
127
127
  import type { V1_SourceInformation } from '../model/V1_SourceInformation.js';
128
128
  import { V1_INTERNAL__PackageableElementWithSourceInformation } from '../transformation/pureProtocol/serializationHelpers/V1_CoreSerializationHelper.js';
129
129
  import { ELEMENT_PATH_DELIMITER } from '../../../../../graph/MetaModelConst.js';
130
- import { V1_serializeExecutionResult } from './execution/V1_ExecutionHelper.js';
130
+ import { V1_deserializeExecutionResult } from './execution/V1_ExecutionHelper.js';
131
131
  import type {
132
132
  ClassifierPathMapping,
133
133
  SubtypeInfo,
@@ -154,7 +154,7 @@ import { V1_RelationalConnectionBuilder } from './relational/V1_RelationalConnec
154
154
  import type { PostValidationAssertionResult } from '../../../../../DSL_Service_Exports.js';
155
155
  import { V1_DebugTestsResult } from './test/V1_DebugTestsResult.js';
156
156
  import type { V1_GraphManagerEngine } from './V1_GraphManagerEngine.js';
157
- import { V1_RelationType } from '../model/packageableElements/type/V1_RelationType.js';
157
+ import { type V1_RelationType } from '../model/packageableElements/type/V1_RelationType.js';
158
158
  import {
159
159
  RelationTypeColumnMetadata,
160
160
  RelationTypeMetadata,
@@ -162,7 +162,12 @@ import {
162
162
  import { V1_CompleteCodeInput } from './compilation/V1_CompleteCodeInput.js';
163
163
  import { CodeCompletionResult } from '../../../../action/compilation/Completion.js';
164
164
  import { DeploymentResult } from '../../../../action/DeploymentResult.js';
165
- import { PersistentDataCubeQuery } from '../../../../action/query/PersistentDataCubeQuery.js';
165
+ import {
166
+ LightPersistentDataCubeQuery,
167
+ PersistentDataCubeQuery,
168
+ } from '../../../../action/query/PersistentDataCubeQuery.js';
169
+ import { V1_getGenericTypeFullPath } from '../helpers/V1_DomainHelper.js';
170
+ import { V1_relationTypeModelSchema } from '../transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js';
166
171
 
167
172
  class V1_RemoteEngineConfig extends TEMPORARY__AbstractEngineConfig {
168
173
  private engine: V1_RemoteEngine;
@@ -329,7 +334,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
329
334
  return sourceInformationIndex;
330
335
  }
331
336
 
332
- pureModelContextDataToPureCode(
337
+ transformPureModelContextDataToCode(
333
338
  graph: V1_PureModelContextData,
334
339
  pretty: boolean,
335
340
  ): Promise<string> {
@@ -339,7 +344,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
339
344
  );
340
345
  }
341
346
 
342
- async pureCodeToPureModelContextData(
347
+ async transformCodeToPureModelContextData(
343
348
  code: string,
344
349
  options?: {
345
350
  sourceInformationIndex?: Map<string, V1_SourceInformation> | undefined;
@@ -413,7 +418,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
413
418
  );
414
419
  }
415
420
 
416
- async transformValueSpecsToCode(
421
+ async transformValueSpecificationsToCode(
417
422
  input: Record<string, PlainObject<V1_ValueSpecification>>,
418
423
  pretty: boolean,
419
424
  ): Promise<Map<string, string>> {
@@ -426,7 +431,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
426
431
  );
427
432
  }
428
433
 
429
- async transformValueSpecToCode(
434
+ async transformValueSpecificationToCode(
430
435
  input: PlainObject<V1_ValueSpecification>,
431
436
  pretty: boolean,
432
437
  ): Promise<string> {
@@ -437,7 +442,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
437
442
  return code;
438
443
  }
439
444
 
440
- async transformCodeToValueSpeces(
445
+ async transformCodeToValueSpecifications(
441
446
  input: Record<string, V1_GrammarParserBatchInputEntry>,
442
447
  ): Promise<Map<string, PlainObject>> {
443
448
  const batchResults =
@@ -454,7 +459,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
454
459
  return finalResults;
455
460
  }
456
461
 
457
- async transformCodeToValueSpec(
462
+ async transformCodeToValueSpecification(
458
463
  input: string,
459
464
  returnSourceInformation?: boolean,
460
465
  ): Promise<PlainObject<V1_ValueSpecification>> {
@@ -720,27 +725,32 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
720
725
  async getLambdaRelationTypeFromRawInput(
721
726
  rawInput: V1_LambdaReturnTypeInput,
722
727
  ): Promise<RelationTypeMetadata> {
723
- const res = V1_RelationType.serialization.fromJson(
728
+ const result = deserialize(
729
+ V1_relationTypeModelSchema,
724
730
  (await this.engineServerClient.lambdaRelationType(
725
731
  V1_LambdaReturnTypeInput.serialization.toJson(rawInput),
726
732
  )) as unknown as PlainObject<V1_RelationType>,
727
733
  );
728
- const result = new RelationTypeMetadata();
729
- result.columns = res.columns.map(
730
- (e) => new RelationTypeColumnMetadata(e.type, e.name),
734
+ const relationType = new RelationTypeMetadata();
735
+ relationType.columns = result.columns.map(
736
+ (column) =>
737
+ new RelationTypeColumnMetadata(
738
+ V1_getGenericTypeFullPath(column.genericType),
739
+ column.name,
740
+ ),
731
741
  );
732
- return result;
742
+ return relationType;
733
743
  }
734
744
 
735
745
  async getCodeCompletion(
736
746
  rawInput: V1_CompleteCodeInput,
737
747
  ): Promise<CodeCompletionResult> {
738
- const res = CodeCompletionResult.serialization.fromJson(
748
+ const result = CodeCompletionResult.serialization.fromJson(
739
749
  (await this.engineServerClient.completeCode(
740
750
  V1_CompleteCodeInput.serialization.toJson(rawInput),
741
751
  )) as unknown as PlainObject<CodeCompletionResult>,
742
752
  );
743
- return res;
753
+ return result;
744
754
  }
745
755
 
746
756
  // --------------------------------------------- Execution ---------------------------------------------
@@ -763,7 +773,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
763
773
  returnUndefOnError(() =>
764
774
  this.parseExecutionResults(executionResultInText, options),
765
775
  ) ?? executionResultInText;
766
- const executionResult = V1_serializeExecutionResult(rawExecutionResult);
776
+ const executionResult = V1_deserializeExecutionResult(rawExecutionResult);
767
777
  const executionTraceId = executionResultMap.get(V1_ZIPKIN_TRACE_HEADER);
768
778
  if (executionTraceId) {
769
779
  return { executionResult, executionTraceId };
@@ -989,7 +999,10 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
989
999
  // from the front end to engine would take up a lot of bandwidth.
990
1000
  const textModel = new V1_PureModelContextText();
991
1001
  textModel.serializer = model.serializer;
992
- textModel.code = await this.pureModelContextDataToPureCode(model, false);
1002
+ textModel.code = await this.transformPureModelContextDataToCode(
1003
+ model,
1004
+ false,
1005
+ );
993
1006
  return (
994
1007
  await this.engineServerClient.generateFile(
995
1008
  generationMode,
@@ -1108,12 +1121,12 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
1108
1121
  await this.engineServerClient.searchQueries(
1109
1122
  V1_QuerySearchSpecification.serialization.toJson(searchSpecification),
1110
1123
  )
1111
- ).map((v) => V1_LightQuery.serialization.fromJson(v));
1124
+ ).map((query) => V1_LightQuery.serialization.fromJson(query));
1112
1125
  }
1113
1126
 
1114
1127
  async getQueries(queryIds: string[]): Promise<V1_LightQuery[]> {
1115
- return (await this.engineServerClient.getQueries(queryIds)).map((v) =>
1116
- V1_LightQuery.serialization.fromJson(v),
1128
+ return (await this.engineServerClient.getQueries(queryIds)).map((query) =>
1129
+ V1_LightQuery.serialization.fromJson(query),
1117
1130
  );
1118
1131
  }
1119
1132
 
@@ -1159,7 +1172,27 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
1159
1172
  broadcastToCluster,
1160
1173
  );
1161
1174
  }
1162
- // ------------------------------------------ Query Data Cube ------------------------------------------
1175
+ // ------------------------------------------ QueryData Cube ------------------------------------------
1176
+
1177
+ async searchDataCubeQueries(
1178
+ searchSpecification: V1_QuerySearchSpecification,
1179
+ ): Promise<LightPersistentDataCubeQuery[]> {
1180
+ return (
1181
+ await this.engineServerClient.searchDataCubeQueries(
1182
+ V1_QuerySearchSpecification.serialization.toJson(searchSpecification),
1183
+ )
1184
+ ).map((query) =>
1185
+ LightPersistentDataCubeQuery.serialization.fromJson(query),
1186
+ );
1187
+ }
1188
+
1189
+ async getDataCubeQueries(
1190
+ queryIds: string[],
1191
+ ): Promise<LightPersistentDataCubeQuery[]> {
1192
+ return (await this.engineServerClient.getDataCubeQueries(queryIds)).map(
1193
+ (query) => LightPersistentDataCubeQuery.serialization.fromJson(query),
1194
+ );
1195
+ }
1163
1196
 
1164
1197
  async getDataCubeQuery(id: string): Promise<PersistentDataCubeQuery> {
1165
1198
  return PersistentDataCubeQuery.serialization.fromJson(
@@ -1177,6 +1210,17 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
1177
1210
  );
1178
1211
  }
1179
1212
 
1213
+ async updateDataCubeQuery(
1214
+ query: PersistentDataCubeQuery,
1215
+ ): Promise<PersistentDataCubeQuery> {
1216
+ return PersistentDataCubeQuery.serialization.fromJson(
1217
+ await this.engineServerClient.updateDataCubeQuery(
1218
+ query.id,
1219
+ PersistentDataCubeQuery.serialization.toJson(query),
1220
+ ),
1221
+ );
1222
+ }
1223
+
1180
1224
  async deleteDataCubeQuery(queryId: string): Promise<void> {
1181
1225
  await this.engineServerClient.deleteDataCubeQuery(queryId);
1182
1226
  }
@@ -22,7 +22,7 @@ import { V1_pureModelContextPropSchema } from '../../transformation/pureProtocol
22
22
  export class V1_CompleteCodeInput {
23
23
  model!: V1_PureModelContext;
24
24
  codeBlock!: string;
25
- offset: number | undefined;
25
+ offset?: number | undefined;
26
26
 
27
27
  constructor(
28
28
  codeBlock: string,
@@ -168,7 +168,7 @@ export const V1_buildExecutionResult = (
168
168
  throw new UnsupportedOperationError(`Can't build execution result`, protocol);
169
169
  };
170
170
 
171
- export const V1_serializeExecutionResult = (
171
+ export const V1_deserializeExecutionResult = (
172
172
  json: PlainObject<V1_ExecutionResult> | string | null | boolean | number,
173
173
  ): V1_ExecutionResult => {
174
174
  if (json === null || isString(json) || isNumber(json) || isBoolean(json)) {
@@ -36,7 +36,7 @@ export const V1_getGenericTypeFullPath = (val: V1_GenericType): string => {
36
36
  return val.rawType.fullPath;
37
37
  }
38
38
  throw new UnsupportedOperationError(
39
- 'Failed to get full path from generic type',
39
+ `Can't extract type path from generic type`,
40
40
  );
41
41
  };
42
42
 
@@ -152,6 +152,6 @@ export function V1_createRelationTypeColumn(
152
152
  ): V1_RelationTypeColumn {
153
153
  const column = new V1_RelationTypeColumn();
154
154
  column.name = name;
155
- column.type = type;
155
+ column.genericType = V1_createGenericTypeWithElementPath(type);
156
156
  return column;
157
157
  }
@@ -14,43 +14,27 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import {
18
- hashArray,
19
- SerializationFactory,
20
- usingModelSchema,
21
- type Hashable,
22
- } from '@finos/legend-shared';
23
- import { createModelSchema, list, primitive } from 'serializr';
17
+ import { hashArray, type Hashable } from '@finos/legend-shared';
24
18
  import type { V1_Type } from './V1_Type.js';
25
19
  import { CORE_HASH_STRUCTURE } from '../../../../../../../graph/Core_HashUtils.js';
20
+ import type { V1_GenericType } from './V1_GenericType.js';
26
21
 
27
22
  export class V1_RelationTypeColumn implements Hashable {
28
23
  name!: string;
29
- type!: string;
30
-
31
- static readonly serialization = new SerializationFactory(
32
- createModelSchema(V1_RelationTypeColumn, {
33
- name: primitive(),
34
- type: primitive(),
35
- }),
36
- );
24
+ genericType!: V1_GenericType;
37
25
 
38
26
  get hashCode(): string {
39
- return hashArray([CORE_HASH_STRUCTURE.RELATION_TYPE, this.name, this.type]);
27
+ return hashArray([
28
+ CORE_HASH_STRUCTURE.RELATION_TYPE,
29
+ this.name,
30
+ this.genericType,
31
+ ]);
40
32
  }
41
33
  }
42
34
 
43
35
  export class V1_RelationType implements V1_Type {
44
36
  columns: V1_RelationTypeColumn[] = [];
45
37
 
46
- static readonly serialization = new SerializationFactory(
47
- createModelSchema(V1_RelationType, {
48
- columns: list(
49
- usingModelSchema(V1_RelationTypeColumn.serialization.schema),
50
- ),
51
- }),
52
- );
53
-
54
38
  get hashCode(): string {
55
39
  return hashArray([
56
40
  CORE_HASH_STRUCTURE.RELATION_TYPE,
@@ -89,7 +89,7 @@ import { V1_CByteArray } from '../../../model/valueSpecification/raw/V1_CByteArr
89
89
  import type { ColSpecArrayInstance } from '../../../../../../../graph/metamodel/pure/valueSpecification/RelationValueSpecification.js';
90
90
  import { V1_ColSpecArray } from '../../../model/valueSpecification/raw/classInstance/relation/V1_ColSpecArray.js';
91
91
  import { V1_ColSpec } from '../../../model/valueSpecification/raw/classInstance/relation/V1_ColSpec.js';
92
- import { Relation_RelationalColumn } from '../../../../../../../graph/metamodel/pure/packageableElements/relation/Relation_RelationType.js';
92
+ import { RelationColumn } from '../../../../../../../graph/metamodel/pure/packageableElements/relation/RelationType.js';
93
93
  import { V1_createGenericTypeWithElementPath } from '../../../helpers/V1_DomainHelper.js';
94
94
 
95
95
  class V1_ValueSpecificationTransformer
@@ -134,7 +134,7 @@ class V1_ValueSpecificationTransformer
134
134
  valueSpecification: FunctionExpression,
135
135
  ): V1_ValueSpecification {
136
136
  // handle relational column
137
- if (valueSpecification.func instanceof Relation_RelationalColumn) {
137
+ if (valueSpecification.func instanceof RelationColumn) {
138
138
  const _property = new V1_AppliedProperty();
139
139
  _property.property = valueSpecification.func.name;
140
140
  _property.parameters = valueSpecification.parametersValues.map((value) =>
@@ -109,7 +109,7 @@ import {
109
109
  import { V1_SubTypeGraphFetchTree } from '../../../../model/valueSpecification/raw/classInstance/graph/V1_SubTypeGraphFetchTree.js';
110
110
  import { findMappingLocalProperty } from '../../../../../../../../graph/helpers/DSL_Mapping_Helper.js';
111
111
  import { getRelationTypeGenericType } from '../../../../../../../../graph/helpers/ValueSpecificationHelper.js';
112
- import { Relation_RelationType } from '../../../../../../../../graph/metamodel/pure/packageableElements/relation/Relation_RelationType.js';
112
+ import { RelationType } from '../../../../../../../../graph/metamodel/pure/packageableElements/relation/RelationType.js';
113
113
  import {
114
114
  V1_getGenericTypeFullPath,
115
115
  V1_createGenericTypeWithElementPath,
@@ -585,7 +585,7 @@ export function V1_processProperty(
585
585
  EnumValueExplicitReference.create(getEnumValue(inferredType, property)),
586
586
  ];
587
587
  return enumValueInstanceValue;
588
- } else if (inferredType instanceof Relation_RelationType) {
588
+ } else if (inferredType instanceof RelationType) {
589
589
  const col = guaranteeNonNullable(
590
590
  inferredType.columns.find((e) => property === e.name),
591
591
  `Can't find property ${property} in relation`,
@@ -86,7 +86,7 @@ import { V1_DefaultValue } from '../../../model/packageableElements/domain/V1_De
86
86
  import { V1_HostedService } from '../../../model/packageableElements/function/V1_HostedService.js';
87
87
  import {
88
88
  V1_deserializeGenericType,
89
- V1_GenericTypeModelSchema,
89
+ V1_genericTypeModelSchema,
90
90
  } from './V1_TypeSerializationHelper.js';
91
91
  import { PackageableElementPointerType } from '../../../../../../../graph/MetaModelConst.js';
92
92
  import type { V1_PackageableElementPointer } from '../../../model/packageableElements/V1_PackageableElement.js';
@@ -256,7 +256,7 @@ export const V1_propertyModelSchema = createModelSchema(V1_Property, {
256
256
  aggregation: optional(primitive()),
257
257
  defaultValue: optional(usingModelSchema(V1_defaultValueModelSchema)),
258
258
  genericType: custom(
259
- (val) => serialize(V1_GenericTypeModelSchema, val),
259
+ (val) => serialize(V1_genericTypeModelSchema, val),
260
260
  (val) => V1_deserializeGenericType(val),
261
261
  {
262
262
  beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
@@ -289,7 +289,7 @@ export const V1_derivedPropertyModelSchema = createModelSchema(
289
289
  name: primitive(),
290
290
  parameters: raw(),
291
291
  returnGenericType: custom(
292
- (val) => serialize(V1_GenericTypeModelSchema, val),
292
+ (val) => serialize(V1_genericTypeModelSchema, val),
293
293
  (val) => V1_deserializeGenericType(val),
294
294
  {
295
295
  beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
@@ -423,7 +423,7 @@ export const V1_functionModelSchema = (
423
423
  postConstraints: list(primitive()), // NOTE: these are not currently supported and just added to pass roundtrip test
424
424
  preConstraints: list(primitive()), // NOTE: these are not currently supported and just added to pass roundtrip test
425
425
  returnGenericType: custom(
426
- (val) => serialize(V1_GenericTypeModelSchema, val),
426
+ (val) => serialize(V1_genericTypeModelSchema, val),
427
427
  (val) => V1_deserializeGenericType(val),
428
428
  {
429
429
  beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
@@ -51,45 +51,7 @@ export enum V1_Type_Type {
51
51
  RELATION_TYPE = 'relationType',
52
52
  }
53
53
 
54
- const packageableTypeSchema = createModelSchema(V1_PackageableType, {
55
- _type: usingConstantValueSchema(V1_Type_Type.PACKAGEABLE_TYPE),
56
- fullPath: primitive(),
57
- });
58
-
59
- const relationTypeColumnSchema = createModelSchema(V1_RelationTypeColumn, {
60
- name: primitive(),
61
- type: primitive(),
62
- });
63
-
64
- const relationTypeSchema = createModelSchema(V1_RelationType, {
65
- _type: usingConstantValueSchema(V1_Type_Type.RELATION_TYPE),
66
- columns: list(usingModelSchema(relationTypeColumnSchema)),
67
- });
68
-
69
- export function V1_deserializeType(json: PlainObject<V1_Type>): V1_Type {
70
- switch (json._type) {
71
- case V1_Type_Type.PACKAGEABLE_TYPE:
72
- return deserialize(packageableTypeSchema, json);
73
- case V1_Type_Type.RELATION_TYPE:
74
- return deserialize(relationTypeSchema, json);
75
- default:
76
- throw new UnsupportedOperationError(
77
- `Can't deserialize type: '${json._type}'`,
78
- );
79
- }
80
- }
81
-
82
- export function V1_serializeType(protocol: V1_Type): PlainObject<V1_Type> {
83
- if (protocol instanceof V1_PackageableType) {
84
- return serialize(packageableTypeSchema, protocol);
85
- } else if (protocol instanceof V1_RelationType) {
86
- return serialize(relationTypeSchema, protocol);
87
- }
88
-
89
- throw new UnsupportedOperationError(`Can't serialize type`, protocol);
90
- }
91
-
92
- export const V1_GenericTypeModelSchema = createModelSchema(V1_GenericType, {
54
+ export const V1_genericTypeModelSchema = createModelSchema(V1_GenericType, {
93
55
  multiplicityArguments: customList(
94
56
  (val: V1_Multiplicity) => serialize(V1_multiplicityModelSchema, val),
95
57
  (val) => deserialize(V1_multiplicityModelSchema, val),
@@ -120,6 +82,62 @@ export const V1_GenericTypeModelSchema = createModelSchema(V1_GenericType, {
120
82
  ),
121
83
  });
122
84
 
85
+ const packageableTypeModelSchema = createModelSchema(V1_PackageableType, {
86
+ _type: usingConstantValueSchema(V1_Type_Type.PACKAGEABLE_TYPE),
87
+ fullPath: primitive(),
88
+ });
89
+
90
+ const V1_relationTypeColumnModelSchema = createModelSchema(
91
+ V1_RelationTypeColumn,
92
+ {
93
+ name: primitive(),
94
+ genericType: custom(
95
+ (val) => serialize(V1_genericTypeModelSchema, val),
96
+ (val) => V1_deserializeGenericType(val),
97
+ {
98
+ beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
99
+ /** @backwardCompatibility */
100
+ if (
101
+ jsonParentValue.type !== undefined &&
102
+ jsonParentValue.genericType === undefined
103
+ ) {
104
+ callback(null, jsonParentValue.type);
105
+ } else {
106
+ callback(null, jsonParentValue.genericType);
107
+ }
108
+ },
109
+ },
110
+ ),
111
+ },
112
+ );
113
+
114
+ export const V1_relationTypeModelSchema = createModelSchema(V1_RelationType, {
115
+ _type: usingConstantValueSchema(V1_Type_Type.RELATION_TYPE),
116
+ columns: list(usingModelSchema(V1_relationTypeColumnModelSchema)),
117
+ });
118
+
119
+ export function V1_deserializeType(json: PlainObject<V1_Type>): V1_Type {
120
+ switch (json._type) {
121
+ case V1_Type_Type.PACKAGEABLE_TYPE:
122
+ return deserialize(packageableTypeModelSchema, json);
123
+ case V1_Type_Type.RELATION_TYPE:
124
+ return deserialize(V1_relationTypeModelSchema, json);
125
+ default:
126
+ throw new UnsupportedOperationError(
127
+ `Can't deserialize type: '${json._type}'`,
128
+ );
129
+ }
130
+ }
131
+
132
+ export function V1_serializeType(protocol: V1_Type): PlainObject<V1_Type> {
133
+ if (protocol instanceof V1_PackageableType) {
134
+ return serialize(packageableTypeModelSchema, protocol);
135
+ } else if (protocol instanceof V1_RelationType) {
136
+ return serialize(V1_relationTypeModelSchema, protocol);
137
+ }
138
+ throw new UnsupportedOperationError(`Can't serialize type`, protocol);
139
+ }
140
+
123
141
  const appendAnyGenericType = (current: V1_GenericType): void => {
124
142
  current.multiplicityArguments = [new V1_Multiplicity(1, undefined)];
125
143
  const _anytype = new V1_PackageableType();
@@ -129,32 +147,32 @@ const appendAnyGenericType = (current: V1_GenericType): void => {
129
147
  current.typeArguments = [arGenType];
130
148
  };
131
149
 
132
- export const V1_deserializeGenericType = (
150
+ export function V1_deserializeGenericType(
133
151
  val: PlainObject<V1_GenericType> | string,
134
- ): V1_GenericType => {
152
+ ): V1_GenericType {
135
153
  /** @backwardCompatibility */
136
- let genType: V1_GenericType;
154
+ let genericType: V1_GenericType;
137
155
  if (isString(val)) {
138
- genType = new V1_GenericType();
156
+ genericType = new V1_GenericType();
139
157
  const packageableType = new V1_PackageableType();
140
158
  packageableType.fullPath = val;
141
- genType.rawType = packageableType;
159
+ genericType.rawType = packageableType;
142
160
  if (matchFunctionName(val, CORE_PURE_PATH.TABULAR_RESULT)) {
143
- appendAnyGenericType(genType);
161
+ appendAnyGenericType(genericType);
144
162
  }
145
163
  } else {
146
- genType = deserialize(V1_GenericTypeModelSchema, val);
164
+ genericType = deserialize(V1_genericTypeModelSchema, val);
147
165
  }
148
166
  const classPath = returnUndefOnError(() =>
149
- V1_getGenericTypeFullPath(genType),
167
+ V1_getGenericTypeFullPath(genericType),
150
168
  );
151
169
  if (
152
170
  classPath &&
153
171
  matchFunctionName(classPath, CORE_PURE_PATH.TABULAR_RESULT) &&
154
- !genType.multiplicityArguments.length &&
155
- !genType.typeArguments.length
172
+ !genericType.multiplicityArguments.length &&
173
+ !genericType.typeArguments.length
156
174
  ) {
157
- appendAnyGenericType(genType);
175
+ appendAnyGenericType(genericType);
158
176
  }
159
- return genType;
160
- };
177
+ return genericType;
178
+ }
@@ -92,7 +92,7 @@ import { V1_ClassInstance } from '../../../model/valueSpecification/raw/V1_Class
92
92
  import { V1_CByteArray } from '../../../model/valueSpecification/raw/V1_CByteArray.js';
93
93
  import {
94
94
  V1_deserializeGenericType,
95
- V1_GenericTypeModelSchema,
95
+ V1_genericTypeModelSchema,
96
96
  } from './V1_TypeSerializationHelper.js';
97
97
  import { V1_createGenericTypeWithElementPath } from '../../../helpers/V1_DomainHelper.js';
98
98
 
@@ -173,7 +173,7 @@ enum V1_ValueSpecificationType {
173
173
  export const V1_variableModelSchema = createModelSchema(V1_Variable, {
174
174
  _type: usingConstantValueSchema(V1_ValueSpecificationType.VARIABLE),
175
175
  genericType: optionalCustom(
176
- (val) => serialize(V1_GenericTypeModelSchema, val),
176
+ (val) => serialize(V1_genericTypeModelSchema, val),
177
177
  (val) => V1_deserializeGenericType(val),
178
178
  {
179
179
  beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
@@ -266,7 +266,7 @@ const genericTypeInstanceSchema = (plugins: PureProtocolProcessorPlugin[]) =>
266
266
  V1_ValueSpecificationType.GENERIC_TYPE_INSTANCE,
267
267
  ),
268
268
  genericType: custom(
269
- (val) => serialize(V1_GenericTypeModelSchema, val),
269
+ (val) => serialize(V1_genericTypeModelSchema, val),
270
270
  (val) => V1_deserializeGenericType(val),
271
271
  {
272
272
  beforeDeserialize: function (callback, jsonValue, jsonParentValue) {