-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api-service): refactor issue error messages #7359
Conversation
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for dashboard-v2-novu-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…messages # Conflicts: # apps/api/src/app/workflows-v2/shared/schemas/chat-control.schema.ts # apps/api/src/app/workflows-v2/shared/schemas/delay-control.schema.ts # apps/api/src/app/workflows-v2/shared/schemas/digest-control.schema.ts # apps/api/src/app/workflows-v2/shared/schemas/email-control.schema.ts # apps/api/src/app/workflows-v2/shared/schemas/in-app-control.schema.ts # apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts # apps/api/src/app/workflows-v2/shared/schemas/sms-control.schema.ts
…messages # Conflicts: # apps/api/src/app/inbox/usecases/get-inbox-preferences/get-inbox-preferences.spec.ts
apps/api/src/app/environments-v1/usecases/output-renderers/digest-output-renderer.usecase.ts
Show resolved
Hide resolved
|
||
if (isEmpty(body)) { | ||
return { subject, body: '' }; | ||
if (!body || typeof body !== 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit picky comment: Since tip tap processing takes place if the body exists, it is more readable to change the logic to
let renderedBody = '';
const expandedMailyContent = this.transformMailyDynamicBlocks(body, renderCommand.fullPayloadForRender);
const parsedTipTap = await this.parseTipTapNodeByLiquid(expandedMailyContent, renderCommand);
renderedBody = await this.renderEmail(parsedTipTap);
}
return { subject, renderedBody }
apps/api/src/app/workflows-v2/usecases/generate-preview/generate-preview.usecase.ts
Show resolved
Hide resolved
): Record<string, unknown> { | ||
const outputSchema = channelStepSchemas[type].output || actionStepSchemas[type].output; | ||
|
||
if (!outputSchema || !controlValues) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should throw an error at this point. The inability to identify an outputSchema
from the framework indicates an invalid workflow definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, but I tried to handle it as gracefully as possible. maybe we could log and return the controlValues instead? are you sure we need to throw an error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Without output schema, there is no step. So we need to fail fast.
apps/api/src/app/workflows-v2/usecases/upsert-workflow/upsert-workflow.usecase.ts
Show resolved
Hide resolved
@@ -0,0 +1,7 @@ | |||
export * from './in-app-control.schema'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These schemas are strictly connected to the built-in Dashboard UI powered by the new Novu workflow V2 API. Do they belong in the application generic? I don't feel strongly about it, but I'd consider it a code smell if these schemas were reused in other services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting and valid point, i can share why they are in app-gen.
The are in app-gen because i reused the types from the schema in the dashboardSanitizeControlValues function so i needed them close to it, and dashboardSanitizeControlValues is used in Worker.
Let me know what you think about such an implementation.
What changed? Why was the change needed?
https://www.loom.com/share/91f0b186dea3470f987ff902ff9b8933
Screenshots
Expand for optional sections
Related enterprise PR
Special notes for your reviewer