@configura/web-api 1.4.0 → 1.5.0-alpha.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 (61) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/CatalogueAPI.d.ts +504 -504
  4. package/dist/CatalogueAPI.js +250 -248
  5. package/dist/CfgMeasure.d.ts +32 -32
  6. package/dist/CfgMeasure.js +30 -30
  7. package/dist/CfgProduct.d.ts +217 -217
  8. package/dist/CfgProduct.js +636 -636
  9. package/dist/index.d.ts +18 -16
  10. package/dist/index.js +18 -16
  11. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  12. package/dist/material/CfgMaterialMapping.js +181 -181
  13. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  14. package/dist/material/CfgMtrlApplication.js +43 -43
  15. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  16. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  17. package/dist/material/CfgMtrlSource.d.ts +19 -19
  18. package/dist/material/CfgMtrlSource.js +40 -40
  19. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  20. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  21. package/dist/productConfiguration/CfgFeature.d.ts +164 -160
  22. package/dist/productConfiguration/CfgFeature.js +597 -593
  23. package/dist/productConfiguration/CfgOption.d.ts +128 -128
  24. package/dist/productConfiguration/CfgOption.js +394 -394
  25. package/dist/productConfiguration/CfgProductConfiguration.d.ts +120 -120
  26. package/dist/productConfiguration/CfgProductConfiguration.js +307 -307
  27. package/dist/productConfiguration/filters.d.ts +15 -15
  28. package/dist/productConfiguration/filters.js +67 -67
  29. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  30. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  31. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  32. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  33. package/dist/productLoader.d.ts +33 -33
  34. package/dist/productLoader.js +49 -49
  35. package/dist/tasks/TaskHandler.d.ts +79 -0
  36. package/dist/tasks/TaskHandler.js +264 -0
  37. package/dist/tasks/formats.d.ts +7 -0
  38. package/dist/tasks/formats.js +8 -0
  39. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  40. package/dist/tests/testData/collectorForTest.js +195 -195
  41. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  42. package/dist/tests/testData/dummyProductForTest.js +36 -36
  43. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
  44. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +348 -348
  45. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  46. package/dist/tests/testData/testDataCachedGetProduct.js +196 -196
  47. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  48. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  49. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  50. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  51. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  52. package/dist/tests/testData/testDataProductAggregatedPrice.js +198 -198
  53. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  54. package/dist/tests/testData/testDataUpcharge.js +151 -151
  55. package/dist/utilitiesCatalogueData.d.ts +25 -25
  56. package/dist/utilitiesCatalogueData.js +64 -64
  57. package/dist/utilitiesCataloguePermission.d.ts +39 -39
  58. package/dist/utilitiesCataloguePermission.js +84 -84
  59. package/dist/utilitiesNumericValues.d.ts +24 -24
  60. package/dist/utilitiesNumericValues.js +109 -109
  61. package/package.json +3 -3
@@ -1,348 +1,348 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { CfgProduct } from "../../CfgProduct";
11
- import { Collector } from "./collectorForTest";
12
- import { dummyCatId } from "./dummyProductForTest";
13
- const A = () => ({
14
- uuid: "A",
15
- unit: "m",
16
- features: [
17
- {
18
- code: "featureA",
19
- description: "",
20
- numericOrder: false,
21
- options: [
22
- {
23
- code: "optionA",
24
- description: "",
25
- additionalProductRefs: [
26
- { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
27
- { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
28
- ],
29
- },
30
- {
31
- code: "optionB",
32
- description: "",
33
- },
34
- {
35
- code: "optionC",
36
- description: "",
37
- additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
38
- },
39
- ],
40
- },
41
- {
42
- code: "featureX",
43
- description: "",
44
- numericOrder: false,
45
- options: [
46
- {
47
- code: "optionA",
48
- description: "",
49
- },
50
- {
51
- code: "optionB",
52
- description: "",
53
- },
54
- {
55
- code: "optionC",
56
- description: "",
57
- },
58
- ],
59
- },
60
- {
61
- code: "featureNotUsed",
62
- description: "",
63
- numericOrder: false,
64
- options: [
65
- {
66
- code: "optionA",
67
- description: "",
68
- },
69
- {
70
- code: "optionB",
71
- description: "",
72
- },
73
- ],
74
- },
75
- {
76
- code: "featureOptionCSelectedAtStart",
77
- description: "",
78
- numericOrder: false,
79
- options: [
80
- {
81
- code: "optionA",
82
- description: "",
83
- },
84
- {
85
- code: "optionB",
86
- description: "",
87
- },
88
- {
89
- code: "optionC",
90
- description: "",
91
- },
92
- ],
93
- },
94
- {
95
- code: "featureSelectMany",
96
- description: "",
97
- numericOrder: false,
98
- options: [
99
- {
100
- code: "optionA",
101
- description: "",
102
- },
103
- {
104
- code: "optionB",
105
- description: "",
106
- },
107
- {
108
- code: "optionC",
109
- description: "",
110
- },
111
- ],
112
- },
113
- ],
114
- productData: {
115
- sku: "A",
116
- partsData: {
117
- basePrice: 0,
118
- currency: "",
119
- listPrice: 0,
120
- pkgCount: 0,
121
- styleNr: "",
122
- selOptions: [
123
- {
124
- code: "!~!",
125
- next: {
126
- optionA: {
127
- code: "optionA",
128
- },
129
- },
130
- },
131
- {
132
- code: "!~!",
133
- next: {
134
- optionB: {
135
- code: "optionB",
136
- },
137
- },
138
- },
139
- {
140
- code: "!~!",
141
- next: {
142
- optionC: {
143
- code: "optionC",
144
- },
145
- },
146
- },
147
- ],
148
- },
149
- additionalProductRefs: [
150
- { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
151
- ],
152
- },
153
- rootFeatureRefs: [
154
- { code: "featureA" },
155
- { code: "featureX" },
156
- { code: "featureOptionCSelectedAtStart" },
157
- ],
158
- });
159
- const B = () => ({
160
- uuid: "B",
161
- unit: "m",
162
- features: [
163
- {
164
- code: "featureI",
165
- description: "",
166
- numericOrder: false,
167
- options: [
168
- { code: "optionI0", description: "" },
169
- { code: "optionI1", description: "", featureRefs: [{ code: "featureII" }] },
170
- ],
171
- },
172
- {
173
- code: "featureII",
174
- description: "",
175
- numericOrder: false,
176
- options: [
177
- { code: "optionII0", description: "" },
178
- { code: "optionII1", description: "", featureRefs: [{ code: "featureIII" }] },
179
- ],
180
- },
181
- {
182
- code: "featureIII",
183
- description: "",
184
- numericOrder: false,
185
- options: [
186
- { code: "optionIII0", description: "" },
187
- { code: "optionIII1", description: "" },
188
- ],
189
- },
190
- ],
191
- productData: {
192
- sku: "B",
193
- partsData: {
194
- basePrice: 0,
195
- currency: "",
196
- listPrice: 0,
197
- pkgCount: 0,
198
- selOptions: [
199
- {
200
- code: "!~!",
201
- next: {
202
- optionI0: {
203
- code: "optionI0",
204
- },
205
- },
206
- },
207
- ],
208
- styleNr: "",
209
- },
210
- additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
211
- },
212
- rootFeatureRefs: [{ code: "featureI" }],
213
- });
214
- const C = () => ({
215
- uuid: "C",
216
- unit: "m",
217
- features: [
218
- {
219
- code: "featureC",
220
- description: "",
221
- numericOrder: false,
222
- options: [
223
- {
224
- code: "optionA",
225
- description: "",
226
- },
227
- {
228
- code: "optionB",
229
- description: "",
230
- },
231
- {
232
- code: "optionC",
233
- description: "",
234
- },
235
- ],
236
- },
237
- ],
238
- productData: {
239
- sku: "C",
240
- partsData: {
241
- basePrice: 0,
242
- currency: "",
243
- listPrice: 0,
244
- pkgCount: 0,
245
- selOptions: [
246
- {
247
- code: "!~!",
248
- next: {
249
- optionA: {
250
- code: "optionA",
251
- },
252
- },
253
- },
254
- ],
255
- styleNr: "",
256
- },
257
- },
258
- rootFeatureRefs: [{ code: "featureC" }],
259
- });
260
- const D = () => ({
261
- uuid: "D",
262
- unit: "m",
263
- features: [],
264
- productData: {
265
- sku: "D",
266
- partsData: {
267
- basePrice: 0,
268
- currency: "",
269
- listPrice: 0,
270
- pkgCount: 0,
271
- selOptions: [],
272
- styleNr: "",
273
- },
274
- },
275
- rootFeatureRefs: [],
276
- });
277
- export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, function* () {
278
- const partNumber = params.partNumber;
279
- switch (partNumber) {
280
- case "A":
281
- return A();
282
- case "B":
283
- return B();
284
- case "C":
285
- return C();
286
- case "D":
287
- return D();
288
- }
289
- throw new Error("No such part");
290
- });
291
- export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0, void 0, function* () {
292
- const product = yield CfgProduct.make({
293
- getProduct: getTestProduct,
294
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
295
- const productData = (yield getTestProduct(params)).productData;
296
- productData.partsData.selOptions = [
297
- {
298
- code: "!~!",
299
- next: {
300
- optionC: {
301
- code: "optionC",
302
- },
303
- },
304
- },
305
- ];
306
- if (params.partNumber === "A") {
307
- productData.partsData.selOptions.push({
308
- code: "!~!",
309
- next: {
310
- optionC: {
311
- code: "optionC",
312
- },
313
- },
314
- });
315
- productData.partsData.selOptions.push({
316
- code: "!~!",
317
- next: {
318
- optionC: {
319
- code: "optionC",
320
- },
321
- },
322
- });
323
- }
324
- const validateResponse = {
325
- uuid: "",
326
- validated: true,
327
- productData,
328
- };
329
- collect.pushNotification(`Validate ${params.enterprise} ${params.prdCat} ${params.prdCatVersion} ${params.priceList} ${params.vendor} ${params.partNumber}`);
330
- return validateResponse;
331
- }),
332
- }, "lang", dummyCatId, "A");
333
- if (prepFunc !== undefined) {
334
- yield prepFunc(product);
335
- }
336
- const collect = new Collector(product);
337
- const beforeSnapshot = collect.takeSnapshot();
338
- yield testFunc(product);
339
- const afterSnapshot = collect.takeSnapshot();
340
- const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
341
- const notifications = collect.notifications;
342
- return {
343
- beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
344
- afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
345
- diff,
346
- notifications,
347
- };
348
- });
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { CfgProduct } from "../../CfgProduct";
11
+ import { Collector } from "./collectorForTest";
12
+ import { dummyCatId } from "./dummyProductForTest";
13
+ const A = () => ({
14
+ uuid: "A",
15
+ unit: "m",
16
+ features: [
17
+ {
18
+ code: "featureA",
19
+ description: "",
20
+ numericOrder: false,
21
+ options: [
22
+ {
23
+ code: "optionA",
24
+ description: "",
25
+ additionalProductRefs: [
26
+ { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
27
+ { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
28
+ ],
29
+ },
30
+ {
31
+ code: "optionB",
32
+ description: "",
33
+ },
34
+ {
35
+ code: "optionC",
36
+ description: "",
37
+ additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
38
+ },
39
+ ],
40
+ },
41
+ {
42
+ code: "featureX",
43
+ description: "",
44
+ numericOrder: false,
45
+ options: [
46
+ {
47
+ code: "optionA",
48
+ description: "",
49
+ },
50
+ {
51
+ code: "optionB",
52
+ description: "",
53
+ },
54
+ {
55
+ code: "optionC",
56
+ description: "",
57
+ },
58
+ ],
59
+ },
60
+ {
61
+ code: "featureNotUsed",
62
+ description: "",
63
+ numericOrder: false,
64
+ options: [
65
+ {
66
+ code: "optionA",
67
+ description: "",
68
+ },
69
+ {
70
+ code: "optionB",
71
+ description: "",
72
+ },
73
+ ],
74
+ },
75
+ {
76
+ code: "featureOptionCSelectedAtStart",
77
+ description: "",
78
+ numericOrder: false,
79
+ options: [
80
+ {
81
+ code: "optionA",
82
+ description: "",
83
+ },
84
+ {
85
+ code: "optionB",
86
+ description: "",
87
+ },
88
+ {
89
+ code: "optionC",
90
+ description: "",
91
+ },
92
+ ],
93
+ },
94
+ {
95
+ code: "featureSelectMany",
96
+ description: "",
97
+ numericOrder: false,
98
+ options: [
99
+ {
100
+ code: "optionA",
101
+ description: "",
102
+ },
103
+ {
104
+ code: "optionB",
105
+ description: "",
106
+ },
107
+ {
108
+ code: "optionC",
109
+ description: "",
110
+ },
111
+ ],
112
+ },
113
+ ],
114
+ productData: {
115
+ sku: "A",
116
+ partsData: {
117
+ basePrice: 0,
118
+ currency: "",
119
+ listPrice: 0,
120
+ pkgCount: 0,
121
+ styleNr: "",
122
+ selOptions: [
123
+ {
124
+ code: "!~!",
125
+ next: {
126
+ optionA: {
127
+ code: "optionA",
128
+ },
129
+ },
130
+ },
131
+ {
132
+ code: "!~!",
133
+ next: {
134
+ optionB: {
135
+ code: "optionB",
136
+ },
137
+ },
138
+ },
139
+ {
140
+ code: "!~!",
141
+ next: {
142
+ optionC: {
143
+ code: "optionC",
144
+ },
145
+ },
146
+ },
147
+ ],
148
+ },
149
+ additionalProductRefs: [
150
+ { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
151
+ ],
152
+ },
153
+ rootFeatureRefs: [
154
+ { code: "featureA" },
155
+ { code: "featureX" },
156
+ { code: "featureOptionCSelectedAtStart" },
157
+ ],
158
+ });
159
+ const B = () => ({
160
+ uuid: "B",
161
+ unit: "m",
162
+ features: [
163
+ {
164
+ code: "featureI",
165
+ description: "",
166
+ numericOrder: false,
167
+ options: [
168
+ { code: "optionI0", description: "" },
169
+ { code: "optionI1", description: "", featureRefs: [{ code: "featureII" }] },
170
+ ],
171
+ },
172
+ {
173
+ code: "featureII",
174
+ description: "",
175
+ numericOrder: false,
176
+ options: [
177
+ { code: "optionII0", description: "" },
178
+ { code: "optionII1", description: "", featureRefs: [{ code: "featureIII" }] },
179
+ ],
180
+ },
181
+ {
182
+ code: "featureIII",
183
+ description: "",
184
+ numericOrder: false,
185
+ options: [
186
+ { code: "optionIII0", description: "" },
187
+ { code: "optionIII1", description: "" },
188
+ ],
189
+ },
190
+ ],
191
+ productData: {
192
+ sku: "B",
193
+ partsData: {
194
+ basePrice: 0,
195
+ currency: "",
196
+ listPrice: 0,
197
+ pkgCount: 0,
198
+ selOptions: [
199
+ {
200
+ code: "!~!",
201
+ next: {
202
+ optionI0: {
203
+ code: "optionI0",
204
+ },
205
+ },
206
+ },
207
+ ],
208
+ styleNr: "",
209
+ },
210
+ additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
211
+ },
212
+ rootFeatureRefs: [{ code: "featureI" }],
213
+ });
214
+ const C = () => ({
215
+ uuid: "C",
216
+ unit: "m",
217
+ features: [
218
+ {
219
+ code: "featureC",
220
+ description: "",
221
+ numericOrder: false,
222
+ options: [
223
+ {
224
+ code: "optionA",
225
+ description: "",
226
+ },
227
+ {
228
+ code: "optionB",
229
+ description: "",
230
+ },
231
+ {
232
+ code: "optionC",
233
+ description: "",
234
+ },
235
+ ],
236
+ },
237
+ ],
238
+ productData: {
239
+ sku: "C",
240
+ partsData: {
241
+ basePrice: 0,
242
+ currency: "",
243
+ listPrice: 0,
244
+ pkgCount: 0,
245
+ selOptions: [
246
+ {
247
+ code: "!~!",
248
+ next: {
249
+ optionA: {
250
+ code: "optionA",
251
+ },
252
+ },
253
+ },
254
+ ],
255
+ styleNr: "",
256
+ },
257
+ },
258
+ rootFeatureRefs: [{ code: "featureC" }],
259
+ });
260
+ const D = () => ({
261
+ uuid: "D",
262
+ unit: "m",
263
+ features: [],
264
+ productData: {
265
+ sku: "D",
266
+ partsData: {
267
+ basePrice: 0,
268
+ currency: "",
269
+ listPrice: 0,
270
+ pkgCount: 0,
271
+ selOptions: [],
272
+ styleNr: "",
273
+ },
274
+ },
275
+ rootFeatureRefs: [],
276
+ });
277
+ export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, function* () {
278
+ const partNumber = params.partNumber;
279
+ switch (partNumber) {
280
+ case "A":
281
+ return A();
282
+ case "B":
283
+ return B();
284
+ case "C":
285
+ return C();
286
+ case "D":
287
+ return D();
288
+ }
289
+ throw new Error("No such part");
290
+ });
291
+ export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0, void 0, function* () {
292
+ const product = yield CfgProduct.make({
293
+ getProduct: getTestProduct,
294
+ postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
295
+ const productData = (yield getTestProduct(params)).productData;
296
+ productData.partsData.selOptions = [
297
+ {
298
+ code: "!~!",
299
+ next: {
300
+ optionC: {
301
+ code: "optionC",
302
+ },
303
+ },
304
+ },
305
+ ];
306
+ if (params.partNumber === "A") {
307
+ productData.partsData.selOptions.push({
308
+ code: "!~!",
309
+ next: {
310
+ optionC: {
311
+ code: "optionC",
312
+ },
313
+ },
314
+ });
315
+ productData.partsData.selOptions.push({
316
+ code: "!~!",
317
+ next: {
318
+ optionC: {
319
+ code: "optionC",
320
+ },
321
+ },
322
+ });
323
+ }
324
+ const validateResponse = {
325
+ uuid: "",
326
+ validated: true,
327
+ productData,
328
+ };
329
+ collect.pushNotification(`Validate ${params.enterprise} ${params.prdCat} ${params.prdCatVersion} ${params.priceList} ${params.vendor} ${params.partNumber}`);
330
+ return validateResponse;
331
+ }),
332
+ }, "lang", dummyCatId, "A");
333
+ if (prepFunc !== undefined) {
334
+ yield prepFunc(product);
335
+ }
336
+ const collect = new Collector(product);
337
+ const beforeSnapshot = collect.takeSnapshot();
338
+ yield testFunc(product);
339
+ const afterSnapshot = collect.takeSnapshot();
340
+ const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
341
+ const notifications = collect.notifications;
342
+ return {
343
+ beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
344
+ afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
345
+ diff,
346
+ notifications,
347
+ };
348
+ });