@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,6 +1,6 @@
1
- import { GetProductParams } from "../../CatalogueAPI.js";
2
- import { CfgProduct } from "../../CfgProduct.js";
3
- import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
4
- export declare const getTestProduct: (params: GetProductParams, validateCall?: Boolean | undefined) => Promise<CfgProductResponse>;
5
- export declare const cachedProductLoaderTest: () => Promise<CfgProduct>;
1
+ import { GetProductParams } from "../../CatalogueAPI.js";
2
+ import { CfgProduct } from "../../CfgProduct.js";
3
+ import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
4
+ export declare const getTestProduct: (params: GetProductParams, validateCall?: Boolean | undefined) => Promise<CfgProductResponse>;
5
+ export declare const cachedProductLoaderTest: () => Promise<CfgProduct>;
6
6
  //# sourceMappingURL=testDataCachedGetProduct.d.ts.map
@@ -1,196 +1,196 @@
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.js";
11
- import { wrapWithGetProductCache } from "../../productLoader.js";
12
- import { dummyCatId } from "./dummyProductForTest.js";
13
- let prodKeyArray = [];
14
- const A = () => ({
15
- uuid: "A",
16
- unit: "m",
17
- features: [
18
- {
19
- code: "featureA",
20
- description: "",
21
- numericOrder: false,
22
- options: [
23
- {
24
- code: "optionA",
25
- description: "",
26
- additionalProductRefs: [
27
- { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
28
- { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
29
- ],
30
- },
31
- {
32
- code: "optionB",
33
- description: "",
34
- additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
35
- },
36
- {
37
- code: "optionC",
38
- description: "",
39
- additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
40
- },
41
- ],
42
- },
43
- ],
44
- productData: {
45
- sku: "A",
46
- partsData: {
47
- basePrice: 40,
48
- currency: "EURO",
49
- listPrice: 50,
50
- pkgCount: 0,
51
- styleNr: "",
52
- selOptions: [
53
- {
54
- code: "!~!",
55
- next: {
56
- optionA: {
57
- code: "optionA",
58
- },
59
- },
60
- },
61
- ],
62
- },
63
- additionalProductRefs: [
64
- { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
65
- ],
66
- },
67
- rootFeatureRefs: [{ code: "featureA" }],
68
- });
69
- const B = () => ({
70
- uuid: "B",
71
- unit: "m",
72
- features: [],
73
- productData: {
74
- sku: "B",
75
- partsData: {
76
- basePrice: 30,
77
- currency: "EURO",
78
- listPrice: 40,
79
- pkgCount: 0,
80
- selOptions: [],
81
- styleNr: "",
82
- },
83
- additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
84
- },
85
- rootFeatureRefs: [],
86
- });
87
- const C = () => ({
88
- uuid: "C",
89
- unit: "m",
90
- features: [],
91
- productData: {
92
- sku: "C",
93
- partsData: {
94
- basePrice: 20,
95
- currency: "EURO",
96
- listPrice: 30,
97
- pkgCount: 0,
98
- selOptions: [],
99
- styleNr: "",
100
- },
101
- },
102
- rootFeatureRefs: [],
103
- });
104
- const D = () => ({
105
- uuid: "D",
106
- unit: "m",
107
- features: [],
108
- productData: {
109
- sku: "D",
110
- partsData: {
111
- basePrice: 10,
112
- currency: "EURO",
113
- listPrice: 20,
114
- pkgCount: 0,
115
- selOptions: [],
116
- styleNr: "",
117
- },
118
- },
119
- rootFeatureRefs: [],
120
- });
121
- const E = () => ({
122
- uuid: "E",
123
- unit: "m",
124
- features: [],
125
- productData: {
126
- sku: "E",
127
- partsData: {
128
- basePrice: 15,
129
- currency: "USD",
130
- listPrice: 25,
131
- pkgCount: 0,
132
- selOptions: [],
133
- styleNr: "",
134
- },
135
- },
136
- rootFeatureRefs: [],
137
- });
138
- export const getTestProduct = (params, validateCall) => __awaiter(void 0, void 0, void 0, function* () {
139
- const partNumber = params.partNumber;
140
- if (validateCall !== true) {
141
- if (prodKeyArray.indexOf(partNumber) > -1) {
142
- throw new Error("Duplicate call!");
143
- }
144
- else {
145
- prodKeyArray.push(partNumber);
146
- }
147
- }
148
- switch (partNumber) {
149
- case "A":
150
- return A();
151
- case "B":
152
- return B();
153
- case "C":
154
- return C();
155
- case "D":
156
- return D();
157
- case "E":
158
- return E();
159
- }
160
- throw new Error("No such part");
161
- });
162
- export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, function* () {
163
- prodKeyArray = [];
164
- const productLoader = {
165
- getProduct: getTestProduct,
166
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
167
- const productData = (yield getTestProduct(params, true)).productData;
168
- let code = "optionA";
169
- for (let test in _body.selOptions[0].next) {
170
- code = test;
171
- break;
172
- }
173
- productData.partsData.selOptions = [
174
- {
175
- code: _body.selOptions[0].code,
176
- next: {
177
- [code]: {
178
- code: code,
179
- },
180
- },
181
- },
182
- ];
183
- const validateResponse = {
184
- uuid: "",
185
- validated: true,
186
- productData,
187
- };
188
- return validateResponse;
189
- }),
190
- };
191
- const productWrapper = yield CfgProduct.make({
192
- getProduct: wrapWithGetProductCache(productLoader.getProduct.bind(productLoader)),
193
- postValidate: productLoader.postValidate.bind(productLoader),
194
- }, "lang", dummyCatId, "A");
195
- return productWrapper;
196
- });
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.js";
11
+ import { wrapWithGetProductCache } from "../../productLoader.js";
12
+ import { dummyCatId } from "./dummyProductForTest.js";
13
+ let prodKeyArray = [];
14
+ const A = () => ({
15
+ uuid: "A",
16
+ unit: "m",
17
+ features: [
18
+ {
19
+ code: "featureA",
20
+ description: "",
21
+ numericOrder: false,
22
+ options: [
23
+ {
24
+ code: "optionA",
25
+ description: "",
26
+ additionalProductRefs: [
27
+ { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
28
+ { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
29
+ ],
30
+ },
31
+ {
32
+ code: "optionB",
33
+ description: "",
34
+ additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
35
+ },
36
+ {
37
+ code: "optionC",
38
+ description: "",
39
+ additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
40
+ },
41
+ ],
42
+ },
43
+ ],
44
+ productData: {
45
+ sku: "A",
46
+ partsData: {
47
+ basePrice: 40,
48
+ currency: "EURO",
49
+ listPrice: 50,
50
+ pkgCount: 0,
51
+ styleNr: "",
52
+ selOptions: [
53
+ {
54
+ code: "!~!",
55
+ next: {
56
+ optionA: {
57
+ code: "optionA",
58
+ },
59
+ },
60
+ },
61
+ ],
62
+ },
63
+ additionalProductRefs: [
64
+ { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
65
+ ],
66
+ },
67
+ rootFeatureRefs: [{ code: "featureA" }],
68
+ });
69
+ const B = () => ({
70
+ uuid: "B",
71
+ unit: "m",
72
+ features: [],
73
+ productData: {
74
+ sku: "B",
75
+ partsData: {
76
+ basePrice: 30,
77
+ currency: "EURO",
78
+ listPrice: 40,
79
+ pkgCount: 0,
80
+ selOptions: [],
81
+ styleNr: "",
82
+ },
83
+ additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
84
+ },
85
+ rootFeatureRefs: [],
86
+ });
87
+ const C = () => ({
88
+ uuid: "C",
89
+ unit: "m",
90
+ features: [],
91
+ productData: {
92
+ sku: "C",
93
+ partsData: {
94
+ basePrice: 20,
95
+ currency: "EURO",
96
+ listPrice: 30,
97
+ pkgCount: 0,
98
+ selOptions: [],
99
+ styleNr: "",
100
+ },
101
+ },
102
+ rootFeatureRefs: [],
103
+ });
104
+ const D = () => ({
105
+ uuid: "D",
106
+ unit: "m",
107
+ features: [],
108
+ productData: {
109
+ sku: "D",
110
+ partsData: {
111
+ basePrice: 10,
112
+ currency: "EURO",
113
+ listPrice: 20,
114
+ pkgCount: 0,
115
+ selOptions: [],
116
+ styleNr: "",
117
+ },
118
+ },
119
+ rootFeatureRefs: [],
120
+ });
121
+ const E = () => ({
122
+ uuid: "E",
123
+ unit: "m",
124
+ features: [],
125
+ productData: {
126
+ sku: "E",
127
+ partsData: {
128
+ basePrice: 15,
129
+ currency: "USD",
130
+ listPrice: 25,
131
+ pkgCount: 0,
132
+ selOptions: [],
133
+ styleNr: "",
134
+ },
135
+ },
136
+ rootFeatureRefs: [],
137
+ });
138
+ export const getTestProduct = (params, validateCall) => __awaiter(void 0, void 0, void 0, function* () {
139
+ const partNumber = params.partNumber;
140
+ if (validateCall !== true) {
141
+ if (prodKeyArray.indexOf(partNumber) > -1) {
142
+ throw new Error("Duplicate call!");
143
+ }
144
+ else {
145
+ prodKeyArray.push(partNumber);
146
+ }
147
+ }
148
+ switch (partNumber) {
149
+ case "A":
150
+ return A();
151
+ case "B":
152
+ return B();
153
+ case "C":
154
+ return C();
155
+ case "D":
156
+ return D();
157
+ case "E":
158
+ return E();
159
+ }
160
+ throw new Error("No such part");
161
+ });
162
+ export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, function* () {
163
+ prodKeyArray = [];
164
+ const productLoader = {
165
+ getProduct: getTestProduct,
166
+ postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
167
+ const productData = (yield getTestProduct(params, true)).productData;
168
+ let code = "optionA";
169
+ for (let test in _body.selOptions[0].next) {
170
+ code = test;
171
+ break;
172
+ }
173
+ productData.partsData.selOptions = [
174
+ {
175
+ code: _body.selOptions[0].code,
176
+ next: {
177
+ [code]: {
178
+ code: code,
179
+ },
180
+ },
181
+ },
182
+ ];
183
+ const validateResponse = {
184
+ uuid: "",
185
+ validated: true,
186
+ productData,
187
+ };
188
+ return validateResponse;
189
+ }),
190
+ };
191
+ const productWrapper = yield CfgProduct.make({
192
+ getProduct: wrapWithGetProductCache(productLoader.getProduct.bind(productLoader)),
193
+ postValidate: productLoader.postValidate.bind(productLoader),
194
+ }, "lang", dummyCatId, "A");
195
+ return productWrapper;
196
+ });
@@ -1,8 +1,8 @@
1
- import { CfgProduct } from "../../CfgProduct.js";
2
- export declare const cachedProductLoaderTest: () => Promise<{
3
- product: CfgProduct;
4
- validateCounter: {
5
- count: number;
6
- };
7
- }>;
1
+ import { CfgProduct } from "../../CfgProduct.js";
2
+ export declare const cachedProductLoaderTest: () => Promise<{
3
+ product: CfgProduct;
4
+ validateCounter: {
5
+ count: number;
6
+ };
7
+ }>;
8
8
  //# sourceMappingURL=testDataCachedPostValidate.d.ts.map