@contrail/flexplm 1.3.1-alpha.7db7b62 → 1.3.1-alpha.8bc920d
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/.github/pull_request_template.md +31 -0
- package/.github/workflows/flexplm-lib.yml +27 -0
- package/.github/workflows/publish-to-npm.yml +121 -0
- package/CHANGELOG.md +32 -0
- package/lib/entity-processor/base-entity-processor.d.ts +0 -47
- package/lib/entity-processor/base-entity-processor.js +0 -53
- package/lib/entity-processor/base-entity-processor.spec.js +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/publish/base-process-publish-assortment.d.ts +0 -25
- package/lib/publish/base-process-publish-assortment.js +6 -60
- package/lib/publish/base-process-publish-assortment.spec.js +4 -22
- package/lib/publish/mockData.js +0 -5
- package/lib/transform/identifier-conversion-spec-mockData.js +6 -34
- package/lib/transform/identifier-conversion.d.ts +0 -36
- package/lib/transform/identifier-conversion.js +0 -36
- package/lib/transform/identifier-conversion.spec.js +0 -4
- package/lib/util/config-defaults.js +0 -3
- package/lib/util/config-defaults.spec.js +0 -9
- package/lib/util/data-converter-spec-mockData.js +3 -17
- package/lib/util/data-converter.d.ts +0 -97
- package/lib/util/data-converter.js +4 -127
- package/lib/util/data-converter.spec.js +0 -2
- package/lib/util/error-response-object.d.ts +0 -5
- package/lib/util/error-response-object.js +0 -7
- package/lib/util/event-short-message-status.js +0 -1
- package/lib/util/federation.js +0 -8
- package/lib/util/flexplm-connect.d.ts +0 -7
- package/lib/util/flexplm-connect.js +0 -14
- package/lib/util/logger-config.js +0 -1
- package/lib/util/map-util-spec-mockData.js +3 -17
- package/lib/util/map-utils.d.ts +0 -27
- package/lib/util/map-utils.js +0 -27
- package/lib/util/thumbnail-util.d.ts +0 -21
- package/lib/util/thumbnail-util.js +1 -28
- package/lib/util/thumbnail-util.spec.js +0 -6
- package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
- package/lib/util/type-conversion-utils.d.ts +0 -139
- package/lib/util/type-conversion-utils.js +0 -140
- package/lib/util/type-defaults.d.ts +0 -58
- package/lib/util/type-defaults.js +0 -58
- package/lib/util/type-defaults.spec.js +5 -5
- package/lib/util/type-utils.d.ts +0 -21
- package/lib/util/type-utils.js +0 -23
- package/lib/util/type-utils.spec.js +0 -2
- package/package.json +6 -21
- package/publish.bat +5 -0
- package/publish.sh +5 -0
- package/src/entity-processor/base-entity-processor.spec.ts +460 -0
- package/src/entity-processor/base-entity-processor.ts +515 -0
- package/src/flexplm-request.ts +28 -0
- package/src/flexplm-utils.spec.ts +27 -0
- package/src/flexplm-utils.ts +29 -0
- package/src/index.ts +22 -0
- package/src/interfaces/interfaces.ts +122 -0
- package/src/interfaces/item-family-changes.ts +67 -0
- package/src/interfaces/publish-change-data.ts +43 -0
- package/src/publish/base-process-publish-assortment-callback.ts +50 -0
- package/src/publish/base-process-publish-assortment.spec.ts +1992 -0
- package/src/publish/base-process-publish-assortment.ts +1134 -0
- package/src/publish/mockData.ts +4561 -0
- package/src/transform/identifier-conversion-spec-mockData.ts +496 -0
- package/src/transform/identifier-conversion.spec.ts +354 -0
- package/src/transform/identifier-conversion.ts +282 -0
- package/src/util/config-defaults.spec.ts +350 -0
- package/src/util/config-defaults.ts +93 -0
- package/src/util/data-converter-spec-mockData.ts +231 -0
- package/src/util/data-converter.spec.ts +1041 -0
- package/src/util/data-converter.ts +764 -0
- package/src/util/error-response-object.spec.ts +116 -0
- package/src/util/error-response-object.ts +50 -0
- package/src/util/event-short-message-status.ts +22 -0
- package/src/util/federation.ts +172 -0
- package/src/util/flexplm-connect.spec.ts +132 -0
- package/src/util/flexplm-connect.ts +208 -0
- package/src/util/logger-config.ts +20 -0
- package/src/util/map-util-spec-mockData.ts +231 -0
- package/src/util/map-utils.spec.ts +103 -0
- package/src/util/map-utils.ts +41 -0
- package/src/util/mockData.ts +101 -0
- package/src/util/thumbnail-util.spec.ts +508 -0
- package/src/util/thumbnail-util.ts +272 -0
- package/src/util/type-conversion-utils-spec-mockData.ts +271 -0
- package/src/util/type-conversion-utils.spec.ts +968 -0
- package/src/util/type-conversion-utils.ts +460 -0
- package/src/util/type-defaults.spec.ts +669 -0
- package/src/util/type-defaults.ts +281 -0
- package/src/util/type-utils.spec.ts +227 -0
- package/src/util/type-utils.ts +144 -0
- package/tsconfig.json +24 -0
- package/tslint.json +57 -0
- package/lib/cli/commands/compile.d.ts +0 -1
- package/lib/cli/commands/compile.js +0 -71
- package/lib/cli/commands/create.d.ts +0 -1
- package/lib/cli/commands/create.js +0 -75
- package/lib/cli/commands/upload.d.ts +0 -1
- package/lib/cli/commands/upload.js +0 -217
- package/lib/cli/index.d.ts +0 -2
- package/lib/cli/index.js +0 -60
- package/lib/cli/template/mapping-template.ts.template +0 -18
- package/lib/interfaces/mapping-file.d.ts +0 -429
- package/lib/interfaces/mapping-file.js +0 -2
- package/scripts/copy-template.js +0 -10
|
@@ -13,7 +13,6 @@ let federatedId = '';
|
|
|
13
13
|
jest.mock('../util/data-converter', () => {
|
|
14
14
|
return {
|
|
15
15
|
DataConverter: class {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
|
|
17
16
|
getFlexPLMObjectData(newData, dataToSkip, inflateObjRef) {
|
|
18
17
|
return newData;
|
|
19
18
|
}
|
|
@@ -96,7 +95,6 @@ describe('getPublishInfo', () => {
|
|
|
96
95
|
return { id: assortmentId, name: assortmentName };
|
|
97
96
|
});
|
|
98
97
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
99
|
-
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
100
98
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
101
99
|
return versionHistoryNumber;
|
|
102
100
|
});
|
|
@@ -122,7 +120,6 @@ describe('getPublishInfo', () => {
|
|
|
122
120
|
return { id: assortmentId, name: undefined };
|
|
123
121
|
});
|
|
124
122
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
125
|
-
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
126
123
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
127
124
|
return versionHistoryNumber;
|
|
128
125
|
});
|
|
@@ -148,7 +145,6 @@ describe('getPublishInfo', () => {
|
|
|
148
145
|
return undefined;
|
|
149
146
|
});
|
|
150
147
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
151
|
-
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
152
148
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
153
149
|
return versionHistoryNumber;
|
|
154
150
|
});
|
|
@@ -183,7 +179,6 @@ describe('getPublishInfo', () => {
|
|
|
183
179
|
return { id: assortmentId, name: assortmentName };
|
|
184
180
|
});
|
|
185
181
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
186
|
-
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
187
182
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
188
183
|
return versionHistoryNumber;
|
|
189
184
|
});
|
|
@@ -208,7 +203,6 @@ describe('getPublishInfo', () => {
|
|
|
208
203
|
return { id: assortmentId, name: assortmentName };
|
|
209
204
|
});
|
|
210
205
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
211
|
-
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
212
206
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
213
207
|
return versionHistoryNumber;
|
|
214
208
|
});
|
|
@@ -235,7 +229,6 @@ describe('getPublishInfo', () => {
|
|
|
235
229
|
return { id: assortmentId, name: assortmentName };
|
|
236
230
|
});
|
|
237
231
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
238
|
-
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
239
232
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
240
233
|
return versionHistoryNumber;
|
|
241
234
|
});
|
|
@@ -262,7 +255,6 @@ describe('getPublishInfo', () => {
|
|
|
262
255
|
return { id: assortmentId, name: assortmentName };
|
|
263
256
|
});
|
|
264
257
|
const spyyGetSnapshotVersion = jest.spyOn(ppa, 'getSnapshotVersion')
|
|
265
|
-
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
266
258
|
.mockImplementation(async (assortmentId, assortmentPublishChangeId) => {
|
|
267
259
|
return versionHistoryNumber;
|
|
268
260
|
});
|
|
@@ -416,7 +408,6 @@ describe('getSnapshotVersion', () => {
|
|
|
416
408
|
{
|
|
417
409
|
id: 'qewrwer',
|
|
418
410
|
assortmentChangeId: 'bad-id',
|
|
419
|
-
// createdOn: '2023-01-14T19:13:58.902Z',
|
|
420
411
|
versionNumber
|
|
421
412
|
}
|
|
422
413
|
];
|
|
@@ -1149,7 +1140,6 @@ describe('getItemFamilyChanges', () => {
|
|
|
1149
1140
|
const ifcs = pcd.itemFamilyChanges;
|
|
1150
1141
|
expect(ifcs.size).toEqual(1);
|
|
1151
1142
|
const ifc = ifcs.get(itemFamilyId);
|
|
1152
|
-
// expect(ifc.familyAdd).toBe(true);
|
|
1153
1143
|
expect(ifc.colorAdds.length).toEqual(1);
|
|
1154
1144
|
});
|
|
1155
1145
|
it('Feb 3 - 2+ Option A', () => {
|
|
@@ -1179,7 +1169,6 @@ describe('getItemFamilyChanges', () => {
|
|
|
1179
1169
|
const ifcs = pcd.itemFamilyChanges;
|
|
1180
1170
|
expect(ifcs.size).toEqual(1);
|
|
1181
1171
|
const ifc = ifcs.get(itemFamilyId);
|
|
1182
|
-
// expect(ifc.familyAdd).toBe(true);
|
|
1183
1172
|
expect(ifc.colorAdds.length).toEqual(2);
|
|
1184
1173
|
});
|
|
1185
1174
|
it('Feb 3 - 2+ Option A & Feb 3 - 1 Option A', () => {
|
|
@@ -1311,8 +1300,6 @@ describe('getItemFamilyChanges', () => {
|
|
|
1311
1300
|
const ifcs = pcd.itemFamilyChanges;
|
|
1312
1301
|
expect(ifcs.size).toEqual(1);
|
|
1313
1302
|
const ifc = ifcs.get(itemFamilyId);
|
|
1314
|
-
//TODO fix
|
|
1315
|
-
// expect(ifc.familyDelete).toBe(true);
|
|
1316
1303
|
expect(ifc.colorAdds.length).toEqual(0);
|
|
1317
1304
|
expect(ifc.colorDeletes.length).toEqual(1);
|
|
1318
1305
|
});
|
|
@@ -1585,10 +1572,9 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1585
1572
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
|
|
1586
1573
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
|
|
1587
1574
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
|
|
1588
|
-
.mockResolvedValueOnce(true)
|
|
1589
|
-
.mockResolvedValueOnce(true);
|
|
1575
|
+
.mockResolvedValueOnce(true)
|
|
1576
|
+
.mockResolvedValueOnce(true);
|
|
1590
1577
|
const events = await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
|
|
1591
|
-
// Should have both family and SKU events because familyAssortmentItem is true when colorAdds.length > 0
|
|
1592
1578
|
expect(events).toHaveLength(2);
|
|
1593
1579
|
const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
|
|
1594
1580
|
expect(skuEvent.eventType).toBe('UPSERT_ON_SEASON');
|
|
@@ -1627,10 +1613,9 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1627
1613
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
|
|
1628
1614
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
|
|
1629
1615
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
|
|
1630
|
-
.mockResolvedValueOnce(false)
|
|
1631
|
-
.mockResolvedValueOnce(false);
|
|
1616
|
+
.mockResolvedValueOnce(false)
|
|
1617
|
+
.mockResolvedValueOnce(false);
|
|
1632
1618
|
const events = await bppa.getEventsForItemFamilyChanges(itemFamilyChanges, 'assort123', seasonFed, new Map());
|
|
1633
|
-
// Should have both family and SKU events because familyAssortmentItem is true when colorUpdates.length > 0
|
|
1634
1619
|
expect(events).toHaveLength(2);
|
|
1635
1620
|
const skuEvent = events.find(e => e.objectClass === 'LCSSKUSeasonLink');
|
|
1636
1621
|
expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
|
|
@@ -1669,7 +1654,6 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1669
1654
|
jest.spyOn(map_utils_1.MapUtil, 'applyTransformMap').mockResolvedValue({ transformedData: 'value' });
|
|
1670
1655
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getIdentifierProperties').mockResolvedValue(['identifier']);
|
|
1671
1656
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'getInformationalProperties').mockResolvedValue([]);
|
|
1672
|
-
// Product is creatable (true), SKU is not (false)
|
|
1673
1657
|
jest.spyOn(type_conversion_utils_1.TypeConversionUtils, 'isOutboundCreatableFromEntity')
|
|
1674
1658
|
.mockResolvedValueOnce(true)
|
|
1675
1659
|
.mockResolvedValueOnce(false);
|
|
@@ -1680,9 +1664,7 @@ describe('getEventsForItemFamilyChanges - conditional eventType', () => {
|
|
|
1680
1664
|
expect(productEvent.eventType).toBe('UPSERT_ON_SEASON');
|
|
1681
1665
|
expect(skuEvent.eventType).toBe('UPDATE_ON_SEASON');
|
|
1682
1666
|
expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenCalledTimes(2);
|
|
1683
|
-
// Verify product event called with assortment entity
|
|
1684
1667
|
expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(1, undefined, mapFileUtil, familyProjectItem, { item: prodEntityData, assortment });
|
|
1685
|
-
// Verify SKU event called with assortment entity
|
|
1686
1668
|
expect(type_conversion_utils_1.TypeConversionUtils.isOutboundCreatableFromEntity).toHaveBeenNthCalledWith(2, undefined, mapFileUtil, colorProjectItem, { item: itemData, assortment });
|
|
1687
1669
|
});
|
|
1688
1670
|
});
|
package/lib/publish/mockData.js
CHANGED
|
@@ -3399,11 +3399,6 @@ exports.fall_2003_fedMapping = [
|
|
|
3399
3399
|
mappedReference: 'VR:com.lcs.wc.product.LCSSKU:372509'
|
|
3400
3400
|
}
|
|
3401
3401
|
];
|
|
3402
|
-
//SYHfQzYWlfXDqK7r - 4 adds
|
|
3403
|
-
//JreGRNvoJ3FsoRZI - 1 delete
|
|
3404
|
-
//NaPUhAdEzKB-5tQ3 - no changes
|
|
3405
|
-
//CHGKSCT358qyh1Nu - 1 delete
|
|
3406
|
-
//H4L4dHziO6WZRIwa - re-add from JreGRNvoJ3FsoRZI
|
|
3407
3402
|
exports.apc_2bOWR2j9R0QThDVu_delete_history = [
|
|
3408
3403
|
{
|
|
3409
3404
|
adds: 4,
|
|
@@ -31,20 +31,6 @@ exports.mapping = {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
// flex2vibe: {
|
|
35
|
-
// LCSRevisableEntity: {
|
|
36
|
-
// getMapKey: (object) =>{ return object;}
|
|
37
|
-
// },
|
|
38
|
-
// LCSLast: {
|
|
39
|
-
// getMapKey: (object) => {return object;}
|
|
40
|
-
// },
|
|
41
|
-
// LCSMaterial: {
|
|
42
|
-
// getMapKey: (object) =>{ return object;}
|
|
43
|
-
// },
|
|
44
|
-
// LCSBusinessObject: {
|
|
45
|
-
// getMapKey: (object) => {return object;}
|
|
46
|
-
// }
|
|
47
|
-
// },
|
|
48
34
|
},
|
|
49
35
|
LCSSeason: {
|
|
50
36
|
vibe2flex: {
|
|
@@ -68,7 +54,7 @@ exports.mapping = {
|
|
|
68
54
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
69
55
|
vibe2flex: {
|
|
70
56
|
getClass: () => 'LCSProduct',
|
|
71
|
-
getSoftType: (entity
|
|
57
|
+
getSoftType: (entity) => {
|
|
72
58
|
const prodType = entity['prodType'];
|
|
73
59
|
let val = '';
|
|
74
60
|
switch (prodType) {
|
|
@@ -93,7 +79,7 @@ exports.mapping = {
|
|
|
93
79
|
vibeIQIdentifier: 'itemNumber'
|
|
94
80
|
},
|
|
95
81
|
valueTransform: {
|
|
96
|
-
transformEx: (row
|
|
82
|
+
transformEx: (row) => {
|
|
97
83
|
return row['otherProp'] + 'xxx';
|
|
98
84
|
}
|
|
99
85
|
}
|
|
@@ -111,7 +97,7 @@ exports.mapping = {
|
|
|
111
97
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
112
98
|
vibe2flex: {
|
|
113
99
|
getClass: () => 'LCSSKU',
|
|
114
|
-
getSoftType: (entity
|
|
100
|
+
getSoftType: (entity) => {
|
|
115
101
|
const prodType = entity['prodType'];
|
|
116
102
|
let val = '';
|
|
117
103
|
switch (prodType) {
|
|
@@ -266,20 +252,6 @@ exports.mapping2 = {
|
|
|
266
252
|
}
|
|
267
253
|
}
|
|
268
254
|
}
|
|
269
|
-
// flex2vibe: {
|
|
270
|
-
// LCSRevisableEntity: {
|
|
271
|
-
// getMapKey: (object) =>{ return object;}
|
|
272
|
-
// },
|
|
273
|
-
// LCSLast: {
|
|
274
|
-
// getMapKey: (object) => {return object;}
|
|
275
|
-
// },
|
|
276
|
-
// LCSMaterial: {
|
|
277
|
-
// getMapKey: (object) =>{ return object;}
|
|
278
|
-
// },
|
|
279
|
-
// LCSBusinessObject: {
|
|
280
|
-
// getMapKey: (object) => {return object;}
|
|
281
|
-
// }
|
|
282
|
-
// },
|
|
283
255
|
},
|
|
284
256
|
LCSSeason: {
|
|
285
257
|
getIdentifierProperties: () => ['brand', 'year', 'seasonType'],
|
|
@@ -302,7 +274,7 @@ exports.mapping2 = {
|
|
|
302
274
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
303
275
|
vibe2flex: {
|
|
304
276
|
getClass: () => 'LCSProduct',
|
|
305
|
-
getSoftType: (entity
|
|
277
|
+
getSoftType: (entity) => {
|
|
306
278
|
const prodType = entity['prodType'];
|
|
307
279
|
let val = '';
|
|
308
280
|
switch (prodType) {
|
|
@@ -327,7 +299,7 @@ exports.mapping2 = {
|
|
|
327
299
|
vibeIQIdentifier: 'itemNumber'
|
|
328
300
|
},
|
|
329
301
|
valueTransform: {
|
|
330
|
-
transformEx: (row
|
|
302
|
+
transformEx: (row) => {
|
|
331
303
|
return row['otherProp'] + 'xxx';
|
|
332
304
|
}
|
|
333
305
|
}
|
|
@@ -346,7 +318,7 @@ exports.mapping2 = {
|
|
|
346
318
|
getIdentifierProperties: () => ['uniqueIdentifierA', 'uniqueIdentifierB'],
|
|
347
319
|
vibe2flex: {
|
|
348
320
|
getClass: () => 'LCSSKU',
|
|
349
|
-
getSoftType: (entity
|
|
321
|
+
getSoftType: (entity) => {
|
|
350
322
|
const prodType = entity['prodType'];
|
|
351
323
|
let val = '';
|
|
352
324
|
switch (prodType) {
|
|
@@ -5,45 +5,9 @@ export declare class IdentifierConversion {
|
|
|
5
5
|
static readonly INBOUND_ENTITY_MISSING_IDENIFIER_PROPS = "IdentifierConversion.getEntityCriteriaFromObject(): missing identifier properties: ";
|
|
6
6
|
static readonly MISSING_OBJECT = "IdentifierConversion.getEntityCriteriaFromObject(): missing: object";
|
|
7
7
|
static readonly MISSING_FLEXPLM_OBJECT_CLASS = "IdentifierConversion.getEntityCriteriaFromObject(): missing: flexPLMObjectClass";
|
|
8
|
-
/** Takes in an assortment and returns an object to query for an LCSSeason
|
|
9
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
10
|
-
* @param transformMapFile
|
|
11
|
-
* @param mapFileUtil
|
|
12
|
-
* @param dc
|
|
13
|
-
* @param assortment
|
|
14
|
-
* @param includeInformationKeys defaults true
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
8
|
static getSeasonIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, assortment: any, includeInformationKeys?: boolean): Promise<SeasonFederation>;
|
|
18
|
-
/** Takes in an assortment and returns an object to query for an SeasonGroup
|
|
19
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
20
|
-
* @param transformMapFile
|
|
21
|
-
* @param mapFileUtil
|
|
22
|
-
* @param dc
|
|
23
|
-
* @param assortment
|
|
24
|
-
* @param includeInformationKeys defaults true
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
9
|
static getSeasonGroupIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, assortment: any, includeInformationKeys?: boolean): Promise<SeasonGroupFederation>;
|
|
28
|
-
/** Takes in an item and returns an object to query for an LCSProduct
|
|
29
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
30
|
-
* @param transformMapFile
|
|
31
|
-
* @param mapFileUtil
|
|
32
|
-
* @param dc
|
|
33
|
-
* @param assortment
|
|
34
|
-
* @param includeInformationKeys defaults true
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
10
|
static getProductIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, itemFamilyObject: any, includeInformationKeys?: boolean): Promise<ProductFederation>;
|
|
38
|
-
/** Takes in an item and returns an object to query for an LCSSKU
|
|
39
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
40
|
-
* @param transformMapFile
|
|
41
|
-
* @param mapFileUtil
|
|
42
|
-
* @param dc
|
|
43
|
-
* @param assortment
|
|
44
|
-
* @param includeInformationKeys defaults true
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
11
|
static getSKUIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, itemObject: any, includeInformationKeys?: boolean): Promise<SkuFederation>;
|
|
48
12
|
static getEntityCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
|
|
49
13
|
static getAssortmentCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
|
|
@@ -5,15 +5,6 @@ const map_utils_1 = require("../util/map-utils");
|
|
|
5
5
|
const type_conversion_utils_1 = require("../util/type-conversion-utils");
|
|
6
6
|
const event_short_message_status_1 = require("../util/event-short-message-status");
|
|
7
7
|
class IdentifierConversion {
|
|
8
|
-
/** Takes in an assortment and returns an object to query for an LCSSeason
|
|
9
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
10
|
-
* @param transformMapFile
|
|
11
|
-
* @param mapFileUtil
|
|
12
|
-
* @param dc
|
|
13
|
-
* @param assortment
|
|
14
|
-
* @param includeInformationKeys defaults true
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
8
|
static async getSeasonIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
|
|
18
9
|
if (!assortment) {
|
|
19
10
|
throw new Error('IdentifierConversion.getSeasonIdentityObject(): assortment must be provided.');
|
|
@@ -58,15 +49,6 @@ class IdentifierConversion {
|
|
|
58
49
|
}
|
|
59
50
|
return seasonObj;
|
|
60
51
|
}
|
|
61
|
-
/** Takes in an assortment and returns an object to query for an SeasonGroup
|
|
62
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
63
|
-
* @param transformMapFile
|
|
64
|
-
* @param mapFileUtil
|
|
65
|
-
* @param dc
|
|
66
|
-
* @param assortment
|
|
67
|
-
* @param includeInformationKeys defaults true
|
|
68
|
-
* @returns
|
|
69
|
-
*/
|
|
70
52
|
static async getSeasonGroupIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
|
|
71
53
|
if (!assortment) {
|
|
72
54
|
throw new Error('IdentifierConversion.getSeasonGroupIdentityObject(): assortment must be provided.');
|
|
@@ -110,15 +92,6 @@ class IdentifierConversion {
|
|
|
110
92
|
}
|
|
111
93
|
return seasonGroupObj;
|
|
112
94
|
}
|
|
113
|
-
/** Takes in an item and returns an object to query for an LCSProduct
|
|
114
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
115
|
-
* @param transformMapFile
|
|
116
|
-
* @param mapFileUtil
|
|
117
|
-
* @param dc
|
|
118
|
-
* @param assortment
|
|
119
|
-
* @param includeInformationKeys defaults true
|
|
120
|
-
* @returns
|
|
121
|
-
*/
|
|
122
95
|
static async getProductIdentityObject(transformMapFile, mapFileUtil, dc, itemFamilyObject, includeInformationKeys = true) {
|
|
123
96
|
if (!itemFamilyObject) {
|
|
124
97
|
throw new Error('IdentifierConversion.getProductIdentityObject(): itemFamilyObject must be provided.');
|
|
@@ -156,15 +129,6 @@ class IdentifierConversion {
|
|
|
156
129
|
.applyTransformMap(transformMapFile, mapFileUtil, prodObj, mapKey, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
|
|
157
130
|
return prodObj;
|
|
158
131
|
}
|
|
159
|
-
/** Takes in an item and returns an object to query for an LCSSKU
|
|
160
|
-
* This will only return the identifier properties, and information properties if specified.
|
|
161
|
-
* @param transformMapFile
|
|
162
|
-
* @param mapFileUtil
|
|
163
|
-
* @param dc
|
|
164
|
-
* @param assortment
|
|
165
|
-
* @param includeInformationKeys defaults true
|
|
166
|
-
* @returns
|
|
167
|
-
*/
|
|
168
132
|
static async getSKUIdentityObject(transformMapFile, mapFileUtil, dc, itemObject, includeInformationKeys = true) {
|
|
169
133
|
if (!itemObject) {
|
|
170
134
|
throw new Error('IdentifierConversion.getSKUIdentityObject(): itemObject must be provided.');
|
|
@@ -30,11 +30,9 @@ describe('getAssortmentFromObject', () => {
|
|
|
30
30
|
entityValues[key] = value;
|
|
31
31
|
}
|
|
32
32
|
else if (Array.isArray(value)) {
|
|
33
|
-
//multi select
|
|
34
33
|
entityValues[key] = value.map((v) => v.value);
|
|
35
34
|
}
|
|
36
35
|
else if (value.value) {
|
|
37
|
-
//single select
|
|
38
36
|
entityValues[key] = value.value;
|
|
39
37
|
}
|
|
40
38
|
}
|
|
@@ -168,11 +166,9 @@ describe('getItemCriteriaFromObject', () => {
|
|
|
168
166
|
entityValues[key] = value;
|
|
169
167
|
}
|
|
170
168
|
else if (Array.isArray(value)) {
|
|
171
|
-
//multi select
|
|
172
169
|
entityValues[key] = value.map((v) => v.value);
|
|
173
170
|
}
|
|
174
171
|
else if (value.value) {
|
|
175
|
-
//single select
|
|
176
172
|
entityValues[key] = value.value;
|
|
177
173
|
}
|
|
178
174
|
}
|
|
@@ -5,11 +5,9 @@ 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
|
|
9
8
|
if (!config.apiHost || !config.userName || !config.password) {
|
|
10
9
|
throw new Error(ConfigDefaults.NEED_CONFIG_VALUES);
|
|
11
10
|
}
|
|
12
|
-
//List will be comma separated list in UI, so convert to array
|
|
13
11
|
if (config?.itemPreDevelopmentLifecycleStages && !(config?.itemPreDevelopmentLifecycleStages instanceof Array)) {
|
|
14
12
|
config.itemPreDevelopmentLifecycleStages = config.itemPreDevelopmentLifecycleStages.split(',');
|
|
15
13
|
}
|
|
@@ -42,7 +40,6 @@ class ConfigDefaults {
|
|
|
42
40
|
const pass = outputConfig.password;
|
|
43
41
|
outputConfig.userName = () => uName;
|
|
44
42
|
outputConfig.password = () => pass;
|
|
45
|
-
//Don't allow overwriting this.
|
|
46
43
|
outputConfig['OOBvibeEventEndpoint'] = '/rfa/vibeiq/vibeEvents';
|
|
47
44
|
console.log('outputConfig: ' + JSON.stringify(outputConfig));
|
|
48
45
|
return outputConfig;
|
|
@@ -21,13 +21,11 @@ describe('all tests', () => {
|
|
|
21
21
|
describe('setConfigDefaults - required values', () => {
|
|
22
22
|
it('missing apiHost', async () => {
|
|
23
23
|
const config = {
|
|
24
|
-
//apiHost: 'http://test.com',
|
|
25
24
|
userName: 'vibeiq',
|
|
26
25
|
password: 'vibeiq',
|
|
27
26
|
plmEnviornment: 'SB'
|
|
28
27
|
};
|
|
29
28
|
try {
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
|
|
31
29
|
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
|
|
32
30
|
}
|
|
33
31
|
catch (e) {
|
|
@@ -37,12 +35,10 @@ describe('all tests', () => {
|
|
|
37
35
|
it('missing userName', async () => {
|
|
38
36
|
const config = {
|
|
39
37
|
apiHost: 'http://test.com',
|
|
40
|
-
//userName: 'vibeiq',
|
|
41
38
|
password: 'vibeiq',
|
|
42
39
|
plmEnviornment: 'SB'
|
|
43
40
|
};
|
|
44
41
|
try {
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
|
|
46
42
|
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
|
|
47
43
|
}
|
|
48
44
|
catch (e) {
|
|
@@ -53,11 +49,9 @@ describe('all tests', () => {
|
|
|
53
49
|
const config = {
|
|
54
50
|
apiHost: 'http://test.com',
|
|
55
51
|
userName: 'vibeiq',
|
|
56
|
-
//password: 'vibeiq',
|
|
57
52
|
plmEnviornment: 'SB'
|
|
58
53
|
};
|
|
59
54
|
try {
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
|
|
61
55
|
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
|
|
62
56
|
}
|
|
63
57
|
catch (e) {
|
|
@@ -69,10 +63,8 @@ describe('all tests', () => {
|
|
|
69
63
|
apiHost: 'http://test.com',
|
|
70
64
|
userName: 'vibeiq',
|
|
71
65
|
password: 'vibeiq',
|
|
72
|
-
//plmEnviornment: 'SB'
|
|
73
66
|
};
|
|
74
67
|
try {
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
|
|
76
68
|
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(config);
|
|
77
69
|
}
|
|
78
70
|
catch (e) {
|
|
@@ -223,7 +215,6 @@ describe('all tests', () => {
|
|
|
223
215
|
const startConfig = Object.assign({}, config);
|
|
224
216
|
const objectClass = 'LCSSeason';
|
|
225
217
|
const expectedAtts = ['flexPLMSeasonName'];
|
|
226
|
-
// const expectedAtts =['seasonType', 'seasonYear'];
|
|
227
218
|
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(startConfig);
|
|
228
219
|
const identifierAtts = fcConfig.identifierAtts[objectClass];
|
|
229
220
|
expect(identifierAtts instanceof Array).toBeTruthy();
|
|
@@ -31,26 +31,12 @@ exports.mapping = {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
// flex2vibe: {
|
|
35
|
-
// LCSRevisableEntity: {
|
|
36
|
-
// getMapKey: (object) =>{ return object;}
|
|
37
|
-
// },
|
|
38
|
-
// LCSLast: {
|
|
39
|
-
// getMapKey: (object) => {return object;}
|
|
40
|
-
// },
|
|
41
|
-
// LCSMaterial: {
|
|
42
|
-
// getMapKey: (object) =>{ return object;}
|
|
43
|
-
// },
|
|
44
|
-
// LCSBusinessObject: {
|
|
45
|
-
// getMapKey: (object) => {return object;}
|
|
46
|
-
// }
|
|
47
|
-
// },
|
|
48
34
|
},
|
|
49
35
|
LCSProduct: {
|
|
50
36
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
51
37
|
vibe2flex: {
|
|
52
38
|
getClass: () => 'LCSProduct',
|
|
53
|
-
getSoftType: (entity
|
|
39
|
+
getSoftType: (entity) => {
|
|
54
40
|
const prodType = entity['prodType'];
|
|
55
41
|
let val = '';
|
|
56
42
|
switch (prodType) {
|
|
@@ -75,7 +61,7 @@ exports.mapping = {
|
|
|
75
61
|
vibeIQIdentifier: 'itemNumber'
|
|
76
62
|
},
|
|
77
63
|
valueTransform: {
|
|
78
|
-
transformEx: (row
|
|
64
|
+
transformEx: (row) => {
|
|
79
65
|
return row['otherProp'] + 'xxx';
|
|
80
66
|
}
|
|
81
67
|
}
|
|
@@ -93,7 +79,7 @@ exports.mapping = {
|
|
|
93
79
|
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
94
80
|
vibe2flex: {
|
|
95
81
|
getClass: () => 'LCSSKU',
|
|
96
|
-
getSoftType: (entity
|
|
82
|
+
getSoftType: (entity) => {
|
|
97
83
|
const prodType = entity['prodType'];
|
|
98
84
|
let val = '';
|
|
99
85
|
switch (prodType) {
|
|
@@ -19,118 +19,21 @@ 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
|
-
*/
|
|
28
22
|
getEnumerationValue(prop: any, nd: any): any;
|
|
29
23
|
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
|
-
*/
|
|
38
24
|
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
|
-
*/
|
|
46
25
|
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
|
-
*/
|
|
54
26
|
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
|
-
*/
|
|
61
27
|
getEntityValue(prop: any, data: any): Promise<any>;
|
|
62
28
|
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
|
-
*/
|
|
69
29
|
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
|
-
*/
|
|
76
30
|
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
|
-
*/
|
|
84
31
|
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
|
-
*/
|
|
93
32
|
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
|
-
*/
|
|
99
33
|
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
|
-
*/
|
|
106
34
|
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
|
-
*/
|
|
114
35
|
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
|
-
*/
|
|
120
36
|
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
|
-
*/
|
|
127
37
|
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
|
-
*/
|
|
135
38
|
getUserById(userId: any): Promise<any>;
|
|
136
39
|
}
|