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

fix(sdk): expose getIntegration() #3080

Merged
merged 5 commits into from
Dec 3, 2024

Conversation

bodinsamuel
Copy link
Collaborator

Changes

  • Expose getIntegration() in the SDK
    The shape of the response is determined by the include, which is maybe a bad idea I never know. On one hand it's pretty standard, on the other it makes caching and types hard :\

@bodinsamuel bodinsamuel requested a review from a team November 28, 2024 15:29
Copy link
Contributor

@nalanj nalanj left a comment

Choose a reason for hiding this comment

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

Looks good!

>();
private memoizedIntegration: GetPublicIntegration['Success']['data'] | undefined;
private memoizedConnections = new Map<string, { connection: Connection; timestamp: number }>();
private memoizedIntegration = new Map<string, { integration: GetPublicIntegration['Success']['data']; timestamp: number }>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious here - what's the use case around needing to access any multiple integrations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not the case here, the key is the sum of query params which can change the shape so it's going to store different shape of the same integration depending on the params. Not ideal (cf PR desc)

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe this explaination should be in a comment. I am sure in 3 months I am gonna have forgotten why

/**
* Get current integration
*/
public async getIntegration(queries?: GetPublicIntegration['Querystring']): Promise<GetPublicIntegration['Success']['data']> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just an aside: rather than sync providers.yaml it feels like we could just pull this data at runtime for each job and not have to load the whole providers file that way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep agreed, there is a lot to improve regarding the task payload

@bodinsamuel
Copy link
Collaborator Author

@TBonnin Haven't had the chance to get a review, I'll go ahead and merge but feel free to add comments after

@bodinsamuel bodinsamuel merged commit 7adb8de into master Dec 3, 2024
21 checks passed
@bodinsamuel bodinsamuel deleted the sam/24_11_28/feat/expose-get-integration-in-sdk branch December 3, 2024 09:40
bodinsamuel added a commit that referenced this pull request Dec 3, 2024
## Changes

- Automatically log http calls to API
While doing #3080 I noticed we don't log calls to our own API which can
lead to confusion when you expect something to happen but don't manually
log the result. Thanks to recent change, we now have a way to plug into
axios and just listen to requests.
It will log everything (i.e: triggerAction, getConnection,
getIntegration, etc.), except proxy which doesn't go through
node-client.

NB: This will for sure increase the log amount but just slightly since
we do cache a lot.

![Screenshot 2024-11-28 at 16 11
02](https://github.com/user-attachments/assets/208e2ae2-fa4b-4c8e-97e7-1f924a38f5ce)
Copy link
Collaborator

@TBonnin TBonnin left a comment

Choose a reason for hiding this comment

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

Sorry. I reviewed it yesterday but forgot to submit it. :(

>();
private memoizedIntegration: GetPublicIntegration['Success']['data'] | undefined;
private memoizedConnections = new Map<string, { connection: Connection; timestamp: number }>();
private memoizedIntegration = new Map<string, { integration: GetPublicIntegration['Success']['data']; timestamp: number }>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe this explaination should be in a comment. I am sure in 3 months I am gonna have forgotten why

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.

3 participants