@configura/web-api 1.4.0-alpha.4 → 1.5.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 +511 -504
  4. package/dist/CatalogueAPI.js +273 -248
  5. package/dist/CfgMeasure.d.ts +32 -32
  6. package/dist/CfgMeasure.js +30 -30
  7. package/dist/CfgProduct.d.ts +239 -217
  8. package/dist/CfgProduct.js +668 -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 +178 -160
  22. package/dist/productConfiguration/CfgFeature.js +611 -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 +265 -0
  37. package/dist/tasks/formats.d.ts +5 -0
  38. package/dist/tasks/formats.js +7 -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,7 +1,7 @@
1
- import { GetProductParams, SelectedOption } from "../../CatalogueAPI";
2
- import { CfgProduct } from "../../CfgProduct";
3
- import { CfgProductResponse } from "../../utilitiesCatalogueData";
4
- export declare const getTestProduct: (params: GetProductParams) => Promise<CfgProductResponse>;
5
- export declare function getSelOptions(option: string): SelectedOption[];
6
- export declare const cfgProductPriceTest: (testFunc?: ((cfgProduct: CfgProduct) => Promise<void>) | undefined, featureOption?: string | undefined) => Promise<CfgProduct>;
1
+ import { GetProductParams, SelectedOption } from "../../CatalogueAPI.js";
2
+ import { CfgProduct } from "../../CfgProduct.js";
3
+ import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
4
+ export declare const getTestProduct: (params: GetProductParams) => Promise<CfgProductResponse>;
5
+ export declare function getSelOptions(option: string): SelectedOption[];
6
+ export declare const cfgProductPriceTest: (testFunc?: ((cfgProduct: CfgProduct) => Promise<void>) | undefined, featureOption?: string | undefined) => Promise<CfgProduct>;
7
7
  //# sourceMappingURL=testDataProductAggregatedPrice.d.ts.map
@@ -1,198 +1,198 @@
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 { dummyCatId } from "./dummyProductForTest";
12
- const A = () => ({
13
- uuid: "A",
14
- unit: "m",
15
- features: [
16
- {
17
- code: "featureA",
18
- description: "",
19
- numericOrder: false,
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
- next: {
54
- optionA: {
55
- code: "optionA",
56
- },
57
- },
58
- },
59
- ],
60
- },
61
- additionalProductRefs: [
62
- { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
63
- ],
64
- },
65
- rootFeatureRefs: [{ code: "featureA" }],
66
- });
67
- const B = () => ({
68
- uuid: "B",
69
- unit: "m",
70
- features: [],
71
- productData: {
72
- sku: "B",
73
- partsData: {
74
- basePrice: 30,
75
- currency: "EURO",
76
- listPrice: 40,
77
- pkgCount: 0,
78
- selOptions: [],
79
- styleNr: "",
80
- },
81
- additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
82
- },
83
- rootFeatureRefs: [],
84
- });
85
- const C = () => ({
86
- uuid: "C",
87
- unit: "m",
88
- features: [],
89
- productData: {
90
- sku: "C",
91
- partsData: {
92
- basePrice: 20,
93
- currency: "EURO",
94
- listPrice: 30,
95
- pkgCount: 0,
96
- selOptions: [],
97
- styleNr: "",
98
- },
99
- },
100
- rootFeatureRefs: [],
101
- });
102
- const D = () => ({
103
- uuid: "D",
104
- unit: "m",
105
- features: [],
106
- productData: {
107
- sku: "D",
108
- partsData: {
109
- basePrice: 10,
110
- currency: "EURO",
111
- listPrice: 20,
112
- pkgCount: 0,
113
- selOptions: [],
114
- styleNr: "",
115
- },
116
- },
117
- rootFeatureRefs: [],
118
- });
119
- const E = () => ({
120
- uuid: "E",
121
- unit: "m",
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) => __awaiter(void 0, void 0, void 0, function* () {
137
- const partNumber = params.partNumber;
138
- switch (partNumber) {
139
- case "A":
140
- return A();
141
- case "B":
142
- return B();
143
- case "C":
144
- return C();
145
- case "D":
146
- return D();
147
- case "E":
148
- return E();
149
- }
150
- throw new Error("No such part");
151
- });
152
- export function getSelOptions(option) {
153
- if (option === "optionB") {
154
- return [
155
- {
156
- code: "!~!",
157
- next: {
158
- optionB: {
159
- code: "optionB",
160
- },
161
- },
162
- },
163
- ];
164
- }
165
- else {
166
- return [
167
- {
168
- code: "!~!",
169
- next: {
170
- optionC: {
171
- code: "optionC",
172
- },
173
- },
174
- },
175
- ];
176
- }
177
- }
178
- export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
179
- const cfgProduct = yield CfgProduct.make({
180
- getProduct: getTestProduct,
181
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
182
- const productData = (yield getTestProduct(params)).productData;
183
- if (featureOption !== undefined) {
184
- productData.partsData.selOptions = getSelOptions(featureOption);
185
- }
186
- const validateResponse = {
187
- uuid: "",
188
- validated: true,
189
- productData,
190
- };
191
- return validateResponse;
192
- }),
193
- }, "lang", dummyCatId, "A");
194
- if (testFunc !== undefined) {
195
- yield testFunc(cfgProduct);
196
- }
197
- return cfgProduct;
198
- });
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 { dummyCatId } from "./dummyProductForTest.js";
12
+ const A = () => ({
13
+ uuid: "A",
14
+ unit: "m",
15
+ features: [
16
+ {
17
+ code: "featureA",
18
+ description: "",
19
+ numericOrder: false,
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
+ next: {
54
+ optionA: {
55
+ code: "optionA",
56
+ },
57
+ },
58
+ },
59
+ ],
60
+ },
61
+ additionalProductRefs: [
62
+ { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
63
+ ],
64
+ },
65
+ rootFeatureRefs: [{ code: "featureA" }],
66
+ });
67
+ const B = () => ({
68
+ uuid: "B",
69
+ unit: "m",
70
+ features: [],
71
+ productData: {
72
+ sku: "B",
73
+ partsData: {
74
+ basePrice: 30,
75
+ currency: "EURO",
76
+ listPrice: 40,
77
+ pkgCount: 0,
78
+ selOptions: [],
79
+ styleNr: "",
80
+ },
81
+ additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
82
+ },
83
+ rootFeatureRefs: [],
84
+ });
85
+ const C = () => ({
86
+ uuid: "C",
87
+ unit: "m",
88
+ features: [],
89
+ productData: {
90
+ sku: "C",
91
+ partsData: {
92
+ basePrice: 20,
93
+ currency: "EURO",
94
+ listPrice: 30,
95
+ pkgCount: 0,
96
+ selOptions: [],
97
+ styleNr: "",
98
+ },
99
+ },
100
+ rootFeatureRefs: [],
101
+ });
102
+ const D = () => ({
103
+ uuid: "D",
104
+ unit: "m",
105
+ features: [],
106
+ productData: {
107
+ sku: "D",
108
+ partsData: {
109
+ basePrice: 10,
110
+ currency: "EURO",
111
+ listPrice: 20,
112
+ pkgCount: 0,
113
+ selOptions: [],
114
+ styleNr: "",
115
+ },
116
+ },
117
+ rootFeatureRefs: [],
118
+ });
119
+ const E = () => ({
120
+ uuid: "E",
121
+ unit: "m",
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) => __awaiter(void 0, void 0, void 0, function* () {
137
+ const partNumber = params.partNumber;
138
+ switch (partNumber) {
139
+ case "A":
140
+ return A();
141
+ case "B":
142
+ return B();
143
+ case "C":
144
+ return C();
145
+ case "D":
146
+ return D();
147
+ case "E":
148
+ return E();
149
+ }
150
+ throw new Error("No such part");
151
+ });
152
+ export function getSelOptions(option) {
153
+ if (option === "optionB") {
154
+ return [
155
+ {
156
+ code: "!~!",
157
+ next: {
158
+ optionB: {
159
+ code: "optionB",
160
+ },
161
+ },
162
+ },
163
+ ];
164
+ }
165
+ else {
166
+ return [
167
+ {
168
+ code: "!~!",
169
+ next: {
170
+ optionC: {
171
+ code: "optionC",
172
+ },
173
+ },
174
+ },
175
+ ];
176
+ }
177
+ }
178
+ export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
179
+ const cfgProduct = yield CfgProduct.make({
180
+ getProduct: getTestProduct,
181
+ postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
182
+ const productData = (yield getTestProduct(params)).productData;
183
+ if (featureOption !== undefined) {
184
+ productData.partsData.selOptions = getSelOptions(featureOption);
185
+ }
186
+ const validateResponse = {
187
+ uuid: "",
188
+ validated: true,
189
+ productData,
190
+ };
191
+ return validateResponse;
192
+ }),
193
+ }, "lang", dummyCatId, "A");
194
+ if (testFunc !== undefined) {
195
+ yield testFunc(cfgProduct);
196
+ }
197
+ return cfgProduct;
198
+ });
@@ -1,30 +1,30 @@
1
- import { CfgProduct } from "../../CfgProduct.js";
2
- export declare const getUpchargeProduct: (testFunc: (product: CfgProduct) => Promise<void>) => Promise<{
3
- beforeSnapshot: {
4
- path: string;
5
- selected: boolean;
6
- } & {
7
- productConfiguration: {
8
- path: string;
9
- };
10
- additionalProducts: {
11
- path: string;
12
- selected: boolean;
13
- }[];
14
- };
15
- afterSnapshot: {
16
- path: string;
17
- selected: boolean;
18
- } & {
19
- productConfiguration: {
20
- path: string;
21
- };
22
- additionalProducts: {
23
- path: string;
24
- selected: boolean;
25
- }[];
26
- };
27
- diff: string[];
28
- notifications: string[];
29
- }>;
1
+ import { CfgProduct } from "../../CfgProduct.js";
2
+ export declare const getUpchargeProduct: (testFunc: (product: CfgProduct) => Promise<void>) => Promise<{
3
+ beforeSnapshot: {
4
+ path: string;
5
+ selected: boolean;
6
+ } & {
7
+ productConfiguration: {
8
+ path: string;
9
+ };
10
+ additionalProducts: {
11
+ path: string;
12
+ selected: boolean;
13
+ }[];
14
+ };
15
+ afterSnapshot: {
16
+ path: string;
17
+ selected: boolean;
18
+ } & {
19
+ productConfiguration: {
20
+ path: string;
21
+ };
22
+ additionalProducts: {
23
+ path: string;
24
+ selected: boolean;
25
+ }[];
26
+ };
27
+ diff: string[];
28
+ notifications: string[];
29
+ }>;
30
30
  //# sourceMappingURL=testDataUpcharge.d.ts.map