@finos/legend-graph 32.6.4 → 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 +27 -2
- 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 +63 -2
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.ts +16 -8
- package/src/index.ts +1 -0
|
@@ -230,7 +230,7 @@ export const V1_buildRelationTypeFromAccessPointImplementation = (
|
|
|
230
230
|
* For IngestDefinition: requires `datasetName` to identify the dataset.
|
|
231
231
|
* For Database: requires `schemaName` and `tableName` to identify the table.
|
|
232
232
|
*/
|
|
233
|
-
export const
|
|
233
|
+
export const V1_createAccessorFromPackageableElementWithNonFunctionSources = (
|
|
234
234
|
element: AccessorOwner,
|
|
235
235
|
context: V1_GraphBuilderContext,
|
|
236
236
|
options?: {
|
|
@@ -239,6 +239,7 @@ export const V1_createAccessorFromPackageableElement = (
|
|
|
239
239
|
},
|
|
240
240
|
): Accessor | undefined => {
|
|
241
241
|
if (element instanceof IngestDefinition) {
|
|
242
|
+
const datasetName = options?.tableName;
|
|
242
243
|
const content = returnUndefOnError(() =>
|
|
243
244
|
V1_deserializeIngestDefinitionContent(element.content),
|
|
244
245
|
);
|
|
@@ -246,7 +247,6 @@ export const V1_createAccessorFromPackageableElement = (
|
|
|
246
247
|
if (!content) {
|
|
247
248
|
return undefined;
|
|
248
249
|
}
|
|
249
|
-
const datasetName = options?.tableName;
|
|
250
250
|
const dataset = datasetName
|
|
251
251
|
? content.datasets?.find((ds) => ds.name === datasetName)
|
|
252
252
|
: content.datasets?.[0];
|
|
@@ -313,6 +313,67 @@ const buildRelationTypeFromMetadata = (
|
|
|
313
313
|
return relationType;
|
|
314
314
|
};
|
|
315
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
|
+
|
|
316
377
|
export const V1_buildDataProductAccessor = async (
|
|
317
378
|
element: DataProduct,
|
|
318
379
|
context: V1_GraphBuilderContext,
|
|
@@ -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,
|