@finos/legend-graph 32.3.22 → 32.3.23

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 (72) 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/model/packageableElements/dataProduct/V1_DataProduct.d.ts +30 -0
  25. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.d.ts.map +1 -1
  26. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.js +67 -0
  27. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.js.map +1 -1
  28. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.d.ts +1 -0
  29. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.d.ts.map +1 -1
  30. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.js +2 -0
  31. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.js.map +1 -1
  32. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.d.ts.map +1 -1
  33. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.js +74 -2
  34. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.js.map +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.d.ts.map +1 -1
  36. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.js +1 -0
  37. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.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 +5 -1
  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 +5 -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 +93 -3
  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 +10 -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 +53 -1
  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_ServiceSerializationHelper.d.ts.map +1 -1
  50. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.js +1 -0
  51. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.js.map +1 -1
  52. package/lib/index.d.ts +1 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +1 -1
  55. package/lib/index.js.map +1 -1
  56. package/lib/package.json +1 -1
  57. package/package.json +1 -1
  58. package/src/graph/Core_HashUtils.ts +5 -0
  59. package/src/graph/metamodel/pure/dataProduct/DataProduct.ts +89 -1
  60. package/src/graph/metamodel/pure/packageableElements/service/Service.ts +2 -0
  61. package/src/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.ts +1 -0
  62. package/src/graph-manager/action/validation/DSL_Service_ValidationHelper.ts +19 -0
  63. package/src/graph-manager/protocol/pure/v1/lakehouse/deploy/V1_DataProductArtifact.ts +294 -0
  64. package/src/graph-manager/protocol/pure/v1/model/packageableElements/dataProduct/V1_DataProduct.ts +77 -0
  65. package/src/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.ts +2 -0
  66. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.ts +105 -0
  67. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.ts +1 -0
  68. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.ts +8 -0
  69. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.ts +161 -1
  70. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DataProductSerializationHelper.ts +92 -0
  71. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.ts +1 -0
  72. package/src/index.ts +8 -0
@@ -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
+ };
@@ -48,6 +48,11 @@ import {
48
48
  V1_Expertise,
49
49
  V1_FunctionAccessPoint,
50
50
  V1_DataProductOperationalMetadata,
51
+ V1_NativeModelAccess,
52
+ type V1_SampleQuery,
53
+ V1_PackageableElementSampleQuery,
54
+ V1_InLineSampleQuery,
55
+ V1_NativeModelExecutionContext,
51
56
  } from '../../../model/packageableElements/dataProduct/V1_DataProduct.js';
52
57
  import {
53
58
  UnsupportedOperationError,
@@ -87,6 +92,11 @@ export enum V1_AccessPointGrouptype {
87
92
  MODEL_ACCESS_POINT_GROUP = 'modelAccessPointGroup',
88
93
  }
89
94
 
95
+ export enum V1_SampleQueryType {
96
+ IN_LINE_SAMPLE_QUERY = 'inLineSampleQuery',
97
+ PACKAGEABLE_ELEMENT_SAMPLE_QUERY = 'packageableElementSampleQuery',
98
+ }
99
+
90
100
  export enum V1_DataProductIconType {
91
101
  LIBRARY_ICON = 'libraryIcon',
92
102
  EMBEDDED_IMAGE_ICON = 'embeddedImageIcon',
@@ -199,6 +209,85 @@ export const V1_ModelAccessPointGroupModelSchema = createModelSchema(
199
209
  },
200
210
  );
201
211
 
212
+ export const V1_PackageableElementSampleQueryModelSchema = createModelSchema(
213
+ V1_PackageableElementSampleQuery,
214
+ {
215
+ _type: usingConstantValueSchema(
216
+ V1_SampleQueryType.PACKAGEABLE_ELEMENT_SAMPLE_QUERY,
217
+ ),
218
+ id: primitive(),
219
+ title: primitive(),
220
+ description: optional(primitive()),
221
+ query: usingModelSchema(V1_packageableElementPointerModelSchema),
222
+ executionContextKey: optional(primitive()),
223
+ },
224
+ );
225
+
226
+ export const V1_InLineSampleQueryModelSchema = createModelSchema(
227
+ V1_InLineSampleQuery,
228
+ {
229
+ _type: usingConstantValueSchema(V1_SampleQueryType.IN_LINE_SAMPLE_QUERY),
230
+ id: primitive(),
231
+ title: primitive(),
232
+ description: optional(primitive()),
233
+ executionContextKey: optional(primitive()),
234
+ query: usingModelSchema(V1_rawLambdaModelSchema),
235
+ },
236
+ );
237
+
238
+ const V1_serializeSampleQuery = (
239
+ protocol: V1_SampleQuery,
240
+ ): PlainObject<V1_SampleQuery> => {
241
+ if (protocol instanceof V1_InLineSampleQuery) {
242
+ return serialize(V1_InLineSampleQueryModelSchema, protocol);
243
+ } else if (protocol instanceof V1_PackageableElementSampleQuery) {
244
+ return serialize(V1_PackageableElementSampleQueryModelSchema, protocol);
245
+ }
246
+ throw new UnsupportedOperationError(
247
+ `Can't serialize data product sample query`,
248
+ protocol,
249
+ );
250
+ };
251
+
252
+ export const V1_deserializeSampleQuery = (
253
+ json: PlainObject<V1_SampleQuery>,
254
+ ): V1_SampleQuery => {
255
+ switch (json._type) {
256
+ case V1_SampleQueryType.IN_LINE_SAMPLE_QUERY:
257
+ return deserialize(V1_InLineSampleQueryModelSchema, json);
258
+ case V1_SampleQueryType.PACKAGEABLE_ELEMENT_SAMPLE_QUERY:
259
+ default:
260
+ return deserialize(V1_PackageableElementSampleQueryModelSchema, json);
261
+ }
262
+ };
263
+
264
+ export const V1_NativeModelExecutionContextSchema = createModelSchema(
265
+ V1_NativeModelExecutionContext,
266
+ {
267
+ key: primitive(),
268
+ mapping: usingModelSchema(V1_packageableElementPointerModelSchema),
269
+ runtime: optionalCustomUsingModelSchema(
270
+ V1_packageableElementPointerModelSchema,
271
+ ),
272
+ },
273
+ );
274
+
275
+ export const V1_NativeModelAccessModelSchema = createModelSchema(
276
+ V1_NativeModelAccess,
277
+ {
278
+ diagrams: optionalCustomListWithSchema(V1_dataProductDiagramModelSchema),
279
+ sampleQueries: optionalCustomList(
280
+ (val: V1_SampleQuery) => V1_serializeSampleQuery(val),
281
+ (val) => V1_deserializeSampleQuery(val),
282
+ ),
283
+ nativeModelExecutionContexts: customListWithSchema(
284
+ V1_NativeModelExecutionContextSchema,
285
+ ),
286
+ featuredElements: optionalCustomListWithSchema(V1_ElementScopeModelSchema),
287
+ defaultExecutionContext: primitive(),
288
+ },
289
+ );
290
+
202
291
  export const V1_DefaultAccessPointGroupModelSchema = createModelSchema(
203
292
  V1_AccessPointGroup,
204
293
  {
@@ -369,6 +458,9 @@ export const V1_dataProductModelSchema = (
369
458
  V1_serializeAccessPointGroup,
370
459
  V1_deserializeAccessPointGroup,
371
460
  ),
461
+ nativeModelAccess: optionalCustomUsingModelSchema(
462
+ V1_NativeModelAccessModelSchema,
463
+ ),
372
464
  description: optional(primitive()),
373
465
  sampleValues: optionalCustomList(
374
466
  (data: V1_EmbeddedData) => V1_serializeEmbeddedDataType(data, plugins),
@@ -383,4 +383,5 @@ export const V1_serviceModelSchema = (
383
383
  postValidations: customListWithSchema(V1_servicePostValidationModelSchema, {
384
384
  INTERNAL__forceReturnEmptyInTest: true,
385
385
  }),
386
+ mcpServer: optional(primitive()),
386
387
  });
package/src/index.ts CHANGED
@@ -399,6 +399,14 @@ export {
399
399
  V1_DataProductArtifact,
400
400
  V1_AccessPointImplementation,
401
401
  V1_AccessPointGroupInfo,
402
+ V1_SampleQueryInfo,
403
+ V1_InLineSampleQueryInfo,
404
+ V1_PackageableElementSampleQueryInfo,
405
+ V1_NativeModelAccessInfo,
406
+ V1_DiagramInfo,
407
+ V1_EnumerationDocumentationEntry,
408
+ V1_AssociationDocumentationEntry,
409
+ V1_ClassDocumentationEntry,
402
410
  } from './graph-manager/protocol/pure/v1/lakehouse/deploy/V1_DataProductArtifact.js';
403
411
  export {
404
412
  V1_IngestEnvironmentType,