orionis 0.405.0__py3-none-any.whl → 0.406.0__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.
- orionis/console/base/command.py +57 -50
- orionis/console/base/contracts/command.py +68 -0
- orionis/console/dynamic/contracts/progress_bar.py +3 -3
- orionis/console/dynamic/progress_bar.py +8 -8
- orionis/console/output/console.py +8 -2
- orionis/console/output/contracts/console.py +1 -1
- orionis/container/container.py +2 -2
- orionis/container/context/scope.py +4 -1
- orionis/container/contracts/service_provider.py +2 -2
- orionis/container/entities/binding.py +31 -44
- orionis/container/enums/lifetimes.py +22 -1
- orionis/container/facades/facade.py +1 -2
- orionis/container/providers/service_provider.py +2 -2
- orionis/foundation/application.py +542 -248
- orionis/foundation/config/app/entities/app.py +107 -90
- orionis/foundation/config/auth/entities/auth.py +4 -33
- orionis/foundation/config/cache/entities/cache.py +18 -41
- orionis/foundation/config/cache/entities/file.py +8 -35
- orionis/foundation/config/cache/entities/stores.py +17 -38
- orionis/foundation/config/cors/entities/cors.py +41 -54
- orionis/foundation/config/database/entities/connections.py +40 -56
- orionis/foundation/config/database/entities/database.py +11 -38
- orionis/foundation/config/database/entities/mysql.py +48 -76
- orionis/foundation/config/database/entities/oracle.py +30 -57
- orionis/foundation/config/database/entities/pgsql.py +45 -61
- orionis/foundation/config/database/entities/sqlite.py +26 -53
- orionis/foundation/config/filesystems/entitites/aws.py +28 -49
- orionis/foundation/config/filesystems/entitites/disks.py +27 -47
- orionis/foundation/config/filesystems/entitites/filesystems.py +15 -37
- orionis/foundation/config/filesystems/entitites/local.py +9 -35
- orionis/foundation/config/filesystems/entitites/public.py +14 -41
- orionis/foundation/config/logging/entities/channels.py +56 -86
- orionis/foundation/config/logging/entities/chunked.py +9 -9
- orionis/foundation/config/logging/entities/daily.py +8 -8
- orionis/foundation/config/logging/entities/hourly.py +6 -6
- orionis/foundation/config/logging/entities/logging.py +12 -18
- orionis/foundation/config/logging/entities/monthly.py +7 -7
- orionis/foundation/config/logging/entities/stack.py +5 -5
- orionis/foundation/config/logging/entities/weekly.py +6 -6
- orionis/foundation/config/mail/entities/file.py +9 -36
- orionis/foundation/config/mail/entities/mail.py +22 -40
- orionis/foundation/config/mail/entities/mailers.py +29 -44
- orionis/foundation/config/mail/entities/smtp.py +47 -48
- orionis/foundation/config/queue/entities/brokers.py +19 -41
- orionis/foundation/config/queue/entities/database.py +24 -46
- orionis/foundation/config/queue/entities/queue.py +28 -40
- orionis/foundation/config/roots/paths.py +272 -468
- orionis/foundation/config/session/entities/session.py +23 -53
- orionis/foundation/config/startup.py +165 -135
- orionis/foundation/config/testing/entities/testing.py +137 -122
- orionis/foundation/config/testing/enums/__init__.py +6 -2
- orionis/foundation/config/testing/enums/drivers.py +16 -0
- orionis/foundation/config/testing/enums/verbosity.py +18 -0
- orionis/foundation/contracts/application.py +152 -362
- orionis/foundation/providers/console_provider.py +24 -2
- orionis/foundation/providers/dumper_provider.py +24 -2
- orionis/foundation/providers/logger_provider.py +24 -2
- orionis/foundation/providers/path_resolver_provider.py +25 -2
- orionis/foundation/providers/progress_bar_provider.py +24 -2
- orionis/foundation/providers/testing_provider.py +39 -0
- orionis/foundation/providers/workers_provider.py +24 -2
- orionis/metadata/framework.py +1 -1
- orionis/services/environment/helpers/functions.py +1 -2
- orionis/services/environment/key/__init__.py +0 -0
- orionis/services/environment/key/key_generator.py +37 -0
- orionis/support/entities/__init__.py +0 -0
- orionis/support/entities/base.py +104 -0
- orionis/support/facades/testing.py +15 -0
- orionis/support/facades/workers.py +1 -1
- orionis/test/cases/asynchronous.py +0 -11
- orionis/test/cases/synchronous.py +0 -9
- orionis/test/contracts/dumper.py +11 -4
- orionis/test/contracts/kernel.py +5 -110
- orionis/test/contracts/logs.py +27 -65
- orionis/test/contracts/printer.py +16 -128
- orionis/test/contracts/test_result.py +100 -0
- orionis/test/contracts/unit_test.py +87 -150
- orionis/test/core/unit_test.py +608 -554
- orionis/test/entities/result.py +22 -2
- orionis/test/enums/__init__.py +0 -2
- orionis/test/enums/status.py +14 -9
- orionis/test/exceptions/config.py +9 -1
- orionis/test/exceptions/failure.py +34 -11
- orionis/test/exceptions/persistence.py +10 -2
- orionis/test/exceptions/runtime.py +9 -1
- orionis/test/exceptions/value.py +13 -1
- orionis/test/kernel.py +87 -289
- orionis/test/output/dumper.py +82 -18
- orionis/test/output/printer.py +399 -156
- orionis/test/records/logs.py +203 -82
- orionis/test/validators/__init__.py +33 -0
- orionis/test/validators/base_path.py +45 -0
- orionis/test/validators/execution_mode.py +45 -0
- orionis/test/validators/fail_fast.py +37 -0
- orionis/test/validators/folder_path.py +34 -0
- orionis/test/validators/module_name.py +31 -0
- orionis/test/validators/name_pattern.py +40 -0
- orionis/test/validators/pattern.py +36 -0
- orionis/test/validators/persistent.py +42 -0
- orionis/test/validators/persistent_driver.py +43 -0
- orionis/test/validators/print_result.py +37 -0
- orionis/test/validators/tags.py +37 -0
- orionis/test/validators/throw_exception.py +39 -0
- orionis/test/validators/verbosity.py +37 -0
- orionis/test/validators/web_report.py +35 -0
- orionis/test/validators/workers.py +31 -0
- orionis/test/view/render.py +48 -54
- {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/METADATA +1 -1
- {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/RECORD +149 -98
- tests/container/__init__.py +0 -0
- tests/container/context/__init__.py +0 -0
- tests/container/context/test_manager.py +27 -0
- tests/container/context/test_scope.py +23 -0
- tests/container/entities/__init__.py +0 -0
- tests/container/entities/test_binding.py +133 -0
- tests/container/enums/__init__.py +0 -0
- tests/container/enums/test_lifetimes.py +63 -0
- tests/container/facades/__init__.py +0 -0
- tests/container/facades/test_facade.py +61 -0
- tests/container/mocks/__init__.py +0 -0
- tests/container/mocks/mock_complex_classes.py +482 -0
- tests/container/mocks/mock_simple_classes.py +32 -0
- tests/container/providers/__init__.py +0 -0
- tests/container/providers/test_providers.py +48 -0
- tests/container/resolver/__init__.py +0 -0
- tests/container/resolver/test_resolver.py +55 -0
- tests/container/test_container.py +254 -0
- tests/container/test_singleton.py +98 -0
- tests/container/test_thread_safety.py +217 -0
- tests/container/validators/__init__.py +0 -0
- tests/container/validators/test_implements.py +140 -0
- tests/container/validators/test_is_abstract_class.py +99 -0
- tests/container/validators/test_is_callable.py +73 -0
- tests/container/validators/test_is_concrete_class.py +97 -0
- tests/container/validators/test_is_instance.py +105 -0
- tests/container/validators/test_is_not_subclass.py +117 -0
- tests/container/validators/test_is_subclass.py +115 -0
- tests/container/validators/test_is_valid_alias.py +113 -0
- tests/container/validators/test_lifetime.py +75 -0
- tests/foundation/config/testing/test_foundation_config_testing.py +1 -1
- tests/metadata/test_metadata_framework.py +18 -18
- tests/testing/test_testing_result.py +117 -117
- tests/testing/test_testing_unit.py +209 -209
- orionis/foundation/config/base.py +0 -112
- orionis/test/arguments/parser.py +0 -187
- orionis/test/contracts/parser.py +0 -43
- orionis/test/entities/arguments.py +0 -38
- orionis/test/enums/execution_mode.py +0 -16
- /orionis/{test/arguments → console/base/contracts}/__init__.py +0 -0
- /orionis/foundation/config/testing/enums/{test_mode.py → mode.py} +0 -0
- {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/WHEEL +0 -0
- {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/top_level.txt +0 -0
- {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/zip-safe +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
from dataclasses import
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
2
|
from typing import Optional
|
|
3
3
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
4
4
|
from orionis.foundation.config.session.enums import SameSitePolicy
|
|
5
5
|
from orionis.foundation.config.session.helpers.secret_key import SecretKey
|
|
6
6
|
from orionis.services.environment.env import Env
|
|
7
|
+
from orionis.support.entities.base import BaseEntity
|
|
7
8
|
|
|
8
9
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
9
|
-
class Session:
|
|
10
|
+
class Session(BaseEntity):
|
|
10
11
|
"""
|
|
11
12
|
Configuration for Starlette session middleware.
|
|
12
13
|
|
|
@@ -19,58 +20,58 @@ class Session:
|
|
|
19
20
|
https_only (bool): Restrict cookies to HTTPS. Defaults to False.
|
|
20
21
|
domain (Optional[str]): Cookie domain for cross-subdomain usage.
|
|
21
22
|
"""
|
|
23
|
+
|
|
22
24
|
secret_key: str = field(
|
|
23
|
-
|
|
24
|
-
metadata={
|
|
25
|
+
default = Env.get('APP_KEY', SecretKey.random()),
|
|
26
|
+
metadata = {
|
|
25
27
|
"description": "Secret key for signing session cookies (required).",
|
|
26
|
-
"default":
|
|
28
|
+
"default": SecretKey.random()
|
|
27
29
|
}
|
|
28
30
|
)
|
|
29
31
|
|
|
30
32
|
session_cookie: str = field(
|
|
31
|
-
|
|
32
|
-
metadata={
|
|
33
|
+
default = Env.get('SESSION_COOKIE_NAME', 'orionis_session'),
|
|
34
|
+
metadata = {
|
|
33
35
|
"description": "Name of the session cookie.",
|
|
34
|
-
"default":
|
|
36
|
+
"default": 'orionis_session'
|
|
35
37
|
}
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
max_age: Optional[int] = field(
|
|
39
|
-
|
|
40
|
-
metadata={
|
|
41
|
+
default = Env.get('SESSION_MAX_AGE', 30 * 60),
|
|
42
|
+
metadata = {
|
|
41
43
|
"description": "Session expiration in seconds. None for browser session.",
|
|
42
|
-
"default":
|
|
44
|
+
"default": 30 * 60
|
|
43
45
|
}
|
|
44
46
|
)
|
|
45
47
|
|
|
46
48
|
same_site: str | SameSitePolicy = field(
|
|
47
|
-
|
|
48
|
-
metadata={
|
|
49
|
+
default = Env.get('SESSION_SAME_SITE', SameSitePolicy.LAX.value),
|
|
50
|
+
metadata = {
|
|
49
51
|
"description": "SameSite cookie policy.",
|
|
50
|
-
"
|
|
51
|
-
"default": "lax"
|
|
52
|
+
"default": SameSitePolicy.LAX.value
|
|
52
53
|
}
|
|
53
54
|
)
|
|
54
55
|
|
|
55
56
|
path: str = field(
|
|
56
|
-
|
|
57
|
-
metadata={
|
|
57
|
+
default = Env.get('SESSION_PATH', '/'),
|
|
58
|
+
metadata = {
|
|
58
59
|
"description": "Cookie path.",
|
|
59
60
|
"default": "/"
|
|
60
61
|
}
|
|
61
62
|
)
|
|
62
63
|
|
|
63
64
|
https_only: bool = field(
|
|
64
|
-
|
|
65
|
-
metadata={
|
|
65
|
+
default = Env.get('SESSION_HTTPS_ONLY', False),
|
|
66
|
+
metadata = {
|
|
66
67
|
"description": "Restrict cookies to HTTPS.",
|
|
67
68
|
"default": False
|
|
68
69
|
}
|
|
69
70
|
)
|
|
70
71
|
|
|
71
72
|
domain: Optional[str] = field(
|
|
72
|
-
|
|
73
|
-
metadata={
|
|
73
|
+
default = Env.get('SESSION_DOMAIN'),
|
|
74
|
+
metadata = {
|
|
74
75
|
"description": "Cookie domain for cross-subdomain usage.",
|
|
75
76
|
"default": None
|
|
76
77
|
}
|
|
@@ -134,35 +135,4 @@ class Session:
|
|
|
134
135
|
if self.domain.startswith('.') or self.domain.endswith('.'):
|
|
135
136
|
raise OrionisIntegrityException("domain must not start or end with a dot")
|
|
136
137
|
if '..' in self.domain:
|
|
137
|
-
raise OrionisIntegrityException("domain must not contain consecutive dots")
|
|
138
|
-
|
|
139
|
-
def toDict(self) -> dict:
|
|
140
|
-
"""
|
|
141
|
-
Converts the Session entity instance into a dictionary.
|
|
142
|
-
|
|
143
|
-
Returns:
|
|
144
|
-
dict: A dictionary representation of the Session instance, with all fields serialized.
|
|
145
|
-
"""
|
|
146
|
-
return asdict(self)
|
|
147
|
-
|
|
148
|
-
def getFields(self):
|
|
149
|
-
"""
|
|
150
|
-
Retrieves a list of field information for the current dataclass instance.
|
|
151
|
-
|
|
152
|
-
Returns:
|
|
153
|
-
list: A list of dictionaries, each containing details about a field:
|
|
154
|
-
- name (str): The name of the field.
|
|
155
|
-
- type (type): The type of the field.
|
|
156
|
-
- default: The default value of the field, if specified; otherwise, the value from metadata or None.
|
|
157
|
-
- metadata (mapping): The metadata associated with the field.
|
|
158
|
-
"""
|
|
159
|
-
__fields = []
|
|
160
|
-
for field in fields(self):
|
|
161
|
-
__metadata = dict(field.metadata) or {}
|
|
162
|
-
__fields.append({
|
|
163
|
-
"name": field.name,
|
|
164
|
-
"type": field.type.__name__ if hasattr(field.type, '__name__') else str(field.type),
|
|
165
|
-
"default": field.default if (field.default is not None and '_MISSING_TYPE' not in str(field.default)) else __metadata.get('default', None),
|
|
166
|
-
"metadata": __metadata
|
|
167
|
-
})
|
|
168
|
-
return __fields
|
|
138
|
+
raise OrionisIntegrityException("domain must not contain consecutive dots")
|
|
@@ -1,225 +1,255 @@
|
|
|
1
|
-
from dataclasses import
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
2
|
from orionis.foundation.config.app.entities.app import App
|
|
3
3
|
from orionis.foundation.config.auth.entities.auth import Auth
|
|
4
4
|
from orionis.foundation.config.cache.entities.cache import Cache
|
|
5
5
|
from orionis.foundation.config.cors.entities.cors import Cors
|
|
6
6
|
from orionis.foundation.config.database.entities.database import Database
|
|
7
|
-
from orionis.foundation.
|
|
7
|
+
from orionis.foundation.config.roots.paths import Paths
|
|
8
|
+
from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
8
9
|
from orionis.foundation.config.filesystems.entitites.filesystems import Filesystems
|
|
9
10
|
from orionis.foundation.config.logging.entities.logging import Logging
|
|
10
11
|
from orionis.foundation.config.mail.entities.mail import Mail
|
|
11
12
|
from orionis.foundation.config.queue.entities.queue import Queue
|
|
12
|
-
from orionis.foundation.config.roots.paths import Paths
|
|
13
13
|
from orionis.foundation.config.session.entities.session import Session
|
|
14
14
|
from orionis.foundation.config.testing.entities.testing import Testing
|
|
15
|
+
from orionis.support.entities.base import BaseEntity
|
|
15
16
|
|
|
16
|
-
@dataclass
|
|
17
|
-
class Configuration:
|
|
17
|
+
@dataclass(unsafe_hash=True, kw_only=True)
|
|
18
|
+
class Configuration(BaseEntity):
|
|
18
19
|
"""
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
Main configuration dataclass for Orionis Framework startup.
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
app : App or dict, optional
|
|
25
|
+
Application configuration settings.
|
|
26
|
+
auth : Auth or dict, optional
|
|
27
|
+
Authentication configuration settings.
|
|
28
|
+
cache : Cache or dict, optional
|
|
29
|
+
Cache configuration settings.
|
|
30
|
+
cors : Cors or dict, optional
|
|
31
|
+
CORS configuration settings.
|
|
32
|
+
database : Database or dict, optional
|
|
33
|
+
Database configuration settings.
|
|
34
|
+
filesystems : Filesystems or dict, optional
|
|
35
|
+
Filesystem configuration settings.
|
|
36
|
+
logging : Logging or dict, optional
|
|
37
|
+
Logging configuration settings.
|
|
38
|
+
mail : Mail or dict, optional
|
|
39
|
+
Mail configuration settings.
|
|
40
|
+
path : Paths or dict, optional
|
|
41
|
+
Path configuration settings.
|
|
42
|
+
queue : Queue or dict, optional
|
|
43
|
+
Queue configuration settings.
|
|
44
|
+
session : Session or dict, optional
|
|
45
|
+
Session configuration settings.
|
|
46
|
+
testing : Testing or dict, optional
|
|
47
|
+
Testing configuration settings.
|
|
48
|
+
|
|
49
|
+
Raises
|
|
50
|
+
------
|
|
51
|
+
OrionisIntegrityException
|
|
52
|
+
If any configuration section is initialized with an invalid type.
|
|
33
53
|
"""
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
|
|
55
|
+
app : App | dict = field(
|
|
56
|
+
default_factory = lambda: App(),
|
|
57
|
+
metadata = {
|
|
58
|
+
"description": "Application configuration settings.",
|
|
59
|
+
"default": App().toDict()
|
|
38
60
|
}
|
|
39
61
|
)
|
|
40
62
|
|
|
41
|
-
|
|
42
|
-
default_factory=
|
|
43
|
-
metadata={
|
|
44
|
-
"description": "
|
|
63
|
+
auth : Auth | dict = field(
|
|
64
|
+
default_factory = lambda: Auth(),
|
|
65
|
+
metadata = {
|
|
66
|
+
"description": "Authentication configuration settings.",
|
|
67
|
+
"default": Auth().toDict()
|
|
45
68
|
}
|
|
46
69
|
)
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
default_factory=
|
|
50
|
-
metadata={
|
|
51
|
-
"description": "
|
|
71
|
+
cache : Cache | dict = field(
|
|
72
|
+
default_factory = lambda: Cache(),
|
|
73
|
+
metadata = {
|
|
74
|
+
"description": "Cache configuration settings.",
|
|
75
|
+
"default": Cache().toDict()
|
|
52
76
|
}
|
|
53
77
|
)
|
|
54
78
|
|
|
55
|
-
|
|
56
|
-
default_factory=
|
|
57
|
-
metadata={
|
|
58
|
-
"description": "
|
|
79
|
+
cors : Cors | dict = field(
|
|
80
|
+
default_factory = lambda: Cors(),
|
|
81
|
+
metadata = {
|
|
82
|
+
"description": "CORS configuration settings.",
|
|
83
|
+
"default": Cors().toDict()
|
|
59
84
|
}
|
|
60
85
|
)
|
|
61
86
|
|
|
62
|
-
|
|
63
|
-
default_factory=
|
|
64
|
-
metadata={
|
|
65
|
-
"description": "
|
|
87
|
+
database : Database | dict = field(
|
|
88
|
+
default_factory = lambda: Database(),
|
|
89
|
+
metadata = {
|
|
90
|
+
"description": "Database configuration settings.",
|
|
91
|
+
"default": Database().toDict()
|
|
66
92
|
}
|
|
67
93
|
)
|
|
68
94
|
|
|
69
|
-
|
|
70
|
-
default_factory=
|
|
71
|
-
metadata={
|
|
72
|
-
"description": "
|
|
95
|
+
filesystems : Filesystems | dict = field(
|
|
96
|
+
default_factory = lambda: Filesystems(),
|
|
97
|
+
metadata = {
|
|
98
|
+
"description": "Filesystem configuration settings.",
|
|
99
|
+
"default": Filesystems().toDict()
|
|
73
100
|
}
|
|
74
101
|
)
|
|
75
102
|
|
|
76
|
-
|
|
77
|
-
default_factory=
|
|
78
|
-
metadata={
|
|
79
|
-
"description": "
|
|
103
|
+
logging : Logging | dict = field(
|
|
104
|
+
default_factory = lambda: Logging(),
|
|
105
|
+
metadata = {
|
|
106
|
+
"description": "Logging configuration settings.",
|
|
107
|
+
"default": Logging().toDict()
|
|
80
108
|
}
|
|
81
109
|
)
|
|
82
110
|
|
|
83
|
-
|
|
84
|
-
default_factory=
|
|
85
|
-
metadata={
|
|
86
|
-
"description": "
|
|
111
|
+
mail : Mail | dict = field(
|
|
112
|
+
default_factory = lambda: Mail(),
|
|
113
|
+
metadata = {
|
|
114
|
+
"description": "Mail configuration settings.",
|
|
115
|
+
"default": Mail().toDict()
|
|
87
116
|
}
|
|
88
117
|
)
|
|
89
118
|
|
|
90
|
-
|
|
91
|
-
default_factory=
|
|
119
|
+
path : Paths | dict = field(
|
|
120
|
+
default_factory = lambda: Paths(),
|
|
92
121
|
metadata={
|
|
93
|
-
"description": "
|
|
122
|
+
"description": "Path configuration settings.",
|
|
123
|
+
"default": Paths().toDict()
|
|
94
124
|
}
|
|
95
125
|
)
|
|
96
126
|
|
|
97
|
-
queue : Queue = field(
|
|
98
|
-
default_factory=Queue,
|
|
99
|
-
metadata={
|
|
100
|
-
"description": "Queue configuration settings."
|
|
127
|
+
queue : Queue | dict = field(
|
|
128
|
+
default_factory = lambda: Queue(),
|
|
129
|
+
metadata = {
|
|
130
|
+
"description": "Queue configuration settings.",
|
|
131
|
+
"default": Queue().toDict()
|
|
101
132
|
}
|
|
102
133
|
)
|
|
103
134
|
|
|
104
|
-
session : Session = field(
|
|
105
|
-
default_factory=Session,
|
|
106
|
-
metadata={
|
|
107
|
-
"description": "Session configuration settings."
|
|
135
|
+
session : Session | dict = field(
|
|
136
|
+
default_factory = lambda: Session(),
|
|
137
|
+
metadata = {
|
|
138
|
+
"description": "Session configuration settings.",
|
|
139
|
+
"default": Session().toDict()
|
|
108
140
|
}
|
|
109
141
|
)
|
|
110
142
|
|
|
111
|
-
testing : Testing = field(
|
|
112
|
-
default_factory=Testing,
|
|
113
|
-
metadata={
|
|
114
|
-
"description": "Testing configuration settings."
|
|
143
|
+
testing : Testing | dict = field(
|
|
144
|
+
default_factory = lambda: Testing(),
|
|
145
|
+
metadata = {
|
|
146
|
+
"description": "Testing configuration settings.",
|
|
147
|
+
"default": Testing().toDict()
|
|
115
148
|
}
|
|
116
149
|
)
|
|
117
150
|
|
|
118
151
|
def __post_init__(self):
|
|
119
152
|
"""
|
|
120
|
-
Validates
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- cache (Cache)
|
|
127
|
-
- cors (Cors)
|
|
128
|
-
- database (Database)
|
|
129
|
-
- filesystems (Filesystems)
|
|
130
|
-
- logging (Logging)
|
|
131
|
-
- mail (Mail)
|
|
132
|
-
- queue (Queue)
|
|
133
|
-
- session (Session)
|
|
134
|
-
- testing (Testing)
|
|
153
|
+
Validates and converts configuration attributes to their respective entity types.
|
|
154
|
+
|
|
155
|
+
Raises
|
|
156
|
+
------
|
|
157
|
+
OrionisIntegrityException
|
|
158
|
+
If any attribute is not an instance of the expected type or a dictionary.
|
|
135
159
|
"""
|
|
136
160
|
|
|
137
|
-
|
|
161
|
+
# Validate `app` attribute
|
|
162
|
+
if not isinstance(self.app, (App, dict)):
|
|
138
163
|
raise OrionisIntegrityException(
|
|
139
|
-
f"Invalid type for '
|
|
164
|
+
f"Invalid type for 'app': expected App or dict, got {type(self.app).__name__}"
|
|
140
165
|
)
|
|
166
|
+
if isinstance(self.app, dict):
|
|
167
|
+
self.app = App(**self.app)
|
|
141
168
|
|
|
142
|
-
|
|
169
|
+
# Validate `auth` attribute
|
|
170
|
+
if not isinstance(self.auth, (Auth, dict)):
|
|
143
171
|
raise OrionisIntegrityException(
|
|
144
|
-
f"Invalid type for '
|
|
172
|
+
f"Invalid type for 'auth': expected Auth or dict, got {type(self.auth).__name__}"
|
|
145
173
|
)
|
|
174
|
+
if isinstance(self.auth, dict):
|
|
175
|
+
self.auth = Auth(**self.auth)
|
|
146
176
|
|
|
147
|
-
|
|
177
|
+
# Validate `cache` attribute
|
|
178
|
+
if not isinstance(self.cache, (Cache, dict)):
|
|
148
179
|
raise OrionisIntegrityException(
|
|
149
|
-
f"Invalid type for '
|
|
180
|
+
f"Invalid type for 'cache': expected Cache or dict, got {type(self.cache).__name__}"
|
|
150
181
|
)
|
|
182
|
+
if isinstance(self.cache, dict):
|
|
183
|
+
self.cache = Cache(**self.cache)
|
|
151
184
|
|
|
152
|
-
|
|
185
|
+
# Validate `cors` attribute
|
|
186
|
+
if not isinstance(self.cors, (Cors, dict)):
|
|
153
187
|
raise OrionisIntegrityException(
|
|
154
|
-
f"Invalid type for '
|
|
188
|
+
f"Invalid type for 'cors': expected Cors or dict, got {type(self.cors).__name__}"
|
|
155
189
|
)
|
|
190
|
+
if isinstance(self.cors, dict):
|
|
191
|
+
self.cors = Cors(**self.cors)
|
|
156
192
|
|
|
157
|
-
|
|
193
|
+
# Validate `database` attribute
|
|
194
|
+
if not isinstance(self.database, (Database, dict)):
|
|
158
195
|
raise OrionisIntegrityException(
|
|
159
|
-
f"Invalid type for '
|
|
196
|
+
f"Invalid type for 'database': expected Database or dict, got {type(self.database).__name__}"
|
|
160
197
|
)
|
|
198
|
+
if isinstance(self.database, dict):
|
|
199
|
+
self.database = Database(**self.database)
|
|
161
200
|
|
|
162
|
-
|
|
201
|
+
# Validate `filesystems` attribute
|
|
202
|
+
if not isinstance(self.filesystems, (Filesystems, dict)):
|
|
163
203
|
raise OrionisIntegrityException(
|
|
164
|
-
f"Invalid type for '
|
|
204
|
+
f"Invalid type for 'filesystems': expected Filesystems or dict, got {type(self.filesystems).__name__}"
|
|
165
205
|
)
|
|
206
|
+
if isinstance(self.filesystems, dict):
|
|
207
|
+
self.filesystems = Filesystems(**self.filesystems)
|
|
166
208
|
|
|
167
|
-
|
|
209
|
+
# Validate `logging` attribute
|
|
210
|
+
if not isinstance(self.logging, (Logging, dict)):
|
|
168
211
|
raise OrionisIntegrityException(
|
|
169
|
-
f"Invalid type for '
|
|
212
|
+
f"Invalid type for 'logging': expected Logging or dict, got {type(self.logging).__name__}"
|
|
170
213
|
)
|
|
214
|
+
if isinstance(self.logging, dict):
|
|
215
|
+
self.logging = Logging(**self.logging)
|
|
171
216
|
|
|
172
|
-
|
|
217
|
+
# Validate `mail` attribute
|
|
218
|
+
if not isinstance(self.mail, (Mail, dict)):
|
|
173
219
|
raise OrionisIntegrityException(
|
|
174
|
-
f"Invalid type for '
|
|
220
|
+
f"Invalid type for 'mail': expected Mail or dict, got {type(self.mail).__name__}"
|
|
175
221
|
)
|
|
222
|
+
if isinstance(self.mail, dict):
|
|
223
|
+
self.mail = Mail(**self.mail)
|
|
176
224
|
|
|
177
|
-
|
|
225
|
+
# Validate `path` attribute
|
|
226
|
+
if not isinstance(self.path, (Paths, dict)):
|
|
178
227
|
raise OrionisIntegrityException(
|
|
179
|
-
f"Invalid type for '
|
|
228
|
+
f"Invalid type for 'path': expected Paths or dict, got {type(self.path).__name__}"
|
|
180
229
|
)
|
|
230
|
+
if isinstance(self.path, dict):
|
|
231
|
+
self.path = Paths(**self.path)
|
|
181
232
|
|
|
182
|
-
|
|
233
|
+
# Validate `queue` attribute
|
|
234
|
+
if not isinstance(self.queue, (Queue, dict)):
|
|
183
235
|
raise OrionisIntegrityException(
|
|
184
|
-
f"Invalid type for 'queue': expected Queue, got {type(self.queue).__name__}"
|
|
236
|
+
f"Invalid type for 'queue': expected Queue or dict, got {type(self.queue).__name__}"
|
|
185
237
|
)
|
|
238
|
+
if isinstance(self.queue, dict):
|
|
239
|
+
self.queue = Queue(**self.queue)
|
|
186
240
|
|
|
187
|
-
|
|
241
|
+
# Validate `session` attribute
|
|
242
|
+
if not isinstance(self.session, (Session, dict)):
|
|
188
243
|
raise OrionisIntegrityException(
|
|
189
|
-
f"Invalid type for 'session': expected Session, got {type(self.session).__name__}"
|
|
244
|
+
f"Invalid type for 'session': expected Session or dict, got {type(self.session).__name__}"
|
|
190
245
|
)
|
|
246
|
+
if isinstance(self.session, dict):
|
|
247
|
+
self.session = Session(**self.session)
|
|
191
248
|
|
|
192
|
-
|
|
249
|
+
# Validate `testing` attribute
|
|
250
|
+
if not isinstance(self.testing, (Testing, dict)):
|
|
193
251
|
raise OrionisIntegrityException(
|
|
194
|
-
f"Invalid type for 'testing': expected Testing, got {type(self.testing).__name__}"
|
|
252
|
+
f"Invalid type for 'testing': expected Testing or dict, got {type(self.testing).__name__}"
|
|
195
253
|
)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"""
|
|
199
|
-
Convert the object to a dictionary representation.
|
|
200
|
-
Returns:
|
|
201
|
-
dict: A dictionary representation of the Dataclass object.
|
|
202
|
-
"""
|
|
203
|
-
return asdict(self)
|
|
204
|
-
|
|
205
|
-
def getFields(self):
|
|
206
|
-
"""
|
|
207
|
-
Retrieves a list of field information for the current dataclass instance.
|
|
208
|
-
|
|
209
|
-
Returns:
|
|
210
|
-
list: A list of dictionaries, each containing details about a field:
|
|
211
|
-
- name (str): The name of the field.
|
|
212
|
-
- type (type): The type of the field.
|
|
213
|
-
- default: The default value of the field, if specified; otherwise, the value from metadata or None.
|
|
214
|
-
- metadata (mapping): The metadata associated with the field.
|
|
215
|
-
"""
|
|
216
|
-
__fields = []
|
|
217
|
-
for field in fields(self):
|
|
218
|
-
__metadata = dict(field.metadata) or {}
|
|
219
|
-
__fields.append({
|
|
220
|
-
"name": field.name,
|
|
221
|
-
"type": field.type.__name__ if hasattr(field.type, '__name__') else str(field.type),
|
|
222
|
-
"default": field.default if (field.default is not None and '_MISSING_TYPE' not in str(field.default)) else __metadata.get('default', None),
|
|
223
|
-
"metadata": __metadata
|
|
224
|
-
})
|
|
225
|
-
return __fields
|
|
254
|
+
if isinstance(self.testing, dict):
|
|
255
|
+
self.testing = Testing(**self.testing)
|