@nifrajs/schema 1.1.0 → 1.2.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.
package/dist/t.d.ts CHANGED
@@ -35,7 +35,7 @@ export declare const t: {
35
35
  nextCursor: TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
36
36
  }>>;
37
37
  /** A request query schema for cursor pagination: `{ cursor?: string; limit?: number }`. `maxLimit`
38
- * caps `limit` — a larger value fails validation (a 400), so a client can't request an unbounded page.
38
+ * caps `limit` — a larger value fails validation (a 422), so a client can't request an unbounded page.
39
39
  * `coerce` is on because query values arrive as strings (`?limit=20` → `"20"`); it's what makes `limit`
40
40
  * a real `number` in the handler (`c.query.limit`), not a string. */
41
41
  readonly pageQuery: (options?: {
package/dist/t.js CHANGED
@@ -28,7 +28,7 @@ export const t = {
28
28
  null: () => fromTypeBox(Type.Null()),
29
29
  literal: (value) => fromTypeBox(Type.Literal(value)),
30
30
  // `t.object` REJECTS unknown fields by default (`additionalProperties: false`) — the trust-boundary
31
- // rule. A body with extra keys fails validation (a 400), so `c.body` never carries attacker-supplied
31
+ // rule. A body with extra keys fails validation (a 422), so `c.body` never carries attacker-supplied
32
32
  // properties (no mass-assignment). Use `t.looseObject` (or pass `{ additionalProperties: true }`) to
33
33
  // opt into an open object; an explicit `options.additionalProperties` always wins over the default.
34
34
  object: (props, options) => fromTypeBox(Type.Object(unwrap(props), { additionalProperties: false, ...options })),
@@ -54,7 +54,7 @@ export const t = {
54
54
  nextCursor: Type.Union([Type.String(), Type.Null()]),
55
55
  }, { additionalProperties: false, ...options })),
56
56
  /** A request query schema for cursor pagination: `{ cursor?: string; limit?: number }`. `maxLimit`
57
- * caps `limit` — a larger value fails validation (a 400), so a client can't request an unbounded page.
57
+ * caps `limit` — a larger value fails validation (a 422), so a client can't request an unbounded page.
58
58
  * `coerce` is on because query values arrive as strings (`?limit=20` → `"20"`); it's what makes `limit`
59
59
  * a real `number` in the handler (`c.query.limit`), not a string. */
60
60
  pageQuery: (options) => fromTypeBox(Type.Object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nifrajs/schema",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Built-in schema builder `t` — TypeBox-backed (free JSON Schema + compiled validators), implements Standard Schema so nifra routes validate it natively.",
5
5
  "keywords": [
6
6
  "bun",
@@ -48,7 +48,7 @@
48
48
  "@sinclair/typebox": "^0.34.49"
49
49
  },
50
50
  "peerDependencies": {
51
- "@nifrajs/core": "^1.1.0"
51
+ "@nifrajs/core": "^1.2.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@nifrajs/core": "workspace:*",
package/src/t.ts CHANGED
@@ -42,7 +42,7 @@ export const t = {
42
42
  literal: <const L extends TLiteralValue>(value: L) => fromTypeBox(Type.Literal(value)),
43
43
 
44
44
  // `t.object` REJECTS unknown fields by default (`additionalProperties: false`) — the trust-boundary
45
- // rule. A body with extra keys fails validation (a 400), so `c.body` never carries attacker-supplied
45
+ // rule. A body with extra keys fails validation (a 422), so `c.body` never carries attacker-supplied
46
46
  // properties (no mass-assignment). Use `t.looseObject` (or pass `{ additionalProperties: true }`) to
47
47
  // opt into an open object; an explicit `options.additionalProperties` always wins over the default.
48
48
  object: <P extends Props>(props: P, options?: ObjectOptions) =>
@@ -83,7 +83,7 @@ export const t = {
83
83
  ),
84
84
  ),
85
85
  /** A request query schema for cursor pagination: `{ cursor?: string; limit?: number }`. `maxLimit`
86
- * caps `limit` — a larger value fails validation (a 400), so a client can't request an unbounded page.
86
+ * caps `limit` — a larger value fails validation (a 422), so a client can't request an unbounded page.
87
87
  * `coerce` is on because query values arrive as strings (`?limit=20` → `"20"`); it's what makes `limit`
88
88
  * a real `number` in the handler (`c.query.limit`), not a string. */
89
89
  pageQuery: (options?: { maxLimit?: number }) =>