maleo-foundation 0.3.27__py3-none-any.whl → 0.3.31__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.
@@ -27,7 +27,7 @@ class ConfigurationManager:
27
27
  self
28
28
  ._credential_manager
29
29
  .secret_manager
30
- .get(f"/configurations/{self._settings.SERVICE_KEY}-configurations-{self._settings.ENVIRONMENT}")
30
+ .get(f"{self._settings.SERVICE_KEY}-configurations-{self._settings.ENVIRONMENT}")
31
31
  )
32
32
  data = YAMLLoader.load_from_string(secret_data)
33
33
  self._configurations = Configurations.model_validate(data)
@@ -1,80 +1,5 @@
1
1
  from __future__ import annotations
2
- from datetime import datetime, timezone
3
- from pydantic import BaseModel, Field
4
- from typing import Dict, Any
5
- from uuid import UUID
6
- from maleo_foundation.models.schemas.general import BaseGeneralSchemas
7
- from maleo_foundation.types import BaseTypes
8
2
  from .token import MaleoFoundationTokenGeneralTransfers
9
3
 
10
4
  class BaseGeneralTransfers:
11
- Token = MaleoFoundationTokenGeneralTransfers
12
-
13
- class AccessTransfers(
14
- BaseGeneralSchemas.AccessedBy,
15
- BaseGeneralSchemas.AccessedAt
16
- ): pass
17
-
18
- class RequestContextTransfers(BaseModel):
19
- request_id: UUID = Field(..., description="Unique identifier for tracing the request")
20
- requested_at: datetime = Field(datetime.now(tz=timezone.utc), description="Request timestamp")
21
- method: str = Field(..., description="Request's method")
22
- url: str = Field(..., description="Request's URL")
23
- path_params: Dict = Field(..., description="Request's path parameters")
24
- query_params: Dict = Field(..., description="Request's query parameters")
25
- ip_address: str = Field("unknown", description="Client's IP address")
26
- is_internal: BaseTypes.OptionalBoolean = Field(None, description="True if IP is internal")
27
- user_agent: BaseTypes.OptionalString = Field(None, description="User-Agent string")
28
- ua_browser: BaseTypes.OptionalString = Field(None, description="Browser info from sec-ch-ua")
29
- ua_mobile: BaseTypes.OptionalString = Field(None, description="Is mobile device?")
30
- platform: BaseTypes.OptionalString = Field(None, description="Client platform or OS")
31
- referer: BaseTypes.OptionalString = Field(None, description="Referrer URL")
32
- origin: BaseTypes.OptionalString = Field(None, description="Origin of the request")
33
- host: BaseTypes.OptionalString = Field(None, description="Host header from request")
34
- forwarded_proto: BaseTypes.OptionalString = Field(None, description="Forwarded protocol (http/https)")
35
- language: BaseTypes.OptionalString = Field(None, description="Accepted languages from client")
36
-
37
- def to_google_pubsub_object(self) -> Dict[str, Any]:
38
- result = {
39
- "request_id": str(self.request_id),
40
- "requested_at": self.requested_at.isoformat(),
41
- "method": self.method,
42
- "url": self.url,
43
- "path_params": {"map": self.path_params},
44
- "query_params": {"map": self.query_params},
45
- "ip_address": self.ip_address,
46
- "is_internal": None if self.is_internal is None else {"boolean": self.is_internal},
47
- "user_agent": None if self.user_agent is None else {"string": self.user_agent},
48
- "ua_browser": None if self.ua_browser is None else {"string": self.ua_browser},
49
- "ua_mobile": None if self.ua_mobile is None else {"string": self.ua_mobile},
50
- "platform": None if self.platform is None else {"string": self.platform},
51
- "referer": None if self.referer is None else {"array": self.referer},
52
- "origin": None if self.origin is None else {"array": self.origin},
53
- "host": None if self.host is None else {"array": self.host},
54
- "forwarded_proto": None if self.forwarded_proto is None else {"array": self.forwarded_proto},
55
- "language": None if self.language is None else {"array": self.language}
56
- }
57
-
58
- return result
59
-
60
- @classmethod
61
- def from_google_pubsub_object(cls, obj:Dict[str, Any]):
62
- return cls(
63
- request_id = UUID(obj["request_id"]),
64
- requested_at = datetime.fromisoformat(obj["requested_at"]),
65
- method = obj["method"],
66
- url = obj["url"],
67
- path_params = obj["path_params"]["map"] or {},
68
- query_params = obj["query_params"]["map"] or {},
69
- ip_address = obj["ip_address"],
70
- is_internal = None if obj["is_internal"] is None else bool(obj["is_internal"]["boolean"]),
71
- user_agent = None if obj["user_agent"] is None else obj["user_agent"]["string"],
72
- ua_browser = None if obj["ua_browser"] is None else obj["ua_browser"]["string"],
73
- ua_mobile = None if obj["ua_mobile"] is None else obj["ua_mobile"]["string"],
74
- platform = None if obj["platform"] is None else obj["platform"]["string"],
75
- referer = None if obj["referer"] is None else obj["referer"]["string"],
76
- origin = None if obj["origin"] is None else obj["origin"]["string"],
77
- host = None if obj["host"] is None else obj["host"]["string"],
78
- forwarded_proto = None if obj["forwarded_proto"] is None else obj["forwarded_proto"]["string"],
79
- language = None if obj["language"] is None else obj["language"]["string"],
80
- )
5
+ Token = MaleoFoundationTokenGeneralTransfers
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.27
3
+ Version: 0.3.31
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -33,7 +33,7 @@ maleo_foundation/expanded_types/encryption/aes.py,sha256=1rj43qjIO0TePpr1mErT_NJ
33
33
  maleo_foundation/expanded_types/encryption/rsa.py,sha256=Esf_H8nMz2kOLAWa3M7dlD-sFdFIZylNjB_qB20Yaww,488
34
34
  maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  maleo_foundation/managers/cache.py,sha256=IgcA-NAJbW83jRyApuQPbSJdth2LUpix9o-5CMWNwdI,274
36
- maleo_foundation/managers/configuration.py,sha256=B2ho_-QkXh4KkHuiVA_GPrn2QvhoZL_KqNwQCIea_1c,1433
36
+ maleo_foundation/managers/configuration.py,sha256=Jcm2A_fS-styLEWZurF7nquitnSYuce05YVuxlDgxe4,1417
37
37
  maleo_foundation/managers/credential.py,sha256=i1w9bVozf7FYG8NGfLgJYRdLWBQBf35yyzVOEDgdXSA,3108
38
38
  maleo_foundation/managers/db.py,sha256=y5oP3bTXKeXYKqng-E_HZ-3wC0ZPtl5bls0AEEej6zM,6050
39
39
  maleo_foundation/managers/middleware.py,sha256=ecTNloglV67xoC_hqIEMIxhfQwzXRKHLI3ThJdd-lbY,2480
@@ -63,7 +63,7 @@ maleo_foundation/models/schemas/result.py,sha256=Utpq7ZPb55Q08-j_P5GukcYnNxaIlHX
63
63
  maleo_foundation/models/schemas/signature.py,sha256=pP78JZpoizQguVKXv4AXQmB8ebVy0BmcIfpEm9_YbRU,625
64
64
  maleo_foundation/models/schemas/token.py,sha256=Ay-ntAiKeBjCT4YYw0S3Zd4e-KvHSYvG_hzCMYzd5qY,567
65
65
  maleo_foundation/models/transfers/__init__.py,sha256=oJLJ3Geeme6vBw7R2Dhvdvg4ziVvzEYAGJaP-tm_90w,299
66
- maleo_foundation/models/transfers/general/__init__.py,sha256=rzHpxhyNphl5RVrsAlzEvuYEonmWgb69gJ8XOLMvFDc,4686
66
+ maleo_foundation/models/transfers/general/__init__.py,sha256=UPIE9l9XXCb6nWzaV3atMgbbCeBeRzsvFyROJuH2d2w,168
67
67
  maleo_foundation/models/transfers/general/credentials.py,sha256=kLS0ymFipQmL3QaA2YFQepRfrQYlEm0jp1MiviAnfXM,345
68
68
  maleo_foundation/models/transfers/general/database.py,sha256=bFNPd-1x3jNHPscwCk0besnpwartAeLY2e5PfKVyI4M,1201
69
69
  maleo_foundation/models/transfers/general/key.py,sha256=S37SqD3qwTbgMk7785hW7Kl9d4Kouh4uPZcGoyMQ_-Q,755
@@ -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.27.dist-info/METADATA,sha256=daIDsRpkAI2bjdV4LqhFm-p31oe6xxfPv_EdHlLj1yA,3740
137
- maleo_foundation-0.3.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
138
- maleo_foundation-0.3.27.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
139
- maleo_foundation-0.3.27.dist-info/RECORD,,
136
+ maleo_foundation-0.3.31.dist-info/METADATA,sha256=p-26o94K0XrdT_UOZoZ3T2NfltVyT5kg9sVqG2n9JDI,3740
137
+ maleo_foundation-0.3.31.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
138
+ maleo_foundation-0.3.31.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
139
+ maleo_foundation-0.3.31.dist-info/RECORD,,