neonctl 1.27.0-beta.0 → 1.27.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.
@@ -74,7 +74,15 @@ export const builder = (argv) => argv
74
74
  describe: 'Name under which to preserve the old branch',
75
75
  },
76
76
  }), async (args) => await reset(args))
77
- .command('restore <id|name> <point-in-time>', 'Restore a branch to a point in time.\nPoint in time format is following ^self|^parent|source-branch-(id|name)[@(lsn|timestamp)]', (yargs) => yargs
77
+ .command('restore <target-id|name> <source>[@(timestamp|lsn)]', 'Restores a branch to a specific point in time\n<source> can be: ^self, ^parent, or <source-branch-id|name>', (yargs) => yargs
78
+ // we want to show meaningful help for the command
79
+ // but it makes yargs to fail on parsing the command
80
+ // so we need to fill in the missing args manually
81
+ .middleware((args) => {
82
+ args.id = args.targetId;
83
+ args.pointInTime = args['source@(timestamp'];
84
+ })
85
+ .usage('$0 branches restore <target-id|name> <source>[@(timestamp|lsn)]')
78
86
  .options({
79
87
  'preserve-under-name': {
80
88
  describe: 'Name under which to preserve the old branch',
@@ -83,19 +91,19 @@ export const builder = (argv) => argv
83
91
  .example([
84
92
  [
85
93
  '$0 branches restore main br-source-branch-123456',
86
- 'Restore main to the head of the branch with id br-source-branch-123456',
94
+ 'Restores main to the head of the branch with id br-source-branch-123456',
87
95
  ],
88
96
  [
89
97
  '$0 branches restore main source@2021-01-01T00:00:00Z',
90
- 'Restore main to the timestamp 2021-01-01T00:00:00Z of the source branch',
98
+ 'Restores main to the timestamp 2021-01-01T00:00:00Z of the source branch',
91
99
  ],
92
100
  [
93
101
  '$0 branches restore my-branch ^self@0/123456',
94
- 'Restore my-branch to the LSN 0/123456 of the branch itself',
102
+ 'Restores my-branch to the LSN 0/123456 from its own history',
95
103
  ],
96
104
  [
97
105
  '$0 branches restore my-branch ^parent',
98
- 'Restore my-branch to the head of the parent branch',
106
+ 'Restore my-branch to the head of its parent branch',
99
107
  ],
100
108
  ]), async (args) => await restore(args))
101
109
  .command('rename <id|name> <new-name>', 'Rename a branch', (yargs) => yargs, async (args) => await rename(args))
@@ -49,6 +49,11 @@ export const builder = (argv) => {
49
49
  describe: 'Connect to a database via psql using connection string',
50
50
  default: false,
51
51
  },
52
+ ssl: {
53
+ type: 'boolean',
54
+ describe: 'Add sslmode=require to the connection string',
55
+ default: true,
56
+ },
52
57
  })
53
58
  .middleware(fillSingleProject);
54
59
  };
@@ -107,6 +112,9 @@ export const handler = async (props) => {
107
112
  connectionString.searchParams.set('pgbouncer', 'true');
108
113
  }
109
114
  }
115
+ if (props.ssl) {
116
+ connectionString.searchParams.set('sslmode', 'require');
117
+ }
110
118
  if (props.psql) {
111
119
  const psqlArgs = props['--'];
112
120
  await psql(connectionString.toString(), psqlArgs);
@@ -165,4 +165,22 @@ describe('connection_string', () => {
165
165
  snapshot: true,
166
166
  },
167
167
  });
168
+ testCliCommand({
169
+ name: 'connection_string without ssl',
170
+ args: [
171
+ 'connection-string',
172
+ 'test_branch',
173
+ '--project-id',
174
+ 'test',
175
+ '--database-name',
176
+ 'test_db',
177
+ '--role-name',
178
+ 'test_role',
179
+ '--ssl',
180
+ 'false',
181
+ ],
182
+ expected: {
183
+ snapshot: true,
184
+ },
185
+ });
168
186
  });
package/help.js CHANGED
@@ -128,9 +128,10 @@ const formatHelp = (help) => {
128
128
  ui.div({
129
129
  text: chalk.bold(command),
130
130
  padding: [0, 0, 0, 0],
131
- }, {
132
- text: description,
133
- padding: [0, 0, 0, 0],
131
+ });
132
+ ui.div({
133
+ text: chalk.reset(description),
134
+ padding: [0, 0, 0, 2],
134
135
  });
135
136
  }
136
137
  result.push(ui.toString());
@@ -139,7 +140,7 @@ const formatHelp = (help) => {
139
140
  };
140
141
  export const showHelp = async (argv) => {
141
142
  // add wrap to ensure that there are no line breaks
142
- const help = await argv.wrap(500).getHelp();
143
+ const help = await argv.getHelp();
143
144
  process.stderr.write(formatHelp(help).join('\n') + '\n');
144
145
  process.exit(0);
145
146
  };
package/index.js CHANGED
@@ -145,7 +145,10 @@ builder = builder
145
145
  log.error('Authentication failed, please run `neonctl auth`');
146
146
  }
147
147
  else {
148
- log.error('Fail: status: %d %s | path: %s | message: %s', err.response?.status, err.response?.statusText, err.request?.path, err.response?.data?.message);
148
+ if (err.response?.data?.message) {
149
+ log.error(err.response?.data?.message);
150
+ }
151
+ log.debug('status: %d %s | path: %s', err.response?.status, err.response?.statusText, err.request?.path);
149
152
  sendError(err, 'API_ERROR');
150
153
  }
151
154
  }
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.27.0-beta.0",
8
+ "version": "1.27.0",
9
9
  "description": "CLI tool for NeonDB Cloud management",
10
10
  "main": "index.js",
11
11
  "author": "NeonDB",