triplit-tanstackdb
Version:
TanStack DB collection adapter for the Triplit real-time, offline-first sync engine. Enables powerful optimistic updates and reactive, cross-source queries.
23 lines • 1.06 kB
TypeScript
import type { CollectionConfig } from '@tanstack/db';
import { TriplitClient, SchemaQuery, TriplitError, Models } from '@triplit/client';
/**
* The internal configuration required by the low-level Triplit collection adapter.
* @internal
*/
export interface TriplitCollectionOptions<M extends Models<M>, TQuery extends SchemaQuery<M>, TItem extends object = TQuery extends {
_output: infer O extends object;
} ? O : never> {
client: TriplitClient<M>;
query: TQuery;
getKey: (item: TItem) => string | number;
onError?: (error: TriplitError | Error) => void;
}
/**
* Creates the core `CollectionConfig` object with sync and mutation handlers
* for a Triplit-powered collection. This is the low-level primitive.
* @internal
*/
export declare function createTriplitCollectionOptions<M extends Models<M>, TQuery extends SchemaQuery<M>, TItem extends object = TQuery extends {
_output: infer O extends object;
} ? O : never>(options: TriplitCollectionOptions<M, TQuery, TItem>): CollectionConfig<TItem>;
//# sourceMappingURL=options.d.ts.map