@tatara/cli 0.13.1 → 0.13.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tatara/cli",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "Create and grow opinionated Hono backends",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +1,5 @@
1
- import { createApp, handleErrors, mountRoutes, serveOpenApi } from "@tatara/http";
1
+ import { corsOrigin, createApp, handleErrors, mountRoutes, serveOpenApi } from "@tatara/http";
2
+ import { cors } from "hono/cors";
2
3
  import { env } from "#core/config/env";
3
4
  import type { AppEnv } from "#core/http/context";
4
5
  import type { AppName } from "#core/http/routes";
@@ -12,13 +13,6 @@ export const API_PREFIX = "/api";
12
13
  export function createHttpApp(name: AppName, options: { title: string }) {
13
14
  const app = createApp<AppEnv>({
14
15
  logger,
15
- cors: {
16
- origins: env.CORS_ORIGINS,
17
- exposeHeaders: [
18
- "X-Request-Id",
19
- // tatara:slot expose-headers
20
- ],
21
- },
22
16
  bodyLimitBytes: env.BODY_LIMIT_BYTES,
23
17
  timeouts: {
24
18
  defaultMs: env.REQUEST_TIMEOUT_MS,
@@ -28,6 +22,25 @@ export function createHttpApp(name: AppName, options: { title: string }) {
28
22
  },
29
23
  defaults: { principal: null, language: "en" },
30
24
  });
25
+ // browsers on other origins (Hono's own middleware); corsOrigin matches exact origins and
26
+ // one-label patterns like https://*.example.com
27
+ app.use(
28
+ cors({
29
+ origin: corsOrigin(env.CORS_ORIGINS),
30
+ credentials: true,
31
+ allowHeaders: [
32
+ "Content-Type",
33
+ "Authorization",
34
+ "X-Request-Id",
35
+ "Accept-Language",
36
+ // tatara:slot allow-headers
37
+ ],
38
+ exposeHeaders: [
39
+ "X-Request-Id",
40
+ // tatara:slot expose-headers
41
+ ],
42
+ }),
43
+ );
31
44
  // tatara:slot middleware
32
45
 
33
46
  // tatara:slot routes
@@ -32,12 +32,12 @@
32
32
  "nodemailer": "10.1.1",
33
33
  "@types/nodemailer": "8.0.2",
34
34
  "@tatara/core": "0.1.3",
35
- "@tatara/http": "0.1.2",
35
+ "@tatara/http": "0.1.4",
36
36
  "@tatara/db": "0.2.2",
37
37
  "@tatara/testing": "0.1.1",
38
38
  "@tatara/auth": "0.2.1",
39
39
  "@tatara/keycloak": "0.1.2",
40
- "@tatara/authz": "0.5.0",
40
+ "@tatara/authz": "0.5.2",
41
41
  "@tatara/storage": "0.2.0",
42
42
  "@tatara/email": "0.3.0",
43
43
  "@tatara/i18n": "0.1.0",