neon 8.6.0 → 8.7.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/dist/api.js +14 -0
- package/dist/commands/dev.js +3 -3
- package/dist/commands/env.js +1 -1
- package/dist/commands/realtime.js +31 -3
- package/dist/commands/subscribe.js +1 -1
- package/dist/init/copy.js +5 -4
- package/dist/init/run.js +7 -3
- package/package.json +3 -3
package/dist/api.js
CHANGED
|
@@ -669,6 +669,13 @@ const getApiClient = ({ apiKey, apiHost, requestTimeoutMs = REQUEST_TIMEOUT_MS }
|
|
|
669
669
|
database_name: databaseName
|
|
670
670
|
}
|
|
671
671
|
})),
|
|
672
|
+
getProjectBranchRealtime: (projectId, branchId) => call(() => raw.getProjectBranchRealtime({
|
|
673
|
+
client,
|
|
674
|
+
path: {
|
|
675
|
+
project_id: projectId,
|
|
676
|
+
branch_id: branchId
|
|
677
|
+
}
|
|
678
|
+
})),
|
|
672
679
|
enableProjectBranchRealtime: (projectId, branchId, data) => call(() => raw.enableProjectBranchRealtime({
|
|
673
680
|
client,
|
|
674
681
|
path: {
|
|
@@ -684,6 +691,13 @@ const getApiClient = ({ apiKey, apiHost, requestTimeoutMs = REQUEST_TIMEOUT_MS }
|
|
|
684
691
|
branch_id: branchId
|
|
685
692
|
}
|
|
686
693
|
})),
|
|
694
|
+
rotateProjectBranchRealtimeSecret: (projectId, branchId) => call(() => raw.rotateProjectBranchRealtimeSecret({
|
|
695
|
+
client,
|
|
696
|
+
path: {
|
|
697
|
+
project_id: projectId,
|
|
698
|
+
branch_id: branchId
|
|
699
|
+
}
|
|
700
|
+
})),
|
|
687
701
|
listProjectVpcEndpoints: (projectId) => call(() => raw.listProjectVpcEndpoints({
|
|
688
702
|
client,
|
|
689
703
|
path: { project_id: projectId }
|
package/dist/commands/dev.js
CHANGED
|
@@ -4,12 +4,12 @@ import { isClaimableEnvTarget } from "../claimable/state.js";
|
|
|
4
4
|
import { getCliName } from "../utils/cli_name.js";
|
|
5
5
|
import { defaultDevEnvFiles, readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
6
6
|
import { l as functionBaseUrlKey } from "../_chunks/env-BpP3Dqpe.js";
|
|
7
|
-
import { a as resolveDevEnv } from "../_chunks/env-BNm69Qh8.js";
|
|
8
|
-
import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
9
|
-
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
10
7
|
import { branchIdResolve } from "../utils/enrichers.js";
|
|
11
8
|
import { bundleEntry } from "../utils/esbuild.js";
|
|
9
|
+
import { a as resolveDevEnv } from "../_chunks/env-BNm69Qh8.js";
|
|
12
10
|
import { envFlag } from "./config.js";
|
|
11
|
+
import { findConfigFunctionBySource, resolveFunctionsFromConfig } from "../dev/functions.js";
|
|
12
|
+
import { resolveWatchInputs } from "../dev/inputs.js";
|
|
13
13
|
import { existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
14
14
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
package/dist/commands/env.js
CHANGED
|
@@ -7,9 +7,9 @@ import { deprecatedServiceMessage, parseServices, servicesFlagValue, servicesOpt
|
|
|
7
7
|
import { mergeEnvFile, readEnvFile, resolveEnvFilePath } from "../env_file.js";
|
|
8
8
|
import { t as NEON_ENV_VAR_KEYS, u as isFunctionBaseUrlKey } from "../_chunks/env-BpP3Dqpe.js";
|
|
9
9
|
import { ENV_PULL_KEY_HELP, ENV_PULL_SERVICES, envKeysForSelection, envPullFlagValue, ownedEnvServiceKeys, parseEnvPullKeys } from "../env_services.js";
|
|
10
|
-
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "../_chunks/env-BNm69Qh8.js";
|
|
11
10
|
import { fillSingleProject, resolveBranchRef } from "../utils/enrichers.js";
|
|
12
11
|
import { warnAiGateway } from "../utils/ai_gateway_notice.js";
|
|
12
|
+
import { i as dropClaimableUnsupported, o as resolveNeonEnvVars } from "../_chunks/env-BNm69Qh8.js";
|
|
13
13
|
import { formatPulledEnv, pulledBranch } from "./env_output.js";
|
|
14
14
|
import { existsSync } from "node:fs";
|
|
15
15
|
import chalk from "chalk";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "../_chunks/rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { log } from "../log.js";
|
|
3
3
|
import { retryOnLock } from "../api.js";
|
|
4
|
+
import { getCliName } from "../utils/cli_name.js";
|
|
4
5
|
import { branchIdFromProps, fillSingleProject } from "../utils/enrichers.js";
|
|
5
6
|
import { builder as builder$1, handler as handler$1 } from "./subscribe.js";
|
|
6
7
|
import { defineConfig } from "@neon/config";
|
|
@@ -11,8 +12,11 @@ var realtime_exports = /* @__PURE__ */ __exportAll({
|
|
|
11
12
|
describe: () => describe,
|
|
12
13
|
disable: () => disable,
|
|
13
14
|
enable: () => enable,
|
|
14
|
-
handler: () => handler
|
|
15
|
+
handler: () => handler,
|
|
16
|
+
rotateSecret: () => rotateSecret
|
|
15
17
|
});
|
|
18
|
+
const ROTATION_POLL_INTERVAL_MS = Number(process.env.NEON_REALTIME_POLL_INTERVAL_MS) || 1e3;
|
|
19
|
+
const ROTATION_POLL_TIMEOUT_MS = Number(process.env.NEON_REALTIME_POLL_TIMEOUT_MS) || 6e4;
|
|
16
20
|
/** Request Realtime provisioning or an allowed-origin update for a branch. */
|
|
17
21
|
const enable = async (props) => {
|
|
18
22
|
const realtime = props.allowedOrigins === void 0 ? true : { allowedOrigins: props.allowedOrigins };
|
|
@@ -27,6 +31,26 @@ const disable = async (props) => {
|
|
|
27
31
|
await retryOnLock(() => props.apiClient.disableProjectBranchRealtime(props.projectId, branchId));
|
|
28
32
|
log.info("Realtime disable requested for branch %s.", branchId);
|
|
29
33
|
};
|
|
34
|
+
/** Request replacement of a branch's Realtime shared secret. */
|
|
35
|
+
const rotateSecret = async (props) => {
|
|
36
|
+
const branchId = await branchIdFromProps(props);
|
|
37
|
+
await retryOnLock(() => props.apiClient.rotateProjectBranchRealtimeSecret(props.projectId, branchId));
|
|
38
|
+
log.info("Realtime secret rotation requested for branch %s.", branchId);
|
|
39
|
+
if (!props.wait) return;
|
|
40
|
+
const deadline = Date.now() + ROTATION_POLL_TIMEOUT_MS;
|
|
41
|
+
do {
|
|
42
|
+
const { data } = await props.apiClient.getProjectBranchRealtime(props.projectId, branchId);
|
|
43
|
+
if (!data.pending) {
|
|
44
|
+
log.info("Realtime secret rotation completed for branch %s.", branchId);
|
|
45
|
+
log.info("Run %s env pull --service realtime to update NEON_REALTIME_SECRET.", getCliName());
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const remainingMs = deadline - Date.now();
|
|
49
|
+
if (remainingMs <= 0) break;
|
|
50
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(ROTATION_POLL_INTERVAL_MS, remainingMs)));
|
|
51
|
+
} while (Date.now() < deadline);
|
|
52
|
+
throw new Error(`Timed out waiting for Realtime secret rotation on branch ${branchId}. It may still be in progress.`);
|
|
53
|
+
};
|
|
30
54
|
const command = "realtime";
|
|
31
55
|
const describe = "Manage Neon Realtime for a branch";
|
|
32
56
|
const builder = (argv) => argv.usage("$0 realtime <sub-command> [options]").options({
|
|
@@ -45,7 +69,11 @@ const builder = (argv) => argv.usage("$0 realtime <sub-command> [options]").opti
|
|
|
45
69
|
}), (args) => enable({
|
|
46
70
|
...args,
|
|
47
71
|
...args.allowedOrigin !== void 0 ? { allowedOrigins: args.allowedOrigin } : {}
|
|
48
|
-
})).command("disable", "Disable Realtime on a branch", (yargs) => yargs.strict(), (args) => disable(args)).command("
|
|
72
|
+
})).command("disable", "Disable Realtime on a branch", (yargs) => yargs.strict(), (args) => disable(args)).command("rotate-secret", "Replace a branch's Realtime shared secret", (yargs) => yargs.strict().option("wait", {
|
|
73
|
+
describe: "Wait for the Realtime secret rotation to finish",
|
|
74
|
+
type: "boolean",
|
|
75
|
+
default: true
|
|
76
|
+
}), (args) => rotateSecret(args)).command("subscribe <query>", "Subscribe to a live SQL query with Neon Realtime", builder$1, handler$1);
|
|
49
77
|
const handler = (_args) => {};
|
|
50
78
|
//#endregion
|
|
51
|
-
export { builder, command, describe, disable, enable, handler, realtime_exports as t };
|
|
79
|
+
export { builder, command, describe, disable, enable, handler, rotateSecret, realtime_exports as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writer } from "../writer.js";
|
|
2
|
-
import { o as resolveNeonEnvVars } from "../_chunks/env-BNm69Qh8.js";
|
|
3
2
|
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
3
|
+
import { o as resolveNeonEnvVars } from "../_chunks/env-BNm69Qh8.js";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
//#region src/commands/subscribe.ts
|
|
6
6
|
const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
|
package/dist/init/copy.js
CHANGED
|
@@ -99,11 +99,11 @@ const offlinePinNext = (input) => [
|
|
|
99
99
|
...input.envPull !== void 0 ? ["Then pull the branch's environment variables:", input.envPull] : []
|
|
100
100
|
];
|
|
101
101
|
const skippedLinkNext = () => ["To connect this directory to a Neon project:", `${getCliName()} link`];
|
|
102
|
-
const
|
|
102
|
+
const newConfigNext = (input) => [
|
|
103
103
|
"Preview the changes:",
|
|
104
104
|
`${getCliName()} config plan`,
|
|
105
105
|
"",
|
|
106
|
-
"Deploy
|
|
106
|
+
"Deploy to your Neon project:",
|
|
107
107
|
`${getCliName()} deploy`,
|
|
108
108
|
"",
|
|
109
109
|
"Optional, once deployed:",
|
|
@@ -116,6 +116,7 @@ const extraServicesNext = (input) => [
|
|
|
116
116
|
`${getCliName()} checkout dev --create`,
|
|
117
117
|
...input.skills ? ["", "Set up the services declared in neon.ts with your coding agent. The Neon agent skills cover best practices for each one."] : []
|
|
118
118
|
];
|
|
119
|
+
const configInitNext = () => ["Declare this project's Neon services as code in neon.ts:", `${getCliName()} config init`];
|
|
119
120
|
const existingConfigNext = () => ["The existing Neon config was preserved. Refresh environment variables when its declared services are available:", `${getCliName()} env pull`];
|
|
120
121
|
const claimableNext = (expiresAt) => [
|
|
121
122
|
`This project expires at ${expiresAt}.`,
|
|
@@ -128,7 +129,7 @@ const claimableThenServicesNext = (expiresAt) => [
|
|
|
128
129
|
"After claiming the project, review neon.ts and preview the changes:",
|
|
129
130
|
`${getCliName()} config plan`,
|
|
130
131
|
"",
|
|
131
|
-
"Deploy
|
|
132
|
+
"Deploy to your Neon project:",
|
|
132
133
|
`${getCliName()} deploy`,
|
|
133
134
|
"",
|
|
134
135
|
"Refresh local environment variables:",
|
|
@@ -173,4 +174,4 @@ const headingForOutcome = (outcome) => {
|
|
|
173
174
|
}
|
|
174
175
|
};
|
|
175
176
|
//#endregion
|
|
176
|
-
export { AGENT_DETECTED_DESCRIPTION, AGENT_MCP_PICKER_MESSAGE, AGENT_MCP_SKIP_MESSAGE, AGENT_OTHER_DESCRIPTION, AGENT_PICKER_MESSAGE, AGENT_PLUGIN_SKIP_MESSAGE, AGENT_SETUP_MESSAGE, AGENT_SETUP_PLUGIN_DESCRIPTION, AGENT_SETUP_PLUGIN_TITLE, AGENT_SETUP_SKILLS_DESCRIPTION, AGENT_SETUP_SKILLS_TITLE, AGENT_SETUP_SKIP_DESCRIPTION, AGENT_SETUP_SKIP_TITLE, AGENT_SKILLS_PICKER_MESSAGE, AGENT_SKILLS_SKIP_MESSAGE, CANCELLED_BODY, CLAIMABLE_ACCOUNT_FLAGS, CLAIMABLE_ALREADY_LINKED, CLAIMABLE_MCP_API_KEY, CLAIMABLE_NO_LINK, CONFIG_CONFIRM_HINT, CONFIG_CONFIRM_MESSAGE, HEADING_CANCELLED, HEADING_COMPLETE, HEADING_FAILED, HEADING_PENDING, INIT_NEEDS_YES, INIT_SUBTITLE, MCP_API_KEY_NEEDS_AUTH, MCP_AUTH_API_KEY_DESCRIPTION, MCP_AUTH_API_KEY_TITLE, MCP_AUTH_MESSAGE, MCP_AUTH_OAUTH_DESCRIPTION, MCP_AUTH_OAUTH_TITLE, MCP_OAUTH_FALLBACK, MCP_SCOPED_NEEDS_PROJECT, MCP_SCOPE_GLOBAL_DESCRIPTION, MCP_SCOPE_GLOBAL_TITLE, MCP_SCOPE_MESSAGE, MCP_SCOPE_PROJECT_DESCRIPTION, MCP_SCOPE_PROJECT_TITLE, MODE_CUSTOM_DESCRIPTION, MODE_CUSTOM_TITLE, MODE_MESSAGE, MODE_RECOMMENDED_DESCRIPTION, MODE_RECOMMENDED_TITLE, NON_TTY_AGENT_SETUP, NON_TTY_LINK_NEEDS_AUTH, NO_AGENTS_FALLBACK_STATUS, NO_AGENT_SETUP_CONFLICT, PACKAGE_MANAGER_MESSAGE, PROGRESS, PROJECT_PINNED_OFFLINE, PROJECT_SETUP_CLAIMABLE_DESCRIPTION, PROJECT_SETUP_CLAIMABLE_TITLE, PROJECT_SETUP_LINK_DESCRIPTION, PROJECT_SETUP_LINK_TITLE, PROJECT_SETUP_MESSAGE, SERVICES_HINT, SERVICES_MESSAGE, SKILLS_PICKER_MESSAGE, agentMissingCommandDescription, claimableNext, claimableThenServicesNext, envPullFailedNext, existingConfigNext,
|
|
177
|
+
export { AGENT_DETECTED_DESCRIPTION, AGENT_MCP_PICKER_MESSAGE, AGENT_MCP_SKIP_MESSAGE, AGENT_OTHER_DESCRIPTION, AGENT_PICKER_MESSAGE, AGENT_PLUGIN_SKIP_MESSAGE, AGENT_SETUP_MESSAGE, AGENT_SETUP_PLUGIN_DESCRIPTION, AGENT_SETUP_PLUGIN_TITLE, AGENT_SETUP_SKILLS_DESCRIPTION, AGENT_SETUP_SKILLS_TITLE, AGENT_SETUP_SKIP_DESCRIPTION, AGENT_SETUP_SKIP_TITLE, AGENT_SKILLS_PICKER_MESSAGE, AGENT_SKILLS_SKIP_MESSAGE, CANCELLED_BODY, CLAIMABLE_ACCOUNT_FLAGS, CLAIMABLE_ALREADY_LINKED, CLAIMABLE_MCP_API_KEY, CLAIMABLE_NO_LINK, CONFIG_CONFIRM_HINT, CONFIG_CONFIRM_MESSAGE, HEADING_CANCELLED, HEADING_COMPLETE, HEADING_FAILED, HEADING_PENDING, INIT_NEEDS_YES, INIT_SUBTITLE, MCP_API_KEY_NEEDS_AUTH, MCP_AUTH_API_KEY_DESCRIPTION, MCP_AUTH_API_KEY_TITLE, MCP_AUTH_MESSAGE, MCP_AUTH_OAUTH_DESCRIPTION, MCP_AUTH_OAUTH_TITLE, MCP_OAUTH_FALLBACK, MCP_SCOPED_NEEDS_PROJECT, MCP_SCOPE_GLOBAL_DESCRIPTION, MCP_SCOPE_GLOBAL_TITLE, MCP_SCOPE_MESSAGE, MCP_SCOPE_PROJECT_DESCRIPTION, MCP_SCOPE_PROJECT_TITLE, MODE_CUSTOM_DESCRIPTION, MODE_CUSTOM_TITLE, MODE_MESSAGE, MODE_RECOMMENDED_DESCRIPTION, MODE_RECOMMENDED_TITLE, NON_TTY_AGENT_SETUP, NON_TTY_LINK_NEEDS_AUTH, NO_AGENTS_FALLBACK_STATUS, NO_AGENT_SETUP_CONFLICT, PACKAGE_MANAGER_MESSAGE, PROGRESS, PROJECT_PINNED_OFFLINE, PROJECT_SETUP_CLAIMABLE_DESCRIPTION, PROJECT_SETUP_CLAIMABLE_TITLE, PROJECT_SETUP_LINK_DESCRIPTION, PROJECT_SETUP_LINK_TITLE, PROJECT_SETUP_MESSAGE, SERVICES_HINT, SERVICES_MESSAGE, SKILLS_PICKER_MESSAGE, agentMissingCommandDescription, claimableNext, claimableThenServicesNext, configInitNext, envPullFailedNext, existingConfigNext, headingForOutcome, installFailedNext, mcpAfterLinkNext, mcpConfigLocationSkipped, mcpConfigLocationUnavailable, mcpKeyFailedNext, namedAgentsUnavailable, newConfigNext, offlinePinNext, skippedLinkNext, unattendedUnauthedNext };
|
package/dist/init/run.js
CHANGED
|
@@ -15,7 +15,7 @@ import { missingPluginsCommands, pluginsInstallableAgents } from "../plugins/tar
|
|
|
15
15
|
import { skillsInstallableAgents } from "../skills/targets.js";
|
|
16
16
|
import { FALLBACK_SKILLS_AGENTS, assertNamedAgentTooling, funnelAgentSetup, planInitToolingSteps, recommendedTooling, resolveNamedAgents, splitInitTooling } from "./plan.js";
|
|
17
17
|
import { inferPackageManager, resolvePackageManager } from "../utils/package_manager.js";
|
|
18
|
-
import { 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, envPullFailedNext, existingConfigNext,
|
|
18
|
+
import { 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, unattendedUnauthedNext } from "./copy.js";
|
|
19
19
|
import { agentsRowValue, configRowValue, formatInitDone, headingForKind, printInitBanner, printInitDone, printInitProgress, projectRowValue, shouldPrintInitBanner } from "./chrome.js";
|
|
20
20
|
import { ConfigInstallFailed, initCmd } from "../commands/config.js";
|
|
21
21
|
import { quoteFlagValue, runLink } from "../commands/link.js";
|
|
@@ -620,9 +620,9 @@ const runInit = async (props) => {
|
|
|
620
620
|
} else if (pendingClaimable && claimExpiresAt !== void 0) {
|
|
621
621
|
if (next.length > 0) next.push("");
|
|
622
622
|
next.push(...claimableNext(claimExpiresAt));
|
|
623
|
-
} else if (
|
|
623
|
+
} else if (wroteNewFile && linked) {
|
|
624
624
|
if (next.length > 0) next.push("");
|
|
625
|
-
next.push(...
|
|
625
|
+
next.push(...newConfigNext({
|
|
626
626
|
skills: installsSkills(reportedTooling()),
|
|
627
627
|
functions: declared.includes("functions")
|
|
628
628
|
}));
|
|
@@ -630,6 +630,10 @@ const runInit = async (props) => {
|
|
|
630
630
|
if (next.length > 0) next.push("");
|
|
631
631
|
next.push(...existingConfigNext());
|
|
632
632
|
}
|
|
633
|
+
if (funnel.config === "skipped" && !existingConfig) {
|
|
634
|
+
if (next.length > 0) next.push("");
|
|
635
|
+
next.push(...configInitNext());
|
|
636
|
+
}
|
|
633
637
|
outcome = pending && !pendingUnauthed && noLink ? "success" : pending ? "pending" : "success";
|
|
634
638
|
if (pendingUnauthed) outcome = "pending";
|
|
635
639
|
if (noLink && !pendingUnauthed && !pendingServices && !pendingExisting) outcome = "success";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neon",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"yargs": "17.7.2",
|
|
72
72
|
"yoctocolors": "^2.1.2",
|
|
73
73
|
"@neon/config": "1.9.1",
|
|
74
|
-
"@neon/config-runtime": "1.10.0",
|
|
75
74
|
"@neon/realtime": "0.1.0",
|
|
76
|
-
"@neon/sdk": "7.2.0"
|
|
75
|
+
"@neon/sdk": "7.2.0",
|
|
76
|
+
"@neon/config-runtime": "1.10.0"
|
|
77
77
|
},
|
|
78
78
|
"optionalDependencies": {
|
|
79
79
|
"@napi-rs/keyring": "1.3.0",
|