-
Notifications
You must be signed in to change notification settings - Fork 451
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: make connectionId optional when creating a new connection #2746
Conversation
providerConfigKey: string, | ||
connectionIdOrConnectionConfig?: string | ConnectionConfig, | ||
moreConnectionConfig?: ConnectionConfig | ||
): Promise<AuthResult> { |
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.
method overload to allow passing connectionConfig
without having to specify an undefined
connectionId
? nango.create(target.integration_unique_key.value, target.connection_id.value, connectionConfig) | ||
: nango.auth(target.integration_unique_key.value, target.connection_id.value, connectionConfig); | ||
|
||
getConnection |
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.
the compiler doesn't like the dynamic index method calling (I don't know how this is called) with method overloadding. No logic has changed 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.
honestly more readable like 👌🏻
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.
It works great, tested locally by modifying the frontend 👌🏻
? nango.create(target.integration_unique_key.value, target.connection_id.value, connectionConfig) | ||
: nango.auth(target.integration_unique_key.value, target.connection_id.value, connectionConfig); | ||
|
||
getConnection |
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.
honestly more readable like 👌🏻
async verify(expectedDigest: string, id: number, ...values: string[]): Promise<boolean> { | ||
const actualDigest = await this.digest(id, ...values); | ||
async verify(expectedDigest: string, id: number, ...values: (string | undefined)[]): Promise<boolean> { | ||
const definedValues: string[] = values.flatMap((v) => (v === undefined ? [] : [v])); |
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.
filter(Boolean) would not work 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.
you are right, that should work. let me check
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.
it does work but it will require to cast to string[]
because filter doesn't change the type of values. I will leave it like it is then
11873d3
to
f88f672
Compare
## Describe your changes Making connectionId optional when creating a connection. If connectionId is not provided a uuid is generated. I haven't updated the documentation which is still relevant. I will do it once we decide not passing the connectionId is the default way. With this PR we are making it possible without promoting it yet. ## Issue ticket number and link https://linear.app/nango/issue/NAN-1747/make-connectionid-optional-when-creating-a-new-connection ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [ ] I added tests, otherwise the reason is: - [ ] I added observability, otherwise the reason is: - [ ] I added analytics, otherwise the reason is:
Describe your changes
Making connectionId optional when creating a connection. If connectionId is not provided a uuid is generated.
I haven't updated the documentation which is still relevant. I will do it once we decide not passing the connectionId is the default way. With this PR we are making it possible without promoting it yet.
Issue ticket number and link
https://linear.app/nango/issue/NAN-1747/make-connectionid-optional-when-creating-a-new-connection
Checklist before requesting a review (skip if just adding/editing APIs & templates)