mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 11:29:42 +00:00
54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
|
|
import { IntegrationAuthsSchema, SecretApprovalPoliciesSchema, UsersSchema } from "@app/db/schemas";
|
|
|
|
// sometimes the return data must be santizied to avoid leaking important values
|
|
// always prefer pick over omit in zod
|
|
export const integrationAuthPubSchema = IntegrationAuthsSchema.pick({
|
|
id: true,
|
|
projectId: true,
|
|
integration: true,
|
|
teamId: true,
|
|
url: true,
|
|
namespace: true,
|
|
accountId: true,
|
|
metadata: true,
|
|
createdAt: true,
|
|
updatedAt: true
|
|
});
|
|
|
|
export const sapPubSchema = SecretApprovalPoliciesSchema.merge(
|
|
z.object({
|
|
environment: z.object({
|
|
id: z.string(),
|
|
name: z.string(),
|
|
slug: z.string()
|
|
}),
|
|
projectId: z.string()
|
|
})
|
|
);
|
|
|
|
export const sanitizedServiceTokenUserSchema = UsersSchema.pick({
|
|
authMethods: true,
|
|
id: true,
|
|
createdAt: true,
|
|
updatedAt: true,
|
|
devices: true,
|
|
email: true,
|
|
firstName: true,
|
|
lastName: true,
|
|
mfaMethods: true
|
|
});
|
|
|
|
export const secretRawSchema = z.object({
|
|
id: z.string(),
|
|
_id: z.string(),
|
|
workspace: z.string(),
|
|
environment: z.string(),
|
|
version: z.number(),
|
|
type: z.string(),
|
|
secretKey: z.string(),
|
|
secretValue: z.string(),
|
|
secretComment: z.string().optional()
|
|
});
|