@shaferllc/keel 0.82.0 → 0.83.0

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 (118) hide show
  1. package/dist/db/d1-http.d.ts +34 -0
  2. package/dist/db/d1-http.js +61 -0
  3. package/dist/db/libsql.d.ts +13 -3
  4. package/dist/teams/models.js +51 -5
  5. package/docs/ai-manifest.json +22 -1
  6. package/docs/database.md +5 -522
  7. package/docs/models.md +5 -2
  8. package/docs/orm.md +57 -0
  9. package/docs/query-builder.md +533 -0
  10. package/docs/starter-kits.md +88 -0
  11. package/llms-full.txt +5299 -5115
  12. package/llms.txt +3 -0
  13. package/package.json +7 -2
  14. package/templates/api/.env.example +12 -0
  15. package/templates/api/app/Controllers/PostController.ts +37 -0
  16. package/templates/api/app/Http/Kernel.ts +13 -0
  17. package/templates/api/app/Http/Middleware/requestLogger.ts +8 -0
  18. package/templates/api/app/Models/Post.ts +12 -0
  19. package/templates/api/app/Providers/AppServiceProvider.ts +8 -0
  20. package/templates/api/app/Providers/DatabaseServiceProvider.ts +52 -0
  21. package/templates/api/bin/keel.ts +15 -0
  22. package/templates/api/bootstrap/app.ts +24 -0
  23. package/templates/api/bootstrap/providers.edge.ts +14 -0
  24. package/templates/api/bootstrap/providers.ts +7 -0
  25. package/templates/api/config/app.ts +10 -0
  26. package/templates/api/config/database.ts +42 -0
  27. package/templates/api/database/migrations/0001_create_posts.ts +20 -0
  28. package/templates/api/package.json +30 -0
  29. package/templates/api/routes/web.ts +12 -0
  30. package/templates/api/tests/posts.test.ts +30 -0
  31. package/templates/api/tsconfig.json +16 -0
  32. package/templates/api/worker.ts +33 -0
  33. package/templates/api/wrangler.jsonc +22 -0
  34. package/templates/app/.env.example +12 -0
  35. package/templates/app/app/Controllers/AuthController.ts +117 -0
  36. package/templates/app/app/Controllers/DashboardController.ts +37 -0
  37. package/templates/app/app/Controllers/HomeController.ts +10 -0
  38. package/templates/app/app/Http/Kernel.ts +21 -0
  39. package/templates/app/app/Http/Middleware/requestLogger.ts +8 -0
  40. package/templates/app/app/Models/User.ts +15 -0
  41. package/templates/app/app/Providers/AppServiceProvider.ts +12 -0
  42. package/templates/app/app/Providers/DatabaseServiceProvider.ts +52 -0
  43. package/templates/app/bin/keel.ts +15 -0
  44. package/templates/app/bootstrap/app.ts +24 -0
  45. package/templates/app/bootstrap/providers.edge.ts +15 -0
  46. package/templates/app/bootstrap/providers.ts +18 -0
  47. package/templates/app/config/app.ts +10 -0
  48. package/templates/app/config/database.ts +42 -0
  49. package/templates/app/database/migrations/0001_create_users.ts +21 -0
  50. package/templates/app/package.json +35 -0
  51. package/templates/app/public/.gitkeep +2 -0
  52. package/templates/app/resources/css/app.css +1 -0
  53. package/templates/app/resources/views/auth/forgot.tsx +30 -0
  54. package/templates/app/resources/views/auth/login.tsx +24 -0
  55. package/templates/app/resources/views/auth/register.tsx +24 -0
  56. package/templates/app/resources/views/auth/two-factor.tsx +22 -0
  57. package/templates/app/resources/views/dashboard.tsx +20 -0
  58. package/templates/app/resources/views/layout.tsx +15 -0
  59. package/templates/app/resources/views/welcome.tsx +29 -0
  60. package/templates/app/routes/web.ts +35 -0
  61. package/templates/app/tests/auth.test.ts +47 -0
  62. package/templates/app/tsconfig.json +31 -0
  63. package/templates/app/worker.ts +33 -0
  64. package/templates/app/wrangler.jsonc +25 -0
  65. package/templates/minimal/.env.example +8 -0
  66. package/templates/minimal/app/Controllers/HomeController.ts +14 -0
  67. package/templates/minimal/app/Http/Kernel.ts +22 -0
  68. package/templates/minimal/app/Http/Middleware/requestLogger.ts +8 -0
  69. package/templates/minimal/app/Providers/AppServiceProvider.ts +8 -0
  70. package/templates/minimal/bin/keel.ts +15 -0
  71. package/templates/minimal/bootstrap/app.ts +24 -0
  72. package/templates/minimal/bootstrap/providers.ts +6 -0
  73. package/templates/minimal/config/app.ts +10 -0
  74. package/templates/minimal/package.json +29 -0
  75. package/templates/minimal/public/.gitkeep +2 -0
  76. package/templates/minimal/resources/css/app.css +1 -0
  77. package/templates/minimal/resources/views/layout.tsx +15 -0
  78. package/templates/minimal/resources/views/welcome.tsx +15 -0
  79. package/templates/minimal/routes/web.ts +13 -0
  80. package/templates/minimal/tsconfig.json +18 -0
  81. package/templates/minimal/worker.ts +23 -0
  82. package/templates/minimal/wrangler.jsonc +10 -0
  83. package/templates/saas/.env.example +12 -0
  84. package/templates/saas/app/Controllers/AuthController.ts +125 -0
  85. package/templates/saas/app/Controllers/DashboardController.ts +37 -0
  86. package/templates/saas/app/Controllers/HomeController.ts +10 -0
  87. package/templates/saas/app/Controllers/TeamController.ts +88 -0
  88. package/templates/saas/app/Http/Kernel.ts +27 -0
  89. package/templates/saas/app/Http/Middleware/requestLogger.ts +8 -0
  90. package/templates/saas/app/Models/Project.ts +20 -0
  91. package/templates/saas/app/Models/User.ts +15 -0
  92. package/templates/saas/app/Providers/AppServiceProvider.ts +12 -0
  93. package/templates/saas/app/Providers/DatabaseServiceProvider.ts +52 -0
  94. package/templates/saas/bin/keel.ts +15 -0
  95. package/templates/saas/bootstrap/app.ts +24 -0
  96. package/templates/saas/bootstrap/providers.edge.ts +18 -0
  97. package/templates/saas/bootstrap/providers.ts +22 -0
  98. package/templates/saas/config/app.ts +10 -0
  99. package/templates/saas/config/database.ts +42 -0
  100. package/templates/saas/database/migrations/0001_create_users.ts +21 -0
  101. package/templates/saas/database/migrations/0002_create_projects.ts +20 -0
  102. package/templates/saas/package.json +35 -0
  103. package/templates/saas/public/.gitkeep +2 -0
  104. package/templates/saas/resources/css/app.css +1 -0
  105. package/templates/saas/resources/views/auth/forgot.tsx +30 -0
  106. package/templates/saas/resources/views/auth/login.tsx +24 -0
  107. package/templates/saas/resources/views/auth/register.tsx +24 -0
  108. package/templates/saas/resources/views/auth/two-factor.tsx +22 -0
  109. package/templates/saas/resources/views/dashboard.tsx +20 -0
  110. package/templates/saas/resources/views/layout.tsx +15 -0
  111. package/templates/saas/resources/views/teams/index.tsx +85 -0
  112. package/templates/saas/resources/views/welcome.tsx +29 -0
  113. package/templates/saas/routes/web.ts +44 -0
  114. package/templates/saas/tests/auth.test.ts +47 -0
  115. package/templates/saas/tests/teams.test.ts +27 -0
  116. package/templates/saas/tsconfig.json +31 -0
  117. package/templates/saas/worker.ts +33 -0
  118. package/templates/saas/wrangler.jsonc +25 -0
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": [
7
+ "ES2022"
8
+ ],
9
+ "types": [
10
+ "node"
11
+ ],
12
+ "strict": true,
13
+ "noUncheckedIndexedAccess": true,
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "resolveJsonModule": true,
17
+ "noEmit": true,
18
+ "jsx": "react-jsx",
19
+ "jsxImportSource": "hono/jsx"
20
+ },
21
+ "include": [
22
+ "app",
23
+ "bootstrap",
24
+ "config",
25
+ "routes",
26
+ "database",
27
+ "resources",
28
+ "bin",
29
+ "tests"
30
+ ]
31
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The Cloudflare Workers entry. `wrangler dev` / `wrangler deploy` use this.
3
+ *
4
+ * D1's binding only exists inside a request, so the connection is wired here, before
5
+ * the app boots — and the app is built once, then reused.
6
+ *
7
+ * Note the provider list: `edgeProviders`, not the Node one. See providers.edge.ts.
8
+ */
9
+
10
+ import { setConnection, HttpKernel } from "@shaferllc/keel/core";
11
+ import { d1Connection, type D1Like } from "@shaferllc/keel/db/d1";
12
+
13
+ import { createApplication } from "./bootstrap/app.js";
14
+ import { edgeProviders } from "./bootstrap/providers.edge.js";
15
+
16
+ interface Env {
17
+ DB: D1Like;
18
+ }
19
+
20
+ let handler: { fetch: (request: Request, env: unknown) => Response | Promise<Response> } | undefined;
21
+
22
+ export default {
23
+ async fetch(request: Request, env: Env): Promise<Response> {
24
+ if (!handler) {
25
+ setConnection(d1Connection(env.DB), "sqlite");
26
+
27
+ const app = await createApplication(edgeProviders);
28
+ handler = app.make(HttpKernel).build();
29
+ }
30
+
31
+ return handler.fetch(request, env);
32
+ },
33
+ };
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "node_modules/wrangler/config-schema.json",
3
+ "name": "__APP_NAME__",
4
+ "main": "worker.ts",
5
+ "compatibility_date": "2025-01-01",
6
+ // AsyncLocalStorage — Keel carries the request, the open transaction, and the
7
+ // current team in it. Without this flag they have nowhere to live.
8
+ "compatibility_flags": ["nodejs_compat"],
9
+
10
+ // The compiled stylesheet. Cloudflare serves these; the Worker never sees them.
11
+ "assets": { "directory": "./public" },
12
+
13
+ "d1_databases": [
14
+ {
15
+ "binding": "DB",
16
+ "database_name": "__APP_NAME__",
17
+ // Create one: wrangler d1 create __APP_NAME__ — then paste the id here.
18
+ "database_id": ""
19
+ }
20
+ ],
21
+
22
+ "vars": {
23
+ "DB_CONNECTION": "d1"
24
+ }
25
+ }