orionis 0.405.0__py3-none-any.whl → 0.407.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/asynchrony/contracts/coroutines.py +13 -5
- orionis/services/asynchrony/coroutines.py +33 -29
- orionis/services/asynchrony/exceptions/exception.py +9 -1
- orionis/services/environment/core/dot_env.py +46 -34
- orionis/services/environment/enums/__init__.py +0 -0
- orionis/services/environment/enums/cast_type.py +42 -0
- 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/services/environment/serializer/__init__.py +0 -0
- orionis/services/environment/serializer/values.py +21 -0
- orionis/services/environment/validators/__init__.py +0 -0
- orionis/services/environment/validators/key_name.py +46 -0
- orionis/services/environment/validators/types.py +45 -0
- orionis/services/system/contracts/imports.py +38 -18
- orionis/services/system/contracts/workers.py +29 -12
- orionis/services/system/imports.py +65 -25
- orionis/services/system/runtime/imports.py +18 -9
- orionis/services/system/workers.py +49 -16
- 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 +83 -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.407.0.dist-info}/METADATA +1 -1
- {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/RECORD +170 -112
- 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/example/test_example.py +2 -2
- tests/foundation/config/testing/test_foundation_config_testing.py +1 -1
- tests/metadata/test_metadata_framework.py +89 -24
- tests/metadata/test_metadata_package.py +55 -10
- tests/services/asynchrony/test_services_asynchrony_coroutine.py +52 -7
- tests/services/system/test_services_system_imports.py +119 -16
- tests/services/system/test_services_system_workers.py +71 -30
- 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.407.0.dist-info}/WHEEL +0 -0
- {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/top_level.txt +0 -0
- {orionis-0.405.0.dist-info → orionis-0.407.0.dist-info}/zip-safe +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.entities.monthly import Monthly
|
|
4
4
|
from orionis.foundation.config.logging.entities.chunked import Chunked
|
|
5
5
|
from orionis.foundation.config.logging.entities.daily import Daily
|
|
@@ -9,56 +9,56 @@ from orionis.foundation.config.logging.entities.weekly import Weekly
|
|
|
9
9
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
10
10
|
|
|
11
11
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
12
|
-
class Channels(
|
|
12
|
+
class Channels(BaseEntity):
|
|
13
13
|
"""
|
|
14
14
|
Represents the different logging channels available.
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
stack: Stack | dict = field(
|
|
18
18
|
default_factory = lambda: Stack(),
|
|
19
|
-
metadata={
|
|
19
|
+
metadata = {
|
|
20
20
|
"description": "Configuration for stack log channel.",
|
|
21
|
-
"default":
|
|
21
|
+
"default": Stack().toDict()
|
|
22
22
|
}
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
hourly: Hourly | dict = field(
|
|
26
26
|
default_factory = lambda: Hourly(),
|
|
27
|
-
metadata={
|
|
27
|
+
metadata = {
|
|
28
28
|
"description": "Configuration for hourly log rotation.",
|
|
29
|
-
"default":
|
|
29
|
+
"default": Hourly().toDict()
|
|
30
30
|
}
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
daily: Daily | dict = field(
|
|
34
34
|
default_factory = lambda: Daily(),
|
|
35
|
-
metadata={
|
|
35
|
+
metadata = {
|
|
36
36
|
"description": "Configuration for daily log rotation.",
|
|
37
|
-
"default":
|
|
37
|
+
"default": Daily().toDict()
|
|
38
38
|
}
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
weekly: Weekly | dict = field(
|
|
42
42
|
default_factory = lambda: Weekly(),
|
|
43
|
-
metadata={
|
|
43
|
+
metadata = {
|
|
44
44
|
"description": "Configuration for weekly log rotation.",
|
|
45
|
-
"default":
|
|
45
|
+
"default": Weekly().toDict()
|
|
46
46
|
}
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
monthly: Monthly | dict= field(
|
|
50
50
|
default_factory = lambda: Monthly(),
|
|
51
|
-
metadata={
|
|
51
|
+
metadata = {
|
|
52
52
|
"description": "Configuration for monthly log rotation.",
|
|
53
|
-
"default":
|
|
53
|
+
"default": Monthly().toDict()
|
|
54
54
|
}
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
chunked: Chunked | dict = field(
|
|
58
58
|
default_factory = lambda: Chunked(),
|
|
59
|
-
metadata={
|
|
59
|
+
metadata = {
|
|
60
60
|
"description": "Configuration for chunked log file storage.",
|
|
61
|
-
"default":
|
|
61
|
+
"default": Chunked().toDict()
|
|
62
62
|
}
|
|
63
63
|
)
|
|
64
64
|
|
|
@@ -76,80 +76,50 @@ class Channels(BaseConfigEntity):
|
|
|
76
76
|
OrionisIntegrityException: If any of the properties are not instances of their expected classes.
|
|
77
77
|
"""
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
else:
|
|
88
|
-
raise OrionisIntegrityException(
|
|
89
|
-
"The 'stack' property must be an instance of Stack or a dictionary."
|
|
90
|
-
)
|
|
79
|
+
# Validate `stack` attribute
|
|
80
|
+
if not isinstance(self.stack, (Stack, dict)):
|
|
81
|
+
raise OrionisIntegrityException(
|
|
82
|
+
"The 'stack' property must be an instance of Stack or a dictionary."
|
|
83
|
+
)
|
|
84
|
+
if isinstance(self.stack, dict):
|
|
85
|
+
self.stack = Stack(**self.stack)
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
100
|
-
else:
|
|
101
|
-
raise OrionisIntegrityException(
|
|
102
|
-
"The 'hourly' property must be an instance of Hourly or a dictionary."
|
|
103
|
-
)
|
|
87
|
+
# Validate `hourly` attribute
|
|
88
|
+
if not isinstance(self.hourly, (Hourly, dict)):
|
|
89
|
+
raise OrionisIntegrityException(
|
|
90
|
+
"The 'hourly' property must be an instance of Hourly or a dictionary."
|
|
91
|
+
)
|
|
92
|
+
if isinstance(self.hourly, dict):
|
|
93
|
+
self.hourly = Hourly(**self.hourly)
|
|
104
94
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
else:
|
|
114
|
-
raise OrionisIntegrityException(
|
|
115
|
-
"The 'daily' property must be an instance of Daily or a dictionary."
|
|
116
|
-
)
|
|
95
|
+
# Validate `daily` attribute
|
|
96
|
+
if not isinstance(self.daily, (Daily, dict)):
|
|
97
|
+
raise OrionisIntegrityException(
|
|
98
|
+
"The 'daily' property must be an instance of Daily or a dictionary."
|
|
99
|
+
)
|
|
100
|
+
if isinstance(self.daily, dict):
|
|
101
|
+
self.daily = Daily(**self.daily)
|
|
117
102
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
else:
|
|
127
|
-
raise OrionisIntegrityException(
|
|
128
|
-
"The 'weekly' property must be an instance of Weekly or a dictionary."
|
|
129
|
-
)
|
|
103
|
+
# Validate `weekly` attribute
|
|
104
|
+
if not isinstance(self.weekly, (Weekly, dict)):
|
|
105
|
+
raise OrionisIntegrityException(
|
|
106
|
+
"The 'weekly' property must be an instance of Weekly or a dictionary."
|
|
107
|
+
)
|
|
108
|
+
if isinstance(self.weekly, dict):
|
|
109
|
+
self.weekly = Weekly(**self.weekly)
|
|
130
110
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
)
|
|
139
|
-
else:
|
|
140
|
-
raise OrionisIntegrityException(
|
|
141
|
-
"The 'monthly' property must be an instance of Monthly or a dictionary."
|
|
142
|
-
)
|
|
111
|
+
# Validate `monthly` attribute
|
|
112
|
+
if not isinstance(self.monthly, (Monthly, dict)):
|
|
113
|
+
raise OrionisIntegrityException(
|
|
114
|
+
"The 'monthly' property must be an instance of Monthly or a dictionary."
|
|
115
|
+
)
|
|
116
|
+
if isinstance(self.monthly, dict):
|
|
117
|
+
self.monthly = Monthly(**self.monthly)
|
|
143
118
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
)
|
|
152
|
-
else:
|
|
153
|
-
raise OrionisIntegrityException(
|
|
154
|
-
"The 'chunked' property must be an instance of Chunked or a dictionary."
|
|
155
|
-
)
|
|
119
|
+
# Validate `chunked` attribute
|
|
120
|
+
if not isinstance(self.chunked, (Chunked, dict)):
|
|
121
|
+
raise OrionisIntegrityException(
|
|
122
|
+
"The 'chunked' property must be an instance of Chunked or a dictionary."
|
|
123
|
+
)
|
|
124
|
+
if isinstance(self.chunked, dict):
|
|
125
|
+
self.chunked = Chunked(**self.chunked)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Chunked(
|
|
8
|
+
class Chunked(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Configuration for chunked log file rotation.
|
|
11
11
|
|
|
@@ -29,31 +29,31 @@ class Chunked(BaseConfigEntity):
|
|
|
29
29
|
default = 'storage/log/chunked.log',
|
|
30
30
|
metadata = {
|
|
31
31
|
"description": "The file path where the log is stored.",
|
|
32
|
-
"default": "storage/log/chunked.log"
|
|
32
|
+
"default": "storage/log/chunked.log"
|
|
33
33
|
},
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
level: int | str | Level = field(
|
|
37
|
-
default = Level.INFO,
|
|
37
|
+
default = Level.INFO.value,
|
|
38
38
|
metadata = {
|
|
39
39
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
40
|
-
"default": Level.INFO
|
|
40
|
+
"default": Level.INFO.value
|
|
41
41
|
},
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
mb_size: int = field(
|
|
45
45
|
default = 10,
|
|
46
|
-
metadata={
|
|
46
|
+
metadata = {
|
|
47
47
|
"description": "Maximum size (in MB) of a log file before chunking.",
|
|
48
|
-
"default": 10
|
|
48
|
+
"default": 10
|
|
49
49
|
},
|
|
50
50
|
)
|
|
51
51
|
|
|
52
52
|
files: int = field(
|
|
53
53
|
default = 5,
|
|
54
|
-
metadata={
|
|
54
|
+
metadata = {
|
|
55
55
|
"description": "Maximum number of log files to retain.",
|
|
56
|
-
"default": 5
|
|
56
|
+
"default": 5
|
|
57
57
|
},
|
|
58
58
|
)
|
|
59
59
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
2
|
from datetime import datetime, time
|
|
3
|
-
from orionis.
|
|
3
|
+
from orionis.support.entities.base import BaseEntity
|
|
4
4
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
5
5
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
6
6
|
from orionis.foundation.config.logging.enums import Level
|
|
7
7
|
|
|
8
8
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
9
|
-
class Daily(
|
|
9
|
+
class Daily(BaseEntity):
|
|
10
10
|
"""
|
|
11
11
|
Represents the configuration for daily log file rotation.
|
|
12
12
|
|
|
@@ -21,15 +21,15 @@ class Daily(BaseConfigEntity):
|
|
|
21
21
|
default = 'storage/log/daily.log',
|
|
22
22
|
metadata = {
|
|
23
23
|
"description": "The file path where the log is stored.",
|
|
24
|
-
"default": "storage/log/daily.log"
|
|
24
|
+
"default": "storage/log/daily.log"
|
|
25
25
|
},
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
level: int | str | Level = field(
|
|
29
|
-
default = Level.INFO,
|
|
29
|
+
default = Level.INFO.value,
|
|
30
30
|
metadata = {
|
|
31
31
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
32
|
-
"default": Level.INFO
|
|
32
|
+
"default": Level.INFO.value
|
|
33
33
|
},
|
|
34
34
|
)
|
|
35
35
|
|
|
@@ -37,15 +37,15 @@ class Daily(BaseConfigEntity):
|
|
|
37
37
|
default = 7,
|
|
38
38
|
metadata = {
|
|
39
39
|
"description": "The number of days to retain log files before deletion.",
|
|
40
|
-
"default": 7
|
|
40
|
+
"default": 7
|
|
41
41
|
},
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
at: time | str = field(
|
|
45
45
|
default = time(0, 0).strftime("%H:%M"),
|
|
46
|
-
metadata={
|
|
46
|
+
metadata = {
|
|
47
47
|
"description": "The time of day when the log rotation should occur.",
|
|
48
|
-
"default": time(0, 0).strftime("%H:%M")
|
|
48
|
+
"default": time(0, 0).strftime("%H:%M")
|
|
49
49
|
},
|
|
50
50
|
)
|
|
51
51
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidLevel, IsValidPath
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Hourly(
|
|
8
|
+
class Hourly(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Represents the configuration for hourly log file management.
|
|
11
11
|
|
|
@@ -19,15 +19,15 @@ class Hourly(BaseConfigEntity):
|
|
|
19
19
|
default = 'storage/log/hourly.log',
|
|
20
20
|
metadata = {
|
|
21
21
|
"description": "The file path where the log is stored.",
|
|
22
|
-
"default": "storage/log/hourly.log"
|
|
22
|
+
"default": "storage/log/hourly.log"
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
level: int | str | Level = field(
|
|
27
|
-
default = Level.INFO,
|
|
27
|
+
default = Level.INFO.value,
|
|
28
28
|
metadata = {
|
|
29
29
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
30
|
-
"default": Level.INFO
|
|
30
|
+
"default": Level.INFO.value
|
|
31
31
|
},
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ class Hourly(BaseConfigEntity):
|
|
|
35
35
|
default = 24,
|
|
36
36
|
metadata = {
|
|
37
37
|
"description": "The number of hours to retain log files before deletion.",
|
|
38
|
-
"default": 24
|
|
38
|
+
"default": 24
|
|
39
39
|
},
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from dataclasses import dataclass, field, fields
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.entities.channels import Channels
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
|
|
6
6
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
7
|
-
class Logging(
|
|
7
|
+
class Logging(BaseEntity):
|
|
8
8
|
"""
|
|
9
9
|
Represents the logging system configuration.
|
|
10
10
|
|
|
@@ -16,8 +16,8 @@ class Logging(BaseConfigEntity):
|
|
|
16
16
|
A collection of available logging channels.
|
|
17
17
|
"""
|
|
18
18
|
default: str = field(
|
|
19
|
-
default="stack",
|
|
20
|
-
metadata={
|
|
19
|
+
default = "stack",
|
|
20
|
+
metadata = {
|
|
21
21
|
"description": "The default logging channel to use.",
|
|
22
22
|
"default": "stack"
|
|
23
23
|
}
|
|
@@ -25,9 +25,9 @@ class Logging(BaseConfigEntity):
|
|
|
25
25
|
|
|
26
26
|
channels: Channels | dict = field(
|
|
27
27
|
default_factory = lambda: Channels(),
|
|
28
|
-
metadata={
|
|
28
|
+
metadata = {
|
|
29
29
|
"description": "A collection of available logging channels.",
|
|
30
|
-
"default":
|
|
30
|
+
"default": Channels().toDict()
|
|
31
31
|
}
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -58,15 +58,9 @@ class Logging(BaseConfigEntity):
|
|
|
58
58
|
f"The 'default' property must be a string and match one of the available options ({options})."
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
-
if not isinstance(self.channels, Channels):
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
f"Invalid channels configuration: {e}"
|
|
68
|
-
)
|
|
69
|
-
else:
|
|
70
|
-
raise OrionisIntegrityException(
|
|
71
|
-
"The 'channels' property must be an instance of Channels or a dictionary."
|
|
72
|
-
)
|
|
61
|
+
if not isinstance(self.channels, (Channels, dict)):
|
|
62
|
+
raise OrionisIntegrityException(
|
|
63
|
+
"The 'channels' property must be an instance of Channels or a dictionary."
|
|
64
|
+
)
|
|
65
|
+
if isinstance(self.channels, dict):
|
|
66
|
+
self.channels = Channels(**self.channels)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Monthly(
|
|
8
|
+
class Monthly(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Configuration entity for monthly log file management.
|
|
11
11
|
|
|
@@ -19,23 +19,23 @@ class Monthly(BaseConfigEntity):
|
|
|
19
19
|
default = 'storage/log/monthly.log',
|
|
20
20
|
metadata = {
|
|
21
21
|
"description": "The file path where the log is stored.",
|
|
22
|
-
"default": "storage/log/monthly.log"
|
|
22
|
+
"default": "storage/log/monthly.log"
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
level: int | str | Level = field(
|
|
27
|
-
default = Level.INFO,
|
|
27
|
+
default = Level.INFO.value,
|
|
28
28
|
metadata = {
|
|
29
29
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
30
|
-
"default": Level.INFO
|
|
30
|
+
"default": Level.INFO.value
|
|
31
31
|
},
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
retention_months: int = field(
|
|
35
35
|
default = 4,
|
|
36
|
-
metadata={
|
|
36
|
+
metadata = {
|
|
37
37
|
"description": "The number of months to retain log files before deletion.",
|
|
38
|
-
"default": 4
|
|
38
|
+
"default": 4
|
|
39
39
|
},
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidLevel, IsValidPath
|
|
4
4
|
from orionis.foundation.config.logging.enums import Level
|
|
5
5
|
|
|
6
6
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
7
|
-
class Stack(
|
|
7
|
+
class Stack(BaseEntity):
|
|
8
8
|
"""
|
|
9
9
|
Represents the configuration for a logging stack, including the log file path and logging level.
|
|
10
10
|
"""
|
|
@@ -13,15 +13,15 @@ class Stack(BaseConfigEntity):
|
|
|
13
13
|
default = 'storage/log/stack.log',
|
|
14
14
|
metadata = {
|
|
15
15
|
"description": "The file path where the log is stored.",
|
|
16
|
-
"default": "storage/log/stack.log"
|
|
16
|
+
"default": "storage/log/stack.log"
|
|
17
17
|
},
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
level: int | str | Level = field(
|
|
21
|
-
default = Level.INFO,
|
|
21
|
+
default = Level.INFO.value,
|
|
22
22
|
metadata = {
|
|
23
23
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
24
|
-
"default": Level.INFO
|
|
24
|
+
"default": Level.INFO.value
|
|
25
25
|
},
|
|
26
26
|
)
|
|
27
27
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from orionis.
|
|
2
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
3
|
from orionis.foundation.config.logging.validators import IsValidPath, IsValidLevel
|
|
4
4
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
5
5
|
from orionis.foundation.config.logging.enums import Level
|
|
6
6
|
|
|
7
7
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
8
|
-
class Weekly(
|
|
8
|
+
class Weekly(BaseEntity):
|
|
9
9
|
"""
|
|
10
10
|
Configuration entity for weekly log file management.
|
|
11
11
|
|
|
@@ -19,15 +19,15 @@ class Weekly(BaseConfigEntity):
|
|
|
19
19
|
default = 'storage/log/weekly.log',
|
|
20
20
|
metadata = {
|
|
21
21
|
"description": "The file path where the log is stored.",
|
|
22
|
-
"default": "storage/log/weekly.log"
|
|
22
|
+
"default": "storage/log/weekly.log"
|
|
23
23
|
},
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
level: int | str | Level = field(
|
|
27
|
-
default = Level.INFO,
|
|
27
|
+
default = Level.INFO.value,
|
|
28
28
|
metadata = {
|
|
29
29
|
"description": "The logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).",
|
|
30
|
-
"default": Level.INFO
|
|
30
|
+
"default": Level.INFO.value
|
|
31
31
|
},
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ class Weekly(BaseConfigEntity):
|
|
|
35
35
|
default = 4,
|
|
36
36
|
metadata = {
|
|
37
37
|
"description": "The number of weeks to retain log files before deletion.",
|
|
38
|
-
"default": 4
|
|
38
|
+
"default": 4
|
|
39
39
|
},
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
from dataclasses import
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
2
|
from orionis.foundation.exceptions import OrionisIntegrityException
|
|
3
|
+
from orionis.support.entities.base import BaseEntity
|
|
3
4
|
|
|
4
5
|
@dataclass(unsafe_hash=True, kw_only=True)
|
|
5
|
-
class File:
|
|
6
|
+
class File(BaseEntity):
|
|
6
7
|
"""
|
|
7
8
|
Represents a file configuration entity for storing outgoing emails.
|
|
8
9
|
Attributes:
|
|
@@ -17,8 +18,11 @@ class File:
|
|
|
17
18
|
"""
|
|
18
19
|
|
|
19
20
|
path: str = field(
|
|
20
|
-
default="storage/mail",
|
|
21
|
-
metadata={
|
|
21
|
+
default = "storage/mail",
|
|
22
|
+
metadata = {
|
|
23
|
+
"description": "The file path where outgoing emails are stored.",
|
|
24
|
+
"default": "storage/mail",
|
|
25
|
+
}
|
|
22
26
|
)
|
|
23
27
|
|
|
24
28
|
def __post_init__(self):
|
|
@@ -29,35 +33,4 @@ class File:
|
|
|
29
33
|
OrionisIntegrityException: If 'path' is not a non-empty string.
|
|
30
34
|
"""
|
|
31
35
|
if not isinstance(self.path, str) or self.path.strip() == "":
|
|
32
|
-
raise OrionisIntegrityException("The 'path' attribute must be a non-empty string.")
|
|
33
|
-
|
|
34
|
-
def toDict(self) -> dict:
|
|
35
|
-
"""
|
|
36
|
-
Converts the current instance into a dictionary representation.
|
|
37
|
-
|
|
38
|
-
Returns:
|
|
39
|
-
dict: A dictionary containing all the fields of the instance.
|
|
40
|
-
"""
|
|
41
|
-
return asdict(self)
|
|
42
|
-
|
|
43
|
-
def getFields(self):
|
|
44
|
-
"""
|
|
45
|
-
Retrieves a list of field information for the current dataclass instance.
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
list: A list of dictionaries, each containing details about a field:
|
|
49
|
-
- name (str): The name of the field.
|
|
50
|
-
- type (type): The type of the field.
|
|
51
|
-
- default: The default value of the field, if specified; otherwise, the value from metadata or None.
|
|
52
|
-
- metadata (mapping): The metadata associated with the field.
|
|
53
|
-
"""
|
|
54
|
-
__fields = []
|
|
55
|
-
for field in fields(self):
|
|
56
|
-
__metadata = dict(field.metadata) or {}
|
|
57
|
-
__fields.append({
|
|
58
|
-
"name": field.name,
|
|
59
|
-
"type": field.type.__name__ if hasattr(field.type, '__name__') else str(field.type),
|
|
60
|
-
"default": field.default if (field.default is not None and '_MISSING_TYPE' not in str(field.default)) else __metadata.get('default', None),
|
|
61
|
-
"metadata": __metadata
|
|
62
|
-
})
|
|
63
|
-
return __fields
|
|
36
|
+
raise OrionisIntegrityException("The 'path' attribute must be a non-empty string.")
|