@finos/legend-graph 32.3.35 → 32.3.37

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 (30) hide show
  1. package/lib/graph/helpers/DomainHelper.d.ts +3 -0
  2. package/lib/graph/helpers/DomainHelper.d.ts.map +1 -1
  3. package/lib/graph/helpers/DomainHelper.js +3 -0
  4. package/lib/graph/helpers/DomainHelper.js.map +1 -1
  5. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +11 -0
  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 +76 -43
  8. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
  9. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.d.ts +15 -0
  10. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.d.ts.map +1 -1
  11. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js.map +1 -1
  12. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.d.ts.map +1 -1
  13. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js +14 -10
  14. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.js.map +1 -1
  15. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.d.ts +2 -1
  16. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.d.ts.map +1 -1
  17. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js +20 -5
  18. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js.map +1 -1
  19. package/lib/index.d.ts +3 -3
  20. package/lib/index.d.ts.map +1 -1
  21. package/lib/index.js +3 -3
  22. package/lib/index.js.map +1 -1
  23. package/lib/package.json +1 -1
  24. package/package.json +3 -3
  25. package/src/graph/helpers/DomainHelper.ts +7 -0
  26. package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +283 -413
  27. package/src/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.ts +16 -0
  28. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_PureProtocolSerialization.ts +21 -23
  29. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.ts +36 -5
  30. package/src/index.ts +8 -2
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  import type { V1_AppDirNode } from '../../../lakehouse/entitlements/V1_CoreEntitlements.js';
18
+ import type { V1_RelationTypeColumn } from '../type/V1_RelationType.js';
18
19
  import { V1_INTERNAL__UnknownPackageableElement } from '../V1_INTERNAL__UnknownPackageableElement.js';
19
20
  import type { V1_PackageableElementVisitor } from '../V1_PackageableElement.js';
20
21
 
@@ -29,3 +30,18 @@ export class V1_IngestDefinition extends V1_INTERNAL__UnknownPackageableElement
29
30
  return visitor.visit_IngestDefinition(this);
30
31
  }
31
32
  }
33
+ export interface V1_IngestDataset {
34
+ name: string;
35
+ primaryKey: string[];
36
+ source: {
37
+ _type: string;
38
+ schema: {
39
+ _type: string;
40
+ columns: V1_RelationTypeColumn[];
41
+ };
42
+ };
43
+ }
44
+
45
+ export interface V1_IngestDefinitionContent {
46
+ datasets?: V1_IngestDataset[];
47
+ }
@@ -29,6 +29,7 @@ import {
29
29
  usingConstantValueSchema,
30
30
  UnsupportedOperationError,
31
31
  assertErrorThrown,
32
+ guaranteeNonNullable,
32
33
  usingModelSchema,
33
34
  } from '@finos/legend-shared';
34
35
  import { V1_PureModelContextData } from '../../model/context/V1_PureModelContextData.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);
@@ -55,8 +55,8 @@ import {
55
55
  list,
56
56
  optional,
57
57
  primitive,
58
+ raw,
58
59
  serialize,
59
- SKIP,
60
60
  } from 'serializr';
61
61
  import {
62
62
  type V1_OrganizationalScope,
@@ -139,11 +139,18 @@ export const V1_EntitlementsDataProductModelSchema = createModelSchema(
139
139
  export const V1_AccessPointGroupReferenceModelSchema = createModelSchema(
140
140
  V1_AccessPointGroupReference,
141
141
  {
142
+ _type: usingConstantValueSchema(
143
+ V1_AccessPointGroupReferenceType.AccessPointGroupReference,
144
+ ),
142
145
  dataProduct: usingModelSchema(V1_EntitlementsDataProductModelSchema),
143
146
  accessPointGroup: primitive(),
144
147
  },
145
148
  );
146
149
 
150
+ export const V1_DataBundleModelSchema = createModelSchema(V1_DataBundle, {
151
+ content: raw(),
152
+ });
153
+
147
154
  export const V1_AdhocTeamModelSchema = createModelSchema(V1_AdhocTeam, {
148
155
  _type: usingConstantValueSchema(V1_OrganizationalScopeType.AdHocTeam),
149
156
  users: customListWithSchema(V1_UserModelSchema),
@@ -207,10 +214,29 @@ const V1_serializeOrganizationalScope = (
207
214
  return result;
208
215
  }
209
216
  }
210
- throw new UnsupportedOperationError();
217
+ throw new UnsupportedOperationError(
218
+ `Can't serialize unsupported organizational scope type: ${organizationalScope.constructor.name}`,
219
+ );
211
220
  };
212
221
 
213
- const V1_deseralizeV1_ConsumerEntitlementResource = (
222
+ const V1_seralizeConsumerEntitlementResource = (
223
+ consumerEntitlementResource: V1_ConsumerEntitlementResource,
224
+ ): PlainObject<V1_ConsumerEntitlementResource> => {
225
+ if (consumerEntitlementResource instanceof V1_AccessPointGroupReference) {
226
+ return serialize(
227
+ V1_AccessPointGroupReferenceModelSchema,
228
+ consumerEntitlementResource,
229
+ );
230
+ } else if (consumerEntitlementResource instanceof V1_DataBundle) {
231
+ return serialize(V1_DataBundleModelSchema, consumerEntitlementResource);
232
+ } else {
233
+ throw new UnsupportedOperationError(
234
+ `Can't serialize unsupported consumer entitlement resource type: ${consumerEntitlementResource.constructor.name}`,
235
+ );
236
+ }
237
+ };
238
+
239
+ const V1_deseralizeConsumerEntitlementResource = (
214
240
  json: PlainObject<V1_ConsumerEntitlementResource>,
215
241
  ): V1_ConsumerEntitlementResource => {
216
242
  switch (json._type) {
@@ -240,7 +266,10 @@ export const V1_dataContractModelSchema = (
240
266
  guid: primitive(),
241
267
  version: primitive(),
242
268
  state: primitive(),
243
- resource: custom(() => SKIP, V1_deseralizeV1_ConsumerEntitlementResource),
269
+ resource: custom(
270
+ V1_seralizeConsumerEntitlementResource,
271
+ V1_deseralizeConsumerEntitlementResource,
272
+ ),
244
273
  members: optional(
245
274
  list(usingModelSchema(V1_contractUserMembershipModelSchema)),
246
275
  ),
@@ -585,7 +614,9 @@ const V1_serializeDataProductOrigin = (
585
614
  if (origin instanceof V1_SdlcDeploymentDataProductOrigin) {
586
615
  return serialize(V1_SdlcDeploymentDataProductOriginModelSchema, origin);
587
616
  }
588
- throw new UnsupportedOperationError();
617
+ throw new UnsupportedOperationError(
618
+ `Can't serialize unsupported data product origin type: ${origin?.constructor.name}`,
619
+ );
589
620
  };
590
621
 
591
622
  export const V1_EntitlementsLakehouseEnvironmentModelSchema = createModelSchema(
package/src/index.ts CHANGED
@@ -93,7 +93,11 @@ export { SnowflakeAppDeploymentConfiguration } from './graph/metamodel/pure/func
93
93
  export { SnowflakeM2MUdf } from './graph/metamodel/pure/packageableElements/function/SnowflakeM2MUdf.js';
94
94
  export { SnowflakeM2MUdfDeploymentConfiguration } from './graph/metamodel/pure/functionActivator/SnowflakeM2MUdfDeploymentConfiguration.js';
95
95
  export { INTERNAL__UnknownElement } from './graph/metamodel/pure/packageableElements/INTERNAL__UnknownElement.js';
96
- export { V1_IngestDefinition } from './graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js';
96
+ export {
97
+ V1_IngestDefinition,
98
+ type V1_IngestDataset,
99
+ type V1_IngestDefinitionContent,
100
+ } from './graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js';
97
101
  export {
98
102
  Ownership,
99
103
  DeploymentOwner,
@@ -374,8 +378,8 @@ export {
374
378
  V1_EntitlementsAccessPointModelSchema,
375
379
  V1_EntitlementsDataProductDetailsModelSchema,
376
380
  V1_EntitlementsDataProductDetailsResponseModelSchema,
377
- V1_EntitlementsDataProductLiteModelSchema,
378
381
  V1_entitlementsDataProductDetailsResponseToDataProductDetails,
382
+ V1_EntitlementsDataProductLiteModelSchema,
379
383
  V1_EntitlementsDataProductModelSchema,
380
384
  V1_EntitlementsLakehouseEnvironmentModelSchema,
381
385
  V1_liteDataContractModelSchema,
@@ -384,6 +388,7 @@ export {
384
388
  V1_OrganizationalScopeType,
385
389
  V1_pendingTasksResponseModelSchema,
386
390
  V1_SdlcDeploymentDataProductOriginModelSchema,
391
+ V1_taskResponseModelSchema,
387
392
  V1_TaskStatusChangeResponseModelSchema,
388
393
  V1_terminalProvisionPayloadModelSchema,
389
394
  } from './graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js';
@@ -402,6 +407,7 @@ export {
402
407
  V1_NativeModelExecutionContextInfo,
403
408
  V1_AccessPointImplementation,
404
409
  V1_AccessPointGroupInfo,
410
+ V1_DataProductInfo,
405
411
  V1_ModelAccessPointGroupInfo,
406
412
  V1_AccessPointGroupInfoType,
407
413
  V1_SampleQuery,