Skip to content

Commit

Permalink
fix: added force paramter to some sync user mapping functions
Browse files Browse the repository at this point in the history
removed default user_context value from internal functions
  • Loading branch information
IamMayankThakur committed Nov 9, 2023
1 parent e96b961 commit 2961c44
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.16.8] - 2023-11-7

### Added

- Added `network_interceptor` to the `supertokens_config` in `init`.
- This can be used to capture/modify all the HTTP requests sent to the core.
- Solves the issue - https://github.com/supertokens/supertokens-core/issues/865

### Fixes
- The sync functions `create_user_id_mapping` and `delete_user_id_mapping` now take the `force` parameter as an optional argument, just like their async counterparts.
- Functions `get_users_oldest_first`, `get_users_newest_first`, `get_user_count`, `delete_user`, `create_user_id_mapping`, `get_user_id_mapping`, `delete_user_id_mapping` and `update_or_delete_user_id_mapping_info` now accept `user_context` as an optional argument.
- Fixed the dependencies in the example apps
- Example apps will now fetch the latest version of the frameworks
Expand Down
28 changes: 14 additions & 14 deletions supertokens_python/supertokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ async def get_user_count( # pylint: disable=no-self-use
async def delete_user( # pylint: disable=no-self-use
self,
user_id: str,
user_context: Optional[Dict[str, Any]] = None,
user_context: Optional[Dict[str, Any]],
) -> None:
querier = Querier.get_instance(None)

Expand All @@ -337,8 +337,8 @@ async def get_users( # pylint: disable=no-self-use
limit: Union[int, None],
pagination_token: Union[str, None],
include_recipe_ids: Union[None, List[str]],
query: Union[Dict[str, str], None] = None,
user_context: Optional[Dict[str, Any]] = None,
query: Union[Dict[str, str], None],
user_context: Optional[Dict[str, Any]],
) -> UsersResponse:
from supertokens_python.recipe.multitenancy.constants import DEFAULT_TENANT_ID

Expand Down Expand Up @@ -400,9 +400,9 @@ async def create_user_id_mapping( # pylint: disable=no-self-use
self,
supertokens_user_id: str,
external_user_id: str,
external_user_id_info: Optional[str] = None,
force: Optional[bool] = None,
user_context: Optional[Dict[str, Any]] = None,
external_user_id_info: Optional[str],
force: Optional[bool],
user_context: Optional[Dict[str, Any]],
) -> Union[
CreateUserIdMappingOkResult,
UnknownSupertokensUserIDError,
Expand Down Expand Up @@ -441,8 +441,8 @@ async def create_user_id_mapping( # pylint: disable=no-self-use
async def get_user_id_mapping( # pylint: disable=no-self-use
self,
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
user_context: Optional[Dict[str, Any]] = None,
user_id_type: Optional[UserIDTypes],
user_context: Optional[Dict[str, Any]],
) -> Union[GetUserIdMappingOkResult, UnknownMappingError]:
querier = Querier.get_instance(None)

Expand Down Expand Up @@ -475,9 +475,9 @@ async def get_user_id_mapping( # pylint: disable=no-self-use
async def delete_user_id_mapping( # pylint: disable=no-self-use
self,
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
force: Optional[bool] = None,
user_context: Optional[Dict[str, Any]] = None,
user_id_type: Optional[UserIDTypes],
force: Optional[bool],
user_context: Optional[Dict[str, Any]],
) -> DeleteUserIdMappingOkResult:
querier = Querier.get_instance(None)

Expand Down Expand Up @@ -507,9 +507,9 @@ async def delete_user_id_mapping( # pylint: disable=no-self-use
async def update_or_delete_user_id_mapping_info( # pylint: disable=no-self-use
self,
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
external_user_id_info: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
user_id_type: Optional[UserIDTypes],
external_user_id_info: Optional[str],
user_context: Optional[Dict[str, Any]],
) -> Union[UpdateOrDeleteUserIdMappingInfoOkResult, UnknownMappingError]:
querier = Querier.get_instance(None)

Expand Down
5 changes: 4 additions & 1 deletion supertokens_python/syncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def create_user_id_mapping(
supertokens_user_id: str,
external_user_id: str,
external_user_id_info: Optional[str] = None,
force: Optional[bool] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> Union[
CreateUserIdMappingOkResult,
Expand All @@ -101,6 +102,7 @@ def create_user_id_mapping(
supertokens_user_id,
external_user_id,
external_user_id_info,
force=force,
user_context=user_context,
)
)
Expand All @@ -121,11 +123,12 @@ def get_user_id_mapping(
def delete_user_id_mapping(
user_id: str,
user_id_type: Optional[UserIDTypes] = None,
force: Optional[bool] = None,
user_context: Optional[Dict[str, Any]] = None,
) -> DeleteUserIdMappingOkResult:
return sync(
Supertokens.get_instance().delete_user_id_mapping(
user_id, user_id_type, user_context=user_context
user_id, user_id_type, force=force, user_context=user_context
)
)

Expand Down

0 comments on commit 2961c44

Please sign in to comment.