Commit b553741 1 parent 8809bf3 commit b553741 Copy full SHA for b553741
File tree 5 files changed +6
-32
lines changed
5 files changed +6
-32
lines changed Original file line number Diff line number Diff line change 24
24
"@types/isomorphic-fetch" : " ^0.0.35" ,
25
25
"@types/jest" : " ^26.0.9" ,
26
26
"@types/node" : " ^14.0.27" ,
27
- "@types/node-fetch" : " ^2.5.7" ,
28
27
"@typescript-eslint/eslint-plugin" : " ^3.9.0" ,
29
28
"@typescript-eslint/parser" : " ^3.9.0" ,
30
29
"@zerollup/ts-transform-paths" : " ^1.7.18" ,
Original file line number Diff line number Diff line change 1
- import type { Response } from "node-fetch" ;
2
-
3
1
import { CustomError } from "@mgtitimoli/utils-error" ;
4
2
5
3
import * as withHttpStatusCode from "./httpStatusCode" ;
Original file line number Diff line number Diff line change 1
1
import fetch from "isomorphic-fetch" ;
2
2
3
- import type { RequestInfo , RequestInit , Response } from "node-fetch" ;
4
-
5
3
import HttpResponseError from "./HttpResponseError" ;
6
4
7
- type FetchOptionsMode = "cors" | "no-cors" | "same-origin" | "navigate" ;
8
-
9
- type FetchOptions = RequestInit & { mode ?: FetchOptionsMode } ;
10
-
11
- type PostJsonOptions = Omit < FetchOptions , "body" | "method" > & { data ?: unknown } ;
5
+ type PostJsonOptions = Omit < RequestInit , "body" | "method" > & { data ?: unknown } ;
12
6
13
- type GetJsonOptions = Omit < FetchOptions , "body" | "method" > ;
7
+ type GetJsonOptions = Omit < RequestInit , "body" | "method" > ;
14
8
15
9
const responseToJson = ( response : Response ) => response . json ( ) ;
16
10
17
11
const ensureResponseIsSucceeded = ( response : Response ) =>
18
12
response . ok ? response : Promise . reject ( new HttpResponseError ( response ) ) ;
19
13
20
- const safeFetch = ( url : RequestInfo , options ?: FetchOptions ) =>
14
+ const safeFetch = ( url : RequestInfo , options ?: RequestInit ) =>
21
15
fetch ( url , options ) . then ( ensureResponseIsSucceeded ) ;
22
16
23
17
const postJsonHeaders = { "Content-Type" : "application/json" } ;
Original file line number Diff line number Diff line change 6
6
"esModuleInterop" : true ,
7
7
"importHelpers" : true ,
8
8
"isolatedModules" : true ,
9
- "lib" : [ "es2020" ] ,
9
+ "lib" : [ "dom" , " es2020"] ,
10
10
"moduleResolution" : "node" ,
11
11
"noEmitOnError" : true ,
12
12
"outDir" : "./dist" ,
19
19
"resolveJsonModule" : true ,
20
20
"skipLibCheck" : true ,
21
21
"strict" : true ,
22
- "target" : "ES2020 " ,
22
+ "target" : "es5 " ,
23
23
"typeRoots" : [ "./typings" , "./node_modules/@types" ] ,
24
24
} ,
25
25
"exclude" : [ "node_modules" ] ,
Original file line number Diff line number Diff line change 881
881
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6"
882
882
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
883
883
884
- " @types/node-fetch@^2.5.7 " :
885
- version "2.5.7"
886
- resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.7.tgz#20a2afffa882ab04d44ca786449a276f9f6bbf3c"
887
- integrity sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==
888
- dependencies :
889
- " @types/node" " *"
890
- form-data "^3.0.0"
891
-
892
884
" @types/node@* " :
893
885
version "14.0.23"
894
886
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.23.tgz#676fa0883450ed9da0bb24156213636290892806"
@@ -2041,7 +2033,7 @@ columnify@~1.5.4:
2041
2033
strip-ansi "^3.0.0"
2042
2034
wcwidth "^1.0.0"
2043
2035
2044
- combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@ ~1.0.6 :
2036
+ combined-stream@^1.0.6, combined-stream@~1.0.6 :
2045
2037
version "1.0.8"
2046
2038
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
2047
2039
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
@@ -3296,15 +3288,6 @@ forever-agent@~0.6.1:
3296
3288
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
3297
3289
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
3298
3290
3299
- form-data@^3.0.0 :
3300
- version "3.0.0"
3301
- resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.0.tgz#31b7e39c85f1355b7139ee0c647cf0de7f83c682"
3302
- integrity sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==
3303
- dependencies :
3304
- asynckit "^0.4.0"
3305
- combined-stream "^1.0.8"
3306
- mime-types "^2.1.12"
3307
-
3308
3291
form-data@~2.3.2 :
3309
3292
version "2.3.3"
3310
3293
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
You can’t perform that action at this time.
0 commit comments