koa-ts-core 0.0.5 → 0.0.7

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.
@@ -4,5 +4,5 @@ import Koa from "koa";
4
4
  * @param app - Koa 应用实例
5
5
  * @returns - 可用的端口号
6
6
  */
7
- declare const initializeServer: (app: Koa) => Promise<number>;
7
+ declare const initializeServer: (app: Koa) => Promise<void>;
8
8
  export default initializeServer;
@@ -0,0 +1,7 @@
1
+ import { Middleware } from "koa";
2
+ /**
3
+ * 往global添加属性
4
+ * @param ctx
5
+ */
6
+ declare const requestParamsMiddleware: Middleware;
7
+ export default requestParamsMiddleware;
@@ -0,0 +1,16 @@
1
+ export interface IMetaData {
2
+ method: string;
3
+ description: string;
4
+ path: string;
5
+ request: Request;
6
+ response: Response;
7
+ }
8
+ interface Response {
9
+ body: any;
10
+ }
11
+ interface Request {
12
+ header: Record<string, string>;
13
+ body: any;
14
+ query: any;
15
+ }
16
+ export {};
@@ -22,4 +22,5 @@ export interface RouteConfig {
22
22
  authRequired: boolean;
23
23
  middlewares: Middleware[];
24
24
  className: string;
25
+ apiPrePath: string;
25
26
  }
@@ -22,12 +22,12 @@ export declare const getDefaultExportFromFile: <T = any>(filePath: string) => T
22
22
  */
23
23
  export declare function walkDirectorySync(currentDirPath: string, callback: WalkSyncHandler): void;
24
24
  /**
25
- * 根据路由器的路径生成控制器前缀和类名
25
+ * 根据文件路径和关键字部分生成路径的模块选项
26
26
  * @param {FilePathMeta} filePath - 文件路径元数据
27
27
  * @returns {Object} 包含控制器前缀、模块名和文件名的对象
28
28
  */
29
- export declare const generateControllerOptions: (filePath: FilePathMeta) => {
30
- controllerPrefix: string;
29
+ export declare const generateOptionsByKeyPart: (filePath: FilePathMeta, keyPart: string) => {
30
+ pathPrefix: string;
31
31
  moduleName: string;
32
32
  name: string;
33
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koa-ts-core",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "koa-ts-core",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -26,6 +26,7 @@
26
26
  "dependencies": {
27
27
  "dotenv": "^16.4.7",
28
28
  "koa": "^2.15.4",
29
+ "koa-bodyparser": "^4.4.1",
29
30
  "koa-router": "^13.0.1",
30
31
  "portfinder": "^1.0.37",
31
32
  "pug": "^3.0.3",
@@ -33,10 +34,12 @@
33
34
  },
34
35
  "devDependencies": {
35
36
  "@rollup/plugin-commonjs": "^28.0.3",
37
+ "@rollup/plugin-json": "^6.1.0",
36
38
  "@rollup/plugin-node-resolve": "^16.0.0",
37
39
  "@rollup/plugin-terser": "^0.4.4",
38
40
  "@rollup/plugin-typescript": "^12.1.2",
39
41
  "@types/koa": "^2.15.0",
42
+ "@types/koa-bodyparser": "^4.3.12",
40
43
  "@types/koa-router": "^7.4.8",
41
44
  "@types/node": "^22.13.4",
42
45
  "@types/pug": "^2.0.10",
@@ -50,4 +53,4 @@
50
53
  "engines": {
51
54
  "node": ">=14.0.0"
52
55
  }
53
- }
56
+ }