@contrail/flexplm 1.5.0-alpha.98b8b06 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.github/pull_request_template.md +31 -0
  2. package/.github/workflows/flexplm-lib.yml +27 -0
  3. package/.github/workflows/publish-to-npm.yml +121 -0
  4. package/CHANGELOG.md +45 -0
  5. package/lib/entity-processor/base-entity-processor.d.ts +0 -65
  6. package/lib/entity-processor/base-entity-processor.js +0 -71
  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 +1 -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 +1 -152
  39. package/lib/util/type-conversion-utils.js +1 -155
  40. package/lib/util/type-defaults.d.ts +0 -66
  41. package/lib/util/type-defaults.js +0 -66
  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 +689 -0
  50. package/src/entity-processor/base-entity-processor.ts +583 -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 +386 -0
  64. package/src/transform/identifier-conversion.ts +282 -0
  65. package/src/util/config-defaults.spec.ts +445 -0
  66. package/src/util/config-defaults.ts +106 -0
  67. package/src/util/data-converter-spec-mockData.ts +231 -0
  68. package/src/util/data-converter.spec.ts +1622 -0
  69. package/src/util/data-converter.ts +819 -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 +272 -0
  84. package/src/util/type-conversion-utils.spec.ts +1031 -0
  85. package/src/util/type-conversion-utils.ts +490 -0
  86. package/src/util/type-defaults.spec.ts +797 -0
  87. package/src/util/type-defaults.ts +320 -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 -4
  93. package/lib/cli/commands/compile.js +0 -73
  94. package/lib/cli/commands/compile.spec.d.ts +0 -1
  95. package/lib/cli/commands/compile.spec.js +0 -80
  96. package/lib/cli/commands/create.d.ts +0 -5
  97. package/lib/cli/commands/create.js +0 -77
  98. package/lib/cli/commands/create.spec.d.ts +0 -1
  99. package/lib/cli/commands/create.spec.js +0 -78
  100. package/lib/cli/commands/upload.d.ts +0 -17
  101. package/lib/cli/commands/upload.js +0 -228
  102. package/lib/cli/commands/upload.spec.d.ts +0 -1
  103. package/lib/cli/commands/upload.spec.js +0 -88
  104. package/lib/cli/index.d.ts +0 -5
  105. package/lib/cli/index.js +0 -70
  106. package/lib/cli/index.spec.d.ts +0 -1
  107. package/lib/cli/index.spec.js +0 -85
  108. package/lib/cli/template/mapping-template.ts.template +0 -62
  109. package/lib/interfaces/mapping-file.d.ts +0 -460
  110. package/lib/interfaces/mapping-file.js +0 -2
  111. package/scripts/copy-template.js +0 -10
@@ -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,20 +118,6 @@ class TypeConversionUtils {
199
118
  }
200
119
  return type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
201
120
  }
202
- static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object) {
203
- return await this.getEntityTypePathFromObject(fileId, mapFileUtil, object);
204
- }
205
- /** Takes in a FlexPLM object and returns the correct VibeIQ uniqueness
206
- * pool key. Order of precedence:
207
- * Map file entry in 'typeConversion:flex2vibe:<value>:getUniquenessPool()'
208
- * for value from 'objectClass'
209
- * TypeDefaults.getDefaultEntityClass() function
210
- *
211
- * @param fileId id for mapFile
212
- * @param mapFileUtil class to get mapfile
213
- * @param object FlexPLM object
214
- * @returns Promise<string>
215
- */
216
121
  static async getUniquenessPoolKeyFromObject(fileId, mapFileUtil, object) {
217
122
  let uniquenessPool;
218
123
  if (fileId) {
@@ -229,19 +134,7 @@ class TypeConversionUtils {
229
134
  }
230
135
  return type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
231
136
  }
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) {
137
+ static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object) {
245
138
  let typePath = object['vibeIQTypePath'];
246
139
  if (typePath) {
247
140
  return typePath;
@@ -258,18 +151,6 @@ class TypeConversionUtils {
258
151
  }
259
152
  return type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
260
153
  }
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
- */
273
154
  static async getIdentifierPropertiesFromObject(fileId, mapFileUtil, object) {
274
155
  let identifiers = object['vibeIQIdentifierProperties'];
275
156
  if (identifiers) {
@@ -287,18 +168,6 @@ class TypeConversionUtils {
287
168
  }
288
169
  return type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
289
170
  }
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
- */
302
171
  static async getInformationalPropertiesFromObject(fileId, mapFileUtil, object) {
303
172
  let identifiers = object['vibeIQInformationalProperties'];
304
173
  if (identifiers) {
@@ -326,7 +195,6 @@ class TypeConversionUtils {
326
195
  }
327
196
  return type;
328
197
  }
329
- //TODO use TypeDefaults?
330
198
  }
331
199
  static async isInboundCreatableFromObject(fileId, mapFileUtil, object, context) {
332
200
  let isInboundCreatable = false;
@@ -360,17 +228,6 @@ class TypeConversionUtils {
360
228
  }
361
229
  return isOutboundCreatable;
362
230
  }
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
- */
374
231
  static async syncInboundImages(fileId, mapFileUtil, object, context) {
375
232
  let syncImages = false;
376
233
  if (!fileId) {
@@ -392,17 +249,6 @@ class TypeConversionUtils {
392
249
  }
393
250
  return syncImages;
394
251
  }
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
- */
406
252
  static async syncOutboundImages(fileId, mapFileUtil, entity, context) {
407
253
  let syncImages = true;
408
254
  if (!fileId) {
@@ -4,82 +4,16 @@ 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
- */
15
7
  static applyConfig(config: any): void;
16
8
  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
- */
23
9
  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
- */
30
10
  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
- */
38
11
  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
- */
46
12
  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
- */
53
13
  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
- */
60
14
  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
- */
67
15
  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
- */
75
16
  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
- */
83
17
  static getDefaultInformationalPropertiesFromObject(object: any): string[];
84
18
  static getObjectClass(object: any): string;
85
19
  }
@@ -4,26 +4,12 @@ exports.TypeDefaults = void 0;
4
4
  class TypeDefaults {
5
5
  constructor() {
6
6
  }
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
- */
15
7
  static applyConfig(config) {
16
8
  TypeDefaults.processLCSMaterialAsItem = TypeDefaults.isPropertyTrue(config?.LCSMaterial?.processAsItem);
17
9
  }
18
10
  static isPropertyTrue(value) {
19
11
  return value === true || (typeof value === 'string' && value.toLowerCase() === 'true');
20
12
  }
21
- /**Takes in full entity and returs the default FlexPLM
22
- * object class.
23
- *
24
- * @param entity
25
- * @returns string
26
- */
27
13
  static getDefaultObjectClass(entity) {
28
14
  const entityType = this.getEntityType(entity);
29
15
  let objectClass = '';
@@ -62,12 +48,6 @@ class TypeDefaults {
62
48
  }
63
49
  return objectClass;
64
50
  }
65
- /**Takes in full entity and returns the default FlexPLM type path
66
- * object class.
67
- *
68
- * @param entity
69
- * @returns string
70
- */
71
51
  static getDefaultObjectTypePath(entity) {
72
52
  let typePath = '';
73
53
  const entityType = this.getEntityType(entity);
@@ -96,13 +76,6 @@ class TypeDefaults {
96
76
  }
97
77
  return typePath;
98
78
  }
99
- /**Takes in full entity and returns the slugs for the default identifier
100
- * properties. These properties are used when searching for an entity
101
- * object class.
102
- *
103
- * @param entity
104
- * @returns string[]
105
- */
106
79
  static getDefaultIdentifierProperties(entity) {
107
80
  const identifierProps = [];
108
81
  const entityType = this.getEntityType(entity);
@@ -128,13 +101,6 @@ class TypeDefaults {
128
101
  }
129
102
  return identifierProps;
130
103
  }
131
- /** Takes in full entity and returns the slugs for informational
132
- * properties. These properties are helpful when debugging issues
133
- * where the identifier properties don't find a match.
134
- *
135
- * @param entity
136
- * @returns string[]
137
- */
138
104
  static getDefaultInformationalProperties(entity) {
139
105
  const entityType = this.getEntityType(entity);
140
106
  let properties = [];
@@ -151,12 +117,6 @@ class TypeDefaults {
151
117
  }
152
118
  return properties;
153
119
  }
154
- /** Returns the VibeIQ entity type from an entity.
155
- * Throws error if it can't determine the entity type
156
- *
157
- * @param entity
158
- * @returns string
159
- */
160
120
  static getEntityType(entity) {
161
121
  let entityType = entity['entityType'];
162
122
  if (!entityType) {
@@ -173,12 +133,6 @@ class TypeDefaults {
173
133
  }
174
134
  return entityType;
175
135
  }
176
- /**Takes in full object and returns the default VibeIQ
177
- * entity class.
178
- *
179
- * @param entity
180
- * @returns string
181
- */
182
136
  static getDefaultEntityClass(object) {
183
137
  let entityClass = '';
184
138
  let objectClass = TypeDefaults.getObjectClass(object);
@@ -207,12 +161,6 @@ class TypeDefaults {
207
161
  throw Error(TypeDefaults.NO_OBJECT_CLASS);
208
162
  return entityClass;
209
163
  }
210
- /**Takes in full object and returns the default VibeIQ type path
211
- * object class.
212
- *
213
- * @param object
214
- * @returns string
215
- */
216
164
  static getDefaultEntityTypePath(object) {
217
165
  let typePath = '';
218
166
  const objectClass = TypeDefaults.getObjectClass(object);
@@ -242,13 +190,6 @@ class TypeDefaults {
242
190
  throw Error(TypeDefaults.NO_TYPE_PATH);
243
191
  return typePath;
244
192
  }
245
- /**Takes in full entity and returns the slugs for the default identifier
246
- * properties. These properties are used when searching for an entity
247
- * object class.
248
- *
249
- * @param entity
250
- * @returns string[]
251
- */
252
193
  static getDefaultIdentifierPropertiesFromObject(object) {
253
194
  const identifierProps = [];
254
195
  const objectClass = TypeDefaults.getObjectClass(object);
@@ -280,13 +221,6 @@ class TypeDefaults {
280
221
  }
281
222
  return identifierProps;
282
223
  }
283
- /** Takes in full object and returns the slugs for informational
284
- * properties. These properties are helpful when debugging issues
285
- * where the identifier properties don't find a match.
286
- *
287
- * @param object
288
- * @returns string[]
289
- */
290
224
  static getDefaultInformationalPropertiesFromObject(object) {
291
225
  const objectClass = TypeDefaults.getObjectClass(object);
292
226
  let properties = [];
@@ -304,7 +304,7 @@ describe('Type Defaults', () => {
304
304
  expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrowError();
305
305
  expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrow(type_defaults_1.TypeDefaults.NO_ENTITY_TYPE);
306
306
  });
307
- }); //getEntityType
307
+ });
308
308
  describe('getDefaultEntityClass', () => {
309
309
  it('item - LCSProduct', () => {
310
310
  const object = {
@@ -389,7 +389,7 @@ describe('Type Defaults', () => {
389
389
  const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
390
390
  expect(entityClass).toBe('custom-entity');
391
391
  });
392
- }); //getDefaultEntityClass
392
+ });
393
393
  describe('getDefaultEntityTypePath', () => {
394
394
  it('LCSProduct', () => {
395
395
  const object = {
@@ -459,7 +459,7 @@ describe('Type Defaults', () => {
459
459
  };
460
460
  expect(() => type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object)).toThrowError(type_defaults_1.TypeDefaults.NO_TYPE_PATH);
461
461
  });
462
- }); //getDefaultEntityTypePath
462
+ });
463
463
  describe('getDefaultIdentifierPropertiesFromObject', () => {
464
464
  it('LCSProduct', () => {
465
465
  const object = {
@@ -539,7 +539,7 @@ describe('Type Defaults', () => {
539
539
  expect(defaultIdentifiers).toContain('name');
540
540
  expect(defaultIdentifiers).toHaveLength(1);
541
541
  });
542
- }); //getDefaultIdentifierPropertiesFromObject
542
+ });
543
543
  describe('getDefaultInformationalPropertiesFromObject', () => {
544
544
  it('LCSProduct', () => {
545
545
  const object = {
@@ -594,7 +594,7 @@ describe('Type Defaults', () => {
594
594
  const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
595
595
  expect(defaultIdentifiers).toHaveLength(0);
596
596
  });
597
- }); //getDefaultInformationalPropertiesFromObject
597
+ });
598
598
  describe('applyConfig', () => {
599
599
  afterEach(() => {
600
600
  type_defaults_1.TypeDefaults.applyConfig({});
@@ -5,30 +5,9 @@ export declare class TypeUtils {
5
5
  constructor();
6
6
  getTypeById(id: any): Promise<import("@contrail/types").Type>;
7
7
  getByRootAndPath(options: TypeClientOptions): Promise<import("@contrail/types").Type>;
8
- /** Deprecated: use TypeConversionUtils.getObjectTypePath() */
9
8
  static getFlexPLMTypePath(entity: any): any;
10
- /** Deprecated: use TypeConversionUtils.getObjectClass()
11
- *
12
- * @param entityType
13
- * @param newData
14
- * @returns
15
- */
16
9
  getEventObjectClass(entityType: string, newData: any): string;
17
- /** Gets the VibeIQ entity type for the object data
18
- * @param data: object data
19
- */
20
10
  getEntityTypeClientOptionsUsingMapping(transformMapFile: any, mapFileUtil: any, data: any): Promise<TypeClientOptions>;
21
- /** Gets the VibeIQ entity type for the object data
22
- * @param objectClass: string object class
23
- * @param data: object data
24
- */
25
11
  getEntityTypeClientOptions(objectClass: string, data: any): TypeClientOptions;
26
- /** This will filter the properties based the newData entity.
27
- * It is assumed the type is correct for the entity
28
- *
29
- * @param type entire type object
30
- * @param newData the entity being processed
31
- * @returns TypeProperty[] of applicable properties
32
- */
33
12
  filterTypeProperties(type: any, newData: any): TypeProperty[];
34
13
  }
@@ -9,7 +9,6 @@ class TypeUtils {
9
9
  this.typesObj = new sdk_1.Types();
10
10
  }
11
11
  async getTypeById(id) {
12
- // this.logger.log('!-getTypeById: ' + id);
13
12
  const type = await this.typesObj.getType({
14
13
  id,
15
14
  relations: ['typeProperties', 'typeInterfaces']
@@ -20,16 +19,9 @@ class TypeUtils {
20
19
  const type = await this.typesObj.getByRootAndPath(options);
21
20
  return type;
22
21
  }
23
- /** Deprecated: use TypeConversionUtils.getObjectTypePath() */
24
22
  static getFlexPLMTypePath(entity) {
25
23
  return entity['flexPLMTypePath'] || entity['flexTypePath'] || '';
26
24
  }
27
- /** Deprecated: use TypeConversionUtils.getObjectClass()
28
- *
29
- * @param entityType
30
- * @param newData
31
- * @returns
32
- */
33
25
  getEventObjectClass(entityType, newData) {
34
26
  let objectClass = '';
35
27
  if ('item' === entityType) {
@@ -56,9 +48,6 @@ class TypeUtils {
56
48
  }
57
49
  return objectClass;
58
50
  }
59
- /** Gets the VibeIQ entity type for the object data
60
- * @param data: object data
61
- */
62
51
  async getEntityTypeClientOptionsUsingMapping(transformMapFile, mapFileUtil, data) {
63
52
  const root = await type_conversion_utils_1.TypeConversionUtils.getEntityClassFromObject(transformMapFile, mapFileUtil, data);
64
53
  const path = await type_conversion_utils_1.TypeConversionUtils.getEntityTypePathFromOjbect(transformMapFile, mapFileUtil, data);
@@ -68,10 +57,6 @@ class TypeUtils {
68
57
  };
69
58
  return tco;
70
59
  }
71
- /** Gets the VibeIQ entity type for the object data
72
- * @param objectClass: string object class
73
- * @param data: object data
74
- */
75
60
  getEntityTypeClientOptions(objectClass, data) {
76
61
  let tco;
77
62
  if (['LCSProduct', 'LCSSKU'].includes(objectClass)) {
@@ -90,7 +75,6 @@ class TypeUtils {
90
75
  };
91
76
  }
92
77
  else if (['LCSBusinessObject', 'LCSRevisableEntity', 'LCSLast'].includes(objectClass)) {
93
- //TODO need to write logic using mapping file
94
78
  tco = {
95
79
  root: 'custom-entity'
96
80
  };
@@ -98,13 +82,6 @@ class TypeUtils {
98
82
  }
99
83
  return tco;
100
84
  }
101
- /** This will filter the properties based the newData entity.
102
- * It is assumed the type is correct for the entity
103
- *
104
- * @param type entire type object
105
- * @param newData the entity being processed
106
- * @returns TypeProperty[] of applicable properties
107
- */
108
85
  filterTypeProperties(type, newData) {
109
86
  let filteredProps = type['typeProperties'];
110
87
  const typePath = type['typePath'];
@@ -103,7 +103,6 @@ describe('filterProperties-item', () => {
103
103
  expect(filteredProps.length).toEqual(len);
104
104
  });
105
105
  });
106
- //project-item
107
106
  describe('filterProperties-project-item', () => {
108
107
  const projectItemType = {
109
108
  typePath: 'project-item'
@@ -153,7 +152,6 @@ describe('filterProperties-project-item', () => {
153
152
  expect(filteredProps.length).toEqual(len);
154
153
  });
155
154
  });
156
- //color
157
155
  describe('filterProperties-color', () => {
158
156
  const colorType = {
159
157
  typePath: 'color'
package/package.json CHANGED
@@ -1,18 +1,11 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.5.0-alpha.98b8b06",
3
+ "version": "1.5.0",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
- "bin": {
8
- "flexplm-mapping": "lib/cli/index.js"
9
- },
10
- "files": [
11
- "lib/**/*",
12
- "scripts/copy-template.js"
13
- ],
14
7
  "scripts": {
15
- "build": "tsc && node scripts/copy-template.js",
8
+ "build": "tsc",
16
9
  "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
17
10
  "lint": "tslint -p tsconfig.json",
18
11
  "test": "jest",
@@ -32,14 +25,6 @@
32
25
  "tslint-config-prettier": "^1.18.0",
33
26
  "typescript": "^4.0.0"
34
27
  },
35
- "peerDependencies": {
36
- "typescript": ">=4.0.0"
37
- },
38
- "peerDependenciesMeta": {
39
- "typescript": {
40
- "optional": true
41
- }
42
- },
43
28
  "jest": {
44
29
  "moduleFileExtensions": [
45
30
  "js",
@@ -55,10 +40,10 @@
55
40
  "testEnvironment": "node"
56
41
  },
57
42
  "dependencies": {
58
- "@contrail/app-framework": "^1.4.3",
59
- "@contrail/sdk": "^1.5.10",
60
- "@contrail/transform-data": "1.3.2-alpha.36321eb",
61
- "@contrail/util": "^1.3.1",
43
+ "@contrail/app-framework": "^1.3.4",
44
+ "@contrail/sdk": "^1.4.3",
45
+ "@contrail/transform-data": "^1.1.3",
46
+ "@contrail/util": "^1.0.48",
62
47
  "axios": "^1.4.0",
63
48
  "p-limit": "^3.1.0"
64
49
  }
package/publish.bat ADDED
@@ -0,0 +1,5 @@
1
+ rd /s /q lib
2
+ call npm install
3
+ call npm run build
4
+ call npm version patch
5
+ call npm publish
package/publish.sh ADDED
@@ -0,0 +1,5 @@
1
+ rm -rf lib;
2
+ npm install;
3
+ npm run build;
4
+ npm version patch;
5
+ npm publish;