@stackframe/stack 2.5.8 → 2.5.10

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/credential-sign-in.d.mts +5 -0
  3. package/dist/components/credential-sign-in.d.ts +5 -0
  4. package/dist/components/{credential-sign-in-form.js → credential-sign-in.js} +8 -8
  5. package/dist/components/credential-sign-in.js.map +1 -0
  6. package/dist/components/credential-sign-up.d.mts +5 -0
  7. package/dist/components/credential-sign-up.d.ts +5 -0
  8. package/dist/components/{credential-sign-up-form.js → credential-sign-up.js} +8 -8
  9. package/dist/components/credential-sign-up.js.map +1 -0
  10. package/dist/components/elements/user-avatar.d.mts +1 -1
  11. package/dist/components/elements/user-avatar.d.ts +1 -1
  12. package/dist/components/magic-link-sign-in.d.mts +5 -0
  13. package/dist/components/magic-link-sign-in.d.ts +5 -0
  14. package/dist/components/{magic-link-sign-in-form.js → magic-link-sign-in.js} +8 -8
  15. package/dist/components/magic-link-sign-in.js.map +1 -0
  16. package/dist/components/message-cards/predefined-message-card.js +8 -8
  17. package/dist/components/message-cards/predefined-message-card.js.map +1 -1
  18. package/dist/components/selected-team-switcher.d.mts +1 -1
  19. package/dist/components/selected-team-switcher.d.ts +1 -1
  20. package/dist/components/user-button.js +3 -3
  21. package/dist/components/user-button.js.map +1 -1
  22. package/dist/components-page/account-settings.js +4 -4
  23. package/dist/components-page/account-settings.js.map +1 -1
  24. package/dist/components-page/auth-page.js +21 -8
  25. package/dist/components-page/auth-page.js.map +1 -1
  26. package/dist/components-page/stack-handler.d.mts +2 -2
  27. package/dist/components-page/stack-handler.d.ts +2 -2
  28. package/dist/components-page/stack-handler.js +8 -15
  29. package/dist/components-page/stack-handler.js.map +1 -1
  30. package/dist/esm/components/{credential-sign-in-form.js → credential-sign-in.js} +4 -4
  31. package/dist/esm/components/credential-sign-in.js.map +1 -0
  32. package/dist/esm/components/{credential-sign-up-form.js → credential-sign-up.js} +4 -4
  33. package/dist/esm/components/credential-sign-up.js.map +1 -0
  34. package/dist/esm/components/{magic-link-sign-in-form.js → magic-link-sign-in.js} +4 -4
  35. package/dist/esm/components/magic-link-sign-in.js.map +1 -0
  36. package/dist/esm/components/message-cards/predefined-message-card.js +8 -8
  37. package/dist/esm/components/message-cards/predefined-message-card.js.map +1 -1
  38. package/dist/esm/components/user-button.js +3 -3
  39. package/dist/esm/components/user-button.js.map +1 -1
  40. package/dist/esm/components-page/account-settings.js +4 -4
  41. package/dist/esm/components-page/account-settings.js.map +1 -1
  42. package/dist/esm/components-page/auth-page.js +21 -8
  43. package/dist/esm/components-page/auth-page.js.map +1 -1
  44. package/dist/esm/components-page/stack-handler.js +8 -15
  45. package/dist/esm/components-page/stack-handler.js.map +1 -1
  46. package/dist/esm/index.js +7 -9
  47. package/dist/esm/index.js.map +1 -1
  48. package/dist/esm/lib/auth.js +3 -3
  49. package/dist/esm/lib/auth.js.map +1 -1
  50. package/dist/esm/lib/cookie.js +8 -6
  51. package/dist/esm/lib/cookie.js.map +1 -1
  52. package/dist/esm/lib/stack-app.js +143 -93
  53. package/dist/esm/lib/stack-app.js.map +1 -1
  54. package/dist/esm/providers/stack-provider-client.js +1 -3
  55. package/dist/esm/providers/stack-provider-client.js.map +1 -1
  56. package/dist/esm/utils/url.js +9 -1
  57. package/dist/esm/utils/url.js.map +1 -1
  58. package/dist/index.d.mts +5 -5
  59. package/dist/index.d.ts +5 -5
  60. package/dist/index.js +6 -8
  61. package/dist/index.js.map +1 -1
  62. package/dist/lib/auth.js +3 -3
  63. package/dist/lib/auth.js.map +1 -1
  64. package/dist/lib/cookie.js +6 -6
  65. package/dist/lib/cookie.js.map +1 -1
  66. package/dist/lib/hooks.d.mts +1 -1
  67. package/dist/lib/hooks.d.ts +1 -1
  68. package/dist/lib/stack-app.d.mts +59 -23
  69. package/dist/lib/stack-app.d.ts +59 -23
  70. package/dist/lib/stack-app.js +143 -93
  71. package/dist/lib/stack-app.js.map +1 -1
  72. package/dist/providers/stack-provider-client.d.mts +1 -1
  73. package/dist/providers/stack-provider-client.d.ts +1 -1
  74. package/dist/providers/stack-provider-client.js +1 -3
  75. package/dist/providers/stack-provider-client.js.map +1 -1
  76. package/dist/providers/stack-provider.d.mts +1 -1
  77. package/dist/providers/stack-provider.d.ts +1 -1
  78. package/dist/utils/url.js +9 -1
  79. package/dist/utils/url.js.map +1 -1
  80. package/package.json +6 -4
  81. package/dist/components/credential-sign-in-form.d.mts +0 -5
  82. package/dist/components/credential-sign-in-form.d.ts +0 -5
  83. package/dist/components/credential-sign-in-form.js.map +0 -1
  84. package/dist/components/credential-sign-up-form.d.mts +0 -5
  85. package/dist/components/credential-sign-up-form.d.ts +0 -5
  86. package/dist/components/credential-sign-up-form.js.map +0 -1
  87. package/dist/components/magic-link-sign-in-form.d.mts +0 -5
  88. package/dist/components/magic-link-sign-in-form.d.ts +0 -5
  89. package/dist/components/magic-link-sign-in-form.js.map +0 -1
  90. package/dist/esm/components/credential-sign-in-form.js.map +0 -1
  91. package/dist/esm/components/credential-sign-up-form.js.map +0 -1
  92. package/dist/esm/components/magic-link-sign-in-form.js.map +0 -1
@@ -14,6 +14,7 @@ import { suspend, suspendIfSsr } from "@stackframe/stack-shared/dist/utils/react
14
14
  import { Result } from "@stackframe/stack-shared/dist/utils/results";
15
15
  import { Store } from "@stackframe/stack-shared/dist/utils/stores";
16
16
  import { mergeScopeStrings } from "@stackframe/stack-shared/dist/utils/strings";
17
+ import { getRelativePart, isRelative } from "@stackframe/stack-shared/dist/utils/urls";
17
18
  import { generateUuid } from "@stackframe/stack-shared/dist/utils/uuids";
18
19
  import * as cookie from "cookie";
19
20
  import * as NextNavigationUnscrambled from "next/navigation";
@@ -22,23 +23,25 @@ import { constructRedirectUrl } from "../utils/url";
22
23
  import { addNewOAuthProviderOrScope, callOAuthCallback, signInWithOAuth } from "./auth";
23
24
  import { deleteCookie, getCookie, setOrDeleteCookie } from "./cookie";
24
25
  var NextNavigation = scrambleDuringCompileTime(NextNavigationUnscrambled);
25
- var clientVersion = "js @stackframe/stack@2.5.8";
26
+ var clientVersion = "js @stackframe/stack@2.5.10";
26
27
  function getUrls(partial) {
27
28
  const handler = partial.handler ?? "/handler";
29
+ const home = partial.home ?? "/";
30
+ const afterSignIn = partial.afterSignIn ?? home;
28
31
  return {
29
32
  handler,
30
33
  signIn: `${handler}/sign-in`,
31
- afterSignIn: "/",
34
+ afterSignIn: home,
32
35
  signUp: `${handler}/sign-up`,
33
- afterSignUp: "/",
36
+ afterSignUp: afterSignIn,
34
37
  signOut: `${handler}/sign-out`,
35
- afterSignOut: "/",
38
+ afterSignOut: home,
36
39
  emailVerification: `${handler}/email-verification`,
37
40
  passwordReset: `${handler}/password-reset`,
38
41
  forgotPassword: `${handler}/forgot-password`,
39
42
  oauthCallback: `${handler}/oauth-callback`,
40
43
  magicLinkCallback: `${handler}/magic-link-callback`,
41
- home: "/",
44
+ home,
42
45
  accountSettings: `${handler}/account-settings`,
43
46
  error: `${handler}/error`,
44
47
  ...filterUndefined(partial)
@@ -46,7 +49,7 @@ function getUrls(partial) {
46
49
  }
47
50
  async function _redirectTo(url, options) {
48
51
  if (isReactServer) {
49
- NextNavigation.redirect(url, options?.replace ? NextNavigation.RedirectType.replace : NextNavigation.RedirectType.push);
52
+ NextNavigation.redirect(url.toString(), options?.replace ? NextNavigation.RedirectType.replace : NextNavigation.RedirectType.push);
50
53
  } else {
51
54
  if (options?.replace) {
52
55
  window.location.replace(url);
@@ -149,7 +152,10 @@ var _StackClientAppImpl = class __StackClientAppImpl {
149
152
  this._currentUserOAuthConnectionAccessTokensCache = createCacheBySession(
150
153
  async (session, [accountId, scope]) => {
151
154
  try {
152
- return await this._interface.getAccessToken(accountId, scope || "", session);
155
+ const result = await this._interface.createProviderAccessToken(accountId, scope || "", session);
156
+ return {
157
+ accessToken: result.access_token
158
+ };
153
159
  } catch (err) {
154
160
  if (!(err instanceof KnownErrors.OAuthConnectionDoesNotHaveRequiredScope || err instanceof KnownErrors.OAuthConnectionNotConnectedToUser)) {
155
161
  throw err;
@@ -261,12 +267,12 @@ var _StackClientAppImpl = class __StackClientAppImpl {
261
267
  }
262
268
  return this._uniqueIdentifier;
263
269
  }
264
- async _checkFeatureSupport(featureName, options) {
265
- return await this._interface.checkFeatureSupport({ ...options, featureName });
270
+ async _checkFeatureSupport(name, options) {
271
+ return await this._interface.checkFeatureSupport({ ...options, name });
266
272
  }
267
- _useCheckFeatureSupport(featureName, options) {
268
- runAsynchronously(this._checkFeatureSupport(featureName, options));
269
- throw new StackAssertionError(`${featureName} is not currently supported. Please reach out to Stack support for more information.`);
273
+ _useCheckFeatureSupport(name, options) {
274
+ runAsynchronously(this._checkFeatureSupport(name, options));
275
+ throw new StackAssertionError(`${name} is not currently supported. Please reach out to Stack support for more information.`);
270
276
  }
271
277
  get _refreshTokenCookieName() {
272
278
  return `stack-refresh-${this.projectId}`;
@@ -529,7 +535,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
529
535
  }
530
536
  };
531
537
  }
532
- _createCurrentUserExtra(crud, session) {
538
+ _createUserExtra(crud, session) {
533
539
  const app = this;
534
540
  async function getConnectedAccount(id, options) {
535
541
  const scopeString = options?.scopes?.join(" ");
@@ -599,7 +605,10 @@ var _StackClientAppImpl = class __StackClientAppImpl {
599
605
  return app._updateClientUser(update, session);
600
606
  },
601
607
  sendVerificationEmail() {
602
- return app._sendVerificationEmail(session);
608
+ if (!crud?.primary_email) {
609
+ throw new StackAssertionError("User does not have a primary email");
610
+ }
611
+ return app._sendVerificationEmail(crud.primary_email, session);
603
612
  },
604
613
  updatePassword(options) {
605
614
  return app._updatePassword(options, session);
@@ -625,7 +634,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
625
634
  const currentUser = {
626
635
  ...this._createBaseUser(crud),
627
636
  ...this._createAuth(session),
628
- ...this._createCurrentUserExtra(crud, session),
637
+ ...this._createUserExtra(crud, session),
629
638
  ...this._isInternalProject() ? this._createInternalUserExtra(session) : {}
630
639
  };
631
640
  Object.freeze(currentUser);
@@ -646,57 +655,93 @@ var _StackClientAppImpl = class __StackClientAppImpl {
646
655
  get projectId() {
647
656
  return this._interface.projectId;
648
657
  }
658
+ async _isTrusted(url) {
659
+ return isRelative(url);
660
+ }
649
661
  get urls() {
650
662
  return getUrls(this._urlOptions);
651
663
  }
652
- async _redirectTo(handlerName, options) {
653
- const url = this.urls[handlerName];
664
+ async _redirectIfTrusted(url, options) {
665
+ if (!await this._isTrusted(url)) {
666
+ throw new Error(`Redirect URL ${url} is not trusted; should be relative.`);
667
+ }
668
+ return await _redirectTo(url, options);
669
+ }
670
+ async _redirectToHandler(handlerName, options) {
671
+ let url = this.urls[handlerName];
654
672
  if (!url) {
655
673
  throw new Error(`No URL for handler name ${handlerName}`);
656
674
  }
657
- await _redirectTo(url, options);
675
+ if (handlerName === "afterSignIn" || handlerName === "afterSignUp") {
676
+ if (isReactServer || typeof window === "undefined") {
677
+ try {
678
+ await this._checkFeatureSupport("rsc-handler-" + handlerName, {});
679
+ } catch (e) {
680
+ }
681
+ } else {
682
+ const queryParams = new URLSearchParams(window.location.search);
683
+ url = queryParams.get("after_auth_return_to") || url;
684
+ }
685
+ } else if (handlerName === "signIn" || handlerName === "signUp") {
686
+ if (isReactServer || typeof window === "undefined") {
687
+ try {
688
+ await this._checkFeatureSupport("rsc-handler-" + handlerName, {});
689
+ } catch (e) {
690
+ }
691
+ } else {
692
+ const currentUrl = new URL(window.location.href);
693
+ const nextUrl = new URL(url, currentUrl);
694
+ if (currentUrl.searchParams.has("after_auth_return_to")) {
695
+ nextUrl.searchParams.set("after_auth_return_to", currentUrl.searchParams.get("after_auth_return_to"));
696
+ } else if (currentUrl.protocol === nextUrl.protocol && currentUrl.host === nextUrl.host) {
697
+ nextUrl.searchParams.set("after_auth_return_to", getRelativePart(currentUrl));
698
+ }
699
+ url = getRelativePart(nextUrl);
700
+ }
701
+ }
702
+ await this._redirectIfTrusted(url, options);
658
703
  }
659
- async redirectToSignIn() {
660
- return await this._redirectTo("signIn");
704
+ async redirectToSignIn(options) {
705
+ return await this._redirectToHandler("signIn", options);
661
706
  }
662
- async redirectToSignUp() {
663
- return await this._redirectTo("signUp");
707
+ async redirectToSignUp(options) {
708
+ return await this._redirectToHandler("signUp", options);
664
709
  }
665
- async redirectToSignOut() {
666
- return await this._redirectTo("signOut");
710
+ async redirectToSignOut(options) {
711
+ return await this._redirectToHandler("signOut", options);
667
712
  }
668
- async redirectToEmailVerification() {
669
- return await this._redirectTo("emailVerification");
713
+ async redirectToEmailVerification(options) {
714
+ return await this._redirectToHandler("emailVerification", options);
670
715
  }
671
- async redirectToPasswordReset() {
672
- return await this._redirectTo("passwordReset");
716
+ async redirectToPasswordReset(options) {
717
+ return await this._redirectToHandler("passwordReset", options);
673
718
  }
674
- async redirectToForgotPassword() {
675
- return await this._redirectTo("forgotPassword");
719
+ async redirectToForgotPassword(options) {
720
+ return await this._redirectToHandler("forgotPassword", options);
676
721
  }
677
- async redirectToHome() {
678
- return await this._redirectTo("home");
722
+ async redirectToHome(options) {
723
+ return await this._redirectToHandler("home", options);
679
724
  }
680
- async redirectToOAuthCallback() {
681
- return await this._redirectTo("oauthCallback");
725
+ async redirectToOAuthCallback(options) {
726
+ return await this._redirectToHandler("oauthCallback", options);
682
727
  }
683
- async redirectToMagicLinkCallback() {
684
- return await this._redirectTo("magicLinkCallback");
728
+ async redirectToMagicLinkCallback(options) {
729
+ return await this._redirectToHandler("magicLinkCallback", options);
685
730
  }
686
- async redirectToAfterSignIn() {
687
- return await this._redirectTo("afterSignIn");
731
+ async redirectToAfterSignIn(options) {
732
+ return await this._redirectToHandler("afterSignIn", options);
688
733
  }
689
- async redirectToAfterSignUp() {
690
- return await this._redirectTo("afterSignUp");
734
+ async redirectToAfterSignUp(options) {
735
+ return await this._redirectToHandler("afterSignUp", options);
691
736
  }
692
- async redirectToAfterSignOut() {
693
- return await this._redirectTo("afterSignOut");
737
+ async redirectToAfterSignOut(options) {
738
+ return await this._redirectToHandler("afterSignOut", options);
694
739
  }
695
- async redirectToAccountSettings() {
696
- return await this._redirectTo("accountSettings");
740
+ async redirectToAccountSettings(options) {
741
+ return await this._redirectToHandler("accountSettings", options);
697
742
  }
698
- async redirectToError() {
699
- return await this._redirectTo("error");
743
+ async redirectToError(options) {
744
+ return await this._redirectToHandler("error", options);
700
745
  }
701
746
  async sendForgotPasswordEmail(email) {
702
747
  const redirectUrl = constructRedirectUrl(this.urls.passwordReset);
@@ -725,7 +770,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
725
770
  if (crud === null) {
726
771
  switch (options?.or) {
727
772
  case "redirect": {
728
- await this.redirectToSignIn();
773
+ await this.redirectToSignIn({ replace: true });
729
774
  break;
730
775
  }
731
776
  case "throw": {
@@ -746,7 +791,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
746
791
  if (crud === null) {
747
792
  switch (options?.or) {
748
793
  case "redirect": {
749
- setTimeout(() => router.replace(this.urls.signIn), 0);
794
+ runAsynchronously(this.redirectToSignIn({ replace: true }));
750
795
  suspend();
751
796
  throw new StackAssertionError("suspend should never return");
752
797
  }
@@ -840,9 +885,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
840
885
  await this._interface.signOut(session);
841
886
  await this.redirectToAfterSignOut();
842
887
  }
843
- async _sendVerificationEmail(session) {
888
+ async _sendVerificationEmail(email, session) {
844
889
  const emailVerificationRedirectUrl = constructRedirectUrl(this.urls.emailVerification);
845
- return await this._interface.sendVerificationEmail(emailVerificationRedirectUrl, session);
890
+ return await this._interface.sendVerificationEmail(email, emailVerificationRedirectUrl, session);
846
891
  }
847
892
  async _updatePassword(options, session) {
848
893
  return await this._interface.updatePassword(options, session);
@@ -987,7 +1032,13 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
987
1032
  return await this._interface.listServerTeamMemberPermissions({ teamId, userId, recursive });
988
1033
  });
989
1034
  }
1035
+ async _updateServerUser(userId, update) {
1036
+ const result = await this._interface.updateServerUser(userId, userUpdateOptionsToCrud(update));
1037
+ await this._refreshUsers();
1038
+ return result;
1039
+ }
990
1040
  _createBaseUser(crud) {
1041
+ const app = this;
991
1042
  if (!crud) {
992
1043
  throw new StackAssertionError("User not found");
993
1044
  }
@@ -996,10 +1047,41 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
996
1047
  ..."server_metadata" in crud ? {
997
1048
  // server user
998
1049
  serverMetadata: crud.server_metadata
999
- } : {}
1050
+ } : {},
1051
+ async setServerMetadata(metadata) {
1052
+ await app._updateServerUser(crud.id, { serverMetadata: metadata });
1053
+ },
1054
+ async setPrimaryEmail(email, options) {
1055
+ await app._updateServerUser(crud.id, { primaryEmail: email, primaryEmailVerified: options?.verified });
1056
+ },
1057
+ async grantPermission(scope, permissionId) {
1058
+ await app._interface.grantServerTeamUserPermission(scope.id, crud.id, permissionId);
1059
+ for (const recursive of [true, false]) {
1060
+ await app._serverTeamUserPermissionsCache.refresh([scope.id, crud.id, recursive]);
1061
+ }
1062
+ },
1063
+ async revokePermission(scope, permissionId) {
1064
+ await app._interface.revokeServerTeamUserPermission(scope.id, crud.id, permissionId);
1065
+ for (const recursive of [true, false]) {
1066
+ await app._serverTeamUserPermissionsCache.refresh([scope.id, crud.id, recursive]);
1067
+ }
1068
+ },
1069
+ async delete() {
1070
+ const res = await app._interface.deleteServerServerUser(crud.id);
1071
+ await app._refreshUsers();
1072
+ return res;
1073
+ },
1074
+ async createSession(options) {
1075
+ const tokens = await app._interface.createServerUserSession(crud.id, options.expiresInMillis ?? 1e3 * 60 * 60 * 24 * 365);
1076
+ return {
1077
+ async getTokens() {
1078
+ return tokens;
1079
+ }
1080
+ };
1081
+ }
1000
1082
  };
1001
1083
  }
1002
- _createCurrentUserExtra(crud) {
1084
+ _createUserExtra(crud) {
1003
1085
  if (!crud) {
1004
1086
  throw new StackAssertionError("User not found");
1005
1087
  }
@@ -1011,15 +1093,9 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1011
1093
  async setClientMetadata(metadata) {
1012
1094
  return await this.update({ clientMetadata: metadata });
1013
1095
  },
1014
- async setServerMetadata(metadata) {
1015
- return await this.update({ serverMetadata: metadata });
1016
- },
1017
1096
  async setSelectedTeam(team) {
1018
1097
  return await this.update({ selectedTeamId: team?.id ?? null });
1019
1098
  },
1020
- async setPrimaryEmail(email, options) {
1021
- return await this.update({ primaryEmail: email, primaryEmailVerified: options?.verified });
1022
- },
1023
1099
  getConnectedAccount: async () => {
1024
1100
  return await app._checkFeatureSupport("getConnectedAccount() on ServerUser", {});
1025
1101
  },
@@ -1066,26 +1142,8 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1066
1142
  async hasPermission(scope, permissionId) {
1067
1143
  return await this.getPermission(scope, permissionId) !== null;
1068
1144
  },
1069
- async grantPermission(scope, permissionId) {
1070
- await app._interface.grantServerTeamUserPermission(scope.id, crud.id, permissionId);
1071
- for (const recursive of [true, false]) {
1072
- await app._serverTeamUserPermissionsCache.refresh([scope.id, crud.id, recursive]);
1073
- }
1074
- },
1075
- async revokePermission(scope, permissionId) {
1076
- await app._interface.revokeServerTeamUserPermission(scope.id, crud.id, permissionId);
1077
- for (const recursive of [true, false]) {
1078
- await app._serverTeamUserPermissionsCache.refresh([scope.id, crud.id, recursive]);
1079
- }
1080
- },
1081
- async delete() {
1082
- const res = await app._interface.deleteServerServerUser(crud.id);
1083
- await app._refreshUsers();
1084
- return res;
1085
- },
1086
1145
  async update(update) {
1087
- const res = await app._interface.updateServerUser(crud.id, serverUserUpdateOptionsToCrud(update));
1088
- await app._refreshUsers();
1146
+ await app._updateServerUser(crud.id, update);
1089
1147
  },
1090
1148
  async sendVerificationEmail() {
1091
1149
  return await app._checkFeatureSupport("sendVerificationEmail() on ServerUser", {});
@@ -1097,8 +1155,8 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1097
1155
  }
1098
1156
  _serverUserFromCrud(crud) {
1099
1157
  return {
1100
- ...this._createBaseUser(crud),
1101
- ...this._createCurrentUserExtra(crud)
1158
+ ...this._createUserExtra(crud),
1159
+ ...this._createBaseUser(crud)
1102
1160
  };
1103
1161
  }
1104
1162
  _currentUserFromCrud(crud, session) {
@@ -1156,7 +1214,7 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1156
1214
  if (crud === null) {
1157
1215
  switch (options?.or) {
1158
1216
  case "redirect": {
1159
- await this.redirectToSignIn();
1217
+ await this.redirectToSignIn({ replace: true });
1160
1218
  break;
1161
1219
  }
1162
1220
  case "throw": {
@@ -1185,7 +1243,7 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1185
1243
  if (crud === null) {
1186
1244
  switch (options?.or) {
1187
1245
  case "redirect": {
1188
- setTimeout(() => router.replace(this.urls.signIn), 0);
1246
+ runAsynchronously(this.redirectToSignIn({ replace: true }));
1189
1247
  suspend();
1190
1248
  throw new StackAssertionError("suspend should never return");
1191
1249
  }
@@ -1335,7 +1393,8 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
1335
1393
  enabled: p.enabled,
1336
1394
  type: "standard",
1337
1395
  clientId: p.client_id ?? throwErr("Client ID is missing"),
1338
- clientSecret: p.client_secret ?? throwErr("Client secret is missing")
1396
+ clientSecret: p.client_secret ?? throwErr("Client secret is missing"),
1397
+ facebookConfigId: p.facebook_config_id
1339
1398
  }),
1340
1399
  emailConfig: data.config.email_config.type === "shared" ? {
1341
1400
  type: "shared"
@@ -1501,16 +1560,6 @@ function userUpdateOptionsToCrud(options) {
1501
1560
  selected_team_id: options.selectedTeamId
1502
1561
  };
1503
1562
  }
1504
- function serverUserUpdateOptionsToCrud(options) {
1505
- return {
1506
- display_name: options.displayName,
1507
- client_metadata: options.clientMetadata,
1508
- selected_team_id: options.selectedTeamId,
1509
- primary_email: options.primaryEmail,
1510
- primary_email_verified: options.primaryEmailVerified,
1511
- server_metadata: options.serverMetadata
1512
- };
1513
- }
1514
1563
  function adminProjectUpdateOptionsToCrud(options) {
1515
1564
  return {
1516
1565
  display_name: options.displayName,
@@ -1527,7 +1576,8 @@ function adminProjectUpdateOptionsToCrud(options) {
1527
1576
  type: p.type,
1528
1577
  ...p.type === "standard" && {
1529
1578
  client_id: p.clientId,
1530
- client_secret: p.clientSecret
1579
+ client_secret: p.clientSecret,
1580
+ facebook_config_id: p.facebookConfigId
1531
1581
  }
1532
1582
  })),
1533
1583
  email_config: options.config?.emailConfig && (options.config.emailConfig.type === "shared" ? {