* add webhook version schema * version the code * update version from numeric to date val * migration * update schema and build factory * update string * move version picker * tooltip instead of infobadge * -- * fix type * -- * fix type * fix type * -- * fix messed up merge * improvements to payloadfactory * extract version off of DB and instead keep it in IWebhookRepository * fix webhookform * fix type safety and routing ambiguity * scalable with easier factory extensions and base definition * fix types * -- * -- * clean up prisma/client type imports * fix * type fix * type fix * cleanup * add tests and registry changes * unintended file inclusion * type-fix * select in repo * -- * explicit return type * -- * fix type * fixes * feedback 1 * feedback 2 * use enum instead of string * fixes
25 lines
978 B
TypeScript
25 lines
978 B
TypeScript
import { z } from "zod";
|
|
|
|
import { TIME_UNIT } from "@calcom/features/ee/workflows/lib/constants";
|
|
import { WEBHOOK_TRIGGER_EVENTS } from "@calcom/features/webhooks/lib/constants";
|
|
import { WebhookVersion } from "@calcom/features/webhooks/lib/interface/IWebhookRepository";
|
|
|
|
import { webhookIdAndEventTypeIdSchema } from "./types";
|
|
|
|
export const ZCreateInputSchema = webhookIdAndEventTypeIdSchema.extend({
|
|
subscriberUrl: z.string().url(),
|
|
eventTriggers: z.enum(WEBHOOK_TRIGGER_EVENTS).array(),
|
|
active: z.boolean(),
|
|
payloadTemplate: z.string().nullable(),
|
|
eventTypeId: z.number().optional(),
|
|
appId: z.string().optional().nullable(),
|
|
secret: z.string().optional().nullable(),
|
|
teamId: z.number().optional(),
|
|
platform: z.boolean().optional(),
|
|
time: z.number().nullable().optional(),
|
|
timeUnit: z.enum(TIME_UNIT).nullable().optional(),
|
|
version: z.nativeEnum(WebhookVersion).optional(),
|
|
});
|
|
|
|
export type TCreateInputSchema = z.infer<typeof ZCreateInputSchema>;
|