@contrail/flexplm 1.5.0-alpha.98b8b06 → 1.5.0
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 +45 -0
- package/lib/entity-processor/base-entity-processor.d.ts +0 -65
- package/lib/entity-processor/base-entity-processor.js +0 -71
- 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 +1 -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 +1 -152
- package/lib/util/type-conversion-utils.js +1 -155
- package/lib/util/type-defaults.d.ts +0 -66
- package/lib/util/type-defaults.js +0 -66
- 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 +689 -0
- package/src/entity-processor/base-entity-processor.ts +583 -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 +386 -0
- package/src/transform/identifier-conversion.ts +282 -0
- package/src/util/config-defaults.spec.ts +445 -0
- package/src/util/config-defaults.ts +106 -0
- package/src/util/data-converter-spec-mockData.ts +231 -0
- package/src/util/data-converter.spec.ts +1622 -0
- package/src/util/data-converter.ts +819 -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 +272 -0
- package/src/util/type-conversion-utils.spec.ts +1031 -0
- package/src/util/type-conversion-utils.ts +490 -0
- package/src/util/type-defaults.spec.ts +797 -0
- package/src/util/type-defaults.ts +320 -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 -4
- package/lib/cli/commands/compile.js +0 -73
- package/lib/cli/commands/compile.spec.d.ts +0 -1
- package/lib/cli/commands/compile.spec.js +0 -80
- package/lib/cli/commands/create.d.ts +0 -5
- package/lib/cli/commands/create.js +0 -77
- package/lib/cli/commands/create.spec.d.ts +0 -1
- package/lib/cli/commands/create.spec.js +0 -78
- package/lib/cli/commands/upload.d.ts +0 -17
- package/lib/cli/commands/upload.js +0 -228
- package/lib/cli/commands/upload.spec.d.ts +0 -1
- package/lib/cli/commands/upload.spec.js +0 -88
- package/lib/cli/index.d.ts +0 -5
- package/lib/cli/index.js +0 -70
- package/lib/cli/index.spec.d.ts +0 -1
- package/lib/cli/index.spec.js +0 -85
- package/lib/cli/template/mapping-template.ts.template +0 -62
- package/lib/interfaces/mapping-file.d.ts +0 -460
- package/lib/interfaces/mapping-file.js +0 -2
- package/scripts/copy-template.js +0 -10
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LogLevel, Logger } from '@contrail/app-framework';
|
|
2
|
+
|
|
3
|
+
export async function setLoggerConfig(appConfig) {
|
|
4
|
+
let logLevel: LogLevel = LogLevel.INFO;
|
|
5
|
+
if(!appConfig.logLevel) {
|
|
6
|
+
//pass
|
|
7
|
+
} else if (appConfig.logLevel === 'error') {
|
|
8
|
+
logLevel = LogLevel.ERROR;
|
|
9
|
+
} else if (appConfig.logLevel === 'warn') {
|
|
10
|
+
logLevel = LogLevel.WARN;
|
|
11
|
+
} else if (appConfig.logLevel === 'info') {
|
|
12
|
+
logLevel = LogLevel.INFO;
|
|
13
|
+
} else if (appConfig.logLevel === 'debug') {
|
|
14
|
+
logLevel = LogLevel.DEBUG;
|
|
15
|
+
} else {
|
|
16
|
+
console.log('could not parse log level:', appConfig);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Logger.setConfig({logLevel: logLevel});
|
|
20
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
// LCSRevisableEntity: {
|
|
37
|
+
// getMapKey: (object) =>{ return object;}
|
|
38
|
+
// },
|
|
39
|
+
// LCSLast: {
|
|
40
|
+
// getMapKey: (object) => {return object;}
|
|
41
|
+
// },
|
|
42
|
+
// LCSMaterial: {
|
|
43
|
+
// getMapKey: (object) =>{ return object;}
|
|
44
|
+
// },
|
|
45
|
+
// LCSBusinessObject: {
|
|
46
|
+
// getMapKey: (object) => {return object;}
|
|
47
|
+
// }
|
|
48
|
+
// },
|
|
49
|
+
},
|
|
50
|
+
LCSProduct: {
|
|
51
|
+
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
52
|
+
vibe2flex: {
|
|
53
|
+
getClass: () => 'LCSProduct',
|
|
54
|
+
getSoftType: (entity /*, dependencies*/) =>{
|
|
55
|
+
const prodType = entity['prodType'];
|
|
56
|
+
let val = '';
|
|
57
|
+
switch (prodType) {
|
|
58
|
+
case 'acc':
|
|
59
|
+
val = 'Product\\Accesories';
|
|
60
|
+
break;
|
|
61
|
+
case 'app':
|
|
62
|
+
val = 'Product\\Apparel';
|
|
63
|
+
break;
|
|
64
|
+
case 'eqp':
|
|
65
|
+
val = 'Product\\Equipment';
|
|
66
|
+
break;
|
|
67
|
+
case 'foot':
|
|
68
|
+
val = 'Product\\Footwear';
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return val;
|
|
73
|
+
},
|
|
74
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
|
|
75
|
+
rekey: {
|
|
76
|
+
productName: 'name',
|
|
77
|
+
vibeIQIdentifier: 'itemNumber'
|
|
78
|
+
},
|
|
79
|
+
valueTransform: {
|
|
80
|
+
transformEx: (row/*, dependencies*/) => {
|
|
81
|
+
return row['otherProp'] + 'xxx';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
},
|
|
86
|
+
flex2vibe: {
|
|
87
|
+
getClass: () => 'item',
|
|
88
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
89
|
+
rekey: {
|
|
90
|
+
itemNumber: 'vibeIQIdentifier',
|
|
91
|
+
name: 'productName',
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
LCSSKU: {
|
|
96
|
+
vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
|
|
97
|
+
vibe2flex: {
|
|
98
|
+
getClass: () => 'LCSSKU',
|
|
99
|
+
getSoftType: (entity /*, dependencies*/) =>{
|
|
100
|
+
const prodType = entity['prodType'];
|
|
101
|
+
let val = '';
|
|
102
|
+
switch (prodType) {
|
|
103
|
+
case 'acc':
|
|
104
|
+
val = 'Product\\Accesories';
|
|
105
|
+
break;
|
|
106
|
+
case 'app':
|
|
107
|
+
val = 'Product\\Apparel';
|
|
108
|
+
break;
|
|
109
|
+
case 'eqp':
|
|
110
|
+
val = 'Product\\Equipment';
|
|
111
|
+
break;
|
|
112
|
+
case 'foot':
|
|
113
|
+
val = 'Product\\Footwear';
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return val;
|
|
118
|
+
},
|
|
119
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
120
|
+
rekey: {
|
|
121
|
+
skuName: 'optionName',
|
|
122
|
+
vibeIQIdentifier: 'itemNumber'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
flex2vibe: {
|
|
126
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
127
|
+
rekey: {
|
|
128
|
+
itemNumber: 'vibeIQIdentifier',
|
|
129
|
+
optionName: 'skuName',
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
packaging: {
|
|
135
|
+
vibe2flex: {
|
|
136
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
137
|
+
rekey: {
|
|
138
|
+
retailPackType: 'packType',
|
|
139
|
+
retailIntroDate: 'introDate'
|
|
140
|
+
},
|
|
141
|
+
getSoftType: () => 'Revisable Entity\\packaging',
|
|
142
|
+
getClass: () => 'LCSRevisableEntity'
|
|
143
|
+
},
|
|
144
|
+
flex2vibe: {
|
|
145
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
146
|
+
rekey: {
|
|
147
|
+
packType: 'retailPackType',
|
|
148
|
+
introDate: 'retailIntroDate'
|
|
149
|
+
},
|
|
150
|
+
getClass: () => 'custom-entity',
|
|
151
|
+
getSoftType: () => 'custom-entity:pack',
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
prefix: {
|
|
156
|
+
vibe2flex: {
|
|
157
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
158
|
+
rekey: {
|
|
159
|
+
retailOwner: 'owner',
|
|
160
|
+
retailIntroDate: 'introDate'
|
|
161
|
+
},
|
|
162
|
+
getSoftType: () => 'Revisable Entity\\prefix',
|
|
163
|
+
getClass: () => 'LCSRevisableEntity'
|
|
164
|
+
},
|
|
165
|
+
flex2vibe: {
|
|
166
|
+
transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
|
|
167
|
+
rekey: {
|
|
168
|
+
owner: 'retailOwner',
|
|
169
|
+
introDate: 'retailIntroDate'
|
|
170
|
+
},
|
|
171
|
+
getClass: () => 'custom-entity',
|
|
172
|
+
getSoftType: () => 'custom-entity:prefix',
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
catName: {
|
|
177
|
+
getIdentifierProperties: () => ['catName', 'catNumber'],
|
|
178
|
+
getInformationalProperties: () => ['longName'],
|
|
179
|
+
vibe2flex: {
|
|
180
|
+
transformOrder: [],
|
|
181
|
+
getSoftType: () => 'Revisable Entity\\catName',
|
|
182
|
+
getClass: () => 'LCSLast'
|
|
183
|
+
},
|
|
184
|
+
flex2vibe: {
|
|
185
|
+
transformOrder: [],
|
|
186
|
+
getClass: () => 'custom-entity',
|
|
187
|
+
getSoftType: () => 'custom-entity:catName',
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
partnerOrg: {
|
|
192
|
+
vibe2flex: {
|
|
193
|
+
transformOrder: [],
|
|
194
|
+
getSoftType: () => 'Business Object\\partnerOrg',
|
|
195
|
+
getClass: () => 'LCSLifecycleManaged'
|
|
196
|
+
},
|
|
197
|
+
flex2vibe: {
|
|
198
|
+
transformOrder: [],
|
|
199
|
+
getClass: () => 'custom-entity',
|
|
200
|
+
getSoftType: () => 'custom-entity:partnerOrg',
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
catFamily: {
|
|
205
|
+
vibe2flex: {
|
|
206
|
+
transformOrder: [],
|
|
207
|
+
getSoftType: () => 'Revisable Entity\\catFamily',
|
|
208
|
+
getClass: () => 'LCSRevisableEntity'
|
|
209
|
+
},
|
|
210
|
+
flex2vibe: {
|
|
211
|
+
transformOrder: [],
|
|
212
|
+
getClass: () => 'custom-entity',
|
|
213
|
+
getSoftType: () => 'custom-entity:catFamily',
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
formName: {
|
|
218
|
+
vibe2flex: {
|
|
219
|
+
transformOrder: [],
|
|
220
|
+
getSoftType: () => 'Material\\form',
|
|
221
|
+
getClass: () => 'LCSMaterial'
|
|
222
|
+
},
|
|
223
|
+
flex2vibe: {
|
|
224
|
+
transformOrder: [],
|
|
225
|
+
getClass: () => 'custom-entity',
|
|
226
|
+
getSoftType: () => 'custom-entity:formName',
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
|
|
2
|
+
const maps = require('./map-util-spec-mockData').mapping;
|
|
3
|
+
|
|
4
|
+
const mockData = {
|
|
5
|
+
file1: maps
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const mockGetMapFileFunction = jest.fn(async (fileId) =>{
|
|
9
|
+
return mockData[fileId];
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import { Entities } from '@contrail/sdk';
|
|
14
|
+
import { MapFileUtil } from '@contrail/transform-data';
|
|
15
|
+
import { MapUtil } from './map-utils';
|
|
16
|
+
|
|
17
|
+
describe('getMapKey', () =>{
|
|
18
|
+
const transformMapFile = 'file1';
|
|
19
|
+
const mapFileUtil = new MapFileUtil(new Entities());
|
|
20
|
+
let spy;
|
|
21
|
+
beforeAll(() =>{
|
|
22
|
+
spy = jest.spyOn(mapFileUtil, 'getMapFile').mockImplementation(mockGetMapFileFunction);
|
|
23
|
+
});
|
|
24
|
+
beforeEach(()=>{
|
|
25
|
+
spy.mockClear();
|
|
26
|
+
});
|
|
27
|
+
afterAll(() =>{
|
|
28
|
+
spy.mockRestore();
|
|
29
|
+
});
|
|
30
|
+
it('custom-entity:pack', async () =>{
|
|
31
|
+
const entity = {
|
|
32
|
+
typePath: 'custom-entity:pack',
|
|
33
|
+
entityType: 'custom-entity'
|
|
34
|
+
}
|
|
35
|
+
const expectedMapKey = 'packaging';
|
|
36
|
+
|
|
37
|
+
const results:string = await MapUtil.getMapKey(transformMapFile, mapFileUtil, entity, entity.entityType, 'vibe2flex');;
|
|
38
|
+
expect(results).toEqual(expectedMapKey);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('custom-entity:prefix', async () =>{
|
|
42
|
+
const entity = {
|
|
43
|
+
typePath: 'custom-entity:prefix',
|
|
44
|
+
entityType: 'custom-entity'
|
|
45
|
+
}
|
|
46
|
+
const expectedMapKey = 'prefix';
|
|
47
|
+
|
|
48
|
+
const results:string = await MapUtil.getMapKey(transformMapFile, mapFileUtil, entity, entity.entityType, 'vibe2flex');;
|
|
49
|
+
expect(results).toEqual(expectedMapKey);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('color - no mapping exists', async () =>{
|
|
53
|
+
const entity = {
|
|
54
|
+
typePath: 'color',
|
|
55
|
+
entityType: 'color'
|
|
56
|
+
}
|
|
57
|
+
const expectedMapKey = undefined;
|
|
58
|
+
|
|
59
|
+
const results:string = await MapUtil.getMapKey(transformMapFile, mapFileUtil, entity, entity.entityType, 'vibe2flex');;
|
|
60
|
+
expect(results).toEqual(expectedMapKey);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('getFullMapSection', () =>{
|
|
66
|
+
const transformMapFile = 'file1';
|
|
67
|
+
const mapFileUtil = new MapFileUtil(new Entities());
|
|
68
|
+
let spy;
|
|
69
|
+
beforeAll(() =>{
|
|
70
|
+
spy = jest.spyOn(mapFileUtil, 'getMapFile').mockImplementation(mockGetMapFileFunction);
|
|
71
|
+
});
|
|
72
|
+
beforeEach(()=>{
|
|
73
|
+
spy.mockClear();
|
|
74
|
+
});
|
|
75
|
+
afterAll(() =>{
|
|
76
|
+
spy.mockRestore();
|
|
77
|
+
});
|
|
78
|
+
it('custom-entity:pack', async () =>{
|
|
79
|
+
const mapKey = 'packaging';
|
|
80
|
+
|
|
81
|
+
const mapSection = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
|
|
82
|
+
expect(mapSection).toHaveProperty('vibe2flex');
|
|
83
|
+
expect(mapSection).toHaveProperty('flex2vibe');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('custom-entity:catName', async () =>{
|
|
87
|
+
const mapKey = 'catName';
|
|
88
|
+
|
|
89
|
+
const mapSection = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
|
|
90
|
+
expect(mapSection).toHaveProperty('vibe2flex');
|
|
91
|
+
expect(mapSection).toHaveProperty('flex2vibe');
|
|
92
|
+
expect(mapSection).toHaveProperty('getIdentifierProperties');
|
|
93
|
+
expect(mapSection).toHaveProperty('getInformationalProperties');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('color - no mapping exists', async () =>{
|
|
97
|
+
const mapKey = 'color';
|
|
98
|
+
|
|
99
|
+
const mapSection = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
|
|
100
|
+
expect(mapSection).toBeUndefined();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MapFileUtil } from '@contrail/transform-data';
|
|
2
|
+
export class MapUtil {
|
|
3
|
+
/** Transforms the data, assumes mapSectionKey has been correctly determined.
|
|
4
|
+
*
|
|
5
|
+
* @param transformMapFile id of map file
|
|
6
|
+
* @param mapFileUtil
|
|
7
|
+
* @param data
|
|
8
|
+
* @param mapSectionKey key for section of map file
|
|
9
|
+
* @param direction vibe2flex or flex2vibe
|
|
10
|
+
* @param transformTaskOrderKey key for the list of tasks to be processed. default is 'transformOrder'
|
|
11
|
+
* @returns The converted data
|
|
12
|
+
*/
|
|
13
|
+
static async applyTransformMap(transformMapFile, mapFileUtil, data: any, mapSectionKey: string, direction: string, transformTaskOrderKey: string = 'transformOrder'): Promise<any> {
|
|
14
|
+
return await mapFileUtil.applyTransformMap(transformMapFile, data, mapSectionKey, direction, transformTaskOrderKey);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Returns the mapKey based on the 'typeConversion' section of the map file.
|
|
18
|
+
* If the map file doesn't have a section for the type in question, 'undefined' is returned.
|
|
19
|
+
*
|
|
20
|
+
* @param fileId
|
|
21
|
+
* @param mapFileUtil
|
|
22
|
+
* @param data The full object
|
|
23
|
+
* @param type The entity or object class of the object. The functions are keyed based on this.
|
|
24
|
+
* @param direction
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
static async getMapKey(transformMapFile, mapFileUtil: MapFileUtil, data: any, type: string, direction: string): Promise<string> {
|
|
28
|
+
return await mapFileUtil.getMapKey(transformMapFile, data, type, direction);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Returns the full map section with both directions; identifier and informational properties; etc.
|
|
32
|
+
*
|
|
33
|
+
* @param transformMapFile id if map file
|
|
34
|
+
* @param mapFileUtil
|
|
35
|
+
* @param mapSectionKey key of the map section
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
static async getFullMapSection(transformMapFile: string, mapFileUtil: MapFileUtil, mapSectionKey: string):Promise<any> {
|
|
39
|
+
return await mapFileUtil.getFullMapSection(transformMapFile, mapSectionKey);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export const empty_custom_sizes = [];
|
|
2
|
+
export const four_custom_sizes = [
|
|
3
|
+
{
|
|
4
|
+
size: 1000,
|
|
5
|
+
id: '-QwFOWnCs0Gb5jkA',
|
|
6
|
+
slug: 'CS_1000',
|
|
7
|
+
name: 'CS_1000'
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
size: 300,
|
|
11
|
+
id: 'AKXOowvhJRnkerG8',
|
|
12
|
+
slug: 'CS_300',
|
|
13
|
+
name: 'CS_300'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
size: 500,
|
|
17
|
+
id: '9asQ65N188RIYgnh',
|
|
18
|
+
slug: 'CS_500',
|
|
19
|
+
name: 'CS_500'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
size: 800,
|
|
23
|
+
id: 'xkzhwE4nJ6iRwfvP',
|
|
24
|
+
slug: 'CS_800',
|
|
25
|
+
name: 'CS_800'
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export const thumbnail_content_entity = {
|
|
30
|
+
fileName: 'JACKET 300_SOLDIER OLIVE.png',
|
|
31
|
+
primaryFileId: 'yn2d5oHD4rXHRzyB',
|
|
32
|
+
primaryFileUrl: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2Ff646d3cd-e23a-4689-bd16-0301d2036720.png',
|
|
33
|
+
primaryFile: {
|
|
34
|
+
fileName: 'JACKET 300_SOLDIER OLIVE.png',
|
|
35
|
+
id: 'yn2d5oHD4rXHRzyB',
|
|
36
|
+
size: 1757973
|
|
37
|
+
},
|
|
38
|
+
tinyViewableId: '6HWzJrQ-Jx1iefmj',
|
|
39
|
+
tinyViewableUrl: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2Fb68f8652-f33f-452f-ae34-25397b4521eb.png',
|
|
40
|
+
tinyViewable: {
|
|
41
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_tiny.png',
|
|
42
|
+
id: '6HWzJrQ-Jx1iefmj',
|
|
43
|
+
size: 1784
|
|
44
|
+
},
|
|
45
|
+
smallViewableId: 'D3WRW4iRmjLzp5VX',
|
|
46
|
+
smallViewableUrl: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2F541c53f8-fd85-418e-ae28-ad7410658b90.png',
|
|
47
|
+
smallViewable: {
|
|
48
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_small.png',
|
|
49
|
+
id: 'D3WRW4iRmjLzp5VX',
|
|
50
|
+
size: 8699
|
|
51
|
+
},
|
|
52
|
+
mediumViewableId: 'AsRvJenpeqxksUNW',
|
|
53
|
+
mediumViewableUrl: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2Fe803c2d3-3e1b-4d9c-9bb9-2c488f1f295b.png',
|
|
54
|
+
mediumViewable: {
|
|
55
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_medium.png',
|
|
56
|
+
id: 'AsRvJenpeqxksUNW',
|
|
57
|
+
size: 77558
|
|
58
|
+
},
|
|
59
|
+
largeViewableId: 'vo4N4mCd-tFrw101',
|
|
60
|
+
largeViewableUrl: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2Fb1b7a55c-b8ba-4857-be4e-e1c3f11d8e9a.png',
|
|
61
|
+
largeViewable: {
|
|
62
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_large.png',
|
|
63
|
+
id: 'vo4N4mCd-tFrw101',
|
|
64
|
+
size: 1781538
|
|
65
|
+
},
|
|
66
|
+
CS_300Id: '6A5AG33nVu3Z6ogO',
|
|
67
|
+
CS_300Url: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2F3f2ea306-a77f-4cc3-a49a-75fb5d8b113c.png',
|
|
68
|
+
CS_300: {
|
|
69
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_CS_300.png',
|
|
70
|
+
id: '6A5AG33nVu3Z6ogO',
|
|
71
|
+
size: 141153
|
|
72
|
+
},
|
|
73
|
+
CS_500Id: 'rBaHc1J2xdOWdbhI',
|
|
74
|
+
CS_500Url: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2F979c8c65-b63f-4220-aa2e-11520f2f68bf.png',
|
|
75
|
+
CS_500: {
|
|
76
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_CS_500.png',
|
|
77
|
+
id: 'rBaHc1J2xdOWdbhI',
|
|
78
|
+
size: 382057
|
|
79
|
+
},
|
|
80
|
+
CS_800Id: 'ZPAeYI3JiqjQ7unY',
|
|
81
|
+
CS_800Url: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2Fc58eeffa-2592-4698-a058-19281cda447c.png',
|
|
82
|
+
CS_800:{
|
|
83
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_CS_800.png',
|
|
84
|
+
id: 'ZPAeYI3JiqjQ7unY',
|
|
85
|
+
size: 1008702
|
|
86
|
+
},
|
|
87
|
+
CS_1000Id: 'Hg_CthwsD4ozopCb',
|
|
88
|
+
CS_1000Url: 'https://api.vibeiq.com/prod/api/files/downloadUrl/5LZnKVTNxvwMqufy%2Fcontent:cuRficeyoStwTF-f%2F2c827c7b-361b-4e05-b77d-4280294f9d9c.png',
|
|
89
|
+
CS_1000: {
|
|
90
|
+
fileName: 'JACKET 300_SOLDIER OLIVE_CS_1000.png',
|
|
91
|
+
id: 'Hg_CthwsD4ozopCb',
|
|
92
|
+
size: 1605889
|
|
93
|
+
},
|
|
94
|
+
createdOn: '2023-07-05T15:02:13.950Z',
|
|
95
|
+
orgId: '5LZnKVTNxvwMqufy',
|
|
96
|
+
id: 'cuRficeyoStwTF-f',
|
|
97
|
+
contentType: 'image/png',
|
|
98
|
+
createdById: 'SWIFPZeZzkBvrSLD',
|
|
99
|
+
updatedById: 'SWIFPZeZzkBvrSLD',
|
|
100
|
+
fileSize: 1757973
|
|
101
|
+
};
|