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.
@@ -1041,51 +1041,11 @@ var BruceApi;
1041
1041
  if ((params === null || params === void 0 ? void 0 : params.cdn) && this.cdnBaseUrl) {
1042
1042
  return this.ConstructCdnUrl(params.url, params.urlParams);
1043
1043
  }
1044
- const tmp = new URL(this.baseUrl);
1045
- if (params === null || params === void 0 ? void 0 : params.urlParams) {
1046
- if (params.urlParams instanceof URLSearchParams) {
1047
- params.urlParams.forEach((value, key) => {
1048
- tmp.searchParams.append(key, value);
1049
- });
1050
- }
1051
- else {
1052
- for (const key in params.urlParams) {
1053
- tmp.searchParams.append(key, params.urlParams[key]);
1054
- }
1055
- }
1056
- }
1057
- // Ensure the url ends with a slash.
1058
- if (!tmp.pathname.endsWith("/")) {
1059
- tmp.pathname += "/";
1060
- }
1061
- let split;
1062
- if (params === null || params === void 0 ? void 0 : params.url) {
1063
- // Ensure we're only adding the path.
1064
- // The baseUrl could have included query params so have this extra logic.
1065
- split = params.url.split("?");
1066
- // Ensure the url does not start with a slash.
1067
- // This is because the base url already has a slash at the end.
1068
- let path = split[0];
1069
- if (path.startsWith("/")) {
1070
- path = path.substring(1);
1071
- }
1072
- tmp.pathname += path;
1073
- }
1074
- let full = tmp.toString();
1075
- // Append the query string if any exist.
1076
- if (split && split.length > 1) {
1077
- const query = split[1].split("&");
1078
- for (let q of query) {
1079
- if (full.includes("?")) {
1080
- full += "&";
1081
- }
1082
- else {
1083
- full += "?";
1084
- }
1085
- full += q;
1086
- }
1087
- }
1088
- return full;
1044
+ return UrlUtils.ConstructUrl({
1045
+ existing: this.baseUrl,
1046
+ url: params === null || params === void 0 ? void 0 : params.url,
1047
+ urlParams: params === null || params === void 0 ? void 0 : params.urlParams
1048
+ });
1089
1049
  }
1090
1050
  /**
1091
1051
  * Returns a url routed through the API's CDN.
@@ -1098,51 +1058,11 @@ var BruceApi;
1098
1058
  if (!this.cdnBaseUrl) {
1099
1059
  return null;
1100
1060
  }
1101
- const tmp = new URL(this.cdnBaseUrl);
1102
- if (urlParams) {
1103
- if (urlParams instanceof URLSearchParams) {
1104
- urlParams.forEach((value, key) => {
1105
- tmp.searchParams.append(key, value);
1106
- });
1107
- }
1108
- else {
1109
- for (const key in urlParams) {
1110
- tmp.searchParams.append(key, urlParams[key]);
1111
- }
1112
- }
1113
- }
1114
- // Ensure the url ends with a slash.
1115
- if (!tmp.pathname.endsWith("/")) {
1116
- tmp.pathname += "/";
1117
- }
1118
- let split;
1119
- if (url) {
1120
- // Ensure we're only adding the path.
1121
- // The baseUrl could have included query params so have this extra logic.
1122
- split = url.split("?");
1123
- // Ensure the url does not start with a slash.
1124
- // This is because the base url already has a slash at the end.
1125
- let path = split[0];
1126
- if (path.startsWith("/")) {
1127
- path = url.substring(1);
1128
- }
1129
- tmp.pathname += path;
1130
- }
1131
- let full = tmp.toString();
1132
- // Append the query string if any exist.
1133
- if (split && split.length > 1) {
1134
- const query = split[1].split("&");
1135
- for (let q of query) {
1136
- if (full.includes("?")) {
1137
- full += "&";
1138
- }
1139
- else {
1140
- full += "?";
1141
- }
1142
- full += q;
1143
- }
1144
- }
1145
- return full;
1061
+ return UrlUtils.ConstructUrl({
1062
+ existing: this.cdnBaseUrl,
1063
+ url: url,
1064
+ urlParams: urlParams
1065
+ });
1146
1066
  }
1147
1067
  /**
1148
1068
  * Warning: This will cancel the init process.
@@ -13495,6 +13415,58 @@ var UrlUtils;
13495
13415
  return urlObj.toString();
13496
13416
  }
13497
13417
  UrlUtils.AddQueryParam = AddQueryParam;
13418
+ /**
13419
+ * Returns a url with the provided url appended to the provided existing url.
13420
+ * @param params
13421
+ */
13422
+ function ConstructUrl(params) {
13423
+ const tmp = new URL(params.existing);
13424
+ if (params === null || params === void 0 ? void 0 : params.urlParams) {
13425
+ if (params.urlParams instanceof URLSearchParams) {
13426
+ params.urlParams.forEach((value, key) => {
13427
+ tmp.searchParams.append(key, value);
13428
+ });
13429
+ }
13430
+ else {
13431
+ for (const key in params.urlParams) {
13432
+ tmp.searchParams.append(key, params.urlParams[key]);
13433
+ }
13434
+ }
13435
+ }
13436
+ // Ensure the url ends with a slash.
13437
+ if (!tmp.pathname.endsWith("/")) {
13438
+ tmp.pathname += "/";
13439
+ }
13440
+ let split;
13441
+ if (params === null || params === void 0 ? void 0 : params.url) {
13442
+ // Ensure we're only adding the path.
13443
+ // 'existing' could have included query params so have this extra logic.
13444
+ split = params.url.split("?");
13445
+ // Ensure the url does not start with a slash.
13446
+ // This is because the existing url already has a slash at the end.
13447
+ let path = split[0];
13448
+ if (path.startsWith("/")) {
13449
+ path = path.substring(1);
13450
+ }
13451
+ tmp.pathname += path;
13452
+ }
13453
+ let full = tmp.toString();
13454
+ // Append the query string if any exist.
13455
+ if (split && split.length > 1) {
13456
+ const query = split[1].split("&");
13457
+ for (let q of query) {
13458
+ if (full.includes("?")) {
13459
+ full += "&";
13460
+ }
13461
+ else {
13462
+ full += "?";
13463
+ }
13464
+ full += q;
13465
+ }
13466
+ }
13467
+ return full;
13468
+ }
13469
+ UrlUtils.ConstructUrl = ConstructUrl;
13498
13470
  })(UrlUtils || (UrlUtils = {}));
13499
13471
 
13500
13472
  /**
@@ -14746,7 +14718,7 @@ var DataSource;
14746
14718
  })(DataSource || (DataSource = {}));
14747
14719
 
14748
14720
  // This is updated with the package.json version on build.
14749
- const VERSION = "5.3.4";
14721
+ const VERSION = "5.3.5";
14750
14722
 
14751
14723
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, 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, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14752
14724
  //# sourceMappingURL=bruce-models.es5.js.map