@ldhop/react
Version:
Follow your nose through linked data resources - for React
36 lines (35 loc) • 1.25 kB
TypeScript
import { QueryAndStore, type FetchRdfReturnType, type RdfQuery } from '@ldhop/core';
import type { QueryKey, UseQueryResult } from '@tanstack/react-query';
import { Quad, Store } from 'n3';
type Fetch = typeof globalThis.fetch;
type Variables = {
[variable: string]: string[] | undefined;
};
export declare const useLDhopQuery: <AdditionalData extends object = object>({ query, variables, fetch, getQueryKey, staleTime, getAdditionalData, }: {
query: RdfQuery;
variables: Variables;
fetch: Fetch;
getQueryKey?: (resource: string) => QueryKey;
staleTime?: number;
getAdditionalData?: (results: UseQueryResult<FetchRdfReturnType, Error>[]) => AdditionalData;
}) => {
store: Store<import("@rdfjs/types").Quad, Quad, import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>;
quads: Quad[];
variables: Variables;
qas: QueryAndStore;
isLoading: boolean;
isMissing: boolean;
} & Omit<AdditionalData & {
data: {
[k: string]: {
data: Quad[];
rawData: string;
hash: string;
ok: boolean;
statusCode: number;
response: Response | undefined;
} | undefined;
};
pending: boolean;
}, "pending" | "data">;
export {};