From 3f9027c1247a7d32908a46a93690df78e431bbf0 Mon Sep 17 00:00:00 2001 From: GalT <39020298+tatarco@users.noreply.github.com> Date: Tue, 29 Oct 2024 09:21:46 +0100 Subject: [PATCH 01/11] feat(api): complete email preview --- .cspell.json | 1 + .idea/codeStyles/Project.xml | 1 + .../preview-step/preview-step.command.ts | 11 +- .../preview-step/preview-step.usecase.ts | 4 +- .../app/environments-v1/novu-bridge.module.ts | 8 +- .../construct-framework-workflow.usecase.ts | 30 +- .../email-output-renderer.usecase.ts | 44 -- .../email-schema-expander.usecase.ts | 77 --- .../expand-email-editor-schema-command.ts | 9 + .../expand-email-editor-schema.usecase.ts | 170 ++++++ .../expend-email-editor-schema-command.ts | 9 - .../hydrate-email-schema.command.ts | 8 + .../hydrate-email-schema.usecase.ts | 211 +++++++ .../usecases/output-renderers/index.ts | 6 +- .../output-renderers/render-command.ts | 6 + .../render-email-output.usecase.ts | 33 + .../app/workflows-v2/generate-preview.e2e.ts | 226 ++++--- .../src/app/workflows-v2/maily-test-data.ts | 570 ++++++++++++++++++ .../build-default-payload-use-case.service.ts | 159 +++++ .../build-payload-from-placeholder/index.ts | 1 + .../generate-preview-command.ts | 2 +- .../generate-preview.usecase.ts | 213 ++----- .../buildPayloadNestedStructureUsecase.ts | 29 + ...laceholders-from-tip-tap-schema.usecase.ts | 109 ---- ...yload-defaults-engine-failure.exception.ts | 7 + ...payload-preview-value-generator.usecase.ts | 81 ++- .../transform-placeholder.usecase.ts | 60 -- .../workflows-v2/workflow.controller.e2e.ts | 35 +- .../src/app/workflows-v2/workflow.module.ts | 15 +- apps/api/src/exception-filter.ts | 40 +- .../shared/src}/clients/index.ts | 0 .../shared/src}/clients/novu-base-client.ts | 0 .../shared/src}/clients/workflows-client.ts | 8 +- packages/shared/src/dto/index.ts | 1 - .../control-preview-issue-type.enum.ts | 5 - .../src/dto/step-schemas/control-schemas.ts | 13 - .../generate-preview-response.dto.ts | 86 --- packages/shared/src/dto/step-schemas/index.ts | 5 - .../src/dto/workflows/control-schemas.ts | 33 + .../generate-preview-request.dto.ts | 6 +- packages/shared/src/dto/workflows/index.ts | 4 + .../json-schema-dto.ts | 0 .../workflows/preview-step-response.dto.ts | 13 +- packages/shared/src/index.ts | 1 + 44 files changed, 1638 insertions(+), 712 deletions(-) delete mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/email-output-renderer.usecase.ts delete mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/email-schema-expander.usecase.ts create mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/expand-email-editor-schema-command.ts create mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/expand-email-editor-schema.usecase.ts delete mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/expend-email-editor-schema-command.ts create mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/hydrate-email-schema.command.ts create mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/hydrate-email-schema.usecase.ts create mode 100644 apps/api/src/app/environments-v1/usecases/output-renderers/render-email-output.usecase.ts create mode 100644 apps/api/src/app/workflows-v2/maily-test-data.ts create mode 100644 apps/api/src/app/workflows-v2/usecases/build-payload-from-placeholder/build-default-payload-use-case.service.ts create mode 100644 apps/api/src/app/workflows-v2/usecases/build-payload-from-placeholder/index.ts create mode 100644 apps/api/src/app/workflows-v2/usecases/placeholder-enrichment/buildPayloadNestedStructureUsecase.ts delete mode 100644 apps/api/src/app/workflows-v2/usecases/placeholder-enrichment/collect-placeholders-from-tip-tap-schema.usecase.ts create mode 100644 apps/api/src/app/workflows-v2/usecases/placeholder-enrichment/payload-defaults-engine-failure.exception.ts delete mode 100644 apps/api/src/app/workflows-v2/usecases/placeholder-enrichment/transform-placeholder.usecase.ts rename {apps/api/src/app/workflows-v2 => packages/shared/src}/clients/index.ts (100%) rename {apps/api/src/app/workflows-v2 => packages/shared/src}/clients/novu-base-client.ts (100%) rename {apps/api/src/app/workflows-v2 => packages/shared/src}/clients/workflows-client.ts (97%) delete mode 100644 packages/shared/src/dto/step-schemas/control-preview-issue-type.enum.ts delete mode 100644 packages/shared/src/dto/step-schemas/control-schemas.ts delete mode 100644 packages/shared/src/dto/step-schemas/generate-preview-response.dto.ts delete mode 100644 packages/shared/src/dto/step-schemas/index.ts create mode 100644 packages/shared/src/dto/workflows/control-schemas.ts rename packages/shared/src/dto/{step-schemas => workflows}/generate-preview-request.dto.ts (65%) rename packages/shared/src/dto/{step-schemas => workflows}/json-schema-dto.ts (100%) diff --git a/.cspell.json b/.cspell.json index 5c8000f827f..b8ae9adfc23 100644 --- a/.cspell.json +++ b/.cspell.json @@ -753,6 +753,7 @@ "projectIds" ], "ignorePaths": [ + "apps/api/src/app/workflows-v2/maily-test-data.ts", "apps/api/src/.env.test", "apps/ws/src/.env.test", "apps/ws/src/.example.env", diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index f986f2fe824..fcf2ca85553 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -19,6 +19,7 @@