@configura/web-api 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 (53) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/CatalogueAPI.d.ts +448 -448
  4. package/dist/CatalogueAPI.js +206 -206
  5. package/dist/CfgProduct.d.ts +116 -116
  6. package/dist/CfgProduct.js +588 -588
  7. package/dist/index.d.ts +15 -15
  8. package/dist/index.js +15 -15
  9. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  10. package/dist/material/CfgMaterialMapping.js +176 -176
  11. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  12. package/dist/material/CfgMtrlApplication.js +43 -43
  13. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  14. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  15. package/dist/material/CfgMtrlSource.d.ts +19 -19
  16. package/dist/material/CfgMtrlSource.js +40 -40
  17. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  18. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  19. package/dist/productConfiguration/CfgFeature.d.ts +134 -134
  20. package/dist/productConfiguration/CfgFeature.js +483 -483
  21. package/dist/productConfiguration/CfgOption.d.ts +112 -112
  22. package/dist/productConfiguration/CfgOption.js +293 -293
  23. package/dist/productConfiguration/CfgProductConfiguration.d.ts +50 -50
  24. package/dist/productConfiguration/CfgProductConfiguration.js +198 -198
  25. package/dist/productConfiguration/filters.d.ts +7 -7
  26. package/dist/productConfiguration/filters.js +29 -29
  27. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  28. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  29. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +9 -9
  30. package/dist/productConfiguration/utilitiesProductConfiguration.js +61 -61
  31. package/dist/productLoader.d.ts +11 -11
  32. package/dist/productLoader.js +41 -41
  33. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  34. package/dist/tests/testData/collectorForTest.js +195 -195
  35. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  36. package/dist/tests/testData/dummyProductForTest.js +35 -35
  37. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
  38. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +368 -368
  39. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  40. package/dist/tests/testData/testDataCachedGetProduct.js +199 -199
  41. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  42. package/dist/tests/testData/testDataCachedPostValidate.js +189 -189
  43. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  44. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1117 -1117
  45. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +28 -28
  46. package/dist/tests/testData/testDataProductAggregatedPrice.js +205 -205
  47. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  48. package/dist/tests/testData/testDataUpcharge.js +159 -159
  49. package/dist/utilitiesCatalogueData.d.ts +20 -18
  50. package/dist/utilitiesCatalogueData.js +64 -56
  51. package/dist/utilitiesCataloguePermission.d.ts +39 -39
  52. package/dist/utilitiesCataloguePermission.js +84 -84
  53. 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,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
- 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
+ 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,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