@contrail/flexplm 1.3.1-alpha.763fca8 → 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.
- package/.github/pull_request_template.md +31 -0
- package/.github/workflows/flexplm-lib.yml +27 -0
- package/.github/workflows/publish-to-npm.yml +121 -0
- package/CHANGELOG.md +32 -0
- package/lib/entity-processor/base-entity-processor.d.ts +0 -47
- package/lib/entity-processor/base-entity-processor.js +0 -53
- package/lib/entity-processor/base-entity-processor.spec.js +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/publish/base-process-publish-assortment.d.ts +0 -25
- package/lib/publish/base-process-publish-assortment.js +6 -60
- package/lib/publish/base-process-publish-assortment.spec.js +4 -22
- package/lib/publish/mockData.js +0 -5
- package/lib/transform/identifier-conversion-spec-mockData.js +6 -34
- package/lib/transform/identifier-conversion.d.ts +0 -36
- package/lib/transform/identifier-conversion.js +0 -36
- package/lib/transform/identifier-conversion.spec.js +0 -4
- package/lib/util/config-defaults.js +0 -3
- package/lib/util/config-defaults.spec.js +0 -9
- package/lib/util/data-converter-spec-mockData.js +3 -17
- package/lib/util/data-converter.d.ts +0 -97
- package/lib/util/data-converter.js +4 -127
- package/lib/util/data-converter.spec.js +0 -2
- package/lib/util/error-response-object.d.ts +0 -5
- package/lib/util/error-response-object.js +0 -7
- package/lib/util/event-short-message-status.js +0 -1
- package/lib/util/federation.js +0 -8
- package/lib/util/flexplm-connect.d.ts +0 -7
- package/lib/util/flexplm-connect.js +0 -14
- package/lib/util/logger-config.js +0 -1
- package/lib/util/map-util-spec-mockData.js +3 -17
- package/lib/util/map-utils.d.ts +0 -27
- package/lib/util/map-utils.js +0 -27
- package/lib/util/thumbnail-util.d.ts +0 -21
- package/lib/util/thumbnail-util.js +1 -28
- package/lib/util/thumbnail-util.spec.js +0 -6
- package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
- package/lib/util/type-conversion-utils.d.ts +0 -140
- package/lib/util/type-conversion-utils.js +0 -143
- package/lib/util/type-defaults.d.ts +0 -58
- package/lib/util/type-defaults.js +0 -58
- package/lib/util/type-defaults.spec.js +5 -5
- package/lib/util/type-utils.d.ts +0 -21
- package/lib/util/type-utils.js +0 -23
- package/lib/util/type-utils.spec.js +0 -2
- package/package.json +6 -21
- package/publish.bat +5 -0
- package/publish.sh +5 -0
- package/src/entity-processor/base-entity-processor.spec.ts +460 -0
- package/src/entity-processor/base-entity-processor.ts +515 -0
- package/src/flexplm-request.ts +28 -0
- package/src/flexplm-utils.spec.ts +27 -0
- package/src/flexplm-utils.ts +29 -0
- package/src/index.ts +22 -0
- package/src/interfaces/interfaces.ts +122 -0
- package/src/interfaces/item-family-changes.ts +67 -0
- package/src/interfaces/publish-change-data.ts +43 -0
- package/src/publish/base-process-publish-assortment-callback.ts +50 -0
- package/src/publish/base-process-publish-assortment.spec.ts +1992 -0
- package/src/publish/base-process-publish-assortment.ts +1134 -0
- package/src/publish/mockData.ts +4561 -0
- package/src/transform/identifier-conversion-spec-mockData.ts +496 -0
- package/src/transform/identifier-conversion.spec.ts +354 -0
- package/src/transform/identifier-conversion.ts +282 -0
- package/src/util/config-defaults.spec.ts +350 -0
- package/src/util/config-defaults.ts +93 -0
- package/src/util/data-converter-spec-mockData.ts +231 -0
- package/src/util/data-converter.spec.ts +1041 -0
- package/src/util/data-converter.ts +764 -0
- package/src/util/error-response-object.spec.ts +116 -0
- package/src/util/error-response-object.ts +50 -0
- package/src/util/event-short-message-status.ts +22 -0
- package/src/util/federation.ts +172 -0
- package/src/util/flexplm-connect.spec.ts +132 -0
- package/src/util/flexplm-connect.ts +208 -0
- package/src/util/logger-config.ts +20 -0
- package/src/util/map-util-spec-mockData.ts +231 -0
- package/src/util/map-utils.spec.ts +103 -0
- package/src/util/map-utils.ts +41 -0
- package/src/util/mockData.ts +101 -0
- package/src/util/thumbnail-util.spec.ts +508 -0
- package/src/util/thumbnail-util.ts +272 -0
- package/src/util/type-conversion-utils-spec-mockData.ts +271 -0
- package/src/util/type-conversion-utils.spec.ts +968 -0
- package/src/util/type-conversion-utils.ts +460 -0
- package/src/util/type-defaults.spec.ts +669 -0
- package/src/util/type-defaults.ts +281 -0
- package/src/util/type-utils.spec.ts +227 -0
- package/src/util/type-utils.ts +144 -0
- package/tsconfig.json +24 -0
- package/tslint.json +57 -0
- package/lib/cli/commands/compile.d.ts +0 -1
- package/lib/cli/commands/compile.js +0 -71
- package/lib/cli/commands/compile.spec.d.ts +0 -1
- package/lib/cli/commands/compile.spec.js +0 -80
- package/lib/cli/commands/create.d.ts +0 -1
- package/lib/cli/commands/create.js +0 -75
- package/lib/cli/commands/create.spec.d.ts +0 -1
- package/lib/cli/commands/create.spec.js +0 -78
- package/lib/cli/commands/upload.d.ts +0 -10
- package/lib/cli/commands/upload.js +0 -219
- package/lib/cli/commands/upload.spec.d.ts +0 -1
- package/lib/cli/commands/upload.spec.js +0 -88
- package/lib/cli/index.d.ts +0 -2
- package/lib/cli/index.js +0 -64
- package/lib/cli/index.spec.d.ts +0 -1
- package/lib/cli/index.spec.js +0 -79
- package/lib/cli/template/mapping-template.ts.template +0 -18
- package/lib/interfaces/mapping-file.d.ts +0 -429
- package/lib/interfaces/mapping-file.js +0 -2
- package/scripts/copy-template.js +0 -10
|
@@ -4,12 +4,6 @@ exports.TypeDefaults = void 0;
|
|
|
4
4
|
class TypeDefaults {
|
|
5
5
|
constructor() {
|
|
6
6
|
}
|
|
7
|
-
/**Takes in full entity and returs the default FlexPLM
|
|
8
|
-
* object class.
|
|
9
|
-
*
|
|
10
|
-
* @param entity
|
|
11
|
-
* @returns string
|
|
12
|
-
*/
|
|
13
7
|
static getDefaultObjectClass(entity) {
|
|
14
8
|
const entityType = this.getEntityType(entity);
|
|
15
9
|
let objectClass = '';
|
|
@@ -48,12 +42,6 @@ class TypeDefaults {
|
|
|
48
42
|
}
|
|
49
43
|
return objectClass;
|
|
50
44
|
}
|
|
51
|
-
/**Takes in full entity and returns the default FlexPLM type path
|
|
52
|
-
* object class.
|
|
53
|
-
*
|
|
54
|
-
* @param entity
|
|
55
|
-
* @returns string
|
|
56
|
-
*/
|
|
57
45
|
static getDefaultObjectTypePath(entity) {
|
|
58
46
|
let typePath = '';
|
|
59
47
|
const entityType = this.getEntityType(entity);
|
|
@@ -82,13 +70,6 @@ class TypeDefaults {
|
|
|
82
70
|
}
|
|
83
71
|
return typePath;
|
|
84
72
|
}
|
|
85
|
-
/**Takes in full entity and returns the slugs for the default identifier
|
|
86
|
-
* properties. These properties are used when searching for an entity
|
|
87
|
-
* object class.
|
|
88
|
-
*
|
|
89
|
-
* @param entity
|
|
90
|
-
* @returns string[]
|
|
91
|
-
*/
|
|
92
73
|
static getDefaultIdentifierProperties(entity) {
|
|
93
74
|
const identifierProps = [];
|
|
94
75
|
const entityType = this.getEntityType(entity);
|
|
@@ -114,13 +95,6 @@ class TypeDefaults {
|
|
|
114
95
|
}
|
|
115
96
|
return identifierProps;
|
|
116
97
|
}
|
|
117
|
-
/** Takes in full entity and returns the slugs for informational
|
|
118
|
-
* properties. These properties are helpful when debugging issues
|
|
119
|
-
* where the identifier properties don't find a match.
|
|
120
|
-
*
|
|
121
|
-
* @param entity
|
|
122
|
-
* @returns string[]
|
|
123
|
-
*/
|
|
124
98
|
static getDefaultInformationalProperties(entity) {
|
|
125
99
|
const entityType = this.getEntityType(entity);
|
|
126
100
|
let properties = [];
|
|
@@ -137,12 +111,6 @@ class TypeDefaults {
|
|
|
137
111
|
}
|
|
138
112
|
return properties;
|
|
139
113
|
}
|
|
140
|
-
/** Returns the VibeIQ entity type from an entity.
|
|
141
|
-
* Throws error if it can't determine the entity type
|
|
142
|
-
*
|
|
143
|
-
* @param entity
|
|
144
|
-
* @returns string
|
|
145
|
-
*/
|
|
146
114
|
static getEntityType(entity) {
|
|
147
115
|
let entityType = entity['entityType'];
|
|
148
116
|
if (!entityType) {
|
|
@@ -159,12 +127,6 @@ class TypeDefaults {
|
|
|
159
127
|
}
|
|
160
128
|
return entityType;
|
|
161
129
|
}
|
|
162
|
-
/**Takes in full object and returns the default VibeIQ
|
|
163
|
-
* entity class.
|
|
164
|
-
*
|
|
165
|
-
* @param entity
|
|
166
|
-
* @returns string
|
|
167
|
-
*/
|
|
168
130
|
static getDefaultEntityClass(object) {
|
|
169
131
|
let entityClass = '';
|
|
170
132
|
let objectClass = TypeDefaults.getObjectClass(object);
|
|
@@ -187,12 +149,6 @@ class TypeDefaults {
|
|
|
187
149
|
throw Error(TypeDefaults.NO_OBJECT_CLASS);
|
|
188
150
|
return entityClass;
|
|
189
151
|
}
|
|
190
|
-
/**Takes in full object and returns the default VibeIQ type path
|
|
191
|
-
* object class.
|
|
192
|
-
*
|
|
193
|
-
* @param object
|
|
194
|
-
* @returns string
|
|
195
|
-
*/
|
|
196
152
|
static getDefaultEntityTypePath(object) {
|
|
197
153
|
let typePath = '';
|
|
198
154
|
const objectClass = TypeDefaults.getObjectClass(object);
|
|
@@ -217,13 +173,6 @@ class TypeDefaults {
|
|
|
217
173
|
throw Error(TypeDefaults.NO_TYPE_PATH);
|
|
218
174
|
return typePath;
|
|
219
175
|
}
|
|
220
|
-
/**Takes in full entity and returns the slugs for the default identifier
|
|
221
|
-
* properties. These properties are used when searching for an entity
|
|
222
|
-
* object class.
|
|
223
|
-
*
|
|
224
|
-
* @param entity
|
|
225
|
-
* @returns string[]
|
|
226
|
-
*/
|
|
227
176
|
static getDefaultIdentifierPropertiesFromObject(object) {
|
|
228
177
|
const identifierProps = [];
|
|
229
178
|
const objectClass = TypeDefaults.getObjectClass(object);
|
|
@@ -248,13 +197,6 @@ class TypeDefaults {
|
|
|
248
197
|
}
|
|
249
198
|
return identifierProps;
|
|
250
199
|
}
|
|
251
|
-
/** Takes in full object and returns the slugs for informational
|
|
252
|
-
* properties. These properties are helpful when debugging issues
|
|
253
|
-
* where the identifier properties don't find a match.
|
|
254
|
-
*
|
|
255
|
-
* @param object
|
|
256
|
-
* @returns string[]
|
|
257
|
-
*/
|
|
258
200
|
static getDefaultInformationalPropertiesFromObject(object) {
|
|
259
201
|
const objectClass = TypeDefaults.getObjectClass(object);
|
|
260
202
|
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
|
-
});
|
|
307
|
+
});
|
|
308
308
|
describe('getDefaultEntityClass', () => {
|
|
309
309
|
it('item - LCSProduct', () => {
|
|
310
310
|
const object = {
|
|
@@ -369,7 +369,7 @@ describe('Type Defaults', () => {
|
|
|
369
369
|
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
370
370
|
expect(entityClass).toBe('custom-entity');
|
|
371
371
|
});
|
|
372
|
-
});
|
|
372
|
+
});
|
|
373
373
|
describe('getDefaultEntityTypePath', () => {
|
|
374
374
|
it('LCSProduct', () => {
|
|
375
375
|
const object = {
|
|
@@ -420,7 +420,7 @@ describe('Type Defaults', () => {
|
|
|
420
420
|
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
421
421
|
expect(typePath).toBe('assortment');
|
|
422
422
|
});
|
|
423
|
-
});
|
|
423
|
+
});
|
|
424
424
|
describe('getDefaultIdentifierPropertiesFromObject', () => {
|
|
425
425
|
it('LCSProduct', () => {
|
|
426
426
|
const object = {
|
|
@@ -478,7 +478,7 @@ describe('Type Defaults', () => {
|
|
|
478
478
|
expect(defaultIdentifiers).toContain('name');
|
|
479
479
|
expect(defaultIdentifiers).toHaveLength(1);
|
|
480
480
|
});
|
|
481
|
-
});
|
|
481
|
+
});
|
|
482
482
|
describe('getDefaultInformationalPropertiesFromObject', () => {
|
|
483
483
|
it('LCSProduct', () => {
|
|
484
484
|
const object = {
|
|
@@ -512,5 +512,5 @@ describe('Type Defaults', () => {
|
|
|
512
512
|
expect(defaultIdentifiers).toContain('name');
|
|
513
513
|
expect(defaultIdentifiers).toHaveLength(1);
|
|
514
514
|
});
|
|
515
|
-
});
|
|
515
|
+
});
|
|
516
516
|
});
|
package/lib/util/type-utils.d.ts
CHANGED
|
@@ -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
|
}
|
package/lib/util/type-utils.js
CHANGED
|
@@ -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.3.1-alpha.
|
|
3
|
+
"version": "1.3.1-alpha.8bc920d",
|
|
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
|
|
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": "^
|
|
59
|
-
"@contrail/sdk": "^1.
|
|
60
|
-
"@contrail/transform-data": "^1.3
|
|
61
|
-
"@contrail/util": "^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