@stackframe/stack 2.6.33 → 2.6.34

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.
@@ -109,7 +109,9 @@ type Session = {
109
109
  type Auth = {
110
110
  readonly _internalSession: InternalSession;
111
111
  readonly currentSession: Session;
112
- signOut(): Promise<void>;
112
+ signOut(options?: {
113
+ redirectUrl?: URL | string;
114
+ }): Promise<void>;
113
115
  /**
114
116
  * Returns headers for sending authenticated HTTP requests to external servers. Most commonly used in cross-origin
115
117
  * requests. Similar to `getAuthJson`, but specifically for HTTP requests.
@@ -109,7 +109,9 @@ type Session = {
109
109
  type Auth = {
110
110
  readonly _internalSession: InternalSession;
111
111
  readonly currentSession: Session;
112
- signOut(): Promise<void>;
112
+ signOut(options?: {
113
+ redirectUrl?: URL | string;
114
+ }): Promise<void>;
113
115
  /**
114
116
  * Returns headers for sending authenticated HTTP requests to external servers. Most commonly used in cross-origin
115
117
  * requests. Similar to `getAuthJson`, but specifically for HTTP requests.
@@ -64,7 +64,7 @@ var import_url = require("../utils/url");
64
64
  var import_auth = require("./auth");
65
65
  var import_cookie = require("./cookie");
66
66
  var NextNavigation = (0, import_compile_time.scrambleDuringCompileTime)(NextNavigationUnscrambled);
67
- var clientVersion = "js @stackframe/stack@2.6.33";
67
+ var clientVersion = "js @stackframe/stack@2.6.34";
68
68
  function getUrls(partial) {
69
69
  const handler = partial.handler ?? "/handler";
70
70
  const home = partial.home ?? "/";
@@ -155,7 +155,7 @@ function useAsyncCache(cache, dependencies, caller) {
155
155
  }
156
156
  return result.data;
157
157
  }
158
- var stackAppInternalsSymbol = Symbol.for("StackAppInternals");
158
+ var stackAppInternalsSymbol = Symbol.for("StackAuth--DO-NOT-USE-OR-YOU-WILL-BE-FIRED--StackAppInternals");
159
159
  var allClientApps = /* @__PURE__ */ new Map();
160
160
  var createCache = (fetcher) => {
161
161
  return new import_caches.AsyncCache(
@@ -712,8 +712,8 @@ var _StackClientAppImpl = class __StackClientAppImpl {
712
712
  await app._refreshUser(session);
713
713
  return registrationResult;
714
714
  },
715
- signOut() {
716
- return app._signOut(session);
715
+ signOut(options) {
716
+ return app._signOut(session, options);
717
717
  }
718
718
  };
719
719
  }
@@ -1279,18 +1279,22 @@ var _StackClientAppImpl = class __StackClientAppImpl {
1279
1279
  }
1280
1280
  return false;
1281
1281
  }
1282
- async _signOut(session) {
1282
+ async _signOut(session, options) {
1283
1283
  await this._interface.signOut(session);
1284
- await this.redirectToAfterSignOut();
1284
+ if (options?.redirectUrl) {
1285
+ await _redirectTo(options.redirectUrl);
1286
+ } else {
1287
+ await this.redirectToAfterSignOut();
1288
+ }
1285
1289
  }
1286
1290
  async _sendVerificationEmail(email, session) {
1287
1291
  const emailVerificationRedirectUrl = (0, import_url.constructRedirectUrl)(this.urls.emailVerification);
1288
1292
  return await this._interface.sendVerificationEmail(email, emailVerificationRedirectUrl, session);
1289
1293
  }
1290
- async signOut() {
1294
+ async signOut(options) {
1291
1295
  const user = await this.getUser();
1292
1296
  if (user) {
1293
- await user.signOut();
1297
+ await user.signOut(options);
1294
1298
  }
1295
1299
  }
1296
1300
  async getProject() {
@@ -1382,6 +1386,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
1382
1386
  (0, import_promises.runAsynchronously)(async () => {
1383
1387
  await this._currentUserCache.forceSetCachedValueAsync([await this._getSession()], import_results.Result.fromPromise(userJsonPromise));
1384
1388
  });
1389
+ },
1390
+ sendRequest: async (path, requestOptions, requestType = "client") => {
1391
+ return await this._interface.sendClientRequest(path, requestOptions, await this._getSession(), requestType);
1385
1392
  }
1386
1393
  };
1387
1394
  }