@aura-stack/next 0.2.2 → 0.3.0

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.
@@ -553,7 +553,7 @@ type MaybePromise<TValue$1> = TValue$1 | Promise<TValue$1>;
553
553
  * Hint: This type has no effect and is only used so that TypeScript displays
554
554
  * the final type in the preview instead of the utility types used.
555
555
  */
556
- type Prettify$3<TObject> = { [TKey in keyof TObject]: TObject[TKey] } & {};
556
+ type Prettify$2<TObject> = { [TKey in keyof TObject]: TObject[TKey] } & {};
557
557
  /**
558
558
  * Marks specific keys as optional.
559
559
  */
@@ -641,11 +641,11 @@ type OutputWithReadonly<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, T
641
641
  /**
642
642
  * Infer object input type.
643
643
  */
644
- type InferObjectInput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify$3<InputWithQuestionMarks<TEntries$1, InferEntriesInput<TEntries$1>>>;
644
+ type InferObjectInput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify$2<InputWithQuestionMarks<TEntries$1, InferEntriesInput<TEntries$1>>>;
645
645
  /**
646
646
  * Infer object output type.
647
647
  */
648
- type InferObjectOutput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify$3<OutputWithReadonly<TEntries$1, OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>>>;
648
+ type InferObjectOutput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify$2<OutputWithReadonly<TEntries$1, OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>>>;
649
649
  /**
650
650
  * Infer object issue type.
651
651
  */
@@ -7624,7 +7624,7 @@ type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T e
7624
7624
  type SomeObject = Record<PropertyKey, any>;
7625
7625
  type Identity$1<T> = T;
7626
7626
  type Flatten<T> = Identity$1<{ [k in keyof T]: T[k] }>;
7627
- type Prettify$2<T> = { [K in keyof T]: T[K] } & {};
7627
+ type Prettify$1<T> = { [K in keyof T]: T[K] } & {};
7628
7628
  type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K] } & { [K in keyof B]: B[K] }>;
7629
7629
  type TupleItems = ReadonlyArray<SomeType>;
7630
7630
  type AnyFunc = (...args: any[]) => any;
@@ -8110,8 +8110,8 @@ type OptionalInSchema = {
8110
8110
  optin: "optional";
8111
8111
  };
8112
8112
  };
8113
- type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify$2<{ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"] } & { -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"] } & Extra>;
8114
- type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify$2<{ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"] } & { -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"] } & Extra>;
8113
+ type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify$1<{ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"] } & { -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"] } & Extra>;
8114
+ type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify$1<{ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"] } & { -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"] } & Extra>;
8115
8115
  type $ZodObjectConfig = {
8116
8116
  out: Record<string, unknown>;
8117
8117
  in: Record<string, unknown>;
@@ -8994,7 +8994,7 @@ type SchemaKind<T> = [T] extends [$ZodType] ? "zod" : [T] extends [ObjectSchema<
8994
8994
  * const getPostsComments:RoutePattern = "/posts/:postId/comments/:commentId"
8995
8995
  */
8996
8996
  type RoutePattern = `/${string}`;
8997
- type Prettify$1<Obj extends object> = { [Key in keyof Obj]: Obj[Key] } & {};
8997
+ type Prettify<Obj extends object> = { [Key in keyof Obj]: Obj[Key] } & {};
8998
8998
  type GetParam<Route extends string> = Route extends `:${infer Param}` ? { [K in Param]: string } : {};
8999
8999
  /**
9000
9000
  * Extracts route parameters from a given route pattern through colon-prefixed segments.
@@ -9011,7 +9011,7 @@ type GetParam<Route extends string> = Route extends `:${infer Param}` ? { [K in
9011
9011
  * // Expected: {}
9012
9012
  * type NoParams = Params<"/about">;
9013
9013
  */
9014
- type GetRouteParams<Route extends RoutePattern> = Route extends `/${infer Path}/${infer Str}` ? Prettify$1<GetParam<Path> & GetRouteParams<`/${Str}`>> : Route extends `/${infer Path}` ? GetParam<Path> : {};
9014
+ type GetRouteParams<Route extends RoutePattern> = Route extends `/${infer Path}/${infer Str}` ? Prettify<GetParam<Path> & GetRouteParams<`/${Str}`>> : Route extends `/${infer Path}` ? GetParam<Path> : {};
9015
9015
  /**
9016
9016
  * Available schemas validation for an endpoint. It can include body and searchParams schemas.
9017
9017
  */
@@ -9692,8 +9692,7 @@ interface DecodeJWTOptions {
9692
9692
  decrypt?: DecryptOptions;
9693
9693
  }
9694
9694
  //#endregion
9695
- //#region ../core/dist/index-tmedkhtX.d.ts
9696
- //#endregion
9695
+ //#region ../core/dist/index-vaLptcEI.d.ts
9697
9696
  //#region src/jose.d.ts
9698
9697
  /**
9699
9698
  * Creates the JOSE instance used for signing and verifying tokens. It derives keys
@@ -9717,14 +9716,16 @@ declare const createJoseInstance: <DefaultUser extends User = User>(secret?: JWT
9717
9716
  encodeJWT: (payload: TypedJWTPayload<Partial<DefaultUser>>, options?: EncodeJWTOptions) => Promise<string>;
9718
9717
  decodeJWT: (token: string, options?: DecodeJWTOptions) => Promise<TypedJWTPayload<DefaultUser>>;
9719
9718
  }; //#endregion
9719
+ //#region src/identity/arktype.d.ts
9720
+ type SchemaTypes = ZodObject<any> | ObjectSchema<any, undefined> | Type<{}> | TObject;
9721
+ //#endregion
9720
9722
  //#region src/identity/zod.d.ts
9721
- declare const identitySchema$3: ZodObject<{
9723
+ declare const identitySchema: ZodObject<{
9722
9724
  sub: ZodString;
9723
9725
  name: ZodOptional<ZodNullable<ZodString>>;
9724
9726
  image: ZodOptional<ZodNullable<ZodString>>;
9725
9727
  email: ZodOptional<ZodNullable<ZodEmail>>;
9726
9728
  }, $strip>;
9727
- type SchemaTypes = ZodObject<any> | ObjectSchema<any, undefined> | Type<{}> | TObject;
9728
9729
  //#endregion
9729
9730
  //#region src/api/createApi.d.ts
9730
9731
  declare const createAuthAPI: <DefaultUser extends User = User, SignUpSchema extends SchemaTypes = ZodObject<any>>(ctx: GlobalContext) => {
@@ -9808,7 +9809,93 @@ declare const createAuthAPI: <DefaultUser extends User = User, SignUpSchema exte
9808
9809
  * })
9809
9810
  */
9810
9811
  updateSession: (options: UpdateSessionAPIOptions<DefaultUser>) => Promise<UpdateSessionAPIReturn<DefaultUser>>;
9812
+ /**
9813
+ * Retrieves the access token for a specific OAuth provider on the server-side.
9814
+ * It implements CSRF Protection by default, for server-side calls it only verifies and validates the CSRF Token,
9815
+ * it also provides Double-Submit Cookie protection by requiring the `session_token` cookie to be included in
9816
+ * the request headers.
9817
+ *
9818
+ * @params oauth - The OAuth provider for which to retrieve the access token (e.g., "github", "gitlab", "bitbucket").
9819
+ * @params options - Options for the API call, including headers and request object.
9820
+ * @example
9821
+ * const { success, tokens } = await api.getProviderTokens("github", {
9822
+ * headers: getHeaders()
9823
+ * })
9824
+ *
9825
+ * const { accessToken, refreshToken } = tokens
9826
+ */
9811
9827
  getProviderTokens: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: GetProviderTokensAPIOptions) => Promise<GetProviderTokensAPIReturn>;
9828
+ /**
9829
+ * Retrieves the access token for a specific OAuth provider on the server-side.
9830
+ * It implements CSRF Protection by default, for server-side calls it only verifies and validates the CSRF Token,
9831
+ * it also provides Double-Submit Cookie protection by requiring the `session_token` cookie to be included in
9832
+ * the request headers.
9833
+ *
9834
+ * > **NOTE**: This method is based on `getProviderTokens` and it's recommended for simple use cases where only the
9835
+ * access token is needed. For more advanced scenarios, consider using `getProviderTokens` directly.
9836
+ *
9837
+ * @params oauth - The OAuth provider for which to retrieve the access token (e.g., "github", "gitlab", "bitbucket").
9838
+ * @params options - Options for the API call, including headers and request object.
9839
+ * @example
9840
+ * const { success, accessToken } = await api.getAccessToken("github", {
9841
+ * headers: getHeaders()
9842
+ * })
9843
+ */
9844
+ getAccessToken: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: AccessTokenAPIOptions) => Promise<AccessTokenAPIReturn>;
9845
+ /**
9846
+ * Refreshes the user profile data from the OAuth provider on the server-side. It makes a request to the
9847
+ * `userInfo` endpoint of the specified OAuth provider.
9848
+ *
9849
+ * @param oauth - The OAuth provider for which to refresh the user profile data (e.g., "github", "gitlab", "bitbucket").
9850
+ * @param options - Options for the API call, including headers and request object.
9851
+ * @example
9852
+ * const { success, session } = await api.refreshUserInfo("github", {
9853
+ * headers: getHeaders()
9854
+ * })
9855
+ */
9856
+ refreshUserInfo: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: RefreshUserInfoAPIOptions) => Promise<RefreshUserInfoAPIReturn<DefaultUser>>;
9857
+ /**
9858
+ * Revokes the access token for a specific OAuth provider on the server-side. It makes a request to the
9859
+ * `revokeToken` endpoint of the specified OAuth provider.
9860
+ *
9861
+ * @param oauth - The OAuth provider for which to revoke the access token (e.g., "github", "gitlab", "bitbucket").
9862
+ * @param options - Options for the API call, including headers and request object.
9863
+ * @example
9864
+ * const { success, headers } = await api.revokeToken("github", {
9865
+ * headers: getHeaders()
9866
+ * })
9867
+ * // Use the returned headers to update the response headers in your server-side logic
9868
+ * return new Response(null, { status: 200, headers })
9869
+ */
9870
+ revokeToken: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: RevokeTokenAPIOptions) => Promise<RevokeTokenAPIReturn>;
9871
+ /**
9872
+ * Disconnects the OAuth provider for the current session on the server-side. It removes the association
9873
+ * between the user's session and the specified OAuth provider.
9874
+ * @params oauth - The OAuth provider to disconnect (e.g., "github", "gitlab", "bitbucket").
9875
+ * @params options - Options for the API call, including headers and request object.
9876
+ * @example
9877
+ * const { success, headers } = await api.disconnectProvider("github", {
9878
+ * headers: getHeaders()
9879
+ * })
9880
+ * // Use the returned headers to update the response headers in your server-side logic
9881
+ * return new Response(null, { status: 200, headers })
9882
+ */
9883
+ disconnectProvider: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: DisconnectProviderAPIOptions) => Promise<DisconnectProviderAPIReturn>;
9884
+ /**
9885
+ * Checks if the current session is connected to a specific OAuth provider on the server-side. It verifies
9886
+ * the presence of a valid access token for the specified provider in the session.
9887
+ *
9888
+ * @param oauth - The OAuth provider to check for connection (e.g., "github", "gitlab", "bitbucket").
9889
+ * @param options - Options for the API call, including headers and request object.
9890
+ * @example
9891
+ * const { success, connected } = await api.isProviderConnected("github", {
9892
+ * headers: getHeaders()
9893
+ * })
9894
+ * if (connected) {
9895
+ * // The session is connected to the GitHub provider
9896
+ * }
9897
+ */
9898
+ isProviderConnected: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: ProviderConnectedAPIOptions) => Promise<ProviderConnectedAPIReturn>;
9812
9899
  /**
9813
9900
  * Signs out the current session on the server-side. It implements CSRF Protection by default, for
9814
9901
  * server-side calls it only verifies and validates the CSRF Token, it also provides Double-Submit
@@ -9834,9 +9921,248 @@ declare const createAuthAPI: <DefaultUser extends User = User, SignUpSchema exte
9834
9921
  * Each message includes facility, severity, msgId, and default message.
9835
9922
  */
9836
9923
  //#endregion
9924
+ //#region src/@types/entities.d.ts
9925
+ type UserStatus = "active" | "suspended" | "pending_verification" | "deleted";
9926
+ /**
9927
+ * @todo: add "passkey" and "saml" to AccountType when we implement those providers
9928
+ */
9929
+ type AccountType$1 = "oauth" | "credentials";
9930
+ type AccountStatus = "active" | "unlinked" | "suspended";
9931
+ type SessionStatus = "active" | "expired" | "revoked";
9932
+ /**
9933
+ * Tracks MFA progress within a session.
9934
+ * - "none": MFA not required for this user or session
9935
+ * - "pending": primary auth passed, MFA challenge not yet completed
9936
+ * - "completed": MFA challenge passed
9937
+ * - "skipped": trusted device, MFA step-up bypassed
9938
+ */
9939
+ type MFAState = "none" | "pending" | "completed" | "skipped";
9940
+ type MFAMethod = "totp" | "webauthn_passkey" | "webauthn_security_key" | "sms" | "email" | "recovery_code";
9941
+ type DeviceType = "desktop" | "mobile" | "tablet" | "tv" | "bot" | "unknown";
9942
+ type RevokeReason = "user_logout" | "admin_action" | "password_changed" | "email_changed" | "all_sessions_revoked" | "mfa_disabled" | "account_suspended" | "max_sessions_exceeded";
9943
+ interface UserEntity {
9944
+ id: string;
9945
+ name: string | null;
9946
+ email: string | null;
9947
+ image: string | null;
9948
+ emailVerifiedAt: Date | null;
9949
+ status: UserStatus;
9950
+ mfaEnabled: boolean;
9951
+ mfaPreferredMethod: MFAMethod | null;
9952
+ createdAt: Date;
9953
+ updatedAt: Date;
9954
+ /**
9955
+ * Used to store the extra user attributes and extended by the `identity.schema`
9956
+ * configuration.
9957
+ */
9958
+ attributes: Record<string, unknown> | null;
9959
+ }
9960
+ interface AccountEntity {
9961
+ id: string;
9962
+ userId: string;
9963
+ provider: string;
9964
+ providerUserId: string;
9965
+ type: AccountType$1;
9966
+ status: AccountStatus;
9967
+ createdAt: Date;
9968
+ updatedAt: Date;
9969
+ }
9970
+ interface OAuthAccountEntity {
9971
+ accountId: string;
9972
+ accessToken: string;
9973
+ refreshToken: string | null;
9974
+ idToken: string | null;
9975
+ tokenType: string | null;
9976
+ scopes: string | null;
9977
+ issuer: string | null;
9978
+ accessTokenExpiresAt: Date | null;
9979
+ refreshTokenExpiresAt: Date | null;
9980
+ updatedAt: Date;
9981
+ }
9982
+ interface CredentialAccountEntity {
9983
+ accountId: string;
9984
+ passwordHash: string;
9985
+ updatedAt: Date;
9986
+ }
9987
+ interface SessionEntity {
9988
+ id: string;
9989
+ userId: string;
9990
+ deviceId: string | null;
9991
+ authenticatedWith: string;
9992
+ status: SessionStatus;
9993
+ mfaState: MFAState;
9994
+ tokenHash: string;
9995
+ expiresAt: Date;
9996
+ metadata: Record<string, unknown> | null;
9997
+ lastActivityAt: Date;
9998
+ revokedAt: Date | null;
9999
+ createdAt: Date;
10000
+ updatedAt: Date;
10001
+ }
10002
+ type SessionWithUserEntity = SessionEntity & {
10003
+ user: UserEntity;
10004
+ };
10005
+ /**
10006
+ * Tracks physical devices across sessions.
10007
+ */
10008
+ interface DeviceEntity {
10009
+ id: string;
10010
+ userId: string;
10011
+ /**
10012
+ * User-assigned label for the device, e.g. "Work MacBook" or "iPhone 14 Pro".
10013
+ */
10014
+ name: string | null;
10015
+ type: DeviceType;
10016
+ /**
10017
+ * Platform name and version, e.g. "macOS 14.1" or "Android 14".
10018
+ */
10019
+ platform: string | null;
10020
+ /**
10021
+ * Browser name and version, e.g. "Chrome 120" or "Safari 17".
10022
+ */
10023
+ browser: string | null;
10024
+ /**
10025
+ * User-Agent string captured at first sign-in from this device.
10026
+ * @see https://developer.mozilla.org/es/docs/Web/HTTP/Reference/Headers/User-Agent
10027
+ */
10028
+ userAgent: string | null;
10029
+ fingerprint: string | null;
10030
+ lastIp: string | null;
10031
+ trusted: boolean;
10032
+ firstSeenAt: Date;
10033
+ lastSeenAt: Date;
10034
+ metadata: Record<string, unknown> | null;
10035
+ }
10036
+ interface MFACredentialEntity {
10037
+ id: string;
10038
+ userId: string;
10039
+ type: MFAMethod;
10040
+ credentialData: Record<string, unknown>;
10041
+ isPrimary: boolean;
10042
+ verifiedAt: Date | null;
10043
+ createdAt: Date;
10044
+ metadata: Record<string, unknown> | null;
10045
+ }
10046
+ /**
10047
+ * Stores the OAuth transaction state during an OAuth or OIDC authorization flow.
10048
+ */
10049
+ interface OAuthTransactionEntity {
10050
+ id: string;
10051
+ provider: string;
10052
+ state: string;
10053
+ nonce: string | null;
10054
+ codeVerifier: string | null;
10055
+ redirectURI: string;
10056
+ redirectTo: string | null;
10057
+ userAgent: string | null;
10058
+ fingerprint: string | null;
10059
+ deviceId: string | null;
10060
+ createdAt: Date;
10061
+ expiresAt: Date;
10062
+ metadata: Record<string, unknown> | null;
10063
+ } //#endregion
10064
+ //#region src/@types/adapter.d.ts
10065
+ interface UsersAdapter {
10066
+ /**
10067
+ * User management methods
10068
+ */
10069
+ createUser(input: Partial<Omit<UserEntity, "createdAt" | "updatedAt">>): Promise<UserEntity>;
10070
+ getUserById(id: string): Promise<UserEntity | null>;
10071
+ getUserByEmail(email: string): Promise<UserEntity | null>;
10072
+ updateUser(id: string, input: Partial<Omit<UserEntity, "createdAt" | "updatedAt">>): Promise<UserEntity>;
10073
+ /**
10074
+ * Soft delete: sets status = "deleted", row is preserved.
10075
+ * Hard delete: removes the row and all owned rows (Accounts, Sessions,
10076
+ * Devices, MfaCredentials). Strategy is set in AdapterConfig, not here.
10077
+ *
10078
+ * Delete an user based on the selected strategy.
10079
+ * - `"soft"`: The user is marked as deleted, but the row is preserved in the database.
10080
+ * - `"hard"`: The user and all associated data (Accounts, Sessions, Devices, MfaCredentials) are permanently removed from the database.
10081
+ */
10082
+ deleteUser(id: string): Promise<void>;
10083
+ }
10084
+ interface AccountsAdapter {
10085
+ /**
10086
+ * Account management methods
10087
+ */
10088
+ createAccount(input: Partial<Omit<AccountEntity, "createdAt" | "updatedAt">>): Promise<AccountEntity>;
10089
+ getAccountById(id: string): Promise<AccountEntity | null>;
10090
+ getAccountByProvider(provider: string, providerUserId: string): Promise<AccountEntity | null>;
10091
+ getAccountsByUserId(userId: string): Promise<AccountEntity[]>;
10092
+ updateAccountStatus(id: string, status: AccountEntity["status"]): Promise<AccountEntity>;
10093
+ unlinkAccount(id: string): Promise<void>;
10094
+ }
10095
+ interface OAuthAccountsAdapter {
10096
+ /**
10097
+ * OAuthAccount management methods
10098
+ */
10099
+ createOAuthAccount(input: Partial<Omit<OAuthAccountEntity, "createdAt" | "updatedAt">>): Promise<OAuthAccountEntity>;
10100
+ getOAuthAccount(accountId: string): Promise<OAuthAccountEntity | null>;
10101
+ updateOAuthTokens(accountId: string, input: Partial<Omit<OAuthAccountEntity, "createdAt" | "updatedAt">>): Promise<OAuthAccountEntity>;
10102
+ }
10103
+ interface CredentialAccountsAdapter {
10104
+ /**
10105
+ * CredentialAccounts management methods.
10106
+ */
10107
+ createCredentialAccount(input: Partial<Omit<CredentialAccountEntity, "updatedAt">>): Promise<CredentialAccountEntity>;
10108
+ getCredentialAccount(accountId: string): Promise<CredentialAccountEntity | null>;
10109
+ updatePasswordHash(accountId: string, passwordHash: string): Promise<CredentialAccountEntity>;
10110
+ }
10111
+ interface SessionsAdapter {
10112
+ /**
10113
+ * Session management methods.
10114
+ */
10115
+ createSession(input: Omit<SessionEntity, "createdAt" | "updatedAt" | "lastActivityAt" | "revokedAt">): Promise<SessionEntity>;
10116
+ getSessionByToken(token: string): Promise<SessionWithUserEntity | null>;
10117
+ getSessionById(id: string): Promise<SessionEntity | null>;
10118
+ listSessions(filter: Pick<SessionEntity, "userId" | "status" | "deviceId">): Promise<SessionEntity[]>;
10119
+ updateSession(id: string, input: Partial<Omit<SessionEntity, "createdAt" | "updatedAt" | "revokedAt">>): Promise<SessionEntity>;
10120
+ touchSession(id: string, lastActivityAt: Date): Promise<void>;
10121
+ revokeSession(id: string, reason: RevokeReason): Promise<void>;
10122
+ revokeAllSessions(userId: string, reason: RevokeReason, exceptSessionId?: string): Promise<number>;
10123
+ }
10124
+ interface DevicesAdapter {
10125
+ /**
10126
+ * Device management methods.
10127
+ */
10128
+ createDevice(input: Omit<DeviceEntity, "id" | "createdAt" | "updatedAt">): Promise<DeviceEntity>;
10129
+ getDeviceById(id: string): Promise<DeviceEntity | null>;
10130
+ getDeviceByFingerprint(userId: string, fingerprint: string): Promise<DeviceEntity | null>;
10131
+ getDevicesByUserId(userId: string): Promise<DeviceEntity[]>;
10132
+ updateDevice(id: string, input: Partial<Omit<DeviceEntity, "createdAt" | "updatedAt">>): Promise<DeviceEntity>;
10133
+ trustDevice(id: string, trusted: boolean): Promise<DeviceEntity>;
10134
+ deleteDevice(id: string): Promise<void>;
10135
+ }
10136
+ interface MFACredentialsAdapter {
10137
+ /**
10138
+ * MFACredentials management methods.
10139
+ */
10140
+ createMfaCredential(input: Omit<MFACredentialEntity, "id" | "verifiedAt" | "updatedAt">): Promise<MFACredentialEntity>;
10141
+ getMfaCredentialById(id: string): Promise<MFACredentialEntity | null>;
10142
+ getMfaCredentialsByUserId(userId: string): Promise<MFACredentialEntity[]>;
10143
+ getMfaCredentialsByType(userId: string, type: MFAMethod): Promise<MFACredentialEntity[]>;
10144
+ verifyMfaCredential(id: string): Promise<MFACredentialEntity>;
10145
+ updateMfaCredential(id: string, input: Omit<MFACredentialEntity, "id" | "verifiedAt" | "updatedAt">): Promise<MFACredentialEntity>;
10146
+ deleteMfaCredential(id: string): Promise<void>;
10147
+ }
10148
+ interface OAuthTransactionsAdapter {
10149
+ /**
10150
+ * OAuthTransaction management methods.
10151
+ */
10152
+ createOAuthTransaction(input: OAuthTransactionEntity): Promise<OAuthTransactionEntity>;
10153
+ getOAuthTransactionByState(state: string): Promise<OAuthTransactionEntity | null>;
10154
+ consumeOAuthTransaction(state: string): Promise<OAuthTransactionEntity | null>;
10155
+ deleteExpiredOAuthTransactions(): Promise<number>;
10156
+ }
10157
+ /**
10158
+ * The database adapter interface. Each provider package must implement this.
10159
+ */
10160
+ interface DatabaseAdapter extends UsersAdapter, AccountsAdapter, OAuthAccountsAdapter, CredentialAccountsAdapter, SessionsAdapter, DevicesAdapter, MFACredentialsAdapter, OAuthTransactionsAdapter {} //#endregion
10161
+ //#region src/session/cookie-manager.d.ts
10162
+ //#endregion
9837
10163
  //#region src/@types/session.d.ts
9838
10164
  /** Application user type, inferred from the configured identity schema (defaults to the built-in user shape). */
9839
- type User = output<typeof identitySchema$3>;
10165
+ type User = output<typeof identitySchema>;
9840
10166
  /**
9841
10167
  * Session data returned by the session endpoint.
9842
10168
  */
@@ -9904,11 +10230,16 @@ type JWTSealedMode = {
9904
10230
  };
9905
10231
  /** Discriminated union of JWT wire format: signed JWS, encrypted JWE, or nested sealed (JWS in JWE). */
9906
10232
  type JWTConfigBase = JWTSignedMode | JWTEncryptedMode | JWTSealedMode;
9907
- /** How session/JWT lifetime is enforced relative to `iat`, absolute caps, and sliding windows. */
9908
- type JWTExpirationStrategy = "fixed" | "rolling" | "absolute" | "sliding";
10233
+ type ExpirationStrategy = "fixed" | "rolling" | "absolute" | "sliding";
10234
+ /**
10235
+ * How session/JWT lifetime is enforced relative to `iat`, absolute caps, and sliding windows.
10236
+ * @deprecated Use `ExpirationStrategy` instead. This will be removed in a future release.
10237
+ */
10238
+ type JWTExpirationStrategy = ExpirationStrategy;
9909
10239
  type JWTConfig = Prettify<{
9910
10240
  /**
9911
10241
  * Token lifetime.
10242
+ * @deprecated Use `session.maxAge` instead. This will be removed in a future release.
9912
10243
  */
9913
10244
  maxAge?: number;
9914
10245
  /**
@@ -9925,13 +10256,62 @@ type JWTConfig = Prettify<{
9925
10256
  * Maximum absolute session duration in seconds.
9926
10257
  * Required for "absolute" and "sliding" strategies.
9927
10258
  * Enforced via jose's maxTokenAge against the iat claim.
10259
+ * @deprecated Use `session.maxDuration` instead. This will be removed in a future release.
9928
10260
  */
9929
10261
  maxExpiration?: number;
9930
10262
  /**
9931
10263
  * Policy for renewing or capping token lifetime (pairs with `maxExpiration` where applicable).
10264
+ * @deprecated Use `session.expirationStrategy` instead. This will be removed in a future release.
9932
10265
  */
9933
10266
  expirationStrategy?: JWTExpirationStrategy;
9934
10267
  } & JWTConfigBase>;
10268
+ interface SessionStatefulConfig {
10269
+ /**
10270
+ * The session deletion strategy when a user is deleted. Defaults to "soft" (mark as deleted, keep for audit).
10271
+ * - "soft": The user is marked as deleted, but the row is preserved in the database.
10272
+ * - "hard": The user and all associated data (Accounts, Sessions, Devices, MfaCredentials) are permanently removed from the database.
10273
+ */
10274
+ deleteStrategy?: "soft" | "hard";
10275
+ /**
10276
+ * The maximum number of concurrent sessions allowed per user. If exceeded, the oldest session(s) will be revoked.
10277
+ * If not set, there is no limit on concurrent sessions.
10278
+ */
10279
+ maxSessions?: number;
10280
+ /**
10281
+ * Defines the minimum interval (in seconds) between session "touches" (updates to lastActivityAt) to reduce database writes.
10282
+ */
10283
+ touchInterval?: number;
10284
+ }
10285
+ interface SessionConfigBase {
10286
+ /**
10287
+ * Session time to live (TTL) in seconds. Determines how long a session is valid before it expires.
10288
+ * If not set, the default is 15 days (60 * 60 * 24 * 15).
10289
+ * @default 1296000 (15 days)
10290
+ */
10291
+ maxAge?: number;
10292
+ /**
10293
+ * Maximum absolute session duration in seconds.
10294
+ * Required for "absolute" and "sliding" strategies.
10295
+ * Enforced via jose's maxTokenAge against the iat claim.
10296
+ */
10297
+ maxDuration?: number;
10298
+ /**
10299
+ * The session expiration strategy. Determines how the session's lifetime is calculated and enforced.
10300
+ * - "fixed": The session expires after a fixed duration from the time of creation.
10301
+ * - "rolling": The session expiration is extended on each request, up to the maximum age.
10302
+ * - "absolute": The session has a hard expiration time, regardless of activity.
10303
+ * - "sliding": The session expiration is extended on each request, but cannot exceed the maximum expiration time.
10304
+ *
10305
+ * @default "absolute"
10306
+ */
10307
+ expirationStrategy?: ExpirationStrategy;
10308
+ /**
10309
+ * The sliding threshold percentage p for the `"sliding"` expiration strategy. Determines when the
10310
+ * session expiration is extended based on the remaining time.
10311
+ * @default 0.5 (50%)
10312
+ */
10313
+ slidingThreshold?: number;
10314
+ }
9935
10315
  /**
9936
10316
  * Stateless JWT strategy.
9937
10317
  * No database required. Tokens are self-contained and cannot be revoked
@@ -9940,14 +10320,33 @@ type JWTConfig = Prettify<{
9940
10320
  * @example
9941
10321
  * {
9942
10322
  * strategy: "jwt",
9943
- * jwt: { mode: "sealed", maxAge: "15m", issuer: "https://auth.example.com" },
9944
- * refreshToken: { enabled: true, maxAge: "7d" },
10323
+ * jwt: { mode: "sealed", issuer: "https://auth.example.com" },
9945
10324
  * }
9946
10325
  */
9947
- type StatelessStrategyConfig = {
10326
+ interface StatelessStrategyConfig extends SessionConfigBase {
9948
10327
  strategy?: "jwt";
9949
10328
  jwt?: JWTConfig;
9950
- };
10329
+ }
10330
+ /**
10331
+ * Stateful database strategy.
10332
+ * Database required. Every request hits the DB to validate the session.
10333
+ *
10334
+ * @example
10335
+ * {
10336
+ * strategy: "database",
10337
+ * adapter: prismaAdapter({ client: prismaClient }),
10338
+ * database: { deleteStrategy: "soft", maxSessions: 5 },
10339
+ * }
10340
+ */
10341
+ interface StatefulStrategyConfig extends SessionConfigBase {
10342
+ strategy: "database";
10343
+ adapter: DatabaseAdapter;
10344
+ database?: SessionStatefulConfig;
10345
+ /**
10346
+ * @deprecated Use `database` instead. This will be removed in a future release.
10347
+ */
10348
+ session?: SessionStatefulConfig;
10349
+ }
9951
10350
  /**
9952
10351
  * The session strategy. Determines which fields below are required.
9953
10352
  *
@@ -9957,7 +10356,7 @@ type StatelessStrategyConfig = {
9957
10356
  *
9958
10357
  * @default "jwt"
9959
10358
  */
9960
- type SessionConfig = StatelessStrategyConfig;
10359
+ type SessionConfig = StatelessStrategyConfig | StatefulStrategyConfig;
9961
10360
  /** Result of reading a stateless (JWT) session from a request: session payload and outgoing header mutations. */
9962
10361
  interface OAuthTokenPayload {
9963
10362
  /**
@@ -9966,8 +10365,10 @@ interface OAuthTokenPayload {
9966
10365
  accessToken: string;
9967
10366
  /**
9968
10367
  * The expiration time of the access token, in seconds since the epoch (Unix time).
10368
+ * @deprecated
9969
10369
  */
9970
10370
  expiresAt: number;
10371
+ accessTokenExpiresAt?: number;
9971
10372
  /**
9972
10373
  * The raw refresh token string issued by the OAuth provider, if applicable.
9973
10374
  */
@@ -9996,28 +10397,8 @@ interface OAuthTokenPayload {
9996
10397
  * The time at which the token was issued, in seconds since the epoch (Unix time).
9997
10398
  */
9998
10399
  issuedAt: number;
9999
- } //#endregion
10000
- //#region src/validator/registry.d.ts
10001
- type OpenIDProvider<Profile extends object = Record<string, any>, DefaultUser = User, Issuer extends string = string> = {
10002
- id: string;
10003
- name: string;
10004
- /**
10005
- * URL to concatenating the string /.well-known/openid-configuration to the Issuer.
10006
- */
10007
- issuer: Issuer;
10008
- clientId?: string;
10009
- clientSecret?: string;
10010
- /**
10011
- * Refresh window in seconds before the access token expires to attempt a refresh.
10012
- * Defaults to 300 seconds.
10013
- */
10014
- refreshWindow?: number;
10015
- /**
10016
- * Override the default OIDC scope (`openid profile email`).
10017
- */
10018
- scope?: string;
10019
- profile?: (profile: Profile) => DefaultUser | Promise<DefaultUser>;
10020
- } & GetRouteParams<`/${Issuer}`>; //#endregion
10400
+ }
10401
+ //#endregion
10021
10402
  //#region src/oauth/github.d.ts
10022
10403
  /**
10023
10404
  * @see [Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
@@ -10557,6 +10938,7 @@ interface AtlassianProfile {
10557
10938
  created_at: string;
10558
10939
  }
10559
10940
  /**
10941
+ * @see [Atlassian - Authorizing OAuth Apps](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/)
10560
10942
  * @see [Atlassian - OAuth Apps](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/)
10561
10943
  * @see [Atlassian - My Apps](https://developer.atlassian.com/console/myapps/)
10562
10944
  * @see [Atlassian - Retrieve Authenticated User](https://developer.atlassian.com/cloud/jira/software/oauth-2-3lo-apps/#how-do-i-retrieve-the-public-profile-of-the-authenticated-user-)
@@ -10865,7 +11247,35 @@ interface AuthentikProfile {
10865
11247
  * @see [Authentik - OAuth 2.0 Provider](https://docs.goauthentik.io/add-secure-apps/providers/oauth2/)
10866
11248
  * @see [Authentik - Create an OAuth2 Provider](https://docs.goauthentik.io/add-secure-apps/providers/oauth2/create-oauth2-provider/)
10867
11249
  */
10868
- //#endregion
11250
+ type OpenIDProvider<Profile extends object = Record<string, any>, DefaultUser = User, Issuer extends string = string> = {
11251
+ id: string;
11252
+ name: string;
11253
+ /**
11254
+ * URL to concatenating the string /.well-known/openid-configuration to the Issuer.
11255
+ */
11256
+ issuer: Issuer;
11257
+ clientId?: string;
11258
+ clientSecret?: string;
11259
+ /**
11260
+ * Refresh window in seconds before the access token expires to attempt a refresh.
11261
+ * Defaults to 300 seconds.
11262
+ */
11263
+ refreshWindow?: number;
11264
+ /**
11265
+ * Revoke the access token configuration for the OAuth provider. It revokes the access token but not
11266
+ * invalidate the session when there are multiple access token configured for the session.
11267
+ */
11268
+ revokeToken?: string | {
11269
+ url: string;
11270
+ headers?: Record<string, string>;
11271
+ params?: Record<RevokeTokenParams, RevokeTokenTokenHint>;
11272
+ };
11273
+ /**
11274
+ * Override the default OIDC scope (`openid profile email`).
11275
+ */
11276
+ scope?: string;
11277
+ profile?: (profile: Profile) => DefaultUser | Promise<DefaultUser>;
11278
+ } & Partial<GetRouteParams<`/${Issuer}`>>; //#endregion
10869
11279
  //#region src/oauth/index.d.ts
10870
11280
  declare const builtInOAuthProviders: {
10871
11281
  readonly github: <DefaultUser extends User = {
@@ -11024,8 +11434,11 @@ type AccessTokenContext = {
11024
11434
  };
11025
11435
  /** Known query parameter names supported when building an OAuth authorization URL. */
11026
11436
  type AuthorizeParams = LiteralUnion<"clientId" | "prompt" | "scope" | "responseMode" | "audience" | "loginHint" | "nonce" | "display">;
11437
+ /** Known query parameter names supported when revoking an OAuth token. */
11438
+ type RevokeTokenParams = LiteralUnion<"tokenHint">;
11439
+ type RevokeTokenTokenHint = LiteralUnion<"access_token" | "refresh_token">;
11027
11440
  /** OAuth 2.0 `response_type` values used in authorization requests. */
11028
- type ResponseType = LiteralUnion<"code" | "token" | "refresh_token" | "id_token">;
11441
+ type ResponseType$1 = LiteralUnion<"code" | "token" | "refresh_token" | "id_token">;
11029
11442
  /**
11030
11443
  * Configuration for an OAuth provider without credentials.
11031
11444
  * Use this type when defining provider metadata and endpoints.
@@ -11041,7 +11454,7 @@ interface OAuthProviderConfig<Profile extends object = Record<string, any>, Defa
11041
11454
  authorize: string | {
11042
11455
  url: string;
11043
11456
  params?: Partial<Record<AuthorizeParams, string> & {
11044
- responseType: ResponseType;
11457
+ responseType: ResponseType$1;
11045
11458
  }>;
11046
11459
  };
11047
11460
  accessToken: string | {
@@ -11064,6 +11477,18 @@ interface OAuthProviderConfig<Profile extends object = Record<string, any>, Defa
11064
11477
  url: string;
11065
11478
  headers?: Record<string, string>;
11066
11479
  params?: Record<string, string>;
11480
+ authorization?: {
11481
+ type: "basic" | "credentials";
11482
+ };
11483
+ };
11484
+ /**
11485
+ * Revoke the access token configuration for the OAuth provider. It revokes the access token but not
11486
+ * invalidate the session when there are multiple access token configured for the session.
11487
+ */
11488
+ revokeToken?: string | {
11489
+ url: string;
11490
+ headers?: Record<string, string>;
11491
+ params?: Record<RevokeTokenParams, RevokeTokenTokenHint>;
11067
11492
  };
11068
11493
  /**
11069
11494
  * Refresh window in seconds before the access token expires to attempt a refresh.
@@ -11079,7 +11504,7 @@ interface OAuthProviderConfig<Profile extends object = Record<string, any>, Defa
11079
11504
  * @deprecated
11080
11505
  * use `authorize.params.responseType` instead of `responseType`
11081
11506
  */
11082
- responseType?: ResponseType;
11507
+ responseType?: ResponseType$1;
11083
11508
  profile?: (profile: Profile) => DefaultUser | Promise<DefaultUser>;
11084
11509
  }
11085
11510
  /**
@@ -11100,16 +11525,15 @@ interface OAuthProviderCredentials<Profile extends object = Record<string, any>,
11100
11525
  type AuthAPI<DefaultUser extends User = User, SignUpSchema extends SchemaTypes = ZodObject<any>> = ReturnType<typeof createAuthAPI<DefaultUser, SignUpSchema>>;
11101
11526
  /** JWT and crypto helpers bound to the configured identity schema (sign, verify, claims). */
11102
11527
  type JoseInstance<DefaultUser extends User = User> = ReturnType<typeof createJoseInstance<DefaultUser>>;
11103
- /** Normalized internal logger with resolved level and structured log function. */
11104
11528
  /** Payload sent to the credentials sign-in endpoint (username/password flow). */
11105
11529
  interface CredentialsPayload {
11106
11530
  username: string;
11107
11531
  password: string;
11108
11532
  }
11109
11533
  /**
11110
- * Context provided to the credentials provider's authorize function.
11111
- * It includes the credentials sent by the user and hashing utilities.
11534
+ * Interface for the credentials provider.
11112
11535
  */
11536
+ type Handlers = { [method in "GET" | "POST" | "PATCH" | "DELETE" | "ALL"]: (request: Request) => Response | Promise<Response> };
11113
11537
  /**
11114
11538
  * Public auth instance: programmatic {@link AuthAPI}, {@link JoseInstance}, and HTTP {@link AuthClient} handlers.
11115
11539
  */
@@ -11125,20 +11549,11 @@ interface AuthInstance<DefaultUser extends User = User, SignUpSchema extends Sch
11125
11549
  /**
11126
11550
  * HTTP handlers for mounting on a router or server.
11127
11551
  */
11128
- handlers: {
11129
- GET: (request: Request) => Response | Promise<Response>;
11130
- POST: (request: Request) => Response | Promise<Response>;
11131
- PATCH: (request: Request) => Response | Promise<Response>;
11132
- ALL: (request: Request) => Response | Promise<Response>;
11133
- };
11552
+ handlers: Handlers;
11134
11553
  }
11135
- /**
11136
- * Extended context used inside the library with both secure and standard cookie materializations.
11137
- */
11554
+ /** Minimal token issue/verify surface used by session code paths. */
11138
11555
  //#endregion
11139
11556
  //#region src/@types/utility.d.ts
11140
- /** Expands intersection types into a single flat object type for readable editor hints. */
11141
- type Prettify<T> = { [K in keyof T]: T[K] };
11142
11557
  /**
11143
11558
  * A string that must be one of the literals in `T`, or any other string (`U`).
11144
11559
  * Useful for autocomplete on known keys while still allowing custom values.
@@ -11216,10 +11631,6 @@ type AuthActionAPIReturn<Body extends object, ErrorCodes = any> = (Extract<Body,
11216
11631
  success: true;
11217
11632
  }>>;
11218
11633
  });
11219
- /**
11220
- * Utility to merge the internal router global context (`ctx`) with per-function options.
11221
- * Used by implementation-level API functions in `src/api/*`.
11222
- */
11223
11634
  interface APIOptionsWithRedirectTo {
11224
11635
  /**
11225
11636
  * Optional redirect strategy for server/programmatic API functions.
@@ -11257,7 +11668,7 @@ interface APIOptionsWithRedirectTo {
11257
11668
  */
11258
11669
  redirectTo?: string;
11259
11670
  }
11260
- interface APIOptionsWithRequest extends APIOptionsWithRedirectTo {
11671
+ interface APIOptionsWithRequest {
11261
11672
  /**
11262
11673
  * Optional `Request` object, useful for constructing the incoming URL on the server side.
11263
11674
  * This option is required when the `redirectTo` option is defined, to ensure the `redirectTo`
@@ -11279,8 +11690,26 @@ interface APIOptionsWithSkipCSRFCheck {
11279
11690
  * The CSRF token is still required and validated to preserve request integrity.
11280
11691
  * Use this only for trusted server-side flows.
11281
11692
  * @default `false`
11693
+ * @deprecated Use `doubleSubmitToken` to provide the CSRF token explicitly instead of skipping the check.
11282
11694
  */
11283
11695
  skipCSRFCheck?: boolean;
11696
+ /**
11697
+ * Optional token used to perform Double-Submit Cookie validation.
11698
+ *
11699
+ * By default, server-side API functions skip the Double-Submit Cookie validation
11700
+ * because they execute in a trusted server environment where the CSRF token is
11701
+ * not directly available. Providing this value enables the same Double-Submit
11702
+ * Cookie validation performed by the HTTP endpoints.
11703
+ *
11704
+ * Other CSRF protections remain enabled regardless of whether this option is
11705
+ * provided.
11706
+ *
11707
+ * @example
11708
+ * api.signOut({
11709
+ * doubleSubmitToken: "csrf-token-value",
11710
+ * })
11711
+ */
11712
+ doubleSubmitToken?: string;
11284
11713
  }
11285
11714
  /** Options to get the current session. */
11286
11715
  interface GetSessionAPIOptions {
@@ -11298,25 +11727,36 @@ type GetSessionAPIReturn<DefaultUser extends User = User> = AuthActionAPIReturn<
11298
11727
  /**
11299
11728
  * Client-side options for `createAuthClient().signIn(...)`.
11300
11729
  */
11730
+ type SignInReturnData = /** redirect: true & redirectTo: string */{
11731
+ success: true;
11732
+ redirect: true;
11733
+ signInURL: string;
11734
+ } /** redirect: false & redirectTo: string */ | {
11735
+ success: true;
11736
+ redirect: false;
11737
+ signInURL: string;
11738
+ } /** redirect: false & redirectTo: null | undefined (not set) */ | {
11739
+ success: false;
11740
+ redirect: false;
11741
+ signInURL: null;
11742
+ };
11743
+ /**
11744
+ * Client-side `signIn` return type.
11745
+ *
11746
+ * - Redirect mode (`redirect: true`): returns `void` because navigation is handled by the client.
11747
+ * - Manual mode (`redirect: false`): returns `signInURL` for caller-controlled navigation.
11748
+ */
11301
11749
  /**
11302
11750
  * Server/programmatic options for `signIn` API.
11303
11751
  */
11304
- interface SignInAPIOptions extends APIOptionsWithRedirectTo, APIOptionsWithRequest {}
11752
+ interface SignInAPIOptions extends APIOptionsWithRequest, APIOptionsWithRedirectTo {}
11305
11753
  /**
11306
11754
  * Server/programmatic `signIn` result.
11307
11755
  *
11308
11756
  * Includes `signInURL` and response metadata to support both framework-managed redirects
11309
11757
  * and custom response handling through `toResponse()`.
11310
11758
  */
11311
- type SignInAPIReturn = AuthActionAPIReturn<{
11312
- success: true;
11313
- redirect: boolean;
11314
- signInURL: string;
11315
- } | {
11316
- success: false;
11317
- redirect: false;
11318
- signInURL: null;
11319
- }>;
11759
+ type SignInAPIReturn = AuthActionAPIReturn<SignInReturnData>;
11320
11760
  type SignInCredentialsReturnData = /** redirect: true & redirectTo: string */{
11321
11761
  success: true;
11322
11762
  redirect: true;
@@ -11339,7 +11779,7 @@ type SignInCredentialsReturnData = /** redirect: true & redirectTo: string */{
11339
11779
  };
11340
11780
  /** Client-side credentials sign-in return type (redirect mode or manual redirect data). */
11341
11781
  /** Server/programmatic credentials sign-in options. */
11342
- interface SignInCredentialsAPIOptions extends APIOptionsWithRedirectTo, APIOptionsWithRequest, APIOptionsWithSkipCSRFCheck {
11782
+ interface SignInCredentialsAPIOptions extends APIOptionsWithRequest, APIOptionsWithRedirectTo, APIOptionsWithSkipCSRFCheck {
11343
11783
  /**
11344
11784
  * Credentials payload validated by the configured `credentials.authorize` function.
11345
11785
  * @example
@@ -11375,7 +11815,7 @@ type SignOutReturnData = /** redirect: true & redirectTo: string */{
11375
11815
  };
11376
11816
  /** Client-side sign-out return type (redirect mode or manual redirect data). */
11377
11817
  /** Server/programmatic options for `signOut` API. */
11378
- interface SignOutAPIOptions extends RequiredKeys<APIOptionsWithRequest, "headers">, APIOptionsWithSkipCSRFCheck {}
11818
+ interface SignOutAPIOptions extends RequiredKeys<APIOptionsWithRequest, "headers">, APIOptionsWithRedirectTo, APIOptionsWithSkipCSRFCheck {}
11379
11819
  /** Programmatic sign-out result with redirect metadata and `toResponse()`. */
11380
11820
  type SignOutAPIReturn = AuthActionAPIReturn<SignOutReturnData>;
11381
11821
  /** Client-side `updateSession` options: partial session payload plus optional redirect behavior. */
@@ -11402,7 +11842,7 @@ type UpdateSessionReturnData<DefaultUser extends User = User> = /** redirect: tr
11402
11842
  };
11403
11843
  /** Client-side `updateSession` return type. */
11404
11844
  /** Server/programmatic options for `updateSession` API. */
11405
- interface UpdateSessionAPIOptions<DefaultUser extends User = User> extends RequiredKeys<APIOptionsWithRequest, "headers">, APIOptionsWithSkipCSRFCheck {
11845
+ interface UpdateSessionAPIOptions<DefaultUser extends User = User> extends RequiredKeys<APIOptionsWithRequest, "headers">, APIOptionsWithRedirectTo, APIOptionsWithSkipCSRFCheck {
11406
11846
  /**
11407
11847
  * Partial session payload used to update the current session.
11408
11848
  * @see Session
@@ -11418,7 +11858,7 @@ interface UpdateSessionAPIOptions<DefaultUser extends User = User> extends Requi
11418
11858
  }
11419
11859
  /** Programmatic session update result with redirect metadata and `toResponse()`. */
11420
11860
  type UpdateSessionAPIReturn<DefaultUser extends User = User> = AuthActionAPIReturn<UpdateSessionReturnData<DefaultUser>>;
11421
- interface SignUpAPIOptions<Payload extends Record<string, any> = Record<string, any>> extends APIOptionsWithRedirectTo, APIOptionsWithRequest, APIOptionsWithSkipCSRFCheck {
11861
+ interface SignUpAPIOptions<Payload extends Record<string, any> = Record<string, any>> extends APIOptionsWithRequest, APIOptionsWithRedirectTo, APIOptionsWithSkipCSRFCheck {
11422
11862
  payload: Payload;
11423
11863
  }
11424
11864
  type SignUpReturnData = /** redirect: true & redirectTo: string */{
@@ -11443,7 +11883,13 @@ type SignUpReturnData = /** redirect: true & redirectTo: string */{
11443
11883
  };
11444
11884
  /** Programmatic sign-up result with redirect metadata and `toResponse()`. */
11445
11885
  type SignUpAPIReturn = AuthActionAPIReturn<SignUpReturnData>;
11446
- interface GetProviderTokensAPIOptions extends Pick<APIOptionsWithRequest, "headers" | "request">, APIOptionsWithSkipCSRFCheck {}
11886
+ /**
11887
+ * Client-side `signUp` options: payload plus optional redirect behavior.
11888
+ */
11889
+ /**
11890
+ * Programmatic options for `getProviderTokens` API.
11891
+ */
11892
+ interface GetProviderTokensAPIOptions extends Pick<APIOptionsWithRequest, "headers" | "request"> {}
11447
11893
  type GetProviderTokensData = {
11448
11894
  success: true;
11449
11895
  tokens: OAuthTokenPayload;
@@ -11451,6 +11897,81 @@ type GetProviderTokensData = {
11451
11897
  success: false;
11452
11898
  tokens: null;
11453
11899
  };
11900
+ /**
11901
+ * Programmatic result for `getProviderTokens` API with response metadata and `toResponse()`.
11902
+ */
11454
11903
  type GetProviderTokensAPIReturn = AuthActionAPIReturn<GetProviderTokensData>;
11904
+ /**
11905
+ * Client-side `getProviderTokens` return type.
11906
+ */
11907
+ /**
11908
+ * Programmatic options for `getAccessToken` API.
11909
+ */
11910
+ type AccessTokenAPIOptions = GetProviderTokensAPIOptions;
11911
+ type AccessTokenData = {
11912
+ success: true;
11913
+ accessToken: string;
11914
+ } | {
11915
+ success: false;
11916
+ accessToken: null;
11917
+ };
11918
+ /**
11919
+ * Programmatic result for `getAccessToken` API with response metadata and `toResponse()`.
11920
+ */
11921
+ type AccessTokenAPIReturn = AuthActionAPIReturn<AccessTokenData>;
11922
+ /**
11923
+ * Programmatic options for `refreshUserInfo` API.
11924
+ */
11925
+ interface RefreshUserInfoAPIOptions extends APIOptionsWithRequest, APIOptionsWithSkipCSRFCheck {}
11926
+ type RefreshUserInfoData<DefaultUser extends User = User> = {
11927
+ success: true;
11928
+ session: Session<DefaultUser>;
11929
+ } | {
11930
+ success: false;
11931
+ session: null;
11932
+ };
11933
+ /**
11934
+ * Programmatic result for `refreshUserInfo` API with response metadata and `toResponse()`.
11935
+ */
11936
+ type RefreshUserInfoAPIReturn<DefaultUser extends User = User> = AuthActionAPIReturn<RefreshUserInfoData<DefaultUser>>;
11937
+ /**
11938
+ * Programmatic options for `revokeToken` API.
11939
+ */
11940
+ interface RevokeTokenAPIOptions extends APIOptionsWithRequest, APIOptionsWithSkipCSRFCheck {}
11941
+ type RevokeTokenData = {
11942
+ success: true;
11943
+ } | {
11944
+ success: false;
11945
+ };
11946
+ /**
11947
+ * Programmatic result for `revokeToken` API with response metadata and `toResponse()`.
11948
+ */
11949
+ type RevokeTokenAPIReturn = AuthActionAPIReturn<RevokeTokenData>;
11950
+ /**
11951
+ * Programmatic options for `disconnectProvider` API.
11952
+ */
11953
+ interface DisconnectProviderAPIOptions extends APIOptionsWithRequest, APIOptionsWithSkipCSRFCheck {}
11954
+ type DisconnectProviderData = {
11955
+ success: true;
11956
+ } | {
11957
+ success: false;
11958
+ };
11959
+ /**
11960
+ * Programmatic result for `disconnectProvider` API with response metadata and `toResponse()`.
11961
+ */
11962
+ type DisconnectProviderAPIReturn = AuthActionAPIReturn<DisconnectProviderData>;
11963
+ type ProviderConnectedAPIOptions = APIOptionsWithRequest;
11964
+ type ProviderConnectedData = {
11965
+ success: true;
11966
+ connected: boolean;
11967
+ } | {
11968
+ success: false;
11969
+ connected: false;
11970
+ };
11971
+ type ProviderConnectedAPIReturn = AuthActionAPIReturn<ProviderConnectedData>; //#endregion
11972
+ //#region src/@types/index.d.ts
11973
+ /**
11974
+ * JWT payload structure that includes a mandatory `token` field used to verify CSRF Tokens
11975
+ */
11455
11976
  //#endregion
11456
- export { DecodeJWTOptions as C, Wrap as S, TypedJWTPayload as T, SignOutAPIReturn as _, GetProviderTokensAPIReturn as a, UpdateSessionAPIOptions as b, LiteralUnion as c, Session as d, SignInAPIOptions as f, SignOutAPIOptions as g, SignInCredentialsAPIReturn as h, GetProviderTokensAPIOptions as i, Prettify as l, SignInCredentialsAPIOptions as m, BuiltInOAuthProvider as n, GetSessionAPIOptions as o, SignInAPIReturn as p, FromShapeToObject as r, GetSessionAPIReturn as s, AuthInstance as t, RemoveIndexSignature as u, SignUpAPIOptions as v, EncodeJWTOptions as w, UpdateSessionAPIReturn as x, SignUpAPIReturn as y };
11977
+ export { SignUpAPIReturn as A, SignInAPIOptions as C, SignOutAPIOptions as D, SignInCredentialsAPIReturn as E, EncodeJWTOptions as F, TypedJWTPayload as I, UpdateSessionAPIReturn as M, Wrap as N, SignOutAPIReturn as O, DecodeJWTOptions as P, Session as S, SignInCredentialsAPIOptions as T, RefreshUserInfoAPIOptions as _, DeepPartial as a, RevokeTokenAPIOptions as b, FromShapeToObject as c, GetSessionAPIOptions as d, GetSessionAPIReturn as f, ProviderConnectedAPIReturn as g, ProviderConnectedAPIOptions as h, BuiltInOAuthProvider as i, UpdateSessionAPIOptions as j, SignUpAPIOptions as k, GetProviderTokensAPIOptions as l, LiteralUnion as m, AccessTokenAPIReturn as n, DisconnectProviderAPIOptions as o, Handlers as p, AuthInstance as r, DisconnectProviderAPIReturn as s, AccessTokenAPIOptions as t, GetProviderTokensAPIReturn as u, RefreshUserInfoAPIReturn as v, SignInAPIReturn as w, RevokeTokenAPIReturn as x, RemoveIndexSignature as y };