@whatwg-node/node-fetch 0.0.1-alpha-20221005123855-1e2f172

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ import { PonyfillAbortSignal } from "./AbortSignal";
2
+ export declare class PonyfillAbortController implements AbortController {
3
+ signal: PonyfillAbortSignal;
4
+ abort(reason?: any): void;
5
+ }
@@ -0,0 +1,3 @@
1
+ export declare class PonyfillAbortError extends Error {
2
+ constructor();
3
+ }
@@ -0,0 +1,8 @@
1
+ export declare class PonyfillAbortSignal extends EventTarget implements AbortSignal {
2
+ aborted: boolean;
3
+ _onabort: ((this: AbortSignal, ev: Event) => any) | null;
4
+ reason: any;
5
+ throwIfAborted(): void;
6
+ get onabort(): ((this: AbortSignal, ev: Event) => any) | null;
7
+ set onabort(value: ((this: AbortSignal, ev: Event) => any) | null);
8
+ }
package/Blob.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const PonyfillBlob: {
2
+ new (blobParts?: BlobPart[] | undefined, options?: BlobPropertyBag | undefined): Blob;
3
+ prototype: Blob;
4
+ };
5
+ export declare type PonyfillBlob = Blob;
package/Body.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
2
+ import { PonyfillBlob } from './Blob';
3
+ import { Readable } from "stream";
4
+ import { PonyfillFormData } from "./FormData";
5
+ import { PonyfillReadableStream } from "./ReadableStream";
6
+ export declare type BodyPonyfillInit = XMLHttpRequestBodyInit | Readable | PonyfillReadableStream<Uint8Array>;
7
+ export declare class BodyPonyfill implements Body {
8
+ private bodyInit;
9
+ bodyUsed: boolean;
10
+ contentType: string | null;
11
+ contentLength: number | null;
12
+ constructor(bodyInit: BodyPonyfillInit | null);
13
+ private bodyType?;
14
+ private _bodyProcessed;
15
+ private _processedBody;
16
+ get body(): PonyfillReadableStream<Uint8Array> | null;
17
+ private processBody;
18
+ arrayBuffer(): Promise<ArrayBuffer>;
19
+ blob(): Promise<PonyfillBlob>;
20
+ formData(): Promise<PonyfillFormData>;
21
+ json(): Promise<any>;
22
+ text(): Promise<string>;
23
+ readable(): Readable | null;
24
+ }
package/File.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { PonyfillBlob } from "./Blob";
2
+ export declare class PonyfillFile extends PonyfillBlob implements File {
3
+ name: string;
4
+ lastModified: number;
5
+ constructor(fileBits: BlobPart[], name: string, options?: FilePropertyBag);
6
+ webkitRelativePath: string;
7
+ }
package/FormData.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { PonyfillBlob } from './Blob';
2
+ export declare class PonyfillFormData implements FormData {
3
+ private map;
4
+ append(name: string, value: PonyfillBlob | string, fileName?: string): void;
5
+ delete(name: string): void;
6
+ get(name: string): FormDataEntryValue | null;
7
+ getAll(name: string): FormDataEntryValue[];
8
+ has(name: string): boolean;
9
+ set(name: string, value: PonyfillBlob | string, fileName?: string): void;
10
+ private getNormalizedFile;
11
+ forEach(callback: (value: FormDataEntryValue, key: string, parent: this) => void): void;
12
+ }
package/Headers.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export declare type PonyfillHeadersInit = [string, string][] | Record<string, string | string[] | undefined> | Headers;
2
+ export declare class PonyfillHeaders implements Headers {
3
+ private map;
4
+ constructor(headersInit?: PonyfillHeadersInit);
5
+ append(name: string, value: string): void;
6
+ get(name: string): string | null;
7
+ has(name: string): boolean;
8
+ set(name: string, value: string): void;
9
+ delete(name: string): void;
10
+ forEach(callback: (value: string, key: string, parent: Headers) => void): void;
11
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="node" />
2
+ import { Readable } from "stream";
3
+ export declare class PonyfillReadableStream<T> implements ReadableStream<T> {
4
+ readable: Readable;
5
+ constructor(underlyingSource?: UnderlyingSource<T> | Readable | ReadableStream<T> | PonyfillReadableStream<T>);
6
+ cancel(reason?: any): Promise<void>;
7
+ locked: boolean;
8
+ getReader(): ReadableStreamDefaultReader<T>;
9
+ [Symbol.asyncIterator](): AsyncIterableIterator<any>;
10
+ tee(): [ReadableStream<T>, ReadableStream<T>];
11
+ pipeTo(destination: WritableStream<T>): Promise<void>;
12
+ pipeThrough<T2>({ writable, readable }: {
13
+ writable: WritableStream<T>;
14
+ readable: ReadableStream<T2>;
15
+ }): ReadableStream<T2>;
16
+ }
package/Request.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { BodyPonyfill, BodyPonyfillInit } from "./Body";
2
+ import { PonyfillHeadersInit } from "./Headers";
3
+ export declare type RequestPonyfillInit = Omit<RequestInit, 'body' | 'headers'> & {
4
+ body?: BodyPonyfillInit | null;
5
+ headers?: PonyfillHeadersInit;
6
+ };
7
+ export declare class PonyfillRequest extends BodyPonyfill implements Request {
8
+ constructor(input: RequestInfo | URL, options?: RequestPonyfillInit);
9
+ get body(): import("./ReadableStream").PonyfillReadableStream<Uint8Array> | null;
10
+ private postProcessedBody;
11
+ private postProcessBody;
12
+ cache: RequestCache;
13
+ credentials: RequestCredentials;
14
+ destination: RequestDestination;
15
+ headers: Headers;
16
+ integrity: string;
17
+ keepalive: boolean;
18
+ method: string;
19
+ mode: RequestMode;
20
+ priority: string;
21
+ redirect: RequestRedirect;
22
+ referrer: string;
23
+ referrerPolicy: ReferrerPolicy;
24
+ url: string;
25
+ signal: AbortSignal;
26
+ clone(): Request;
27
+ }
package/Response.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { BodyPonyfill, BodyPonyfillInit } from "./Body";
2
+ import { PonyfillHeadersInit } from "./Headers";
3
+ export declare type ResponsePonyfilInit = Omit<ResponseInit, 'headers'> & {
4
+ url?: string;
5
+ redirected?: boolean;
6
+ headers?: PonyfillHeadersInit;
7
+ };
8
+ export declare class PonyfillResponse extends BodyPonyfill implements Response {
9
+ constructor(body?: BodyPonyfillInit | null, init?: ResponsePonyfilInit);
10
+ headers: Headers;
11
+ get ok(): boolean;
12
+ status: number;
13
+ statusText: string;
14
+ url: string;
15
+ redirected: boolean;
16
+ type: ResponseType;
17
+ clone(): PonyfillResponse;
18
+ static error(): PonyfillResponse;
19
+ static redirect(url: string, status?: number): PonyfillResponse;
20
+ }
package/fetch.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { PonyfillRequest, RequestPonyfillInit } from "./Request";
2
+ import { PonyfillResponse } from "./Response";
3
+ export declare const fetchPonyfill: (info: string | PonyfillRequest | URL, init?: RequestPonyfillInit) => Promise<PonyfillResponse>;
package/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export { fetchPonyfill as fetch } from './fetch';
2
+ export { PonyfillHeaders as Headers } from './Headers';
3
+ export { PonyfillRequest as Request, RequestPonyfillInit as RequestInit } from './Request';
4
+ export { PonyfillResponse as Response, ResponsePonyfilInit as ResponseInit } from './Response';
5
+ export { PonyfillReadableStream as ReadableStream } from './ReadableStream';
6
+ export { PonyfillFile as File } from './File';
7
+ export { PonyfillFormData as FormData } from './FormData';
8
+ export { PonyfillAbortController as AbortController } from './AbortController';
9
+ export { PonyfillAbortSignal as AbortSignal } from './AbortSignal';
10
+ export { PonyfillAbortError as AbortError } from './AbortError';
11
+ export { PonyfillBlob as Blob } from './Blob';