tina4-python 3.13.148__tar.gz → 3.13.150__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 (201) hide show
  1. {tina4_python-3.13.148 → tina4_python-3.13.150}/PKG-INFO +1 -1
  2. {tina4_python-3.13.148 → tina4_python-3.13.150}/pyproject.toml +1 -1
  3. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/__init__.py +1 -1
  4. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/cli/__init__.py +218 -67
  5. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/server.py +15 -2
  6. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/crud/__init__.py +75 -31
  7. tina4_python-3.13.150/tina4_python/crud/page.py +344 -0
  8. tina4_python-3.13.150/tina4_python/crud/page_render.py +257 -0
  9. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/dev_admin/__init__.py +214 -120
  10. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/dev_admin/plan.py +1 -1
  11. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/messenger/__init__.py +47 -2
  12. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/migration/runner.py +142 -7
  13. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/bundled-component-provenance.json +2 -2
  14. tina4_python-3.13.150/tina4_python/public/js/tina4-dev-admin-split.html +202 -0
  15. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/js/tina4-dev-admin.min.js +147 -138
  16. tina4_python-3.13.150/tina4_python/templates/crud/form.twig +26 -0
  17. tina4_python-3.13.150/tina4_python/templates/crud/modals.twig +31 -0
  18. tina4_python-3.13.150/tina4_python/templates/crud/page.twig +401 -0
  19. tina4_python-3.13.150/tina4_python/templates/crud/table.twig +69 -0
  20. {tina4_python-3.13.148 → tina4_python-3.13.150}/.gitignore +0 -0
  21. {tina4_python-3.13.148 → tina4_python-3.13.150}/COMMERCIAL-LICENSE.md +0 -0
  22. {tina4_python-3.13.148 → tina4_python-3.13.150}/LICENSE +0 -0
  23. {tina4_python-3.13.148 → tina4_python-3.13.150}/NOTICE +0 -0
  24. {tina4_python-3.13.148 → tina4_python-3.13.150}/README.md +0 -0
  25. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/.tina4-metrics.json +0 -0
  26. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/CLAUDE.md +0 -0
  27. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/HtmlElement.py +0 -0
  28. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/Testing.py +0 -0
  29. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/_import_helper.py +0 -0
  30. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/ai/__init__.py +0 -0
  31. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/ai/client.py +0 -0
  32. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/api/__init__.py +0 -0
  33. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/auth/__init__.py +0 -0
  34. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/cache/__init__.py +0 -0
  35. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/container/__init__.py +0 -0
  36. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/context/__init__.py +0 -0
  37. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/context/chunker.py +0 -0
  38. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/__init__.py +0 -0
  39. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/cache.py +0 -0
  40. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/constants.py +0 -0
  41. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/csp.py +0 -0
  42. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/events.py +0 -0
  43. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/middleware.py +0 -0
  44. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/port_takeover.py +0 -0
  45. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/rate_limiter.py +0 -0
  46. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/request.py +0 -0
  47. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/response.py +0 -0
  48. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/core/router.py +0 -0
  49. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/__init__.py +0 -0
  50. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/adapter.py +0 -0
  51. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/async_api.py +0 -0
  52. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/connection.py +0 -0
  53. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/database_url.py +0 -0
  54. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/firebird.py +0 -0
  55. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/mongodb.py +0 -0
  56. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/mssql.py +0 -0
  57. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/mysql.py +0 -0
  58. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/odbc.py +0 -0
  59. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/pool.py +0 -0
  60. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/postgres.py +0 -0
  61. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/sql_translator.py +0 -0
  62. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/database/sqlite.py +0 -0
  63. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/debug/__init__.py +0 -0
  64. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/debug/error_overlay.py +0 -0
  65. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/dev_admin/metrics.py +0 -0
  66. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/dev_admin/project_index.py +0 -0
  67. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/docs.py +0 -0
  68. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/docstore/__init__.py +0 -0
  69. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/dotenv/__init__.py +0 -0
  70. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/env.py +0 -0
  71. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/frond/FROND.md +0 -0
  72. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/frond/__init__.py +0 -0
  73. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/frond/compiler.py +0 -0
  74. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/frond/engine.py +0 -0
  75. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/frond/parser.py +0 -0
  76. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/auth/meta.json +0 -0
  77. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/auth/src/routes/api/gallery_auth.py +0 -0
  78. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/database/meta.json +0 -0
  79. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/database/src/routes/api/gallery_db.py +0 -0
  80. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/error-overlay/meta.json +0 -0
  81. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/error-overlay/src/routes/api/gallery_crash.py +0 -0
  82. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/orm/meta.json +0 -0
  83. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/orm/src/orm/Product.py +0 -0
  84. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/orm/src/routes/api/gallery_products.py +0 -0
  85. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/queue/meta.json +0 -0
  86. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/queue/src/routes/api/gallery_queue.py +0 -0
  87. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/rest-api/meta.json +0 -0
  88. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/rest-api/src/routes/api/gallery_hello.py +0 -0
  89. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/templates/meta.json +0 -0
  90. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/templates/src/routes/gallery_page.py +0 -0
  91. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/gallery/templates/src/templates/gallery_page.twig +0 -0
  92. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graph/__init__.py +0 -0
  93. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graph/adapter.py +0 -0
  94. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graph/adapters/__init__.py +0 -0
  95. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graph/adapters/arango.py +0 -0
  96. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graph/adapters/bolt.py +0 -0
  97. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graph/adapters/ultipa.py +0 -0
  98. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graph/graph_url.py +0 -0
  99. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/graphql/__init__.py +0 -0
  100. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/i18n/__init__.py +0 -0
  101. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/mcp/__init__.py +0 -0
  102. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/mcp/protocol.py +0 -0
  103. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/mcp/tools.py +0 -0
  104. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/migration/__init__.py +0 -0
  105. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/mqtt/__init__.py +0 -0
  106. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/mqtt/message.py +0 -0
  107. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/orm/__init__.py +0 -0
  108. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/orm/async_api.py +0 -0
  109. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/orm/collection.py +0 -0
  110. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/orm/fields.py +0 -0
  111. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/orm/model.py +0 -0
  112. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/orm/point.py +0 -0
  113. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/THIRD-PARTY-NOTICES.md +0 -0
  114. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/__feedback/widget.js +0 -0
  115. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/css/tina4.css +0 -0
  116. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/css/tina4.min.css +0 -0
  117. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/favicon.ico +0 -0
  118. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/images/logo.svg +0 -0
  119. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/images/tina4-logo-icon.webp +0 -0
  120. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/js/frond.js +0 -0
  121. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/js/frond.min.js +0 -0
  122. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/js/tina4.min.js +0 -0
  123. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/js/tina4js.min.js +0 -0
  124. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/licenses/swagger-ui-3.10.0-original-notice.txt +0 -0
  125. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/licenses/swagger-ui-5.17.14-NOTICE.txt +0 -0
  126. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/licenses/swagger-ui-Apache-2.0.txt +0 -0
  127. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/licenses/tina4-css-MIT.txt +0 -0
  128. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/licenses/tina4-dev-admin-components.json +0 -0
  129. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/licenses/tina4-dev-admin-third-party.txt +0 -0
  130. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/licenses/tina4-js-MIT.txt +0 -0
  131. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/swagger/index.html +0 -0
  132. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
  133. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/push/__init__.py +0 -0
  134. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/push/_base.py +0 -0
  135. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/push/_cryptography.py +0 -0
  136. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/push/_libcrypto.py +0 -0
  137. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/query_builder/__init__.py +0 -0
  138. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/__init__.py +0 -0
  139. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/amqp_url.py +0 -0
  140. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/job.py +0 -0
  141. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/kafka_backend.py +0 -0
  142. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/lite_backend.py +0 -0
  143. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/mongo_backend.py +0 -0
  144. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/rabbitmq_backend.py +0 -0
  145. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue/topic_dead_letter.py +0 -0
  146. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue_backends/__init__.py +0 -0
  147. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue_backends/kafka_backend.py +0 -0
  148. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue_backends/mongo_backend.py +0 -0
  149. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/queue_backends/rabbitmq_backend.py +0 -0
  150. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/__init__.py +0 -0
  151. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/models/Attachment.py +0 -0
  152. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/models/Channel.py +0 -0
  153. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/models/ChannelMember.py +0 -0
  154. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/models/Message.py +0 -0
  155. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/models/Workspace.py +0 -0
  156. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/models/__init__.py +0 -0
  157. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/realtime/storage.py +0 -0
  158. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/seeder/__init__.py +0 -0
  159. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/service/__init__.py +0 -0
  160. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/session/__init__.py +0 -0
  161. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/session_handlers/__init__.py +0 -0
  162. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/session_handlers/memcached_handler.py +0 -0
  163. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/session_handlers/mongodb_handler.py +0 -0
  164. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/session_handlers/redis_handler.py +0 -0
  165. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/session_handlers/valkey_handler.py +0 -0
  166. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/sso.py +0 -0
  167. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/ssrf.py +0 -0
  168. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/swagger/__init__.py +0 -0
  169. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/components/crud.twig +0 -0
  170. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/docker/distroless/Dockerfile +0 -0
  171. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/docker/poetry/Dockerfile +0 -0
  172. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/docker/python/Dockerfile +0 -0
  173. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/docker/uv/Dockerfile +0 -0
  174. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/302.twig +0 -0
  175. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/401.twig +0 -0
  176. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/403.twig +0 -0
  177. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/404.twig +0 -0
  178. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/500.twig +0 -0
  179. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/502.twig +0 -0
  180. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/503.twig +0 -0
  181. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/errors/base.twig +0 -0
  182. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/frontend/README.md +0 -0
  183. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/templates/readme.md +0 -0
  184. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/test/__init__.py +0 -0
  185. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/test_client/__init__.py +0 -0
  186. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/af/LC_MESSAGES/messages.mo +0 -0
  187. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/af/LC_MESSAGES/messages.po +0 -0
  188. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
  189. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
  190. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/es/LC_MESSAGES/messages.mo +0 -0
  191. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/es/LC_MESSAGES/messages.po +0 -0
  192. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
  193. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
  194. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/ja/LC_MESSAGES/messages.mo +0 -0
  195. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/ja/LC_MESSAGES/messages.po +0 -0
  196. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/zh/LC_MESSAGES/messages.mo +0 -0
  197. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/translations/zh/LC_MESSAGES/messages.po +0 -0
  198. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/validator/__init__.py +0 -0
  199. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/websocket/__init__.py +0 -0
  200. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/websocket/backplane.py +0 -0
  201. {tina4_python-3.13.148 → tina4_python-3.13.150}/tina4_python/wsdl/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tina4-python
3
- Version: 3.13.148
3
+ Version: 3.13.150
4
4
  Summary: Tina4 Python v3 — Zero-dependency, lightweight web framework
5
5
  Author-email: Andre van Zuydam <andrevanzuydam@gmail.com>
6
6
  License-Expression: MPL-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tina4-python"
3
- version = "3.13.148"
3
+ version = "3.13.150"
4
4
  description = "Tina4 Python v3 — Zero-dependency, lightweight web framework"
5
5
  authors = [
6
6
  {name = "Andre van Zuydam", email = "andrevanzuydam@gmail.com"}
@@ -57,7 +57,7 @@ def _resolve_version() -> str:
57
57
  #
58
58
  # test_version_constant.py now asserts this literal equals the pyproject
59
59
  # version, so the release bump cannot leave it behind again.
60
- return "3.13.148"
60
+ return "3.13.150"
61
61
 
62
62
 
63
63
  __version__ = _resolve_version()
@@ -1652,8 +1652,8 @@ def _generate(args):
1652
1652
 
1653
1653
  what = args[0].lower()
1654
1654
 
1655
- # Auth doesn't require a name argument
1656
- no_name_generators = {"auth"}
1655
+ # These generators take no name argument.
1656
+ no_name_generators = {"auth", "base"}
1657
1657
  if what not in no_name_generators and len(args) < 2:
1658
1658
  print(f"Usage: tina4python generate {what} <name> [options]")
1659
1659
  sys.exit(1)
@@ -1964,84 +1964,112 @@ async def delete_{singular}(request, response):
1964
1964
 
1965
1965
 
1966
1966
  def _gen_crud(name: str, flags: dict):
1967
- """Generate full CRUD stack: model + migration + routes + template + test.
1967
+ """ADR-0094: scaffold an AutoCrud-backed admin PAGE rendered by Crud.to_crud.
1968
1968
 
1969
1969
  tina4python generate crud Product --fields "name:string,price:float"
1970
+
1971
+ The route file is named by the model's TABLE, registers the AutoCrud REST
1972
+ backend (secure-by-default; --public opens writes), and renders to_crud — no
1973
+ hand-written list/detail/write routes. The overridable crud/*.twig templates
1974
+ are copied into the app (unless --no-templates) so the developer owns an
1975
+ editable copy straight away.
1970
1976
  """
1971
- fields = _fields_or_default(flags.get("fields", ""))
1977
+ # The table name (singular, e.g. "product"; reserved words pluralised, e.g.
1978
+ # "orders") is the canonical path: the model declares table_name "<table>",
1979
+ # AutoCrud serves /api/<table>, and the page route + gate test key off it.
1972
1980
  table = _resolve_table(name, flags)
1973
- # Routes are the SINGLE plural of the singular base — pluralise(snake(name)) —
1974
- # never `table + "s"`. When the table was pluralised to escape a SQL reserved
1975
- # word (Order -> table `orders`), `table + "s"` double-pluralised the route,
1976
- # file and template to `orderss`. Deriving from the singular base keeps one
1977
- # consistent rule: Order -> orders, Product -> products.
1978
- route_name = _pluralize_table(_to_snake(name))
1981
+ is_public = bool(flags.get("public"))
1979
1982
 
1980
1983
  print(f"\n Generating CRUD for {name}...\n")
1981
1984
 
1982
- # 1. Model + migration (emit_test=False — crud emits its own broader test
1983
- # at step 6, so the sub-generators stay quiet to avoid double-emission).
1985
+ # 1. Model + migration (emit_test=False — crud emits its own broader gate
1986
+ # test at step 4, so the sub-generators stay quiet to avoid double-emit).
1984
1987
  _gen_model(name, flags, emit_test=False)
1985
1988
 
1986
- # 2. Routes with model — secure-by-default; thread --public through so
1987
- # `generate crud X --public` opens the writes (mirrors AutoCrud public=).
1988
- is_public = bool(flags.get("public"))
1989
- route_flags = {"model": name, "public": is_public}
1990
- _gen_route(route_name, route_flags, emit_test=False)
1991
-
1992
- # 3. Template
1993
- template_dir = Path("src/templates/pages")
1994
- template_dir.mkdir(parents=True, exist_ok=True)
1995
- template_path = template_dir / f"{route_name}.twig"
1996
- if not template_path.exists():
1997
- # Build column headers from fields
1998
- cols = [f for f, _ in fields]
1999
- th = "\n ".join(f"<th>{c.replace('_', ' ').title()}</th>" for c in cols)
2000
- td = "\n ".join(f"<td>{{{{ item.{c} }}}}</td>" for c in cols)
2001
-
2002
- template_path.write_text(
2003
- '{% extends "base.twig" %}\n'
2004
- f'{{% block title %}}{name}s{{% endblock %}}\n'
2005
- '{% block content %}\n'
2006
- '<div class="container mt-4">\n'
2007
- f' <h1>{name}s</h1>\n'
2008
- ' {# tina4:edit restrict fields exposed to the API here #}\n'
2009
- ' <table class="table">\n'
2010
- ' <thead>\n'
2011
- ' <tr>\n'
2012
- ' <th>ID</th>\n'
2013
- f' {th}\n'
2014
- ' <th>Actions</th>\n'
2015
- ' </tr>\n'
2016
- ' </thead>\n'
2017
- ' <tbody>\n'
2018
- ' {% for item in items %}\n'
2019
- ' <tr>\n'
2020
- ' <td>{{ item.id }}</td>\n'
2021
- f' {td}\n'
2022
- ' <td><a href="/api/' + route_name + '/{{ item.id }}">View</a></td>\n'
2023
- ' </tr>\n'
2024
- ' {% endfor %}\n'
2025
- ' </tbody>\n'
2026
- ' </table>\n'
2027
- '</div>\n'
2028
- '{% endblock %}\n',
2029
- encoding="utf-8",
2030
- )
2031
- print(f" ✓ Created {template_path}")
2032
-
2033
- # 4. Form
2034
- _gen_form(name, flags)
1989
+ # 2. Admin page route: registers AutoCrud (secure-by-default; --public opens
1990
+ # writes) and renders the to_crud admin UI at /admin/<table>.
1991
+ _gen_crud_admin_route(name, table, is_public)
2035
1992
 
2036
- # 5. View (list + detail)
2037
- _gen_view(name, flags)
1993
+ # 3. Copy the overridable crud/*.twig templates into the app (unless
1994
+ # --no-templates) so the developer can edit them in place.
1995
+ if "no-templates" not in flags:
1996
+ _copy_crud_templates()
2038
1997
 
2039
- # 6. Test — secure-by-default gate test (behavioural, real TestClient).
2040
- _gen_test(route_name, {"model": name, "secure_writes": True, "public": is_public})
1998
+ # 4. Test — secure-by-default gate test (behavioural, real TestClient),
1999
+ # keyed off the table so it imports the page route + hits /api/<table>.
2000
+ _gen_test(table, {"model": name, "secure_writes": True, "public": is_public})
2041
2001
 
2042
2002
  print(f"\n CRUD generation complete for {name}.")
2043
2003
  print(f" Run: tina4python migrate")
2044
- print(f" Visit: /swagger to see the API docs")
2004
+ print(f" Visit: /admin/{table} for the admin UI, or /swagger for the API docs")
2005
+
2006
+
2007
+ def _gen_crud_admin_route(model: str, table: str, is_public: bool):
2008
+ """Write the admin page route src/routes/<table>.py. It wires the AutoCrud
2009
+ REST backend for the model and renders the to_crud admin page — ADR-0094:
2010
+ to_crud owns no routes of its own, so the backend is AutoCrud and only the
2011
+ GET page lives here. Secure by default; ``is_public`` opens the writes."""
2012
+ target = Path("src/routes")
2013
+ target.mkdir(parents=True, exist_ok=True)
2014
+ path = target / f"{table}.py"
2015
+ if path.exists():
2016
+ print(f" ✗ File already exists: {path}")
2017
+ return
2018
+
2019
+ if is_public:
2020
+ router_import = "from tina4_python.core.router import get\n"
2021
+ decorator = f'@get("/admin/{table}")'
2022
+ posture_doc = "--public: the admin page and the writes are OPEN (no token)."
2023
+ page_note = ""
2024
+ else:
2025
+ router_import = "from tina4_python.core.router import get, secured\n"
2026
+ decorator = f'@secured()\n@get("/admin/{table}")'
2027
+ posture_doc = ("Secure by default: the admin page AND the writes require a valid Bearer "
2028
+ "token (pass --public to open them).")
2029
+ page_note = (
2030
+ f"\n# NOTE: the admin page is secured (@secured). A browser needs a valid token/session\n"
2031
+ f"# to open it; wire your login (Auth / Session) or run `generate crud {model} --public`\n"
2032
+ f"# for an open page. The AutoCrud READ API (GET /api/{table}, GET /api/{table}/{{id}})\n"
2033
+ f"# stays public by AutoCrud's default."
2034
+ )
2035
+
2036
+ content = (
2037
+ router_import
2038
+ + "from tina4_python.crud import AutoCrud, Crud\n"
2039
+ + f"from src.orm.{model} import {model}\n\n\n"
2040
+ + f"# {model} admin — one server-rendered CRUD page (searchable, sortable,\n"
2041
+ + f"# paginated table + create/edit/delete modals). The REST backend (GET\n"
2042
+ + f"# list, GET/{{id}}, POST, PUT, DELETE) is AutoCrud; this file owns only\n"
2043
+ + f"# the GET admin page. {posture_doc}{page_note}\n"
2044
+ + f"#\n"
2045
+ + f"# Restyle the UI by editing src/templates/crud/*.twig (copied into this app).\n"
2046
+ + f"AutoCrud.register({model}, public={is_public})\n\n\n"
2047
+ + f"{decorator}\n"
2048
+ + f"async def {table}_admin(request, response):\n"
2049
+ + f' return response(Crud.to_crud(request, model={model}, title="{model} Admin"))\n'
2050
+ )
2051
+ path.write_text(content, encoding="utf-8")
2052
+ print(f" ✓ Created {path}")
2053
+
2054
+
2055
+ def _copy_crud_templates():
2056
+ """Copy the framework's overridable crud/*.twig templates into the app's
2057
+ src/templates/crud/ so the developer can edit them in place (an app copy
2058
+ wins over the framework's via the app-first resolution). Existing files are
2059
+ left untouched."""
2060
+ import shutil
2061
+ import tina4_python
2062
+
2063
+ source_dir = Path(tina4_python.__file__).resolve().parent / "templates" / "crud"
2064
+ target_dir = Path("src/templates/crud")
2065
+ target_dir.mkdir(parents=True, exist_ok=True)
2066
+ for src in sorted(source_dir.glob("*.twig")):
2067
+ dest = target_dir / src.name
2068
+ if dest.exists():
2069
+ print(f" ✗ File already exists: {dest}")
2070
+ else:
2071
+ shutil.copyfile(src, dest)
2072
+ print(f" ✓ Created {dest}")
2045
2073
 
2046
2074
 
2047
2075
  def _gen_migration(name: str, flags: dict = None, *,
@@ -3324,6 +3352,127 @@ def _gen_form(name: str, flags: dict = None):
3324
3352
  print(f" ✓ Created {path}")
3325
3353
 
3326
3354
 
3355
+ _BASE_TWIG = '''<!DOCTYPE html>
3356
+ <html lang="en">
3357
+ <head>
3358
+ <meta charset="UTF-8">
3359
+ <title>{% block title %}{{ APP_NAME }}{% endblock %}</title>
3360
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
3361
+ <link rel="stylesheet" href="/css/tina4.min.css">
3362
+ <link rel="stylesheet" href="/css/default.css">
3363
+ {% block stylesheets %}{% endblock %}
3364
+ </head>
3365
+ <body>
3366
+ {% block nav %}{% include "partials/nav.twig" ignore missing %}{% endblock %}
3367
+ <main>{% block content %}{% endblock %}</main>
3368
+ {% block javascripts %}
3369
+ <script src="/js/tina4.min.js"></script>
3370
+ <script src="/js/frond.min.js"></script>
3371
+ {% endblock %}
3372
+ </body>
3373
+ </html>
3374
+ '''
3375
+
3376
+
3377
+ def _ensure_base_template():
3378
+ """Create src/templates/base.twig and the src/templates/pages/ folder if
3379
+ missing. Returns the paths created (empty when everything already existed).
3380
+ Shared by `generate base` and `generate page` so a page can be scaffolded
3381
+ into a fresh project and still inherit from a real base."""
3382
+ created = []
3383
+ templates = Path("src/templates")
3384
+ templates.mkdir(parents=True, exist_ok=True)
3385
+ (templates / "pages").mkdir(parents=True, exist_ok=True)
3386
+ base = templates / "base.twig"
3387
+ if not base.exists():
3388
+ base.write_text(_BASE_TWIG, encoding="utf-8")
3389
+ created.append(str(base))
3390
+ return created
3391
+
3392
+
3393
+ def _page_twig(title: str) -> str:
3394
+ """A Frond page template that extends base.twig (Twig braces kept literal)."""
3395
+ return (
3396
+ '{% extends "base.twig" %}\n'
3397
+ '{% block title %}' + title + '{% endblock %}\n'
3398
+ '{% block content %}\n'
3399
+ '<div class="container mt-4">\n'
3400
+ ' <h1>' + title + '</h1>\n'
3401
+ ' {# tina4:edit page content goes here #}\n'
3402
+ '</div>\n'
3403
+ '{% endblock %}\n'
3404
+ )
3405
+
3406
+
3407
+ def _page_route(url_path: str, template_name: str, fn_name: str, title: str) -> str:
3408
+ """A route that renders a page template through the @template decorator."""
3409
+ return (
3410
+ "from tina4_python.core.router import get, template\n\n\n"
3411
+ '@get("' + url_path + '")\n'
3412
+ '@template("' + template_name + '")\n'
3413
+ "async def " + fn_name + "(request, response):\n"
3414
+ ' return {"title": "' + title + '"}\n'
3415
+ )
3416
+
3417
+
3418
+ def _gen_base(name: str = None, flags: dict = None):
3419
+ """Scaffold a Frond base template + an index page that extends it.
3420
+
3421
+ tina4python generate base
3422
+
3423
+ Creates src/templates/base.twig (if missing), the src/templates/pages/
3424
+ folder, src/templates/pages/index.twig (extends base), and the `/` route
3425
+ that renders it. Subsequent `generate page <name>` pages inherit from base.
3426
+ """
3427
+ created = _ensure_base_template()
3428
+ index_tpl = Path("src/templates/pages/index.twig")
3429
+ if not index_tpl.exists():
3430
+ index_tpl.write_text(_page_twig("Home"), encoding="utf-8")
3431
+ created.append(str(index_tpl))
3432
+ routes = Path("src/routes")
3433
+ routes.mkdir(parents=True, exist_ok=True)
3434
+ index_route = routes / "index.py"
3435
+ if not index_route.exists():
3436
+ index_route.write_text(_page_route("/", "pages/index.twig", "index_page", "Home"), encoding="utf-8")
3437
+ created.append(str(index_route))
3438
+ if created:
3439
+ for p in created:
3440
+ print(f" ✓ Created {p}")
3441
+ else:
3442
+ print(" ✓ base template + index page already present")
3443
+
3444
+
3445
+ def _gen_page(name: str, flags: dict = None):
3446
+ """Scaffold a page that inherits from the Frond base template.
3447
+
3448
+ tina4python generate page about
3449
+
3450
+ Creates src/templates/pages/<name>.twig (extends base.twig) and a route that
3451
+ renders it. Auto-creates the pages/ folder and bootstraps base.twig when they
3452
+ do not exist yet, so a page always inherits from a real base.
3453
+ """
3454
+ slug = _to_snake(name or "").strip("/")
3455
+ if not slug:
3456
+ print(" ✗ page needs a name (e.g. generate page about)")
3457
+ return
3458
+ title = slug.replace("_", " ").title()
3459
+ created = _ensure_base_template()
3460
+ tpl = Path("src/templates/pages") / f"{slug}.twig"
3461
+ if tpl.exists():
3462
+ print(f" ✗ File already exists: {tpl}")
3463
+ return
3464
+ tpl.write_text(_page_twig(title), encoding="utf-8")
3465
+ created.append(str(tpl))
3466
+ routes = Path("src/routes")
3467
+ routes.mkdir(parents=True, exist_ok=True)
3468
+ route = routes / f"{slug}.py"
3469
+ if not route.exists():
3470
+ route.write_text(_page_route(f"/{slug}", f"pages/{slug}.twig", f"{slug}_page", title), encoding="utf-8")
3471
+ created.append(str(route))
3472
+ for p in created:
3473
+ print(f" ✓ Created {p}")
3474
+
3475
+
3327
3476
  def _gen_view(name: str, flags: dict = None):
3328
3477
  """Generate list + detail view templates.
3329
3478
 
@@ -3884,7 +4033,9 @@ def _commands(args=None):
3884
4033
  GENERATORS = {
3885
4034
  "model": {"handler": _gen_model, "usage": '<Name> [--fields "name:string,price:float"] [--table-name <name>]', "summary": "ORM model + matching migration"},
3886
4035
  "route": {"handler": _gen_route, "usage": "<name> [--model Name] [--public]", "summary": "CRUD route file, secure by default (--public opens writes)"},
3887
- "crud": {"handler": _gen_crud, "usage": '<Name> [--fields "..."] [--public]', "summary": "Model + migration + routes + form + view + test"},
4036
+ "base": {"handler": _gen_base, "usage": "", "summary": "Frond base template + index page + pages/ folder"},
4037
+ "page": {"handler": _gen_page, "usage": "<name>", "summary": "Page that extends base.twig (auto-creates pages/ + base)"},
4038
+ "crud": {"handler": _gen_crud, "usage": '<Name> [--fields "..."] [--public] [--no-templates]', "summary": "Model + migration + AutoCrud-backed admin page (to_crud) + editable crud/ templates + gate test"},
3888
4039
  "migration": {"handler": _gen_migration, "usage": "<description>", "summary": "Timestamped migration file (UP/DOWN)"},
3889
4040
  "middleware": {"handler": _gen_middleware, "usage": "<Name>", "summary": "Middleware with before/after hooks"},
3890
4041
  "test": {"handler": _gen_test, "usage": "<name> [--model Name]", "summary": "pytest test file"},
@@ -1654,7 +1654,7 @@ def _handle_rate_limit(request: Request, response: Response) -> Response | None:
1654
1654
 
1655
1655
  async def _handle_dev_admin(request: Request, response: Response) -> Response:
1656
1656
  """Serve the /__dev dashboard and API routes."""
1657
- from tina4_python.dev_admin import get_api_handlers, _dev_request_denial
1657
+ from tina4_python.dev_admin import get_api_handlers, _dev_request_denial, split_view_html
1658
1658
  # ADR-0082: ONE gate for every /__dev request, reads and writes alike -
1659
1659
  # Host allow-list (DNS rebinding), same-origin (CSRF and cross-site reads)
1660
1660
  # and loopback peer. Scoped to /__dev so the deliberately cross-origin
@@ -1665,7 +1665,15 @@ async def _handle_dev_admin(request: Request, response: Response) -> Response:
1665
1665
  response.status(_denial[0]).json({"ok": False, "error": _denial[1]})
1666
1666
  _cors.apply(request, response)
1667
1667
  return response
1668
- if request.path in ("/__dev/", "/__dev", "/__dev/v2", "/__dev/v2/"):
1668
+ if request.path in ("/__dev/split", "/__dev/split/"):
1669
+ # Detached split view: dashboard/editor LEFT, live app preview RIGHT.
1670
+ # A plain page (no toolbar, no reload) hosting two iframes that each
1671
+ # keep their own reload behaviour - so the editor stays put while the
1672
+ # preview updates on a change.
1673
+ response.html(split_view_html())
1674
+ response.header("cache-control", "no-store, must-revalidate")
1675
+ response.header("pragma", "no-cache")
1676
+ elif request.path in ("/__dev/", "/__dev", "/__dev/v2", "/__dev/v2/"):
1669
1677
  # Unified SPA dev admin. The bundle derives its WS URL from
1670
1678
  # `location.host` directly, so no environment shim is needed —
1671
1679
  # the framework serves /__dev_reload on its own port and the
@@ -2725,6 +2733,11 @@ def _stage_dev_toolbar_inject(ctx: DispatchContext) -> None:
2725
2733
  return None
2726
2734
  if ctx.request.path.startswith("/__dev"):
2727
2735
  return None
2736
+ # Do not inject the toolbar for a viewer the /__dev gate would refuse (#279):
2737
+ # otherwise the page carries toolbar markup whose stylesheet and script 403.
2738
+ from tina4_python.dev_admin import dev_toolbar_allowed
2739
+ if not dev_toolbar_allowed(ctx.request):
2740
+ return None
2728
2741
 
2729
2742
  try:
2730
2743
  from tina4_python.dev_admin import render_dev_toolbar
@@ -80,6 +80,59 @@ def _allow_listed_data(model_class, data, *, is_create: bool) -> dict:
80
80
  return allowed
81
81
 
82
82
 
83
+ def _parse_list_pagination(query) -> tuple[int, int, int]:
84
+ """Resolve (limit, offset, page) from the list query string.
85
+
86
+ Primary names are limit/offset; page/per_page are the PHP/Ruby/Node compat
87
+ spelling. Pagination is a QUERY-STRING concern, not a route param
88
+ (REQ-PARAM-POLLUTION, 3.13.99). PAGE-DEC-01: page < 1 clamps to 1 BEFORE the
89
+ offset is derived (so offset can never go negative), and per_page/limit are
90
+ capped at MAX_PER_PAGE BEFORE the same derivation so offset lines up with the
91
+ size actually used. Any bad value falls back to limit 10 / offset 0 / page 1.
92
+ """
93
+ try:
94
+ limit = int(query.get("limit", query.get("per_page", 10)))
95
+ offset = int(query.get("offset", 0))
96
+ if "page" in query and "offset" not in query:
97
+ page = max(1, int(query.get("page", 1)))
98
+ per_page = min(int(query.get("per_page", limit)), MAX_PER_PAGE)
99
+ offset = (page - 1) * per_page
100
+ limit = per_page
101
+ else:
102
+ limit = min(limit, MAX_PER_PAGE)
103
+ page = (offset // limit) + 1 if limit else 1
104
+ except (ValueError, TypeError):
105
+ return 10, 0, 1
106
+ return limit, offset, page
107
+
108
+
109
+ def _resolve_list_order_by(model_class, query):
110
+ """ADR-0069 safe ORDER BY from ?sort (&sort_dir=asc|desc): the sort column
111
+ must resolve to a DECLARED field (else it is ignored and None is returned)."""
112
+ sort_param = str(query.get("sort", "") or "").strip()
113
+ if not sort_param:
114
+ return None
115
+ sort_dir = "DESC" if str(query.get("sort_dir", "")).lower() == "desc" else "ASC"
116
+ sort_name = model_class._declared_field_for(sort_param)
117
+ if sort_name is None:
118
+ return None
119
+ return f"{model_class.get_db_column(sort_name)} {sort_dir}"
120
+
121
+
122
+ def _build_list_search(model_class, query) -> tuple:
123
+ """ADR-0094 ?search=term filter: a LIKE %term% OR'd across the model's own
124
+ declared string/text columns. Returns (where_clause_or_None, params)."""
125
+ search_term = str(query.get("search", "") or "").strip()
126
+ if not search_term:
127
+ return None, []
128
+ search_cols = [model_class.get_db_column(name)
129
+ for name, field in model_class._fields.items() if field.field_type is str]
130
+ if not search_cols:
131
+ return None, []
132
+ where_clause = "(" + " OR ".join(f"{col} LIKE ?" for col in search_cols) + ")"
133
+ return where_clause, [f"%{search_term}%" for _ in search_cols]
134
+
135
+
83
136
  class AutoCrud:
84
137
  """Auto-generate REST endpoints from ORM model classes."""
85
138
 
@@ -143,37 +196,20 @@ class AutoCrud:
143
196
 
144
197
  # ── GET /api/{table} — list with pagination ──────────────
145
198
  async def list_handler(request, response, _cls=model_class):
146
- try:
147
- # Primary names: limit / offset
148
- # Compat names: per_page / page (PHP/Ruby/Node style)
149
- # Pagination is a QUERY-STRING concern, not a route param
150
- # (REQ-PARAM-POLLUTION, 3.13.99 — request.params is route-only).
151
- limit = int(request.query.get("limit", request.query.get("per_page", 10)))
152
- offset = int(request.query.get("offset", 0))
153
- # page/per_page compat: if page is provided, derive offset from it
154
- if "page" in request.query and "offset" not in request.query:
155
- page = int(request.query.get("page", 1))
156
- per_page = int(request.query.get("per_page", limit))
157
- # PAGE-DEC-01: clamp page < 1 -> page 1 BEFORE deriving offset,
158
- # so offset=(page-1)*per_page can never go negative (a page=0/
159
- # negative request used to hand PostgreSQL a negative OFFSET -
160
- # a driver error - and silently misbehave on SQLite, while the
161
- # envelope reported page:0). Cap per_page BEFORE the same
162
- # derivation so the offset lines up with the size actually used.
163
- page = max(1, page)
164
- per_page = min(per_page, MAX_PER_PAGE)
165
- offset = (page - 1) * per_page
166
- limit = per_page
167
- else:
168
- limit = min(limit, MAX_PER_PAGE) # PAGE-DEC-01: cap an oversized ?limit=
169
- page = (offset // limit) + 1 if limit else 1
170
- except (ValueError, TypeError):
171
- limit = 10
172
- offset = 0
173
- page = 1
174
-
175
- records = _cls.all(limit=limit, offset=offset)
176
- total = _cls.count()
199
+ # Pagination, the ADR-0069-safe sort, and the ADR-0094 ?search filter
200
+ # are each resolved by a dedicated module helper so this handler stays
201
+ # a thin orchestrator. The search filter is applied BEFORE limit/offset
202
+ # so the envelope's total reflects the filtered set.
203
+ limit, offset, page = _parse_list_pagination(request.query)
204
+ order_by = _resolve_list_order_by(_cls, request.query)
205
+ where_clause, where_params = _build_list_search(_cls, request.query)
206
+
207
+ if where_clause:
208
+ records = _cls.where(where_clause, where_params, limit=limit, offset=offset, order_by=order_by)
209
+ total = _cls.count(where_clause, where_params)
210
+ else:
211
+ records = _cls.all(limit=limit, offset=offset, order_by=order_by)
212
+ total = _cls.count()
177
213
  total_pages = max(1, -(-total // limit)) if limit else 1
178
214
  record_dicts = [record.to_dict() for record in records]
179
215
  # The canonical ADR-0043 envelope: EXACTLY seven snake_case keys, no
@@ -444,3 +480,11 @@ class AutoCrud:
444
480
  def clear():
445
481
  """Clear all registered models (useful for testing)."""
446
482
  AutoCrud._registered.clear()
483
+
484
+
485
+ # ADR-0094: the frontend-over-AutoCrud admin page generator. Imported last so
486
+ # that tina4_python.crud.Crud resolves AutoCrud (defined above) without a
487
+ # circular import.
488
+ from tina4_python.crud.page import Crud # noqa: E402
489
+
490
+ __all__ = ["AutoCrud", "Crud"]