@contrail/flexplm 1.1.13 → 1.1.15

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 (68) hide show
  1. package/.github/pull_request_template.md +30 -0
  2. package/.github/workflows/flexplm-lib.yml +27 -0
  3. package/lib/flexplm-utils.spec.d.ts +1 -0
  4. package/lib/flexplm-utils.spec.js +26 -0
  5. package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -0
  6. package/lib/publish/base-process-publish-assortment.spec.js +1053 -0
  7. package/lib/util/config-defaults.spec.d.ts +1 -0
  8. package/lib/util/config-defaults.spec.js +264 -0
  9. package/lib/util/data-converter.d.ts +4 -0
  10. package/lib/util/data-converter.js +88 -1
  11. package/lib/util/data-converter.spec.d.ts +1 -0
  12. package/lib/util/data-converter.spec.js +591 -0
  13. package/lib/util/map-utils.d.ts +2 -2
  14. package/lib/util/map-utils.js +5 -28
  15. package/lib/util/map-utils.spec.d.ts +1 -0
  16. package/lib/util/map-utils.spec.js +89 -0
  17. package/lib/util/thumbnail-util.spec.d.ts +1 -0
  18. package/lib/util/thumbnail-util.spec.js +132 -0
  19. package/lib/util/type-conversion-utils-spec-mockData.js +21 -0
  20. package/lib/util/type-conversion-utils.d.ts +7 -0
  21. package/lib/util/type-conversion-utils.js +88 -4
  22. package/lib/util/type-conversion-utils.spec.d.ts +1 -0
  23. package/lib/util/type-conversion-utils.spec.js +547 -0
  24. package/lib/util/type-defaults.d.ts +5 -0
  25. package/lib/util/type-defaults.js +66 -0
  26. package/lib/util/type-defaults.spec.d.ts +1 -0
  27. package/lib/util/type-defaults.spec.js +460 -0
  28. package/lib/util/type-utils.spec.d.ts +1 -0
  29. package/lib/util/type-utils.spec.js +190 -0
  30. package/package.json +2 -2
  31. package/publish.bat +5 -0
  32. package/publish.sh +5 -0
  33. package/src/entity-processor/base-entity-processor.ts +183 -0
  34. package/src/flexplm-request.ts +28 -0
  35. package/src/flexplm-utils.spec.ts +27 -0
  36. package/src/flexplm-utils.ts +29 -0
  37. package/src/index.ts +20 -0
  38. package/src/interfaces/interfaces.ts +120 -0
  39. package/src/interfaces/item-family-changes.ts +67 -0
  40. package/src/interfaces/publish-change-data.ts +43 -0
  41. package/src/publish/base-process-publish-assortment-callback.ts +23 -0
  42. package/src/publish/base-process-publish-assortment.spec.ts +1239 -0
  43. package/src/publish/base-process-publish-assortment.ts +1024 -0
  44. package/src/publish/mockData.ts +4561 -0
  45. package/src/transform/identifier-conversion.ts +226 -0
  46. package/src/util/config-defaults.spec.ts +315 -0
  47. package/src/util/config-defaults.ts +79 -0
  48. package/src/util/data-converter-spec-mockData.ts +231 -0
  49. package/src/util/data-converter.spec.ts +872 -0
  50. package/src/util/data-converter.ts +507 -0
  51. package/src/util/federation.ts +172 -0
  52. package/src/util/flexplm-connect.ts +169 -0
  53. package/src/util/logger-config.ts +20 -0
  54. package/src/util/map-util-spec-mockData.ts +231 -0
  55. package/src/util/map-utils.spec.ts +103 -0
  56. package/src/util/map-utils.ts +40 -0
  57. package/src/util/mockData.ts +98 -0
  58. package/src/util/thumbnail-util.spec.ts +152 -0
  59. package/src/util/thumbnail-util.ts +128 -0
  60. package/src/util/type-conversion-utils-spec-mockData.ts +238 -0
  61. package/src/util/type-conversion-utils.spec.ts +601 -0
  62. package/src/util/type-conversion-utils.ts +345 -0
  63. package/src/util/type-defaults.spec.ts +592 -0
  64. package/src/util/type-defaults.ts +261 -0
  65. package/src/util/type-utils.spec.ts +227 -0
  66. package/src/util/type-utils.ts +124 -0
  67. package/tsconfig.json +27 -0
  68. package/tslint.json +57 -0
@@ -0,0 +1,460 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const type_defaults_1 = require("./type-defaults");
4
+ describe('Type Defaults', () => {
5
+ describe('getDefaultObjectClass', () => {
6
+ it('LCSProduct', () => {
7
+ const newData = {
8
+ entityType: 'item',
9
+ roles: ['family']
10
+ };
11
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
12
+ expect(objectClass).toEqual('LCSProduct');
13
+ });
14
+ it('LCSSKU', () => {
15
+ const newData = {
16
+ entityType: 'item',
17
+ roles: ['color']
18
+ };
19
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
20
+ expect(objectClass).toEqual('LCSSKU');
21
+ });
22
+ it('LCSProductSeasonLink', () => {
23
+ const newData = {
24
+ entityType: 'project-item',
25
+ roles: ['family']
26
+ };
27
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
28
+ expect(objectClass).toEqual('LCSProductSeasonLink');
29
+ });
30
+ it('LCSSKUSeasonLink', () => {
31
+ const newData = {
32
+ entityType: 'project-item',
33
+ roles: ['color']
34
+ };
35
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
36
+ expect(objectClass).toEqual('LCSSKUSeasonLink');
37
+ });
38
+ it('LCSColor', () => {
39
+ const newData = {
40
+ entityType: 'color'
41
+ };
42
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
43
+ expect(objectClass).toEqual('LCSColor');
44
+ });
45
+ it('LCSRevisableEntity', () => {
46
+ const newData = {
47
+ entityType: 'custom-entity'
48
+ };
49
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
50
+ expect(objectClass).toEqual('LCSRevisableEntity');
51
+ });
52
+ it('LCSSeason - project', () => {
53
+ const newData = {
54
+ entityType: 'project'
55
+ };
56
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
57
+ expect(objectClass).toEqual('LCSSeason');
58
+ });
59
+ it('Season Group', () => {
60
+ const newData = {
61
+ entityType: 'assortment'
62
+ };
63
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
64
+ expect(objectClass).toEqual('SeasonGroup');
65
+ });
66
+ it('LCSSeason - assortment - publishToFlexPLM=true', () => {
67
+ const newData = {
68
+ entityType: 'assortment',
69
+ publishToFlexPLM: true
70
+ };
71
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
72
+ expect(objectClass).toEqual('LCSSeason');
73
+ });
74
+ it('LCSSeason - assortment - publishToFlexPLM=true', () => {
75
+ const newData = {
76
+ entityType: 'assortment',
77
+ flex2vibeMapKeyRoot: 'LCSSeason'
78
+ };
79
+ const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
80
+ expect(objectClass).toEqual('LCSSeason');
81
+ });
82
+ });
83
+ describe('getDefaultObjectTypePath', () => {
84
+ it('item-family', () => {
85
+ const newData = {
86
+ entityType: 'item',
87
+ roles: ['family']
88
+ };
89
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
90
+ expect(typePath).toEqual('Product');
91
+ });
92
+ it('item-color', () => {
93
+ const newData = {
94
+ entityType: 'item',
95
+ roles: ['color']
96
+ };
97
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
98
+ expect(typePath).toEqual('Product');
99
+ });
100
+ it('project-item-family', () => {
101
+ const newData = {
102
+ entityType: 'project-item',
103
+ roles: ['family']
104
+ };
105
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
106
+ expect(typePath).toEqual('Product');
107
+ });
108
+ it('project-item-color', () => {
109
+ const newData = {
110
+ entityType: 'project-item',
111
+ roles: ['color']
112
+ };
113
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
114
+ expect(typePath).toEqual('Product');
115
+ });
116
+ it('color', () => {
117
+ const newData = {
118
+ entityType: 'color'
119
+ };
120
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
121
+ expect(typePath).toEqual('Color');
122
+ });
123
+ it('custom-entity', () => {
124
+ const newData = {
125
+ entityType: 'custom-entity'
126
+ };
127
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
128
+ expect(typePath).toEqual('Revisable Entity');
129
+ });
130
+ it('project', () => {
131
+ const newData = {
132
+ entityType: 'project'
133
+ };
134
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
135
+ expect(typePath).toEqual('Season');
136
+ });
137
+ it('assortment', () => {
138
+ const newData = {
139
+ entityType: 'assortment'
140
+ };
141
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
142
+ expect(typePath).toEqual('Season Group');
143
+ });
144
+ it('assortment - publishToFlexPLM=true', () => {
145
+ const newData = {
146
+ entityType: 'assortment',
147
+ publishToFlexPLM: true
148
+ };
149
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
150
+ expect(typePath).toEqual('Season');
151
+ });
152
+ it('assortment - flex2vibeMapKeyRoot=LCSSeason', () => {
153
+ const newData = {
154
+ entityType: 'assortment',
155
+ flex2vibeMapKeyRoot: 'LCSSeason'
156
+ };
157
+ const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
158
+ expect(typePath).toEqual('Season');
159
+ });
160
+ });
161
+ describe('getDefaultIdentifiers', () => {
162
+ it('item-family', () => {
163
+ const newData = {
164
+ entityType: 'item',
165
+ roles: ['family']
166
+ };
167
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
168
+ expect(defaultIdentifiers).toContain('itemNumber');
169
+ expect(defaultIdentifiers).toHaveLength(1);
170
+ });
171
+ it('item-color', () => {
172
+ const newData = {
173
+ entityType: 'item',
174
+ roles: ['color']
175
+ };
176
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
177
+ expect(defaultIdentifiers).toContain('itemNumber');
178
+ expect(defaultIdentifiers).toHaveLength(1);
179
+ });
180
+ it('project', () => {
181
+ const newData = {
182
+ entityType: 'project'
183
+ };
184
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
185
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
186
+ expect(defaultIdentifiers).toHaveLength(1);
187
+ });
188
+ it('assortment', () => {
189
+ const newData = {
190
+ entityType: 'assortment'
191
+ };
192
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
193
+ expect(defaultIdentifiers).toContain('seasonGroupName');
194
+ expect(defaultIdentifiers).toHaveLength(1);
195
+ });
196
+ it('assortment - publishToFlexPLM=true', () => {
197
+ const newData = {
198
+ entityType: 'assortment',
199
+ publishToFlexPLM: true
200
+ };
201
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
202
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
203
+ expect(defaultIdentifiers).toHaveLength(1);
204
+ });
205
+ it('assortment - flex2vibeMapKeyRoot=LCSSeason', () => {
206
+ const newData = {
207
+ entityType: 'assortment',
208
+ flex2vibeMapKeyRoot: 'LCSSeason'
209
+ };
210
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
211
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
212
+ expect(defaultIdentifiers).toHaveLength(1);
213
+ });
214
+ it('color', () => {
215
+ const newData = {
216
+ entityType: 'color'
217
+ };
218
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
219
+ expect(defaultIdentifiers).toContain('name');
220
+ expect(defaultIdentifiers).toHaveLength(1);
221
+ });
222
+ it('custom-entity', () => {
223
+ const newData = {
224
+ entityType: 'custom-entity'
225
+ };
226
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
227
+ expect(defaultIdentifiers).toContain('name');
228
+ expect(defaultIdentifiers).toHaveLength(1);
229
+ });
230
+ });
231
+ describe('getDefaultInformationalProperties', () => {
232
+ it('item-family', () => {
233
+ const newData = {
234
+ entityType: 'item',
235
+ roles: ['family']
236
+ };
237
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
238
+ expect(defaultIdentifiers).toContain('name');
239
+ expect(defaultIdentifiers).toHaveLength(1);
240
+ });
241
+ it('item-color', () => {
242
+ const newData = {
243
+ entityType: 'item',
244
+ roles: ['color']
245
+ };
246
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
247
+ expect(defaultIdentifiers).toContain('optionName');
248
+ expect(defaultIdentifiers).toHaveLength(1);
249
+ });
250
+ it('project', () => {
251
+ const newData = {
252
+ entityType: 'project'
253
+ };
254
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
255
+ expect(defaultIdentifiers).toContain('name');
256
+ expect(defaultIdentifiers).toHaveLength(1);
257
+ });
258
+ it('assortment', () => {
259
+ const newData = {
260
+ entityType: 'assortment'
261
+ };
262
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
263
+ expect(defaultIdentifiers).toContain('name');
264
+ expect(defaultIdentifiers).toHaveLength(1);
265
+ });
266
+ it('color', () => {
267
+ const newData = {
268
+ entityType: 'color'
269
+ };
270
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
271
+ expect(defaultIdentifiers).toHaveLength(0);
272
+ });
273
+ it('custom-entity', () => {
274
+ const newData = {
275
+ entityType: 'custom-entity'
276
+ };
277
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
278
+ expect(defaultIdentifiers).toHaveLength(0);
279
+ });
280
+ });
281
+ describe('getEntityType', () => {
282
+ it('entityType', () => {
283
+ const entityType = 'item';
284
+ const entity = {
285
+ entityType
286
+ };
287
+ const results = type_defaults_1.TypeDefaults.getEntityType(entity);
288
+ expect(results).toEqual(entityType);
289
+ });
290
+ it('entityType from type path', () => {
291
+ const entityType = 'item';
292
+ const typePath = 'item:product:apparel';
293
+ const entity = {
294
+ typePath: typePath
295
+ };
296
+ const results = type_defaults_1.TypeDefaults.getEntityType(entity);
297
+ expect(results).toEqual(entityType);
298
+ });
299
+ it('No entityType', () => {
300
+ const typePath = 'item:product:apparel';
301
+ const entity = {
302
+ someValue: typePath
303
+ };
304
+ expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrowError();
305
+ expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrow(type_defaults_1.TypeDefaults.NO_ENTITY_TYPE);
306
+ });
307
+ });
308
+ describe('getDefaultEntityClass', () => {
309
+ it('item - LCSProduct', () => {
310
+ const object = {
311
+ objectClass: 'LCSProduct'
312
+ };
313
+ const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
314
+ expect(entityClass).toBe('item');
315
+ });
316
+ it('item - LCSSKU', () => {
317
+ const object = {
318
+ objectClass: 'LCSSKU'
319
+ };
320
+ const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
321
+ expect(entityClass).toBe('item');
322
+ });
323
+ it('color - LCSColor', () => {
324
+ const object = {
325
+ objectClass: 'LCSColor'
326
+ };
327
+ const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
328
+ expect(entityClass).toBe('color');
329
+ });
330
+ });
331
+ describe('getDefaultEntityTypePath', () => {
332
+ it('LCSProduct', () => {
333
+ const object = {
334
+ objectClass: 'LCSProduct'
335
+ };
336
+ const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
337
+ expect(typePath).toBe('item');
338
+ });
339
+ it('LCSSKU', () => {
340
+ const object = {
341
+ objectClass: 'LCSSKU'
342
+ };
343
+ const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
344
+ expect(typePath).toBe('item');
345
+ });
346
+ it('LCSProductSeasonLink', () => {
347
+ const object = {
348
+ objectClass: 'LCSProductSeasonLink'
349
+ };
350
+ const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
351
+ expect(typePath).toBe('item');
352
+ });
353
+ it('LCSSKUSeasonLink', () => {
354
+ const object = {
355
+ objectClass: 'LCSSKUSeasonLink'
356
+ };
357
+ const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
358
+ expect(typePath).toBe('item');
359
+ });
360
+ it('LCSColor', () => {
361
+ const object = {
362
+ objectClass: 'LCSColor'
363
+ };
364
+ const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
365
+ expect(typePath).toBe('color');
366
+ });
367
+ });
368
+ describe('getDefaultIdentifierPropertiesFromObject', () => {
369
+ it('LCSProduct', () => {
370
+ const object = {
371
+ objectClass: 'LCSProduct'
372
+ };
373
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
374
+ expect(defaultIdentifiers).toContain('itemNumber');
375
+ expect(defaultIdentifiers).toHaveLength(1);
376
+ });
377
+ it('LCSSKU', () => {
378
+ const object = {
379
+ objectClass: 'LCSSKU'
380
+ };
381
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
382
+ expect(defaultIdentifiers).toContain('itemNumber');
383
+ expect(defaultIdentifiers).toHaveLength(1);
384
+ });
385
+ it('LCSSeason', () => {
386
+ const object = {
387
+ objectClass: 'LCSSeason'
388
+ };
389
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
390
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
391
+ expect(defaultIdentifiers).toHaveLength(1);
392
+ });
393
+ it('SeasonGroup', () => {
394
+ const object = {
395
+ objectClass: 'SeasonGroup'
396
+ };
397
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
398
+ expect(defaultIdentifiers).toContain('seasonGroupName');
399
+ expect(defaultIdentifiers).toHaveLength(1);
400
+ });
401
+ it('LCSColor', () => {
402
+ const object = {
403
+ objectClass: 'LCSColor'
404
+ };
405
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
406
+ expect(defaultIdentifiers).toContain('name');
407
+ expect(defaultIdentifiers).toHaveLength(1);
408
+ });
409
+ it('LCSRevisableEntity', () => {
410
+ const object = {
411
+ objectClass: 'LCSRevisableEntity'
412
+ };
413
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
414
+ expect(defaultIdentifiers).toContain('name');
415
+ expect(defaultIdentifiers).toHaveLength(1);
416
+ });
417
+ it('LCSLifecycleManaged', () => {
418
+ const object = {
419
+ objectClass: 'LCSLifecycleManaged'
420
+ };
421
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
422
+ expect(defaultIdentifiers).toContain('name');
423
+ expect(defaultIdentifiers).toHaveLength(1);
424
+ });
425
+ });
426
+ describe('getDefaultInformationalPropertiesFromObject', () => {
427
+ it('LCSProduct', () => {
428
+ const object = {
429
+ objectClass: 'LCSProduct'
430
+ };
431
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
432
+ expect(defaultIdentifiers).toContain('name');
433
+ expect(defaultIdentifiers).toHaveLength(1);
434
+ });
435
+ it('LCSSKU', () => {
436
+ const object = {
437
+ objectClass: 'LCSSKU'
438
+ };
439
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
440
+ expect(defaultIdentifiers).toContain('optionName');
441
+ expect(defaultIdentifiers).toHaveLength(1);
442
+ });
443
+ it('LCSSeason', () => {
444
+ const object = {
445
+ objectClass: 'LCSSeason'
446
+ };
447
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
448
+ expect(defaultIdentifiers).toContain('name');
449
+ expect(defaultIdentifiers).toHaveLength(1);
450
+ });
451
+ it('SeasonGroup', () => {
452
+ const object = {
453
+ objectClass: 'SeasonGroup'
454
+ };
455
+ const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
456
+ expect(defaultIdentifiers).toContain('name');
457
+ expect(defaultIdentifiers).toHaveLength(1);
458
+ });
459
+ });
460
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const type_utils_1 = require("./type-utils");
4
+ describe('TypeUtils.getEventObjectClass() tests', () => {
5
+ const tu = new type_utils_1.TypeUtils();
6
+ it('LCSProduct', () => {
7
+ const entityType = 'item';
8
+ const newData = {
9
+ roles: ['family']
10
+ };
11
+ const objectClass = tu.getEventObjectClass(entityType, newData);
12
+ expect(objectClass).toEqual('LCSProduct');
13
+ });
14
+ it('LCSSKU', () => {
15
+ const entityType = 'item';
16
+ const newData = {
17
+ roles: ['color']
18
+ };
19
+ const objectClass = tu.getEventObjectClass(entityType, newData);
20
+ expect(objectClass).toEqual('LCSSKU');
21
+ });
22
+ it('LCSProductSeasonLink', () => {
23
+ const entityType = 'project-item';
24
+ const newData = {
25
+ roles: ['family']
26
+ };
27
+ const objectClass = tu.getEventObjectClass(entityType, newData);
28
+ expect(objectClass).toEqual('LCSProductSeasonLink');
29
+ });
30
+ it('LCSSKUSeasonLink', () => {
31
+ const entityType = 'project-item';
32
+ const newData = {
33
+ roles: ['color']
34
+ };
35
+ const objectClass = tu.getEventObjectClass(entityType, newData);
36
+ expect(objectClass).toEqual('LCSSKUSeasonLink');
37
+ });
38
+ it('LCSColor', () => {
39
+ const entityType = 'color';
40
+ const newData = {};
41
+ const objectClass = tu.getEventObjectClass(entityType, newData);
42
+ expect(objectClass).toEqual('LCSColor');
43
+ });
44
+ it('LCSRevisableEntity', () => {
45
+ const entityType = 'custom-entity';
46
+ const newData = {};
47
+ const objectClass = tu.getEventObjectClass(entityType, newData);
48
+ expect(objectClass).toEqual('LCSRevisableEntity');
49
+ });
50
+ });
51
+ describe('filterProperties-item', () => {
52
+ const itemType = {
53
+ typePath: 'item'
54
+ };
55
+ itemType['typeProperties'] = [
56
+ {
57
+ id: 'H4NazLloHdUVhc71',
58
+ slug: 'null',
59
+ propertyLevel: null
60
+ },
61
+ {
62
+ id: 'H4NazLloHdUVhc71',
63
+ slug: 'family',
64
+ propertyLevel: 'family'
65
+ },
66
+ {
67
+ id: 'H4NazLloHdUVhc71',
68
+ slug: 'option',
69
+ propertyLevel: 'option'
70
+ },
71
+ {
72
+ id: 'H4NazLloHdUVhc71',
73
+ slug: 'overridable',
74
+ propertyLevel: 'overridable'
75
+ },
76
+ {
77
+ id: 'H4NazLloHdUVhc71',
78
+ slug: 'all',
79
+ propertyLevel: 'all'
80
+ },
81
+ ];
82
+ const tu = new type_utils_1.TypeUtils();
83
+ it('item-family', () => {
84
+ const len = 4;
85
+ const newData = {
86
+ roles: ['family']
87
+ };
88
+ const filteredProps = tu.filterTypeProperties(itemType, newData);
89
+ expect(filteredProps.length).toEqual(len);
90
+ });
91
+ it('item-option', () => {
92
+ const len = 4;
93
+ const newData = {
94
+ roles: ['option']
95
+ };
96
+ const filteredProps = tu.filterTypeProperties(itemType, newData);
97
+ expect(filteredProps.length).toEqual(len);
98
+ });
99
+ it('item-no-roles', () => {
100
+ const len = 5;
101
+ const newData = {};
102
+ const filteredProps = tu.filterTypeProperties(itemType, newData);
103
+ expect(filteredProps.length).toEqual(len);
104
+ });
105
+ });
106
+ describe('filterProperties-project-item', () => {
107
+ const projectItemType = {
108
+ typePath: 'project-item'
109
+ };
110
+ projectItemType['typeProperties'] = [
111
+ {
112
+ id: 'H4NazLloHdUVhc71',
113
+ slug: 'null',
114
+ propertyLevel: null
115
+ },
116
+ {
117
+ id: 'H4NazLloHdUVhc71',
118
+ slug: 'family',
119
+ propertyLevel: 'family'
120
+ },
121
+ {
122
+ id: 'H4NazLloHdUVhc71',
123
+ slug: 'option',
124
+ propertyLevel: 'option'
125
+ },
126
+ {
127
+ id: 'H4NazLloHdUVhc71',
128
+ slug: 'overridable',
129
+ propertyLevel: 'overridable'
130
+ },
131
+ {
132
+ id: 'H4NazLloHdUVhc71',
133
+ slug: 'all',
134
+ propertyLevel: 'all'
135
+ },
136
+ ];
137
+ const tu = new type_utils_1.TypeUtils();
138
+ it('item-family', () => {
139
+ const len = 4;
140
+ const newData = {
141
+ roles: ['family']
142
+ };
143
+ const filteredProps = tu.filterTypeProperties(projectItemType, newData);
144
+ expect(filteredProps.length).toEqual(len);
145
+ });
146
+ it('item-option', () => {
147
+ const len = 4;
148
+ const newData = {
149
+ roles: ['option']
150
+ };
151
+ const filteredProps = tu.filterTypeProperties(projectItemType, newData);
152
+ expect(filteredProps.length).toEqual(len);
153
+ });
154
+ });
155
+ describe('filterProperties-color', () => {
156
+ const colorType = {
157
+ typePath: 'color'
158
+ };
159
+ colorType['typeProperties'] = [
160
+ {
161
+ id: 'H4NazLloHdUVhc71',
162
+ slug: 'null',
163
+ },
164
+ {
165
+ id: 'H4NazLloHdUVhc71',
166
+ slug: 'family',
167
+ },
168
+ {
169
+ id: 'H4NazLloHdUVhc71',
170
+ slug: 'option',
171
+ },
172
+ {
173
+ id: 'H4NazLloHdUVhc71',
174
+ slug: 'overridable',
175
+ },
176
+ {
177
+ id: 'H4NazLloHdUVhc71',
178
+ slug: 'all',
179
+ },
180
+ ];
181
+ const tu = new type_utils_1.TypeUtils();
182
+ it('color', () => {
183
+ const len = 5;
184
+ const newData = {
185
+ roles: ['family']
186
+ };
187
+ const filteredProps = tu.filterTypeProperties(colorType, newData);
188
+ expect(filteredProps.length).toEqual(len);
189
+ });
190
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "@contrail/app-framework": "^1.2.4",
42
42
  "@contrail/sdk": "^1.3.0",
43
- "@contrail/transform-data": "^1.0.13",
43
+ "@contrail/transform-data": "^1.0.14",
44
44
  "axios": "^1.4.0",
45
45
  "p-limit": "^3.1.0"
46
46
  }
package/publish.bat ADDED
@@ -0,0 +1,5 @@
1
+ rd /s /q lib
2
+ call npm install
3
+ call npm run build
4
+ call npm version patch
5
+ call npm publish
package/publish.sh ADDED
@@ -0,0 +1,5 @@
1
+ rm -rf lib;
2
+ npm install;
3
+ npm run build;
4
+ npm version patch;
5
+ npm publish;