@contrail/flexplm 1.3.0 → 1.3.1-alpha.585afc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/commands/compile.d.ts +1 -0
- package/lib/cli/commands/compile.js +71 -0
- package/lib/cli/commands/compile.spec.d.ts +1 -0
- package/lib/cli/commands/compile.spec.js +80 -0
- package/lib/cli/commands/create.d.ts +1 -0
- package/lib/cli/commands/create.js +75 -0
- package/lib/cli/commands/create.spec.d.ts +1 -0
- package/lib/cli/commands/create.spec.js +78 -0
- package/lib/cli/commands/upload.d.ts +10 -0
- package/lib/cli/commands/upload.js +219 -0
- package/lib/cli/commands/upload.spec.d.ts +1 -0
- package/lib/cli/commands/upload.spec.js +88 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +64 -0
- package/lib/cli/index.spec.d.ts +1 -0
- package/lib/cli/index.spec.js +79 -0
- package/lib/cli/template/mapping-template.ts.template +18 -0
- package/lib/entity-processor/base-entity-processor.d.ts +89 -42
- package/lib/entity-processor/base-entity-processor.js +438 -385
- package/lib/entity-processor/base-entity-processor.spec.d.ts +1 -1
- package/lib/entity-processor/base-entity-processor.spec.js +398 -397
- package/lib/flexplm-request.d.ts +3 -3
- package/lib/flexplm-request.js +34 -34
- package/lib/flexplm-utils.d.ts +5 -5
- package/lib/flexplm-utils.js +33 -33
- package/lib/flexplm-utils.spec.d.ts +1 -1
- package/lib/flexplm-utils.spec.js +26 -26
- package/lib/index.d.ts +23 -22
- package/lib/index.js +39 -38
- package/lib/interfaces/interfaces.d.ts +105 -105
- package/lib/interfaces/interfaces.js +2 -2
- package/lib/interfaces/item-family-changes.d.ts +20 -20
- package/lib/interfaces/item-family-changes.js +56 -56
- package/lib/interfaces/mapping-file.d.ts +429 -0
- package/lib/interfaces/mapping-file.js +2 -0
- package/lib/interfaces/publish-change-data.d.ts +19 -19
- package/lib/interfaces/publish-change-data.js +32 -32
- package/lib/publish/base-process-publish-assortment-callback.d.ts +9 -9
- package/lib/publish/base-process-publish-assortment-callback.js +38 -38
- package/lib/publish/base-process-publish-assortment.d.ts +118 -93
- package/lib/publish/base-process-publish-assortment.js +998 -944
- package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -1
- package/lib/publish/base-process-publish-assortment.spec.js +1688 -1670
- package/lib/publish/mockData.d.ts +1389 -1389
- package/lib/publish/mockData.js +4524 -4519
- package/lib/transform/identifier-conversion-spec-mockData.js +472 -444
- package/lib/transform/identifier-conversion.d.ts +51 -15
- package/lib/transform/identifier-conversion.js +248 -212
- package/lib/transform/identifier-conversion.spec.d.ts +1 -1
- package/lib/transform/identifier-conversion.spec.js +343 -339
- package/lib/util/config-defaults.d.ts +8 -8
- package/lib/util/config-defaults.js +88 -85
- package/lib/util/config-defaults.spec.d.ts +1 -1
- package/lib/util/config-defaults.spec.js +302 -293
- package/lib/util/data-converter-spec-mockData.js +219 -205
- package/lib/util/data-converter.d.ts +136 -39
- package/lib/util/data-converter.js +718 -592
- package/lib/util/data-converter.spec.d.ts +1 -1
- package/lib/util/data-converter.spec.js +906 -904
- package/lib/util/error-response-object.d.ts +9 -4
- package/lib/util/error-response-object.js +54 -47
- package/lib/util/error-response-object.spec.d.ts +1 -1
- package/lib/util/error-response-object.spec.js +99 -99
- package/lib/util/event-short-message-status.d.ts +19 -19
- package/lib/util/event-short-message-status.js +24 -23
- package/lib/util/federation.d.ts +15 -15
- package/lib/util/federation.js +157 -149
- package/lib/util/flexplm-connect.d.ts +29 -22
- package/lib/util/flexplm-connect.js +190 -176
- package/lib/util/flexplm-connect.spec.d.ts +1 -1
- package/lib/util/flexplm-connect.spec.js +88 -88
- package/lib/util/logger-config.d.ts +1 -1
- package/lib/util/logger-config.js +27 -26
- package/lib/util/map-util-spec-mockData.js +219 -205
- package/lib/util/map-utils.d.ts +33 -6
- package/lib/util/map-utils.js +42 -15
- package/lib/util/map-utils.spec.d.ts +1 -1
- package/lib/util/map-utils.spec.js +89 -89
- package/lib/util/mockData.d.ts +80 -80
- package/lib/util/mockData.js +103 -103
- package/lib/util/thumbnail-util.d.ts +55 -34
- package/lib/util/thumbnail-util.js +242 -215
- package/lib/util/thumbnail-util.spec.d.ts +1 -1
- package/lib/util/thumbnail-util.spec.js +440 -434
- package/lib/util/type-conversion-utils-spec-mockData.js +259 -259
- package/lib/util/type-conversion-utils.d.ts +163 -23
- package/lib/util/type-conversion-utils.js +408 -265
- package/lib/util/type-conversion-utils.spec.d.ts +1 -1
- package/lib/util/type-conversion-utils.spec.js +868 -868
- package/lib/util/type-defaults.d.ts +74 -16
- package/lib/util/type-defaults.js +279 -221
- package/lib/util/type-defaults.spec.d.ts +1 -1
- package/lib/util/type-defaults.spec.js +516 -516
- package/lib/util/type-utils.d.ts +34 -13
- package/lib/util/type-utils.js +137 -114
- package/lib/util/type-utils.spec.d.ts +1 -1
- package/lib/util/type-utils.spec.js +192 -190
- package/package.json +21 -6
- package/scripts/copy-template.js +10 -0
- package/.claude/settings.local.json +0 -8
- package/.github/pull_request_template.md +0 -31
- package/.github/workflows/flexplm-lib.yml +0 -27
- package/.github/workflows/publish-to-npm.yml +0 -124
- package/CHANGELOG.md +0 -32
- package/publish.bat +0 -5
- package/publish.sh +0 -5
- package/src/entity-processor/base-entity-processor.spec.ts +0 -460
- package/src/entity-processor/base-entity-processor.ts +0 -515
- package/src/flexplm-request.ts +0 -28
- package/src/flexplm-utils.spec.ts +0 -27
- package/src/flexplm-utils.ts +0 -29
- package/src/index.ts +0 -22
- package/src/interfaces/interfaces.ts +0 -122
- package/src/interfaces/item-family-changes.ts +0 -67
- package/src/interfaces/publish-change-data.ts +0 -43
- package/src/publish/base-process-publish-assortment-callback.ts +0 -50
- package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
- package/src/publish/base-process-publish-assortment.ts +0 -1134
- package/src/publish/mockData.ts +0 -4561
- package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
- package/src/transform/identifier-conversion.spec.ts +0 -354
- package/src/transform/identifier-conversion.ts +0 -282
- package/src/util/config-defaults.spec.ts +0 -350
- package/src/util/config-defaults.ts +0 -93
- package/src/util/data-converter-spec-mockData.ts +0 -231
- package/src/util/data-converter.spec.ts +0 -1041
- package/src/util/data-converter.ts +0 -762
- package/src/util/error-response-object.spec.ts +0 -116
- package/src/util/error-response-object.ts +0 -50
- package/src/util/event-short-message-status.ts +0 -22
- package/src/util/federation.ts +0 -172
- package/src/util/flexplm-connect.spec.ts +0 -132
- package/src/util/flexplm-connect.ts +0 -208
- package/src/util/logger-config.ts +0 -20
- package/src/util/map-util-spec-mockData.ts +0 -231
- package/src/util/map-utils.spec.ts +0 -103
- package/src/util/map-utils.ts +0 -41
- package/src/util/mockData.ts +0 -101
- package/src/util/thumbnail-util.spec.ts +0 -508
- package/src/util/thumbnail-util.ts +0 -272
- package/src/util/type-conversion-utils-spec-mockData.ts +0 -271
- package/src/util/type-conversion-utils.spec.ts +0 -968
- package/src/util/type-conversion-utils.ts +0 -460
- package/src/util/type-defaults.spec.ts +0 -669
- package/src/util/type-defaults.ts +0 -281
- package/src/util/type-utils.spec.ts +0 -227
- package/src/util/type-utils.ts +0 -144
- package/tsconfig.json +0 -29
- package/tslint.json +0 -57
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
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
|
-
});
|
package/src/util/map-utils.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
}
|
package/src/util/mockData.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
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
|
-
};
|