@contrail/flexplm 1.1.12 → 1.1.14
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 +30 -0
- package/.github/workflows/flexplm-lib.yml +27 -0
- package/lib/flexplm-utils.spec.d.ts +1 -0
- package/lib/flexplm-utils.spec.js +26 -0
- package/lib/publish/base-process-publish-assortment.js +2 -4
- package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -0
- package/lib/publish/base-process-publish-assortment.spec.js +1053 -0
- package/lib/util/config-defaults.spec.d.ts +1 -0
- package/lib/util/config-defaults.spec.js +264 -0
- package/lib/util/data-converter.spec.d.ts +1 -0
- package/lib/util/data-converter.spec.js +591 -0
- package/lib/util/map-utils.d.ts +2 -2
- package/lib/util/map-utils.js +5 -28
- package/lib/util/map-utils.spec.d.ts +1 -0
- package/lib/util/map-utils.spec.js +89 -0
- package/lib/util/thumbnail-util.spec.d.ts +1 -0
- package/lib/util/thumbnail-util.spec.js +132 -0
- package/lib/util/type-conversion-utils-spec-mockData.js +21 -0
- package/lib/util/type-conversion-utils.d.ts +7 -0
- package/lib/util/type-conversion-utils.js +88 -4
- package/lib/util/type-conversion-utils.spec.d.ts +1 -0
- package/lib/util/type-conversion-utils.spec.js +547 -0
- package/lib/util/type-defaults.d.ts +5 -0
- package/lib/util/type-defaults.js +66 -0
- package/lib/util/type-defaults.spec.d.ts +1 -0
- package/lib/util/type-defaults.spec.js +460 -0
- package/lib/util/type-utils.spec.d.ts +1 -0
- package/lib/util/type-utils.spec.js +190 -0
- package/package.json +2 -2
- package/publish.bat +5 -0
- package/publish.sh +5 -0
- package/src/entity-processor/base-entity-processor.ts +183 -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 +20 -0
- package/src/interfaces/interfaces.ts +120 -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 +23 -0
- package/src/publish/base-process-publish-assortment.spec.ts +1239 -0
- package/src/publish/base-process-publish-assortment.ts +1024 -0
- package/src/publish/mockData.ts +4561 -0
- package/src/transform/identifier-conversion.ts +226 -0
- package/src/util/config-defaults.spec.ts +315 -0
- package/src/util/config-defaults.ts +79 -0
- package/src/util/data-converter-spec-mockData.ts +231 -0
- package/src/util/data-converter.spec.ts +872 -0
- package/src/util/data-converter.ts +389 -0
- package/src/util/federation.ts +172 -0
- package/src/util/flexplm-connect.ts +169 -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 +40 -0
- package/src/util/mockData.ts +98 -0
- package/src/util/thumbnail-util.spec.ts +152 -0
- package/src/util/thumbnail-util.ts +128 -0
- package/src/util/type-conversion-utils-spec-mockData.ts +238 -0
- package/src/util/type-conversion-utils.spec.ts +601 -0
- package/src/util/type-conversion-utils.ts +345 -0
- package/src/util/type-defaults.spec.ts +592 -0
- package/src/util/type-defaults.ts +261 -0
- package/src/util/type-utils.spec.ts +227 -0
- package/src/util/type-utils.ts +124 -0
- package/tsconfig.json +27 -0
- package/tslint.json +57 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { FCConfig } from '../interfaces/interfaces';
|
|
2
|
+
import { ThumbnailUtil } from './thumbnail-util';
|
|
3
|
+
|
|
4
|
+
import { empty_custom_sizes, four_custom_sizes, thumbnail_content_entity, cuRficeyoStwTF_f_fileEntities } from './mockData';
|
|
5
|
+
|
|
6
|
+
describe('ThumbnailUtil Tests', () =>{
|
|
7
|
+
const config = {} as FCConfig;
|
|
8
|
+
describe('setOutboundThumbnail()', () =>{
|
|
9
|
+
const tu = new ThumbnailUtil(config);
|
|
10
|
+
beforeEach(() =>{
|
|
11
|
+
jest.clearAllMocks();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('no data', async () =>{
|
|
15
|
+
const data = {};
|
|
16
|
+
const event = {};
|
|
17
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
18
|
+
const keys = Object.keys(results);
|
|
19
|
+
|
|
20
|
+
expect(results).toEqual(data);
|
|
21
|
+
expect(keys.length).toEqual(0);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('remove thumbnail', async () =>{
|
|
25
|
+
const data = {};
|
|
26
|
+
const event = {
|
|
27
|
+
propertyDiffs: {
|
|
28
|
+
largeViewableDownloadUrl: {
|
|
29
|
+
oldValue: '123',
|
|
30
|
+
newValue: null
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
35
|
+
const keys = Object.keys(results);
|
|
36
|
+
|
|
37
|
+
expect(keys.length).toEqual(1);
|
|
38
|
+
expect(keys[0]).toEqual(ThumbnailUtil.NEW_THUMBNAIL_ID);
|
|
39
|
+
expect(results[ThumbnailUtil.NEW_THUMBNAIL_ID]).toEqual(ThumbnailUtil.REMOVE_THUMBNAIL);
|
|
40
|
+
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('calling getFileId - new thumbnail', async () =>{
|
|
44
|
+
const data = {};
|
|
45
|
+
const newDownloadUrl = 'https://api.vibeiq.com/dev/api/files/downloadUrl/w3ckfeGAD8ViOZj-%2Fcontent:E1iBQuWbr74lcdcw%2F9e30ds9o-d34b-451e-ae59-b4km36018d5a.png';
|
|
46
|
+
const oldDownloadUrl = 'xxx';
|
|
47
|
+
const thumbnailId = 'Eey3ZOiqdrUA84F8';
|
|
48
|
+
const event = {
|
|
49
|
+
newData: {
|
|
50
|
+
primaryViewableId: 'm5bJa4RtTLUtKBP5',
|
|
51
|
+
largeViewableDownloadUrl: newDownloadUrl
|
|
52
|
+
},
|
|
53
|
+
propertyDiffs: {
|
|
54
|
+
largeViewableDownloadUrl :{
|
|
55
|
+
newValue: newDownloadUrl,
|
|
56
|
+
oldValue: oldDownloadUrl
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const spyGetFileId = jest.spyOn(tu, 'getFileId');
|
|
62
|
+
spyGetFileId.mockReturnValue(Promise.resolve(thumbnailId));
|
|
63
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
64
|
+
const keys = Object.keys(results);
|
|
65
|
+
expect(keys.length).toEqual(1);
|
|
66
|
+
expect(keys[0]).toEqual(ThumbnailUtil.NEW_THUMBNAIL_ID);
|
|
67
|
+
const thumbnailValue = results[ThumbnailUtil.NEW_THUMBNAIL_ID];
|
|
68
|
+
expect(thumbnailValue).toEqual(thumbnailId);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('calling getFileId - existing thumbnail', async () =>{
|
|
72
|
+
const data = {};
|
|
73
|
+
const newDownloadUrl = 'https://api.vibeiq.com/dev/api/files/downloadUrl/w3ckfeGAD8ViOZj-%2Fcontent:E1iBQuWbr74lcdcw%2F9e30ds9o-d34b-451e-ae59-b4km36018d5a.png';
|
|
74
|
+
const thumbnailId = 'Eey3ZOiqdrUA84F8';
|
|
75
|
+
const event = {
|
|
76
|
+
newData: {
|
|
77
|
+
primaryViewableId: 'm5bJa4RtTLUtKBP5',
|
|
78
|
+
largeViewableDownloadUrl: newDownloadUrl
|
|
79
|
+
},
|
|
80
|
+
propertyDiffs: {}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const spyGetFileId = jest.spyOn(tu, 'getFileId');
|
|
84
|
+
spyGetFileId.mockReturnValue(Promise.resolve(thumbnailId));
|
|
85
|
+
const results = await tu.setOutboundThumbnail(data, event);
|
|
86
|
+
const keys = Object.keys(results);
|
|
87
|
+
expect(keys.length).toEqual(1);
|
|
88
|
+
expect(keys[0]).toEqual(ThumbnailUtil.EXISTING_THUMBNAIL_ID);
|
|
89
|
+
const thumbnailValue = results[ThumbnailUtil.EXISTING_THUMBNAIL_ID];
|
|
90
|
+
expect(thumbnailValue).toEqual(thumbnailId);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('getFileId', () =>{
|
|
95
|
+
const primaryFileId = 'yn2d5oHD4rXHRzyB';
|
|
96
|
+
beforeEach(() =>{
|
|
97
|
+
jest.clearAllMocks();
|
|
98
|
+
});
|
|
99
|
+
it('no custom sizes, default max_thumbnail_size - result large', async () =>{
|
|
100
|
+
const tu = new ThumbnailUtil(config);
|
|
101
|
+
const spyCustomSizes = jest.spyOn(tu, 'getCustomSizes');
|
|
102
|
+
spyCustomSizes.mockReturnValue(Promise.resolve(empty_custom_sizes));
|
|
103
|
+
const spyContentEntity = jest.spyOn(tu, 'getContentEntity');
|
|
104
|
+
const content = thumbnail_content_entity;
|
|
105
|
+
spyContentEntity.mockReturnValue(Promise.resolve(content));
|
|
106
|
+
|
|
107
|
+
const spyGetFileEntities = jest.spyOn(tu, 'getFileEntities');
|
|
108
|
+
spyGetFileEntities.mockReturnValue(Promise.resolve(cuRficeyoStwTF_f_fileEntities));
|
|
109
|
+
|
|
110
|
+
const results = await tu.getFileId(primaryFileId);
|
|
111
|
+
expect(results).toEqual('vo4N4mCd-tFrw101');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('no custom sizes, 750 * 1_024 max_thumbnail_size - result medium', async () =>{
|
|
115
|
+
const config1 = {
|
|
116
|
+
max_thumbnail_size: 750 * 1_024
|
|
117
|
+
} as any as FCConfig;
|
|
118
|
+
const tu = new ThumbnailUtil(config1);
|
|
119
|
+
const spyCustomSizes = jest.spyOn(tu, 'getCustomSizes');
|
|
120
|
+
spyCustomSizes.mockReturnValue(Promise.resolve(empty_custom_sizes));
|
|
121
|
+
const spyContentEntity = jest.spyOn(tu, 'getContentEntity');
|
|
122
|
+
const content = thumbnail_content_entity;
|
|
123
|
+
spyContentEntity.mockReturnValue(Promise.resolve(content));
|
|
124
|
+
|
|
125
|
+
const spyGetFileEntities = jest.spyOn(tu, 'getFileEntities');
|
|
126
|
+
spyGetFileEntities.mockReturnValue(Promise.resolve(cuRficeyoStwTF_f_fileEntities));
|
|
127
|
+
|
|
128
|
+
const results = await tu.getFileId(primaryFileId);
|
|
129
|
+
expect(results).toEqual('AsRvJenpeqxksUNW');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('custom sizes, 750 * 1_024 max_thumbnail_size - result CS_500Id', async () =>{
|
|
133
|
+
console.log('custom sizes, 750 * 1_024 max_thumbnail_size - result CS_500Id');
|
|
134
|
+
const config1 = {
|
|
135
|
+
max_thumbnail_size: 750 * 1_024
|
|
136
|
+
} as any as FCConfig;
|
|
137
|
+
const tu = new ThumbnailUtil(config1);
|
|
138
|
+
const spyCustomSizes = jest.spyOn(tu, 'getCustomSizes');
|
|
139
|
+
spyCustomSizes.mockReturnValue(Promise.resolve(four_custom_sizes));
|
|
140
|
+
const spyContentEntity = jest.spyOn(tu, 'getContentEntity');
|
|
141
|
+
const content = thumbnail_content_entity;
|
|
142
|
+
spyContentEntity.mockReturnValue(Promise.resolve(content));
|
|
143
|
+
|
|
144
|
+
const spyGetFileEntities = jest.spyOn(tu, 'getFileEntities');
|
|
145
|
+
spyGetFileEntities.mockReturnValue(Promise.resolve(cuRficeyoStwTF_f_fileEntities));
|
|
146
|
+
|
|
147
|
+
const results = await tu.getFileId(primaryFileId);
|
|
148
|
+
expect(results).toEqual('rBaHc1J2xdOWdbhI');
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
});
|
|
152
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Logger } from '@contrail/app-framework';
|
|
2
|
+
import { Entities } from '@contrail/sdk';
|
|
3
|
+
import { FCConfig } from '../interfaces/interfaces';
|
|
4
|
+
|
|
5
|
+
export class ThumbnailUtil {
|
|
6
|
+
private max_thumbnail_size = 5 * 1_024 * 1_024;
|
|
7
|
+
private entities: Entities;
|
|
8
|
+
static NEW_THUMBNAIL_ID = 'NEW_THUMBNAIL_ID';
|
|
9
|
+
static EXISTING_THUMBNAIL_ID = 'EXISTING_THUMBNAIL_ID';
|
|
10
|
+
static REMOVE_THUMBNAIL = 'REMOVE_THUMBNAIL';
|
|
11
|
+
constructor(private config: FCConfig){
|
|
12
|
+
this.entities = new Entities();
|
|
13
|
+
if(this.config['max_thumbnail_size']){
|
|
14
|
+
this.max_thumbnail_size = this.config['max_thumbnail_size'];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async setOutboundThumbnail(data, event){
|
|
18
|
+
if(event?.newData?.primaryViewableId && event?.newData?.largeViewableDownloadUrl){
|
|
19
|
+
const primaryViewableId = event.newData.primaryViewableId;
|
|
20
|
+
|
|
21
|
+
//get custom sizes
|
|
22
|
+
const fileId = await this.getFileId(primaryViewableId);
|
|
23
|
+
|
|
24
|
+
if(fileId){
|
|
25
|
+
const key = (event?.propertyDiffs?.largeViewableDownloadUrl)
|
|
26
|
+
? ThumbnailUtil.NEW_THUMBNAIL_ID
|
|
27
|
+
: ThumbnailUtil.EXISTING_THUMBNAIL_ID;
|
|
28
|
+
data[key] = fileId;
|
|
29
|
+
}
|
|
30
|
+
} else if(event?.propertyDiffs?.largeViewableDownloadUrl?.oldValue && !event?.propertyDiffs?.largeViewableDownloadUrl?.newValue){
|
|
31
|
+
data[ThumbnailUtil.NEW_THUMBNAIL_ID] = ThumbnailUtil.REMOVE_THUMBNAIL;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async getFileId(primaryViewableId: string): Promise<string> {
|
|
38
|
+
console.info('getFileId()-' + primaryViewableId);
|
|
39
|
+
const sizes = await this.getCustomSizes();
|
|
40
|
+
|
|
41
|
+
const OOBSizes = [{ slug: 'largeViewable' }, { slug: 'mediumViewable' }, { slug: 'smallViewable' }, { slug: 'tinyViewable' }];
|
|
42
|
+
sizes.push(...OOBSizes);
|
|
43
|
+
console.info('sizes: ' + JSON.stringify(sizes));
|
|
44
|
+
|
|
45
|
+
//get Content
|
|
46
|
+
const content = await this.getContentEntity(primaryViewableId);
|
|
47
|
+
if(Logger.isDebugOn()){
|
|
48
|
+
console.debug('content: ' + JSON.stringify(content));
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
if (!content) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
//get file entities
|
|
55
|
+
const contentKeys = Object.getOwnPropertyNames(content);
|
|
56
|
+
const fileEntityIds = [];
|
|
57
|
+
for (const size of sizes) {
|
|
58
|
+
const key = size.slug + 'Id';
|
|
59
|
+
if (contentKeys.includes(key) && !fileEntityIds.includes(content[key])) {
|
|
60
|
+
fileEntityIds.push(content[key]);
|
|
61
|
+
size['fileId'] = content[key];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const fileResults = await this.getFileEntities(fileEntityIds);
|
|
66
|
+
|
|
67
|
+
if(Logger.isDebugOn()){
|
|
68
|
+
console.debug('fileResults: ' + JSON.stringify(fileResults));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Finding largest image that is under the max limit
|
|
72
|
+
let fileId = undefined;
|
|
73
|
+
let tempFileSize = 0;
|
|
74
|
+
const isDebugOn = Logger.isDebugOn();
|
|
75
|
+
for (const sizeObj of sizes) {
|
|
76
|
+
if(isDebugOn){
|
|
77
|
+
console.debug('size: ' + JSON.stringify(sizeObj));
|
|
78
|
+
}
|
|
79
|
+
if (sizeObj['fileId']) {
|
|
80
|
+
const file = fileResults.find(f => f['id'] === sizeObj['fileId']);
|
|
81
|
+
if (file['size'] > tempFileSize && file['size'] < this.max_thumbnail_size) {
|
|
82
|
+
tempFileSize = file['size'];
|
|
83
|
+
fileId = file['id'];
|
|
84
|
+
if(isDebugOn){
|
|
85
|
+
console.debug('fileId: ' + fileId);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
console.info('getFileId(): returning-' + fileId);
|
|
91
|
+
return fileId;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async getCustomSizes() {
|
|
95
|
+
const customSizes = await this.entities.get({
|
|
96
|
+
entityName: 'content-custom-size'
|
|
97
|
+
});
|
|
98
|
+
const sizes = [];
|
|
99
|
+
sizes.push(...customSizes);
|
|
100
|
+
return sizes;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async getContentEntity(primaryViewableId: any) {
|
|
104
|
+
const criteria = {
|
|
105
|
+
id: primaryViewableId
|
|
106
|
+
};
|
|
107
|
+
const contentResults = await this.entities.get({
|
|
108
|
+
entityName: 'content',
|
|
109
|
+
criteria
|
|
110
|
+
});
|
|
111
|
+
console.info('contentResults: ' + JSON.stringify(contentResults));
|
|
112
|
+
const content = (contentResults && contentResults[0]) ? contentResults[0] : undefined;
|
|
113
|
+
return content;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async getFileEntities(fileEntityIds: any[]) {
|
|
117
|
+
const criteria = {
|
|
118
|
+
ids: fileEntityIds
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const fileResults = await this.entities.get({
|
|
122
|
+
entityName: 'file',
|
|
123
|
+
criteria
|
|
124
|
+
});
|
|
125
|
+
return fileResults;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
@@ -0,0 +1,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
|
+
vibe2flex: {
|
|
164
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
165
|
+
rekey: {
|
|
166
|
+
retailOwner: 'owner',
|
|
167
|
+
retailIntroDate: 'introDate'
|
|
168
|
+
},
|
|
169
|
+
getSoftType: () => 'Revisable Entity\\prefix',
|
|
170
|
+
getClass: () => 'LCSRevisableEntity'
|
|
171
|
+
},
|
|
172
|
+
flex2vibe: {
|
|
173
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
174
|
+
rekey: {
|
|
175
|
+
owner: 'retailOwner',
|
|
176
|
+
introDate: 'retailIntroDate'
|
|
177
|
+
},
|
|
178
|
+
getClass: () => 'custom-entity',
|
|
179
|
+
getSoftType: () => 'custom-entity:prefix',
|
|
180
|
+
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
catName: {
|
|
184
|
+
getIdentifierProperties: () => ['catName', 'catNumber'],
|
|
185
|
+
getInformationalProperties: () => ['longName'],
|
|
186
|
+
vibe2flex: {
|
|
187
|
+
transformOrder: [],
|
|
188
|
+
getSoftType: () => 'Last\\catName',
|
|
189
|
+
getClass: () => 'LCSLast'
|
|
190
|
+
},
|
|
191
|
+
flex2vibe: {
|
|
192
|
+
transformOrder: [],
|
|
193
|
+
getClass: () => 'custom-entity',
|
|
194
|
+
getSoftType: () => 'custom-entity:catName',
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
partnerOrg: {
|
|
199
|
+
vibe2flex: {
|
|
200
|
+
transformOrder: [],
|
|
201
|
+
getSoftType: () => 'Business Object\\partnerOrg',
|
|
202
|
+
getClass: () => 'LCSLifecycleManaged'
|
|
203
|
+
},
|
|
204
|
+
flex2vibe: {
|
|
205
|
+
transformOrder: [],
|
|
206
|
+
getClass: () => 'custom-entity',
|
|
207
|
+
getSoftType: () => 'custom-entity:partnerOrg',
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
catFamily: {
|
|
212
|
+
vibe2flex: {
|
|
213
|
+
transformOrder: [],
|
|
214
|
+
getSoftType: () => 'Revisable Entity\\catFamily',
|
|
215
|
+
getClass: () => 'LCSRevisableEntity'
|
|
216
|
+
},
|
|
217
|
+
flex2vibe: {
|
|
218
|
+
transformOrder: [],
|
|
219
|
+
getClass: () => 'custom-entity',
|
|
220
|
+
getSoftType: () => 'custom-entity:catFamily',
|
|
221
|
+
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
formName: {
|
|
225
|
+
vibe2flex: {
|
|
226
|
+
transformOrder: [],
|
|
227
|
+
getSoftType: () => 'Material\\form',
|
|
228
|
+
getClass: () => 'LCSMaterial'
|
|
229
|
+
},
|
|
230
|
+
flex2vibe: {
|
|
231
|
+
transformOrder: [],
|
|
232
|
+
getClass: () => 'custom-entity',
|
|
233
|
+
getSoftType: () => 'custom-entity:formName',
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
};
|