maleo-foundation 0.3.42__py3-none-any.whl → 0.3.44__py3-none-any.whl

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.
@@ -1,4 +1,4 @@
1
- from pydantic import BaseModel, ConfigDict, Field
1
+ from pydantic import BaseModel, ConfigDict, Field, field_serializer
2
2
  from starlette.authentication import AuthCredentials, BaseUser
3
3
  from typing import Optional, Sequence
4
4
  from maleo_foundation.enums import BaseEnums
@@ -48,4 +48,19 @@ class Authentication(BaseModel):
48
48
  model_config = ConfigDict(arbitrary_types_allowed=True)
49
49
 
50
50
  credentials: Credentials = Field(..., description="Credentials's information")
51
- user: User = Field(..., description="User's information")
51
+ user: User = Field(..., description="User's information")
52
+
53
+ @field_serializer('credentials')
54
+ def serialize_credentials(self, credentials: Credentials, _info):
55
+ return {
56
+ "token": credentials.token.model_dump() if credentials.token is not None else None,
57
+ "scopes": credentials.scopes if credentials.scopes is not None else None
58
+ }
59
+
60
+ @field_serializer('user')
61
+ def serialize_user(self, user: User, _info):
62
+ return {
63
+ "is_authenticated": user.is_authenticated,
64
+ "display_name": user.display_name,
65
+ "identity": user.identity
66
+ }
@@ -34,7 +34,7 @@ def key_builder(
34
34
  return f"{func.__module__}:{func.__qualname__}({serialized_args}|{serialized_kwargs})"
35
35
 
36
36
  def build_key(
37
- namespace: str,
38
- *ext: str
37
+ *ext: str,
38
+ namespace: str
39
39
  ):
40
40
  return ":".join([namespace, *ext])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.42
3
+ Version: 0.3.44
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- maleo_foundation/authentication.py,sha256=TSszeTEKijy95gdYM_fFGR_VtpPWKDwkP7_AOdoGCA0,1556
2
+ maleo_foundation/authentication.py,sha256=2Fw6rrSnJj7i18UpWovJRKthZyZdq3sLKnkGVYP3wqM,2138
3
3
  maleo_foundation/authorization.py,sha256=HGXCJ47AU1YFMDSmGhrMMmlHnAyghcFZVUiPa1FSvog,283
4
4
  maleo_foundation/constants.py,sha256=LjMIy_Fcr6HLuhIuXs5lCtkyScZXXHOtBMPYx5lwg00,1446
5
5
  maleo_foundation/enums.py,sha256=x6hVz0gvrKRF1ng8lMgVzwfiA_F6Y4vuOU4rBOgtTUg,4758
@@ -111,7 +111,7 @@ maleo_foundation/models/transfers/results/service/repository.py,sha256=djITRZh2j
111
111
  maleo_foundation/models/transfers/results/service/controllers/__init__.py,sha256=HZJWMy2dskzOCzLmp_UaL9rjbQ-sDMI7sd2bXb-4QOU,175
112
112
  maleo_foundation/models/transfers/results/service/controllers/rest.py,sha256=txZG-yFttHTla8-m85taLt8lrt-n3NeYVvRPGQnGm4M,1124
113
113
  maleo_foundation/utils/__init__.py,sha256=ZZv0NDcTdHsHl51EKfgrlCm8CQmgvyIndMcQABDudN0,391
114
- maleo_foundation/utils/cache.py,sha256=G0ywe0kSxWaoUm_bn2cPBGqVTx9rSYzveEkFJ2tZg4k,1170
114
+ maleo_foundation/utils/cache.py,sha256=4Nygz1_csL7GhGj5lG74kHqUy4oujLIjfQ22lNR5JQE,1170
115
115
  maleo_foundation/utils/client.py,sha256=CGwn8eH5WlwnE5tPMfMAH5V3BItBgVmYBZnXpLjTVSc,2826
116
116
  maleo_foundation/utils/controller.py,sha256=Ub1R-JN6spmXakYrOY7igwaNt4Sg8LASASdXymxZcCI,6954
117
117
  maleo_foundation/utils/exceptions.py,sha256=z24kzEP2geaAEElxXaEy7ln6KodebXvtlu-h1inZ_nw,6376
@@ -133,7 +133,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
133
133
  maleo_foundation/utils/loaders/credential/google.py,sha256=ZglnLdW3lHmaKER4mwGe5N5ERus-bdsamfpwGmQYPIo,6344
134
134
  maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
135
135
  maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
136
- maleo_foundation-0.3.42.dist-info/METADATA,sha256=7SRB2HR-ynhHw7kRbjFqEFnU-OmXnlDSkyn-4teZq1I,3740
137
- maleo_foundation-0.3.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
138
- maleo_foundation-0.3.42.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
139
- maleo_foundation-0.3.42.dist-info/RECORD,,
136
+ maleo_foundation-0.3.44.dist-info/METADATA,sha256=2_3jtAGsVlUYE-_D93ljfnRvx7fWqiY3wIQqZUEA11g,3740
137
+ maleo_foundation-0.3.44.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
138
+ maleo_foundation-0.3.44.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
139
+ maleo_foundation-0.3.44.dist-info/RECORD,,