@fluxbase/sdk 2026.3.3 → 2026.3.4

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
@@ -670,6 +670,43 @@ interface OAuthLogoutResponse {
670
670
  /** Warning message if something failed but logout still proceeded */
671
671
  warning?: string;
672
672
  }
673
+ /**
674
+ * Response from the provider token endpoint
675
+ * Contains OAuth tokens that can be used to call provider APIs (e.g., Google Drive)
676
+ */
677
+ interface ProviderTokenResponse {
678
+ /** OAuth provider name (e.g., 'google', 'github') */
679
+ provider: string;
680
+ /** Provider access token - use this to call provider APIs */
681
+ access_token: string;
682
+ /** Provider refresh token (may be empty for some providers) */
683
+ refresh_token?: string;
684
+ /** Token expiry timestamp in RFC3339 format */
685
+ token_expiry: string;
686
+ /** Seconds until token expires (0 if already expired) */
687
+ expires_in: number;
688
+ /** OpenID Connect ID token (if available) */
689
+ id_token?: string;
690
+ /** OAuth scopes granted for this token */
691
+ scopes?: string[];
692
+ /** Token type (always 'Bearer') */
693
+ token_type: string;
694
+ }
695
+ /**
696
+ * Error response when provider token is not found
697
+ */
698
+ interface ProviderTokenNotFoundError {
699
+ /** Error message */
700
+ error: string;
701
+ /** Error code for programmatic handling */
702
+ error_code: "oauth_token_not_found";
703
+ /** Hint for resolving the error */
704
+ error_hint: string;
705
+ /** Provider name */
706
+ provider: string;
707
+ /** URL to initiate OAuth flow for this provider */
708
+ authorize_url: string;
709
+ }
673
710
  /**
674
711
  * SAML Identity Provider configuration
675
712
  */
@@ -4390,6 +4427,54 @@ declare class FluxbaseAuth {
4390
4427
  * ```
4391
4428
  */
4392
4429
  signOutWithOAuth(provider: string, options?: OAuthLogoutOptions): Promise<DataResponse<OAuthLogoutResponse>>;
4430
+ /**
4431
+ * Get provider OAuth tokens for calling external APIs
4432
+ *
4433
+ * Retrieves the stored OAuth tokens for a provider (e.g., Google, GitHub) that
4434
+ * the user has previously authenticated with. Use these tokens to call provider
4435
+ * APIs directly (e.g., Google Drive API).
4436
+ *
4437
+ * The access_token is automatically refreshed if it has expired or is about to expire.
4438
+ *
4439
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
4440
+ * @returns Promise with provider tokens (access_token, refresh_token, etc.)
4441
+ *
4442
+ * @example
4443
+ * ```typescript
4444
+ * // Get Google tokens to call Google Drive API
4445
+ * const { data, error } = await client.auth.getProviderToken('google')
4446
+ *
4447
+ * if (error) {
4448
+ * if (error.error_code === 'oauth_token_not_found') {
4449
+ * // User needs to sign in with Google first
4450
+ * window.location.href = error.authorize_url
4451
+ * }
4452
+ * return
4453
+ * }
4454
+ *
4455
+ * // Use the access token to call Google Drive API
4456
+ * const response = await fetch('https://www.googleapis.com/drive/v3/files', {
4457
+ * headers: {
4458
+ * 'Authorization': `Bearer ${data.access_token}`
4459
+ * }
4460
+ * })
4461
+ * const files = await response.json()
4462
+ * ```
4463
+ *
4464
+ * @example
4465
+ * ```typescript
4466
+ * // Check token expiry before making API calls
4467
+ * const { data } = await client.auth.getProviderToken('google')
4468
+ *
4469
+ * if (data.expires_in < 60) {
4470
+ * console.warn('Token expires soon, consider caching and refreshing')
4471
+ * }
4472
+ *
4473
+ * // Token expiry is also available as ISO timestamp
4474
+ * console.log('Token expires at:', data.token_expiry)
4475
+ * ```
4476
+ */
4477
+ getProviderToken(provider: string): Promise<DataResponse<ProviderTokenResponse>>;
4393
4478
  /**
4394
4479
  * Sign in with OTP (One-Time Password) - Supabase-compatible
4395
4480
  * Sends a one-time password via email or SMS for passwordless authentication
@@ -13013,4 +13098,4 @@ declare function isBoolean(value: unknown): value is boolean;
13013
13098
  */
13014
13099
  declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
13015
13100
 
13016
- export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotLookupResponse, 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 AuthConfig, 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 CreateSecretRequest, type CreateTableExportSyncConfig, type CreateTableRequest, type CreateTableResponse, type CreateUserSettingRequest, 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 EnableRealtimeRequest, type EnableRealtimeResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type ExportTableOptions, type ExportTableResult, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminRealtime, 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 ListRealtimeTablesResponse, type ListSchemasResponse, type ListSecretsOptions, 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 OAuthProviderPublic, 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 RealtimeTableStatus, 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 Secret, type SecretByNameOptions, type SecretStats, type SecretSummary, type SecretVersion, SecretsManager, 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 TableColumn, type TableDetails, type TableExportSyncConfig, type TableForeignKey, type TableIndex, 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 UpdateRealtimeConfigRequest, type UpdateSecretRequest, type UpdateSystemSettingRequest, type UpdateTableExportSyncConfig, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type UserSetting, type UserSettingWithSource, 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 };
13101
+ export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotLookupResponse, 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 AuthConfig, 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 CreateSecretRequest, type CreateTableExportSyncConfig, type CreateTableRequest, type CreateTableResponse, type CreateUserSettingRequest, 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 EnableRealtimeRequest, type EnableRealtimeResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type ExportTableOptions, type ExportTableResult, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminRealtime, 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 ListRealtimeTablesResponse, type ListSchemasResponse, type ListSecretsOptions, 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 OAuthProviderPublic, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, type ProviderTokenNotFoundError, type ProviderTokenResponse, 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 RealtimeTableStatus, 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 Secret, type SecretByNameOptions, type SecretStats, type SecretSummary, type SecretVersion, SecretsManager, 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 TableColumn, type TableDetails, type TableExportSyncConfig, type TableForeignKey, type TableIndex, 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 UpdateRealtimeConfigRequest, type UpdateSecretRequest, type UpdateSystemSettingRequest, type UpdateTableExportSyncConfig, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type UserSetting, type UserSettingWithSource, 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
@@ -670,6 +670,43 @@ interface OAuthLogoutResponse {
670
670
  /** Warning message if something failed but logout still proceeded */
671
671
  warning?: string;
672
672
  }
673
+ /**
674
+ * Response from the provider token endpoint
675
+ * Contains OAuth tokens that can be used to call provider APIs (e.g., Google Drive)
676
+ */
677
+ interface ProviderTokenResponse {
678
+ /** OAuth provider name (e.g., 'google', 'github') */
679
+ provider: string;
680
+ /** Provider access token - use this to call provider APIs */
681
+ access_token: string;
682
+ /** Provider refresh token (may be empty for some providers) */
683
+ refresh_token?: string;
684
+ /** Token expiry timestamp in RFC3339 format */
685
+ token_expiry: string;
686
+ /** Seconds until token expires (0 if already expired) */
687
+ expires_in: number;
688
+ /** OpenID Connect ID token (if available) */
689
+ id_token?: string;
690
+ /** OAuth scopes granted for this token */
691
+ scopes?: string[];
692
+ /** Token type (always 'Bearer') */
693
+ token_type: string;
694
+ }
695
+ /**
696
+ * Error response when provider token is not found
697
+ */
698
+ interface ProviderTokenNotFoundError {
699
+ /** Error message */
700
+ error: string;
701
+ /** Error code for programmatic handling */
702
+ error_code: "oauth_token_not_found";
703
+ /** Hint for resolving the error */
704
+ error_hint: string;
705
+ /** Provider name */
706
+ provider: string;
707
+ /** URL to initiate OAuth flow for this provider */
708
+ authorize_url: string;
709
+ }
673
710
  /**
674
711
  * SAML Identity Provider configuration
675
712
  */
@@ -4390,6 +4427,54 @@ declare class FluxbaseAuth {
4390
4427
  * ```
4391
4428
  */
4392
4429
  signOutWithOAuth(provider: string, options?: OAuthLogoutOptions): Promise<DataResponse<OAuthLogoutResponse>>;
4430
+ /**
4431
+ * Get provider OAuth tokens for calling external APIs
4432
+ *
4433
+ * Retrieves the stored OAuth tokens for a provider (e.g., Google, GitHub) that
4434
+ * the user has previously authenticated with. Use these tokens to call provider
4435
+ * APIs directly (e.g., Google Drive API).
4436
+ *
4437
+ * The access_token is automatically refreshed if it has expired or is about to expire.
4438
+ *
4439
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
4440
+ * @returns Promise with provider tokens (access_token, refresh_token, etc.)
4441
+ *
4442
+ * @example
4443
+ * ```typescript
4444
+ * // Get Google tokens to call Google Drive API
4445
+ * const { data, error } = await client.auth.getProviderToken('google')
4446
+ *
4447
+ * if (error) {
4448
+ * if (error.error_code === 'oauth_token_not_found') {
4449
+ * // User needs to sign in with Google first
4450
+ * window.location.href = error.authorize_url
4451
+ * }
4452
+ * return
4453
+ * }
4454
+ *
4455
+ * // Use the access token to call Google Drive API
4456
+ * const response = await fetch('https://www.googleapis.com/drive/v3/files', {
4457
+ * headers: {
4458
+ * 'Authorization': `Bearer ${data.access_token}`
4459
+ * }
4460
+ * })
4461
+ * const files = await response.json()
4462
+ * ```
4463
+ *
4464
+ * @example
4465
+ * ```typescript
4466
+ * // Check token expiry before making API calls
4467
+ * const { data } = await client.auth.getProviderToken('google')
4468
+ *
4469
+ * if (data.expires_in < 60) {
4470
+ * console.warn('Token expires soon, consider caching and refreshing')
4471
+ * }
4472
+ *
4473
+ * // Token expiry is also available as ISO timestamp
4474
+ * console.log('Token expires at:', data.token_expiry)
4475
+ * ```
4476
+ */
4477
+ getProviderToken(provider: string): Promise<DataResponse<ProviderTokenResponse>>;
4393
4478
  /**
4394
4479
  * Sign in with OTP (One-Time Password) - Supabase-compatible
4395
4480
  * Sends a one-time password via email or SMS for passwordless authentication
@@ -13013,4 +13098,4 @@ declare function isBoolean(value: unknown): value is boolean;
13013
13098
  */
13014
13099
  declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
13015
13100
 
13016
- export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotLookupResponse, 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 AuthConfig, 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 CreateSecretRequest, type CreateTableExportSyncConfig, type CreateTableRequest, type CreateTableResponse, type CreateUserSettingRequest, 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 EnableRealtimeRequest, type EnableRealtimeResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type ExportTableOptions, type ExportTableResult, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminRealtime, 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 ListRealtimeTablesResponse, type ListSchemasResponse, type ListSecretsOptions, 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 OAuthProviderPublic, 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 RealtimeTableStatus, 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 Secret, type SecretByNameOptions, type SecretStats, type SecretSummary, type SecretVersion, SecretsManager, 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 TableColumn, type TableDetails, type TableExportSyncConfig, type TableForeignKey, type TableIndex, 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 UpdateRealtimeConfigRequest, type UpdateSecretRequest, type UpdateSystemSettingRequest, type UpdateTableExportSyncConfig, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type UserSetting, type UserSettingWithSource, 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 };
13101
+ export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotLookupResponse, 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 AuthConfig, 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 CreateSecretRequest, type CreateTableExportSyncConfig, type CreateTableRequest, type CreateTableResponse, type CreateUserSettingRequest, 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 EnableRealtimeRequest, type EnableRealtimeResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type ExportTableOptions, type ExportTableResult, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminRealtime, 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 ListRealtimeTablesResponse, type ListSchemasResponse, type ListSecretsOptions, 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 OAuthProviderPublic, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, type ProviderTokenNotFoundError, type ProviderTokenResponse, 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 RealtimeTableStatus, 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 Secret, type SecretByNameOptions, type SecretStats, type SecretSummary, type SecretVersion, SecretsManager, 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 TableColumn, type TableDetails, type TableExportSyncConfig, type TableForeignKey, type TableIndex, 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 UpdateRealtimeConfigRequest, type UpdateSecretRequest, type UpdateSystemSettingRequest, type UpdateTableExportSyncConfig, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type UserSetting, type UserSettingWithSource, 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
@@ -1124,6 +1124,63 @@ var FluxbaseAuth = class {
1124
1124
  return result.data;
1125
1125
  });
1126
1126
  }
1127
+ /**
1128
+ * Get provider OAuth tokens for calling external APIs
1129
+ *
1130
+ * Retrieves the stored OAuth tokens for a provider (e.g., Google, GitHub) that
1131
+ * the user has previously authenticated with. Use these tokens to call provider
1132
+ * APIs directly (e.g., Google Drive API).
1133
+ *
1134
+ * The access_token is automatically refreshed if it has expired or is about to expire.
1135
+ *
1136
+ * @param provider - OAuth provider name (e.g., 'google', 'github')
1137
+ * @returns Promise with provider tokens (access_token, refresh_token, etc.)
1138
+ *
1139
+ * @example
1140
+ * ```typescript
1141
+ * // Get Google tokens to call Google Drive API
1142
+ * const { data, error } = await client.auth.getProviderToken('google')
1143
+ *
1144
+ * if (error) {
1145
+ * if (error.error_code === 'oauth_token_not_found') {
1146
+ * // User needs to sign in with Google first
1147
+ * window.location.href = error.authorize_url
1148
+ * }
1149
+ * return
1150
+ * }
1151
+ *
1152
+ * // Use the access token to call Google Drive API
1153
+ * const response = await fetch('https://www.googleapis.com/drive/v3/files', {
1154
+ * headers: {
1155
+ * 'Authorization': `Bearer ${data.access_token}`
1156
+ * }
1157
+ * })
1158
+ * const files = await response.json()
1159
+ * ```
1160
+ *
1161
+ * @example
1162
+ * ```typescript
1163
+ * // Check token expiry before making API calls
1164
+ * const { data } = await client.auth.getProviderToken('google')
1165
+ *
1166
+ * if (data.expires_in < 60) {
1167
+ * console.warn('Token expires soon, consider caching and refreshing')
1168
+ * }
1169
+ *
1170
+ * // Token expiry is also available as ISO timestamp
1171
+ * console.log('Token expires at:', data.token_expiry)
1172
+ * ```
1173
+ */
1174
+ async getProviderToken(provider) {
1175
+ return wrapAsync(async () => {
1176
+ if (!this.session) {
1177
+ throw new Error("Not authenticated");
1178
+ }
1179
+ return await this.fetch.get(
1180
+ `/api/v1/auth/oauth/${provider}/token`
1181
+ );
1182
+ });
1183
+ }
1127
1184
  /**
1128
1185
  * Sign in with OTP (One-Time Password) - Supabase-compatible
1129
1186
  * Sends a one-time password via email or SMS for passwordless authentication