streamline-code-by-ikun2274 0.12.5 → 0.12.6

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 (2) hide show
  1. package/package.json +1 -1
  2. package/types/index.d.ts +55 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamline-code-by-ikun2274",
3
- "version": "0.12.5",
3
+ "version": "0.12.6",
4
4
  "description": "A streamline Express route builder with database operations, pagination, and authentication",
5
5
  "main": "src/StreamlineCodeIndex.js",
6
6
  "type": "module",
package/types/index.d.ts CHANGED
@@ -2,6 +2,61 @@
2
2
 
3
3
  import express from 'express';
4
4
 
5
+
6
+ // types/index.d.ts
7
+
8
+ // 数据库配置类型
9
+ export interface DbConfig {
10
+ host: string;
11
+ user: string;
12
+ password: string;
13
+ database: string;
14
+ }
15
+
16
+ // 服务器配置类型
17
+ export interface ServerConfig {
18
+ port: number;
19
+ allowedOrigins: string[];
20
+ }
21
+
22
+ // 路由配置类型
23
+ export interface RouteConfig {
24
+ url: string;
25
+ method: 'get' | 'post' | 'put' | 'delete';
26
+ middlewares?: Array<Function>;
27
+ BuiltinMid?: {
28
+ Parameter?: string | string[];
29
+ };
30
+ PlusHandler: {
31
+ db: {
32
+ table: string;
33
+ operation: 'select' | 'read' | 'create' | 'update' | 'delete';
34
+ primaryKey?: string;
35
+ fields?: string;
36
+ categoryField?: string;
37
+ };
38
+ Mode?: {
39
+ pagination?: boolean;
40
+ requireAuth?: boolean;
41
+ shuffle?: boolean;
42
+ pageSize?: number;
43
+ };
44
+ other: {
45
+ successMessage?: string;
46
+ errorMessage?: string;
47
+ customLogic?: Function;
48
+ };
49
+ };
50
+ }
51
+
52
+ // 函数类型定义
53
+ export function setDbConfig(config: DbConfig): void;
54
+ export function startServer(config: ServerConfig): void;
55
+ export function DefineRoutePlus_A(config: RouteConfig): void;
56
+
57
+
58
+
59
+
5
60
  /** 数据库配置接口 */
6
61
  export interface setDbConfig {
7
62
  /** 数据库主机地址 */