@contrail/flexplm 1.3.0-alpha.ccc03be → 1.3.1-alpha.3e8dbdd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/commands/compile.d.ts +1 -0
- package/lib/cli/commands/compile.js +71 -0
- package/lib/cli/commands/compile.spec.d.ts +1 -0
- package/lib/cli/commands/compile.spec.js +80 -0
- package/lib/cli/commands/create.d.ts +1 -0
- package/lib/cli/commands/create.js +75 -0
- package/lib/cli/commands/create.spec.d.ts +1 -0
- package/lib/cli/commands/create.spec.js +78 -0
- package/lib/cli/commands/upload.d.ts +10 -0
- package/lib/cli/commands/upload.js +226 -0
- package/lib/cli/commands/upload.spec.d.ts +1 -0
- package/lib/cli/commands/upload.spec.js +88 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +64 -0
- package/lib/cli/index.spec.d.ts +1 -0
- package/lib/cli/index.spec.js +79 -0
- package/lib/cli/template/mapping-template.ts.template +62 -0
- package/lib/entity-processor/base-entity-processor.d.ts +47 -0
- package/lib/entity-processor/base-entity-processor.js +53 -0
- package/lib/entity-processor/base-entity-processor.spec.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/interfaces/mapping-file.d.ts +460 -0
- package/lib/interfaces/mapping-file.js +2 -0
- package/lib/publish/base-process-publish-assortment.d.ts +25 -0
- package/lib/publish/base-process-publish-assortment.js +60 -6
- package/lib/publish/base-process-publish-assortment.spec.js +22 -4
- package/lib/publish/mockData.js +5 -0
- package/lib/transform/identifier-conversion-spec-mockData.js +34 -6
- package/lib/transform/identifier-conversion.d.ts +36 -0
- package/lib/transform/identifier-conversion.js +36 -0
- package/lib/transform/identifier-conversion.spec.js +4 -0
- package/lib/util/config-defaults.js +3 -0
- package/lib/util/config-defaults.spec.js +9 -0
- package/lib/util/data-converter-spec-mockData.js +17 -3
- package/lib/util/data-converter.d.ts +97 -0
- package/lib/util/data-converter.js +127 -1
- package/lib/util/data-converter.spec.js +2 -0
- package/lib/util/error-response-object.d.ts +5 -0
- package/lib/util/error-response-object.js +7 -0
- package/lib/util/event-short-message-status.js +1 -0
- package/lib/util/federation.js +8 -0
- package/lib/util/flexplm-connect.d.ts +7 -0
- package/lib/util/flexplm-connect.js +14 -0
- package/lib/util/logger-config.js +1 -0
- package/lib/util/map-util-spec-mockData.js +17 -3
- package/lib/util/map-utils.d.ts +27 -0
- package/lib/util/map-utils.js +27 -0
- package/lib/util/thumbnail-util.d.ts +21 -0
- package/lib/util/thumbnail-util.js +28 -1
- package/lib/util/thumbnail-util.spec.js +6 -0
- package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
- package/lib/util/type-conversion-utils.d.ts +140 -0
- package/lib/util/type-conversion-utils.js +143 -0
- package/lib/util/type-defaults.d.ts +58 -0
- package/lib/util/type-defaults.js +58 -0
- package/lib/util/type-defaults.spec.js +5 -5
- package/lib/util/type-utils.d.ts +21 -0
- package/lib/util/type-utils.js +23 -0
- package/lib/util/type-utils.spec.js +2 -0
- package/package.json +21 -6
- package/scripts/copy-template.js +10 -0
- package/.github/pull_request_template.md +0 -31
- package/.github/workflows/flexplm-lib.yml +0 -27
- package/.github/workflows/publish-to-npm.yml +0 -121
- package/CHANGELOG.md +0 -32
- package/publish.bat +0 -5
- package/publish.sh +0 -5
- package/src/entity-processor/base-entity-processor.spec.ts +0 -460
- package/src/entity-processor/base-entity-processor.ts +0 -515
- package/src/flexplm-request.ts +0 -28
- package/src/flexplm-utils.spec.ts +0 -27
- package/src/flexplm-utils.ts +0 -29
- package/src/index.ts +0 -22
- package/src/interfaces/interfaces.ts +0 -122
- package/src/interfaces/item-family-changes.ts +0 -67
- package/src/interfaces/publish-change-data.ts +0 -43
- package/src/publish/base-process-publish-assortment-callback.ts +0 -50
- package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
- package/src/publish/base-process-publish-assortment.ts +0 -1134
- package/src/publish/mockData.ts +0 -4561
- package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
- package/src/transform/identifier-conversion.spec.ts +0 -354
- package/src/transform/identifier-conversion.ts +0 -282
- package/src/util/config-defaults.spec.ts +0 -350
- package/src/util/config-defaults.ts +0 -93
- package/src/util/data-converter-spec-mockData.ts +0 -231
- package/src/util/data-converter.spec.ts +0 -1041
- package/src/util/data-converter.ts +0 -762
- package/src/util/error-response-object.spec.ts +0 -116
- package/src/util/error-response-object.ts +0 -50
- package/src/util/event-short-message-status.ts +0 -22
- package/src/util/federation.ts +0 -172
- package/src/util/flexplm-connect.spec.ts +0 -132
- package/src/util/flexplm-connect.ts +0 -208
- package/src/util/logger-config.ts +0 -20
- package/src/util/map-util-spec-mockData.ts +0 -231
- package/src/util/map-utils.spec.ts +0 -103
- package/src/util/map-utils.ts +0 -41
- package/src/util/mockData.ts +0 -101
- package/src/util/thumbnail-util.spec.ts +0 -508
- package/src/util/thumbnail-util.ts +0 -272
- package/src/util/type-conversion-utils-spec-mockData.ts +0 -271
- package/src/util/type-conversion-utils.spec.ts +0 -968
- package/src/util/type-conversion-utils.ts +0 -460
- package/src/util/type-defaults.spec.ts +0 -669
- package/src/util/type-defaults.ts +0 -281
- package/src/util/type-utils.spec.ts +0 -227
- package/src/util/type-utils.ts +0 -144
- package/tsconfig.json +0 -24
- package/tslint.json +0 -57
|
@@ -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
|
});
|
package/lib/publish/mockData.js
CHANGED
|
@@ -3399,6 +3399,11 @@ exports.fall_2003_fedMapping = [
|
|
|
3399
3399
|
mappedReference: 'VR:com.lcs.wc.product.LCSSKU:372509'
|
|
3400
3400
|
}
|
|
3401
3401
|
];
|
|
3402
|
+
//SYHfQzYWlfXDqK7r - 4 adds
|
|
3403
|
+
//JreGRNvoJ3FsoRZI - 1 delete
|
|
3404
|
+
//NaPUhAdEzKB-5tQ3 - no changes
|
|
3405
|
+
//CHGKSCT358qyh1Nu - 1 delete
|
|
3406
|
+
//H4L4dHziO6WZRIwa - re-add from JreGRNvoJ3FsoRZI
|
|
3402
3407
|
exports.apc_2bOWR2j9R0QThDVu_delete_history = [
|
|
3403
3408
|
{
|
|
3404
3409
|
adds: 4,
|
|
@@ -31,6 +31,20 @@ exports.mapping = {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
// flex2vibe: {
|
|
35
|
+
// LCSRevisableEntity: {
|
|
36
|
+
// getMapKey: (object) =>{ return object;}
|
|
37
|
+
// },
|
|
38
|
+
// LCSLast: {
|
|
39
|
+
// getMapKey: (object) => {return object;}
|
|
40
|
+
// },
|
|
41
|
+
// LCSMaterial: {
|
|
42
|
+
// getMapKey: (object) =>{ return object;}
|
|
43
|
+
// },
|
|
44
|
+
// LCSBusinessObject: {
|
|
45
|
+
// getMapKey: (object) => {return object;}
|
|
46
|
+
// }
|
|
47
|
+
// },
|
|
34
48
|
},
|
|
35
49
|
LCSSeason: {
|
|
36
50
|
vibe2flex: {
|
|
@@ -54,7 +68,7 @@ exports.mapping = {
|
|
|
54
68
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
55
69
|
vibe2flex: {
|
|
56
70
|
getClass: () => 'LCSProduct',
|
|
57
|
-
getSoftType: (entity) => {
|
|
71
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
58
72
|
const prodType = entity['prodType'];
|
|
59
73
|
let val = '';
|
|
60
74
|
switch (prodType) {
|
|
@@ -79,7 +93,7 @@ exports.mapping = {
|
|
|
79
93
|
vibeIQIdentifier: 'itemNumber'
|
|
80
94
|
},
|
|
81
95
|
valueTransform: {
|
|
82
|
-
transformEx: (row) => {
|
|
96
|
+
transformEx: (row /*, dependencies*/) => {
|
|
83
97
|
return row['otherProp'] + 'xxx';
|
|
84
98
|
}
|
|
85
99
|
}
|
|
@@ -97,7 +111,7 @@ exports.mapping = {
|
|
|
97
111
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
98
112
|
vibe2flex: {
|
|
99
113
|
getClass: () => 'LCSSKU',
|
|
100
|
-
getSoftType: (entity) => {
|
|
114
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
101
115
|
const prodType = entity['prodType'];
|
|
102
116
|
let val = '';
|
|
103
117
|
switch (prodType) {
|
|
@@ -252,6 +266,20 @@ exports.mapping2 = {
|
|
|
252
266
|
}
|
|
253
267
|
}
|
|
254
268
|
}
|
|
269
|
+
// flex2vibe: {
|
|
270
|
+
// LCSRevisableEntity: {
|
|
271
|
+
// getMapKey: (object) =>{ return object;}
|
|
272
|
+
// },
|
|
273
|
+
// LCSLast: {
|
|
274
|
+
// getMapKey: (object) => {return object;}
|
|
275
|
+
// },
|
|
276
|
+
// LCSMaterial: {
|
|
277
|
+
// getMapKey: (object) =>{ return object;}
|
|
278
|
+
// },
|
|
279
|
+
// LCSBusinessObject: {
|
|
280
|
+
// getMapKey: (object) => {return object;}
|
|
281
|
+
// }
|
|
282
|
+
// },
|
|
255
283
|
},
|
|
256
284
|
LCSSeason: {
|
|
257
285
|
getIdentifierProperties: () => ['brand', 'year', 'seasonType'],
|
|
@@ -274,7 +302,7 @@ exports.mapping2 = {
|
|
|
274
302
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
275
303
|
vibe2flex: {
|
|
276
304
|
getClass: () => 'LCSProduct',
|
|
277
|
-
getSoftType: (entity) => {
|
|
305
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
278
306
|
const prodType = entity['prodType'];
|
|
279
307
|
let val = '';
|
|
280
308
|
switch (prodType) {
|
|
@@ -299,7 +327,7 @@ exports.mapping2 = {
|
|
|
299
327
|
vibeIQIdentifier: 'itemNumber'
|
|
300
328
|
},
|
|
301
329
|
valueTransform: {
|
|
302
|
-
transformEx: (row) => {
|
|
330
|
+
transformEx: (row /*, dependencies*/) => {
|
|
303
331
|
return row['otherProp'] + 'xxx';
|
|
304
332
|
}
|
|
305
333
|
}
|
|
@@ -318,7 +346,7 @@ exports.mapping2 = {
|
|
|
318
346
|
getIdentifierProperties: () => ['uniqueIdentifierA', 'uniqueIdentifierB'],
|
|
319
347
|
vibe2flex: {
|
|
320
348
|
getClass: () => 'LCSSKU',
|
|
321
|
-
getSoftType: (entity) => {
|
|
349
|
+
getSoftType: (entity /*, dependencies*/) => {
|
|
322
350
|
const prodType = entity['prodType'];
|
|
323
351
|
let val = '';
|
|
324
352
|
switch (prodType) {
|
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -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();
|
|
@@ -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) {
|
|
@@ -19,21 +19,118 @@ export declare class DataConverter {
|
|
|
19
19
|
getFlexPLMObjectDataFromEvent(event: any, dataToSkip: string[]): Promise<{}>;
|
|
20
20
|
getFlexPLMObjectData(newData: any, dataToSkip: string[], inflateObjRef: boolean): Promise<{}>;
|
|
21
21
|
getFlexPLMValue(prop: any, newData: any, inflateObjRef: boolean): Promise<any>;
|
|
22
|
+
/** Returns the display values for list properties (choice & multi_select)
|
|
23
|
+
*
|
|
24
|
+
* @param prop
|
|
25
|
+
* @param newData
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
22
28
|
getEnumerationValue(prop: any, nd: any): any;
|
|
23
29
|
getObjectReferenceValue(prop: any, newData: any, inflateObjRef?: boolean): Promise<any>;
|
|
30
|
+
/** (Deprecated) Use TypeConversionUtils.getMapKey()
|
|
31
|
+
* Will return the class to use to get mapping.
|
|
32
|
+
* This is needed because mappings will be different for different sub types
|
|
33
|
+
* of custom-entity
|
|
34
|
+
*
|
|
35
|
+
* @param obj: Entity being checked
|
|
36
|
+
* @param mapping: The whole mapping file
|
|
37
|
+
*/
|
|
24
38
|
getMappingClass(entity: object, mapping: any): string;
|
|
39
|
+
/** Sets entity values from FlexPLM data passed in
|
|
40
|
+
* Assumes the entity has a VibeIQ typeId and 'roles' value to filter if necessary.
|
|
41
|
+
* @param entity the entity to update
|
|
42
|
+
* @param data the FlexPLM data
|
|
43
|
+
* @param keysToSkip properties to skip
|
|
44
|
+
* @returns the modified entity with VibeIQ values
|
|
45
|
+
*/
|
|
25
46
|
setEntityValues(entity: any, data: any, keysToSkip?: string[]): Promise<any>;
|
|
47
|
+
/** Gets the entity values from FlexPLM data
|
|
48
|
+
* Assumes there isn't a VibeIQ typeId, so uses FlexPLM data to determine type
|
|
49
|
+
* @param objectClass FlexPLM object class
|
|
50
|
+
* @param data object data
|
|
51
|
+
* @param keysToSkip type properties to not process
|
|
52
|
+
* @returns object with VibeIQ values
|
|
53
|
+
*/
|
|
26
54
|
getEntityValues(objectClass: string, data: any, keysToSkip?: string[]): Promise<{}>;
|
|
55
|
+
/** Gets the VibeIQ value for the property from data
|
|
56
|
+
*
|
|
57
|
+
* @param prop the VibeIQ property
|
|
58
|
+
* @param data the FlexPLM data
|
|
59
|
+
* @returns value to be set in VibeIQ
|
|
60
|
+
*/
|
|
27
61
|
getEntityValue(prop: any, data: any): Promise<any>;
|
|
28
62
|
setEnumerationKeys(prop: any, nd: any, matchByDisplay: any): any;
|
|
63
|
+
/** Compares the potential changes to the entity and returns only the actual differences.
|
|
64
|
+
*
|
|
65
|
+
* @param entity the full entity
|
|
66
|
+
* @param changes the potential changes
|
|
67
|
+
* @returns only the change values that are different from the entity's value
|
|
68
|
+
*/
|
|
29
69
|
getPersistableChanges(entity: object, changes: object): object;
|
|
70
|
+
/** Sets object reference value from FlexPLM data passed in
|
|
71
|
+
*
|
|
72
|
+
* @param prop the VibeIQ property
|
|
73
|
+
* @param nd the VibeIQ data
|
|
74
|
+
* @returns the object reference id from VibeIQ
|
|
75
|
+
*/
|
|
30
76
|
setObjectReferenceValue(prop: any, nd: any): Promise<any>;
|
|
77
|
+
/**
|
|
78
|
+
* Retrieves all object references of a specified entity type based on the provided criteria.
|
|
79
|
+
* This function handles pagination and asynchronously fetches object references until there are no more pages.
|
|
80
|
+
* @param {string} entityType - The type of entity for which object references are to be retrieved.
|
|
81
|
+
* @param {object} rootTypeCriteria - The criteria used to filter object references.
|
|
82
|
+
* @returns {Promise<Array>} A Promise that resolves to an array containing all object references.
|
|
83
|
+
*/
|
|
31
84
|
getAllObjectReferences(entityType: string, rootTypeCriteria: any, postProcessCriteria?: any): Promise<any[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Checks if all keys and values of a given object are present in an array of objects.
|
|
87
|
+
* @param {Object} criteria - The object whose keys and values are to be checked in the array of objects.
|
|
88
|
+
* @param {Array<Object>} arrayOfObjects - The array of objects to be searched for matching keys and values.
|
|
89
|
+
* @param {string} entityTypePath - The type / subtype for the property; objects must be this type or a sub type of it.
|
|
90
|
+
* @returns {(Object|boolean)} Returns the array of objects that matches all keys and values of the provided object.
|
|
91
|
+
* If no match is found, returns empty array.
|
|
92
|
+
*/
|
|
32
93
|
checkKeysAndValues(criteria: any, arrayOfObjects: any, entityTypePath: any): any[];
|
|
94
|
+
/** Filters out archived and trashed entities from the provided array of entities.
|
|
95
|
+
*
|
|
96
|
+
* @param entities
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
33
99
|
filterOutArchivedAndTrashedEntities(entities: any[]): any[];
|
|
100
|
+
/** Sets userListId value from FlexPLM data passed in
|
|
101
|
+
*
|
|
102
|
+
* @param prop the VibeIQ property
|
|
103
|
+
* @param nd the VibeIQ data
|
|
104
|
+
* @returns the modified entity with FlexPLM values
|
|
105
|
+
*/
|
|
34
106
|
setUserListValue(prop: any, nd: any): Promise<any>;
|
|
107
|
+
/** Makes batch calls of 1000 of user-org entities until
|
|
108
|
+
* it find one with userEmail of passed in nd.email.
|
|
109
|
+
* Maxes out after querying for 15,000 user-org entities
|
|
110
|
+
*
|
|
111
|
+
* @param nd
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
35
114
|
getUserByEmail(nd: any): Promise<any>;
|
|
115
|
+
/** Shows warning if user email address not present in group associated to property
|
|
116
|
+
*
|
|
117
|
+
* @param prop the VibeIQ property
|
|
118
|
+
* @param userEmail user email address
|
|
119
|
+
*/
|
|
36
120
|
processGroupMemberCheck(prop: any, userEmail: any): Promise<void>;
|
|
121
|
+
/** Gets the VibeIQ value for the userList property from data
|
|
122
|
+
*
|
|
123
|
+
* @param prop the VibeIQ property
|
|
124
|
+
* @param newData the FlexPLM data
|
|
125
|
+
* @returns value to be set in VibeIQ
|
|
126
|
+
*/
|
|
37
127
|
getUserListValue(prop: any, newData: any): Promise<any>;
|
|
128
|
+
/** Makes batch calls of 1000 of user-org entities until
|
|
129
|
+
* it find one with user.id of passed in userId.
|
|
130
|
+
* Maxes out after querying for 15,000 user-org entities
|
|
131
|
+
*
|
|
132
|
+
* @param userId
|
|
133
|
+
* @returns
|
|
134
|
+
*/
|
|
38
135
|
getUserById(userId: any): Promise<any>;
|
|
39
136
|
}
|