@configura/web-api 2.0.0-alpha.12 → 2.0.0-alpha.13
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/dist/CfgProduct.js +2 -2
- package/dist/ConfigurationConverter.js +4 -11
- package/package.json +3 -3
package/dist/CfgProduct.js
CHANGED
|
@@ -653,8 +653,8 @@ export class CfgProduct {
|
|
|
653
653
|
*/
|
|
654
654
|
this.getApiSelection = () => convertDtoProductConfigurationToV1(this._internal.getDtoConfiguration(false, false), true);
|
|
655
655
|
this.getDtoConfiguration = (includeExtendedData = false, includeProductParams = false) => this._internal.getDtoConfiguration(includeExtendedData, includeProductParams);
|
|
656
|
-
this.setDtoConfiguration = (s, doValidate =
|
|
657
|
-
this.setApiSelection = (s, doValidate =
|
|
656
|
+
this.setDtoConfiguration = (s, doValidate = true) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.setDtoConfiguration(s, doValidate); });
|
|
657
|
+
this.setApiSelection = (s, doValidate = true) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.setApiSelection(s, doValidate); });
|
|
658
658
|
this.listenForChange = (l) => this._internal.changeObservable.listen(l);
|
|
659
659
|
this.stopListenForChange = (l) => this._internal.changeObservable.stopListen(l);
|
|
660
660
|
this.stopAllListenForChange = () => this._internal.changeObservable.stopAllListen();
|
|
@@ -72,8 +72,7 @@ const convertDtoOptionConfigurationToSelectedOption = (option, silenceWarnings)
|
|
|
72
72
|
};
|
|
73
73
|
const versionedRegex = /^v(\d+)(.+)$/;
|
|
74
74
|
const jsonKeyRegex = /"([^"]+)":/g;
|
|
75
|
-
const
|
|
76
|
-
const swapFromUrlAdaptedRegex = /[-~_]/g;
|
|
75
|
+
const swapForUrlAdaptedRegex = /[-~_{}"]/g;
|
|
77
76
|
const shortToLong = new Map();
|
|
78
77
|
const longToShort = new Map();
|
|
79
78
|
// The replacement scheme here assumes this will only be used for keys
|
|
@@ -99,7 +98,7 @@ for (const [long, short] of [
|
|
|
99
98
|
* As certain chars are abundant in JSON but less abundant in the actual data
|
|
100
99
|
* we swap these so that frequent characters do not need to be URL-encoded.
|
|
101
100
|
*/
|
|
102
|
-
const jsonStringSwapCharsForUrl = (data) => data.replace(
|
|
101
|
+
const jsonStringSwapCharsForUrl = (data) => data.replace(swapForUrlAdaptedRegex, (char) => {
|
|
103
102
|
switch (char) {
|
|
104
103
|
case "{":
|
|
105
104
|
return "~";
|
|
@@ -107,12 +106,6 @@ const jsonStringSwapCharsForUrl = (data) => data.replace(swapIntoUrlAdaptedRegex
|
|
|
107
106
|
return "-";
|
|
108
107
|
case '"':
|
|
109
108
|
return "_";
|
|
110
|
-
default:
|
|
111
|
-
throw new Error(`Unexpected char "${char}" in swap for URL`);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
const jsonStringSwapCharsFromUrl = (data) => data.replace(swapFromUrlAdaptedRegex, (char) => {
|
|
115
|
-
switch (char) {
|
|
116
109
|
case "~":
|
|
117
110
|
return "{";
|
|
118
111
|
case "-":
|
|
@@ -120,7 +113,7 @@ const jsonStringSwapCharsFromUrl = (data) => data.replace(swapFromUrlAdaptedRege
|
|
|
120
113
|
case "_":
|
|
121
114
|
return '"';
|
|
122
115
|
default:
|
|
123
|
-
throw new Error(`Unexpected char "${char}" in swap
|
|
116
|
+
throw new Error(`Unexpected char "${char}" in swap for URL`);
|
|
124
117
|
}
|
|
125
118
|
});
|
|
126
119
|
const compactDtoProductConfigurationJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = longToShort.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
|
|
@@ -145,5 +138,5 @@ export const compactStringToDtoProductConfiguration = (versionAndConf) => {
|
|
|
145
138
|
if (conf === "") {
|
|
146
139
|
throw new Error("No conf found");
|
|
147
140
|
}
|
|
148
|
-
return JSON.parse(expandDtoProductConfigurationJsonKeys(
|
|
141
|
+
return JSON.parse(expandDtoProductConfigurationJsonKeys(jsonStringSwapCharsForUrl(conf)));
|
|
149
142
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-api",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
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.0.0-alpha.
|
|
26
|
+
"@configura/web-utilities": "2.0.0-alpha.13"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "353bae03a3e4a79899f0c85b14b1d152c32e8a0f"
|
|
29
29
|
}
|