@contrail/flexplm 1.1.20 → 1.1.22

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.
@@ -110,7 +110,7 @@ class BaseEntityProcessor {
110
110
  entityName: entityName,
111
111
  object: changes,
112
112
  };
113
- console.log("options: " + JSON.stringify(options));
113
+ console.log("createEntity: " + JSON.stringify(options));
114
114
  return await new sdk_1.Entities().create(options);
115
115
  }
116
116
  async updateEntity(entityName, entity, diffs) {
@@ -119,7 +119,7 @@ class BaseEntityProcessor {
119
119
  id: entity['id'],
120
120
  object: diffs
121
121
  };
122
- console.log('options: ' + JSON.stringify(options));
122
+ console.log('updateEntity: ' + JSON.stringify(options));
123
123
  return await new sdk_1.Entities().update(options);
124
124
  }
125
125
  async outbound(event) {
@@ -344,6 +344,7 @@ class DataConverter {
344
344
  let userOrg = undefined;
345
345
  let count = 0;
346
346
  let size = 0;
347
+ let emailInput = nd?.email.toLowerCase();
347
348
  const entities = new sdk_1.Entities();
348
349
  const getOptionsCriteria = {
349
350
  entityName: 'user-org',
@@ -351,7 +352,7 @@ class DataConverter {
351
352
  };
352
353
  do {
353
354
  const userBatch = await entities.get(getOptionsCriteria);
354
- userOrg = userBatch.find(uo => uo?.userEmail === nd?.email);
355
+ userOrg = userBatch.find(uo => uo?.userEmail.toLowerCase() === emailInput);
355
356
  } while (!userOrg && size == getOptionsCriteria.take && count < 15);
356
357
  return userOrg?.user;
357
358
  }
@@ -1,5 +1,7 @@
1
1
  export declare class TypeDefaults {
2
2
  static NO_ENTITY_TYPE: string;
3
+ static NO_OBJECT_CLASS: string;
4
+ static NO_TYPE_PATH: string;
3
5
  constructor();
4
6
  static getDefaultObjectClass(entity: any): string;
5
7
  static getDefaultObjectTypePath(entity: any): string;
@@ -133,6 +133,9 @@ class TypeDefaults {
133
133
  if (['LCSProduct', 'LCSSKU'].includes(objectClass)) {
134
134
  entityClass = 'item';
135
135
  }
136
+ else if (['LCSProductSeasonLink', 'LCSSKUSeasonLink'].includes(objectClass)) {
137
+ entityClass = 'project-item';
138
+ }
136
139
  else if ('LCSColor' === objectClass) {
137
140
  entityClass = 'color';
138
141
  }
@@ -142,6 +145,8 @@ class TypeDefaults {
142
145
  else if (['LCSRevisableEntity', 'LCSLifecycleManaged', 'LCSLast', 'LCSMaterial'].includes(objectClass)) {
143
146
  entityClass = 'custom-entity';
144
147
  }
148
+ if (entityClass === '')
149
+ throw Error(TypeDefaults.NO_OBJECT_CLASS);
145
150
  return entityClass;
146
151
  }
147
152
  static getDefaultEntityTypePath(object) {
@@ -150,14 +155,22 @@ class TypeDefaults {
150
155
  switch (objectClass) {
151
156
  case 'LCSProduct':
152
157
  case 'LCSSKU':
158
+ typePath = 'item';
159
+ break;
153
160
  case 'LCSProductSeasonLink':
154
161
  case 'LCSSKUSeasonLink':
155
- typePath = 'item';
162
+ typePath = 'project-item';
156
163
  break;
157
164
  case 'LCSColor':
158
165
  typePath = 'color';
159
166
  break;
167
+ case 'LCSSeason':
168
+ case 'SeasonGroup':
169
+ typePath = 'assortment';
170
+ break;
160
171
  }
172
+ if (typePath === '')
173
+ throw Error(TypeDefaults.NO_TYPE_PATH);
161
174
  return typePath;
162
175
  }
163
176
  static getDefaultIdentifierPropertiesFromObject(object) {
@@ -204,3 +217,5 @@ class TypeDefaults {
204
217
  }
205
218
  exports.TypeDefaults = TypeDefaults;
206
219
  TypeDefaults.NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
220
+ TypeDefaults.NO_OBJECT_CLASS = 'Please ensure that the flexPLMObjectClass property is provided.';
221
+ TypeDefaults.NO_TYPE_PATH = 'Please ensure that the flexPLMTypePath property is provided.';
@@ -320,6 +320,20 @@ describe('Type Defaults', () => {
320
320
  const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
321
321
  expect(entityClass).toBe('item');
322
322
  });
323
+ it('project-item - LCSProductSeasonLink', () => {
324
+ const object = {
325
+ flexPLMObjectClass: 'LCSProductSeasonLink'
326
+ };
327
+ const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
328
+ expect(entityClass).toBe('project-item');
329
+ });
330
+ it('project-item - LCSSKUSeasonLink', () => {
331
+ const object = {
332
+ flexPLMObjectClass: 'LCSSKUSeasonLink'
333
+ };
334
+ const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
335
+ expect(entityClass).toBe('project-item');
336
+ });
323
337
  it('color - LCSColor', () => {
324
338
  const object = {
325
339
  flexPLMObjectClass: 'LCSColor'
@@ -376,14 +390,14 @@ describe('Type Defaults', () => {
376
390
  flexPLMObjectClass: 'LCSProductSeasonLink'
377
391
  };
378
392
  const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
379
- expect(typePath).toBe('item');
393
+ expect(typePath).toBe('project-item');
380
394
  });
381
395
  it('LCSSKUSeasonLink', () => {
382
396
  const object = {
383
397
  flexPLMObjectClass: 'LCSSKUSeasonLink'
384
398
  };
385
399
  const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
386
- expect(typePath).toBe('item');
400
+ expect(typePath).toBe('project-item');
387
401
  });
388
402
  it('LCSColor', () => {
389
403
  const object = {
@@ -392,6 +406,20 @@ describe('Type Defaults', () => {
392
406
  const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
393
407
  expect(typePath).toBe('color');
394
408
  });
409
+ it('LCSSeason', () => {
410
+ const object = {
411
+ flexPLMObjectClass: 'LCSSeason'
412
+ };
413
+ const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
414
+ expect(typePath).toBe('assortment');
415
+ });
416
+ it('SeasonGroup', () => {
417
+ const object = {
418
+ flexPLMObjectClass: 'SeasonGroup'
419
+ };
420
+ const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
421
+ expect(typePath).toBe('assortment');
422
+ });
395
423
  });
396
424
  describe('getDefaultIdentifierPropertiesFromObject', () => {
397
425
  it('LCSProduct', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -142,7 +142,7 @@ export abstract class BaseEntityProcessor {
142
142
  entityName: entityName,
143
143
  object: changes,
144
144
  };
145
- console.log("options: " + JSON.stringify(options));
145
+ console.log("createEntity: " + JSON.stringify(options));
146
146
 
147
147
  return await new Entities().create(options);
148
148
  }
@@ -153,7 +153,7 @@ export abstract class BaseEntityProcessor {
153
153
  id: entity['id'],
154
154
  object: diffs
155
155
  };
156
- console.log('options: ' + JSON.stringify(options));
156
+ console.log('updateEntity: ' + JSON.stringify(options));
157
157
 
158
158
  return await new Entities().update(options);
159
159
  }
@@ -437,6 +437,8 @@ export class DataConverter {
437
437
  let userOrg = undefined;
438
438
  let count =0;
439
439
  let size = 0;
440
+ let emailInput = nd?.email.toLowerCase();
441
+
440
442
  const entities = new Entities();
441
443
  const getOptionsCriteria = {
442
444
  entityName: 'user-org',
@@ -445,7 +447,7 @@ export class DataConverter {
445
447
 
446
448
  do {
447
449
  const userBatch: [any] = await entities.get(getOptionsCriteria);
448
- userOrg = userBatch.find(uo => uo?.userEmail === nd?.email);
450
+ userOrg = userBatch.find(uo => uo?.userEmail.toLowerCase() === emailInput);
449
451
 
450
452
  }while( !userOrg && size == getOptionsCriteria.take && count < 15);
451
453
  return userOrg?.user
@@ -415,6 +415,26 @@ describe('Type Defaults', () =>{
415
415
  expect(entityClass).toBe('item');
416
416
  });
417
417
 
418
+ it('project-item - LCSProductSeasonLink', () =>{
419
+ const object = {
420
+ flexPLMObjectClass: 'LCSProductSeasonLink'
421
+ };
422
+
423
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
424
+
425
+ expect(entityClass).toBe('project-item');
426
+ });
427
+
428
+ it('project-item - LCSSKUSeasonLink', () =>{
429
+ const object = {
430
+ flexPLMObjectClass: 'LCSSKUSeasonLink'
431
+ };
432
+
433
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
434
+
435
+ expect(entityClass).toBe('project-item');
436
+ });
437
+
418
438
  it('color - LCSColor', () =>{
419
439
  const object = {
420
440
  flexPLMObjectClass: 'LCSColor'
@@ -491,7 +511,7 @@ describe('Type Defaults', () =>{
491
511
  };
492
512
 
493
513
  const typePath = TypeDefaults.getDefaultEntityTypePath(object);
494
- expect(typePath).toBe('item');
514
+ expect(typePath).toBe('project-item');
495
515
  });
496
516
 
497
517
  it('LCSSKUSeasonLink', () =>{
@@ -500,7 +520,7 @@ describe('Type Defaults', () =>{
500
520
  };
501
521
 
502
522
  const typePath = TypeDefaults.getDefaultEntityTypePath(object);
503
- expect(typePath).toBe('item');
523
+ expect(typePath).toBe('project-item');
504
524
  });
505
525
 
506
526
  it('LCSColor', () =>{
@@ -512,6 +532,23 @@ describe('Type Defaults', () =>{
512
532
  expect(typePath).toBe('color');
513
533
  });
514
534
 
535
+ it('LCSSeason', () =>{
536
+ const object = {
537
+ flexPLMObjectClass: 'LCSSeason'
538
+ };
539
+
540
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
541
+ expect(typePath).toBe('assortment');
542
+ });
543
+
544
+ it('SeasonGroup', () =>{
545
+ const object = {
546
+ flexPLMObjectClass: 'SeasonGroup'
547
+ };
548
+
549
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
550
+ expect(typePath).toBe('assortment');
551
+ });
515
552
  });//getDefaultEntityTypePath
516
553
 
517
554
  describe('getDefaultIdentifierPropertiesFromObject', () =>{
@@ -1,8 +1,7 @@
1
- import { MapFileUtil } from "@contrail/transform-data";
2
-
3
-
4
1
  export class TypeDefaults {
5
2
  static NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
3
+ static NO_OBJECT_CLASS = 'Please ensure that the flexPLMObjectClass property is provided.';
4
+ static NO_TYPE_PATH = 'Please ensure that the flexPLMTypePath property is provided.';
6
5
  constructor() {
7
6
  }
8
7
  /**Takes in full entity and returs the default FlexPLM
@@ -171,6 +170,8 @@ export class TypeDefaults {
171
170
  let objectClass = TypeDefaults.getObjectClass(object);
172
171
  if(['LCSProduct', 'LCSSKU'].includes(objectClass)){
173
172
  entityClass = 'item';
173
+ }else if(['LCSProductSeasonLink', 'LCSSKUSeasonLink'].includes(objectClass)){
174
+ entityClass = 'project-item'
174
175
  } else if('LCSColor' === objectClass){
175
176
  entityClass = 'color';
176
177
  } else if(['LCSSeason', 'SeasonGroup'].includes(objectClass)) {
@@ -179,6 +180,9 @@ export class TypeDefaults {
179
180
  entityClass = 'custom-entity';
180
181
  }
181
182
 
183
+ if(entityClass === '')
184
+ throw Error(TypeDefaults.NO_OBJECT_CLASS);
185
+
182
186
  return entityClass;
183
187
  }
184
188
 
@@ -195,14 +199,24 @@ export class TypeDefaults {
195
199
  switch (objectClass) {
196
200
  case 'LCSProduct':
197
201
  case 'LCSSKU':
202
+ typePath = 'item';
203
+ break;
198
204
  case 'LCSProductSeasonLink':
199
205
  case 'LCSSKUSeasonLink':
200
- typePath = 'item';
206
+ typePath = 'project-item';
201
207
  break;
202
208
  case 'LCSColor':
203
209
  typePath = 'color';
204
210
  break;
205
- }
211
+ case 'LCSSeason':
212
+ case 'SeasonGroup':
213
+ typePath = 'assortment';
214
+ break;
215
+ }
216
+
217
+ if(typePath === '')
218
+ throw Error(TypeDefaults.NO_TYPE_PATH);
219
+
206
220
  return typePath;
207
221
  }
208
222