neonctl 1.9.3 → 1.10.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.
@@ -7,7 +7,7 @@ export const describe = 'Manage branches';
7
7
  export const builder = (argv) => argv
8
8
  .demandCommand(1, '')
9
9
  .fail(commandFailHandler)
10
- .usage('usage: $0 branches <cmd> [args]')
10
+ .usage('usage: $0 branches <sub-command> [options]')
11
11
  .options({
12
12
  'project.id': {
13
13
  describe: 'Project ID',
@@ -2,7 +2,7 @@ export const command = 'connection-string';
2
2
  export const aliases = ['cs'];
3
3
  export const describe = 'Get connection string';
4
4
  export const builder = (argv) => {
5
- return argv.usage('usage: $0 connection-string [args]').options({
5
+ return argv.usage('usage: $0 connection-string [options]').options({
6
6
  'project.id': {
7
7
  type: 'string',
8
8
  describe: 'Project ID',
@@ -23,12 +23,20 @@ export const builder = (argv) => {
23
23
  describe: 'Database name',
24
24
  demandOption: true,
25
25
  },
26
+ pooled: {
27
+ type: 'boolean',
28
+ describe: 'Use pooled connection',
29
+ default: false,
30
+ },
26
31
  });
27
32
  };
28
33
  export const handler = async (props) => {
29
34
  const { data: { endpoint }, } = await props.apiClient.getProjectEndpoint(props.project.id, props.endpoint.id);
30
35
  const { data: password } = await props.apiClient.getProjectBranchRolePassword(props.project.id, endpoint.branch_id, props.role.name);
31
- const connectionString = new URL(`postgres://${endpoint.host}`);
36
+ const host = props.pooled
37
+ ? endpoint.host.replace(endpoint.id, `${endpoint.id}-pooler`)
38
+ : endpoint.host;
39
+ const connectionString = new URL(`postgres://${host}`);
32
40
  connectionString.pathname = props.database.name;
33
41
  connectionString.username = props.role.name;
34
42
  connectionString.password = password.password;
@@ -18,4 +18,22 @@ describe('connection_string', () => {
18
18
  snapshot: true,
19
19
  },
20
20
  });
21
+ testCliCommand({
22
+ name: 'connection_string pooled',
23
+ args: [
24
+ 'connection-string',
25
+ '--project.id',
26
+ 'test',
27
+ '--endpoint.id',
28
+ 'test_endpoint_id',
29
+ '--database.name',
30
+ 'test_db',
31
+ '--role.name',
32
+ 'test_role',
33
+ '--pooled',
34
+ ],
35
+ expected: {
36
+ snapshot: true,
37
+ },
38
+ });
21
39
  });
@@ -7,7 +7,7 @@ export const describe = 'Manage databases';
7
7
  export const builder = (argv) => argv
8
8
  .demandCommand(1, '')
9
9
  .fail(commandFailHandler)
10
- .usage('usage: $0 databases <cmd> [args]')
10
+ .usage('usage: $0 databases <sub-command> [options]')
11
11
  .options({
12
12
  'project.id': {
13
13
  describe: 'Project ID',
@@ -13,7 +13,7 @@ export const describe = 'Manage endpoints';
13
13
  export const builder = (argv) => argv
14
14
  .demandCommand(1, '')
15
15
  .fail(commandFailHandler)
16
- .usage('usage: $0 endpoints <cmd> [args]')
16
+ .usage('usage: $0 endpoints <sub-command> [options]')
17
17
  .options({
18
18
  'project.id': {
19
19
  describe: 'Project ID',
@@ -5,7 +5,7 @@ describe('help', () => {
5
5
  name: 'without args',
6
6
  args: [],
7
7
  expected: {
8
- stderr: expect.stringContaining('usage: neonctl <cmd> [args]'),
8
+ stderr: expect.stringContaining('usage: neonctl <command> [options]'),
9
9
  },
10
10
  });
11
11
  });
package/commands/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as auth from './auth.js';
2
2
  import * as projects from './projects.js';
3
- import * as users from './users.js';
3
+ import * as users from './user.js';
4
4
  import * as branches from './branches.js';
5
5
  import * as endpoints from './endpoints.js';
6
6
  import * as databases from './databases.js';
@@ -9,8 +9,8 @@ import * as operations from './operations.js';
9
9
  import * as cs from './connection_string.js';
10
10
  export default [
11
11
  auth,
12
- projects,
13
12
  users,
13
+ projects,
14
14
  branches,
15
15
  endpoints,
16
16
  databases,
@@ -6,7 +6,7 @@ export const describe = 'Manage operations';
6
6
  export const builder = (argv) => argv
7
7
  .demandCommand(1, '')
8
8
  .fail(commandFailHandler)
9
- .usage('usage: $0 operations <cmd> [args]')
9
+ .usage('usage: $0 operations <sub-command> [options]')
10
10
  .options({
11
11
  'project.id': {
12
12
  describe: 'Project ID',
@@ -8,7 +8,7 @@ export const builder = (argv) => {
8
8
  return argv
9
9
  .demandCommand(1, '')
10
10
  .fail(commandFailHandler)
11
- .usage('usage: $0 projects <cmd> [args]')
11
+ .usage('usage: $0 projects <sub-command> [options]')
12
12
  .command('list', 'List projects', (yargs) => yargs, async (args) => {
13
13
  await list(args);
14
14
  })
package/commands/roles.js CHANGED
@@ -7,7 +7,7 @@ export const describe = 'Manage roles';
7
7
  export const builder = (argv) => argv
8
8
  .demandCommand(1, '')
9
9
  .fail(commandFailHandler)
10
- .usage('usage: $0 roles <cmd> [args]')
10
+ .usage('usage: $0 roles <sub-command> [options]')
11
11
  .options({
12
12
  'project.id': {
13
13
  describe: 'Project ID',
package/index.js CHANGED
@@ -21,9 +21,10 @@ import { fillInArgs } from './utils.js';
21
21
  import pkg from './pkg.js';
22
22
  import commands from './commands/index.js';
23
23
  import { analyticsMiddleware } from './analytics.js';
24
- const builder = yargs(hideBin(process.argv))
24
+ let builder = yargs(hideBin(process.argv));
25
+ builder = builder
25
26
  .scriptName(pkg.name)
26
- .usage('usage: $0 <cmd> [args]')
27
+ .usage('usage: $0 <command> [options]')
27
28
  .help()
28
29
  .option('output', {
29
30
  alias: 'o',
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.9.3",
8
+ "version": "1.10.0",
9
9
  "description": "CLI tool for NeonDB Cloud management",
10
10
  "main": "index.js",
11
11
  "author": "NeonDB",
File without changes