neon 3.1.0 → 3.1.1
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 +16 -5
- package/dist/{_shared/auth_selection.js → _chunks/auth_selection-DGgq6ifc.js} +3 -3
- package/dist/_chunks/cmd_pipeline-CUbBO9U_.js +2818 -0
- package/dist/{_shared/credentials.js → _chunks/credentials-MYdHdKah.js} +3 -3
- package/dist/_chunks/env-NbA61JR3.js +585 -0
- package/dist/{_shared/env-core/env.js → _chunks/env_services-Tz9G4JeT.js} +179 -43
- package/dist/{_shared/paths.js → _chunks/paths-DMq0Lt7a.js} +2 -2
- package/dist/{_shared/profiles.js → _chunks/profiles-Ir29rqns.js} +4 -13
- package/dist/_chunks/psql-DWH-kc69.js +2169 -0
- package/dist/{_virtual/_rolldown/runtime.js → _chunks/rolldown-runtime-D7D4PA-g.js} +1 -1
- package/dist/{_shared/secure_file.js → _chunks/secure_file-BucZj4yQ.js} +2 -4
- package/dist/analytics.js +2 -2
- package/dist/auth_context.js +1 -1
- package/dist/commands/api.js +2 -2
- package/dist/commands/api_keys.js +2 -2
- package/dist/commands/auth.js +6 -6
- package/dist/commands/bootstrap.js +3 -3
- package/dist/commands/branches.js +2 -2
- package/dist/commands/bucket.js +2 -2
- package/dist/commands/checkout.js +2 -2
- package/dist/commands/config.js +2 -2
- package/dist/commands/connection_string.js +2 -2
- package/dist/commands/data_api.js +2 -2
- package/dist/commands/databases.js +2 -2
- package/dist/commands/deploy.js +2 -2
- package/dist/commands/dev.js +3 -3
- package/dist/commands/diff.js +2 -2
- package/dist/commands/env.js +42 -32
- package/dist/commands/functions.js +2 -2
- package/dist/commands/index.js +33 -33
- package/dist/commands/init.js +3 -3
- package/dist/commands/inspect.js +2 -2
- package/dist/commands/ip_allow.js +2 -2
- package/dist/commands/link.js +2 -2
- package/dist/commands/logs.js +2 -2
- package/dist/commands/neon_auth.js +2 -2
- package/dist/commands/operations.js +2 -2
- package/dist/commands/orgs.js +2 -2
- package/dist/commands/profile.js +7 -7
- package/dist/commands/projects.js +2 -2
- package/dist/commands/psql.js +2 -2
- package/dist/commands/roles.js +2 -2
- package/dist/commands/set_context.js +2 -2
- package/dist/commands/snapshots.js +2 -2
- package/dist/commands/status.js +2 -2
- package/dist/commands/user.js +2 -2
- package/dist/commands/vpc_endpoints.js +2 -2
- package/dist/config.js +1 -1
- package/dist/dev/env.js +1 -364
- package/dist/env_services.js +2 -49
- package/dist/index.js +1 -1
- package/dist/init/auth.js +4 -4
- package/dist/psql/cli.js +1 -1
- package/dist/psql/command/cmd_copy.js +1 -1
- package/dist/psql/command/cmd_io.js +1 -1403
- package/dist/psql/command/cmd_pipeline.js +1 -595
- package/dist/psql/command/dispatch.js +1 -2
- package/dist/psql/core/common.js +1 -834
- package/dist/psql/core/mainloop.js +1 -2
- package/dist/psql/core/startup.js +1 -656
- package/dist/psql/index.js +1 -1516
- package/dist/psql/io/psqlrc.js +1 -1
- package/dist/psql/types/index.js +6 -0
- package/dist/utils/inspect_db.js +1 -1
- package/dist/utils/middlewares.js +2 -1
- package/package.json +6 -3
- package/dist/_shared/env-core/reuse-secrets.js +0 -179
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, join } from "node:path";
|
|
3
|
-
//#region
|
|
4
|
-
/** Owner read/write. A credential needs those two and nothing else. */
|
|
5
|
-
const SECRET_FILE_MODE = 384;
|
|
3
|
+
//#region ../../internals/cli-core/dist/secure_file.js
|
|
6
4
|
/**
|
|
7
5
|
* Write a secret to disk owner-only, by creating a temporary file in the same directory and
|
|
8
6
|
* renaming it over the target.
|
|
@@ -38,4 +36,4 @@ const writeSecretFile = (path, contents) => {
|
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
//#endregion
|
|
41
|
-
export {
|
|
39
|
+
export { writeSecretFile as t };
|
package/dist/analytics.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OAUTH, inspectCredentials } from "./
|
|
1
|
+
import { n as OAUTH, o as inspectCredentials } from "./_chunks/credentials-MYdHdKah.js";
|
|
2
2
|
import { getGithubEnvVars, isCi } from "./env.js";
|
|
3
3
|
import { log } from "./log.js";
|
|
4
4
|
import pkg_default from "./pkg.js";
|
|
5
5
|
import { getApiClient, isNeonApiError } from "./api.js";
|
|
6
|
-
import { credentialsPath } from "./
|
|
6
|
+
import { n as credentialsPath } from "./_chunks/paths-DMq0Lt7a.js";
|
|
7
7
|
import "./config.js";
|
|
8
8
|
import { getAuthContext } from "./auth_context.js";
|
|
9
9
|
import { isCurrentBranchProbe } from "./context.js";
|
package/dist/auth_context.js
CHANGED
package/dist/commands/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { getEndpoints, loadSpec } from "../utils/openapi.js";
|
|
3
3
|
import { writer } from "../writer.js";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
@@ -245,4 +245,4 @@ const handler = async (args) => {
|
|
|
245
245
|
await runRequest(apiArgs);
|
|
246
246
|
};
|
|
247
247
|
//#endregion
|
|
248
|
-
export {
|
|
248
|
+
export { buildBody, buildQuery, builder, command, describe, handler, parseHeaders, parseKeyValue, parseTypedValue, setDeep, api_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { isNeonApiError } from "../api.js";
|
|
4
4
|
import { writer } from "../writer.js";
|
|
@@ -283,4 +283,4 @@ const orgIdForProject = async (client, projectId) => {
|
|
|
283
283
|
return orgId;
|
|
284
284
|
};
|
|
285
285
|
//#endregion
|
|
286
|
-
export { aliases,
|
|
286
|
+
export { aliases, builder, command, describe, handler, orgIdForProject, api_keys_exports as t };
|
package/dist/commands/auth.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
2
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { d as writeCredentials, l as readCredentials, n as OAUTH, s as interpretCredentials, t as API_KEY } from "../_chunks/credentials-MYdHdKah.js";
|
|
3
3
|
import { isCi } from "../env.js";
|
|
4
4
|
import { log } from "../log.js";
|
|
5
5
|
import { getApiClient } from "../api.js";
|
|
6
|
-
import { credentialsPath } from "../
|
|
6
|
+
import { n as credentialsPath } from "../_chunks/paths-DMq0Lt7a.js";
|
|
7
7
|
import "../config.js";
|
|
8
8
|
import { setAuthContext } from "../auth_context.js";
|
|
9
9
|
import { isConfigInit, isCurrentBranchProbe, isProfileCommand } from "../context.js";
|
|
10
10
|
import { extendTokenSet } from "../utils/auth.js";
|
|
11
11
|
import { auth, refreshToken } from "../auth.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { a as newProfileCredentialsPath, c as readProfiles, d as upsertProfile, l as resolveProfile, n as assertProfilesUsable, r as assertValidProfileName, t as DEFAULT_PROFILE, u as selectProfileName } from "../_chunks/profiles-Ir29rqns.js";
|
|
13
|
+
import { i as selectCredential, n as displacedProfileWarning, t as credentialInputs } from "../_chunks/auth_selection-DGgq6ifc.js";
|
|
14
14
|
import { existsSync, rmSync } from "node:fs";
|
|
15
15
|
import { createHash } from "node:crypto";
|
|
16
16
|
//#region src/commands/auth.ts
|
|
@@ -298,4 +298,4 @@ const deleteCredentialsAt = (credentialsPath) => {
|
|
|
298
298
|
};
|
|
299
299
|
const md5hash = (s) => createHash("md5").update(s).digest("hex");
|
|
300
300
|
//#endregion
|
|
301
|
-
export { aliases, authFlow,
|
|
301
|
+
export { aliases, authFlow, builder, command, credentialsPathForName, deleteCredentialsAt, describe, ensureAuth, handler, auth_exports as t, usableCredential };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { isCi } from "../env.js";
|
|
3
3
|
import { log } from "../log.js";
|
|
4
4
|
import { getCliName } from "../utils/cli_name.js";
|
|
5
|
-
import { credentialInputs } from "../
|
|
5
|
+
import { t as credentialInputs } from "../_chunks/auth_selection-DGgq6ifc.js";
|
|
6
6
|
import { BootstrapInputError, FALLBACK_TEMPLATES, ensureTargetUsable, fetchTemplates, findTemplate, scaffoldTemplate, templateIds } from "../init/bootstrap.js";
|
|
7
7
|
import { DO_NOT_SUBSTITUTE_HINT, formatInstallCommand, inferPackageManager, installArgs, installedPackageManagers, resolvePackageManager, runCommand } from "../utils/package_manager.js";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
@@ -427,4 +427,4 @@ const onPromptState = (state) => {
|
|
|
427
427
|
}
|
|
428
428
|
};
|
|
429
429
|
//#endregion
|
|
430
|
-
export {
|
|
430
|
+
export { builder, command, describe, handler, bootstrap_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { retryOnLock } from "../api.js";
|
|
4
4
|
import { contextBranch, readContextFile } from "../context.js";
|
|
@@ -334,4 +334,4 @@ const setExpiration = async (props) => {
|
|
|
334
334
|
writer(props).end(data.branch, { fields: BRANCH_FIELDS });
|
|
335
335
|
};
|
|
336
336
|
//#endregion
|
|
337
|
-
export { BRANCH_FIELDS, aliases,
|
|
337
|
+
export { BRANCH_FIELDS, aliases, builder, command, describe, handler, branches_exports as t };
|
package/dist/commands/bucket.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { isNeonApiError, retryOnLock } from "../api.js";
|
|
4
4
|
import { writer } from "../writer.js";
|
|
@@ -406,4 +406,4 @@ const deleteObject = async (props) => {
|
|
|
406
406
|
log.info(`Object "${rest}" deleted from bucket "${bucket}" on branch ${branchId}`);
|
|
407
407
|
};
|
|
408
408
|
//#endregion
|
|
409
|
-
export { aliases,
|
|
409
|
+
export { aliases, builder, command, describe, handler, resolveListDelimiter, splitBucketTarget, bucket_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { isCi } from "../env.js";
|
|
3
3
|
import { log } from "../log.js";
|
|
4
4
|
import { isNeonApiError } from "../api.js";
|
|
@@ -234,4 +234,4 @@ const tryAutoDetectProject = async (props) => {
|
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
//#endregion
|
|
237
|
-
export { builder,
|
|
237
|
+
export { builder, command, describe, handler, checkout_exports as t };
|
package/dist/commands/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { isCi } from "../env.js";
|
|
3
3
|
import { log } from "../log.js";
|
|
4
4
|
import { getApiClient } from "../api.js";
|
|
@@ -638,4 +638,4 @@ const createBranchFromPolicyOnCheckout = async (props) => {
|
|
|
638
638
|
}
|
|
639
639
|
};
|
|
640
640
|
//#endregion
|
|
641
|
-
export { applyCmd, applyFlags, applyPolicyOnCreate, builder, command,
|
|
641
|
+
export { applyCmd, applyFlags, applyPolicyOnCreate, builder, command, createBranchFromPolicyOnCheckout, describe, envFlag, envPullFlag, handler, hasNeonConfigFile, initCmd, planCmd, status, config_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { writer } from "../writer.js";
|
|
3
3
|
import { EndpointType } from "../utils/api_enums.js";
|
|
4
4
|
import { branchIdFromProps, fillSingleProject } from "../utils/enrichers.js";
|
|
@@ -141,4 +141,4 @@ const handler = async (props) => {
|
|
|
141
141
|
else process.stdout.write(connectionString.toString() + "\n");
|
|
142
142
|
};
|
|
143
143
|
//#endregion
|
|
144
|
-
export { SSL_MODES, aliases, builder, command,
|
|
144
|
+
export { SSL_MODES, aliases, builder, command, describe, handler, connection_string_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { isNeonApiError, retryOnLock } from "../api.js";
|
|
4
4
|
import { getCliName } from "../utils/cli_name.js";
|
|
@@ -260,4 +260,4 @@ const deleteDataApi = async (props) => {
|
|
|
260
260
|
log.info(`Data API deleted for ${database} on branch ${branchId}`);
|
|
261
261
|
};
|
|
262
262
|
//#endregion
|
|
263
|
-
export { builder, command,
|
|
263
|
+
export { builder, command, describe, handler, data_api_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { retryOnLock } from "../api.js";
|
|
3
3
|
import { writer } from "../writer.js";
|
|
4
4
|
import { branchIdFromProps, fillSingleProject } from "../utils/enrichers.js";
|
|
@@ -70,4 +70,4 @@ const deleteDb = async (props) => {
|
|
|
70
70
|
if (data) writer(props).end(data.database, { fields: DATABASE_FIELDS });
|
|
71
71
|
};
|
|
72
72
|
//#endregion
|
|
73
|
-
export { DATABASE_FIELDS, aliases, builder, command, create,
|
|
73
|
+
export { DATABASE_FIELDS, aliases, builder, command, create, deleteDb, describe, handler, list, databases_exports as t };
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
3
3
|
import { applyCmd, applyFlags, envFlag, envPullFlag } from "./config.js";
|
|
4
4
|
//#region src/commands/deploy.ts
|
|
@@ -29,4 +29,4 @@ const builder = (argv) => argv.usage("$0 deploy [options]").options({
|
|
|
29
29
|
}).middleware(fillSingleProject).strict();
|
|
30
30
|
const handler = (props) => applyCmd(props);
|
|
31
31
|
//#endregion
|
|
32
|
-
export { builder, command,
|
|
32
|
+
export { builder, command, describe, handler, deploy_exports as t };
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { getCliName } from "../utils/cli_name.js";
|
|
4
4
|
import { readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
5
5
|
import { branchIdResolve } from "../utils/enrichers.js";
|
|
6
6
|
import { bundleEntry } from "../utils/esbuild.js";
|
|
7
|
-
import { resolveDevEnv } from "../
|
|
7
|
+
import { i as resolveDevEnv } from "../_chunks/env-NbA61JR3.js";
|
|
8
8
|
import { resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
9
9
|
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
10
10
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -715,4 +715,4 @@ const resolveRuntimePath = () => {
|
|
|
715
715
|
return candidate;
|
|
716
716
|
};
|
|
717
717
|
//#endregion
|
|
718
|
-
export { builder, command, describe, devBundleDir, devEnvContext,
|
|
718
|
+
export { builder, command, describe, devBundleDir, devEnvContext, diffUnits, formatEnvSummary, handler, reportDevCredential, dev_exports as t };
|
package/dist/commands/diff.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { isNeonApiError } from "../api.js";
|
|
4
4
|
import { writer } from "../writer.js";
|
|
@@ -175,4 +175,4 @@ const writeStructured = (props, diffs) => {
|
|
|
175
175
|
] });
|
|
176
176
|
};
|
|
177
177
|
//#endregion
|
|
178
|
-
export { builder, command, describe,
|
|
178
|
+
export { builder, command, describe, handler, diff_exports as t };
|
package/dist/commands/env.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { ensureGitignored } from "../context.js";
|
|
4
4
|
import { getCliName } from "../utils/cli_name.js";
|
|
5
5
|
import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOption } from "../neon_services.js";
|
|
6
6
|
import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
7
|
-
import { NEON_ENV_VAR_KEYS } from "../
|
|
8
|
-
import { ENV_PULL_SERVICES, ENV_PULL_UNAVAILABLE, envServiceKeys, ownedEnvServiceKeys } from "../env_services.js";
|
|
7
|
+
import { a as envKeysForSelection, c as ownedEnvServiceKeys, f as NEON_ENV_VAR_KEYS, i as ENV_PULL_UNAVAILABLE, l as parseEnvPullKeys, n as ENV_PULL_KEYS, o as envPullFlagValue, r as ENV_PULL_SERVICES } from "../_chunks/env_services-Tz9G4JeT.js";
|
|
9
8
|
import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
|
|
10
9
|
import { warnAiGateway } from "../utils/ai_gateway_notice.js";
|
|
11
10
|
import { announceTargetBranch } from "../utils/branch_notice.js";
|
|
12
|
-
import { resolveNeonEnvVars } from "../
|
|
11
|
+
import { a as resolveNeonEnvVars } from "../_chunks/env-NbA61JR3.js";
|
|
13
12
|
import { existsSync } from "node:fs";
|
|
14
13
|
import chalk from "chalk";
|
|
15
14
|
//#region src/commands/env.ts
|
|
@@ -49,12 +48,18 @@ const builder = (argv) => argv.usage("$0 env <sub-command> [options]").options({
|
|
|
49
48
|
key: "service",
|
|
50
49
|
allowed: ENV_PULL_SERVICES,
|
|
51
50
|
describe: "Pull only these services' variables",
|
|
52
|
-
also: "Overrides neon.ts, and prunes only within the services you name."
|
|
53
|
-
})
|
|
51
|
+
also: "Overrides neon.ts, and prunes only within the services you name. Combines with --env as a union."
|
|
52
|
+
}),
|
|
53
|
+
env: {
|
|
54
|
+
alias: "e",
|
|
55
|
+
describe: `Pull only these individual variables: ${ENV_PULL_KEYS.join(", ")}. Repeat the flag or comma-separate. Overrides neon.ts. Combines with --service as a union; it never narrows a service bundle.`,
|
|
56
|
+
type: "array",
|
|
57
|
+
string: true
|
|
58
|
+
}
|
|
54
59
|
}).epilogue([
|
|
55
60
|
"",
|
|
56
61
|
"What gets pulled, in precedence order:",
|
|
57
|
-
" 1. --service, when given —
|
|
62
|
+
" 1. --service / --env, when given — their union, ignoring neon.ts.",
|
|
58
63
|
" 2. neon.ts, when this directory has one.",
|
|
59
64
|
" 3. Otherwise everything the branch has, plus the AI Gateway —",
|
|
60
65
|
" which mints a branch credential for it.",
|
|
@@ -62,19 +67,23 @@ const builder = (argv) => argv.usage("$0 env <sub-command> [options]").options({
|
|
|
62
67
|
"The pull bundled into link / checkout / config apply follows 2 and 3",
|
|
63
68
|
"without the AI Gateway, so it never mints a credential you did not ask",
|
|
64
69
|
"for. Run `env pull` to add it."
|
|
65
|
-
].join("\n")).example("$0 env pull", "Write the linked branch's Neon vars into .env.local (or .env if present)").example("$0 env pull --branch preview --file .env.preview", "Pull a specific branch into a specific file").example("$0 env pull -s ai-gateway -s postgres", "Pull only the AI Gateway and Postgres variables"), async (args) => {
|
|
66
|
-
const
|
|
70
|
+
].join("\n")).example("$0 env pull", "Write the linked branch's Neon vars into .env.local (or .env if present)").example("$0 env pull --branch preview --file .env.preview", "Pull a specific branch into a specific file").example("$0 env pull -s ai-gateway -s postgres", "Pull only the AI Gateway and Postgres variables").example("$0 env pull -e DATABASE_URL", "Pull only the pooled Postgres connection string").example("$0 env pull -s auth -e DATABASE_URL", "Pull all Auth variables plus DATABASE_URL").strict(), async (args) => {
|
|
71
|
+
const rawServices = servicesFlagValue(args.service);
|
|
72
|
+
const rawEnvKeys = envPullFlagValue(args.env);
|
|
73
|
+
const services = rawServices ? parseServices(rawServices, {
|
|
74
|
+
allowed: ENV_PULL_SERVICES,
|
|
75
|
+
whyUnavailable: ENV_PULL_UNAVAILABLE,
|
|
76
|
+
flag: "--service",
|
|
77
|
+
onDeprecated: (used, canonical) => log.warning(deprecatedServiceMessage(used, canonical))
|
|
78
|
+
}) : void 0;
|
|
79
|
+
const envKeys = rawEnvKeys ? parseEnvPullKeys(rawEnvKeys, "--env") : void 0;
|
|
67
80
|
await pull({
|
|
68
81
|
...args,
|
|
69
|
-
...
|
|
70
|
-
|
|
71
|
-
whyUnavailable: ENV_PULL_UNAVAILABLE,
|
|
72
|
-
flag: "--service",
|
|
73
|
-
onDeprecated: (used, canonical) => log.warning(deprecatedServiceMessage(used, canonical))
|
|
74
|
-
}) } : {}
|
|
82
|
+
...services ? { services } : {},
|
|
83
|
+
...envKeys ? { envKeys } : {}
|
|
75
84
|
}, {
|
|
76
85
|
announce: true,
|
|
77
|
-
implyAiGateway:
|
|
86
|
+
implyAiGateway: rawServices === void 0 && rawEnvKeys === void 0
|
|
78
87
|
});
|
|
79
88
|
}).demandCommand(1);
|
|
80
89
|
const handler = (args) => args;
|
|
@@ -101,6 +110,7 @@ const NEON_OWNED_ENV_KEYS = [
|
|
|
101
110
|
];
|
|
102
111
|
const pull = async (props, opts = {}) => {
|
|
103
112
|
const cwd = props.cwd ?? process.cwd();
|
|
113
|
+
const selectedKeys = props.services !== void 0 || props.envKeys !== void 0 ? envKeysForSelection(props.services ?? [], props.envKeys ?? []) : void 0;
|
|
104
114
|
const branch = await resolveBranchRef(props);
|
|
105
115
|
if (opts.announce) announceTargetBranch(props, branch, "Pulling env from branch");
|
|
106
116
|
const branchId = branch.branchId;
|
|
@@ -116,23 +126,24 @@ const pull = async (props, opts = {}) => {
|
|
|
116
126
|
...existingEnv
|
|
117
127
|
},
|
|
118
128
|
...props.services ? { services: props.services } : {},
|
|
129
|
+
...props.envKeys ? { envKeys: props.envKeys } : {},
|
|
119
130
|
...opts.implyAiGateway ? { implyAiGateway: true } : {},
|
|
120
131
|
...props.apiKey ? { apiKey: props.apiKey } : {},
|
|
121
132
|
...props.apiHost ? { apiHost: props.apiHost } : {},
|
|
122
133
|
...props.runtimeApi ? { api: props.runtimeApi } : {}
|
|
123
134
|
});
|
|
124
|
-
const neonVars =
|
|
135
|
+
const neonVars = pickSelectedVars(pickNeonVars(vars), selectedKeys);
|
|
125
136
|
if (Object.keys(neonVars).length === 0) {
|
|
126
137
|
log.info("No Neon env variables to pull for this branch (no DATABASE_URL or enabled Auth / Data API).");
|
|
127
138
|
return { status: "empty" };
|
|
128
139
|
}
|
|
129
|
-
const { written, removed } = mergeEnvFile(targetPath, neonVars, { managedKeys: managedKeysFor(
|
|
140
|
+
const { written, removed } = mergeEnvFile(targetPath, neonVars, { managedKeys: managedKeysFor(selectedKeys, unreachedButCurrent(skipped, existingEnv, branchId)) });
|
|
130
141
|
log.info("Pulled %d Neon variable%s into %s: %s", written.length, written.length === 1 ? "" : "s", targetPath, written.join(", "));
|
|
131
142
|
if (removed.length > 0) log.info("Removed %d stale Neon variable%s not enabled on this branch: %s", removed.length, removed.length === 1 ? "" : "s", removed.join(", "));
|
|
132
143
|
if (credential?.issued) {
|
|
133
144
|
log.info("Issued a new branch credential — these now hold fresh values: %s", credential.keys.join(", "));
|
|
134
145
|
if (credential.revoked.length > 0) log.info("Revoked the credential it replaced (%s).", credential.revoked.join(", "));
|
|
135
|
-
else if (credential.superseded.length > 0) log.info("Left the credential it replaced live (%s):
|
|
146
|
+
else if (credential.superseded.length > 0) log.info("Left the credential it replaced live (%s): an explicitly scoped pull can't tell which other variables still use it. Revoke it in the Neon Console if nothing does.", credential.superseded.join(", "));
|
|
136
147
|
}
|
|
137
148
|
if (!fileExisted) ensureGitignored(targetPath);
|
|
138
149
|
const gatewayBaseUrl = neonVars.NEON_AI_GATEWAY_BASE_URL;
|
|
@@ -157,13 +168,13 @@ const pull = async (props, opts = {}) => {
|
|
|
157
168
|
/**
|
|
158
169
|
* The keys this pull is allowed to prune, i.e. the ones it is authoritative for.
|
|
159
170
|
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
171
|
+
* An explicit selection narrows that to the service bundles and individual keys it named:
|
|
172
|
+
* `env pull -s ai-gateway` and `env pull -e NEON_AI_GATEWAY_TOKEN` both say nothing about
|
|
173
|
+
* `DATABASE_URL`. `unreached` is subtracted for the same reason — see
|
|
163
174
|
* {@link unreachedButCurrent}.
|
|
164
175
|
*/
|
|
165
|
-
const managedKeysFor = (
|
|
166
|
-
const owned =
|
|
176
|
+
const managedKeysFor = (selectedKeys, unreached) => {
|
|
177
|
+
const owned = selectedKeys ? NEON_OWNED_ENV_KEYS.filter((key) => selectedKeys.includes(key)) : [...NEON_OWNED_ENV_KEYS];
|
|
167
178
|
if (unreached.length === 0) return owned;
|
|
168
179
|
const keep = new Set(ownedEnvServiceKeys(unreached));
|
|
169
180
|
return owned.filter((key) => !keep.has(key));
|
|
@@ -202,14 +213,13 @@ const unreachedButCurrent = (skipped, existingEnv, branchId) => {
|
|
|
202
213
|
*/
|
|
203
214
|
const isBranchGatewayUrl = (baseUrl, branchId) => URL.canParse(baseUrl) && new URL(baseUrl).hostname.startsWith(`${branchId}-api.ai.`);
|
|
204
215
|
/**
|
|
205
|
-
* Narrow the resolved vars to the
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* one — so `--service ai-gateway` has to drop them here rather than avoid fetching them.
|
|
216
|
+
* Narrow the resolved vars to the explicit service/key union. `fetchEnv` may resolve
|
|
217
|
+
* supporting values that were not selected (the direct connection URI derives the AI Gateway
|
|
218
|
+
* host, for example); those must not land in the target file.
|
|
209
219
|
*/
|
|
210
|
-
const
|
|
211
|
-
if (!
|
|
212
|
-
const wanted =
|
|
220
|
+
const pickSelectedVars = (vars, selectedKeys) => {
|
|
221
|
+
if (!selectedKeys) return vars;
|
|
222
|
+
const wanted = new Set(selectedKeys);
|
|
213
223
|
return Object.fromEntries(Object.entries(vars).filter(([key]) => wanted.has(key)));
|
|
214
224
|
};
|
|
215
225
|
/**
|
|
@@ -268,4 +278,4 @@ const pickNeonVars = (vars) => {
|
|
|
268
278
|
return out;
|
|
269
279
|
};
|
|
270
280
|
//#endregion
|
|
271
|
-
export { ENV_PULL_SKIPPED_HINT, autoPullEnvAfterPin, builder, command, describe,
|
|
281
|
+
export { ENV_PULL_SKIPPED_HINT, autoPullEnvAfterPin, builder, command, describe, handler, pull, renderAgentPullNote, env_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { isNeonApiError, retryOnLock } from "../api.js";
|
|
4
4
|
import { getCliName } from "../utils/cli_name.js";
|
|
@@ -305,4 +305,4 @@ const list = async (props) => {
|
|
|
305
305
|
});
|
|
306
306
|
};
|
|
307
307
|
//#endregion
|
|
308
|
-
export { aliases, builder, command, describe,
|
|
308
|
+
export { aliases, builder, command, describe, handler, functions_exports as t };
|
package/dist/commands/index.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { auth_exports } from "./auth.js";
|
|
2
|
-
import { api_exports } from "./api.js";
|
|
3
|
-
import { api_keys_exports } from "./api_keys.js";
|
|
4
|
-
import { bootstrap_exports } from "./bootstrap.js";
|
|
5
|
-
import { branches_exports } from "./branches.js";
|
|
6
|
-
import { bucket_exports } from "./bucket.js";
|
|
7
|
-
import { env_exports } from "./env.js";
|
|
8
|
-
import { config_exports } from "./config.js";
|
|
9
|
-
import { projects_exports } from "./projects.js";
|
|
10
|
-
import { link_exports } from "./link.js";
|
|
11
|
-
import { checkout_exports } from "./checkout.js";
|
|
12
|
-
import { connection_string_exports } from "./connection_string.js";
|
|
13
|
-
import { data_api_exports } from "./data_api.js";
|
|
14
|
-
import { databases_exports } from "./databases.js";
|
|
15
|
-
import { deploy_exports } from "./deploy.js";
|
|
16
|
-
import { dev_exports } from "./dev.js";
|
|
17
|
-
import { diff_exports } from "./diff.js";
|
|
18
|
-
import { functions_exports } from "./functions.js";
|
|
19
|
-
import { init_exports } from "./init.js";
|
|
20
|
-
import { inspect_exports } from "./inspect.js";
|
|
21
|
-
import { ip_allow_exports } from "./ip_allow.js";
|
|
22
|
-
import { logs_exports } from "./logs.js";
|
|
23
|
-
import { neon_auth_exports } from "./neon_auth.js";
|
|
24
|
-
import { operations_exports } from "./operations.js";
|
|
25
|
-
import { orgs_exports } from "./orgs.js";
|
|
26
|
-
import { profile_exports } from "./profile.js";
|
|
27
|
-
import { psql_exports } from "./psql.js";
|
|
28
|
-
import { roles_exports } from "./roles.js";
|
|
29
|
-
import { set_context_exports } from "./set_context.js";
|
|
30
|
-
import { snapshots_exports } from "./snapshots.js";
|
|
31
|
-
import { status_exports } from "./status.js";
|
|
32
|
-
import { user_exports } from "./user.js";
|
|
33
|
-
import { vpc_endpoints_exports } from "./vpc_endpoints.js";
|
|
1
|
+
import { t as auth_exports } from "./auth.js";
|
|
2
|
+
import { t as api_exports } from "./api.js";
|
|
3
|
+
import { t as api_keys_exports } from "./api_keys.js";
|
|
4
|
+
import { t as bootstrap_exports } from "./bootstrap.js";
|
|
5
|
+
import { t as branches_exports } from "./branches.js";
|
|
6
|
+
import { t as bucket_exports } from "./bucket.js";
|
|
7
|
+
import { t as env_exports } from "./env.js";
|
|
8
|
+
import { t as config_exports } from "./config.js";
|
|
9
|
+
import { t as projects_exports } from "./projects.js";
|
|
10
|
+
import { t as link_exports } from "./link.js";
|
|
11
|
+
import { t as checkout_exports } from "./checkout.js";
|
|
12
|
+
import { t as connection_string_exports } from "./connection_string.js";
|
|
13
|
+
import { t as data_api_exports } from "./data_api.js";
|
|
14
|
+
import { t as databases_exports } from "./databases.js";
|
|
15
|
+
import { t as deploy_exports } from "./deploy.js";
|
|
16
|
+
import { t as dev_exports } from "./dev.js";
|
|
17
|
+
import { t as diff_exports } from "./diff.js";
|
|
18
|
+
import { t as functions_exports } from "./functions.js";
|
|
19
|
+
import { t as init_exports } from "./init.js";
|
|
20
|
+
import { t as inspect_exports } from "./inspect.js";
|
|
21
|
+
import { t as ip_allow_exports } from "./ip_allow.js";
|
|
22
|
+
import { t as logs_exports } from "./logs.js";
|
|
23
|
+
import { t as neon_auth_exports } from "./neon_auth.js";
|
|
24
|
+
import { t as operations_exports } from "./operations.js";
|
|
25
|
+
import { t as orgs_exports } from "./orgs.js";
|
|
26
|
+
import { t as profile_exports } from "./profile.js";
|
|
27
|
+
import { t as psql_exports } from "./psql.js";
|
|
28
|
+
import { t as roles_exports } from "./roles.js";
|
|
29
|
+
import { t as set_context_exports } from "./set_context.js";
|
|
30
|
+
import { t as snapshots_exports } from "./snapshots.js";
|
|
31
|
+
import { t as status_exports } from "./status.js";
|
|
32
|
+
import { t as user_exports } from "./user.js";
|
|
33
|
+
import { t as vpc_endpoints_exports } from "./vpc_endpoints.js";
|
|
34
34
|
//#region src/commands/index.ts
|
|
35
35
|
var commands_default = [
|
|
36
36
|
auth_exports,
|
package/dist/commands/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { closeAnalytics, sendError } from "../analytics.js";
|
|
3
|
-
import { credentialInputs } from "../
|
|
3
|
+
import { t as credentialInputs } from "../_chunks/auth_selection-DGgq6ifc.js";
|
|
4
4
|
import { detectAgent } from "../init/detect_agent.js";
|
|
5
5
|
import { enrichResponse } from "../init/enrich_output.js";
|
|
6
6
|
import { interactiveInit } from "../init/interactive.js";
|
|
@@ -97,4 +97,4 @@ const handler = async (argv) => {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
//#endregion
|
|
100
|
-
export { builder, command, describe, handler, init_exports };
|
|
100
|
+
export { builder, command, describe, handler, init_exports as t };
|
package/dist/commands/inspect.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { writer } from "../writer.js";
|
|
3
3
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
4
4
|
import { resolveConnectionUri, runInspectQuery } from "../utils/inspect_db.js";
|
|
@@ -62,4 +62,4 @@ const handler = (args) => {
|
|
|
62
62
|
return args;
|
|
63
63
|
};
|
|
64
64
|
//#endregion
|
|
65
|
-
export { aliases, builder, command, describe, handler, inspect_exports };
|
|
65
|
+
export { aliases, builder, command, describe, handler, inspect_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { getCliName } from "../utils/cli_name.js";
|
|
4
4
|
import { writer } from "../writer.js";
|
|
@@ -103,4 +103,4 @@ const parse = (project) => {
|
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
105
|
//#endregion
|
|
106
|
-
export { builder, command, describe, handler, ip_allow_exports };
|
|
106
|
+
export { builder, command, describe, handler, ip_allow_exports as t };
|
package/dist/commands/link.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { isCi } from "../env.js";
|
|
3
3
|
import { log } from "../log.js";
|
|
4
4
|
import { isNeonApiError, messageFromBody } from "../api.js";
|
|
@@ -974,4 +974,4 @@ const mustString = (value, name) => {
|
|
|
974
974
|
return value;
|
|
975
975
|
};
|
|
976
976
|
//#endregion
|
|
977
|
-
export { builder, command, describe, handler, link_exports };
|
|
977
|
+
export { builder, command, describe, handler, link_exports as t };
|
package/dist/commands/logs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { isNeonApiError } from "../api.js";
|
|
4
4
|
import { writer } from "../writer.js";
|
|
@@ -288,4 +288,4 @@ const fieldValues = async (props) => {
|
|
|
288
288
|
if (data.is_truncated) log.info(`More values exist than were returned for "${escapeLogSingleLine(props.field)}". Narrow the window with --since or --start-time, restrict --source, or raise --limit, then run it again.`);
|
|
289
289
|
};
|
|
290
290
|
//#endregion
|
|
291
|
-
export { assertReachableLogsPage, buildLogsQueryBody, builder, command, describe, escapeLogSingleLine, escapeLogTableCell, handler, logs_exports };
|
|
291
|
+
export { assertReachableLogsPage, buildLogsQueryBody, builder, command, describe, escapeLogSingleLine, escapeLogTableCell, handler, logs_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { codeFromBody, isNeonApiError, retryOnLock } from "../api.js";
|
|
3
3
|
import { writer } from "../writer.js";
|
|
4
4
|
import { NeonAuthEmailVerificationMethod, NeonAuthOauthProviderId, NeonAuthOauthProviderType, NeonAuthSupportedAuthProvider } from "../utils/api_enums.js";
|
|
@@ -817,4 +817,4 @@ const userSetRole = async (props) => {
|
|
|
817
817
|
printKvBlock("Roles updated", [["User ID: ", data.id], ["Roles: ", props.roles.join(", ")]]);
|
|
818
818
|
};
|
|
819
819
|
//#endregion
|
|
820
|
-
export { builder, command, describe, handler, neon_auth_exports };
|
|
820
|
+
export { builder, command, describe, handler, neon_auth_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { writer } from "../writer.js";
|
|
3
3
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
4
4
|
//#region src/commands/operations.ts
|
|
@@ -34,4 +34,4 @@ const list = async (props) => {
|
|
|
34
34
|
writer(props).end(data.operations, { fields: OPERATIONS_FIELDS });
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
37
|
-
export { aliases, builder, command, describe, handler, list, operations_exports };
|
|
37
|
+
export { aliases, builder, command, describe, handler, list, operations_exports as t };
|
package/dist/commands/orgs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../
|
|
1
|
+
import { t as __exportAll } from "../_chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { writer } from "../writer.js";
|
|
3
3
|
//#region src/commands/orgs.ts
|
|
4
4
|
var orgs_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -31,4 +31,4 @@ const list = async (props) => {
|
|
|
31
31
|
out.end();
|
|
32
32
|
};
|
|
33
33
|
//#endregion
|
|
34
|
-
export { aliases, builder, command, describe, handler, orgs_exports };
|
|
34
|
+
export { aliases, builder, command, describe, handler, orgs_exports as t };
|