nexus-framework 0.4.0__tar.gz → 0.4.2__tar.gz
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.
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/PKG-INFO +21 -1
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/pyproject.toml +25 -1
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/__init__.py +1 -1
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/cache/driver.py +12 -1
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/db_reverse.py +6 -6
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/install_tools.py +32 -4
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/new_command.py +47 -9
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/connection.py +39 -4
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/migrations/migration.py +9 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/schema/blueprint.py +42 -5
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/studio/manager.py +801 -134
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/__init__.py +1 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/converters/base.py +1 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/converters/django.py +5 -2
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/converters/flask.py +5 -2
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/converters/laravel.py +340 -66
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/converters/reverse.py +7 -5
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/routing/router.py +84 -1
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/starters/api.py +6 -6
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/starters/inertia.py +2 -2
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/starters/standard.py +430 -65
- nexus_framework-0.4.2/src/nexus/starters/web.py +716 -0
- nexus_framework-0.4.2/src/nexus/support/dependencies.py +88 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus_framework.egg-info/PKG-INFO +21 -1
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus_framework.egg-info/SOURCES.txt +1 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus_framework.egg-info/requires.txt +24 -0
- nexus_framework-0.4.0/src/nexus/starters/web.py +0 -400
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/README.md +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/setup.cfg +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/application.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/access/gate.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/auth_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/authenticatable.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/guard.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/hashing.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/middleware.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/sanctum/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/sanctum/guard.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/sanctum/has_api_tokens.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/sanctum/middleware.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/sanctum/migration.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/sanctum/new_access_token.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/sanctum/personal_access_token.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/auth/user_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/cache/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/cache/cache_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/cache/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/cache/store.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/config/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/config/repository.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/cli.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/command.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/clear.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/config.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/database.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/key_generate.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/make.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/queue.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/route_list.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/schedule.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/serve.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/starter.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/commands/tinker.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/console_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/generators/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/generators/stubs.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/console/kernel.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/container/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/container/container.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/container/exceptions.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/database_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/factory.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/migrations/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/migrations/migrator.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/exceptions.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/model.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/relations/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/relations/base.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/relations/belongs_to.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/relations/belongs_to_many.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/relations/has_many.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/relations/has_one.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/models/soft_deletes.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/query/builder.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/schema/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/schema/schema.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/seeder.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/database/studio/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/events/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/events/dispatcher.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/events/event_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/exceptions/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/exceptions/exception_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/exceptions/handler.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/app.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/artisan.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/auth.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/cache.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/config.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/date.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/db.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/event.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/facade.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/gate.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/hash.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/inertia.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/log.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/mail.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/notification.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/queue.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/rate_limiter.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/request.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/route.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/schedule.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/schema.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/session.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/storage.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/telescope.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/url.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/validator.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/facades/view.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/filesystem/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/filesystem/driver.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/filesystem/filesystem_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/filesystem/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/foundation/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/foundation/application.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/foundation/provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/foundation/runner.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/foundation/service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/exceptions.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/middleware.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/request.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/requests/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/requests/form_request.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/resources/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/resources/json_resource.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/resources/resource_collection.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/response.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/http/uploaded_file.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/inertia/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/inertia/helpers.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/inertia/inertia.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/inertia/inertia_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/inertia/lazy.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/inertia/middleware.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/inertia/response.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/logging/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/logging/logging_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/logging/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/mail/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/mail/mail_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/mail/mailable.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/mail/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/mail/transport.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/notifications/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/notifications/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/notifications/notification.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/notifications/notification_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/detector.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/porter/porter_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/py.typed +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/queue/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/queue/driver.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/queue/job.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/queue/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/queue/queue_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/queue/worker.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/routing/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/routing/limiter.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/routing/route.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/routing/throttle.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/routing/url.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/schedule/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/schedule/event.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/schedule/schedule.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/schedule/schedule_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/security/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/security/cors.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/security/csrf.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/security/headers.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/session/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/session/driver.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/session/manager.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/session/middleware.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/session/session.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/session/session_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/starters/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/starters/openapi.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/support/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/support/arr.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/support/carbon.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/support/collection.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/support/env.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/support/helpers.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/support/str.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/telescope/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/telescope/debugbar.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/telescope/entry.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/telescope/middleware.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/telescope/telescope.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/telescope/telescope_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/client.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/database.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/fakes/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/fakes/event_fake.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/fakes/log_fake.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/fakes/mail_fake.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/fakes/notification_fake.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/fakes/queue_fake.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/fakes/storage_fake.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/response.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/test_case.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/testing/time.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/validation/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/validation/rule.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/validation/validation_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/validation/validator.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/view/__init__.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/view/compiler.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/view/factory.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus/view/view_service_provider.py +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus_framework.egg-info/dependency_links.txt +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus_framework.egg-info/entry_points.txt +0 -0
- {nexus_framework-0.4.0 → nexus_framework-0.4.2}/src/nexus_framework.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nexus-framework
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: An expressive, batteries-included asynchronous web framework for Python inspired by Laravel.
|
|
5
5
|
Author-email: Nexus Core Team <core@nexus-framework.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -35,6 +35,26 @@ Requires-Dist: python-dotenv>=1.0.1
|
|
|
35
35
|
Requires-Dist: python-multipart>=0.0.9
|
|
36
36
|
Requires-Dist: anyio>=4.3.0
|
|
37
37
|
Requires-Dist: faker>=24.0.0
|
|
38
|
+
Requires-Dist: pymysql>=1.1.0
|
|
39
|
+
Requires-Dist: cryptography>=42.0.0
|
|
40
|
+
Requires-Dist: psycopg2-binary>=2.9.9
|
|
41
|
+
Requires-Dist: httpx>=0.27.0
|
|
42
|
+
Requires-Dist: redis>=5.0.0
|
|
43
|
+
Requires-Dist: bcrypt>=4.0.0
|
|
44
|
+
Provides-Extra: mysql
|
|
45
|
+
Requires-Dist: pymysql>=1.1.0; extra == "mysql"
|
|
46
|
+
Requires-Dist: cryptography>=42.0.0; extra == "mysql"
|
|
47
|
+
Provides-Extra: postgres
|
|
48
|
+
Requires-Dist: psycopg2-binary>=2.9.9; extra == "postgres"
|
|
49
|
+
Provides-Extra: redis
|
|
50
|
+
Requires-Dist: redis>=5.0.0; extra == "redis"
|
|
51
|
+
Provides-Extra: all
|
|
52
|
+
Requires-Dist: pymysql>=1.1.0; extra == "all"
|
|
53
|
+
Requires-Dist: cryptography>=42.0.0; extra == "all"
|
|
54
|
+
Requires-Dist: psycopg2-binary>=2.9.9; extra == "all"
|
|
55
|
+
Requires-Dist: redis>=5.0.0; extra == "all"
|
|
56
|
+
Requires-Dist: bcrypt>=4.0.0; extra == "all"
|
|
57
|
+
Requires-Dist: httpx>=0.27.0; extra == "all"
|
|
38
58
|
Provides-Extra: dev
|
|
39
59
|
Requires-Dist: pytest>=8.1.0; extra == "dev"
|
|
40
60
|
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nexus-framework"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.2"
|
|
8
8
|
description = "An expressive, batteries-included asynchronous web framework for Python inspired by Laravel."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -52,6 +52,12 @@ dependencies = [
|
|
|
52
52
|
"python-multipart>=0.0.9",
|
|
53
53
|
"anyio>=4.3.0",
|
|
54
54
|
"faker>=24.0.0",
|
|
55
|
+
"pymysql>=1.1.0",
|
|
56
|
+
"cryptography>=42.0.0",
|
|
57
|
+
"psycopg2-binary>=2.9.9",
|
|
58
|
+
"httpx>=0.27.0",
|
|
59
|
+
"redis>=5.0.0",
|
|
60
|
+
"bcrypt>=4.0.0",
|
|
55
61
|
]
|
|
56
62
|
|
|
57
63
|
[project.urls]
|
|
@@ -61,6 +67,24 @@ Repository = "https://github.com/nexus-framework/nexus.git"
|
|
|
61
67
|
Issues = "https://github.com/nexus-framework/nexus/issues"
|
|
62
68
|
|
|
63
69
|
[project.optional-dependencies]
|
|
70
|
+
mysql = [
|
|
71
|
+
"pymysql>=1.1.0",
|
|
72
|
+
"cryptography>=42.0.0",
|
|
73
|
+
]
|
|
74
|
+
postgres = [
|
|
75
|
+
"psycopg2-binary>=2.9.9",
|
|
76
|
+
]
|
|
77
|
+
redis = [
|
|
78
|
+
"redis>=5.0.0",
|
|
79
|
+
]
|
|
80
|
+
all = [
|
|
81
|
+
"pymysql>=1.1.0",
|
|
82
|
+
"cryptography>=42.0.0",
|
|
83
|
+
"psycopg2-binary>=2.9.9",
|
|
84
|
+
"redis>=5.0.0",
|
|
85
|
+
"bcrypt>=4.0.0",
|
|
86
|
+
"httpx>=0.27.0",
|
|
87
|
+
]
|
|
64
88
|
dev = [
|
|
65
89
|
"pytest>=8.1.0",
|
|
66
90
|
"pytest-asyncio>=0.23.0",
|
|
@@ -193,7 +193,18 @@ class RedisCacheDriver(CacheDriver):
|
|
|
193
193
|
import redis # type: ignore[import-not-found]
|
|
194
194
|
self._client = redis.Redis(host=host, port=port, db=db, decode_responses=True)
|
|
195
195
|
self._client.ping()
|
|
196
|
-
except
|
|
196
|
+
except ImportError:
|
|
197
|
+
try:
|
|
198
|
+
from nexus.support.dependencies import ensure_driver
|
|
199
|
+
if ensure_driver("redis", silent=True):
|
|
200
|
+
import redis # type: ignore[import-not-found]
|
|
201
|
+
self._client = redis.Redis(host=host, port=port, db=db, decode_responses=True)
|
|
202
|
+
self._client.ping()
|
|
203
|
+
else:
|
|
204
|
+
self._client = None
|
|
205
|
+
except Exception: # noqa: BLE001
|
|
206
|
+
self._client = None
|
|
207
|
+
except (RuntimeError, ConnectionError, OSError):
|
|
197
208
|
self._client = None
|
|
198
209
|
|
|
199
210
|
def _prefixed(self, key: str) -> str:
|
|
@@ -194,22 +194,22 @@ def reverse_engineer_database(
|
|
|
194
194
|
|
|
195
195
|
from __future__ import annotations
|
|
196
196
|
|
|
197
|
-
from nexus.database.migrations
|
|
197
|
+
from nexus.database.migrations import Migration
|
|
198
198
|
from nexus.database.schema.blueprint import Blueprint
|
|
199
|
-
from nexus.
|
|
199
|
+
from nexus.facades.schema import Schema
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
class {class_name}(Migration):
|
|
203
203
|
"""Create {t_name} table schema."""
|
|
204
204
|
|
|
205
|
-
def up(self
|
|
205
|
+
def up(self) -> None:
|
|
206
206
|
def table_definition(table: Blueprint) -> None:
|
|
207
207
|
{schema_body}
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
Schema.create("{t_name}", table_definition)
|
|
210
210
|
|
|
211
|
-
def down(self
|
|
212
|
-
|
|
211
|
+
def down(self) -> None:
|
|
212
|
+
Schema.drop_if_exists("{t_name}")
|
|
213
213
|
'''
|
|
214
214
|
target_mig_file.write_text(migration_code, encoding="utf-8")
|
|
215
215
|
generated_migrations.append(mig_filename)
|
|
@@ -10,12 +10,14 @@ Provides commands to install and publish optional tooling:
|
|
|
10
10
|
from __future__ import annotations
|
|
11
11
|
|
|
12
12
|
import os
|
|
13
|
+
import secrets
|
|
13
14
|
import webbrowser
|
|
14
15
|
from typing import TYPE_CHECKING
|
|
15
16
|
|
|
16
17
|
import typer
|
|
17
18
|
from rich.console import Console
|
|
18
19
|
from rich.panel import Panel
|
|
20
|
+
from rich.prompt import Prompt
|
|
19
21
|
|
|
20
22
|
if TYPE_CHECKING:
|
|
21
23
|
from nexus.foundation.application import Application
|
|
@@ -141,14 +143,35 @@ CONFIG = {
|
|
|
141
143
|
)
|
|
142
144
|
)
|
|
143
145
|
|
|
144
|
-
@cli.command("db:install", help="Install Nexus Database Studio management interface")
|
|
145
|
-
def db_install(
|
|
146
|
-
"""
|
|
146
|
+
@cli.command("db:install", help="Install Nexus Database Studio management interface with secure credentials")
|
|
147
|
+
def db_install(
|
|
148
|
+
username: str | None = typer.Option(None, "--username", "-u", help="Admin username for Database Studio access"),
|
|
149
|
+
password: str | None = typer.Option(None, "--password", "-p", help="Admin password for Database Studio access"),
|
|
150
|
+
no_interaction: bool = typer.Option(False, "--no-interaction", "-n", help="Skip interactive prompts and use defaults"),
|
|
151
|
+
) -> None:
|
|
152
|
+
"""Publish config/database_studio.py and activate DB_STUDIO_ENABLED in .env with secure credentials."""
|
|
153
|
+
if not username:
|
|
154
|
+
if no_interaction:
|
|
155
|
+
username = "admin"
|
|
156
|
+
else:
|
|
157
|
+
username = Prompt.ask("[bold cyan]Enter Database Studio admin username[/bold cyan]", default="admin")
|
|
158
|
+
|
|
159
|
+
if not password:
|
|
160
|
+
if no_interaction:
|
|
161
|
+
password = "admin"
|
|
162
|
+
else:
|
|
163
|
+
password = Prompt.ask("[bold cyan]Enter Database Studio admin password[/bold cyan]", password=True, default="nexus123")
|
|
164
|
+
|
|
165
|
+
secret_key = secrets.token_urlsafe(32)
|
|
166
|
+
|
|
147
167
|
_update_env_file(
|
|
148
168
|
app,
|
|
149
169
|
{
|
|
150
170
|
"DB_STUDIO_ENABLED": "true",
|
|
151
171
|
"DB_STUDIO_PATH": "/db/studio",
|
|
172
|
+
"DB_STUDIO_USER": username,
|
|
173
|
+
"DB_STUDIO_PASSWORD": password,
|
|
174
|
+
"DB_STUDIO_SECRET": secret_key,
|
|
152
175
|
},
|
|
153
176
|
)
|
|
154
177
|
|
|
@@ -163,6 +186,9 @@ from nexus.support.env import env
|
|
|
163
186
|
CONFIG = {
|
|
164
187
|
"enabled": env("DB_STUDIO_ENABLED", True),
|
|
165
188
|
"path": env("DB_STUDIO_PATH", "/db/studio"),
|
|
189
|
+
"username": env("DB_STUDIO_USER", "admin"),
|
|
190
|
+
"password": env("DB_STUDIO_PASSWORD", ""),
|
|
191
|
+
"secret": env("DB_STUDIO_SECRET", "nexus_studio_secret_key"),
|
|
166
192
|
}
|
|
167
193
|
''',
|
|
168
194
|
encoding="utf-8",
|
|
@@ -172,8 +198,10 @@ CONFIG = {
|
|
|
172
198
|
Panel(
|
|
173
199
|
"[bold green]⚡ Nexus Database Studio Installed Successfully![/bold green]\n\n"
|
|
174
200
|
"• [bold cyan]Database Management GUI:[/bold cyan] http://localhost:8000/db/studio\n"
|
|
201
|
+
f"• [bold cyan]Admin Username:[/bold cyan] [yellow]{username}[/yellow]\n"
|
|
202
|
+
f"• [bold cyan]Admin Password:[/bold cyan] [dim]{'*' * len(password)}[/dim]\n"
|
|
203
|
+
"• [bold cyan]Access Security:[/bold cyan] Protected with session authentication\n"
|
|
175
204
|
"• [bold cyan]CLI Shortcut:[/bold cyan] Run [white]nexus db:studio[/white] to launch\n"
|
|
176
|
-
"• Features: Table Inspector, Row Pagination, Schema Viewer, Raw SQL Console\n"
|
|
177
205
|
"• Published [dim]config/database_studio.py[/dim]",
|
|
178
206
|
title="Database Studio",
|
|
179
207
|
border_style="green",
|
|
@@ -54,6 +54,11 @@ def register_new_command(cli: typer.Typer, app: Application) -> None:
|
|
|
54
54
|
name: str | None = typer.Argument(None, help="The project name or directory (use '.' for current directory)"),
|
|
55
55
|
starter: str | None = typer.Option(None, "--starter", "-s", help="Starter kit template ('standard', 'api', 'web', 'inertia')"),
|
|
56
56
|
database: str | None = typer.Option(None, "--database", "-d", help="Database driver ('sqlite', 'pgsql', 'mysql')"),
|
|
57
|
+
db_host: str | None = typer.Option(None, "--db-host", help="Database server hostname"),
|
|
58
|
+
db_port: int | None = typer.Option(None, "--db-port", help="Database server port"),
|
|
59
|
+
db_name: str | None = typer.Option(None, "--db-name", help="Database schema name"),
|
|
60
|
+
db_user: str | None = typer.Option(None, "--db-user", help="Database username"),
|
|
61
|
+
db_password: str | None = typer.Option(None, "--db-password", help="Database password"),
|
|
57
62
|
force: bool = typer.Option(False, "--force", "-f", help="Overwrite existing files in target directory"),
|
|
58
63
|
git: bool | None = typer.Option(None, "--git/--no-git", help="Initialize a fresh Git repository"),
|
|
59
64
|
install: bool | None = typer.Option(None, "--install/--no-install", help="Automatically install Python and NPM dependencies"),
|
|
@@ -106,12 +111,31 @@ def register_new_command(cli: typer.Typer, app: Application) -> None:
|
|
|
106
111
|
raw_db = Prompt.ask("Choose database engine", choices=list(db_map.keys()), default="1")
|
|
107
112
|
db_choice = db_map[raw_db]
|
|
108
113
|
|
|
109
|
-
# 4.
|
|
114
|
+
# 4. Database configuration prompts (if non-sqlite)
|
|
115
|
+
clean_app_name = "".join(c if c.isalnum() else "_" for c in (name or "nexus").lower()).strip("_") or "nexus"
|
|
116
|
+
default_port = 3306 if "mysql" in db_choice else 5432
|
|
117
|
+
default_user = "root" if "mysql" in db_choice else "postgres"
|
|
118
|
+
|
|
119
|
+
db_host = db_host or "127.0.0.1"
|
|
120
|
+
db_port = db_port or default_port
|
|
121
|
+
db_name = db_name or clean_app_name
|
|
122
|
+
db_user = db_user or default_user
|
|
123
|
+
db_password = db_password if db_password is not None else ""
|
|
124
|
+
|
|
125
|
+
if is_interactive and db_choice != "sqlite":
|
|
126
|
+
console.print(f"\n[bold cyan]Configure {db_choice.upper()} Database Credentials:[/bold cyan]")
|
|
127
|
+
db_host = Prompt.ask(" Database Host", default=db_host)
|
|
128
|
+
db_port = int(Prompt.ask(" Database Port", default=str(db_port)))
|
|
129
|
+
db_name = Prompt.ask(" Database Name", default=db_name)
|
|
130
|
+
db_user = Prompt.ask(" Database Username", default=db_user)
|
|
131
|
+
db_password = Prompt.ask(" Database Password", password=True, default=db_password)
|
|
132
|
+
|
|
133
|
+
# 5. Git repository prompt
|
|
110
134
|
use_git = git if git is not None else True
|
|
111
135
|
if is_interactive and git is None:
|
|
112
136
|
use_git = Confirm.ask("\nInitialize a fresh Git repository?", default=True)
|
|
113
137
|
|
|
114
|
-
#
|
|
138
|
+
# 6. Dependency installation prompt
|
|
115
139
|
should_install = install if install is not None else True
|
|
116
140
|
if is_interactive and install is None:
|
|
117
141
|
should_install = Confirm.ask("Automatically install Python & NPM dependencies now?", default=True)
|
|
@@ -168,14 +192,28 @@ def register_new_command(cli: typer.Typer, app: Application) -> None:
|
|
|
168
192
|
app_key, _ = set_app_key_in_env(target)
|
|
169
193
|
console.print(f"[bold green]Application key set successfully:[/bold green] [cyan]{app_key}[/cyan]")
|
|
170
194
|
|
|
171
|
-
# Configure selected database in .env if not sqlite
|
|
195
|
+
# Configure selected database in .env and .env.example if not sqlite
|
|
172
196
|
if db_choice != "sqlite":
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
197
|
+
new_db_block = (
|
|
198
|
+
f"DB_CONNECTION={db_choice}\n"
|
|
199
|
+
f"DB_HOST={db_host}\n"
|
|
200
|
+
f"DB_PORT={db_port}\n"
|
|
201
|
+
f"DB_DATABASE={db_name}\n"
|
|
202
|
+
f"DB_USERNAME={db_user}\n"
|
|
203
|
+
f"DB_PASSWORD={db_password}"
|
|
204
|
+
)
|
|
205
|
+
for env_target in [target / ".env", target / ".env.example"]:
|
|
206
|
+
if env_target.exists():
|
|
207
|
+
txt = env_target.read_text(encoding="utf-8")
|
|
208
|
+
old_sqlite_block = "DB_CONNECTION=sqlite\nDB_DATABASE=storage/database.sqlite"
|
|
209
|
+
if old_sqlite_block in txt:
|
|
210
|
+
txt = txt.replace(old_sqlite_block, new_db_block)
|
|
211
|
+
else:
|
|
212
|
+
txt = txt.replace("DB_CONNECTION=sqlite", f"DB_CONNECTION={db_choice}")
|
|
213
|
+
txt = txt.replace("DB_DATABASE=storage/database.sqlite", f"DB_DATABASE={db_name}")
|
|
214
|
+
txt += f"\nDB_HOST={db_host}\nDB_PORT={db_port}\nDB_USERNAME={db_user}\nDB_PASSWORD={db_password}\n"
|
|
215
|
+
env_target.write_text(txt, encoding="utf-8")
|
|
216
|
+
console.print(f"[bold green]✓[/bold green] Database configured in .env: [cyan]{db_choice}://{db_user}@{db_host}:{db_port}/{db_name}[/cyan]")
|
|
179
217
|
|
|
180
218
|
# Auto-install Python and NPM dependencies if requested
|
|
181
219
|
if should_install:
|
|
@@ -66,22 +66,57 @@ class DatabaseManager:
|
|
|
66
66
|
)
|
|
67
67
|
|
|
68
68
|
elif driver in ("mysql", "mariadb"):
|
|
69
|
+
from urllib.parse import quote_plus
|
|
70
|
+
|
|
71
|
+
from nexus.support.dependencies import ensure_driver
|
|
72
|
+
|
|
73
|
+
ensure_driver("mysql")
|
|
69
74
|
host = db_config.get("host") or env("DB_HOST", "127.0.0.1")
|
|
70
75
|
port = db_config.get("port") or env("DB_PORT", 3306)
|
|
71
76
|
database = db_config.get("database") or env("DB_DATABASE", "nexus")
|
|
72
77
|
username = db_config.get("username") or env("DB_USERNAME", "root")
|
|
73
78
|
password = db_config.get("password") or env("DB_PASSWORD", "")
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
|
|
80
|
+
safe_user = quote_plus(str(username))
|
|
81
|
+
safe_pass = quote_plus(str(password))
|
|
82
|
+
url = f"mysql+pymysql://{safe_user}:{safe_pass}@{host}:{port}/{database}?charset=utf8mb4"
|
|
83
|
+
try:
|
|
84
|
+
return create_engine(url, pool_pre_ping=True)
|
|
85
|
+
except Exception as e:
|
|
86
|
+
err_str = str(e).lower()
|
|
87
|
+
if "pymysql" in err_str or "module" in err_str:
|
|
88
|
+
ensure_driver("mysql", silent=False)
|
|
89
|
+
return create_engine(url, pool_pre_ping=True)
|
|
90
|
+
if "auth_gssapi_client" in err_str:
|
|
91
|
+
raise RuntimeError(
|
|
92
|
+
f"Database connection error: MariaDB/MySQL server requested 'auth_gssapi_client'. "
|
|
93
|
+
f"This happens when connecting as '{username}' with an invalid/empty password or when MariaDB GSSAPI plugin is active. "
|
|
94
|
+
f"Please check DB_USERNAME and DB_PASSWORD in your .env file."
|
|
95
|
+
) from e
|
|
96
|
+
raise
|
|
76
97
|
|
|
77
98
|
elif driver in ("pgsql", "postgres", "postgresql"):
|
|
99
|
+
from urllib.parse import quote_plus
|
|
100
|
+
|
|
101
|
+
from nexus.support.dependencies import ensure_driver
|
|
102
|
+
|
|
103
|
+
ensure_driver("postgresql")
|
|
78
104
|
host = db_config.get("host") or env("DB_HOST", "127.0.0.1")
|
|
79
105
|
port = db_config.get("port") or env("DB_PORT", 5432)
|
|
80
106
|
database = db_config.get("database") or env("DB_DATABASE", "nexus")
|
|
81
107
|
username = db_config.get("username") or env("DB_USERNAME", "postgres")
|
|
82
108
|
password = db_config.get("password") or env("DB_PASSWORD", "")
|
|
83
|
-
|
|
84
|
-
|
|
109
|
+
|
|
110
|
+
safe_user = quote_plus(str(username))
|
|
111
|
+
safe_pass = quote_plus(str(password))
|
|
112
|
+
url = f"postgresql://{safe_user}:{safe_pass}@{host}:{port}/{database}"
|
|
113
|
+
try:
|
|
114
|
+
return create_engine(url, pool_pre_ping=True)
|
|
115
|
+
except Exception as e:
|
|
116
|
+
if "psycopg" in str(e).lower() or "module" in str(e).lower():
|
|
117
|
+
ensure_driver("postgresql", silent=False)
|
|
118
|
+
return create_engine(url, pool_pre_ping=True)
|
|
119
|
+
raise
|
|
85
120
|
|
|
86
121
|
else:
|
|
87
122
|
url = db_config.get("url") or f"{driver}:///"
|
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
class Migration:
|
|
7
9
|
"""Base class for all schema migrations."""
|
|
8
10
|
|
|
11
|
+
@property
|
|
12
|
+
def schema(self) -> Any:
|
|
13
|
+
"""Access the database schema builder facade."""
|
|
14
|
+
from nexus.facades.schema import Schema
|
|
15
|
+
|
|
16
|
+
return Schema
|
|
17
|
+
|
|
9
18
|
def up(self) -> None:
|
|
10
19
|
"""Run the migration operations."""
|
|
11
20
|
|
|
@@ -33,9 +33,11 @@ class ColumnDefinition:
|
|
|
33
33
|
self._has_default = True
|
|
34
34
|
return self
|
|
35
35
|
|
|
36
|
-
def unique(self) -> Self:
|
|
36
|
+
def unique(self, name: str | None = None) -> Self:
|
|
37
37
|
"""Mark column as unique."""
|
|
38
38
|
self._unique = True
|
|
39
|
+
if name:
|
|
40
|
+
self.attributes["unique_name"] = name
|
|
39
41
|
return self
|
|
40
42
|
|
|
41
43
|
def primary(self) -> Self:
|
|
@@ -43,9 +45,11 @@ class ColumnDefinition:
|
|
|
43
45
|
self._primary = True
|
|
44
46
|
return self
|
|
45
47
|
|
|
46
|
-
def index(self) -> Self:
|
|
48
|
+
def index(self, name: str | None = None) -> Self:
|
|
47
49
|
"""Create an index on the column."""
|
|
48
50
|
self._index = True
|
|
51
|
+
if name:
|
|
52
|
+
self.attributes["index_name"] = name
|
|
49
53
|
return self
|
|
50
54
|
|
|
51
55
|
def constrained(self, table: str | None = None, column: str = "id") -> Self:
|
|
@@ -101,6 +105,18 @@ class Blueprint:
|
|
|
101
105
|
self.columns.append(col)
|
|
102
106
|
return col
|
|
103
107
|
|
|
108
|
+
def small_integer(self, name: str) -> ColumnDefinition:
|
|
109
|
+
"""Add a small integer column."""
|
|
110
|
+
col = ColumnDefinition(name, "small_integer")
|
|
111
|
+
self.columns.append(col)
|
|
112
|
+
return col
|
|
113
|
+
|
|
114
|
+
def tiny_integer(self, name: str) -> ColumnDefinition:
|
|
115
|
+
"""Add a tiny integer column."""
|
|
116
|
+
col = ColumnDefinition(name, "tiny_integer")
|
|
117
|
+
self.columns.append(col)
|
|
118
|
+
return col
|
|
119
|
+
|
|
104
120
|
def big_integer(self, name: str) -> ColumnDefinition:
|
|
105
121
|
"""Add a big integer column."""
|
|
106
122
|
col = ColumnDefinition(name, "big_integer")
|
|
@@ -154,6 +170,18 @@ class Blueprint:
|
|
|
154
170
|
"""Drop columns from the table."""
|
|
155
171
|
self.commands.append({"type": "drop_column", "columns": list(names)})
|
|
156
172
|
|
|
173
|
+
def index(self, columns: str | list[str], name: str | None = None) -> None:
|
|
174
|
+
"""Add a standalone or composite index."""
|
|
175
|
+
cols = [columns] if isinstance(columns, str) else list(columns)
|
|
176
|
+
idx_name = name or f"idx_{self.table}_{'_'.join(cols)}"
|
|
177
|
+
self.commands.append({"type": "index", "columns": cols, "name": idx_name})
|
|
178
|
+
|
|
179
|
+
def unique(self, columns: str | list[str], name: str | None = None) -> None:
|
|
180
|
+
"""Add a standalone or composite unique constraint/index."""
|
|
181
|
+
cols = [columns] if isinstance(columns, str) else list(columns)
|
|
182
|
+
uq_name = name or f"uq_{self.table}_{'_'.join(cols)}"
|
|
183
|
+
self.commands.append({"type": "unique", "columns": cols, "name": uq_name})
|
|
184
|
+
|
|
157
185
|
def to_sql(self, driver: str = "sqlite") -> list[str]:
|
|
158
186
|
"""Compile the blueprint columns and commands to SQL DDL statements."""
|
|
159
187
|
statements: list[str] = []
|
|
@@ -197,12 +225,21 @@ class Blueprint:
|
|
|
197
225
|
create_table = f"CREATE TABLE IF NOT EXISTS {self.table} (\n " + ",\n ".join(column_clauses) + "\n)"
|
|
198
226
|
statements.append(create_table)
|
|
199
227
|
|
|
200
|
-
# Handle indexes
|
|
228
|
+
# Handle column indexes
|
|
201
229
|
for col in self.columns:
|
|
202
230
|
if col._index and not col._primary and not col._unique:
|
|
203
|
-
idx_name = f"idx_{self.table}_{col.name}"
|
|
231
|
+
idx_name = col.attributes.get("index_name") or f"idx_{self.table}_{col.name}"
|
|
204
232
|
statements.append(f"CREATE INDEX IF NOT EXISTS {idx_name} ON {self.table} ({col.name})")
|
|
205
233
|
|
|
234
|
+
# Handle explicit commands (composite indexes and unique constraints)
|
|
235
|
+
for cmd in self.commands:
|
|
236
|
+
if cmd["type"] == "index":
|
|
237
|
+
cols_str = ", ".join(cmd["columns"])
|
|
238
|
+
statements.append(f"CREATE INDEX IF NOT EXISTS {cmd['name']} ON {self.table} ({cols_str})")
|
|
239
|
+
elif cmd["type"] == "unique":
|
|
240
|
+
cols_str = ", ".join(cmd["columns"])
|
|
241
|
+
statements.append(f"CREATE UNIQUE INDEX IF NOT EXISTS {cmd['name']} ON {self.table} ({cols_str})")
|
|
242
|
+
|
|
206
243
|
return statements
|
|
207
244
|
|
|
208
245
|
def _map_type(self, col: ColumnDefinition, driver: str) -> str:
|
|
@@ -212,7 +249,7 @@ class Blueprint:
|
|
|
212
249
|
return f"VARCHAR({col.attributes.get('length', 255)})"
|
|
213
250
|
elif t == "text":
|
|
214
251
|
return "TEXT"
|
|
215
|
-
elif t
|
|
252
|
+
elif t in ("integer", "small_integer", "tiny_integer"):
|
|
216
253
|
return "INTEGER"
|
|
217
254
|
elif t == "big_integer":
|
|
218
255
|
return "BIGINT"
|