avo 3.2.9-beta.2 → 3.2.9

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.
Files changed (2) hide show
  1. package/cli.js +9 -9
  2. package/package.json +3 -2
package/cli.js CHANGED
@@ -113,7 +113,10 @@ let accessToken;
113
113
  let refreshToken;
114
114
  /// //////////////////////////////////////////////////////////////////////
115
115
  // REQUEST HANDLING
116
- function responseToError(response) {
116
+ function responseToError(response, error) {
117
+ if (!response) {
118
+ return new AvoError(error, {});
119
+ }
117
120
  let { body } = response;
118
121
  if (typeof body === 'string' && response.statusCode === 404) {
119
122
  body = {
@@ -174,15 +177,12 @@ function _request(options) {
174
177
  got(options)
175
178
  .then((response) => {
176
179
  if (response.statusCode >= 400) {
177
- return reject(responseToError(response));
178
- }
179
- if (response && response.body) {
180
- return resolve(JSON.parse(response.body));
180
+ return reject(responseToError(response, null));
181
181
  }
182
- return reject(responseToError(response));
182
+ return resolve(JSON.parse(response.body));
183
183
  })
184
184
  .catch((err) => {
185
- report.error(`${responseToError(err.response)}\n`);
185
+ report.error(`${responseToError(err.response, err)}\n`);
186
186
  reject(new AvoError(`Server Error. ${err.message}`, {
187
187
  original: err,
188
188
  exit: 2,
@@ -201,7 +201,7 @@ const _appendQueryData = (urlPath, data) => {
201
201
  function _refreshAccessToken(refreshToken) {
202
202
  return api // eslint-disable-line
203
203
  .request('POST', '/auth/refresh', {
204
- origin: api.apiOrigin,
204
+ origin: api.apiOrigin, // eslint-disable-line
205
205
  json: {
206
206
  token: refreshToken,
207
207
  },
@@ -1870,7 +1870,7 @@ yargs(hideBin(process.argv)) // eslint-disable-line no-unused-expressions
1870
1870
  .catch(() => {
1871
1871
  Avo.signInFailed({
1872
1872
  userId_: conf.get('avo_install_id'),
1873
- emailInput: '',
1873
+ emailInput: '', // XXX this is not passed back here
1874
1874
  signInError: Avo.SignInError.UNKNOWN,
1875
1875
  });
1876
1876
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "avo",
3
- "version": "3.2.9-beta.2",
3
+ "version": "3.2.9",
4
4
  "type": "module",
5
5
  "description": "The command-line interface for Avo",
6
6
  "author": "Avo (https://www.avo.app)",
@@ -17,6 +17,7 @@
17
17
  "node": ">=14.16"
18
18
  },
19
19
  "scripts": {
20
+ "postinstall": "node cli.js track-install",
20
21
  "prepublishOnly": "npm run compile",
21
22
  "lint": "eslint cli.ts",
22
23
  "format": "prettier --write cli.ts",
@@ -63,7 +64,7 @@
63
64
  "eslint-config-airbnb-base": "^15.0.0",
64
65
  "eslint-config-prettier": "^9.0.0",
65
66
  "eslint-plugin-import": "^2.25.2",
66
- "prettier": "3.0.3",
67
+ "prettier": "3.2.5",
67
68
  "typescript": "^5.0.2"
68
69
  }
69
70
  }