swiftpy-framework 0.2.0__tar.gz → 0.2.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.
Files changed (490) hide show
  1. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/.env.example +4 -1
  2. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/.gitignore +1 -0
  3. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/CHANGELOG.md +35 -0
  4. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/PKG-INFO +5 -2
  5. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/README.md +4 -1
  6. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/auth.py +3 -1
  7. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-14-installation-quick-start.md +4 -4
  8. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-authentication-and-security.md +27 -2
  9. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-core-application-di-and-config.md +17 -0
  10. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-filesystem-storage-and-mail.md +1 -1
  11. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-http-routing-middleware-and-exceptions.md +2 -2
  12. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-orm-models-and-relationships.md +2 -0
  13. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-20-request-and-responses.md +2 -1
  14. swiftpy_framework-0.2.2/documentations/2026-11-21-cors.md +273 -0
  15. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/pyproject.toml +1 -1
  16. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/__init__.py +3 -0
  17. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth/auth_manager.py +69 -68
  18. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth/jwt_guard.py +5 -5
  19. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth/jwt_issuer.py +88 -14
  20. swiftpy_framework-0.2.2/swiftpy/auth/user_context.py +348 -0
  21. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/new.py +7 -3
  22. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/application.py +91 -2
  23. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/orm/model.py +83 -1
  24. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/helpers/__init__.py +2 -0
  25. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/helpers/helper.py +149 -0
  26. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/http/request.py +58 -1
  27. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/http/response.py +2 -0
  28. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/http/router.py +1 -1
  29. swiftpy_framework-0.2.2/tests/auth/test_auth_context_on_issue.py +317 -0
  30. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_auth_proxy.py +153 -0
  31. swiftpy_framework-0.2.2/tests/auth/test_jwt_defaults.py +89 -0
  32. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_refresh_and_logout.py +1 -1
  33. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/test_new_command.py +7 -0
  34. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/test_phase9_cli_remediation.py +1 -1
  35. swiftpy_framework-0.2.2/tests/core/test_helpers.py +364 -0
  36. swiftpy_framework-0.2.2/tests/http/test_router_405_and_has_file.py +279 -0
  37. swiftpy_framework-0.2.2/tests/orm/test_instance_update.py +202 -0
  38. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/uv.lock +1 -1
  39. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/.dockerignore +0 -0
  40. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/.github/workflows/ci.yml +0 -0
  41. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/.github/workflows/publish.yml +0 -0
  42. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/CONTRIBUTING.md +0 -0
  43. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/Dockerfile +0 -0
  44. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/LICENSE +0 -0
  45. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/__init__.py +0 -0
  46. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/events/user_registered.py +0 -0
  47. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/http/handler/exceptions.py +0 -0
  48. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/http/middleware/__init__.py +0 -0
  49. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/http/middleware/admin_middleware.py +0 -0
  50. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/http/middleware/auth_middleware.py +0 -0
  51. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/http/middleware/test_middleware.py +0 -0
  52. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/http/requests/create_user_request.py +0 -0
  53. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/jobs/send_notification_job.py +0 -0
  54. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/listeners/send_welcome_notification.py +0 -0
  55. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/mail/welcome_email.py +0 -0
  56. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/models/user.py +0 -0
  57. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/app_service_provider.py +0 -0
  58. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/auth_service_provider.py +0 -0
  59. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/cache_service_provider.py +0 -0
  60. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/database_service_provider.py +0 -0
  61. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/event_service_provider.py +0 -0
  62. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/filesystem_service_provider.py +0 -0
  63. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/mail_service_provider.py +0 -0
  64. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/providers/queue_service_provider.py +0 -0
  65. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/repositories/user_repository.py +0 -0
  66. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/schemas/user_schema.py +0 -0
  67. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/app/services/user_service.py +0 -0
  68. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/bootstrap/cache/.gitkeep +0 -0
  69. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/__init__.py +0 -0
  70. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/ai.py +0 -0
  71. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/app.py +0 -0
  72. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/cache.py +0 -0
  73. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/cors.py +0 -0
  74. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/database.py +0 -0
  75. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/events.py +0 -0
  76. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/filesystems.py +0 -0
  77. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/logging.py +0 -0
  78. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/mail.py +0 -0
  79. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/config/queue.py +0 -0
  80. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/database/migrations/2026_01_01_000000_create_users_table.py +0 -0
  81. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/database/seeders/database_seeder.py +0 -0
  82. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/docker-compose.yml +0 -0
  83. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-ai-subsystem.md +0 -0
  84. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-cache-events-and-queues.md +0 -0
  85. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-database-query-builder-and-migrations.md +0 -0
  86. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-validation-and-form-requests.md +0 -0
  87. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-15-websockets-and-admin.md +0 -0
  88. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-19-application-schemas.md +0 -0
  89. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-19-cli-and-testing.md +0 -0
  90. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-19-database-schema-and-blueprint.md +0 -0
  91. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-20-error-handling.md +0 -0
  92. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/documentations/2026-11-20-logging.md +0 -0
  93. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/main.py +0 -0
  94. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/red-black.png +0 -0
  95. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/routes/__init__.py +0 -0
  96. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/routes/api.py +0 -0
  97. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/.gitignore +0 -0
  98. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/admin/__init__.py +0 -0
  99. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/admin/auth.py +0 -0
  100. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/admin/registry.py +0 -0
  101. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/admin/views.py +0 -0
  102. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/__init__.py +0 -0
  103. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/_deterministic.py +0 -0
  104. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/_fake.py +0 -0
  105. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/agents/__init__.py +0 -0
  106. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/agents/base_agent.py +0 -0
  107. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/agents/memory.py +0 -0
  108. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/client.py +0 -0
  109. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/conversation.py +0 -0
  110. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/embeddings.py +0 -0
  111. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/exceptions.py +0 -0
  112. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/history_strategies.py +0 -0
  113. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/middleware.py +0 -0
  114. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/observability/__init__.py +0 -0
  115. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/observability/drivers.py +0 -0
  116. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/observability/observer.py +0 -0
  117. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/pool.py +0 -0
  118. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/pricing.py +0 -0
  119. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/prompts/__init__.py +0 -0
  120. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/prompts/loader.py +0 -0
  121. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/providers/__init__.py +0 -0
  122. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/providers/anthropic_provider.py +0 -0
  123. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/providers/base.py +0 -0
  124. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/providers/openai_provider.py +0 -0
  125. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/rag/__init__.py +0 -0
  126. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/rag/context_formatter.py +0 -0
  127. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/rag/pipeline_builder.py +0 -0
  128. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/rag/reranker.py +0 -0
  129. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/rag/result.py +0 -0
  130. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/rag/retriever.py +0 -0
  131. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/redis_store.py +0 -0
  132. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/streaming.py +0 -0
  133. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/tools/__init__.py +0 -0
  134. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/tools/base_tool.py +0 -0
  135. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/tools/first_party.py +0 -0
  136. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/tools/tool_loop.py +0 -0
  137. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/__init__.py +0 -0
  138. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/base.py +0 -0
  139. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/chroma_adapter.py +0 -0
  140. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/in_memory_adapter.py +0 -0
  141. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/lancedb_adapter.py +0 -0
  142. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/pgvector_adapter.py +0 -0
  143. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/pinecone_adapter.py +0 -0
  144. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/ai/vectorstore/qdrant_adapter.py +0 -0
  145. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth/__init__.py +0 -0
  146. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth/api_key_guard.py +0 -0
  147. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth/exceptions.py +0 -0
  148. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth/token_blacklist.py +0 -0
  149. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/auth_manager.py +0 -0
  150. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/cache/__init__.py +0 -0
  151. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/cache/cache.py +0 -0
  152. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/cache/driver.py +0 -0
  153. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/cache/drivers/memory.py +0 -0
  154. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/cache/drivers/redis.py +0 -0
  155. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/__init__.py +0 -0
  156. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/cli.py +0 -0
  157. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/__init__.py +0 -0
  158. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/cache.py +0 -0
  159. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/make.py +0 -0
  160. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/migrate.py +0 -0
  161. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/queue.py +0 -0
  162. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/seed.py +0 -0
  163. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/start.py +0 -0
  164. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/commands/storage.py +0 -0
  165. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/loader.py +0 -0
  166. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/__init__.py +0 -0
  167. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/controller.stub +0 -0
  168. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/event.stub +0 -0
  169. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/job.stub +0 -0
  170. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/listener.stub +0 -0
  171. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/mail.stub +0 -0
  172. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/middleware.stub +0 -0
  173. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/migration.alter.stub +0 -0
  174. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/migration.api_keys.stub +0 -0
  175. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/migration.blank.stub +0 -0
  176. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/migration.create.stub +0 -0
  177. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/migration.stub +0 -0
  178. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/migration.update.stub +0 -0
  179. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/model.stub +0 -0
  180. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/provider.stub +0 -0
  181. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/repository.stub +0 -0
  182. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/request.stub +0 -0
  183. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/resource.stub +0 -0
  184. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/schema.stub +0 -0
  185. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/seeder.stub +0 -0
  186. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/console/stubs/service.stub +0 -0
  187. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/__init__.py +0 -0
  188. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/bootstrap.py +0 -0
  189. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/config.py +0 -0
  190. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/container.py +0 -0
  191. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/container_exceptions.py +0 -0
  192. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/context.py +0 -0
  193. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/exceptions.py +0 -0
  194. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/core/providers/base.py +0 -0
  195. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/__init__.py +0 -0
  196. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/exceptions.py +0 -0
  197. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/identifiers.py +0 -0
  198. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/migrations/__init__.py +0 -0
  199. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/migrations/blueprint.py +0 -0
  200. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/migrations/lock.py +0 -0
  201. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/migrations/migration.py +0 -0
  202. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/migrations/migrator.py +0 -0
  203. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/migrations/schema.py +0 -0
  204. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/orm/__init__.py +0 -0
  205. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/orm/fields.py +0 -0
  206. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/orm/registry.py +0 -0
  207. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/orm/relationships.py +0 -0
  208. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/pagination/__init__.py +0 -0
  209. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/pagination/contracts.py +0 -0
  210. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/pagination/paginator.py +0 -0
  211. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/pagination/simple_paginator.py +0 -0
  212. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/pool.py +0 -0
  213. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/query_builder.py +0 -0
  214. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/seeder.py +0 -0
  215. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/database/transaction.py +0 -0
  216. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/events/__init__.py +0 -0
  217. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/events/dispatcher.py +0 -0
  218. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/events/redis_bus.py +0 -0
  219. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/__init__.py +0 -0
  220. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/disk.py +0 -0
  221. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/drivers/__init__.py +0 -0
  222. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/drivers/base.py +0 -0
  223. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/drivers/local.py +0 -0
  224. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/drivers/s3.py +0 -0
  225. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/events.py +0 -0
  226. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/exceptions.py +0 -0
  227. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/manager.py +0 -0
  228. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/metadata.py +0 -0
  229. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/paths.py +0 -0
  230. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/service_provider.py +0 -0
  231. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/uploads/__init__.py +0 -0
  232. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/uploads/handlers.py +0 -0
  233. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/uploads/uploaded_file.py +0 -0
  234. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/uploads/validators.py +0 -0
  235. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/filesystem/visibility.py +0 -0
  236. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/http/exceptions.py +0 -0
  237. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/http/middleware.py +0 -0
  238. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/logging/__init__.py +0 -0
  239. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/logging/channels.py +0 -0
  240. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/logging/log.py +0 -0
  241. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/logging/manager.py +0 -0
  242. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/__init__.py +0 -0
  243. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/attachments.py +0 -0
  244. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/config.py +0 -0
  245. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/envelope.py +0 -0
  246. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/exceptions.py +0 -0
  247. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/facade.py +0 -0
  248. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/mailable.py +0 -0
  249. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/manager.py +0 -0
  250. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/message.py +0 -0
  251. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/models.py +0 -0
  252. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/queue/__init__.py +0 -0
  253. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/queue/job.py +0 -0
  254. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/service_provider.py +0 -0
  255. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/templates/__init__.py +0 -0
  256. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/templates/renderer.py +0 -0
  257. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/__init__.py +0 -0
  258. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/api/__init__.py +0 -0
  259. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/api/base.py +0 -0
  260. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/api/mailgun.py +0 -0
  261. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/api/resend.py +0 -0
  262. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/api/sendgrid.py +0 -0
  263. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/base.py +0 -0
  264. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/console.py +0 -0
  265. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/sendmail.py +0 -0
  266. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/mail/transports/smtp.py +0 -0
  267. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/queue/__init__.py +0 -0
  268. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/queue/dispatcher.py +0 -0
  269. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/queue/job.py +0 -0
  270. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/queue/worker.py +0 -0
  271. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/support/__init__.py +0 -0
  272. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/support/hashing.py +0 -0
  273. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/support/keys.py +0 -0
  274. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/support/redis_config.py +0 -0
  275. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/support/strings.py +0 -0
  276. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/testing/__init__.py +0 -0
  277. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/testing/fakes/__init__.py +0 -0
  278. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/testing/fakes/ai_fake.py +0 -0
  279. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/testing/fakes/vectorstore_fake.py +0 -0
  280. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/testing/fixtures.py +0 -0
  281. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/testing/http_client.py +0 -0
  282. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/testing/test_case.py +0 -0
  283. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/__init__.py +0 -0
  284. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/exceptions.py +0 -0
  285. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/form_request.py +0 -0
  286. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/protocols.py +0 -0
  287. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/rules/__init__.py +0 -0
  288. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/rules/builtin.py +0 -0
  289. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/rules/exists.py +0 -0
  290. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/rules/registry.py +0 -0
  291. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/rules/required.py +0 -0
  292. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/rules/unique.py +0 -0
  293. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/validation/validator.py +0 -0
  294. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/websockets/__init__.py +0 -0
  295. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/websockets/connection.py +0 -0
  296. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/swiftpy/websockets/manager.py +0 -0
  297. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/__init__.py +0 -0
  298. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/admin/__init__.py +0 -0
  299. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/admin/test_admin.py +0 -0
  300. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/__init__.py +0 -0
  301. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/conftest.py +0 -0
  302. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/integration/__init__.py +0 -0
  303. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/integration/test_chroma.py +0 -0
  304. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/integration/test_lancedb.py +0 -0
  305. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/integration/test_pinecone.py +0 -0
  306. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/integration/test_qdrant.py +0 -0
  307. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/integration/test_rag_integration.py +0 -0
  308. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_agents.py +0 -0
  309. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_ai_fake.py +0 -0
  310. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_ai_fake_isolation.py +0 -0
  311. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_client.py +0 -0
  312. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_conversation.py +0 -0
  313. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_embeddings.py +0 -0
  314. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_middleware.py +0 -0
  315. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_middleware_concurrency.py +0 -0
  316. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_observability.py +0 -0
  317. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_observability_resilience.py +0 -0
  318. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_phase7_ai_remediation.py +0 -0
  319. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_phase8_agents_tools_prompts_remediation.py +0 -0
  320. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_phase8_rag_remediation.py +0 -0
  321. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_phase8_vectorstore_remediation.py +0 -0
  322. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_prompts.py +0 -0
  323. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_prompts_security.py +0 -0
  324. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_providers.py +0 -0
  325. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_rag.py +0 -0
  326. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_streaming.py +0 -0
  327. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_tools.py +0 -0
  328. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_vectorstore.py +0 -0
  329. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/ai/test_vectorstore_adapters.py +0 -0
  330. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/app/__init__.py +0 -0
  331. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/app/test_application_providers.py +0 -0
  332. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/app/test_starter_auth.py +0 -0
  333. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/__init__.py +0 -0
  334. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_api_key_guard.py +0 -0
  335. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_auth_manager.py +0 -0
  336. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_auth_remediation.py +0 -0
  337. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_auth_security.py +0 -0
  338. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_jwt_issuer.py +0 -0
  339. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_password_hashing.py +0 -0
  340. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/auth/test_token_blacklist.py +0 -0
  341. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/benchmarks.py +0 -0
  342. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/cache/__init__.py +0 -0
  343. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/cache/test_cache_concurrency.py +0 -0
  344. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/cache/test_cache_manager.py +0 -0
  345. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/cache/test_driver_correctness.py +0 -0
  346. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/cache/test_memory_cache.py +0 -0
  347. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/cache/test_redis_cache.py +0 -0
  348. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/concurrency/__init__.py +0 -0
  349. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/concurrency/test_circular_dependency.py +0 -0
  350. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/concurrency/test_container_semantics.py +0 -0
  351. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/concurrency/test_resolution.py +0 -0
  352. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/concurrency/test_resolution2.py +0 -0
  353. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/conftest.py +0 -0
  354. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/__init__.py +0 -0
  355. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/test_cache_commands.py +0 -0
  356. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/test_cli.py +0 -0
  357. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/test_start.py +0 -0
  358. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/test_storage_command.py +0 -0
  359. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/console/test_stubs_and_make.py +0 -0
  360. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/core/__init__.py +0 -0
  361. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/core/test_application_config_isolation.py +0 -0
  362. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/core/test_core_config.py +0 -0
  363. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/core/test_exceptions.py +0 -0
  364. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/core/test_instance_singletons.py +0 -0
  365. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/core/test_lifespan.py +0 -0
  366. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/__init__.py +0 -0
  367. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_orm_expansion.py +0 -0
  368. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_orm_vector.py +0 -0
  369. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_pagination_and_grouping.py +0 -0
  370. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_pagination_pg_integration.py +0 -0
  371. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_pgvector_integration.py +0 -0
  372. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_phase4_remediation.py +0 -0
  373. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_query_expansion.py +0 -0
  374. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_query_expansion_pg_integration.py +0 -0
  375. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_seeder.py +0 -0
  376. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/database/test_sequence_gaps.py +0 -0
  377. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/__init__.py +0 -0
  378. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/load_test_database.py +0 -0
  379. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/load_test_database2.py +0 -0
  380. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/test_arbitrary_primary_keys.py +0 -0
  381. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/test_identifiers.py +0 -0
  382. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/test_mass_writes.py +0 -0
  383. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/test_pool_config.py +0 -0
  384. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/test_query_builder_terminals.py +0 -0
  385. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/test_sql_injections.py +0 -0
  386. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/db/test_transaction_isolation.py +0 -0
  387. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/docs/__init__.py +0 -0
  388. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/docs/test_readme_examples.py +0 -0
  389. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/e2e/__init__.py +0 -0
  390. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/e2e/test_concurrent_auth.py +0 -0
  391. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/e2e/test_crud_auth_e2e.py +0 -0
  392. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/events/__init__.py +0 -0
  393. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/events/test_event_dispatcher.py +0 -0
  394. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/events/test_model_events.py +0 -0
  395. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/events/test_redis_bus.py +0 -0
  396. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/events/test_redis_bus_reliability.py +0 -0
  397. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/__init__.py +0 -0
  398. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_cli_storage_link.py +0 -0
  399. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_disk.py +0 -0
  400. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_filesystem_concurrency.py +0 -0
  401. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_filesystem_config.py +0 -0
  402. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_http_integration.py +0 -0
  403. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_local_driver.py +0 -0
  404. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_multipart.py +0 -0
  405. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_paths.py +0 -0
  406. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_phase6_filesystem_remediation.py +0 -0
  407. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_s3_driver.py +0 -0
  408. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_signed_urls.py +0 -0
  409. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_storage_facade.py +0 -0
  410. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_uploaded_file.py +0 -0
  411. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/filesystem/test_validation.py +0 -0
  412. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/__init__.py +0 -0
  413. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_error_pipeline.py +0 -0
  414. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_http_remediation.py +0 -0
  415. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_include_router.py +0 -0
  416. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_request.py +0 -0
  417. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_request_router_abort.py +0 -0
  418. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_response.py +0 -0
  419. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_route_groups.py +0 -0
  420. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/http/test_router.py +0 -0
  421. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/integration/__init__.py +0 -0
  422. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/integration/test_queue_event_websocket.py +0 -0
  423. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/logging/__init__.py +0 -0
  424. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/logging/test_logging.py +0 -0
  425. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/__init__.py +0 -0
  426. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_api_transports.py +0 -0
  427. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_attachments.py +0 -0
  428. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_cli_make_mail.py +0 -0
  429. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_console_transport.py +0 -0
  430. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_envelope.py +0 -0
  431. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_facade_and_fake.py +0 -0
  432. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_mailable.py +0 -0
  433. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_manager_and_config.py +0 -0
  434. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_message.py +0 -0
  435. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_phase6_mail_remediation.py +0 -0
  436. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_queue_integration.py +0 -0
  437. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_service_provider_and_helpers.py +0 -0
  438. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_smtp_and_sendmail.py +0 -0
  439. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/mail/test_templates.py +0 -0
  440. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/migrations/__init__.py +0 -0
  441. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/migrations/test_migrations.py +0 -0
  442. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/orm/__init__.py +0 -0
  443. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/orm/test_defaults_dirty.py +0 -0
  444. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/orm/test_eager_loading.py +0 -0
  445. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/orm/test_hidden.py +0 -0
  446. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/orm/test_mass_assignment.py +0 -0
  447. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/orm/test_model_events_transaction.py +0 -0
  448. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/orm/test_relationships_hardening.py +0 -0
  449. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/__init__.py +0 -0
  450. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/test_after_commit.py +0 -0
  451. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/test_phase5_remediation.py +0 -0
  452. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/test_poison_messages.py +0 -0
  453. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/test_queue.py +0 -0
  454. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/test_reliability.py +0 -0
  455. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/test_signing.py +0 -0
  456. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/queue/test_worker_behavior.py +0 -0
  457. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/security/__init__.py +0 -0
  458. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/security/test_security_audit.py +0 -0
  459. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/stress/__init__.py +0 -0
  460. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/stress/test_context_isolation.py +0 -0
  461. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/support/__init__.py +0 -0
  462. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/support/test_redis_config.py +0 -0
  463. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/support/test_strings.py +0 -0
  464. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/testing/__init__.py +0 -0
  465. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/testing/test_fixtures.py +0 -0
  466. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/testing/test_phase9_testing_remediation.py +0 -0
  467. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/testing/test_test_client.py +0 -0
  468. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/typing/__init__.py +0 -0
  469. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/typing/test_orm_typing.py +0 -0
  470. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/__init__.py +0 -0
  471. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_db_rules.py +0 -0
  472. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_form_request_fail_closed.py +0 -0
  473. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_form_request_pipeline.py +0 -0
  474. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_phase6_validation_remediation.py +0 -0
  475. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_rules_hardening.py +0 -0
  476. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_validation_concurrency.py +0 -0
  477. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_validation_ergonomics.py +0 -0
  478. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/validation/test_validator_rules.py +0 -0
  479. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/__init__.py +0 -0
  480. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_broadcast.py +0 -0
  481. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_handshake.py +0 -0
  482. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_lifecycle.py +0 -0
  483. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_websocket_concurrency.py +0 -0
  484. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_websocket_connection.py +0 -0
  485. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_websocket_manager.py +0 -0
  486. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_websocket_remediation.py +0 -0
  487. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/tests/websockets/test_websocket_routing_and_lifecycle.py +0 -0
  488. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/views/admin/dashboard.html +0 -0
  489. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/views/admin/login.html +0 -0
  490. {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.2}/views/mail/template.html +0 -0
@@ -77,9 +77,12 @@ MAILGUN_DOMAIN=
77
77
 
78
78
  # Authentication & Security
79
79
  AUTH_GUARD=jwt
80
+ AUTH_BLACKLIST_ENABLED=true
81
+ AUTH_HYDRATE_USER=false
82
+ AUTH_PASSIVE_RESOLUTION=false
80
83
  JWT_SECRET=
81
84
  JWT_ALGORITHM=HS256
82
- JWT_ACCESS_TTL=900
85
+ JWT_ACCESS_TTL=3600
83
86
  JWT_REFRESH_TTL=604800
84
87
  AUTH_KEY_PEPPER=
85
88
 
@@ -31,3 +31,4 @@ PROMPTS.md
31
31
  /docs/
32
32
  AGENTS.md
33
33
  DEVLOG.md
34
+ PROMPTS.md
@@ -4,6 +4,41 @@ All notable changes to SwiftPY will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.2] - 2026-11-21
8
+
9
+ ### Added
10
+ - **ORM (`Model.update` & `Model.force_update`):** Added async `update()` and `force_update()` methods on `Model` instances accepting either a mapping (`await user.update({"name": "Alice"})`) or keyword attributes (`await user.update(name="Alice")`). Respects `__fillable__` / `__guarded__`, updates `updated_at`, short-circuits cleanly on unchanged attributes, fires `updating` / `updated` events, and raises `PrimaryKeyError` on unsaved instances. Existing query-builder `Model.where(...).update(...)` remains unchanged.
11
+ - **Helpers (`isset()`):** Added `isset(data, *keys)` in `swiftpy.helpers` (and re-exported from top-level `swiftpy`) to test non-`None` key, index, dot-path, and attribute existence across mappings, sequences, sets, `Request`, `FormData`, `FormRequest` (inspecting only actual form input), `ValidatedData`, `Config`, loaded `Model` fields/relations (without triggering lazy loads on unloaded relations or exposing `_`-prefixed private attributes), and generic Python objects.
12
+ - **HTTP (`Request.has_file`):** Added `request.has_file(name)` returning a dual sync/awaitable result (`if request.has_file("image"):` and `if await request.has_file("image"):`, plus direct boolean serialization in `encode_json` / `json_response`) with targeted multipart pre-loading when `Application` detects `has_file` usage on a route, while keeping non-`has_file` multipart routes lazy (`multipart_body_calls == 0`).
13
+
14
+ ### Changed
15
+ - **Auth (`JWTIssuer` / Config / Scaffolding):** Increased default `JWT_ACCESS_TTL` / `access_token_ttl` from `900` (15 minutes) to `3600` seconds (60 minutes) across `JWTIssuer`, `config/auth.py`, `.env.example`, and `swiftpy new` templates while retaining `JWT_REFRESH_TTL=604800` (7 days), and added strict positive-integer validation for `access_token_ttl` and `refresh_token_ttl`.
16
+ - **Routing (`MethodNotAllowedError`):** Updated 405 error detail wording in `Router` from `"Method '...' not allowed for path '...'"` to `"Method '...' not allowed for route '...'"` to match framework routing terminology.
17
+ - **Packaging & Scaffolding:** Bumped `swiftpy-framework` package version and `swiftpy new` dependency floor to `0.2.2`.
18
+
19
+ ### Documentation
20
+ - Added dedicated CORS guide [`documentations/2026-11-21-cors.md`](documentations/2026-11-21-cors.md) covering `CORSMiddleware` / `CORS`, `config/cors.py` and `.env` / `CORS__*` configuration, global vs. `Router`/`RouteGroup` attachment (including ordering ahead of `JWTGuard`), preflight `OPTIONS` handling, `Vary: Origin`, exact origin matching, wildcard + credentials (`G-3`) enforcement, and `TestClient` verification; cross-linked from [the HTTP routing guide](documentations/2026-11-15-http-routing-middleware-and-exceptions.md) and [README.md](README.md).
21
+ - Updated ORM, Auth, Core Helpers, HTTP Routing, Request/Response, Filesystem Upload, and Installation guides for `v0.2.2`.
22
+
23
+ ## [0.2.1] - 2026-11-20
24
+
25
+ ### Fixed
26
+ - **`CurrentUser` and `auth()` after an access token is issued (`swiftpy.auth`):** `JWTIssuer.issue_token(token_type="access")`, `issue_access_token()`, `issue_token_pair()` and `refresh_token_pair()` now bind the user into the request `Context` and `request.state`, so an already-injected `CurrentUser` and `auth().check()` / `id()` / `user()` work immediately (for example inside `/login` or `/refresh`). Refresh tokens never bind a user, and issuing a token for a different subject never replaces an already-authenticated user.
27
+ - `FrameworkServiceProvider` now registers `CurrentUser` as a scoped binding, so injecting `CurrentUser` works with `auto_discover_providers=False`.
28
+
29
+ ### Added
30
+ - `JWTIssuer` token methods accept a saved `Model`, a mapping with `id`/`sub`, or a plain id as `subject`, plus an optional `user=` keyword (`Model` or mapping). A `user=` that does not match the subject, or a model without a primary key, raises `ValueError`. Sensitive keys and `__hidden__` fields are never bound.
31
+ - Opt-in `auth.hydrate_user` (`AUTH_HYDRATE_USER`, default `false`): `require_jwt()` / `JWTGuard` load the User model by `sub` (one query per request, degrading to token claims with a warning on database errors) so sub-only tokens expose every non-hidden field.
32
+ - Opt-in `auth.passive_resolution` (`AUTH_PASSIVE_RESOLUTION`, default `false`): routes without a guard resolve a valid Bearer access token into `CurrentUser` / `auth()` when the default guard is `jwt`. Revoked, expired or invalid tokens stay guests.
33
+ - New internal module `swiftpy.auth.user_context` shared by `JWTIssuer`, `require_jwt()` and `AuthManager`; `resolve_user_model_class` is still exported from `swiftpy.auth`, `swiftpy.auth.auth_manager` and `swiftpy.auth_manager`.
34
+
35
+ ### Changed
36
+ - `require_jwt()` now returns the bound user dictionary (token claims plus model fields when hydrated) instead of the raw claims dictionary.
37
+ - Generated projects (`swiftpy new`) include `hydrate_user` / `passive_resolution` in `config/auth.py`, matching `.env` keys, and depend on `swiftpy-framework>=0.2.1`.
38
+
39
+ ### Documentation
40
+ - Updated [`documentations/2026-11-15-authentication-and-security.md`](documentations/2026-11-15-authentication-and-security.md) with issuing-time context binding, `hydrate_user`, `passive_resolution`, and the `CurrentUser.id` vs `auth().id()` typing note.
41
+
7
42
  ## [0.2.0] - 2026-11-19
8
43
 
9
44
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: swiftpy-framework
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: SwiftPY is a new generation async-first Python framework purpose built for the modern API and AI economy.
5
5
  Project-URL: Homepage, https://github.com/obrainwave/swiftpy
6
6
  Project-URL: Repository, https://github.com/obrainwave/swiftpy
@@ -89,6 +89,8 @@ All core architectural, storage, AI, and security hardening phases have been com
89
89
  | **Week 26: Security Audit & Hardening** | SQL injection audit, JWT & bcrypt API keys, JSON depth & streaming limits, traceback suppression | ✅ Completed |
90
90
  | **Week 26: Pagination & Aggregation Subsystem** | Limit/offset parameterized SQL, length-aware `paginate()`, `simple_paginate()`, `group_by()` & `having()` | ✅ Completed |
91
91
  | **Release v0.2.0: DX, Logging, Auth Refresh & Docs** | `ValidatedData` & `validate(request)`, `Request.input()` & `abort()`, `Router(prefix, middleware)`, `Blueprint.enum`/`medium_text`/`long_text`, `swiftpy.logging` (`Log`), `refresh_token_pair()` & `auth().logout()`, 17 user guides in `documentations/` | ✅ Completed |
92
+ | **Release v0.2.1: Auth Context on Token Issue** | `CurrentUser` / `auth()` available when an access token is issued, `user=` / `Model` subjects, opt-in `auth.hydrate_user` & `auth.passive_resolution` | ✅ Completed |
93
+ | **Release v0.2.2: Model `.update()`, `isset()`, `has_file()`, & Auth TTL** | `Model.update()` / `force_update()`, `JWT_ACCESS_TTL=3600`, 405 `"for route"` detail, `isset()` helper, `request.has_file()` (sync & `await`), CORS guide | ✅ Completed |
92
94
 
93
95
  *See [`documentations/2026-11-14-installation-quick-start.md`](./documentations/2026-11-14-installation-quick-start.md) for the complete step-by-step documentation series and [`CHANGELOG.md`](./CHANGELOG.md) for release notes.*
94
96
 
@@ -531,8 +533,9 @@ SwiftPY reads environment variables and YAML/Python configuration files with str
531
533
  | `DB_CONNECTION` | `database.default` | `"postgresql"` | Default database connection key (`"postgresql"`). |
532
534
  | `DB_SSL` | `database.connections.postgresql.ssl` | `"disable"` | PostgreSQL SSL mode (`"disable"`, `"require"`, `"verify-ca"`, `"verify-full"`). |
533
535
  | `DB_SSL_CA_FILE` | `database.connections.postgresql.ssl_ca_file` | `""` | Filepath to CA certificate when `DB_SSL` is `"verify-ca"` or `"verify-full"`. |
534
- | `CORS_ALLOWED_ORIGINS` | `cors.allowed_origins` | `[]` | Comma-separated list of allowed CORS origins (never pair `"*"` with `CORS_ALLOW_CREDENTIALS=true`). |
536
+ | `CORS_ALLOWED_ORIGINS` | `cors.allowed_origins` | `[]` | Comma-separated list of exact allowed CORS origins (never pair `"*"` with `CORS_ALLOW_CREDENTIALS=true`). See the [CORS Guide](./documentations/2026-11-21-cors.md). |
535
537
  | `CORS_ALLOW_CREDENTIALS` | `cors.allow_credentials` | `False` | Whether cross-origin requests may include credentials/cookies. |
538
+ | `CORS_MAX_AGE` | `cors.max_age` | `600` | Preflight `OPTIONS` cache duration (`Access-Control-Max-Age`) in seconds. |
536
539
  | `AI_ENABLED` | `ai.enabled` | `True` | Master toggle for `swiftpy.ai` requests (raises `AIModuleDisabledError` when disabled). |
537
540
  | `AI_DEFAULT_PROVIDER` | `ai.default` | `"openai"` | Default LLM provider (`"openai"` or `"anthropic"`) when not inferred from model name. |
538
541
  | `OPENAI_API_KEY` | `ai.providers.openai.api_key` | `""` | OpenAI API key for chat, streaming, and embeddings. |
@@ -59,6 +59,8 @@ All core architectural, storage, AI, and security hardening phases have been com
59
59
  | **Week 26: Security Audit & Hardening** | SQL injection audit, JWT & bcrypt API keys, JSON depth & streaming limits, traceback suppression | ✅ Completed |
60
60
  | **Week 26: Pagination & Aggregation Subsystem** | Limit/offset parameterized SQL, length-aware `paginate()`, `simple_paginate()`, `group_by()` & `having()` | ✅ Completed |
61
61
  | **Release v0.2.0: DX, Logging, Auth Refresh & Docs** | `ValidatedData` & `validate(request)`, `Request.input()` & `abort()`, `Router(prefix, middleware)`, `Blueprint.enum`/`medium_text`/`long_text`, `swiftpy.logging` (`Log`), `refresh_token_pair()` & `auth().logout()`, 17 user guides in `documentations/` | ✅ Completed |
62
+ | **Release v0.2.1: Auth Context on Token Issue** | `CurrentUser` / `auth()` available when an access token is issued, `user=` / `Model` subjects, opt-in `auth.hydrate_user` & `auth.passive_resolution` | ✅ Completed |
63
+ | **Release v0.2.2: Model `.update()`, `isset()`, `has_file()`, & Auth TTL** | `Model.update()` / `force_update()`, `JWT_ACCESS_TTL=3600`, 405 `"for route"` detail, `isset()` helper, `request.has_file()` (sync & `await`), CORS guide | ✅ Completed |
62
64
 
63
65
  *See [`documentations/2026-11-14-installation-quick-start.md`](./documentations/2026-11-14-installation-quick-start.md) for the complete step-by-step documentation series and [`CHANGELOG.md`](./CHANGELOG.md) for release notes.*
64
66
 
@@ -501,8 +503,9 @@ SwiftPY reads environment variables and YAML/Python configuration files with str
501
503
  | `DB_CONNECTION` | `database.default` | `"postgresql"` | Default database connection key (`"postgresql"`). |
502
504
  | `DB_SSL` | `database.connections.postgresql.ssl` | `"disable"` | PostgreSQL SSL mode (`"disable"`, `"require"`, `"verify-ca"`, `"verify-full"`). |
503
505
  | `DB_SSL_CA_FILE` | `database.connections.postgresql.ssl_ca_file` | `""` | Filepath to CA certificate when `DB_SSL` is `"verify-ca"` or `"verify-full"`. |
504
- | `CORS_ALLOWED_ORIGINS` | `cors.allowed_origins` | `[]` | Comma-separated list of allowed CORS origins (never pair `"*"` with `CORS_ALLOW_CREDENTIALS=true`). |
506
+ | `CORS_ALLOWED_ORIGINS` | `cors.allowed_origins` | `[]` | Comma-separated list of exact allowed CORS origins (never pair `"*"` with `CORS_ALLOW_CREDENTIALS=true`). See the [CORS Guide](./documentations/2026-11-21-cors.md). |
505
507
  | `CORS_ALLOW_CREDENTIALS` | `cors.allow_credentials` | `False` | Whether cross-origin requests may include credentials/cookies. |
508
+ | `CORS_MAX_AGE` | `cors.max_age` | `600` | Preflight `OPTIONS` cache duration (`Access-Control-Max-Age`) in seconds. |
506
509
  | `AI_ENABLED` | `ai.enabled` | `True` | Master toggle for `swiftpy.ai` requests (raises `AIModuleDisabledError` when disabled). |
507
510
  | `AI_DEFAULT_PROVIDER` | `ai.default` | `"openai"` | Default LLM provider (`"openai"` or `"anthropic"`) when not inferred from model name. |
508
511
  | `OPENAI_API_KEY` | `ai.providers.openai.api_key` | `""` | OpenAI API key for chat, streaming, and embeddings. |
@@ -2,6 +2,8 @@ from swiftpy.helpers.helper import env, env_bool
2
2
 
3
3
  CONFIG: dict[str, object] = {
4
4
  "blacklist_enabled": env_bool("AUTH_BLACKLIST_ENABLED", True),
5
+ "hydrate_user": env_bool("AUTH_HYDRATE_USER", False),
6
+ "passive_resolution": env_bool("AUTH_PASSIVE_RESOLUTION", False),
5
7
  "defaults": {
6
8
  "guard": env("AUTH_GUARD", "jwt"),
7
9
  },
@@ -13,7 +15,7 @@ CONFIG: dict[str, object] = {
13
15
  "driver": "jwt",
14
16
  "algorithm": env("JWT_ALGORITHM", "HS256"),
15
17
  "secret": env("JWT_SECRET", None),
16
- "access_token_ttl": int(env("JWT_ACCESS_TTL", "900")),
18
+ "access_token_ttl": int(env("JWT_ACCESS_TTL", "3600")),
17
19
  "refresh_token_ttl": int(env("JWT_REFRESH_TTL", "604800")),
18
20
  "issuer": env("JWT_ISSUER", None),
19
21
  "audience": env("JWT_AUDIENCE", None),
@@ -159,7 +159,7 @@ my_api/
159
159
  ├── docker-compose.yml # name: my_api; app, postgres (pgvector:pg16), & redis services
160
160
  ├── Dockerfile
161
161
  ├── main.py # Entrypoint: GET /, /api router, register_exception_handlers(app)
162
- └── pyproject.toml # Configured with swiftpy-framework>=0.2.0, setuptools, & mypy strict settings
162
+ └── pyproject.toml # Configured with swiftpy-framework>=0.2.2, setuptools, & mypy strict settings
163
163
  ```
164
164
 
165
165
  What `swiftpy new my_api` configures automatically:
@@ -313,7 +313,7 @@ The scaffolded `Dockerfile` reads `[project].dependencies` from your project's `
313
313
  name = "my_api"
314
314
  version = "0.1.0"
315
315
  dependencies = [
316
- "swiftpy-framework>=0.2.0",
316
+ "swiftpy-framework>=0.2.2",
317
317
  # ...
318
318
  ]
319
319
  ```
@@ -325,7 +325,7 @@ The scaffolded `Dockerfile` reads `[project].dependencies` from your project's `
325
325
  docker compose exec app swiftpy --version
326
326
  ```
327
327
 
328
- - If you did **not** edit `pyproject.toml` (for example, keeping `swiftpy-framework>=0.1.6` to pull a newly published `0.2.0` release from PyPI), Docker's `COPY pyproject.toml .` layer stays cached unless you force a rebuild:
328
+ - If you did **not** edit `pyproject.toml` (for example, keeping `swiftpy-framework>=0.1.6` to pull a newly published `0.2.1` release from PyPI), Docker's `COPY pyproject.toml .` layer stays cached unless you force a rebuild:
329
329
 
330
330
  ```bash
331
331
  docker compose build --no-cache app
@@ -343,7 +343,7 @@ If running without Docker, upgrade inside your activated `.venv`:
343
343
  uv sync --upgrade-package swiftpy-framework
344
344
 
345
345
  # Or with pip
346
- python -m pip install --upgrade "swiftpy-framework>=0.2.0"
346
+ python -m pip install --upgrade "swiftpy-framework>=0.2.2"
347
347
  swiftpy --version
348
348
  ```
349
349
 
@@ -79,12 +79,16 @@ swiftpy make:service AuthService
79
79
  APP_KEY=base64:<32-byte-base64-key>
80
80
  AUTH_GUARD=jwt
81
81
  AUTH_BLACKLIST_ENABLED=true
82
+ # Opt-in (default false): load the User model by `sub` on verified tokens (one query per request)
83
+ AUTH_HYDRATE_USER=false
84
+ # Opt-in (default false): resolve a valid Bearer token on routes without JWTGuard
85
+ AUTH_PASSIVE_RESOLUTION=false
82
86
  BCRYPT_ROUNDS=12
83
87
 
84
88
  # JWT (HS256 requires at least 32 UTF-8 bytes)
85
89
  JWT_ALGORITHM=HS256
86
90
  JWT_SECRET=replace-with-at-least-32-bytes-of-random-entropy
87
- JWT_ACCESS_TTL=900
91
+ JWT_ACCESS_TTL=3600
88
92
  JWT_REFRESH_TTL=604800
89
93
  # Optional strict claim validation
90
94
  # JWT_ISSUER=https://api.example.com
@@ -149,7 +153,7 @@ from swiftpy.auth import JWTIssuer
149
153
  issuer = JWTIssuer(
150
154
  secret="at-least-32-bytes-of-secret-material!",
151
155
  algorithm="HS256",
152
- access_token_ttl=900, # 15 minutes (default)
156
+ access_token_ttl=3600, # 60 minutes (default)
153
157
  refresh_token_ttl=604800, # 7 days (default)
154
158
  issuer="https://api.example.com",
155
159
  audience="web-client",
@@ -185,6 +189,9 @@ Important `JWTIssuer` rules:
185
189
 
186
190
  - **Reserved claims cannot be overridden:** Passing `sub`, `iat`, `exp`, `jti`, `type`, `token_type`, `typ`, `iss`, `aud`, or `nbf` inside `claims` raises `ValueError`.
187
191
  - **Isolated refresh claims:** `issue_token_pair()` attaches `claims` to the access token **only**; pass `refresh_claims={...}` if you explicitly want custom claims on the refresh token.
192
+ - **`CurrentUser` and `auth()` are available as soon as an access token is issued:** `issue_token()`, `issue_access_token()`, `issue_token_pair()` and `await refresh_token_pair()` bind the user into the request `Context`, so an already-injected `CurrentUser` and `auth().check()` / `auth().id()` / `auth().user()` work in the same request (for example inside `/login`). Refresh tokens never bind a user.
193
+ - **What gets bound:** pass the subject as `user.id`, a saved `Model` instance, or a mapping with an `id`/`sub` key. Pass `user=` (a `Model` or mapping) to attach more fields to a plain id. Sensitive keys (`password`, `password_hash`, `key_hash`, `secret`, `token`) and `__hidden__` model fields are never bound. A `user=` whose id does not match the subject raises `ValueError`, and a model without a primary key cannot be used as a subject.
194
+ - **Existing sessions win:** issuing a token for a *different* subject while another user is authenticated (for example an admin minting a token) leaves the authenticated user untouched.
188
195
  - **Strict algorithm enforcement:** `alg="none"` (in any case) and algorithm mismatches (`"hs256"`, HS256 token submitted to an RS256 verifier) raise `InvalidAlgorithmError`.
189
196
 
190
197
  ### 3. Complete Login Endpoint & Service Example
@@ -272,6 +279,24 @@ def admin_routes(group: RouteGroup) -> None:
272
279
  return json_response({"admin_id": user.id})
273
280
  ```
274
281
 
282
+ ```python
283
+ @router.post("/auth/login")
284
+ async def login(payload: LoginRequest, jwt: JWTIssuer, current: CurrentUser) -> Response:
285
+ user = await authenticate(payload) # your own lookup/password check
286
+ tokens = jwt.issue_token_pair(user) # or jwt.issue_token_pair(user.id, user=user)
287
+
288
+ # Available immediately, without waiting for the next request:
289
+ assert auth().check() and auth().id() == user.id
290
+ assert current.is_authenticated and current.email == user.email
291
+ return json_response(tokens)
292
+ ```
293
+
294
+ **Tokens that carry only `sub`.** `require_jwt()` / `JWTGuard` bind the verified claims. Set `AUTH_HYDRATE_USER=true` (`auth.hydrate_user`) and, when a `DatabasePool` is initialized, they also load the User model by primary key so `CurrentUser` and `auth().user()` expose every non-hidden field. This costs one query per authenticated request and is off by default; if the lookup fails the request continues with the token claims and a warning is logged. `require_jwt()` returns the bound user dictionary (token claims plus model fields) rather than the raw claims.
295
+
296
+ **Routes without `JWTGuard`.** By default only guards authenticate. Set `AUTH_PASSIVE_RESOLUTION=true` (`auth.passive_resolution`, default guard `jwt`) to let routes without a guard resolve a valid `Authorization: Bearer <access_token>` into `CurrentUser` / `auth()`. Invalid, expired or revoked tokens are ignored and the request stays a guest; use `JWTGuard` when you need a `401`.
297
+
298
+ > `CurrentUser.id` returns the raw token `sub` (a string) when no model is bound, while `auth().id()` coerces it to the User model's primary key type. Compare with `str(...)` or use `auth().id()` consistently.
299
+
275
300
  For token refresh endpoints, use `await jwt.refresh_token_pair(refresh_token)` rather than calling `issue_token_pair()` manually. It verifies the incoming token with `expected_type="refresh"`, checks `TokenBlacklist`, revokes the previous refresh token's `jti` automatically (`rotate=True` by default) so reused refresh tokens fail with `TokenRevokedError` (`401`), and issues a fresh access/refresh pair:
276
301
 
277
302
  ```python
@@ -417,6 +417,23 @@ async def run_batch_job() -> None:
417
417
 
418
418
  ---
419
419
 
420
+ ## Helper Functions (`isset`, `env`, `config`, ...)
421
+
422
+ SwiftPY exports convenience helpers from `swiftpy.helpers` and the top-level `swiftpy` package:
423
+
424
+ ```python
425
+ from swiftpy import isset
426
+
427
+ if isset(payload, "user.profile.email"):
428
+ ...
429
+
430
+ # Require multiple keys/paths at once (missing or None -> False; 0 / False / "" / [] -> True)
431
+ if isset(request, "title", "category_id"):
432
+ ...
433
+ ```
434
+
435
+ `isset(data, *keys)` works across dictionaries (including dot-notation nested lookups, preferring literal keys first), lists/tuples (integer or digit-string indices), sets, `Request`, `FormData`, `FormRequest`, `ValidatedData`, `Config`, loaded attributes/relations on `Model` instances (without triggering lazy-load errors on unloaded relations), dataclasses, and standard Python objects. If omitted keys are not passed (`isset(value)`), it returns `value is not None`.
436
+
420
437
  ## Storing Request-Local Data with `Context`
421
438
 
422
439
  Because an async ASGI server runs many requests concurrently inside the same Python process, **never** store per-request values (current tenant, correlation ID, locale) in module-level global variables or mutable class attributes.
@@ -257,7 +257,7 @@ async def upload_avatar(request: Request) -> Response:
257
257
 
258
258
  Key `UploadedFile` & `FileValidator` rules:
259
259
 
260
- - **Route parameter injection:** Besides `await request.file("avatar")` / `await request.files("attachments")`, handlers can inject uploads directly by parameter name using `avatar: UploadedFile` or `attachments: list[UploadedFile]`.
260
+ - **Route parameter & upload existence checks:** Besides `await request.file("avatar")` / `await request.files("attachments")`, handlers can inject uploads directly by parameter name using `avatar: UploadedFile` or `attachments: list[UploadedFile]`, or check whether an upload was provided via `if request.has_file("avatar"):` (or `if await request.has_file("avatar"):`).
261
261
  - **Rules mapping (`dict` required):** Supported keys are `"max_size"`, `"min_size"` (integers or units like `"500B"`, `"10KB"`, `"5MB"`, `"1GB"`), `"extensions"`, `"mimes"`, and `"magic_bytes"`. Passing a list instead of a mapping raises `TypeError`.
262
262
  - **Fail-closed magic-byte verification:** `magic_bytes=True` reads the file's leading header bytes (`32` bytes) and verifies them against signatures derived from your server policy (`extensions` / `mimes`), supporting `image/jpeg`, `image/png`, `image/gif`, `image/webp`, `application/pdf`, and `application/zip`. Unknown types without registered magic signatures fail closed rather than passing.
263
263
  - **Anti-spoofing & HTTP exceptions:** `FileValidator` checks `await file.get_real_size()` against actual spooled bytes alongside declared size. Size violations raise `FileTooLargeError` (HTTP `413`); extension, MIME, and magic-byte failures raise `InvalidFileExtensionError` / `InvalidMimeTypeError` / `FileValidationError` (HTTP `422` when handled by SwiftPY's exception handler).
@@ -154,7 +154,7 @@ SwiftPY enforces strict, predictable routing rules:
154
154
  - **Exact trailing-slash matching**: `/items` and `/items/` are distinct paths. Requesting `/items/` when only `/items` is registered returns `404 Not Found`.
155
155
  - **Duplicate detection**: Registering two routes with the same HTTP method and normalized path raises `RouteRegistrationError` at startup.
156
156
  - **Automatic `HEAD` & `OPTIONS`**: Any `GET` route automatically supports `HEAD` (returning headers with an empty body). `OPTIONS` requests on any matched path automatically return `204 No Content` with an `Allow` header listing supported methods.
157
- - **Method Not Allowed (`405`)**: Sending an unsupported HTTP method to an existing path returns `405` JSON (`{"detail": "Method '...' not allowed for path '...'. Allowed: ..."}`) along with the `Allow` header.
157
+ - **Method Not Allowed (`405`)**: Sending an unsupported HTTP method to an existing route returns `405` JSON (`{"detail": "Method '...' not allowed for route '...'. Allowed: ..."}`) along with the `Allow` header.
158
158
 
159
159
  ---
160
160
 
@@ -716,7 +716,7 @@ CORS_ALLOW_CREDENTIALS=true
716
716
  CORS_MAX_AGE=600
717
717
  ```
718
718
 
719
- `CORSMiddleware` handles preflight `OPTIONS` requests (`Access-Control-Request-Method`) with `204 No Content` and attaches `Vary: Origin` when specific origins or credentials are enabled. Never pair `"*"` in `allowed_origins` with `CORS_ALLOW_CREDENTIALS=true`.
719
+ `CORSMiddleware` handles preflight `OPTIONS` requests (`Access-Control-Request-Method`) with `204 No Content` and attaches `Vary: Origin` when specific origins or credentials are enabled. Never pair `"*"` in `allowed_origins` with `CORS_ALLOW_CREDENTIALS=true`. See the dedicated [CORS Configuration & Middleware](2026-11-21-cors.md) guide for full preflight, credential, header exposure, and SPA integration details.
720
720
 
721
721
  ---
722
722
 
@@ -250,6 +250,8 @@ await draft.delete()
250
250
  Dirty-tracking safeguards:
251
251
 
252
252
  - If an existing persisted model has **no dirty non-PK attributes**, calling `await model.save()` performs **0 SQL queries** and emits no `updated` event.
253
+
254
+ - **Direct instance updates (`update()` & `force_update()`):** On a persisted model instance, call `await model.update({"name": "New Name"})` or `await model.update(name="New Name")` to apply attributes via `.fill()`, respect `__fillable__` / `__guarded__` rules, update `updated_at`, run dirty checks (0 SQL queries if nothing changed), emit `updating` / `updated` events, and persist via `.save()` (returning `self`). For trusted internal writes bypassing mass-assignment rules, use `await model.force_update(...)`. Calling `update()` or `force_update()` on an unsaved model raises `PrimaryKeyError`.
253
255
  - If the model defines `updated_at`, saving a dirty existing record refreshes `updated_at` to `datetime.now(UTC)` automatically.
254
256
  - If you load a partial subset of columns with `.select("id", "title")`, SwiftPY records only the selected columns in its original snapshot. Calling `await post.save()` after modifying `post.title` updates only `title` and never clobbers unselected database columns.
255
257
 
@@ -66,6 +66,7 @@ Request bodies arrive over the ASGI `receive` channel and are cached on the `Req
66
66
  - **`await request.json() -> Any`:** Parses UTF-8 JSON (empty body returns `{}`) and validates JSON nesting depth (`max_json_depth`). Malformed JSON or exceeded depth raises `HttpException(status_code=400)`.
67
67
  - **`await request.form() -> FormData`:** Parses `application/x-www-form-urlencoded` and streaming `multipart/form-data` submissions (`fields_list` / `files_list`).
68
68
  - **`await request.file(name) -> UploadedFile | None`:** Retrieves the first uploaded file for `name`.
69
+ - **`request.has_file(name)`:** Checks whether a non-empty uploaded file with a filename was submitted for field `name`. Inside `Application` routes (with `auto_load_request_input=True`), you can call either `if request.has_file("image"):` synchronously or `if await request.has_file("image"):` asynchronously (`empty` browser file inputs with `filename=""`, text fields, and JSON payloads return `False`).
69
70
  - **`await request.files(name=None) -> list[UploadedFile] | dict[str, list[UploadedFile]]`:** Retrieves all uploaded files for `name`, or the full mapping of uploaded files when `name` is `None`.
70
71
 
71
72
  Call `await request.close()` only when working outside the ASGI pipeline; `Application` automatically closes parsed `FormData` temporary files in a `finally` block at the end of every HTTP request.
@@ -88,7 +89,7 @@ When your route handler declares a `Request` parameter, `Application` automatica
88
89
  3. `Transfer-Encoding` is **not** `chunked`.
89
90
  4. `Content-Type` media type is `application/json`, `*+json` (such as `application/problem+json`), or `application/x-www-form-urlencoded`.
90
91
 
91
- `multipart/form-data` uploads, arbitrary binary payloads, and chunked streams are **never** auto-read before your handler runs—your handler keeps full control over streaming multipart parsing and file size validation. Furthermore, if an auto-preloaded request body is not valid JSON (for example, a raw webhook payload sent with an `application/json` header), preload buffers the raw bytes (still enforcing `max_body_size` / `413`) and defers any `400 Invalid JSON payload` error until your handler explicitly calls `await request.json()` or `await request.input()`—so handlers that only inspect `await request.body()` continue to run normally.
92
+ `multipart/form-data` uploads are automatically preloaded **only when** `has_request_param` and `auto_load_request_input=True` and the handler calls `request.has_file(...)`; otherwise `multipart/form-data`, arbitrary binary payloads, and chunked streams are **never** auto-read before your handler runs—your handler keeps full control over streaming multipart parsing and file size validation. Furthermore, if an auto-preloaded request body is not valid JSON (for example, a raw webhook payload sent with an `application/json` header), preload buffers the raw bytes (still enforcing `max_body_size` / `413`) and defers any `400 Invalid JSON payload` error until your handler explicitly calls `await request.json()` or `await request.input()`—so handlers that only inspect `await request.body()` continue to run normally.
92
93
 
93
94
  ```python
94
95
  from swiftpy import Request, Response, json_response, validate
@@ -0,0 +1,273 @@
1
+ # Cross-Origin Resource Sharing (CORS)
2
+
3
+ ## Introduction
4
+
5
+ Browser single-page applications (React, Vue, Next.js) and third-party web clients hosted on a different scheme, hostname, or port from your SwiftPY backend cannot read API responses or send authenticated requests unless your server returns valid **Cross-Origin Resource Sharing (CORS)** headers.
6
+
7
+ SwiftPY handles HTTP CORS through **`CORSMiddleware`** (also exported as **`CORS`**) backed by **`config/cors.py`** and `.env` environment variables. By design, CORS in SwiftPY is both **opt-in** (disabled unless you attach the middleware) and **fail-closed** (`allowed_origins` defaults to `[]`, emitting zero cross-origin headers until you explicitly allow trusted origins).
8
+
9
+ Quick imports:
10
+
11
+ ```python
12
+ from swiftpy import CORS, CORSMiddleware
13
+ # Equivalent module imports:
14
+ from swiftpy.http.middleware import CORS, CORSMiddleware
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Creating & Organizing Files
20
+
21
+ Every project scaffolded with `swiftpy new` includes **`config/cors.py`** and matching variables in **`.env` / `.env.example`**:
22
+
23
+ ```python
24
+ # config/cors.py (generated by `swiftpy new`)
25
+ from __future__ import annotations
26
+
27
+ from swiftpy.helpers.helper import env, env_bool
28
+
29
+ CONFIG = {
30
+ "allowed_origins": [
31
+ origin.strip()
32
+ for origin in str(env("CORS_ALLOWED_ORIGINS", "") or "").split(",")
33
+ if origin.strip()
34
+ ],
35
+ "allowed_methods": ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"],
36
+ "allowed_headers": ["Content-Type", "Authorization", "X-Request-ID"],
37
+ "expose_headers": ["X-Request-ID"],
38
+ "allow_credentials": env_bool("CORS_ALLOW_CREDENTIALS", False),
39
+ "max_age": int(env("CORS_MAX_AGE", "600") or "600"),
40
+ }
41
+ ```
42
+
43
+ > [!NOTE]
44
+ > **`config/cors.py` vs. `CORSMiddleware` internal defaults:**
45
+ > A newly scaffolded `swiftpy new` project configures `allowed_methods`, `allowed_headers`, and `expose_headers` cleanly for typical SPA APIs (`["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"]`, `["Content-Type", "Authorization", "X-Request-ID"]`, and `["X-Request-ID"]`). This framework repository's starter [`config/cors.py`](../config/cors.py) uses `["GET", "HEAD", "POST"]`, `["Authorization", "Content-Type", "X-Requested-With"]`, and `[]`. If you pass a partial `config={"cors": {...}}` dictionary directly without those keys, `CORSMiddleware` defaults `allowed_origins` to `[]`, `allowed_methods` to `["GET", "HEAD", "POST"]`, `allowed_headers` to `[]`, `expose_headers` to `[]`, `allow_credentials` to `False`, and `max_age` to `600`.
46
+
47
+ ### Environment Variables (`.env`)
48
+
49
+ For common deployments, configure CORS purely via environment variables without editing Python config files:
50
+
51
+ ```dotenv
52
+ # Comma-separated exact origins (scheme + host + optional port, no trailing slash)
53
+ CORS_ALLOWED_ORIGINS=https://app.example.com,http://localhost:3000
54
+ CORS_ALLOW_CREDENTIALS=true
55
+ CORS_MAX_AGE=600
56
+ ```
57
+
58
+ You can also override individual keys using SwiftPY's nested environment syntax (`CORS__*` or `SWIFTPY_CORS__*`), including comma-separated lists or JSON arrays:
59
+
60
+ ```dotenv
61
+ CORS__ALLOWED_ORIGINS=["https://app.example.com", "https://admin.example.com"]
62
+ CORS__ALLOWED_METHODS=GET, POST, PUT, PATCH, DELETE, OPTIONS
63
+ CORS__ALLOWED_HEADERS=Authorization, Content-Type, X-Request-ID
64
+ CORS__EXPOSE_HEADERS=X-Request-ID
65
+ CORS__ALLOW_CREDENTIALS=true
66
+ CORS__MAX_AGE=3600
67
+ ```
68
+
69
+ | Config Path | Env Key(s) | Accepted Input Formats | Behavior |
70
+ |---|---|---|---|
71
+ | `cors.allowed_origins` | `CORS_ALLOWED_ORIGINS`, `CORS__ALLOWED_ORIGINS` | `list[str]`, CSV `str`, JSON array `str`, or `None` | Exact origin whitelist (`[]` denies all; `["*"]` allows any origin when `allow_credentials=False`). |
72
+ | `cors.allowed_methods` | `CORS__ALLOWED_METHODS` | `list[str]`, CSV `str`, JSON array `str`, or `None` | Sent in preflight `Access-Control-Allow-Methods`. Falls back to `["GET", "HEAD", "POST"]` if unset or empty. |
73
+ | `cors.allowed_headers` | `CORS__ALLOWED_HEADERS` | `list[str]`, CSV `str`, JSON array `str`, or `None` | Sent in preflight `Access-Control-Allow-Headers` when non-empty; `"*"` echoes incoming `Access-Control-Request-Headers`. |
74
+ | `cors.expose_headers` | `CORS__EXPOSE_HEADERS` | `list[str]`, CSV `str`, JSON array `str`, or `None` | Sent in actual responses via `Access-Control-Expose-Headers` when non-empty. |
75
+ | `cors.allow_credentials` | `CORS_ALLOW_CREDENTIALS`, `CORS__ALLOW_CREDENTIALS` | `bool` or `"true"`/`"1"`/`"yes"`/`"on"` (`env_bool`) | Emits `Access-Control-Allow-Credentials: true` on allowed preflight and actual responses. |
76
+ | `cors.max_age` | `CORS_MAX_AGE`, `CORS__MAX_AGE` | `int` (or `None` to default `600`) | Preflight cache TTL in seconds via `Access-Control-Max-Age`. |
77
+
78
+ ---
79
+
80
+ ## Enabling `CORSMiddleware`
81
+
82
+ `CORSMiddleware` accepts `config: Config` cleanly via SwiftPY's DI container—pass the class directly to SwiftPY's middleware hooks without instantiating it manually.
83
+
84
+ ### 1. Global Application Middleware (Recommended for Web APIs & SPAs)
85
+
86
+ Attach `CORSMiddleware` globally in `main.py` using `app.middleware([...])` (or pass `middleware=[CORSMiddleware]` to `Application(...)`):
87
+
88
+ ```python
89
+ # main.py
90
+ from __future__ import annotations
91
+
92
+ from swiftpy import Application, CORS, RequestId, SecurityHeaders
93
+ from routes.api import router as api_router
94
+
95
+ app = Application(title="SwiftPY API")
96
+
97
+ # Run CORS on every HTTP request, including preflight OPTIONS, 404, 422, and 500 error responses
98
+ app.middleware([RequestId, SecurityHeaders, CORS])
99
+
100
+ app.include_router(api_router, prefix="/api")
101
+ ```
102
+
103
+ Global registration wraps SwiftPY's entire HTTP dispatcher (`_dispatch_http`), so even `404 Not Found`, `405 Method Not Allowed`, `422 ValidationException`, and `500` error responses receive valid `Access-Control-Allow-Origin` headers for allowed origins.
104
+
105
+ ### 2. Scoped to a `Router`, `RouteGroup`, or Single Route
106
+
107
+ When only a subset of endpoints (such as `/api` routes, excluding `/admin` or internal endpoints) should allow cross-origin browser requests, attach `CORSMiddleware` to a `Router`, `app.include_router(...)`, `@app.group(...)`, or an individual `Router` decorator:
108
+
109
+ ```python
110
+ from swiftpy import Application, CORSMiddleware, JWTGuard, RouteGroup
111
+ from swiftpy.http.router import Router
112
+
113
+ app = Application()
114
+
115
+ # Option A: Constructor-configured Router (keep CORSMiddleware BEFORE auth middleware!)
116
+ api_router = Router(prefix="/v1", middleware=[CORSMiddleware, JWTGuard])
117
+
118
+
119
+ @api_router.get("/profile")
120
+ async def profile() -> dict[str, str]:
121
+ return {"status": "ok"}
122
+
123
+
124
+ app.include_router(api_router, prefix="/api")
125
+
126
+
127
+ # Option B: Application route group
128
+ @app.group("/public-api", middleware=[CORSMiddleware])
129
+ def public_routes(group: RouteGroup) -> None:
130
+ @group.get("/catalog")
131
+ async def catalog() -> list[dict[str, str]]:
132
+ return [{"sku": "SP-01", "name": "Starter Kit"}]
133
+
134
+
135
+ # Option C: Single route on a Router (Note: `@app.get` does not accept `middleware=`)
136
+ partner_router = Router()
137
+
138
+
139
+ @partner_router.get("/widget-config", middleware=[CORSMiddleware])
140
+ async def widget_config() -> dict[str, str]:
141
+ return {"theme": "light"}
142
+
143
+
144
+ app.include_router(partner_router, prefix="/partners")
145
+ ```
146
+
147
+ > [!WARNING]
148
+ > **Always place `CORSMiddleware` before `JWTGuard` or `AuthMiddleware`.**
149
+ > Browsers never send `Authorization` headers or session cookies on `OPTIONS` preflight requests. If `JWTGuard` runs before `CORSMiddleware` (`middleware=[JWTGuard, CORSMiddleware]`), `JWTGuard` intercepts the preflight and returns `401 Unauthorized` before `CORSMiddleware` can respond with `204` + `Access-Control-Allow-*` headers. Placing `CORSMiddleware` globally (`app.middleware([CORSMiddleware])`) or first in the group (`middleware=[CORSMiddleware, JWTGuard]`) ensures preflights short-circuit with `204` and authenticated `401` responses still carry `Access-Control-Allow-Origin` for allowed callers.
150
+
151
+ Scoped CORS works on matching paths even during preflight because SwiftPY's `Router` automatically synthesizes an `OPTIONS` route carrying every matched route's middleware (`GET`, `POST`, etc.) for that path, returning `204 No Content` through `CORSMiddleware`. Unmatched URLs (`404 Not Found`) do not enter group middleware—use global `app.middleware([CORSMiddleware])` if browsers must read `404` payloads across origins.
152
+
153
+ ---
154
+
155
+ ## Step-by-Step Request & Preflight Behavior
156
+
157
+ Understanding exactly what `CORSMiddleware` emits helps diagnose browser console errors quickly:
158
+
159
+ ### 1. Requests Without an `Origin` Header
160
+
161
+ Same-origin server requests, `curl`, backend HTTP clients, and server-to-server jobs normally omit `Origin`. `CORSMiddleware` passes those requests straight to `next_handler(request)` untouched without adding CORS headers.
162
+
163
+ ### 2. Preflight `OPTIONS` Requests
164
+
165
+ SwiftPY identifies a browser CORS preflight when **both** conditions hold:
166
+ - `request.method.upper() == "OPTIONS"`
167
+ - `"access-control-request-method" in request.headers`
168
+
169
+ Behavior:
170
+ - **Origin disallowed (including default `allowed_origins = []`):** Returns `204 No Content` with an empty body and **no** `Access-Control-*` headers. Browsers block the subsequent request.
171
+ - **Origin allowed:** Returns `204 No Content` with:
172
+ - `Access-Control-Allow-Origin`: `"*"` if `"*"` is configured (with `allow_credentials=False`), otherwise echoes the exact `Origin` and sets `Vary: Origin`.
173
+ - `Access-Control-Allow-Methods`: comma-joined `allowed_methods`.
174
+ - `Access-Control-Allow-Headers`: omitted if `allowed_headers` is empty; echoes `Access-Control-Request-Headers` if `allowed_headers` contains `"*"`; otherwise comma-joined `allowed_headers`.
175
+ - `Access-Control-Allow-Credentials: true`: included only when `allow_credentials=True`.
176
+ - `Access-Control-Max-Age`: `str(max_age)` (defaults to `"600"`).
177
+
178
+ ### 3. Actual Cross-Origin Requests (`GET`, `POST`, `PUT`, `DELETE`, etc.)
179
+
180
+ When an `Origin` header is present on a non-preflight request:
181
+ 1. SwiftPY executes `response = await next_handler(request)`.
182
+ 2. If the origin is not allowed, `response` returns without any `Access-Control-*` headers.
183
+ 3. If the origin is allowed:
184
+ - Emits `Access-Control-Allow-Origin` (`"*"` or the matched `origin`).
185
+ - For non-wildcard origin responses, sets or appends `Origin` to `Vary` cleanly (`Vary: Origin`, or `Vary: Accept-Encoding, Origin` when `Vary` already exists) so shared proxies and CDNs do not cache one origin's headers for another origin.
186
+ - Emits `Access-Control-Allow-Credentials: true` when enabled.
187
+ - Emits `Access-Control-Expose-Headers` when `expose_headers` is non-empty (so JavaScript `fetch()` / `axios` can read custom headers like `X-Request-ID`).
188
+ 4. If response transmission fails before HTTP headers start during `StreamingResponse` error handling, `Application` preserves `Vary` and any `Access-Control-*` headers on the fallback `500` response.
189
+
190
+ ---
191
+
192
+ ## Testing CORS with `TestClient`
193
+
194
+ Verify your CORS rules—allowed origins, denied origins, preflight headers, credentials, and `422` validation errors—directly in `pytest` using [`TestClient`](2026-11-19-cli-and-testing.md):
195
+
196
+ ```python
197
+ from __future__ import annotations
198
+
199
+ import pytest
200
+
201
+ from swiftpy import Application, CORSMiddleware, Response, json_response
202
+ from swiftpy.testing import TestClient
203
+
204
+
205
+ @pytest.mark.asyncio
206
+ async def test_api_cors_preflight_and_actual_request() -> None:
207
+ app = Application(
208
+ auto_discover_providers=False,
209
+ config={
210
+ "cors": {
211
+ "allowed_origins": ["https://app.example.com"],
212
+ "allowed_methods": ["GET", "POST", "OPTIONS"],
213
+ "allowed_headers": ["Authorization", "Content-Type"],
214
+ "expose_headers": ["X-Request-ID"],
215
+ "allow_credentials": True,
216
+ "max_age": 3600,
217
+ }
218
+ },
219
+ )
220
+ app.middleware([CORSMiddleware])
221
+
222
+ @app.get("/api/items")
223
+ async def list_items() -> Response:
224
+ return json_response({"items": []}, headers={"X-Request-ID": "req-1"})
225
+
226
+ async with TestClient(app) as client:
227
+ # 1. Allowed preflight OPTIONS request
228
+ preflight = await client.options(
229
+ "/api/items",
230
+ headers={
231
+ "Origin": "https://app.example.com",
232
+ "Access-Control-Request-Method": "POST",
233
+ },
234
+ )
235
+ preflight.assert_no_content()
236
+ preflight.assert_header("Access-Control-Allow-Origin", "https://app.example.com")
237
+ preflight.assert_header("Access-Control-Allow-Credentials", "true")
238
+ preflight.assert_header("Access-Control-Max-Age", "3600")
239
+ preflight.assert_header("Vary", "Origin")
240
+
241
+ # 2. Allowed actual GET request
242
+ res = await client.get(
243
+ "/api/items",
244
+ headers={"Origin": "https://app.example.com"},
245
+ )
246
+ res.assert_ok()
247
+ res.assert_header("Access-Control-Allow-Origin", "https://app.example.com")
248
+ res.assert_header("Access-Control-Expose-Headers", "X-Request-ID")
249
+
250
+ # 3. Disallowed origin stays fail-closed (no Access-Control-Allow-Origin)
251
+ blocked = await client.get(
252
+ "/api/items",
253
+ headers={"Origin": "https://evil.example.com"},
254
+ )
255
+ blocked.assert_ok()
256
+ assert "access-control-allow-origin" not in blocked.headers
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Important Defaults & Security Safeguards
262
+
263
+ - **Exact origin matching (no wildcard subdomain globs):** `CORSMiddleware` checks exact equality (`origin in allowed_origins`, or `"*" in allowed_origins`). A pattern like `"https://*.example.com"` is treated as a literal string and will **not** match `https://sub.example.com`, and origins must omit trailing slashes (use `https://app.example.com`, not `https://app.example.com/`). List each trusted origin explicitly, or build the list dynamically in `config/cors.py`.
264
+ - **Wildcard `*` + `allow_credentials=True` fails closed (`Gate G-3`):** Combining `"*"` in `allowed_origins` with `allow_credentials=True` violates the Fetch/CORS specification and is rejected immediately with `ConfigurationError` at middleware construction and re-validated on every request if `app.config["cors"]` is mutated at runtime. Always list explicit origins when cookies or credentialed requests are enabled.
265
+ - **CSV & JSON env safety (`CORE-2` / `INF-3`):** Passing a raw string (`"https://a.com, https://b.com"`) in programmatic `config={"cors": {"allowed_origins": "..."}}` splits cleanly on commas or parses JSON arrays instead of iterating characters, and `"false"` / `"0"` booleans coerce strictly to `False`. Malformed JSON array syntax raises `ConfigurationError`.
266
+ - **`allowed_headers` must list custom request headers:** If your frontend sends headers beyond CORS-safelisted headers—such as `Authorization`, `X-API-Key`, or `X-CSRF-Token`—include them in `allowed_headers` (or set `["*"]` if credentials are not used and you intentionally reflect requested headers).
267
+ - **WebSockets use a separate origin setting (`Decision D-14`):** `CORSMiddleware` applies to HTTP requests only. WebSocket handshakes validate `Origin` against `Application(allowed_origins=...)` / `websockets.allowed_origins` (defaulting to strict same-origin checking against `Host`). See [WebSockets & Admin Dashboard](2026-11-15-websockets-and-admin.md) for details.
268
+
269
+ ---
270
+
271
+ ## Next Step
272
+
273
+ Continue to [Requests & Responses](2026-11-20-request-and-responses.md) for `Request` input/header inspection and `ResponseHeaders`, or review [WebSockets & Admin Dashboard](2026-11-15-websockets-and-admin.md) for cross-origin WebSocket handshake validation (`D-14`).
@@ -10,7 +10,7 @@ dev = [
10
10
 
11
11
  [project]
12
12
  name = "swiftpy-framework"
13
- version = "0.2.0"
13
+ version = "0.2.2"
14
14
  description = "SwiftPY is a new generation async-first Python framework purpose built for the modern API and AI economy."
15
15
  requires-python = ">=3.12"
16
16
  dependencies = [