@@ -233,22 +233,22 @@ class _BaseSupertokensPublicConfig(CamelCaseBaseModel):
233233 Public properties received as input to the `Supertokens.init` function.
234234 """
235235
236- framework : Literal ["fastapi" , "flask" , "django" ]
237236 supertokens_config : SupertokensConfig
238- mode : Optional [Literal ["asgi" , "wsgi" ]]
239- telemetry : Optional [bool ]
240- debug : Optional [bool ]
241237
242238
243239class SupertokensPublicConfig (_BaseSupertokensPublicConfig ):
244240 """
245241 Public properties received as input to the `Supertokens.init` function.
246242 """
247243
248- app_info : AppInfo # Uses the Normalised AppInfo class
244+ pass
249245
250246
251247class _BaseSupertokensInputConfig (_BaseSupertokensPublicConfig ):
248+ framework : Literal ["fastapi" , "flask" , "django" ]
249+ mode : Optional [Literal ["asgi" , "wsgi" ]]
250+ telemetry : Optional [bool ]
251+ debug : Optional [bool ]
252252 recipe_list : List [Callable [[AppInfo , List ["OverrideMap" ]], "RecipeModule" ]]
253253 experimental : Optional [SupertokensExperimentalConfig ] = None
254254
@@ -264,31 +264,41 @@ class SupertokensInputConfig(_BaseSupertokensInputConfig):
264264
265265 app_info : InputAppInfo
266266
267- def to_public_config (self , normalised_app_info : AppInfo ) -> SupertokensPublicConfig :
268- return SupertokensPublicConfig (
269- app_info = normalised_app_info ,
270- framework = self .framework ,
271- supertokens_config = self .supertokens_config ,
272- mode = self .mode ,
273- telemetry = self .telemetry ,
274- debug = self .debug ,
267+ def to_public_config (self ) -> SupertokensPublicConfig :
268+ return SupertokensPublicConfig (supertokens_config = self .supertokens_config )
269+
270+ @classmethod
271+ def from_public_and_input_config (
272+ cls ,
273+ input_config : "SupertokensInputConfig" ,
274+ public_config : SupertokensPublicConfig ,
275+ ) -> "SupertokensInputConfig" :
276+ return cls (
277+ ** {
278+ ** input_config .model_dump (),
279+ ** public_config .model_dump (),
280+ }
275281 )
276282
277283 @classmethod
278284 def from_public_config (
279285 cls ,
280286 config : SupertokensPublicConfig ,
281287 app_info : InputAppInfo ,
288+ framework : Literal ["fastapi" , "flask" , "django" ],
289+ mode : Optional [Literal ["asgi" , "wsgi" ]],
290+ telemetry : Optional [bool ],
291+ debug : Optional [bool ],
282292 recipe_list : List [Callable [[AppInfo , List ["OverrideMap" ]], "RecipeModule" ]],
283293 experimental : Optional [SupertokensExperimentalConfig ],
284294 ) -> "SupertokensInputConfig" :
285295 return cls (
286296 app_info = app_info ,
287- framework = config . framework ,
297+ framework = framework ,
288298 supertokens_config = config .supertokens_config ,
289- mode = config . mode ,
290- telemetry = config . telemetry ,
291- debug = config . debug ,
299+ mode = mode ,
300+ telemetry = telemetry ,
301+ debug = debug ,
292302 recipe_list = recipe_list ,
293303 experimental = experimental ,
294304 )
@@ -347,9 +357,7 @@ def __init__(
347357 debug = debug ,
348358 experimental = experimental ,
349359 )
350- input_public_config = input_config .to_public_config (
351- normalised_app_info = self .app_info
352- )
360+ input_public_config = input_config .to_public_config ()
353361 # Use the input public config by default if no plugins provided
354362 processed_public_config : SupertokensPublicConfig = input_public_config
355363
@@ -369,11 +377,9 @@ def __init__(
369377 self .plugin_list = load_plugins_result .processed_plugins
370378 self .plugin_route_handlers = load_plugins_result .plugin_route_handlers
371379
372- config = SupertokensInputConfig .from_public_config (
373- config = processed_public_config ,
374- app_info = input_config .app_info ,
375- recipe_list = recipe_list ,
376- experimental = experimental ,
380+ config = SupertokensInputConfig .from_public_and_input_config (
381+ input_config = input_config ,
382+ public_config = processed_public_config ,
377383 )
378384
379385 self .app_info = AppInfo (
0 commit comments