@contrail/flexplm 1.5.1-alpha.64caad7 → 1.6.0-alpha.6f15d4e

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/lib/cli/commands/compile.d.ts +4 -0
  2. package/lib/cli/commands/compile.js +73 -0
  3. package/lib/cli/commands/compile.spec.d.ts +1 -0
  4. package/lib/cli/commands/compile.spec.js +80 -0
  5. package/lib/cli/commands/create.d.ts +5 -0
  6. package/lib/cli/commands/create.js +77 -0
  7. package/lib/cli/commands/create.spec.d.ts +1 -0
  8. package/lib/cli/commands/create.spec.js +78 -0
  9. package/lib/cli/commands/upload.d.ts +17 -0
  10. package/lib/cli/commands/upload.js +228 -0
  11. package/lib/cli/commands/upload.spec.d.ts +1 -0
  12. package/lib/cli/commands/upload.spec.js +88 -0
  13. package/lib/cli/index.d.ts +5 -0
  14. package/lib/cli/index.js +70 -0
  15. package/lib/cli/index.spec.d.ts +1 -0
  16. package/lib/cli/index.spec.js +85 -0
  17. package/lib/cli/template/mapping-template.ts.template +62 -0
  18. package/lib/entity-processor/base-entity-processor.d.ts +65 -0
  19. package/lib/entity-processor/base-entity-processor.js +71 -0
  20. package/lib/entity-processor/base-entity-processor.spec.js +1 -0
  21. package/lib/index.d.ts +1 -0
  22. package/lib/index.js +1 -0
  23. package/lib/interfaces/mapping-file.d.ts +460 -0
  24. package/lib/interfaces/mapping-file.js +2 -0
  25. package/lib/publish/base-process-publish-assortment.d.ts +25 -1
  26. package/lib/publish/base-process-publish-assortment.js +67 -48
  27. package/lib/publish/base-process-publish-assortment.spec.js +22 -143
  28. package/lib/publish/mockData.js +5 -0
  29. package/lib/transform/identifier-conversion-spec-mockData.js +34 -6
  30. package/lib/transform/identifier-conversion.d.ts +36 -0
  31. package/lib/transform/identifier-conversion.js +36 -0
  32. package/lib/transform/identifier-conversion.spec.js +4 -0
  33. package/lib/util/config-defaults.js +3 -0
  34. package/lib/util/config-defaults.spec.js +9 -0
  35. package/lib/util/data-converter-spec-mockData.js +17 -3
  36. package/lib/util/data-converter.d.ts +97 -0
  37. package/lib/util/data-converter.js +127 -1
  38. package/lib/util/data-converter.spec.js +2 -0
  39. package/lib/util/error-response-object.d.ts +5 -0
  40. package/lib/util/error-response-object.js +7 -0
  41. package/lib/util/event-short-message-status.js +1 -0
  42. package/lib/util/federation.js +8 -0
  43. package/lib/util/flexplm-connect.d.ts +7 -0
  44. package/lib/util/flexplm-connect.js +14 -0
  45. package/lib/util/logger-config.js +1 -0
  46. package/lib/util/map-util-spec-mockData.js +17 -3
  47. package/lib/util/map-utils.d.ts +27 -0
  48. package/lib/util/map-utils.js +27 -0
  49. package/lib/util/thumbnail-util.d.ts +21 -0
  50. package/lib/util/thumbnail-util.js +28 -1
  51. package/lib/util/thumbnail-util.spec.js +6 -0
  52. package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
  53. package/lib/util/type-conversion-utils.d.ts +151 -0
  54. package/lib/util/type-conversion-utils.js +154 -0
  55. package/lib/util/type-defaults.d.ts +66 -0
  56. package/lib/util/type-defaults.js +66 -0
  57. package/lib/util/type-defaults.spec.js +5 -5
  58. package/lib/util/type-utils.d.ts +21 -0
  59. package/lib/util/type-utils.js +23 -0
  60. package/lib/util/type-utils.spec.js +2 -0
  61. package/package.json +21 -6
  62. package/scripts/copy-template.js +10 -0
  63. package/.github/pull_request_template.md +0 -31
  64. package/.github/workflows/flexplm-lib.yml +0 -27
  65. package/.github/workflows/publish-to-npm.yml +0 -121
  66. package/CHANGELOG.md +0 -49
  67. package/publish.bat +0 -5
  68. package/publish.sh +0 -5
  69. package/src/entity-processor/base-entity-processor.spec.ts +0 -689
  70. package/src/entity-processor/base-entity-processor.ts +0 -583
  71. package/src/flexplm-request.ts +0 -28
  72. package/src/flexplm-utils.spec.ts +0 -27
  73. package/src/flexplm-utils.ts +0 -29
  74. package/src/index.ts +0 -22
  75. package/src/interfaces/interfaces.ts +0 -122
  76. package/src/interfaces/item-family-changes.ts +0 -67
  77. package/src/interfaces/publish-change-data.ts +0 -43
  78. package/src/publish/base-process-publish-assortment-callback.ts +0 -50
  79. package/src/publish/base-process-publish-assortment.spec.ts +0 -2154
  80. package/src/publish/base-process-publish-assortment.ts +0 -1173
  81. package/src/publish/mockData.ts +0 -4561
  82. package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
  83. package/src/transform/identifier-conversion.spec.ts +0 -386
  84. package/src/transform/identifier-conversion.ts +0 -282
  85. package/src/util/config-defaults.spec.ts +0 -445
  86. package/src/util/config-defaults.ts +0 -106
  87. package/src/util/data-converter-spec-mockData.ts +0 -231
  88. package/src/util/data-converter.spec.ts +0 -1622
  89. package/src/util/data-converter.ts +0 -819
  90. package/src/util/error-response-object.spec.ts +0 -116
  91. package/src/util/error-response-object.ts +0 -50
  92. package/src/util/event-short-message-status.ts +0 -22
  93. package/src/util/federation.ts +0 -172
  94. package/src/util/flexplm-connect.spec.ts +0 -132
  95. package/src/util/flexplm-connect.ts +0 -208
  96. package/src/util/logger-config.ts +0 -20
  97. package/src/util/map-util-spec-mockData.ts +0 -231
  98. package/src/util/map-utils.spec.ts +0 -103
  99. package/src/util/map-utils.ts +0 -41
  100. package/src/util/mockData.ts +0 -101
  101. package/src/util/thumbnail-util.spec.ts +0 -508
  102. package/src/util/thumbnail-util.ts +0 -272
  103. package/src/util/type-conversion-utils-spec-mockData.ts +0 -272
  104. package/src/util/type-conversion-utils.spec.ts +0 -1031
  105. package/src/util/type-conversion-utils.ts +0 -490
  106. package/src/util/type-defaults.spec.ts +0 -797
  107. package/src/util/type-defaults.ts +0 -320
  108. package/src/util/type-utils.spec.ts +0 -227
  109. package/src/util/type-utils.ts +0 -144
  110. package/tsconfig.json +0 -24
  111. package/tslint.json +0 -57
@@ -8,6 +8,7 @@ const flexplm_connect_1 = require("./flexplm-connect");
8
8
  class ThumbnailUtil {
9
9
  constructor(config) {
10
10
  this.config = config;
11
+ /** 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.). */
11
12
  this.max_thumbnail_size = 5 * 1024 * 1024;
12
13
  this.entities = new sdk_1.Entities();
13
14
  if (this.config['max_thumbnail_size']) {
@@ -17,6 +18,7 @@ class ThumbnailUtil {
17
18
  async setOutboundThumbnail(data, event) {
18
19
  if (event?.newData?.primaryViewableId && event?.newData?.largeViewableDownloadUrl) {
19
20
  const primaryViewableId = event.newData.primaryViewableId;
21
+ //get custom sizes
20
22
  const fileId = await this.getFileId(primaryViewableId);
21
23
  if (fileId) {
22
24
  const customSizes = await this.getCustomSizes();
@@ -31,6 +33,9 @@ class ThumbnailUtil {
31
33
  }
32
34
  return data;
33
35
  }
36
+ /** Determines if a new image has been generated. If any viewable is new, there might be a better
37
+ * sized image. So send the fileId as new.
38
+ */
34
39
  isThumbnailNew(event, customSizes) {
35
40
  const propertyDiffs = event?.propertyDiffs;
36
41
  if (propertyDiffs) {
@@ -52,6 +57,7 @@ class ThumbnailUtil {
52
57
  const OOBSizes = JSON.parse(JSON.stringify(ThumbnailUtil.OOB_SIZES));
53
58
  sizes.push(...OOBSizes);
54
59
  console.info('sizes: ' + JSON.stringify(sizes));
60
+ //get Content
55
61
  const content = await this.getContentEntity(primaryViewableId, sizes);
56
62
  if (!content) {
57
63
  return undefined;
@@ -99,6 +105,14 @@ class ThumbnailUtil {
99
105
  this.logContentResults(content, relations);
100
106
  return content;
101
107
  }
108
+ /** This outputs the content entity, without the inflated file entities.
109
+ * To help debugging issues with sending the thumbnail info.
110
+ * The inflated entities are removed, because are large and cause
111
+ * problems with log file size limits.
112
+ *
113
+ * @param content: the content with inflated objects
114
+ * @param relations: string[] of the slugs for inflated objects
115
+ */
102
116
  logContentResults(content, relations) {
103
117
  if (app_framework_1.Logger.isDebugOn() && content && relations) {
104
118
  const contentCopy = JSON.parse(JSON.stringify(content));
@@ -108,12 +122,22 @@ class ThumbnailUtil {
108
122
  console.debug('content: ' + JSON.stringify(contentCopy));
109
123
  }
110
124
  }
125
+ /** Syncs the thumbnail from FlexPLM to VibeIQ. Handles creating, replacing, or removing
126
+ * the primary viewable content and persists the updates directly to the entity.
127
+ *
128
+ * @param entityId - The ID of the entity to update with thumbnail properties.
129
+ * @param primaryViewableId - The existing primary viewable content ID, if any.
130
+ * @param event - The inbound event containing thumbnail data (NEW_THUMBNAIL_ID / EXISTING_THUMBNAIL_ID).
131
+ * @param entityName - The entity type name (e.g. 'item', 'color') used for API calls.
132
+ * @returns The updated entity, or undefined if no thumbnail changes were needed.
133
+ */
111
134
  async syncThumbnailToVibeIQ({ entityId, primaryViewableId, event, entityName }) {
112
135
  console.debug(`syncThumbnailToVibeIQ: entityId=${entityId}, primaryViewableId=${primaryViewableId}, entityName=${entityName}`);
113
136
  const eventData = event.data || {};
114
137
  const newThumbnailId = eventData[ThumbnailUtil.NEW_THUMBNAIL_ID];
115
138
  const existingThumbnailId = eventData[ThumbnailUtil.EXISTING_THUMBNAIL_ID];
116
139
  const thumbnailUrl = newThumbnailId || existingThumbnailId;
140
+ // Case 1: REMOVE_THUMBNAIL
117
141
  if (newThumbnailId === ThumbnailUtil.REMOVE_THUMBNAIL) {
118
142
  if (primaryViewableId) {
119
143
  await this.entities.delete({ entityName: 'content', id: primaryViewableId });
@@ -123,10 +147,12 @@ class ThumbnailUtil {
123
147
  console.debug(`syncThumbnailToVibeIQ: applied clear updates for entityId=${entityId}`);
124
148
  return updatedEntity;
125
149
  }
150
+ // Early return if no thumbnail URL
126
151
  if (!thumbnailUrl) {
127
152
  console.debug(`syncThumbnailToVibeIQ: no thumbnail URL for entityId=${entityId}`);
128
153
  return undefined;
129
154
  }
155
+ // Case 2: No existing primaryViewableId — create new content
130
156
  if (!primaryViewableId) {
131
157
  const content = await this.createContentFromFlexPLM(thumbnailUrl, entityId, entityName);
132
158
  await this.entities.update({ entityName: 'content', id: content.id, object: { flexplmThumbnailUrl: thumbnailUrl } });
@@ -135,10 +161,11 @@ class ThumbnailUtil {
135
161
  console.debug(`syncThumbnailToVibeIQ: created new content ${content.id} for entityId=${entityId}`);
136
162
  return updatedEntity;
137
163
  }
164
+ // Case 3: Has primaryViewableId — check if thumbnail changed
138
165
  const primaryViewable = await this.entities.get({ entityName: 'content', id: primaryViewableId });
139
166
  if (primaryViewable?.flexplmThumbnailUrl === thumbnailUrl) {
140
167
  console.debug(`syncThumbnailToVibeIQ: thumbnail already synced for entityId=${entityId}`);
141
- return undefined;
168
+ return undefined; // Already synced
142
169
  }
143
170
  const content = await this.createContentFromFlexPLM(thumbnailUrl, entityId, entityName);
144
171
  await this.entities.update({ entityName: 'content', id: content.id, object: { flexplmThumbnailUrl: thumbnailUrl } });
@@ -327,11 +327,13 @@ describe('ThumbnailUtil Tests', () => {
327
327
  contentType: 'image/png',
328
328
  contentHolderReference: 'color:entity1',
329
329
  }));
330
+ // Updates content with flexplmThumbnailUrl
330
331
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({
331
332
  entityName: 'content',
332
333
  id: 'newContent1',
333
334
  object: { flexplmThumbnailUrl: '/rest/thumbnail/thumb.png' },
334
335
  }));
336
+ // Updates the main entity
335
337
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({
336
338
  entityName: 'color',
337
339
  id: 'entity1',
@@ -405,13 +407,17 @@ describe('ThumbnailUtil Tests', () => {
405
407
  mockContentCreate.mockResolvedValue(createdContent);
406
408
  const event = { data: { [thumbnail_util_1.ThumbnailUtil.NEW_THUMBNAIL_ID]: '/rest/thumbnail/new.jpg' } };
407
409
  await tu.syncThumbnailToVibeIQ({ entityId: 'entity1', primaryViewableId: 'oldPv', event, entityName: 'item' });
410
+ // Creates new content
408
411
  expect(mockContentCreate).toHaveBeenCalled();
412
+ // Updates new content with flexplmThumbnailUrl
409
413
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({
410
414
  entityName: 'content',
411
415
  id: 'newContent2',
412
416
  object: { flexplmThumbnailUrl: '/rest/thumbnail/new.jpg' },
413
417
  }));
418
+ // Updates the main entity
414
419
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({ entityName: 'item', id: 'entity1' }));
420
+ // Deletes old content
415
421
  expect(mockEntitiesDelete).toHaveBeenCalledWith({ entityName: 'content', id: 'oldPv' });
416
422
  });
417
423
  it('does not update when primaryViewable.flexplmThumbnailUrl matches', async () => {
@@ -57,7 +57,7 @@ exports.mapping = {
57
57
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
58
58
  vibe2flex: {
59
59
  getClass: () => 'LCSProduct',
60
- getSoftType: (entity) => {
60
+ getSoftType: (entity /*, dependencies*/) => {
61
61
  const prodType = entity['prodType'];
62
62
  let val = '';
63
63
  switch (prodType) {
@@ -82,7 +82,7 @@ exports.mapping = {
82
82
  vibeIQIdentifier: 'itemNumber'
83
83
  },
84
84
  valueTransform: {
85
- transformEx: (row) => {
85
+ transformEx: (row /*, dependencies*/) => {
86
86
  return row['otherProp'] + 'xxx';
87
87
  }
88
88
  }
@@ -100,7 +100,7 @@ exports.mapping = {
100
100
  vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
101
101
  vibe2flex: {
102
102
  getClass: () => 'LCSSKU',
103
- getSoftType: (entity) => {
103
+ getSoftType: (entity /*, dependencies*/) => {
104
104
  const prodType = entity['prodType'];
105
105
  let val = '';
106
106
  switch (prodType) {
@@ -1,24 +1,175 @@
1
1
  import { MapFileUtil } from '@contrail/transform-data';
2
+ /** This class is helper functions to get the data for converting
3
+ * VibeIQ entities to / from FlexPLM Objects
4
+ */
2
5
  export declare class TypeConversionUtils {
3
6
  static NO_ENTITY_TYPE: string;
4
7
  static VIBE2FLEX_DIRECTION: string;
5
8
  static FLEX2VIBE_DIRECTION: string;
6
9
  constructor();
10
+ /** Takes in a VibeIQ entity object and returns the correct FlexPLM
11
+ * object class associated to the entity. Order of precedence
12
+ * Property 'flexPLMObjectClass'
13
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getObjectClass()'
14
+ * for value from 'entityClass' or root from 'typePath'
15
+ * TypeDefaults.getDefaultObjectClass() function
16
+ * @param transformMapFile id for mapFile
17
+ * @param mapFileUtil class to get mapfile
18
+ * @param entity
19
+ * @returns Promise<string>
20
+ */
7
21
  static getObjectClass(transformMapFile: any, mapFileUtil: any, entity: any): Promise<string>;
22
+ /** Takes in a VibeIQ entity object and returns the correct FlexPLM
23
+ * FlexType associated to the entity. Order of precedence
24
+ * Property 'flexPLMTypePath'
25
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getSoftType()'
26
+ * for value from 'entityClass' or root from 'typePath'
27
+ * TypeDefaults.getDefaultObjectTypePath() function
28
+ *
29
+ * @param transformMapFile id for mapFile
30
+ * @param mapFileUtil class to get mapfile
31
+ * @param entity VibeIQ entity
32
+ * @returns Promise<string>
33
+ */
8
34
  static getObjectTypePath(transformMapFile: any, mapFileUtil: any, entity: any): Promise<string>;
35
+ /**Takes in a VibeIQ entity object and returns the correct
36
+ * identifier properties. Order of precedence
37
+ * Property 'flexPLMIdentifierProperties'
38
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getIdentifierProperties()'
39
+ * for value from 'entityClass' or root from 'typePath'
40
+ * TypeDefaults.getDefaultIdentifierProperties() function
41
+ *
42
+ * @param transformMapFile id for mapFile
43
+ * @param mapFileUtil class to get mapfile
44
+ * @param entity
45
+ * @returns Promise<string[]>
46
+ */
9
47
  static getIdentifierProperties(transformMapFile: any, mapFileUtil: any, entity: any): Promise<string[]>;
48
+ /**Takes in a VibeIQ entity object and returns the correct
49
+ * informational properties. Order of precedence
50
+ * Property 'flexPLMInformationalProperties'
51
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getInformationalProperties()'
52
+ * for value from 'entityClass' or root from 'typePath'
53
+ * TypeDefaults.getDefaultObjectTypePath() function
54
+ *
55
+ * @param transformMapFile id for mapFile
56
+ * @param mapFileUtil class to get mapfile
57
+ * @param entity
58
+ * @returns string
59
+ */
10
60
  static getInformationalProperties(transformMapFile: any, mapFileUtil: any, entity: any): Promise<string[]>;
61
+ /**Takes in a VibeIQ entity object and returns the correct mapKey
62
+ * Order of precedence:
63
+ * Map file entry in 'typeConversion:<direction>:<value>:getObjectClass()'
64
+ * for value from 'entityClass' or root from 'typePath'
65
+ * TypeDefaults.getDefaultObjectClass() function
66
+ *
67
+ * @param transformMapFile
68
+ * @param mapFileUtil
69
+ * @param entity
70
+ * @param type
71
+ * @param direction
72
+ * @returns
73
+ */
11
74
  static getMapKey(transformMapFile: any, mapFileUtil: MapFileUtil, entity: any, direction: string): Promise<string>;
75
+ /** Returns the VibeIQ entity type from an entity.
76
+ * Throws error if it can't determine the entity type
77
+ *
78
+ * @param entity
79
+ * @returns string
80
+ */
12
81
  static getEntityType(entity: any): any;
82
+ /** Takes in a FlexPLM object and returns the correct VibeIQ entity
83
+ * class associated to the object. Order of precedence
84
+ * Property 'vibeIQEntityClass'
85
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getObjectClass()'
86
+ * for value from 'objectClass'
87
+ * TypeDefaults.getDefaultEntityClass() function
88
+ *
89
+ * @param fileId id for mapFile
90
+ * @param mapFileUtil class to get mapfile
91
+ * @param object FlexPLM object
92
+ * @returns Promise<string>
93
+ */
13
94
  static getEntityClassFromObject(fileId: any, mapFileUtil: any, object: any): Promise<string>;
95
+ /** Takes in a FlexPLM object and returns the correct VibeIQ uniqueness
96
+ * pool key. Order of precedence:
97
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getUniquenessPool()'
98
+ * for value from 'objectClass'
99
+ * TypeDefaults.getDefaultEntityClass() function
100
+ *
101
+ * @param fileId id for mapFile
102
+ * @param mapFileUtil class to get mapfile
103
+ * @param object FlexPLM object
104
+ * @returns Promise<string>
105
+ */
14
106
  static getUniquenessPoolKeyFromObject(fileId: any, mapFileUtil: any, object: any): Promise<string>;
15
107
  static getEntityTypePathFromOjbect(fileId: any, mapFileUtil: any, object: any): Promise<string>;
108
+ /** Takes in a FlexPLM object and returns the correct VibeIQ
109
+ * type associated to the object. Order of precedence
110
+ * Property 'vibeIQTypePath'
111
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
112
+ * for value from 'objectClass' or root from 'flexPLMTypePath'
113
+ * TypeDefaults.getDefaultEntityTypePath() function
114
+ *
115
+ * @param transformMapFile id for mapFile
116
+ * @param mapFileUtil class to get mapfile
117
+ * @param entity VibeIQ entity
118
+ * @returns Promise<string>
119
+ */
120
+ static getEntityTypePathFromObject(fileId: any, mapFileUtil: any, object: any): Promise<string>;
121
+ /**Takes in a FlexPLM object and returns the correct
122
+ * identifier properties. Order of precedence
123
+ * Property 'vibeIQIdentifierProperties'
124
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getIdentifierProperties()'
125
+ * for value from 'objectClass'
126
+ * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
127
+ *
128
+ * @param transformMapFile id for mapFile
129
+ * @param mapFileUtil class to get mapfile
130
+ * @param object
131
+ * @returns Promise<string[]>
132
+ */
16
133
  static getIdentifierPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
134
+ /**Takes in a FlexPLM object and returns the correct
135
+ * identifier properties. Order of precedence
136
+ * Property 'vibeIQIdentifierProperties'
137
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getInformationalProperties()'
138
+ * for value from 'objectClass'
139
+ * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
140
+ *
141
+ * @param transformMapFile id for mapFile
142
+ * @param mapFileUtil class to get mapfile
143
+ * @param object
144
+ * @returns Promise<string[]>
145
+ */
17
146
  static getInformationalPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
18
147
  static getMapKeyFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any, direction: string): Promise<string | undefined>;
19
148
  static isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean>;
20
149
  static isOutboundCreatableFromEntity(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean>;
150
+ /** Takes in a FlexPLM object and determines whether inbound
151
+ * images should be synced. In most cases, the creation owning system
152
+ * will also control image syncing. Defaults to false if no mapping exists.
153
+ * Map file entry in '<mapKey>:syncInboundImages()'
154
+ *
155
+ * @param fileId id for mapFile
156
+ * @param mapFileUtil class to get mapfile
157
+ * @param object FlexPLM object
158
+ * @param context optional context object
159
+ * @returns Promise<boolean>
160
+ */
21
161
  static syncInboundImages(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean>;
162
+ /** Takes in a VibeIQ entity object and determines whether outbound
163
+ * images should be synced. In most cases, the creation owning system
164
+ * will also control image syncing. Defaults to true if no mapping exists.
165
+ * Map file entry in '<mapKey>:syncOutboundImages()'
166
+ *
167
+ * @param fileId id for mapFile
168
+ * @param mapFileUtil class to get mapfile
169
+ * @param entity VibeIQ entity
170
+ * @param context optional context object
171
+ * @returns Promise<boolean>
172
+ */
22
173
  static syncOutboundImages(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean>;
23
174
  static getObjectType(object: any): any;
24
175
  }
@@ -3,9 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TypeConversionUtils = void 0;
4
4
  const type_defaults_1 = require("./type-defaults");
5
5
  const map_utils_1 = require("./map-utils");
6
+ /** This class is helper functions to get the data for converting
7
+ * VibeIQ entities to / from FlexPLM Objects
8
+ */
6
9
  class TypeConversionUtils {
7
10
  constructor() {
8
11
  }
12
+ /** Takes in a VibeIQ entity object and returns the correct FlexPLM
13
+ * object class associated to the entity. Order of precedence
14
+ * Property 'flexPLMObjectClass'
15
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getObjectClass()'
16
+ * for value from 'entityClass' or root from 'typePath'
17
+ * TypeDefaults.getDefaultObjectClass() function
18
+ * @param transformMapFile id for mapFile
19
+ * @param mapFileUtil class to get mapfile
20
+ * @param entity
21
+ * @returns Promise<string>
22
+ */
9
23
  static async getObjectClass(transformMapFile, mapFileUtil, entity) {
10
24
  let objectClass = entity['flexPLMObjectClass'];
11
25
  if (objectClass) {
@@ -23,6 +37,18 @@ class TypeConversionUtils {
23
37
  }
24
38
  return type_defaults_1.TypeDefaults.getDefaultObjectClass(entity);
25
39
  }
40
+ /** Takes in a VibeIQ entity object and returns the correct FlexPLM
41
+ * FlexType associated to the entity. Order of precedence
42
+ * Property 'flexPLMTypePath'
43
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getSoftType()'
44
+ * for value from 'entityClass' or root from 'typePath'
45
+ * TypeDefaults.getDefaultObjectTypePath() function
46
+ *
47
+ * @param transformMapFile id for mapFile
48
+ * @param mapFileUtil class to get mapfile
49
+ * @param entity VibeIQ entity
50
+ * @returns Promise<string>
51
+ */
26
52
  static async getObjectTypePath(transformMapFile, mapFileUtil, entity) {
27
53
  let typePath = entity['flexPLMTypePath'];
28
54
  if (typePath) {
@@ -40,6 +66,18 @@ class TypeConversionUtils {
40
66
  }
41
67
  return type_defaults_1.TypeDefaults.getDefaultObjectTypePath(entity);
42
68
  }
69
+ /**Takes in a VibeIQ entity object and returns the correct
70
+ * identifier properties. Order of precedence
71
+ * Property 'flexPLMIdentifierProperties'
72
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getIdentifierProperties()'
73
+ * for value from 'entityClass' or root from 'typePath'
74
+ * TypeDefaults.getDefaultIdentifierProperties() function
75
+ *
76
+ * @param transformMapFile id for mapFile
77
+ * @param mapFileUtil class to get mapfile
78
+ * @param entity
79
+ * @returns Promise<string[]>
80
+ */
43
81
  static async getIdentifierProperties(transformMapFile, mapFileUtil, entity) {
44
82
  let identifiers = entity['flexPLMIdentifierProperties'];
45
83
  if (identifiers) {
@@ -57,6 +95,18 @@ class TypeConversionUtils {
57
95
  }
58
96
  return type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(entity);
59
97
  }
98
+ /**Takes in a VibeIQ entity object and returns the correct
99
+ * informational properties. Order of precedence
100
+ * Property 'flexPLMInformationalProperties'
101
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getInformationalProperties()'
102
+ * for value from 'entityClass' or root from 'typePath'
103
+ * TypeDefaults.getDefaultObjectTypePath() function
104
+ *
105
+ * @param transformMapFile id for mapFile
106
+ * @param mapFileUtil class to get mapfile
107
+ * @param entity
108
+ * @returns string
109
+ */
60
110
  static async getInformationalProperties(transformMapFile, mapFileUtil, entity) {
61
111
  let identifiers = entity['flexPLMInformationalProperties'];
62
112
  if (identifiers) {
@@ -74,6 +124,19 @@ class TypeConversionUtils {
74
124
  }
75
125
  return type_defaults_1.TypeDefaults.getDefaultInformationalProperties(entity);
76
126
  }
127
+ /**Takes in a VibeIQ entity object and returns the correct mapKey
128
+ * Order of precedence:
129
+ * Map file entry in 'typeConversion:<direction>:<value>:getObjectClass()'
130
+ * for value from 'entityClass' or root from 'typePath'
131
+ * TypeDefaults.getDefaultObjectClass() function
132
+ *
133
+ * @param transformMapFile
134
+ * @param mapFileUtil
135
+ * @param entity
136
+ * @param type
137
+ * @param direction
138
+ * @returns
139
+ */
77
140
  static async getMapKey(transformMapFile, mapFileUtil, entity, direction) {
78
141
  if (transformMapFile) {
79
142
  const type = this.getEntityType(entity);
@@ -85,6 +148,12 @@ class TypeConversionUtils {
85
148
  }
86
149
  return type_defaults_1.TypeDefaults.getDefaultObjectClass(entity);
87
150
  }
151
+ /** Returns the VibeIQ entity type from an entity.
152
+ * Throws error if it can't determine the entity type
153
+ *
154
+ * @param entity
155
+ * @returns string
156
+ */
88
157
  static getEntityType(entity) {
89
158
  let entityType = entity['entityType'];
90
159
  if (!entityType) {
@@ -101,6 +170,18 @@ class TypeConversionUtils {
101
170
  }
102
171
  return entityType;
103
172
  }
173
+ /** Takes in a FlexPLM object and returns the correct VibeIQ entity
174
+ * class associated to the object. Order of precedence
175
+ * Property 'vibeIQEntityClass'
176
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getObjectClass()'
177
+ * for value from 'objectClass'
178
+ * TypeDefaults.getDefaultEntityClass() function
179
+ *
180
+ * @param fileId id for mapFile
181
+ * @param mapFileUtil class to get mapfile
182
+ * @param object FlexPLM object
183
+ * @returns Promise<string>
184
+ */
104
185
  static async getEntityClassFromObject(fileId, mapFileUtil, object) {
105
186
  let entityClass = object['vibeIQEntityClass'];
106
187
  if (entityClass) {
@@ -118,6 +199,17 @@ class TypeConversionUtils {
118
199
  }
119
200
  return type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
120
201
  }
202
+ /** Takes in a FlexPLM object and returns the correct VibeIQ uniqueness
203
+ * pool key. Order of precedence:
204
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getUniquenessPool()'
205
+ * for value from 'objectClass'
206
+ * TypeDefaults.getDefaultEntityClass() function
207
+ *
208
+ * @param fileId id for mapFile
209
+ * @param mapFileUtil class to get mapfile
210
+ * @param object FlexPLM object
211
+ * @returns Promise<string>
212
+ */
121
213
  static async getUniquenessPoolKeyFromObject(fileId, mapFileUtil, object) {
122
214
  let uniquenessPool;
123
215
  if (fileId) {
@@ -135,6 +227,21 @@ class TypeConversionUtils {
135
227
  return type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
136
228
  }
137
229
  static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object) {
230
+ return await this.getEntityTypePathFromObject(fileId, mapFileUtil, object);
231
+ }
232
+ /** Takes in a FlexPLM object and returns the correct VibeIQ
233
+ * type associated to the object. Order of precedence
234
+ * Property 'vibeIQTypePath'
235
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
236
+ * for value from 'objectClass' or root from 'flexPLMTypePath'
237
+ * TypeDefaults.getDefaultEntityTypePath() function
238
+ *
239
+ * @param transformMapFile id for mapFile
240
+ * @param mapFileUtil class to get mapfile
241
+ * @param entity VibeIQ entity
242
+ * @returns Promise<string>
243
+ */
244
+ static async getEntityTypePathFromObject(fileId, mapFileUtil, object) {
138
245
  let typePath = object['vibeIQTypePath'];
139
246
  if (typePath) {
140
247
  return typePath;
@@ -151,6 +258,18 @@ class TypeConversionUtils {
151
258
  }
152
259
  return type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
153
260
  }
261
+ /**Takes in a FlexPLM object and returns the correct
262
+ * identifier properties. Order of precedence
263
+ * Property 'vibeIQIdentifierProperties'
264
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getIdentifierProperties()'
265
+ * for value from 'objectClass'
266
+ * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
267
+ *
268
+ * @param transformMapFile id for mapFile
269
+ * @param mapFileUtil class to get mapfile
270
+ * @param object
271
+ * @returns Promise<string[]>
272
+ */
154
273
  static async getIdentifierPropertiesFromObject(fileId, mapFileUtil, object) {
155
274
  let identifiers = object['vibeIQIdentifierProperties'];
156
275
  if (identifiers) {
@@ -168,6 +287,18 @@ class TypeConversionUtils {
168
287
  }
169
288
  return type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
170
289
  }
290
+ /**Takes in a FlexPLM object and returns the correct
291
+ * identifier properties. Order of precedence
292
+ * Property 'vibeIQIdentifierProperties'
293
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getInformationalProperties()'
294
+ * for value from 'objectClass'
295
+ * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
296
+ *
297
+ * @param transformMapFile id for mapFile
298
+ * @param mapFileUtil class to get mapfile
299
+ * @param object
300
+ * @returns Promise<string[]>
301
+ */
171
302
  static async getInformationalPropertiesFromObject(fileId, mapFileUtil, object) {
172
303
  let identifiers = object['vibeIQInformationalProperties'];
173
304
  if (identifiers) {
@@ -195,6 +326,7 @@ class TypeConversionUtils {
195
326
  }
196
327
  return type;
197
328
  }
329
+ //TODO use TypeDefaults?
198
330
  }
199
331
  static async isInboundCreatableFromObject(fileId, mapFileUtil, object, context) {
200
332
  let isInboundCreatable = false;
@@ -228,6 +360,17 @@ class TypeConversionUtils {
228
360
  }
229
361
  return isOutboundCreatable;
230
362
  }
363
+ /** Takes in a FlexPLM object and determines whether inbound
364
+ * images should be synced. In most cases, the creation owning system
365
+ * will also control image syncing. Defaults to false if no mapping exists.
366
+ * Map file entry in '<mapKey>:syncInboundImages()'
367
+ *
368
+ * @param fileId id for mapFile
369
+ * @param mapFileUtil class to get mapfile
370
+ * @param object FlexPLM object
371
+ * @param context optional context object
372
+ * @returns Promise<boolean>
373
+ */
231
374
  static async syncInboundImages(fileId, mapFileUtil, object, context) {
232
375
  let syncImages = false;
233
376
  if (!fileId) {
@@ -249,6 +392,17 @@ class TypeConversionUtils {
249
392
  }
250
393
  return syncImages;
251
394
  }
395
+ /** Takes in a VibeIQ entity object and determines whether outbound
396
+ * images should be synced. In most cases, the creation owning system
397
+ * will also control image syncing. Defaults to true if no mapping exists.
398
+ * Map file entry in '<mapKey>:syncOutboundImages()'
399
+ *
400
+ * @param fileId id for mapFile
401
+ * @param mapFileUtil class to get mapfile
402
+ * @param entity VibeIQ entity
403
+ * @param context optional context object
404
+ * @returns Promise<boolean>
405
+ */
252
406
  static async syncOutboundImages(fileId, mapFileUtil, entity, context) {
253
407
  let syncImages = true;
254
408
  if (!fileId) {
@@ -4,16 +4,82 @@ export declare class TypeDefaults {
4
4
  static NO_TYPE_PATH: string;
5
5
  static processLCSMaterialAsItem: boolean;
6
6
  constructor();
7
+ /** Applies values from the resolved config to TypeDefaults static state.
8
+ * Currently toggles whether LCSMaterial is treated as an item (new) or a
9
+ * custom-entity (old) based on config.LCSMaterial.processAsItem.
10
+ * Technically this could cause side effects if different parts of the code
11
+ * expect different behavior, but in practice * @param config will be
12
+ * consistent across the app and this is simpler than passing this config
13
+ * through multiple layers of function calls.
14
+ */
7
15
  static applyConfig(config: any): void;
8
16
  static isPropertyTrue(value: any): boolean;
17
+ /**Takes in full entity and returs the default FlexPLM
18
+ * object class.
19
+ *
20
+ * @param entity
21
+ * @returns string
22
+ */
9
23
  static getDefaultObjectClass(entity: any): string;
24
+ /**Takes in full entity and returns the default FlexPLM type path
25
+ * object class.
26
+ *
27
+ * @param entity
28
+ * @returns string
29
+ */
10
30
  static getDefaultObjectTypePath(entity: any): string;
31
+ /**Takes in full entity and returns the slugs for the default identifier
32
+ * properties. These properties are used when searching for an entity
33
+ * object class.
34
+ *
35
+ * @param entity
36
+ * @returns string[]
37
+ */
11
38
  static getDefaultIdentifierProperties(entity: any): string[];
39
+ /** Takes in full entity and returns the slugs for informational
40
+ * properties. These properties are helpful when debugging issues
41
+ * where the identifier properties don't find a match.
42
+ *
43
+ * @param entity
44
+ * @returns string[]
45
+ */
12
46
  static getDefaultInformationalProperties(entity: any): string[];
47
+ /** Returns the VibeIQ entity type from an entity.
48
+ * Throws error if it can't determine the entity type
49
+ *
50
+ * @param entity
51
+ * @returns string
52
+ */
13
53
  static getEntityType(entity: any): any;
54
+ /**Takes in full object and returns the default VibeIQ
55
+ * entity class.
56
+ *
57
+ * @param entity
58
+ * @returns string
59
+ */
14
60
  static getDefaultEntityClass(object: any): string;
61
+ /**Takes in full object and returns the default VibeIQ type path
62
+ * object class.
63
+ *
64
+ * @param object
65
+ * @returns string
66
+ */
15
67
  static getDefaultEntityTypePath(object: any): string;
68
+ /**Takes in full entity and returns the slugs for the default identifier
69
+ * properties. These properties are used when searching for an entity
70
+ * object class.
71
+ *
72
+ * @param entity
73
+ * @returns string[]
74
+ */
16
75
  static getDefaultIdentifierPropertiesFromObject(object: any): string[];
76
+ /** Takes in full object and returns the slugs for informational
77
+ * properties. These properties are helpful when debugging issues
78
+ * where the identifier properties don't find a match.
79
+ *
80
+ * @param object
81
+ * @returns string[]
82
+ */
17
83
  static getDefaultInformationalPropertiesFromObject(object: any): string[];
18
84
  static getObjectClass(object: any): string;
19
85
  }