@neon/env 1.5.4 → 1.6.2
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 +20 -7
- package/dist/env.js +71 -1
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +40 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Contributing? See [`CONTRIBUTING.md`](./CONTRIBUTING.md).
|
|
|
24
24
|
|
|
25
25
|
The library functions are **filesystem- and env-agnostic**: `fetchEnv` requires an explicit `projectId` + `branch` (a branch **name** like `main`, or a `br-…` id). (The `neon-env` CLI does the `.neon`/`NEON_*` resolution and passes these in.)
|
|
26
26
|
|
|
27
|
-
> `parseEnv` takes **no branch name**: the secret set is static (
|
|
27
|
+
> `parseEnv` takes **no branch name**: the secret set is static (`config.auth` / `config.dataApi` / `config.preview.realtime`), so it reads those toggles directly without evaluating the per-branch closure. Its optional second argument is a **scope** _or_ a **key filter** — omit it for the full external (app/build) env, pass a **function slug** when running inside that deployed function (adds a typed `function` namespace of that function's declared env keys), or pass an **array of OS-level env-var keys** to require + return only that subset.
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
30
|
import config from "../neon";
|
|
@@ -41,7 +41,6 @@ const env2 = parseEnv(config);
|
|
|
41
41
|
// Inside a deployed function, pass its slug for the typed `function` namespace:
|
|
42
42
|
const fnEnv = parseEnv(config, "hello");
|
|
43
43
|
fnEnv.function.resendApiKey; // typed from hello's declared env keys
|
|
44
|
-
fnEnv.functions.hello.baseUrl;
|
|
45
44
|
|
|
46
45
|
// Key filter — only enforce + return the vars you actually use (e.g. a Next.js app that
|
|
47
46
|
// reads the pooled URL but not the unpooled one). The keys autocomplete from the policy, so
|
|
@@ -50,11 +49,11 @@ const { postgres } = parseEnv(config, ["DATABASE_URL"]);
|
|
|
50
49
|
postgres.databaseUrl; // string — `databaseUrlUnpooled` is absent, and never required
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
Both return the same namespaced `NeonEnv` shape: `postgres` is always present; `branch` (the branch name, surfaced as `NEON_BRANCH`) is always present on a `fetchEnv` result and present on a `parseEnv` result when `NEON_BRANCH` was injected; `auth` and `
|
|
52
|
+
Both return the same namespaced `NeonEnv` shape: `postgres` is always present; `branch` (the branch name, surfaced as `NEON_BRANCH`) is always present on a `fetchEnv` result and present on a `parseEnv` result when `NEON_BRANCH` was injected; `auth`, `dataApi`, and `realtime` are included (and statically typed) when the policy enables them.
|
|
54
53
|
|
|
55
54
|
| Function | Description |
|
|
56
55
|
| --- | --- |
|
|
57
|
-
| `fetchEnv(config, { projectId, branch, ... })` | Async. Calls the Neon API for the given project + branch and returns live connection strings (and Auth/Data API values when enabled). `projectId` and `branch` are required; `branch` accepts a branch **name** (e.g. `main`) or a `br-…` id. (The legacy id-only `branchId` option still works.) Pass `keys` to fetch only some vars — see [Fetching a subset](#fetching-a-subset). Reads nothing from `process.env` or disk. |
|
|
56
|
+
| `fetchEnv(config, { projectId, branch, ... })` | Async. Calls the Neon API for the given project + branch and returns live connection strings (and Auth/Data API/Realtime values when enabled). `projectId` and `branch` are required; `branch` accepts a branch **name** (e.g. `main`) or a `br-…` id. (The legacy id-only `branchId` option still works.) Pass `keys` to fetch only some vars — see [Fetching a subset](#fetching-a-subset). Reads nothing from `process.env` or disk. |
|
|
58
57
|
| `parseEnv(config)` / `parseEnv(config, slug)` / `parseEnv(config, keys)` | Sync. Reads/validates the Neon env vars already present in `process.env` against the static policy toggles. With a function `slug`, also returns a typed `function` namespace of that function's declared env keys; `functions.<slug>.baseUrl` is the invocation URL. With a `keys` array (e.g. `["DATABASE_URL"]`), only those vars are required and returned, as a narrowed namespaced shape — the keys are typesafe against the policy. Throws `PlatformError(EnvNotInjected)` listing missing vars when the env isn't populated. |
|
|
59
58
|
| `toEntries(env)` | Project a resolved `NeonEnv` into `{ KEY: value }` pairs for cross-process transport (named after the web `.entries()` convention; returns a `Record`). |
|
|
60
59
|
|
|
@@ -69,7 +68,7 @@ neon-env run -- npm run dev
|
|
|
69
68
|
neon-env run -- pnpm dev
|
|
70
69
|
```
|
|
71
70
|
|
|
72
|
-
`run` loads `neon.ts`, resolves the branch (via `--branch`, `NEON_BRANCH` / `NEON_BRANCH_ID`, or the `branch` field in `.neon[/project.json]` — by name or id), fetches the connection strings from Neon, and spawns the command with `NEON_BRANCH` / `DATABASE_URL` / `DATABASE_URL_UNPOOLED` (plus the Auth, Data API, object-storage `AWS_*`, AI Gateway `NEON_AI_GATEWAY_*`, and function `NEON_FUNCTION_*_BASE_URL` vars when the policy enables them — see [Env vars produced](#env-vars-produced)) injected on top of the inherited environment. Stdio is inherited so interactive dev servers keep working, and the parent exits with the child's exit code.
|
|
71
|
+
`run` loads `neon.ts`, resolves the branch (via `--branch`, `NEON_BRANCH` / `NEON_BRANCH_ID`, or the `branch` field in `.neon[/project.json]` — by name or id), fetches the connection strings from Neon, and spawns the command with `NEON_BRANCH` / `DATABASE_URL` / `DATABASE_URL_UNPOOLED` (plus the Auth, Data API, Realtime, object-storage `AWS_*`, AI Gateway `NEON_AI_GATEWAY_*`, and function `NEON_FUNCTION_*_BASE_URL` vars when the policy enables them — see [Env vars produced](#env-vars-produced)) injected on top of the inherited environment. Stdio is inherited so interactive dev servers keep working, and the parent exits with the child's exit code.
|
|
73
72
|
|
|
74
73
|
### `export` — print env to stdout
|
|
75
74
|
|
|
@@ -121,6 +120,15 @@ These are the OS-level vars `fetchEnv` / `parseEnv` read and `toEntries` (so `ne
|
|
|
121
120
|
| --- | --- |
|
|
122
121
|
| `NEON_DATA_API_URL` | Data API (PostgREST) integration URL |
|
|
123
122
|
|
|
123
|
+
**Realtime** (when `preview.realtime` is enabled). `fetchEnv` waits for asynchronous provisioning or secret rotation to finish before returning these values:
|
|
124
|
+
|
|
125
|
+
| Key | From |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `NEON_REALTIME_URL` | WebSocket endpoint passed to `createRealtimeClient` |
|
|
128
|
+
| `NEON_REALTIME_SECRET` | shared key passed to server-side `createRealtime`; never expose it to browser code |
|
|
129
|
+
|
|
130
|
+
Derive the database passed to `createRealtime` from `DATABASE_URL` so the two cannot drift out of sync.
|
|
131
|
+
|
|
124
132
|
**Object storage** (when `buckets` declares at least one bucket). Projected onto the AWS SDK's standard config vars so an S3 client works from env alone (set `forcePathStyle: true`):
|
|
125
133
|
|
|
126
134
|
| Key | From |
|
|
@@ -137,7 +145,9 @@ These are the OS-level vars `fetchEnv` / `parseEnv` read and `toEntries` (so `ne
|
|
|
137
145
|
| `NEON_AI_GATEWAY_TOKEN` | branch credential's API token (bearer) |
|
|
138
146
|
| `NEON_AI_GATEWAY_BASE_URL` | bare branch gateway host (`https://<branch>-api.ai.<region>.…`, no path) |
|
|
139
147
|
|
|
140
|
-
**Functions** (when `functions` declares at least one slug). Each declared slug
|
|
148
|
+
**Functions** (when `functions` declares at least one slug). Each declared slug maps to `NEON_FUNCTION_<SLUG>_BASE_URL`, read as `env.functions.<slug>.baseUrl: string`. These are the public function URLs, not the function's declared `env` secrets (those are uploaded at deploy). `fetchEnv` / `neon env pull` derive the URL from the branch connection host; the function does not have to be deployed. `neon dev` injects `http://localhost:<port>` instead.
|
|
149
|
+
|
|
150
|
+
The deployed Functions runtime does not inject these vars yet. Without a key filter, `parseEnv` therefore returns `functions` only when every declared slug's URL is set, and leaves it `undefined` otherwise. A value that is set must be a URL. Select the key to require it.
|
|
141
151
|
|
|
142
152
|
| Key | From |
|
|
143
153
|
| --- | --- |
|
|
@@ -145,7 +155,10 @@ These are the OS-level vars `fetchEnv` / `parseEnv` read and `toEntries` (so `ne
|
|
|
145
155
|
|
|
146
156
|
```ts
|
|
147
157
|
const env = parseEnv(config);
|
|
148
|
-
env.functions
|
|
158
|
+
env.functions?.hello.baseUrl; // string | undefined
|
|
159
|
+
|
|
160
|
+
const { functions: required } = parseEnv(config, ["NEON_FUNCTION_HELLO_BASE_URL"]);
|
|
161
|
+
required.hello.baseUrl; // string, throws when unset
|
|
149
162
|
|
|
150
163
|
const { functions } = await fetchEnv(config, { projectId, branch: "main" });
|
|
151
164
|
functions.hello.baseUrl; // string
|
package/dist/env.js
CHANGED
|
@@ -45,7 +45,7 @@ function defaultConnectionRole(roleNames) {
|
|
|
45
45
|
* Each top-level key here is a {@link NeonEnv} namespace; the inner record maps the
|
|
46
46
|
* camelCase property names exposed to TypeScript to the UPPER_SNAKE env-var names used
|
|
47
47
|
* by the OS. Keep this in sync with {@link postgresEnvSchema} / {@link authEnvSchema} /
|
|
48
|
-
* {@link dataApiEnvSchema}.
|
|
48
|
+
* {@link dataApiEnvSchema} / {@link realtimeEnvSchema}.
|
|
49
49
|
*/
|
|
50
50
|
/**
|
|
51
51
|
* Neon's default database, created with every project. When a branch has several databases
|
|
@@ -69,6 +69,10 @@ const NEON_ENV_VAR_KEYS = {
|
|
|
69
69
|
jwksUrl: "NEON_AUTH_JWKS_URL"
|
|
70
70
|
},
|
|
71
71
|
dataApi: { url: "NEON_DATA_API_URL" },
|
|
72
|
+
realtime: {
|
|
73
|
+
url: "NEON_REALTIME_URL",
|
|
74
|
+
secret: "NEON_REALTIME_SECRET"
|
|
75
|
+
},
|
|
72
76
|
/**
|
|
73
77
|
* Object storage (Preview). The S3 SDKs read `AWS_*` from their standard config chain, so
|
|
74
78
|
* a branch credential + `neon dev` / `env pull` makes object storage work from env alone.
|
|
@@ -134,6 +138,55 @@ function requiredValue(value, description) {
|
|
|
134
138
|
if (value === null) throw new Error(`fetchEnv: missing ${description}.`);
|
|
135
139
|
return value;
|
|
136
140
|
}
|
|
141
|
+
const REALTIME_POLL_INTERVAL_MS = 1e3;
|
|
142
|
+
/**
|
|
143
|
+
* Wait for asynchronous Realtime provisioning/rotation before reading its secret. The
|
|
144
|
+
* secret endpoint deliberately returns 404 until provisioning finishes, and during a
|
|
145
|
+
* rotation it can still expose the previous key while `pending` is true.
|
|
146
|
+
*/
|
|
147
|
+
async function resolveRealtimeEnv(args) {
|
|
148
|
+
const getRealtime = args.api.getProjectBranchRealtime;
|
|
149
|
+
if (!getRealtime) throw new PlatformError(ErrorCode.FeatureUnavailable, "fetchEnv cannot resolve Realtime: this NeonApi adapter does not implement getProjectBranchRealtime.");
|
|
150
|
+
const getSecret = args.api.getProjectBranchRealtimeSecret;
|
|
151
|
+
let resolvedEnv;
|
|
152
|
+
while (resolvedEnv === void 0) {
|
|
153
|
+
const snapshot = await getRealtime.call(args.api, args.projectId, args.branch.id);
|
|
154
|
+
if (!snapshot.pending) {
|
|
155
|
+
if (!snapshot.enabled) throw new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy enables realtime but Realtime is disabled on branch ${args.branch.name} (${args.branch.id}).`, "Enable it via `apply(config, { projectId, branchId })` (or `npx neon deploy`) and re-run fetchEnv. Or set realtime to false or omit it."].join(" "), { details: {
|
|
156
|
+
projectId: args.projectId,
|
|
157
|
+
branchId: args.branch.id
|
|
158
|
+
} });
|
|
159
|
+
let secret;
|
|
160
|
+
if (args.wantsSecret) {
|
|
161
|
+
if (!getSecret) throw new PlatformError(ErrorCode.FeatureUnavailable, "fetchEnv cannot resolve NEON_REALTIME_SECRET: this NeonApi adapter does not implement getProjectBranchRealtimeSecret.");
|
|
162
|
+
secret = await getSecret.call(args.api, args.projectId, args.branch.id);
|
|
163
|
+
}
|
|
164
|
+
if (!secret?.pending) resolvedEnv = {
|
|
165
|
+
...args.wantsUrl ? { url: realtimeWebSocketUrl(requiredRealtimeInvocationUrl(snapshot, args.branch)) } : {},
|
|
166
|
+
...secret ? { secret: secret.secret } : {}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (resolvedEnv === void 0) await new Promise((resolve) => setTimeout(resolve, REALTIME_POLL_INTERVAL_MS));
|
|
170
|
+
}
|
|
171
|
+
return resolvedEnv;
|
|
172
|
+
}
|
|
173
|
+
function requiredRealtimeInvocationUrl(snapshot, branch) {
|
|
174
|
+
if (snapshot.invocationUrl !== void 0 && snapshot.invocationUrl !== "") return snapshot.invocationUrl;
|
|
175
|
+
throw new PlatformError(ErrorCode.ServerError, `Realtime is enabled on branch ${branch.name} (${branch.id}), but the Neon API returned no invocation URL.`, { details: { branchId: branch.id } });
|
|
176
|
+
}
|
|
177
|
+
/** Normalize the control-plane invocation URL to the WebSocket URL the client SDK needs. */
|
|
178
|
+
function realtimeWebSocketUrl(value) {
|
|
179
|
+
let parsed;
|
|
180
|
+
try {
|
|
181
|
+
parsed = new URL(value);
|
|
182
|
+
} catch {
|
|
183
|
+
throw new PlatformError(ErrorCode.ServerError, `Realtime invocation URL is invalid: ${JSON.stringify(value)}.`);
|
|
184
|
+
}
|
|
185
|
+
if (parsed.protocol === "https:") parsed.protocol = "wss:";
|
|
186
|
+
else if (parsed.protocol === "http:") parsed.protocol = "ws:";
|
|
187
|
+
else if (parsed.protocol !== "wss:" && parsed.protocol !== "ws:") throw new PlatformError(ErrorCode.ServerError, `Realtime invocation URL must use http(s) or ws(s): ${JSON.stringify(value)}.`);
|
|
188
|
+
return parsed.toString();
|
|
189
|
+
}
|
|
137
190
|
/**
|
|
138
191
|
* The {@link fetchEnv} body, with the key selection as a plain argument and no generic
|
|
139
192
|
* narrowing. Exists for callers that compute the selection at runtime — notably
|
|
@@ -163,6 +216,7 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
163
216
|
const wantsUnpooled = wants(K.postgres.databaseUrlUnpooled);
|
|
164
217
|
const wantsAuth = desired.authEnabled && (wants(K.auth.baseUrl) || wants(K.auth.jwksUrl));
|
|
165
218
|
const wantsDataApi = desired.dataApiEnabled && wants(K.dataApi.url);
|
|
219
|
+
const wantsRealtime = desired.realtimePolicy === "enabled" && (wants(K.realtime.url) || wants(K.realtime.secret));
|
|
166
220
|
const gatewayEnabled = desired.preview?.aiGatewayEnabled ?? false;
|
|
167
221
|
const functionUrlMode = options.functionUrls ?? "policy";
|
|
168
222
|
const declaredSlugs = (desired.preview?.functions ?? []).map((fn) => fn.slug);
|
|
@@ -229,6 +283,19 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
229
283
|
}
|
|
230
284
|
result.dataApi = { url: dataApiSnapshot.url };
|
|
231
285
|
}
|
|
286
|
+
if (wantsRealtime) {
|
|
287
|
+
const realtime = await resolveRealtimeEnv({
|
|
288
|
+
api,
|
|
289
|
+
projectId,
|
|
290
|
+
branch,
|
|
291
|
+
wantsUrl: wants(K.realtime.url),
|
|
292
|
+
wantsSecret: wants(K.realtime.secret)
|
|
293
|
+
});
|
|
294
|
+
const realtimeEnv = {};
|
|
295
|
+
if (wants(K.realtime.url)) realtimeEnv.url = requiredValue(realtime.url, "WebSocket URL for enabled Realtime");
|
|
296
|
+
if (wants(K.realtime.secret)) realtimeEnv.secret = requiredValue(realtime.secret, "shared secret for enabled Realtime");
|
|
297
|
+
result.realtime = realtimeEnv;
|
|
298
|
+
}
|
|
232
299
|
const wantsGateway = gatewayEnabled && (wants(K.aiGateway.apiKey) || wants(K.aiGateway.baseUrl));
|
|
233
300
|
const wantsStorageCredential = storageEnabled && (wants(K.storage.accessKeyId) || wants(K.storage.secretAccessKey));
|
|
234
301
|
const wantsGatewayCredential = gatewayEnabled && wants(K.aiGateway.apiKey);
|
|
@@ -393,6 +460,7 @@ function policyEnvKeys(desired) {
|
|
|
393
460
|
K.branch.name,
|
|
394
461
|
...desired.authEnabled ? [K.auth.baseUrl, K.auth.jwksUrl] : [],
|
|
395
462
|
...desired.dataApiEnabled ? [K.dataApi.url] : [],
|
|
463
|
+
...desired.realtimePolicy === "enabled" ? [K.realtime.url, K.realtime.secret] : [],
|
|
396
464
|
...(desired.preview?.buckets.length ?? 0) > 0 ? [
|
|
397
465
|
K.storage.accessKeyId,
|
|
398
466
|
K.storage.secretAccessKey,
|
|
@@ -605,6 +673,8 @@ function toEntries(env) {
|
|
|
605
673
|
put(K.auth.baseUrl, env.auth?.baseUrl);
|
|
606
674
|
put(K.auth.jwksUrl, env.auth?.jwksUrl);
|
|
607
675
|
put(K.dataApi.url, env.dataApi?.url);
|
|
676
|
+
put(K.realtime.url, env.realtime?.url);
|
|
677
|
+
put(K.realtime.secret, env.realtime?.secret);
|
|
608
678
|
put(K.storage.accessKeyId, env.storage?.accessKeyId);
|
|
609
679
|
put(K.storage.secretAccessKey, env.storage?.secretAccessKey);
|
|
610
680
|
put(K.storage.endpoint, env.storage?.endpoint);
|
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","names":[],"sources":["../../../internals/env-core/dist/roles.js","../../../internals/env-core/dist/env.js"],"sourcesContent":["//#region src/roles.ts\n/**\n* Neon's default branch owner role, created with every project. This is the role a\n* `DATABASE_URL` should connect as.\n*/\nconst NEON_DEFAULT_OWNER_ROLE = \"neondb_owner\";\n/**\n* Roles Neon provisions for the Auth / Data API (PostgREST) stack. They exist to back\n* RLS-scoped Data API requests authenticated by JWT — never to hold a `DATABASE_URL` —\n* so they're skipped when auto-picking the connection role. Enabling Neon Auth or the\n* Data API (`neon config apply`) adds these next to the owner role, which is why a plain\n* branch routinely reports more than one role.\n*/\nconst NEON_MANAGED_AUTH_ROLES = /* @__PURE__ */ new Set([\n\t\"authenticator\",\n\t\"anonymous\",\n\t\"authenticated\"\n]);\n/** `undefined` when more than one app role remains (or none exist), so the caller has to ask. */\nfunction defaultConnectionRole(roleNames) {\n\tif (roleNames.length === 1) return roleNames[0];\n\tif (roleNames.includes(\"neondb_owner\")) return NEON_DEFAULT_OWNER_ROLE;\n\tconst appRoles = roleNames.filter((name) => !NEON_MANAGED_AUTH_ROLES.has(name));\n\treturn appRoles.length === 1 ? appRoles[0] : void 0;\n}\n//#endregion\nexport { NEON_DEFAULT_OWNER_ROLE, defaultConnectionRole };\n\n//# sourceMappingURL=roles.js.map","import { NEON_DEFAULT_OWNER_ROLE, defaultConnectionRole } from \"./roles.js\";\nimport { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialScopes, isPlatformError, resolveConfig } from \"@neon/config/v1\";\n//#region src/env.ts\n/**\n* The Neon env core — resolving a branch's env from the Neon API, and projecting it into\n* OS-level `{ KEY: value }` pairs.\n*\n* Private, and bundled into both consumers: `@neon/env` publishes it as `fetchEnv` /\n* `toEntries`, and the `neon` CLI needs the credential-reuse half in `reuse-secrets.ts`.\n* See `README.md` for why it is not published.\n*\n* The counterpart that reads `process.env` — `parseEnv` and its zod schemas — is not here. It\n* has no consumer outside `@neon/env`, so it stays in that package and imports this.\n*/\n/**\n* Mapping between the {@link NeonEnv} property paths and the OS-level env-var keys used\n* for cross-process transport (via `.env` files, `env run -- <cmd>`, or anything else\n* that talks to `process.env`).\n*\n* Each top-level key here is a {@link NeonEnv} namespace; the inner record maps the\n* camelCase property names exposed to TypeScript to the UPPER_SNAKE env-var names used\n* by the OS. Keep this in sync with {@link postgresEnvSchema} / {@link authEnvSchema} /\n* {@link dataApiEnvSchema}.\n*/\n/**\n* Neon's default database, created with every project. When a branch has several databases\n* and none was requested, this is preferred for the `DATABASE_URL` so the common case (a\n* user added a second database next to `neondb`) auto-picks without asking.\n*/\nconst NEON_DEFAULT_DATABASE = \"neondb\";\nconst NEON_ENV_VAR_KEYS = {\n\t/**\n\t* Branch identity. `NEON_BRANCH` carries the branch **name** and is injected into the\n\t* Neon Functions runtime on every branch (including the default) by default. `env pull` /\n\t* `neon dev` / `neon-env run` emit it too so local dev mirrors the deployed runtime.\n\t*/\n\tbranch: { name: \"NEON_BRANCH\" },\n\tpostgres: {\n\t\tdatabaseUrl: \"DATABASE_URL\",\n\t\tdatabaseUrlUnpooled: \"DATABASE_URL_UNPOOLED\"\n\t},\n\tauth: {\n\t\tbaseUrl: \"NEON_AUTH_BASE_URL\",\n\t\tjwksUrl: \"NEON_AUTH_JWKS_URL\"\n\t},\n\tdataApi: { url: \"NEON_DATA_API_URL\" },\n\t/**\n\t* Object storage (Preview). The S3 SDKs read `AWS_*` from their standard config chain, so\n\t* a branch credential + `neon dev` / `env pull` makes object storage work from env alone.\n\t* `region` is injected under the SDK-standard `AWS_REGION`.\n\t*/\n\tstorage: {\n\t\taccessKeyId: \"AWS_ACCESS_KEY_ID\",\n\t\tsecretAccessKey: \"AWS_SECRET_ACCESS_KEY\",\n\t\tendpoint: \"AWS_ENDPOINT_URL_S3\",\n\t\tregion: \"AWS_REGION\"\n\t},\n\t/**\n\t* AI Gateway (Preview). Exposed under the Neon-branded env vars the deployed Functions\n\t* runtime injects: `apiKey` is the minted credential's bearer (`NEON_AI_GATEWAY_TOKEN`)\n\t* and `baseUrl` is the bare branch gateway host (`NEON_AI_GATEWAY_BASE_URL`,\n\t* `scheme://host`, no path). Clients like `@neon/ai-sdk-provider` read these and append the\n\t* dialect route (`/v1`, `/openai/v1`, `/anthropic/v1`) themselves (https://github.com/vercel/ai/pull/15997).\n\t*/\n\taiGateway: {\n\t\tapiKey: \"NEON_AI_GATEWAY_TOKEN\",\n\t\tbaseUrl: \"NEON_AI_GATEWAY_BASE_URL\"\n\t}\n};\nconst FUNCTION_SLUG = /^[a-z0-9]{1,20}$/;\nconst FUNCTION_BASE_URL_KEY = /^NEON_FUNCTION_([A-Z0-9]{1,20})_BASE_URL$/;\nfunction functionBaseUrlKey(slug) {\n\tif (!FUNCTION_SLUG.test(slug)) throw new Error(`functionBaseUrlKey: ${JSON.stringify(slug)} is not a function slug ([a-z0-9]{1,20}).`);\n\treturn `NEON_FUNCTION_${slug.toUpperCase()}_BASE_URL`;\n}\nfunction parseFunctionBaseUrlKey(key) {\n\tconst match = FUNCTION_BASE_URL_KEY.exec(key);\n\treturn match ? match[1].toLowerCase() : null;\n}\nfunction isFunctionBaseUrlKey(key) {\n\treturn parseFunctionBaseUrlKey(key) !== null;\n}\nasync function fetchEnv(config, options) {\n\tif (options.keys) assertStorageCredentialKeyPair(options.keys);\n\treturn fetchEnvKeys(config, options, options.keys ?? null);\n}\nfunction assertStorageCredentialKeyPair(keys) {\n\tif (keys.includes(NEON_ENV_VAR_KEYS.storage.accessKeyId) === keys.includes(NEON_ENV_VAR_KEYS.storage.secretAccessKey)) return;\n\tthrow new TypeError(\"fetchEnv: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be selected together. Pass both in `keys`, or omit both.\");\n}\n/**\n* Starts a read now and keeps an unread rejection from crashing the process; the caller\n* awaits it (and sees the error) when its turn comes. The read is called synchronously and\n* its own promise returned, so errors surface in the same order as a direct call; a\n* synchronous throw becomes the returned rejection.\n*/\nfunction started(read) {\n\tlet promise;\n\ttry {\n\t\tpromise = read();\n\t} catch (error) {\n\t\tpromise = Promise.reject(error);\n\t}\n\tpromise.catch(() => void 0);\n\treturn promise;\n}\n/** Fail loudly when selected-key dependency planning and execution disagree. */\nfunction requiredValue(value, description) {\n\tif (value === null) throw new Error(`fetchEnv: missing ${description}.`);\n\treturn value;\n}\n/**\n* The {@link fetchEnv} body, with the key selection as a plain argument and no generic\n* narrowing. Exists for callers that compute the selection at runtime — notably\n* {@link fetchEnvReusingSecrets}, which decides which keys it still needs by checking the\n* branch — since the public overload's `keys` is bound to a literal union those callers cannot\n* produce without asserting.\n*\n* `keys === null` selects everything the policy enables.\n*/\nasync function fetchEnvKeys(config, options, keys) {\n\treturn (await fetchEnvKeysState(config, options, keys)).env;\n}\n/**\n* `policy` is the {@link resolveBranchPolicy} result for this same `config` and branch, when\n* the caller already has it.\n*/\nasync function fetchEnvKeysState(config, options, keys, policy) {\n\tconst api = options.api ?? createApiFromOptions(options);\n\tconst projectId = options.projectId;\n\tconst { branch, desired } = policy ?? await resolveBranchPolicy(config, options, api);\n\tconst selection = keys ? new Set(keys) : null;\n\tconst omitted = new Set(options.omitKeys ?? []);\n\tconst wants = (key) => !omitted.has(key) && (selection === null || selection.has(key));\n\tconst result = {};\n\tconst K = NEON_ENV_VAR_KEYS;\n\tconst wantsPooled = wants(K.postgres.databaseUrl);\n\tconst wantsUnpooled = wants(K.postgres.databaseUrlUnpooled);\n\tconst wantsAuth = desired.authEnabled && (wants(K.auth.baseUrl) || wants(K.auth.jwksUrl));\n\tconst wantsDataApi = desired.dataApiEnabled && wants(K.dataApi.url);\n\tconst gatewayEnabled = desired.preview?.aiGatewayEnabled ?? false;\n\tconst functionUrlMode = options.functionUrls ?? \"policy\";\n\tconst declaredSlugs = (desired.preview?.functions ?? []).map((fn) => fn.slug);\n\tconst selectedFunctionKeys = selection === null ? [] : [...selection].filter(isFunctionBaseUrlKey);\n\tconst constructSlugs = functionUrlSlugsToConstruct({\n\t\tfunctionUrlMode,\n\t\tselection,\n\t\tdeclaredSlugs,\n\t\tselectedFunctionKeys,\n\t\twants\n\t});\n\tconst wantsAnyFunctionUrl = selection === null || selectedFunctionKeys.length > 0;\n\tconst storageEnabled = (desired.preview?.buckets.length ?? 0) > 0;\n\tconst wantsStorage = storageEnabled && (wants(K.storage.accessKeyId) || wants(K.storage.secretAccessKey) || wants(K.storage.endpoint) || wants(K.storage.region));\n\tconst functionsRead = functionUrlMode === \"all-live\" && wantsAnyFunctionUrl && options.listedFunctions === void 0 ? listFunctionInvocationUrls(api, projectId, branch.id) : null;\n\tfunctionsRead?.catch(() => void 0);\n\tconst storageRead = wantsStorage ? started(() => api.getProjectBranchStorage(projectId, branch.id)) : null;\n\tconst needsUnpooled = wantsUnpooled || gatewayEnabled && wants(K.aiGateway.baseUrl) || constructSlugs.length > 0;\n\tconst needsConnectionTarget = wantsPooled || needsUnpooled;\n\tconst needsDatabase = needsConnectionTarget || wantsDataApi;\n\tconst [roles, databases] = await Promise.all([needsConnectionTarget ? api.listBranchRoles(projectId, branch.id) : Promise.resolve([]), needsDatabase ? api.listBranchDatabases(projectId, branch.id) : Promise.resolve([])]);\n\tconst databaseName = needsDatabase ? pickDatabaseName(databases, branch, options.databaseName) : null;\n\tconst connectionTarget = needsConnectionTarget ? {\n\t\troleName: pickRoleName(roles, branch, options.roleName),\n\t\tdatabaseName: requiredValue(databaseName, \"database for a selected connection URI\")\n\t} : null;\n\tconst getConnectionUri = (pooled) => {\n\t\tconst target = requiredValue(connectionTarget, \"role and database for a selected connection URI\");\n\t\treturn api.getConnectionUri(projectId, {\n\t\t\tbranchId: branch.id,\n\t\t\t...target,\n\t\t\tpooled\n\t\t});\n\t};\n\tconst [pooled, unpooled, authSnapshot, dataApiSnapshot] = await Promise.all([\n\t\twantsPooled ? getConnectionUri(true) : Promise.resolve(null),\n\t\tneedsUnpooled ? getConnectionUri(false) : Promise.resolve(null),\n\t\twantsAuth ? api.getNeonAuth(projectId, branch.id) : Promise.resolve(null),\n\t\twantsDataApi ? api.getNeonDataApi(projectId, branch.id, requiredValue(databaseName, \"database for the selected Data API URL\")) : Promise.resolve(null)\n\t]);\n\tconst postgres = {};\n\tif (wantsPooled) postgres.databaseUrl = requiredValue(pooled, \"pooled connection URI response\").uri;\n\tif (wantsUnpooled) postgres.databaseUrlUnpooled = requiredValue(unpooled, \"direct connection URI response\").uri;\n\tif (Object.keys(postgres).length > 0) result.postgres = postgres;\n\tif (wants(K.branch.name)) result.branch = { name: branch.name };\n\tif (wantsAuth) {\n\t\tif (!authSnapshot) throw new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy enables auth but no Neon Auth integration is enabled on branch ${branch.name} (${branch.id}).`, \"Enable it via `apply(config, { projectId, branchId })` (or `npx neon …`), in the Neon Console — then re-run fetchEnv. Or return auth.enabled=false.\"].join(\" \"), { details: {\n\t\t\tprojectId,\n\t\t\tbranchId: branch.id\n\t\t} });\n\t\tconst auth = {};\n\t\tif (wants(K.auth.baseUrl)) auth.baseUrl = authSnapshot.baseUrl ?? \"\";\n\t\tif (wants(K.auth.jwksUrl)) auth.jwksUrl = authSnapshot.jwksUrl ?? \"\";\n\t\tresult.auth = auth;\n\t}\n\tif (wantsDataApi) {\n\t\tif (!dataApiSnapshot) {\n\t\t\tconst selectedDatabase = requiredValue(databaseName, \"database for the selected Data API URL\");\n\t\t\tthrow new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy enables dataApi but no Data API integration is enabled on branch ${branch.name} (${branch.id}) database ${selectedDatabase}.`, \"Enable it via `apply(config, { projectId, branchId })` or in the Neon Console — then re-run fetchEnv. Or return dataApi.enabled=false.\"].join(\" \"), { details: {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId: branch.id,\n\t\t\t\tdatabaseName: selectedDatabase\n\t\t\t} });\n\t\t}\n\t\tresult.dataApi = { url: dataApiSnapshot.url };\n\t}\n\tconst wantsGateway = gatewayEnabled && (wants(K.aiGateway.apiKey) || wants(K.aiGateway.baseUrl));\n\tconst wantsStorageCredential = storageEnabled && (wants(K.storage.accessKeyId) || wants(K.storage.secretAccessKey));\n\tconst wantsGatewayCredential = gatewayEnabled && wants(K.aiGateway.apiKey);\n\tconst wantsCredential = wantsStorageCredential || wantsGatewayCredential;\n\tif (wantsStorage || wantsGateway) {\n\t\tlet storage = null;\n\t\tif (wantsStorage) {\n\t\t\tstorage = await requiredValue(storageRead, \"storage read\");\n\t\t\tif (!storage) throw new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy declares object storage (buckets) but storage is not enabled on branch ${branch.name} (${branch.id}).`, \"Enable it via `apply(config, { projectId, branchId })` (or in the Neon Console) — then re-run fetchEnv. Or remove buckets.\"].join(\" \"), { details: {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId: branch.id\n\t\t\t} });\n\t\t}\n\t\tconst secrets = wantsCredential ? await resolveBranchCredentialSecrets({\n\t\t\tapi,\n\t\t\tprojectId,\n\t\t\tbranchId: branch.id,\n\t\t\tbranchName: branch.name,\n\t\t\tscopes: previewCredentialScopes(desired.preview, {\n\t\t\t\tstorage: wantsStorageCredential,\n\t\t\t\taiGateway: wantsGatewayCredential\n\t\t\t})\n\t\t}) : null;\n\t\tif (storage) {\n\t\t\tconst storageEnv = {};\n\t\t\tif (secrets && wants(K.storage.accessKeyId)) storageEnv.accessKeyId = secrets.accessKeyId;\n\t\t\tif (secrets && wants(K.storage.secretAccessKey)) storageEnv.secretAccessKey = secrets.secretAccessKey;\n\t\t\tif (wants(K.storage.endpoint)) storageEnv.endpoint = storage.s3Endpoint;\n\t\t\tif (wants(K.storage.region)) storageEnv.region = storage.region;\n\t\t\tresult.storage = storageEnv;\n\t\t}\n\t\tif (wantsGateway) {\n\t\t\tconst gateway = {};\n\t\t\tif (secrets && wants(K.aiGateway.apiKey)) gateway.apiKey = secrets.apiToken;\n\t\t\tif (wants(K.aiGateway.baseUrl)) gateway.baseUrl = aiGatewayBaseUrl(branch.id, requiredValue(unpooled, \"direct connection URI for the selected AI Gateway base URL\").uri);\n\t\t\tresult.aiGateway = gateway;\n\t\t}\n\t}\n\tconst functions = {};\n\tlet functionUrlsUnavailable = false;\n\tif (functionUrlMode === \"all-live\" && wantsAnyFunctionUrl) {\n\t\tconst listed = options.listedFunctions === void 0 ? await requiredValue(functionsRead, \"function listing\") : listedFromSnapshots(options.listedFunctions);\n\t\tif (listed.status === \"unavailable\") {\n\t\t\tif (selection === null) functionUrlsUnavailable = true;\n\t\t} else for (const fn of listed.functions) {\n\t\t\tif (!wants(functionBaseUrlKey(fn.slug))) continue;\n\t\t\tfunctions[fn.slug] = { baseUrl: asEnvBaseUrl(fn.invocationUrl) };\n\t\t}\n\t}\n\tconst missingConstructSlugs = constructSlugs.filter((slug) => functions[slug] === void 0);\n\tif (missingConstructSlugs.length > 0) {\n\t\tconst uri = requiredValue(unpooled, \"direct connection URI for function invocation URLs\").uri;\n\t\tfor (const slug of missingConstructSlugs) functions[slug] = { baseUrl: functionInvocationUrl(branch.id, slug, uri) };\n\t}\n\tassertSelectedFunctionUrls(selectedFunctionKeys, functions);\n\tif (Object.keys(functions).length > 0) result.functions = functions;\n\treturn {\n\t\tenv: result,\n\t\tfunctionUrlsUnavailable\n\t};\n}\nfunction functionUrlSlugsToConstruct(args) {\n\tconst slugs = [];\n\tif (args.functionUrlMode === \"policy\" && args.selection === null) {\n\t\tfor (const slug of args.declaredSlugs) if (args.wants(functionBaseUrlKey(slug))) slugs.push(slug);\n\t\treturn slugs;\n\t}\n\tfor (const key of args.selectedFunctionKeys) {\n\t\tconst slug = parseFunctionBaseUrlKey(key);\n\t\tif (slug !== null) slugs.push(slug);\n\t}\n\treturn slugs;\n}\nfunction listedFromSnapshots(snapshots) {\n\treturn {\n\t\tstatus: \"ok\",\n\t\tfunctions: snapshots.filter((fn) => fn.invocationUrl !== \"\").map((fn) => ({\n\t\t\tslug: fn.slug,\n\t\t\tinvocationUrl: fn.invocationUrl\n\t\t})).sort((left, right) => left.slug.localeCompare(right.slug))\n\t};\n}\nfunction assertSelectedFunctionUrls(keys, functions) {\n\tfor (const key of keys) {\n\t\tconst slug = parseFunctionBaseUrlKey(key);\n\t\tif (slug === null || functions[slug] === void 0) throw new Error(`fetchEnv: missing ${key}.`);\n\t}\n}\nasync function listFunctionInvocationUrls(api, projectId, branchId) {\n\ttry {\n\t\treturn listedFromSnapshots(await api.listBranchFunctions(projectId, branchId));\n\t} catch (error) {\n\t\tif (isPlatformError(error) && error.code === ErrorCode.FeatureUnavailable) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\terror\n\t\t};\n\t\tthrow error;\n\t}\n}\n/**\n* Resolve the target branch and evaluate the policy against it — the first thing any\n* branch-scoped operation needs. Shared by {@link fetchEnv} and {@link fetchEnvReusingSecrets}\n* so the two agree on which branch they're talking about and what it has enabled.\n*/\nasync function resolveBranchPolicy(config, options, api, resolved) {\n\tconst branch = resolved ?? await listAndResolveBranch(options, api);\n\treturn {\n\t\tbranch,\n\t\tdesired: resolveConfig(config, {\n\t\t\tname: branch.name,\n\t\t\tid: branch.id,\n\t\t\texists: true,\n\t\t\t...branch.parentId ? { parentId: branch.parentId } : {},\n\t\t\tisDefault: branch.isDefault,\n\t\t\tisProtected: branch.protected,\n\t\t\t...branch.expiresAt ? { expiresAt: branch.expiresAt } : {}\n\t\t})\n\t};\n}\nasync function listAndResolveBranch(options, api) {\n\tconst projectId = options.projectId;\n\tconst branches = await api.listBranches(projectId);\n\tif (branches.length === 0) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: project ${projectId} has no branches.`, \"Deploy your neon.ts policy (or create a branch) first, or pick a different project id.\"].join(\" \"), { details: { projectId } });\n\tconst branchRef = options.branch ?? options.branchId;\n\tif (!branchRef) throw new PlatformError(ErrorCode.BranchNotFound, [\"fetchEnv: no branch provided.\", \"Pass `branch` with a branch name (e.g. `main`) or id (`br-…`).\"].join(\" \"), { details: { projectId } });\n\treturn resolveBranch(branchRef, branches);\n}\n/**\n* Scopes a minted fallback credential should carry. Only object storage and the AI Gateway\n* *require* secrets; functions never force a credential. `functions:invoke` rides along only\n* when this path still has to mint (defaults already cover storage and the gateway).\n*/\nfunction previewCredentialScopes(preview, selected) {\n\tif (!preview) return [];\n\tconst storage = preview.buckets.length > 0 && (selected?.storage ?? true);\n\tconst aiGateway = preview.aiGatewayEnabled && (selected?.aiGateway ?? true);\n\tif (!storage && !aiGateway) return [];\n\treturn deriveCredentialScopes({\n\t\tstorage,\n\t\taiGateway,\n\t\tfunctions: preview.functions.length > 0\n\t});\n}\n/** The `name` this tool stamps on every credential it mints, so it can recognize its own. */\nfunction credentialName(branchName) {\n\treturn `neon-env ${branchName}`;\n}\n/** The env-var keys a branch credential's secrets surface under, in emit order. */\nfunction credentialEnvKeys(flags) {\n\treturn [...flags.storage ? [NEON_ENV_VAR_KEYS.storage.accessKeyId, NEON_ENV_VAR_KEYS.storage.secretAccessKey] : [], ...flags.aiGateway ? [NEON_ENV_VAR_KEYS.aiGateway.apiKey] : []];\n}\n/**\n* Every OS-level env var a resolved branch policy produces, in emit order. Lets a caller\n* subtract the ones it already holds and pass the rest as {@link fetchEnv}'s `keys`, without\n* re-deriving which vars a policy implies.\n*/\nfunction policyEnvKeys(desired) {\n\tconst K = NEON_ENV_VAR_KEYS;\n\treturn [\n\t\tK.postgres.databaseUrl,\n\t\tK.postgres.databaseUrlUnpooled,\n\t\tK.branch.name,\n\t\t...desired.authEnabled ? [K.auth.baseUrl, K.auth.jwksUrl] : [],\n\t\t...desired.dataApiEnabled ? [K.dataApi.url] : [],\n\t\t...(desired.preview?.buckets.length ?? 0) > 0 ? [\n\t\t\tK.storage.accessKeyId,\n\t\t\tK.storage.secretAccessKey,\n\t\t\tK.storage.endpoint,\n\t\t\tK.storage.region\n\t\t] : [],\n\t\t...desired.preview?.aiGatewayEnabled ? [K.aiGateway.apiKey, K.aiGateway.baseUrl] : []\n\t];\n}\n/** Exact `name` values the credentials list endpoint returns for the platform defaults. */\nconst DEFAULT_AI_GATEWAY_CREDENTIAL_NAME = \"Default AI gateway credential\";\nconst DEFAULT_OBJECT_STORAGE_CREDENTIAL_NAME = \"Default object storage credential\";\n/** Whether an issued credential can still be used: not revoked, not past its expiry. */\nfunction isLiveCredential(meta, now) {\n\tif (meta.revokedAt !== void 0) return false;\n\tif (meta.expiresAt === void 0) return true;\n\tconst expiresAt = Date.parse(meta.expiresAt);\n\treturn Number.isNaN(expiresAt) || expiresAt > now;\n}\nfunction defaultStorageCredential(live, now) {\n\treturn live.find((meta) => meta.name === DEFAULT_OBJECT_STORAGE_CREDENTIAL_NAME && isLiveCredential(meta, now)) ?? null;\n}\nfunction defaultAiGatewayCredential(live, now) {\n\treturn live.find((meta) => meta.name === DEFAULT_AI_GATEWAY_CREDENTIAL_NAME && isLiveCredential(meta, now)) ?? null;\n}\n/**\n* Resolve secrets for object storage / the AI Gateway.\n*\n* Regions that expose those products already have platform defaults on every branch.\n* Reveal those by exact name instead of minting a combined `neon-env ${branch}` credential.\n* Mint only the half (or both) that has no default — regions without the credentials\n* endpoint still fail at list, same as before.\n*\n* A caller that already holds secrets for those defaults should leave the secret keys out\n* of `keys` (see {@link fetchEnvReusingSecrets}) instead of revealing them again.\n*/\nasync function resolveBranchCredentialSecrets(args) {\n\tconst needsStorage = args.scopes.includes(\"storage:read\") || args.scopes.includes(\"storage:write\");\n\tconst needsGateway = args.scopes.includes(\"ai_gateway:invoke\");\n\tconst live = await args.api.listCredentials(args.projectId, args.branchId);\n\tconst now = Date.now();\n\tconst storageDefault = defaultStorageCredential(live, now);\n\tconst gatewayDefault = defaultAiGatewayCredential(live, now);\n\tconst secrets = {\n\t\taccessKeyId: \"\",\n\t\tsecretAccessKey: \"\",\n\t\tapiToken: \"\"\n\t};\n\tconst storageReveal = needsStorage && storageDefault ? started(() => args.api.revealCredential(args.projectId, args.branchId, storageDefault.tokenId)) : null;\n\tconst gatewayReveal = needsGateway && gatewayDefault ? started(() => args.api.revealCredential(args.projectId, args.branchId, gatewayDefault.tokenId)) : null;\n\tif (storageReveal) {\n\t\tconst revealed = await storageReveal;\n\t\tsecrets.accessKeyId = revealed.tokenId;\n\t\tsecrets.secretAccessKey = revealed.s3SecretAccessKey;\n\t}\n\tif (gatewayReveal) secrets.apiToken = (await gatewayReveal).apiToken;\n\tconst missingStorage = needsStorage && storageDefault === null;\n\tconst missingGateway = needsGateway && gatewayDefault === null;\n\tif (missingStorage || missingGateway) {\n\t\tconst minted = await mintBranchCredential({\n\t\t\t...args,\n\t\t\tscopes: deriveCredentialScopes({\n\t\t\t\tstorage: missingStorage,\n\t\t\t\taiGateway: missingGateway,\n\t\t\t\tfunctions: args.scopes.includes(\"functions:invoke\")\n\t\t\t})\n\t\t});\n\t\tif (missingStorage) {\n\t\t\tsecrets.accessKeyId = minted.accessKeyId;\n\t\t\tsecrets.secretAccessKey = minted.secretAccessKey;\n\t\t}\n\t\tif (missingGateway) secrets.apiToken = minted.apiToken;\n\t}\n\treturn secrets;\n}\nasync function mintBranchCredential(args) {\n\tconst minted = await args.api.createCredential(args.projectId, args.branchId, {\n\t\tscopes: args.scopes,\n\t\tprincipalType: \"user\",\n\t\tname: credentialName(args.branchName)\n\t});\n\treturn {\n\t\taccessKeyId: minted.tokenId,\n\t\tsecretAccessKey: minted.s3SecretAccessKey,\n\t\tapiToken: minted.apiToken\n\t};\n}\n/**\n* The AI Gateway is a **branch-scoped host** — `<branchId>-api.ai.<host-suffix>` — NOT the\n* control-plane API origin. Derive the suffix from the branch's own Postgres connection host\n* by dropping only the endpoint label (the first segment) and keeping everything after it,\n* including any infra cell prefix (`c-N.`): a connection host of\n* `ep-x.c-3.us-east-2.aws.neon.tech` yields the gateway host\n* `<branchId>-api.ai.c-3.us-east-2.aws.neon.tech`. The cell prefix is **load-bearing** —\n* the gateway is cell-routed, so dropping `c-N.` resolves to the wrong (or no) host.\n*\n* Function invocation URLs use the same suffix: `<branchId>-<slug>.compute.<suffix>`.\n*/\nfunction connectionHostSuffix(connectionUri) {\n\tlet connectionHost = \"\";\n\ttry {\n\t\tconnectionHost = new URL(connectionUri).hostname;\n\t} catch {\n\t\tconnectionHost = \"\";\n\t}\n\treturn connectionHost.split(\".\").slice(1).join(\".\");\n}\nfunction aiGatewayHost(branchId, connectionUri) {\n\treturn `${branchId}-api.ai.${connectionHostSuffix(connectionUri)}`;\n}\n/**\n* The API's `invocation_url` ends with `/` so paths concatenate onto it. Neon `*_BASE_URL`\n* vars are origin-only (`NEON_AUTH_BASE_URL`, `NEON_AI_GATEWAY_BASE_URL`).\n*/\nfunction asEnvBaseUrl(url) {\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(url);\n\t} catch {\n\t\tthrow new Error(`fetchEnv: function invocation URL is not a URL: ${JSON.stringify(url)}`);\n\t}\n\tif (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") throw new Error(`fetchEnv: function invocation URL must be http(s): ${JSON.stringify(url)}`);\n\treturn parsed.origin;\n}\n/** Derived from the connection URI so undeployed functions have a cell-routed URL. */\nfunction functionInvocationUrl(branchId, slug, connectionUri) {\n\tconst suffix = connectionHostSuffix(connectionUri);\n\tif (suffix === \"\") throw new Error(`fetchEnv: cannot derive the invocation URL for function \"${slug}\": the direct connection URI has no host suffix.`);\n\treturn `https://${branchId}-${slug}.compute.${suffix}`;\n}\n/** The AI Gateway's bare base URL (`NEON_AI_GATEWAY_BASE_URL`) on the branch gateway host. */\nfunction aiGatewayBaseUrl(branchId, connectionUri) {\n\treturn `https://${aiGatewayHost(branchId, connectionUri)}`;\n}\nfunction createApiFromOptions(options) {\n\treturn createNeonApiFromOptions(\"fetchEnv\", {\n\t\t...options.apiKey ? { apiKey: options.apiKey } : {},\n\t\t...options.apiHost ? { apiHost: options.apiHost } : {}\n\t});\n}\n/**\n* Resolve a branch ref — a name or an id — to a concrete branch. Matches by id first\n* (exact `br-…`), then by name; both are unique within a project, so the lookup is\n* unambiguous. This lets `.neon` files written by `neonctl` (which pin the branch *name*)\n* and explicit `br-…` ids both work.\n*/\nfunction resolveBranch(branch, branches) {\n\tconst match = branches.find((b) => b.id === branch) ?? branches.find((b) => b.name === branch);\n\tif (match) return match;\n\tthrow new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: branch ${JSON.stringify(branch)} not found on project (matched by id or name).`, `Existing branches: ${branches.map((b) => `${b.name} (${b.id})`).join(\", \")}.`].join(\" \"), { details: {\n\t\tbranch,\n\t\tavailable: branches.map((b) => `${b.name} (${b.id})`)\n\t} });\n}\nfunction pickRoleName(roles, branch, requested) {\n\tif (requested) {\n\t\tif (!roles.some((r) => r.name === requested)) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: role \"${requested}\" not found on branch ${branch.name} (${branch.id}).`, `Existing roles: ${roles.map((r) => r.name).join(\", \") || \"(none)\"}.`].join(\" \"), { details: {\n\t\t\tbranchId: branch.id,\n\t\t\troleName: requested,\n\t\t\tavailableRoles: roles.map((r) => r.name)\n\t\t} });\n\t\treturn requested;\n\t}\n\tif (roles.length === 0) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: branch ${branch.name} (${branch.id}) has no roles.`, \"Create one via the Neon console or pass `roleName` explicitly.\"].join(\" \"), { details: { branchId: branch.id } });\n\tconst picked = defaultConnectionRole(roles.map((r) => r.name));\n\tif (picked) return picked;\n\tthrow new PlatformError(ErrorCode.AmbiguousBranchAuth, [`fetchEnv: branch ${branch.name} (${branch.id}) has ${roles.length} roles and none is \"${NEON_DEFAULT_OWNER_ROLE}\"; cannot auto-pick.`, `Pass \\`roleName\\` explicitly. Available: ${roles.map((r) => r.name).join(\", \")}.`].join(\" \"), { details: {\n\t\tbranchId: branch.id,\n\t\tavailableRoles: roles.map((r) => r.name)\n\t} });\n}\nfunction pickDatabaseName(databases, branch, requested) {\n\tif (requested) {\n\t\tif (!databases.some((d) => d.name === requested)) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: database \"${requested}\" not found on branch ${branch.name} (${branch.id}).`, `Existing databases: ${databases.map((d) => d.name).join(\", \") || \"(none)\"}.`].join(\" \"), { details: {\n\t\t\tbranchId: branch.id,\n\t\t\tdatabaseName: requested,\n\t\t\tavailableDatabases: databases.map((d) => d.name)\n\t\t} });\n\t\treturn requested;\n\t}\n\tif (databases.length === 0) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: branch ${branch.name} (${branch.id}) has no databases.`, \"Create one via the Neon console or pass `databaseName` explicitly.\"].join(\" \"), { details: { branchId: branch.id } });\n\tconst neondb = databases.find((d) => d.name === NEON_DEFAULT_DATABASE);\n\tif (neondb) return neondb.name;\n\tif (databases.length === 1) return databases[0].name;\n\tthrow new PlatformError(ErrorCode.AmbiguousBranchAuth, [`fetchEnv: branch ${branch.name} (${branch.id}) has ${databases.length} databases and none is named \"${NEON_DEFAULT_DATABASE}\"; cannot auto-pick.`, `Rename one to \"${NEON_DEFAULT_DATABASE}\" or keep a single database on the branch (or, when calling fetchEnv directly, pass \\`databaseName\\`). Available: ${databases.map((d) => d.name).join(\", \")}.`].join(\" \"), { details: {\n\t\tbranchId: branch.id,\n\t\tavailableDatabases: databases.map((d) => d.name)\n\t} });\n}\n/**\n* Project a fully-resolved {@link NeonEnv} into the OS-level `{ KEY: value }` pairs used\n* for cross-process transport. Named after the web-platform `.entries()` convention\n* (`URLSearchParams` / `Headers` / `FormData`); returns a `Record` rather than an\n* iterator of tuples since that's the shape env injection needs (wrap with\n* `Object.entries(...)` if you want literal `[key, value]` pairs). Used by `neon-env run`\n* to inject the vars into a subprocess's `process.env`.\n*\n* Walks the value at runtime so it works for any `NeonEnv<C>` regardless of which\n* conditional namespaces are present.\n*/\nfunction toEntries(env) {\n\tconst out = {};\n\tconst put = (key, value) => {\n\t\tif (value !== void 0) out[key] = value;\n\t};\n\tconst K = NEON_ENV_VAR_KEYS;\n\tput(K.postgres.databaseUrl, env.postgres?.databaseUrl);\n\tput(K.postgres.databaseUrlUnpooled, env.postgres?.databaseUrlUnpooled);\n\tput(K.branch.name, env.branch?.name);\n\tput(K.auth.baseUrl, env.auth?.baseUrl);\n\tput(K.auth.jwksUrl, env.auth?.jwksUrl);\n\tput(K.dataApi.url, env.dataApi?.url);\n\tput(K.storage.accessKeyId, env.storage?.accessKeyId);\n\tput(K.storage.secretAccessKey, env.storage?.secretAccessKey);\n\tput(K.storage.endpoint, env.storage?.endpoint);\n\tput(K.storage.region, env.storage?.region);\n\tput(K.aiGateway.apiKey, env.aiGateway?.apiKey);\n\tput(K.aiGateway.baseUrl, env.aiGateway?.baseUrl);\n\tif (env.functions) for (const slug of Object.keys(env.functions).sort()) put(functionBaseUrlKey(slug), env.functions[slug]?.baseUrl);\n\treturn out;\n}\n//#endregion\nexport { NEON_ENV_VAR_KEYS, createApiFromOptions, credentialEnvKeys, credentialName, defaultAiGatewayCredential, defaultStorageCredential, fetchEnv, fetchEnvKeys, fetchEnvKeysState, functionBaseUrlKey, isFunctionBaseUrlKey, isLiveCredential, parseFunctionBaseUrlKey, policyEnvKeys, previewCredentialScopes, resolveBranchPolicy, toEntries };\n\n//# sourceMappingURL=env.js.map"],"mappings":";;;;;;AAKA,MAAM,0BAA0B;;;;;;;;AAQhC,MAAM,0CAA0C,IAAI,IAAI;CACvD;CACA;CACA;AACD,CAAC;;AAED,SAAS,sBAAsB,WAAW;CACzC,IAAI,UAAU,WAAW,GAAG,OAAO,UAAU;CAC7C,IAAI,UAAU,SAAS,cAAc,GAAG,OAAO;CAC/C,MAAM,WAAW,UAAU,QAAQ,SAAS,CAAC,wBAAwB,IAAI,IAAI,CAAC;CAC9E,OAAO,SAAS,WAAW,IAAI,SAAS,KAAK,KAAK;AACnD;;;;;;;;;;;;;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AO;CACrC,IAAI,EAAE,KAAK,SAAS,IAAI,MAAM,OAAO;CACrC,IAAI,EAAE,QAAQ,KAAK,IAAI,SAAS,GAAG;CACnC,IAAI,EAAE,QAAQ,aAAa,IAAI,SAAS,WAAW;CACnD,IAAI,EAAE,QAAQ,iBAAiB,IAAI,SAAS,eAAe;CAC3D,IAAI,EAAE,QAAQ,UAAU,IAAI,SAAS,QAAQ;CAC7C,IAAI,EAAE,QAAQ,QAAQ,IAAI,SAAS,MAAM;CACzC,IAAI,EAAE,UAAU,QAAQ,IAAI,WAAW,MAAM;CAC7C,IAAI,EAAE,UAAU,SAAS,IAAI,WAAW,OAAO;CAC/C,IAAI,IAAI,WAAW,KAAK,MAAM,QAAQ,OAAO,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,GAAG,IAAI,mBAAmB,IAAI,GAAG,IAAI,UAAU,KAAK,EAAE,OAAO;CACnI,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"env.js","names":[],"sources":["../../../internals/env-core/dist/roles.js","../../../internals/env-core/dist/env.js"],"sourcesContent":["//#region src/roles.ts\n/**\n* Neon's default branch owner role, created with every project. This is the role a\n* `DATABASE_URL` should connect as.\n*/\nconst NEON_DEFAULT_OWNER_ROLE = \"neondb_owner\";\n/**\n* Roles Neon provisions for the Auth / Data API (PostgREST) stack. They exist to back\n* RLS-scoped Data API requests authenticated by JWT — never to hold a `DATABASE_URL` —\n* so they're skipped when auto-picking the connection role. Enabling Neon Auth or the\n* Data API (`neon config apply`) adds these next to the owner role, which is why a plain\n* branch routinely reports more than one role.\n*/\nconst NEON_MANAGED_AUTH_ROLES = /* @__PURE__ */ new Set([\n\t\"authenticator\",\n\t\"anonymous\",\n\t\"authenticated\"\n]);\n/** `undefined` when more than one app role remains (or none exist), so the caller has to ask. */\nfunction defaultConnectionRole(roleNames) {\n\tif (roleNames.length === 1) return roleNames[0];\n\tif (roleNames.includes(\"neondb_owner\")) return NEON_DEFAULT_OWNER_ROLE;\n\tconst appRoles = roleNames.filter((name) => !NEON_MANAGED_AUTH_ROLES.has(name));\n\treturn appRoles.length === 1 ? appRoles[0] : void 0;\n}\n//#endregion\nexport { NEON_DEFAULT_OWNER_ROLE, defaultConnectionRole };\n\n//# sourceMappingURL=roles.js.map","import { NEON_DEFAULT_OWNER_ROLE, defaultConnectionRole } from \"./roles.js\";\nimport { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialScopes, isPlatformError, resolveConfig } from \"@neon/config/v1\";\n//#region src/env.ts\n/**\n* The Neon env core — resolving a branch's env from the Neon API, and projecting it into\n* OS-level `{ KEY: value }` pairs.\n*\n* Private, and bundled into both consumers: `@neon/env` publishes it as `fetchEnv` /\n* `toEntries`, and the `neon` CLI needs the credential-reuse half in `reuse-secrets.ts`.\n* See `README.md` for why it is not published.\n*\n* The counterpart that reads `process.env` — `parseEnv` and its zod schemas — is not here. It\n* has no consumer outside `@neon/env`, so it stays in that package and imports this.\n*/\n/**\n* Mapping between the {@link NeonEnv} property paths and the OS-level env-var keys used\n* for cross-process transport (via `.env` files, `env run -- <cmd>`, or anything else\n* that talks to `process.env`).\n*\n* Each top-level key here is a {@link NeonEnv} namespace; the inner record maps the\n* camelCase property names exposed to TypeScript to the UPPER_SNAKE env-var names used\n* by the OS. Keep this in sync with {@link postgresEnvSchema} / {@link authEnvSchema} /\n* {@link dataApiEnvSchema} / {@link realtimeEnvSchema}.\n*/\n/**\n* Neon's default database, created with every project. When a branch has several databases\n* and none was requested, this is preferred for the `DATABASE_URL` so the common case (a\n* user added a second database next to `neondb`) auto-picks without asking.\n*/\nconst NEON_DEFAULT_DATABASE = \"neondb\";\nconst NEON_ENV_VAR_KEYS = {\n\t/**\n\t* Branch identity. `NEON_BRANCH` carries the branch **name** and is injected into the\n\t* Neon Functions runtime on every branch (including the default) by default. `env pull` /\n\t* `neon dev` / `neon-env run` emit it too so local dev mirrors the deployed runtime.\n\t*/\n\tbranch: { name: \"NEON_BRANCH\" },\n\tpostgres: {\n\t\tdatabaseUrl: \"DATABASE_URL\",\n\t\tdatabaseUrlUnpooled: \"DATABASE_URL_UNPOOLED\"\n\t},\n\tauth: {\n\t\tbaseUrl: \"NEON_AUTH_BASE_URL\",\n\t\tjwksUrl: \"NEON_AUTH_JWKS_URL\"\n\t},\n\tdataApi: { url: \"NEON_DATA_API_URL\" },\n\trealtime: {\n\t\turl: \"NEON_REALTIME_URL\",\n\t\tsecret: \"NEON_REALTIME_SECRET\"\n\t},\n\t/**\n\t* Object storage (Preview). The S3 SDKs read `AWS_*` from their standard config chain, so\n\t* a branch credential + `neon dev` / `env pull` makes object storage work from env alone.\n\t* `region` is injected under the SDK-standard `AWS_REGION`.\n\t*/\n\tstorage: {\n\t\taccessKeyId: \"AWS_ACCESS_KEY_ID\",\n\t\tsecretAccessKey: \"AWS_SECRET_ACCESS_KEY\",\n\t\tendpoint: \"AWS_ENDPOINT_URL_S3\",\n\t\tregion: \"AWS_REGION\"\n\t},\n\t/**\n\t* AI Gateway (Preview). Exposed under the Neon-branded env vars the deployed Functions\n\t* runtime injects: `apiKey` is the minted credential's bearer (`NEON_AI_GATEWAY_TOKEN`)\n\t* and `baseUrl` is the bare branch gateway host (`NEON_AI_GATEWAY_BASE_URL`,\n\t* `scheme://host`, no path). Clients like `@neon/ai-sdk-provider` read these and append the\n\t* dialect route (`/v1`, `/openai/v1`, `/anthropic/v1`) themselves (https://github.com/vercel/ai/pull/15997).\n\t*/\n\taiGateway: {\n\t\tapiKey: \"NEON_AI_GATEWAY_TOKEN\",\n\t\tbaseUrl: \"NEON_AI_GATEWAY_BASE_URL\"\n\t}\n};\nconst FUNCTION_SLUG = /^[a-z0-9]{1,20}$/;\nconst FUNCTION_BASE_URL_KEY = /^NEON_FUNCTION_([A-Z0-9]{1,20})_BASE_URL$/;\nfunction functionBaseUrlKey(slug) {\n\tif (!FUNCTION_SLUG.test(slug)) throw new Error(`functionBaseUrlKey: ${JSON.stringify(slug)} is not a function slug ([a-z0-9]{1,20}).`);\n\treturn `NEON_FUNCTION_${slug.toUpperCase()}_BASE_URL`;\n}\nfunction parseFunctionBaseUrlKey(key) {\n\tconst match = FUNCTION_BASE_URL_KEY.exec(key);\n\treturn match ? match[1].toLowerCase() : null;\n}\nfunction isFunctionBaseUrlKey(key) {\n\treturn parseFunctionBaseUrlKey(key) !== null;\n}\nasync function fetchEnv(config, options) {\n\tif (options.keys) assertStorageCredentialKeyPair(options.keys);\n\treturn fetchEnvKeys(config, options, options.keys ?? null);\n}\nfunction assertStorageCredentialKeyPair(keys) {\n\tif (keys.includes(NEON_ENV_VAR_KEYS.storage.accessKeyId) === keys.includes(NEON_ENV_VAR_KEYS.storage.secretAccessKey)) return;\n\tthrow new TypeError(\"fetchEnv: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be selected together. Pass both in `keys`, or omit both.\");\n}\n/**\n* Starts a read now and keeps an unread rejection from crashing the process; the caller\n* awaits it (and sees the error) when its turn comes. The read is called synchronously and\n* its own promise returned, so errors surface in the same order as a direct call; a\n* synchronous throw becomes the returned rejection.\n*/\nfunction started(read) {\n\tlet promise;\n\ttry {\n\t\tpromise = read();\n\t} catch (error) {\n\t\tpromise = Promise.reject(error);\n\t}\n\tpromise.catch(() => void 0);\n\treturn promise;\n}\n/** Fail loudly when selected-key dependency planning and execution disagree. */\nfunction requiredValue(value, description) {\n\tif (value === null) throw new Error(`fetchEnv: missing ${description}.`);\n\treturn value;\n}\nconst REALTIME_POLL_INTERVAL_MS = 1e3;\n/**\n* Wait for asynchronous Realtime provisioning/rotation before reading its secret. The\n* secret endpoint deliberately returns 404 until provisioning finishes, and during a\n* rotation it can still expose the previous key while `pending` is true.\n*/\nasync function resolveRealtimeEnv(args) {\n\tconst getRealtime = args.api.getProjectBranchRealtime;\n\tif (!getRealtime) throw new PlatformError(ErrorCode.FeatureUnavailable, \"fetchEnv cannot resolve Realtime: this NeonApi adapter does not implement getProjectBranchRealtime.\");\n\tconst getSecret = args.api.getProjectBranchRealtimeSecret;\n\tlet resolvedEnv;\n\twhile (resolvedEnv === void 0) {\n\t\tconst snapshot = await getRealtime.call(args.api, args.projectId, args.branch.id);\n\t\tif (!snapshot.pending) {\n\t\t\tif (!snapshot.enabled) throw new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy enables realtime but Realtime is disabled on branch ${args.branch.name} (${args.branch.id}).`, \"Enable it via `apply(config, { projectId, branchId })` (or `npx neon deploy`) and re-run fetchEnv. Or set realtime to false or omit it.\"].join(\" \"), { details: {\n\t\t\t\tprojectId: args.projectId,\n\t\t\t\tbranchId: args.branch.id\n\t\t\t} });\n\t\t\tlet secret;\n\t\t\tif (args.wantsSecret) {\n\t\t\t\tif (!getSecret) throw new PlatformError(ErrorCode.FeatureUnavailable, \"fetchEnv cannot resolve NEON_REALTIME_SECRET: this NeonApi adapter does not implement getProjectBranchRealtimeSecret.\");\n\t\t\t\tsecret = await getSecret.call(args.api, args.projectId, args.branch.id);\n\t\t\t}\n\t\t\tif (!secret?.pending) resolvedEnv = {\n\t\t\t\t...args.wantsUrl ? { url: realtimeWebSocketUrl(requiredRealtimeInvocationUrl(snapshot, args.branch)) } : {},\n\t\t\t\t...secret ? { secret: secret.secret } : {}\n\t\t\t};\n\t\t}\n\t\tif (resolvedEnv === void 0) await new Promise((resolve) => setTimeout(resolve, REALTIME_POLL_INTERVAL_MS));\n\t}\n\treturn resolvedEnv;\n}\nfunction requiredRealtimeInvocationUrl(snapshot, branch) {\n\tif (snapshot.invocationUrl !== void 0 && snapshot.invocationUrl !== \"\") return snapshot.invocationUrl;\n\tthrow new PlatformError(ErrorCode.ServerError, `Realtime is enabled on branch ${branch.name} (${branch.id}), but the Neon API returned no invocation URL.`, { details: { branchId: branch.id } });\n}\n/** Normalize the control-plane invocation URL to the WebSocket URL the client SDK needs. */\nfunction realtimeWebSocketUrl(value) {\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(value);\n\t} catch {\n\t\tthrow new PlatformError(ErrorCode.ServerError, `Realtime invocation URL is invalid: ${JSON.stringify(value)}.`);\n\t}\n\tif (parsed.protocol === \"https:\") parsed.protocol = \"wss:\";\n\telse if (parsed.protocol === \"http:\") parsed.protocol = \"ws:\";\n\telse if (parsed.protocol !== \"wss:\" && parsed.protocol !== \"ws:\") throw new PlatformError(ErrorCode.ServerError, `Realtime invocation URL must use http(s) or ws(s): ${JSON.stringify(value)}.`);\n\treturn parsed.toString();\n}\n/**\n* The {@link fetchEnv} body, with the key selection as a plain argument and no generic\n* narrowing. Exists for callers that compute the selection at runtime — notably\n* {@link fetchEnvReusingSecrets}, which decides which keys it still needs by checking the\n* branch — since the public overload's `keys` is bound to a literal union those callers cannot\n* produce without asserting.\n*\n* `keys === null` selects everything the policy enables.\n*/\nasync function fetchEnvKeys(config, options, keys) {\n\treturn (await fetchEnvKeysState(config, options, keys)).env;\n}\n/**\n* `policy` is the {@link resolveBranchPolicy} result for this same `config` and branch, when\n* the caller already has it.\n*/\nasync function fetchEnvKeysState(config, options, keys, policy) {\n\tconst api = options.api ?? createApiFromOptions(options);\n\tconst projectId = options.projectId;\n\tconst { branch, desired } = policy ?? await resolveBranchPolicy(config, options, api);\n\tconst selection = keys ? new Set(keys) : null;\n\tconst omitted = new Set(options.omitKeys ?? []);\n\tconst wants = (key) => !omitted.has(key) && (selection === null || selection.has(key));\n\tconst result = {};\n\tconst K = NEON_ENV_VAR_KEYS;\n\tconst wantsPooled = wants(K.postgres.databaseUrl);\n\tconst wantsUnpooled = wants(K.postgres.databaseUrlUnpooled);\n\tconst wantsAuth = desired.authEnabled && (wants(K.auth.baseUrl) || wants(K.auth.jwksUrl));\n\tconst wantsDataApi = desired.dataApiEnabled && wants(K.dataApi.url);\n\tconst wantsRealtime = desired.realtimePolicy === \"enabled\" && (wants(K.realtime.url) || wants(K.realtime.secret));\n\tconst gatewayEnabled = desired.preview?.aiGatewayEnabled ?? false;\n\tconst functionUrlMode = options.functionUrls ?? \"policy\";\n\tconst declaredSlugs = (desired.preview?.functions ?? []).map((fn) => fn.slug);\n\tconst selectedFunctionKeys = selection === null ? [] : [...selection].filter(isFunctionBaseUrlKey);\n\tconst constructSlugs = functionUrlSlugsToConstruct({\n\t\tfunctionUrlMode,\n\t\tselection,\n\t\tdeclaredSlugs,\n\t\tselectedFunctionKeys,\n\t\twants\n\t});\n\tconst wantsAnyFunctionUrl = selection === null || selectedFunctionKeys.length > 0;\n\tconst storageEnabled = (desired.preview?.buckets.length ?? 0) > 0;\n\tconst wantsStorage = storageEnabled && (wants(K.storage.accessKeyId) || wants(K.storage.secretAccessKey) || wants(K.storage.endpoint) || wants(K.storage.region));\n\tconst functionsRead = functionUrlMode === \"all-live\" && wantsAnyFunctionUrl && options.listedFunctions === void 0 ? listFunctionInvocationUrls(api, projectId, branch.id) : null;\n\tfunctionsRead?.catch(() => void 0);\n\tconst storageRead = wantsStorage ? started(() => api.getProjectBranchStorage(projectId, branch.id)) : null;\n\tconst needsUnpooled = wantsUnpooled || gatewayEnabled && wants(K.aiGateway.baseUrl) || constructSlugs.length > 0;\n\tconst needsConnectionTarget = wantsPooled || needsUnpooled;\n\tconst needsDatabase = needsConnectionTarget || wantsDataApi;\n\tconst [roles, databases] = await Promise.all([needsConnectionTarget ? api.listBranchRoles(projectId, branch.id) : Promise.resolve([]), needsDatabase ? api.listBranchDatabases(projectId, branch.id) : Promise.resolve([])]);\n\tconst databaseName = needsDatabase ? pickDatabaseName(databases, branch, options.databaseName) : null;\n\tconst connectionTarget = needsConnectionTarget ? {\n\t\troleName: pickRoleName(roles, branch, options.roleName),\n\t\tdatabaseName: requiredValue(databaseName, \"database for a selected connection URI\")\n\t} : null;\n\tconst getConnectionUri = (pooled) => {\n\t\tconst target = requiredValue(connectionTarget, \"role and database for a selected connection URI\");\n\t\treturn api.getConnectionUri(projectId, {\n\t\t\tbranchId: branch.id,\n\t\t\t...target,\n\t\t\tpooled\n\t\t});\n\t};\n\tconst [pooled, unpooled, authSnapshot, dataApiSnapshot] = await Promise.all([\n\t\twantsPooled ? getConnectionUri(true) : Promise.resolve(null),\n\t\tneedsUnpooled ? getConnectionUri(false) : Promise.resolve(null),\n\t\twantsAuth ? api.getNeonAuth(projectId, branch.id) : Promise.resolve(null),\n\t\twantsDataApi ? api.getNeonDataApi(projectId, branch.id, requiredValue(databaseName, \"database for the selected Data API URL\")) : Promise.resolve(null)\n\t]);\n\tconst postgres = {};\n\tif (wantsPooled) postgres.databaseUrl = requiredValue(pooled, \"pooled connection URI response\").uri;\n\tif (wantsUnpooled) postgres.databaseUrlUnpooled = requiredValue(unpooled, \"direct connection URI response\").uri;\n\tif (Object.keys(postgres).length > 0) result.postgres = postgres;\n\tif (wants(K.branch.name)) result.branch = { name: branch.name };\n\tif (wantsAuth) {\n\t\tif (!authSnapshot) throw new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy enables auth but no Neon Auth integration is enabled on branch ${branch.name} (${branch.id}).`, \"Enable it via `apply(config, { projectId, branchId })` (or `npx neon …`), in the Neon Console — then re-run fetchEnv. Or return auth.enabled=false.\"].join(\" \"), { details: {\n\t\t\tprojectId,\n\t\t\tbranchId: branch.id\n\t\t} });\n\t\tconst auth = {};\n\t\tif (wants(K.auth.baseUrl)) auth.baseUrl = authSnapshot.baseUrl ?? \"\";\n\t\tif (wants(K.auth.jwksUrl)) auth.jwksUrl = authSnapshot.jwksUrl ?? \"\";\n\t\tresult.auth = auth;\n\t}\n\tif (wantsDataApi) {\n\t\tif (!dataApiSnapshot) {\n\t\t\tconst selectedDatabase = requiredValue(databaseName, \"database for the selected Data API URL\");\n\t\t\tthrow new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy enables dataApi but no Data API integration is enabled on branch ${branch.name} (${branch.id}) database ${selectedDatabase}.`, \"Enable it via `apply(config, { projectId, branchId })` or in the Neon Console — then re-run fetchEnv. Or return dataApi.enabled=false.\"].join(\" \"), { details: {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId: branch.id,\n\t\t\t\tdatabaseName: selectedDatabase\n\t\t\t} });\n\t\t}\n\t\tresult.dataApi = { url: dataApiSnapshot.url };\n\t}\n\tif (wantsRealtime) {\n\t\tconst realtime = await resolveRealtimeEnv({\n\t\t\tapi,\n\t\t\tprojectId,\n\t\t\tbranch,\n\t\t\twantsUrl: wants(K.realtime.url),\n\t\t\twantsSecret: wants(K.realtime.secret)\n\t\t});\n\t\tconst realtimeEnv = {};\n\t\tif (wants(K.realtime.url)) realtimeEnv.url = requiredValue(realtime.url, \"WebSocket URL for enabled Realtime\");\n\t\tif (wants(K.realtime.secret)) realtimeEnv.secret = requiredValue(realtime.secret, \"shared secret for enabled Realtime\");\n\t\tresult.realtime = realtimeEnv;\n\t}\n\tconst wantsGateway = gatewayEnabled && (wants(K.aiGateway.apiKey) || wants(K.aiGateway.baseUrl));\n\tconst wantsStorageCredential = storageEnabled && (wants(K.storage.accessKeyId) || wants(K.storage.secretAccessKey));\n\tconst wantsGatewayCredential = gatewayEnabled && wants(K.aiGateway.apiKey);\n\tconst wantsCredential = wantsStorageCredential || wantsGatewayCredential;\n\tif (wantsStorage || wantsGateway) {\n\t\tlet storage = null;\n\t\tif (wantsStorage) {\n\t\t\tstorage = await requiredValue(storageRead, \"storage read\");\n\t\t\tif (!storage) throw new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy declares object storage (buckets) but storage is not enabled on branch ${branch.name} (${branch.id}).`, \"Enable it via `apply(config, { projectId, branchId })` (or in the Neon Console) — then re-run fetchEnv. Or remove buckets.\"].join(\" \"), { details: {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId: branch.id\n\t\t\t} });\n\t\t}\n\t\tconst secrets = wantsCredential ? await resolveBranchCredentialSecrets({\n\t\t\tapi,\n\t\t\tprojectId,\n\t\t\tbranchId: branch.id,\n\t\t\tbranchName: branch.name,\n\t\t\tscopes: previewCredentialScopes(desired.preview, {\n\t\t\t\tstorage: wantsStorageCredential,\n\t\t\t\taiGateway: wantsGatewayCredential\n\t\t\t})\n\t\t}) : null;\n\t\tif (storage) {\n\t\t\tconst storageEnv = {};\n\t\t\tif (secrets && wants(K.storage.accessKeyId)) storageEnv.accessKeyId = secrets.accessKeyId;\n\t\t\tif (secrets && wants(K.storage.secretAccessKey)) storageEnv.secretAccessKey = secrets.secretAccessKey;\n\t\t\tif (wants(K.storage.endpoint)) storageEnv.endpoint = storage.s3Endpoint;\n\t\t\tif (wants(K.storage.region)) storageEnv.region = storage.region;\n\t\t\tresult.storage = storageEnv;\n\t\t}\n\t\tif (wantsGateway) {\n\t\t\tconst gateway = {};\n\t\t\tif (secrets && wants(K.aiGateway.apiKey)) gateway.apiKey = secrets.apiToken;\n\t\t\tif (wants(K.aiGateway.baseUrl)) gateway.baseUrl = aiGatewayBaseUrl(branch.id, requiredValue(unpooled, \"direct connection URI for the selected AI Gateway base URL\").uri);\n\t\t\tresult.aiGateway = gateway;\n\t\t}\n\t}\n\tconst functions = {};\n\tlet functionUrlsUnavailable = false;\n\tif (functionUrlMode === \"all-live\" && wantsAnyFunctionUrl) {\n\t\tconst listed = options.listedFunctions === void 0 ? await requiredValue(functionsRead, \"function listing\") : listedFromSnapshots(options.listedFunctions);\n\t\tif (listed.status === \"unavailable\") {\n\t\t\tif (selection === null) functionUrlsUnavailable = true;\n\t\t} else for (const fn of listed.functions) {\n\t\t\tif (!wants(functionBaseUrlKey(fn.slug))) continue;\n\t\t\tfunctions[fn.slug] = { baseUrl: asEnvBaseUrl(fn.invocationUrl) };\n\t\t}\n\t}\n\tconst missingConstructSlugs = constructSlugs.filter((slug) => functions[slug] === void 0);\n\tif (missingConstructSlugs.length > 0) {\n\t\tconst uri = requiredValue(unpooled, \"direct connection URI for function invocation URLs\").uri;\n\t\tfor (const slug of missingConstructSlugs) functions[slug] = { baseUrl: functionInvocationUrl(branch.id, slug, uri) };\n\t}\n\tassertSelectedFunctionUrls(selectedFunctionKeys, functions);\n\tif (Object.keys(functions).length > 0) result.functions = functions;\n\treturn {\n\t\tenv: result,\n\t\tfunctionUrlsUnavailable\n\t};\n}\nfunction functionUrlSlugsToConstruct(args) {\n\tconst slugs = [];\n\tif (args.functionUrlMode === \"policy\" && args.selection === null) {\n\t\tfor (const slug of args.declaredSlugs) if (args.wants(functionBaseUrlKey(slug))) slugs.push(slug);\n\t\treturn slugs;\n\t}\n\tfor (const key of args.selectedFunctionKeys) {\n\t\tconst slug = parseFunctionBaseUrlKey(key);\n\t\tif (slug !== null) slugs.push(slug);\n\t}\n\treturn slugs;\n}\nfunction listedFromSnapshots(snapshots) {\n\treturn {\n\t\tstatus: \"ok\",\n\t\tfunctions: snapshots.filter((fn) => fn.invocationUrl !== \"\").map((fn) => ({\n\t\t\tslug: fn.slug,\n\t\t\tinvocationUrl: fn.invocationUrl\n\t\t})).sort((left, right) => left.slug.localeCompare(right.slug))\n\t};\n}\nfunction assertSelectedFunctionUrls(keys, functions) {\n\tfor (const key of keys) {\n\t\tconst slug = parseFunctionBaseUrlKey(key);\n\t\tif (slug === null || functions[slug] === void 0) throw new Error(`fetchEnv: missing ${key}.`);\n\t}\n}\nasync function listFunctionInvocationUrls(api, projectId, branchId) {\n\ttry {\n\t\treturn listedFromSnapshots(await api.listBranchFunctions(projectId, branchId));\n\t} catch (error) {\n\t\tif (isPlatformError(error) && error.code === ErrorCode.FeatureUnavailable) return {\n\t\t\tstatus: \"unavailable\",\n\t\t\terror\n\t\t};\n\t\tthrow error;\n\t}\n}\n/**\n* Resolve the target branch and evaluate the policy against it — the first thing any\n* branch-scoped operation needs. Shared by {@link fetchEnv} and {@link fetchEnvReusingSecrets}\n* so the two agree on which branch they're talking about and what it has enabled.\n*/\nasync function resolveBranchPolicy(config, options, api, resolved) {\n\tconst branch = resolved ?? await listAndResolveBranch(options, api);\n\treturn {\n\t\tbranch,\n\t\tdesired: resolveConfig(config, {\n\t\t\tname: branch.name,\n\t\t\tid: branch.id,\n\t\t\texists: true,\n\t\t\t...branch.parentId ? { parentId: branch.parentId } : {},\n\t\t\tisDefault: branch.isDefault,\n\t\t\tisProtected: branch.protected,\n\t\t\t...branch.expiresAt ? { expiresAt: branch.expiresAt } : {}\n\t\t})\n\t};\n}\nasync function listAndResolveBranch(options, api) {\n\tconst projectId = options.projectId;\n\tconst branches = await api.listBranches(projectId);\n\tif (branches.length === 0) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: project ${projectId} has no branches.`, \"Deploy your neon.ts policy (or create a branch) first, or pick a different project id.\"].join(\" \"), { details: { projectId } });\n\tconst branchRef = options.branch ?? options.branchId;\n\tif (!branchRef) throw new PlatformError(ErrorCode.BranchNotFound, [\"fetchEnv: no branch provided.\", \"Pass `branch` with a branch name (e.g. `main`) or id (`br-…`).\"].join(\" \"), { details: { projectId } });\n\treturn resolveBranch(branchRef, branches);\n}\n/**\n* Scopes a minted fallback credential should carry. Only object storage and the AI Gateway\n* *require* secrets; functions never force a credential. `functions:invoke` rides along only\n* when this path still has to mint (defaults already cover storage and the gateway).\n*/\nfunction previewCredentialScopes(preview, selected) {\n\tif (!preview) return [];\n\tconst storage = preview.buckets.length > 0 && (selected?.storage ?? true);\n\tconst aiGateway = preview.aiGatewayEnabled && (selected?.aiGateway ?? true);\n\tif (!storage && !aiGateway) return [];\n\treturn deriveCredentialScopes({\n\t\tstorage,\n\t\taiGateway,\n\t\tfunctions: preview.functions.length > 0\n\t});\n}\n/** The `name` this tool stamps on every credential it mints, so it can recognize its own. */\nfunction credentialName(branchName) {\n\treturn `neon-env ${branchName}`;\n}\n/** The env-var keys a branch credential's secrets surface under, in emit order. */\nfunction credentialEnvKeys(flags) {\n\treturn [...flags.storage ? [NEON_ENV_VAR_KEYS.storage.accessKeyId, NEON_ENV_VAR_KEYS.storage.secretAccessKey] : [], ...flags.aiGateway ? [NEON_ENV_VAR_KEYS.aiGateway.apiKey] : []];\n}\n/**\n* Every OS-level env var a resolved branch policy produces, in emit order. Lets a caller\n* subtract the ones it already holds and pass the rest as {@link fetchEnv}'s `keys`, without\n* re-deriving which vars a policy implies.\n*/\nfunction policyEnvKeys(desired) {\n\tconst K = NEON_ENV_VAR_KEYS;\n\treturn [\n\t\tK.postgres.databaseUrl,\n\t\tK.postgres.databaseUrlUnpooled,\n\t\tK.branch.name,\n\t\t...desired.authEnabled ? [K.auth.baseUrl, K.auth.jwksUrl] : [],\n\t\t...desired.dataApiEnabled ? [K.dataApi.url] : [],\n\t\t...desired.realtimePolicy === \"enabled\" ? [K.realtime.url, K.realtime.secret] : [],\n\t\t...(desired.preview?.buckets.length ?? 0) > 0 ? [\n\t\t\tK.storage.accessKeyId,\n\t\t\tK.storage.secretAccessKey,\n\t\t\tK.storage.endpoint,\n\t\t\tK.storage.region\n\t\t] : [],\n\t\t...desired.preview?.aiGatewayEnabled ? [K.aiGateway.apiKey, K.aiGateway.baseUrl] : []\n\t];\n}\n/** Exact `name` values the credentials list endpoint returns for the platform defaults. */\nconst DEFAULT_AI_GATEWAY_CREDENTIAL_NAME = \"Default AI gateway credential\";\nconst DEFAULT_OBJECT_STORAGE_CREDENTIAL_NAME = \"Default object storage credential\";\n/** Whether an issued credential can still be used: not revoked, not past its expiry. */\nfunction isLiveCredential(meta, now) {\n\tif (meta.revokedAt !== void 0) return false;\n\tif (meta.expiresAt === void 0) return true;\n\tconst expiresAt = Date.parse(meta.expiresAt);\n\treturn Number.isNaN(expiresAt) || expiresAt > now;\n}\nfunction defaultStorageCredential(live, now) {\n\treturn live.find((meta) => meta.name === DEFAULT_OBJECT_STORAGE_CREDENTIAL_NAME && isLiveCredential(meta, now)) ?? null;\n}\nfunction defaultAiGatewayCredential(live, now) {\n\treturn live.find((meta) => meta.name === DEFAULT_AI_GATEWAY_CREDENTIAL_NAME && isLiveCredential(meta, now)) ?? null;\n}\n/**\n* Resolve secrets for object storage / the AI Gateway.\n*\n* Regions that expose those products already have platform defaults on every branch.\n* Reveal those by exact name instead of minting a combined `neon-env ${branch}` credential.\n* Mint only the half (or both) that has no default — regions without the credentials\n* endpoint still fail at list, same as before.\n*\n* A caller that already holds secrets for those defaults should leave the secret keys out\n* of `keys` (see {@link fetchEnvReusingSecrets}) instead of revealing them again.\n*/\nasync function resolveBranchCredentialSecrets(args) {\n\tconst needsStorage = args.scopes.includes(\"storage:read\") || args.scopes.includes(\"storage:write\");\n\tconst needsGateway = args.scopes.includes(\"ai_gateway:invoke\");\n\tconst live = await args.api.listCredentials(args.projectId, args.branchId);\n\tconst now = Date.now();\n\tconst storageDefault = defaultStorageCredential(live, now);\n\tconst gatewayDefault = defaultAiGatewayCredential(live, now);\n\tconst secrets = {\n\t\taccessKeyId: \"\",\n\t\tsecretAccessKey: \"\",\n\t\tapiToken: \"\"\n\t};\n\tconst storageReveal = needsStorage && storageDefault ? started(() => args.api.revealCredential(args.projectId, args.branchId, storageDefault.tokenId)) : null;\n\tconst gatewayReveal = needsGateway && gatewayDefault ? started(() => args.api.revealCredential(args.projectId, args.branchId, gatewayDefault.tokenId)) : null;\n\tif (storageReveal) {\n\t\tconst revealed = await storageReveal;\n\t\tsecrets.accessKeyId = revealed.tokenId;\n\t\tsecrets.secretAccessKey = revealed.s3SecretAccessKey;\n\t}\n\tif (gatewayReveal) secrets.apiToken = (await gatewayReveal).apiToken;\n\tconst missingStorage = needsStorage && storageDefault === null;\n\tconst missingGateway = needsGateway && gatewayDefault === null;\n\tif (missingStorage || missingGateway) {\n\t\tconst minted = await mintBranchCredential({\n\t\t\t...args,\n\t\t\tscopes: deriveCredentialScopes({\n\t\t\t\tstorage: missingStorage,\n\t\t\t\taiGateway: missingGateway,\n\t\t\t\tfunctions: args.scopes.includes(\"functions:invoke\")\n\t\t\t})\n\t\t});\n\t\tif (missingStorage) {\n\t\t\tsecrets.accessKeyId = minted.accessKeyId;\n\t\t\tsecrets.secretAccessKey = minted.secretAccessKey;\n\t\t}\n\t\tif (missingGateway) secrets.apiToken = minted.apiToken;\n\t}\n\treturn secrets;\n}\nasync function mintBranchCredential(args) {\n\tconst minted = await args.api.createCredential(args.projectId, args.branchId, {\n\t\tscopes: args.scopes,\n\t\tprincipalType: \"user\",\n\t\tname: credentialName(args.branchName)\n\t});\n\treturn {\n\t\taccessKeyId: minted.tokenId,\n\t\tsecretAccessKey: minted.s3SecretAccessKey,\n\t\tapiToken: minted.apiToken\n\t};\n}\n/**\n* The AI Gateway is a **branch-scoped host** — `<branchId>-api.ai.<host-suffix>` — NOT the\n* control-plane API origin. Derive the suffix from the branch's own Postgres connection host\n* by dropping only the endpoint label (the first segment) and keeping everything after it,\n* including any infra cell prefix (`c-N.`): a connection host of\n* `ep-x.c-3.us-east-2.aws.neon.tech` yields the gateway host\n* `<branchId>-api.ai.c-3.us-east-2.aws.neon.tech`. The cell prefix is **load-bearing** —\n* the gateway is cell-routed, so dropping `c-N.` resolves to the wrong (or no) host.\n*\n* Function invocation URLs use the same suffix: `<branchId>-<slug>.compute.<suffix>`.\n*/\nfunction connectionHostSuffix(connectionUri) {\n\tlet connectionHost = \"\";\n\ttry {\n\t\tconnectionHost = new URL(connectionUri).hostname;\n\t} catch {\n\t\tconnectionHost = \"\";\n\t}\n\treturn connectionHost.split(\".\").slice(1).join(\".\");\n}\nfunction aiGatewayHost(branchId, connectionUri) {\n\treturn `${branchId}-api.ai.${connectionHostSuffix(connectionUri)}`;\n}\n/**\n* The API's `invocation_url` ends with `/` so paths concatenate onto it. Neon `*_BASE_URL`\n* vars are origin-only (`NEON_AUTH_BASE_URL`, `NEON_AI_GATEWAY_BASE_URL`).\n*/\nfunction asEnvBaseUrl(url) {\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(url);\n\t} catch {\n\t\tthrow new Error(`fetchEnv: function invocation URL is not a URL: ${JSON.stringify(url)}`);\n\t}\n\tif (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") throw new Error(`fetchEnv: function invocation URL must be http(s): ${JSON.stringify(url)}`);\n\treturn parsed.origin;\n}\n/** Derived from the connection URI so undeployed functions have a cell-routed URL. */\nfunction functionInvocationUrl(branchId, slug, connectionUri) {\n\tconst suffix = connectionHostSuffix(connectionUri);\n\tif (suffix === \"\") throw new Error(`fetchEnv: cannot derive the invocation URL for function \"${slug}\": the direct connection URI has no host suffix.`);\n\treturn `https://${branchId}-${slug}.compute.${suffix}`;\n}\n/** The AI Gateway's bare base URL (`NEON_AI_GATEWAY_BASE_URL`) on the branch gateway host. */\nfunction aiGatewayBaseUrl(branchId, connectionUri) {\n\treturn `https://${aiGatewayHost(branchId, connectionUri)}`;\n}\nfunction createApiFromOptions(options) {\n\treturn createNeonApiFromOptions(\"fetchEnv\", {\n\t\t...options.apiKey ? { apiKey: options.apiKey } : {},\n\t\t...options.apiHost ? { apiHost: options.apiHost } : {}\n\t});\n}\n/**\n* Resolve a branch ref — a name or an id — to a concrete branch. Matches by id first\n* (exact `br-…`), then by name; both are unique within a project, so the lookup is\n* unambiguous. This lets `.neon` files written by `neonctl` (which pin the branch *name*)\n* and explicit `br-…` ids both work.\n*/\nfunction resolveBranch(branch, branches) {\n\tconst match = branches.find((b) => b.id === branch) ?? branches.find((b) => b.name === branch);\n\tif (match) return match;\n\tthrow new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: branch ${JSON.stringify(branch)} not found on project (matched by id or name).`, `Existing branches: ${branches.map((b) => `${b.name} (${b.id})`).join(\", \")}.`].join(\" \"), { details: {\n\t\tbranch,\n\t\tavailable: branches.map((b) => `${b.name} (${b.id})`)\n\t} });\n}\nfunction pickRoleName(roles, branch, requested) {\n\tif (requested) {\n\t\tif (!roles.some((r) => r.name === requested)) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: role \"${requested}\" not found on branch ${branch.name} (${branch.id}).`, `Existing roles: ${roles.map((r) => r.name).join(\", \") || \"(none)\"}.`].join(\" \"), { details: {\n\t\t\tbranchId: branch.id,\n\t\t\troleName: requested,\n\t\t\tavailableRoles: roles.map((r) => r.name)\n\t\t} });\n\t\treturn requested;\n\t}\n\tif (roles.length === 0) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: branch ${branch.name} (${branch.id}) has no roles.`, \"Create one via the Neon console or pass `roleName` explicitly.\"].join(\" \"), { details: { branchId: branch.id } });\n\tconst picked = defaultConnectionRole(roles.map((r) => r.name));\n\tif (picked) return picked;\n\tthrow new PlatformError(ErrorCode.AmbiguousBranchAuth, [`fetchEnv: branch ${branch.name} (${branch.id}) has ${roles.length} roles and none is \"${NEON_DEFAULT_OWNER_ROLE}\"; cannot auto-pick.`, `Pass \\`roleName\\` explicitly. Available: ${roles.map((r) => r.name).join(\", \")}.`].join(\" \"), { details: {\n\t\tbranchId: branch.id,\n\t\tavailableRoles: roles.map((r) => r.name)\n\t} });\n}\nfunction pickDatabaseName(databases, branch, requested) {\n\tif (requested) {\n\t\tif (!databases.some((d) => d.name === requested)) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: database \"${requested}\" not found on branch ${branch.name} (${branch.id}).`, `Existing databases: ${databases.map((d) => d.name).join(\", \") || \"(none)\"}.`].join(\" \"), { details: {\n\t\t\tbranchId: branch.id,\n\t\t\tdatabaseName: requested,\n\t\t\tavailableDatabases: databases.map((d) => d.name)\n\t\t} });\n\t\treturn requested;\n\t}\n\tif (databases.length === 0) throw new PlatformError(ErrorCode.BranchNotFound, [`fetchEnv: branch ${branch.name} (${branch.id}) has no databases.`, \"Create one via the Neon console or pass `databaseName` explicitly.\"].join(\" \"), { details: { branchId: branch.id } });\n\tconst neondb = databases.find((d) => d.name === NEON_DEFAULT_DATABASE);\n\tif (neondb) return neondb.name;\n\tif (databases.length === 1) return databases[0].name;\n\tthrow new PlatformError(ErrorCode.AmbiguousBranchAuth, [`fetchEnv: branch ${branch.name} (${branch.id}) has ${databases.length} databases and none is named \"${NEON_DEFAULT_DATABASE}\"; cannot auto-pick.`, `Rename one to \"${NEON_DEFAULT_DATABASE}\" or keep a single database on the branch (or, when calling fetchEnv directly, pass \\`databaseName\\`). Available: ${databases.map((d) => d.name).join(\", \")}.`].join(\" \"), { details: {\n\t\tbranchId: branch.id,\n\t\tavailableDatabases: databases.map((d) => d.name)\n\t} });\n}\n/**\n* Project a fully-resolved {@link NeonEnv} into the OS-level `{ KEY: value }` pairs used\n* for cross-process transport. Named after the web-platform `.entries()` convention\n* (`URLSearchParams` / `Headers` / `FormData`); returns a `Record` rather than an\n* iterator of tuples since that's the shape env injection needs (wrap with\n* `Object.entries(...)` if you want literal `[key, value]` pairs). Used by `neon-env run`\n* to inject the vars into a subprocess's `process.env`.\n*\n* Walks the value at runtime so it works for any `NeonEnv<C>` regardless of which\n* conditional namespaces are present.\n*/\nfunction toEntries(env) {\n\tconst out = {};\n\tconst put = (key, value) => {\n\t\tif (value !== void 0) out[key] = value;\n\t};\n\tconst K = NEON_ENV_VAR_KEYS;\n\tput(K.postgres.databaseUrl, env.postgres?.databaseUrl);\n\tput(K.postgres.databaseUrlUnpooled, env.postgres?.databaseUrlUnpooled);\n\tput(K.branch.name, env.branch?.name);\n\tput(K.auth.baseUrl, env.auth?.baseUrl);\n\tput(K.auth.jwksUrl, env.auth?.jwksUrl);\n\tput(K.dataApi.url, env.dataApi?.url);\n\tput(K.realtime.url, env.realtime?.url);\n\tput(K.realtime.secret, env.realtime?.secret);\n\tput(K.storage.accessKeyId, env.storage?.accessKeyId);\n\tput(K.storage.secretAccessKey, env.storage?.secretAccessKey);\n\tput(K.storage.endpoint, env.storage?.endpoint);\n\tput(K.storage.region, env.storage?.region);\n\tput(K.aiGateway.apiKey, env.aiGateway?.apiKey);\n\tput(K.aiGateway.baseUrl, env.aiGateway?.baseUrl);\n\tif (env.functions) for (const slug of Object.keys(env.functions).sort()) put(functionBaseUrlKey(slug), env.functions[slug]?.baseUrl);\n\treturn out;\n}\n//#endregion\nexport { NEON_ENV_VAR_KEYS, createApiFromOptions, credentialEnvKeys, credentialName, defaultAiGatewayCredential, defaultStorageCredential, fetchEnv, fetchEnvKeys, fetchEnvKeysState, functionBaseUrlKey, isFunctionBaseUrlKey, isLiveCredential, parseFunctionBaseUrlKey, policyEnvKeys, previewCredentialScopes, resolveBranchPolicy, toEntries };\n\n//# sourceMappingURL=env.js.map"],"mappings":";;;;;;AAKA,MAAM,0BAA0B;;;;;;;;AAQhC,MAAM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BAAqB,IAAI,UAAU,mBAAmB;CACrE,IAAI,EAAE,OAAO,MAAM,IAAI,QAAQ,IAAI;CACnC,IAAI,EAAE,KAAK,SAAS,IAAI,MAAM,OAAO;CACrC,IAAI,EAAE,KAAK,SAAS,IAAI,MAAM,OAAO;CACrC,IAAI,EAAE,QAAQ,KAAK,IAAI,SAAS,GAAG;CACnC,IAAI,EAAE,SAAS,KAAK,IAAI,UAAU,GAAG;CACrC,IAAI,EAAE,SAAS,QAAQ,IAAI,UAAU,MAAM;CAC3C,IAAI,EAAE,QAAQ,aAAa,IAAI,SAAS,WAAW;CACnD,IAAI,EAAE,QAAQ,iBAAiB,IAAI,SAAS,eAAe;CAC3D,IAAI,EAAE,QAAQ,UAAU,IAAI,SAAS,QAAQ;CAC7C,IAAI,EAAE,QAAQ,QAAQ,IAAI,SAAS,MAAM;CACzC,IAAI,EAAE,UAAU,QAAQ,IAAI,WAAW,MAAM;CAC7C,IAAI,EAAE,UAAU,SAAS,IAAI,WAAW,OAAO;CAC/C,IAAI,IAAI,WAAW,KAAK,MAAM,QAAQ,OAAO,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,GAAG,IAAI,mBAAmB,IAAI,GAAG,IAAI,UAAU,KAAK,EAAE,OAAO;CACnI,OAAO;AACR"}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ declare const NEON_ENV_VAR_KEYS: {
|
|
|
23
23
|
readonly dataApi: {
|
|
24
24
|
readonly url: "NEON_DATA_API_URL";
|
|
25
25
|
};
|
|
26
|
+
readonly realtime: {
|
|
27
|
+
readonly url: "NEON_REALTIME_URL";
|
|
28
|
+
readonly secret: "NEON_REALTIME_SECRET";
|
|
29
|
+
};
|
|
26
30
|
/**
|
|
27
31
|
* Object storage (Preview). The S3 SDKs read `AWS_*` from their standard config chain, so
|
|
28
32
|
* a branch credential + `neon dev` / `env pull` makes object storage work from env alone.
|
|
@@ -93,6 +97,13 @@ interface NeonAuthEnv {
|
|
|
93
97
|
interface NeonDataApiEnv {
|
|
94
98
|
url: string;
|
|
95
99
|
}
|
|
100
|
+
/** Connection values for a branch with Realtime enabled. */
|
|
101
|
+
interface NeonRealtimeEnv {
|
|
102
|
+
/** WebSocket endpoint passed to `createRealtimeClient`. */
|
|
103
|
+
url: string;
|
|
104
|
+
/** Server-only key passed to `createRealtime`. Never expose it to browser code. */
|
|
105
|
+
secret: string;
|
|
106
|
+
}
|
|
96
107
|
/**
|
|
97
108
|
* S3-compatible object-storage access for the branch. Present on `NeonEnv` only
|
|
98
109
|
* when the policy declares `buckets` (or deprecated `preview.buckets`). Combines a minted branch credential's access
|
|
@@ -180,6 +191,10 @@ type HasBuckets<C extends Config> = OrBool<HasGaRecord<C["buckets"]>, HasPreview
|
|
|
180
191
|
type HasPreviewAiGateway<C extends Config> = [NonNullable<C["preview"]>] extends [never] ? false : NonNullable<C["preview"]> extends {
|
|
181
192
|
aiGateway: infer A;
|
|
182
193
|
} ? ServiceOn<NonNullable<A>> : false;
|
|
194
|
+
/** Whether the policy statically enables Realtime under `preview.realtime`. */
|
|
195
|
+
type RealtimeOn<C extends Config> = [NonNullable<C["preview"]>] extends [never] ? false : NonNullable<C["preview"]> extends {
|
|
196
|
+
realtime: infer R;
|
|
197
|
+
} ? ServiceOn<NonNullable<R>> : false;
|
|
183
198
|
type AiGatewayOn<C extends Config> = OrBool<HasGaToggle<C["aiGateway"]>, HasPreviewAiGateway<C>>;
|
|
184
199
|
/** The tuple guard prevents a missing preview block from enabling functions. */
|
|
185
200
|
type HasPreviewFunctions<C extends Config> = [NonNullable<C["preview"]>] extends [never] ? false : NonNullable<C["preview"]> extends {
|
|
@@ -198,13 +213,14 @@ type FunctionBaseUrlKeyOf<C extends Config> = FunctionSlugOfConfig<C> extends in
|
|
|
198
213
|
* Static, namespaced shape of `fetchEnv` / `parseEnv`'s return value. Generic over the
|
|
199
214
|
* {@link Config} so the type system knows which optional namespaces are present.
|
|
200
215
|
*
|
|
201
|
-
* Because the secret-bearing toggles
|
|
202
|
-
*
|
|
203
|
-
*
|
|
216
|
+
* Because the secret-bearing toggles live in the **static** config (not inside a per-branch
|
|
217
|
+
* closure), namespace presence is a direct read of those fields — no union-across-branches,
|
|
218
|
+
* no default-config escape hatch:
|
|
204
219
|
*
|
|
205
220
|
* - `postgres` is always present.
|
|
206
221
|
* - `auth` is added iff `config.auth` is statically enabled.
|
|
207
222
|
* - `dataApi` is added iff `config.dataApi` is statically enabled.
|
|
223
|
+
* - `realtime` is added iff `config.preview.realtime` is statically enabled.
|
|
208
224
|
* - `storage` is added iff `config.buckets` (or deprecated `preview.buckets`) declares at least one bucket.
|
|
209
225
|
* - `aiGateway` is added iff `config.aiGateway` (or deprecated `preview.aiGateway`) is statically enabled.
|
|
210
226
|
* - `functions` is added iff `config.functions` (or deprecated `preview.functions`) declares at least one slug.
|
|
@@ -220,6 +236,8 @@ type NeonEnv<C extends Config = Config> = {
|
|
|
220
236
|
auth: NeonAuthEnv;
|
|
221
237
|
} : NoNamespace) & (ServiceOn<NonNullable<C["dataApi"]>> extends true ? {
|
|
222
238
|
dataApi: NeonDataApiEnv;
|
|
239
|
+
} : NoNamespace) & (RealtimeOn<C> extends true ? {
|
|
240
|
+
realtime: NeonRealtimeEnv;
|
|
223
241
|
} : NoNamespace) & (HasBuckets<C> extends true ? {
|
|
224
242
|
storage: NeonStorageEnv;
|
|
225
243
|
} : NoNamespace) & (AiGatewayOn<C> extends true ? {
|
|
@@ -239,6 +257,7 @@ interface EnvKeysByNamespace {
|
|
|
239
257
|
branch: "NEON_BRANCH";
|
|
240
258
|
auth: "NEON_AUTH_BASE_URL" | "NEON_AUTH_JWKS_URL";
|
|
241
259
|
dataApi: "NEON_DATA_API_URL";
|
|
260
|
+
realtime: "NEON_REALTIME_URL" | "NEON_REALTIME_SECRET";
|
|
242
261
|
storage: "AWS_ACCESS_KEY_ID" | "AWS_SECRET_ACCESS_KEY" | "AWS_ENDPOINT_URL_S3" | "AWS_REGION";
|
|
243
262
|
aiGateway: "NEON_AI_GATEWAY_TOKEN" | "NEON_AI_GATEWAY_BASE_URL";
|
|
244
263
|
}
|
|
@@ -248,6 +267,7 @@ interface NamespaceEnv {
|
|
|
248
267
|
branch: NeonBranchEnv;
|
|
249
268
|
auth: NeonAuthEnv;
|
|
250
269
|
dataApi: NeonDataApiEnv;
|
|
270
|
+
realtime: NeonRealtimeEnv;
|
|
251
271
|
storage: NeonStorageEnv;
|
|
252
272
|
aiGateway: NeonAiGatewayEnv;
|
|
253
273
|
}
|
|
@@ -259,6 +279,8 @@ interface EnvKeyToProp {
|
|
|
259
279
|
NEON_AUTH_BASE_URL: "baseUrl";
|
|
260
280
|
NEON_AUTH_JWKS_URL: "jwksUrl";
|
|
261
281
|
NEON_DATA_API_URL: "url";
|
|
282
|
+
NEON_REALTIME_URL: "url";
|
|
283
|
+
NEON_REALTIME_SECRET: "secret";
|
|
262
284
|
AWS_ACCESS_KEY_ID: "accessKeyId";
|
|
263
285
|
AWS_SECRET_ACCESS_KEY: "secretAccessKey";
|
|
264
286
|
AWS_ENDPOINT_URL_S3: "endpoint";
|
|
@@ -511,6 +533,16 @@ type FunctionEnvKeysOf<C extends Config, S extends string> = S extends keyof Pre
|
|
|
511
533
|
* The extra `function` namespace added to `parseEnv`'s result when called with a function
|
|
512
534
|
* slug scope: the declared env-var keys for that function, each resolved to a `string`.
|
|
513
535
|
*/
|
|
536
|
+
/**
|
|
537
|
+
* What `parseEnv` returns without a key filter: {@link NeonEnv} with `functions` optional,
|
|
538
|
+
* because the deployed Functions runtime does not inject `NEON_FUNCTION_<SLUG>_BASE_URL`.
|
|
539
|
+
* Select the key (`parseEnv(config, ["NEON_FUNCTION_HELLO_BASE_URL"])`) to require it.
|
|
540
|
+
*/
|
|
541
|
+
type ParsedNeonEnv<C extends Config> = NeonEnv<C> extends {
|
|
542
|
+
functions: infer F;
|
|
543
|
+
} ? Omit<NeonEnv<C>, "functions"> & {
|
|
544
|
+
functions?: F;
|
|
545
|
+
} : NeonEnv<C>;
|
|
514
546
|
type NeonFunctionEnv<C extends Config, S extends string> = {
|
|
515
547
|
function: Record<FunctionEnvKeysOf<C, S>, string>;
|
|
516
548
|
};
|
|
@@ -526,8 +558,8 @@ type NeonFunctionEnv<C extends Config, S extends string> = {
|
|
|
526
558
|
* - You are **inside a deployed Neon Function**, whose env was uploaded at `config apply`.
|
|
527
559
|
*
|
|
528
560
|
* Unlike the old API, `parseEnv` does **not** take a branch name: the secret set is now
|
|
529
|
-
* static (
|
|
530
|
-
* evaluating the per-branch closure.
|
|
561
|
+
* static (`config.auth` / `config.dataApi` / `config.preview.realtime`), so it reads those
|
|
562
|
+
* directly without evaluating the per-branch closure.
|
|
531
563
|
*
|
|
532
564
|
* The second argument is a **scope** or a **key filter**:
|
|
533
565
|
* - omitted — *external* scope (app bootstrap, build scripts, your dev machine). Returns the
|
|
@@ -563,9 +595,9 @@ type NeonFunctionEnv<C extends Config, S extends string> = {
|
|
|
563
595
|
* postgres.databaseUrl; // string — `databaseUrlUnpooled` is absent
|
|
564
596
|
* ```
|
|
565
597
|
*/
|
|
566
|
-
declare function parseEnv<const C extends Config>(config: C):
|
|
567
|
-
declare function parseEnv<const C extends Config, const S extends FunctionSlugOf<C>>(config: C, scope: FunctionScopeField<C, S>):
|
|
598
|
+
declare function parseEnv<const C extends Config>(config: C): ParsedNeonEnv<C>;
|
|
599
|
+
declare function parseEnv<const C extends Config, const S extends FunctionSlugOf<C>>(config: C, scope: FunctionScopeField<C, S>): ParsedNeonEnv<C> & NeonFunctionEnv<C, S>;
|
|
568
600
|
declare function parseEnv<const C extends Config, const K extends SelectableEnvKey<C>>(config: C, keys: readonly K[]): FilteredNeonEnv<K>;
|
|
569
601
|
//#endregion
|
|
570
|
-
export { type FetchEnvOptions, type FilteredNeonEnv, type FunctionBaseUrlKey, type FunctionSlugOf, NEON_ENV_VAR_KEYS, type NeonAiGatewayEnv, type NeonAuthEnv, type NeonBranchEnv, type NeonDataApiEnv, type NeonEnv, type NeonFunctionEnv, type NeonFunctionUrlEnv, type NeonFunctionsEnv, type NeonPostgresEnv, type NeonStorageEnv, type ResolvedNeonEnv, type SelectableEnvKey, type SelectedNeonEnv, fetchEnv, functionBaseUrlKey, isFunctionBaseUrlKey, parseEnv, parseFunctionBaseUrlKey, toEntries };
|
|
602
|
+
export { type FetchEnvOptions, type FilteredNeonEnv, type FunctionBaseUrlKey, type FunctionSlugOf, NEON_ENV_VAR_KEYS, type NeonAiGatewayEnv, type NeonAuthEnv, type NeonBranchEnv, type NeonDataApiEnv, type NeonEnv, type NeonFunctionEnv, type NeonFunctionUrlEnv, type NeonFunctionsEnv, type NeonPostgresEnv, type NeonRealtimeEnv, type NeonStorageEnv, type ParsedNeonEnv, type ResolvedNeonEnv, type SelectableEnvKey, type SelectedNeonEnv, fetchEnv, functionBaseUrlKey, isFunctionBaseUrlKey, parseEnv, parseFunctionBaseUrlKey, toEntries };
|
|
571
603
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["Config","CredentialScope","NeonApi","NeonBranchSnapshot","NeonCredentialMeta","ResolvedPreviewConfig","resolveConfig","NEON_ENV_VAR_KEYS","FunctionBaseUrlKey","Slug","Uppercase","functionBaseUrlKey","S","parseFunctionBaseUrlKey","isFunctionBaseUrlKey","FunctionUrlMode","NeonBranchEnv","NeonPostgresEnv","NeonAuthEnv","NeonDataApiEnv","NeonStorageEnv","NeonAiGatewayEnv","NeonFunctionUrlEnv","NoNamespace","Record","ServiceOn","T","HasKeys","OrBool","A","B","HasGaRecord","NonNullable","HasGaToggle","HasPreviewBuckets","C","HasBuckets","HasPreviewAiGateway","AiGatewayOn","HasPreviewFunctions","F","HasFunctions","GaFunctionsOfConfig","PreviewFunctionsOfConfig","FunctionsOfConfig","FunctionSlugOfConfig","Extract","NeonFunctionsEnv","FunctionBaseUrlKeyOf","NeonEnv","EnvKeysByNamespace","NamespaceEnv","EnvKeyToProp","SelectableEnvKey","SelectedFunctionKeys","K","FunctionSlugFromKey","Lowercase","FunctionsFilteredEnv","P","OptionalFunctionsFilteredEnv","FilteredNeonEnv","N","OptionalFilteredNeonEnv","IsUnion","Whole","TupleHasUnion","Head","Tail","SelectedNeonEnv","Keys","StorageCredentialEnvKey","StorageKeyPairError","TupleDefinitelyContains","Key","TupleDefinitelyContainsStoragePair","InvalidStorageKeyTuple","StorageKeyPairConstraint","FetchEnvKeysFromArgs","Args","StorageKeyPairArgsConstraint","StorageKeyUnionConstraint","FetchEnvOptions","fetchEnv","NoInfer","Promise","fetchEnvKeys","FetchEnvKeysOptions","ResolvedNeonEnv","FetchEnvKeysState","ReadonlyArray","fetchEnvKeysState","BranchPolicy","ReturnType","resolveBranchPolicy","Pick","previewCredentialScopes","credentialName","credentialEnvKeys","policyEnvKeys","isLiveCredential","defaultStorageCredential","defaultAiGatewayCredential","createApiFromOptions","toEntries","Partial","Config","FilteredNeonEnv","NeonEnv","SelectableEnvKey","GaFunctionsOf","C","NonNullable","Record","PreviewFunctionsHome","F","PreviewFunctionsOf","FunctionSlugOf","Extract","NoFunctionScopeHint","FunctionScopeField","S","FunctionEnvKeysOf","E","NeonFunctionEnv","parseEnv","K","Config","NeonApi","resolveConfig","NEON_ENV_VAR_KEYS","branch","name","postgres","databaseUrl","databaseUrlUnpooled","auth","baseUrl","jwksUrl","dataApi","url","storage","accessKeyId","secretAccessKey","endpoint","region","aiGateway","apiKey","FunctionBaseUrlKey","Uppercase","Slug","functionBaseUrlKey","slug","S","parseFunctionBaseUrlKey","key","isFunctionBaseUrlKey","NeonBranchEnv","NeonPostgresEnv","NeonAuthEnv","NeonDataApiEnv","NeonStorageEnv","NeonAiGatewayEnv","NeonFunctionUrlEnv","NoNamespace","Record","ServiceOn","T","enabled","HasKeys","OrBool","A","B","HasGaRecord","NonNullable","HasGaToggle","HasPreviewBuckets","C","buckets","HasBuckets","HasPreviewAiGateway","AiGatewayOn","HasPreviewFunctions","functions","F","HasFunctions","GaFunctionsOfConfig","PreviewFunctionsOfConfig","FunctionsOfConfig","FunctionSlugOfConfig","Extract","NeonFunctionsEnv","FunctionBaseUrlKeyOf","NeonEnv","EnvKeysByNamespace","NamespaceEnv","EnvKeyToProp","DATABASE_URL","DATABASE_URL_UNPOOLED","NEON_BRANCH","NEON_AUTH_BASE_URL","NEON_AUTH_JWKS_URL","NEON_DATA_API_URL","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_ENDPOINT_URL_S3","AWS_REGION","NEON_AI_GATEWAY_TOKEN","NEON_AI_GATEWAY_BASE_URL","SelectableEnvKey","SelectedFunctionKeys","K","FunctionSlugFromKey","Lowercase","FunctionsFilteredEnv","P","OptionalFunctionsFilteredEnv","FilteredNeonEnv","N","OptionalFilteredNeonEnv","IsUnion","Whole","TupleHasUnion","Head","Tail","SelectedNeonEnv","Keys","StorageCredentialEnvKey","StorageKeyPairError","TupleDefinitelyContains","Key","TupleDefinitelyContainsStoragePair","InvalidStorageKeyTuple","StorageKeyPairConstraint","FetchEnvKeysFromArgs","Args","keys","StorageKeyPairArgsConstraint","StorageKeyUnionConstraint","FetchEnvOptions","projectId","branchId","apiHost","api","roleName","databaseName","fetchEnv","options","config","args","NoInfer","Promise","toEntries","env","ResolvedNeonEnv","Partial","GaFunctionsOf","PreviewFunctionsHome","PreviewFunctionsOf","FunctionSlugOf","NoFunctionScopeHint","FunctionScopeField","FunctionEnvKeysOf","E","NeonFunctionEnv","function","parseEnv","scope"],"sources":["../../../internals/env-core/dist/env.d.ts","../src/lib/parse-env.ts"],"sourcesContent":["import { Config, CredentialScope, NeonApi, NeonBranchSnapshot, NeonCredentialMeta, ResolvedPreviewConfig, resolveConfig } from \"@neon/config/v1\";\n\n//#region src/env.d.ts\n\ndeclare const NEON_ENV_VAR_KEYS: {\n /**\n * Branch identity. `NEON_BRANCH` carries the branch **name** and is injected into the\n * Neon Functions runtime on every branch (including the default) by default. `env pull` /\n * `neon dev` / `neon-env run` emit it too so local dev mirrors the deployed runtime.\n */\n readonly branch: {\n readonly name: \"NEON_BRANCH\";\n };\n readonly postgres: {\n readonly databaseUrl: \"DATABASE_URL\";\n readonly databaseUrlUnpooled: \"DATABASE_URL_UNPOOLED\";\n };\n readonly auth: {\n readonly baseUrl: \"NEON_AUTH_BASE_URL\";\n readonly jwksUrl: \"NEON_AUTH_JWKS_URL\";\n };\n readonly dataApi: {\n readonly url: \"NEON_DATA_API_URL\";\n };\n /**\n * Object storage (Preview). The S3 SDKs read `AWS_*` from their standard config chain, so\n * a branch credential + `neon dev` / `env pull` makes object storage work from env alone.\n * `region` is injected under the SDK-standard `AWS_REGION`.\n */\n readonly storage: {\n readonly accessKeyId: \"AWS_ACCESS_KEY_ID\";\n readonly secretAccessKey: \"AWS_SECRET_ACCESS_KEY\";\n readonly endpoint: \"AWS_ENDPOINT_URL_S3\";\n readonly region: \"AWS_REGION\";\n };\n /**\n * AI Gateway (Preview). Exposed under the Neon-branded env vars the deployed Functions\n * runtime injects: `apiKey` is the minted credential's bearer (`NEON_AI_GATEWAY_TOKEN`)\n * and `baseUrl` is the bare branch gateway host (`NEON_AI_GATEWAY_BASE_URL`,\n * `scheme://host`, no path). Clients like `@neon/ai-sdk-provider` read these and append the\n * dialect route (`/v1`, `/openai/v1`, `/anthropic/v1`) themselves (https://github.com/vercel/ai/pull/15997).\n */\n readonly aiGateway: {\n readonly apiKey: \"NEON_AI_GATEWAY_TOKEN\";\n readonly baseUrl: \"NEON_AI_GATEWAY_BASE_URL\";\n };\n};\ntype FunctionBaseUrlKey<Slug extends string = string> = `NEON_FUNCTION_${Uppercase<Slug>}_BASE_URL`;\ndeclare function functionBaseUrlKey<S extends string>(slug: S): FunctionBaseUrlKey<S>;\ndeclare function parseFunctionBaseUrlKey(key: string): string | null;\ndeclare function isFunctionBaseUrlKey(key: string): key is FunctionBaseUrlKey;\n/** `all-live` lists deployed functions. Policy mode derives declared slugs from the connection host. */\ntype FunctionUrlMode = \"policy\" | \"all-live\";\n/**\n * Branch identity for the resolved branch. Always present on a `fetchEnv` result (the branch\n * name is always known); on a `parseEnv` result it's present only when `NEON_BRANCH` was\n * injected into `process.env` (the Functions runtime injects it by default, as do `neon dev` /\n * `neon-env run` / `env pull`). `name` is the branch **name** (e.g. `main`, `preview/foo`).\n */\ninterface NeonBranchEnv {\n name: string;\n}\n/** Per-namespace inner shapes. Exposed so consumers can name the parts independently. */\ninterface NeonPostgresEnv {\n /**\n * Pooled connection string (via Neon's PgBouncer pooler). The right default for\n * serverless drivers (`@neondatabase/serverless`, edge runtimes, Postgres.js, …).\n */\n databaseUrl: string;\n /**\n * Direct (unpooled) connection string. Use this when you need session-level\n * features (`LISTEN`/`NOTIFY`, prepared statements across calls, transactions\n * spanning round-trips) that PgBouncer's transaction-mode pooling drops.\n */\n databaseUrlUnpooled: string;\n}\n/**\n * Bits of a Neon Auth integration for the resolved branch. Only present on `NeonEnv`\n * when the branch policy enables `auth`.\n *\n * Neon Auth exposes the `baseUrl` (which doubles as the publishable client identifier) and\n * the `jwksUrl` used to verify tokens it issues. `fetchEnv` reads both from the live\n * integration; `parseEnv` reads them from `process.env` (`NEON_AUTH_BASE_URL` /\n * `NEON_AUTH_JWKS_URL`).\n */\ninterface NeonAuthEnv {\n baseUrl: string;\n /** JWKS URL for verifying tokens issued by Neon Auth (`NEON_AUTH_JWKS_URL`). */\n jwksUrl: string;\n}\n/** Bits of a Neon Data API integration. Only present when the branch policy enables it. */\ninterface NeonDataApiEnv {\n url: string;\n}\n/**\n * S3-compatible object-storage access for the branch. Present on `NeonEnv` only\n * when the policy declares `buckets` (or deprecated `preview.buckets`). Combines a minted branch credential's access\n * keys (`accessKeyId` = the credential's full token id, e.g. `nak_live_…`, which is what the\n * storage gateway authenticates against; `secretAccessKey` = its\n * `s3_secret_access_key`) with the branch's non-secret connection details\n * (`endpoint`/`region`, from `GET .../storage`). Projects to the AWS SDK's\n * standard config env (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL_S3`,\n * `AWS_REGION`) so the S3 client works from env alone. Neon's storage gateway always\n * requires path-style addressing, so set `forcePathStyle: true` on your S3 client.\n */\ninterface NeonStorageEnv {\n accessKeyId: string;\n secretAccessKey: string;\n /** S3-compatible endpoint URL for the branch. */\n endpoint: string;\n /** AWS region string (e.g. `us-east-2`). Injected as `AWS_REGION`. */\n region: string;\n}\n/**\n * AI Gateway access for the branch. Present on `NeonEnv` only when the policy\n * enables `aiGateway` (or deprecated `preview.aiGateway`). `apiKey` is the minted credential's bearer (`api_token`);\n * `baseUrl` is the bare branch-scoped gateway host\n * (`https://<branchId>-api.ai.<region>.…`, no path). Projects to the Neon-branded env\n * (`NEON_AI_GATEWAY_TOKEN`, `NEON_AI_GATEWAY_BASE_URL`); clients like `@neon/ai-sdk-provider`\n * append the dialect route (`/v1`, `/openai/v1`, `/anthropic/v1`) themselves.\n */\ninterface NeonAiGatewayEnv {\n apiKey: string;\n baseUrl: string;\n}\ninterface NeonFunctionUrlEnv {\n baseUrl: string;\n}\n/**\n * Empty record alias used as the \"false\" branch of the conditional namespace adds below.\n * `Record<never, never>` is the no-op for intersection — the cleaner alternative to `{}`,\n * which biome rejects (it means \"any non-null\", not \"empty object\").\n */\ntype NoNamespace = Record<never, never>;\n/**\n * Resolve a **static** service toggle (the value of `config.auth` / `config.dataApi`) to a\n * type-level boolean. The whole-thing wrapping (`[T] extends […]`) turns off distribution\n * so a union/`undefined` is checked as one unit:\n *\n * - `false` / `{ enabled: false }` / `undefined` → `false`\n * - `true` / `{ enabled: true }` / any other object (`{}`, `{ enabled?: boolean }`) → `true`\n * (a present toggle defaults to enabled)\n * - the bare `boolean | ServiceToggle | undefined` (the default `Config` param, no literal\n * info) → `false`, so an untyped policy yields just `{ postgres }`.\n */\ntype ServiceOn<T> = [T] extends [false] ? false : [T] extends [{\n enabled: false;\n}] ? false : [T] extends [undefined] ? false : [T] extends [true] ? true : [T] extends [{\n enabled: true;\n}] ? true : [T] extends [object] ? true : false;\n/** True when `T` has at least one known key; `false` for `{}` / `never`. */\ntype HasKeys<T> = [keyof T] extends [never] ? false : true;\ntype OrBool<A extends boolean, B extends boolean> = A extends true ? true : B;\n/**\n * Whether a top-level optional record (GA `functions` / `buckets`) has known keys.\n * A string index signature (`Record<string, …>`, the default `Config` param) is treated\n * as empty so an untyped policy yields just `{ postgres }`, matching {@link HasPreviewBuckets}.\n */\ntype HasGaRecord<T> = [NonNullable<T>] extends [never] ? false : string extends keyof NonNullable<T> ? false : HasKeys<NonNullable<T>>;\ntype HasGaToggle<T> = [NonNullable<T>] extends [never] ? false : ServiceOn<NonNullable<T>>;\n/**\n * Whether the policy declares at least one object-storage bucket (`buckets` or\n * deprecated `preview.buckets`). Drives whether {@link NeonEnv} carries the `storage`\n * namespace.\n *\n * The leading `[never]` guard is load-bearing: when a policy has no `preview` at all,\n * `NonNullable<C[\"preview\"]>` is `never`, and without the guard the `extends { … }` probe\n * below would vacuously match (everything extends `never`-derived shapes) and `HasKeys<never>`\n * would resolve `true`, wrongly adding the namespace. The guard short-circuits to `false`.\n */\ntype HasPreviewBuckets<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? false : NonNullable<C[\"preview\"]> extends {\n buckets: infer B;\n} ? HasKeys<NonNullable<B>> : false;\ntype HasBuckets<C extends Config> = OrBool<HasGaRecord<C[\"buckets\"]>, HasPreviewBuckets<C>>;\n/**\n * Whether the policy enables the AI Gateway (`aiGateway` or deprecated `preview.aiGateway`).\n * Drives whether {@link NeonEnv} carries the `aiGateway` namespace.\n */\ntype HasPreviewAiGateway<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? false : NonNullable<C[\"preview\"]> extends {\n aiGateway: infer A;\n} ? ServiceOn<NonNullable<A>> : false;\ntype AiGatewayOn<C extends Config> = OrBool<HasGaToggle<C[\"aiGateway\"]>, HasPreviewAiGateway<C>>;\n/** The tuple guard prevents a missing preview block from enabling functions. */\ntype HasPreviewFunctions<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? false : NonNullable<C[\"preview\"]> extends {\n functions: infer F;\n} ? HasKeys<NonNullable<F>> : false;\ntype HasFunctions<C extends Config> = OrBool<HasGaRecord<C[\"functions\"]>, HasPreviewFunctions<C>>;\ntype GaFunctionsOfConfig<C extends Config> = [NonNullable<C[\"functions\"]>] extends [never] ? Record<never, never> : string extends keyof NonNullable<C[\"functions\"]> ? Record<never, never> : NonNullable<C[\"functions\"]>;\ntype PreviewFunctionsOfConfig<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? Record<never, never> : NonNullable<C[\"preview\"]> extends {\n functions: infer F;\n} ? F : Record<never, never>;\ntype FunctionsOfConfig<C extends Config> = [keyof GaFunctionsOfConfig<C>] extends [never] ? PreviewFunctionsOfConfig<C> : [keyof PreviewFunctionsOfConfig<C>] extends [never] ? GaFunctionsOfConfig<C> : GaFunctionsOfConfig<C> & PreviewFunctionsOfConfig<C>;\ntype FunctionSlugOfConfig<C extends Config> = Extract<keyof FunctionsOfConfig<C>, string>;\ntype NeonFunctionsEnv<C extends Config> = { [S in FunctionSlugOfConfig<C>]: NeonFunctionUrlEnv };\ntype FunctionBaseUrlKeyOf<C extends Config> = FunctionSlugOfConfig<C> extends infer S ? S extends string ? FunctionBaseUrlKey<S> : never : never;\n/**\n * Static, namespaced shape of `fetchEnv` / `parseEnv`'s return value. Generic over the\n * {@link Config} so the type system knows which optional namespaces are present.\n *\n * Because the secret-bearing toggles now live in the **static** top-level `config.auth` /\n * `config.dataApi` (not inside a per-branch closure), the namespace presence is a direct\n * read of those fields — no union-across-branches, no default-config escape hatch:\n *\n * - `postgres` is always present.\n * - `auth` is added iff `config.auth` is statically enabled.\n * - `dataApi` is added iff `config.dataApi` is statically enabled.\n * - `storage` is added iff `config.buckets` (or deprecated `preview.buckets`) declares at least one bucket.\n * - `aiGateway` is added iff `config.aiGateway` (or deprecated `preview.aiGateway`) is statically enabled.\n * - `functions` is added iff `config.functions` (or deprecated `preview.functions`) declares at least one slug.\n */\ntype NeonEnv<C extends Config = Config> = {\n postgres: NeonPostgresEnv;\n /**\n * Branch identity (`NEON_BRANCH`). Optional because `parseEnv` only surfaces it when the\n * var was injected; `fetchEnv` always populates it.\n */\n branch?: NeonBranchEnv;\n} & (ServiceOn<NonNullable<C[\"auth\"]>> extends true ? {\n auth: NeonAuthEnv;\n} : NoNamespace) & (ServiceOn<NonNullable<C[\"dataApi\"]>> extends true ? {\n dataApi: NeonDataApiEnv;\n} : NoNamespace) & (HasBuckets<C> extends true ? {\n storage: NeonStorageEnv;\n} : NoNamespace) & (AiGatewayOn<C> extends true ? {\n aiGateway: NeonAiGatewayEnv;\n} : NoNamespace) & (HasFunctions<C> extends true ? {\n functions: NeonFunctionsEnv<C>;\n} : NoNamespace);\n/**\n * OS-level env-var keys grouped by the {@link NeonEnv} namespace they populate. Only the\n * **input** vars `parseEnv` validates are listed — the output-only aliases in\n * {@link NEON_ENV_VAR_KEYS} (`NEON_AI_GATEWAY_TOKEN`, …) are intentionally absent, so they\n * are not selectable in a `parseEnv(config, keys)` filter. Keep in sync with\n * {@link EnvKeyToProp}.\n */\ninterface EnvKeysByNamespace {\n postgres: \"DATABASE_URL\" | \"DATABASE_URL_UNPOOLED\";\n branch: \"NEON_BRANCH\";\n auth: \"NEON_AUTH_BASE_URL\" | \"NEON_AUTH_JWKS_URL\";\n dataApi: \"NEON_DATA_API_URL\";\n storage: \"AWS_ACCESS_KEY_ID\" | \"AWS_SECRET_ACCESS_KEY\" | \"AWS_ENDPOINT_URL_S3\" | \"AWS_REGION\";\n aiGateway: \"NEON_AI_GATEWAY_TOKEN\" | \"NEON_AI_GATEWAY_BASE_URL\";\n}\n/** The {@link NeonEnv} namespace interface backing each namespace key. */\ninterface NamespaceEnv {\n postgres: NeonPostgresEnv;\n branch: NeonBranchEnv;\n auth: NeonAuthEnv;\n dataApi: NeonDataApiEnv;\n storage: NeonStorageEnv;\n aiGateway: NeonAiGatewayEnv;\n}\n/** OS-level env-var key → the camelCase property it sets on its namespace object. */\ninterface EnvKeyToProp {\n DATABASE_URL: \"databaseUrl\";\n DATABASE_URL_UNPOOLED: \"databaseUrlUnpooled\";\n NEON_BRANCH: \"name\";\n NEON_AUTH_BASE_URL: \"baseUrl\";\n NEON_AUTH_JWKS_URL: \"jwksUrl\";\n NEON_DATA_API_URL: \"url\";\n AWS_ACCESS_KEY_ID: \"accessKeyId\";\n AWS_SECRET_ACCESS_KEY: \"secretAccessKey\";\n AWS_ENDPOINT_URL_S3: \"endpoint\";\n AWS_REGION: \"region\";\n NEON_AI_GATEWAY_TOKEN: \"apiKey\";\n NEON_AI_GATEWAY_BASE_URL: \"baseUrl\";\n}\n/**\n * The OS-level env-var keys selectable for a given policy: the union of input vars across\n * exactly the namespaces {@link NeonEnv}<C> carries. Drives the typesafe autocomplete of the\n * `keys` filter — selecting a var from a namespace the policy does not enable is a type error\n * (e.g. `NEON_AUTH_BASE_URL` is only offered once the policy turns on `auth`).\n */\ntype SelectableEnvKey<C extends Config> = EnvKeysByNamespace[keyof NeonEnv<C> & keyof EnvKeysByNamespace] | FunctionBaseUrlKeyOf<C>;\n/**\n * The result shape of a **filtered** `parseEnv(config, keys)` call: the namespaced\n * {@link NeonEnv} restricted to exactly the selected OS-level keys `K`. Namespaces with no\n * selected key are dropped, and within a kept namespace only the selected properties survive\n * — selecting just `[\"DATABASE_URL\"]` yields `{ postgres: { databaseUrl: string } }`, with no\n * `databaseUrlUnpooled`.\n *\n * The policy gating lives on the `parseEnv` overload (which binds `K` to\n * {@link SelectableEnvKey}); this type only needs the selection, so it takes a bare\n * `K extends string` and filters with `Extract`. The outer mapped type's `as` clause drops\n * any namespace whose intersection with the selection is empty (`[…] extends [never]`,\n * tuple-wrapped to switch off distribution); the inner one re-keys each selected OS var to its\n * camelCase property and looks the value type up on the canonical namespace interface, so it\n * stays correct if a field ever stops being a plain `string`.\n */\ntype SelectedFunctionKeys<K extends string> = Extract<K, FunctionBaseUrlKey>;\ntype FunctionSlugFromKey<K extends string> = K extends `NEON_FUNCTION_${infer S}_BASE_URL` ? Lowercase<S> : never;\ntype FunctionsFilteredEnv<K extends string> = [SelectedFunctionKeys<K>] extends [never] ? unknown : {\n functions: { [P in SelectedFunctionKeys<K> as FunctionSlugFromKey<P>]: NeonFunctionUrlEnv };\n};\ntype OptionalFunctionsFilteredEnv<K extends string> = [SelectedFunctionKeys<K>] extends [never] ? unknown : {\n functions?: { [P in SelectedFunctionKeys<K> as FunctionSlugFromKey<P>]?: NeonFunctionUrlEnv };\n};\ntype FilteredNeonEnv<K extends string> = { [N in keyof EnvKeysByNamespace as [Extract<K, EnvKeysByNamespace[N]>] extends [never] ? never : N]: { [P in Extract<K, EnvKeysByNamespace[N]> as EnvKeyToProp[P & keyof EnvKeyToProp]]: NamespaceEnv[N][EnvKeyToProp[P & keyof EnvKeyToProp] & keyof NamespaceEnv[N]] } } & FunctionsFilteredEnv<K>;\n/**\n * A filtered result when the exact runtime contents of a key array are unknown. Both the\n * namespace and its selected properties are optional because the array may omit any member of\n * its element union, or be empty.\n */\ntype OptionalFilteredNeonEnv<K extends string> = { [N in keyof EnvKeysByNamespace as [Extract<K, EnvKeysByNamespace[N]>] extends [never] ? never : N]?: { [P in Extract<K, EnvKeysByNamespace[N]> as EnvKeyToProp[P & keyof EnvKeyToProp]]?: NamespaceEnv[N][EnvKeyToProp[P & keyof EnvKeyToProp] & keyof NamespaceEnv[N]] } } & OptionalFunctionsFilteredEnv<K>;\n/** Whether `T` is a union rather than one concrete type. */\ntype IsUnion<T, Whole = T> = T extends Whole ? [Whole] extends [T] ? false : true : never;\n/** Whether any fixed tuple position can hold more than one key at runtime. */\ntype TupleHasUnion<T extends readonly unknown[]> = T extends readonly [] ? false : T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? true extends IsUnion<Head> ? true : TupleHasUnion<Tail> : true;\n/**\n * The sound result of selecting an array of OS-level env-var keys.\n *\n * Inline literal tuples remain exact. Widened arrays, rest tuples, and tuple positions whose\n * value is a union are conservative because their runtime contents may be any subset of the\n * element type. The leading conditional distributes unions of whole literal tuples, preserving\n * each exact alternative.\n */\ntype SelectedNeonEnv<Keys extends readonly string[]> = Keys extends readonly string[] ? number extends Keys[\"length\"] ? OptionalFilteredNeonEnv<Keys[number]> : TupleHasUnion<Keys> extends true ? OptionalFilteredNeonEnv<Keys[number]> : FilteredNeonEnv<Keys[number]> : never;\ntype StorageCredentialEnvKey = \"AWS_ACCESS_KEY_ID\" | \"AWS_SECRET_ACCESS_KEY\";\ntype StorageKeyPairError = {\n readonly \"fetchEnv keys must include AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY together\": never;\n};\ntype TupleDefinitelyContains<Keys extends readonly string[], Key extends string> = Keys extends readonly [infer Head extends string, ...infer Tail extends readonly string[]] ? [Head] extends [Key] ? true : TupleDefinitelyContains<Tail, Key> : false;\ntype TupleDefinitelyContainsStoragePair<Keys extends readonly string[]> = TupleDefinitelyContains<Keys, \"AWS_ACCESS_KEY_ID\"> extends true ? TupleDefinitelyContains<Keys, \"AWS_SECRET_ACCESS_KEY\"> extends true ? true : false : false;\n/**\n * Reject a fixed key tuple that contains only one half of the storage credential. Dynamic\n * arrays are checked at runtime because their contents are not known to TypeScript.\n */\ntype InvalidStorageKeyTuple<Keys extends readonly string[]> = Keys extends unknown ? number extends Keys[\"length\"] ? never : [Extract<Keys[number], StorageCredentialEnvKey>] extends [never] ? never : TupleDefinitelyContainsStoragePair<Keys> extends true ? never : Keys : never;\ntype StorageKeyPairConstraint<Keys extends readonly string[]> = [InvalidStorageKeyTuple<Keys>] extends [never] ? unknown : StorageKeyPairError;\ntype FetchEnvKeysFromArgs<Args extends readonly unknown[]> = Args[0] extends {\n keys: infer Keys extends readonly string[];\n} ? Keys : never;\ntype StorageKeyPairArgsConstraint<Args extends readonly unknown[]> = StorageKeyPairConstraint<FetchEnvKeysFromArgs<Args>>;\n/** Preserve the same pair rule for callers that explicitly provide the legacy `K` generic. */\ntype StorageKeyUnionConstraint<K extends string> = [Extract<K, StorageCredentialEnvKey>] extends [never] ? unknown : StorageCredentialEnvKey extends K ? unknown : StorageKeyPairError;\ninterface FetchEnvOptions {\n /**\n * Neon project id. **Required** — the management API addresses branches through their\n * project. Resolve it in your CLI (e.g. neonctl) and pass it in.\n */\n projectId: string;\n /**\n * Neon branch — its **name** (e.g. `main`) or its id (`br-…`). **Required** (or pass the\n * legacy {@link FetchEnvOptions.branchId}). Resolved against the project's branches by\n * id first, then by name, so either form works.\n */\n branch?: string;\n /**\n * @deprecated Legacy id-only field. Prefer {@link FetchEnvOptions.branch}, which accepts\n * a branch name or id. Still honored for backward compatibility; ignored when `branch`\n * is set.\n */\n branchId?: string;\n /**\n * Neon API key. Resolved via the standard chain (option → `NEON_API_KEY` →\n * `~/.config/neonctl/credentials.json`) when omitted. Ignored when a custom `api`\n * is supplied.\n */\n apiKey?: string;\n /**\n * Neon **management** API base URL (not the Auth base URL). Falls back to\n * `NEON_API_HOST`, then production. Ignored when a custom `api` is supplied.\n */\n apiHost?: string;\n /**\n * Inject a custom NeonApi adapter. Primarily used by tests; production callers can rely\n * on the default real adapter built from `apiKey`.\n */\n api?: NeonApi;\n /**\n * Role name to fetch credentials for. When omitted, the connection role is auto-picked:\n * the only role on the branch, else Neon's default owner (`neondb_owner`), else the\n * single role left after dropping the managed Auth/Data API roles\n * (`authenticator`/`anonymous`/`authenticated`). Throws {@link PlatformError} with\n * `PLATFORM_AMBIGUOUS_BRANCH_AUTH` only when more than one app role remains.\n */\n roleName?: string;\n /**\n * Database name. When omitted, it is auto-picked: Neon's default `neondb` if present,\n * else the only database on the branch. Throws {@link PlatformError} with\n * `PLATFORM_AMBIGUOUS_BRANCH_AUTH` when the branch has several databases and none is\n * `neondb` (pass `databaseName` to disambiguate), and `PLATFORM_BRANCH_NOT_FOUND` when\n * the branch has no databases or the requested `databaseName` does not exist.\n */\n databaseName?: string;\n}\n/**\n * Resolve the project + branch this process should target, then fetch live Neon\n * connection strings for that branch over the network. Async — calls the Neon API.\n *\n * Use this from build scripts and the `neon-env run` command, where top-level await is\n * fine. For application code that needs a synchronous bootstrap (most frameworks: Drizzle\n * config, Next.js, Vite, etc.), inject env vars via `neon-env run -- <cmd>` and use\n * {@link parseEnv} instead — same {@link NeonEnv} shape, but a sync call against\n * `process.env`.\n *\n * Filesystem- and env-agnostic: pass `projectId` and the target `branch` (name or id)\n * explicitly (resolve them in your CLI, e.g. neonctl).\n *\n * ```ts\n * import config from \"../neon\";\n * import { fetchEnv } from \"@neon/env\";\n *\n * const env = await fetchEnv(config, { projectId: \"patient-art-12345\", branch: \"main\" });\n * const db = drizzle(neon(env.postgres.databaseUrl), { schema });\n * ```\n *\n * Pass `keys` to fetch only some of them — see the overload below.\n *\n * The package does **not** read `process.env`, mutate it, or touch the filesystem. Everything\n * it returns comes from the Neon API, so a value the API cannot produce (a one-time secret\n * issued to a previous call) is minted afresh rather than recovered. Callers that hold\n * persisted secrets and want to keep them use {@link fetchEnvReusingSecrets}, which decides\n * what is still valid and narrows this call's `keys` accordingly.\n */\ndeclare function fetchEnv<const C extends Config, const Args extends readonly [options: FetchEnvOptions & {\n /**\n * Fetch only these OS-level env vars, instead of everything the policy enables. The\n * keys autocomplete from the policy ({@link SelectableEnvKey}), and the result is\n * narrowed to match ({@link SelectedNeonEnv}). Inline literal arrays produce an exact\n * result; runtime-built arrays make their possible namespaces and properties optional.\n * `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` must be selected together.\n *\n * The point is not just a smaller result: **work is skipped too.** Leave out\n * `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `NEON_AI_GATEWAY_TOKEN` and no branch\n * credential is minted at all, so a caller that already holds valid secrets can refresh\n * everything else without issuing a new one. The non-secret vars of the same features\n * (`AWS_ENDPOINT_URL_S3`, `AWS_REGION`, `NEON_AI_GATEWAY_BASE_URL`) are not\n * credential-backed and stay available on their own.\n *\n * The selection **intersects** with the policy rather than overriding it: naming a var\n * the branch policy does not enable is not an error, it simply yields nothing.\n */\n keys: readonly SelectableEnvKey<C>[];\n}]>(config: C, ...args: Args & StorageKeyPairArgsConstraint<NoInfer<Args>>): Promise<SelectedNeonEnv<FetchEnvKeysFromArgs<NoInfer<Args>>>>;\ndeclare function fetchEnv<const C extends Config, const K extends SelectableEnvKey<C> = never>(config: C, options: [NoInfer<K>] extends [never] ? never : FetchEnvOptions & {\n keys: readonly NoInfer<K>[];\n} & StorageKeyUnionConstraint<NoInfer<K>>): Promise<FilteredNeonEnv<NoInfer<K>>>;\ndeclare function fetchEnv<const C extends Config>(config: C, options: FetchEnvOptions & {\n keys?: never;\n}): Promise<NeonEnv<C>>;\n/** Diagnostic-only fallback: valid keyed calls resolve through the exact overload above. */\ndeclare function fetchEnv<const C extends Config, const Keys extends readonly SelectableEnvKey<C>[]>(config: C, options: FetchEnvOptions & {\n keys: Keys;\n} & StorageKeyPairError): Promise<never>;\n/**\n * The {@link fetchEnv} body, with the key selection as a plain argument and no generic\n * narrowing. Exists for callers that compute the selection at runtime — notably\n * {@link fetchEnvReusingSecrets}, which decides which keys it still needs by checking the\n * branch — since the public overload's `keys` is bound to a literal union those callers cannot\n * produce without asserting.\n *\n * `keys === null` selects everything the policy enables.\n */\ndeclare function fetchEnvKeys(config: Config, options: FetchEnvKeysOptions, keys: readonly string[] | null): Promise<ResolvedNeonEnv>;\ntype FetchEnvKeysState = {\n env: ResolvedNeonEnv;\n /** Prevents endpoint failure from being mistaken for a confirmed empty function list. */\n functionUrlsUnavailable: boolean;\n};\ntype FetchEnvKeysOptions = FetchEnvOptions & {\n functionUrls?: FunctionUrlMode;\n /**\n * Keys to skip even when {@link fetchEnvKeys} is unscoped (`keys === null`).\n * {@link fetchEnvReusingSecrets} uses this to keep already-verified secrets\n * without converting an unscoped fetch into a static policy-key list — that\n * list cannot name `NEON_FUNCTION_*_BASE_URL`, so it would drop function URLs.\n */\n omitKeys?: readonly string[];\n /**\n * Skip a second `listBranchFunctions` when the caller already listed.\n * `--service functions` uses this so a later `FeatureUnavailable` cannot be\n * swallowed as `skipped`.\n */\n listedFunctions?: ReadonlyArray<{\n slug: string;\n invocationUrl: string;\n }>;\n};\n/**\n * `policy` is the {@link resolveBranchPolicy} result for this same `config` and branch, when\n * the caller already has it.\n */\ndeclare function fetchEnvKeysState(config: Config, options: FetchEnvKeysOptions, keys: readonly string[] | null, policy?: BranchPolicy): Promise<FetchEnvKeysState>;\ntype BranchPolicy = {\n branch: NeonBranchSnapshot;\n desired: ReturnType<typeof resolveConfig>;\n};\n/**\n * Resolve the target branch and evaluate the policy against it — the first thing any\n * branch-scoped operation needs. Shared by {@link fetchEnv} and {@link fetchEnvReusingSecrets}\n * so the two agree on which branch they're talking about and what it has enabled.\n */\ndeclare function resolveBranchPolicy(config: Config, options: Pick<FetchEnvOptions, \"projectId\" | \"branch\" | \"branchId\">, api: NeonApi, /** The target branch, when the caller listed it already. */\nresolved?: NeonBranchSnapshot): Promise<BranchPolicy>;\n/**\n * Scopes a minted fallback credential should carry. Only object storage and the AI Gateway\n * *require* secrets; functions never force a credential. `functions:invoke` rides along only\n * when this path still has to mint (defaults already cover storage and the gateway).\n */\ndeclare function previewCredentialScopes(preview: ResolvedPreviewConfig | undefined, selected?: {\n storage: boolean;\n aiGateway: boolean;\n}): CredentialScope[];\n/** The `name` this tool stamps on every credential it mints, so it can recognize its own. */\ndeclare function credentialName(branchName: string): string;\n/** The env-var keys a branch credential's secrets surface under, in emit order. */\ndeclare function credentialEnvKeys(flags: {\n storage: boolean;\n aiGateway: boolean;\n}): string[];\n/**\n * Every OS-level env var a resolved branch policy produces, in emit order. Lets a caller\n * subtract the ones it already holds and pass the rest as {@link fetchEnv}'s `keys`, without\n * re-deriving which vars a policy implies.\n */\ndeclare function policyEnvKeys(desired: ReturnType<typeof resolveConfig>): string[];\n/** Whether an issued credential can still be used: not revoked, not past its expiry. */\ndeclare function isLiveCredential(meta: NeonCredentialMeta, now: number): boolean;\ndeclare function defaultStorageCredential(live: readonly NeonCredentialMeta[], now: number): NeonCredentialMeta | null;\ndeclare function defaultAiGatewayCredential(live: readonly NeonCredentialMeta[], now: number): NeonCredentialMeta | null;\ndeclare function createApiFromOptions(options: FetchEnvOptions): NeonApi;\n/**\n * Project a fully-resolved {@link NeonEnv} into the OS-level `{ KEY: value }` pairs used\n * for cross-process transport. Named after the web-platform `.entries()` convention\n * (`URLSearchParams` / `Headers` / `FormData`); returns a `Record` rather than an\n * iterator of tuples since that's the shape env injection needs (wrap with\n * `Object.entries(...)` if you want literal `[key, value]` pairs). Used by `neon-env run`\n * to inject the vars into a subprocess's `process.env`.\n *\n * Walks the value at runtime so it works for any `NeonEnv<C>` regardless of which\n * conditional namespaces are present.\n */\ndeclare function toEntries(env: ResolvedNeonEnv): Record<string, string>;\n/**\n * Any resolved env {@link toEntries} can project: a full {@link NeonEnv}, or the narrowed\n * result of a `keys`-filtered {@link fetchEnv} / {@link parseEnv} call. Every namespace and\n * property is optional so a filtered result — which legitimately carries only what was asked\n * for — projects to exactly the vars it holds instead of failing to type-check.\n */\ntype ResolvedNeonEnv = { [N in keyof NamespaceEnv]?: Partial<NamespaceEnv[N]> } & {\n functions?: Record<string, NeonFunctionUrlEnv>;\n};\n//#endregion\nexport { BranchPolicy, FetchEnvKeysOptions, FetchEnvKeysState, FetchEnvOptions, FilteredNeonEnv, FunctionBaseUrlKey, FunctionUrlMode, NEON_ENV_VAR_KEYS, NeonAiGatewayEnv, NeonAuthEnv, NeonBranchEnv, NeonDataApiEnv, NeonEnv, NeonFunctionUrlEnv, NeonFunctionsEnv, NeonPostgresEnv, NeonStorageEnv, ResolvedNeonEnv, SelectableEnvKey, SelectedNeonEnv, createApiFromOptions, credentialEnvKeys, credentialName, defaultAiGatewayCredential, defaultStorageCredential, fetchEnv, fetchEnvKeys, fetchEnvKeysState, functionBaseUrlKey, isFunctionBaseUrlKey, isLiveCredential, parseFunctionBaseUrlKey, policyEnvKeys, previewCredentialScopes, resolveBranchPolicy, toEntries };\n//# sourceMappingURL=env.d.ts.map",null],"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fig","resolveConfig","NEON_ENV_VAR_KEYS","FunctionBaseUrlKey","Slug","Uppercase","functionBaseUrlKey","S","parseFunctionBaseUrlKey","isFunctionBaseUrlKey","FunctionUrlMode","NeonBranchEnv","NeonPostgresEnv","NeonAuthEnv","NeonDataApiEnv","NeonRealtimeEnv","NeonStorageEnv","NeonAiGatewayEnv","NeonFunctionUrlEnv","NoNamespace","Record","ServiceOn","T","HasKeys","OrBool","A","B","HasGaRecord","NonNullable","HasGaToggle","HasPreviewBuckets","C","HasBuckets","HasPreviewAiGateway","RealtimeOn","R","AiGatewayOn","HasPreviewFunctions","F","HasFunctions","GaFunctionsOfConfig","PreviewFunctionsOfConfig","FunctionsOfConfig","FunctionSlugOfConfig","Extract","NeonFunctionsEnv","FunctionBaseUrlKeyOf","NeonEnv","EnvKeysByNamespace","NamespaceEnv","EnvKeyToProp","SelectableEnvKey","SelectedFunctionKeys","K","FunctionSlugFromKey","Lowercase","FunctionsFilteredEnv","P","OptionalFunctionsFilteredEnv","FilteredNeonEnv","N","OptionalFilteredNeonEnv","IsUnion","Whole","TupleHasUnion","Head","Tail","SelectedNeonEnv","Keys","StorageCredentialEnvKey","StorageKeyPairError","TupleDefinitelyContains","Key","TupleDefinitelyContainsStoragePair","InvalidStorageKeyTuple","StorageKeyPairConstraint","FetchEnvKeysFromArgs","Args","StorageKeyPairArgsConstraint","StorageKeyUnionConstraint","FetchEnvOptions","fetchEnv","NoInfer","Promise","fetchEnvKeys","FetchEnvKeysOptions","ResolvedNeonEnv","FetchEnvKeysState","ReadonlyArray","fetchEnvKeysState","BranchPolicy","ReturnType","resolveBranchPolicy","Pick","previewCredentialScopes","credentialName","credentialEnvKeys","policyEnvKeys","isLiveCredential","defaultStorageCredential","defaultAiGatewayCredential","createApiFromOptions","toEntries","Partial","Config","FilteredNeonEnv","NeonEnv","SelectableEnvKey","GaFunctionsOf","C","NonNullable","Record","PreviewFunctionsHome","F","PreviewFunctionsOf","FunctionSlugOf","Extract","NoFunctionScopeHint","FunctionScopeField","S","FunctionEnvKeysOf","E","ParsedNeonEnv","Omit","NeonFunctionEnv","parseEnv","K","Config","NeonApi","resolveConfig","NEON_ENV_VAR_KEYS","branch","name","postgres","databaseUrl","databaseUrlUnpooled","auth","baseUrl","jwksUrl","dataApi","url","realtime","secret","storage","accessKeyId","secretAccessKey","endpoint","region","aiGateway","apiKey","FunctionBaseUrlKey","Uppercase","Slug","functionBaseUrlKey","slug","S","parseFunctionBaseUrlKey","key","isFunctionBaseUrlKey","NeonBranchEnv","NeonPostgresEnv","NeonAuthEnv","NeonDataApiEnv","NeonRealtimeEnv","NeonStorageEnv","NeonAiGatewayEnv","NeonFunctionUrlEnv","NoNamespace","Record","ServiceOn","T","enabled","HasKeys","OrBool","A","B","HasGaRecord","NonNullable","HasGaToggle","HasPreviewBuckets","C","buckets","HasBuckets","HasPreviewAiGateway","RealtimeOn","R","AiGatewayOn","HasPreviewFunctions","functions","F","HasFunctions","GaFunctionsOfConfig","PreviewFunctionsOfConfig","FunctionsOfConfig","FunctionSlugOfConfig","Extract","NeonFunctionsEnv","FunctionBaseUrlKeyOf","NeonEnv","EnvKeysByNamespace","NamespaceEnv","EnvKeyToProp","DATABASE_URL","DATABASE_URL_UNPOOLED","NEON_BRANCH","NEON_AUTH_BASE_URL","NEON_AUTH_JWKS_URL","NEON_DATA_API_URL","NEON_REALTIME_URL","NEON_REALTIME_SECRET","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_ENDPOINT_URL_S3","AWS_REGION","NEON_AI_GATEWAY_TOKEN","NEON_AI_GATEWAY_BASE_URL","SelectableEnvKey","SelectedFunctionKeys","K","FunctionSlugFromKey","Lowercase","FunctionsFilteredEnv","P","OptionalFunctionsFilteredEnv","FilteredNeonEnv","N","OptionalFilteredNeonEnv","IsUnion","Whole","TupleHasUnion","Head","Tail","SelectedNeonEnv","Keys","StorageCredentialEnvKey","StorageKeyPairError","TupleDefinitelyContains","Key","TupleDefinitelyContainsStoragePair","InvalidStorageKeyTuple","StorageKeyPairConstraint","FetchEnvKeysFromArgs","Args","keys","StorageKeyPairArgsConstraint","StorageKeyUnionConstraint","FetchEnvOptions","projectId","branchId","apiHost","api","roleName","databaseName","fetchEnv","options","config","args","NoInfer","Promise","toEntries","env","ResolvedNeonEnv","Partial","GaFunctionsOf","PreviewFunctionsHome","PreviewFunctionsOf","FunctionSlugOf","NoFunctionScopeHint","FunctionScopeField","FunctionEnvKeysOf","E","ParsedNeonEnv","Omit","NeonFunctionEnv","function","parseEnv","scope"],"sources":["../../../internals/env-core/dist/env.d.ts","../src/lib/parse-env.ts"],"sourcesContent":["import { Config, CredentialScope, NeonApi, NeonBranchSnapshot, NeonCredentialMeta, ResolvedPreviewConfig, resolveConfig } from \"@neon/config/v1\";\n\n//#region src/env.d.ts\n\ndeclare const NEON_ENV_VAR_KEYS: {\n /**\n * Branch identity. `NEON_BRANCH` carries the branch **name** and is injected into the\n * Neon Functions runtime on every branch (including the default) by default. `env pull` /\n * `neon dev` / `neon-env run` emit it too so local dev mirrors the deployed runtime.\n */\n readonly branch: {\n readonly name: \"NEON_BRANCH\";\n };\n readonly postgres: {\n readonly databaseUrl: \"DATABASE_URL\";\n readonly databaseUrlUnpooled: \"DATABASE_URL_UNPOOLED\";\n };\n readonly auth: {\n readonly baseUrl: \"NEON_AUTH_BASE_URL\";\n readonly jwksUrl: \"NEON_AUTH_JWKS_URL\";\n };\n readonly dataApi: {\n readonly url: \"NEON_DATA_API_URL\";\n };\n readonly realtime: {\n readonly url: \"NEON_REALTIME_URL\";\n readonly secret: \"NEON_REALTIME_SECRET\";\n };\n /**\n * Object storage (Preview). The S3 SDKs read `AWS_*` from their standard config chain, so\n * a branch credential + `neon dev` / `env pull` makes object storage work from env alone.\n * `region` is injected under the SDK-standard `AWS_REGION`.\n */\n readonly storage: {\n readonly accessKeyId: \"AWS_ACCESS_KEY_ID\";\n readonly secretAccessKey: \"AWS_SECRET_ACCESS_KEY\";\n readonly endpoint: \"AWS_ENDPOINT_URL_S3\";\n readonly region: \"AWS_REGION\";\n };\n /**\n * AI Gateway (Preview). Exposed under the Neon-branded env vars the deployed Functions\n * runtime injects: `apiKey` is the minted credential's bearer (`NEON_AI_GATEWAY_TOKEN`)\n * and `baseUrl` is the bare branch gateway host (`NEON_AI_GATEWAY_BASE_URL`,\n * `scheme://host`, no path). Clients like `@neon/ai-sdk-provider` read these and append the\n * dialect route (`/v1`, `/openai/v1`, `/anthropic/v1`) themselves (https://github.com/vercel/ai/pull/15997).\n */\n readonly aiGateway: {\n readonly apiKey: \"NEON_AI_GATEWAY_TOKEN\";\n readonly baseUrl: \"NEON_AI_GATEWAY_BASE_URL\";\n };\n};\ntype FunctionBaseUrlKey<Slug extends string = string> = `NEON_FUNCTION_${Uppercase<Slug>}_BASE_URL`;\ndeclare function functionBaseUrlKey<S extends string>(slug: S): FunctionBaseUrlKey<S>;\ndeclare function parseFunctionBaseUrlKey(key: string): string | null;\ndeclare function isFunctionBaseUrlKey(key: string): key is FunctionBaseUrlKey;\n/** `all-live` lists deployed functions. Policy mode derives declared slugs from the connection host. */\ntype FunctionUrlMode = \"policy\" | \"all-live\";\n/**\n * Branch identity for the resolved branch. Always present on a `fetchEnv` result (the branch\n * name is always known); on a `parseEnv` result it's present only when `NEON_BRANCH` was\n * injected into `process.env` (the Functions runtime injects it by default, as do `neon dev` /\n * `neon-env run` / `env pull`). `name` is the branch **name** (e.g. `main`, `preview/foo`).\n */\ninterface NeonBranchEnv {\n name: string;\n}\n/** Per-namespace inner shapes. Exposed so consumers can name the parts independently. */\ninterface NeonPostgresEnv {\n /**\n * Pooled connection string (via Neon's PgBouncer pooler). The right default for\n * serverless drivers (`@neondatabase/serverless`, edge runtimes, Postgres.js, …).\n */\n databaseUrl: string;\n /**\n * Direct (unpooled) connection string. Use this when you need session-level\n * features (`LISTEN`/`NOTIFY`, prepared statements across calls, transactions\n * spanning round-trips) that PgBouncer's transaction-mode pooling drops.\n */\n databaseUrlUnpooled: string;\n}\n/**\n * Bits of a Neon Auth integration for the resolved branch. Only present on `NeonEnv`\n * when the branch policy enables `auth`.\n *\n * Neon Auth exposes the `baseUrl` (which doubles as the publishable client identifier) and\n * the `jwksUrl` used to verify tokens it issues. `fetchEnv` reads both from the live\n * integration; `parseEnv` reads them from `process.env` (`NEON_AUTH_BASE_URL` /\n * `NEON_AUTH_JWKS_URL`).\n */\ninterface NeonAuthEnv {\n baseUrl: string;\n /** JWKS URL for verifying tokens issued by Neon Auth (`NEON_AUTH_JWKS_URL`). */\n jwksUrl: string;\n}\n/** Bits of a Neon Data API integration. Only present when the branch policy enables it. */\ninterface NeonDataApiEnv {\n url: string;\n}\n/** Connection values for a branch with Realtime enabled. */\ninterface NeonRealtimeEnv {\n /** WebSocket endpoint passed to `createRealtimeClient`. */\n url: string;\n /** Server-only key passed to `createRealtime`. Never expose it to browser code. */\n secret: string;\n}\n/**\n * S3-compatible object-storage access for the branch. Present on `NeonEnv` only\n * when the policy declares `buckets` (or deprecated `preview.buckets`). Combines a minted branch credential's access\n * keys (`accessKeyId` = the credential's full token id, e.g. `nak_live_…`, which is what the\n * storage gateway authenticates against; `secretAccessKey` = its\n * `s3_secret_access_key`) with the branch's non-secret connection details\n * (`endpoint`/`region`, from `GET .../storage`). Projects to the AWS SDK's\n * standard config env (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL_S3`,\n * `AWS_REGION`) so the S3 client works from env alone. Neon's storage gateway always\n * requires path-style addressing, so set `forcePathStyle: true` on your S3 client.\n */\ninterface NeonStorageEnv {\n accessKeyId: string;\n secretAccessKey: string;\n /** S3-compatible endpoint URL for the branch. */\n endpoint: string;\n /** AWS region string (e.g. `us-east-2`). Injected as `AWS_REGION`. */\n region: string;\n}\n/**\n * AI Gateway access for the branch. Present on `NeonEnv` only when the policy\n * enables `aiGateway` (or deprecated `preview.aiGateway`). `apiKey` is the minted credential's bearer (`api_token`);\n * `baseUrl` is the bare branch-scoped gateway host\n * (`https://<branchId>-api.ai.<region>.…`, no path). Projects to the Neon-branded env\n * (`NEON_AI_GATEWAY_TOKEN`, `NEON_AI_GATEWAY_BASE_URL`); clients like `@neon/ai-sdk-provider`\n * append the dialect route (`/v1`, `/openai/v1`, `/anthropic/v1`) themselves.\n */\ninterface NeonAiGatewayEnv {\n apiKey: string;\n baseUrl: string;\n}\ninterface NeonFunctionUrlEnv {\n baseUrl: string;\n}\n/**\n * Empty record alias used as the \"false\" branch of the conditional namespace adds below.\n * `Record<never, never>` is the no-op for intersection — the cleaner alternative to `{}`,\n * which biome rejects (it means \"any non-null\", not \"empty object\").\n */\ntype NoNamespace = Record<never, never>;\n/**\n * Resolve a **static** service toggle (the value of `config.auth` / `config.dataApi`) to a\n * type-level boolean. The whole-thing wrapping (`[T] extends […]`) turns off distribution\n * so a union/`undefined` is checked as one unit:\n *\n * - `false` / `{ enabled: false }` / `undefined` → `false`\n * - `true` / `{ enabled: true }` / any other object (`{}`, `{ enabled?: boolean }`) → `true`\n * (a present toggle defaults to enabled)\n * - the bare `boolean | ServiceToggle | undefined` (the default `Config` param, no literal\n * info) → `false`, so an untyped policy yields just `{ postgres }`.\n */\ntype ServiceOn<T> = [T] extends [false] ? false : [T] extends [{\n enabled: false;\n}] ? false : [T] extends [undefined] ? false : [T] extends [true] ? true : [T] extends [{\n enabled: true;\n}] ? true : [T] extends [object] ? true : false;\n/** True when `T` has at least one known key; `false` for `{}` / `never`. */\ntype HasKeys<T> = [keyof T] extends [never] ? false : true;\ntype OrBool<A extends boolean, B extends boolean> = A extends true ? true : B;\n/**\n * Whether a top-level optional record (GA `functions` / `buckets`) has known keys.\n * A string index signature (`Record<string, …>`, the default `Config` param) is treated\n * as empty so an untyped policy yields just `{ postgres }`, matching {@link HasPreviewBuckets}.\n */\ntype HasGaRecord<T> = [NonNullable<T>] extends [never] ? false : string extends keyof NonNullable<T> ? false : HasKeys<NonNullable<T>>;\ntype HasGaToggle<T> = [NonNullable<T>] extends [never] ? false : ServiceOn<NonNullable<T>>;\n/**\n * Whether the policy declares at least one object-storage bucket (`buckets` or\n * deprecated `preview.buckets`). Drives whether {@link NeonEnv} carries the `storage`\n * namespace.\n *\n * The leading `[never]` guard is load-bearing: when a policy has no `preview` at all,\n * `NonNullable<C[\"preview\"]>` is `never`, and without the guard the `extends { … }` probe\n * below would vacuously match (everything extends `never`-derived shapes) and `HasKeys<never>`\n * would resolve `true`, wrongly adding the namespace. The guard short-circuits to `false`.\n */\ntype HasPreviewBuckets<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? false : NonNullable<C[\"preview\"]> extends {\n buckets: infer B;\n} ? HasKeys<NonNullable<B>> : false;\ntype HasBuckets<C extends Config> = OrBool<HasGaRecord<C[\"buckets\"]>, HasPreviewBuckets<C>>;\n/**\n * Whether the policy enables the AI Gateway (`aiGateway` or deprecated `preview.aiGateway`).\n * Drives whether {@link NeonEnv} carries the `aiGateway` namespace.\n */\ntype HasPreviewAiGateway<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? false : NonNullable<C[\"preview\"]> extends {\n aiGateway: infer A;\n} ? ServiceOn<NonNullable<A>> : false;\n/** Whether the policy statically enables Realtime under `preview.realtime`. */\ntype RealtimeOn<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? false : NonNullable<C[\"preview\"]> extends {\n realtime: infer R;\n} ? ServiceOn<NonNullable<R>> : false;\ntype AiGatewayOn<C extends Config> = OrBool<HasGaToggle<C[\"aiGateway\"]>, HasPreviewAiGateway<C>>;\n/** The tuple guard prevents a missing preview block from enabling functions. */\ntype HasPreviewFunctions<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? false : NonNullable<C[\"preview\"]> extends {\n functions: infer F;\n} ? HasKeys<NonNullable<F>> : false;\ntype HasFunctions<C extends Config> = OrBool<HasGaRecord<C[\"functions\"]>, HasPreviewFunctions<C>>;\ntype GaFunctionsOfConfig<C extends Config> = [NonNullable<C[\"functions\"]>] extends [never] ? Record<never, never> : string extends keyof NonNullable<C[\"functions\"]> ? Record<never, never> : NonNullable<C[\"functions\"]>;\ntype PreviewFunctionsOfConfig<C extends Config> = [NonNullable<C[\"preview\"]>] extends [never] ? Record<never, never> : NonNullable<C[\"preview\"]> extends {\n functions: infer F;\n} ? F : Record<never, never>;\ntype FunctionsOfConfig<C extends Config> = [keyof GaFunctionsOfConfig<C>] extends [never] ? PreviewFunctionsOfConfig<C> : [keyof PreviewFunctionsOfConfig<C>] extends [never] ? GaFunctionsOfConfig<C> : GaFunctionsOfConfig<C> & PreviewFunctionsOfConfig<C>;\ntype FunctionSlugOfConfig<C extends Config> = Extract<keyof FunctionsOfConfig<C>, string>;\ntype NeonFunctionsEnv<C extends Config> = { [S in FunctionSlugOfConfig<C>]: NeonFunctionUrlEnv };\ntype FunctionBaseUrlKeyOf<C extends Config> = FunctionSlugOfConfig<C> extends infer S ? S extends string ? FunctionBaseUrlKey<S> : never : never;\n/**\n * Static, namespaced shape of `fetchEnv` / `parseEnv`'s return value. Generic over the\n * {@link Config} so the type system knows which optional namespaces are present.\n *\n * Because the secret-bearing toggles live in the **static** config (not inside a per-branch\n * closure), namespace presence is a direct read of those fields — no union-across-branches,\n * no default-config escape hatch:\n *\n * - `postgres` is always present.\n * - `auth` is added iff `config.auth` is statically enabled.\n * - `dataApi` is added iff `config.dataApi` is statically enabled.\n * - `realtime` is added iff `config.preview.realtime` is statically enabled.\n * - `storage` is added iff `config.buckets` (or deprecated `preview.buckets`) declares at least one bucket.\n * - `aiGateway` is added iff `config.aiGateway` (or deprecated `preview.aiGateway`) is statically enabled.\n * - `functions` is added iff `config.functions` (or deprecated `preview.functions`) declares at least one slug.\n */\ntype NeonEnv<C extends Config = Config> = {\n postgres: NeonPostgresEnv;\n /**\n * Branch identity (`NEON_BRANCH`). Optional because `parseEnv` only surfaces it when the\n * var was injected; `fetchEnv` always populates it.\n */\n branch?: NeonBranchEnv;\n} & (ServiceOn<NonNullable<C[\"auth\"]>> extends true ? {\n auth: NeonAuthEnv;\n} : NoNamespace) & (ServiceOn<NonNullable<C[\"dataApi\"]>> extends true ? {\n dataApi: NeonDataApiEnv;\n} : NoNamespace) & (RealtimeOn<C> extends true ? {\n realtime: NeonRealtimeEnv;\n} : NoNamespace) & (HasBuckets<C> extends true ? {\n storage: NeonStorageEnv;\n} : NoNamespace) & (AiGatewayOn<C> extends true ? {\n aiGateway: NeonAiGatewayEnv;\n} : NoNamespace) & (HasFunctions<C> extends true ? {\n functions: NeonFunctionsEnv<C>;\n} : NoNamespace);\n/**\n * OS-level env-var keys grouped by the {@link NeonEnv} namespace they populate. Only the\n * **input** vars `parseEnv` validates are listed — the output-only aliases in\n * {@link NEON_ENV_VAR_KEYS} (`NEON_AI_GATEWAY_TOKEN`, …) are intentionally absent, so they\n * are not selectable in a `parseEnv(config, keys)` filter. Keep in sync with\n * {@link EnvKeyToProp}.\n */\ninterface EnvKeysByNamespace {\n postgres: \"DATABASE_URL\" | \"DATABASE_URL_UNPOOLED\";\n branch: \"NEON_BRANCH\";\n auth: \"NEON_AUTH_BASE_URL\" | \"NEON_AUTH_JWKS_URL\";\n dataApi: \"NEON_DATA_API_URL\";\n realtime: \"NEON_REALTIME_URL\" | \"NEON_REALTIME_SECRET\";\n storage: \"AWS_ACCESS_KEY_ID\" | \"AWS_SECRET_ACCESS_KEY\" | \"AWS_ENDPOINT_URL_S3\" | \"AWS_REGION\";\n aiGateway: \"NEON_AI_GATEWAY_TOKEN\" | \"NEON_AI_GATEWAY_BASE_URL\";\n}\n/** The {@link NeonEnv} namespace interface backing each namespace key. */\ninterface NamespaceEnv {\n postgres: NeonPostgresEnv;\n branch: NeonBranchEnv;\n auth: NeonAuthEnv;\n dataApi: NeonDataApiEnv;\n realtime: NeonRealtimeEnv;\n storage: NeonStorageEnv;\n aiGateway: NeonAiGatewayEnv;\n}\n/** OS-level env-var key → the camelCase property it sets on its namespace object. */\ninterface EnvKeyToProp {\n DATABASE_URL: \"databaseUrl\";\n DATABASE_URL_UNPOOLED: \"databaseUrlUnpooled\";\n NEON_BRANCH: \"name\";\n NEON_AUTH_BASE_URL: \"baseUrl\";\n NEON_AUTH_JWKS_URL: \"jwksUrl\";\n NEON_DATA_API_URL: \"url\";\n NEON_REALTIME_URL: \"url\";\n NEON_REALTIME_SECRET: \"secret\";\n AWS_ACCESS_KEY_ID: \"accessKeyId\";\n AWS_SECRET_ACCESS_KEY: \"secretAccessKey\";\n AWS_ENDPOINT_URL_S3: \"endpoint\";\n AWS_REGION: \"region\";\n NEON_AI_GATEWAY_TOKEN: \"apiKey\";\n NEON_AI_GATEWAY_BASE_URL: \"baseUrl\";\n}\n/**\n * The OS-level env-var keys selectable for a given policy: the union of input vars across\n * exactly the namespaces {@link NeonEnv}<C> carries. Drives the typesafe autocomplete of the\n * `keys` filter — selecting a var from a namespace the policy does not enable is a type error\n * (e.g. `NEON_AUTH_BASE_URL` is only offered once the policy turns on `auth`).\n */\ntype SelectableEnvKey<C extends Config> = EnvKeysByNamespace[keyof NeonEnv<C> & keyof EnvKeysByNamespace] | FunctionBaseUrlKeyOf<C>;\n/**\n * The result shape of a **filtered** `parseEnv(config, keys)` call: the namespaced\n * {@link NeonEnv} restricted to exactly the selected OS-level keys `K`. Namespaces with no\n * selected key are dropped, and within a kept namespace only the selected properties survive\n * — selecting just `[\"DATABASE_URL\"]` yields `{ postgres: { databaseUrl: string } }`, with no\n * `databaseUrlUnpooled`.\n *\n * The policy gating lives on the `parseEnv` overload (which binds `K` to\n * {@link SelectableEnvKey}); this type only needs the selection, so it takes a bare\n * `K extends string` and filters with `Extract`. The outer mapped type's `as` clause drops\n * any namespace whose intersection with the selection is empty (`[…] extends [never]`,\n * tuple-wrapped to switch off distribution); the inner one re-keys each selected OS var to its\n * camelCase property and looks the value type up on the canonical namespace interface, so it\n * stays correct if a field ever stops being a plain `string`.\n */\ntype SelectedFunctionKeys<K extends string> = Extract<K, FunctionBaseUrlKey>;\ntype FunctionSlugFromKey<K extends string> = K extends `NEON_FUNCTION_${infer S}_BASE_URL` ? Lowercase<S> : never;\ntype FunctionsFilteredEnv<K extends string> = [SelectedFunctionKeys<K>] extends [never] ? unknown : {\n functions: { [P in SelectedFunctionKeys<K> as FunctionSlugFromKey<P>]: NeonFunctionUrlEnv };\n};\ntype OptionalFunctionsFilteredEnv<K extends string> = [SelectedFunctionKeys<K>] extends [never] ? unknown : {\n functions?: { [P in SelectedFunctionKeys<K> as FunctionSlugFromKey<P>]?: NeonFunctionUrlEnv };\n};\ntype FilteredNeonEnv<K extends string> = { [N in keyof EnvKeysByNamespace as [Extract<K, EnvKeysByNamespace[N]>] extends [never] ? never : N]: { [P in Extract<K, EnvKeysByNamespace[N]> as EnvKeyToProp[P & keyof EnvKeyToProp]]: NamespaceEnv[N][EnvKeyToProp[P & keyof EnvKeyToProp] & keyof NamespaceEnv[N]] } } & FunctionsFilteredEnv<K>;\n/**\n * A filtered result when the exact runtime contents of a key array are unknown. Both the\n * namespace and its selected properties are optional because the array may omit any member of\n * its element union, or be empty.\n */\ntype OptionalFilteredNeonEnv<K extends string> = { [N in keyof EnvKeysByNamespace as [Extract<K, EnvKeysByNamespace[N]>] extends [never] ? never : N]?: { [P in Extract<K, EnvKeysByNamespace[N]> as EnvKeyToProp[P & keyof EnvKeyToProp]]?: NamespaceEnv[N][EnvKeyToProp[P & keyof EnvKeyToProp] & keyof NamespaceEnv[N]] } } & OptionalFunctionsFilteredEnv<K>;\n/** Whether `T` is a union rather than one concrete type. */\ntype IsUnion<T, Whole = T> = T extends Whole ? [Whole] extends [T] ? false : true : never;\n/** Whether any fixed tuple position can hold more than one key at runtime. */\ntype TupleHasUnion<T extends readonly unknown[]> = T extends readonly [] ? false : T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? true extends IsUnion<Head> ? true : TupleHasUnion<Tail> : true;\n/**\n * The sound result of selecting an array of OS-level env-var keys.\n *\n * Inline literal tuples remain exact. Widened arrays, rest tuples, and tuple positions whose\n * value is a union are conservative because their runtime contents may be any subset of the\n * element type. The leading conditional distributes unions of whole literal tuples, preserving\n * each exact alternative.\n */\ntype SelectedNeonEnv<Keys extends readonly string[]> = Keys extends readonly string[] ? number extends Keys[\"length\"] ? OptionalFilteredNeonEnv<Keys[number]> : TupleHasUnion<Keys> extends true ? OptionalFilteredNeonEnv<Keys[number]> : FilteredNeonEnv<Keys[number]> : never;\ntype StorageCredentialEnvKey = \"AWS_ACCESS_KEY_ID\" | \"AWS_SECRET_ACCESS_KEY\";\ntype StorageKeyPairError = {\n readonly \"fetchEnv keys must include AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY together\": never;\n};\ntype TupleDefinitelyContains<Keys extends readonly string[], Key extends string> = Keys extends readonly [infer Head extends string, ...infer Tail extends readonly string[]] ? [Head] extends [Key] ? true : TupleDefinitelyContains<Tail, Key> : false;\ntype TupleDefinitelyContainsStoragePair<Keys extends readonly string[]> = TupleDefinitelyContains<Keys, \"AWS_ACCESS_KEY_ID\"> extends true ? TupleDefinitelyContains<Keys, \"AWS_SECRET_ACCESS_KEY\"> extends true ? true : false : false;\n/**\n * Reject a fixed key tuple that contains only one half of the storage credential. Dynamic\n * arrays are checked at runtime because their contents are not known to TypeScript.\n */\ntype InvalidStorageKeyTuple<Keys extends readonly string[]> = Keys extends unknown ? number extends Keys[\"length\"] ? never : [Extract<Keys[number], StorageCredentialEnvKey>] extends [never] ? never : TupleDefinitelyContainsStoragePair<Keys> extends true ? never : Keys : never;\ntype StorageKeyPairConstraint<Keys extends readonly string[]> = [InvalidStorageKeyTuple<Keys>] extends [never] ? unknown : StorageKeyPairError;\ntype FetchEnvKeysFromArgs<Args extends readonly unknown[]> = Args[0] extends {\n keys: infer Keys extends readonly string[];\n} ? Keys : never;\ntype StorageKeyPairArgsConstraint<Args extends readonly unknown[]> = StorageKeyPairConstraint<FetchEnvKeysFromArgs<Args>>;\n/** Preserve the same pair rule for callers that explicitly provide the legacy `K` generic. */\ntype StorageKeyUnionConstraint<K extends string> = [Extract<K, StorageCredentialEnvKey>] extends [never] ? unknown : StorageCredentialEnvKey extends K ? unknown : StorageKeyPairError;\ninterface FetchEnvOptions {\n /**\n * Neon project id. **Required** — the management API addresses branches through their\n * project. Resolve it in your CLI (e.g. neonctl) and pass it in.\n */\n projectId: string;\n /**\n * Neon branch — its **name** (e.g. `main`) or its id (`br-…`). **Required** (or pass the\n * legacy {@link FetchEnvOptions.branchId}). Resolved against the project's branches by\n * id first, then by name, so either form works.\n */\n branch?: string;\n /**\n * @deprecated Legacy id-only field. Prefer {@link FetchEnvOptions.branch}, which accepts\n * a branch name or id. Still honored for backward compatibility; ignored when `branch`\n * is set.\n */\n branchId?: string;\n /**\n * Neon API key. Resolved via the standard chain (option → `NEON_API_KEY` →\n * `~/.config/neonctl/credentials.json`) when omitted. Ignored when a custom `api`\n * is supplied.\n */\n apiKey?: string;\n /**\n * Neon **management** API base URL (not the Auth base URL). Falls back to\n * `NEON_API_HOST`, then production. Ignored when a custom `api` is supplied.\n */\n apiHost?: string;\n /**\n * Inject a custom NeonApi adapter. Primarily used by tests; production callers can rely\n * on the default real adapter built from `apiKey`.\n */\n api?: NeonApi;\n /**\n * Role name to fetch credentials for. When omitted, the connection role is auto-picked:\n * the only role on the branch, else Neon's default owner (`neondb_owner`), else the\n * single role left after dropping the managed Auth/Data API roles\n * (`authenticator`/`anonymous`/`authenticated`). Throws {@link PlatformError} with\n * `PLATFORM_AMBIGUOUS_BRANCH_AUTH` only when more than one app role remains.\n */\n roleName?: string;\n /**\n * Database name. When omitted, it is auto-picked: Neon's default `neondb` if present,\n * else the only database on the branch. Throws {@link PlatformError} with\n * `PLATFORM_AMBIGUOUS_BRANCH_AUTH` when the branch has several databases and none is\n * `neondb` (pass `databaseName` to disambiguate), and `PLATFORM_BRANCH_NOT_FOUND` when\n * the branch has no databases or the requested `databaseName` does not exist.\n */\n databaseName?: string;\n}\n/**\n * Resolve the project + branch this process should target, then fetch live Neon\n * connection strings for that branch over the network. Async — calls the Neon API.\n *\n * Use this from build scripts and the `neon-env run` command, where top-level await is\n * fine. For application code that needs a synchronous bootstrap (most frameworks: Drizzle\n * config, Next.js, Vite, etc.), inject env vars via `neon-env run -- <cmd>` and use\n * {@link parseEnv} instead — same {@link NeonEnv} shape, but a sync call against\n * `process.env`.\n *\n * Filesystem- and env-agnostic: pass `projectId` and the target `branch` (name or id)\n * explicitly (resolve them in your CLI, e.g. neonctl).\n *\n * ```ts\n * import config from \"../neon\";\n * import { fetchEnv } from \"@neon/env\";\n *\n * const env = await fetchEnv(config, { projectId: \"patient-art-12345\", branch: \"main\" });\n * const db = drizzle(neon(env.postgres.databaseUrl), { schema });\n * ```\n *\n * Pass `keys` to fetch only some of them — see the overload below.\n *\n * The package does **not** read `process.env`, mutate it, or touch the filesystem. Everything\n * it returns comes from the Neon API, so a value the API cannot produce (a one-time secret\n * issued to a previous call) is minted afresh rather than recovered. Callers that hold\n * persisted secrets and want to keep them use {@link fetchEnvReusingSecrets}, which decides\n * what is still valid and narrows this call's `keys` accordingly.\n */\ndeclare function fetchEnv<const C extends Config, const Args extends readonly [options: FetchEnvOptions & {\n /**\n * Fetch only these OS-level env vars, instead of everything the policy enables. The\n * keys autocomplete from the policy ({@link SelectableEnvKey}), and the result is\n * narrowed to match ({@link SelectedNeonEnv}). Inline literal arrays produce an exact\n * result; runtime-built arrays make their possible namespaces and properties optional.\n * `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` must be selected together.\n *\n * The point is not just a smaller result: **work is skipped too.** Leave out\n * `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `NEON_AI_GATEWAY_TOKEN` and no branch\n * credential is minted at all, so a caller that already holds valid secrets can refresh\n * everything else without issuing a new one. The non-secret vars of the same features\n * (`AWS_ENDPOINT_URL_S3`, `AWS_REGION`, `NEON_AI_GATEWAY_BASE_URL`) are not\n * credential-backed and stay available on their own.\n *\n * The selection **intersects** with the policy rather than overriding it: naming a var\n * the branch policy does not enable is not an error, it simply yields nothing.\n */\n keys: readonly SelectableEnvKey<C>[];\n}]>(config: C, ...args: Args & StorageKeyPairArgsConstraint<NoInfer<Args>>): Promise<SelectedNeonEnv<FetchEnvKeysFromArgs<NoInfer<Args>>>>;\ndeclare function fetchEnv<const C extends Config, const K extends SelectableEnvKey<C> = never>(config: C, options: [NoInfer<K>] extends [never] ? never : FetchEnvOptions & {\n keys: readonly NoInfer<K>[];\n} & StorageKeyUnionConstraint<NoInfer<K>>): Promise<FilteredNeonEnv<NoInfer<K>>>;\ndeclare function fetchEnv<const C extends Config>(config: C, options: FetchEnvOptions & {\n keys?: never;\n}): Promise<NeonEnv<C>>;\n/** Diagnostic-only fallback: valid keyed calls resolve through the exact overload above. */\ndeclare function fetchEnv<const C extends Config, const Keys extends readonly SelectableEnvKey<C>[]>(config: C, options: FetchEnvOptions & {\n keys: Keys;\n} & StorageKeyPairError): Promise<never>;\n/**\n * The {@link fetchEnv} body, with the key selection as a plain argument and no generic\n * narrowing. Exists for callers that compute the selection at runtime — notably\n * {@link fetchEnvReusingSecrets}, which decides which keys it still needs by checking the\n * branch — since the public overload's `keys` is bound to a literal union those callers cannot\n * produce without asserting.\n *\n * `keys === null` selects everything the policy enables.\n */\ndeclare function fetchEnvKeys(config: Config, options: FetchEnvKeysOptions, keys: readonly string[] | null): Promise<ResolvedNeonEnv>;\ntype FetchEnvKeysState = {\n env: ResolvedNeonEnv;\n /** Prevents endpoint failure from being mistaken for a confirmed empty function list. */\n functionUrlsUnavailable: boolean;\n};\ntype FetchEnvKeysOptions = FetchEnvOptions & {\n functionUrls?: FunctionUrlMode;\n /**\n * Keys to skip even when {@link fetchEnvKeys} is unscoped (`keys === null`).\n * {@link fetchEnvReusingSecrets} uses this to keep already-verified secrets\n * without converting an unscoped fetch into a static policy-key list — that\n * list cannot name `NEON_FUNCTION_*_BASE_URL`, so it would drop function URLs.\n */\n omitKeys?: readonly string[];\n /**\n * Skip a second `listBranchFunctions` when the caller already listed.\n * `--service functions` uses this so a later `FeatureUnavailable` cannot be\n * swallowed as `skipped`.\n */\n listedFunctions?: ReadonlyArray<{\n slug: string;\n invocationUrl: string;\n }>;\n};\n/**\n * `policy` is the {@link resolveBranchPolicy} result for this same `config` and branch, when\n * the caller already has it.\n */\ndeclare function fetchEnvKeysState(config: Config, options: FetchEnvKeysOptions, keys: readonly string[] | null, policy?: BranchPolicy): Promise<FetchEnvKeysState>;\ntype BranchPolicy = {\n branch: NeonBranchSnapshot;\n desired: ReturnType<typeof resolveConfig>;\n};\n/**\n * Resolve the target branch and evaluate the policy against it — the first thing any\n * branch-scoped operation needs. Shared by {@link fetchEnv} and {@link fetchEnvReusingSecrets}\n * so the two agree on which branch they're talking about and what it has enabled.\n */\ndeclare function resolveBranchPolicy(config: Config, options: Pick<FetchEnvOptions, \"projectId\" | \"branch\" | \"branchId\">, api: NeonApi, /** The target branch, when the caller listed it already. */\nresolved?: NeonBranchSnapshot): Promise<BranchPolicy>;\n/**\n * Scopes a minted fallback credential should carry. Only object storage and the AI Gateway\n * *require* secrets; functions never force a credential. `functions:invoke` rides along only\n * when this path still has to mint (defaults already cover storage and the gateway).\n */\ndeclare function previewCredentialScopes(preview: ResolvedPreviewConfig | undefined, selected?: {\n storage: boolean;\n aiGateway: boolean;\n}): CredentialScope[];\n/** The `name` this tool stamps on every credential it mints, so it can recognize its own. */\ndeclare function credentialName(branchName: string): string;\n/** The env-var keys a branch credential's secrets surface under, in emit order. */\ndeclare function credentialEnvKeys(flags: {\n storage: boolean;\n aiGateway: boolean;\n}): string[];\n/**\n * Every OS-level env var a resolved branch policy produces, in emit order. Lets a caller\n * subtract the ones it already holds and pass the rest as {@link fetchEnv}'s `keys`, without\n * re-deriving which vars a policy implies.\n */\ndeclare function policyEnvKeys(desired: ReturnType<typeof resolveConfig>): string[];\n/** Whether an issued credential can still be used: not revoked, not past its expiry. */\ndeclare function isLiveCredential(meta: NeonCredentialMeta, now: number): boolean;\ndeclare function defaultStorageCredential(live: readonly NeonCredentialMeta[], now: number): NeonCredentialMeta | null;\ndeclare function defaultAiGatewayCredential(live: readonly NeonCredentialMeta[], now: number): NeonCredentialMeta | null;\ndeclare function createApiFromOptions(options: FetchEnvOptions): NeonApi;\n/**\n * Project a fully-resolved {@link NeonEnv} into the OS-level `{ KEY: value }` pairs used\n * for cross-process transport. Named after the web-platform `.entries()` convention\n * (`URLSearchParams` / `Headers` / `FormData`); returns a `Record` rather than an\n * iterator of tuples since that's the shape env injection needs (wrap with\n * `Object.entries(...)` if you want literal `[key, value]` pairs). Used by `neon-env run`\n * to inject the vars into a subprocess's `process.env`.\n *\n * Walks the value at runtime so it works for any `NeonEnv<C>` regardless of which\n * conditional namespaces are present.\n */\ndeclare function toEntries(env: ResolvedNeonEnv): Record<string, string>;\n/**\n * Any resolved env {@link toEntries} can project: a full {@link NeonEnv}, or the narrowed\n * result of a `keys`-filtered {@link fetchEnv} / {@link parseEnv} call. Every namespace and\n * property is optional so a filtered result — which legitimately carries only what was asked\n * for — projects to exactly the vars it holds instead of failing to type-check.\n */\ntype ResolvedNeonEnv = { [N in keyof NamespaceEnv]?: Partial<NamespaceEnv[N]> } & {\n functions?: Record<string, NeonFunctionUrlEnv>;\n};\n//#endregion\nexport { BranchPolicy, FetchEnvKeysOptions, FetchEnvKeysState, FetchEnvOptions, FilteredNeonEnv, FunctionBaseUrlKey, FunctionUrlMode, NEON_ENV_VAR_KEYS, NeonAiGatewayEnv, NeonAuthEnv, NeonBranchEnv, NeonDataApiEnv, NeonEnv, NeonFunctionUrlEnv, NeonFunctionsEnv, NeonPostgresEnv, NeonRealtimeEnv, NeonStorageEnv, ResolvedNeonEnv, SelectableEnvKey, SelectedNeonEnv, createApiFromOptions, credentialEnvKeys, credentialName, defaultAiGatewayCredential, defaultStorageCredential, fetchEnv, fetchEnvKeys, fetchEnvKeysState, functionBaseUrlKey, isFunctionBaseUrlKey, isLiveCredential, parseFunctionBaseUrlKey, policyEnvKeys, previewCredentialScopes, resolveBranchPolicy, toEntries };\n//# sourceMappingURL=env.d.ts.map",null],"mappings":";;;;;AAkDC,cA9C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EkG,CD/EuElG,EAAAA,CAAAA,EC+EjE6E,eD/EiE7E,CC+EjDkG,CD/EiDlG,CAAAA"}
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,10 @@ const authEnvSchema = z.object({
|
|
|
28
28
|
NEON_AUTH_JWKS_URL: z.string({ message: "NEON_AUTH_JWKS_URL is missing" }).min(1, "NEON_AUTH_JWKS_URL must not be empty")
|
|
29
29
|
});
|
|
30
30
|
const dataApiEnvSchema = z.object({ NEON_DATA_API_URL: z.string({ message: "NEON_DATA_API_URL is missing" }).min(1, "NEON_DATA_API_URL must not be empty") });
|
|
31
|
+
const realtimeEnvSchema = z.object({
|
|
32
|
+
NEON_REALTIME_URL: z.string({ message: "NEON_REALTIME_URL is missing" }).min(1, "NEON_REALTIME_URL must not be empty"),
|
|
33
|
+
NEON_REALTIME_SECRET: z.string({ message: "NEON_REALTIME_SECRET is missing" }).min(1, "NEON_REALTIME_SECRET must not be empty")
|
|
34
|
+
});
|
|
31
35
|
const storageEnvSchema = z.object({
|
|
32
36
|
AWS_ACCESS_KEY_ID: z.string({ message: "AWS_ACCESS_KEY_ID is missing" }).min(1, "AWS_ACCESS_KEY_ID must not be empty"),
|
|
33
37
|
AWS_SECRET_ACCESS_KEY: z.string({ message: "AWS_SECRET_ACCESS_KEY is missing" }).min(1, "AWS_SECRET_ACCESS_KEY must not be empty"),
|
|
@@ -85,6 +89,17 @@ function parseEnv(config, scopeOrKeys) {
|
|
|
85
89
|
if (dataApi.success) result.dataApi = { url: dataApi.data.NEON_DATA_API_URL };
|
|
86
90
|
else for (const issue of dataApi.error.issues) issues.push(issue.message);
|
|
87
91
|
}
|
|
92
|
+
if (config.preview?.realtime !== void 0 && config.preview.realtime !== false) {
|
|
93
|
+
const realtime = realtimeEnvSchema.safeParse({
|
|
94
|
+
NEON_REALTIME_URL: source.NEON_REALTIME_URL,
|
|
95
|
+
NEON_REALTIME_SECRET: source.NEON_REALTIME_SECRET
|
|
96
|
+
});
|
|
97
|
+
if (realtime.success) result.realtime = {
|
|
98
|
+
url: realtime.data.NEON_REALTIME_URL,
|
|
99
|
+
secret: realtime.data.NEON_REALTIME_SECRET
|
|
100
|
+
};
|
|
101
|
+
else for (const issue of realtime.error.issues) issues.push(issue.message);
|
|
102
|
+
}
|
|
88
103
|
if (configWantsStorage(config)) {
|
|
89
104
|
const storage = storageEnvSchema.safeParse({
|
|
90
105
|
AWS_ACCESS_KEY_ID: source.AWS_ACCESS_KEY_ID,
|
|
@@ -116,6 +131,7 @@ function parseEnv(config, scopeOrKeys) {
|
|
|
116
131
|
const functions = {};
|
|
117
132
|
for (const slug of declaredFunctionSlugs) {
|
|
118
133
|
const key = functionBaseUrlKey(slug);
|
|
134
|
+
if (source[key] === void 0) continue;
|
|
119
135
|
const parsed = readFunctionBaseUrl(key, source[key]);
|
|
120
136
|
if (parsed.ok) functions[slug] = { baseUrl: parsed.value };
|
|
121
137
|
else issues.push(parsed.issue);
|
|
@@ -190,6 +206,8 @@ const FILTERABLE_ENV_KEYS = {
|
|
|
190
206
|
NEON_AUTH_BASE_URL: ["auth", "baseUrl"],
|
|
191
207
|
NEON_AUTH_JWKS_URL: ["auth", "jwksUrl"],
|
|
192
208
|
NEON_DATA_API_URL: ["dataApi", "url"],
|
|
209
|
+
NEON_REALTIME_URL: ["realtime", "url"],
|
|
210
|
+
NEON_REALTIME_SECRET: ["realtime", "secret"],
|
|
193
211
|
AWS_ACCESS_KEY_ID: ["storage", "accessKeyId"],
|
|
194
212
|
AWS_SECRET_ACCESS_KEY: ["storage", "secretAccessKey"],
|
|
195
213
|
AWS_ENDPOINT_URL_S3: ["storage", "endpoint"],
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/lib/parse-env.ts"],"sourcesContent":["/**\n * `parseEnv` — the synchronous, network-free counterpart to `fetchEnv`: read the Neon env vars\n * already injected into `process.env`, validate them against the policy, and return them in the\n * same namespaced shape.\n *\n * Lives in this package rather than in `@neon-internals/env-core` because nothing else needs\n * it. The `neon` CLI resolves env from the API and injects it; it never reads it back. Keeping\n * it here also keeps `zod` out of that package, and so out of every consumer that bundles it.\n */\n\nimport {\n\tauthoredAiGateway,\n\tauthoredBuckets,\n\tauthoredFunctions,\n\ttype Config,\n\tErrorCode,\n\tPlatformError,\n\ttype ServiceToggleInput,\n} from \"@neon/config/v1\";\nimport {\n\ttype FilteredNeonEnv,\n\tfunctionBaseUrlKey,\n\tisFunctionBaseUrlKey,\n\tNEON_ENV_VAR_KEYS,\n\ttype NeonAiGatewayEnv,\n\ttype NeonAuthEnv,\n\ttype NeonBranchEnv,\n\ttype NeonDataApiEnv,\n\ttype NeonEnv,\n\ttype NeonFunctionUrlEnv,\n\ttype NeonPostgresEnv,\n\ttype NeonStorageEnv,\n\tparseFunctionBaseUrlKey,\n\ttype SelectableEnvKey,\n} from \"@neon-internals/env-core/env\";\nimport { z } from \"zod\";\n\n/** The static `functions` record of a config (GA or deprecated `preview.functions`). */\ntype GaFunctionsOf<C extends Config> = [NonNullable<C[\"functions\"]>] extends [\n\tnever,\n]\n\t? Record<never, never>\n\t: string extends keyof NonNullable<C[\"functions\"]>\n\t\t? Record<never, never>\n\t\t: NonNullable<C[\"functions\"]>;\n\ntype PreviewFunctionsHome<C extends Config> = [\n\tNonNullable<C[\"preview\"]>,\n] extends [never]\n\t? Record<never, never>\n\t: NonNullable<C[\"preview\"]> extends { functions: infer F }\n\t\t? F\n\t\t: Record<never, never>;\n\ntype PreviewFunctionsOf<C extends Config> = [keyof GaFunctionsOf<C>] extends [\n\tnever,\n]\n\t? PreviewFunctionsHome<C>\n\t: [keyof PreviewFunctionsHome<C>] extends [never]\n\t\t? GaFunctionsOf<C>\n\t\t: GaFunctionsOf<C> & PreviewFunctionsHome<C>;\n\n/** The declared function slugs of a config (record keys), as a string union. */\nexport type FunctionSlugOf<C extends Config> = Extract<\n\tkeyof PreviewFunctionsOf<C>,\n\tstring\n>;\n\n/**\n * Human-readable hint surfaced as the **expected type** of `parseEnv`'s `scope` argument when\n * the policy declares no functions at all. Without it the argument's expected type is the bare\n * `never` {@link FunctionSlugOf} yields, and TypeScript reports the opaque `Type '\"x\"' is not\n * assignable to type 'never'`; the literal turns that into a sentence naming the fix (and the\n * editor offers it as the single completion, so the empty completion list is explained rather\n * than just empty). Mirrors `NeonAuthRequiredHint` in `@neon/config`.\n */\n// Exported (type-only) for the type tests in `env.test-d.ts`; intentionally not re-exported\n// from `index.ts`, so it stays an internal implementation detail.\nexport type NoFunctionScopeHint =\n\t\"this policy declares no `functions`, so there is no function scope to read. Declare the function in `neon.ts` first, or omit the scope to read the branch env\";\n\n/**\n * The expected type of `parseEnv`'s function-slug `scope` argument: the caller's inferred slug\n * `S` normally, and the {@link NoFunctionScopeHint} message when the policy declares no\n * functions. Keeping `S` (rather than `FunctionSlugOf<C>`) in the enabled branch is what makes\n * the returned `function` namespace exact — it stays the one function's env keys instead of\n * widening to every declared function's.\n */\ntype FunctionScopeField<C extends Config, S extends string> = [\n\tFunctionSlugOf<C>,\n] extends [never]\n\t? NoFunctionScopeHint\n\t: S;\n\n/** The declared env-var keys of one function `S`, as a string union. */\ntype FunctionEnvKeysOf<\n\tC extends Config,\n\tS extends string,\n> = S extends keyof PreviewFunctionsOf<C>\n\t? NonNullable<PreviewFunctionsOf<C>[S]> extends { env: infer E }\n\t\t? Extract<keyof E, string>\n\t\t: never\n\t: never;\n\n/**\n * The extra `function` namespace added to `parseEnv`'s result when called with a function\n * slug scope: the declared env-var keys for that function, each resolved to a `string`.\n */\nexport type NeonFunctionEnv<C extends Config, S extends string> = {\n\tfunction: Record<FunctionEnvKeysOf<C, S>, string>;\n};\n\n// ───────────────────────── parseEnv ─────────────────────────\n\n/**\n * Per-namespace zod schemas. Each defines exactly the OS-level keys parsed from\n * `process.env` for its namespace. Keep in sync with {@link NEON_ENV_VAR_KEYS}.\n *\n * `z.string().url()` would be tighter than `min(1)` but Postgres URIs that include\n * URL-illegal characters in the password (rare but legal in Neon's connection-string\n * format) fail the WHATWG `URL` parse, so we settle for \"non-empty string\".\n */\nconst postgresEnvSchema = z.object({\n\tDATABASE_URL: z\n\t\t.string({ message: \"DATABASE_URL is missing\" })\n\t\t.min(1, \"DATABASE_URL must not be empty\"),\n\tDATABASE_URL_UNPOOLED: z\n\t\t.string({ message: \"DATABASE_URL_UNPOOLED is missing\" })\n\t\t.min(1, \"DATABASE_URL_UNPOOLED must not be empty\"),\n});\n\nconst authEnvSchema = z.object({\n\tNEON_AUTH_BASE_URL: z\n\t\t.string({ message: \"NEON_AUTH_BASE_URL is missing\" })\n\t\t.min(1, \"NEON_AUTH_BASE_URL must not be empty\"),\n\tNEON_AUTH_JWKS_URL: z\n\t\t.string({ message: \"NEON_AUTH_JWKS_URL is missing\" })\n\t\t.min(1, \"NEON_AUTH_JWKS_URL must not be empty\"),\n});\n\nconst dataApiEnvSchema = z.object({\n\tNEON_DATA_API_URL: z\n\t\t.string({ message: \"NEON_DATA_API_URL is missing\" })\n\t\t.min(1, \"NEON_DATA_API_URL must not be empty\"),\n});\n\nconst storageEnvSchema = z.object({\n\tAWS_ACCESS_KEY_ID: z\n\t\t.string({ message: \"AWS_ACCESS_KEY_ID is missing\" })\n\t\t.min(1, \"AWS_ACCESS_KEY_ID must not be empty\"),\n\tAWS_SECRET_ACCESS_KEY: z\n\t\t.string({ message: \"AWS_SECRET_ACCESS_KEY is missing\" })\n\t\t.min(1, \"AWS_SECRET_ACCESS_KEY must not be empty\"),\n\tAWS_ENDPOINT_URL_S3: z\n\t\t.string({ message: \"AWS_ENDPOINT_URL_S3 is missing\" })\n\t\t.min(1, \"AWS_ENDPOINT_URL_S3 must not be empty\"),\n\tAWS_REGION: z\n\t\t.string({ message: \"AWS_REGION is missing\" })\n\t\t.min(1, \"AWS_REGION must not be empty\"),\n});\n\nconst aiGatewayEnvSchema = z.object({\n\tNEON_AI_GATEWAY_TOKEN: z\n\t\t.string({ message: \"NEON_AI_GATEWAY_TOKEN is missing\" })\n\t\t.min(1, \"NEON_AI_GATEWAY_TOKEN must not be empty\"),\n\tNEON_AI_GATEWAY_BASE_URL: z\n\t\t.string({ message: \"NEON_AI_GATEWAY_BASE_URL is missing\" })\n\t\t.min(1, \"NEON_AI_GATEWAY_BASE_URL must not be empty\"),\n});\n\n/** Whether a **static** policy declares object storage (`buckets`). No network. */\nfunction configWantsStorage(config: Config): boolean {\n\treturn Object.keys(authoredBuckets(config) ?? {}).length > 0;\n}\n\n/** Whether a **static** policy enables the AI Gateway (`aiGateway`). No network. */\nfunction configWantsAiGateway(config: Config): boolean {\n\treturn isServiceEnabledInput(authoredAiGateway(config));\n}\n\n/** Static-toggle helper mirroring `config`'s `isServiceEnabled` for the env reader. */\nfunction isServiceEnabledInput(\n\ttoggle: ServiceToggleInput | undefined,\n): boolean {\n\tif (toggle === undefined) return false;\n\tif (typeof toggle === \"boolean\") return toggle;\n\treturn toggle.enabled !== false;\n}\n\n/**\n * Synchronous, network-free counterpart to {@link fetchEnv}. Reads `process.env`, validates\n * the required Neon env vars with zod, and returns the same {@link NeonEnv} shape — so the\n * rest of your app touches `env.postgres.databaseUrl` instead of stringly-typed\n * `process.env.DATABASE_URL` lookups.\n *\n * Designed for the **\"env-vars-already-injected\"** path:\n * - You wrapped your dev command with `neon-env run -- <cmd>` or `neon dev`.\n * - Your platform (Vercel, Fly, Railway, …) injected the vars via its own integration.\n * - You are **inside a deployed Neon Function**, whose env was uploaded at `config apply`.\n *\n * Unlike the old API, `parseEnv` does **not** take a branch name: the secret set is now\n * static (top-level `config.auth` / `config.dataApi`), so it reads those directly without\n * evaluating the per-branch closure.\n *\n * The second argument is a **scope** or a **key filter**:\n * - omitted — *external* scope (app bootstrap, build scripts, your dev machine). Returns the\n * full `{ postgres, auth?, dataApi?, … }` the policy enables.\n * - a **function slug** (a key of `config.functions`) — *function* scope: you are\n * running inside that function. Returns the same branch secrets **plus** a typed\n * `function` namespace with the function's declared env-var keys. The slug autocompletes\n * from the policy ({@link FunctionSlugOf}) and an undeclared one is a type error.\n * - an **array of OS-level env-var keys** (e.g. `[\"DATABASE_URL\", \"NEON_AUTH_BASE_URL\"]`) —\n * *filtered* mode: only those vars are required and returned, as a narrowed namespaced\n * shape. The keys autocomplete from the policy ({@link SelectableEnvKey}), so you can only\n * pick vars the policy actually enables. Use this when a process needs just a subset (a\n * Next.js app that reads `DATABASE_URL` but not `DATABASE_URL_UNPOOLED`, say) and you don't\n * want `parseEnv` to throw over vars you never use.\n *\n * Throws `PlatformError(EnvNotInjected)` listing every missing/invalid var when the env\n * isn't fully populated, with a fix hint pointing back at `neon dev` / `neon-env run`.\n *\n * ```ts\n * import config from \"../neon\";\n * import { parseEnv } from \"@neon/env\";\n *\n * // External (app / build):\n * const env = parseEnv(config);\n * const db = drizzle(neon(env.postgres.databaseUrl), { schema });\n *\n * // Inside the \"hello\" function:\n * const env = parseEnv(config, \"hello\");\n * env.function.resendApiKey; // typed from hello's declared env keys\n *\n * // Filtered: only enforce + return the pooled URL.\n * const { postgres } = parseEnv(config, [\"DATABASE_URL\"]);\n * postgres.databaseUrl; // string — `databaseUrlUnpooled` is absent\n * ```\n */\nexport function parseEnv<const C extends Config>(config: C): NeonEnv<C>;\n// Overload order is load-bearing for **editor autocomplete**, not for type checking: when the\n// argument is a half-typed string literal the call resolves against no signature, and the\n// editor takes its string-literal completions from the first candidate overload. With the\n// `keys` overload listed first, the expected type of `parseEnv(config, \"…\")` is read as\n// `readonly K[]` — an array has no literal completions, so typing a function slug offered\n// nothing. Keep the slug overload ahead of the array one: `env.completions.test.ts` asserts the\n// completions through the language service, and `env.test-d.ts` locks the order itself (the\n// last overload is observable as `Parameters<typeof parseEnv>`), so `tsc` fails on a reorder.\nexport function parseEnv<\n\tconst C extends Config,\n\tconst S extends FunctionSlugOf<C>,\n>(\n\tconfig: C,\n\tscope: FunctionScopeField<C, S>,\n): NeonEnv<C> & NeonFunctionEnv<C, S>;\nexport function parseEnv<\n\tconst C extends Config,\n\tconst K extends SelectableEnvKey<C>,\n>(config: C, keys: readonly K[]): FilteredNeonEnv<K>;\nexport function parseEnv(\n\tconfig: Config,\n\tscopeOrKeys?: string | readonly string[],\n): unknown {\n\tconst source = process.env;\n\tif (Array.isArray(scopeOrKeys)) {\n\t\treturn parseFilteredEnv(source, scopeOrKeys);\n\t}\n\t// `Array.isArray` doesn't narrow a `readonly string[]` out of the union, so re-derive the\n\t// function-slug scope from the remaining `string` shape explicitly.\n\tconst scope = typeof scopeOrKeys === \"string\" ? scopeOrKeys : undefined;\n\tconst issues: string[] = [];\n\tconst result: Record<string, unknown> = {};\n\n\tconst pg = postgresEnvSchema.safeParse({\n\t\tDATABASE_URL: source.DATABASE_URL,\n\t\tDATABASE_URL_UNPOOLED: source.DATABASE_URL_UNPOOLED,\n\t});\n\tif (pg.success) {\n\t\tresult.postgres = {\n\t\t\tdatabaseUrl: pg.data.DATABASE_URL,\n\t\t\tdatabaseUrlUnpooled: pg.data.DATABASE_URL_UNPOOLED,\n\t\t} satisfies NeonPostgresEnv;\n\t} else {\n\t\tfor (const issue of pg.error.issues) issues.push(issue.message);\n\t}\n\n\t// Branch identity is optional: the Functions runtime injects `NEON_BRANCH` on every\n\t// branch by default and `neon dev` / `neon-env run` / `env pull` emit it too, but older\n\t// runtimes and platform integrations may not, so a missing value is not an error — we\n\t// just omit the namespace rather than failing the whole parse.\n\tconst branchName = source[NEON_ENV_VAR_KEYS.branch.name];\n\tif (branchName !== undefined && branchName !== \"\") {\n\t\tresult.branch = { name: branchName } satisfies NeonBranchEnv;\n\t}\n\n\tif (isServiceEnabledInput(config.auth)) {\n\t\tconst auth = authEnvSchema.safeParse({\n\t\t\tNEON_AUTH_BASE_URL: source.NEON_AUTH_BASE_URL,\n\t\t\tNEON_AUTH_JWKS_URL: source.NEON_AUTH_JWKS_URL,\n\t\t});\n\t\tif (auth.success) {\n\t\t\tresult.auth = {\n\t\t\t\tbaseUrl: auth.data.NEON_AUTH_BASE_URL,\n\t\t\t\tjwksUrl: auth.data.NEON_AUTH_JWKS_URL,\n\t\t\t} satisfies NeonAuthEnv;\n\t\t} else {\n\t\t\tfor (const issue of auth.error.issues) issues.push(issue.message);\n\t\t}\n\t}\n\n\tif (isServiceEnabledInput(config.dataApi)) {\n\t\tconst dataApi = dataApiEnvSchema.safeParse({\n\t\t\tNEON_DATA_API_URL: source.NEON_DATA_API_URL,\n\t\t});\n\t\tif (dataApi.success) {\n\t\t\tresult.dataApi = {\n\t\t\t\turl: dataApi.data.NEON_DATA_API_URL,\n\t\t\t} satisfies NeonDataApiEnv;\n\t\t} else {\n\t\t\tfor (const issue of dataApi.error.issues)\n\t\t\t\tissues.push(issue.message);\n\t\t}\n\t}\n\n\tif (configWantsStorage(config)) {\n\t\tconst storage = storageEnvSchema.safeParse({\n\t\t\tAWS_ACCESS_KEY_ID: source.AWS_ACCESS_KEY_ID,\n\t\t\tAWS_SECRET_ACCESS_KEY: source.AWS_SECRET_ACCESS_KEY,\n\t\t\tAWS_ENDPOINT_URL_S3: source.AWS_ENDPOINT_URL_S3,\n\t\t\tAWS_REGION: source.AWS_REGION,\n\t\t});\n\t\tif (storage.success) {\n\t\t\tresult.storage = {\n\t\t\t\taccessKeyId: storage.data.AWS_ACCESS_KEY_ID,\n\t\t\t\tsecretAccessKey: storage.data.AWS_SECRET_ACCESS_KEY,\n\t\t\t\tendpoint: storage.data.AWS_ENDPOINT_URL_S3,\n\t\t\t\tregion: storage.data.AWS_REGION,\n\t\t\t} satisfies NeonStorageEnv;\n\t\t} else {\n\t\t\tfor (const issue of storage.error.issues)\n\t\t\t\tissues.push(issue.message);\n\t\t}\n\t}\n\n\tif (configWantsAiGateway(config)) {\n\t\tconst aiGateway = aiGatewayEnvSchema.safeParse({\n\t\t\tNEON_AI_GATEWAY_TOKEN: source.NEON_AI_GATEWAY_TOKEN,\n\t\t\tNEON_AI_GATEWAY_BASE_URL: source.NEON_AI_GATEWAY_BASE_URL,\n\t\t});\n\t\tif (aiGateway.success) {\n\t\t\tresult.aiGateway = {\n\t\t\t\tapiKey: aiGateway.data.NEON_AI_GATEWAY_TOKEN,\n\t\t\t\tbaseUrl: aiGateway.data.NEON_AI_GATEWAY_BASE_URL,\n\t\t\t} satisfies NeonAiGatewayEnv;\n\t\t} else {\n\t\t\tfor (const issue of aiGateway.error.issues)\n\t\t\t\tissues.push(issue.message);\n\t\t}\n\t}\n\n\tconst declaredFunctionSlugs = Object.keys(\n\t\tauthoredFunctions(config) ?? {},\n\t).sort();\n\tif (declaredFunctionSlugs.length > 0) {\n\t\tconst functions: Record<string, NeonFunctionUrlEnv> = {};\n\t\tfor (const slug of declaredFunctionSlugs) {\n\t\t\tconst key = functionBaseUrlKey(slug);\n\t\t\tconst parsed = readFunctionBaseUrl(key, source[key]);\n\t\t\tif (parsed.ok) {\n\t\t\t\tfunctions[slug] = { baseUrl: parsed.value };\n\t\t\t} else {\n\t\t\t\tissues.push(parsed.issue);\n\t\t\t}\n\t\t}\n\t\tif (Object.keys(functions).length === declaredFunctionSlugs.length) {\n\t\t\tresult.functions = functions;\n\t\t}\n\t}\n\n\tif (scope !== undefined) {\n\t\tconst fn = authoredFunctions(config)?.[scope];\n\t\tif (!fn) {\n\t\t\tthrow new PlatformError(\n\t\t\t\tErrorCode.EnvNotInjected,\n\t\t\t\t[\n\t\t\t\t\t`parseEnv: no function \"${scope}\" is declared in this policy's functions.`,\n\t\t\t\t\t\"Pass a declared function slug (or omit the scope to read external env).\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t\t{ details: { scope } },\n\t\t\t);\n\t\t}\n\t\tconst envOut: Record<string, string> = {};\n\t\tfor (const key of Object.keys(fn.env ?? {})) {\n\t\t\tconst value = source[key];\n\t\t\t// Only a truly *unset* var is \"not injected\". Function env values carry no\n\t\t\t// non-empty constraint (unlike DATABASE_URL / NEON_AUTH_BASE_URL), so a\n\t\t\t// deliberately empty value is a present, valid value and is passed through.\n\t\t\tif (value === undefined) {\n\t\t\t\tissues.push(`${key} is missing (function \"${scope}\")`);\n\t\t\t} else {\n\t\t\t\tenvOut[key] = value;\n\t\t\t}\n\t\t}\n\t\tresult.function = envOut;\n\t}\n\n\tif (issues.length > 0) {\n\t\tthrow new PlatformError(\n\t\t\tErrorCode.EnvNotInjected,\n\t\t\t[\n\t\t\t\t\"parseEnv: the required Neon env variables are not present in process.env.\",\n\t\t\t\t...issues.map((i) => ` - ${i}`),\n\t\t\t\t...parseEnvInjectHint(issues),\n\t\t\t\t\"Or switch the call to `await fetchEnv(config, …)` if you're in a context that can do async I/O.\",\n\t\t\t].join(\"\\n\"),\n\t\t\t{ details: { missing: issues } },\n\t\t);\n\t}\n\n\treturn result;\n}\n\nfunction isFunctionBaseUrlIssue(issue: string): boolean {\n\treturn /^NEON_FUNCTION_[A-Z0-9]+_BASE_URL (is missing|must not be empty|must be a URL)$/.test(\n\t\tissue,\n\t);\n}\n\nfunction readFunctionBaseUrl(\n\tkey: string,\n\tvalue: string | undefined,\n): { ok: true; value: string } | { ok: false; issue: string } {\n\tif (value === undefined) {\n\t\treturn { ok: false, issue: `${key} is missing` };\n\t}\n\tif (value === \"\") {\n\t\treturn { ok: false, issue: `${key} must not be empty` };\n\t}\n\ttry {\n\t\tnew URL(value);\n\t} catch {\n\t\treturn { ok: false, issue: `${key} must be a URL` };\n\t}\n\treturn { ok: true, value };\n}\n\nfunction parseEnvInjectHint(issues: readonly string[]): string[] {\n\tif (issues.length > 0 && issues.every(isFunctionBaseUrlIssue)) {\n\t\treturn [\n\t\t\t\"Inject them via `neon env pull` or `neon-env run` (production URL), or `neon dev` (`http://localhost:<port>`).\",\n\t\t];\n\t}\n\tconst lines = [\n\t\t\"Inject them via one of:\",\n\t\t\" - `neon dev` / `neon-env run -- <your dev command>` (wraps the command with the vars injected)\",\n\t\t\" - your hosting platform's Neon integration (Vercel, Fly, Railway, …)\",\n\t];\n\tif (issues.some((issue) => issue.includes('(function \"'))) {\n\t\tlines.push(\n\t\t\t\" - for the `function` namespace: deploy the function (`neon deploy` / `config apply`) so its env is uploaded.\",\n\t\t);\n\t}\n\tif (issues.some(isFunctionBaseUrlIssue)) {\n\t\tlines.push(\n\t\t\t\" - for NEON_FUNCTION_*_BASE_URL: `neon env pull` or `neon dev`.\",\n\t\t);\n\t}\n\treturn lines;\n}\n\n/**\n * Runtime reverse map for filtered `parseEnv`: OS-level env-var key → `[namespace, property]`\n * in the {@link NeonEnv} shape. The compile-time mirror is {@link EnvKeysByNamespace} /\n * {@link EnvKeyToProp}; keep all three in sync. Only input vars appear (no output-only\n * aliases).\n */\nconst FILTERABLE_ENV_KEYS: Record<string, readonly [string, string]> = {\n\tDATABASE_URL: [\"postgres\", \"databaseUrl\"],\n\tDATABASE_URL_UNPOOLED: [\"postgres\", \"databaseUrlUnpooled\"],\n\tNEON_BRANCH: [\"branch\", \"name\"],\n\tNEON_AUTH_BASE_URL: [\"auth\", \"baseUrl\"],\n\tNEON_AUTH_JWKS_URL: [\"auth\", \"jwksUrl\"],\n\tNEON_DATA_API_URL: [\"dataApi\", \"url\"],\n\tAWS_ACCESS_KEY_ID: [\"storage\", \"accessKeyId\"],\n\tAWS_SECRET_ACCESS_KEY: [\"storage\", \"secretAccessKey\"],\n\tAWS_ENDPOINT_URL_S3: [\"storage\", \"endpoint\"],\n\tAWS_REGION: [\"storage\", \"region\"],\n\tNEON_AI_GATEWAY_TOKEN: [\"aiGateway\", \"apiKey\"],\n\tNEON_AI_GATEWAY_BASE_URL: [\"aiGateway\", \"baseUrl\"],\n};\n\n/**\n * Filtered counterpart to the {@link parseEnv} body: validate and return only the explicitly\n * selected OS-level env-var keys, projected back into the narrowed namespaced shape. Unlike\n * the full reader it never consults the policy — the selection alone decides what's required —\n * so vars the caller didn't ask for (e.g. `DATABASE_URL_UNPOOLED`) can be absent without\n * throwing. Mirrors the same non-empty constraint and {@link PlatformError} aggregation.\n */\nfunction parseFilteredEnv(\n\tsource: NodeJS.ProcessEnv,\n\tkeys: readonly string[],\n): Record<string, unknown> {\n\tconst issues: string[] = [];\n\tconst result: Record<string, Record<string, unknown>> = {};\n\tconst functionUrls: Record<string, NeonFunctionUrlEnv> = {};\n\tfor (const key of keys) {\n\t\tif (isFunctionBaseUrlKey(key)) {\n\t\t\tconst slug = parseFunctionBaseUrlKey(key);\n\t\t\tif (slug === null) continue;\n\t\t\tconst parsed = readFunctionBaseUrl(key, source[key]);\n\t\t\tif (!parsed.ok) {\n\t\t\t\tissues.push(parsed.issue);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfunctionUrls[slug] = { baseUrl: parsed.value };\n\t\t\tcontinue;\n\t\t}\n\t\t// Unknown keys are blocked at the type level; a runtime caller bypassing the types\n\t\t// gets a clear error rather than a silently-dropped selection.\n\t\tif (!Object.hasOwn(FILTERABLE_ENV_KEYS, key)) {\n\t\t\tissues.push(`${key} is not a selectable Neon env variable`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = source[key];\n\t\tif (value === undefined) {\n\t\t\tissues.push(`${key} is missing`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (value === \"\") {\n\t\t\tissues.push(`${key} must not be empty`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst [namespace, property] = FILTERABLE_ENV_KEYS[key];\n\t\tconst bucket = result[namespace] ?? {};\n\t\tbucket[property] = value;\n\t\tresult[namespace] = bucket;\n\t}\n\tif (Object.keys(functionUrls).length > 0) {\n\t\tresult.functions = functionUrls;\n\t}\n\tif (issues.length > 0) {\n\t\tthrow new PlatformError(\n\t\t\tErrorCode.EnvNotInjected,\n\t\t\t[\n\t\t\t\t\"parseEnv: the required Neon env variables are not present in process.env.\",\n\t\t\t\t...issues.map((i) => ` - ${i}`),\n\t\t\t\t...parseEnvInjectHint(issues),\n\t\t\t\t\"Or switch the call to `await fetchEnv(config, …)` if you're in a context that can do async I/O.\",\n\t\t\t].join(\"\\n\"),\n\t\t\t{ details: { missing: issues } },\n\t\t);\n\t}\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0HA,MAAM,oBAAoB,EAAE,OAAO;CA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,WAAW,YAAY,oBAAoB;EAClD,MAAM,SAAS,OAAO,cAAc,CAAC;EACrC,OAAO,YAAY;EACnB,OAAO,aAAa;CACrB;CACA,IAAI,OAAO,KAAK,YAAY,CAAC,CAAC,SAAS,GACtC,OAAO,YAAY;CAEpB,IAAI,OAAO,SAAS,GACnB,MAAM,IAAI,cACT,UAAU,gBACV;EACC;EACA,GAAG,OAAO,KAAK,MAAM,OAAO,GAAG;EAC/B,GAAG,mBAAmB,MAAM;EAC5B;CACD,CAAC,CAAC,KAAK,IAAI,GACX,EAAE,SAAS,EAAE,SAAS,OAAO,EAAE,CAChC;CAED,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/lib/parse-env.ts"],"sourcesContent":["/**\n * `parseEnv` — the synchronous, network-free counterpart to `fetchEnv`: read the Neon env vars\n * already injected into `process.env`, validate them against the policy, and return them in the\n * same namespaced shape.\n *\n * Lives in this package rather than in `@neon-internals/env-core` because nothing else needs\n * it. The `neon` CLI resolves env from the API and injects it; it never reads it back. Keeping\n * it here also keeps `zod` out of that package, and so out of every consumer that bundles it.\n */\n\nimport {\n\tauthoredAiGateway,\n\tauthoredBuckets,\n\tauthoredFunctions,\n\ttype Config,\n\tErrorCode,\n\tPlatformError,\n\ttype ServiceToggleInput,\n} from \"@neon/config/v1\";\nimport {\n\ttype FilteredNeonEnv,\n\tfunctionBaseUrlKey,\n\tisFunctionBaseUrlKey,\n\tNEON_ENV_VAR_KEYS,\n\ttype NeonAiGatewayEnv,\n\ttype NeonAuthEnv,\n\ttype NeonBranchEnv,\n\ttype NeonDataApiEnv,\n\ttype NeonEnv,\n\ttype NeonFunctionUrlEnv,\n\ttype NeonPostgresEnv,\n\ttype NeonRealtimeEnv,\n\ttype NeonStorageEnv,\n\tparseFunctionBaseUrlKey,\n\ttype SelectableEnvKey,\n} from \"@neon-internals/env-core/env\";\nimport { z } from \"zod\";\n\n/** The static `functions` record of a config (GA or deprecated `preview.functions`). */\ntype GaFunctionsOf<C extends Config> = [NonNullable<C[\"functions\"]>] extends [\n\tnever,\n]\n\t? Record<never, never>\n\t: string extends keyof NonNullable<C[\"functions\"]>\n\t\t? Record<never, never>\n\t\t: NonNullable<C[\"functions\"]>;\n\ntype PreviewFunctionsHome<C extends Config> = [\n\tNonNullable<C[\"preview\"]>,\n] extends [never]\n\t? Record<never, never>\n\t: NonNullable<C[\"preview\"]> extends { functions: infer F }\n\t\t? F\n\t\t: Record<never, never>;\n\ntype PreviewFunctionsOf<C extends Config> = [keyof GaFunctionsOf<C>] extends [\n\tnever,\n]\n\t? PreviewFunctionsHome<C>\n\t: [keyof PreviewFunctionsHome<C>] extends [never]\n\t\t? GaFunctionsOf<C>\n\t\t: GaFunctionsOf<C> & PreviewFunctionsHome<C>;\n\n/** The declared function slugs of a config (record keys), as a string union. */\nexport type FunctionSlugOf<C extends Config> = Extract<\n\tkeyof PreviewFunctionsOf<C>,\n\tstring\n>;\n\n/**\n * Human-readable hint surfaced as the **expected type** of `parseEnv`'s `scope` argument when\n * the policy declares no functions at all. Without it the argument's expected type is the bare\n * `never` {@link FunctionSlugOf} yields, and TypeScript reports the opaque `Type '\"x\"' is not\n * assignable to type 'never'`; the literal turns that into a sentence naming the fix (and the\n * editor offers it as the single completion, so the empty completion list is explained rather\n * than just empty). Mirrors `NeonAuthRequiredHint` in `@neon/config`.\n */\n// Exported (type-only) for the type tests in `env.test-d.ts`; intentionally not re-exported\n// from `index.ts`, so it stays an internal implementation detail.\nexport type NoFunctionScopeHint =\n\t\"this policy declares no `functions`, so there is no function scope to read. Declare the function in `neon.ts` first, or omit the scope to read the branch env\";\n\n/**\n * The expected type of `parseEnv`'s function-slug `scope` argument: the caller's inferred slug\n * `S` normally, and the {@link NoFunctionScopeHint} message when the policy declares no\n * functions. Keeping `S` (rather than `FunctionSlugOf<C>`) in the enabled branch is what makes\n * the returned `function` namespace exact — it stays the one function's env keys instead of\n * widening to every declared function's.\n */\ntype FunctionScopeField<C extends Config, S extends string> = [\n\tFunctionSlugOf<C>,\n] extends [never]\n\t? NoFunctionScopeHint\n\t: S;\n\n/** The declared env-var keys of one function `S`, as a string union. */\ntype FunctionEnvKeysOf<\n\tC extends Config,\n\tS extends string,\n> = S extends keyof PreviewFunctionsOf<C>\n\t? NonNullable<PreviewFunctionsOf<C>[S]> extends { env: infer E }\n\t\t? Extract<keyof E, string>\n\t\t: never\n\t: never;\n\n/**\n * The extra `function` namespace added to `parseEnv`'s result when called with a function\n * slug scope: the declared env-var keys for that function, each resolved to a `string`.\n */\n/**\n * What `parseEnv` returns without a key filter: {@link NeonEnv} with `functions` optional,\n * because the deployed Functions runtime does not inject `NEON_FUNCTION_<SLUG>_BASE_URL`.\n * Select the key (`parseEnv(config, [\"NEON_FUNCTION_HELLO_BASE_URL\"])`) to require it.\n */\nexport type ParsedNeonEnv<C extends Config> =\n\tNeonEnv<C> extends { functions: infer F }\n\t\t? Omit<NeonEnv<C>, \"functions\"> & { functions?: F }\n\t\t: NeonEnv<C>;\n\nexport type NeonFunctionEnv<C extends Config, S extends string> = {\n\tfunction: Record<FunctionEnvKeysOf<C, S>, string>;\n};\n\n// ───────────────────────── parseEnv ─────────────────────────\n\n/**\n * Per-namespace zod schemas. Each defines exactly the OS-level keys parsed from\n * `process.env` for its namespace. Keep in sync with {@link NEON_ENV_VAR_KEYS}.\n *\n * `z.string().url()` would be tighter than `min(1)` but Postgres URIs that include\n * URL-illegal characters in the password (rare but legal in Neon's connection-string\n * format) fail the WHATWG `URL` parse, so we settle for \"non-empty string\".\n */\nconst postgresEnvSchema = z.object({\n\tDATABASE_URL: z\n\t\t.string({ message: \"DATABASE_URL is missing\" })\n\t\t.min(1, \"DATABASE_URL must not be empty\"),\n\tDATABASE_URL_UNPOOLED: z\n\t\t.string({ message: \"DATABASE_URL_UNPOOLED is missing\" })\n\t\t.min(1, \"DATABASE_URL_UNPOOLED must not be empty\"),\n});\n\nconst authEnvSchema = z.object({\n\tNEON_AUTH_BASE_URL: z\n\t\t.string({ message: \"NEON_AUTH_BASE_URL is missing\" })\n\t\t.min(1, \"NEON_AUTH_BASE_URL must not be empty\"),\n\tNEON_AUTH_JWKS_URL: z\n\t\t.string({ message: \"NEON_AUTH_JWKS_URL is missing\" })\n\t\t.min(1, \"NEON_AUTH_JWKS_URL must not be empty\"),\n});\n\nconst dataApiEnvSchema = z.object({\n\tNEON_DATA_API_URL: z\n\t\t.string({ message: \"NEON_DATA_API_URL is missing\" })\n\t\t.min(1, \"NEON_DATA_API_URL must not be empty\"),\n});\n\nconst realtimeEnvSchema = z.object({\n\tNEON_REALTIME_URL: z\n\t\t.string({ message: \"NEON_REALTIME_URL is missing\" })\n\t\t.min(1, \"NEON_REALTIME_URL must not be empty\"),\n\tNEON_REALTIME_SECRET: z\n\t\t.string({ message: \"NEON_REALTIME_SECRET is missing\" })\n\t\t.min(1, \"NEON_REALTIME_SECRET must not be empty\"),\n});\n\nconst storageEnvSchema = z.object({\n\tAWS_ACCESS_KEY_ID: z\n\t\t.string({ message: \"AWS_ACCESS_KEY_ID is missing\" })\n\t\t.min(1, \"AWS_ACCESS_KEY_ID must not be empty\"),\n\tAWS_SECRET_ACCESS_KEY: z\n\t\t.string({ message: \"AWS_SECRET_ACCESS_KEY is missing\" })\n\t\t.min(1, \"AWS_SECRET_ACCESS_KEY must not be empty\"),\n\tAWS_ENDPOINT_URL_S3: z\n\t\t.string({ message: \"AWS_ENDPOINT_URL_S3 is missing\" })\n\t\t.min(1, \"AWS_ENDPOINT_URL_S3 must not be empty\"),\n\tAWS_REGION: z\n\t\t.string({ message: \"AWS_REGION is missing\" })\n\t\t.min(1, \"AWS_REGION must not be empty\"),\n});\n\nconst aiGatewayEnvSchema = z.object({\n\tNEON_AI_GATEWAY_TOKEN: z\n\t\t.string({ message: \"NEON_AI_GATEWAY_TOKEN is missing\" })\n\t\t.min(1, \"NEON_AI_GATEWAY_TOKEN must not be empty\"),\n\tNEON_AI_GATEWAY_BASE_URL: z\n\t\t.string({ message: \"NEON_AI_GATEWAY_BASE_URL is missing\" })\n\t\t.min(1, \"NEON_AI_GATEWAY_BASE_URL must not be empty\"),\n});\n\n/** Whether a **static** policy declares object storage (`buckets`). No network. */\nfunction configWantsStorage(config: Config): boolean {\n\treturn Object.keys(authoredBuckets(config) ?? {}).length > 0;\n}\n\n/** Whether a **static** policy enables the AI Gateway (`aiGateway`). No network. */\nfunction configWantsAiGateway(config: Config): boolean {\n\treturn isServiceEnabledInput(authoredAiGateway(config));\n}\n\n/** Static-toggle helper mirroring `config`'s `isServiceEnabled` for the env reader. */\nfunction isServiceEnabledInput(\n\ttoggle: ServiceToggleInput | undefined,\n): boolean {\n\tif (toggle === undefined) return false;\n\tif (typeof toggle === \"boolean\") return toggle;\n\treturn toggle.enabled !== false;\n}\n\n/**\n * Synchronous, network-free counterpart to {@link fetchEnv}. Reads `process.env`, validates\n * the required Neon env vars with zod, and returns the same {@link NeonEnv} shape — so the\n * rest of your app touches `env.postgres.databaseUrl` instead of stringly-typed\n * `process.env.DATABASE_URL` lookups.\n *\n * Designed for the **\"env-vars-already-injected\"** path:\n * - You wrapped your dev command with `neon-env run -- <cmd>` or `neon dev`.\n * - Your platform (Vercel, Fly, Railway, …) injected the vars via its own integration.\n * - You are **inside a deployed Neon Function**, whose env was uploaded at `config apply`.\n *\n * Unlike the old API, `parseEnv` does **not** take a branch name: the secret set is now\n * static (`config.auth` / `config.dataApi` / `config.preview.realtime`), so it reads those\n * directly without evaluating the per-branch closure.\n *\n * The second argument is a **scope** or a **key filter**:\n * - omitted — *external* scope (app bootstrap, build scripts, your dev machine). Returns the\n * full `{ postgres, auth?, dataApi?, … }` the policy enables.\n * - a **function slug** (a key of `config.functions`) — *function* scope: you are\n * running inside that function. Returns the same branch secrets **plus** a typed\n * `function` namespace with the function's declared env-var keys. The slug autocompletes\n * from the policy ({@link FunctionSlugOf}) and an undeclared one is a type error.\n * - an **array of OS-level env-var keys** (e.g. `[\"DATABASE_URL\", \"NEON_AUTH_BASE_URL\"]`) —\n * *filtered* mode: only those vars are required and returned, as a narrowed namespaced\n * shape. The keys autocomplete from the policy ({@link SelectableEnvKey}), so you can only\n * pick vars the policy actually enables. Use this when a process needs just a subset (a\n * Next.js app that reads `DATABASE_URL` but not `DATABASE_URL_UNPOOLED`, say) and you don't\n * want `parseEnv` to throw over vars you never use.\n *\n * Throws `PlatformError(EnvNotInjected)` listing every missing/invalid var when the env\n * isn't fully populated, with a fix hint pointing back at `neon dev` / `neon-env run`.\n *\n * ```ts\n * import config from \"../neon\";\n * import { parseEnv } from \"@neon/env\";\n *\n * // External (app / build):\n * const env = parseEnv(config);\n * const db = drizzle(neon(env.postgres.databaseUrl), { schema });\n *\n * // Inside the \"hello\" function:\n * const env = parseEnv(config, \"hello\");\n * env.function.resendApiKey; // typed from hello's declared env keys\n *\n * // Filtered: only enforce + return the pooled URL.\n * const { postgres } = parseEnv(config, [\"DATABASE_URL\"]);\n * postgres.databaseUrl; // string — `databaseUrlUnpooled` is absent\n * ```\n */\nexport function parseEnv<const C extends Config>(config: C): ParsedNeonEnv<C>;\n// Overload order is load-bearing for **editor autocomplete**, not for type checking: when the\n// argument is a half-typed string literal the call resolves against no signature, and the\n// editor takes its string-literal completions from the first candidate overload. With the\n// `keys` overload listed first, the expected type of `parseEnv(config, \"…\")` is read as\n// `readonly K[]` — an array has no literal completions, so typing a function slug offered\n// nothing. Keep the slug overload ahead of the array one: `env.completions.test.ts` asserts the\n// completions through the language service, and `env.test-d.ts` locks the order itself (the\n// last overload is observable as `Parameters<typeof parseEnv>`), so `tsc` fails on a reorder.\nexport function parseEnv<\n\tconst C extends Config,\n\tconst S extends FunctionSlugOf<C>,\n>(\n\tconfig: C,\n\tscope: FunctionScopeField<C, S>,\n): ParsedNeonEnv<C> & NeonFunctionEnv<C, S>;\nexport function parseEnv<\n\tconst C extends Config,\n\tconst K extends SelectableEnvKey<C>,\n>(config: C, keys: readonly K[]): FilteredNeonEnv<K>;\nexport function parseEnv(\n\tconfig: Config,\n\tscopeOrKeys?: string | readonly string[],\n): unknown {\n\tconst source = process.env;\n\tif (Array.isArray(scopeOrKeys)) {\n\t\treturn parseFilteredEnv(source, scopeOrKeys);\n\t}\n\t// `Array.isArray` doesn't narrow a `readonly string[]` out of the union, so re-derive the\n\t// function-slug scope from the remaining `string` shape explicitly.\n\tconst scope = typeof scopeOrKeys === \"string\" ? scopeOrKeys : undefined;\n\tconst issues: string[] = [];\n\tconst result: Record<string, unknown> = {};\n\n\tconst pg = postgresEnvSchema.safeParse({\n\t\tDATABASE_URL: source.DATABASE_URL,\n\t\tDATABASE_URL_UNPOOLED: source.DATABASE_URL_UNPOOLED,\n\t});\n\tif (pg.success) {\n\t\tresult.postgres = {\n\t\t\tdatabaseUrl: pg.data.DATABASE_URL,\n\t\t\tdatabaseUrlUnpooled: pg.data.DATABASE_URL_UNPOOLED,\n\t\t} satisfies NeonPostgresEnv;\n\t} else {\n\t\tfor (const issue of pg.error.issues) issues.push(issue.message);\n\t}\n\n\t// Branch identity is optional: the Functions runtime injects `NEON_BRANCH` on every\n\t// branch by default and `neon dev` / `neon-env run` / `env pull` emit it too, but older\n\t// runtimes and platform integrations may not, so a missing value is not an error — we\n\t// just omit the namespace rather than failing the whole parse.\n\tconst branchName = source[NEON_ENV_VAR_KEYS.branch.name];\n\tif (branchName !== undefined && branchName !== \"\") {\n\t\tresult.branch = { name: branchName } satisfies NeonBranchEnv;\n\t}\n\n\tif (isServiceEnabledInput(config.auth)) {\n\t\tconst auth = authEnvSchema.safeParse({\n\t\t\tNEON_AUTH_BASE_URL: source.NEON_AUTH_BASE_URL,\n\t\t\tNEON_AUTH_JWKS_URL: source.NEON_AUTH_JWKS_URL,\n\t\t});\n\t\tif (auth.success) {\n\t\t\tresult.auth = {\n\t\t\t\tbaseUrl: auth.data.NEON_AUTH_BASE_URL,\n\t\t\t\tjwksUrl: auth.data.NEON_AUTH_JWKS_URL,\n\t\t\t} satisfies NeonAuthEnv;\n\t\t} else {\n\t\t\tfor (const issue of auth.error.issues) issues.push(issue.message);\n\t\t}\n\t}\n\n\tif (isServiceEnabledInput(config.dataApi)) {\n\t\tconst dataApi = dataApiEnvSchema.safeParse({\n\t\t\tNEON_DATA_API_URL: source.NEON_DATA_API_URL,\n\t\t});\n\t\tif (dataApi.success) {\n\t\t\tresult.dataApi = {\n\t\t\t\turl: dataApi.data.NEON_DATA_API_URL,\n\t\t\t} satisfies NeonDataApiEnv;\n\t\t} else {\n\t\t\tfor (const issue of dataApi.error.issues)\n\t\t\t\tissues.push(issue.message);\n\t\t}\n\t}\n\n\tif (\n\t\tconfig.preview?.realtime !== undefined &&\n\t\tconfig.preview.realtime !== false\n\t) {\n\t\tconst realtime = realtimeEnvSchema.safeParse({\n\t\t\tNEON_REALTIME_URL: source.NEON_REALTIME_URL,\n\t\t\tNEON_REALTIME_SECRET: source.NEON_REALTIME_SECRET,\n\t\t});\n\t\tif (realtime.success) {\n\t\t\tresult.realtime = {\n\t\t\t\turl: realtime.data.NEON_REALTIME_URL,\n\t\t\t\tsecret: realtime.data.NEON_REALTIME_SECRET,\n\t\t\t} satisfies NeonRealtimeEnv;\n\t\t} else {\n\t\t\tfor (const issue of realtime.error.issues)\n\t\t\t\tissues.push(issue.message);\n\t\t}\n\t}\n\n\tif (configWantsStorage(config)) {\n\t\tconst storage = storageEnvSchema.safeParse({\n\t\t\tAWS_ACCESS_KEY_ID: source.AWS_ACCESS_KEY_ID,\n\t\t\tAWS_SECRET_ACCESS_KEY: source.AWS_SECRET_ACCESS_KEY,\n\t\t\tAWS_ENDPOINT_URL_S3: source.AWS_ENDPOINT_URL_S3,\n\t\t\tAWS_REGION: source.AWS_REGION,\n\t\t});\n\t\tif (storage.success) {\n\t\t\tresult.storage = {\n\t\t\t\taccessKeyId: storage.data.AWS_ACCESS_KEY_ID,\n\t\t\t\tsecretAccessKey: storage.data.AWS_SECRET_ACCESS_KEY,\n\t\t\t\tendpoint: storage.data.AWS_ENDPOINT_URL_S3,\n\t\t\t\tregion: storage.data.AWS_REGION,\n\t\t\t} satisfies NeonStorageEnv;\n\t\t} else {\n\t\t\tfor (const issue of storage.error.issues)\n\t\t\t\tissues.push(issue.message);\n\t\t}\n\t}\n\n\tif (configWantsAiGateway(config)) {\n\t\tconst aiGateway = aiGatewayEnvSchema.safeParse({\n\t\t\tNEON_AI_GATEWAY_TOKEN: source.NEON_AI_GATEWAY_TOKEN,\n\t\t\tNEON_AI_GATEWAY_BASE_URL: source.NEON_AI_GATEWAY_BASE_URL,\n\t\t});\n\t\tif (aiGateway.success) {\n\t\t\tresult.aiGateway = {\n\t\t\t\tapiKey: aiGateway.data.NEON_AI_GATEWAY_TOKEN,\n\t\t\t\tbaseUrl: aiGateway.data.NEON_AI_GATEWAY_BASE_URL,\n\t\t\t} satisfies NeonAiGatewayEnv;\n\t\t} else {\n\t\t\tfor (const issue of aiGateway.error.issues)\n\t\t\t\tissues.push(issue.message);\n\t\t}\n\t}\n\n\tconst declaredFunctionSlugs = Object.keys(\n\t\tauthoredFunctions(config) ?? {},\n\t).sort();\n\tif (declaredFunctionSlugs.length > 0) {\n\t\tconst functions: Record<string, NeonFunctionUrlEnv> = {};\n\t\tfor (const slug of declaredFunctionSlugs) {\n\t\t\tconst key = functionBaseUrlKey(slug);\n\t\t\t// The Functions runtime does not inject NEON_FUNCTION_<SLUG>_BASE_URL, so an\n\t\t\t// unset one leaves `functions` out instead of failing every deployed function.\n\t\t\tif (source[key] === undefined) continue;\n\t\t\tconst parsed = readFunctionBaseUrl(key, source[key]);\n\t\t\tif (parsed.ok) {\n\t\t\t\tfunctions[slug] = { baseUrl: parsed.value };\n\t\t\t} else {\n\t\t\t\tissues.push(parsed.issue);\n\t\t\t}\n\t\t}\n\t\tif (Object.keys(functions).length === declaredFunctionSlugs.length) {\n\t\t\tresult.functions = functions;\n\t\t}\n\t}\n\n\tif (scope !== undefined) {\n\t\tconst fn = authoredFunctions(config)?.[scope];\n\t\tif (!fn) {\n\t\t\tthrow new PlatformError(\n\t\t\t\tErrorCode.EnvNotInjected,\n\t\t\t\t[\n\t\t\t\t\t`parseEnv: no function \"${scope}\" is declared in this policy's functions.`,\n\t\t\t\t\t\"Pass a declared function slug (or omit the scope to read external env).\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t\t{ details: { scope } },\n\t\t\t);\n\t\t}\n\t\tconst envOut: Record<string, string> = {};\n\t\tfor (const key of Object.keys(fn.env ?? {})) {\n\t\t\tconst value = source[key];\n\t\t\t// Only a truly *unset* var is \"not injected\". Function env values carry no\n\t\t\t// non-empty constraint (unlike DATABASE_URL / NEON_AUTH_BASE_URL), so a\n\t\t\t// deliberately empty value is a present, valid value and is passed through.\n\t\t\tif (value === undefined) {\n\t\t\t\tissues.push(`${key} is missing (function \"${scope}\")`);\n\t\t\t} else {\n\t\t\t\tenvOut[key] = value;\n\t\t\t}\n\t\t}\n\t\tresult.function = envOut;\n\t}\n\n\tif (issues.length > 0) {\n\t\tthrow new PlatformError(\n\t\t\tErrorCode.EnvNotInjected,\n\t\t\t[\n\t\t\t\t\"parseEnv: the required Neon env variables are not present in process.env.\",\n\t\t\t\t...issues.map((i) => ` - ${i}`),\n\t\t\t\t...parseEnvInjectHint(issues),\n\t\t\t\t\"Or switch the call to `await fetchEnv(config, …)` if you're in a context that can do async I/O.\",\n\t\t\t].join(\"\\n\"),\n\t\t\t{ details: { missing: issues } },\n\t\t);\n\t}\n\n\treturn result;\n}\n\nfunction isFunctionBaseUrlIssue(issue: string): boolean {\n\treturn /^NEON_FUNCTION_[A-Z0-9]+_BASE_URL (is missing|must not be empty|must be a URL)$/.test(\n\t\tissue,\n\t);\n}\n\nfunction readFunctionBaseUrl(\n\tkey: string,\n\tvalue: string | undefined,\n): { ok: true; value: string } | { ok: false; issue: string } {\n\tif (value === undefined) {\n\t\treturn { ok: false, issue: `${key} is missing` };\n\t}\n\tif (value === \"\") {\n\t\treturn { ok: false, issue: `${key} must not be empty` };\n\t}\n\ttry {\n\t\tnew URL(value);\n\t} catch {\n\t\treturn { ok: false, issue: `${key} must be a URL` };\n\t}\n\treturn { ok: true, value };\n}\n\nfunction parseEnvInjectHint(issues: readonly string[]): string[] {\n\tif (issues.length > 0 && issues.every(isFunctionBaseUrlIssue)) {\n\t\treturn [\n\t\t\t\"Inject them via `neon env pull` or `neon-env run` (production URL), or `neon dev` (`http://localhost:<port>`).\",\n\t\t];\n\t}\n\tconst lines = [\n\t\t\"Inject them via one of:\",\n\t\t\" - `neon dev` / `neon-env run -- <your dev command>` (wraps the command with the vars injected)\",\n\t\t\" - your hosting platform's Neon integration (Vercel, Fly, Railway, …)\",\n\t];\n\tif (issues.some((issue) => issue.includes('(function \"'))) {\n\t\tlines.push(\n\t\t\t\" - for the `function` namespace: deploy the function (`neon deploy` / `config apply`) so its env is uploaded.\",\n\t\t);\n\t}\n\tif (issues.some(isFunctionBaseUrlIssue)) {\n\t\tlines.push(\n\t\t\t\" - for NEON_FUNCTION_*_BASE_URL: `neon env pull` or `neon dev`.\",\n\t\t);\n\t}\n\treturn lines;\n}\n\n/**\n * Runtime reverse map for filtered `parseEnv`: OS-level env-var key → `[namespace, property]`\n * in the {@link NeonEnv} shape. The compile-time mirror is {@link EnvKeysByNamespace} /\n * {@link EnvKeyToProp}; keep all three in sync. Only input vars appear (no output-only\n * aliases).\n */\nconst FILTERABLE_ENV_KEYS: Record<string, readonly [string, string]> = {\n\tDATABASE_URL: [\"postgres\", \"databaseUrl\"],\n\tDATABASE_URL_UNPOOLED: [\"postgres\", \"databaseUrlUnpooled\"],\n\tNEON_BRANCH: [\"branch\", \"name\"],\n\tNEON_AUTH_BASE_URL: [\"auth\", \"baseUrl\"],\n\tNEON_AUTH_JWKS_URL: [\"auth\", \"jwksUrl\"],\n\tNEON_DATA_API_URL: [\"dataApi\", \"url\"],\n\tNEON_REALTIME_URL: [\"realtime\", \"url\"],\n\tNEON_REALTIME_SECRET: [\"realtime\", \"secret\"],\n\tAWS_ACCESS_KEY_ID: [\"storage\", \"accessKeyId\"],\n\tAWS_SECRET_ACCESS_KEY: [\"storage\", \"secretAccessKey\"],\n\tAWS_ENDPOINT_URL_S3: [\"storage\", \"endpoint\"],\n\tAWS_REGION: [\"storage\", \"region\"],\n\tNEON_AI_GATEWAY_TOKEN: [\"aiGateway\", \"apiKey\"],\n\tNEON_AI_GATEWAY_BASE_URL: [\"aiGateway\", \"baseUrl\"],\n};\n\n/**\n * Filtered counterpart to the {@link parseEnv} body: validate and return only the explicitly\n * selected OS-level env-var keys, projected back into the narrowed namespaced shape. Unlike\n * the full reader it never consults the policy — the selection alone decides what's required —\n * so vars the caller didn't ask for (e.g. `DATABASE_URL_UNPOOLED`) can be absent without\n * throwing. Mirrors the same non-empty constraint and {@link PlatformError} aggregation.\n */\nfunction parseFilteredEnv(\n\tsource: NodeJS.ProcessEnv,\n\tkeys: readonly string[],\n): Record<string, unknown> {\n\tconst issues: string[] = [];\n\tconst result: Record<string, Record<string, unknown>> = {};\n\tconst functionUrls: Record<string, NeonFunctionUrlEnv> = {};\n\tfor (const key of keys) {\n\t\tif (isFunctionBaseUrlKey(key)) {\n\t\t\tconst slug = parseFunctionBaseUrlKey(key);\n\t\t\tif (slug === null) continue;\n\t\t\tconst parsed = readFunctionBaseUrl(key, source[key]);\n\t\t\tif (!parsed.ok) {\n\t\t\t\tissues.push(parsed.issue);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfunctionUrls[slug] = { baseUrl: parsed.value };\n\t\t\tcontinue;\n\t\t}\n\t\t// Unknown keys are blocked at the type level; a runtime caller bypassing the types\n\t\t// gets a clear error rather than a silently-dropped selection.\n\t\tif (!Object.hasOwn(FILTERABLE_ENV_KEYS, key)) {\n\t\t\tissues.push(`${key} is not a selectable Neon env variable`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = source[key];\n\t\tif (value === undefined) {\n\t\t\tissues.push(`${key} is missing`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (value === \"\") {\n\t\t\tissues.push(`${key} must not be empty`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst [namespace, property] = FILTERABLE_ENV_KEYS[key];\n\t\tconst bucket = result[namespace] ?? {};\n\t\tbucket[property] = value;\n\t\tresult[namespace] = bucket;\n\t}\n\tif (Object.keys(functionUrls).length > 0) {\n\t\tresult.functions = functionUrls;\n\t}\n\tif (issues.length > 0) {\n\t\tthrow new PlatformError(\n\t\t\tErrorCode.EnvNotInjected,\n\t\t\t[\n\t\t\t\t\"parseEnv: the required Neon env variables are not present in process.env.\",\n\t\t\t\t...issues.map((i) => ` - ${i}`),\n\t\t\t\t...parseEnvInjectHint(issues),\n\t\t\t\t\"Or switch the call to `await fetchEnv(config, …)` if you're in a context that can do async I/O.\",\n\t\t\t].join(\"\\n\"),\n\t\t\t{ details: { missing: issues } },\n\t\t);\n\t}\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqIA,MAAM,oBAAoB,EAAE,OAAO;CAClC,cAAc,EACZ,OAAO,EAAE,SAAS,0BAA0B,CAAC,CAAC,CAC9C,IAAI,GAAG,gCAAgC;CACzC,uBAAuB,EACrB,OAAO,EAAE,SAAS,mCAAmC,CAAC,CAAC,CACvD,IAAI,GAAG,yCAAyC;AACnD,CAAC;AAED,MAAM,gBAAgB,EAAE,OAAO;CAC9B,oBAAoB,EAClB,OAAO,EAAE,SAAS,gCAAgC,CAAC,CAAC,CACpD,IAAI,GAAG,sCAAsC;CAC/C,oBAAoB,EAClB,OAAO,EAAE,SAAS,gCAAgC,CAAC,CAAC,CACpD,IAAI,GAAG,sCAAsC;AAChD,CAAC;AAED,MAAM,mBAAmB,EAAE,OAAO,EACjC,mBAAmB,EACjB,OAAO,EAAE,SAAS,+BAA+B,CAAC,CAAC,CACnD,IAAI,GAAG,qCAAqC,EAC/C,CAAC;AAED,MAAM,oBAAoB,EAAE,OAAO;CAClC,mBAAmB,EACjB,OAAO,EAAE,SAAS,+BAA+B,CAAC,CAAC,CACnD,IAAI,GAAG,qCAAqC;CAC9C,sBAAsB,EACpB,OAAO,EAAE,SAAS,kCAAkC,CA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CAAC;EACrC,OAAO,YAAY;EACnB,OAAO,aAAa;CACrB;CACA,IAAI,OAAO,KAAK,YAAY,CAAC,CAAC,SAAS,GACtC,OAAO,YAAY;CAEpB,IAAI,OAAO,SAAS,GACnB,MAAM,IAAI,cACT,UAAU,gBACV;EACC;EACA,GAAG,OAAO,KAAK,MAAM,OAAO,GAAG;EAC/B,GAAG,mBAAmB,MAAM;EAC5B;CACD,CAAC,CAAC,KAAK,IAAI,GACX,EAAE,SAAS,EAAE,SAAS,OAAO,EAAE,CAChC;CAED,OAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neon/env",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "Resolve and inject Neon connection strings for the branch selected by your neon.ts policy. fetchEnv / parseEnv plus a `neon-env` CLI with `run` and `export`.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"tsdown": "^0.14.1",
|
|
46
46
|
"typescript": "^5.9.0",
|
|
47
47
|
"vitest": "^3.0.9",
|
|
48
|
-
"@neon-internals/cli-core": "0.0.0",
|
|
49
|
-
"@neon-internals/env-core": "0.0.30",
|
|
50
48
|
"@neon/e2e-harness": "0.0.0",
|
|
51
|
-
"@neon/sdk": "7.0
|
|
49
|
+
"@neon/sdk": "7.2.0",
|
|
50
|
+
"@neon-internals/env-core": "0.0.32",
|
|
51
|
+
"@neon-internals/cli-core": "0.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"zod": "^4.4.3",
|
|
55
55
|
"yargs": "^18.0.0",
|
|
56
|
-
"@neon/config": "1.
|
|
56
|
+
"@neon/config": "1.9.1"
|
|
57
57
|
},
|
|
58
58
|
"optionalDependencies": {
|
|
59
59
|
"@napi-rs/keyring": "1.3.0"
|