neonctl 1.9.4 → 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.
- package/commands/branches.js +1 -1
- package/commands/connection_string.js +9 -1
- package/commands/connection_string.test.js +18 -0
- package/commands/databases.js +1 -1
- package/commands/endpoints.js +1 -1
- package/commands/index.js +1 -1
- package/commands/operations.js +1 -1
- package/commands/projects.js +1 -1
- package/commands/roles.js +1 -1
- package/index.js +2 -1
- package/package.json +1 -1
package/commands/branches.js
CHANGED
|
@@ -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 <command> [options]')
|
|
10
|
+
.usage('usage: $0 branches <sub-command> [options]')
|
|
11
11
|
.options({
|
|
12
12
|
'project.id': {
|
|
13
13
|
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
|
|
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
|
});
|
package/commands/databases.js
CHANGED
|
@@ -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 <command> [options]')
|
|
10
|
+
.usage('usage: $0 databases <sub-command> [options]')
|
|
11
11
|
.options({
|
|
12
12
|
'project.id': {
|
|
13
13
|
describe: 'Project ID',
|
package/commands/endpoints.js
CHANGED
|
@@ -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 <command> [options]')
|
|
16
|
+
.usage('usage: $0 endpoints <sub-command> [options]')
|
|
17
17
|
.options({
|
|
18
18
|
'project.id': {
|
|
19
19
|
describe: 'Project ID',
|
package/commands/index.js
CHANGED
package/commands/operations.js
CHANGED
|
@@ -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 <command> [options]')
|
|
9
|
+
.usage('usage: $0 operations <sub-command> [options]')
|
|
10
10
|
.options({
|
|
11
11
|
'project.id': {
|
|
12
12
|
describe: 'Project ID',
|
package/commands/projects.js
CHANGED
|
@@ -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 <command> [options]')
|
|
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 <command> [options]')
|
|
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,7 +21,8 @@ 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
|
-
|
|
24
|
+
let builder = yargs(hideBin(process.argv));
|
|
25
|
+
builder = builder
|
|
25
26
|
.scriptName(pkg.name)
|
|
26
27
|
.usage('usage: $0 <command> [options]')
|
|
27
28
|
.help()
|