@contrail/flexplm 1.1.67-alpha.4 → 1.3.0-alpha.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.
Files changed (89) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/package.json +1 -1
  3. package/scripts/output.png +0 -0
  4. package/scripts/test-get-request.ts +35 -0
  5. package/src/util/flexplm-connect.spec.ts +132 -0
  6. package/src/util/flexplm-connect.ts +14 -5
  7. package/src/util/type-conversion-utils-spec-mockData.ts +18 -0
  8. package/src/util/type-conversion-utils.spec.ts +184 -0
  9. package/src/util/type-conversion-utils.ts +74 -0
  10. package/lib/entity-processor/base-entity-processor.d.ts +0 -42
  11. package/lib/entity-processor/base-entity-processor.js +0 -363
  12. package/lib/entity-processor/base-entity-processor.spec.d.ts +0 -1
  13. package/lib/entity-processor/base-entity-processor.spec.js +0 -302
  14. package/lib/flexplm-request.d.ts +0 -3
  15. package/lib/flexplm-request.js +0 -34
  16. package/lib/flexplm-utils.d.ts +0 -5
  17. package/lib/flexplm-utils.js +0 -33
  18. package/lib/flexplm-utils.spec.d.ts +0 -1
  19. package/lib/flexplm-utils.spec.js +0 -26
  20. package/lib/index.d.ts +0 -22
  21. package/lib/index.js +0 -38
  22. package/lib/interfaces/interfaces.d.ts +0 -105
  23. package/lib/interfaces/interfaces.js +0 -2
  24. package/lib/interfaces/item-family-changes.d.ts +0 -20
  25. package/lib/interfaces/item-family-changes.js +0 -56
  26. package/lib/interfaces/publish-change-data.d.ts +0 -19
  27. package/lib/interfaces/publish-change-data.js +0 -32
  28. package/lib/publish/base-process-publish-assortment-callback.d.ts +0 -9
  29. package/lib/publish/base-process-publish-assortment-callback.js +0 -38
  30. package/lib/publish/base-process-publish-assortment.d.ts +0 -93
  31. package/lib/publish/base-process-publish-assortment.js +0 -944
  32. package/lib/publish/base-process-publish-assortment.spec.d.ts +0 -1
  33. package/lib/publish/base-process-publish-assortment.spec.js +0 -1670
  34. package/lib/publish/mockData.d.ts +0 -1389
  35. package/lib/publish/mockData.js +0 -4519
  36. package/lib/transform/identifier-conversion-spec-mockData.d.ts +0 -0
  37. package/lib/transform/identifier-conversion-spec-mockData.js +0 -444
  38. package/lib/transform/identifier-conversion.d.ts +0 -15
  39. package/lib/transform/identifier-conversion.js +0 -212
  40. package/lib/transform/identifier-conversion.spec.d.ts +0 -1
  41. package/lib/transform/identifier-conversion.spec.js +0 -339
  42. package/lib/util/config-defaults.d.ts +0 -8
  43. package/lib/util/config-defaults.js +0 -85
  44. package/lib/util/config-defaults.spec.d.ts +0 -1
  45. package/lib/util/config-defaults.spec.js +0 -293
  46. package/lib/util/data-converter-spec-mockData.d.ts +0 -0
  47. package/lib/util/data-converter-spec-mockData.js +0 -205
  48. package/lib/util/data-converter.d.ts +0 -39
  49. package/lib/util/data-converter.js +0 -592
  50. package/lib/util/data-converter.spec.d.ts +0 -1
  51. package/lib/util/data-converter.spec.js +0 -904
  52. package/lib/util/error-response-object.d.ts +0 -4
  53. package/lib/util/error-response-object.js +0 -47
  54. package/lib/util/error-response-object.spec.d.ts +0 -1
  55. package/lib/util/error-response-object.spec.js +0 -99
  56. package/lib/util/event-short-message-status.d.ts +0 -18
  57. package/lib/util/event-short-message-status.js +0 -22
  58. package/lib/util/federation.d.ts +0 -15
  59. package/lib/util/federation.js +0 -149
  60. package/lib/util/flexplm-connect.d.ts +0 -18
  61. package/lib/util/flexplm-connect.js +0 -171
  62. package/lib/util/logger-config.d.ts +0 -1
  63. package/lib/util/logger-config.js +0 -26
  64. package/lib/util/map-util-spec-mockData.d.ts +0 -0
  65. package/lib/util/map-util-spec-mockData.js +0 -205
  66. package/lib/util/map-utils.d.ts +0 -6
  67. package/lib/util/map-utils.js +0 -15
  68. package/lib/util/map-utils.spec.d.ts +0 -1
  69. package/lib/util/map-utils.spec.js +0 -89
  70. package/lib/util/mockData.d.ts +0 -79
  71. package/lib/util/mockData.js +0 -99
  72. package/lib/util/thumbnail-util.d.ts +0 -19
  73. package/lib/util/thumbnail-util.js +0 -114
  74. package/lib/util/thumbnail-util.spec.d.ts +0 -1
  75. package/lib/util/thumbnail-util.spec.js +0 -242
  76. package/lib/util/type-conversion-utils-spec-mockData.d.ts +0 -0
  77. package/lib/util/type-conversion-utils-spec-mockData.js +0 -241
  78. package/lib/util/type-conversion-utils.d.ts +0 -21
  79. package/lib/util/type-conversion-utils.js +0 -223
  80. package/lib/util/type-conversion-utils.spec.d.ts +0 -1
  81. package/lib/util/type-conversion-utils.spec.js +0 -708
  82. package/lib/util/type-defaults.d.ts +0 -16
  83. package/lib/util/type-defaults.js +0 -221
  84. package/lib/util/type-defaults.spec.d.ts +0 -1
  85. package/lib/util/type-defaults.spec.js +0 -516
  86. package/lib/util/type-utils.d.ts +0 -13
  87. package/lib/util/type-utils.js +0 -114
  88. package/lib/util/type-utils.spec.d.ts +0 -1
  89. package/lib/util/type-utils.spec.js +0 -190
@@ -1,444 +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
- return mapKey;
31
- }
32
- }
33
- }
34
- },
35
- LCSSeason: {
36
- vibe2flex: {
37
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
38
- rekey: {
39
- seasonName: 'flexPLMSeasonName',
40
- year: 'seasonYear'
41
- },
42
- getSoftType: () => 'Season',
43
- getClass: () => 'LCSSeason'
44
- },
45
- flex2vibe: {
46
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
47
- rekey: {
48
- flexPLMSeasonName: 'seasonName',
49
- seasonYear: 'year'
50
- }
51
- }
52
- },
53
- LCSProduct: {
54
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
55
- vibe2flex: {
56
- getClass: () => 'LCSProduct',
57
- getSoftType: (entity) => {
58
- const prodType = entity['prodType'];
59
- let val = '';
60
- switch (prodType) {
61
- case 'acc':
62
- val = 'Product\\Accesories';
63
- break;
64
- case 'app':
65
- val = 'Product\\Apparel';
66
- break;
67
- case 'eqp':
68
- val = 'Product\\Equipment';
69
- break;
70
- case 'foot':
71
- val = 'Product\\Footwear';
72
- break;
73
- }
74
- return val;
75
- },
76
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
77
- rekey: {
78
- productName: 'name',
79
- vibeIQIdentifier: 'itemNumber'
80
- },
81
- valueTransform: {
82
- transformEx: (row) => {
83
- return row['otherProp'] + 'xxx';
84
- }
85
- }
86
- },
87
- flex2vibe: {
88
- getClass: () => 'item',
89
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
90
- rekey: {
91
- itemNumber: 'vibeIQIdentifier',
92
- name: 'productName',
93
- }
94
- }
95
- },
96
- LCSSKU: {
97
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
98
- vibe2flex: {
99
- getClass: () => 'LCSSKU',
100
- getSoftType: (entity) => {
101
- const prodType = entity['prodType'];
102
- let val = '';
103
- switch (prodType) {
104
- case 'acc':
105
- val = 'Product\\Accesories';
106
- break;
107
- case 'app':
108
- val = 'Product\\Apparel';
109
- break;
110
- case 'eqp':
111
- val = 'Product\\Equipment';
112
- break;
113
- case 'foot':
114
- val = 'Product\\Footwear';
115
- break;
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
- packaging: {
134
- vibe2flex: {
135
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
136
- rekey: {
137
- retailPackType: 'packType',
138
- retailIntroDate: 'introDate'
139
- },
140
- getSoftType: () => 'Revisable Entity\\packaging',
141
- getClass: () => 'LCSRevisableEntity'
142
- },
143
- flex2vibe: {
144
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
145
- rekey: {
146
- packType: 'retailPackType',
147
- introDate: 'retailIntroDate'
148
- },
149
- getClass: () => 'custom-entity',
150
- getSoftType: () => 'custom-entity:pack',
151
- }
152
- },
153
- prefix: {
154
- vibe2flex: {
155
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
156
- rekey: {
157
- retailOwner: 'owner',
158
- retailIntroDate: 'introDate'
159
- },
160
- getSoftType: () => 'Revisable Entity\\prefix',
161
- getClass: () => 'LCSRevisableEntity'
162
- },
163
- flex2vibe: {
164
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
165
- rekey: {
166
- owner: 'retailOwner',
167
- introDate: 'retailIntroDate'
168
- },
169
- getClass: () => 'custom-entity',
170
- getSoftType: () => 'custom-entity:prefix',
171
- }
172
- },
173
- catName: {
174
- getIdentifierProperties: () => ['catName', 'catNumber'],
175
- getInformationalProperties: () => ['longName'],
176
- vibe2flex: {
177
- transformOrder: [],
178
- getSoftType: () => 'Last\\catName',
179
- getClass: () => 'LCSLast'
180
- },
181
- flex2vibe: {
182
- transformOrder: [],
183
- getClass: () => 'custom-entity',
184
- getSoftType: () => 'custom-entity:catName',
185
- }
186
- },
187
- partnerOrg: {
188
- vibe2flex: {
189
- transformOrder: [],
190
- getSoftType: () => 'Business Object\\partnerOrg',
191
- getClass: () => 'LCSLifecycleManaged'
192
- },
193
- flex2vibe: {
194
- transformOrder: [],
195
- getClass: () => 'custom-entity',
196
- getSoftType: () => 'custom-entity:partnerOrg',
197
- }
198
- },
199
- catFamily: {
200
- vibe2flex: {
201
- transformOrder: [],
202
- getSoftType: () => 'Revisable Entity\\catFamily',
203
- getClass: () => 'LCSRevisableEntity'
204
- },
205
- flex2vibe: {
206
- transformOrder: [],
207
- getClass: () => 'custom-entity',
208
- getSoftType: () => 'custom-entity:catFamily',
209
- }
210
- },
211
- formName: {
212
- vibe2flex: {
213
- transformOrder: [],
214
- getSoftType: () => 'Material\\form',
215
- getClass: () => 'LCSMaterial'
216
- },
217
- flex2vibe: {
218
- transformOrder: [],
219
- getClass: () => 'custom-entity',
220
- getSoftType: () => 'custom-entity:formName',
221
- }
222
- },
223
- };
224
- exports.mapping2 = {
225
- typeConversion: {
226
- vibe2flex: {
227
- 'custom-entity': {
228
- getMapKey: (entity) => {
229
- const typePath = entity['typePath'];
230
- let mapKey = '';
231
- switch (typePath) {
232
- case 'custom-entity:pack':
233
- mapKey = 'packaging';
234
- break;
235
- case 'custom-entity:prefix':
236
- mapKey = 'prefix';
237
- break;
238
- case 'custom-entity:catName':
239
- mapKey = 'catName';
240
- break;
241
- case 'custom-entity:partnerOrg':
242
- mapKey = 'partnerOrg';
243
- break;
244
- case 'custom-entity:catFamily':
245
- mapKey = 'catFamily';
246
- break;
247
- case 'custom-entity:formName':
248
- mapKey = 'formName';
249
- break;
250
- }
251
- return mapKey;
252
- }
253
- }
254
- }
255
- },
256
- LCSSeason: {
257
- getIdentifierProperties: () => ['brand', 'year', 'seasonType'],
258
- vibe2flex: {
259
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
260
- rekey: {
261
- seasonName: 'flexPLMSeasonName'
262
- },
263
- getSoftType: () => 'Season',
264
- getClass: () => 'LCSSeason'
265
- },
266
- flex2vibe: {
267
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
268
- rekey: {
269
- flexPLMSeasonName: 'seasonName'
270
- }
271
- }
272
- },
273
- LCSProduct: {
274
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
275
- vibe2flex: {
276
- getClass: () => 'LCSProduct',
277
- getSoftType: (entity) => {
278
- const prodType = entity['prodType'];
279
- let val = '';
280
- switch (prodType) {
281
- case 'acc':
282
- val = 'Product\\Accesories';
283
- break;
284
- case 'app':
285
- val = 'Product\\Apparel';
286
- break;
287
- case 'eqp':
288
- val = 'Product\\Equipment';
289
- break;
290
- case 'foot':
291
- val = 'Product\\Footwear';
292
- break;
293
- }
294
- return val;
295
- },
296
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
297
- rekey: {
298
- productName: 'name',
299
- vibeIQIdentifier: 'itemNumber'
300
- },
301
- valueTransform: {
302
- transformEx: (row) => {
303
- return row['otherProp'] + 'xxx';
304
- }
305
- }
306
- },
307
- flex2vibe: {
308
- getClass: () => 'item',
309
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
310
- rekey: {
311
- itemNumber: 'vibeIQIdentifier',
312
- name: 'productName',
313
- }
314
- }
315
- },
316
- LCSSKU: {
317
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
318
- getIdentifierProperties: () => ['uniqueIdentifierA', 'uniqueIdentifierB'],
319
- vibe2flex: {
320
- getClass: () => 'LCSSKU',
321
- getSoftType: (entity) => {
322
- const prodType = entity['prodType'];
323
- let val = '';
324
- switch (prodType) {
325
- case 'acc':
326
- val = 'Product\\Accesories';
327
- break;
328
- case 'app':
329
- val = 'Product\\Apparel';
330
- break;
331
- case 'eqp':
332
- val = 'Product\\Equipment';
333
- break;
334
- case 'foot':
335
- val = 'Product\\Footwear';
336
- break;
337
- }
338
- return val;
339
- },
340
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
341
- rekey: {
342
- skuName: 'optionName',
343
- vibeIQIdentifier: 'itemNumber'
344
- }
345
- },
346
- flex2vibe: {
347
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
348
- rekey: {
349
- itemNumber: 'vibeIQIdentifier',
350
- optionName: 'skuName',
351
- }
352
- }
353
- },
354
- packaging: {
355
- vibe2flex: {
356
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
357
- rekey: {
358
- retailPackType: 'packType',
359
- retailIntroDate: 'introDate'
360
- },
361
- getSoftType: () => 'Revisable Entity\\packaging',
362
- getClass: () => 'LCSRevisableEntity'
363
- },
364
- flex2vibe: {
365
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
366
- rekey: {
367
- packType: 'retailPackType',
368
- introDate: 'retailIntroDate'
369
- },
370
- getClass: () => 'custom-entity',
371
- getSoftType: () => 'custom-entity:pack',
372
- }
373
- },
374
- prefix: {
375
- vibe2flex: {
376
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
377
- rekey: {
378
- retailOwner: 'owner',
379
- retailIntroDate: 'introDate'
380
- },
381
- getSoftType: () => 'Revisable Entity\\prefix',
382
- getClass: () => 'LCSRevisableEntity'
383
- },
384
- flex2vibe: {
385
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
386
- rekey: {
387
- owner: 'retailOwner',
388
- introDate: 'retailIntroDate'
389
- },
390
- getClass: () => 'custom-entity',
391
- getSoftType: () => 'custom-entity:prefix',
392
- }
393
- },
394
- catName: {
395
- getIdentifierProperties: () => ['catName', 'catNumber'],
396
- getInformationalProperties: () => ['longName'],
397
- vibe2flex: {
398
- transformOrder: [],
399
- getSoftType: () => 'Last\\catName',
400
- getClass: () => 'LCSLast'
401
- },
402
- flex2vibe: {
403
- transformOrder: [],
404
- getClass: () => 'custom-entity',
405
- getSoftType: () => 'custom-entity:catName',
406
- }
407
- },
408
- partnerOrg: {
409
- vibe2flex: {
410
- transformOrder: [],
411
- getSoftType: () => 'Business Object\\partnerOrg',
412
- getClass: () => 'LCSLifecycleManaged'
413
- },
414
- flex2vibe: {
415
- transformOrder: [],
416
- getClass: () => 'custom-entity',
417
- getSoftType: () => 'custom-entity:partnerOrg',
418
- }
419
- },
420
- catFamily: {
421
- vibe2flex: {
422
- transformOrder: [],
423
- getSoftType: () => 'Revisable Entity\\catFamily',
424
- getClass: () => 'LCSRevisableEntity'
425
- },
426
- flex2vibe: {
427
- transformOrder: [],
428
- getClass: () => 'custom-entity',
429
- getSoftType: () => 'custom-entity:catFamily',
430
- }
431
- },
432
- formName: {
433
- vibe2flex: {
434
- transformOrder: [],
435
- getSoftType: () => 'Material\\form',
436
- getClass: () => 'LCSMaterial'
437
- },
438
- flex2vibe: {
439
- transformOrder: [],
440
- getClass: () => 'custom-entity',
441
- getSoftType: () => 'custom-entity:formName',
442
- }
443
- },
444
- };
@@ -1,15 +0,0 @@
1
- import { MapFileUtil } from "@contrail/transform-data";
2
- import { ProductFederation, SeasonFederation, SeasonGroupFederation, SkuFederation } from "../interfaces/interfaces";
3
- import { DataConverter } from "../util/data-converter";
4
- export declare class IdentifierConversion {
5
- static readonly INBOUND_ENTITY_MISSING_IDENIFIER_PROPS = "IdentifierConversion.getEntityCriteriaFromObject(): missing identifier properties: ";
6
- static readonly MISSING_OBJECT = "IdentifierConversion.getEntityCriteriaFromObject(): missing: object";
7
- static readonly MISSING_FLEXPLM_OBJECT_CLASS = "IdentifierConversion.getEntityCriteriaFromObject(): missing: flexPLMObjectClass";
8
- static getSeasonIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, assortment: any, includeInformationKeys?: boolean): Promise<SeasonFederation>;
9
- static getSeasonGroupIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, assortment: any, includeInformationKeys?: boolean): Promise<SeasonGroupFederation>;
10
- static getProductIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, itemFamilyObject: any, includeInformationKeys?: boolean): Promise<ProductFederation>;
11
- static getSKUIdentityObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, itemObject: any, includeInformationKeys?: boolean): Promise<SkuFederation>;
12
- static getEntityCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
13
- static getAssortmentCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
14
- static getItemCriteriaFromObject(transformMapFile: string, mapFileUtil: MapFileUtil, dc: DataConverter, object: any): Promise<any>;
15
- }
@@ -1,212 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdentifierConversion = void 0;
4
- const map_utils_1 = require("../util/map-utils");
5
- const type_conversion_utils_1 = require("../util/type-conversion-utils");
6
- const event_short_message_status_1 = require("../util/event-short-message-status");
7
- class IdentifierConversion {
8
- static async getSeasonIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
9
- if (!assortment) {
10
- throw new Error('IdentifierConversion.getSeasonIdentityObject(): assortment must be provided.');
11
- }
12
- assortment['flex2vibeMapKeyRoot'] = 'LCSSeason';
13
- const flexPLMTypePath = await type_conversion_utils_1.TypeConversionUtils.getObjectTypePath(transformMapFile, mapFileUtil, assortment);
14
- let seasonObj = {
15
- entityReference: 'assortment:' + assortment?.id,
16
- objectClass: 'LCSSeason',
17
- flexPLMTypePath
18
- };
19
- try {
20
- const assortmentObj = await dc.getFlexPLMObjectData(assortment, [], true);
21
- const identifierKeys = await type_conversion_utils_1.TypeConversionUtils.getIdentifierProperties(transformMapFile, mapFileUtil, assortment);
22
- for (const key of identifierKeys) {
23
- if (assortmentObj[key]) {
24
- seasonObj[key] = assortmentObj[key];
25
- }
26
- }
27
- if (includeInformationKeys) {
28
- const informationKeys = await type_conversion_utils_1.TypeConversionUtils
29
- .getInformationalProperties(transformMapFile, mapFileUtil, assortment);
30
- for (const key of informationKeys) {
31
- if (assortmentObj[key]) {
32
- seasonObj[key] = assortmentObj[key];
33
- }
34
- }
35
- }
36
- const objectKeys = Object.keys(seasonObj);
37
- const hasAllIdentifiers = identifierKeys.every(key => objectKeys.includes(key));
38
- if (!hasAllIdentifiers) {
39
- console.error('IdentifierConversion.getSeasonIdentityObject(): doesnt have all identifier properties - ' + identifierKeys);
40
- console.error('assortment: ' + JSON.stringify(assortment));
41
- }
42
- const mapKey = await type_conversion_utils_1.TypeConversionUtils
43
- .getMapKey(transformMapFile, mapFileUtil, assortment, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
44
- seasonObj = await map_utils_1.MapUtil
45
- .applyTransformMap(transformMapFile, mapFileUtil, seasonObj, mapKey, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
46
- }
47
- finally {
48
- delete assortment['flex2vibeMapKeyRoot'];
49
- }
50
- return seasonObj;
51
- }
52
- static async getSeasonGroupIdentityObject(transformMapFile, mapFileUtil, dc, assortment, includeInformationKeys = true) {
53
- if (!assortment) {
54
- throw new Error('IdentifierConversion.getSeasonGroupIdentityObject(): assortment must be provided.');
55
- }
56
- assortment['flex2vibeMapKeyRoot'] = 'SeasonGroup';
57
- const flexPLMTypePath = await type_conversion_utils_1.TypeConversionUtils.getObjectTypePath(transformMapFile, mapFileUtil, assortment);
58
- let seasonGroupObj = {
59
- entityReference: 'assortment:' + assortment?.id,
60
- objectClass: 'SeasonGroup',
61
- flexPLMTypePath
62
- };
63
- try {
64
- const assortmentObj = await dc.getFlexPLMObjectData(assortment, [], true);
65
- const identifierKeys = await type_conversion_utils_1.TypeConversionUtils
66
- .getIdentifierProperties(transformMapFile, mapFileUtil, assortment);
67
- for (const key of identifierKeys) {
68
- if (assortmentObj[key]) {
69
- seasonGroupObj[key] = assortmentObj[key];
70
- }
71
- }
72
- if (includeInformationKeys) {
73
- const informationKeys = await type_conversion_utils_1.TypeConversionUtils
74
- .getInformationalProperties(transformMapFile, mapFileUtil, assortment);
75
- for (const key of informationKeys) {
76
- if (assortmentObj[key]) {
77
- seasonGroupObj[key] = assortmentObj[key];
78
- }
79
- }
80
- }
81
- const objectKeys = Object.keys(seasonGroupObj);
82
- const hasAllIdentifiers = identifierKeys.every(key => objectKeys.includes(key));
83
- if (!hasAllIdentifiers) {
84
- console.error('IdentifierConversion.getSeasonGroupIdentityObject(): doesnt have all identifier properties - ' + identifierKeys);
85
- console.error('assortment: ' + JSON.stringify(assortment));
86
- }
87
- const mapKey = await type_conversion_utils_1.TypeConversionUtils.getMapKey(transformMapFile, mapFileUtil, assortment, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
88
- seasonGroupObj = await map_utils_1.MapUtil.applyTransformMap(transformMapFile, mapFileUtil, seasonGroupObj, mapKey, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
89
- }
90
- finally {
91
- delete assortment['flex2vibeMapKeyRoot'];
92
- }
93
- return seasonGroupObj;
94
- }
95
- static async getProductIdentityObject(transformMapFile, mapFileUtil, dc, itemFamilyObject, includeInformationKeys = true) {
96
- if (!itemFamilyObject) {
97
- throw new Error('IdentifierConversion.getProductIdentityObject(): itemFamilyObject must be provided.');
98
- }
99
- const itemObj = await dc.getFlexPLMObjectData(itemFamilyObject, [], true);
100
- const flexPLMTypePath = await type_conversion_utils_1.TypeConversionUtils.getObjectTypePath(transformMapFile, mapFileUtil, itemFamilyObject);
101
- let prodObj = {
102
- entityReference: 'item:' + itemFamilyObject?.id,
103
- objectClass: 'LCSProduct',
104
- flexPLMTypePath
105
- };
106
- const identifierKeys = await type_conversion_utils_1.TypeConversionUtils
107
- .getIdentifierProperties(transformMapFile, mapFileUtil, itemFamilyObject);
108
- for (const key of identifierKeys) {
109
- if (itemObj[key]) {
110
- prodObj[key] = itemObj[key];
111
- }
112
- }
113
- if (includeInformationKeys) {
114
- const informationKeys = await type_conversion_utils_1.TypeConversionUtils
115
- .getInformationalProperties(transformMapFile, mapFileUtil, itemFamilyObject);
116
- for (const key of informationKeys) {
117
- if (itemObj[key]) {
118
- prodObj[key] = itemObj[key];
119
- }
120
- }
121
- }
122
- const vibeIQIdentifier = 'vibeIQIdentifier';
123
- if (!prodObj[vibeIQIdentifier]) {
124
- prodObj['vibeIQIdentifier'] = itemFamilyObject['identifier'] || itemFamilyObject['itemNumber'];
125
- }
126
- const mapKey = await type_conversion_utils_1.TypeConversionUtils
127
- .getMapKey(transformMapFile, mapFileUtil, itemFamilyObject, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
128
- prodObj = await map_utils_1.MapUtil
129
- .applyTransformMap(transformMapFile, mapFileUtil, prodObj, mapKey, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
130
- return prodObj;
131
- }
132
- static async getSKUIdentityObject(transformMapFile, mapFileUtil, dc, itemObject, includeInformationKeys = true) {
133
- if (!itemObject) {
134
- throw new Error('IdentifierConversion.getSKUIdentityObject(): itemObject must be provided.');
135
- }
136
- const itemObj = await dc.getFlexPLMObjectData(itemObject, [], true);
137
- const flexPLMTypePath = await type_conversion_utils_1.TypeConversionUtils.getObjectTypePath(transformMapFile, mapFileUtil, itemObject);
138
- let skuObj = {
139
- entityReference: 'item:' + itemObject?.id,
140
- objectClass: 'LCSSKU',
141
- flexPLMTypePath
142
- };
143
- const identifierKeys = await type_conversion_utils_1.TypeConversionUtils.getIdentifierProperties(transformMapFile, mapFileUtil, itemObject);
144
- for (const key of identifierKeys) {
145
- if (itemObj[key]) {
146
- skuObj[key] = itemObj[key];
147
- }
148
- }
149
- if (includeInformationKeys) {
150
- const informationKeys = await type_conversion_utils_1.TypeConversionUtils.getInformationalProperties(transformMapFile, mapFileUtil, itemObject);
151
- for (const key of informationKeys) {
152
- if (itemObj[key]) {
153
- skuObj[key] = itemObj[key];
154
- }
155
- }
156
- }
157
- const vibeIQIdentifier = 'vibeIQIdentifier';
158
- if (!skuObj[vibeIQIdentifier]) {
159
- skuObj['vibeIQIdentifier'] = itemObject['identifier'] || itemObject['itemNumber'];
160
- }
161
- const mapKey = await type_conversion_utils_1.TypeConversionUtils.getMapKey(transformMapFile, mapFileUtil, itemObject, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
162
- skuObj = await map_utils_1.MapUtil.applyTransformMap(transformMapFile, mapFileUtil, skuObj, mapKey, type_conversion_utils_1.TypeConversionUtils.VIBE2FLEX_DIRECTION);
163
- return skuObj;
164
- }
165
- static async getEntityCriteriaFromObject(transformMapFile, mapFileUtil, dc, object) {
166
- if (!object) {
167
- const e = new Error(IdentifierConversion.MISSING_OBJECT);
168
- e['shortStatusMessage'] = event_short_message_status_1.EventShortMessageStatus.MISSING_INPUT;
169
- throw e;
170
- }
171
- else if (!object.flexPLMObjectClass) {
172
- const e = new Error(IdentifierConversion.MISSING_FLEXPLM_OBJECT_CLASS);
173
- e['shortStatusMessage'] = event_short_message_status_1.EventShortMessageStatus.MISSING_INPUT;
174
- throw e;
175
- }
176
- const mapKey = await type_conversion_utils_1.TypeConversionUtils.getMapKeyFromObject(transformMapFile, mapFileUtil, object, type_conversion_utils_1.TypeConversionUtils.FLEX2VIBE_DIRECTION);
177
- const identifierKeys = await type_conversion_utils_1.TypeConversionUtils.getIdentifierPropertiesFromObject(transformMapFile, mapFileUtil, object);
178
- const objectData = await map_utils_1.MapUtil.applyTransformMap(transformMapFile, mapFileUtil, object, mapKey, type_conversion_utils_1.TypeConversionUtils.FLEX2VIBE_DIRECTION);
179
- let identifierValues = identifierKeys.reduce((acc, key) => {
180
- acc[key] = objectData[key];
181
- return acc;
182
- }, {});
183
- identifierValues['flexPLMObjectClass'] = objectData?.flexPLMObjectClass;
184
- identifierValues['flexPLMTypePath'] = objectData?.flexPLMTypePath;
185
- identifierValues = await dc.getEntityValues(objectData?.flexPLMObjectClass, identifierValues, []);
186
- const entityKeys = Object.keys(identifierValues);
187
- const hasAllIdentifiers = identifierKeys.every(key => entityKeys.includes(key));
188
- if (!hasAllIdentifiers) {
189
- const e = new Error(IdentifierConversion.INBOUND_ENTITY_MISSING_IDENIFIER_PROPS + identifierKeys);
190
- e['shortStatusMessage'] = event_short_message_status_1.EventShortMessageStatus.MISSING_IDENTIFIER_PROPERTIES;
191
- throw e;
192
- }
193
- const criteria = {};
194
- for (const key of identifierKeys) {
195
- criteria[key] = identifierValues[key];
196
- }
197
- return criteria;
198
- }
199
- static async getAssortmentCriteriaFromObject(transformMapFile, mapFileUtil, dc, object) {
200
- return IdentifierConversion.getEntityCriteriaFromObject(transformMapFile, mapFileUtil, dc, object);
201
- }
202
- static async getItemCriteriaFromObject(transformMapFile, mapFileUtil, dc, object) {
203
- const criteria = await IdentifierConversion.getEntityCriteriaFromObject(transformMapFile, mapFileUtil, dc, object);
204
- const roles = (object.flexPLMObjectClass === 'LCSProduct') ? 'family' : 'color';
205
- criteria['roles'] = roles;
206
- return criteria;
207
- }
208
- }
209
- exports.IdentifierConversion = IdentifierConversion;
210
- IdentifierConversion.INBOUND_ENTITY_MISSING_IDENIFIER_PROPS = 'IdentifierConversion.getEntityCriteriaFromObject(): missing identifier properties: ';
211
- IdentifierConversion.MISSING_OBJECT = 'IdentifierConversion.getEntityCriteriaFromObject(): missing: object';
212
- IdentifierConversion.MISSING_FLEXPLM_OBJECT_CLASS = 'IdentifierConversion.getEntityCriteriaFromObject(): missing: flexPLMObjectClass';
@@ -1 +0,0 @@
1
- export {};