@fluxbase/sdk 0.0.1-rc.30 → 0.0.1-rc.32
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 +224 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -12
- package/dist/index.d.ts +116 -12
- package/dist/index.js +224 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -155,7 +155,7 @@ interface PostgrestResponse<T> {
|
|
|
155
155
|
status: number;
|
|
156
156
|
statusText: string;
|
|
157
157
|
}
|
|
158
|
-
type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'cs' | 'cd' | 'ov' | 'sl' | 'sr' | 'nxr' | 'nxl' | 'fts' | 'plfts' | 'wfts';
|
|
158
|
+
type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'cs' | 'cd' | 'ov' | 'sl' | 'sr' | 'nxr' | 'nxl' | 'adj' | 'not' | 'fts' | 'plfts' | 'wfts';
|
|
159
159
|
interface QueryFilter {
|
|
160
160
|
column: string;
|
|
161
161
|
operator: FilterOperator;
|
|
@@ -167,6 +167,27 @@ interface OrderBy {
|
|
|
167
167
|
direction: OrderDirection;
|
|
168
168
|
nulls?: 'first' | 'last';
|
|
169
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Options for upsert operations (Supabase-compatible)
|
|
172
|
+
*/
|
|
173
|
+
interface UpsertOptions {
|
|
174
|
+
/**
|
|
175
|
+
* Comma-separated columns to use for conflict resolution
|
|
176
|
+
* @example 'email'
|
|
177
|
+
* @example 'user_id,tenant_id'
|
|
178
|
+
*/
|
|
179
|
+
onConflict?: string;
|
|
180
|
+
/**
|
|
181
|
+
* If true, duplicate rows are ignored (not upserted)
|
|
182
|
+
* @default false
|
|
183
|
+
*/
|
|
184
|
+
ignoreDuplicates?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* If true, missing columns default to null instead of using existing values
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
defaultToNull?: boolean;
|
|
190
|
+
}
|
|
170
191
|
interface RealtimeMessage {
|
|
171
192
|
type: 'subscribe' | 'unsubscribe' | 'heartbeat' | 'broadcast' | 'presence' | 'ack' | 'error';
|
|
172
193
|
channel?: string;
|
|
@@ -4226,11 +4247,17 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4226
4247
|
private table;
|
|
4227
4248
|
private selectQuery;
|
|
4228
4249
|
private filters;
|
|
4250
|
+
private orFilters;
|
|
4251
|
+
private andFilters;
|
|
4229
4252
|
private orderBys;
|
|
4230
4253
|
private limitValue?;
|
|
4231
4254
|
private offsetValue?;
|
|
4232
4255
|
private singleRow;
|
|
4256
|
+
private maybeSingleRow;
|
|
4233
4257
|
private groupByColumns?;
|
|
4258
|
+
private operationType;
|
|
4259
|
+
private insertData?;
|
|
4260
|
+
private updateData?;
|
|
4234
4261
|
constructor(fetch: FluxbaseFetch, table: string);
|
|
4235
4262
|
/**
|
|
4236
4263
|
* Select columns to return
|
|
@@ -4242,19 +4269,21 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4242
4269
|
/**
|
|
4243
4270
|
* Insert a single row or multiple rows
|
|
4244
4271
|
*/
|
|
4245
|
-
insert(data: Partial<T> | Array<Partial<T>>):
|
|
4272
|
+
insert(data: Partial<T> | Array<Partial<T>>): this;
|
|
4246
4273
|
/**
|
|
4247
|
-
* Upsert (insert or update) rows
|
|
4274
|
+
* Upsert (insert or update) rows (Supabase-compatible)
|
|
4275
|
+
* @param data - Row(s) to upsert
|
|
4276
|
+
* @param options - Upsert options (onConflict, ignoreDuplicates, defaultToNull)
|
|
4248
4277
|
*/
|
|
4249
|
-
upsert(data: Partial<T> | Array<Partial<T
|
|
4278
|
+
upsert(data: Partial<T> | Array<Partial<T>>, options?: UpsertOptions): Promise<PostgrestResponse<T>>;
|
|
4250
4279
|
/**
|
|
4251
4280
|
* Update rows matching the filters
|
|
4252
4281
|
*/
|
|
4253
|
-
update(data: Partial<T>):
|
|
4282
|
+
update(data: Partial<T>): this;
|
|
4254
4283
|
/**
|
|
4255
4284
|
* Delete rows matching the filters
|
|
4256
4285
|
*/
|
|
4257
|
-
delete():
|
|
4286
|
+
delete(): this;
|
|
4258
4287
|
/**
|
|
4259
4288
|
* Equal to
|
|
4260
4289
|
*/
|
|
@@ -4303,6 +4332,48 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4303
4332
|
* Full-text search
|
|
4304
4333
|
*/
|
|
4305
4334
|
textSearch(column: string, query: string): this;
|
|
4335
|
+
/**
|
|
4336
|
+
* Negate a filter condition (Supabase-compatible)
|
|
4337
|
+
* @example not('status', 'eq', 'deleted')
|
|
4338
|
+
* @example not('completed_at', 'is', null)
|
|
4339
|
+
*/
|
|
4340
|
+
not(column: string, operator: FilterOperator, value: unknown): this;
|
|
4341
|
+
/**
|
|
4342
|
+
* Apply OR logic to filters (Supabase-compatible)
|
|
4343
|
+
* @example or('status.eq.active,status.eq.pending')
|
|
4344
|
+
* @example or('id.eq.2,name.eq.Han')
|
|
4345
|
+
*/
|
|
4346
|
+
or(filters: string): this;
|
|
4347
|
+
/**
|
|
4348
|
+
* Apply AND logic to filters (Supabase-compatible)
|
|
4349
|
+
* Groups multiple conditions that must all be true
|
|
4350
|
+
* @example and('status.eq.active,verified.eq.true')
|
|
4351
|
+
* @example and('age.gte.18,age.lte.65')
|
|
4352
|
+
*/
|
|
4353
|
+
and(filters: string): this;
|
|
4354
|
+
/**
|
|
4355
|
+
* Match multiple columns with exact values (Supabase-compatible)
|
|
4356
|
+
* Shorthand for multiple .eq() calls
|
|
4357
|
+
* @example match({ id: 1, status: 'active', role: 'admin' })
|
|
4358
|
+
*/
|
|
4359
|
+
match(conditions: Record<string, unknown>): this;
|
|
4360
|
+
/**
|
|
4361
|
+
* Generic filter method using PostgREST syntax (Supabase-compatible)
|
|
4362
|
+
* @example filter('name', 'in', '("Han","Yoda")')
|
|
4363
|
+
* @example filter('age', 'gte', '18')
|
|
4364
|
+
*/
|
|
4365
|
+
filter(column: string, operator: FilterOperator, value: unknown): this;
|
|
4366
|
+
/**
|
|
4367
|
+
* Check if column is contained by value (Supabase-compatible)
|
|
4368
|
+
* For arrays and JSONB
|
|
4369
|
+
* @example containedBy('tags', '["news","update"]')
|
|
4370
|
+
*/
|
|
4371
|
+
containedBy(column: string, value: unknown): this;
|
|
4372
|
+
/**
|
|
4373
|
+
* Check if arrays have common elements (Supabase-compatible)
|
|
4374
|
+
* @example overlaps('tags', '["news","sports"]')
|
|
4375
|
+
*/
|
|
4376
|
+
overlaps(column: string, value: unknown): this;
|
|
4306
4377
|
/**
|
|
4307
4378
|
* Order results
|
|
4308
4379
|
*/
|
|
@@ -4320,8 +4391,24 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4320
4391
|
offset(count: number): this;
|
|
4321
4392
|
/**
|
|
4322
4393
|
* Return a single row (adds limit(1))
|
|
4394
|
+
* Errors if no rows found
|
|
4323
4395
|
*/
|
|
4324
4396
|
single(): this;
|
|
4397
|
+
/**
|
|
4398
|
+
* Return a single row or null (adds limit(1))
|
|
4399
|
+
* Does not error if no rows found (Supabase-compatible)
|
|
4400
|
+
* @example
|
|
4401
|
+
* ```typescript
|
|
4402
|
+
* // Returns null instead of erroring when no row exists
|
|
4403
|
+
* const { data, error } = await client
|
|
4404
|
+
* .from('users')
|
|
4405
|
+
* .select('*')
|
|
4406
|
+
* .eq('id', 999)
|
|
4407
|
+
* .maybeSingle()
|
|
4408
|
+
* // data will be null if no row found
|
|
4409
|
+
* ```
|
|
4410
|
+
*/
|
|
4411
|
+
maybeSingle(): this;
|
|
4325
4412
|
/**
|
|
4326
4413
|
* Range selection (pagination)
|
|
4327
4414
|
*/
|
|
@@ -4475,7 +4562,7 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4475
4562
|
* { name: 'Alice', email: 'alice@example.com' },
|
|
4476
4563
|
* { name: 'Bob', email: 'bob@example.com' },
|
|
4477
4564
|
* { name: 'Charlie', email: 'charlie@example.com' }
|
|
4478
|
-
* ])
|
|
4565
|
+
* ])
|
|
4479
4566
|
* ```
|
|
4480
4567
|
*
|
|
4481
4568
|
* @category Batch Operations
|
|
@@ -4496,13 +4583,11 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4496
4583
|
* const { data } = await client.from('products')
|
|
4497
4584
|
* .eq('category', 'electronics')
|
|
4498
4585
|
* .updateMany({ discount: 10, updated_at: new Date() })
|
|
4499
|
-
* .execute()
|
|
4500
4586
|
*
|
|
4501
4587
|
* // Mark all pending orders as processing
|
|
4502
4588
|
* const { data } = await client.from('orders')
|
|
4503
4589
|
* .eq('status', 'pending')
|
|
4504
4590
|
* .updateMany({ status: 'processing' })
|
|
4505
|
-
* .execute()
|
|
4506
4591
|
* ```
|
|
4507
4592
|
*
|
|
4508
4593
|
* @category Batch Operations
|
|
@@ -4522,13 +4607,11 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4522
4607
|
* await client.from('users')
|
|
4523
4608
|
* .eq('active', false)
|
|
4524
4609
|
* .deleteMany()
|
|
4525
|
-
* .execute()
|
|
4526
4610
|
*
|
|
4527
4611
|
* // Delete old logs
|
|
4528
4612
|
* await client.from('logs')
|
|
4529
4613
|
* .lt('created_at', '2024-01-01')
|
|
4530
4614
|
* .deleteMany()
|
|
4531
|
-
* .execute()
|
|
4532
4615
|
* ```
|
|
4533
4616
|
*
|
|
4534
4617
|
* @category Batch Operations
|
|
@@ -4538,6 +4621,27 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4538
4621
|
* Execute the query and return results
|
|
4539
4622
|
*/
|
|
4540
4623
|
execute(): Promise<PostgrestResponse<T>>;
|
|
4624
|
+
/**
|
|
4625
|
+
* Execute the query and throw an error if one occurs (Supabase-compatible)
|
|
4626
|
+
* Returns the data directly instead of { data, error } wrapper
|
|
4627
|
+
*
|
|
4628
|
+
* @throws {Error} If the query fails or returns an error
|
|
4629
|
+
* @example
|
|
4630
|
+
* ```typescript
|
|
4631
|
+
* // Throws error instead of returning { data, error }
|
|
4632
|
+
* try {
|
|
4633
|
+
* const user = await client
|
|
4634
|
+
* .from('users')
|
|
4635
|
+
* .select('*')
|
|
4636
|
+
* .eq('id', 1)
|
|
4637
|
+
* .single()
|
|
4638
|
+
* .throwOnError()
|
|
4639
|
+
* } catch (error) {
|
|
4640
|
+
* console.error('Query failed:', error)
|
|
4641
|
+
* }
|
|
4642
|
+
* ```
|
|
4643
|
+
*/
|
|
4644
|
+
throwOnError(): Promise<T>;
|
|
4541
4645
|
/**
|
|
4542
4646
|
* Make QueryBuilder awaitable (implements PromiseLike)
|
|
4543
4647
|
* This allows using `await client.from('table').select()` without calling `.execute()`
|
|
@@ -4767,4 +4871,4 @@ declare class FluxbaseClient<Database = any, _SchemaName extends string & keyof
|
|
|
4767
4871
|
*/
|
|
4768
4872
|
declare function createClient<Database = any, SchemaName extends string & keyof Database = any>(fluxbaseUrl: string, fluxbaseKey: string, options?: FluxbaseClientOptions): FluxbaseClient<Database, SchemaName>;
|
|
4769
4873
|
|
|
4770
|
-
export { type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminUser, type AppSettings, AppSettingsManager, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, type Column, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, 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 EdgeFunction, type EdgeFunctionExecution, type EmailSettings, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EnrichedUser, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAdmin, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, type FunctionInvokeOptions, type GetImpersonationResponse, 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 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 OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type SESSettings, type SMTPSettings, type Schema, type SecuritySettings, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SupabaseAuthResponse, type SupabaseResponse, type SystemSetting, SystemSettingsManager, type Table, type TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateSystemSettingRequest, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type User, type UserResponse, type ValidateInvitationResponse, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|
|
4874
|
+
export { type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminUser, type AppSettings, AppSettingsManager, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, type Column, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, 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 EdgeFunction, type EdgeFunctionExecution, type EmailSettings, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EnrichedUser, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAdmin, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, type FunctionInvokeOptions, type GetImpersonationResponse, 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 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 OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type SESSettings, type SMTPSettings, type Schema, type SecuritySettings, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SupabaseAuthResponse, type SupabaseResponse, type SystemSetting, SystemSettingsManager, type Table, type TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateSystemSettingRequest, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ interface PostgrestResponse<T> {
|
|
|
155
155
|
status: number;
|
|
156
156
|
statusText: string;
|
|
157
157
|
}
|
|
158
|
-
type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'cs' | 'cd' | 'ov' | 'sl' | 'sr' | 'nxr' | 'nxl' | 'fts' | 'plfts' | 'wfts';
|
|
158
|
+
type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'cs' | 'cd' | 'ov' | 'sl' | 'sr' | 'nxr' | 'nxl' | 'adj' | 'not' | 'fts' | 'plfts' | 'wfts';
|
|
159
159
|
interface QueryFilter {
|
|
160
160
|
column: string;
|
|
161
161
|
operator: FilterOperator;
|
|
@@ -167,6 +167,27 @@ interface OrderBy {
|
|
|
167
167
|
direction: OrderDirection;
|
|
168
168
|
nulls?: 'first' | 'last';
|
|
169
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Options for upsert operations (Supabase-compatible)
|
|
172
|
+
*/
|
|
173
|
+
interface UpsertOptions {
|
|
174
|
+
/**
|
|
175
|
+
* Comma-separated columns to use for conflict resolution
|
|
176
|
+
* @example 'email'
|
|
177
|
+
* @example 'user_id,tenant_id'
|
|
178
|
+
*/
|
|
179
|
+
onConflict?: string;
|
|
180
|
+
/**
|
|
181
|
+
* If true, duplicate rows are ignored (not upserted)
|
|
182
|
+
* @default false
|
|
183
|
+
*/
|
|
184
|
+
ignoreDuplicates?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* If true, missing columns default to null instead of using existing values
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
defaultToNull?: boolean;
|
|
190
|
+
}
|
|
170
191
|
interface RealtimeMessage {
|
|
171
192
|
type: 'subscribe' | 'unsubscribe' | 'heartbeat' | 'broadcast' | 'presence' | 'ack' | 'error';
|
|
172
193
|
channel?: string;
|
|
@@ -4226,11 +4247,17 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4226
4247
|
private table;
|
|
4227
4248
|
private selectQuery;
|
|
4228
4249
|
private filters;
|
|
4250
|
+
private orFilters;
|
|
4251
|
+
private andFilters;
|
|
4229
4252
|
private orderBys;
|
|
4230
4253
|
private limitValue?;
|
|
4231
4254
|
private offsetValue?;
|
|
4232
4255
|
private singleRow;
|
|
4256
|
+
private maybeSingleRow;
|
|
4233
4257
|
private groupByColumns?;
|
|
4258
|
+
private operationType;
|
|
4259
|
+
private insertData?;
|
|
4260
|
+
private updateData?;
|
|
4234
4261
|
constructor(fetch: FluxbaseFetch, table: string);
|
|
4235
4262
|
/**
|
|
4236
4263
|
* Select columns to return
|
|
@@ -4242,19 +4269,21 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4242
4269
|
/**
|
|
4243
4270
|
* Insert a single row or multiple rows
|
|
4244
4271
|
*/
|
|
4245
|
-
insert(data: Partial<T> | Array<Partial<T>>):
|
|
4272
|
+
insert(data: Partial<T> | Array<Partial<T>>): this;
|
|
4246
4273
|
/**
|
|
4247
|
-
* Upsert (insert or update) rows
|
|
4274
|
+
* Upsert (insert or update) rows (Supabase-compatible)
|
|
4275
|
+
* @param data - Row(s) to upsert
|
|
4276
|
+
* @param options - Upsert options (onConflict, ignoreDuplicates, defaultToNull)
|
|
4248
4277
|
*/
|
|
4249
|
-
upsert(data: Partial<T> | Array<Partial<T
|
|
4278
|
+
upsert(data: Partial<T> | Array<Partial<T>>, options?: UpsertOptions): Promise<PostgrestResponse<T>>;
|
|
4250
4279
|
/**
|
|
4251
4280
|
* Update rows matching the filters
|
|
4252
4281
|
*/
|
|
4253
|
-
update(data: Partial<T>):
|
|
4282
|
+
update(data: Partial<T>): this;
|
|
4254
4283
|
/**
|
|
4255
4284
|
* Delete rows matching the filters
|
|
4256
4285
|
*/
|
|
4257
|
-
delete():
|
|
4286
|
+
delete(): this;
|
|
4258
4287
|
/**
|
|
4259
4288
|
* Equal to
|
|
4260
4289
|
*/
|
|
@@ -4303,6 +4332,48 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4303
4332
|
* Full-text search
|
|
4304
4333
|
*/
|
|
4305
4334
|
textSearch(column: string, query: string): this;
|
|
4335
|
+
/**
|
|
4336
|
+
* Negate a filter condition (Supabase-compatible)
|
|
4337
|
+
* @example not('status', 'eq', 'deleted')
|
|
4338
|
+
* @example not('completed_at', 'is', null)
|
|
4339
|
+
*/
|
|
4340
|
+
not(column: string, operator: FilterOperator, value: unknown): this;
|
|
4341
|
+
/**
|
|
4342
|
+
* Apply OR logic to filters (Supabase-compatible)
|
|
4343
|
+
* @example or('status.eq.active,status.eq.pending')
|
|
4344
|
+
* @example or('id.eq.2,name.eq.Han')
|
|
4345
|
+
*/
|
|
4346
|
+
or(filters: string): this;
|
|
4347
|
+
/**
|
|
4348
|
+
* Apply AND logic to filters (Supabase-compatible)
|
|
4349
|
+
* Groups multiple conditions that must all be true
|
|
4350
|
+
* @example and('status.eq.active,verified.eq.true')
|
|
4351
|
+
* @example and('age.gte.18,age.lte.65')
|
|
4352
|
+
*/
|
|
4353
|
+
and(filters: string): this;
|
|
4354
|
+
/**
|
|
4355
|
+
* Match multiple columns with exact values (Supabase-compatible)
|
|
4356
|
+
* Shorthand for multiple .eq() calls
|
|
4357
|
+
* @example match({ id: 1, status: 'active', role: 'admin' })
|
|
4358
|
+
*/
|
|
4359
|
+
match(conditions: Record<string, unknown>): this;
|
|
4360
|
+
/**
|
|
4361
|
+
* Generic filter method using PostgREST syntax (Supabase-compatible)
|
|
4362
|
+
* @example filter('name', 'in', '("Han","Yoda")')
|
|
4363
|
+
* @example filter('age', 'gte', '18')
|
|
4364
|
+
*/
|
|
4365
|
+
filter(column: string, operator: FilterOperator, value: unknown): this;
|
|
4366
|
+
/**
|
|
4367
|
+
* Check if column is contained by value (Supabase-compatible)
|
|
4368
|
+
* For arrays and JSONB
|
|
4369
|
+
* @example containedBy('tags', '["news","update"]')
|
|
4370
|
+
*/
|
|
4371
|
+
containedBy(column: string, value: unknown): this;
|
|
4372
|
+
/**
|
|
4373
|
+
* Check if arrays have common elements (Supabase-compatible)
|
|
4374
|
+
* @example overlaps('tags', '["news","sports"]')
|
|
4375
|
+
*/
|
|
4376
|
+
overlaps(column: string, value: unknown): this;
|
|
4306
4377
|
/**
|
|
4307
4378
|
* Order results
|
|
4308
4379
|
*/
|
|
@@ -4320,8 +4391,24 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4320
4391
|
offset(count: number): this;
|
|
4321
4392
|
/**
|
|
4322
4393
|
* Return a single row (adds limit(1))
|
|
4394
|
+
* Errors if no rows found
|
|
4323
4395
|
*/
|
|
4324
4396
|
single(): this;
|
|
4397
|
+
/**
|
|
4398
|
+
* Return a single row or null (adds limit(1))
|
|
4399
|
+
* Does not error if no rows found (Supabase-compatible)
|
|
4400
|
+
* @example
|
|
4401
|
+
* ```typescript
|
|
4402
|
+
* // Returns null instead of erroring when no row exists
|
|
4403
|
+
* const { data, error } = await client
|
|
4404
|
+
* .from('users')
|
|
4405
|
+
* .select('*')
|
|
4406
|
+
* .eq('id', 999)
|
|
4407
|
+
* .maybeSingle()
|
|
4408
|
+
* // data will be null if no row found
|
|
4409
|
+
* ```
|
|
4410
|
+
*/
|
|
4411
|
+
maybeSingle(): this;
|
|
4325
4412
|
/**
|
|
4326
4413
|
* Range selection (pagination)
|
|
4327
4414
|
*/
|
|
@@ -4475,7 +4562,7 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4475
4562
|
* { name: 'Alice', email: 'alice@example.com' },
|
|
4476
4563
|
* { name: 'Bob', email: 'bob@example.com' },
|
|
4477
4564
|
* { name: 'Charlie', email: 'charlie@example.com' }
|
|
4478
|
-
* ])
|
|
4565
|
+
* ])
|
|
4479
4566
|
* ```
|
|
4480
4567
|
*
|
|
4481
4568
|
* @category Batch Operations
|
|
@@ -4496,13 +4583,11 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4496
4583
|
* const { data } = await client.from('products')
|
|
4497
4584
|
* .eq('category', 'electronics')
|
|
4498
4585
|
* .updateMany({ discount: 10, updated_at: new Date() })
|
|
4499
|
-
* .execute()
|
|
4500
4586
|
*
|
|
4501
4587
|
* // Mark all pending orders as processing
|
|
4502
4588
|
* const { data } = await client.from('orders')
|
|
4503
4589
|
* .eq('status', 'pending')
|
|
4504
4590
|
* .updateMany({ status: 'processing' })
|
|
4505
|
-
* .execute()
|
|
4506
4591
|
* ```
|
|
4507
4592
|
*
|
|
4508
4593
|
* @category Batch Operations
|
|
@@ -4522,13 +4607,11 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4522
4607
|
* await client.from('users')
|
|
4523
4608
|
* .eq('active', false)
|
|
4524
4609
|
* .deleteMany()
|
|
4525
|
-
* .execute()
|
|
4526
4610
|
*
|
|
4527
4611
|
* // Delete old logs
|
|
4528
4612
|
* await client.from('logs')
|
|
4529
4613
|
* .lt('created_at', '2024-01-01')
|
|
4530
4614
|
* .deleteMany()
|
|
4531
|
-
* .execute()
|
|
4532
4615
|
* ```
|
|
4533
4616
|
*
|
|
4534
4617
|
* @category Batch Operations
|
|
@@ -4538,6 +4621,27 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4538
4621
|
* Execute the query and return results
|
|
4539
4622
|
*/
|
|
4540
4623
|
execute(): Promise<PostgrestResponse<T>>;
|
|
4624
|
+
/**
|
|
4625
|
+
* Execute the query and throw an error if one occurs (Supabase-compatible)
|
|
4626
|
+
* Returns the data directly instead of { data, error } wrapper
|
|
4627
|
+
*
|
|
4628
|
+
* @throws {Error} If the query fails or returns an error
|
|
4629
|
+
* @example
|
|
4630
|
+
* ```typescript
|
|
4631
|
+
* // Throws error instead of returning { data, error }
|
|
4632
|
+
* try {
|
|
4633
|
+
* const user = await client
|
|
4634
|
+
* .from('users')
|
|
4635
|
+
* .select('*')
|
|
4636
|
+
* .eq('id', 1)
|
|
4637
|
+
* .single()
|
|
4638
|
+
* .throwOnError()
|
|
4639
|
+
* } catch (error) {
|
|
4640
|
+
* console.error('Query failed:', error)
|
|
4641
|
+
* }
|
|
4642
|
+
* ```
|
|
4643
|
+
*/
|
|
4644
|
+
throwOnError(): Promise<T>;
|
|
4541
4645
|
/**
|
|
4542
4646
|
* Make QueryBuilder awaitable (implements PromiseLike)
|
|
4543
4647
|
* This allows using `await client.from('table').select()` without calling `.execute()`
|
|
@@ -4767,4 +4871,4 @@ declare class FluxbaseClient<Database = any, _SchemaName extends string & keyof
|
|
|
4767
4871
|
*/
|
|
4768
4872
|
declare function createClient<Database = any, SchemaName extends string & keyof Database = any>(fluxbaseUrl: string, fluxbaseKey: string, options?: FluxbaseClientOptions): FluxbaseClient<Database, SchemaName>;
|
|
4769
4873
|
|
|
4770
|
-
export { type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminUser, type AppSettings, AppSettingsManager, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, type Column, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, 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 EdgeFunction, type EdgeFunctionExecution, type EmailSettings, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EnrichedUser, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAdmin, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, type FunctionInvokeOptions, type GetImpersonationResponse, 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 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 OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type SESSettings, type SMTPSettings, type Schema, type SecuritySettings, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SupabaseAuthResponse, type SupabaseResponse, type SystemSetting, SystemSettingsManager, type Table, type TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateSystemSettingRequest, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type User, type UserResponse, type ValidateInvitationResponse, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|
|
4874
|
+
export { type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminUser, type AppSettings, AppSettingsManager, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, type Column, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, 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 EdgeFunction, type EdgeFunctionExecution, type EmailSettings, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EnrichedUser, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAdmin, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, type FunctionInvokeOptions, type GetImpersonationResponse, 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 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 OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type SESSettings, type SMTPSettings, type Schema, type SecuritySettings, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SupabaseAuthResponse, type SupabaseResponse, type SystemSetting, SystemSettingsManager, type Table, type TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateSystemSettingRequest, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|