@contrail/flexplm 1.3.0 → 1.3.1-alpha.585afc1

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 (149) hide show
  1. package/lib/cli/commands/compile.d.ts +1 -0
  2. package/lib/cli/commands/compile.js +71 -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 +1 -0
  6. package/lib/cli/commands/create.js +75 -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 +10 -0
  10. package/lib/cli/commands/upload.js +219 -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 +2 -0
  14. package/lib/cli/index.js +64 -0
  15. package/lib/cli/index.spec.d.ts +1 -0
  16. package/lib/cli/index.spec.js +79 -0
  17. package/lib/cli/template/mapping-template.ts.template +18 -0
  18. package/lib/entity-processor/base-entity-processor.d.ts +89 -42
  19. package/lib/entity-processor/base-entity-processor.js +438 -385
  20. package/lib/entity-processor/base-entity-processor.spec.d.ts +1 -1
  21. package/lib/entity-processor/base-entity-processor.spec.js +398 -397
  22. package/lib/flexplm-request.d.ts +3 -3
  23. package/lib/flexplm-request.js +34 -34
  24. package/lib/flexplm-utils.d.ts +5 -5
  25. package/lib/flexplm-utils.js +33 -33
  26. package/lib/flexplm-utils.spec.d.ts +1 -1
  27. package/lib/flexplm-utils.spec.js +26 -26
  28. package/lib/index.d.ts +23 -22
  29. package/lib/index.js +39 -38
  30. package/lib/interfaces/interfaces.d.ts +105 -105
  31. package/lib/interfaces/interfaces.js +2 -2
  32. package/lib/interfaces/item-family-changes.d.ts +20 -20
  33. package/lib/interfaces/item-family-changes.js +56 -56
  34. package/lib/interfaces/mapping-file.d.ts +429 -0
  35. package/lib/interfaces/mapping-file.js +2 -0
  36. package/lib/interfaces/publish-change-data.d.ts +19 -19
  37. package/lib/interfaces/publish-change-data.js +32 -32
  38. package/lib/publish/base-process-publish-assortment-callback.d.ts +9 -9
  39. package/lib/publish/base-process-publish-assortment-callback.js +38 -38
  40. package/lib/publish/base-process-publish-assortment.d.ts +118 -93
  41. package/lib/publish/base-process-publish-assortment.js +998 -944
  42. package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -1
  43. package/lib/publish/base-process-publish-assortment.spec.js +1688 -1670
  44. package/lib/publish/mockData.d.ts +1389 -1389
  45. package/lib/publish/mockData.js +4524 -4519
  46. package/lib/transform/identifier-conversion-spec-mockData.js +472 -444
  47. package/lib/transform/identifier-conversion.d.ts +51 -15
  48. package/lib/transform/identifier-conversion.js +248 -212
  49. package/lib/transform/identifier-conversion.spec.d.ts +1 -1
  50. package/lib/transform/identifier-conversion.spec.js +343 -339
  51. package/lib/util/config-defaults.d.ts +8 -8
  52. package/lib/util/config-defaults.js +88 -85
  53. package/lib/util/config-defaults.spec.d.ts +1 -1
  54. package/lib/util/config-defaults.spec.js +302 -293
  55. package/lib/util/data-converter-spec-mockData.js +219 -205
  56. package/lib/util/data-converter.d.ts +136 -39
  57. package/lib/util/data-converter.js +718 -592
  58. package/lib/util/data-converter.spec.d.ts +1 -1
  59. package/lib/util/data-converter.spec.js +906 -904
  60. package/lib/util/error-response-object.d.ts +9 -4
  61. package/lib/util/error-response-object.js +54 -47
  62. package/lib/util/error-response-object.spec.d.ts +1 -1
  63. package/lib/util/error-response-object.spec.js +99 -99
  64. package/lib/util/event-short-message-status.d.ts +19 -19
  65. package/lib/util/event-short-message-status.js +24 -23
  66. package/lib/util/federation.d.ts +15 -15
  67. package/lib/util/federation.js +157 -149
  68. package/lib/util/flexplm-connect.d.ts +29 -22
  69. package/lib/util/flexplm-connect.js +190 -176
  70. package/lib/util/flexplm-connect.spec.d.ts +1 -1
  71. package/lib/util/flexplm-connect.spec.js +88 -88
  72. package/lib/util/logger-config.d.ts +1 -1
  73. package/lib/util/logger-config.js +27 -26
  74. package/lib/util/map-util-spec-mockData.js +219 -205
  75. package/lib/util/map-utils.d.ts +33 -6
  76. package/lib/util/map-utils.js +42 -15
  77. package/lib/util/map-utils.spec.d.ts +1 -1
  78. package/lib/util/map-utils.spec.js +89 -89
  79. package/lib/util/mockData.d.ts +80 -80
  80. package/lib/util/mockData.js +103 -103
  81. package/lib/util/thumbnail-util.d.ts +55 -34
  82. package/lib/util/thumbnail-util.js +242 -215
  83. package/lib/util/thumbnail-util.spec.d.ts +1 -1
  84. package/lib/util/thumbnail-util.spec.js +440 -434
  85. package/lib/util/type-conversion-utils-spec-mockData.js +259 -259
  86. package/lib/util/type-conversion-utils.d.ts +163 -23
  87. package/lib/util/type-conversion-utils.js +408 -265
  88. package/lib/util/type-conversion-utils.spec.d.ts +1 -1
  89. package/lib/util/type-conversion-utils.spec.js +868 -868
  90. package/lib/util/type-defaults.d.ts +74 -16
  91. package/lib/util/type-defaults.js +279 -221
  92. package/lib/util/type-defaults.spec.d.ts +1 -1
  93. package/lib/util/type-defaults.spec.js +516 -516
  94. package/lib/util/type-utils.d.ts +34 -13
  95. package/lib/util/type-utils.js +137 -114
  96. package/lib/util/type-utils.spec.d.ts +1 -1
  97. package/lib/util/type-utils.spec.js +192 -190
  98. package/package.json +21 -6
  99. package/scripts/copy-template.js +10 -0
  100. package/.claude/settings.local.json +0 -8
  101. package/.github/pull_request_template.md +0 -31
  102. package/.github/workflows/flexplm-lib.yml +0 -27
  103. package/.github/workflows/publish-to-npm.yml +0 -124
  104. package/CHANGELOG.md +0 -32
  105. package/publish.bat +0 -5
  106. package/publish.sh +0 -5
  107. package/src/entity-processor/base-entity-processor.spec.ts +0 -460
  108. package/src/entity-processor/base-entity-processor.ts +0 -515
  109. package/src/flexplm-request.ts +0 -28
  110. package/src/flexplm-utils.spec.ts +0 -27
  111. package/src/flexplm-utils.ts +0 -29
  112. package/src/index.ts +0 -22
  113. package/src/interfaces/interfaces.ts +0 -122
  114. package/src/interfaces/item-family-changes.ts +0 -67
  115. package/src/interfaces/publish-change-data.ts +0 -43
  116. package/src/publish/base-process-publish-assortment-callback.ts +0 -50
  117. package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
  118. package/src/publish/base-process-publish-assortment.ts +0 -1134
  119. package/src/publish/mockData.ts +0 -4561
  120. package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
  121. package/src/transform/identifier-conversion.spec.ts +0 -354
  122. package/src/transform/identifier-conversion.ts +0 -282
  123. package/src/util/config-defaults.spec.ts +0 -350
  124. package/src/util/config-defaults.ts +0 -93
  125. package/src/util/data-converter-spec-mockData.ts +0 -231
  126. package/src/util/data-converter.spec.ts +0 -1041
  127. package/src/util/data-converter.ts +0 -762
  128. package/src/util/error-response-object.spec.ts +0 -116
  129. package/src/util/error-response-object.ts +0 -50
  130. package/src/util/event-short-message-status.ts +0 -22
  131. package/src/util/federation.ts +0 -172
  132. package/src/util/flexplm-connect.spec.ts +0 -132
  133. package/src/util/flexplm-connect.ts +0 -208
  134. package/src/util/logger-config.ts +0 -20
  135. package/src/util/map-util-spec-mockData.ts +0 -231
  136. package/src/util/map-utils.spec.ts +0 -103
  137. package/src/util/map-utils.ts +0 -41
  138. package/src/util/mockData.ts +0 -101
  139. package/src/util/thumbnail-util.spec.ts +0 -508
  140. package/src/util/thumbnail-util.ts +0 -272
  141. package/src/util/type-conversion-utils-spec-mockData.ts +0 -271
  142. package/src/util/type-conversion-utils.spec.ts +0 -968
  143. package/src/util/type-conversion-utils.ts +0 -460
  144. package/src/util/type-defaults.spec.ts +0 -669
  145. package/src/util/type-defaults.ts +0 -281
  146. package/src/util/type-utils.spec.ts +0 -227
  147. package/src/util/type-utils.ts +0 -144
  148. package/tsconfig.json +0 -29
  149. package/tslint.json +0 -57
@@ -1,460 +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
228
- * type associated to the object. Order of precedence
229
- * Property 'vibeIQTypePath'
230
- * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
231
- * for value from 'objectClass' or root from 'flexPLMTypePath'
232
- * TypeDefaults.getDefaultEntityTypePath() function
233
- *
234
- * @param transformMapFile id for mapFile
235
- * @param mapFileUtil class to get mapfile
236
- * @param entity VibeIQ entity
237
- * @returns Promise<string>
238
- */
239
- static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object): Promise<string>{
240
- let typePath = object['vibeIQTypePath'];
241
-
242
- if(typePath){
243
- return typePath;
244
- }
245
-
246
- if(fileId){
247
- const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
248
- const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
249
- if(mapData['getSoftType']){
250
- typePath = await mapData['getSoftType'](object);
251
- }
252
- }
253
-
254
- if(typePath){
255
- return typePath;
256
- }
257
- return TypeDefaults.getDefaultEntityTypePath(object);
258
- }
259
-
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>:getIdentifierProperties()'
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
- static async getIdentifierPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
273
- let identifiers = object['vibeIQIdentifierProperties'];
274
- if(identifiers){
275
- return identifiers
276
- }
277
-
278
- if(fileId){
279
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
280
-
281
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
282
- if(mapData && mapData['getIdentifierProperties']){
283
- identifiers = await mapData['getIdentifierProperties'](object);
284
- }
285
- }
286
- if(identifiers){
287
- return identifiers
288
- }
289
-
290
- return TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
291
- }
292
-
293
- /**Takes in a FlexPLM object and returns the correct
294
- * identifier properties. Order of precedence
295
- * Property 'vibeIQIdentifierProperties'
296
- * Map file entry in 'typeConversion:flex2vibe:<value>:getInformationalProperties()'
297
- * for value from 'objectClass'
298
- * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
299
- *
300
- * @param transformMapFile id for mapFile
301
- * @param mapFileUtil class to get mapfile
302
- * @param object
303
- * @returns Promise<string[]>
304
- */
305
- static async getInformationalPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
306
- let identifiers = object['vibeIQInformationalProperties'];
307
- if(identifiers){
308
- return identifiers
309
- }
310
-
311
- if(fileId){
312
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
313
-
314
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
315
- if(mapData && mapData['getInformationalProperties']){
316
- identifiers = await mapData['getInformationalProperties'](object);
317
- }
318
- }
319
- if(identifiers){
320
- return identifiers
321
- }
322
-
323
- return TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
324
- }
325
-
326
- static async getMapKeyFromObject(fileId, mapFileUtil: MapFileUtil, object: any, direction:string): Promise<string | undefined> {
327
- const type = this.getObjectType(object);
328
- if(fileId){
329
- const mappingData = await mapFileUtil.getMappingSection(fileId, 'typeConversion', direction);
330
- if(mappingData && mappingData[type] && mappingData[type]['getMapKey']){
331
- const mapKey = await mappingData[type]['getMapKey'](object);
332
- return mapKey;
333
- }
334
- return type;
335
- }
336
- //TODO use TypeDefaults?
337
- }
338
-
339
- static async isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean> {
340
-
341
- let isInboundCreatable = false;
342
- if(fileId){
343
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
344
-
345
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
346
- if(mapData && mapData['isInboundCreatable']){
347
- isInboundCreatable = await mapData['isInboundCreatable'](object, context);
348
- }
349
- }
350
-
351
- return isInboundCreatable;
352
- }
353
-
354
- static async isOutboundCreatableFromEntity(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean> {
355
-
356
- let isOutboundCreatable = true;
357
-
358
- if (!fileId) {
359
- return isOutboundCreatable;
360
- }
361
-
362
- let mapKey: string | undefined;
363
- try {
364
- mapKey = await this.getMapKey(fileId, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
365
- } catch {
366
- return isOutboundCreatable;
367
- }
368
-
369
- if (!mapKey) {
370
- return isOutboundCreatable;
371
- }
372
-
373
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
374
- if (mapData && mapData['isOutboundCreatable']) {
375
- isOutboundCreatable = await mapData['isOutboundCreatable'](entity, context);
376
- }
377
- return isOutboundCreatable;
378
- }
379
-
380
- /** Takes in a FlexPLM object and determines whether inbound
381
- * images should be synced. In most cases, the creation owning system
382
- * will also control image syncing. Defaults to false if no mapping exists.
383
- * Map file entry in '<mapKey>:syncInboundImages()'
384
- *
385
- * @param fileId id for mapFile
386
- * @param mapFileUtil class to get mapfile
387
- * @param object FlexPLM object
388
- * @param context optional context object
389
- * @returns Promise<boolean>
390
- */
391
- static async syncInboundImages(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean> {
392
-
393
- let syncImages = false;
394
-
395
- if (!fileId) {
396
- return syncImages;
397
- }
398
-
399
- let mapKey: string | undefined;
400
- try {
401
- mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
402
- } catch {
403
- return syncImages;
404
- }
405
-
406
- if (!mapKey) {
407
- return syncImages;
408
- }
409
-
410
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
411
- if (mapData && mapData['syncInboundImages']) {
412
- syncImages = await mapData['syncInboundImages'](object, context);
413
- }
414
- return syncImages;
415
- }
416
-
417
- /** Takes in a VibeIQ entity object and determines whether outbound
418
- * images should be synced. In most cases, the creation owning system
419
- * will also control image syncing. Defaults to true if no mapping exists.
420
- * Map file entry in '<mapKey>:syncOutboundImages()'
421
- *
422
- * @param fileId id for mapFile
423
- * @param mapFileUtil class to get mapfile
424
- * @param entity VibeIQ entity
425
- * @param context optional context object
426
- * @returns Promise<boolean>
427
- */
428
- static async syncOutboundImages(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean> {
429
-
430
- let syncImages = true;
431
-
432
- if (!fileId) {
433
- return syncImages;
434
- }
435
-
436
- let mapKey: string | undefined;
437
- try {
438
- mapKey = await this.getMapKey(fileId, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
439
- } catch {
440
- return syncImages;
441
- }
442
-
443
- if (!mapKey) {
444
- return syncImages;
445
- }
446
-
447
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
448
- if (mapData && mapData['syncOutboundImages']) {
449
- syncImages = await mapData['syncOutboundImages'](entity, context);
450
- }
451
- return syncImages;
452
- }
453
-
454
- static getObjectType(object:any) {
455
- let objectType = object['flexPLMObjectClass'];
456
- return objectType;
457
- }
458
-
459
-
460
- }