@tatara/cli 0.9.2 → 0.11.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 (100) hide show
  1. package/dist/bin.mjs +1436 -319
  2. package/package.json +1 -1
  3. package/templates/features/admin/files/src/apps/admin/app.ts +1 -1
  4. package/templates/features/admin/files/src/modules/example/routes/admin-greeting.routes.ts +2 -2
  5. package/templates/features/admin/files/src/modules/example/tests/admin.test.ts +11 -4
  6. package/templates/features/admin/files/src/modules/staff/db/seed.ts +27 -0
  7. package/templates/features/admin/files/src/modules/staff/services/auth.ts +46 -0
  8. package/templates/features/admin/files/tests/helpers/staff.ts +8 -0
  9. package/templates/features/admin/files+drizzle+mysql/src/modules/staff/db/staff.schema.ts +58 -0
  10. package/templates/features/admin/files+drizzle+mysql/src/modules/staff/services/adapter.ts +13 -0
  11. package/templates/features/admin/files+drizzle+postgres/src/modules/staff/db/staff.schema.ts +57 -0
  12. package/templates/features/admin/files+drizzle+postgres/src/modules/staff/services/adapter.ts +13 -0
  13. package/templates/features/admin/files+prisma/prisma/models/staff.prisma +61 -0
  14. package/templates/features/admin/files+prisma+mysql/src/modules/staff/services/adapter.ts +5 -0
  15. package/templates/features/admin/files+prisma+postgres/src/modules/staff/services/adapter.ts +5 -0
  16. package/templates/features/auth-keycloak/files/keycloak/realm.json +70 -9
  17. package/templates/features/auth-keycloak/files/src/{core/auth → modules/users}/commands/keycloak-token.ts +3 -1
  18. package/templates/features/auth-keycloak/files/{src/core/auth/tests/keycloak-tokens.test.ts → tests/tatara/auth-keycloak-tokens.test.ts} +2 -2
  19. package/templates/features/auth-keycloak/files+auth-orgs/{src/core/auth/tests/keycloak-organizations.test.ts → tests/tatara/auth-keycloak-organizations.test.ts} +1 -1
  20. package/templates/features/auth-keycloak/files+authz/{src/core/auth/tests/keycloak-authz.test.ts → tests/tatara/auth-keycloak-authz.test.ts} +3 -2
  21. package/templates/features/auth-orgs/files+drizzle+mysql/src/{core/auth → modules/users}/db/organization.schema.ts +1 -1
  22. package/templates/features/auth-orgs/files+drizzle+postgres/src/{core/auth → modules/users}/db/organization.schema.ts +1 -1
  23. package/templates/features/authz/files/src/core/authz/system-roles.ts +1 -0
  24. package/templates/features/authz/files/src/{core/authz → modules/users}/routes/authorization.routes.ts +4 -1
  25. package/templates/features/authz/files/{src/core/authz/tests → tests/tatara}/authz.test.ts +4 -2
  26. package/templates/features/authz/files+drizzle/src/core/authz/index.ts +1 -0
  27. package/templates/features/authz/files+prisma/src/core/authz/index.ts +1 -0
  28. package/templates/features/base/files/AGENTS.md +17 -0
  29. package/templates/features/base/files/biome.template.json +1 -1
  30. package/templates/features/base/files/src/apps/api/app.ts +1 -1
  31. package/templates/features/base/files/src/apps/api/server.ts +7 -1
  32. package/templates/features/base/files/src/apps/cli/index.ts +4 -1
  33. package/templates/features/base/files/src/{core/http/app.ts → apps/http.ts} +6 -0
  34. package/templates/features/base/files/src/core/http/context.ts +2 -0
  35. package/templates/features/base/files/src/core/logging/logger.ts +5 -3
  36. package/templates/features/better-auth/files/src/{core/auth → modules/users}/db/seed.ts +1 -1
  37. package/templates/features/better-auth/files/src/modules/users/services/auth.ts +37 -0
  38. package/templates/features/better-auth/files/src/{core/auth → modules/users/services}/delivery.ts +1 -1
  39. package/templates/features/better-auth/files/tests/helpers/auth.ts +4 -3
  40. package/templates/features/better-auth/files+admin/tests/tatara/auth-openapi-admin.test.ts +10 -0
  41. package/templates/features/better-auth/files+auth-orgs/{src/core/auth/tests/principal.test.ts → tests/tatara/auth-principal.test.ts} +1 -1
  42. package/templates/features/better-auth/files+auth-orgs+authz/{src/core/auth/tests/principal-authz.test.ts → tests/tatara/auth-principal-authz.test.ts} +1 -1
  43. package/templates/features/better-auth/files+drizzle+mysql/src/{core/auth → modules/users/services}/adapter.ts +1 -1
  44. package/templates/features/better-auth/files+drizzle+postgres/src/{core/auth → modules/users/services}/adapter.ts +1 -1
  45. package/templates/features/cache/files/src/core/cache/index.ts +23 -0
  46. package/templates/features/cache/files/src/core/http/rate-limit.ts +15 -0
  47. package/templates/features/cache/files/tests/tatara/cache.test.ts +22 -0
  48. package/templates/features/cache/files/tests/tatara/rate-limit.test.ts +27 -0
  49. package/templates/features/cache/files+postgres/src/core/cache/index.ts +36 -0
  50. package/templates/features/db/files+mysql+drizzle/src/core/commands/db/command-runs.schema.ts +10 -0
  51. package/templates/features/db/files+mysql+drizzle/src/core/db/admin.ts +6 -1
  52. package/templates/features/db/files+mysql+prisma/prisma/models/command-runs.prisma +9 -0
  53. package/templates/features/db/files+mysql+prisma/src/core/db/admin.ts +1 -0
  54. package/templates/features/db/files+postgres/src/core/db/admin.ts +6 -1
  55. package/templates/features/email/files/src/core/email/send.ts +22 -2
  56. package/templates/features/email/files/src/modules/example/emails/welcome.ts +11 -0
  57. package/templates/features/jobs/files/src/apps/cron/index.ts +2 -3
  58. package/templates/features/jobs/files/src/apps/cron/runner.ts +11 -0
  59. package/templates/features/jobs/files/src/apps/worker/index.ts +2 -9
  60. package/templates/features/jobs/files/src/core/jobs/index.ts +37 -6
  61. package/templates/features/jobs/files/src/modules/example/tests/jobs.test.ts +7 -10
  62. package/templates/features/jobs/files+drizzle+postgres/src/core/jobs/outbox.ts +23 -0
  63. package/templates/features/jobs/files+drizzle+postgres/tests/tatara/jobs-outbox.test.ts +34 -0
  64. package/templates/features/jobs/files+postgres/src/core/jobs/index.ts +47 -0
  65. package/templates/features/jobs/files+prisma+postgres/src/core/jobs/outbox.ts +17 -0
  66. package/templates/features/jobs/files+prisma+postgres/tests/tatara/jobs-outbox.test.ts +34 -0
  67. package/templates/features/notifications/files/src/modules/example/notifications/welcome.ts +14 -0
  68. package/templates/features/notifications/files/src/modules/notifications/consumers/deliver.ts +6 -0
  69. package/templates/features/notifications/files/src/modules/notifications/consumers/fanout.ts +6 -0
  70. package/templates/features/notifications/files/src/modules/notifications/routes/notifications.routes.ts +168 -0
  71. package/templates/features/notifications/files/src/modules/notifications/services/notifier.ts +59 -0
  72. package/templates/features/notifications/files/src/modules/notifications/tests/notifications.test.ts +72 -0
  73. package/templates/features/notifications/files+drizzle/src/modules/notifications/services/store.ts +5 -0
  74. package/templates/features/notifications/files+drizzle+mysql/src/modules/notifications/db/notifications.schema.ts +40 -0
  75. package/templates/features/notifications/files+drizzle+postgres/src/modules/notifications/db/notifications.schema.ts +41 -0
  76. package/templates/features/notifications/files+prisma/prisma/models/notifications.prisma +34 -0
  77. package/templates/features/notifications/files+prisma/src/modules/notifications/services/store.ts +4 -0
  78. package/templates/features/observability/files/src/apps/instrument.ts +15 -0
  79. package/templates/features/realtime/files/src/core/realtime/index.ts +29 -0
  80. package/templates/features/realtime/files/src/modules/realtime/routes/realtime.routes.ts +38 -0
  81. package/templates/features/realtime/files/tests/tatara/realtime.test.ts +37 -0
  82. package/templates/versions.json +28 -8
  83. package/templates/features/better-auth/files/src/core/auth/auth.ts +0 -26
  84. package/templates/features/better-auth/files/src/core/auth/principal.ts +0 -10
  85. package/templates/features/better-auth/files+admin/src/core/auth/tests/openapi-admin.test.ts +0 -8
  86. /package/templates/features/auth/files/src/{core/auth → modules/users}/routes/me.routes.ts +0 -0
  87. /package/templates/features/auth/files/{src/core/auth/tests/me.test.ts → tests/tatara/auth-me.test.ts} +0 -0
  88. /package/templates/features/auth-keycloak/files/src/{core/auth → modules/users/services}/keycloak.ts +0 -0
  89. /package/templates/features/authz/files/{src/core/authz/tests/error-messages.test.ts → tests/tatara/authz-error-messages.test.ts} +0 -0
  90. /package/templates/features/authz/files/{src/core/authz/tests/request-body.test.ts → tests/tatara/authz-request-body.test.ts} +0 -0
  91. /package/templates/features/base/files/{src/core/config/tests/env.test.ts → tests/tatara/config-env.test.ts} +0 -0
  92. /package/templates/features/better-auth/files/src/{core/auth → modules/users/services}/sms.ts +0 -0
  93. /package/templates/features/better-auth/files/{src/core/auth/tests/openapi.test.ts → tests/tatara/auth-openapi.test.ts} +0 -0
  94. /package/templates/features/better-auth/files+drizzle+mysql/src/{core/auth → modules/users}/db/auth.schema.ts +0 -0
  95. /package/templates/features/better-auth/files+drizzle+postgres/src/{core/auth → modules/users}/db/auth.schema.ts +0 -0
  96. /package/templates/features/better-auth/files+prisma+mysql/src/{core/auth → modules/users/services}/adapter.ts +0 -0
  97. /package/templates/features/better-auth/files+prisma+postgres/src/{core/auth → modules/users/services}/adapter.ts +0 -0
  98. /package/templates/features/email/files/{src/core/email/tests → tests/tatara}/email.test.ts +0 -0
  99. /package/templates/features/i18n/files/{src/core/i18n/tests → tests/tatara}/i18n.test.ts +0 -0
  100. /package/templates/features/storage/files/{src/core/storage/tests → tests/tatara}/storage.test.ts +0 -0
@@ -31,15 +31,35 @@
31
31
  "@aws-sdk/s3-request-presigner": "3.1152.0",
32
32
  "nodemailer": "10.1.1",
33
33
  "@types/nodemailer": "8.0.2",
34
- "@tatara/core": "0.1.1",
35
- "@tatara/http": "0.1.1",
36
- "@tatara/db": "0.2.0",
34
+ "@tatara/core": "0.1.2",
35
+ "@tatara/http": "0.1.2",
36
+ "@tatara/db": "0.2.2",
37
37
  "@tatara/testing": "0.1.1",
38
- "@tatara/auth": "0.1.1",
39
- "@tatara/keycloak": "0.1.1",
40
- "@tatara/authz": "0.2.0",
38
+ "@tatara/auth": "0.2.0",
39
+ "@tatara/keycloak": "0.1.2",
40
+ "@tatara/authz": "0.3.1",
41
41
  "@tatara/storage": "0.2.0",
42
- "@tatara/email": "0.2.0",
42
+ "@tatara/email": "0.3.0",
43
43
  "@tatara/i18n": "0.1.0",
44
- "@tatara/jobs": "0.2.0"
44
+ "@tatara/jobs": "0.3.0",
45
+ "@tatara/cache": "0.1.0",
46
+ "openapi-typescript": "7.13.0",
47
+ "kafkajs": "2.2.4",
48
+ "@tatara/notifications": "0.1.0",
49
+ "@tatara/realtime": "0.1.0",
50
+ "socket.io": "4.8.4",
51
+ "socket.io-client": "4.8.4",
52
+ "@socket.io/redis-adapter": "8.3.0",
53
+ "@socket.io/redis-emitter": "5.1.0",
54
+ "@tatara/observability": "0.1.0",
55
+ "@opentelemetry/api": "1.10.0",
56
+ "@opentelemetry/sdk-node": "0.300.0",
57
+ "@opentelemetry/sdk-trace": "3.0.0",
58
+ "@opentelemetry/sdk-metrics": "3.0.0",
59
+ "@opentelemetry/resources": "3.0.0",
60
+ "@opentelemetry/exporter-trace-otlp-http": "0.300.0",
61
+ "@opentelemetry/exporter-metrics-otlp-http": "0.300.0",
62
+ "@opentelemetry/auto-instrumentations-node": "0.82.0",
63
+ "@opentelemetry/instrumentation": "0.300.0",
64
+ "@hono/otel": "1.3.0"
45
65
  }
@@ -1,26 +0,0 @@
1
- import { betterAuth } from "better-auth";
2
- import { bearer, openAPI } from "better-auth/plugins";
3
- import { database } from "#core/auth/adapter";
4
- import { env } from "#core/config/env";
5
- import { newId } from "@tatara/db";
6
- // tatara:slot imports
7
-
8
- export const auth = betterAuth({
9
- appName: "__APP_NAME__",
10
- baseURL: env.APP_URL,
11
- basePath: "/api/auth",
12
- secret: env.BETTER_AUTH_SECRET,
13
- trustedOrigins: env.CORS_ORIGINS,
14
- database,
15
- advanced: { database: { generateId: () => newId() } },
16
- // tatara:slot options
17
- plugins: [
18
- // Authorization: Bearer <session token> for mobile and API clients
19
- bearer(),
20
- // reference for the auth endpoints at /api/auth/reference
21
- openAPI(),
22
- // tatara:slot plugins
23
- ],
24
- });
25
-
26
- export type Session = typeof auth.$Infer.Session;
@@ -1,10 +0,0 @@
1
- import { principalMiddleware, sessionPrincipal } from "@tatara/auth";
2
- import { auth } from "#core/auth/auth";
3
- import type { AppEnv } from "#core/http/context";
4
- // tatara:slot imports
5
-
6
- /** Sets `c.var.principal` from the first resolver that recognises the request's credentials. */
7
- export const attachPrincipal = principalMiddleware<AppEnv>([
8
- (c) => sessionPrincipal(auth, c.req.raw.headers),
9
- // tatara:slot resolvers
10
- ]);
@@ -1,8 +0,0 @@
1
- import { expect, it } from "vitest";
2
- import { adminApi } from "#tests/helpers/api";
3
-
4
- it("leaves auth out of the admin OpenAPI document", async () => {
5
- const res = await adminApi.get<{ paths: Record<string, unknown> }>("/openapi.json");
6
- expect(res.status).toBe(200);
7
- expect(Object.keys(res.body.paths).some((path) => path.startsWith("/api/auth/"))).toBe(false);
8
- });