python-ddd-framework 0.3.2__py3-none-any.whl → 0.4.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.
- python_ddd_framework/__init__.py +139 -21
- python_ddd_framework/application/builder.py +23 -78
- python_ddd_framework/application/composition.py +4 -22
- python_ddd_framework/application/runtime.py +96 -291
- python_ddd_framework/application/state.py +7 -75
- python_ddd_framework/application_services/__init__.py +5 -21
- python_ddd_framework/{services/application_bindings.py → application_services/bindings.py} +52 -9
- python_ddd_framework/application_services/catalog.py +36 -288
- python_ddd_framework/application_services/contracts.py +14 -13
- python_ddd_framework/application_services/dispatcher.py +19 -269
- python_ddd_framework/application_services/invocation.py +126 -7
- python_ddd_framework/application_services/module.py +168 -0
- python_ddd_framework/application_services/pagination.py +21 -0
- python_ddd_framework/auditing/control.py +1 -1
- python_ddd_framework/auditing/module.py +15 -0
- python_ddd_framework/authorization/__init__.py +2 -0
- python_ddd_framework/authorization/contracts.py +7 -2
- python_ddd_framework/authorization/definitions.py +5 -0
- python_ddd_framework/authorization/module.py +40 -0
- python_ddd_framework/authorization/options.py +7 -0
- python_ddd_framework/background_execution/child.py +13 -3
- python_ddd_framework/background_execution/declarations.py +45 -0
- python_ddd_framework/background_execution/lifecycle.py +12 -0
- python_ddd_framework/background_execution/module.py +107 -1
- python_ddd_framework/background_jobs/catalog.py +59 -42
- python_ddd_framework/background_jobs/contracts.py +16 -19
- python_ddd_framework/background_jobs/pgqueuer/enqueue.py +4 -0
- python_ddd_framework/background_jobs/pgqueuer/module.py +2 -1
- python_ddd_framework/background_jobs/pgqueuer/runtime.py +7 -7
- python_ddd_framework/background_workers/catalog.py +23 -36
- python_ddd_framework/background_workers/contracts.py +3 -0
- python_ddd_framework/background_workers/execution.py +1 -1
- python_ddd_framework/background_workers/runtime.py +38 -1
- python_ddd_framework/caching/__init__.py +7 -6
- python_ddd_framework/caching/contracts.py +65 -67
- python_ddd_framework/caching/errors.py +0 -7
- python_ddd_framework/caching/module.py +18 -0
- python_ddd_framework/caching/naming.py +29 -0
- python_ddd_framework/caching/options.py +38 -0
- python_ddd_framework/caching/unit_of_work.py +46 -0
- python_ddd_framework/cli/__init__.py +31 -6
- python_ddd_framework/cli/project.py +68 -6
- python_ddd_framework/cli/runtime.py +1 -1
- python_ddd_framework/developer_kit/generation.py +75 -22
- python_ddd_framework/developer_kit/project_metadata.py +2 -4
- python_ddd_framework/developer_kit/templates/basic/cookiecutter.json +4 -0
- python_ddd_framework/developer_kit/templates/basic/{{cookiecutter.module_name}}/README.md +45 -0
- python_ddd_framework/developer_kit/templates/basic/{{cookiecutter.module_name}}/__init__.py.jinja +0 -0
- python_ddd_framework/developer_kit/templates/basic/{{cookiecutter.module_name}}/contracts/__init__.py.jinja +0 -0
- python_ddd_framework/developer_kit/templates/basic/{{cookiecutter.module_name}}/contracts/conversion_service.py.jinja +7 -0
- python_ddd_framework/developer_kit/templates/basic/{{cookiecutter.module_name}}/module.py.jinja +38 -0
- python_ddd_framework/developer_kit/templates/basic/{{cookiecutter.module_name}}/services/__init__.py.jinja +0 -0
- python_ddd_framework/developer_kit/templates/basic/{{cookiecutter.module_name}}/services/default_conversion_service.py.jinja +10 -0
- python_ddd_framework/developer_kit/templates/module/cookiecutter.json +1 -1
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/README.md +41 -49
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/order_approval/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/order_approval/handler.py.jinja +45 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/order_approval/payload.py.jinja +8 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/order_statistics/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/order_statistics/handler.py.jinja +35 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/order_statistics/payload.py.jinja +5 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_jobs/order_statistics/schedule.py.jinja +15 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_workers/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_workers/order_maintenance_worker.py.jinja +28 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/background_workers/order_statistics_worker.py.jinja +26 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/caching/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/caching/order_cache.py.jinja +9 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/caching/statistics_cache.py.jinja +9 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/event_handlers/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/event_handlers/order_changed_handler.py.jinja +23 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/hosted_services/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/{integration.py.jinja → hosted_services/order_integration_service.py.jinja} +8 -2
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/hosted_services/order_observation_handler.py.jinja +16 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/integration_services/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/integration_services/order_reporting_service.py.jinja +16 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/interceptors/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/interceptors/order_timing_interceptor.py.jinja +17 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/module.py.jinja +105 -10
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/options/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/{options.py.jinja → options/order_options.py.jinja} +1 -1
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/services/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/services/order_approval_service.py.jinja +65 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/services/order_management_service.py.jinja +35 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/services/order_query_service.py.jinja +41 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/setting_handlers/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/setting_handlers/approval_setting_observer.py.jinja +17 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/inputs/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/inputs/approve_order.py.jinja +6 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/inputs/create_order.py.jinja +7 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/integration_services/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/integration_services/order_reporting_service.py.jinja +7 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/module.py.jinja +39 -2
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/services/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/services/order_approval_service.py.jinja +13 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/services/order_management_service.py.jinja +10 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/services/order_query_service.py.jinja +12 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/views/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/views/order_statistics_snapshot.py.jinja +9 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/views/order_view.py.jinja +12 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/entities/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/{orders.py.jinja → entities/order.py.jinja} +10 -18
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/events/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/events/order_changed.py.jinja +13 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/module.py.jinja +42 -3
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/repositories/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/repositories/order_repository.py.jinja +17 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/seeding/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/seeding/order_seed_contributor.py.jinja +22 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/services/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/services/order_approval_service.py.jinja +23 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/settings/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/{settings.py.jinja → settings/approval_settings.py.jinja} +3 -2
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/value_objects/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/value_objects/order_title.py.jinja +10 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/constants/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/constants/order_constants.py.jinja +3 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/enums/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/enums/order_status.py.jinja +6 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/errors/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/errors/order_errors.py.jinja +11 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/messages/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/messages/order_messages.py.jinja +26 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/messages/order_observation.py.jinja +13 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/module.py.jinja +40 -1
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/permissions/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/{permissions.py.jinja → permissions/order_permission_provider.py.jinja} +6 -2
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/permissions/order_permissions.py.jinja +7 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/value_objects/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/value_objects/money.py.jinja +18 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/filters/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/filters/export_filter.py.jinja +15 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/models/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/models/refresh_orders.py.jinja +5 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/module.py.jinja +85 -7
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/routers/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/{files.py.jinja → routers/order_files.py.jinja} +23 -20
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/websockets/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/websockets/order_socket.py.jinja +44 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/sqlalchemy/migrations/__init__.py.jinja +1 -1
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/sqlalchemy/models/__init__.py.jinja +1 -7
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/sqlalchemy/models/base.py.jinja +7 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/sqlalchemy/models/{orders.py.jinja → order_model.py.jinja} +7 -3
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/sqlalchemy/module.py.jinja +42 -5
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/sqlalchemy/repositories/order_repository.py.jinja +79 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/tests/__init__.py.jinja +1 -0
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/tests/test_domain.py.jinja +4 -3
- python_ddd_framework/developer_kit/templates/project/cookiecutter.json +1 -1
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/AGENTS.md +16 -3
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/README.md +29 -22
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{app.development.yaml.jinja → backend/app.development.yaml.jinja} +2 -0
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{pyproject.toml.jinja → backend/pyproject.toml.jinja} +1 -1
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{src → backend/src}/host/main.py.jinja +2 -0
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{src → backend/src}/host/module.py.jinja +40 -3
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/docs/architecture.md +40 -10
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/docs/development.md +134 -23
- python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/scripts/.gitkeep +0 -0
- python_ddd_framework/distributed_lock/contracts.py +4 -1
- python_ddd_framework/domain/__init__.py +2 -0
- python_ddd_framework/domain/services.py +11 -0
- python_ddd_framework/errors/business.py +10 -1
- python_ddd_framework/errors/lifecycle.py +3 -31
- python_ddd_framework/events/__init__.py +5 -2
- python_ddd_framework/events/aggregate.py +3 -3
- python_ddd_framework/events/catalog.py +12 -11
- python_ddd_framework/events/contracts.py +6 -1
- python_ddd_framework/events/contribution.py +1 -52
- python_ddd_framework/events/entities.py +23 -0
- python_ddd_framework/events/module.py +97 -0
- python_ddd_framework/events/runtime.py +80 -29
- python_ddd_framework/events/subscription.py +36 -0
- python_ddd_framework/events/unit_of_work.py +25 -0
- python_ddd_framework/extensions/__init__.py +22 -0
- python_ddd_framework/extensions/catalog.py +198 -0
- python_ddd_framework/extensions/contracts.py +85 -0
- python_ddd_framework/extensions/models.py +142 -0
- python_ddd_framework/extensions/module.py +21 -0
- python_ddd_framework/fastapi/__init__.py +2 -0
- python_ddd_framework/fastapi/action.py +1 -2
- python_ddd_framework/fastapi/adapter.py +16 -0
- python_ddd_framework/fastapi/application_services.py +43 -25
- python_ddd_framework/fastapi/background.py +2 -1
- python_ddd_framework/fastapi/contracts.py +26 -8
- python_ddd_framework/fastapi/health.py +1 -1
- python_ddd_framework/fastapi/module.py +14 -0
- python_ddd_framework/fastapi/parameters.py +3 -18
- python_ddd_framework/fastapi/realtime/connection.py +10 -7
- python_ddd_framework/fastapi/realtime/module.py +3 -0
- python_ddd_framework/fastapi/realtime/runtime.py +10 -24
- python_ddd_framework/fastapi/request_context.py +2 -1
- python_ddd_framework/fastapi/routing.py +2 -1
- python_ddd_framework/fastapi/server.py +8 -0
- python_ddd_framework/fastapi/settings.py +2 -1
- python_ddd_framework/hosted_services/bridge.py +20 -1
- python_ddd_framework/hosted_services/catalog.py +6 -16
- python_ddd_framework/hosted_services/contracts.py +4 -0
- python_ddd_framework/hosted_services/declarations.py +15 -0
- python_ddd_framework/hosted_services/module.py +69 -0
- python_ddd_framework/hosted_services/runtime.py +30 -1
- python_ddd_framework/identity/__init__.py +24 -0
- python_ddd_framework/identity/application.py +38 -90
- python_ddd_framework/identity/contracts.py +181 -16
- python_ddd_framework/identity/http_api.py +79 -2
- python_ddd_framework/identity/management.py +166 -0
- python_ddd_framework/identity/module.py +12 -4
- python_ddd_framework/identity/services.py +29 -16
- python_ddd_framework/identity/sqlalchemy/migrations/0003_extra_properties.py +26 -0
- python_ddd_framework/identity/sqlalchemy/migrations/0004_concurrency_version.py +29 -0
- python_ddd_framework/identity/sqlalchemy/models.py +21 -2
- python_ddd_framework/identity/sqlalchemy/module.py +11 -2
- python_ddd_framework/identity/sqlalchemy/repository.py +458 -0
- python_ddd_framework/identity/sqlalchemy/session_security.py +88 -0
- python_ddd_framework/identity/sqlalchemy/stores.py +69 -290
- python_ddd_framework/identity/tokens.py +2 -5
- python_ddd_framework/{application_services/validation.py → invocation/arguments.py} +8 -6
- python_ddd_framework/invocation/contribution.py +61 -0
- python_ddd_framework/invocation/dispatcher.py +291 -0
- python_ddd_framework/invocation/entries.py +2 -25
- python_ddd_framework/invocation/entrypoints.py +126 -0
- python_ddd_framework/{application_services → invocation}/execution.py +8 -5
- python_ddd_framework/invocation/function_runtime.py +3 -1
- python_ddd_framework/invocation/interception.py +113 -42
- python_ddd_framework/{application_services → invocation}/interceptors.py +2 -2
- python_ddd_framework/invocation/managed_proxy.py +116 -0
- python_ddd_framework/invocation/managed_services.py +250 -0
- python_ddd_framework/invocation/methods.py +345 -0
- python_ddd_framework/invocation/module.py +113 -0
- python_ddd_framework/{application_services → invocation}/policies.py +8 -1
- python_ddd_framework/invocation/validation.py +25 -0
- python_ddd_framework/lifecycle/__init__.py +2 -0
- python_ddd_framework/lifecycle/composition.py +5 -2
- python_ddd_framework/lifecycle/participants.py +33 -0
- python_ddd_framework/messaging/__init__.py +25 -0
- python_ddd_framework/messaging/channel.py +205 -0
- python_ddd_framework/messaging/contracts.py +69 -0
- python_ddd_framework/messaging/module.py +101 -0
- python_ddd_framework/messaging/options.py +13 -0
- python_ddd_framework/messaging/receipt.py +27 -0
- python_ddd_framework/messaging/runtime.py +124 -0
- python_ddd_framework/modularity/__init__.py +11 -1
- python_ddd_framework/modularity/contracts.py +47 -16
- python_ddd_framework/modularity/discovery.py +21 -2
- python_ddd_framework/modularity/graph.py +45 -1
- python_ddd_framework/modularity/registry.py +83 -3
- python_ddd_framework/notifications/__init__.py +2 -0
- python_ddd_framework/notifications/catalog.py +3 -2
- python_ddd_framework/notifications/declarations.py +18 -0
- python_ddd_framework/notifications/module.py +21 -0
- python_ddd_framework/observability/logging.py +3 -0
- python_ddd_framework/observability/tracing.py +3 -0
- python_ddd_framework/options/contribution.py +12 -0
- python_ddd_framework/options/registry.py +44 -11
- python_ddd_framework/realtime/__init__.py +2 -1
- python_ddd_framework/realtime/contracts.py +3 -7
- python_ddd_framework/realtime/messages.py +26 -1
- python_ddd_framework/redis/cache.py +243 -0
- python_ddd_framework/redis/cache_scripts.py +40 -0
- python_ddd_framework/redis/distributed_lock.py +10 -2
- python_ddd_framework/redis/module.py +13 -4
- python_ddd_framework/redis/notifications.py +5 -2
- python_ddd_framework/redis/runtime.py +1 -79
- python_ddd_framework/seeding/__init__.py +13 -0
- python_ddd_framework/seeding/contracts.py +45 -0
- python_ddd_framework/seeding/module.py +73 -0
- python_ddd_framework/seeding/runtime.py +63 -0
- python_ddd_framework/services/arbitration.py +23 -0
- python_ddd_framework/services/binding.py +2 -3
- python_ddd_framework/services/composition.py +108 -0
- python_ddd_framework/services/contribution.py +44 -54
- python_ddd_framework/services/convention.py +53 -181
- python_ddd_framework/services/fixed_lifetime.py +12 -15
- python_ddd_framework/services/framework_provider.py +3 -158
- python_ddd_framework/services/native_graph.py +35 -60
- python_ddd_framework/services/provider.py +59 -4
- python_ddd_framework/services/repository.py +6 -0
- python_ddd_framework/services/runtime.py +129 -215
- python_ddd_framework/settings/catalog.py +5 -4
- python_ddd_framework/settings/declarations.py +18 -0
- python_ddd_framework/settings/definitions.py +5 -0
- python_ddd_framework/settings/manager.py +1 -1
- python_ddd_framework/settings/module.py +50 -1
- python_ddd_framework/settings/notifications.py +4 -2
- python_ddd_framework/settings/refresh_module.py +9 -2
- python_ddd_framework/settings/sqlalchemy/module.py +2 -1
- python_ddd_framework/sqlalchemy/__init__.py +12 -0
- python_ddd_framework/sqlalchemy/alembic_runtime/env.py +1 -0
- python_ddd_framework/sqlalchemy/auditing.py +7 -1
- python_ddd_framework/sqlalchemy/extensions.py +186 -0
- python_ddd_framework/sqlalchemy/metadata.py +110 -6
- python_ddd_framework/sqlalchemy/migration.py +61 -8
- python_ddd_framework/sqlalchemy/migration_operations.py +86 -0
- python_ddd_framework/sqlalchemy/module.py +14 -11
- python_ddd_framework/sqlalchemy/module_migration.py +71 -3
- python_ddd_framework/sqlalchemy/repository.py +217 -13
- python_ddd_framework/sqlalchemy/session_provider.py +14 -1
- python_ddd_framework/testing/runtime.py +5 -4
- python_ddd_framework/unit_of_work/__init__.py +2 -1
- python_ddd_framework/unit_of_work/contracts.py +6 -7
- python_ddd_framework/unit_of_work/errors.py +11 -0
- python_ddd_framework/unit_of_work/lifecycle.py +19 -0
- python_ddd_framework/unit_of_work/manager.py +86 -32
- python_ddd_framework/unit_of_work/module.py +61 -0
- python_ddd_framework/unit_of_work/options.py +7 -1
- python_ddd_framework/validation/__init__.py +1 -0
- python_ddd_framework/validation/models.py +37 -0
- {python_ddd_framework-0.3.2.dist-info → python_ddd_framework-0.4.0.dist-info}/METADATA +139 -44
- python_ddd_framework-0.4.0.dist-info/RECORD +488 -0
- {python_ddd_framework-0.3.2.dist-info → python_ddd_framework-0.4.0.dist-info}/WHEEL +1 -1
- python_ddd_framework/application_services/seeding.py +0 -72
- python_ddd_framework/caching/catalog.py +0 -73
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/cache.py.jinja +0 -10
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/events.py.jinja +0 -24
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/orders.py.jinja +0 -83
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application/tasks.py.jinja +0 -84
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/application_contracts/orders.py.jinja +0 -35
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/repository.py.jinja +0 -14
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain/seeding.py.jinja +0 -19
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/domain_shared/definitions.py.jinja +0 -24
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/http_api/realtime.py.jinja +0 -36
- python_ddd_framework/developer_kit/templates/module/{{cookiecutter.module_name}}/sqlalchemy/repositories/orders.py.jinja +0 -49
- python_ddd_framework-0.3.2.dist-info/RECORD +0 -355
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{.dockerignore → backend/.dockerignore} +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{.gitignore → backend/.gitignore} +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{.python-version → backend/.python-version} +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{Dockerfile → backend/Dockerfile} +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{compose.dev.yaml.jinja → backend/compose.dev.yaml.jinja} +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{compose.production.yaml.jinja → backend/compose.production.yaml.jinja} +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{src → backend/src}/host/__init__.py.jinja +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{tests → backend/tests}/conftest.py.jinja +0 -0
- /python_ddd_framework/developer_kit/templates/project/{{cookiecutter.project_name}}/{tests → backend/tests}/host/test_http.py.jinja +0 -0
- /python_ddd_framework/{application_services → invocation}/signature.py +0 -0
- {python_ddd_framework-0.3.2.dist-info → python_ddd_framework-0.4.0.dist-info}/entry_points.txt +0 -0
- {python_ddd_framework-0.3.2.dist-info → python_ddd_framework-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {python_ddd_framework-0.3.2.dist-info → python_ddd_framework-0.4.0.dist-info}/licenses/src/python_ddd_framework/background_jobs/pgqueuer/UPSTREAM_LICENSE.txt +0 -0
python_ddd_framework/__init__.py
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
from .application import Application, ApplicationBuilder
|
|
2
2
|
from .application_services import (
|
|
3
3
|
ApplicationInvocationCleanupError,
|
|
4
|
-
ApplicationInvocationContext,
|
|
5
4
|
ApplicationInvocationRejectedError,
|
|
6
5
|
ApplicationService,
|
|
7
6
|
ApplicationServiceCatalog,
|
|
8
7
|
ApplicationServiceContract,
|
|
9
8
|
ApplicationServiceDefinitionError,
|
|
10
|
-
ApplicationServiceMethod,
|
|
11
9
|
ApplicationServiceMethodError,
|
|
12
10
|
ApplicationServiceRegistration,
|
|
13
11
|
ApplicationServiceValidationError,
|
|
14
12
|
ApplicationServiceValidationIssue,
|
|
15
13
|
CrossTaskInvocationError,
|
|
16
|
-
DataSeedContributor,
|
|
17
|
-
DataSeeder,
|
|
18
|
-
DataSeedError,
|
|
19
14
|
IntegrationService,
|
|
20
|
-
InterceptionStage,
|
|
21
|
-
Interceptor,
|
|
22
|
-
InterceptorRegistration,
|
|
23
|
-
MethodInvocation,
|
|
24
15
|
NestedConnectionError,
|
|
25
16
|
application_service,
|
|
26
|
-
disable_validation,
|
|
27
|
-
enable_validation,
|
|
28
17
|
)
|
|
18
|
+
from .application_services.module import ApplicationServicesModule
|
|
19
|
+
from .application_services.pagination import (
|
|
20
|
+
PagedAndSortedResultRequestDto,
|
|
21
|
+
PagedResult,
|
|
22
|
+
PagedResultRequestDto,
|
|
23
|
+
)
|
|
24
|
+
from .auditing.module import AuditingModule
|
|
29
25
|
from .authorization import (
|
|
30
26
|
AccessTokenAuthenticator,
|
|
31
27
|
AuthorizationDefinitionError,
|
|
28
|
+
AuthorizationOptions,
|
|
32
29
|
CurrentUser,
|
|
33
30
|
PermissionCatalog,
|
|
34
31
|
PermissionChecker,
|
|
@@ -44,6 +41,7 @@ from .authorization import (
|
|
|
44
41
|
allow_anonymous,
|
|
45
42
|
authorize,
|
|
46
43
|
)
|
|
44
|
+
from .authorization.module import AuthorizationModule
|
|
47
45
|
from .background_execution import (
|
|
48
46
|
BackgroundExecutionMode,
|
|
49
47
|
BackgroundJobOptions,
|
|
@@ -51,6 +49,12 @@ from .background_execution import (
|
|
|
51
49
|
BackgroundTaskSnapshot,
|
|
52
50
|
BackgroundTaskState,
|
|
53
51
|
)
|
|
52
|
+
from .background_execution.declarations import (
|
|
53
|
+
BackgroundJobs,
|
|
54
|
+
BackgroundSchedules,
|
|
55
|
+
BackgroundWorkers,
|
|
56
|
+
)
|
|
57
|
+
from .background_execution.module import BackgroundExecutionModule
|
|
54
58
|
from .background_jobs import (
|
|
55
59
|
BackgroundJobCatalog,
|
|
56
60
|
BackgroundJobContext,
|
|
@@ -75,12 +79,13 @@ from .background_workers import (
|
|
|
75
79
|
BackgroundWorkerRuntimeError,
|
|
76
80
|
)
|
|
77
81
|
from .caching import (
|
|
78
|
-
CacheCatalog,
|
|
79
|
-
CacheDefinition,
|
|
80
|
-
CacheDefinitionError,
|
|
81
82
|
DistributedCache,
|
|
83
|
+
DistributedCacheEntryOptions,
|
|
82
84
|
DistributedCacheError,
|
|
85
|
+
DistributedCacheOptions,
|
|
86
|
+
cache_name,
|
|
83
87
|
)
|
|
88
|
+
from .caching.module import CachingModule
|
|
84
89
|
from .configuration import (
|
|
85
90
|
ConfigurationContribution,
|
|
86
91
|
ConfigurationProvenance,
|
|
@@ -101,10 +106,13 @@ from .diagnostics import (
|
|
|
101
106
|
SourceLocation,
|
|
102
107
|
)
|
|
103
108
|
from .distributed_lock import DistributedLock, DistributedLockError, DistributedLockOptions
|
|
104
|
-
from .domain import AggregateRoot, Entity, OptimisticConcurrencyError, ValueObject
|
|
109
|
+
from .domain import AggregateRoot, DomainService, Entity, OptimisticConcurrencyError, ValueObject
|
|
105
110
|
from .errors import (
|
|
106
111
|
ApplicationRuntimeError,
|
|
107
112
|
ApplicationStartError,
|
|
113
|
+
BusinessError,
|
|
114
|
+
BusinessErrorDefinition,
|
|
115
|
+
BusinessErrorField,
|
|
108
116
|
CatalogNativeGraphMismatchError,
|
|
109
117
|
CompositionResourceError,
|
|
110
118
|
ConfigurationSourceError,
|
|
@@ -136,8 +144,11 @@ from .errors import (
|
|
|
136
144
|
)
|
|
137
145
|
from .events import (
|
|
138
146
|
AggregateEventCollector,
|
|
147
|
+
EntityChangedEvent,
|
|
148
|
+
EntityCreatedEvent,
|
|
149
|
+
EntityDeletedEvent,
|
|
150
|
+
EntityUpdatedEvent,
|
|
139
151
|
EventContributionError,
|
|
140
|
-
EventContributor,
|
|
141
152
|
EventCycleError,
|
|
142
153
|
LocalEventBus,
|
|
143
154
|
LocalEventCatalog,
|
|
@@ -147,6 +158,19 @@ from .events import (
|
|
|
147
158
|
PostCommitEventError,
|
|
148
159
|
local_event_handler,
|
|
149
160
|
)
|
|
161
|
+
from .events.module import LocalEventsModule
|
|
162
|
+
from .events.subscription import subscribe_local_event
|
|
163
|
+
from .extensions import (
|
|
164
|
+
ExtensibleModel,
|
|
165
|
+
ExtensionCatalog,
|
|
166
|
+
ExtensionContribution,
|
|
167
|
+
ExtensionPoints,
|
|
168
|
+
ExtensionProperties,
|
|
169
|
+
ExtensionsModule,
|
|
170
|
+
ExtensionTarget,
|
|
171
|
+
ModelExtension,
|
|
172
|
+
ModelExtensions,
|
|
173
|
+
)
|
|
150
174
|
from .hosted_services import (
|
|
151
175
|
ApplicationReadinessSnapshot,
|
|
152
176
|
HostedService,
|
|
@@ -161,6 +185,16 @@ from .hosted_services import (
|
|
|
161
185
|
HostedServiceSnapshot,
|
|
162
186
|
HostedServiceStatus,
|
|
163
187
|
)
|
|
188
|
+
from .hosted_services.declarations import HostedServices
|
|
189
|
+
from .hosted_services.module import HostedServicesModule
|
|
190
|
+
from .invocation.contracts import ApplicationInvocationContext
|
|
191
|
+
from .invocation.contribution import add_interceptor
|
|
192
|
+
from .invocation.entrypoints import call, call_as, invoke, invoke_as
|
|
193
|
+
from .invocation.execution import MethodInvocation
|
|
194
|
+
from .invocation.interceptors import InterceptionStage, Interceptor, InterceptorRegistration
|
|
195
|
+
from .invocation.methods import ServiceMethod
|
|
196
|
+
from .invocation.module import InvocationModule
|
|
197
|
+
from .invocation.policies import ValidationEnabled, disable_validation, enable_validation
|
|
164
198
|
from .lifecycle import (
|
|
165
199
|
ApplicationState,
|
|
166
200
|
ApplicationView,
|
|
@@ -174,8 +208,20 @@ from .lifecycle import (
|
|
|
174
208
|
ShutdownContext,
|
|
175
209
|
ShutdownReason,
|
|
176
210
|
)
|
|
211
|
+
from .messaging import (
|
|
212
|
+
MessageChannel,
|
|
213
|
+
MessageChannelDefinition,
|
|
214
|
+
MessageHandler,
|
|
215
|
+
MessageOutcome,
|
|
216
|
+
MessageReceipt,
|
|
217
|
+
MessageRejectedError,
|
|
218
|
+
MessageState,
|
|
219
|
+
MessagingModule,
|
|
220
|
+
MessagingOptions,
|
|
221
|
+
)
|
|
177
222
|
from .modularity import (
|
|
178
223
|
AppModule,
|
|
224
|
+
ModuleDeclaration,
|
|
179
225
|
ModuleDependency,
|
|
180
226
|
ModuleDependencyEdge,
|
|
181
227
|
ModuleDescriptor,
|
|
@@ -183,7 +229,9 @@ from .modularity import (
|
|
|
183
229
|
ModuleKey,
|
|
184
230
|
ModuleRef,
|
|
185
231
|
ModuleRegistry,
|
|
232
|
+
ModuleRequirement,
|
|
186
233
|
)
|
|
234
|
+
from .notifications.module import NotificationsModule
|
|
187
235
|
from .options import (
|
|
188
236
|
BaseOptions,
|
|
189
237
|
Options,
|
|
@@ -195,9 +243,17 @@ from .options import (
|
|
|
195
243
|
from .realtime import (
|
|
196
244
|
RealtimeDeliveryReport,
|
|
197
245
|
RealtimeEnvelope,
|
|
246
|
+
RealtimeMessage,
|
|
198
247
|
RealtimePublisher,
|
|
199
248
|
RealtimeSnapshot,
|
|
200
249
|
)
|
|
250
|
+
from .seeding import (
|
|
251
|
+
DataSeedContributor,
|
|
252
|
+
DataSeeder,
|
|
253
|
+
DataSeedError,
|
|
254
|
+
DataSeedingModule,
|
|
255
|
+
DataSeedRegistration,
|
|
256
|
+
)
|
|
201
257
|
from .services import (
|
|
202
258
|
ConventionalService,
|
|
203
259
|
ConventionCandidate,
|
|
@@ -227,8 +283,11 @@ from .settings import (
|
|
|
227
283
|
SettingManager,
|
|
228
284
|
SettingProvider,
|
|
229
285
|
)
|
|
286
|
+
from .settings.declarations import SettingHandlers
|
|
287
|
+
from .settings.module import SettingsModule
|
|
230
288
|
from .unit_of_work import (
|
|
231
289
|
UnitOfWork,
|
|
290
|
+
UnitOfWorkCompletionError,
|
|
232
291
|
UnitOfWorkManager,
|
|
233
292
|
UnitOfWorkOptions,
|
|
234
293
|
UnitOfWorkState,
|
|
@@ -236,6 +295,7 @@ from .unit_of_work import (
|
|
|
236
295
|
UnitOfWorkTransactionBehavior,
|
|
237
296
|
unit_of_work,
|
|
238
297
|
)
|
|
298
|
+
from .unit_of_work.module import UnitOfWorkModule
|
|
239
299
|
|
|
240
300
|
__all__ = (
|
|
241
301
|
"AccessTokenAuthenticator",
|
|
@@ -253,16 +313,20 @@ __all__ = (
|
|
|
253
313
|
"ApplicationServiceCatalog",
|
|
254
314
|
"ApplicationServiceContract",
|
|
255
315
|
"ApplicationServiceDefinitionError",
|
|
256
|
-
"ApplicationServiceMethod",
|
|
257
316
|
"ApplicationServiceMethodError",
|
|
258
317
|
"ApplicationServiceRegistration",
|
|
259
318
|
"ApplicationServiceValidationError",
|
|
260
319
|
"ApplicationServiceValidationIssue",
|
|
320
|
+
"ApplicationServicesModule",
|
|
261
321
|
"ApplicationStartError",
|
|
262
322
|
"ApplicationState",
|
|
263
323
|
"ApplicationView",
|
|
324
|
+
"AuditingModule",
|
|
264
325
|
"AuthorizationDefinitionError",
|
|
326
|
+
"AuthorizationModule",
|
|
327
|
+
"AuthorizationOptions",
|
|
265
328
|
"BackgroundExecutionMode",
|
|
329
|
+
"BackgroundExecutionModule",
|
|
266
330
|
"BackgroundExecutionOptions",
|
|
267
331
|
"BackgroundExecutionProfile",
|
|
268
332
|
"BackgroundJobCatalog",
|
|
@@ -276,6 +340,8 @@ __all__ = (
|
|
|
276
340
|
"BackgroundJobPayloadError",
|
|
277
341
|
"BackgroundJobRetryPolicy",
|
|
278
342
|
"BackgroundJobSchedule",
|
|
343
|
+
"BackgroundJobs",
|
|
344
|
+
"BackgroundSchedules",
|
|
279
345
|
"BackgroundSystemCaller",
|
|
280
346
|
"BackgroundTaskOptions",
|
|
281
347
|
"BackgroundTaskSnapshot",
|
|
@@ -286,10 +352,12 @@ __all__ = (
|
|
|
286
352
|
"BackgroundWorkerDefinition",
|
|
287
353
|
"BackgroundWorkerDefinitionError",
|
|
288
354
|
"BackgroundWorkerRuntimeError",
|
|
355
|
+
"BackgroundWorkers",
|
|
289
356
|
"BaseOptions",
|
|
290
|
-
"
|
|
291
|
-
"
|
|
292
|
-
"
|
|
357
|
+
"BusinessError",
|
|
358
|
+
"BusinessErrorDefinition",
|
|
359
|
+
"BusinessErrorField",
|
|
360
|
+
"CachingModule",
|
|
293
361
|
"CatalogNativeGraphMismatchError",
|
|
294
362
|
"CompositionResourceError",
|
|
295
363
|
"ConfigurationContribution",
|
|
@@ -312,21 +380,36 @@ __all__ = (
|
|
|
312
380
|
"CurrentUser",
|
|
313
381
|
"DataSeedContributor",
|
|
314
382
|
"DataSeedError",
|
|
383
|
+
"DataSeedRegistration",
|
|
315
384
|
"DataSeeder",
|
|
385
|
+
"DataSeedingModule",
|
|
316
386
|
"DiagnosticMessage",
|
|
317
387
|
"DiagnosticSnapshot",
|
|
318
388
|
"DistributedCache",
|
|
389
|
+
"DistributedCacheEntryOptions",
|
|
319
390
|
"DistributedCacheError",
|
|
391
|
+
"DistributedCacheOptions",
|
|
320
392
|
"DistributedLock",
|
|
321
393
|
"DistributedLockError",
|
|
322
394
|
"DistributedLockOptions",
|
|
395
|
+
"DomainService",
|
|
323
396
|
"DuplicateModuleIdentityError",
|
|
324
397
|
"DuplicateOptionDefinitionError",
|
|
325
398
|
"Entity",
|
|
399
|
+
"EntityChangedEvent",
|
|
400
|
+
"EntityCreatedEvent",
|
|
401
|
+
"EntityDeletedEvent",
|
|
402
|
+
"EntityUpdatedEvent",
|
|
326
403
|
"EventContributionError",
|
|
327
|
-
"EventContributor",
|
|
328
404
|
"EventCycleError",
|
|
329
405
|
"EventStatus",
|
|
406
|
+
"ExtensibleModel",
|
|
407
|
+
"ExtensionCatalog",
|
|
408
|
+
"ExtensionContribution",
|
|
409
|
+
"ExtensionPoints",
|
|
410
|
+
"ExtensionProperties",
|
|
411
|
+
"ExtensionTarget",
|
|
412
|
+
"ExtensionsModule",
|
|
330
413
|
"FailureRecord",
|
|
331
414
|
"FrameworkError",
|
|
332
415
|
"GraphInvariantError",
|
|
@@ -341,6 +424,8 @@ __all__ = (
|
|
|
341
424
|
"HostedServiceRegistration",
|
|
342
425
|
"HostedServiceSnapshot",
|
|
343
426
|
"HostedServiceStatus",
|
|
427
|
+
"HostedServices",
|
|
428
|
+
"HostedServicesModule",
|
|
344
429
|
"InitializeContext",
|
|
345
430
|
"IntegrationService",
|
|
346
431
|
"InterceptionStage",
|
|
@@ -351,6 +436,7 @@ __all__ = (
|
|
|
351
436
|
"InvalidDiagnosticCodeError",
|
|
352
437
|
"InvalidModuleReferenceError",
|
|
353
438
|
"InvalidOptionDefinitionError",
|
|
439
|
+
"InvocationModule",
|
|
354
440
|
"LifecycleContext",
|
|
355
441
|
"LifecycleInvocationError",
|
|
356
442
|
"LifecyclePhase",
|
|
@@ -361,8 +447,21 @@ __all__ = (
|
|
|
361
447
|
"LocalEventHandlerError",
|
|
362
448
|
"LocalEventPhase",
|
|
363
449
|
"LocalEventSubscription",
|
|
450
|
+
"LocalEventsModule",
|
|
451
|
+
"MessageChannel",
|
|
452
|
+
"MessageChannelDefinition",
|
|
453
|
+
"MessageHandler",
|
|
454
|
+
"MessageOutcome",
|
|
455
|
+
"MessageReceipt",
|
|
456
|
+
"MessageRejectedError",
|
|
457
|
+
"MessageState",
|
|
458
|
+
"MessagingModule",
|
|
459
|
+
"MessagingOptions",
|
|
364
460
|
"MethodInvocation",
|
|
461
|
+
"ModelExtension",
|
|
462
|
+
"ModelExtensions",
|
|
365
463
|
"ModuleCycleError",
|
|
464
|
+
"ModuleDeclaration",
|
|
366
465
|
"ModuleDependency",
|
|
367
466
|
"ModuleDependencyEdge",
|
|
368
467
|
"ModuleDescriptor",
|
|
@@ -371,8 +470,10 @@ __all__ = (
|
|
|
371
470
|
"ModuleKey",
|
|
372
471
|
"ModuleRef",
|
|
373
472
|
"ModuleRegistry",
|
|
473
|
+
"ModuleRequirement",
|
|
374
474
|
"ModuleResolutionError",
|
|
375
475
|
"NestedConnectionError",
|
|
476
|
+
"NotificationsModule",
|
|
376
477
|
"OptimisticConcurrencyError",
|
|
377
478
|
"Options",
|
|
378
479
|
"OptionsContribution",
|
|
@@ -380,6 +481,9 @@ __all__ = (
|
|
|
380
481
|
"OptionsSnapshot",
|
|
381
482
|
"OptionsValidationError",
|
|
382
483
|
"OptionsValidationIssue",
|
|
484
|
+
"PagedAndSortedResultRequestDto",
|
|
485
|
+
"PagedResult",
|
|
486
|
+
"PagedResultRequestDto",
|
|
383
487
|
"PermissionCatalog",
|
|
384
488
|
"PermissionChecker",
|
|
385
489
|
"PermissionCheckerUnavailableError",
|
|
@@ -400,6 +504,7 @@ __all__ = (
|
|
|
400
504
|
"ProviderContributionView",
|
|
401
505
|
"RealtimeDeliveryReport",
|
|
402
506
|
"RealtimeEnvelope",
|
|
507
|
+
"RealtimeMessage",
|
|
403
508
|
"RealtimePublisher",
|
|
404
509
|
"RealtimeSnapshot",
|
|
405
510
|
"RegistrationConflictError",
|
|
@@ -415,14 +520,17 @@ __all__ = (
|
|
|
415
520
|
"ServiceCatalog",
|
|
416
521
|
"ServiceContributor",
|
|
417
522
|
"ServiceContributorClosedError",
|
|
523
|
+
"ServiceMethod",
|
|
418
524
|
"ServiceRegistration",
|
|
419
525
|
"SettingCatalog",
|
|
420
526
|
"SettingDefinition",
|
|
421
527
|
"SettingDefinitionContext",
|
|
422
528
|
"SettingDefinitionError",
|
|
423
529
|
"SettingDefinitionProvider",
|
|
530
|
+
"SettingHandlers",
|
|
424
531
|
"SettingManager",
|
|
425
532
|
"SettingProvider",
|
|
533
|
+
"SettingsModule",
|
|
426
534
|
"ShutdownContext",
|
|
427
535
|
"ShutdownReason",
|
|
428
536
|
"SingletonDependency",
|
|
@@ -430,20 +538,30 @@ __all__ = (
|
|
|
430
538
|
"TransientDependency",
|
|
431
539
|
"UnauthenticatedError",
|
|
432
540
|
"UnitOfWork",
|
|
541
|
+
"UnitOfWorkCompletionError",
|
|
433
542
|
"UnitOfWorkManager",
|
|
543
|
+
"UnitOfWorkModule",
|
|
434
544
|
"UnitOfWorkOptions",
|
|
435
545
|
"UnitOfWorkState",
|
|
436
546
|
"UnitOfWorkStateError",
|
|
437
547
|
"UnitOfWorkTransactionBehavior",
|
|
438
548
|
"UnknownModuleError",
|
|
439
549
|
"UnknownOptionsError",
|
|
550
|
+
"ValidationEnabled",
|
|
440
551
|
"ValueObject",
|
|
552
|
+
"add_interceptor",
|
|
441
553
|
"allow_anonymous",
|
|
442
554
|
"application_service",
|
|
443
555
|
"authorize",
|
|
556
|
+
"cache_name",
|
|
557
|
+
"call",
|
|
558
|
+
"call_as",
|
|
444
559
|
"disable_validation",
|
|
445
560
|
"enable_validation",
|
|
561
|
+
"invoke",
|
|
562
|
+
"invoke_as",
|
|
446
563
|
"local_event_handler",
|
|
447
564
|
"service",
|
|
565
|
+
"subscribe_local_event",
|
|
448
566
|
"unit_of_work",
|
|
449
567
|
)
|
|
@@ -9,31 +9,16 @@ from uuid import uuid4
|
|
|
9
9
|
|
|
10
10
|
from pydantic import BaseModel
|
|
11
11
|
|
|
12
|
-
from ..application_services.invocation import _InvocationRuntime
|
|
13
|
-
from ..authorization.catalog import _build_permission_catalog
|
|
14
|
-
from ..background_jobs.catalog import _build_background_job_catalog
|
|
15
|
-
from ..background_workers import BackgroundExecutionOptions
|
|
16
|
-
from ..background_workers.catalog import _build_background_worker_catalog
|
|
17
|
-
from ..background_workers.runtime import _BackgroundCoordinator
|
|
18
|
-
from ..caching.catalog import _build_cache_catalog
|
|
19
12
|
from ..configuration.composition import _ConfigurationComposer
|
|
20
13
|
from ..configuration.contracts import _ConfigurationDefaultContribution
|
|
21
14
|
from ..diagnostics.journal import _DiagnosticJournal
|
|
22
|
-
from ..
|
|
23
|
-
from ..hosted_services import HostedServiceOptions
|
|
24
|
-
from ..hosted_services.catalog import (
|
|
25
|
-
_build_hosted_service_catalog,
|
|
26
|
-
_contribute_hosted_service_defaults,
|
|
27
|
-
)
|
|
28
|
-
from ..hosted_services.runtime import _HostedServiceCoordinator
|
|
15
|
+
from ..lifecycle import RuntimeParticipant
|
|
29
16
|
from ..modularity import AppModule, ModuleDescriptor, ModuleRef
|
|
30
17
|
from ..modularity.discovery import _discover_types, _snapshot_scan_packages
|
|
31
18
|
from ..modularity.graph import _ModuleGraphBuilder
|
|
32
|
-
from ..notifications.catalog import _build_notification_catalog
|
|
33
19
|
from ..options.registry import _OptionsRegistry
|
|
34
20
|
from ..services.contribution import ServiceContributionRegistry
|
|
35
21
|
from ..services.runtime import _ServiceRuntimeBuilder
|
|
36
|
-
from ..settings.catalog import _build_setting_catalog, _contribute_setting_handler_defaults
|
|
37
22
|
from .build_spec import _ApplicationBuildSpec
|
|
38
23
|
from .composition import _CompositionLifecycle
|
|
39
24
|
from .runtime import Application
|
|
@@ -85,15 +70,6 @@ class ApplicationBuilder:
|
|
|
85
70
|
scan_packages = _snapshot_scan_packages(registry)
|
|
86
71
|
discoveries = _discover_types(registry, scan_packages)
|
|
87
72
|
claims: dict[type[BaseModel], tuple[str, ModuleDescriptor]] = {}
|
|
88
|
-
pre_options_registry = _OptionsRegistry(kind="PreOptions", claims=claims)
|
|
89
|
-
options_registry = _OptionsRegistry(kind="Options", claims=claims)
|
|
90
|
-
permission_catalog = _build_permission_catalog(registry, discoveries)
|
|
91
|
-
cache_catalog = _build_cache_catalog(registry)
|
|
92
|
-
setting_catalog = _build_setting_catalog(registry, discoveries)
|
|
93
|
-
notification_catalog = _build_notification_catalog(registry)
|
|
94
|
-
background_worker_catalog = _build_background_worker_catalog(registry)
|
|
95
|
-
background_job_catalog = _build_background_job_catalog(registry, discoveries)
|
|
96
|
-
hosted_service_catalog = _build_hosted_service_catalog(registry)
|
|
97
73
|
configuration = _ConfigurationComposer(
|
|
98
74
|
environment=self._environment,
|
|
99
75
|
base_path=self._base_path,
|
|
@@ -113,33 +89,25 @@ class ApplicationBuilder:
|
|
|
113
89
|
root = _ApplicationStateRoot(
|
|
114
90
|
application_id=uuid4(),
|
|
115
91
|
registry=registry,
|
|
92
|
+
discoveries=discoveries,
|
|
116
93
|
configuration=configuration,
|
|
117
|
-
pre_options_registry=
|
|
118
|
-
options_registry=
|
|
94
|
+
pre_options_registry=_OptionsRegistry(kind="PreOptions", claims=claims),
|
|
95
|
+
options_registry=_OptionsRegistry(kind="Options", claims=claims),
|
|
119
96
|
service_registry=ServiceContributionRegistry(),
|
|
120
|
-
event_registry=EventContributionRegistry(),
|
|
121
|
-
permission_catalog=permission_catalog,
|
|
122
|
-
cache_catalog=cache_catalog,
|
|
123
|
-
setting_catalog=setting_catalog,
|
|
124
|
-
background_worker_catalog=background_worker_catalog,
|
|
125
|
-
background_job_catalog=background_job_catalog,
|
|
126
|
-
hosted_service_catalog=hosted_service_catalog,
|
|
127
97
|
journal=_DiagnosticJournal(),
|
|
128
98
|
completed_stages={descriptor.key: [] for descriptor in registry.dependency_order},
|
|
129
99
|
)
|
|
130
100
|
_CompositionLifecycle(root).run()
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
invocation_runtime=root.require_invocation_runtime(),
|
|
142
|
-
build_spec=_ApplicationBuildSpec(
|
|
101
|
+
application = Application(root)
|
|
102
|
+
service_runtime = _ServiceRuntimeBuilder(
|
|
103
|
+
registry,
|
|
104
|
+
root.service_registry,
|
|
105
|
+
scan_packages,
|
|
106
|
+
discoveries,
|
|
107
|
+
root.configuration,
|
|
108
|
+
root.require_options(),
|
|
109
|
+
application,
|
|
110
|
+
_ApplicationBuildSpec(
|
|
143
111
|
self._startup_module,
|
|
144
112
|
self._environment,
|
|
145
113
|
self._base_path,
|
|
@@ -149,41 +117,18 @@ class ApplicationBuilder:
|
|
|
149
117
|
dict(self._explicit_overrides),
|
|
150
118
|
Path.cwd().resolve(),
|
|
151
119
|
),
|
|
152
|
-
)
|
|
153
|
-
root.hosted_service_coordinator = _HostedServiceCoordinator(
|
|
154
|
-
catalog=hosted_service_catalog,
|
|
155
|
-
options=root.require_options().get(HostedServiceOptions),
|
|
156
|
-
state_getter=lambda: root.state,
|
|
157
|
-
)
|
|
158
|
-
service_runtime = _ServiceRuntimeBuilder(
|
|
159
|
-
registry,
|
|
160
|
-
root.service_registry,
|
|
161
|
-
root.event_registry,
|
|
162
|
-
scan_packages,
|
|
163
|
-
discoveries,
|
|
164
|
-
root.configuration,
|
|
165
|
-
root.require_options(),
|
|
166
|
-
root.require_invocation_runtime(),
|
|
167
|
-
permission_catalog,
|
|
168
|
-
cache_catalog,
|
|
169
|
-
setting_catalog,
|
|
170
|
-
notification_catalog,
|
|
171
|
-
background_worker_catalog,
|
|
172
|
-
background_job_catalog,
|
|
173
|
-
root.require_background_coordinator(),
|
|
174
|
-
hosted_service_catalog,
|
|
175
|
-
root.require_hosted_service_coordinator(),
|
|
176
120
|
).build()
|
|
177
121
|
root.service_catalog = service_runtime.catalog
|
|
178
|
-
root.application_service_catalog = service_runtime.application_service_catalog
|
|
179
|
-
root.event_catalog = service_runtime.event_catalog
|
|
180
122
|
root.container = service_runtime.container
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
123
|
+
participants: list[RuntimeParticipant] = []
|
|
124
|
+
for descriptor in registry.dependency_order:
|
|
125
|
+
participant = descriptor.instance.runtime
|
|
126
|
+
if participant is not None:
|
|
127
|
+
if not isinstance(participant, RuntimeParticipant):
|
|
128
|
+
raise TypeError(f"{descriptor.key}.runtime must be RuntimeParticipant or None")
|
|
129
|
+
participants.append(participant)
|
|
130
|
+
root.runtimes = tuple(participants)
|
|
131
|
+
return application
|
|
187
132
|
|
|
188
133
|
|
|
189
134
|
def _validate_environment(environment: str) -> str:
|
|
@@ -6,18 +6,13 @@ import inspect
|
|
|
6
6
|
from collections.abc import Callable
|
|
7
7
|
from typing import cast
|
|
8
8
|
|
|
9
|
-
from ..auditing import AuditingOptions
|
|
10
|
-
from ..background_workers import BackgroundExecutionOptions
|
|
11
9
|
from ..diagnostics import EventStatus, LifecyclePhase, LifecycleStage
|
|
12
10
|
from ..errors import (
|
|
13
11
|
CompositionResourceError,
|
|
14
12
|
LifecycleInvocationError,
|
|
15
13
|
)
|
|
16
|
-
from ..hosted_services import HostedServiceOptions
|
|
17
|
-
from ..hosted_services.options import HOSTED_SERVICE_OPTIONS_SECTION
|
|
18
14
|
from ..lifecycle import ConfigureContext, PostConfigureContext, PreConfigureContext
|
|
19
15
|
from ..modularity import ModuleDescriptor
|
|
20
|
-
from ..unit_of_work import UnitOfWorkOptions
|
|
21
16
|
from .state import (
|
|
22
17
|
LIFECYCLE_ERROR_TYPE,
|
|
23
18
|
_ApplicationStateRoot,
|
|
@@ -45,19 +40,9 @@ class _CompositionLifecycle:
|
|
|
45
40
|
for descriptor in self._root.registry.dependency_order:
|
|
46
41
|
self._invoke_post_configure(descriptor)
|
|
47
42
|
options = self._root.options_registry
|
|
48
|
-
owner = self._root.registry.startup
|
|
49
|
-
# 常驻框架能力的默认声明只有此处负责;显式 Module 声明优先,默认值仍由 model 验证。
|
|
50
|
-
options.declare_default(BackgroundExecutionOptions, "background_execution", owner=owner)
|
|
51
|
-
options.declare_default(HostedServiceOptions, HOSTED_SERVICE_OPTIONS_SECTION, owner=owner)
|
|
52
|
-
options.declare_default(AuditingOptions, "auditing", owner=owner)
|
|
53
|
-
options.declare_default(UnitOfWorkOptions, "unit_of_work", owner=owner)
|
|
54
43
|
self._root.options = options.bind_options(self._root.configuration)
|
|
55
44
|
self._root.configuration = self._root.configuration._finalize(
|
|
56
|
-
sections=(
|
|
57
|
-
options.sections
|
|
58
|
-
| self._root.pre_options_registry.sections
|
|
59
|
-
| ({"settings"} if self._root.setting_catalog.definitions else set())
|
|
60
|
-
),
|
|
45
|
+
sections=(options.sections | self._root.pre_options_registry.sections),
|
|
61
46
|
secret_paths=options.secret_paths | self._root.pre_options_registry.secret_paths,
|
|
62
47
|
mapping_paths=lambda values, reference: (
|
|
63
48
|
options.mapping_paths(values, reference, self._root.options)
|
|
@@ -101,11 +86,9 @@ class _CompositionLifecycle:
|
|
|
101
86
|
descriptor=descriptor,
|
|
102
87
|
stage=stage,
|
|
103
88
|
)
|
|
104
|
-
events = self._root.event_registry.contributor(
|
|
105
|
-
descriptor=descriptor,
|
|
106
|
-
stage=stage,
|
|
107
|
-
)
|
|
108
89
|
context = ConfigureContext(
|
|
90
|
+
modules=self._root.registry,
|
|
91
|
+
discoveries=self._root.discoveries,
|
|
109
92
|
application_id=self._root.application_id,
|
|
110
93
|
descriptor=descriptor,
|
|
111
94
|
stage=stage,
|
|
@@ -115,7 +98,6 @@ class _CompositionLifecycle:
|
|
|
115
98
|
pre_options=self._root.require_pre_options(),
|
|
116
99
|
configure=editor,
|
|
117
100
|
services=services,
|
|
118
|
-
events=events,
|
|
119
101
|
)
|
|
120
102
|
callback = cast(
|
|
121
103
|
Callable[[ConfigureContext], object],
|
|
@@ -126,7 +108,6 @@ class _CompositionLifecycle:
|
|
|
126
108
|
finally:
|
|
127
109
|
editor._close()
|
|
128
110
|
services._close()
|
|
129
|
-
events._close()
|
|
130
111
|
|
|
131
112
|
def _invoke_post_configure(self, descriptor: ModuleDescriptor) -> None:
|
|
132
113
|
stage = LifecycleStage.POST_CONFIGURE
|
|
@@ -139,6 +120,7 @@ class _CompositionLifecycle:
|
|
|
139
120
|
stage=stage,
|
|
140
121
|
)
|
|
141
122
|
context = PostConfigureContext(
|
|
123
|
+
modules=self._root.registry,
|
|
142
124
|
application_id=self._root.application_id,
|
|
143
125
|
descriptor=descriptor,
|
|
144
126
|
stage=stage,
|