@contrail/flexplm 1.1.67-alpha.0 → 1.1.67-alpha.2
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/CHANGELOG.md +21 -0
- package/lib/util/event-short-message-status.d.ts +1 -0
- package/lib/util/event-short-message-status.js +1 -0
- package/lib/util/type-conversion-utils-spec-mockData.js +6 -1
- package/lib/util/type-conversion-utils.d.ts +1 -1
- package/lib/util/type-conversion-utils.js +2 -2
- package/lib/util/type-conversion-utils.spec.js +35 -0
- package/package.json +1 -1
- package/src/util/event-short-message-status.ts +1 -0
- package/src/util/type-conversion-utils-spec-mockData.ts +243 -238
- package/src/util/type-conversion-utils.spec.ts +39 -0
- package/src/util/type-conversion-utils.ts +359 -359
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@contrail/flexplm` are documented here.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [1.1.67] - 2026-xx-xx
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Added EventShortMessageStatus status values for adding items to projects functionality.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Added optional `context` parameter to `TypeConversionUtils.isInboundCreatableFromObject` method to allow passing context data to map file `isInboundCreatable` functions.
|
|
17
|
+
|
|
18
|
+
## [1.1.66] - (initial changelog entry)
|
|
19
|
+
|
|
20
|
+
- Initial changelog. Prior releases did not include a changelog.
|
|
21
|
+
See git history for changes predating this entry.
|
|
@@ -3,6 +3,7 @@ export declare enum EventShortMessageStatus {
|
|
|
3
3
|
FAILURE = "Failure",
|
|
4
4
|
CREATED = "Created",
|
|
5
5
|
ITEM_FAMILY_ID_MISSING = "Item_family_id_missing",
|
|
6
|
+
ITEM_FAMILY_NOT_FOUND = "Item_family_not_found",
|
|
6
7
|
PROJECT_ITEM_NOT_FOUND = "Project_item_not_found",
|
|
7
8
|
MISSING_IDENTIFIER_PROPERTIES = "Missing_identifier_properties",
|
|
8
9
|
MISSING_INPUT = "Missing_input",
|
|
@@ -7,6 +7,7 @@ var EventShortMessageStatus;
|
|
|
7
7
|
EventShortMessageStatus["FAILURE"] = "Failure";
|
|
8
8
|
EventShortMessageStatus["CREATED"] = "Created";
|
|
9
9
|
EventShortMessageStatus["ITEM_FAMILY_ID_MISSING"] = "Item_family_id_missing";
|
|
10
|
+
EventShortMessageStatus["ITEM_FAMILY_NOT_FOUND"] = "Item_family_not_found";
|
|
10
11
|
EventShortMessageStatus["PROJECT_ITEM_NOT_FOUND"] = "Project_item_not_found";
|
|
11
12
|
EventShortMessageStatus["MISSING_IDENTIFIER_PROPERTIES"] = "Missing_identifier_properties";
|
|
12
13
|
EventShortMessageStatus["MISSING_INPUT"] = "Missing_input";
|
|
@@ -154,7 +154,12 @@ exports.mapping = {
|
|
|
154
154
|
}
|
|
155
155
|
},
|
|
156
156
|
prefix: {
|
|
157
|
-
isInboundCreatable: () =>
|
|
157
|
+
isInboundCreatable: (object, context) => {
|
|
158
|
+
if (context && context.skipPrefix) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
},
|
|
158
163
|
vibe2flex: {
|
|
159
164
|
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
160
165
|
rekey: {
|
|
@@ -15,6 +15,6 @@ export declare class TypeConversionUtils {
|
|
|
15
15
|
static getIdentifierPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
|
|
16
16
|
static getInformationalPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
|
|
17
17
|
static getMapKeyFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any, direction: string): Promise<string>;
|
|
18
|
-
static isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any): Promise<boolean>;
|
|
18
|
+
static isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean>;
|
|
19
19
|
static getObjectType(object: any): any;
|
|
20
20
|
}
|
|
@@ -180,13 +180,13 @@ class TypeConversionUtils {
|
|
|
180
180
|
return type;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
static async isInboundCreatableFromObject(fileId, mapFileUtil, object) {
|
|
183
|
+
static async isInboundCreatableFromObject(fileId, mapFileUtil, object, context) {
|
|
184
184
|
let isInboundCreatable = false;
|
|
185
185
|
if (fileId) {
|
|
186
186
|
const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
187
187
|
const mapData = await map_utils_1.MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
|
|
188
188
|
if (mapData && mapData['isInboundCreatable']) {
|
|
189
|
-
isInboundCreatable = await mapData['isInboundCreatable'](object);
|
|
189
|
+
isInboundCreatable = await mapData['isInboundCreatable'](object, context);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
return isInboundCreatable;
|
|
@@ -580,5 +580,40 @@ describe('conversion-utils', () => {
|
|
|
580
580
|
spy.mockRestore();
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
|
+
it('should pass context to isInboundCreatable function', async () => {
|
|
584
|
+
const spy = jest.spyOn(mapFileUtil, 'getMapFile')
|
|
585
|
+
.mockImplementation(async () => {
|
|
586
|
+
return mapping;
|
|
587
|
+
});
|
|
588
|
+
const object = {
|
|
589
|
+
flexPLMObjectClass: 'LCSRevisableEntity',
|
|
590
|
+
flexPLMTypePath: 'Revisable Entity\\prefix'
|
|
591
|
+
};
|
|
592
|
+
const context = { skipPrefix: true };
|
|
593
|
+
try {
|
|
594
|
+
const results = await type_conversion_utils_1.TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object, context);
|
|
595
|
+
expect(results).toBeFalsy();
|
|
596
|
+
}
|
|
597
|
+
finally {
|
|
598
|
+
spy.mockRestore();
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
it('should work without context parameter', async () => {
|
|
602
|
+
const spy = jest.spyOn(mapFileUtil, 'getMapFile')
|
|
603
|
+
.mockImplementation(async () => {
|
|
604
|
+
return mapping;
|
|
605
|
+
});
|
|
606
|
+
const object = {
|
|
607
|
+
flexPLMObjectClass: 'LCSRevisableEntity',
|
|
608
|
+
flexPLMTypePath: 'Revisable Entity\\prefix'
|
|
609
|
+
};
|
|
610
|
+
try {
|
|
611
|
+
const results = await type_conversion_utils_1.TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object);
|
|
612
|
+
expect(results).toBeTruthy();
|
|
613
|
+
}
|
|
614
|
+
finally {
|
|
615
|
+
spy.mockRestore();
|
|
616
|
+
}
|
|
617
|
+
});
|
|
583
618
|
});
|
|
584
619
|
});
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ export enum EventShortMessageStatus {
|
|
|
3
3
|
FAILURE = 'Failure',
|
|
4
4
|
CREATED = 'Created',
|
|
5
5
|
ITEM_FAMILY_ID_MISSING = "Item_family_id_missing",
|
|
6
|
+
ITEM_FAMILY_NOT_FOUND = "Item_family_not_found",
|
|
6
7
|
PROJECT_ITEM_NOT_FOUND = "Project_item_not_found",
|
|
7
8
|
MISSING_IDENTIFIER_PROPERTIES = 'Missing_identifier_properties',
|
|
8
9
|
MISSING_INPUT = 'Missing_input',
|
|
@@ -1,239 +1,244 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.mapping = {
|
|
4
|
-
typeConversion: {
|
|
5
|
-
vibe2flex: {
|
|
6
|
-
'custom-entity': {
|
|
7
|
-
getMapKey: (entity) =>{
|
|
8
|
-
const typePath = entity['typePath'];
|
|
9
|
-
let mapKey = '';
|
|
10
|
-
switch (typePath) {
|
|
11
|
-
case 'custom-entity:pack':
|
|
12
|
-
mapKey = 'packaging';
|
|
13
|
-
break;
|
|
14
|
-
case 'custom-entity:prefix':
|
|
15
|
-
mapKey = 'prefix';
|
|
16
|
-
break;
|
|
17
|
-
case 'custom-entity:catName':
|
|
18
|
-
mapKey = 'catName';
|
|
19
|
-
break;
|
|
20
|
-
case 'custom-entity:partnerOrg':
|
|
21
|
-
mapKey = 'partnerOrg';
|
|
22
|
-
break;
|
|
23
|
-
case 'custom-entity:catFamily':
|
|
24
|
-
mapKey = 'catFamily';
|
|
25
|
-
break;
|
|
26
|
-
case 'custom-entity:formName':
|
|
27
|
-
mapKey = 'formName';
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return mapKey;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
flex2vibe: {
|
|
36
|
-
LCSLast: {
|
|
37
|
-
getMapKey: (object) =>{ return 'catName';}
|
|
38
|
-
},
|
|
39
|
-
LCSRevisableEntity : {
|
|
40
|
-
getMapKey: (object) =>{
|
|
41
|
-
const typePath = object['flexPLMTypePath'];
|
|
42
|
-
let mapKey = '';
|
|
43
|
-
switch (typePath) {
|
|
44
|
-
case 'Revisable Entity\\packaging':
|
|
45
|
-
mapKey = 'packaging';
|
|
46
|
-
break
|
|
47
|
-
case 'Revisable Entity\\prefix':
|
|
48
|
-
mapKey = 'prefix';
|
|
49
|
-
break
|
|
50
|
-
};
|
|
51
|
-
return mapKey;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
LCSProduct: {
|
|
58
|
-
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
59
|
-
vibe2flex: {
|
|
60
|
-
getClass: () => 'LCSProduct',
|
|
61
|
-
getSoftType: (entity /*, dependencies*/) =>{
|
|
62
|
-
const prodType = entity['prodType'];
|
|
63
|
-
let val = '';
|
|
64
|
-
switch (prodType) {
|
|
65
|
-
case 'acc':
|
|
66
|
-
val = 'Product\\Accesories';
|
|
67
|
-
break;
|
|
68
|
-
case 'app':
|
|
69
|
-
val = 'Product\\Apparel';
|
|
70
|
-
break;
|
|
71
|
-
case 'eqp':
|
|
72
|
-
val = 'Product\\Equipment';
|
|
73
|
-
break;
|
|
74
|
-
case 'foot':
|
|
75
|
-
val = 'Product\\Footwear';
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return val;
|
|
80
|
-
},
|
|
81
|
-
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
|
|
82
|
-
rekey: {
|
|
83
|
-
productName: 'name',
|
|
84
|
-
vibeIQIdentifier: 'itemNumber'
|
|
85
|
-
},
|
|
86
|
-
valueTransform: {
|
|
87
|
-
transformEx: (row/*, dependencies*/) => {
|
|
88
|
-
return row['otherProp'] + 'xxx';
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
flex2vibe: {
|
|
94
|
-
getClass: () => 'item',
|
|
95
|
-
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
96
|
-
rekey: {
|
|
97
|
-
itemNumber: 'vibeIQIdentifier',
|
|
98
|
-
name: 'productName',
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
LCSSKU: {
|
|
103
|
-
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
104
|
-
vibe2flex: {
|
|
105
|
-
getClass: () => 'LCSSKU',
|
|
106
|
-
getSoftType: (entity /*, dependencies*/) =>{
|
|
107
|
-
const prodType = entity['prodType'];
|
|
108
|
-
let val = '';
|
|
109
|
-
switch (prodType) {
|
|
110
|
-
case 'acc':
|
|
111
|
-
val = 'Product\\Accesories';
|
|
112
|
-
break;
|
|
113
|
-
case 'app':
|
|
114
|
-
val = 'Product\\Apparel';
|
|
115
|
-
break;
|
|
116
|
-
case 'eqp':
|
|
117
|
-
val = 'Product\\Equipment';
|
|
118
|
-
break;
|
|
119
|
-
case 'foot':
|
|
120
|
-
val = 'Product\\Footwear';
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return val;
|
|
125
|
-
},
|
|
126
|
-
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
127
|
-
rekey: {
|
|
128
|
-
skuName: 'optionName',
|
|
129
|
-
vibeIQIdentifier: 'itemNumber'
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
flex2vibe: {
|
|
133
|
-
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
134
|
-
rekey: {
|
|
135
|
-
itemNumber: 'vibeIQIdentifier',
|
|
136
|
-
optionName: 'skuName',
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
packaging: {
|
|
142
|
-
vibe2flex: {
|
|
143
|
-
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
144
|
-
rekey: {
|
|
145
|
-
retailPackType: 'packType',
|
|
146
|
-
retailIntroDate: 'introDate'
|
|
147
|
-
},
|
|
148
|
-
getSoftType: () => 'Revisable Entity\\packaging',
|
|
149
|
-
getClass: () => 'LCSRevisableEntity'
|
|
150
|
-
},
|
|
151
|
-
flex2vibe: {
|
|
152
|
-
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
153
|
-
rekey: {
|
|
154
|
-
packType: 'retailPackType',
|
|
155
|
-
introDate: 'retailIntroDate'
|
|
156
|
-
},
|
|
157
|
-
getClass: () => 'custom-entity',
|
|
158
|
-
getSoftType: () => 'custom-entity:pack',
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
prefix: {
|
|
163
|
-
isInboundCreatable: () =>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
transformOrder: [],
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
transformOrder: [],
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
transformOrder: [],
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
transformOrder: [],
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.mapping = {
|
|
4
|
+
typeConversion: {
|
|
5
|
+
vibe2flex: {
|
|
6
|
+
'custom-entity': {
|
|
7
|
+
getMapKey: (entity) =>{
|
|
8
|
+
const typePath = entity['typePath'];
|
|
9
|
+
let mapKey = '';
|
|
10
|
+
switch (typePath) {
|
|
11
|
+
case 'custom-entity:pack':
|
|
12
|
+
mapKey = 'packaging';
|
|
13
|
+
break;
|
|
14
|
+
case 'custom-entity:prefix':
|
|
15
|
+
mapKey = 'prefix';
|
|
16
|
+
break;
|
|
17
|
+
case 'custom-entity:catName':
|
|
18
|
+
mapKey = 'catName';
|
|
19
|
+
break;
|
|
20
|
+
case 'custom-entity:partnerOrg':
|
|
21
|
+
mapKey = 'partnerOrg';
|
|
22
|
+
break;
|
|
23
|
+
case 'custom-entity:catFamily':
|
|
24
|
+
mapKey = 'catFamily';
|
|
25
|
+
break;
|
|
26
|
+
case 'custom-entity:formName':
|
|
27
|
+
mapKey = 'formName';
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return mapKey;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
flex2vibe: {
|
|
36
|
+
LCSLast: {
|
|
37
|
+
getMapKey: (object) =>{ return 'catName';}
|
|
38
|
+
},
|
|
39
|
+
LCSRevisableEntity : {
|
|
40
|
+
getMapKey: (object) =>{
|
|
41
|
+
const typePath = object['flexPLMTypePath'];
|
|
42
|
+
let mapKey = '';
|
|
43
|
+
switch (typePath) {
|
|
44
|
+
case 'Revisable Entity\\packaging':
|
|
45
|
+
mapKey = 'packaging';
|
|
46
|
+
break
|
|
47
|
+
case 'Revisable Entity\\prefix':
|
|
48
|
+
mapKey = 'prefix';
|
|
49
|
+
break
|
|
50
|
+
};
|
|
51
|
+
return mapKey;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
},
|
|
57
|
+
LCSProduct: {
|
|
58
|
+
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
59
|
+
vibe2flex: {
|
|
60
|
+
getClass: () => 'LCSProduct',
|
|
61
|
+
getSoftType: (entity /*, dependencies*/) =>{
|
|
62
|
+
const prodType = entity['prodType'];
|
|
63
|
+
let val = '';
|
|
64
|
+
switch (prodType) {
|
|
65
|
+
case 'acc':
|
|
66
|
+
val = 'Product\\Accesories';
|
|
67
|
+
break;
|
|
68
|
+
case 'app':
|
|
69
|
+
val = 'Product\\Apparel';
|
|
70
|
+
break;
|
|
71
|
+
case 'eqp':
|
|
72
|
+
val = 'Product\\Equipment';
|
|
73
|
+
break;
|
|
74
|
+
case 'foot':
|
|
75
|
+
val = 'Product\\Footwear';
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return val;
|
|
80
|
+
},
|
|
81
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
|
|
82
|
+
rekey: {
|
|
83
|
+
productName: 'name',
|
|
84
|
+
vibeIQIdentifier: 'itemNumber'
|
|
85
|
+
},
|
|
86
|
+
valueTransform: {
|
|
87
|
+
transformEx: (row/*, dependencies*/) => {
|
|
88
|
+
return row['otherProp'] + 'xxx';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
},
|
|
93
|
+
flex2vibe: {
|
|
94
|
+
getClass: () => 'item',
|
|
95
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
96
|
+
rekey: {
|
|
97
|
+
itemNumber: 'vibeIQIdentifier',
|
|
98
|
+
name: 'productName',
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
LCSSKU: {
|
|
103
|
+
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
104
|
+
vibe2flex: {
|
|
105
|
+
getClass: () => 'LCSSKU',
|
|
106
|
+
getSoftType: (entity /*, dependencies*/) =>{
|
|
107
|
+
const prodType = entity['prodType'];
|
|
108
|
+
let val = '';
|
|
109
|
+
switch (prodType) {
|
|
110
|
+
case 'acc':
|
|
111
|
+
val = 'Product\\Accesories';
|
|
112
|
+
break;
|
|
113
|
+
case 'app':
|
|
114
|
+
val = 'Product\\Apparel';
|
|
115
|
+
break;
|
|
116
|
+
case 'eqp':
|
|
117
|
+
val = 'Product\\Equipment';
|
|
118
|
+
break;
|
|
119
|
+
case 'foot':
|
|
120
|
+
val = 'Product\\Footwear';
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return val;
|
|
125
|
+
},
|
|
126
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
127
|
+
rekey: {
|
|
128
|
+
skuName: 'optionName',
|
|
129
|
+
vibeIQIdentifier: 'itemNumber'
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
flex2vibe: {
|
|
133
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
134
|
+
rekey: {
|
|
135
|
+
itemNumber: 'vibeIQIdentifier',
|
|
136
|
+
optionName: 'skuName',
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
packaging: {
|
|
142
|
+
vibe2flex: {
|
|
143
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
144
|
+
rekey: {
|
|
145
|
+
retailPackType: 'packType',
|
|
146
|
+
retailIntroDate: 'introDate'
|
|
147
|
+
},
|
|
148
|
+
getSoftType: () => 'Revisable Entity\\packaging',
|
|
149
|
+
getClass: () => 'LCSRevisableEntity'
|
|
150
|
+
},
|
|
151
|
+
flex2vibe: {
|
|
152
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
153
|
+
rekey: {
|
|
154
|
+
packType: 'retailPackType',
|
|
155
|
+
introDate: 'retailIntroDate'
|
|
156
|
+
},
|
|
157
|
+
getClass: () => 'custom-entity',
|
|
158
|
+
getSoftType: () => 'custom-entity:pack',
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
prefix: {
|
|
163
|
+
isInboundCreatable: (object, context) => {
|
|
164
|
+
if (context && context.skipPrefix) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
},
|
|
169
|
+
vibe2flex: {
|
|
170
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
171
|
+
rekey: {
|
|
172
|
+
retailOwner: 'owner',
|
|
173
|
+
retailIntroDate: 'introDate'
|
|
174
|
+
},
|
|
175
|
+
getSoftType: () => 'Revisable Entity\\prefix',
|
|
176
|
+
getClass: () => 'LCSRevisableEntity'
|
|
177
|
+
},
|
|
178
|
+
flex2vibe: {
|
|
179
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
180
|
+
rekey: {
|
|
181
|
+
owner: 'retailOwner',
|
|
182
|
+
introDate: 'retailIntroDate'
|
|
183
|
+
},
|
|
184
|
+
getClass: () => 'custom-entity',
|
|
185
|
+
getSoftType: () => 'custom-entity:prefix',
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
catName: {
|
|
190
|
+
getIdentifierProperties: () => ['catName', 'catNumber'],
|
|
191
|
+
getInformationalProperties: () => ['longName'],
|
|
192
|
+
vibe2flex: {
|
|
193
|
+
transformOrder: [],
|
|
194
|
+
getSoftType: () => 'Last\\catName',
|
|
195
|
+
getClass: () => 'LCSLast'
|
|
196
|
+
},
|
|
197
|
+
flex2vibe: {
|
|
198
|
+
transformOrder: [],
|
|
199
|
+
getClass: () => 'custom-entity',
|
|
200
|
+
getSoftType: () => 'custom-entity:catName',
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
partnerOrg: {
|
|
205
|
+
vibe2flex: {
|
|
206
|
+
transformOrder: [],
|
|
207
|
+
getSoftType: () => 'Business Object\\partnerOrg',
|
|
208
|
+
getClass: () => 'LCSLifecycleManaged'
|
|
209
|
+
},
|
|
210
|
+
flex2vibe: {
|
|
211
|
+
transformOrder: [],
|
|
212
|
+
getClass: () => 'custom-entity',
|
|
213
|
+
getSoftType: () => 'custom-entity:partnerOrg',
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
catFamily: {
|
|
218
|
+
vibe2flex: {
|
|
219
|
+
transformOrder: [],
|
|
220
|
+
getSoftType: () => 'Revisable Entity\\catFamily',
|
|
221
|
+
getClass: () => 'LCSRevisableEntity'
|
|
222
|
+
},
|
|
223
|
+
flex2vibe: {
|
|
224
|
+
transformOrder: [],
|
|
225
|
+
getClass: () => 'custom-entity',
|
|
226
|
+
getSoftType: () => 'custom-entity:catFamily',
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
formName: {
|
|
231
|
+
vibe2flex: {
|
|
232
|
+
transformOrder: [],
|
|
233
|
+
getSoftType: () => 'Material\\form',
|
|
234
|
+
getClass: () => 'LCSMaterial'
|
|
235
|
+
},
|
|
236
|
+
flex2vibe: {
|
|
237
|
+
transformOrder: [],
|
|
238
|
+
getClass: () => 'custom-entity',
|
|
239
|
+
getSoftType: () => 'custom-entity:formName',
|
|
240
|
+
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
|
|
239
244
|
};
|
|
@@ -640,5 +640,44 @@ describe('conversion-utils', () => {
|
|
|
640
640
|
}
|
|
641
641
|
});
|
|
642
642
|
|
|
643
|
+
it('should pass context to isInboundCreatable function', async () =>{
|
|
644
|
+
const spy = jest.spyOn(mapFileUtil, 'getMapFile')
|
|
645
|
+
.mockImplementation(async () =>{
|
|
646
|
+
return mapping;
|
|
647
|
+
});
|
|
648
|
+
const object = {
|
|
649
|
+
flexPLMObjectClass: 'LCSRevisableEntity',
|
|
650
|
+
flexPLMTypePath: 'Revisable Entity\\prefix'
|
|
651
|
+
}
|
|
652
|
+
const context = { skipPrefix: true };
|
|
653
|
+
|
|
654
|
+
try{
|
|
655
|
+
const results = await TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object, context);
|
|
656
|
+
expect(results).toBeFalsy();
|
|
657
|
+
|
|
658
|
+
} finally {
|
|
659
|
+
spy.mockRestore();
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
it('should work without context parameter', async () =>{
|
|
664
|
+
const spy = jest.spyOn(mapFileUtil, 'getMapFile')
|
|
665
|
+
.mockImplementation(async () =>{
|
|
666
|
+
return mapping;
|
|
667
|
+
});
|
|
668
|
+
const object = {
|
|
669
|
+
flexPLMObjectClass: 'LCSRevisableEntity',
|
|
670
|
+
flexPLMTypePath: 'Revisable Entity\\prefix'
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
try{
|
|
674
|
+
const results = await TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object);
|
|
675
|
+
expect(results).toBeTruthy();
|
|
676
|
+
|
|
677
|
+
} finally {
|
|
678
|
+
spy.mockRestore();
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
|
|
643
682
|
});
|
|
644
683
|
});
|