diff --git a/src/auth/src/supabase_auth/__init__.py b/src/auth/src/supabase_auth/__init__.py index baac9472..69d2112c 100644 --- a/src/auth/src/supabase_auth/__init__.py +++ b/src/auth/src/supabase_auth/__init__.py @@ -1,296 +1,241 @@ from __future__ import annotations -from .admin_api import AsyncSupabaseAuthAdmin as AsyncSupabaseAuthAdmin -from .admin_api import SyncSupabaseAuthAdmin as SyncSupabaseAuthAdmin -from .client import AsyncSupabaseAuthClient as AsyncSupabaseAuthClient -from .client import SyncSupabaseAuthClient as SyncSupabaseAuthClient -from .session import AsyncMemoryStorage as AsyncMemoryStorage -from .session import AsyncSupportedStorage as AsyncSupportedStorage -from .session import SyncMemoryStorage as SyncMemoryStorage -from .session import SyncSupportedStorage as SyncSupportedStorage -from .types import ( - JWK as JWK, -) -from .types import ( - AdminUserAttributes as AdminUserAttributes, -) -from .types import ( - AMREntry as AMREntry, -) -from .types import ( - AMREntryDict as AMREntryDict, -) -from .types import ( - AuthChangeEvent as AuthChangeEvent, -) -from .types import ( - AuthChangeEventMFA as AuthChangeEventMFA, -) -from .types import ( - AuthenticatorAssuranceLevels as AuthenticatorAssuranceLevels, -) -from .types import ( - AuthFlowType as AuthFlowType, -) -from .types import ( - AuthMFAAdminDeleteFactorResponse as AuthMFAAdminDeleteFactorResponse, -) -from .types import ( - AuthMFAAdminListFactorsResponse as AuthMFAAdminListFactorsResponse, -) -from .types import ( - AuthMFAAdminListFactorsResponseParser as AuthMFAAdminListFactorsResponseParser, -) -from .types import ( - AuthMFAChallengeResponse as AuthMFAChallengeResponse, -) -from .types import ( - AuthMFAEnrollResponse as AuthMFAEnrollResponse, -) -from .types import ( - AuthMFAEnrollResponseTotp as AuthMFAEnrollResponseTotp, -) -from .types import ( - AuthMFAGetAuthenticatorAssuranceLevelResponse as AuthMFAGetAuthenticatorAssuranceLevelResponse, -) -from .types import ( - AuthMFAListFactorsResponse as AuthMFAListFactorsResponse, -) -from .types import ( - AuthMFAUnenrollResponse as AuthMFAUnenrollResponse, -) -from .types import ( - AuthMFAVerifyResponse as AuthMFAVerifyResponse, -) -from .types import ( - AuthOtpResponse as AuthOtpResponse, -) -from .types import ( - AuthResponse as AuthResponse, -) -from .types import ( - CaptchaToken as CaptchaToken, -) -from .types import ( - ClaimsResponse as ClaimsResponse, -) -from .types import ( - CreateOAuthClientParams as CreateOAuthClientParams, -) -from .types import ( - EmailOtpType as EmailOtpType, -) -from .types import ( - Factor as Factor, -) -from .types import ( - GenerateLinkBody as GenerateLinkBody, -) -from .types import ( - GenerateLinkParams as GenerateLinkParams, -) -from .types import ( - GenerateLinkProperties as GenerateLinkProperties, -) -from .types import ( - GenerateLinkResponse as GenerateLinkResponse, -) -from .types import ( - GenerateLinkType as GenerateLinkType, -) -from .types import ( - IdentitiesResponse as IdentitiesResponse, -) -from .types import ( - JWKSet as JWKSet, -) -from .types import ( - JWTHeader as JWTHeader, -) -from .types import ( - JWTPayload as JWTPayload, -) -from .types import ( - LinkIdentityResponse as LinkIdentityResponse, -) -from .types import ( - MFAEnroll as MFAEnroll, -) -from .types import ( - MFAEnrollParams as MFAEnrollParams, -) -from .types import ( - MFAEnrollPhoneParams as MFAEnrollPhoneParams, -) -from .types import ( - MFAEnrollTOTPParams as MFAEnrollTOTPParams, -) -from .types import ( - OAuthClient as OAuthClient, -) -from .types import ( - OAuthClientGrantType as OAuthClientGrantType, -) -from .types import ( - OAuthClientListResponse as OAuthClientListResponse, -) -from .types import ( - OAuthClientRegistrationType as OAuthClientRegistrationType, -) -from .types import ( - OAuthClientResponse as OAuthClientResponse, -) -from .types import ( - OAuthClientResponseType as OAuthClientResponseType, -) -from .types import ( - OAuthClientTokenEndpointAuthMethod as OAuthClientTokenEndpointAuthMethod, -) -from .types import ( - OAuthClientType as OAuthClientType, -) -from .types import ( - OAuthResponse as OAuthResponse, -) -from .types import ( - Pagination as Pagination, -) -from .types import ( - Provider as Provider, -) -from .types import ( - Resend as Resend, -) -from .types import ( - ResendCredentials as ResendCredentials, -) -from .types import ( - ResendEmailBody as ResendEmailBody, -) -from .types import ( - ResendEmailCredentials as ResendEmailCredentials, -) -from .types import ( - ResendPhoneBody as ResendPhoneBody, -) -from .types import ( - ResendPhoneCredentials as ResendPhoneCredentials, -) -from .types import ( - Session as Session, -) -from .types import ( - SignInWithEmailAndPasswordCredentials as SignInWithEmailAndPasswordCredentials, -) -from .types import ( - SignInWithEmailAndPasswordlessBody as SignInWithEmailAndPasswordlessBody, -) -from .types import ( - SignInWithEmailAndPasswordlessCredentials as SignInWithEmailAndPasswordlessCredentials, -) -from .types import ( - SignInWithPassword as SignInWithPassword, -) -from .types import ( - SignInWithPasswordCredentials as SignInWithPasswordCredentials, -) -from .types import ( - SignInWithPasswordless as SignInWithPasswordless, -) -from .types import ( - SignInWithPasswordlessCredentials as SignInWithPasswordlessCredentials, -) -from .types import ( - SignInWithPhoneAndPasswordCredentials as SignInWithPhoneAndPasswordCredentials, -) -from .types import ( - SignInWithPhoneAndPasswordlessBody as SignInWithPhoneAndPasswordlessBody, -) -from .types import ( - SignInWithPhoneAndPasswordlessCredentials as SignInWithPhoneAndPasswordlessCredentials, -) -from .types import ( - SignInWithSSO as SignInWithSSO, -) -from .types import ( - SignInWithSSOCredentials as SignInWithSSOCredentials, -) -from .types import ( - SignInWithSSODomain as SignInWithSSODomain, -) -from .types import ( - SignInWithSSOProvider as SignInWithSSOProvider, -) -from .types import ( - SignOutScope as SignOutScope, -) -from .types import ( - SignUpWithEmailAndPasswordBody as SignUpWithEmailAndPasswordBody, -) -from .types import ( - SignUpWithEmailAndPasswordCredentials as SignUpWithEmailAndPasswordCredentials, -) -from .types import ( - SignUpWithPassword as SignUpWithPassword, -) -from .types import ( - SignUpWithPasswordCredentials as SignUpWithPasswordCredentials, -) -from .types import ( - SignUpWithPhoneAndPasswordBody as SignUpWithPhoneAndPasswordBody, -) -from .types import ( - SignUpWithPhoneAndPasswordCredentials as SignUpWithPhoneAndPasswordCredentials, -) -from .types import ( - SSOResponse as SSOResponse, -) -from .types import ( - Subscription as Subscription, -) -from .types import ( - UpdateOAuthClientParams as UpdateOAuthClientParams, -) -from .types import ( - User as User, -) -from .types import ( - UserAttributes as UserAttributes, -) -from .types import ( - UserIdentity as UserIdentity, -) -from .types import ( - UserList as UserList, -) -from .types import ( - UserResponse as UserResponse, -) -from .types import ( - VerifyEmailOtpBody as VerifyEmailOtpBody, -) -from .types import ( - VerifyEmailOtpParams as VerifyEmailOtpParams, -) -from .types import ( - VerifyMobileOtpBody as VerifyMobileOtpBody, -) -from .types import ( - VerifyMobileOtpParams as VerifyMobileOtpParams, -) -from .types import ( - VerifyOtp as VerifyOtp, -) -from .types import ( - VerifyOtpParams as VerifyOtpParams, -) -from .types import ( - VerifyTokenHashBody as VerifyTokenHashBody, -) -from .types import ( - VerifyTokenHashParams as VerifyTokenHashParams, -) -from .types import ( - WithCaptchaToken as WithCaptchaToken, -) -from .version import __version__ as __version__ +from .admin_api import AsyncSupabaseAuthAdmin, SyncSupabaseAuthAdmin +from .client import AsyncSupabaseAuthClient, SyncSupabaseAuthClient +from .errors import ( + AuthApiError, + AuthError, + AuthImplicitGrantRedirectError, + AuthInvalidCredentialsError, + AuthInvalidJwtError, + AuthRetryableError, + AuthSessionMissingError, + AuthUnknownError, + AuthWeakPasswordError, + CustomAuthError, + ErrorCode, + UserDoesntExist, +) +from .session import ( + AsyncMemoryStorage, + AsyncSupportedStorage, + SyncMemoryStorage, + SyncSupportedStorage, +) +from .types import ( + JWK, + AdminUserAttributes, + AMREntry, + AMREntryDict, + AuthChangeEvent, + AuthChangeEventMFA, + AuthenticatorAssuranceLevels, + AuthFlowType, + AuthMFAAdminDeleteFactorResponse, + AuthMFAAdminListFactorsResponse, + AuthMFAAdminListFactorsResponseParser, + AuthMFAChallengeResponse, + AuthMFAEnrollResponse, + AuthMFAEnrollResponseTotp, + AuthMFAGetAuthenticatorAssuranceLevelResponse, + AuthMFAListFactorsResponse, + AuthMFAUnenrollResponse, + AuthMFAVerifyResponse, + AuthOtpResponse, + AuthResponse, + CaptchaToken, + ClaimsResponse, + CreateOAuthClientParams, + EmailOtpType, + Factor, + GenerateLinkBody, + GenerateLinkParams, + GenerateLinkProperties, + GenerateLinkResponse, + GenerateLinkType, + IdentitiesResponse, + JWKSet, + JWTHeader, + JWTPayload, + LinkIdentityResponse, + MFAEnroll, + MFAEnrollParams, + MFAEnrollPhoneParams, + MFAEnrollTOTPParams, + OAuthClient, + OAuthClientGrantType, + OAuthClientListResponse, + OAuthClientRegistrationType, + OAuthClientResponse, + OAuthClientResponseType, + OAuthClientTokenEndpointAuthMethod, + OAuthClientType, + OAuthResponse, + Pagination, + Provider, + Resend, + ResendCredentials, + ResendEmailBody, + ResendEmailCredentials, + ResendPhoneBody, + ResendPhoneCredentials, + Session, + SignInWithEmailAndPasswordCredentials, + SignInWithEmailAndPasswordlessBody, + SignInWithEmailAndPasswordlessCredentials, + SignInWithPassword, + SignInWithPasswordCredentials, + SignInWithPasswordless, + SignInWithPasswordlessCredentials, + SignInWithPhoneAndPasswordCredentials, + SignInWithPhoneAndPasswordlessBody, + SignInWithPhoneAndPasswordlessCredentials, + SignInWithSSO, + SignInWithSSOCredentials, + SignInWithSSODomain, + SignInWithSSOProvider, + SignOutScope, + SignUpWithEmailAndPasswordBody, + SignUpWithEmailAndPasswordCredentials, + SignUpWithPassword, + SignUpWithPasswordCredentials, + SignUpWithPhoneAndPasswordBody, + SignUpWithPhoneAndPasswordCredentials, + SSOResponse, + Subscription, + UpdateOAuthClientParams, + User, + UserAttributes, + UserIdentity, + UserList, + UserResponse, + VerifyEmailOtpBody, + VerifyEmailOtpParams, + VerifyMobileOtpBody, + VerifyMobileOtpParams, + VerifyOtp, + VerifyOtpParams, + VerifyTokenHashBody, + VerifyTokenHashParams, + WithCaptchaToken, +) +from .version import __version__ + +__all__ = [ + "AsyncSupabaseAuthAdmin", + "SyncSupabaseAuthAdmin", + "AsyncSupabaseAuthClient", + "SyncSupabaseAuthClient", + "AuthApiError", + "AuthError", + "AuthImplicitGrantRedirectError", + "AuthInvalidCredentialsError", + "AuthInvalidJwtError", + "AuthRetryableError", + "AuthSessionMissingError", + "AuthUnknownError", + "AuthWeakPasswordError", + "CustomAuthError", + "ErrorCode", + "UserDoesntExist", + "AsyncMemoryStorage", + "AsyncSupportedStorage", + "SyncMemoryStorage", + "SyncSupportedStorage", + "JWK", + "AdminUserAttributes", + "AMREntry", + "AMREntryDict", + "AuthChangeEvent", + "AuthChangeEventMFA", + "AuthenticatorAssuranceLevels", + "AuthFlowType", + "AuthMFAAdminDeleteFactorResponse", + "AuthMFAAdminListFactorsResponse", + "AuthMFAAdminListFactorsResponseParser", + "AuthMFAChallengeResponse", + "AuthMFAEnrollResponse", + "AuthMFAEnrollResponseTotp", + "AuthMFAGetAuthenticatorAssuranceLevelResponse", + "AuthMFAListFactorsResponse", + "AuthMFAUnenrollResponse", + "AuthMFAVerifyResponse", + "AuthOtpResponse", + "AuthResponse", + "CaptchaToken", + "ClaimsResponse", + "CreateOAuthClientParams", + "EmailOtpType", + "Factor", + "GenerateLinkBody", + "GenerateLinkParams", + "GenerateLinkProperties", + "GenerateLinkResponse", + "GenerateLinkType", + "IdentitiesResponse", + "JWKSet", + "JWTHeader", + "JWTPayload", + "LinkIdentityResponse", + "MFAEnroll", + "MFAEnrollParams", + "MFAEnrollPhoneParams", + "MFAEnrollTOTPParams", + "OAuthClient", + "OAuthClientGrantType", + "OAuthClientListResponse", + "OAuthClientRegistrationType", + "OAuthClientResponse", + "OAuthClientResponseType", + "OAuthClientTokenEndpointAuthMethod", + "OAuthClientType", + "OAuthResponse", + "Pagination", + "Provider", + "Resend", + "ResendCredentials", + "ResendEmailBody", + "ResendEmailCredentials", + "ResendPhoneBody", + "ResendPhoneCredentials", + "Session", + "SignInWithEmailAndPasswordCredentials", + "SignInWithEmailAndPasswordlessBody", + "SignInWithEmailAndPasswordlessCredentials", + "SignInWithPassword", + "SignInWithPasswordCredentials", + "SignInWithPasswordless", + "SignInWithPasswordlessCredentials", + "SignInWithPhoneAndPasswordCredentials", + "SignInWithPhoneAndPasswordlessBody", + "SignInWithPhoneAndPasswordlessCredentials", + "SignInWithSSO", + "SignInWithSSOCredentials", + "SignInWithSSODomain", + "SignInWithSSOProvider", + "SignOutScope", + "SignUpWithEmailAndPasswordBody", + "SignUpWithEmailAndPasswordCredentials", + "SignUpWithPassword", + "SignUpWithPasswordCredentials", + "SignUpWithPhoneAndPasswordBody", + "SignUpWithPhoneAndPasswordCredentials", + "SSOResponse", + "Subscription", + "UpdateOAuthClientParams", + "User", + "UserAttributes", + "UserIdentity", + "UserList", + "UserResponse", + "VerifyEmailOtpBody", + "VerifyEmailOtpParams", + "VerifyMobileOtpBody", + "VerifyMobileOtpParams", + "VerifyOtp", + "VerifyOtpParams", + "VerifyTokenHashBody", + "VerifyTokenHashParams", + "WithCaptchaToken", + "__version__", +] diff --git a/src/functions/src/supabase_functions/__init__.py b/src/functions/src/supabase_functions/__init__.py index e3f578b5..3374c8ff 100644 --- a/src/functions/src/supabase_functions/__init__.py +++ b/src/functions/src/supabase_functions/__init__.py @@ -1,11 +1,23 @@ from __future__ import annotations from .client import AsyncFunctionsClient, SyncFunctionsClient, create_client +from .errors import ( + FunctionsApiErrorDict, + FunctionsError, + FunctionsHttpError, + FunctionsRelayError, +) from .utils import FunctionRegion +from .version import __version__ __all__ = [ + "__version__", "create_client", "FunctionRegion", "AsyncFunctionsClient", "SyncFunctionsClient", + "FunctionsApiErrorDict", + "FunctionsError", + "FunctionsHttpError", + "FunctionsRelayError", ] diff --git a/src/realtime/src/realtime/__init__.py b/src/realtime/src/realtime/__init__.py index 1b31cd83..402ecbf7 100644 --- a/src/realtime/src/realtime/__init__.py +++ b/src/realtime/src/realtime/__init__.py @@ -3,202 +3,144 @@ # Configure the root logger for the module logging.getLogger(__name__).addHandler(logging.NullHandler()) -from realtime.version import __version__ as __version__ +from realtime.version import __version__ -from .channel import RealtimeChannel as RealtimeChannel -from .channel import RealtimeChannelOptions as RealtimeChannelOptions -from .client import RealtimeClient as RealtimeClient -from .client import connect_once as connect_once -from .exceptions import ( - AuthorizationError as AuthorizationError, -) -from .exceptions import ( - NotConnectedError as NotConnectedError, -) -from .message import ( - AccessTokenMessage as AccessTokenMessage, -) -from .message import ( - AccessTokenPayload as AccessTokenPayload, -) -from .message import ( - BroadcastMessage as BroadcastMessage, -) -from .message import ( - ChannelCloseMessage as ChannelCloseMessage, -) -from .message import ( - ChannelErrorMessage as ChannelErrorMessage, -) -from .message import ( - ChannelLeaveMessage as ChannelLeaveMessage, -) -from .message import ( - ClientMessage as ClientMessage, -) -from .message import ( - ErrorReplyMessage as ErrorReplyMessage, -) -from .message import ( - ErrorSystemPayload as ErrorSystemPayload, -) -from .message import ( - HeartbeatMessage as HeartbeatMessage, -) -from .message import ( - HeartbeatPayload as HeartbeatPayload, -) -from .message import ( - JoinMessage as JoinMessage, -) -from .message import ( - Message as Message, -) -from .message import ( - PostgresChangesMessage as PostgresChangesMessage, -) -from .message import ( - PostgresRowChange as PostgresRowChange, -) -from .message import ( - PresenceDiffMessage as PresenceDiffMessage, -) -from .message import ( - PresenceMessage as PresenceMessage, -) -from .message import ( - PresenceStateMessage as PresenceStateMessage, -) -from .message import ( - ReplyMessage as ReplyMessage, -) -from .message import ( - ReplyPostgresChanges as ReplyPostgresChanges, -) -from .message import ( - ServerMessage as ServerMessage, -) -from .message import ( - ServerMessageAdapter as ServerMessageAdapter, -) -from .message import ( - SuccessReplyMessage as SuccessReplyMessage, -) -from .message import ( - SuccessSystemPayload as SuccessSystemPayload, -) -from .message import ( - SystemMessage as SystemMessage, -) -from .presence import RealtimePresence as RealtimePresence -from .types import ( - DEFAULT_HEARTBEAT_INTERVAL as DEFAULT_HEARTBEAT_INTERVAL, -) -from .types import ( - DEFAULT_TIMEOUT as DEFAULT_TIMEOUT, -) -from .types import ( - PHOENIX_CHANNEL as PHOENIX_CHANNEL, -) -from .types import ( - VSN as VSN, -) -from .types import ( - BroadcastMeta as BroadcastMeta, -) -from .types import ( - BroadcastPayload as BroadcastPayload, -) -from .types import ( - Callback as Callback, -) -from .types import ( - ChannelEvents as ChannelEvents, -) -from .types import ( - ChannelStates as ChannelStates, -) -from .types import ( - Payload as Payload, -) -from .types import ( - PostgresChangesBinding as PostgresChangesBinding, -) -from .types import ( - PostgresChangesBindingDict as PostgresChangesBindingDict, -) -from .types import ( - PostgresChangesColumn as PostgresChangesColumn, -) -from .types import ( - PostgresChangesData as PostgresChangesData, -) -from .types import ( - PostgresChangesPayload as PostgresChangesPayload, -) -from .types import ( - Presence as Presence, -) -from .types import ( - PresenceDiff as PresenceDiff, -) -from .types import ( - PresenceEvents as PresenceEvents, -) -from .types import ( - PresenceMeta as PresenceMeta, -) -from .types import ( - PresenceOpts as PresenceOpts, -) -from .types import ( - RawPresenceDiff as RawPresenceDiff, -) -from .types import ( - RawPresenceState as RawPresenceState, -) -from .types import ( - RawPresenceStateEntry as RawPresenceStateEntry, -) -from .types import ( - RealtimeAcknowledgementStatus as RealtimeAcknowledgementStatus, -) -from .types import ( - RealtimeChannelBroadcastConfig as RealtimeChannelBroadcastConfig, -) -from .types import ( - RealtimeChannelConfig as RealtimeChannelConfig, -) -from .types import ( - RealtimeChannelOptionsPayload as RealtimeChannelOptionsPayload, -) -from .types import ( - RealtimeChannelPresenceConfig as RealtimeChannelPresenceConfig, -) -from .types import ( - RealtimePostgresChangesListenEvent as RealtimePostgresChangesListenEvent, -) -from .types import ( - RealtimePresenceJoinPayload as RealtimePresenceJoinPayload, -) -from .types import ( - RealtimePresenceLeavePayload as RealtimePresenceLeavePayload, -) -from .types import ( - RealtimePresenceListenEvents as RealtimePresenceListenEvents, -) -from .types import ( - RealtimePresenceState as RealtimePresenceState, -) -from .types import ( - RealtimeSubscribeStates as RealtimeSubscribeStates, -) -from .types import ( - ReplayOption as ReplayOption, -) -from .types import ( - T_ParamSpec as T_ParamSpec, -) -from .types import ( - T_Retval as T_Retval, +from .channel import RealtimeChannel, RealtimeChannelOptions +from .client import RealtimeClient, connect_once +from .exceptions import AuthorizationError, NotConnectedError +from .message import ( + AccessTokenMessage, + AccessTokenPayload, + BroadcastMessage, + ChannelCloseMessage, + ChannelErrorMessage, + ChannelLeaveMessage, + ClientMessage, + ErrorReplyMessage, + ErrorSystemPayload, + HeartbeatMessage, + HeartbeatPayload, + JoinMessage, + Message, + PostgresChangesMessage, + PostgresRowChange, + PresenceDiffMessage, + PresenceMessage, + PresenceStateMessage, + ReplyMessage, + ReplyPostgresChanges, + ServerMessage, + ServerMessageAdapter, + SuccessReplyMessage, + SuccessSystemPayload, + SystemMessage, +) +from .presence import RealtimePresence +from .types import ( + DEFAULT_HEARTBEAT_INTERVAL, + DEFAULT_TIMEOUT, + PHOENIX_CHANNEL, + VSN, + BroadcastMeta, + BroadcastPayload, + Callback, + ChannelEvents, + ChannelStates, + Payload, + PostgresChangesBinding, + PostgresChangesBindingDict, + PostgresChangesColumn, + PostgresChangesData, + PostgresChangesPayload, + Presence, + PresenceDiff, + PresenceEvents, + PresenceMeta, + PresenceOpts, + RawPresenceDiff, + RawPresenceState, + RawPresenceStateEntry, + RealtimeAcknowledgementStatus, + RealtimeChannelBroadcastConfig, + RealtimeChannelConfig, + RealtimeChannelOptionsPayload, + RealtimeChannelPresenceConfig, + RealtimePostgresChangesListenEvent, + RealtimePresenceJoinPayload, + RealtimePresenceLeavePayload, + RealtimePresenceListenEvents, + RealtimePresenceState, + RealtimeSubscribeStates, + ReplayOption, ) + +__all__ = [ + "__version__", + "RealtimeChannel", + "RealtimeChannelOptions", + "RealtimeClient", + "connect_once", + "AuthorizationError", + "NotConnectedError", + "AccessTokenMessage", + "AccessTokenPayload", + "BroadcastMessage", + "ChannelCloseMessage", + "ChannelErrorMessage", + "ChannelLeaveMessage", + "ClientMessage", + "ErrorReplyMessage", + "ErrorSystemPayload", + "HeartbeatMessage", + "HeartbeatPayload", + "JoinMessage", + "Message", + "PostgresChangesMessage", + "PostgresRowChange", + "PresenceDiffMessage", + "PresenceMessage", + "PresenceStateMessage", + "ReplyMessage", + "ReplyPostgresChanges", + "ServerMessage", + "ServerMessageAdapter", + "SuccessReplyMessage", + "SuccessSystemPayload", + "SystemMessage", + "RealtimePresence", + "DEFAULT_HEARTBEAT_INTERVAL", + "DEFAULT_TIMEOUT", + "PHOENIX_CHANNEL", + "VSN", + "BroadcastMeta", + "BroadcastPayload", + "Callback", + "ChannelEvents", + "ChannelStates", + "Payload", + "PostgresChangesBinding", + "PostgresChangesBindingDict", + "PostgresChangesColumn", + "PostgresChangesData", + "PostgresChangesPayload", + "Presence", + "PresenceDiff", + "PresenceEvents", + "PresenceMeta", + "PresenceOpts", + "RawPresenceDiff", + "RawPresenceState", + "RawPresenceStateEntry", + "RealtimeAcknowledgementStatus", + "RealtimeChannelBroadcastConfig", + "RealtimeChannelConfig", + "RealtimeChannelOptionsPayload", + "RealtimeChannelPresenceConfig", + "RealtimePostgresChangesListenEvent", + "RealtimePresenceJoinPayload", + "RealtimePresenceLeavePayload", + "RealtimePresenceListenEvents", + "RealtimePresenceState", + "RealtimeSubscribeStates", + "ReplayOption", +] diff --git a/src/storage/src/storage3/__init__.py b/src/storage/src/storage3/__init__.py index 28ece260..2da2883a 100644 --- a/src/storage/src/storage3/__init__.py +++ b/src/storage/src/storage3/__init__.py @@ -1,6 +1,12 @@ from __future__ import annotations from storage3.client import AsyncStorageClient, SyncStorageClient +from storage3.exceptions import ( + StorageApiError, + StorageApiErrorMessage, + StorageException, + VectorBucketException, +) from storage3.file_api import StorageFileApiClient from storage3.version import __version__ @@ -9,4 +15,8 @@ "AsyncStorageClient", "SyncStorageClient", "StorageFileApiClient", + "StorageApiError", + "StorageApiErrorMessage", + "StorageException", + "VectorBucketException", ] diff --git a/src/supabase/src/supabase/__init__.py b/src/supabase/src/supabase/__init__.py index 8fd8ec3e..d74174f4 100644 --- a/src/supabase/src/supabase/__init__.py +++ b/src/supabase/src/supabase/__init__.py @@ -2,19 +2,22 @@ from postgrest import APIResponse as PostgrestAPIResponse from realtime import AuthorizationError, NotConnectedError from storage3 import AsyncStorageClient as ASupabaseStorageClient +from storage3 import StorageApiError, StorageException, VectorBucketException from storage3 import SyncStorageClient as SupabaseStorageClient -from storage3.exceptions import StorageException -from supabase_auth.errors import ( +from supabase_auth import ( AuthApiError, AuthError, AuthImplicitGrantRedirectError, AuthInvalidCredentialsError, + AuthInvalidJwtError, AuthRetryableError, AuthSessionMissingError, AuthUnknownError, AuthWeakPasswordError, + CustomAuthError, + UserDoesntExist, ) -from supabase_functions.errors import ( +from supabase_functions import ( FunctionsError, FunctionsHttpError, FunctionsRelayError, @@ -36,7 +39,7 @@ # Version from .version import __version__ -__all__ = ( +__all__ = [ "AClient", "ASupabaseStorageClient", "AClientOptions", @@ -47,16 +50,21 @@ "ClientOptions", "PostgrestAPIError", "PostgrestAPIResponse", + "StorageApiError", "StorageException", + "VectorBucketException", "__version__", "AuthApiError", "AuthError", "AuthImplicitGrantRedirectError", "AuthInvalidCredentialsError", + "AuthInvalidJwtError", "AuthRetryableError", "AuthSessionMissingError", "AuthWeakPasswordError", "AuthUnknownError", + "CustomAuthError", + "UserDoesntExist", "FunctionsHttpError", "FunctionsRelayError", "FunctionsError", @@ -65,4 +73,4 @@ "ASupabaseException", "AsyncSupabaseException", "SyncSupabaseException", -) +] diff --git a/src/supabase/src/supabase/client.py b/src/supabase/src/supabase/client.py index 7e839750..0329714f 100644 --- a/src/supabase/src/supabase/client.py +++ b/src/supabase/src/supabase/client.py @@ -2,21 +2,24 @@ from postgrest import APIResponse as PostgrestAPIResponse from realtime import AuthorizationError, NotConnectedError from storage3 import AsyncStorageClient as AsyncSupabaseStorageClient +from storage3 import StorageApiError, StorageException, VectorBucketException # Sync Client from storage3 import SyncStorageClient as SupabaseStorageClient -from storage3.exceptions import StorageException -from supabase_auth.errors import ( +from supabase_auth import ( AuthApiError, AuthError, AuthImplicitGrantRedirectError, AuthInvalidCredentialsError, + AuthInvalidJwtError, AuthRetryableError, AuthSessionMissingError, AuthUnknownError, AuthWeakPasswordError, + CustomAuthError, + UserDoesntExist, ) -from supabase_functions.errors import ( +from supabase_functions import ( FunctionsError, FunctionsHttpError, FunctionsRelayError, @@ -42,16 +45,21 @@ "SupabaseStorageClient", "PostgrestAPIError", "PostgrestAPIResponse", + "StorageApiError", "StorageException", + "VectorBucketException", "__version__", "AuthApiError", "AuthError", "AuthImplicitGrantRedirectError", "AuthInvalidCredentialsError", + "AuthInvalidJwtError", "AuthRetryableError", "AuthSessionMissingError", "AuthWeakPasswordError", "AuthUnknownError", + "CustomAuthError", + "UserDoesntExist", "FunctionsHttpError", "FunctionsRelayError", "FunctionsError", diff --git a/src/supabase/tests/test_exports.py b/src/supabase/tests/test_exports.py new file mode 100644 index 00000000..1a711fa6 --- /dev/null +++ b/src/supabase/tests/test_exports.py @@ -0,0 +1,78 @@ +import importlib +from types import ModuleType + +import postgrest +import pytest +import realtime +import storage3 +import supabase_auth +import supabase_functions + +import supabase +import supabase.client + +PACKAGES = [ + "postgrest", + "realtime", + "storage3", + "supabase", + "supabase.client", + "supabase_auth", + "supabase_functions", + "supabase_utils", +] + + +@pytest.mark.parametrize("name", PACKAGES) +def test_package_declares_all(name: str) -> None: + module = importlib.import_module(name) + exported = module.__dict__.get("__all__") + assert exported is not None + assert len(set(exported)) == len(exported) + for symbol in exported: + assert hasattr(module, symbol), f"{name}.{symbol}" + + +@pytest.mark.parametrize( + ("package", "names"), + [ + ( + supabase_auth, + [ + "AuthApiError", + "AuthError", + "AuthImplicitGrantRedirectError", + "AuthInvalidCredentialsError", + "AuthInvalidJwtError", + "AuthRetryableError", + "AuthSessionMissingError", + "AuthUnknownError", + "AuthWeakPasswordError", + "CustomAuthError", + "UserDoesntExist", + ], + ), + ( + storage3, + ["StorageApiError", "StorageException", "VectorBucketException"], + ), + ( + supabase_functions, + ["FunctionsError", "FunctionsHttpError", "FunctionsRelayError"], + ), + (realtime, ["AuthorizationError", "NotConnectedError"]), + ], +) +def test_errors_are_exported_from_package_and_supabase( + package: ModuleType, names: list[str] +) -> None: + for name in names: + assert name in package.__all__ + assert name in supabase.__all__ + assert getattr(supabase, name) is getattr(package, name) + assert name in supabase.client.__all__ + assert getattr(supabase.client, name) is getattr(package, name) + + +def test_postgrest_error_is_exported_from_supabase() -> None: + assert supabase.PostgrestAPIError is postgrest.APIError diff --git a/src/utils/src/supabase_utils/__init__.py b/src/utils/src/supabase_utils/__init__.py index e69de29b..c9c2ef67 100644 --- a/src/utils/src/supabase_utils/__init__.py +++ b/src/utils/src/supabase_utils/__init__.py @@ -0,0 +1 @@ +__all__: list[str] = []