@koala-ts/framework 0.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/dist/config/config-defaults.d.ts +3 -0
  4. package/dist/config/config-defaults.d.ts.map +1 -0
  5. package/dist/config/config-defaults.js +4 -0
  6. package/dist/config/config-defaults.js.map +1 -0
  7. package/dist/config/index.d.ts +3 -0
  8. package/dist/config/index.d.ts.map +1 -0
  9. package/dist/config/index.js +3 -0
  10. package/dist/config/index.js.map +1 -0
  11. package/dist/config/types.d.ts +4 -0
  12. package/dist/config/types.d.ts.map +1 -0
  13. package/dist/config/types.js +1 -0
  14. package/dist/config/types.js.map +1 -0
  15. package/dist/core/application.d.ts +4 -0
  16. package/dist/core/application.d.ts.map +1 -0
  17. package/dist/core/application.js +21 -0
  18. package/dist/core/application.js.map +1 -0
  19. package/dist/core/index.d.ts +4 -0
  20. package/dist/core/index.d.ts.map +1 -0
  21. package/dist/core/index.js +4 -0
  22. package/dist/core/index.js.map +1 -0
  23. package/dist/core/route.d.ts +5 -0
  24. package/dist/core/route.d.ts.map +1 -0
  25. package/dist/core/route.js +32 -0
  26. package/dist/core/route.js.map +1 -0
  27. package/dist/core/types.d.ts +44 -0
  28. package/dist/core/types.d.ts.map +1 -0
  29. package/dist/core/types.js +1 -0
  30. package/dist/core/types.js.map +1 -0
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +4 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/testing/index.d.ts +3 -0
  36. package/dist/testing/index.d.ts.map +1 -0
  37. package/dist/testing/index.js +3 -0
  38. package/dist/testing/index.js.map +1 -0
  39. package/dist/testing/test-agent.d.ts +4 -0
  40. package/dist/testing/test-agent.d.ts.map +1 -0
  41. package/dist/testing/test-agent.js +6 -0
  42. package/dist/testing/test-agent.js.map +1 -0
  43. package/dist/testing/types.d.ts +4 -0
  44. package/dist/testing/types.d.ts.map +1 -0
  45. package/dist/testing/types.js +1 -0
  46. package/dist/testing/types.js.map +1 -0
  47. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 KoalaTs ~ Mohamad Eldhemy (Dhemy)
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.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Framework
2
+
3
+ ## Todo
4
+
5
+ - [ ] Routing & Middleware
6
+ + [x] Routing
7
+ + [ ] Middleware
8
+ + [ ] Request validation
9
+ + [ ] Guards and Authorization
10
+ - [x] Handlers
11
+ + [x] Register handlers
12
+ + [x] Create responses from views
13
+ + [x] Access request data
14
+ - [ ] Configuration
15
+ - [ ] Database
16
+ - [ ] Caching
17
+ - [ ] Task scheduling
18
+ - [ ] Queues
19
+ - [ ] Logging
20
+ - [ ] Events
21
+ - [ ] Security
22
+ + [ ] Authentication
23
+ + [ ] Authorization
24
+ + [ ] Encryption and Hashing
25
+ + [ ] Helmet
26
+ + [ ] CORS
27
+ + [ ] Rate limiting
28
+ - [ ] Console commands
29
+ - [x] Testing
@@ -0,0 +1,3 @@
1
+ import { IKoalaConfig } from './types.js';
2
+ export declare const koalaDefaultConfig: IKoalaConfig;
3
+ //# sourceMappingURL=config-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-defaults.d.ts","sourceRoot":"","sources":["../../src/config/config-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,kBAAkB,EAAE,YAEhC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export const koalaDefaultConfig = {
2
+ controllers: [],
3
+ };
4
+ //# sourceMappingURL=config-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-defaults.js","sourceRoot":"","sources":["../../src/config/config-defaults.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC5C,WAAW,EAAE,EAAE;CAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './config-defaults.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './config-defaults.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export interface IKoalaConfig {
2
+ controllers: Object[];
3
+ }
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { IApplication } from './types.js';
2
+ import { IKoalaConfig } from '../config/types.js';
3
+ export declare function create(_: IKoalaConfig): IApplication;
4
+ //# sourceMappingURL=application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/core/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAIvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,wBAAgB,MAAM,CAAC,CAAC,EAAE,YAAY,GAAG,YAAY,CAmBpD"}
@@ -0,0 +1,21 @@
1
+ import Koa from 'koa';
2
+ import Router from '@koa/router';
3
+ import { getRoutes } from './route.js';
4
+ import { koaBody } from 'koa-body';
5
+ export function create(_) {
6
+ const app = new Koa();
7
+ const router = new Router();
8
+ getRoutes().forEach((route) => {
9
+ const middlewareStack = [...route.middleware, route.handler];
10
+ for (const method of route.methods) {
11
+ if (route.parseBody) {
12
+ router[method](route.path, koaBody(), ...middlewareStack);
13
+ continue;
14
+ }
15
+ router[method](route.path, ...middlewareStack);
16
+ }
17
+ });
18
+ app.use(router.routes());
19
+ return app;
20
+ }
21
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/core/application.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,UAAU,MAAM,CAAC,CAAe;IAClC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IAEtB,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAE5B,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,KAAqB,EAAE,EAAE;QAC1C,MAAM,eAAe,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7D,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YACjC,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;gBAClB,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,eAAe,CAAC,CAAC;gBAC1D,SAAS;YACb,CAAC;YACD,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,eAAe,CAAC,CAAC;QACnD,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzB,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './types.js';
2
+ export * from './application.js';
3
+ export * from './route.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './types.js';
2
+ export * from './application.js';
3
+ export * from './route.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ import 'reflect-metadata';
2
+ import { IRouteMetadata, IRouteOptions } from './types.js';
3
+ export declare function Route({ method, path, parseBody, middleware }: IRouteOptions): MethodDecorator;
4
+ export declare function getRoutes(): IRouteMetadata[];
5
+ //# sourceMappingURL=route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/core/route.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAW,cAAc,EAAE,aAAa,EAA8B,MAAM,SAAS,CAAC;AAI7F,wBAAgB,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAgB,EAAE,UAAe,EAAE,EAAE,aAAa,GAAG,eAAe,CAYzG;AAED,wBAAgB,SAAS,IAAI,cAAc,EAAE,CAE5C"}
@@ -0,0 +1,32 @@
1
+ import 'reflect-metadata';
2
+ const key = Symbol('Route');
3
+ export function Route({ method, path, parseBody = true, middleware = [] }) {
4
+ return function (target, propertyKey) {
5
+ const routes = Reflect.getMetadata(key, Reflect) || [];
6
+ routes.push({
7
+ path,
8
+ methods: qualifyMethod(method),
9
+ handler: qualifyMiddleware(target, propertyKey),
10
+ parseBody: parseBody,
11
+ middleware: middleware
12
+ });
13
+ Reflect.defineMetadata(key, routes, Reflect);
14
+ };
15
+ }
16
+ export function getRoutes() {
17
+ return Reflect.getMetadata(key, Reflect) || [];
18
+ }
19
+ function qualifyMethod(method) {
20
+ const lowerMethod = method.toLowerCase();
21
+ if (lowerMethod === 'any') {
22
+ return ['get', 'post', 'put', 'patch', 'delete', 'options', 'head'];
23
+ }
24
+ return [lowerMethod];
25
+ }
26
+ function qualifyMiddleware(target, propertyKey) {
27
+ if (typeof target === 'function') {
28
+ return target;
29
+ }
30
+ return target[propertyKey];
31
+ }
32
+ //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C;QAC/B,OAAO,MAAiB,CAAC;IAC7B,CAAC;IAED,OAAQ,MAAc,CAAC,WAAW,CAAY,CAAC;AACnD,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { IncomingMessage, Server, ServerResponse } from 'http';
2
+ import { Middleware } from '@koa/router';
3
+ import { Context, Next, Request } from 'koa';
4
+ import { Http2ServerRequest, Http2ServerResponse } from 'http2';
5
+ export interface IApplication {
6
+ listen(port?: number): Server;
7
+ callback(): (req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse) => Promise<void>;
8
+ }
9
+ export interface IRequest extends Request {
10
+ body?: {
11
+ [key: string]: any;
12
+ };
13
+ }
14
+ export interface IHttpRequest extends IRequest {
15
+ body: {
16
+ [key: string]: any;
17
+ };
18
+ }
19
+ export interface IScope extends Context {
20
+ request: IRequest | IHttpRequest;
21
+ }
22
+ export interface IMiddleware extends Middleware {
23
+ (scope: IScope, next: INext): Promise<INext>;
24
+ }
25
+ export interface INext extends Next {
26
+ }
27
+ export interface Handler extends Middleware {
28
+ }
29
+ export type THttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'head' | 'any' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'ANY';
30
+ export type TRouterMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'head';
31
+ export interface IRouteMetadata {
32
+ path: string;
33
+ methods: TRouterMethod[];
34
+ handler: Handler;
35
+ parseBody: boolean;
36
+ middleware: Middleware[];
37
+ }
38
+ export interface IRouteOptions {
39
+ path: string;
40
+ method: THttpMethod;
41
+ parseBody?: boolean;
42
+ middleware?: Middleware[];
43
+ }
44
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,MAAM,C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G,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7F,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,UAAU,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;CAC7B"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './config/index.js';
2
+ export * from './core/index.js';
3
+ export * from './testing/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './config/index.js';
2
+ export * from './core/index.js';
3
+ export * from './testing/index.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './test-agent.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './test-agent.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { IKoalaConfig } from '../config/index.js';
2
+ import { ITestAgent } from './types.js';
3
+ export declare function testAgent(config: IKoalaConfig): ITestAgent;
4
+ //# sourceMappingURL=test-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-agent.d.ts","sourceRoot":"","sources":["../../src/testing/test-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAE1D"}
@@ -0,0 +1,6 @@
1
+ import supertest from 'supertest';
2
+ import { create } from '../core/index.js';
3
+ export function testAgent(config) {
4
+ return supertest(create(config).callback());
5
+ }
6
+ //# sourceMappingURL=test-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-agent.js","sourceRoot":"","sources":["../../src/testing/test-agent.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,MAAM,UAAU,SAAS,CAAC,MAAoB;IAC1C,OAAO,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import TestAgent from 'supertest/lib/agent';
2
+ export interface ITestAgent extends TestAgent {
3
+ }
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/testing/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAE5C,MAAM,WAAW,UAAW,SAAQ,SAAS;CAE5C"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/testing/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@koala-ts/framework",
3
+ "main": "dist/index.js",
4
+ "type": "module",
5
+ "version": "0.0.1",
6
+ "description": "A NodeJS framework for lazy developers",
7
+ "keywords": [
8
+ "koala",
9
+ "framework",
10
+ "nodejs",
11
+ "typescript"
12
+ ],
13
+ "homepage": "https://koala-ts.github.io/docs/",
14
+ "bugs": {
15
+ "url": "https://github.com/koala-ts/framework/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/koala-ts/framework.git"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "author": {
25
+ "name": "Dhemy",
26
+ "email": "imdhemy@gmail.com",
27
+ "url": "https://imdhemy.com"
28
+ },
29
+ "license": "MIT",
30
+ "scripts": {
31
+ "test": "vitest run --coverage",
32
+ "build": "tsc && tsc-alias",
33
+ "start": "tsx watch playground/main.ts",
34
+ "check-exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
35
+ "release": "changeset version && changeset publish",
36
+ "changeset": "changeset"
37
+ },
38
+ "devDependencies": {
39
+ "@arethetypeswrong/cli": "^0.17.2",
40
+ "@changesets/cli": "^2.27.11",
41
+ "@eslint/js": "^9.17.0",
42
+ "@types/koa__router": "^12.0.4",
43
+ "@types/stack-trace": "^0.0.33",
44
+ "@types/supertest": "^6.0.2",
45
+ "@vitest/coverage-v8": "^2.1.8",
46
+ "eslint": "^9.17.0",
47
+ "globals": "^15.14.0",
48
+ "supertest": "^7.0.0",
49
+ "tsc-alias": "^1.8.10",
50
+ "tsx": "^4.19.2",
51
+ "typescript": "^5.7.2",
52
+ "typescript-eslint": "^8.18.2",
53
+ "vitest": "^2.1.8"
54
+ },
55
+ "dependencies": {
56
+ "@koa/router": "^13.1.0",
57
+ "@types/koa": "^2.15.0",
58
+ "koa": "^2.15.3",
59
+ "koa-body": "^6.0.1",
60
+ "reflect-metadata": "^0.2.2"
61
+ }
62
+ }