maleo-foundation 0.3.52__py3-none-any.whl → 0.3.54__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.
@@ -33,7 +33,7 @@ class CredentialsModel(BaseModel):
33
33
 
34
34
  class User(BaseUser):
35
35
  def __init__(
36
- self, authenticated: bool = True, username: str = "", email: str = ""
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(True, description="Authenticated")
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 DataSource(StrEnum):
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(f"{self.key}:{blob_name}", url)
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}", url, ex=int(expiration)
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(f"{self.key}:{blob_name}", url, ex=int(expiration))
179
+ await self._redis.set(
180
+ f"{self._service_key}:{blob_name}", url, ex=int(expiration)
181
+ )
176
182
 
177
183
  return url
@@ -1,6 +1,6 @@
1
+ from datetime import datetime, timezone
1
2
  from pydantic import BaseModel, Field
2
3
  from typing import Dict, Optional, Union, Any
3
- from maleo_foundation.enums import BaseEnums
4
4
  from maleo_foundation.models.schemas.general import BaseGeneralSchemas
5
5
  from maleo_foundation.types import BaseTypes
6
6
 
@@ -95,7 +95,9 @@ class BaseResultSchemas:
95
95
  )
96
96
 
97
97
  class Get(BaseModel):
98
- source: BaseEnums.DataSource = Field(..., description="Data source")
98
+ accessed_at: datetime = Field(
99
+ datetime.now(tz=timezone.utc), description="Accessed at timestamp"
100
+ )
99
101
 
100
102
 
101
103
  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.DataSource = Field(..., description="Data source type")
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,6 @@
1
1
  from __future__ import annotations
2
- from pydantic import model_validator
2
+ from pydantic import Field, model_validator
3
+ from maleo_foundation.enums import BaseEnums
3
4
  from maleo_foundation.models.schemas.result import BaseResultSchemas
4
5
 
5
6
 
@@ -33,3 +34,6 @@ class BaseClientServiceResultsTransfers:
33
34
  values["total_data"] = pagination.total_data
34
35
 
35
36
  return values
37
+
38
+ class Get(BaseResultSchemas.Get):
39
+ source: BaseEnums.ClientDataSource = Field(..., description="Data source")
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
- from pydantic import model_validator
2
+ from pydantic import Field, model_validator
3
+ from maleo_foundation.enums import BaseEnums
3
4
  from maleo_foundation.models.schemas.result import BaseResultSchemas
4
5
 
5
6
 
@@ -45,6 +46,4 @@ class BaseServiceGeneralResultsTransfers:
45
46
  return values
46
47
 
47
48
  class Get(BaseResultSchemas.Get):
48
- """Repository data source result schema."""
49
-
50
- pass
49
+ source: BaseEnums.ServiceDataSource = Field(..., description="Data source")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.52
3
+ Version: 0.3.54
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -1,8 +1,8 @@
1
1
  maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- maleo_foundation/authentication.py,sha256=Fo4DYLXOqX3sd-m8Eu0oVeuGN0YYLC8xlneGJClQ5Oc,2725
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=0-AEsjoUU8wUo20mpqLr3uVpz2s1TlEoeSTk2yoe_Ck,4978
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=b3iEeBNwX2Rp5bqh4V-JiKkXmPTe_7xbsr4e4G8CvB4,6391
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=r9BY7sXBbguCyw9ZO6lXenf7TMvCe_G8hDi25x0BBdI,4376
61
+ maleo_foundation/models/schemas/result.py,sha256=ZyF3b0xJHHKRk_wBdPclQwzLY7p3zfM2ReFqdpNKSNg,4422
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=VMDNwMlIuzpE7RLYVVu4GRi7r_ZqqeCA9zJ6cpxEWZg,1401
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=Gqcq23ZbBs-wqpdvGU0L_YmZExU5hv9KUQ3vz62L34E,5018
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=_Eu12Zjr7vwjRoCBRkUEHCS0DEeMZtq4vLwGmBGo5tc,1234
102
+ maleo_foundation/models/transfers/results/client/service.py,sha256=OG79dJBZlXZkXHSXc85R-jbnJSSAGH5j0gEng9URZ7E,1408
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=XrPNlsA0jAA7xpECYnlSVjZRuyt9X6YItHo53JjgOG8,1619
109
+ maleo_foundation/models/transfers/results/service/general.py,sha256=rtuKg1DaRAQgbYAHeSLjs9Q0SCnOxzRXtd5M-EJD9wY,1689
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.52.dist-info/METADATA,sha256=_7ZsEFE7Ea6NnFpE3zm7JFGoajpNYidyZuMuq63L6lo,4150
136
- maleo_foundation-0.3.52.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
137
- maleo_foundation-0.3.52.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
138
- maleo_foundation-0.3.52.dist-info/RECORD,,
135
+ maleo_foundation-0.3.54.dist-info/METADATA,sha256=O--0I5NMndf1s3HQEX4gNJ5Eb6S3W_A3azULfknYkso,4150
136
+ maleo_foundation-0.3.54.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
137
+ maleo_foundation-0.3.54.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
138
+ maleo_foundation-0.3.54.dist-info/RECORD,,