@finos/legend-graph 32.6.3 → 32.6.5
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.
- package/lib/graph-manager/AbstractPureGraphManager.d.ts +1 -1
- package/lib/graph-manager/AbstractPureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +2 -2
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.d.ts +5 -1
- package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.js +31 -4
- package/lib/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js +3 -3
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/src/graph-manager/AbstractPureGraphManager.ts +1 -1
- package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +8 -3
- package/src/graph-manager/protocol/pure/v1/helpers/V1_AccessorHelper.ts +67 -3
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.ts +16 -8
- package/src/index.ts +1 -0
|
@@ -2150,14 +2150,14 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
2150
2150
|
|
|
2151
2151
|
//
|
|
2152
2152
|
|
|
2153
|
-
override createAccessorFromPackageableElement(
|
|
2153
|
+
override async createAccessorFromPackageableElement(
|
|
2154
2154
|
element: PackageableElement,
|
|
2155
2155
|
graph: PureModel,
|
|
2156
2156
|
options?: {
|
|
2157
2157
|
schemaName?: string | undefined;
|
|
2158
2158
|
tableName?: string | undefined;
|
|
2159
2159
|
},
|
|
2160
|
-
): Accessor | undefined {
|
|
2160
|
+
): Promise<Accessor | undefined> {
|
|
2161
2161
|
if (
|
|
2162
2162
|
!(element instanceof IngestDefinition) &&
|
|
2163
2163
|
!(element instanceof Database)
|
|
@@ -2170,7 +2170,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
2170
2170
|
this.graphBuilderExtensions,
|
|
2171
2171
|
this.logService,
|
|
2172
2172
|
).build();
|
|
2173
|
-
return V1_createAccessorFromPackageableElement(
|
|
2173
|
+
return V1_createAccessorFromPackageableElement(
|
|
2174
|
+
element,
|
|
2175
|
+
context,
|
|
2176
|
+
this,
|
|
2177
|
+
options,
|
|
2178
|
+
);
|
|
2174
2179
|
}
|
|
2175
2180
|
|
|
2176
2181
|
override async buildDataProductAccessor(
|
|
@@ -51,6 +51,7 @@ import { V1_deserializeIngestDefinitionContent } from '../transformation/purePro
|
|
|
51
51
|
import {
|
|
52
52
|
RelationElement,
|
|
53
53
|
RelationElementsData,
|
|
54
|
+
RelationRowTestData,
|
|
54
55
|
} from '../../../../../graph/metamodel/pure/data/EmbeddedData.js';
|
|
55
56
|
import type { RawLambda } from '../../../../../graph/metamodel/pure/rawValueSpecification/RawLambda.js';
|
|
56
57
|
import type { AbstractPureGraphManager } from '../../../../AbstractPureGraphManager.js';
|
|
@@ -229,7 +230,7 @@ export const V1_buildRelationTypeFromAccessPointImplementation = (
|
|
|
229
230
|
* For IngestDefinition: requires `datasetName` to identify the dataset.
|
|
230
231
|
* For Database: requires `schemaName` and `tableName` to identify the table.
|
|
231
232
|
*/
|
|
232
|
-
export const
|
|
233
|
+
export const V1_createAccessorFromPackageableElementWithNonFunctionSources = (
|
|
233
234
|
element: AccessorOwner,
|
|
234
235
|
context: V1_GraphBuilderContext,
|
|
235
236
|
options?: {
|
|
@@ -238,6 +239,7 @@ export const V1_createAccessorFromPackageableElement = (
|
|
|
238
239
|
},
|
|
239
240
|
): Accessor | undefined => {
|
|
240
241
|
if (element instanceof IngestDefinition) {
|
|
242
|
+
const datasetName = options?.tableName;
|
|
241
243
|
const content = returnUndefOnError(() =>
|
|
242
244
|
V1_deserializeIngestDefinitionContent(element.content),
|
|
243
245
|
);
|
|
@@ -245,7 +247,6 @@ export const V1_createAccessorFromPackageableElement = (
|
|
|
245
247
|
if (!content) {
|
|
246
248
|
return undefined;
|
|
247
249
|
}
|
|
248
|
-
const datasetName = options?.tableName;
|
|
249
250
|
const dataset = datasetName
|
|
250
251
|
? content.datasets?.find((ds) => ds.name === datasetName)
|
|
251
252
|
: content.datasets?.[0];
|
|
@@ -312,6 +313,67 @@ const buildRelationTypeFromMetadata = (
|
|
|
312
313
|
return relationType;
|
|
313
314
|
};
|
|
314
315
|
|
|
316
|
+
export const V1_createAccessorFromPackageableElement = async (
|
|
317
|
+
element: AccessorOwner,
|
|
318
|
+
context: V1_GraphBuilderContext,
|
|
319
|
+
graphManager: AbstractPureGraphManager,
|
|
320
|
+
options?: {
|
|
321
|
+
schemaName?: string | undefined;
|
|
322
|
+
tableName?: string | undefined;
|
|
323
|
+
},
|
|
324
|
+
): Promise<Accessor | undefined> => {
|
|
325
|
+
if (element instanceof IngestDefinition) {
|
|
326
|
+
const datasetName = options?.tableName;
|
|
327
|
+
const content = returnUndefOnError(() =>
|
|
328
|
+
V1_deserializeIngestDefinitionContent(element.content),
|
|
329
|
+
);
|
|
330
|
+
let matviewDataSet;
|
|
331
|
+
if (datasetName) {
|
|
332
|
+
matviewDataSet = element.TEMPORARY_MATVIEW_FUNCTION_DATA_SETS?.find(
|
|
333
|
+
(ds) => ds.name === datasetName,
|
|
334
|
+
);
|
|
335
|
+
} else if (element.TEMPORARY_MATVIEW_FUNCTION_DATA_SETS?.length) {
|
|
336
|
+
// Prefer non-matview datasets - only use matview if no non-matview dataset exists
|
|
337
|
+
const matviewNames = new Set(
|
|
338
|
+
element.TEMPORARY_MATVIEW_FUNCTION_DATA_SETS.map((ds) => ds.name),
|
|
339
|
+
);
|
|
340
|
+
const hasNonMatviewDataset = content?.datasets?.some(
|
|
341
|
+
(ds) => !matviewNames.has(ds.name),
|
|
342
|
+
);
|
|
343
|
+
matviewDataSet = hasNonMatviewDataset
|
|
344
|
+
? undefined
|
|
345
|
+
: element.TEMPORARY_MATVIEW_FUNCTION_DATA_SETS[0];
|
|
346
|
+
}
|
|
347
|
+
if (matviewDataSet) {
|
|
348
|
+
const relationTypeMetadata = await graphManager.getLambdaRelationType(
|
|
349
|
+
matviewDataSet.source.function,
|
|
350
|
+
context.graph,
|
|
351
|
+
);
|
|
352
|
+
const relationType = buildRelationTypeFromMetadata(
|
|
353
|
+
relationTypeMetadata,
|
|
354
|
+
context,
|
|
355
|
+
);
|
|
356
|
+
addMilestonedColumnsForWriteMode(
|
|
357
|
+
relationType,
|
|
358
|
+
content?.writeMode,
|
|
359
|
+
context,
|
|
360
|
+
);
|
|
361
|
+
return new IngestionAccessor(
|
|
362
|
+
element.path,
|
|
363
|
+
undefined,
|
|
364
|
+
matviewDataSet.name,
|
|
365
|
+
relationType,
|
|
366
|
+
element,
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return V1_createAccessorFromPackageableElementWithNonFunctionSources(
|
|
371
|
+
element,
|
|
372
|
+
context,
|
|
373
|
+
options,
|
|
374
|
+
);
|
|
375
|
+
};
|
|
376
|
+
|
|
315
377
|
export const V1_buildDataProductAccessor = async (
|
|
316
378
|
element: DataProduct,
|
|
317
379
|
context: V1_GraphBuilderContext,
|
|
@@ -457,7 +519,9 @@ export const V1_buildRelationElementsDataFromAccessors = (
|
|
|
457
519
|
relationElement.columns = accessor.relationType.columns.map(
|
|
458
520
|
(column) => column.name,
|
|
459
521
|
);
|
|
460
|
-
|
|
522
|
+
const row = new RelationRowTestData();
|
|
523
|
+
row.values = relationElement.columns.map(() => '');
|
|
524
|
+
relationElement.rows = [row];
|
|
461
525
|
return relationElement;
|
|
462
526
|
});
|
|
463
527
|
return relationElementsData;
|
|
@@ -135,9 +135,9 @@ import {
|
|
|
135
135
|
DataProduct,
|
|
136
136
|
LakehouseAccessPoint,
|
|
137
137
|
} from '../../../../../../../../graph/metamodel/pure/dataProduct/DataProduct.js';
|
|
138
|
-
import { V1_createAccessorFromPackageableElement } from '../../../../helpers/V1_AccessorHelper.js';
|
|
139
138
|
import { Database } from '../../../../../../../../graph/metamodel/pure/packageableElements/store/relational/model/Database.js';
|
|
140
139
|
import { IngestDefinition } from '../../../../../../../../graph/metamodel/pure/packageableElements/ingest/IngestDefinition.js';
|
|
140
|
+
import { V1_createAccessorFromPackageableElementWithNonFunctionSources } from '../../../../helpers/V1_AccessorHelper.js';
|
|
141
141
|
|
|
142
142
|
const buildPrimtiveInstanceValue = (
|
|
143
143
|
type: PRIMITIVE_TYPE,
|
|
@@ -562,10 +562,14 @@ export class V1_ValueSpecificationBuilder
|
|
|
562
562
|
Database,
|
|
563
563
|
);
|
|
564
564
|
const accessor = guaranteeNonNullable(
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
565
|
+
V1_createAccessorFromPackageableElementWithNonFunctionSources(
|
|
566
|
+
db,
|
|
567
|
+
this.context,
|
|
568
|
+
{
|
|
569
|
+
schemaName,
|
|
570
|
+
tableName,
|
|
571
|
+
},
|
|
572
|
+
),
|
|
569
573
|
`Can't build accessor for database '${dbPath}'`,
|
|
570
574
|
);
|
|
571
575
|
const accessorInstanceValue = new AccessorInstanceValue();
|
|
@@ -587,9 +591,13 @@ export class V1_ValueSpecificationBuilder
|
|
|
587
591
|
IngestDefinition,
|
|
588
592
|
);
|
|
589
593
|
const accessor = guaranteeNonNullable(
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
594
|
+
V1_createAccessorFromPackageableElementWithNonFunctionSources(
|
|
595
|
+
ingestDef,
|
|
596
|
+
this.context,
|
|
597
|
+
{
|
|
598
|
+
tableName: datasetName,
|
|
599
|
+
},
|
|
600
|
+
),
|
|
593
601
|
`Can't build accessor for ingest definition '${ingestPath}'`,
|
|
594
602
|
);
|
|
595
603
|
const accessorInstanceValue = new AccessorInstanceValue();
|
package/src/index.ts
CHANGED
|
@@ -888,6 +888,7 @@ export {
|
|
|
888
888
|
} from './graph/metamodel/pure/packageableElements/relation/Accessor.js';
|
|
889
889
|
export {
|
|
890
890
|
V1_createAccessorFromPackageableElement,
|
|
891
|
+
V1_createAccessorFromPackageableElementWithNonFunctionSources,
|
|
891
892
|
V1_resolveAccessorsFromRawLambda,
|
|
892
893
|
V1_buildRelationElementsDataFromAccessors,
|
|
893
894
|
V1_buildRelationTypeFromAccessPointImplementation,
|