@automattic/request-promise-native 2.1.1 → 2.2.0
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/deps/promise-core/package-lock.json +321 -868
- package/deps/promise-core/package.json +2 -3
- package/errors.js +1 -1
- package/lib/request.d.ts +393 -0
- package/package.json +9 -3
- package/eslint.config.mjs +0 -212
|
@@ -35,11 +35,10 @@
|
|
|
35
35
|
"request": "npm:@cypress/request@^3.0.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"bluebird": "~3.
|
|
38
|
+
"bluebird": "~3.7.2",
|
|
39
39
|
"body-parser": "^1.20.3",
|
|
40
40
|
"chai": "^4.5.0",
|
|
41
41
|
"mocha": "^11.1.0",
|
|
42
|
-
"
|
|
43
|
-
"stealthy-require": "~1.0.0"
|
|
42
|
+
"stealthy-require": "~1.1.1"
|
|
44
43
|
}
|
|
45
44
|
}
|
package/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('
|
|
1
|
+
module.exports = require('./deps/promise-core/errors.js');
|
package/lib/request.d.ts
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
// See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/request/index.d.ts
|
|
2
|
+
|
|
3
|
+
import caseless from "caseless";
|
|
4
|
+
import { Stream, Readable } from "node:stream";
|
|
5
|
+
import http from "node:http";
|
|
6
|
+
import https from "node:https";
|
|
7
|
+
import FormData from "form-data";
|
|
8
|
+
import net from "node:net";
|
|
9
|
+
import ToughCookie from "tough-cookie";
|
|
10
|
+
import { Url } from "node:url";
|
|
11
|
+
|
|
12
|
+
declare namespace request {
|
|
13
|
+
interface RequestAPI<TRequest extends Request, TOptions extends CoreOptions, TUriUrlOptions> {
|
|
14
|
+
defaults(options: TOptions): RequestAPI<TRequest, TOptions, RequiredUriUrl>;
|
|
15
|
+
defaults(options: RequiredUriUrl & TOptions): DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>;
|
|
16
|
+
|
|
17
|
+
(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
18
|
+
(uri: string, callback?: RequestCallback): TRequest;
|
|
19
|
+
(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
20
|
+
|
|
21
|
+
get(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
22
|
+
get(uri: string, callback?: RequestCallback): TRequest;
|
|
23
|
+
get(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
24
|
+
|
|
25
|
+
post(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
26
|
+
post(uri: string, callback?: RequestCallback): TRequest;
|
|
27
|
+
post(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
28
|
+
|
|
29
|
+
put(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
30
|
+
put(uri: string, callback?: RequestCallback): TRequest;
|
|
31
|
+
put(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
32
|
+
|
|
33
|
+
head(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
34
|
+
head(uri: string, callback?: RequestCallback): TRequest;
|
|
35
|
+
head(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
36
|
+
|
|
37
|
+
patch(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
38
|
+
patch(uri: string, callback?: RequestCallback): TRequest;
|
|
39
|
+
patch(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
40
|
+
|
|
41
|
+
del(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
42
|
+
del(uri: string, callback?: RequestCallback): TRequest;
|
|
43
|
+
del(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
44
|
+
|
|
45
|
+
delete(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
46
|
+
delete(uri: string, callback?: RequestCallback): TRequest;
|
|
47
|
+
delete(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
48
|
+
|
|
49
|
+
initParams(uri: string, options?: TOptions, callback?: RequestCallback): RequiredUriUrl & TOptions;
|
|
50
|
+
initParams(
|
|
51
|
+
uriOrOpts: string | RequiredUriUrl & TOptions,
|
|
52
|
+
callback?: RequestCallback,
|
|
53
|
+
): RequiredUriUrl & TOptions;
|
|
54
|
+
|
|
55
|
+
forever(agentOptions: any, optionsArg: any): TRequest;
|
|
56
|
+
jar(store?: any): CookieJar;
|
|
57
|
+
cookie(str: string): Cookie | undefined;
|
|
58
|
+
|
|
59
|
+
debug: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface DefaultUriUrlRequestApi<TRequest extends Request, TOptions extends CoreOptions, TUriUrlOptions>
|
|
63
|
+
extends RequestAPI<TRequest, TOptions, TUriUrlOptions>
|
|
64
|
+
{
|
|
65
|
+
defaults(options: TOptions): DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>;
|
|
66
|
+
(callback?: RequestCallback): TRequest;
|
|
67
|
+
|
|
68
|
+
get(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
69
|
+
get(uri: string, callback?: RequestCallback): TRequest;
|
|
70
|
+
get(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
71
|
+
get(callback?: RequestCallback): TRequest;
|
|
72
|
+
|
|
73
|
+
post(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
74
|
+
post(uri: string, callback?: RequestCallback): TRequest;
|
|
75
|
+
post(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
76
|
+
post(callback?: RequestCallback): TRequest;
|
|
77
|
+
|
|
78
|
+
put(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
79
|
+
put(uri: string, callback?: RequestCallback): TRequest;
|
|
80
|
+
put(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
81
|
+
put(callback?: RequestCallback): TRequest;
|
|
82
|
+
|
|
83
|
+
head(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
84
|
+
head(uri: string, callback?: RequestCallback): TRequest;
|
|
85
|
+
head(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
86
|
+
head(callback?: RequestCallback): TRequest;
|
|
87
|
+
|
|
88
|
+
patch(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
89
|
+
patch(uri: string, callback?: RequestCallback): TRequest;
|
|
90
|
+
patch(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
91
|
+
patch(callback?: RequestCallback): TRequest;
|
|
92
|
+
|
|
93
|
+
del(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
94
|
+
del(uri: string, callback?: RequestCallback): TRequest;
|
|
95
|
+
del(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
96
|
+
del(callback?: RequestCallback): TRequest;
|
|
97
|
+
|
|
98
|
+
delete(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
|
99
|
+
delete(uri: string, callback?: RequestCallback): TRequest;
|
|
100
|
+
delete(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
|
101
|
+
delete(callback?: RequestCallback): TRequest;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface CoreOptions {
|
|
105
|
+
baseUrl?: string | undefined;
|
|
106
|
+
callback?: RequestCallback | undefined;
|
|
107
|
+
jar?: CookieJar | boolean | undefined;
|
|
108
|
+
formData?: { [key: string]: any } | undefined;
|
|
109
|
+
form?: { [key: string]: any } | string | undefined;
|
|
110
|
+
auth?: AuthOptions | undefined;
|
|
111
|
+
oauth?: OAuthOptions | undefined;
|
|
112
|
+
aws?: AWSOptions | undefined;
|
|
113
|
+
hawk?: HawkOptions | undefined;
|
|
114
|
+
qs?: any;
|
|
115
|
+
qsStringifyOptions?: any;
|
|
116
|
+
qsParseOptions?: any;
|
|
117
|
+
json?: any;
|
|
118
|
+
jsonReviver?: ((key: string, value: any) => any) | undefined;
|
|
119
|
+
jsonReplacer?: ((key: string, value: any) => any) | undefined;
|
|
120
|
+
multipart?: RequestPart[] | Multipart | undefined;
|
|
121
|
+
agent?: http.Agent | https.Agent | undefined;
|
|
122
|
+
agentOptions?: http.AgentOptions | https.AgentOptions | undefined;
|
|
123
|
+
agentClass?: any;
|
|
124
|
+
forever?: any;
|
|
125
|
+
host?: string | undefined;
|
|
126
|
+
port?: number | undefined;
|
|
127
|
+
method?: string | undefined;
|
|
128
|
+
headers?: Headers | undefined;
|
|
129
|
+
body?: any;
|
|
130
|
+
family?: 4 | 6 | undefined;
|
|
131
|
+
followRedirect?: boolean | ((response: http.IncomingMessage) => boolean) | undefined;
|
|
132
|
+
followAllRedirects?: boolean | undefined;
|
|
133
|
+
followOriginalHttpMethod?: boolean | undefined;
|
|
134
|
+
maxRedirects?: number | undefined;
|
|
135
|
+
removeRefererHeader?: boolean | undefined;
|
|
136
|
+
encoding?: string | null | undefined;
|
|
137
|
+
pool?: PoolOptions | undefined;
|
|
138
|
+
timeout?: number | undefined;
|
|
139
|
+
localAddress?: string | undefined;
|
|
140
|
+
proxy?: any;
|
|
141
|
+
tunnel?: boolean | undefined;
|
|
142
|
+
strictSSL?: boolean | undefined;
|
|
143
|
+
rejectUnauthorized?: boolean | undefined;
|
|
144
|
+
time?: boolean | undefined;
|
|
145
|
+
gzip?: boolean | undefined;
|
|
146
|
+
preambleCRLF?: boolean | undefined;
|
|
147
|
+
postambleCRLF?: boolean | undefined;
|
|
148
|
+
withCredentials?: boolean | undefined;
|
|
149
|
+
key?: Buffer | undefined;
|
|
150
|
+
cert?: Buffer | undefined;
|
|
151
|
+
passphrase?: string | undefined;
|
|
152
|
+
ca?: string | Buffer | string[] | Buffer[] | undefined;
|
|
153
|
+
har?: HttpArchiveRequest | undefined;
|
|
154
|
+
useQuerystring?: boolean | undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface UriOptions {
|
|
158
|
+
uri: string | Url;
|
|
159
|
+
}
|
|
160
|
+
interface UrlOptions {
|
|
161
|
+
url: string | Url;
|
|
162
|
+
}
|
|
163
|
+
type RequiredUriUrl = UriOptions | UrlOptions;
|
|
164
|
+
|
|
165
|
+
type OptionalUriUrl = RequiredUriUrl | {};
|
|
166
|
+
|
|
167
|
+
type OptionsWithUri = UriOptions & CoreOptions;
|
|
168
|
+
type OptionsWithUrl = UrlOptions & CoreOptions;
|
|
169
|
+
type Options = OptionsWithUri | OptionsWithUrl;
|
|
170
|
+
|
|
171
|
+
type MultipartBody = string | Buffer | ArrayBuffer | Uint8Array;
|
|
172
|
+
|
|
173
|
+
type RequestCallback = (error: any, response: Response, body: any) => void;
|
|
174
|
+
|
|
175
|
+
interface HttpArchiveRequest {
|
|
176
|
+
url?: string | undefined;
|
|
177
|
+
method?: string | undefined;
|
|
178
|
+
headers?: NameValuePair[] | undefined;
|
|
179
|
+
postData?: {
|
|
180
|
+
mimeType?: string | undefined;
|
|
181
|
+
params?: NameValuePair[] | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface ExtraPoolOptions {
|
|
186
|
+
maxSockets?: number | undefined;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type PoolOptions = false | { [key: string]: http.Agent | https.Agent } & ExtraPoolOptions | ExtraPoolOptions;
|
|
190
|
+
|
|
191
|
+
interface NameValuePair {
|
|
192
|
+
name: string;
|
|
193
|
+
value: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface Multipart {
|
|
197
|
+
chunked?: boolean | undefined;
|
|
198
|
+
data?:
|
|
199
|
+
| Array<{
|
|
200
|
+
"content-type"?: string | undefined;
|
|
201
|
+
body: MultipartBody;
|
|
202
|
+
}>
|
|
203
|
+
| undefined;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
interface RequestPart {
|
|
207
|
+
headers?: Headers | undefined;
|
|
208
|
+
body: any;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
interface Request extends caseless.Httpified, Stream {
|
|
212
|
+
readable: boolean;
|
|
213
|
+
writable: boolean;
|
|
214
|
+
explicitMethod?: true | undefined;
|
|
215
|
+
|
|
216
|
+
debug(...args: any[]): void;
|
|
217
|
+
pipeDest(dest: any): void;
|
|
218
|
+
qs(q: object, clobber?: boolean): Request;
|
|
219
|
+
form(): FormData;
|
|
220
|
+
form(form: any): Request;
|
|
221
|
+
multipart(multipart: RequestPart[]): Request;
|
|
222
|
+
json(val: any): Request;
|
|
223
|
+
aws(opts: AWSOptions, now?: boolean): Request;
|
|
224
|
+
hawk(opts: HawkOptions): void;
|
|
225
|
+
auth(username: string, password: string, sendImmediately?: boolean, bearer?: string): Request;
|
|
226
|
+
oauth(oauth: OAuthOptions): Request;
|
|
227
|
+
jar(jar: CookieJar): Request;
|
|
228
|
+
|
|
229
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
230
|
+
on(event: "request", listener: (req: http.ClientRequest) => void): this;
|
|
231
|
+
on(event: "response", listener: (resp: Response) => void): this;
|
|
232
|
+
on(event: "data", listener: (data: Buffer | string) => void): this;
|
|
233
|
+
on(event: "error", listener: (e: Error) => void): this;
|
|
234
|
+
on(event: "complete", listener: (resp: Response, body?: string | Buffer) => void): this;
|
|
235
|
+
on(event: "pipe", listener: (src: Readable) => void): this;
|
|
236
|
+
on(event: "socket", listener: (src: net.Socket) => void): this;
|
|
237
|
+
|
|
238
|
+
write(buffer: Buffer | string, cb?: (err?: Error) => void): boolean;
|
|
239
|
+
write(str: string, encoding?: string, cb?: (err?: Error) => void): boolean;
|
|
240
|
+
end(cb?: () => void): any;
|
|
241
|
+
end(chunk: string | Buffer, cb?: () => void): any;
|
|
242
|
+
end(str: string, encoding?: string, cb?: () => void): any;
|
|
243
|
+
|
|
244
|
+
pause(): void;
|
|
245
|
+
resume(): void;
|
|
246
|
+
abort(): void;
|
|
247
|
+
destroy(): void;
|
|
248
|
+
toJSON(): RequestAsJSON;
|
|
249
|
+
|
|
250
|
+
// several of the CoreOptions are copied onto the request instance
|
|
251
|
+
host?: string | undefined;
|
|
252
|
+
port?: number | undefined;
|
|
253
|
+
followAllRedirects?: boolean | undefined;
|
|
254
|
+
followOriginalHttpMethod?: boolean | undefined;
|
|
255
|
+
maxRedirects?: number | undefined;
|
|
256
|
+
removeRefererHeader?: boolean | undefined;
|
|
257
|
+
encoding?: string | null | undefined;
|
|
258
|
+
timeout?: number | undefined;
|
|
259
|
+
localAddress?: string | undefined;
|
|
260
|
+
strictSSL?: boolean | undefined;
|
|
261
|
+
rejectUnauthorized?: boolean | undefined;
|
|
262
|
+
time?: boolean | undefined;
|
|
263
|
+
gzip?: boolean | undefined;
|
|
264
|
+
preambleCRLF?: boolean | undefined;
|
|
265
|
+
postambleCRLF?: boolean | undefined;
|
|
266
|
+
withCredentials?: boolean | undefined;
|
|
267
|
+
key?: Buffer | undefined;
|
|
268
|
+
cert?: Buffer | undefined;
|
|
269
|
+
passphrase?: string | undefined;
|
|
270
|
+
ca?: string | Buffer | string[] | Buffer[] | undefined;
|
|
271
|
+
har?: HttpArchiveRequest | undefined;
|
|
272
|
+
|
|
273
|
+
// set in `Request.prototype.init`
|
|
274
|
+
headers: Headers;
|
|
275
|
+
method: string;
|
|
276
|
+
pool: PoolOptions;
|
|
277
|
+
dests: Readable[];
|
|
278
|
+
callback?: RequestCallback | undefined;
|
|
279
|
+
uri: Url & { href: string; pathname: string };
|
|
280
|
+
proxy: null | string | Url;
|
|
281
|
+
tunnel: boolean;
|
|
282
|
+
setHost: boolean;
|
|
283
|
+
path: string;
|
|
284
|
+
agent: false | http.Agent | https.Agent;
|
|
285
|
+
body: Buffer | Buffer[] | string | string[] | Readable;
|
|
286
|
+
timing?: boolean | undefined;
|
|
287
|
+
src?: Readable | undefined;
|
|
288
|
+
|
|
289
|
+
// set in `Request.prototype.start`
|
|
290
|
+
href: string;
|
|
291
|
+
startTime?: number | undefined;
|
|
292
|
+
startTimeNow?: number | undefined;
|
|
293
|
+
timings?: {
|
|
294
|
+
socket: number;
|
|
295
|
+
lookup: number;
|
|
296
|
+
connect: number;
|
|
297
|
+
response: number;
|
|
298
|
+
end: number;
|
|
299
|
+
} | undefined;
|
|
300
|
+
|
|
301
|
+
// set in `Request.prototype.onRequestResponse`
|
|
302
|
+
elapsedTime?: number | undefined;
|
|
303
|
+
response?: Response | undefined;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
interface Response extends http.IncomingMessage {
|
|
307
|
+
statusCode: number;
|
|
308
|
+
statusMessage: string;
|
|
309
|
+
request: Request;
|
|
310
|
+
body: any; // Buffer, string, stream.Readable, or a plain object if `json` was truthy
|
|
311
|
+
caseless: caseless.Caseless; // case-insensitive access to headers
|
|
312
|
+
toJSON(): ResponseAsJSON;
|
|
313
|
+
|
|
314
|
+
timingStart?: number | undefined;
|
|
315
|
+
elapsedTime?: number | undefined;
|
|
316
|
+
timings?: {
|
|
317
|
+
socket: number;
|
|
318
|
+
lookup: number;
|
|
319
|
+
connect: number;
|
|
320
|
+
response: number;
|
|
321
|
+
end: number;
|
|
322
|
+
} | undefined;
|
|
323
|
+
timingPhases?: {
|
|
324
|
+
wait: number;
|
|
325
|
+
dns: number;
|
|
326
|
+
tcp: number;
|
|
327
|
+
firstByte: number;
|
|
328
|
+
download: number;
|
|
329
|
+
total: number;
|
|
330
|
+
} | undefined;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// aliases for backwards compatibility
|
|
334
|
+
type ResponseRequest = Request;
|
|
335
|
+
type RequestResponse = Response;
|
|
336
|
+
|
|
337
|
+
interface Headers {
|
|
338
|
+
[key: string]: any;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
interface AuthOptions {
|
|
342
|
+
user?: string | undefined;
|
|
343
|
+
username?: string | undefined;
|
|
344
|
+
pass?: string | undefined;
|
|
345
|
+
password?: string | undefined;
|
|
346
|
+
sendImmediately?: boolean | undefined;
|
|
347
|
+
bearer?: string | (() => string) | undefined;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
interface OAuthOptions {
|
|
351
|
+
callback?: string | undefined;
|
|
352
|
+
consumer_key?: string | undefined;
|
|
353
|
+
consumer_secret?: string | undefined;
|
|
354
|
+
token?: string | undefined;
|
|
355
|
+
token_secret?: string | undefined;
|
|
356
|
+
transport_method?: "body" | "header" | "query" | undefined;
|
|
357
|
+
verifier?: string | undefined;
|
|
358
|
+
body_hash?: true | string | undefined;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface HawkOptions {
|
|
362
|
+
credentials: any;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
interface AWSOptions {
|
|
366
|
+
secret: string;
|
|
367
|
+
bucket?: string | undefined;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
interface RequestAsJSON {
|
|
371
|
+
uri: Url;
|
|
372
|
+
method: string;
|
|
373
|
+
headers: Headers;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
interface ResponseAsJSON {
|
|
377
|
+
statusCode: number;
|
|
378
|
+
body: any;
|
|
379
|
+
headers: Headers;
|
|
380
|
+
request: RequestAsJSON;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
type Cookie = ToughCookie.Cookie;
|
|
384
|
+
|
|
385
|
+
interface CookieJar {
|
|
386
|
+
setCookie(cookieOrStr: Cookie | string, uri: string | Url, options?: ToughCookie.SetCookieOptions): void;
|
|
387
|
+
getCookieString(uri: string | Url): string;
|
|
388
|
+
getCookies(uri: string | Url): Cookie[];
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
declare var request: request.RequestAPI<request.Request, request.CoreOptions, request.RequiredUriUrl>;
|
|
393
|
+
export = request;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/request-promise-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "The simplified HTTP request client 'request' with Promise support. Powered by native ES6 promises.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xhr",
|
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
"native"
|
|
14
14
|
],
|
|
15
15
|
"main": "./lib/rp.js",
|
|
16
|
+
"types": "./lib/request.d.ts",
|
|
16
17
|
"scripts": {
|
|
17
18
|
"lint": "eslint .",
|
|
18
19
|
"lint:fix": "eslint --fix .",
|
|
19
20
|
"test": "mocha test/spec",
|
|
20
|
-
"check-dependencies": "npx depcheck@1.4.7"
|
|
21
|
+
"check-dependencies": "npx depcheck@1.4.7",
|
|
22
|
+
"check-dts": "npx check-dts lib/*.d.ts"
|
|
21
23
|
},
|
|
22
24
|
"repository": {
|
|
23
25
|
"type": "git",
|
|
@@ -38,9 +40,13 @@
|
|
|
38
40
|
"stealthy-require": "^1.1.1"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
43
|
+
"@types/caseless": "^0.12.5",
|
|
44
|
+
"@types/node": "^22.13.1",
|
|
41
45
|
"body-parser": "~1.20.3",
|
|
42
46
|
"chai": "^4.5.0",
|
|
43
47
|
"eslint": "^9.19.0",
|
|
44
|
-
"
|
|
48
|
+
"globals": "^15.14.0",
|
|
49
|
+
"mocha": "^11.1.0",
|
|
50
|
+
"tough-cookie": "^5.1.1"
|
|
45
51
|
}
|
|
46
52
|
}
|
package/eslint.config.mjs
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import globals from 'globals';
|
|
2
|
-
|
|
3
|
-
// https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects
|
|
4
|
-
export default [{
|
|
5
|
-
plugins: {},
|
|
6
|
-
|
|
7
|
-
languageOptions: {
|
|
8
|
-
globals: {
|
|
9
|
-
...globals.node,
|
|
10
|
-
...globals.mocha, // for tests
|
|
11
|
-
Promise: false
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
ecmaVersion: 2020,
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
|
|
17
|
-
parserOptions: {
|
|
18
|
-
ecmaFeatures: {}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
rules: {
|
|
23
|
-
'no-cond-assign': 2,
|
|
24
|
-
'no-console': 0,
|
|
25
|
-
'no-constant-condition': 2,
|
|
26
|
-
'no-control-regex': 2,
|
|
27
|
-
'no-debugger': 2,
|
|
28
|
-
'no-dupe-args': 2,
|
|
29
|
-
'no-dupe-keys': 2,
|
|
30
|
-
'no-duplicate-case': 2,
|
|
31
|
-
|
|
32
|
-
'no-empty': [2, {
|
|
33
|
-
allowEmptyCatch: false
|
|
34
|
-
}],
|
|
35
|
-
|
|
36
|
-
'no-empty-character-class': 2,
|
|
37
|
-
'no-ex-assign': 2,
|
|
38
|
-
'no-extra-boolean-cast': 2,
|
|
39
|
-
'no-extra-parens': [2, 'all'],
|
|
40
|
-
'no-extra-semi': 2,
|
|
41
|
-
'no-func-assign': 2,
|
|
42
|
-
'no-inner-declarations': [2, 'functions'],
|
|
43
|
-
'no-invalid-regexp': 2,
|
|
44
|
-
|
|
45
|
-
'no-irregular-whitespace': [2, {
|
|
46
|
-
skipComments: false
|
|
47
|
-
}],
|
|
48
|
-
|
|
49
|
-
'no-negated-in-lhs': 2,
|
|
50
|
-
'no-obj-calls': 2,
|
|
51
|
-
'no-prototype-builtins': 2,
|
|
52
|
-
'no-regex-spaces': 2,
|
|
53
|
-
'no-sparse-arrays': 2,
|
|
54
|
-
'no-unexpected-multiline': 2,
|
|
55
|
-
'no-unreachable': 2,
|
|
56
|
-
'no-unsafe-finally': 2,
|
|
57
|
-
'use-isnan': 2,
|
|
58
|
-
'valid-jsdoc': 0,
|
|
59
|
-
'valid-typeof': 2,
|
|
60
|
-
'accessor-pairs': 2,
|
|
61
|
-
curly: [2, 'multi-line'],
|
|
62
|
-
'dot-location': [2, 'property'],
|
|
63
|
-
eqeqeq: 2,
|
|
64
|
-
'no-caller': 2,
|
|
65
|
-
'no-empty-pattern': 0,
|
|
66
|
-
'no-eval': 2,
|
|
67
|
-
'no-extend-native': 2,
|
|
68
|
-
'no-extra-bind': 2,
|
|
69
|
-
'no-fallthrough': 2,
|
|
70
|
-
'no-floating-decimal': 2,
|
|
71
|
-
'no-implied-eval': 2,
|
|
72
|
-
'no-iterator': 2,
|
|
73
|
-
'no-labels': 2,
|
|
74
|
-
'no-lone-blocks': 2,
|
|
75
|
-
'no-magic-numbers': 0,
|
|
76
|
-
'no-multi-spaces': 2,
|
|
77
|
-
'no-multi-str': 2,
|
|
78
|
-
'no-native-reassign': 2,
|
|
79
|
-
'no-new': 2,
|
|
80
|
-
'no-new-func': 2,
|
|
81
|
-
'no-new-wrappers': 2,
|
|
82
|
-
'no-octal': 2,
|
|
83
|
-
'no-octal-escape': 2,
|
|
84
|
-
'no-proto': 2,
|
|
85
|
-
'no-redeclare': 2,
|
|
86
|
-
'no-return-assign': [2, 'except-parens'],
|
|
87
|
-
'no-self-assign': 2,
|
|
88
|
-
'no-self-compare': 2,
|
|
89
|
-
'no-sequences': 2,
|
|
90
|
-
'no-throw-literal': 2,
|
|
91
|
-
'no-unmodified-loop-condition': 2,
|
|
92
|
-
'no-useless-call': 2,
|
|
93
|
-
'no-useless-escape': 2,
|
|
94
|
-
'no-with': 2,
|
|
95
|
-
'wrap-iife': [2, 'inside'],
|
|
96
|
-
yoda: 2,
|
|
97
|
-
strict: [2, 'safe'],
|
|
98
|
-
'init-declarations': [2, 'always'],
|
|
99
|
-
'no-catch-shadow': 0,
|
|
100
|
-
'no-delete-var': 2,
|
|
101
|
-
'no-label-var': 2,
|
|
102
|
-
'no-restricted-globals': 0,
|
|
103
|
-
|
|
104
|
-
'no-shadow': [2, {
|
|
105
|
-
builtinGlobals: false,
|
|
106
|
-
hoist: 'all',
|
|
107
|
-
allow: []
|
|
108
|
-
}],
|
|
109
|
-
|
|
110
|
-
'no-shadow-restricted-names': 2,
|
|
111
|
-
|
|
112
|
-
'no-undef': [2, {
|
|
113
|
-
typeof: true
|
|
114
|
-
}],
|
|
115
|
-
|
|
116
|
-
'no-undef-init': 2,
|
|
117
|
-
'no-undefined': 0,
|
|
118
|
-
|
|
119
|
-
'no-unused-vars': [2, {
|
|
120
|
-
vars: 'local',
|
|
121
|
-
args: 'none',
|
|
122
|
-
caughtErrors: 'none'
|
|
123
|
-
}],
|
|
124
|
-
|
|
125
|
-
'no-use-before-define': [2, {
|
|
126
|
-
functions: false,
|
|
127
|
-
classes: true
|
|
128
|
-
}],
|
|
129
|
-
|
|
130
|
-
'callback-return': 0,
|
|
131
|
-
'global-require': 0,
|
|
132
|
-
'handle-callback-err': [2, '^(err|error)$'],
|
|
133
|
-
'no-mixed-requires': 0,
|
|
134
|
-
'no-new-require': 2,
|
|
135
|
-
'no-path-concat': 2,
|
|
136
|
-
'no-process-env': 2,
|
|
137
|
-
'no-process-exit': 2,
|
|
138
|
-
'no-restricted-modules': 0,
|
|
139
|
-
'no-sync': 2,
|
|
140
|
-
'block-spacing': 2,
|
|
141
|
-
|
|
142
|
-
'brace-style': [2, '1tbs', {
|
|
143
|
-
allowSingleLine: true
|
|
144
|
-
}],
|
|
145
|
-
|
|
146
|
-
camelcase: [2, {
|
|
147
|
-
properties: 'never'
|
|
148
|
-
}],
|
|
149
|
-
|
|
150
|
-
'comma-dangle': [2, 'never'],
|
|
151
|
-
'comma-spacing': 2,
|
|
152
|
-
'comma-style': 2,
|
|
153
|
-
'eol-last': 2,
|
|
154
|
-
|
|
155
|
-
indent: [2, 4, {
|
|
156
|
-
SwitchCase: 1
|
|
157
|
-
}],
|
|
158
|
-
|
|
159
|
-
'jsx-quotes': 0,
|
|
160
|
-
'key-spacing': 2,
|
|
161
|
-
'keyword-spacing': 2,
|
|
162
|
-
'new-cap': 0,
|
|
163
|
-
'new-parens': 2,
|
|
164
|
-
'no-array-constructor': 2,
|
|
165
|
-
'no-mixed-spaces-and-tabs': 2,
|
|
166
|
-
|
|
167
|
-
'no-multiple-empty-lines': [2, {
|
|
168
|
-
max: 2,
|
|
169
|
-
maxBOF: 0,
|
|
170
|
-
maxEOF: 1
|
|
171
|
-
}],
|
|
172
|
-
|
|
173
|
-
'no-new-object': 2,
|
|
174
|
-
|
|
175
|
-
'no-plusplus': [2, {
|
|
176
|
-
allowForLoopAfterthoughts: false
|
|
177
|
-
}],
|
|
178
|
-
|
|
179
|
-
'no-spaced-func': 2,
|
|
180
|
-
'no-trailing-spaces': 2,
|
|
181
|
-
|
|
182
|
-
'no-unneeded-ternary': [2, {
|
|
183
|
-
defaultAssignment: false
|
|
184
|
-
}],
|
|
185
|
-
|
|
186
|
-
'no-whitespace-before-property': 2,
|
|
187
|
-
'one-var': 0,
|
|
188
|
-
|
|
189
|
-
'operator-linebreak': [2, 'after', {
|
|
190
|
-
overrides: {
|
|
191
|
-
'?': 'before',
|
|
192
|
-
':': 'before'
|
|
193
|
-
}
|
|
194
|
-
}],
|
|
195
|
-
|
|
196
|
-
'padded-blocks': 0,
|
|
197
|
-
quotes: [2, 'single', 'avoid-escape'],
|
|
198
|
-
semi: [2, 'always'],
|
|
199
|
-
'semi-spacing': 2,
|
|
200
|
-
'space-before-blocks': 2,
|
|
201
|
-
|
|
202
|
-
'space-before-function-paren': [2, {
|
|
203
|
-
anonymous: 'always',
|
|
204
|
-
named: 'never'
|
|
205
|
-
}],
|
|
206
|
-
|
|
207
|
-
'space-in-parens': 0,
|
|
208
|
-
'space-infix-ops': 0,
|
|
209
|
-
'space-unary-ops': 2,
|
|
210
|
-
'spaced-comment': 0
|
|
211
|
-
}
|
|
212
|
-
}];
|