Skip to content
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(framework): add class-validator support #6945

Open
wants to merge 85 commits into
base: next
Choose a base branch
from

Conversation

paulwer
Copy link
Contributor

@paulwer paulwer commented Nov 11, 2024

What changed? Why was the change needed?

  • Add Class Validator support for @novu/framework
  • Add type error messages when providing invalid schemas
  • Add Stringify<T> generic helper for helpful type error messages
  • Hard-code checkIsErrorResponse into @novu/framework to resolve ESM import issues from @novu/shared

Screenhots

Class validator peer dependency import failure message

 ⨯ Error: Tried to use a class-validator schema in @novu/framework without class-validator-jsonschema installed. Please install it by running `npm install class-validator-jsonschema`.
    at se (/Users/rifont/git/framework-next-turbo/.next/server/app/api/novu/route.js:411:77618)
    at async si.canHandle (/Users/rifont/git/framework-next-turbo/.next/server/app/api/novu/route.js:411:79403)
    at async sp (/Users/rifont/git/framework-next-turbo/.next/server/app/api/novu/route.js:411:81104)
    at async Object.discover (/Users/rifont/git/framework-next-turbo/.next/server/app/api/novu/route.js:505:10531)
    at async sl.addWorkflows (/Users/rifont/git/framework-next-turbo/.next/server/app/api/novu/route.js:501:8314)
    at async (/Users/rifont/git/framework-next-turbo/.next/server/app/api/novu/route.js:505:3508)
    at async te.do (/Users/rifont/git/framework-next-turbo/node_modules/.pnpm/[email protected][email protected][email protected]__utrvdij6okqvk6cvj3mqcl5cuy/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:17826)
    at async te.handle (/Users/rifont/git/framework-next-turbo/node_modules/.pnpm/[email protected][email protected][email protected]__utrvdij6okqvk6cvj3mqcl5cuy/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:22492)
    at async doRender (/Users/rifont/git/framework-next-turbo/node_modules/.pnpm/[email protected][email protected][email protected]__utrvdij6okqvk6cvj3mqcl5cuy/node_modules/next/dist/server/base-server.js:1455:42) {
  statusCode: 500,
  code: 'MissingDependencyError',
  data: [Array]
}

New type error messages shown when attempting to consume data for invalid schemas
image

Demonstrating a more advanced variant of the error message
image

Expand for optional sections ### Related enterprise PR

Special notes for your reviewer

closes #6682

reference #6840

paulwer and others added 30 commits November 4, 2024 14:17
…validator-support' into feat-package-class-validator-support
@@ -38,7 +38,7 @@
"build:watch": "tsup --watch",
"postbuild": "pnpm run check:exports && pnpm check:circulars",
"check:exports": "attw --pack .",
"check:circulars": "madge --circular --extensions ts ./src",
"check:circulars": "madge --circular --extensions ts --exclude ../../shared ./src",
Copy link
Collaborator

@rifont rifont Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SokratisVidros is seems that Framework is still detecting circular dependency issues from Framework, even though no issues are traced back to Framework (see logs below in collapsible). Note, shared does not report these issues using madge on it's own check:circulars script.

Furthermore it appears the PR removing shared circulars had a run pulled from local cache on CI, so this removal was never tested. I am reverting for now as it's a false-positive.

Details

1) ../../shared/dist/cjs/dto/index.d.ts > ../../shared/dist/cjs/dto/events/index.d.ts > ../../shared/dist/cjs/dto/events/event.interface.d.ts > ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/clerk/index.d.ts > ../../shared/dist/cjs/types/clerk/types.d.ts
2) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/clerk/index.d.ts > ../../shared/dist/cjs/types/clerk/types.d.ts > ../../shared/dist/cjs/entities/user/index.d.ts > ../../shared/dist/cjs/entities/user/user.interface.d.ts
3) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/handlebar-helpers/index.d.ts > ../../shared/dist/cjs/consts/handlebar-helpers/getTemplateVariables.d.ts
4) ../../shared/dist/cjs/dto/index.d.ts > ../../shared/dist/cjs/dto/events/index.d.ts > ../../shared/dist/cjs/dto/events/event.interface.d.ts > ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/entities/message-template/index.d.ts > ../../shared/dist/cjs/entities/message-template/message-template.interface.d.ts
5) ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/entities/message-template/index.d.ts > ../../shared/dist/cjs/entities/message-template/message-template.interface.d.ts
6) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/entities/message-template/index.d.ts > ../../shared/dist/cjs/entities/message-template/message-template.interface.d.ts
7) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/entities/step/index.d.ts
8) ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/entities/subscriber-preference/index.d.ts > ../../shared/dist/cjs/entities/subscriber-preference/subscriber-preference.interface.d.ts
9) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/entities/subscriber-preference/index.d.ts > ../../shared/dist/cjs/entities/subscriber-preference/subscriber-preference.interface.d.ts
10) ../../shared/dist/cjs/clients/index.d.ts > ../../shared/dist/cjs/clients/workflows-client.d.ts > ../../shared/dist/cjs/dto/index.d.ts > ../../shared/dist/cjs/dto/events/index.d.ts > ../../shared/dist/cjs/dto/events/event.interface.d.ts > ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts
11) ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts
12) ../../shared/dist/cjs/dto/index.d.ts > ../../shared/dist/cjs/dto/events/index.d.ts > ../../shared/dist/cjs/dto/events/event.interface.d.ts > ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts
13) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/environment/index.d.ts > ../../shared/dist/cjs/entities/environment/environment.interface.d.ts
14) ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/job/index.d.ts > ../../shared/dist/cjs/entities/job/job.interface.d.ts
15) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/job/index.d.ts > ../../shared/dist/cjs/entities/job/job.interface.d.ts
16) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/layout/index.d.ts > ../../shared/dist/cjs/entities/layout/layout.interface.d.ts
17) ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts
18) ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts
19) ../../shared/dist/cjs/dto/index.d.ts > ../../shared/dist/cjs/dto/events/index.d.ts > ../../shared/dist/cjs/dto/events/event.interface.d.ts > ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/organization/index.d.ts > ../../shared/dist/cjs/entities/organization/organization.interface.d.ts
20) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/organization/index.d.ts > ../../shared/dist/cjs/entities/organization/organization.interface.d.ts
21) ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/subscriber/index.d.ts > ../../shared/dist/cjs/entities/subscriber/subscriber.interface.d.ts
22) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/subscriber/index.d.ts > ../../shared/dist/cjs/entities/subscriber/subscriber.interface.d.ts
23) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/tenant/index.d.ts > ../../shared/dist/cjs/entities/tenant/tenant.interface.d.ts
24) ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/workflow-override/index.d.ts > ../../shared/dist/cjs/entities/workflow-override/workflow-override.interface.d.ts
25) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/entities/workflow-override/index.d.ts > ../../shared/dist/cjs/entities/workflow-override/workflow-override.interface.d.ts
26) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts
27) ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/utils/index.d.ts > ../../shared/dist/cjs/utils/bridge.utils.d.ts
28) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/utils/index.d.ts > ../../shared/dist/cjs/utils/bridge.utils.d.ts
29) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/utils/index.d.ts > ../../shared/dist/cjs/utils/buildWorkflowPreferences.d.ts
30) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts > ../../shared/dist/cjs/index.d.ts > ../../shared/dist/cjs/utils/index.d.ts > ../../shared/dist/cjs/utils/checkIsResponseError.d.ts
31) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts > ../../shared/dist/cjs/entities/notification-template/index.d.ts > ../../shared/dist/cjs/entities/notification-template/notification-template.interface.d.ts
32) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/index.d.ts > ../../shared/dist/cjs/consts/notification-item-buttons/notificationItemButton.d.ts > ../../shared/dist/cjs/entities/messages/index.d.ts > ../../shared/dist/cjs/entities/messages/messages.interface.d.ts
33) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/preferences/index.d.ts > ../../shared/dist/cjs/consts/preferences/preferences.const.d.ts
34) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/productFeatureEnabledForServiceLevel.d.ts
35) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/providers/index.d.ts > ../../shared/dist/cjs/consts/providers/credentials/index.d.ts > ../../shared/dist/cjs/consts/providers/credentials/provider-credentials.d.ts > ../../shared/dist/cjs/consts/providers/provider.interface.d.ts
36) ../../shared/dist/cjs/types/index.d.ts > ../../shared/dist/cjs/types/subscriber/index.d.ts > ../../shared/dist/cjs/consts/index.d.ts > ../../shared/dist/cjs/consts/rate-limiting/index.d.ts > ../../shared/dist/cjs/consts/rate-limiting/apiRateLimits.d.ts
37) ../../shared/dist/cjs/dto/workflows/workflow-commons-fields.d.ts > ../../shared/dist/cjs/dto/workflows/workflow-response-dto.d.ts > ../../shared/dist/cjs/dto/workflows/create-workflow-dto.d.ts
38) ../../shared/dist/cjs/dto/workflows/update-workflow-dto.d.ts > ../../shared/dist/cjs/dto/workflows/workflow-commons-fields.d.ts > ../../shared/dist/cjs/dto/workflows/workflow-response-dto.d.ts
39) ../../shared/dist/cjs/dto/workflows/workflow-commons-fields.d.ts > ../../shared/dist/cjs/dto/workflows/workflow-response-dto.d.ts

*/
export const checkIsResponseError = (err: unknown): err is IResponseError => {
return !!err && typeof err === 'object' && 'error' in err && 'message' in err && 'statusCode' in err;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SokratisVidros I have duplicated this from @novu/shared to resolve the error reported here in Discord and elsewhere when using Framework in Remix & NextJS. Enums may be an issue but this could resolve it.

Copy link
Collaborator

@rifont rifont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @paulwer , thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature: @novu/framework Integration with class-validator
3 participants