maleo-foundation 0.3.53__py3-none-any.whl → 0.3.55__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.
- maleo_foundation/authentication.py +2 -2
- maleo_foundation/enums.py +5 -1
- maleo_foundation/managers/client/google/storage.py +10 -4
- maleo_foundation/models/schemas/result.py +2 -5
- maleo_foundation/models/transfers/general/data.py +1 -1
- maleo_foundation/models/transfers/general/token.py +1 -1
- maleo_foundation/models/transfers/results/client/service.py +8 -1
- maleo_foundation/models/transfers/results/service/general.py +6 -4
- {maleo_foundation-0.3.53.dist-info → maleo_foundation-0.3.55.dist-info}/METADATA +1 -1
- {maleo_foundation-0.3.53.dist-info → maleo_foundation-0.3.55.dist-info}/RECORD +12 -12
- {maleo_foundation-0.3.53.dist-info → maleo_foundation-0.3.55.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.3.53.dist-info → maleo_foundation-0.3.55.dist-info}/top_level.txt +0 -0
@@ -33,7 +33,7 @@ class CredentialsModel(BaseModel):
|
|
33
33
|
|
34
34
|
class User(BaseUser):
|
35
35
|
def __init__(
|
36
|
-
self, authenticated: bool =
|
36
|
+
self, authenticated: bool = False, username: str = "", email: str = ""
|
37
37
|
) -> None:
|
38
38
|
self._authenticated = authenticated
|
39
39
|
self._username = username
|
@@ -53,7 +53,7 @@ class User(BaseUser):
|
|
53
53
|
|
54
54
|
|
55
55
|
class UserModel(BaseModel):
|
56
|
-
is_authenticated: bool = Field(
|
56
|
+
is_authenticated: bool = Field(False, description="Authenticated")
|
57
57
|
display_name: str = Field("", description="Username")
|
58
58
|
identity: str = Field("", description="Email")
|
59
59
|
|
maleo_foundation/enums.py
CHANGED
@@ -168,8 +168,12 @@ class BaseEnums:
|
|
168
168
|
EXP_2WK = int(2 * 7 * 24 * 60 * 60)
|
169
169
|
EXP_1MO = int(1 * 30 * 24 * 60 * 60)
|
170
170
|
|
171
|
-
class
|
171
|
+
class ServiceDataSource(StrEnum):
|
172
172
|
CACHE = "cache"
|
173
173
|
DATABASE = "database"
|
174
174
|
MICROSERVICE = "microservice"
|
175
175
|
THIRD_PARTY = "third_party"
|
176
|
+
|
177
|
+
class ClientDataSource(StrEnum):
|
178
|
+
CACHE = "cache"
|
179
|
+
REQUEST = "request"
|
@@ -111,10 +111,14 @@ class GoogleCloudStorage(GoogleClientManager):
|
|
111
111
|
if self._redis is None:
|
112
112
|
raise ValueError("Can not use redis. Redis is not initialized")
|
113
113
|
if make_public:
|
114
|
-
await self._redis.set(
|
114
|
+
await self._redis.set(
|
115
|
+
f"{self._service_key}:{self.key}:{blob_name}", url
|
116
|
+
)
|
115
117
|
else:
|
116
118
|
await self._redis.set(
|
117
|
-
f"{self.key}:{blob_name}",
|
119
|
+
f"{self._service_key}:{self.key}:{blob_name}",
|
120
|
+
url,
|
121
|
+
ex=int(expiration),
|
118
122
|
)
|
119
123
|
|
120
124
|
return url
|
@@ -161,7 +165,7 @@ class GoogleCloudStorage(GoogleClientManager):
|
|
161
165
|
if use_redis:
|
162
166
|
if self._redis is None:
|
163
167
|
raise ValueError("Can not use redis. Redis is not initialized")
|
164
|
-
url = await self._redis.get(f"{self.key}:{blob_name}")
|
168
|
+
url = await self._redis.get(f"{self._service_key}:{self.key}:{blob_name}")
|
165
169
|
if url is not None:
|
166
170
|
return url
|
167
171
|
|
@@ -172,6 +176,8 @@ class GoogleCloudStorage(GoogleClientManager):
|
|
172
176
|
if use_redis:
|
173
177
|
if self._redis is None:
|
174
178
|
raise ValueError("Can not use redis. Redis is not initialized")
|
175
|
-
await self._redis.set(
|
179
|
+
await self._redis.set(
|
180
|
+
f"{self._service_key}:{blob_name}", url, ex=int(expiration)
|
181
|
+
)
|
176
182
|
|
177
183
|
return url
|
@@ -1,7 +1,5 @@
|
|
1
|
-
from datetime import datetime, timezone
|
2
1
|
from pydantic import BaseModel, Field
|
3
2
|
from typing import Dict, Optional, Union, Any
|
4
|
-
from maleo_foundation.enums import BaseEnums
|
5
3
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
6
4
|
from maleo_foundation.types import BaseTypes
|
7
5
|
|
@@ -96,10 +94,9 @@ class BaseResultSchemas:
|
|
96
94
|
)
|
97
95
|
|
98
96
|
class Get(BaseModel):
|
99
|
-
accessed_at:
|
100
|
-
|
97
|
+
accessed_at: BaseTypes.OptionalDatetime = Field(
|
98
|
+
None, description="Accessed at timestamp"
|
101
99
|
)
|
102
|
-
source: BaseEnums.DataSource = Field(..., description="Data source")
|
103
100
|
|
104
101
|
|
105
102
|
BaseResultSchemas.PaginatedMultipleData.model_rebuild()
|
@@ -24,7 +24,7 @@ class DataAccess(BaseModel):
|
|
24
24
|
)
|
25
25
|
service: BaseEnums.Service = Field(..., description="Service key")
|
26
26
|
resource: str = Field(..., description="Resource name")
|
27
|
-
source: BaseEnums.
|
27
|
+
source: BaseEnums.ServiceDataSource = Field(..., description="Data source type")
|
28
28
|
table: BaseTypes.OptionalString = Field(None, description="Table name")
|
29
29
|
data_id: int = Field(..., ge=1, description="Data Id")
|
30
30
|
data: BaseTypes.StringToAnyDict = Field(..., description="Data")
|
@@ -99,7 +99,7 @@ class MaleoFoundationTokenGeneralTransfers:
|
|
99
99
|
values["iat_dt"] = iat_dt
|
100
100
|
# * Convert `iat` to timestamp (int)
|
101
101
|
values["iat"] = int(iat_dt.timestamp())
|
102
|
-
exp_in = values.get("exp_in")
|
102
|
+
exp_in = values.get("exp_in", 15)
|
103
103
|
exp_dt = values.get("exp_dt", None)
|
104
104
|
if not exp_dt:
|
105
105
|
exp_dt = iat_dt + timedelta(minutes=exp_in)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from pydantic import model_validator
|
2
|
+
from pydantic import Field, model_validator
|
3
|
+
from typing import Optional
|
4
|
+
from maleo_foundation.enums import BaseEnums
|
3
5
|
from maleo_foundation.models.schemas.result import BaseResultSchemas
|
4
6
|
|
5
7
|
|
@@ -33,3 +35,8 @@ class BaseClientServiceResultsTransfers:
|
|
33
35
|
values["total_data"] = pagination.total_data
|
34
36
|
|
35
37
|
return values
|
38
|
+
|
39
|
+
class Get(BaseResultSchemas.Get):
|
40
|
+
source: Optional[BaseEnums.ClientDataSource] = Field(
|
41
|
+
None, description="Data source"
|
42
|
+
)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from pydantic import model_validator
|
2
|
+
from pydantic import Field, model_validator
|
3
|
+
from typing import Optional
|
4
|
+
from maleo_foundation.enums import BaseEnums
|
3
5
|
from maleo_foundation.models.schemas.result import BaseResultSchemas
|
4
6
|
|
5
7
|
|
@@ -45,6 +47,6 @@ class BaseServiceGeneralResultsTransfers:
|
|
45
47
|
return values
|
46
48
|
|
47
49
|
class Get(BaseResultSchemas.Get):
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
source: Optional[BaseEnums.ServiceDataSource] = Field(
|
51
|
+
None, description="Data source"
|
52
|
+
)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
maleo_foundation/authentication.py,sha256=
|
2
|
+
maleo_foundation/authentication.py,sha256=2Y2py-teDSO_YTFdZiPtuYhC8r3qIzn7CKyLNN8b2NQ,2727
|
3
3
|
maleo_foundation/authorization.py,sha256=8P1hleBYRv8kda4uQcbHVujHVAlI92YV1Flfzf-oJEU,285
|
4
4
|
maleo_foundation/constants.py,sha256=cgW2TjXYEdQRoYCL3fMk3r5B2Yr-Av67CaEAdY5SZ6o,1529
|
5
|
-
maleo_foundation/enums.py,sha256=
|
5
|
+
maleo_foundation/enums.py,sha256=teEj0pqZmt-V7yEzYE3PnDO4stINlxRSWbejAatmqEQ,5075
|
6
6
|
maleo_foundation/extended_types.py,sha256=oOAYc5f89WcPt5OWEaNdeceENHiPVr4KDhdttg6bA_w,305
|
7
7
|
maleo_foundation/rest_controller_result.py,sha256=uZxBxZ5hB98q1B4hNyRigHcO0560NYfUjq8L662aOPw,2172
|
8
8
|
maleo_foundation/types.py,sha256=Tq50KOISbnsMslVGBCqlY77lRAQZa-UUFDGqqwRglow,2466
|
@@ -44,7 +44,7 @@ maleo_foundation/managers/client/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
|
|
44
44
|
maleo_foundation/managers/client/google/base.py,sha256=MUxGM3wtzdMkbghMdyQkRQ-AI_pG2qpTxq2n69kMF-A,1544
|
45
45
|
maleo_foundation/managers/client/google/parameter.py,sha256=emBgc1qCQcnETKYvwv35EqARjdO9igD0-F-Xuxx-fyU,1410
|
46
46
|
maleo_foundation/managers/client/google/secret.py,sha256=75q32U-kcTljVb19MZQQ5sOVOnf1HkquyK8nIoyeMrY,5014
|
47
|
-
maleo_foundation/managers/client/google/storage.py,sha256=
|
47
|
+
maleo_foundation/managers/client/google/storage.py,sha256=uUc3RGu5PyGOKrObP-ub2Vpztqidu5BUADUrRTMxy7E,6569
|
48
48
|
maleo_foundation/managers/client/google/subscription.py,sha256=KLXneM39r8Uzvevir_jL7s9-q4iSakNUkD_I66JGbng,5365
|
49
49
|
maleo_foundation/middlewares/authentication.py,sha256=Foag5Bc4tEiCZtHuCnBAKFq4t4jMoU3ZCrR_MMZRZPc,4167
|
50
50
|
maleo_foundation/middlewares/base.py,sha256=ZXMJTiuDBa6sIbgD_g1MhhlMkszsYkt3Ocl4boPtbEU,16825
|
@@ -58,19 +58,19 @@ maleo_foundation/models/schemas/general.py,sha256=jxzBsVGsdKKEiM14MfV47dDiAZalUK
|
|
58
58
|
maleo_foundation/models/schemas/hash.py,sha256=jthDmu_VTBydffPruAIAiR8l0Xs6IrlgTptaP42zr1M,447
|
59
59
|
maleo_foundation/models/schemas/key.py,sha256=LSEDQpaCxavwp5je2O-ZNyOPtrFW_lXDywF9LK-An1w,622
|
60
60
|
maleo_foundation/models/schemas/parameter.py,sha256=OE1hg100lEa2IlGlT2Zz6PJ-OcC-6ZfDzsTOeJvvEig,3907
|
61
|
-
maleo_foundation/models/schemas/result.py,sha256=
|
61
|
+
maleo_foundation/models/schemas/result.py,sha256=k_VcmdIoZX-9nyxkmH7uPaSZFK2m0tjFIqYbVXdL1jw,4375
|
62
62
|
maleo_foundation/models/schemas/signature.py,sha256=h0sa91vnCaivmvlbqOd7RLiCz8qAY8gCzEnm0DOBlSg,649
|
63
63
|
maleo_foundation/models/schemas/token.py,sha256=eh4k9rm_MoaCfGV3Nqa7yFH-PH7Ec6WY4RxHhbF4m5U,591
|
64
64
|
maleo_foundation/models/transfers/__init__.py,sha256=V5kdd8wuXqe78bQ7HG3a8vW3Rkke2wTr6mb5lC0IQJg,301
|
65
65
|
maleo_foundation/models/transfers/general/__init__.py,sha256=e7lZRjpwQ8utt1D3IkuWOVFsnCn64De0SvxdWLSezJ0,170
|
66
66
|
maleo_foundation/models/transfers/general/credentials.py,sha256=t6OhQb3DyGSfBpbqHsiJKzPbOVSEcuBTXqmw6f8H3UY,347
|
67
|
-
maleo_foundation/models/transfers/general/data.py,sha256=
|
67
|
+
maleo_foundation/models/transfers/general/data.py,sha256=_J-Y5X2Nx8D1lpaR9ctpm54kUbxR7Vy00hO103uXtxE,1408
|
68
68
|
maleo_foundation/models/transfers/general/database.py,sha256=VQYnZa8dYrqucSQdzkaPSrzLd4SJnpU8LPytUrWErO0,1245
|
69
69
|
maleo_foundation/models/transfers/general/key.py,sha256=QV_kcxAlnrupBcGQK8tqz9FVYbivxwhgIsrmW7XDdME,845
|
70
70
|
maleo_foundation/models/transfers/general/request.py,sha256=W2aKxo0lQ-kV-4XpQEzxxa-odwLlGfOulh_wQKgcz9o,1920
|
71
71
|
maleo_foundation/models/transfers/general/settings.py,sha256=1QkPq6GP33S5R718be3XBz0BCtApAuxlL-x21EZ2Xmo,1609
|
72
72
|
maleo_foundation/models/transfers/general/signature.py,sha256=TCTIy928EeBBeFLlyQ3_NozpR9FUcWXPQKIYIwyj66k,308
|
73
|
-
maleo_foundation/models/transfers/general/token.py,sha256=
|
73
|
+
maleo_foundation/models/transfers/general/token.py,sha256=aF7IXEYS4EnWtWquZexnrXcJBOl5M1lneo7yu7IiKYg,5022
|
74
74
|
maleo_foundation/models/transfers/general/configurations/__init__.py,sha256=hrhVflh3coOvqGrxMZKkX5XDxYAbxjxnsGwJjJqV86s,1540
|
75
75
|
maleo_foundation/models/transfers/general/configurations/database.py,sha256=4j465vki3bCNGogrJLmMmF1uEXc-sUfyhwMeuaR5JyM,706
|
76
76
|
maleo_foundation/models/transfers/general/configurations/middleware.py,sha256=gBm7yv-PYOPcv-u6SXq8cMWfuuo9LwPSXuqoJ4uw9h0,1761
|
@@ -99,14 +99,14 @@ maleo_foundation/models/transfers/results/key.py,sha256=dwEWM_FLubTf4tx3dFbvKJye
|
|
99
99
|
maleo_foundation/models/transfers/results/signature.py,sha256=Wjn5GjWTXWMtmSykAZACvAPT_hfXzmwo8GFAOCwYCMw,728
|
100
100
|
maleo_foundation/models/transfers/results/token.py,sha256=uucgesaw7fRUhvfJnsWpjKEARjsTQ8-HF-maAYKei3Q,659
|
101
101
|
maleo_foundation/models/transfers/results/client/__init__.py,sha256=QVW77FHou7OOABTjiIGdwPhXub46AI3GIM8EGk6ONw4,292
|
102
|
-
maleo_foundation/models/transfers/results/client/service.py,sha256=
|
102
|
+
maleo_foundation/models/transfers/results/client/service.py,sha256=XfiHk4AKNIqSuKonjG76U3vfwrxbX7kykcAo1eLMh3c,1469
|
103
103
|
maleo_foundation/models/transfers/results/client/controllers/__init__.py,sha256=DN3va_Mcxjw0l1s9dSIOy3LkLR1jEERiAohuIA59vpc,175
|
104
104
|
maleo_foundation/models/transfers/results/client/controllers/http.py,sha256=8-FvXt5n9MSutjKSEWE5k70LrC_UGZ2Ri2oCDrEIfYw,1541
|
105
105
|
maleo_foundation/models/transfers/results/encryption/__init__.py,sha256=fq8hH7SHyYgZkYEurnZpj4Plez7Ipy8-8yX60bj-I-w,309
|
106
106
|
maleo_foundation/models/transfers/results/encryption/aes.py,sha256=5aNglJqHT3Ufordl_Bfy9thIXVblMw80xtmLs7KiCXI,877
|
107
107
|
maleo_foundation/models/transfers/results/encryption/rsa.py,sha256=dSIshf386TAF9hfokDmj4XKHsR_MQfQLmft8AF2MTZc,748
|
108
108
|
maleo_foundation/models/transfers/results/service/__init__.py,sha256=J2PANZfFCPIE836hqKLj7a7q9AT5YSPQ0_SlYj3OKP0,295
|
109
|
-
maleo_foundation/models/transfers/results/service/general.py,sha256=
|
109
|
+
maleo_foundation/models/transfers/results/service/general.py,sha256=nx23IHIxiscl1miSz2D2VNN2oFV8e7eKlm-cV4QjFWc,1750
|
110
110
|
maleo_foundation/models/transfers/results/service/controllers/__init__.py,sha256=rRt93gFqsJloJXzNWS_2chBC3hJoG4WaN84H2B5UPow,177
|
111
111
|
maleo_foundation/models/transfers/results/service/controllers/rest.py,sha256=YRD_D064BGqHUJeFH-ArOPmSNnhJO_gr_AI4gTqh8Y0,951
|
112
112
|
maleo_foundation/utils/__init__.py,sha256=L9J946_ySumzbJoOIbSBkhGz0tcjWPZ2_g76EXyxKkk,393
|
@@ -132,7 +132,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=g-cAxkTE2EtHaG8Tv52
|
|
132
132
|
maleo_foundation/utils/loaders/credential/google.py,sha256=GCJl-bsKSSxoE_ERAkIzRrRNIbIEeqYOhHwzFuBr0mk,6576
|
133
133
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=RfqIbUxkdlx1xrbzJZPD_JHiRFNFLRuQs8JoUPCGCv4,108
|
134
134
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=UXcP0rr4QVacTsHLNQuU05wcow5CHWz-JW-zsVxlbPs,4121
|
135
|
-
maleo_foundation-0.3.
|
136
|
-
maleo_foundation-0.3.
|
137
|
-
maleo_foundation-0.3.
|
138
|
-
maleo_foundation-0.3.
|
135
|
+
maleo_foundation-0.3.55.dist-info/METADATA,sha256=BCt07Y4xUXZCRZgLjDa64c6BpJ3ZlmrMX0ZNAPHKATI,4150
|
136
|
+
maleo_foundation-0.3.55.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
137
|
+
maleo_foundation-0.3.55.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
138
|
+
maleo_foundation-0.3.55.dist-info/RECORD,,
|
File without changes
|
File without changes
|