@contrail/flexplm 1.3.2-alpha.30ca8bf → 1.3.2-alpha.3ffe557

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 (113) hide show
  1. package/lib/cli/commands/compile.d.ts +4 -0
  2. package/lib/cli/commands/compile.js +73 -0
  3. package/lib/cli/commands/compile.spec.d.ts +1 -0
  4. package/lib/cli/commands/compile.spec.js +80 -0
  5. package/lib/cli/commands/create.d.ts +5 -0
  6. package/lib/cli/commands/create.js +77 -0
  7. package/lib/cli/commands/create.spec.d.ts +1 -0
  8. package/lib/cli/commands/create.spec.js +78 -0
  9. package/lib/cli/commands/upload.d.ts +17 -0
  10. package/lib/cli/commands/upload.js +228 -0
  11. package/lib/cli/commands/upload.spec.d.ts +1 -0
  12. package/lib/cli/commands/upload.spec.js +88 -0
  13. package/lib/cli/index.d.ts +5 -0
  14. package/lib/cli/index.js +70 -0
  15. package/lib/cli/index.spec.d.ts +1 -0
  16. package/lib/cli/index.spec.js +85 -0
  17. package/lib/cli/template/mapping-template.ts.template +62 -0
  18. package/lib/entity-processor/base-entity-processor.d.ts +47 -10
  19. package/lib/entity-processor/base-entity-processor.js +53 -34
  20. package/lib/entity-processor/base-entity-processor.spec.js +1 -191
  21. package/lib/index.d.ts +1 -0
  22. package/lib/index.js +1 -0
  23. package/lib/interfaces/mapping-file.d.ts +460 -0
  24. package/lib/interfaces/mapping-file.js +2 -0
  25. package/lib/publish/base-process-publish-assortment.d.ts +25 -0
  26. package/lib/publish/base-process-publish-assortment.js +60 -6
  27. package/lib/publish/base-process-publish-assortment.spec.js +22 -4
  28. package/lib/publish/mockData.js +5 -0
  29. package/lib/transform/identifier-conversion-spec-mockData.js +34 -6
  30. package/lib/transform/identifier-conversion.d.ts +36 -0
  31. package/lib/transform/identifier-conversion.js +36 -0
  32. package/lib/transform/identifier-conversion.spec.js +4 -0
  33. package/lib/util/config-defaults.d.ts +0 -1
  34. package/lib/util/config-defaults.js +3 -3
  35. package/lib/util/config-defaults.spec.js +9 -32
  36. package/lib/util/data-converter-spec-mockData.js +17 -3
  37. package/lib/util/data-converter.d.ts +97 -0
  38. package/lib/util/data-converter.js +133 -1
  39. package/lib/util/data-converter.spec.js +68 -0
  40. package/lib/util/error-response-object.d.ts +5 -0
  41. package/lib/util/error-response-object.js +7 -0
  42. package/lib/util/event-short-message-status.js +1 -0
  43. package/lib/util/federation.js +8 -0
  44. package/lib/util/flexplm-connect.d.ts +7 -0
  45. package/lib/util/flexplm-connect.js +14 -0
  46. package/lib/util/logger-config.js +1 -0
  47. package/lib/util/map-util-spec-mockData.js +17 -3
  48. package/lib/util/map-utils.d.ts +27 -0
  49. package/lib/util/map-utils.js +27 -0
  50. package/lib/util/thumbnail-util.d.ts +21 -0
  51. package/lib/util/thumbnail-util.js +28 -1
  52. package/lib/util/thumbnail-util.spec.js +6 -0
  53. package/lib/util/type-conversion-utils-spec-mockData.js +3 -4
  54. package/lib/util/type-conversion-utils.d.ts +140 -1
  55. package/lib/util/type-conversion-utils.js +143 -16
  56. package/lib/util/type-conversion-utils.spec.js +0 -59
  57. package/lib/util/type-defaults.d.ts +58 -0
  58. package/lib/util/type-defaults.js +58 -0
  59. package/lib/util/type-defaults.spec.js +5 -5
  60. package/lib/util/type-utils.d.ts +21 -0
  61. package/lib/util/type-utils.js +23 -0
  62. package/lib/util/type-utils.spec.js +2 -0
  63. package/package.json +21 -6
  64. package/scripts/copy-template.js +10 -0
  65. package/.github/pull_request_template.md +0 -31
  66. package/.github/workflows/flexplm-lib.yml +0 -27
  67. package/.github/workflows/publish-to-npm.yml +0 -121
  68. package/CHANGELOG.md +0 -36
  69. package/publish.bat +0 -5
  70. package/publish.sh +0 -5
  71. package/src/entity-processor/base-entity-processor.spec.ts +0 -689
  72. package/src/entity-processor/base-entity-processor.ts +0 -583
  73. package/src/flexplm-request.ts +0 -28
  74. package/src/flexplm-utils.spec.ts +0 -27
  75. package/src/flexplm-utils.ts +0 -29
  76. package/src/index.ts +0 -22
  77. package/src/interfaces/interfaces.ts +0 -122
  78. package/src/interfaces/item-family-changes.ts +0 -67
  79. package/src/interfaces/publish-change-data.ts +0 -43
  80. package/src/publish/base-process-publish-assortment-callback.ts +0 -50
  81. package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
  82. package/src/publish/base-process-publish-assortment.ts +0 -1134
  83. package/src/publish/mockData.ts +0 -4561
  84. package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
  85. package/src/transform/identifier-conversion.spec.ts +0 -354
  86. package/src/transform/identifier-conversion.ts +0 -282
  87. package/src/util/config-defaults.spec.ts +0 -392
  88. package/src/util/config-defaults.ts +0 -97
  89. package/src/util/data-converter-spec-mockData.ts +0 -231
  90. package/src/util/data-converter.spec.ts +0 -1041
  91. package/src/util/data-converter.ts +0 -762
  92. package/src/util/error-response-object.spec.ts +0 -116
  93. package/src/util/error-response-object.ts +0 -50
  94. package/src/util/event-short-message-status.ts +0 -22
  95. package/src/util/federation.ts +0 -172
  96. package/src/util/flexplm-connect.spec.ts +0 -132
  97. package/src/util/flexplm-connect.ts +0 -208
  98. package/src/util/logger-config.ts +0 -20
  99. package/src/util/map-util-spec-mockData.ts +0 -231
  100. package/src/util/map-utils.spec.ts +0 -103
  101. package/src/util/map-utils.ts +0 -41
  102. package/src/util/mockData.ts +0 -101
  103. package/src/util/thumbnail-util.spec.ts +0 -508
  104. package/src/util/thumbnail-util.ts +0 -272
  105. package/src/util/type-conversion-utils-spec-mockData.ts +0 -272
  106. package/src/util/type-conversion-utils.spec.ts +0 -1031
  107. package/src/util/type-conversion-utils.ts +0 -490
  108. package/src/util/type-defaults.spec.ts +0 -669
  109. package/src/util/type-defaults.ts +0 -281
  110. package/src/util/type-utils.spec.ts +0 -227
  111. package/src/util/type-utils.ts +0 -144
  112. package/tsconfig.json +0 -24
  113. package/tslint.json +0 -57
@@ -13,6 +13,7 @@ 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
16
17
  getFlexPLMObjectData(newData, dataToSkip, inflateObjRef) {
17
18
  return newData;
18
19
  }
@@ -95,6 +96,7 @@ describe('getPublishInfo', () => {
95
96
  return { id: assortmentId, name: assortmentName };
96
97
  });
97
98
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
99
+ // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
98
100
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
99
101
  return versionHistoryNumber;
100
102
  });
@@ -120,6 +122,7 @@ describe('getPublishInfo', () => {
120
122
  return { id: assortmentId, name: undefined };
121
123
  });
122
124
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
125
+ // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
123
126
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
124
127
  return versionHistoryNumber;
125
128
  });
@@ -145,6 +148,7 @@ describe('getPublishInfo', () => {
145
148
  return undefined;
146
149
  });
147
150
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
151
+ // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
148
152
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
149
153
  return versionHistoryNumber;
150
154
  });
@@ -179,6 +183,7 @@ describe('getPublishInfo', () => {
179
183
  return { id: assortmentId, name: assortmentName };
180
184
  });
181
185
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
186
+ // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
182
187
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
183
188
  return versionHistoryNumber;
184
189
  });
@@ -203,6 +208,7 @@ describe('getPublishInfo', () => {
203
208
  return { id: assortmentId, name: assortmentName };
204
209
  });
205
210
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
211
+ // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
206
212
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
207
213
  return versionHistoryNumber;
208
214
  });
@@ -229,6 +235,7 @@ describe('getPublishInfo', () => {
229
235
  return { id: assortmentId, name: assortmentName };
230
236
  });
231
237
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
238
+ // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
232
239
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
233
240
  return versionHistoryNumber;
234
241
  });
@@ -255,6 +262,7 @@ describe('getPublishInfo', () => {
255
262
  return { id: assortmentId, name: assortmentName };
256
263
  });
257
264
  const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
265
+ // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
258
266
  .mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
259
267
  return versionHistoryNumber;
260
268
  });
@@ -408,6 +416,7 @@ describe('getSnapshotVersion', () => {
408
416
  {
409
417
  id: 'qewrwer',
410
418
  assortmentChangeId: 'bad-id',
419
+ // createdOn: '2023-01-14T19:13:58.902Z',
411
420
  versionNumber
412
421
  }
413
422
  ];
@@ -1140,6 +1149,7 @@ describe('getItemFamilyChanges', () => {
1140
1149
  const ifcs = pcd.itemFamilyChanges;
1141
1150
  expect(ifcs.size).toEqual(1);
1142
1151
  const ifc = ifcs.get(itemFamilyId);
1152
+ // expect(ifc.familyAdd).toBe(true);
1143
1153
  expect(ifc.colorAdds.length).toEqual(1);
1144
1154
  });
1145
1155
  it('Feb 3 - 2+ Option A', () => {
@@ -1169,6 +1179,7 @@ describe('getItemFamilyChanges', () => {
1169
1179
  const ifcs = pcd.itemFamilyChanges;
1170
1180
  expect(ifcs.size).toEqual(1);
1171
1181
  const ifc = ifcs.get(itemFamilyId);
1182
+ // expect(ifc.familyAdd).toBe(true);
1172
1183
  expect(ifc.colorAdds.length).toEqual(2);
1173
1184
  });
1174
1185
  it('Feb 3 - 2+ Option A & Feb 3 - 1 Option A', () => {
@@ -1300,6 +1311,8 @@ describe('getItemFamilyChanges', () => {
1300
1311
  const ifcs = pcd.itemFamilyChanges;
1301
1312
  expect(ifcs.size).toEqual(1);
1302
1313
  const ifc = ifcs.get(itemFamilyId);
1314
+ //TODO fix
1315
+ // expect(ifc.familyDelete).toBe(true);
1303
1316
  expect(ifc.colorAdds.length).toEqual(0);
1304
1317
  expect(ifc.colorDeletes.length).toEqual(1);
1305
1318
  });
@@ -1572,9 +1585,10 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1572
1585
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1573
1586
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1574
1587
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
1575
- .mockResolvedValueOnce(true)
1576
- .mockResolvedValueOnce(true);
1588
+ .mockResolvedValueOnce(true) // for family
1589
+ .mockResolvedValueOnce(true); // for SKU
1577
1590
  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
1578
1592
  expect(events).toHaveLength(2);
1579
1593
  const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
1580
1594
  expect(skuEvent.eventType).toBe('UPSERT_ON_SEASON');
@@ -1613,9 +1627,10 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1613
1627
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1614
1628
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1615
1629
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
1616
- .mockResolvedValueOnce(false)
1617
- .mockResolvedValueOnce(false);
1630
+ .mockResolvedValueOnce(false) // for family
1631
+ .mockResolvedValueOnce(false); // for SKU
1618
1632
  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
1619
1634
  expect(events).toHaveLength(2);
1620
1635
  const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
1621
1636
  expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
@@ -1654,6 +1669,7 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1654
1669
  jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
1655
1670
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
1656
1671
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
1672
+ // Product is creatable (true), SKU is not (false)
1657
1673
  jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
1658
1674
  .mockResolvedValueOnce(true)
1659
1675
  .mockResolvedValueOnce(false);
@@ -1664,7 +1680,9 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
1664
1680
  expect(productEvent.eventType).toBe('UPSERT_ON_SEASON');
1665
1681
  expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
1666
1682
  expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenCalledTimes(2);
1683
+ // Verify product event called with assortment entity
1667
1684
  expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(1, undefined, mapFileUtil, familyProjectItem, { item: prodEntityData, assortment });
1685
+ // Verify SKU event called with assortment entity
1668
1686
  expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(2, undefined, mapFileUtil, colorProjectItem, { item: itemData, assortment });
1669
1687
  });
1670
1688
  });
@@ -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) {
@@ -5,9 +5,45 @@ 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
+ */
8
17
  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
+ */
9
27
  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
+ */
10
37
  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
+ */
11
47
  static getSKUIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, itemObject: any, includeInformationKeys?: boolean): Promise<SkuFederation>;
12
48
  static getEntityCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
13
49
  static getAssortmentCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
@@ -5,6 +5,15 @@ 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
+ */
8
17
  static async getSeasonIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
9
18
  if (!assortment) {
10
19
  throw new Error('IdentifierConversion.getSeasonIdentityObject(): assortment must be provided.');
@@ -49,6 +58,15 @@ class IdentifierConversion {
49
58
  }
50
59
  return seasonObj;
51
60
  }
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
+ */
52
70
  static async getSeasonGroupIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
53
71
  if (!assortment) {
54
72
  throw new Error('IdentifierConversion.getSeasonGroupIdentityObject(): assortment must be provided.');
@@ -92,6 +110,15 @@ class IdentifierConversion {
92
110
  }
93
111
  return seasonGroupObj;
94
112
  }
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
+ */
95
122
  static async getProductIdentityObject(transformMapFile, mapFileUtil, dc, itemFamilyObject, includeInformationKeys = true) {
96
123
  if (!itemFamilyObject) {
97
124
  throw new Error('IdentifierConversion.getProductIdentityObject(): itemFamilyObject must be provided.');
@@ -129,6 +156,15 @@ class IdentifierConversion {
129
156
  .applyTransformMap(transformMapFile, mapFileUtil, prodObj, mapKey, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
130
157
  return prodObj;
131
158
  }
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
+ */
132
168
  static async getSKUIdentityObject(transformMapFile, mapFileUtil, dc, itemObject, includeInformationKeys = true) {
133
169
  if (!itemObject) {
134
170
  throw new Error('IdentifierConversion.getSKUIdentityObject(): itemObject must be provided.');
@@ -30,9 +30,11 @@ describe('getAssortmentFromObject', () => {
30
30
  entityValues[key] = value;
31
31
  }
32
32
  else if (Array.isArray(value)) {
33
+ //multi select
33
34
  entityValues[key] = value.map((v) => v.value);
34
35
  }
35
36
  else if (value.value) {
37
+ //single select
36
38
  entityValues[key] = value.value;
37
39
  }
38
40
  }
@@ -166,9 +168,11 @@ describe('getItemCriteriaFromObject', () => {
166
168
  entityValues[key] = value;
167
169
  }
168
170
  else if (Array.isArray(value)) {
171
+ //multi select
169
172
  entityValues[key] = value.map((v) => v.value);
170
173
  }
171
174
  else if (value.value) {
175
+ //single select
172
176
  entityValues[key] = value.value;
173
177
  }
174
178
  }
@@ -4,6 +4,5 @@ export declare class ConfigDefaults {
4
4
  static STATIC_CONFIG_CACHE: {};
5
5
  static setConfigDefaults(config: any): Promise<FCConfig>;
6
6
  static getConfigFile(fileId: string): Promise<any>;
7
- static isPropertyTrue(value: any): boolean;
8
7
  static clearConfigCache(): void;
9
8
  }
@@ -5,9 +5,11 @@ const sdk_1 = require("@contrail/sdk");
5
5
  const util_1 = require("@contrail/util");
6
6
  class ConfigDefaults {
7
7
  static async setConfigDefaults(config) {
8
+ //Validate config
8
9
  if (!config.apiHost || !config.userName || !config.password) {
9
10
  throw new Error(ConfigDefaults.NEED_CONFIG_VALUES);
10
11
  }
12
+ //List will be comma separated list in UI, so convert to array
11
13
  if (config?.itemPreDevelopmentLifecycleStages && !(config?.itemPreDevelopmentLifecycleStages instanceof Array)) {
12
14
  config.itemPreDevelopmentLifecycleStages = config.itemPreDevelopmentLifecycleStages.split(',');
13
15
  }
@@ -40,6 +42,7 @@ class ConfigDefaults {
40
42
  const pass = outputConfig.password;
41
43
  outputConfig.userName = () => uName;
42
44
  outputConfig.password = () => pass;
45
+ //Don't allow overwriting this.
43
46
  outputConfig['OOBvibeEventEndpoint'] = '/rfa/vibeiq/vibeEvents';
44
47
  console.log('outputConfig: ' + JSON.stringify(outputConfig));
45
48
  return outputConfig;
@@ -76,9 +79,6 @@ class ConfigDefaults {
76
79
  return {};
77
80
  }
78
81
  }
79
- static isPropertyTrue(value) {
80
- return value === true || (typeof value === 'string' && value.toLowerCase() === 'true');
81
- }
82
82
  static clearConfigCache() {
83
83
  ConfigDefaults.STATIC_CONFIG_CACHE = {};
84
84
  }
@@ -21,11 +21,13 @@ describe('all tests', () => {
21
21
  describe('setConfigDefaults - required values', () => {
22
22
  it('missing apiHost', async () => {
23
23
  const config = {
24
+ //apiHost: 'http://test.com',
24
25
  userName: 'vibeiq',
25
26
  password: 'vibeiq',
26
27
  plmEnviornment: 'SB'
27
28
  };
28
29
  try {
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
29
31
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
30
32
  }
31
33
  catch (e) {
@@ -35,10 +37,12 @@ describe('all tests', () => {
35
37
  it('missing userName', async () => {
36
38
  const config = {
37
39
  apiHost: 'http://test.com',
40
+ //userName: 'vibeiq',
38
41
  password: 'vibeiq',
39
42
  plmEnviornment: 'SB'
40
43
  };
41
44
  try {
45
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
42
46
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
43
47
  }
44
48
  catch (e) {
@@ -49,9 +53,11 @@ describe('all tests', () => {
49
53
  const config = {
50
54
  apiHost: 'http://test.com',
51
55
  userName: 'vibeiq',
56
+ //password: 'vibeiq',
52
57
  plmEnviornment: 'SB'
53
58
  };
54
59
  try {
60
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
55
61
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
56
62
  }
57
63
  catch (e) {
@@ -63,8 +69,10 @@ describe('all tests', () => {
63
69
  apiHost: 'http://test.com',
64
70
  userName: 'vibeiq',
65
71
  password: 'vibeiq',
72
+ //plmEnviornment: 'SB'
66
73
  };
67
74
  try {
75
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
68
76
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
69
77
  }
70
78
  catch (e) {
@@ -215,6 +223,7 @@ describe('all tests', () => {
215
223
  const startConfig = Object.assign({}, config);
216
224
  const objectClass = 'LCSSeason';
217
225
  const expectedAtts = ['flexPLMSeasonName'];
226
+ // const expectedAtts =['seasonType', 'seasonYear'];
218
227
  const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(startConfig);
219
228
  const identifierAtts = fcConfig.identifierAtts[objectClass];
220
229
  expect(identifierAtts instanceof Array).toBeTruthy();
@@ -264,38 +273,6 @@ describe('all tests', () => {
264
273
  }
265
274
  });
266
275
  });
267
- describe('isPropertyTrue', () => {
268
- it('returns true for boolean true', () => {
269
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue(true)).toBe(true);
270
- });
271
- it('returns true for string true', () => {
272
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue('true')).toBe(true);
273
- });
274
- it('returns true for string TRUE', () => {
275
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue('TRUE')).toBe(true);
276
- });
277
- it('returns true for string True', () => {
278
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue('True')).toBe(true);
279
- });
280
- it('returns false for boolean false', () => {
281
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue(false)).toBe(false);
282
- });
283
- it('returns false for string false', () => {
284
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue('false')).toBe(false);
285
- });
286
- it('returns false for null', () => {
287
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue(null)).toBe(false);
288
- });
289
- it('returns false for undefined', () => {
290
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue(undefined)).toBe(false);
291
- });
292
- it('returns false for empty string', () => {
293
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue('')).toBe(false);
294
- });
295
- it('returns false for number 1', () => {
296
- expect(config_defaults_1.ConfigDefaults.isPropertyTrue(1)).toBe(false);
297
- });
298
- });
299
276
  describe('getConfigFile', () => {
300
277
  beforeEach(() => {
301
278
  config_defaults_1.ConfigDefaults.clearConfigCache();
@@ -31,12 +31,26 @@ 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
  LCSProduct: {
36
50
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
37
51
  vibe2flex: {
38
52
  getClass: () => 'LCSProduct',
39
- getSoftType: (entity) => {
53
+ getSoftType: (entity /*, dependencies*/) => {
40
54
  const prodType = entity['prodType'];
41
55
  let val = '';
42
56
  switch (prodType) {
@@ -61,7 +75,7 @@ exports.mapping = {
61
75
  vibeIQIdentifier: 'itemNumber'
62
76
  },
63
77
  valueTransform: {
64
- transformEx: (row) => {
78
+ transformEx: (row /*, dependencies*/) => {
65
79
  return row['otherProp'] + 'xxx';
66
80
  }
67
81
  }
@@ -79,7 +93,7 @@ exports.mapping = {
79
93
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
80
94
  vibe2flex: {
81
95
  getClass: () => 'LCSSKU',
82
- getSoftType: (entity) => {
96
+ getSoftType: (entity /*, dependencies*/) => {
83
97
  const prodType = entity['prodType'];
84
98
  let val = '';
85
99
  switch (prodType) {