neon 8.20.1 → 8.21.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 +21 -0
- package/dist/_chunks/computes-OKFUNFee.js +208 -0
- package/dist/_chunks/{connection_string-C9e7N4xk.js → connection_string-6WhV4WFx.js} +5 -3
- package/dist/_chunks/{databases-B2Yapqme.js → databases-B-qY303S.js} +4 -2
- package/dist/_chunks/postgres-BkJPZRov.js +31 -0
- package/dist/_chunks/{psql-Bce4X0NG.js → psql-BcxiPR4W.js} +6 -4
- package/dist/_chunks/{roles-CNoDyRf4.js → roles-BXGtPGjv.js} +4 -2
- package/dist/commands/computes.js +1 -0
- package/dist/commands/connection_string.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/index.js +6 -4
- package/dist/commands/manifest.js +6 -0
- package/dist/commands/postgres.js +1 -0
- package/dist/commands/psql.js +1 -1
- package/dist/commands/roles.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1179,6 +1179,26 @@ neon credentials revoke nak_live_…
|
|
|
1179
1179
|
|
|
1180
1180
|
All sub-commands honor the [global options](#global-options), including `--output json|yaml|table`.
|
|
1181
1181
|
|
|
1182
|
+
## Postgres (`postgres`)
|
|
1183
|
+
|
|
1184
|
+
`neon postgres` (aliases `neon pg` and `neon lakebase`) groups the Postgres commands: `computes`, `databases`, `roles`, `connection-string` (`cs`), and `psql`. `neon postgres roles list` and `neon roles list` run the same command; the top-level spellings keep working.
|
|
1185
|
+
|
|
1186
|
+
`neon postgres computes` (aliases `compute`, `endpoints`, `endpoint`) manages the computes in a project:
|
|
1187
|
+
|
|
1188
|
+
```bash
|
|
1189
|
+
neon postgres computes list # the .neon branch's computes, else every compute in the project
|
|
1190
|
+
neon postgres computes list --branch main
|
|
1191
|
+
neon postgres computes list --all-branches # every compute in the project, even when .neon pins a branch
|
|
1192
|
+
neon postgres computes get ep-cool-king-123456
|
|
1193
|
+
neon postgres computes update ep-cool-king-123456 --cu 0.25-2 --suspend-timeout 600
|
|
1194
|
+
neon postgres computes suspend ep-cool-king-123456
|
|
1195
|
+
neon postgres computes start ep-cool-king-123456
|
|
1196
|
+
neon postgres computes restart ep-cool-king-123456
|
|
1197
|
+
neon postgres computes delete ep-cool-king-123456
|
|
1198
|
+
```
|
|
1199
|
+
|
|
1200
|
+
`update`, `start`, `suspend`, `restart`, and `delete` wait until the change is applied. `update`, `start`, `suspend`, and `restart` then print the compute as the API reports it; `delete` prints a confirmation on stderr. `--no-wait` returns as soon as the API accepts the request. `update` sends only the flags you pass and fails without one. To add a compute, use `neon branches add-compute`.
|
|
1201
|
+
|
|
1182
1202
|
## Database diagnostics (`inspect`)
|
|
1183
1203
|
|
|
1184
1204
|
`neon inspect db stalled-queries` takes a read-only snapshot of active queries that have run for more than 30 seconds and groups parallel workers with their leader. Oldest group first. Table output shows duration, wait event, blocking pids, role, query group, and query. `--output json` adds timestamps, query IDs, pids, database, and the rest of the row. A blocking pid can belong to an idle-in-transaction backend this command does not list; `neon inspect db locks` shows lock holders.
|
|
@@ -1511,6 +1531,7 @@ Id Name Project Created At Last Used At Last
|
|
|
1511
1531
|
| [ip-allow](https://neon.com/docs/reference/cli-ip-allow) | `list`, `add`, `remove`, `reset` | Manage IP Allow |
|
|
1512
1532
|
| [me](https://neon.com/docs/reference/cli-me) | | Show current user |
|
|
1513
1533
|
| [branches](https://neon.com/docs/reference/cli-branches) | `list`, `create`, `rename`, `add-compute`, `set-default`, `set-expiration`, `delete`, `get` | Manage branches |
|
|
1534
|
+
| postgres (`pg`, `lakebase`) | `computes`, `databases`, `roles`, `connection-string`, `psql` | Manage Postgres and connect to it |
|
|
1514
1535
|
| [databases](https://neon.com/docs/reference/cli-databases) | `list`, `create`, `delete` | Manage databases |
|
|
1515
1536
|
| function | `deploy`, `list`, `get`, `delete`, `domains list`, `domains register`, `domains delete` | Manage Neon Functions |
|
|
1516
1537
|
| [roles](https://neon.com/docs/reference/cli-roles) | `list`, `create`, `delete` | Manage roles |
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
|
+
import { log } from "../log.js";
|
|
3
|
+
import { endpointUpdateRequest } from "../parameters.gen.js";
|
|
4
|
+
import { writer } from "../writer.js";
|
|
5
|
+
import { fillSingleProject, resolveBranchFromProps } from "../utils/enrichers.js";
|
|
6
|
+
import { getComputeUnits } from "../utils/compute_units.js";
|
|
7
|
+
// src/commands/computes.ts
|
|
8
|
+
var computes_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
aliases: () => aliases,
|
|
10
|
+
builder: () => builder,
|
|
11
|
+
builderFor: () => builderFor,
|
|
12
|
+
command: () => command,
|
|
13
|
+
deleteCompute: () => deleteCompute,
|
|
14
|
+
describe: () => describe,
|
|
15
|
+
get: () => get,
|
|
16
|
+
handler: () => handler,
|
|
17
|
+
list: () => list,
|
|
18
|
+
restart: () => restart,
|
|
19
|
+
start: () => start,
|
|
20
|
+
suspend: () => suspend,
|
|
21
|
+
update: () => update
|
|
22
|
+
});
|
|
23
|
+
const COMPUTE_FIELDS = [
|
|
24
|
+
"id",
|
|
25
|
+
"branch_id",
|
|
26
|
+
"type",
|
|
27
|
+
"current_state",
|
|
28
|
+
"autoscaling_limit_min_cu",
|
|
29
|
+
"autoscaling_limit_max_cu"
|
|
30
|
+
];
|
|
31
|
+
const COMPUTE_DETAIL_FIELDS = [
|
|
32
|
+
"id",
|
|
33
|
+
"name",
|
|
34
|
+
"branch_id",
|
|
35
|
+
"type",
|
|
36
|
+
"current_state",
|
|
37
|
+
"pending_state",
|
|
38
|
+
"host",
|
|
39
|
+
"region_id",
|
|
40
|
+
"autoscaling_limit_min_cu",
|
|
41
|
+
"autoscaling_limit_max_cu",
|
|
42
|
+
"suspend_timeout_seconds",
|
|
43
|
+
"disabled",
|
|
44
|
+
"last_active",
|
|
45
|
+
"created_at"
|
|
46
|
+
];
|
|
47
|
+
const waitOption = { wait: {
|
|
48
|
+
describe: "Wait until the change is applied. Use --no-wait to return as soon as the API accepts it",
|
|
49
|
+
type: "boolean",
|
|
50
|
+
default: true
|
|
51
|
+
} };
|
|
52
|
+
const command = "computes";
|
|
53
|
+
const aliases = [
|
|
54
|
+
"compute",
|
|
55
|
+
"endpoints",
|
|
56
|
+
"endpoint"
|
|
57
|
+
];
|
|
58
|
+
const describe = "Manage Postgres computes";
|
|
59
|
+
const builderFor = (usage) => (argv) => argv.usage(`$0 ${usage} <sub-command> [options]`).options({ "project-id": {
|
|
60
|
+
describe: "Project ID",
|
|
61
|
+
type: "string"
|
|
62
|
+
} }).middleware(fillSingleProject).command("list", "List computes. Lists the branch's computes when --branch is passed or .neon pins one, otherwise every compute in the project", (yargs) => yargs.options({
|
|
63
|
+
branch: {
|
|
64
|
+
describe: "Branch ID or name",
|
|
65
|
+
type: "string"
|
|
66
|
+
},
|
|
67
|
+
"all-branches": {
|
|
68
|
+
describe: "List every compute in the project, ignoring --branch and the branch .neon pins",
|
|
69
|
+
type: "boolean",
|
|
70
|
+
default: false
|
|
71
|
+
}
|
|
72
|
+
}), (args) => list(args)).command("get <id>", "Get a compute", (yargs) => yargs, (args) => get(args)).command("update <id>", "Update a compute's size, scale-to-zero timeout, name, or connection access", (yargs) => yargs.options({
|
|
73
|
+
cu: {
|
|
74
|
+
describe: "The number of Compute Units. Could be a fixed size (e.g. \"2\") or a range delimited by a dash (e.g. \"0.5-3\").",
|
|
75
|
+
type: "string"
|
|
76
|
+
},
|
|
77
|
+
"suspend-timeout": {
|
|
78
|
+
describe: endpointUpdateRequest["endpoint.suspend_timeout_seconds"].description,
|
|
79
|
+
type: "number"
|
|
80
|
+
},
|
|
81
|
+
name: {
|
|
82
|
+
describe: "Name of the compute",
|
|
83
|
+
type: "string"
|
|
84
|
+
},
|
|
85
|
+
disabled: {
|
|
86
|
+
describe: "Restrict connections to the compute. Disabling schedules a suspend. Use --disabled=false to allow connections again.",
|
|
87
|
+
type: "boolean"
|
|
88
|
+
},
|
|
89
|
+
...waitOption
|
|
90
|
+
}), (args) => update(args)).command("start <id>", "Start a compute", (yargs) => yargs.options(waitOption), (args) => start(args)).command("suspend <id>", "Suspend a compute", (yargs) => yargs.options(waitOption), (args) => suspend(args)).command("restart <id>", "Restart a compute", (yargs) => yargs.options(waitOption), (args) => restart(args)).command("delete <id>", "Delete a compute", (yargs) => yargs.options(waitOption), (args) => deleteCompute(args));
|
|
91
|
+
const builder = builderFor("computes");
|
|
92
|
+
const handler = (args) => {
|
|
93
|
+
return args;
|
|
94
|
+
};
|
|
95
|
+
const sdk = async (props) => {
|
|
96
|
+
const { fromSdkError, getNeonClient } = await import("../neon_client.js");
|
|
97
|
+
return {
|
|
98
|
+
neon: getNeonClient(props),
|
|
99
|
+
fail: (error) => fromSdkError(error, props.apiHost)
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
const writeCompute = (props, compute, humanTitle) => {
|
|
103
|
+
writer(props).end(compute, {
|
|
104
|
+
fields: COMPUTE_DETAIL_FIELDS,
|
|
105
|
+
humanTitle
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
const list = async (props) => {
|
|
109
|
+
const { neon, fail } = await sdk(props);
|
|
110
|
+
if (props.allBranches || props.branch === void 0) {
|
|
111
|
+
const computes = await neon.postgres.endpoints.list({ projectId: props.projectId }).catch((error) => {
|
|
112
|
+
throw fail(error);
|
|
113
|
+
});
|
|
114
|
+
writer(props).end(computes, {
|
|
115
|
+
fields: COMPUTE_FIELDS,
|
|
116
|
+
humanTitle: `Computes in project ${props.projectId}`,
|
|
117
|
+
emptyMessage: `No computes in project ${props.projectId}.`
|
|
118
|
+
});
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const { branchId, branch } = await resolveBranchFromProps(props);
|
|
122
|
+
const computes = await neon.postgres.endpoints.listByBranch({
|
|
123
|
+
projectId: props.projectId,
|
|
124
|
+
branchId
|
|
125
|
+
}).catch((error) => {
|
|
126
|
+
throw fail(error);
|
|
127
|
+
});
|
|
128
|
+
const branchLabel = branch?.name ?? branchId;
|
|
129
|
+
writer(props).end(computes, {
|
|
130
|
+
fields: COMPUTE_FIELDS,
|
|
131
|
+
humanTitle: `Computes on ${branchLabel}`,
|
|
132
|
+
emptyMessage: `No computes on ${branchLabel}.`
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
const get = async (props) => {
|
|
136
|
+
const { neon, fail } = await sdk(props);
|
|
137
|
+
const compute = await neon.postgres.endpoints.get({
|
|
138
|
+
projectId: props.projectId,
|
|
139
|
+
endpointId: props.id
|
|
140
|
+
}).catch((error) => {
|
|
141
|
+
throw fail(error);
|
|
142
|
+
});
|
|
143
|
+
writeCompute(props, compute);
|
|
144
|
+
};
|
|
145
|
+
const updateRequest = (props) => {
|
|
146
|
+
const endpoint = {
|
|
147
|
+
...props.cu === void 0 ? {} : getComputeUnits(props.cu),
|
|
148
|
+
...props.suspendTimeout === void 0 ? {} : { suspend_timeout_seconds: props.suspendTimeout },
|
|
149
|
+
...props.name === void 0 ? {} : { name: props.name },
|
|
150
|
+
...props.disabled === void 0 ? {} : { disabled: props.disabled }
|
|
151
|
+
};
|
|
152
|
+
if (Object.keys(endpoint).length === 0) throw new Error("Nothing to update. Pass --cu, --suspend-timeout, --name, or --disabled.");
|
|
153
|
+
return endpoint;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Mutations return the compute as it was when the request was accepted, so after waiting
|
|
157
|
+
* the compute is read again to show the state the change produced.
|
|
158
|
+
*/
|
|
159
|
+
const mutate = async (props, action, run) => {
|
|
160
|
+
const { neon, fail } = await sdk(props);
|
|
161
|
+
const params = {
|
|
162
|
+
projectId: props.projectId,
|
|
163
|
+
endpointId: props.id
|
|
164
|
+
};
|
|
165
|
+
try {
|
|
166
|
+
const accepted = await run(neon, params, { waitForReadiness: props.wait });
|
|
167
|
+
if (!props.wait) {
|
|
168
|
+
writeCompute(props, accepted, `Compute ${props.id}: ${action.verb} accepted, not yet applied`);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
writeCompute(props, await neon.postgres.endpoints.get(params), `Compute ${props.id} ${action.done}`);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
throw fail(error);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const update = (props) => {
|
|
177
|
+
const endpoint = updateRequest(props);
|
|
178
|
+
return mutate(props, {
|
|
179
|
+
verb: "update",
|
|
180
|
+
done: "updated"
|
|
181
|
+
}, (neon, params, opts) => neon.postgres.endpoints.update({
|
|
182
|
+
...params,
|
|
183
|
+
...endpoint
|
|
184
|
+
}, opts));
|
|
185
|
+
};
|
|
186
|
+
const start = (props) => mutate(props, {
|
|
187
|
+
verb: "start",
|
|
188
|
+
done: "started"
|
|
189
|
+
}, (neon, params, opts) => neon.postgres.endpoints.start(params, opts));
|
|
190
|
+
const suspend = (props) => mutate(props, {
|
|
191
|
+
verb: "suspend",
|
|
192
|
+
done: "suspended"
|
|
193
|
+
}, (neon, params, opts) => neon.postgres.endpoints.suspend(params, opts));
|
|
194
|
+
const restart = (props) => mutate(props, {
|
|
195
|
+
verb: "restart",
|
|
196
|
+
done: "restarted"
|
|
197
|
+
}, (neon, params, opts) => neon.postgres.endpoints.restart(params, opts));
|
|
198
|
+
const deleteCompute = async (props) => {
|
|
199
|
+
const { neon, fail } = await sdk(props);
|
|
200
|
+
await neon.postgres.endpoints.delete({
|
|
201
|
+
projectId: props.projectId,
|
|
202
|
+
endpointId: props.id
|
|
203
|
+
}, { waitForReadiness: props.wait }).catch((error) => {
|
|
204
|
+
throw fail(error);
|
|
205
|
+
});
|
|
206
|
+
log.info(props.wait ? `Compute ${props.id} deleted` : `Compute ${props.id}: delete accepted, not yet applied`);
|
|
207
|
+
};
|
|
208
|
+
export { computes_exports as a, get as c, restart as d, start as f, command as i, handler as l, update as m, builder as n, deleteCompute as o, suspend as p, builderFor as r, describe as s, aliases as t, list as u };
|
|
@@ -10,6 +10,7 @@ var connection_string_exports = /* @__PURE__ */ __exportAll({
|
|
|
10
10
|
SSL_MODES: () => SSL_MODES,
|
|
11
11
|
aliases: () => aliases,
|
|
12
12
|
builder: () => builder,
|
|
13
|
+
builderFor: () => builderFor,
|
|
13
14
|
command: () => command,
|
|
14
15
|
describe: () => describe,
|
|
15
16
|
handler: () => handler
|
|
@@ -23,8 +24,8 @@ const SSL_MODES = [
|
|
|
23
24
|
const command = "connection-string [branch]";
|
|
24
25
|
const aliases = ["cs"];
|
|
25
26
|
const describe = "Get connection string";
|
|
26
|
-
const
|
|
27
|
-
return argv.usage(
|
|
27
|
+
const builderFor = (usage) => (argv) => {
|
|
28
|
+
return argv.usage(`$0 ${usage} [branch] [options]`).example("$0 cs main", "Get connection string for the main branch").example("$0 cs main@2024-01-01T00:00:00Z", "Get connection string for the main branch at a specific point in time").example("$0 cs main@0/234235", "Get connection string for the main branch at a specific LSN").positional("branch", {
|
|
28
29
|
describe: `Branch name or id. Defaults to the default branch if omitted. Can be written in the point-in-time format: "branch@timestamp" or "branch@lsn"`,
|
|
29
30
|
type: "string"
|
|
30
31
|
}).options({
|
|
@@ -78,6 +79,7 @@ const builder = (argv) => {
|
|
|
78
79
|
}
|
|
79
80
|
}).middleware(fillSingleProject);
|
|
80
81
|
};
|
|
82
|
+
const builder = builderFor("connection-string");
|
|
81
83
|
const handler = async (props) => {
|
|
82
84
|
const projectId = props.projectId;
|
|
83
85
|
const parsedPIT = props.branch ? parsePITBranch(props.branch) : {
|
|
@@ -150,4 +152,4 @@ const handler = async (props) => {
|
|
|
150
152
|
] });
|
|
151
153
|
else process.stdout.write(connectionString.toString() + "\n");
|
|
152
154
|
};
|
|
153
|
-
export {
|
|
155
|
+
export { command as a, handler as c, builderFor as i, aliases as n, connection_string_exports as o, builder as r, describe as s, SSL_MODES as t };
|
|
@@ -8,6 +8,7 @@ var databases_exports = /* @__PURE__ */ __exportAll({
|
|
|
8
8
|
DATABASE_FIELDS: () => DATABASE_FIELDS,
|
|
9
9
|
aliases: () => aliases,
|
|
10
10
|
builder: () => builder,
|
|
11
|
+
builderFor: () => builderFor,
|
|
11
12
|
command: () => command,
|
|
12
13
|
create: () => create,
|
|
13
14
|
deleteDb: () => deleteDb,
|
|
@@ -23,7 +24,7 @@ const DATABASE_FIELDS = [
|
|
|
23
24
|
const command = "databases";
|
|
24
25
|
const describe = "Manage databases";
|
|
25
26
|
const aliases = ["database", "db"];
|
|
26
|
-
const
|
|
27
|
+
const builderFor = (usage) => (argv) => argv.usage(`$0 ${usage} <sub-command> [options]`).options({
|
|
27
28
|
"project-id": {
|
|
28
29
|
describe: "Project ID",
|
|
29
30
|
type: "string"
|
|
@@ -43,6 +44,7 @@ const builder = (argv) => argv.usage("$0 databases <sub-command> [options]").opt
|
|
|
43
44
|
type: "string"
|
|
44
45
|
}
|
|
45
46
|
}), (args) => create(args)).command("delete <database>", "Delete a database", (yargs) => yargs, (args) => deleteDb(args));
|
|
47
|
+
const builder = builderFor("databases");
|
|
46
48
|
const handler = (args) => {
|
|
47
49
|
return args;
|
|
48
50
|
};
|
|
@@ -85,4 +87,4 @@ const deleteDb = async (props) => {
|
|
|
85
87
|
}
|
|
86
88
|
log.info(`Database "${props.database}" not found on branch ${branch?.name ?? branchId}; nothing to delete.`);
|
|
87
89
|
};
|
|
88
|
-
export {
|
|
90
|
+
export { command as a, deleteDb as c, list as d, builderFor as i, describe as l, aliases as n, create as o, builder as r, databases_exports as s, DATABASE_FIELDS as t, handler as u };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
|
+
import { a as computes_exports } from "./computes-OKFUNFee.js";
|
|
3
|
+
import { o as connection_string_exports } from "./connection_string-6WhV4WFx.js";
|
|
4
|
+
import { s as databases_exports } from "./databases-B-qY303S.js";
|
|
5
|
+
import { o as psql_exports } from "./psql-BcxiPR4W.js";
|
|
6
|
+
import { u as roles_exports } from "./roles-BXGtPGjv.js";
|
|
7
|
+
// src/commands/postgres.ts
|
|
8
|
+
var postgres_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
aliases: () => aliases,
|
|
10
|
+
builder: () => builder,
|
|
11
|
+
command: () => command,
|
|
12
|
+
describe: () => describe,
|
|
13
|
+
handler: () => handler
|
|
14
|
+
});
|
|
15
|
+
const nested = (group) => ({
|
|
16
|
+
command: group.command,
|
|
17
|
+
aliases: group.aliases,
|
|
18
|
+
describe: group.describe,
|
|
19
|
+
builder: group.builderFor(`postgres ${group.command.split(" ")[0]}`),
|
|
20
|
+
handler: async (args) => {
|
|
21
|
+
await group.handler(args);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const command = "postgres";
|
|
25
|
+
const aliases = ["pg", "lakebase"];
|
|
26
|
+
const describe = "Manage Postgres computes, databases, and roles, and connect with psql or a connection string";
|
|
27
|
+
const builder = (argv) => argv.usage("$0 postgres <sub-command> [options]").command(nested(computes_exports)).command(nested(databases_exports)).command(nested(roles_exports)).command(nested(connection_string_exports)).command(nested(psql_exports));
|
|
28
|
+
const handler = (args) => {
|
|
29
|
+
return args;
|
|
30
|
+
};
|
|
31
|
+
export { handler as a, describe as i, builder as n, postgres_exports as o, command as r, aliases as t };
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
2
|
import { EndpointType } from "../utils/api_enums.js";
|
|
3
3
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
4
|
-
import {
|
|
4
|
+
import { c as handler$1, t as SSL_MODES } from "./connection_string-6WhV4WFx.js";
|
|
5
5
|
// src/commands/psql.ts
|
|
6
6
|
var psql_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
builder: () => builder,
|
|
8
|
+
builderFor: () => builderFor,
|
|
8
9
|
command: () => command,
|
|
9
10
|
describe: () => describe,
|
|
10
11
|
handler: () => handler
|
|
11
12
|
});
|
|
12
13
|
const command = "psql [branch]";
|
|
13
14
|
const describe = "Connect to a database via psql";
|
|
14
|
-
const
|
|
15
|
-
return argv.usage(
|
|
15
|
+
const builderFor = (usage) => (argv) => {
|
|
16
|
+
return argv.usage(`$0 ${usage} [branch] [options] [-- psql-args]`).example("$0 psql", "Connect to the default branch via psql").example("$0 psql main", "Connect to the main branch via psql").example("$0 psql main -- -c \"SELECT 1\"", "Run a single query against the main branch").example("$0 psql main@2024-01-01T00:00:00Z", "Connect to the main branch at a specific point in time").positional("branch", {
|
|
16
17
|
describe: `Branch name or id. Defaults to the default branch if omitted. Can be written in the point-in-time format: "branch@timestamp" or "branch@lsn"`,
|
|
17
18
|
type: "string"
|
|
18
19
|
}).options({
|
|
@@ -52,6 +53,7 @@ const builder = (argv) => {
|
|
|
52
53
|
}
|
|
53
54
|
}).middleware(fillSingleProject);
|
|
54
55
|
};
|
|
56
|
+
const builder = builderFor("psql");
|
|
55
57
|
const handler = async (props) => {
|
|
56
58
|
await handler$1({
|
|
57
59
|
...props,
|
|
@@ -60,4 +62,4 @@ const handler = async (props) => {
|
|
|
60
62
|
extended: false
|
|
61
63
|
});
|
|
62
64
|
};
|
|
63
|
-
export {
|
|
65
|
+
export { handler as a, describe as i, builderFor as n, psql_exports as o, command as r, builder as t };
|
|
@@ -7,6 +7,7 @@ import { fillSingleProject, resolveBranchFromProps } from "../utils/enrichers.js
|
|
|
7
7
|
var roles_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
aliases: () => aliases,
|
|
9
9
|
builder: () => builder,
|
|
10
|
+
builderFor: () => builderFor,
|
|
10
11
|
command: () => command,
|
|
11
12
|
create: () => create,
|
|
12
13
|
deleteRole: () => deleteRole,
|
|
@@ -28,7 +29,7 @@ const ROLE_ACCESS = [
|
|
|
28
29
|
const command = "roles";
|
|
29
30
|
const describe = "Manage roles";
|
|
30
31
|
const aliases = ["role"];
|
|
31
|
-
const
|
|
32
|
+
const builderFor = (usage) => (argv) => argv.usage(`$0 ${usage} <sub-command> [options]`).options({
|
|
32
33
|
"project-id": {
|
|
33
34
|
describe: "Project ID",
|
|
34
35
|
type: "string"
|
|
@@ -66,6 +67,7 @@ const builder = (argv) => argv.usage("$0 roles <sub-command> [options]").options
|
|
|
66
67
|
if (args.access === "admin" && (args.database !== void 0 || args.schema !== void 0)) throw new Error("--database and --schema need --access read_only or --access read_write");
|
|
67
68
|
return true;
|
|
68
69
|
}), (args) => create(args)).command("delete <role>", "Delete a role", (yargs) => yargs, (args) => deleteRole(args));
|
|
70
|
+
const builder = builderFor("roles");
|
|
69
71
|
const handler = (args) => {
|
|
70
72
|
return args;
|
|
71
73
|
};
|
|
@@ -125,4 +127,4 @@ const deleteRole = async (props) => {
|
|
|
125
127
|
}
|
|
126
128
|
log.info(`Role "${props.role}" not found on branch ${branch?.name ?? branchId}; nothing to delete.`);
|
|
127
129
|
};
|
|
128
|
-
export {
|
|
130
|
+
export { create as a, handler as c, command as i, list as l, builder as n, deleteRole as o, builderFor as r, describe as s, aliases as t, roles_exports as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as aliases, n as builder, r as builderFor, i as command, o as deleteCompute, s as describe, c as get, l as handler, u as list, d as restart, f as start, p as suspend, m as update } from "../_chunks/computes-OKFUNFee.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as SSL_MODES, n as aliases, r as builder, i as command,
|
|
1
|
+
export { t as SSL_MODES, n as aliases, r as builder, i as builderFor, a as command, s as describe, c as handler } from "../_chunks/connection_string-6WhV4WFx.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as DATABASE_FIELDS, n as aliases, r as builder, i as
|
|
1
|
+
export { t as DATABASE_FIELDS, n as aliases, r as builder, i as builderFor, a as command, o as create, c as deleteDb, l as describe, u as handler, d as list } from "../_chunks/databases-B-qY303S.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -14,10 +14,10 @@ import { r as branches_exports } from "../_chunks/branches-Bp-5z1lM.js";
|
|
|
14
14
|
import { n as bucket_exports } from "../_chunks/bucket-D06bvDSa.js";
|
|
15
15
|
import { n as checkout_exports } from "../_chunks/checkout-CNBIS3gA.js";
|
|
16
16
|
import { o as claim_exports } from "../_chunks/claim-DhV0f_5o.js";
|
|
17
|
-
import {
|
|
17
|
+
import { o as connection_string_exports } from "../_chunks/connection_string-6WhV4WFx.js";
|
|
18
18
|
import { a as credentials_exports } from "../_chunks/credentials-BMBNmW0t.js";
|
|
19
19
|
import { r as data_api_exports } from "../_chunks/data_api-CHDwvMTG.js";
|
|
20
|
-
import {
|
|
20
|
+
import { s as databases_exports } from "../_chunks/databases-B-qY303S.js";
|
|
21
21
|
import { r as deploy_exports } from "../_chunks/deploy-Bs5gmi4Q.js";
|
|
22
22
|
import { s as dev_exports } from "../_chunks/dev-DxiIp4c9.js";
|
|
23
23
|
import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
|
|
@@ -33,10 +33,11 @@ import { a as neon_auth_exports } from "../_chunks/neon_auth-C1CgNTGP.js";
|
|
|
33
33
|
import { a as open_exports } from "../_chunks/open-T2nI89Oh.js";
|
|
34
34
|
import { c as operations_exports } from "../_chunks/operations-D7qGkKo3.js";
|
|
35
35
|
import { o as orgs_exports } from "../_chunks/orgs-Dpbr-K0A.js";
|
|
36
|
+
import { o as psql_exports } from "../_chunks/psql-BcxiPR4W.js";
|
|
37
|
+
import { u as roles_exports } from "../_chunks/roles-BXGtPGjv.js";
|
|
38
|
+
import { o as postgres_exports } from "../_chunks/postgres-BkJPZRov.js";
|
|
36
39
|
import { o as profile_exports } from "../_chunks/profile-BAlM625e.js";
|
|
37
|
-
import { a as psql_exports } from "../_chunks/psql-Bce4X0NG.js";
|
|
38
40
|
import { s as realtime_exports } from "../_chunks/realtime-BwtzYf5a.js";
|
|
39
|
-
import { l as roles_exports } from "../_chunks/roles-CNoDyRf4.js";
|
|
40
41
|
import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
|
|
41
42
|
import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
|
|
42
43
|
import { a as status_exports } from "../_chunks/status-BlrzeKyA.js";
|
|
@@ -56,6 +57,7 @@ var commands_default = [
|
|
|
56
57
|
vpc_endpoints_exports,
|
|
57
58
|
neon_auth_exports,
|
|
58
59
|
branches_exports,
|
|
60
|
+
postgres_exports,
|
|
59
61
|
databases_exports,
|
|
60
62
|
roles_exports,
|
|
61
63
|
operations_exports,
|
|
@@ -71,6 +71,12 @@ const commandManifest = [
|
|
|
71
71
|
describe: "Manage branches",
|
|
72
72
|
load: () => import("./branches.js")
|
|
73
73
|
},
|
|
74
|
+
{
|
|
75
|
+
command: "postgres",
|
|
76
|
+
aliases: ["pg", "lakebase"],
|
|
77
|
+
describe: "Manage Postgres computes, databases, and roles, and connect with psql or a connection string",
|
|
78
|
+
load: () => import("./postgres.js")
|
|
79
|
+
},
|
|
74
80
|
{
|
|
75
81
|
command: "databases",
|
|
76
82
|
aliases: ["database", "db"],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as aliases, n as builder, r as command, i as describe, a as handler } from "../_chunks/postgres-BkJPZRov.js";
|
package/dist/commands/psql.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as
|
|
1
|
+
export { t as builder, n as builderFor, r as command, i as describe, a as handler } from "../_chunks/psql-BcxiPR4W.js";
|
package/dist/commands/roles.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as
|
|
1
|
+
export { t as aliases, n as builder, r as builderFor, i as command, a as create, o as deleteRole, s as describe, c as handler, l as list } from "../_chunks/roles-BXGtPGjv.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.21.0",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"yaml": "^2.9.0",
|
|
74
74
|
"yargs": "17.7.2",
|
|
75
75
|
"yoctocolors": "^2.1.2",
|
|
76
|
-
"@neon/realtime": "0.2.0",
|
|
77
76
|
"@neon/config-runtime": "1.11.4",
|
|
78
|
-
"@neon/
|
|
79
|
-
"@neon/sdk": "7.8.1"
|
|
77
|
+
"@neon/realtime": "0.2.0",
|
|
78
|
+
"@neon/sdk": "7.8.1",
|
|
79
|
+
"@neon/config": "1.11.0"
|
|
80
80
|
},
|
|
81
81
|
"optionalDependencies": {
|
|
82
82
|
"@napi-rs/keyring": "1.3.0",
|