UNPKG

@instantdb/core

Version:
81 lines 2.29 kB
import { InstantCoreDatabase, InstantDBAttr } from './index.ts'; import { RuleParams } from './schemaTypes.ts'; export declare const isServer: boolean; export type FrameworkConfig = { token?: string | null; db: InstantCoreDatabase<any, any>; }; type QueryPromise = { type: 'http'; triples: any; attrs: any; queryHash: any; query: any; pageInfo?: any; } | { type: 'session'; queryResult: any; }; export declare class FrameworkClient { private params; private db; resultMap: Map<string, { status: 'pending' | 'success' | 'error'; type: 'http' | 'session'; promise?: Promise<QueryPromise> | null; data?: any; error?: any; }>; private queryResolvedCallbacks; constructor(params: FrameworkConfig); subscribe: (callback: (result: { triples: any; attrs: any; queryHash: string; pageInfo?: any; }) => void) => void; addQueryResult: (queryKey: string, value: any) => void; removeCachedQueryResult: (queryHash: string) => void; queryClient: (query_: any, opts?: { ruleParams: RuleParams; }) => Promise<QueryPromise>; query: (_query: any, opts?: { ruleParams: RuleParams; }) => { type: "http" | "session"; status: "pending" | "success" | "error"; promise?: Promise<QueryPromise>; data?: any; error?: any; }; getExistingResultForQuery: (_query: any, opts?: { ruleParams: RuleParams; }) => { status: "pending" | "success" | "error"; type: "http" | "session"; promise?: Promise<QueryPromise> | null; data?: any; error?: any; } | undefined; completeIsomorphic: (query: any, triples: any[], attrs: InstantDBAttr[], pageInfo?: any) => { data: any; pageInfo?: any; aggregate?: any; }; hashQuery: (_query: any, opts?: { ruleParams: RuleParams; }) => { hash: string; query: any; }; getTriplesAndAttrsForQuery: (query: any) => Promise<{ triples: any[]; attrs: InstantDBAttr[]; query: any; queryHash: string; type: "http"; pageInfo?: any; }>; } export {}; //# sourceMappingURL=framework.d.ts.map