maleo-foundation 0.1.88__py3-none-any.whl → 0.1.90__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/client/manager.py +4 -5
- maleo_foundation/managers/client/maleo.py +4 -9
- maleo_foundation/managers/service.py +11 -2
- {maleo_foundation-0.1.88.dist-info → maleo_foundation-0.1.90.dist-info}/METADATA +1 -1
- {maleo_foundation-0.1.88.dist-info → maleo_foundation-0.1.90.dist-info}/RECORD +7 -7
- {maleo_foundation-0.1.88.dist-info → maleo_foundation-0.1.90.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.1.88.dist-info → maleo_foundation-0.1.90.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,5 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from maleo_foundation.managers.client.
|
3
|
-
from maleo_foundation.managers.service import ServiceManager
|
2
|
+
from maleo_foundation.managers.client.base import ClientManager
|
4
3
|
from maleo_foundation.types import BaseTypes
|
5
4
|
from maleo_foundation.utils.logging import SimpleConfig
|
6
5
|
from maleo_foundation.client.services.encryption import (
|
@@ -21,11 +20,11 @@ from maleo_foundation.client.services import (
|
|
21
20
|
MaleoFoundationServices
|
22
21
|
)
|
23
22
|
|
24
|
-
class MaleoFoundationClientManager(
|
25
|
-
def __init__(self,
|
23
|
+
class MaleoFoundationClientManager(ClientManager):
|
24
|
+
def __init__(self, log_config:SimpleConfig, service_key:BaseTypes.OptionalString=None):
|
26
25
|
key = "maleo-foundation"
|
27
26
|
name = "MaleoFoundation"
|
28
|
-
super().__init__(key, name,
|
27
|
+
super().__init__(key, name, log_config, service_key)
|
29
28
|
self._initialize_services()
|
30
29
|
self._logger.info("Client manager initialized successfully")
|
31
30
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
from pydantic import Field
|
2
|
-
from maleo_foundation.types import BaseTypes
|
1
|
+
from pydantic import BaseModel, Field
|
3
2
|
from maleo_foundation.managers.client.base import ClientManager, ClientHTTPControllerManager, ClientControllerManagers, ClientHTTPController, ClientServiceControllers, ClientControllers
|
4
3
|
from maleo_foundation.managers.service import ServiceManager
|
5
4
|
|
@@ -23,8 +22,8 @@ class MaleoClientManager(ClientManager):
|
|
23
22
|
self,
|
24
23
|
key:str,
|
25
24
|
name:str,
|
26
|
-
|
27
|
-
|
25
|
+
url:str,
|
26
|
+
service_manager:ServiceManager
|
28
27
|
):
|
29
28
|
self._url = url
|
30
29
|
self._service_manager = service_manager
|
@@ -35,8 +34,6 @@ class MaleoClientManager(ClientManager):
|
|
35
34
|
return self._service_manager
|
36
35
|
|
37
36
|
def _initialize_controllers(self) -> None:
|
38
|
-
if self._url is None:
|
39
|
-
raise ValueError("'URL' must not be None if initializing controllers")
|
40
37
|
#* Initialize managers
|
41
38
|
http_controller_manager = ClientHTTPControllerManager(url=self._url)
|
42
39
|
self._controller_managers = ClientControllerManagers(http=http_controller_manager)
|
@@ -50,7 +47,5 @@ class MaleoClientManager(ClientManager):
|
|
50
47
|
|
51
48
|
async def dispose(self) -> None:
|
52
49
|
self._logger.info("Disposing client manager")
|
53
|
-
|
54
|
-
if self._controller_managers.http is not None:
|
55
|
-
await self._controller_managers.http.dispose()
|
50
|
+
await self._controller_managers.http.dispose()
|
56
51
|
self._logger.info("Client manager disposed successfully")
|
@@ -8,6 +8,7 @@ from starlette.exceptions import HTTPException
|
|
8
8
|
from starlette.types import Lifespan, AppType
|
9
9
|
from sqlalchemy import MetaData
|
10
10
|
from typing import Optional
|
11
|
+
from maleo_foundation.client.manager import MaleoFoundationClientManager
|
11
12
|
from maleo_foundation.enums import BaseEnums
|
12
13
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
13
14
|
from maleo_foundation.models.transfers.general.token import MaleoFoundationTokenGeneralTransfers
|
@@ -133,6 +134,7 @@ class ServiceManager:
|
|
133
134
|
self._load_keys()
|
134
135
|
self._initialize_loggers()
|
135
136
|
self._initialize_db()
|
137
|
+
self._initialize_foundation()
|
136
138
|
|
137
139
|
@property
|
138
140
|
def log_config(self) -> SimpleConfig:
|
@@ -228,6 +230,13 @@ class ServiceManager:
|
|
228
230
|
def database(self) -> DatabaseManager:
|
229
231
|
return self._database
|
230
232
|
|
233
|
+
def _initialize_foundation(self) -> None:
|
234
|
+
self._foundation = MaleoFoundationClientManager(log_config=self._log_config, service_key=self._settings.SERVICE_KEY)
|
235
|
+
|
236
|
+
@property
|
237
|
+
def foundation(self) -> MaleoFoundationClientManager:
|
238
|
+
return self._foundation
|
239
|
+
|
231
240
|
@property
|
232
241
|
def token(self) -> str:
|
233
242
|
payload = MaleoFoundationTokenGeneralTransfers.BaseEncodePayload(
|
@@ -237,7 +246,7 @@ class ServiceManager:
|
|
237
246
|
u_ut="service"
|
238
247
|
)
|
239
248
|
parameters = MaleoFoundationTokenParametersTransfers.Encode(key=self._keys.private, password=self._keys.password, payload=payload)
|
240
|
-
result = self.
|
249
|
+
result = self._foundation.services.token.encode(parameters=parameters)
|
241
250
|
if not result.success:
|
242
251
|
raise RuntimeError("Failed encoding payload into token")
|
243
252
|
return result.data.token
|
@@ -255,7 +264,7 @@ class ServiceManager:
|
|
255
264
|
configurations=self._configs.middleware,
|
256
265
|
keys=self._keys,
|
257
266
|
loggers=self._loggers.middleware,
|
258
|
-
maleo_foundation=self.
|
267
|
+
maleo_foundation=self._foundation
|
259
268
|
)
|
260
269
|
self._middleware.add_all()
|
261
270
|
self._loggers.application.info("Middlewares addedd successfully")
|
@@ -5,7 +5,7 @@ maleo_foundation/enums.py,sha256=uvwl3dl2r6BoJMEbtSETiLoyJubHup9Lc7VOg7w7zQo,294
|
|
5
5
|
maleo_foundation/extended_types.py,sha256=pIKt-_9tby4rmune3fmWcCW_mohaNRh_1lywBmdc-L4,301
|
6
6
|
maleo_foundation/types.py,sha256=aKXnIgEhYGSfFqNMGLc4qIKGkINBRpkOo9R9cb2CbwI,2414
|
7
7
|
maleo_foundation/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
maleo_foundation/client/manager.py,sha256=
|
8
|
+
maleo_foundation/client/manager.py,sha256=pFWLFYW4eE9MLyFmFS05IgnMBdqqUHbdyTkSbnBtm5E,2620
|
9
9
|
maleo_foundation/client/services/__init__.py,sha256=uIBnAeQ9a2otQbUAbKBQfYrkEUugXjxXoV8W5QYHuic,1051
|
10
10
|
maleo_foundation/client/services/key.py,sha256=Av8OFEJO8-Chlu-lRzR4or1qkJ0ahxtiHwkqF4ktDD4,5537
|
11
11
|
maleo_foundation/client/services/signature.py,sha256=brEnNPrkeChx0niDgAYCI2HeANQGHpPI6a0lARGCbZ4,4498
|
@@ -32,10 +32,10 @@ maleo_foundation/expanded_types/encryption/rsa.py,sha256=MuhB_DGrjnsl4t96W4pKuCt
|
|
32
32
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
maleo_foundation/managers/db.py,sha256=Pn5EZ-c1Hy6-BihN7KokHJWmBIt3Ty96fZ0zF-srtF4,5208
|
34
34
|
maleo_foundation/managers/middleware.py,sha256=ODIQU1Hpu-Xempjjo_VRbVtxiD5oi74mNuoWuDawRh0,4250
|
35
|
-
maleo_foundation/managers/service.py,sha256=
|
35
|
+
maleo_foundation/managers/service.py,sha256=hPimC1VYQv2e8kZz6omCKWCtnvEnY5Wa1BdqxtFLoo8,15419
|
36
36
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
maleo_foundation/managers/client/base.py,sha256=5z9l2GN4QASF0-Lft8o5QQ3SRPXqeNZNT1S1CgaE764,4384
|
38
|
-
maleo_foundation/managers/client/maleo.py,sha256
|
38
|
+
maleo_foundation/managers/client/maleo.py,sha256=iCM47TLL-RSQ2FkTmHVPdsb2JCd1LebMx6OJvIr4vCQ,2035
|
39
39
|
maleo_foundation/managers/client/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
40
|
maleo_foundation/managers/client/google/base.py,sha256=eIdd6C2BFIu4EyZ1j017VZaJn_nSTPGFftBwQmVAUDA,1366
|
41
41
|
maleo_foundation/managers/client/google/secret.py,sha256=Ski1CHYeA8vjSk2Oc2Pf4CfFrzT_RcA6NEZwza7gM7Y,4464
|
@@ -107,7 +107,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
107
107
|
maleo_foundation/utils/loaders/credential/google.py,sha256=deksZXT5wPhEsSMHbZ3x05WHXxCjLDt76Ns-1Tmhp7g,948
|
108
108
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
109
109
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
110
|
-
maleo_foundation-0.1.
|
111
|
-
maleo_foundation-0.1.
|
112
|
-
maleo_foundation-0.1.
|
113
|
-
maleo_foundation-0.1.
|
110
|
+
maleo_foundation-0.1.90.dist-info/METADATA,sha256=s6loO-JepMDGZsq5r3d5SxNnCIxouIhrbAXWBImrRp4,3419
|
111
|
+
maleo_foundation-0.1.90.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
112
|
+
maleo_foundation-0.1.90.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
113
|
+
maleo_foundation-0.1.90.dist-info/RECORD,,
|
File without changes
|
File without changes
|