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.
Files changed (154) hide show
  1. orionis/console/base/command.py +57 -50
  2. orionis/console/base/contracts/command.py +68 -0
  3. orionis/console/dynamic/contracts/progress_bar.py +3 -3
  4. orionis/console/dynamic/progress_bar.py +8 -8
  5. orionis/console/output/console.py +8 -2
  6. orionis/console/output/contracts/console.py +1 -1
  7. orionis/container/container.py +2 -2
  8. orionis/container/context/scope.py +4 -1
  9. orionis/container/contracts/service_provider.py +2 -2
  10. orionis/container/entities/binding.py +31 -44
  11. orionis/container/enums/lifetimes.py +22 -1
  12. orionis/container/facades/facade.py +1 -2
  13. orionis/container/providers/service_provider.py +2 -2
  14. orionis/foundation/application.py +542 -248
  15. orionis/foundation/config/app/entities/app.py +107 -90
  16. orionis/foundation/config/auth/entities/auth.py +4 -33
  17. orionis/foundation/config/cache/entities/cache.py +18 -41
  18. orionis/foundation/config/cache/entities/file.py +8 -35
  19. orionis/foundation/config/cache/entities/stores.py +17 -38
  20. orionis/foundation/config/cors/entities/cors.py +41 -54
  21. orionis/foundation/config/database/entities/connections.py +40 -56
  22. orionis/foundation/config/database/entities/database.py +11 -38
  23. orionis/foundation/config/database/entities/mysql.py +48 -76
  24. orionis/foundation/config/database/entities/oracle.py +30 -57
  25. orionis/foundation/config/database/entities/pgsql.py +45 -61
  26. orionis/foundation/config/database/entities/sqlite.py +26 -53
  27. orionis/foundation/config/filesystems/entitites/aws.py +28 -49
  28. orionis/foundation/config/filesystems/entitites/disks.py +27 -47
  29. orionis/foundation/config/filesystems/entitites/filesystems.py +15 -37
  30. orionis/foundation/config/filesystems/entitites/local.py +9 -35
  31. orionis/foundation/config/filesystems/entitites/public.py +14 -41
  32. orionis/foundation/config/logging/entities/channels.py +56 -86
  33. orionis/foundation/config/logging/entities/chunked.py +9 -9
  34. orionis/foundation/config/logging/entities/daily.py +8 -8
  35. orionis/foundation/config/logging/entities/hourly.py +6 -6
  36. orionis/foundation/config/logging/entities/logging.py +12 -18
  37. orionis/foundation/config/logging/entities/monthly.py +7 -7
  38. orionis/foundation/config/logging/entities/stack.py +5 -5
  39. orionis/foundation/config/logging/entities/weekly.py +6 -6
  40. orionis/foundation/config/mail/entities/file.py +9 -36
  41. orionis/foundation/config/mail/entities/mail.py +22 -40
  42. orionis/foundation/config/mail/entities/mailers.py +29 -44
  43. orionis/foundation/config/mail/entities/smtp.py +47 -48
  44. orionis/foundation/config/queue/entities/brokers.py +19 -41
  45. orionis/foundation/config/queue/entities/database.py +24 -46
  46. orionis/foundation/config/queue/entities/queue.py +28 -40
  47. orionis/foundation/config/roots/paths.py +272 -468
  48. orionis/foundation/config/session/entities/session.py +23 -53
  49. orionis/foundation/config/startup.py +165 -135
  50. orionis/foundation/config/testing/entities/testing.py +137 -122
  51. orionis/foundation/config/testing/enums/__init__.py +6 -2
  52. orionis/foundation/config/testing/enums/drivers.py +16 -0
  53. orionis/foundation/config/testing/enums/verbosity.py +18 -0
  54. orionis/foundation/contracts/application.py +152 -362
  55. orionis/foundation/providers/console_provider.py +24 -2
  56. orionis/foundation/providers/dumper_provider.py +24 -2
  57. orionis/foundation/providers/logger_provider.py +24 -2
  58. orionis/foundation/providers/path_resolver_provider.py +25 -2
  59. orionis/foundation/providers/progress_bar_provider.py +24 -2
  60. orionis/foundation/providers/testing_provider.py +39 -0
  61. orionis/foundation/providers/workers_provider.py +24 -2
  62. orionis/metadata/framework.py +1 -1
  63. orionis/services/environment/helpers/functions.py +1 -2
  64. orionis/services/environment/key/__init__.py +0 -0
  65. orionis/services/environment/key/key_generator.py +37 -0
  66. orionis/support/entities/__init__.py +0 -0
  67. orionis/support/entities/base.py +104 -0
  68. orionis/support/facades/testing.py +15 -0
  69. orionis/support/facades/workers.py +1 -1
  70. orionis/test/cases/asynchronous.py +0 -11
  71. orionis/test/cases/synchronous.py +0 -9
  72. orionis/test/contracts/dumper.py +11 -4
  73. orionis/test/contracts/kernel.py +5 -110
  74. orionis/test/contracts/logs.py +27 -65
  75. orionis/test/contracts/printer.py +16 -128
  76. orionis/test/contracts/test_result.py +100 -0
  77. orionis/test/contracts/unit_test.py +87 -150
  78. orionis/test/core/unit_test.py +608 -554
  79. orionis/test/entities/result.py +22 -2
  80. orionis/test/enums/__init__.py +0 -2
  81. orionis/test/enums/status.py +14 -9
  82. orionis/test/exceptions/config.py +9 -1
  83. orionis/test/exceptions/failure.py +34 -11
  84. orionis/test/exceptions/persistence.py +10 -2
  85. orionis/test/exceptions/runtime.py +9 -1
  86. orionis/test/exceptions/value.py +13 -1
  87. orionis/test/kernel.py +87 -289
  88. orionis/test/output/dumper.py +82 -18
  89. orionis/test/output/printer.py +399 -156
  90. orionis/test/records/logs.py +203 -82
  91. orionis/test/validators/__init__.py +33 -0
  92. orionis/test/validators/base_path.py +45 -0
  93. orionis/test/validators/execution_mode.py +45 -0
  94. orionis/test/validators/fail_fast.py +37 -0
  95. orionis/test/validators/folder_path.py +34 -0
  96. orionis/test/validators/module_name.py +31 -0
  97. orionis/test/validators/name_pattern.py +40 -0
  98. orionis/test/validators/pattern.py +36 -0
  99. orionis/test/validators/persistent.py +42 -0
  100. orionis/test/validators/persistent_driver.py +43 -0
  101. orionis/test/validators/print_result.py +37 -0
  102. orionis/test/validators/tags.py +37 -0
  103. orionis/test/validators/throw_exception.py +39 -0
  104. orionis/test/validators/verbosity.py +37 -0
  105. orionis/test/validators/web_report.py +35 -0
  106. orionis/test/validators/workers.py +31 -0
  107. orionis/test/view/render.py +48 -54
  108. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/METADATA +1 -1
  109. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/RECORD +149 -98
  110. tests/container/__init__.py +0 -0
  111. tests/container/context/__init__.py +0 -0
  112. tests/container/context/test_manager.py +27 -0
  113. tests/container/context/test_scope.py +23 -0
  114. tests/container/entities/__init__.py +0 -0
  115. tests/container/entities/test_binding.py +133 -0
  116. tests/container/enums/__init__.py +0 -0
  117. tests/container/enums/test_lifetimes.py +63 -0
  118. tests/container/facades/__init__.py +0 -0
  119. tests/container/facades/test_facade.py +61 -0
  120. tests/container/mocks/__init__.py +0 -0
  121. tests/container/mocks/mock_complex_classes.py +482 -0
  122. tests/container/mocks/mock_simple_classes.py +32 -0
  123. tests/container/providers/__init__.py +0 -0
  124. tests/container/providers/test_providers.py +48 -0
  125. tests/container/resolver/__init__.py +0 -0
  126. tests/container/resolver/test_resolver.py +55 -0
  127. tests/container/test_container.py +254 -0
  128. tests/container/test_singleton.py +98 -0
  129. tests/container/test_thread_safety.py +217 -0
  130. tests/container/validators/__init__.py +0 -0
  131. tests/container/validators/test_implements.py +140 -0
  132. tests/container/validators/test_is_abstract_class.py +99 -0
  133. tests/container/validators/test_is_callable.py +73 -0
  134. tests/container/validators/test_is_concrete_class.py +97 -0
  135. tests/container/validators/test_is_instance.py +105 -0
  136. tests/container/validators/test_is_not_subclass.py +117 -0
  137. tests/container/validators/test_is_subclass.py +115 -0
  138. tests/container/validators/test_is_valid_alias.py +113 -0
  139. tests/container/validators/test_lifetime.py +75 -0
  140. tests/foundation/config/testing/test_foundation_config_testing.py +1 -1
  141. tests/metadata/test_metadata_framework.py +18 -18
  142. tests/testing/test_testing_result.py +117 -117
  143. tests/testing/test_testing_unit.py +209 -209
  144. orionis/foundation/config/base.py +0 -112
  145. orionis/test/arguments/parser.py +0 -187
  146. orionis/test/contracts/parser.py +0 -43
  147. orionis/test/entities/arguments.py +0 -38
  148. orionis/test/enums/execution_mode.py +0 -16
  149. /orionis/{test/arguments → console/base/contracts}/__init__.py +0 -0
  150. /orionis/foundation/config/testing/enums/{test_mode.py → mode.py} +0 -0
  151. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/WHEEL +0 -0
  152. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/licenses/LICENCE +0 -0
  153. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/top_level.txt +0 -0
  154. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/zip-safe +0 -0
@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass, field
2
- from orionis.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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": lambda : Stack().toDict()
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": lambda: Hourly().toDict()
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": lambda: Daily().toDict()
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": lambda: Weekly().toDict()
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": lambda: Monthly().toDict()
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": lambda: Chunked().toDict()
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
- if not isinstance(self.stack, Stack):
80
- if isinstance(self.stack, dict):
81
- try:
82
- self.stack = Stack(**self.stack)
83
- except TypeError as e:
84
- raise OrionisIntegrityException(
85
- f"Invalid stack configuration: {e}"
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
- if not isinstance(self.hourly, Hourly):
93
- if isinstance(self.hourly, dict):
94
- try:
95
- self.hourly = Hourly(**self.hourly)
96
- except TypeError as e:
97
- raise OrionisIntegrityException(
98
- f"Invalid hourly configuration: {e}"
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
- if not isinstance(self.daily, Daily):
106
- if isinstance(self.daily, dict):
107
- try:
108
- self.daily = Daily(**self.daily)
109
- except TypeError as e:
110
- raise OrionisIntegrityException(
111
- f"Invalid daily configuration: {e}"
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
- if not isinstance(self.weekly, Weekly):
119
- if isinstance(self.weekly, dict):
120
- try:
121
- self.weekly = Weekly(**self.weekly)
122
- except TypeError as e:
123
- raise OrionisIntegrityException(
124
- f"Invalid weekly configuration: {e}"
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
- if not isinstance(self.monthly, Monthly):
132
- if isinstance(self.monthly, dict):
133
- try:
134
- self.monthly = Monthly(**self.monthly)
135
- except TypeError as e:
136
- raise OrionisIntegrityException(
137
- f"Invalid monthly configuration: {e}"
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
- if not isinstance(self.chunked, Chunked):
145
- if isinstance(self.chunked, dict):
146
- try:
147
- self.chunked = Chunked(**self.chunked)
148
- except TypeError as e:
149
- raise OrionisIntegrityException(
150
- f"Invalid chunked configuration: {e}"
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.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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": lambda: Channels().toDict()
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
- if isinstance(self.channels, dict):
63
- try:
64
- self.channels = Channels(**self.channels)
65
- except TypeError as e:
66
- raise OrionisIntegrityException(
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.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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.foundation.config.base import BaseConfigEntity
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(BaseConfigEntity):
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 asdict, dataclass, field, fields
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={"description": "The file path where outgoing emails are stored."}
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.")