@wthek/koa-middleware 0.0.0-stage → 1.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 ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Himanshu Bansal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,3 +1,179 @@
1
- # Temporary Holding Version
1
+ # Official @wthek Extension – Koa Middleware for `http-error-kit`
2
+
3
+ **Seamless Koa Error Handling with @wthek**
4
+
5
+ _Built for applications powered by [http-error-kit][http-error-kit], this middleware ensures that all `http-error-kit` errors are properly formatted and returned with the correct HTTP status codes in Koa._
6
+
7
+ > 💡 What the HEK?! Need a hassle-free way to manage error responses for `http-error-kit` errors in Koa? `@wthek/koa-middleware` has got you covered!
8
+
9
+ ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/skillnter/wthek-koa-middleware/main.yml)
10
+ [![npm version](https://img.shields.io/npm/v/%40wthek%2Fkoa-middleware?color=brightgreen)](https://www.npmjs.com/package/@wthek/koa-middleware)
11
+ [![GitHub license](https://img.shields.io/github/license/skillnter/wthek-koa-middleware?color=brightgreen)](LICENSE)
12
+ [![GitHub Issues](https://img.shields.io/github/issues/Skillnter/wthek-koa-middleware)](https://github.com/Skillnter/wthek-koa-middleware/issues)
13
+ ![npm](https://img.shields.io/npm/dy/%40wthek%2Fkoa-middleware)
14
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/%40wthek%2Fkoa-middleware)](https://bundlephobia.com/package/%40wthek%2Fkoa-middleware)
15
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/8cb84abac51c4e67b0e8c7a0730d1a40)](https://app.codacy.com/gh/Skillnter/wthek-koa-middleware/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
16
+ [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/8cb84abac51c4e67b0e8c7a0730d1a40)](https://app.codacy.com/gh/Skillnter/wthek-koa-middleware/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
17
+ [![Socket Badge](https://socket.dev/api/badge/npm/package/@wthek/koa-middleware/1.0.0)](https://socket.dev/npm/package/@wthek/koa-middleware/overview/1.0.0)
18
+ [![Github Sponsors](https://img.shields.io/badge/GitHub%20Sponsors-30363D?&logo=GitHub-Sponsors&logoColor=EA4AAA)](https://github.com/sponsors/Skillnter)
19
+ [![Open Collective](https://img.shields.io/badge/Open%20Collective-3385FF?logo=open-collective&logoColor=white)](https://opencollective.com/skillnter)
20
+ [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/skillnter)
21
+ [![Patreon](https://img.shields.io/badge/Patreon-F96854?logo=patreon&logoColor=white)](https://www.patreon.com/skillnter)
22
+ [![PayPal](https://img.shields.io/badge/PayPal-003087?logo=paypal&logoColor=fff)](https://www.paypal.me/skillnte)
23
+
24
+ ## Features
25
+
26
+ - **Official `http-error-kit` Extension** – The idiomatic error-handling middleware for Koa applications.
27
+ - **Onion Architecture First** – Wraps downstream middleware in `try ... catch` at the top of your Koa stack.
28
+ - **Auto-sets HTTP Status & Body** – Automatically sets `ctx.status` and `ctx.body` from `KitHttpError` or `KitGeneralError`.
29
+ - **Streaming & Header Safety** – Automatically avoids double writes if `ctx.headerSent` is true.
30
+ - **Configurable Logging** – Support for boolean logging or custom logger callbacks (Pino, Winston).
31
+ - **`handleUnknownErrors` Option** – Catch unexpected errors and return structured 500 JSON responses.
32
+ - **`emitAppError` Option** – Optionally trigger Koa's application-level `app.emit('error', err, ctx)` for central monitoring.
33
+
34
+ ## Table of Contents
35
+
36
+ - [Installation](#installation)
37
+ - [Usage](#usage)
38
+ - [Options](#options)
39
+ - [Custom Formatting with KitHttpErrorConfig](#custom-formatting-with-kithttperrorconfig)
40
+ - [Explore More WTHek Extensions](#explore-more-wthek-extensions)
41
+ - [People](#people)
42
+ - [Donations](#donations)
43
+ - [License](#license)
44
+
45
+ ## Installation
46
+
47
+ ```console
48
+ npm install @wthek/koa-middleware
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ `KitKoaMiddleware` supports both **direct registration** (passing `app` as first argument, like Fastify & Hono) and the **middleware factory pattern** (passing returned middleware into `app.use()`, like Express & standard Koa).
54
+
55
+ Place it **near or at the very top** of your Koa stack so it wraps all downstream middleware in `try ... catch`.
56
+
57
+ ### Pattern 1: Direct Registration (Recommended)
58
+
59
+ ```typescript
60
+ import Koa from "koa";
61
+ import { KitKoaMiddleware } from "@wthek/koa-middleware";
62
+ import { KitHttpError } from "http-error-kit";
63
+ import { NOT_FOUND } from "http-response-status-code";
64
+
65
+ const app = new Koa();
66
+
67
+ // 1. Direct registration at the top of the stack
68
+ KitKoaMiddleware(app, {
69
+ log: true,
70
+ handleUnknownErrors: true,
71
+ emitAppError: true,
72
+ });
73
+
74
+ // 2. Downstream routes / middleware
75
+ app.use(async (ctx) => {
76
+ if (ctx.path === "/user") {
77
+ throw new KitHttpError(NOT_FOUND, "User Not Found", {
78
+ userId: ctx.query.id,
79
+ });
80
+ }
81
+ ctx.body = { message: "Hello Koa" };
82
+ });
83
+
84
+ app.listen(3000);
85
+ ```
86
+
87
+ ### Pattern 2: Middleware Factory (`app.use`)
88
+
89
+ ```typescript
90
+ // Alternatively, pass into app.use() directly:
91
+ app.use(
92
+ KitKoaMiddleware({
93
+ log: true,
94
+ handleUnknownErrors: true,
95
+ emitAppError: true,
96
+ }),
97
+ );
98
+ ```
99
+
100
+ ### Custom Logging Example
101
+
102
+ ```typescript
103
+ import Koa from "koa";
104
+ import { KitKoaMiddleware } from "@wthek/koa-middleware";
105
+ import pino from "pino";
106
+
107
+ const logger = pino();
108
+ const app = new Koa();
109
+
110
+ app.use(
111
+ KitKoaMiddleware({
112
+ log: (error, ctx) => {
113
+ logger.error({ err: error, url: ctx.url, method: ctx.method }, "Request failed");
114
+ },
115
+ handleUnknownErrors: true,
116
+ }),
117
+ );
118
+ ```
119
+
120
+ ## Options
121
+
122
+ | Option | Type | Default | Description |
123
+ | :--- | :--- | :--- | :--- |
124
+ | `log` | `boolean \| ((error: unknown, ctx: Context) => void)` | `false` | When `true`, logs via `console.error`. When a function is provided, receives `(error, ctx)` for custom logging. |
125
+ | `handleUnknownErrors` | `boolean` | `false` | When `true`, unhandled non-Kit errors return a structured 500 JSON response instead of re-throwing. |
126
+ | `emitAppError` | `boolean` | `false` | When `true`, emits `ctx.app.emit("error", error, ctx)` so central Koa error listeners can monitor errors. |
127
+
128
+ ## Custom Formatting with `KitHttpErrorConfig`
129
+
130
+ Customize the output JSON payload across all errors globally:
131
+
132
+ ```typescript
133
+ import { KitHttpErrorConfig } from "http-error-kit";
134
+
135
+ KitHttpErrorConfig.configureFormatter(
136
+ (statusCode, message, details, ...args) => ({
137
+ timestamp: new Date().toISOString(),
138
+ status: statusCode,
139
+ error: message,
140
+ details,
141
+ }),
142
+ );
143
+ ```
144
+
145
+ ## Explore More WTHek Extensions
146
+
147
+ The WTHek ecosystem continues to grow with new extensions to simplify error handling across various frameworks and libraries. Stay updated with the latest tools that integrate seamlessly with `http-error-kit`.
148
+
149
+ **Check out the official list of extensions**: [Official Extensions List](https://github.com/Skillnter/http-error-kit/wiki/Official-Extensions-List)
150
+
151
+ ## People
152
+
153
+ The original author of the project is [Himanshu Bansal][skillnter]
154
+
155
+ ## Donations
156
+
157
+ **This is all voluntary work**, so if you want to support my efforts you can:
158
+
159
+ - [Buy Me A Coffee](https://www.buymeacoffee.com/skillnter)
160
+ - [PayPal](https://www.paypal.me/skillnte)
161
+ - [GitHub Sponsors](https://github.com/sponsors/Skillnter)
162
+ - [Patreon](https://www.patreon.com/skillnter)
163
+ - [Open Collective](https://opencollective.com/skillnter)
164
+
165
+ You can also use crypto:
166
+
167
+ ![BNB: 0x1D59a291391a3CE17C63D5dC50F258Dc0Ab62889](https://img.shields.io/badge/BNB-0x1D59a291391a3CE17C63D5dC50F258Dc0Ab62889-brightgreen)
168
+
169
+ ![BTC: bc1p22h4nsad5d8ketyhuvf0vyva6unttxwzzqvkty5r839as0mlclgs72d3mf](https://img.shields.io/badge/BTC-bc1p22h4nsad5d8ketyhuvf0vyva6unttxwzzqvkty5r839as0mlclgs72d3mf-brightgreen)
170
+
171
+ ![ETH: 0x1D59a291391a3CE17C63D5dC50F258Dc0Ab62889](https://img.shields.io/badge/ETH-0x1D59a291391a3CE17C63D5dC50F258Dc0Ab62889-brightgreen)
172
+
173
+ ## License
174
+
175
+ `@wthek/koa-middleware` project is open-sourced software licensed under the [MIT license](LICENSE) by [Himanshu Bansal][skillnter].
176
+
177
+ [skillnter]: https://github.com/Skillnter/
178
+ [http-error-kit]: https://www.npmjs.com/package/http-error-kit
2
179
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
@@ -0,0 +1,59 @@
1
+ import type { Context, default as Koa, Middleware } from "koa";
2
+ /**
3
+ * Configuration options for KitKoaMiddleware.
4
+ */
5
+ export interface IKitKoaMiddlewareOptions {
6
+ /**
7
+ * Optional logger callback or boolean flag.
8
+ * When set to `true`, errors are logged via `console.error`.
9
+ * When set to a function, the function receives the error and context
10
+ * for custom logging (e.g. Pino, Winston).
11
+ *
12
+ * @default false
13
+ */
14
+ log?: boolean | ((error: unknown, ctx: Context) => void);
15
+ /**
16
+ * If true, catches non-Kit errors and returns a structured 500 JSON response
17
+ * instead of re-throwing them downstream.
18
+ *
19
+ * @default false
20
+ */
21
+ handleUnknownErrors?: boolean;
22
+ /**
23
+ * Optional flag to emit Koa application error events via
24
+ * `ctx.app.emit("error", error, ctx)`. Useful for centralized error monitoring
25
+ * tools (such as Sentry or Datadog) that listen on `app.on("error")`.
26
+ *
27
+ * @default false
28
+ */
29
+ emitAppError?: boolean;
30
+ }
31
+ /**
32
+ * Koa error-handling middleware for applications powered by `http-error-kit`.
33
+ * Supports two usage patterns:
34
+ * 1. Direct registration: `KitKoaMiddleware(app, options)` (like Fastify & Hono)
35
+ * 2. Middleware factory: `app.use(KitKoaMiddleware(options))` (like Express & Koa idioms)
36
+ *
37
+ * In accordance with Koa's onion architecture, this middleware wraps downstream
38
+ * handlers in a `try ... catch` block.
39
+ *
40
+ * @param {Koa | IKitKoaMiddlewareOptions} [appOrOptions] Koa application instance or options object.
41
+ * @param {IKitKoaMiddlewareOptions} [options] Options when app is passed as first argument.
42
+ * @returns {Middleware} A Koa-compatible middleware function.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * import Koa from "koa";
47
+ * import { KitKoaMiddleware } from "@wthek/koa-middleware";
48
+ *
49
+ * const app = new Koa();
50
+ *
51
+ * // Pattern 1: Direct registration (Hono / Fastify style)
52
+ * KitKoaMiddleware(app, { log: true, handleUnknownErrors: true });
53
+ *
54
+ * // Pattern 2: Middleware factory (Express / Koa app.use style)
55
+ * app.use(KitKoaMiddleware({ log: true, handleUnknownErrors: true }));
56
+ * ```
57
+ */
58
+ export declare const KitKoaMiddleware: (appOrOptions?: Koa | IKitKoaMiddlewareOptions, options?: IKitKoaMiddlewareOptions) => Middleware;
59
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.KitKoaMiddleware = void 0;
40
+ var http_error_kit_1 = require("http-error-kit");
41
+ var http_response_status_code_1 = require("http-response-status-code");
42
+ /**
43
+ * Helper to log errors according to options.
44
+ */
45
+ var logError = function (error, ctx, log) {
46
+ if (!log) {
47
+ return;
48
+ }
49
+ if (typeof log === "function") {
50
+ log(error, ctx);
51
+ return;
52
+ }
53
+ console.error(error);
54
+ };
55
+ /**
56
+ * Helper to emit application error events if configured.
57
+ */
58
+ var emitError = function (error, ctx, emitAppError) {
59
+ if (emitAppError && ctx.app && typeof ctx.app.emit === "function") {
60
+ ctx.app.emit("error", error, ctx);
61
+ }
62
+ };
63
+ /**
64
+ * Helper to format and assign Kit error payloads to context.
65
+ */
66
+ var handleKitError = function (error, ctx) {
67
+ var _a;
68
+ var inputs = error.getInputs();
69
+ var statusCode = ((_a = inputs === null || inputs === void 0 ? void 0 : inputs.statusCode) !== null && _a !== void 0 ? _a : http_response_status_code_1.INTERNAL_SERVER_ERROR);
70
+ var payload = typeof error.toJSON === "function" ? error.toJSON() : error;
71
+ ctx.status = statusCode;
72
+ ctx.body = payload;
73
+ };
74
+ /**
75
+ * Helper to format structured 500 response for unknown errors.
76
+ */
77
+ var handleUnknownError = function (ctx) {
78
+ ctx.status = http_response_status_code_1.INTERNAL_SERVER_ERROR;
79
+ ctx.body = {
80
+ message: (0, http_response_status_code_1.getStatusDescription)(http_response_status_code_1.INTERNAL_SERVER_ERROR),
81
+ statusCode: http_response_status_code_1.INTERNAL_SERVER_ERROR,
82
+ };
83
+ };
84
+ /**
85
+ * Koa error-handling middleware for applications powered by `http-error-kit`.
86
+ * Supports two usage patterns:
87
+ * 1. Direct registration: `KitKoaMiddleware(app, options)` (like Fastify & Hono)
88
+ * 2. Middleware factory: `app.use(KitKoaMiddleware(options))` (like Express & Koa idioms)
89
+ *
90
+ * In accordance with Koa's onion architecture, this middleware wraps downstream
91
+ * handlers in a `try ... catch` block.
92
+ *
93
+ * @param {Koa | IKitKoaMiddlewareOptions} [appOrOptions] Koa application instance or options object.
94
+ * @param {IKitKoaMiddlewareOptions} [options] Options when app is passed as first argument.
95
+ * @returns {Middleware} A Koa-compatible middleware function.
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * import Koa from "koa";
100
+ * import { KitKoaMiddleware } from "@wthek/koa-middleware";
101
+ *
102
+ * const app = new Koa();
103
+ *
104
+ * // Pattern 1: Direct registration (Hono / Fastify style)
105
+ * KitKoaMiddleware(app, { log: true, handleUnknownErrors: true });
106
+ *
107
+ * // Pattern 2: Middleware factory (Express / Koa app.use style)
108
+ * app.use(KitKoaMiddleware({ log: true, handleUnknownErrors: true }));
109
+ * ```
110
+ */
111
+ var KitKoaMiddleware = function (appOrOptions, options) {
112
+ var _a;
113
+ if (appOrOptions && typeof appOrOptions.use === "function") {
114
+ var middleware = (0, exports.KitKoaMiddleware)(options);
115
+ appOrOptions.use(middleware);
116
+ return middleware;
117
+ }
118
+ var _b = (_a = appOrOptions) !== null && _a !== void 0 ? _a : {}, _c = _b.log, log = _c === void 0 ? false : _c, _d = _b.handleUnknownErrors, handleUnknownErrors = _d === void 0 ? false : _d, _e = _b.emitAppError, emitAppError = _e === void 0 ? false : _e;
119
+ return function (ctx, next) { return __awaiter(void 0, void 0, void 0, function () {
120
+ var error_1;
121
+ return __generator(this, function (_a) {
122
+ switch (_a.label) {
123
+ case 0:
124
+ _a.trys.push([0, 2, , 3]);
125
+ return [4 /*yield*/, next()];
126
+ case 1:
127
+ _a.sent();
128
+ return [3 /*break*/, 3];
129
+ case 2:
130
+ error_1 = _a.sent();
131
+ logError(error_1, ctx, log);
132
+ emitError(error_1, ctx, emitAppError);
133
+ if (ctx.headerSent) {
134
+ return [2 /*return*/];
135
+ }
136
+ if (error_1 instanceof http_error_kit_1.KitHttpError || error_1 instanceof http_error_kit_1.KitGeneralError) {
137
+ handleKitError(error_1, ctx);
138
+ return [2 /*return*/];
139
+ }
140
+ if (handleUnknownErrors) {
141
+ handleUnknownError(ctx);
142
+ return [2 /*return*/];
143
+ }
144
+ throw error_1;
145
+ case 3: return [2 /*return*/];
146
+ }
147
+ });
148
+ }); };
149
+ };
150
+ exports.KitKoaMiddleware = KitKoaMiddleware;
package/package.json CHANGED
@@ -1,6 +1,109 @@
1
1
  {
2
2
  "name": "@wthek/koa-middleware",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Production-safe Koa error-handling middleware for http-error-kit. Maps KitHttpError instances to structured JSON responses with correct HTTP status codes and optional logging.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "sideEffects": false,
15
+ "scripts": {
16
+ "test": "jest --config jest.config.ts",
17
+ "build": "tsc --build",
18
+ "coverage": "jest --coverage --config jest.config.ts",
19
+ "prepublishOnly": "npm run test && npm run build"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/Skillnter/wthek-koa-middleware.git"
24
+ },
25
+ "keywords": [
26
+ "http",
27
+ "error",
28
+ "kit",
29
+ "http-errors",
30
+ "custom-errors",
31
+ "error-handling",
32
+ "koa",
33
+ "koa2",
34
+ "koa-middleware",
35
+ "koa-error-handler",
36
+ "koajs",
37
+ "rest-api",
38
+ "status-codes",
39
+ "api-error",
40
+ "json-error",
41
+ "typescript",
42
+ "middleware",
43
+ "wthek",
44
+ "skillnter"
45
+ ],
46
+ "author": "Himanshu Bansal <skillhimanshubansal@gmail.com>",
47
+ "license": "MIT",
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/Skillnter/wthek-koa-middleware/issues"
53
+ },
54
+ "homepage": "https://github.com/Skillnter/wthek-koa-middleware#readme",
55
+ "dependencies": {
56
+ "http-error-kit": "^1.2.0",
57
+ "http-response-status-code": "^1.8.0"
58
+ },
59
+ "peerDependencies": {
60
+ "koa": "^2.0.0 || ^3.0.0"
61
+ },
62
+ "devDependencies": {
63
+ "@types/jest": "^29.5.14",
64
+ "@types/koa": "^2.15.0",
65
+ "@types/node": "^22.13.4",
66
+ "@types/supertest": "^6.0.2",
67
+ "@typescript-eslint/eslint-plugin": "^8.22.0",
68
+ "eslint": "^8.57.1",
69
+ "eslint-plugin-security": "^3.0.1",
70
+ "jest": "^29.7.0",
71
+ "koa": "^2.15.3",
72
+ "supertest": "^7.0.0",
73
+ "ts-jest": "^29.2.5",
74
+ "ts-node": "^10.9.2",
75
+ "tslib": "^2.8.1",
76
+ "typescript": "^5.7.3"
77
+ },
78
+ "publishConfig": {
79
+ "@skillnter:registry": "https://npm.pkg.github.com/"
80
+ },
81
+ "files": [
82
+ "dist/index.js",
83
+ "dist/index.d.ts",
84
+ "LICENSE"
85
+ ],
86
+ "funding": [
87
+ {
88
+ "type": "github",
89
+ "url": "https://github.com/sponsors/Skillnter"
90
+ },
91
+ {
92
+ "type": "patreon",
93
+ "url": "https://www.patreon.com/skillnter"
94
+ },
95
+ {
96
+ "type": "open_collective",
97
+ "url": "https://opencollective.com/skillnter"
98
+ },
99
+ {
100
+ "type": "buy_me_a_coffee",
101
+ "url": "https://buymeacoffee.com/skillnter"
102
+ },
103
+ {
104
+ "type": "paypal",
105
+ "url": "https://paypal.me/skillhimanshubansal"
106
+ }
107
+ ]
108
+ }
109
+