arangojs
Version:
The official ArangoDB JavaScript driver.
66 lines • 1.6 kB
TypeScript
/**
* Request handling internals.
*
* @packageDocumentation
* @internal
*/
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
/**
* @internal
*/
export interface ArangojsResponse extends globalThis.Response {
request: globalThis.Request;
parsedBody?: any;
arangojsHostUrl?: string;
}
/**
* @internal
*/
export interface ArangojsError extends Error {
request: globalThis.Request;
toJSON: () => Record<string, any>;
}
/**
* @internal
*/
export type RequestOptions = {
method: string;
pathname: string;
search?: URLSearchParams;
headers: Headers;
body: any;
expectBinary: boolean;
timeout?: number;
};
/**
* @internal
*/
export type RequestConfig = {
credentials: "omit" | "include" | "same-origin";
keepalive: boolean;
beforeRequest?: (req: globalThis.Request) => void;
afterResponse?: (err: ArangojsError | null, res?: ArangojsResponse) => void;
};
/**
* @internal
*/
export type RequestFunction = {
(options: RequestOptions): Promise<ArangojsResponse>;
close?: () => void;
};
/**
* @internal
*/
export declare const isBrowser = false;
/**
* Create a function for performing requests against a given host.
*
* @param baseUrl - Base URL of the host, i.e. protocol, port and domain name.
* @param config - Options to use for creating the agent.
* @param agent - Agent to use for performing requests.
*
* @internal
*/
export declare function createRequest(baseUrl: URL, config: RequestConfig): RequestFunction;
//# sourceMappingURL=request.d.ts.map