@contrail/flexplm 1.0.16 → 1.0.18

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 (47) hide show
  1. package/lib/entity-processor/base-entity-processor.d.ts +30 -30
  2. package/lib/entity-processor/base-entity-processor.js +143 -143
  3. package/lib/flexplm-request.d.ts +3 -3
  4. package/lib/flexplm-request.js +34 -34
  5. package/lib/flexplm-utils.d.ts +5 -5
  6. package/lib/flexplm-utils.js +33 -33
  7. package/lib/index.d.ts +19 -15
  8. package/lib/index.js +35 -31
  9. package/lib/interfaces/interfaces.d.ts +91 -91
  10. package/lib/interfaces/interfaces.js +2 -2
  11. package/lib/interfaces/item-family-changes.d.ts +19 -19
  12. package/lib/interfaces/item-family-changes.js +49 -49
  13. package/lib/interfaces/publish-change-data.d.ts +17 -17
  14. package/lib/interfaces/publish-change-data.js +30 -30
  15. package/lib/publish/base-process-publish-assortment-callback.d.ts +8 -8
  16. package/lib/publish/base-process-publish-assortment-callback.js +19 -19
  17. package/lib/publish/base-process-publish-assortment.d.ts +57 -57
  18. package/lib/publish/base-process-publish-assortment.js +570 -563
  19. package/lib/publish/mockData.d.ts +774 -774
  20. package/lib/publish/mockData.js +3033 -3033
  21. package/lib/util/config-defaults.d.ts +6 -6
  22. package/lib/util/config-defaults.js +71 -71
  23. package/lib/util/data-converter.d.ts +22 -22
  24. package/lib/util/data-converter.js +318 -318
  25. package/lib/util/federation.d.ts +15 -15
  26. package/lib/util/federation.js +149 -149
  27. package/lib/util/flexplm-connect.d.ts +16 -16
  28. package/lib/util/flexplm-connect.js +130 -130
  29. package/lib/util/logger-config.d.ts +1 -1
  30. package/lib/util/logger-config.js +26 -26
  31. package/lib/util/map-util-spec-mockData.d.ts +0 -0
  32. package/lib/util/map-util-spec-mockData.js +203 -0
  33. package/lib/util/map-utils.d.ts +4 -3
  34. package/lib/util/map-utils.js +28 -20
  35. package/lib/util/mockData.d.ts +39 -39
  36. package/lib/util/mockData.js +100 -100
  37. package/lib/util/thumbnail-util.d.ts +15 -15
  38. package/lib/util/thumbnail-util.js +112 -112
  39. package/lib/util/type-conversion-utils-spec-mockData.d.ts +0 -0
  40. package/lib/util/type-conversion-utils-spec-mockData.js +205 -0
  41. package/lib/util/type-conversion-utils.d.ts +10 -0
  42. package/lib/util/type-conversion-utils.js +100 -0
  43. package/lib/util/type-defaults.d.ts +9 -0
  44. package/lib/util/type-defaults.js +117 -0
  45. package/lib/util/type-utils.d.ts +12 -12
  46. package/lib/util/type-utils.js +101 -101
  47. package/package.json +47 -46
@@ -1,12 +1,12 @@
1
- import { TypeClientOptions } from '@contrail/sdk';
2
- import { TypeProperty } from '@contrail/types';
3
- export declare class TypeUtils {
4
- private typesObj;
5
- constructor();
6
- getTypeById(id: any): Promise<import("@contrail/types").Type>;
7
- getByRootAndPath(options: TypeClientOptions): Promise<import("@contrail/types").Type>;
8
- static getFlexPLMTypePath(entity: any): any;
9
- getEventObjectClass(entityType: string, newData: any): string;
10
- getEntityTypeClientOptions(objectClass: string, data: any): TypeClientOptions;
11
- filterTypeProperties(type: any, newData: any): TypeProperty[];
12
- }
1
+ import { TypeClientOptions } from '@contrail/sdk';
2
+ import { TypeProperty } from '@contrail/types';
3
+ export declare class TypeUtils {
4
+ private typesObj;
5
+ constructor();
6
+ getTypeById(id: any): Promise<import("@contrail/types").Type>;
7
+ getByRootAndPath(options: TypeClientOptions): Promise<import("@contrail/types").Type>;
8
+ static getFlexPLMTypePath(entity: any): any;
9
+ getEventObjectClass(entityType: string, newData: any): string;
10
+ getEntityTypeClientOptions(objectClass: string, data: any): TypeClientOptions;
11
+ filterTypeProperties(type: any, newData: any): TypeProperty[];
12
+ }
@@ -1,101 +1,101 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeUtils = void 0;
4
- const app_framework_1 = require("@contrail/app-framework");
5
- const sdk_1 = require("@contrail/sdk");
6
- class TypeUtils {
7
- constructor() {
8
- this.typesObj = new sdk_1.Types();
9
- }
10
- async getTypeById(id) {
11
- const type = await this.typesObj.getType({
12
- id,
13
- relations: ['typeProperties', 'typeInterfaces']
14
- });
15
- return type;
16
- }
17
- async getByRootAndPath(options) {
18
- const type = await this.typesObj.getByRootAndPath(options);
19
- return type;
20
- }
21
- static getFlexPLMTypePath(entity) {
22
- return entity['flexPLMTypePath'] || entity['flexTypePath'] || '';
23
- }
24
- getEventObjectClass(entityType, newData) {
25
- let objectClass = '';
26
- if ('item' === entityType) {
27
- if (newData.roles.includes('family')) {
28
- objectClass = 'LCSProduct';
29
- }
30
- else if (newData.roles.includes('color')) {
31
- objectClass = 'LCSSKU';
32
- }
33
- }
34
- else if ('project-item' === entityType) {
35
- if (newData.roles.includes('family')) {
36
- objectClass = 'LCSProductSeasonLink';
37
- }
38
- else if (newData.roles.includes('color')) {
39
- objectClass = 'LCSSKUSeasonLink';
40
- }
41
- }
42
- else if ('color' === entityType) {
43
- objectClass = 'LCSColor';
44
- }
45
- else if ('custom-entity' === entityType) {
46
- objectClass = 'LCSRevisableEntity';
47
- }
48
- return objectClass;
49
- }
50
- getEntityTypeClientOptions(objectClass, data) {
51
- let tco;
52
- if (['LCSProduct', 'LCSSKU'].includes(objectClass)) {
53
- tco = {
54
- root: 'item'
55
- };
56
- }
57
- else if ('LCSSeason' === objectClass) {
58
- tco = {
59
- root: 'assortment'
60
- };
61
- }
62
- else if ('LCSColor' === objectClass) {
63
- tco = {
64
- root: 'color'
65
- };
66
- }
67
- else if (['LCSBusinessObject', 'LCSRevisableEntity', 'LCSLast'].includes(objectClass)) {
68
- tco = {
69
- root: 'custom-entity'
70
- };
71
- console.log('data: ' + data);
72
- }
73
- return tco;
74
- }
75
- filterTypeProperties(type, newData) {
76
- let filteredProps = type['typeProperties'];
77
- const typePath = type['typePath'];
78
- if (typePath && (typePath.startsWith('item') || typePath.startsWith('project-item'))) {
79
- if (app_framework_1.Logger.isDebugOn()) {
80
- console.debug('typePath: ' + typePath);
81
- console.debug('newData: ' + JSON.stringify(newData));
82
- }
83
- const roles = newData['roles'];
84
- if (roles) {
85
- const isFamily = roles.includes('family');
86
- console.debug('isFamily: ' + isFamily);
87
- filteredProps = filteredProps.filter(prop => {
88
- const propertyLevel = prop.propertyLevel;
89
- const applies = (isFamily && 'option' != propertyLevel) ||
90
- (!isFamily && 'family' != propertyLevel);
91
- return applies;
92
- });
93
- }
94
- else {
95
- console.error('filterTypeProperties():Entity missing role-id: ' + newData['id']);
96
- }
97
- }
98
- return filteredProps;
99
- }
100
- }
101
- exports.TypeUtils = TypeUtils;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeUtils = void 0;
4
+ const app_framework_1 = require("@contrail/app-framework");
5
+ const sdk_1 = require("@contrail/sdk");
6
+ class TypeUtils {
7
+ constructor() {
8
+ this.typesObj = new sdk_1.Types();
9
+ }
10
+ async getTypeById(id) {
11
+ const type = await this.typesObj.getType({
12
+ id,
13
+ relations: ['typeProperties', 'typeInterfaces']
14
+ });
15
+ return type;
16
+ }
17
+ async getByRootAndPath(options) {
18
+ const type = await this.typesObj.getByRootAndPath(options);
19
+ return type;
20
+ }
21
+ static getFlexPLMTypePath(entity) {
22
+ return entity['flexPLMTypePath'] || entity['flexTypePath'] || '';
23
+ }
24
+ getEventObjectClass(entityType, newData) {
25
+ let objectClass = '';
26
+ if ('item' === entityType) {
27
+ if (newData.roles.includes('family')) {
28
+ objectClass = 'LCSProduct';
29
+ }
30
+ else if (newData.roles.includes('color')) {
31
+ objectClass = 'LCSSKU';
32
+ }
33
+ }
34
+ else if ('project-item' === entityType) {
35
+ if (newData.roles.includes('family')) {
36
+ objectClass = 'LCSProductSeasonLink';
37
+ }
38
+ else if (newData.roles.includes('color')) {
39
+ objectClass = 'LCSSKUSeasonLink';
40
+ }
41
+ }
42
+ else if ('color' === entityType) {
43
+ objectClass = 'LCSColor';
44
+ }
45
+ else if ('custom-entity' === entityType) {
46
+ objectClass = 'LCSRevisableEntity';
47
+ }
48
+ return objectClass;
49
+ }
50
+ getEntityTypeClientOptions(objectClass, data) {
51
+ let tco;
52
+ if (['LCSProduct', 'LCSSKU'].includes(objectClass)) {
53
+ tco = {
54
+ root: 'item'
55
+ };
56
+ }
57
+ else if ('LCSSeason' === objectClass) {
58
+ tco = {
59
+ root: 'assortment'
60
+ };
61
+ }
62
+ else if ('LCSColor' === objectClass) {
63
+ tco = {
64
+ root: 'color'
65
+ };
66
+ }
67
+ else if (['LCSBusinessObject', 'LCSRevisableEntity', 'LCSLast'].includes(objectClass)) {
68
+ tco = {
69
+ root: 'custom-entity'
70
+ };
71
+ console.log('data: ' + data);
72
+ }
73
+ return tco;
74
+ }
75
+ filterTypeProperties(type, newData) {
76
+ let filteredProps = type['typeProperties'];
77
+ const typePath = type['typePath'];
78
+ if (typePath && (typePath.startsWith('item') || typePath.startsWith('project-item'))) {
79
+ if (app_framework_1.Logger.isDebugOn()) {
80
+ console.debug('typePath: ' + typePath);
81
+ console.debug('newData: ' + JSON.stringify(newData));
82
+ }
83
+ const roles = newData['roles'];
84
+ if (roles) {
85
+ const isFamily = roles.includes('family');
86
+ console.debug('isFamily: ' + isFamily);
87
+ filteredProps = filteredProps.filter(prop => {
88
+ const propertyLevel = prop.propertyLevel;
89
+ const applies = (isFamily && 'option' != propertyLevel) ||
90
+ (!isFamily && 'family' != propertyLevel);
91
+ return applies;
92
+ });
93
+ }
94
+ else {
95
+ console.error('filterTypeProperties():Entity missing role-id: ' + newData['id']);
96
+ }
97
+ }
98
+ return filteredProps;
99
+ }
100
+ }
101
+ exports.TypeUtils = TypeUtils;
package/package.json CHANGED
@@ -1,46 +1,47 @@
1
- {
2
- "name": "@contrail/flexplm",
3
- "version": "1.0.16",
4
- "description": "Library used for integration with flexplm.",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "scripts": {
8
- "build": "tsc",
9
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
10
- "lint": "tslint -p tsconfig.json",
11
- "test": "jest"
12
- },
13
- "keywords": [],
14
- "author": "",
15
- "license": "ISC",
16
- "devDependencies": {
17
- "@types/jest": "^29.5.2",
18
- "jest": "^29.5.0",
19
- "prettier": "^1.19.1",
20
- "ts-jest": "^29.1.1",
21
- "tslint": "^5.11.0",
22
- "tslint-config-prettier": "^1.18.0",
23
- "typescript": "^4.0.0"
24
- },
25
- "jest": {
26
- "moduleFileExtensions": [
27
- "js",
28
- "json",
29
- "ts"
30
- ],
31
- "rootDir": "src",
32
- "testRegex": ".spec.ts$",
33
- "transform": {
34
- "^.+\\.(t|j)s$": "ts-jest"
35
- },
36
- "coverageDirectory": "../coverage",
37
- "testEnvironment": "node"
38
- },
39
- "dependencies": {
40
- "@contrail/app-framework": "^1.2.0",
41
- "@contrail/sdk": "^1.2.11",
42
- "@contrail/transform-data": "^1.0.8",
43
- "axios": "^1.4.0",
44
- "p-limit": "^3.1.0"
45
- }
46
- }
1
+ {
2
+ "name": "@contrail/flexplm",
3
+ "version": "1.0.18",
4
+ "description": "Library used for integration with flexplm.",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
10
+ "lint": "tslint -p tsconfig.json",
11
+ "test": "jest",
12
+ "test-watch": "jest --watch"
13
+ },
14
+ "keywords": [],
15
+ "author": "",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "@types/jest": "^29.5.2",
19
+ "jest": "^29.5.0",
20
+ "prettier": "^1.19.1",
21
+ "ts-jest": "^29.1.1",
22
+ "tslint": "^5.11.0",
23
+ "tslint-config-prettier": "^1.18.0",
24
+ "typescript": "^4.0.0"
25
+ },
26
+ "jest": {
27
+ "moduleFileExtensions": [
28
+ "js",
29
+ "json",
30
+ "ts"
31
+ ],
32
+ "rootDir": "src",
33
+ "testRegex": ".spec.ts$",
34
+ "transform": {
35
+ "^.+\\.(t|j)s$": "ts-jest"
36
+ },
37
+ "coverageDirectory": "../coverage",
38
+ "testEnvironment": "node"
39
+ },
40
+ "dependencies": {
41
+ "@contrail/app-framework": "^1.2.0",
42
+ "@contrail/sdk": "^1.2.11",
43
+ "@contrail/transform-data": "^1.0.9",
44
+ "axios": "^1.4.0",
45
+ "p-limit": "^3.1.0"
46
+ }
47
+ }