@contrail/flexplm 1.3.1-alpha.763fca8 → 1.3.1-alpha.8bc920d

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 (111) hide show
  1. package/.github/pull_request_template.md +31 -0
  2. package/.github/workflows/flexplm-lib.yml +27 -0
  3. package/.github/workflows/publish-to-npm.yml +121 -0
  4. package/CHANGELOG.md +32 -0
  5. package/lib/entity-processor/base-entity-processor.d.ts +0 -47
  6. package/lib/entity-processor/base-entity-processor.js +0 -53
  7. package/lib/entity-processor/base-entity-processor.spec.js +0 -1
  8. package/lib/index.d.ts +0 -1
  9. package/lib/index.js +0 -1
  10. package/lib/publish/base-process-publish-assortment.d.ts +0 -25
  11. package/lib/publish/base-process-publish-assortment.js +6 -60
  12. package/lib/publish/base-process-publish-assortment.spec.js +4 -22
  13. package/lib/publish/mockData.js +0 -5
  14. package/lib/transform/identifier-conversion-spec-mockData.js +6 -34
  15. package/lib/transform/identifier-conversion.d.ts +0 -36
  16. package/lib/transform/identifier-conversion.js +0 -36
  17. package/lib/transform/identifier-conversion.spec.js +0 -4
  18. package/lib/util/config-defaults.js +0 -3
  19. package/lib/util/config-defaults.spec.js +0 -9
  20. package/lib/util/data-converter-spec-mockData.js +3 -17
  21. package/lib/util/data-converter.d.ts +0 -97
  22. package/lib/util/data-converter.js +4 -127
  23. package/lib/util/data-converter.spec.js +0 -2
  24. package/lib/util/error-response-object.d.ts +0 -5
  25. package/lib/util/error-response-object.js +0 -7
  26. package/lib/util/event-short-message-status.js +0 -1
  27. package/lib/util/federation.js +0 -8
  28. package/lib/util/flexplm-connect.d.ts +0 -7
  29. package/lib/util/flexplm-connect.js +0 -14
  30. package/lib/util/logger-config.js +0 -1
  31. package/lib/util/map-util-spec-mockData.js +3 -17
  32. package/lib/util/map-utils.d.ts +0 -27
  33. package/lib/util/map-utils.js +0 -27
  34. package/lib/util/thumbnail-util.d.ts +0 -21
  35. package/lib/util/thumbnail-util.js +1 -28
  36. package/lib/util/thumbnail-util.spec.js +0 -6
  37. package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
  38. package/lib/util/type-conversion-utils.d.ts +0 -140
  39. package/lib/util/type-conversion-utils.js +0 -143
  40. package/lib/util/type-defaults.d.ts +0 -58
  41. package/lib/util/type-defaults.js +0 -58
  42. package/lib/util/type-defaults.spec.js +5 -5
  43. package/lib/util/type-utils.d.ts +0 -21
  44. package/lib/util/type-utils.js +0 -23
  45. package/lib/util/type-utils.spec.js +0 -2
  46. package/package.json +6 -21
  47. package/publish.bat +5 -0
  48. package/publish.sh +5 -0
  49. package/src/entity-processor/base-entity-processor.spec.ts +460 -0
  50. package/src/entity-processor/base-entity-processor.ts +515 -0
  51. package/src/flexplm-request.ts +28 -0
  52. package/src/flexplm-utils.spec.ts +27 -0
  53. package/src/flexplm-utils.ts +29 -0
  54. package/src/index.ts +22 -0
  55. package/src/interfaces/interfaces.ts +122 -0
  56. package/src/interfaces/item-family-changes.ts +67 -0
  57. package/src/interfaces/publish-change-data.ts +43 -0
  58. package/src/publish/base-process-publish-assortment-callback.ts +50 -0
  59. package/src/publish/base-process-publish-assortment.spec.ts +1992 -0
  60. package/src/publish/base-process-publish-assortment.ts +1134 -0
  61. package/src/publish/mockData.ts +4561 -0
  62. package/src/transform/identifier-conversion-spec-mockData.ts +496 -0
  63. package/src/transform/identifier-conversion.spec.ts +354 -0
  64. package/src/transform/identifier-conversion.ts +282 -0
  65. package/src/util/config-defaults.spec.ts +350 -0
  66. package/src/util/config-defaults.ts +93 -0
  67. package/src/util/data-converter-spec-mockData.ts +231 -0
  68. package/src/util/data-converter.spec.ts +1041 -0
  69. package/src/util/data-converter.ts +764 -0
  70. package/src/util/error-response-object.spec.ts +116 -0
  71. package/src/util/error-response-object.ts +50 -0
  72. package/src/util/event-short-message-status.ts +22 -0
  73. package/src/util/federation.ts +172 -0
  74. package/src/util/flexplm-connect.spec.ts +132 -0
  75. package/src/util/flexplm-connect.ts +208 -0
  76. package/src/util/logger-config.ts +20 -0
  77. package/src/util/map-util-spec-mockData.ts +231 -0
  78. package/src/util/map-utils.spec.ts +103 -0
  79. package/src/util/map-utils.ts +41 -0
  80. package/src/util/mockData.ts +101 -0
  81. package/src/util/thumbnail-util.spec.ts +508 -0
  82. package/src/util/thumbnail-util.ts +272 -0
  83. package/src/util/type-conversion-utils-spec-mockData.ts +271 -0
  84. package/src/util/type-conversion-utils.spec.ts +968 -0
  85. package/src/util/type-conversion-utils.ts +460 -0
  86. package/src/util/type-defaults.spec.ts +669 -0
  87. package/src/util/type-defaults.ts +281 -0
  88. package/src/util/type-utils.spec.ts +227 -0
  89. package/src/util/type-utils.ts +144 -0
  90. package/tsconfig.json +24 -0
  91. package/tslint.json +57 -0
  92. package/lib/cli/commands/compile.d.ts +0 -1
  93. package/lib/cli/commands/compile.js +0 -71
  94. package/lib/cli/commands/compile.spec.d.ts +0 -1
  95. package/lib/cli/commands/compile.spec.js +0 -80
  96. package/lib/cli/commands/create.d.ts +0 -1
  97. package/lib/cli/commands/create.js +0 -75
  98. package/lib/cli/commands/create.spec.d.ts +0 -1
  99. package/lib/cli/commands/create.spec.js +0 -78
  100. package/lib/cli/commands/upload.d.ts +0 -10
  101. package/lib/cli/commands/upload.js +0 -219
  102. package/lib/cli/commands/upload.spec.d.ts +0 -1
  103. package/lib/cli/commands/upload.spec.js +0 -88
  104. package/lib/cli/index.d.ts +0 -2
  105. package/lib/cli/index.js +0 -64
  106. package/lib/cli/index.spec.d.ts +0 -1
  107. package/lib/cli/index.spec.js +0 -79
  108. package/lib/cli/template/mapping-template.ts.template +0 -18
  109. package/lib/interfaces/mapping-file.d.ts +0 -429
  110. package/lib/interfaces/mapping-file.js +0 -2
  111. package/scripts/copy-template.js +0 -10
@@ -44,22 +44,16 @@ class DataConverter {
44
44
  if (this.isVerboseDebugOn()) {
45
45
  console.debug('newData: ' + JSON.stringify(newData));
46
46
  }
47
- //Using event to get propertyDiffs to find emptied values
48
- //Add standard atts to skip
49
47
  dataToSkip = dataToSkip.concat(['updatedOn', 'updatedById', 'createdOn', 'createdById', 'modifiedAt', 'orgId', 'createdAt', 'id', 'typeId', 'workspaceId']);
50
- // const oldData = event.oldData;
51
48
  const data = {};
52
49
  const typeId = newData?.typeId;
53
50
  if (!typeId) {
54
- return; // Don't have a type; so can't process
51
+ return;
55
52
  }
56
53
  data['typePath'] = newData['typePath'];
57
54
  const type = await this.typeUtils.getTypeById(typeId);
58
55
  const typeProps = this.typeUtils.filterTypeProperties(type, newData);
59
56
  for (const prop of typeProps) {
60
- // if(this.logger.isTraceOn()){
61
- // this.logger.log('prop: ' + JSON.stringify(prop));
62
- // }
63
57
  const slug = prop['slug'];
64
58
  if (dataToSkip.includes(slug)) {
65
59
  continue;
@@ -75,7 +69,6 @@ class DataConverter {
75
69
  const propertyType = prop['propertyType'];
76
70
  const slug = prop['slug'];
77
71
  const nd = newData[slug];
78
- // console.log('getFlexPLMValue: ' + propertyType + ', ' +slug + ', ' + nd + ', ' + od);
79
72
  let value;
80
73
  if (['string', 'text'].includes(propertyType)) {
81
74
  value = nd || '';
@@ -86,10 +79,6 @@ class DataConverter {
86
79
  else if ('date' === propertyType) {
87
80
  if (nd) {
88
81
  value = nd;
89
- // const d = new Date(nd);
90
- // console.log('Date.getTimezoneOffset(): ' + d.getTimezoneOffset());
91
- // value = d.toISOString();
92
- // console.log('date: ' + nd + ' -- ' + value);
93
82
  }
94
83
  else {
95
84
  value = null;
@@ -111,13 +100,11 @@ class DataConverter {
111
100
  }
112
101
  }
113
102
  else if ('image' === propertyType) {
114
- // console.log('image-TODO');
115
103
  }
116
104
  else if ('formula' === propertyType) {
117
105
  value = nd;
118
106
  }
119
107
  else if ('json' === propertyType) {
120
- // console.log('json-TODO');
121
108
  value = nd;
122
109
  }
123
110
  else if ('userList' === propertyType) {
@@ -125,12 +112,6 @@ class DataConverter {
125
112
  }
126
113
  return value;
127
114
  }
128
- /** Returns the display values for list properties (choice & multi_select)
129
- *
130
- * @param prop
131
- * @param newData
132
- * @returns
133
- */
134
115
  getEnumerationValue(prop, nd) {
135
116
  const propertyType = prop['propertyType'];
136
117
  let value;
@@ -214,14 +195,6 @@ class DataConverter {
214
195
  this.objRefCache[entityId] = value;
215
196
  return value;
216
197
  }
217
- /** (Deprecated) Use TypeConversionUtils.getMapKey()
218
- * Will return the class to use to get mapping.
219
- * This is needed because mappings will be different for different sub types
220
- * of custom-entity
221
- *
222
- * @param obj: Entity being checked
223
- * @param mapping: The whole mapping file
224
- */
225
198
  getMappingClass(entity, mapping) {
226
199
  const entityTypePath = entity['typePath'];
227
200
  const typeMapKey = mapping['typeMapKey'];
@@ -235,22 +208,11 @@ class DataConverter {
235
208
  }
236
209
  return objClass;
237
210
  }
238
- /** Sets entity values from FlexPLM data passed in
239
- * Assumes the entity has a VibeIQ typeId and 'roles' value to filter if necessary.
240
- * @param entity the entity to update
241
- * @param data the FlexPLM data
242
- * @param keysToSkip properties to skip
243
- * @returns the modified entity with VibeIQ values
244
- */
245
211
  async setEntityValues(entity, data, keysToSkip = []) {
246
- // this.logger.log('setEntityValues: ' + JSON.stringify(entity));
247
- // this.logger.log('data: ' + JSON.stringify(data));
248
212
  const type = await this.typeUtils.getTypeById(entity.typeId);
249
213
  keysToSkip = keysToSkip.concat(['updatedOn', 'updatedById', 'createdOn', 'createdById', 'modifiedAt', 'orgId', 'createdAt', 'id', 'typeId', 'typePath', 'workspaceId']);
250
214
  let typeProps = this.typeUtils.filterTypeProperties(type, entity);
251
215
  typeProps = typeProps.filter(prop => !keysToSkip.includes(prop['slug']));
252
- //Only process properties that had a value sent; to not accidentally clear out values
253
- //for properties that weren't sent.
254
216
  const dataKeys = Object.getOwnPropertyNames(data);
255
217
  typeProps = typeProps.filter(prop => dataKeys.includes(prop['slug']));
256
218
  for (const prop of typeProps) {
@@ -261,17 +223,9 @@ class DataConverter {
261
223
  keyName = slug + 'Id';
262
224
  }
263
225
  entity[keyName] = await this.getEntityValue(prop, data);
264
- // console.log('entity[slug]: ' + entity[slug]);
265
226
  }
266
227
  return entity;
267
228
  }
268
- /** Gets the entity values from FlexPLM data
269
- * Assumes there isn't a VibeIQ typeId, so uses FlexPLM data to determine type
270
- * @param objectClass FlexPLM object class
271
- * @param data object data
272
- * @param keysToSkip type properties to not process
273
- * @returns object with VibeIQ values
274
- */
275
229
  async getEntityValues(objectClass, data, keysToSkip = []) {
276
230
  const entityValues = {};
277
231
  const tco = await this.typeUtils.getEntityTypeClientOptionsUsingMapping(this.transformMapFile, this.mapFileUtil, data);
@@ -296,17 +250,10 @@ class DataConverter {
296
250
  }
297
251
  return entityValues;
298
252
  }
299
- /** Gets the VibeIQ value for the property from data
300
- *
301
- * @param prop the VibeIQ property
302
- * @param data the FlexPLM data
303
- * @returns value to be set in VibeIQ
304
- */
305
253
  async getEntityValue(prop, data) {
306
254
  const propertyType = prop['propertyType'];
307
255
  const slug = prop['slug'];
308
256
  const nd = data[slug];
309
- // this.logger.log('getValue: ' + propertyType + ', ' +slug + ', ' + nd);
310
257
  let value;
311
258
  if (['string', 'text'].includes(propertyType)) {
312
259
  value = nd;
@@ -316,11 +263,6 @@ class DataConverter {
316
263
  }
317
264
  else if ('date' === propertyType) {
318
265
  if (nd) {
319
- // const offset = new Date(nd).getTimezoneOffset() * 60 * 1_000;
320
- // this.logger.log('nd: ' + nd);
321
- // this.logger.log(offset);
322
- // this.logger.log('No Offset: ' + new Date(nd).toISOString());
323
- // const d = new Date(nd + offset);// Take system Timezone into account.
324
266
  const d = new Date(nd);
325
267
  value = d.toISOString();
326
268
  }
@@ -341,25 +283,23 @@ class DataConverter {
341
283
  value = await this.setObjectReferenceValue(prop, nd);
342
284
  }
343
285
  else if ('image' === propertyType) {
344
- // console.log('TODO-image');
345
286
  }
346
287
  else if ('formula' === propertyType) {
347
- // console.log('TODO-formula');
348
288
  }
349
289
  else if ('json' === propertyType) {
350
- // console.log('TODO-json');
351
290
  }
352
291
  else if ('userList' === propertyType) {
353
292
  value = await this.setUserListValue(prop, nd);
354
293
  }
355
- // console.log(value);
294
+ else if ('size_range' === propertyType) {
295
+ value = nd || {};
296
+ }
356
297
  return value;
357
298
  }
358
299
  setEnumerationKeys(prop, nd, matchByDisplay) {
359
300
  const propertyType = prop['propertyType'];
360
301
  let value;
361
302
  if (['choice', 'multi_select'].includes(propertyType)) {
362
- //If there are no options, use empty array to not error out and don't set anything
363
303
  const options = prop['options'] || [];
364
304
  if ('choice' === propertyType) {
365
305
  if (nd) {
@@ -389,12 +329,6 @@ class DataConverter {
389
329
  }
390
330
  return value;
391
331
  }
392
- /** Compares the potential changes to the entity and returns only the actual differences.
393
- *
394
- * @param entity the full entity
395
- * @param changes the potential changes
396
- * @returns only the change values that are different from the entity's value
397
- */
398
332
  getPersistableChanges(entity, changes) {
399
333
  const entityCompareValues = {};
400
334
  for (const key of (Object.getOwnPropertyNames(changes))) {
@@ -409,12 +343,6 @@ class DataConverter {
409
343
  }
410
344
  return diffValues;
411
345
  }
412
- /** Sets object reference value from FlexPLM data passed in
413
- *
414
- * @param prop the VibeIQ property
415
- * @param nd the VibeIQ data
416
- * @returns the object reference id from VibeIQ
417
- */
418
346
  async setObjectReferenceValue(prop, nd) {
419
347
  let objectReferenceId = "";
420
348
  if (!nd) {
@@ -473,13 +401,6 @@ class DataConverter {
473
401
  this.objRefCache[cacheKey] = objectReferenceId;
474
402
  return objectReferenceId;
475
403
  }
476
- /**
477
- * Retrieves all object references of a specified entity type based on the provided criteria.
478
- * This function handles pagination and asynchronously fetches object references until there are no more pages.
479
- * @param {string} entityType - The type of entity for which object references are to be retrieved.
480
- * @param {object} rootTypeCriteria - The criteria used to filter object references.
481
- * @returns {Promise<Array>} A Promise that resolves to an array containing all object references.
482
- */
483
404
  async getAllObjectReferences(entityType, rootTypeCriteria, postProcessCriteria = null) {
484
405
  const entities = new sdk_1.Entities();
485
406
  let loads = [];
@@ -535,14 +456,6 @@ class DataConverter {
535
456
  }
536
457
  return loads;
537
458
  }
538
- /**
539
- * Checks if all keys and values of a given object are present in an array of objects.
540
- * @param {Object} criteria - The object whose keys and values are to be checked in the array of objects.
541
- * @param {Array<Object>} arrayOfObjects - The array of objects to be searched for matching keys and values.
542
- * @param {string} entityTypePath - The type / subtype for the property; objects must be this type or a sub type of it.
543
- * @returns {(Object|boolean)} Returns the array of objects that matches all keys and values of the provided object.
544
- * If no match is found, returns empty array.
545
- */
546
459
  checkKeysAndValues(criteria, arrayOfObjects, entityTypePath) {
547
460
  let arrOfMatchObjects = [];
548
461
  for (let i = 0; i < arrayOfObjects.length; i++) {
@@ -566,11 +479,6 @@ class DataConverter {
566
479
  }
567
480
  return arrOfMatchObjects;
568
481
  }
569
- /** Filters out archived and trashed entities from the provided array of entities.
570
- *
571
- * @param entities
572
- * @returns
573
- */
574
482
  filterOutArchivedAndTrashedEntities(entities) {
575
483
  if (!entities || !Array.isArray(entities) || entities.length === 0) {
576
484
  return [];
@@ -581,12 +489,6 @@ class DataConverter {
581
489
  return !isArchived && !isTrashed;
582
490
  });
583
491
  }
584
- /** Sets userListId value from FlexPLM data passed in
585
- *
586
- * @param prop the VibeIQ property
587
- * @param nd the VibeIQ data
588
- * @returns the modified entity with FlexPLM values
589
- */
590
492
  async setUserListValue(prop, nd) {
591
493
  if (!nd?.email) {
592
494
  return "";
@@ -607,13 +509,6 @@ class DataConverter {
607
509
  }
608
510
  return userId;
609
511
  }
610
- /** Makes batch calls of 1000 of user-org entities until
611
- * it find one with userEmail of passed in nd.email.
612
- * Maxes out after querying for 15,000 user-org entities
613
- *
614
- * @param nd
615
- * @returns
616
- */
617
512
  async getUserByEmail(nd) {
618
513
  let userOrg = undefined;
619
514
  let count = 0;
@@ -630,11 +525,6 @@ class DataConverter {
630
525
  } while (!userOrg && size == getOptionsCriteria.take && count < 15);
631
526
  return userOrg?.user;
632
527
  }
633
- /** Shows warning if user email address not present in group associated to property
634
- *
635
- * @param prop the VibeIQ property
636
- * @param userEmail user email address
637
- */
638
528
  async processGroupMemberCheck(prop, userEmail) {
639
529
  let arrUserList = [];
640
530
  if (this.userRefCache[prop.typePropertyUserListId]) {
@@ -657,12 +547,6 @@ class DataConverter {
657
547
  }
658
548
  }
659
549
  }
660
- /** Gets the VibeIQ value for the userList property from data
661
- *
662
- * @param prop the VibeIQ property
663
- * @param newData the FlexPLM data
664
- * @returns value to be set in VibeIQ
665
- */
666
550
  async getUserListValue(prop, newData) {
667
551
  const slug = prop['slug'];
668
552
  if (app_framework_1.Logger.isDebugOn()) {
@@ -691,13 +575,6 @@ class DataConverter {
691
575
  }
692
576
  return value;
693
577
  }
694
- /** Makes batch calls of 1000 of user-org entities until
695
- * it find one with user.id of passed in userId.
696
- * Maxes out after querying for 15,000 user-org entities
697
- *
698
- * @param userId
699
- * @returns
700
- */
701
578
  async getUserById(userId) {
702
579
  let userOrg = undefined;
703
580
  let count = 0;
@@ -609,7 +609,6 @@ describe('checkKeysAndValues', () => {
609
609
  { name: 'Group 4', typePath: 'custom-entity:grouping:sub' },
610
610
  { name: 'Group 5', typePath: 'custom-entity:grouping:sub' }
611
611
  ];
612
- //item:product:newBalance:accessories, item:product:newBalance:apparel
613
612
  it('Group 1', () => {
614
613
  const criteria = {
615
614
  name: 'Group 1'
@@ -831,7 +830,6 @@ describe('getUserListValue', () => {
831
830
  ];
832
831
  const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
833
832
  const dc = new data_converter_1.DataConverter(config, mapFileUtil);
834
- //getUserById
835
833
  let spyGetUserById = jest.spyOn(dc, 'getUserById')
836
834
  .mockImplementation(async (nd) => {
837
835
  return userEmailMapping.find((user) => user.id === nd);
@@ -1,9 +1,4 @@
1
1
  import { AppActionCallBack } from "@contrail/app-framework";
2
2
  export declare class ErrorResponseObject {
3
- /** Returns a response, checking for multiple possible error details
4
- *
5
- * @param e
6
- * @returns
7
- */
8
3
  static getResponse(e: any): AppActionCallBack;
9
4
  }
@@ -3,11 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ErrorResponseObject = void 0;
4
4
  const app_framework_1 = require("@contrail/app-framework");
5
5
  class ErrorResponseObject {
6
- /** Returns a response, checking for multiple possible error details
7
- *
8
- * @param e
9
- * @returns
10
- */
11
6
  static getResponse(e) {
12
7
  if (!e) {
13
8
  const response = {
@@ -25,7 +20,6 @@ class ErrorResponseObject {
25
20
  }
26
21
  };
27
22
  const output = response.output;
28
- //Errors when persisting in VibeIQ
29
23
  if (e.details)
30
24
  output.errorDetails = e.details;
31
25
  if (e.code)
@@ -36,7 +30,6 @@ class ErrorResponseObject {
36
30
  output.type = e.type;
37
31
  if (e.name)
38
32
  output.errorName = e.name;
39
- //Has original cause
40
33
  if (e.cause) {
41
34
  output.cause = {};
42
35
  const cause = output.cause;
@@ -16,7 +16,6 @@ var EventShortMessageStatus;
16
16
  EventShortMessageStatus["PRIMARY_CONTENT_UPDATED"] = "Primary_Content_Updated";
17
17
  EventShortMessageStatus["TOO_MANY_ENTITIES_FOUND"] = "Too_Many_Entities_Found";
18
18
  EventShortMessageStatus["UPDATED"] = "Updated";
19
- //Publish
20
19
  EventShortMessageStatus["NOT_PUBLISHABLE"] = "Not_Publishable";
21
20
  EventShortMessageStatus["NO_FEDERATION_INFO"] = "No_Federation_Information";
22
21
  EventShortMessageStatus["NO_EVENTS_TO_SEND"] = "No_Events_to_Send";
@@ -43,11 +43,9 @@ class Federation {
43
43
  mappedReference: itemResults[i].federatedId,
44
44
  federationSchema: FED_CONFIG.federationSchema
45
45
  };
46
- // console.log('createFederatedRecord: ' + JSON.stringify(payload));
47
46
  try {
48
47
  const results = await new sdk_1.Entities().create({ entityName: 'federation', object: payload });
49
48
  return results;
50
- // console.log(JSON.stringify(results));
51
49
  }
52
50
  catch (error) {
53
51
  console.log('createFederatedRecord-error: ', error);
@@ -81,16 +79,13 @@ class Federation {
81
79
  return { entityType, entityId };
82
80
  }
83
81
  async getEntityFromMappedRefId(mappedRefId) {
84
- // console.log('!---getEntityFromMappedRefId: ' + mappedRefId);
85
82
  const fedRecord = await this.getFederationRecordFromMappedRefId(mappedRefId);
86
83
  console.log('fedRecord: ' + JSON.stringify(fedRecord));
87
84
  if (!fedRecord) {
88
- //Not creating from FlexPLM at this time.
89
85
  console.log('Federation Record doesnt exist. Cant get entity!');
90
86
  return;
91
87
  }
92
88
  const { entityType, entityId } = Federation.getEntityId(fedRecord);
93
- // console.log(entityType + ':' + entityId);
94
89
  const criteria = {
95
90
  id: entityId
96
91
  };
@@ -99,7 +94,6 @@ class Federation {
99
94
  criteria
100
95
  });
101
96
  const entity = (entities && entities[0]) ? entities[0] : undefined;
102
- // console.log(' entities: ' +JSON.stringify(entities));
103
97
  return entity;
104
98
  }
105
99
  async getFederationRecordsFromIds(ids) {
@@ -110,7 +104,6 @@ class Federation {
110
104
  appIdentifier: FED_CONFIG.appIdentifier,
111
105
  federationSchema: FED_CONFIG.federationSchema
112
106
  };
113
- // this.logger.log('getFederatedMappedRefId: ' + JSON.stringify(criteria));
114
107
  const recs = await new sdk_1.Entities().get({
115
108
  entityName: 'federation',
116
109
  criteria
@@ -133,7 +126,6 @@ class Federation {
133
126
  appIdentifier: FED_CONFIG.appIdentifier,
134
127
  federationSchema: FED_CONFIG.federationSchema
135
128
  };
136
- // this.logger.log('getFederatedMappedRefId: ' + JSON.stringify(criteria));
137
129
  const records = await entities.get({
138
130
  entityName: 'federation',
139
131
  criteria
@@ -14,13 +14,6 @@ export declare class FlexPLMConnect {
14
14
  protected processRequest(payload: any): Promise<FlexPLMResponseData>;
15
15
  sendToFlexPLM(payload: PayloadType): Promise<FlexPLMResponseData>;
16
16
  sendMultipleToFlexPLM(payload: PayloadType[]): Promise<FlexPLMResponseData>;
17
- /** Runs a GET request to FlexPLM.
18
- * @param params - Optional configuration for the request.
19
- * @param params.urlPath - Custom URL path to use instead of the default `/servlet/rest` + endpoint.
20
- * @param params.includeUrlContext - Whether to include the urlContext in the URL. Defaults to `true`.
21
- * @param params.returnFullResponse - If `true`, returns the raw `Response` object instead of parsed JSON. Defaults to `false`.
22
- * @returns The parsed JSON response body, or the raw `Response` object if `returnFullResponse` is `true`.
23
- */
24
17
  getRequest(params?: {
25
18
  urlPath?: string;
26
19
  includeUrlContext?: boolean;
@@ -18,9 +18,6 @@ class FlexPLMConnect {
18
18
  this.staticHeaders = this.config?.flexplmConnect?.staticHeaders;
19
19
  }
20
20
  }
21
- /////////////////////////////////////////////////////////////////////////////
22
- ///////// Custom getRequestOptions: start
23
- /////////////////////////////////////////////////////////////////////////////
24
21
  getRequestOptions(method) {
25
22
  const csrfOptions = {
26
23
  method,
@@ -40,9 +37,6 @@ class FlexPLMConnect {
40
37
  }
41
38
  return csrfOptions;
42
39
  }
43
- /////////////////////////////////////////////////////////////////////////////
44
- ///////// Custom getRequestOptions: end
45
- /////////////////////////////////////////////////////////////////////////////
46
40
  async getCSRF() {
47
41
  const urlContext = this.config.urlContext;
48
42
  const csrfEndpoint = this.config.csrfEndpoint;
@@ -136,7 +130,6 @@ class FlexPLMConnect {
136
130
  }
137
131
  }
138
132
  console.log('eventResponse.status: ' + status);
139
- // console.log('eventBody: ', JSON.stringify(data));
140
133
  return res;
141
134
  }
142
135
  catch (e) {
@@ -152,13 +145,6 @@ class FlexPLMConnect {
152
145
  async sendMultipleToFlexPLM(payload) {
153
146
  return await this.processRequest(payload);
154
147
  }
155
- /** Runs a GET request to FlexPLM.
156
- * @param params - Optional configuration for the request.
157
- * @param params.urlPath - Custom URL path to use instead of the default `/servlet/rest` + endpoint.
158
- * @param params.includeUrlContext - Whether to include the urlContext in the URL. Defaults to `true`.
159
- * @param params.returnFullResponse - If `true`, returns the raw `Response` object instead of parsed JSON. Defaults to `false`.
160
- * @returns The parsed JSON response body, or the raw `Response` object if `returnFullResponse` is `true`.
161
- */
162
148
  async getRequest(params) {
163
149
  const { urlPath, includeUrlContext = true, returnFullResponse = false } = params || {};
164
150
  const urlContext = includeUrlContext ? this.config.urlContext : '';
@@ -5,7 +5,6 @@ const app_framework_1 = require("@contrail/app-framework");
5
5
  async function setLoggerConfig(appConfig) {
6
6
  let logLevel = app_framework_1.LogLevel.INFO;
7
7
  if (!appConfig.logLevel) {
8
- //pass
9
8
  }
10
9
  else if (appConfig.logLevel === 'error') {
11
10
  logLevel = app_framework_1.LogLevel.ERROR;
@@ -31,26 +31,12 @@ exports.mapping = {
31
31
  }
32
32
  }
33
33
  }
34
- // flex2vibe: {
35
- // LCSRevisableEntity: {
36
- // getMapKey: (object) =>{ return object;}
37
- // },
38
- // LCSLast: {
39
- // getMapKey: (object) => {return object;}
40
- // },
41
- // LCSMaterial: {
42
- // getMapKey: (object) =>{ return object;}
43
- // },
44
- // LCSBusinessObject: {
45
- // getMapKey: (object) => {return object;}
46
- // }
47
- // },
48
34
  },
49
35
  LCSProduct: {
50
36
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
51
37
  vibe2flex: {
52
38
  getClass: () => 'LCSProduct',
53
- getSoftType: (entity /*, dependencies*/) => {
39
+ getSoftType: (entity) => {
54
40
  const prodType = entity['prodType'];
55
41
  let val = '';
56
42
  switch (prodType) {
@@ -75,7 +61,7 @@ exports.mapping = {
75
61
  vibeIQIdentifier: 'itemNumber'
76
62
  },
77
63
  valueTransform: {
78
- transformEx: (row /*, dependencies*/) => {
64
+ transformEx: (row) => {
79
65
  return row['otherProp'] + 'xxx';
80
66
  }
81
67
  }
@@ -93,7 +79,7 @@ exports.mapping = {
93
79
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
94
80
  vibe2flex: {
95
81
  getClass: () => 'LCSSKU',
96
- getSoftType: (entity /*, dependencies*/) => {
82
+ getSoftType: (entity) => {
97
83
  const prodType = entity['prodType'];
98
84
  let val = '';
99
85
  switch (prodType) {
@@ -1,33 +1,6 @@
1
1
  import { MapFileUtil } from '@contrail/transform-data';
2
2
  export declare 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
3
  static applyTransformMap(transformMapFile: any, mapFileUtil: any, data: any, mapSectionKey: string, direction: string, transformTaskOrderKey?: string): Promise<any>;
14
- /** Returns the mapKey based on the 'typeConversion' section of the map file.
15
- * If the map file doesn't have a section for the type in question, 'undefined' is returned.
16
- *
17
- * @param fileId
18
- * @param mapFileUtil
19
- * @param data The full object
20
- * @param type The entity or object class of the object. The functions are keyed based on this.
21
- * @param direction
22
- * @returns
23
- */
24
4
  static getMapKey(transformMapFile: any, mapFileUtil: MapFileUtil, data: any, type: string, direction: string): Promise<string>;
25
- /** Returns the full map section with both directions; identifier and informational properties; etc.
26
- *
27
- * @param transformMapFile id if map file
28
- * @param mapFileUtil
29
- * @param mapSectionKey key of the map section
30
- * @returns
31
- */
32
5
  static getFullMapSection(transformMapFile: string, mapFileUtil: MapFileUtil, mapSectionKey: string): Promise<any>;
33
6
  }
@@ -2,39 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MapUtil = void 0;
4
4
  class MapUtil {
5
- /** Transforms the data, assumes mapSectionKey has been correctly determined.
6
- *
7
- * @param transformMapFile id of map file
8
- * @param mapFileUtil
9
- * @param data
10
- * @param mapSectionKey key for section of map file
11
- * @param direction vibe2flex or flex2vibe
12
- * @param transformTaskOrderKey key for the list of tasks to be processed. default is 'transformOrder'
13
- * @returns The converted data
14
- */
15
5
  static async applyTransformMap(transformMapFile, mapFileUtil, data, mapSectionKey, direction, transformTaskOrderKey = 'transformOrder') {
16
6
  return await mapFileUtil.applyTransformMap(transformMapFile, data, mapSectionKey, direction, transformTaskOrderKey);
17
7
  }
18
- /** Returns the mapKey based on the 'typeConversion' section of the map file.
19
- * If the map file doesn't have a section for the type in question, 'undefined' is returned.
20
- *
21
- * @param fileId
22
- * @param mapFileUtil
23
- * @param data The full object
24
- * @param type The entity or object class of the object. The functions are keyed based on this.
25
- * @param direction
26
- * @returns
27
- */
28
8
  static async getMapKey(transformMapFile, mapFileUtil, data, type, direction) {
29
9
  return await mapFileUtil.getMapKey(transformMapFile, data, type, direction);
30
10
  }
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
11
  static async getFullMapSection(transformMapFile, mapFileUtil, mapSectionKey) {
39
12
  return await mapFileUtil.getFullMapSection(transformMapFile, mapSectionKey);
40
13
  }
@@ -6,7 +6,6 @@ interface ContentCustomSize {
6
6
  }
7
7
  export declare class ThumbnailUtil {
8
8
  private config;
9
- /** The max_thumbnail_size is for limiting the size of the thumbnail being sent to FlexPLM. It is used when checking the size of the auto generated thumbnails (smallViewable, tinyViewable, etc.). */
10
9
  private max_thumbnail_size;
11
10
  private entities;
12
11
  static NEW_THUMBNAIL_ID: string;
@@ -17,31 +16,11 @@ export declare class ThumbnailUtil {
17
16
  }[];
18
17
  constructor(config: FCConfig);
19
18
  setOutboundThumbnail(data: any, event: any): Promise<any>;
20
- /** Determines if a new image has been generated. If any viewable is new, there might be a better
21
- * sized image. So send the fileId as new.
22
- */
23
19
  isThumbnailNew(event: any, customSizes: any[]): boolean;
24
20
  getFileId(primaryViewableId: string): Promise<string | undefined>;
25
21
  getCustomSizes(): Promise<ContentCustomSize[]>;
26
22
  getContentEntity(primaryViewableId: any, sizes: ContentCustomSize[]): Promise<any>;
27
- /** This outputs the content entity, without the inflated file entities.
28
- * To help debugging issues with sending the thumbnail info.
29
- * The inflated entities are removed, because are large and cause
30
- * problems with log file size limits.
31
- *
32
- * @param content: the content with inflated objects
33
- * @param relations: string[] of the slugs for inflated objects
34
- */
35
23
  logContentResults(content: any, relations: string[]): void;
36
- /** Syncs the thumbnail from FlexPLM to VibeIQ. Handles creating, replacing, or removing
37
- * the primary viewable content and persists the updates directly to the entity.
38
- *
39
- * @param entityId - The ID of the entity to update with thumbnail properties.
40
- * @param primaryViewableId - The existing primary viewable content ID, if any.
41
- * @param event - The inbound event containing thumbnail data (NEW_THUMBNAIL_ID / EXISTING_THUMBNAIL_ID).
42
- * @param entityName - The entity type name (e.g. 'item', 'color') used for API calls.
43
- * @returns The updated entity, or undefined if no thumbnail changes were needed.
44
- */
45
24
  syncThumbnailToVibeIQ({ entityId, primaryViewableId, event, entityName }: {
46
25
  entityId: string;
47
26
  primaryViewableId?: string;