@configura/web-api 2.0.0 → 2.1.0-alpha.0

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 (100) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +622 -622
  5. package/dist/CatalogueAPI.js +329 -329
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +344 -344
  9. package/dist/CfgProduct.js +990 -991
  10. package/dist/CfgReferencePathHelper.d.ts +26 -26
  11. package/dist/CfgReferencePathHelper.js +26 -26
  12. package/dist/index.d.ts +23 -23
  13. package/dist/index.js +23 -23
  14. package/dist/io/CfgHistoryManager.d.ts +83 -83
  15. package/dist/io/CfgHistoryManager.js +144 -144
  16. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -21
  17. package/dist/io/CfgHistoryToProdConfConnector.js +50 -50
  18. package/dist/io/CfgIOManager.d.ts +53 -53
  19. package/dist/io/CfgIOManager.js +134 -134
  20. package/dist/io/CfgIOProdConfConnector.d.ts +54 -64
  21. package/dist/io/CfgIOProdConfConnector.js +137 -149
  22. package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
  23. package/dist/io/CfgIOWarningSupplier.js +1 -1
  24. package/dist/io/CfgObservableStateManager.d.ts +25 -25
  25. package/dist/io/CfgObservableStateManager.js +69 -69
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -14
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +17 -16
  28. package/dist/io/CfgWindowEventManager.d.ts +21 -21
  29. package/dist/io/CfgWindowEventManager.js +38 -38
  30. package/dist/io/CfgWindowMessageManager.d.ts +40 -40
  31. package/dist/io/CfgWindowMessageManager.js +91 -91
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -16
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -18
  34. package/dist/io/index.d.ts +8 -8
  35. package/dist/io/index.js +8 -8
  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 +192 -192
  47. package/dist/productConfiguration/CfgFeature.js +664 -663
  48. package/dist/productConfiguration/CfgOption.d.ts +157 -157
  49. package/dist/productConfiguration/CfgOption.js +444 -444
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +128 -128
  51. package/dist/productConfiguration/CfgProductConfiguration.js +331 -331
  52. package/dist/productConfiguration/filters.d.ts +17 -15
  53. package/dist/productConfiguration/filters.js +141 -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 +87 -87
  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 +47 -47
  63. package/dist/syncGroups/SyncGroupsHandler.js +370 -370
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  66. package/dist/syncGroups/SyncGroupsState.d.ts +39 -39
  67. package/dist/syncGroups/SyncGroupsState.js +167 -167
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  69. package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
  70. package/dist/tasks/TaskHandler.d.ts +77 -77
  71. package/dist/tasks/TaskHandler.js +276 -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 -32
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -282
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +187 -187
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +185 -185
  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 +189 -189
  90. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  91. package/dist/tests/testData/testDataUpcharge.js +121 -121
  92. package/dist/utilitiesCatalogueData.d.ts +47 -47
  93. package/dist/utilitiesCatalogueData.js +180 -180
  94. package/dist/utilitiesCataloguePermission.d.ts +38 -38
  95. package/dist/utilitiesCataloguePermission.js +79 -79
  96. package/dist/{ConfigurationConverter.d.ts → utilitiesConfiguration.d.ts} +29 -18
  97. package/dist/{ConfigurationConverter.js → utilitiesConfiguration.js} +200 -175
  98. package/dist/utilitiesNumericValues.d.ts +24 -24
  99. package/dist/utilitiesNumericValues.js +114 -114
  100. package/package.json +3 -3
@@ -1,175 +1,200 @@
1
- /** Is the newer version of product configuration */
2
- export const isProductConf = (value) => !("selOptions" in value);
3
- /** Is the older version of product configuration */
4
- export const isAdditionalProductConfiguration = (value) => "selOptions" in value;
5
- export const isDtoProductConfAdditional = (value) => "refKey" in value;
6
- // As this has potential to flood the terminal we only inform once
7
- let hasInformedAboutProdParams = false;
8
- let hasInformedAboutGroupCode = false;
9
- let hasInformedAboutUnit = false;
10
- export const convertDtoProductConfToV1 = (conf, silenceWarnings = false) => {
11
- var _a, _b;
12
- if (!silenceWarnings && conf.prodParams !== undefined && !hasInformedAboutProdParams) {
13
- hasInformedAboutProdParams = true;
14
- console.info("Incoming DtoProductConf contains prodParams. These will be ignored.");
15
- }
16
- const result = {
17
- selOptions: ((_a = conf.features) !== null && _a !== void 0 ? _a : []).map((f) => ({
18
- code: "!~!",
19
- next: convertDtoFeatureConfToApiSelection(f, silenceWarnings),
20
- })),
21
- additionalProducts: ((_b = conf.additionalProducts) !== null && _b !== void 0 ? _b : []).map((p) => convertDtoProductConfToV1(p, silenceWarnings)),
22
- selected: true,
23
- };
24
- if (isDtoProductConfAdditional(conf)) {
25
- result.refKey = conf.refKey;
26
- result.selected = conf.selected;
27
- }
28
- return result;
29
- };
30
- export const convertDtoFeatureConfsToSelOptions = (features, silenceWarnings = false) => (features !== null && features !== void 0 ? features : []).map((f) => ({
31
- code: "!~!",
32
- next: convertDtoFeatureConfToApiSelection(f, silenceWarnings),
33
- }));
34
- const convertDtoFeatureConfToApiSelection = (feature, silenceWarnings) => {
35
- const { groupCode, options, unit } = feature;
36
- if (!silenceWarnings && groupCode !== undefined && !hasInformedAboutGroupCode) {
37
- hasInformedAboutGroupCode = true;
38
- console.info("Incoming DtoFeature contains groupCode. It will be ignored.");
39
- }
40
- if (!silenceWarnings && unit !== undefined && !hasInformedAboutUnit) {
41
- hasInformedAboutUnit = true;
42
- console.info("Incoming DtoFeature contains a unit. It will be ignored.");
43
- }
44
- const result = {};
45
- for (const option of (options !== null && options !== void 0 ? options : []).filter((o) => o.selected)) {
46
- result[option.code] = convertDtoOptionConfToSelectedOption(option, silenceWarnings);
47
- }
48
- return result;
49
- };
50
- const convertDtoOptionConfToSelectedOption = (option, silenceWarnings) => {
51
- const { features, code, numericValue } = option;
52
- const selectionTrees = (features !== null && features !== void 0 ? features : []).map((f) => convertDtoFeatureConfToApiSelection(f, silenceWarnings));
53
- const mergedSelectionTree = {};
54
- let anyItems = false;
55
- for (const selectionTree of selectionTrees) {
56
- if (selectionTree === undefined) {
57
- continue;
58
- }
59
- for (const key of Object.keys(selectionTree)) {
60
- if (mergedSelectionTree[key] !== undefined) {
61
- console.warn(`The key (${key}) is already used in the selection tree. Option code: "${code}".`);
62
- continue;
63
- }
64
- mergedSelectionTree[key] = selectionTree[key];
65
- anyItems = true;
66
- }
67
- }
68
- const selectedOption = {
69
- code,
70
- numericValue,
71
- };
72
- if (anyItems) {
73
- selectedOption.next = mergedSelectionTree;
74
- }
75
- return selectedOption;
76
- };
77
- const versionedRegex = /^v(\d+)(.+)$/;
78
- const jsonKeyRegex = /"([^"]+)":/g;
79
- const swapForUrlAdaptedRegex = /[-~_{}"]/g;
80
- const shortToLong = new Map();
81
- const longToShort = new Map();
82
- // The replacement scheme here assumes this will only be used for keys
83
- // in DtoProductConf and the knowledge that it contains no one
84
- // one char keys.
85
- for (const [long, short] of [
86
- ["configuration", "c"],
87
- ["additionalProducts", "a"],
88
- ["prodParams", "p"],
89
- ["refKey", "r"],
90
- ["selected", "s"],
91
- ["features", "f"],
92
- ["code", "d"],
93
- ["options", "o"],
94
- ["numericValue", "n"],
95
- ["groupCode", "g"],
96
- ["unit", "u"],
97
- ["syncGroupState", "sgs"],
98
- ["selectOne", "so"],
99
- ["selectMany", "sm"],
100
- ["syncCode", "sc"],
101
- ["optionCode", "oc"],
102
- ]) {
103
- shortToLong.set(short, long);
104
- longToShort.set(long, short);
105
- }
106
- /**
107
- * As certain chars are abundant in JSON but less abundant in the actual data
108
- * we swap these so that frequent characters do not need to be URL-encoded.
109
- */
110
- const jsonStringSwapCharsForUrl = (data) => data.replace(swapForUrlAdaptedRegex, (char) => {
111
- switch (char) {
112
- case "{":
113
- return "~";
114
- case "}":
115
- return "-";
116
- case '"':
117
- return "_";
118
- case "~":
119
- return "{";
120
- case "-":
121
- return "}";
122
- case "_":
123
- return '"';
124
- default:
125
- throw new Error(`Unexpected char "${char}" in swap for URL`);
126
- }
127
- });
128
- const compactDtoProductConfJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = longToShort.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
129
- const expandDtoProductConfJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = shortToLong.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
130
- /**
131
- * Serializes and compacts the configuration into a format especially suited for URLs
132
- */
133
- export const dtoProductConfigurationToCompactString = (conf) => "v1" +
134
- jsonStringSwapCharsForUrl(compactDtoProductConfJsonKeys(JSON.stringify(conf, undefined, "")));
135
- /**
136
- * Deserializes and inflates the configuration from the compacted format
137
- */
138
- export const compactStringToDtoProductConf = (versionAndConf) => {
139
- const match = versionedRegex.exec(versionAndConf);
140
- if (match === null) {
141
- throw new Error("Could not match version string");
142
- }
143
- const [, version, conf] = match;
144
- if (version !== "1") {
145
- throw new Error("Unknown packed URL version");
146
- }
147
- if (conf === "") {
148
- throw new Error("No conf found");
149
- }
150
- return JSON.parse(expandDtoProductConfJsonKeys(jsonStringSwapCharsForUrl(conf)));
151
- };
152
- export const stripExtendedDataFromDtoProductConf = (conf) => {
153
- var _a, _b;
154
- return ({
155
- features: (_a = conf.features) === null || _a === void 0 ? void 0 : _a.map(stripExtendedDataFromDtoFeatureConf),
156
- additionalProducts: (_b = conf.additionalProducts) === null || _b === void 0 ? void 0 : _b.map(stripExtendedDataFromDtoAdditionalProductConfiguration),
157
- });
158
- };
159
- const stripExtendedDataFromDtoAdditionalProductConfiguration = (conf) => (Object.assign(Object.assign({}, stripExtendedDataFromDtoProductConf(conf)), { refKey: conf.refKey, selected: conf.selected }));
160
- const stripExtendedDataFromDtoFeatureConf = (conf) => {
161
- var _a;
162
- return ({
163
- code: conf.code,
164
- options: (_a = conf.options) === null || _a === void 0 ? void 0 : _a.map(stripExtendedDataFromDtoOptionConf),
165
- });
166
- };
167
- const stripExtendedDataFromDtoOptionConf = (conf) => {
168
- var _a;
169
- return ({
170
- code: conf.code,
171
- selected: conf.selected,
172
- numericValue: conf.numericValue,
173
- features: (_a = conf.features) === null || _a === void 0 ? void 0 : _a.map(stripExtendedDataFromDtoFeatureConf),
174
- });
175
- };
1
+ /**
2
+ * @param ExtendedData Extra data, i.e. units and groupCodes
3
+ * @param ProductParams What Product the conf is for, and the same for any Additional Products.
4
+ * @param SyncGroupState The current sync group state
5
+ */
6
+ export var CfgProdConfParts;
7
+ (function (CfgProdConfParts) {
8
+ CfgProdConfParts[CfgProdConfParts["NoExtra"] = 0] = "NoExtra";
9
+ CfgProdConfParts[CfgProdConfParts["ExtendedData"] = 1] = "ExtendedData";
10
+ CfgProdConfParts[CfgProdConfParts["ProdParams"] = 2] = "ProdParams";
11
+ CfgProdConfParts[CfgProdConfParts["SyncGroupState"] = 4] = "SyncGroupState";
12
+ })(CfgProdConfParts || (CfgProdConfParts = {}));
13
+ /** Is the newer version of product configuration */
14
+ export const isProductConf = (value) => !("selOptions" in value);
15
+ /** Is the older version of product configuration */
16
+ export const isAdditionalProductConfiguration = (value) => "selOptions" in value;
17
+ export const isDtoProductConfAdditional = (value) => "refKey" in value;
18
+ // As this has potential to flood the terminal we only inform once
19
+ let hasInformedAboutProdParams = false;
20
+ let hasInformedAboutGroupCode = false;
21
+ let hasInformedAboutUnit = false;
22
+ export const convertDtoProductConfToV1 = (conf, silenceWarnings = false) => {
23
+ var _a, _b;
24
+ if (!silenceWarnings && conf.prodParams !== undefined && !hasInformedAboutProdParams) {
25
+ hasInformedAboutProdParams = true;
26
+ console.info("Incoming DtoProductConf contains prodParams. These will be ignored.");
27
+ }
28
+ const result = {
29
+ selOptions: ((_a = conf.features) !== null && _a !== void 0 ? _a : []).map((f) => ({
30
+ code: "!~!",
31
+ next: convertDtoFeatureConfToApiSelection(f, silenceWarnings),
32
+ })),
33
+ additionalProducts: ((_b = conf.additionalProducts) !== null && _b !== void 0 ? _b : []).map((p) => convertDtoProductConfToV1(p, silenceWarnings)),
34
+ selected: true,
35
+ };
36
+ if (isDtoProductConfAdditional(conf)) {
37
+ result.refKey = conf.refKey;
38
+ result.selected = conf.selected;
39
+ }
40
+ return result;
41
+ };
42
+ export const convertDtoFeatureConfsToSelOptions = (features, silenceWarnings = false) => (features !== null && features !== void 0 ? features : []).map((f) => ({
43
+ code: "!~!",
44
+ next: convertDtoFeatureConfToApiSelection(f, silenceWarnings),
45
+ }));
46
+ const convertDtoFeatureConfToApiSelection = (feature, silenceWarnings) => {
47
+ const { groupCode, options, unit } = feature;
48
+ if (!silenceWarnings && groupCode !== undefined && !hasInformedAboutGroupCode) {
49
+ hasInformedAboutGroupCode = true;
50
+ console.info("Incoming DtoFeature contains groupCode. It will be ignored.");
51
+ }
52
+ if (!silenceWarnings && unit !== undefined && !hasInformedAboutUnit) {
53
+ hasInformedAboutUnit = true;
54
+ console.info("Incoming DtoFeature contains a unit. It will be ignored.");
55
+ }
56
+ const result = {};
57
+ for (const option of (options !== null && options !== void 0 ? options : []).filter((o) => o.selected)) {
58
+ result[option.code] = convertDtoOptionConfToSelectedOption(option, silenceWarnings);
59
+ }
60
+ return result;
61
+ };
62
+ const convertDtoOptionConfToSelectedOption = (option, silenceWarnings) => {
63
+ const { features, code, numericValue } = option;
64
+ const selectionTrees = (features !== null && features !== void 0 ? features : []).map((f) => convertDtoFeatureConfToApiSelection(f, silenceWarnings));
65
+ const mergedSelectionTree = {};
66
+ let anyItems = false;
67
+ for (const selectionTree of selectionTrees) {
68
+ if (selectionTree === undefined) {
69
+ continue;
70
+ }
71
+ for (const key of Object.keys(selectionTree)) {
72
+ if (mergedSelectionTree[key] !== undefined) {
73
+ console.warn(`The key (${key}) is already used in the selection tree. Option code: "${code}".`);
74
+ continue;
75
+ }
76
+ mergedSelectionTree[key] = selectionTree[key];
77
+ anyItems = true;
78
+ }
79
+ }
80
+ const selectedOption = {
81
+ code,
82
+ numericValue,
83
+ };
84
+ if (anyItems) {
85
+ selectedOption.next = mergedSelectionTree;
86
+ }
87
+ return selectedOption;
88
+ };
89
+ const versionedRegex = /^v(\d+)(.+)$/;
90
+ const jsonKeyRegex = /"([^"]+)":/g;
91
+ const swapForUrlAdaptedRegex = /[-~_{}"]/g;
92
+ const shortToLong = new Map();
93
+ const longToShort = new Map();
94
+ // The replacement scheme here assumes this will only be used for keys
95
+ // in DtoProductConf and the knowledge that it contains no one
96
+ // one char keys.
97
+ for (const [long, short] of [
98
+ ["configuration", "c"],
99
+ ["additionalProducts", "a"],
100
+ ["prodParams", "p"],
101
+ ["refKey", "r"],
102
+ ["selected", "s"],
103
+ ["features", "f"],
104
+ ["code", "d"],
105
+ ["options", "o"],
106
+ ["numericValue", "n"],
107
+ ["groupCode", "g"],
108
+ ["unit", "u"],
109
+ ["syncGroupState", "sgs"],
110
+ ["selectOne", "so"],
111
+ ["selectMany", "sm"],
112
+ ["syncCode", "sc"],
113
+ ["optionCode", "oc"],
114
+ ]) {
115
+ shortToLong.set(short, long);
116
+ longToShort.set(long, short);
117
+ }
118
+ /**
119
+ * As certain chars are abundant in JSON but less abundant in the actual data
120
+ * we swap these so that frequent characters do not need to be URL-encoded.
121
+ */
122
+ const jsonStringSwapCharsForUrl = (data) => data.replace(swapForUrlAdaptedRegex, (char) => {
123
+ switch (char) {
124
+ case "{":
125
+ return "~";
126
+ case "}":
127
+ return "-";
128
+ case '"':
129
+ return "_";
130
+ case "~":
131
+ return "{";
132
+ case "-":
133
+ return "}";
134
+ case "_":
135
+ return '"';
136
+ default:
137
+ throw new Error(`Unexpected char "${char}" in swap for URL`);
138
+ }
139
+ });
140
+ const compactDtoProductConfJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = longToShort.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
141
+ const expandDtoProductConfJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = shortToLong.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
142
+ /**
143
+ * Serializes and compacts the configuration into a format especially suited for URLs
144
+ */
145
+ export const dtoProductConfigurationToCompactString = (conf) => "v1" +
146
+ jsonStringSwapCharsForUrl(compactDtoProductConfJsonKeys(JSON.stringify(conf, undefined, "")));
147
+ /**
148
+ * Deserializes and inflates the configuration from the compacted format
149
+ */
150
+ export const compactStringToDtoProductConf = (versionAndConf) => {
151
+ const match = versionedRegex.exec(versionAndConf);
152
+ if (match === null) {
153
+ throw new Error("Could not match version string");
154
+ }
155
+ const [, version, conf] = match;
156
+ if (version !== "1") {
157
+ throw new Error("Unknown packed URL version");
158
+ }
159
+ if (conf === "") {
160
+ throw new Error("No conf found");
161
+ }
162
+ return JSON.parse(expandDtoProductConfJsonKeys(jsonStringSwapCharsForUrl(conf)));
163
+ };
164
+ export const stripExtendedDataFromDtoProductConf = (conf, toStrip) => {
165
+ var _a, _b;
166
+ const stripped = {
167
+ features: (_a = conf.features) === null || _a === void 0 ? void 0 : _a.map((f) => stripExtendedDataFromDtoFeatureConf(f, toStrip)),
168
+ additionalProducts: (_b = conf.additionalProducts) === null || _b === void 0 ? void 0 : _b.map(stripExtendedDataFromDtoAdditionalProductConfiguration),
169
+ };
170
+ if ((toStrip & CfgProdConfParts.SyncGroupState) !== CfgProdConfParts.SyncGroupState) {
171
+ stripped.syncGroupState = conf.syncGroupState;
172
+ }
173
+ if ((toStrip & CfgProdConfParts.ProdParams) !== CfgProdConfParts.ProdParams) {
174
+ stripped.prodParams = conf.prodParams;
175
+ }
176
+ return stripped;
177
+ };
178
+ const stripExtendedDataFromDtoAdditionalProductConfiguration = (conf, toStrip) => (Object.assign(Object.assign({}, stripExtendedDataFromDtoProductConf(conf, toStrip)), { refKey: conf.refKey, selected: conf.selected }));
179
+ const stripExtendedDataFromDtoFeatureConf = (conf, toStrip) => {
180
+ var _a;
181
+ const stripped = {
182
+ code: conf.code,
183
+ options: (_a = conf.options) === null || _a === void 0 ? void 0 : _a.map((o) => stripExtendedDataFromDtoOptionConf(o, toStrip)),
184
+ };
185
+ if ((toStrip & CfgProdConfParts.ExtendedData) !== CfgProdConfParts.ExtendedData) {
186
+ // Keep in sync with getDtoConf in CfgFeature
187
+ stripped.groupCode = conf.groupCode;
188
+ stripped.unit = conf.unit;
189
+ }
190
+ return stripped;
191
+ };
192
+ const stripExtendedDataFromDtoOptionConf = (conf, toStrip) => {
193
+ var _a;
194
+ return ({
195
+ code: conf.code,
196
+ selected: conf.selected,
197
+ numericValue: conf.numericValue,
198
+ features: (_a = conf.features) === null || _a === void 0 ? void 0 : _a.map((f) => stripExtendedDataFromDtoFeatureConf(f, toStrip)),
199
+ });
200
+ };
@@ -1,25 +1,25 @@
1
- import { DtoCodeRange } from "./CatalogueAPI.js";
2
- export declare class NumericValuesSelection {
3
- constructor(rawRanges: DtoCodeRange[]);
4
- readonly ranges: (NumericValueRangeDefinition | NumericValueDiscrete)[];
5
- includesValue(value: number): boolean;
6
- get first(): number;
7
- get legend(): string;
8
- }
9
- export declare class NumericValueDiscrete {
10
- readonly value: number;
11
- constructor(value: number);
12
- includesValue(value: number): boolean;
13
- get first(): number;
14
- get legend(): string;
15
- }
16
- export declare class NumericValueRangeDefinition {
17
- constructor(rawRange: DtoCodeRange);
18
- readonly minValue: number;
19
- readonly maxValue: number;
20
- readonly increment: number | undefined;
21
- includesValue(value: number): boolean;
22
- get first(): number;
23
- get legend(): string;
24
- }
1
+ import { DtoCodeRange } from "./CatalogueAPI.js";
2
+ export declare class NumericValuesSelection {
3
+ constructor(rawRanges: DtoCodeRange[]);
4
+ readonly ranges: (NumericValueRangeDefinition | NumericValueDiscrete)[];
5
+ includesValue(value: number): boolean;
6
+ get first(): number;
7
+ get legend(): string;
8
+ }
9
+ export declare class NumericValueDiscrete {
10
+ readonly value: number;
11
+ constructor(value: number);
12
+ includesValue(value: number): boolean;
13
+ get first(): number;
14
+ get legend(): string;
15
+ }
16
+ export declare class NumericValueRangeDefinition {
17
+ constructor(rawRange: DtoCodeRange);
18
+ readonly minValue: number;
19
+ readonly maxValue: number;
20
+ readonly increment: number | undefined;
21
+ includesValue(value: number): boolean;
22
+ get first(): number;
23
+ get legend(): string;
24
+ }
25
25
  //# sourceMappingURL=utilitiesNumericValues.d.ts.map