@whatwg-node/node-fetch 0.4.11 → 0.4.12-alpha-20230807152742-5fe256c
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/cjs/Blob.js +7 -7
- package/cjs/Body.js +30 -31
- package/cjs/fetch.js +4 -3
- package/cjs/utils.js +35 -1
- package/esm/Blob.js +7 -7
- package/esm/Body.js +31 -32
- package/esm/fetch.js +4 -3
- package/esm/utils.js +33 -0
- package/package.json +1 -1
- package/typings/FormData.d.cts +4 -2
- package/typings/FormData.d.ts +4 -2
- package/typings/utils.d.cts +1 -0
- package/typings/utils.d.ts +1 -0
package/cjs/Blob.js
CHANGED
@@ -47,9 +47,8 @@ class PonyfillBlob {
|
|
47
47
|
}
|
48
48
|
return Buffer.concat(bufferChunks);
|
49
49
|
}
|
50
|
-
|
51
|
-
|
52
|
-
return (0, utils_js_1.uint8ArrayToArrayBuffer)(buffer);
|
50
|
+
arrayBuffer() {
|
51
|
+
return this.buffer().then(utils_js_1.uint8ArrayToArrayBuffer);
|
53
52
|
}
|
54
53
|
async text() {
|
55
54
|
let text = '';
|
@@ -94,13 +93,14 @@ class PonyfillBlob {
|
|
94
93
|
controller.close();
|
95
94
|
}
|
96
95
|
},
|
97
|
-
pull:
|
96
|
+
pull: controller => {
|
98
97
|
const blobPart = partQueue.pop();
|
99
98
|
if (blobPart) {
|
100
99
|
if (isBlob(blobPart)) {
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
return blobPart.arrayBuffer().then(arrayBuffer => {
|
101
|
+
const buf = Buffer.from(arrayBuffer, undefined, blobPart.size);
|
102
|
+
controller.enqueue(buf);
|
103
|
+
});
|
104
104
|
}
|
105
105
|
else {
|
106
106
|
const buf = getBlobPartAsBuffer(blobPart);
|
package/cjs/Body.js
CHANGED
@@ -69,25 +69,23 @@ class PonyfillBody {
|
|
69
69
|
}
|
70
70
|
return null;
|
71
71
|
}
|
72
|
-
|
72
|
+
arrayBuffer() {
|
73
73
|
if (this.bodyType === BodyInitType.ArrayBuffer) {
|
74
|
-
return this.bodyInit;
|
74
|
+
return (0, utils_js_1.fakePromise)(this.bodyInit);
|
75
75
|
}
|
76
76
|
if (this.bodyType === BodyInitType.Uint8Array || this.bodyType === BodyInitType.Buffer) {
|
77
77
|
const typedBodyInit = this.bodyInit;
|
78
|
-
return (0, utils_js_1.uint8ArrayToArrayBuffer)(typedBodyInit);
|
78
|
+
return (0, utils_js_1.fakePromise)((0, utils_js_1.uint8ArrayToArrayBuffer)(typedBodyInit));
|
79
79
|
}
|
80
80
|
if (this.bodyType === BodyInitType.String) {
|
81
81
|
const buffer = Buffer.from(this.bodyInit);
|
82
|
-
return (0, utils_js_1.
|
82
|
+
return (0, utils_js_1.fakePromise)(buffer.buffer);
|
83
83
|
}
|
84
84
|
if (this.bodyType === BodyInitType.Blob) {
|
85
85
|
const blob = this.bodyInit;
|
86
|
-
|
87
|
-
return arrayBuffer;
|
86
|
+
return blob.arrayBuffer();
|
88
87
|
}
|
89
|
-
|
90
|
-
return blob.arrayBuffer();
|
88
|
+
return this.blob().then(blob => blob.arrayBuffer());
|
91
89
|
}
|
92
90
|
_collectChunksFromReadable() {
|
93
91
|
return new Promise((resolve, reject) => {
|
@@ -109,33 +107,36 @@ class PonyfillBody {
|
|
109
107
|
}
|
110
108
|
});
|
111
109
|
}
|
112
|
-
|
110
|
+
blob() {
|
113
111
|
if (this.bodyType === BodyInitType.Blob) {
|
114
|
-
return this.bodyInit;
|
112
|
+
return (0, utils_js_1.fakePromise)(this.bodyInit);
|
115
113
|
}
|
116
114
|
if (this.bodyType === BodyInitType.String ||
|
117
115
|
this.bodyType === BodyInitType.Buffer ||
|
118
116
|
this.bodyType === BodyInitType.Uint8Array) {
|
119
117
|
const bodyInitTyped = this.bodyInit;
|
120
|
-
|
118
|
+
const blob = new Blob_js_1.PonyfillBlob([bodyInitTyped], {
|
121
119
|
type: this.contentType || '',
|
122
120
|
});
|
121
|
+
return (0, utils_js_1.fakePromise)(blob);
|
123
122
|
}
|
124
123
|
if (this.bodyType === BodyInitType.ArrayBuffer) {
|
125
124
|
const bodyInitTyped = this.bodyInit;
|
126
125
|
const buf = Buffer.from(bodyInitTyped, undefined, bodyInitTyped.byteLength);
|
127
|
-
|
126
|
+
const blob = new Blob_js_1.PonyfillBlob([buf], {
|
128
127
|
type: this.contentType || '',
|
129
128
|
});
|
129
|
+
return (0, utils_js_1.fakePromise)(blob);
|
130
130
|
}
|
131
|
-
|
132
|
-
|
133
|
-
|
131
|
+
return this._collectChunksFromReadable().then(chunks => {
|
132
|
+
return new Blob_js_1.PonyfillBlob(chunks, {
|
133
|
+
type: this.contentType || '',
|
134
|
+
});
|
134
135
|
});
|
135
136
|
}
|
136
137
|
formData(opts) {
|
137
138
|
if (this.bodyType === BodyInitType.FormData) {
|
138
|
-
return
|
139
|
+
return (0, utils_js_1.fakePromise)(this.bodyInit);
|
139
140
|
}
|
140
141
|
const formData = new FormData_js_1.PonyfillFormData();
|
141
142
|
const _body = this.generateBody();
|
@@ -197,39 +198,37 @@ class PonyfillBody {
|
|
197
198
|
_body?.readable.pipe(bb);
|
198
199
|
});
|
199
200
|
}
|
200
|
-
|
201
|
+
buffer() {
|
201
202
|
if (this.bodyType === BodyInitType.Buffer) {
|
202
|
-
return this.bodyInit;
|
203
|
+
return (0, utils_js_1.fakePromise)(this.bodyInit);
|
203
204
|
}
|
204
205
|
if (this.bodyType === BodyInitType.String) {
|
205
|
-
return Buffer.from(this.bodyInit);
|
206
|
+
return (0, utils_js_1.fakePromise)(Buffer.from(this.bodyInit));
|
206
207
|
}
|
207
208
|
if (this.bodyType === BodyInitType.Uint8Array || this.bodyType === BodyInitType.ArrayBuffer) {
|
208
209
|
const bodyInitTyped = this.bodyInit;
|
209
210
|
const buffer = Buffer.from(bodyInitTyped, 'byteOffset' in bodyInitTyped ? bodyInitTyped.byteOffset : undefined, bodyInitTyped.byteLength);
|
210
|
-
return buffer;
|
211
|
+
return (0, utils_js_1.fakePromise)(buffer);
|
211
212
|
}
|
212
213
|
if (this.bodyType === BodyInitType.Blob) {
|
213
214
|
if (this.bodyInit instanceof Blob_js_1.PonyfillBlob) {
|
214
215
|
return this.bodyInit.buffer();
|
215
216
|
}
|
216
217
|
const bodyInitTyped = this.bodyInit;
|
217
|
-
|
218
|
-
|
218
|
+
return bodyInitTyped
|
219
|
+
.arrayBuffer()
|
220
|
+
.then(arrayBuffer => Buffer.from(arrayBuffer, undefined, bodyInitTyped.size));
|
219
221
|
}
|
220
|
-
|
221
|
-
return Buffer.concat(chunks);
|
222
|
+
return this._collectChunksFromReadable().then(chunks => Buffer.concat(chunks));
|
222
223
|
}
|
223
|
-
|
224
|
-
|
225
|
-
return JSON.parse(text);
|
224
|
+
json() {
|
225
|
+
return this.text().then(text => JSON.parse(text));
|
226
226
|
}
|
227
|
-
|
227
|
+
text() {
|
228
228
|
if (this.bodyType === BodyInitType.String) {
|
229
|
-
return this.bodyInit;
|
229
|
+
return (0, utils_js_1.fakePromise)(this.bodyInit);
|
230
230
|
}
|
231
|
-
|
232
|
-
return buffer.toString('utf-8');
|
231
|
+
return this.buffer().then(buffer => buffer.toString('utf-8'));
|
233
232
|
}
|
234
233
|
}
|
235
234
|
exports.PonyfillBody = PonyfillBody;
|
package/cjs/fetch.js
CHANGED
@@ -8,6 +8,7 @@ const fetchCurl_js_1 = require("./fetchCurl.js");
|
|
8
8
|
const fetchNodeHttp_js_1 = require("./fetchNodeHttp.js");
|
9
9
|
const Request_js_1 = require("./Request.js");
|
10
10
|
const Response_js_1 = require("./Response.js");
|
11
|
+
const utils_js_1 = require("./utils.js");
|
11
12
|
const BASE64_SUFFIX = ';base64';
|
12
13
|
function getResponseForFile(url) {
|
13
14
|
const path = (0, url_1.fileURLToPath)(url);
|
@@ -34,7 +35,7 @@ function getResponseForDataUri(url) {
|
|
34
35
|
},
|
35
36
|
});
|
36
37
|
}
|
37
|
-
|
38
|
+
function fetchPonyfill(info, init) {
|
38
39
|
if (typeof info === 'string' || 'href' in info) {
|
39
40
|
const ponyfillRequest = new Request_js_1.PonyfillRequest(info, init);
|
40
41
|
return fetchPonyfill(ponyfillRequest);
|
@@ -42,11 +43,11 @@ async function fetchPonyfill(info, init) {
|
|
42
43
|
const fetchRequest = info;
|
43
44
|
if (fetchRequest.url.startsWith('data:')) {
|
44
45
|
const response = getResponseForDataUri(fetchRequest.url);
|
45
|
-
return
|
46
|
+
return (0, utils_js_1.fakePromise)(response);
|
46
47
|
}
|
47
48
|
if (fetchRequest.url.startsWith('file:')) {
|
48
49
|
const response = getResponseForFile(fetchRequest.url);
|
49
|
-
return
|
50
|
+
return (0, utils_js_1.fakePromise)(response);
|
50
51
|
}
|
51
52
|
if (globalThis.libcurl) {
|
52
53
|
return (0, fetchCurl_js_1.fetchCurl)(fetchRequest);
|
package/cjs/utils.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.defaultHeadersSerializer = exports.uint8ArrayToArrayBuffer = exports.getHeadersObj = void 0;
|
3
|
+
exports.fakePromise = exports.defaultHeadersSerializer = exports.uint8ArrayToArrayBuffer = exports.getHeadersObj = void 0;
|
4
4
|
function getHeadersObj(headers) {
|
5
5
|
if (headers == null || !('forEach' in headers)) {
|
6
6
|
return headers;
|
@@ -27,3 +27,37 @@ function defaultHeadersSerializer(headers, onContentLength) {
|
|
27
27
|
return headerArray;
|
28
28
|
}
|
29
29
|
exports.defaultHeadersSerializer = defaultHeadersSerializer;
|
30
|
+
function isPromise(val) {
|
31
|
+
return val?.then != null;
|
32
|
+
}
|
33
|
+
function fakePromise(value) {
|
34
|
+
if (isPromise(value)) {
|
35
|
+
return value;
|
36
|
+
}
|
37
|
+
// Write a fake promise to avoid the promise constructor
|
38
|
+
// being called with `new Promise` in the browser.
|
39
|
+
return {
|
40
|
+
then: (resolve) => {
|
41
|
+
const callbackResult = resolve(value);
|
42
|
+
if (isPromise(callbackResult)) {
|
43
|
+
return callbackResult;
|
44
|
+
}
|
45
|
+
return fakePromise(callbackResult);
|
46
|
+
},
|
47
|
+
catch() {
|
48
|
+
return this;
|
49
|
+
},
|
50
|
+
finally(cb) {
|
51
|
+
if (cb) {
|
52
|
+
const callbackResult = cb();
|
53
|
+
if (isPromise(callbackResult)) {
|
54
|
+
return callbackResult.then(() => value);
|
55
|
+
}
|
56
|
+
return fakePromise(value);
|
57
|
+
}
|
58
|
+
return this;
|
59
|
+
},
|
60
|
+
[Symbol.toStringTag]: 'Promise',
|
61
|
+
};
|
62
|
+
}
|
63
|
+
exports.fakePromise = fakePromise;
|
package/esm/Blob.js
CHANGED
@@ -44,9 +44,8 @@ export class PonyfillBlob {
|
|
44
44
|
}
|
45
45
|
return Buffer.concat(bufferChunks);
|
46
46
|
}
|
47
|
-
|
48
|
-
|
49
|
-
return uint8ArrayToArrayBuffer(buffer);
|
47
|
+
arrayBuffer() {
|
48
|
+
return this.buffer().then(uint8ArrayToArrayBuffer);
|
50
49
|
}
|
51
50
|
async text() {
|
52
51
|
let text = '';
|
@@ -91,13 +90,14 @@ export class PonyfillBlob {
|
|
91
90
|
controller.close();
|
92
91
|
}
|
93
92
|
},
|
94
|
-
pull:
|
93
|
+
pull: controller => {
|
95
94
|
const blobPart = partQueue.pop();
|
96
95
|
if (blobPart) {
|
97
96
|
if (isBlob(blobPart)) {
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
return blobPart.arrayBuffer().then(arrayBuffer => {
|
98
|
+
const buf = Buffer.from(arrayBuffer, undefined, blobPart.size);
|
99
|
+
controller.enqueue(buf);
|
100
|
+
});
|
101
101
|
}
|
102
102
|
else {
|
103
103
|
const buf = getBlobPartAsBuffer(blobPart);
|
package/esm/Body.js
CHANGED
@@ -4,7 +4,7 @@ import { PonyfillBlob } from './Blob.js';
|
|
4
4
|
import { PonyfillFile } from './File.js';
|
5
5
|
import { getStreamFromFormData, PonyfillFormData } from './FormData.js';
|
6
6
|
import { PonyfillReadableStream } from './ReadableStream.js';
|
7
|
-
import { uint8ArrayToArrayBuffer } from './utils.js';
|
7
|
+
import { fakePromise, uint8ArrayToArrayBuffer } from './utils.js';
|
8
8
|
var BodyInitType;
|
9
9
|
(function (BodyInitType) {
|
10
10
|
BodyInitType["ReadableStream"] = "ReadableStream";
|
@@ -65,25 +65,23 @@ export class PonyfillBody {
|
|
65
65
|
}
|
66
66
|
return null;
|
67
67
|
}
|
68
|
-
|
68
|
+
arrayBuffer() {
|
69
69
|
if (this.bodyType === BodyInitType.ArrayBuffer) {
|
70
|
-
return this.bodyInit;
|
70
|
+
return fakePromise(this.bodyInit);
|
71
71
|
}
|
72
72
|
if (this.bodyType === BodyInitType.Uint8Array || this.bodyType === BodyInitType.Buffer) {
|
73
73
|
const typedBodyInit = this.bodyInit;
|
74
|
-
return uint8ArrayToArrayBuffer(typedBodyInit);
|
74
|
+
return fakePromise(uint8ArrayToArrayBuffer(typedBodyInit));
|
75
75
|
}
|
76
76
|
if (this.bodyType === BodyInitType.String) {
|
77
77
|
const buffer = Buffer.from(this.bodyInit);
|
78
|
-
return
|
78
|
+
return fakePromise(buffer.buffer);
|
79
79
|
}
|
80
80
|
if (this.bodyType === BodyInitType.Blob) {
|
81
81
|
const blob = this.bodyInit;
|
82
|
-
|
83
|
-
return arrayBuffer;
|
82
|
+
return blob.arrayBuffer();
|
84
83
|
}
|
85
|
-
|
86
|
-
return blob.arrayBuffer();
|
84
|
+
return this.blob().then(blob => blob.arrayBuffer());
|
87
85
|
}
|
88
86
|
_collectChunksFromReadable() {
|
89
87
|
return new Promise((resolve, reject) => {
|
@@ -105,33 +103,36 @@ export class PonyfillBody {
|
|
105
103
|
}
|
106
104
|
});
|
107
105
|
}
|
108
|
-
|
106
|
+
blob() {
|
109
107
|
if (this.bodyType === BodyInitType.Blob) {
|
110
|
-
return this.bodyInit;
|
108
|
+
return fakePromise(this.bodyInit);
|
111
109
|
}
|
112
110
|
if (this.bodyType === BodyInitType.String ||
|
113
111
|
this.bodyType === BodyInitType.Buffer ||
|
114
112
|
this.bodyType === BodyInitType.Uint8Array) {
|
115
113
|
const bodyInitTyped = this.bodyInit;
|
116
|
-
|
114
|
+
const blob = new PonyfillBlob([bodyInitTyped], {
|
117
115
|
type: this.contentType || '',
|
118
116
|
});
|
117
|
+
return fakePromise(blob);
|
119
118
|
}
|
120
119
|
if (this.bodyType === BodyInitType.ArrayBuffer) {
|
121
120
|
const bodyInitTyped = this.bodyInit;
|
122
121
|
const buf = Buffer.from(bodyInitTyped, undefined, bodyInitTyped.byteLength);
|
123
|
-
|
122
|
+
const blob = new PonyfillBlob([buf], {
|
124
123
|
type: this.contentType || '',
|
125
124
|
});
|
125
|
+
return fakePromise(blob);
|
126
126
|
}
|
127
|
-
|
128
|
-
|
129
|
-
|
127
|
+
return this._collectChunksFromReadable().then(chunks => {
|
128
|
+
return new PonyfillBlob(chunks, {
|
129
|
+
type: this.contentType || '',
|
130
|
+
});
|
130
131
|
});
|
131
132
|
}
|
132
133
|
formData(opts) {
|
133
134
|
if (this.bodyType === BodyInitType.FormData) {
|
134
|
-
return
|
135
|
+
return fakePromise(this.bodyInit);
|
135
136
|
}
|
136
137
|
const formData = new PonyfillFormData();
|
137
138
|
const _body = this.generateBody();
|
@@ -193,39 +194,37 @@ export class PonyfillBody {
|
|
193
194
|
_body?.readable.pipe(bb);
|
194
195
|
});
|
195
196
|
}
|
196
|
-
|
197
|
+
buffer() {
|
197
198
|
if (this.bodyType === BodyInitType.Buffer) {
|
198
|
-
return this.bodyInit;
|
199
|
+
return fakePromise(this.bodyInit);
|
199
200
|
}
|
200
201
|
if (this.bodyType === BodyInitType.String) {
|
201
|
-
return Buffer.from(this.bodyInit);
|
202
|
+
return fakePromise(Buffer.from(this.bodyInit));
|
202
203
|
}
|
203
204
|
if (this.bodyType === BodyInitType.Uint8Array || this.bodyType === BodyInitType.ArrayBuffer) {
|
204
205
|
const bodyInitTyped = this.bodyInit;
|
205
206
|
const buffer = Buffer.from(bodyInitTyped, 'byteOffset' in bodyInitTyped ? bodyInitTyped.byteOffset : undefined, bodyInitTyped.byteLength);
|
206
|
-
return buffer;
|
207
|
+
return fakePromise(buffer);
|
207
208
|
}
|
208
209
|
if (this.bodyType === BodyInitType.Blob) {
|
209
210
|
if (this.bodyInit instanceof PonyfillBlob) {
|
210
211
|
return this.bodyInit.buffer();
|
211
212
|
}
|
212
213
|
const bodyInitTyped = this.bodyInit;
|
213
|
-
|
214
|
-
|
214
|
+
return bodyInitTyped
|
215
|
+
.arrayBuffer()
|
216
|
+
.then(arrayBuffer => Buffer.from(arrayBuffer, undefined, bodyInitTyped.size));
|
215
217
|
}
|
216
|
-
|
217
|
-
return Buffer.concat(chunks);
|
218
|
+
return this._collectChunksFromReadable().then(chunks => Buffer.concat(chunks));
|
218
219
|
}
|
219
|
-
|
220
|
-
|
221
|
-
return JSON.parse(text);
|
220
|
+
json() {
|
221
|
+
return this.text().then(text => JSON.parse(text));
|
222
222
|
}
|
223
|
-
|
223
|
+
text() {
|
224
224
|
if (this.bodyType === BodyInitType.String) {
|
225
|
-
return this.bodyInit;
|
225
|
+
return fakePromise(this.bodyInit);
|
226
226
|
}
|
227
|
-
|
228
|
-
return buffer.toString('utf-8');
|
227
|
+
return this.buffer().then(buffer => buffer.toString('utf-8'));
|
229
228
|
}
|
230
229
|
}
|
231
230
|
function processBodyInit(bodyInit) {
|
package/esm/fetch.js
CHANGED
@@ -5,6 +5,7 @@ import { fetchCurl } from './fetchCurl.js';
|
|
5
5
|
import { fetchNodeHttp } from './fetchNodeHttp.js';
|
6
6
|
import { PonyfillRequest } from './Request.js';
|
7
7
|
import { PonyfillResponse } from './Response.js';
|
8
|
+
import { fakePromise } from './utils.js';
|
8
9
|
const BASE64_SUFFIX = ';base64';
|
9
10
|
function getResponseForFile(url) {
|
10
11
|
const path = fileURLToPath(url);
|
@@ -31,7 +32,7 @@ function getResponseForDataUri(url) {
|
|
31
32
|
},
|
32
33
|
});
|
33
34
|
}
|
34
|
-
export
|
35
|
+
export function fetchPonyfill(info, init) {
|
35
36
|
if (typeof info === 'string' || 'href' in info) {
|
36
37
|
const ponyfillRequest = new PonyfillRequest(info, init);
|
37
38
|
return fetchPonyfill(ponyfillRequest);
|
@@ -39,11 +40,11 @@ export async function fetchPonyfill(info, init) {
|
|
39
40
|
const fetchRequest = info;
|
40
41
|
if (fetchRequest.url.startsWith('data:')) {
|
41
42
|
const response = getResponseForDataUri(fetchRequest.url);
|
42
|
-
return
|
43
|
+
return fakePromise(response);
|
43
44
|
}
|
44
45
|
if (fetchRequest.url.startsWith('file:')) {
|
45
46
|
const response = getResponseForFile(fetchRequest.url);
|
46
|
-
return
|
47
|
+
return fakePromise(response);
|
47
48
|
}
|
48
49
|
if (globalThis.libcurl) {
|
49
50
|
return fetchCurl(fetchRequest);
|
package/esm/utils.js
CHANGED
@@ -21,3 +21,36 @@ export function defaultHeadersSerializer(headers, onContentLength) {
|
|
21
21
|
});
|
22
22
|
return headerArray;
|
23
23
|
}
|
24
|
+
function isPromise(val) {
|
25
|
+
return val?.then != null;
|
26
|
+
}
|
27
|
+
export function fakePromise(value) {
|
28
|
+
if (isPromise(value)) {
|
29
|
+
return value;
|
30
|
+
}
|
31
|
+
// Write a fake promise to avoid the promise constructor
|
32
|
+
// being called with `new Promise` in the browser.
|
33
|
+
return {
|
34
|
+
then: (resolve) => {
|
35
|
+
const callbackResult = resolve(value);
|
36
|
+
if (isPromise(callbackResult)) {
|
37
|
+
return callbackResult;
|
38
|
+
}
|
39
|
+
return fakePromise(callbackResult);
|
40
|
+
},
|
41
|
+
catch() {
|
42
|
+
return this;
|
43
|
+
},
|
44
|
+
finally(cb) {
|
45
|
+
if (cb) {
|
46
|
+
const callbackResult = cb();
|
47
|
+
if (isPromise(callbackResult)) {
|
48
|
+
return callbackResult.then(() => value);
|
49
|
+
}
|
50
|
+
return fakePromise(value);
|
51
|
+
}
|
52
|
+
return this;
|
53
|
+
},
|
54
|
+
[Symbol.toStringTag]: 'Promise',
|
55
|
+
};
|
56
|
+
}
|
package/package.json
CHANGED
package/typings/FormData.d.cts
CHANGED
@@ -2,12 +2,14 @@ import { PonyfillBlob } from './Blob.cjs';
|
|
2
2
|
import { PonyfillReadableStream } from './ReadableStream.cjs';
|
3
3
|
export declare class PonyfillFormData implements FormData {
|
4
4
|
private map;
|
5
|
-
append(name: string, value:
|
5
|
+
append(name: string, value: string): void;
|
6
|
+
append(name: string, value: PonyfillBlob, fileName?: string): void;
|
6
7
|
delete(name: string): void;
|
7
8
|
get(name: string): FormDataEntryValue | null;
|
8
9
|
getAll(name: string): FormDataEntryValue[];
|
9
10
|
has(name: string): boolean;
|
10
|
-
set(name: string, value:
|
11
|
+
set(name: string, value: string): void;
|
12
|
+
set(name: string, value: PonyfillBlob, fileName?: string): void;
|
11
13
|
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
|
12
14
|
entries(): IterableIterator<[string, FormDataEntryValue]>;
|
13
15
|
keys(): IterableIterator<string>;
|
package/typings/FormData.d.ts
CHANGED
@@ -2,12 +2,14 @@ import { PonyfillBlob } from './Blob.js';
|
|
2
2
|
import { PonyfillReadableStream } from './ReadableStream.js';
|
3
3
|
export declare class PonyfillFormData implements FormData {
|
4
4
|
private map;
|
5
|
-
append(name: string, value:
|
5
|
+
append(name: string, value: string): void;
|
6
|
+
append(name: string, value: PonyfillBlob, fileName?: string): void;
|
6
7
|
delete(name: string): void;
|
7
8
|
get(name: string): FormDataEntryValue | null;
|
8
9
|
getAll(name: string): FormDataEntryValue[];
|
9
10
|
has(name: string): boolean;
|
10
|
-
set(name: string, value:
|
11
|
+
set(name: string, value: string): void;
|
12
|
+
set(name: string, value: PonyfillBlob, fileName?: string): void;
|
11
13
|
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
|
12
14
|
entries(): IterableIterator<[string, FormDataEntryValue]>;
|
13
15
|
keys(): IterableIterator<string>;
|
package/typings/utils.d.cts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
1
|
export declare function getHeadersObj(headers: Headers): Record<string, string>;
|
2
2
|
export declare function uint8ArrayToArrayBuffer(uint8array: Uint8Array): ArrayBuffer;
|
3
3
|
export declare function defaultHeadersSerializer(headers: Headers, onContentLength?: (value: string) => void): string[];
|
4
|
+
export declare function fakePromise<T>(value: T): Promise<T>;
|
package/typings/utils.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
1
|
export declare function getHeadersObj(headers: Headers): Record<string, string>;
|
2
2
|
export declare function uint8ArrayToArrayBuffer(uint8array: Uint8Array): ArrayBuffer;
|
3
3
|
export declare function defaultHeadersSerializer(headers: Headers, onContentLength?: (value: string) => void): string[];
|
4
|
+
export declare function fakePromise<T>(value: T): Promise<T>;
|