Skip to content

Commit 8eec089

Browse files
committed
adding dev-v0.15.0 tag to this commit to ensure building
1 parent a719deb commit 8eec089

File tree

13 files changed

+140
-109
lines changed

13 files changed

+140
-109
lines changed

html/supertokens_python/framework/django/django_middleware.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ <h1 class="title">Module <code>supertokens_python.framework.django.django_middle
9999
from django.http import HttpResponse
100100

101101
response = DjangoResponse(HttpResponse())
102+
user_context = default_user_context(custom_request)
103+
102104
try:
103105
result: Union[DjangoResponse, None] = async_to_sync(st.middleware)(
104-
custom_request, response
106+
custom_request, response, user_context
105107
)
106108

107109
if result is None:
@@ -195,9 +197,11 @@ <h2 class="section-title" id="header-functions">Functions</h2>
195197
from django.http import HttpResponse
196198

197199
response = DjangoResponse(HttpResponse())
200+
user_context = default_user_context(custom_request)
201+
198202
try:
199203
result: Union[DjangoResponse, None] = async_to_sync(st.middleware)(
200-
custom_request, response
204+
custom_request, response, user_context
201205
)
202206

203207
if result is None:

html/supertokens_python/recipe/dashboard/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard</code></h1>
4242

4343
from __future__ import annotations
4444

45-
from typing import Callable, Optional, Union, TYPE_CHECKING
45+
from typing import Callable, Optional, Union
4646

4747
from supertokens_python import AppInfo, RecipeModule
4848

4949
from .recipe import DashboardRecipe
5050

51-
if TYPE_CHECKING:
52-
from supertokens_python.recipe.dashboard.utils import InputOverrideConfig
51+
from supertokens_python.recipe.dashboard import utils
52+
53+
InputOverrideConfig = utils.InputOverrideConfig
5354

5455

5556
def init(
@@ -101,7 +102,7 @@ <h2 class="section-title" id="header-submodules">Sub-modules</h2>
101102
<h2 class="section-title" id="header-functions">Functions</h2>
102103
<dl>
103104
<dt id="supertokens_python.recipe.dashboard.init"><code class="name flex">
104-
<span>def <span class="ident">init</span></span>(<span>api_key: Union[str, None] = None, override: Optional[InputOverrideConfig] = None) ‑> Callable[[AppInfo], RecipeModule]</span>
105+
<span>def <span class="ident">init</span></span>(<span>api_key: Union[str, None] = None, override: Optional[InputOverrideConfig] = None) ‑> Callable[[<a title="supertokens_python.supertokens.AppInfo" href="../../supertokens.html#supertokens_python.supertokens.AppInfo">AppInfo</a>], <a title="supertokens_python.recipe_module.RecipeModule" href="../../recipe_module.html#supertokens_python.recipe_module.RecipeModule">RecipeModule</a>]</span>
105106
</code></dt>
106107
<dd>
107108
<div class="desc"></div>

html/supertokens_python/recipe/emailpassword/asyncio/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.emailpassword.asyncio</
9898
if user_context is None:
9999
user_context = {}
100100
return await EmailPasswordRecipe.get_instance().recipe_implementation.get_user_by_email(
101-
tenant_id, email, user_context
101+
email, tenant_id, user_context
102102
)
103103

104104

@@ -121,7 +121,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.emailpassword.asyncio</
121121
if user_context is None:
122122
user_context = {}
123123
return await EmailPasswordRecipe.get_instance().recipe_implementation.reset_password_using_token(
124-
new_password, tenant_id, token, user_context
124+
token, new_password, tenant_id, user_context
125125
)
126126

127127

@@ -270,7 +270,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
270270
if user_context is None:
271271
user_context = {}
272272
return await EmailPasswordRecipe.get_instance().recipe_implementation.get_user_by_email(
273-
tenant_id, email, user_context
273+
email, tenant_id, user_context
274274
)</code></pre>
275275
</details>
276276
</dd>
@@ -313,7 +313,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
313313
if user_context is None:
314314
user_context = {}
315315
return await EmailPasswordRecipe.get_instance().recipe_implementation.reset_password_using_token(
316-
new_password, tenant_id, token, user_context
316+
token, new_password, tenant_id, user_context
317317
)</code></pre>
318318
</details>
319319
</dd>

html/supertokens_python/recipe/multitenancy/recipe_implementation.html

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
7373
from .utils import MultitenancyConfig
7474

7575
from supertokens_python.querier import NormalisedURLPath
76+
from .constants import DEFAULT_TENANT_ID
7677

7778

7879
def parse_tenant_config(tenant: Dict[str, Any]) -&gt; TenantConfigResponse:
@@ -189,7 +190,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
189190
self, tenant_id: Optional[str], user_context: Dict[str, Any]
190191
) -&gt; Optional[GetTenantOkResult]:
191192
res = await self.querier.send_get_request(
192-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant&#34;),
193+
NormalisedURLPath(
194+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant&#34;
195+
),
193196
)
194197

195198
if res[&#34;status&#34;] == &#34;TENANT_NOT_FOUND_ERROR&#34;:
@@ -237,7 +240,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
237240
user_context: Dict[str, Any],
238241
) -&gt; CreateOrUpdateThirdPartyConfigOkResult:
239242
response = await self.querier.send_put_request(
240-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/config/thirdparty&#34;),
243+
NormalisedURLPath(
244+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty&#34;
245+
),
241246
{
242247
&#34;config&#34;: config.to_json(),
243248
&#34;skipValidation&#34;: skip_validation is True,
@@ -256,7 +261,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
256261
) -&gt; DeleteThirdPartyConfigOkResult:
257262
response = await self.querier.send_post_request(
258263
NormalisedURLPath(
259-
f&#34;{tenant_id}/recipe/multitenancy/config/thirdparty/remove&#34;
264+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty/remove&#34;
260265
),
261266
{
262267
&#34;thirdPartyId&#34;: third_party_id,
@@ -268,7 +273,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
268273
)
269274

270275
async def associate_user_to_tenant(
271-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
276+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
272277
) -&gt; Union[
273278
AssociateUserToTenantOkResult,
274279
AssociateUserToTenantUnknownUserIdError,
@@ -277,7 +282,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
277282
AssociateUserToTenantThirdPartyUserAlreadyExistsError,
278283
]:
279284
response: Dict[str, Any] = await self.querier.send_post_request(
280-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant/user&#34;),
285+
NormalisedURLPath(
286+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user&#34;
287+
),
281288
{
282289
&#34;userId&#34;: user_id,
283290
},
@@ -305,10 +312,12 @@ <h1 class="title">Module <code>supertokens_python.recipe.multitenancy.recipe_imp
305312
raise Exception(&#34;Should never come here&#34;)
306313

307314
async def dissociate_user_from_tenant(
308-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
315+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
309316
) -&gt; DisassociateUserFromTenantOkResult:
310317
response = await self.querier.send_post_request(
311-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant/user/remove&#34;),
318+
NormalisedURLPath(
319+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user/remove&#34;
320+
),
312321
{
313322
&#34;userId&#34;: user_id,
314323
},
@@ -465,7 +474,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
465474
self, tenant_id: Optional[str], user_context: Dict[str, Any]
466475
) -&gt; Optional[GetTenantOkResult]:
467476
res = await self.querier.send_get_request(
468-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant&#34;),
477+
NormalisedURLPath(
478+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant&#34;
479+
),
469480
)
470481

471482
if res[&#34;status&#34;] == &#34;TENANT_NOT_FOUND_ERROR&#34;:
@@ -513,7 +524,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
513524
user_context: Dict[str, Any],
514525
) -&gt; CreateOrUpdateThirdPartyConfigOkResult:
515526
response = await self.querier.send_put_request(
516-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/config/thirdparty&#34;),
527+
NormalisedURLPath(
528+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty&#34;
529+
),
517530
{
518531
&#34;config&#34;: config.to_json(),
519532
&#34;skipValidation&#34;: skip_validation is True,
@@ -532,7 +545,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
532545
) -&gt; DeleteThirdPartyConfigOkResult:
533546
response = await self.querier.send_post_request(
534547
NormalisedURLPath(
535-
f&#34;{tenant_id}/recipe/multitenancy/config/thirdparty/remove&#34;
548+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty/remove&#34;
536549
),
537550
{
538551
&#34;thirdPartyId&#34;: third_party_id,
@@ -544,7 +557,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
544557
)
545558

546559
async def associate_user_to_tenant(
547-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
560+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
548561
) -&gt; Union[
549562
AssociateUserToTenantOkResult,
550563
AssociateUserToTenantUnknownUserIdError,
@@ -553,7 +566,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
553566
AssociateUserToTenantThirdPartyUserAlreadyExistsError,
554567
]:
555568
response: Dict[str, Any] = await self.querier.send_post_request(
556-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant/user&#34;),
569+
NormalisedURLPath(
570+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user&#34;
571+
),
557572
{
558573
&#34;userId&#34;: user_id,
559574
},
@@ -581,10 +596,12 @@ <h2 class="section-title" id="header-classes">Classes</h2>
581596
raise Exception(&#34;Should never come here&#34;)
582597

583598
async def dissociate_user_from_tenant(
584-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
599+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
585600
) -&gt; DisassociateUserFromTenantOkResult:
586601
response = await self.querier.send_post_request(
587-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant/user/remove&#34;),
602+
NormalisedURLPath(
603+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user/remove&#34;
604+
),
588605
{
589606
&#34;userId&#34;: user_id,
590607
},
@@ -602,7 +619,7 @@ <h3>Ancestors</h3>
602619
<h3>Methods</h3>
603620
<dl>
604621
<dt id="supertokens_python.recipe.multitenancy.recipe_implementation.RecipeImplementation.associate_user_to_tenant"><code class="name flex">
605-
<span>async def <span class="ident">associate_user_to_tenant</span></span>(<span>self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]) ‑> Union[AssociateUserToTenantOkResult, AssociateUserToTenantUnknownUserIdError, AssociateUserToTenantEmailAlreadyExistsError, AssociateUserToTenantPhoneNumberAlreadyExistsError, AssociateUserToTenantThirdPartyUserAlreadyExistsError]</span>
622+
<span>async def <span class="ident">associate_user_to_tenant</span></span>(<span>self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]) ‑> Union[<a title="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantOkResult" href="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantOkResult">AssociateUserToTenantOkResult</a><a title="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantUnknownUserIdError" href="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantUnknownUserIdError">AssociateUserToTenantUnknownUserIdError</a><a title="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantEmailAlreadyExistsError" href="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantEmailAlreadyExistsError">AssociateUserToTenantEmailAlreadyExistsError</a><a title="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantPhoneNumberAlreadyExistsError" href="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantPhoneNumberAlreadyExistsError">AssociateUserToTenantPhoneNumberAlreadyExistsError</a><a title="supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantThirdPartyUserAlreadyExistsError" href="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.AssociateUserToTenantThirdPartyUserAlreadyExistsError">AssociateUserToTenantThirdPartyUserAlreadyExistsError</a>]</span>
606623
</code></dt>
607624
<dd>
608625
<div class="desc"></div>
@@ -611,7 +628,7 @@ <h3>Methods</h3>
611628
<span>Expand source code</span>
612629
</summary>
613630
<pre><code class="python">async def associate_user_to_tenant(
614-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
631+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
615632
) -&gt; Union[
616633
AssociateUserToTenantOkResult,
617634
AssociateUserToTenantUnknownUserIdError,
@@ -620,7 +637,9 @@ <h3>Methods</h3>
620637
AssociateUserToTenantThirdPartyUserAlreadyExistsError,
621638
]:
622639
response: Dict[str, Any] = await self.querier.send_post_request(
623-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant/user&#34;),
640+
NormalisedURLPath(
641+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user&#34;
642+
),
624643
{
625644
&#34;userId&#34;: user_id,
626645
},
@@ -692,7 +711,9 @@ <h3>Methods</h3>
692711
user_context: Dict[str, Any],
693712
) -&gt; CreateOrUpdateThirdPartyConfigOkResult:
694713
response = await self.querier.send_put_request(
695-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/config/thirdparty&#34;),
714+
NormalisedURLPath(
715+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty&#34;
716+
),
696717
{
697718
&#34;config&#34;: config.to_json(),
698719
&#34;skipValidation&#34;: skip_validation is True,
@@ -742,7 +763,7 @@ <h3>Methods</h3>
742763
) -&gt; DeleteThirdPartyConfigOkResult:
743764
response = await self.querier.send_post_request(
744765
NormalisedURLPath(
745-
f&#34;{tenant_id}/recipe/multitenancy/config/thirdparty/remove&#34;
766+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty/remove&#34;
746767
),
747768
{
748769
&#34;thirdPartyId&#34;: third_party_id,
@@ -755,7 +776,7 @@ <h3>Methods</h3>
755776
</details>
756777
</dd>
757778
<dt id="supertokens_python.recipe.multitenancy.recipe_implementation.RecipeImplementation.dissociate_user_from_tenant"><code class="name flex">
758-
<span>async def <span class="ident">dissociate_user_from_tenant</span></span>(<span>self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]) ‑> DisassociateUserFromTenantOkResult</span>
779+
<span>async def <span class="ident">dissociate_user_from_tenant</span></span>(<span>self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]) ‑> <a title="supertokens_python.recipe.multitenancy.interfaces.DisassociateUserFromTenantOkResult" href="interfaces.html#supertokens_python.recipe.multitenancy.interfaces.DisassociateUserFromTenantOkResult">DisassociateUserFromTenantOkResult</a></span>
759780
</code></dt>
760781
<dd>
761782
<div class="desc"></div>
@@ -764,10 +785,12 @@ <h3>Methods</h3>
764785
<span>Expand source code</span>
765786
</summary>
766787
<pre><code class="python">async def dissociate_user_from_tenant(
767-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
788+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
768789
) -&gt; DisassociateUserFromTenantOkResult:
769790
response = await self.querier.send_post_request(
770-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant/user/remove&#34;),
791+
NormalisedURLPath(
792+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user/remove&#34;
793+
),
771794
{
772795
&#34;userId&#34;: user_id,
773796
},
@@ -791,7 +814,9 @@ <h3>Methods</h3>
791814
self, tenant_id: Optional[str], user_context: Dict[str, Any]
792815
) -&gt; Optional[GetTenantOkResult]:
793816
res = await self.querier.send_get_request(
794-
NormalisedURLPath(f&#34;{tenant_id}/recipe/multitenancy/tenant&#34;),
817+
NormalisedURLPath(
818+
f&#34;{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant&#34;
819+
),
795820
)
796821

797822
if res[&#34;status&#34;] == &#34;TENANT_NOT_FOUND_ERROR&#34;:

html/supertokens_python/recipe/passwordless/api/implementation.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,17 +317,17 @@ <h1 class="title">Module <code>supertokens_python.recipe.passwordless.api.implem
317317
ev_instance = EmailVerificationRecipe.get_instance_optional()
318318
if ev_instance is not None:
319319
token_response = await ev_instance.recipe_implementation.create_email_verification_token(
320-
tenant_id, user.user_id, user.email, user_context
320+
user.user_id, user.email, tenant_id, user_context
321321
)
322322

323323
if isinstance(token_response, CreateEmailVerificationTokenOkResult):
324324
await ev_instance.recipe_implementation.verify_email_using_token(
325-
tenant_id, token_response.token, user_context
325+
token_response.token, tenant_id, user_context
326326
)
327327

328328
session = await create_new_session(
329-
tenant_id=tenant_id,
330329
request=api_options.request,
330+
tenant_id=tenant_id,
331331
user_id=user.user_id,
332332
access_token_payload={},
333333
session_data_in_database={},
@@ -625,17 +625,17 @@ <h2 class="section-title" id="header-classes">Classes</h2>
625625
ev_instance = EmailVerificationRecipe.get_instance_optional()
626626
if ev_instance is not None:
627627
token_response = await ev_instance.recipe_implementation.create_email_verification_token(
628-
tenant_id, user.user_id, user.email, user_context
628+
user.user_id, user.email, tenant_id, user_context
629629
)
630630

631631
if isinstance(token_response, CreateEmailVerificationTokenOkResult):
632632
await ev_instance.recipe_implementation.verify_email_using_token(
633-
tenant_id, token_response.token, user_context
633+
token_response.token, tenant_id, user_context
634634
)
635635

636636
session = await create_new_session(
637-
tenant_id=tenant_id,
638637
request=api_options.request,
638+
tenant_id=tenant_id,
639639
user_id=user.user_id,
640640
access_token_payload={},
641641
session_data_in_database={},
@@ -731,17 +731,17 @@ <h3>Methods</h3>
731731
ev_instance = EmailVerificationRecipe.get_instance_optional()
732732
if ev_instance is not None:
733733
token_response = await ev_instance.recipe_implementation.create_email_verification_token(
734-
tenant_id, user.user_id, user.email, user_context
734+
user.user_id, user.email, tenant_id, user_context
735735
)
736736

737737
if isinstance(token_response, CreateEmailVerificationTokenOkResult):
738738
await ev_instance.recipe_implementation.verify_email_using_token(
739-
tenant_id, token_response.token, user_context
739+
token_response.token, tenant_id, user_context
740740
)
741741

742742
session = await create_new_session(
743-
tenant_id=tenant_id,
744743
request=api_options.request,
744+
tenant_id=tenant_id,
745745
user_id=user.user_id,
746746
access_token_payload={},
747747
session_data_in_database={},

0 commit comments

Comments
 (0)