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.
- package/commands/branches.js +18 -19
- package/commands/projects.js +3 -1
- package/index.js +1 -0
- package/log.js +3 -0
- package/package.json +1 -1
package/commands/branches.js
CHANGED
|
@@ -187,17 +187,16 @@ const list = async (props) => {
|
|
|
187
187
|
});
|
|
188
188
|
};
|
|
189
189
|
const create = async (props) => {
|
|
190
|
-
const
|
|
190
|
+
const branches = await props.apiClient
|
|
191
|
+
.listProjectBranches(props.projectId)
|
|
192
|
+
.then(({ data }) => data.branches);
|
|
193
|
+
const parentProps = (() => {
|
|
191
194
|
if (!props.parent) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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,
|
package/commands/projects.js
CHANGED
|
@@ -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
|
|
141
|
+
title: 'Shared with you',
|
|
140
142
|
});
|
|
141
143
|
}
|
|
142
144
|
out.end();
|
package/index.js
CHANGED
package/log.js
CHANGED