neon 4.8.0 → 4.9.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/README.md +12 -0
- package/dist/commands/branches.js +29 -14
- package/dist/commands/projects.js +17 -6
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -133,6 +133,18 @@ automation:
|
|
|
133
133
|
neon branches create --project-id <project-id> --name production --protected
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
+
Project and branch creation include connection credentials in their output by
|
|
137
|
+
default for backward compatibility. When the output may be logged or passed to
|
|
138
|
+
an agent, use `--no-secrets` to return only the created resource metadata:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
neon projects create --name my-project --output json --no-secrets
|
|
142
|
+
neon branches create --project-id <project-id> --name preview --output json --no-secrets
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The flag omits the complete `connection_uris` block rather than redacting one
|
|
146
|
+
field. Retrieve a connection string separately when it is actually needed.
|
|
147
|
+
|
|
136
148
|
### Enable logical replication
|
|
137
149
|
|
|
138
150
|
Enable logical replication for every endpoint in an existing project:
|
|
@@ -44,6 +44,11 @@ const builder = (argv) => argv.usage("$0 branches <sub-command> [options]").opti
|
|
|
44
44
|
} }).middleware(fillSingleProject).middleware((args) => {
|
|
45
45
|
args.branchId ??= args.id;
|
|
46
46
|
}).command("list", "List branches", (yargs) => yargs, (args) => list(args)).command("create", "Create a branch", (yargs) => yargs.options({
|
|
47
|
+
secrets: {
|
|
48
|
+
describe: "Include connection credentials in command output. Use --no-secrets to omit them",
|
|
49
|
+
type: "boolean",
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
47
52
|
name: branchCreateRequest["branch.name"],
|
|
48
53
|
parent: {
|
|
49
54
|
describe: "Parent branch name or id or timestamp or LSN. Defaults to the default branch",
|
|
@@ -220,21 +225,31 @@ const create = async (props) => {
|
|
|
220
225
|
}));
|
|
221
226
|
if (branches.find((b) => b.id === data.branch.parent_id)?.protected) log.warning("The parent branch is protected; a unique role password has been generated for the new branch.");
|
|
222
227
|
const out = writer(props);
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
title: "endpoints",
|
|
231
|
-
emptyMessage: "No endpoints have been found."
|
|
232
|
-
});
|
|
233
|
-
if (data.connection_uris?.length) out.write(data.connection_uris, {
|
|
234
|
-
fields: ["connection_uri"],
|
|
235
|
-
title: "connection_uris",
|
|
236
|
-
emptyMessage: "No connection uris have been found"
|
|
228
|
+
const endpoints = data.endpoints ?? [];
|
|
229
|
+
const connectionUris = data.connection_uris ?? [];
|
|
230
|
+
const writeEndpoints = endpoints.length > 0;
|
|
231
|
+
const writeUris = props.secrets && connectionUris.length > 0;
|
|
232
|
+
if (!props.secrets && (props.output === "json" || props.output === "yaml") && !writeEndpoints) out.write({ branch: data.branch }, {
|
|
233
|
+
fields: ["branch"],
|
|
234
|
+
title: "branch"
|
|
237
235
|
});
|
|
236
|
+
else {
|
|
237
|
+
out.write(data.branch, {
|
|
238
|
+
fields: BRANCH_FIELDS,
|
|
239
|
+
title: "branch",
|
|
240
|
+
emptyMessage: "No branches have been found."
|
|
241
|
+
});
|
|
242
|
+
if (writeEndpoints) out.write(endpoints, {
|
|
243
|
+
fields: ["id", "created_at"],
|
|
244
|
+
title: "endpoints",
|
|
245
|
+
emptyMessage: "No endpoints have been found."
|
|
246
|
+
});
|
|
247
|
+
if (writeUris) out.write(connectionUris, {
|
|
248
|
+
fields: ["connection_uri"],
|
|
249
|
+
title: "connection_uris",
|
|
250
|
+
emptyMessage: "No connection uris have been found"
|
|
251
|
+
});
|
|
252
|
+
}
|
|
238
253
|
out.end();
|
|
239
254
|
if (props.psql) {
|
|
240
255
|
if (!data.connection_uris?.length) throw new Error(`Branch ${data.branch.id} doesn't have a connection uri`);
|
|
@@ -62,6 +62,11 @@ const builder = (argv) => {
|
|
|
62
62
|
}), async (args) => {
|
|
63
63
|
await handleMissingOrgId(args, list);
|
|
64
64
|
}).command("create", "Create a project", (yargs) => yargs.options({
|
|
65
|
+
secrets: {
|
|
66
|
+
describe: "Include connection credentials in command output. Use --no-secrets to omit them",
|
|
67
|
+
type: "boolean",
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
65
70
|
"block-public-connections": {
|
|
66
71
|
describe: projectCreateRequest["project.settings.block_public_connections"].description,
|
|
67
72
|
type: "boolean"
|
|
@@ -230,14 +235,20 @@ const create = async (props) => {
|
|
|
230
235
|
const { data } = await props.apiClient.createProject({ project });
|
|
231
236
|
if (props.setContext) updateContextFile(props.contextFile, { projectId: data.project.id });
|
|
232
237
|
const out = writer(props);
|
|
233
|
-
out.write(data.project, {
|
|
234
|
-
fields:
|
|
238
|
+
if (!props.secrets && (props.output === "json" || props.output === "yaml")) out.write({ project: data.project }, {
|
|
239
|
+
fields: ["project"],
|
|
235
240
|
title: "Project"
|
|
236
241
|
});
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
242
|
+
else {
|
|
243
|
+
out.write(data.project, {
|
|
244
|
+
fields: PROJECT_FIELDS,
|
|
245
|
+
title: "Project"
|
|
246
|
+
});
|
|
247
|
+
if (props.secrets) out.write(data.connection_uris, {
|
|
248
|
+
fields: ["connection_uri"],
|
|
249
|
+
title: "Connection URIs"
|
|
250
|
+
});
|
|
251
|
+
}
|
|
241
252
|
out.end();
|
|
242
253
|
if (props.psql) {
|
|
243
254
|
const connection_uri = data.connection_uris[0].connection_uri;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"yaml": "^2.9.0",
|
|
64
64
|
"yargs": "17.7.2",
|
|
65
65
|
"yoctocolors": "^2.1.2",
|
|
66
|
-
"@neon/config": "1.0.5",
|
|
67
66
|
"@neon/config-runtime": "1.0.5",
|
|
68
|
-
"@neon/sdk": "3.0.0"
|
|
67
|
+
"@neon/sdk": "3.0.0",
|
|
68
|
+
"@neon/config": "1.0.5"
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
71
|
"@napi-rs/keyring": "1.3.0",
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
"tsx": "4.22.3",
|
|
97
97
|
"typescript": "^5.9.0",
|
|
98
98
|
"vitest": "^3.0.9",
|
|
99
|
-
"@neon-internals/cli-core": "0.0.0",
|
|
100
99
|
"@neon-internals/env-core": "0.0.5",
|
|
101
|
-
"@neon/e2e-harness": "0.0.0"
|
|
100
|
+
"@neon/e2e-harness": "0.0.0",
|
|
101
|
+
"@neon-internals/cli-core": "0.0.0"
|
|
102
102
|
},
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public",
|