@configura/web-api 1.4.0-alpha.0 → 1.4.0-alpha.1

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/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/CatalogueAPI.d.ts +503 -502
  4. package/dist/CatalogueAPI.js +242 -206
  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 -634
  9. package/dist/index.d.ts +16 -16
  10. package/dist/index.js +16 -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 +160 -160
  22. package/dist/productConfiguration/CfgFeature.js +593 -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 -7
  28. package/dist/productConfiguration/filters.js +67 -29
  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/tests/testData/collectorForTest.d.ts +73 -73
  36. package/dist/tests/testData/collectorForTest.js +195 -195
  37. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  38. package/dist/tests/testData/dummyProductForTest.js +36 -36
  39. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
  40. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +348 -381
  41. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  42. package/dist/tests/testData/testDataCachedGetProduct.js +196 -205
  43. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  44. package/dist/tests/testData/testDataCachedPostValidate.js +183 -195
  45. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  46. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1119
  47. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -28
  48. package/dist/tests/testData/testDataProductAggregatedPrice.js +198 -210
  49. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  50. package/dist/tests/testData/testDataUpcharge.js +151 -163
  51. package/dist/utilitiesCatalogueData.d.ts +25 -22
  52. package/dist/utilitiesCatalogueData.js +64 -64
  53. package/dist/utilitiesCataloguePermission.d.ts +39 -39
  54. package/dist/utilitiesCataloguePermission.js +84 -84
  55. package/dist/utilitiesNumericValues.d.ts +24 -24
  56. package/dist/utilitiesNumericValues.js +109 -109
  57. package/package.json +3 -3
@@ -1,381 +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
- feature: "featureA",
126
- featDesc: "",
127
- next: {
128
- optionA: {
129
- code: "optionA",
130
- feature: "featureA",
131
- featDesc: "",
132
- },
133
- },
134
- },
135
- {
136
- code: "!~!",
137
- feature: "featureX",
138
- featDesc: "",
139
- next: {
140
- optionB: {
141
- code: "optionB",
142
- feature: "featureX",
143
- featDesc: "",
144
- },
145
- },
146
- },
147
- {
148
- code: "!~!",
149
- feature: "featureOptionCSelectedAtStart",
150
- featDesc: "",
151
- next: {
152
- optionC: {
153
- code: "optionC",
154
- feature: "featureOptionCSelectedAtStart",
155
- featDesc: "",
156
- },
157
- },
158
- },
159
- ],
160
- },
161
- additionalProductRefs: [
162
- { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
163
- ],
164
- },
165
- rootFeatureRefs: [
166
- { code: "featureA" },
167
- { code: "featureX" },
168
- { code: "featureOptionCSelectedAtStart" },
169
- ],
170
- });
171
- const B = () => ({
172
- uuid: "B",
173
- unit: "m",
174
- features: [
175
- {
176
- code: "featureI",
177
- description: "",
178
- numericOrder: false,
179
- options: [
180
- { code: "optionI0", description: "" },
181
- { code: "optionI1", description: "", featureRefs: [{ code: "featureII" }] },
182
- ],
183
- },
184
- {
185
- code: "featureII",
186
- description: "",
187
- numericOrder: false,
188
- options: [
189
- { code: "optionII0", description: "" },
190
- { code: "optionII1", description: "", featureRefs: [{ code: "featureIII" }] },
191
- ],
192
- },
193
- {
194
- code: "featureIII",
195
- description: "",
196
- numericOrder: false,
197
- options: [
198
- { code: "optionIII0", description: "" },
199
- { code: "optionIII1", description: "" },
200
- ],
201
- },
202
- ],
203
- productData: {
204
- sku: "B",
205
- partsData: {
206
- basePrice: 0,
207
- currency: "",
208
- listPrice: 0,
209
- pkgCount: 0,
210
- selOptions: [
211
- {
212
- code: "!~!",
213
- feature: "featureI",
214
- featDesc: "",
215
- next: {
216
- optionI0: {
217
- code: "optionI0",
218
- feature: "featureI",
219
- featDesc: "",
220
- },
221
- },
222
- },
223
- ],
224
- styleNr: "",
225
- },
226
- additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
227
- },
228
- rootFeatureRefs: [{ code: "featureI" }],
229
- });
230
- const C = () => ({
231
- uuid: "C",
232
- unit: "m",
233
- features: [
234
- {
235
- code: "featureC",
236
- description: "",
237
- numericOrder: false,
238
- options: [
239
- {
240
- code: "optionA",
241
- description: "",
242
- },
243
- {
244
- code: "optionB",
245
- description: "",
246
- },
247
- {
248
- code: "optionC",
249
- description: "",
250
- },
251
- ],
252
- },
253
- ],
254
- productData: {
255
- sku: "C",
256
- partsData: {
257
- basePrice: 0,
258
- currency: "",
259
- listPrice: 0,
260
- pkgCount: 0,
261
- selOptions: [
262
- {
263
- code: "!~!",
264
- feature: "featureC",
265
- featDesc: "",
266
- next: {
267
- optionA: {
268
- code: "optionA",
269
- feature: "featureC",
270
- featDesc: "",
271
- },
272
- },
273
- },
274
- ],
275
- styleNr: "",
276
- },
277
- },
278
- rootFeatureRefs: [{ code: "featureC" }],
279
- });
280
- const D = () => ({
281
- uuid: "D",
282
- unit: "m",
283
- features: [],
284
- productData: {
285
- sku: "D",
286
- partsData: {
287
- basePrice: 0,
288
- currency: "",
289
- listPrice: 0,
290
- pkgCount: 0,
291
- selOptions: [],
292
- styleNr: "",
293
- },
294
- },
295
- rootFeatureRefs: [],
296
- });
297
- export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, function* () {
298
- const partNumber = params.partNumber;
299
- switch (partNumber) {
300
- case "A":
301
- return A();
302
- case "B":
303
- return B();
304
- case "C":
305
- return C();
306
- case "D":
307
- return D();
308
- }
309
- throw new Error("No such part");
310
- });
311
- export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0, void 0, function* () {
312
- const product = yield CfgProduct.make({
313
- getProduct: getTestProduct,
314
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
315
- const productData = (yield getTestProduct(params)).productData;
316
- const feat = productData.partsData.selOptions[0].feature;
317
- productData.partsData.selOptions = [
318
- {
319
- code: "!~!",
320
- feature: feat,
321
- featDesc: "",
322
- next: {
323
- optionC: {
324
- code: "optionC",
325
- feature: feat,
326
- featDesc: "",
327
- },
328
- },
329
- },
330
- ];
331
- if (params.partNumber === "A") {
332
- productData.partsData.selOptions.push({
333
- code: "!~!",
334
- feature: "featureX",
335
- featDesc: "",
336
- next: {
337
- optionC: {
338
- code: "optionC",
339
- feature: "featureX",
340
- featDesc: "",
341
- },
342
- },
343
- });
344
- productData.partsData.selOptions.push({
345
- code: "!~!",
346
- feature: "featureOptionCSelectedAtStart",
347
- featDesc: "",
348
- next: {
349
- optionC: {
350
- code: "optionC",
351
- feature: "featureOptionCSelectedAtStart",
352
- featDesc: "",
353
- },
354
- },
355
- });
356
- }
357
- const validateResponse = {
358
- uuid: "",
359
- validated: true,
360
- productData,
361
- };
362
- collect.pushNotification(`Validate ${params.enterprise} ${params.prdCat} ${params.prdCatVersion} ${params.priceList} ${params.vendor} ${params.partNumber}`);
363
- return validateResponse;
364
- }),
365
- }, "lang", dummyCatId, "A");
366
- if (prepFunc !== undefined) {
367
- yield prepFunc(product);
368
- }
369
- const collect = new Collector(product);
370
- const beforeSnapshot = collect.takeSnapshot();
371
- yield testFunc(product);
372
- const afterSnapshot = collect.takeSnapshot();
373
- const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
374
- const notifications = collect.notifications;
375
- return {
376
- beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
377
- afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
378
- diff,
379
- notifications,
380
- };
381
- });
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
+ });