@finos/legend-graph 32.5.0 → 32.5.2

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 (49) hide show
  1. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts +4 -3
  2. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts.map +1 -1
  3. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js +7 -5
  4. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js.map +1 -1
  5. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.d.ts +1 -0
  6. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.d.ts.map +1 -1
  7. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.js +5 -1
  8. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.js.map +1 -1
  9. package/lib/graph-manager/action/query/Query.d.ts +7 -0
  10. package/lib/graph-manager/action/query/Query.d.ts.map +1 -1
  11. package/lib/graph-manager/action/query/Query.js +7 -0
  12. package/lib/graph-manager/action/query/Query.js.map +1 -1
  13. package/lib/graph-manager/helpers/DataProductHelper.d.ts +7 -2
  14. package/lib/graph-manager/helpers/DataProductHelper.d.ts.map +1 -1
  15. package/lib/graph-manager/helpers/DataProductHelper.js +27 -2
  16. package/lib/graph-manager/helpers/DataProductHelper.js.map +1 -1
  17. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +13 -1
  18. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  19. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +214 -92
  20. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
  21. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.d.ts.map +1 -1
  22. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.js +20 -2
  23. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.js.map +1 -1
  24. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.d.ts.map +1 -1
  25. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.js +7 -0
  26. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.js.map +1 -1
  27. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.d.ts +6 -1
  28. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.d.ts.map +1 -1
  29. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.js +16 -0
  30. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.js.map +1 -1
  31. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts +1 -1
  32. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts.map +1 -1
  33. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js +6 -6
  34. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js.map +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.d.ts.map +1 -1
  36. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js +14 -10
  37. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js.map +1 -1
  38. package/lib/package.json +1 -1
  39. package/package.json +3 -3
  40. package/src/graph/metamodel/pure/dataProduct/DataProduct.ts +13 -5
  41. package/src/graph/metamodel/pure/packageableElements/relation/Accessor.ts +6 -1
  42. package/src/graph-manager/action/query/Query.ts +9 -0
  43. package/src/graph-manager/helpers/DataProductHelper.ts +47 -4
  44. package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +488 -484
  45. package/src/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.ts +22 -0
  46. package/src/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.ts +7 -0
  47. package/src/graph-manager/protocol/pure/v1/engine/query/V1_Query.ts +28 -0
  48. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.ts +6 -3
  49. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.ts +21 -23
@@ -36,6 +36,8 @@ import {
36
36
  QueryDataProductModelAccessExecutionContext,
37
37
  QueryDataProductNativeExecutionContextInfo,
38
38
  QueryDataProductModelAccessExecutionContextInfo,
39
+ QueryDataProductLakehouseExecutionContext,
40
+ QueryDataProductLakehouseExecutionContextInfo,
39
41
  } from '../../../../../graph-manager/action/query/Query.js';
40
42
  import {
41
43
  type V1_LightQuery,
@@ -46,6 +48,7 @@ import {
46
48
  type V1_QueryExecutionContext,
47
49
  V1_DataProductNativeExecutionContext,
48
50
  V1_DataProductModelAccessExecutionContext,
51
+ V1_DataProductLakehouseExecutionContext,
49
52
  } from './query/V1_Query.js';
50
53
  import type { PureModel } from '../../../../../graph/PureModel.js';
51
54
  import { DEPRECATED__ServiceTestResult } from '../../../../../graph-manager/action/service/DEPRECATED__ServiceTestResult.js';
@@ -220,6 +223,13 @@ export const V1_buildExecutionContext = (
220
223
  exec.dataProductPath = protocolExecContext.dataProductPath;
221
224
  exec.accessPointGroupId = protocolExecContext.accessPointGroupId;
222
225
  return exec;
226
+ } else if (
227
+ protocolExecContext instanceof V1_DataProductLakehouseExecutionContext
228
+ ) {
229
+ const exec = new QueryDataProductLakehouseExecutionContext();
230
+ exec.dataProductPath = protocolExecContext.dataProductPath;
231
+ exec.accessPointId = protocolExecContext.accessPointId;
232
+ return exec;
223
233
  }
224
234
  throw new UnsupportedOperationError('Unsupported query execution context');
225
235
  };
@@ -263,6 +273,13 @@ export const V1_buildExecutionContextInfo = (
263
273
  exec.dataProductPath = v1_execContext.dataProductPath;
264
274
  exec.accessPointGroupId = v1_execContext.accessPointGroupId;
265
275
  return exec;
276
+ } else if (
277
+ v1_execContext instanceof V1_DataProductLakehouseExecutionContext
278
+ ) {
279
+ const exec = new QueryDataProductLakehouseExecutionContextInfo();
280
+ exec.dataProductPath = v1_execContext.dataProductPath;
281
+ exec.accessPointId = v1_execContext.accessPointId;
282
+ return exec;
266
283
  }
267
284
  throw new UnsupportedOperationError('Unsupported query execution context');
268
285
  };
@@ -382,6 +399,11 @@ export const V1_transformQueryExecutionContext = (
382
399
  protocol.dataProductPath = execContext.dataProductPath;
383
400
  protocol.accessPointGroupId = execContext.accessPointGroupId;
384
401
  return protocol;
402
+ } else if (execContext instanceof QueryDataProductLakehouseExecutionContext) {
403
+ const protocol = new V1_DataProductLakehouseExecutionContext();
404
+ protocol.dataProductPath = execContext.dataProductPath;
405
+ protocol.accessPointId = execContext.accessPointId;
406
+ return protocol;
385
407
  }
386
408
  throw new UnsupportedOperationError('Unsupported query execution context');
387
409
  };
@@ -103,6 +103,13 @@ const V1_deserializeMappedProperty = (
103
103
  case V1_MappedPropertyType.ENUM:
104
104
  return deserialize(V1_EnumMappedProperty.serialization.schema, json);
105
105
  default: {
106
+ // fix: data product artifacts omit type
107
+ if (json.entityPath !== undefined) {
108
+ return deserialize(V1_EntityMappedProperty.serialization.schema, json);
109
+ }
110
+ if (json.enumPath !== undefined) {
111
+ return deserialize(V1_EnumMappedProperty.serialization.schema, json);
112
+ }
106
113
  return deserialize(V1_MappedProperty.serialization.schema, json);
107
114
  }
108
115
  }
@@ -67,6 +67,7 @@ export enum V1_QueryExecutionContextType {
67
67
  QUERY_DATASAPCE_EXECUTION_CONTEXT = 'dataSpaceExecutionContext',
68
68
  QUERY_DATAPRODUCT_NATIVE_EXECUTION_CONTEXT = 'dataProductNativeExecutionContext',
69
69
  QUERY_DATAPRODUCT_MODEL_ACCESS_EXECUTION_CONTEXT = 'dataProductModelAccessExecutionContext',
70
+ QUERY_DATAPRODUCT_LAKEHOUSE_EXECUTION_CONTEXT = 'dataProductLakehouseExecutionContext',
70
71
  }
71
72
 
72
73
  export class V1_QueryExplicitExecutionContext extends V1_QueryExecutionContext {
@@ -143,6 +144,23 @@ export class V1_DataProductModelAccessExecutionContext extends V1_QueryDataProdu
143
144
  );
144
145
  }
145
146
 
147
+ export class V1_DataProductLakehouseExecutionContext extends V1_QueryDataProductExecutionContext {
148
+ accessPointId!: string;
149
+
150
+ static readonly serialization = new SerializationFactory(
151
+ createModelSchema(V1_DataProductLakehouseExecutionContext, {
152
+ _type: usingConstantValueSchema(
153
+ V1_QueryExecutionContextType.QUERY_DATAPRODUCT_LAKEHOUSE_EXECUTION_CONTEXT,
154
+ ),
155
+ dataProductPath: primitive(),
156
+ accessPointId: primitive(),
157
+ }),
158
+ {
159
+ deserializeNullAsUndefined: true,
160
+ },
161
+ );
162
+ }
163
+
146
164
  export const V1_deserializeQueryExecutionContext = (
147
165
  json: PlainObject<V1_QueryExecutionContext>,
148
166
  ): V1_QueryExecutionContext => {
@@ -167,6 +185,11 @@ export const V1_deserializeQueryExecutionContext = (
167
185
  V1_DataProductModelAccessExecutionContext.serialization.schema,
168
186
  json,
169
187
  );
188
+ case V1_QueryExecutionContextType.QUERY_DATAPRODUCT_LAKEHOUSE_EXECUTION_CONTEXT:
189
+ return deserialize(
190
+ V1_DataProductLakehouseExecutionContext.serialization.schema,
191
+ json,
192
+ );
170
193
  default: {
171
194
  throw new UnsupportedOperationError(
172
195
  `Can't deserialize authentication strategy of type '${json._type}': no compatible deserializer available from plugins`,
@@ -198,6 +221,11 @@ export const V1_serializeQueryExecutionContext = (
198
221
  V1_DataProductModelAccessExecutionContext.serialization.schema,
199
222
  protocol,
200
223
  );
224
+ } else if (protocol instanceof V1_DataProductLakehouseExecutionContext) {
225
+ return serialize(
226
+ V1_DataProductLakehouseExecutionContext.serialization.schema,
227
+ protocol,
228
+ );
201
229
  }
202
230
  throw new UnsupportedOperationError(
203
231
  `Can't serialize authentication strategy: no compatible serializer available from plugins`,
@@ -85,6 +85,7 @@ export const V1_buildDataProductLink = (
85
85
  export const V1_buildAccessPoint = (
86
86
  ap: V1_AccessPoint,
87
87
  context: V1_GraphBuilderContext,
88
+ owner: AccessPointGroup,
88
89
  ): AccessPoint => {
89
90
  if (ap instanceof V1_LakehouseAccessPoint) {
90
91
  const lakeAccessPoint = new LakehouseAccessPoint(
@@ -95,6 +96,7 @@ export const V1_buildAccessPoint = (
95
96
  ap.func.body,
96
97
  context,
97
98
  ),
99
+ owner,
98
100
  );
99
101
  lakeAccessPoint.reproducible = ap.reproducible;
100
102
  lakeAccessPoint.classification = ap.classification;
@@ -112,6 +114,7 @@ export const V1_buildAccessPoint = (
112
114
  ap.query.body,
113
115
  context,
114
116
  ),
117
+ owner,
115
118
  );
116
119
  functionAccessPoint.description = ap.description;
117
120
  functionAccessPoint.title = ap.title;
@@ -120,7 +123,7 @@ export const V1_buildAccessPoint = (
120
123
  .filter(isNonNullable);
121
124
  return functionAccessPoint;
122
125
  } else if (ap instanceof V1_UnknownAccessPoint) {
123
- const unknown = new UnknownAccessPoint(ap.id);
126
+ const unknown = new UnknownAccessPoint(ap.id, owner);
124
127
  unknown.description = ap.description;
125
128
  unknown.title = ap.title;
126
129
  unknown.content = ap.content;
@@ -178,7 +181,7 @@ export const V1_buildAccessPointGroup = (
178
181
  group.title = elementGroup.title;
179
182
  group.description = elementGroup.description;
180
183
  group.accessPoints = elementGroup.accessPoints.map((ep) =>
181
- V1_buildAccessPoint(ep, context),
184
+ V1_buildAccessPoint(ep, context, group),
182
185
  );
183
186
  group.stereotypes = elementGroup.stereotypes
184
187
  .map((stereotype) => context.resolveStereotype(stereotype))
@@ -225,7 +228,7 @@ export const V1_buildAccessPointGroup = (
225
228
  group.title = elementGroup.title;
226
229
  group.description = elementGroup.description;
227
230
  group.accessPoints = elementGroup.accessPoints.map((ep) =>
228
- V1_buildAccessPoint(ep, context),
231
+ V1_buildAccessPoint(ep, context, group),
229
232
  );
230
233
  group.stereotypes = elementGroup.stereotypes
231
234
  .map((stereotype) => context.resolveStereotype(stereotype))
@@ -30,6 +30,7 @@ import {
30
30
  UnsupportedOperationError,
31
31
  assertErrorThrown,
32
32
  usingModelSchema,
33
+ guaranteeNonNullable,
33
34
  } from '@finos/legend-shared';
34
35
  import { V1_PureModelContextData } from '../../model/context/V1_PureModelContextData.js';
35
36
  import { V1_PureModelContextPointer } from '../../model/context/V1_PureModelContextPointer.js';
@@ -101,29 +102,26 @@ export const V1_entitiesToPureModelContextData = async (
101
102
  TEMPORARY__entityPathIndex?.set(element.path, entity.path);
102
103
  return element;
103
104
  };
104
- graph.elements = await Promise.all<V1_PackageableElement>(
105
- entities.map(
106
- (e) =>
107
- new Promise((resolve, reject) =>
108
- setTimeout(() => {
109
- try {
110
- resolve(
111
- // NOTE: here we skip the check for classifier path, so there could be cases
112
- // where the classifier path is different from the actua element protocol path
113
- // we might need to do validation here. This can happen when the classifier
114
- // path is changed in the backend. If we are to check for this, we might consider
115
- // not throwing error but quitely print out warnings about elements that would not
116
- // be built.
117
- entityToElement(e),
118
- );
119
- } catch (error) {
120
- assertErrorThrown(error);
121
- reject(error);
122
- }
123
- }, 0),
124
- ),
125
- ),
126
- );
105
+ // Process entities in batches to avoid per-element setTimeout overhead.
106
+ // Each batch yields to the event loop to keep the UI responsive.
107
+ const DESERIALIZATION_BATCH_SIZE = 100;
108
+ const results: V1_PackageableElement[] = [];
109
+ for (let i = 0; i < entities.length; i += DESERIALIZATION_BATCH_SIZE) {
110
+ if (i > 0) {
111
+ await new Promise<void>((resolve) => setTimeout(resolve, 0));
112
+ }
113
+ const end = Math.min(i + DESERIALIZATION_BATCH_SIZE, entities.length);
114
+ for (let j = i; j < end; j++) {
115
+ // NOTE: here we skip the check for classifier path, so there could be cases
116
+ // where the classifier path is different from the actua element protocol path
117
+ // we might need to do validation here. This can happen when the classifier
118
+ // path is changed in the backend. If we are to check for this, we might consider
119
+ // not throwing error but quitely print out warnings about elements that would not
120
+ // be built.
121
+ results.push(entityToElement(guaranteeNonNullable(entities[j])));
122
+ }
123
+ }
124
+ graph.elements = results;
127
125
  }
128
126
  } catch (error) {
129
127
  assertErrorThrown(error);