maleo-foundation 0.3.54__tar.gz → 0.3.57__tar.gz
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-0.3.54 → maleo_foundation-0.3.57}/PKG-INFO +1 -1
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/enums.py +58 -18
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/service.py +11 -9
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/middlewares/authentication.py +2 -2
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/responses.py +60 -14
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/result.py +72 -8
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/cache/redis.py +3 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/client/maleo.py +4 -0
- maleo_foundation-0.3.57/maleo_foundation/models/transfers/results/client/controllers/http.py +41 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/client/service.py +1 -5
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/service/general.py +1 -5
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/__init__.py +0 -2
- maleo_foundation-0.3.57/maleo_foundation/utils/exceptions/__init__.py +0 -0
- maleo_foundation-0.3.57/maleo_foundation/utils/exceptions/client.py +221 -0
- maleo_foundation-0.3.57/maleo_foundation/utils/exceptions/request.py +38 -0
- maleo_foundation-0.3.57/maleo_foundation/utils/exceptions/service.py +221 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation.egg-info/PKG-INFO +1 -1
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation.egg-info/SOURCES.txt +4 -1
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/pyproject.toml +1 -1
- maleo_foundation-0.3.54/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -37
- maleo_foundation-0.3.54/maleo_foundation/utils/exceptions.py +0 -158
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/README.md +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/authentication.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/authorization.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/manager.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/encryption/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/encryption/aes.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/encryption/rsa.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/hash/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/hash/bcrypt.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/hash/hmac.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/hash/sha256.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/key.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/signature.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/client/services/token.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/constants.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/client.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/encryption/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/encryption/aes.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/encryption/rsa.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/general.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/hash.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/key.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/service.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/signature.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/expanded_types/token.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/extended_types.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/cache.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/base.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/google/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/google/base.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/google/parameter.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/google/secret.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/google/storage.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/google/subscription.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/client/maleo.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/configuration.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/credential.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/db.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/managers/middleware.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/middlewares/base.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/middlewares/cors.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/encryption.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/general.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/hash.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/key.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/parameter.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/signature.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/token.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/table.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/cache/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/client/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/database.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/middleware.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/configurations/service.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/credentials.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/data.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/database.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/key.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/request.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/settings.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/signature.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/general/token.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/client.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/encryption/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/encryption/aes.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/encryption/rsa.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/general.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/hash/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/hash/bcrypt.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/hash/hmac.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/hash/sha256.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/key.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/service.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/signature.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/parameters/token.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/encryption/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/encryption/aes.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/encryption/rsa.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/hash.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/key.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/signature.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/transfers/results/token.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/rest_controller_result.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/types.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/cache.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/client.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/controller.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/dependencies/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/dependencies/auth.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/dependencies/context.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/extractor.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/formatter/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/formatter/case.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/loaders/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/loaders/credential/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/loaders/credential/google.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/loaders/json.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/loaders/key/__init__.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/loaders/key/rsa.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/loaders/yaml.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/logging.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/merger.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/query.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/repository.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/utils/searcher.py +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation.egg-info/dependency_links.txt +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation.egg-info/requires.txt +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation.egg-info/top_level.txt +0 -0
- {maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/setup.cfg +0 -0
@@ -67,19 +67,69 @@ class BaseEnums:
|
|
67
67
|
REFRESH = "refresh"
|
68
68
|
ACCESS = "access"
|
69
69
|
|
70
|
-
class
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
class ExceptionType(StrEnum):
|
71
|
+
TIMEOUT = "timeout"
|
72
|
+
UNAUTHORIZED = "unauthorized"
|
73
|
+
FORBIDDEN = "forbidden"
|
74
|
+
NOT_FOUND = "not_found"
|
75
|
+
VALIDATION = "validation"
|
76
|
+
INTERNAL = "internal"
|
77
|
+
UNAVAILABLE = "unavailable"
|
78
|
+
|
79
|
+
class OperationOrigin(StrEnum):
|
80
|
+
SERVICE = "service"
|
81
|
+
CLIENT = "client"
|
75
82
|
|
76
|
-
class
|
77
|
-
|
78
|
-
|
83
|
+
class ServiceOperationLayer(StrEnum):
|
84
|
+
ROUTER = "router"
|
85
|
+
CONTROLLER = "controller"
|
86
|
+
SERVICE = "service"
|
87
|
+
REPOSITORY = "repository"
|
88
|
+
|
89
|
+
class ClientOperationLayer(StrEnum):
|
90
|
+
CONTROLLER = "controller"
|
91
|
+
SERVICE = "service"
|
92
|
+
|
93
|
+
class OperationLayer(StrEnum):
|
94
|
+
ROUTER = "router"
|
95
|
+
CONTROLLER = "controller"
|
96
|
+
SERVICE = "service"
|
97
|
+
REPOSITORY = "repository"
|
98
|
+
|
99
|
+
class ServiceOperationTarget(StrEnum):
|
100
|
+
CACHE = "cache"
|
101
|
+
DATABASE = "database"
|
102
|
+
MICROSERVICE = "microservice"
|
103
|
+
THIRD_PARTY = "third_party"
|
104
|
+
|
105
|
+
class ClientOperationTarget(StrEnum):
|
106
|
+
CACHE = "cache"
|
107
|
+
CONTROLLER = "controller"
|
108
|
+
|
109
|
+
class OperationTarget(StrEnum):
|
110
|
+
CACHE = "cache"
|
111
|
+
CONTROLLER = "controller"
|
112
|
+
DATABASE = "database"
|
113
|
+
MICROSERVICE = "microservice"
|
114
|
+
THIRD_PARTY = "third_party"
|
79
115
|
|
80
116
|
class OperationType(StrEnum):
|
81
117
|
CREATE = "create"
|
118
|
+
READ = "read"
|
82
119
|
UPDATE = "update"
|
120
|
+
DELETE = "delete"
|
121
|
+
|
122
|
+
class CreateType(StrEnum):
|
123
|
+
CREATE = "create"
|
124
|
+
RESTORE = "restore"
|
125
|
+
|
126
|
+
class UpdateType(StrEnum):
|
127
|
+
DATA = "data"
|
128
|
+
STATUS = "status"
|
129
|
+
|
130
|
+
class StatusUpdateType(StrEnum):
|
131
|
+
ACTIVATE = "activate"
|
132
|
+
DEACTIVATE = "deactivate"
|
83
133
|
RESTORE = "restore"
|
84
134
|
DELETE = "delete"
|
85
135
|
|
@@ -167,13 +217,3 @@ class BaseEnums:
|
|
167
217
|
EXP_1WK = int(1 * 7 * 24 * 60 * 60)
|
168
218
|
EXP_2WK = int(2 * 7 * 24 * 60 * 60)
|
169
219
|
EXP_1MO = int(1 * 30 * 24 * 60 * 60)
|
170
|
-
|
171
|
-
class ServiceDataSource(StrEnum):
|
172
|
-
CACHE = "cache"
|
173
|
-
DATABASE = "database"
|
174
|
-
MICROSERVICE = "microservice"
|
175
|
-
THIRD_PARTY = "third_party"
|
176
|
-
|
177
|
-
class ClientDataSource(StrEnum):
|
178
|
-
CACHE = "cache"
|
179
|
-
REQUEST = "request"
|
@@ -28,7 +28,7 @@ from maleo_foundation.managers.client.google.storage import GoogleCloudStorage
|
|
28
28
|
from maleo_foundation.managers.client.google.secret import GoogleSecretManager
|
29
29
|
from maleo_foundation.managers.middleware import MiddlewareManager
|
30
30
|
from maleo_foundation.types import BaseTypes
|
31
|
-
from maleo_foundation.utils.exceptions import
|
31
|
+
from maleo_foundation.utils.exceptions.request import BaseRequestExceptions
|
32
32
|
from maleo_foundation.utils.logging import (
|
33
33
|
SimpleConfig,
|
34
34
|
ApplicationLogger,
|
@@ -52,7 +52,7 @@ class ServiceManager:
|
|
52
52
|
self._db_metadata = db_metadata # * Declare DB Metadata
|
53
53
|
self._log_config = log_config # * Declare log config
|
54
54
|
self._settings = (
|
55
|
-
settings if settings is not None else Settings()
|
55
|
+
settings if settings is not None else Settings() # type: ignore
|
56
56
|
) # * Initialize settings
|
57
57
|
|
58
58
|
# * Disable google cloud logging if environment is local
|
@@ -244,13 +244,18 @@ class ServiceManager:
|
|
244
244
|
u_u=self.maleo_credentials.username,
|
245
245
|
u_e=self.maleo_credentials.email,
|
246
246
|
u_ut="service",
|
247
|
+
o_i=None,
|
248
|
+
o_uu=None,
|
249
|
+
o_k=None,
|
250
|
+
o_ot=None,
|
251
|
+
uor=None,
|
247
252
|
exp_in=1,
|
248
253
|
)
|
249
254
|
parameters = MaleoFoundationTokenParametersTransfers.Encode(
|
250
255
|
key=self._keys.private, password=self._keys.password, payload=payload
|
251
256
|
)
|
252
257
|
result = self._foundation.services.token.encode(parameters=parameters)
|
253
|
-
return result.data.token if result.success else None
|
258
|
+
return result.data.token if result.success and result.data is not None else None
|
254
259
|
|
255
260
|
def create_app(
|
256
261
|
self,
|
@@ -263,7 +268,7 @@ class ServiceManager:
|
|
263
268
|
self._app = FastAPI(
|
264
269
|
title=self.configurations.service.name,
|
265
270
|
version=version,
|
266
|
-
lifespan=lifespan,
|
271
|
+
lifespan=lifespan, # type: ignore
|
267
272
|
root_path=root_path,
|
268
273
|
)
|
269
274
|
self._loggers.application.info("FastAPI application created successfully")
|
@@ -284,11 +289,11 @@ class ServiceManager:
|
|
284
289
|
self._loggers.application.info("Adding exception handlers")
|
285
290
|
self._app.add_exception_handler(
|
286
291
|
exc_class_or_status_code=RequestValidationError,
|
287
|
-
handler=
|
292
|
+
handler=BaseRequestExceptions.validation_exception_handler, # type: ignore
|
288
293
|
)
|
289
294
|
self._app.add_exception_handler(
|
290
295
|
exc_class_or_status_code=HTTPException,
|
291
|
-
handler=
|
296
|
+
handler=BaseRequestExceptions.http_exception_handler, # type: ignore
|
292
297
|
)
|
293
298
|
self._loggers.application.info("Exception handlers added successfully")
|
294
299
|
|
@@ -307,10 +312,8 @@ class ServiceManager:
|
|
307
312
|
self._loggers.application.info("Disposing service manager")
|
308
313
|
if self._redis is not None:
|
309
314
|
await self._redis.close()
|
310
|
-
self._redis = None
|
311
315
|
if self._database is not None:
|
312
316
|
self._database.dispose()
|
313
|
-
self._database = None
|
314
317
|
self._loggers.application.info("Service manager disposed successfully")
|
315
318
|
if self._loggers is not None:
|
316
319
|
self._loggers.application.info("Disposing logger")
|
@@ -319,4 +322,3 @@ class ServiceManager:
|
|
319
322
|
self._loggers.database.dispose()
|
320
323
|
self._loggers.middleware.info("Disposing logger")
|
321
324
|
self._loggers.middleware.dispose()
|
322
|
-
self._loggers = None
|
{maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/middlewares/authentication.py
RENAMED
@@ -10,7 +10,7 @@ from maleo_foundation.models.schemas import BaseGeneralSchemas
|
|
10
10
|
from maleo_foundation.models.transfers.parameters.token import (
|
11
11
|
MaleoFoundationTokenParametersTransfers,
|
12
12
|
)
|
13
|
-
from maleo_foundation.utils.exceptions import
|
13
|
+
from maleo_foundation.utils.exceptions.request import BaseRequestExceptions
|
14
14
|
|
15
15
|
|
16
16
|
class Backend(AuthenticationBackend):
|
@@ -100,5 +100,5 @@ def add_authentication_middleware(
|
|
100
100
|
app.add_middleware(
|
101
101
|
AuthenticationMiddleware,
|
102
102
|
backend=Backend(keys, maleo_foundation),
|
103
|
-
on_error=
|
103
|
+
on_error=BaseRequestExceptions.authentication_error_handler, # type: ignore
|
104
104
|
)
|
@@ -1,18 +1,48 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from fastapi import status
|
3
|
-
from pydantic import Field, model_validator
|
4
|
-
from typing import Dict, Type, Union
|
5
|
-
from maleo_foundation.models.schemas.result import BaseResultSchemas
|
3
|
+
from pydantic import BaseModel, Field, model_validator
|
4
|
+
from typing import Any, Dict, Optional, Type, Union
|
5
|
+
from maleo_foundation.models.schemas.result import BaseResultSchemas, ResultMetadata
|
6
6
|
from maleo_foundation.types import BaseTypes
|
7
7
|
|
8
8
|
|
9
9
|
class BaseResponses:
|
10
|
-
|
10
|
+
# * ----- ----- ----- Base ----- ----- ----- *#
|
11
|
+
class Base(BaseModel):
|
12
|
+
success: bool = Field(..., description="Success status")
|
13
|
+
code: BaseTypes.OptionalString = Field(None, description="Optional result code")
|
14
|
+
message: BaseTypes.OptionalString = Field(None, description="Optional message")
|
15
|
+
description: BaseTypes.OptionalString = Field(
|
16
|
+
None, description="Optional description"
|
17
|
+
)
|
18
|
+
data: Any = Field(..., description="Data")
|
19
|
+
metadata: Optional[ResultMetadata] = Field(
|
20
|
+
None, description="Optional metadata"
|
21
|
+
)
|
22
|
+
other: BaseTypes.OptionalAny = Field(
|
23
|
+
None, description="Optional other information"
|
24
|
+
)
|
25
|
+
|
26
|
+
# * ----- ----- ----- Intermediary ----- ----- ----- *#
|
27
|
+
class Fail(Base):
|
28
|
+
success: BaseTypes.LiteralFalse = Field(False, description="Success status") # type: ignore
|
29
|
+
code: str = "MAL-FAI-001" # type: ignore
|
30
|
+
message: str = "Fail result" # type: ignore
|
31
|
+
description: str = "Operation failed." # type: ignore
|
32
|
+
data: None = Field(None, description="No data")
|
11
33
|
other: BaseTypes.OptionalAny = Field(
|
12
34
|
"Please try again later or contact administrator.",
|
13
35
|
description="Response's other information",
|
14
36
|
)
|
15
37
|
|
38
|
+
class Success(Base):
|
39
|
+
success: BaseTypes.LiteralTrue = Field(True, description="Success status") # type: ignore
|
40
|
+
code: str = "MAL-SCS-001" # type: ignore
|
41
|
+
message: str = "Success result" # type: ignore
|
42
|
+
description: str = "Operation succeeded." # type: ignore
|
43
|
+
data: Any = Field(..., description="Data")
|
44
|
+
|
45
|
+
# * ----- ----- ----- Derived ----- ----- ----- *#
|
16
46
|
class BadRequest(Fail):
|
17
47
|
code: str = "MAL-BDR-001"
|
18
48
|
message: str = "Bad Request"
|
@@ -83,16 +113,32 @@ class BaseResponses:
|
|
83
113
|
message: str = "Resource not found"
|
84
114
|
description: str = "The requested resource can not be found."
|
85
115
|
|
86
|
-
class NoData(
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
class
|
93
|
-
|
94
|
-
|
95
|
-
|
116
|
+
class NoData(Success):
|
117
|
+
code: str = "MAL-NDT-001"
|
118
|
+
message: str = "No data found"
|
119
|
+
description: str = "No data found in the requested resource."
|
120
|
+
data: None = Field(None, description="No data")
|
121
|
+
|
122
|
+
class SingleData(Success):
|
123
|
+
code: str = "MAL-SGD-001"
|
124
|
+
message: str = "Single data found"
|
125
|
+
description: str = "Requested data found in database."
|
126
|
+
data: Any = Field(..., description="Fetched single data")
|
127
|
+
|
128
|
+
class UnpaginatedMultipleData(Success):
|
129
|
+
code: str = "MAL-MTD-001"
|
130
|
+
message: str = "Multiple unpaginated data found"
|
131
|
+
description: str = "Requested unpaginated data found in database."
|
132
|
+
data: BaseTypes.ListOfAny = Field(..., description="Unpaginated multiple data")
|
133
|
+
|
134
|
+
class PaginatedMultipleData(Success):
|
135
|
+
code: str = "MAL-MTD-002"
|
136
|
+
message: str = "Multiple paginated data found"
|
137
|
+
description: str = "Requested paginated data found in database."
|
138
|
+
total_data: int = Field(..., ge=0, description="Total data count")
|
139
|
+
pagination: BaseResultSchemas.ExtendedPagination = Field(
|
140
|
+
..., description="Pagination metadata"
|
141
|
+
)
|
96
142
|
page: int = Field(
|
97
143
|
1, ge=1, description="Page number, must be >= 1.", exclude=True
|
98
144
|
)
|
{maleo_foundation-0.3.54 → maleo_foundation-0.3.57}/maleo_foundation/models/schemas/result.py
RENAMED
@@ -1,6 +1,7 @@
|
|
1
1
|
from datetime import datetime, timezone
|
2
|
-
from pydantic import BaseModel, Field
|
3
|
-
from typing import Dict, Optional,
|
2
|
+
from pydantic import BaseModel, Field, model_validator
|
3
|
+
from typing import Any, Dict, Optional, Self, Union
|
4
|
+
from maleo_foundation.enums import BaseEnums
|
4
5
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
5
6
|
from maleo_foundation.types import BaseTypes
|
6
7
|
|
@@ -30,6 +31,29 @@ class BaseResultSchemas:
|
|
30
31
|
# * ----- ----- ----- Base ----- ----- ----- *#
|
31
32
|
class Base(BaseModel):
|
32
33
|
success: bool = Field(..., description="Success status")
|
34
|
+
exception: Optional[BaseEnums.ExceptionType] = Field(
|
35
|
+
None, description="Exception type (optional)"
|
36
|
+
)
|
37
|
+
timestamp: datetime = Field(datetime.now(timezone.utc), description="Timestamp")
|
38
|
+
origin: BaseEnums.OperationOrigin = Field(..., description="Operation origin")
|
39
|
+
layer: BaseEnums.OperationLayer = Field(..., description="Operation layer")
|
40
|
+
target: Optional[BaseEnums.OperationTarget] = Field(
|
41
|
+
None, description="Operation target (optional)"
|
42
|
+
)
|
43
|
+
environment: Optional[BaseEnums.EnvironmentType] = Field(
|
44
|
+
None, description="Operation target environment (optional)"
|
45
|
+
)
|
46
|
+
resource: str = Field(..., description="Resource name")
|
47
|
+
operation: BaseEnums.OperationType = Field(..., description="Operation type")
|
48
|
+
create_type: Optional[BaseEnums.CreateType] = Field(
|
49
|
+
None, description="Create type (optional)"
|
50
|
+
)
|
51
|
+
update_type: Optional[BaseEnums.UpdateType] = Field(
|
52
|
+
None, description="Update type (optional)"
|
53
|
+
)
|
54
|
+
status_update_type: Optional[BaseEnums.StatusUpdateType] = Field(
|
55
|
+
None, description="Status update type (optional)"
|
56
|
+
)
|
33
57
|
code: BaseTypes.OptionalString = Field(None, description="Optional result code")
|
34
58
|
message: BaseTypes.OptionalString = Field(None, description="Optional message")
|
35
59
|
description: BaseTypes.OptionalString = Field(
|
@@ -43,9 +67,52 @@ class BaseResultSchemas:
|
|
43
67
|
None, description="Optional other information"
|
44
68
|
)
|
45
69
|
|
70
|
+
@model_validator(mode="after")
|
71
|
+
def verify_fields(self) -> Self:
|
72
|
+
"""Verify that the required fields are set."""
|
73
|
+
if self.origin is BaseEnums.OperationOrigin.SERVICE:
|
74
|
+
if self.layer not in BaseEnums.ServiceOperationLayer:
|
75
|
+
raise ValueError(
|
76
|
+
f"Invalid layer '{self.layer}' for service operation."
|
77
|
+
)
|
78
|
+
if self.target and self.target not in BaseEnums.ServiceOperationTarget:
|
79
|
+
raise ValueError(
|
80
|
+
f"Invalid target '{self.target}' for service operation."
|
81
|
+
)
|
82
|
+
elif self.origin is BaseEnums.OperationOrigin.CLIENT:
|
83
|
+
if self.layer not in BaseEnums.ClientOperationLayer:
|
84
|
+
raise ValueError(
|
85
|
+
f"Invalid layer '{self.layer}' for client operation."
|
86
|
+
)
|
87
|
+
if self.target and self.target not in BaseEnums.ClientOperationTarget:
|
88
|
+
raise ValueError(
|
89
|
+
f"Invalid target '{self.target}' for client operation."
|
90
|
+
)
|
91
|
+
else:
|
92
|
+
raise ValueError(
|
93
|
+
f"Invalid operation origin '{self.origin}'. Must be 'service' or 'client'."
|
94
|
+
)
|
95
|
+
|
96
|
+
if self.operation is BaseEnums.OperationType.CREATE:
|
97
|
+
if self.create_type is None:
|
98
|
+
raise ValueError("Create type must be set for create operations.")
|
99
|
+
elif self.operation is BaseEnums.OperationType.UPDATE:
|
100
|
+
if self.update_type is None:
|
101
|
+
raise ValueError("Update type must be set for update operations.")
|
102
|
+
if self.update_type is BaseEnums.UpdateType.STATUS:
|
103
|
+
if self.status_update_type is None:
|
104
|
+
raise ValueError(
|
105
|
+
"Status update type must be set for status update operations."
|
106
|
+
)
|
107
|
+
|
108
|
+
return self
|
109
|
+
|
46
110
|
# * ----- ----- ----- Intermediary ----- ----- ----- *#
|
47
111
|
class Fail(Base):
|
48
112
|
success: BaseTypes.LiteralFalse = Field(False, description="Success status") # type: ignore
|
113
|
+
exception: BaseEnums.ExceptionType = Field( # type: ignore
|
114
|
+
..., description="Exception type"
|
115
|
+
)
|
49
116
|
code: str = "MAL-FAI-001" # type: ignore
|
50
117
|
message: str = "Fail result" # type: ignore
|
51
118
|
description: str = "Operation failed." # type: ignore
|
@@ -61,9 +128,11 @@ class BaseResultSchemas:
|
|
61
128
|
# * ----- ----- ----- Derived ----- ----- ----- *#
|
62
129
|
class NotFound(Fail):
|
63
130
|
code: str = "MAL-NTF-001"
|
131
|
+
exception: BaseEnums.ExceptionType = Field(
|
132
|
+
BaseEnums.ExceptionType.NOT_FOUND, description="Exception type"
|
133
|
+
)
|
64
134
|
message: str = "Resource not found"
|
65
135
|
description: str = "The requested resource can not be found."
|
66
|
-
data: None = Field(None, description="No data")
|
67
136
|
|
68
137
|
class NoData(Success):
|
69
138
|
code: str = "MAL-NDT-001"
|
@@ -94,10 +163,5 @@ class BaseResultSchemas:
|
|
94
163
|
..., description="Pagination metadata"
|
95
164
|
)
|
96
165
|
|
97
|
-
class Get(BaseModel):
|
98
|
-
accessed_at: datetime = Field(
|
99
|
-
datetime.now(tz=timezone.utc), description="Accessed at timestamp"
|
100
|
-
)
|
101
|
-
|
102
166
|
|
103
167
|
BaseResultSchemas.PaginatedMultipleData.model_rebuild()
|
@@ -19,6 +19,9 @@ class RedisCacheNamespaces(BaseModel):
|
|
19
19
|
|
20
20
|
|
21
21
|
class RedisCacheConfigurations(BaseModel):
|
22
|
+
environment: BaseEnums.EnvironmentType = Field(
|
23
|
+
..., description="Redis cache's environment"
|
24
|
+
)
|
22
25
|
ttl: Union[int, float] = Field(
|
23
26
|
BaseEnums.Expiration.EXP_5MN, description="Default TTL"
|
24
27
|
)
|
@@ -1,8 +1,12 @@
|
|
1
1
|
from pydantic import BaseModel, ConfigDict, Field
|
2
2
|
from typing import Optional
|
3
|
+
from maleo_foundation.enums import BaseEnums
|
3
4
|
|
4
5
|
|
5
6
|
class MaleoClientConfigurations(BaseModel):
|
7
|
+
environment: BaseEnums.EnvironmentType = Field(
|
8
|
+
..., description="Client's environment"
|
9
|
+
)
|
6
10
|
key: str = Field(..., description="Client's key")
|
7
11
|
name: str = Field(..., description="Client's name")
|
8
12
|
url: str = Field(..., description="Client's URL")
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from httpx import Response
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
4
|
+
from typing import Any, Self
|
5
|
+
|
6
|
+
|
7
|
+
class BaseClientHTTPControllerResults(BaseModel):
|
8
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
9
|
+
|
10
|
+
response: Response = Field(..., description="Client's HTTP Controller response")
|
11
|
+
|
12
|
+
@model_validator(mode="after")
|
13
|
+
def verify_response(self) -> Self:
|
14
|
+
"""Verify that the response is an instance of httpx.Response."""
|
15
|
+
if not isinstance(self.response, Response):
|
16
|
+
raise TypeError("Response must be an instance of httpx.Response")
|
17
|
+
return self
|
18
|
+
|
19
|
+
@property
|
20
|
+
def status_code(self) -> int:
|
21
|
+
"""Get the status code of the response."""
|
22
|
+
return self.response.status_code
|
23
|
+
|
24
|
+
@property
|
25
|
+
def success(self) -> bool:
|
26
|
+
"""Get the success status of the response."""
|
27
|
+
return self.response.is_success
|
28
|
+
|
29
|
+
@property
|
30
|
+
def content(self) -> Any:
|
31
|
+
"""Get the content of the response."""
|
32
|
+
# * Determine content type and parse accordingly
|
33
|
+
content_type: str = self.response.headers.get("content-type", "")
|
34
|
+
content_type = content_type.lower()
|
35
|
+
if "application/json" in content_type:
|
36
|
+
content = self.response.json()
|
37
|
+
elif "text/" in content_type or "application/xml" in content_type:
|
38
|
+
content = self.response.text
|
39
|
+
else:
|
40
|
+
content = self.response.content # * Raw bytes for unknown types
|
41
|
+
return content
|
@@ -1,6 +1,5 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from pydantic import
|
3
|
-
from maleo_foundation.enums import BaseEnums
|
2
|
+
from pydantic import model_validator
|
4
3
|
from maleo_foundation.models.schemas.result import BaseResultSchemas
|
5
4
|
|
6
5
|
|
@@ -34,6 +33,3 @@ class BaseClientServiceResultsTransfers:
|
|
34
33
|
values["total_data"] = pagination.total_data
|
35
34
|
|
36
35
|
return values
|
37
|
-
|
38
|
-
class Get(BaseResultSchemas.Get):
|
39
|
-
source: BaseEnums.ClientDataSource = Field(..., description="Data source")
|
@@ -1,6 +1,5 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from pydantic import
|
3
|
-
from maleo_foundation.enums import BaseEnums
|
2
|
+
from pydantic import model_validator
|
4
3
|
from maleo_foundation.models.schemas.result import BaseResultSchemas
|
5
4
|
|
6
5
|
|
@@ -44,6 +43,3 @@ class BaseServiceGeneralResultsTransfers:
|
|
44
43
|
total_pages=total_pages,
|
45
44
|
)
|
46
45
|
return values
|
47
|
-
|
48
|
-
class Get(BaseResultSchemas.Get):
|
49
|
-
source: BaseEnums.ServiceDataSource = Field(..., description="Data source")
|
@@ -1,6 +1,5 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from .formatter import BaseFormatter
|
3
|
-
from .exceptions import BaseExceptions
|
4
3
|
from .loaders import BaseLoaders
|
5
4
|
from .controller import BaseControllerUtils
|
6
5
|
from .query import BaseQueryUtils
|
@@ -8,7 +7,6 @@ from .query import BaseQueryUtils
|
|
8
7
|
|
9
8
|
class BaseUtils:
|
10
9
|
Formatter = BaseFormatter
|
11
|
-
Exceptions = BaseExceptions
|
12
10
|
Loaders = BaseLoaders
|
13
11
|
Controller = BaseControllerUtils
|
14
12
|
Query = BaseQueryUtils
|
File without changes
|