@contrail/flexplm 1.2.1 → 1.3.0-alpha.3

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 (57) hide show
  1. package/.claude/settings.local.json +1 -2
  2. package/.github/pull_request_template.md +31 -31
  3. package/.github/workflows/flexplm-lib.yml +27 -27
  4. package/lib/entity-processor/base-entity-processor.js +16 -2
  5. package/lib/entity-processor/base-entity-processor.spec.js +124 -0
  6. package/lib/util/flexplm-connect.d.ts +5 -1
  7. package/lib/util/flexplm-connect.js +8 -3
  8. package/lib/util/flexplm-connect.spec.d.ts +1 -0
  9. package/lib/util/flexplm-connect.spec.js +88 -0
  10. package/lib/util/thumbnail-util.d.ts +9 -0
  11. package/lib/util/thumbnail-util.js +88 -0
  12. package/lib/util/thumbnail-util.spec.js +156 -0
  13. package/lib/util/type-conversion-utils-spec-mockData.js +18 -0
  14. package/lib/util/type-conversion-utils.d.ts +2 -0
  15. package/lib/util/type-conversion-utils.js +43 -0
  16. package/lib/util/type-conversion-utils.spec.js +160 -0
  17. package/package.json +1 -1
  18. package/publish.bat +4 -4
  19. package/publish.sh +4 -4
  20. package/src/entity-processor/base-entity-processor.spec.ts +157 -0
  21. package/src/entity-processor/base-entity-processor.ts +21 -2
  22. package/src/flexplm-request.ts +28 -28
  23. package/src/flexplm-utils.spec.ts +27 -27
  24. package/src/flexplm-utils.ts +29 -29
  25. package/src/index.ts +21 -21
  26. package/src/interfaces/item-family-changes.ts +66 -66
  27. package/src/interfaces/publish-change-data.ts +42 -42
  28. package/src/publish/base-process-publish-assortment-callback.ts +50 -50
  29. package/src/transform/identifier-conversion-spec-mockData.ts +495 -495
  30. package/src/transform/identifier-conversion.spec.ts +353 -353
  31. package/src/transform/identifier-conversion.ts +281 -281
  32. package/src/util/config-defaults.spec.ts +350 -350
  33. package/src/util/config-defaults.ts +92 -92
  34. package/src/util/data-converter-spec-mockData.ts +230 -230
  35. package/src/util/error-response-object.spec.ts +115 -115
  36. package/src/util/error-response-object.ts +49 -49
  37. package/src/util/federation.ts +172 -172
  38. package/src/util/flexplm-connect.spec.ts +132 -0
  39. package/src/util/flexplm-connect.ts +14 -5
  40. package/src/util/logger-config.ts +19 -19
  41. package/src/util/map-util-spec-mockData.ts +230 -230
  42. package/src/util/map-utils.spec.ts +102 -102
  43. package/src/util/map-utils.ts +40 -40
  44. package/src/util/mockData.ts +97 -97
  45. package/src/util/thumbnail-util.spec.ts +190 -0
  46. package/src/util/thumbnail-util.ts +109 -1
  47. package/src/util/type-conversion-utils-spec-mockData.ts +18 -0
  48. package/src/util/type-conversion-utils.spec.ts +184 -0
  49. package/src/util/type-conversion-utils.ts +75 -0
  50. package/src/util/type-defaults.spec.ts +668 -668
  51. package/src/util/type-defaults.ts +280 -280
  52. package/src/util/type-utils.spec.ts +227 -227
  53. package/src/util/type-utils.ts +144 -144
  54. package/tsconfig.json +28 -26
  55. package/tslint.json +57 -57
  56. package/scripts/output.png +0 -0
  57. package/scripts/test-get-request.ts +0 -35
@@ -1,227 +1,227 @@
1
- import { TypeUtils } from './type-utils';
2
-
3
- describe('TypeUtils.getEventObjectClass() tests', () =>{
4
-
5
- const tu = new TypeUtils();
6
-
7
- it('LCSProduct', () =>{
8
- const entityType = 'item';
9
- const newData = {
10
- roles: ['family']
11
- };
12
-
13
- const objectClass = tu.getEventObjectClass(entityType, newData);
14
-
15
- expect(objectClass).toEqual('LCSProduct');
16
- });
17
-
18
- it('LCSSKU', () =>{
19
- const entityType = 'item';
20
- const newData = {
21
- roles: ['color']
22
- };
23
-
24
- const objectClass = tu.getEventObjectClass(entityType, newData);
25
-
26
- expect(objectClass).toEqual('LCSSKU');
27
- });
28
-
29
- it('LCSProductSeasonLink', () =>{
30
- const entityType = 'project-item';
31
- const newData = {
32
- roles: ['family']
33
- };
34
-
35
- const objectClass = tu.getEventObjectClass(entityType, newData);
36
-
37
- expect(objectClass).toEqual('LCSProductSeasonLink');
38
- });
39
-
40
- it('LCSSKUSeasonLink', () =>{
41
- const entityType = 'project-item';
42
- const newData = {
43
- roles: ['color']
44
- };
45
-
46
- const objectClass = tu.getEventObjectClass(entityType, newData);
47
-
48
- expect(objectClass).toEqual('LCSSKUSeasonLink');
49
- });
50
- it('LCSColor', () =>{
51
- const entityType = 'color';
52
- const newData = {};
53
-
54
- const objectClass = tu.getEventObjectClass(entityType, newData);
55
-
56
- expect(objectClass).toEqual('LCSColor');
57
- });
58
-
59
- it('LCSRevisableEntity', () =>{
60
- const entityType = 'custom-entity';
61
- const newData = {};
62
-
63
- const objectClass = tu.getEventObjectClass(entityType, newData);
64
-
65
- expect(objectClass).toEqual('LCSRevisableEntity');
66
- });
67
-
68
- });
69
- describe('filterProperties-item', () => {
70
-
71
- const itemType = {
72
- typePath: 'item'
73
- };
74
- itemType['typeProperties'] = [
75
- {
76
- id: 'H4NazLloHdUVhc71',
77
- slug: 'null',
78
- propertyLevel: null
79
- },
80
- {
81
- id: 'H4NazLloHdUVhc71',
82
- slug: 'family',
83
- propertyLevel: 'family'
84
- },
85
- {
86
- id: 'H4NazLloHdUVhc71',
87
- slug: 'option',
88
- propertyLevel: 'option'
89
- },
90
- {
91
- id: 'H4NazLloHdUVhc71',
92
- slug: 'overridable',
93
- propertyLevel: 'overridable'
94
- },
95
- {
96
- id: 'H4NazLloHdUVhc71',
97
- slug: 'all',
98
- propertyLevel: 'all'
99
- },
100
- ];
101
- const tu = new TypeUtils();
102
-
103
- it('item-family', () =>{
104
- const len = 4;
105
- const newData = {
106
- roles: ['family']
107
- };
108
-
109
- const filteredProps = tu.filterTypeProperties(itemType, newData);
110
- expect(filteredProps.length).toEqual(len);
111
- });
112
-
113
- it('item-option', () =>{
114
- const len = 4;
115
- const newData = {
116
- roles: ['option']
117
- };
118
-
119
- const filteredProps = tu.filterTypeProperties(itemType, newData);
120
- expect(filteredProps.length).toEqual(len);
121
- });
122
-
123
- it('item-no-roles', () =>{
124
- const len = 5;
125
- const newData = {
126
- };
127
-
128
- const filteredProps = tu.filterTypeProperties(itemType, newData);
129
- expect(filteredProps.length).toEqual(len);
130
- });
131
- });
132
-
133
- //project-item
134
- describe('filterProperties-project-item', () => {
135
-
136
- const projectItemType = {
137
- typePath: 'project-item'
138
- };
139
- projectItemType['typeProperties'] = [
140
- {
141
- id: 'H4NazLloHdUVhc71',
142
- slug: 'null',
143
- propertyLevel: null
144
- },
145
- {
146
- id: 'H4NazLloHdUVhc71',
147
- slug: 'family',
148
- propertyLevel: 'family'
149
- },
150
- {
151
- id: 'H4NazLloHdUVhc71',
152
- slug: 'option',
153
- propertyLevel: 'option'
154
- },
155
- {
156
- id: 'H4NazLloHdUVhc71',
157
- slug: 'overridable',
158
- propertyLevel: 'overridable'
159
- },
160
- {
161
- id: 'H4NazLloHdUVhc71',
162
- slug: 'all',
163
- propertyLevel: 'all'
164
- },
165
- ];
166
- const tu = new TypeUtils();
167
-
168
- it('item-family', () =>{
169
- const len = 4;
170
- const newData = {
171
- roles: ['family']
172
- };
173
-
174
- const filteredProps = tu.filterTypeProperties(projectItemType, newData);
175
- expect(filteredProps.length).toEqual(len);
176
- });
177
-
178
- it('item-option', () =>{
179
- const len = 4;
180
- const newData = {
181
- roles: ['option']
182
- };
183
-
184
- const filteredProps = tu.filterTypeProperties(projectItemType, newData);
185
- expect(filteredProps.length).toEqual(len);
186
- });
187
- });
188
-
189
- //color
190
- describe('filterProperties-color', () => {
191
- const colorType = {
192
- typePath: 'color'
193
- };
194
- colorType['typeProperties'] = [
195
- {
196
- id: 'H4NazLloHdUVhc71',
197
- slug: 'null',
198
- },
199
- {
200
- id: 'H4NazLloHdUVhc71',
201
- slug: 'family',
202
- },
203
- {
204
- id: 'H4NazLloHdUVhc71',
205
- slug: 'option',
206
- },
207
- {
208
- id: 'H4NazLloHdUVhc71',
209
- slug: 'overridable',
210
- },
211
- {
212
- id: 'H4NazLloHdUVhc71',
213
- slug: 'all',
214
- },
215
- ];
216
- const tu = new TypeUtils();
217
-
218
- it('color', () =>{
219
- const len = 5;
220
- const newData = {
221
- roles: ['family']
222
- };
223
-
224
- const filteredProps = tu.filterTypeProperties(colorType, newData);
225
- expect(filteredProps.length).toEqual(len);
226
- });
227
- });
1
+ import { TypeUtils } from './type-utils';
2
+
3
+ describe('TypeUtils.getEventObjectClass() tests', () =>{
4
+
5
+ const tu = new TypeUtils();
6
+
7
+ it('LCSProduct', () =>{
8
+ const entityType = 'item';
9
+ const newData = {
10
+ roles: ['family']
11
+ };
12
+
13
+ const objectClass = tu.getEventObjectClass(entityType, newData);
14
+
15
+ expect(objectClass).toEqual('LCSProduct');
16
+ });
17
+
18
+ it('LCSSKU', () =>{
19
+ const entityType = 'item';
20
+ const newData = {
21
+ roles: ['color']
22
+ };
23
+
24
+ const objectClass = tu.getEventObjectClass(entityType, newData);
25
+
26
+ expect(objectClass).toEqual('LCSSKU');
27
+ });
28
+
29
+ it('LCSProductSeasonLink', () =>{
30
+ const entityType = 'project-item';
31
+ const newData = {
32
+ roles: ['family']
33
+ };
34
+
35
+ const objectClass = tu.getEventObjectClass(entityType, newData);
36
+
37
+ expect(objectClass).toEqual('LCSProductSeasonLink');
38
+ });
39
+
40
+ it('LCSSKUSeasonLink', () =>{
41
+ const entityType = 'project-item';
42
+ const newData = {
43
+ roles: ['color']
44
+ };
45
+
46
+ const objectClass = tu.getEventObjectClass(entityType, newData);
47
+
48
+ expect(objectClass).toEqual('LCSSKUSeasonLink');
49
+ });
50
+ it('LCSColor', () =>{
51
+ const entityType = 'color';
52
+ const newData = {};
53
+
54
+ const objectClass = tu.getEventObjectClass(entityType, newData);
55
+
56
+ expect(objectClass).toEqual('LCSColor');
57
+ });
58
+
59
+ it('LCSRevisableEntity', () =>{
60
+ const entityType = 'custom-entity';
61
+ const newData = {};
62
+
63
+ const objectClass = tu.getEventObjectClass(entityType, newData);
64
+
65
+ expect(objectClass).toEqual('LCSRevisableEntity');
66
+ });
67
+
68
+ });
69
+ describe('filterProperties-item', () => {
70
+
71
+ const itemType = {
72
+ typePath: 'item'
73
+ };
74
+ itemType['typeProperties'] = [
75
+ {
76
+ id: 'H4NazLloHdUVhc71',
77
+ slug: 'null',
78
+ propertyLevel: null
79
+ },
80
+ {
81
+ id: 'H4NazLloHdUVhc71',
82
+ slug: 'family',
83
+ propertyLevel: 'family'
84
+ },
85
+ {
86
+ id: 'H4NazLloHdUVhc71',
87
+ slug: 'option',
88
+ propertyLevel: 'option'
89
+ },
90
+ {
91
+ id: 'H4NazLloHdUVhc71',
92
+ slug: 'overridable',
93
+ propertyLevel: 'overridable'
94
+ },
95
+ {
96
+ id: 'H4NazLloHdUVhc71',
97
+ slug: 'all',
98
+ propertyLevel: 'all'
99
+ },
100
+ ];
101
+ const tu = new TypeUtils();
102
+
103
+ it('item-family', () =>{
104
+ const len = 4;
105
+ const newData = {
106
+ roles: ['family']
107
+ };
108
+
109
+ const filteredProps = tu.filterTypeProperties(itemType, newData);
110
+ expect(filteredProps.length).toEqual(len);
111
+ });
112
+
113
+ it('item-option', () =>{
114
+ const len = 4;
115
+ const newData = {
116
+ roles: ['option']
117
+ };
118
+
119
+ const filteredProps = tu.filterTypeProperties(itemType, newData);
120
+ expect(filteredProps.length).toEqual(len);
121
+ });
122
+
123
+ it('item-no-roles', () =>{
124
+ const len = 5;
125
+ const newData = {
126
+ };
127
+
128
+ const filteredProps = tu.filterTypeProperties(itemType, newData);
129
+ expect(filteredProps.length).toEqual(len);
130
+ });
131
+ });
132
+
133
+ //project-item
134
+ describe('filterProperties-project-item', () => {
135
+
136
+ const projectItemType = {
137
+ typePath: 'project-item'
138
+ };
139
+ projectItemType['typeProperties'] = [
140
+ {
141
+ id: 'H4NazLloHdUVhc71',
142
+ slug: 'null',
143
+ propertyLevel: null
144
+ },
145
+ {
146
+ id: 'H4NazLloHdUVhc71',
147
+ slug: 'family',
148
+ propertyLevel: 'family'
149
+ },
150
+ {
151
+ id: 'H4NazLloHdUVhc71',
152
+ slug: 'option',
153
+ propertyLevel: 'option'
154
+ },
155
+ {
156
+ id: 'H4NazLloHdUVhc71',
157
+ slug: 'overridable',
158
+ propertyLevel: 'overridable'
159
+ },
160
+ {
161
+ id: 'H4NazLloHdUVhc71',
162
+ slug: 'all',
163
+ propertyLevel: 'all'
164
+ },
165
+ ];
166
+ const tu = new TypeUtils();
167
+
168
+ it('item-family', () =>{
169
+ const len = 4;
170
+ const newData = {
171
+ roles: ['family']
172
+ };
173
+
174
+ const filteredProps = tu.filterTypeProperties(projectItemType, newData);
175
+ expect(filteredProps.length).toEqual(len);
176
+ });
177
+
178
+ it('item-option', () =>{
179
+ const len = 4;
180
+ const newData = {
181
+ roles: ['option']
182
+ };
183
+
184
+ const filteredProps = tu.filterTypeProperties(projectItemType, newData);
185
+ expect(filteredProps.length).toEqual(len);
186
+ });
187
+ });
188
+
189
+ //color
190
+ describe('filterProperties-color', () => {
191
+ const colorType = {
192
+ typePath: 'color'
193
+ };
194
+ colorType['typeProperties'] = [
195
+ {
196
+ id: 'H4NazLloHdUVhc71',
197
+ slug: 'null',
198
+ },
199
+ {
200
+ id: 'H4NazLloHdUVhc71',
201
+ slug: 'family',
202
+ },
203
+ {
204
+ id: 'H4NazLloHdUVhc71',
205
+ slug: 'option',
206
+ },
207
+ {
208
+ id: 'H4NazLloHdUVhc71',
209
+ slug: 'overridable',
210
+ },
211
+ {
212
+ id: 'H4NazLloHdUVhc71',
213
+ slug: 'all',
214
+ },
215
+ ];
216
+ const tu = new TypeUtils();
217
+
218
+ it('color', () =>{
219
+ const len = 5;
220
+ const newData = {
221
+ roles: ['family']
222
+ };
223
+
224
+ const filteredProps = tu.filterTypeProperties(colorType, newData);
225
+ expect(filteredProps.length).toEqual(len);
226
+ });
227
+ });