neon 8.23.4 → 9.1.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 +67 -8
- package/dist/_chunks/{checkout-OEE3GTc_.js → checkout-B_gbS0nD.js} +3 -3
- package/dist/_chunks/{claim-C-9or54_.js → claim-BVEwQ65H.js} +1 -1
- package/dist/_chunks/{config-DPuP7ywm.js → config-BClSMzco.js} +1 -1
- package/dist/_chunks/{deploy-CpF33Ij-.js → deploy-CJ22hy3i.js} +1 -1
- package/dist/_chunks/{dev-BE5TL7ZH.js → dev-CSoQfCuS.js} +19 -20
- package/dist/_chunks/{env-CIFMBEon.js → env-CFBmcKyo.js} +18 -45
- package/dist/_chunks/{env-C4-EYFmE.js → env-DxcO3oJk.js} +21 -23
- package/dist/_chunks/{env-JgoSsmyt.js → env-EJU-0InB.js} +49 -110
- package/dist/_chunks/{git-R8RebFpF.js → git-C6XPViK5.js} +2 -2
- package/dist/_chunks/{link-PLk7-vwB.js → link-n40BxbmK.js} +2 -2
- package/dist/_chunks/{logs-BB4uvblR.js → logs-Zf8mcRVE.js} +7 -4
- package/dist/_chunks/{status-BjaHpnTV.js → status-TDYLPWRO.js} +1 -1
- package/dist/api.js +1 -0
- 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/env_output.js +4 -4
- package/dist/commands/functions_new.js +1 -1
- package/dist/commands/git.js +1 -1
- package/dist/commands/index.js +10 -10
- package/dist/commands/link.js +1 -1
- package/dist/commands/logs.js +1 -1
- package/dist/commands/loki.js +125 -0
- package/dist/commands/manifest.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/subscribe.js +1 -1
- package/dist/dev/env.js +1 -1
- package/dist/env_services.js +30 -23
- package/dist/errors.js +2 -1
- package/dist/init/auth.js +1 -1
- package/dist/init/choices.js +8 -6
- package/dist/init/deploy.js +1 -1
- package/dist/init/link.js +1 -1
- package/dist/init/run.js +3 -3
- package/dist/utils/hooks.js +9 -4
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -601,9 +601,8 @@ neon env pull -e DATABASE_URL,NEON_AUTH_BASE_URL
|
|
|
601
601
|
# The selectors compose as a union: all Auth vars plus DATABASE_URL
|
|
602
602
|
neon env pull -s auth -e DATABASE_URL
|
|
603
603
|
|
|
604
|
-
#
|
|
604
|
+
# The variables functionBaseUrl("<slug>") from @neon/env reads
|
|
605
605
|
neon env pull -s functions
|
|
606
|
-
neon env pull -e NEON_FUNCTION_HELLO_BASE_URL
|
|
607
606
|
```
|
|
608
607
|
|
|
609
608
|
Every services flag in the CLI takes those three spellings, the same value syntax, and the same service names — see [`config init --services`](#getting-a-neonts-config-init).
|
|
@@ -613,15 +612,17 @@ Every services flag in the CLI takes those three spellings, the same value synta
|
|
|
613
612
|
| `postgres` | `DATABASE_URL`, `DATABASE_URL_UNPOOLED` |
|
|
614
613
|
| `auth` | `NEON_AUTH_BASE_URL`, `NEON_AUTH_JWKS_URL` |
|
|
615
614
|
| `data-api` | `NEON_DATA_API_URL` |
|
|
616
|
-
| `functions` | `
|
|
615
|
+
| `functions` | `NEON_FUNCTION_HOST_SUFFIX` |
|
|
617
616
|
| `object-storage` | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL_S3`, `AWS_REGION` |
|
|
618
617
|
| `ai-gateway` | `NEON_AI_GATEWAY_TOKEN`, `NEON_AI_GATEWAY_BASE_URL` |
|
|
619
618
|
|
|
620
|
-
`-e, --env` accepts any variable in the table plus `NEON_BRANCH
|
|
619
|
+
`-e, --env` accepts any variable in the table plus `NEON_BRANCH` and `NEON_BRANCH_ID`. It is case-sensitive and rejects unknown names rather than silently widening the pull. `NEON_BRANCH` and `NEON_BRANCH_ID` are written by unscoped and service-scoped pulls because they are branch identity, not a service; an env-only pull writes them only when you select them.
|
|
621
620
|
|
|
622
|
-
|
|
621
|
+
`NEON_BRANCH_ID` and `NEON_FUNCTION_HOST_SUFFIX` are what `functionBaseUrl("<slug>")` from `@neon/env` builds a function's URL from, and what the Functions runtime injects into every deployed function. An unscoped pull writes both whether or not `neon.ts` declares functions. Earlier releases wrote one `NEON_FUNCTION_<SLUG>_BASE_URL` per function instead; an unscoped or `-s functions` pull removes those lines, and `-e NEON_FUNCTION_<SLUG>_BASE_URL` fails with a pointer to `functionBaseUrl`.
|
|
623
622
|
|
|
624
|
-
|
|
623
|
+
`--env` never narrows `--service`: `neon env pull -s postgres -e DATABASE_URL` still pulls the complete Postgres bundle (`DATABASE_URL`, `DATABASE_URL_UNPOOLED`, `NEON_BRANCH`, and `NEON_BRANCH_ID`). The two selectors always form a union.
|
|
624
|
+
|
|
625
|
+
**A scoped pull is scoped in both directions.** An unscoped `env pull` owns the Neon-named variables: pointing a directory at a branch without Neon Auth prunes the stale `NEON_AUTH_*` lines. `--service` narrows that to the services you named, while `--env` narrows it to the exact keys you named, so `env pull -e DATABASE_URL` never touches `DATABASE_URL_UNPOOLED`. (`AWS_*` is never pruned by any pull: those names collide with credentials you may set yourself, so `env pull` only ever writes them.)
|
|
625
626
|
|
|
626
627
|
**A scoped pull also never revokes a credential.** Where an unscoped pull revokes the credential it replaces, a scoped one leaves the old one live — it can't tell which other variables still use it. It says so when it happens; revoke it in the Neon Console if nothing does.
|
|
627
628
|
|
|
@@ -639,7 +640,7 @@ Console), or drop auth from --service.
|
|
|
639
640
|
|
|
640
641
|
If you'd rather not keep env vars on disk, inject them at runtime instead with `neon-env run -- <your dev command>` (from `@neon/env`) or `neon dev`, and pass `--no-env-pull` to `link` / `checkout`.
|
|
641
642
|
|
|
642
|
-
**`neon dev` resolves the same set, by the same rules** — including the AI Gateway on a branch with no `neon.ts`. A function running locally gets the same Postgres / Auth / Data API / storage / AI Gateway vars a deploy would inject.
|
|
643
|
+
**`neon dev` resolves the same set, by the same rules** — including the AI Gateway on a branch with no `neon.ts`. A function running locally gets the same Postgres / Auth / Data API / storage / AI Gateway vars a deploy would inject. `dev` also sets `NEON_DEV_FUNCTION_PORTS`, a JSON map of the slugs this process is serving to their ports (every neon.ts function, or the matching slug when `--source` names one), so `functionBaseUrl("<slug>")` returns `http://localhost:<port>` for those and the deployed URL on the linked branch for any other slug.
|
|
643
644
|
|
|
644
645
|
Before `neon.ts` is evaluated, `dev` loads the project directory's `.env`, then `.env.local`, which overrides it, into the environment, so Function env values written as `process.env.X!` resolve the same way they do for `neon deploy --env`. A variable already set in the shell wins over both. Local Functions inherit every loaded variable, including keys `neon.ts` doesn't declare; the deployed runtime gets only declared and Neon-injected env. `--env <file>` loads only that file, resolved from the current directory, matching `neon deploy --env`:
|
|
645
646
|
|
|
@@ -1211,6 +1212,10 @@ neon inspect db stalled-queries --output json
|
|
|
1211
1212
|
|
|
1212
1213
|
Every sub-command resolves the project through the standard chain (`--project-id`, then the `.neon` context file, then a single-project auto-detect), and takes `--branch <id|name>`, defaulting to the project's default branch. `logs query` searches the previous hour by default; `logs field-values` searches the previous six hours. The maximum time window is seven days.
|
|
1213
1214
|
|
|
1215
|
+
Use `neon logs query` for structured filters or LogQL with formatted records and cursor
|
|
1216
|
+
pagination. Use [`neon logs loki`](#loki-api-logs-loki) for the Loki read API, label
|
|
1217
|
+
discovery, and the complete Loki JSON response. Both appear in `neon logs --help`.
|
|
1218
|
+
|
|
1214
1219
|
```bash
|
|
1215
1220
|
# The last 30 minutes on the default branch
|
|
1216
1221
|
neon logs query --since 30m
|
|
@@ -1258,6 +1263,60 @@ Two combinations are rejected before the request: `--since` with `--start-time`,
|
|
|
1258
1263
|
|
|
1259
1264
|
`--body-contains` compares a case-sensitive substring against the rendered message. Structured bodies, including object storage records, are rendered as compact JSON, so match the JSON form (for example, `"http_status":200`).
|
|
1260
1265
|
|
|
1266
|
+
### Loki API (`logs loki`)
|
|
1267
|
+
|
|
1268
|
+
`neon logs loki` calls the branch's [Loki-compatible read API](https://neon.com/docs/cli/logs#loki-read-api) directly, using the CLI's
|
|
1269
|
+
normal authentication, project selection and branch resolution, through
|
|
1270
|
+
`neon.logs.loki` in `@neon/sdk`. JSON is the command's default output; `--output json` and `--output yaml` are supported. It preserves the full
|
|
1271
|
+
Loki response envelope. Help and shell completion work without authentication.
|
|
1272
|
+
|
|
1273
|
+
Discover labels and service names, then choose a selector and bound the query:
|
|
1274
|
+
|
|
1275
|
+
```bash
|
|
1276
|
+
neon logs loki --endpoint labels
|
|
1277
|
+
neon logs loki --endpoint label/service_name/values --since 6h
|
|
1278
|
+
neon logs loki '{entity_type="function"} |= "error"' --since 30m --limit 100
|
|
1279
|
+
neon logs loki '{entity_type="function"}' --limit 200 --direction forward
|
|
1280
|
+
neon logs loki '{entity_type="function"}' --project-id <id> --branch main \
|
|
1281
|
+
--start 2026-11-01T00:00:00Z --end 2026-11-01T01:00:00Z
|
|
1282
|
+
neon logs loki '{entity_type="function"}' --endpoint label/severity_text/values
|
|
1283
|
+
neon logs loki '{entity_type="function"}' --since 30m --limit 100 \
|
|
1284
|
+
| jq '{warnings: (.warnings // []), streams: .data.result}'
|
|
1285
|
+
```
|
|
1286
|
+
|
|
1287
|
+
The default endpoint is `query_range`. Each Loki parameter has a named flag, and with a
|
|
1288
|
+
label endpoint the positional query is an optional stream selector:
|
|
1289
|
+
|
|
1290
|
+
| Flag | Meaning |
|
|
1291
|
+
| --- | --- |
|
|
1292
|
+
| `--since <duration>` | Positive Go duration such as `30m` or `24h`. Defaults to 1h for range queries and 6h for label values. |
|
|
1293
|
+
| `--start <timestamp>` | RFC 3339 or Unix nanoseconds, kept as a string. Takes precedence over `since`. |
|
|
1294
|
+
| `--end <timestamp>` | RFC 3339 or Unix nanoseconds, kept as a string. Defaults to now. |
|
|
1295
|
+
| `--limit <count>` | `query_range` only. Positive integer limiting the number of log lines; the server enforces its cap. |
|
|
1296
|
+
| `--direction <order>` | `query_range` only. `forward` (oldest first) or `backward` (newest first). |
|
|
1297
|
+
|
|
1298
|
+
The CLI does not parse LogQL or convert nanosecond timestamps to numbers.
|
|
1299
|
+
|
|
1300
|
+
Range responses have `data.resultType: "streams"` and a `data.result` array. Each entry
|
|
1301
|
+
contains `stream` labels and `values` pairs of `[timestamp, line]`; timestamps are nanosecond
|
|
1302
|
+
strings. There is no continuation cursor. A result with `--limit` lines, or with the
|
|
1303
|
+
server's cap of 10,000 lines, may be incomplete, and reaching the cap adds no `warnings`
|
|
1304
|
+
entry. Narrow the time window or selector for complete results. The maximum window is
|
|
1305
|
+
168 hours.
|
|
1306
|
+
|
|
1307
|
+
Neon's supported LogQL subset is stream selectors (`=`, `!=`, `=~`, `!~`) and line filters
|
|
1308
|
+
(`|=`, `!=`, `|~`, `!~`). Metric queries, parser/format stages and live tailing are unsupported.
|
|
1309
|
+
Instant queries are unsupported. The advertised labels are `service_name`,
|
|
1310
|
+
`severity_text`, `scope_name`, and `entity_type`; use `labels` to discover them. Label-value
|
|
1311
|
+
queries accept a stream selector without line filters.
|
|
1312
|
+
|
|
1313
|
+
Requests go to
|
|
1314
|
+
`/telemetry/v1/projects/<project>/branches/<branch>/loki/api/v1/<endpoint>` on the same
|
|
1315
|
+
origin as `--api-host` / `NEON_API_HOST` (default `https://console.neon.tech`). This is a
|
|
1316
|
+
separate API from the Management API used by `neon logs query --logql`. Access requires
|
|
1317
|
+
project read permission and telemetry enabled for the project's organization and region.
|
|
1318
|
+
The CLI reports the server's error when access or a query is rejected.
|
|
1319
|
+
|
|
1261
1320
|
## Profiles
|
|
1262
1321
|
|
|
1263
1322
|
The CLI holds one Neon account by default. A profile adds another, and is a pointer: a
|
|
@@ -1556,7 +1615,7 @@ Every subcommand except `list` takes `--org-id`. Without it, the CLI uses the or
|
|
|
1556
1615
|
| function | `deploy`, `list`, `get`, `delete`, `domains list`, `domains register`, `domains delete` | Manage Neon Functions |
|
|
1557
1616
|
| [roles](https://neon.com/docs/reference/cli-roles) | `list`, `get`, `create`, `reset-password`, `delete` | Manage roles |
|
|
1558
1617
|
| [operations](https://neon.com/docs/reference/cli-operations) | `list`, `get` | Manage operations |
|
|
1559
|
-
| logs
|
|
1618
|
+
| [logs](#logs-logs) | `query`, `fields`, `field-values`, `loki [query]` | Query branch logs or the Loki API |
|
|
1560
1619
|
| inspect | `db stalled-queries` | Inspect Postgres diagnostics |
|
|
1561
1620
|
| snapshots | `list`, `get`, `create`, `update`, `delete`, `restore`, `finalize`, `schedule get`, `schedule set` | Manage snapshots |
|
|
1562
1621
|
| triggers | `list`, `get`, `create`, `update`, `enable`, `disable`, `delete` | Manage function triggers |
|
|
@@ -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-DxcO3oJk.js";
|
|
15
|
+
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-BClSMzco.js";
|
|
16
|
+
import { i as handler$1 } from "./link-n40BxbmK.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-DxcO3oJk.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-DxcO3oJk.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-BClSMzco.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({
|
|
@@ -3,11 +3,11 @@ import { log } from "../log.js";
|
|
|
3
3
|
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
|
-
import {
|
|
6
|
+
import { t as NEON_DEV_FUNCTION_PORTS } from "./env-EJU-0InB.js";
|
|
7
7
|
import { branchIdResolve } from "../utils/enrichers.js";
|
|
8
8
|
import { bundleEntry } from "../utils/esbuild.js";
|
|
9
|
-
import { a as resolveDevEnv } from "./env-
|
|
10
|
-
import { f as envFlag } from "./config-
|
|
9
|
+
import { a as resolveDevEnv } from "./env-CFBmcKyo.js";
|
|
10
|
+
import { f as envFlag } from "./config-BClSMzco.js";
|
|
11
11
|
import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
12
12
|
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
13
13
|
import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -31,7 +31,7 @@ var dev_exports = /* @__PURE__ */ __exportAll({
|
|
|
31
31
|
formatEnvSummary: () => formatEnvSummary,
|
|
32
32
|
handler: () => handler,
|
|
33
33
|
loadDevEnvFiles: () => loadDevEnvFiles,
|
|
34
|
-
|
|
34
|
+
localFunctionPortsEnv: () => localFunctionPortsEnv,
|
|
35
35
|
planFunctionsToUnits: () => planFunctionsToUnits,
|
|
36
36
|
reportDevCredential: () => reportDevCredential,
|
|
37
37
|
sourceFunctionUrlOverlay: () => sourceFunctionUrlOverlay
|
|
@@ -55,10 +55,10 @@ const builder = (argv) => argv.usage("$0 dev [--source <path>] [options]").examp
|
|
|
55
55
|
"object storage and the AI Gateway where the branch has them. A neon.ts in",
|
|
56
56
|
"this directory decides instead, exactly as it does for `env pull`.",
|
|
57
57
|
"",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
58
|
+
"`functionBaseUrl(\"<slug>\")` from @neon/env returns `http://localhost:<port>` for",
|
|
59
|
+
"each function this process is serving (every neon.ts function, or the matching",
|
|
60
|
+
"slug when `--source` names one), through NEON_DEV_FUNCTION_PORTS, and the",
|
|
61
|
+
"deployed URL on the linked branch for any other slug.",
|
|
62
62
|
"",
|
|
63
63
|
"Before neon.ts is evaluated, `dev` loads the project's .env, then .env.local,",
|
|
64
64
|
"which overrides it, into the environment, so Function env values that read",
|
|
@@ -267,7 +267,7 @@ const planFunctionsToUnits = async (functions, neonEnv, searchBase, keepPorts =
|
|
|
267
267
|
port
|
|
268
268
|
};
|
|
269
269
|
});
|
|
270
|
-
const overlay =
|
|
270
|
+
const overlay = localFunctionPortsEnv(assigned.map(({ fn, port }) => ({
|
|
271
271
|
slug: fn.slug,
|
|
272
272
|
port
|
|
273
273
|
})));
|
|
@@ -281,14 +281,10 @@ const planFunctionsToUnits = async (functions, neonEnv, searchBase, keepPorts =
|
|
|
281
281
|
}, overlay));
|
|
282
282
|
};
|
|
283
283
|
/**
|
|
284
|
-
*
|
|
285
|
-
* other on localhost instead of the
|
|
284
|
+
* The ports of the functions `neon dev` is serving, which `functionBaseUrl` reads so
|
|
285
|
+
* siblings call each other on localhost instead of the deployed compute host.
|
|
286
286
|
*/
|
|
287
|
-
const
|
|
288
|
-
const out = {};
|
|
289
|
-
for (const fn of functions) out[functionBaseUrlKey(fn.slug)] = `http://localhost:${fn.port}`;
|
|
290
|
-
return out;
|
|
291
|
-
};
|
|
287
|
+
const localFunctionPortsEnv = (functions) => ({ [NEON_DEV_FUNCTION_PORTS]: JSON.stringify(Object.fromEntries(functions.map((fn) => [fn.slug, fn.port]))) });
|
|
292
288
|
/**
|
|
293
289
|
* `--source` serves one file. If that file is a neon.ts function, rewrite only that
|
|
294
290
|
* slug to localhost — this process is not listening for the others.
|
|
@@ -301,7 +297,7 @@ const sourceFunctionUrlOverlay = async (match, cliPort, shellEnv = process.env)
|
|
|
301
297
|
};
|
|
302
298
|
const port = portSpec.mode === "explicit" ? portSpec.port : match.port ?? await pickFreePort(portSpec.from);
|
|
303
299
|
return {
|
|
304
|
-
overlay:
|
|
300
|
+
overlay: localFunctionPortsEnv([{
|
|
305
301
|
slug: match.slug,
|
|
306
302
|
port
|
|
307
303
|
}]),
|
|
@@ -421,11 +417,14 @@ const plannedToUnit = (fn, branchEnv, port, overlay = {}) => {
|
|
|
421
417
|
* Build a child's env. Neon vars layer over the inherited environment (so the branch's
|
|
422
418
|
* DATABASE_URL wins over a stale inherited value); a function that loads its own `.env`
|
|
423
419
|
* at runtime still overrides them. The port spec is encoded for the runtime via
|
|
424
|
-
* NEON_DEV_PORT (explicit) or NEON_DEV_PORT_BASE (search).
|
|
420
|
+
* NEON_DEV_PORT (explicit) or NEON_DEV_PORT_BASE (search). An inherited
|
|
421
|
+
* NEON_DEV_FUNCTION_PORTS names another process's ports, so only this one's applies.
|
|
425
422
|
*/
|
|
426
423
|
const buildChildEnv = (neonEnv, port) => {
|
|
424
|
+
const inherited = { ...process.env };
|
|
425
|
+
delete inherited[NEON_DEV_FUNCTION_PORTS];
|
|
427
426
|
const env = {
|
|
428
|
-
...
|
|
427
|
+
...inherited,
|
|
429
428
|
...neonEnv
|
|
430
429
|
};
|
|
431
430
|
delete env.NEON_DEV_PORT;
|
|
@@ -941,4 +940,4 @@ const resolveRuntimePath = () => {
|
|
|
941
940
|
if (!existsSync(candidate)) throw new Error(`Could not locate the dev runtime at ${candidate}`);
|
|
942
941
|
return candidate;
|
|
943
942
|
};
|
|
944
|
-
export { devBundleDir as a, diffUnits as c, handler as d, loadDevEnvFiles as f, sourceFunctionUrlOverlay as g, reportDevCredential as h, describe as i, formatEnvFiles as l, planFunctionsToUnits as m, captureShellEnv as n, devEnvContext as o,
|
|
943
|
+
export { devBundleDir as a, diffUnits as c, handler as d, loadDevEnvFiles as f, sourceFunctionUrlOverlay as g, reportDevCredential as h, describe as i, formatEnvFiles as l, planFunctionsToUnits as m, captureShellEnv as n, devEnvContext as o, localFunctionPortsEnv as p, command as r, dev_exports as s, builder as t, formatEnvSummary as u };
|
|
@@ -2,7 +2,7 @@ import { log } from "../log.js";
|
|
|
2
2
|
import { getCliName } from "../utils/cli_name.js";
|
|
3
3
|
import { declaredNeonServices } from "../config_services.js";
|
|
4
4
|
import { loadProjectConfig } from "../project.js";
|
|
5
|
-
import { a as
|
|
5
|
+
import { a as credentialName, d as policyEnvKeys, f as resolveBranchPolicy, i as credentialEnvKeys, l as fetchEnvKeysState, n as NEON_ENV_VAR_KEYS, o as defaultAiGatewayCredential, p as toEntries, r as createApiFromOptions, s as defaultStorageCredential, u as isLiveCredential } from "./env-EJU-0InB.js";
|
|
6
6
|
import { ENV_PULL_SERVICES, envKeysForSelection, serviceForEnvKey, servicesForEnvKeys } from "../env_services.js";
|
|
7
7
|
import { formatInstallCommand, resolvePackageManager } from "../utils/package_manager.js";
|
|
8
8
|
import { StagingOnlyError } from "../utils/staging.js";
|
|
@@ -48,7 +48,7 @@ async function fetchEnvReusingSecrets(config, options) {
|
|
|
48
48
|
const { branch, desired } = await resolveBranchPolicy(config, options, api, resolvedBranch);
|
|
49
49
|
const allPolicyKeys = policyEnvKeys(desired);
|
|
50
50
|
const requested = requestedKeys ? new Set(requestedKeys) : null;
|
|
51
|
-
const selectedPolicyKeys = requested === null ? allPolicyKeys : [...allPolicyKeys.filter((key) => requested.has(key)), ...
|
|
51
|
+
const selectedPolicyKeys = requested === null ? allPolicyKeys : [...allPolicyKeys.filter((key) => requested.has(key)), ...Object.values(NEON_ENV_VAR_KEYS.branch).filter((key) => requested.has(key) && !allPolicyKeys.includes(key))];
|
|
52
52
|
const selected = new Set(selectedPolicyKeys);
|
|
53
53
|
const K = NEON_ENV_VAR_KEYS;
|
|
54
54
|
const storageCredentialSelected = (desired.preview?.buckets.length ?? 0) > 0 && (selected.has(K.storage.accessKeyId) || selected.has(K.storage.secretAccessKey));
|
|
@@ -70,8 +70,7 @@ async function fetchEnvReusingSecrets(config, options) {
|
|
|
70
70
|
fresh: [],
|
|
71
71
|
revoked: [],
|
|
72
72
|
superseded: []
|
|
73
|
-
}
|
|
74
|
-
...fetched.functionUrlsUnavailable ? { functionUrlsUnavailable: true } : {}
|
|
73
|
+
}
|
|
75
74
|
};
|
|
76
75
|
}
|
|
77
76
|
const persisted = readPersistedSecrets(source);
|
|
@@ -103,7 +102,6 @@ async function fetchEnvReusingSecrets(config, options) {
|
|
|
103
102
|
desired
|
|
104
103
|
});
|
|
105
104
|
const vars = preferPersisted(toEntries(fetched.env), source);
|
|
106
|
-
const unavailable = fetched.functionUrlsUnavailable ? { functionUrlsUnavailable: true } : {};
|
|
107
105
|
for (const key of keptSecretKeys) {
|
|
108
106
|
const value = source[key];
|
|
109
107
|
if (value !== void 0) vars[key] = value;
|
|
@@ -116,8 +114,7 @@ async function fetchEnvReusingSecrets(config, options) {
|
|
|
116
114
|
fresh: [],
|
|
117
115
|
revoked: [],
|
|
118
116
|
superseded: []
|
|
119
|
-
}
|
|
120
|
-
...unavailable
|
|
117
|
+
}
|
|
121
118
|
};
|
|
122
119
|
const ours = /* @__PURE__ */ new Set();
|
|
123
120
|
for (const meta of [storageCredentialManaged && !keepStorage ? named.storage : null, gatewayCredentialManaged && !keepGateway ? named.gateway : null]) if (meta !== null && meta.principalType === "user" && meta.name === credentialName(branch.name)) ours.add(meta.tokenId);
|
|
@@ -130,8 +127,7 @@ async function fetchEnvReusingSecrets(config, options) {
|
|
|
130
127
|
fresh: secretKeys.filter((key) => !keptSecretKeys.includes(key)),
|
|
131
128
|
revoked: revokeSuperseded ? [...ours] : [],
|
|
132
129
|
superseded: revokeSuperseded ? [] : [...ours]
|
|
133
|
-
}
|
|
134
|
-
...unavailable
|
|
130
|
+
}
|
|
135
131
|
};
|
|
136
132
|
}
|
|
137
133
|
/** Read the branch credential's secrets out of an env source. */
|
|
@@ -378,16 +374,13 @@ const resolveClaimableNeonEnvVars = async (ctx) => {
|
|
|
378
374
|
* 1. a `neon.ts` policy is found -> the policy is the source of truth. We first
|
|
379
375
|
* check it against the branch's live state (`plan`); if it declares a resource
|
|
380
376
|
* the branch is missing, we stop with a {@link DevEnvMismatchError} pointing at
|
|
381
|
-
* `neonctl deploy`. Function declarations are excluded from that check:
|
|
382
|
-
*
|
|
383
|
-
* function still gets `NEON_FUNCTION_*_BASE_URL`. Otherwise `fetchEnv` evaluates
|
|
377
|
+
* `neonctl deploy`. Function declarations are excluded from that check: local env
|
|
378
|
+
* does not depend on whether a function is deployed. Otherwise `fetchEnv` evaluates
|
|
384
379
|
* the policy.
|
|
385
380
|
* 2. no `neon.ts`, but a project + branch are known -> `pullConfig` reads the
|
|
386
381
|
* branch's live state (Auth / Data API / Realtime enablement plus any object-storage
|
|
387
382
|
* buckets) into a config, then `fetchEnv` resolves what is actually enabled —
|
|
388
|
-
* so a branch with a bucket gets its `AWS_*` storage vars pulled with no policy.
|
|
389
|
-
* Function invocation URLs are listed live (`functionUrls: "all-live"`) because
|
|
390
|
-
* `pullConfig` cannot round-trip them into `functions`. With
|
|
383
|
+
* so a branch with a bucket gets its `AWS_*` storage vars pulled with no policy. With
|
|
391
384
|
* {@link DevEnvContext.implyAiGateway}, the AI Gateway is added on top, since
|
|
392
385
|
* `pullConfig` cannot read it back.
|
|
393
386
|
* 3. otherwise -> throw {@link MissingBranchContextError}.
|
|
@@ -422,10 +415,7 @@ const resolveNeonEnvVars = async (ctx) => {
|
|
|
422
415
|
protected: pulled.branch.protected,
|
|
423
416
|
...pulled.branch.expiresAt ? { expiresAt: pulled.branch.expiresAt } : {}
|
|
424
417
|
};
|
|
425
|
-
if (!ctx.implyAiGateway) return await fetchAndProject(pulled.config, ctx, {
|
|
426
|
-
functionUrls: "all-live",
|
|
427
|
-
resolvedBranch
|
|
428
|
-
});
|
|
418
|
+
if (!ctx.implyAiGateway) return await fetchAndProject(pulled.config, ctx, { resolvedBranch });
|
|
429
419
|
return await resolveWithImpliedGateway(pulled.config, ctx, {
|
|
430
420
|
projectId: ctx.projectId,
|
|
431
421
|
branchId: ctx.branchId,
|
|
@@ -466,15 +456,9 @@ const withAiGateway = (config) => ({
|
|
|
466
456
|
*/
|
|
467
457
|
const resolveWithImpliedGateway = async (config, ctx, branch) => {
|
|
468
458
|
const unreachable = await credentialsUnreachable(ctx, branch);
|
|
469
|
-
if (unreachable === null) return await fetchAndProject(withAiGateway(config), ctx, {
|
|
470
|
-
functionUrls: "all-live",
|
|
471
|
-
resolvedBranch: branch.resolvedBranch
|
|
472
|
-
});
|
|
459
|
+
if (unreachable === null) return await fetchAndProject(withAiGateway(config), ctx, { resolvedBranch: branch.resolvedBranch });
|
|
473
460
|
log.warning(`Could not reach the AI Gateway's credentials, so %s were not resolved. Everything else was. Either this project does not have the AI Gateway, or the call failed — \`${getCliName()} env pull -s ai-gateway\` will say which.\nDetails: %s`, [NEON_ENV_VAR_KEYS.aiGateway.apiKey, NEON_ENV_VAR_KEYS.aiGateway.baseUrl].join(" and "), unreachable);
|
|
474
|
-
const pulled = await fetchAndProject(config, ctx, {
|
|
475
|
-
functionUrls: "all-live",
|
|
476
|
-
resolvedBranch: branch.resolvedBranch
|
|
477
|
-
});
|
|
461
|
+
const pulled = await fetchAndProject(config, ctx, { resolvedBranch: branch.resolvedBranch });
|
|
478
462
|
return {
|
|
479
463
|
...pulled,
|
|
480
464
|
skipped: [...pulled.skipped ?? [], "ai-gateway"]
|
|
@@ -514,18 +498,13 @@ const resolveSelectedServices = async (ctx, directServices, envKeys) => {
|
|
|
514
498
|
const api = apiFor(ctx);
|
|
515
499
|
const has = (service) => services.includes(service);
|
|
516
500
|
const checkAiGateway = has("ai-gateway") && !selectedKeys.includes(NEON_ENV_VAR_KEYS.aiGateway.apiKey);
|
|
517
|
-
const [auth, dataApiEnabled, realtime, buckets, aiGatewayAvailable
|
|
501
|
+
const [auth, dataApiEnabled, realtime, buckets, aiGatewayAvailable] = await Promise.all([
|
|
518
502
|
has("auth") ? api.getNeonAuth(projectId, branchId) : null,
|
|
519
503
|
has("data-api") ? readDataApiEnabled(api, projectId, branchId) : null,
|
|
520
504
|
has("realtime") ? readRealtime(api, projectId, branchId) : null,
|
|
521
505
|
has("object-storage") ? api.listBranchBuckets(projectId, branchId) : null,
|
|
522
|
-
checkAiGateway ? readAiGatewayAvailable(api, projectId, branchId) : null
|
|
523
|
-
directServices.includes("functions") ? api.listBranchFunctions(projectId, branchId) : null
|
|
506
|
+
checkAiGateway ? readAiGatewayAvailable(api, projectId, branchId) : null
|
|
524
507
|
]);
|
|
525
|
-
const callableFunctions = (functions ?? []).filter((fn) => fn.invocationUrl !== "");
|
|
526
|
-
if (directServices.includes("functions") && callableFunctions.length === 0) throw new ServiceNotOnBranchError(`--service functions: branch ${branchId} has no deployed functions, so there are no NEON_FUNCTION_*_BASE_URL vars to pull. Deploy a function first (\`${getCliName()} deploy\`, or in the Neon Console), or drop functions from --service.`);
|
|
527
|
-
const functionKeys = directServices.includes("functions") ? callableFunctions.map((fn) => functionBaseUrlKey(fn.slug)).sort((left, right) => left.localeCompare(right)) : [];
|
|
528
|
-
const fetchKeys = [.../* @__PURE__ */ new Set([...selectedKeys, ...functionKeys])];
|
|
529
508
|
const config = configForServices(services, branchId, {
|
|
530
509
|
authEnabled: auth !== null,
|
|
531
510
|
dataApiEnabled,
|
|
@@ -537,12 +516,8 @@ const resolveSelectedServices = async (ctx, directServices, envKeys) => {
|
|
|
537
516
|
envKeys
|
|
538
517
|
});
|
|
539
518
|
return await fetchAndProject(config, ctx, {
|
|
540
|
-
keys:
|
|
541
|
-
revokeSuperseded: false
|
|
542
|
-
...directServices.includes("functions") ? {
|
|
543
|
-
functionUrls: "all-live",
|
|
544
|
-
listedFunctions: callableFunctions
|
|
545
|
-
} : {}
|
|
519
|
+
keys: selectedKeys,
|
|
520
|
+
revokeSuperseded: false
|
|
546
521
|
});
|
|
547
522
|
};
|
|
548
523
|
/**
|
|
@@ -703,14 +678,12 @@ const fetchAndProject = async (config, ctx, opts = {}) => {
|
|
|
703
678
|
...ctx.env ? { env: ctx.env } : {},
|
|
704
679
|
...opts.keys ? { keys: opts.keys } : {},
|
|
705
680
|
...opts.revokeSuperseded === false ? { revokeSuperseded: false } : {},
|
|
706
|
-
...opts.
|
|
707
|
-
|
|
708
|
-
...opts.resolvedBranch ? { resolvedBranch: opts.resolvedBranch } : {}
|
|
681
|
+
...opts.resolvedBranch ? { resolvedBranch: opts.resolvedBranch } : {},
|
|
682
|
+
functionHostSuffix: "always"
|
|
709
683
|
});
|
|
710
684
|
return {
|
|
711
685
|
vars: result.vars,
|
|
712
|
-
credential: result.credential
|
|
713
|
-
...result.functionUrlsUnavailable ? { skipped: ["functions"] } : {}
|
|
686
|
+
credential: result.credential
|
|
714
687
|
};
|
|
715
688
|
};
|
|
716
689
|
/**
|
|
@@ -5,10 +5,10 @@ import { isClaimableEnvTarget } from "../claimable/state.js";
|
|
|
5
5
|
import { getCliName } from "../utils/cli_name.js";
|
|
6
6
|
import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOption } from "../neon_services.js";
|
|
7
7
|
import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
8
|
-
import {
|
|
9
|
-
import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
|
|
8
|
+
import { n as NEON_ENV_VAR_KEYS } from "./env-EJU-0InB.js";
|
|
9
|
+
import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, isLegacyFunctionBaseUrlKey, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
|
|
10
10
|
import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
|
|
11
|
-
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-
|
|
11
|
+
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-CFBmcKyo.js";
|
|
12
12
|
import { warnAiGateway } from "../utils/ai_gateway_notice.js";
|
|
13
13
|
import { formatPulledEnv, pulledBranch } from "../commands/env_output.js";
|
|
14
14
|
import { existsSync } from "node:fs";
|
|
@@ -66,8 +66,7 @@ const builder = (argv) => argv.usage("$0 env <sub-command> [options]").options({
|
|
|
66
66
|
"What gets pulled, in precedence order:",
|
|
67
67
|
" 1. --service / --env, when given — their union, ignoring neon.ts.",
|
|
68
68
|
" 2. neon.ts, when the project directory (next to .neon, or cwd",
|
|
69
|
-
" without one) has one
|
|
70
|
-
" function does not have to be deployed).",
|
|
69
|
+
" without one) has one.",
|
|
71
70
|
" 3. Otherwise everything the branch has, plus the AI Gateway —",
|
|
72
71
|
" which pulls the default AI Gateway credential.",
|
|
73
72
|
"",
|
|
@@ -82,7 +81,7 @@ const builder = (argv) => argv.usage("$0 env <sub-command> [options]").options({
|
|
|
82
81
|
"The pull bundled into link / checkout / config apply follows 2 and 3",
|
|
83
82
|
"without the AI Gateway, so it never writes a gateway token you did",
|
|
84
83
|
"not ask for. Run `env pull` to add it."
|
|
85
|
-
].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").example("$0 env pull -s functions", "Pull
|
|
84
|
+
].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").example("$0 env pull -s functions", "Pull NEON_BRANCH_ID and NEON_FUNCTION_HOST_SUFFIX, which functionBaseUrl(\"<slug>\") from @neon/env reads").strict(), async (args) => {
|
|
86
85
|
const rawServices = servicesFlagValue(args.service);
|
|
87
86
|
const rawEnvKeys = envPullFlagValue(args.env);
|
|
88
87
|
const services = rawServices ? parseServices(rawServices, {
|
|
@@ -118,6 +117,8 @@ const NEON_VAR_NAMES = Object.values(NEON_ENV_VAR_KEYS).flatMap((group) => Objec
|
|
|
118
117
|
*/
|
|
119
118
|
const NEON_OWNED_ENV_KEYS = [
|
|
120
119
|
...Object.values(NEON_ENV_VAR_KEYS.postgres),
|
|
120
|
+
NEON_ENV_VAR_KEYS.branch.id,
|
|
121
|
+
NEON_ENV_VAR_KEYS.branch.functionHostSuffix,
|
|
121
122
|
...Object.values(NEON_ENV_VAR_KEYS.auth),
|
|
122
123
|
...Object.values(NEON_ENV_VAR_KEYS.dataApi),
|
|
123
124
|
...Object.values(NEON_ENV_VAR_KEYS.realtime),
|
|
@@ -162,12 +163,12 @@ const pull = async (props, opts = {}) => {
|
|
|
162
163
|
...props.apiHost ? { apiHost: props.apiHost } : {},
|
|
163
164
|
...props.runtimeApi ? { api: props.runtimeApi } : {}
|
|
164
165
|
});
|
|
165
|
-
const neonVars = pickSelectedVars(pickNeonVars(vars), selectedKeys
|
|
166
|
+
const neonVars = pickSelectedVars(pickNeonVars(vars), selectedKeys);
|
|
166
167
|
if (Object.keys(neonVars).length === 0) {
|
|
167
168
|
if (!(dropped !== null && dropped.services.length === 0 && dropped.envKeys.length === 0 && dropped.skipped.length > 0)) log.info(`No Neon env variables to pull from ${namedBranch ? pulledBranch(namedBranch) : "this branch"}: no DATABASE_URL or enabled Auth / Data API.`);
|
|
168
169
|
return { status: "empty" };
|
|
169
170
|
}
|
|
170
|
-
const { written, removed } = mergeEnvFile(targetPath, neonVars, { managedKeys: managedKeysFor(selectedKeys, unreachedButCurrent(skipped, existingEnv, branchId), existingEnv, props.services !== void 0 ? selectionServices : void 0
|
|
171
|
+
const { written, removed } = mergeEnvFile(targetPath, neonVars, { managedKeys: managedKeysFor(selectedKeys, unreachedButCurrent(skipped, existingEnv, branchId), existingEnv, props.services !== void 0 ? selectionServices : void 0) });
|
|
171
172
|
process.stderr.write(formatPulledEnv({
|
|
172
173
|
status: "written",
|
|
173
174
|
written,
|
|
@@ -195,18 +196,17 @@ const pull = async (props, opts = {}) => {
|
|
|
195
196
|
...skipped && skipped.length > 0 ? { skipped } : {}
|
|
196
197
|
};
|
|
197
198
|
};
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Prevents scoped or unavailable services from pruning values they did not resolve. A pull
|
|
201
|
+
* that covers functions also prunes the `NEON_FUNCTION_<SLUG>_BASE_URL` lines earlier
|
|
202
|
+
* releases wrote, since nothing reads or refreshes them anymore.
|
|
203
|
+
*/
|
|
204
|
+
const managedKeysFor = (selectedKeys, unreached, existingEnv, services) => {
|
|
205
|
+
const legacyFunctionKeys = selectedKeys === void 0 || (services?.includes("functions") ?? false) ? Object.keys(existingEnv).filter(isLegacyFunctionBaseUrlKey) : [];
|
|
206
|
+
const owned = [...selectedKeys ? NEON_OWNED_ENV_KEYS.filter((key) => selectedKeys.includes(key)) : NEON_OWNED_ENV_KEYS, ...legacyFunctionKeys];
|
|
204
207
|
if (unreached.length === 0) return owned;
|
|
205
208
|
const keep = new Set(ownedEnvServiceKeys(unreached));
|
|
206
|
-
return owned.filter((key) =>
|
|
207
|
-
if (unreached.includes("functions") && isFunctionBaseUrlKey(key)) return false;
|
|
208
|
-
return !keep.has(key);
|
|
209
|
-
});
|
|
209
|
+
return owned.filter((key) => !keep.has(key));
|
|
210
210
|
};
|
|
211
211
|
/**
|
|
212
212
|
* Endpoint failure is not evidence that existing values are stale; the gateway host check
|
|
@@ -219,7 +219,6 @@ const unreachedButCurrent = (skipped, existingEnv, branchId) => {
|
|
|
219
219
|
const baseUrl = existingEnv[NEON_ENV_VAR_KEYS.aiGateway.baseUrl];
|
|
220
220
|
if (baseUrl !== void 0 && isBranchGatewayUrl(baseUrl, branchId)) keep.push("ai-gateway");
|
|
221
221
|
}
|
|
222
|
-
if (skipped.includes("functions")) keep.push("functions");
|
|
223
222
|
return keep;
|
|
224
223
|
};
|
|
225
224
|
/**
|
|
@@ -237,11 +236,10 @@ const isBranchGatewayUrl = (baseUrl, branchId) => URL.canParse(baseUrl) && new U
|
|
|
237
236
|
* supporting values that were not selected (the direct connection URI derives the AI Gateway
|
|
238
237
|
* host, for example); those must not land in the target file.
|
|
239
238
|
*/
|
|
240
|
-
const pickSelectedVars = (vars, selectedKeys
|
|
239
|
+
const pickSelectedVars = (vars, selectedKeys) => {
|
|
241
240
|
if (!selectedKeys) return vars;
|
|
242
241
|
const wanted = new Set(selectedKeys);
|
|
243
|
-
|
|
244
|
-
return Object.fromEntries(Object.entries(vars).filter(([key]) => wanted.has(key) || keepFunctionUrls && isFunctionBaseUrlKey(key)));
|
|
242
|
+
return Object.fromEntries(Object.entries(vars).filter(([key]) => wanted.has(key)));
|
|
245
243
|
};
|
|
246
244
|
/**
|
|
247
245
|
* Pull a freshly-pinned branch's Neon env vars into a local `.env`, bundled into `link` and
|
|
@@ -276,7 +274,7 @@ Run \`${getCliName()} env pull\` once resolved (e.g. \`${getCliName()} deploy\`
|
|
|
276
274
|
*/
|
|
277
275
|
const pickNeonVars = (vars) => {
|
|
278
276
|
const out = {};
|
|
279
|
-
for (const [name, value] of Object.entries(vars)) if (NEON_VAR_NAMES.some((key) => key === name)
|
|
277
|
+
for (const [name, value] of Object.entries(vars)) if (NEON_VAR_NAMES.some((key) => key === name)) out[name] = value;
|
|
280
278
|
return out;
|
|
281
279
|
};
|
|
282
280
|
export { describe as a, pull as c, command as i, autoPullEnvAfterPin as n, env_exports as o, builder as r, handler as s, ENV_PULL_SKIPPED_HINT as t };
|