@finos/legend-graph 32.4.3 → 32.5.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 (131) hide show
  1. package/lib/graph/Core_HashUtils.d.ts +1 -0
  2. package/lib/graph/Core_HashUtils.d.ts.map +1 -1
  3. package/lib/graph/Core_HashUtils.js +1 -0
  4. package/lib/graph/Core_HashUtils.js.map +1 -1
  5. package/lib/graph/helpers/STO_Relational_Helper.d.ts +2 -0
  6. package/lib/graph/helpers/STO_Relational_Helper.d.ts.map +1 -1
  7. package/lib/graph/helpers/STO_Relational_Helper.js +37 -0
  8. package/lib/graph/helpers/STO_Relational_Helper.js.map +1 -1
  9. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.d.ts +62 -0
  10. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.d.ts.map +1 -0
  11. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.js +95 -0
  12. package/lib/graph/metamodel/pure/packageableElements/relation/Accessor.js.map +1 -0
  13. package/lib/graph/metamodel/pure/packageableElements/service/Service.d.ts +1 -0
  14. package/lib/graph/metamodel/pure/packageableElements/service/Service.d.ts.map +1 -1
  15. package/lib/graph/metamodel/pure/packageableElements/service/Service.js +2 -0
  16. package/lib/graph/metamodel/pure/packageableElements/service/Service.js.map +1 -1
  17. package/lib/graph/metamodel/pure/valueSpecification/ValueSpecification.d.ts +2 -0
  18. package/lib/graph/metamodel/pure/valueSpecification/ValueSpecification.d.ts.map +1 -1
  19. package/lib/graph/metamodel/pure/valueSpecification/ValueSpecification.js.map +1 -1
  20. package/lib/graph-manager/AbstractPureGraphManager.d.ts +6 -0
  21. package/lib/graph-manager/AbstractPureGraphManager.d.ts.map +1 -1
  22. package/lib/graph-manager/AbstractPureGraphManager.js.map +1 -1
  23. package/lib/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.d.ts.map +1 -1
  24. package/lib/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.js +1 -0
  25. package/lib/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.js.map +1 -1
  26. package/lib/graph-manager/action/changeDetection/ValueSpecificationObserver.d.ts.map +1 -1
  27. package/lib/graph-manager/action/changeDetection/ValueSpecificationObserver.js +3 -0
  28. package/lib/graph-manager/action/changeDetection/ValueSpecificationObserver.js.map +1 -1
  29. package/lib/graph-manager/action/query/Query.d.ts +7 -0
  30. package/lib/graph-manager/action/query/Query.d.ts.map +1 -1
  31. package/lib/graph-manager/action/query/Query.js +7 -0
  32. package/lib/graph-manager/action/query/Query.js.map +1 -1
  33. package/lib/graph-manager/helpers/DataProductHelper.d.ts +7 -2
  34. package/lib/graph-manager/helpers/DataProductHelper.d.ts.map +1 -1
  35. package/lib/graph-manager/helpers/DataProductHelper.js +27 -2
  36. package/lib/graph-manager/helpers/DataProductHelper.js.map +1 -1
  37. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +6 -0
  38. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  39. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +13 -0
  40. package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
  41. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.d.ts.map +1 -1
  42. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.js +20 -2
  43. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.js.map +1 -1
  44. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.d.ts +6 -1
  45. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.d.ts.map +1 -1
  46. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.js +16 -0
  47. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.js.map +1 -1
  48. package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.d.ts +28 -0
  49. package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.d.ts.map +1 -0
  50. package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.js +104 -0
  51. package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.js.map +1 -0
  52. package/lib/graph-manager/protocol/pure/v1/helpers/V1_ValueSpecificationObserver.d.ts +1 -1
  53. package/lib/graph-manager/protocol/pure/v1/helpers/V1_ValueSpecificationObserver.d.ts.map +1 -1
  54. package/lib/graph-manager/protocol/pure/v1/helpers/V1_ValueSpecificationObserver.js +3 -2
  55. package/lib/graph-manager/protocol/pure/v1/helpers/V1_ValueSpecificationObserver.js.map +1 -1
  56. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.d.ts +11 -9
  57. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.d.ts.map +1 -1
  58. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js +16 -0
  59. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js.map +1 -1
  60. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.d.ts +1 -0
  61. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.d.ts.map +1 -1
  62. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.js +2 -0
  63. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.js.map +1 -1
  64. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_ColSpec.d.ts +3 -3
  65. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_ColSpec.d.ts.map +1 -1
  66. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_ColSpec.js.map +1 -1
  67. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.d.ts +14 -4
  68. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.d.ts.map +1 -1
  69. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.js +21 -4
  70. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.js.map +1 -1
  71. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.d.ts.map +1 -1
  72. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.js +6 -5
  73. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.js.map +1 -1
  74. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.d.ts.map +1 -1
  75. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.js +30 -2
  76. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.js.map +1 -1
  77. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.d.ts.map +1 -1
  78. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js +1 -0
  79. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.js.map +1 -1
  80. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.d.ts.map +1 -1
  81. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js +67 -1
  82. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js.map +1 -1
  83. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_IngestSerializationHelper.d.ts +5 -1
  84. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_IngestSerializationHelper.d.ts.map +1 -1
  85. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_IngestSerializationHelper.js +22 -2
  86. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_IngestSerializationHelper.js.map +1 -1
  87. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.d.ts.map +1 -1
  88. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.js +5 -4
  89. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.js.map +1 -1
  90. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.d.ts +2 -1
  91. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.d.ts.map +1 -1
  92. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js +1 -1
  93. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js.map +1 -1
  94. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.d.ts.map +1 -1
  95. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js +16 -4
  96. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js.map +1 -1
  97. package/lib/index.d.ts +5 -2
  98. package/lib/index.d.ts.map +1 -1
  99. package/lib/index.js +5 -2
  100. package/lib/index.js.map +1 -1
  101. package/lib/package.json +1 -1
  102. package/package.json +1 -1
  103. package/src/graph/Core_HashUtils.ts +1 -0
  104. package/src/graph/helpers/STO_Relational_Helper.ts +44 -0
  105. package/src/graph/metamodel/pure/packageableElements/relation/Accessor.ts +138 -0
  106. package/src/graph/metamodel/pure/packageableElements/service/Service.ts +2 -0
  107. package/src/graph/metamodel/pure/valueSpecification/ValueSpecification.ts +4 -0
  108. package/src/graph-manager/AbstractPureGraphManager.ts +13 -0
  109. package/src/graph-manager/action/changeDetection/DSL_Service_ObserverHelper.ts +1 -0
  110. package/src/graph-manager/action/changeDetection/ValueSpecificationObserver.ts +6 -0
  111. package/src/graph-manager/action/query/Query.ts +9 -0
  112. package/src/graph-manager/helpers/DataProductHelper.ts +47 -4
  113. package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +31 -0
  114. package/src/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.ts +22 -0
  115. package/src/graph-manager/protocol/pure/v1/engine/query/V1_Query.ts +28 -0
  116. package/src/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.ts +156 -0
  117. package/src/graph-manager/protocol/pure/v1/helpers/V1_ValueSpecificationObserver.ts +3 -3
  118. package/src/graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.ts +15 -11
  119. package/src/graph-manager/protocol/pure/v1/model/packageableElements/service/V1_Service.ts +2 -0
  120. package/src/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_ColSpec.ts +3 -3
  121. package/src/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.ts +29 -4
  122. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ServiceTransformer.ts +8 -7
  123. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.ts +49 -2
  124. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementSecondPassBuilder.ts +1 -0
  125. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.ts +129 -0
  126. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_IngestSerializationHelper.ts +51 -1
  127. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ServiceSerializationHelper.ts +5 -4
  128. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.ts +1 -1
  129. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.ts +29 -3
  130. package/src/index.ts +18 -2
  131. package/tsconfig.json +2 -0
@@ -27,6 +27,8 @@ import {
27
27
  type DataProductElement,
28
28
  type ElementScope,
29
29
  type NativeModelExecutionContext,
30
+ LakehouseAccessPoint,
31
+ type AccessPointGroup,
30
32
  } from '../../graph/metamodel/pure/dataProduct/DataProduct.js';
31
33
  import type { Mapping } from '../../graph/metamodel/pure/packageableElements/mapping/Mapping.js';
32
34
  import type { GraphManagerState } from '../GraphManagerState.js';
@@ -119,9 +121,26 @@ export const resolveUsableDataProductClasses = (
119
121
  return compatibleClasses;
120
122
  };
121
123
 
124
+ export const resolveLakehouseAccessPoint = (
125
+ dataProduct: DataProduct,
126
+ ): LakehouseAccessPoint | undefined => {
127
+ for (const group of dataProduct.accessPointGroups) {
128
+ const lakehouseAp = group.accessPoints.find(
129
+ (ap): ap is LakehouseAccessPoint => ap instanceof LakehouseAccessPoint,
130
+ );
131
+ if (lakehouseAp) {
132
+ return lakehouseAp;
133
+ }
134
+ }
135
+ return undefined;
136
+ };
137
+
122
138
  export const resolveDataProductExecutionState = (
123
139
  dataProduct: DataProduct,
124
- ): NativeModelExecutionContext | ModelAccessPointGroup => {
140
+ ):
141
+ | NativeModelExecutionContext
142
+ | ModelAccessPointGroup
143
+ | LakehouseAccessPoint => {
125
144
  if (isDataProductNative(dataProduct)) {
126
145
  return getModelGroupFromNativeDataProduct(dataProduct)
127
146
  .defaultExecutionContext;
@@ -129,9 +148,33 @@ export const resolveDataProductExecutionState = (
129
148
  const modelAccessGroup = dataProduct.accessPointGroups.filter(
130
149
  filterByType(ModelAccessPointGroup),
131
150
  )[0];
132
- return guaranteeNonNullable(
133
- modelAccessGroup,
134
- 'No native model access group or model access group on data product',
151
+ if (modelAccessGroup) {
152
+ return modelAccessGroup;
153
+ }
154
+ const lakehouseAccessPoint = resolveLakehouseAccessPoint(dataProduct);
155
+ if (lakehouseAccessPoint) {
156
+ return lakehouseAccessPoint;
157
+ }
158
+ throw new Error(
159
+ 'No native model access, model access group, or lakehouse access point on data product',
135
160
  );
136
161
  }
137
162
  };
163
+
164
+ export const findLakehouseAccessPointGroup = (
165
+ dataProduct: DataProduct,
166
+ accessPointId: string,
167
+ ):
168
+ | { group: AccessPointGroup; accessPoint: LakehouseAccessPoint }
169
+ | undefined => {
170
+ for (const group of dataProduct.accessPointGroups) {
171
+ const ap = group.accessPoints.find(
172
+ (a): a is LakehouseAccessPoint =>
173
+ a instanceof LakehouseAccessPoint && a.id === accessPointId,
174
+ );
175
+ if (ap) {
176
+ return { group, accessPoint: ap };
177
+ }
178
+ }
179
+ return undefined;
180
+ };
@@ -398,6 +398,10 @@ import {
398
398
  V1_MetadatProject,
399
399
  } from './engine/dev-metadata/V1_DevMetadataPushRequest.js';
400
400
  import type { MetadataRequestOptions } from '../../../action/dev-metadata/MetadataRequestOptions.js';
401
+ import type { Accessor } from '../../../../graph/metamodel/pure/packageableElements/relation/Accessor.js';
402
+ import { IngestDefinition } from '../../../../graph/metamodel/pure/packageableElements/ingest/IngestDefinition.js';
403
+ import { Database } from '../../../../graph/metamodel/pure/packageableElements/store/relational/model/Database.js';
404
+ import { V1_createAccessorFromPackageableElement } from './helpers/V1_AccessorHelper.js';
401
405
 
402
406
  class V1_PureModelContextDataIndex {
403
407
  elements: V1_PackageableElement[] = [];
@@ -2232,6 +2236,31 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
2232
2236
  }
2233
2237
  }
2234
2238
 
2239
+ //
2240
+
2241
+ override createAccessorFromPackageableElement(
2242
+ element: PackageableElement,
2243
+ graph: PureModel,
2244
+ options?: {
2245
+ schemaName?: string | undefined;
2246
+ tableName?: string | undefined;
2247
+ },
2248
+ ): Accessor | undefined {
2249
+ if (
2250
+ !(element instanceof IngestDefinition) &&
2251
+ !(element instanceof Database)
2252
+ ) {
2253
+ return undefined;
2254
+ }
2255
+ const context = new V1_GraphBuilderContextBuilder(
2256
+ graph,
2257
+ graph,
2258
+ this.graphBuilderExtensions,
2259
+ this.logService,
2260
+ ).build();
2261
+ return V1_createAccessorFromPackageableElement(element, context, options);
2262
+ }
2263
+
2235
2264
  private buildLambdaReturnTypeInput(
2236
2265
  lambda: RawLambda,
2237
2266
  graph: PureModel,
@@ -3541,12 +3570,14 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
3541
3570
  packageName: string;
3542
3571
  pattern: string;
3543
3572
  serviceOwners: string[];
3573
+ title?: string | undefined;
3544
3574
  },
3545
3575
  graph: Entity[],
3546
3576
  ): Promise<Entity> {
3547
3577
  const service = new V1_Service();
3548
3578
  service.name = serviceConfig.name;
3549
3579
  service.package = serviceConfig.packageName;
3580
+ service.title = serviceConfig.title;
3550
3581
  const owernship = new V1_UserListOwnership();
3551
3582
  owernship.users = serviceConfig.serviceOwners;
3552
3583
  service.ownership = owernship;
@@ -36,6 +36,8 @@ import {
36
36
  QueryDataProductModelAccessExecutionContext,
37
37
  QueryDataProductNativeExecutionContextInfo,
38
38
  QueryDataProductModelAccessExecutionContextInfo,
39
+ QueryDataProductLakehouseExecutionContext,
40
+ QueryDataProductLakehouseExecutionContextInfo,
39
41
  } from '../../../../../graph-manager/action/query/Query.js';
40
42
  import {
41
43
  type V1_LightQuery,
@@ -46,6 +48,7 @@ import {
46
48
  type V1_QueryExecutionContext,
47
49
  V1_DataProductNativeExecutionContext,
48
50
  V1_DataProductModelAccessExecutionContext,
51
+ V1_DataProductLakehouseExecutionContext,
49
52
  } from './query/V1_Query.js';
50
53
  import type { PureModel } from '../../../../../graph/PureModel.js';
51
54
  import { DEPRECATED__ServiceTestResult } from '../../../../../graph-manager/action/service/DEPRECATED__ServiceTestResult.js';
@@ -220,6 +223,13 @@ export const V1_buildExecutionContext = (
220
223
  exec.dataProductPath = protocolExecContext.dataProductPath;
221
224
  exec.accessPointGroupId = protocolExecContext.accessPointGroupId;
222
225
  return exec;
226
+ } else if (
227
+ protocolExecContext instanceof V1_DataProductLakehouseExecutionContext
228
+ ) {
229
+ const exec = new QueryDataProductLakehouseExecutionContext();
230
+ exec.dataProductPath = protocolExecContext.dataProductPath;
231
+ exec.accessPointId = protocolExecContext.accessPointId;
232
+ return exec;
223
233
  }
224
234
  throw new UnsupportedOperationError('Unsupported query execution context');
225
235
  };
@@ -263,6 +273,13 @@ export const V1_buildExecutionContextInfo = (
263
273
  exec.dataProductPath = v1_execContext.dataProductPath;
264
274
  exec.accessPointGroupId = v1_execContext.accessPointGroupId;
265
275
  return exec;
276
+ } else if (
277
+ v1_execContext instanceof V1_DataProductLakehouseExecutionContext
278
+ ) {
279
+ const exec = new QueryDataProductLakehouseExecutionContextInfo();
280
+ exec.dataProductPath = v1_execContext.dataProductPath;
281
+ exec.accessPointId = v1_execContext.accessPointId;
282
+ return exec;
266
283
  }
267
284
  throw new UnsupportedOperationError('Unsupported query execution context');
268
285
  };
@@ -382,6 +399,11 @@ export const V1_transformQueryExecutionContext = (
382
399
  protocol.dataProductPath = execContext.dataProductPath;
383
400
  protocol.accessPointGroupId = execContext.accessPointGroupId;
384
401
  return protocol;
402
+ } else if (execContext instanceof QueryDataProductLakehouseExecutionContext) {
403
+ const protocol = new V1_DataProductLakehouseExecutionContext();
404
+ protocol.dataProductPath = execContext.dataProductPath;
405
+ protocol.accessPointId = execContext.accessPointId;
406
+ return protocol;
385
407
  }
386
408
  throw new UnsupportedOperationError('Unsupported query execution context');
387
409
  };
@@ -67,6 +67,7 @@ export enum V1_QueryExecutionContextType {
67
67
  QUERY_DATASAPCE_EXECUTION_CONTEXT = 'dataSpaceExecutionContext',
68
68
  QUERY_DATAPRODUCT_NATIVE_EXECUTION_CONTEXT = 'dataProductNativeExecutionContext',
69
69
  QUERY_DATAPRODUCT_MODEL_ACCESS_EXECUTION_CONTEXT = 'dataProductModelAccessExecutionContext',
70
+ QUERY_DATAPRODUCT_LAKEHOUSE_EXECUTION_CONTEXT = 'dataProductLakehouseExecutionContext',
70
71
  }
71
72
 
72
73
  export class V1_QueryExplicitExecutionContext extends V1_QueryExecutionContext {
@@ -143,6 +144,23 @@ export class V1_DataProductModelAccessExecutionContext extends V1_QueryDataProdu
143
144
  );
144
145
  }
145
146
 
147
+ export class V1_DataProductLakehouseExecutionContext extends V1_QueryDataProductExecutionContext {
148
+ accessPointId!: string;
149
+
150
+ static readonly serialization = new SerializationFactory(
151
+ createModelSchema(V1_DataProductLakehouseExecutionContext, {
152
+ _type: usingConstantValueSchema(
153
+ V1_QueryExecutionContextType.QUERY_DATAPRODUCT_LAKEHOUSE_EXECUTION_CONTEXT,
154
+ ),
155
+ dataProductPath: primitive(),
156
+ accessPointId: primitive(),
157
+ }),
158
+ {
159
+ deserializeNullAsUndefined: true,
160
+ },
161
+ );
162
+ }
163
+
146
164
  export const V1_deserializeQueryExecutionContext = (
147
165
  json: PlainObject<V1_QueryExecutionContext>,
148
166
  ): V1_QueryExecutionContext => {
@@ -167,6 +185,11 @@ export const V1_deserializeQueryExecutionContext = (
167
185
  V1_DataProductModelAccessExecutionContext.serialization.schema,
168
186
  json,
169
187
  );
188
+ case V1_QueryExecutionContextType.QUERY_DATAPRODUCT_LAKEHOUSE_EXECUTION_CONTEXT:
189
+ return deserialize(
190
+ V1_DataProductLakehouseExecutionContext.serialization.schema,
191
+ json,
192
+ );
170
193
  default: {
171
194
  throw new UnsupportedOperationError(
172
195
  `Can't deserialize authentication strategy of type '${json._type}': no compatible deserializer available from plugins`,
@@ -198,6 +221,11 @@ export const V1_serializeQueryExecutionContext = (
198
221
  V1_DataProductModelAccessExecutionContext.serialization.schema,
199
222
  protocol,
200
223
  );
224
+ } else if (protocol instanceof V1_DataProductLakehouseExecutionContext) {
225
+ return serialize(
226
+ V1_DataProductLakehouseExecutionContext.serialization.schema,
227
+ protocol,
228
+ );
201
229
  }
202
230
  throw new UnsupportedOperationError(
203
231
  `Can't serialize authentication strategy: no compatible serializer available from plugins`,
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ type Accessor,
19
+ IngestionAccessor,
20
+ RelationalStoreAccessor,
21
+ type AccessorOwner,
22
+ } from '../../../../../graph/metamodel/pure/packageableElements/relation/Accessor.js';
23
+ import {
24
+ RelationType,
25
+ RelationColumn,
26
+ } from '../../../../../graph/metamodel/pure/packageableElements/relation/RelationType.js';
27
+ import { GenericType } from '../../../../../graph/metamodel/pure/packageableElements/domain/GenericType.js';
28
+ import { GenericTypeExplicitReference } from '../../../../../graph/metamodel/pure/packageableElements/domain/GenericTypeReference.js';
29
+ import { IngestDefinition } from '../../../../../graph/metamodel/pure/packageableElements/ingest/IngestDefinition.js';
30
+ import { Database } from '../../../../../graph/metamodel/pure/packageableElements/store/relational/model/Database.js';
31
+ import { Column } from '../../../../../graph/metamodel/pure/packageableElements/store/relational/model/Column.js';
32
+ import type { Table } from '../../../../../graph/metamodel/pure/packageableElements/store/relational/model/Table.js';
33
+ import { mapRelationalDataTypeToPrimitiveType } from '../../../../../graph/helpers/STO_Relational_Helper.js';
34
+ import type { V1_IngestDataset } from '../model/packageableElements/ingest/V1_IngestDefinition.js';
35
+ import type { V1_GraphBuilderContext } from '../transformation/pureGraph/to/V1_GraphBuilderContext.js';
36
+ import { V1_GenericType as V1_GenericTypeProtocol } from '../model/packageableElements/type/V1_GenericType.js';
37
+ import { V1_PackageableType } from '../model/packageableElements/type/V1_PackageableType.js';
38
+ import { returnUndefOnError } from '@finos/legend-shared';
39
+ import { V1_deserializeIngestDefinitionContent } from '../transformation/pureProtocol/serializationHelpers/V1_IngestSerializationHelper.js';
40
+
41
+ const buildV1GenericType = (fullPath: string): V1_GenericTypeProtocol => {
42
+ // Strip package prefix — primitive types are indexed by simple name
43
+ const typeName = fullPath.includes('::')
44
+ ? fullPath.substring(fullPath.lastIndexOf('::') + 2)
45
+ : fullPath;
46
+ const rawType = new V1_PackageableType();
47
+ rawType.fullPath = typeName;
48
+ const genericType = new V1_GenericTypeProtocol();
49
+ genericType.rawType = rawType;
50
+ return genericType;
51
+ };
52
+
53
+ const buildRelationTypeFromIngestDataset = (
54
+ dataset: V1_IngestDataset,
55
+ context: V1_GraphBuilderContext,
56
+ ): RelationType => {
57
+ const relationType = new RelationType('__ingest_dataset__');
58
+ relationType.columns = dataset.source.schema.columns.map((col) => {
59
+ const rawTypePath =
60
+ col.genericType.rawType instanceof V1_PackageableType
61
+ ? col.genericType.rawType.fullPath
62
+ : 'String';
63
+ const v1GenericType = buildV1GenericType(rawTypePath);
64
+ const resolvedGenericType =
65
+ returnUndefOnError(() =>
66
+ context.resolveGenericTypeFromProtocolWithRelationType(v1GenericType),
67
+ ) ??
68
+ context.resolveGenericTypeFromProtocolWithRelationType(
69
+ buildV1GenericType('String'),
70
+ );
71
+ return new RelationColumn(col.name, resolvedGenericType);
72
+ });
73
+ return relationType;
74
+ };
75
+
76
+ const buildRelationTypeFromTable = (table: Table): RelationType => {
77
+ const relationType = new RelationType('__database_table__');
78
+ relationType.columns = table.columns
79
+ .filter((col): col is Column => col instanceof Column)
80
+ .map(
81
+ (col) =>
82
+ new RelationColumn(
83
+ col.name,
84
+ GenericTypeExplicitReference.create(
85
+ new GenericType(mapRelationalDataTypeToPrimitiveType(col.type)),
86
+ ),
87
+ ),
88
+ );
89
+ return relationType;
90
+ };
91
+ // TODO: move to pure graph
92
+ /**
93
+ * Creates an appropriate Accessor from a packageable element.
94
+ *
95
+ * For IngestDefinition: requires `datasetName` to identify the dataset.
96
+ * For Database: requires `schemaName` and `tableName` to identify the table.
97
+ */
98
+ export const V1_createAccessorFromPackageableElement = (
99
+ element: AccessorOwner,
100
+ context: V1_GraphBuilderContext,
101
+ options?: {
102
+ schemaName?: string | undefined;
103
+ tableName?: string | undefined;
104
+ },
105
+ ): Accessor | undefined => {
106
+ if (element instanceof IngestDefinition) {
107
+ const content = returnUndefOnError(() =>
108
+ V1_deserializeIngestDefinitionContent(element.content),
109
+ );
110
+ // if unable to serialize we dont fall hard, we return undefined. we may want to revisit and fall hard on this.
111
+ if (!content) {
112
+ return undefined;
113
+ }
114
+ const datasetName = options?.tableName;
115
+ const dataset = datasetName
116
+ ? content.datasets?.find((ds) => ds.name === datasetName)
117
+ : content.datasets?.[0];
118
+ if (!dataset) {
119
+ return undefined;
120
+ }
121
+ const relationType = buildRelationTypeFromIngestDataset(dataset, context);
122
+ return new IngestionAccessor(
123
+ element.path,
124
+ undefined,
125
+ dataset.name,
126
+ relationType,
127
+ element,
128
+ );
129
+ }
130
+ if (element instanceof Database) {
131
+ const schemaName = options?.schemaName;
132
+ const tableName = options?.tableName;
133
+ let table: Table | undefined;
134
+ if (schemaName && tableName) {
135
+ const schema = element.schemas.find((s) => s.name === schemaName);
136
+ if (!schema) {
137
+ return undefined;
138
+ }
139
+ table = schema.tables.find((t) => t.name === tableName);
140
+ }
141
+ const tables = element.schemas.map((e) => e.tables).flat();
142
+ table = tableName ? tables.find((t) => t.name === tableName) : tables[0];
143
+ if (!table) {
144
+ return undefined;
145
+ }
146
+ const relationType = buildRelationTypeFromTable(table);
147
+ return new RelationalStoreAccessor(
148
+ element.path,
149
+ table.schema.name,
150
+ table.name,
151
+ relationType,
152
+ element,
153
+ );
154
+ }
155
+ return undefined;
156
+ };
@@ -20,7 +20,7 @@ import {
20
20
  type V1_ValueSpecificationVisitor,
21
21
  } from '../model/valueSpecification/V1_ValueSpecification.js';
22
22
  import type { V1_Variable } from '../model/valueSpecification/V1_Variable.js';
23
- import type { V1_Lambda } from '../model/valueSpecification/raw/V1_Lambda.js';
23
+ import { V1_Lambda } from '../model/valueSpecification/raw/V1_Lambda.js';
24
24
  import type { V1_EnumValue } from '../model/valueSpecification/raw/V1_EnumValue.js';
25
25
  import type { V1_AppliedFunction } from '../model/valueSpecification/application/V1_AppliedFunction.js';
26
26
  import type { V1_Collection } from '../model/valueSpecification/raw/V1_Collection.js';
@@ -380,10 +380,10 @@ function _V1_observe_ColSpec(metamodel: V1_ColSpec): V1_ColSpec {
380
380
  function2: observable,
381
381
  });
382
382
 
383
- if (metamodel.function1) {
383
+ if (metamodel.function1 && metamodel.function1 instanceof V1_Lambda) {
384
384
  V1_observe_Lambda(metamodel.function1);
385
385
  }
386
- if (metamodel.function2) {
386
+ if (metamodel.function2 && metamodel.function2 instanceof V1_Lambda) {
387
387
  V1_observe_Lambda(metamodel.function2);
388
388
  }
389
389
 
@@ -30,18 +30,22 @@ export class V1_IngestDefinition extends V1_INTERNAL__UnknownPackageableElement
30
30
  return visitor.visit_IngestDefinition(this);
31
31
  }
32
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
- };
33
+ export class V1_IngestDatasetSchema {
34
+ _type!: string;
35
+ columns: V1_RelationTypeColumn[] = [];
43
36
  }
44
37
 
45
- export interface V1_IngestDefinitionContent {
38
+ export class V1_IngestDatasetSource {
39
+ _type!: string;
40
+ schema!: V1_IngestDatasetSchema;
41
+ }
42
+
43
+ export class V1_IngestDataset {
44
+ name!: string;
45
+ primaryKey: string[] = [];
46
+ source!: V1_IngestDatasetSource;
47
+ }
48
+
49
+ export class V1_IngestDefinitionContent {
46
50
  datasets?: V1_IngestDataset[];
47
51
  }
@@ -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
+ title?: string | undefined;
38
39
  mcpServer?: string | undefined;
39
40
  autoActivateUpdates = true;
40
41
  execution!: V1_ServiceExecution;
@@ -56,6 +57,7 @@ export class V1_Service extends V1_PackageableElement implements Hashable {
56
57
  this.execution,
57
58
  this.test ?? '',
58
59
  this.mcpServer ?? '',
60
+ this.title ?? '',
59
61
  hashArray(this.testSuites),
60
62
  hashArray(this.postValidations),
61
63
  hashArray(this.taggedValues),
@@ -14,11 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { V1_Lambda } from '../../V1_Lambda.js';
17
+ import type { V1_ValueSpecification } from '../../../V1_ValueSpecification.js';
18
18
 
19
19
  export class V1_ColSpec {
20
20
  name!: string;
21
21
  type?: string | undefined;
22
- function1?: V1_Lambda | undefined;
23
- function2?: V1_Lambda | undefined;
22
+ function1?: V1_ValueSpecification | undefined;
23
+ function2?: V1_ValueSpecification | undefined;
24
24
  }
@@ -14,16 +14,41 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export class V1_RelationStoreAccessor {
17
+ import { V1_ClassInstanceType } from '../../../../../transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js';
18
+
19
+ export abstract class V1_Accessor {
18
20
  path: string[] = [];
21
+
22
+ abstract INSTANCE_TYPE: V1_ClassInstanceType;
23
+ }
24
+
25
+ export class V1_RelationStoreAccessor extends V1_Accessor {
19
26
  metadata?: boolean;
27
+
28
+ get INSTANCE_TYPE(): V1_ClassInstanceType {
29
+ return V1_ClassInstanceType.RELATION_STORE_ACCESSOR;
30
+ }
20
31
  }
21
32
 
22
- export class V1_DataProductAccessor {
23
- path: string[] = [];
33
+ export class V1_DataProductAccessor extends V1_Accessor {
24
34
  parameters: string[] = [];
35
+ get INSTANCE_TYPE(): V1_ClassInstanceType {
36
+ return V1_ClassInstanceType.DATA_PRODUCT_ACCESSOR;
37
+ }
25
38
  }
26
39
 
27
- export class V1_SQLAccessor {
40
+ export class V1_IngestDefinitionAccessor extends V1_Accessor {
41
+ metadata = false;
42
+
43
+ get INSTANCE_TYPE(): V1_ClassInstanceType {
44
+ return V1_ClassInstanceType.INGEST_ACCESSOR;
45
+ }
46
+ }
47
+
48
+ export class V1_SQLAccessor extends V1_Accessor {
28
49
  sql!: string;
50
+
51
+ get INSTANCE_TYPE(): V1_ClassInstanceType {
52
+ return V1_ClassInstanceType.SQL_ACCESSOR;
53
+ }
29
54
  }
@@ -329,25 +329,26 @@ export const V1_transformService = (
329
329
  ): V1_Service => {
330
330
  const service = new V1_Service();
331
331
  V1_initPackageableElement(service, element);
332
- service.stereotypes = element.stereotypes.map(V1_transformStereotype);
333
- service.taggedValues = element.taggedValues.map(V1_transformTaggedValue);
334
332
  service.autoActivateUpdates = element.autoActivateUpdates;
335
- service.mcpServer = element.mcpServer;
336
333
  service.documentation = element.documentation;
337
334
  service.execution = transformServiceExecution(element.execution, context);
335
+ service.mcpServer = element.mcpServer;
336
+ service.owners = element.owners;
338
337
  if (element.ownership) {
339
338
  service.ownership = transformServiceOwnership(element.ownership);
340
339
  }
341
- service.owners = element.owners;
342
340
  service.pattern = element.pattern;
341
+ service.postValidations = element.postValidations.map((postValidation) =>
342
+ V1_transformPostValidation(postValidation, context),
343
+ );
344
+ service.stereotypes = element.stereotypes.map(V1_transformStereotype);
345
+ service.taggedValues = element.taggedValues.map(V1_transformTaggedValue);
343
346
  if (element.test) {
344
347
  service.test = transformLegacyServiceTest(element.test, context);
345
348
  }
346
349
  service.testSuites = element.tests.map((testSuite) =>
347
350
  V1_transformTestSuite(testSuite, context),
348
351
  );
349
- service.postValidations = element.postValidations.map((postValidation) =>
350
- V1_transformPostValidation(postValidation, context),
351
- );
352
+ service.title = element.title;
352
353
  return service;
353
354
  };
@@ -94,6 +94,39 @@ import { V1_ColSpecArray } from '../../../model/valueSpecification/raw/classInst
94
94
  import { V1_ColSpec } from '../../../model/valueSpecification/raw/classInstance/relation/V1_ColSpec.js';
95
95
  import { RelationColumn } from '../../../../../../../graph/metamodel/pure/packageableElements/relation/RelationType.js';
96
96
  import { V1_createGenericTypeWithElementPath } from '../../../helpers/V1_DomainHelper.js';
97
+ import {
98
+ type Accessor,
99
+ type AccessorInstanceValue,
100
+ DataProductAccessor,
101
+ IngestionAccessor,
102
+ RelationalStoreAccessor,
103
+ } from '../../../../../../../graph/metamodel/pure/packageableElements/relation/Accessor.js';
104
+ import {
105
+ type V1_Accessor,
106
+ V1_DataProductAccessor,
107
+ V1_IngestDefinitionAccessor,
108
+ V1_RelationStoreAccessor,
109
+ } from '../../../model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.js';
110
+
111
+ const transformAccessor = (accessor: Accessor): V1_Accessor => {
112
+ if (accessor instanceof DataProductAccessor) {
113
+ const v1Accessor = new V1_DataProductAccessor();
114
+ v1Accessor.path = accessor.path;
115
+ return v1Accessor;
116
+ } else if (accessor instanceof IngestionAccessor) {
117
+ const v1Accessor = new V1_IngestDefinitionAccessor();
118
+ v1Accessor.path = accessor.path;
119
+ return v1Accessor;
120
+ } else if (accessor instanceof RelationalStoreAccessor) {
121
+ const v1Accessor = new V1_RelationStoreAccessor();
122
+ v1Accessor.path = accessor.path;
123
+ return v1Accessor;
124
+ }
125
+ throw new UnsupportedOperationError(
126
+ `Can't transform accessor: unsupported accessor type`,
127
+ accessor,
128
+ );
129
+ };
97
130
 
98
131
  class V1_ValueSpecificationTransformer
99
132
  implements ValueSpecificationVisitor<V1_ValueSpecification>
@@ -254,6 +287,20 @@ class V1_ValueSpecificationTransformer
254
287
  );
255
288
  }
256
289
 
290
+ visit_AccessorInstanceValue(
291
+ valueAccessorInstanceValue: AccessorInstanceValue,
292
+ ): V1_ValueSpecification {
293
+ const accessor = guaranteeNonNullable(
294
+ valueAccessorInstanceValue.values[0],
295
+ 'Accessor required in AccessorInstanceValue',
296
+ );
297
+ const v1Accessor = transformAccessor(accessor);
298
+ const classInstance = new V1_ClassInstance();
299
+ classInstance.type = v1Accessor.INSTANCE_TYPE;
300
+ classInstance.value = v1Accessor;
301
+ return classInstance;
302
+ }
303
+
257
304
  visit_CollectionInstanceValue(
258
305
  valueSpecification: CollectionInstanceValue,
259
306
  ): V1_ValueSpecification {
@@ -428,10 +475,10 @@ class V1_ValueSpecificationTransformer
428
475
  ),
429
476
  );
430
477
  if (fun1) {
431
- colProtocol.function1 = guaranteeType(fun1, V1_Lambda);
478
+ colProtocol.function1 = fun1;
432
479
  }
433
480
  if (fun2) {
434
- colProtocol.function2 = guaranteeType(fun2, V1_Lambda);
481
+ colProtocol.function2 = fun2;
435
482
  }
436
483
  return colProtocol;
437
484
  });
@@ -619,6 +619,7 @@ export class V1_ElementSecondPassBuilder
619
619
  .map((taggedValue) => V1_buildTaggedValue(taggedValue, this.context))
620
620
  .filter(isNonNullable);
621
621
  service.pattern = element.pattern;
622
+ service.title = element.title;
622
623
  service.owners = element.owners.slice();
623
624
  service.documentation = element.documentation;
624
625
  service.autoActivateUpdates = element.autoActivateUpdates;