@meistrari/auth-core 1.21.0 → 1.23.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.
package/dist/index.d.mts CHANGED
@@ -6,7 +6,6 @@ import z, { z as z$1 } from 'zod';
6
6
  import * as better_auth_client from 'better-auth/client';
7
7
  import { BetterFetchOption } from 'better-auth/client';
8
8
  import * as jose from 'jose';
9
- import * as _better_auth_sso from '@better-auth/sso';
10
9
  import { ApiKey as ApiKey$1 } from '@better-auth/api-key';
11
10
 
12
11
  declare const AMRBrand: unique symbol;
@@ -29,11 +28,11 @@ declare const ACRs: {
29
28
  readonly Unspecified: "urn:tela:auth:unspecified" & z.core.$brand<typeof ACRBrand>;
30
29
  };
31
30
  declare const AuthMethods: {
32
- readonly Password: ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
33
- readonly EmailOTP: ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
34
- readonly OAuth: ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
35
- readonly SAML: ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
36
- readonly Unknown: ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
31
+ readonly Password: ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
32
+ readonly EmailOTP: ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
33
+ readonly OAuth: ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
34
+ readonly SAML: ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
35
+ readonly Unknown: ("saml" & z.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z.core.$brand<typeof AuthMethodBrand>) | ("password" & z.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z.core.$brand<typeof AuthMethodBrand>);
37
36
  };
38
37
  declare const AMR: z.core.$ZodBranded<z.ZodEnum<{
39
38
  readonly Pwd: "pwd";
@@ -531,2697 +530,527 @@ declare class SessionAssuranceService {
531
530
  completeOAuthStepUp(stepUpToken: string): Promise<OAuthCompleteStepUpResponse>;
532
531
  }
533
532
 
534
- declare const ApiKeyMetadata: z.ZodObject<{
535
- user: z.ZodObject<{
536
- id: z.ZodString;
537
- email: z.ZodString;
538
- }, z.core.$strip>;
539
- workspace: z.ZodObject<{
540
- id: z.ZodString;
541
- title: z.ZodString;
542
- }, z.core.$strip>;
543
- application: z.ZodNullable<z.ZodOptional<z.ZodObject<{
544
- id: z.ZodString;
545
- name: z.ZodString;
546
- }, z.core.$strip>>>;
547
- }, z.core.$strip>;
533
+ declare const DEFAULT_SESSION_ASSURANCE_CONFIG: ApplicationSessionAssuranceConfig;
534
+ declare const DEFAULT_APPLICATION_CONFIG: {
535
+ version: 1;
536
+ sessionAssurance: ApplicationSessionAssuranceConfig;
537
+ };
538
+ type ApplicationSessionAssuranceConfig = {
539
+ acceptedAmr: AMR[];
540
+ minAal: AAL;
541
+ };
542
+ declare const ApplicationSessionAssuranceConfig: z.ZodType<ApplicationSessionAssuranceConfig>;
543
+ type ApplicationConfig = {
544
+ version: 1;
545
+ sessionAssurance: ApplicationSessionAssuranceConfig;
546
+ };
547
+ declare const ApplicationConfig: z.ZodType<ApplicationConfig>;
548
548
  /**
549
- * Metadata attached to an API key, identifying the owning user and workspace.
549
+ * Keys of the organization's related collections that can be optionally
550
+ * included in the "who am I" response.
550
551
  */
551
- type ApiKeyMetadata = z.infer<typeof ApiKeyMetadata> & Record<string, unknown>;
552
+ type WhoAmIInclude = 'members' | 'teams' | 'invitations';
552
553
  /**
553
- * A full API key including the secret key value.
554
- *
555
- * The secret `key` field is only returned once at creation time.
554
+ * Represents a registered OAuth application.
556
555
  */
557
- type ApiKey = Omit<ApiKey$1, 'metadata' | 'name'> & {
558
- /** Display name of the API key. */
556
+ type Application = {
557
+ /** Unique application identifier. */
558
+ id: string;
559
+ /** Display name of the application. */
559
560
  name: string;
560
- /** Metadata identifying the key's owner and workspace. */
561
- metadata: ApiKeyMetadata;
561
+ /** Human-readable description of the application. */
562
+ description: string;
563
+ /** Allowed OAuth redirect URIs for this application. */
564
+ redirectUris: string[];
565
+ /** Additional configuration for this application. */
566
+ config?: ApplicationConfig;
562
567
  };
563
568
  /**
564
- * An API key with the secret key value omitted.
569
+ * Response returned when listing candidate organizations for an application.
570
+ */
571
+ type ListCandidateOrganizationsResponse = FullOrganization[];
572
+ /**
573
+ * Public application context used to preserve continuity during auth redirects.
574
+ */
575
+ type ApplicationAuthContextResponse = {
576
+ /** Minimal application identity shown in the hosted auth flow. */
577
+ application: Pick<Application, 'id' | 'name' | 'config'>;
578
+ };
579
+ /**
580
+ * Response returned when starting an authorization flow.
581
+ */
582
+ type StartAuthorizationFlowResponse = {
583
+ /** The authorization code to exchange for tokens. */
584
+ code: string;
585
+ };
586
+ /**
587
+ * Response returned when completing an authorization flow or refreshing tokens.
588
+ */
589
+ type CompleteAuthorizationFlowResponse = {
590
+ /** Short-lived JWT access token. */
591
+ accessToken: string;
592
+ /** Long-lived refresh token for obtaining new access tokens. */
593
+ refreshToken: string;
594
+ /** The authenticated user. */
595
+ user: User;
596
+ /** The organization the tokens are scoped to. */
597
+ organization: FullOrganization;
598
+ /** Assurance context embedded in the issued access token. */
599
+ assurance: JWTPayload['assurance'];
600
+ };
601
+ /**
602
+ * Response returned by the "who am I" endpoint.
565
603
  *
566
- * Used in list and get operations where the secret should not be exposed.
604
+ * By default, the `organization` only contains the base organization fields.
605
+ * The `members`, `teams`, and `invitations` collections are only populated
606
+ * when explicitly requested via the `include` query parameter.
567
607
  */
568
- type ApiKeyWithoutSecret = Omit<ApiKey, 'key'>;
608
+ type WhoAmIResponse = {
609
+ /** The authenticated user. */
610
+ user: User;
611
+ /** The user's active organization. */
612
+ organization: WhoAmIOrganization;
613
+ /** Assurance context embedded in the verified access token. */
614
+ assurance: JWTPayload['assurance'];
615
+ };
569
616
  /**
570
- * Payload for creating a new API key.
617
+ * Options accepted by the "who am I" client method.
571
618
  */
572
- type CreateApiKeyPayload = {
573
- /** Display name for the API key. */
574
- name: string;
575
- /** Time in milliseconds until the key expires. Omit for a non-expiring key. */
576
- expiresIn?: number;
577
- /** Optional prefix prepended to the generated key for identification. */
578
- prefix?: string;
579
- /** Optional metadata to attach to the key. */
580
- metadata?: ApiKeyMetadata;
619
+ type WhoAmIOptions = {
620
+ /**
621
+ * Collections to include in the returned organization. When omitted or
622
+ * empty, only the base organization fields are returned.
623
+ */
624
+ include?: WhoAmIInclude[];
581
625
  };
582
626
  /**
583
- * Payload for updating an existing API key.
627
+ * Response returned when starting a device authorization flow (RFC 8628).
584
628
  */
585
- type UpdateApiKeyPayload = {
586
- /** The ID of the API key to update. */
629
+ type DeviceAuthorizationResponse = {
630
+ /** The device verification code for polling. */
631
+ device_code: string;
632
+ /** The user-facing code to enter on the verification page. */
633
+ user_code: string;
634
+ /** The URI the user should visit to authorize the device. */
635
+ verification_uri: string;
636
+ /** A complete URI including the user code for convenience. */
637
+ verification_uri_complete: string;
638
+ /** Number of seconds until the device code expires. */
639
+ expires_in: number;
640
+ /** Minimum polling interval in seconds. */
641
+ interval: number;
642
+ };
643
+ /**
644
+ * Minimal application info shown in device authorization context.
645
+ *
646
+ * @internal
647
+ */
648
+ type DeviceContextApplication = {
649
+ /** Unique application identifier. */
587
650
  id: string;
588
- /** The new display name for the API key. */
651
+ /** Display name of the application. */
589
652
  name: string;
653
+ /** Human-readable description, or `null` if not set. */
654
+ description: string | null;
655
+ };
656
+ /**
657
+ * Context information for a pending device authorization request.
658
+ */
659
+ type DeviceAuthorizationContextResponse = {
660
+ /** The application that initiated the device flow, with verification status. */
661
+ requester: DeviceContextApplication & {
662
+ isVerified: boolean;
663
+ };
664
+ /** The target application the requester wants access to. */
665
+ target: DeviceContextApplication;
666
+ /** Organizations the user can authorize the device for. */
667
+ organizations: FullOrganization[];
668
+ /** Organization pre-selected by the requester, if any. */
669
+ preselectedOrganizationId: string | null;
670
+ /** Current status of the device authorization request. */
671
+ status: 'pending' | 'approved' | 'denied';
672
+ /** Seconds remaining before the device code expires. */
673
+ expiresIn: number;
674
+ };
675
+ /**
676
+ * Response returned when approving or denying a device authorization request.
677
+ */
678
+ type DeviceAuthorizationActionResponse = {
679
+ /** Whether the action was performed successfully. */
680
+ success: boolean;
590
681
  };
591
682
 
592
683
  /**
593
- * Removes index signatures from a type
594
- * @template T - The type to remove index signatures from
595
- * @example
596
- * ```typescript
597
- * type MyType = {
598
- * foo: string
599
- * bar: number
600
- * [key: string]: any
601
- * }
684
+ * Generic error thrown by the `ApplicationService`.
602
685
  *
603
- * type StrictMyType = Strict<MyType> // { foo: string; bar: number; }
604
- * ```
686
+ * All application-specific errors extend this class, so you can catch
687
+ * `ApplicationError` to handle any application-related failure.
605
688
  */
606
- type Strict<T> = {
607
- [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
608
- };
689
+ declare class ApplicationError extends BaseError {
690
+ constructor(message: string, options?: ErrorOptions);
691
+ }
609
692
  /**
610
- * Creates a configured Better Auth API client with all required plugins.
693
+ * Thrown when a refresh token has expired or been revoked.
611
694
  *
612
- * @param apiUrl - The base URL of the authentication API
613
- * @param fetchOptions - Custom fetch options to include in all API requests
614
- * @returns A fully-configured Better Auth client instance
695
+ * The client should discard its stored tokens and prompt the user
696
+ * to re-authenticate.
697
+ */
698
+ declare class RefreshTokenExpiredError extends ApplicationError {
699
+ constructor(options?: ErrorOptions);
700
+ }
701
+ /**
702
+ * Thrown when an authorization flow fails unexpectedly.
703
+ */
704
+ declare class AuthorizationFlowError extends ApplicationError {
705
+ constructor(message: string, options?: ErrorOptions);
706
+ }
707
+ /**
708
+ * Thrown when the authenticated session no longer satisfies the target
709
+ * application's assurance policy.
615
710
  *
616
- * @internal
711
+ * During device-code token exchange this is a final error: the consumed flow
712
+ * cannot be retried and the client must start a new device authorization flow.
617
713
  */
618
- declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOption): {
619
- useActiveOrganization: better_auth_client.AuthQueryAtom<better_auth.Prettify<{
620
- id: string;
621
- name: string;
622
- slug: string;
623
- createdAt: Date;
624
- logo?: string | null | undefined | undefined;
625
- metadata?: any;
626
- } & {
627
- members: {
628
- id: string;
629
- organizationId: string;
630
- role: "org:admin" | "org:member" | "org:reviewer";
631
- createdAt: Date;
632
- userId: string;
633
- teamId?: string | undefined | undefined;
634
- user: {
635
- id: string;
636
- email: string;
637
- name: string;
638
- image?: string | undefined;
639
- };
640
- }[];
641
- invitations: {
642
- id: string;
643
- organizationId: string;
644
- email: string;
645
- role: "org:admin" | "org:member" | "org:reviewer";
646
- status: better_auth_plugins.InvitationStatus;
647
- inviterId: string;
648
- expiresAt: Date;
649
- createdAt: Date;
650
- teamId?: string | undefined | undefined;
651
- }[];
652
- }>>;
653
- useListOrganizations: better_auth_client.AuthQueryAtom<{
654
- id: string;
655
- name: string;
656
- slug: string;
657
- createdAt: Date;
658
- logo?: string | null | undefined | undefined;
659
- metadata?: any;
660
- }[]>;
661
- useActiveMember: better_auth_client.AuthQueryAtom<{
662
- id: string;
663
- organizationId: string;
664
- userId: string;
665
- role: string;
666
- createdAt: Date;
667
- }>;
668
- useActiveMemberRole: better_auth_client.AuthQueryAtom<{
669
- role: string;
670
- }>;
671
- } & {
672
- customEndpoints: {
673
- teams: {
674
- ":id": {
675
- members: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, {
676
- id: string;
677
- }>>(data_0?: better_auth.Prettify<{
678
- query?: Record<string, any> | undefined;
679
- fetchOptions?: FetchOptions | undefined;
680
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
681
- teamMembers: {
682
- id: string;
683
- teamId: string;
684
- userId: string;
685
- createdAt: Date;
686
- }[];
687
- }, {
688
- code?: string | undefined;
689
- message?: string | undefined;
690
- }, FetchOptions["throw"] extends true ? true : true>>;
691
- };
692
- };
693
- };
694
- } & {
695
- customEndpoints: {
696
- organizations: {
697
- apiKeys: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
698
- query?: Record<string, any> | undefined;
699
- fetchOptions?: FetchOptions | undefined;
700
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
701
- id: string;
702
- name: string;
703
- start: string | null;
704
- prefix: string | null;
705
- referenceId: string;
706
- configId: string;
707
- refillInterval: number | null;
708
- refillAmount: number | null;
709
- lastRefillAt: Date | null;
710
- enabled: boolean;
711
- rateLimitEnabled: boolean;
712
- rateLimitTimeWindow: number | null;
713
- rateLimitMax: number | null;
714
- requestCount: number;
715
- remaining: number | null;
716
- lastRequest: Date | null;
717
- expiresAt: Date | null;
718
- createdAt: Date;
719
- updatedAt: Date;
720
- permissions: string | null;
721
- metadata: any;
722
- }[], {
723
- code?: string | undefined;
724
- message?: string | undefined;
725
- }, FetchOptions["throw"] extends true ? true : true>>;
726
- };
727
- };
728
- } & {
729
- handshake: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
730
- origin: string;
731
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
732
- query: {
733
- origin: string;
734
- };
735
- fetchOptions?: FetchOptions | undefined;
736
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
737
- status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
738
- body: ({
739
- message?: string;
740
- code?: string;
741
- cause?: unknown;
742
- } & Record<string, any>) | undefined;
743
- headers: HeadersInit;
744
- statusCode: number;
745
- name: string;
746
- message: string;
747
- stack?: string;
748
- cause?: unknown;
749
- }, {
750
- code?: string | undefined;
751
- message?: string | undefined;
752
- }, FetchOptions["throw"] extends true ? true : true>>;
753
- } & {
754
- handshake: {
755
- noncePayload: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
756
- nonce: string;
757
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
758
- query: {
759
- nonce: string;
760
- };
761
- fetchOptions?: FetchOptions | undefined;
762
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
763
- token: string;
764
- }, {
765
- code?: string | undefined;
766
- message?: string | undefined;
767
- }, FetchOptions["throw"] extends true ? true : true>>;
768
- };
769
- } & {
770
- organization: {
771
- create: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
772
- name: string;
773
- slug: string;
774
- userId?: string | undefined;
775
- logo?: string | undefined;
776
- metadata?: Record<string, any> | undefined;
777
- keepCurrentActiveOrganization?: boolean | undefined;
778
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
779
- name: string;
780
- slug: string;
781
- userId?: string | undefined;
782
- logo?: string | undefined;
783
- metadata?: Record<string, any> | undefined;
784
- keepCurrentActiveOrganization?: boolean | undefined;
785
- } & {
786
- fetchOptions?: FetchOptions | undefined;
787
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<NonNullable<{
788
- id: string;
789
- name: string;
790
- slug: string;
791
- createdAt: Date;
792
- logo?: string | null | undefined | undefined;
793
- metadata?: any;
794
- } & {
795
- metadata: any;
796
- members: ({
797
- id: string;
798
- organizationId: string;
799
- userId: string;
800
- role: string;
801
- createdAt: Date;
802
- } | undefined)[];
803
- }>, {
804
- code?: string | undefined;
805
- message?: string | undefined;
806
- }, FetchOptions["throw"] extends true ? true : true>>;
807
- };
808
- } & {
809
- organization: {
810
- update: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
811
- data: {
812
- name?: string | undefined;
813
- slug?: string | undefined;
814
- logo?: string | undefined;
815
- metadata?: Record<string, any> | undefined;
816
- } & Partial<{}>;
817
- organizationId?: string | undefined;
818
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
819
- data: {
820
- name?: string | undefined;
821
- slug?: string | undefined;
822
- logo?: string | undefined;
823
- metadata?: Record<string, any> | undefined;
824
- } & Partial<{}>;
825
- organizationId?: string | undefined;
826
- } & {
827
- fetchOptions?: FetchOptions | undefined;
828
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
829
- id: string;
830
- name: string;
831
- slug: string;
832
- createdAt: Date;
833
- logo?: string | null | undefined | undefined;
834
- metadata?: any;
835
- }, {
836
- code?: string | undefined;
837
- message?: string | undefined;
838
- }, FetchOptions["throw"] extends true ? true : true>>;
839
- };
840
- } & {
841
- organization: {
842
- delete: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
843
- organizationId: string;
844
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
845
- organizationId: string;
846
- } & {
847
- fetchOptions?: FetchOptions | undefined;
848
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
849
- id: string;
850
- name: string;
851
- slug: string;
852
- createdAt: Date;
853
- logo?: string | null | undefined | undefined;
854
- metadata?: any;
855
- }, {
856
- code?: string | undefined;
857
- message?: string | undefined;
858
- }, FetchOptions["throw"] extends true ? true : true>>;
859
- };
860
- } & {
861
- organization: {
862
- setActive: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
863
- organizationId?: string | null | undefined;
864
- organizationSlug?: string | undefined;
865
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
866
- organizationId?: string | null | undefined;
867
- organizationSlug?: string | undefined;
868
- } & {
869
- fetchOptions?: FetchOptions | undefined;
870
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
871
- members: {
872
- id: string;
873
- organizationId: string;
874
- role: "org:admin" | "org:member" | "org:reviewer";
875
- createdAt: Date;
876
- userId: string;
877
- teamId?: string | undefined | undefined;
878
- user: {
879
- id: string;
880
- email: string;
881
- name: string;
882
- image?: string | undefined;
883
- };
884
- }[];
885
- invitations: {
886
- id: string;
887
- organizationId: string;
888
- email: string;
889
- role: "org:admin" | "org:member" | "org:reviewer";
890
- status: better_auth_plugins.InvitationStatus;
891
- inviterId: string;
892
- expiresAt: Date;
893
- createdAt: Date;
894
- teamId?: string | undefined | undefined;
895
- }[];
896
- teams: {
897
- id: string;
898
- name: string;
899
- organizationId: string;
900
- createdAt: Date;
901
- updatedAt?: Date | undefined;
902
- }[];
903
- } & {
904
- id: string;
905
- name: string;
906
- slug: string;
907
- createdAt: Date;
908
- logo?: string | null | undefined | undefined;
909
- metadata?: any;
910
- }, {
911
- code?: string | undefined;
912
- message?: string | undefined;
913
- }, FetchOptions["throw"] extends true ? true : true>>;
914
- };
915
- } & {
916
- organization: {
917
- getFullOrganization: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
918
- organizationId?: string | undefined;
919
- organizationSlug?: string | undefined;
920
- membersLimit?: string | number | undefined;
921
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
922
- query?: {
923
- organizationId?: string | undefined;
924
- organizationSlug?: string | undefined;
925
- membersLimit?: string | number | undefined;
926
- } | undefined;
927
- fetchOptions?: FetchOptions | undefined;
928
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
929
- members: {
930
- id: string;
931
- organizationId: string;
932
- role: "org:admin" | "org:member" | "org:reviewer";
933
- createdAt: Date;
934
- userId: string;
935
- teamId?: string | undefined | undefined;
936
- user: {
937
- id: string;
938
- email: string;
939
- name: string;
940
- image?: string | undefined;
941
- };
942
- }[];
943
- invitations: {
944
- id: string;
945
- organizationId: string;
946
- email: string;
947
- role: "org:admin" | "org:member" | "org:reviewer";
948
- status: better_auth_plugins.InvitationStatus;
949
- inviterId: string;
950
- expiresAt: Date;
951
- createdAt: Date;
952
- teamId?: string | undefined | undefined;
953
- }[];
954
- teams: {
955
- id: string;
956
- name: string;
957
- organizationId: string;
958
- createdAt: Date;
959
- updatedAt?: Date | undefined;
960
- }[];
961
- } & {
962
- id: string;
963
- name: string;
964
- slug: string;
965
- createdAt: Date;
966
- logo?: string | null | undefined | undefined;
967
- metadata?: any;
968
- }, {
969
- code?: string | undefined;
970
- message?: string | undefined;
971
- }, FetchOptions["throw"] extends true ? true : true>>;
972
- };
973
- } & {
974
- organization: {
975
- list: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
976
- query?: Record<string, any> | undefined;
977
- fetchOptions?: FetchOptions | undefined;
978
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
979
- id: string;
980
- name: string;
981
- slug: string;
982
- createdAt: Date;
983
- logo?: string | null | undefined | undefined;
984
- metadata?: any;
985
- }[], {
986
- code?: string | undefined;
987
- message?: string | undefined;
988
- }, FetchOptions["throw"] extends true ? true : true>>;
989
- };
990
- } & {
991
- organization: {
992
- inviteMember: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
993
- email: string;
994
- role: "org:admin" | "org:member" | "org:reviewer" | ("org:admin" | "org:member" | "org:reviewer")[];
995
- organizationId?: string | undefined;
996
- resend?: boolean | undefined;
997
- } & {
998
- teamId?: (string | string[]) | undefined;
999
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1000
- email: string;
1001
- role: "org:admin" | "org:member" | "org:reviewer" | ("org:admin" | "org:member" | "org:reviewer")[];
1002
- organizationId?: string | undefined;
1003
- resend?: boolean | undefined;
1004
- } & {
1005
- teamId?: (string | string[]) | undefined;
1006
- } & {
1007
- fetchOptions?: FetchOptions | undefined;
1008
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<NonNullable<{
1009
- id: string;
1010
- organizationId: string;
1011
- email: string;
1012
- role: "org:admin" | "org:member" | "org:reviewer";
1013
- status: better_auth_plugins.InvitationStatus;
1014
- inviterId: string;
1015
- expiresAt: Date;
1016
- createdAt: Date;
1017
- teamId?: string | undefined | undefined;
1018
- } | {
1019
- id: string;
1020
- organizationId: string;
1021
- email: string;
1022
- role: "org:admin" | "org:member" | "org:reviewer";
1023
- status: better_auth_plugins.InvitationStatus;
1024
- inviterId: string;
1025
- expiresAt: Date;
1026
- createdAt: Date;
1027
- teamId?: string | undefined | undefined;
1028
- }>, {
1029
- code?: string | undefined;
1030
- message?: string | undefined;
1031
- }, FetchOptions["throw"] extends true ? true : true>>;
1032
- };
1033
- } & {
1034
- organization: {
1035
- cancelInvitation: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1036
- invitationId: string;
1037
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1038
- invitationId: string;
1039
- } & {
1040
- fetchOptions?: FetchOptions | undefined;
1041
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1042
- id: string;
1043
- organizationId: string;
1044
- email: string;
1045
- role: "org:admin" | "org:member" | "org:reviewer";
1046
- status: better_auth_plugins.InvitationStatus;
1047
- inviterId: string;
1048
- expiresAt: Date;
1049
- createdAt: Date;
1050
- teamId?: string | undefined | undefined;
1051
- }, {
1052
- code?: string | undefined;
1053
- message?: string | undefined;
1054
- }, FetchOptions["throw"] extends true ? true : true>>;
1055
- };
1056
- } & {
1057
- organization: {
1058
- acceptInvitation: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1059
- invitationId: string;
1060
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1061
- invitationId: string;
1062
- } & {
1063
- fetchOptions?: FetchOptions | undefined;
1064
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1065
- invitation: {
1066
- id: string;
1067
- organizationId: string;
1068
- email: string;
1069
- role: "org:admin" | "org:member" | "org:reviewer";
1070
- status: better_auth_plugins.InvitationStatus;
1071
- inviterId: string;
1072
- expiresAt: Date;
1073
- createdAt: Date;
1074
- teamId?: string | undefined | undefined;
1075
- };
1076
- member: {
1077
- id: string;
1078
- organizationId: string;
1079
- userId: string;
1080
- role: string;
1081
- createdAt: Date;
1082
- };
1083
- }, {
1084
- code?: string | undefined;
1085
- message?: string | undefined;
1086
- }, FetchOptions["throw"] extends true ? true : true>>;
1087
- };
1088
- } & {
1089
- organization: {
1090
- getInvitation: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1091
- id: string;
1092
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1093
- query: {
1094
- id: string;
1095
- };
1096
- fetchOptions?: FetchOptions | undefined;
1097
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<NonNullable<{
1098
- id: string;
1099
- organizationId: string;
1100
- email: string;
1101
- role: "org:admin" | "org:member" | "org:reviewer";
1102
- status: better_auth_plugins.InvitationStatus;
1103
- inviterId: string;
1104
- expiresAt: Date;
1105
- createdAt: Date;
1106
- teamId?: string | undefined | undefined;
1107
- } & {
1108
- organizationName: string;
1109
- organizationSlug: string;
1110
- inviterEmail: string;
1111
- }>, {
1112
- code?: string | undefined;
1113
- message?: string | undefined;
1114
- }, FetchOptions["throw"] extends true ? true : true>>;
1115
- };
1116
- } & {
1117
- organization: {
1118
- rejectInvitation: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1119
- invitationId: string;
1120
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1121
- invitationId: string;
1122
- } & {
1123
- fetchOptions?: FetchOptions | undefined;
1124
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1125
- invitation: {
1126
- id: string;
1127
- organizationId: string;
1128
- email: string;
1129
- role: "admin" | "member" | "owner";
1130
- status: better_auth_plugins.InvitationStatus;
1131
- inviterId: string;
1132
- expiresAt: Date;
1133
- createdAt: Date;
1134
- } | null;
1135
- member: null;
1136
- }, {
1137
- code?: string | undefined;
1138
- message?: string | undefined;
1139
- }, FetchOptions["throw"] extends true ? true : true>>;
1140
- };
1141
- } & {
1142
- organization: {
1143
- listInvitations: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1144
- organizationId?: string | undefined;
1145
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1146
- query?: {
1147
- organizationId?: string | undefined;
1148
- } | undefined;
1149
- fetchOptions?: FetchOptions | undefined;
1150
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1151
- id: string;
1152
- organizationId: string;
1153
- email: string;
1154
- role: "org:admin" | "org:member" | "org:reviewer";
1155
- status: better_auth_plugins.InvitationStatus;
1156
- inviterId: string;
1157
- expiresAt: Date;
1158
- createdAt: Date;
1159
- teamId?: string | undefined | undefined;
1160
- }[], {
1161
- code?: string | undefined;
1162
- message?: string | undefined;
1163
- }, FetchOptions["throw"] extends true ? true : true>>;
1164
- };
1165
- } & {
1166
- organization: {
1167
- getActiveMember: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1168
- query?: Record<string, any> | undefined;
1169
- fetchOptions?: FetchOptions | undefined;
1170
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<NonNullable<Omit<{
1171
- id: string;
1172
- organizationId: string;
1173
- role: "org:admin" | "org:member" | "org:reviewer";
1174
- createdAt: Date;
1175
- userId: string;
1176
- teamId?: string | undefined | undefined;
1177
- user: {
1178
- id: string;
1179
- email: string;
1180
- name: string;
1181
- image?: string | undefined;
1182
- };
1183
- } & {
1184
- user: {
1185
- id: string;
1186
- createdAt: Date;
1187
- updatedAt: Date;
1188
- email: string;
1189
- emailVerified: boolean;
1190
- name: string;
1191
- image?: string | null | undefined;
1192
- };
1193
- }, "user"> & {
1194
- user: {
1195
- id: string;
1196
- name: string;
1197
- email: string;
1198
- image: string | undefined;
1199
- };
1200
- }>, {
1201
- code?: string | undefined;
1202
- message?: string | undefined;
1203
- }, FetchOptions["throw"] extends true ? true : true>>;
1204
- };
1205
- } & {
1206
- organization: {
1207
- checkSlug: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1208
- slug: string;
1209
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1210
- slug: string;
1211
- } & {
1212
- fetchOptions?: FetchOptions | undefined;
1213
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1214
- status: boolean;
1215
- }, {
1216
- code?: string | undefined;
1217
- message?: string | undefined;
1218
- }, FetchOptions["throw"] extends true ? true : true>>;
1219
- };
1220
- } & {
1221
- organization: {
1222
- removeMember: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1223
- memberIdOrEmail: string;
1224
- organizationId?: string | undefined;
1225
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1226
- memberIdOrEmail: string;
1227
- organizationId?: string | undefined;
1228
- } & {
1229
- fetchOptions?: FetchOptions | undefined;
1230
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1231
- member: {
1232
- id: string;
1233
- organizationId: string;
1234
- role: "org:admin" | "org:member" | "org:reviewer";
1235
- createdAt: Date;
1236
- userId: string;
1237
- teamId?: string | undefined | undefined;
1238
- user: {
1239
- id: string;
1240
- email: string;
1241
- name: string;
1242
- image?: string | undefined;
1243
- };
1244
- };
1245
- }, {
1246
- code?: string | undefined;
1247
- message?: string | undefined;
1248
- }, FetchOptions["throw"] extends true ? true : true>>;
1249
- };
1250
- } & {
1251
- organization: {
1252
- updateMemberRole: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1253
- role: better_auth.LiteralString | "org:admin" | "org:member" | "org:reviewer" | better_auth.LiteralString[] | ("org:admin" | "org:member" | "org:reviewer")[];
1254
- memberId: string;
1255
- organizationId?: string | undefined;
1256
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1257
- role: better_auth.LiteralString | "org:admin" | "org:member" | "org:reviewer" | better_auth.LiteralString[] | ("org:admin" | "org:member" | "org:reviewer")[];
1258
- memberId: string;
1259
- organizationId?: string | undefined;
1260
- } & {
1261
- fetchOptions?: FetchOptions | undefined;
1262
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1263
- id: string;
1264
- organizationId: string;
1265
- role: "admin" | "member" | "owner";
1266
- createdAt: Date;
1267
- userId: string;
1268
- user: {
1269
- id: string;
1270
- email: string;
1271
- name: string;
1272
- image?: string | undefined;
1273
- };
1274
- }, {
1275
- code?: string | undefined;
1276
- message?: string | undefined;
1277
- }, FetchOptions["throw"] extends true ? true : true>>;
1278
- };
1279
- } & {
1280
- organization: {
1281
- leave: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1282
- organizationId: string;
1283
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1284
- organizationId: string;
1285
- } & {
1286
- fetchOptions?: FetchOptions | undefined;
1287
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<NonNullable<Omit<{
1288
- id: string;
1289
- organizationId: string;
1290
- role: "org:admin" | "org:member" | "org:reviewer";
1291
- createdAt: Date;
1292
- userId: string;
1293
- teamId?: string | undefined | undefined;
1294
- user: {
1295
- id: string;
1296
- email: string;
1297
- name: string;
1298
- image?: string | undefined;
1299
- };
1300
- } & {
1301
- user: {
1302
- id: string;
1303
- createdAt: Date;
1304
- updatedAt: Date;
1305
- email: string;
1306
- emailVerified: boolean;
1307
- name: string;
1308
- image?: string | null | undefined;
1309
- };
1310
- }, "user"> & {
1311
- user: {
1312
- id: string;
1313
- name: string;
1314
- email: string;
1315
- image: string | undefined;
1316
- };
1317
- }>, {
1318
- code?: string | undefined;
1319
- message?: string | undefined;
1320
- }, FetchOptions["throw"] extends true ? true : true>>;
1321
- };
1322
- } & {
1323
- organization: {
1324
- listUserInvitations: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1325
- email?: string | undefined;
1326
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1327
- query?: {
1328
- email?: string | undefined;
1329
- } | undefined;
1330
- fetchOptions?: FetchOptions | undefined;
1331
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<(Omit<{
1332
- id: string;
1333
- organizationId: string;
1334
- email: string;
1335
- role: "org:admin" | "org:member" | "org:reviewer";
1336
- status: better_auth_plugins.InvitationStatus;
1337
- inviterId: string;
1338
- expiresAt: Date;
1339
- createdAt: Date;
1340
- teamId?: string | undefined | undefined;
1341
- } & {
1342
- organization: {
1343
- id: string;
1344
- name: string;
1345
- slug: string;
1346
- createdAt: Date;
1347
- logo?: string | null | undefined | undefined;
1348
- metadata?: any;
1349
- };
1350
- }, "organization"> & {
1351
- organizationName: string;
1352
- })[], {
1353
- code?: string | undefined;
1354
- message?: string | undefined;
1355
- }, FetchOptions["throw"] extends true ? true : true>>;
1356
- };
1357
- } & {
1358
- organization: {
1359
- listMembers: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1360
- limit?: string | number | undefined;
1361
- offset?: string | number | undefined;
1362
- sortBy?: string | undefined;
1363
- sortDirection?: "asc" | "desc" | undefined;
1364
- filterField?: string | undefined;
1365
- filterValue?: string | number | boolean | string[] | number[] | undefined;
1366
- filterOperator?: "in" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
1367
- organizationId?: string | undefined;
1368
- organizationSlug?: string | undefined;
1369
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1370
- query?: {
1371
- limit?: string | number | undefined;
1372
- offset?: string | number | undefined;
1373
- sortBy?: string | undefined;
1374
- sortDirection?: "asc" | "desc" | undefined;
1375
- filterField?: string | undefined;
1376
- filterValue?: string | number | boolean | string[] | number[] | undefined;
1377
- filterOperator?: "in" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
1378
- organizationId?: string | undefined;
1379
- organizationSlug?: string | undefined;
1380
- } | undefined;
1381
- fetchOptions?: FetchOptions | undefined;
1382
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1383
- members: ({
1384
- id: string;
1385
- organizationId: string;
1386
- role: "org:admin" | "org:member" | "org:reviewer";
1387
- createdAt: Date;
1388
- userId: string;
1389
- teamId?: string | undefined | undefined;
1390
- user: {
1391
- id: string;
1392
- email: string;
1393
- name: string;
1394
- image?: string | undefined;
1395
- };
1396
- } & {
1397
- user: {
1398
- id: string;
1399
- name: string;
1400
- email: string;
1401
- image: string | null | undefined;
1402
- };
1403
- })[];
1404
- total: number;
1405
- }, {
1406
- code?: string | undefined;
1407
- message?: string | undefined;
1408
- }, FetchOptions["throw"] extends true ? true : true>>;
1409
- };
1410
- } & {
1411
- organization: {
1412
- getActiveMemberRole: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1413
- userId?: string | undefined;
1414
- organizationId?: string | undefined;
1415
- organizationSlug?: string | undefined;
1416
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1417
- query?: {
1418
- userId?: string | undefined;
1419
- organizationId?: string | undefined;
1420
- organizationSlug?: string | undefined;
1421
- } | undefined;
1422
- fetchOptions?: FetchOptions | undefined;
1423
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1424
- role: "org:admin" | "org:member" | "org:reviewer";
1425
- }, {
1426
- code?: string | undefined;
1427
- message?: string | undefined;
1428
- }, FetchOptions["throw"] extends true ? true : true>>;
1429
- };
1430
- } & {
1431
- organization: {
1432
- hasPermission: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1433
- permissions: {
1434
- access?: string[] | undefined;
1435
- organization?: ("update" | "delete")[] | undefined;
1436
- member?: ("update" | "delete" | "create")[] | undefined;
1437
- invitation?: ("create" | "cancel")[] | undefined;
1438
- team?: ("update" | "delete" | "create")[] | undefined;
1439
- ac?: ("update" | "delete" | "create" | "read")[] | undefined;
1440
- };
1441
- } & {
1442
- organizationId?: string | undefined;
1443
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1444
- permissions: {
1445
- access?: string[] | undefined;
1446
- organization?: ("update" | "delete")[] | undefined;
1447
- member?: ("update" | "delete" | "create")[] | undefined;
1448
- invitation?: ("create" | "cancel")[] | undefined;
1449
- team?: ("update" | "delete" | "create")[] | undefined;
1450
- ac?: ("update" | "delete" | "create" | "read")[] | undefined;
1451
- };
1452
- } & {
1453
- organizationId?: string | undefined;
1454
- } & {
1455
- fetchOptions?: FetchOptions | undefined;
1456
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1457
- error: null;
1458
- success: boolean;
1459
- }, {
1460
- code?: string | undefined;
1461
- message?: string | undefined;
1462
- }, FetchOptions["throw"] extends true ? true : true>>;
1463
- };
1464
- } & {
1465
- organization: {
1466
- createTeam: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1467
- name: string;
1468
- organizationId?: string | undefined;
1469
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1470
- name: string;
1471
- organizationId?: string | undefined;
1472
- } & {
1473
- fetchOptions?: FetchOptions | undefined;
1474
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1475
- id: string;
1476
- name: string;
1477
- organizationId: string;
1478
- createdAt: Date;
1479
- updatedAt?: Date | undefined;
1480
- }, {
1481
- code?: string | undefined;
1482
- message?: string | undefined;
1483
- }, FetchOptions["throw"] extends true ? true : true>>;
1484
- };
1485
- } & {
1486
- organization: {
1487
- listTeams: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1488
- organizationId?: string | undefined;
1489
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1490
- query?: {
1491
- organizationId?: string | undefined;
1492
- } | undefined;
1493
- fetchOptions?: FetchOptions | undefined;
1494
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1495
- id: string;
1496
- name: string;
1497
- organizationId: string;
1498
- createdAt: Date;
1499
- updatedAt?: Date | undefined;
1500
- }[], {
1501
- code?: string | undefined;
1502
- message?: string | undefined;
1503
- }, FetchOptions["throw"] extends true ? true : true>>;
1504
- };
1505
- } & {
1506
- organization: {
1507
- removeTeam: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1508
- teamId: string;
1509
- organizationId?: string | undefined;
1510
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1511
- teamId: string;
1512
- organizationId?: string | undefined;
1513
- } & {
1514
- fetchOptions?: FetchOptions | undefined;
1515
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1516
- message: string;
1517
- }, {
1518
- code?: string | undefined;
1519
- message?: string | undefined;
1520
- }, FetchOptions["throw"] extends true ? true : true>>;
1521
- };
1522
- } & {
1523
- organization: {
1524
- updateTeam: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1525
- teamId: string;
1526
- data: Partial<{
1527
- name: string;
1528
- organizationId: string;
1529
- }>;
1530
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1531
- teamId: string;
1532
- data: Partial<{
1533
- name: string;
1534
- organizationId: string;
1535
- }>;
1536
- } & {
1537
- fetchOptions?: FetchOptions | undefined;
1538
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1539
- id: string;
1540
- name: string;
1541
- organizationId: string;
1542
- createdAt: Date;
1543
- updatedAt?: Date | undefined;
1544
- }, {
1545
- code?: string | undefined;
1546
- message?: string | undefined;
1547
- }, FetchOptions["throw"] extends true ? true : true>>;
1548
- };
1549
- } & {
1550
- organization: {
1551
- setActiveTeam: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1552
- teamId?: string | null | undefined;
1553
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1554
- teamId?: string | null | undefined;
1555
- } & {
1556
- fetchOptions?: FetchOptions | undefined;
1557
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1558
- id: string;
1559
- name: string;
1560
- organizationId: string;
1561
- createdAt: Date;
1562
- updatedAt?: Date | undefined;
1563
- }, {
1564
- code?: string | undefined;
1565
- message?: string | undefined;
1566
- }, FetchOptions["throw"] extends true ? true : true>>;
1567
- };
1568
- } & {
1569
- organization: {
1570
- listUserTeams: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1571
- query?: Record<string, any> | undefined;
1572
- fetchOptions?: FetchOptions | undefined;
1573
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1574
- id: string;
1575
- name: string;
1576
- organizationId: string;
1577
- createdAt: Date;
1578
- updatedAt?: Date | undefined;
1579
- }[], {
1580
- code?: string | undefined;
1581
- message?: string | undefined;
1582
- }, FetchOptions["throw"] extends true ? true : true>>;
1583
- };
1584
- } & {
1585
- organization: {
1586
- listTeamMembers: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1587
- teamId?: string | undefined;
1588
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1589
- query?: {
1590
- teamId?: string | undefined;
1591
- } | undefined;
1592
- fetchOptions?: FetchOptions | undefined;
1593
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1594
- id: string;
1595
- teamId: string;
1596
- userId: string;
1597
- createdAt: Date;
1598
- }[], {
1599
- code?: string | undefined;
1600
- message?: string | undefined;
1601
- }, FetchOptions["throw"] extends true ? true : true>>;
1602
- };
1603
- } & {
1604
- organization: {
1605
- addTeamMember: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1606
- teamId: string;
1607
- userId: unknown;
1608
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1609
- teamId: string;
1610
- userId: unknown;
1611
- } & {
1612
- fetchOptions?: FetchOptions | undefined;
1613
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1614
- id: string;
1615
- teamId: string;
1616
- userId: string;
1617
- createdAt: Date;
1618
- }, {
1619
- code?: string | undefined;
1620
- message?: string | undefined;
1621
- }, FetchOptions["throw"] extends true ? true : true>>;
1622
- };
1623
- } & {
1624
- organization: {
1625
- removeTeamMember: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1626
- teamId: string;
1627
- userId: unknown;
1628
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1629
- teamId: string;
1630
- userId: unknown;
1631
- } & {
1632
- fetchOptions?: FetchOptions | undefined;
1633
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1634
- message: string;
1635
- }, {
1636
- code?: string | undefined;
1637
- message?: string | undefined;
1638
- }, FetchOptions["throw"] extends true ? true : true>>;
1639
- };
1640
- } & {
1641
- sso: {
1642
- saml2: {
1643
- sp: {
1644
- metadata: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1645
- providerId: string;
1646
- format?: "json" | "xml" | undefined;
1647
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1648
- query: {
1649
- providerId: string;
1650
- format?: "json" | "xml" | undefined;
1651
- };
1652
- fetchOptions?: FetchOptions | undefined;
1653
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<Response, {
1654
- code?: string | undefined;
1655
- message?: string | undefined;
1656
- }, FetchOptions["throw"] extends true ? true : true>>;
1657
- };
1658
- };
1659
- };
1660
- } & {
1661
- sso: {
1662
- register: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1663
- providerId: string;
1664
- issuer: string;
1665
- domain: string;
1666
- oidcConfig?: {
1667
- clientId: string;
1668
- clientSecret: string;
1669
- authorizationEndpoint?: string | undefined;
1670
- tokenEndpoint?: string | undefined;
1671
- userInfoEndpoint?: string | undefined;
1672
- tokenEndpointAuthentication?: "client_secret_post" | "client_secret_basic" | undefined;
1673
- jwksEndpoint?: string | undefined;
1674
- discoveryEndpoint?: string | undefined;
1675
- skipDiscovery?: boolean | undefined;
1676
- scopes?: string[] | undefined;
1677
- pkce?: boolean | undefined;
1678
- mapping?: {
1679
- id: string;
1680
- email: string;
1681
- name: string;
1682
- emailVerified?: string | undefined;
1683
- image?: string | undefined;
1684
- extraFields?: Record<string, any> | undefined;
1685
- } | undefined;
1686
- } | undefined;
1687
- samlConfig?: {
1688
- entryPoint: string;
1689
- cert: string;
1690
- callbackUrl: string;
1691
- spMetadata: {
1692
- metadata?: string | undefined;
1693
- entityID?: string | undefined;
1694
- binding?: string | undefined;
1695
- privateKey?: string | undefined;
1696
- privateKeyPass?: string | undefined;
1697
- isAssertionEncrypted?: boolean | undefined;
1698
- encPrivateKey?: string | undefined;
1699
- encPrivateKeyPass?: string | undefined;
1700
- };
1701
- audience?: string | undefined;
1702
- idpMetadata?: {
1703
- metadata?: string | undefined;
1704
- entityID?: string | undefined;
1705
- cert?: string | undefined;
1706
- privateKey?: string | undefined;
1707
- privateKeyPass?: string | undefined;
1708
- isAssertionEncrypted?: boolean | undefined;
1709
- encPrivateKey?: string | undefined;
1710
- encPrivateKeyPass?: string | undefined;
1711
- singleSignOnService?: {
1712
- Binding: string;
1713
- Location: string;
1714
- }[] | undefined;
1715
- } | undefined;
1716
- wantAssertionsSigned?: boolean | undefined;
1717
- authnRequestsSigned?: boolean | undefined;
1718
- signatureAlgorithm?: string | undefined;
1719
- digestAlgorithm?: string | undefined;
1720
- identifierFormat?: string | undefined;
1721
- privateKey?: string | undefined;
1722
- decryptionPvk?: string | undefined;
1723
- additionalParams?: Record<string, any> | undefined;
1724
- mapping?: {
1725
- id: string;
1726
- email: string;
1727
- name: string;
1728
- emailVerified?: string | undefined;
1729
- firstName?: string | undefined;
1730
- lastName?: string | undefined;
1731
- extraFields?: Record<string, any> | undefined;
1732
- } | undefined;
1733
- } | undefined;
1734
- organizationId?: string | undefined;
1735
- overrideUserInfo?: boolean | undefined;
1736
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1737
- providerId: string;
1738
- issuer: string;
1739
- domain: string;
1740
- oidcConfig?: {
1741
- clientId: string;
1742
- clientSecret: string;
1743
- authorizationEndpoint?: string | undefined;
1744
- tokenEndpoint?: string | undefined;
1745
- userInfoEndpoint?: string | undefined;
1746
- tokenEndpointAuthentication?: "client_secret_post" | "client_secret_basic" | undefined;
1747
- jwksEndpoint?: string | undefined;
1748
- discoveryEndpoint?: string | undefined;
1749
- skipDiscovery?: boolean | undefined;
1750
- scopes?: string[] | undefined;
1751
- pkce?: boolean | undefined;
1752
- mapping?: {
1753
- id: string;
1754
- email: string;
1755
- name: string;
1756
- emailVerified?: string | undefined;
1757
- image?: string | undefined;
1758
- extraFields?: Record<string, any> | undefined;
1759
- } | undefined;
1760
- } | undefined;
1761
- samlConfig?: {
1762
- entryPoint: string;
1763
- cert: string;
1764
- callbackUrl: string;
1765
- spMetadata: {
1766
- metadata?: string | undefined;
1767
- entityID?: string | undefined;
1768
- binding?: string | undefined;
1769
- privateKey?: string | undefined;
1770
- privateKeyPass?: string | undefined;
1771
- isAssertionEncrypted?: boolean | undefined;
1772
- encPrivateKey?: string | undefined;
1773
- encPrivateKeyPass?: string | undefined;
1774
- };
1775
- audience?: string | undefined;
1776
- idpMetadata?: {
1777
- metadata?: string | undefined;
1778
- entityID?: string | undefined;
1779
- cert?: string | undefined;
1780
- privateKey?: string | undefined;
1781
- privateKeyPass?: string | undefined;
1782
- isAssertionEncrypted?: boolean | undefined;
1783
- encPrivateKey?: string | undefined;
1784
- encPrivateKeyPass?: string | undefined;
1785
- singleSignOnService?: {
1786
- Binding: string;
1787
- Location: string;
1788
- }[] | undefined;
1789
- } | undefined;
1790
- wantAssertionsSigned?: boolean | undefined;
1791
- authnRequestsSigned?: boolean | undefined;
1792
- signatureAlgorithm?: string | undefined;
1793
- digestAlgorithm?: string | undefined;
1794
- identifierFormat?: string | undefined;
1795
- privateKey?: string | undefined;
1796
- decryptionPvk?: string | undefined;
1797
- additionalParams?: Record<string, any> | undefined;
1798
- mapping?: {
1799
- id: string;
1800
- email: string;
1801
- name: string;
1802
- emailVerified?: string | undefined;
1803
- firstName?: string | undefined;
1804
- lastName?: string | undefined;
1805
- extraFields?: Record<string, any> | undefined;
1806
- } | undefined;
1807
- } | undefined;
1808
- organizationId?: string | undefined;
1809
- overrideUserInfo?: boolean | undefined;
1810
- } & {
1811
- fetchOptions?: FetchOptions | undefined;
1812
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<NonNullable<{
1813
- redirectURI: string;
1814
- oidcConfig: _better_auth_sso.OIDCConfig | null;
1815
- samlConfig: _better_auth_sso.SAMLConfig | null;
1816
- } & Omit<{
1817
- issuer: string;
1818
- oidcConfig?: _better_auth_sso.OIDCConfig | undefined;
1819
- samlConfig?: _better_auth_sso.SAMLConfig | undefined;
1820
- userId: string;
1821
- providerId: string;
1822
- organizationId?: string | undefined;
1823
- domain: string;
1824
- }, "oidcConfig" | "samlConfig">>, {
1825
- code?: string | undefined;
1826
- message?: string | undefined;
1827
- }, FetchOptions["throw"] extends true ? true : true>>;
1828
- };
1829
- } & {
1830
- signIn: {
1831
- sso: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1832
- callbackURL: string;
1833
- email?: string | undefined;
1834
- organizationSlug?: string | undefined;
1835
- providerId?: string | undefined;
1836
- domain?: string | undefined;
1837
- errorCallbackURL?: string | undefined;
1838
- newUserCallbackURL?: string | undefined;
1839
- scopes?: string[] | undefined;
1840
- loginHint?: string | undefined;
1841
- requestSignUp?: boolean | undefined;
1842
- providerType?: "saml" | "oidc" | undefined;
1843
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1844
- callbackURL: string;
1845
- email?: string | undefined;
1846
- organizationSlug?: string | undefined;
1847
- providerId?: string | undefined;
1848
- domain?: string | undefined;
1849
- errorCallbackURL?: string | undefined;
1850
- newUserCallbackURL?: string | undefined;
1851
- scopes?: string[] | undefined;
1852
- loginHint?: string | undefined;
1853
- requestSignUp?: boolean | undefined;
1854
- providerType?: "saml" | "oidc" | undefined;
1855
- } & {
1856
- fetchOptions?: FetchOptions | undefined;
1857
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1858
- url: string;
1859
- redirect: boolean;
1860
- }, {
1861
- code?: string | undefined;
1862
- message?: string | undefined;
1863
- }, FetchOptions["throw"] extends true ? true : true>>;
1864
- };
1865
- } & {
1866
- sso: {
1867
- providers: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
1868
- query?: Record<string, any> | undefined;
1869
- fetchOptions?: FetchOptions | undefined;
1870
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1871
- providers: {
1872
- providerId: string;
1873
- type: string;
1874
- issuer: string;
1875
- domain: string;
1876
- organizationId: string | null;
1877
- domainVerified: boolean;
1878
- oidcConfig: {
1879
- discoveryEndpoint: string;
1880
- clientIdLastFour: string;
1881
- pkce: boolean;
1882
- authorizationEndpoint: string | undefined;
1883
- tokenEndpoint: string | undefined;
1884
- userInfoEndpoint: string | undefined;
1885
- jwksEndpoint: string | undefined;
1886
- scopes: string[] | undefined;
1887
- tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
1888
- } | undefined;
1889
- samlConfig: {
1890
- entryPoint: string;
1891
- callbackUrl: string;
1892
- audience: string | undefined;
1893
- wantAssertionsSigned: boolean | undefined;
1894
- authnRequestsSigned: boolean | undefined;
1895
- identifierFormat: string | undefined;
1896
- signatureAlgorithm: string | undefined;
1897
- digestAlgorithm: string | undefined;
1898
- certificate: {
1899
- fingerprintSha256: string;
1900
- notBefore: string;
1901
- notAfter: string;
1902
- publicKeyAlgorithm: string;
1903
- } | {
1904
- error: string;
1905
- };
1906
- } | undefined;
1907
- spMetadataUrl: string;
1908
- }[];
1909
- }, {
1910
- code?: string | undefined;
1911
- message?: string | undefined;
1912
- }, FetchOptions["throw"] extends true ? true : true>>;
1913
- };
1914
- } & {
1915
- sso: {
1916
- getProvider: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
1917
- providerId: string;
1918
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1919
- query: {
1920
- providerId: string;
1921
- };
1922
- fetchOptions?: FetchOptions | undefined;
1923
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
1924
- providerId: string;
1925
- type: string;
1926
- issuer: string;
1927
- domain: string;
1928
- organizationId: string | null;
1929
- domainVerified: boolean;
1930
- oidcConfig: {
1931
- discoveryEndpoint: string;
1932
- clientIdLastFour: string;
1933
- pkce: boolean;
1934
- authorizationEndpoint: string | undefined;
1935
- tokenEndpoint: string | undefined;
1936
- userInfoEndpoint: string | undefined;
1937
- jwksEndpoint: string | undefined;
1938
- scopes: string[] | undefined;
1939
- tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
1940
- } | undefined;
1941
- samlConfig: {
1942
- entryPoint: string;
1943
- callbackUrl: string;
1944
- audience: string | undefined;
1945
- wantAssertionsSigned: boolean | undefined;
1946
- authnRequestsSigned: boolean | undefined;
1947
- identifierFormat: string | undefined;
1948
- signatureAlgorithm: string | undefined;
1949
- digestAlgorithm: string | undefined;
1950
- certificate: {
1951
- fingerprintSha256: string;
1952
- notBefore: string;
1953
- notAfter: string;
1954
- publicKeyAlgorithm: string;
1955
- } | {
1956
- error: string;
1957
- };
1958
- } | undefined;
1959
- spMetadataUrl: string;
1960
- }, {
1961
- code?: string | undefined;
1962
- message?: string | undefined;
1963
- }, FetchOptions["throw"] extends true ? true : true>>;
1964
- };
1965
- } & {
1966
- sso: {
1967
- updateProvider: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
1968
- providerId: string;
1969
- issuer?: string | undefined;
1970
- domain?: string | undefined;
1971
- oidcConfig?: {
1972
- clientId?: string | undefined;
1973
- clientSecret?: string | undefined;
1974
- authorizationEndpoint?: string | undefined;
1975
- tokenEndpoint?: string | undefined;
1976
- userInfoEndpoint?: string | undefined;
1977
- tokenEndpointAuthentication?: "client_secret_post" | "client_secret_basic" | undefined;
1978
- jwksEndpoint?: string | undefined;
1979
- discoveryEndpoint?: string | undefined;
1980
- scopes?: string[] | undefined;
1981
- pkce?: boolean | undefined;
1982
- overrideUserInfo?: boolean | undefined;
1983
- mapping?: {
1984
- id?: string | undefined;
1985
- email?: string | undefined;
1986
- emailVerified?: string | undefined;
1987
- name?: string | undefined;
1988
- image?: string | undefined;
1989
- extraFields?: Record<string, any> | undefined;
1990
- } | undefined;
1991
- } | undefined;
1992
- samlConfig?: {
1993
- entryPoint?: string | undefined;
1994
- cert?: string | undefined;
1995
- callbackUrl?: string | undefined;
1996
- audience?: string | undefined;
1997
- idpMetadata?: {
1998
- metadata?: string | undefined;
1999
- entityID?: string | undefined;
2000
- cert?: string | undefined;
2001
- privateKey?: string | undefined;
2002
- privateKeyPass?: string | undefined;
2003
- isAssertionEncrypted?: boolean | undefined;
2004
- encPrivateKey?: string | undefined;
2005
- encPrivateKeyPass?: string | undefined;
2006
- singleSignOnService?: {
2007
- Binding: string;
2008
- Location: string;
2009
- }[] | undefined;
2010
- } | undefined;
2011
- spMetadata?: {
2012
- metadata?: string | undefined;
2013
- entityID?: string | undefined;
2014
- binding?: string | undefined;
2015
- privateKey?: string | undefined;
2016
- privateKeyPass?: string | undefined;
2017
- isAssertionEncrypted?: boolean | undefined;
2018
- encPrivateKey?: string | undefined;
2019
- encPrivateKeyPass?: string | undefined;
2020
- } | undefined;
2021
- wantAssertionsSigned?: boolean | undefined;
2022
- authnRequestsSigned?: boolean | undefined;
2023
- signatureAlgorithm?: string | undefined;
2024
- digestAlgorithm?: string | undefined;
2025
- identifierFormat?: string | undefined;
2026
- privateKey?: string | undefined;
2027
- decryptionPvk?: string | undefined;
2028
- additionalParams?: Record<string, any> | undefined;
2029
- mapping?: {
2030
- id?: string | undefined;
2031
- email?: string | undefined;
2032
- emailVerified?: string | undefined;
2033
- name?: string | undefined;
2034
- firstName?: string | undefined;
2035
- lastName?: string | undefined;
2036
- extraFields?: Record<string, any> | undefined;
2037
- } | undefined;
2038
- } | undefined;
2039
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2040
- providerId: string;
2041
- issuer?: string | undefined;
2042
- domain?: string | undefined;
2043
- oidcConfig?: {
2044
- clientId?: string | undefined;
2045
- clientSecret?: string | undefined;
2046
- authorizationEndpoint?: string | undefined;
2047
- tokenEndpoint?: string | undefined;
2048
- userInfoEndpoint?: string | undefined;
2049
- tokenEndpointAuthentication?: "client_secret_post" | "client_secret_basic" | undefined;
2050
- jwksEndpoint?: string | undefined;
2051
- discoveryEndpoint?: string | undefined;
2052
- scopes?: string[] | undefined;
2053
- pkce?: boolean | undefined;
2054
- overrideUserInfo?: boolean | undefined;
2055
- mapping?: {
2056
- id?: string | undefined;
2057
- email?: string | undefined;
2058
- emailVerified?: string | undefined;
2059
- name?: string | undefined;
2060
- image?: string | undefined;
2061
- extraFields?: Record<string, any> | undefined;
2062
- } | undefined;
2063
- } | undefined;
2064
- samlConfig?: {
2065
- entryPoint?: string | undefined;
2066
- cert?: string | undefined;
2067
- callbackUrl?: string | undefined;
2068
- audience?: string | undefined;
2069
- idpMetadata?: {
2070
- metadata?: string | undefined;
2071
- entityID?: string | undefined;
2072
- cert?: string | undefined;
2073
- privateKey?: string | undefined;
2074
- privateKeyPass?: string | undefined;
2075
- isAssertionEncrypted?: boolean | undefined;
2076
- encPrivateKey?: string | undefined;
2077
- encPrivateKeyPass?: string | undefined;
2078
- singleSignOnService?: {
2079
- Binding: string;
2080
- Location: string;
2081
- }[] | undefined;
2082
- } | undefined;
2083
- spMetadata?: {
2084
- metadata?: string | undefined;
2085
- entityID?: string | undefined;
2086
- binding?: string | undefined;
2087
- privateKey?: string | undefined;
2088
- privateKeyPass?: string | undefined;
2089
- isAssertionEncrypted?: boolean | undefined;
2090
- encPrivateKey?: string | undefined;
2091
- encPrivateKeyPass?: string | undefined;
2092
- } | undefined;
2093
- wantAssertionsSigned?: boolean | undefined;
2094
- authnRequestsSigned?: boolean | undefined;
2095
- signatureAlgorithm?: string | undefined;
2096
- digestAlgorithm?: string | undefined;
2097
- identifierFormat?: string | undefined;
2098
- privateKey?: string | undefined;
2099
- decryptionPvk?: string | undefined;
2100
- additionalParams?: Record<string, any> | undefined;
2101
- mapping?: {
2102
- id?: string | undefined;
2103
- email?: string | undefined;
2104
- emailVerified?: string | undefined;
2105
- name?: string | undefined;
2106
- firstName?: string | undefined;
2107
- lastName?: string | undefined;
2108
- extraFields?: Record<string, any> | undefined;
2109
- } | undefined;
2110
- } | undefined;
2111
- } & {
2112
- fetchOptions?: FetchOptions | undefined;
2113
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2114
- providerId: string;
2115
- type: string;
2116
- issuer: string;
2117
- domain: string;
2118
- organizationId: string | null;
2119
- domainVerified: boolean;
2120
- oidcConfig: {
2121
- discoveryEndpoint: string;
2122
- clientIdLastFour: string;
2123
- pkce: boolean;
2124
- authorizationEndpoint: string | undefined;
2125
- tokenEndpoint: string | undefined;
2126
- userInfoEndpoint: string | undefined;
2127
- jwksEndpoint: string | undefined;
2128
- scopes: string[] | undefined;
2129
- tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
2130
- } | undefined;
2131
- samlConfig: {
2132
- entryPoint: string;
2133
- callbackUrl: string;
2134
- audience: string | undefined;
2135
- wantAssertionsSigned: boolean | undefined;
2136
- authnRequestsSigned: boolean | undefined;
2137
- identifierFormat: string | undefined;
2138
- signatureAlgorithm: string | undefined;
2139
- digestAlgorithm: string | undefined;
2140
- certificate: {
2141
- fingerprintSha256: string;
2142
- notBefore: string;
2143
- notAfter: string;
2144
- publicKeyAlgorithm: string;
2145
- } | {
2146
- error: string;
2147
- };
2148
- } | undefined;
2149
- spMetadataUrl: string;
2150
- }, {
2151
- code?: string | undefined;
2152
- message?: string | undefined;
2153
- }, FetchOptions["throw"] extends true ? true : true>>;
2154
- };
2155
- } & {
2156
- sso: {
2157
- deleteProvider: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2158
- providerId: string;
2159
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2160
- providerId: string;
2161
- } & {
2162
- fetchOptions?: FetchOptions | undefined;
2163
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2164
- success: boolean;
2165
- }, {
2166
- code?: string | undefined;
2167
- message?: string | undefined;
2168
- }, FetchOptions["throw"] extends true ? true : true>>;
2169
- };
2170
- } & {
2171
- twoFactor: {
2172
- enable: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2173
- password: string;
2174
- issuer?: string | undefined;
2175
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2176
- password: string;
2177
- issuer?: string | undefined;
2178
- } & {
2179
- fetchOptions?: FetchOptions | undefined;
2180
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2181
- totpURI: string;
2182
- backupCodes: string[];
2183
- }, {
2184
- code?: string | undefined;
2185
- message?: string | undefined;
2186
- }, FetchOptions["throw"] extends true ? true : true>>;
2187
- };
2188
- } & {
2189
- twoFactor: {
2190
- disable: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2191
- password: string;
2192
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2193
- password: string;
2194
- } & {
2195
- fetchOptions?: FetchOptions | undefined;
2196
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2197
- status: boolean;
2198
- }, {
2199
- code?: string | undefined;
2200
- message?: string | undefined;
2201
- }, FetchOptions["throw"] extends true ? true : true>>;
2202
- };
2203
- } & {
2204
- twoFactor: {
2205
- verifyBackupCode: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2206
- code: string;
2207
- disableSession?: boolean | undefined;
2208
- trustDevice?: boolean | undefined;
2209
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2210
- code: string;
2211
- disableSession?: boolean | undefined;
2212
- trustDevice?: boolean | undefined;
2213
- } & {
2214
- fetchOptions?: FetchOptions | undefined;
2215
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<Omit<{
2216
- token: string | undefined;
2217
- user: (Record<string, any> & {
2218
- id: string;
2219
- createdAt: Date;
2220
- updatedAt: Date;
2221
- email: string;
2222
- emailVerified: boolean;
2223
- name: string;
2224
- image?: string | null | undefined;
2225
- }) | better_auth_plugins.UserWithTwoFactor;
2226
- }, "user"> & {
2227
- user: better_auth.StripEmptyObjects<{
2228
- id: string;
2229
- createdAt: Date;
2230
- updatedAt: Date;
2231
- email: string;
2232
- emailVerified: boolean;
2233
- name: string;
2234
- image?: string | null | undefined;
2235
- } & {
2236
- twoFactorEnabled: boolean | null | undefined;
2237
- } & {} & {
2238
- banned: boolean | null | undefined;
2239
- } & {
2240
- role?: string | null | undefined;
2241
- banReason?: string | null | undefined;
2242
- banExpires?: Date | null | undefined;
2243
- } & {} & {
2244
- lastActiveAt?: Date | null | undefined;
2245
- }>;
2246
- }, {
2247
- code?: string | undefined;
2248
- message?: string | undefined;
2249
- }, FetchOptions["throw"] extends true ? true : true>>;
2250
- };
2251
- } & {
2252
- twoFactor: {
2253
- generateBackupCodes: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2254
- password: string;
2255
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2256
- password: string;
2257
- } & {
2258
- fetchOptions?: FetchOptions | undefined;
2259
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2260
- status: boolean;
2261
- backupCodes: string[];
2262
- }, {
2263
- code?: string | undefined;
2264
- message?: string | undefined;
2265
- }, FetchOptions["throw"] extends true ? true : true>>;
2266
- };
2267
- } & {
2268
- twoFactor: {
2269
- sendOtp: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2270
- trustDevice?: boolean | undefined;
2271
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
2272
- query?: Record<string, any> | undefined;
2273
- fetchOptions?: FetchOptions | undefined;
2274
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2275
- status: boolean;
2276
- }, {
2277
- code?: string | undefined;
2278
- message?: string | undefined;
2279
- }, FetchOptions["throw"] extends true ? true : true>>;
2280
- };
2281
- } & {
2282
- twoFactor: {
2283
- verifyOtp: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2284
- code: string;
2285
- trustDevice?: boolean | undefined;
2286
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2287
- code: string;
2288
- trustDevice?: boolean | undefined;
2289
- } & {
2290
- fetchOptions?: FetchOptions | undefined;
2291
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<(Omit<{
2292
- token: string;
2293
- user: better_auth_plugins.UserWithTwoFactor;
2294
- }, "user"> & {
2295
- user: better_auth.StripEmptyObjects<{
2296
- id: string;
2297
- createdAt: Date;
2298
- updatedAt: Date;
2299
- email: string;
2300
- emailVerified: boolean;
2301
- name: string;
2302
- image?: string | null | undefined;
2303
- } & {
2304
- twoFactorEnabled: boolean | null | undefined;
2305
- } & {} & {
2306
- banned: boolean | null | undefined;
2307
- } & {
2308
- role?: string | null | undefined;
2309
- banReason?: string | null | undefined;
2310
- banExpires?: Date | null | undefined;
2311
- } & {} & {
2312
- lastActiveAt?: Date | null | undefined;
2313
- }>;
2314
- }) | (Omit<{
2315
- token: string;
2316
- user: Record<string, any> & {
2317
- id: string;
2318
- createdAt: Date;
2319
- updatedAt: Date;
2320
- email: string;
2321
- emailVerified: boolean;
2322
- name: string;
2323
- image?: string | null | undefined;
2324
- };
2325
- }, "user"> & {
2326
- user: better_auth.StripEmptyObjects<{
2327
- id: string;
2328
- createdAt: Date;
2329
- updatedAt: Date;
2330
- email: string;
2331
- emailVerified: boolean;
2332
- name: string;
2333
- image?: string | null | undefined;
2334
- } & {
2335
- twoFactorEnabled: boolean | null | undefined;
2336
- } & {} & {
2337
- banned: boolean | null | undefined;
2338
- } & {
2339
- role?: string | null | undefined;
2340
- banReason?: string | null | undefined;
2341
- banExpires?: Date | null | undefined;
2342
- } & {} & {
2343
- lastActiveAt?: Date | null | undefined;
2344
- }>;
2345
- }), {
2346
- code?: string | undefined;
2347
- message?: string | undefined;
2348
- }, FetchOptions["throw"] extends true ? true : true>>;
2349
- };
2350
- } & {
2351
- twoFactor: {
2352
- getTotpUri: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2353
- password: string;
2354
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2355
- password: string;
2356
- } & {
2357
- fetchOptions?: FetchOptions | undefined;
2358
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2359
- totpURI: string;
2360
- }, {
2361
- code?: string | undefined;
2362
- message?: string | undefined;
2363
- }, FetchOptions["throw"] extends true ? true : true>>;
2364
- };
2365
- } & {
2366
- twoFactor: {
2367
- verifyTotp: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2368
- code: string;
2369
- trustDevice?: boolean | undefined;
2370
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2371
- code: string;
2372
- trustDevice?: boolean | undefined;
2373
- } & {
2374
- fetchOptions?: FetchOptions | undefined;
2375
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<(Omit<{
2376
- token: string;
2377
- user: better_auth_plugins.UserWithTwoFactor;
2378
- }, "user"> & {
2379
- user: better_auth.StripEmptyObjects<{
2380
- id: string;
2381
- createdAt: Date;
2382
- updatedAt: Date;
2383
- email: string;
2384
- emailVerified: boolean;
2385
- name: string;
2386
- image?: string | null | undefined;
2387
- } & {
2388
- twoFactorEnabled: boolean | null | undefined;
2389
- } & {} & {
2390
- banned: boolean | null | undefined;
2391
- } & {
2392
- role?: string | null | undefined;
2393
- banReason?: string | null | undefined;
2394
- banExpires?: Date | null | undefined;
2395
- } & {} & {
2396
- lastActiveAt?: Date | null | undefined;
2397
- }>;
2398
- }) | (Omit<{
2399
- token: string;
2400
- user: Record<string, any> & {
2401
- id: string;
2402
- createdAt: Date;
2403
- updatedAt: Date;
2404
- email: string;
2405
- emailVerified: boolean;
2406
- name: string;
2407
- image?: string | null | undefined;
2408
- };
2409
- }, "user"> & {
2410
- user: better_auth.StripEmptyObjects<{
2411
- id: string;
2412
- createdAt: Date;
2413
- updatedAt: Date;
2414
- email: string;
2415
- emailVerified: boolean;
2416
- name: string;
2417
- image?: string | null | undefined;
2418
- } & {
2419
- twoFactorEnabled: boolean | null | undefined;
2420
- } & {} & {
2421
- banned: boolean | null | undefined;
2422
- } & {
2423
- role?: string | null | undefined;
2424
- banReason?: string | null | undefined;
2425
- banExpires?: Date | null | undefined;
2426
- } & {} & {
2427
- lastActiveAt?: Date | null | undefined;
2428
- }>;
2429
- }), {
2430
- code?: string | undefined;
2431
- message?: string | undefined;
2432
- }, FetchOptions["throw"] extends true ? true : true>>;
2433
- };
2434
- } & {
2435
- token: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
2436
- query?: Record<string, any> | undefined;
2437
- fetchOptions?: FetchOptions | undefined;
2438
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2439
- token: string;
2440
- }, {
2441
- code?: string | undefined;
2442
- message?: string | undefined;
2443
- }, FetchOptions["throw"] extends true ? true : true>>;
2444
- } & {
2445
- apiKey: {
2446
- create: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2447
- configId?: string | undefined;
2448
- name?: string | undefined;
2449
- expiresIn?: number | null | undefined;
2450
- prefix?: string | undefined;
2451
- remaining?: number | null | undefined;
2452
- metadata?: any;
2453
- refillAmount?: number | undefined;
2454
- refillInterval?: number | undefined;
2455
- rateLimitTimeWindow?: number | undefined;
2456
- rateLimitMax?: number | undefined;
2457
- rateLimitEnabled?: boolean | undefined;
2458
- permissions?: Record<string, string[]> | undefined;
2459
- userId?: unknown;
2460
- organizationId?: unknown;
2461
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
2462
- configId?: string | undefined;
2463
- name?: string | undefined;
2464
- expiresIn?: number | null | undefined;
2465
- prefix?: string | undefined;
2466
- remaining?: number | null | undefined;
2467
- metadata?: any;
2468
- refillAmount?: number | undefined;
2469
- refillInterval?: number | undefined;
2470
- rateLimitTimeWindow?: number | undefined;
2471
- rateLimitMax?: number | undefined;
2472
- rateLimitEnabled?: boolean | undefined;
2473
- permissions?: Record<string, string[]> | undefined;
2474
- userId?: unknown;
2475
- organizationId?: unknown;
2476
- } & {
2477
- fetchOptions?: FetchOptions | undefined;
2478
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2479
- key: string;
2480
- metadata: any;
2481
- permissions: any;
2482
- id: string;
2483
- configId: string;
2484
- name: string | null;
2485
- start: string | null;
2486
- prefix: string | null;
2487
- referenceId: string;
2488
- refillInterval: number | null;
2489
- refillAmount: number | null;
2490
- lastRefillAt: Date | null;
2491
- enabled: boolean;
2492
- rateLimitEnabled: boolean;
2493
- rateLimitTimeWindow: number | null;
2494
- rateLimitMax: number | null;
2495
- requestCount: number;
2496
- remaining: number | null;
2497
- lastRequest: Date | null;
2498
- expiresAt: Date | null;
2499
- createdAt: Date;
2500
- updatedAt: Date;
2501
- }, {
2502
- code?: string | undefined;
2503
- message?: string | undefined;
2504
- }, FetchOptions["throw"] extends true ? true : true>>;
2505
- };
2506
- } & {
2507
- apiKey: {
2508
- get: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
2509
- id: string;
2510
- configId?: string | undefined;
2511
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2512
- query: {
2513
- id: string;
2514
- configId?: string | undefined;
2515
- };
2516
- fetchOptions?: FetchOptions | undefined;
2517
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2518
- metadata: Record<string, any> | null;
2519
- permissions: {
2520
- [key: string]: string[];
2521
- } | null;
2522
- id: string;
2523
- configId: string;
2524
- name: string | null;
2525
- start: string | null;
2526
- prefix: string | null;
2527
- referenceId: string;
2528
- refillInterval: number | null;
2529
- refillAmount: number | null;
2530
- lastRefillAt: Date | null;
2531
- enabled: boolean;
2532
- rateLimitEnabled: boolean;
2533
- rateLimitTimeWindow: number | null;
2534
- rateLimitMax: number | null;
2535
- requestCount: number;
2536
- remaining: number | null;
2537
- lastRequest: Date | null;
2538
- expiresAt: Date | null;
2539
- createdAt: Date;
2540
- updatedAt: Date;
2541
- }, {
2542
- code?: string | undefined;
2543
- message?: string | undefined;
2544
- }, FetchOptions["throw"] extends true ? true : true>>;
2545
- };
2546
- } & {
2547
- apiKey: {
2548
- update: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2549
- keyId: string;
2550
- configId?: string | undefined;
2551
- userId?: unknown;
2552
- name?: string | undefined;
2553
- enabled?: boolean | undefined;
2554
- remaining?: number | undefined;
2555
- refillAmount?: number | undefined;
2556
- refillInterval?: number | undefined;
2557
- metadata?: any;
2558
- expiresIn?: number | null | undefined;
2559
- rateLimitEnabled?: boolean | undefined;
2560
- rateLimitTimeWindow?: number | undefined;
2561
- rateLimitMax?: number | undefined;
2562
- permissions?: Record<string, string[]> | null | undefined;
2563
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2564
- keyId: string;
2565
- configId?: string | undefined;
2566
- userId?: unknown;
2567
- name?: string | undefined;
2568
- enabled?: boolean | undefined;
2569
- remaining?: number | undefined;
2570
- refillAmount?: number | undefined;
2571
- refillInterval?: number | undefined;
2572
- metadata?: any;
2573
- expiresIn?: number | null | undefined;
2574
- rateLimitEnabled?: boolean | undefined;
2575
- rateLimitTimeWindow?: number | undefined;
2576
- rateLimitMax?: number | undefined;
2577
- permissions?: Record<string, string[]> | null | undefined;
2578
- } & {
2579
- fetchOptions?: FetchOptions | undefined;
2580
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2581
- metadata: Record<string, any> | null;
2582
- permissions: {
2583
- [key: string]: string[];
2584
- } | null;
2585
- id: string;
2586
- configId: string;
2587
- name: string | null;
2588
- start: string | null;
2589
- prefix: string | null;
2590
- referenceId: string;
2591
- refillInterval: number | null;
2592
- refillAmount: number | null;
2593
- lastRefillAt: Date | null;
2594
- enabled: boolean;
2595
- rateLimitEnabled: boolean;
2596
- rateLimitTimeWindow: number | null;
2597
- rateLimitMax: number | null;
2598
- requestCount: number;
2599
- remaining: number | null;
2600
- lastRequest: Date | null;
2601
- expiresAt: Date | null;
2602
- createdAt: Date;
2603
- updatedAt: Date;
2604
- }, {
2605
- code?: string | undefined;
2606
- message?: string | undefined;
2607
- }, FetchOptions["throw"] extends true ? true : true>>;
2608
- };
2609
- } & {
2610
- apiKey: {
2611
- delete: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2612
- keyId: string;
2613
- configId?: string | undefined;
2614
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2615
- keyId: string;
2616
- configId?: string | undefined;
2617
- } & {
2618
- fetchOptions?: FetchOptions | undefined;
2619
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2620
- success: boolean;
2621
- }, {
2622
- code?: string | undefined;
2623
- message?: string | undefined;
2624
- }, FetchOptions["throw"] extends true ? true : true>>;
2625
- };
2626
- } & {
2627
- apiKey: {
2628
- list: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
2629
- configId?: string | undefined;
2630
- organizationId?: string | undefined;
2631
- limit?: unknown;
2632
- offset?: unknown;
2633
- sortBy?: string | undefined;
2634
- sortDirection?: "asc" | "desc" | undefined;
2635
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
2636
- query?: {
2637
- configId?: string | undefined;
2638
- organizationId?: string | undefined;
2639
- limit?: unknown;
2640
- offset?: unknown;
2641
- sortBy?: string | undefined;
2642
- sortDirection?: "asc" | "desc" | undefined;
2643
- } | undefined;
2644
- fetchOptions?: FetchOptions | undefined;
2645
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2646
- apiKeys: {
2647
- metadata: Record<string, any> | null;
2648
- permissions: {
2649
- [key: string]: string[];
2650
- } | null;
2651
- id: string;
2652
- configId: string;
2653
- name: string | null;
2654
- start: string | null;
2655
- prefix: string | null;
2656
- referenceId: string;
2657
- refillInterval: number | null;
2658
- refillAmount: number | null;
2659
- lastRefillAt: Date | null;
2660
- enabled: boolean;
2661
- rateLimitEnabled: boolean;
2662
- rateLimitTimeWindow: number | null;
2663
- rateLimitMax: number | null;
2664
- requestCount: number;
2665
- remaining: number | null;
2666
- lastRequest: Date | null;
2667
- expiresAt: Date | null;
2668
- createdAt: Date;
2669
- updatedAt: Date;
2670
- }[];
2671
- total: number;
2672
- limit: number | undefined;
2673
- offset: number | undefined;
2674
- }, {
2675
- code?: string | undefined;
2676
- message?: string | undefined;
2677
- }, FetchOptions["throw"] extends true ? true : true>>;
2678
- };
2679
- } & {
2680
- admin: {
2681
- setRole: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2682
- userId: string;
2683
- role: "admin" | "user" | ("admin" | "user")[];
2684
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2685
- userId: string;
2686
- role: "admin" | "user" | ("admin" | "user")[];
2687
- } & {
2688
- fetchOptions?: FetchOptions | undefined;
2689
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2690
- user: better_auth_plugins.UserWithRole;
2691
- }, {
2692
- code?: string | undefined;
2693
- message?: string | undefined;
2694
- }, FetchOptions["throw"] extends true ? true : true>>;
2695
- };
2696
- } & {
2697
- admin: {
2698
- getUser: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
2699
- id: string;
2700
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2701
- query: {
2702
- id: string;
2703
- };
2704
- fetchOptions?: FetchOptions | undefined;
2705
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<better_auth_plugins.UserWithRole, {
2706
- code?: string | undefined;
2707
- message?: string | undefined;
2708
- }, FetchOptions["throw"] extends true ? true : true>>;
2709
- };
2710
- } & {
2711
- admin: {
2712
- createUser: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2713
- email: string;
2714
- password?: string | undefined;
2715
- name: string;
2716
- role?: "admin" | "user" | ("admin" | "user")[] | undefined;
2717
- data?: Record<string, any> | undefined;
2718
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2719
- email: string;
2720
- password?: string | undefined;
2721
- name: string;
2722
- role?: "admin" | "user" | ("admin" | "user")[] | undefined;
2723
- data?: Record<string, any> | undefined;
2724
- } & {
2725
- fetchOptions?: FetchOptions | undefined;
2726
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2727
- user: better_auth_plugins.UserWithRole;
2728
- }, {
2729
- code?: string | undefined;
2730
- message?: string | undefined;
2731
- }, FetchOptions["throw"] extends true ? true : true>>;
2732
- };
2733
- } & {
2734
- admin: {
2735
- updateUser: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2736
- userId: unknown;
2737
- data: Record<any, any>;
2738
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2739
- userId: unknown;
2740
- data: Record<any, any>;
2741
- } & {
2742
- fetchOptions?: FetchOptions | undefined;
2743
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<better_auth_plugins.UserWithRole, {
2744
- code?: string | undefined;
2745
- message?: string | undefined;
2746
- }, FetchOptions["throw"] extends true ? true : true>>;
2747
- };
2748
- } & {
2749
- admin: {
2750
- listUsers: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<{
2751
- searchValue?: string | undefined;
2752
- searchField?: "name" | "email" | undefined;
2753
- searchOperator?: "contains" | "starts_with" | "ends_with" | undefined;
2754
- limit?: string | number | undefined;
2755
- offset?: string | number | undefined;
2756
- sortBy?: string | undefined;
2757
- sortDirection?: "asc" | "desc" | undefined;
2758
- filterField?: string | undefined;
2759
- filterValue?: string | number | boolean | string[] | number[] | undefined;
2760
- filterOperator?: "in" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
2761
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2762
- query: {
2763
- searchValue?: string | undefined;
2764
- searchField?: "name" | "email" | undefined;
2765
- searchOperator?: "contains" | "starts_with" | "ends_with" | undefined;
2766
- limit?: string | number | undefined;
2767
- offset?: string | number | undefined;
2768
- sortBy?: string | undefined;
2769
- sortDirection?: "asc" | "desc" | undefined;
2770
- filterField?: string | undefined;
2771
- filterValue?: string | number | boolean | string[] | number[] | undefined;
2772
- filterOperator?: "in" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
2773
- };
2774
- fetchOptions?: FetchOptions | undefined;
2775
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2776
- users: better_auth_plugins.UserWithRole[];
2777
- total: number;
2778
- }, {
2779
- code?: string | undefined;
2780
- message?: string | undefined;
2781
- }, FetchOptions["throw"] extends true ? true : true>>;
2782
- };
2783
- } & {
2784
- admin: {
2785
- listUserSessions: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2786
- userId: unknown;
2787
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2788
- userId: unknown;
2789
- } & {
2790
- fetchOptions?: FetchOptions | undefined;
2791
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2792
- sessions: better_auth_plugins.SessionWithImpersonatedBy[];
2793
- }, {
2794
- code?: string | undefined;
2795
- message?: string | undefined;
2796
- }, FetchOptions["throw"] extends true ? true : true>>;
2797
- };
2798
- } & {
2799
- admin: {
2800
- unbanUser: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2801
- userId: unknown;
2802
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2803
- userId: unknown;
2804
- } & {
2805
- fetchOptions?: FetchOptions | undefined;
2806
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2807
- user: better_auth_plugins.UserWithRole;
2808
- }, {
2809
- code?: string | undefined;
2810
- message?: string | undefined;
2811
- }, FetchOptions["throw"] extends true ? true : true>>;
2812
- };
2813
- } & {
2814
- admin: {
2815
- banUser: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2816
- userId: unknown;
2817
- banReason?: string | undefined;
2818
- banExpiresIn?: number | undefined;
2819
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2820
- userId: unknown;
2821
- banReason?: string | undefined;
2822
- banExpiresIn?: number | undefined;
2823
- } & {
2824
- fetchOptions?: FetchOptions | undefined;
2825
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2826
- user: better_auth_plugins.UserWithRole;
2827
- }, {
2828
- code?: string | undefined;
2829
- message?: string | undefined;
2830
- }, FetchOptions["throw"] extends true ? true : true>>;
2831
- };
2832
- } & {
2833
- admin: {
2834
- impersonateUser: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2835
- userId: unknown;
2836
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2837
- userId: unknown;
2838
- } & {
2839
- fetchOptions?: FetchOptions | undefined;
2840
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2841
- session: {
2842
- id: string;
2843
- createdAt: Date;
2844
- updatedAt: Date;
2845
- userId: string;
2846
- expiresAt: Date;
2847
- token: string;
2848
- ipAddress?: string | null | undefined;
2849
- userAgent?: string | null | undefined;
2850
- };
2851
- user: better_auth_plugins.UserWithRole;
2852
- }, {
2853
- code?: string | undefined;
2854
- message?: string | undefined;
2855
- }, FetchOptions["throw"] extends true ? true : true>>;
2856
- };
2857
- } & {
2858
- admin: {
2859
- stopImpersonating: <FetchOptions extends better_auth.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
2860
- query?: Record<string, any> | undefined;
2861
- fetchOptions?: FetchOptions | undefined;
2862
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2863
- session: {
2864
- id: string;
2865
- createdAt: Date;
2866
- updatedAt: Date;
2867
- userId: string;
2868
- expiresAt: Date;
2869
- token: string;
2870
- ipAddress?: string | null | undefined;
2871
- userAgent?: string | null | undefined;
2872
- } & Record<string, any>;
2873
- user: {
2874
- id: string;
2875
- createdAt: Date;
2876
- updatedAt: Date;
2877
- email: string;
2878
- emailVerified: boolean;
2879
- name: string;
2880
- image?: string | null | undefined;
2881
- } & Record<string, any>;
2882
- }, {
2883
- code?: string | undefined;
2884
- message?: string | undefined;
2885
- }, FetchOptions["throw"] extends true ? true : true>>;
2886
- };
2887
- } & {
2888
- admin: {
2889
- revokeUserSession: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2890
- sessionToken: string;
2891
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2892
- sessionToken: string;
2893
- } & {
2894
- fetchOptions?: FetchOptions | undefined;
2895
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2896
- success: boolean;
2897
- }, {
2898
- code?: string | undefined;
2899
- message?: string | undefined;
2900
- }, FetchOptions["throw"] extends true ? true : true>>;
2901
- };
2902
- } & {
2903
- admin: {
2904
- revokeUserSessions: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2905
- userId: unknown;
2906
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2907
- userId: unknown;
2908
- } & {
2909
- fetchOptions?: FetchOptions | undefined;
2910
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2911
- success: boolean;
2912
- }, {
2913
- code?: string | undefined;
2914
- message?: string | undefined;
2915
- }, FetchOptions["throw"] extends true ? true : true>>;
2916
- };
2917
- } & {
2918
- admin: {
2919
- removeUser: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2920
- userId: unknown;
2921
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2922
- userId: unknown;
2923
- } & {
2924
- fetchOptions?: FetchOptions | undefined;
2925
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2926
- success: boolean;
2927
- }, {
2928
- code?: string | undefined;
2929
- message?: string | undefined;
2930
- }, FetchOptions["throw"] extends true ? true : true>>;
2931
- };
2932
- } & {
2933
- admin: {
2934
- setUserPassword: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2935
- newPassword: string;
2936
- userId: unknown;
2937
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2938
- newPassword: string;
2939
- userId: unknown;
2940
- } & {
2941
- fetchOptions?: FetchOptions | undefined;
2942
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2943
- status: boolean;
2944
- }, {
2945
- code?: string | undefined;
2946
- message?: string | undefined;
2947
- }, FetchOptions["throw"] extends true ? true : true>>;
2948
- };
2949
- } & {
2950
- admin: {
2951
- hasPermission: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2952
- permissions: {
2953
- readonly user?: ("update" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "get")[] | undefined;
2954
- readonly session?: ("delete" | "list" | "revoke")[] | undefined;
2955
- };
2956
- } & {
2957
- userId?: string | undefined;
2958
- role?: "admin" | "user" | undefined;
2959
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2960
- permissions: {
2961
- readonly user?: ("update" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "get")[] | undefined;
2962
- readonly session?: ("delete" | "list" | "revoke")[] | undefined;
2963
- };
2964
- } & {
2965
- userId?: string | undefined;
2966
- role?: "admin" | "user" | undefined;
2967
- } & {
2968
- fetchOptions?: FetchOptions | undefined;
2969
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2970
- error: null;
2971
- success: boolean;
2972
- }, {
2973
- code?: string | undefined;
2974
- message?: string | undefined;
2975
- }, FetchOptions["throw"] extends true ? true : true>>;
2976
- };
2977
- } & {
2978
- emailOtp: {
2979
- sendVerificationOtp: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2980
- email: string;
2981
- type: "sign-in" | "change-email" | "email-verification" | "forget-password";
2982
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2983
- email: string;
2984
- type: "sign-in" | "change-email" | "email-verification" | "forget-password";
2985
- } & {
2986
- fetchOptions?: FetchOptions | undefined;
2987
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
2988
- success: boolean;
2989
- }, {
2990
- code?: string | undefined;
2991
- message?: string | undefined;
2992
- }, FetchOptions["throw"] extends true ? true : true>>;
2993
- };
2994
- } & {
2995
- emailOtp: {
2996
- checkVerificationOtp: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2997
- email: string;
2998
- type: "sign-in" | "change-email" | "email-verification" | "forget-password";
2999
- otp: string;
3000
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
3001
- email: string;
3002
- type: "sign-in" | "change-email" | "email-verification" | "forget-password";
3003
- otp: string;
3004
- } & {
3005
- fetchOptions?: FetchOptions | undefined;
3006
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
3007
- success: boolean;
3008
- }, {
3009
- code?: string | undefined;
3010
- message?: string | undefined;
3011
- }, FetchOptions["throw"] extends true ? true : true>>;
3012
- };
3013
- } & {
3014
- emailOtp: {
3015
- verifyEmail: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
3016
- email: string;
3017
- otp: string;
3018
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
3019
- email: string;
3020
- otp: string;
3021
- } & {
3022
- fetchOptions?: FetchOptions | undefined;
3023
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<(Omit<{
3024
- status: boolean;
3025
- token: string;
3026
- user: {
3027
- id: string;
3028
- createdAt: Date;
3029
- updatedAt: Date;
3030
- email: string;
3031
- emailVerified: boolean;
3032
- name: string;
3033
- image?: string | null | undefined;
3034
- } & Record<string, any>;
3035
- }, "user"> & {
3036
- user: better_auth.StripEmptyObjects<{
3037
- id: string;
3038
- createdAt: Date;
3039
- updatedAt: Date;
3040
- email: string;
3041
- emailVerified: boolean;
3042
- name: string;
3043
- image?: string | null | undefined;
3044
- } & {
3045
- twoFactorEnabled: boolean | null | undefined;
3046
- } & {} & {
3047
- banned: boolean | null | undefined;
3048
- } & {
3049
- role?: string | null | undefined;
3050
- banReason?: string | null | undefined;
3051
- banExpires?: Date | null | undefined;
3052
- } & {} & {
3053
- lastActiveAt?: Date | null | undefined;
3054
- }>;
3055
- }) | (Omit<{
3056
- status: boolean;
3057
- token: null;
3058
- user: {
3059
- id: string;
3060
- createdAt: Date;
3061
- updatedAt: Date;
3062
- email: string;
3063
- emailVerified: boolean;
3064
- name: string;
3065
- image?: string | null | undefined;
3066
- } & Record<string, any>;
3067
- }, "user"> & {
3068
- user: better_auth.StripEmptyObjects<{
3069
- id: string;
3070
- createdAt: Date;
3071
- updatedAt: Date;
3072
- email: string;
3073
- emailVerified: boolean;
3074
- name: string;
3075
- image?: string | null | undefined;
3076
- } & {
3077
- twoFactorEnabled: boolean | null | undefined;
3078
- } & {} & {
3079
- banned: boolean | null | undefined;
3080
- } & {
3081
- role?: string | null | undefined;
3082
- banReason?: string | null | undefined;
3083
- banExpires?: Date | null | undefined;
3084
- } & {} & {
3085
- lastActiveAt?: Date | null | undefined;
3086
- }>;
3087
- }), {
3088
- code?: string | undefined;
3089
- message?: string | undefined;
3090
- }, FetchOptions["throw"] extends true ? true : true>>;
3091
- };
3092
- } & {
3093
- signIn: {
3094
- emailOtp: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
3095
- email: string;
3096
- otp: string;
3097
- name?: string | undefined;
3098
- image?: string | undefined;
3099
- } & Record<string, any>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
3100
- email: string;
3101
- otp: string;
3102
- name?: string | undefined;
3103
- image?: string | undefined;
3104
- } & Record<string, any> & {
3105
- fetchOptions?: FetchOptions | undefined;
3106
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<Omit<{
3107
- token: string;
714
+ declare class ApplicationSessionAssuranceError extends ApplicationError {
715
+ readonly payload: SessionAssuranceRequiredPayload | null;
716
+ readonly currentAssurance: SessionAssuranceRequiredPayload['currentAssurance'] | null;
717
+ readonly requiredAssurance: SessionAssuranceRequiredPayload['requiredAssurance'] | null;
718
+ readonly validStepUps: SessionAssuranceRequiredPayload['validStepUps'];
719
+ constructor(payload?: SessionAssuranceRequiredPayload | null, options?: ErrorOptions);
720
+ }
721
+ /**
722
+ * Thrown when an operation requires an authenticated user but no session exists.
723
+ */
724
+ declare class UserNotLoggedInError extends ApplicationError {
725
+ constructor(message: string, options?: ErrorOptions);
726
+ }
727
+ /**
728
+ * Thrown during device code polling when the user has not yet authorized the request.
729
+ *
730
+ * The client should continue polling at the specified interval.
731
+ */
732
+ declare class DeviceAuthorizationPendingError extends ApplicationError {
733
+ constructor(options?: ErrorOptions);
734
+ }
735
+ /**
736
+ * Thrown when the client is polling too frequently during the device flow.
737
+ *
738
+ * The client should increase its polling interval before retrying.
739
+ */
740
+ declare class DeviceAuthorizationSlowDownError extends ApplicationError {
741
+ constructor(options?: ErrorOptions);
742
+ }
743
+ /**
744
+ * Thrown when the user explicitly denies the device authorization request.
745
+ */
746
+ declare class DeviceAccessDeniedError extends ApplicationError {
747
+ constructor(options?: ErrorOptions);
748
+ }
749
+ /**
750
+ * Thrown when the device code has expired or has already been consumed.
751
+ *
752
+ * The client must start a new device authorization flow.
753
+ */
754
+ declare class DeviceCodeExpiredError extends ApplicationError {
755
+ constructor(options?: ErrorOptions);
756
+ }
757
+ /**
758
+ * Thrown when the authorization server returns a transient error during the device flow.
759
+ *
760
+ * The token exchange can be safely retried.
761
+ */
762
+ declare class DeviceTransientServerError extends ApplicationError {
763
+ constructor(options?: ErrorOptions);
764
+ }
765
+
766
+ /**
767
+ * Checks whether a session assurance value satisfies an application policy.
768
+ */
769
+ declare function isSessionAssuranceSufficient(sessionAssurance: JWTPayload['assurance'] | null | undefined, config?: ApplicationConfig): boolean;
770
+
771
+ /**
772
+ * Service for managing applications and their candidate organizations.
773
+ *
774
+ * Provides functionality for:
775
+ * - OAuth authorization code flow (PKCE)
776
+ * - Device authorization flow (RFC 8628)
777
+ * - Token management (refresh, exchange)
778
+ * - Organization switching
779
+ */
780
+ declare class ApplicationService {
781
+ private client;
782
+ /**
783
+ * Creates a new ApplicationService instance.
784
+ *
785
+ * @param client - The API client for making application requests
786
+ */
787
+ constructor(client: APIClient);
788
+ /**
789
+ * Gets public display context for an application auth redirect.
790
+ *
791
+ * @param applicationId - The application ID to get public auth context for
792
+ * @returns The minimal application identity safe to show before login
793
+ */
794
+ getApplicationAuthContext(applicationId: string): Promise<ApplicationAuthContextResponse>;
795
+ /**
796
+ * Lists candidate organizations for a specific application.
797
+ *
798
+ * Returns organizations where the authenticated user is a member and
799
+ * the application has been enabled with appropriate entitlement rules.
800
+ *
801
+ * @param applicationId - The application ID to get candidate organizations for
802
+ * @returns The list of candidate organizations
803
+ */
804
+ listCandidateOrganizations(applicationId: string): Promise<ListCandidateOrganizationsResponse>;
805
+ /**
806
+ * Starts an authorization flow for a specific application.
807
+ *
808
+ * @param applicationId - The application ID to start the authorization flow for
809
+ * @param redirectUri - The redirect URI to use for the authorization flow
810
+ * @param codeChallenge - The code challenge to use for the authorization flow
811
+ * @param organizationId - The organization ID to start the authorization flow for
812
+ */
813
+ startAuthorizationFlow(applicationId: string, redirectUri: string, codeChallenge: string, organizationId: string): Promise<StartAuthorizationFlowResponse>;
814
+ /**
815
+ * Starts a device authorization flow (RFC 8628).
816
+ *
817
+ * Returns a device code and user code that the end user must enter
818
+ * on the verification URI to authorize the device.
819
+ *
820
+ * @param requesterApplicationId - The application requesting authorization
821
+ * @param targetApplicationId - The target application to gain access to
822
+ * @returns Device authorization details including codes and verification URI
823
+ */
824
+ startDeviceAuthorizationFlow(requesterApplicationId: string, targetApplicationId: string): Promise<DeviceAuthorizationResponse>;
825
+ /**
826
+ * Retrieves the context for a pending device authorization request.
827
+ *
828
+ * Used by the authorization page to display details about the requesting
829
+ * and target applications before the user approves or denies.
830
+ *
831
+ * @param userCode - The user code from the device authorization response
832
+ * @returns Context including application info, available organizations, and status
833
+ */
834
+ getDeviceAuthorizationContext(userCode: string): Promise<DeviceAuthorizationContextResponse>;
835
+ /**
836
+ * Approves a pending device authorization request.
837
+ *
838
+ * @param userCode - The user code identifying the device authorization request
839
+ * @param organizationId - The organization to authorize the device for
840
+ * @returns Confirmation of the approval action
841
+ */
842
+ approveDeviceAuthorizationFlow(userCode: string, organizationId: string): Promise<DeviceAuthorizationActionResponse>;
843
+ /**
844
+ * Denies a pending device authorization request.
845
+ *
846
+ * @param userCode - The user code identifying the device authorization request
847
+ * @returns Confirmation of the denial action
848
+ */
849
+ denyDeviceAuthorizationFlow(userCode: string): Promise<DeviceAuthorizationActionResponse>;
850
+ /**
851
+ * Exchanges a device code for access and refresh tokens.
852
+ *
853
+ * This should be called by the device client while polling. It will throw
854
+ * typed errors to indicate the polling state (pending, slow down, denied, expired).
855
+ *
856
+ * @param deviceCode - The device code obtained from {@link startDeviceAuthorizationFlow}
857
+ * @returns Access and refresh tokens along with user and organization info
858
+ *
859
+ * @throws {DeviceAuthorizationPendingError} The user hasn't authorized yet — keep polling
860
+ * @throws {DeviceAuthorizationSlowDownError} Polling too fast — increase the interval
861
+ * @throws {DeviceAccessDeniedError} The user denied the request
862
+ * @throws {DeviceCodeExpiredError} The device code has expired
863
+ * @throws {DeviceTransientServerError} Transient server error — safe to retry
864
+ * @throws {ApplicationSessionAssuranceError} Assurance policy changed or is no longer met — start a new flow
865
+ */
866
+ exchangeDeviceCodeForTokens(deviceCode: string): Promise<CompleteAuthorizationFlowResponse>;
867
+ /**
868
+ * Completes an authorization flow for a specific application.
869
+ *
870
+ * @param code - The code to use for the authorization flow
871
+ * @param codeVerifier - The code verifier to use for the authorization flow
872
+ */
873
+ completeAuthorizationFlow(code: string, codeVerifier: string): Promise<CompleteAuthorizationFlowResponse>;
874
+ /**
875
+ * Refreshes an authentication token for a specific application.
876
+ *
877
+ * @param refreshToken - The refresh token to use for the authentication token refresh
878
+ * @throws {RefreshTokenExpiredError} When the refresh token has expired or is invalid
879
+ * @throws {ApplicationError} For other API errors
880
+ */
881
+ refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse | null>;
882
+ /**
883
+ * Gets the current user and organization for a specific application.
884
+ *
885
+ * By default, the returned organization does not include its `members`,
886
+ * `teams`, or `invitations` collections. Pass `options.include` to request
887
+ * any of them explicitly.
888
+ *
889
+ * @param accessToken - The access token to use for the who am I request
890
+ * @param options - Optional include list controlling which relations are loaded
891
+ * @returns The current user and organization
892
+ */
893
+ whoAmI(accessToken: string, options?: WhoAmIOptions): Promise<WhoAmIResponse>;
894
+ /**
895
+ * Switches the active organization for the authenticated user.
896
+ *
897
+ * Issues new access and refresh tokens scoped to the specified organization.
898
+ * The target organization must be entitled to the application and the entitlement's
899
+ * access rules must allow the current user.
900
+ *
901
+ * @param organizationId - The ID of the organization to switch to
902
+ * @param accessToken - Optional access token for authentication (uses cookie if not provided)
903
+ * @returns New authentication tokens and user/organization details
904
+ */
905
+ switchOrganization(organizationId: string, accessToken: string): Promise<CompleteAuthorizationFlowResponse>;
906
+ /**
907
+ * Logs out the user by invalidating their refresh token.
908
+ *
909
+ * Revokes the refresh token on the server, preventing further token refreshes
910
+ * and effectively ending the user's session.
911
+ *
912
+ * @param refreshToken - The refresh token to invalidate
913
+ */
914
+ logout(refreshToken: string): Promise<void>;
915
+ }
916
+
917
+ declare const ApiKeyMetadata: z.ZodObject<{
918
+ user: z.ZodObject<{
919
+ id: z.ZodString;
920
+ email: z.ZodString;
921
+ }, z.core.$strip>;
922
+ workspace: z.ZodObject<{
923
+ id: z.ZodString;
924
+ title: z.ZodString;
925
+ }, z.core.$strip>;
926
+ application: z.ZodNullable<z.ZodOptional<z.ZodObject<{
927
+ id: z.ZodString;
928
+ name: z.ZodString;
929
+ }, z.core.$strip>>>;
930
+ }, z.core.$strip>;
931
+ /**
932
+ * Metadata attached to an API key, identifying the owning user and workspace.
933
+ */
934
+ type ApiKeyMetadata = z.infer<typeof ApiKeyMetadata> & Record<string, unknown>;
935
+ /**
936
+ * A full API key including the secret key value.
937
+ *
938
+ * The secret `key` field is only returned once at creation time.
939
+ */
940
+ type ApiKey = Omit<ApiKey$1, 'metadata' | 'name'> & {
941
+ /** Display name of the API key. */
942
+ name: string;
943
+ /** Metadata identifying the key's owner and workspace. */
944
+ metadata: ApiKeyMetadata;
945
+ };
946
+ /**
947
+ * An API key with the secret key value omitted.
948
+ *
949
+ * Used in list and get operations where the secret should not be exposed.
950
+ */
951
+ type ApiKeyWithoutSecret = Omit<ApiKey, 'key'>;
952
+ /**
953
+ * Payload for creating a new API key.
954
+ */
955
+ type CreateApiKeyPayload = {
956
+ /** Display name for the API key. */
957
+ name: string;
958
+ /** Time in milliseconds until the key expires. Omit for a non-expiring key. */
959
+ expiresIn?: number;
960
+ /** Optional prefix prepended to the generated key for identification. */
961
+ prefix?: string;
962
+ /** Optional metadata to attach to the key. */
963
+ metadata?: ApiKeyMetadata;
964
+ };
965
+ /**
966
+ * Payload for updating an existing API key.
967
+ */
968
+ type UpdateApiKeyPayload = {
969
+ /** The ID of the API key to update. */
970
+ id: string;
971
+ /** The new display name for the API key. */
972
+ name: string;
973
+ };
974
+
975
+ /**
976
+ * Removes index signatures from a type
977
+ * @template T - The type to remove index signatures from
978
+ * @example
979
+ * ```typescript
980
+ * type MyType = {
981
+ * foo: string
982
+ * bar: number
983
+ * [key: string]: any
984
+ * }
985
+ *
986
+ * type StrictMyType = Strict<MyType> // { foo: string; bar: number; }
987
+ * ```
988
+ */
989
+ type Strict<T> = {
990
+ [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
991
+ };
992
+ /**
993
+ * Creates a configured Better Auth API client with all required plugins.
994
+ *
995
+ * @param apiUrl - The base URL of the authentication API
996
+ * @param fetchOptions - Custom fetch options to include in all API requests
997
+ * @returns A fully-configured Better Auth client instance
998
+ *
999
+ * @internal
1000
+ */
1001
+ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOption): {
1002
+ useActiveOrganization: better_auth_client.AuthQueryAtom<better_auth.Prettify<{
1003
+ id: string;
1004
+ name: string;
1005
+ slug: string;
1006
+ createdAt: Date;
1007
+ logo?: string | null | undefined | undefined;
1008
+ metadata?: any;
1009
+ } & {
1010
+ members: {
1011
+ id: string;
1012
+ organizationId: string;
1013
+ role: "org:admin" | "org:member" | "org:reviewer";
1014
+ createdAt: Date;
1015
+ userId: string;
1016
+ teamId?: string | undefined | undefined;
3108
1017
  user: {
3109
1018
  id: string;
3110
- createdAt: Date;
3111
- updatedAt: Date;
3112
1019
  email: string;
3113
- emailVerified: boolean;
3114
1020
  name: string;
3115
- image?: string | null | undefined;
1021
+ image?: string | undefined;
3116
1022
  };
3117
- }, "user"> & {
3118
- user: better_auth.StripEmptyObjects<{
3119
- id: string;
3120
- createdAt: Date;
3121
- updatedAt: Date;
3122
- email: string;
3123
- emailVerified: boolean;
3124
- name: string;
3125
- image?: string | null | undefined;
3126
- } & {
3127
- twoFactorEnabled: boolean | null | undefined;
3128
- } & {} & {
3129
- banned: boolean | null | undefined;
3130
- } & {
3131
- role?: string | null | undefined;
3132
- banReason?: string | null | undefined;
3133
- banExpires?: Date | null | undefined;
3134
- } & {} & {
3135
- lastActiveAt?: Date | null | undefined;
3136
- }>;
3137
- }, {
3138
- code?: string | undefined;
3139
- message?: string | undefined;
3140
- }, FetchOptions["throw"] extends true ? true : true>>;
3141
- };
3142
- } & {
3143
- emailOtp: {
3144
- requestPasswordReset: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
3145
- email: string;
3146
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
3147
- email: string;
3148
- } & {
3149
- fetchOptions?: FetchOptions | undefined;
3150
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
3151
- success: boolean;
3152
- }, {
3153
- code?: string | undefined;
3154
- message?: string | undefined;
3155
- }, FetchOptions["throw"] extends true ? true : true>>;
3156
- };
3157
- } & {
3158
- forgetPassword: {
3159
- emailOtp: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
3160
- email: string;
3161
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
3162
- email: string;
3163
- } & {
3164
- fetchOptions?: FetchOptions | undefined;
3165
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
3166
- success: boolean;
3167
- }, {
3168
- code?: string | undefined;
3169
- message?: string | undefined;
3170
- }, FetchOptions["throw"] extends true ? true : true>>;
3171
- };
3172
- } & {
3173
- emailOtp: {
3174
- resetPassword: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
3175
- email: string;
3176
- otp: string;
3177
- password: string;
3178
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
1023
+ }[];
1024
+ invitations: {
1025
+ id: string;
1026
+ organizationId: string;
3179
1027
  email: string;
3180
- otp: string;
3181
- password: string;
3182
- } & {
3183
- fetchOptions?: FetchOptions | undefined;
3184
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
3185
- success: boolean;
3186
- }, {
3187
- code?: string | undefined;
3188
- message?: string | undefined;
3189
- }, FetchOptions["throw"] extends true ? true : true>>;
3190
- };
3191
- } & {
3192
- emailOtp: {
3193
- requestEmailChange: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
3194
- newEmail: string;
3195
- otp?: string | undefined;
3196
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
3197
- newEmail: string;
3198
- otp?: string | undefined;
3199
- } & {
3200
- fetchOptions?: FetchOptions | undefined;
3201
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
3202
- success: boolean;
3203
- }, {
3204
- code?: string | undefined;
3205
- message?: string | undefined;
3206
- }, FetchOptions["throw"] extends true ? true : true>>;
3207
- };
3208
- } & {
3209
- emailOtp: {
3210
- changeEmail: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
3211
- newEmail: string;
3212
- otp: string;
3213
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
3214
- newEmail: string;
3215
- otp: string;
3216
- } & {
3217
- fetchOptions?: FetchOptions | undefined;
3218
- }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
3219
- success: boolean;
3220
- }, {
3221
- code?: string | undefined;
3222
- message?: string | undefined;
3223
- }, FetchOptions["throw"] extends true ? true : true>>;
3224
- };
1028
+ role: "org:admin" | "org:member" | "org:reviewer";
1029
+ status: better_auth_plugins.InvitationStatus;
1030
+ inviterId: string;
1031
+ expiresAt: Date;
1032
+ createdAt: Date;
1033
+ teamId?: string | undefined | undefined;
1034
+ }[];
1035
+ }>>;
1036
+ useListOrganizations: better_auth_client.AuthQueryAtom<{
1037
+ id: string;
1038
+ name: string;
1039
+ slug: string;
1040
+ createdAt: Date;
1041
+ logo?: string | null | undefined | undefined;
1042
+ metadata?: any;
1043
+ }[]>;
1044
+ useActiveMember: better_auth_client.AuthQueryAtom<{
1045
+ id: string;
1046
+ organizationId: string;
1047
+ userId: string;
1048
+ role: string;
1049
+ createdAt: Date;
1050
+ }>;
1051
+ useActiveMemberRole: better_auth_client.AuthQueryAtom<{
1052
+ role: string;
1053
+ }>;
3225
1054
  } & {
3226
1055
  signIn: {
3227
1056
  social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
@@ -4337,7 +2166,7 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4337
2166
  body?: any;
4338
2167
  query?: any;
4339
2168
  params?: any;
4340
- duplex?: "full" | "half" | undefined;
2169
+ duplex? /** Number of hours to retain data before automatic cleanup. */: "full" | "half" | undefined;
4341
2170
  jsonParser: (text: string) => Promise<any> | any;
4342
2171
  retry?: better_auth_client.RetryOptions | undefined;
4343
2172
  retryAttempt?: number | undefined;
@@ -5077,11 +2906,26 @@ type Member = Strict<APIClient['$Infer']['Member']>;
5077
2906
  /**
5078
2907
  * Custom settings that can be applied to an organization.
5079
2908
  */
2909
+ type BillingMode = 'credits' | 'plan';
5080
2910
  type OrganizationSettings = {
5081
2911
  /** Whether file storage is disabled for this organization. */
5082
2912
  disableStorage?: boolean;
5083
2913
  /** Number of hours to retain data before automatic cleanup. */
5084
2914
  dataRetentionHours?: number;
2915
+ /** How the organization is billed for usage. */
2916
+ billing?: {
2917
+ mode: BillingMode;
2918
+ cvp?: number;
2919
+ limits?: {
2920
+ enabled: boolean;
2921
+ soft_usd?: number;
2922
+ hard_usd?: number;
2923
+ soft_credits?: number;
2924
+ hard_credits?: number;
2925
+ period: 'monthly';
2926
+ notify_emails?: string[];
2927
+ };
2928
+ };
5085
2929
  };
5086
2930
  /**
5087
2931
  * An organization with optional custom settings.
@@ -5120,389 +2964,405 @@ type TeamMember = {
5120
2964
  /** When the user was added to the team. */
5121
2965
  createdAt: Date;
5122
2966
  };
5123
-
5124
- declare const DEFAULT_SESSION_ASSURANCE_CONFIG: ApplicationSessionAssuranceConfig;
5125
- declare const DEFAULT_APPLICATION_CONFIG: {
5126
- version: 1;
5127
- sessionAssurance: ApplicationSessionAssuranceConfig;
5128
- };
5129
- type ApplicationSessionAssuranceConfig = {
5130
- acceptedAmr: AMR[];
5131
- minAal: AAL;
5132
- };
5133
- declare const ApplicationSessionAssuranceConfig: z.ZodType<ApplicationSessionAssuranceConfig>;
5134
- type ApplicationConfig = {
5135
- version: 1;
5136
- sessionAssurance: ApplicationSessionAssuranceConfig;
5137
- };
5138
- declare const ApplicationConfig: z.ZodType<ApplicationConfig>;
5139
- /**
5140
- * Keys of the organization's related collections that can be optionally
5141
- * included in the "who am I" response.
5142
- */
5143
- type WhoAmIInclude = 'members' | 'teams' | 'invitations';
5144
- /**
5145
- * Represents a registered OAuth application.
5146
- */
5147
- type Application = {
5148
- /** Unique application identifier. */
5149
- id: string;
5150
- /** Display name of the application. */
5151
- name: string;
5152
- /** Human-readable description of the application. */
5153
- description: string;
5154
- /** Allowed OAuth redirect URIs for this application. */
5155
- redirectUris: string[];
5156
- /** Additional configuration for this application. */
5157
- config?: ApplicationConfig;
5158
- };
5159
- /**
5160
- * Response returned when listing candidate organizations for an application.
5161
- */
5162
- type ListCandidateOrganizationsResponse = FullOrganization[];
5163
- /**
5164
- * Public application context used to preserve continuity during auth redirects.
5165
- */
5166
- type ApplicationAuthContextResponse = {
5167
- /** Minimal application identity shown in the hosted auth flow. */
5168
- application: Pick<Application, 'id' | 'name' | 'config'>;
5169
- };
5170
- /**
5171
- * Response returned when starting an authorization flow.
5172
- */
5173
- type StartAuthorizationFlowResponse = {
5174
- /** The authorization code to exchange for tokens. */
5175
- code: string;
5176
- };
2967
+
5177
2968
  /**
5178
- * Response returned when completing an authorization flow or refreshing tokens.
2969
+ * Options accepted when listing users through the Better Auth admin plugin.
5179
2970
  */
5180
- type CompleteAuthorizationFlowResponse = {
5181
- /** Short-lived JWT access token. */
5182
- accessToken: string;
5183
- /** Long-lived refresh token for obtaining new access tokens. */
5184
- refreshToken: string;
5185
- /** The authenticated user. */
5186
- user: User;
5187
- /** The organization the tokens are scoped to. */
5188
- organization: FullOrganization;
5189
- /** Assurance context embedded in the issued access token. */
5190
- assurance: JWTPayload['assurance'];
2971
+ type ListAdminUsersOptions = {
2972
+ /** Maximum number of users to return. */
2973
+ limit?: number;
2974
+ /** Number of users to skip. */
2975
+ offset?: number;
2976
+ /** Free-text search value. */
2977
+ searchValue?: string;
2978
+ /** User field searched by Better Auth. Defaults to email. */
2979
+ searchField?: 'email' | 'name';
2980
+ /** Search comparison operator. Defaults to contains. */
2981
+ searchOperator?: 'contains' | 'starts_with' | 'ends_with';
2982
+ /** Field used to sort the listing. */
2983
+ sortBy?: string;
2984
+ /** Sort direction. */
2985
+ sortDirection?: 'asc' | 'desc';
2986
+ /** User field filtered by Better Auth. Defaults to email. */
2987
+ filterField?: string;
2988
+ /** Filter value. */
2989
+ filterValue?: string | number | boolean | string[] | number[];
2990
+ /** Filter comparison operator. Defaults to eq. */
2991
+ filterOperator?: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'not_in' | 'contains' | 'starts_with' | 'ends_with';
5191
2992
  };
5192
2993
  /**
5193
- * Response returned by the "who am I" endpoint.
5194
- *
5195
- * By default, the `organization` only contains the base organization fields.
5196
- * The `members`, `teams`, and `invitations` collections are only populated
5197
- * when explicitly requested via the `include` query parameter.
2994
+ * Options accepted when listing all organizations as a global admin.
5198
2995
  */
5199
- type WhoAmIResponse = {
5200
- /** The authenticated user. */
5201
- user: User;
5202
- /** The user's active organization. */
5203
- organization: WhoAmIOrganization;
5204
- /** Assurance context embedded in the verified access token. */
5205
- assurance: JWTPayload['assurance'];
2996
+ type ListAdminOrganizationsOptions = {
2997
+ /** Maximum number of organizations to return. Defaults to 50. */
2998
+ limit?: number;
2999
+ /** Number of organizations to skip. Defaults to 0. */
3000
+ offset?: number;
3001
+ /** Column used to order the listing. Defaults to creation date. */
3002
+ sortBy?: 'createdAt' | 'title';
3003
+ /** Order direction. Defaults to descending. */
3004
+ sortDirection?: 'asc' | 'desc';
3005
+ /** Free-text search matched against organization name, slug, and ID. */
3006
+ query?: string;
3007
+ /**
3008
+ * Number of member previews to include per organization (max 10).
3009
+ * When greater than 0, each row also includes the total member count.
3010
+ * Defaults to 0 (no members or member count returned).
3011
+ */
3012
+ membersPreview?: number;
3013
+ /**
3014
+ * Number of application previews to include per organization (max 10).
3015
+ * When greater than 0, each row also includes the total application count.
3016
+ * Defaults to 0 (no applications or application count returned).
3017
+ */
3018
+ applicationsPreview?: number;
5206
3019
  };
5207
3020
  /**
5208
- * Options accepted by the "who am I" client method.
3021
+ * Options accepted when listing applications as a global admin.
5209
3022
  */
5210
- type WhoAmIOptions = {
3023
+ type ListAdminApplicationsOptions = {
3024
+ /** Maximum number of applications to return. Defaults to 50. */
3025
+ limit?: number;
5211
3026
  /**
5212
- * Collections to include in the returned organization. When omitted or
5213
- * empty, only the base organization fields are returned.
3027
+ * Number of member previews to include per application (max 10).
3028
+ * When greater than 0, each row also includes the total member count.
3029
+ * Defaults to 0 (no members or member count returned).
5214
3030
  */
5215
- include?: WhoAmIInclude[];
3031
+ membersPreview?: number;
3032
+ /** Number of applications to skip. Defaults to 0. */
3033
+ offset?: number;
3034
+ /** Column used to order the listing. Defaults to creation date. */
3035
+ orderBy?: 'createdAt' | 'updatedAt' | 'name';
3036
+ /** Order direction. Defaults to descending. */
3037
+ orderDirection?: 'asc' | 'desc';
3038
+ /** When provided, only applications enabled for this organization are returned. */
3039
+ organizationId?: string;
3040
+ /** Free-text search matched against application name, description, and UUIDs. */
3041
+ search?: string;
5216
3042
  };
5217
3043
  /**
5218
- * Response returned when starting a device authorization flow (RFC 8628).
3044
+ * Options accepted when fetching a single organization as a global admin.
5219
3045
  */
5220
- type DeviceAuthorizationResponse = {
5221
- /** The device verification code for polling. */
5222
- device_code: string;
5223
- /** The user-facing code to enter on the verification page. */
5224
- user_code: string;
5225
- /** The URI the user should visit to authorize the device. */
5226
- verification_uri: string;
5227
- /** A complete URI including the user code for convenience. */
5228
- verification_uri_complete: string;
5229
- /** Number of seconds until the device code expires. */
5230
- expires_in: number;
5231
- /** Minimum polling interval in seconds. */
5232
- interval: number;
3046
+ type GetAdminOrganizationOptions = {
3047
+ /** ID of the organization to fetch. */
3048
+ organizationId: string;
3049
+ /** Column the listing adjacency is computed against. Defaults to creation date. */
3050
+ sortBy?: 'createdAt' | 'title';
3051
+ /** Order direction the listing adjacency is computed against. Defaults to descending. */
3052
+ sortDirection?: 'asc' | 'desc';
3053
+ /**
3054
+ * When true, the organization includes adjacent IDs in the listing
3055
+ * defined by the ordering options.
3056
+ */
3057
+ includeAdjacent?: boolean;
5233
3058
  };
5234
3059
  /**
5235
- * Minimal application info shown in device authorization context.
5236
- *
5237
- * @internal
3060
+ * Options accepted when listing members for a single organization as a global admin.
5238
3061
  */
5239
- type DeviceContextApplication = {
5240
- /** Unique application identifier. */
5241
- id: string;
5242
- /** Display name of the application. */
5243
- name: string;
5244
- /** Human-readable description, or `null` if not set. */
5245
- description: string | null;
3062
+ type ListAdminOrganizationMembersOptions = {
3063
+ /** ID of the organization whose members should be listed. */
3064
+ organizationId: string;
3065
+ /** Maximum number of members to return. Defaults to 50. */
3066
+ limit?: number;
3067
+ /** Number of members to skip. Defaults to 0. */
3068
+ offset?: number;
5246
3069
  };
5247
3070
  /**
5248
- * Context information for a pending device authorization request.
3071
+ * Options accepted when creating an organization as a global admin.
5249
3072
  */
5250
- type DeviceAuthorizationContextResponse = {
5251
- /** The application that initiated the device flow, with verification status. */
5252
- requester: DeviceContextApplication & {
5253
- isVerified: boolean;
5254
- };
5255
- /** The target application the requester wants access to. */
5256
- target: DeviceContextApplication;
5257
- /** Organizations the user can authorize the device for. */
5258
- organizations: FullOrganization[];
5259
- /** Organization pre-selected by the requester, if any. */
5260
- preselectedOrganizationId: string | null;
5261
- /** Current status of the device authorization request. */
5262
- status: 'pending' | 'approved' | 'denied';
5263
- /** Seconds remaining before the device code expires. */
5264
- expiresIn: number;
3073
+ type CreateAdminOrganizationOptions = {
3074
+ /** Optional organization ID. Generated by the API when omitted. */
3075
+ id?: string;
3076
+ /** Display name of the organization. */
3077
+ name: string;
3078
+ /** URL-friendly identifier. Generated from the name when omitted. */
3079
+ slug?: string;
3080
+ /** Logo URL. */
3081
+ logo?: string;
3082
+ /** Opaque metadata stored with the organization. */
3083
+ metadata?: string;
3084
+ /** Custom organization settings. */
3085
+ settings?: OrganizationSettings;
5265
3086
  };
5266
3087
  /**
5267
- * Response returned when approving or denying a device authorization request.
5268
- */
5269
- type DeviceAuthorizationActionResponse = {
5270
- /** Whether the action was performed successfully. */
5271
- success: boolean;
3088
+ * Options accepted when updating an organization as a global admin.
3089
+ */
3090
+ type UpdateAdminOrganizationOptions = {
3091
+ /** ID of the organization to update. */
3092
+ organizationId: string;
3093
+ /** Display name of the organization. */
3094
+ name?: string;
3095
+ /** URL-friendly identifier. */
3096
+ slug?: string;
3097
+ /** Logo URL. */
3098
+ logo?: string;
3099
+ /** Opaque metadata stored with the organization. */
3100
+ metadata?: string;
3101
+ /** Custom organization settings. Replaces the stored settings object. */
3102
+ settings?: OrganizationSettings;
5272
3103
  };
5273
-
5274
3104
  /**
5275
- * Generic error thrown by the `ApplicationService`.
5276
- *
5277
- * All application-specific errors extend this class, so you can catch
5278
- * `ApplicationError` to handle any application-related failure.
3105
+ * User row returned by the Better Auth admin user listing endpoint.
5279
3106
  */
5280
- declare class ApplicationError extends BaseError {
5281
- constructor(message: string, options?: ErrorOptions);
5282
- }
3107
+ type AdminUser = {
3108
+ id: string;
3109
+ name: string;
3110
+ email: string;
3111
+ emailVerified: boolean;
3112
+ image: string | null;
3113
+ createdAt: string | Date;
3114
+ updatedAt: string | Date;
3115
+ role: string | null;
3116
+ banned: boolean | null;
3117
+ banReason: string | null;
3118
+ banExpires: string | Date | null;
3119
+ lastActiveAt?: string | Date | null;
3120
+ twoFactorEnabled?: boolean | null;
3121
+ };
5283
3122
  /**
5284
- * Thrown when a refresh token has expired or been revoked.
5285
- *
5286
- * The client should discard its stored tokens and prompt the user
5287
- * to re-authenticate.
3123
+ * Paginated Better Auth admin user listing response.
5288
3124
  */
5289
- declare class RefreshTokenExpiredError extends ApplicationError {
5290
- constructor(options?: ErrorOptions);
5291
- }
3125
+ type ListAdminUsersResult = {
3126
+ users: AdminUser[];
3127
+ total: number;
3128
+ limit?: number;
3129
+ offset?: number;
3130
+ };
5292
3131
  /**
5293
- * Thrown when an authorization flow fails unexpectedly.
3132
+ * Member preview returned alongside each admin organization row.
5294
3133
  */
5295
- declare class AuthorizationFlowError extends ApplicationError {
5296
- constructor(message: string, options?: ErrorOptions);
5297
- }
3134
+ type AdminOrganizationMember = {
3135
+ id: string;
3136
+ name: string;
3137
+ email: string;
3138
+ image: string | null;
3139
+ };
5298
3140
  /**
5299
- * Thrown when the authenticated session no longer satisfies the target
5300
- * application's assurance policy.
5301
- *
5302
- * During device-code token exchange this is a final error: the consumed flow
5303
- * cannot be retried and the client must start a new device authorization flow.
3141
+ * Full organization member row returned by the admin organization member listing endpoint.
5304
3142
  */
5305
- declare class ApplicationSessionAssuranceError extends ApplicationError {
5306
- readonly payload: SessionAssuranceRequiredPayload | null;
5307
- readonly currentAssurance: SessionAssuranceRequiredPayload['currentAssurance'] | null;
5308
- readonly requiredAssurance: SessionAssuranceRequiredPayload['requiredAssurance'] | null;
5309
- readonly validStepUps: SessionAssuranceRequiredPayload['validStepUps'];
5310
- constructor(payload?: SessionAssuranceRequiredPayload | null, options?: ErrorOptions);
5311
- }
3143
+ type AdminOrganizationMemberRecord = AdminOrganizationMember & {
3144
+ memberId: string;
3145
+ organizationId: string;
3146
+ role: string;
3147
+ createdAt: string;
3148
+ };
5312
3149
  /**
5313
- * Thrown when an operation requires an authenticated user but no session exists.
3150
+ * Paginated organization member listing response.
5314
3151
  */
5315
- declare class UserNotLoggedInError extends ApplicationError {
5316
- constructor(message: string, options?: ErrorOptions);
5317
- }
3152
+ type ListAdminOrganizationMembersResult = {
3153
+ members: AdminOrganizationMemberRecord[];
3154
+ total: number;
3155
+ limit: number;
3156
+ offset: number;
3157
+ };
5318
3158
  /**
5319
- * Thrown during device code polling when the user has not yet authorized the request.
5320
- *
5321
- * The client should continue polling at the specified interval.
3159
+ * Organization row embedded in an admin application entitlement.
5322
3160
  */
5323
- declare class DeviceAuthorizationPendingError extends ApplicationError {
5324
- constructor(options?: ErrorOptions);
5325
- }
3161
+ type AdminApplicationOrganization = {
3162
+ id: string;
3163
+ title: string;
3164
+ slug: string | null;
3165
+ avatarUrl: string | null;
3166
+ createdAt: string;
3167
+ metadata: string | null;
3168
+ settings: OrganizationSettings | null;
3169
+ };
5326
3170
  /**
5327
- * Thrown when the client is polling too frequently during the device flow.
5328
- *
5329
- * The client should increase its polling interval before retrying.
3171
+ * Entitlement returned alongside each admin application row.
5330
3172
  */
5331
- declare class DeviceAuthorizationSlowDownError extends ApplicationError {
5332
- constructor(options?: ErrorOptions);
5333
- }
3173
+ type AdminApplicationEntitlement = {
3174
+ id: string;
3175
+ applicationId: string;
3176
+ organizationId: string;
3177
+ enabled: boolean;
3178
+ createdAt: string;
3179
+ updatedAt: string;
3180
+ createdBy: string;
3181
+ updatedBy: string;
3182
+ organization: AdminApplicationOrganization | null;
3183
+ };
5334
3184
  /**
5335
- * Thrown when the user explicitly denies the device authorization request.
3185
+ * Member preview returned alongside each admin application row.
5336
3186
  */
5337
- declare class DeviceAccessDeniedError extends ApplicationError {
5338
- constructor(options?: ErrorOptions);
5339
- }
3187
+ type AdminApplicationMember = {
3188
+ id: string;
3189
+ name: string;
3190
+ email: string;
3191
+ image: string | null;
3192
+ };
5340
3193
  /**
5341
- * Thrown when the device code has expired or has already been consumed.
5342
- *
5343
- * The client must start a new device authorization flow.
3194
+ * Application row returned by the admin application listing endpoint.
5344
3195
  */
5345
- declare class DeviceCodeExpiredError extends ApplicationError {
5346
- constructor(options?: ErrorOptions);
5347
- }
3196
+ type AdminApplication = {
3197
+ id: string;
3198
+ name: string;
3199
+ description: string | null;
3200
+ imageUrl: string | null;
3201
+ redirectUris: string[];
3202
+ homeUrl: string | null;
3203
+ config: ApplicationConfig | null;
3204
+ createdBy: string;
3205
+ updatedBy: string;
3206
+ createdAt: string;
3207
+ updatedAt: string;
3208
+ entitlements: AdminApplicationEntitlement[];
3209
+ /** Total number of users with application access. Present when requested via membersPreview. */
3210
+ memberCount?: number;
3211
+ /** Preview of the first users with application access. Present when requested via membersPreview. */
3212
+ members?: AdminApplicationMember[];
3213
+ };
5348
3214
  /**
5349
- * Thrown when the authorization server returns a transient error during the device flow.
5350
- *
5351
- * The token exchange can be safely retried.
3215
+ * Admin application listing response.
5352
3216
  */
5353
- declare class DeviceTransientServerError extends ApplicationError {
5354
- constructor(options?: ErrorOptions);
5355
- }
5356
-
3217
+ type ListAdminApplicationsResult = AdminApplication[];
5357
3218
  /**
5358
- * Checks whether a session assurance value satisfies an application policy.
3219
+ * Application preview returned alongside each admin organization row.
5359
3220
  */
5360
- declare function isSessionAssuranceSufficient(sessionAssurance: JWTPayload['assurance'] | null | undefined, config?: ApplicationConfig): boolean;
5361
-
3221
+ type AdminOrganizationApplication = {
3222
+ id: string;
3223
+ name: string;
3224
+ imageUrl: string | null;
3225
+ createdAt: string;
3226
+ };
5362
3227
  /**
5363
- * Service for managing applications and their candidate organizations.
5364
- *
5365
- * Provides functionality for:
5366
- * - OAuth authorization code flow (PKCE)
5367
- * - Device authorization flow (RFC 8628)
5368
- * - Token management (refresh, exchange)
5369
- * - Organization switching
3228
+ * Organization row returned by the admin organization listing endpoint.
5370
3229
  */
5371
- declare class ApplicationService {
5372
- private client;
5373
- /**
5374
- * Creates a new ApplicationService instance.
5375
- *
5376
- * @param client - The API client for making application requests
5377
- */
5378
- constructor(client: APIClient);
5379
- /**
5380
- * Gets public display context for an application auth redirect.
5381
- *
5382
- * @param applicationId - The application ID to get public auth context for
5383
- * @returns The minimal application identity safe to show before login
5384
- */
5385
- getApplicationAuthContext(applicationId: string): Promise<ApplicationAuthContextResponse>;
5386
- /**
5387
- * Lists candidate organizations for a specific application.
5388
- *
5389
- * Returns organizations where the authenticated user is a member and
5390
- * the application has been enabled with appropriate entitlement rules.
5391
- *
5392
- * @param applicationId - The application ID to get candidate organizations for
5393
- * @returns The list of candidate organizations
5394
- */
5395
- listCandidateOrganizations(applicationId: string): Promise<ListCandidateOrganizationsResponse>;
5396
- /**
5397
- * Starts an authorization flow for a specific application.
5398
- *
5399
- * @param applicationId - The application ID to start the authorization flow for
5400
- * @param redirectUri - The redirect URI to use for the authorization flow
5401
- * @param codeChallenge - The code challenge to use for the authorization flow
5402
- * @param organizationId - The organization ID to start the authorization flow for
5403
- */
5404
- startAuthorizationFlow(applicationId: string, redirectUri: string, codeChallenge: string, organizationId: string): Promise<StartAuthorizationFlowResponse>;
5405
- /**
5406
- * Starts a device authorization flow (RFC 8628).
5407
- *
5408
- * Returns a device code and user code that the end user must enter
5409
- * on the verification URI to authorize the device.
5410
- *
5411
- * @param requesterApplicationId - The application requesting authorization
5412
- * @param targetApplicationId - The target application to gain access to
5413
- * @returns Device authorization details including codes and verification URI
5414
- */
5415
- startDeviceAuthorizationFlow(requesterApplicationId: string, targetApplicationId: string): Promise<DeviceAuthorizationResponse>;
5416
- /**
5417
- * Retrieves the context for a pending device authorization request.
5418
- *
5419
- * Used by the authorization page to display details about the requesting
5420
- * and target applications before the user approves or denies.
5421
- *
5422
- * @param userCode - The user code from the device authorization response
5423
- * @returns Context including application info, available organizations, and status
5424
- */
5425
- getDeviceAuthorizationContext(userCode: string): Promise<DeviceAuthorizationContextResponse>;
3230
+ type AdminOrganization = {
3231
+ id: string;
3232
+ name: string;
3233
+ slug: string;
3234
+ logo: string | null;
3235
+ createdAt: string;
3236
+ metadata: string | null;
3237
+ settings: OrganizationSettings | null;
3238
+ /** Total number of active members. Present when requested via membersPreview. */
3239
+ memberCount?: number;
3240
+ /** Preview of the first members. Present when requested via membersPreview. */
3241
+ members?: AdminOrganizationMember[];
3242
+ /** Total number of enabled applications. Present when requested via applicationsPreview. */
3243
+ applicationCount?: number;
3244
+ /** Preview of the first enabled applications. Present when requested via applicationsPreview. */
3245
+ applications?: AdminOrganizationApplication[];
3246
+ /**
3247
+ * Adjacent organization IDs in the listing defined by the ordering options.
3248
+ * Present when requested via includeAdjacent.
3249
+ */
3250
+ adjacent?: {
3251
+ previous: string | null;
3252
+ next: string | null;
3253
+ /** 1-based position in the listing. */
3254
+ index: number;
3255
+ total: number;
3256
+ };
3257
+ };
3258
+ /**
3259
+ * Paginated admin organization listing response.
3260
+ */
3261
+ type ListAdminOrganizationsResult = {
3262
+ organizations: AdminOrganization[];
3263
+ total: number;
3264
+ limit: number;
3265
+ offset: number;
3266
+ };
3267
+
3268
+ /**
3269
+ * Service for global admin operations.
3270
+ *
3271
+ * All endpoints require the authenticated user to hold the global admin role.
3272
+ */
3273
+ declare class AdminService {
3274
+ private client;
5426
3275
  /**
5427
- * Approves a pending device authorization request.
3276
+ * Creates a new AdminService instance.
5428
3277
  *
5429
- * @param userCode - The user code identifying the device authorization request
5430
- * @param organizationId - The organization to authorize the device for
5431
- * @returns Confirmation of the approval action
3278
+ * @param client - The API client for making admin requests
5432
3279
  */
5433
- approveDeviceAuthorizationFlow(userCode: string, organizationId: string): Promise<DeviceAuthorizationActionResponse>;
3280
+ constructor(client: APIClient);
5434
3281
  /**
5435
- * Denies a pending device authorization request.
3282
+ * Lists all organizations, optionally with member and application previews
3283
+ * and totals when a preview size is requested.
5436
3284
  *
5437
- * @param userCode - The user code identifying the device authorization request
5438
- * @returns Confirmation of the denial action
3285
+ * @param options - Pagination, ordering, search, and preview options
3286
+ * @returns The paginated organization listing
5439
3287
  */
5440
- denyDeviceAuthorizationFlow(userCode: string): Promise<DeviceAuthorizationActionResponse>;
3288
+ listOrganizations(options?: ListAdminOrganizationsOptions): Promise<{
3289
+ data: null;
3290
+ error: {
3291
+ message?: string | undefined;
3292
+ status: number;
3293
+ statusText: string;
3294
+ };
3295
+ } | {
3296
+ data: ListAdminOrganizationsResult;
3297
+ error: null;
3298
+ }>;
5441
3299
  /**
5442
- * Exchanges a device code for access and refresh tokens.
5443
- *
5444
- * This should be called by the device client while polling. It will throw
5445
- * typed errors to indicate the polling state (pending, slow down, denied, expired).
3300
+ * Lists all Better Auth users from the user table.
5446
3301
  *
5447
- * @param deviceCode - The device code obtained from {@link startDeviceAuthorizationFlow}
5448
- * @returns Access and refresh tokens along with user and organization info
5449
- *
5450
- * @throws {DeviceAuthorizationPendingError} The user hasn't authorized yet — keep polling
5451
- * @throws {DeviceAuthorizationSlowDownError} Polling too fast — increase the interval
5452
- * @throws {DeviceAccessDeniedError} The user denied the request
5453
- * @throws {DeviceCodeExpiredError} The device code has expired
5454
- * @throws {DeviceTransientServerError} Transient server error — safe to retry
5455
- * @throws {ApplicationSessionAssuranceError} Assurance policy changed or is no longer met — start a new flow
3302
+ * @param options - Pagination, search, filter, and ordering options
3303
+ * @returns The paginated user listing
5456
3304
  */
5457
- exchangeDeviceCodeForTokens(deviceCode: string): Promise<CompleteAuthorizationFlowResponse>;
3305
+ listUsers(options?: ListAdminUsersOptions): Promise<{
3306
+ data: null;
3307
+ error: {
3308
+ message?: string | undefined;
3309
+ status: number;
3310
+ statusText: string;
3311
+ };
3312
+ } | {
3313
+ data: ListAdminUsersResult;
3314
+ error: null;
3315
+ }>;
5458
3316
  /**
5459
- * Completes an authorization flow for a specific application.
3317
+ * Fetches a single organization, optionally with adjacent IDs in
3318
+ * the listing defined by the ordering options.
5460
3319
  *
5461
- * @param code - The code to use for the authorization flow
5462
- * @param codeVerifier - The code verifier to use for the authorization flow
3320
+ * @param options - Organization ID and listing adjacency options
3321
+ * @returns The organization
5463
3322
  */
5464
- completeAuthorizationFlow(code: string, codeVerifier: string): Promise<CompleteAuthorizationFlowResponse>;
3323
+ getOrganization(options: GetAdminOrganizationOptions): Promise<{
3324
+ data: AdminOrganization;
3325
+ } | null>;
5465
3326
  /**
5466
- * Refreshes an authentication token for a specific application.
3327
+ * Lists active members for one organization as a global admin.
5467
3328
  *
5468
- * @param refreshToken - The refresh token to use for the authentication token refresh
5469
- * @throws {RefreshTokenExpiredError} When the refresh token has expired or is invalid
5470
- * @throws {ApplicationError} For other API errors
3329
+ * @param options - Organization ID and pagination options
3330
+ * @returns The paginated organization member listing
5471
3331
  */
5472
- refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse | null>;
3332
+ listOrganizationMembers(options: ListAdminOrganizationMembersOptions): Promise<{
3333
+ data: null;
3334
+ error: {
3335
+ message?: string | undefined;
3336
+ status: number;
3337
+ statusText: string;
3338
+ };
3339
+ } | {
3340
+ data: ListAdminOrganizationMembersResult;
3341
+ error: null;
3342
+ }>;
5473
3343
  /**
5474
- * Gets the current user and organization for a specific application.
5475
- *
5476
- * By default, the returned organization does not include its `members`,
5477
- * `teams`, or `invitations` collections. Pass `options.include` to request
5478
- * any of them explicitly.
3344
+ * Creates an organization without adding the creator as a member.
5479
3345
  *
5480
- * @param accessToken - The access token to use for the who am I request
5481
- * @param options - Optional include list controlling which relations are loaded
5482
- * @returns The current user and organization
3346
+ * @param options - Organization name and optional slug, logo, metadata, and settings
3347
+ * @returns The created organization
5483
3348
  */
5484
- whoAmI(accessToken: string, options?: WhoAmIOptions): Promise<WhoAmIResponse>;
3349
+ createOrganization(options: CreateAdminOrganizationOptions): Promise<{
3350
+ data: AdminOrganization;
3351
+ } | null>;
5485
3352
  /**
5486
- * Switches the active organization for the authenticated user.
5487
- *
5488
- * Issues new access and refresh tokens scoped to the specified organization.
5489
- * The target organization must be entitled to the application and the entitlement's
5490
- * access rules must allow the current user.
3353
+ * Updates an organization's profile and settings.
5491
3354
  *
5492
- * @param organizationId - The ID of the organization to switch to
5493
- * @param accessToken - Optional access token for authentication (uses cookie if not provided)
5494
- * @returns New authentication tokens and user/organization details
3355
+ * @param options - Organization ID and the fields to update
3356
+ * @returns The updated organization
5495
3357
  */
5496
- switchOrganization(organizationId: string, accessToken: string): Promise<CompleteAuthorizationFlowResponse>;
3358
+ updateOrganization(options: UpdateAdminOrganizationOptions): Promise<{
3359
+ data: AdminOrganization;
3360
+ } | null>;
5497
3361
  /**
5498
- * Logs out the user by invalidating their refresh token.
5499
- *
5500
- * Revokes the refresh token on the server, preventing further token refreshes
5501
- * and effectively ending the user's session.
5502
- *
5503
- * @param refreshToken - The refresh token to invalidate
3362
+ * Bans a user from the auth system and invalidates all their sessions.
3363
+ * @param userId - The ID of the user to ban
5504
3364
  */
5505
- logout(refreshToken: string): Promise<void>;
3365
+ banUser(userId: string): Promise<void>;
5506
3366
  }
5507
3367
 
5508
3368
  /**
@@ -5590,47 +3450,7 @@ declare class OrganizationService {
5590
3450
  * @param id - The organization ID
5591
3451
  * @returns The organization with members, invitations, and teams
5592
3452
  */
5593
- getOrganization(id: string): Promise<{
5594
- members: {
5595
- id: string;
5596
- organizationId: string;
5597
- role: "org:admin" | "org:member" | "org:reviewer";
5598
- createdAt: Date;
5599
- userId: string;
5600
- teamId?: string | undefined | undefined;
5601
- user: {
5602
- id: string;
5603
- email: string;
5604
- name: string;
5605
- image?: string | undefined;
5606
- };
5607
- }[];
5608
- invitations: {
5609
- id: string;
5610
- organizationId: string;
5611
- email: string;
5612
- role: "org:admin" | "org:member" | "org:reviewer";
5613
- status: better_auth_plugins.InvitationStatus;
5614
- inviterId: string;
5615
- expiresAt: Date;
5616
- createdAt: Date;
5617
- teamId?: string | undefined | undefined;
5618
- }[];
5619
- teams: {
5620
- id: string;
5621
- name: string;
5622
- organizationId: string;
5623
- createdAt: Date;
5624
- updatedAt?: Date | undefined;
5625
- }[];
5626
- } & {
5627
- id: string;
5628
- name: string;
5629
- slug: string;
5630
- createdAt: Date;
5631
- logo?: string | null | undefined | undefined;
5632
- metadata?: any;
5633
- }>;
3453
+ getOrganization(id: string): Promise<any>;
5634
3454
  /**
5635
3455
  * Lists all organizations accessible to the current user.
5636
3456
  *
@@ -5658,63 +3478,13 @@ declare class OrganizationService {
5658
3478
  * @param options.offset - Number of members to skip
5659
3479
  * @returns An array of organization members
5660
3480
  */
5661
- listMembers(options?: ListMembersOptions): Promise<({
5662
- id: string;
5663
- organizationId: string;
5664
- role: "org:admin" | "org:member" | "org:reviewer";
5665
- createdAt: Date;
5666
- userId: string;
5667
- teamId?: string | undefined | undefined;
5668
- user: {
5669
- id: string;
5670
- email: string;
5671
- name: string;
5672
- image?: string | undefined;
5673
- };
5674
- } & {
5675
- user: {
5676
- id: string;
5677
- name: string;
5678
- email: string;
5679
- image: string | null | undefined;
5680
- };
5681
- })[]>;
3481
+ listMembers(options?: ListMembersOptions): Promise<any>;
5682
3482
  /**
5683
3483
  * Gets the currently active organization member for the authenticated user.
5684
3484
  *
5685
3485
  * @returns The active member object
5686
3486
  */
5687
- getActiveMember(): Promise<NonNullable<Omit<{
5688
- id: string;
5689
- organizationId: string;
5690
- role: "org:admin" | "org:member" | "org:reviewer";
5691
- createdAt: Date;
5692
- userId: string;
5693
- teamId?: string | undefined | undefined;
5694
- user: {
5695
- id: string;
5696
- email: string;
5697
- name: string;
5698
- image?: string | undefined;
5699
- };
5700
- } & {
5701
- user: {
5702
- id: string;
5703
- createdAt: Date;
5704
- updatedAt: Date;
5705
- email: string;
5706
- emailVerified: boolean;
5707
- name: string;
5708
- image?: string | null | undefined;
5709
- };
5710
- }, "user"> & {
5711
- user: {
5712
- id: string;
5713
- name: string;
5714
- email: string;
5715
- image: string | undefined;
5716
- };
5717
- }>>;
3487
+ getActiveMember(): Promise<any>;
5718
3488
  /**
5719
3489
  * Invites a user to join the active organization.
5720
3490
  *
@@ -5728,27 +3498,7 @@ declare class OrganizationService {
5728
3498
  * @param options.resend - Whether to resend if invitation already exists
5729
3499
  * @returns The created invitation
5730
3500
  */
5731
- inviteUserToOrganization({ userEmail, role, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
5732
- id: string;
5733
- organizationId: string;
5734
- email: string;
5735
- role: "org:admin" | "org:member" | "org:reviewer";
5736
- status: better_auth_plugins.InvitationStatus;
5737
- inviterId: string;
5738
- expiresAt: Date;
5739
- createdAt: Date;
5740
- teamId?: string | undefined | undefined;
5741
- } | {
5742
- id: string;
5743
- organizationId: string;
5744
- email: string;
5745
- role: "org:admin" | "org:member" | "org:reviewer";
5746
- status: better_auth_plugins.InvitationStatus;
5747
- inviterId: string;
5748
- expiresAt: Date;
5749
- createdAt: Date;
5750
- teamId?: string | undefined | undefined;
5751
- }>>;
3501
+ inviteUserToOrganization({ userEmail, role, teamId, resend }: InviteUserToOrganizationOptions): Promise<any>;
5752
3502
  /**
5753
3503
  * Cancels a pending organization invitation.
5754
3504
  *
@@ -5785,13 +3535,7 @@ declare class OrganizationService {
5785
3535
  * @param payload - Team configuration with a `name` field
5786
3536
  * @returns The created team
5787
3537
  */
5788
- createTeam(payload: CreateTeamPayload): Promise<{
5789
- id: string;
5790
- name: string;
5791
- organizationId: string;
5792
- createdAt: Date;
5793
- updatedAt?: Date | undefined;
5794
- }>;
3538
+ createTeam(payload: CreateTeamPayload): Promise<any>;
5795
3539
  /**
5796
3540
  * Updates an existing team's details.
5797
3541
  *
@@ -5799,13 +3543,7 @@ declare class OrganizationService {
5799
3543
  * @param payload - Team fields to update (currently supports `name`)
5800
3544
  * @returns The updated team
5801
3545
  */
5802
- updateTeam(id: string, payload: UpdateTeamPayload): Promise<{
5803
- id: string;
5804
- name: string;
5805
- organizationId: string;
5806
- createdAt: Date;
5807
- updatedAt?: Date | undefined;
5808
- }>;
3546
+ updateTeam(id: string, payload: UpdateTeamPayload): Promise<any>;
5809
3547
  /**
5810
3548
  * Deletes a team from the active organization.
5811
3549
  *
@@ -5817,25 +3555,14 @@ declare class OrganizationService {
5817
3555
  *
5818
3556
  * @returns An array of teams
5819
3557
  */
5820
- listTeams(): Promise<{
5821
- id: string;
5822
- name: string;
5823
- organizationId: string;
5824
- createdAt: Date;
5825
- updatedAt?: Date | undefined;
5826
- }[]>;
3558
+ listTeams(): Promise<any>;
5827
3559
  /**
5828
3560
  * Lists all members of a specific team.
5829
3561
  *
5830
3562
  * @param id - The team ID
5831
3563
  * @returns An array of team members
5832
3564
  */
5833
- listTeamMembers(id: string): Promise<{
5834
- id: string;
5835
- teamId: string;
5836
- userId: string;
5837
- createdAt: Date;
5838
- }[]>;
3565
+ listTeamMembers(id: string): Promise<any>;
5839
3566
  /**
5840
3567
  * Adds a user to a team.
5841
3568
  *
@@ -5843,12 +3570,7 @@ declare class OrganizationService {
5843
3570
  * @param userId - The user ID to add
5844
3571
  * @returns The added team member
5845
3572
  */
5846
- addTeamMember(teamId: string, userId: string): Promise<{
5847
- id: string;
5848
- teamId: string;
5849
- userId: string;
5850
- createdAt: Date;
5851
- }>;
3573
+ addTeamMember(teamId: string, userId: string): Promise<any>;
5852
3574
  /**
5853
3575
  * Removes a user from a team.
5854
3576
  *
@@ -5954,9 +3676,7 @@ declare class SessionService {
5954
3676
  *
5955
3677
  * @returns The JWT token
5956
3678
  */
5957
- getToken(): Promise<{
5958
- token: string;
5959
- }>;
3679
+ getToken(): Promise<any>;
5960
3680
  /**
5961
3681
  * Initiates social authentication flow with Google or Microsoft.
5962
3682
  *
@@ -6016,9 +3736,7 @@ declare class SessionService {
6016
3736
  * @param nonce - The nonce to retrieve the token for
6017
3737
  * @returns The JWT token for the nonce
6018
3738
  */
6019
- getNoncePayload(nonce: string): Promise<{
6020
- token: string;
6021
- }>;
3739
+ getNoncePayload(nonce: string): Promise<any>;
6022
3740
  }
6023
3741
 
6024
3742
  /**
@@ -6081,9 +3799,7 @@ declare class ApiKeyService {
6081
3799
  *
6082
3800
  * @param id - The API key ID to delete
6083
3801
  */
6084
- deleteApiKey(id: string): Promise<{
6085
- success: boolean;
6086
- }>;
3802
+ deleteApiKey(id: string): Promise<any>;
6087
3803
  }
6088
3804
 
6089
3805
  /**
@@ -6127,9 +3843,7 @@ declare class EmailOTPService {
6127
3843
  * @param options - Request configuration
6128
3844
  * @returns The underlying email OTP API response
6129
3845
  */
6130
- sendVerificationOTP(email: string, options: SendVerificationOTPOptions): Promise<{
6131
- success: boolean;
6132
- }>;
3846
+ sendVerificationOTP(email: string, options: SendVerificationOTPOptions): Promise<any>;
6133
3847
  /**
6134
3848
  * Completes email OTP sign-in with a one-time passcode.
6135
3849
  *
@@ -6138,38 +3852,7 @@ declare class EmailOTPService {
6138
3852
  * @param options - Request configuration
6139
3853
  * @returns The underlying email OTP sign-in API response
6140
3854
  */
6141
- signIn(email: string, otp: string, options: EmailOTPSignInOptions): Promise<Omit<{
6142
- token: string;
6143
- user: {
6144
- id: string;
6145
- createdAt: Date;
6146
- updatedAt: Date;
6147
- email: string;
6148
- emailVerified: boolean;
6149
- name: string;
6150
- image?: string | null | undefined;
6151
- };
6152
- }, "user"> & {
6153
- user: better_auth.StripEmptyObjects<{
6154
- id: string;
6155
- createdAt: Date;
6156
- updatedAt: Date;
6157
- email: string;
6158
- emailVerified: boolean;
6159
- name: string;
6160
- image?: string | null | undefined;
6161
- } & {
6162
- twoFactorEnabled: boolean | null | undefined;
6163
- } & {} & {
6164
- banned: boolean | null | undefined;
6165
- } & {
6166
- role?: string | null | undefined;
6167
- banReason?: string | null | undefined;
6168
- banExpires?: Date | null | undefined;
6169
- } & {} & {
6170
- lastActiveAt?: Date | null | undefined;
6171
- }>;
6172
- }>;
3855
+ signIn(email: string, otp: string, options: EmailOTPSignInOptions): Promise<any>;
6173
3856
  }
6174
3857
 
6175
3858
  /**
@@ -6245,6 +3928,10 @@ declare class AuthClient {
6245
3928
  * Session assurance service for step-up operations
6246
3929
  */
6247
3930
  sessionAssurance: SessionAssuranceService;
3931
+ /**
3932
+ * Admin service for global admin operations
3933
+ */
3934
+ admin: AdminService;
6248
3935
  /**
6249
3936
  * Creates a new AuthClient instance.
6250
3937
  *
@@ -6319,4 +4006,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
6319
4006
  declare function extractTokenPayload(token: string): DecodedJWTPayload;
6320
4007
 
6321
4008
  export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, AuthClient, AuthMethod, AuthMethodBrand, AuthMethods, AuthorizationFlowError, DEFAULT_APPLICATION_CONFIG, DEFAULT_JWT_ASSURANCE, DEFAULT_SESSION_ASSURANCE_CONFIG, DeviceAccessDeniedError, DeviceAuthorizationPendingError, DeviceAuthorizationSlowDownError, DeviceCodeExpiredError, DeviceTransientServerError, EmailOTPService, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, JWTPayload, JWTPayloadAssurance, JWTPayloadUser, JWTPayloadWorkspace, OAuthBeginStepUpResponse, OAuthCompleteStepUpResponse, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, SendOtpResponse, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceResponse, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, createAPIClient, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, organizationAdditionalFields, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
6322
- export type { APIClient, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, CompleteAuthorizationFlowResponse, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
4009
+ export type { APIClient, AdminApplication, AdminApplicationEntitlement, AdminApplicationMember, AdminApplicationOrganization, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberRecord, AdminUser, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminOrganizationOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };