bruce-models 4.6.1 → 4.6.3

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.
@@ -641,8 +641,21 @@ var MessageBroker;
641
641
  }
642
642
  }
643
643
  formatApiUri(uri) {
644
- const ws = !window.document || window.document.location.protocol === "https:" ? "wss" : "ws";
645
- return uri.replace(/^(https|http)/, ws) + "websocket";
644
+ const wsProtocol = window.document.location.protocol === "https:" ? "wss" : "ws";
645
+ const currentUrl = new URL(uri);
646
+ let full = wsProtocol + "://" + currentUrl.host + currentUrl.pathname + "websocket";
647
+ // Check if we have a queryParam for accountId.
648
+ const accountId = currentUrl.searchParams.get("accountId");
649
+ if (accountId) {
650
+ if (full.includes("?")) {
651
+ full += "&";
652
+ }
653
+ else {
654
+ full += "?";
655
+ }
656
+ full += "accountId=" + accountId;
657
+ }
658
+ return full;
646
659
  }
647
660
  onOpen(ev) {
648
661
  if (this.env === Api.EEnv.DEV) {
@@ -1132,10 +1145,11 @@ var BruceApi;
1132
1145
  if (!tmp.pathname.endsWith("/")) {
1133
1146
  tmp.pathname += "/";
1134
1147
  }
1148
+ let split;
1135
1149
  if (url) {
1136
1150
  // Ensure we're only adding the path.
1137
1151
  // The baseUrl could have included query params so have this extra logic.
1138
- let split = url.split("?");
1152
+ split = url.split("?");
1139
1153
  // Ensure the url does not start with a slash.
1140
1154
  // This is because the base url already has a slash at the end.
1141
1155
  let path = split[0];
@@ -1143,16 +1157,22 @@ var BruceApi;
1143
1157
  path = url.substring(1);
1144
1158
  }
1145
1159
  tmp.pathname += path;
1146
- // Append the query string if any exist.
1147
- if (split.length > 1) {
1148
- const query = split[1].split("&");
1149
- for (let q of query) {
1150
- const parts = q.split("=");
1151
- tmp.searchParams.append(parts[0], parts[1]);
1160
+ }
1161
+ let full = tmp.toString();
1162
+ // Append the query string if any exist.
1163
+ if (split && split.length > 1) {
1164
+ const query = split[1].split("&");
1165
+ for (let q of query) {
1166
+ if (full.includes("?")) {
1167
+ full += "&";
1152
1168
  }
1169
+ else {
1170
+ full += "?";
1171
+ }
1172
+ full += q;
1153
1173
  }
1154
1174
  }
1155
- return tmp.toString();
1175
+ return full;
1156
1176
  }
1157
1177
  /**
1158
1178
  * Warning: This will cancel the init process.
@@ -3829,10 +3849,13 @@ var Entity;
3829
3849
  urlParams.set("schema", schemaId);
3830
3850
  }
3831
3851
  urlParams.set("hasMigrated", String(Boolean(migrated)));
3852
+ let url = analysis ? "entities/summary" : "entities";
3853
+ // Adding url params here because this will avoid making them encoded.
3854
+ // Our API isn't decoding them properly so $expand is not being recognized.
3855
+ url += "?" + urlParams.toString();
3832
3856
  const urlStr = api.ConstructUrl({
3833
3857
  cdn: !analysis && viaCdn,
3834
- url: analysis ? "entities/summary" : "entities",
3835
- urlParams: urlParams
3858
+ url: url
3836
3859
  });
3837
3860
  const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
3838
3861
  if (!analysis) {
@@ -3852,10 +3875,13 @@ var Entity;
3852
3875
  urlParams.set("schema", schemaId);
3853
3876
  }
3854
3877
  urlParams.set("hasMigrated", String(Boolean(migrated)));
3878
+ let url = analysis ? "entities/summary" : "entities";
3879
+ // Adding url params here because this will avoid making them encoded.
3880
+ // Our API isn't decoding them properly so $expand is not being recognized.
3881
+ url += "?" + urlParams.toString();
3855
3882
  const urlStr = api.ConstructUrl({
3856
3883
  cdn: false,
3857
- url: analysis ? "entities/summary" : "entities",
3858
- urlParams: urlParams
3884
+ url: url
3859
3885
  });
3860
3886
  const data = yield api.post(urlStr, body, Api.PrepReqParams(reqParams));
3861
3887
  if (!analysis) {
@@ -13768,7 +13794,7 @@ var DataSource;
13768
13794
  })(DataSource || (DataSource = {}));
13769
13795
 
13770
13796
  // This is updated with the package.json version on build.
13771
- const VERSION = "4.6.1";
13797
+ const VERSION = "4.6.3";
13772
13798
 
13773
13799
  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 };
13774
13800
  //# sourceMappingURL=bruce-models.es5.js.map