@instantdb/core
Version:
Instant's core local abstraction
77 lines • 2.12 kB
TypeScript
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;
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