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.
@@ -642,8 +642,21 @@
642
642
  }
643
643
  }
644
644
  formatApiUri(uri) {
645
- const ws = !window.document || window.document.location.protocol === "https:" ? "wss" : "ws";
646
- return uri.replace(/^(https|http)/, ws) + "websocket";
645
+ const wsProtocol = window.document.location.protocol === "https:" ? "wss" : "ws";
646
+ const currentUrl = new URL(uri);
647
+ let full = wsProtocol + "://" + currentUrl.host + currentUrl.pathname + "websocket";
648
+ // Check if we have a queryParam for accountId.
649
+ const accountId = currentUrl.searchParams.get("accountId");
650
+ if (accountId) {
651
+ if (full.includes("?")) {
652
+ full += "&";
653
+ }
654
+ else {
655
+ full += "?";
656
+ }
657
+ full += "accountId=" + accountId;
658
+ }
659
+ return full;
647
660
  }
648
661
  onOpen(ev) {
649
662
  if (this.env === exports.Api.EEnv.DEV) {
@@ -1123,10 +1136,11 @@
1123
1136
  if (!tmp.pathname.endsWith("/")) {
1124
1137
  tmp.pathname += "/";
1125
1138
  }
1139
+ let split;
1126
1140
  if (url) {
1127
1141
  // Ensure we're only adding the path.
1128
1142
  // The baseUrl could have included query params so have this extra logic.
1129
- let split = url.split("?");
1143
+ split = url.split("?");
1130
1144
  // Ensure the url does not start with a slash.
1131
1145
  // This is because the base url already has a slash at the end.
1132
1146
  let path = split[0];
@@ -1134,16 +1148,22 @@
1134
1148
  path = url.substring(1);
1135
1149
  }
1136
1150
  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]);
1151
+ }
1152
+ let full = tmp.toString();
1153
+ // Append the query string if any exist.
1154
+ if (split && split.length > 1) {
1155
+ const query = split[1].split("&");
1156
+ for (let q of query) {
1157
+ if (full.includes("?")) {
1158
+ full += "&";
1143
1159
  }
1160
+ else {
1161
+ full += "?";
1162
+ }
1163
+ full += q;
1144
1164
  }
1145
1165
  }
1146
- return tmp.toString();
1166
+ return full;
1147
1167
  }
1148
1168
  /**
1149
1169
  * Warning: This will cancel the init process.
@@ -3784,10 +3804,13 @@
3784
3804
  urlParams.set("schema", schemaId);
3785
3805
  }
3786
3806
  urlParams.set("hasMigrated", String(Boolean(migrated)));
3807
+ let url = analysis ? "entities/summary" : "entities";
3808
+ // Adding url params here because this will avoid making them encoded.
3809
+ // Our API isn't decoding them properly so $expand is not being recognized.
3810
+ url += "?" + urlParams.toString();
3787
3811
  const urlStr = api.ConstructUrl({
3788
3812
  cdn: !analysis && viaCdn,
3789
- url: analysis ? "entities/summary" : "entities",
3790
- urlParams: urlParams
3813
+ url: url
3791
3814
  });
3792
3815
  const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
3793
3816
  if (!analysis) {
@@ -3807,10 +3830,13 @@
3807
3830
  urlParams.set("schema", schemaId);
3808
3831
  }
3809
3832
  urlParams.set("hasMigrated", String(Boolean(migrated)));
3833
+ let url = analysis ? "entities/summary" : "entities";
3834
+ // Adding url params here because this will avoid making them encoded.
3835
+ // Our API isn't decoding them properly so $expand is not being recognized.
3836
+ url += "?" + urlParams.toString();
3810
3837
  const urlStr = api.ConstructUrl({
3811
3838
  cdn: false,
3812
- url: analysis ? "entities/summary" : "entities",
3813
- urlParams: urlParams
3839
+ url: url
3814
3840
  });
3815
3841
  const data = yield api.post(urlStr, body, exports.Api.PrepReqParams(reqParams));
3816
3842
  if (!analysis) {
@@ -13497,7 +13523,7 @@
13497
13523
  })(exports.DataSource || (exports.DataSource = {}));
13498
13524
 
13499
13525
  // This is updated with the package.json version on build.
13500
- const VERSION = "4.6.1";
13526
+ const VERSION = "4.6.3";
13501
13527
 
13502
13528
  exports.VERSION = VERSION;
13503
13529
  exports.AbstractApi = AbstractApi;