neon 8.23.3 → 9.0.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 +9 -8
- package/dist/_chunks/{checkout-Bsfl-B0h.js → checkout-B_gbS0nD.js} +3 -3
- package/dist/_chunks/{claim-B3tMeMuo.js → claim-BVEwQ65H.js} +1 -1
- package/dist/_chunks/{config-DZ3cDaOS.js → config-BClSMzco.js} +1 -43
- package/dist/_chunks/{deploy-CF4PxuNX.js → deploy-CJ22hy3i.js} +1 -1
- package/dist/_chunks/{dev-BnHQENZM.js → dev-CSoQfCuS.js} +21 -22
- package/dist/_chunks/{env-CIFMBEon.js → env-CFBmcKyo.js} +18 -45
- package/dist/_chunks/{env-BOt9AZ1j.js → env-DxcO3oJk.js} +21 -24
- package/dist/_chunks/{env-JgoSsmyt.js → env-EJU-0InB.js} +49 -110
- package/dist/_chunks/{git-CRYW7ku0.js → git-C6XPViK5.js} +2 -2
- package/dist/_chunks/{link-VYCSKqU-.js → link-n40BxbmK.js} +2 -2
- package/dist/_chunks/{status-rt-0bUaQ.js → status-TDYLPWRO.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 +4 -4
- package/dist/commands/functions_new.js +1 -1
- package/dist/commands/git.js +1 -1
- package/dist/commands/index.js +9 -9
- package/dist/commands/link.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/subscribe.js +1 -1
- package/dist/dev/env.js +1 -1
- package/dist/env_services.js +30 -23
- package/dist/errors.js +2 -1
- package/dist/init/auth.js +1 -1
- package/dist/init/choices.js +8 -6
- package/dist/init/deploy.js +1 -1
- package/dist/init/link.js +1 -1
- package/dist/init/run.js +3 -3
- package/dist/utils/ai_gateway_notice.js +47 -114
- package/dist/utils/hooks.js +9 -4
- package/dist/utils/service_picker.js +1 -1
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as defaultConnectionRole, t as NEON_DEFAULT_OWNER_ROLE } from "./roles-Bd9r8_pX.js";
|
|
2
|
-
import { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialScopes,
|
|
2
|
+
import { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialScopes, resolveConfig } from "@neon/config/v1";
|
|
3
3
|
// ../../internals/env-core/dist/env.js
|
|
4
4
|
/**
|
|
5
5
|
* The Neon env core — resolving a branch's env from the Neon API, and projecting it into
|
|
@@ -28,13 +28,27 @@ import { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialSco
|
|
|
28
28
|
* user added a second database next to `neondb`) auto-picks without asking.
|
|
29
29
|
*/
|
|
30
30
|
const NEON_DEFAULT_DATABASE = "neondb";
|
|
31
|
+
/**
|
|
32
|
+
* Set only by `neon dev`: a JSON object mapping each function it serves to its localhost port,
|
|
33
|
+
* which `functionBaseUrl` prefers over the deployed hostname.
|
|
34
|
+
*/
|
|
35
|
+
const NEON_DEV_FUNCTION_PORTS = "NEON_DEV_FUNCTION_PORTS";
|
|
31
36
|
const NEON_ENV_VAR_KEYS = {
|
|
32
37
|
/**
|
|
33
38
|
* Branch identity. `NEON_BRANCH` carries the branch **name** and is injected into the
|
|
34
39
|
* Neon Functions runtime on every branch (including the default) by default. `env pull` /
|
|
35
40
|
* `neon dev` / `neon-env run` emit it too so local dev mirrors the deployed runtime.
|
|
36
41
|
*/
|
|
37
|
-
branch: {
|
|
42
|
+
branch: {
|
|
43
|
+
name: "NEON_BRANCH",
|
|
44
|
+
id: "NEON_BRANCH_ID",
|
|
45
|
+
/**
|
|
46
|
+
* Shared by every function on the branch, with a leading dot
|
|
47
|
+
* (`.compute.c-2.us-east-2.aws.neon.tech`). A function's host is
|
|
48
|
+
* `<NEON_BRANCH_ID>-<slug><NEON_FUNCTION_HOST_SUFFIX>`.
|
|
49
|
+
*/
|
|
50
|
+
functionHostSuffix: "NEON_FUNCTION_HOST_SUFFIX"
|
|
51
|
+
},
|
|
38
52
|
postgres: {
|
|
39
53
|
databaseUrl: "DATABASE_URL",
|
|
40
54
|
databaseUrlUnpooled: "DATABASE_URL_UNPOOLED"
|
|
@@ -71,19 +85,6 @@ const NEON_ENV_VAR_KEYS = {
|
|
|
71
85
|
baseUrl: "NEON_AI_GATEWAY_BASE_URL"
|
|
72
86
|
}
|
|
73
87
|
};
|
|
74
|
-
const FUNCTION_SLUG = /^[a-z0-9]{1,20}$/;
|
|
75
|
-
const FUNCTION_BASE_URL_KEY = /^NEON_FUNCTION_([A-Z0-9]{1,20})_BASE_URL$/;
|
|
76
|
-
function functionBaseUrlKey(slug) {
|
|
77
|
-
if (!FUNCTION_SLUG.test(slug)) throw new Error(`functionBaseUrlKey: ${JSON.stringify(slug)} is not a function slug ([a-z0-9]{1,20}).`);
|
|
78
|
-
return `NEON_FUNCTION_${slug.toUpperCase()}_BASE_URL`;
|
|
79
|
-
}
|
|
80
|
-
function parseFunctionBaseUrlKey(key) {
|
|
81
|
-
const match = FUNCTION_BASE_URL_KEY.exec(key);
|
|
82
|
-
return match ? match[1].toLowerCase() : null;
|
|
83
|
-
}
|
|
84
|
-
function isFunctionBaseUrlKey(key) {
|
|
85
|
-
return parseFunctionBaseUrlKey(key) !== null;
|
|
86
|
-
}
|
|
87
88
|
/**
|
|
88
89
|
* Starts a read now and keeps an unread rejection from crashing the process; the caller
|
|
89
90
|
* awaits it (and sees the error) when its turn comes. The read is called synchronously and
|
|
@@ -185,24 +186,13 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
185
186
|
const wantsDataApi = desired.dataApiEnabled && wants(K.dataApi.url);
|
|
186
187
|
const wantsRealtime = desired.realtimePolicy === "enabled" && (wants(K.realtime.url) || wants(K.realtime.secret));
|
|
187
188
|
const gatewayEnabled = desired.preview?.aiGatewayEnabled ?? false;
|
|
188
|
-
const
|
|
189
|
-
const declaredSlugs = (desired.preview?.functions ?? []).map((fn) => fn.slug);
|
|
190
|
-
const selectedFunctionKeys = selection === null ? [] : [...selection].filter(isFunctionBaseUrlKey);
|
|
191
|
-
const constructSlugs = functionUrlSlugsToConstruct({
|
|
192
|
-
functionUrlMode,
|
|
193
|
-
selection,
|
|
194
|
-
declaredSlugs,
|
|
195
|
-
selectedFunctionKeys,
|
|
196
|
-
wants
|
|
197
|
-
});
|
|
198
|
-
const wantsAnyFunctionUrl = selection === null || selectedFunctionKeys.length > 0;
|
|
189
|
+
const wantsFunctionHostSuffix = wants(K.branch.functionHostSuffix) && (selection !== null || options.functionHostSuffix === "always" || (desired.preview?.functions.length ?? 0) > 0);
|
|
199
190
|
const storageEnabled = (desired.preview?.buckets.length ?? 0) > 0;
|
|
200
191
|
const wantsStorage = storageEnabled && (wants(K.storage.accessKeyId) || wants(K.storage.secretAccessKey) || wants(K.storage.endpoint) || wants(K.storage.region));
|
|
201
|
-
const
|
|
202
|
-
functionsRead?.catch(() => void 0);
|
|
203
|
-
const storageRead = wantsStorage ? started(() => api.getProjectBranchStorage(projectId, branch.id)) : null;
|
|
204
|
-
const needsUnpooled = wantsUnpooled || gatewayEnabled && wants(K.aiGateway.baseUrl) || constructSlugs.length > 0;
|
|
192
|
+
const needsUnpooled = wantsUnpooled || gatewayEnabled && wants(K.aiGateway.baseUrl);
|
|
205
193
|
const needsConnectionTarget = wantsPooled || needsUnpooled;
|
|
194
|
+
const storageRead = wantsStorage ? started(() => api.getProjectBranchStorage(projectId, branch.id)) : null;
|
|
195
|
+
const endpointsRead = wantsFunctionHostSuffix && !needsConnectionTarget ? started(() => api.listEndpoints(projectId)) : null;
|
|
206
196
|
const needsDatabase = needsConnectionTarget || wantsDataApi;
|
|
207
197
|
const [roles, databases] = await Promise.all([needsConnectionTarget ? api.listBranchRoles(projectId, branch.id) : Promise.resolve([]), needsDatabase ? api.listBranchDatabases(projectId, branch.id) : Promise.resolve([])]);
|
|
208
198
|
const databaseName = needsDatabase ? pickDatabaseName(databases, branch, options.databaseName) : null;
|
|
@@ -228,7 +218,16 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
228
218
|
if (wantsPooled) postgres.databaseUrl = requiredValue(pooled, "pooled connection URI response").uri;
|
|
229
219
|
if (wantsUnpooled) postgres.databaseUrlUnpooled = requiredValue(unpooled, "direct connection URI response").uri;
|
|
230
220
|
if (Object.keys(postgres).length > 0) result.postgres = postgres;
|
|
231
|
-
if (wants(K.branch.name)
|
|
221
|
+
if (wants(K.branch.name) || wants(K.branch.id) || wantsFunctionHostSuffix) {
|
|
222
|
+
const branchEnv = {};
|
|
223
|
+
if (wants(K.branch.name)) branchEnv.name = branch.name;
|
|
224
|
+
if (wants(K.branch.id)) branchEnv.id = branch.id;
|
|
225
|
+
if (wantsFunctionHostSuffix) {
|
|
226
|
+
const connectionUri = unpooled?.uri ?? pooled?.uri;
|
|
227
|
+
branchEnv.functionHostSuffix = functionHostSuffix(connectionUri !== void 0 ? new URL(connectionUri).hostname : branchComputeHost(await requiredValue(endpointsRead, "branch endpoint list"), branch));
|
|
228
|
+
}
|
|
229
|
+
result.branch = branchEnv;
|
|
230
|
+
}
|
|
232
231
|
if (wantsAuth) {
|
|
233
232
|
if (!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: {
|
|
234
233
|
projectId,
|
|
@@ -301,66 +300,7 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
301
300
|
result.aiGateway = gateway;
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
|
-
|
|
305
|
-
let functionUrlsUnavailable = false;
|
|
306
|
-
if (functionUrlMode === "all-live" && wantsAnyFunctionUrl) {
|
|
307
|
-
const listed = options.listedFunctions === void 0 ? await requiredValue(functionsRead, "function listing") : listedFromSnapshots(options.listedFunctions);
|
|
308
|
-
if (listed.status === "unavailable") {
|
|
309
|
-
if (selection === null) functionUrlsUnavailable = true;
|
|
310
|
-
} else for (const fn of listed.functions) {
|
|
311
|
-
if (!wants(functionBaseUrlKey(fn.slug))) continue;
|
|
312
|
-
functions[fn.slug] = { baseUrl: asEnvBaseUrl(fn.invocationUrl) };
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
const missingConstructSlugs = constructSlugs.filter((slug) => functions[slug] === void 0);
|
|
316
|
-
if (missingConstructSlugs.length > 0) {
|
|
317
|
-
const uri = requiredValue(unpooled, "direct connection URI for function invocation URLs").uri;
|
|
318
|
-
for (const slug of missingConstructSlugs) functions[slug] = { baseUrl: functionInvocationUrl(branch.id, slug, uri) };
|
|
319
|
-
}
|
|
320
|
-
assertSelectedFunctionUrls(selectedFunctionKeys, functions);
|
|
321
|
-
if (Object.keys(functions).length > 0) result.functions = functions;
|
|
322
|
-
return {
|
|
323
|
-
env: result,
|
|
324
|
-
functionUrlsUnavailable
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
function functionUrlSlugsToConstruct(args) {
|
|
328
|
-
const slugs = [];
|
|
329
|
-
if (args.functionUrlMode === "policy" && args.selection === null) {
|
|
330
|
-
for (const slug of args.declaredSlugs) if (args.wants(functionBaseUrlKey(slug))) slugs.push(slug);
|
|
331
|
-
return slugs;
|
|
332
|
-
}
|
|
333
|
-
for (const key of args.selectedFunctionKeys) {
|
|
334
|
-
const slug = parseFunctionBaseUrlKey(key);
|
|
335
|
-
if (slug !== null) slugs.push(slug);
|
|
336
|
-
}
|
|
337
|
-
return slugs;
|
|
338
|
-
}
|
|
339
|
-
function listedFromSnapshots(snapshots) {
|
|
340
|
-
return {
|
|
341
|
-
status: "ok",
|
|
342
|
-
functions: snapshots.filter((fn) => fn.invocationUrl !== "").map((fn) => ({
|
|
343
|
-
slug: fn.slug,
|
|
344
|
-
invocationUrl: fn.invocationUrl
|
|
345
|
-
})).sort((left, right) => left.slug.localeCompare(right.slug))
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
function assertSelectedFunctionUrls(keys, functions) {
|
|
349
|
-
for (const key of keys) {
|
|
350
|
-
const slug = parseFunctionBaseUrlKey(key);
|
|
351
|
-
if (slug === null || functions[slug] === void 0) throw new Error(`fetchEnv: missing ${key}.`);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
async function listFunctionInvocationUrls(api, projectId, branchId) {
|
|
355
|
-
try {
|
|
356
|
-
return listedFromSnapshots(await api.listBranchFunctions(projectId, branchId));
|
|
357
|
-
} catch (error) {
|
|
358
|
-
if (isPlatformError(error) && error.code === ErrorCode.FeatureUnavailable) return {
|
|
359
|
-
status: "unavailable",
|
|
360
|
-
error
|
|
361
|
-
};
|
|
362
|
-
throw error;
|
|
363
|
-
}
|
|
303
|
+
return { env: result };
|
|
364
304
|
}
|
|
365
305
|
/**
|
|
366
306
|
* Resolve the target branch and evaluate the policy against it — the first thing any
|
|
@@ -425,6 +365,8 @@ function policyEnvKeys(desired) {
|
|
|
425
365
|
K.postgres.databaseUrl,
|
|
426
366
|
K.postgres.databaseUrlUnpooled,
|
|
427
367
|
K.branch.name,
|
|
368
|
+
K.branch.id,
|
|
369
|
+
...(desired.preview?.functions.length ?? 0) > 0 ? [K.branch.functionHostSuffix] : [],
|
|
428
370
|
...desired.authEnabled ? [K.auth.baseUrl, K.auth.jwksUrl] : [],
|
|
429
371
|
...desired.dataApiEnabled ? [K.dataApi.url] : [],
|
|
430
372
|
...desired.realtimePolicy === "enabled" ? [K.realtime.url, K.realtime.secret] : [],
|
|
@@ -539,24 +481,20 @@ function aiGatewayHost(branchId, connectionUri) {
|
|
|
539
481
|
return `${branchId}-api.ai.${connectionHostSuffix(connectionUri)}`;
|
|
540
482
|
}
|
|
541
483
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
484
|
+
* `NEON_FUNCTION_HOST_SUFFIX` from a compute host: the endpoint label is replaced by
|
|
485
|
+
* `compute`, as the Functions runtime does (`.compute.c-2.us-east-2.aws.neon.tech`).
|
|
544
486
|
*/
|
|
545
|
-
function
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
function functionInvocationUrl(branchId, slug, connectionUri) {
|
|
557
|
-
const suffix = connectionHostSuffix(connectionUri);
|
|
558
|
-
if (suffix === "") throw new Error(`fetchEnv: cannot derive the invocation URL for function "${slug}": the direct connection URI has no host suffix.`);
|
|
559
|
-
return `https://${branchId}-${slug}.compute.${suffix}`;
|
|
487
|
+
function functionHostSuffix(computeHost) {
|
|
488
|
+
const suffix = computeHost.split(".").slice(1).join(".");
|
|
489
|
+
if (suffix === "") throw new Error(`fetchEnv: cannot derive NEON_FUNCTION_HOST_SUFFIX from compute host ${JSON.stringify(computeHost)}.`);
|
|
490
|
+
return `.compute.${suffix}`;
|
|
491
|
+
}
|
|
492
|
+
/** The branch's read-write compute host, else its first compute host. */
|
|
493
|
+
function branchComputeHost(endpoints, branch) {
|
|
494
|
+
const own = endpoints.filter((endpoint) => endpoint.branchId === branch.id);
|
|
495
|
+
const endpoint = own.find((candidate) => candidate.type === "read_write") ?? own[0];
|
|
496
|
+
if (!endpoint?.host) throw new PlatformError(ErrorCode.NotFound, `fetchEnv: branch ${branch.name} (${branch.id}) has no compute endpoint, so NEON_FUNCTION_HOST_SUFFIX cannot be derived. Add a compute to the branch, then re-run.`, { details: { branchId: branch.id } });
|
|
497
|
+
return endpoint.host;
|
|
560
498
|
}
|
|
561
499
|
/** The AI Gateway's bare base URL (`NEON_AI_GATEWAY_BASE_URL`) on the branch gateway host. */
|
|
562
500
|
function aiGatewayBaseUrl(branchId, connectionUri) {
|
|
@@ -637,6 +575,8 @@ function toEntries(env) {
|
|
|
637
575
|
put(K.postgres.databaseUrl, env.postgres?.databaseUrl);
|
|
638
576
|
put(K.postgres.databaseUrlUnpooled, env.postgres?.databaseUrlUnpooled);
|
|
639
577
|
put(K.branch.name, env.branch?.name);
|
|
578
|
+
put(K.branch.id, env.branch?.id);
|
|
579
|
+
put(K.branch.functionHostSuffix, env.branch?.functionHostSuffix);
|
|
640
580
|
put(K.auth.baseUrl, env.auth?.baseUrl);
|
|
641
581
|
put(K.auth.jwksUrl, env.auth?.jwksUrl);
|
|
642
582
|
put(K.dataApi.url, env.dataApi?.url);
|
|
@@ -648,7 +588,6 @@ function toEntries(env) {
|
|
|
648
588
|
put(K.storage.region, env.storage?.region);
|
|
649
589
|
put(K.aiGateway.apiKey, env.aiGateway?.apiKey);
|
|
650
590
|
put(K.aiGateway.baseUrl, env.aiGateway?.baseUrl);
|
|
651
|
-
if (env.functions) for (const slug of Object.keys(env.functions).sort()) put(functionBaseUrlKey(slug), env.functions[slug]?.baseUrl);
|
|
652
591
|
return out;
|
|
653
592
|
}
|
|
654
|
-
export {
|
|
593
|
+
export { credentialName as a, fetchEnvKeys as c, policyEnvKeys as d, resolveBranchPolicy as f, credentialEnvKeys as i, fetchEnvKeysState as l, NEON_ENV_VAR_KEYS as n, defaultAiGatewayCredential as o, toEntries as p, createApiFromOptions as r, defaultStorageCredential as s, NEON_DEV_FUNCTION_PORTS as t, isLiveCredential as u };
|
|
@@ -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-n40BxbmK.js";
|
|
9
|
+
import { o as handler$1 } from "./checkout-B_gbS0nD.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-DxcO3oJk.js";
|
|
17
|
+
import { h as initCmd } from "./config-BClSMzco.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";
|
|
@@ -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-BClSMzco.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-B_gbS0nD.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-BVEwQ65H.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-BClSMzco.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-CJ22hy3i.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
|
|
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-CSoQfCuS.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-DxcO3oJk.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NEON_SERVICES, NEON_SERVICE_LABELS } from "../neon_services.js";
|
|
2
|
-
import {
|
|
3
|
-
import { BRANCH_ENV_KEY, ENV_PULL_KEYS, serviceForEnvKey } from "../env_services.js";
|
|
2
|
+
import { BRANCH_ENV_KEYS, ENV_PULL_KEYS, isLegacyFunctionBaseUrlKey, serviceForEnvKey } from "../env_services.js";
|
|
4
3
|
import { isAbsolute, relative } from "node:path";
|
|
5
4
|
import { homedir } from "node:os";
|
|
6
5
|
import chalk from "chalk";
|
|
@@ -24,8 +23,8 @@ const GROUP_ORDER = [
|
|
|
24
23
|
OTHER_GROUP
|
|
25
24
|
];
|
|
26
25
|
const groupOf = (key) => {
|
|
27
|
-
if (key
|
|
28
|
-
if (
|
|
26
|
+
if (BRANCH_ENV_KEYS.includes(key)) return BRANCH_GROUP;
|
|
27
|
+
if (isLegacyFunctionBaseUrlKey(key)) return NEON_SERVICE_LABELS.functions;
|
|
29
28
|
const pullKey = ENV_PULL_KEYS.find((candidate) => candidate === key);
|
|
30
29
|
const service = pullKey ? serviceForEnvKey(pullKey) : null;
|
|
31
30
|
return service ? NEON_SERVICE_LABELS[service] : OTHER_GROUP;
|
|
@@ -57,6 +56,7 @@ const formatPulledEnv = (outcome, cwd, branch) => {
|
|
|
57
56
|
lines.push(row(group, keys.map((key) => fresh.has(key) ? `${key}*` : key).join(", ")));
|
|
58
57
|
}
|
|
59
58
|
if (outcome.removed.length > 0) lines.push(row("Removed", `${outcome.removed.join(", ")} (not produced by this pull)`));
|
|
59
|
+
if (outcome.removed.some(isLegacyFunctionBaseUrlKey)) lines.push(row("", "Use functionBaseUrl(\"<slug>\") from @neon/env instead."));
|
|
60
60
|
if (fresh.size > 0) lines.push(" * new credential value");
|
|
61
61
|
const credential = outcome.credential;
|
|
62
62
|
if (credential?.issued && credential.revoked.length > 0) lines.push(`Revoked the credential it replaced (${credential.revoked.join(", ")}).`);
|
|
@@ -8,7 +8,7 @@ import { writer } from "../writer.js";
|
|
|
8
8
|
import { formatInitDone, printInitDone } from "../init/chrome.js";
|
|
9
9
|
import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
|
|
10
10
|
import { displayPath } from "./env_output.js";
|
|
11
|
-
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-
|
|
11
|
+
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-BClSMzco.js";
|
|
12
12
|
import { recommendedOperations } from "../functions/registry.js";
|
|
13
13
|
import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
|
|
14
14
|
import { describeRegistrySource, 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-C6XPViK5.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -2,29 +2,29 @@ import { r as auth_exports } from "../_chunks/auth-rup6nemJ.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-DxcO3oJk.js";
|
|
6
|
+
import { c as config_exports } from "../_chunks/config-BClSMzco.js";
|
|
7
7
|
import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
|
|
8
|
-
import { a as link_exports } from "../_chunks/link-
|
|
8
|
+
import { a as link_exports } from "../_chunks/link-n40BxbmK.js";
|
|
9
9
|
import { o as mcp_exports } from "../_chunks/mcp-SvqWzHnT.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-B_gbS0nD.js";
|
|
16
|
+
import { o as claim_exports } from "../_chunks/claim-BVEwQ65H.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-BMBNmW0t.js";
|
|
19
19
|
import { r as data_api_exports } from "../_chunks/data_api-CHDwvMTG.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-CJ22hy3i.js";
|
|
22
|
+
import { s as dev_exports } from "../_chunks/dev-CSoQfCuS.js";
|
|
23
23
|
import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
|
|
24
24
|
import { c as docs_exports } from "../_chunks/docs-BpLiSTmm.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-C6XPViK5.js";
|
|
28
28
|
import { a as init_exports } from "../_chunks/init-D2fClHtC.js";
|
|
29
29
|
import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
|
|
30
30
|
import { a as ip_allow_exports } from "../_chunks/ip_allow-DBdxNEUa.js";
|
|
@@ -40,7 +40,7 @@ import { o as profile_exports } from "../_chunks/profile-CArcjyS4.js";
|
|
|
40
40
|
import { s as realtime_exports } from "../_chunks/realtime-BwtzYf5a.js";
|
|
41
41
|
import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
|
|
42
42
|
import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
|
|
43
|
-
import { a as status_exports } from "../_chunks/status-
|
|
43
|
+
import { a as status_exports } from "../_chunks/status-TDYLPWRO.js";
|
|
44
44
|
import { d as triggers_exports } from "../_chunks/triggers-BfvyeJUC.js";
|
|
45
45
|
import { s as user_exports } from "../_chunks/user-D9mC430O.js";
|
|
46
46
|
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-n40BxbmK.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-TDYLPWRO.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writer } from "../writer.js";
|
|
2
|
-
import { o as resolveNeonEnvVars } from "../_chunks/env-CIFMBEon.js";
|
|
3
2
|
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
3
|
+
import { o as resolveNeonEnvVars } from "../_chunks/env-CFBmcKyo.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-CFBmcKyo.js";
|
package/dist/env_services.js
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { NEON_SERVICES } from "./neon_services.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n as NEON_ENV_VAR_KEYS } from "./_chunks/env-EJU-0InB.js";
|
|
3
3
|
// src/env_services.ts
|
|
4
4
|
const ENV_PULL_SERVICES = NEON_SERVICES;
|
|
5
5
|
const ENV_PULL_KEYS = [
|
|
6
6
|
...Object.values(NEON_ENV_VAR_KEYS.postgres),
|
|
7
7
|
NEON_ENV_VAR_KEYS.branch.name,
|
|
8
|
+
NEON_ENV_VAR_KEYS.branch.id,
|
|
9
|
+
NEON_ENV_VAR_KEYS.branch.functionHostSuffix,
|
|
8
10
|
...Object.values(NEON_ENV_VAR_KEYS.auth),
|
|
9
11
|
...Object.values(NEON_ENV_VAR_KEYS.dataApi),
|
|
10
12
|
...Object.values(NEON_ENV_VAR_KEYS.realtime),
|
|
11
13
|
...Object.values(NEON_ENV_VAR_KEYS.storage),
|
|
12
14
|
...Object.values(NEON_ENV_VAR_KEYS.aiGateway)
|
|
13
15
|
];
|
|
14
|
-
const ENV_PULL_KEY_HELP =
|
|
16
|
+
const ENV_PULL_KEY_HELP = ENV_PULL_KEYS.join(", ");
|
|
17
|
+
/**
|
|
18
|
+
* The per-function URL vars earlier releases wrote (`NEON_FUNCTION_<SLUG>_BASE_URL`), replaced
|
|
19
|
+
* by `NEON_BRANCH_ID` + `NEON_FUNCTION_HOST_SUFFIX`. Recognized only to prune them from a
|
|
20
|
+
* pulled file and to point `--env` callers at `functionBaseUrl`.
|
|
21
|
+
*/
|
|
22
|
+
const isLegacyFunctionBaseUrlKey = (key) => /^NEON_FUNCTION_[A-Z0-9]{1,20}_BASE_URL$/.test(key);
|
|
15
23
|
/** The OS-level env vars each service contributes to a pulled `.env`. */
|
|
16
24
|
const SERVICE_ENV_KEYS = {
|
|
17
25
|
postgres: Object.values(NEON_ENV_VAR_KEYS.postgres),
|
|
@@ -20,29 +28,29 @@ const SERVICE_ENV_KEYS = {
|
|
|
20
28
|
realtime: Object.values(NEON_ENV_VAR_KEYS.realtime),
|
|
21
29
|
"object-storage": Object.values(NEON_ENV_VAR_KEYS.storage),
|
|
22
30
|
"ai-gateway": Object.values(NEON_ENV_VAR_KEYS.aiGateway),
|
|
23
|
-
functions: []
|
|
31
|
+
functions: [NEON_ENV_VAR_KEYS.branch.functionHostSuffix]
|
|
24
32
|
};
|
|
25
33
|
/**
|
|
26
34
|
* The subset of {@link SERVICE_ENV_KEYS} a pull *owns*, and so may prune from the target file
|
|
27
35
|
* when the branch no longer has it. Object storage is deliberately absent: it is emitted under
|
|
28
36
|
* the third-party `AWS_*` names, which collide with credentials a user may set by hand, so
|
|
29
|
-
* `env pull` only ever writes them.
|
|
30
|
-
* discovered at runtime.
|
|
37
|
+
* `env pull` only ever writes them.
|
|
31
38
|
*/
|
|
32
39
|
const SERVICE_OWNED_ENV_KEYS = {
|
|
33
40
|
...SERVICE_ENV_KEYS,
|
|
34
|
-
"object-storage": []
|
|
35
|
-
functions: []
|
|
41
|
+
"object-storage": []
|
|
36
42
|
};
|
|
37
43
|
/**
|
|
38
|
-
* Branch identity. Not a service — every branch has a name — so a scoped pull
|
|
39
|
-
* alongside whatever services were selected.
|
|
44
|
+
* Branch identity. Not a service — every branch has a name and an id — so a scoped pull
|
|
45
|
+
* refreshes it alongside whatever services were selected.
|
|
40
46
|
*/
|
|
41
|
-
const
|
|
47
|
+
const BRANCH_ENV_KEYS = [NEON_ENV_VAR_KEYS.branch.name, NEON_ENV_VAR_KEYS.branch.id];
|
|
42
48
|
const ENV_KEY_SERVICE = {
|
|
43
49
|
DATABASE_URL: "postgres",
|
|
44
50
|
DATABASE_URL_UNPOOLED: "postgres",
|
|
45
51
|
NEON_BRANCH: null,
|
|
52
|
+
NEON_BRANCH_ID: null,
|
|
53
|
+
NEON_FUNCTION_HOST_SUFFIX: "functions",
|
|
46
54
|
NEON_AUTH_BASE_URL: "auth",
|
|
47
55
|
NEON_AUTH_JWKS_URL: "auth",
|
|
48
56
|
NEON_DATA_API_URL: "data-api",
|
|
@@ -55,12 +63,12 @@ const ENV_KEY_SERVICE = {
|
|
|
55
63
|
NEON_AI_GATEWAY_TOKEN: "ai-gateway",
|
|
56
64
|
NEON_AI_GATEWAY_BASE_URL: "ai-gateway"
|
|
57
65
|
};
|
|
58
|
-
const serviceForEnvKey = (key) =>
|
|
66
|
+
const serviceForEnvKey = (key) => ENV_KEY_SERVICE[key];
|
|
59
67
|
/** Services that must be resolved to produce the selected env keys. */
|
|
60
68
|
const servicesForEnvKeys = (keys) => ENV_PULL_SERVICES.filter((service) => keys.some((key) => serviceForEnvKey(key) === service));
|
|
61
69
|
/** Every env var the selected services contribute, plus branch identity. */
|
|
62
70
|
const envServiceKeys = (services) => {
|
|
63
|
-
const keys =
|
|
71
|
+
const keys = new Set(BRANCH_ENV_KEYS);
|
|
64
72
|
for (const service of services) for (const key of SERVICE_ENV_KEYS[service]) keys.add(key);
|
|
65
73
|
return keys;
|
|
66
74
|
};
|
|
@@ -68,34 +76,34 @@ const envServiceKeys = (services) => {
|
|
|
68
76
|
* The env vars a pull scoped to `services` may prune. Narrower than the unscoped set on
|
|
69
77
|
* purpose: `env pull -s ai-gateway` says nothing about `DATABASE_URL`, so it must leave it
|
|
70
78
|
* alone rather than treat its absence from this pull as "the branch no longer has it".
|
|
71
|
-
* Function URL keys cannot live here because slugs are discovered at runtime.
|
|
72
79
|
*/
|
|
73
80
|
const ownedEnvServiceKeys = (services) => services.flatMap((service) => SERVICE_OWNED_ENV_KEYS[service]);
|
|
74
81
|
const envKeysForSelection = (services, envKeys) => {
|
|
75
82
|
const selected = services.length > 0 ? envServiceKeys(services) : /* @__PURE__ */ new Set();
|
|
76
83
|
for (const key of envKeys) selected.add(key);
|
|
77
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.");
|
|
78
|
-
|
|
79
|
-
const functionKeys = [...selected].filter(isFunctionBaseUrlKey).sort((left, right) => left.localeCompare(right));
|
|
80
|
-
return [...staticKeys, ...functionKeys];
|
|
85
|
+
return ENV_PULL_KEYS.filter((key) => selected.has(key));
|
|
81
86
|
};
|
|
82
87
|
/** Parse repeated or comma-separated `--env` values into canonical env-key order. */
|
|
83
88
|
const parseEnvPullKeys = (raw, flag) => {
|
|
84
89
|
const names = raw.flatMap((value) => value.split(",")).map((name) => name.trim()).filter((name) => name !== "");
|
|
85
90
|
const supported = `Supported values: ${ENV_PULL_KEY_HELP}.`;
|
|
86
91
|
if (names.length === 0) throw new Error(`${flag} needs at least one env variable. ${supported}`);
|
|
87
|
-
const
|
|
92
|
+
const legacy = names.filter(isLegacyFunctionBaseUrlKey);
|
|
93
|
+
if (legacy.length > 0) {
|
|
94
|
+
const slug = (legacy[0] ?? "").slice(14, -9).toLowerCase();
|
|
95
|
+
throw new Error(`${legacy.join(", ")} ${legacy.length === 1 ? "is" : "are"} no longer pulled. Pull NEON_BRANCH_ID and NEON_FUNCTION_HOST_SUFFIX with \`--service functions\`, then build the URL with \`functionBaseUrl("${slug}")\` from @neon/env.`);
|
|
96
|
+
}
|
|
97
|
+
const unknown = names.filter((name) => !ENV_PULL_KEYS.some((key) => key === name));
|
|
88
98
|
if (unknown.length > 0) {
|
|
89
99
|
const displayNames = unknown.map(redactUnknownEnvValue);
|
|
90
100
|
const suggestions = [...new Set(unknown.map(suggestEnvPullKey).filter((key) => key !== null))];
|
|
91
101
|
const suggestion = suggestions.length > 0 ? ` Did you mean ${suggestions.join(" or ")}?` : "";
|
|
92
102
|
throw new Error(`Unknown env variable${unknown.length === 1 ? "" : "s"} ${displayNames.join(", ")}.${suggestion} ${supported}`);
|
|
93
103
|
}
|
|
94
|
-
|
|
95
|
-
const functionKeys = [...new Set(names.filter(isFunctionBaseUrlKey))].sort((left, right) => left.localeCompare(right));
|
|
96
|
-
return [...staticKeys, ...functionKeys];
|
|
104
|
+
return ENV_PULL_KEYS.filter((key) => names.includes(key));
|
|
97
105
|
};
|
|
98
|
-
const isKnownEnvPullKey = (key) => ENV_PULL_KEYS.some((supportedKey) => supportedKey === key)
|
|
106
|
+
const isKnownEnvPullKey = (key) => ENV_PULL_KEYS.some((supportedKey) => supportedKey === key);
|
|
99
107
|
const redactUnknownEnvValue = (value) => {
|
|
100
108
|
const separator = value.indexOf("=");
|
|
101
109
|
if (separator !== -1) {
|
|
@@ -106,7 +114,6 @@ const redactUnknownEnvValue = (value) => {
|
|
|
106
114
|
};
|
|
107
115
|
const suggestEnvPullKey = (value) => {
|
|
108
116
|
if (value.includes("=")) return null;
|
|
109
|
-
if (parseFunctionBaseUrlKey(value) !== null) return null;
|
|
110
117
|
const closest = ENV_PULL_KEYS.map((key) => [key, editDistance(value, key)]).sort((a, b) => a[1] - b[1])[0];
|
|
111
118
|
return closest && closest[1] <= 2 ? closest[0] : null;
|
|
112
119
|
};
|
|
@@ -121,4 +128,4 @@ const editDistance = (left, right) => {
|
|
|
121
128
|
};
|
|
122
129
|
/** Narrow yargs' array option value without accepting any other runtime shape. */
|
|
123
130
|
const envPullFlagValue = (value) => Array.isArray(value) ? value.map(String) : void 0;
|
|
124
|
-
export {
|
|
131
|
+
export { BRANCH_ENV_KEYS, ENV_PULL_KEYS, ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, envServiceKeys, isLegacyFunctionBaseUrlKey, ownedEnvServiceKeys, parseEnvPullKeys, serviceForEnvKey, servicesForEnvKeys };
|
package/dist/errors.js
CHANGED
|
@@ -19,7 +19,8 @@ const ERROR_MATCHERS = [
|
|
|
19
19
|
[/^(Failed to install Neon agent skills|skills CLI failed)/, "SKILLS_CLI_FAILED"],
|
|
20
20
|
[/^Cannot install the Neon plugin for /, "AGENT_COMMAND_UNAVAILABLE"],
|
|
21
21
|
[/^(Failed to install the Neon plugin for: |plugins CLI (failed|timed out))/, "PLUGINS_CLI_FAILED"],
|
|
22
|
-
[/^Could not install the Neon dependencies/, "DEPENDENCY_INSTALL_FAILED"]
|
|
22
|
+
[/^Could not install the Neon dependencies/, "DEPENDENCY_INSTALL_FAILED"],
|
|
23
|
+
[/ (is|are) no longer pulled\. Pull NEON_BRANCH_ID /, "LEGACY_FUNCTION_ENV_KEY"]
|
|
23
24
|
];
|
|
24
25
|
const matchErrorCode = (message) => {
|
|
25
26
|
if (!message) return "UNKNOWN_ERROR";
|
package/dist/init/auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import "../config.js";
|
|
|
4
4
|
import "../auth.js";
|
|
5
5
|
import { c as ensureAuth, l as existingApiClient } from "../_chunks/auth-rup6nemJ.js";
|
|
6
6
|
import { recoverFrom401 } from "../auth_recovery.js";
|
|
7
|
-
import { c as pull } from "../_chunks/env-
|
|
7
|
+
import { c as pull } from "../_chunks/env-DxcO3oJk.js";
|
|
8
8
|
import { c as setupNeonMcp } from "../_chunks/mcp-SvqWzHnT.js";
|
|
9
9
|
// src/init/auth.ts
|
|
10
10
|
const isUnauthorized = (error) => isNeonApiError(error) && error.status === 401;
|
package/dist/init/choices.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { FUNCTION_SLUG } from "../config_template.js";
|
|
2
|
-
import { l as functionBaseUrlKey } from "../_chunks/env-JgoSsmyt.js";
|
|
3
1
|
// src/init/choices.ts
|
|
4
2
|
const INIT_CONFIG_SERVICES_CONFLICT = "--no-config cannot be combined with --services.";
|
|
5
3
|
const resolveInitConfigChoice = (input) => {
|
|
@@ -25,8 +23,8 @@ const configPlanFromResolution = (resolution, accepted) => {
|
|
|
25
23
|
};
|
|
26
24
|
/**
|
|
27
25
|
* A neon.ts policy pull fails while the branch lacks a declared service. These two need
|
|
28
|
-
* no `deploy`: the AI Gateway exists on every branch, and function
|
|
29
|
-
* branch host.
|
|
26
|
+
* no `deploy`: the AI Gateway exists on every branch, and the function host suffix derives
|
|
27
|
+
* from the branch's compute host.
|
|
30
28
|
*/
|
|
31
29
|
const DEPLOY_FREE_SERVICES = /* @__PURE__ */ new Set(["ai-gateway", "functions"]);
|
|
32
30
|
const needsDeploy = (declared) => declared.some((service) => !DEPLOY_FREE_SERVICES.has(service));
|
|
@@ -37,8 +35,12 @@ const initEnvPullAfterConfig = (input) => {
|
|
|
37
35
|
if (!needsDeploy(input.declared)) return { kind: "policy" };
|
|
38
36
|
return {
|
|
39
37
|
kind: "services",
|
|
40
|
-
services:
|
|
41
|
-
|
|
38
|
+
services: [
|
|
39
|
+
"postgres",
|
|
40
|
+
...input.declared.includes("ai-gateway") ? ["ai-gateway"] : [],
|
|
41
|
+
...input.declared.includes("functions") ? ["functions"] : []
|
|
42
|
+
],
|
|
43
|
+
envKeys: []
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
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-rup6nemJ.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-BClSMzco.js";
|
|
8
8
|
import { authContext } from "./auth.js";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
10
|
// src/init/deploy.ts
|
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-rup6nemJ.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-n40BxbmK.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.");
|