@timber-js/app 0.2.0-alpha.217 → 0.2.0-alpha.219

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 (81) hide show
  1. package/agent-skill.md +5 -5
  2. package/dist/_chunks/{actions-CUh3cClk.js → actions-BwkmAYXq.js} +8 -1
  3. package/dist/_chunks/actions-BwkmAYXq.js.map +1 -0
  4. package/dist/_chunks/cloudflare-Byxl8FWP.js.map +1 -1
  5. package/dist/_chunks/dev-server-B8zsT-ee.js.map +1 -1
  6. package/dist/_chunks/dist-DtrJyBbw.js.map +1 -1
  7. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +1 -1
  8. package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -1
  9. package/dist/adapters/cloudflare.js +1 -2
  10. package/dist/adapters/nitro.js.map +1 -1
  11. package/dist/analyze/graph-command.js.map +1 -1
  12. package/dist/client/error-boundary.js +1 -2
  13. package/dist/client/form.d.ts +34 -37
  14. package/dist/client/form.d.ts.map +1 -1
  15. package/dist/client/index.d.ts +3 -3
  16. package/dist/client/index.d.ts.map +1 -1
  17. package/dist/client/index.js +40 -75
  18. package/dist/client/index.js.map +1 -1
  19. package/dist/client/{use-form-field.d.ts → use-field-state.d.ts} +10 -7
  20. package/dist/client/use-field-state.d.ts.map +1 -0
  21. package/dist/config-types.d.ts +15 -18
  22. package/dist/config-types.d.ts.map +1 -1
  23. package/dist/cookies/index.js.map +1 -1
  24. package/dist/index.js +29 -27
  25. package/dist/index.js.map +1 -1
  26. package/dist/plugins/build-manifest.d.ts.map +1 -1
  27. package/dist/plugins/shims.d.ts.map +1 -1
  28. package/dist/search-params/index.js.map +1 -1
  29. package/dist/server/action-client.d.ts +11 -172
  30. package/dist/server/action-client.d.ts.map +1 -1
  31. package/dist/server/action-handler.d.ts +0 -7
  32. package/dist/server/action-handler.d.ts.map +1 -1
  33. package/dist/server/action-schema.d.ts +126 -0
  34. package/dist/server/action-schema.d.ts.map +1 -0
  35. package/dist/server/action-types.d.ts +108 -0
  36. package/dist/server/action-types.d.ts.map +1 -0
  37. package/dist/server/form-data.d.ts +7 -0
  38. package/dist/server/form-data.d.ts.map +1 -1
  39. package/dist/server/index.d.ts +3 -2
  40. package/dist/server/index.d.ts.map +1 -1
  41. package/dist/server/index.js +511 -148
  42. package/dist/server/index.js.map +1 -1
  43. package/dist/server/internal.js +12 -3
  44. package/dist/server/internal.js.map +1 -1
  45. package/dist/server/pipeline-metadata.d.ts +9 -0
  46. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  47. package/dist/server/pipeline-phases.d.ts.map +1 -1
  48. package/dist/server/rsc-entry/action-dispatcher.d.ts +0 -3
  49. package/dist/server/rsc-entry/action-dispatcher.d.ts.map +1 -1
  50. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  51. package/dist/server/schema-introspection.d.ts +68 -0
  52. package/dist/server/schema-introspection.d.ts.map +1 -0
  53. package/dist/server/sensitive-fields.d.ts +40 -26
  54. package/dist/server/sensitive-fields.d.ts.map +1 -1
  55. package/dist/server/sitemap-handler.d.ts.map +1 -1
  56. package/docs/api/31-api-client.mdx +19 -18
  57. package/docs/api/34-api-config.mdx +1 -1
  58. package/docs/learn/08-forms-and-actions.mdx +57 -23
  59. package/package.json +8 -8
  60. package/src/client/browser-entry/index.ts +7 -1
  61. package/src/client/form.tsx +57 -108
  62. package/src/client/index.ts +3 -3
  63. package/src/client/{use-form-field.ts → use-field-state.ts} +20 -8
  64. package/src/config-types.ts +15 -18
  65. package/src/plugins/build-manifest.ts +12 -27
  66. package/src/plugins/shims.ts +0 -1
  67. package/src/server/action-client.ts +82 -307
  68. package/src/server/action-handler.ts +1 -42
  69. package/src/server/action-schema.ts +203 -0
  70. package/src/server/action-types.ts +145 -0
  71. package/src/server/form-data.ts +7 -0
  72. package/src/server/index.ts +5 -3
  73. package/src/server/pipeline-metadata.ts +11 -1
  74. package/src/server/pipeline-phases.ts +9 -2
  75. package/src/server/rsc-entry/action-dispatcher.ts +0 -4
  76. package/src/server/rsc-entry/index.ts +1 -2
  77. package/src/server/schema-introspection.ts +393 -0
  78. package/src/server/sensitive-fields.ts +115 -58
  79. package/src/server/sitemap-handler.ts +14 -21
  80. package/dist/_chunks/actions-CUh3cClk.js.map +0 -1
  81. package/dist/client/use-form-field.d.ts.map +0 -1
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Action input schemas — the Standard Schema protocol (and the legacy
3
+ * `.parse()` interface) as `createActionClient().schema()` accepts them, the
4
+ * input/output types they carry, and running one against an action's input.
5
+ *
6
+ * See design/08-forms-and-actions.md §"Validation Pattern"
7
+ */
8
+
9
+ import type { ValidationErrors } from './action-types.ts';
10
+
11
+ // ─── Standard Schema ──────────────────────────────────────────────────────
12
+
13
+ /**
14
+ * Standard Schema v1 interface (subset).
15
+ * Zod ≥3.24, Valibot ≥1.0, and ArkType all implement this.
16
+ * See https://github.com/standard-schema/standard-schema
17
+ *
18
+ * `types` is the protocol's type-only carrier: a schema's input type (what a
19
+ * caller passes, before coercion) and output type (what validation produces).
20
+ * We use permissive types for issues and paths to accept all compliant
21
+ * libraries without requiring exact structural matches on their shapes.
22
+ */
23
+ export interface StandardSchemaV1<Input = unknown, Output = Input> {
24
+ readonly '~standard': {
25
+ readonly validate: (
26
+ value: unknown
27
+ ) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
28
+ readonly types?: { readonly input: Input; readonly output: Output } | undefined;
29
+ };
30
+ }
31
+
32
+ type StandardSchemaResult<Output> =
33
+ | { value: Output; issues?: undefined }
34
+ | { value?: undefined; issues: ReadonlyArray<StandardSchemaIssue> };
35
+
36
+ interface StandardSchemaIssue {
37
+ message: string;
38
+ path?: ReadonlyArray<PropertyKey | { key: PropertyKey }>;
39
+ }
40
+
41
+ /** Check if a schema implements the Standard Schema protocol. */
42
+ export function isStandardSchema(schema: unknown): schema is StandardSchemaV1 {
43
+ return (
44
+ typeof schema === 'object' &&
45
+ schema !== null &&
46
+ '~standard' in schema &&
47
+ typeof (schema as StandardSchemaV1)['~standard'].validate === 'function'
48
+ );
49
+ }
50
+
51
+ // ─── Schema types ─────────────────────────────────────────────────────────
52
+
53
+ /**
54
+ * Minimal schema interface — compatible with Zod, Valibot, ArkType, etc.
55
+ *
56
+ * Accepts either:
57
+ * - Standard Schema (preferred): any object with `~standard.validate()`
58
+ * - Legacy parse interface: objects with `.parse()` / `.safeParse()`
59
+ *
60
+ * At runtime, Standard Schema is detected via `~standard` property and
61
+ * takes priority over the legacy interface.
62
+ */
63
+ export type ActionSchema<T = unknown> = StandardSchemaV1<unknown, T> | LegacyActionSchema<T>;
64
+
65
+ /** Legacy schema interface with .parse() / .safeParse(). */
66
+ interface LegacyActionSchema<T = unknown> {
67
+ 'parse'(data: unknown): T;
68
+ 'safeParse'?(data: unknown): { success: true; data: T } | { success: false; error: SchemaError };
69
+ // Exclude Standard Schema objects from matching this interface
70
+ '~standard'?: never;
71
+ }
72
+
73
+ /** Schema validation error shape (for legacy .safeParse()/.parse() interface). */
74
+ export interface SchemaError {
75
+ issues?: Array<{ path?: Array<string | number>; message: string }>;
76
+ flatten?(): { fieldErrors: Record<string, string[]> };
77
+ }
78
+
79
+ /**
80
+ * What a validated action's body receives: the schema's output, after
81
+ * coercion and defaults.
82
+ */
83
+ export type SchemaOutput<S> = S extends { readonly '~standard': infer Std }
84
+ ? DeclaredType<Std, 'output', ValidatedValue<S>>
85
+ : S extends LegacyActionSchema<infer T>
86
+ ? T
87
+ : never;
88
+
89
+ /**
90
+ * The value a Standard Schema's `validate` produces on success, for a schema
91
+ * that declares no `types`. Only the success branch has a required `value`.
92
+ */
93
+ type ValidatedValue<S> = S extends {
94
+ readonly '~standard': { readonly validate: (value: unknown) => infer R };
95
+ }
96
+ ? SuccessValue<Awaited<R>>
97
+ : never;
98
+
99
+ /** Distributes over the result union, keeping the members with a value. */
100
+ type SuccessValue<R> = R extends { value: infer O } ? O : never;
101
+
102
+ /**
103
+ * What a caller passes a validated action: the schema's input, before
104
+ * coercion. A schema that declares no `types` (a hand-written Standard
105
+ * Schema, a legacy `.parse()` schema) has one type for both.
106
+ */
107
+ export type SchemaInput<S> = S extends { readonly '~standard': infer Std }
108
+ ? DeclaredType<Std, 'input', SchemaOutput<S>>
109
+ : SchemaOutput<S>;
110
+
111
+ /**
112
+ * `Std.types[K]` when the schema declares `types` (Zod, Valibot, ArkType do),
113
+ * else `Fallback`. Read by key, because `types` is optional in the protocol.
114
+ */
115
+ type DeclaredType<Std, K extends 'input' | 'output', Fallback> = 'types' extends keyof Std
116
+ ? NonNullable<Std['types' & keyof Std]> extends { readonly [P in K]: infer T }
117
+ ? T
118
+ : Fallback
119
+ : Fallback;
120
+
121
+ // ─── Validation ───────────────────────────────────────────────────────────
122
+
123
+ /** The outcome of running an action's schema over its input. */
124
+ export type SchemaValidation<T> =
125
+ | { ok: true; value: T }
126
+ | { ok: false; validationErrors: ValidationErrors };
127
+
128
+ /**
129
+ * Validate `input` with `schema`, through Standard Schema when the schema
130
+ * implements it, and through `.safeParse()` / `.parse()` otherwise. Only
131
+ * synchronous Standard Schema validation is supported.
132
+ */
133
+ export function validateWithSchema<T>(
134
+ schema: ActionSchema<T>,
135
+ input: unknown
136
+ ): SchemaValidation<T> {
137
+ if (isStandardSchema(schema)) {
138
+ const result = schema['~standard'].validate(input);
139
+ if (result instanceof Promise) {
140
+ throw new Error(
141
+ '[timber] createActionClient: schema returned a Promise — only sync schemas are supported.'
142
+ );
143
+ }
144
+ if (result.issues) {
145
+ return { ok: false, validationErrors: extractStandardSchemaErrors(result.issues) };
146
+ }
147
+ return { ok: true, value: result.value };
148
+ }
149
+ if (typeof schema.safeParse === 'function') {
150
+ const result = schema.safeParse(input);
151
+ if (!result.success) {
152
+ return { ok: false, validationErrors: extractValidationErrors(result.error) };
153
+ }
154
+ return { ok: true, value: result.data };
155
+ }
156
+ try {
157
+ return { ok: true, value: schema.parse(input) };
158
+ } catch (parseError) {
159
+ return { ok: false, validationErrors: extractValidationErrors(parseError as SchemaError) };
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Extract validation errors from a schema error.
165
+ * Supports Zod's flatten() and generic issues array.
166
+ */
167
+ function extractValidationErrors(error: SchemaError): ValidationErrors {
168
+ // Zod-style flatten
169
+ if (typeof error.flatten === 'function') {
170
+ return error.flatten().fieldErrors;
171
+ }
172
+
173
+ // Generic issues array
174
+ if (error.issues) {
175
+ const errors: Record<string, string[]> = {};
176
+ for (const issue of error.issues) {
177
+ const path = issue.path?.join('.') ?? '_root';
178
+ (errors[path] ??= []).push(issue.message);
179
+ }
180
+ return errors;
181
+ }
182
+
183
+ return { _root: ['Validation failed'] };
184
+ }
185
+
186
+ /**
187
+ * Extract validation errors from Standard Schema issues.
188
+ */
189
+ function extractStandardSchemaErrors(issues: ReadonlyArray<StandardSchemaIssue>): ValidationErrors {
190
+ const errors: Record<string, string[]> = {};
191
+ for (const issue of issues) {
192
+ const path =
193
+ issue.path
194
+ ?.map((p) => {
195
+ // Standard Schema path items can be { key: ... } objects or bare PropertyKey values
196
+ if (typeof p === 'object' && p !== null && 'key' in p) return String(p.key);
197
+ return String(p);
198
+ })
199
+ .join('.') ?? '_root';
200
+ (errors[path] ??= []).push(issue.message);
201
+ }
202
+ return Object.keys(errors).length > 0 ? errors : { _root: ['Validation failed'] };
203
+ }
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Types for `createActionClient` actions: what a caller passes, what the
3
+ * action body receives, and the result the client reads.
4
+ *
5
+ * A validated action has two input types. Callers pass the schema's input
6
+ * (`SchemaInput`), the values before coercion: a form's strings, or whatever
7
+ * a direct call hands it. The body receives the schema's output
8
+ * (`SchemaOutput`), after coercion and defaults.
9
+ *
10
+ * See design/08-forms-and-actions.md §"Middleware and Server Actions"
11
+ */
12
+
13
+ import type { ActionSchema, SchemaInput, SchemaOutput } from './action-schema.ts';
14
+
15
+ // ─── Field paths ─────────────────────────────────────────────────────────
16
+
17
+ /** Recursion budget for `FieldPath`: six levels, then a path ends in `string`. */
18
+ type Depth = [never, 0, 1, 2, 3, 4, 5, 6];
19
+
20
+ /**
21
+ * The dot paths of the fields in `T`, as a form names them and a validation
22
+ * error is keyed: `title`, `user.email`, `sets.${number}.name`.
23
+ *
24
+ * An input of unknown shape has `string` paths, so nothing is rejected: an
25
+ * action with no schema (`undefined` input, whose only validation errors are
26
+ * `fileSizeLimit`'s) and a schema that declares no types.
27
+ */
28
+ export type FieldPath<T> = unknown extends T
29
+ ? string
30
+ : [T] extends [undefined]
31
+ ? string
32
+ : PathsOf<NonNullable<T>, 5>;
33
+
34
+ type PathsOf<T, D extends number> = [D] extends [never]
35
+ ? string
36
+ : unknown extends T
37
+ ? never
38
+ : T extends File | Blob | Date
39
+ ? never
40
+ : T extends readonly (infer Item)[]
41
+ ? `${number}` | `${number}.${PathsOf<NonNullable<Item>, Depth[D]>}`
42
+ : T extends object
43
+ ? {
44
+ [K in keyof T & string]-?: K | `${K}.${PathsOf<NonNullable<T[K]>, Depth[D]>}`;
45
+ }[keyof T & string]
46
+ : never;
47
+
48
+ // ─── Results ─────────────────────────────────────────────────────────────
49
+
50
+ /**
51
+ * Validation errors keyed by field path. `_root` holds errors that belong to
52
+ * the whole input rather than one field.
53
+ */
54
+ export type ValidationErrors<TPath extends string = string> = {
55
+ [K in TPath | '_root']?: string[];
56
+ };
57
+
58
+ /** Middleware function: returns context to merge into the action body's ctx. */
59
+ export type ActionMiddleware<TCtx = Record<string, unknown>> = () => Promise<TCtx> | TCtx;
60
+
61
+ /** A typed failure: an `ActionError`'s code and data, or `INTERNAL_ERROR`. */
62
+ export interface ActionServerError {
63
+ code: string;
64
+ data?: Record<string, unknown>;
65
+ }
66
+
67
+ /**
68
+ * The result returned to the client. `TInput` is the schema's input type,
69
+ * which keys `validationErrors` by the input's field paths.
70
+ */
71
+ export type ActionResult<TData = unknown, TInput = unknown> =
72
+ | { data: TData; validationErrors?: never; serverError?: never; submittedValues?: never }
73
+ | {
74
+ data?: never;
75
+ validationErrors: ValidationErrors<FieldPath<TInput>>;
76
+ serverError?: never;
77
+ /** Raw input values on validation failure — for repopulating form fields. */
78
+ submittedValues?: Record<string, unknown>;
79
+ }
80
+ | {
81
+ data?: never;
82
+ validationErrors?: never;
83
+ serverError: ActionServerError;
84
+ /**
85
+ * The submitted form, when the input was FormData — for repopulating
86
+ * form fields, which React resets after the action (TIM-1573).
87
+ */
88
+ submittedValues?: Record<string, unknown>;
89
+ };
90
+
91
+ /** Context passed to the action body. */
92
+ export interface ActionContext<TCtx, TInput> {
93
+ ctx: TCtx;
94
+ input: TInput;
95
+ }
96
+
97
+ // ─── Builder ─────────────────────────────────────────────────────────────
98
+
99
+ /** Intermediate builder returned by createActionClient(). */
100
+ export interface ActionBuilder<TCtx> {
101
+ /** Declare the input schema. Validation errors are returned typed. */
102
+ schema<S extends ActionSchema>(
103
+ schema: S
104
+ ): ActionBuilderWithSchema<TCtx, SchemaInput<S>, SchemaOutput<S>>;
105
+ /** Define the action body without input validation. */
106
+ action<TData>(
107
+ fn: (ctx: ActionContext<TCtx, undefined>) => Promise<TData>
108
+ ): ActionFn<TData, undefined>;
109
+ }
110
+
111
+ /** Builder after .schema() has been called. */
112
+ export interface ActionBuilderWithSchema<TCtx, TInput, TOutput = TInput> {
113
+ /** Define the action body. It receives the schema's output. */
114
+ action<TData>(fn: (ctx: ActionContext<TCtx, TOutput>) => Promise<TData>): ActionFn<TData, TInput>;
115
+ }
116
+
117
+ /**
118
+ * The final action function. Callable three ways:
119
+ * - Direct: action(input) → Promise<ActionResult<TData>>
120
+ * - React useActionState: action(prevState, payload) → Promise<ActionResult<TData>>,
121
+ * where payload is the submitted FormData or the value dispatch was called with
122
+ * - React <form action={fn}>: action(formData) → void (return value ignored by React)
123
+ *
124
+ * `TInput` is what callers pass: the schema's input type. The third overload
125
+ * exists purely for type compatibility with React's `<form action>` prop,
126
+ * which expects `(formData: FormData) => void`. At runtime the function still
127
+ * returns Promise<ActionResult>, but React discards it. This lets validated
128
+ * actions be passed directly to forms without casts.
129
+ */
130
+ export type ActionFn<TData = unknown, TInput = unknown> = {
131
+ /** <form action={fn}> compatibility — React discards the return value. */
132
+ (formData: FormData): void;
133
+ /** Direct call: action(input) — optional when TInput is undefined/unknown (no-schema actions). */
134
+ (
135
+ ...args: undefined extends TInput ? [input?: TInput] : [input: TInput]
136
+ ): Promise<ActionResult<TData, TInput>>;
137
+ /**
138
+ * React useActionState: action(prevState, payload). The payload is the
139
+ * submitted FormData, or whatever the hook's dispatch was called with.
140
+ */
141
+ (
142
+ prevState: ActionResult<TData, TInput> | null,
143
+ payload: TInput | FormData
144
+ ): Promise<ActionResult<TData, TInput>>;
145
+ };
@@ -27,6 +27,13 @@
27
27
  * - **Empty Files → undefined**: File inputs with no selection become `undefined`
28
28
  * - **Strips `$ACTION_*` fields**: React's internal hidden fields are excluded
29
29
  * - **Drops `__proto__` paths and names deeper than 32 segments**
30
+ *
31
+ * A field's shape follows its count: a name sent once is a scalar, several
32
+ * times an array, never at all absent. A `createActionClient` action with a
33
+ * schema then gives every field the schema declares as a list one shape
34
+ * (`normalizeListFields` in `schema-introspection.ts`). A raw call, and a raw
35
+ * `'use server'` action that calls this itself, keep the count-dependent
36
+ * shape.
30
37
  */
31
38
  export function parseFormData(formData: FormData): Record<string, unknown> {
32
39
  const flat: Record<string, unknown> = {};
@@ -34,7 +34,7 @@ export {
34
34
  // Re-export removed per TIM-721.
35
35
 
36
36
  // Server Actions — user-facing action client and validation
37
- export { createActionClient, ActionError, validated } from './action-client.ts';
37
+ export { createActionClient, ActionError } from './action-client.ts';
38
38
  export type {
39
39
  ActionResult,
40
40
  ActionFn,
@@ -42,9 +42,11 @@ export type {
42
42
  ActionBuilderWithSchema,
43
43
  ActionContext,
44
44
  ActionMiddleware,
45
- ActionSchema,
45
+ ActionServerError,
46
+ FieldPath,
46
47
  ValidationErrors,
47
- } from './action-client.ts';
48
+ } from './action-types.ts';
49
+ export type { ActionSchema, SchemaInput, SchemaOutput } from './action-schema.ts';
48
50
 
49
51
  // FormData Preprocessing
50
52
  export { coerce, parseFormData } from './form-data.ts';
@@ -9,6 +9,16 @@
9
9
 
10
10
  import { readFile } from 'node:fs/promises';
11
11
 
12
+ /**
13
+ * Cache-Control the framework sets on metadata route responses it produces:
14
+ * static files, serialized handler results (sitemap, robots, manifest) and
15
+ * the auto-generated sitemap. A Response a handler returns is sent with its
16
+ * own headers only — the framework adds no default to it.
17
+ *
18
+ * See design/16-metadata.md §"Caching" (under "Metadata Routes")
19
+ */
20
+ export const METADATA_CACHE_CONTROL = 'public, max-age=14400, must-revalidate';
21
+
12
22
  /**
13
23
  * Content types that are text-based and should include charset=utf-8.
14
24
  * Binary formats (images) should not include charset.
@@ -41,7 +51,7 @@ export async function serveStaticMetadataFile(
41
51
  const headers: Record<string, string> = {
42
52
  'Content-Type': isText ? `${contentType}; charset=utf-8` : contentType,
43
53
  'Content-Length': String(body.byteLength),
44
- 'Cache-Control': 'public, max-age=14400, must-revalidate',
54
+ 'Cache-Control': METADATA_CACHE_CONTROL,
45
55
  };
46
56
 
47
57
  return new Response(body, { status: 200, headers });
@@ -28,7 +28,11 @@ import { logRenderError } from './logger.ts';
28
28
  import { isDenySignal, isRedirectSignal } from './signal-identity.ts';
29
29
  import { ParamCoercionError } from './param-coercion.ts';
30
30
  import { checkVersionSkew, applyReloadHeaders } from './version-skew.ts';
31
- import { serveStaticMetadataFile, serializeSitemap } from './pipeline-metadata.ts';
31
+ import {
32
+ METADATA_CACHE_CONTROL,
33
+ serveStaticMetadataFile,
34
+ serializeSitemap,
35
+ } from './pipeline-metadata.ts';
32
36
  import { loadModule } from './safe-load.ts';
33
37
  import { resolveInterceptedRoute } from './pipeline-interception.ts';
34
38
  import { isApiRouteChain } from './route-matcher.ts';
@@ -271,6 +275,9 @@ export async function handleRequest(
271
275
  // If the handler returns a Response, normalize headers so the
272
276
  // outer Server-Timing writer can append without hitting an
273
277
  // immutable header bag (e.g. user returns Response.redirect()).
278
+ // No default Cache-Control here: the handler runs in the request
279
+ // context and may vary on cookies or headers, so a public default
280
+ // could serve one user's response to another (#1064).
274
281
  if (handlerResult instanceof Response) {
275
282
  return cloneWithMutableHeaders(handlerResult);
276
283
  }
@@ -294,7 +301,7 @@ export async function handleRequest(
294
301
  status: 200,
295
302
  headers: {
296
303
  'Content-Type': `${contentType}; charset=utf-8`,
297
- 'Cache-Control': 'public, max-age=14400, must-revalidate',
304
+ 'Cache-Control': METADATA_CACHE_CONTROL,
298
305
  },
299
306
  });
300
307
  } catch (error) {
@@ -25,7 +25,6 @@ import type { BodyLimitsConfig } from '../body-limits.ts';
25
25
  import type { CsrfConfig } from '../csrf.ts';
26
26
  import type { PipelineReentry, RouteMatcher } from '../pipeline.ts';
27
27
  import { isApiRouteChain } from '../route-matcher.ts';
28
- import type { SensitiveFieldsOption } from '../sensitive-fields.ts';
29
28
  import type { RevalidateRenderer } from '../actions.ts';
30
29
 
31
30
  // ─── Types ────────────────────────────────────────────────────────────────
@@ -47,8 +46,6 @@ export interface ActionDispatcherDeps {
47
46
  csrfConfig: CsrfConfig;
48
47
  /** Body size limits forwarded to `handleActionRequest`. */
49
48
  bodyLimits?: BodyLimitsConfig['limits'];
50
- /** Sensitive-field deny-list forwarded to `handleActionRequest`. */
51
- sensitiveFields?: SensitiveFieldsOption;
52
49
  /** Per-request factory that builds a `RevalidateRenderer`. */
53
50
  buildRevalidateRenderer: RevalidateRendererFactory;
54
51
  /**
@@ -104,7 +101,6 @@ export function buildActionDispatcher(
104
101
  const actionResponse = await handleActionRequest(req, {
105
102
  csrf: deps.csrfConfig,
106
103
  bodyLimits: { limits: deps.bodyLimits },
107
- sensitiveFields: deps.sensitiveFields,
108
104
  revalidateRenderer: deps.buildRevalidateRenderer(req),
109
105
  });
110
106
 
@@ -225,7 +225,7 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
225
225
  // Wire the global sensitive-field stripping config so `createActionClient`
226
226
  // instances in user code pick up `forms.stripSensitiveFields` from
227
227
  // `timber.config.ts` without needing to plumb config through each action.
228
- // See TIM-816 and design/08-forms-and-actions.md §"Validation errors".
228
+ // See design/08-forms-and-actions.md §"Sensitive field stripping".
229
229
  const formsConfig = (runtimeConfig as Record<string, unknown>).forms as
230
230
  | {
231
231
  stripSensitiveFields?: import('../sensitive-fields.ts').SensitiveFieldsOption;
@@ -415,7 +415,6 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
415
415
  dispatchAction: buildActionDispatcher({
416
416
  csrfConfig,
417
417
  bodyLimits: (runtimeConfig as Record<string, unknown>).limits as BodyLimitsConfig['limits'],
418
- sensitiveFields: formsConfig?.stripSensitiveFields,
419
418
  matchRoute,
420
419
  buildRevalidateRenderer: createRevalidateRendererFactory({
421
420
  matchRoute,