import type { ExecutionDetails } from "../index.ts"; import type { GrafastResultsList, Maybe, PromiseOrDirect, Thunk } from "../interfaces.ts"; import type { Multistep, UnwrapMultistep } from "../multistep.ts"; import { Step } from "../step.ts"; import type { IOEquivalence } from "./_loadCommon.ts"; export interface LoadOneInfo, TShared = never> { shared: TShared; attributes: ReadonlyArray; params: Partial; /** @deprecated Please use 'shared' instead. It's simply renamed */ unary: TShared; } export type LoadOneCallback = Maybe, TParams extends Record = Record, TUnarySpec = never> = { (specs: ReadonlyArray, info: LoadOneInfo): PromiseOrDirect>; displayName?: string; }; /** * A TypeScript Identity Function to help you strongly type your * LoadOneCallback. */ export declare function loadOneCallback = Maybe, TParams extends Record = Record, TUnarySpec = never>(load: LoadOneCallback): LoadOneCallback; /** * A TypeScript Identity Function to help you strongly type your * LoadOneLoader. */ export declare function loadOneLoader = Maybe, TParams extends Record = Record, TShared extends Multistep = never>(load: LoadOneLoader): LoadOneLoader; export declare class LoadOneStep, TParams extends Record, const TShared extends Multistep = never> extends Step { static $$export: { moduleName: string; exportName: string; }; isSyncAndSafe: boolean; loadInfo: Omit>, "shared" | "unary" | "params"> | null; loadInfoKey: string; attributes: Set; paramDepIdByKey: { [TKey in keyof TParams]: number; }; sharedDepId: number | null; private ioEquivalence; private load; private name; constructor(lookup: TLookup, loader: LoadOneLoader, TItem, TData, TParams, TShared>); toStringMeta(): string | null; private _accessMap; private getAccessMap; setParam(paramKey: TParamKey, value: TParams[TParamKey] | Step): void; addAttributes(attributes: Set): void; deduplicate(peers: readonly LoadOneStep[]): LoadOneStep[]; deduplicatedWith(replacement: LoadOneStep): void; _paramSig?: string; getParamSignature(): string; finalize(): void; execute(details: ExecutionDetails): PromiseOrDirect>; get(attr: keyof TItem & (string | number)): Step; private _getInner; } export interface LoadOneLoader = Maybe, TParams extends Record = Record, TShared extends Multistep = never> { /** * The function that actually loads data from the backend */ load: LoadOneCallback>; /** Name your function (for plan diagrams/debugging) */ name?: string; /** * Details of anything your `load` function will need access to, for example * database connections, API clients, etc. */ shared?: Thunk; /** * Details of which attributes on the output are equivalent to those on the * input (if any), useful for reducing unnecessary fetches (e.g. load the * friends of a user by their id without ever loading the user). */ ioEquivalence?: IOEquivalence; } /** * Loads an individual record identified by the `lookup` using the `loader`. * * @param lookup - A step/multistep representing the value to look up - could be an * identifier or combination of identifiers. * @param loader - The function to load this, or a LoadManyLoader object containing such a function */ export declare function loadOne = Maybe, TParams extends Record = Record, const TShared extends Multistep = never>(lookup: TLookup, loader: LoadOneCallback, TItem, TData, TParams, never> | LoadOneLoader, TItem, TData, TParams, TShared>): LoadOneStep, TItem, TData, TParams, TShared>; //# sourceMappingURL=loadOne.d.ts.map