http-response-kit 1.0.0 → 2.0.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.
Files changed (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +357 -272
  3. package/dist/chunk-373JVXMN.mjs +1199 -0
  4. package/dist/chunk-373JVXMN.mjs.map +1 -0
  5. package/dist/chunk-FFRB2EUE.mjs +36 -0
  6. package/dist/chunk-FFRB2EUE.mjs.map +1 -0
  7. package/dist/express.d.mts +50 -0
  8. package/dist/express.d.ts +50 -0
  9. package/dist/express.js +1155 -0
  10. package/dist/express.js.map +1 -0
  11. package/dist/express.mjs +28 -0
  12. package/dist/express.mjs.map +1 -0
  13. package/dist/fastify.d.mts +45 -0
  14. package/dist/fastify.d.ts +45 -0
  15. package/dist/fastify.js +1170 -0
  16. package/dist/fastify.js.map +1 -0
  17. package/dist/fastify.mjs +43 -0
  18. package/dist/fastify.mjs.map +1 -0
  19. package/dist/hono.d.mts +33 -0
  20. package/dist/hono.d.ts +33 -0
  21. package/dist/hono.js +1139 -0
  22. package/dist/hono.js.map +1 -0
  23. package/dist/hono.mjs +18 -0
  24. package/dist/hono.mjs.map +1 -0
  25. package/dist/index.d.mts +75 -493
  26. package/dist/index.d.ts +75 -493
  27. package/dist/index.js +480 -180
  28. package/dist/index.js.map +1 -0
  29. package/dist/index.mjs +18 -891
  30. package/dist/index.mjs.map +1 -0
  31. package/dist/kit-nHfihlKE.d.mts +753 -0
  32. package/dist/kit-nHfihlKE.d.ts +753 -0
  33. package/dist/koa.d.mts +38 -0
  34. package/dist/koa.d.ts +38 -0
  35. package/dist/koa.js +1150 -0
  36. package/dist/koa.js.map +1 -0
  37. package/dist/koa.mjs +24 -0
  38. package/dist/koa.mjs.map +1 -0
  39. package/dist/schemas.d.mts +452 -0
  40. package/dist/schemas.d.ts +452 -0
  41. package/dist/schemas.js +124 -0
  42. package/dist/schemas.js.map +1 -0
  43. package/dist/schemas.mjs +119 -0
  44. package/dist/schemas.mjs.map +1 -0
  45. package/dist/shared-Czwmz6Xa.d.ts +22 -0
  46. package/dist/shared-DYq1Fic4.d.mts +22 -0
  47. package/package.json +104 -49
@@ -0,0 +1,119 @@
1
+ // src/schemas/index.ts
2
+ var validationIssueSchema = {
3
+ type: "object",
4
+ required: ["field", "message"],
5
+ properties: {
6
+ field: { type: "string", description: "Field/path that failed validation" },
7
+ message: { type: "string", description: "Human-readable description" },
8
+ code: { type: "string", description: "Stable machine-readable code" }
9
+ },
10
+ additionalProperties: false
11
+ };
12
+ var successResponseSchema = {
13
+ $schema: "https://json-schema.org/draft/2020-12/schema",
14
+ $id: "https://github.com/matteo-teodori/http-response-kit/schemas/success-response.json",
15
+ title: "SuccessResponse",
16
+ type: "object",
17
+ required: ["success", "status_code"],
18
+ properties: {
19
+ success: { const: true },
20
+ status_code: { type: "integer", minimum: 100, maximum: 399 },
21
+ timestamp: { type: "string", format: "date-time" },
22
+ request_id: { type: "string" },
23
+ data: {},
24
+ message: { type: "string" },
25
+ metadata: { type: "object" }
26
+ }
27
+ };
28
+ var errorResponseSchema = {
29
+ $schema: "https://json-schema.org/draft/2020-12/schema",
30
+ $id: "https://github.com/matteo-teodori/http-response-kit/schemas/error-response.json",
31
+ title: "ErrorResponse",
32
+ type: "object",
33
+ required: ["success", "status_code", "error"],
34
+ properties: {
35
+ success: { const: false },
36
+ status_code: { type: "integer", minimum: 400, maximum: 599 },
37
+ timestamp: { type: "string", format: "date-time" },
38
+ request_id: { type: "string" },
39
+ retry_after: { type: "number" },
40
+ error: {
41
+ type: "object",
42
+ required: ["type", "title", "message"],
43
+ properties: {
44
+ type: { type: "string" },
45
+ title: { type: "string" },
46
+ message: { type: "string" },
47
+ code: { type: "string" },
48
+ details: { type: "string" },
49
+ errors: { type: "array", items: validationIssueSchema },
50
+ stack: { type: "string" },
51
+ causes: { type: "array", items: { type: "string" } }
52
+ }
53
+ },
54
+ metadata: { type: "object" }
55
+ }
56
+ };
57
+ var problemDetailsSchema = {
58
+ $schema: "https://json-schema.org/draft/2020-12/schema",
59
+ $id: "https://github.com/matteo-teodori/http-response-kit/schemas/problem-details.json",
60
+ title: "ProblemDetails",
61
+ description: "RFC 9457 Problem Details for HTTP APIs",
62
+ type: "object",
63
+ required: ["type", "title", "status"],
64
+ properties: {
65
+ type: { type: "string", format: "uri-reference", default: "about:blank" },
66
+ title: { type: "string" },
67
+ status: { type: "integer", minimum: 100, maximum: 599 },
68
+ detail: { type: "string" },
69
+ instance: { type: "string", format: "uri-reference" },
70
+ code: { type: "string" },
71
+ errors: { type: "array", items: validationIssueSchema },
72
+ request_id: { type: "string" }
73
+ }
74
+ };
75
+ var openApiComponents = {
76
+ schemas: {
77
+ SuccessResponse: successResponseSchema,
78
+ ErrorResponse: errorResponseSchema,
79
+ ProblemDetails: problemDetailsSchema
80
+ },
81
+ responses: {
82
+ BadRequest: {
83
+ description: "Bad Request",
84
+ content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } }
85
+ },
86
+ Unauthorized: {
87
+ description: "Unauthorized",
88
+ content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } }
89
+ },
90
+ Forbidden: {
91
+ description: "Forbidden",
92
+ content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } }
93
+ },
94
+ NotFound: {
95
+ description: "Not Found",
96
+ content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } }
97
+ },
98
+ UnprocessableEntity: {
99
+ description: "Validation failed",
100
+ content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } }
101
+ },
102
+ TooManyRequests: {
103
+ description: "Too Many Requests",
104
+ content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } }
105
+ },
106
+ InternalServerError: {
107
+ description: "Internal Server Error",
108
+ content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } }
109
+ },
110
+ Problem: {
111
+ description: "RFC 9457 Problem Details",
112
+ content: { "application/problem+json": { schema: { $ref: "#/components/schemas/ProblemDetails" } } }
113
+ }
114
+ }
115
+ };
116
+
117
+ export { errorResponseSchema, openApiComponents, problemDetailsSchema, successResponseSchema };
118
+ //# sourceMappingURL=schemas.mjs.map
119
+ //# sourceMappingURL=schemas.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/index.ts"],"names":[],"mappings":";AAYA,IAAM,qBAAA,GAAwB;AAAA,EAC1B,IAAA,EAAM,QAAA;AAAA,EACN,QAAA,EAAU,CAAC,OAAA,EAAS,SAAS,CAAA;AAAA,EAC7B,UAAA,EAAY;AAAA,IACR,KAAA,EAAO,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,mCAAA,EAAoC;AAAA,IAC1E,OAAA,EAAS,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,4BAAA,EAA6B;AAAA,IACrE,IAAA,EAAM,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,8BAAA;AAA+B,GACxE;AAAA,EACA,oBAAA,EAAsB;AAC1B,CAAA;AAGO,IAAM,qBAAA,GAAwB;AAAA,EACjC,OAAA,EAAS,8CAAA;AAAA,EACT,GAAA,EAAK,mFAAA;AAAA,EACL,KAAA,EAAO,iBAAA;AAAA,EACP,IAAA,EAAM,QAAA;AAAA,EACN,QAAA,EAAU,CAAC,SAAA,EAAW,aAAa,CAAA;AAAA,EACnC,UAAA,EAAY;AAAA,IACR,OAAA,EAAS,EAAE,KAAA,EAAO,IAAA,EAAK;AAAA,IACvB,aAAa,EAAE,IAAA,EAAM,WAAW,OAAA,EAAS,GAAA,EAAK,SAAS,GAAA,EAAI;AAAA,IAC3D,SAAA,EAAW,EAAE,IAAA,EAAM,QAAA,EAAU,QAAQ,WAAA,EAAY;AAAA,IACjD,UAAA,EAAY,EAAE,IAAA,EAAM,QAAA,EAAS;AAAA,IAC7B,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,EAAE,IAAA,EAAM,QAAA,EAAS;AAAA,IAC1B,QAAA,EAAU,EAAE,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AAc;AAAA,MACV,WAAA,EAAa,cAAA;AAAA,MACb,OAAA,EAAS,EAAE,kBAAA,EAAoB,EAAE,QAAQ,EAAE,IAAA,EAAM,oCAAA,EAAqC,EAAE;AAAE,KAC9F;AAAA,IACA,SAAA,EAAW;AAAA,MACP,WAAA,EAAa,WAAA;AAAA,MACb,OAAA,EAAS,EAAE,kBAAA,EAAoB,EAAE,QAAQ,EAAE,IAAA,EAAM,oCAAA,EAAqC,EAAE;AAAE,KAC9F;AAAA,IACA,QAAA,EAAU;AAAA,MACN,WAAA,EAAa,WAAA;AAAA,MACb,OAAA,EAAS,EAAE,kBAAA,EAAoB,EAAE,QAAQ,EAAE,IAAA,EAAM,oCAAA,EAAqC,EAAE;AAAE,KAC9F;AAAA,IACA,mBAAA,EAAqB;AAAA,MACjB,WAAA,EAAa,mBAAA;AAAA,MACb,OAAA,EAAS,EAAE,kBAAA,EAAoB,EAAE,QAAQ,EAAE,IAAA,EAAM,oCAAA,EAAqC,EAAE;AAAE,KAC9F;AAAA,IACA,eAAA,EAAiB;AAAA,MACb,WAAA,EAAa,mBAAA;AAAA,MACb,OAAA,EAAS,EAAE,kBAAA,EAAoB,EAAE,QAAQ,EAAE,IAAA,EAAM,oCAAA,EAAqC,EAAE;AAAE,KAC9F;AAAA,IACA,mBAAA,EAAqB;AAAA,MACjB,WAAA,EAAa,uBAAA;AAAA,MACb,OAAA,EAAS,EAAE,kBAAA,EAAoB,EAAE,QAAQ,EAAE,IAAA,EAAM,oCAAA,EAAqC,EAAE;AAAE,KAC9F;AAAA,IACA,OAAA,EAAS;AAAA,MACL,WAAA,EAAa,0BAAA;AAAA,MACb,OAAA,EAAS,EAAE,0BAAA,EAA4B,EAAE,QAAQ,EAAE,IAAA,EAAM,qCAAA,EAAsC,EAAE;AAAE;AACvG;AAER","file":"schemas.mjs","sourcesContent":["/**\n * HTTP Response Kit - JSON Schemas\n *\n * Machine-readable JSON Schema (draft 2020-12) definitions of the response\n * shapes, usable for contract testing, gateway validation, and OpenAPI specs.\n *\n * Import from the dedicated subpath to keep your main bundle lean:\n * `import { errorResponseSchema } from 'http-response-kit/schemas'`\n *\n * @module schemas\n */\n\nconst validationIssueSchema = {\n type: 'object',\n required: ['field', 'message'],\n properties: {\n field: { type: 'string', description: 'Field/path that failed validation' },\n message: { type: 'string', description: 'Human-readable description' },\n code: { type: 'string', description: 'Stable machine-readable code' },\n },\n additionalProperties: false,\n} as const;\n\n/** JSON Schema for the standard success envelope */\nexport const successResponseSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n $id: 'https://github.com/matteo-teodori/http-response-kit/schemas/success-response.json',\n title: 'SuccessResponse',\n type: 'object',\n required: ['success', 'status_code'],\n properties: {\n success: { const: true },\n status_code: { type: 'integer', minimum: 100, maximum: 399 },\n timestamp: { type: 'string', format: 'date-time' },\n request_id: { type: 'string' },\n data: {},\n message: { type: 'string' },\n metadata: { type: 'object' },\n },\n} as const;\n\n/** JSON Schema for the standard error envelope */\nexport const errorResponseSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n $id: 'https://github.com/matteo-teodori/http-response-kit/schemas/error-response.json',\n title: 'ErrorResponse',\n type: 'object',\n required: ['success', 'status_code', 'error'],\n properties: {\n success: { const: false },\n status_code: { type: 'integer', minimum: 400, maximum: 599 },\n timestamp: { type: 'string', format: 'date-time' },\n request_id: { type: 'string' },\n retry_after: { type: 'number' },\n error: {\n type: 'object',\n required: ['type', 'title', 'message'],\n properties: {\n type: { type: 'string' },\n title: { type: 'string' },\n message: { type: 'string' },\n code: { type: 'string' },\n details: { type: 'string' },\n errors: { type: 'array', items: validationIssueSchema },\n stack: { type: 'string' },\n causes: { type: 'array', items: { type: 'string' } },\n },\n },\n metadata: { type: 'object' },\n },\n} as const;\n\n/** JSON Schema for RFC 9457 Problem Details (with common extensions) */\nexport const problemDetailsSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n $id: 'https://github.com/matteo-teodori/http-response-kit/schemas/problem-details.json',\n title: 'ProblemDetails',\n description: 'RFC 9457 Problem Details for HTTP APIs',\n type: 'object',\n required: ['type', 'title', 'status'],\n properties: {\n type: { type: 'string', format: 'uri-reference', default: 'about:blank' },\n title: { type: 'string' },\n status: { type: 'integer', minimum: 100, maximum: 599 },\n detail: { type: 'string' },\n instance: { type: 'string', format: 'uri-reference' },\n code: { type: 'string' },\n errors: { type: 'array', items: validationIssueSchema },\n request_id: { type: 'string' },\n },\n} as const;\n\n/**\n * Ready-to-merge OpenAPI 3.1 `components` fragment.\n *\n * @example\n * ```ts\n * const spec = { openapi: '3.1.0', ...yourSpec, components: { schemas: { ...openApiComponents.schemas } } };\n * ```\n */\nexport const openApiComponents = {\n schemas: {\n SuccessResponse: successResponseSchema,\n ErrorResponse: errorResponseSchema,\n ProblemDetails: problemDetailsSchema,\n },\n responses: {\n BadRequest: {\n description: 'Bad Request',\n content: { 'application/json': { schema: { $ref: '#/components/schemas/ErrorResponse' } } },\n },\n Unauthorized: {\n description: 'Unauthorized',\n content: { 'application/json': { schema: { $ref: '#/components/schemas/ErrorResponse' } } },\n },\n Forbidden: {\n description: 'Forbidden',\n content: { 'application/json': { schema: { $ref: '#/components/schemas/ErrorResponse' } } },\n },\n NotFound: {\n description: 'Not Found',\n content: { 'application/json': { schema: { $ref: '#/components/schemas/ErrorResponse' } } },\n },\n UnprocessableEntity: {\n description: 'Validation failed',\n content: { 'application/json': { schema: { $ref: '#/components/schemas/ErrorResponse' } } },\n },\n TooManyRequests: {\n description: 'Too Many Requests',\n content: { 'application/json': { schema: { $ref: '#/components/schemas/ErrorResponse' } } },\n },\n InternalServerError: {\n description: 'Internal Server Error',\n content: { 'application/json': { schema: { $ref: '#/components/schemas/ErrorResponse' } } },\n },\n Problem: {\n description: 'RFC 9457 Problem Details',\n content: { 'application/problem+json': { schema: { $ref: '#/components/schemas/ProblemDetails' } } },\n },\n },\n} as const;\n"]}
@@ -0,0 +1,22 @@
1
+ import { R as ResponseKit, H as HttpError } from './kit-nHfihlKE.js';
2
+
3
+ /**
4
+ * HTTP Response Kit - Shared adapter internals
5
+ * @module adapters/shared
6
+ */
7
+
8
+ /** Options shared by all framework adapters */
9
+ interface AdapterOptions {
10
+ /** Kit instance to use (default: an internal kit with default config) */
11
+ kit?: ResponseKit;
12
+ /** Request header carrying the correlation id (default: "x-request-id") */
13
+ requestIdHeader?: string;
14
+ /** Called with every handled error — hook your logger here */
15
+ onError?: (error: HttpError, requestId?: string) => void;
16
+ /** Override stack inclusion (default: kit dev mode) */
17
+ includeStack?: boolean;
18
+ /** Force RFC 9457 output regardless of kit `format` config */
19
+ problem?: boolean;
20
+ }
21
+
22
+ export type { AdapterOptions as A };
@@ -0,0 +1,22 @@
1
+ import { R as ResponseKit, H as HttpError } from './kit-nHfihlKE.mjs';
2
+
3
+ /**
4
+ * HTTP Response Kit - Shared adapter internals
5
+ * @module adapters/shared
6
+ */
7
+
8
+ /** Options shared by all framework adapters */
9
+ interface AdapterOptions {
10
+ /** Kit instance to use (default: an internal kit with default config) */
11
+ kit?: ResponseKit;
12
+ /** Request header carrying the correlation id (default: "x-request-id") */
13
+ requestIdHeader?: string;
14
+ /** Called with every handled error — hook your logger here */
15
+ onError?: (error: HttpError, requestId?: string) => void;
16
+ /** Override stack inclusion (default: kit dev mode) */
17
+ includeStack?: boolean;
18
+ /** Force RFC 9457 output regardless of kit `format` config */
19
+ problem?: boolean;
20
+ }
21
+
22
+ export type { AdapterOptions as A };
package/package.json CHANGED
@@ -1,49 +1,104 @@
1
- {
2
- "name": "http-response-kit",
3
- "version": "1.0.0",
4
- "description": "A professional HTTP error and response formatting library for Node.js",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
13
- }
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "scripts": {
19
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
20
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
21
- "lint": "tsc --noEmit",
22
- "prepublishOnly": "npm run build"
23
- },
24
- "keywords": [
25
- "http",
26
- "error",
27
- "response",
28
- "api",
29
- "rest",
30
- "status-code",
31
- "express",
32
- "nodejs",
33
- "typescript"
34
- ],
35
- "author": "Matteo Teodori",
36
- "license": "MIT",
37
- "devDependencies": {
38
- "@types/node": "^25.2.1",
39
- "tsup": "^8.0.0",
40
- "typescript": "^5.0.0"
41
- },
42
- "engines": {
43
- "node": ">=16.0.0"
44
- },
45
- "repository": {
46
- "type": "git",
47
- "url": "https://github.com/matteo-teodori/http-response-kit"
48
- }
49
- }
1
+ {
2
+ "name": "http-response-kit",
3
+ "version": "2.0.0",
4
+ "description": "Framework-agnostic HTTP error & response standardization for Node.js - RFC 9457 Problem Details, secure-by-default error exposure, domain error catalogs, and first-class adapters for Express/Fastify/Koa/Hono.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./express": {
15
+ "types": "./dist/express.d.ts",
16
+ "import": "./dist/express.mjs",
17
+ "require": "./dist/express.js"
18
+ },
19
+ "./fastify": {
20
+ "types": "./dist/fastify.d.ts",
21
+ "import": "./dist/fastify.mjs",
22
+ "require": "./dist/fastify.js"
23
+ },
24
+ "./koa": {
25
+ "types": "./dist/koa.d.ts",
26
+ "import": "./dist/koa.mjs",
27
+ "require": "./dist/koa.js"
28
+ },
29
+ "./hono": {
30
+ "types": "./dist/hono.d.ts",
31
+ "import": "./dist/hono.mjs",
32
+ "require": "./dist/hono.js"
33
+ },
34
+ "./schemas": {
35
+ "types": "./dist/schemas.d.ts",
36
+ "import": "./dist/schemas.mjs",
37
+ "require": "./dist/schemas.js"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "sideEffects": false,
42
+ "files": [
43
+ "dist"
44
+ ],
45
+ "scripts": {
46
+ "build": "tsup",
47
+ "dev": "tsup --watch",
48
+ "typecheck": "tsc --noEmit",
49
+ "lint": "eslint .",
50
+ "lint:fix": "eslint . --fix",
51
+ "test": "vitest run",
52
+ "test:watch": "vitest",
53
+ "test:coverage": "vitest run --coverage",
54
+ "ci": "npm run typecheck && npm run lint && npm run test && npm run build",
55
+ "prepublishOnly": "npm run ci"
56
+ },
57
+ "keywords": [
58
+ "http",
59
+ "error",
60
+ "response",
61
+ "api",
62
+ "rest",
63
+ "status-code",
64
+ "rfc-9457",
65
+ "rfc-7807",
66
+ "problem-details",
67
+ "problem+json",
68
+ "error-handling",
69
+ "express",
70
+ "fastify",
71
+ "koa",
72
+ "hono",
73
+ "nodejs",
74
+ "typescript"
75
+ ],
76
+ "author": "Matteo Teodori",
77
+ "license": "MIT",
78
+ "devDependencies": {
79
+ "@eslint/js": "10.0.1",
80
+ "@types/node": "26.1.0",
81
+ "@vitest/coverage-v8": "4.1.10",
82
+ "eslint": "10.6.0",
83
+ "tsup": "8.5.1",
84
+ "tsx": "4.23.0",
85
+ "typescript": "6.0.3",
86
+ "typescript-eslint": "8.62.1",
87
+ "vitest": "4.1.10"
88
+ },
89
+ "engines": {
90
+ "node": ">=20.0.0"
91
+ },
92
+ "publishConfig": {
93
+ "provenance": true,
94
+ "access": "public"
95
+ },
96
+ "repository": {
97
+ "type": "git",
98
+ "url": "git+https://github.com/matteo-teodori/http-response-kit.git"
99
+ },
100
+ "homepage": "https://github.com/matteo-teodori/http-response-kit#readme",
101
+ "bugs": {
102
+ "url": "https://github.com/matteo-teodori/http-response-kit/issues"
103
+ }
104
+ }