A few tweaks

This commit is contained in:
x032205
2025-07-16 03:05:32 -04:00
parent fce6738562
commit 19cb220107
7 changed files with 11 additions and 6 deletions
+1
View File
@@ -2199,6 +2199,7 @@ export const AppConnections = {
audience: "The unique identifier of the target API you want to access." audience: "The unique identifier of the target API you want to access."
}, },
SQL_CONNECTION: { SQL_CONNECTION: {
gatewayId: "The ID of the gateway to use when performing database requests.",
host: "The hostname of the database server.", host: "The hostname of the database server.",
port: "The port number of the database.", port: "The port number of the database.",
database: "The name of the database to connect to.", database: "The name of the database to connect to.",
@@ -3,7 +3,11 @@ import { z } from "zod";
import { AppConnections } from "@app/lib/api-docs"; import { AppConnections } from "@app/lib/api-docs";
export const BaseSqlUsernameAndPasswordConnectionSchema = z.object({ export const BaseSqlUsernameAndPasswordConnectionSchema = z.object({
gatewayId: z.string().optional(), gatewayId: z
.union([z.string().uuid(), z.literal("")])
.transform((value) => value || null)
.nullish()
.describe(AppConnections.CREDENTIALS.SQL_CONNECTION.gatewayId),
host: z.string().trim().min(1, "Host required").describe(AppConnections.CREDENTIALS.SQL_CONNECTION.host), host: z.string().trim().min(1, "Host required").describe(AppConnections.CREDENTIALS.SQL_CONNECTION.host),
port: z.coerce.number().describe(AppConnections.CREDENTIALS.SQL_CONNECTION.port), port: z.coerce.number().describe(AppConnections.CREDENTIALS.SQL_CONNECTION.port),
database: z.string().trim().min(1, "Database required").describe(AppConnections.CREDENTIALS.SQL_CONNECTION.database), database: z.string().trim().min(1, "Database required").describe(AppConnections.CREDENTIALS.SQL_CONNECTION.database),
@@ -152,7 +152,7 @@ export const MsSqlConnectionForm = ({ appConnection, onSubmit }: Props) => {
<div> <div>
<Select <Select
isDisabled={!isAllowed} isDisabled={!isAllowed}
value={value} value={value as string}
onValueChange={onChange} onValueChange={onChange}
className="w-full border border-mineshaft-500" className="w-full border border-mineshaft-500"
dropdownContainerClassName="max-w-none" dropdownContainerClassName="max-w-none"
@@ -149,7 +149,7 @@ export const MySqlConnectionForm = ({ appConnection, onSubmit }: Props) => {
<div> <div>
<Select <Select
isDisabled={!isAllowed} isDisabled={!isAllowed}
value={value} value={value as string}
onValueChange={onChange} onValueChange={onChange}
className="w-full border border-mineshaft-500" className="w-full border border-mineshaft-500"
dropdownContainerClassName="max-w-none" dropdownContainerClassName="max-w-none"
@@ -149,7 +149,7 @@ export const OracleDBConnectionForm = ({ appConnection, onSubmit }: Props) => {
<div> <div>
<Select <Select
isDisabled={!isAllowed} isDisabled={!isAllowed}
value={value} value={value as string}
onValueChange={onChange} onValueChange={onChange}
className="w-full border border-mineshaft-500" className="w-full border border-mineshaft-500"
dropdownContainerClassName="max-w-none" dropdownContainerClassName="max-w-none"
@@ -149,7 +149,7 @@ export const PostgresConnectionForm = ({ appConnection, onSubmit }: Props) => {
<div> <div>
<Select <Select
isDisabled={!isAllowed} isDisabled={!isAllowed}
value={value} value={value as string}
onValueChange={onChange} onValueChange={onChange}
className="w-full border border-mineshaft-500" className="w-full border border-mineshaft-500"
dropdownContainerClassName="max-w-none" dropdownContainerClassName="max-w-none"
@@ -1,7 +1,7 @@
import { z } from "zod"; import { z } from "zod";
export const BaseSqlUsernameAndPasswordConnectionSchema = z.object({ export const BaseSqlUsernameAndPasswordConnectionSchema = z.object({
gatewayId: z.string().optional(), gatewayId: z.string().nullable().optional(),
host: z.string().trim().min(1, "Host required"), host: z.string().trim().min(1, "Host required"),
port: z.coerce.number().default(5432), port: z.coerce.number().default(5432),
database: z.string().trim().min(1, "Database required").default("default"), database: z.string().trim().min(1, "Database required").default("default"),