netlify 10.1.1 → 11.0.1
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/README.md +1 -1
- package/package.json +11 -15
- package/src/methods/response.js +11 -4
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify",
|
|
3
3
|
"description": "Netlify Node.js API client",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "11.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"src/**/*.js",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"exports": "./src/index.js",
|
|
11
11
|
"main": "./src/index.js",
|
|
12
12
|
"scripts": {
|
|
13
|
+
"prepare": "husky install node_modules/@netlify/eslint-config-node/.husky/",
|
|
13
14
|
"prepublishOnly": "npm ci && npm test",
|
|
14
15
|
"test": "run-s format test:dev",
|
|
15
16
|
"format": "run-s format:check-fix:*",
|
|
@@ -21,19 +22,13 @@
|
|
|
21
22
|
"format:check:prettier": "cross-env-shell prettier --check $npm_package_config_prettier",
|
|
22
23
|
"format:fix:prettier": "cross-env-shell prettier --write $npm_package_config_prettier",
|
|
23
24
|
"test:dev": "ava",
|
|
24
|
-
"test:ci": "
|
|
25
|
+
"test:ci": "c8 -r lcovonly -r text -r json ava",
|
|
25
26
|
"update-snapshots": "ava -u"
|
|
26
27
|
},
|
|
27
28
|
"config": {
|
|
28
29
|
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,tests,.github}/**/*.{cjs,mjs,js,md,html}\" \"*.{cjs,mjs,js,md,html}\" \".*.{cjs,mjs,js,md,html}\"",
|
|
29
30
|
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tests,.github}/**/*.{cjs,mjs,js,md,yml,json,html}\" \"*.{cjs,mjs,js,yml,json,html}\" \".*.{cjs,mjs,js,yml,json,html}\" \"!package-lock.json\" \"!CHANGELOG.md\""
|
|
30
31
|
},
|
|
31
|
-
"husky": {
|
|
32
|
-
"hooks": {
|
|
33
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
34
|
-
"pre-push": "npm run format"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
32
|
"license": "MIT",
|
|
38
33
|
"author": "Netlify Inc.",
|
|
39
34
|
"contributors": [
|
|
@@ -60,19 +55,19 @@
|
|
|
60
55
|
"@netlify/open-api": "^2.8.0",
|
|
61
56
|
"lodash.camelcase": "^4.3.0",
|
|
62
57
|
"micro-api-client": "^3.3.0",
|
|
63
|
-
"node-fetch": "^
|
|
58
|
+
"node-fetch": "^3.0.0",
|
|
64
59
|
"omit.js": "^2.0.2",
|
|
65
|
-
"p-wait-for": "^
|
|
60
|
+
"p-wait-for": "^4.0.0",
|
|
66
61
|
"qs": "^6.9.6"
|
|
67
62
|
},
|
|
68
63
|
"devDependencies": {
|
|
69
|
-
"@netlify/eslint-config-node": "^
|
|
70
|
-
"ava": "^
|
|
64
|
+
"@netlify/eslint-config-node": "^5.1.7",
|
|
65
|
+
"ava": "^4.0.0",
|
|
66
|
+
"c8": "^7.11.0",
|
|
71
67
|
"from2-string": "^1.1.0",
|
|
72
|
-
"husky": "^
|
|
68
|
+
"husky": "^7.0.4",
|
|
73
69
|
"nock": "^13.0.0",
|
|
74
70
|
"npm-run-all": "^4.1.5",
|
|
75
|
-
"nyc": "^15.1.0",
|
|
76
71
|
"uuid": "^8.3.2"
|
|
77
72
|
},
|
|
78
73
|
"engines": {
|
|
@@ -82,6 +77,7 @@
|
|
|
82
77
|
"files": [
|
|
83
78
|
"src/**/*.test.js"
|
|
84
79
|
],
|
|
85
|
-
"verbose": true
|
|
80
|
+
"verbose": true,
|
|
81
|
+
"workerThreads": false
|
|
86
82
|
}
|
|
87
83
|
}
|
package/src/methods/response.js
CHANGED
|
@@ -10,7 +10,7 @@ export const parseResponse = async function (response) {
|
|
|
10
10
|
|
|
11
11
|
if (!response.ok) {
|
|
12
12
|
const ErrorType = responseType === 'json' ? JSONHTTPError : TextHTTPError
|
|
13
|
-
throw new ErrorType(response, parsedResponse)
|
|
13
|
+
throw addFallbackErrorMessage(new ErrorType(response, parsedResponse), textResponse)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return parsedResponse
|
|
@@ -33,14 +33,21 @@ const parseJsonResponse = function (response, textResponse, responseType) {
|
|
|
33
33
|
|
|
34
34
|
try {
|
|
35
35
|
return JSON.parse(textResponse)
|
|
36
|
-
} catch
|
|
37
|
-
throw new TextHTTPError(response, textResponse)
|
|
36
|
+
} catch {
|
|
37
|
+
throw addFallbackErrorMessage(new TextHTTPError(response, textResponse), textResponse)
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
const addFallbackErrorMessage = function (error, textResponse) {
|
|
42
|
+
error.message = error.message || textResponse
|
|
43
|
+
return error
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
export const getFetchError = function (error, url, opts) {
|
|
42
47
|
const data = omit.default(opts, ['Authorization'])
|
|
43
|
-
error.name
|
|
48
|
+
if (error.name !== 'FetchError') {
|
|
49
|
+
error.name = 'FetchError'
|
|
50
|
+
}
|
|
44
51
|
error.url = url
|
|
45
52
|
error.data = data
|
|
46
53
|
return error
|