@finos/legend-graph 32.1.67 → 32.2.1

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 (76) hide show
  1. package/lib/graph/Core_HashUtils.d.ts +3 -1
  2. package/lib/graph/Core_HashUtils.d.ts.map +1 -1
  3. package/lib/graph/Core_HashUtils.js +2 -0
  4. package/lib/graph/Core_HashUtils.js.map +1 -1
  5. package/lib/graph/MetaModelConst.d.ts.map +1 -1
  6. package/lib/graph/MetaModelConst.js +2 -0
  7. package/lib/graph/MetaModelConst.js.map +1 -1
  8. package/lib/graph/PureModel.d.ts +2 -0
  9. package/lib/graph/PureModel.d.ts.map +1 -1
  10. package/lib/graph/PureModel.js +2 -0
  11. package/lib/graph/PureModel.js.map +1 -1
  12. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts +20 -5
  13. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts.map +1 -1
  14. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js +39 -10
  15. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js.map +1 -1
  16. package/lib/graph-manager/AbstractPureGraphManager.d.ts +5 -0
  17. package/lib/graph-manager/AbstractPureGraphManager.d.ts.map +1 -1
  18. package/lib/graph-manager/AbstractPureGraphManager.js.map +1 -1
  19. package/lib/graph-manager/action/changeDetection/DataProductObserveHelper.d.ts +2 -1
  20. package/lib/graph-manager/action/changeDetection/DataProductObserveHelper.d.ts.map +1 -1
  21. package/lib/graph-manager/action/changeDetection/DataProductObserveHelper.js +24 -1
  22. package/lib/graph-manager/action/changeDetection/DataProductObserveHelper.js.map +1 -1
  23. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +3 -2
  24. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  25. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +62 -12
  26. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
  27. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.d.ts +1 -1
  28. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.d.ts.map +1 -1
  29. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.js +1 -1
  30. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.js.map +1 -1
  31. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.d.ts +24 -4
  32. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.d.ts.map +1 -1
  33. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.js +39 -7
  34. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.js.map +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.d.ts.map +1 -1
  36. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.js +33 -11
  37. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.js.map +1 -1
  38. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.d.ts.map +1 -1
  39. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js +10 -2
  40. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js.map +1 -1
  41. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts +2 -2
  42. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts.map +1 -1
  43. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js +9 -6
  44. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js.map +1 -1
  45. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.d.ts +15 -1
  46. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.d.ts.map +1 -1
  47. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.js +54 -20
  48. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.js.map +1 -1
  49. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js +1 -1
  50. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js.map +1 -1
  51. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.d.ts +1 -0
  52. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.d.ts.map +1 -1
  53. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js +2 -0
  54. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js.map +1 -1
  55. package/lib/index.d.ts +3 -3
  56. package/lib/index.d.ts.map +1 -1
  57. package/lib/index.js +3 -3
  58. package/lib/index.js.map +1 -1
  59. package/lib/package.json +1 -1
  60. package/package.json +1 -1
  61. package/src/graph/Core_HashUtils.ts +2 -0
  62. package/src/graph/MetaModelConst.ts +2 -0
  63. package/src/graph/PureModel.ts +2 -0
  64. package/src/graph/metamodel/pure/dataProduct/DataProduct.ts +56 -12
  65. package/src/graph-manager/AbstractPureGraphManager.ts +5 -0
  66. package/src/graph-manager/action/changeDetection/DataProductObserveHelper.ts +31 -3
  67. package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +86 -26
  68. package/src/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.ts +1 -1
  69. package/src/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.ts +54 -9
  70. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.ts +58 -21
  71. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.ts +14 -1
  72. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.ts +21 -17
  73. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.ts +89 -33
  74. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.ts +1 -1
  75. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.ts +2 -0
  76. package/src/index.ts +20 -12
@@ -119,6 +119,8 @@ export const AUTO_IMPORTS = [
119
119
  // 'meta::pure::tds',
120
120
  // 'meta::pure::tools',
121
121
  'meta::pure::profiles',
122
+ 'meta::pure::metamodel::relation',
123
+ 'meta::pure::metamodel::variant',
122
124
  ];
123
125
 
124
126
  export enum CORE_PURE_PATH {
@@ -180,6 +180,8 @@ export class SystemModel extends BasicModel {
180
180
  *
181
181
  * `meta::pure::metamodel::type::Any` covers `meta::pure::metamodel::type`
182
182
  * `meta::pure::profiles::doc` covers `meta::pure::profiles`
183
+ * `meta::pure::metamodel::relation::Relation` covers `meta::pure::metamodel::relation`
184
+ * `meta::pure::metamodel::variant::Variant` covers `meta::pure::metamodel::variant`
183
185
  */
184
186
  initializeAutoImports(): void {
185
187
  this.autoImports = AUTO_IMPORTS.map((_package) =>
@@ -253,8 +253,33 @@ export abstract class DataProductIcon implements Hashable {
253
253
  abstract get hashCode(): string;
254
254
  }
255
255
 
256
- export class EmbeddedImageIcon extends DataProductIcon implements Hashable {
257
- imageUrl: string;
256
+ export class DataProductLibraryIcon
257
+ extends DataProductIcon
258
+ implements Hashable
259
+ {
260
+ libraryId!: string;
261
+ iconId!: string;
262
+
263
+ constructor(libraryId: string, iconId: string) {
264
+ super();
265
+ this.libraryId = libraryId;
266
+ this.iconId = iconId;
267
+ }
268
+
269
+ get hashCode(): string {
270
+ return hashArray([
271
+ CORE_HASH_STRUCTURE.DATA_PRODUCT_ICON_LIBRARY,
272
+ this.libraryId,
273
+ this.iconId,
274
+ ]);
275
+ }
276
+ }
277
+
278
+ export class DataProductEmbeddedImageIcon
279
+ extends DataProductIcon
280
+ implements Hashable
281
+ {
282
+ imageUrl!: string;
258
283
 
259
284
  constructor(imageUrl: string) {
260
285
  super();
@@ -269,25 +294,42 @@ export class EmbeddedImageIcon extends DataProductIcon implements Hashable {
269
294
  }
270
295
  }
271
296
 
272
- export class LibraryIcon extends DataProductIcon implements Hashable {
273
- libraryId: string;
274
- iconId: string;
297
+ // handle incoming icons not yet modeled
298
+ export class UnknownDataProductIcon
299
+ extends DataProductIcon
300
+ implements Hashable
301
+ {
302
+ content!: PlainObject;
275
303
 
276
- constructor(libraryId: string, iconId: string) {
304
+ constructor(content: PlainObject) {
277
305
  super();
278
- this.libraryId = libraryId;
279
- this.iconId = iconId;
306
+ this.content = content;
280
307
  }
281
308
 
282
- get hashCode(): string {
309
+ override get hashCode(): string {
283
310
  return hashArray([
284
- CORE_HASH_STRUCTURE.DATA_PRODUCT_ICON_LIBRARY,
285
- this.libraryId,
286
- this.iconId,
311
+ CORE_HASH_STRUCTURE.INTERNAL__UNKNOWN_DATA_PRODUCT_ICON,
312
+ hashObjectWithoutSourceInformation(this.content),
287
313
  ]);
288
314
  }
289
315
  }
290
316
 
317
+ export abstract class DataProductType implements Hashable {
318
+ get hashCode(): string {
319
+ return hashArray([CORE_HASH_STRUCTURE.DATA_PRODUCT_TYPE]);
320
+ }
321
+ }
322
+
323
+ export class InternalDataProductType extends DataProductType {}
324
+
325
+ export class ExternalDataProductType extends DataProductType {
326
+ link!: DataProductLink;
327
+
328
+ override get hashCode(): string {
329
+ return hashArray([CORE_HASH_STRUCTURE.DATA_PRODUCT_TYPE, this.link]);
330
+ }
331
+ }
332
+
291
333
  export class DataProduct extends PackageableElement {
292
334
  title: string | undefined;
293
335
  description: string | undefined;
@@ -296,6 +338,7 @@ export class DataProduct extends PackageableElement {
296
338
  icon: DataProductIcon | undefined;
297
339
  accessPointGroups: AccessPointGroup[] = [];
298
340
  supportInfo: SupportInfo | undefined;
341
+ type: DataProductType | undefined;
299
342
 
300
343
  override accept_PackageableElementVisitor<T>(
301
344
  visitor: PackageableElementVisitor<T>,
@@ -313,6 +356,7 @@ export class DataProduct extends PackageableElement {
313
356
  this.icon ?? '',
314
357
  hashArray(this.accessPointGroups),
315
358
  this.supportInfo ?? '',
359
+ this.type ?? '',
316
360
  hashArray(this.stereotypes.map((val) => val.pointerHashCode)),
317
361
  hashArray(this.taggedValues),
318
362
  ]);
@@ -170,6 +170,11 @@ export interface ExecutionOptions {
170
170
  abortController?: AbortController | undefined;
171
171
  preservedResponseHeadersList?: string[];
172
172
  tracingtags?: PlainObject | undefined;
173
+ /**
174
+ * If set will force lambda to append ->from(mapping/runtime)
175
+ * instead of providing in separate input property
176
+ */
177
+ forceFromExpression?: boolean | undefined;
173
178
  }
174
179
 
175
180
  export interface ServiceRegistrationOptions {
@@ -16,13 +16,17 @@
16
16
 
17
17
  import { makeObservable, observable, override } from 'mobx';
18
18
  import {
19
- LakehouseAccessPoint,
20
- type Email,
21
- type SupportInfo,
22
19
  type AccessPoint,
23
20
  type AccessPointGroup,
24
21
  type DataProduct,
22
+ type DataProductIcon,
25
23
  type DataProductLink,
24
+ type Email,
25
+ type SupportInfo,
26
+ DataProductEmbeddedImageIcon,
27
+ DataProductLibraryIcon,
28
+ LakehouseAccessPoint,
29
+ UnknownDataProductIcon,
26
30
  } from '../../../graph/metamodel/pure/dataProduct/DataProduct.js';
27
31
  import {
28
32
  observe_Abstract_PackageableElement,
@@ -109,6 +113,26 @@ export const observe_AccessPointGroup = skipObserved(
109
113
  },
110
114
  );
111
115
 
116
+ export const observe_DataProductIcon = skipObserved(
117
+ (metamodel: DataProductIcon): DataProductIcon => {
118
+ if (metamodel instanceof DataProductLibraryIcon) {
119
+ makeObservable(metamodel, {
120
+ libraryId: observable,
121
+ iconId: observable,
122
+ });
123
+ } else if (metamodel instanceof DataProductEmbeddedImageIcon) {
124
+ makeObservable(metamodel, {
125
+ imageUrl: observable,
126
+ });
127
+ } else if (metamodel instanceof UnknownDataProductIcon) {
128
+ makeObservable(metamodel, {
129
+ content: observable,
130
+ });
131
+ }
132
+ return metamodel;
133
+ },
134
+ );
135
+
112
136
  export const observe_DataProduct = skipObserved(
113
137
  (metamodel: DataProduct): DataProduct => {
114
138
  observe_Abstract_PackageableElement(metamodel);
@@ -119,11 +143,15 @@ export const observe_DataProduct = skipObserved(
119
143
  title: observable,
120
144
  description: observable,
121
145
  supportInfo: observable,
146
+ icon: observable,
122
147
  });
123
148
 
124
149
  if (metamodel.supportInfo) {
125
150
  observe_SupportInfo(metamodel.supportInfo);
126
151
  }
152
+ if (metamodel.icon) {
153
+ observe_DataProductIcon(metamodel.icon);
154
+ }
127
155
  metamodel.accessPointGroups.forEach(observe_AccessPointGroup);
128
156
  return metamodel;
129
157
  },
@@ -2694,7 +2694,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2694
2694
  lambda: RawLambda,
2695
2695
  runtime: Runtime | undefined,
2696
2696
  clientVersion: string | undefined,
2697
- parameterValues?: ParameterValue[],
2697
+ options?: ExecutionOptions,
2698
2698
  ): V1_ExecuteInput =>
2699
2699
  this.createExecutionInputWithPureModelContext(
2700
2700
  graph.origin
@@ -2705,7 +2705,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2705
2705
  runtime,
2706
2706
  clientVersion,
2707
2707
  new V1_ExecuteInput(),
2708
- parameterValues,
2708
+ options,
2709
2709
  );
2710
2710
 
2711
2711
  public createLineageInput = (
@@ -2714,7 +2714,6 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2714
2714
  lambda: RawLambda,
2715
2715
  runtime: Runtime | undefined,
2716
2716
  clientVersion: string | undefined,
2717
- parameterValues?: ParameterValue[],
2718
2717
  ): V1_LineageInput => {
2719
2718
  const executionInput = this.createExecutionInput(
2720
2719
  graph,
@@ -2722,7 +2721,6 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2722
2721
  lambda,
2723
2722
  runtime,
2724
2723
  clientVersion,
2725
- parameterValues,
2726
2724
  );
2727
2725
 
2728
2726
  const lineageInput = new V1_LineageInput();
@@ -2741,31 +2739,93 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2741
2739
  runtime: Runtime | undefined,
2742
2740
  clientVersion: string | undefined,
2743
2741
  executeInput: V1_ExecuteInput,
2744
- parameterValues?: ParameterValue[],
2742
+ options?: ExecutionOptions | undefined,
2745
2743
  ): V1_ExecuteInput => {
2744
+ let mappingPath = mapping?.path;
2745
+ const lambdaToExecute = V1_transformRawLambda(
2746
+ lambda,
2747
+ new V1_GraphTransformerContextBuilder(
2748
+ this.pluginManager.getPureProtocolProcessorPlugins(),
2749
+ ).build(),
2750
+ );
2751
+ let runtimeToExecute = runtime
2752
+ ? V1_transformRuntime(
2753
+ runtime,
2754
+ new V1_GraphTransformerContextBuilder(
2755
+ this.pluginManager.getPureProtocolProcessorPlugins(),
2756
+ ).build(),
2757
+ )
2758
+ : undefined;
2759
+ if (options?.forceFromExpression) {
2760
+ if (runtimeToExecute instanceof V1_RuntimePointer) {
2761
+ const runtimePath = runtimeToExecute.runtime;
2762
+ const body = lambdaToExecute.body;
2763
+ if (body && runtimePath.length) {
2764
+ // handles multi expression lambda (i.e let statement executions)
2765
+ if (Array.isArray(body)) {
2766
+ const expressions = body as object[];
2767
+ if (expressions.length) {
2768
+ const lastIdx = expressions.length - 1;
2769
+ const lastBody = expressions[lastIdx];
2770
+ if (lastBody) {
2771
+ const fromExpression = this.__fromExpression(
2772
+ mappingPath,
2773
+ runtimePath,
2774
+ lastBody,
2775
+ );
2776
+ expressions[lastIdx] = fromExpression;
2777
+ mappingPath = undefined;
2778
+ runtimeToExecute = undefined;
2779
+ }
2780
+ }
2781
+ } else {
2782
+ const fromExpression = this.__fromExpression(
2783
+ mappingPath,
2784
+ runtimePath,
2785
+ body,
2786
+ );
2787
+ lambdaToExecute.body = fromExpression;
2788
+ mappingPath = undefined;
2789
+ runtimeToExecute = undefined;
2790
+ }
2791
+ }
2792
+ }
2793
+ }
2746
2794
  return this.createExecutionInputWithPureModelContextWithV1(
2747
2795
  data,
2748
- mapping?.path,
2749
- V1_transformRawLambda(
2750
- lambda,
2751
- new V1_GraphTransformerContextBuilder(
2752
- this.pluginManager.getPureProtocolProcessorPlugins(),
2753
- ).build(),
2754
- ),
2755
- runtime
2756
- ? V1_transformRuntime(
2757
- runtime,
2758
- new V1_GraphTransformerContextBuilder(
2759
- this.pluginManager.getPureProtocolProcessorPlugins(),
2760
- ).build(),
2761
- )
2762
- : undefined,
2796
+ mappingPath,
2797
+ lambdaToExecute,
2798
+ runtimeToExecute,
2763
2799
  clientVersion,
2764
2800
  executeInput,
2765
- parameterValues,
2801
+ options?.parameterValues,
2766
2802
  );
2767
2803
  };
2768
2804
 
2805
+ __fromExpression = (
2806
+ mapping: string | undefined,
2807
+ runtime: string,
2808
+ body: object,
2809
+ ): object => {
2810
+ return {
2811
+ _type: 'func',
2812
+ function: 'from',
2813
+ parameters: [
2814
+ body,
2815
+ mapping
2816
+ ? {
2817
+ _type: 'packageableElementPtr',
2818
+ fullPath: mapping,
2819
+ }
2820
+ : undefined,
2821
+ {
2822
+ _type: 'packageableElementPtr',
2823
+ fullPath: runtime,
2824
+ },
2825
+ ].filter(isNonNullable),
2826
+ };
2827
+ };
2828
+
2769
2829
  private createExecutionInputWithPureModelContextWithV1 = (
2770
2830
  data: V1_PureModelContext,
2771
2831
  mapping: string | undefined,
@@ -2857,7 +2917,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2857
2917
  this.engine.config.useDevClientProtocol
2858
2918
  ? V1_PureGraphManager.DEV_PROTOCOL_VERSION
2859
2919
  : V1_PureGraphManager.PROD_PROTOCOL_VERSION,
2860
- options?.parameterValues,
2920
+ options,
2861
2921
  ),
2862
2922
  options,
2863
2923
  _report,
@@ -2915,7 +2975,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2915
2975
  this.engine.config.useDevClientProtocol
2916
2976
  ? V1_PureGraphManager.DEV_PROTOCOL_VERSION
2917
2977
  : V1_PureGraphManager.PROD_PROTOCOL_VERSION,
2918
- options?.parameterValues,
2978
+ options,
2919
2979
  );
2920
2980
  stopWatch.record(GRAPH_MANAGER_EVENT.V1_ENGINE_OPERATION_INPUT__SUCCESS);
2921
2981
  const stream = await this.engine.exportData(input, options, contentType);
@@ -2984,7 +3044,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2984
3044
  testInfo.runtime,
2985
3045
  V1_PureGraphManager.PROD_PROTOCOL_VERSION,
2986
3046
  new V1_ExecuteInput(),
2987
- options?.parameterValues,
3047
+ options,
2988
3048
  );
2989
3049
  const result = V1_buildExecutionResult(
2990
3050
  (await this.engine.runQuery(input, options)).executionResult,
@@ -3096,7 +3156,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
3096
3156
  runtime,
3097
3157
  V1_PureGraphManager.DEV_PROTOCOL_VERSION,
3098
3158
  testDataGenerationExecuteInput,
3099
- options?.parameterValues,
3159
+ options,
3100
3160
  );
3101
3161
  testDataGenerationExecuteInput.parameters = parameters;
3102
3162
  testDataGenerationExecuteInput.hashStrings = Boolean(
@@ -3144,7 +3204,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
3144
3204
  runtime,
3145
3205
  V1_PureGraphManager.DEV_PROTOCOL_VERSION,
3146
3206
  testDataGenerationExecuteWithSeedInput,
3147
- options?.parameterValues,
3207
+ options,
3148
3208
  );
3149
3209
  testDataGenerationExecuteWithSeedInput.hashStrings = Boolean(
3150
3210
  options?.anonymizeGeneratedData,
@@ -74,5 +74,5 @@ export class V1_EntitlementsDataProductDetails {
74
74
  }
75
75
 
76
76
  export class V1_EntitlementsDataProductDetailsResponse {
77
- dataProducts: V1_EntitlementsDataProductDetails[] = [];
77
+ dataProducts?: V1_EntitlementsDataProductDetails[];
78
78
  }
@@ -34,6 +34,11 @@ import type { V1_TaggedValue } from '../domain/V1_TaggedValue.js';
34
34
 
35
35
  export const V1_DATA_PRODUCT_ELEMENT_PROTOCOL_TYPE = 'dataProduct';
36
36
 
37
+ export enum V1_DataProductTypeValue {
38
+ INTERNAL = 'internalDataProductType',
39
+ EXTERNAL = 'externalDataProductType',
40
+ }
41
+
37
42
  export abstract class V1_AccessPoint implements Hashable {
38
43
  id!: string;
39
44
  description: string | undefined;
@@ -222,13 +227,29 @@ export abstract class V1_DataProductIcon implements Hashable {
222
227
  abstract get hashCode(): string;
223
228
  }
224
229
 
225
- export class V1_EmbeddedImageIcon
230
+ export class V1_DataProductLibraryIcon
231
+ extends V1_DataProductIcon
232
+ implements Hashable
233
+ {
234
+ libraryId!: string;
235
+ iconId!: string;
236
+
237
+ override get hashCode(): string {
238
+ return hashArray([
239
+ CORE_HASH_STRUCTURE.DATA_PRODUCT_ICON_LIBRARY,
240
+ this.libraryId,
241
+ this.iconId,
242
+ ]);
243
+ }
244
+ }
245
+
246
+ export class V1_DataProductEmbeddedImageIcon
226
247
  extends V1_DataProductIcon
227
248
  implements Hashable
228
249
  {
229
250
  imageUrl!: string; // base64 encoded image content
230
251
 
231
- get hashCode(): string {
252
+ override get hashCode(): string {
232
253
  return hashArray([
233
254
  CORE_HASH_STRUCTURE.DATA_PRODUCT_ICON_EMBEDDED_IMAGE,
234
255
  this.imageUrl,
@@ -236,18 +257,40 @@ export class V1_EmbeddedImageIcon
236
257
  }
237
258
  }
238
259
 
239
- export class V1_LibraryIcon extends V1_DataProductIcon implements Hashable {
240
- libraryId!: string;
241
- iconId!: string;
242
- get hashCode(): string {
260
+ // handle incoming icons not yet modeled
261
+ export class V1_UnknownDataProductIcon
262
+ extends V1_DataProductIcon
263
+ implements Hashable
264
+ {
265
+ content!: PlainObject;
266
+
267
+ override get hashCode(): string {
243
268
  return hashArray([
244
- CORE_HASH_STRUCTURE.DATA_PRODUCT_ICON_LIBRARY,
245
- this.libraryId,
246
- this.iconId,
269
+ CORE_HASH_STRUCTURE.INTERNAL__UNKNOWN_DATA_PRODUCT_ICON,
270
+ hashObjectWithoutSourceInformation(this.content),
247
271
  ]);
248
272
  }
249
273
  }
250
274
 
275
+ export abstract class V1_DataProductType implements Hashable {
276
+ get hashCode(): string {
277
+ return hashArray([CORE_HASH_STRUCTURE.DATA_PRODUCT_TYPE]);
278
+ }
279
+ }
280
+
281
+ export class V1_InternalDataProductType extends V1_DataProductType {
282
+ _type = V1_DataProductTypeValue.INTERNAL;
283
+ }
284
+
285
+ export class V1_ExternalDataProductType extends V1_DataProductType {
286
+ _type = V1_DataProductTypeValue.EXTERNAL;
287
+ link!: V1_DataProductLink;
288
+
289
+ override get hashCode(): string {
290
+ return hashArray([CORE_HASH_STRUCTURE.DATA_PRODUCT_TYPE, this.link]);
291
+ }
292
+ }
293
+
251
294
  export class V1_DataProduct extends V1_PackageableElement implements Hashable {
252
295
  title: string | undefined;
253
296
  description: string | undefined;
@@ -256,6 +299,7 @@ export class V1_DataProduct extends V1_PackageableElement implements Hashable {
256
299
  icon: V1_DataProductIcon | undefined;
257
300
  accessPointGroups: V1_AccessPointGroup[] = [];
258
301
  supportInfo: V1_SupportInfo | undefined;
302
+ type: V1_DataProductType | undefined;
259
303
  stereotypes: V1_StereotypePtr[] = [];
260
304
  taggedValues: V1_TaggedValue[] = [];
261
305
 
@@ -269,6 +313,7 @@ export class V1_DataProduct extends V1_PackageableElement implements Hashable {
269
313
  this.icon ?? '',
270
314
  hashArray(this.accessPointGroups),
271
315
  this.supportInfo ?? '',
316
+ this.type ?? '',
272
317
  hashArray(this.stereotypes),
273
318
  hashArray(this.taggedValues),
274
319
  ]);
@@ -17,29 +17,37 @@
17
17
  import { UnsupportedOperationError } from '@finos/legend-shared';
18
18
  import {
19
19
  type AccessPoint,
20
- LakehouseAccessPoint,
21
- UnknownAccessPoint,
22
20
  type DataProduct,
23
- LibraryIcon,
24
- EmbeddedImageIcon,
21
+ type DataProductIcon,
22
+ DataProductEmbeddedImageIcon,
23
+ DataProductLibraryIcon,
24
+ LakehouseAccessPoint,
25
25
  ModelAccessPointGroup,
26
+ ExternalDataProductType,
27
+ InternalDataProductType,
28
+ UnknownAccessPoint,
29
+ UnknownDataProductIcon,
26
30
  } from '../../../../../../../graph/metamodel/pure/dataProduct/DataProduct.js';
27
31
  import {
28
32
  type V1_AccessPoint,
33
+ type V1_DataProductIcon,
34
+ type V1_DataProductRegion,
35
+ type V1_DeliveryFrequency,
29
36
  V1_AccessPointGroup,
30
37
  V1_DataProduct,
31
- type V1_DeliveryFrequency,
38
+ V1_DataProductDiagram,
39
+ V1_DataProductEmbeddedImageIcon,
40
+ V1_DataProductLibraryIcon,
41
+ V1_DataProductRuntimeInfo,
42
+ V1_ElementScope,
32
43
  V1_Email,
33
- V1_EmbeddedImageIcon,
34
44
  V1_LakehouseAccessPoint,
35
- V1_LibraryIcon,
45
+ V1_ModelAccessPointGroup,
36
46
  V1_SupportInfo,
37
47
  V1_UnknownAccessPoint,
38
- type V1_DataProductRegion,
39
- V1_ModelAccessPointGroup,
40
- V1_DataProductRuntimeInfo,
41
- V1_ElementScope,
42
- V1_DataProductDiagram,
48
+ V1_UnknownDataProductIcon,
49
+ V1_InternalDataProductType,
50
+ V1_ExternalDataProductType,
43
51
  } from '../../../model/packageableElements/dataProduct/V1_DataProduct.js';
44
52
  import { V1_initPackageableElement } from './V1_CoreTransformerHelper.js';
45
53
  import { V1_transformRawLambda } from './V1_RawValueSpecificationTransformer.js';
@@ -74,6 +82,28 @@ const transformAccessPoint = (
74
82
  );
75
83
  };
76
84
 
85
+ const transformDataProductIcon = (
86
+ icon: DataProductIcon,
87
+ ): V1_DataProductIcon => {
88
+ if (icon instanceof DataProductLibraryIcon) {
89
+ const dataProductLibraryIcon = new V1_DataProductLibraryIcon();
90
+ dataProductLibraryIcon.libraryId = icon.libraryId;
91
+ dataProductLibraryIcon.iconId = icon.iconId;
92
+ return dataProductLibraryIcon;
93
+ } else if (icon instanceof DataProductEmbeddedImageIcon) {
94
+ const dataProductEmbeddedImageIcon = new V1_DataProductEmbeddedImageIcon();
95
+ dataProductEmbeddedImageIcon.imageUrl = icon.imageUrl;
96
+ return dataProductEmbeddedImageIcon;
97
+ } else if (icon instanceof UnknownDataProductIcon) {
98
+ const unknownDataProductIcon = new V1_UnknownDataProductIcon();
99
+ unknownDataProductIcon.content = icon.content;
100
+ return unknownDataProductIcon;
101
+ }
102
+ throw new UnsupportedOperationError(
103
+ `Can't transform data product icon type: ${icon}`,
104
+ );
105
+ };
106
+
77
107
  export const V1_transformDataProduct = (
78
108
  element: DataProduct,
79
109
  context: V1_GraphTransformerContext,
@@ -88,16 +118,20 @@ export const V1_transformDataProduct = (
88
118
  product.coverageRegions = element.coverageRegions as
89
119
  | V1_DataProductRegion[]
90
120
  | undefined;
91
- if (element.icon instanceof LibraryIcon) {
92
- const libIcon = new V1_LibraryIcon();
93
- libIcon.libraryId = element.icon.libraryId;
94
- libIcon.iconId = element.icon.iconId;
95
- product.icon = libIcon;
96
- } else if (element.icon instanceof EmbeddedImageIcon) {
97
- const embeddedIcon = new V1_EmbeddedImageIcon();
98
- embeddedIcon.imageUrl = element.icon.imageUrl;
99
- product.icon = embeddedIcon;
121
+ if (element.type instanceof InternalDataProductType) {
122
+ product.type = new V1_InternalDataProductType();
123
+ } else if (element.type instanceof ExternalDataProductType) {
124
+ const dataProductType = new V1_ExternalDataProductType();
125
+ dataProductType.link = element.type.link;
126
+ product.type = dataProductType;
100
127
  }
128
+
129
+ if (!element.icon) {
130
+ product.icon = undefined;
131
+ } else {
132
+ product.icon = transformDataProductIcon(element.icon);
133
+ }
134
+
101
135
  if (!element.supportInfo) {
102
136
  product.supportInfo = undefined;
103
137
  } else {
@@ -114,6 +148,7 @@ export const V1_transformDataProduct = (
114
148
  });
115
149
  product.supportInfo = supportInfo;
116
150
  }
151
+
117
152
  product.accessPointGroups = element.accessPointGroups.map(
118
153
  (metamodelGroup) => {
119
154
  if (metamodelGroup instanceof ModelAccessPointGroup) {
@@ -181,9 +216,11 @@ export const V1_transformDataProduct = (
181
216
  return group;
182
217
  },
183
218
  );
219
+
184
220
  product.stereotypes = element.stereotypes.map(V1_transformStereotype);
185
221
  product.taggedValues = element.taggedValues.map((taggedValue) =>
186
222
  V1_transformTaggedValue(taggedValue),
187
223
  );
224
+
188
225
  return product;
189
226
  };
@@ -117,11 +117,17 @@ import {
117
117
  } from './helpers/V1_FunctionActivatorBuilderHelper.js';
118
118
  import type { V1_INTERNAL__UnknownElement } from '../../../model/packageableElements/V1_INTERNAL__UnknownElement.js';
119
119
  import type { V1_HostedService } from '../../../model/packageableElements/function/V1_HostedService.js';
120
- import { type V1_DataProduct } from '../../../model/packageableElements/dataProduct/V1_DataProduct.js';
120
+ import {
121
+ V1_ExternalDataProductType,
122
+ V1_InternalDataProductType,
123
+ type V1_DataProduct,
124
+ } from '../../../model/packageableElements/dataProduct/V1_DataProduct.js';
121
125
  import {
122
126
  type DataProduct_DeliveryFrequency,
123
127
  type DataProduct_Region,
124
128
  Email,
129
+ ExternalDataProductType,
130
+ InternalDataProductType,
125
131
  SupportInfo,
126
132
  } from '../../../../../../../graph/metamodel/pure/dataProduct/DataProduct.js';
127
133
  import {
@@ -726,6 +732,13 @@ export class V1_ElementSecondPassBuilder
726
732
  });
727
733
  dataProduct.supportInfo = supportInfo;
728
734
  }
735
+ if (element.type instanceof V1_InternalDataProductType) {
736
+ dataProduct.type = new InternalDataProductType();
737
+ } else if (element.type instanceof V1_ExternalDataProductType) {
738
+ const dataProductType = new ExternalDataProductType();
739
+ dataProductType.link = element.type.link;
740
+ dataProduct.type = dataProductType;
741
+ }
729
742
  dataProduct.deliveryFrequency = element.deliveryFrequency as
730
743
  | DataProduct_DeliveryFrequency
731
744
  | undefined;