@contrail/flexplm 1.4.0 → 1.5.0-alpha.14a4f1b

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 (112) 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 -0
  26. package/lib/publish/base-process-publish-assortment.js +60 -6
  27. package/lib/publish/base-process-publish-assortment.spec.js +22 -4
  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 +37 -1
  32. package/lib/transform/identifier-conversion.spec.js +35 -0
  33. package/lib/util/config-defaults.d.ts +18 -0
  34. package/lib/util/config-defaults.js +25 -15
  35. package/lib/util/config-defaults.spec.js +56 -0
  36. package/lib/util/data-converter-spec-mockData.js +17 -3
  37. package/lib/util/data-converter.d.ts +102 -0
  38. package/lib/util/data-converter.js +195 -34
  39. package/lib/util/data-converter.spec.js +430 -0
  40. package/lib/util/error-response-object.d.ts +5 -0
  41. package/lib/util/error-response-object.js +7 -0
  42. package/lib/util/event-short-message-status.js +1 -0
  43. package/lib/util/federation.js +8 -0
  44. package/lib/util/flexplm-connect.d.ts +7 -0
  45. package/lib/util/flexplm-connect.js +14 -0
  46. package/lib/util/logger-config.js +1 -0
  47. package/lib/util/map-util-spec-mockData.js +17 -3
  48. package/lib/util/map-utils.d.ts +27 -0
  49. package/lib/util/map-utils.js +27 -0
  50. package/lib/util/thumbnail-util.d.ts +21 -0
  51. package/lib/util/thumbnail-util.js +28 -1
  52. package/lib/util/thumbnail-util.spec.js +6 -0
  53. package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
  54. package/lib/util/type-conversion-utils.d.ts +151 -0
  55. package/lib/util/type-conversion-utils.js +154 -0
  56. package/lib/util/type-defaults.d.ts +69 -0
  57. package/lib/util/type-defaults.js +98 -4
  58. package/lib/util/type-defaults.spec.js +114 -4
  59. package/lib/util/type-utils.d.ts +21 -0
  60. package/lib/util/type-utils.js +23 -0
  61. package/lib/util/type-utils.spec.js +2 -0
  62. package/package.json +21 -6
  63. package/scripts/copy-template.js +10 -0
  64. package/.github/pull_request_template.md +0 -31
  65. package/.github/workflows/flexplm-lib.yml +0 -27
  66. package/.github/workflows/publish-to-npm.yml +0 -121
  67. package/CHANGELOG.md +0 -40
  68. package/publish.bat +0 -5
  69. package/publish.sh +0 -5
  70. package/src/entity-processor/base-entity-processor.spec.ts +0 -689
  71. package/src/entity-processor/base-entity-processor.ts +0 -583
  72. package/src/flexplm-request.ts +0 -28
  73. package/src/flexplm-utils.spec.ts +0 -27
  74. package/src/flexplm-utils.ts +0 -29
  75. package/src/index.ts +0 -22
  76. package/src/interfaces/interfaces.ts +0 -122
  77. package/src/interfaces/item-family-changes.ts +0 -67
  78. package/src/interfaces/publish-change-data.ts +0 -43
  79. package/src/publish/base-process-publish-assortment-callback.ts +0 -50
  80. package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
  81. package/src/publish/base-process-publish-assortment.ts +0 -1134
  82. package/src/publish/mockData.ts +0 -4561
  83. package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
  84. package/src/transform/identifier-conversion.spec.ts +0 -354
  85. package/src/transform/identifier-conversion.ts +0 -282
  86. package/src/util/config-defaults.spec.ts +0 -392
  87. package/src/util/config-defaults.ts +0 -97
  88. package/src/util/data-converter-spec-mockData.ts +0 -231
  89. package/src/util/data-converter.spec.ts +0 -1120
  90. package/src/util/data-converter.ts +0 -766
  91. package/src/util/error-response-object.spec.ts +0 -116
  92. package/src/util/error-response-object.ts +0 -50
  93. package/src/util/event-short-message-status.ts +0 -22
  94. package/src/util/federation.ts +0 -172
  95. package/src/util/flexplm-connect.spec.ts +0 -132
  96. package/src/util/flexplm-connect.ts +0 -208
  97. package/src/util/logger-config.ts +0 -20
  98. package/src/util/map-util-spec-mockData.ts +0 -231
  99. package/src/util/map-utils.spec.ts +0 -103
  100. package/src/util/map-utils.ts +0 -41
  101. package/src/util/mockData.ts +0 -101
  102. package/src/util/thumbnail-util.spec.ts +0 -508
  103. package/src/util/thumbnail-util.ts +0 -272
  104. package/src/util/type-conversion-utils-spec-mockData.ts +0 -272
  105. package/src/util/type-conversion-utils.spec.ts +0 -1031
  106. package/src/util/type-conversion-utils.ts +0 -490
  107. package/src/util/type-defaults.spec.ts +0 -669
  108. package/src/util/type-defaults.ts +0 -281
  109. package/src/util/type-utils.spec.ts +0 -227
  110. package/src/util/type-utils.ts +0 -144
  111. package/tsconfig.json +0 -24
  112. package/tslint.json +0 -57
@@ -1,490 +0,0 @@
1
- import { MapFileUtil, TransformProcessor, TransformTask } from '@contrail/transform-data';
2
- import { TypeDefaults } from './type-defaults';
3
- import { MapUtil } from './map-utils';
4
-
5
- /** This class is helper functions to get the data for converting
6
- * VibeIQ entities to / from FlexPLM Objects
7
- */
8
- export class TypeConversionUtils {
9
- static NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
10
- static VIBE2FLEX_DIRECTION = 'vibe2flex';
11
- static FLEX2VIBE_DIRECTION = 'flex2vibe';
12
- constructor(){
13
- }
14
-
15
- /** Takes in a VibeIQ entity object and returns the correct FlexPLM
16
- * object class associated to the entity. Order of precedence
17
- * Property 'flexPLMObjectClass'
18
- * Map file entry in 'typeConversion:vibe2flex:<value>:getObjectClass()'
19
- * for value from 'entityClass' or root from 'typePath'
20
- * TypeDefaults.getDefaultObjectClass() function
21
- * @param transformMapFile id for mapFile
22
- * @param mapFileUtil class to get mapfile
23
- * @param entity
24
- * @returns Promise<string>
25
- */
26
- static async getObjectClass(transformMapFile, mapFileUtil, entity): Promise<string> {
27
- let objectClass = entity['flexPLMObjectClass'];
28
-
29
- if(objectClass){
30
- return objectClass;
31
- }
32
-
33
- if(transformMapFile){
34
- const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
35
- const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
36
- if(mapData['getClass']){
37
- objectClass = await mapData['getClass'](entity);
38
- }
39
- }
40
-
41
- if(objectClass){
42
- return objectClass;
43
- }
44
- return TypeDefaults.getDefaultObjectClass(entity);
45
- }
46
-
47
- /** Takes in a VibeIQ entity object and returns the correct FlexPLM
48
- * FlexType associated to the entity. Order of precedence
49
- * Property 'flexPLMTypePath'
50
- * Map file entry in 'typeConversion:vibe2flex:<value>:getSoftType()'
51
- * for value from 'entityClass' or root from 'typePath'
52
- * TypeDefaults.getDefaultObjectTypePath() function
53
- *
54
- * @param transformMapFile id for mapFile
55
- * @param mapFileUtil class to get mapfile
56
- * @param entity VibeIQ entity
57
- * @returns Promise<string>
58
- */
59
- static async getObjectTypePath(transformMapFile, mapFileUtil, entity): Promise<string> {
60
- let typePath = entity['flexPLMTypePath'];
61
-
62
- if(typePath){
63
- return typePath;
64
- }
65
-
66
- if(transformMapFile){
67
- const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
68
- const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
69
- if(mapData['getSoftType']){
70
- typePath = await mapData['getSoftType'](entity);
71
- }
72
- }
73
-
74
- if(typePath){
75
- return typePath;
76
- }
77
-
78
- return TypeDefaults.getDefaultObjectTypePath(entity);
79
- }
80
-
81
- /**Takes in a VibeIQ entity object and returns the correct
82
- * identifier properties. Order of precedence
83
- * Property 'flexPLMIdentifierProperties'
84
- * Map file entry in 'typeConversion:vibe2flex:<value>:getIdentifierProperties()'
85
- * for value from 'entityClass' or root from 'typePath'
86
- * TypeDefaults.getDefaultIdentifierProperties() function
87
- *
88
- * @param transformMapFile id for mapFile
89
- * @param mapFileUtil class to get mapfile
90
- * @param entity
91
- * @returns Promise<string[]>
92
- */
93
- static async getIdentifierProperties(transformMapFile, mapFileUtil, entity) :Promise<string[]> {
94
- let identifiers = entity['flexPLMIdentifierProperties'];
95
- if(identifiers){
96
- return identifiers
97
- }
98
-
99
- if(transformMapFile){
100
- const mapKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
101
-
102
- const mapData = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
103
- if(mapData && mapData['getIdentifierProperties']){
104
- identifiers = await mapData['getIdentifierProperties'](entity);
105
- }
106
- }
107
- if(identifiers){
108
- return identifiers
109
- }
110
-
111
- return TypeDefaults.getDefaultIdentifierProperties(entity);
112
- }
113
-
114
- /**Takes in a VibeIQ entity object and returns the correct
115
- * informational properties. Order of precedence
116
- * Property 'flexPLMInformationalProperties'
117
- * Map file entry in 'typeConversion:vibe2flex:<value>:getInformationalProperties()'
118
- * for value from 'entityClass' or root from 'typePath'
119
- * TypeDefaults.getDefaultObjectTypePath() function
120
- *
121
- * @param transformMapFile id for mapFile
122
- * @param mapFileUtil class to get mapfile
123
- * @param entity
124
- * @returns string
125
- */
126
- static async getInformationalProperties(transformMapFile, mapFileUtil, entity) :Promise<string[]> {
127
- let identifiers = entity['flexPLMInformationalProperties'];
128
- if(identifiers){
129
- return identifiers
130
- }
131
-
132
- if(transformMapFile){
133
- const mapKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
134
- const mapData = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
135
- if(mapData && mapData['getInformationalProperties']){
136
- identifiers = await mapData['getInformationalProperties'](entity);
137
- }
138
- }
139
- if(identifiers){
140
- return identifiers
141
- }
142
-
143
- return TypeDefaults.getDefaultInformationalProperties(entity);
144
- }
145
-
146
- /**Takes in a VibeIQ entity object and returns the correct mapKey
147
- * Order of precedence:
148
- * Map file entry in 'typeConversion:<direction>:<value>:getObjectClass()'
149
- * for value from 'entityClass' or root from 'typePath'
150
- * TypeDefaults.getDefaultObjectClass() function
151
- *
152
- * @param transformMapFile
153
- * @param mapFileUtil
154
- * @param entity
155
- * @param type
156
- * @param direction
157
- * @returns
158
- */
159
- static async getMapKey(transformMapFile, mapFileUtil: MapFileUtil, entity: any, direction: string): Promise<string> {
160
- if(transformMapFile){
161
- const type = this.getEntityType(entity);
162
- const mappingData = await mapFileUtil.getMappingSection(transformMapFile, 'typeConversion', direction);
163
- if(mappingData && mappingData[type] && mappingData[type]['getMapKey']){
164
- const mapKey = await mappingData[type]['getMapKey'](entity);
165
- return mapKey;
166
- }
167
-
168
- }
169
- return TypeDefaults.getDefaultObjectClass(entity);
170
- }
171
-
172
- /** Returns the VibeIQ entity type from an entity.
173
- * Throws error if it can't determine the entity type
174
- *
175
- * @param entity
176
- * @returns string
177
- */
178
- static getEntityType(entity: any) {
179
- let entityType = entity['entityType'];
180
- if (!entityType) {
181
- const typePath: string = entity['typePath'];
182
- if (typePath) {
183
- const types = typePath.split(':');
184
- if(types && types[0]){
185
- entityType = types[0];
186
- }
187
- }
188
- }
189
- if (!entityType) {
190
- throw Error(TypeConversionUtils.NO_ENTITY_TYPE);
191
- }
192
- return entityType;
193
- }
194
-
195
- /** Takes in a FlexPLM object and returns the correct VibeIQ entity
196
- * class associated to the object. Order of precedence
197
- * Property 'vibeIQEntityClass'
198
- * Map file entry in 'typeConversion:flex2vibe:<value>:getObjectClass()'
199
- * for value from 'objectClass'
200
- * TypeDefaults.getDefaultEntityClass() function
201
- *
202
- * @param fileId id for mapFile
203
- * @param mapFileUtil class to get mapfile
204
- * @param object FlexPLM object
205
- * @returns Promise<string>
206
- */
207
- static async getEntityClassFromObject(fileId, mapFileUtil, object): Promise<string>{
208
- let entityClass = object['vibeIQEntityClass'];
209
- if (entityClass){
210
- return entityClass;
211
- }
212
-
213
- if(fileId){
214
- const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
215
- const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
216
- if(mapData['getClass']){
217
- entityClass = await mapData['getClass'](object);
218
- }
219
- }
220
-
221
- if(entityClass){
222
- return entityClass;
223
- }
224
- return TypeDefaults.getDefaultEntityClass(object);
225
- }
226
-
227
- /** Takes in a FlexPLM object and returns the correct VibeIQ uniqueness
228
- * pool key. Order of precedence:
229
- * Map file entry in 'typeConversion:flex2vibe:<value>:getUniquenessPool()'
230
- * for value from 'objectClass'
231
- * TypeDefaults.getDefaultEntityClass() function
232
- *
233
- * @param fileId id for mapFile
234
- * @param mapFileUtil class to get mapfile
235
- * @param object FlexPLM object
236
- * @returns Promise<string>
237
- */
238
- static async getUniquenessPoolKeyFromObject(fileId, mapFileUtil, object): Promise<string>{
239
- let uniquenessPool;
240
-
241
- if(fileId){
242
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
243
- if(mapKey){
244
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
245
- if(mapData && mapData['uniquenessPool']){
246
- uniquenessPool = mapData['uniquenessPool'];
247
- }
248
- }
249
- }
250
-
251
- if(uniquenessPool){
252
- return uniquenessPool;
253
- }
254
- return TypeDefaults.getDefaultEntityClass(object);
255
- }
256
-
257
- /** Takes in a FlexPLM object and returns the correct VibeIQ
258
- * type associated to the object. Order of precedence
259
- * Property 'vibeIQTypePath'
260
- * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
261
- * for value from 'objectClass' or root from 'flexPLMTypePath'
262
- * TypeDefaults.getDefaultEntityTypePath() function
263
- *
264
- * @param transformMapFile id for mapFile
265
- * @param mapFileUtil class to get mapfile
266
- * @param entity VibeIQ entity
267
- * @returns Promise<string>
268
- */
269
- static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object): Promise<string>{
270
- let typePath = object['vibeIQTypePath'];
271
-
272
- if(typePath){
273
- return typePath;
274
- }
275
-
276
- if(fileId){
277
- const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
278
- const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
279
- if(mapData['getSoftType']){
280
- typePath = await mapData['getSoftType'](object);
281
- }
282
- }
283
-
284
- if(typePath){
285
- return typePath;
286
- }
287
- return TypeDefaults.getDefaultEntityTypePath(object);
288
- }
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>:getIdentifierProperties()'
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
- */
302
- static async getIdentifierPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
303
- let identifiers = object['vibeIQIdentifierProperties'];
304
- if(identifiers){
305
- return identifiers
306
- }
307
-
308
- if(fileId){
309
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
310
-
311
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
312
- if(mapData && mapData['getIdentifierProperties']){
313
- identifiers = await mapData['getIdentifierProperties'](object);
314
- }
315
- }
316
- if(identifiers){
317
- return identifiers
318
- }
319
-
320
- return TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
321
- }
322
-
323
- /**Takes in a FlexPLM object and returns the correct
324
- * identifier properties. Order of precedence
325
- * Property 'vibeIQIdentifierProperties'
326
- * Map file entry in 'typeConversion:flex2vibe:<value>:getInformationalProperties()'
327
- * for value from 'objectClass'
328
- * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
329
- *
330
- * @param transformMapFile id for mapFile
331
- * @param mapFileUtil class to get mapfile
332
- * @param object
333
- * @returns Promise<string[]>
334
- */
335
- static async getInformationalPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
336
- let identifiers = object['vibeIQInformationalProperties'];
337
- if(identifiers){
338
- return identifiers
339
- }
340
-
341
- if(fileId){
342
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
343
-
344
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
345
- if(mapData && mapData['getInformationalProperties']){
346
- identifiers = await mapData['getInformationalProperties'](object);
347
- }
348
- }
349
- if(identifiers){
350
- return identifiers
351
- }
352
-
353
- return TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
354
- }
355
-
356
- static async getMapKeyFromObject(fileId, mapFileUtil: MapFileUtil, object: any, direction:string): Promise<string | undefined> {
357
- const type = this.getObjectType(object);
358
- if(fileId){
359
- const mappingData = await mapFileUtil.getMappingSection(fileId, 'typeConversion', direction);
360
- if(mappingData && mappingData[type] && mappingData[type]['getMapKey']){
361
- const mapKey = await mappingData[type]['getMapKey'](object);
362
- return mapKey;
363
- }
364
- return type;
365
- }
366
- //TODO use TypeDefaults?
367
- }
368
-
369
- static async isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean> {
370
-
371
- let isInboundCreatable = false;
372
- if(fileId){
373
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
374
-
375
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
376
- if(mapData && mapData['isInboundCreatable']){
377
- isInboundCreatable = await mapData['isInboundCreatable'](object, context);
378
- }
379
- }
380
-
381
- return isInboundCreatable;
382
- }
383
-
384
- static async isOutboundCreatableFromEntity(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean> {
385
-
386
- let isOutboundCreatable = true;
387
-
388
- if (!fileId) {
389
- return isOutboundCreatable;
390
- }
391
-
392
- let mapKey: string | undefined;
393
- try {
394
- mapKey = await this.getMapKey(fileId, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
395
- } catch {
396
- return isOutboundCreatable;
397
- }
398
-
399
- if (!mapKey) {
400
- return isOutboundCreatable;
401
- }
402
-
403
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
404
- if (mapData && mapData['isOutboundCreatable']) {
405
- isOutboundCreatable = await mapData['isOutboundCreatable'](entity, context);
406
- }
407
- return isOutboundCreatable;
408
- }
409
-
410
- /** Takes in a FlexPLM object and determines whether inbound
411
- * images should be synced. In most cases, the creation owning system
412
- * will also control image syncing. Defaults to false if no mapping exists.
413
- * Map file entry in '<mapKey>:syncInboundImages()'
414
- *
415
- * @param fileId id for mapFile
416
- * @param mapFileUtil class to get mapfile
417
- * @param object FlexPLM object
418
- * @param context optional context object
419
- * @returns Promise<boolean>
420
- */
421
- static async syncInboundImages(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean> {
422
-
423
- let syncImages = false;
424
-
425
- if (!fileId) {
426
- return syncImages;
427
- }
428
-
429
- let mapKey: string | undefined;
430
- try {
431
- mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
432
- } catch {
433
- return syncImages;
434
- }
435
-
436
- if (!mapKey) {
437
- return syncImages;
438
- }
439
-
440
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
441
- if (mapData && mapData['syncInboundImages']) {
442
- syncImages = await mapData['syncInboundImages'](object, context);
443
- }
444
- return syncImages;
445
- }
446
-
447
- /** Takes in a VibeIQ entity object and determines whether outbound
448
- * images should be synced. In most cases, the creation owning system
449
- * will also control image syncing. Defaults to true if no mapping exists.
450
- * Map file entry in '<mapKey>:syncOutboundImages()'
451
- *
452
- * @param fileId id for mapFile
453
- * @param mapFileUtil class to get mapfile
454
- * @param entity VibeIQ entity
455
- * @param context optional context object
456
- * @returns Promise<boolean>
457
- */
458
- static async syncOutboundImages(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean> {
459
-
460
- let syncImages = true;
461
-
462
- if (!fileId) {
463
- return syncImages;
464
- }
465
-
466
- let mapKey: string | undefined;
467
- try {
468
- mapKey = await this.getMapKey(fileId, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
469
- } catch {
470
- return syncImages;
471
- }
472
-
473
- if (!mapKey) {
474
- return syncImages;
475
- }
476
-
477
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
478
- if (mapData && mapData['syncOutboundImages']) {
479
- syncImages = await mapData['syncOutboundImages'](entity, context);
480
- }
481
- return syncImages;
482
- }
483
-
484
- static getObjectType(object:any) {
485
- let objectType = object['flexPLMObjectClass'];
486
- return objectType;
487
- }
488
-
489
-
490
- }