neonctl 1.36.0 → 1.37.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.
@@ -187,17 +187,16 @@ const list = async (props) => {
187
187
  });
188
188
  };
189
189
  const create = async (props) => {
190
- const parentProps = await (() => {
190
+ const branches = await props.apiClient
191
+ .listProjectBranches(props.projectId)
192
+ .then(({ data }) => data.branches);
193
+ const parentProps = (() => {
191
194
  if (!props.parent) {
192
- return props.apiClient
193
- .listProjectBranches(props.projectId)
194
- .then(({ data }) => {
195
- const branch = data.branches.find((b) => b.default);
196
- if (!branch) {
197
- throw new Error('No default branch found');
198
- }
199
- return { parent_id: branch.id };
200
- });
195
+ const branch = branches.find((b) => b.default);
196
+ if (!branch) {
197
+ throw new Error('No default branch found');
198
+ }
199
+ return { parent_id: branch.id };
201
200
  }
202
201
  if (looksLikeLSN(props.parent)) {
203
202
  return { parent_lsn: props.parent };
@@ -208,15 +207,11 @@ const create = async (props) => {
208
207
  if (looksLikeBranchId(props.parent)) {
209
208
  return { parent_id: props.parent };
210
209
  }
211
- return props.apiClient
212
- .listProjectBranches(props.projectId)
213
- .then(({ data }) => {
214
- const branch = data.branches.find((b) => b.name === props.parent);
215
- if (!branch) {
216
- throw new Error(`Branch ${props.parent} not found`);
217
- }
218
- return { parent_id: branch.id };
219
- });
210
+ const branch = branches.find((b) => b.name === props.parent);
211
+ if (!branch) {
212
+ throw new Error(`Branch ${props.parent} not found`);
213
+ }
214
+ return { parent_id: branch.id };
220
215
  })();
221
216
  const { data } = await retryOnLock(() => props.apiClient.createProjectBranch(props.projectId, {
222
217
  branch: {
@@ -236,6 +231,10 @@ const create = async (props) => {
236
231
  ? JSON.parse(props.annotation)
237
232
  : undefined,
238
233
  }));
234
+ const parent = branches.find((b) => b.id === data.branch.parent_id);
235
+ if (parent?.protected) {
236
+ log.warning('The parent branch is protected; a unique role password has been generated for the new branch.');
237
+ }
239
238
  const out = writer(props);
240
239
  out.write(data.branch, {
241
240
  fields: BRANCH_FIELDS,
@@ -13,9 +13,11 @@ export const PROJECT_FIELDS = [
13
13
  const REGIONS = [
14
14
  'aws-us-west-2',
15
15
  'aws-ap-southeast-1',
16
+ 'aws-ap-southeast-2',
16
17
  'aws-eu-central-1',
17
18
  'aws-us-east-2',
18
19
  'aws-us-east-1',
20
+ 'azure-eastus2',
19
21
  ];
20
22
  const PROJECTS_LIST_LIMIT = 100;
21
23
  export const command = 'projects';
@@ -136,7 +138,7 @@ const list = async (props) => {
136
138
  if (sharedProjects) {
137
139
  out.write(await sharedProjects, {
138
140
  fields: PROJECT_FIELDS,
139
- title: 'Shared with me',
141
+ title: 'Shared with you',
140
142
  });
141
143
  }
142
144
  out.end();
package/index.js CHANGED
@@ -137,6 +137,7 @@ builder = builder
137
137
  default: true,
138
138
  })
139
139
  .middleware(analyticsMiddleware, true)
140
+ .version(pkg.version)
140
141
  .group('version', 'Global options:')
141
142
  .alias('version', 'v')
142
143
  .completion()
package/log.js CHANGED
@@ -6,6 +6,9 @@ export const log = {
6
6
  process.stderr.write(`DEBUG: ${format(...args)}\n`);
7
7
  }
8
8
  },
9
+ warning: (...args) => {
10
+ process.stderr.write(`WARNING: ${format(...args)}\n`);
11
+ },
9
12
  info: (...args) => {
10
13
  process.stderr.write(`INFO: ${format(...args)}\n`);
11
14
  },
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+ssh://git@github.com/neondatabase/neonctl.git"
6
6
  },
7
7
  "type": "module",
8
- "version": "1.36.0",
8
+ "version": "1.37.0",
9
9
  "description": "CLI tool for NeonDB Cloud management",
10
10
  "main": "index.js",
11
11
  "author": "NeonDB",