@configura/web-api 1.6.1 → 2.0.0-alpha.2

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 (98) hide show
  1. package/.eslintrc.json +18 -18
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +551 -507
  5. package/dist/CatalogueAPI.js +293 -280
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +268 -258
  9. package/dist/CfgProduct.js +778 -747
  10. package/dist/CfgReferencePathHelper.d.ts +14 -0
  11. package/dist/CfgReferencePathHelper.js +13 -0
  12. package/dist/ConfigurationConverter.d.ts +5 -0
  13. package/dist/ConfigurationConverter.js +72 -0
  14. package/dist/index.d.ts +23 -20
  15. package/dist/index.js +23 -20
  16. package/dist/io/CfgHistoryManager.d.ts +51 -0
  17. package/dist/io/CfgHistoryManager.js +82 -0
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -0
  19. package/dist/io/CfgHistoryToProdConfConnector.js +56 -0
  20. package/dist/io/CfgIOManager.d.ts +49 -0
  21. package/dist/io/CfgIOManager.js +115 -0
  22. package/dist/io/CfgIOProdConfConnector.d.ts +53 -0
  23. package/dist/io/CfgIOProdConfConnector.js +141 -0
  24. package/dist/io/CfgObservableStateManager.d.ts +22 -0
  25. package/dist/io/CfgObservableStateManager.js +65 -0
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -0
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -0
  28. package/dist/io/CfgWindowEventManager.d.ts +22 -0
  29. package/dist/io/CfgWindowEventManager.js +38 -0
  30. package/dist/io/CfgWindowMessageManager.d.ts +41 -0
  31. package/dist/io/CfgWindowMessageManager.js +84 -0
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -0
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -0
  34. package/dist/io/index.d.ts +9 -0
  35. package/dist/io/index.js +8 -0
  36. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  37. package/dist/material/CfgMaterialMapping.js +181 -181
  38. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  39. package/dist/material/CfgMtrlApplication.js +43 -43
  40. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  41. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  42. package/dist/material/CfgMtrlSource.d.ts +19 -19
  43. package/dist/material/CfgMtrlSource.js +40 -40
  44. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  45. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  46. package/dist/productConfiguration/CfgFeature.d.ts +187 -188
  47. package/dist/productConfiguration/CfgFeature.js +645 -636
  48. package/dist/productConfiguration/CfgOption.d.ts +151 -150
  49. package/dist/productConfiguration/CfgOption.js +416 -426
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +117 -120
  51. package/dist/productConfiguration/CfgProductConfiguration.js +307 -309
  52. package/dist/productConfiguration/filters.d.ts +15 -15
  53. package/dist/productConfiguration/filters.js +70 -70
  54. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  55. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  56. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  57. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  58. package/dist/productLoader.d.ts +33 -33
  59. package/dist/productLoader.js +49 -49
  60. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  61. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  62. package/dist/syncGroups/SyncGroupsHandler.d.ts +40 -40
  63. package/dist/syncGroups/SyncGroupsHandler.js +359 -358
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  66. package/dist/syncGroups/SyncGroupsState.d.ts +35 -35
  67. package/dist/syncGroups/SyncGroupsState.js +125 -125
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  69. package/dist/syncGroups/SyncGroupsTransaction.js +576 -576
  70. package/dist/tasks/TaskHandler.d.ts +77 -78
  71. package/dist/tasks/TaskHandler.js +275 -276
  72. package/dist/tasks/formats.d.ts +4 -4
  73. package/dist/tasks/formats.js +7 -7
  74. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  75. package/dist/tests/testData/collectorForTest.js +194 -194
  76. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  77. package/dist/tests/testData/dummyProductForTest.js +32 -36
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +277 -277
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +185 -185
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  84. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  85. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  86. package/dist/tests/testData/testDataOptions.d.ts +12 -12
  87. package/dist/tests/testData/testDataOptions.js +60 -60
  88. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  89. package/dist/tests/testData/testDataProductAggregatedPrice.js +187 -187
  90. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  91. package/dist/tests/testData/testDataUpcharge.js +119 -119
  92. package/dist/utilitiesCatalogueData.d.ts +42 -31
  93. package/dist/utilitiesCatalogueData.js +173 -162
  94. package/dist/utilitiesCataloguePermission.d.ts +38 -37
  95. package/dist/utilitiesCataloguePermission.js +79 -80
  96. package/dist/utilitiesNumericValues.d.ts +24 -24
  97. package/dist/utilitiesNumericValues.js +109 -109
  98. package/package.json +3 -3
@@ -1,109 +1,109 @@
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
- export class NumericValueRangeDefinition {
48
- constructor(rawRange) {
49
- const { minValue, maxValue, increment } = rawRange;
50
- this.minValue = minValue;
51
- this.maxValue = maxValue;
52
- this.increment = increment === 0 ? undefined : increment;
53
- }
54
- includesValue(value) {
55
- const { minValue: start, maxValue: end, increment: step } = this;
56
- if (value < start || end < value) {
57
- return false;
58
- }
59
- // TODO: This comparison will often fail due to the fact that all the values used are
60
- // base-2 (binary) floating point numbers based on base-10 (decimal) input strings.
61
- //
62
- // Such calculations are often not 100% accurate as is visible in JS by simply
63
- // computing "0.1 + 0.2" which should equal about "0.30000000000000004" != "0.3".
64
- //
65
- // The easiest workaround is to define an static accuracy, say "6 decimals" and round
66
- // everything when comparing. One could also use a scaled version of Number.EPSILON to
67
- // dynamically match the precision to the precision of the input numbers.
68
- //
69
- // Both workarounds share the same problem however; an infinite number of numbers will be
70
- // included in the range since an "infinite" number of values will map to the same rounded
71
- // actual number.
72
- //
73
- // The proper fix is probably to use a fixed point mathematics, where we either define a
74
- // maximum of say 6 decimals or the number of decimals vary on the number of decimals given
75
- // in the JSON for each value.
76
- //
77
- // This should work given that the input in CatCreator is decimal (human created string) and
78
- // both XML and JSON uses string based decimal numbers. One question mark remains however,
79
- // and that is how the numbers are stored in CatCreator if you use a db3-file. If it is a
80
- // string there as well, everything is dandy. Otherwise we might get problems with rounding
81
- // or infinite decimals during the conversions to/from the db3-file.
82
- return step === undefined || (value - start) % step === 0;
83
- }
84
- get first() {
85
- return this.minValue;
86
- }
87
- get legend() {
88
- const { minValue, maxValue, increment } = this;
89
- if (increment === undefined) {
90
- return `[${round(minValue)} ... ${round(maxValue)}]`;
91
- }
92
- const steps = 1 + Math.floor((maxValue - minValue) / increment);
93
- let legend = `[${round(minValue)}`;
94
- if (increment !== undefined && 3 <= steps) {
95
- legend += `, ${round(minValue + increment)}`;
96
- }
97
- if (5 <= steps) {
98
- legend += " ... ";
99
- }
100
- else {
101
- legend += ", ";
102
- }
103
- if (4 <= steps) {
104
- legend += `${round(minValue + increment * (steps - 2))}, `;
105
- }
106
- legend += `${round(minValue + increment * (steps - 1))}]`;
107
- return legend;
108
- }
109
- }
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
+ export class NumericValueRangeDefinition {
48
+ constructor(rawRange) {
49
+ const { minValue, maxValue, increment } = rawRange;
50
+ this.minValue = minValue;
51
+ this.maxValue = maxValue;
52
+ this.increment = increment === 0 ? undefined : increment;
53
+ }
54
+ includesValue(value) {
55
+ const { minValue: start, maxValue: end, increment: step } = this;
56
+ if (value < start || end < value) {
57
+ return false;
58
+ }
59
+ // TODO: This comparison will often fail due to the fact that all the values used are
60
+ // base-2 (binary) floating point numbers based on base-10 (decimal) input strings.
61
+ //
62
+ // Such calculations are often not 100% accurate as is visible in JS by simply
63
+ // computing "0.1 + 0.2" which should equal about "0.30000000000000004" != "0.3".
64
+ //
65
+ // The easiest workaround is to define an static accuracy, say "6 decimals" and round
66
+ // everything when comparing. One could also use a scaled version of Number.EPSILON to
67
+ // dynamically match the precision to the precision of the input numbers.
68
+ //
69
+ // Both workarounds share the same problem however; an infinite number of numbers will be
70
+ // included in the range since an "infinite" number of values will map to the same rounded
71
+ // actual number.
72
+ //
73
+ // The proper fix is probably to use a fixed point mathematics, where we either define a
74
+ // maximum of say 6 decimals or the number of decimals vary on the number of decimals given
75
+ // in the JSON for each value.
76
+ //
77
+ // This should work given that the input in CatCreator is decimal (human created string) and
78
+ // both XML and JSON uses string based decimal numbers. One question mark remains however,
79
+ // and that is how the numbers are stored in CatCreator if you use a db3-file. If it is a
80
+ // string there as well, everything is dandy. Otherwise we might get problems with rounding
81
+ // or infinite decimals during the conversions to/from the db3-file.
82
+ return step === undefined || (value - start) % step === 0;
83
+ }
84
+ get first() {
85
+ return this.minValue;
86
+ }
87
+ get legend() {
88
+ const { minValue, maxValue, increment } = this;
89
+ if (increment === undefined) {
90
+ return `[${round(minValue)} ... ${round(maxValue)}]`;
91
+ }
92
+ const steps = 1 + Math.floor((maxValue - minValue) / increment);
93
+ let legend = `[${round(minValue)}`;
94
+ if (increment !== undefined && 3 <= steps) {
95
+ legend += `, ${round(minValue + increment)}`;
96
+ }
97
+ if (5 <= steps) {
98
+ legend += " ... ";
99
+ }
100
+ else {
101
+ legend += ", ";
102
+ }
103
+ if (4 <= steps) {
104
+ legend += `${round(minValue + increment * (steps - 2))}, `;
105
+ }
106
+ legend += `${round(minValue + increment * (steps - 1))}]`;
107
+ return legend;
108
+ }
109
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/web-api",
3
- "version": "1.6.1",
3
+ "version": "2.0.0-alpha.2",
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": "1.6.1"
26
+ "@configura/web-utilities": "2.0.0-alpha.2"
27
27
  },
28
- "gitHead": "bffef8762f32d8629a89837cafc20d34702409a3"
28
+ "gitHead": "70b1f8c6426c11420f00b031912e1023d3b591bf"
29
29
  }