bruce-models 4.5.9 → 4.6.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.
@@ -1055,9 +1055,6 @@ var BruceApi;
1055
1055
  * @param params
1056
1056
  */
1057
1057
  ConstructUrl(params) {
1058
- if (!(params === null || params === void 0 ? void 0 : params.url)) {
1059
- return null;
1060
- }
1061
1058
  if ((params === null || params === void 0 ? void 0 : params.cdn) && this.cdnBaseUrl) {
1062
1059
  return this.ConstructCdnUrl(params.url, params.urlParams);
1063
1060
  }
@@ -1079,12 +1076,24 @@ var BruceApi;
1079
1076
  tmp.pathname += "/";
1080
1077
  }
1081
1078
  if (params === null || params === void 0 ? void 0 : params.url) {
1079
+ // Ensure we're only adding the path.
1080
+ // The baseUrl could have included query params so have this extra logic.
1081
+ const split = params.url.split("?");
1082
1082
  // Ensure the url does not start with a slash.
1083
1083
  // This is because the base url already has a slash at the end.
1084
- if (params.url.startsWith("/")) {
1085
- params.url = params.url.substring(1);
1084
+ let path = split[0];
1085
+ if (path.startsWith("/")) {
1086
+ path = path.substring(1);
1087
+ }
1088
+ tmp.pathname += path;
1089
+ // Append the query string if any exist.
1090
+ if (split.length > 1) {
1091
+ const query = split[1].split("&");
1092
+ for (let q of query) {
1093
+ const parts = q.split("=");
1094
+ tmp.searchParams.append(parts[0], parts[1]);
1095
+ }
1086
1096
  }
1087
- tmp.pathname += params.url;
1088
1097
  }
1089
1098
  return tmp.toString();
1090
1099
  }
@@ -1117,12 +1126,24 @@ var BruceApi;
1117
1126
  tmp.pathname += "/";
1118
1127
  }
1119
1128
  if (url) {
1129
+ // Ensure we're only adding the path.
1130
+ // The baseUrl could have included query params so have this extra logic.
1131
+ let split = url.split("?");
1120
1132
  // Ensure the url does not start with a slash.
1121
1133
  // This is because the base url already has a slash at the end.
1122
- if (url.startsWith("/")) {
1123
- url = url.substring(1);
1134
+ let path = split[0];
1135
+ if (path.startsWith("/")) {
1136
+ path = url.substring(1);
1137
+ }
1138
+ tmp.pathname += path;
1139
+ // Append the query string if any exist.
1140
+ if (split.length > 1) {
1141
+ const query = split[1].split("&");
1142
+ for (let q of query) {
1143
+ const parts = q.split("=");
1144
+ tmp.searchParams.append(parts[0], parts[1]);
1145
+ }
1124
1146
  }
1125
- tmp.pathname += url;
1126
1147
  }
1127
1148
  return tmp.toString();
1128
1149
  }
@@ -1134,8 +1155,14 @@ var BruceApi;
1134
1155
  */
1135
1156
  SetBaseUrl(url) {
1136
1157
  this.baseUrl = url;
1137
- if (!this.baseUrl.endsWith("/")) {
1138
- this.baseUrl += "/";
1158
+ // If we're setting a valid URL then we'll ensure it ends with a slash.
1159
+ if (this.baseUrl && (this.baseUrl.startsWith("http://") || this.baseUrl.startsWith("https://"))) {
1160
+ // Parsing into URL object to avoid adding a "/" after query params.
1161
+ const full = new URL(this.baseUrl);
1162
+ if (!full.pathname.endsWith("/")) {
1163
+ full.pathname += "/";
1164
+ }
1165
+ this.baseUrl = full.toString();
1139
1166
  }
1140
1167
  this.loadCancelled = true;
1141
1168
  }
@@ -13734,7 +13761,7 @@ var DataSource;
13734
13761
  })(DataSource || (DataSource = {}));
13735
13762
 
13736
13763
  // This is updated with the package.json version on build.
13737
- const VERSION = "4.5.9";
13764
+ const VERSION = "4.6.0";
13738
13765
 
13739
13766
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
13740
13767
  //# sourceMappingURL=bruce-models.es5.js.map