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

Update the integration-factory to take advantage of/utilize the new methods for the integration-base. #345

Open
wants to merge 1 commit into
base: update-integration-base-to-v2
Choose a base branch
from

Conversation

seanspeaks
Copy link
Contributor

@seanspeaks seanspeaks commented Oct 17, 2024

Add entityReference to Integration Model and Update Integration Factory

Add the entityReference field to the Integration Model and update the Integration Factory to support name-based module references. This enhancement allows developers to import the same API module multiple times with different intended purposes, such as slack-admin and slack-user.

Key changes:

  • Add entityReference field to the Integration Model schema
  • Update getInstanceFromIntegrationId method in Integration Factory to handle entityReference
  • Implement getModuleTypesAndKeys method to map module types to keys
  • Improve error handling for duplicate module types
  • Update module loading logic to support both entityReference and default behavior

This update provides more flexibility in integration configurations and should be paired with other integration-related updates for full functionality.

…ethods for the integration-base.

Add the entityReference used by the integration-factory and any new itnegrations added, which allows for name-based module reference. This allows for the developer importing the same api module multiple times but with different intended purpose. Example: slack-admin and slack-user. There may be other use cases as well.

This likely should be paired with a few other integration-related updates.
Copy link

sonarcloud bot commented Oct 17, 2024

Comment on lines +123 to +124
integrationRecord.entityReference &&
Object.keys(integrationRecord.entityReference) > 0
Copy link

Choose a reason for hiding this comment

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

The condition to check if entityReference has any keys is incorrect. It should be:

Object.keys(integrationRecord.entityReference).length > 0

This ensures that the length of the keys array is greater than zero, properly verifying the presence of keys in the entityReference object. The current implementation will always evaluate to false as it's comparing a number (the result of Object.keys()) directly to zero, which is not the intended logic.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@seanspeaks seanspeaks mentioned this pull request Oct 17, 2024
2 tasks
@seanspeaks seanspeaks marked this pull request as ready for review October 17, 2024 03:36
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.

1 participant