orionis 0.252.0__py3-none-any.whl → 0.265.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/application.py +6 -0
- orionis/framework.py +1 -1
- orionis/luminate/{application.py → _application.py} +21 -19
- orionis/luminate/{container → _container}/container.py +4 -4
- orionis/luminate/{container → _container}/container_integrity.py +2 -2
- orionis/luminate/{container → _container}/resolve.py +2 -2
- orionis/luminate/{contracts → _contracts}/application.py +2 -2
- orionis/luminate/{contracts → _contracts}/console/task_manager.py +1 -1
- orionis/luminate/{contracts → _contracts}/facades/commands/scheduler_facade.py +1 -1
- orionis/luminate/{contracts → _contracts}/facades/facade.py +4 -3
- orionis/luminate/{contracts → _contracts}/foundation/providers/service_providers_bootstrapper.py +2 -2
- orionis/luminate/{contracts → _contracts}/providers/service_provider.py +1 -1
- orionis/luminate/{facades → _facades}/app_facade.py +2 -2
- orionis/luminate/{facades → _facades}/commands/commands_facade.py +3 -3
- orionis/luminate/{facades → _facades}/commands/scheduler_facade.py +3 -3
- orionis/luminate/{facades → _facades}/config/config_facade.py +3 -3
- orionis/luminate/{facades → _facades}/environment/environment_facade.py +3 -3
- orionis/luminate/{facades → _facades}/files/path_facade.py +4 -4
- orionis/luminate/{facades → _facades}/log/log_facade.py +2 -2
- orionis/luminate/{foundation → _foundation}/console/command_bootstrapper.py +2 -2
- orionis/luminate/{foundation → _foundation}/environment/environment_bootstrapper.py +3 -3
- orionis/luminate/{foundation → _foundation/foundation}/config/config_bootstrapper.py +3 -3
- orionis/luminate/{foundation → _foundation}/providers/service_providers_bootstrapper.py +4 -4
- orionis/luminate/{providers → _providers}/commands/reactor_commands_service_provider.py +7 -7
- orionis/luminate/{providers → _providers}/commands/scheduler_provider.py +3 -3
- orionis/luminate/{providers → _providers}/config/config_service_provider.py +3 -3
- orionis/luminate/{providers → _providers}/environment/environment__service_provider.py +4 -4
- orionis/luminate/_providers/files/paths_provider.py +21 -0
- orionis/luminate/{providers → _providers}/log/log_service_provider.py +5 -5
- orionis/luminate/{providers → _providers}/service_provider.py +2 -2
- orionis/luminate/{services_ → _services}/commands/reactor_commands_service.py +3 -3
- orionis/luminate/{services_ → _services}/commands/scheduler_service.py +1 -1
- orionis/luminate/{services_ → _services}/config/config_service.py +1 -1
- orionis/luminate/{services_ → _services}/log/log_service.py +1 -1
- orionis/luminate/app.py +19 -0
- orionis/luminate/console/base/command.py +1 -1
- orionis/luminate/console/command_filter.py +1 -1
- orionis/luminate/console/commands/help.py +1 -1
- orionis/luminate/console/commands/schedule_work.py +2 -2
- orionis/luminate/console/dumper/dump_die.py +1 -1
- orionis/luminate/console/kernel.py +1 -1
- orionis/luminate/console/output/console.py +3 -3
- orionis/luminate/console/output/executor.py +1 -1
- orionis/luminate/console/output/progress_bar.py +1 -1
- orionis/luminate/console/parser.py +1 -1
- orionis/luminate/{config → foundation/config}/app/entities/app.py +44 -43
- orionis/luminate/{config → foundation/config}/auth/entities/auth.py +9 -1
- orionis/luminate/foundation/config/cache/entities/cache.py +74 -0
- orionis/luminate/foundation/config/cache/entities/file.py +46 -0
- orionis/luminate/foundation/config/cache/entities/stores.py +46 -0
- orionis/luminate/{contracts/config → foundation/config/contracts}/config.py +8 -12
- orionis/luminate/foundation/config/cors/entities/cors.py +129 -0
- orionis/luminate/foundation/config/database/entities/connections.py +89 -0
- orionis/luminate/foundation/config/database/entities/database.py +62 -0
- orionis/luminate/foundation/config/database/entities/mysql.py +270 -0
- orionis/luminate/foundation/config/database/entities/oracle.py +227 -0
- orionis/luminate/foundation/config/database/entities/pgsql.py +189 -0
- orionis/luminate/foundation/config/database/entities/sqlite.py +178 -0
- orionis/luminate/foundation/config/database/enums/mysql_charsets.py +92 -0
- orionis/luminate/foundation/config/database/enums/mysql_collations.py +53 -0
- orionis/luminate/foundation/config/database/enums/mysql_engine.py +18 -0
- orionis/luminate/foundation/config/database/enums/oracle_encoding.py +44 -0
- orionis/luminate/foundation/config/database/enums/oracle_nencoding.py +31 -0
- orionis/luminate/foundation/config/database/enums/pgsql_charsets.py +90 -0
- orionis/luminate/foundation/config/database/enums/pgsql_collations.py +26 -0
- orionis/luminate/foundation/config/database/enums/pgsql_mode.py +24 -0
- orionis/luminate/foundation/config/database/enums/sqlite_foreign_key.py +12 -0
- orionis/luminate/foundation/config/database/enums/sqlite_journal.py +22 -0
- orionis/luminate/foundation/config/database/enums/sqlite_synchronous.py +16 -0
- orionis/luminate/foundation/config/filesystems/entitites/aws.py +134 -0
- orionis/luminate/foundation/config/filesystems/entitites/disks.py +68 -0
- orionis/luminate/foundation/config/filesystems/entitites/filesystems.py +53 -0
- orionis/luminate/foundation/config/filesystems/entitites/local.py +39 -0
- orionis/luminate/foundation/config/filesystems/entitites/public.py +52 -0
- orionis/luminate/foundation/config/logging/entities/channels.py +115 -0
- orionis/luminate/foundation/config/logging/entities/chunked.py +128 -0
- orionis/luminate/foundation/config/logging/entities/daily.py +113 -0
- orionis/luminate/foundation/config/logging/entities/hourly.py +100 -0
- orionis/luminate/foundation/config/logging/entities/logging.py +51 -0
- orionis/luminate/foundation/config/logging/entities/monthly.py +100 -0
- orionis/luminate/foundation/config/logging/entities/stack.py +74 -0
- orionis/luminate/foundation/config/logging/entities/weekly.py +102 -0
- orionis/luminate/foundation/config/logging/enums/levels.py +21 -0
- orionis/luminate/foundation/config/mail/entities/file.py +41 -0
- orionis/luminate/foundation/config/mail/entities/mail.py +56 -0
- orionis/luminate/foundation/config/mail/entities/mailers.py +54 -0
- orionis/luminate/foundation/config/mail/entities/smtp.py +104 -0
- orionis/luminate/foundation/config/queue/entities/brokers.py +55 -0
- orionis/luminate/foundation/config/queue/entities/database.py +107 -0
- orionis/luminate/foundation/config/queue/entities/queue.py +47 -0
- orionis/luminate/foundation/config/queue/enums/strategy.py +15 -0
- orionis/luminate/foundation/config/roots/paths.py +446 -0
- orionis/luminate/foundation/config/session/entities/session.py +147 -0
- orionis/luminate/foundation/config/session/enums/same_site_policy.py +14 -0
- orionis/luminate/foundation/config/session/helpers/secret_key.py +16 -0
- orionis/luminate/foundation/config/startup.py +203 -0
- orionis/luminate/foundation/config/testing/entities/__init__.py +0 -0
- orionis/luminate/{config → foundation/config/testing}/entities/testing.py +36 -20
- orionis/luminate/foundation/config/testing/enums/__init__.py +0 -0
- orionis/luminate/foundation/config/testing/enums/test_mode.py +12 -0
- orionis/luminate/patterns/__init__.py +0 -4
- orionis/luminate/patterns/singleton/__init__.py +0 -10
- orionis/luminate/services/asynchrony/__init__.py +0 -0
- orionis/luminate/services/asynchrony/async_io.py +31 -0
- orionis/luminate/services/environment/__init__.py +0 -10
- orionis/luminate/services/environment/contracts/__init__.py +0 -5
- orionis/luminate/services/environment/contracts/env.py +0 -11
- orionis/luminate/services/environment/dot_env.py +87 -163
- orionis/luminate/services/environment/env.py +0 -11
- orionis/luminate/services/introspection/__init__.py +0 -0
- orionis/luminate/services/introspection/abstracts/__init__.py +0 -0
- orionis/luminate/services/introspection/abstracts/entities/__init__.py +0 -0
- orionis/luminate/services/introspection/abstracts/entities/abstract_class_attributes.py +37 -0
- orionis/luminate/{support → services}/introspection/abstracts/reflect_abstract.py +1 -1
- orionis/luminate/services/introspection/dependencies/__init__.py +0 -0
- orionis/luminate/services/introspection/dependencies/contracts/__init__.py +0 -0
- orionis/luminate/{support → services}/introspection/dependencies/contracts/reflect_dependencies.py +2 -2
- orionis/luminate/services/introspection/dependencies/entities/__init__.py +0 -0
- orionis/luminate/services/introspection/dependencies/entities/class_dependencies.py +41 -0
- orionis/luminate/services/introspection/dependencies/entities/method_dependencies.py +42 -0
- orionis/luminate/services/introspection/dependencies/entities/resolved_dependencies.py +49 -0
- orionis/luminate/{support → services}/introspection/dependencies/reflect_dependencies.py +4 -4
- orionis/luminate/services/parsers/__init__.py +0 -0
- orionis/luminate/services/parsers/contracts/__init__.py +0 -0
- orionis/luminate/{support/parsers/exception_parser.py → services/parsers/exception.py} +1 -1
- orionis/luminate/services/parsers/serializer.py +15 -0
- orionis/luminate/services/paths/__init__.py +0 -9
- orionis/luminate/services/paths/resolver.py +1 -1
- orionis/luminate/services/standard/__init__.py +0 -0
- orionis/luminate/services/standard/contracts/__init__.py +0 -0
- orionis/luminate/{support → services}/standard/std.py +1 -1
- orionis/luminate/services/system/__init__.py +0 -0
- orionis/luminate/services/system/contracts/__init__.py +0 -0
- orionis/luminate/services/system/contracts/imports.py +31 -0
- orionis/luminate/services/system/contracts/workers.py +18 -0
- orionis/luminate/services/system/imports.py +124 -0
- orionis/luminate/services/system/runtime_imports.py +70 -0
- orionis/luminate/services/{workers/maximum_workers.py → system/workers.py} +2 -1
- orionis/luminate/services/wrapper/__init__.py +0 -0
- orionis/luminate/services/wrapper/dicts/__init__.py +0 -0
- orionis/luminate/services/wrapper/dicts/dot_dict.py +115 -0
- orionis/luminate/support/introspection/__init__.py +0 -5
- orionis/luminate/support/introspection/container_integrity.py +2 -2
- orionis/luminate/support/introspection/instances/__init__.py +0 -5
- orionis/luminate/support/introspection/reflection.py +1 -1
- orionis/luminate/test/__init__.py +0 -23
- orionis/luminate/test/cases/test_async.py +41 -9
- orionis/luminate/test/cases/test_case.py +27 -13
- orionis/luminate/test/cases/test_sync.py +28 -6
- orionis/luminate/test/output/contracts/{test_std_out.py → dumper.py} +2 -1
- orionis/luminate/test/output/{test_std_out.py → dumper.py} +7 -4
- orionis/luminate/test/suites/__init__.py +0 -0
- orionis/luminate/test/suites/contracts/__init__.py +0 -0
- orionis/luminate/test/suites/contracts/test_suite.py +23 -0
- orionis/luminate/test/suites/test_suite.py +101 -0
- orionis/luminate/test/{core → suites}/test_unit.py +16 -8
- orionis/unittesting.py +43 -0
- {orionis-0.252.0.dist-info → orionis-0.265.0.dist-info}/METADATA +19 -3
- orionis-0.265.0.dist-info/RECORD +440 -0
- {orionis-0.252.0.dist-info → orionis-0.265.0.dist-info}/WHEEL +1 -1
- orionis-0.265.0.dist-info/entry_points.txt +2 -0
- orionis-0.265.0.dist-info/zip-safe +1 -0
- tests/example/test_example.py +1 -1
- tests/foundation/__init__.py +0 -0
- tests/foundation/config/__init__.py +0 -0
- tests/foundation/config/app/__init__.py +0 -0
- tests/foundation/config/app/test_app.py +140 -0
- tests/foundation/config/auth/__init__.py +0 -0
- tests/{config → foundation/config/auth}/test_auth.py +6 -3
- tests/foundation/config/cache/__init__.py +0 -0
- tests/foundation/config/cache/test_cache.py +98 -0
- tests/foundation/config/cache/test_cache_file.py +78 -0
- tests/foundation/config/cache/test_cache_stores.py +88 -0
- tests/foundation/config/cors/__init__.py +0 -0
- tests/foundation/config/cors/test_cors.py +121 -0
- tests/foundation/config/database/__init__.py +0 -0
- tests/foundation/config/database/test_database.py +108 -0
- tests/foundation/config/database/test_database_connections.py +129 -0
- tests/foundation/config/database/test_database_mysql.py +231 -0
- tests/foundation/config/database/test_database_oracle.py +204 -0
- tests/foundation/config/database/test_database_pgsql.py +187 -0
- tests/foundation/config/database/test_database_sqlite.py +153 -0
- tests/foundation/config/exceptions/__init__.py +0 -0
- tests/foundation/config/exceptions/test_exceptions_integrity.py +83 -0
- tests/foundation/config/filesystems/__init__.py +0 -0
- tests/foundation/config/filesystems/test_filesystems.py +110 -0
- tests/foundation/config/filesystems/test_filesystems_aws.py +133 -0
- tests/foundation/config/filesystems/test_filesystems_disks.py +114 -0
- tests/foundation/config/filesystems/test_filesystems_local.py +95 -0
- tests/foundation/config/filesystems/test_filesystems_public.py +120 -0
- tests/foundation/config/logging/__init__.py +0 -0
- tests/foundation/config/logging/test_logging.py +48 -0
- tests/foundation/config/logging/test_logging_channels.py +157 -0
- tests/foundation/config/logging/test_logging_chunked.py +166 -0
- tests/foundation/config/logging/test_logging_daily.py +153 -0
- tests/foundation/config/logging/test_logging_hourly.py +131 -0
- tests/foundation/config/logging/test_logging_monthly.py +133 -0
- tests/foundation/config/logging/test_logging_stack.py +124 -0
- tests/foundation/config/logging/test_logging_weekly.py +133 -0
- tests/foundation/config/mail/__init__.py +0 -0
- tests/foundation/config/mail/test_mail.py +73 -0
- tests/foundation/config/mail/test_mail_file.py +61 -0
- tests/foundation/config/mail/test_mail_mailers.py +58 -0
- tests/foundation/config/mail/test_mail_smtp.py +102 -0
- tests/foundation/config/queue/__init__.py +0 -0
- tests/foundation/config/queue/test_queue.py +58 -0
- tests/foundation/config/queue/test_queue_brokers.py +67 -0
- tests/foundation/config/queue/test_queue_database.py +95 -0
- tests/foundation/config/root/__init__.py +0 -0
- tests/foundation/config/root/test_root_paths.py +134 -0
- tests/foundation/config/session/__init__.py +0 -0
- tests/foundation/config/session/test_session.py +138 -0
- tests/foundation/config/startup/__init__.py +0 -0
- tests/foundation/config/startup/test_config_startup.py +134 -0
- tests/foundation/config/testing/__init__.py +0 -0
- tests/foundation/config/testing/test_testing.py +167 -0
- tests/patterns/singleton/test_singleton.py +2 -2
- tests/services/asynchrony/__init__.py +0 -0
- tests/{support/async_io/test_async_coroutine.py → services/asynchrony/test_async_io.py} +6 -5
- tests/services/environment/test_env.py +155 -33
- tests/services/inspection/__init__.py +0 -0
- tests/services/inspection/dependencies/__init__.py +0 -0
- tests/services/inspection/dependencies/mocks/__init__.py +0 -0
- tests/services/inspection/dependencies/mocks/mock_user.py +30 -0
- tests/services/inspection/dependencies/mocks/mock_user_controller.py +27 -0
- tests/services/inspection/dependencies/mocks/mock_users_permissions.py +41 -0
- tests/services/inspection/dependencies/test_reflect_dependencies.py +94 -0
- tests/services/parsers/__init__.py +0 -0
- tests/services/parsers/mocks/__init__.py +0 -0
- tests/services/parsers/mocks/mock_custom_error.py +15 -0
- tests/{support → services}/parsers/test_exception_parser.py +8 -8
- tests/services/path/__init__.py +0 -0
- tests/services/path/test_resolver.py +73 -0
- tests/services/standard/__init__.py +0 -0
- tests/services/standard/test_std.py +127 -0
- tests/services/wrapper/__init__.py +0 -0
- tests/services/wrapper/test_wrapper_doc_dict.py +129 -0
- tests/testing/__init__.py +0 -0
- tests/testing/test_testing_result.py +92 -0
- tests/testing/test_testing_unit.py +138 -0
- orionis/luminate/config/app/__init__.py +0 -10
- orionis/luminate/config/auth/__init__.py +0 -7
- orionis/luminate/config/cache/__init__.py +0 -9
- orionis/luminate/config/cache/entities/cache.py +0 -58
- orionis/luminate/config/cache/entities/file.py +0 -29
- orionis/luminate/config/cache/entities/stores.py +0 -35
- orionis/luminate/config/entities/cors.py +0 -58
- orionis/luminate/config/entities/database.py +0 -204
- orionis/luminate/config/entities/filesystems.py +0 -98
- orionis/luminate/config/entities/logging.py +0 -157
- orionis/luminate/config/entities/mail.py +0 -76
- orionis/luminate/config/entities/queue.py +0 -62
- orionis/luminate/config/entities/session.py +0 -58
- orionis/luminate/providers/files/paths_provider.py +0 -20
- orionis/luminate/services/workers/__init__.py +0 -10
- orionis/luminate/support/adapters/dot_dict.py +0 -29
- orionis/luminate/support/asynchrony/async_io.py +0 -40
- orionis/luminate/support/asynchrony/contracts/async_coroutine.py +0 -26
- orionis/luminate/support/introspection/abstracts/entities/abstract_class_attributes.py +0 -11
- orionis/luminate/support/introspection/dependencies/__init__.py +0 -5
- orionis/luminate/support/introspection/dependencies/entities/class_dependencies.py +0 -11
- orionis/luminate/support/introspection/dependencies/entities/method_dependencies.py +0 -11
- orionis/luminate/support/introspection/dependencies/entities/resolved_dependencies.py +0 -12
- orionis/luminate/support/paths/contracts/resolver.py +0 -67
- orionis/luminate/support/paths/resolver.py +0 -83
- orionis/luminate/test/core/contracts/test_suite.py +0 -30
- orionis/luminate/test/core/test_suite.py +0 -93
- orionis-0.252.0.dist-info/RECORD +0 -318
- orionis-0.252.0.dist-info/entry_points.txt +0 -2
- tests/config/test_app.py +0 -122
- tests/config/test_cache.py +0 -20
- tests/support/adapters/fakes/fake_dict.py +0 -15
- tests/support/adapters/test_doct_dict.py +0 -21
- tests/support/inspection/fakes/fake_reflect_dependencies.py +0 -25
- tests/support/inspection/test_reflect_dependencies.py +0 -67
- tests/support/parsers/fakes/fake_custom_error.py +0 -27
- tests/support/path/test_resolver.py +0 -33
- tests/support/standard/test_std.py +0 -62
- /orionis/{console.py → clinstall.py} +0 -0
- /orionis/luminate/{config → _container}/__init__.py +0 -0
- /orionis/luminate/{container → _container}/exception.py +0 -0
- /orionis/luminate/{container → _container}/lifetimes.py +0 -0
- /orionis/luminate/{config/app/entities → _contracts}/__init__.py +0 -0
- /orionis/luminate/{config/app/enums → _contracts/config}/__init__.py +0 -0
- /orionis/luminate/{config/contracts → _contracts/config}/config.py +0 -0
- /orionis/luminate/{config/auth/entities → _contracts/console}/__init__.py +0 -0
- /orionis/luminate/{config/cache/entities → _contracts/console/base}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/console/base/command.py +0 -0
- /orionis/luminate/{contracts → _contracts}/console/command_filter.py +0 -0
- /orionis/luminate/{contracts → _contracts}/console/kernel.py +0 -0
- /orionis/luminate/{config/cache/enums → _contracts/console/output}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/console/output/console.py +0 -0
- /orionis/luminate/{contracts → _contracts}/console/output/executor.py +0 -0
- /orionis/luminate/{contracts → _contracts}/console/output/progress_bar.py +0 -0
- /orionis/luminate/{contracts → _contracts}/console/parser.py +0 -0
- /orionis/luminate/{contracts → _contracts}/container/container.py +0 -0
- /orionis/luminate/{contracts → _contracts}/container/container_integrity.py +0 -0
- /orionis/luminate/{config/contracts → _contracts/facades}/__init__.py +0 -0
- /orionis/luminate/{config/exceptions → _contracts/facades/commands}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/facades/commands/commands_facade.py +0 -0
- /orionis/luminate/{container → _contracts/facades/config}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/facades/config/config_facade.py +0 -0
- /orionis/luminate/{contracts → _contracts/facades/environment}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/facades/environment/environment_facade.py +0 -0
- /orionis/luminate/{contracts/config → _contracts/facades/files}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/facades/files/path_facade.py +0 -0
- /orionis/luminate/{contracts/console → _contracts/facades/log}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/facades/log/log_facade.py +0 -0
- /orionis/luminate/{contracts/console/base → _contracts/facades/tests}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/facades/tests/tests_facade.py +0 -0
- /orionis/luminate/{contracts/console/output → _contracts/foundation}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/foundation/bootstraper.py +0 -0
- /orionis/luminate/{contracts/facades → _contracts/foundation/config}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/foundation/config/config_bootstrapper.py +0 -0
- /orionis/luminate/{contracts/facades/commands → _contracts/foundation/console}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/foundation/console/command_bootstrapper.py +0 -0
- /orionis/luminate/{contracts/facades/config → _contracts/foundation/environment}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/foundation/environment/environment_bootstrapper.py +0 -0
- /orionis/luminate/{contracts/facades/environment → _contracts/foundation/providers}/__init__.py +0 -0
- /orionis/luminate/{contracts/facades/files → _contracts/providers}/__init__.py +0 -0
- /orionis/luminate/{contracts/facades/log → _contracts/services}/__init__.py +0 -0
- /orionis/luminate/{contracts/facades/tests → _contracts/services/commands}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/services/commands/reactor_commands_service.py +0 -0
- /orionis/luminate/{contracts → _contracts}/services/commands/schedule_service.py +0 -0
- /orionis/luminate/{contracts/foundation → _contracts/services/config}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/services/config/config_service.py +0 -0
- /orionis/luminate/{contracts/foundation/config → _contracts/services/environment}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/services/environment/environment_service.py +0 -0
- /orionis/luminate/{contracts/foundation/console → _contracts/services/files}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/services/files/path_resolver_service.py +0 -0
- /orionis/luminate/{contracts/foundation/environment → _contracts/services/log}/__init__.py +0 -0
- /orionis/luminate/{contracts → _contracts}/services/log/log_service.py +0 -0
- /orionis/luminate/{contracts → _contracts}/support/exception_parse.py +0 -0
- /orionis/luminate/{contracts → _contracts}/support/reflection.py +0 -0
- /orionis/luminate/{contracts/foundation/providers → _facades}/__init__.py +0 -0
- /orionis/luminate/{contracts/providers → _facades/commands}/__init__.py +0 -0
- /orionis/luminate/{contracts/services → _facades/config}/__init__.py +0 -0
- /orionis/luminate/{contracts/services/commands → _facades/environment}/__init__.py +0 -0
- /orionis/luminate/{contracts/services/config → _facades/files}/__init__.py +0 -0
- /orionis/luminate/{contracts/services/environment → _facades/log}/__init__.py +0 -0
- /orionis/luminate/{contracts/services/files → _foundation}/__init__.py +0 -0
- /orionis/luminate/{contracts/services/log → _foundation/console}/__init__.py +0 -0
- /orionis/luminate/{facades → _foundation/environment}/__init__.py +0 -0
- /orionis/luminate/{facades/commands → _foundation/exceptions}/__init__.py +0 -0
- /orionis/luminate/{foundation → _foundation}/exceptions/exception_bootstrapper.py +0 -0
- /orionis/luminate/{foundation → _foundation}/exceptions/exception_providers.py +0 -0
- /orionis/luminate/{facades → _foundation/foundation}/config/__init__.py +0 -0
- /orionis/luminate/{facades/environment → _foundation/providers}/__init__.py +0 -0
- /orionis/luminate/{facades/files → _providers}/__init__.py +0 -0
- /orionis/luminate/{facades/log → _providers/commands}/__init__.py +0 -0
- /orionis/luminate/{foundation/console → _providers/config}/__init__.py +0 -0
- /orionis/luminate/{foundation → _providers}/environment/__init__.py +0 -0
- /orionis/luminate/{foundation/exceptions → _providers/files}/__init__.py +0 -0
- /orionis/luminate/{foundation/providers → _providers/log}/__init__.py +0 -0
- /orionis/luminate/{providers → _services}/__init__.py +0 -0
- /orionis/luminate/{providers → _services}/commands/__init__.py +0 -0
- /orionis/luminate/{providers → _services}/config/__init__.py +0 -0
- /orionis/luminate/{providers/environment → _services/log}/__init__.py +0 -0
- /orionis/luminate/{providers/files → foundation/config/app}/__init__.py +0 -0
- /orionis/luminate/{providers/log → foundation/config/app/entities}/__init__.py +0 -0
- /orionis/luminate/{services_ → foundation/config/app/enums}/__init__.py +0 -0
- /orionis/luminate/{config → foundation/config}/app/enums/ciphers.py +0 -0
- /orionis/luminate/{config → foundation/config}/app/enums/environments.py +0 -0
- /orionis/luminate/{services_/commands → foundation/config/auth}/__init__.py +0 -0
- /orionis/luminate/{services_/config → foundation/config/auth/entities}/__init__.py +0 -0
- /orionis/luminate/{services_/log → foundation/config/cache}/__init__.py +0 -0
- /orionis/luminate/{support/adapters → foundation/config/cache/entities}/__init__.py +0 -0
- /orionis/luminate/{support/asynchrony → foundation/config/cache/enums}/__init__.py +0 -0
- /orionis/luminate/{config → foundation/config}/cache/enums/drivers.py +0 -0
- /orionis/luminate/{support/asynchrony → foundation/config}/contracts/__init__.py +0 -0
- /orionis/luminate/{support/introspection/abstracts → foundation/config/cors}/__init__.py +0 -0
- /orionis/luminate/{support/introspection/abstracts → foundation/config/cors}/entities/__init__.py +0 -0
- /orionis/luminate/{support/introspection/dependencies/contracts → foundation/config/database}/__init__.py +0 -0
- /orionis/luminate/{support/introspection/dependencies → foundation/config/database}/entities/__init__.py +0 -0
- /orionis/luminate/{support/parsers → foundation/config/database/enums}/__init__.py +0 -0
- /orionis/luminate/{support/parsers/contracts → foundation/config/exceptions}/__init__.py +0 -0
- /orionis/luminate/{config/exceptions/integrity_exception.py → foundation/config/exceptions/integrity.py} +0 -0
- /orionis/luminate/{support/paths → foundation/config/filesystems}/__init__.py +0 -0
- /orionis/luminate/{support/paths/contracts → foundation/config/filesystems/entitites}/__init__.py +0 -0
- /orionis/luminate/{support/standard → foundation/config/logging}/__init__.py +0 -0
- /orionis/luminate/{support/standard/contracts → foundation/config/logging/entities}/__init__.py +0 -0
- /orionis/luminate/{test/core → foundation/config/logging/enums}/__init__.py +0 -0
- /orionis/luminate/{test/core/contracts → foundation/config/mail}/__init__.py +0 -0
- {tests/config → orionis/luminate/foundation/config/mail/entities}/__init__.py +0 -0
- {tests/support/adapters → orionis/luminate/foundation/config/queue}/__init__.py +0 -0
- {tests/support/adapters/fakes → orionis/luminate/foundation/config/queue/entities}/__init__.py +0 -0
- {tests/support/async_io → orionis/luminate/foundation/config/roots}/__init__.py +0 -0
- {tests/support/parsers → orionis/luminate/foundation/config/session}/__init__.py +0 -0
- {tests/support/parsers/fakes → orionis/luminate/foundation/config/session/entities}/__init__.py +0 -0
- {tests/support/path → orionis/luminate/foundation/config/session/enums}/__init__.py +0 -0
- {tests/support/standard → orionis/luminate/foundation/config/testing}/__init__.py +0 -0
- /orionis/luminate/{support → services}/parsers/contracts/exception_parser.py +0 -0
- /orionis/luminate/{support → services}/standard/contracts/std.py +0 -0
- /orionis/luminate/test/exceptions/{test_exception.py → test_failure_exception.py} +0 -0
- /orionis/luminate/test/{core → suites}/contracts/test_unit.py +0 -0
- {orionis-0.252.0.dist-info → orionis-0.265.0.dist-info/licenses}/LICENCE +0 -0
- {orionis-0.252.0.dist-info → orionis-0.265.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,446 @@
|
|
1
|
+
from dataclasses import asdict, dataclass, field
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import Dict
|
4
|
+
from orionis.luminate.foundation.config.exceptions.integrity import OrionisIntegrityException
|
5
|
+
|
6
|
+
@dataclass(frozen=True, kw_only=True)
|
7
|
+
class Paths:
|
8
|
+
"""
|
9
|
+
A frozen dataclass representing the canonical directory and file structure
|
10
|
+
for a Laravel-inspired Python project.
|
11
|
+
|
12
|
+
This class provides type-safe access to all standard project paths and includes
|
13
|
+
validation to ensure path integrity. All paths are relative to the project root.
|
14
|
+
|
15
|
+
Attributes are organized into logical groups:
|
16
|
+
- Application components (controllers, models, services)
|
17
|
+
- Resources (views, assets, translations)
|
18
|
+
- Routing configuration
|
19
|
+
- Configuration and database
|
20
|
+
- Storage locations
|
21
|
+
"""
|
22
|
+
|
23
|
+
# --- Application Paths ---
|
24
|
+
console_scheduler: str = field(
|
25
|
+
default='app/console/kernel.py',
|
26
|
+
metadata={
|
27
|
+
'description': 'Path to the console scheduler (Kernel) file.',
|
28
|
+
'type': 'file',
|
29
|
+
'required': True
|
30
|
+
}
|
31
|
+
)
|
32
|
+
|
33
|
+
console_commands: str = field(
|
34
|
+
default='app/console/commands',
|
35
|
+
metadata={
|
36
|
+
'description': 'Directory containing custom Artisan-style console commands.',
|
37
|
+
'type': 'directory',
|
38
|
+
'required': True
|
39
|
+
}
|
40
|
+
)
|
41
|
+
|
42
|
+
http_controllers: str = field(
|
43
|
+
default='app/http/controllers',
|
44
|
+
metadata={
|
45
|
+
'description': 'Directory containing HTTP controller classes.',
|
46
|
+
'type': 'directory',
|
47
|
+
'required': True
|
48
|
+
}
|
49
|
+
)
|
50
|
+
|
51
|
+
http_middleware: str = field(
|
52
|
+
default='app/http/middleware',
|
53
|
+
metadata={
|
54
|
+
'description': 'Directory containing HTTP middleware classes.',
|
55
|
+
'type': 'directory',
|
56
|
+
'required': True
|
57
|
+
}
|
58
|
+
)
|
59
|
+
|
60
|
+
http_requests: str = field(
|
61
|
+
default='app/http/requests',
|
62
|
+
metadata={
|
63
|
+
'description': 'Directory containing HTTP form request validation classes.',
|
64
|
+
'type': 'directory',
|
65
|
+
'required': False
|
66
|
+
}
|
67
|
+
)
|
68
|
+
|
69
|
+
models: str = field(
|
70
|
+
default='app/models',
|
71
|
+
metadata={
|
72
|
+
'description': 'Directory containing ORM model classes.',
|
73
|
+
'type': 'directory',
|
74
|
+
'required': True
|
75
|
+
}
|
76
|
+
)
|
77
|
+
|
78
|
+
providers: str = field(
|
79
|
+
default='app/providers',
|
80
|
+
metadata={
|
81
|
+
'description': 'Directory containing service provider classes.',
|
82
|
+
'type': 'directory',
|
83
|
+
'required': True
|
84
|
+
}
|
85
|
+
)
|
86
|
+
|
87
|
+
events: str = field(
|
88
|
+
default='app/events',
|
89
|
+
metadata={
|
90
|
+
'description': 'Directory containing event classes.',
|
91
|
+
'type': 'directory',
|
92
|
+
'required': False
|
93
|
+
}
|
94
|
+
)
|
95
|
+
|
96
|
+
listeners: str = field(
|
97
|
+
default='app/listeners',
|
98
|
+
metadata={
|
99
|
+
'description': 'Directory containing event listener classes.',
|
100
|
+
'type': 'directory',
|
101
|
+
'required': False
|
102
|
+
}
|
103
|
+
)
|
104
|
+
|
105
|
+
notifications: str = field(
|
106
|
+
default='app/notifications',
|
107
|
+
metadata={
|
108
|
+
'description': 'Directory containing notification classes.',
|
109
|
+
'type': 'directory',
|
110
|
+
'required': False
|
111
|
+
}
|
112
|
+
)
|
113
|
+
|
114
|
+
jobs: str = field(
|
115
|
+
default='app/jobs',
|
116
|
+
metadata={
|
117
|
+
'description': 'Directory containing queued job classes.',
|
118
|
+
'type': 'directory',
|
119
|
+
'required': False
|
120
|
+
}
|
121
|
+
)
|
122
|
+
|
123
|
+
policies: str = field(
|
124
|
+
default='app/policies',
|
125
|
+
metadata={
|
126
|
+
'description': 'Directory containing authorization policy classes.',
|
127
|
+
'type': 'directory',
|
128
|
+
'required': False
|
129
|
+
}
|
130
|
+
)
|
131
|
+
|
132
|
+
exceptions: str = field(
|
133
|
+
default='app/exceptions',
|
134
|
+
metadata={
|
135
|
+
'description': 'Directory containing exception handler classes.',
|
136
|
+
'type': 'directory',
|
137
|
+
'required': True
|
138
|
+
}
|
139
|
+
)
|
140
|
+
|
141
|
+
services: str = field(
|
142
|
+
default='app/services',
|
143
|
+
metadata={
|
144
|
+
'description': 'Directory containing business logic service classes.',
|
145
|
+
'type': 'directory',
|
146
|
+
'required': False
|
147
|
+
}
|
148
|
+
)
|
149
|
+
|
150
|
+
# --- Resource Paths ---
|
151
|
+
views: str = field(
|
152
|
+
default='resources/views',
|
153
|
+
metadata={
|
154
|
+
'description': 'Directory containing template view files.',
|
155
|
+
'type': 'directory',
|
156
|
+
'required': True
|
157
|
+
}
|
158
|
+
)
|
159
|
+
|
160
|
+
lang: str = field(
|
161
|
+
default='resources/lang',
|
162
|
+
metadata={
|
163
|
+
'description': 'Directory containing internationalization files.',
|
164
|
+
'type': 'directory',
|
165
|
+
'required': False
|
166
|
+
}
|
167
|
+
)
|
168
|
+
|
169
|
+
assets: str = field(
|
170
|
+
default='resources/assets',
|
171
|
+
metadata={
|
172
|
+
'description': 'Directory containing frontend assets (JS, CSS, images).',
|
173
|
+
'type': 'directory',
|
174
|
+
'required': False
|
175
|
+
}
|
176
|
+
)
|
177
|
+
|
178
|
+
# --- Routing Paths ---
|
179
|
+
routes_web: str = field(
|
180
|
+
default='routes/web.py',
|
181
|
+
metadata={
|
182
|
+
'description': 'Path to the web routes definition file.',
|
183
|
+
'type': 'file',
|
184
|
+
'required': True
|
185
|
+
}
|
186
|
+
)
|
187
|
+
|
188
|
+
routes_api: str = field(
|
189
|
+
default='routes/api.py',
|
190
|
+
metadata={
|
191
|
+
'description': 'Path to the API routes definition file.',
|
192
|
+
'type': 'file',
|
193
|
+
'required': False
|
194
|
+
}
|
195
|
+
)
|
196
|
+
|
197
|
+
routes_console: str = field(
|
198
|
+
default='routes/console.py',
|
199
|
+
metadata={
|
200
|
+
'description': 'Path to the console routes definition file.',
|
201
|
+
'type': 'file',
|
202
|
+
'required': False
|
203
|
+
}
|
204
|
+
)
|
205
|
+
|
206
|
+
routes_channels: str = field(
|
207
|
+
default='routes/channels.py',
|
208
|
+
metadata={
|
209
|
+
'description': 'Path to the broadcast channels routes file.',
|
210
|
+
'type': 'file',
|
211
|
+
'required': False
|
212
|
+
}
|
213
|
+
)
|
214
|
+
|
215
|
+
# --- Configuration & Database Paths ---
|
216
|
+
config: str = field(
|
217
|
+
default='config',
|
218
|
+
metadata={
|
219
|
+
'description': 'Directory containing application configuration files.',
|
220
|
+
'type': 'directory',
|
221
|
+
'required': True
|
222
|
+
}
|
223
|
+
)
|
224
|
+
|
225
|
+
migrations: str = field(
|
226
|
+
default='database/migrations',
|
227
|
+
metadata={
|
228
|
+
'description': 'Directory containing database migration files.',
|
229
|
+
'type': 'directory',
|
230
|
+
'required': True
|
231
|
+
}
|
232
|
+
)
|
233
|
+
|
234
|
+
seeders: str = field(
|
235
|
+
default='database/seeders',
|
236
|
+
metadata={
|
237
|
+
'description': 'Directory containing database seeder files.',
|
238
|
+
'type': 'directory',
|
239
|
+
'required': False
|
240
|
+
}
|
241
|
+
)
|
242
|
+
|
243
|
+
factories: str = field(
|
244
|
+
default='database/factories',
|
245
|
+
metadata={
|
246
|
+
'description': 'Directory containing model factory files.',
|
247
|
+
'type': 'directory',
|
248
|
+
'required': False
|
249
|
+
}
|
250
|
+
)
|
251
|
+
|
252
|
+
# --- Storage Paths ---
|
253
|
+
storage_logs: str = field(
|
254
|
+
default='storage/logs',
|
255
|
+
metadata={
|
256
|
+
'description': 'Directory containing application log files.',
|
257
|
+
'type': 'directory',
|
258
|
+
'required': True
|
259
|
+
}
|
260
|
+
)
|
261
|
+
|
262
|
+
storage_framework: str = field(
|
263
|
+
default='storage/framework',
|
264
|
+
metadata={
|
265
|
+
'description': 'Directory for framework-generated files (cache, sessions, views).',
|
266
|
+
'type': 'directory',
|
267
|
+
'required': True
|
268
|
+
}
|
269
|
+
)
|
270
|
+
|
271
|
+
storage_sessions: str = field(
|
272
|
+
default='storage/framework/sessions',
|
273
|
+
metadata={
|
274
|
+
'description': 'Directory containing session files.',
|
275
|
+
'type': 'directory',
|
276
|
+
'required': False
|
277
|
+
}
|
278
|
+
)
|
279
|
+
|
280
|
+
storage_cache: str = field(
|
281
|
+
default='storage/framework/cache',
|
282
|
+
metadata={
|
283
|
+
'description': 'Directory containing framework cache files.',
|
284
|
+
'type': 'directory',
|
285
|
+
'required': False
|
286
|
+
}
|
287
|
+
)
|
288
|
+
|
289
|
+
storage_views: str = field(
|
290
|
+
default='storage/framework/views',
|
291
|
+
metadata={
|
292
|
+
'description': 'Directory containing compiled view files.',
|
293
|
+
'type': 'directory',
|
294
|
+
'required': False
|
295
|
+
}
|
296
|
+
)
|
297
|
+
|
298
|
+
def __post_init__(self) -> None:
|
299
|
+
"""
|
300
|
+
Validates all path fields after initialization.
|
301
|
+
|
302
|
+
Raises:
|
303
|
+
OrionisIntegrityException: If any path is invalid (empty or not a string)
|
304
|
+
"""
|
305
|
+
for field_name, field_info in self.__dataclass_fields__.items():
|
306
|
+
value = getattr(self, field_name)
|
307
|
+
metadata:dict = field_info.metadata
|
308
|
+
|
309
|
+
if not isinstance(value, str) or not value.strip():
|
310
|
+
raise OrionisIntegrityException(
|
311
|
+
f"Invalid path value for '{field_name}': {value!r}. Must be non-empty string."
|
312
|
+
)
|
313
|
+
|
314
|
+
if metadata.get('required', False) and not value:
|
315
|
+
raise OrionisIntegrityException(
|
316
|
+
f"Required path '{field_name}' cannot be empty."
|
317
|
+
)
|
318
|
+
|
319
|
+
# --- Path Accessors ---
|
320
|
+
def getConsoleScheduler(self) -> Path:
|
321
|
+
"""Get Path object for console scheduler file."""
|
322
|
+
return Path(self.console_scheduler)
|
323
|
+
|
324
|
+
def getConsoleCommands(self) -> Path:
|
325
|
+
"""Get Path object for console commands directory."""
|
326
|
+
return Path(self.console_commands)
|
327
|
+
|
328
|
+
def getHttpControllers(self) -> Path:
|
329
|
+
"""Get Path object for HTTP controllers directory."""
|
330
|
+
return Path(self.http_controllers)
|
331
|
+
|
332
|
+
def getHttpMiddleware(self) -> Path:
|
333
|
+
"""Get Path object for HTTP middleware directory."""
|
334
|
+
return Path(self.http_middleware)
|
335
|
+
|
336
|
+
def getHttpRequests(self) -> Path:
|
337
|
+
"""Get Path object for HTTP requests directory."""
|
338
|
+
return Path(self.http_requests)
|
339
|
+
|
340
|
+
def getModels(self) -> Path:
|
341
|
+
"""Get Path object for models directory."""
|
342
|
+
return Path(self.models)
|
343
|
+
|
344
|
+
def getProviders(self) -> Path:
|
345
|
+
"""Get Path object for service providers directory."""
|
346
|
+
return Path(self.providers)
|
347
|
+
|
348
|
+
def getEvents(self) -> Path:
|
349
|
+
"""Get Path object for events directory."""
|
350
|
+
return Path(self.events)
|
351
|
+
|
352
|
+
def getListeners(self) -> Path:
|
353
|
+
"""Get Path object for event listeners directory."""
|
354
|
+
return Path(self.listeners)
|
355
|
+
|
356
|
+
def getNotifications(self) -> Path:
|
357
|
+
"""Get Path object for notifications directory."""
|
358
|
+
return Path(self.notifications)
|
359
|
+
|
360
|
+
def getJobs(self) -> Path:
|
361
|
+
"""Get Path object for queued jobs directory."""
|
362
|
+
return Path(self.jobs)
|
363
|
+
|
364
|
+
def getPolicies(self) -> Path:
|
365
|
+
"""Get Path object for authorization policies directory."""
|
366
|
+
return Path(self.policies)
|
367
|
+
|
368
|
+
def getExceptions(self) -> Path:
|
369
|
+
"""Get Path object for exceptions directory."""
|
370
|
+
return Path(self.exceptions)
|
371
|
+
|
372
|
+
def getServices(self) -> Path:
|
373
|
+
"""Get Path object for services directory."""
|
374
|
+
return Path(self.services)
|
375
|
+
|
376
|
+
def getViews(self) -> Path:
|
377
|
+
"""Get Path object for views directory."""
|
378
|
+
return Path(self.views)
|
379
|
+
|
380
|
+
def getLang(self) -> Path:
|
381
|
+
"""Get Path object for language files directory."""
|
382
|
+
return Path(self.lang)
|
383
|
+
|
384
|
+
def getAssets(self) -> Path:
|
385
|
+
"""Get Path object for assets directory."""
|
386
|
+
return Path(self.assets)
|
387
|
+
|
388
|
+
def getRoutesWeb(self) -> Path:
|
389
|
+
"""Get Path object for web routes file."""
|
390
|
+
return Path(self.routes_web)
|
391
|
+
|
392
|
+
def getRoutesApi(self) -> Path:
|
393
|
+
"""Get Path object for API routes file."""
|
394
|
+
return Path(self.routes_api)
|
395
|
+
|
396
|
+
def getRoutesConsole(self) -> Path:
|
397
|
+
"""Get Path object for console routes file."""
|
398
|
+
return Path(self.routes_console)
|
399
|
+
|
400
|
+
def getRoutesChannels(self) -> Path:
|
401
|
+
"""Get Path object for broadcast channels routes file."""
|
402
|
+
return Path(self.routes_channels)
|
403
|
+
|
404
|
+
def getConfig(self) -> Path:
|
405
|
+
"""Get Path object for config directory."""
|
406
|
+
return Path(self.config)
|
407
|
+
|
408
|
+
def getMigrations(self) -> Path:
|
409
|
+
"""Get Path object for migrations directory."""
|
410
|
+
return Path(self.migrations)
|
411
|
+
|
412
|
+
def getSeeders(self) -> Path:
|
413
|
+
"""Get Path object for seeders directory."""
|
414
|
+
return Path(self.seeders)
|
415
|
+
|
416
|
+
def getFactories(self) -> Path:
|
417
|
+
"""Get Path object for model factories directory."""
|
418
|
+
return Path(self.factories)
|
419
|
+
|
420
|
+
def getStorageLogs(self) -> Path:
|
421
|
+
"""Get Path object for logs directory."""
|
422
|
+
return Path(self.storage_logs)
|
423
|
+
|
424
|
+
def getStorageFramework(self) -> Path:
|
425
|
+
"""Get Path object for framework storage directory."""
|
426
|
+
return Path(self.storage_framework)
|
427
|
+
|
428
|
+
def getStorageSessions(self) -> Path:
|
429
|
+
"""Get Path object for sessions storage directory."""
|
430
|
+
return Path(self.storage_sessions)
|
431
|
+
|
432
|
+
def getStorageCache(self) -> Path:
|
433
|
+
"""Get Path object for cache storage directory."""
|
434
|
+
return Path(self.storage_cache)
|
435
|
+
|
436
|
+
def getStorageViews(self) -> Path:
|
437
|
+
"""Get Path object for compiled views storage directory."""
|
438
|
+
return Path(self.storage_views)
|
439
|
+
|
440
|
+
def toDict(self) -> Dict[str, str]:
|
441
|
+
"""
|
442
|
+
Returns a dictionary representation of all paths.
|
443
|
+
Returns:
|
444
|
+
Dict[str, str]: Dictionary mapping field names to path strings
|
445
|
+
"""
|
446
|
+
return asdict(self)
|
@@ -0,0 +1,147 @@
|
|
1
|
+
from dataclasses import asdict, dataclass, field
|
2
|
+
from typing import Optional
|
3
|
+
from orionis.luminate.foundation.config.exceptions.integrity import OrionisIntegrityException
|
4
|
+
from orionis.luminate.foundation.config.session.enums.same_site_policy import SameSitePolicy
|
5
|
+
from orionis.luminate.foundation.config.session.helpers.secret_key import SecretKey
|
6
|
+
from orionis.luminate.services.environment.env import Env
|
7
|
+
|
8
|
+
@dataclass(unsafe_hash=True, kw_only=True)
|
9
|
+
class Session:
|
10
|
+
"""
|
11
|
+
Configuration for Starlette session middleware.
|
12
|
+
|
13
|
+
Attributes:
|
14
|
+
secret_key (str): Secret key for signing session cookies (required).
|
15
|
+
session_cookie (str): Name of the session cookie. Defaults to 'session'.
|
16
|
+
max_age (Optional[int]): Session expiration in seconds. None for browser session.
|
17
|
+
same_site (Literal['lax', 'strict', 'none']): SameSite cookie policy.
|
18
|
+
path (str): Cookie path. Defaults to '/'.
|
19
|
+
https_only (bool): Restrict cookies to HTTPS. Defaults to False.
|
20
|
+
domain (Optional[str]): Cookie domain for cross-subdomain usage.
|
21
|
+
"""
|
22
|
+
secret_key: str = field(
|
23
|
+
default_factory=lambda: Env.get('APP_KEY', SecretKey.random()),
|
24
|
+
metadata={
|
25
|
+
"description": "Secret key for signing session cookies (required).",
|
26
|
+
"default": "APP_KEY"
|
27
|
+
}
|
28
|
+
)
|
29
|
+
|
30
|
+
session_cookie: str = field(
|
31
|
+
default_factory=lambda: Env.get('SESSION_COOKIE_NAME', 'orionis_session'),
|
32
|
+
metadata={
|
33
|
+
"description": "Name of the session cookie.",
|
34
|
+
"default": "orionis_session"
|
35
|
+
}
|
36
|
+
)
|
37
|
+
|
38
|
+
max_age: Optional[int] = field(
|
39
|
+
default_factory=lambda: Env.get('SESSION_MAX_AGE', 30*60),
|
40
|
+
metadata={
|
41
|
+
"description": "Session expiration in seconds. None for browser session.",
|
42
|
+
"default": "1800 (30 minutes)"
|
43
|
+
}
|
44
|
+
)
|
45
|
+
|
46
|
+
same_site: str | SameSitePolicy = field(
|
47
|
+
default_factory=lambda: Env.get('SESSION_SAME_SITE', SameSitePolicy.LAX),
|
48
|
+
metadata={
|
49
|
+
"description": "SameSite cookie policy.",
|
50
|
+
"options": ["lax", "strict", "none"],
|
51
|
+
"default": "lax"
|
52
|
+
}
|
53
|
+
)
|
54
|
+
|
55
|
+
path: str = field(
|
56
|
+
default_factory=lambda: Env.get('SESSION_PATH', '/'),
|
57
|
+
metadata={
|
58
|
+
"description": "Cookie path.",
|
59
|
+
"default": "/"
|
60
|
+
}
|
61
|
+
)
|
62
|
+
|
63
|
+
https_only: bool = field(
|
64
|
+
default_factory=lambda: Env.get('SESSION_HTTPS_ONLY', False),
|
65
|
+
metadata={
|
66
|
+
"description": "Restrict cookies to HTTPS.",
|
67
|
+
"default": False
|
68
|
+
}
|
69
|
+
)
|
70
|
+
|
71
|
+
domain: Optional[str] = field(
|
72
|
+
default_factory=lambda: Env.get('SESSION_DOMAIN'),
|
73
|
+
metadata={
|
74
|
+
"description": "Cookie domain for cross-subdomain usage.",
|
75
|
+
"default": None
|
76
|
+
}
|
77
|
+
)
|
78
|
+
|
79
|
+
def __post_init__(self):
|
80
|
+
"""
|
81
|
+
Validates the initialization parameters of the session entity.
|
82
|
+
Raises:
|
83
|
+
OrionisIntegrityException: If any of the following conditions are not met:
|
84
|
+
- `secret_key` must be a non-empty string.
|
85
|
+
- `secret_key` must be at least 32 characters long.
|
86
|
+
- `max_age` must be an integer or None.
|
87
|
+
- `same_site` must be one of: 'lax', 'strict', 'none'.
|
88
|
+
- If `same_site` is 'none', `https_only` must be True.
|
89
|
+
- `domain` must be a string or None.
|
90
|
+
"""
|
91
|
+
|
92
|
+
# Validate secret_key
|
93
|
+
if not isinstance(self.secret_key, str) or not self.secret_key.strip():
|
94
|
+
raise OrionisIntegrityException("Session secret_key must be a non-empty string")
|
95
|
+
|
96
|
+
# Validate session_cookie
|
97
|
+
if not isinstance(self.session_cookie, str) or not self.session_cookie.strip():
|
98
|
+
raise OrionisIntegrityException("session_cookie must be a non-empty string")
|
99
|
+
if any(c in self.session_cookie for c in ' ;,'):
|
100
|
+
raise OrionisIntegrityException("session_cookie must not contain spaces, semicolons, or commas")
|
101
|
+
|
102
|
+
# Validate max_age
|
103
|
+
if self.max_age is not None:
|
104
|
+
if not isinstance(self.max_age, int):
|
105
|
+
raise OrionisIntegrityException("max_age must be an integer or None")
|
106
|
+
if self.max_age <= 0:
|
107
|
+
raise OrionisIntegrityException("max_age must be a positive integer if set")
|
108
|
+
|
109
|
+
# Validate same_site
|
110
|
+
if not isinstance(self.same_site, (str, SameSitePolicy)):
|
111
|
+
raise OrionisIntegrityException("same_site must be a string or SameSitePolicy")
|
112
|
+
if isinstance(self.same_site, str):
|
113
|
+
options = SameSitePolicy._member_names_
|
114
|
+
_value = self.same_site.upper().strip()
|
115
|
+
if _value not in options:
|
116
|
+
raise OrionisIntegrityException(f"same_site must be one of: {', '.join(options)}")
|
117
|
+
else:
|
118
|
+
self.same_site = SameSitePolicy[_value].value
|
119
|
+
elif isinstance(self.same_site, SameSitePolicy):
|
120
|
+
self.same_site = self.same_site.value
|
121
|
+
|
122
|
+
# Validate path
|
123
|
+
if not isinstance(self.path, str) or not self.path.startswith('/'):
|
124
|
+
raise OrionisIntegrityException("path must be a string starting with '/'")
|
125
|
+
|
126
|
+
# Validate https_only
|
127
|
+
if not isinstance(self.https_only, bool):
|
128
|
+
raise OrionisIntegrityException("https_only must be a boolean value")
|
129
|
+
|
130
|
+
# Validate domain
|
131
|
+
if self.domain is not None:
|
132
|
+
if not isinstance(self.domain, str) or not self.domain.strip():
|
133
|
+
raise OrionisIntegrityException("domain must be a non-empty string or None")
|
134
|
+
if self.domain.startswith('.') or self.domain.endswith('.'):
|
135
|
+
raise OrionisIntegrityException("domain must not start or end with a dot")
|
136
|
+
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
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from enum import Enum
|
2
|
+
|
3
|
+
class SameSitePolicy(Enum):
|
4
|
+
"""
|
5
|
+
Enumeration representing the possible values for the SameSite attribute of cookies.
|
6
|
+
|
7
|
+
Attributes:
|
8
|
+
LAX (str): Cookies are withheld on cross-site subrequests, but sent when a user navigates to the URL from an external site (e.g., following a link).
|
9
|
+
STRICT (str): Cookies are only sent in a first-party context and not with requests initiated by third party websites.
|
10
|
+
NONE (str): Cookies are sent in all contexts, i.e., in responses to both first-party and cross-origin requests.
|
11
|
+
"""
|
12
|
+
LAX = "lax"
|
13
|
+
STRICT = "strict"
|
14
|
+
NONE = "none"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import secrets
|
2
|
+
|
3
|
+
class SecretKey:
|
4
|
+
|
5
|
+
@staticmethod
|
6
|
+
def random(length: int = 32) -> str:
|
7
|
+
"""
|
8
|
+
Generates a cryptographically secure random key of the specified length (in bytes), returned as a hex string.
|
9
|
+
|
10
|
+
Args:
|
11
|
+
length (int): Length of the key in bytes. Default is 32.
|
12
|
+
|
13
|
+
Returns:
|
14
|
+
str: A random key as a hexadecimal string.
|
15
|
+
"""
|
16
|
+
return secrets.token_hex(length)
|