neon 8.3.2 → 8.3.4
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/dist/commands/dev.js +2 -2
- package/dist/commands/env.js +1 -1
- package/dist/human_table.js +22 -2
- package/dist/utils/inspect_db.js +32 -24
- package/package.json +3 -3
package/dist/commands/dev.js
CHANGED
|
@@ -4,11 +4,11 @@ import { isClaimableEnvTarget } from "../claimable/state.js";
|
|
|
4
4
|
import { getCliName } from "../utils/cli_name.js";
|
|
5
5
|
import { readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
6
6
|
import { l as functionBaseUrlKey } from "../_chunks/env-HYNFtxu5.js";
|
|
7
|
-
import { branchIdResolve } from "../utils/enrichers.js";
|
|
8
|
-
import { bundleEntry } from "../utils/esbuild.js";
|
|
9
7
|
import { a as resolveDevEnv } from "../_chunks/env-BWqJqBDJ.js";
|
|
10
8
|
import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
11
9
|
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
10
|
+
import { branchIdResolve } from "../utils/enrichers.js";
|
|
11
|
+
import { bundleEntry } from "../utils/esbuild.js";
|
|
12
12
|
import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
package/dist/commands/env.js
CHANGED
|
@@ -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 "../_chunks/env-HYNFtxu5.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 "../_chunks/env-BWqJqBDJ.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 "../_chunks/env-BWqJqBDJ.js";
|
|
13
13
|
import { formatPulledEnv, pulledBranch } from "./env_output.js";
|
|
14
14
|
import { existsSync } from "node:fs";
|
|
15
15
|
import chalk from "chalk";
|
package/dist/human_table.js
CHANGED
|
@@ -132,8 +132,28 @@ function flattenCell(value) {
|
|
|
132
132
|
if (isObject(value)) return JSON.stringify(value);
|
|
133
133
|
return String(value).replace(/\s+/g, " ").trim();
|
|
134
134
|
}
|
|
135
|
+
const LABEL_WORDS = {
|
|
136
|
+
api: "API",
|
|
137
|
+
cname: "CNAME",
|
|
138
|
+
cors: "CORS",
|
|
139
|
+
db: "DB",
|
|
140
|
+
id: "ID",
|
|
141
|
+
jwks: "JWKS",
|
|
142
|
+
jwt: "JWT",
|
|
143
|
+
lfc: "LFC",
|
|
144
|
+
lsn: "LSN",
|
|
145
|
+
mib: "MiB",
|
|
146
|
+
openapi: "OpenAPI",
|
|
147
|
+
pid: "PID",
|
|
148
|
+
pids: "PIDs",
|
|
149
|
+
s3: "S3",
|
|
150
|
+
ttl: "TTL",
|
|
151
|
+
uri: "URI",
|
|
152
|
+
url: "URL",
|
|
153
|
+
vpc: "VPC"
|
|
154
|
+
};
|
|
135
155
|
function titleCaseField(field) {
|
|
136
|
-
return field.split("_").map((word) => word ? word[0]?.toUpperCase() + word.slice(1) : word).join(" ");
|
|
156
|
+
return field.split("_").map((word) => LABEL_WORDS[word] ?? (word ? word[0]?.toUpperCase() + word.slice(1) : word)).join(" ");
|
|
137
157
|
}
|
|
138
158
|
const WIDE_RANGES = [
|
|
139
159
|
[4352, 4447],
|
|
@@ -206,4 +226,4 @@ function charWidth(code) {
|
|
|
206
226
|
return 1;
|
|
207
227
|
}
|
|
208
228
|
//#endregion
|
|
209
|
-
export { displayWidth, formatHumanChunk, parseColumns, resolveOutputWidth, stripAnsi };
|
|
229
|
+
export { displayWidth, formatHumanChunk, parseColumns, resolveOutputWidth, stripAnsi, titleCaseField };
|
package/dist/utils/inspect_db.js
CHANGED
|
@@ -48,20 +48,36 @@ const connectionUriForDatabase = (connectionUri, database) => {
|
|
|
48
48
|
url.pathname = `/${encodeURIComponent(database)}`;
|
|
49
49
|
return url.toString();
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Resolves the branch once and starts its endpoint, role, and database reads together.
|
|
53
|
+
* Callers read them in the order a sequential run would, so the first error is the same.
|
|
54
|
+
*/
|
|
55
|
+
const startBranchConnectionReads = async (props) => {
|
|
52
56
|
const projectId = props.projectId;
|
|
53
57
|
const parsedPIT = props.branch ? parsePITBranch(props.branch) : {
|
|
54
58
|
tag: "head",
|
|
55
59
|
branch: ""
|
|
56
60
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
if (props.branch) props.branch = parsedPIT.branch;
|
|
62
|
+
const branchId = await branchIdFromProps(props);
|
|
63
|
+
const endpoints = props.apiClient.listProjectBranchEndpoints(projectId, branchId).then(({ data }) => data.endpoints);
|
|
64
|
+
const role = props.roleName ? Promise.resolve(props.roleName) : props.apiClient.listProjectBranchRoles(projectId, branchId).then(({ data }) => {
|
|
65
|
+
if (data.roles.length === 0) throw new Error(`No roles found for the branch: ${branchId}`);
|
|
66
|
+
if (data.roles.length === 1) return data.roles[0].name;
|
|
67
|
+
throw new Error(`Multiple roles found for the branch, please provide one with the --role-name option: ${data.roles.map((r) => r.name).join(", ")}`);
|
|
60
68
|
});
|
|
61
|
-
const
|
|
69
|
+
const databases = props.apiClient.listProjectBranchDatabases(projectId, branchId).then(({ data }) => data.databases);
|
|
70
|
+
for (const read of [
|
|
71
|
+
endpoints,
|
|
72
|
+
role,
|
|
73
|
+
databases
|
|
74
|
+
]) read.catch(() => void 0);
|
|
62
75
|
return {
|
|
63
76
|
branchId,
|
|
64
|
-
|
|
77
|
+
parsedPIT,
|
|
78
|
+
endpoints,
|
|
79
|
+
role,
|
|
80
|
+
databases
|
|
65
81
|
};
|
|
66
82
|
};
|
|
67
83
|
/**
|
|
@@ -70,25 +86,16 @@ const listBranchDatabases = async (props) => {
|
|
|
70
86
|
* pooling, prisma tuning, and SSL mode). Mirrors how `connection-string`
|
|
71
87
|
* resolves a branch so `inspect db` connects the same way.
|
|
72
88
|
*/
|
|
73
|
-
const resolveConnectionUri = async (props) => {
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
branch: ""
|
|
78
|
-
};
|
|
79
|
-
if (props.branch) props.branch = parsedPIT.branch;
|
|
80
|
-
const branchId = await branchIdFromProps(props);
|
|
81
|
-
const { data: { endpoints } } = await props.apiClient.listProjectBranchEndpoints(projectId, branchId);
|
|
89
|
+
const resolveConnectionUri = async (props, started) => {
|
|
90
|
+
const reads = started ?? await startBranchConnectionReads(props);
|
|
91
|
+
const { branchId, parsedPIT } = reads;
|
|
92
|
+
const endpoints = await reads.endpoints;
|
|
82
93
|
const matchEndpointType = props.endpointType ?? EndpointType.ReadWrite;
|
|
83
94
|
let endpoint = endpoints.find((e) => e.type === matchEndpointType);
|
|
84
95
|
if (!endpoint && props.endpointType == null) endpoint = endpoints[0];
|
|
85
96
|
if (!endpoint) throw new Error(`No ${props.endpointType ?? ""} endpoint found for the branch: ${branchId}`);
|
|
86
|
-
const role =
|
|
87
|
-
|
|
88
|
-
if (data.roles.length === 1) return data.roles[0].name;
|
|
89
|
-
throw new Error(`Multiple roles found for the branch, please provide one with the --role-name option: ${data.roles.map((r) => r.name).join(", ")}`);
|
|
90
|
-
});
|
|
91
|
-
const { data: { databases: branchDatabases } } = await props.apiClient.listProjectBranchDatabases(projectId, branchId);
|
|
97
|
+
const role = await reads.role;
|
|
98
|
+
const branchDatabases = await reads.databases;
|
|
92
99
|
const database = props.databaseName || (() => {
|
|
93
100
|
if (branchDatabases.length === 0) throw new Error(`No databases found for the branch: ${branchId}`);
|
|
94
101
|
if (branchDatabases.length === 1) return branchDatabases[0].name;
|
|
@@ -158,8 +165,9 @@ const resolveInspectTargets = async (props, scope) => {
|
|
|
158
165
|
branchDatabaseCount: 1
|
|
159
166
|
};
|
|
160
167
|
}
|
|
161
|
-
const
|
|
162
|
-
|
|
168
|
+
const reads = await startBranchConnectionReads(props);
|
|
169
|
+
const names = (await reads.databases).map((d) => d.name);
|
|
170
|
+
if (names.length === 0) throw new Error(`No databases found for the branch: ${reads.branchId}`);
|
|
163
171
|
const selection = selectInspectTargets({
|
|
164
172
|
branchDatabases: names,
|
|
165
173
|
scope
|
|
@@ -167,7 +175,7 @@ const resolveInspectTargets = async (props, scope) => {
|
|
|
167
175
|
const first = await resolveConnectionUri({
|
|
168
176
|
...props,
|
|
169
177
|
databaseName: selection.databases[0]
|
|
170
|
-
});
|
|
178
|
+
}, reads);
|
|
171
179
|
return {
|
|
172
180
|
targets: selection.databases.map((database) => ({
|
|
173
181
|
database,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.4",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"yaml": "^2.9.0",
|
|
65
65
|
"yargs": "17.7.2",
|
|
66
66
|
"yoctocolors": "^2.1.2",
|
|
67
|
-
"@neon/config-runtime": "1.8.0",
|
|
68
67
|
"@neon/config": "1.8.6",
|
|
68
|
+
"@neon/config-runtime": "1.8.0",
|
|
69
69
|
"@neon/sdk": "7.0.1"
|
|
70
70
|
},
|
|
71
71
|
"optionalDependencies": {
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"typescript": "^5.9.0",
|
|
102
102
|
"vitest": "^3.0.9",
|
|
103
103
|
"@neon-internals/cli-core": "0.0.0",
|
|
104
|
-
"@neon/e2e-harness": "0.0.0",
|
|
105
104
|
"@neon-internals/env-core": "0.0.29",
|
|
105
|
+
"@neon/e2e-harness": "0.0.0",
|
|
106
106
|
"@neon/functions": "0.11.0"
|
|
107
107
|
},
|
|
108
108
|
"publishConfig": {
|