neon 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +30 -5
  2. package/dist/{_shared/auth_selection.js → _chunks/auth_selection-DGgq6ifc.js} +3 -3
  3. package/dist/_chunks/cmd_pipeline-CUbBO9U_.js +2818 -0
  4. package/dist/{_shared/credentials.js → _chunks/credentials-MYdHdKah.js} +3 -3
  5. package/dist/_chunks/env-NbA61JR3.js +585 -0
  6. package/dist/{_shared/env-core/env.js → _chunks/env_services-Tz9G4JeT.js} +179 -43
  7. package/dist/{_shared/paths.js → _chunks/paths-DMq0Lt7a.js} +2 -2
  8. package/dist/{_shared/profiles.js → _chunks/profiles-Ir29rqns.js} +4 -13
  9. package/dist/_chunks/psql-DWH-kc69.js +2169 -0
  10. package/dist/{_virtual/_rolldown/runtime.js → _chunks/rolldown-runtime-D7D4PA-g.js} +1 -1
  11. package/dist/{_shared/secure_file.js → _chunks/secure_file-BucZj4yQ.js} +2 -4
  12. package/dist/analytics.js +2 -2
  13. package/dist/auth_context.js +1 -1
  14. package/dist/commands/api.js +2 -2
  15. package/dist/commands/api_keys.js +2 -2
  16. package/dist/commands/auth.js +7 -6
  17. package/dist/commands/bootstrap.js +3 -3
  18. package/dist/commands/branches.js +2 -2
  19. package/dist/commands/bucket.js +2 -2
  20. package/dist/commands/checkout.js +2 -2
  21. package/dist/commands/config.js +2 -2
  22. package/dist/commands/connection_string.js +2 -2
  23. package/dist/commands/data_api.js +2 -2
  24. package/dist/commands/databases.js +2 -2
  25. package/dist/commands/deploy.js +2 -2
  26. package/dist/commands/dev.js +3 -3
  27. package/dist/commands/diff.js +2 -2
  28. package/dist/commands/env.js +42 -32
  29. package/dist/commands/functions.js +2 -2
  30. package/dist/commands/index.js +35 -33
  31. package/dist/commands/init.js +3 -3
  32. package/dist/commands/inspect.js +2 -2
  33. package/dist/commands/ip_allow.js +2 -2
  34. package/dist/commands/link.js +2 -2
  35. package/dist/commands/logs.js +2 -2
  36. package/dist/commands/neon_auth.js +2 -2
  37. package/dist/commands/open.js +33 -0
  38. package/dist/commands/operations.js +2 -2
  39. package/dist/commands/orgs.js +2 -2
  40. package/dist/commands/profile.js +7 -7
  41. package/dist/commands/projects.js +2 -2
  42. package/dist/commands/psql.js +2 -2
  43. package/dist/commands/roles.js +2 -2
  44. package/dist/commands/set_context.js +2 -2
  45. package/dist/commands/snapshots.js +2 -2
  46. package/dist/commands/status.js +2 -2
  47. package/dist/commands/user.js +2 -2
  48. package/dist/commands/vpc_endpoints.js +2 -2
  49. package/dist/config.js +1 -1
  50. package/dist/dev/env.js +1 -364
  51. package/dist/env_services.js +2 -49
  52. package/dist/index.js +2 -1
  53. package/dist/init/auth.js +4 -4
  54. package/dist/psql/cli.js +1 -1
  55. package/dist/psql/command/cmd_copy.js +1 -1
  56. package/dist/psql/command/cmd_io.js +1 -1403
  57. package/dist/psql/command/cmd_pipeline.js +1 -595
  58. package/dist/psql/command/dispatch.js +1 -2
  59. package/dist/psql/core/common.js +1 -834
  60. package/dist/psql/core/mainloop.js +1 -2
  61. package/dist/psql/core/startup.js +1 -656
  62. package/dist/psql/index.js +1 -1516
  63. package/dist/psql/io/psqlrc.js +1 -1
  64. package/dist/psql/types/index.js +6 -0
  65. package/dist/utils/inspect_db.js +1 -1
  66. package/dist/utils/middlewares.js +2 -1
  67. package/package.json +7 -4
  68. package/dist/_shared/env-core/reuse-secrets.js +0 -179
package/README.md CHANGED
@@ -352,6 +352,19 @@ How today's `set-context` uses map onto `link`:
352
352
 
353
353
  The key difference: `link` resolves and **verifies** before writing (so you never get a half-written or stale `.neon`), whereas `set-context` writes whatever you give it verbatim. The closest like-for-like replacement for the old raw write is `link --no-checks`.
354
354
 
355
+ ### open
356
+
357
+ `open` launches the linked project's page in the Neon Console. It reads the closest `.neon` file without authenticating or calling the Neon API, so it works from any sub-directory of a linked project.
358
+
359
+ ```bash
360
+ neon open
361
+
362
+ # Open a project without changing the linked context
363
+ neon open --project-id polished-snowflake-12345678
364
+ ```
365
+
366
+ A branch pinned in `.neon` does not change the destination. `.neon` stores the branch as a name, while the Console route requires its ID; resolving it would turn this local command into an authenticated API call.
367
+
355
368
  ### checkout
356
369
 
357
370
  `checkout [id|name]` pins a branch in the local context so subsequent commands target it — it's the focused companion to `link` for the common "switch the branch I'm working on" case (`link` resolves org + project; `checkout` pins the branch). It resolves the branch (by name or id) against the project, then **heals** the `.neon` file: it always (re)writes `projectId`, `branch`, and `orgId` (when the project has one), so a `.neon` that was missing fields or drifted ends up complete and consistent. The branch is stored as its **name** when known (matching `link`). When `orgId` isn't already known (from `--org-id` or the existing `.neon`), it's looked up from the project itself.
@@ -421,9 +434,9 @@ The human-readable summary line goes to stderr and the diff body to stdout, so `
421
434
 
422
435
  **What gets pulled**, in precedence order:
423
436
 
424
- 1. **`--service`**, when you pass it — exactly those services, whatever else is on the branch and whatever a `neon.ts` says.
437
+ 1. **`--service` and/or `--env`**, when you pass either — their union is the complete selection, ignoring `neon.ts` and unselected branch variables. `--service` adds a service's complete variable bundle; `--env` adds only the individual variables you name.
425
438
  2. **`neon.ts`**, when the working directory has one — the policy is the source of truth, same as `neon dev` and `neon deploy`.
426
- 3. **Everything the branch has** otherwise — Postgres, Neon Auth, the Data API, and object storage read back from the branch, plus the AI Gateway. The gateway has no branch-level state to read back (it is credential-gated, not provisioned), so a bare `env pull` asks for it rather than detecting it, which mints a branch credential. To leave it out, name the services you do want with `--service`.
439
+ 3. **Everything the branch has** otherwise — Postgres, Neon Auth, the Data API, and object storage read back from the branch, plus the AI Gateway. The gateway has no branch-level state to read back, so a bare `env pull` asks for it rather than detecting it and may mint a branch credential. To leave it out, name only what you do want with `--service` and/or `--env`.
427
440
 
428
441
  If the gateway can't be resolved, it is dropped with a warning and the rest of the pull still lands. Gateway variables already in your file for *this* branch are left alone — a pull that couldn't reach the gateway is no evidence the branch has stopped having one — while ones left over from a different branch are pruned like any other stale value.
429
442
 
@@ -440,6 +453,13 @@ neon env pull --service ai-gateway
440
453
  # Repeat the flag or comma-separate; -s, --service and --services are all accepted
441
454
  neon env pull -s postgres -s data-api
442
455
  neon env pull -s postgres,auth
456
+
457
+ # Pull one exact variable; repeat -e or comma-separate for more
458
+ neon env pull -e DATABASE_URL
459
+ neon env pull -e DATABASE_URL,NEON_AUTH_BASE_URL
460
+
461
+ # The selectors compose as a union: all Auth vars plus DATABASE_URL
462
+ neon env pull -s auth -e DATABASE_URL
443
463
  ```
444
464
 
445
465
  Every services flag in the CLI takes those three spellings, the same value syntax, and the same service names — see [`config init --services`](#getting-a-neonts-config-init).
@@ -452,11 +472,15 @@ Every services flag in the CLI takes those three spellings, the same value synta
452
472
  | `object-storage` | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL_S3`, `AWS_REGION` |
453
473
  | `ai-gateway` | `NEON_AI_GATEWAY_TOKEN`, `NEON_AI_GATEWAY_BASE_URL` |
454
474
 
455
- `NEON_BRANCH` is written by every pull — it is branch identity, not a service.
475
+ `-e, --env` accepts any variable in the table plus `NEON_BRANCH`. It is case-sensitive and rejects unknown names rather than silently widening the pull. `NEON_BRANCH` is written by unscoped and service-scoped pulls because it is branch identity, not a service; an env-only pull writes it only when you select it.
476
+
477
+ `--env` never narrows `--service`: `neon env pull -s postgres -e DATABASE_URL` still pulls the complete Postgres bundle (`DATABASE_URL`, `DATABASE_URL_UNPOOLED`, and `NEON_BRANCH`). The two selectors always form a union.
478
+
479
+ **A scoped pull is scoped in both directions.** An unscoped `env pull` owns the Neon-named variables: pointing a directory at a branch without Neon Auth prunes the stale `NEON_AUTH_*` lines. `--service` narrows that to the services you named, while `--env` narrows it to the exact keys you named, so `env pull -e DATABASE_URL` never touches `DATABASE_URL_UNPOOLED`. (`AWS_*` is never pruned by any pull: those names collide with credentials you may set yourself, so `env pull` only ever writes them.)
456
480
 
457
- **A scoped pull is scoped in both directions.** An unscoped `env pull` owns the Neon-named variables: pointing a directory at a branch without Neon Auth prunes the stale `NEON_AUTH_*` lines. `--service` narrows that to the services you named, so `env pull -s ai-gateway` never touches your `DATABASE_URL`. (`AWS_*` is never pruned by any pull: those names collide with credentials you may set yourself, so `env pull` only ever writes them.)
481
+ **A scoped pull also never revokes a credential.** Where an unscoped pull revokes the credential it replaces, a scoped one leaves the old one live — it can't tell which other variables still use it. It says so when it happens; revoke it in the Neon Console if nothing does.
458
482
 
459
- **A scoped pull also never revokes a credential.** Where an unscoped pull revokes the credential it replaces, a scoped one leaves the old one live — it can't tell which other services still use it. It says so when it happens; revoke it in the Neon Console if nothing does.
483
+ `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` must be selected together. Neon issues them as one object-storage credential; pulling only one would pair a fresh half with whatever old half remains in the file.
460
484
 
461
485
  Naming a service the branch does not have is an error, not an empty pull:
462
486
 
@@ -1033,6 +1057,7 @@ API keys in org-7
1033
1057
  | checkout | | Pin a branch in `.neon` |
1034
1058
  | diff | | Git-style schema diff vs a branch |
1035
1059
  | [link](https://neon.com/docs/reference/cli-link) | | Link a directory to a project |
1060
+ | open | | Open the linked project in Console |
1036
1061
  | config | `init`, `status`, `plan`, `apply` | Drive a branch from `neon.ts` |
1037
1062
  | deploy | | Alias for `config apply` |
1038
1063
  | bootstrap | | Scaffold a project from a template |
@@ -1,5 +1,5 @@
1
- import "./profiles.js";
2
- //#region src/_shared/auth_selection.ts
1
+ import "./profiles-Ir29rqns.js";
2
+ //#region ../../internals/cli-core/dist/auth_selection.js
3
3
  /**
4
4
  * # Which credential an invocation authenticates with
5
5
  *
@@ -80,4 +80,4 @@ function nonEmpty(value) {
80
80
  return trimmed === "" ? void 0 : trimmed;
81
81
  }
82
82
  //#endregion
83
- export { credentialInputs, displacedProfileWarning, recordCredentialInputs, selectCredential };
83
+ export { selectCredential as i, displacedProfileWarning as n, recordCredentialInputs as r, credentialInputs as t };