@types/relay-runtime
Version:
TypeScript definitions for relay-runtime
22 lines (18 loc) • 756 B
TypeScript
import { PayloadData } from "../network/RelayNetworkTypes";
import { MutableRecordSource, NormalizationSelector, RelayResponsePayload, RequestDescriptor } from "./RelayStoreTypes";
export type GetDataID = (fieldValue: { [key: string]: any }, typeName: string) => any;
export interface NormalizationOptions {
getDataID: GetDataID;
path?: readonly string[] | undefined;
request: RequestDescriptor;
}
/**
* Normalizes the results of a query and standard GraphQL response, writing the
* normalized records/fields into the given MutableRecordSource.
*/
export function normalize(
recordSource: MutableRecordSource,
selector: NormalizationSelector,
response: PayloadData,
options: NormalizationOptions,
): RelayResponsePayload;