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

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 -502
  4. package/dist/CatalogueAPI.js +206 -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 +634 -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 +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 -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 +381 -381
  41. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  42. package/dist/tests/testData/testDataCachedGetProduct.js +205 -205
  43. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  44. package/dist/tests/testData/testDataCachedPostValidate.js +195 -195
  45. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  46. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1119 -1119
  47. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +28 -28
  48. package/dist/tests/testData/testDataProductAggregatedPrice.js +210 -210
  49. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  50. package/dist/tests/testData/testDataUpcharge.js +163 -163
  51. package/dist/utilitiesCatalogueData.d.ts +22 -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,29 +1,29 @@
1
- import { GetProductParams } 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, feat: string): {
6
- code: string;
7
- feature: string;
8
- featDesc: string;
9
- next: {
10
- optionB: {
11
- code: string;
12
- feature: string;
13
- featDesc: string;
14
- };
15
- };
16
- }[] | {
17
- code: string;
18
- feature: string;
19
- featDesc: string;
20
- next: {
21
- optionC: {
22
- code: string;
23
- feature: string;
24
- featDesc: string;
25
- };
26
- };
27
- }[];
28
- export declare const cfgProductPriceTest: (testFunc?: ((cfgProduct: CfgProduct) => Promise<void>) | undefined, featureOption?: string | undefined) => Promise<CfgProduct>;
1
+ import { GetProductParams } 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, feat: string): {
6
+ code: string;
7
+ feature: string;
8
+ featDesc: string;
9
+ next: {
10
+ optionB: {
11
+ code: string;
12
+ feature: string;
13
+ featDesc: string;
14
+ };
15
+ };
16
+ }[] | {
17
+ code: string;
18
+ feature: string;
19
+ featDesc: string;
20
+ next: {
21
+ optionC: {
22
+ code: string;
23
+ feature: string;
24
+ featDesc: string;
25
+ };
26
+ };
27
+ }[];
28
+ export declare const cfgProductPriceTest: (testFunc?: ((cfgProduct: CfgProduct) => Promise<void>) | undefined, featureOption?: string | undefined) => Promise<CfgProduct>;
29
29
  //# sourceMappingURL=testDataProductAggregatedPrice.d.ts.map
@@ -1,210 +1,210 @@
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, options: [
20
- {
21
- code: "optionA",
22
- description: "",
23
- additionalProductRefs: [
24
- { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
25
- { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
26
- ],
27
- },
28
- {
29
- code: "optionB",
30
- description: "",
31
- additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
32
- },
33
- {
34
- code: "optionC",
35
- description: "",
36
- additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
37
- },
38
- ],
39
- },
40
- ],
41
- productData: {
42
- sku: "A",
43
- partsData: {
44
- basePrice: 40,
45
- currency: "EURO",
46
- listPrice: 50,
47
- pkgCount: 0,
48
- styleNr: "",
49
- selOptions: [
50
- {
51
- code: "!~!",
52
- feature: "featureA",
53
- featDesc: "",
54
- next: {
55
- optionA: {
56
- code: "optionA",
57
- feature: "featureA",
58
- featDesc: "",
59
- },
60
- },
61
- },
62
- ],
63
- },
64
- additionalProductRefs: [
65
- { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
66
- ],
67
- },
68
- rootFeatureRefs: [{ code: "featureA" }],
69
- });
70
- const B = () => ({
71
- uuid: "B",
72
- unit: "m",
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
- unit: "m",
91
- features: [],
92
- productData: {
93
- sku: "C",
94
- partsData: {
95
- basePrice: 20,
96
- currency: "EURO",
97
- listPrice: 30,
98
- pkgCount: 0,
99
- selOptions: [],
100
- styleNr: "",
101
- },
102
- },
103
- rootFeatureRefs: [],
104
- });
105
- const D = () => ({
106
- uuid: "D",
107
- unit: "m",
108
- features: [],
109
- productData: {
110
- sku: "D",
111
- partsData: {
112
- basePrice: 10,
113
- currency: "EURO",
114
- listPrice: 20,
115
- pkgCount: 0,
116
- selOptions: [],
117
- styleNr: "",
118
- },
119
- },
120
- rootFeatureRefs: [],
121
- });
122
- const E = () => ({
123
- uuid: "E",
124
- unit: "m",
125
- features: [],
126
- productData: {
127
- sku: "E",
128
- partsData: {
129
- basePrice: 15,
130
- currency: "USD",
131
- listPrice: 25,
132
- pkgCount: 0,
133
- selOptions: [],
134
- styleNr: "",
135
- },
136
- },
137
- rootFeatureRefs: [],
138
- });
139
- export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, function* () {
140
- const partNumber = params.partNumber;
141
- switch (partNumber) {
142
- case "A":
143
- return A();
144
- case "B":
145
- return B();
146
- case "C":
147
- return C();
148
- case "D":
149
- return D();
150
- case "E":
151
- return E();
152
- }
153
- throw new Error("No such part");
154
- });
155
- export function getSelOptions(option, feat) {
156
- if (option === "optionB") {
157
- return [
158
- {
159
- code: "!~!",
160
- feature: feat,
161
- featDesc: "",
162
- next: {
163
- optionB: {
164
- code: "optionB",
165
- feature: feat,
166
- featDesc: "",
167
- },
168
- },
169
- },
170
- ];
171
- }
172
- else {
173
- return [
174
- {
175
- code: "!~!",
176
- feature: feat,
177
- featDesc: "",
178
- next: {
179
- optionC: {
180
- code: "optionC",
181
- feature: feat,
182
- featDesc: "",
183
- },
184
- },
185
- },
186
- ];
187
- }
188
- }
189
- export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
190
- const cfgProduct = yield CfgProduct.make({
191
- getProduct: getTestProduct,
192
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
193
- const productData = (yield getTestProduct(params)).productData;
194
- const feat = productData.partsData.selOptions[0].feature;
195
- if (featureOption !== undefined) {
196
- productData.partsData.selOptions = getSelOptions(featureOption, feat);
197
- }
198
- const validateResponse = {
199
- uuid: "",
200
- validated: true,
201
- productData,
202
- };
203
- return validateResponse;
204
- }),
205
- }, "lang", dummyCatId, "A");
206
- if (testFunc !== undefined) {
207
- yield testFunc(cfgProduct);
208
- }
209
- return cfgProduct;
210
- });
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, options: [
20
+ {
21
+ code: "optionA",
22
+ description: "",
23
+ additionalProductRefs: [
24
+ { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
25
+ { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
26
+ ],
27
+ },
28
+ {
29
+ code: "optionB",
30
+ description: "",
31
+ additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
32
+ },
33
+ {
34
+ code: "optionC",
35
+ description: "",
36
+ additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
37
+ },
38
+ ],
39
+ },
40
+ ],
41
+ productData: {
42
+ sku: "A",
43
+ partsData: {
44
+ basePrice: 40,
45
+ currency: "EURO",
46
+ listPrice: 50,
47
+ pkgCount: 0,
48
+ styleNr: "",
49
+ selOptions: [
50
+ {
51
+ code: "!~!",
52
+ feature: "featureA",
53
+ featDesc: "",
54
+ next: {
55
+ optionA: {
56
+ code: "optionA",
57
+ feature: "featureA",
58
+ featDesc: "",
59
+ },
60
+ },
61
+ },
62
+ ],
63
+ },
64
+ additionalProductRefs: [
65
+ { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
66
+ ],
67
+ },
68
+ rootFeatureRefs: [{ code: "featureA" }],
69
+ });
70
+ const B = () => ({
71
+ uuid: "B",
72
+ unit: "m",
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
+ unit: "m",
91
+ features: [],
92
+ productData: {
93
+ sku: "C",
94
+ partsData: {
95
+ basePrice: 20,
96
+ currency: "EURO",
97
+ listPrice: 30,
98
+ pkgCount: 0,
99
+ selOptions: [],
100
+ styleNr: "",
101
+ },
102
+ },
103
+ rootFeatureRefs: [],
104
+ });
105
+ const D = () => ({
106
+ uuid: "D",
107
+ unit: "m",
108
+ features: [],
109
+ productData: {
110
+ sku: "D",
111
+ partsData: {
112
+ basePrice: 10,
113
+ currency: "EURO",
114
+ listPrice: 20,
115
+ pkgCount: 0,
116
+ selOptions: [],
117
+ styleNr: "",
118
+ },
119
+ },
120
+ rootFeatureRefs: [],
121
+ });
122
+ const E = () => ({
123
+ uuid: "E",
124
+ unit: "m",
125
+ features: [],
126
+ productData: {
127
+ sku: "E",
128
+ partsData: {
129
+ basePrice: 15,
130
+ currency: "USD",
131
+ listPrice: 25,
132
+ pkgCount: 0,
133
+ selOptions: [],
134
+ styleNr: "",
135
+ },
136
+ },
137
+ rootFeatureRefs: [],
138
+ });
139
+ export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, function* () {
140
+ const partNumber = params.partNumber;
141
+ switch (partNumber) {
142
+ case "A":
143
+ return A();
144
+ case "B":
145
+ return B();
146
+ case "C":
147
+ return C();
148
+ case "D":
149
+ return D();
150
+ case "E":
151
+ return E();
152
+ }
153
+ throw new Error("No such part");
154
+ });
155
+ export function getSelOptions(option, feat) {
156
+ if (option === "optionB") {
157
+ return [
158
+ {
159
+ code: "!~!",
160
+ feature: feat,
161
+ featDesc: "",
162
+ next: {
163
+ optionB: {
164
+ code: "optionB",
165
+ feature: feat,
166
+ featDesc: "",
167
+ },
168
+ },
169
+ },
170
+ ];
171
+ }
172
+ else {
173
+ return [
174
+ {
175
+ code: "!~!",
176
+ feature: feat,
177
+ featDesc: "",
178
+ next: {
179
+ optionC: {
180
+ code: "optionC",
181
+ feature: feat,
182
+ featDesc: "",
183
+ },
184
+ },
185
+ },
186
+ ];
187
+ }
188
+ }
189
+ export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
190
+ const cfgProduct = yield CfgProduct.make({
191
+ getProduct: getTestProduct,
192
+ postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
193
+ const productData = (yield getTestProduct(params)).productData;
194
+ const feat = productData.partsData.selOptions[0].feature;
195
+ if (featureOption !== undefined) {
196
+ productData.partsData.selOptions = getSelOptions(featureOption, feat);
197
+ }
198
+ const validateResponse = {
199
+ uuid: "",
200
+ validated: true,
201
+ productData,
202
+ };
203
+ return validateResponse;
204
+ }),
205
+ }, "lang", dummyCatId, "A");
206
+ if (testFunc !== undefined) {
207
+ yield testFunc(cfgProduct);
208
+ }
209
+ return cfgProduct;
210
+ });
@@ -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