-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(root): Replace shortid with nanoid #7720
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
commit: |
@@ -149,7 +149,7 @@ export class CreateIntegration { | |||
const defaultName = | |||
providers.find((provider) => provider.id === command.providerId)?.displayName ?? providerIdCapitalized; | |||
const name = command.name ?? defaultName; | |||
const identifier = command.identifier ?? `${slugify(name)}-${shortid.generate()}`; | |||
const identifier = command.identifier ?? `${slugify(name)}-${nanoid()}`; |
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.
Maybe we need a longer id here as the default length is 4.
✅ Deploy Preview for dashboard-v2-novu-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -94,7 +94,6 @@ | |||
"rrule": "^2.7.2", | |||
"rxjs": "7.8.1", | |||
"sanitize-html": "^2.4.0", | |||
"shortid": "^2.2.16", |
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.
👏
@@ -62,7 +62,7 @@ export class IntegrationService { | |||
channel, | |||
credentials: {}, | |||
active, | |||
identifier: `${slugify(name)}-${shortid.generate()}`, | |||
identifier: `${slugify(name)}-${nanoid()}`, |
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.
identifier: `${slugify(name)}-${nanoid()}`, | |
identifier: `${slugify(name)}-${shortId()}`, |
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.
please reuse the short Id from application-generic, so we will have the same alphabet even in tests
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.
preferably will be to create eslint to prevent imports from nanoid
@@ -149,7 +149,7 @@ export class CreateIntegration { | |||
const defaultName = | |||
providers.find((provider) => provider.id === command.providerId)?.displayName ?? providerIdCapitalized; | |||
const name = command.name ?? defaultName; | |||
const identifier = command.identifier ?? `${slugify(name)}-${shortid.generate()}`; | |||
const identifier = command.identifier ?? `${slugify(name)}-${nanoid()}`; |
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.
const identifier = command.identifier ?? `${slugify(name)}-${nanoid()}`; | |
const identifier = command.identifier ?? `${slugify(name)}-${shortId()}`; |
the default is length of 21
FYI for the future workflow and steps short id we had length of 6 #7029
regardless please use shortId from libs/application-generic/src/utils/generate-id.ts
so we will have the same alphabet on our identifiers.
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.
Looks good to me, we just need to update the last place to use the internal shortId func
59a7874
to
3cc8299
Compare
@djabarovgeorge All comments have been addressed. Please take another look. |
3cc8299
to
ad585e6
Compare
@@ -149,7 +149,7 @@ export class CreateIntegration { | |||
const defaultName = | |||
providers.find((provider) => provider.id === command.providerId)?.displayName ?? providerIdCapitalized; | |||
const name = command.name ?? defaultName; | |||
const identifier = command.identifier ?? `${slugify(name)}-${shortid.generate()}`; | |||
const identifier = command.identifier ?? `${slugify(name)}-${shortId()}`; |
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.
before, we used shortId, which generated ids 7+ characters long
do we want to increase the length here as well?
reasons:
- to align with old ids.
- for future multi-tenancy support, which may require a larger identifier.
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.
looks good, please check the last 2 comments that left.
Shortid is deprecated and marked as unsafe
ad585e6
to
a6472cd
Compare
What changed? Why was the change needed?
Shortid is deprecated and marked as unsafe. https://www.npmjs.com/package/shortid
See also https://github.com/novuhq/packages-enterprise/pull/267