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.
Files changed (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +357 -281
  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 -527
  26. package/dist/index.d.ts +75 -527
  27. package/dist/index.js +440 -188
  28. package/dist/index.js.map +1 -0
  29. package/dist/index.mjs +18 -939
  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 -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 };