@stackframe/stack 2.6.12 → 2.6.16

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 (38) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/components/passkey-button.d.mts +7 -0
  3. package/dist/components/passkey-button.d.ts +7 -0
  4. package/dist/components/passkey-button.js +58 -0
  5. package/dist/components/passkey-button.js.map +1 -0
  6. package/dist/components-page/account-settings.js +58 -1
  7. package/dist/components-page/account-settings.js.map +1 -1
  8. package/dist/components-page/auth-page.d.mts +1 -0
  9. package/dist/components-page/auth-page.d.ts +1 -0
  10. package/dist/components-page/auth-page.js +5 -1
  11. package/dist/components-page/auth-page.js.map +1 -1
  12. package/dist/esm/components/passkey-button.js +34 -0
  13. package/dist/esm/components/passkey-button.js.map +1 -0
  14. package/dist/esm/components-page/account-settings.js +58 -1
  15. package/dist/esm/components-page/account-settings.js.map +1 -1
  16. package/dist/esm/components-page/auth-page.js +5 -1
  17. package/dist/esm/components-page/auth-page.js.map +1 -1
  18. package/dist/esm/generated/global-css.js +1 -1
  19. package/dist/esm/generated/global-css.js.map +1 -1
  20. package/dist/esm/generated/quetzal-translations.js +2244 -2124
  21. package/dist/esm/generated/quetzal-translations.js.map +1 -1
  22. package/dist/esm/lib/stack-app.js +81 -16
  23. package/dist/esm/lib/stack-app.js.map +1 -1
  24. package/dist/generated/global-css.d.mts +1 -1
  25. package/dist/generated/global-css.d.ts +1 -1
  26. package/dist/generated/global-css.js +1 -1
  27. package/dist/generated/global-css.js.map +1 -1
  28. package/dist/generated/quetzal-translations.d.mts +2 -2
  29. package/dist/generated/quetzal-translations.d.ts +2 -2
  30. package/dist/generated/quetzal-translations.js +2244 -2124
  31. package/dist/generated/quetzal-translations.js.map +1 -1
  32. package/dist/index.d.mts +1 -1
  33. package/dist/index.d.ts +1 -1
  34. package/dist/lib/stack-app.d.mts +31 -6
  35. package/dist/lib/stack-app.d.ts +31 -6
  36. package/dist/lib/stack-app.js +81 -16
  37. package/dist/lib/stack-app.js.map +1 -1
  38. package/package.json +5 -4
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ export { default as StackProvider } from './providers/stack-provider.mjs';
2
2
  export { useStackApp, useUser } from './lib/hooks.mjs';
3
3
  export { default as StackHandler } from './components-page/stack-handler.mjs';
4
4
  export { StackTheme } from './providers/theme-provider.mjs';
5
- export { AdminDomainConfig, AdminEmailConfig, AdminOAuthProviderConfig, AdminOwnedProject, AdminProject, AdminProjectConfig, AdminProjectConfigUpdateOptions, AdminProjectCreateOptions, AdminProjectUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView, Connection, CurrentInternalServerUser, CurrentInternalUser, CurrentServerUser, CurrentUser, EditableTeamMemberProfile, GetUserOptions, HandlerUrls, OAuthConnection, OAuthProviderConfig, OAuthScopesOnSignIn, Project, ProjectConfig, ServerTeam, ServerTeamCreateOptions, ServerTeamMemberProfile, ServerTeamUpdateOptions, ServerTeamUser, ServerUser, StackAdminApp, StackAdminAppConstructorOptions, StackClientApp, StackClientAppConstructorOptions, StackClientAppJson, StackServerApp, StackServerAppConstructorOptions, Team, TeamCreateOptions, TeamMemberProfile, TeamPermission, TeamUpdateOptions, TeamUser, TokenStoreInit, User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol } from './lib/stack-app.mjs';
5
+ export { AdminDomainConfig, AdminEmailConfig, AdminOAuthProviderConfig, AdminOwnedProject, AdminProject, AdminProjectConfig, AdminProjectConfigUpdateOptions, AdminProjectCreateOptions, AdminProjectUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView, Connection, CurrentInternalServerUser, CurrentInternalUser, CurrentServerUser, CurrentUser, EditableTeamMemberProfile, GetUserOptions, HandlerUrls, OAuthConnection, OAuthProviderConfig, OAuthScopesOnSignIn, Project, ProjectConfig, ServerListUsersOptions, ServerTeam, ServerTeamCreateOptions, ServerTeamMemberProfile, ServerTeamUpdateOptions, ServerTeamUser, ServerUser, StackAdminApp, StackAdminAppConstructorOptions, StackClientApp, StackClientAppConstructorOptions, StackClientAppJson, StackServerApp, StackServerAppConstructorOptions, Team, TeamCreateOptions, TeamMemberProfile, TeamPermission, TeamUpdateOptions, TeamUser, TokenStoreInit, User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol } from './lib/stack-app.mjs';
6
6
  export { SignIn } from './components-page/sign-in.mjs';
7
7
  export { SignUp } from './components-page/sign-up.mjs';
8
8
  export { EmailVerification } from './components-page/email-verification.mjs';
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { default as StackProvider } from './providers/stack-provider.js';
2
2
  export { useStackApp, useUser } from './lib/hooks.js';
3
3
  export { default as StackHandler } from './components-page/stack-handler.js';
4
4
  export { StackTheme } from './providers/theme-provider.js';
5
- export { AdminDomainConfig, AdminEmailConfig, AdminOAuthProviderConfig, AdminOwnedProject, AdminProject, AdminProjectConfig, AdminProjectConfigUpdateOptions, AdminProjectCreateOptions, AdminProjectUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView, Connection, CurrentInternalServerUser, CurrentInternalUser, CurrentServerUser, CurrentUser, EditableTeamMemberProfile, GetUserOptions, HandlerUrls, OAuthConnection, OAuthProviderConfig, OAuthScopesOnSignIn, Project, ProjectConfig, ServerTeam, ServerTeamCreateOptions, ServerTeamMemberProfile, ServerTeamUpdateOptions, ServerTeamUser, ServerUser, StackAdminApp, StackAdminAppConstructorOptions, StackClientApp, StackClientAppConstructorOptions, StackClientAppJson, StackServerApp, StackServerAppConstructorOptions, Team, TeamCreateOptions, TeamMemberProfile, TeamPermission, TeamUpdateOptions, TeamUser, TokenStoreInit, User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol } from './lib/stack-app.js';
5
+ export { AdminDomainConfig, AdminEmailConfig, AdminOAuthProviderConfig, AdminOwnedProject, AdminProject, AdminProjectConfig, AdminProjectConfigUpdateOptions, AdminProjectCreateOptions, AdminProjectUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView, Connection, CurrentInternalServerUser, CurrentInternalUser, CurrentServerUser, CurrentUser, EditableTeamMemberProfile, GetUserOptions, HandlerUrls, OAuthConnection, OAuthProviderConfig, OAuthScopesOnSignIn, Project, ProjectConfig, ServerListUsersOptions, ServerTeam, ServerTeamCreateOptions, ServerTeamMemberProfile, ServerTeamUpdateOptions, ServerTeamUser, ServerUser, StackAdminApp, StackAdminAppConstructorOptions, StackClientApp, StackClientAppConstructorOptions, StackClientAppJson, StackServerApp, StackServerAppConstructorOptions, Team, TeamCreateOptions, TeamMemberProfile, TeamPermission, TeamUpdateOptions, TeamUser, TokenStoreInit, User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol } from './lib/stack-app.js';
6
6
  export { SignIn } from './components-page/sign-in.js';
7
7
  export { SignUp } from './components-page/sign-up.js';
8
8
  export { EmailVerification } from './components-page/email-verification.js';
@@ -74,7 +74,7 @@ type ContactChannel = {
74
74
  isPrimary: boolean;
75
75
  isVerified: boolean;
76
76
  usedForAuth: boolean;
77
- sendVerificationEmail(): Promise<Result<undefined, KnownErrors["EmailAlreadyVerified"]>>;
77
+ sendVerificationEmail(): Promise<void>;
78
78
  update(data: ContactChannelUpdateOptions): Promise<void>;
79
79
  delete(): Promise<void>;
80
80
  };
@@ -88,7 +88,12 @@ type ContactChannelUpdateOptions = {
88
88
  value?: string;
89
89
  isPrimary?: boolean;
90
90
  };
91
- type ServerContactChannel = ContactChannel;
91
+ type ServerContactChannel = ContactChannel & {
92
+ update(data: ServerContactChannelUpdateOptions): Promise<void>;
93
+ };
94
+ type ServerContactChannelUpdateOptions = ContactChannelUpdateOptions & {
95
+ isVerified?: boolean;
96
+ };
92
97
  type ServerContactChannelCreateOptions = ContactChannelCreateOptions & {
93
98
  isVerified?: boolean;
94
99
  };
@@ -176,6 +181,7 @@ type Auth = {
176
181
  accessToken: string | null;
177
182
  refreshToken: string | null;
178
183
  }>;
184
+ registerPasskey(): Promise<Result<undefined, KnownErrors["PasskeyRegistrationFailed"] | KnownErrors["PasskeyWebAuthnError"]>>;
179
185
  };
180
186
  /**
181
187
  * ```
@@ -218,6 +224,7 @@ type BaseUser = {
218
224
  */
219
225
  readonly hasPassword: boolean;
220
226
  readonly otpAuthEnabled: boolean;
227
+ readonly passkeyAuthEnabled: boolean;
221
228
  readonly isMultiFactorRequired: boolean;
222
229
  /**
223
230
  * A shorthand method to update multiple fields of the user at once.
@@ -297,6 +304,7 @@ type UserUpdateOptions = {
297
304
  totpMultiFactorSecret?: Uint8Array | null;
298
305
  profileImageUrl?: string | null;
299
306
  otpAuthEnabled?: boolean;
307
+ passkeyAuthEnabled?: boolean;
300
308
  };
301
309
  type ServerBaseUser = {
302
310
  setPrimaryEmail(email: string, options?: {
@@ -380,6 +388,7 @@ type ProjectConfig = {
380
388
  readonly signUpEnabled: boolean;
381
389
  readonly credentialEnabled: boolean;
382
390
  readonly magicLinkEnabled: boolean;
391
+ readonly passkeyEnabled: boolean;
383
392
  readonly clientTeamCreationEnabled: boolean;
384
393
  readonly clientUserDeletionEnabled: boolean;
385
394
  readonly oauthProviders: OAuthProviderConfig[];
@@ -392,6 +401,7 @@ type AdminProjectConfig = {
392
401
  readonly signUpEnabled: boolean;
393
402
  readonly credentialEnabled: boolean;
394
403
  readonly magicLinkEnabled: boolean;
404
+ readonly passkeyEnabled: boolean;
395
405
  readonly clientTeamCreationEnabled: boolean;
396
406
  readonly clientUserDeletionEnabled: boolean;
397
407
  readonly legacyGlobalJwtSigning: boolean;
@@ -439,6 +449,7 @@ type AdminProjectConfigUpdateOptions = {
439
449
  signUpEnabled?: boolean;
440
450
  credentialEnabled?: boolean;
441
451
  magicLinkEnabled?: boolean;
452
+ passkeyEnabled?: boolean;
442
453
  clientTeamCreationEnabled?: boolean;
443
454
  clientUserDeletionEnabled?: boolean;
444
455
  allowLocalhost?: boolean;
@@ -509,7 +520,7 @@ type Team = {
509
520
  clientReadOnlyMetadata: any;
510
521
  inviteUser(options: {
511
522
  email: string;
512
- }): Promise<Result<undefined, KnownErrors["TeamPermissionRequired"]>>;
523
+ }): Promise<void>;
513
524
  listUsers(): Promise<TeamUser[]>;
514
525
  useUsers(): TeamUser[];
515
526
  update(update: TeamUpdateOptions): Promise<void>;
@@ -537,9 +548,16 @@ type ServerTeam = {
537
548
  addUser(userId: string): Promise<void>;
538
549
  inviteUser(options: {
539
550
  email: string;
540
- }): Promise<Result<undefined, KnownErrors["TeamPermissionRequired"]>>;
551
+ }): Promise<void>;
541
552
  removeUser(userId: string): Promise<void>;
542
553
  } & Team;
554
+ type ServerListUsersOptions = {
555
+ cursor?: string;
556
+ limit?: number;
557
+ orderBy?: 'signedUpAt';
558
+ desc?: boolean;
559
+ query?: string;
560
+ };
543
561
  type ServerTeamCreateOptions = TeamCreateOptions;
544
562
  type ServerTeamUpdateOptions = TeamUpdateOptions & {
545
563
  clientReadOnlyMetadata?: ReadonlyJson;
@@ -600,6 +618,7 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
600
618
  password: string;
601
619
  noRedirect?: boolean;
602
620
  }): Promise<Result<undefined, KnownErrors["UserEmailAlreadyExists"] | KnownErrors["PasswordRequirementsNotMet"]>>;
621
+ signInWithPasskey(): Promise<Result<undefined, KnownErrors["PasskeyAuthenticationFailed"] | KnownErrors["InvalidTotpCode"] | KnownErrors["PasskeyWebAuthnError"]>>;
603
622
  callOAuthCallback(): Promise<boolean>;
604
623
  sendForgotPasswordEmail(email: string): Promise<Result<undefined, KnownErrors["UserNotFound"]>>;
605
624
  sendMagicLinkEmail(email: string): Promise<Result<{
@@ -665,7 +684,13 @@ type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends s
665
684
  or: 'throw';
666
685
  }): Promise<ProjectCurrentServerUser<ProjectId>>;
667
686
  getUser(options?: GetUserOptions<HasTokenStore>): Promise<ProjectCurrentServerUser<ProjectId> | null>;
668
- } & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> & AsyncStoreProperty<"users", [], ServerUser[], true> & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & StackClientApp<HasTokenStore, ProjectId>);
687
+ listUsers(options?: ServerListUsersOptions): Promise<ServerUser[] & {
688
+ nextCursor: string | null;
689
+ }>;
690
+ useUsers(options?: ServerListUsersOptions): ServerUser[] & {
691
+ nextCursor: string | null;
692
+ };
693
+ } & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> & Omit<AsyncStoreProperty<"users", [], ServerUser[], true>, "listUsers" | "useUsers"> & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & StackClientApp<HasTokenStore, ProjectId>);
669
694
  declare const StackServerApp: StackServerAppConstructor;
670
695
  type StackAdminAppConstructor = {
671
696
  new <HasTokenStore extends boolean, ProjectId extends string>(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>;
@@ -703,4 +728,4 @@ type AsyncStoreProperty<Name extends string, Args extends any[], Value, IsMultip
703
728
  [key in `use${Capitalize<Name>}`]: (...args: Args) => Value;
704
729
  };
705
730
 
706
- export { type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectUpdateOptions, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Connection, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type GetUserOptions, type HandlerUrls, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamMemberProfile, type TeamPermission, type TeamUpdateOptions, type TeamUser, type TokenStoreInit, type User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol };
731
+ export { type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectUpdateOptions, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Connection, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type GetUserOptions, type HandlerUrls, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamMemberProfile, type TeamPermission, type TeamUpdateOptions, type TeamUser, type TokenStoreInit, type User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol };
@@ -74,7 +74,7 @@ type ContactChannel = {
74
74
  isPrimary: boolean;
75
75
  isVerified: boolean;
76
76
  usedForAuth: boolean;
77
- sendVerificationEmail(): Promise<Result<undefined, KnownErrors["EmailAlreadyVerified"]>>;
77
+ sendVerificationEmail(): Promise<void>;
78
78
  update(data: ContactChannelUpdateOptions): Promise<void>;
79
79
  delete(): Promise<void>;
80
80
  };
@@ -88,7 +88,12 @@ type ContactChannelUpdateOptions = {
88
88
  value?: string;
89
89
  isPrimary?: boolean;
90
90
  };
91
- type ServerContactChannel = ContactChannel;
91
+ type ServerContactChannel = ContactChannel & {
92
+ update(data: ServerContactChannelUpdateOptions): Promise<void>;
93
+ };
94
+ type ServerContactChannelUpdateOptions = ContactChannelUpdateOptions & {
95
+ isVerified?: boolean;
96
+ };
92
97
  type ServerContactChannelCreateOptions = ContactChannelCreateOptions & {
93
98
  isVerified?: boolean;
94
99
  };
@@ -176,6 +181,7 @@ type Auth = {
176
181
  accessToken: string | null;
177
182
  refreshToken: string | null;
178
183
  }>;
184
+ registerPasskey(): Promise<Result<undefined, KnownErrors["PasskeyRegistrationFailed"] | KnownErrors["PasskeyWebAuthnError"]>>;
179
185
  };
180
186
  /**
181
187
  * ```
@@ -218,6 +224,7 @@ type BaseUser = {
218
224
  */
219
225
  readonly hasPassword: boolean;
220
226
  readonly otpAuthEnabled: boolean;
227
+ readonly passkeyAuthEnabled: boolean;
221
228
  readonly isMultiFactorRequired: boolean;
222
229
  /**
223
230
  * A shorthand method to update multiple fields of the user at once.
@@ -297,6 +304,7 @@ type UserUpdateOptions = {
297
304
  totpMultiFactorSecret?: Uint8Array | null;
298
305
  profileImageUrl?: string | null;
299
306
  otpAuthEnabled?: boolean;
307
+ passkeyAuthEnabled?: boolean;
300
308
  };
301
309
  type ServerBaseUser = {
302
310
  setPrimaryEmail(email: string, options?: {
@@ -380,6 +388,7 @@ type ProjectConfig = {
380
388
  readonly signUpEnabled: boolean;
381
389
  readonly credentialEnabled: boolean;
382
390
  readonly magicLinkEnabled: boolean;
391
+ readonly passkeyEnabled: boolean;
383
392
  readonly clientTeamCreationEnabled: boolean;
384
393
  readonly clientUserDeletionEnabled: boolean;
385
394
  readonly oauthProviders: OAuthProviderConfig[];
@@ -392,6 +401,7 @@ type AdminProjectConfig = {
392
401
  readonly signUpEnabled: boolean;
393
402
  readonly credentialEnabled: boolean;
394
403
  readonly magicLinkEnabled: boolean;
404
+ readonly passkeyEnabled: boolean;
395
405
  readonly clientTeamCreationEnabled: boolean;
396
406
  readonly clientUserDeletionEnabled: boolean;
397
407
  readonly legacyGlobalJwtSigning: boolean;
@@ -439,6 +449,7 @@ type AdminProjectConfigUpdateOptions = {
439
449
  signUpEnabled?: boolean;
440
450
  credentialEnabled?: boolean;
441
451
  magicLinkEnabled?: boolean;
452
+ passkeyEnabled?: boolean;
442
453
  clientTeamCreationEnabled?: boolean;
443
454
  clientUserDeletionEnabled?: boolean;
444
455
  allowLocalhost?: boolean;
@@ -509,7 +520,7 @@ type Team = {
509
520
  clientReadOnlyMetadata: any;
510
521
  inviteUser(options: {
511
522
  email: string;
512
- }): Promise<Result<undefined, KnownErrors["TeamPermissionRequired"]>>;
523
+ }): Promise<void>;
513
524
  listUsers(): Promise<TeamUser[]>;
514
525
  useUsers(): TeamUser[];
515
526
  update(update: TeamUpdateOptions): Promise<void>;
@@ -537,9 +548,16 @@ type ServerTeam = {
537
548
  addUser(userId: string): Promise<void>;
538
549
  inviteUser(options: {
539
550
  email: string;
540
- }): Promise<Result<undefined, KnownErrors["TeamPermissionRequired"]>>;
551
+ }): Promise<void>;
541
552
  removeUser(userId: string): Promise<void>;
542
553
  } & Team;
554
+ type ServerListUsersOptions = {
555
+ cursor?: string;
556
+ limit?: number;
557
+ orderBy?: 'signedUpAt';
558
+ desc?: boolean;
559
+ query?: string;
560
+ };
543
561
  type ServerTeamCreateOptions = TeamCreateOptions;
544
562
  type ServerTeamUpdateOptions = TeamUpdateOptions & {
545
563
  clientReadOnlyMetadata?: ReadonlyJson;
@@ -600,6 +618,7 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
600
618
  password: string;
601
619
  noRedirect?: boolean;
602
620
  }): Promise<Result<undefined, KnownErrors["UserEmailAlreadyExists"] | KnownErrors["PasswordRequirementsNotMet"]>>;
621
+ signInWithPasskey(): Promise<Result<undefined, KnownErrors["PasskeyAuthenticationFailed"] | KnownErrors["InvalidTotpCode"] | KnownErrors["PasskeyWebAuthnError"]>>;
603
622
  callOAuthCallback(): Promise<boolean>;
604
623
  sendForgotPasswordEmail(email: string): Promise<Result<undefined, KnownErrors["UserNotFound"]>>;
605
624
  sendMagicLinkEmail(email: string): Promise<Result<{
@@ -665,7 +684,13 @@ type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends s
665
684
  or: 'throw';
666
685
  }): Promise<ProjectCurrentServerUser<ProjectId>>;
667
686
  getUser(options?: GetUserOptions<HasTokenStore>): Promise<ProjectCurrentServerUser<ProjectId> | null>;
668
- } & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> & AsyncStoreProperty<"users", [], ServerUser[], true> & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & StackClientApp<HasTokenStore, ProjectId>);
687
+ listUsers(options?: ServerListUsersOptions): Promise<ServerUser[] & {
688
+ nextCursor: string | null;
689
+ }>;
690
+ useUsers(options?: ServerListUsersOptions): ServerUser[] & {
691
+ nextCursor: string | null;
692
+ };
693
+ } & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> & Omit<AsyncStoreProperty<"users", [], ServerUser[], true>, "listUsers" | "useUsers"> & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & StackClientApp<HasTokenStore, ProjectId>);
669
694
  declare const StackServerApp: StackServerAppConstructor;
670
695
  type StackAdminAppConstructor = {
671
696
  new <HasTokenStore extends boolean, ProjectId extends string>(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>;
@@ -703,4 +728,4 @@ type AsyncStoreProperty<Name extends string, Args extends any[], Value, IsMultip
703
728
  [key in `use${Capitalize<Name>}`]: (...args: Args) => Value;
704
729
  };
705
730
 
706
- export { type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectUpdateOptions, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Connection, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type GetUserOptions, type HandlerUrls, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamMemberProfile, type TeamPermission, type TeamUpdateOptions, type TeamUser, type TokenStoreInit, type User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol };
731
+ export { type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectUpdateOptions, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Connection, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type GetUserOptions, type HandlerUrls, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamMemberProfile, type TeamPermission, type TeamUpdateOptions, type TeamUser, type TokenStoreInit, type User, serverTeamPermissionDefinitionCreateOptionsToCrud, serverTeamPermissionDefinitionUpdateOptionsToCrud, stackAppInternalsSymbol };
@@ -38,6 +38,7 @@ __export(stack_app_exports, {
38
38
  stackAppInternalsSymbol: () => stackAppInternalsSymbol
39
39
  });
40
40
  module.exports = __toCommonJS(stack_app_exports);
41
+ var import_browser = require("@simplewebauthn/browser");
41
42
  var import_stack_sc = require("@stackframe/stack-sc");
42
43
  var import_stack_shared = require("@stackframe/stack-shared");
43
44
  var import_production_mode = require("@stackframe/stack-shared/dist/helpers/production-mode");
@@ -63,7 +64,7 @@ var import_url = require("../utils/url");
63
64
  var import_auth = require("./auth");
64
65
  var import_cookie = require("./cookie");
65
66
  var NextNavigation = (0, import_compile_time.scrambleDuringCompileTime)(NextNavigationUnscrambled);
66
- var clientVersion = "js @stackframe/stack@2.6.12";
67
+ var clientVersion = "js @stackframe/stack@2.6.16";
67
68
  function getUrls(partial) {
68
69
  const handler = partial.handler ?? "/handler";
69
70
  const home = partial.home ?? "/";
@@ -542,6 +543,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
542
543
  signUpEnabled: crud.config.sign_up_enabled,
543
544
  credentialEnabled: crud.config.credential_enabled,
544
545
  magicLinkEnabled: crud.config.magic_link_enabled,
546
+ passkeyEnabled: crud.config.passkey_enabled,
545
547
  clientTeamCreationEnabled: crud.config.client_team_creation_enabled,
546
548
  clientUserDeletionEnabled: crud.config.client_user_deletion_enabled,
547
549
  oauthProviders: crud.config.enabled_oauth_providers.map((p) => ({
@@ -573,7 +575,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
573
575
  clientMetadata: crud.client_metadata,
574
576
  clientReadOnlyMetadata: crud.client_read_only_metadata,
575
577
  async inviteUser(options) {
576
- return await app._interface.sendTeamInvitation({
578
+ await app._interface.sendTeamInvitation({
577
579
  teamId: crud.id,
578
580
  email: options.email,
579
581
  session: app._getSession(),
@@ -604,7 +606,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
604
606
  isPrimary: crud.is_primary,
605
607
  usedForAuth: crud.used_for_auth,
606
608
  async sendVerificationEmail() {
607
- return await app._interface.sendCurrentUserContactChannelVerificationEmail(crud.id, (0, import_url.constructRedirectUrl)(app.urls.emailVerification), app._getSession());
609
+ await app._interface.sendCurrentUserContactChannelVerificationEmail(crud.id, (0, import_url.constructRedirectUrl)(app.urls.emailVerification), app._getSession());
608
610
  },
609
611
  async update(data) {
610
612
  await app._interface.updateClientContactChannel(crud.id, contactChannelUpdateOptionsToCrud(data), app._getSession());
@@ -638,6 +640,31 @@ var _StackClientAppImpl = class __StackClientAppImpl {
638
640
  const tokens = await this.currentSession.getTokens();
639
641
  return tokens;
640
642
  },
643
+ async registerPasskey() {
644
+ const initiationResult = await app._interface.initiatePasskeyRegistration({}, session);
645
+ if (initiationResult.status !== "ok") {
646
+ return import_results.Result.error(new import_stack_shared.KnownErrors.PasskeyRegistrationFailed("Failed to get initiation options for passkey registration"));
647
+ }
648
+ const { options_json, code } = initiationResult.data;
649
+ if (options_json.rp.id !== "THIS_VALUE_WILL_BE_REPLACED.example.com") {
650
+ throw new import_errors.StackAssertionError(`Expected returned RP ID from server to equal sentinel, but found ${options_json.rp.id}`);
651
+ }
652
+ options_json.rp.id = window.location.hostname;
653
+ let attResp;
654
+ try {
655
+ attResp = await (0, import_browser.startRegistration)({ optionsJSON: options_json });
656
+ debugger;
657
+ } catch (error) {
658
+ if (error instanceof import_browser.WebAuthnError) {
659
+ return import_results.Result.error(new import_stack_shared.KnownErrors.PasskeyWebAuthnError(error.message, error.name));
660
+ } else {
661
+ return import_results.Result.error(new import_stack_shared.KnownErrors.PasskeyRegistrationFailed("Failed to start passkey registration"));
662
+ }
663
+ }
664
+ const registrationResult = await app._interface.registerPasskey({ credential: attResp, code }, session);
665
+ await app._refreshUser(session);
666
+ return registrationResult;
667
+ },
641
668
  signOut() {
642
669
  return app._signOut(session);
643
670
  }
@@ -660,6 +687,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
660
687
  emailAuthEnabled: crud.auth_with_email,
661
688
  otpAuthEnabled: crud.otp_auth_enabled,
662
689
  oauthProviders: crud.oauth_providers,
690
+ passkeyAuthEnabled: crud.passkey_auth_enabled,
663
691
  selectedTeam: crud.selected_team && this._clientTeamFromCrud(crud.selected_team),
664
692
  isMultiFactorRequired: crud.requires_totp_mfa,
665
693
  toClientJson() {
@@ -1146,6 +1174,38 @@ var _StackClientAppImpl = class __StackClientAppImpl {
1146
1174
  return import_results.Result.error(result.error);
1147
1175
  }
1148
1176
  }
1177
+ async signInWithPasskey() {
1178
+ this._ensurePersistentTokenStore();
1179
+ let result;
1180
+ try {
1181
+ result = await this._catchMfaRequiredError(async () => {
1182
+ const initiationResult = await this._interface.initiatePasskeyAuthentication({}, this._getSession());
1183
+ if (initiationResult.status !== "ok") {
1184
+ return import_results.Result.error(new import_stack_shared.KnownErrors.PasskeyAuthenticationFailed("Failed to get initiation options for passkey authentication"));
1185
+ }
1186
+ const { options_json, code } = initiationResult.data;
1187
+ if (options_json.rpId !== "THIS_VALUE_WILL_BE_REPLACED.example.com") {
1188
+ throw new import_errors.StackAssertionError(`Expected returned RP ID from server to equal sentinel, but found ${options_json.rpId}`);
1189
+ }
1190
+ options_json.rpId = window.location.hostname;
1191
+ const authentication_response = await (0, import_browser.startAuthentication)({ optionsJSON: options_json });
1192
+ return await this._interface.signInWithPasskey({ authentication_response, code });
1193
+ });
1194
+ } catch (error) {
1195
+ if (error instanceof import_browser.WebAuthnError) {
1196
+ return import_results.Result.error(new import_stack_shared.KnownErrors.PasskeyWebAuthnError(error.message, error.name));
1197
+ } else {
1198
+ return import_results.Result.error(new import_stack_shared.KnownErrors.PasskeyAuthenticationFailed("Failed to sign in with passkey"));
1199
+ }
1200
+ }
1201
+ if (result.status === "ok") {
1202
+ await this._signInToAccountWithTokens(result.data);
1203
+ await this.redirectToAfterSignIn({ replace: true });
1204
+ return import_results.Result.ok(void 0);
1205
+ } else {
1206
+ return import_results.Result.error(result.error);
1207
+ }
1208
+ }
1149
1209
  async callOAuthCallback() {
1150
1210
  this._ensurePersistentTokenStore();
1151
1211
  let result;
@@ -1302,8 +1362,8 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1302
1362
  this._currentServerUserCache = createCacheBySession(async (session) => {
1303
1363
  return await this._interface.getServerUserByToken(session);
1304
1364
  });
1305
- this._serverUsersCache = createCache(async () => {
1306
- return await this._interface.listServerUsers();
1365
+ this._serverUsersCache = createCache(async ([cursor, limit, orderBy, desc, query]) => {
1366
+ return await this._interface.listServerUsers({ cursor, limit, orderBy, desc, query });
1307
1367
  });
1308
1368
  this._serverUserCache = createCache(async ([userId]) => {
1309
1369
  const user = await this._interface.getServerUserById(userId);
@@ -1378,7 +1438,7 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1378
1438
  return {
1379
1439
  ...this._clientContactChannelFromCrud(crud),
1380
1440
  async sendVerificationEmail() {
1381
- return await app._interface.sendServerContactChannelVerificationEmail(userId, crud.id, (0, import_url.constructRedirectUrl)(app.urls.emailVerification));
1441
+ await app._interface.sendServerContactChannelVerificationEmail(userId, crud.id, (0, import_url.constructRedirectUrl)(app.urls.emailVerification));
1382
1442
  },
1383
1443
  async update(data) {
1384
1444
  await app._interface.updateServerContactChannel(userId, crud.id, serverContactChannelUpdateOptionsToCrud(data));
@@ -1596,7 +1656,7 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1596
1656
  await app._serverTeamMemberProfilesCache.refresh([crud.id]);
1597
1657
  },
1598
1658
  async inviteUser(options) {
1599
- return await app._interface.sendTeamInvitation({
1659
+ await app._interface.sendTeamInvitation({
1600
1660
  teamId: crud.id,
1601
1661
  email: options.email,
1602
1662
  session: null,
@@ -1678,15 +1738,17 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1678
1738
  return crud && this._serverUserFromCrud(crud);
1679
1739
  }, [crud]);
1680
1740
  }
1681
- async listUsers() {
1682
- const crud = await this._serverUsersCache.getOrWait([], "write-only");
1683
- return crud.map((j) => this._serverUserFromCrud(j));
1741
+ async listUsers(options) {
1742
+ const crud = await this._serverUsersCache.getOrWait([options?.cursor, options?.limit, options?.orderBy, options?.desc, options?.query], "write-only");
1743
+ const result = crud.items.map((j) => this._serverUserFromCrud(j));
1744
+ result.nextCursor = crud.pagination?.next_cursor ?? null;
1745
+ return result;
1684
1746
  }
1685
- useUsers() {
1686
- const crud = useAsyncCache(this._serverUsersCache, [], "useServerUsers()");
1687
- return (0, import_react2.useMemo)(() => {
1688
- return crud.map((j) => this._serverUserFromCrud(j));
1689
- }, [crud]);
1747
+ useUsers(options) {
1748
+ const crud = useAsyncCache(this._serverUsersCache, [options?.cursor, options?.limit, options?.orderBy, options?.desc, options?.query], "useServerUsers()");
1749
+ const result = crud.items.map((j) => this._serverUserFromCrud(j));
1750
+ result.nextCursor = crud.pagination?.next_cursor ?? null;
1751
+ return result;
1690
1752
  }
1691
1753
  _serverPermissionFromCrud(crud) {
1692
1754
  return {
@@ -1800,6 +1862,7 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
1800
1862
  signUpEnabled: data.config.sign_up_enabled,
1801
1863
  credentialEnabled: data.config.credential_enabled,
1802
1864
  magicLinkEnabled: data.config.magic_link_enabled,
1865
+ passkeyEnabled: data.config.passkey_enabled,
1803
1866
  legacyGlobalJwtSigning: data.config.legacy_global_jwt_signing,
1804
1867
  clientTeamCreationEnabled: data.config.client_team_creation_enabled,
1805
1868
  clientUserDeletionEnabled: data.config.client_user_deletion_enabled,
@@ -2019,7 +2082,8 @@ function userUpdateOptionsToCrud(options) {
2019
2082
  selected_team_id: options.selectedTeamId,
2020
2083
  totp_secret_base64: options.totpMultiFactorSecret != null ? (0, import_bytes.encodeBase64)(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,
2021
2084
  profile_image_url: options.profileImageUrl,
2022
- otp_auth_enabled: options.otpAuthEnabled
2085
+ otp_auth_enabled: options.otpAuthEnabled,
2086
+ passkey_auth_enabled: options.passkeyAuthEnabled
2023
2087
  };
2024
2088
  }
2025
2089
  function serverUserUpdateOptionsToCrud(options) {
@@ -2082,6 +2146,7 @@ function adminProjectUpdateOptionsToCrud(options) {
2082
2146
  sign_up_enabled: options.config?.signUpEnabled,
2083
2147
  credential_enabled: options.config?.credentialEnabled,
2084
2148
  magic_link_enabled: options.config?.magicLinkEnabled,
2149
+ passkey_enabled: options.config?.passkeyEnabled,
2085
2150
  allow_localhost: options.config?.allowLocalhost,
2086
2151
  create_team_on_sign_up: options.config?.createTeamOnSignUp,
2087
2152
  client_team_creation_enabled: options.config?.clientTeamCreationEnabled,