@fluxbase/sdk 0.0.1-rc.115 → 0.0.1-rc.117

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.cts CHANGED
@@ -631,6 +631,30 @@ interface OAuthUrlResponse {
631
631
  url: string;
632
632
  provider: string;
633
633
  }
634
+ /**
635
+ * Options for OAuth logout
636
+ */
637
+ interface OAuthLogoutOptions {
638
+ /** URL to redirect to after logout completes */
639
+ redirect_url?: string;
640
+ }
641
+ /**
642
+ * Response from OAuth logout endpoint
643
+ */
644
+ interface OAuthLogoutResponse {
645
+ /** OAuth provider name */
646
+ provider: string;
647
+ /** Whether local JWT tokens were revoked */
648
+ local_tokens_revoked: boolean;
649
+ /** Whether the token was revoked at the OAuth provider */
650
+ provider_token_revoked: boolean;
651
+ /** Whether the user should be redirected to the provider's logout page */
652
+ requires_redirect?: boolean;
653
+ /** URL to redirect to for OIDC logout (if requires_redirect is true) */
654
+ redirect_url?: string;
655
+ /** Warning message if something failed but logout still proceeded */
656
+ warning?: string;
657
+ }
634
658
  /**
635
659
  * SAML Identity Provider configuration
636
660
  */
@@ -3821,8 +3845,9 @@ declare class FluxbaseAuth {
3821
3845
  * Exchange OAuth authorization code for session
3822
3846
  * This is typically called in your OAuth callback handler
3823
3847
  * @param code - Authorization code from OAuth callback
3848
+ * @param state - State parameter from OAuth callback (for CSRF protection)
3824
3849
  */
3825
- exchangeCodeForSession(code: string): Promise<FluxbaseAuthResponse>;
3850
+ exchangeCodeForSession(code: string, state?: string): Promise<FluxbaseAuthResponse>;
3826
3851
  /**
3827
3852
  * Convenience method to initiate OAuth sign-in
3828
3853
  * Redirects the user to the OAuth provider's authorization page
@@ -3833,6 +3858,39 @@ declare class FluxbaseAuth {
3833
3858
  provider: string;
3834
3859
  url: string;
3835
3860
  }>>;
3861
+ /**
3862
+ * Get OAuth logout URL for a provider
3863
+ * Use this to get the logout URL without automatically redirecting
3864
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
3865
+ * @param options - Optional logout configuration
3866
+ * @returns Promise with OAuth logout response including redirect URL if applicable
3867
+ *
3868
+ * @example
3869
+ * ```typescript
3870
+ * const { data, error } = await client.auth.getOAuthLogoutUrl('google')
3871
+ * if (!error && data.redirect_url) {
3872
+ * // Redirect user to complete logout at provider
3873
+ * window.location.href = data.redirect_url
3874
+ * }
3875
+ * ```
3876
+ */
3877
+ getOAuthLogoutUrl(provider: string, options?: OAuthLogoutOptions): Promise<DataResponse<OAuthLogoutResponse>>;
3878
+ /**
3879
+ * Sign out with OAuth provider logout
3880
+ * Revokes tokens at the OAuth provider and optionally redirects for OIDC logout
3881
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
3882
+ * @param options - Optional logout configuration
3883
+ * @returns Promise with OAuth logout response
3884
+ *
3885
+ * @example
3886
+ * ```typescript
3887
+ * // This will revoke tokens and redirect to provider's logout page if supported
3888
+ * await client.auth.signOutWithOAuth('google', {
3889
+ * redirect_url: 'https://myapp.com/logged-out'
3890
+ * })
3891
+ * ```
3892
+ */
3893
+ signOutWithOAuth(provider: string, options?: OAuthLogoutOptions): Promise<DataResponse<OAuthLogoutResponse>>;
3836
3894
  /**
3837
3895
  * Sign in with OTP (One-Time Password) - Supabase-compatible
3838
3896
  * Sends a one-time password via email or SMS for passwordless authentication
@@ -11325,4 +11383,4 @@ declare function isBoolean(value: unknown): value is boolean;
11325
11383
  */
11326
11384
  declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
11327
11385
 
11328
- export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type Branch, type BranchActivity, type BranchPoolStats, type BranchStatus, type BranchType, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type CaptchaConfig, type CaptchaProvider, type ChatbotSpec, type ChunkedUploadSession, type ClientKey, ClientKeysManager, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateBranchOptions, type CreateClientKeyRequest, type CreateClientKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateMigrationRequest, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DataCloneMode, type DataResponse, type DeleteAPIKeyResponse, type DeleteClientKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailProviderSettings, type EmailSettingOverride, type EmailSettings, EmailSettingsManager, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EmbedRequest, type EmbedResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminStorage, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseBranching, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type GraphQLError, type GraphQLErrorLocation, type GraphQLRequestOptions, type GraphQLResponse, type HealthResponse, type HttpMethod, type ImageFitMode, type ImageFormat, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type IntrospectionDirective, type IntrospectionEnumValue, type IntrospectionField, type IntrospectionInputValue, type IntrospectionSchema, type IntrospectionType, type IntrospectionTypeRef, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListBranchesOptions, type ListBranchesResponse, type ListClientKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeClientKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, type SAMLLoginOptions, type SAMLLoginResponse, type SAMLProvider, type SAMLProvidersResponse, type SAMLSession, type SESSettings, type SMTPSettings, type Schema, SchemaQueryBuilder, type SecuritySettings, type SendEmailRequest, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type SignedUrlResponse, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type StreamDownloadData, type StreamUploadOptions, type SupabaseAuthResponse, type SupabaseResponse, type SyncChatbotsOptions, type SyncChatbotsResult, type SyncError, type SyncFunctionsOptions, type SyncFunctionsResult, type SyncMigrationsOptions, type SyncMigrationsResult, type SyncRPCOptions, type SyncRPCResult, type SystemSetting, SystemSettingsManager, type Table, type TestEmailSettingsResponse, type TestEmailTemplateRequest, type TestWebhookResponse, type TransformOptions, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateClientKeyRequest, type UpdateConversationOptions, type UpdateEmailProviderSettingsRequest, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateMigrationRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateRPCProcedureRequest, type UpdateSystemSettingRequest, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VectorMetric, type VectorOrderOptions, type VectorSearchOptions, type VectorSearchResult, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
11386
+ export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type Branch, type BranchActivity, type BranchPoolStats, type BranchStatus, type BranchType, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type CaptchaConfig, type CaptchaProvider, type ChatbotSpec, type ChunkedUploadSession, type ClientKey, ClientKeysManager, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateBranchOptions, type CreateClientKeyRequest, type CreateClientKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateMigrationRequest, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DataCloneMode, type DataResponse, type DeleteAPIKeyResponse, type DeleteClientKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailProviderSettings, type EmailSettingOverride, type EmailSettings, EmailSettingsManager, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EmbedRequest, type EmbedResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminStorage, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseBranching, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type GraphQLError, type GraphQLErrorLocation, type GraphQLRequestOptions, type GraphQLResponse, type HealthResponse, type HttpMethod, type ImageFitMode, type ImageFormat, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type IntrospectionDirective, type IntrospectionEnumValue, type IntrospectionField, type IntrospectionInputValue, type IntrospectionSchema, type IntrospectionType, type IntrospectionTypeRef, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListBranchesOptions, type ListBranchesResponse, type ListClientKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthLogoutOptions, type OAuthLogoutResponse, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeClientKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, type SAMLLoginOptions, type SAMLLoginResponse, type SAMLProvider, type SAMLProvidersResponse, type SAMLSession, type SESSettings, type SMTPSettings, type Schema, SchemaQueryBuilder, type SecuritySettings, type SendEmailRequest, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type SignedUrlResponse, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type StreamDownloadData, type StreamUploadOptions, type SupabaseAuthResponse, type SupabaseResponse, type SyncChatbotsOptions, type SyncChatbotsResult, type SyncError, type SyncFunctionsOptions, type SyncFunctionsResult, type SyncMigrationsOptions, type SyncMigrationsResult, type SyncRPCOptions, type SyncRPCResult, type SystemSetting, SystemSettingsManager, type Table, type TestEmailSettingsResponse, type TestEmailTemplateRequest, type TestWebhookResponse, type TransformOptions, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateClientKeyRequest, type UpdateConversationOptions, type UpdateEmailProviderSettingsRequest, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateMigrationRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateRPCProcedureRequest, type UpdateSystemSettingRequest, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VectorMetric, type VectorOrderOptions, type VectorSearchOptions, type VectorSearchResult, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
package/dist/index.d.ts CHANGED
@@ -631,6 +631,30 @@ interface OAuthUrlResponse {
631
631
  url: string;
632
632
  provider: string;
633
633
  }
634
+ /**
635
+ * Options for OAuth logout
636
+ */
637
+ interface OAuthLogoutOptions {
638
+ /** URL to redirect to after logout completes */
639
+ redirect_url?: string;
640
+ }
641
+ /**
642
+ * Response from OAuth logout endpoint
643
+ */
644
+ interface OAuthLogoutResponse {
645
+ /** OAuth provider name */
646
+ provider: string;
647
+ /** Whether local JWT tokens were revoked */
648
+ local_tokens_revoked: boolean;
649
+ /** Whether the token was revoked at the OAuth provider */
650
+ provider_token_revoked: boolean;
651
+ /** Whether the user should be redirected to the provider's logout page */
652
+ requires_redirect?: boolean;
653
+ /** URL to redirect to for OIDC logout (if requires_redirect is true) */
654
+ redirect_url?: string;
655
+ /** Warning message if something failed but logout still proceeded */
656
+ warning?: string;
657
+ }
634
658
  /**
635
659
  * SAML Identity Provider configuration
636
660
  */
@@ -3821,8 +3845,9 @@ declare class FluxbaseAuth {
3821
3845
  * Exchange OAuth authorization code for session
3822
3846
  * This is typically called in your OAuth callback handler
3823
3847
  * @param code - Authorization code from OAuth callback
3848
+ * @param state - State parameter from OAuth callback (for CSRF protection)
3824
3849
  */
3825
- exchangeCodeForSession(code: string): Promise<FluxbaseAuthResponse>;
3850
+ exchangeCodeForSession(code: string, state?: string): Promise<FluxbaseAuthResponse>;
3826
3851
  /**
3827
3852
  * Convenience method to initiate OAuth sign-in
3828
3853
  * Redirects the user to the OAuth provider's authorization page
@@ -3833,6 +3858,39 @@ declare class FluxbaseAuth {
3833
3858
  provider: string;
3834
3859
  url: string;
3835
3860
  }>>;
3861
+ /**
3862
+ * Get OAuth logout URL for a provider
3863
+ * Use this to get the logout URL without automatically redirecting
3864
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
3865
+ * @param options - Optional logout configuration
3866
+ * @returns Promise with OAuth logout response including redirect URL if applicable
3867
+ *
3868
+ * @example
3869
+ * ```typescript
3870
+ * const { data, error } = await client.auth.getOAuthLogoutUrl('google')
3871
+ * if (!error && data.redirect_url) {
3872
+ * // Redirect user to complete logout at provider
3873
+ * window.location.href = data.redirect_url
3874
+ * }
3875
+ * ```
3876
+ */
3877
+ getOAuthLogoutUrl(provider: string, options?: OAuthLogoutOptions): Promise<DataResponse<OAuthLogoutResponse>>;
3878
+ /**
3879
+ * Sign out with OAuth provider logout
3880
+ * Revokes tokens at the OAuth provider and optionally redirects for OIDC logout
3881
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
3882
+ * @param options - Optional logout configuration
3883
+ * @returns Promise with OAuth logout response
3884
+ *
3885
+ * @example
3886
+ * ```typescript
3887
+ * // This will revoke tokens and redirect to provider's logout page if supported
3888
+ * await client.auth.signOutWithOAuth('google', {
3889
+ * redirect_url: 'https://myapp.com/logged-out'
3890
+ * })
3891
+ * ```
3892
+ */
3893
+ signOutWithOAuth(provider: string, options?: OAuthLogoutOptions): Promise<DataResponse<OAuthLogoutResponse>>;
3836
3894
  /**
3837
3895
  * Sign in with OTP (One-Time Password) - Supabase-compatible
3838
3896
  * Sends a one-time password via email or SMS for passwordless authentication
@@ -11325,4 +11383,4 @@ declare function isBoolean(value: unknown): value is boolean;
11325
11383
  */
11326
11384
  declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
11327
11385
 
11328
- export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type Branch, type BranchActivity, type BranchPoolStats, type BranchStatus, type BranchType, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type CaptchaConfig, type CaptchaProvider, type ChatbotSpec, type ChunkedUploadSession, type ClientKey, ClientKeysManager, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateBranchOptions, type CreateClientKeyRequest, type CreateClientKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateMigrationRequest, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DataCloneMode, type DataResponse, type DeleteAPIKeyResponse, type DeleteClientKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailProviderSettings, type EmailSettingOverride, type EmailSettings, EmailSettingsManager, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EmbedRequest, type EmbedResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminStorage, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseBranching, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type GraphQLError, type GraphQLErrorLocation, type GraphQLRequestOptions, type GraphQLResponse, type HealthResponse, type HttpMethod, type ImageFitMode, type ImageFormat, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type IntrospectionDirective, type IntrospectionEnumValue, type IntrospectionField, type IntrospectionInputValue, type IntrospectionSchema, type IntrospectionType, type IntrospectionTypeRef, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListBranchesOptions, type ListBranchesResponse, type ListClientKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeClientKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, type SAMLLoginOptions, type SAMLLoginResponse, type SAMLProvider, type SAMLProvidersResponse, type SAMLSession, type SESSettings, type SMTPSettings, type Schema, SchemaQueryBuilder, type SecuritySettings, type SendEmailRequest, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type SignedUrlResponse, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type StreamDownloadData, type StreamUploadOptions, type SupabaseAuthResponse, type SupabaseResponse, type SyncChatbotsOptions, type SyncChatbotsResult, type SyncError, type SyncFunctionsOptions, type SyncFunctionsResult, type SyncMigrationsOptions, type SyncMigrationsResult, type SyncRPCOptions, type SyncRPCResult, type SystemSetting, SystemSettingsManager, type Table, type TestEmailSettingsResponse, type TestEmailTemplateRequest, type TestWebhookResponse, type TransformOptions, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateClientKeyRequest, type UpdateConversationOptions, type UpdateEmailProviderSettingsRequest, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateMigrationRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateRPCProcedureRequest, type UpdateSystemSettingRequest, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VectorMetric, type VectorOrderOptions, type VectorSearchOptions, type VectorSearchResult, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
11386
+ export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type Branch, type BranchActivity, type BranchPoolStats, type BranchStatus, type BranchType, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type CaptchaConfig, type CaptchaProvider, type ChatbotSpec, type ChunkedUploadSession, type ClientKey, ClientKeysManager, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateBranchOptions, type CreateClientKeyRequest, type CreateClientKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateMigrationRequest, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DataCloneMode, type DataResponse, type DeleteAPIKeyResponse, type DeleteClientKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailProviderSettings, type EmailSettingOverride, type EmailSettings, EmailSettingsManager, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EmbedRequest, type EmbedResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminStorage, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseBranching, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type GraphQLError, type GraphQLErrorLocation, type GraphQLRequestOptions, type GraphQLResponse, type HealthResponse, type HttpMethod, type ImageFitMode, type ImageFormat, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type IntrospectionDirective, type IntrospectionEnumValue, type IntrospectionField, type IntrospectionInputValue, type IntrospectionSchema, type IntrospectionType, type IntrospectionTypeRef, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListBranchesOptions, type ListBranchesResponse, type ListClientKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthLogoutOptions, type OAuthLogoutResponse, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeClientKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, type SAMLLoginOptions, type SAMLLoginResponse, type SAMLProvider, type SAMLProvidersResponse, type SAMLSession, type SESSettings, type SMTPSettings, type Schema, SchemaQueryBuilder, type SecuritySettings, type SendEmailRequest, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type SignedUrlResponse, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type StreamDownloadData, type StreamUploadOptions, type SupabaseAuthResponse, type SupabaseResponse, type SyncChatbotsOptions, type SyncChatbotsResult, type SyncError, type SyncFunctionsOptions, type SyncFunctionsResult, type SyncMigrationsOptions, type SyncMigrationsResult, type SyncRPCOptions, type SyncRPCResult, type SystemSetting, SystemSettingsManager, type Table, type TestEmailSettingsResponse, type TestEmailTemplateRequest, type TestWebhookResponse, type TransformOptions, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateClientKeyRequest, type UpdateConversationOptions, type UpdateEmailProviderSettingsRequest, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateMigrationRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateRPCProcedureRequest, type UpdateSystemSettingRequest, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VectorMetric, type VectorOrderOptions, type VectorSearchOptions, type VectorSearchResult, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
package/dist/index.js CHANGED
@@ -331,6 +331,7 @@ async function wrapAsyncVoid(operation) {
331
331
 
332
332
  // src/auth.ts
333
333
  var AUTH_STORAGE_KEY = "fluxbase.auth.session";
334
+ var OAUTH_PROVIDER_KEY = "fluxbase.auth.oauth_provider";
334
335
  var AUTO_REFRESH_TICK_THRESHOLD = 10;
335
336
  var AUTO_REFRESH_TICK_MINIMUM = 1e3;
336
337
  var MAX_REFRESH_RETRIES = 3;
@@ -908,13 +909,24 @@ var FluxbaseAuth = class {
908
909
  * Exchange OAuth authorization code for session
909
910
  * This is typically called in your OAuth callback handler
910
911
  * @param code - Authorization code from OAuth callback
912
+ * @param state - State parameter from OAuth callback (for CSRF protection)
911
913
  */
912
- async exchangeCodeForSession(code) {
914
+ async exchangeCodeForSession(code, state) {
913
915
  return wrapAsync(async () => {
914
- const response = await this.fetch.post(
915
- "/api/v1/auth/oauth/callback",
916
- { code }
916
+ const provider = this.storage?.getItem(OAUTH_PROVIDER_KEY);
917
+ if (!provider) {
918
+ throw new Error(
919
+ "No OAuth provider found. Call signInWithOAuth first."
920
+ );
921
+ }
922
+ const params = new URLSearchParams({ code });
923
+ if (state) {
924
+ params.append("state", state);
925
+ }
926
+ const response = await this.fetch.get(
927
+ `/api/v1/auth/oauth/${provider}/callback?${params.toString()}`
917
928
  );
929
+ this.storage?.removeItem(OAUTH_PROVIDER_KEY);
918
930
  const session = {
919
931
  ...response,
920
932
  expires_at: Date.now() + response.expires_in * 1e3
@@ -937,6 +949,7 @@ var FluxbaseAuth = class {
937
949
  }
938
950
  const url = result.data.url;
939
951
  if (typeof window !== "undefined") {
952
+ this.storage?.setItem(OAUTH_PROVIDER_KEY, provider);
940
953
  window.location.href = url;
941
954
  } else {
942
955
  throw new Error(
@@ -946,6 +959,59 @@ var FluxbaseAuth = class {
946
959
  return { provider, url };
947
960
  });
948
961
  }
962
+ /**
963
+ * Get OAuth logout URL for a provider
964
+ * Use this to get the logout URL without automatically redirecting
965
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
966
+ * @param options - Optional logout configuration
967
+ * @returns Promise with OAuth logout response including redirect URL if applicable
968
+ *
969
+ * @example
970
+ * ```typescript
971
+ * const { data, error } = await client.auth.getOAuthLogoutUrl('google')
972
+ * if (!error && data.redirect_url) {
973
+ * // Redirect user to complete logout at provider
974
+ * window.location.href = data.redirect_url
975
+ * }
976
+ * ```
977
+ */
978
+ async getOAuthLogoutUrl(provider, options) {
979
+ return wrapAsync(async () => {
980
+ const response = await this.fetch.post(
981
+ `/api/v1/auth/oauth/${provider}/logout`,
982
+ options || {}
983
+ );
984
+ this.clearSession();
985
+ return response;
986
+ });
987
+ }
988
+ /**
989
+ * Sign out with OAuth provider logout
990
+ * Revokes tokens at the OAuth provider and optionally redirects for OIDC logout
991
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
992
+ * @param options - Optional logout configuration
993
+ * @returns Promise with OAuth logout response
994
+ *
995
+ * @example
996
+ * ```typescript
997
+ * // This will revoke tokens and redirect to provider's logout page if supported
998
+ * await client.auth.signOutWithOAuth('google', {
999
+ * redirect_url: 'https://myapp.com/logged-out'
1000
+ * })
1001
+ * ```
1002
+ */
1003
+ async signOutWithOAuth(provider, options) {
1004
+ return wrapAsync(async () => {
1005
+ const result = await this.getOAuthLogoutUrl(provider, options);
1006
+ if (result.error) {
1007
+ throw result.error;
1008
+ }
1009
+ if (result.data.requires_redirect && result.data.redirect_url && typeof window !== "undefined") {
1010
+ window.location.href = result.data.redirect_url;
1011
+ }
1012
+ return result.data;
1013
+ });
1014
+ }
949
1015
  /**
950
1016
  * Sign in with OTP (One-Time Password) - Supabase-compatible
951
1017
  * Sends a one-time password via email or SMS for passwordless authentication