neon 3.6.0 → 4.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/dist/api.js CHANGED
@@ -796,7 +796,7 @@ const getApiClient = ({ apiKey, apiHost, requestTimeoutMs = REQUEST_TIMEOUT_MS }
796
796
  },
797
797
  body: data
798
798
  })),
799
- sendNeonAuthTestEmail: (projectId, branchId, data) => call(() => raw.sendNeonAuthTestEmail({
799
+ sendNeonAuthEmailProviderTest: (projectId, branchId, data) => call(() => raw.sendNeonAuthEmailProviderTest({
800
800
  client,
801
801
  path: {
802
802
  project_id: projectId,
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "../_chunks/rolldown-runtime-8H4AJuhK.js";
2
2
  import { codeFromBody, isNeonApiError, retryOnLock } from "../api.js";
3
3
  import { writer } from "../writer.js";
4
+ import { noPassthrough, single } from "../utils/flags.js";
4
5
  import { NeonAuthEmailVerificationMethod, NeonAuthOauthProviderId, NeonAuthOauthProviderType, NeonAuthSupportedAuthProvider } from "../utils/api_enums.js";
5
6
  import { branchIdFromProps, fillSingleProject } from "../utils/enrichers.js";
6
7
  import chalk from "chalk";
@@ -241,43 +242,17 @@ const builder = (argv) => {
241
242
  }
242
243
  }), async (args) => {
243
244
  await emailProviderUpdate(args);
244
- }).command("test", "Send a test email", (yargs) => yargs.options({
245
- "recipient-email": {
246
- describe: "Email address to send test email to",
247
- type: "string",
248
- demandOption: true
249
- },
250
- host: {
251
- describe: "SMTP host",
252
- type: "string",
253
- demandOption: true
254
- },
255
- port: {
256
- describe: "SMTP port",
257
- type: "number",
258
- demandOption: true
259
- },
260
- username: {
261
- describe: "SMTP username",
262
- type: "string",
263
- demandOption: true
264
- },
265
- password: {
266
- describe: "SMTP password",
267
- type: "string",
268
- demandOption: true
269
- },
270
- "sender-email": {
271
- describe: "Sender email address",
272
- type: "string",
273
- demandOption: true
274
- },
275
- "sender-name": {
276
- describe: "Sender display name",
277
- type: "string",
278
- demandOption: true
279
- }
280
- }), async (args) => {
245
+ }).command("test", "Send a test message through the saved custom SMTP provider", (yargs) => yargs.options({ "recipient-email": {
246
+ describe: "Email address to deliver the test message to",
247
+ type: "string",
248
+ demandOption: true,
249
+ coerce: single("recipient-email", { required: true })
250
+ } }).strict().check(noPassthrough("neon-auth config email-provider test")).epilogue([
251
+ "Save the provider first with",
252
+ "`neon neon-auth config email-provider update --type standard`.",
253
+ "A shared provider, a missing configuration, or a",
254
+ "non-Better-Auth integration is rejected by the API."
255
+ ].join("\n")), async (args) => {
281
256
  await emailProviderTest(args);
282
257
  });
283
258
  }).command("organization", "Manage organization plugin settings", (yargs) => {
@@ -663,18 +638,21 @@ const emailProviderUpdate = async (props) => {
663
638
  };
664
639
  const emailProviderTest = async (props) => {
665
640
  const branchId = await resolveBranch(props);
666
- const { data } = await props.apiClient.sendNeonAuthTestEmail(props.projectId, branchId, {
667
- recipient_email: props.recipientEmail,
668
- host: props.host,
669
- port: props.port,
670
- username: props.username,
671
- password: props.password,
672
- sender_email: props.senderEmail,
673
- sender_name: props.senderName
674
- });
675
- if (props.output === "json" || props.output === "yaml") writer(props).end(data, { fields: TEST_EMAIL_FIELDS });
676
- else if (data.success) printMessage("Test email sent successfully");
677
- else process.stdout.write(`\n${chalk.red("Test email failed")}\n ${data.error_message ?? "Unknown error"}\n\n`);
641
+ const { data } = await props.apiClient.sendNeonAuthEmailProviderTest(props.projectId, branchId, { recipient_email: props.recipientEmail });
642
+ if (props.output === "json" || props.output === "yaml") {
643
+ writer(props).end(data, { fields: TEST_EMAIL_FIELDS });
644
+ if (!data.success) throw new Error(emailProviderTestFailureMessage(props.recipientEmail, data.error_message));
645
+ return;
646
+ }
647
+ if (data.success) {
648
+ printMessage(`Test email dispatched to ${props.recipientEmail} using the custom SMTP provider saved on this branch.`);
649
+ return;
650
+ }
651
+ throw new Error(emailProviderTestFailureMessage(props.recipientEmail, data.error_message));
652
+ };
653
+ const emailProviderTestFailureMessage = (recipientEmail, errorMessage) => {
654
+ const header = `Test email could NOT be sent to ${recipientEmail} using the custom SMTP provider saved on this branch.`;
655
+ return errorMessage ? `${header}\nUpstream error: ${errorMessage}` : header;
678
656
  };
679
657
  const printOrganizationEntries = (data) => [
680
658
  ["Enabled: ", String(data.enabled)],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "3.6.0",
3
+ "version": "4.0.0",
4
4
  "description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
5
5
  "keywords": [
6
6
  "neon",
@@ -63,9 +63,9 @@
63
63
  "yaml": "^2.9.0",
64
64
  "yargs": "17.7.2",
65
65
  "yoctocolors": "^2.1.2",
66
- "@neon/config": "1.0.1",
67
- "@neon/sdk": "2.1.0",
68
- "@neon/config-runtime": "1.0.1"
66
+ "@neon/config-runtime": "1.0.2",
67
+ "@neon/config": "1.0.2",
68
+ "@neon/sdk": "2.2.0"
69
69
  },
70
70
  "optionalDependencies": {
71
71
  "@napi-rs/keyring": "1.3.0",
@@ -97,7 +97,7 @@
97
97
  "typescript": "^5.9.0",
98
98
  "vitest": "^3.0.9",
99
99
  "@neon-internals/cli-core": "0.0.0",
100
- "@neon-internals/env-core": "0.0.1",
100
+ "@neon-internals/env-core": "0.0.2",
101
101
  "@neon/e2e-harness": "0.0.0"
102
102
  },
103
103
  "publishConfig": {