@fluxbase/sdk 0.0.1-rc.81 → 0.0.1-rc.83
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 +75 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +201 -26
- package/dist/index.d.ts +201 -26
- package/dist/index.js +64 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -248,8 +248,8 @@ interface RealtimeMessage {
|
|
|
248
248
|
payload?: unknown;
|
|
249
249
|
error?: string;
|
|
250
250
|
config?: PostgresChangesConfig;
|
|
251
|
-
presence?:
|
|
252
|
-
broadcast?:
|
|
251
|
+
presence?: unknown;
|
|
252
|
+
broadcast?: unknown;
|
|
253
253
|
messageId?: string;
|
|
254
254
|
status?: string;
|
|
255
255
|
subscription_id?: string;
|
|
@@ -265,7 +265,7 @@ interface PostgresChangesConfig {
|
|
|
265
265
|
* Realtime postgres_changes payload structure
|
|
266
266
|
* Compatible with Supabase realtime payloads
|
|
267
267
|
*/
|
|
268
|
-
interface RealtimePostgresChangesPayload<T =
|
|
268
|
+
interface RealtimePostgresChangesPayload<T = unknown> {
|
|
269
269
|
/** Event type (Supabase-compatible field name) */
|
|
270
270
|
eventType: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
271
271
|
/** Database schema */
|
|
@@ -314,7 +314,7 @@ interface RealtimeChannelConfig {
|
|
|
314
314
|
* Presence state for a user
|
|
315
315
|
*/
|
|
316
316
|
interface PresenceState {
|
|
317
|
-
[key: string]:
|
|
317
|
+
[key: string]: unknown;
|
|
318
318
|
}
|
|
319
319
|
/**
|
|
320
320
|
* Realtime presence payload structure
|
|
@@ -336,14 +336,14 @@ type PresenceCallback = (payload: RealtimePresencePayload) => void;
|
|
|
336
336
|
interface BroadcastMessage {
|
|
337
337
|
type: 'broadcast';
|
|
338
338
|
event: string;
|
|
339
|
-
payload:
|
|
339
|
+
payload: unknown;
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
342
|
* Realtime broadcast payload structure
|
|
343
343
|
*/
|
|
344
344
|
interface RealtimeBroadcastPayload {
|
|
345
345
|
event: string;
|
|
346
|
-
payload:
|
|
346
|
+
payload: unknown;
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Broadcast callback type
|
|
@@ -361,7 +361,7 @@ interface FileObject {
|
|
|
361
361
|
created_at?: string;
|
|
362
362
|
updated_at?: string;
|
|
363
363
|
last_accessed_at?: string;
|
|
364
|
-
metadata?: Record<string,
|
|
364
|
+
metadata?: Record<string, unknown>;
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* @deprecated Use FileObject instead. This alias is provided for backwards compatibility.
|
|
@@ -629,7 +629,7 @@ interface SignInWithOtpCredentials {
|
|
|
629
629
|
options?: {
|
|
630
630
|
emailRedirectTo?: string;
|
|
631
631
|
shouldCreateUser?: boolean;
|
|
632
|
-
data?: Record<string,
|
|
632
|
+
data?: Record<string, unknown>;
|
|
633
633
|
captchaToken?: string;
|
|
634
634
|
};
|
|
635
635
|
}
|
|
@@ -660,7 +660,7 @@ interface OTPResponse {
|
|
|
660
660
|
interface UserIdentity {
|
|
661
661
|
id: string;
|
|
662
662
|
user_id: string;
|
|
663
|
-
identity_data?: Record<string,
|
|
663
|
+
identity_data?: Record<string, unknown>;
|
|
664
664
|
provider: string;
|
|
665
665
|
created_at: string;
|
|
666
666
|
updated_at: string;
|
|
@@ -741,7 +741,7 @@ interface EnrichedUser {
|
|
|
741
741
|
last_login_at?: string;
|
|
742
742
|
session_count?: number;
|
|
743
743
|
is_anonymous?: boolean;
|
|
744
|
-
metadata?: Record<string,
|
|
744
|
+
metadata?: Record<string, unknown>;
|
|
745
745
|
}
|
|
746
746
|
interface ListUsersResponse {
|
|
747
747
|
users: EnrichedUser[];
|
|
@@ -850,7 +850,7 @@ interface WebhookDelivery {
|
|
|
850
850
|
id: string;
|
|
851
851
|
webhook_id: string;
|
|
852
852
|
event: string;
|
|
853
|
-
payload: Record<string,
|
|
853
|
+
payload: Record<string, unknown>;
|
|
854
854
|
status_code?: number;
|
|
855
855
|
response_body?: string;
|
|
856
856
|
error?: string;
|
|
@@ -1426,7 +1426,7 @@ interface FunctionInvokeOptions {
|
|
|
1426
1426
|
/**
|
|
1427
1427
|
* Request body to send to the function
|
|
1428
1428
|
*/
|
|
1429
|
-
body?:
|
|
1429
|
+
body?: unknown;
|
|
1430
1430
|
/**
|
|
1431
1431
|
* Custom headers to include in the request
|
|
1432
1432
|
*/
|
|
@@ -1674,8 +1674,8 @@ interface Job {
|
|
|
1674
1674
|
job_function_id?: string;
|
|
1675
1675
|
job_name: string;
|
|
1676
1676
|
status: JobStatus;
|
|
1677
|
-
payload?:
|
|
1678
|
-
result?:
|
|
1677
|
+
payload?: unknown;
|
|
1678
|
+
result?: unknown;
|
|
1679
1679
|
error?: string;
|
|
1680
1680
|
logs?: string;
|
|
1681
1681
|
priority: number;
|
|
@@ -1683,7 +1683,7 @@ interface Job {
|
|
|
1683
1683
|
progress_timeout_seconds?: number;
|
|
1684
1684
|
progress_percent?: number;
|
|
1685
1685
|
progress_message?: string;
|
|
1686
|
-
progress_data?:
|
|
1686
|
+
progress_data?: unknown;
|
|
1687
1687
|
max_retries: number;
|
|
1688
1688
|
retry_count: number;
|
|
1689
1689
|
worker_id?: string;
|
|
@@ -1931,6 +1931,7 @@ interface AIProvider {
|
|
|
1931
1931
|
}
|
|
1932
1932
|
/**
|
|
1933
1933
|
* Request to create an AI provider
|
|
1934
|
+
* Note: config values can be strings, numbers, or booleans - they will be converted to strings automatically
|
|
1934
1935
|
*/
|
|
1935
1936
|
interface CreateAIProviderRequest {
|
|
1936
1937
|
name: string;
|
|
@@ -1938,14 +1939,15 @@ interface CreateAIProviderRequest {
|
|
|
1938
1939
|
provider_type: AIProviderType;
|
|
1939
1940
|
is_default?: boolean;
|
|
1940
1941
|
enabled?: boolean;
|
|
1941
|
-
config: Record<string, string>;
|
|
1942
|
+
config: Record<string, string | number | boolean>;
|
|
1942
1943
|
}
|
|
1943
1944
|
/**
|
|
1944
1945
|
* Request to update an AI provider
|
|
1946
|
+
* Note: config values can be strings, numbers, or booleans - they will be converted to strings automatically
|
|
1945
1947
|
*/
|
|
1946
1948
|
interface UpdateAIProviderRequest {
|
|
1947
1949
|
display_name?: string;
|
|
1948
|
-
config?: Record<string, string>;
|
|
1950
|
+
config?: Record<string, string | number | boolean>;
|
|
1949
1951
|
enabled?: boolean;
|
|
1950
1952
|
}
|
|
1951
1953
|
/**
|
|
@@ -2069,7 +2071,7 @@ interface AIChatServerMessage {
|
|
|
2069
2071
|
query?: string;
|
|
2070
2072
|
summary?: string;
|
|
2071
2073
|
row_count?: number;
|
|
2072
|
-
data?: Record<string,
|
|
2074
|
+
data?: Record<string, unknown>[];
|
|
2073
2075
|
usage?: AIUsageStats;
|
|
2074
2076
|
error?: string;
|
|
2075
2077
|
code?: string;
|
|
@@ -3994,7 +3996,7 @@ declare class FluxbaseFunctions {
|
|
|
3994
3996
|
* })
|
|
3995
3997
|
* ```
|
|
3996
3998
|
*/
|
|
3997
|
-
invoke<T =
|
|
3999
|
+
invoke<T = unknown>(functionName: string, options?: FunctionInvokeOptions): Promise<{
|
|
3998
4000
|
data: T | null;
|
|
3999
4001
|
error: Error | null;
|
|
4000
4002
|
}>;
|
|
@@ -4107,7 +4109,7 @@ declare class FluxbaseJobs {
|
|
|
4107
4109
|
* })
|
|
4108
4110
|
* ```
|
|
4109
4111
|
*/
|
|
4110
|
-
submit(jobName: string, payload?:
|
|
4112
|
+
submit(jobName: string, payload?: unknown, options?: {
|
|
4111
4113
|
priority?: number;
|
|
4112
4114
|
namespace?: string;
|
|
4113
4115
|
scheduled?: string;
|
|
@@ -9455,7 +9457,7 @@ declare class SchemaQueryBuilder {
|
|
|
9455
9457
|
* @param table - The table name (without schema prefix)
|
|
9456
9458
|
* @returns A query builder instance for constructing and executing queries
|
|
9457
9459
|
*/
|
|
9458
|
-
from<T =
|
|
9460
|
+
from<T = unknown>(table: string): QueryBuilder<T>;
|
|
9459
9461
|
}
|
|
9460
9462
|
|
|
9461
9463
|
/**
|
|
@@ -9476,7 +9478,7 @@ type CallableRPC = {
|
|
|
9476
9478
|
* const { data, error } = await client.rpc('get_user_orders', { user_id: '123' })
|
|
9477
9479
|
* ```
|
|
9478
9480
|
*/
|
|
9479
|
-
<T =
|
|
9481
|
+
<T = unknown>(fn: string, params?: Record<string, unknown>): Promise<{
|
|
9480
9482
|
data: T | null;
|
|
9481
9483
|
error: Error | null;
|
|
9482
9484
|
}>;
|
|
@@ -9485,7 +9487,7 @@ type CallableRPC = {
|
|
|
9485
9487
|
* Main Fluxbase client class
|
|
9486
9488
|
* @category Client
|
|
9487
9489
|
*/
|
|
9488
|
-
declare class FluxbaseClient<Database =
|
|
9490
|
+
declare class FluxbaseClient<Database = unknown, _SchemaName extends string & keyof Database = string & keyof Database> {
|
|
9489
9491
|
protected fluxbaseUrl: string;
|
|
9490
9492
|
protected fluxbaseKey: string;
|
|
9491
9493
|
/** Internal HTTP client for making requests */
|
|
@@ -9600,7 +9602,7 @@ declare class FluxbaseClient<Database = any, _SchemaName extends string & keyof
|
|
|
9600
9602
|
*
|
|
9601
9603
|
* @category Database
|
|
9602
9604
|
*/
|
|
9603
|
-
from<T =
|
|
9605
|
+
from<T = unknown>(table: string): QueryBuilder<T>;
|
|
9604
9606
|
/**
|
|
9605
9607
|
* Access a specific database schema
|
|
9606
9608
|
*
|
|
@@ -9756,6 +9758,179 @@ declare class FluxbaseClient<Database = any, _SchemaName extends string & keyof
|
|
|
9756
9758
|
*
|
|
9757
9759
|
* @category Client
|
|
9758
9760
|
*/
|
|
9759
|
-
declare function createClient<Database =
|
|
9761
|
+
declare function createClient<Database = unknown, SchemaName extends string & keyof Database = string & keyof Database>(fluxbaseUrl?: string, fluxbaseKey?: string, options?: FluxbaseClientOptions): FluxbaseClient<Database, SchemaName>;
|
|
9762
|
+
|
|
9763
|
+
/**
|
|
9764
|
+
* Type guard utilities for Fluxbase SDK
|
|
9765
|
+
* Provides runtime type checking and type narrowing for response types
|
|
9766
|
+
*/
|
|
9767
|
+
|
|
9768
|
+
/**
|
|
9769
|
+
* Type guard to check if a FluxbaseResponse is an error response
|
|
9770
|
+
*
|
|
9771
|
+
* @param response - The response to check
|
|
9772
|
+
* @returns true if the response is an error (data is null, error is not null)
|
|
9773
|
+
*
|
|
9774
|
+
* @example
|
|
9775
|
+
* ```typescript
|
|
9776
|
+
* const result = await client.auth.signIn(credentials)
|
|
9777
|
+
*
|
|
9778
|
+
* if (isFluxbaseError(result)) {
|
|
9779
|
+
* // TypeScript knows: result.error is Error, result.data is null
|
|
9780
|
+
* console.error('Sign in failed:', result.error.message)
|
|
9781
|
+
* return
|
|
9782
|
+
* }
|
|
9783
|
+
*
|
|
9784
|
+
* // TypeScript knows: result.data is T, result.error is null
|
|
9785
|
+
* console.log('Signed in as:', result.data.user.email)
|
|
9786
|
+
* ```
|
|
9787
|
+
*/
|
|
9788
|
+
declare function isFluxbaseError<T>(response: FluxbaseResponse<T>): response is {
|
|
9789
|
+
data: null;
|
|
9790
|
+
error: Error;
|
|
9791
|
+
};
|
|
9792
|
+
/**
|
|
9793
|
+
* Type guard to check if a FluxbaseResponse is a success response
|
|
9794
|
+
*
|
|
9795
|
+
* @param response - The response to check
|
|
9796
|
+
* @returns true if the response is successful (data is not null, error is null)
|
|
9797
|
+
*
|
|
9798
|
+
* @example
|
|
9799
|
+
* ```typescript
|
|
9800
|
+
* const result = await client.from('users').select('*').execute()
|
|
9801
|
+
*
|
|
9802
|
+
* if (isFluxbaseSuccess(result)) {
|
|
9803
|
+
* // TypeScript knows: result.data is T, result.error is null
|
|
9804
|
+
* result.data.forEach(user => console.log(user.name))
|
|
9805
|
+
* }
|
|
9806
|
+
* ```
|
|
9807
|
+
*/
|
|
9808
|
+
declare function isFluxbaseSuccess<T>(response: FluxbaseResponse<T>): response is {
|
|
9809
|
+
data: T;
|
|
9810
|
+
error: null;
|
|
9811
|
+
};
|
|
9812
|
+
/**
|
|
9813
|
+
* Type guard to check if an auth response is an error
|
|
9814
|
+
*
|
|
9815
|
+
* @param response - The auth response to check
|
|
9816
|
+
* @returns true if the auth operation failed
|
|
9817
|
+
*
|
|
9818
|
+
* @example
|
|
9819
|
+
* ```typescript
|
|
9820
|
+
* const result = await client.auth.signUp(credentials)
|
|
9821
|
+
*
|
|
9822
|
+
* if (isAuthError(result)) {
|
|
9823
|
+
* console.error('Sign up failed:', result.error.message)
|
|
9824
|
+
* return
|
|
9825
|
+
* }
|
|
9826
|
+
*
|
|
9827
|
+
* // TypeScript knows result.data contains user and session
|
|
9828
|
+
* console.log('Welcome,', result.data.user.email)
|
|
9829
|
+
* ```
|
|
9830
|
+
*/
|
|
9831
|
+
declare function isAuthError(response: FluxbaseAuthResponse): response is {
|
|
9832
|
+
data: null;
|
|
9833
|
+
error: Error;
|
|
9834
|
+
};
|
|
9835
|
+
/**
|
|
9836
|
+
* Type guard to check if an auth response is successful
|
|
9837
|
+
*
|
|
9838
|
+
* @param response - The auth response to check
|
|
9839
|
+
* @returns true if the auth operation succeeded
|
|
9840
|
+
*/
|
|
9841
|
+
declare function isAuthSuccess(response: FluxbaseAuthResponse): response is {
|
|
9842
|
+
data: AuthResponseData;
|
|
9843
|
+
error: null;
|
|
9844
|
+
};
|
|
9845
|
+
/**
|
|
9846
|
+
* Type guard to check if a PostgrestResponse has an error
|
|
9847
|
+
*
|
|
9848
|
+
* @param response - The Postgrest response to check
|
|
9849
|
+
* @returns true if the response contains an error
|
|
9850
|
+
*
|
|
9851
|
+
* @example
|
|
9852
|
+
* ```typescript
|
|
9853
|
+
* const response = await client.from('products').select('*').execute()
|
|
9854
|
+
*
|
|
9855
|
+
* if (hasPostgrestError(response)) {
|
|
9856
|
+
* // TypeScript knows: response.error is PostgrestError
|
|
9857
|
+
* console.error('Query failed:', response.error.message)
|
|
9858
|
+
* if (response.error.hint) {
|
|
9859
|
+
* console.log('Hint:', response.error.hint)
|
|
9860
|
+
* }
|
|
9861
|
+
* return
|
|
9862
|
+
* }
|
|
9863
|
+
*
|
|
9864
|
+
* // TypeScript knows: response.data is T (not null)
|
|
9865
|
+
* console.log('Found', response.data.length, 'products')
|
|
9866
|
+
* ```
|
|
9867
|
+
*/
|
|
9868
|
+
declare function hasPostgrestError<T>(response: PostgrestResponse<T>): response is PostgrestResponse<T> & {
|
|
9869
|
+
error: PostgrestError;
|
|
9870
|
+
data: null;
|
|
9871
|
+
};
|
|
9872
|
+
/**
|
|
9873
|
+
* Type guard to check if a PostgrestResponse is successful (has data)
|
|
9874
|
+
*
|
|
9875
|
+
* @param response - The Postgrest response to check
|
|
9876
|
+
* @returns true if the response has data and no error
|
|
9877
|
+
*/
|
|
9878
|
+
declare function isPostgrestSuccess<T>(response: PostgrestResponse<T>): response is PostgrestResponse<T> & {
|
|
9879
|
+
data: T;
|
|
9880
|
+
error: null;
|
|
9881
|
+
};
|
|
9882
|
+
/**
|
|
9883
|
+
* Type guard to check if a value is a non-null object
|
|
9884
|
+
* Useful for narrowing unknown types from API responses
|
|
9885
|
+
*
|
|
9886
|
+
* @param value - The value to check
|
|
9887
|
+
* @returns true if value is a non-null object
|
|
9888
|
+
*/
|
|
9889
|
+
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
9890
|
+
/**
|
|
9891
|
+
* Type guard to check if a value is an array
|
|
9892
|
+
* Useful for narrowing unknown types from API responses
|
|
9893
|
+
*
|
|
9894
|
+
* @param value - The value to check
|
|
9895
|
+
* @returns true if value is an array
|
|
9896
|
+
*/
|
|
9897
|
+
declare function isArray(value: unknown): value is unknown[];
|
|
9898
|
+
/**
|
|
9899
|
+
* Type guard to check if a value is a string
|
|
9900
|
+
*
|
|
9901
|
+
* @param value - The value to check
|
|
9902
|
+
* @returns true if value is a string
|
|
9903
|
+
*/
|
|
9904
|
+
declare function isString(value: unknown): value is string;
|
|
9905
|
+
/**
|
|
9906
|
+
* Type guard to check if a value is a number
|
|
9907
|
+
*
|
|
9908
|
+
* @param value - The value to check
|
|
9909
|
+
* @returns true if value is a number (excludes NaN)
|
|
9910
|
+
*/
|
|
9911
|
+
declare function isNumber(value: unknown): value is number;
|
|
9912
|
+
/**
|
|
9913
|
+
* Type guard to check if a value is a boolean
|
|
9914
|
+
*
|
|
9915
|
+
* @param value - The value to check
|
|
9916
|
+
* @returns true if value is a boolean
|
|
9917
|
+
*/
|
|
9918
|
+
declare function isBoolean(value: unknown): value is boolean;
|
|
9919
|
+
/**
|
|
9920
|
+
* Assert that a value is of type T, throwing if validation fails
|
|
9921
|
+
*
|
|
9922
|
+
* @param value - The value to assert
|
|
9923
|
+
* @param validator - A type guard function to validate the value
|
|
9924
|
+
* @param errorMessage - Optional custom error message
|
|
9925
|
+
* @throws Error if validation fails
|
|
9926
|
+
*
|
|
9927
|
+
* @example
|
|
9928
|
+
* ```typescript
|
|
9929
|
+
* const response = await client.functions.invoke('get-user')
|
|
9930
|
+
* assertType(response.data, isObject, 'Expected user object')
|
|
9931
|
+
* // Now response.data is typed as Record<string, unknown>
|
|
9932
|
+
* ```
|
|
9933
|
+
*/
|
|
9934
|
+
declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
|
|
9760
9935
|
|
|
9761
|
-
export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type ChatbotSpec, type ChunkedUploadSession, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, 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 DataResponse, type DeleteAPIKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailSettings, 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, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type HealthResponse, type HttpMethod, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, 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 TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateConversationOptions, 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, bundleCode, createClient, denoExternalPlugin, loadImportMap };
|
|
9936
|
+
export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type ChatbotSpec, type ChunkedUploadSession, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, 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 DataResponse, type DeleteAPIKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailSettings, 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, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type HealthResponse, type HttpMethod, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, 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 TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateConversationOptions, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateMigrationRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateRPCProcedureRequest, type UpdateSystemSettingRequest, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VectorMetric, type VectorOrderOptions, type VectorSearchOptions, type VectorSearchResult, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
|
package/dist/index.js
CHANGED
|
@@ -6919,9 +6919,20 @@ var FluxbaseAdminAI = class {
|
|
|
6919
6919
|
*/
|
|
6920
6920
|
async createProvider(request) {
|
|
6921
6921
|
try {
|
|
6922
|
+
const normalizedConfig = {};
|
|
6923
|
+
if (request.config) {
|
|
6924
|
+
for (const [key, value] of Object.entries(request.config)) {
|
|
6925
|
+
if (value !== void 0 && value !== null) {
|
|
6926
|
+
normalizedConfig[key] = String(value);
|
|
6927
|
+
}
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6922
6930
|
const data = await this.fetch.post(
|
|
6923
6931
|
"/api/v1/admin/ai/providers",
|
|
6924
|
-
|
|
6932
|
+
{
|
|
6933
|
+
...request,
|
|
6934
|
+
config: normalizedConfig
|
|
6935
|
+
}
|
|
6925
6936
|
);
|
|
6926
6937
|
return { data, error: null };
|
|
6927
6938
|
} catch (error) {
|
|
@@ -6949,9 +6960,19 @@ var FluxbaseAdminAI = class {
|
|
|
6949
6960
|
*/
|
|
6950
6961
|
async updateProvider(id, updates) {
|
|
6951
6962
|
try {
|
|
6963
|
+
let normalizedUpdates = updates;
|
|
6964
|
+
if (updates.config) {
|
|
6965
|
+
const normalizedConfig = {};
|
|
6966
|
+
for (const [key, value] of Object.entries(updates.config)) {
|
|
6967
|
+
if (value !== void 0 && value !== null) {
|
|
6968
|
+
normalizedConfig[key] = String(value);
|
|
6969
|
+
}
|
|
6970
|
+
}
|
|
6971
|
+
normalizedUpdates = { ...updates, config: normalizedConfig };
|
|
6972
|
+
}
|
|
6952
6973
|
const data = await this.fetch.put(
|
|
6953
6974
|
`/api/v1/admin/ai/providers/${id}`,
|
|
6954
|
-
|
|
6975
|
+
normalizedUpdates
|
|
6955
6976
|
);
|
|
6956
6977
|
return { data, error: null };
|
|
6957
6978
|
} catch (error) {
|
|
@@ -10351,6 +10372,46 @@ function createClient(fluxbaseUrl, fluxbaseKey, options) {
|
|
|
10351
10372
|
return new FluxbaseClient(url, key, options);
|
|
10352
10373
|
}
|
|
10353
10374
|
|
|
10354
|
-
|
|
10375
|
+
// src/type-guards.ts
|
|
10376
|
+
function isFluxbaseError(response) {
|
|
10377
|
+
return response.error !== null;
|
|
10378
|
+
}
|
|
10379
|
+
function isFluxbaseSuccess(response) {
|
|
10380
|
+
return response.error === null;
|
|
10381
|
+
}
|
|
10382
|
+
function isAuthError(response) {
|
|
10383
|
+
return response.error !== null;
|
|
10384
|
+
}
|
|
10385
|
+
function isAuthSuccess(response) {
|
|
10386
|
+
return response.error === null;
|
|
10387
|
+
}
|
|
10388
|
+
function hasPostgrestError(response) {
|
|
10389
|
+
return response.error !== null;
|
|
10390
|
+
}
|
|
10391
|
+
function isPostgrestSuccess(response) {
|
|
10392
|
+
return response.error === null && response.data !== null;
|
|
10393
|
+
}
|
|
10394
|
+
function isObject(value) {
|
|
10395
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10396
|
+
}
|
|
10397
|
+
function isArray(value) {
|
|
10398
|
+
return Array.isArray(value);
|
|
10399
|
+
}
|
|
10400
|
+
function isString(value) {
|
|
10401
|
+
return typeof value === "string";
|
|
10402
|
+
}
|
|
10403
|
+
function isNumber(value) {
|
|
10404
|
+
return typeof value === "number" && !Number.isNaN(value);
|
|
10405
|
+
}
|
|
10406
|
+
function isBoolean(value) {
|
|
10407
|
+
return typeof value === "boolean";
|
|
10408
|
+
}
|
|
10409
|
+
function assertType(value, validator, errorMessage = "Type assertion failed") {
|
|
10410
|
+
if (!validator(value)) {
|
|
10411
|
+
throw new Error(errorMessage);
|
|
10412
|
+
}
|
|
10413
|
+
}
|
|
10414
|
+
|
|
10415
|
+
export { APIKeysManager, AppSettingsManager, AuthSettingsManager, DDLManager, EmailTemplateManager, ExecutionLogsChannel, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminStorage, FluxbaseAuth, FluxbaseClient, FluxbaseFetch, FluxbaseFunctions, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, ImpersonationManager, InvitationsManager, OAuthProviderManager, QueryBuilder, RealtimeChannel, SchemaQueryBuilder, SettingsClient, StorageBucket, SystemSettingsManager, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
|
|
10355
10416
|
//# sourceMappingURL=index.js.map
|
|
10356
10417
|
//# sourceMappingURL=index.js.map
|