UNPKG

auth0

Version:

Auth0 Node.js SDK for the Management API v2.

57 lines (56 loc) 2.09 kB
import { type LogConfig, type Logger } from "../logging/logger.mjs"; import type { APIResponse } from "./APIResponse.mjs"; import type { EndpointMetadata } from "./EndpointMetadata.mjs"; export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>; export declare namespace Fetcher { interface Args { url: string; method: string; contentType?: string; headers?: Record<string, unknown>; /** * @deprecated Prefer `queryString` (produced by `core.url.queryBuilder()`). * Retained for backwards compatibility with custom fetchers and callers that * still construct request args with a query-parameter object. */ queryParameters?: Record<string, unknown>; queryString?: string; body?: unknown; timeoutMs?: number; maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; requestType?: "json" | "file" | "bytes" | "form" | "other"; responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response"; duplex?: "half"; endpointMetadata?: EndpointMetadata; fetchFn?: typeof fetch; logging?: LogConfig | Logger; } type Error = FailedStatusCodeError | NonJsonError | BodyIsNullError | TimeoutError | UnknownError; interface FailedStatusCodeError { reason: "status-code"; statusCode: number; body: unknown; } interface NonJsonError { reason: "non-json"; statusCode: number; rawBody: string; } interface BodyIsNullError { reason: "body-is-null"; statusCode: number; } interface TimeoutError { reason: "timeout"; cause?: unknown; } interface UnknownError { reason: "unknown"; errorMessage: string; cause?: unknown; } } export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>; export declare const fetcher: FetchFunction;