bruce-models 7.1.47 → 7.1.48

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.
@@ -1565,6 +1565,16 @@
1565
1565
  this.version = "UNKNOWN";
1566
1566
  }
1567
1567
  }
1568
+ // Same version as the proxy-update we started supporting an accountId/subdomain prefix.
1569
+ // We can upgrade URLs automatically so anything using them for proxies doesn't have to manage query params.
1570
+ // Eg: "/v3/entity/abc?accountId=template" would become "/A:template/v3/entity/abc".
1571
+ if (this.IsVersionAtLeast(BruceApi.VERSION_WITH_PROXIES)) {
1572
+ this.baseUrl = Api$$1.rewriteAccountIdToPath(this.baseUrl);
1573
+ this.cdnBaseUrl = Api$$1.rewriteAccountIdToPath(this.cdnBaseUrl);
1574
+ this.EntityCdnUrl = Api$$1.rewriteAccountIdToPath(this.EntityCdnUrl);
1575
+ this.TilesetCdnUrl = Api$$1.rewriteAccountIdToPath(this.TilesetCdnUrl);
1576
+ this.LegacyTilesetCdnUrl = Api$$1.rewriteAccountIdToPath(this.LegacyTilesetCdnUrl);
1577
+ }
1568
1578
  // Start web socket connection.
1569
1579
  if (loadWebSocket == true) {
1570
1580
  try {
@@ -1578,6 +1588,34 @@
1578
1588
  }
1579
1589
  });
1580
1590
  }
1591
+ /**
1592
+ * Moves query param specified accountId/subdomain to be a prefix segment in the URL path.
1593
+ * Eg: "/v3/entity/abc?accountId=template" would become "/A:template/v3/entity/abc".
1594
+ * If no accountId param is present or the URL is invalid, returns the URL unchanged.
1595
+ */
1596
+ static rewriteAccountIdToPath(url) {
1597
+ if (!url) {
1598
+ return url;
1599
+ }
1600
+ try {
1601
+ const parsed = new URL(url);
1602
+ const accountId = parsed.searchParams.get("accountId");
1603
+ if (!accountId) {
1604
+ return url;
1605
+ }
1606
+ parsed.searchParams.delete("accountId");
1607
+ // Prepend A:<id>/ to the existing pathname.
1608
+ let path = parsed.pathname;
1609
+ if (!path.endsWith("/")) {
1610
+ path += "/";
1611
+ }
1612
+ parsed.pathname = path + `A:${accountId}/`;
1613
+ return parsed.toString();
1614
+ }
1615
+ catch (e) {
1616
+ return url;
1617
+ }
1618
+ }
1581
1619
  getDomain() {
1582
1620
  const env = this.env.toUpperCase();
1583
1621
  let domain = "nextspace.host";
@@ -18610,7 +18648,7 @@
18610
18648
  })(exports.UrlUtils || (exports.UrlUtils = {}));
18611
18649
 
18612
18650
  // This is updated with the package.json version on build.
18613
- const VERSION = "7.1.47";
18651
+ const VERSION = "7.1.48";
18614
18652
 
18615
18653
  exports.VERSION = VERSION;
18616
18654
  exports.AbstractApi = AbstractApi;