@fluxbase/sdk 2026.1.1-rc.12 → 2026.1.1-rc.14
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.cjs +142 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +152 -1
- package/dist/index.d.ts +152 -1
- package/dist/index.js +142 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1066,6 +1066,36 @@ interface SecretSettingMetadata {
|
|
|
1066
1066
|
created_at: string;
|
|
1067
1067
|
updated_at: string;
|
|
1068
1068
|
}
|
|
1069
|
+
/**
|
|
1070
|
+
* A user's non-encrypted setting
|
|
1071
|
+
* These settings are stored per-user and can be read/written via SDK
|
|
1072
|
+
*/
|
|
1073
|
+
interface UserSetting {
|
|
1074
|
+
id: string;
|
|
1075
|
+
key: string;
|
|
1076
|
+
value: Record<string, unknown>;
|
|
1077
|
+
description?: string;
|
|
1078
|
+
user_id: string;
|
|
1079
|
+
created_at: string;
|
|
1080
|
+
updated_at: string;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* A setting with source information (user or system)
|
|
1084
|
+
* Returned when fetching a setting with user -> system fallback
|
|
1085
|
+
*/
|
|
1086
|
+
interface UserSettingWithSource {
|
|
1087
|
+
key: string;
|
|
1088
|
+
value: Record<string, unknown>;
|
|
1089
|
+
/** Where the value came from: "user" = user's own setting, "system" = system default */
|
|
1090
|
+
source: "user" | "system";
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Request to create or update a user setting
|
|
1094
|
+
*/
|
|
1095
|
+
interface CreateUserSettingRequest {
|
|
1096
|
+
value: Record<string, unknown>;
|
|
1097
|
+
description?: string;
|
|
1098
|
+
}
|
|
1069
1099
|
/**
|
|
1070
1100
|
* Authentication settings for the application
|
|
1071
1101
|
*/
|
|
@@ -6091,6 +6121,127 @@ declare class SettingsClient {
|
|
|
6091
6121
|
* ```
|
|
6092
6122
|
*/
|
|
6093
6123
|
deleteSecret(key: string): Promise<void>;
|
|
6124
|
+
/**
|
|
6125
|
+
* Get a setting with user -> system fallback
|
|
6126
|
+
*
|
|
6127
|
+
* First checks for a user-specific setting, then falls back to system default.
|
|
6128
|
+
* Returns both the value and the source ("user" or "system").
|
|
6129
|
+
*
|
|
6130
|
+
* @param key - Setting key (e.g., 'theme', 'notifications.email')
|
|
6131
|
+
* @returns Promise resolving to UserSettingWithSource with value and source
|
|
6132
|
+
* @throws Error if setting doesn't exist in either user or system
|
|
6133
|
+
*
|
|
6134
|
+
* @example
|
|
6135
|
+
* ```typescript
|
|
6136
|
+
* // Get theme with fallback to system default
|
|
6137
|
+
* const { value, source } = await client.settings.getSetting('theme')
|
|
6138
|
+
* console.log(value) // { mode: 'dark' }
|
|
6139
|
+
* console.log(source) // 'system' (from system default)
|
|
6140
|
+
*
|
|
6141
|
+
* // After user sets their own theme
|
|
6142
|
+
* const { value, source } = await client.settings.getSetting('theme')
|
|
6143
|
+
* console.log(source) // 'user' (user's own setting)
|
|
6144
|
+
* ```
|
|
6145
|
+
*/
|
|
6146
|
+
getSetting(key: string): Promise<UserSettingWithSource>;
|
|
6147
|
+
/**
|
|
6148
|
+
* Get only the user's own setting (no fallback to system)
|
|
6149
|
+
*
|
|
6150
|
+
* Returns the user's own setting for this key, or throws if not found.
|
|
6151
|
+
* Use this when you specifically want to check if the user has set a value.
|
|
6152
|
+
*
|
|
6153
|
+
* @param key - Setting key
|
|
6154
|
+
* @returns Promise resolving to UserSetting
|
|
6155
|
+
* @throws Error if user has no setting with this key
|
|
6156
|
+
*
|
|
6157
|
+
* @example
|
|
6158
|
+
* ```typescript
|
|
6159
|
+
* // Check if user has set their own theme
|
|
6160
|
+
* try {
|
|
6161
|
+
* const setting = await client.settings.getUserSetting('theme')
|
|
6162
|
+
* console.log('User theme:', setting.value)
|
|
6163
|
+
* } catch (e) {
|
|
6164
|
+
* console.log('User has not set a theme')
|
|
6165
|
+
* }
|
|
6166
|
+
* ```
|
|
6167
|
+
*/
|
|
6168
|
+
getUserSetting(key: string): Promise<UserSetting>;
|
|
6169
|
+
/**
|
|
6170
|
+
* Get a system-level setting (no user override)
|
|
6171
|
+
*
|
|
6172
|
+
* Returns the system default for this key, ignoring any user-specific value.
|
|
6173
|
+
* Useful for reading default configurations.
|
|
6174
|
+
*
|
|
6175
|
+
* @param key - Setting key
|
|
6176
|
+
* @returns Promise resolving to the setting value
|
|
6177
|
+
* @throws Error if system setting doesn't exist
|
|
6178
|
+
*
|
|
6179
|
+
* @example
|
|
6180
|
+
* ```typescript
|
|
6181
|
+
* // Get system default theme
|
|
6182
|
+
* const { value } = await client.settings.getSystemSetting('theme')
|
|
6183
|
+
* console.log('System default theme:', value)
|
|
6184
|
+
* ```
|
|
6185
|
+
*/
|
|
6186
|
+
getSystemSetting(key: string): Promise<{
|
|
6187
|
+
key: string;
|
|
6188
|
+
value: Record<string, unknown>;
|
|
6189
|
+
}>;
|
|
6190
|
+
/**
|
|
6191
|
+
* Set a user setting (create or update)
|
|
6192
|
+
*
|
|
6193
|
+
* Creates or updates a non-encrypted user setting.
|
|
6194
|
+
* This value will override any system default when using getSetting().
|
|
6195
|
+
*
|
|
6196
|
+
* @param key - Setting key
|
|
6197
|
+
* @param value - Setting value (any JSON-serializable object)
|
|
6198
|
+
* @param options - Optional description
|
|
6199
|
+
* @returns Promise resolving to UserSetting
|
|
6200
|
+
*
|
|
6201
|
+
* @example
|
|
6202
|
+
* ```typescript
|
|
6203
|
+
* // Set user's theme preference
|
|
6204
|
+
* await client.settings.setSetting('theme', { mode: 'dark', accent: 'blue' })
|
|
6205
|
+
*
|
|
6206
|
+
* // Set with description
|
|
6207
|
+
* await client.settings.setSetting('notifications', { email: true, push: false }, {
|
|
6208
|
+
* description: 'User notification preferences'
|
|
6209
|
+
* })
|
|
6210
|
+
* ```
|
|
6211
|
+
*/
|
|
6212
|
+
setSetting(key: string, value: Record<string, unknown>, options?: {
|
|
6213
|
+
description?: string;
|
|
6214
|
+
}): Promise<UserSetting>;
|
|
6215
|
+
/**
|
|
6216
|
+
* List all user's own settings
|
|
6217
|
+
*
|
|
6218
|
+
* Returns all non-encrypted settings the current user has set.
|
|
6219
|
+
* Does not include system defaults.
|
|
6220
|
+
*
|
|
6221
|
+
* @returns Promise resolving to array of UserSetting
|
|
6222
|
+
*
|
|
6223
|
+
* @example
|
|
6224
|
+
* ```typescript
|
|
6225
|
+
* const settings = await client.settings.listSettings()
|
|
6226
|
+
* settings.forEach(s => console.log(s.key, s.value))
|
|
6227
|
+
* ```
|
|
6228
|
+
*/
|
|
6229
|
+
listSettings(): Promise<UserSetting[]>;
|
|
6230
|
+
/**
|
|
6231
|
+
* Delete a user setting
|
|
6232
|
+
*
|
|
6233
|
+
* Removes the user's own setting, reverting to system default (if any).
|
|
6234
|
+
*
|
|
6235
|
+
* @param key - Setting key to delete
|
|
6236
|
+
* @returns Promise<void>
|
|
6237
|
+
*
|
|
6238
|
+
* @example
|
|
6239
|
+
* ```typescript
|
|
6240
|
+
* // Remove user's theme preference, revert to system default
|
|
6241
|
+
* await client.settings.deleteSetting('theme')
|
|
6242
|
+
* ```
|
|
6243
|
+
*/
|
|
6244
|
+
deleteSetting(key: string): Promise<void>;
|
|
6094
6245
|
}
|
|
6095
6246
|
|
|
6096
6247
|
/**
|
|
@@ -11509,4 +11660,4 @@ declare function isBoolean(value: unknown): value is boolean;
|
|
|
11509
11660
|
*/
|
|
11510
11661
|
declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
|
|
11511
11662
|
|
|
11512
|
-
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 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 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 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 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 };
|
|
11663
|
+
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 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 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 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 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 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 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
|
@@ -1066,6 +1066,36 @@ interface SecretSettingMetadata {
|
|
|
1066
1066
|
created_at: string;
|
|
1067
1067
|
updated_at: string;
|
|
1068
1068
|
}
|
|
1069
|
+
/**
|
|
1070
|
+
* A user's non-encrypted setting
|
|
1071
|
+
* These settings are stored per-user and can be read/written via SDK
|
|
1072
|
+
*/
|
|
1073
|
+
interface UserSetting {
|
|
1074
|
+
id: string;
|
|
1075
|
+
key: string;
|
|
1076
|
+
value: Record<string, unknown>;
|
|
1077
|
+
description?: string;
|
|
1078
|
+
user_id: string;
|
|
1079
|
+
created_at: string;
|
|
1080
|
+
updated_at: string;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* A setting with source information (user or system)
|
|
1084
|
+
* Returned when fetching a setting with user -> system fallback
|
|
1085
|
+
*/
|
|
1086
|
+
interface UserSettingWithSource {
|
|
1087
|
+
key: string;
|
|
1088
|
+
value: Record<string, unknown>;
|
|
1089
|
+
/** Where the value came from: "user" = user's own setting, "system" = system default */
|
|
1090
|
+
source: "user" | "system";
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Request to create or update a user setting
|
|
1094
|
+
*/
|
|
1095
|
+
interface CreateUserSettingRequest {
|
|
1096
|
+
value: Record<string, unknown>;
|
|
1097
|
+
description?: string;
|
|
1098
|
+
}
|
|
1069
1099
|
/**
|
|
1070
1100
|
* Authentication settings for the application
|
|
1071
1101
|
*/
|
|
@@ -6091,6 +6121,127 @@ declare class SettingsClient {
|
|
|
6091
6121
|
* ```
|
|
6092
6122
|
*/
|
|
6093
6123
|
deleteSecret(key: string): Promise<void>;
|
|
6124
|
+
/**
|
|
6125
|
+
* Get a setting with user -> system fallback
|
|
6126
|
+
*
|
|
6127
|
+
* First checks for a user-specific setting, then falls back to system default.
|
|
6128
|
+
* Returns both the value and the source ("user" or "system").
|
|
6129
|
+
*
|
|
6130
|
+
* @param key - Setting key (e.g., 'theme', 'notifications.email')
|
|
6131
|
+
* @returns Promise resolving to UserSettingWithSource with value and source
|
|
6132
|
+
* @throws Error if setting doesn't exist in either user or system
|
|
6133
|
+
*
|
|
6134
|
+
* @example
|
|
6135
|
+
* ```typescript
|
|
6136
|
+
* // Get theme with fallback to system default
|
|
6137
|
+
* const { value, source } = await client.settings.getSetting('theme')
|
|
6138
|
+
* console.log(value) // { mode: 'dark' }
|
|
6139
|
+
* console.log(source) // 'system' (from system default)
|
|
6140
|
+
*
|
|
6141
|
+
* // After user sets their own theme
|
|
6142
|
+
* const { value, source } = await client.settings.getSetting('theme')
|
|
6143
|
+
* console.log(source) // 'user' (user's own setting)
|
|
6144
|
+
* ```
|
|
6145
|
+
*/
|
|
6146
|
+
getSetting(key: string): Promise<UserSettingWithSource>;
|
|
6147
|
+
/**
|
|
6148
|
+
* Get only the user's own setting (no fallback to system)
|
|
6149
|
+
*
|
|
6150
|
+
* Returns the user's own setting for this key, or throws if not found.
|
|
6151
|
+
* Use this when you specifically want to check if the user has set a value.
|
|
6152
|
+
*
|
|
6153
|
+
* @param key - Setting key
|
|
6154
|
+
* @returns Promise resolving to UserSetting
|
|
6155
|
+
* @throws Error if user has no setting with this key
|
|
6156
|
+
*
|
|
6157
|
+
* @example
|
|
6158
|
+
* ```typescript
|
|
6159
|
+
* // Check if user has set their own theme
|
|
6160
|
+
* try {
|
|
6161
|
+
* const setting = await client.settings.getUserSetting('theme')
|
|
6162
|
+
* console.log('User theme:', setting.value)
|
|
6163
|
+
* } catch (e) {
|
|
6164
|
+
* console.log('User has not set a theme')
|
|
6165
|
+
* }
|
|
6166
|
+
* ```
|
|
6167
|
+
*/
|
|
6168
|
+
getUserSetting(key: string): Promise<UserSetting>;
|
|
6169
|
+
/**
|
|
6170
|
+
* Get a system-level setting (no user override)
|
|
6171
|
+
*
|
|
6172
|
+
* Returns the system default for this key, ignoring any user-specific value.
|
|
6173
|
+
* Useful for reading default configurations.
|
|
6174
|
+
*
|
|
6175
|
+
* @param key - Setting key
|
|
6176
|
+
* @returns Promise resolving to the setting value
|
|
6177
|
+
* @throws Error if system setting doesn't exist
|
|
6178
|
+
*
|
|
6179
|
+
* @example
|
|
6180
|
+
* ```typescript
|
|
6181
|
+
* // Get system default theme
|
|
6182
|
+
* const { value } = await client.settings.getSystemSetting('theme')
|
|
6183
|
+
* console.log('System default theme:', value)
|
|
6184
|
+
* ```
|
|
6185
|
+
*/
|
|
6186
|
+
getSystemSetting(key: string): Promise<{
|
|
6187
|
+
key: string;
|
|
6188
|
+
value: Record<string, unknown>;
|
|
6189
|
+
}>;
|
|
6190
|
+
/**
|
|
6191
|
+
* Set a user setting (create or update)
|
|
6192
|
+
*
|
|
6193
|
+
* Creates or updates a non-encrypted user setting.
|
|
6194
|
+
* This value will override any system default when using getSetting().
|
|
6195
|
+
*
|
|
6196
|
+
* @param key - Setting key
|
|
6197
|
+
* @param value - Setting value (any JSON-serializable object)
|
|
6198
|
+
* @param options - Optional description
|
|
6199
|
+
* @returns Promise resolving to UserSetting
|
|
6200
|
+
*
|
|
6201
|
+
* @example
|
|
6202
|
+
* ```typescript
|
|
6203
|
+
* // Set user's theme preference
|
|
6204
|
+
* await client.settings.setSetting('theme', { mode: 'dark', accent: 'blue' })
|
|
6205
|
+
*
|
|
6206
|
+
* // Set with description
|
|
6207
|
+
* await client.settings.setSetting('notifications', { email: true, push: false }, {
|
|
6208
|
+
* description: 'User notification preferences'
|
|
6209
|
+
* })
|
|
6210
|
+
* ```
|
|
6211
|
+
*/
|
|
6212
|
+
setSetting(key: string, value: Record<string, unknown>, options?: {
|
|
6213
|
+
description?: string;
|
|
6214
|
+
}): Promise<UserSetting>;
|
|
6215
|
+
/**
|
|
6216
|
+
* List all user's own settings
|
|
6217
|
+
*
|
|
6218
|
+
* Returns all non-encrypted settings the current user has set.
|
|
6219
|
+
* Does not include system defaults.
|
|
6220
|
+
*
|
|
6221
|
+
* @returns Promise resolving to array of UserSetting
|
|
6222
|
+
*
|
|
6223
|
+
* @example
|
|
6224
|
+
* ```typescript
|
|
6225
|
+
* const settings = await client.settings.listSettings()
|
|
6226
|
+
* settings.forEach(s => console.log(s.key, s.value))
|
|
6227
|
+
* ```
|
|
6228
|
+
*/
|
|
6229
|
+
listSettings(): Promise<UserSetting[]>;
|
|
6230
|
+
/**
|
|
6231
|
+
* Delete a user setting
|
|
6232
|
+
*
|
|
6233
|
+
* Removes the user's own setting, reverting to system default (if any).
|
|
6234
|
+
*
|
|
6235
|
+
* @param key - Setting key to delete
|
|
6236
|
+
* @returns Promise<void>
|
|
6237
|
+
*
|
|
6238
|
+
* @example
|
|
6239
|
+
* ```typescript
|
|
6240
|
+
* // Remove user's theme preference, revert to system default
|
|
6241
|
+
* await client.settings.deleteSetting('theme')
|
|
6242
|
+
* ```
|
|
6243
|
+
*/
|
|
6244
|
+
deleteSetting(key: string): Promise<void>;
|
|
6094
6245
|
}
|
|
6095
6246
|
|
|
6096
6247
|
/**
|
|
@@ -11509,4 +11660,4 @@ declare function isBoolean(value: unknown): value is boolean;
|
|
|
11509
11660
|
*/
|
|
11510
11661
|
declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
|
|
11511
11662
|
|
|
11512
|
-
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 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 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 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 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 };
|
|
11663
|
+
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 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 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 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 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 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 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
|
@@ -5032,6 +5032,148 @@ var SettingsClient = class {
|
|
|
5032
5032
|
`/api/v1/settings/secret/${encodeURIComponent(key)}`
|
|
5033
5033
|
);
|
|
5034
5034
|
}
|
|
5035
|
+
// ============================================================================
|
|
5036
|
+
// User Settings (non-encrypted, with system fallback support)
|
|
5037
|
+
// These methods mirror the edge function secrets helper pattern for regular settings
|
|
5038
|
+
// ============================================================================
|
|
5039
|
+
/**
|
|
5040
|
+
* Get a setting with user -> system fallback
|
|
5041
|
+
*
|
|
5042
|
+
* First checks for a user-specific setting, then falls back to system default.
|
|
5043
|
+
* Returns both the value and the source ("user" or "system").
|
|
5044
|
+
*
|
|
5045
|
+
* @param key - Setting key (e.g., 'theme', 'notifications.email')
|
|
5046
|
+
* @returns Promise resolving to UserSettingWithSource with value and source
|
|
5047
|
+
* @throws Error if setting doesn't exist in either user or system
|
|
5048
|
+
*
|
|
5049
|
+
* @example
|
|
5050
|
+
* ```typescript
|
|
5051
|
+
* // Get theme with fallback to system default
|
|
5052
|
+
* const { value, source } = await client.settings.getSetting('theme')
|
|
5053
|
+
* console.log(value) // { mode: 'dark' }
|
|
5054
|
+
* console.log(source) // 'system' (from system default)
|
|
5055
|
+
*
|
|
5056
|
+
* // After user sets their own theme
|
|
5057
|
+
* const { value, source } = await client.settings.getSetting('theme')
|
|
5058
|
+
* console.log(source) // 'user' (user's own setting)
|
|
5059
|
+
* ```
|
|
5060
|
+
*/
|
|
5061
|
+
async getSetting(key) {
|
|
5062
|
+
return await this.fetch.get(
|
|
5063
|
+
`/api/v1/settings/user/${encodeURIComponent(key)}`
|
|
5064
|
+
);
|
|
5065
|
+
}
|
|
5066
|
+
/**
|
|
5067
|
+
* Get only the user's own setting (no fallback to system)
|
|
5068
|
+
*
|
|
5069
|
+
* Returns the user's own setting for this key, or throws if not found.
|
|
5070
|
+
* Use this when you specifically want to check if the user has set a value.
|
|
5071
|
+
*
|
|
5072
|
+
* @param key - Setting key
|
|
5073
|
+
* @returns Promise resolving to UserSetting
|
|
5074
|
+
* @throws Error if user has no setting with this key
|
|
5075
|
+
*
|
|
5076
|
+
* @example
|
|
5077
|
+
* ```typescript
|
|
5078
|
+
* // Check if user has set their own theme
|
|
5079
|
+
* try {
|
|
5080
|
+
* const setting = await client.settings.getUserSetting('theme')
|
|
5081
|
+
* console.log('User theme:', setting.value)
|
|
5082
|
+
* } catch (e) {
|
|
5083
|
+
* console.log('User has not set a theme')
|
|
5084
|
+
* }
|
|
5085
|
+
* ```
|
|
5086
|
+
*/
|
|
5087
|
+
async getUserSetting(key) {
|
|
5088
|
+
return await this.fetch.get(
|
|
5089
|
+
`/api/v1/settings/user/own/${encodeURIComponent(key)}`
|
|
5090
|
+
);
|
|
5091
|
+
}
|
|
5092
|
+
/**
|
|
5093
|
+
* Get a system-level setting (no user override)
|
|
5094
|
+
*
|
|
5095
|
+
* Returns the system default for this key, ignoring any user-specific value.
|
|
5096
|
+
* Useful for reading default configurations.
|
|
5097
|
+
*
|
|
5098
|
+
* @param key - Setting key
|
|
5099
|
+
* @returns Promise resolving to the setting value
|
|
5100
|
+
* @throws Error if system setting doesn't exist
|
|
5101
|
+
*
|
|
5102
|
+
* @example
|
|
5103
|
+
* ```typescript
|
|
5104
|
+
* // Get system default theme
|
|
5105
|
+
* const { value } = await client.settings.getSystemSetting('theme')
|
|
5106
|
+
* console.log('System default theme:', value)
|
|
5107
|
+
* ```
|
|
5108
|
+
*/
|
|
5109
|
+
async getSystemSetting(key) {
|
|
5110
|
+
return await this.fetch.get(`/api/v1/settings/user/system/${encodeURIComponent(key)}`);
|
|
5111
|
+
}
|
|
5112
|
+
/**
|
|
5113
|
+
* Set a user setting (create or update)
|
|
5114
|
+
*
|
|
5115
|
+
* Creates or updates a non-encrypted user setting.
|
|
5116
|
+
* This value will override any system default when using getSetting().
|
|
5117
|
+
*
|
|
5118
|
+
* @param key - Setting key
|
|
5119
|
+
* @param value - Setting value (any JSON-serializable object)
|
|
5120
|
+
* @param options - Optional description
|
|
5121
|
+
* @returns Promise resolving to UserSetting
|
|
5122
|
+
*
|
|
5123
|
+
* @example
|
|
5124
|
+
* ```typescript
|
|
5125
|
+
* // Set user's theme preference
|
|
5126
|
+
* await client.settings.setSetting('theme', { mode: 'dark', accent: 'blue' })
|
|
5127
|
+
*
|
|
5128
|
+
* // Set with description
|
|
5129
|
+
* await client.settings.setSetting('notifications', { email: true, push: false }, {
|
|
5130
|
+
* description: 'User notification preferences'
|
|
5131
|
+
* })
|
|
5132
|
+
* ```
|
|
5133
|
+
*/
|
|
5134
|
+
async setSetting(key, value, options) {
|
|
5135
|
+
return await this.fetch.put(
|
|
5136
|
+
`/api/v1/settings/user/${encodeURIComponent(key)}`,
|
|
5137
|
+
{
|
|
5138
|
+
value,
|
|
5139
|
+
description: options?.description
|
|
5140
|
+
}
|
|
5141
|
+
);
|
|
5142
|
+
}
|
|
5143
|
+
/**
|
|
5144
|
+
* List all user's own settings
|
|
5145
|
+
*
|
|
5146
|
+
* Returns all non-encrypted settings the current user has set.
|
|
5147
|
+
* Does not include system defaults.
|
|
5148
|
+
*
|
|
5149
|
+
* @returns Promise resolving to array of UserSetting
|
|
5150
|
+
*
|
|
5151
|
+
* @example
|
|
5152
|
+
* ```typescript
|
|
5153
|
+
* const settings = await client.settings.listSettings()
|
|
5154
|
+
* settings.forEach(s => console.log(s.key, s.value))
|
|
5155
|
+
* ```
|
|
5156
|
+
*/
|
|
5157
|
+
async listSettings() {
|
|
5158
|
+
return await this.fetch.get("/api/v1/settings/user/list");
|
|
5159
|
+
}
|
|
5160
|
+
/**
|
|
5161
|
+
* Delete a user setting
|
|
5162
|
+
*
|
|
5163
|
+
* Removes the user's own setting, reverting to system default (if any).
|
|
5164
|
+
*
|
|
5165
|
+
* @param key - Setting key to delete
|
|
5166
|
+
* @returns Promise<void>
|
|
5167
|
+
*
|
|
5168
|
+
* @example
|
|
5169
|
+
* ```typescript
|
|
5170
|
+
* // Remove user's theme preference, revert to system default
|
|
5171
|
+
* await client.settings.deleteSetting('theme')
|
|
5172
|
+
* ```
|
|
5173
|
+
*/
|
|
5174
|
+
async deleteSetting(key) {
|
|
5175
|
+
await this.fetch.delete(`/api/v1/settings/user/${encodeURIComponent(key)}`);
|
|
5176
|
+
}
|
|
5035
5177
|
};
|
|
5036
5178
|
|
|
5037
5179
|
// src/ddl.ts
|