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

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 -80
  20. package/dist/productConfiguration/CfgFeature.js +483 -451
  21. package/dist/productConfiguration/CfgOption.d.ts +112 -64
  22. package/dist/productConfiguration/CfgOption.js +293 -263
  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,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,205 +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";
11
- import { dummyCatId } from "./dummyProductForTest";
12
- const A = () => ({
13
- uuid: "A",
14
- features: [
15
- {
16
- code: "featureA",
17
- description: "",
18
- options: [
19
- {
20
- code: "optionA",
21
- description: "",
22
- additionalProductRefs: [
23
- { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
24
- { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
25
- ],
26
- },
27
- {
28
- code: "optionB",
29
- description: "",
30
- additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
31
- },
32
- {
33
- code: "optionC",
34
- description: "",
35
- additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
36
- },
37
- ],
38
- },
39
- ],
40
- productData: {
41
- sku: "A",
42
- partsData: {
43
- basePrice: 40,
44
- currency: "EURO",
45
- listPrice: 50,
46
- pkgCount: 0,
47
- styleNr: "",
48
- selOptions: [
49
- {
50
- code: "!~!",
51
- feature: "featureA",
52
- featDesc: "",
53
- next: {
54
- optionA: {
55
- code: "optionA",
56
- feature: "featureA",
57
- featDesc: "",
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
- features: [],
72
- productData: {
73
- sku: "B",
74
- partsData: {
75
- basePrice: 30,
76
- currency: "EURO",
77
- listPrice: 40,
78
- pkgCount: 0,
79
- selOptions: [],
80
- styleNr: "",
81
- },
82
- additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
83
- },
84
- rootFeatureRefs: [],
85
- });
86
- const C = () => ({
87
- uuid: "C",
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
- features: [],
105
- productData: {
106
- sku: "D",
107
- partsData: {
108
- basePrice: 10,
109
- currency: "EURO",
110
- listPrice: 20,
111
- pkgCount: 0,
112
- selOptions: [],
113
- styleNr: "",
114
- },
115
- },
116
- rootFeatureRefs: [],
117
- });
118
- const E = () => ({
119
- uuid: "E",
120
- features: [],
121
- productData: {
122
- sku: "E",
123
- partsData: {
124
- basePrice: 15,
125
- currency: "USD",
126
- listPrice: 25,
127
- pkgCount: 0,
128
- selOptions: [],
129
- styleNr: "",
130
- },
131
- },
132
- rootFeatureRefs: [],
133
- });
134
- export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, function* () {
135
- const partNumber = params.partNumber;
136
- switch (partNumber) {
137
- case "A":
138
- return A();
139
- case "B":
140
- return B();
141
- case "C":
142
- return C();
143
- case "D":
144
- return D();
145
- case "E":
146
- return E();
147
- }
148
- throw new Error("No such part");
149
- });
150
- export function getSelOptions(option, feat) {
151
- if (option === "optionB") {
152
- return [
153
- {
154
- code: "!~!",
155
- feature: feat,
156
- featDesc: "",
157
- next: {
158
- optionB: {
159
- code: "optionB",
160
- feature: feat,
161
- featDesc: "",
162
- },
163
- },
164
- },
165
- ];
166
- }
167
- else {
168
- return [
169
- {
170
- code: "!~!",
171
- feature: feat,
172
- featDesc: "",
173
- next: {
174
- optionC: {
175
- code: "optionC",
176
- feature: feat,
177
- featDesc: "",
178
- },
179
- },
180
- },
181
- ];
182
- }
183
- }
184
- export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
185
- const cfgProduct = yield CfgProduct.make({
186
- getProduct: getTestProduct,
187
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
188
- const productData = (yield getTestProduct(params)).productData;
189
- const feat = productData.partsData.selOptions[0].feature;
190
- if (featureOption !== undefined) {
191
- productData.partsData.selOptions = getSelOptions(featureOption, feat);
192
- }
193
- const validateResponse = {
194
- uuid: "",
195
- validated: true,
196
- productData,
197
- };
198
- return validateResponse;
199
- }),
200
- }, "lang", dummyCatId, "A");
201
- if (testFunc !== undefined) {
202
- yield testFunc(cfgProduct);
203
- }
204
- return cfgProduct;
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";
11
+ import { dummyCatId } from "./dummyProductForTest";
12
+ const A = () => ({
13
+ uuid: "A",
14
+ features: [
15
+ {
16
+ code: "featureA",
17
+ description: "",
18
+ options: [
19
+ {
20
+ code: "optionA",
21
+ description: "",
22
+ additionalProductRefs: [
23
+ { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
24
+ { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
25
+ ],
26
+ },
27
+ {
28
+ code: "optionB",
29
+ description: "",
30
+ additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
31
+ },
32
+ {
33
+ code: "optionC",
34
+ description: "",
35
+ additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
36
+ },
37
+ ],
38
+ },
39
+ ],
40
+ productData: {
41
+ sku: "A",
42
+ partsData: {
43
+ basePrice: 40,
44
+ currency: "EURO",
45
+ listPrice: 50,
46
+ pkgCount: 0,
47
+ styleNr: "",
48
+ selOptions: [
49
+ {
50
+ code: "!~!",
51
+ feature: "featureA",
52
+ featDesc: "",
53
+ next: {
54
+ optionA: {
55
+ code: "optionA",
56
+ feature: "featureA",
57
+ featDesc: "",
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
+ features: [],
72
+ productData: {
73
+ sku: "B",
74
+ partsData: {
75
+ basePrice: 30,
76
+ currency: "EURO",
77
+ listPrice: 40,
78
+ pkgCount: 0,
79
+ selOptions: [],
80
+ styleNr: "",
81
+ },
82
+ additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
83
+ },
84
+ rootFeatureRefs: [],
85
+ });
86
+ const C = () => ({
87
+ uuid: "C",
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
+ features: [],
105
+ productData: {
106
+ sku: "D",
107
+ partsData: {
108
+ basePrice: 10,
109
+ currency: "EURO",
110
+ listPrice: 20,
111
+ pkgCount: 0,
112
+ selOptions: [],
113
+ styleNr: "",
114
+ },
115
+ },
116
+ rootFeatureRefs: [],
117
+ });
118
+ const E = () => ({
119
+ uuid: "E",
120
+ features: [],
121
+ productData: {
122
+ sku: "E",
123
+ partsData: {
124
+ basePrice: 15,
125
+ currency: "USD",
126
+ listPrice: 25,
127
+ pkgCount: 0,
128
+ selOptions: [],
129
+ styleNr: "",
130
+ },
131
+ },
132
+ rootFeatureRefs: [],
133
+ });
134
+ export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, function* () {
135
+ const partNumber = params.partNumber;
136
+ switch (partNumber) {
137
+ case "A":
138
+ return A();
139
+ case "B":
140
+ return B();
141
+ case "C":
142
+ return C();
143
+ case "D":
144
+ return D();
145
+ case "E":
146
+ return E();
147
+ }
148
+ throw new Error("No such part");
149
+ });
150
+ export function getSelOptions(option, feat) {
151
+ if (option === "optionB") {
152
+ return [
153
+ {
154
+ code: "!~!",
155
+ feature: feat,
156
+ featDesc: "",
157
+ next: {
158
+ optionB: {
159
+ code: "optionB",
160
+ feature: feat,
161
+ featDesc: "",
162
+ },
163
+ },
164
+ },
165
+ ];
166
+ }
167
+ else {
168
+ return [
169
+ {
170
+ code: "!~!",
171
+ feature: feat,
172
+ featDesc: "",
173
+ next: {
174
+ optionC: {
175
+ code: "optionC",
176
+ feature: feat,
177
+ featDesc: "",
178
+ },
179
+ },
180
+ },
181
+ ];
182
+ }
183
+ }
184
+ export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
185
+ const cfgProduct = yield CfgProduct.make({
186
+ getProduct: getTestProduct,
187
+ postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
188
+ const productData = (yield getTestProduct(params)).productData;
189
+ const feat = productData.partsData.selOptions[0].feature;
190
+ if (featureOption !== undefined) {
191
+ productData.partsData.selOptions = getSelOptions(featureOption, feat);
192
+ }
193
+ const validateResponse = {
194
+ uuid: "",
195
+ validated: true,
196
+ productData,
197
+ };
198
+ return validateResponse;
199
+ }),
200
+ }, "lang", dummyCatId, "A");
201
+ if (testFunc !== undefined) {
202
+ yield testFunc(cfgProduct);
203
+ }
204
+ return cfgProduct;
205
+ });
@@ -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