neon 2.30.0 → 2.30.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/dist/api.js +12 -1
- package/package.json +6 -6
package/dist/api.js
CHANGED
|
@@ -133,6 +133,17 @@ function readSocketCode(err) {
|
|
|
133
133
|
}
|
|
134
134
|
return undefined;
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* The wrapped `@neon/sdk/raw` layer surfaces a typed `NeonError` on `.error`, whose `.body`
|
|
138
|
+
* holds the original parsed API error body. Unwrap it so {@link httpError} sees the body
|
|
139
|
+
* (message/code) rather than the SDK wrapper object.
|
|
140
|
+
*/
|
|
141
|
+
function rawErrorBody(error) {
|
|
142
|
+
if (error && typeof error === "object" && "body" in error) {
|
|
143
|
+
return error.body;
|
|
144
|
+
}
|
|
145
|
+
return error;
|
|
146
|
+
}
|
|
136
147
|
/** Build a {@link NeonApiError} from a non-2xx `Response` and its parsed body. */
|
|
137
148
|
function httpError(response, body) {
|
|
138
149
|
let requestPath;
|
|
@@ -257,7 +268,7 @@ export const getApiClient = ({ apiKey, apiHost }) => {
|
|
|
257
268
|
throw networkError(result.error ?? new Error("No response from Neon API"));
|
|
258
269
|
}
|
|
259
270
|
if (!response.ok) {
|
|
260
|
-
throw httpError(response, result.error ?? result.data);
|
|
271
|
+
throw httpError(response, rawErrorBody(result.error) ?? result.data);
|
|
261
272
|
}
|
|
262
273
|
return {
|
|
263
274
|
data: result.data,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.1",
|
|
4
4
|
"description": "CLI tool for Neon Serverless Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"which": "3.0.1",
|
|
52
52
|
"yaml": "2.4.5",
|
|
53
53
|
"yargs": "17.7.2",
|
|
54
|
-
"@neon/config": "0.9.
|
|
55
|
-
"@neon/sdk": "0.
|
|
56
|
-
"@neon/config-runtime": "0.9.
|
|
57
|
-
"@neon/env": "0.10.
|
|
54
|
+
"@neon/config": "0.9.1",
|
|
55
|
+
"@neon/sdk": "1.0.0",
|
|
56
|
+
"@neon/config-runtime": "0.9.1",
|
|
57
|
+
"@neon/env": "0.10.1"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"esbuild": "0.28.
|
|
60
|
+
"esbuild": "0.28.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@apidevtools/swagger-parser": "12.1.0",
|