-
Notifications
You must be signed in to change notification settings - Fork 44.7k
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
refactor(backend): Move credentials storage to prisma user #8283
Merged
Merged
Changes from all commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
27c62a1
feat(frontend,backend): testing
ntindle 4293a70
feat: testing
ntindle b4d2935
feat(backend): it works for reading email
ntindle 9e15497
feat(backend): more docs on google
ntindle f079983
fix(frontend,backend): formatting
ntindle 59d8ccd
feat(backend): more logigin (i know this should be debug)
ntindle ac8e99b
feat(backend): make real the default scopes
ntindle 95d6c28
feat(backend): tests and linting
ntindle fc6084c
fix: code review prep
ntindle 59f0094
feat: sheets block
ntindle 5be1ce0
feat: liniting
ntindle 81d1052
Update route.ts
ntindle b01da5a
Update autogpt_platform/backend/backend/integrations/oauth/google.py
ntindle 25c5206
Update autogpt_platform/backend/backend/server/routers/integrations.py
ntindle 392cf7a
fix: revert opener change
ntindle fac9a53
feat(frontend): add back opener
ntindle b5dded0
feat(frontend): drop typing list import from gmail
ntindle 56cabd9
fix: code review comments
ntindle b6f17dc
feat: code review changes
ntindle 5ec1206
feat: code review changes
ntindle 7491b6a
fix(backend): move from asserts to checks so they don't get optimized…
ntindle 58324a7
fix(backend): code review changes
ntindle 3ec0aa5
fix(backend): remove google specific check
ntindle 9484a4e
fix: add typing
ntindle af1ef1a
fix: only enable google blocks when oauth is configured for google
ntindle 65de432
fix: errors are real and valid outputs always when output
ntindle 2004d80
fix(backend): add provider detail for debuging scope declines
ntindle 3ebc7dd
Update autogpt_platform/frontend/src/components/integrations/credenti…
ntindle 0da12a8
fix(frontend): enhance with comment, typeof error isn't known so this…
ntindle d43c944
feat: code review change requests
ntindle 432ea92
fix: linting
ntindle 572e1b0
fix: reduce error catching
ntindle c629cc6
fix: doc messages in code
ntindle 954c12f
fix: check the correct scopes object :smile:
ntindle b1b8354
fix: remove double (and not needed) try catch
ntindle 3cd1b58
fix: lint
ntindle 02458f1
Merge branch 'master' into add-gmail
ntindle 42deeee
fix: scopes
ntindle 23e395b
feat: handle the default scopes better
ntindle b521c63
feat: better email objectification
ntindle 101e9f4
feat: process attachements
ntindle 5d66689
fix: lint
ntindle bd78850
Update google.py
ntindle 8d3f453
Update autogpt_platform/backend/backend/data/block.py
ntindle 7eaa7b8
fix: quit trying and except failure
ntindle 59ba400
Merge branch 'add-gmail' of https://github.com/Significant-Gravitas/A…
ntindle e4c4bb8
Update autogpt_platform/backend/backend/server/routers/integrations.py
ntindle 39a99e3
Merge branch 'add-gmail' of https://github.com/Significant-Gravitas/A…
ntindle 9ca4e1e
feat: don't allow expired states
ntindle 2629daf
fix: clarify function name and purpose
ntindle b4f26d7
feat: code links updates
ntindle b332d3f
feat: additional docs on adding a block
ntindle 60e295e
fix: type hint missing which means the block won't work
ntindle ec63197
fix: linting
ntindle cf0804d
fix: docs formatting
ntindle 154b033
Merge branch 'master' into oauth-docs-updates
ntindle 9cb1b0f
Update issues.py
ntindle 1cdf524
fix: improve the naming
ntindle 0ce1d88
fix: formatting
ntindle 8d0148f
Update new_blocks.md
ntindle fbb64d1
Update new_blocks.md
ntindle 4a30f72
feat: better docs on what the args mean
ntindle 5517708
feat: more details on yield
ntindle 868aea8
Update new_blocks.md
ntindle 4bbb368
Merge branch 'master' into oauth-docs-updates
majdyz 44cb3dc
Merge branch 'master' into oauth-docs-updates
ntindle 9eb55a8
fix: remove ignore from docs build
ntindle 1991556
feat: initial migration
ntindle 0c65618
feat: migration tested with supabase-> prisma data location
ntindle 66d8299
Merge branch 'master' into move-oauth-to-prisma-user
ntindle 4ff1487
add custom migrations and script
aarushik93 649b570
update migration command
aarushik93 9979418
formatting and linting
aarushik93 8571a89
updated migration script
aarushik93 63f3394
add direct db url
aarushik93 31b3349
add find files
aarushik93 6b39f21
rename
aarushik93 2bebc14
use binary instead of source
aarushik93 58a62c4
Merge branch 'master' into move-oauth-to-prisma-user
ntindle 29352e8
temp adding supabase
aarushik93 818fde0
remove unused functions
aarushik93 55a085c
Merge branch 'dev' into move-oauth-to-prisma-user
ntindle 62134f4
adding missed merge
ntindle 8ee37d4
fix: commit hash for lock
ntindle f04f328
ci: fix lint
ntindle 8c0dd41
fix: minor bugs that prevented connecting and migrating to dbs and auth
ntindle ce3df9f
fix: linting
ntindle b008a53
fix: missed await
ntindle 83fda8c
Merge branch 'dev' into move-oauth-to-prisma-user
majdyz 9c07633
fix(backend): phase one pr updates
ntindle b624510
fix: handle error with returning user object from database_manager
ntindle b854e16
fix: linting
ntindle b776fb1
Merge branch 'dev' into move-oauth-to-prisma-user
ntindle fce9e01
Address comments
majdyz 70cbe29
Make the migration safe
majdyz 65f6371
Update migration doc
majdyz 802f597
Move misplaced model functions
majdyz 94dcfde
Grammar
majdyz 5a8c097
Revert lock
majdyz 2c596e1
Remove irrelevant changes
majdyz 0779b3e
Remove irrelevant changes
majdyz d6346cf
Merge branch 'dev' into move-oauth-to-prisma-user
aarushik93 fbaa723
Avoid adding trigger on public schema
majdyz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,10 @@ | |
from redis.lock import Lock as RedisLock | ||
|
||
from backend.data import redis | ||
from backend.executor.database import DatabaseManager | ||
from backend.integrations.oauth import HANDLERS_BY_NAME, BaseOAuthHandler | ||
from backend.util.settings import Settings | ||
|
||
from ..server.integrations.utils import get_supabase | ||
|
||
logger = logging.getLogger(__name__) | ||
settings = Settings() | ||
|
||
|
@@ -51,10 +50,12 @@ class IntegrationCredentialsManager: | |
cause so much latency that it's worth implementing. | ||
""" | ||
|
||
def __init__(self): | ||
def __init__(self, db_manager: DatabaseManager): | ||
redis_conn = redis.get_redis() | ||
self._locks = RedisKeyedMutex(redis_conn) | ||
self.store = SupabaseIntegrationCredentialsStore(get_supabase(), redis_conn) | ||
self.store = SupabaseIntegrationCredentialsStore( | ||
redis=redis_conn, db=db_manager | ||
) | ||
|
||
def create(self, user_id: str, credentials: Credentials) -> None: | ||
return self.store.add_creds(user_id, credentials) | ||
|
@@ -131,7 +132,7 @@ def delete(self, user_id: str, credentials_id: str) -> None: | |
|
||
def _acquire_lock(self, user_id: str, credentials_id: str, *args: str) -> RedisLock: | ||
key = ( | ||
self.store.supabase.supabase_url, | ||
self.store.db_manager, | ||
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. Unless
|
||
f"user:{user_id}", | ||
f"credentials:{credentials_id}", | ||
*args, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
See https://github.com/Significant-Gravitas/AutoGPT/pull/8283/files#r1827924084