mphttpx 1.0.7 → 1.0.8

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.
package/dist/index.d.ts CHANGED
@@ -1,40 +1,33 @@
1
+ /** @type {typeof globalThis.TextEncoder} */
1
2
  declare class TextEncoderP implements TextEncoder {
2
3
  get encoding(): string;
3
4
  encode(input?: string): Uint8Array<ArrayBuffer>;
4
- encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
5
- toString(): string;
6
- get isPolyfill(): {
7
- symbol: symbol;
8
- hierarchy: string[];
9
- };
5
+ encodeInto(...args: Parameters<TextEncoder["encodeInto"]>): TextEncoderEncodeIntoResult;
10
6
  }
11
7
  declare const TextEncoderE: {
12
8
  new (): TextEncoder;
13
9
  prototype: TextEncoder;
14
10
  };
15
11
 
12
+ /** @type {typeof globalThis.TextDecoder} */
16
13
  declare class TextDecoderP implements TextDecoder {
17
- constructor(utfLabel?: string, { fatal, ignoreBOM }?: {
14
+ constructor(label?: string, { fatal, ignoreBOM }?: {
18
15
  fatal?: boolean | undefined;
19
16
  ignoreBOM?: boolean | undefined;
20
17
  });
21
18
  get encoding(): string;
22
19
  get fatal(): boolean;
23
20
  get ignoreBOM(): boolean;
24
- decode(buffer?: Parameters<TextDecoder["decode"]>[0], { stream }?: {
21
+ decode(input?: Parameters<TextDecoder["decode"]>[0], { stream }?: {
25
22
  stream?: boolean | undefined;
26
23
  }): string;
27
- toString(): string;
28
- get isPolyfill(): {
29
- symbol: symbol;
30
- hierarchy: string[];
31
- };
32
24
  }
33
25
  declare const TextDecoderE: {
34
26
  new (label?: string, options?: TextDecoderOptions): TextDecoder;
35
27
  prototype: TextDecoder;
36
28
  };
37
29
 
30
+ /** @type {typeof globalThis.Blob} */
38
31
  declare class BlobP implements Blob {
39
32
  constructor(blobParts?: BlobPart[], options?: BlobPropertyBag);
40
33
  get size(): number;
@@ -44,49 +37,37 @@ declare class BlobP implements Blob {
44
37
  slice(start?: number, end?: number, contentType?: string): Blob;
45
38
  stream(): ReturnType<Blob["stream"]>;
46
39
  text(): Promise<string>;
47
- toString(): string;
48
- get isPolyfill(): {
49
- symbol: symbol;
50
- hierarchy: string[];
51
- };
52
40
  }
53
41
  declare const BlobE: {
54
42
  new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
55
43
  prototype: Blob;
56
44
  };
57
45
 
46
+ /** @type {typeof globalThis.File} */
58
47
  declare class FileP extends BlobP implements File {
59
- constructor(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag);
48
+ constructor(...args: [BlobPart[], string, FilePropertyBag?]);
60
49
  get lastModified(): number;
61
50
  get name(): string;
62
51
  get webkitRelativePath(): string;
63
- toString(): string;
64
- get isPolyfill(): {
65
- symbol: symbol;
66
- hierarchy: string[];
67
- };
68
52
  }
69
53
  declare const FileE: {
70
54
  new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
71
55
  prototype: File;
72
56
  };
73
57
 
58
+ /** @type {typeof globalThis.EventTarget} */
74
59
  declare class EventTargetP implements EventTarget {
75
60
  constructor();
76
- addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
77
- dispatchEvent(event: Event): boolean;
78
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
79
- toString(): string;
80
- get isPolyfill(): {
81
- symbol: symbol;
82
- hierarchy: string[];
83
- };
61
+ addEventListener(...args: [string, EventListenerOrEventListenerObject | null, (AddEventListenerOptions | boolean)?]): void;
62
+ dispatchEvent(...args: [Event]): boolean;
63
+ removeEventListener(...args: [string, EventListenerOrEventListenerObject | null, (EventListenerOptions | boolean)?]): void;
84
64
  }
85
65
  declare const EventTargetE: {
86
66
  new (): EventTarget;
87
67
  prototype: EventTarget;
88
68
  };
89
69
 
70
+ /** @type {typeof globalThis.FileReader} */
90
71
  declare class FileReaderP extends EventTargetP implements FileReader {
91
72
  static readonly EMPTY: 0;
92
73
  static readonly LOADING: 1;
@@ -97,12 +78,12 @@ declare class FileReaderP extends EventTargetP implements FileReader {
97
78
  readonly EMPTY: 0;
98
79
  readonly LOADING: 1;
99
80
  readonly DONE: 2;
100
- get error(): DOMException | null;
81
+ get error(): (DOMException | null);
101
82
  abort(): void;
102
- readAsArrayBuffer(blob: Blob): void;
103
- readAsBinaryString(blob: Blob): void;
104
- readAsDataURL(blob: Blob): void;
105
- readAsText(blob: Blob, encoding?: string): void;
83
+ readAsArrayBuffer(...args: [Blob]): void;
84
+ readAsBinaryString(...args: [Blob]): void;
85
+ readAsDataURL(...args: [Blob]): void;
86
+ readAsText(...args: [Blob, string?]): void;
106
87
  get onabort(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
107
88
  set onabort(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
108
89
  get onerror(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
@@ -115,11 +96,6 @@ declare class FileReaderP extends EventTargetP implements FileReader {
115
96
  set onloadstart(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
116
97
  get onprogress(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
117
98
  set onprogress(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
118
- toString(): string;
119
- get isPolyfill(): {
120
- symbol: symbol;
121
- hierarchy: string[];
122
- };
123
99
  }
124
100
  declare const FileReaderE: {
125
101
  new (): FileReader;
@@ -129,86 +105,75 @@ declare const FileReaderE: {
129
105
  readonly DONE: 2;
130
106
  };
131
107
 
132
- declare class FormDataP implements FormData {
133
- constructor(form?: HTMLFormElement, submitter?: HTMLElement | null);
134
- append(name: string, value: string | Blob, filename?: string): void;
135
- delete(name: string): void;
136
- get(name: string): FormDataEntryValue | null;
137
- getAll(name: string): FormDataEntryValue[];
138
- has(name: string): boolean;
139
- set(name: string, value: string | Blob, filename?: string): void;
140
- forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
141
- entries(): ArrayIterator<[string, FormDataEntryValue]>;
142
- keys(): ArrayIterator<string>;
143
- values(): ArrayIterator<FormDataEntryValue>;
144
- [Symbol.iterator](): ArrayIterator<[string, FormDataEntryValue]>;
145
- toString(): string;
146
- get isPolyfill(): {
147
- symbol: symbol;
148
- hierarchy: string[];
149
- };
150
- }
151
- declare const FormDataE: {
152
- new (form?: HTMLFormElement, submitter?: HTMLElement | null): FormData;
153
- prototype: FormData;
154
- };
155
-
108
+ /** @type {typeof globalThis.URLSearchParams} */
156
109
  declare class URLSearchParamsP implements URLSearchParams {
157
110
  constructor(init?: string[][] | Record<string, string> | string | URLSearchParams);
158
111
  get size(): number;
159
- append(name: string, value: string): void;
160
- delete(name: string, value?: string): void;
161
- get(name: string): string | null;
162
- getAll(name: string): string[];
163
- has(name: string, value?: string): boolean;
164
- set(name: string, value: string): void;
112
+ append(...args: [string, string]): void;
113
+ delete(...args: [string, string?]): void;
114
+ get(...args: [string]): string | null;
115
+ getAll(...args: [string]): string[];
116
+ has(...args: [string, string?]): boolean;
117
+ set(...args: [string, string]): void;
165
118
  sort(): void;
166
- forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
119
+ forEach(...args: [(value: string, key: string, parent: URLSearchParams) => void, any?]): void;
167
120
  entries(): ArrayIterator<[string, string]>;
168
121
  keys(): ArrayIterator<string>;
169
122
  values(): ArrayIterator<string>;
170
123
  [Symbol.iterator](): ArrayIterator<[string, string]>;
171
124
  toString(): string;
172
- get isPolyfill(): {
173
- symbol: symbol;
174
- hierarchy: string[];
175
- };
176
125
  }
177
126
  declare const URLSearchParamsE: {
178
127
  new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
179
128
  prototype: URLSearchParams;
180
129
  };
181
130
 
182
- declare const setXMLHttpRequest: (XHR: (typeof globalThis)["XMLHttpRequest"]) => void;
183
- declare function fetchP(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
184
- declare const fetchE: typeof fetch;
131
+ /** @type {typeof globalThis.FormData} */
132
+ declare class FormDataP implements FormData {
133
+ constructor(form?: HTMLFormElement, submitter?: HTMLElement | null);
134
+ append(...args: [string, string | Blob, string?]): void;
135
+ delete(...args: [string]): void;
136
+ get(...args: [string]): FormDataEntryValue | null;
137
+ getAll(...args: [string]): FormDataEntryValue[];
138
+ has(...args: [string]): boolean;
139
+ set(...args: [string, string | Blob, string?]): void;
140
+ forEach(...args: [(value: FormDataEntryValue, key: string, parent: FormData) => void, any?]): void;
141
+ entries(): ArrayIterator<[string, FormDataEntryValue]>;
142
+ keys(): ArrayIterator<string>;
143
+ values(): ArrayIterator<FormDataEntryValue>;
144
+ [Symbol.iterator](): ArrayIterator<[string, FormDataEntryValue]>;
145
+ }
146
+ declare const FormDataE: {
147
+ new (form?: HTMLFormElement, submitter?: HTMLElement | null): FormData;
148
+ prototype: FormData;
149
+ };
185
150
 
151
+ /** @type {typeof globalThis.Headers} */
186
152
  declare class HeadersP implements Headers {
187
153
  constructor(init?: HeadersInit);
188
- append(name: string, value: string): void;
189
- delete(name: string): void;
190
- get(name: string): string | null;
154
+ append(...args: [string, string]): void;
155
+ delete(...args: [string]): void;
156
+ get(...args: [string]): string | null;
191
157
  getSetCookie(): string[];
192
- has(name: string): boolean;
193
- set(name: string, value: string): void;
194
- forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
158
+ has(...args: [string]): boolean;
159
+ set(...args: [string, string]): void;
160
+ forEach(...args: [(value: string, key: string, parent: Headers) => void, any?]): void;
195
161
  entries(): ArrayIterator<[string, string]>;
196
162
  keys(): ArrayIterator<string>;
197
163
  values(): ArrayIterator<string>;
198
164
  [Symbol.iterator](): ArrayIterator<[string, string]>;
199
- toString(): string;
200
- get isPolyfill(): {
201
- symbol: symbol;
202
- hierarchy: string[];
203
- };
204
165
  }
205
166
  declare const HeadersE: {
206
167
  new (init?: HeadersInit): Headers;
207
168
  prototype: Headers;
208
169
  };
209
170
 
210
- declare class BodyImpl implements Body {
211
- constructor();
171
+ declare const setXMLHttpRequest: (XHR: (typeof globalThis)["XMLHttpRequest"]) => void;
172
+ /** @type {typeof globalThis["fetch"]} */
173
+ declare function fetchP(...args: [RequestInfo | URL, RequestInit?]): Promise<Response>;
174
+ declare const fetchE: typeof fetch;
175
+
176
+ declare abstract class BodyImpl implements Body {
212
177
  get body(): Body["body"];
213
178
  get bodyUsed(): boolean;
214
179
  arrayBuffer(): Promise<ArrayBuffer>;
@@ -217,15 +182,11 @@ declare class BodyImpl implements Body {
217
182
  formData(): Promise<FormData>;
218
183
  json(): Promise<any>;
219
184
  text(): Promise<string>;
220
- toString(): string;
221
- get isPolyfill(): {
222
- symbol: symbol;
223
- hierarchy: string[];
224
- };
225
185
  }
226
186
 
187
+ /** @type {typeof globalThis.Request} */
227
188
  declare class RequestP extends BodyImpl implements Request {
228
- constructor(input: RequestInfo | URL, init?: RequestInit);
189
+ constructor(...args: [RequestInfo | URL, RequestInit?]);
229
190
  get cache(): RequestCache;
230
191
  get credentials(): RequestCredentials;
231
192
  get destination(): RequestDestination;
@@ -240,17 +201,13 @@ declare class RequestP extends BodyImpl implements Request {
240
201
  get signal(): AbortSignal;
241
202
  get url(): string;
242
203
  clone(): Request;
243
- toString(): string;
244
- get isPolyfill(): {
245
- symbol: symbol;
246
- hierarchy: string[];
247
- };
248
204
  }
249
205
  declare const RequestE: {
250
206
  new (input: RequestInfo | URL, init?: RequestInit): Request;
251
207
  prototype: Request;
252
208
  };
253
209
 
210
+ /** @type {typeof globalThis.Response} */
254
211
  declare class ResponseP extends BodyImpl implements Response {
255
212
  constructor(body?: BodyInit | null, init?: ResponseInit);
256
213
  get headers(): Headers;
@@ -261,14 +218,9 @@ declare class ResponseP extends BodyImpl implements Response {
261
218
  get type(): ResponseType;
262
219
  get url(): string;
263
220
  clone(): Response;
264
- static json(data: any, init?: ResponseInit): Response;
221
+ static json(...args: [any, ResponseInit?]): Response;
265
222
  static error(): Response;
266
- static redirect(url: string | URL, status?: number): Response;
267
- toString(): string;
268
- get isPolyfill(): {
269
- symbol: symbol;
270
- hierarchy: string[];
271
- };
223
+ static redirect(...args: [string | URL, number?]): Response;
272
224
  }
273
225
  declare const ResponseE: {
274
226
  new (body?: BodyInit | null, init?: ResponseInit): Response;
@@ -278,36 +230,27 @@ declare const ResponseE: {
278
230
  redirect(url: string | URL, status?: number): Response;
279
231
  };
280
232
 
233
+ /** @type {typeof globalThis.AbortController} */
281
234
  declare class AbortControllerP implements AbortController {
282
235
  constructor();
283
236
  get signal(): AbortSignal;
284
237
  abort(reason?: any): void;
285
- toString(): string;
286
- get isPolyfill(): {
287
- symbol: symbol;
288
- hierarchy: string[];
289
- };
290
238
  }
291
239
  declare const AbortControllerE: {
292
240
  new (): AbortController;
293
241
  prototype: AbortController;
294
242
  };
295
243
 
244
+ /** @type {typeof globalThis.AbortSignal} */
296
245
  declare class AbortSignalP extends EventTargetP implements AbortSignal {
297
246
  static abort(reason?: any): AbortSignal;
298
- static any(signals: AbortSignal[]): AbortSignal;
299
- static timeout(milliseconds: number): AbortSignal;
300
- constructor();
247
+ static any(...args: [AbortSignal[]]): AbortSignal;
248
+ static timeout(...args: [number]): AbortSignal;
301
249
  get aborted(): boolean;
302
250
  get reason(): any;
303
251
  throwIfAborted(): void;
304
252
  get onabort(): ((this: AbortSignal, ev: Event) => any) | null;
305
253
  set onabort(value: ((this: AbortSignal, ev: Event) => any) | null);
306
- toString(): string;
307
- get isPolyfill(): {
308
- symbol: symbol;
309
- hierarchy: string[];
310
- };
311
254
  }
312
255
  declare const AbortSignalE: {
313
256
  new (): AbortSignal;
@@ -317,12 +260,13 @@ declare const AbortSignalE: {
317
260
  timeout(milliseconds: number): AbortSignal;
318
261
  };
319
262
 
263
+ /** @type {typeof globalThis.Event} */
320
264
  declare class EventP implements Event {
321
265
  static readonly NONE: 0;
322
266
  static readonly CAPTURING_PHASE: 1;
323
267
  static readonly AT_TARGET: 2;
324
268
  static readonly BUBBLING_PHASE: 3;
325
- constructor(type: string, eventInitDict?: EventInit);
269
+ constructor(...args: [string, EventInit?]);
326
270
  get type(): string;
327
271
  get bubbles(): boolean;
328
272
  get cancelable(): boolean;
@@ -343,15 +287,10 @@ declare class EventP implements Event {
343
287
  readonly isTrusted: boolean;
344
288
  get timeStamp(): number;
345
289
  composedPath(): EventTarget[];
346
- initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
290
+ initEvent(...args: [string, boolean?, boolean?]): void;
347
291
  preventDefault(): void;
348
292
  stopImmediatePropagation(): void;
349
293
  stopPropagation(): void;
350
- toString(): string;
351
- get isPolyfill(): {
352
- symbol: symbol;
353
- hierarchy: string[];
354
- };
355
294
  }
356
295
  declare const EventE: {
357
296
  new (type: string, eventInitDict?: EventInit): Event;
@@ -362,39 +301,31 @@ declare const EventE: {
362
301
  readonly BUBBLING_PHASE: 3;
363
302
  };
364
303
 
304
+ /** @type {typeof globalThis.CustomEvent} */
365
305
  declare class CustomEventP<T> extends EventP implements CustomEvent {
366
306
  constructor(type: string, eventInitDict?: CustomEventInit<T>);
367
307
  get detail(): T;
368
- initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void;
369
- toString(): string;
370
- get isPolyfill(): {
371
- symbol: symbol;
372
- hierarchy: string[];
373
- };
308
+ initCustomEvent(...args: [string, boolean?, boolean?, T?]): void;
374
309
  }
375
310
  declare const CustomEventE: {
376
311
  new <T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
377
312
  prototype: CustomEvent;
378
313
  };
379
314
 
315
+ /** @type {typeof globalThis.ProgressEvent} */
380
316
  declare class ProgressEventP extends EventP implements ProgressEvent {
381
317
  constructor(type: string, eventInitDict?: ProgressEventInit);
382
318
  get lengthComputable(): boolean;
383
319
  get loaded(): number;
384
320
  get total(): number;
385
- toString(): string;
386
- get isPolyfill(): {
387
- symbol: symbol;
388
- hierarchy: string[];
389
- };
390
321
  }
391
322
  declare const ProgressEventE: {
392
323
  new (type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
393
324
  prototype: ProgressEvent;
394
325
  };
395
326
 
327
+ /** @type {typeof globalThis.XMLHttpRequestEventTarget} */
396
328
  declare class XMLHttpRequestEventTargetP extends EventTargetP implements XMLHttpRequestEventTarget {
397
- constructor();
398
329
  get onabort(): ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
399
330
  set onabort(value: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null);
400
331
  get onerror(): ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
@@ -409,11 +340,6 @@ declare class XMLHttpRequestEventTargetP extends EventTargetP implements XMLHttp
409
340
  set onprogress(value: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null);
410
341
  get ontimeout(): ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
411
342
  set ontimeout(value: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null);
412
- toString(): string;
413
- get isPolyfill(): {
414
- symbol: symbol;
415
- hierarchy: string[];
416
- };
417
343
  }
418
344
 
419
345
  /**
@@ -762,6 +688,7 @@ interface IRequestTask {
762
688
  }
763
689
 
764
690
  declare const setRequest: (request: TRequestFunc) => void;
691
+ /** @type {typeof globalThis.XMLHttpRequest} */
765
692
  declare class XMLHttpRequestP extends XMLHttpRequestEventTargetP implements XMLHttpRequest {
766
693
  static readonly UNSENT: 0;
767
694
  static readonly OPENED: 1;
@@ -790,18 +717,13 @@ declare class XMLHttpRequestP extends XMLHttpRequestEventTargetP implements XMLH
790
717
  set withCredentials(value: boolean);
791
718
  abort(): void;
792
719
  getAllResponseHeaders(): string;
793
- getResponseHeader(name: string): string | null;
720
+ getResponseHeader(...args: [string]): string | null;
794
721
  open(...args: [method: string, url: string | URL, async?: boolean, username?: string | null, password?: string | null]): void;
795
- overrideMimeType(mime: string): void;
722
+ overrideMimeType(...args: [string]): void;
796
723
  send(body?: Document | XMLHttpRequestBodyInit | null): void;
797
- setRequestHeader(name: string, value: string): void;
724
+ setRequestHeader(...args: [string, string]): void;
798
725
  get onreadystatechange(): ((this: XMLHttpRequest, ev: Event) => any) | null;
799
726
  set onreadystatechange(value: ((this: XMLHttpRequest, ev: Event) => any) | null);
800
- toString(): string;
801
- get isPolyfill(): {
802
- symbol: symbol;
803
- hierarchy: string[];
804
- };
805
727
  }
806
728
  declare const XMLHttpRequestE: {
807
729
  new (): XMLHttpRequest;