-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Only fetch actions available to an entity during schema validation #1095
base: master
Are you sure you want to change the base?
Changes from 13 commits
9fe5466
3fda8b6
e71c298
5af820b
2a33873
20ca66c
3848355
590f9e8
fefebc2
301a07d
bc5ba62
e193bfd
419aa66
5722fd9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1659,7 +1659,9 @@ def _validate_connection_ids( | |||||||||||||||||||||
return valid | ||||||||||||||||||||||
raise InvalidConnectedAccount(f"Invalid connected accounts found: {invalid}") | ||||||||||||||||||||||
|
||||||||||||||||||||||
def check_connected_account(self, action: ActionType) -> None: | ||||||||||||||||||||||
def check_connected_account( | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new parameter |
||||||||||||||||||||||
self, action: ActionType, entity_id: t.Optional[str] = None | ||||||||||||||||||||||
) -> None: | ||||||||||||||||||||||
"""Check if connected account is required and if required it exists or not.""" | ||||||||||||||||||||||
action = Action(action) | ||||||||||||||||||||||
if action.no_auth or action.is_runtime: | ||||||||||||||||||||||
|
@@ -1677,6 +1679,7 @@ def check_connected_account(self, action: ActionType) -> None: | |||||||||||||||||||||
if action.app not in [ | ||||||||||||||||||||||
connection.appUniqueId.upper() # Normalize app names/ids coming from API | ||||||||||||||||||||||
for connection in self._connected_accounts | ||||||||||||||||||||||
if connection.clientUniqueUserId == entity_id | ||||||||||||||||||||||
Devanshusisodiya marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
]: | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 📝 Committable Code Suggestion
Suggested change
|
||||||||||||||||||||||
raise ConnectedAccountNotFoundError( | ||||||||||||||||||||||
f"No connected account found for app `{action.app}`; " | ||||||||||||||||||||||
|
@@ -1790,7 +1793,7 @@ def _execute_remote( | |||||||||||||||||||||
action=action | ||||||||||||||||||||||
) | ||||||||||||||||||||||
if auth is None: | ||||||||||||||||||||||
self.check_connected_account(action=action) | ||||||||||||||||||||||
self.check_connected_account(action=action, entity_id=entity_id) | ||||||||||||||||||||||
|
||||||||||||||||||||||
output = self.client.get_entity( # pylint: disable=protected-access | ||||||||||||||||||||||
id=entity_id | ||||||||||||||||||||||
|
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.
Refactor: The change from an optional
entityId
to a default value ofDEFAULT_ENTITY_ID
enhances consistency across the codebase. This aligns with thecheck_connected_account
function, which now expects anentity_id
parameter. This change ensures logical consistency and reduces potential errors related to missingentityId
values.