mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
checkpoint
This commit is contained in:
@@ -11,6 +11,7 @@ export enum AppConnection {
|
|||||||
Vercel = "vercel",
|
Vercel = "vercel",
|
||||||
Postgres = "postgres",
|
Postgres = "postgres",
|
||||||
MsSql = "mssql",
|
MsSql = "mssql",
|
||||||
|
MySql = "mysql",
|
||||||
Camunda = "camunda",
|
Camunda = "camunda",
|
||||||
Windmill = "windmill",
|
Windmill = "windmill",
|
||||||
Auth0 = "auth0",
|
Auth0 = "auth0",
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export * from "./postgres-connection-enums";
|
||||||
|
export * from "./postgres-connection-fns";
|
||||||
|
export * from "./postgres-connection-schemas";
|
||||||
|
export * from "./postgres-connection-types";
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export enum MySqlConnectionMethod {
|
||||||
|
UsernameAndPassword = "username-and-password"
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
|
||||||
|
import { MySqlConnectionMethod } from "./mysql-connection-enums";
|
||||||
|
|
||||||
|
export const getMySqlConnectionListItem = () => {
|
||||||
|
return {
|
||||||
|
name: "MySQL" as const,
|
||||||
|
app: AppConnection.MySql as const,
|
||||||
|
methods: Object.values(MySqlConnectionMethod) as [MySqlConnectionMethod.UsernameAndPassword],
|
||||||
|
supportsPlatformManagement: true as const
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import z from "zod";
|
||||||
|
|
||||||
|
import { AppConnections } from "@app/lib/api-docs";
|
||||||
|
import {
|
||||||
|
BaseAppConnectionSchema,
|
||||||
|
GenericCreateAppConnectionFieldsSchema,
|
||||||
|
GenericUpdateAppConnectionFieldsSchema
|
||||||
|
} from "@app/services/app-connection/app-connection-schemas";
|
||||||
|
|
||||||
|
import { AppConnection } from "../app-connection-enums";
|
||||||
|
import { BaseSqlUsernameAndPasswordConnectionSchema } from "../shared/sql";
|
||||||
|
import { MySqlConnectionMethod } from "./mysql-connection-enums";
|
||||||
|
|
||||||
|
export const MySqlConnectionAccessTokenCredentialsSchema = BaseSqlUsernameAndPasswordConnectionSchema;
|
||||||
|
|
||||||
|
const BaseMySqlConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.MySql) });
|
||||||
|
|
||||||
|
export const MySqlConnectionSchema = BaseMySqlConnectionSchema.extend({
|
||||||
|
method: z.literal(MySqlConnectionMethod.UsernameAndPassword),
|
||||||
|
credentials: MySqlConnectionAccessTokenCredentialsSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
export const SanitizedMySqlConnectionSchema = z.discriminatedUnion("method", [
|
||||||
|
BaseMySqlConnectionSchema.extend({
|
||||||
|
method: z.literal(MySqlConnectionMethod.UsernameAndPassword),
|
||||||
|
credentials: MySqlConnectionAccessTokenCredentialsSchema.pick({
|
||||||
|
host: true,
|
||||||
|
database: true,
|
||||||
|
port: true,
|
||||||
|
username: true,
|
||||||
|
sslEnabled: true,
|
||||||
|
sslRejectUnauthorized: true,
|
||||||
|
sslCertificate: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const ValidateMySqlConnectionCredentialsSchema = z.discriminatedUnion("method", [
|
||||||
|
z.object({
|
||||||
|
method: z
|
||||||
|
.literal(MySqlConnectionMethod.UsernameAndPassword)
|
||||||
|
.describe(AppConnections.CREATE(AppConnection.MySql).method),
|
||||||
|
credentials: MySqlConnectionAccessTokenCredentialsSchema.describe(
|
||||||
|
AppConnections.CREATE(AppConnection.MySql).credentials
|
||||||
|
)
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const CreateMySqlConnectionSchema = ValidateMySqlConnectionCredentialsSchema.and(
|
||||||
|
GenericCreateAppConnectionFieldsSchema(AppConnection.MySql, { supportsPlatformManagedCredentials: true })
|
||||||
|
);
|
||||||
|
|
||||||
|
export const UpdateMySqlConnectionSchema = z
|
||||||
|
.object({
|
||||||
|
credentials: MySqlConnectionAccessTokenCredentialsSchema.optional().describe(
|
||||||
|
AppConnections.UPDATE(AppConnection.MySql).credentials
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.and(GenericUpdateAppConnectionFieldsSchema(AppConnection.MySql, { supportsPlatformManagedCredentials: true }));
|
||||||
|
|
||||||
|
export const MySqlConnectionListItemSchema = z.object({
|
||||||
|
name: z.literal("MySQL"),
|
||||||
|
app: z.literal(AppConnection.MySql),
|
||||||
|
methods: z.nativeEnum(MySqlConnectionMethod).array(),
|
||||||
|
supportsPlatformManagement: z.literal(true)
|
||||||
|
});
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import z from "zod";
|
||||||
|
|
||||||
|
import { AppConnection } from "../app-connection-enums";
|
||||||
|
import {
|
||||||
|
CreateMySqlConnectionSchema,
|
||||||
|
MySqlConnectionSchema,
|
||||||
|
ValidateMySqlConnectionCredentialsSchema
|
||||||
|
} from "./mysql-connection-schemas";
|
||||||
|
|
||||||
|
export type TMySqlConnection = z.infer<typeof MySqlConnectionSchema>;
|
||||||
|
|
||||||
|
export type TMySqlConnectionInput = z.infer<typeof CreateMySqlConnectionSchema> & {
|
||||||
|
app: AppConnection.MySql;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TValidateMySqlConnectionCredentialsSchema = typeof ValidateMySqlConnectionCredentialsSchema;
|
||||||
Reference in New Issue
Block a user