@finos/legend-graph 32.5.1 → 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 (25) 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-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +13 -1
  6. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  7. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +214 -92
  8. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
  9. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.d.ts.map +1 -1
  10. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.js +7 -0
  11. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.js.map +1 -1
  12. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts +1 -1
  13. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts.map +1 -1
  14. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js +6 -6
  15. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js.map +1 -1
  16. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.d.ts.map +1 -1
  17. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js +14 -10
  18. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js.map +1 -1
  19. package/lib/package.json +1 -1
  20. package/package.json +3 -3
  21. package/src/graph/metamodel/pure/dataProduct/DataProduct.ts +13 -5
  22. package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +488 -484
  23. package/src/graph-manager/protocol/pure/v1/engine/analytics/V1_MappingModelCoverageAnalysis.ts +7 -0
  24. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.ts +6 -3
  25. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.ts +21 -23
@@ -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
  }
@@ -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);