@contrail/flexplm 1.5.0-alpha.aaef470 → 1.5.0
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/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,8 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
6
6
|
Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [1.5.0] - 2026-05-12
|
|
9
11
|
### Added
|
|
10
12
|
- Added support for Inbound `LCSMaterial` to sync to the entity class `item` with type path `item:material` and `itemNumber` as identifier. This is controlled by an `LCSMaterial.processAsItem` (default `false`) config default.
|
|
11
13
|
- Added optional identity-service lookup in `DataConverter.setObjectReferenceValue` for resolving inbound `object_reference` values. Enabled per referenced entity type via `config.search.<entityType>.useIdentityServiceForInboundData`. When enabled the reference is resolved via the identity service using a uniqueness pool key; otherwise behavior falls through to the existing `getAllObjectReferences` query path.
|
|
@@ -32,7 +32,7 @@ export declare class DataConverter {
|
|
|
32
32
|
private buildObjectReferenceContext;
|
|
33
33
|
private lookupObjectReferenceViaIdentityService;
|
|
34
34
|
private lookupObjectReferenceViaQuery;
|
|
35
|
-
private
|
|
35
|
+
private pickSingleResult;
|
|
36
36
|
getAllObjectReferences(entityType: string, rootTypeCriteria: any, postProcessCriteria?: any): Promise<any[]>;
|
|
37
37
|
checkKeysAndValues(criteria: any, arrayOfObjects: any, entityTypePath: any): any[];
|
|
38
38
|
filterOutArchivedAndTrashedEntities(entities: any[]): any[];
|
|
@@ -417,25 +417,27 @@ class DataConverter {
|
|
|
417
417
|
entityName: 'identity',
|
|
418
418
|
criteria: { poolKey, propertyName, propertyValue }
|
|
419
419
|
}) ?? [];
|
|
420
|
-
|
|
420
|
+
const match = this.pickSingleResult(identityResults, ctx.combinedCriteria);
|
|
421
|
+
return match ? match.entityReference.split(':')[1] : "";
|
|
421
422
|
}
|
|
422
423
|
async lookupObjectReferenceViaQuery(ctx) {
|
|
423
424
|
let arrObjectReferences = await this.getAllObjectReferences(ctx.entityType, ctx.rootTypeCriteria);
|
|
424
425
|
if (ctx.entityType !== ctx.entityTypePath) {
|
|
425
426
|
arrObjectReferences = this.checkKeysAndValues(ctx.typeCriteria, arrObjectReferences, ctx.entityTypePath);
|
|
426
427
|
}
|
|
427
|
-
|
|
428
|
+
const match = this.pickSingleResult(arrObjectReferences, ctx.combinedCriteria);
|
|
429
|
+
return match ? match.id : "";
|
|
428
430
|
}
|
|
429
|
-
|
|
431
|
+
pickSingleResult(results, combinedCriteria) {
|
|
430
432
|
if (!results.length) {
|
|
431
433
|
console.warn(`The passed in object reference criteria ${JSON.stringify(combinedCriteria)} didn't match any entities.`);
|
|
432
|
-
return
|
|
434
|
+
return undefined;
|
|
433
435
|
}
|
|
434
436
|
if (results.length > 1) {
|
|
435
437
|
console.warn(`The passed in object reference criteria has duplicate records found ${JSON.stringify(combinedCriteria)}.`);
|
|
436
|
-
return
|
|
438
|
+
return undefined;
|
|
437
439
|
}
|
|
438
|
-
return
|
|
440
|
+
return results[0];
|
|
439
441
|
}
|
|
440
442
|
async getAllObjectReferences(entityType, rootTypeCriteria, postProcessCriteria = null) {
|
|
441
443
|
const entities = new sdk_1.Entities();
|
|
@@ -826,7 +826,7 @@ describe('setObjectReferenceValue - identity service', () => {
|
|
|
826
826
|
checkSpy.mockRestore();
|
|
827
827
|
}
|
|
828
828
|
});
|
|
829
|
-
it('
|
|
829
|
+
it('pickSingleResult single result - identity branch parses id from entityReference', async () => {
|
|
830
830
|
const config = baseConfig();
|
|
831
831
|
config.search = { item: { useIdentityServiceForInboundData: true } };
|
|
832
832
|
const dc = new data_converter_1.DataConverter(config, new transform_data_1.MapFileUtil(new sdk_1.Entities()));
|
package/package.json
CHANGED
|
@@ -947,7 +947,7 @@ describe('setObjectReferenceValue - identity service', () => {
|
|
|
947
947
|
}
|
|
948
948
|
});
|
|
949
949
|
|
|
950
|
-
it('
|
|
950
|
+
it('pickSingleResult single result - identity branch parses id from entityReference', async () => {
|
|
951
951
|
const config = baseConfig();
|
|
952
952
|
config.search = { item: { useIdentityServiceForInboundData: true } };
|
|
953
953
|
const dc = new DataConverter(config, new MapFileUtil(new Entities()));
|
|
@@ -520,7 +520,8 @@ export class DataConverter {
|
|
|
520
520
|
criteria: { poolKey, propertyName, propertyValue }
|
|
521
521
|
}) ?? [];
|
|
522
522
|
|
|
523
|
-
|
|
523
|
+
const match = this.pickSingleResult(identityResults, ctx.combinedCriteria);
|
|
524
|
+
return match ? match.entityReference.split(':')[1] : "";
|
|
524
525
|
}
|
|
525
526
|
|
|
526
527
|
private async lookupObjectReferenceViaQuery(ctx: ObjectReferenceContext): Promise<string> {
|
|
@@ -528,19 +529,20 @@ export class DataConverter {
|
|
|
528
529
|
if (ctx.entityType !== ctx.entityTypePath) {
|
|
529
530
|
arrObjectReferences = this.checkKeysAndValues(ctx.typeCriteria, arrObjectReferences, ctx.entityTypePath);
|
|
530
531
|
}
|
|
531
|
-
|
|
532
|
+
const match = this.pickSingleResult(arrObjectReferences, ctx.combinedCriteria);
|
|
533
|
+
return match ? match.id : "";
|
|
532
534
|
}
|
|
533
535
|
|
|
534
|
-
private
|
|
536
|
+
private pickSingleResult(results: any[], combinedCriteria: any): any | undefined {
|
|
535
537
|
if (!results.length) {
|
|
536
538
|
console.warn(`The passed in object reference criteria ${JSON.stringify(combinedCriteria)} didn't match any entities.`);
|
|
537
|
-
return
|
|
539
|
+
return undefined;
|
|
538
540
|
}
|
|
539
541
|
if (results.length > 1) {
|
|
540
542
|
console.warn(`The passed in object reference criteria has duplicate records found ${JSON.stringify(combinedCriteria)}.`);
|
|
541
|
-
return
|
|
543
|
+
return undefined;
|
|
542
544
|
}
|
|
543
|
-
return
|
|
545
|
+
return results[0];
|
|
544
546
|
}
|
|
545
547
|
|
|
546
548
|
/**
|