@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.
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +448 -448
- package/dist/CatalogueAPI.js +206 -206
- package/dist/CfgProduct.d.ts +116 -116
- package/dist/CfgProduct.js +588 -588
- package/dist/index.d.ts +15 -15
- package/dist/index.js +15 -15
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +176 -176
- 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 +134 -80
- package/dist/productConfiguration/CfgFeature.js +483 -451
- package/dist/productConfiguration/CfgOption.d.ts +112 -64
- package/dist/productConfiguration/CfgOption.js +293 -263
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +50 -50
- package/dist/productConfiguration/CfgProductConfiguration.js +198 -198
- package/dist/productConfiguration/filters.d.ts +7 -7
- package/dist/productConfiguration/filters.js +29 -29
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +51 -51
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +9 -9
- package/dist/productConfiguration/utilitiesProductConfiguration.js +61 -61
- package/dist/productLoader.d.ts +11 -11
- package/dist/productLoader.js +41 -41
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +195 -195
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +35 -35
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +368 -368
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +199 -199
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +189 -189
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1117 -1117
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +28 -28
- package/dist/tests/testData/testDataProductAggregatedPrice.js +205 -205
- package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
- package/dist/tests/testData/testDataUpcharge.js +159 -159
- package/dist/utilitiesCatalogueData.d.ts +20 -18
- package/dist/utilitiesCatalogueData.js +64 -56
- package/dist/utilitiesCataloguePermission.d.ts +39 -39
- package/dist/utilitiesCataloguePermission.js +84 -84
- package/package.json +3 -3
|
@@ -1,195 +1,195 @@
|
|
|
1
|
-
export class Collector {
|
|
2
|
-
constructor(product) {
|
|
3
|
-
this.product = product;
|
|
4
|
-
this.notifications = [];
|
|
5
|
-
this.pushNotification = (message) => {
|
|
6
|
-
this.notifications.push(message);
|
|
7
|
-
};
|
|
8
|
-
this.takeSnapshot = () => {
|
|
9
|
-
return this.takeRefSnapshotForWrapper("", this.product);
|
|
10
|
-
};
|
|
11
|
-
this.compareSnapshot = (o, n) => {
|
|
12
|
-
const result = [];
|
|
13
|
-
this.compareSnapshotForWrapper(result, o, n);
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
this.takeRefSnapshotForWrapper = (path, product) => {
|
|
17
|
-
path += `prdwrap ${product.refKey || product.partNumber} `;
|
|
18
|
-
return {
|
|
19
|
-
path,
|
|
20
|
-
selected: product.selected,
|
|
21
|
-
ref: product,
|
|
22
|
-
productConfiguration: this.takeRefSnapshopForConf(path, product.configuration),
|
|
23
|
-
additionalProducts: product.additionalProducts.map((additionalProduct) => this.takeRefSnapshotForWrapper(path, additionalProduct)),
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
this.compareSnapshotForWrapper = (result, o, n) => {
|
|
27
|
-
if (o.path !== n.path) {
|
|
28
|
-
result.push(`No longer same path ${o.path}, ${n.path}`);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (o.ref !== n.ref) {
|
|
32
|
-
result.push(`New ref ${n.path}${o.ref.optional
|
|
33
|
-
? `Was ${o.selected ? "selected " : "deselected"} Now ${n.selected ? "selected " : "deselected"}`
|
|
34
|
-
: ""} `);
|
|
35
|
-
}
|
|
36
|
-
this.compareSnapshopForConf(result, o.productConfiguration, n.productConfiguration);
|
|
37
|
-
const oAdditionals = o.additionalProducts.slice();
|
|
38
|
-
const nAdditionals = n.additionalProducts.slice();
|
|
39
|
-
for (const oAdditional of oAdditionals) {
|
|
40
|
-
const i = nAdditionals.findIndex((nAdditional) => oAdditional.path === nAdditional.path);
|
|
41
|
-
if (i === -1) {
|
|
42
|
-
result.push(`Removed additional product ${oAdditional.path}`);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
this.compareSnapshotForWrapper(result, oAdditional, nAdditionals[i]);
|
|
46
|
-
nAdditionals.splice(i, 1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
for (const nAdditional of nAdditionals) {
|
|
50
|
-
result.push(`Added additional product ${nAdditional.path}`);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
this.takeRefSnapshopForConf = (path, productConfiguration) => {
|
|
54
|
-
path += `cfg `;
|
|
55
|
-
return {
|
|
56
|
-
path,
|
|
57
|
-
ref: productConfiguration,
|
|
58
|
-
features: productConfiguration.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
this.compareSnapshopForConf = (result, o, n) => {
|
|
62
|
-
if (o.ref !== n.ref) {
|
|
63
|
-
result.push(`New ref ${n.path}`);
|
|
64
|
-
}
|
|
65
|
-
const oFeatures = o.features;
|
|
66
|
-
const nFeatures = n.features;
|
|
67
|
-
if (oFeatures.length !== nFeatures.length) {
|
|
68
|
-
result.push(`No longer same options for ${o.path}`);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
for (let i = 0; i < oFeatures.length; i++) {
|
|
72
|
-
this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
this.takeRefSnapshotForFeature = (path, feature) => {
|
|
76
|
-
path += `feature ${feature.code} `;
|
|
77
|
-
return {
|
|
78
|
-
path,
|
|
79
|
-
ref: feature,
|
|
80
|
-
options: feature.options.map((option) => this.takeRefSnapshotForOption(path, option)),
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
this.compareSnapshopForFeature = (result, o, n) => {
|
|
84
|
-
if (o.path !== n.path) {
|
|
85
|
-
result.push(`No longer same path ${o.path}, ${n.path}`);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (o.ref !== n.ref) {
|
|
89
|
-
result.push(`New ref ${n.path}`);
|
|
90
|
-
}
|
|
91
|
-
const oOptions = o.options;
|
|
92
|
-
const nOptions = n.options;
|
|
93
|
-
if (oOptions.length !== nOptions.length) {
|
|
94
|
-
result.push(`No longer same features for ${o.path}`);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
for (let i = 0; i < oOptions.length; i++) {
|
|
98
|
-
this.compareSnapshopForOption(result, oOptions[i], nOptions[i]);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
this.takeRefSnapshotForOption = (path, option) => {
|
|
102
|
-
path += `option ${option.code} `;
|
|
103
|
-
return {
|
|
104
|
-
path,
|
|
105
|
-
ref: option,
|
|
106
|
-
selected: option.selected,
|
|
107
|
-
features: option.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
this.compareSnapshopForOption = (result, o, n) => {
|
|
111
|
-
if (o.path !== n.path) {
|
|
112
|
-
result.push(`No longer same path ${o.path}, ${n.path}`);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (o.ref !== n.ref) {
|
|
116
|
-
result.push(`New ref ${n.path} Was ${o.selected ? "selected" : "deselected"} Now ${n.selected ? "selected" : "deselected"}`);
|
|
117
|
-
}
|
|
118
|
-
const oFeatures = o.features;
|
|
119
|
-
const nFeatures = n.features;
|
|
120
|
-
if (oFeatures.length !== nFeatures.length) {
|
|
121
|
-
result.push(`No longer same options for ${o.path}`);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
for (let i = 0; i < oFeatures.length; i++) {
|
|
125
|
-
this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
this.addListenersForProduct = (path, product) => {
|
|
129
|
-
path += `prdwrap ${product.refKey || product.partNumber} `;
|
|
130
|
-
product.listenForChange(() => {
|
|
131
|
-
this.pushNotification(`${path}${product.optional ? `${product.selected ? "selected" : "deselected"}` : ""}`);
|
|
132
|
-
});
|
|
133
|
-
this.addListenersForProductConfiguration(path, product.configuration);
|
|
134
|
-
for (const additionalProduct of product.additionalProducts) {
|
|
135
|
-
this.addListenersForProduct(path, additionalProduct);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
this.addListenersForProductConfiguration = (path, productConfiguration) => {
|
|
139
|
-
path += `cfg `;
|
|
140
|
-
productConfiguration.listenForChange(() => {
|
|
141
|
-
this.pushNotification(path);
|
|
142
|
-
});
|
|
143
|
-
for (const feature of productConfiguration.features) {
|
|
144
|
-
this.addListenersForFeature(path, feature);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
this.addListenersForFeature = (path, feature) => {
|
|
148
|
-
path += `feature ${feature.code} `;
|
|
149
|
-
feature.listenForChange(() => {
|
|
150
|
-
this.pushNotification(path);
|
|
151
|
-
});
|
|
152
|
-
for (const option of feature.options) {
|
|
153
|
-
this.addListenersForOption(path, option);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
this.addListenersForOption = (path, option) => {
|
|
157
|
-
path += `option ${option.code} `;
|
|
158
|
-
option.listenForChange(() => {
|
|
159
|
-
this.pushNotification(`${path}${option.selected ? "selected" : "deselected"}`);
|
|
160
|
-
});
|
|
161
|
-
for (const feature of option.features) {
|
|
162
|
-
this.addListenersForFeature(path, feature);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
let path = "";
|
|
166
|
-
this.addListenersForProduct(path, product);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
Collector.stripRefsForWrapper = (w) => {
|
|
170
|
-
return {
|
|
171
|
-
path: w.path,
|
|
172
|
-
selected: w.selected,
|
|
173
|
-
productConfiguration: Collector.stripRefsForConf(w.productConfiguration),
|
|
174
|
-
additionalProducts: w.additionalProducts.map(Collector.stripRefsForWrapper),
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
Collector.stripRefsForConf = (c) => {
|
|
178
|
-
return {
|
|
179
|
-
path: c.path,
|
|
180
|
-
features: c.features.map(Collector.stripRefsForFeature),
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
Collector.stripRefsForFeature = (f) => {
|
|
184
|
-
return {
|
|
185
|
-
path: f.path,
|
|
186
|
-
options: f.options.map(Collector.stripRefsForOption),
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
Collector.stripRefsForOption = (o) => {
|
|
190
|
-
return {
|
|
191
|
-
path: o.path,
|
|
192
|
-
selected: o.selected,
|
|
193
|
-
features: o.features.map(Collector.stripRefsForFeature),
|
|
194
|
-
};
|
|
195
|
-
};
|
|
1
|
+
export class Collector {
|
|
2
|
+
constructor(product) {
|
|
3
|
+
this.product = product;
|
|
4
|
+
this.notifications = [];
|
|
5
|
+
this.pushNotification = (message) => {
|
|
6
|
+
this.notifications.push(message);
|
|
7
|
+
};
|
|
8
|
+
this.takeSnapshot = () => {
|
|
9
|
+
return this.takeRefSnapshotForWrapper("", this.product);
|
|
10
|
+
};
|
|
11
|
+
this.compareSnapshot = (o, n) => {
|
|
12
|
+
const result = [];
|
|
13
|
+
this.compareSnapshotForWrapper(result, o, n);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
this.takeRefSnapshotForWrapper = (path, product) => {
|
|
17
|
+
path += `prdwrap ${product.refKey || product.partNumber} `;
|
|
18
|
+
return {
|
|
19
|
+
path,
|
|
20
|
+
selected: product.selected,
|
|
21
|
+
ref: product,
|
|
22
|
+
productConfiguration: this.takeRefSnapshopForConf(path, product.configuration),
|
|
23
|
+
additionalProducts: product.additionalProducts.map((additionalProduct) => this.takeRefSnapshotForWrapper(path, additionalProduct)),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
this.compareSnapshotForWrapper = (result, o, n) => {
|
|
27
|
+
if (o.path !== n.path) {
|
|
28
|
+
result.push(`No longer same path ${o.path}, ${n.path}`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (o.ref !== n.ref) {
|
|
32
|
+
result.push(`New ref ${n.path}${o.ref.optional
|
|
33
|
+
? `Was ${o.selected ? "selected " : "deselected"} Now ${n.selected ? "selected " : "deselected"}`
|
|
34
|
+
: ""} `);
|
|
35
|
+
}
|
|
36
|
+
this.compareSnapshopForConf(result, o.productConfiguration, n.productConfiguration);
|
|
37
|
+
const oAdditionals = o.additionalProducts.slice();
|
|
38
|
+
const nAdditionals = n.additionalProducts.slice();
|
|
39
|
+
for (const oAdditional of oAdditionals) {
|
|
40
|
+
const i = nAdditionals.findIndex((nAdditional) => oAdditional.path === nAdditional.path);
|
|
41
|
+
if (i === -1) {
|
|
42
|
+
result.push(`Removed additional product ${oAdditional.path}`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.compareSnapshotForWrapper(result, oAdditional, nAdditionals[i]);
|
|
46
|
+
nAdditionals.splice(i, 1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
for (const nAdditional of nAdditionals) {
|
|
50
|
+
result.push(`Added additional product ${nAdditional.path}`);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
this.takeRefSnapshopForConf = (path, productConfiguration) => {
|
|
54
|
+
path += `cfg `;
|
|
55
|
+
return {
|
|
56
|
+
path,
|
|
57
|
+
ref: productConfiguration,
|
|
58
|
+
features: productConfiguration.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
this.compareSnapshopForConf = (result, o, n) => {
|
|
62
|
+
if (o.ref !== n.ref) {
|
|
63
|
+
result.push(`New ref ${n.path}`);
|
|
64
|
+
}
|
|
65
|
+
const oFeatures = o.features;
|
|
66
|
+
const nFeatures = n.features;
|
|
67
|
+
if (oFeatures.length !== nFeatures.length) {
|
|
68
|
+
result.push(`No longer same options for ${o.path}`);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
for (let i = 0; i < oFeatures.length; i++) {
|
|
72
|
+
this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
this.takeRefSnapshotForFeature = (path, feature) => {
|
|
76
|
+
path += `feature ${feature.code} `;
|
|
77
|
+
return {
|
|
78
|
+
path,
|
|
79
|
+
ref: feature,
|
|
80
|
+
options: feature.options.map((option) => this.takeRefSnapshotForOption(path, option)),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
this.compareSnapshopForFeature = (result, o, n) => {
|
|
84
|
+
if (o.path !== n.path) {
|
|
85
|
+
result.push(`No longer same path ${o.path}, ${n.path}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (o.ref !== n.ref) {
|
|
89
|
+
result.push(`New ref ${n.path}`);
|
|
90
|
+
}
|
|
91
|
+
const oOptions = o.options;
|
|
92
|
+
const nOptions = n.options;
|
|
93
|
+
if (oOptions.length !== nOptions.length) {
|
|
94
|
+
result.push(`No longer same features for ${o.path}`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
for (let i = 0; i < oOptions.length; i++) {
|
|
98
|
+
this.compareSnapshopForOption(result, oOptions[i], nOptions[i]);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
this.takeRefSnapshotForOption = (path, option) => {
|
|
102
|
+
path += `option ${option.code} `;
|
|
103
|
+
return {
|
|
104
|
+
path,
|
|
105
|
+
ref: option,
|
|
106
|
+
selected: option.selected,
|
|
107
|
+
features: option.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
this.compareSnapshopForOption = (result, o, n) => {
|
|
111
|
+
if (o.path !== n.path) {
|
|
112
|
+
result.push(`No longer same path ${o.path}, ${n.path}`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (o.ref !== n.ref) {
|
|
116
|
+
result.push(`New ref ${n.path} Was ${o.selected ? "selected" : "deselected"} Now ${n.selected ? "selected" : "deselected"}`);
|
|
117
|
+
}
|
|
118
|
+
const oFeatures = o.features;
|
|
119
|
+
const nFeatures = n.features;
|
|
120
|
+
if (oFeatures.length !== nFeatures.length) {
|
|
121
|
+
result.push(`No longer same options for ${o.path}`);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
for (let i = 0; i < oFeatures.length; i++) {
|
|
125
|
+
this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
this.addListenersForProduct = (path, product) => {
|
|
129
|
+
path += `prdwrap ${product.refKey || product.partNumber} `;
|
|
130
|
+
product.listenForChange(() => {
|
|
131
|
+
this.pushNotification(`${path}${product.optional ? `${product.selected ? "selected" : "deselected"}` : ""}`);
|
|
132
|
+
});
|
|
133
|
+
this.addListenersForProductConfiguration(path, product.configuration);
|
|
134
|
+
for (const additionalProduct of product.additionalProducts) {
|
|
135
|
+
this.addListenersForProduct(path, additionalProduct);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
this.addListenersForProductConfiguration = (path, productConfiguration) => {
|
|
139
|
+
path += `cfg `;
|
|
140
|
+
productConfiguration.listenForChange(() => {
|
|
141
|
+
this.pushNotification(path);
|
|
142
|
+
});
|
|
143
|
+
for (const feature of productConfiguration.features) {
|
|
144
|
+
this.addListenersForFeature(path, feature);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
this.addListenersForFeature = (path, feature) => {
|
|
148
|
+
path += `feature ${feature.code} `;
|
|
149
|
+
feature.listenForChange(() => {
|
|
150
|
+
this.pushNotification(path);
|
|
151
|
+
});
|
|
152
|
+
for (const option of feature.options) {
|
|
153
|
+
this.addListenersForOption(path, option);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
this.addListenersForOption = (path, option) => {
|
|
157
|
+
path += `option ${option.code} `;
|
|
158
|
+
option.listenForChange(() => {
|
|
159
|
+
this.pushNotification(`${path}${option.selected ? "selected" : "deselected"}`);
|
|
160
|
+
});
|
|
161
|
+
for (const feature of option.features) {
|
|
162
|
+
this.addListenersForFeature(path, feature);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
let path = "";
|
|
166
|
+
this.addListenersForProduct(path, product);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
Collector.stripRefsForWrapper = (w) => {
|
|
170
|
+
return {
|
|
171
|
+
path: w.path,
|
|
172
|
+
selected: w.selected,
|
|
173
|
+
productConfiguration: Collector.stripRefsForConf(w.productConfiguration),
|
|
174
|
+
additionalProducts: w.additionalProducts.map(Collector.stripRefsForWrapper),
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
Collector.stripRefsForConf = (c) => {
|
|
178
|
+
return {
|
|
179
|
+
path: c.path,
|
|
180
|
+
features: c.features.map(Collector.stripRefsForFeature),
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
Collector.stripRefsForFeature = (f) => {
|
|
184
|
+
return {
|
|
185
|
+
path: f.path,
|
|
186
|
+
options: f.options.map(Collector.stripRefsForOption),
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
Collector.stripRefsForOption = (o) => {
|
|
190
|
+
return {
|
|
191
|
+
path: o.path,
|
|
192
|
+
selected: o.selected,
|
|
193
|
+
features: o.features.map(Collector.stripRefsForFeature),
|
|
194
|
+
};
|
|
195
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CatalogueParams } from "../../CatalogueAPI";
|
|
2
|
-
import { CfgProduct } from "../../CfgProduct";
|
|
3
|
-
export declare const dummyCatId: CatalogueParams;
|
|
4
|
-
export declare const getDummyCfgProduct: () => Promise<CfgProduct>;
|
|
1
|
+
import { CatalogueParams } from "../../CatalogueAPI";
|
|
2
|
+
import { CfgProduct } from "../../CfgProduct";
|
|
3
|
+
export declare const dummyCatId: CatalogueParams;
|
|
4
|
+
export declare const getDummyCfgProduct: () => Promise<CfgProduct>;
|
|
5
5
|
//# sourceMappingURL=dummyProductForTest.d.ts.map
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { CfgProduct } from "../../CfgProduct";
|
|
2
|
-
export const dummyCatId = {
|
|
3
|
-
enterprise: "enterprise",
|
|
4
|
-
prdCat: "prdCat",
|
|
5
|
-
prdCatVersion: "prdCatVersion",
|
|
6
|
-
vendor: "vendor",
|
|
7
|
-
priceList: "priceList",
|
|
8
|
-
};
|
|
9
|
-
export const getDummyCfgProduct = () => CfgProduct.make({
|
|
10
|
-
getProduct: () => Promise.resolve({
|
|
11
|
-
features: [],
|
|
12
|
-
uuid: "uuid",
|
|
13
|
-
rootFeatureRefs: [],
|
|
14
|
-
productData: {
|
|
15
|
-
sku: "sku",
|
|
16
|
-
partsData: {
|
|
17
|
-
basePrice: 0,
|
|
18
|
-
currency: "",
|
|
19
|
-
listPrice: 0,
|
|
20
|
-
pkgCount: 0,
|
|
21
|
-
selOptions: [],
|
|
22
|
-
styleNr: "",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
}),
|
|
26
|
-
postValidate: () => {
|
|
27
|
-
throw new Error("Should not be used");
|
|
28
|
-
},
|
|
29
|
-
}, "lang", {
|
|
30
|
-
enterprise: "enterprise",
|
|
31
|
-
prdCat: "prdCat",
|
|
32
|
-
prdCatVersion: "prdCatVersion",
|
|
33
|
-
priceList: "priceList",
|
|
34
|
-
vendor: "vendor",
|
|
35
|
-
}, "partNumber");
|
|
1
|
+
import { CfgProduct } from "../../CfgProduct";
|
|
2
|
+
export const dummyCatId = {
|
|
3
|
+
enterprise: "enterprise",
|
|
4
|
+
prdCat: "prdCat",
|
|
5
|
+
prdCatVersion: "prdCatVersion",
|
|
6
|
+
vendor: "vendor",
|
|
7
|
+
priceList: "priceList",
|
|
8
|
+
};
|
|
9
|
+
export const getDummyCfgProduct = () => CfgProduct.make({
|
|
10
|
+
getProduct: () => Promise.resolve({
|
|
11
|
+
features: [],
|
|
12
|
+
uuid: "uuid",
|
|
13
|
+
rootFeatureRefs: [],
|
|
14
|
+
productData: {
|
|
15
|
+
sku: "sku",
|
|
16
|
+
partsData: {
|
|
17
|
+
basePrice: 0,
|
|
18
|
+
currency: "",
|
|
19
|
+
listPrice: 0,
|
|
20
|
+
pkgCount: 0,
|
|
21
|
+
selOptions: [],
|
|
22
|
+
styleNr: "",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
postValidate: () => {
|
|
27
|
+
throw new Error("Should not be used");
|
|
28
|
+
},
|
|
29
|
+
}, "lang", {
|
|
30
|
+
enterprise: "enterprise",
|
|
31
|
+
prdCat: "prdCat",
|
|
32
|
+
prdCatVersion: "prdCatVersion",
|
|
33
|
+
priceList: "priceList",
|
|
34
|
+
vendor: "vendor",
|
|
35
|
+
}, "partNumber");
|
package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
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 const cfgProductTest: (testFunc: (product: CfgProduct) => Promise<void>, prepFunc?: ((product: CfgProduct) => Promise<void>) | undefined) => Promise<{
|
|
6
|
-
beforeSnapshot: {
|
|
7
|
-
path: string;
|
|
8
|
-
selected: boolean;
|
|
9
|
-
} & {
|
|
10
|
-
productConfiguration: {
|
|
11
|
-
path: string;
|
|
12
|
-
};
|
|
13
|
-
additionalProducts: {
|
|
14
|
-
path: string;
|
|
15
|
-
selected: boolean;
|
|
16
|
-
}[];
|
|
17
|
-
};
|
|
18
|
-
afterSnapshot: {
|
|
19
|
-
path: string;
|
|
20
|
-
selected: boolean;
|
|
21
|
-
} & {
|
|
22
|
-
productConfiguration: {
|
|
23
|
-
path: string;
|
|
24
|
-
};
|
|
25
|
-
additionalProducts: {
|
|
26
|
-
path: string;
|
|
27
|
-
selected: boolean;
|
|
28
|
-
}[];
|
|
29
|
-
};
|
|
30
|
-
diff: string[];
|
|
31
|
-
notifications: string[];
|
|
32
|
-
}>;
|
|
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 const cfgProductTest: (testFunc: (product: CfgProduct) => Promise<void>, prepFunc?: ((product: CfgProduct) => Promise<void>) | undefined) => Promise<{
|
|
6
|
+
beforeSnapshot: {
|
|
7
|
+
path: string;
|
|
8
|
+
selected: boolean;
|
|
9
|
+
} & {
|
|
10
|
+
productConfiguration: {
|
|
11
|
+
path: string;
|
|
12
|
+
};
|
|
13
|
+
additionalProducts: {
|
|
14
|
+
path: string;
|
|
15
|
+
selected: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
afterSnapshot: {
|
|
19
|
+
path: string;
|
|
20
|
+
selected: boolean;
|
|
21
|
+
} & {
|
|
22
|
+
productConfiguration: {
|
|
23
|
+
path: string;
|
|
24
|
+
};
|
|
25
|
+
additionalProducts: {
|
|
26
|
+
path: string;
|
|
27
|
+
selected: boolean;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
diff: string[];
|
|
31
|
+
notifications: string[];
|
|
32
|
+
}>;
|
|
33
33
|
//# sourceMappingURL=testDataAdditionalProductInAdditionalProductInProductForTest.d.ts.map
|