@finos/legend-graph 32.3.22 → 32.3.24

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 (90) hide show
  1. package/lib/graph/Core_HashUtils.d.ts +5 -0
  2. package/lib/graph/Core_HashUtils.d.ts.map +1 -1
  3. package/lib/graph/Core_HashUtils.js +5 -0
  4. package/lib/graph/Core_HashUtils.js.map +1 -1
  5. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts +30 -0
  6. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts.map +1 -1
  7. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js +76 -1
  8. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js.map +1 -1
  9. package/lib/graph/metamodel/pure/packageableElements/service/Service.d.ts +1 -0
  10. package/lib/graph/metamodel/pure/packageableElements/service/Service.d.ts.map +1 -1
  11. package/lib/graph/metamodel/pure/packageableElements/service/Service.js +2 -0
  12. package/lib/graph/metamodel/pure/packageableElements/service/Service.js.map +1 -1
  13. package/lib/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.d.ts.map +1 -1
  14. package/lib/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.js +1 -0
  15. package/lib/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.js.map +1 -1
  16. package/lib/graph-manager/action/validation/DSL_Service_ValidationHelper.d.ts +1 -0
  17. package/lib/graph-manager/action/validation/DSL_Service_ValidationHelper.d.ts.map +1 -1
  18. package/lib/graph-manager/action/validation/DSL_Service_ValidationHelper.js +14 -0
  19. package/lib/graph-manager/action/validation/DSL_Service_ValidationHelper.js.map +1 -1
  20. package/lib/graph-manager/protocol/pure/v1/lakehouse/deploy/V1_DataProductArtifact.d.ts +89 -0
  21. package/lib/graph-manager/protocol/pure/v1/lakehouse/deploy/V1_DataProductArtifact.d.ts.map +1 -1
  22. package/lib/graph-manager/protocol/pure/v1/lakehouse/deploy/V1_DataProductArtifact.js +195 -2
  23. package/lib/graph-manager/protocol/pure/v1/lakehouse/deploy/V1_DataProductArtifact.js.map +1 -1
  24. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_ConsumerEntitlements.d.ts +6 -2
  25. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_ConsumerEntitlements.d.ts.map +1 -1
  26. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_ConsumerEntitlements.js +4 -0
  27. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_ConsumerEntitlements.js.map +1 -1
  28. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.d.ts +1 -0
  29. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.d.ts.map +1 -1
  30. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.js +1 -0
  31. package/lib/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.js.map +1 -1
  32. package/lib/graph-manager/protocol/pure/v1/lakehouse/helpers/V1_ConsumerEntitlementsUtils.d.ts.map +1 -1
  33. package/lib/graph-manager/protocol/pure/v1/lakehouse/helpers/V1_ConsumerEntitlementsUtils.js +20 -7
  34. package/lib/graph-manager/protocol/pure/v1/lakehouse/helpers/V1_ConsumerEntitlementsUtils.js.map +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.d.ts +30 -0
  36. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.d.ts.map +1 -1
  37. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.js +67 -0
  38. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.js.map +1 -1
  39. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.d.ts +1 -0
  40. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.d.ts.map +1 -1
  41. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.js +2 -0
  42. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.js.map +1 -1
  43. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.d.ts.map +1 -1
  44. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.js +74 -2
  45. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.js.map +1 -1
  46. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.d.ts.map +1 -1
  47. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.js +1 -0
  48. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.js.map +1 -1
  49. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.d.ts.map +1 -1
  50. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js +5 -1
  51. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js.map +1 -1
  52. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts +5 -2
  53. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.d.ts.map +1 -1
  54. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js +93 -3
  55. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js.map +1 -1
  56. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.d.ts +10 -1
  57. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.d.ts.map +1 -1
  58. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.js +53 -1
  59. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.js.map +1 -1
  60. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.d.ts.map +1 -1
  61. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js +3 -0
  62. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.js.map +1 -1
  63. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.d.ts.map +1 -1
  64. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.js +1 -0
  65. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.js.map +1 -1
  66. package/lib/index.d.ts +2 -2
  67. package/lib/index.d.ts.map +1 -1
  68. package/lib/index.js +2 -2
  69. package/lib/index.js.map +1 -1
  70. package/lib/package.json +1 -1
  71. package/package.json +1 -1
  72. package/src/graph/Core_HashUtils.ts +5 -0
  73. package/src/graph/metamodel/pure/dataProduct/DataProduct.ts +89 -1
  74. package/src/graph/metamodel/pure/packageableElements/service/Service.ts +2 -0
  75. package/src/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.ts +1 -0
  76. package/src/graph-manager/action/validation/DSL_Service_ValidationHelper.ts +19 -0
  77. package/src/graph-manager/protocol/pure/v1/lakehouse/deploy/V1_DataProductArtifact.ts +294 -0
  78. package/src/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_ConsumerEntitlements.ts +5 -1
  79. package/src/graph-manager/protocol/pure/v1/lakehouse/entitlements/V1_EntitlementsDataProduct.ts +1 -0
  80. package/src/graph-manager/protocol/pure/v1/lakehouse/helpers/V1_ConsumerEntitlementsUtils.ts +24 -10
  81. package/src/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.ts +77 -0
  82. package/src/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.ts +2 -0
  83. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.ts +105 -0
  84. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.ts +1 -0
  85. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.ts +8 -0
  86. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.ts +161 -1
  87. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.ts +92 -0
  88. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_EntitlementSerializationHelper.ts +3 -0
  89. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.ts +1 -0
  90. package/src/index.ts +13 -0
@@ -54,6 +54,7 @@ export class V1_DataContract {
54
54
  members: V1_ContractUserMembership[] = [];
55
55
  consumer!: V1_OrganizationalScope;
56
56
  createdBy!: string;
57
+ createdAt!: string;
57
58
  }
58
59
 
59
60
  export class V1_DataContractSubscriptions {
@@ -81,6 +82,7 @@ export class V1_LiteDataContract {
81
82
  members: V1_ContractUserMembership[] = [];
82
83
  consumer!: V1_OrganizationalScope;
83
84
  createdBy!: string;
85
+ createdAt!: string;
84
86
  resourceId!: string;
85
87
  resourceType!: V1_ResourceType;
86
88
  deploymentId!: number;
@@ -93,8 +95,9 @@ export class V1_LiteDataContractsResponse {
93
95
 
94
96
  export class V1_LiteDataContractWithUserStatus {
95
97
  contractResultLite!: V1_LiteDataContract;
96
- status!: V1_UserApprovalStatus;
98
+ status!: V1_EnrichedUserApprovalStatus;
97
99
  pendingTaskWithAssignees!: V1_PendingTaskWithAssignees | null;
100
+ user!: string;
98
101
  }
99
102
 
100
103
  // -------------------------------------- Data Contract Approval ---------------------------------------
@@ -130,6 +133,7 @@ export enum V1_ResourceType {
130
133
  ACCESS_POINT_GROUP = 'ACCESS_POINT_GROUP',
131
134
  DATA_PRODUCT = 'DATA_PRODUCT',
132
135
  DATA_BUNDLE = 'DATA_BUNDLE',
136
+ UNKNOWN = 'UNKNOWN',
133
137
  }
134
138
 
135
139
  export enum V1_ApprovalType {
@@ -81,6 +81,7 @@ export class V1_EntitlementsDataProductLite {
81
81
  description?: string;
82
82
  origin?: V1_EntitlementsDataProductOrigin | null;
83
83
  fullPath?: string;
84
+ lakehouseEnvironment?: V1_EntitlementsLakehouseEnvironment | null;
84
85
  }
85
86
 
86
87
  export class V1_EntitlementsDataProductDetailsResponse {
@@ -16,20 +16,33 @@
16
16
 
17
17
  import {
18
18
  V1_AccessPointGroupReference,
19
+ V1_DataBundle,
19
20
  V1_ResourceType,
20
21
  type V1_DataContract,
21
22
  type V1_LiteDataContract,
22
23
  } from '../entitlements/V1_ConsumerEntitlements.js';
23
- import { guaranteeType } from '@finos/legend-shared';
24
24
 
25
25
  export const V1_transformDataContractToLiteDatacontract = (
26
26
  dataContract: V1_DataContract,
27
27
  ): V1_LiteDataContract => {
28
- const accessPointGroupReference = guaranteeType(
29
- dataContract.resource,
30
- V1_AccessPointGroupReference,
31
- 'Only access point group reference is supported',
32
- );
28
+ const dataProductName =
29
+ dataContract.resource instanceof V1_AccessPointGroupReference
30
+ ? dataContract.resource.dataProduct.name
31
+ : 'Unknown';
32
+ const deploymentId =
33
+ dataContract.resource instanceof V1_AccessPointGroupReference
34
+ ? dataContract.resource.dataProduct.owner.appDirId
35
+ : -1;
36
+ const accessPointGroup =
37
+ dataContract.resource instanceof V1_AccessPointGroupReference
38
+ ? dataContract.resource.accessPointGroup
39
+ : 'Unknown';
40
+ const resourceType =
41
+ dataContract.resource instanceof V1_AccessPointGroupReference
42
+ ? V1_ResourceType.ACCESS_POINT_GROUP
43
+ : dataContract.resource instanceof V1_DataBundle
44
+ ? V1_ResourceType.DATA_BUNDLE
45
+ : V1_ResourceType.UNKNOWN;
33
46
  const liteDataContract: V1_LiteDataContract = {
34
47
  description: dataContract.description,
35
48
  guid: dataContract.guid,
@@ -38,10 +51,11 @@ export const V1_transformDataContractToLiteDatacontract = (
38
51
  members: dataContract.members,
39
52
  consumer: dataContract.consumer,
40
53
  createdBy: dataContract.createdBy,
41
- resourceId: accessPointGroupReference.dataProduct.name,
42
- resourceType: V1_ResourceType.ACCESS_POINT_GROUP,
43
- deploymentId: accessPointGroupReference.dataProduct.owner.appDirId,
44
- accessPointGroup: accessPointGroupReference.accessPointGroup,
54
+ resourceId: dataProductName,
55
+ createdAt: dataContract.createdAt,
56
+ resourceType,
57
+ deploymentId,
58
+ accessPointGroup,
45
59
  };
46
60
  return liteDataContract;
47
61
  };
@@ -220,6 +220,81 @@ export class V1_ModelAccessPointGroup extends V1_AccessPointGroup {
220
220
  }
221
221
  }
222
222
 
223
+ export class V1_NativeModelExecutionContext {
224
+ key!: string;
225
+ mapping!: V1_PackageableElementPointer;
226
+ runtime: V1_PackageableElementPointer | undefined;
227
+
228
+ get hashCode(): string {
229
+ return hashArray([
230
+ CORE_HASH_STRUCTURE.DATA_PRODUCT_NATIVE_MODEL_EXECUTION_CONTEXT,
231
+ this.key,
232
+ this.mapping.path,
233
+ this.runtime?.path ?? '',
234
+ ]);
235
+ }
236
+ }
237
+
238
+ export class V1_NativeModelAccess {
239
+ featuredElements: V1_ElementScope[] | undefined;
240
+ nativeModelExecutionContexts!: V1_NativeModelExecutionContext[];
241
+ defaultExecutionContext!: string;
242
+ diagrams: V1_DataProductDiagram[] | undefined;
243
+ sampleQueries: V1_SampleQuery[] | undefined;
244
+
245
+ get hashCode(): string {
246
+ return hashArray([
247
+ CORE_HASH_STRUCTURE.DATA_PRODUCT_NATIVE_MODEL_ACCESS,
248
+ hashArray(this.nativeModelExecutionContexts),
249
+ hashArray(this.featuredElements ?? []),
250
+ hashArray(this.diagrams ?? []),
251
+ hashArray(this.sampleQueries ?? []),
252
+ this.defaultExecutionContext,
253
+ ]);
254
+ }
255
+ }
256
+
257
+ export abstract class V1_SampleQuery {
258
+ id!: string;
259
+ title!: string;
260
+ description: string | undefined;
261
+ executionContextKey: string | undefined;
262
+
263
+ get hashCode(): string {
264
+ return hashArray([
265
+ CORE_HASH_STRUCTURE.DATA_PRODUCT_SAMPLE_QUERY,
266
+ this.id,
267
+ this.title,
268
+ this.description ?? '',
269
+ this.executionContextKey ?? '',
270
+ ]);
271
+ }
272
+ }
273
+
274
+ export class V1_InLineSampleQuery extends V1_SampleQuery {
275
+ query!: V1_RawLambda;
276
+
277
+ override get hashCode(): string {
278
+ return hashArray([
279
+ CORE_HASH_STRUCTURE.DATA_PRODUCT_INLINE_SAMPLE_QUERY,
280
+ super.hashCode,
281
+ this.query,
282
+ ]);
283
+ }
284
+ }
285
+
286
+ export class V1_PackageableElementSampleQuery extends V1_SampleQuery {
287
+ query!: V1_PackageableElementPointer;
288
+
289
+ override get hashCode(): string {
290
+ return hashArray([
291
+ CORE_HASH_STRUCTURE.DATA_PRODUCT_PACKAGEABLE_ELEMENT_SAMPLE_QUERY,
292
+ super.hashCode,
293
+ this.query.path,
294
+ ]);
295
+ }
296
+ }
297
+
223
298
  export enum V1_DeliveryFrequency {
224
299
  DAILY = 'DAILY',
225
300
  WEEKLY = 'WEEKLY',
@@ -337,6 +412,7 @@ export class V1_DataProduct extends V1_PackageableElement implements Hashable {
337
412
  description: string | undefined;
338
413
  icon: V1_DataProductIcon | undefined;
339
414
  accessPointGroups: V1_AccessPointGroup[] = [];
415
+ nativeModelAccess: V1_NativeModelAccess | undefined;
340
416
  supportInfo: V1_SupportInfo | undefined;
341
417
  type: V1_DataProductType | undefined;
342
418
  stereotypes: V1_StereotypePtr[] = [];
@@ -351,6 +427,7 @@ export class V1_DataProduct extends V1_PackageableElement implements Hashable {
351
427
  this.description ?? '',
352
428
  this.icon ?? '',
353
429
  hashArray(this.accessPointGroups),
430
+ this.nativeModelAccess ?? '',
354
431
  this.supportInfo ?? '',
355
432
  this.type ?? '',
356
433
  hashArray(this.stereotypes),
@@ -35,6 +35,7 @@ export class V1_Service extends V1_PackageableElement implements Hashable {
35
35
  owners: string[] = [];
36
36
  ownership?: V1_ServiceOwnership | undefined;
37
37
  documentation!: string;
38
+ mcpServer?: string | undefined;
38
39
  autoActivateUpdates = true;
39
40
  execution!: V1_ServiceExecution;
40
41
  test?: V1_DEPRECATED__ServiceTest | undefined;
@@ -54,6 +55,7 @@ export class V1_Service extends V1_PackageableElement implements Hashable {
54
55
  this.autoActivateUpdates.toString(),
55
56
  this.execution,
56
57
  this.test ?? '',
58
+ this.mcpServer ?? '',
57
59
  hashArray(this.testSuites),
58
60
  hashArray(this.postValidations),
59
61
  hashArray(this.taggedValues),
@@ -28,6 +28,8 @@ import {
28
28
  UnknownAccessPoint,
29
29
  UnknownDataProductIcon,
30
30
  FunctionAccessPoint,
31
+ PackageableElementSampleQuery,
32
+ InLineSampleQuery,
31
33
  } from '../../../../../../../graph/metamodel/pure/dataProduct/DataProduct.js';
32
34
  import {
33
35
  type V1_AccessPoint,
@@ -51,6 +53,10 @@ import {
51
53
  V1_FunctionAccessPoint,
52
54
  type V1_Expertise,
53
55
  V1_DataProductOperationalMetadata,
56
+ V1_NativeModelAccess,
57
+ V1_PackageableElementSampleQuery,
58
+ V1_InLineSampleQuery,
59
+ V1_NativeModelExecutionContext,
54
60
  } from '../../../model/packageableElements/dataProduct/V1_DataProduct.js';
55
61
  import { V1_initPackageableElement } from './V1_CoreTransformerHelper.js';
56
62
  import { V1_transformRawLambda } from './V1_RawValueSpecificationTransformer.js';
@@ -61,6 +67,8 @@ import {
61
67
  } from './V1_DomainTransformer.js';
62
68
  import { V1_PackageableElementPointer } from '../../../model/packageableElements/V1_PackageableElement.js';
63
69
  import { V1_transformEmbeddedData } from './V1_DataElementTransformer.js';
70
+ import { ConcreteFunctionDefinition } from '../../../../../../../graph/metamodel/pure/packageableElements/function/ConcreteFunctionDefinition.js';
71
+ import { generateFunctionPrettyName } from '../../../../../../../graph/helpers/PureLanguageHelper.js';
64
72
 
65
73
  const transformAccessPoint = (
66
74
  ap: AccessPoint,
@@ -137,6 +145,103 @@ export const V1_transformDataProduct = (
137
145
  product.type = dataProductType;
138
146
  }
139
147
 
148
+ if (element.nativeModelAccess) {
149
+ const nativeModelAccess = new V1_NativeModelAccess();
150
+ const metamodelNativeModelAccess = element.nativeModelAccess;
151
+ if (metamodelNativeModelAccess.diagrams.length === 0) {
152
+ nativeModelAccess.diagrams = undefined;
153
+ } else {
154
+ nativeModelAccess.diagrams = metamodelNativeModelAccess.diagrams.map(
155
+ (diagram) => {
156
+ const v1Diagram = new V1_DataProductDiagram();
157
+ v1Diagram.title = diagram.title;
158
+ v1Diagram.description = diagram.description;
159
+ v1Diagram.diagram = new V1_PackageableElementPointer(
160
+ undefined,
161
+ diagram.diagram.path,
162
+ );
163
+ return v1Diagram;
164
+ },
165
+ );
166
+ }
167
+ nativeModelAccess.defaultExecutionContext =
168
+ metamodelNativeModelAccess.defaultExecutionContext;
169
+ nativeModelAccess.nativeModelExecutionContexts =
170
+ metamodelNativeModelAccess.nativeModelExecutionContexts.map(
171
+ (executionContext) => {
172
+ const v1ExecutionContext = new V1_NativeModelExecutionContext();
173
+ v1ExecutionContext.key = executionContext.key;
174
+ v1ExecutionContext.mapping = new V1_PackageableElementPointer(
175
+ undefined,
176
+ executionContext.mapping.valueForSerialization ?? '',
177
+ );
178
+ if (executionContext.runtime) {
179
+ v1ExecutionContext.runtime = new V1_PackageableElementPointer(
180
+ undefined,
181
+ executionContext.runtime.valueForSerialization ?? '',
182
+ );
183
+ }
184
+ return v1ExecutionContext;
185
+ },
186
+ );
187
+ nativeModelAccess.featuredElements =
188
+ metamodelNativeModelAccess.featuredElements.map((metatamodelScope) => {
189
+ const scope = new V1_ElementScope();
190
+ scope.exclude = metatamodelScope.exclude;
191
+ scope.element = new V1_PackageableElementPointer(
192
+ undefined,
193
+ metatamodelScope.element.valueForSerialization ?? '',
194
+ );
195
+ return scope;
196
+ });
197
+ nativeModelAccess.sampleQueries =
198
+ metamodelNativeModelAccess.sampleQueries.map((metamodelSampleQuery) => {
199
+ if (metamodelSampleQuery instanceof PackageableElementSampleQuery) {
200
+ const sampleQuery = new V1_PackageableElementSampleQuery();
201
+ sampleQuery.id = metamodelSampleQuery.id;
202
+ sampleQuery.title = metamodelSampleQuery.title;
203
+ sampleQuery.description = metamodelSampleQuery.description;
204
+ sampleQuery.executionContextKey =
205
+ metamodelSampleQuery.executionContextKey;
206
+ if (
207
+ metamodelSampleQuery.query.value instanceof
208
+ ConcreteFunctionDefinition
209
+ ) {
210
+ sampleQuery.query = new V1_PackageableElementPointer(
211
+ undefined,
212
+ generateFunctionPrettyName(metamodelSampleQuery.query.value, {
213
+ fullPath: true,
214
+ spacing: false,
215
+ notIncludeParamName: true,
216
+ }),
217
+ );
218
+ } else {
219
+ sampleQuery.query = new V1_PackageableElementPointer(
220
+ undefined,
221
+ metamodelSampleQuery.query.valueForSerialization ?? '',
222
+ );
223
+ }
224
+ return sampleQuery;
225
+ } else if (metamodelSampleQuery instanceof InLineSampleQuery) {
226
+ const sampleQuery = new V1_InLineSampleQuery();
227
+ sampleQuery.id = metamodelSampleQuery.id;
228
+ sampleQuery.title = metamodelSampleQuery.title;
229
+ sampleQuery.description = metamodelSampleQuery.description;
230
+ sampleQuery.executionContextKey =
231
+ metamodelSampleQuery.executionContextKey;
232
+ sampleQuery.query = V1_transformRawLambda(
233
+ metamodelSampleQuery.query,
234
+ context,
235
+ );
236
+ return sampleQuery;
237
+ }
238
+ throw new UnsupportedOperationError(
239
+ `Unable to transform data product sample query`,
240
+ );
241
+ });
242
+ product.nativeModelAccess = nativeModelAccess;
243
+ }
244
+
140
245
  if (!element.icon) {
141
246
  product.icon = undefined;
142
247
  } else {
@@ -332,6 +332,7 @@ export const V1_transformService = (
332
332
  service.stereotypes = element.stereotypes.map(V1_transformStereotype);
333
333
  service.taggedValues = element.taggedValues.map(V1_transformTaggedValue);
334
334
  service.autoActivateUpdates = element.autoActivateUpdates;
335
+ service.mcpServer = element.mcpServer;
335
336
  service.documentation = element.documentation;
336
337
  service.execution = transformServiceExecution(element.execution, context);
337
338
  if (element.ownership) {
@@ -143,6 +143,7 @@ import {
143
143
  V1_buildDataProductIcon,
144
144
  V1_buildDataProductLink,
145
145
  V1_buildDataProductOperationalMetadata,
146
+ V1_buildNativeModelAccess,
146
147
  } from './helpers/V1_DataProductBuilder.js';
147
148
  import type { V1_IngestDefinition } from '../../../model/packageableElements/ingest/V1_IngestDefinition.js';
148
149
  import { IncludeStore } from '../../../../../../../graph/metamodel/pure/packageableElements/store/relational/model/IncludeStore.js';
@@ -619,6 +620,7 @@ export class V1_ElementSecondPassBuilder
619
620
  service.owners = element.owners.slice();
620
621
  service.documentation = element.documentation;
621
622
  service.autoActivateUpdates = element.autoActivateUpdates;
623
+ service.mcpServer = element.mcpServer;
622
624
  if (element.ownership) {
623
625
  service.ownership = V1_buildServiceOwnership(element.ownership, service);
624
626
  }
@@ -751,6 +753,12 @@ export class V1_ElementSecondPassBuilder
751
753
  dataProduct.accessPointGroups = element.accessPointGroups.map((gr) =>
752
754
  V1_buildAccessPointGroup(gr, this.context),
753
755
  );
756
+ if (element.nativeModelAccess) {
757
+ dataProduct.nativeModelAccess = V1_buildNativeModelAccess(
758
+ element.nativeModelAccess,
759
+ this.context,
760
+ );
761
+ }
754
762
  const protocolSupportInfo = element.supportInfo;
755
763
  if (protocolSupportInfo) {
756
764
  const supportInfo = new SupportInfo();
@@ -14,7 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { isNonNullable, UnsupportedOperationError } from '@finos/legend-shared';
17
+ import {
18
+ guaranteeNonNullable,
19
+ isNonNullable,
20
+ UnsupportedOperationError,
21
+ } from '@finos/legend-shared';
18
22
  import {
19
23
  type AccessPoint,
20
24
  type DataProductElement,
@@ -33,6 +37,12 @@ import {
33
37
  ModelAccessPointGroup,
34
38
  UnknownAccessPoint,
35
39
  UnknownDataProductIcon,
40
+ NativeModelAccess,
41
+ type SampleQuery,
42
+ PackageableElementSampleQuery,
43
+ InLineSampleQuery,
44
+ DataProductDiagram,
45
+ NativeModelExecutionContext,
36
46
  } from '../../../../../../../../graph/metamodel/pure/dataProduct/DataProduct.js';
37
47
  import {
38
48
  type V1_AccessPoint,
@@ -45,9 +55,14 @@ import {
45
55
  V1_FunctionAccessPoint,
46
56
  V1_LakehouseAccessPoint,
47
57
  V1_ModelAccessPointGroup,
58
+ type V1_NativeModelAccess,
59
+ type V1_SampleQuery,
48
60
  V1_UnknownAccessPoint,
49
61
  V1_UnknownDataProductIcon,
50
62
  type V1_DataProductOperationalMetadata,
63
+ V1_PackageableElementSampleQuery,
64
+ V1_InLineSampleQuery,
65
+ type V1_NativeModelExecutionContext,
51
66
  } from '../../../../model/packageableElements/dataProduct/V1_DataProduct.js';
52
67
  import type { V1_GraphBuilderContext } from '../V1_GraphBuilderContext.js';
53
68
  import { V1_buildRawLambdaWithResolvedPaths } from './V1_ValueSpecificationPathResolver.js';
@@ -59,6 +74,7 @@ import { Package } from '../../../../../../../../graph/metamodel/pure/packageabl
59
74
  import { Class } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Class.js';
60
75
  import { Enumeration } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Enumeration.js';
61
76
  import { Association } from '../../../../../../../../graph/metamodel/pure/packageableElements/domain/Association.js';
77
+ import { generateFunctionPrettyName } from '../../../../../../../../graph/helpers/PureLanguageHelper.js';
62
78
 
63
79
  export const V1_buildDataProductLink = (
64
80
  link: V1_DataProductLink,
@@ -202,3 +218,147 @@ export const V1_buildAccessPointGroup = (
202
218
  return group;
203
219
  }
204
220
  };
221
+
222
+ export const V1_buildNativeModelExecutionContext = (
223
+ nativeModelExecutionContext: V1_NativeModelExecutionContext,
224
+ context: V1_GraphBuilderContext,
225
+ ): NativeModelExecutionContext => {
226
+ const metamodelNativeModelExecutionContext =
227
+ new NativeModelExecutionContext();
228
+ metamodelNativeModelExecutionContext.key = nativeModelExecutionContext.key;
229
+ metamodelNativeModelExecutionContext.mapping =
230
+ PackageableElementExplicitReference.create(
231
+ context.graph.getMapping(nativeModelExecutionContext.mapping.path),
232
+ );
233
+ if (nativeModelExecutionContext.runtime) {
234
+ metamodelNativeModelExecutionContext.runtime =
235
+ PackageableElementExplicitReference.create(
236
+ context.graph.getRuntime(nativeModelExecutionContext.runtime.path),
237
+ );
238
+ }
239
+ return metamodelNativeModelExecutionContext;
240
+ };
241
+
242
+ export const V1_buildSampleQuery = (
243
+ sampleQuery: V1_SampleQuery,
244
+ defaultExecutionContext: string,
245
+ context: V1_GraphBuilderContext,
246
+ ): SampleQuery => {
247
+ if (sampleQuery instanceof V1_PackageableElementSampleQuery) {
248
+ const metamodelSampleQuery = new PackageableElementSampleQuery();
249
+ metamodelSampleQuery.id = sampleQuery.id;
250
+ metamodelSampleQuery.title = sampleQuery.title;
251
+ metamodelSampleQuery.description = sampleQuery.description;
252
+ metamodelSampleQuery.executionContextKey =
253
+ sampleQuery.executionContextKey ?? defaultExecutionContext;
254
+ try {
255
+ metamodelSampleQuery.query = context.resolveElement(
256
+ sampleQuery.query.path,
257
+ false,
258
+ );
259
+ } catch {
260
+ try {
261
+ metamodelSampleQuery.query = PackageableElementExplicitReference.create(
262
+ guaranteeNonNullable(
263
+ context.graph.functions.find(
264
+ (fn) =>
265
+ generateFunctionPrettyName(fn, {
266
+ fullPath: true,
267
+ spacing: false,
268
+ notIncludeParamName: true,
269
+ }) === sampleQuery.query.path.replaceAll(/\s*/gu, ''),
270
+ ),
271
+ ),
272
+ );
273
+ } catch {
274
+ throw new UnsupportedOperationError(
275
+ `Can't analyze data product executable with element in path: ${sampleQuery.query.path}`,
276
+ sampleQuery,
277
+ );
278
+ }
279
+ }
280
+
281
+ return metamodelSampleQuery;
282
+ } else if (sampleQuery instanceof V1_InLineSampleQuery) {
283
+ const metamodelSampleQuery = new InLineSampleQuery();
284
+ metamodelSampleQuery.id = sampleQuery.id;
285
+ metamodelSampleQuery.title = sampleQuery.title;
286
+ metamodelSampleQuery.description = sampleQuery.description;
287
+ metamodelSampleQuery.executionContextKey =
288
+ sampleQuery.executionContextKey ?? defaultExecutionContext;
289
+ metamodelSampleQuery.query = V1_buildRawLambdaWithResolvedPaths(
290
+ sampleQuery.query.parameters,
291
+ sampleQuery.query.body,
292
+ context,
293
+ );
294
+ return metamodelSampleQuery;
295
+ }
296
+
297
+ throw new UnsupportedOperationError(
298
+ `Unsupported data product sample query type`,
299
+ );
300
+ };
301
+
302
+ export const V1_buildNativeModelAccess = (
303
+ nativeModelAccess: V1_NativeModelAccess,
304
+ context: V1_GraphBuilderContext,
305
+ ): NativeModelAccess => {
306
+ const metamodelNativeModelAccess = new NativeModelAccess();
307
+ metamodelNativeModelAccess.defaultExecutionContext =
308
+ nativeModelAccess.defaultExecutionContext;
309
+ metamodelNativeModelAccess.nativeModelExecutionContexts =
310
+ nativeModelAccess.nativeModelExecutionContexts.map((executionContext) =>
311
+ V1_buildNativeModelExecutionContext(executionContext, context),
312
+ );
313
+ if (nativeModelAccess.sampleQueries) {
314
+ metamodelNativeModelAccess.sampleQueries =
315
+ nativeModelAccess.sampleQueries.map((sampleQuery) =>
316
+ V1_buildSampleQuery(
317
+ sampleQuery,
318
+ nativeModelAccess.defaultExecutionContext,
319
+ context,
320
+ ),
321
+ );
322
+ }
323
+ if (!nativeModelAccess.diagrams) {
324
+ metamodelNativeModelAccess.diagrams = [];
325
+ } else {
326
+ metamodelNativeModelAccess.diagrams = nativeModelAccess.diagrams.map(
327
+ (diagram) => {
328
+ const metadatamodelDiagram = new DataProductDiagram();
329
+ metadatamodelDiagram.diagram = context.graph.getElement(
330
+ diagram.diagram.path,
331
+ );
332
+ metadatamodelDiagram.title = diagram.title;
333
+ metadatamodelDiagram.description = diagram.description;
334
+ return metadatamodelDiagram;
335
+ },
336
+ );
337
+ }
338
+ if (nativeModelAccess.featuredElements) {
339
+ metamodelNativeModelAccess.featuredElements =
340
+ nativeModelAccess.featuredElements.map((pointer) => {
341
+ const elementReference = context.resolveElement(
342
+ pointer.element.path,
343
+ true,
344
+ );
345
+ if (
346
+ elementReference.value instanceof Package ||
347
+ elementReference.value instanceof Class ||
348
+ elementReference.value instanceof Enumeration ||
349
+ elementReference.value instanceof Association
350
+ ) {
351
+ const elementPointer = new DataProductElementScope();
352
+ elementPointer.element =
353
+ elementReference as unknown as PackageableElementReference<DataProductElement>;
354
+ elementPointer.exclude = pointer.exclude;
355
+ return elementPointer;
356
+ }
357
+ throw new UnsupportedOperationError(
358
+ `Can't find data product element (only allow packages, classes, enumerations, and associations) '${pointer.element.path}'`,
359
+ );
360
+ });
361
+ }
362
+
363
+ return metamodelNativeModelAccess;
364
+ };