mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: greptile review
This commit is contained in:
@@ -57,10 +57,16 @@ const rootSchema = genericAppConnectionFieldsSchema.extend({
|
|||||||
method: z.nativeEnum(GitHubConnectionMethod)
|
method: z.nativeEnum(GitHubConnectionMethod)
|
||||||
});
|
});
|
||||||
|
|
||||||
const baseCredentialsSchema = z.object({
|
const baseCredentialsSchema = z.union([
|
||||||
instanceType: z.union([z.literal("cloud"), z.literal("server")]).optional(),
|
z.object({
|
||||||
host: z.string().optional()
|
instanceType: z.literal("server"),
|
||||||
});
|
host: z.string().min(1, "Host is required for server instance type")
|
||||||
|
}),
|
||||||
|
z.object({
|
||||||
|
instanceType: z.literal("cloud").optional(),
|
||||||
|
host: z.string().optional()
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
|
||||||
const appSchema = rootSchema.extend({
|
const appSchema = rootSchema.extend({
|
||||||
method: z.literal(GitHubConnectionMethod.App),
|
method: z.literal(GitHubConnectionMethod.App),
|
||||||
@@ -74,9 +80,18 @@ const oauthSchema = rootSchema.extend({
|
|||||||
|
|
||||||
const patSchema = rootSchema.extend({
|
const patSchema = rootSchema.extend({
|
||||||
method: z.literal(GitHubConnectionMethod.Pat),
|
method: z.literal(GitHubConnectionMethod.Pat),
|
||||||
credentials: baseCredentialsSchema.extend({
|
credentials: z.union([
|
||||||
personalAccessToken: z.string().min(1, "Personal Access Token is required")
|
z.object({
|
||||||
})
|
instanceType: z.literal("server"),
|
||||||
|
host: z.string().min(1, "Host is required for server instance type"),
|
||||||
|
personalAccessToken: z.string().min(1, "Personal Access Token is required")
|
||||||
|
}),
|
||||||
|
z.object({
|
||||||
|
instanceType: z.literal("cloud").optional(),
|
||||||
|
host: z.string().optional(),
|
||||||
|
personalAccessToken: z.string().min(1, "Personal Access Token is required")
|
||||||
|
})
|
||||||
|
])
|
||||||
});
|
});
|
||||||
|
|
||||||
type PatSchemaForm = z.infer<typeof patSchema>;
|
type PatSchemaForm = z.infer<typeof patSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user