@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,114 +1,114 @@
|
|
|
1
|
-
/** Rounds the supplied value to 3 decimal points. */
|
|
2
|
-
function round(v) {
|
|
3
|
-
return Math.round(v * 1000) / 1000;
|
|
4
|
-
}
|
|
5
|
-
export class NumericValuesSelection {
|
|
6
|
-
constructor(rawRanges) {
|
|
7
|
-
if (rawRanges.length === 0) {
|
|
8
|
-
throw new Error("A numeric values selection must have at least one value");
|
|
9
|
-
}
|
|
10
|
-
this.ranges = rawRanges.map((rawRange) => {
|
|
11
|
-
const { minValue, maxValue } = rawRange;
|
|
12
|
-
if (minValue === maxValue) {
|
|
13
|
-
return new NumericValueDiscrete(minValue);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return new NumericValueRangeDefinition(rawRange);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
includesValue(value) {
|
|
21
|
-
return this.ranges.some((range) => range.includesValue(value));
|
|
22
|
-
}
|
|
23
|
-
get first() {
|
|
24
|
-
return this.ranges[0].first;
|
|
25
|
-
}
|
|
26
|
-
get legend() {
|
|
27
|
-
return this.ranges
|
|
28
|
-
.sort((l, r) => l.first - r.first)
|
|
29
|
-
.map((range) => range.legend)
|
|
30
|
-
.join(", ");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export class NumericValueDiscrete {
|
|
34
|
-
constructor(value) {
|
|
35
|
-
this.value = value;
|
|
36
|
-
}
|
|
37
|
-
includesValue(value) {
|
|
38
|
-
return value === this.value;
|
|
39
|
-
}
|
|
40
|
-
get first() {
|
|
41
|
-
return this.value;
|
|
42
|
-
}
|
|
43
|
-
get legend() {
|
|
44
|
-
return `${round(this.value)}`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const ACCEPTABLE_STEP_DEVIATION = 0.0000001;
|
|
48
|
-
export class NumericValueRangeDefinition {
|
|
49
|
-
constructor(rawRange) {
|
|
50
|
-
const { minValue, maxValue, increment } = rawRange;
|
|
51
|
-
this.minValue = minValue;
|
|
52
|
-
this.maxValue = maxValue;
|
|
53
|
-
this.increment = increment === 0 ? undefined : increment;
|
|
54
|
-
}
|
|
55
|
-
includesValue(value) {
|
|
56
|
-
const { minValue: start, maxValue: end, increment: step } = this;
|
|
57
|
-
if (value < start || end < value) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
// This comparison would often fail due to the fact that all the values used are
|
|
61
|
-
// base-2 (binary) floating point numbers based on base-10 (decimal) input strings.
|
|
62
|
-
//
|
|
63
|
-
// Such calculations are often not 100% accurate as is visible in JS by simply
|
|
64
|
-
// computing "0.1 + 0.2" which should equal about "0.30000000000000004" != "0.3".
|
|
65
|
-
//
|
|
66
|
-
// We have used the easiest workaround, to simply be a bit fuzzy with the checks and
|
|
67
|
-
// allow values that are very, very close to being on a step.
|
|
68
|
-
//
|
|
69
|
-
// This workaround comes with two major compromises:
|
|
70
|
-
// 1. The fuzziness needed depends on how many steps the checked values pass on the way.
|
|
71
|
-
// 2. An infinite number of numbers will be included in the range since many an "infinite"
|
|
72
|
-
// number of values close to each step will map to it.
|
|
73
|
-
//
|
|
74
|
-
// The proper fix is probably to use a fixed point mathematics, where we either define a
|
|
75
|
-
// maximum of say 6 decimals or the number of decimals vary on the number of decimals given
|
|
76
|
-
// in the JSON for each value.
|
|
77
|
-
//
|
|
78
|
-
// This should work given that the input in CatCreator is decimal (human created string) and
|
|
79
|
-
// both XML and JSON uses string based decimal numbers. One question mark remains however,
|
|
80
|
-
// and that is how the numbers are stored in CatCreator if you use a db3-file. If it is a
|
|
81
|
-
// string there as well, everything is dandy. Otherwise we might get problems with rounding
|
|
82
|
-
// or infinite decimals during the conversions to/from the db3-file.
|
|
83
|
-
if (step === undefined) {
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
const deviation = (value - start) % step;
|
|
87
|
-
return (deviation < ACCEPTABLE_STEP_DEVIATION || step - deviation < ACCEPTABLE_STEP_DEVIATION);
|
|
88
|
-
}
|
|
89
|
-
get first() {
|
|
90
|
-
return this.minValue;
|
|
91
|
-
}
|
|
92
|
-
get legend() {
|
|
93
|
-
const { minValue, maxValue, increment } = this;
|
|
94
|
-
if (increment === undefined) {
|
|
95
|
-
return `[${round(minValue)} ... ${round(maxValue)}]`;
|
|
96
|
-
}
|
|
97
|
-
const steps = 1 + Math.floor((maxValue - minValue) / increment);
|
|
98
|
-
let legend = `[${round(minValue)}`;
|
|
99
|
-
if (increment !== undefined && 3 <= steps) {
|
|
100
|
-
legend += `, ${round(minValue + increment)}`;
|
|
101
|
-
}
|
|
102
|
-
if (5 <= steps) {
|
|
103
|
-
legend += " ... ";
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
legend += ", ";
|
|
107
|
-
}
|
|
108
|
-
if (4 <= steps) {
|
|
109
|
-
legend += `${round(minValue + increment * (steps - 2))}, `;
|
|
110
|
-
}
|
|
111
|
-
legend += `${round(minValue + increment * (steps - 1))}]`;
|
|
112
|
-
return legend;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
1
|
+
/** Rounds the supplied value to 3 decimal points. */
|
|
2
|
+
function round(v) {
|
|
3
|
+
return Math.round(v * 1000) / 1000;
|
|
4
|
+
}
|
|
5
|
+
export class NumericValuesSelection {
|
|
6
|
+
constructor(rawRanges) {
|
|
7
|
+
if (rawRanges.length === 0) {
|
|
8
|
+
throw new Error("A numeric values selection must have at least one value");
|
|
9
|
+
}
|
|
10
|
+
this.ranges = rawRanges.map((rawRange) => {
|
|
11
|
+
const { minValue, maxValue } = rawRange;
|
|
12
|
+
if (minValue === maxValue) {
|
|
13
|
+
return new NumericValueDiscrete(minValue);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return new NumericValueRangeDefinition(rawRange);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
includesValue(value) {
|
|
21
|
+
return this.ranges.some((range) => range.includesValue(value));
|
|
22
|
+
}
|
|
23
|
+
get first() {
|
|
24
|
+
return this.ranges[0].first;
|
|
25
|
+
}
|
|
26
|
+
get legend() {
|
|
27
|
+
return this.ranges
|
|
28
|
+
.sort((l, r) => l.first - r.first)
|
|
29
|
+
.map((range) => range.legend)
|
|
30
|
+
.join(", ");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export class NumericValueDiscrete {
|
|
34
|
+
constructor(value) {
|
|
35
|
+
this.value = value;
|
|
36
|
+
}
|
|
37
|
+
includesValue(value) {
|
|
38
|
+
return value === this.value;
|
|
39
|
+
}
|
|
40
|
+
get first() {
|
|
41
|
+
return this.value;
|
|
42
|
+
}
|
|
43
|
+
get legend() {
|
|
44
|
+
return `${round(this.value)}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const ACCEPTABLE_STEP_DEVIATION = 0.0000001;
|
|
48
|
+
export class NumericValueRangeDefinition {
|
|
49
|
+
constructor(rawRange) {
|
|
50
|
+
const { minValue, maxValue, increment } = rawRange;
|
|
51
|
+
this.minValue = minValue;
|
|
52
|
+
this.maxValue = maxValue;
|
|
53
|
+
this.increment = increment === 0 ? undefined : increment;
|
|
54
|
+
}
|
|
55
|
+
includesValue(value) {
|
|
56
|
+
const { minValue: start, maxValue: end, increment: step } = this;
|
|
57
|
+
if (value < start || end < value) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// This comparison would often fail due to the fact that all the values used are
|
|
61
|
+
// base-2 (binary) floating point numbers based on base-10 (decimal) input strings.
|
|
62
|
+
//
|
|
63
|
+
// Such calculations are often not 100% accurate as is visible in JS by simply
|
|
64
|
+
// computing "0.1 + 0.2" which should equal about "0.30000000000000004" != "0.3".
|
|
65
|
+
//
|
|
66
|
+
// We have used the easiest workaround, to simply be a bit fuzzy with the checks and
|
|
67
|
+
// allow values that are very, very close to being on a step.
|
|
68
|
+
//
|
|
69
|
+
// This workaround comes with two major compromises:
|
|
70
|
+
// 1. The fuzziness needed depends on how many steps the checked values pass on the way.
|
|
71
|
+
// 2. An infinite number of numbers will be included in the range since many an "infinite"
|
|
72
|
+
// number of values close to each step will map to it.
|
|
73
|
+
//
|
|
74
|
+
// The proper fix is probably to use a fixed point mathematics, where we either define a
|
|
75
|
+
// maximum of say 6 decimals or the number of decimals vary on the number of decimals given
|
|
76
|
+
// in the JSON for each value.
|
|
77
|
+
//
|
|
78
|
+
// This should work given that the input in CatCreator is decimal (human created string) and
|
|
79
|
+
// both XML and JSON uses string based decimal numbers. One question mark remains however,
|
|
80
|
+
// and that is how the numbers are stored in CatCreator if you use a db3-file. If it is a
|
|
81
|
+
// string there as well, everything is dandy. Otherwise we might get problems with rounding
|
|
82
|
+
// or infinite decimals during the conversions to/from the db3-file.
|
|
83
|
+
if (step === undefined) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
const deviation = (value - start) % step;
|
|
87
|
+
return (deviation < ACCEPTABLE_STEP_DEVIATION || step - deviation < ACCEPTABLE_STEP_DEVIATION);
|
|
88
|
+
}
|
|
89
|
+
get first() {
|
|
90
|
+
return this.minValue;
|
|
91
|
+
}
|
|
92
|
+
get legend() {
|
|
93
|
+
const { minValue, maxValue, increment } = this;
|
|
94
|
+
if (increment === undefined) {
|
|
95
|
+
return `[${round(minValue)} ... ${round(maxValue)}]`;
|
|
96
|
+
}
|
|
97
|
+
const steps = 1 + Math.floor((maxValue - minValue) / increment);
|
|
98
|
+
let legend = `[${round(minValue)}`;
|
|
99
|
+
if (increment !== undefined && 3 <= steps) {
|
|
100
|
+
legend += `, ${round(minValue + increment)}`;
|
|
101
|
+
}
|
|
102
|
+
if (5 <= steps) {
|
|
103
|
+
legend += " ... ";
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
legend += ", ";
|
|
107
|
+
}
|
|
108
|
+
if (4 <= steps) {
|
|
109
|
+
legend += `${round(minValue + increment * (steps - 2))}, `;
|
|
110
|
+
}
|
|
111
|
+
legend += `${round(minValue + increment * (steps - 1))}]`;
|
|
112
|
+
return legend;
|
|
113
|
+
}
|
|
114
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-api",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@configura/web-utilities": "2.2.0-alpha.
|
|
26
|
+
"@configura/web-utilities": "2.2.0-alpha.3"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "4ae8d9c7420c14d68d6053e44e76abacd1432b81"
|
|
29
29
|
}
|