@agilecustoms/envctl 1.22.0 → 1.23.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/dist/client/HttpClient.js +13 -2
- package/dist/commands/_utils.js +1 -1
- package/package.json +4 -3
|
@@ -64,7 +64,18 @@ export class HttpClient {
|
|
|
64
64
|
throw new Error('Error (network?) making the request:', { cause: error });
|
|
65
65
|
}
|
|
66
66
|
const contentType = response.headers?.get('Content-Type') || '';
|
|
67
|
-
|
|
67
|
+
let body = await response.text();
|
|
68
|
+
if (contentType.includes('application/json')) {
|
|
69
|
+
try {
|
|
70
|
+
body = JSON.parse(body);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
if (e instanceof SyntaxError) {
|
|
74
|
+
throw new Error(`Malformed json response: ${body}`, { cause: e });
|
|
75
|
+
}
|
|
76
|
+
throw new Error('Unexpected error when parsing JSON response', { cause: e });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
68
79
|
if (response.ok) {
|
|
69
80
|
return body;
|
|
70
81
|
}
|
|
@@ -72,7 +83,7 @@ export class HttpClient {
|
|
|
72
83
|
throw new NotFoundException(body);
|
|
73
84
|
}
|
|
74
85
|
if (response.status === 422) {
|
|
75
|
-
throw new BusinessException(body);
|
|
86
|
+
throw new BusinessException(body.message);
|
|
76
87
|
}
|
|
77
88
|
if (response.status === 426) {
|
|
78
89
|
throw new KnownException(body.message);
|
package/dist/commands/_utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agilecustoms/envctl",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "node.js CLI client for manage environments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"terraform wrapper",
|
|
@@ -46,14 +46,15 @@
|
|
|
46
46
|
"d1": "CWD=../tt-core npm run it --",
|
|
47
47
|
"d1-init": "cd ../tt-core && terraform init -upgrade -backend-config=key=d1 -reconfigure",
|
|
48
48
|
"d1-status": "npm run d1 -- status --verbose",
|
|
49
|
-
"d1-apply": " npm run d1 -- apply --auto-approve",
|
|
49
|
+
"d1-apply": " npm run d1 -- apply --auto-approve -var=env_size=min",
|
|
50
50
|
"d1-delete": "npm run d1 -- delete",
|
|
51
|
+
"d1-logs": " npm run d1 -- logs",
|
|
51
52
|
"-d2-": "",
|
|
52
53
|
"d2-desc": "dev env destroy",
|
|
53
54
|
"d2": "CWD=../tt-core npm run it --",
|
|
54
55
|
"d2-init": "cd ../tt-core && terraform init -upgrade -backend-config=key=d2 -reconfigure",
|
|
55
56
|
"d2-status": " npm run d2 -- status",
|
|
56
|
-
"d2-apply": " npm run d2 -- apply --auto-approve
|
|
57
|
+
"d2-apply": " npm run d2 -- apply --auto-approve",
|
|
57
58
|
"d2-destroy": "npm run d2 -- destroy -var=env_size=min --auto-approve",
|
|
58
59
|
"-d3-": "",
|
|
59
60
|
"d3-desc": "dev env plan apply",
|