@contrail/flexplm 1.7.5 → 1.7.6-alpha.6b93f59

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.
@@ -29,7 +29,8 @@ class BaseProcessPublishAssortment {
29
29
  let publisher;
30
30
  const assortmentId = event.assortmentId;
31
31
  try {
32
- console.info('process-start!');
32
+ console.info('process-start: assortmentId: ' + assortmentId
33
+ + ', assortmentPublishChangeId: ' + assortmentPublishChangeId);
33
34
  let seasonFed;
34
35
  try {
35
36
  seasonFed = await this.getSeasonFederation(assortmentId);
@@ -74,9 +75,9 @@ class BaseProcessPublishAssortment {
74
75
  e.publishInfo = publishInfo;
75
76
  }
76
77
  catch (e2) {
77
- console.log('catch e2: ' + e2.message);
78
+ console.error('getPublishInfo failed: ' + e2.message);
78
79
  }
79
- console.log('catch e: ' + e.message);
80
+ console.error('process failed: assortmentId: ' + assortmentId + ': ' + e.message);
80
81
  throw e;
81
82
  }
82
83
  }
@@ -315,19 +316,17 @@ class BaseProcessPublishAssortment {
315
316
  }
316
317
  async downloadHydratedChangeDetail(assortmentPublishChange) {
317
318
  try {
318
- console.info('downloadHydratedChangeDetail-start');
319
319
  const link = assortmentPublishChange?.hydratedDetailDownloadLink;
320
320
  const response = await fetch(link);
321
321
  const data = await response.json();
322
322
  return data;
323
323
  }
324
324
  catch (e) {
325
- console.log('Error hydratedDetailDownloadLink: ' + e.message);
325
+ console.error('Error hydratedDetailDownloadLink: ' + e.message);
326
326
  }
327
327
  return undefined;
328
328
  }
329
329
  async downloadAssortmentBaseline(assortmentPublishChange) {
330
- console.info('downloadAssortmentBaseline-start');
331
330
  try {
332
331
  const link = assortmentPublishChange?.assortmentBaselineDownloadLink;
333
332
  const response = await fetch(link);
@@ -335,15 +334,12 @@ class BaseProcessPublishAssortment {
335
334
  return data;
336
335
  }
337
336
  catch (e) {
338
- console.log('Error assortmentBaselineDownloadLink: ' + e.message);
337
+ console.error('Error assortmentBaselineDownloadLink: ' + e.message);
339
338
  }
340
339
  return undefined;
341
340
  }
342
341
  async getDeleteChanges(assortmentPublishChange, apcHistory, assortmentBaseline, sinceDate) {
343
- console.info('getDeleteChanges(): ' + assortmentPublishChange?.id);
344
- console.info(sinceDate);
345
342
  const currentAPCIndex = apcHistory.findIndex(pc => pc?.id === assortmentPublishChange?.id);
346
- console.info(' currentAPCIndex: ' + currentAPCIndex);
347
343
  if (currentAPCIndex == 0) {
348
344
  return [];
349
345
  }
@@ -352,16 +348,13 @@ class BaseProcessPublishAssortment {
352
348
  const apcDeletes = await this.downloadDeleteChanges(assortmentPublishChange);
353
349
  let previousApcDate = Date.parse(apcCreatedOn);
354
350
  const sinceDateMilliseconds = sinceDate.getTime();
355
- if (app_framework_1.Logger.isInfoOn()) {
356
- console.info('apcCreatedOn: ' + apcCreatedOn);
357
- console.info('sinceDate: ' + sinceDate);
358
- console.info('sinceDateMilliseconds: ' + sinceDateMilliseconds);
359
- console.info('apcDateMilliseconds: ' + previousApcDate);
360
- }
351
+ console.info('getDeleteChanges(): apc: ' + assortmentPublishChange?.id
352
+ + ', index: ' + currentAPCIndex + ', previousApcCreatedOn: ' + apcCreatedOn);
361
353
  //if only 1 apc, no processing needed
362
354
  if (sinceDateMilliseconds !== previousApcDate) {
363
- console.info('sinceDateMilliseconds !== apcDateMilliseconds');
364
355
  const currentAssortmentItemIds = this.getBaselineItemIds(assortmentBaseline);
356
+ let scannedCount = 0;
357
+ let addedCount = 0;
365
358
  const deleteIds = (apcDeletes.length === 0)
366
359
  ? []
367
360
  : apcDeletes.map(item => item?.itemId);
@@ -376,19 +369,20 @@ class BaseProcessPublishAssortment {
376
369
  ? apcHistory[i - 1]
377
370
  : undefined;
378
371
  const deleteChanges = await this.buildDeleteChanges(workingAPC, previousApc);
379
- console.info('checking deleteChanges');
380
372
  for (const dItem of deleteChanges) {
381
373
  const dItemId = dItem?.itemId;
382
- console.info(dItemId);
374
+ scannedCount++;
383
375
  if (!currentAssortmentItemIds.includes(dItemId) && !deleteIds.includes(dItemId)) {
384
- console.info('adding');
376
+ addedCount++;
385
377
  deleteIds.push(dItemId);
386
378
  apcDeletes.push(dItem);
387
379
  }
388
380
  }
389
381
  }
390
382
  }
391
- console.info('getDeleteChanges()-currentAssortmentItemIds: ' + currentAssortmentItemIds);
383
+ console.info('getDeleteChanges(): baselineItems: ' + currentAssortmentItemIds.length
384
+ + ', scanned ' + scannedCount + ' historical delete changes, added ' + addedCount
385
+ + ', deleteIds: ' + deleteIds.length);
392
386
  console.info('getDeleteChanges()-deleteIds: ' + deleteIds);
393
387
  }
394
388
  return apcDeletes;
@@ -402,7 +396,6 @@ class BaseProcessPublishAssortment {
402
396
  return itemIds;
403
397
  }
404
398
  async downloadDeleteChanges(apc) {
405
- console.info('deleteDataDownloadLink-start');
406
399
  try {
407
400
  const link = apc?.deleteDataDownloadLink;
408
401
  const response = await fetch(link);
@@ -410,19 +403,17 @@ class BaseProcessPublishAssortment {
410
403
  return data;
411
404
  }
412
405
  catch (e) {
413
- console.log('Error deleteDataDownloadLink: ' + e.message);
406
+ console.error('Error deleteDataDownloadLink: ' + e.message);
414
407
  }
415
408
  return undefined;
416
409
  }
417
410
  async buildDeleteChanges(apc, previousApc) {
418
- console.info('buildDeleteChanges()');
419
411
  if (apc?.deleteDataDownloadLink) {
420
412
  const deleteChanges = await this.downloadDeleteChanges(apc);
421
413
  if (deleteChanges) {
422
414
  return deleteChanges;
423
415
  }
424
416
  }
425
- console.info('pulling down full APC');
426
417
  apc = await this.downloadAssortmentPublishChange(apc?.assortmentId, apc?.id);
427
418
  if (apc?.deleteDataDownloadLink) {
428
419
  const deleteChanges = await this.downloadDeleteChanges(apc);
@@ -434,19 +425,18 @@ class BaseProcessPublishAssortment {
434
425
  throw new Error(BaseProcessPublishAssortment.NOT_ABLE_TO_PROCESS_DELETE_CHANGES);
435
426
  }
436
427
  let previousBaseline;
437
- console.info('check previousApc');
438
428
  if (previousApc?.assortmentBaselineDownloadLink) {
439
429
  previousBaseline = await this.downloadAssortmentBaseline(previousApc);
440
430
  }
441
431
  else {
442
- console.info('previousApc pulling down full APC');
443
432
  previousApc = await this.downloadAssortmentPublishChange(previousApc?.assortmentId, previousApc?.id);
444
433
  previousBaseline = await this.downloadAssortmentBaseline(previousApc);
445
434
  }
446
435
  const deleteIds = apc?.detail?.deletes.map(dItem => dItem?.id);
447
436
  //building deletes based on previous baseline; because some APCs don't have delete data
448
437
  const deleteArray = previousBaseline?.assortmentItems.filter(aItem => deleteIds.includes(aItem?.itemId));
449
- console.info('deleteArray.length: ' + deleteArray.length);
438
+ console.info('buildDeleteChanges(): no deleteDataDownloadLink on apc ' + apc?.id
439
+ + '; rebuilding ' + deleteArray.length + ' deletes from previous baseline');
450
440
  return deleteArray;
451
441
  }
452
442
  async getItemFederatedIds( /*itemIds*/) {
@@ -484,7 +474,6 @@ class BaseProcessPublishAssortment {
484
474
  return deleteItems;
485
475
  }
486
476
  getReleasedForDevelopmentItemAndFamilyIds(fullChange, deleteChanges) {
487
- console.info('getReleasedForDevelopmentItemAndFamilyIds');
488
477
  const releasedForDevelopmentItemIds = [];
489
478
  const itemFamilySet = new Set();
490
479
  const assortmentItemsArray = fullChange?.assortmentItems;
@@ -561,7 +550,6 @@ class BaseProcessPublishAssortment {
561
550
  return !!lifecycleStage && !this.config.itemPreDevelopmentLifecycleStages.includes(lifecycleStage);
562
551
  }
563
552
  async processPublish(pcd, changeDetail, fullChange, deleteChanges) {
564
- console.info('processPublish-start');
565
553
  const event = {
566
554
  assortmentId: pcd.assortmentId,
567
555
  assortmentPublishChangeId: pcd.assortmentPublishChangeId
@@ -745,7 +733,6 @@ class BaseProcessPublishAssortment {
745
733
  + '-' + d.getUTCMilliseconds();
746
734
  }
747
735
  getItemFamilyChanges(pcd, changeDetail, assortmentItemFullChangeMap, assortmentItemDeleteMap) {
748
- console.info('getItemFamilyChanges-start');
749
736
  const itemFamilyChanges = new Map();
750
737
  const { adds, deletes, updates, familyItemsRemoved } = changeDetail;
751
738
  const addIds = adds.map(item => item.id);
@@ -836,8 +823,7 @@ class BaseProcessPublishAssortment {
836
823
  }
837
824
  else {
838
825
  if (!item) {
839
- console.error('Failed to find deleted item entity');
840
- console.error(' itemFamilyId: ' + itemFamilyId + ' -itemId: ' + itemId);
826
+ console.error('Failed to find deleted item entity: itemFamilyId: ' + itemFamilyId + ', itemId: ' + itemId);
841
827
  continue;
842
828
  }
843
829
  }
@@ -878,7 +864,6 @@ class BaseProcessPublishAssortment {
878
864
  return itemFamilyChanges;
879
865
  }
880
866
  async getEventsForPublishChangeData(publishChangeData) {
881
- console.info('getEventsForPublishChangeData-start');
882
867
  const seasonalPayloads = [];
883
868
  for (const itemFamilyChange of publishChangeData.itemFamilyChanges.values()) {
884
869
  const events = await this.getEventsForItemFamilyChanges(itemFamilyChange, publishChangeData.assortmentId, publishChangeData.seasonFed, publishChangeData.itemToFederatedIdMapping);
@@ -886,6 +871,8 @@ class BaseProcessPublishAssortment {
886
871
  seasonalPayloads.push(...events);
887
872
  }
888
873
  }
874
+ console.info('getEventsForPublishChangeData: itemFamilies: '
875
+ + publishChangeData.itemFamilyChanges.size + ', payloads: ' + seasonalPayloads.length);
889
876
  return seasonalPayloads;
890
877
  }
891
878
  /**Returns the events for a given ItemFamilyChanges object
@@ -905,7 +892,6 @@ class BaseProcessPublishAssortment {
905
892
  * @returns
906
893
  */
907
894
  async getEventsForItemFamilyChanges(itemFamilyChanges, assortmentId, seasonFed, itemToFederatedIdMapping) {
908
- console.info('getEventsForItemFamilyChanges()');
909
895
  const events = [];
910
896
  const LCSSeason = Object.assign({}, seasonFed);
911
897
  const assortment = await this.getAssortment(assortmentId);
@@ -923,7 +909,8 @@ class BaseProcessPublishAssortment {
923
909
  ? itemFamilyChanges.assortmentItemFullChangeMap.get(entityReference)?.item
924
910
  : itemFamilyChanges.itemFamilyObject;
925
911
  let seasonalData = await this.getSeasonalData(projectItem);
926
- seasonalData = await map_utils_1.MapUtil.applyTransformMap(this.transformMapFile, this.mapFileUtil, seasonalData, 'LCSProductSeasonLink', 'vibe2flex');
912
+ const productSeasonMapKey = (await type_conversion_utils_1.TypeConversionUtils.getMapKey(this.transformMapFile, this.mapFileUtil, projectItem, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION)) || 'LCSProductSeasonLink';
913
+ seasonalData = await map_utils_1.MapUtil.applyTransformMap(this.transformMapFile, this.mapFileUtil, seasonalData, productSeasonMapKey, 'vibe2flex');
927
914
  const LCSProduct = await this.getProductFederation(entityReference, itemToFederatedIdMapping, prodEntityData);
928
915
  const isCreatable = await type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity(this.transformMapFile, this.mapFileUtil, projectItem, { item: prodEntityData, assortment });
929
916
  const eventType = isCreatable ? 'UPSERT_ON_SEASON' : 'UPDATE_ON_SEASON';
@@ -958,7 +945,8 @@ class BaseProcessPublishAssortment {
958
945
  }
959
946
  const projectItem = this.getProjectItem(itemFamilyChanges, entityReference);
960
947
  let seasonalData = await this.getSeasonalData(projectItem);
961
- seasonalData = await map_utils_1.MapUtil.applyTransformMap(this.transformMapFile, this.mapFileUtil, seasonalData, 'LCSSKUSeasonLink', 'vibe2flex');
948
+ const skuSeasonMapKey = (await type_conversion_utils_1.TypeConversionUtils.getMapKey(this.transformMapFile, this.mapFileUtil, projectItem, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION)) || 'LCSSKUSeasonLink';
949
+ seasonalData = await map_utils_1.MapUtil.applyTransformMap(this.transformMapFile, this.mapFileUtil, seasonalData, skuSeasonMapKey, 'vibe2flex');
962
950
  const LCSSKU = await this.getSKUFederation(entityReference, itemToFederatedIdMapping, item);
963
951
  const isCreatable = await type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity(this.transformMapFile, this.mapFileUtil, projectItem, { item, assortment });
964
952
  const eventType = isCreatable ? 'UPSERT_ON_SEASON' : 'UPDATE_ON_SEASON';
@@ -1509,6 +1509,9 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1509
1509
  };
1510
1510
  const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
1511
1511
  const dc = new data_converter_1.DataConverter(config, mapFileUtil);
1512
+ beforeEach(() => {
1513
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getMapKey').mockResolvedValue(null);
1514
+ });
1512
1515
  afterEach(() => {
1513
1516
  jest.restoreAllMocks();
1514
1517
  });
@@ -1705,6 +1708,108 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1705
1708
  // Verify SKU event called with assortment entity
1706
1709
  expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(2, undefined, mapFileUtil, colorProjectItem, { item: itemData, assortment });
1707
1710
  });
1711
+ it('should use dynamic map key for LCSSKUSeasonLink when getMapKey returns a custom key', async () => {
1712
+ const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
1713
+ const itemFamilyId = 'family123';
1714
+ const colorId = 'color456';
1715
+ const familyItemData = { id: itemFamilyId, identifier: 'FAM-123', itemNumber: 'FAM-123' };
1716
+ const familyProjectItem = { id: 'proj0', updatedOn: '2023-01-15T00:00:00.000Z' };
1717
+ const colorProjectItem = { id: 'proj1', updatedOn: '2023-01-15T00:00:00.000Z' };
1718
+ const assortment = { id: 'assort123', name: 'Fall 2023 Assortment', publishToFlexPLM: true };
1719
+ const seasonFed = { entityReference: 'assortment:assort123', objectClass: 'LCSSeason', flexPLMSeasonName: 'Fall 2023' };
1720
+ const seasonalData = { someData: 'value' };
1721
+ const itemFamilyChanges = new item_family_changes_1.ItemFamilyChanges(itemFamilyId, new Date('2023-01-01T00:00:00.000Z'));
1722
+ itemFamilyChanges.colorUpdates.push(colorId);
1723
+ itemFamilyChanges.assortmentItemFullChangeMap.set(itemFamilyId, { item: familyItemData, projectItem: familyProjectItem });
1724
+ itemFamilyChanges.assortmentItemFullChangeMap.set(colorId, { item: { id: colorId, identifier: 'COLOR-456' }, projectItem: colorProjectItem });
1725
+ jest.spyOn(bppa, 'getAssortment').mockResolvedValue(assortment);
1726
+ jest.spyOn(bppa, 'getProjectItem')
1727
+ .mockReturnValueOnce(familyProjectItem)
1728
+ .mockReturnValueOnce(colorProjectItem);
1729
+ jest.spyOn(bppa, 'getSeasonalData').mockResolvedValue(seasonalData);
1730
+ jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
1731
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1732
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1733
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity').mockResolvedValue(false);
1734
+ // First call: product path (return null → falls back to default)
1735
+ // Second call: SKU path (return custom key)
1736
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getMapKey')
1737
+ .mockResolvedValueOnce(null)
1738
+ .mockResolvedValueOnce('LCSSKUSeasonLinkFlexOwned');
1739
+ await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
1740
+ expect(map_utils_1.MapUtil.applyTransformMap).toHaveBeenCalledWith(undefined, mapFileUtil, seasonalData, 'LCSSKUSeasonLinkFlexOwned', 'vibe2flex');
1741
+ });
1742
+ it('should fall back to LCSSKUSeasonLink when getMapKey returns null', async () => {
1743
+ const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
1744
+ const itemFamilyId = 'family123';
1745
+ const colorId = 'color456';
1746
+ const familyItemData = { id: itemFamilyId, identifier: 'FAM-123', itemNumber: 'FAM-123' };
1747
+ const familyProjectItem = { id: 'proj0', updatedOn: '2023-01-15T00:00:00.000Z' };
1748
+ const colorProjectItem = { id: 'proj1', updatedOn: '2023-01-15T00:00:00.000Z' };
1749
+ const assortment = { id: 'assort123', name: 'Fall 2023 Assortment', publishToFlexPLM: true };
1750
+ const seasonFed = { entityReference: 'assortment:assort123', objectClass: 'LCSSeason', flexPLMSeasonName: 'Fall 2023' };
1751
+ const seasonalData = { someData: 'value' };
1752
+ const itemFamilyChanges = new item_family_changes_1.ItemFamilyChanges(itemFamilyId, new Date('2023-01-01T00:00:00.000Z'));
1753
+ itemFamilyChanges.colorUpdates.push(colorId);
1754
+ itemFamilyChanges.assortmentItemFullChangeMap.set(itemFamilyId, { item: familyItemData, projectItem: familyProjectItem });
1755
+ itemFamilyChanges.assortmentItemFullChangeMap.set(colorId, { item: { id: colorId, identifier: 'COLOR-456' }, projectItem: colorProjectItem });
1756
+ jest.spyOn(bppa, 'getAssortment').mockResolvedValue(assortment);
1757
+ jest.spyOn(bppa, 'getProjectItem')
1758
+ .mockReturnValueOnce(familyProjectItem)
1759
+ .mockReturnValueOnce(colorProjectItem);
1760
+ jest.spyOn(bppa, 'getSeasonalData').mockResolvedValue(seasonalData);
1761
+ jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
1762
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1763
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1764
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity').mockResolvedValue(false);
1765
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getMapKey').mockResolvedValue(null);
1766
+ await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
1767
+ expect(map_utils_1.MapUtil.applyTransformMap).toHaveBeenCalledWith(undefined, mapFileUtil, seasonalData, 'LCSSKUSeasonLink', 'vibe2flex');
1768
+ });
1769
+ it('should use dynamic map key for LCSProductSeasonLink when getMapKey returns a custom key', async () => {
1770
+ const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
1771
+ const itemFamilyId = 'family123';
1772
+ const prodEntityData = { id: itemFamilyId, identifier: 'FAM-123', itemNumber: 'FAM-123' };
1773
+ const projectItem = { id: 'proj1', updatedOn: '2023-01-15T00:00:00.000Z' };
1774
+ const assortment = { id: 'assort123', name: 'Fall 2023 Assortment', publishToFlexPLM: true };
1775
+ const seasonFed = { entityReference: 'assortment:assort123', objectClass: 'LCSSeason', flexPLMSeasonName: 'Fall 2023' };
1776
+ const seasonalData = { someData: 'value' };
1777
+ const itemFamilyChanges = new item_family_changes_1.ItemFamilyChanges(itemFamilyId, new Date('2023-01-01T00:00:00.000Z'));
1778
+ itemFamilyChanges.familyUpdate = true;
1779
+ itemFamilyChanges.assortmentItemFullChangeMap.set(itemFamilyId, { item: prodEntityData, projectItem });
1780
+ jest.spyOn(bppa, 'getAssortment').mockResolvedValue(assortment);
1781
+ jest.spyOn(bppa, 'getProjectItem').mockReturnValue(projectItem);
1782
+ jest.spyOn(bppa, 'getSeasonalData').mockResolvedValue(seasonalData);
1783
+ jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
1784
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1785
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1786
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity').mockResolvedValue(false);
1787
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getMapKey').mockResolvedValue('LCSProductSeasonLinkCustom');
1788
+ await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
1789
+ expect(map_utils_1.MapUtil.applyTransformMap).toHaveBeenCalledWith(undefined, mapFileUtil, seasonalData, 'LCSProductSeasonLinkCustom', 'vibe2flex');
1790
+ });
1791
+ it('should fall back to LCSProductSeasonLink when getMapKey returns null', async () => {
1792
+ const bppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
1793
+ const itemFamilyId = 'family123';
1794
+ const prodEntityData = { id: itemFamilyId, identifier: 'FAM-123', itemNumber: 'FAM-123' };
1795
+ const projectItem = { id: 'proj1', updatedOn: '2023-01-15T00:00:00.000Z' };
1796
+ const assortment = { id: 'assort123', name: 'Fall 2023 Assortment', publishToFlexPLM: true };
1797
+ const seasonFed = { entityReference: 'assortment:assort123', objectClass: 'LCSSeason', flexPLMSeasonName: 'Fall 2023' };
1798
+ const seasonalData = { someData: 'value' };
1799
+ const itemFamilyChanges = new item_family_changes_1.ItemFamilyChanges(itemFamilyId, new Date('2023-01-01T00:00:00.000Z'));
1800
+ itemFamilyChanges.familyUpdate = true;
1801
+ itemFamilyChanges.assortmentItemFullChangeMap.set(itemFamilyId, { item: prodEntityData, projectItem });
1802
+ jest.spyOn(bppa, 'getAssortment').mockResolvedValue(assortment);
1803
+ jest.spyOn(bppa, 'getProjectItem').mockReturnValue(projectItem);
1804
+ jest.spyOn(bppa, 'getSeasonalData').mockResolvedValue(seasonalData);
1805
+ jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
1806
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1807
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1808
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity').mockResolvedValue(false);
1809
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getMapKey').mockResolvedValue(null);
1810
+ await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
1811
+ expect(map_utils_1.MapUtil.applyTransformMap).toHaveBeenCalledWith(undefined, mapFileUtil, seasonalData, 'LCSProductSeasonLink', 'vibe2flex');
1812
+ });
1708
1813
  });
1709
1814
  describe('sendToFlexPLM / handleVibeIQFile / sendPublishPayloadEvent', () => {
1710
1815
  const config = {
@@ -1932,6 +2037,7 @@ describe('released family with pre-development options', () => {
1932
2037
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['itemNumber']);
1933
2038
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1934
2039
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity').mockResolvedValue(true);
2040
+ jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getMapKey').mockResolvedValue(null);
1935
2041
  };
1936
2042
  afterEach(() => { jest.restoreAllMocks(); });
1937
2043
  /////////////////////////////////////////////////////////////////////////////
@@ -175,18 +175,12 @@ class DataConverter {
175
175
  }
176
176
  async getObjectReferenceValue(prop, newData, inflateObjRef = false) {
177
177
  const slug = prop['slug'];
178
- if (app_framework_1.Logger.isDebugOn()) {
179
- console.debug('getObjectReferenceValue-prop: ' + slug);
180
- }
181
178
  let value = newData[slug];
182
179
  const entityType = prop['referencedTypeRootSlug'];
183
180
  const entityId = newData[slug + 'Id'];
184
181
  if ((!value || typeof value === 'string') && inflateObjRef) {
185
182
  if (entityId) {
186
183
  if (this.objRefCache[entityId]) {
187
- if (app_framework_1.Logger.isDebugOn()) {
188
- console.debug('cache hit: ' + entityId);
189
- }
190
184
  return this.objRefCache[entityId];
191
185
  }
192
186
  const criteria = {
@@ -432,9 +426,6 @@ class DataConverter {
432
426
  return "";
433
427
  }
434
428
  if (this.objRefCache[ctx.cacheKey]) {
435
- if (app_framework_1.Logger.isDebugOn()) {
436
- console.debug(`object reference cache hit: ${ctx.cacheKey}`);
437
- }
438
429
  return this.objRefCache[ctx.cacheKey];
439
430
  }
440
431
  const objectReferenceId = ctx.useIdentityService
@@ -634,9 +625,6 @@ class DataConverter {
634
625
  }
635
626
  let cacheUser = DataConverter.getFromStaticCache(nd.email);
636
627
  if (cacheUser) {
637
- if (app_framework_1.Logger.isDebugOn()) {
638
- console.debug('user cache hit: ' + nd.email);
639
- }
640
628
  await this.processGroupMemberCheck(prop, nd.email);
641
629
  return cacheUser;
642
630
  }
@@ -706,18 +694,12 @@ class DataConverter {
706
694
  */
707
695
  async getUserListValue(prop, newData) {
708
696
  const slug = prop['slug'];
709
- if (app_framework_1.Logger.isDebugOn()) {
710
- console.debug('getUserListValue-prop: ' + slug);
711
- }
712
697
  const entityId = newData[slug + 'Id'];
713
698
  if (!entityId) {
714
699
  return {};
715
700
  }
716
701
  const cacheUser = DataConverter.getFromStaticCache(entityId);
717
702
  if (cacheUser) {
718
- if (app_framework_1.Logger.isDebugOn()) {
719
- console.debug('user cache hit: ' + entityId);
720
- }
721
703
  return Object.assign({}, cacheUser);
722
704
  }
723
705
  const user = await this.getUserById(entityId);
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
- {
2
- "name": "@contrail/flexplm",
3
- "version": "1.7.5",
4
- "description": "Library used for integration with flexplm.",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "bin": {
8
- "flexplm-mapping": "lib/cli/index.js"
9
- },
10
- "files": [
11
- "lib/**/*",
12
- "scripts/copy-template.js"
13
- ],
14
- "scripts": {
15
- "build": "tsc; node scripts/copy-template.js",
16
- "build:win": "tsc && node scripts/copy-template.js",
17
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
18
- "lint": "tslint -p tsconfig.json",
19
- "test": "jest",
20
- "test-watch": "jest --watch",
21
- "test-debug": "jest --runInBand",
22
- "test-coverage": "jest --coverage"
23
- },
24
- "keywords": [],
25
- "author": "VibeIQ",
26
- "license": "ISC",
27
- "devDependencies": {
28
- "@types/jest": "^29.5.2",
29
- "jest": "^29.5.0",
30
- "prettier": "^1.19.1",
31
- "ts-jest": "^29.1.1",
32
- "tslint": "^5.11.0",
33
- "tslint-config-prettier": "^1.18.0",
34
- "typescript": "^4.0.0"
35
- },
36
- "peerDependencies": {
37
- "typescript": ">=4.0.0"
38
- },
39
- "peerDependenciesMeta": {
40
- "typescript": {
41
- "optional": true
42
- }
43
- },
44
- "jest": {
45
- "moduleFileExtensions": [
46
- "js",
47
- "json",
48
- "ts"
49
- ],
50
- "rootDir": "src",
51
- "testRegex": ".spec.ts$",
52
- "transform": {
53
- "^.+\\.(t|j)s$": "ts-jest"
54
- },
55
- "coverageDirectory": "../coverage",
56
- "testEnvironment": "node"
57
- },
58
- "dependencies": {
59
- "@contrail/app-framework": "^1.4.3",
60
- "@contrail/sdk": "^1.5.10",
61
- "@contrail/transform-data": "^1.3.2",
62
- "@contrail/util": "^1.3.1",
63
- "axios": "^1.4.0",
64
- "p-limit": "^3.1.0"
65
- }
66
- }
1
+ {
2
+ "name": "@contrail/flexplm",
3
+ "version": "1.7.6-alpha.6b93f59",
4
+ "description": "Library used for integration with flexplm.",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "bin": {
8
+ "flexplm-mapping": "lib/cli/index.js"
9
+ },
10
+ "files": [
11
+ "lib/**/*",
12
+ "scripts/copy-template.js"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc; node scripts/copy-template.js",
16
+ "build:win": "tsc && node scripts/copy-template.js",
17
+ "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
18
+ "lint": "tslint -p tsconfig.json",
19
+ "test": "jest",
20
+ "test-watch": "jest --watch",
21
+ "test-debug": "jest --runInBand",
22
+ "test-coverage": "jest --coverage"
23
+ },
24
+ "keywords": [],
25
+ "author": "VibeIQ",
26
+ "license": "ISC",
27
+ "devDependencies": {
28
+ "@types/jest": "^29.5.2",
29
+ "jest": "^29.5.0",
30
+ "prettier": "^1.19.1",
31
+ "ts-jest": "^29.1.1",
32
+ "tslint": "^5.11.0",
33
+ "tslint-config-prettier": "^1.18.0",
34
+ "typescript": "^4.0.0"
35
+ },
36
+ "peerDependencies": {
37
+ "typescript": ">=4.0.0"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "typescript": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "jest": {
45
+ "moduleFileExtensions": [
46
+ "js",
47
+ "json",
48
+ "ts"
49
+ ],
50
+ "rootDir": "src",
51
+ "testRegex": ".spec.ts$",
52
+ "transform": {
53
+ "^.+\\.(t|j)s$": "ts-jest"
54
+ },
55
+ "coverageDirectory": "../coverage",
56
+ "testEnvironment": "node"
57
+ },
58
+ "dependencies": {
59
+ "@contrail/app-framework": "^1.4.3",
60
+ "@contrail/sdk": "^1.5.10",
61
+ "@contrail/transform-data": "^1.3.2",
62
+ "@contrail/util": "^1.3.1",
63
+ "axios": "^1.4.0",
64
+ "p-limit": "^3.1.0"
65
+ }
66
+ }