@trpc/client
Version:
46 lines • 1.84 kB
text/typescript
import { _ as NonEmptyArray, n as Operation, t as HTTPHeaders, u as TRPCLink } from "./types-BrCJd1zp.cjs";
import { t as HTTPLinkBaseOptions } from "./httpUtils-j-oJ4G4z.cjs";
import { AnyClientTypes } from "@trpc/server/unstable-core-do-not-import";
import { AnyRouter as AnyRouter$1 } from "@trpc/server";
//#region src/links/HTTPBatchLinkOptions.d.ts
/**
* The options of `httpBatchLink`.
* @see https://trpc.io/docs/client/links/httpBatchLink#options
*/
type HTTPBatchLinkOptions<TRoot extends AnyClientTypes> = HTTPLinkBaseOptions<TRoot> & {
/**
* The longest URL a batched GET request can have. Calls that would
* make it longer go in another batch. A call too long on its own
* fails.
* @see https://trpc.io/docs/client/links/httpBatchLink#setting-a-maximum-url-length
* @default Infinity
*/
maxURLLength?: number;
/**
* Headers for each request: an object, or a function of the batch's
* operations that returns them.
* @see https://trpc.io/docs/client/headers
*/
headers?: HTTPHeaders | ((opts: {
opList: NonEmptyArray<Operation>;
}) => HTTPHeaders | Promise<HTTPHeaders>);
/**
* The most calls one batch can have. Set it to the server's
* `maxBatchSize` or lower.
* @see https://trpc.io/docs/client/links/httpBatchLink#limiting-batch-size
* @default Infinity
*/
maxItems?: number;
};
//#endregion
//#region src/links/httpBatchLink.d.ts
/**
* A terminating link that batches calls made in the same tick into one HTTP
* request.
*
* @see https://trpc.io/docs/client/links/httpBatchLink
*/
declare function httpBatchLink<TRouter extends AnyRouter$1>(opts: HTTPBatchLinkOptions<TRouter['_def']['_config']['$types']>): TRPCLink<TRouter>;
//#endregion
export { HTTPBatchLinkOptions as n, httpBatchLink as t };
//# sourceMappingURL=httpBatchLink-CRRfyw0c.d.cts.map