From ce9f953d8267685803ef98989f2c0d70eeb1a150 Mon Sep 17 00:00:00 2001 From: Gosha Date: Mon, 23 Dec 2024 16:41:32 +0200 Subject: [PATCH] feat(api): remove skip ref --- .../app/workflows-v2/shared/schemas/chat-control.schema.ts | 4 ++-- .../app/workflows-v2/shared/schemas/delay-control.schema.ts | 4 ++-- .../workflows-v2/shared/schemas/digest-control.schema.ts | 6 +++--- .../app/workflows-v2/shared/schemas/email-control.schema.ts | 4 ++-- .../workflows-v2/shared/schemas/in-app-control.schema.ts | 4 ++-- .../app/workflows-v2/shared/schemas/push-control.schema.ts | 4 ++-- .../app/workflows-v2/shared/schemas/skip-control.schema.ts | 3 --- .../app/workflows-v2/shared/schemas/sms-control.schema.ts | 4 ++-- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts index a05dd9e1021..07ad1dcef2f 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts @@ -2,11 +2,11 @@ import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; import { JSONSchemaDto, UiComponentEnum, UiSchema, UiSchemaGroupEnum } from '@novu/shared'; -import { skipStepUiSchema, skipZodSchema } from './skip-control.schema'; +import { skipStepUiSchema } from './skip-control.schema'; export const chatControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), body: z.string(), }) .strict(); diff --git a/apps/api/src/app/workflows-v2/shared/schemas/delay-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/delay-control.schema.ts index 73df64df4fb..bae03fffe38 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/delay-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/delay-control.schema.ts @@ -8,11 +8,11 @@ import { UiSchema, UiSchemaGroupEnum, } from '@novu/shared'; -import { skipStepUiSchema, skipZodSchema } from './skip-control.schema'; +import { skipStepUiSchema } from './skip-control.schema'; export const delayControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), type: z.enum(['regular']).default('regular'), amount: z.union([z.number().min(1), z.string()]), unit: z.nativeEnum(TimeUnitEnum), diff --git a/apps/api/src/app/workflows-v2/shared/schemas/digest-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/digest-control.schema.ts index c9fc750cd52..e47a80888c8 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/digest-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/digest-control.schema.ts @@ -8,11 +8,11 @@ import { UiSchema, UiSchemaGroupEnum, } from '@novu/shared'; -import { skipStepUiSchema, skipZodSchema } from './skip-control.schema'; +import { skipStepUiSchema } from './skip-control.schema'; const digestRegularControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), amount: z.union([z.number().min(1), z.string().min(1)]), unit: z.nativeEnum(TimeUnitEnum).default(TimeUnitEnum.SECONDS), digestKey: z.string().optional(), @@ -27,7 +27,7 @@ const digestRegularControlZodSchema = z .strict(); const digestTimedControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), cron: z.string().min(1), digestKey: z.string().optional(), }) diff --git a/apps/api/src/app/workflows-v2/shared/schemas/email-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/email-control.schema.ts index 7cf7b21e093..0a3227d6c91 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/email-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/email-control.schema.ts @@ -2,11 +2,11 @@ import { JSONSchemaDto, UiComponentEnum, UiSchema, UiSchemaGroupEnum } from '@no import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; import { TipTapSchema } from '../../../environments-v1/usecases/output-renderers'; -import { skipZodSchema, skipStepUiSchema } from './skip-control.schema'; +import { skipStepUiSchema } from './skip-control.schema'; export const emailControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), /* * todo: we need to validate the email editor (body) by type and not string, * updating it to TipTapSchema will break the existing upsert issues generation diff --git a/apps/api/src/app/workflows-v2/shared/schemas/in-app-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/in-app-control.schema.ts index 0d827963e74..1c48225e5a5 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/in-app-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/in-app-control.schema.ts @@ -1,7 +1,7 @@ import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; import { JSONSchemaDto, UiComponentEnum, UiSchema, UiSchemaGroupEnum } from '@novu/shared'; -import { skipStepUiSchema, skipZodSchema } from './skip-control.schema'; +import { skipStepUiSchema } from './skip-control.schema'; const redirectZodSchema = z .object({ @@ -23,7 +23,7 @@ const actionZodSchema = z export const inAppControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), subject: z.string().optional(), body: z.string(), avatar: z.string().optional(), diff --git a/apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts index 2ff49d9ec6b..5e51b0e319c 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts @@ -2,11 +2,11 @@ import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; import { JSONSchemaDto, UiComponentEnum, UiSchema, UiSchemaGroupEnum } from '@novu/shared'; -import { skipZodSchema, skipStepUiSchema } from './skip-control.schema'; +import { skipStepUiSchema } from './skip-control.schema'; export const pushControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), subject: z.string(), body: z.string(), }) diff --git a/apps/api/src/app/workflows-v2/shared/schemas/skip-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/skip-control.schema.ts index 28fa246e337..98f59ee6033 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/skip-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/skip-control.schema.ts @@ -1,7 +1,4 @@ import { UiSchemaGroupEnum, UiSchema, UiComponentEnum } from '@novu/shared'; -import { z } from 'zod'; - -export const skipZodSchema = z.object({}).catchall(z.unknown()).optional(); export const skipStepUiSchema = { group: UiSchemaGroupEnum.SKIP, diff --git a/apps/api/src/app/workflows-v2/shared/schemas/sms-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/sms-control.schema.ts index 36ebe4ff5d7..a9d0911a5dd 100644 --- a/apps/api/src/app/workflows-v2/shared/schemas/sms-control.schema.ts +++ b/apps/api/src/app/workflows-v2/shared/schemas/sms-control.schema.ts @@ -2,11 +2,11 @@ import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; import { JSONSchemaDto, UiComponentEnum, UiSchema, UiSchemaGroupEnum } from '@novu/shared'; -import { skipZodSchema, skipStepUiSchema } from './skip-control.schema'; +import { skipStepUiSchema } from './skip-control.schema'; export const smsControlZodSchema = z .object({ - skip: skipZodSchema, + skip: z.object({}).catchall(z.unknown()).optional(), body: z.string(), }) .strict();