import * as _tanstack_db0 from "@tanstack/db"; import { Collection, ExtractContext, InferResultType, InitialQueryBuilder, QueryBuilder } from "@tanstack/db"; import * as _tanstack_query_db_collection0 from "@tanstack/query-db-collection"; import { QueryClient } from "@tanstack/query-core"; import { StandardSchemaV1 } from "@standard-schema/spec"; import { SupabaseClient } from "@supabase/supabase-js"; //#region src/db.d.ts interface SupabaseCollectionOptions { /** * The columns that uniquely identify a row. Used to extract the key for * storing the item in the collection and to build the where clause for * update and delete operations. */ keys: Array & string>; /** The query client */ queryClient?: QueryClient; /** Whether to receive updates when a record has been inserted, updated, or deleted by another user */ realtime?: boolean; /** The schema of the collection */ schema: TSchema; /** The supabase browser client */ supabase: SupabaseClient; /** The name of the table in the database */ tableName: string; } declare const supabaseCollectionOptions: ({ tableName, keys, schema, queryClient, supabase, realtime }: SupabaseCollectionOptions) => { sync: { sync: (params: { collection: Collection ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, any, any, any>; begin: (options?: { immediate?: boolean; }) => void; write: (message: _tanstack_db0.ChangeMessageOrDeleteKeyMessage ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number>) => void; commit: () => void; markReady: () => void; truncate: () => void; metadata?: _tanstack_db0.SyncMetadataApi | undefined; }) => ReturnType<(params: { collection: Collection ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, any, any, any>; begin: (options?: { immediate?: boolean; }) => void; write: (message: _tanstack_db0.ChangeMessageOrDeleteKeyMessage ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number>) => void; commit: () => void; markReady: () => void; truncate: () => void; metadata?: _tanstack_db0.SyncMetadataApi | undefined; }) => void | _tanstack_db0.CleanupFn | _tanstack_db0.SyncConfigRes>; }; id?: string; schema: TSchema | (undefined & TSchema); getKey: (item: TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record) => string | number; gcTime?: number; startSync?: boolean; autoIndex?: `off` | `eager`; defaultIndexType?: _tanstack_db0.IndexConstructor | undefined; compare?: ((x: TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, y: TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record) => number) | undefined; syncMode?: _tanstack_db0.SyncMode; onInsert?: _tanstack_db0.InsertMutationFn ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, _tanstack_query_db_collection0.QueryCollectionUtils ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferInput extends object ? StandardSchemaV1.InferInput : Record : Record, unknown>, any> | undefined; onUpdate?: _tanstack_db0.UpdateMutationFn ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, _tanstack_query_db_collection0.QueryCollectionUtils ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferInput extends object ? StandardSchemaV1.InferInput : Record : Record, unknown>, any> | undefined; onDelete?: _tanstack_db0.DeleteMutationFn ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, _tanstack_query_db_collection0.QueryCollectionUtils ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferInput extends object ? StandardSchemaV1.InferInput : Record : Record, unknown>, any> | undefined; defaultStringCollation?: _tanstack_db0.StringCollationConfig; utils: _tanstack_query_db_collection0.QueryCollectionUtils ? StandardSchemaV1.InferOutput extends object ? StandardSchemaV1.InferOutput : Record : Record, string | number, TSchema extends StandardSchemaV1 ? StandardSchemaV1.InferInput extends object ? StandardSchemaV1.InferInput : Record : Record, unknown>; }; //#endregion //#region src/query-once.d.ts /** * Execute a TanStack DB query against Supabase in a one-shot manner. * * Translates the query IR to a single PostgREST request, pushing filters, * ordering, limit, offset, joins (resource embedding), and aggregates * to the server. * * Operations that cannot be pushed (groupBy, having, distinct, computed * select expressions) are not applied — the raw fetched data is returned * for client-side processing. */ declare const queryOnce: QueryBuilder, TQuery extends QueryBuilder = ReturnType>(callback: TQueryFn, supabase: SupabaseClient) => Promise>>; //#endregion export { queryOnce, supabaseCollectionOptions };