http-response-kit 1.1.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.
- package/LICENSE +21 -21
- package/README.md +357 -281
- package/dist/chunk-373JVXMN.mjs +1199 -0
- package/dist/chunk-373JVXMN.mjs.map +1 -0
- package/dist/chunk-FFRB2EUE.mjs +36 -0
- package/dist/chunk-FFRB2EUE.mjs.map +1 -0
- package/dist/express.d.mts +50 -0
- package/dist/express.d.ts +50 -0
- package/dist/express.js +1155 -0
- package/dist/express.js.map +1 -0
- package/dist/express.mjs +28 -0
- package/dist/express.mjs.map +1 -0
- package/dist/fastify.d.mts +45 -0
- package/dist/fastify.d.ts +45 -0
- package/dist/fastify.js +1170 -0
- package/dist/fastify.js.map +1 -0
- package/dist/fastify.mjs +43 -0
- package/dist/fastify.mjs.map +1 -0
- package/dist/hono.d.mts +33 -0
- package/dist/hono.d.ts +33 -0
- package/dist/hono.js +1139 -0
- package/dist/hono.js.map +1 -0
- package/dist/hono.mjs +18 -0
- package/dist/hono.mjs.map +1 -0
- package/dist/index.d.mts +75 -527
- package/dist/index.d.ts +75 -527
- package/dist/index.js +440 -188
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +18 -939
- package/dist/index.mjs.map +1 -0
- package/dist/kit-nHfihlKE.d.mts +753 -0
- package/dist/kit-nHfihlKE.d.ts +753 -0
- package/dist/koa.d.mts +38 -0
- package/dist/koa.d.ts +38 -0
- package/dist/koa.js +1150 -0
- package/dist/koa.js.map +1 -0
- package/dist/koa.mjs +24 -0
- package/dist/koa.mjs.map +1 -0
- package/dist/schemas.d.mts +452 -0
- package/dist/schemas.d.ts +452 -0
- package/dist/schemas.js +124 -0
- package/dist/schemas.js.map +1 -0
- package/dist/schemas.mjs +119 -0
- package/dist/schemas.mjs.map +1 -0
- package/dist/shared-Czwmz6Xa.d.ts +22 -0
- package/dist/shared-DYq1Fic4.d.mts +22 -0
- package/package.json +104 -53
package/dist/koa.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { A as AdapterOptions } from './shared-DYq1Fic4.mjs';
|
|
2
|
+
import './kit-nHfihlKE.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HTTP Response Kit - Koa adapter
|
|
6
|
+
*
|
|
7
|
+
* Zero-dependency (structural typing, no `koa` types needed).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import Koa from 'koa';
|
|
12
|
+
* import { koaErrorHandler } from 'http-response-kit/koa';
|
|
13
|
+
*
|
|
14
|
+
* const app = new Koa();
|
|
15
|
+
* app.use(koaErrorHandler()); // register FIRST
|
|
16
|
+
* // ...other middleware...
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module adapters/koa
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** Minimal structural view of a Koa context */
|
|
23
|
+
interface KoaLikeContext {
|
|
24
|
+
status?: number;
|
|
25
|
+
body?: unknown;
|
|
26
|
+
headers?: Record<string, unknown>;
|
|
27
|
+
request?: {
|
|
28
|
+
headers?: Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
set(name: string, value: string): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Koa error-handling middleware. Register it as the FIRST middleware so it
|
|
34
|
+
* wraps everything downstream.
|
|
35
|
+
*/
|
|
36
|
+
declare function koaErrorHandler(options?: AdapterOptions): (ctx: KoaLikeContext, next: () => Promise<unknown>) => Promise<void>;
|
|
37
|
+
|
|
38
|
+
export { type KoaLikeContext, koaErrorHandler };
|
package/dist/koa.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { A as AdapterOptions } from './shared-Czwmz6Xa.js';
|
|
2
|
+
import './kit-nHfihlKE.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HTTP Response Kit - Koa adapter
|
|
6
|
+
*
|
|
7
|
+
* Zero-dependency (structural typing, no `koa` types needed).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import Koa from 'koa';
|
|
12
|
+
* import { koaErrorHandler } from 'http-response-kit/koa';
|
|
13
|
+
*
|
|
14
|
+
* const app = new Koa();
|
|
15
|
+
* app.use(koaErrorHandler()); // register FIRST
|
|
16
|
+
* // ...other middleware...
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module adapters/koa
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** Minimal structural view of a Koa context */
|
|
23
|
+
interface KoaLikeContext {
|
|
24
|
+
status?: number;
|
|
25
|
+
body?: unknown;
|
|
26
|
+
headers?: Record<string, unknown>;
|
|
27
|
+
request?: {
|
|
28
|
+
headers?: Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
set(name: string, value: string): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Koa error-handling middleware. Register it as the FIRST middleware so it
|
|
34
|
+
* wraps everything downstream.
|
|
35
|
+
*/
|
|
36
|
+
declare function koaErrorHandler(options?: AdapterOptions): (ctx: KoaLikeContext, next: () => Promise<unknown>) => Promise<void>;
|
|
37
|
+
|
|
38
|
+
export { type KoaLikeContext, koaErrorHandler };
|