maleo-foundation 0.2.21__py3-none-any.whl → 0.2.23__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.
@@ -7,7 +7,7 @@ class RedisCacheNamespaces(BaseModel):
7
7
  base:str = Field(..., description="Base's redis namespace")
8
8
 
9
9
  def create(self, type:BaseEnums.CacheType, *ext:str) -> str:
10
- return "::".join([self.base, type, *ext])
10
+ return ":".join([self.base, type, *ext])
11
11
 
12
12
  class RedisCacheConfigurations(BaseModel):
13
13
  ttl:Union[int, float] = Field(BaseEnums.CacheTTL.TTL_5MN, description="Default TTL")
@@ -429,6 +429,9 @@ class ServiceManager:
429
429
 
430
430
  async def dispose(self) -> None:
431
431
  self._loggers.application.info("Disposing service manager")
432
+ if self._redis is not None:
433
+ await self._redis.close()
434
+ self._redis = None
432
435
  if self._database is not None:
433
436
  self._database.dispose()
434
437
  self._database = None
@@ -9,7 +9,6 @@ from maleo_foundation.models.transfers.results.service.repository import \
9
9
  class BaseRepositoryUtils:
10
10
  @staticmethod
11
11
  def result_processor(
12
- fail_class:Type[BaseServiceRepositoryResultsTransfers.Fail],
13
12
  data_found_class:Union[
14
13
  Type[BaseServiceRepositoryResultsTransfers.SingleData],
15
14
  Type[BaseServiceRepositoryResultsTransfers.UnpaginatedMultipleData],
@@ -20,22 +19,17 @@ class BaseRepositoryUtils:
20
19
  """Decorator to handle repository-related exceptions consistently."""
21
20
  def decorator(func):
22
21
  def _processor(result:BaseTypes.StringToAnyDict):
23
- if "success" not in result or "data" not in result:
24
- raise ValueError("Result did not have both 'success' and 'data' field")
25
- success = result.get("success")
22
+ if "data" not in result:
23
+ raise ValueError("Result did not have 'data' field")
26
24
  data = result.get("data")
27
- if success is False:
28
- validated_result = fail_class.model_validate(result)
25
+ if data is None:
26
+ if no_data_class is None:
27
+ raise ValueError("'no_data_class' must be given to validate No Data")
28
+ validated_result = no_data_class.model_validate(result)
29
+ return validated_result
30
+ else:
31
+ validated_result = data_found_class.model_validate(result)
29
32
  return validated_result
30
- if success is True:
31
- if data is None:
32
- if no_data_class is None:
33
- raise ValueError("'no_data_class' must be given to validate No Data")
34
- validated_result = no_data_class.model_validate(result)
35
- return validated_result
36
- else:
37
- validated_result = data_found_class.model_validate(result)
38
- return validated_result
39
33
  if asyncio.iscoroutinefunction(func):
40
34
  @wraps(func)
41
35
  async def async_wrapper(*args, **kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.2.21
3
+ Version: 0.2.23
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -33,9 +33,9 @@ maleo_foundation/expanded_types/encryption/rsa.py,sha256=Esf_H8nMz2kOLAWa3M7dlD-
33
33
  maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  maleo_foundation/managers/db.py,sha256=cpY1IOiUytT9XXYtzS0E9OSYOuB7jBKo0XHe__uI1Jg,5340
35
35
  maleo_foundation/managers/middleware.py,sha256=ODIQU1Hpu-Xempjjo_VRbVtxiD5oi74mNuoWuDawRh0,4250
36
- maleo_foundation/managers/service.py,sha256=MZXjULbl5XMtcqn3NC9TkQEHbnTIDdFab1M3OJh-F0U,18585
36
+ maleo_foundation/managers/service.py,sha256=4H-eEayFEA1aWUYCgSu2sOy4MLDN9RqkCj5xJXN154o,18690
37
37
  maleo_foundation/managers/cache/__init__.py,sha256=CeY0oof2bVl_v5WS-FKXNwn2gf3xrEMfUsHK9cHo59s,471
38
- maleo_foundation/managers/cache/redis.py,sha256=IPa2m3z70NqNLi-4EuRLUnwdkKuBG5SZdReBu1w3JNY,1022
38
+ maleo_foundation/managers/cache/redis.py,sha256=vUpQUAKP_wZb_Fr1wEzICDCPQyBW8jnZ-pktl6AIdmY,1021
39
39
  maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  maleo_foundation/managers/client/base.py,sha256=AlMsdxIsu2U8BLT2SyEXC7YQXDZjVPZfEmHvV_IUv18,4430
41
41
  maleo_foundation/managers/client/maleo.py,sha256=pY3285ZjFttte0uN3x3AmqaoCTeFOhXvuI4GbuPbDkQ,2140
@@ -103,7 +103,7 @@ maleo_foundation/utils/extractor.py,sha256=SZXVYDHWGaA-Dd1BUydwF2HHdZqexEielS4Cj
103
103
  maleo_foundation/utils/logging.py,sha256=W5Fhk_xAXVqSujaY8mv3hRH4wlQSpUn4ReuMoiKcQa4,7759
104
104
  maleo_foundation/utils/mergers.py,sha256=DniUu3Ot4qkYH_YSw4uD1cn9cfirum4S_Opp8fMkQwA,702
105
105
  maleo_foundation/utils/query.py,sha256=OQJNf42XeIh-J6tBa_f8iX-UoAib1vg_z8LsVE3zfGk,4739
106
- maleo_foundation/utils/repository.py,sha256=CbT1teeJSXEKcws8K_xQbjGphRyrbItPKN1omHo_wew,2839
106
+ maleo_foundation/utils/repository.py,sha256=n9eGpFybisXb0LVmNDZi2JJ61Urma5QqK6MhDOHcqfI,2454
107
107
  maleo_foundation/utils/dependencies/__init__.py,sha256=0KKGrdfj8Cc5A4SRk_ZBAxzOP795Mizdb4zIBh07KC4,122
108
108
  maleo_foundation/utils/dependencies/auth.py,sha256=wS9qnmd1n2WsFhiSfyq_3Io3wwZKTENVPv4rMwxJslE,727
109
109
  maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
@@ -115,7 +115,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
115
115
  maleo_foundation/utils/loaders/credential/google.py,sha256=SKsqPuFnAiCcYLf24CxKnMybhVHpgqnq1gGSlThqjts,994
116
116
  maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
117
117
  maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
118
- maleo_foundation-0.2.21.dist-info/METADATA,sha256=pY5kKILziAx0TD29ASfMWfBe_P891Q5qFYxcp09t364,3598
119
- maleo_foundation-0.2.21.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
120
- maleo_foundation-0.2.21.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
121
- maleo_foundation-0.2.21.dist-info/RECORD,,
118
+ maleo_foundation-0.2.23.dist-info/METADATA,sha256=BXTrWMOeWuolK52z7_6SiVfAOCLlc88erG-yXpS8Xww,3598
119
+ maleo_foundation-0.2.23.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
120
+ maleo_foundation-0.2.23.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
121
+ maleo_foundation-0.2.23.dist-info/RECORD,,