///
import * as net from 'net';
import * as tls from 'tls';
import * as http from 'http';
import { OutgoingHttpHeaders, RequestOptions } from 'http';
type Protocol = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
type ConnectOptsMap = {
http: Omit;
https: Omit;
};
type ConnectOpts = {
[P in keyof ConnectOptsMap]: Protocol extends P ? ConnectOptsMap[P] : never;
}[keyof ConnectOptsMap];
type HttpsProxyAgentOptions = ConnectOpts & http.AgentOptions & {
headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
};
declare const FormData: {
new (): FormData;
prototype: FormData;
};
/** @type {typeof globalThis.Blob} */
declare const Blob: typeof globalThis.Blob;
type AbortSignal$1 = {
readonly aborted: boolean;
addEventListener: (type: 'abort', listener: (this: AbortSignal$1) => void) => void;
removeEventListener: (type: 'abort', listener: (this: AbortSignal$1) => void) => void;
};
type HeadersInit = Headers | Record | Iterable | Iterable>;
/**
* This Fetch API interface allows you to perform various actions on HTTP request and response headers.
* These actions include retrieving, setting, adding to, and removing.
* A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.
* You can add to this using methods like append() (see Examples.)
* In all methods of this interface, header names are matched by case-insensitive byte sequence.
* */
declare class Headers {
constructor(init?: HeadersInit);
append(name: string, value: string): void;
delete(name: string): void;
get(name: string): string | null;
has(name: string): boolean;
set(name: string, value: string): void;
forEach(
callbackfn: (value: string, key: string, parent: Headers) => void,
thisArg?: any
): void;
[Symbol.iterator](): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all key/value pairs contained in this object.
*/
entries(): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
*/
keys(): IterableIterator;
/**
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
*/
values(): IterableIterator;
/** Node-fetch extension */
raw(): Record;
}
interface RequestInit {
/**
* A BodyInit object or null to set request's body.
*/
body?: BodyInit | null;
/**
* A Headers object, an object literal, or an array of two-item arrays to set request's headers.
*/
headers?: HeadersInit;
/**
* A string to set request's method.
*/
method?: string;
/**
* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.
*/
redirect?: RequestRedirect;
/**
* An AbortSignal to set request's signal.
*/
signal?: AbortSignal$1 | null;
/**
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request’s referrer.
*/
referrer?: string;
/**
* A referrer policy to set request’s referrerPolicy.
*/
referrerPolicy?: ReferrerPolicy;
// Node-fetch extensions to the whatwg/fetch spec
agent?: RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']);
compress?: boolean;
counter?: number;
follow?: number;
hostname?: string;
port?: number;
protocol?: string;
size?: number;
highWaterMark?: number;
insecureHTTPParser?: boolean;
}
interface ResponseInit {
headers?: HeadersInit;
status?: number;
statusText?: string;
}
type BodyInit =
| Blob
| Buffer
| URLSearchParams
| FormData
| NodeJS.ReadableStream
| string;
declare class BodyMixin {
constructor(body?: BodyInit, options?: {size?: number});
readonly body: NodeJS.ReadableStream | null;
readonly bodyUsed: boolean;
readonly size: number;
/** @deprecated Use `body.arrayBuffer()` instead. */
buffer(): Promise;
arrayBuffer(): Promise;
formData(): Promise;
blob(): Promise;
json(): Promise;
text(): Promise;
}
type RequestRedirect = 'error' | 'follow' | 'manual';
type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
declare class Response extends BodyMixin {
constructor(body?: BodyInit | null, init?: ResponseInit);
readonly headers: Headers;
readonly ok: boolean;
readonly redirected: boolean;
readonly status: number;
readonly statusText: string;
readonly type: ResponseType;
readonly url: string;
clone(): Response;
static error(): Response;
static redirect(url: string, status?: number): Response;
}
interface HTTPClientOptions {
headers?: Record;
retries?: number;
}
interface HTTPClientFetchOptions {
noLogErrorBody?: boolean;
proxy?: HttpsProxyAgentOptions;
retries?: number;
}
/**
* A basic wrapper class for fetch with the ability to retry fetches
*/
declare class HTTPClient {
env: Context['env'];
log: Context['log'];
headers: Record;
retries: number;
constructor({ env, log }: Pick, { headers, retries }?: HTTPClientOptions);
fetch(url: string, options?: RequestInit, options_?: HTTPClientFetchOptions): Promise;
fetchBuffer(url: any, options: any): Promise;
}
/**
* Interact with a GraphQL server using fetch and retries.
*/
declare class GraphQLClient {
endpoint: string;
headers: Record;
client: HTTPClient;
constructor(ctx: InitialContext, endpoint: string, httpClientOptions: HTTPClientOptions);
setAuthorization(token: string): void;
runQuery(query: string, variables: Record, { endpoint, headers, retries }?: {
endpoint?: string | undefined;
headers?: {} | undefined;
retries?: number | undefined;
}): Promise;
}
declare type Primitive = string | number | symbol | bigint | boolean | null | undefined;
declare namespace util {
type AssertEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? true : false;
export type isAny = 0 extends 1 & T ? true : false;
export const assertEqual: (val: AssertEqual) => AssertEqual;
export function assertIs(_arg: T): void;
export function assertNever(_x: never): never;
export type Omit = Pick>;
export type OmitKeys = Pick>;
export type MakePartial = Omit & Partial>;
export type Exactly = T & Record, never>;
export const arrayToEnum: (items: U) => { [k in U[number]]: k; };
export const getValidEnumValues: (obj: any) => any[];
export const objectValues: (obj: any) => any[];
export const objectKeys: ObjectConstructor["keys"];
export const find: (arr: T[], checker: (arg: T) => any) => T | undefined;
export type identity = objectUtil.identity;
export type flatten = objectUtil.flatten;
export type noUndefined = T extends undefined ? never : T;
export const isInteger: NumberConstructor["isInteger"];
export function joinValues(array: T, separator?: string): string;
export const jsonStringifyReplacer: (_: string, value: any) => any;
export {};
}
declare namespace objectUtil {
export type MergeShapes = {
[k in Exclude]: U[k];
} & V;
type optionalKeys = {
[k in keyof T]: undefined extends T[k] ? k : never;
}[keyof T];
type requiredKeys = {
[k in keyof T]: undefined extends T[k] ? never : k;
}[keyof T];
export type addQuestionMarks = {
[K in requiredKeys]: T[K];
} & {
[K in optionalKeys]?: T[K];
} & {
[k in keyof T]?: unknown;
};
export type identity = T;
export type flatten = identity<{
[k in keyof T]: T[k];
}>;
export type noNeverKeys = {
[k in keyof T]: [T[k]] extends [never] ? never : k;
}[keyof T];
export type noNever = identity<{
[k in noNeverKeys]: k extends keyof T ? T[k] : never;
}>;
export const mergeShapes: (first: U, second: T) => T & U;
export type extendShape = {
[K in keyof A as K extends keyof B ? never : K]: A[K];
} & {
[K in keyof B]: B[K];
};
export {};
}
declare const ZodParsedType: {
function: "function";
number: "number";
string: "string";
nan: "nan";
integer: "integer";
float: "float";
boolean: "boolean";
date: "date";
bigint: "bigint";
symbol: "symbol";
undefined: "undefined";
null: "null";
array: "array";
object: "object";
unknown: "unknown";
promise: "promise";
void: "void";
never: "never";
map: "map";
set: "set";
};
declare type ZodParsedType = keyof typeof ZodParsedType;
declare type allKeys = T extends any ? keyof T : never;
declare type typeToFlattenedError = {
formErrors: U[];
fieldErrors: {
[P in allKeys]?: U[];
};
};
declare const ZodIssueCode: {
invalid_type: "invalid_type";
invalid_literal: "invalid_literal";
custom: "custom";
invalid_union: "invalid_union";
invalid_union_discriminator: "invalid_union_discriminator";
invalid_enum_value: "invalid_enum_value";
unrecognized_keys: "unrecognized_keys";
invalid_arguments: "invalid_arguments";
invalid_return_type: "invalid_return_type";
invalid_date: "invalid_date";
invalid_string: "invalid_string";
too_small: "too_small";
too_big: "too_big";
invalid_intersection_types: "invalid_intersection_types";
not_multiple_of: "not_multiple_of";
not_finite: "not_finite";
};
declare type ZodIssueCode = keyof typeof ZodIssueCode;
declare type ZodIssueBase = {
path: (string | number)[];
message?: string;
};
interface ZodInvalidTypeIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_type;
expected: ZodParsedType;
received: ZodParsedType;
}
interface ZodInvalidLiteralIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_literal;
expected: unknown;
received: unknown;
}
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
code: typeof ZodIssueCode.unrecognized_keys;
keys: string[];
}
interface ZodInvalidUnionIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_union;
unionErrors: ZodError[];
}
interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_union_discriminator;
options: Primitive[];
}
interface ZodInvalidEnumValueIssue extends ZodIssueBase {
received: string | number;
code: typeof ZodIssueCode.invalid_enum_value;
options: (string | number)[];
}
interface ZodInvalidArgumentsIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_arguments;
argumentsError: ZodError;
}
interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_return_type;
returnTypeError: ZodError;
}
interface ZodInvalidDateIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_date;
}
declare type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "base64" | {
includes: string;
position?: number;
} | {
startsWith: string;
} | {
endsWith: string;
};
interface ZodInvalidStringIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_string;
validation: StringValidation;
}
interface ZodTooSmallIssue extends ZodIssueBase {
code: typeof ZodIssueCode.too_small;
minimum: number | bigint;
inclusive: boolean;
exact?: boolean;
type: "array" | "string" | "number" | "set" | "date" | "bigint";
}
interface ZodTooBigIssue extends ZodIssueBase {
code: typeof ZodIssueCode.too_big;
maximum: number | bigint;
inclusive: boolean;
exact?: boolean;
type: "array" | "string" | "number" | "set" | "date" | "bigint";
}
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_intersection_types;
}
interface ZodNotMultipleOfIssue extends ZodIssueBase {
code: typeof ZodIssueCode.not_multiple_of;
multipleOf: number | bigint;
}
interface ZodNotFiniteIssue extends ZodIssueBase {
code: typeof ZodIssueCode.not_finite;
}
interface ZodCustomIssue extends ZodIssueBase {
code: typeof ZodIssueCode.custom;
params?: {
[k: string]: any;
};
}
declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
declare type ZodIssue = ZodIssueOptionalMessage & {
fatal?: boolean;
message: string;
};
declare type recursiveZodFormattedError = T extends [any, ...any[]] ? {
[K in keyof T]?: ZodFormattedError;
} : T extends any[] ? {
[k: number]: ZodFormattedError;
} : T extends object ? {
[K in keyof T]?: ZodFormattedError;
} : unknown;
declare type ZodFormattedError = {
_errors: U[];
} & recursiveZodFormattedError>;
declare class ZodError extends Error {
issues: ZodIssue[];
get errors(): ZodIssue[];
constructor(issues: ZodIssue[]);
format(): ZodFormattedError;
format(mapper: (issue: ZodIssue) => U): ZodFormattedError;
static create: (issues: ZodIssue[]) => ZodError;
static assert(value: unknown): asserts value is ZodError;
toString(): string;
get message(): string;
get isEmpty(): boolean;
addIssue: (sub: ZodIssue) => void;
addIssues: (subs?: ZodIssue[]) => void;
flatten(): typeToFlattenedError;
flatten(mapper?: (issue: ZodIssue) => U): typeToFlattenedError;
get formErrors(): typeToFlattenedError;
}
declare type stripPath = T extends any ? util.OmitKeys : never;
declare type IssueData = stripPath & {
path?: (string | number)[];
fatal?: boolean;
};
declare type ErrorMapCtx = {
defaultError: string;
data: any;
};
declare type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
message: string;
};
declare type ParseParams = {
path: (string | number)[];
errorMap: ZodErrorMap;
async: boolean;
};
declare type ParsePathComponent = string | number;
declare type ParsePath = ParsePathComponent[];
interface ParseContext {
readonly common: {
readonly issues: ZodIssue[];
readonly contextualErrorMap?: ZodErrorMap;
readonly async: boolean;
};
readonly path: ParsePath;
readonly schemaErrorMap?: ZodErrorMap;
readonly parent: ParseContext | null;
readonly data: any;
readonly parsedType: ZodParsedType;
}
declare type ParseInput = {
data: any;
path: (string | number)[];
parent: ParseContext;
};
declare class ParseStatus {
value: "aborted" | "dirty" | "valid";
dirty(): void;
abort(): void;
static mergeArray(status: ParseStatus, results: SyncParseReturnType[]): SyncParseReturnType;
static mergeObjectAsync(status: ParseStatus, pairs: {
key: ParseReturnType;
value: ParseReturnType;
}[]): Promise>;
static mergeObjectSync(status: ParseStatus, pairs: {
key: SyncParseReturnType;
value: SyncParseReturnType;
alwaysSet?: boolean;
}[]): SyncParseReturnType;
}
declare type INVALID = {
status: "aborted";
};
declare const INVALID: INVALID;
declare type DIRTY = {
status: "dirty";
value: T;
};
declare const DIRTY: (value: T) => DIRTY;
declare type OK = {
status: "valid";
value: T;
};
declare const OK: (value: T) => OK;
declare type SyncParseReturnType = OK | DIRTY | INVALID;
declare type AsyncParseReturnType = Promise>;
declare type ParseReturnType = SyncParseReturnType | AsyncParseReturnType;
declare namespace enumUtil {
type UnionToIntersectionFn = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
type GetUnionLast = UnionToIntersectionFn extends () => infer Last ? Last : never;
type UnionToTuple = [T] extends [never] ? Tuple : UnionToTuple>, [GetUnionLast, ...Tuple]>;
type CastToStringTuple = T extends [string, ...string[]] ? T : never;
export type UnionToTupleString = CastToStringTuple>;
export {};
}
declare namespace errorUtil {
type ErrMessage = string | {
message?: string;
};
const errToObj: (message?: ErrMessage | undefined) => {
message?: string | undefined;
};
const toString: (message?: ErrMessage | undefined) => string | undefined;
}
declare namespace partialUtil {
type DeepPartial = T extends ZodObject ? ZodObject<{
[k in keyof T["shape"]]: ZodOptional>;
}, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray ? ZodArray, Card> : T extends ZodOptional ? ZodOptional> : T extends ZodNullable ? ZodNullable> : T extends ZodTuple ? {
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial : never;
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple : never : never : T;
}
interface RefinementCtx {
addIssue: (arg: IssueData) => void;
path: (string | number)[];
}
declare type ZodRawShape = {
[k: string]: ZodTypeAny;
};
declare type ZodTypeAny = ZodType;
declare type TypeOf> = T["_output"];
declare type input> = T["_input"];
declare type output> = T["_output"];
declare type CustomErrorParams = Partial>;
interface ZodTypeDef {
errorMap?: ZodErrorMap;
description?: string;
}
declare type RawCreateParams = {
errorMap?: ZodErrorMap;
invalid_type_error?: string;
required_error?: string;
message?: string;
description?: string;
} | undefined;
declare type SafeParseSuccess