neonctl 1.17.1 → 1.17.3

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/auth.js CHANGED
@@ -39,9 +39,10 @@ export const auth = async ({ oauthHost, clientId }) => {
39
39
  // Start HTTP server and wait till /callback is hit
40
40
  //
41
41
  const server = createServer();
42
- server.listen(0, function () {
42
+ server.listen(0, '127.0.0.1', function () {
43
43
  log.info(`Listening on port ${this.address().port}`);
44
44
  });
45
+ await new Promise((resolve) => server.once('listening', resolve));
45
46
  const listen_port = server.address().port;
46
47
  const neonOAuthClient = new issuer.Client({
47
48
  token_endpoint_auth_method: 'none',
@@ -96,5 +96,5 @@ export const handler = async (props) => {
96
96
  connectionString.searchParams.set('pgbouncer', 'true');
97
97
  }
98
98
  }
99
- process.stdout.write(connectionString.toString());
99
+ process.stdout.write(connectionString.toString() + '\n');
100
100
  };
@@ -5,7 +5,7 @@ import { writer } from '../writer.js';
5
5
  const DATABASE_FIELDS = ['name', 'owner_name', 'created_at'];
6
6
  export const command = 'databases';
7
7
  export const describe = 'Manage databases';
8
- export const aliases = ['database'];
8
+ export const aliases = ['database', 'db'];
9
9
  export const builder = (argv) => argv
10
10
  .demandCommand(1, '')
11
11
  .fail(commandFailHandler)
@@ -1,3 +1,4 @@
1
+ import { log } from '../log.js';
1
2
  import { projectCreateRequest } from '../parameters.gen.js';
2
3
  import { commandFailHandler } from '../utils/middlewares.js';
3
4
  import { writer } from '../writer.js';
@@ -9,6 +10,7 @@ const REGIONS = [
9
10
  'aws-us-east-2',
10
11
  'aws-us-east-1',
11
12
  ];
13
+ const PROJECTS_LIST_LIMIT = 100;
12
14
  export const command = 'projects';
13
15
  export const describe = 'Manage projects';
14
16
  export const aliases = ['project'];
@@ -51,8 +53,22 @@ export const handler = (args) => {
51
53
  return args;
52
54
  };
53
55
  const list = async (props) => {
54
- const { data } = await props.apiClient.listProjects({});
55
- writer(props).end(data.projects, { fields: PROJECT_FIELDS });
56
+ const result = [];
57
+ let cursor;
58
+ let end = false;
59
+ while (!end) {
60
+ const { data } = await props.apiClient.listProjects({
61
+ limit: PROJECTS_LIST_LIMIT,
62
+ cursor,
63
+ });
64
+ result.push(...data.projects);
65
+ cursor = data.pagination?.cursor;
66
+ log.debug('Got %d projects, with cursor: %s', data.projects.length, cursor);
67
+ if (data.projects.length < PROJECTS_LIST_LIMIT) {
68
+ end = true;
69
+ }
70
+ }
71
+ writer(props).end(result, { fields: PROJECT_FIELDS });
56
72
  };
57
73
  const create = async (props) => {
58
74
  const project = {};
package/index.js CHANGED
@@ -96,7 +96,8 @@ builder = builder
96
96
  log.error('Authentication failed, please run `neonctl auth`');
97
97
  }
98
98
  else {
99
- log.error('%d: %s\n%s', err.response?.status, err.response?.statusText, err.response?.data?.message);
99
+ log.debug('Fail: %d | %s', err.response?.status, err.response?.statusText);
100
+ log.error(err.response?.data?.message);
100
101
  }
101
102
  }
102
103
  else {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git@github.com:neondatabase/neonctl.git"
6
6
  },
7
7
  "type": "module",
8
- "version": "1.17.1",
8
+ "version": "1.17.3",
9
9
  "description": "CLI tool for NeonDB Cloud management",
10
10
  "main": "index.js",
11
11
  "author": "NeonDB",