supabase_auth 2.6.0__tar.gz → 2.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/PKG-INFO +4 -4
  2. supabase_auth-2.7.0/pyproject.toml +40 -0
  3. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/__init__.py +1 -2
  4. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_async/gotrue_base_api.py +3 -0
  5. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/gotrue_base_api.py +3 -0
  6. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/constants.py +10 -1
  7. supabase_auth-2.7.0/supabase_auth/errors.py +211 -0
  8. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/helpers.py +79 -4
  9. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/types.py +27 -0
  10. supabase_auth-2.7.0/supabase_auth/version.py +1 -0
  11. supabase_auth-2.6.0/pyproject.toml +0 -50
  12. supabase_auth-2.6.0/supabase_auth/errors.py +0 -115
  13. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/LICENSE +0 -0
  14. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/README.md +0 -0
  15. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_async/__init__.py +0 -0
  16. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_async/gotrue_admin_api.py +0 -0
  17. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_async/gotrue_admin_mfa_api.py +0 -0
  18. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_async/gotrue_client.py +0 -0
  19. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_async/gotrue_mfa_api.py +0 -0
  20. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_async/storage.py +0 -0
  21. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/__init__.py +0 -0
  22. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/api.py +0 -0
  23. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/client.py +0 -0
  24. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/gotrue_admin_api.py +0 -0
  25. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/gotrue_admin_mfa_api.py +0 -0
  26. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/gotrue_client.py +0 -0
  27. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/gotrue_mfa_api.py +0 -0
  28. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/_sync/storage.py +0 -0
  29. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/http_clients.py +0 -0
  30. {supabase_auth-2.6.0 → supabase_auth-2.7.0}/supabase_auth/timer.py +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supabase_auth
3
- Version: 2.6.0
3
+ Version: 2.7.0
4
4
  Summary: Python Client Library for Supabase Auth
5
- Home-page: https://github.com/supabase-community/auth-py
5
+ Home-page: https://github.com/supabase/auth-py
6
6
  License: MIT
7
7
  Author: Joel Lee
8
8
  Author-email: joel@joellee.org
@@ -17,8 +17,8 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Requires-Dist: httpx[http2] (>=0.24,<0.28)
19
19
  Requires-Dist: pydantic (>=1.10,<3)
20
- Project-URL: Documentation, https://github.com/supabase-community/auth-py
21
- Project-URL: Repository, https://github.com/supabase-community/auth-py
20
+ Project-URL: Documentation, https://github.com/supabase/auth-py
21
+ Project-URL: Repository, https://github.com/supabase/auth-py
22
22
  Description-Content-Type: text/markdown
23
23
 
24
24
  # Auth-py
@@ -0,0 +1,40 @@
1
+ [tool.poetry]
2
+ name = "supabase_auth"
3
+ version = "2.7.0" # {x-release-please-version}
4
+ description = "Python Client Library for Supabase Auth"
5
+ authors = ["Joel Lee <joel@joellee.org>"]
6
+ homepage = "https://github.com/supabase/auth-py"
7
+ repository = "https://github.com/supabase/auth-py"
8
+ documentation = "https://github.com/supabase/auth-py"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ classifiers = [
12
+ "Programming Language :: Python :: 3",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Operating System :: OS Independent"
15
+ ]
16
+
17
+ [tool.poetry.dependencies]
18
+ python = "^3.8"
19
+ httpx = {version = ">=0.24,<0.28", extras = ["http2"]}
20
+ pydantic = ">=1.10,<3"
21
+
22
+ [tool.poetry.dev-dependencies]
23
+ pytest = "^8.3.2"
24
+ flake8 = "^5.0.4"
25
+ black = "^24.4.2"
26
+ isort = "^5.12.0"
27
+ pre-commit = "^3.4.0"
28
+ pytest-cov = "^5.0.0"
29
+ pytest-depends = "^1.0.1"
30
+ pytest-asyncio = "^0.23.8"
31
+ Faker = "^27.0.0"
32
+ unasync-cli = "^0.0.9"
33
+
34
+ [tool.poetry.group.dev.dependencies]
35
+ pygithub = ">=1.57,<3.0"
36
+ respx = ">=0.20.2,<0.22.0"
37
+
38
+ [build-system]
39
+ requires = ["poetry-core>=1.0.0"]
40
+ build-backend = "poetry.core.masonry.api"
@@ -1,7 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "2.6.0"
4
-
5
3
  from ._async.gotrue_admin_api import AsyncGoTrueAdminAPI # type: ignore # noqa: F401
6
4
  from ._async.gotrue_client import AsyncGoTrueClient # type: ignore # noqa: F401
7
5
  from ._async.storage import AsyncMemoryStorage # type: ignore # noqa: F401
@@ -11,3 +9,4 @@ from ._sync.gotrue_client import SyncGoTrueClient # type: ignore # noqa: F401
11
9
  from ._sync.storage import SyncMemoryStorage # type: ignore # noqa: F401
12
10
  from ._sync.storage import SyncSupportedStorage # type: ignore # noqa: F401
13
11
  from .types import * # type: ignore # noqa: F401, F403
12
+ from .version import __version__
@@ -6,6 +6,7 @@ from httpx import Response
6
6
  from pydantic import BaseModel
7
7
  from typing_extensions import Literal, Self
8
8
 
9
+ from ..constants import API_VERSION_HEADER_NAME, API_VERSIONS
9
10
  from ..helpers import handle_exception, model_dump
10
11
  from ..http_clients import AsyncClient
11
12
 
@@ -97,6 +98,8 @@ class AsyncGoTrueBaseAPI:
97
98
  ) -> Union[T, None]:
98
99
  url = f"{self._url}/{path}"
99
100
  headers = {**self._headers, **(headers or {})}
101
+ if API_VERSION_HEADER_NAME not in headers:
102
+ headers[API_VERSION_HEADER_NAME] = API_VERSIONS["2024-01-01"].get("name")
100
103
  if "Content-Type" not in headers:
101
104
  headers["Content-Type"] = "application/json;charset=UTF-8"
102
105
  if jwt:
@@ -6,6 +6,7 @@ from httpx import Response
6
6
  from pydantic import BaseModel
7
7
  from typing_extensions import Literal, Self
8
8
 
9
+ from ..constants import API_VERSION_HEADER_NAME, API_VERSIONS
9
10
  from ..helpers import handle_exception, model_dump
10
11
  from ..http_clients import SyncClient
11
12
 
@@ -97,6 +98,8 @@ class SyncGoTrueBaseAPI:
97
98
  ) -> Union[T, None]:
98
99
  url = f"{self._url}/{path}"
99
100
  headers = {**self._headers, **(headers or {})}
101
+ if API_VERSION_HEADER_NAME not in headers:
102
+ headers[API_VERSION_HEADER_NAME] = API_VERSIONS["2024-01-01"].get("name")
100
103
  if "Content-Type" not in headers:
101
104
  headers["Content-Type"] = "application/json;charset=UTF-8"
102
105
  if jwt:
@@ -1,8 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from datetime import datetime
3
4
  from typing import Dict
4
5
 
5
- from . import __version__
6
+ from .version import __version__
6
7
 
7
8
  GOTRUE_URL = "http://localhost:9999"
8
9
  DEFAULT_HEADERS: Dict[str, str] = {
@@ -12,3 +13,11 @@ EXPIRY_MARGIN = 10 # seconds
12
13
  MAX_RETRIES = 10
13
14
  RETRY_INTERVAL = 2 # deciseconds
14
15
  STORAGE_KEY = "supabase.auth.token"
16
+
17
+ API_VERSION_HEADER_NAME = "X-Supabase-Api-Version"
18
+ API_VERSIONS = {
19
+ "2024-01-01": {
20
+ "timestamp": datetime.timestamp(datetime.strptime("2024-01-01", "%Y-%m-%d")),
21
+ "name": "2024-01-01",
22
+ },
23
+ }
@@ -0,0 +1,211 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import List, Literal, Union
4
+
5
+ from typing_extensions import TypedDict
6
+
7
+ ErrorCode = Literal[
8
+ "unexpected_failure",
9
+ "validation_failed",
10
+ "bad_json",
11
+ "email_exists",
12
+ "phone_exists",
13
+ "bad_jwt",
14
+ "not_admin",
15
+ "no_authorization",
16
+ "user_not_found",
17
+ "session_not_found",
18
+ "flow_state_not_found",
19
+ "flow_state_expired",
20
+ "signup_disabled",
21
+ "user_banned",
22
+ "provider_email_needs_verification",
23
+ "invite_not_found",
24
+ "bad_oauth_state",
25
+ "bad_oauth_callback",
26
+ "oauth_provider_not_supported",
27
+ "unexpected_audience",
28
+ "single_identity_not_deletable",
29
+ "email_conflict_identity_not_deletable",
30
+ "identity_already_exists",
31
+ "email_provider_disabled",
32
+ "phone_provider_disabled",
33
+ "too_many_enrolled_mfa_factors",
34
+ "mfa_factor_name_conflict",
35
+ "mfa_factor_not_found",
36
+ "mfa_ip_address_mismatch",
37
+ "mfa_challenge_expired",
38
+ "mfa_verification_failed",
39
+ "mfa_verification_rejected",
40
+ "insufficient_aal",
41
+ "captcha_failed",
42
+ "saml_provider_disabled",
43
+ "manual_linking_disabled",
44
+ "sms_send_failed",
45
+ "email_not_confirmed",
46
+ "phone_not_confirmed",
47
+ "reauth_nonce_missing",
48
+ "saml_relay_state_not_found",
49
+ "saml_relay_state_expired",
50
+ "saml_idp_not_found",
51
+ "saml_assertion_no_user_id",
52
+ "saml_assertion_no_email",
53
+ "user_already_exists",
54
+ "sso_provider_not_found",
55
+ "saml_metadata_fetch_failed",
56
+ "saml_idp_already_exists",
57
+ "sso_domain_already_exists",
58
+ "saml_entity_id_mismatch",
59
+ "conflict",
60
+ "provider_disabled",
61
+ "user_sso_managed",
62
+ "reauthentication_needed",
63
+ "same_password",
64
+ "reauthentication_not_valid",
65
+ "otp_expired",
66
+ "otp_disabled",
67
+ "identity_not_found",
68
+ "weak_password",
69
+ "over_request_rate_limit",
70
+ "over_email_send_rate_limit",
71
+ "over_sms_send_rate_limit",
72
+ "bad_code_verifier",
73
+ ]
74
+
75
+
76
+ class AuthError(Exception):
77
+ def __init__(self, message: str, code: ErrorCode) -> None:
78
+ Exception.__init__(self, message)
79
+ self.message = message
80
+ self.name = "AuthError"
81
+ self.code = code
82
+
83
+
84
+ class AuthApiErrorDict(TypedDict):
85
+ name: str
86
+ message: str
87
+ status: int
88
+ code: ErrorCode
89
+
90
+
91
+ class AuthApiError(AuthError):
92
+ def __init__(self, message: str, status: int, code: ErrorCode) -> None:
93
+ AuthError.__init__(self, message, code)
94
+ self.name = "AuthApiError"
95
+ self.status = status
96
+ self.code = code
97
+
98
+ def to_dict(self) -> AuthApiErrorDict:
99
+ return {
100
+ "name": self.name,
101
+ "message": self.message,
102
+ "status": self.status,
103
+ "code": self.code,
104
+ }
105
+
106
+
107
+ class AuthUnknownError(AuthError):
108
+ def __init__(self, message: str, original_error: Exception) -> None:
109
+ AuthError.__init__(self, message, None)
110
+ self.name = "AuthUnknownError"
111
+ self.original_error = original_error
112
+
113
+
114
+ class CustomAuthError(AuthError):
115
+ def __init__(self, message: str, name: str, status: int, code: ErrorCode) -> None:
116
+ AuthError.__init__(self, message, code)
117
+ self.name = name
118
+ self.status = status
119
+
120
+ def to_dict(self) -> AuthApiErrorDict:
121
+ return {
122
+ "name": self.name,
123
+ "message": self.message,
124
+ "status": self.status,
125
+ }
126
+
127
+
128
+ class AuthSessionMissingError(CustomAuthError):
129
+ def __init__(self) -> None:
130
+ CustomAuthError.__init__(
131
+ self,
132
+ "Auth session missing!",
133
+ "AuthSessionMissingError",
134
+ 400,
135
+ None,
136
+ )
137
+
138
+
139
+ class AuthInvalidCredentialsError(CustomAuthError):
140
+ def __init__(self, message: str) -> None:
141
+ CustomAuthError.__init__(
142
+ self,
143
+ message,
144
+ "AuthInvalidCredentialsError",
145
+ 400,
146
+ None,
147
+ )
148
+
149
+
150
+ class AuthImplicitGrantRedirectErrorDetails(TypedDict):
151
+ error: str
152
+ code: str
153
+
154
+
155
+ class AuthImplicitGrantRedirectErrorDict(AuthApiErrorDict):
156
+ details: Union[AuthImplicitGrantRedirectErrorDetails, None]
157
+
158
+
159
+ class AuthImplicitGrantRedirectError(CustomAuthError):
160
+ def __init__(
161
+ self,
162
+ message: str,
163
+ details: Union[AuthImplicitGrantRedirectErrorDetails, None] = None,
164
+ ) -> None:
165
+ CustomAuthError.__init__(
166
+ self,
167
+ message,
168
+ "AuthImplicitGrantRedirectError",
169
+ 500,
170
+ None,
171
+ )
172
+ self.details = details
173
+
174
+ def to_dict(self) -> AuthImplicitGrantRedirectErrorDict:
175
+ return {
176
+ "name": self.name,
177
+ "message": self.message,
178
+ "status": self.status,
179
+ "details": self.details,
180
+ }
181
+
182
+
183
+ class AuthRetryableError(CustomAuthError):
184
+ def __init__(self, message: str, status: int) -> None:
185
+ CustomAuthError.__init__(
186
+ self,
187
+ message,
188
+ "AuthRetryableError",
189
+ status,
190
+ None,
191
+ )
192
+
193
+
194
+ class AuthWeakPasswordError(CustomAuthError):
195
+ def __init__(self, message: str, status: int, reasons: List[str]) -> None:
196
+ CustomAuthError.__init__(
197
+ self,
198
+ message,
199
+ "AuthWeakPasswordError",
200
+ status,
201
+ "weak_password",
202
+ )
203
+ self.reasons = reasons
204
+
205
+ def to_dict(self) -> AuthApiErrorDict:
206
+ return {
207
+ "name": self.name,
208
+ "message": self.message,
209
+ "status": self.status,
210
+ "reasons": self.reasons,
211
+ }
@@ -2,16 +2,25 @@ from __future__ import annotations
2
2
 
3
3
  import base64
4
4
  import hashlib
5
+ import re
5
6
  import secrets
6
7
  import string
7
8
  from base64 import urlsafe_b64decode
9
+ from datetime import datetime
8
10
  from json import loads
9
11
  from typing import Any, Dict, Type, TypeVar, Union, cast
10
12
 
11
- from httpx import HTTPStatusError
13
+ from httpx import HTTPStatusError, Response
12
14
  from pydantic import BaseModel
13
15
 
14
- from .errors import AuthApiError, AuthError, AuthRetryableError, AuthUnknownError
16
+ from .constants import API_VERSION_HEADER_NAME, API_VERSIONS
17
+ from .errors import (
18
+ AuthApiError,
19
+ AuthError,
20
+ AuthRetryableError,
21
+ AuthUnknownError,
22
+ AuthWeakPasswordError,
23
+ )
15
24
  from .types import (
16
25
  AuthOtpResponse,
17
26
  AuthResponse,
@@ -114,6 +123,10 @@ def get_error_message(error: Any) -> str:
114
123
  return next((error[prop] for prop in props if filter(prop)), str(error))
115
124
 
116
125
 
126
+ def get_error_code(error: Any) -> str:
127
+ return error.get("error_code", None) if isinstance(error, dict) else None
128
+
129
+
117
130
  def looks_like_http_status_error(exception: Exception) -> bool:
118
131
  return isinstance(exception, HTTPStatusError)
119
132
 
@@ -128,8 +141,51 @@ def handle_exception(exception: Exception) -> AuthError:
128
141
  return AuthRetryableError(
129
142
  get_error_message(error), error.response.status_code
130
143
  )
131
- json = error.response.json()
132
- return AuthApiError(get_error_message(json), error.response.status_code or 500)
144
+ data = error.response.json()
145
+
146
+ error_code = None
147
+ response_api_version = parse_response_api_version(error.response)
148
+
149
+ if (
150
+ response_api_version
151
+ and datetime.timestamp(response_api_version)
152
+ >= API_VERSIONS.get("2024-01-01").get("timestamp")
153
+ and isinstance(data, dict)
154
+ and data
155
+ and isinstance(data.get("code"), str)
156
+ ):
157
+ error_code = data.get("code")
158
+ elif (
159
+ isinstance(data, dict) and data and isinstance(data.get("error_code"), str)
160
+ ):
161
+ error_code = data.get("error_code")
162
+
163
+ if error_code is None:
164
+ if (
165
+ isinstance(data, dict)
166
+ and data
167
+ and isinstance(data.get("weak_password"), dict)
168
+ and data.get("weak_password")
169
+ and isinstance(data.get("weak_password"), list)
170
+ and len(data.get("weak_password"))
171
+ ):
172
+ return AuthWeakPasswordError(
173
+ get_error_message(data),
174
+ error.response.status_code,
175
+ data.get("weak_password").get("reasons"),
176
+ )
177
+ elif error_code == "weak_password":
178
+ return AuthWeakPasswordError(
179
+ get_error_message(data),
180
+ error.response.status_code,
181
+ data.get("weak_password", {}).get("reasons", {}),
182
+ )
183
+
184
+ return AuthApiError(
185
+ get_error_message(data),
186
+ error.response.status_code or 500,
187
+ error_code,
188
+ )
133
189
  except Exception as e:
134
190
  return AuthUnknownError(get_error_message(error), e)
135
191
 
@@ -163,3 +219,22 @@ def generate_pkce_challenge(code_verifier):
163
219
  sha256_hash = hashlib.sha256(verifier_bytes).digest()
164
220
 
165
221
  return base64.urlsafe_b64encode(sha256_hash).rstrip(b"=").decode("utf-8")
222
+
223
+
224
+ API_VERSION_REGEX = r"^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$"
225
+
226
+
227
+ def parse_response_api_version(response: Response):
228
+ api_version = response.headers.get(API_VERSION_HEADER_NAME)
229
+
230
+ if not api_version:
231
+ return None
232
+
233
+ if re.search(API_VERSION_REGEX, api_version) is None:
234
+ return None
235
+
236
+ try:
237
+ dt = datetime.strptime(api_version, "%Y-%m-%d")
238
+ return dt
239
+ except Exception as e:
240
+ return None
@@ -26,14 +26,17 @@ Provider = Literal[
26
26
  "discord",
27
27
  "facebook",
28
28
  "figma",
29
+ "fly",
29
30
  "github",
30
31
  "gitlab",
31
32
  "google",
32
33
  "kakao",
33
34
  "keycloak",
34
35
  "linkedin",
36
+ "linkedin_oidc",
35
37
  "notion",
36
38
  "slack",
39
+ "slack_oidc",
37
40
  "spotify",
38
41
  "twitch",
39
42
  "twitter",
@@ -199,6 +202,7 @@ class User(BaseModel):
199
202
  recovery_sent_at: Union[datetime, None] = None
200
203
  email_change_sent_at: Union[datetime, None] = None
201
204
  new_email: Union[str, None] = None
205
+ new_phone: Union[str, None] = None
202
206
  invited_at: Union[datetime, None] = None
203
207
  action_link: Union[str, None] = None
204
208
  email: Union[str, None] = None
@@ -211,6 +215,7 @@ class User(BaseModel):
211
215
  role: Union[str, None] = None
212
216
  updated_at: Union[datetime, None] = None
213
217
  identities: Union[List[UserIdentity], None] = None
218
+ is_anonymous: bool = False
214
219
  factors: Union[List[Factor], None] = None
215
220
 
216
221
 
@@ -227,6 +232,28 @@ class AdminUserAttributes(UserAttributes, TypedDict):
227
232
  email_confirm: NotRequired[bool]
228
233
  phone_confirm: NotRequired[bool]
229
234
  ban_duration: NotRequired[Union[str, Literal["none"]]]
235
+ role: NotRequired[str]
236
+ """
237
+ The `role` claim set in the user's access token JWT.
238
+
239
+ When a user signs up, this role is set to `authenticated` by default. You should only modify the `role` if you need to provision several levels of admin access that have different permissions on individual columns in your database.
240
+
241
+ Setting this role to `service_role` is not recommended as it grants the user admin privileges.
242
+ """
243
+ password_hash: NotRequired[str]
244
+ """
245
+ The `password_hash` for the user's password.
246
+
247
+ Allows you to specify a password hash for the user. This is useful for migrating a user's password hash from another service.
248
+
249
+ Supports bcrypt and argon2 password hashes.
250
+ """
251
+ id: NotRequired[str]
252
+ """
253
+ The `id` for the user.
254
+
255
+ Allows you to overwrite the default `id` set for the user.
256
+ """
230
257
 
231
258
 
232
259
  class Subscription(BaseModel):
@@ -0,0 +1 @@
1
+ __version__ = "2.7.0" # {x-release-please-version}
@@ -1,50 +0,0 @@
1
- [tool.poetry]
2
- name = "supabase_auth"
3
- version = "2.6.0"
4
- description = "Python Client Library for Supabase Auth"
5
- authors = ["Joel Lee <joel@joellee.org>"]
6
- homepage = "https://github.com/supabase-community/auth-py"
7
- repository = "https://github.com/supabase-community/auth-py"
8
- documentation = "https://github.com/supabase-community/auth-py"
9
- readme = "README.md"
10
- license = "MIT"
11
- classifiers = [
12
- "Programming Language :: Python :: 3",
13
- "License :: OSI Approved :: MIT License",
14
- "Operating System :: OS Independent"
15
- ]
16
-
17
- [tool.poetry.dependencies]
18
- python = "^3.8"
19
- httpx = {version = ">=0.24,<0.28", extras = ["http2"]}
20
- pydantic = ">=1.10,<3"
21
-
22
- [tool.poetry.dev-dependencies]
23
- pytest = "^8.2.2"
24
- flake8 = "^5.0.4"
25
- black = "^24.4.2"
26
- isort = "^5.12.0"
27
- pre-commit = "^3.4.0"
28
- pytest-cov = "^5.0.0"
29
- pytest-depends = "^1.0.1"
30
- pytest-asyncio = "^0.23.7"
31
- Faker = "^26.0.0"
32
- unasync-cli = "^0.0.9"
33
- python-semantic-release = "^9.8.5"
34
-
35
- [tool.poetry.group.dev.dependencies]
36
- pygithub = ">=1.57,<3.0"
37
-
38
- [tool.semantic_release]
39
- version_variables = ["supabase_auth/__init__.py:__version__"]
40
- version_toml = ["pyproject.toml:tool.poetry.version"]
41
- major_on_zero = false
42
- commit_message = "chore(release): bump version to v{version}"
43
- build_command = "curl -sSL https://install.python-poetry.org | python - && export PATH=\"/github/home/.local/bin:$PATH\" && poetry install && poetry build"
44
- upload_to_vcs_release = true
45
- branch = "main"
46
- changelog_components = "semantic_release.changelog.changelog_headers,semantic_release.changelog.compare_url"
47
-
48
- [build-system]
49
- requires = ["poetry-core>=1.0.0"]
50
- build-backend = "poetry.core.masonry.api"
@@ -1,115 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Union
4
-
5
- from typing_extensions import TypedDict
6
-
7
-
8
- class AuthError(Exception):
9
- def __init__(self, message: str) -> None:
10
- Exception.__init__(self, message)
11
- self.message = message
12
- self.name = "AuthError"
13
-
14
-
15
- class AuthApiErrorDict(TypedDict):
16
- name: str
17
- message: str
18
- status: int
19
-
20
-
21
- class AuthApiError(AuthError):
22
- def __init__(self, message: str, status: int) -> None:
23
- AuthError.__init__(self, message)
24
- self.name = "AuthApiError"
25
- self.status = status
26
-
27
- def to_dict(self) -> AuthApiErrorDict:
28
- return {
29
- "name": self.name,
30
- "message": self.message,
31
- "status": self.status,
32
- }
33
-
34
-
35
- class AuthUnknownError(AuthError):
36
- def __init__(self, message: str, original_error: Exception) -> None:
37
- AuthError.__init__(self, message)
38
- self.name = "AuthUnknownError"
39
- self.original_error = original_error
40
-
41
-
42
- class CustomAuthError(AuthError):
43
- def __init__(self, message: str, name: str, status: int) -> None:
44
- AuthError.__init__(self, message)
45
- self.name = name
46
- self.status = status
47
-
48
- def to_dict(self) -> AuthApiErrorDict:
49
- return {
50
- "name": self.name,
51
- "message": self.message,
52
- "status": self.status,
53
- }
54
-
55
-
56
- class AuthSessionMissingError(CustomAuthError):
57
- def __init__(self) -> None:
58
- CustomAuthError.__init__(
59
- self,
60
- "Auth session missing!",
61
- "AuthSessionMissingError",
62
- 400,
63
- )
64
-
65
-
66
- class AuthInvalidCredentialsError(CustomAuthError):
67
- def __init__(self, message: str) -> None:
68
- CustomAuthError.__init__(
69
- self,
70
- message,
71
- "AuthInvalidCredentialsError",
72
- 400,
73
- )
74
-
75
-
76
- class AuthImplicitGrantRedirectErrorDetails(TypedDict):
77
- error: str
78
- code: str
79
-
80
-
81
- class AuthImplicitGrantRedirectErrorDict(AuthApiErrorDict):
82
- details: Union[AuthImplicitGrantRedirectErrorDetails, None]
83
-
84
-
85
- class AuthImplicitGrantRedirectError(CustomAuthError):
86
- def __init__(
87
- self,
88
- message: str,
89
- details: Union[AuthImplicitGrantRedirectErrorDetails, None] = None,
90
- ) -> None:
91
- CustomAuthError.__init__(
92
- self,
93
- message,
94
- "AuthImplicitGrantRedirectError",
95
- 500,
96
- )
97
- self.details = details
98
-
99
- def to_dict(self) -> AuthImplicitGrantRedirectErrorDict:
100
- return {
101
- "name": self.name,
102
- "message": self.message,
103
- "status": self.status,
104
- "details": self.details,
105
- }
106
-
107
-
108
- class AuthRetryableError(CustomAuthError):
109
- def __init__(self, message: str, status: int) -> None:
110
- CustomAuthError.__init__(
111
- self,
112
- message,
113
- "AuthRetryableError",
114
- status,
115
- )
File without changes
File without changes