hono-ban 0.3.1 → 1.1.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/CHANGELOG.md +61 -0
- package/{LICENSE.md → LICENSE} +1 -1
- package/README.md +319 -469
- package/dist/ban-error-CPoKZS7g.js +102 -0
- package/dist/ban-error-CPoKZS7g.js.map +1 -0
- package/dist/definition-CDmfpcHf.js +263 -0
- package/dist/definition-CDmfpcHf.js.map +1 -0
- package/dist/formats/google-api.d.ts +117 -0
- package/dist/formats/google-api.d.ts.map +1 -0
- package/dist/formats/google-api.js +388 -0
- package/dist/formats/google-api.js.map +1 -0
- package/dist/formats/json-api.d.ts +53 -0
- package/dist/formats/json-api.d.ts.map +1 -0
- package/dist/formats/json-api.js +177 -0
- package/dist/formats/json-api.js.map +1 -0
- package/dist/formats/plain.d.ts +20 -0
- package/dist/formats/plain.d.ts.map +1 -0
- package/dist/formats/plain.js +76 -0
- package/dist/formats/plain.js.map +1 -0
- package/dist/formats/problem-details.d.ts +39 -0
- package/dist/formats/problem-details.d.ts.map +1 -0
- package/dist/formats/problem-details.js +2 -0
- package/dist/formats/stripe.d.ts +52 -0
- package/dist/formats/stripe.d.ts.map +1 -0
- package/dist/formats/stripe.js +117 -0
- package/dist/formats/stripe.js.map +1 -0
- package/dist/hook-DM38dR1V.js +23 -0
- package/dist/hook-DM38dR1V.js.map +1 -0
- package/dist/hook-TWCLnCmZ.d.ts +15 -0
- package/dist/hook-TWCLnCmZ.d.ts.map +1 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +661 -0
- package/dist/index.js.map +1 -0
- package/dist/issue-B-7iyCBE.js +41 -0
- package/dist/issue-B-7iyCBE.js.map +1 -0
- package/dist/json-Bjfm-jxl.js +17 -0
- package/dist/json-Bjfm-jxl.js.map +1 -0
- package/dist/member-name-k4VABr91.js +20 -0
- package/dist/member-name-k4VABr91.js.map +1 -0
- package/dist/openapi.d.ts +40 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +75 -0
- package/dist/openapi.js.map +1 -0
- package/dist/otel.d.ts +29 -0
- package/dist/otel.d.ts.map +1 -0
- package/dist/otel.js +23 -0
- package/dist/otel.js.map +1 -0
- package/dist/problem-details-DeUg_NjG.js +164 -0
- package/dist/problem-details-DeUg_NjG.js.map +1 -0
- package/dist/schema-helpers-bwCFve8i.js +72 -0
- package/dist/schema-helpers-bwCFve8i.js.map +1 -0
- package/dist/standard-schema-types-Aa3pYPY1.d.ts +43 -0
- package/dist/standard-schema-types-Aa3pYPY1.d.ts.map +1 -0
- package/dist/standard-schema.d.ts +15 -0
- package/dist/standard-schema.d.ts.map +1 -0
- package/dist/standard-schema.js +23 -0
- package/dist/standard-schema.js.map +1 -0
- package/dist/testing.d.ts +21 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +141 -0
- package/dist/testing.js.map +1 -0
- package/dist/types-DYr4CtCC.d.ts +337 -0
- package/dist/types-DYr4CtCC.d.ts.map +1 -0
- package/dist/types-WuQ-karh.d.ts +179 -0
- package/dist/types-WuQ-karh.d.ts.map +1 -0
- package/dist/valibot.d.ts +26 -0
- package/dist/valibot.d.ts.map +1 -0
- package/dist/valibot.js +31 -0
- package/dist/valibot.js.map +1 -0
- package/dist/validation-entries-9R5RK-AZ.js +53 -0
- package/dist/validation-entries-9R5RK-AZ.js.map +1 -0
- package/dist/validation-entries-nUGoBPKm.d.ts +17 -0
- package/dist/validation-entries-nUGoBPKm.d.ts.map +1 -0
- package/dist/zod.d.ts +27 -0
- package/dist/zod.d.ts.map +1 -0
- package/dist/zod.js +30 -0
- package/dist/zod.js.map +1 -0
- package/package.json +98 -66
- package/dist/esm/formatters/index.js +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/types/constants/index.d.ts +0 -5
- package/dist/types/constants/status-codes.d.ts +0 -9
- package/dist/types/core/convert-error.d.ts +0 -17
- package/dist/types/core/create-error.d.ts +0 -23
- package/dist/types/core/format-error.d.ts +0 -18
- package/dist/types/core/index.d.ts +0 -7
- package/dist/types/factories/client-errors.d.ts +0 -179
- package/dist/types/factories/index.d.ts +0 -6
- package/dist/types/factories/server-errors.d.ts +0 -77
- package/dist/types/formatters/default/index.d.ts +0 -19
- package/dist/types/formatters/index.d.ts +0 -7
- package/dist/types/formatters/interfaces.d.ts +0 -5
- package/dist/types/formatters/rfc7807/formatter.d.ts +0 -40
- package/dist/types/formatters/rfc7807/hooks.d.ts +0 -40
- package/dist/types/formatters/rfc7807/index.d.ts +0 -7
- package/dist/types/formatters/rfc7807/schemas.d.ts +0 -162
- package/dist/types/index.d.ts +0 -11
- package/dist/types/middleware/ban-middleware.d.ts +0 -23
- package/dist/types/middleware/index.d.ts +0 -5
- package/dist/types/types/common.d.ts +0 -12
- package/dist/types/types/error.d.ts +0 -39
- package/dist/types/types/formatter.d.ts +0 -43
- package/dist/types/types/index.d.ts +0 -9
- package/dist/types/types/options.d.ts +0 -54
- package/dist/types/types/rfc7807.d.ts +0 -77
- package/dist/types/utils/index.d.ts +0 -6
- package/dist/types/utils/sanitize.d.ts +0 -10
- package/dist/types/utils/validate.d.ts +0 -10
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# hono-ban
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`95a62e1`](https://github.com/ali-issa/hono-ban/commit/95a62e17f663f5f30522eda7fb76d4ef63b3487c) Thanks [@ali-issa](https://github.com/ali-issa)! - Validate options at construction instead of producing broken responses.
|
|
8
|
+
|
|
9
|
+
- `problemDetails()` throws `TypeError` when `traceIdMember` names a reserved member (`status`,
|
|
10
|
+
`id`, `errors`, ...) or is not an RFC 9457 extension member name; `jsonApi()` rejects a
|
|
11
|
+
`traceIdMetaKey` the format writes itself (`stack`, `location`, `code`, ...) or that is not a
|
|
12
|
+
JSON:API member name; `googleApi()` rejects a `traceIdMetadataKey` outside the
|
|
13
|
+
`ErrorInfo.metadata` key grammar. Previously `traceIdMember: 'status'` replaced the numeric status
|
|
14
|
+
with the trace id.
|
|
15
|
+
- `ban.onError()` throws `TypeError` when `errorIdHeader`, `requestIdHeader`, or `headers` holds a
|
|
16
|
+
name or value `Headers` rejects. Previously the failure surfaced inside the handler's last-resort
|
|
17
|
+
fallback and the handler rejected.
|
|
18
|
+
- `googleApi()` drops `meta` keys that do not match `[a-z][a-zA-Z0-9-_]+` or exceed 64 characters,
|
|
19
|
+
as `error_details.proto` requires for `ErrorInfo.metadata`, and the 2020-12 schema states the rule
|
|
20
|
+
with `propertyNames`. Keys such as `order.id` or `UserId` were previously sent as-is.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`95a62e1`](https://github.com/ali-issa/hono-ban/commit/95a62e17f663f5f30522eda7fb76d4ef63b3487c) Thanks [@ali-issa](https://github.com/ali-issa)! - Keep every rendered validation body inside its own schema and the handler inside its guarantee.
|
|
25
|
+
|
|
26
|
+
- `jsonApi()` renders one summary error object for `ban.validation([])` instead of an empty `errors`
|
|
27
|
+
array its schema rejects; `googleApi()` omits `BadRequest` when there are no issues instead of
|
|
28
|
+
sending an empty `fieldViolations`.
|
|
29
|
+
- `assertFormatConformance` from `hono-ban/testing` now also renders a validation error with no
|
|
30
|
+
issues per location.
|
|
31
|
+
- `ban.onError()` gains a third fallback tier: when the header merge itself throws, the response
|
|
32
|
+
still carries `Content-Type`, `Cache-Control: no-store`, and the error id header.
|
|
33
|
+
|
|
34
|
+
## 1.0.0
|
|
35
|
+
|
|
36
|
+
### Major Changes
|
|
37
|
+
|
|
38
|
+
- [`efcb0b6`](https://github.com/ali-issa/hono-ban/commit/efcb0b6bd24a598bf0e8868bff9942ec248a7868) Thanks [@ali-issa](https://github.com/ali-issa)! - First 1.0 release. `createBan()` builds a typed error catalog with a factory per IANA status and per
|
|
39
|
+
custom entry, `ban.onError()` renders every thrown value once through a pluggable format (RFC 9457
|
|
40
|
+
Problem Details by default; JSON:API, Google API (AIP-193), Stripe, and plain built in;
|
|
41
|
+
`defineFormat()` for your own), validator hooks for Zod, Valibot, and Standard Schema throw into the
|
|
42
|
+
handler, `hono-ban/openapi` derives response schemas from the active format, and `hono-ban/otel`
|
|
43
|
+
adds trace ids. Error responses carry `Cache-Control: no-store` unless you set one, and
|
|
44
|
+
`bearerChallenge()` builds RFC 6750 and RFC 9728 `WWW-Authenticate` values. `hono` is the only peer
|
|
45
|
+
dependency.
|
|
46
|
+
|
|
47
|
+
## 1.0.0-alpha.1
|
|
48
|
+
|
|
49
|
+
### Major Changes
|
|
50
|
+
|
|
51
|
+
- First 1.0 release. `createBan()` builds a typed error catalog with a factory per IANA status and per
|
|
52
|
+
custom entry, `ban.onError()` renders every thrown value once through a pluggable format (RFC 9457
|
|
53
|
+
Problem Details by default; JSON:API, Google API (AIP-193), Stripe, and plain built in;
|
|
54
|
+
`defineFormat()` for your own), validator hooks for Zod, Valibot, and Standard Schema throw into the
|
|
55
|
+
handler, `hono-ban/openapi` derives response schemas from the active format, and `hono-ban/otel`
|
|
56
|
+
adds trace ids. Error responses carry `Cache-Control: no-store` unless you set one, and
|
|
57
|
+
`bearerChallenge()` builds RFC 6750 and RFC 9728 `WWW-Authenticate` values. `hono` is the only peer
|
|
58
|
+
dependency.
|
|
59
|
+
|
|
60
|
+
Release notes are generated by [Changesets](https://github.com/changesets/changesets) from the
|
|
61
|
+
entries in `.changeset/` when a version PR is merged.
|
package/{LICENSE.md → LICENSE}
RENAMED