neon 4.18.1 → 4.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/config_template.js +17 -13
- package/dist/utils/service_picker.js +5 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -610,6 +610,8 @@ export default defineConfig({
|
|
|
610
610
|
? Which Neon services should neon.ts declare? (space to toggle, enter to confirm) ›
|
|
611
611
|
◯ Managed Better Auth
|
|
612
612
|
Authentication with users and sessions stored in Postgres.
|
|
613
|
+
◯ Data API
|
|
614
|
+
PostgREST-compatible HTTP API. Also declares Auth; the default provider needs it.
|
|
613
615
|
◯ Functions
|
|
614
616
|
Long-running, without timeouts, and closer to your database.
|
|
615
617
|
◯ Object Storage
|
|
@@ -627,6 +629,9 @@ neon config init
|
|
|
627
629
|
# Declare services with no prompt
|
|
628
630
|
neon config init --services auth,functions,object-storage,ai-gateway
|
|
629
631
|
|
|
632
|
+
# Data API also writes auth: true (the default provider requires it)
|
|
633
|
+
neon config init --services data-api
|
|
634
|
+
|
|
630
635
|
# Repeat the flag instead, and shorten it — every services flag takes all three spellings
|
|
631
636
|
neon config init -s auth -s functions
|
|
632
637
|
|
package/dist/config_template.js
CHANGED
|
@@ -15,24 +15,21 @@ const REQUIRED_PACKAGES = [CONFIG_PACKAGE, ENV_PACKAGE];
|
|
|
15
15
|
/**
|
|
16
16
|
* The services `config init` can declare in the `neon.ts` it scaffolds — the subset of
|
|
17
17
|
* {@link NEON_SERVICES} a policy has a field for. {@link renderNeonConfig} owns the mapping
|
|
18
|
-
* from these names to the `neon.ts` fields (`aiGateway`, `buckets`).
|
|
18
|
+
* from these names to the `neon.ts` fields (`aiGateway`, `buckets`, `dataApi`).
|
|
19
19
|
*
|
|
20
|
-
* Postgres is absent because every branch has it, so there is nothing to declare.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Postgres is absent because every branch has it, so there is nothing to declare. Selecting
|
|
21
|
+
* `data-api` also writes `auth: true`: the default Data API provider requires Neon Auth, and
|
|
22
|
+
* `defineConfig` type-errors the file without it.
|
|
23
23
|
*/
|
|
24
|
-
const CONFIG_INIT_SERVICES = NEON_SERVICES.filter((service) => service !== "postgres"
|
|
24
|
+
const CONFIG_INIT_SERVICES = NEON_SERVICES.filter((service) => service !== "postgres");
|
|
25
25
|
/**
|
|
26
26
|
* What `config init --services none` produces. One constant because it is both the help text
|
|
27
27
|
* and what tells the parser `none` is a value here — passing the literal at each call site
|
|
28
28
|
* lets the two drift into documenting something the parser does not accept.
|
|
29
29
|
*/
|
|
30
30
|
const CONFIG_INIT_NONE_MEANS = "the bare starter policy";
|
|
31
|
-
/** Why
|
|
32
|
-
const CONFIG_INIT_UNAVAILABLE = {
|
|
33
|
-
postgres: "every branch has Postgres, so a policy has nothing to declare for it",
|
|
34
|
-
"data-api": "enabling it with the default provider requires auth, so declare auth here and turn the Data API on with `neon data-api create`"
|
|
35
|
-
};
|
|
31
|
+
/** Why a policy cannot declare a real Neon service, for the refusal message. */
|
|
32
|
+
const CONFIG_INIT_UNAVAILABLE = { postgres: "every branch has Postgres, so a policy has nothing to declare for it" };
|
|
36
33
|
/** Slug, display name, and source path of the function scaffolded for `functions`. */
|
|
37
34
|
const FUNCTION_SLUG = "hello";
|
|
38
35
|
const FUNCTION_NAME = "Hello World";
|
|
@@ -70,13 +67,19 @@ const renderPreview = (services) => {
|
|
|
70
67
|
* policy — an explicit `auth: false`, no `preview` block, and a `branch` closure that gives
|
|
71
68
|
* new non-default branches a 7-day TTL — so the picker's "skip everything" answer and a
|
|
72
69
|
* non-interactive run produce the identical file.
|
|
70
|
+
*
|
|
71
|
+
* `data-api` writes `dataApi: true` and forces `auth: true`. The default provider is Neon
|
|
72
|
+
* Auth; omitting auth is a `defineConfig` type error rather than a deploy-time surprise.
|
|
73
73
|
*/
|
|
74
|
-
const renderNeonConfig = (services) =>
|
|
74
|
+
const renderNeonConfig = (services) => {
|
|
75
|
+
const auth = services.includes("auth") || services.includes("data-api");
|
|
76
|
+
const dataApi = services.includes("data-api") ? " dataApi: true,\n" : "";
|
|
77
|
+
return `import { defineConfig } from "${CONFIG_PACKAGE}/v1";
|
|
75
78
|
|
|
76
79
|
export default defineConfig({
|
|
77
80
|
// Declare your Neon services here
|
|
78
|
-
auth: ${
|
|
79
|
-
${renderPreview(services)} // Branch policy: per-branch tuning
|
|
81
|
+
auth: ${auth},
|
|
82
|
+
${dataApi}${renderPreview(services)} // Branch policy: per-branch tuning
|
|
80
83
|
branch: (branch) => {
|
|
81
84
|
if (branch.isDefault) {
|
|
82
85
|
// Default branch: no overrides, uses project defaults
|
|
@@ -92,6 +95,7 @@ ${renderPreview(services)} // Branch policy: per-branch tuning
|
|
|
92
95
|
},
|
|
93
96
|
});
|
|
94
97
|
`;
|
|
98
|
+
};
|
|
95
99
|
/** Render a scalar the way it has to appear in TypeScript source. */
|
|
96
100
|
const renderScalar = (value) => typeof value === "string" ? `"${value}"` : String(value);
|
|
97
101
|
/**
|
|
@@ -12,6 +12,11 @@ const CHOICES = [
|
|
|
12
12
|
title: "Managed Better Auth",
|
|
13
13
|
description: "Authentication with users and sessions stored in Postgres."
|
|
14
14
|
},
|
|
15
|
+
{
|
|
16
|
+
value: "data-api",
|
|
17
|
+
title: "Data API",
|
|
18
|
+
description: "PostgREST-compatible HTTP API. Also declares Auth; the default provider needs it."
|
|
19
|
+
},
|
|
15
20
|
{
|
|
16
21
|
value: "functions",
|
|
17
22
|
title: "Functions",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.19.0",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"typescript": "^5.9.0",
|
|
99
99
|
"vitest": "^3.0.9",
|
|
100
100
|
"@neon-internals/cli-core": "0.0.0",
|
|
101
|
-
"@neon/e2e-harness": "0.0.0",
|
|
102
101
|
"@neon-internals/env-core": "0.0.17",
|
|
103
|
-
"@neon/
|
|
102
|
+
"@neon/e2e-harness": "0.0.0",
|
|
103
|
+
"@neon/functions": "0.11.0"
|
|
104
104
|
},
|
|
105
105
|
"publishConfig": {
|
|
106
106
|
"access": "public",
|