@contrail/flexplm 1.5.1-alpha.c9b11be → 1.6.0-alpha.8e73fa3
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/cli/commands/compile.d.ts +4 -0
- package/lib/cli/commands/compile.js +73 -0
- package/lib/cli/commands/compile.spec.d.ts +1 -0
- package/lib/cli/commands/compile.spec.js +80 -0
- package/lib/cli/commands/create.d.ts +5 -0
- package/lib/cli/commands/create.js +77 -0
- package/lib/cli/commands/create.spec.d.ts +1 -0
- package/lib/cli/commands/create.spec.js +78 -0
- package/lib/cli/commands/upload.d.ts +17 -0
- package/lib/cli/commands/upload.js +228 -0
- package/lib/cli/commands/upload.spec.d.ts +1 -0
- package/lib/cli/commands/upload.spec.js +88 -0
- package/lib/cli/index.d.ts +5 -0
- package/lib/cli/index.js +70 -0
- package/lib/cli/index.spec.d.ts +1 -0
- package/lib/cli/index.spec.js +85 -0
- package/lib/cli/template/mapping-template.ts.template +62 -0
- package/lib/entity-processor/base-entity-processor.d.ts +65 -0
- package/lib/entity-processor/base-entity-processor.js +71 -0
- package/lib/entity-processor/base-entity-processor.spec.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/interfaces/mapping-file.d.ts +783 -0
- package/lib/interfaces/mapping-file.js +2 -0
- package/lib/publish/base-process-publish-assortment.d.ts +26 -0
- package/lib/publish/base-process-publish-assortment.js +87 -13
- package/lib/publish/base-process-publish-assortment.spec.js +100 -9
- package/lib/publish/mockData.js +5 -0
- package/lib/transform/identifier-conversion-spec-mockData.js +34 -6
- package/lib/transform/identifier-conversion.d.ts +36 -0
- package/lib/transform/identifier-conversion.js +36 -0
- package/lib/transform/identifier-conversion.spec.js +4 -0
- package/lib/util/config-defaults.js +3 -0
- package/lib/util/config-defaults.spec.js +9 -0
- package/lib/util/data-converter-spec-mockData.js +17 -3
- package/lib/util/data-converter.d.ts +97 -0
- package/lib/util/data-converter.js +127 -1
- package/lib/util/data-converter.spec.js +2 -0
- package/lib/util/error-response-object.d.ts +5 -0
- package/lib/util/error-response-object.js +7 -0
- package/lib/util/event-short-message-status.js +1 -0
- package/lib/util/federation.js +8 -0
- package/lib/util/flexplm-connect.d.ts +7 -0
- package/lib/util/flexplm-connect.js +14 -0
- package/lib/util/logger-config.js +1 -0
- package/lib/util/map-util-spec-mockData.js +17 -3
- package/lib/util/map-utils.d.ts +27 -0
- package/lib/util/map-utils.js +27 -0
- package/lib/util/thumbnail-util.d.ts +21 -0
- package/lib/util/thumbnail-util.js +28 -1
- package/lib/util/thumbnail-util.spec.js +6 -0
- package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
- package/lib/util/type-conversion-utils.d.ts +151 -0
- package/lib/util/type-conversion-utils.js +154 -0
- package/lib/util/type-defaults.d.ts +66 -0
- package/lib/util/type-defaults.js +66 -0
- package/lib/util/type-defaults.spec.js +5 -5
- package/lib/util/type-utils.d.ts +21 -0
- package/lib/util/type-utils.js +23 -0
- package/lib/util/type-utils.spec.js +2 -0
- package/package.json +22 -6
- package/scripts/copy-template.js +10 -0
- package/.github/pull_request_template.md +0 -31
- package/.github/workflows/flexplm-lib.yml +0 -27
- package/.github/workflows/publish-to-npm.yml +0 -121
- package/CHANGELOG.md +0 -49
- package/publish.bat +0 -5
- package/publish.sh +0 -5
- package/src/entity-processor/base-entity-processor.spec.ts +0 -689
- package/src/entity-processor/base-entity-processor.ts +0 -583
- package/src/flexplm-request.ts +0 -28
- package/src/flexplm-utils.spec.ts +0 -27
- package/src/flexplm-utils.ts +0 -29
- package/src/index.ts +0 -22
- package/src/interfaces/interfaces.ts +0 -122
- package/src/interfaces/item-family-changes.ts +0 -67
- package/src/interfaces/publish-change-data.ts +0 -43
- package/src/publish/base-process-publish-assortment-callback.ts +0 -50
- package/src/publish/base-process-publish-assortment.spec.ts +0 -2154
- package/src/publish/base-process-publish-assortment.ts +0 -1173
- package/src/publish/mockData.ts +0 -4561
- package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
- package/src/transform/identifier-conversion.spec.ts +0 -386
- package/src/transform/identifier-conversion.ts +0 -282
- package/src/util/config-defaults.spec.ts +0 -445
- package/src/util/config-defaults.ts +0 -106
- package/src/util/data-converter-spec-mockData.ts +0 -231
- package/src/util/data-converter.spec.ts +0 -1622
- package/src/util/data-converter.ts +0 -819
- package/src/util/error-response-object.spec.ts +0 -116
- package/src/util/error-response-object.ts +0 -50
- package/src/util/event-short-message-status.ts +0 -22
- package/src/util/federation.ts +0 -172
- package/src/util/flexplm-connect.spec.ts +0 -132
- package/src/util/flexplm-connect.ts +0 -208
- package/src/util/logger-config.ts +0 -20
- package/src/util/map-util-spec-mockData.ts +0 -231
- package/src/util/map-utils.spec.ts +0 -103
- package/src/util/map-utils.ts +0 -41
- package/src/util/mockData.ts +0 -101
- package/src/util/thumbnail-util.spec.ts +0 -508
- package/src/util/thumbnail-util.ts +0 -272
- package/src/util/type-conversion-utils-spec-mockData.ts +0 -272
- package/src/util/type-conversion-utils.spec.ts +0 -1031
- package/src/util/type-conversion-utils.ts +0 -490
- package/src/util/type-defaults.spec.ts +0 -797
- package/src/util/type-defaults.ts +0 -320
- package/src/util/type-utils.spec.ts +0 -227
- package/src/util/type-utils.ts +0 -144
- package/tsconfig.json +0 -24
- package/tslint.json +0 -57
|
@@ -32,6 +32,15 @@ export declare class BaseProcessPublishAssortment {
|
|
|
32
32
|
skip_await?: undefined;
|
|
33
33
|
}>;
|
|
34
34
|
getPublishInfo(assortmentId: string, assortmentPublishChangeId: string, apcHistory: any, publisher: any): Promise<any>;
|
|
35
|
+
/** Gets the version number of the snapshot that was created for the publish change.
|
|
36
|
+
* But if no snapshot was found for the publish change, and the last snapshot was
|
|
37
|
+
* created before the publish change, then it returns 'after: versionNumber' where
|
|
38
|
+
* versionNumber is the version number of the last snapshot.
|
|
39
|
+
* If no snapshot was found for the publish change, and the last snapshot was
|
|
40
|
+
* created after the publish change, then it returns 'unknown'.
|
|
41
|
+
*
|
|
42
|
+
* @returns versionNumber or 'unknown' or 'after: versionNumber'
|
|
43
|
+
*/
|
|
35
44
|
getSnapshotVersion(assortment: any, apc: any): Promise<number | string>;
|
|
36
45
|
getSeasonFederation(assortmentId: any): Promise<SeasonFederation>;
|
|
37
46
|
getAssortment(assortmentId: any): Promise<any>;
|
|
@@ -77,12 +86,29 @@ export declare class BaseProcessPublishAssortment {
|
|
|
77
86
|
getResultsCount(events: any): any;
|
|
78
87
|
private sendEvents;
|
|
79
88
|
private sendToFlexPLM;
|
|
89
|
+
private buildPublishError;
|
|
80
90
|
private saveToLocalFile;
|
|
81
91
|
private handleVibeIQFile;
|
|
82
92
|
private sendPublishPayloadEvent;
|
|
83
93
|
private getCurrentDateString;
|
|
84
94
|
getItemFamilyChanges(pcd: PublishChangeData, changeDetail: any, assortmentItemFullChangeMap: Map<string, any>, assortmentItemDeleteMap: Map<string, any>): Map<string, ItemFamilyChanges>;
|
|
85
95
|
getEventsForPublishChangeData(publishChangeData: PublishChangeData): Promise<SeasonalPayload[]>;
|
|
96
|
+
/**Returns the events for a given ItemFamilyChanges object
|
|
97
|
+
*
|
|
98
|
+
* Cases:
|
|
99
|
+
* Add just family:
|
|
100
|
+
* Add option to family (with existing option):
|
|
101
|
+
* Add option to family (no options on assortment):
|
|
102
|
+
* Remove family and option:
|
|
103
|
+
* Remove only option and leave family:
|
|
104
|
+
* Remove one option of multiple for family:
|
|
105
|
+
*
|
|
106
|
+
* @param itemFamilyChanges
|
|
107
|
+
* @param assortmentId
|
|
108
|
+
* @param assortmentFederationId
|
|
109
|
+
* @param itemToFederatedIdMapping
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
86
112
|
getEventsForItemFamilyChanges(itemFamilyChanges: ItemFamilyChanges, assortmentId: string, seasonFed: SeasonFederation, itemToFederatedIdMapping: Map<string, string>): Promise<SeasonalPayload[]>;
|
|
87
113
|
getProjectItem(itemFamilyChanges: ItemFamilyChanges, id: string): any;
|
|
88
114
|
getSeasonalData(projectItem: any): Promise<object>;
|
|
@@ -13,7 +13,7 @@ const app_framework_1 = require("@contrail/app-framework");
|
|
|
13
13
|
const event_short_message_status_1 = require("../util/event-short-message-status");
|
|
14
14
|
class BaseProcessPublishAssortment {
|
|
15
15
|
constructor(_config, _dc, _mapFileUtil) {
|
|
16
|
-
this.TTL = 30 * 24 * 60 * 60 * 1000;
|
|
16
|
+
this.TTL = 30 * 24 * 60 * 60 * 1000; // 30 days
|
|
17
17
|
this.cache = {
|
|
18
18
|
carriedFromSeason: {}
|
|
19
19
|
};
|
|
@@ -52,13 +52,14 @@ class BaseProcessPublishAssortment {
|
|
|
52
52
|
}
|
|
53
53
|
apcHistory = await this.getApcHistory(assortmentId);
|
|
54
54
|
const sinceDate = await this.getSinceDate(assortmentId, assortmentPublishChangeId, apcHistory);
|
|
55
|
+
//Get detail information
|
|
55
56
|
const assortmentPublishChange = await this.downloadAssortmentPublishChange(assortmentId, assortmentPublishChangeId);
|
|
56
57
|
publisher = this.getPublisher(assortmentPublishChange);
|
|
57
58
|
const changeDetail = await this.downloadHydratedChangeDetail(assortmentPublishChange);
|
|
58
59
|
const assortmentBaseline = await this.downloadAssortmentBaseline(assortmentPublishChange);
|
|
59
60
|
const deleteChanges = await this.getDeleteChanges(assortmentPublishChange, apcHistory, assortmentBaseline, sinceDate);
|
|
60
61
|
const releasedForDevelopmentItemIds = this.getReleasedForDevelopmentItemAndFamilyIds(assortmentBaseline, deleteChanges);
|
|
61
|
-
const itemToFederatedIdMapping = await this.getItemFederatedIds();
|
|
62
|
+
const itemToFederatedIdMapping = await this.getItemFederatedIds( /*allItemIds*/);
|
|
62
63
|
const pcd = new publish_change_data_1.PublishChangeData(assortmentId, seasonFed, assortmentPublishChangeId, sinceDate, publisher);
|
|
63
64
|
pcd.itemToFederatedIdMapping = itemToFederatedIdMapping;
|
|
64
65
|
pcd.releasedForDevelopmentItemIds = releasedForDevelopmentItemIds;
|
|
@@ -94,6 +95,15 @@ class BaseProcessPublishAssortment {
|
|
|
94
95
|
};
|
|
95
96
|
return publishInfo;
|
|
96
97
|
}
|
|
98
|
+
/** Gets the version number of the snapshot that was created for the publish change.
|
|
99
|
+
* But if no snapshot was found for the publish change, and the last snapshot was
|
|
100
|
+
* created before the publish change, then it returns 'after: versionNumber' where
|
|
101
|
+
* versionNumber is the version number of the last snapshot.
|
|
102
|
+
* If no snapshot was found for the publish change, and the last snapshot was
|
|
103
|
+
* created after the publish change, then it returns 'unknown'.
|
|
104
|
+
*
|
|
105
|
+
* @returns versionNumber or 'unknown' or 'after: versionNumber'
|
|
106
|
+
*/
|
|
97
107
|
async getSnapshotVersion(assortment, apc) {
|
|
98
108
|
const entityReference = assortment?.createdForReference;
|
|
99
109
|
const createdOnString = apc?.createdOn;
|
|
@@ -101,7 +111,7 @@ class BaseProcessPublishAssortment {
|
|
|
101
111
|
return 'unknown';
|
|
102
112
|
}
|
|
103
113
|
const createdOnDate = new Date(createdOnString);
|
|
104
|
-
createdOnDate.setMonth(createdOnDate.getMonth() - 1);
|
|
114
|
+
createdOnDate.setMonth(createdOnDate.getMonth() - 1); //subtract 1 month
|
|
105
115
|
const createdOnStringMinus1 = createdOnDate.toISOString();
|
|
106
116
|
const createdOn = 'ISGREATERTHAN ' + createdOnStringMinus1;
|
|
107
117
|
const snapshots = await new sdk_1.Entities().get({
|
|
@@ -348,6 +358,7 @@ class BaseProcessPublishAssortment {
|
|
|
348
358
|
console.info('sinceDateMilliseconds: ' + sinceDateMilliseconds);
|
|
349
359
|
console.info('apcDateMilliseconds: ' + previousApcDate);
|
|
350
360
|
}
|
|
361
|
+
//if only 1 apc, no processing needed
|
|
351
362
|
if (sinceDateMilliseconds !== previousApcDate) {
|
|
352
363
|
console.info('sinceDateMilliseconds !== apcDateMilliseconds');
|
|
353
364
|
const currentAssortmentItemIds = this.getBaselineItemIds(assortmentBaseline);
|
|
@@ -433,12 +444,27 @@ class BaseProcessPublishAssortment {
|
|
|
433
444
|
previousBaseline = await this.downloadAssortmentBaseline(previousApc);
|
|
434
445
|
}
|
|
435
446
|
const deleteIds = apc?.detail?.deletes.map(dItem => dItem?.id);
|
|
447
|
+
//building deletes based on previous baseline; because some APCs don't have delete data
|
|
436
448
|
const deleteArray = previousBaseline?.assortmentItems.filter(aItem => deleteIds.includes(aItem?.itemId));
|
|
437
449
|
console.info('deleteArray.length: ' + deleteArray.length);
|
|
438
450
|
return deleteArray;
|
|
439
451
|
}
|
|
440
|
-
async getItemFederatedIds() {
|
|
452
|
+
async getItemFederatedIds( /*itemIds*/) {
|
|
441
453
|
const itemFederatedIds = new Map();
|
|
454
|
+
// const expandedItemIds = itemIds.map(id => 'item:' + id);
|
|
455
|
+
// const fedRecords = await new Federation(this.logger).getFederationRecordsFromIdsBulk(expandedItemIds);
|
|
456
|
+
// for (let i = 0; i < fedRecords.length; i++) {
|
|
457
|
+
// const federationRecord = fedRecords[i];
|
|
458
|
+
// // console.log('federationRecord: ' + JSON.stringify(federationRecord));
|
|
459
|
+
// // console.log('federationRecord.reference: ' + federationRecord.reference);
|
|
460
|
+
// // console.log('federationRecord.mappedReference: ' + federationRecord.mappedReference);
|
|
461
|
+
// let vibeId = federationRecord.reference;
|
|
462
|
+
// if (vibeId && vibeId.startsWith('item:')) {
|
|
463
|
+
// vibeId = vibeId.substring(5);
|
|
464
|
+
// }
|
|
465
|
+
// itemFederatedIds.set(vibeId, federationRecord.mappedReference);
|
|
466
|
+
// }
|
|
467
|
+
// console.log('itemFederatedIds: ' + JSON.stringify(Object.fromEntries(itemFederatedIds)));
|
|
442
468
|
return itemFederatedIds;
|
|
443
469
|
}
|
|
444
470
|
getFullChangeAssortmentMap(fullChange) {
|
|
@@ -565,7 +591,7 @@ class BaseProcessPublishAssortment {
|
|
|
565
591
|
case 'vibeiqfile-dontsendtoflexplm':
|
|
566
592
|
return this.handleVibeIQFile(events, eventType, sendMode);
|
|
567
593
|
default:
|
|
568
|
-
return {};
|
|
594
|
+
return {}; // Or handle other cases as required
|
|
569
595
|
}
|
|
570
596
|
}
|
|
571
597
|
async sendToFlexPLM(events, eventType) {
|
|
@@ -576,16 +602,30 @@ class BaseProcessPublishAssortment {
|
|
|
576
602
|
events
|
|
577
603
|
};
|
|
578
604
|
const flexPLMConnect = new flexplm_connect_1.FlexPLMConnect(this.config);
|
|
579
|
-
const [sendResult] = await Promise.allSettled([
|
|
605
|
+
const [sendResult, eventResult] = await Promise.allSettled([
|
|
580
606
|
flexPLMConnect.sendToFlexPLM(outboundPublishEvent),
|
|
581
607
|
this.sendPublishPayloadEvent(outboundPublishEvent)
|
|
582
608
|
]);
|
|
583
|
-
|
|
609
|
+
if (sendResult.status === 'rejected' || eventResult.status === 'rejected') {
|
|
610
|
+
throw this.buildPublishError(sendResult, eventResult, outboundPublishEvent);
|
|
611
|
+
}
|
|
612
|
+
const result = sendResult.value;
|
|
584
613
|
const isResultObject = typeof result === 'object' && result !== null;
|
|
585
|
-
|
|
614
|
+
return isResultObject
|
|
586
615
|
? { ...result, outboundPublishEvent }
|
|
587
616
|
: { result, outboundPublishEvent };
|
|
588
|
-
|
|
617
|
+
}
|
|
618
|
+
buildPublishError(sendResult, eventResult, outboundPublishEvent) {
|
|
619
|
+
const baseReason = sendResult.status === 'rejected' ? sendResult.reason : eventResult.reason;
|
|
620
|
+
const error = baseReason instanceof Error ? baseReason : new Error(String(baseReason));
|
|
621
|
+
error.outboundPublishEvent = outboundPublishEvent;
|
|
622
|
+
error.sendToFlexPLMResult = sendResult.status === 'fulfilled'
|
|
623
|
+
? sendResult.value
|
|
624
|
+
: { error: sendResult.reason?.message ?? String(sendResult.reason) };
|
|
625
|
+
error.sendPublishPayloadEventResult = eventResult.status === 'fulfilled'
|
|
626
|
+
? eventResult.value
|
|
627
|
+
: { error: eventResult.reason?.message ?? String(eventResult.reason) };
|
|
628
|
+
return error;
|
|
589
629
|
}
|
|
590
630
|
async saveToLocalFile(events, eventType) {
|
|
591
631
|
let results = {};
|
|
@@ -632,12 +672,18 @@ class BaseProcessPublishAssortment {
|
|
|
632
672
|
};
|
|
633
673
|
if (sendMode === 'vibeiqfile') {
|
|
634
674
|
const flexPLMConnect = new flexplm_connect_1.FlexPLMConnect(this.config);
|
|
635
|
-
const [sendResult] = await Promise.allSettled([
|
|
675
|
+
const [sendResult, eventResult] = await Promise.allSettled([
|
|
636
676
|
flexPLMConnect.sendToFlexPLM(outboundPublishEvent),
|
|
637
677
|
this.sendPublishPayloadEvent(outboundPublishEvent)
|
|
638
678
|
]);
|
|
639
|
-
|
|
640
|
-
|
|
679
|
+
if (sendResult.status === 'rejected' || eventResult.status === 'rejected') {
|
|
680
|
+
throw this.buildPublishError(sendResult, eventResult, outboundPublishEvent);
|
|
681
|
+
}
|
|
682
|
+
const result = sendResult.value;
|
|
683
|
+
const isResultObject = typeof result === 'object' && result !== null;
|
|
684
|
+
return isResultObject
|
|
685
|
+
? { ...result, outboundPublishEvent }
|
|
686
|
+
: { result, outboundPublishEvent };
|
|
641
687
|
}
|
|
642
688
|
else {
|
|
643
689
|
await this.sendPublishPayloadEvent(outboundPublishEvent);
|
|
@@ -770,7 +816,7 @@ class BaseProcessPublishAssortment {
|
|
|
770
816
|
else {
|
|
771
817
|
ifc.colorDeletes.push(itemId);
|
|
772
818
|
}
|
|
773
|
-
}
|
|
819
|
+
} //End deletes for loop
|
|
774
820
|
if (app_framework_1.Logger.isDebugOn()) {
|
|
775
821
|
console.debug('returning size: ' + itemFamilyChanges.size);
|
|
776
822
|
for (const [key, value] of itemFamilyChanges) {
|
|
@@ -790,6 +836,22 @@ class BaseProcessPublishAssortment {
|
|
|
790
836
|
}
|
|
791
837
|
return seasonalPayloads;
|
|
792
838
|
}
|
|
839
|
+
/**Returns the events for a given ItemFamilyChanges object
|
|
840
|
+
*
|
|
841
|
+
* Cases:
|
|
842
|
+
* Add just family:
|
|
843
|
+
* Add option to family (with existing option):
|
|
844
|
+
* Add option to family (no options on assortment):
|
|
845
|
+
* Remove family and option:
|
|
846
|
+
* Remove only option and leave family:
|
|
847
|
+
* Remove one option of multiple for family:
|
|
848
|
+
*
|
|
849
|
+
* @param itemFamilyChanges
|
|
850
|
+
* @param assortmentId
|
|
851
|
+
* @param assortmentFederationId
|
|
852
|
+
* @param itemToFederatedIdMapping
|
|
853
|
+
* @returns
|
|
854
|
+
*/
|
|
793
855
|
async getEventsForItemFamilyChanges(itemFamilyChanges, assortmentId, seasonFed, itemToFederatedIdMapping) {
|
|
794
856
|
console.info('getEventsForItemFamilyChanges()');
|
|
795
857
|
const events = [];
|
|
@@ -799,7 +861,10 @@ class BaseProcessPublishAssortment {
|
|
|
799
861
|
const familyAssortmentItem = itemFamilyChanges.familyAdd || itemFamilyChanges.familyUpdate || itemFamilyChanges.familyDelete
|
|
800
862
|
|| itemFamilyChanges.colorAdds.length > 0 || itemFamilyChanges.colorUpdates.length > 0 || itemFamilyChanges.colorDeletes.length > 0
|
|
801
863
|
|| (projectItem && this.updatedSinceDate(projectItem, itemFamilyChanges.sinceDate));
|
|
864
|
+
//familyItemRemoved is used when adding the first option to an assortment
|
|
865
|
+
//and will have updates for the family item.
|
|
802
866
|
if (familyAssortmentItem) {
|
|
867
|
+
//Product-season add
|
|
803
868
|
const entityReference = itemFamilyChanges.itemFamilyId;
|
|
804
869
|
const prodEntityData = (itemFamilyChanges.assortmentItemFullChangeMap.has(entityReference))
|
|
805
870
|
? itemFamilyChanges.assortmentItemFullChangeMap.get(entityReference)?.item
|
|
@@ -825,6 +890,9 @@ class BaseProcessPublishAssortment {
|
|
|
825
890
|
}
|
|
826
891
|
events.push(psUpsert);
|
|
827
892
|
}
|
|
893
|
+
//colorway-season adds
|
|
894
|
+
//colorAdds
|
|
895
|
+
//colorUpdates
|
|
828
896
|
const colorwayChanges = [];
|
|
829
897
|
colorwayChanges.push(...itemFamilyChanges.colorAdds);
|
|
830
898
|
colorwayChanges.push(...itemFamilyChanges.colorUpdates);
|
|
@@ -865,6 +933,9 @@ class BaseProcessPublishAssortment {
|
|
|
865
933
|
const aItem = itemFamilyChanges?.assortmentItemFullChangeMap.get(id);
|
|
866
934
|
projectItem = aItem?.projectItem;
|
|
867
935
|
}
|
|
936
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
937
|
+
//Get from option assortmentItem because family not in assortmentItemFullChangeMap:start
|
|
938
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
868
939
|
if (id === itemFamilyChanges.itemFamilyId && Object.keys(projectItem).length == 0) {
|
|
869
940
|
for (const asstItem of itemFamilyChanges.assortmentItemFullChangeMap.values()) {
|
|
870
941
|
if (asstItem?.familyProjectItem) {
|
|
@@ -873,6 +944,9 @@ class BaseProcessPublishAssortment {
|
|
|
873
944
|
}
|
|
874
945
|
}
|
|
875
946
|
}
|
|
947
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
948
|
+
//Get from option assortmentItem because family not in assortmentItemFullChangeMap:end
|
|
949
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
876
950
|
return projectItem;
|
|
877
951
|
}
|
|
878
952
|
async getSeasonalData(projectItem) {
|
|
@@ -14,6 +14,7 @@ let federatedId = '';
|
|
|
14
14
|
jest.mock('../util/data-converter', () => {
|
|
15
15
|
return {
|
|
16
16
|
DataConverter: class {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
|
|
17
18
|
getFlexPLMObjectData(newData, dataToSkip, inflateObjRef) {
|
|
18
19
|
return newData;
|
|
19
20
|
}
|
|
@@ -115,6 +116,7 @@ describe('getPublishInfo', () => {
|
|
|
115
116
|
return { id: assortmentId, name: assortmentName };
|
|
116
117
|
});
|
|
117
118
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
119
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
118
120
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
119
121
|
return versionHistoryNumber;
|
|
120
122
|
});
|
|
@@ -140,6 +142,7 @@ describe('getPublishInfo', () => {
|
|
|
140
142
|
return { id: assortmentId, name: undefined };
|
|
141
143
|
});
|
|
142
144
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
145
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
143
146
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
144
147
|
return versionHistoryNumber;
|
|
145
148
|
});
|
|
@@ -165,6 +168,7 @@ describe('getPublishInfo', () => {
|
|
|
165
168
|
return undefined;
|
|
166
169
|
});
|
|
167
170
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
171
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
168
172
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
169
173
|
return versionHistoryNumber;
|
|
170
174
|
});
|
|
@@ -199,6 +203,7 @@ describe('getPublishInfo', () => {
|
|
|
199
203
|
return { id: assortmentId, name: assortmentName };
|
|
200
204
|
});
|
|
201
205
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
206
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
202
207
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
203
208
|
return versionHistoryNumber;
|
|
204
209
|
});
|
|
@@ -223,6 +228,7 @@ describe('getPublishInfo', () => {
|
|
|
223
228
|
return { id: assortmentId, name: assortmentName };
|
|
224
229
|
});
|
|
225
230
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
231
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
226
232
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
227
233
|
return versionHistoryNumber;
|
|
228
234
|
});
|
|
@@ -249,6 +255,7 @@ describe('getPublishInfo', () => {
|
|
|
249
255
|
return { id: assortmentId, name: assortmentName };
|
|
250
256
|
});
|
|
251
257
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
258
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
252
259
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
253
260
|
return versionHistoryNumber;
|
|
254
261
|
});
|
|
@@ -275,6 +282,7 @@ describe('getPublishInfo', () => {
|
|
|
275
282
|
return { id: assortmentId, name: assortmentName };
|
|
276
283
|
});
|
|
277
284
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
285
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
278
286
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
279
287
|
return versionHistoryNumber;
|
|
280
288
|
});
|
|
@@ -428,6 +436,7 @@ describe('getSnapshotVersion', () => {
|
|
|
428
436
|
{
|
|
429
437
|
id: 'qewrwer',
|
|
430
438
|
assortmentChangeId: 'bad-id',
|
|
439
|
+
// createdOn: '2023-01-14T19:13:58.902Z',
|
|
431
440
|
versionNumber
|
|
432
441
|
}
|
|
433
442
|
];
|
|
@@ -1160,6 +1169,7 @@ describe('getItemFamilyChanges', () => {
|
|
|
1160
1169
|
const ifcs = pcd.itemFamilyChanges;
|
|
1161
1170
|
expect(ifcs.size).toEqual(1);
|
|
1162
1171
|
const ifc = ifcs.get(itemFamilyId);
|
|
1172
|
+
// expect(ifc.familyAdd).toBe(true);
|
|
1163
1173
|
expect(ifc.colorAdds.length).toEqual(1);
|
|
1164
1174
|
});
|
|
1165
1175
|
it('Feb 3 - 2+ Option A', () => {
|
|
@@ -1189,6 +1199,7 @@ describe('getItemFamilyChanges', () => {
|
|
|
1189
1199
|
const ifcs = pcd.itemFamilyChanges;
|
|
1190
1200
|
expect(ifcs.size).toEqual(1);
|
|
1191
1201
|
const ifc = ifcs.get(itemFamilyId);
|
|
1202
|
+
// expect(ifc.familyAdd).toBe(true);
|
|
1192
1203
|
expect(ifc.colorAdds.length).toEqual(2);
|
|
1193
1204
|
});
|
|
1194
1205
|
it('Feb 3 - 2+ Option A & Feb 3 - 1 Option A', () => {
|
|
@@ -1320,6 +1331,8 @@ describe('getItemFamilyChanges', () => {
|
|
|
1320
1331
|
const ifcs = pcd.itemFamilyChanges;
|
|
1321
1332
|
expect(ifcs.size).toEqual(1);
|
|
1322
1333
|
const ifc = ifcs.get(itemFamilyId);
|
|
1334
|
+
//TODO fix
|
|
1335
|
+
// expect(ifc.familyDelete).toBe(true);
|
|
1323
1336
|
expect(ifc.colorAdds.length).toEqual(0);
|
|
1324
1337
|
expect(ifc.colorDeletes.length).toEqual(1);
|
|
1325
1338
|
});
|
|
@@ -1592,9 +1605,10 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1592
1605
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
|
|
1593
1606
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
|
|
1594
1607
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
|
|
1595
|
-
.mockResolvedValueOnce(true)
|
|
1596
|
-
.mockResolvedValueOnce(true);
|
|
1608
|
+
.mockResolvedValueOnce(true) // for family
|
|
1609
|
+
.mockResolvedValueOnce(true); // for SKU
|
|
1597
1610
|
const events = await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
|
|
1611
|
+
// Should have both family and SKU events because familyAssortmentItem is true when colorAdds.length > 0
|
|
1598
1612
|
expect(events).toHaveLength(2);
|
|
1599
1613
|
const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
|
|
1600
1614
|
expect(skuEvent.eventType).toBe('UPSERT_ON_SEASON');
|
|
@@ -1633,9 +1647,10 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1633
1647
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
|
|
1634
1648
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
|
|
1635
1649
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
|
|
1636
|
-
.mockResolvedValueOnce(false)
|
|
1637
|
-
.mockResolvedValueOnce(false);
|
|
1650
|
+
.mockResolvedValueOnce(false) // for family
|
|
1651
|
+
.mockResolvedValueOnce(false); // for SKU
|
|
1638
1652
|
const events = await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
|
|
1653
|
+
// Should have both family and SKU events because familyAssortmentItem is true when colorUpdates.length > 0
|
|
1639
1654
|
expect(events).toHaveLength(2);
|
|
1640
1655
|
const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
|
|
1641
1656
|
expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
|
|
@@ -1674,6 +1689,7 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1674
1689
|
jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
|
|
1675
1690
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
|
|
1676
1691
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
|
|
1692
|
+
// Product is creatable (true), SKU is not (false)
|
|
1677
1693
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
|
|
1678
1694
|
.mockResolvedValueOnce(true)
|
|
1679
1695
|
.mockResolvedValueOnce(false);
|
|
@@ -1684,7 +1700,9 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1684
1700
|
expect(productEvent.eventType).toBe('UPSERT_ON_SEASON');
|
|
1685
1701
|
expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
|
|
1686
1702
|
expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenCalledTimes(2);
|
|
1703
|
+
// Verify product event called with assortment entity
|
|
1687
1704
|
expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(1, undefined, mapFileUtil, familyProjectItem, { item: prodEntityData, assortment });
|
|
1705
|
+
// Verify SKU event called with assortment entity
|
|
1688
1706
|
expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(2, undefined, mapFileUtil, colorProjectItem, { item: itemData, assortment });
|
|
1689
1707
|
});
|
|
1690
1708
|
});
|
|
@@ -1709,7 +1727,7 @@ describe('sendToFlexPLM / handleVibeIQFile / sendPublishPayloadEvent', () => {
|
|
|
1709
1727
|
afterEach(() => {
|
|
1710
1728
|
jest.restoreAllMocks();
|
|
1711
1729
|
});
|
|
1712
|
-
it('
|
|
1730
|
+
it('should merge outboundPublishEvent into result and call sendPublishPayloadEvent in parallel', async () => {
|
|
1713
1731
|
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1714
1732
|
const flexResponse = { status: 200, data: { ok: true } };
|
|
1715
1733
|
let flexResolved = false;
|
|
@@ -1738,7 +1756,80 @@ describe('sendToFlexPLM / handleVibeIQFile / sendPublishPayloadEvent', () => {
|
|
|
1738
1756
|
expect(spyEvent).toHaveBeenCalledWith(passedOutboundPublishEvent);
|
|
1739
1757
|
expect(result).toEqual({ ...flexResponse, outboundPublishEvent: passedOutboundPublishEvent });
|
|
1740
1758
|
});
|
|
1741
|
-
it('
|
|
1759
|
+
it('sendToFlexPLM throws when flexPLMConnect.sendToFlexPLM fails, attaching outboundPublishEvent and both results', async () => {
|
|
1760
|
+
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1761
|
+
const flexError = new Error('flex failed');
|
|
1762
|
+
const eventResponse = { eventOk: true };
|
|
1763
|
+
jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM').mockRejectedValue(flexError);
|
|
1764
|
+
jest.spyOn(bppa, 'sendPublishPayloadEvent').mockResolvedValue(eventResponse);
|
|
1765
|
+
await expect(bppa.sendToFlexPLM(events, eventType)).rejects.toMatchObject({
|
|
1766
|
+
message: 'flex failed',
|
|
1767
|
+
outboundPublishEvent: expect.objectContaining({ taskId: 'task-abc', eventType, objectClass: 'LCSSeason', events }),
|
|
1768
|
+
sendToFlexPLMResult: { error: 'flex failed' },
|
|
1769
|
+
sendPublishPayloadEventResult: eventResponse
|
|
1770
|
+
});
|
|
1771
|
+
});
|
|
1772
|
+
it('sendToFlexPLM throws when sendPublishPayloadEvent fails, with flex result attached', async () => {
|
|
1773
|
+
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1774
|
+
const flexResponse = { status: 200 };
|
|
1775
|
+
const eventError = new Error('event failed');
|
|
1776
|
+
jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM').mockResolvedValue(flexResponse);
|
|
1777
|
+
jest.spyOn(bppa, 'sendPublishPayloadEvent').mockRejectedValue(eventError);
|
|
1778
|
+
await expect(bppa.sendToFlexPLM(events, eventType)).rejects.toMatchObject({
|
|
1779
|
+
message: 'event failed',
|
|
1780
|
+
outboundPublishEvent: expect.objectContaining({ taskId: 'task-abc', eventType }),
|
|
1781
|
+
sendToFlexPLMResult: flexResponse,
|
|
1782
|
+
sendPublishPayloadEventResult: { error: 'event failed' }
|
|
1783
|
+
});
|
|
1784
|
+
});
|
|
1785
|
+
it('sendToFlexPLM throws the flexPLMConnect error when both fail', async () => {
|
|
1786
|
+
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1787
|
+
const flexError = new Error('flex failed');
|
|
1788
|
+
const eventError = new Error('event failed');
|
|
1789
|
+
jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM').mockRejectedValue(flexError);
|
|
1790
|
+
jest.spyOn(bppa, 'sendPublishPayloadEvent').mockRejectedValue(eventError);
|
|
1791
|
+
await expect(bppa.sendToFlexPLM(events, eventType)).rejects.toBe(flexError);
|
|
1792
|
+
expect(flexError.outboundPublishEvent).toBeDefined();
|
|
1793
|
+
expect(flexError.sendToFlexPLMResult).toEqual({ error: 'flex failed' });
|
|
1794
|
+
expect(flexError.sendPublishPayloadEventResult).toEqual({ error: 'event failed' });
|
|
1795
|
+
});
|
|
1796
|
+
it('handleVibeIQFile (vibeiqfile) throws when flexPLMConnect.sendToFlexPLM fails, with both results attached', async () => {
|
|
1797
|
+
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1798
|
+
const flexError = new Error('flex failed');
|
|
1799
|
+
const eventResponse = { eventOk: true };
|
|
1800
|
+
jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM').mockRejectedValue(flexError);
|
|
1801
|
+
jest.spyOn(bppa, 'sendPublishPayloadEvent').mockResolvedValue(eventResponse);
|
|
1802
|
+
await expect(bppa.handleVibeIQFile(events, eventType, 'vibeiqfile')).rejects.toMatchObject({
|
|
1803
|
+
message: 'flex failed',
|
|
1804
|
+
outboundPublishEvent: expect.objectContaining({ eventsFileId: 'file-123' }),
|
|
1805
|
+
sendToFlexPLMResult: { error: 'flex failed' },
|
|
1806
|
+
sendPublishPayloadEventResult: eventResponse
|
|
1807
|
+
});
|
|
1808
|
+
});
|
|
1809
|
+
it('handleVibeIQFile (vibeiqfile) throws when sendPublishPayloadEvent fails, with flex result attached', async () => {
|
|
1810
|
+
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1811
|
+
const flexResponse = { status: 200 };
|
|
1812
|
+
const eventError = new Error('event failed');
|
|
1813
|
+
jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM').mockResolvedValue(flexResponse);
|
|
1814
|
+
jest.spyOn(bppa, 'sendPublishPayloadEvent').mockRejectedValue(eventError);
|
|
1815
|
+
await expect(bppa.handleVibeIQFile(events, eventType, 'vibeiqfile')).rejects.toMatchObject({
|
|
1816
|
+
message: 'event failed',
|
|
1817
|
+
outboundPublishEvent: expect.objectContaining({ eventsFileId: 'file-123' }),
|
|
1818
|
+
sendToFlexPLMResult: flexResponse,
|
|
1819
|
+
sendPublishPayloadEventResult: { error: 'event failed' }
|
|
1820
|
+
});
|
|
1821
|
+
});
|
|
1822
|
+
it('handleVibeIQFile (vibeiqfile) throws the flexPLMConnect error when both fail', async () => {
|
|
1823
|
+
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1824
|
+
const flexError = new Error('flex failed');
|
|
1825
|
+
const eventError = new Error('event failed');
|
|
1826
|
+
jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM').mockRejectedValue(flexError);
|
|
1827
|
+
jest.spyOn(bppa, 'sendPublishPayloadEvent').mockRejectedValue(eventError);
|
|
1828
|
+
await expect(bppa.handleVibeIQFile(events, eventType, 'vibeiqfile')).rejects.toBe(flexError);
|
|
1829
|
+
expect(flexError.sendToFlexPLMResult).toEqual({ error: 'flex failed' });
|
|
1830
|
+
expect(flexError.sendPublishPayloadEventResult).toEqual({ error: 'event failed' });
|
|
1831
|
+
});
|
|
1832
|
+
it('should merge outboundPublishEvent into FlexPLM result and call sendPublishPayloadEvent when mode is vibeiqfile', async () => {
|
|
1742
1833
|
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1743
1834
|
const flexResponse = { status: 200, data: { ok: true } };
|
|
1744
1835
|
const spyFlex = jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM')
|
|
@@ -1761,7 +1852,7 @@ describe('sendToFlexPLM / handleVibeIQFile / sendPublishPayloadEvent', () => {
|
|
|
1761
1852
|
expect(spyEvent).toHaveBeenCalledWith(passedOutboundPublishEvent);
|
|
1762
1853
|
expect(result).toEqual({ ...flexResponse, outboundPublishEvent: passedOutboundPublishEvent });
|
|
1763
1854
|
});
|
|
1764
|
-
it('
|
|
1855
|
+
it('should skip FlexPLM but still call sendPublishPayloadEvent when mode is vibeiqfile-dontsendtoflexplm', async () => {
|
|
1765
1856
|
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1766
1857
|
const spyFlex = jest.spyOn(flexplm_connect_1.FlexPLMConnect.prototype, 'sendToFlexPLM')
|
|
1767
1858
|
.mockResolvedValue({});
|
|
@@ -1777,7 +1868,7 @@ describe('sendToFlexPLM / handleVibeIQFile / sendPublishPayloadEvent', () => {
|
|
|
1777
1868
|
outboundPublishEvent: passedOutboundPublishEvent
|
|
1778
1869
|
});
|
|
1779
1870
|
});
|
|
1780
|
-
it('
|
|
1871
|
+
it('should create an external-event with initialEvent parsed from config', async () => {
|
|
1781
1872
|
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
1782
1873
|
const outboundPublishEvent = { foo: 'bar' };
|
|
1783
1874
|
await bppa.sendPublishPayloadEvent(outboundPublishEvent);
|
|
@@ -1791,7 +1882,7 @@ describe('sendToFlexPLM / handleVibeIQFile / sendPublishPayloadEvent', () => {
|
|
|
1791
1882
|
}
|
|
1792
1883
|
});
|
|
1793
1884
|
});
|
|
1794
|
-
it('
|
|
1885
|
+
it('should default initialEvent to {} when config has no event', async () => {
|
|
1795
1886
|
const bareConfig = { taskId: 'task-x' };
|
|
1796
1887
|
const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(bareConfig, dc, mapFileUtil);
|
|
1797
1888
|
const outboundPublishEvent = { hello: 'world' };
|
package/lib/publish/mockData.js
CHANGED
|
@@ -3399,6 +3399,11 @@ exports.fall_2003_fedMapping = [
|
|
|
3399
3399
|
mappedReference: 'VR:com.lcs.wc.product.LCSSKU:372509'
|
|
3400
3400
|
}
|
|
3401
3401
|
];
|
|
3402
|
+
//SYHfQzYWlfXDqK7r - 4 adds
|
|
3403
|
+
//JreGRNvoJ3FsoRZI - 1 delete
|
|
3404
|
+
//NaPUhAdEzKB-5tQ3 - no changes
|
|
3405
|
+
//CHGKSCT358qyh1Nu - 1 delete
|
|
3406
|
+
//H4L4dHziO6WZRIwa - re-add from JreGRNvoJ3FsoRZI
|
|
3402
3407
|
exports.apc_2bOWR2j9R0QThDVu_delete_history = [
|
|
3403
3408
|
{
|
|
3404
3409
|
adds: 4,
|
|
@@ -31,6 +31,20 @@ exports.mapping = {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
// flex2vibe: {
|
|
35
|
+
// LCSRevisableEntity: {
|
|
36
|
+
// getMapKey: (object) =>{ return object;}
|
|
37
|
+
// },
|
|
38
|
+
// LCSLast: {
|
|
39
|
+
// getMapKey: (object) => {return object;}
|
|
40
|
+
// },
|
|
41
|
+
// LCSMaterial: {
|
|
42
|
+
// getMapKey: (object) =>{ return object;}
|
|
43
|
+
// },
|
|
44
|
+
// LCSBusinessObject: {
|
|
45
|
+
// getMapKey: (object) => {return object;}
|
|
46
|
+
// }
|
|
47
|
+
// },
|
|
34
48
|
},
|
|
35
49
|
LCSSeason: {
|
|
36
50
|
vibe2flex: {
|
|
@@ -54,7 +68,7 @@ exports.mapping = {
|
|
|
54
68
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
55
69
|
vibe2flex: {
|
|
56
70
|
getClass: () => 'LCSProduct',
|
|
57
|
-
getSoftType: (entity) => {
|
|
71
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
58
72
|
const prodType = entity['prodType'];
|
|
59
73
|
let val = '';
|
|
60
74
|
switch (prodType) {
|
|
@@ -79,7 +93,7 @@ exports.mapping = {
|
|
|
79
93
|
vibeIQIdentifier: 'itemNumber'
|
|
80
94
|
},
|
|
81
95
|
valueTransform: {
|
|
82
|
-
transformEx: (row) => {
|
|
96
|
+
transformEx: (row /*, dependencies*/) => {
|
|
83
97
|
return row['otherProp'] + 'xxx';
|
|
84
98
|
}
|
|
85
99
|
}
|
|
@@ -97,7 +111,7 @@ exports.mapping = {
|
|
|
97
111
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
98
112
|
vibe2flex: {
|
|
99
113
|
getClass: () => 'LCSSKU',
|
|
100
|
-
getSoftType: (entity) => {
|
|
114
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
101
115
|
const prodType = entity['prodType'];
|
|
102
116
|
let val = '';
|
|
103
117
|
switch (prodType) {
|
|
@@ -252,6 +266,20 @@ exports.mapping2 = {
|
|
|
252
266
|
}
|
|
253
267
|
}
|
|
254
268
|
}
|
|
269
|
+
// flex2vibe: {
|
|
270
|
+
// LCSRevisableEntity: {
|
|
271
|
+
// getMapKey: (object) =>{ return object;}
|
|
272
|
+
// },
|
|
273
|
+
// LCSLast: {
|
|
274
|
+
// getMapKey: (object) => {return object;}
|
|
275
|
+
// },
|
|
276
|
+
// LCSMaterial: {
|
|
277
|
+
// getMapKey: (object) =>{ return object;}
|
|
278
|
+
// },
|
|
279
|
+
// LCSBusinessObject: {
|
|
280
|
+
// getMapKey: (object) => {return object;}
|
|
281
|
+
// }
|
|
282
|
+
// },
|
|
255
283
|
},
|
|
256
284
|
LCSSeason: {
|
|
257
285
|
getIdentifierProperties: () => ['brand', 'year', 'seasonType'],
|
|
@@ -274,7 +302,7 @@ exports.mapping2 = {
|
|
|
274
302
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
275
303
|
vibe2flex: {
|
|
276
304
|
getClass: () => 'LCSProduct',
|
|
277
|
-
getSoftType: (entity) => {
|
|
305
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
278
306
|
const prodType = entity['prodType'];
|
|
279
307
|
let val = '';
|
|
280
308
|
switch (prodType) {
|
|
@@ -299,7 +327,7 @@ exports.mapping2 = {
|
|
|
299
327
|
vibeIQIdentifier: 'itemNumber'
|
|
300
328
|
},
|
|
301
329
|
valueTransform: {
|
|
302
|
-
transformEx: (row) => {
|
|
330
|
+
transformEx: (row /*, dependencies*/) => {
|
|
303
331
|
return row['otherProp'] + 'xxx';
|
|
304
332
|
}
|
|
305
333
|
}
|
|
@@ -318,7 +346,7 @@ exports.mapping2 = {
|
|
|
318
346
|
getIdentifierProperties: () => ['uniqueIdentifierA', 'uniqueIdentifierB'],
|
|
319
347
|
vibe2flex: {
|
|
320
348
|
getClass: () => 'LCSSKU',
|
|
321
|
-
getSoftType: (entity) => {
|
|
349
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
322
350
|
const prodType = entity['prodType'];
|
|
323
351
|
let val = '';
|
|
324
352
|
switch (prodType) {
|