@cadenza.io/service 2.17.7 → 2.17.8

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.
package/dist/index.js CHANGED
@@ -8762,6 +8762,15 @@ function readConfiguredPort(value) {
8762
8762
  function buildBootstrapUrl(protocol, address, port) {
8763
8763
  return `${protocol}://${address}:${port}`;
8764
8764
  }
8765
+ function readExplicitPortFromOrigin(raw) {
8766
+ const match = raw.match(
8767
+ /^[a-z]+:\/\/(?:\[[^\]]+\]|[^\/?#:]+):(\d+)(?:\/)?$/i
8768
+ );
8769
+ if (!match?.[1]) {
8770
+ return void 0;
8771
+ }
8772
+ return readConfiguredPort(match[1]);
8773
+ }
8765
8774
  function resolveInjectedBootstrapUrl(injectedGlobalKey) {
8766
8775
  if (typeof globalThis === "undefined") {
8767
8776
  return void 0;
@@ -8851,7 +8860,8 @@ function resolveBootstrapEndpoint(options) {
8851
8860
  "Bootstrap URL must be an origin without a path component."
8852
8861
  );
8853
8862
  }
8854
- const port2 = parsed2.port ? readConfiguredPort(parsed2.port) : fallbackPort;
8863
+ const explicitPort = readExplicitPortFromOrigin(raw);
8864
+ const port2 = explicitPort ?? (parsed2.port ? readConfiguredPort(parsed2.port) : fallbackPort);
8855
8865
  if (!port2) {
8856
8866
  throw new Error(
8857
8867
  "Bootstrap URL must include a port or CADENZA_DB_PORT must be provided."