@configura/web-api 1.3.0-alpha.4 → 1.3.0-alpha.5

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