neon 8.22.0 → 8.23.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 +23 -0
- package/dist/_chunks/{api_keys-6Xnxl7a8.js → api_keys-CTFHd5m_.js} +27 -8
- package/dist/_chunks/{checkout-CNBIS3gA.js → checkout-BpOcFaAi.js} +3 -3
- package/dist/_chunks/{claim-DhV0f_5o.js → claim-B3tMeMuo.js} +1 -1
- package/dist/_chunks/{config-CgtJH8xE.js → config-BjCm5cfr.js} +1 -1
- package/dist/_chunks/{deploy-Bs5gmi4Q.js → deploy-DmEEhux0.js} +1 -1
- package/dist/_chunks/{dev-DxiIp4c9.js → dev-DlUJFzRs.js} +3 -3
- package/dist/_chunks/{git-DRUZBCmZ.js → git-j6xSVo3e.js} +2 -2
- package/dist/_chunks/{link-CNO-HxHN.js → link-nAiuWKfg.js} +2 -2
- package/dist/_chunks/orgs-BrvAWM8Z.js +292 -0
- package/dist/_chunks/{profile-BAlM625e.js → profile-CArcjyS4.js} +1 -1
- package/dist/_chunks/{status-BlrzeKyA.js → status-BC4XXuuE.js} +1 -1
- package/dist/api.js +1 -1
- package/dist/commands/api_keys.js +1 -1
- package/dist/commands/checkout.js +1 -1
- package/dist/commands/claim.js +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/env.js +1 -1
- package/dist/commands/functions_new.js +1 -1
- package/dist/commands/git.js +1 -1
- package/dist/commands/index.js +12 -12
- package/dist/commands/link.js +1 -1
- package/dist/commands/orgs.js +1 -1
- package/dist/commands/profile.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/subscribe.js +1 -1
- package/dist/init/auth.js +1 -1
- package/dist/init/deploy.js +1 -1
- package/dist/init/link.js +1 -1
- package/dist/init/run.js +3 -3
- package/dist/mcp/mint.js +1 -1
- package/dist/neon_client.js +4 -2
- package/package.json +6 -6
- package/dist/_chunks/orgs-Dpbr-K0A.js +0 -51
- package/dist/_chunks/{env-BtG4vH55.js → env-BOt9AZ1j.js} +1 -1
package/README.md
CHANGED
|
@@ -1518,6 +1518,28 @@ Id Name Project Created At Last Used At Last
|
|
|
1518
1518
|
|
|
1519
1519
|
`last_used_at` and `last_used_from_addr` are how you spot a key worth revoking.
|
|
1520
1520
|
|
|
1521
|
+
## Organizations (`orgs`)
|
|
1522
|
+
|
|
1523
|
+
```bash
|
|
1524
|
+
neon orgs list
|
|
1525
|
+
neon orgs get # the --org-id, linked, or only organization
|
|
1526
|
+
neon orgs members list
|
|
1527
|
+
neon orgs members get <member-id>
|
|
1528
|
+
neon orgs members update <member-id> --role admin
|
|
1529
|
+
neon orgs members remove <member-id>
|
|
1530
|
+
neon orgs invitations list
|
|
1531
|
+
neon orgs invitations create --email dev@example.com --email ops@example.com --role member
|
|
1532
|
+
neon orgs spending-limit get
|
|
1533
|
+
neon orgs spending-limit set 500 # US dollars per month
|
|
1534
|
+
neon orgs spending-limit delete
|
|
1535
|
+
```
|
|
1536
|
+
|
|
1537
|
+
Every subcommand except `list` takes `--org-id`. Without it, the CLI uses the organization in `.neon`, then the only organization you belong to, and otherwise fails naming `--org-id`. `orgs get` also takes the id as a positional argument.
|
|
1538
|
+
|
|
1539
|
+
`members update` and `invitations create` take `--role`: `admin`, `member`, `editor`, `viewer`, or `collaborator`. The API decides which of them an organization accepts. Every invitee is emailed, and anyone who already has a Neon account joins immediately.
|
|
1540
|
+
|
|
1541
|
+
`spending-limit set` takes dollars with up to two decimals and sends cents. The limit sends emails at 80% and 100% and does not suspend computes. JSON and YAML output keep the API's `spending_limit_cents`, and `members list` keeps the API's `{ member, user }` items. Role changes, member removal, and the spending limit writes need an organization admin.
|
|
1542
|
+
|
|
1521
1543
|
## Commands
|
|
1522
1544
|
|
|
1523
1545
|
| Command | Subcommands | Description |
|
|
@@ -1527,6 +1549,7 @@ Id Name Project Created At Last Used At Last
|
|
|
1527
1549
|
| profile | `list`, `create`, `rotate-key`, `remove` | Manage named sets of credentials |
|
|
1528
1550
|
| api-keys | `list`, `create`, `revoke` | Manage API keys |
|
|
1529
1551
|
| api | | Call any Neon API route |
|
|
1552
|
+
| orgs (`org`) | `list`, `get`, `members`, `invitations`, `spending-limit` | Manage organizations |
|
|
1530
1553
|
| [projects](https://neon.com/docs/reference/cli-projects) | `list`, `create`, `update`, `delete`, `get` | Manage projects |
|
|
1531
1554
|
| [ip-allow](https://neon.com/docs/reference/cli-ip-allow) | `list`, `add`, `remove`, `reset` | Manage IP Allow |
|
|
1532
1555
|
| [me](https://neon.com/docs/reference/cli-me) | | Show current user |
|
|
@@ -109,7 +109,7 @@ const handler = (args) => args;
|
|
|
109
109
|
const list = async (props) => {
|
|
110
110
|
const out = writer(props);
|
|
111
111
|
if (props.orgId) {
|
|
112
|
-
const
|
|
112
|
+
const data = await (await orgKeys(props)).list(props.orgId);
|
|
113
113
|
if (props.output === "table") out.write(data.map((key) => ({
|
|
114
114
|
...key,
|
|
115
115
|
project: key.project_id ?? ALL_PROJECTS
|
|
@@ -148,7 +148,7 @@ const create = async (props) => {
|
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
if (!projectId && orgId) {
|
|
151
|
-
const
|
|
151
|
+
const data = await (await orgKeys(props)).create(orgId, { keyName: name });
|
|
152
152
|
await assertUsable(props, data, {
|
|
153
153
|
orgId,
|
|
154
154
|
expect: NO_PROJECT
|
|
@@ -159,9 +159,9 @@ const create = async (props) => {
|
|
|
159
159
|
}
|
|
160
160
|
const scopeTo = projectId;
|
|
161
161
|
const resolvedOrgId = await orgIdForProject(props.apiClient, scopeTo);
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
const data = await (await orgKeys(props)).create(resolvedOrgId, {
|
|
163
|
+
keyName: name,
|
|
164
|
+
projectId: scopeTo
|
|
165
165
|
});
|
|
166
166
|
await assertUsable(props, data, {
|
|
167
167
|
orgId: resolvedOrgId,
|
|
@@ -170,6 +170,25 @@ const create = async (props) => {
|
|
|
170
170
|
report(props, data, CREATE_FIELDS_SCOPED, CREATE_TABLE_FIELDS_SCOPED);
|
|
171
171
|
log.info("Limited to %s: it cannot create projects, mint API keys, or read any other project. It can still change and delete everything inside that project.", scopeTo);
|
|
172
172
|
};
|
|
173
|
+
/** Organization keys through `@neon/sdk`, failing with the CLI's `NeonApiError`. */
|
|
174
|
+
const orgKeys = async (props) => {
|
|
175
|
+
const { fromSdkError, getNeonClient } = await import("../neon_client.js");
|
|
176
|
+
const keys = getNeonClient(props).organizations.apiKeys;
|
|
177
|
+
const fail = (error) => {
|
|
178
|
+
throw fromSdkError(error, props.apiHost);
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
list: (orgId) => keys.list({ orgId }).catch(fail),
|
|
182
|
+
create: (orgId, params) => keys.create({
|
|
183
|
+
orgId,
|
|
184
|
+
...params
|
|
185
|
+
}).catch(fail),
|
|
186
|
+
revoke: (orgId, keyId) => keys.revoke({
|
|
187
|
+
orgId,
|
|
188
|
+
keyId
|
|
189
|
+
}).catch(fail)
|
|
190
|
+
};
|
|
191
|
+
};
|
|
173
192
|
/**
|
|
174
193
|
* The key is shown only once, so human output keeps it on a selectable line.
|
|
175
194
|
* Structured output keeps it in the object for scripts.
|
|
@@ -229,7 +248,7 @@ const assertUsable = async (props, data, scope) => {
|
|
|
229
248
|
*/
|
|
230
249
|
const revokeOrExplain = async (props) => {
|
|
231
250
|
try {
|
|
232
|
-
return props.orgId ? await props.
|
|
251
|
+
return props.orgId ? await (await orgKeys(props)).revoke(props.orgId, props.id) : (await props.apiClient.revokeApiKey(props.id)).data;
|
|
233
252
|
} catch (err) {
|
|
234
253
|
if (isNeonApiError(err) && err.status === 404) throw new Error(props.orgId ? `No API key with id ${props.id} in ${props.orgId}. If it is one of your account's own keys, drop --org-id.` : `No account API key with id ${props.id}. If it belongs to an organization, pass --org-id. Organization keys are not visible to your account.`);
|
|
235
254
|
throw err;
|
|
@@ -239,7 +258,7 @@ const revokeOrExplain = async (props) => {
|
|
|
239
258
|
const withdraw = async (props, orgId, keyId) => {
|
|
240
259
|
if (!Number.isSafeInteger(keyId) || keyId <= 0) return false;
|
|
241
260
|
try {
|
|
242
|
-
const
|
|
261
|
+
const data = orgId ? await (await orgKeys(props)).revoke(orgId, keyId) : (await props.apiClient.revokeApiKey(keyId)).data;
|
|
243
262
|
return data.revoked === true && data.id === keyId;
|
|
244
263
|
} catch (err) {
|
|
245
264
|
log.warning("Failed to revoke API key %d: %s", keyId, err instanceof Error ? err.message : String(err));
|
|
@@ -248,7 +267,7 @@ const withdraw = async (props, orgId, keyId) => {
|
|
|
248
267
|
};
|
|
249
268
|
const revoke = async (props) => {
|
|
250
269
|
const out = writer(props);
|
|
251
|
-
const
|
|
270
|
+
const data = await revokeOrExplain(props);
|
|
252
271
|
out.write(data, {
|
|
253
272
|
fields: [
|
|
254
273
|
"id",
|
|
@@ -11,9 +11,9 @@ import { looksLikeBranchId } from "../utils/formats.js";
|
|
|
11
11
|
import { fillSingleProject, listAllProjectBranches } from "../utils/enrichers.js";
|
|
12
12
|
import { buildCheckoutEvent, readGitContext } from "../utils/git.js";
|
|
13
13
|
import { buildHookBranch, loadHookConfig, resolveHookEnv, runCheckoutAfterHook, runCheckoutBeforeHook, runCreateAfterHook, runCreateBeforeHook } from "../utils/hooks.js";
|
|
14
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
15
|
-
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-
|
|
16
|
-
import { i as handler$1 } from "./link-
|
|
14
|
+
import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
|
|
15
|
+
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-BjCm5cfr.js";
|
|
16
|
+
import { i as handler$1 } from "./link-nAiuWKfg.js";
|
|
17
17
|
import chalk from "chalk";
|
|
18
18
|
import prompts from "prompts";
|
|
19
19
|
// src/commands/checkout.ts
|
|
@@ -12,7 +12,7 @@ import { projectConfigPath } from "../project.js";
|
|
|
12
12
|
import { resolveEnvFilePath } from "../env_file.js";
|
|
13
13
|
import { writer } from "../writer.js";
|
|
14
14
|
import { noPassthrough } from "../utils/flags.js";
|
|
15
|
-
import { c as pull } from "./env-
|
|
15
|
+
import { c as pull } from "./env-BOt9AZ1j.js";
|
|
16
16
|
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
17
17
|
import open from "open";
|
|
18
18
|
import prompts from "prompts";
|
|
@@ -26,7 +26,7 @@ import { readGitContext } from "../utils/git.js";
|
|
|
26
26
|
import { resolveHookEnv, runDeployAfterHook, runDeployBeforeHook } from "../utils/hooks.js";
|
|
27
27
|
import { pickServicesInteractively } from "../utils/service_picker.js";
|
|
28
28
|
import { zipBundle } from "../utils/zip.js";
|
|
29
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
29
|
+
import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
|
|
30
30
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
31
31
|
import { dirname, join, relative, resolve } from "node:path";
|
|
32
32
|
import chalk from "chalk";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
2
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
3
|
-
import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-
|
|
3
|
+
import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-BjCm5cfr.js";
|
|
4
4
|
import { DEPLOY_COMMANDS_EPILOGUE } from "../commands/deploy_help.js";
|
|
5
5
|
// src/commands/deploy.ts
|
|
6
6
|
var deploy_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -4,12 +4,12 @@ import { isClaimableEnvTarget } from "../claimable/state.js";
|
|
|
4
4
|
import { getCliName } from "../utils/cli_name.js";
|
|
5
5
|
import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
6
6
|
import { l as functionBaseUrlKey } from "./env-JgoSsmyt.js";
|
|
7
|
-
import { branchIdResolve } from "../utils/enrichers.js";
|
|
8
|
-
import { bundleEntry } from "../utils/esbuild.js";
|
|
9
7
|
import { a as resolveDevEnv } from "./env-CIFMBEon.js";
|
|
10
|
-
import { f as envFlag } from "./config-CgtJH8xE.js";
|
|
11
8
|
import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
12
9
|
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
10
|
+
import { branchIdResolve } from "../utils/enrichers.js";
|
|
11
|
+
import { bundleEntry } from "../utils/esbuild.js";
|
|
12
|
+
import { f as envFlag } from "./config-BjCm5cfr.js";
|
|
13
13
|
import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
14
14
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
@@ -5,8 +5,8 @@ import { CONTEXT_FILE, contextBranch, gitBranchMap, gitBranchMapping, isUnfollow
|
|
|
5
5
|
import { writer } from "../writer.js";
|
|
6
6
|
import { neonSafeBranchName } from "../utils/branch_name.js";
|
|
7
7
|
import { currentGitBranch, gitPull, gitRepoRoot, hasUpstream, installPostCheckoutHook, isGitRepo, isManagedHook, localGitBranches, postCheckoutHookPath, readGitContext, removePostCheckoutHook } from "../utils/git.js";
|
|
8
|
-
import { o as quoteFlagValue } from "./link-
|
|
9
|
-
import { o as handler$1 } from "./checkout-
|
|
8
|
+
import { o as quoteFlagValue } from "./link-nAiuWKfg.js";
|
|
9
|
+
import { o as handler$1 } from "./checkout-BpOcFaAi.js";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import chalk from "chalk";
|
|
@@ -13,8 +13,8 @@ import { writer } from "../writer.js";
|
|
|
13
13
|
import { createBranch, pickBranchInteractively } from "../utils/branch_picker.js";
|
|
14
14
|
import { looksLikeBranchId } from "../utils/formats.js";
|
|
15
15
|
import { listAllProjectBranches } from "../utils/enrichers.js";
|
|
16
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
17
|
-
import { h as initCmd } from "./config-
|
|
16
|
+
import { n as autoPullEnvAfterPin } from "./env-BOt9AZ1j.js";
|
|
17
|
+
import { h as initCmd } from "./config-BjCm5cfr.js";
|
|
18
18
|
import { formatLinkSummary } from "../commands/link_output.js";
|
|
19
19
|
import { r as REGIONS } from "./projects-a3X4OFEJ.js";
|
|
20
20
|
import prompts from "prompts";
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
|
+
import { log } from "../log.js";
|
|
3
|
+
import { readContextFile } from "../context.js";
|
|
4
|
+
import { writer } from "../writer.js";
|
|
5
|
+
import { noPassthrough, single } from "../utils/flags.js";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
// src/commands/orgs.ts
|
|
8
|
+
var orgs_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
aliases: () => aliases,
|
|
10
|
+
builder: () => builder,
|
|
11
|
+
command: () => command,
|
|
12
|
+
describe: () => describe,
|
|
13
|
+
handler: () => handler,
|
|
14
|
+
parseUsdCents: () => parseUsdCents,
|
|
15
|
+
planName: () => planName
|
|
16
|
+
});
|
|
17
|
+
const ORG_FIELDS = [
|
|
18
|
+
"id",
|
|
19
|
+
"name",
|
|
20
|
+
"plan"
|
|
21
|
+
];
|
|
22
|
+
const ORG_DETAIL_FIELDS = [
|
|
23
|
+
"id",
|
|
24
|
+
"name",
|
|
25
|
+
"handle",
|
|
26
|
+
"plan",
|
|
27
|
+
"created_at"
|
|
28
|
+
];
|
|
29
|
+
const MEMBER_TABLE_FIELDS = [
|
|
30
|
+
"id",
|
|
31
|
+
"email",
|
|
32
|
+
"role",
|
|
33
|
+
"joined_at"
|
|
34
|
+
];
|
|
35
|
+
const MEMBER_FIELDS = [
|
|
36
|
+
"id",
|
|
37
|
+
"user_id",
|
|
38
|
+
"role",
|
|
39
|
+
"joined_at"
|
|
40
|
+
];
|
|
41
|
+
const INVITATION_FIELDS = [
|
|
42
|
+
"id",
|
|
43
|
+
"email",
|
|
44
|
+
"role",
|
|
45
|
+
"invited_at"
|
|
46
|
+
];
|
|
47
|
+
const SPENDING_LIMIT_TABLE_FIELDS = ["monthly_limit"];
|
|
48
|
+
const MEMBER_ROLES = [
|
|
49
|
+
"admin",
|
|
50
|
+
"member",
|
|
51
|
+
"editor",
|
|
52
|
+
"viewer",
|
|
53
|
+
"collaborator"
|
|
54
|
+
];
|
|
55
|
+
const orgIdOption = { "org-id": {
|
|
56
|
+
describe: "Organization ID. Defaults to the linked organization, or your only one",
|
|
57
|
+
type: "string",
|
|
58
|
+
coerce: single("org-id")
|
|
59
|
+
} };
|
|
60
|
+
/**
|
|
61
|
+
* An empty, negated, misspelled, or `--`-separated `--org-id` must fail rather than fall
|
|
62
|
+
* back to the linked organization: these commands change members, invitations, and billing.
|
|
63
|
+
*/
|
|
64
|
+
const guarded = (yargs) => yargs.strict().check(noPassthrough("orgs"));
|
|
65
|
+
const roleOption = (describe) => ({ role: {
|
|
66
|
+
describe,
|
|
67
|
+
type: "string",
|
|
68
|
+
choices: MEMBER_ROLES,
|
|
69
|
+
demandOption: true
|
|
70
|
+
} });
|
|
71
|
+
const command = "orgs";
|
|
72
|
+
const describe = "Manage organizations";
|
|
73
|
+
const aliases = ["org"];
|
|
74
|
+
const builder = (argv) => {
|
|
75
|
+
return argv.usage("$0 orgs <sub-command> [options]").command("list", "List organizations", (yargs) => yargs, async (args) => {
|
|
76
|
+
await list(args);
|
|
77
|
+
}).command("get [id]", "Show an organization", (yargs) => yargs.positional("id", {
|
|
78
|
+
describe: "Organization ID. Defaults to --org-id, the linked organization, or your only one",
|
|
79
|
+
type: "string"
|
|
80
|
+
}).options(orgIdOption).strict().check(noPassthrough("orgs")), async (args) => await get(args)).command("members", "Manage organization members", (yargs) => yargs.usage("$0 orgs members <sub-command> [options]").options(orgIdOption).command("list", "List members and their organization role", guarded, async (args) => await listMembers(args)).command("get <member-id>", "Show a member", (yargs) => guarded(yargs.positional("member-id", {
|
|
81
|
+
describe: "Member ID, from `orgs members list`",
|
|
82
|
+
type: "string"
|
|
83
|
+
})), async (args) => await getMember(args)).command("update <member-id>", "Change a member's organization role. Admin only", (yargs) => yargs.positional("member-id", {
|
|
84
|
+
describe: "Member ID, from `orgs members list`",
|
|
85
|
+
type: "string"
|
|
86
|
+
}).options(roleOption("The new organization role")).strict().check(noPassthrough("orgs")), async (args) => await updateMember(args)).command("remove <member-id>", "Remove a member from the organization. Admin only", (yargs) => guarded(yargs.positional("member-id", {
|
|
87
|
+
describe: "Member ID, from `orgs members list`",
|
|
88
|
+
type: "string"
|
|
89
|
+
})), async (args) => await removeMember(args))).command("invitations", "Manage organization invitations", (yargs) => yargs.usage("$0 orgs invitations <sub-command> [options]").options(orgIdOption).command("list", "List invitations", guarded, async (args) => await listInvitations(args)).command("create", "Invite people by email. Each one is emailed, and anyone with a Neon account joins immediately", (yargs) => yargs.options({
|
|
90
|
+
email: {
|
|
91
|
+
describe: "Email address to invite. Repeat to invite several",
|
|
92
|
+
type: "string",
|
|
93
|
+
array: true,
|
|
94
|
+
demandOption: true
|
|
95
|
+
},
|
|
96
|
+
...roleOption("The organization role every invitee gets")
|
|
97
|
+
}).strict().check(noPassthrough("orgs")), async (args) => await createInvitations(args))).command("spending-limit", "Manage the organization's monthly spending limit (Launch and Scale plans)", (yargs) => yargs.usage("$0 orgs spending-limit <sub-command> [options]").options(orgIdOption).command("get", "Show the monthly spending limit", guarded, async (args) => await getSpendingLimit(args)).command("set <usd>", "Set the monthly spending limit. Neon emails at 80% and 100% and keeps computes running. Admin only", (yargs) => guarded(yargs.positional("usd", {
|
|
98
|
+
describe: "Monthly limit in US dollars, e.g. 500 or 250.50",
|
|
99
|
+
type: "string"
|
|
100
|
+
})), async (args) => await setSpendingLimit(args)).command("delete", "Remove the monthly spending limit. Admin only", guarded, async (args) => await deleteSpendingLimit(args)));
|
|
101
|
+
};
|
|
102
|
+
const handler = (args) => {
|
|
103
|
+
return args;
|
|
104
|
+
};
|
|
105
|
+
const list = async (props) => {
|
|
106
|
+
const out = writer(props);
|
|
107
|
+
const { data: { organizations } } = await props.apiClient.getCurrentUserOrganizations();
|
|
108
|
+
const current = readContextFile(props.contextFile).orgId;
|
|
109
|
+
out.write(organizations, {
|
|
110
|
+
fields: ORG_FIELDS,
|
|
111
|
+
title: "Organizations",
|
|
112
|
+
emptyMessage: "You are not a member of any organization.",
|
|
113
|
+
renderColumns: {
|
|
114
|
+
plan: (org) => planName(org.plan),
|
|
115
|
+
name: (org) => org.id === current ? `${chalk.green("[current]")} ${org.name}` : org.name
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
out.end();
|
|
119
|
+
};
|
|
120
|
+
/** The SDK client, its error mapper, and the org from the flag, `.neon`, or the only one. */
|
|
121
|
+
const sdk = async (props) => {
|
|
122
|
+
const [{ fromSdkError, getNeonClient }, { fillSingleOrg }] = await Promise.all([import("../neon_client.js"), import("../utils/enrichers.js")]);
|
|
123
|
+
const { orgId } = await fillSingleOrg({
|
|
124
|
+
...props,
|
|
125
|
+
orgId: props.orgId ?? ""
|
|
126
|
+
});
|
|
127
|
+
return {
|
|
128
|
+
neon: getNeonClient(props),
|
|
129
|
+
orgId,
|
|
130
|
+
fail: (error) => fromSdkError(error, props.apiHost)
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const get = async (props) => {
|
|
134
|
+
const { neon, fail, orgId } = await sdk({
|
|
135
|
+
...props,
|
|
136
|
+
orgId: props.id ?? props.orgId
|
|
137
|
+
});
|
|
138
|
+
const org = await neon.organizations.get({ orgId }).catch((error) => {
|
|
139
|
+
throw fail(error);
|
|
140
|
+
});
|
|
141
|
+
writer(props).end(org, {
|
|
142
|
+
fields: ORG_DETAIL_FIELDS,
|
|
143
|
+
renderColumns: { plan: (value) => planName(value.plan) }
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const listMembers = async (props) => {
|
|
147
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
148
|
+
const members = await neon.organizations.members.list({ orgId }).all().catch((error) => {
|
|
149
|
+
throw fail(error);
|
|
150
|
+
});
|
|
151
|
+
const config = {
|
|
152
|
+
title: `Members of ${orgId}`,
|
|
153
|
+
emptyMessage: `No members in ${orgId}.`
|
|
154
|
+
};
|
|
155
|
+
if (props.output === "table") {
|
|
156
|
+
writer(props).end(members.map(memberRow), {
|
|
157
|
+
fields: MEMBER_TABLE_FIELDS,
|
|
158
|
+
...config
|
|
159
|
+
});
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
writer(props).end(members, {
|
|
163
|
+
fields: [],
|
|
164
|
+
...config
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
const memberRow = ({ member, user }) => ({
|
|
168
|
+
id: member.id,
|
|
169
|
+
email: user.email,
|
|
170
|
+
role: member.role,
|
|
171
|
+
joined_at: member.joined_at
|
|
172
|
+
});
|
|
173
|
+
const getMember = async (props) => {
|
|
174
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
175
|
+
const member = await neon.organizations.members.get({
|
|
176
|
+
orgId,
|
|
177
|
+
memberId: props.memberId
|
|
178
|
+
}).catch((error) => {
|
|
179
|
+
throw fail(error);
|
|
180
|
+
});
|
|
181
|
+
writeMember(props, member);
|
|
182
|
+
};
|
|
183
|
+
const updateMember = async (props) => {
|
|
184
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
185
|
+
const member = await neon.organizations.members.update({
|
|
186
|
+
orgId,
|
|
187
|
+
memberId: props.memberId,
|
|
188
|
+
role: props.role
|
|
189
|
+
}).catch((error) => {
|
|
190
|
+
throw fail(error);
|
|
191
|
+
});
|
|
192
|
+
writeMember(props, member);
|
|
193
|
+
};
|
|
194
|
+
const writeMember = (props, member) => {
|
|
195
|
+
writer(props).end(member, { fields: MEMBER_FIELDS });
|
|
196
|
+
};
|
|
197
|
+
const removeMember = async (props) => {
|
|
198
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
199
|
+
await neon.organizations.members.remove({
|
|
200
|
+
orgId,
|
|
201
|
+
memberId: props.memberId
|
|
202
|
+
}).catch((error) => {
|
|
203
|
+
throw fail(error);
|
|
204
|
+
});
|
|
205
|
+
log.info(`Member ${props.memberId} removed from ${orgId}`);
|
|
206
|
+
};
|
|
207
|
+
const listInvitations = async (props) => {
|
|
208
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
209
|
+
const invitations = await neon.organizations.invitations.list({ orgId }).catch((error) => {
|
|
210
|
+
throw fail(error);
|
|
211
|
+
});
|
|
212
|
+
writeInvitations(props, orgId, invitations);
|
|
213
|
+
};
|
|
214
|
+
const createInvitations = async (props) => {
|
|
215
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
216
|
+
const invitations = await neon.organizations.invitations.create({
|
|
217
|
+
orgId,
|
|
218
|
+
invitations: props.email.map((email) => ({
|
|
219
|
+
email,
|
|
220
|
+
role: props.role
|
|
221
|
+
}))
|
|
222
|
+
}).catch((error) => {
|
|
223
|
+
throw fail(error);
|
|
224
|
+
});
|
|
225
|
+
writeInvitations(props, orgId, invitations);
|
|
226
|
+
};
|
|
227
|
+
const writeInvitations = (props, orgId, invitations) => {
|
|
228
|
+
writer(props).end(invitations, {
|
|
229
|
+
fields: INVITATION_FIELDS,
|
|
230
|
+
title: `Invitations to ${orgId}`,
|
|
231
|
+
emptyMessage: `No invitations to ${orgId}.`
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
const getSpendingLimit = async (props) => {
|
|
235
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
236
|
+
const limit = await neon.organizations.spendingLimit.get({ orgId }).catch((error) => {
|
|
237
|
+
throw fail(error);
|
|
238
|
+
});
|
|
239
|
+
writeSpendingLimit(props, orgId, limit);
|
|
240
|
+
};
|
|
241
|
+
const setSpendingLimit = async (props) => {
|
|
242
|
+
const spendingLimitCents = parseUsdCents(props.usd);
|
|
243
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
244
|
+
const limit = await neon.organizations.spendingLimit.set({
|
|
245
|
+
orgId,
|
|
246
|
+
spendingLimitCents
|
|
247
|
+
}).catch((error) => {
|
|
248
|
+
throw fail(error);
|
|
249
|
+
});
|
|
250
|
+
writeSpendingLimit(props, orgId, limit);
|
|
251
|
+
};
|
|
252
|
+
const deleteSpendingLimit = async (props) => {
|
|
253
|
+
const { neon, fail, orgId } = await sdk(props);
|
|
254
|
+
await neon.organizations.spendingLimit.delete({ orgId }).catch((error) => {
|
|
255
|
+
throw fail(error);
|
|
256
|
+
});
|
|
257
|
+
log.info(`Spending limit removed from ${orgId}`);
|
|
258
|
+
};
|
|
259
|
+
/** JSON and YAML keep the API's cents; the table shows dollars. */
|
|
260
|
+
const writeSpendingLimit = (props, orgId, limit) => {
|
|
261
|
+
if (props.output !== "table") {
|
|
262
|
+
writer(props).end(limit, { fields: [] });
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const cents = limit.spending_limit_cents;
|
|
266
|
+
writer(props).end({ monthly_limit: cents === null ? "Not set" : formatUsd(cents) }, {
|
|
267
|
+
fields: SPENDING_LIMIT_TABLE_FIELDS,
|
|
268
|
+
title: `Spending limit for ${orgId}`
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
const USD = new Intl.NumberFormat("en-US", {
|
|
272
|
+
style: "currency",
|
|
273
|
+
currency: "USD"
|
|
274
|
+
});
|
|
275
|
+
const formatUsd = (cents) => USD.format(cents / 100);
|
|
276
|
+
/**
|
|
277
|
+
* `500` or `250.50` → cents. Parsed as text, not with `Number()`: `1e3` and `0x10` are
|
|
278
|
+
* numbers too, and a float multiply turns `0.29` into 28.999… cents.
|
|
279
|
+
*/
|
|
280
|
+
const parseUsdCents = (value) => {
|
|
281
|
+
const match = typeof value === "string" ? /^(\d+)(?:\.(\d{1,2}))?$/.exec(value.trim()) : null;
|
|
282
|
+
const cents = match ? Number(match[1]) * 100 + Number((match[2] ?? "").padEnd(2, "0")) : NaN;
|
|
283
|
+
if (!Number.isSafeInteger(cents) || cents <= 0) throw new Error(`spending-limit set needs a positive amount in US dollars, such as 500 or 250.50. Got \`${String(value)}\`. To remove the limit, run \`neon orgs spending-limit delete\`.`);
|
|
284
|
+
return cents;
|
|
285
|
+
};
|
|
286
|
+
const ACRONYMS = {
|
|
287
|
+
aws: "AWS",
|
|
288
|
+
pg: "PG"
|
|
289
|
+
};
|
|
290
|
+
/** `free_v3` -> `Free`, `aws_marketplace` -> `AWS Marketplace`; JSON/YAML keep the API id. */
|
|
291
|
+
const planName = (plan) => (plan ?? "").replace(/_v\d+$/, "").split("_").filter(Boolean).map((word) => ACRONYMS[word] ?? word[0].toUpperCase() + word.slice(1)).join(" ");
|
|
292
|
+
export { handler as a, planName as c, describe as i, builder as n, orgs_exports as o, command as r, parseUsdCents as s, aliases as t };
|
|
@@ -14,7 +14,7 @@ import { m as usableCredential, n as authFlow } from "./auth-rup6nemJ.js";
|
|
|
14
14
|
import { identityFromAuthDetails, isApiKeyMethod, mintedKeyName, notAnApiKeyMessage } from "../profile_keys.js";
|
|
15
15
|
import { writer } from "../writer.js";
|
|
16
16
|
import { noPassthrough, single } from "../utils/flags.js";
|
|
17
|
-
import { s as orgIdForProject } from "./api_keys-
|
|
17
|
+
import { s as orgIdForProject } from "./api_keys-CTFHd5m_.js";
|
|
18
18
|
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
19
19
|
import { isAbsolute, relative } from "node:path";
|
|
20
20
|
import prompts from "prompts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
2
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
3
|
-
import { y as status } from "./config-
|
|
3
|
+
import { y as status } from "./config-BjCm5cfr.js";
|
|
4
4
|
// src/commands/status.ts
|
|
5
5
|
var status_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
builder: () => builder,
|
package/dist/api.js
CHANGED
|
@@ -1098,4 +1098,4 @@ const getApiClient = ({ apiKey, apiHost, requestTimeoutMs = REQUEST_TIMEOUT_MS }
|
|
|
1098
1098
|
}))
|
|
1099
1099
|
};
|
|
1100
1100
|
};
|
|
1101
|
-
export { ContentType, DEFAULT_API_HOST, NeonApiError, RETRY_COUNT, UnreadableResponseError, cliFetch, codeFromBody, getApiClient, httpError, isNeonApiError, messageFromBody, pathSegment, retryOnLock, unreadableBodyError };
|
|
1101
|
+
export { ContentType, DEFAULT_API_HOST, NeonApiError, RETRY_COUNT, UnreadableResponseError, cliFetch, codeFromBody, getApiClient, httpError, isAbortError, isNeonApiError, messageFromBody, networkError, pathSegment, retryOnLock, unreadableBodyError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, r as builder, i as command, a as describe, o as handler, s as orgIdForProject } from "../_chunks/api_keys-
|
|
1
|
+
export { t as aliases, r as builder, i as command, a as describe, o as handler, s as orgIdForProject } from "../_chunks/api_keys-CTFHd5m_.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-
|
|
1
|
+
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-BpOcFaAi.js";
|
package/dist/commands/claim.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-
|
|
1
|
+
export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-B3tMeMuo.js";
|
package/dist/commands/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-
|
|
1
|
+
export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-BjCm5cfr.js";
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-
|
|
1
|
+
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-DmEEhux0.js";
|
package/dist/commands/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-
|
|
1
|
+
export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionUrlEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-DlUJFzRs.js";
|
package/dist/commands/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-
|
|
1
|
+
export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-BOt9AZ1j.js";
|
|
@@ -8,7 +8,7 @@ import { writer } from "../writer.js";
|
|
|
8
8
|
import { formatInitDone, printInitDone } from "../init/chrome.js";
|
|
9
9
|
import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
|
|
10
10
|
import { displayPath } from "./env_output.js";
|
|
11
|
-
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-
|
|
11
|
+
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-BjCm5cfr.js";
|
|
12
12
|
import { recommendedOperations } from "../functions/registry.js";
|
|
13
13
|
import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
|
|
14
14
|
import { describeRegistrySource, openRegistry } from "../functions/source.js";
|
package/dist/commands/git.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-
|
|
1
|
+
export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-j6xSVo3e.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { r as auth_exports } from "../_chunks/auth-rup6nemJ.js";
|
|
2
2
|
import { t as api_exports } from "../_chunks/api-1MKsfpY3.js";
|
|
3
|
-
import { n as api_keys_exports } from "../_chunks/api_keys-
|
|
3
|
+
import { n as api_keys_exports } from "../_chunks/api_keys-CTFHd5m_.js";
|
|
4
4
|
import { n as ask_exports } from "../_chunks/ask-Xlek1Pxh.js";
|
|
5
|
-
import { o as env_exports } from "../_chunks/env-
|
|
6
|
-
import { c as config_exports } from "../_chunks/config-
|
|
5
|
+
import { o as env_exports } from "../_chunks/env-BOt9AZ1j.js";
|
|
6
|
+
import { c as config_exports } from "../_chunks/config-BjCm5cfr.js";
|
|
7
7
|
import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
|
|
8
|
-
import { a as link_exports } from "../_chunks/link-
|
|
8
|
+
import { a as link_exports } from "../_chunks/link-nAiuWKfg.js";
|
|
9
9
|
import { o as mcp_exports } from "../_chunks/mcp-SvqWzHnT.js";
|
|
10
10
|
import { c as plugins_exports } from "../_chunks/plugins-7cxVcgay.js";
|
|
11
11
|
import { l as skills_exports } from "../_chunks/skills-Bv8oKKwE.js";
|
|
12
12
|
import { t as bootstrap_exports } from "../_chunks/bootstrap-Dh7-KDmw.js";
|
|
13
13
|
import { r as branches_exports } from "../_chunks/branches-Bp-5z1lM.js";
|
|
14
14
|
import { n as bucket_exports } from "../_chunks/bucket-D06bvDSa.js";
|
|
15
|
-
import { n as checkout_exports } from "../_chunks/checkout-
|
|
16
|
-
import { o as claim_exports } from "../_chunks/claim-
|
|
15
|
+
import { n as checkout_exports } from "../_chunks/checkout-BpOcFaAi.js";
|
|
16
|
+
import { o as claim_exports } from "../_chunks/claim-B3tMeMuo.js";
|
|
17
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
20
|
import { s as databases_exports } from "../_chunks/databases-B-qY303S.js";
|
|
21
|
-
import { r as deploy_exports } from "../_chunks/deploy-
|
|
22
|
-
import { s as dev_exports } from "../_chunks/dev-
|
|
21
|
+
import { r as deploy_exports } from "../_chunks/deploy-DmEEhux0.js";
|
|
22
|
+
import { s as dev_exports } from "../_chunks/dev-DlUJFzRs.js";
|
|
23
23
|
import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
|
|
24
24
|
import { c as docs_exports } from "../_chunks/docs-BpLiSTmm.js";
|
|
25
25
|
import { o as feedback_exports } from "../_chunks/feedback-mQmdTRFn.js";
|
|
26
26
|
import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
|
|
27
|
-
import { o as git_exports } from "../_chunks/git-
|
|
27
|
+
import { o as git_exports } from "../_chunks/git-j6xSVo3e.js";
|
|
28
28
|
import { a as init_exports } from "../_chunks/init-D2fClHtC.js";
|
|
29
29
|
import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
|
|
30
30
|
import { a as ip_allow_exports } from "../_chunks/ip_allow-DBdxNEUa.js";
|
|
@@ -32,15 +32,15 @@ import { l as logs_exports } from "../_chunks/logs-BB4uvblR.js";
|
|
|
32
32
|
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
|
-
import { o as orgs_exports } from "../_chunks/orgs-
|
|
35
|
+
import { o as orgs_exports } from "../_chunks/orgs-BrvAWM8Z.js";
|
|
36
36
|
import { o as psql_exports } from "../_chunks/psql-BcxiPR4W.js";
|
|
37
37
|
import { f as roles_exports } from "../_chunks/roles-BELJqjTy.js";
|
|
38
38
|
import { o as postgres_exports } from "../_chunks/postgres-BhR1vUFM.js";
|
|
39
|
-
import { o as profile_exports } from "../_chunks/profile-
|
|
39
|
+
import { o as profile_exports } from "../_chunks/profile-CArcjyS4.js";
|
|
40
40
|
import { s as realtime_exports } from "../_chunks/realtime-BwtzYf5a.js";
|
|
41
41
|
import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
|
|
42
42
|
import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
|
|
43
|
-
import { a as status_exports } from "../_chunks/status-
|
|
43
|
+
import { a as status_exports } from "../_chunks/status-BC4XXuuE.js";
|
|
44
44
|
import { d as triggers_exports } from "../_chunks/triggers-BfvyeJUC.js";
|
|
45
45
|
import { s as user_exports } from "../_chunks/user-D9mC430O.js";
|
|
46
46
|
import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-C-Y4WK2M.js";
|
package/dist/commands/link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-nAiuWKfg.js";
|
package/dist/commands/orgs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as command, i as describe, a as handler, s as planName } from "../_chunks/orgs-
|
|
1
|
+
export { t as aliases, n as builder, r as command, i as describe, a as handler, s as parseUsdCents, c as planName } from "../_chunks/orgs-BrvAWM8Z.js";
|
package/dist/commands/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as command, i as describe, a as handler } from "../_chunks/profile-
|
|
1
|
+
export { t as aliases, n as builder, r as command, i as describe, a as handler } from "../_chunks/profile-CArcjyS4.js";
|
package/dist/commands/status.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-BC4XXuuE.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writer } from "../writer.js";
|
|
2
|
-
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
3
2
|
import { o as resolveNeonEnvVars } from "../_chunks/env-CIFMBEon.js";
|
|
3
|
+
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
// src/commands/subscribe.ts
|
|
6
6
|
const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
|
package/dist/init/auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import "../config.js";
|
|
|
4
4
|
import "../auth.js";
|
|
5
5
|
import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-rup6nemJ.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
|
-
import { c as pull } from "../_chunks/env-
|
|
7
|
+
import { c as pull } from "../_chunks/env-BOt9AZ1j.js";
|
|
8
8
|
import { c as setupNeonMcp } from "../_chunks/mcp-SvqWzHnT.js";
|
|
9
9
|
// src/init/auth.ts
|
|
10
10
|
const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
|
package/dist/init/deploy.js
CHANGED
|
@@ -4,7 +4,7 @@ import { c as ensureAuth } from "../_chunks/auth-rup6nemJ.js";
|
|
|
4
4
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
5
5
|
import { loadProjectConfig } from "../project.js";
|
|
6
6
|
import { loadEnvFileIntoProcess } from "../env_file.js";
|
|
7
|
-
import { r as applyCmd } from "../_chunks/config-
|
|
7
|
+
import { r as applyCmd } from "../_chunks/config-BjCm5cfr.js";
|
|
8
8
|
import { authContext } from "./auth.js";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
10
|
// src/init/deploy.ts
|
package/dist/init/link.js
CHANGED
|
@@ -4,7 +4,7 @@ import "../config.js";
|
|
|
4
4
|
import "../auth.js";
|
|
5
5
|
import { c as ensureAuth } from "../_chunks/auth-rup6nemJ.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
|
-
import { s as runLink } from "../_chunks/link-
|
|
7
|
+
import { s as runLink } from "../_chunks/link-nAiuWKfg.js";
|
|
8
8
|
// src/init/link.ts
|
|
9
9
|
const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
|
|
10
10
|
const authenticationFailed = () => /* @__PURE__ */ new Error("Authentication failed.");
|
package/dist/init/run.js
CHANGED
|
@@ -14,8 +14,8 @@ import { getAgentDisplayName } from "../mcp/agents.js";
|
|
|
14
14
|
import { missingPluginsCommands, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "../plugins/targets.js";
|
|
15
15
|
import { AGENTS_NOT_INSTALLED, CANCELLED_BODY, CLAIMABLE_ACCOUNT_FLAGS, CLAIMABLE_ALREADY_LINKED, CLAIMABLE_MCP_API_KEY, CLAIMABLE_NO_LINK, MCP_API_KEY_NEEDS_AUTH, MCP_SCOPED_NEEDS_PROJECT, NON_TTY_LINK_NEEDS_AUTH, NO_AGENTS_FALLBACK_STATUS, PROGRESS, PROJECT_PINNED_OFFLINE, claimableNext, claimableThenServicesNext, configInitNext, envPullFailedNext, existingConfigNext, installFailedNext, mcpAfterLinkNext, mcpConfigLocationSkipped, mcpConfigLocationUnavailable, mcpKeyFailedNext, namedAgentsUnavailable, newConfigNext, offlinePinNext, skippedLinkNext, toolingFailedNext, unattendedUnauthedNext } from "./copy.js";
|
|
16
16
|
import { agentsRowValue, configRowValue, formatInitDone, headingForKind, printInitBanner, printInitDone, printInitProgress, projectRowValue, shouldPrintInitBanner } from "./chrome.js";
|
|
17
|
-
import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-
|
|
18
|
-
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-
|
|
17
|
+
import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-BjCm5cfr.js";
|
|
18
|
+
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-nAiuWKfg.js";
|
|
19
19
|
import { runAuthenticatedLink } from "./link.js";
|
|
20
20
|
import { mcpInstallableAgents } from "../mcp/targets.js";
|
|
21
21
|
import { skillsInstallableAgents } from "../skills/targets.js";
|
|
@@ -25,7 +25,7 @@ import { pullInitEnv, resolveInitConfigApi } from "./auth.js";
|
|
|
25
25
|
import { InitCancelled, raceSigint, restoreCursor } from "./cancelled.js";
|
|
26
26
|
import { pickAgentSetupInteractively, pickInitAgentsInteractively, pickInitConfigInteractively, pickInitMcpAuthInteractively, pickInitMcpConfigLocationInteractively, pickInitModeInteractively, pickInitPackageManagerInteractively, pickInitProjectSetupInteractively, pickInitServicesInteractively, pickInitSkillsInteractively } from "./wizard.js";
|
|
27
27
|
import { runToolingSteps, toolingStepCommandText } from "./tooling.js";
|
|
28
|
-
import { l as create } from "../_chunks/claim-
|
|
28
|
+
import { l as create } from "../_chunks/claim-B3tMeMuo.js";
|
|
29
29
|
import { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice } from "./choices.js";
|
|
30
30
|
import { detectInitEnvironment } from "./detect.js";
|
|
31
31
|
import { createInitFunnel, emitInitStart, finishInitFunnel, initStartProperties, recordInitError, recordInitExit } from "./funnel.js";
|
package/dist/mcp/mint.js
CHANGED
|
@@ -2,7 +2,7 @@ import { log } from "../log.js";
|
|
|
2
2
|
import { isNeonApiError } from "../api.js";
|
|
3
3
|
import { getCliName } from "../utils/cli_name.js";
|
|
4
4
|
import { mintedKeyName } from "../profile_keys.js";
|
|
5
|
-
import { s as orgIdForProject } from "../_chunks/api_keys-
|
|
5
|
+
import { s as orgIdForProject } from "../_chunks/api_keys-CTFHd5m_.js";
|
|
6
6
|
// src/mcp/mint.ts
|
|
7
7
|
var CannotMintApiKeyError = class extends Error {
|
|
8
8
|
constructor() {
|
package/dist/neon_client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cliFetch, httpError, unreadableBodyError } from "./api.js";
|
|
1
|
+
import { cliFetch, httpError, isAbortError, networkError, unreadableBodyError } from "./api.js";
|
|
2
2
|
import { NeonApiError, createNeonClient } from "@neon/sdk";
|
|
3
3
|
// src/neon_client.ts
|
|
4
4
|
/**
|
|
@@ -15,13 +15,15 @@ const getNeonClient = ({ apiKey, apiHost, requestTimeoutMs }) => createNeonClien
|
|
|
15
15
|
});
|
|
16
16
|
/**
|
|
17
17
|
* Map an error from {@link getNeonClient} for the top-level handler. A management API
|
|
18
|
-
* response becomes the CLI's `NeonApiError`, so 401 and SSO recovery apply
|
|
18
|
+
* response becomes the CLI's `NeonApiError`, so 401 and SSO recovery apply, and a request
|
|
19
|
+
* timeout becomes the same `ECONNABORTED` error the raw client throws. Anything else
|
|
19
20
|
* keeps the SDK's message and drops its `cause`, so a socket code deep in the chain cannot
|
|
20
21
|
* turn a "role was created, but…" message into the generic connectivity hint.
|
|
21
22
|
*/
|
|
22
23
|
function fromSdkError(error, apiHost) {
|
|
23
24
|
const base = apiHost ?? "https://console.neon.tech/api/v2";
|
|
24
25
|
if (error instanceof NeonApiError && error.response?.url.startsWith(base)) return error.response.ok ? unreadableBodyError(error.response, error.body) : httpError(error.response, error.body);
|
|
26
|
+
if (isAbortError(error)) return networkError(error);
|
|
25
27
|
return new Error(error instanceof Error ? error.message : String(error));
|
|
26
28
|
}
|
|
27
29
|
export { fromSdkError, getNeonClient };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.23.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/config": "1.11.1",
|
|
77
|
-
"@neon/config-runtime": "1.11.5",
|
|
78
76
|
"@neon/realtime": "0.2.0",
|
|
79
|
-
"@neon/sdk": "7.
|
|
77
|
+
"@neon/sdk": "7.9.0",
|
|
78
|
+
"@neon/config-runtime": "1.11.6",
|
|
79
|
+
"@neon/config": "1.11.2"
|
|
80
80
|
},
|
|
81
81
|
"optionalDependencies": {
|
|
82
82
|
"@napi-rs/keyring": "1.3.0",
|
|
@@ -113,9 +113,9 @@
|
|
|
113
113
|
"typescript": "^5.9.0",
|
|
114
114
|
"vitest": "^3.0.9",
|
|
115
115
|
"@neon-internals/cli-core": "0.0.0",
|
|
116
|
-
"@neon-internals/env-core": "0.0.
|
|
116
|
+
"@neon-internals/env-core": "0.0.44",
|
|
117
117
|
"@neon/e2e-harness": "0.0.0",
|
|
118
|
-
"@neon/env": "1.6.
|
|
118
|
+
"@neon/env": "1.6.14",
|
|
119
119
|
"@neon/functions": "0.11.0"
|
|
120
120
|
},
|
|
121
121
|
"publishConfig": {
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
|
-
import { readContextFile } from "../context.js";
|
|
3
|
-
import { writer } from "../writer.js";
|
|
4
|
-
import chalk from "chalk";
|
|
5
|
-
// src/commands/orgs.ts
|
|
6
|
-
var orgs_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
aliases: () => aliases,
|
|
8
|
-
builder: () => builder,
|
|
9
|
-
command: () => command,
|
|
10
|
-
describe: () => describe,
|
|
11
|
-
handler: () => handler,
|
|
12
|
-
planName: () => planName
|
|
13
|
-
});
|
|
14
|
-
const ORG_FIELDS = [
|
|
15
|
-
"id",
|
|
16
|
-
"name",
|
|
17
|
-
"plan"
|
|
18
|
-
];
|
|
19
|
-
const command = "orgs";
|
|
20
|
-
const describe = "Manage organizations";
|
|
21
|
-
const aliases = ["org"];
|
|
22
|
-
const builder = (argv) => {
|
|
23
|
-
return argv.usage("$0 orgs <sub-command> [options]").command("list", "List organizations", (yargs) => yargs, async (args) => {
|
|
24
|
-
await list(args);
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
const handler = (args) => {
|
|
28
|
-
return args;
|
|
29
|
-
};
|
|
30
|
-
const list = async (props) => {
|
|
31
|
-
const out = writer(props);
|
|
32
|
-
const { data: { organizations } } = await props.apiClient.getCurrentUserOrganizations();
|
|
33
|
-
const current = readContextFile(props.contextFile).orgId;
|
|
34
|
-
out.write(organizations, {
|
|
35
|
-
fields: ORG_FIELDS,
|
|
36
|
-
title: "Organizations",
|
|
37
|
-
emptyMessage: "You are not a member of any organization.",
|
|
38
|
-
renderColumns: {
|
|
39
|
-
plan: (org) => planName(org.plan),
|
|
40
|
-
name: (org) => org.id === current ? `${chalk.green("[current]")} ${org.name}` : org.name
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
out.end();
|
|
44
|
-
};
|
|
45
|
-
const ACRONYMS = {
|
|
46
|
-
aws: "AWS",
|
|
47
|
-
pg: "PG"
|
|
48
|
-
};
|
|
49
|
-
/** `free_v3` -> `Free`, `aws_marketplace` -> `AWS Marketplace`; JSON/YAML keep the API id. */
|
|
50
|
-
const planName = (plan) => (plan ?? "").replace(/_v\d+$/, "").split("_").filter(Boolean).map((word) => ACRONYMS[word] ?? word[0].toUpperCase() + word.slice(1)).join(" ");
|
|
51
|
-
export { handler as a, describe as i, builder as n, orgs_exports as o, command as r, planName as s, aliases as t };
|
|
@@ -7,9 +7,9 @@ import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOpt
|
|
|
7
7
|
import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
8
8
|
import { t as NEON_ENV_VAR_KEYS, u as isFunctionBaseUrlKey } from "./env-JgoSsmyt.js";
|
|
9
9
|
import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
|
|
10
|
+
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CIFMBEon.js";
|
|
10
11
|
import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
|
|
11
12
|
import { warnAiGateway } from "../utils/ai_gateway_notice.js";
|
|
12
|
-
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CIFMBEon.js";
|
|
13
13
|
import { formatPulledEnv, pulledBranch } from "../commands/env_output.js";
|
|
14
14
|
import { existsSync } from "node:fs";
|
|
15
15
|
import chalk from "chalk";
|