@camcima/nestjs-rfc9457 0.0.2 → 0.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/README.md +61 -2
- package/package.json +16 -13
package/README.md
CHANGED
|
@@ -7,17 +7,35 @@
|
|
|
7
7
|
<br>
|
|
8
8
|
|
|
9
9
|
[](https://github.com/camcima/nestjs-rfc9457/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/camcima/nestjs-rfc9457/actions/workflows/codeql.yml)
|
|
10
11
|
[](https://codecov.io/gh/camcima/nestjs-rfc9457)
|
|
11
12
|
[](https://www.npmjs.com/package/@camcima/nestjs-rfc9457)
|
|
12
|
-
[](https://www.npmjs.com/package/@camcima/nestjs-rfc9457)
|
|
13
13
|
[](https://opensource.org/licenses/MIT)
|
|
14
|
-
[](https://www.typescriptlang.org/)
|
|
15
15
|
[](https://nodejs.org/)
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
19
|
NestJS library for [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) Problem Details HTTP error responses.
|
|
20
20
|
|
|
21
|
+
## Table of Contents
|
|
22
|
+
|
|
23
|
+
- [What is RFC 9457?](#what-is-rfc-9457)
|
|
24
|
+
- [Features](#features)
|
|
25
|
+
- [Installation](#installation)
|
|
26
|
+
- [Quick Start](#quick-start)
|
|
27
|
+
- [Configuration](#configuration)
|
|
28
|
+
- [Async Configuration](#async-configuration)
|
|
29
|
+
- [Custom Exception Types](#custom-exception-types)
|
|
30
|
+
- [Validation Integration](#validation-integration)
|
|
31
|
+
- [Advanced Usage](#advanced-usage)
|
|
32
|
+
- [API Reference](#api-reference)
|
|
33
|
+
- [Example Responses](#example-responses)
|
|
34
|
+
- [Examples](#examples)
|
|
35
|
+
- [Security](#security)
|
|
36
|
+
- [Contributing](#contributing)
|
|
37
|
+
- [License](#license)
|
|
38
|
+
|
|
21
39
|
## What is RFC 9457?
|
|
22
40
|
|
|
23
41
|
[RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) (July 2023) defines a standard JSON format for HTTP API error responses, using the `application/problem+json` media type. It supersedes RFC 7807 and gives APIs a consistent, machine-readable way to communicate errors.
|
|
@@ -719,6 +737,47 @@ Internal error messages are never included in the response to avoid leaking sens
|
|
|
719
737
|
|
|
720
738
|
---
|
|
721
739
|
|
|
740
|
+
## Examples
|
|
741
|
+
|
|
742
|
+
See the [nestjs-rfc9457-examples](https://github.com/camcima/nestjs-rfc9457-examples) repository for complete working NestJS applications demonstrating all features, including runnable demo scripts.
|
|
743
|
+
|
|
744
|
+
---
|
|
745
|
+
|
|
746
|
+
## Security
|
|
747
|
+
|
|
748
|
+
### CI
|
|
749
|
+
|
|
750
|
+
| Tool | Purpose | Trigger |
|
|
751
|
+
| --------------- | -------------------------------------------------------- | ------------------------- |
|
|
752
|
+
| **CodeQL** | Static analysis for security vulnerabilities | Push, PR, weekly schedule |
|
|
753
|
+
| **OSV-Scanner** | Dependency vulnerability scanning (production deps only) | Push, PR |
|
|
754
|
+
| **Dependabot** | Automated dependency and GitHub Actions updates | Weekly PRs |
|
|
755
|
+
| **Codecov** | Test coverage tracking | Push, PR |
|
|
756
|
+
|
|
757
|
+
### Local (via Lefthook)
|
|
758
|
+
|
|
759
|
+
| Hook | Tool | Purpose |
|
|
760
|
+
| ------------ | ------------------------------------------------ | ---------------------------- |
|
|
761
|
+
| `pre-commit` | ESLint + Prettier | Code quality on staged files |
|
|
762
|
+
| `pre-push` | [Gitleaks](https://github.com/gitleaks/gitleaks) | Secret scanning before push |
|
|
763
|
+
|
|
764
|
+
Gitleaks must be [installed locally](https://github.com/gitleaks/gitleaks#installing). The pre-push hook will skip if Gitleaks is not available.
|
|
765
|
+
|
|
766
|
+
### Manual local checks
|
|
767
|
+
|
|
768
|
+
```bash
|
|
769
|
+
# Dependency audit (production only)
|
|
770
|
+
npm run audit:deps
|
|
771
|
+
|
|
772
|
+
# Secret scanning
|
|
773
|
+
npm run audit:secrets
|
|
774
|
+
|
|
775
|
+
# Full npm audit (all dependencies)
|
|
776
|
+
npm audit
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
722
781
|
## Contributing
|
|
723
782
|
|
|
724
783
|
Contributions are welcome. Please open an issue before submitting a pull request for significant changes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camcima/nestjs-rfc9457",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "NestJS library for RFC 9457 Problem Details responses",
|
|
5
5
|
"author": "Carlos Cima",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"test:e2e": "jest --testPathPattern=test/e2e",
|
|
23
23
|
"test:cov": "jest --coverage",
|
|
24
24
|
"prepublishOnly": "npm run build",
|
|
25
|
-
"release": "release-it"
|
|
25
|
+
"release": "release-it",
|
|
26
|
+
"audit:deps": "npm audit --omit=dev",
|
|
27
|
+
"audit:secrets": "gitleaks git --no-banner --redact -v"
|
|
26
28
|
},
|
|
27
29
|
"peerDependencies": {
|
|
28
30
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
@@ -36,15 +38,16 @@
|
|
|
36
38
|
}
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
|
-
"@commitlint/cli": "^
|
|
40
|
-
"@commitlint/config-conventional": "^
|
|
41
|
-
"@nestjs/common": "^
|
|
42
|
-
"@nestjs/core": "^
|
|
43
|
-
"@nestjs/platform-express": "^
|
|
44
|
-
"@nestjs/platform-fastify": "^
|
|
45
|
-
"@nestjs/testing": "^
|
|
46
|
-
"@types/jest": "^
|
|
47
|
-
"@types/
|
|
41
|
+
"@commitlint/cli": "^20.5.0",
|
|
42
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
43
|
+
"@nestjs/common": "^11.1.18",
|
|
44
|
+
"@nestjs/core": "^11.1.18",
|
|
45
|
+
"@nestjs/platform-express": "^11.1.18",
|
|
46
|
+
"@nestjs/platform-fastify": "^11.1.18",
|
|
47
|
+
"@nestjs/testing": "^11.1.18",
|
|
48
|
+
"@types/jest": "^30.0.0",
|
|
49
|
+
"@types/node": "^22.19.17",
|
|
50
|
+
"@types/supertest": "^7.2.0",
|
|
48
51
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
49
52
|
"@typescript-eslint/parser": "^7.0.0",
|
|
50
53
|
"class-transformer": "^0.5.0",
|
|
@@ -53,7 +56,7 @@
|
|
|
53
56
|
"eslint-config-prettier": "^9.0.0",
|
|
54
57
|
"eslint-plugin-prettier": "^5.0.0",
|
|
55
58
|
"fastify": "^4.0.0",
|
|
56
|
-
"jest": "^
|
|
59
|
+
"jest": "^30.3.0",
|
|
57
60
|
"lefthook": "^1.0.0",
|
|
58
61
|
"prettier": "^3.0.0",
|
|
59
62
|
"reflect-metadata": "^0.2.0",
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
"supertest": "^7.0.0",
|
|
63
66
|
"ts-jest": "^29.0.0",
|
|
64
67
|
"ts-node": "^10.9.2",
|
|
65
|
-
"typescript": "^
|
|
68
|
+
"typescript": "^6.0.2"
|
|
66
69
|
},
|
|
67
70
|
"repository": {
|
|
68
71
|
"type": "git",
|