@fastify-utils/error 1.0.0 → 1.0.1

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": "@fastify-utils/error",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "RFC 9457 Problem Details for HTTP APIs - A standardized error handling package for Node.js",
5
5
  "author": "xcfio",
6
6
  "homepage": "https://github.com/fastify-utils#readme",
@@ -15,9 +15,6 @@
15
15
  "require": "./out/index.cjs"
16
16
  }
17
17
  },
18
- "engines": {
19
- "node": ">=24"
20
- },
21
18
  "keywords": [
22
19
  "rfc9457",
23
20
  "rfc7807",
@@ -42,6 +39,12 @@
42
39
  "access": "public",
43
40
  "tag": "latest"
44
41
  },
42
+ "files": [
43
+ "out"
44
+ ],
45
+ "engines": {
46
+ "node": ">=24"
47
+ },
45
48
  "devDependencies": {
46
49
  "@types/node": "^26.6.5",
47
50
  "@vitest/coverage-v8": "^5.0.5",
@@ -1,26 +0,0 @@
1
- [WARN] Failed to replace env in config: ${NODE_AUTH_TOKEN} in .npmrc key "_authToken"
2
- $ tsdown --config=tsdown.config.mts
3
- ℹ tsdown v0.23.1 powered by rolldown v1.2.14
4
- ℹ config file: /home/runner/work/fastify-utils/fastify-utils/packages/error/tsdown.config.mts
5
- ℹ entry: ./src/index.ts
6
- ℹ target: node24.0.0
7
- ℹ tsconfig: tsconfig.json
8
- ℹ Build start
9
-
10
- WARN We recommend using the ESM format instead of CommonJS.
11
- The ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.
12
- Learn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here
13
-
14
-
15
- WARN TypeScript 7.0 does not yet have a stable API and is experimental. Some options will be unavailable.
16
-
17
- ℹ Emit types with typescript@7.0.2
18
- ℹ [CJS] out/index.cjs 24.17 kB │ gzip: 3.73 kB
19
- ℹ [CJS] 1 files, total: 24.17 kB
20
- ℹ [CJS] out/index.d.cts 15.01 kB │ gzip: 1.95 kB
21
- ℹ [CJS] 1 files, total: 15.01 kB
22
- ✔ Build complete in 663ms
23
- ℹ [ESM] out/index.mjs 24.02 kB │ gzip: 3.67 kB
24
- ℹ [ESM] out/index.d.mts 15.01 kB │ gzip: 1.95 kB
25
- ℹ [ESM] 2 files, total: 39.03 kB
26
- ✔ Build complete in 665ms
@@ -1,109 +0,0 @@
1
- [WARN] Failed to replace env in config: ${NODE_AUTH_TOKEN} in .npmrc key "_authToken"
2
- $ tsc --noEmit && vitest run
3
-
4
-  RUN  v5.0.5 /home/runner/work/fastify-utils/fastify-utils/packages/error
5
- Coverage enabled with v8
6
-
7
- ✓ src/core/http-error.test.ts (8 tests) 7ms
8
- ✓ src/helpers/create-error-by-status/index.test.ts (18 tests) 15ms
9
- ✓ src/errors/client/index.test.ts (28 tests) 15ms
10
- ✓ src/errors/server/factories.test.ts (11 tests) 10ms
11
- ✓ src/helpers/is-valid-rfc9457-json/index.test.ts (12 tests) 6ms
12
- ✓ src/errors/client/factories.test.ts (9 tests) 10ms
13
- ✓ src/errors/cause-propagation.test.ts (9 tests) 10ms
14
- ✓ src/errors/server/index.test.ts (11 tests) 10ms
15
- ✓ src/helpers/get-error-type/index.test.ts (5 tests) 7ms
16
- ✓ src/helpers/normalize-to-string/index.test.ts (12 tests) 20ms
17
- ✓ src/helpers/is-http-error/index.test.ts (6 tests) 5ms
18
- ✓ src/helpers/extract-cause/index.test.ts (3 tests) 5ms
19
- ✓ src/helpers/index.test.ts (6 tests) 6ms
20
- ✓ src/config/configure.test.ts (3 tests) 5ms
21
- ✓ src/index.test.ts (4 tests) 4ms
22
- ✓ src/core/index.test.ts (2 tests) 5ms
23
- ✓ src/config/index.test.ts (2 tests) 3ms
24
-
25
-  Test Files  17 passed (17)
26
-  Tests  149 passed (149)
27
-  Start at  06:15:36
28
-  Duration  1.45s (transform 38%, import 31%, worker 21%, tests 9%)
29
-
30
-  Isolate  17 workers spawned · ~122ms startup each (spawn + environment, per file)
31
-   at least ~567ms faster with isolate: false — reuses workers across files instead of one per file
32
-
33
-  % Coverage report from v8
34
- -------------------|---------|----------|---------|---------|-------------------
35
- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
36
- -------------------|---------|----------|---------|---------|-------------------
37
- All files | 100 | 100 | 100 | 100 |
38
- src | 100 | 100 | 100 | 100 |
39
- error.ts | 100 | 100 | 100 | 100 |
40
- errors.ts | 100 | 100 | 100 | 100 |
41
- index.ts | 0 | 0 | 0 | 0 |
42
- src/config | 100 | 100 | 100 | 100 |
43
- configure.ts | 100 | 100 | 100 | 100 |
44
- error-config.ts | 100 | 100 | 100 | 100 |
45
- get-config.ts | 100 | 100 | 100 | 100 |
46
- index.ts | 0 | 0 | 0 | 0 |
47
- src/core | 100 | 100 | 100 | 100 |
48
- http-error.ts | 100 | 100 | 100 | 100 |
49
- index.ts | 0 | 0 | 0 | 0 |
50
- src/errors/client | 100 | 100 | 100 | 100 |
51
- ...tion-error.ts | 100 | 100 | 100 | 100 |
52
- ...tion-error.ts | 100 | 100 | 100 | 100 |
53
- ...uest-error.ts | 100 | 100 | 100 | 100 |
54
- ...lict-error.ts | 100 | 100 | 100 | 100 |
55
- ...iled-error.ts | 100 | 100 | 100 | 100 |
56
- factories.ts | 100 | 100 | 100 | 100 |
57
- ...ency-error.ts | 100 | 100 | 100 | 100 |
58
- gone-error.ts | 100 | 100 | 100 | 100 |
59
- index.ts | 0 | 0 | 0 | 0 |
60
- ...ired-error.ts | 100 | 100 | 100 | 100 |
61
- locked-error.ts | 100 | 100 | 100 | 100 |
62
- ...owed-error.ts | 100 | 100 | 100 | 100 |
63
- ...uest-error.ts | 100 | 100 | 100 | 100 |
64
- ...able-error.ts | 100 | 100 | 100 | 100 |
65
- ...ound-error.ts | 100 | 100 | 100 | 100 |
66
- ...arge-error.ts | 100 | 100 | 100 | 100 |
67
- ...ired-error.ts | 100 | 100 | 100 | 100 |
68
- ...iled-error.ts | 100 | 100 | 100 | 100 |
69
- ...ired-error.ts | 100 | 100 | 100 | 100 |
70
- ...ired-error.ts | 100 | 100 | 100 | 100 |
71
- ...able-error.ts | 100 | 100 | 100 | 100 |
72
- ...imit-error.ts | 100 | 100 | 100 | 100 |
73
- ...arge-error.ts | 100 | 100 | 100 | 100 |
74
- ...eout-error.ts | 100 | 100 | 100 | 100 |
75
- ...arly-error.ts | 100 | 100 | 100 | 100 |
76
- ...sons-error.ts | 100 | 100 | 100 | 100 |
77
- ...type-error.ts | 100 | 100 | 100 | 100 |
78
- ...ired-error.ts | 100 | 100 | 100 | 100 |
79
- ...long-error.ts | 100 | 100 | 100 | 100 |
80
- ...tion-error.ts | 100 | 100 | 100 | 100 |
81
- src/errors/server | 100 | 100 | 100 | 100 |
82
- ...eway-error.ts | 100 | 100 | 100 | 100 |
83
- factories.ts | 100 | 100 | 100 | 100 |
84
- ...eout-error.ts | 100 | 100 | 100 | 100 |
85
- ...rted-error.ts | 100 | 100 | 100 | 100 |
86
- index.ts | 0 | 0 | 0 | 0 |
87
- ...rage-error.ts | 100 | 100 | 100 | 100 |
88
- ...rver-error.ts | 100 | 100 | 100 | 100 |
89
- ...cted-error.ts | 100 | 100 | 100 | 100 |
90
- ...ired-error.ts | 100 | 100 | 100 | 100 |
91
- ...nded-error.ts | 100 | 100 | 100 | 100 |
92
- ...nted-error.ts | 100 | 100 | 100 | 100 |
93
- ...able-error.ts | 100 | 100 | 100 | 100 |
94
- ...ates-error.ts | 100 | 100 | 100 | 100 |
95
- src/helpers | 0 | 0 | 0 | 0 |
96
- index.ts | 0 | 0 | 0 | 0 |
97
- ...rror-by-status | 100 | 100 | 100 | 100 |
98
- index.ts | 100 | 100 | 100 | 100 |
99
- .../extract-cause | 100 | 100 | 100 | 100 |
100
- index.ts | 100 | 100 | 100 | 100 |
101
- ...get-error-type | 100 | 100 | 100 | 100 |
102
- index.ts | 100 | 100 | 100 | 100 |
103
- .../is-http-error | 100 | 100 | 100 | 100 |
104
- index.ts | 100 | 100 | 100 | 100 |
105
- ...d-rfc9457-json | 100 | 100 | 100 | 100 |
106
- index.ts | 100 | 100 | 100 | 100 |
107
- ...lize-to-string | 100 | 100 | 100 | 100 |
108
- index.ts | 100 | 100 | 100 | 100 |
109
- -------------------|---------|----------|---------|---------|-------------------
package/coverage/base.css DELETED
@@ -1,362 +0,0 @@
1
- body,
2
- html {
3
- margin: 0;
4
- padding: 0;
5
- height: 100%;
6
- }
7
- body {
8
- font-family:
9
- Helvetica Neue,
10
- Helvetica,
11
- Arial;
12
- font-size: 14px;
13
- color: #333;
14
- }
15
- .small {
16
- font-size: 12px;
17
- }
18
- *,
19
- *:after,
20
- *:before {
21
- -webkit-box-sizing: border-box;
22
- -moz-box-sizing: border-box;
23
- box-sizing: border-box;
24
- }
25
- h1 {
26
- font-size: 20px;
27
- margin: 0;
28
- }
29
- h2 {
30
- font-size: 14px;
31
- }
32
- pre {
33
- font:
34
- 12px/1.4 Consolas,
35
- "Liberation Mono",
36
- Menlo,
37
- Courier,
38
- monospace;
39
- margin: 0;
40
- padding: 0;
41
- -moz-tab-size: 2;
42
- -o-tab-size: 2;
43
- tab-size: 2;
44
- }
45
- a {
46
- color: #0074d9;
47
- text-decoration: none;
48
- }
49
- a:hover {
50
- text-decoration: underline;
51
- }
52
- .strong {
53
- font-weight: bold;
54
- }
55
- .space-top1 {
56
- padding: 10px 0 0 0;
57
- }
58
- .pad2y {
59
- padding: 20px 0;
60
- }
61
- .pad1y {
62
- padding: 10px 0;
63
- }
64
- .pad2x {
65
- padding: 0 20px;
66
- }
67
- .pad2 {
68
- padding: 20px;
69
- }
70
- .pad1 {
71
- padding: 10px;
72
- }
73
- .space-left2 {
74
- padding-left: 55px;
75
- }
76
- .space-right2 {
77
- padding-right: 20px;
78
- }
79
- .center {
80
- text-align: center;
81
- }
82
- .clearfix {
83
- display: block;
84
- }
85
- .clearfix:after {
86
- content: "";
87
- display: block;
88
- height: 0;
89
- clear: both;
90
- visibility: hidden;
91
- }
92
- .fl {
93
- float: left;
94
- }
95
- @media only screen and (max-width: 640px) {
96
- .col3 {
97
- width: 100%;
98
- max-width: 100%;
99
- }
100
- .hide-mobile {
101
- display: none !important;
102
- }
103
- }
104
-
105
- .quiet {
106
- color: #7f7f7f;
107
- color: rgba(0, 0, 0, 0.5);
108
- }
109
- .quiet a {
110
- opacity: 0.7;
111
- }
112
-
113
- .fraction {
114
- font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
115
- font-size: 10px;
116
- color: #555;
117
- background: #e8e8e8;
118
- padding: 4px 5px;
119
- border-radius: 3px;
120
- vertical-align: middle;
121
- }
122
-
123
- div.path a:link,
124
- div.path a:visited {
125
- color: #333;
126
- }
127
- table.coverage {
128
- border-collapse: collapse;
129
- margin: 10px 0 0 0;
130
- padding: 0;
131
- }
132
-
133
- table.coverage td {
134
- margin: 0;
135
- padding: 0;
136
- vertical-align: top;
137
- }
138
- table.coverage td.line-count {
139
- text-align: right;
140
- padding: 0 5px 0 20px;
141
- }
142
- table.coverage td.line-coverage {
143
- text-align: right;
144
- padding-right: 10px;
145
- min-width: 20px;
146
- }
147
-
148
- table.coverage td span.cline-any {
149
- display: inline-block;
150
- padding: 0 5px;
151
- width: 100%;
152
- }
153
- .missing-if-branch {
154
- display: inline-block;
155
- margin-right: 5px;
156
- border-radius: 3px;
157
- position: relative;
158
- padding: 0 4px;
159
- background: #333;
160
- color: yellow;
161
- }
162
-
163
- .skip-if-branch {
164
- display: none;
165
- margin-right: 10px;
166
- position: relative;
167
- padding: 0 4px;
168
- background: #ccc;
169
- color: white;
170
- }
171
- .missing-if-branch .typ,
172
- .skip-if-branch .typ {
173
- color: inherit !important;
174
- }
175
- .coverage-summary {
176
- border-collapse: collapse;
177
- width: 100%;
178
- }
179
- .coverage-summary tr {
180
- border-bottom: 1px solid #bbb;
181
- }
182
- .keyline-all {
183
- border: 1px solid #ddd;
184
- }
185
- .coverage-summary td,
186
- .coverage-summary th {
187
- padding: 10px;
188
- }
189
- .coverage-summary tbody {
190
- border: 1px solid #bbb;
191
- }
192
- .coverage-summary td {
193
- border-right: 1px solid #bbb;
194
- }
195
- .coverage-summary td:last-child {
196
- border-right: none;
197
- }
198
- .coverage-summary th {
199
- text-align: left;
200
- font-weight: normal;
201
- white-space: nowrap;
202
- }
203
- .coverage-summary th.file {
204
- border-right: none !important;
205
- }
206
- .coverage-summary th.pct {
207
- }
208
- .coverage-summary th.pic,
209
- .coverage-summary th.abs,
210
- .coverage-summary td.pct,
211
- .coverage-summary td.abs {
212
- text-align: right;
213
- }
214
- .coverage-summary td.file {
215
- white-space: nowrap;
216
- }
217
- .coverage-summary td.pic {
218
- min-width: 120px !important;
219
- }
220
- .coverage-summary tfoot td {
221
- }
222
-
223
- .coverage-summary .sorter {
224
- height: 10px;
225
- width: 7px;
226
- display: inline-block;
227
- margin-left: 0.5em;
228
- background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
229
- }
230
- .coverage-summary .sorted .sorter {
231
- background-position: 0 -20px;
232
- }
233
- .coverage-summary .sorted-desc .sorter {
234
- background-position: 0 -10px;
235
- }
236
- .status-line {
237
- height: 10px;
238
- }
239
- /* yellow */
240
- .cbranch-no {
241
- background: yellow !important;
242
- color: #111;
243
- }
244
- /* dark red */
245
- .red.solid,
246
- .status-line.low,
247
- .low .cover-fill {
248
- background: #c21f39;
249
- }
250
- .low .chart {
251
- border: 1px solid #c21f39;
252
- }
253
- .highlighted,
254
- .highlighted .cstat-no,
255
- .highlighted .fstat-no,
256
- .highlighted .cbranch-no {
257
- background: #c21f39 !important;
258
- }
259
- /* medium red */
260
- .cstat-no,
261
- .fstat-no,
262
- .cbranch-no,
263
- .cbranch-no {
264
- background: #f6c6ce;
265
- }
266
- /* light red */
267
- .low,
268
- .cline-no {
269
- background: #fce1e5;
270
- }
271
- /* light green */
272
- .high,
273
- .cline-yes {
274
- background: rgb(230, 245, 208);
275
- }
276
- /* medium green */
277
- .cstat-yes {
278
- background: rgb(161, 215, 106);
279
- }
280
- /* dark green */
281
- .status-line.high,
282
- .high .cover-fill {
283
- background: rgb(77, 146, 33);
284
- }
285
- .high .chart {
286
- border: 1px solid rgb(77, 146, 33);
287
- }
288
- /* dark yellow (gold) */
289
- .status-line.medium,
290
- .medium .cover-fill {
291
- background: #f9cd0b;
292
- }
293
- .medium .chart {
294
- border: 1px solid #f9cd0b;
295
- }
296
- /* light yellow */
297
- .medium {
298
- background: #fff4c2;
299
- }
300
-
301
- .cstat-skip {
302
- background: #ddd;
303
- color: #111;
304
- }
305
- .fstat-skip {
306
- background: #ddd;
307
- color: #111 !important;
308
- }
309
- .cbranch-skip {
310
- background: #ddd !important;
311
- color: #111;
312
- }
313
-
314
- span.cline-neutral {
315
- background: #eaeaea;
316
- }
317
-
318
- .coverage-summary td.empty {
319
- opacity: 0.5;
320
- padding-top: 4px;
321
- padding-bottom: 4px;
322
- line-height: 1;
323
- color: #888;
324
- }
325
-
326
- .cover-fill,
327
- .cover-empty {
328
- display: inline-block;
329
- height: 12px;
330
- }
331
- .chart {
332
- line-height: 0;
333
- }
334
- .cover-empty {
335
- background: white;
336
- }
337
- .cover-full {
338
- border-right: none !important;
339
- }
340
- pre.prettyprint {
341
- border: none !important;
342
- padding: 0 !important;
343
- margin: 0 !important;
344
- }
345
- .com {
346
- color: #999 !important;
347
- }
348
- .ignore-none {
349
- color: #999;
350
- font-weight: normal;
351
- }
352
-
353
- .wrapper {
354
- min-height: 100%;
355
- height: auto !important;
356
- height: 100%;
357
- margin: 0 auto -48px;
358
- }
359
- .footer,
360
- .push {
361
- height: 48px;
362
- }
@@ -1,82 +0,0 @@
1
- /* eslint-disable */
2
- var jumpToCode = (function init() {
3
- // Classes of code we would like to highlight in the file view
4
- var missingCoverageClasses = [".cbranch-no", ".cstat-no", ".fstat-no"];
5
-
6
- // Elements to highlight in the file listing view
7
- var fileListingElements = ["td.pct.low"];
8
-
9
- // We don't want to select elements that are direct descendants of another match
10
- var notSelector = ":not(" + missingCoverageClasses.join("):not(") + ") > "; // becomes `:not(a):not(b) > `
11
-
12
- // Selector that finds elements on the page to which we can jump
13
- var selector =
14
- fileListingElements.join(", ") +
15
- ", " +
16
- notSelector +
17
- missingCoverageClasses.join(", " + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
18
-
19
- // The NodeList of matching elements
20
- var missingCoverageElements = document.querySelectorAll(selector);
21
-
22
- var currentIndex;
23
-
24
- function toggleClass(index) {
25
- missingCoverageElements.item(currentIndex).classList.remove("highlighted");
26
- missingCoverageElements.item(index).classList.add("highlighted");
27
- }
28
-
29
- function makeCurrent(index) {
30
- toggleClass(index);
31
- currentIndex = index;
32
- missingCoverageElements.item(index).scrollIntoView({
33
- behavior: "smooth",
34
- block: "center",
35
- inline: "center",
36
- });
37
- }
38
-
39
- function goToPrevious() {
40
- var nextIndex = 0;
41
- if (typeof currentIndex !== "number" || currentIndex === 0) {
42
- nextIndex = missingCoverageElements.length - 1;
43
- } else if (missingCoverageElements.length > 1) {
44
- nextIndex = currentIndex - 1;
45
- }
46
-
47
- makeCurrent(nextIndex);
48
- }
49
-
50
- function goToNext() {
51
- var nextIndex = 0;
52
-
53
- if (typeof currentIndex === "number" && currentIndex < missingCoverageElements.length - 1) {
54
- nextIndex = currentIndex + 1;
55
- }
56
-
57
- makeCurrent(nextIndex);
58
- }
59
-
60
- return function jump(event) {
61
- if (
62
- document.getElementById("fileSearch") === document.activeElement &&
63
- document.activeElement != null
64
- ) {
65
- // if we're currently focused on the search input, we don't want to navigate
66
- return;
67
- }
68
-
69
- switch (event.which) {
70
- case 78: // n
71
- case 74: // j
72
- goToNext();
73
- break;
74
- case 66: // b
75
- case 75: // k
76
- case 80: // p
77
- goToPrevious();
78
- break;
79
- }
80
- };
81
- })();
82
- window.addEventListener("keydown", jumpToCode);