38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { type QxValueType } from "./bindings.js";
|
|
import type { QueryResponse } from "./camino/api_pb.js";
|
|
import type { QxObjectRef } from "./references.js";
|
|
export type QxQueryPartial<T> = T extends QxObjectRef ? T : T extends readonly (infer Item)[] ? QxQueryPartial<Item>[] : T extends object ? {
|
|
[Key in keyof T]?: QxQueryPartial<T[Key]>;
|
|
} : T;
|
|
export type QxQuerySnapshot<T> = {
|
|
runId: string;
|
|
sequence: bigint;
|
|
dataVersion: string;
|
|
bindingDigest: string;
|
|
consistency: string;
|
|
fields: {
|
|
path: readonly (string | number)[];
|
|
status: "pending" | "error";
|
|
error?: string;
|
|
}[];
|
|
} & ({
|
|
status: "ready";
|
|
data: T;
|
|
} | {
|
|
status: "partial";
|
|
data: QxQueryPartial<T>;
|
|
});
|
|
declare const queryTypes: unique symbol;
|
|
/** Generated shape evidence, not permission to run a query. */
|
|
export interface QxQueryDescriptor<Variables, Result, Root extends string = string> {
|
|
readonly id: string;
|
|
readonly definitionDigest: string;
|
|
readonly rootInterfaceRevisionId: Root;
|
|
readonly variables: QxValueType;
|
|
readonly output: QxValueType;
|
|
readonly watch: boolean;
|
|
readonly [queryTypes]?: (variables: Variables, result: Result) => [Variables, Result];
|
|
}
|
|
export declare function decodeQuerySnapshot<T>(response: QueryResponse, output: QxValueType, runId: string, sequence: bigint): QxQuerySnapshot<T>;
|
|
export {};
|
|
//# sourceMappingURL=queries.d.ts.map
|