Comparing version 1.36.0 to 1.37.0
@@ -190,13 +190,12 @@ import { EndpointType } from '@neondatabase/api-client'; | ||
const create = async (props) => { | ||
const parentProps = await (() => { | ||
const branches = await props.apiClient | ||
.listProjectBranches(props.projectId) | ||
.then(({ data }) => data.branches); | ||
const parentProps = (() => { | ||
if (!props.parent) { | ||
return props.apiClient | ||
.listProjectBranches(props.projectId) | ||
.then(({ data }) => { | ||
const branch = data.branches.find((b) => b.default); | ||
if (!branch) { | ||
throw new Error('No default branch found'); | ||
} | ||
return { parent_id: branch.id }; | ||
}); | ||
const branch = branches.find((b) => b.default); | ||
if (!branch) { | ||
throw new Error('No default branch found'); | ||
} | ||
return { parent_id: branch.id }; | ||
} | ||
@@ -212,11 +211,7 @@ if (looksLikeLSN(props.parent)) { | ||
} | ||
return props.apiClient | ||
.listProjectBranches(props.projectId) | ||
.then(({ data }) => { | ||
const branch = data.branches.find((b) => b.name === props.parent); | ||
if (!branch) { | ||
throw new Error(`Branch ${props.parent} not found`); | ||
} | ||
return { parent_id: branch.id }; | ||
}); | ||
const branch = branches.find((b) => b.name === props.parent); | ||
if (!branch) { | ||
throw new Error(`Branch ${props.parent} not found`); | ||
} | ||
return { parent_id: branch.id }; | ||
})(); | ||
@@ -241,2 +236,6 @@ const { data } = await retryOnLock(() => props.apiClient.createProjectBranch(props.projectId, { | ||
})); | ||
const parent = branches.find((b) => b.id === data.branch.parent_id); | ||
if (parent?.protected) { | ||
log.warning('The parent branch is protected; a unique role password has been generated for the new branch.'); | ||
} | ||
const out = writer(props); | ||
@@ -243,0 +242,0 @@ out.write(data.branch, { |
@@ -16,5 +16,7 @@ import { log } from '../log.js'; | ||
'aws-ap-southeast-1', | ||
'aws-ap-southeast-2', | ||
'aws-eu-central-1', | ||
'aws-us-east-2', | ||
'aws-us-east-1', | ||
'azure-eastus2', | ||
]; | ||
@@ -140,3 +142,3 @@ const PROJECTS_LIST_LIMIT = 100; | ||
fields: PROJECT_FIELDS, | ||
title: 'Shared with me', | ||
title: 'Shared with you', | ||
}); | ||
@@ -143,0 +145,0 @@ } |
@@ -140,2 +140,3 @@ import { basename } from 'node:path'; | ||
.middleware(analyticsMiddleware, true) | ||
.version(pkg.version) | ||
.group('version', 'Global options:') | ||
@@ -142,0 +143,0 @@ .alias('version', 'v') |
@@ -9,2 +9,5 @@ import { format } from 'node:util'; | ||
}, | ||
warning: (...args) => { | ||
process.stderr.write(`WARNING: ${format(...args)}\n`); | ||
}, | ||
info: (...args) => { | ||
@@ -11,0 +14,0 @@ process.stderr.write(`INFO: ${format(...args)}\n`); |
@@ -8,3 +8,3 @@ { | ||
"type": "module", | ||
"version": "1.36.0", | ||
"version": "1.37.0", | ||
"description": "CLI tool for NeonDB Cloud management", | ||
@@ -11,0 +11,0 @@ "main": "index.js", |
197386
5014