@configura/web-api 2.2.0-alpha.1 → 2.2.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.
- package/.eslintrc.json +5 -5
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +633 -633
- package/dist/CatalogueAPI.js +312 -312
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +359 -344
- package/dist/CfgProduct.js +1005 -992
- package/dist/CfgReferencePathHelper.d.ts +26 -26
- package/dist/CfgReferencePathHelper.js +26 -26
- package/dist/index.d.ts +24 -24
- package/dist/index.js +24 -24
- package/dist/io/CfgHistoryManager.d.ts +83 -83
- package/dist/io/CfgHistoryManager.js +144 -144
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -21
- package/dist/io/CfgHistoryToProdConfConnector.js +50 -50
- package/dist/io/CfgIOManager.d.ts +53 -53
- package/dist/io/CfgIOManager.js +134 -134
- package/dist/io/CfgIOProdConfConnector.d.ts +54 -54
- package/dist/io/CfgIOProdConfConnector.js +139 -139
- package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
- package/dist/io/CfgIOWarningSupplier.js +1 -1
- package/dist/io/CfgObservableStateManager.d.ts +25 -25
- package/dist/io/CfgObservableStateManager.js +69 -69
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -15
- package/dist/io/CfgObservableStateToProdConfConnector.js +17 -17
- package/dist/io/CfgWindowEventManager.d.ts +21 -21
- package/dist/io/CfgWindowEventManager.js +38 -38
- package/dist/io/CfgWindowMessageManager.d.ts +40 -40
- package/dist/io/CfgWindowMessageManager.js +91 -91
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -17
- package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -19
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +8 -8
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +181 -181
- package/dist/material/CfgMtrlApplication.d.ts +18 -18
- package/dist/material/CfgMtrlApplication.js +43 -43
- package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
- package/dist/material/CfgMtrlApplicationSource.js +8 -8
- package/dist/material/CfgMtrlSource.d.ts +19 -19
- package/dist/material/CfgMtrlSource.js +40 -40
- package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
- package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
- package/dist/productConfiguration/CfgFeature.d.ts +199 -199
- package/dist/productConfiguration/CfgFeature.js +691 -691
- package/dist/productConfiguration/CfgOption.d.ts +160 -160
- package/dist/productConfiguration/CfgOption.js +464 -464
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +136 -129
- package/dist/productConfiguration/CfgProductConfiguration.js +355 -346
- package/dist/productConfiguration/filters.d.ts +17 -17
- package/dist/productConfiguration/filters.js +141 -141
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +65 -65
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
- package/dist/productConfiguration/utilitiesProductConfiguration.js +89 -87
- package/dist/productLoader.d.ts +33 -33
- package/dist/productLoader.js +49 -49
- package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
- package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
- package/dist/syncGroups/SyncGroupsHandler.d.ts +47 -47
- package/dist/syncGroups/SyncGroupsHandler.js +370 -370
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
- package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
- package/dist/syncGroups/SyncGroupsState.d.ts +39 -39
- package/dist/syncGroups/SyncGroupsState.js +167 -167
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
- package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
- package/dist/tasks/TaskHandler.d.ts +77 -77
- package/dist/tasks/TaskHandler.js +276 -276
- package/dist/tasks/formats.d.ts +4 -4
- package/dist/tasks/formats.js +7 -7
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +194 -194
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +32 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -282
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +187 -187
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +185 -185
- package/dist/tests/testData/testDataConstraints.d.ts +3 -3
- package/dist/tests/testData/testDataConstraints.js +174 -174
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
- package/dist/tests/testData/testDataOptions.d.ts +12 -12
- package/dist/tests/testData/testDataOptions.js +60 -60
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
- package/dist/tests/testData/testDataProductAggregatedPrice.js +189 -189
- package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
- package/dist/tests/testData/testDataUpcharge.js +121 -121
- package/dist/utilitiesCatalogueData.d.ts +47 -47
- package/dist/utilitiesCatalogueData.js +180 -180
- package/dist/utilitiesCataloguePermission.d.ts +38 -38
- package/dist/utilitiesCataloguePermission.js +79 -79
- package/dist/utilitiesConfiguration.d.ts +28 -28
- package/dist/utilitiesConfiguration.js +200 -200
- package/dist/utilitiesNumericValues.d.ts +24 -24
- package/dist/utilitiesNumericValues.js +114 -114
- package/package.json +3 -3
|
@@ -1,282 +1,282 @@
|
|
|
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 { Collector } from "./collectorForTest.js";
|
|
12
|
-
import { dummyCatId } from "./dummyProductForTest.js";
|
|
13
|
-
import { letterOptionCodeA, letterOptionCodeB, letterOptionCodeC, letterOptions, } from "./testDataOptions.js";
|
|
14
|
-
const A = () => ({
|
|
15
|
-
uuid: "A",
|
|
16
|
-
unit: "m",
|
|
17
|
-
features: [
|
|
18
|
-
{
|
|
19
|
-
code: "featureA",
|
|
20
|
-
description: "",
|
|
21
|
-
numericOrder: false,
|
|
22
|
-
options: [
|
|
23
|
-
Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
|
|
24
|
-
{ refKey: "C_0", catId: dummyCatId, partNumber: "C" },
|
|
25
|
-
{ refKey: "B_0", catId: dummyCatId, partNumber: "B" },
|
|
26
|
-
] }),
|
|
27
|
-
letterOptions[1],
|
|
28
|
-
Object.assign(Object.assign({}, letterOptions[2]), { additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }] }),
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
code: "featureX",
|
|
33
|
-
description: "",
|
|
34
|
-
numericOrder: false,
|
|
35
|
-
options: [...letterOptions],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
code: "featureNotUsed",
|
|
39
|
-
description: "",
|
|
40
|
-
numericOrder: false,
|
|
41
|
-
options: [...letterOptions],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
code: "featureOptionCSelectedAtStart",
|
|
45
|
-
description: "",
|
|
46
|
-
numericOrder: false,
|
|
47
|
-
options: [...letterOptions],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
code: "featureSelectMany",
|
|
51
|
-
description: "",
|
|
52
|
-
numericOrder: false,
|
|
53
|
-
options: [...letterOptions],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
productData: {
|
|
57
|
-
sku: "A",
|
|
58
|
-
partsData: {
|
|
59
|
-
basePrice: 0,
|
|
60
|
-
currency: "",
|
|
61
|
-
listPrice: 0,
|
|
62
|
-
pkgCount: 0,
|
|
63
|
-
styleNr: "",
|
|
64
|
-
selOptions: [
|
|
65
|
-
{
|
|
66
|
-
code: "!~!",
|
|
67
|
-
next: {
|
|
68
|
-
[letterOptionCodeA]: {
|
|
69
|
-
code: letterOptionCodeA,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
code: "!~!",
|
|
75
|
-
next: {
|
|
76
|
-
[letterOptionCodeB]: {
|
|
77
|
-
code: letterOptionCodeB,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
code: "!~!",
|
|
83
|
-
next: {
|
|
84
|
-
[letterOptionCodeC]: {
|
|
85
|
-
code: letterOptionCodeC,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
additionalProductRefs: [
|
|
92
|
-
{ refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
rootFeatureRefs: [
|
|
96
|
-
{ code: "featureA" },
|
|
97
|
-
{ code: "featureX" },
|
|
98
|
-
{ code: "featureOptionCSelectedAtStart" },
|
|
99
|
-
],
|
|
100
|
-
});
|
|
101
|
-
const B = () => ({
|
|
102
|
-
uuid: "B",
|
|
103
|
-
unit: "m",
|
|
104
|
-
features: [
|
|
105
|
-
{
|
|
106
|
-
code: "featureI",
|
|
107
|
-
description: "",
|
|
108
|
-
numericOrder: false,
|
|
109
|
-
options: [
|
|
110
|
-
{ code: "optionI0", description: "" },
|
|
111
|
-
{ code: "optionI1", description: "", featureRefs: [{ code: "featureII" }] },
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
code: "featureII",
|
|
116
|
-
description: "",
|
|
117
|
-
numericOrder: false,
|
|
118
|
-
options: [
|
|
119
|
-
{ code: "optionII0", description: "" },
|
|
120
|
-
{ code: "optionII1", description: "", featureRefs: [{ code: "featureIII" }] },
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
code: "featureIII",
|
|
125
|
-
description: "",
|
|
126
|
-
numericOrder: false,
|
|
127
|
-
options: [
|
|
128
|
-
{ code: "optionIII0", description: "" },
|
|
129
|
-
{ code: "optionIII1", description: "" },
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
productData: {
|
|
134
|
-
sku: "B",
|
|
135
|
-
partsData: {
|
|
136
|
-
basePrice: 0,
|
|
137
|
-
currency: "",
|
|
138
|
-
listPrice: 0,
|
|
139
|
-
pkgCount: 0,
|
|
140
|
-
selOptions: [
|
|
141
|
-
{
|
|
142
|
-
code: "!~!",
|
|
143
|
-
next: {
|
|
144
|
-
optionI0: {
|
|
145
|
-
code: "optionI0",
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
styleNr: "",
|
|
151
|
-
},
|
|
152
|
-
additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
|
|
153
|
-
},
|
|
154
|
-
rootFeatureRefs: [{ code: "featureI" }],
|
|
155
|
-
});
|
|
156
|
-
const C = () => ({
|
|
157
|
-
uuid: "C",
|
|
158
|
-
unit: "m",
|
|
159
|
-
features: [
|
|
160
|
-
{
|
|
161
|
-
code: "featureC",
|
|
162
|
-
description: "",
|
|
163
|
-
numericOrder: false,
|
|
164
|
-
options: [...letterOptions],
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
productData: {
|
|
168
|
-
sku: "C",
|
|
169
|
-
partsData: {
|
|
170
|
-
basePrice: 0,
|
|
171
|
-
currency: "",
|
|
172
|
-
listPrice: 0,
|
|
173
|
-
pkgCount: 0,
|
|
174
|
-
selOptions: [
|
|
175
|
-
{
|
|
176
|
-
code: "!~!",
|
|
177
|
-
next: {
|
|
178
|
-
[letterOptionCodeA]: {
|
|
179
|
-
code: letterOptionCodeA,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
styleNr: "",
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
rootFeatureRefs: [{ code: "featureC" }],
|
|
188
|
-
});
|
|
189
|
-
const D = () => ({
|
|
190
|
-
uuid: "D",
|
|
191
|
-
unit: "m",
|
|
192
|
-
features: [],
|
|
193
|
-
productData: {
|
|
194
|
-
sku: "D",
|
|
195
|
-
partsData: {
|
|
196
|
-
basePrice: 0,
|
|
197
|
-
currency: "",
|
|
198
|
-
listPrice: 0,
|
|
199
|
-
pkgCount: 0,
|
|
200
|
-
selOptions: [],
|
|
201
|
-
styleNr: "",
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
rootFeatureRefs: [],
|
|
205
|
-
});
|
|
206
|
-
export const getTestProduct = (params) => {
|
|
207
|
-
const partNumber = params.partNumber;
|
|
208
|
-
switch (partNumber) {
|
|
209
|
-
case "A":
|
|
210
|
-
return Promise.resolve(A());
|
|
211
|
-
case "B":
|
|
212
|
-
return Promise.resolve(B());
|
|
213
|
-
case "C":
|
|
214
|
-
return Promise.resolve(C());
|
|
215
|
-
case "D":
|
|
216
|
-
return Promise.resolve(D());
|
|
217
|
-
}
|
|
218
|
-
throw new Error("No such part");
|
|
219
|
-
};
|
|
220
|
-
export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0, void 0, function* () {
|
|
221
|
-
const product = yield CfgProduct.make({
|
|
222
|
-
getProduct: getTestProduct,
|
|
223
|
-
postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
224
|
-
const productData = (yield getTestProduct(params)).productData;
|
|
225
|
-
const partNumber = params.partNumber;
|
|
226
|
-
if (partNumber !== "D") {
|
|
227
|
-
productData.partsData.selOptions = [
|
|
228
|
-
{
|
|
229
|
-
code: "!~!",
|
|
230
|
-
next: {
|
|
231
|
-
[letterOptionCodeC]: {
|
|
232
|
-
code: letterOptionCodeC,
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
];
|
|
237
|
-
}
|
|
238
|
-
if (partNumber === "A") {
|
|
239
|
-
productData.partsData.selOptions.push({
|
|
240
|
-
code: "!~!",
|
|
241
|
-
next: {
|
|
242
|
-
[letterOptionCodeC]: {
|
|
243
|
-
code: letterOptionCodeC,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
});
|
|
247
|
-
productData.partsData.selOptions.push({
|
|
248
|
-
code: "!~!",
|
|
249
|
-
next: {
|
|
250
|
-
[letterOptionCodeC]: {
|
|
251
|
-
code: letterOptionCodeC,
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
const validateResponse = {
|
|
257
|
-
uuid: "",
|
|
258
|
-
unit: "m",
|
|
259
|
-
validated: true,
|
|
260
|
-
productData,
|
|
261
|
-
features: [],
|
|
262
|
-
};
|
|
263
|
-
collect.pushNotification(`Validate ${params.enterprise} ${params.prdCat} ${params.prdCatVersion} ${params.priceList} ${params.vendor} ${params.partNumber}`);
|
|
264
|
-
return validateResponse;
|
|
265
|
-
}),
|
|
266
|
-
}, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
|
|
267
|
-
if (prepFunc !== undefined) {
|
|
268
|
-
yield prepFunc(product);
|
|
269
|
-
}
|
|
270
|
-
const collect = new Collector(product);
|
|
271
|
-
const beforeSnapshot = collect.takeSnapshot();
|
|
272
|
-
yield testFunc(product);
|
|
273
|
-
const afterSnapshot = collect.takeSnapshot();
|
|
274
|
-
const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
|
|
275
|
-
const notifications = collect.notifications;
|
|
276
|
-
return {
|
|
277
|
-
beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
|
|
278
|
-
afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
|
|
279
|
-
diff,
|
|
280
|
-
notifications,
|
|
281
|
-
};
|
|
282
|
-
});
|
|
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 { Collector } from "./collectorForTest.js";
|
|
12
|
+
import { dummyCatId } from "./dummyProductForTest.js";
|
|
13
|
+
import { letterOptionCodeA, letterOptionCodeB, letterOptionCodeC, letterOptions, } from "./testDataOptions.js";
|
|
14
|
+
const A = () => ({
|
|
15
|
+
uuid: "A",
|
|
16
|
+
unit: "m",
|
|
17
|
+
features: [
|
|
18
|
+
{
|
|
19
|
+
code: "featureA",
|
|
20
|
+
description: "",
|
|
21
|
+
numericOrder: false,
|
|
22
|
+
options: [
|
|
23
|
+
Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
|
|
24
|
+
{ refKey: "C_0", catId: dummyCatId, partNumber: "C" },
|
|
25
|
+
{ refKey: "B_0", catId: dummyCatId, partNumber: "B" },
|
|
26
|
+
] }),
|
|
27
|
+
letterOptions[1],
|
|
28
|
+
Object.assign(Object.assign({}, letterOptions[2]), { additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }] }),
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
code: "featureX",
|
|
33
|
+
description: "",
|
|
34
|
+
numericOrder: false,
|
|
35
|
+
options: [...letterOptions],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
code: "featureNotUsed",
|
|
39
|
+
description: "",
|
|
40
|
+
numericOrder: false,
|
|
41
|
+
options: [...letterOptions],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
code: "featureOptionCSelectedAtStart",
|
|
45
|
+
description: "",
|
|
46
|
+
numericOrder: false,
|
|
47
|
+
options: [...letterOptions],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
code: "featureSelectMany",
|
|
51
|
+
description: "",
|
|
52
|
+
numericOrder: false,
|
|
53
|
+
options: [...letterOptions],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
productData: {
|
|
57
|
+
sku: "A",
|
|
58
|
+
partsData: {
|
|
59
|
+
basePrice: 0,
|
|
60
|
+
currency: "",
|
|
61
|
+
listPrice: 0,
|
|
62
|
+
pkgCount: 0,
|
|
63
|
+
styleNr: "",
|
|
64
|
+
selOptions: [
|
|
65
|
+
{
|
|
66
|
+
code: "!~!",
|
|
67
|
+
next: {
|
|
68
|
+
[letterOptionCodeA]: {
|
|
69
|
+
code: letterOptionCodeA,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
code: "!~!",
|
|
75
|
+
next: {
|
|
76
|
+
[letterOptionCodeB]: {
|
|
77
|
+
code: letterOptionCodeB,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
code: "!~!",
|
|
83
|
+
next: {
|
|
84
|
+
[letterOptionCodeC]: {
|
|
85
|
+
code: letterOptionCodeC,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
additionalProductRefs: [
|
|
92
|
+
{ refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
rootFeatureRefs: [
|
|
96
|
+
{ code: "featureA" },
|
|
97
|
+
{ code: "featureX" },
|
|
98
|
+
{ code: "featureOptionCSelectedAtStart" },
|
|
99
|
+
],
|
|
100
|
+
});
|
|
101
|
+
const B = () => ({
|
|
102
|
+
uuid: "B",
|
|
103
|
+
unit: "m",
|
|
104
|
+
features: [
|
|
105
|
+
{
|
|
106
|
+
code: "featureI",
|
|
107
|
+
description: "",
|
|
108
|
+
numericOrder: false,
|
|
109
|
+
options: [
|
|
110
|
+
{ code: "optionI0", description: "" },
|
|
111
|
+
{ code: "optionI1", description: "", featureRefs: [{ code: "featureII" }] },
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
code: "featureII",
|
|
116
|
+
description: "",
|
|
117
|
+
numericOrder: false,
|
|
118
|
+
options: [
|
|
119
|
+
{ code: "optionII0", description: "" },
|
|
120
|
+
{ code: "optionII1", description: "", featureRefs: [{ code: "featureIII" }] },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
code: "featureIII",
|
|
125
|
+
description: "",
|
|
126
|
+
numericOrder: false,
|
|
127
|
+
options: [
|
|
128
|
+
{ code: "optionIII0", description: "" },
|
|
129
|
+
{ code: "optionIII1", description: "" },
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
productData: {
|
|
134
|
+
sku: "B",
|
|
135
|
+
partsData: {
|
|
136
|
+
basePrice: 0,
|
|
137
|
+
currency: "",
|
|
138
|
+
listPrice: 0,
|
|
139
|
+
pkgCount: 0,
|
|
140
|
+
selOptions: [
|
|
141
|
+
{
|
|
142
|
+
code: "!~!",
|
|
143
|
+
next: {
|
|
144
|
+
optionI0: {
|
|
145
|
+
code: "optionI0",
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
styleNr: "",
|
|
151
|
+
},
|
|
152
|
+
additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
|
|
153
|
+
},
|
|
154
|
+
rootFeatureRefs: [{ code: "featureI" }],
|
|
155
|
+
});
|
|
156
|
+
const C = () => ({
|
|
157
|
+
uuid: "C",
|
|
158
|
+
unit: "m",
|
|
159
|
+
features: [
|
|
160
|
+
{
|
|
161
|
+
code: "featureC",
|
|
162
|
+
description: "",
|
|
163
|
+
numericOrder: false,
|
|
164
|
+
options: [...letterOptions],
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
productData: {
|
|
168
|
+
sku: "C",
|
|
169
|
+
partsData: {
|
|
170
|
+
basePrice: 0,
|
|
171
|
+
currency: "",
|
|
172
|
+
listPrice: 0,
|
|
173
|
+
pkgCount: 0,
|
|
174
|
+
selOptions: [
|
|
175
|
+
{
|
|
176
|
+
code: "!~!",
|
|
177
|
+
next: {
|
|
178
|
+
[letterOptionCodeA]: {
|
|
179
|
+
code: letterOptionCodeA,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
styleNr: "",
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
rootFeatureRefs: [{ code: "featureC" }],
|
|
188
|
+
});
|
|
189
|
+
const D = () => ({
|
|
190
|
+
uuid: "D",
|
|
191
|
+
unit: "m",
|
|
192
|
+
features: [],
|
|
193
|
+
productData: {
|
|
194
|
+
sku: "D",
|
|
195
|
+
partsData: {
|
|
196
|
+
basePrice: 0,
|
|
197
|
+
currency: "",
|
|
198
|
+
listPrice: 0,
|
|
199
|
+
pkgCount: 0,
|
|
200
|
+
selOptions: [],
|
|
201
|
+
styleNr: "",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
rootFeatureRefs: [],
|
|
205
|
+
});
|
|
206
|
+
export const getTestProduct = (params) => {
|
|
207
|
+
const partNumber = params.partNumber;
|
|
208
|
+
switch (partNumber) {
|
|
209
|
+
case "A":
|
|
210
|
+
return Promise.resolve(A());
|
|
211
|
+
case "B":
|
|
212
|
+
return Promise.resolve(B());
|
|
213
|
+
case "C":
|
|
214
|
+
return Promise.resolve(C());
|
|
215
|
+
case "D":
|
|
216
|
+
return Promise.resolve(D());
|
|
217
|
+
}
|
|
218
|
+
throw new Error("No such part");
|
|
219
|
+
};
|
|
220
|
+
export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0, void 0, function* () {
|
|
221
|
+
const product = yield CfgProduct.make({
|
|
222
|
+
getProduct: getTestProduct,
|
|
223
|
+
postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
224
|
+
const productData = (yield getTestProduct(params)).productData;
|
|
225
|
+
const partNumber = params.partNumber;
|
|
226
|
+
if (partNumber !== "D") {
|
|
227
|
+
productData.partsData.selOptions = [
|
|
228
|
+
{
|
|
229
|
+
code: "!~!",
|
|
230
|
+
next: {
|
|
231
|
+
[letterOptionCodeC]: {
|
|
232
|
+
code: letterOptionCodeC,
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
if (partNumber === "A") {
|
|
239
|
+
productData.partsData.selOptions.push({
|
|
240
|
+
code: "!~!",
|
|
241
|
+
next: {
|
|
242
|
+
[letterOptionCodeC]: {
|
|
243
|
+
code: letterOptionCodeC,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
productData.partsData.selOptions.push({
|
|
248
|
+
code: "!~!",
|
|
249
|
+
next: {
|
|
250
|
+
[letterOptionCodeC]: {
|
|
251
|
+
code: letterOptionCodeC,
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
const validateResponse = {
|
|
257
|
+
uuid: "",
|
|
258
|
+
unit: "m",
|
|
259
|
+
validated: true,
|
|
260
|
+
productData,
|
|
261
|
+
features: [],
|
|
262
|
+
};
|
|
263
|
+
collect.pushNotification(`Validate ${params.enterprise} ${params.prdCat} ${params.prdCatVersion} ${params.priceList} ${params.vendor} ${params.partNumber}`);
|
|
264
|
+
return validateResponse;
|
|
265
|
+
}),
|
|
266
|
+
}, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
|
|
267
|
+
if (prepFunc !== undefined) {
|
|
268
|
+
yield prepFunc(product);
|
|
269
|
+
}
|
|
270
|
+
const collect = new Collector(product);
|
|
271
|
+
const beforeSnapshot = collect.takeSnapshot();
|
|
272
|
+
yield testFunc(product);
|
|
273
|
+
const afterSnapshot = collect.takeSnapshot();
|
|
274
|
+
const diff = collect.compareSnapshot(beforeSnapshot, afterSnapshot);
|
|
275
|
+
const notifications = collect.notifications;
|
|
276
|
+
return {
|
|
277
|
+
beforeSnapshot: Collector.stripRefsForWrapper(beforeSnapshot),
|
|
278
|
+
afterSnapshot: Collector.stripRefsForWrapper(afterSnapshot),
|
|
279
|
+
diff,
|
|
280
|
+
notifications,
|
|
281
|
+
};
|
|
282
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DtoGetProductParams } from "../../CatalogueAPI.js";
|
|
2
|
-
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
|
-
import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
|
|
4
|
-
export declare const getTestProduct: (params: DtoGetProductParams, validateCall?: boolean | undefined) => Promise<CfgProductResponse>;
|
|
5
|
-
export declare const cachedProductLoaderTest: () => Promise<CfgProduct>;
|
|
1
|
+
import { DtoGetProductParams } from "../../CatalogueAPI.js";
|
|
2
|
+
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
|
+
import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
|
|
4
|
+
export declare const getTestProduct: (params: DtoGetProductParams, validateCall?: boolean | undefined) => Promise<CfgProductResponse>;
|
|
5
|
+
export declare const cachedProductLoaderTest: () => Promise<CfgProduct>;
|
|
6
6
|
//# sourceMappingURL=testDataCachedGetProduct.d.ts.map
|