sa2kit 2.0.2 → 2.0.4
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/README.md +1 -1
- package/dist/calendar/routes/index.d.mts +118 -0
- package/dist/calendar/routes/index.d.ts +118 -0
- package/dist/calendar/routes/index.js +755 -0
- package/dist/calendar/routes/index.js.map +1 -0
- package/dist/calendar/routes/index.mjs +747 -0
- package/dist/calendar/routes/index.mjs.map +1 -0
- package/dist/festivalCard/index.d.mts +3 -2
- package/dist/festivalCard/index.d.ts +3 -2
- package/dist/festivalCard/routes/index.d.mts +42 -0
- package/dist/festivalCard/routes/index.d.ts +42 -0
- package/dist/festivalCard/routes/index.js +361 -0
- package/dist/festivalCard/routes/index.js.map +1 -0
- package/dist/festivalCard/routes/index.mjs +356 -0
- package/dist/festivalCard/routes/index.mjs.map +1 -0
- package/dist/festivalCard/server/index.d.mts +2 -2
- package/dist/festivalCard/server/index.d.ts +2 -2
- package/dist/festivalCardService-BFCRhJrq.d.ts +13 -0
- package/dist/festivalCardService-GriR2VMc.d.mts +13 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/{festivalCardService-CZomuQ4E.d.mts → types-tQfupO6d.d.mts} +1 -11
- package/dist/{festivalCardService-CZomuQ4E.d.ts → types-tQfupO6d.d.ts} +1 -11
- package/package.json +26 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
一个现代的、类型安全的跨平台工具库。**2.0 重构进行中**:拆分为 `common`(通用逻辑,供 Web / Taro / Electron / Hono 等多项目接入)与 `business`(业务逻辑,逐步迁回 profile-v1)。
|
|
4
4
|
|
|
5
5
|
> 📋 **重构任务 SSOT**:[docs/REFACTOR_2.0_BACKLOG.md](./docs/REFACTOR_2.0_BACKLOG.md)
|
|
6
|
-
> 当前版本:`2.0.
|
|
6
|
+
> 当前版本:`2.0.4`(**common API 稳定**;business 实验田模块逐步迁出,见 [COMMON_API_FREEZE.md](./docs/COMMON_API_FREEZE.md))
|
|
7
7
|
|
|
8
8
|
### 2.0 推荐 import(common)
|
|
9
9
|
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
interface CalendarRouteConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Drizzle 数据库实例
|
|
6
|
+
* 如果提供,将自动初始化 calendarDbService
|
|
7
|
+
*/
|
|
8
|
+
db?: any;
|
|
9
|
+
/**
|
|
10
|
+
* 验证用户身份的函数
|
|
11
|
+
* 应该返回用户信息或 null
|
|
12
|
+
*/
|
|
13
|
+
validateAuth: (request: NextRequest) => Promise<{
|
|
14
|
+
id: number;
|
|
15
|
+
} | null>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 创建获取日历事件列表的处理器
|
|
19
|
+
*/
|
|
20
|
+
declare function createGetEventsHandler(config: CalendarRouteConfig): (request: NextRequest) => Promise<NextResponse<{
|
|
21
|
+
success: boolean;
|
|
22
|
+
error: string;
|
|
23
|
+
}> | NextResponse<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
data: any;
|
|
26
|
+
message: string;
|
|
27
|
+
}>>;
|
|
28
|
+
/**
|
|
29
|
+
* 创建日历事件的处理器
|
|
30
|
+
*/
|
|
31
|
+
declare function createCreateEventHandler(config: CalendarRouteConfig): (request: NextRequest) => Promise<NextResponse<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
error: string;
|
|
34
|
+
}> | NextResponse<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
data: any;
|
|
37
|
+
message: string;
|
|
38
|
+
}>>;
|
|
39
|
+
/**
|
|
40
|
+
* 创建获取单个事件的处理器
|
|
41
|
+
*/
|
|
42
|
+
declare function createGetEventByIdHandler(config: CalendarRouteConfig): (request: NextRequest, { params }: {
|
|
43
|
+
params: {
|
|
44
|
+
id: string;
|
|
45
|
+
};
|
|
46
|
+
}) => Promise<NextResponse<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
error: string;
|
|
49
|
+
}> | NextResponse<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
data: any;
|
|
52
|
+
message: string;
|
|
53
|
+
}>>;
|
|
54
|
+
/**
|
|
55
|
+
* 创建更新事件的处理器
|
|
56
|
+
*/
|
|
57
|
+
declare function createUpdateEventHandler(config: CalendarRouteConfig): (request: NextRequest, { params }: {
|
|
58
|
+
params: {
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
}) => Promise<NextResponse<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
error: string;
|
|
64
|
+
}> | NextResponse<{
|
|
65
|
+
success: boolean;
|
|
66
|
+
data: any;
|
|
67
|
+
message: string;
|
|
68
|
+
}>>;
|
|
69
|
+
/**
|
|
70
|
+
* 创建删除事件的处理器
|
|
71
|
+
*/
|
|
72
|
+
declare function createDeleteEventHandler(config: CalendarRouteConfig): (request: NextRequest, { params }: {
|
|
73
|
+
params: {
|
|
74
|
+
id: string;
|
|
75
|
+
};
|
|
76
|
+
}) => Promise<NextResponse<{
|
|
77
|
+
success: boolean;
|
|
78
|
+
error: string;
|
|
79
|
+
}> | NextResponse<{
|
|
80
|
+
success: boolean;
|
|
81
|
+
message: string;
|
|
82
|
+
}>>;
|
|
83
|
+
/**
|
|
84
|
+
* 创建批量删除事件的处理器
|
|
85
|
+
*/
|
|
86
|
+
declare function createBatchDeleteEventsHandler(config: CalendarRouteConfig): (request: NextRequest) => Promise<NextResponse<{
|
|
87
|
+
success: boolean;
|
|
88
|
+
error: string;
|
|
89
|
+
}> | NextResponse<{
|
|
90
|
+
success: boolean;
|
|
91
|
+
data: {
|
|
92
|
+
deletedCount: number;
|
|
93
|
+
};
|
|
94
|
+
message: string;
|
|
95
|
+
}>>;
|
|
96
|
+
/**
|
|
97
|
+
* 创建配置处理器的工厂
|
|
98
|
+
*/
|
|
99
|
+
declare function createConfigHandler(config: CalendarRouteConfig): {
|
|
100
|
+
GET: (request: NextRequest) => Promise<NextResponse<{
|
|
101
|
+
success: boolean;
|
|
102
|
+
error: string;
|
|
103
|
+
}> | NextResponse<{
|
|
104
|
+
success: boolean;
|
|
105
|
+
data: any;
|
|
106
|
+
message: string;
|
|
107
|
+
}>>;
|
|
108
|
+
PUT: (request: NextRequest) => Promise<NextResponse<{
|
|
109
|
+
success: boolean;
|
|
110
|
+
error: string;
|
|
111
|
+
}> | NextResponse<{
|
|
112
|
+
success: boolean;
|
|
113
|
+
data: any;
|
|
114
|
+
message: string;
|
|
115
|
+
}>>;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export { type CalendarRouteConfig, createBatchDeleteEventsHandler, createConfigHandler, createCreateEventHandler, createDeleteEventHandler, createGetEventByIdHandler, createGetEventsHandler, createUpdateEventHandler };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
interface CalendarRouteConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Drizzle 数据库实例
|
|
6
|
+
* 如果提供,将自动初始化 calendarDbService
|
|
7
|
+
*/
|
|
8
|
+
db?: any;
|
|
9
|
+
/**
|
|
10
|
+
* 验证用户身份的函数
|
|
11
|
+
* 应该返回用户信息或 null
|
|
12
|
+
*/
|
|
13
|
+
validateAuth: (request: NextRequest) => Promise<{
|
|
14
|
+
id: number;
|
|
15
|
+
} | null>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 创建获取日历事件列表的处理器
|
|
19
|
+
*/
|
|
20
|
+
declare function createGetEventsHandler(config: CalendarRouteConfig): (request: NextRequest) => Promise<NextResponse<{
|
|
21
|
+
success: boolean;
|
|
22
|
+
error: string;
|
|
23
|
+
}> | NextResponse<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
data: any;
|
|
26
|
+
message: string;
|
|
27
|
+
}>>;
|
|
28
|
+
/**
|
|
29
|
+
* 创建日历事件的处理器
|
|
30
|
+
*/
|
|
31
|
+
declare function createCreateEventHandler(config: CalendarRouteConfig): (request: NextRequest) => Promise<NextResponse<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
error: string;
|
|
34
|
+
}> | NextResponse<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
data: any;
|
|
37
|
+
message: string;
|
|
38
|
+
}>>;
|
|
39
|
+
/**
|
|
40
|
+
* 创建获取单个事件的处理器
|
|
41
|
+
*/
|
|
42
|
+
declare function createGetEventByIdHandler(config: CalendarRouteConfig): (request: NextRequest, { params }: {
|
|
43
|
+
params: {
|
|
44
|
+
id: string;
|
|
45
|
+
};
|
|
46
|
+
}) => Promise<NextResponse<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
error: string;
|
|
49
|
+
}> | NextResponse<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
data: any;
|
|
52
|
+
message: string;
|
|
53
|
+
}>>;
|
|
54
|
+
/**
|
|
55
|
+
* 创建更新事件的处理器
|
|
56
|
+
*/
|
|
57
|
+
declare function createUpdateEventHandler(config: CalendarRouteConfig): (request: NextRequest, { params }: {
|
|
58
|
+
params: {
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
}) => Promise<NextResponse<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
error: string;
|
|
64
|
+
}> | NextResponse<{
|
|
65
|
+
success: boolean;
|
|
66
|
+
data: any;
|
|
67
|
+
message: string;
|
|
68
|
+
}>>;
|
|
69
|
+
/**
|
|
70
|
+
* 创建删除事件的处理器
|
|
71
|
+
*/
|
|
72
|
+
declare function createDeleteEventHandler(config: CalendarRouteConfig): (request: NextRequest, { params }: {
|
|
73
|
+
params: {
|
|
74
|
+
id: string;
|
|
75
|
+
};
|
|
76
|
+
}) => Promise<NextResponse<{
|
|
77
|
+
success: boolean;
|
|
78
|
+
error: string;
|
|
79
|
+
}> | NextResponse<{
|
|
80
|
+
success: boolean;
|
|
81
|
+
message: string;
|
|
82
|
+
}>>;
|
|
83
|
+
/**
|
|
84
|
+
* 创建批量删除事件的处理器
|
|
85
|
+
*/
|
|
86
|
+
declare function createBatchDeleteEventsHandler(config: CalendarRouteConfig): (request: NextRequest) => Promise<NextResponse<{
|
|
87
|
+
success: boolean;
|
|
88
|
+
error: string;
|
|
89
|
+
}> | NextResponse<{
|
|
90
|
+
success: boolean;
|
|
91
|
+
data: {
|
|
92
|
+
deletedCount: number;
|
|
93
|
+
};
|
|
94
|
+
message: string;
|
|
95
|
+
}>>;
|
|
96
|
+
/**
|
|
97
|
+
* 创建配置处理器的工厂
|
|
98
|
+
*/
|
|
99
|
+
declare function createConfigHandler(config: CalendarRouteConfig): {
|
|
100
|
+
GET: (request: NextRequest) => Promise<NextResponse<{
|
|
101
|
+
success: boolean;
|
|
102
|
+
error: string;
|
|
103
|
+
}> | NextResponse<{
|
|
104
|
+
success: boolean;
|
|
105
|
+
data: any;
|
|
106
|
+
message: string;
|
|
107
|
+
}>>;
|
|
108
|
+
PUT: (request: NextRequest) => Promise<NextResponse<{
|
|
109
|
+
success: boolean;
|
|
110
|
+
error: string;
|
|
111
|
+
}> | NextResponse<{
|
|
112
|
+
success: boolean;
|
|
113
|
+
data: any;
|
|
114
|
+
message: string;
|
|
115
|
+
}>>;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export { type CalendarRouteConfig, createBatchDeleteEventsHandler, createConfigHandler, createCreateEventHandler, createDeleteEventHandler, createGetEventByIdHandler, createGetEventsHandler, createUpdateEventHandler };
|