neon 9.9.3 → 9.9.5
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 +9 -2
- package/dist/_chunks/{checkout-D9CSqjde.js → checkout-CLHGCpZx.js} +3 -3
- package/dist/_chunks/{claim-Dzsw8sdd.js → claim-BoN9NPTy.js} +1 -1
- package/dist/_chunks/{config-CtP-1YSw.js → config-C8BQIoM2.js} +1 -1
- package/dist/_chunks/{deploy-DQNsheXC.js → deploy-BdipMGJE.js} +1 -1
- package/dist/_chunks/{dev-EmQkh84H.js → dev-DVB7fGiG.js} +2 -2
- package/dist/_chunks/{env-CFBmcKyo.js → env-BWvi2_2f.js} +75 -31
- package/dist/_chunks/{env-aWCqnWaF.js → env-C3HQJO8Z.js} +34 -8
- package/dist/_chunks/{git-DJ-QP4YF.js → git-CIXLNUoh.js} +2 -2
- package/dist/_chunks/{link-Caoa3_y8.js → link-BVa6Nfji.js} +2 -2
- package/dist/_chunks/{mcp-SvqWzHnT.js → mcp-g8C-BZIb.js} +1 -1
- package/dist/_chunks/{status-DLH8CtHh.js → status-BBnw48qR.js} +1 -1
- package/dist/commands/checkout.js +1 -1
- package/dist/commands/claim.js +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/env.js +1 -1
- package/dist/commands/env_output.js +3 -1
- package/dist/commands/functions_new.js +1 -1
- package/dist/commands/git.js +1 -1
- package/dist/commands/index.js +10 -10
- package/dist/commands/link.js +1 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/subscribe.js +1 -1
- package/dist/dev/env.js +1 -1
- package/dist/env_services.js +6 -2
- package/dist/init/auth.js +2 -2
- package/dist/init/choices.js +6 -8
- package/dist/init/deploy.js +1 -1
- package/dist/init/link.js +1 -1
- package/dist/init/run.js +5 -4
- package/dist/init/tooling.js +1 -1
- package/dist/neon_services.js +7 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -638,7 +638,14 @@ auth env vars to pull. Provision it first (`neon deploy`, `neon config apply`, o
|
|
|
638
638
|
Console), or drop auth from --service.
|
|
639
639
|
```
|
|
640
640
|
|
|
641
|
-
`link`, `checkout`, and `config apply` invoke `env pull` automatically (see above). Those bundled pulls follow rules 2 and 3 above
|
|
641
|
+
`link`, `checkout`, and `config apply` invoke `env pull` automatically (see above). Those bundled pulls follow rules 2 and 3 above, with two differences:
|
|
642
|
+
|
|
643
|
+
- **The AI Gateway only when the file already has `NEON_AI_GATEWAY_*`.** Minting a credential for a service you never named isn't something a side effect of another command should do; once you run `neon env pull`, later bundled pulls keep the gateway current, so `checkout` moves it to the new branch.
|
|
644
|
+
- **No Object Storage when the file holds a value for `AWS_ACCESS_KEY_ID` or `AWS_SECRET_ACCESS_KEY` without a Neon `AWS_ENDPOINT_URL_S3`.** Those keys are your own (AWS, R2, MinIO), and writing would overwrite them. The summary says so:
|
|
645
|
+
|
|
646
|
+
```text
|
|
647
|
+
Not pulled Object Storage, to keep the AWS_* keys already in .env. Use `neon env pull -s object-storage` to replace them.
|
|
648
|
+
```
|
|
642
649
|
|
|
643
650
|
If you'd rather not keep env vars on disk, inject them at runtime instead with `neon-env run -- <your dev command>` (from `@neon/env`) or `neon dev`, and pass `--no-env-pull` to `link` / `checkout`.
|
|
644
651
|
|
|
@@ -925,7 +932,7 @@ Without a TTY, pass `-y` or enough flags to answer every question. `-y` alone is
|
|
|
925
932
|
|
|
926
933
|
`--project-id`, `--org-id`, `--project-name`, `--region-id`, and `--branch` are forwarded to `link`. They select linking. A linked directory is not relinked unless you pass one of those flags.
|
|
927
934
|
|
|
928
|
-
Init pulls the branch's env vars once, after the `neon.ts` step, so the pull includes what `neon.ts` declares. A `neon.ts` written from the branch declares only services the branch already runs, so all of them are pulled. The AI Gateway and Functions need no deploy and are pulled immediately.
|
|
935
|
+
Init pulls the branch's env vars once, after the `neon.ts` step, so the pull includes what `neon.ts` declares. A `neon.ts` written from the branch declares only services the branch already runs, so all of them are pulled. The AI Gateway and Functions need no deploy and are pulled immediately. Auth, the Data API, Object Storage, and Realtime need a deploy unless the branch already has them: init pulls each one the branch has and skips the others. `neon deploy` provisions the rest and pulls their env vars. An existing `neon.ts` is pulled by `link` as usual.
|
|
929
936
|
|
|
930
937
|
A failed step stops the rest. `--profile` and `--config-dir` are forwarded to each child. `--output json` and `--output yaml` are refused; the commands init runs print their own output.
|
|
931
938
|
|
|
@@ -12,9 +12,9 @@ import { looksLikeBranchId } from "../utils/formats.js";
|
|
|
12
12
|
import { fillSingleProject, listAllProjectBranches } from "../utils/enrichers.js";
|
|
13
13
|
import { buildCheckoutEvent, readGitContext } from "../utils/git.js";
|
|
14
14
|
import { buildHookBranch, loadHookConfig, resolveHookEnv, runCheckoutAfterHook, runCheckoutBeforeHook, runCreateAfterHook, runCreateBeforeHook } from "../utils/hooks.js";
|
|
15
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
16
|
-
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-
|
|
17
|
-
import { i as handler$1 } from "./link-
|
|
15
|
+
import { n as autoPullEnvAfterPin } from "./env-C3HQJO8Z.js";
|
|
16
|
+
import { a as applyPolicyOnCreate, f as envFlag, l as createBranchFromPolicyOnCheckout } from "./config-C8BQIoM2.js";
|
|
17
|
+
import { i as handler$1 } from "./link-BVa6Nfji.js";
|
|
18
18
|
import chalk from "chalk";
|
|
19
19
|
import prompts from "prompts";
|
|
20
20
|
// src/commands/checkout.ts
|
|
@@ -12,7 +12,7 @@ import { projectConfigPath } from "../project.js";
|
|
|
12
12
|
import { resolveEnvFilePath } from "../env_file.js";
|
|
13
13
|
import { writer } from "../writer.js";
|
|
14
14
|
import { noPassthrough } from "../utils/flags.js";
|
|
15
|
-
import { c as pull } from "./env-
|
|
15
|
+
import { c as pull } from "./env-C3HQJO8Z.js";
|
|
16
16
|
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
17
17
|
import open from "open";
|
|
18
18
|
import prompts from "prompts";
|
|
@@ -26,7 +26,7 @@ import { readGitContext } from "../utils/git.js";
|
|
|
26
26
|
import { resolveHookEnv, runDeployAfterHook, runDeployBeforeHook } from "../utils/hooks.js";
|
|
27
27
|
import { pickServicesInteractively } from "../utils/service_picker.js";
|
|
28
28
|
import { zipBundle } from "../utils/zip.js";
|
|
29
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
29
|
+
import { n as autoPullEnvAfterPin } from "./env-C3HQJO8Z.js";
|
|
30
30
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
31
31
|
import { dirname, join, relative, resolve } from "node:path";
|
|
32
32
|
import chalk from "chalk";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
2
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
3
|
-
import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-
|
|
3
|
+
import { f as envFlag, i as applyFlags, p as envPullFlag, r as applyCmd } from "./config-C8BQIoM2.js";
|
|
4
4
|
import { DEPLOY_COMMANDS_EPILOGUE } from "../commands/deploy_help.js";
|
|
5
5
|
// src/commands/deploy.ts
|
|
6
6
|
var deploy_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -6,8 +6,8 @@ import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file
|
|
|
6
6
|
import { t as NEON_DEV_FUNCTION_PORTS } from "./env-EJU-0InB.js";
|
|
7
7
|
import { branchIdResolve } from "../utils/enrichers.js";
|
|
8
8
|
import { bundleEntry } from "../utils/esbuild.js";
|
|
9
|
-
import { a as resolveDevEnv } from "./env-
|
|
10
|
-
import { f as envFlag } from "./config-
|
|
9
|
+
import { a as resolveDevEnv } from "./env-BWvi2_2f.js";
|
|
10
|
+
import { f as envFlag } from "./config-C8BQIoM2.js";
|
|
11
11
|
import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
12
12
|
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
13
13
|
import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -382,7 +382,8 @@ const resolveClaimableNeonEnvVars = async (ctx) => {
|
|
|
382
382
|
* buckets) into a config, then `fetchEnv` resolves what is actually enabled —
|
|
383
383
|
* so a branch with a bucket gets its `AWS_*` storage vars pulled with no policy. With
|
|
384
384
|
* {@link DevEnvContext.implyAiGateway}, the AI Gateway is added on top, since
|
|
385
|
-
* `pullConfig` cannot read it back.
|
|
385
|
+
* `pullConfig` cannot read it back. {@link DevEnvContext.secretServices} narrows the
|
|
386
|
+
* credential-backed services.
|
|
386
387
|
* 3. otherwise -> throw {@link MissingBranchContextError}.
|
|
387
388
|
*
|
|
388
389
|
* {@link DevEnvContext.claimable} keeps the same precedence. Credentials are not
|
|
@@ -415,15 +416,35 @@ const resolveNeonEnvVars = async (ctx) => {
|
|
|
415
416
|
protected: pulled.branch.protected,
|
|
416
417
|
...pulled.branch.expiresAt ? { expiresAt: pulled.branch.expiresAt } : {}
|
|
417
418
|
};
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
const { config, withheld } = withholdSecretServices(pulled.config, ctx.secretServices);
|
|
420
|
+
const resolved = ctx.implyAiGateway || (ctx.secretServices?.includes("ai-gateway") ?? false) ? await resolveWithImpliedGateway(config, ctx, {
|
|
420
421
|
projectId: ctx.projectId,
|
|
421
422
|
branchId: ctx.branchId,
|
|
422
|
-
resolvedBranch
|
|
423
|
-
|
|
423
|
+
resolvedBranch,
|
|
424
|
+
revokeSuperseded: ctx.secretServices === void 0 || config.preview?.buckets !== void 0
|
|
425
|
+
}) : await fetchAndProject(config, ctx, { resolvedBranch });
|
|
426
|
+
return withheld.length > 0 ? {
|
|
427
|
+
...resolved,
|
|
428
|
+
withheld
|
|
429
|
+
} : resolved;
|
|
424
430
|
}
|
|
425
431
|
throw new MissingBranchContextError(`No project/branch context found. Link a branch (\`${getCliName()} link\` / \`${getCliName()} checkout\`) or pass --project-id and --branch.`);
|
|
426
432
|
};
|
|
433
|
+
/** Drop the read-back object storage when `keep` does not name it. */
|
|
434
|
+
const withholdSecretServices = (config, keep) => {
|
|
435
|
+
if (keep === void 0 || keep.includes("object-storage") || config.preview?.buckets === void 0) return {
|
|
436
|
+
config,
|
|
437
|
+
withheld: []
|
|
438
|
+
};
|
|
439
|
+
const { buckets: _, ...preview } = config.preview;
|
|
440
|
+
return {
|
|
441
|
+
config: {
|
|
442
|
+
...config,
|
|
443
|
+
preview
|
|
444
|
+
},
|
|
445
|
+
withheld: ["object-storage"]
|
|
446
|
+
};
|
|
447
|
+
};
|
|
427
448
|
/** The same config with the AI Gateway enabled, leaving any other `preview` entries intact. */
|
|
428
449
|
const withAiGateway = (config) => ({
|
|
429
450
|
...config,
|
|
@@ -456,7 +477,10 @@ const withAiGateway = (config) => ({
|
|
|
456
477
|
*/
|
|
457
478
|
const resolveWithImpliedGateway = async (config, ctx, branch) => {
|
|
458
479
|
const unreachable = await credentialsUnreachable(ctx, branch);
|
|
459
|
-
if (unreachable === null) return await fetchAndProject(withAiGateway(config), ctx, {
|
|
480
|
+
if (unreachable === null) return await fetchAndProject(withAiGateway(config), ctx, {
|
|
481
|
+
resolvedBranch: branch.resolvedBranch,
|
|
482
|
+
...branch.revokeSuperseded === false ? { revokeSuperseded: false } : {}
|
|
483
|
+
});
|
|
460
484
|
log.warning(`Could not reach the AI Gateway's credentials, so %s were not resolved. Everything else was. Either this project does not have the AI Gateway, or the call failed — \`${getCliName()} env pull -s ai-gateway\` will say which.\nDetails: %s`, [NEON_ENV_VAR_KEYS.aiGateway.apiKey, NEON_ENV_VAR_KEYS.aiGateway.baseUrl].join(" and "), unreachable);
|
|
461
485
|
const pulled = await fetchAndProject(config, ctx, { resolvedBranch: branch.resolvedBranch });
|
|
462
486
|
return {
|
|
@@ -497,15 +521,20 @@ const resolveSelectedServices = async (ctx, directServices, envKeys) => {
|
|
|
497
521
|
const selectedKeys = envKeysForSelection(directServices, envKeys);
|
|
498
522
|
const api = apiFor(ctx);
|
|
499
523
|
const has = (service) => services.includes(service);
|
|
524
|
+
const optional = ctx.optionalServices ?? [];
|
|
525
|
+
const read = (service, load, absent) => optional.includes(service) ? absentWhenUnavailable(load, absent) : load();
|
|
500
526
|
const checkAiGateway = has("ai-gateway") && !selectedKeys.includes(NEON_ENV_VAR_KEYS.aiGateway.apiKey);
|
|
501
527
|
const [auth, dataApiEnabled, realtime, buckets, aiGatewayAvailable] = await Promise.all([
|
|
502
|
-
has("auth") ? api.getNeonAuth(projectId, branchId) : null,
|
|
503
|
-
has("data-api") ? readDataApiEnabled(api, projectId, branchId) : null,
|
|
504
|
-
has("realtime") ? readRealtime(api, projectId, branchId)
|
|
505
|
-
|
|
528
|
+
has("auth") ? read("auth", () => api.getNeonAuth(projectId, branchId), null) : null,
|
|
529
|
+
has("data-api") ? read("data-api", () => readDataApiEnabled(api, projectId, branchId), false) : null,
|
|
530
|
+
has("realtime") ? read("realtime", () => readRealtime(api, projectId, branchId), {
|
|
531
|
+
enabled: false,
|
|
532
|
+
pending: false
|
|
533
|
+
}) : null,
|
|
534
|
+
has("object-storage") ? read("object-storage", () => api.listBranchBuckets(projectId, branchId), []) : null,
|
|
506
535
|
checkAiGateway ? readAiGatewayAvailable(api, projectId, branchId) : null
|
|
507
536
|
]);
|
|
508
|
-
const config = configForServices(services, branchId, {
|
|
537
|
+
const { config, skipped } = configForServices(services, branchId, {
|
|
509
538
|
authEnabled: auth !== null,
|
|
510
539
|
dataApiEnabled,
|
|
511
540
|
realtimeEnabled: realtime === null ? false : realtime.enabled || realtime.pending,
|
|
@@ -513,12 +542,29 @@ const resolveSelectedServices = async (ctx, directServices, envKeys) => {
|
|
|
513
542
|
aiGatewayAvailable: aiGatewayAvailable ?? true
|
|
514
543
|
}, {
|
|
515
544
|
directServices,
|
|
516
|
-
envKeys
|
|
545
|
+
envKeys,
|
|
546
|
+
optional
|
|
517
547
|
});
|
|
518
|
-
|
|
548
|
+
const resolved = await fetchAndProject(config, ctx, {
|
|
519
549
|
keys: selectedKeys,
|
|
520
550
|
revokeSuperseded: false
|
|
521
551
|
});
|
|
552
|
+
return skipped.length > 0 ? {
|
|
553
|
+
...resolved,
|
|
554
|
+
skipped
|
|
555
|
+
} : resolved;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Read an optional service's live state, treating a feature the project or region lacks
|
|
559
|
+
* (`FeatureUnavailable`, or a route-level 404) as absent, as `pullConfig` does.
|
|
560
|
+
*/
|
|
561
|
+
const absentWhenUnavailable = async (load, absent) => {
|
|
562
|
+
try {
|
|
563
|
+
return await load();
|
|
564
|
+
} catch (error) {
|
|
565
|
+
if (isPlatformError(error) && (error.code === ErrorCode.FeatureUnavailable || error.code === ErrorCode.NotFound && error.details.status === 404)) return absent;
|
|
566
|
+
throw error;
|
|
567
|
+
}
|
|
522
568
|
};
|
|
523
569
|
/**
|
|
524
570
|
* Whether the branch has a Data API integration — or `null` when that cannot be determined.
|
|
@@ -557,7 +603,7 @@ const NEON_DEFAULT_DATABASE = "neondb";
|
|
|
557
603
|
* {@link ServiceNotOnBranchError} for anything the branch does not have. Naming a service
|
|
558
604
|
* that isn't there has to fail rather than contribute no vars, or a scoped pull would report
|
|
559
605
|
* "no Neon env variables to pull" — which reads as a statement about the branch rather than
|
|
560
|
-
* about the selection.
|
|
606
|
+
* about the selection. An optional service the branch lacks is returned in `skipped` instead.
|
|
561
607
|
*/
|
|
562
608
|
const configForServices = (services, branchId, branch, selection) => {
|
|
563
609
|
const provisionWith = {
|
|
@@ -579,28 +625,26 @@ const configForServices = (services, branchId, branch, selection) => {
|
|
|
579
625
|
const names = selection.envKeys.filter((key) => serviceForEnvKey(key) === "ai-gateway").join(", ");
|
|
580
626
|
throw new ServiceNotOnBranchError(`--env ${names}: ${reason}, so ${names} cannot be pulled. Use another project, or drop ${names} from --env.`);
|
|
581
627
|
};
|
|
628
|
+
const skipped = [];
|
|
629
|
+
const onBranch = (service, present, what) => {
|
|
630
|
+
if (present) return true;
|
|
631
|
+
if (!selection.optional.includes(service)) notOnBranch(service, what);
|
|
632
|
+
skipped.push(service);
|
|
633
|
+
return false;
|
|
634
|
+
};
|
|
582
635
|
const config = {};
|
|
583
|
-
if (services.includes("auth"))
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
if (services.includes("data-api")) {
|
|
588
|
-
if (branch.dataApiEnabled === false) notOnBranch("data-api", "Data API integration");
|
|
589
|
-
config.dataApi = true;
|
|
590
|
-
}
|
|
591
|
-
if (services.includes("realtime")) {
|
|
592
|
-
if (!branch.realtimeEnabled) notOnBranch("realtime", "Realtime integration");
|
|
593
|
-
config.preview = { realtime: true };
|
|
594
|
-
}
|
|
595
|
-
if (services.includes("object-storage")) {
|
|
596
|
-
if (branch.buckets.length === 0) notOnBranch("object-storage", "object-storage buckets");
|
|
597
|
-
config.buckets = Object.fromEntries(branch.buckets.map((bucket) => [bucket.name, { access: bucket.accessLevel }]));
|
|
598
|
-
}
|
|
636
|
+
if (services.includes("auth") && onBranch("auth", branch.authEnabled, "Neon Auth integration")) config.auth = true;
|
|
637
|
+
if (services.includes("data-api") && onBranch("data-api", branch.dataApiEnabled !== false, "Data API integration")) config.dataApi = true;
|
|
638
|
+
if (services.includes("realtime") && onBranch("realtime", branch.realtimeEnabled, "Realtime integration")) config.preview = { realtime: true };
|
|
639
|
+
if (services.includes("object-storage") && onBranch("object-storage", branch.buckets.length > 0, "object-storage buckets")) config.buckets = Object.fromEntries(branch.buckets.map((bucket) => [bucket.name, { access: bucket.accessLevel }]));
|
|
599
640
|
if (services.includes("ai-gateway")) {
|
|
600
641
|
if (!branch.aiGatewayAvailable) aiGatewayUnavailable();
|
|
601
642
|
config.aiGateway = true;
|
|
602
643
|
}
|
|
603
|
-
return
|
|
644
|
+
return {
|
|
645
|
+
config,
|
|
646
|
+
skipped
|
|
647
|
+
};
|
|
604
648
|
};
|
|
605
649
|
/**
|
|
606
650
|
* `neon dev`'s env resolver: {@link resolveNeonEnvVars} with graceful degradation.
|
|
@@ -8,7 +8,7 @@ import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
|
8
8
|
import { n as NEON_ENV_VAR_KEYS } from "./env-EJU-0InB.js";
|
|
9
9
|
import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, isLegacyFunctionBaseUrlKey, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
|
|
10
10
|
import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
|
|
11
|
-
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-
|
|
11
|
+
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "./env-BWvi2_2f.js";
|
|
12
12
|
import { warnAiGateway } from "../utils/ai_gateway_notice.js";
|
|
13
13
|
import { formatPulledEnv, pulledBranch } from "../commands/env_output.js";
|
|
14
14
|
import { existsSync } from "node:fs";
|
|
@@ -78,9 +78,10 @@ const builder = (argv) => argv.usage("$0 env <sub-command> [options]").options({
|
|
|
78
78
|
"API. Naming unsupported services with --service / --env warns",
|
|
79
79
|
"and writes nothing for them.",
|
|
80
80
|
"",
|
|
81
|
-
"The pull bundled into link / checkout / config apply follows 2 and 3",
|
|
82
|
-
"
|
|
83
|
-
"
|
|
81
|
+
"The pull bundled into link / checkout / config apply follows 2 and 3,",
|
|
82
|
+
"with the AI Gateway only when the file already has its variables. It",
|
|
83
|
+
"leaves Object Storage out when the file holds AWS_* keys that are not",
|
|
84
|
+
"Neon's, so it never overwrites them."
|
|
84
85
|
].join("\n")).example("$0 env pull", "Write the linked branch's Neon vars into .env.local (or .env if present)").example("$0 env pull --branch preview --file .env.preview", "Pull a specific branch into a specific file").example("$0 env pull -s ai-gateway -s postgres", "Pull only the AI Gateway and Postgres variables").example("$0 env pull -e DATABASE_URL", "Pull only the pooled Postgres connection string").example("$0 env pull -s auth -e DATABASE_URL", "Pull all Auth variables plus DATABASE_URL").example("$0 env pull -s functions", "Pull NEON_BRANCH_ID and NEON_FUNCTION_HOST_SUFFIX, which functionBaseUrl(\"<slug>\") from @neon/env reads").strict(), async (args) => {
|
|
85
86
|
const rawServices = servicesFlagValue(args.service);
|
|
86
87
|
const rawEnvKeys = envPullFlagValue(args.env);
|
|
@@ -145,7 +146,7 @@ const pull = async (props, opts = {}) => {
|
|
|
145
146
|
const targetPath = resolveEnvFilePath(location, props.file);
|
|
146
147
|
const fileExisted = existsSync(targetPath);
|
|
147
148
|
const existingEnv = fileExisted ? readEnvFile(targetPath) : {};
|
|
148
|
-
const { vars, credential, skipped } = await resolveNeonEnvVars({
|
|
149
|
+
const { vars, credential, skipped, withheld } = await resolveNeonEnvVars({
|
|
149
150
|
...location,
|
|
150
151
|
projectId: props.projectId,
|
|
151
152
|
branchId,
|
|
@@ -154,6 +155,8 @@ const pull = async (props, opts = {}) => {
|
|
|
154
155
|
...existingEnv
|
|
155
156
|
},
|
|
156
157
|
...props.services !== void 0 ? { services: props.services } : {},
|
|
158
|
+
...props.optionalServices !== void 0 ? { optionalServices: props.optionalServices } : {},
|
|
159
|
+
...opts.bundled ? { secretServices: bundledSecretServices(existingEnv) } : {},
|
|
157
160
|
...props.envKeys !== void 0 ? { envKeys: props.envKeys } : {},
|
|
158
161
|
...opts.implyAiGateway ? { implyAiGateway: true } : {},
|
|
159
162
|
omitUnsetFunctionEnv: true,
|
|
@@ -174,7 +177,8 @@ const pull = async (props, opts = {}) => {
|
|
|
174
177
|
written,
|
|
175
178
|
removed,
|
|
176
179
|
file: targetPath,
|
|
177
|
-
...credential && credential.keys.length > 0 ? { credential } : {}
|
|
180
|
+
...credential && credential.keys.length > 0 ? { credential } : {},
|
|
181
|
+
...withheld && withheld.length > 0 ? { withheld } : {}
|
|
178
182
|
}, cwd, namedBranch));
|
|
179
183
|
if (!fileExisted) ensureGitignored(targetPath);
|
|
180
184
|
const gatewayBaseUrl = neonVars.NEON_AI_GATEWAY_BASE_URL;
|
|
@@ -193,10 +197,29 @@ const pull = async (props, opts = {}) => {
|
|
|
193
197
|
removed,
|
|
194
198
|
file: targetPath,
|
|
195
199
|
...credential && credential.keys.length > 0 ? { credential } : {},
|
|
196
|
-
...skipped && skipped.length > 0 ? { skipped } : {}
|
|
200
|
+
...skipped && skipped.length > 0 ? { skipped } : {},
|
|
201
|
+
...withheld && withheld.length > 0 ? { withheld } : {}
|
|
197
202
|
};
|
|
198
203
|
};
|
|
199
204
|
/**
|
|
205
|
+
* The credential-backed services a bundled pull may resolve for this file. Object storage
|
|
206
|
+
* is left out when the file holds `AWS_*` keys not paired with a Neon branch storage
|
|
207
|
+
* endpoint: those are the user's own (AWS, R2, MinIO), and `AWS_*` is never pruned, so
|
|
208
|
+
* writing would overwrite them. The AI Gateway is included only when the file already has
|
|
209
|
+
* its variables, since nobody named it.
|
|
210
|
+
*/
|
|
211
|
+
const bundledSecretServices = (env) => {
|
|
212
|
+
const has = (key) => (env[key] ?? "") !== "";
|
|
213
|
+
const endpoint = env[NEON_ENV_VAR_KEYS.storage.endpoint];
|
|
214
|
+
return [...(has(NEON_ENV_VAR_KEYS.storage.accessKeyId) || has(NEON_ENV_VAR_KEYS.storage.secretAccessKey)) && !(endpoint !== void 0 && isNeonStorageEndpoint(endpoint)) ? [] : ["object-storage"], ...Object.values(NEON_ENV_VAR_KEYS.aiGateway).some(has) ? ["ai-gateway"] : []];
|
|
215
|
+
};
|
|
216
|
+
/** `https://<branch id>.storage.<region host>`, the shape Neon's branch storage API returns. */
|
|
217
|
+
const isNeonStorageEndpoint = (endpoint) => {
|
|
218
|
+
if (!URL.canParse(endpoint)) return false;
|
|
219
|
+
const [branch, service] = new URL(endpoint).hostname.split(".");
|
|
220
|
+
return branch?.startsWith("br-") === true && service === "storage";
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
200
223
|
* Prevents scoped or unavailable services from pruning values they did not resolve. A pull
|
|
201
224
|
* that covers functions also prunes the `NEON_FUNCTION_<SLUG>_BASE_URL` lines earlier
|
|
202
225
|
* releases wrote, since nothing reads or refreshes them anymore.
|
|
@@ -256,7 +279,10 @@ const autoPullEnvAfterPin = async (props, branch) => {
|
|
|
256
279
|
return { status: "skipped" };
|
|
257
280
|
}
|
|
258
281
|
try {
|
|
259
|
-
return await pull(props,
|
|
282
|
+
return await pull(props, {
|
|
283
|
+
bundled: true,
|
|
284
|
+
...branch ? { branch } : {}
|
|
285
|
+
});
|
|
260
286
|
} catch (err) {
|
|
261
287
|
const message = err instanceof Error ? err.message : String(err);
|
|
262
288
|
log.warning(`Branch pinned, but pulling its Neon env vars failed: %s
|
|
@@ -5,8 +5,8 @@ import { CONTEXT_FILE, contextBranch, gitBranchMap, gitBranchMapping, isUnfollow
|
|
|
5
5
|
import { writer } from "../writer.js";
|
|
6
6
|
import { neonSafeBranchName } from "../utils/branch_name.js";
|
|
7
7
|
import { currentGitBranch, gitPull, gitRepoRoot, hasUpstream, installPostCheckoutHook, isGitRepo, isManagedHook, localGitBranches, postCheckoutHookPath, readGitContext, removePostCheckoutHook } from "../utils/git.js";
|
|
8
|
-
import { o as quoteFlagValue } from "./link-
|
|
9
|
-
import { o as handler$1 } from "./checkout-
|
|
8
|
+
import { o as quoteFlagValue } from "./link-BVa6Nfji.js";
|
|
9
|
+
import { o as handler$1 } from "./checkout-CLHGCpZx.js";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import chalk from "chalk";
|
|
@@ -13,8 +13,8 @@ import { writer } from "../writer.js";
|
|
|
13
13
|
import { createBranch, pickBranchInteractively } from "../utils/branch_picker.js";
|
|
14
14
|
import { looksLikeBranchId } from "../utils/formats.js";
|
|
15
15
|
import { listAllProjectBranches } from "../utils/enrichers.js";
|
|
16
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
17
|
-
import { h as initCmd } from "./config-
|
|
16
|
+
import { n as autoPullEnvAfterPin } from "./env-C3HQJO8Z.js";
|
|
17
|
+
import { h as initCmd } from "./config-C8BQIoM2.js";
|
|
18
18
|
import { formatLinkSummary } from "../commands/link_output.js";
|
|
19
19
|
import { r as REGIONS } from "./projects-a3X4OFEJ.js";
|
|
20
20
|
import prompts from "prompts";
|
|
@@ -84,7 +84,7 @@ const builder = (argv) => argv.usage("$0 mcp [options]").options({
|
|
|
84
84
|
for (const part of item.split(",")) {
|
|
85
85
|
const trimmed = part.trim();
|
|
86
86
|
if (trimmed === "") throw new Error("--category needs a value. Pass one, or omit the flag entirely.");
|
|
87
|
-
parts.push(trimmed);
|
|
87
|
+
parts.push(...trimmed.split(/\s+/));
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
return parseMcpCategories(parts);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
2
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
3
|
-
import { y as status } from "./config-
|
|
3
|
+
import { y as status } from "./config-C8BQIoM2.js";
|
|
4
4
|
// src/commands/status.ts
|
|
5
5
|
var status_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
builder: () => builder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-
|
|
1
|
+
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-CLHGCpZx.js";
|
package/dist/commands/claim.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-
|
|
1
|
+
export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-BoN9NPTy.js";
|
package/dist/commands/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-
|
|
1
|
+
export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-C8BQIoM2.js";
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-
|
|
1
|
+
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-BdipMGJE.js";
|
package/dist/commands/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionPortsEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-
|
|
1
|
+
export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionPortsEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-DVB7fGiG.js";
|
package/dist/commands/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-
|
|
1
|
+
export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-C3HQJO8Z.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCliName } from "../utils/cli_name.js";
|
|
1
2
|
import { NEON_SERVICES, NEON_SERVICE_LABELS } from "../neon_services.js";
|
|
2
3
|
import { BRANCH_ENV_KEYS, ENV_PULL_KEYS, isLegacyFunctionBaseUrlKey, serviceForEnvKey } from "../env_services.js";
|
|
3
4
|
import { isAbsolute, relative } from "node:path";
|
|
@@ -57,10 +58,11 @@ const formatPulledEnv = (outcome, cwd, branch) => {
|
|
|
57
58
|
}
|
|
58
59
|
if (outcome.removed.length > 0) lines.push(row("Removed", `${outcome.removed.join(", ")} (not produced by this pull)`));
|
|
59
60
|
if (outcome.removed.some(isLegacyFunctionBaseUrlKey)) lines.push(row("", "Use functionBaseUrl(\"<slug>\") from @neon/env instead."));
|
|
61
|
+
if (outcome.withheld?.includes("object-storage")) lines.push(row("Not pulled", `Object Storage, to keep the AWS_* keys already in ${displayPath(outcome.file, cwd)}. Use \`${getCliName()} env pull -s object-storage\` to replace them.`));
|
|
60
62
|
if (fresh.size > 0) lines.push(" * new credential value");
|
|
61
63
|
const credential = outcome.credential;
|
|
62
64
|
if (credential?.issued && credential.revoked.length > 0) lines.push(`Revoked the credential it replaced (${credential.revoked.join(", ")}).`);
|
|
63
|
-
else if (credential?.issued && credential.superseded.length > 0) lines.push(`Left the credential it replaced live (${credential.superseded.join(", ")}):
|
|
65
|
+
else if (credential?.issued && credential.superseded.length > 0) lines.push(`Left the credential it replaced live (${credential.superseded.join(", ")}): this pull can't tell which other variables still use it. Revoke it in the Neon Console if nothing does.`);
|
|
64
66
|
return `${lines.join("\n")}\n`;
|
|
65
67
|
};
|
|
66
68
|
export { displayPath, formatPulledEnv, pulledBranch, row };
|
|
@@ -9,7 +9,7 @@ import { writer } from "../writer.js";
|
|
|
9
9
|
import { formatInitDone, printInitDone } from "../init/chrome.js";
|
|
10
10
|
import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
|
|
11
11
|
import { displayPath } from "./env_output.js";
|
|
12
|
-
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-
|
|
12
|
+
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-C8BQIoM2.js";
|
|
13
13
|
import { recommendedOperations } from "../functions/registry.js";
|
|
14
14
|
import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
|
|
15
15
|
import { describeRegistrySources, openRegistry } from "../functions/source.js";
|
package/dist/commands/git.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-
|
|
1
|
+
export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-CIXLNUoh.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -2,29 +2,29 @@ import { r as auth_exports } from "../_chunks/auth-CFa969Ck.js";
|
|
|
2
2
|
import { t as api_exports } from "../_chunks/api-1MKsfpY3.js";
|
|
3
3
|
import { n as api_keys_exports } from "../_chunks/api_keys-CTFHd5m_.js";
|
|
4
4
|
import { n as ask_exports } from "../_chunks/ask-Xlek1Pxh.js";
|
|
5
|
-
import { o as env_exports } from "../_chunks/env-
|
|
6
|
-
import { c as config_exports } from "../_chunks/config-
|
|
5
|
+
import { o as env_exports } from "../_chunks/env-C3HQJO8Z.js";
|
|
6
|
+
import { c as config_exports } from "../_chunks/config-C8BQIoM2.js";
|
|
7
7
|
import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
|
|
8
|
-
import { a as link_exports } from "../_chunks/link-
|
|
9
|
-
import { o as mcp_exports } from "../_chunks/mcp-
|
|
8
|
+
import { a as link_exports } from "../_chunks/link-BVa6Nfji.js";
|
|
9
|
+
import { o as mcp_exports } from "../_chunks/mcp-g8C-BZIb.js";
|
|
10
10
|
import { c as plugins_exports } from "../_chunks/plugins-BwUZQ6Ic.js";
|
|
11
11
|
import { l as skills_exports } from "../_chunks/skills-Bv8oKKwE.js";
|
|
12
12
|
import { t as bootstrap_exports } from "../_chunks/bootstrap-B73qVB39.js";
|
|
13
13
|
import { r as branches_exports } from "../_chunks/branches-Bp-5z1lM.js";
|
|
14
14
|
import { n as bucket_exports } from "../_chunks/bucket-D06bvDSa.js";
|
|
15
|
-
import { n as checkout_exports } from "../_chunks/checkout-
|
|
16
|
-
import { o as claim_exports } from "../_chunks/claim-
|
|
15
|
+
import { n as checkout_exports } from "../_chunks/checkout-CLHGCpZx.js";
|
|
16
|
+
import { o as claim_exports } from "../_chunks/claim-BoN9NPTy.js";
|
|
17
17
|
import { o as connection_string_exports } from "../_chunks/connection_string-6WhV4WFx.js";
|
|
18
18
|
import { a as credentials_exports } from "../_chunks/credentials-KV1jlK-n.js";
|
|
19
19
|
import { r as data_api_exports } from "../_chunks/data_api-BpSGbdZf.js";
|
|
20
20
|
import { s as databases_exports } from "../_chunks/databases-B-qY303S.js";
|
|
21
|
-
import { r as deploy_exports } from "../_chunks/deploy-
|
|
22
|
-
import { s as dev_exports } from "../_chunks/dev-
|
|
21
|
+
import { r as deploy_exports } from "../_chunks/deploy-BdipMGJE.js";
|
|
22
|
+
import { s as dev_exports } from "../_chunks/dev-DVB7fGiG.js";
|
|
23
23
|
import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
|
|
24
24
|
import { c as docs_exports } from "../_chunks/docs-DjYRHjGY.js";
|
|
25
25
|
import { o as feedback_exports } from "../_chunks/feedback-mQmdTRFn.js";
|
|
26
26
|
import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
|
|
27
|
-
import { o as git_exports } from "../_chunks/git-
|
|
27
|
+
import { o as git_exports } from "../_chunks/git-CIXLNUoh.js";
|
|
28
28
|
import { o as incidents_exports } from "../_chunks/incidents-BSFkUu1P.js";
|
|
29
29
|
import { a as init_exports } from "../_chunks/init-BSwLzxjX.js";
|
|
30
30
|
import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
|
|
@@ -41,7 +41,7 @@ import { o as profile_exports } from "../_chunks/profile-DWyfpl03.js";
|
|
|
41
41
|
import { s as realtime_exports } from "../_chunks/realtime-cV7-c2-O.js";
|
|
42
42
|
import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
|
|
43
43
|
import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
|
|
44
|
-
import { a as status_exports } from "../_chunks/status-
|
|
44
|
+
import { a as status_exports } from "../_chunks/status-BBnw48qR.js";
|
|
45
45
|
import { d as triggers_exports } from "../_chunks/triggers-m3IBjiph.js";
|
|
46
46
|
import { s as user_exports } from "../_chunks/user-iNYSe0KI.js";
|
|
47
47
|
import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-C-Y4WK2M.js";
|
package/dist/commands/link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-BVa6Nfji.js";
|
package/dist/commands/mcp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler, a as mcpInstallError, s as reportMcpInstall, c as setupNeonMcp } from "../_chunks/mcp-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler, a as mcpInstallError, s as reportMcpInstall, c as setupNeonMcp } from "../_chunks/mcp-g8C-BZIb.js";
|
package/dist/commands/status.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-BBnw48qR.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writer } from "../writer.js";
|
|
2
2
|
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
3
|
-
import { o as resolveNeonEnvVars } from "../_chunks/env-
|
|
3
|
+
import { o as resolveNeonEnvVars } from "../_chunks/env-BWvi2_2f.js";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
// src/commands/subscribe.ts
|
|
6
6
|
const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
|
package/dist/dev/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as DevEnvMismatchError, n as MissingBranchContextError, r as ServiceNotOnBranchError, i as dropClaimableUnsupported, a as resolveDevEnv, o as resolveNeonEnvVars } from "../_chunks/env-
|
|
1
|
+
export { t as DevEnvMismatchError, n as MissingBranchContextError, r as ServiceNotOnBranchError, i as dropClaimableUnsupported, a as resolveDevEnv, o as resolveNeonEnvVars } from "../_chunks/env-BWvi2_2f.js";
|
package/dist/env_services.js
CHANGED
|
@@ -84,9 +84,13 @@ const envKeysForSelection = (services, envKeys) => {
|
|
|
84
84
|
if (selected.has(NEON_ENV_VAR_KEYS.storage.accessKeyId) !== selected.has(NEON_ENV_VAR_KEYS.storage.secretAccessKey)) throw new Error("AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be selected together: they are two halves of one newly issued object-storage credential. Add the missing key to --env, or use --service object-storage.");
|
|
85
85
|
return ENV_PULL_KEYS.filter((key) => selected.has(key));
|
|
86
86
|
};
|
|
87
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Parse repeated or comma-separated `--env` values into canonical env-key order. Whitespace
|
|
89
|
+
* also separates, because npm's `.ps1` shim hands an unquoted PowerShell `A,B` to the CLI as
|
|
90
|
+
* the single value `A B`.
|
|
91
|
+
*/
|
|
88
92
|
const parseEnvPullKeys = (raw, flag) => {
|
|
89
|
-
const names = raw.flatMap((value) => value.split(
|
|
93
|
+
const names = raw.flatMap((value) => value.split(/[\s,]+/)).filter((name) => name !== "");
|
|
90
94
|
const supported = `Supported values: ${ENV_PULL_KEY_HELP}.`;
|
|
91
95
|
if (names.length === 0) throw new Error(`${flag} needs at least one env variable. ${supported}`);
|
|
92
96
|
const legacy = names.filter(isLegacyFunctionBaseUrlKey);
|
package/dist/init/auth.js
CHANGED
|
@@ -4,8 +4,8 @@ import "../config.js";
|
|
|
4
4
|
import "../auth.js";
|
|
5
5
|
import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-CFa969Ck.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
|
-
import { c as pull } from "../_chunks/env-
|
|
8
|
-
import { c as setupNeonMcp } from "../_chunks/mcp-
|
|
7
|
+
import { c as pull } from "../_chunks/env-C3HQJO8Z.js";
|
|
8
|
+
import { c as setupNeonMcp } from "../_chunks/mcp-g8C-BZIb.js";
|
|
9
9
|
// src/init/auth.ts
|
|
10
10
|
const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
|
|
11
11
|
const authenticationFailed = () => /* @__PURE__ */ new Error("Authentication failed.");
|
package/dist/init/choices.js
CHANGED
|
@@ -27,20 +27,18 @@ const configPlanFromResolution = (resolution, accepted) => {
|
|
|
27
27
|
* from the branch's compute host.
|
|
28
28
|
*/
|
|
29
29
|
const DEPLOY_FREE_SERVICES = /* @__PURE__ */ new Set(["ai-gateway", "functions"]);
|
|
30
|
-
const needsDeploy = (
|
|
30
|
+
const needsDeploy = (service) => !DEPLOY_FREE_SERVICES.has(service);
|
|
31
31
|
const initEnvPullAfterConfig = (input) => {
|
|
32
32
|
if (!input.projectId || !input.branch) return { kind: "skip" };
|
|
33
33
|
if (!input.linkDeferredPull && !input.wroteNewFile) return { kind: "skip" };
|
|
34
34
|
if (input.claimable && input.declared.length > 0) return { kind: "skip" };
|
|
35
|
-
|
|
35
|
+
const pending = input.declared.filter(needsDeploy);
|
|
36
|
+
if (pending.length === 0) return { kind: "policy" };
|
|
36
37
|
return {
|
|
37
38
|
kind: "services",
|
|
38
|
-
services: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...input.declared.includes("functions") ? ["functions"] : []
|
|
42
|
-
],
|
|
43
|
-
envKeys: []
|
|
39
|
+
services: ["postgres", ...input.declared],
|
|
40
|
+
envKeys: [],
|
|
41
|
+
optionalServices: pending
|
|
44
42
|
};
|
|
45
43
|
};
|
|
46
44
|
export { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice };
|
package/dist/init/deploy.js
CHANGED
|
@@ -4,7 +4,7 @@ import { c as ensureAuth } from "../_chunks/auth-CFa969Ck.js";
|
|
|
4
4
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
5
5
|
import { loadProjectConfig } from "../project.js";
|
|
6
6
|
import { loadEnvFileIntoProcess } from "../env_file.js";
|
|
7
|
-
import { r as applyCmd } from "../_chunks/config-
|
|
7
|
+
import { r as applyCmd } from "../_chunks/config-C8BQIoM2.js";
|
|
8
8
|
import { authContext } from "./auth.js";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
10
|
import { missingFunctionEnv } from "@neon/config";
|
package/dist/init/link.js
CHANGED
|
@@ -4,7 +4,7 @@ import "../config.js";
|
|
|
4
4
|
import "../auth.js";
|
|
5
5
|
import { c as ensureAuth } from "../_chunks/auth-CFa969Ck.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
|
-
import { s as runLink } from "../_chunks/link-
|
|
7
|
+
import { s as runLink } from "../_chunks/link-BVa6Nfji.js";
|
|
8
8
|
// src/init/link.ts
|
|
9
9
|
const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
|
|
10
10
|
const authenticationFailed = () => /* @__PURE__ */ new Error("Authentication failed.");
|
package/dist/init/run.js
CHANGED
|
@@ -15,8 +15,8 @@ import { getAgentDisplayName } from "../mcp/agents.js";
|
|
|
15
15
|
import { missingPluginsCommands, pluginsCommandProblemText, pluginsInstallableAgents, unusablePluginsCommands } from "../plugins/targets.js";
|
|
16
16
|
import { AGENTS_NOT_INSTALLED, CANCELLED_BODY, CLAIMABLE_ACCOUNT_FLAGS, CLAIMABLE_ALREADY_LINKED, CLAIMABLE_MCP_API_KEY, CLAIMABLE_NO_LINK, MCP_API_KEY_NEEDS_AUTH, MCP_SCOPED_NEEDS_PROJECT, NON_TTY_LINK_NEEDS_AUTH, NO_AGENTS_FALLBACK_STATUS, PROGRESS, PROJECT_PINNED_OFFLINE, claimableNext, claimableThenServicesNext, configInitNext, envPullFailedNext, existingConfigNext, installFailedNext, mcpAfterLinkNext, mcpConfigLocationSkipped, mcpConfigLocationUnavailable, mcpKeyFailedNext, namedAgentsUnavailable, newConfigNext, offlinePinNext, skippedLinkNext, toolingFailedNext, unattendedUnauthedNext } from "./copy.js";
|
|
17
17
|
import { agentsRowValue, configRowValue, formatInitDone, headingForKind, printInitBanner, printInitDone, printInitProgress, projectRowValue, shouldPrintInitBanner } from "./chrome.js";
|
|
18
|
-
import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-
|
|
19
|
-
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-
|
|
18
|
+
import { h as initCmd, t as ConfigInstallFailed } from "../_chunks/config-C8BQIoM2.js";
|
|
19
|
+
import { o as quoteFlagValue, s as runLink } from "../_chunks/link-BVa6Nfji.js";
|
|
20
20
|
import { runAuthenticatedLink } from "./link.js";
|
|
21
21
|
import { mcpInstallableAgents } from "../mcp/targets.js";
|
|
22
22
|
import { skillsInstallableAgents } from "../skills/targets.js";
|
|
@@ -26,7 +26,7 @@ import { pullInitEnv, resolveInitConfigApi } from "./auth.js";
|
|
|
26
26
|
import { InitCancelled, raceSigint, restoreCursor } from "./cancelled.js";
|
|
27
27
|
import { pickAgentSetupInteractively, pickInitAgentsInteractively, pickInitConfigInteractively, pickInitMcpAuthInteractively, pickInitMcpConfigLocationInteractively, pickInitModeInteractively, pickInitPackageManagerInteractively, pickInitProjectSetupInteractively, pickInitServicesInteractively, pickInitSkillsInteractively } from "./wizard.js";
|
|
28
28
|
import { runToolingSteps, toolingStepCommandText } from "./tooling.js";
|
|
29
|
-
import { l as create } from "../_chunks/claim-
|
|
29
|
+
import { l as create } from "../_chunks/claim-BoN9NPTy.js";
|
|
30
30
|
import { INIT_CONFIG_SERVICES_CONFLICT, configPlanFromResolution, initEnvPullAfterConfig, resolveInitConfigChoice } from "./choices.js";
|
|
31
31
|
import { detectInitEnvironment } from "./detect.js";
|
|
32
32
|
import { createInitFunnel, emitInitStart, finishInitFunnel, initStartProperties, recordInitError, recordInitExit } from "./funnel.js";
|
|
@@ -634,7 +634,8 @@ const runInit = async (props) => {
|
|
|
634
634
|
branch,
|
|
635
635
|
...envPullPlan.kind === "services" ? {
|
|
636
636
|
services: envPullPlan.services,
|
|
637
|
-
envKeys: envPullPlan.envKeys
|
|
637
|
+
envKeys: envPullPlan.envKeys,
|
|
638
|
+
optionalServices: envPullPlan.optionalServices
|
|
638
639
|
} : {}
|
|
639
640
|
}));
|
|
640
641
|
} catch (error) {
|
package/dist/init/tooling.js
CHANGED
|
@@ -6,7 +6,7 @@ import { assertNamedAgentTooling, chooseYesAgentTooling, collectYesAgents, initY
|
|
|
6
6
|
import { CannotMintApiKeyError } from "../mcp/mint.js";
|
|
7
7
|
import { detectAgent } from "./detect_host.js";
|
|
8
8
|
import { AgentSelectionSkipped, canPickAgentsInteractively } from "../utils/agent_picker.js";
|
|
9
|
-
import { a as mcpInstallError, s as reportMcpInstall } from "../_chunks/mcp-
|
|
9
|
+
import { a as mcpInstallError, s as reportMcpInstall } from "../_chunks/mcp-g8C-BZIb.js";
|
|
10
10
|
import { l as reportPluginsInstall, o as installPlugins, s as pluginsInstallError } from "../_chunks/plugins-BwUZQ6Ic.js";
|
|
11
11
|
import { c as skillsInstallError, o as installSkills, s as reportSkillsInstall } from "../_chunks/skills-Bv8oKKwE.js";
|
|
12
12
|
import { runAuthenticatedMcp } from "./auth.js";
|
package/dist/neon_services.js
CHANGED
|
@@ -51,9 +51,12 @@ const deprecatedServiceMessage = (used, canonical) => `"${used}" is the old name
|
|
|
51
51
|
* Parse the raw values of a services flag into a canonical selection.
|
|
52
52
|
*
|
|
53
53
|
* Accepts the flag repeated (`-s auth -s postgres`) and comma-separated
|
|
54
|
-
* (`-s auth,postgres`), since both read naturally and users will try either.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* (`-s auth,postgres`), since both read naturally and users will try either. Whitespace also
|
|
55
|
+
* separates: PowerShell reads an unquoted `auth,postgres` as an array, and npm's `.ps1` shim
|
|
56
|
+
* hands it to the CLI as the single value `auth postgres`.
|
|
57
|
+
*
|
|
58
|
+
* The result is deduplicated and sorted into {@link NEON_SERVICES} order, so what a command
|
|
59
|
+
* does never depends on typing order.
|
|
57
60
|
*
|
|
58
61
|
* An unrecognized name is rejected rather than dropped: a typo would otherwise act on
|
|
59
62
|
* everything *except* the service that was asked for, and report success. A name that is a
|
|
@@ -63,7 +66,7 @@ const deprecatedServiceMessage = (used, canonical) => `"${used}" is the old name
|
|
|
63
66
|
const parseServices = (raw, options) => {
|
|
64
67
|
const { allowed, flag, onDeprecated } = options;
|
|
65
68
|
const supported = `Supported values: ${allowed.join(", ")}.`;
|
|
66
|
-
const names = raw.flatMap((value) => value.split(
|
|
69
|
+
const names = raw.flatMap((value) => value.split(/[\s,]+/)).filter((name) => name !== "");
|
|
67
70
|
if (names.length === 0) throw new Error(`${flag} needs at least one service. ${supported}`);
|
|
68
71
|
const deprecated = /* @__PURE__ */ new Map();
|
|
69
72
|
const resolved = names.map((name) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "9.9.
|
|
3
|
+
"version": "9.9.5",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"yaml": "^2.9.0",
|
|
74
74
|
"yargs": "17.7.2",
|
|
75
75
|
"yoctocolors": "^2.1.2",
|
|
76
|
-
"@neon/config-runtime": "1.12.9",
|
|
77
76
|
"@neon/config": "1.14.6",
|
|
77
|
+
"@neon/config-runtime": "1.12.9",
|
|
78
78
|
"@neon/realtime": "0.2.1",
|
|
79
79
|
"@neon/sdk": "7.15.0"
|
|
80
80
|
},
|
|
@@ -113,8 +113,8 @@
|
|
|
113
113
|
"typescript": "^5.9.0",
|
|
114
114
|
"vitest": "^3.0.9",
|
|
115
115
|
"@neon-internals/cli-core": "0.0.0",
|
|
116
|
-
"@neon/e2e-harness": "0.0.0",
|
|
117
116
|
"@neon-internals/env-core": "0.0.57",
|
|
117
|
+
"@neon/e2e-harness": "0.0.0",
|
|
118
118
|
"@neon/env": "2.1.9",
|
|
119
119
|
"@neon/functions": "0.11.0"
|
|
120
120
|
},
|