bruce-models 4.5.9 → 4.6.1
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/bruce-models.es5.js +47 -13
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +47 -13
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/bruce-api.js +46 -12
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1046,9 +1046,6 @@
|
|
|
1046
1046
|
* @param params
|
|
1047
1047
|
*/
|
|
1048
1048
|
ConstructUrl(params) {
|
|
1049
|
-
if (!(params === null || params === void 0 ? void 0 : params.url)) {
|
|
1050
|
-
return null;
|
|
1051
|
-
}
|
|
1052
1049
|
if ((params === null || params === void 0 ? void 0 : params.cdn) && this.cdnBaseUrl) {
|
|
1053
1050
|
return this.ConstructCdnUrl(params.url, params.urlParams);
|
|
1054
1051
|
}
|
|
@@ -1069,15 +1066,34 @@
|
|
|
1069
1066
|
if (!tmp.pathname.endsWith("/")) {
|
|
1070
1067
|
tmp.pathname += "/";
|
|
1071
1068
|
}
|
|
1069
|
+
let split;
|
|
1072
1070
|
if (params === null || params === void 0 ? void 0 : params.url) {
|
|
1071
|
+
// Ensure we're only adding the path.
|
|
1072
|
+
// The baseUrl could have included query params so have this extra logic.
|
|
1073
|
+
split = params.url.split("?");
|
|
1073
1074
|
// Ensure the url does not start with a slash.
|
|
1074
1075
|
// This is because the base url already has a slash at the end.
|
|
1075
|
-
|
|
1076
|
-
|
|
1076
|
+
let path = split[0];
|
|
1077
|
+
if (path.startsWith("/")) {
|
|
1078
|
+
path = path.substring(1);
|
|
1079
|
+
}
|
|
1080
|
+
tmp.pathname += path;
|
|
1081
|
+
}
|
|
1082
|
+
let full = tmp.toString();
|
|
1083
|
+
// Append the query string if any exist.
|
|
1084
|
+
if (split && split.length > 1) {
|
|
1085
|
+
const query = split[1].split("&");
|
|
1086
|
+
for (let q of query) {
|
|
1087
|
+
if (full.includes("?")) {
|
|
1088
|
+
full += "&";
|
|
1089
|
+
}
|
|
1090
|
+
else {
|
|
1091
|
+
full += "?";
|
|
1092
|
+
}
|
|
1093
|
+
full += q;
|
|
1077
1094
|
}
|
|
1078
|
-
tmp.pathname += params.url;
|
|
1079
1095
|
}
|
|
1080
|
-
return
|
|
1096
|
+
return full;
|
|
1081
1097
|
}
|
|
1082
1098
|
/**
|
|
1083
1099
|
* Returns a url routed through the API's CDN.
|
|
@@ -1108,12 +1124,24 @@
|
|
|
1108
1124
|
tmp.pathname += "/";
|
|
1109
1125
|
}
|
|
1110
1126
|
if (url) {
|
|
1127
|
+
// Ensure we're only adding the path.
|
|
1128
|
+
// The baseUrl could have included query params so have this extra logic.
|
|
1129
|
+
let split = url.split("?");
|
|
1111
1130
|
// Ensure the url does not start with a slash.
|
|
1112
1131
|
// This is because the base url already has a slash at the end.
|
|
1113
|
-
|
|
1114
|
-
|
|
1132
|
+
let path = split[0];
|
|
1133
|
+
if (path.startsWith("/")) {
|
|
1134
|
+
path = url.substring(1);
|
|
1135
|
+
}
|
|
1136
|
+
tmp.pathname += path;
|
|
1137
|
+
// Append the query string if any exist.
|
|
1138
|
+
if (split.length > 1) {
|
|
1139
|
+
const query = split[1].split("&");
|
|
1140
|
+
for (let q of query) {
|
|
1141
|
+
const parts = q.split("=");
|
|
1142
|
+
tmp.searchParams.append(parts[0], parts[1]);
|
|
1143
|
+
}
|
|
1115
1144
|
}
|
|
1116
|
-
tmp.pathname += url;
|
|
1117
1145
|
}
|
|
1118
1146
|
return tmp.toString();
|
|
1119
1147
|
}
|
|
@@ -1125,8 +1153,14 @@
|
|
|
1125
1153
|
*/
|
|
1126
1154
|
SetBaseUrl(url) {
|
|
1127
1155
|
this.baseUrl = url;
|
|
1128
|
-
|
|
1129
|
-
|
|
1156
|
+
// If we're setting a valid URL then we'll ensure it ends with a slash.
|
|
1157
|
+
if (this.baseUrl && (this.baseUrl.startsWith("http://") || this.baseUrl.startsWith("https://"))) {
|
|
1158
|
+
// Parsing into URL object to avoid adding a "/" after query params.
|
|
1159
|
+
const full = new URL(this.baseUrl);
|
|
1160
|
+
if (!full.pathname.endsWith("/")) {
|
|
1161
|
+
full.pathname += "/";
|
|
1162
|
+
}
|
|
1163
|
+
this.baseUrl = full.toString();
|
|
1130
1164
|
}
|
|
1131
1165
|
this.loadCancelled = true;
|
|
1132
1166
|
}
|
|
@@ -13463,7 +13497,7 @@
|
|
|
13463
13497
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13464
13498
|
|
|
13465
13499
|
// This is updated with the package.json version on build.
|
|
13466
|
-
const VERSION = "4.
|
|
13500
|
+
const VERSION = "4.6.1";
|
|
13467
13501
|
|
|
13468
13502
|
exports.VERSION = VERSION;
|
|
13469
13503
|
exports.AbstractApi = AbstractApi;
|