bruce-models 5.3.4 → 5.3.5
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 +63 -91
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +63 -91
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/api/bruce-api.js +10 -90
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/util/url-utils.js +52 -0
- package/dist/lib/util/url-utils.js.map +1 -1
- package/dist/types/account/account.d.ts +3 -0
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/util/url-utils.d.ts +10 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1032,51 +1032,11 @@
|
|
|
1032
1032
|
if ((params === null || params === void 0 ? void 0 : params.cdn) && this.cdnBaseUrl) {
|
|
1033
1033
|
return this.ConstructCdnUrl(params.url, params.urlParams);
|
|
1034
1034
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
1042
|
-
else {
|
|
1043
|
-
for (const key in params.urlParams) {
|
|
1044
|
-
tmp.searchParams.append(key, params.urlParams[key]);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
// Ensure the url ends with a slash.
|
|
1049
|
-
if (!tmp.pathname.endsWith("/")) {
|
|
1050
|
-
tmp.pathname += "/";
|
|
1051
|
-
}
|
|
1052
|
-
let split;
|
|
1053
|
-
if (params === null || params === void 0 ? void 0 : params.url) {
|
|
1054
|
-
// Ensure we're only adding the path.
|
|
1055
|
-
// The baseUrl could have included query params so have this extra logic.
|
|
1056
|
-
split = params.url.split("?");
|
|
1057
|
-
// Ensure the url does not start with a slash.
|
|
1058
|
-
// This is because the base url already has a slash at the end.
|
|
1059
|
-
let path = split[0];
|
|
1060
|
-
if (path.startsWith("/")) {
|
|
1061
|
-
path = path.substring(1);
|
|
1062
|
-
}
|
|
1063
|
-
tmp.pathname += path;
|
|
1064
|
-
}
|
|
1065
|
-
let full = tmp.toString();
|
|
1066
|
-
// Append the query string if any exist.
|
|
1067
|
-
if (split && split.length > 1) {
|
|
1068
|
-
const query = split[1].split("&");
|
|
1069
|
-
for (let q of query) {
|
|
1070
|
-
if (full.includes("?")) {
|
|
1071
|
-
full += "&";
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
full += "?";
|
|
1075
|
-
}
|
|
1076
|
-
full += q;
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
return full;
|
|
1035
|
+
return exports.UrlUtils.ConstructUrl({
|
|
1036
|
+
existing: this.baseUrl,
|
|
1037
|
+
url: params === null || params === void 0 ? void 0 : params.url,
|
|
1038
|
+
urlParams: params === null || params === void 0 ? void 0 : params.urlParams
|
|
1039
|
+
});
|
|
1080
1040
|
}
|
|
1081
1041
|
/**
|
|
1082
1042
|
* Returns a url routed through the API's CDN.
|
|
@@ -1089,51 +1049,11 @@
|
|
|
1089
1049
|
if (!this.cdnBaseUrl) {
|
|
1090
1050
|
return null;
|
|
1091
1051
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
else {
|
|
1100
|
-
for (const key in urlParams) {
|
|
1101
|
-
tmp.searchParams.append(key, urlParams[key]);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
// Ensure the url ends with a slash.
|
|
1106
|
-
if (!tmp.pathname.endsWith("/")) {
|
|
1107
|
-
tmp.pathname += "/";
|
|
1108
|
-
}
|
|
1109
|
-
let split;
|
|
1110
|
-
if (url) {
|
|
1111
|
-
// Ensure we're only adding the path.
|
|
1112
|
-
// The baseUrl could have included query params so have this extra logic.
|
|
1113
|
-
split = url.split("?");
|
|
1114
|
-
// Ensure the url does not start with a slash.
|
|
1115
|
-
// This is because the base url already has a slash at the end.
|
|
1116
|
-
let path = split[0];
|
|
1117
|
-
if (path.startsWith("/")) {
|
|
1118
|
-
path = url.substring(1);
|
|
1119
|
-
}
|
|
1120
|
-
tmp.pathname += path;
|
|
1121
|
-
}
|
|
1122
|
-
let full = tmp.toString();
|
|
1123
|
-
// Append the query string if any exist.
|
|
1124
|
-
if (split && split.length > 1) {
|
|
1125
|
-
const query = split[1].split("&");
|
|
1126
|
-
for (let q of query) {
|
|
1127
|
-
if (full.includes("?")) {
|
|
1128
|
-
full += "&";
|
|
1129
|
-
}
|
|
1130
|
-
else {
|
|
1131
|
-
full += "?";
|
|
1132
|
-
}
|
|
1133
|
-
full += q;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
return full;
|
|
1052
|
+
return exports.UrlUtils.ConstructUrl({
|
|
1053
|
+
existing: this.cdnBaseUrl,
|
|
1054
|
+
url: url,
|
|
1055
|
+
urlParams: urlParams
|
|
1056
|
+
});
|
|
1137
1057
|
}
|
|
1138
1058
|
/**
|
|
1139
1059
|
* Warning: This will cancel the init process.
|
|
@@ -13242,6 +13162,58 @@
|
|
|
13242
13162
|
return urlObj.toString();
|
|
13243
13163
|
}
|
|
13244
13164
|
UrlUtils.AddQueryParam = AddQueryParam;
|
|
13165
|
+
/**
|
|
13166
|
+
* Returns a url with the provided url appended to the provided existing url.
|
|
13167
|
+
* @param params
|
|
13168
|
+
*/
|
|
13169
|
+
function ConstructUrl(params) {
|
|
13170
|
+
const tmp = new URL(params.existing);
|
|
13171
|
+
if (params === null || params === void 0 ? void 0 : params.urlParams) {
|
|
13172
|
+
if (params.urlParams instanceof URLSearchParams) {
|
|
13173
|
+
params.urlParams.forEach((value, key) => {
|
|
13174
|
+
tmp.searchParams.append(key, value);
|
|
13175
|
+
});
|
|
13176
|
+
}
|
|
13177
|
+
else {
|
|
13178
|
+
for (const key in params.urlParams) {
|
|
13179
|
+
tmp.searchParams.append(key, params.urlParams[key]);
|
|
13180
|
+
}
|
|
13181
|
+
}
|
|
13182
|
+
}
|
|
13183
|
+
// Ensure the url ends with a slash.
|
|
13184
|
+
if (!tmp.pathname.endsWith("/")) {
|
|
13185
|
+
tmp.pathname += "/";
|
|
13186
|
+
}
|
|
13187
|
+
let split;
|
|
13188
|
+
if (params === null || params === void 0 ? void 0 : params.url) {
|
|
13189
|
+
// Ensure we're only adding the path.
|
|
13190
|
+
// 'existing' could have included query params so have this extra logic.
|
|
13191
|
+
split = params.url.split("?");
|
|
13192
|
+
// Ensure the url does not start with a slash.
|
|
13193
|
+
// This is because the existing url already has a slash at the end.
|
|
13194
|
+
let path = split[0];
|
|
13195
|
+
if (path.startsWith("/")) {
|
|
13196
|
+
path = path.substring(1);
|
|
13197
|
+
}
|
|
13198
|
+
tmp.pathname += path;
|
|
13199
|
+
}
|
|
13200
|
+
let full = tmp.toString();
|
|
13201
|
+
// Append the query string if any exist.
|
|
13202
|
+
if (split && split.length > 1) {
|
|
13203
|
+
const query = split[1].split("&");
|
|
13204
|
+
for (let q of query) {
|
|
13205
|
+
if (full.includes("?")) {
|
|
13206
|
+
full += "&";
|
|
13207
|
+
}
|
|
13208
|
+
else {
|
|
13209
|
+
full += "?";
|
|
13210
|
+
}
|
|
13211
|
+
full += q;
|
|
13212
|
+
}
|
|
13213
|
+
}
|
|
13214
|
+
return full;
|
|
13215
|
+
}
|
|
13216
|
+
UrlUtils.ConstructUrl = ConstructUrl;
|
|
13245
13217
|
})(exports.UrlUtils || (exports.UrlUtils = {}));
|
|
13246
13218
|
|
|
13247
13219
|
(function (DataLab) {
|
|
@@ -14465,7 +14437,7 @@
|
|
|
14465
14437
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
14466
14438
|
|
|
14467
14439
|
// This is updated with the package.json version on build.
|
|
14468
|
-
const VERSION = "5.3.
|
|
14440
|
+
const VERSION = "5.3.5";
|
|
14469
14441
|
|
|
14470
14442
|
exports.VERSION = VERSION;
|
|
14471
14443
|
exports.AbstractApi = AbstractApi;
|