@contrail/flexplm 1.3.1-alpha.7db7b62 → 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 (103) 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 -139
  39. package/lib/util/type-conversion-utils.js +0 -140
  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/create.d.ts +0 -1
  95. package/lib/cli/commands/create.js +0 -75
  96. package/lib/cli/commands/upload.d.ts +0 -1
  97. package/lib/cli/commands/upload.js +0 -217
  98. package/lib/cli/index.d.ts +0 -2
  99. package/lib/cli/index.js +0 -60
  100. package/lib/cli/template/mapping-template.ts.template +0 -18
  101. package/lib/interfaces/mapping-file.d.ts +0 -429
  102. package/lib/interfaces/mapping-file.js +0 -2
  103. package/scripts/copy-template.js +0 -10
@@ -8,7 +8,6 @@ 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.). */
12
11
  this.max_thumbnail_size = 5 * 1024 * 1024;
13
12
  this.entities = new sdk_1.Entities();
14
13
  if (this.config['max_thumbnail_size']) {
@@ -18,7 +17,6 @@ class ThumbnailUtil {
18
17
  async setOutboundThumbnail(data, event) {
19
18
  if (event?.newData?.primaryViewableId && event?.newData?.largeViewableDownloadUrl) {
20
19
  const primaryViewableId = event.newData.primaryViewableId;
21
- //get custom sizes
22
20
  const fileId = await this.getFileId(primaryViewableId);
23
21
  if (fileId) {
24
22
  const customSizes = await this.getCustomSizes();
@@ -33,9 +31,6 @@ class ThumbnailUtil {
33
31
  }
34
32
  return data;
35
33
  }
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
- */
39
34
  isThumbnailNew(event, customSizes) {
40
35
  const propertyDiffs = event?.propertyDiffs;
41
36
  if (propertyDiffs) {
@@ -57,7 +52,6 @@ class ThumbnailUtil {
57
52
  const OOBSizes = JSON.parse(JSON.stringify(ThumbnailUtil.OOB_SIZES));
58
53
  sizes.push(...OOBSizes);
59
54
  console.info('sizes: ' + JSON.stringify(sizes));
60
- //get Content
61
55
  const content = await this.getContentEntity(primaryViewableId, sizes);
62
56
  if (!content) {
63
57
  return undefined;
@@ -105,14 +99,6 @@ class ThumbnailUtil {
105
99
  this.logContentResults(content, relations);
106
100
  return content;
107
101
  }
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
- */
116
102
  logContentResults(content, relations) {
117
103
  if (app_framework_1.Logger.isDebugOn() && content && relations) {
118
104
  const contentCopy = JSON.parse(JSON.stringify(content));
@@ -122,22 +108,12 @@ class ThumbnailUtil {
122
108
  console.debug('content: ' + JSON.stringify(contentCopy));
123
109
  }
124
110
  }
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
- */
134
111
  async syncThumbnailToVibeIQ({ entityId, primaryViewableId, event, entityName }) {
135
112
  console.debug(`syncThumbnailToVibeIQ: entityId=${entityId}, primaryViewableId=${primaryViewableId}, entityName=${entityName}`);
136
113
  const eventData = event.data || {};
137
114
  const newThumbnailId = eventData[ThumbnailUtil.NEW_THUMBNAIL_ID];
138
115
  const existingThumbnailId = eventData[ThumbnailUtil.EXISTING_THUMBNAIL_ID];
139
116
  const thumbnailUrl = newThumbnailId || existingThumbnailId;
140
- // Case 1: REMOVE_THUMBNAIL
141
117
  if (newThumbnailId === ThumbnailUtil.REMOVE_THUMBNAIL) {
142
118
  if (primaryViewableId) {
143
119
  await this.entities.delete({ entityName: 'content', id: primaryViewableId });
@@ -147,12 +123,10 @@ class ThumbnailUtil {
147
123
  console.debug(`syncThumbnailToVibeIQ: applied clear updates for entityId=${entityId}`);
148
124
  return updatedEntity;
149
125
  }
150
- // Early return if no thumbnail URL
151
126
  if (!thumbnailUrl) {
152
127
  console.debug(`syncThumbnailToVibeIQ: no thumbnail URL for entityId=${entityId}`);
153
128
  return undefined;
154
129
  }
155
- // Case 2: No existing primaryViewableId — create new content
156
130
  if (!primaryViewableId) {
157
131
  const content = await this.createContentFromFlexPLM(thumbnailUrl, entityId, entityName);
158
132
  await this.entities.update({ entityName: 'content', id: content.id, object: { flexplmThumbnailUrl: thumbnailUrl } });
@@ -161,11 +135,10 @@ class ThumbnailUtil {
161
135
  console.debug(`syncThumbnailToVibeIQ: created new content ${content.id} for entityId=${entityId}`);
162
136
  return updatedEntity;
163
137
  }
164
- // Case 3: Has primaryViewableId — check if thumbnail changed
165
138
  const primaryViewable = await this.entities.get({ entityName: 'content', id: primaryViewableId });
166
139
  if (primaryViewable?.flexplmThumbnailUrl === thumbnailUrl) {
167
140
  console.debug(`syncThumbnailToVibeIQ: thumbnail already synced for entityId=${entityId}`);
168
- return undefined; // Already synced
141
+ return undefined;
169
142
  }
170
143
  const content = await this.createContentFromFlexPLM(thumbnailUrl, entityId, entityName);
171
144
  await this.entities.update({ entityName: 'content', id: content.id, object: { flexplmThumbnailUrl: thumbnailUrl } });
@@ -327,13 +327,11 @@ describe('ThumbnailUtil Tests', () => {
327
327
  contentType: 'image/png',
328
328
  contentHolderReference: 'color:entity1',
329
329
  }));
330
- // Updates content with flexplmThumbnailUrl
331
330
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({
332
331
  entityName: 'content',
333
332
  id: 'newContent1',
334
333
  object: { flexplmThumbnailUrl: '/rest/thumbnail/thumb.png' },
335
334
  }));
336
- // Updates the main entity
337
335
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({
338
336
  entityName: 'color',
339
337
  id: 'entity1',
@@ -407,17 +405,13 @@ describe('ThumbnailUtil Tests', () => {
407
405
  mockContentCreate.mockResolvedValue(createdContent);
408
406
  const event = { data: { [thumbnail_util_1.ThumbnailUtil.NEW_THUMBNAIL_ID]: '/rest/thumbnail/new.jpg' } };
409
407
  await tu.syncThumbnailToVibeIQ({ entityId: 'entity1', primaryViewableId: 'oldPv', event, entityName: 'item' });
410
- // Creates new content
411
408
  expect(mockContentCreate).toHaveBeenCalled();
412
- // Updates new content with flexplmThumbnailUrl
413
409
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({
414
410
  entityName: 'content',
415
411
  id: 'newContent2',
416
412
  object: { flexplmThumbnailUrl: '/rest/thumbnail/new.jpg' },
417
413
  }));
418
- // Updates the main entity
419
414
  expect(mockEntitiesUpdate).toHaveBeenCalledWith(expect.objectContaining({ entityName: 'item', id: 'entity1' }));
420
- // Deletes old content
421
415
  expect(mockEntitiesDelete).toHaveBeenCalledWith({ entityName: 'content', id: 'oldPv' });
422
416
  });
423
417
  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 /*, dependencies*/) => {
60
+ getSoftType: (entity) => {
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 /*, dependencies*/) => {
85
+ transformEx: (row) => {
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 /*, dependencies*/) => {
103
+ getSoftType: (entity) => {
104
104
  const prodType = entity['prodType'];
105
105
  let val = '';
106
106
  switch (prodType) {
@@ -1,162 +1,23 @@
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
- */
5
2
  export declare class TypeConversionUtils {
6
3
  static NO_ENTITY_TYPE: string;
7
4
  static VIBE2FLEX_DIRECTION: string;
8
5
  static FLEX2VIBE_DIRECTION: string;
9
6
  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
- */
21
7
  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
- */
34
8
  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
- */
47
9
  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
- */
60
10
  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
- */
74
11
  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
- */
81
12
  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
- */
94
13
  static getEntityClassFromObject(fileId: any, mapFileUtil: any, object: any): Promise<string>;
95
- /** Takes in a FlexPLM object and returns the correct VibeIQ
96
- * type associated to the object. Order of precedence
97
- * Property 'vibeIQTypePath'
98
- * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
99
- * for value from 'objectClass' or root from 'flexPLMTypePath'
100
- * TypeDefaults.getDefaultEntityTypePath() function
101
- *
102
- * @param transformMapFile id for mapFile
103
- * @param mapFileUtil class to get mapfile
104
- * @param entity VibeIQ entity
105
- * @returns Promise<string>
106
- */
107
14
  static getEntityTypePathFromOjbect(fileId: any, mapFileUtil: any, object: any): Promise<string>;
108
- /**Takes in a FlexPLM object and returns the correct
109
- * identifier properties. Order of precedence
110
- * Property 'vibeIQIdentifierProperties'
111
- * Map file entry in 'typeConversion:flex2vibe:<value>:getIdentifierProperties()'
112
- * for value from 'objectClass'
113
- * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
114
- *
115
- * @param transformMapFile id for mapFile
116
- * @param mapFileUtil class to get mapfile
117
- * @param object
118
- * @returns Promise<string[]>
119
- */
120
15
  static getIdentifierPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, 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>:getInformationalProperties()'
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
- */
133
16
  static getInformationalPropertiesFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any): Promise<string[]>;
134
17
  static getMapKeyFromObject(fileId: any, mapFileUtil: MapFileUtil, object: any, direction: string): Promise<string | undefined>;
135
18
  static isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean>;
136
19
  static isOutboundCreatableFromEntity(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean>;
137
- /** Takes in a FlexPLM object and determines whether inbound
138
- * images should be synced. In most cases, the creation owning system
139
- * will also control image syncing. Defaults to false if no mapping exists.
140
- * Map file entry in '<mapKey>:syncInboundImages()'
141
- *
142
- * @param fileId id for mapFile
143
- * @param mapFileUtil class to get mapfile
144
- * @param object FlexPLM object
145
- * @param context optional context object
146
- * @returns Promise<boolean>
147
- */
148
20
  static syncInboundImages(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean>;
149
- /** Takes in a VibeIQ entity object and determines whether outbound
150
- * images should be synced. In most cases, the creation owning system
151
- * will also control image syncing. Defaults to true if no mapping exists.
152
- * Map file entry in '<mapKey>:syncOutboundImages()'
153
- *
154
- * @param fileId id for mapFile
155
- * @param mapFileUtil class to get mapfile
156
- * @param entity VibeIQ entity
157
- * @param context optional context object
158
- * @returns Promise<boolean>
159
- */
160
21
  static syncOutboundImages(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean>;
161
22
  static getObjectType(object: any): any;
162
23
  }
@@ -3,23 +3,9 @@ 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
- */
9
6
  class TypeConversionUtils {
10
7
  constructor() {
11
8
  }
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
- */
23
9
  static async getObjectClass(transformMapFile, mapFileUtil, entity) {
24
10
  let objectClass = entity['flexPLMObjectClass'];
25
11
  if (objectClass) {
@@ -37,18 +23,6 @@ class TypeConversionUtils {
37
23
  }
38
24
  return type_defaults_1.TypeDefaults.getDefaultObjectClass(entity);
39
25
  }
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
- */
52
26
  static async getObjectTypePath(transformMapFile, mapFileUtil, entity) {
53
27
  let typePath = entity['flexPLMTypePath'];
54
28
  if (typePath) {
@@ -66,18 +40,6 @@ class TypeConversionUtils {
66
40
  }
67
41
  return type_defaults_1.TypeDefaults.getDefaultObjectTypePath(entity);
68
42
  }
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
- */
81
43
  static async getIdentifierProperties(transformMapFile, mapFileUtil, entity) {
82
44
  let identifiers = entity['flexPLMIdentifierProperties'];
83
45
  if (identifiers) {
@@ -95,18 +57,6 @@ class TypeConversionUtils {
95
57
  }
96
58
  return type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(entity);
97
59
  }
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
- */
110
60
  static async getInformationalProperties(transformMapFile, mapFileUtil, entity) {
111
61
  let identifiers = entity['flexPLMInformationalProperties'];
112
62
  if (identifiers) {
@@ -124,19 +74,6 @@ class TypeConversionUtils {
124
74
  }
125
75
  return type_defaults_1.TypeDefaults.getDefaultInformationalProperties(entity);
126
76
  }
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
- */
140
77
  static async getMapKey(transformMapFile, mapFileUtil, entity, direction) {
141
78
  if (transformMapFile) {
142
79
  const type = this.getEntityType(entity);
@@ -148,12 +85,6 @@ class TypeConversionUtils {
148
85
  }
149
86
  return type_defaults_1.TypeDefaults.getDefaultObjectClass(entity);
150
87
  }
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
- */
157
88
  static getEntityType(entity) {
158
89
  let entityType = entity['entityType'];
159
90
  if (!entityType) {
@@ -170,18 +101,6 @@ class TypeConversionUtils {
170
101
  }
171
102
  return entityType;
172
103
  }
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
- */
185
104
  static async getEntityClassFromObject(fileId, mapFileUtil, object) {
186
105
  let entityClass = object['vibeIQEntityClass'];
187
106
  if (entityClass) {
@@ -199,18 +118,6 @@ class TypeConversionUtils {
199
118
  }
200
119
  return type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
201
120
  }
202
- /** Takes in a FlexPLM object and returns the correct VibeIQ
203
- * type associated to the object. Order of precedence
204
- * Property 'vibeIQTypePath'
205
- * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
206
- * for value from 'objectClass' or root from 'flexPLMTypePath'
207
- * TypeDefaults.getDefaultEntityTypePath() function
208
- *
209
- * @param transformMapFile id for mapFile
210
- * @param mapFileUtil class to get mapfile
211
- * @param entity VibeIQ entity
212
- * @returns Promise<string>
213
- */
214
121
  static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object) {
215
122
  let typePath = object['vibeIQTypePath'];
216
123
  if (typePath) {
@@ -228,18 +135,6 @@ class TypeConversionUtils {
228
135
  }
229
136
  return type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
230
137
  }
231
- /**Takes in a FlexPLM object and returns the correct
232
- * identifier properties. Order of precedence
233
- * Property 'vibeIQIdentifierProperties'
234
- * Map file entry in 'typeConversion:flex2vibe:<value>:getIdentifierProperties()'
235
- * for value from 'objectClass'
236
- * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
237
- *
238
- * @param transformMapFile id for mapFile
239
- * @param mapFileUtil class to get mapfile
240
- * @param object
241
- * @returns Promise<string[]>
242
- */
243
138
  static async getIdentifierPropertiesFromObject(fileId, mapFileUtil, object) {
244
139
  let identifiers = object['vibeIQIdentifierProperties'];
245
140
  if (identifiers) {
@@ -257,18 +152,6 @@ class TypeConversionUtils {
257
152
  }
258
153
  return type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
259
154
  }
260
- /**Takes in a FlexPLM object and returns the correct
261
- * identifier properties. Order of precedence
262
- * Property 'vibeIQIdentifierProperties'
263
- * Map file entry in 'typeConversion:flex2vibe:<value>:getInformationalProperties()'
264
- * for value from 'objectClass'
265
- * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
266
- *
267
- * @param transformMapFile id for mapFile
268
- * @param mapFileUtil class to get mapfile
269
- * @param object
270
- * @returns Promise<string[]>
271
- */
272
155
  static async getInformationalPropertiesFromObject(fileId, mapFileUtil, object) {
273
156
  let identifiers = object['vibeIQInformationalProperties'];
274
157
  if (identifiers) {
@@ -296,7 +179,6 @@ class TypeConversionUtils {
296
179
  }
297
180
  return type;
298
181
  }
299
- //TODO use TypeDefaults?
300
182
  }
301
183
  static async isInboundCreatableFromObject(fileId, mapFileUtil, object, context) {
302
184
  let isInboundCreatable = false;
@@ -330,17 +212,6 @@ class TypeConversionUtils {
330
212
  }
331
213
  return isOutboundCreatable;
332
214
  }
333
- /** Takes in a FlexPLM object and determines whether inbound
334
- * images should be synced. In most cases, the creation owning system
335
- * will also control image syncing. Defaults to false if no mapping exists.
336
- * Map file entry in '<mapKey>:syncInboundImages()'
337
- *
338
- * @param fileId id for mapFile
339
- * @param mapFileUtil class to get mapfile
340
- * @param object FlexPLM object
341
- * @param context optional context object
342
- * @returns Promise<boolean>
343
- */
344
215
  static async syncInboundImages(fileId, mapFileUtil, object, context) {
345
216
  let syncImages = false;
346
217
  if (!fileId) {
@@ -362,17 +233,6 @@ class TypeConversionUtils {
362
233
  }
363
234
  return syncImages;
364
235
  }
365
- /** Takes in a VibeIQ entity object and determines whether outbound
366
- * images should be synced. In most cases, the creation owning system
367
- * will also control image syncing. Defaults to true if no mapping exists.
368
- * Map file entry in '<mapKey>:syncOutboundImages()'
369
- *
370
- * @param fileId id for mapFile
371
- * @param mapFileUtil class to get mapfile
372
- * @param entity VibeIQ entity
373
- * @param context optional context object
374
- * @returns Promise<boolean>
375
- */
376
236
  static async syncOutboundImages(fileId, mapFileUtil, entity, context) {
377
237
  let syncImages = true;
378
238
  if (!fileId) {
@@ -3,72 +3,14 @@ export declare class TypeDefaults {
3
3
  static NO_OBJECT_CLASS: string;
4
4
  static NO_TYPE_PATH: string;
5
5
  constructor();
6
- /**Takes in full entity and returs the default FlexPLM
7
- * object class.
8
- *
9
- * @param entity
10
- * @returns string
11
- */
12
6
  static getDefaultObjectClass(entity: any): string;
13
- /**Takes in full entity and returns the default FlexPLM type path
14
- * object class.
15
- *
16
- * @param entity
17
- * @returns string
18
- */
19
7
  static getDefaultObjectTypePath(entity: any): string;
20
- /**Takes in full entity and returns the slugs for the default identifier
21
- * properties. These properties are used when searching for an entity
22
- * object class.
23
- *
24
- * @param entity
25
- * @returns string[]
26
- */
27
8
  static getDefaultIdentifierProperties(entity: any): string[];
28
- /** Takes in full entity and returns the slugs for informational
29
- * properties. These properties are helpful when debugging issues
30
- * where the identifier properties don't find a match.
31
- *
32
- * @param entity
33
- * @returns string[]
34
- */
35
9
  static getDefaultInformationalProperties(entity: any): string[];
36
- /** Returns the VibeIQ entity type from an entity.
37
- * Throws error if it can't determine the entity type
38
- *
39
- * @param entity
40
- * @returns string
41
- */
42
10
  static getEntityType(entity: any): any;
43
- /**Takes in full object and returns the default VibeIQ
44
- * entity class.
45
- *
46
- * @param entity
47
- * @returns string
48
- */
49
11
  static getDefaultEntityClass(object: any): string;
50
- /**Takes in full object and returns the default VibeIQ type path
51
- * object class.
52
- *
53
- * @param object
54
- * @returns string
55
- */
56
12
  static getDefaultEntityTypePath(object: any): string;
57
- /**Takes in full entity and returns the slugs for the default identifier
58
- * properties. These properties are used when searching for an entity
59
- * object class.
60
- *
61
- * @param entity
62
- * @returns string[]
63
- */
64
13
  static getDefaultIdentifierPropertiesFromObject(object: any): string[];
65
- /** Takes in full object and returns the slugs for informational
66
- * properties. These properties are helpful when debugging issues
67
- * where the identifier properties don't find a match.
68
- *
69
- * @param object
70
- * @returns string[]
71
- */
72
14
  static getDefaultInformationalPropertiesFromObject(object: any): string[];
73
15
  static getObjectClass(object: any): string;
74
16
  }