@contrail/flexplm 1.5.0-alpha.98b8b06 → 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.
Files changed (111) hide show
  1. package/.github/pull_request_template.md +31 -0
  2. package/.github/workflows/flexplm-lib.yml +27 -0
  3. package/.github/workflows/publish-to-npm.yml +121 -0
  4. package/CHANGELOG.md +45 -0
  5. package/lib/entity-processor/base-entity-processor.d.ts +0 -65
  6. package/lib/entity-processor/base-entity-processor.js +0 -71
  7. package/lib/entity-processor/base-entity-processor.spec.js +0 -1
  8. package/lib/index.d.ts +0 -1
  9. package/lib/index.js +0 -1
  10. package/lib/publish/base-process-publish-assortment.d.ts +0 -25
  11. package/lib/publish/base-process-publish-assortment.js +6 -60
  12. package/lib/publish/base-process-publish-assortment.spec.js +4 -22
  13. package/lib/publish/mockData.js +0 -5
  14. package/lib/transform/identifier-conversion-spec-mockData.js +6 -34
  15. package/lib/transform/identifier-conversion.d.ts +0 -36
  16. package/lib/transform/identifier-conversion.js +0 -36
  17. package/lib/transform/identifier-conversion.spec.js +0 -4
  18. package/lib/util/config-defaults.js +0 -3
  19. package/lib/util/config-defaults.spec.js +0 -9
  20. package/lib/util/data-converter-spec-mockData.js +3 -17
  21. package/lib/util/data-converter.d.ts +0 -97
  22. package/lib/util/data-converter.js +1 -127
  23. package/lib/util/data-converter.spec.js +0 -2
  24. package/lib/util/error-response-object.d.ts +0 -5
  25. package/lib/util/error-response-object.js +0 -7
  26. package/lib/util/event-short-message-status.js +0 -1
  27. package/lib/util/federation.js +0 -8
  28. package/lib/util/flexplm-connect.d.ts +0 -7
  29. package/lib/util/flexplm-connect.js +0 -14
  30. package/lib/util/logger-config.js +0 -1
  31. package/lib/util/map-util-spec-mockData.js +3 -17
  32. package/lib/util/map-utils.d.ts +0 -27
  33. package/lib/util/map-utils.js +0 -27
  34. package/lib/util/thumbnail-util.d.ts +0 -21
  35. package/lib/util/thumbnail-util.js +1 -28
  36. package/lib/util/thumbnail-util.spec.js +0 -6
  37. package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
  38. package/lib/util/type-conversion-utils.d.ts +1 -152
  39. package/lib/util/type-conversion-utils.js +1 -155
  40. package/lib/util/type-defaults.d.ts +0 -66
  41. package/lib/util/type-defaults.js +0 -66
  42. package/lib/util/type-defaults.spec.js +5 -5
  43. package/lib/util/type-utils.d.ts +0 -21
  44. package/lib/util/type-utils.js +0 -23
  45. package/lib/util/type-utils.spec.js +0 -2
  46. package/package.json +6 -21
  47. package/publish.bat +5 -0
  48. package/publish.sh +5 -0
  49. package/src/entity-processor/base-entity-processor.spec.ts +689 -0
  50. package/src/entity-processor/base-entity-processor.ts +583 -0
  51. package/src/flexplm-request.ts +28 -0
  52. package/src/flexplm-utils.spec.ts +27 -0
  53. package/src/flexplm-utils.ts +29 -0
  54. package/src/index.ts +22 -0
  55. package/src/interfaces/interfaces.ts +122 -0
  56. package/src/interfaces/item-family-changes.ts +67 -0
  57. package/src/interfaces/publish-change-data.ts +43 -0
  58. package/src/publish/base-process-publish-assortment-callback.ts +50 -0
  59. package/src/publish/base-process-publish-assortment.spec.ts +1992 -0
  60. package/src/publish/base-process-publish-assortment.ts +1134 -0
  61. package/src/publish/mockData.ts +4561 -0
  62. package/src/transform/identifier-conversion-spec-mockData.ts +496 -0
  63. package/src/transform/identifier-conversion.spec.ts +386 -0
  64. package/src/transform/identifier-conversion.ts +282 -0
  65. package/src/util/config-defaults.spec.ts +445 -0
  66. package/src/util/config-defaults.ts +106 -0
  67. package/src/util/data-converter-spec-mockData.ts +231 -0
  68. package/src/util/data-converter.spec.ts +1622 -0
  69. package/src/util/data-converter.ts +819 -0
  70. package/src/util/error-response-object.spec.ts +116 -0
  71. package/src/util/error-response-object.ts +50 -0
  72. package/src/util/event-short-message-status.ts +22 -0
  73. package/src/util/federation.ts +172 -0
  74. package/src/util/flexplm-connect.spec.ts +132 -0
  75. package/src/util/flexplm-connect.ts +208 -0
  76. package/src/util/logger-config.ts +20 -0
  77. package/src/util/map-util-spec-mockData.ts +231 -0
  78. package/src/util/map-utils.spec.ts +103 -0
  79. package/src/util/map-utils.ts +41 -0
  80. package/src/util/mockData.ts +101 -0
  81. package/src/util/thumbnail-util.spec.ts +508 -0
  82. package/src/util/thumbnail-util.ts +272 -0
  83. package/src/util/type-conversion-utils-spec-mockData.ts +272 -0
  84. package/src/util/type-conversion-utils.spec.ts +1031 -0
  85. package/src/util/type-conversion-utils.ts +490 -0
  86. package/src/util/type-defaults.spec.ts +797 -0
  87. package/src/util/type-defaults.ts +320 -0
  88. package/src/util/type-utils.spec.ts +227 -0
  89. package/src/util/type-utils.ts +144 -0
  90. package/tsconfig.json +24 -0
  91. package/tslint.json +57 -0
  92. package/lib/cli/commands/compile.d.ts +0 -4
  93. package/lib/cli/commands/compile.js +0 -73
  94. package/lib/cli/commands/compile.spec.d.ts +0 -1
  95. package/lib/cli/commands/compile.spec.js +0 -80
  96. package/lib/cli/commands/create.d.ts +0 -5
  97. package/lib/cli/commands/create.js +0 -77
  98. package/lib/cli/commands/create.spec.d.ts +0 -1
  99. package/lib/cli/commands/create.spec.js +0 -78
  100. package/lib/cli/commands/upload.d.ts +0 -17
  101. package/lib/cli/commands/upload.js +0 -228
  102. package/lib/cli/commands/upload.spec.d.ts +0 -1
  103. package/lib/cli/commands/upload.spec.js +0 -88
  104. package/lib/cli/index.d.ts +0 -5
  105. package/lib/cli/index.js +0 -70
  106. package/lib/cli/index.spec.d.ts +0 -1
  107. package/lib/cli/index.spec.js +0 -85
  108. package/lib/cli/template/mapping-template.ts.template +0 -62
  109. package/lib/interfaces/mapping-file.d.ts +0 -460
  110. package/lib/interfaces/mapping-file.js +0 -2
  111. package/scripts/copy-template.js +0 -10
@@ -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; // 30 days
16
+ this.TTL = 30 * 24 * 60 * 60 * 1000;
17
17
  this.cache = {
18
18
  carriedFromSeason: {}
19
19
  };
@@ -52,14 +52,13 @@ 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
56
55
  const assortmentPublishChange = await this.downloadAssortmentPublishChange(assortmentId, assortmentPublishChangeId);
57
56
  publisher = this.getPublisher(assortmentPublishChange);
58
57
  const changeDetail = await this.downloadHydratedChangeDetail(assortmentPublishChange);
59
58
  const assortmentBaseline = await this.downloadAssortmentBaseline(assortmentPublishChange);
60
59
  const deleteChanges = await this.getDeleteChanges(assortmentPublishChange, apcHistory, assortmentBaseline, sinceDate);
61
60
  const releasedForDevelopmentItemIds = this.getReleasedForDevelopmentItemAndFamilyIds(assortmentBaseline, deleteChanges);
62
- const itemToFederatedIdMapping = await this.getItemFederatedIds( /*allItemIds*/);
61
+ const itemToFederatedIdMapping = await this.getItemFederatedIds();
63
62
  const pcd = new publish_change_data_1.PublishChangeData(assortmentId, seasonFed, assortmentPublishChangeId, sinceDate, publisher);
64
63
  pcd.itemToFederatedIdMapping = itemToFederatedIdMapping;
65
64
  pcd.releasedForDevelopmentItemIds = releasedForDevelopmentItemIds;
@@ -95,15 +94,6 @@ class BaseProcessPublishAssortment {
95
94
  };
96
95
  return publishInfo;
97
96
  }
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
- */
107
97
  async getSnapshotVersion(assortment, apc) {
108
98
  const entityReference = assortment?.createdForReference;
109
99
  const createdOnString = apc?.createdOn;
@@ -111,7 +101,7 @@ class BaseProcessPublishAssortment {
111
101
  return 'unknown';
112
102
  }
113
103
  const createdOnDate = new Date(createdOnString);
114
- createdOnDate.setMonth(createdOnDate.getMonth() - 1); //subtract 1 month
104
+ createdOnDate.setMonth(createdOnDate.getMonth() - 1);
115
105
  const createdOnStringMinus1 = createdOnDate.toISOString();
116
106
  const createdOn = 'ISGREATERTHAN ' + createdOnStringMinus1;
117
107
  const snapshots = await new sdk_1.Entities().get({
@@ -358,7 +348,6 @@ class BaseProcessPublishAssortment {
358
348
  console.info('sinceDateMilliseconds: ' + sinceDateMilliseconds);
359
349
  console.info('apcDateMilliseconds: ' + previousApcDate);
360
350
  }
361
- //if only 1 apc, no processing needed
362
351
  if (sinceDateMilliseconds !== previousApcDate) {
363
352
  console.info('sinceDateMilliseconds !== apcDateMilliseconds');
364
353
  const currentAssortmentItemIds = this.getBaselineItemIds(assortmentBaseline);
@@ -444,27 +433,12 @@ class BaseProcessPublishAssortment {
444
433
  previousBaseline = await this.downloadAssortmentBaseline(previousApc);
445
434
  }
446
435
  const deleteIds = apc?.detail?.deletes.map(dItem => dItem?.id);
447
- //building deletes based on previous baseline; because some APCs don't have delete data
448
436
  const deleteArray = previousBaseline?.assortmentItems.filter(aItem => deleteIds.includes(aItem?.itemId));
449
437
  console.info('deleteArray.length: ' + deleteArray.length);
450
438
  return deleteArray;
451
439
  }
452
- async getItemFederatedIds( /*itemIds*/) {
440
+ async getItemFederatedIds() {
453
441
  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)));
468
442
  return itemFederatedIds;
469
443
  }
470
444
  getFullChangeAssortmentMap(fullChange) {
@@ -591,7 +565,7 @@ class BaseProcessPublishAssortment {
591
565
  case 'vibeiqfile-dontsendtoflexplm':
592
566
  return this.handleVibeIQFile(events, eventType, sendMode);
593
567
  default:
594
- return {}; // Or handle other cases as required
568
+ return {};
595
569
  }
596
570
  }
597
571
  async sendToFlexPLM(events, eventType) {
@@ -761,7 +735,7 @@ class BaseProcessPublishAssortment {
761
735
  else {
762
736
  ifc.colorDeletes.push(itemId);
763
737
  }
764
- } //End deletes for loop
738
+ }
765
739
  if (app_framework_1.Logger.isDebugOn()) {
766
740
  console.debug('returning size: ' + itemFamilyChanges.size);
767
741
  for (const [key, value] of itemFamilyChanges) {
@@ -781,22 +755,6 @@ class BaseProcessPublishAssortment {
781
755
  }
782
756
  return seasonalPayloads;
783
757
  }
784
- /**Returns the events for a given ItemFamilyChanges object
785
- *
786
- * Cases:
787
- * Add just family:
788
- * Add option to family (with existing option):
789
- * Add option to family (no options on assortment):
790
- * Remove family and option:
791
- * Remove only option and leave family:
792
- * Remove one option of multiple for family:
793
- *
794
- * @param itemFamilyChanges
795
- * @param assortmentId
796
- * @param assortmentFederationId
797
- * @param itemToFederatedIdMapping
798
- * @returns
799
- */
800
758
  async getEventsForItemFamilyChanges(itemFamilyChanges, assortmentId, seasonFed, itemToFederatedIdMapping) {
801
759
  console.info('getEventsForItemFamilyChanges()');
802
760
  const events = [];
@@ -806,10 +764,7 @@ class BaseProcessPublishAssortment {
806
764
  const familyAssortmentItem = itemFamilyChanges.familyAdd || itemFamilyChanges.familyUpdate || itemFamilyChanges.familyDelete
807
765
  || itemFamilyChanges.colorAdds.length > 0 || itemFamilyChanges.colorUpdates.length > 0 || itemFamilyChanges.colorDeletes.length > 0
808
766
  || (projectItem && this.updatedSinceDate(projectItem, itemFamilyChanges.sinceDate));
809
- //familyItemRemoved is used when adding the first option to an assortment
810
- //and will have updates for the family item.
811
767
  if (familyAssortmentItem) {
812
- //Product-season add
813
768
  const entityReference = itemFamilyChanges.itemFamilyId;
814
769
  const prodEntityData = (itemFamilyChanges.assortmentItemFullChangeMap.has(entityReference))
815
770
  ? itemFamilyChanges.assortmentItemFullChangeMap.get(entityReference)?.item
@@ -835,9 +790,6 @@ class BaseProcessPublishAssortment {
835
790
  }
836
791
  events.push(psUpsert);
837
792
  }
838
- //colorway-season adds
839
- //colorAdds
840
- //colorUpdates
841
793
  const colorwayChanges = [];
842
794
  colorwayChanges.push(...itemFamilyChanges.colorAdds);
843
795
  colorwayChanges.push(...itemFamilyChanges.colorUpdates);
@@ -878,9 +830,6 @@ class BaseProcessPublishAssortment {
878
830
  const aItem = itemFamilyChanges?.assortmentItemFullChangeMap.get(id);
879
831
  projectItem = aItem?.projectItem;
880
832
  }
881
- /////////////////////////////////////////////////////////////////////////////
882
- //Get from option assortmentItem because family not in assortmentItemFullChangeMap:start
883
- /////////////////////////////////////////////////////////////////////////////
884
833
  if (id === itemFamilyChanges.itemFamilyId && Object.keys(projectItem).length == 0) {
885
834
  for (const asstItem of itemFamilyChanges.assortmentItemFullChangeMap.values()) {
886
835
  if (asstItem?.familyProjectItem) {
@@ -889,9 +838,6 @@ class BaseProcessPublishAssortment {
889
838
  }
890
839
  }
891
840
  }
892
- /////////////////////////////////////////////////////////////////////////////
893
- //Get from option assortmentItem because family not in assortmentItemFullChangeMap:end
894
- /////////////////////////////////////////////////////////////////////////////
895
841
  return projectItem;
896
842
  }
897
843
  async getSeasonalData(projectItem) {
@@ -13,7 +13,6 @@ let federatedId = '';
13
13
  jest.mock('../util/data-converter', () => {
14
14
  return {
15
15
  DataConverter: class {
16
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
17
16
  getFlexPLMObjectData(newData, dataToSkip, inflateObjRef) {
18
17
  return newData;
19
18
  }
@@ -96,7 +95,6 @@ describe('getPublishInfo', () => {
96
95
  return { id: assortmentId, name: assortmentName };
97
96
  });
98
97
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
99
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
100
98
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
101
99
  return versionHistoryNumber;
102
100
  });
@@ -122,7 +120,6 @@ describe('getPublishInfo', () => {
122
120
  return { id: assortmentId, name: undefined };
123
121
  });
124
122
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
125
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
126
123
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
127
124
  return versionHistoryNumber;
128
125
  });
@@ -148,7 +145,6 @@ describe('getPublishInfo', () => {
148
145
  return undefined;
149
146
  });
150
147
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
151
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
152
148
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
153
149
  return versionHistoryNumber;
154
150
  });
@@ -183,7 +179,6 @@ describe('getPublishInfo', () => {
183
179
  return { id: assortmentId, name: assortmentName };
184
180
  });
185
181
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
186
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
187
182
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
188
183
  return versionHistoryNumber;
189
184
  });
@@ -208,7 +203,6 @@ describe('getPublishInfo', () => {
208
203
  return { id: assortmentId, name: assortmentName };
209
204
  });
210
205
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
211
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
212
206
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
213
207
  return versionHistoryNumber;
214
208
  });
@@ -235,7 +229,6 @@ describe('getPublishInfo', () => {
235
229
  return { id: assortmentId, name: assortmentName };
236
230
  });
237
231
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
238
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
239
232
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
240
233
  return versionHistoryNumber;
241
234
  });
@@ -262,7 +255,6 @@ describe('getPublishInfo', () => {
262
255
  return { id: assortmentId, name: assortmentName };
263
256
  });
264
257
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
265
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
266
258
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
267
259
  return versionHistoryNumber;
268
260
  });
@@ -416,7 +408,6 @@ describe('getSnapshotVersion', () => {
416
408
  {
417
409
  id: 'qewrwer',
418
410
  assortmentChangeId: 'bad-id',
419
- // createdOn: '2023-01-14T19:13:58.902Z',
420
411
  versionNumber
421
412
  }
422
413
  ];
@@ -1149,7 +1140,6 @@ describe('getItemFamilyChanges', () => {
1149
1140
  const ifcs = pcd.itemFamilyChanges;
1150
1141
  expect(ifcs.size).toEqual(1);
1151
1142
  const ifc = ifcs.get(itemFamilyId);
1152
- // expect(ifc.familyAdd).toBe(true);
1153
1143
  expect(ifc.colorAdds.length).toEqual(1);
1154
1144
  });
1155
1145
  it('Feb 3 - 2+ Option A', () => {
@@ -1179,7 +1169,6 @@ describe('getItemFamilyChanges', () => {
1179
1169
  const ifcs = pcd.itemFamilyChanges;
1180
1170
  expect(ifcs.size).toEqual(1);
1181
1171
  const ifc = ifcs.get(itemFamilyId);
1182
- // expect(ifc.familyAdd).toBe(true);
1183
1172
  expect(ifc.colorAdds.length).toEqual(2);
1184
1173
  });
1185
1174
  it('Feb 3 - 2+ Option A & Feb 3 - 1 Option A', () => {
@@ -1311,8 +1300,6 @@ describe('getItemFamilyChanges', () => {
1311
1300
  const ifcs = pcd.itemFamilyChanges;
1312
1301
  expect(ifcs.size).toEqual(1);
1313
1302
  const ifc = ifcs.get(itemFamilyId);
1314
- //TODO fix
1315
- // expect(ifc.familyDelete).toBe(true);
1316
1303
  expect(ifc.colorAdds.length).toEqual(0);
1317
1304
  expect(ifc.colorDeletes.length).toEqual(1);
1318
1305
  });
@@ -1585,10 +1572,9 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1585
1572
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1586
1573
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1587
1574
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
1588
- .mockResolvedValueOnce(true) // for family
1589
- .mockResolvedValueOnce(true); // for SKU
1575
+ .mockResolvedValueOnce(true)
1576
+ .mockResolvedValueOnce(true);
1590
1577
  const events = await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
1591
- // Should have both family and SKU events because familyAssortmentItem is true when colorAdds.length > 0
1592
1578
  expect(events).toHaveLength(2);
1593
1579
  const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
1594
1580
  expect(skuEvent.eventType).toBe('UPSERT_ON_SEASON');
@@ -1627,10 +1613,9 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1627
1613
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1628
1614
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1629
1615
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
1630
- .mockResolvedValueOnce(false) // for family
1631
- .mockResolvedValueOnce(false); // for SKU
1616
+ .mockResolvedValueOnce(false)
1617
+ .mockResolvedValueOnce(false);
1632
1618
  const events = await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
1633
- // Should have both family and SKU events because familyAssortmentItem is true when colorUpdates.length > 0
1634
1619
  expect(events).toHaveLength(2);
1635
1620
  const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
1636
1621
  expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
@@ -1669,7 +1654,6 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1669
1654
  jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
1670
1655
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1671
1656
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1672
- // Product is creatable (true), SKU is not (false)
1673
1657
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
1674
1658
  .mockResolvedValueOnce(true)
1675
1659
  .mockResolvedValueOnce(false);
@@ -1680,9 +1664,7 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1680
1664
  expect(productEvent.eventType).toBe('UPSERT_ON_SEASON');
1681
1665
  expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
1682
1666
  expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenCalledTimes(2);
1683
- // Verify product event called with assortment entity
1684
1667
  expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(1, undefined, mapFileUtil, familyProjectItem, { item: prodEntityData, assortment });
1685
- // Verify SKU event called with assortment entity
1686
1668
  expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(2, undefined, mapFileUtil, colorProjectItem, { item: itemData, assortment });
1687
1669
  });
1688
1670
  });
@@ -3399,11 +3399,6 @@ 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
3407
3402
  exports.apc_2bOWR2j9R0QThDVu_delete_history = [
3408
3403
  {
3409
3404
  adds: 4,
@@ -31,20 +31,6 @@ 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
- // },
48
34
  },
49
35
  LCSSeason: {
50
36
  vibe2flex: {
@@ -68,7 +54,7 @@ exports.mapping = {
68
54
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
69
55
  vibe2flex: {
70
56
  getClass: () => 'LCSProduct',
71
- getSoftType: (entity /*, dependencies*/) => {
57
+ getSoftType: (entity) => {
72
58
  const prodType = entity['prodType'];
73
59
  let val = '';
74
60
  switch (prodType) {
@@ -93,7 +79,7 @@ exports.mapping = {
93
79
  vibeIQIdentifier: 'itemNumber'
94
80
  },
95
81
  valueTransform: {
96
- transformEx: (row /*, dependencies*/) => {
82
+ transformEx: (row) => {
97
83
  return row['otherProp'] + 'xxx';
98
84
  }
99
85
  }
@@ -111,7 +97,7 @@ exports.mapping = {
111
97
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
112
98
  vibe2flex: {
113
99
  getClass: () => 'LCSSKU',
114
- getSoftType: (entity /*, dependencies*/) => {
100
+ getSoftType: (entity) => {
115
101
  const prodType = entity['prodType'];
116
102
  let val = '';
117
103
  switch (prodType) {
@@ -266,20 +252,6 @@ exports.mapping2 = {
266
252
  }
267
253
  }
268
254
  }
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
- // },
283
255
  },
284
256
  LCSSeason: {
285
257
  getIdentifierProperties: () => ['brand', 'year', 'seasonType'],
@@ -302,7 +274,7 @@ exports.mapping2 = {
302
274
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
303
275
  vibe2flex: {
304
276
  getClass: () => 'LCSProduct',
305
- getSoftType: (entity /*, dependencies*/) => {
277
+ getSoftType: (entity) => {
306
278
  const prodType = entity['prodType'];
307
279
  let val = '';
308
280
  switch (prodType) {
@@ -327,7 +299,7 @@ exports.mapping2 = {
327
299
  vibeIQIdentifier: 'itemNumber'
328
300
  },
329
301
  valueTransform: {
330
- transformEx: (row /*, dependencies*/) => {
302
+ transformEx: (row) => {
331
303
  return row['otherProp'] + 'xxx';
332
304
  }
333
305
  }
@@ -346,7 +318,7 @@ exports.mapping2 = {
346
318
  getIdentifierProperties: () => ['uniqueIdentifierA', 'uniqueIdentifierB'],
347
319
  vibe2flex: {
348
320
  getClass: () => 'LCSSKU',
349
- getSoftType: (entity /*, dependencies*/) => {
321
+ getSoftType: (entity) => {
350
322
  const prodType = entity['prodType'];
351
323
  let val = '';
352
324
  switch (prodType) {
@@ -5,45 +5,9 @@ export declare class IdentifierConversion {
5
5
  static readonly INBOUND_ENTITY_MISSING_IDENIFIER_PROPS = "IdentifierConversion.getEntityCriteriaFromObject(): missing identifier properties: ";
6
6
  static readonly MISSING_OBJECT = "IdentifierConversion.getEntityCriteriaFromObject(): missing: object";
7
7
  static readonly MISSING_FLEXPLM_OBJECT_CLASS = "IdentifierConversion.getEntityCriteriaFromObject(): missing: flexPLMObjectClass";
8
- /** Takes in an assortment and returns an object to query for an LCSSeason
9
- * This will only return the identifier properties, and information properties if specified.
10
- * @param transformMapFile
11
- * @param mapFileUtil
12
- * @param dc
13
- * @param assortment
14
- * @param includeInformationKeys defaults true
15
- * @returns
16
- */
17
8
  static getSeasonIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, assortment: any, includeInformationKeys?: boolean): Promise<SeasonFederation>;
18
- /** Takes in an assortment and returns an object to query for an SeasonGroup
19
- * This will only return the identifier properties, and information properties if specified.
20
- * @param transformMapFile
21
- * @param mapFileUtil
22
- * @param dc
23
- * @param assortment
24
- * @param includeInformationKeys defaults true
25
- * @returns
26
- */
27
9
  static getSeasonGroupIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, assortment: any, includeInformationKeys?: boolean): Promise<SeasonGroupFederation>;
28
- /** Takes in an item and returns an object to query for an LCSProduct
29
- * This will only return the identifier properties, and information properties if specified.
30
- * @param transformMapFile
31
- * @param mapFileUtil
32
- * @param dc
33
- * @param assortment
34
- * @param includeInformationKeys defaults true
35
- * @returns
36
- */
37
10
  static getProductIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, itemFamilyObject: any, includeInformationKeys?: boolean): Promise<ProductFederation>;
38
- /** Takes in an item and returns an object to query for an LCSSKU
39
- * This will only return the identifier properties, and information properties if specified.
40
- * @param transformMapFile
41
- * @param mapFileUtil
42
- * @param dc
43
- * @param assortment
44
- * @param includeInformationKeys defaults true
45
- * @returns
46
- */
47
11
  static getSKUIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, itemObject: any, includeInformationKeys?: boolean): Promise<SkuFederation>;
48
12
  static getEntityCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
49
13
  static getAssortmentCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
@@ -5,15 +5,6 @@ const map_utils_1 = require("../util/map-utils");
5
5
  const type_conversion_utils_1 = require("../util/type-conversion-utils");
6
6
  const event_short_message_status_1 = require("../util/event-short-message-status");
7
7
  class IdentifierConversion {
8
- /** Takes in an assortment and returns an object to query for an LCSSeason
9
- * This will only return the identifier properties, and information properties if specified.
10
- * @param transformMapFile
11
- * @param mapFileUtil
12
- * @param dc
13
- * @param assortment
14
- * @param includeInformationKeys defaults true
15
- * @returns
16
- */
17
8
  static async getSeasonIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
18
9
  if (!assortment) {
19
10
  throw new Error('IdentifierConversion.getSeasonIdentityObject(): assortment must be provided.');
@@ -58,15 +49,6 @@ class IdentifierConversion {
58
49
  }
59
50
  return seasonObj;
60
51
  }
61
- /** Takes in an assortment and returns an object to query for an SeasonGroup
62
- * This will only return the identifier properties, and information properties if specified.
63
- * @param transformMapFile
64
- * @param mapFileUtil
65
- * @param dc
66
- * @param assortment
67
- * @param includeInformationKeys defaults true
68
- * @returns
69
- */
70
52
  static async getSeasonGroupIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
71
53
  if (!assortment) {
72
54
  throw new Error('IdentifierConversion.getSeasonGroupIdentityObject(): assortment must be provided.');
@@ -110,15 +92,6 @@ class IdentifierConversion {
110
92
  }
111
93
  return seasonGroupObj;
112
94
  }
113
- /** Takes in an item and returns an object to query for an LCSProduct
114
- * This will only return the identifier properties, and information properties if specified.
115
- * @param transformMapFile
116
- * @param mapFileUtil
117
- * @param dc
118
- * @param assortment
119
- * @param includeInformationKeys defaults true
120
- * @returns
121
- */
122
95
  static async getProductIdentityObject(transformMapFile, mapFileUtil, dc, itemFamilyObject, includeInformationKeys = true) {
123
96
  if (!itemFamilyObject) {
124
97
  throw new Error('IdentifierConversion.getProductIdentityObject(): itemFamilyObject must be provided.');
@@ -156,15 +129,6 @@ class IdentifierConversion {
156
129
  .applyTransformMap(transformMapFile, mapFileUtil, prodObj, mapKey, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
157
130
  return prodObj;
158
131
  }
159
- /** Takes in an item and returns an object to query for an LCSSKU
160
- * This will only return the identifier properties, and information properties if specified.
161
- * @param transformMapFile
162
- * @param mapFileUtil
163
- * @param dc
164
- * @param assortment
165
- * @param includeInformationKeys defaults true
166
- * @returns
167
- */
168
132
  static async getSKUIdentityObject(transformMapFile, mapFileUtil, dc, itemObject, includeInformationKeys = true) {
169
133
  if (!itemObject) {
170
134
  throw new Error('IdentifierConversion.getSKUIdentityObject(): itemObject must be provided.');
@@ -31,11 +31,9 @@ describe('getAssortmentFromObject', () => {
31
31
  entityValues[key] = value;
32
32
  }
33
33
  else if (Array.isArray(value)) {
34
- //multi select
35
34
  entityValues[key] = value.map((v) => v.value);
36
35
  }
37
36
  else if (value.value) {
38
- //single select
39
37
  entityValues[key] = value.value;
40
38
  }
41
39
  }
@@ -169,11 +167,9 @@ describe('getItemCriteriaFromObject', () => {
169
167
  entityValues[key] = value;
170
168
  }
171
169
  else if (Array.isArray(value)) {
172
- //multi select
173
170
  entityValues[key] = value.map((v) => v.value);
174
171
  }
175
172
  else if (value.value) {
176
- //single select
177
173
  entityValues[key] = value.value;
178
174
  }
179
175
  }
@@ -6,11 +6,9 @@ const util_1 = require("@contrail/util");
6
6
  const type_defaults_1 = require("./type-defaults");
7
7
  class ConfigDefaults {
8
8
  static async setConfigDefaults(config) {
9
- //Validate config
10
9
  if (!config.apiHost || !config.userName || !config.password) {
11
10
  throw new Error(ConfigDefaults.NEED_CONFIG_VALUES);
12
11
  }
13
- //List will be comma separated list in UI, so convert to array
14
12
  if (config?.itemPreDevelopmentLifecycleStages && !(config?.itemPreDevelopmentLifecycleStages instanceof Array)) {
15
13
  config.itemPreDevelopmentLifecycleStages = config.itemPreDevelopmentLifecycleStages.split(',');
16
14
  }
@@ -28,7 +26,6 @@ class ConfigDefaults {
28
26
  const pass = outputConfig.password;
29
27
  outputConfig.userName = () => uName;
30
28
  outputConfig.password = () => pass;
31
- //Don't allow overwriting this.
32
29
  outputConfig['OOBvibeEventEndpoint'] = '/rfa/vibeiq/vibeEvents';
33
30
  type_defaults_1.TypeDefaults.applyConfig(outputConfig);
34
31
  console.log('outputConfig: ' + JSON.stringify(outputConfig));
@@ -22,13 +22,11 @@ describe('all tests', () => {
22
22
  describe('setConfigDefaults - required values', () => {
23
23
  it('missing apiHost', async () => {
24
24
  const config = {
25
- //apiHost: 'http://test.com',
26
25
  userName: 'vibeiq',
27
26
  password: 'vibeiq',
28
27
  plmEnviornment: 'SB'
29
28
  };
30
29
  try {
31
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
32
30
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
33
31
  }
34
32
  catch (e) {
@@ -38,12 +36,10 @@ describe('all tests', () => {
38
36
  it('missing userName', async () => {
39
37
  const config = {
40
38
  apiHost: 'http://test.com',
41
- //userName: 'vibeiq',
42
39
  password: 'vibeiq',
43
40
  plmEnviornment: 'SB'
44
41
  };
45
42
  try {
46
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
47
43
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
48
44
  }
49
45
  catch (e) {
@@ -54,11 +50,9 @@ describe('all tests', () => {
54
50
  const config = {
55
51
  apiHost: 'http://test.com',
56
52
  userName: 'vibeiq',
57
- //password: 'vibeiq',
58
53
  plmEnviornment: 'SB'
59
54
  };
60
55
  try {
61
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
62
56
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
63
57
  }
64
58
  catch (e) {
@@ -70,10 +64,8 @@ describe('all tests', () => {
70
64
  apiHost: 'http://test.com',
71
65
  userName: 'vibeiq',
72
66
  password: 'vibeiq',
73
- //plmEnviornment: 'SB'
74
67
  };
75
68
  try {
76
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
77
69
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
78
70
  }
79
71
  catch (e) {
@@ -224,7 +216,6 @@ describe('all tests', () => {
224
216
  const startConfig = Object.assign({}, config);
225
217
  const objectClass = 'LCSSeason';
226
218
  const expectedAtts = ['flexPLMSeasonName'];
227
- // const expectedAtts =['seasonType', 'seasonYear'];
228
219
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(startConfig);
229
220
  const identifierAtts = fcConfig.identifierAtts[objectClass];
230
221
  expect(identifierAtts instanceof Array).toBeTruthy();