cauthy-auth 0.24.0 → 0.24.2

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/svelte.js CHANGED
@@ -102,6 +102,13 @@ function ceremonyError(e) {
102
102
  return { code: "passkey_failed", message: "The passkey could not be used. Try again, or sign in another way." };
103
103
  }
104
104
 
105
+ // src/url.ts
106
+ function withoutTrailingSlashes(s) {
107
+ let end = s.length;
108
+ while (end > 0 && s.charCodeAt(end - 1) === 47) end--;
109
+ return s.slice(0, end);
110
+ }
111
+
105
112
  // src/theme.ts
106
113
  function fromWire(wire) {
107
114
  const names = {
@@ -196,7 +203,7 @@ function loadGoogleIdentity() {
196
203
  var PASSKEY_SECONDS = 300;
197
204
  var UNAVAILABLE = { code: "unavailable", message: "Sign-in is unavailable right now. Try again in a moment." };
198
205
  function createAuthClient(options = {}) {
199
- const base = (options.basePath ?? "/api/auth").replace(/\/+$/, "");
206
+ const base = withoutTrailingSlashes(options.basePath ?? "/api/auth");
200
207
  const doFetch = (...args) => (options.fetch ?? fetch)(...args);
201
208
  const locale = () => {
202
209
  const said = typeof options.locale === "function" ? options.locale() : options.locale;
@@ -489,7 +496,7 @@ function createAuthClient(options = {}) {
489
496
  // src/store.ts
490
497
  var AHEAD_MS = 6e4;
491
498
  function createSessionStore(options = {}) {
492
- const base = (options.basePath ?? "/api/auth").replace(/\/+$/, "");
499
+ const base = withoutTrailingSlashes(options.basePath ?? "/api/auth");
493
500
  const doFetch = (...args) => (options.fetch ?? fetch)(...args);
494
501
  const first = options.initialSession;
495
502
  let state = { session: first ?? null, status: first === void 0 ? "loading" : first === null ? "unauthenticated" : "authenticated" };