@finos/legend-graph 32.3.28 → 32.3.31

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 (75) hide show
  1. package/lib/graph/BasicModel.d.ts +1 -1
  2. package/lib/graph/BasicModel.d.ts.map +1 -1
  3. package/lib/graph/BasicModel.js +2 -2
  4. package/lib/graph/BasicModel.js.map +1 -1
  5. package/lib/graph/DependencyManager.d.ts +3 -1
  6. package/lib/graph/DependencyManager.d.ts.map +1 -1
  7. package/lib/graph/DependencyManager.js +3 -0
  8. package/lib/graph/DependencyManager.js.map +1 -1
  9. package/lib/graph/PureModel.d.ts +1 -0
  10. package/lib/graph/PureModel.d.ts.map +1 -1
  11. package/lib/graph/PureModel.js +9 -0
  12. package/lib/graph/PureModel.js.map +1 -1
  13. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts +5 -1
  14. package/lib/graph/metamodel/pure/dataProduct/DataProduct.d.ts.map +1 -1
  15. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js +2 -2
  16. package/lib/graph/metamodel/pure/dataProduct/DataProduct.js.map +1 -1
  17. package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTest.d.ts.map +1 -1
  18. package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTest.js +1 -0
  19. package/lib/graph/metamodel/pure/packageableElements/function/test/FunctionTest.js.map +1 -1
  20. package/lib/graph-manager/action/changeDetection/GraphObserverHelper.js +1 -1
  21. package/lib/graph-manager/action/changeDetection/GraphObserverHelper.js.map +1 -1
  22. package/lib/graph-manager/action/query/Query.d.ts +8 -0
  23. package/lib/graph-manager/action/query/Query.d.ts.map +1 -1
  24. package/lib/graph-manager/action/query/Query.js +8 -0
  25. package/lib/graph-manager/action/query/Query.js.map +1 -1
  26. package/lib/graph-manager/helpers/DataProductHelper.d.ts +25 -0
  27. package/lib/graph-manager/helpers/DataProductHelper.d.ts.map +1 -0
  28. package/lib/graph-manager/helpers/DataProductHelper.js +73 -0
  29. package/lib/graph-manager/helpers/DataProductHelper.js.map +1 -0
  30. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.d.ts.map +1 -1
  31. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.js +9 -2
  32. package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.js.map +1 -1
  33. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.d.ts +8 -1
  34. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.d.ts.map +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.js +19 -0
  36. package/lib/graph-manager/protocol/pure/v1/engine/query/V1_Query.js.map +1 -1
  37. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.d.ts.map +1 -1
  38. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.js +1 -0
  39. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.js.map +1 -1
  40. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.d.ts +3 -0
  41. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.d.ts.map +1 -1
  42. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.js +3 -0
  43. package/lib/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.js.map +1 -1
  44. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.js +1 -1
  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/to/helpers/V1_DataProductBuilder.d.ts.map +1 -1
  47. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js +1 -2
  48. package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.js.map +1 -1
  49. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.d.ts +1 -0
  50. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.d.ts.map +1 -1
  51. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js +10 -1
  52. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js.map +1 -1
  53. package/lib/index.d.ts +4 -3
  54. package/lib/index.d.ts.map +1 -1
  55. package/lib/index.js +4 -3
  56. package/lib/index.js.map +1 -1
  57. package/lib/package.json +1 -1
  58. package/package.json +3 -3
  59. package/src/graph/BasicModel.ts +2 -2
  60. package/src/graph/DependencyManager.ts +5 -0
  61. package/src/graph/PureModel.ts +9 -0
  62. package/src/graph/metamodel/pure/dataProduct/DataProduct.ts +8 -3
  63. package/src/graph/metamodel/pure/packageableElements/function/test/FunctionTest.ts +1 -0
  64. package/src/graph-manager/action/changeDetection/GraphObserverHelper.ts +1 -1
  65. package/src/graph-manager/action/query/Query.ts +11 -0
  66. package/src/graph-manager/helpers/DataProductHelper.ts +113 -0
  67. package/src/graph-manager/protocol/pure/v1/engine/V1_EngineHelper.ts +8 -0
  68. package/src/graph-manager/protocol/pure/v1/engine/query/V1_Query.ts +31 -0
  69. package/src/graph-manager/protocol/pure/v1/model/packageableElements/function/test/V1_FunctionTest.ts +1 -0
  70. package/src/graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.ts +4 -0
  71. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_DataProductTransformer.ts +1 -1
  72. package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_DataProductBuilder.ts +6 -2
  73. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.ts +10 -0
  74. package/src/index.ts +5 -2
  75. package/tsconfig.json +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-graph",
3
- "version": "32.3.28",
3
+ "version": "32.3.31",
4
4
  "description": "Legend graph and graph manager",
5
5
  "keywords": [
6
6
  "legend",
@@ -43,12 +43,12 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@finos/legend-shared": "11.0.22",
46
- "@finos/legend-storage": "3.0.141",
46
+ "@finos/legend-storage": "3.0.143",
47
47
  "mobx": "6.13.6",
48
48
  "serializr": "3.0.3"
49
49
  },
50
50
  "devDependencies": {
51
- "@finos/legend-dev-utils": "2.2.5",
51
+ "@finos/legend-dev-utils": "2.2.6",
52
52
  "@jest/globals": "29.7.0",
53
53
  "axios": "1.8.2",
54
54
  "cross-env": "7.0.3",
@@ -247,7 +247,7 @@ export abstract class BasicModel {
247
247
  get ownFileGenerations(): FileGenerationSpecification[] {
248
248
  return Array.from(this.fileGenerationsIndex.values());
249
249
  }
250
- get ownProducts(): DataProduct[] {
250
+ get ownDataProducts(): DataProduct[] {
251
251
  return Array.from(this.productsIndex.values());
252
252
  }
253
253
  get ownDataElements(): DataElement[] {
@@ -592,7 +592,7 @@ export abstract class BasicModel {
592
592
  ...this.ownConnections,
593
593
  ...this.ownGenerationSpecifications,
594
594
  ...this.ownFileGenerations,
595
- ...this.ownProducts,
595
+ ...this.ownDataProducts,
596
596
  ...this.ownDataElements,
597
597
  ...this.ownExecutionEnvironments,
598
598
  ...Array.from(this.INTERNAL__unknownElementsIndex.values()),
@@ -47,6 +47,7 @@ import type { FunctionActivator } from './metamodel/pure/packageableElements/fun
47
47
  import type { PureGraphPlugin } from './PureGraphPlugin.js';
48
48
  import type { Testable } from './metamodel/pure/test/Testable.js';
49
49
  import type { IngestDefinition } from './metamodel/pure/packageableElements/ingest/IngestDefinition.js';
50
+ import type { DataProduct } from './metamodel/pure/dataProduct/DataProduct.js';
50
51
 
51
52
  export const DEPENDENCY_ROOT_PACKAGE_PREFIX = '@dependency__';
52
53
  export const generateDependencyRootPackageName = (
@@ -319,6 +320,10 @@ export class DependencyManager {
319
320
  return this.dependencyGraphs.flatMap((dep) => dep.ownIngests);
320
321
  }
321
322
 
323
+ get dataProducts(): DataProduct[] {
324
+ return this.dependencyGraphs.flatMap((dep) => dep.ownDataProducts);
325
+ }
326
+
322
327
  getExtensionElements<T extends PackageableElement>(
323
328
  extensionElementClass: Clazz<T>,
324
329
  ): T[] {
@@ -302,6 +302,15 @@ export class PureModel extends BasicModel {
302
302
  ...this.generationModel.ownFunctions,
303
303
  ];
304
304
  }
305
+ get dataProducts(): DataProduct[] {
306
+ return [
307
+ ...this.coreModel.ownDataProducts,
308
+ ...this.systemModel.ownDataProducts,
309
+ ...this.dependencyManager.dataProducts,
310
+ ...this.ownDataProducts,
311
+ ...this.generationModel.ownDataProducts,
312
+ ];
313
+ }
305
314
  get functionActivators(): FunctionActivator[] {
306
315
  return [
307
316
  ...this.coreModel.ownFunctionActivators,
@@ -139,6 +139,11 @@ export class DataProductRuntimeInfo {
139
139
 
140
140
  export type DataProductElement = Package | Class | Enumeration | Association;
141
141
 
142
+ export interface ElementScope {
143
+ element: PackageableElementReference<DataProductElement>;
144
+ exclude?: boolean | undefined;
145
+ }
146
+
142
147
  export class DataProductElementScope implements Hashable {
143
148
  exclude: boolean | undefined;
144
149
  element!: PackageableElementReference<DataProductElement>;
@@ -222,8 +227,8 @@ export class NativeModelExecutionContext implements Hashable {
222
227
 
223
228
  export class NativeModelAccess implements Hashable {
224
229
  featuredElements: DataProductElementScope[] = [];
225
- nativeModelExecutionContexts!: NativeModelExecutionContext[];
226
- defaultExecutionContext!: string;
230
+ nativeModelExecutionContexts: NativeModelExecutionContext[] = [];
231
+ defaultExecutionContext!: NativeModelExecutionContext;
227
232
  diagrams: DataProductDiagram[] = [];
228
233
  sampleQueries: SampleQuery[] = [];
229
234
 
@@ -234,7 +239,7 @@ export class NativeModelAccess implements Hashable {
234
239
  hashArray(this.featuredElements),
235
240
  hashArray(this.diagrams),
236
241
  hashArray(this.sampleQueries),
237
- this.defaultExecutionContext,
242
+ this.defaultExecutionContext.key,
238
243
  ]);
239
244
  }
240
245
  }
@@ -47,6 +47,7 @@ export class FunctionTest extends AtomicTest implements Hashable {
47
47
  this.id,
48
48
  this.doc ?? '',
49
49
  this.parameters ? hashArray(this.parameters) : '',
50
+ hashArray(this.assertions),
50
51
  ]);
51
52
  }
52
53
  }
@@ -86,7 +86,7 @@ const observe_Abstract_BasicModel = (metamodel: BasicModel): void => {
86
86
  ownFunctions: computed,
87
87
  ownFunctionActivators: computed,
88
88
  ownStores: computed,
89
- ownProducts: computed,
89
+ ownDataProducts: computed,
90
90
  ownIngests: computed,
91
91
  ownFlatDatas: computed,
92
92
  ownDatabases: computed,
@@ -46,6 +46,11 @@ export class QueryDataSpaceExecutionContext extends QueryExecutionContext {
46
46
  executionKey: string | undefined;
47
47
  }
48
48
 
49
+ export class QueryDataProductExecutionContext extends QueryExecutionContext {
50
+ dataProductPath!: string;
51
+ executionKey: string | undefined;
52
+ }
53
+
49
54
  export interface QueryGridConfig {
50
55
  columns: object[];
51
56
  isPivotModeEnabled: boolean | undefined;
@@ -154,6 +159,12 @@ export class QueryDataSpaceExecutionContextInfo extends QueryExecutionContextInf
154
159
  dataSpacePath!: string;
155
160
  executionKey: string | undefined;
156
161
  }
162
+
163
+ export class QueryDataProductNativeExecutionContextInfo extends QueryExecutionContextInfo {
164
+ dataProductPath!: string;
165
+ executionKey: string | undefined;
166
+ }
167
+
157
168
  export interface QueryInfo {
158
169
  name: string;
159
170
  id: string;
@@ -0,0 +1,113 @@
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 { assertTrue, uniq, guaranteeNonNullable } from '@finos/legend-shared';
18
+ import {
19
+ ModelAccessPointGroup,
20
+ type NativeModelAccess,
21
+ type DataProduct,
22
+ type DataProductElement,
23
+ type ElementScope,
24
+ } from '../../graph/metamodel/pure/dataProduct/DataProduct.js';
25
+ import type { Mapping } from '../../graph/metamodel/pure/packageableElements/mapping/Mapping.js';
26
+ import type { GraphManagerState } from '../GraphManagerState.js';
27
+ import type { MappingModelCoverageAnalysisResult } from '../action/analytics/MappingModelCoverageAnalysis.js';
28
+ import { getMappingCompatibleClasses } from '../../graph/helpers/DSL_Mapping_Helper.js';
29
+ import type { Class } from '../../graph/metamodel/pure/packageableElements/domain/Class.js';
30
+ import { elementBelongsToPackage } from '../../graph/helpers/DomainHelper.js';
31
+ import { Package } from '../../graph/metamodel/pure/packageableElements/domain/Package.js';
32
+
33
+ export const isDataProductNative = (dataProduct: DataProduct): boolean => {
34
+ return dataProduct.nativeModelAccess !== undefined;
35
+ };
36
+
37
+ export const isDataProductModeled = (dataProduct: DataProduct): boolean => {
38
+ const groups = dataProduct.accessPointGroups;
39
+ if (groups.length === 1) {
40
+ const group = groups[0];
41
+ if (group instanceof ModelAccessPointGroup) {
42
+ return true;
43
+ }
44
+ }
45
+ return false;
46
+ };
47
+
48
+ export const getModelGroupFromNativeDataProduct = (
49
+ dataProduct: DataProduct,
50
+ ): NativeModelAccess => {
51
+ assertTrue(isDataProductNative(dataProduct), 'Data product is not native');
52
+ return guaranteeNonNullable(
53
+ dataProduct.nativeModelAccess,
54
+ 'Native access point group is expected',
55
+ );
56
+ };
57
+
58
+ const matchesDataElement = (
59
+ _class: Class,
60
+ element: DataProductElement,
61
+ ): boolean => {
62
+ if (_class === element) {
63
+ return true;
64
+ }
65
+ if (element instanceof Package) {
66
+ return elementBelongsToPackage(_class, element);
67
+ }
68
+ return false;
69
+ };
70
+
71
+ export const resolveUsableDataProductClasses = (
72
+ elements: ElementScope[] | undefined,
73
+ mapping: Mapping,
74
+ graphManagerState: GraphManagerState,
75
+ mappingModelCoverageAnalysisResult?: MappingModelCoverageAnalysisResult,
76
+ ): Class[] => {
77
+ let compatibleClasses = getMappingCompatibleClasses(
78
+ mapping,
79
+ graphManagerState.usableClasses,
80
+ );
81
+ if (
82
+ // This check is to make sure that we have `info` field present in `MappedEntity` which
83
+ // contains information about the mapped class path
84
+ mappingModelCoverageAnalysisResult?.mappedEntities.some(
85
+ (m) => m.info !== undefined,
86
+ )
87
+ ) {
88
+ const uniqueCompatibleClasses = uniq(
89
+ mappingModelCoverageAnalysisResult.mappedEntities
90
+ // is root entity filters out mapped classes
91
+ .filter((e) => e.info?.isRootEntity)
92
+ .map((e) => e.info?.classPath),
93
+ );
94
+ compatibleClasses = graphManagerState.graph.classes.filter((c) =>
95
+ uniqueCompatibleClasses.includes(c.path),
96
+ );
97
+ }
98
+ if (elements?.length) {
99
+ return compatibleClasses.filter((_class) => {
100
+ const _classElements = elements
101
+ .filter((e) => matchesDataElement(_class, e.element.value))
102
+ // we sort because we respect the closest definition to the element.
103
+ .sort(
104
+ (a, b) => b.element.value.path.length - a.element.value.path.length,
105
+ );
106
+ if (!_classElements.length) {
107
+ return false;
108
+ }
109
+ return !_classElements[0]?.exclude;
110
+ });
111
+ }
112
+ return compatibleClasses;
113
+ };
@@ -32,6 +32,7 @@ import {
32
32
  type QueryExecutionContextInfo,
33
33
  QueryExplicitExecutionContextInfo,
34
34
  QueryDataSpaceExecutionContextInfo,
35
+ QueryDataProductExecutionContext,
35
36
  } from '../../../../../graph-manager/action/query/Query.js';
36
37
  import {
37
38
  type V1_LightQuery,
@@ -40,6 +41,7 @@ import {
40
41
  V1_QueryExplicitExecutionContext,
41
42
  V1_QueryDataSpaceExecutionContext,
42
43
  type V1_QueryExecutionContext,
44
+ V1_QueryDataProductExecutionContext,
43
45
  } from './query/V1_Query.js';
44
46
  import type { PureModel } from '../../../../../graph/PureModel.js';
45
47
  import { DEPRECATED__ServiceTestResult } from '../../../../../graph-manager/action/service/DEPRECATED__ServiceTestResult.js';
@@ -124,6 +126,7 @@ export const V1_buildLightQuery = (
124
126
  `Query 'artifactId' field is missing`,
125
127
  );
126
128
  metamodel.owner = protocol.owner;
129
+ metamodel.description = protocol.description;
127
130
  metamodel.lastUpdatedAt = protocol.lastUpdatedAt;
128
131
  metamodel.createdAt = protocol.createdAt;
129
132
  metamodel.lastOpenAt = protocol.lastOpenAt;
@@ -337,6 +340,11 @@ export const V1_transformQueryExecutionContext = (
337
340
  protocol.dataSpacePath = execContext.dataSpacePath;
338
341
  protocol.executionKey = execContext.executionKey;
339
342
  return protocol;
343
+ } else if (execContext instanceof QueryDataProductExecutionContext) {
344
+ const protocol = new V1_QueryDataProductExecutionContext();
345
+ protocol.dataProductPath = execContext.dataProductPath;
346
+ protocol.executionKey = execContext.executionKey;
347
+ return protocol;
340
348
  }
341
349
  throw new UnsupportedOperationError('Unsupported query execution context');
342
350
  };
@@ -65,6 +65,7 @@ export class V1_QueryExecutionContext {}
65
65
  export enum V1_QueryExecutionContextType {
66
66
  QUERY_EXPLICIT_EXECUTION_CONTEXT = 'explicitExecutionContext',
67
67
  QUERY_DATASAPCE_EXECUTION_CONTEXT = 'dataSpaceExecutionContext',
68
+ QUERY_DATAPRODUCT_EXECUTION_CONTEXT = 'dataProductExecutionContext',
68
69
  }
69
70
 
70
71
  export class V1_QueryExplicitExecutionContext extends V1_QueryExecutionContext {
@@ -103,6 +104,24 @@ export class V1_QueryDataSpaceExecutionContext extends V1_QueryExecutionContext
103
104
  );
104
105
  }
105
106
 
107
+ export class V1_QueryDataProductExecutionContext extends V1_QueryExecutionContext {
108
+ dataProductPath!: string;
109
+ executionKey: string | undefined;
110
+
111
+ static readonly serialization = new SerializationFactory(
112
+ createModelSchema(V1_QueryDataProductExecutionContext, {
113
+ _type: usingConstantValueSchema(
114
+ V1_QueryExecutionContextType.QUERY_DATAPRODUCT_EXECUTION_CONTEXT,
115
+ ),
116
+ dataProductPath: primitive(),
117
+ executionKey: optional(primitive()),
118
+ }),
119
+ {
120
+ deserializeNullAsUndefined: true,
121
+ },
122
+ );
123
+ }
124
+
106
125
  export const V1_deserializeQueryExecutionContext = (
107
126
  json: PlainObject<V1_QueryExecutionContext>,
108
127
  ): V1_QueryExecutionContext => {
@@ -117,6 +136,11 @@ export const V1_deserializeQueryExecutionContext = (
117
136
  V1_QueryDataSpaceExecutionContext.serialization.schema,
118
137
  json,
119
138
  );
139
+ case V1_QueryExecutionContextType.QUERY_DATAPRODUCT_EXECUTION_CONTEXT:
140
+ return deserialize(
141
+ V1_QueryDataProductExecutionContext.serialization.schema,
142
+ json,
143
+ );
120
144
  default: {
121
145
  throw new UnsupportedOperationError(
122
146
  `Can't deserialize authentication strategy of type '${json._type}': no compatible deserializer available from plugins`,
@@ -138,6 +162,11 @@ export const V1_serializeQueryExecutionContext = (
138
162
  V1_QueryDataSpaceExecutionContext.serialization.schema,
139
163
  protocol,
140
164
  );
165
+ } else if (protocol instanceof V1_QueryDataProductExecutionContext) {
166
+ return serialize(
167
+ V1_QueryDataProductExecutionContext.serialization.schema,
168
+ protocol,
169
+ );
141
170
  }
142
171
  throw new UnsupportedOperationError(
143
172
  `Can't serialize authentication strategy: no compatible serializer available from plugins`,
@@ -217,6 +246,7 @@ export class V1_LightQuery {
217
246
  artifactId!: string;
218
247
  versionId!: string;
219
248
  originalVersionId?: string | undefined;
249
+ description?: string | undefined;
220
250
  lastUpdatedAt?: number | undefined;
221
251
  createdAt?: number | undefined;
222
252
  lastOpenAt?: number | undefined;
@@ -231,6 +261,7 @@ export class V1_LightQuery {
231
261
  lastOpenAt: optional(primitive()),
232
262
  name: primitive(),
233
263
  owner: optional(primitive()),
264
+ description: optional(primitive()),
234
265
  versionId: primitive(),
235
266
  originalVersionId: optional(primitive()),
236
267
  }),
@@ -48,6 +48,7 @@ export class V1_FunctionTest extends V1_AtomicTest {
48
48
  this.id,
49
49
  this.doc ?? '',
50
50
  this.parameters ? hashArray(this.parameters) : '',
51
+ hashArray(this.assertions),
51
52
  ]);
52
53
  }
53
54
  }
@@ -23,3 +23,7 @@ export class V1_DataProductAccessor {
23
23
  path: string[] = [];
24
24
  parameters: string[] = [];
25
25
  }
26
+
27
+ export class V1_SQLAccessor {
28
+ sql!: string;
29
+ }
@@ -167,7 +167,7 @@ export const V1_transformDataProduct = (
167
167
  );
168
168
  }
169
169
  nativeModelAccess.defaultExecutionContext =
170
- metamodelNativeModelAccess.defaultExecutionContext;
170
+ metamodelNativeModelAccess.defaultExecutionContext.key;
171
171
  nativeModelAccess.nativeModelExecutionContexts =
172
172
  metamodelNativeModelAccess.nativeModelExecutionContexts.map(
173
173
  (executionContext) => {
@@ -310,12 +310,16 @@ export const V1_buildNativeModelAccess = (
310
310
  context: V1_GraphBuilderContext,
311
311
  ): NativeModelAccess => {
312
312
  const metamodelNativeModelAccess = new NativeModelAccess();
313
- metamodelNativeModelAccess.defaultExecutionContext =
314
- nativeModelAccess.defaultExecutionContext;
315
313
  metamodelNativeModelAccess.nativeModelExecutionContexts =
316
314
  nativeModelAccess.nativeModelExecutionContexts.map((executionContext) =>
317
315
  V1_buildNativeModelExecutionContext(executionContext, context),
318
316
  );
317
+ metamodelNativeModelAccess.defaultExecutionContext = guaranteeNonNullable(
318
+ metamodelNativeModelAccess.nativeModelExecutionContexts.find(
319
+ (e) => e.key === nativeModelAccess.defaultExecutionContext,
320
+ ),
321
+ `Default execution context ${nativeModelAccess.defaultExecutionContext} not found among native model execution contexts`,
322
+ );
319
323
  if (nativeModelAccess.sampleQueries) {
320
324
  metamodelNativeModelAccess.sampleQueries =
321
325
  nativeModelAccess.sampleQueries.map((sampleQuery) =>
@@ -70,6 +70,7 @@ import { V1_ColSpec } from '../../../model/valueSpecification/raw/classInstance/
70
70
  import {
71
71
  V1_DataProductAccessor,
72
72
  V1_RelationStoreAccessor,
73
+ V1_SQLAccessor,
73
74
  } from '../../../model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.js';
74
75
  import { V1_multiplicityModelSchema } from './V1_CoreSerializationHelper.js';
75
76
  import type {
@@ -129,6 +130,7 @@ export enum V1_ClassInstanceType {
129
130
  RELATION_STORE_ACCESSOR = '>',
130
131
  INGEST_ACCESSOR = 'I',
131
132
  DATA_PRODUCT_ACCESSOR = 'P',
133
+ SQL_ACCESSOR = 'SQL',
132
134
 
133
135
  TDS_AGGREGATE_VALUE = 'tdsAggregateValue',
134
136
  TDS_COLUMN_INFORMATION = 'tdsColumnInformation',
@@ -779,6 +781,10 @@ const dataProductAccessorModelSchema = createModelSchema(
779
781
  },
780
782
  );
781
783
 
784
+ const sqlAccessorModelSchema = createModelSchema(V1_SQLAccessor, {
785
+ sql: primitive(),
786
+ });
787
+
782
788
  const colSpecModelSchema = (
783
789
  plugins: PureProtocolProcessorPlugin[],
784
790
  ): ModelSchema<V1_ColSpec> =>
@@ -854,6 +860,8 @@ export function V1_deserializeClassInstanceValue(
854
860
  return deserialize(relationStoreAccessorModelSchema, json);
855
861
  case V1_ClassInstanceType.DATA_PRODUCT_ACCESSOR:
856
862
  return deserialize(dataProductAccessorModelSchema, json);
863
+ case V1_ClassInstanceType.SQL_ACCESSOR:
864
+ return deserialize(sqlAccessorModelSchema, json);
857
865
  default: {
858
866
  const deserializers = plugins.flatMap(
859
867
  (plugin) =>
@@ -910,6 +918,8 @@ export function V1_serializeClassInstanceValue(
910
918
  return serialize(relationStoreAccessorModelSchema, protocol);
911
919
  } else if (protocol instanceof V1_DataProductAccessor) {
912
920
  return serialize(dataProductAccessorModelSchema, protocol);
921
+ } else if (protocol instanceof V1_SQLAccessor) {
922
+ return serialize(sqlAccessorModelSchema, protocol);
913
923
  }
914
924
  const serializers = plugins.flatMap(
915
925
  (plugin) =>
package/src/index.ts CHANGED
@@ -287,6 +287,7 @@ export { V1_TestAuthenticationStrategy } from './graph-manager/protocol/pure/v1/
287
287
  export {
288
288
  V1_RelationStoreAccessor,
289
289
  V1_DataProductAccessor,
290
+ V1_SQLAccessor,
290
291
  } from './graph-manager/protocol/pure/v1/model/valueSpecification/raw/classInstance/relation/V1_RelationStoreAccessor.js';
291
292
  export { V1_PackageableConnection } from './graph-manager/protocol/pure/v1/model/packageableElements/connection/V1_PackageableConnection.js';
292
293
  export {
@@ -398,6 +399,7 @@ export {
398
399
  } from './graph-manager/protocol/pure/v1/lakehouse/subscriptions/V1_ConsumerSubscriptions.js';
399
400
  export {
400
401
  V1_DataProductArtifact,
402
+ V1_NativeModelExecutionContextInfo,
401
403
  V1_AccessPointImplementation,
402
404
  V1_AccessPointGroupInfo,
403
405
  V1_SampleQueryInfo,
@@ -780,8 +782,6 @@ export {
780
782
  SupportInfo,
781
783
  ModelAccessPointGroup,
782
784
  InLineSampleQuery,
783
- NativeModelAccess,
784
- NativeModelExecutionContext,
785
785
  PackageableElementSampleQuery,
786
786
  SampleQuery,
787
787
  DataProductRuntimeInfo,
@@ -793,6 +793,8 @@ export {
793
793
  Expertise,
794
794
  ExternalDataProductType,
795
795
  type DataProductElement,
796
+ NativeModelAccess,
797
+ NativeModelExecutionContext,
796
798
  DataProductOperationalMetadata,
797
799
  } from './graph/metamodel/pure/dataProduct/DataProduct.js';
798
800
  export * from './graph-manager/action/changeDetection/DataProductObserveHelper.js';
@@ -971,6 +973,7 @@ export {
971
973
  DatasetEntitlementAccessApprovedReport,
972
974
  DatasetEntitlementUnsupportedReport,
973
975
  } from './graph-manager/action/analytics/StoreEntitlementAnalysis.js';
976
+ export * from './graph-manager/helpers/DataProductHelper.js';
974
977
  export {
975
978
  FunctionAnalysisInfo,
976
979
  FunctionAnalysisParameterInfo,
package/tsconfig.json CHANGED
@@ -435,6 +435,7 @@
435
435
  "./src/graph-manager/extensions/Testable_PureGraphManagerPlugin_Extension.ts",
436
436
  "./src/graph-manager/helpers/DSL_Data_GraphManagerHelper.ts",
437
437
  "./src/graph-manager/helpers/DSL_ExternalFormat_GraphManagerHelper.ts",
438
+ "./src/graph-manager/helpers/DataProductHelper.ts",
438
439
  "./src/graph-manager/helpers/ValueSpecificationGraphManagerHelper.ts",
439
440
  "./src/graph-manager/protocol/pure/PureGraphManagerBuilder.ts",
440
441
  "./src/graph-manager/protocol/pure/PureProtocolProcessorPlugin.ts",