sa2kit 1.6.7 → 1.6.9
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/dist/calendar/index.js +334 -399
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/index.mjs +241 -306
- package/dist/calendar/index.mjs.map +1 -1
- package/dist/calendar/routes/index.js +21 -21
- package/dist/calendar/routes/index.mjs +1 -1
- package/dist/calendar/server.js +13 -13
- package/dist/calendar/server.mjs +2 -2
- package/dist/chunk-4FOBBWXW.mjs +179 -0
- package/dist/chunk-4FOBBWXW.mjs.map +1 -0
- package/dist/chunk-CDK3DHKM.mjs +634 -0
- package/dist/chunk-CDK3DHKM.mjs.map +1 -0
- package/dist/chunk-G6WRJ2H2.js +187 -0
- package/dist/chunk-G6WRJ2H2.js.map +1 -0
- package/dist/{chunk-6WXOA4BE.mjs → chunk-GVVS4IMM.mjs} +2 -2
- package/dist/chunk-GVVS4IMM.mjs.map +1 -0
- package/dist/chunk-L5PW2YTI.js +647 -0
- package/dist/chunk-L5PW2YTI.js.map +1 -0
- package/dist/{chunk-AXP7KROR.js → chunk-WC5QFO3T.js} +2 -2
- package/dist/chunk-WC5QFO3T.js.map +1 -0
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/dist/mmd/index.js +2 -2
- package/dist/mmd/index.mjs +1 -1
- package/dist/music/index.js +14 -6
- package/dist/music/index.mjs +1 -1
- package/package.json +41 -7
- package/dist/ConfigService-BxK06xP6.d.mts +0 -262
- package/dist/ConfigService-BxK06xP6.d.ts +0 -262
- package/dist/UniversalFileService-BuHN-jrR.d.ts +0 -515
- package/dist/UniversalFileService-CGGzYeeF.d.mts +0 -515
- package/dist/analytics/index.d.mts +0 -1084
- package/dist/analytics/index.d.ts +0 -1084
- package/dist/analytics/server/index.d.mts +0 -499
- package/dist/analytics/server/index.d.ts +0 -499
- package/dist/api/index.d.mts +0 -248
- package/dist/api/index.d.ts +0 -248
- package/dist/audioDetection/index.d.mts +0 -449
- package/dist/audioDetection/index.d.ts +0 -449
- package/dist/auth/client/index.d.mts +0 -153
- package/dist/auth/client/index.d.ts +0 -153
- package/dist/auth/components/index.d.mts +0 -227
- package/dist/auth/components/index.d.ts +0 -227
- package/dist/auth/hooks/index.d.mts +0 -31
- package/dist/auth/hooks/index.d.ts +0 -31
- package/dist/auth/index.d.mts +0 -40
- package/dist/auth/index.d.ts +0 -40
- package/dist/auth/middleware/index.d.mts +0 -75
- package/dist/auth/middleware/index.d.ts +0 -75
- package/dist/auth/routes/index.d.mts +0 -261
- package/dist/auth/routes/index.d.ts +0 -261
- package/dist/auth/schema/index.d.mts +0 -789
- package/dist/auth/schema/index.d.ts +0 -789
- package/dist/auth/services/index.d.mts +0 -48
- package/dist/auth/services/index.d.ts +0 -48
- package/dist/calendar/index.d.mts +0 -1197
- package/dist/calendar/index.d.ts +0 -1197
- package/dist/calendar/routes/index.d.mts +0 -118
- package/dist/calendar/routes/index.d.ts +0 -118
- package/dist/calendar/server.d.mts +0 -1184
- package/dist/calendar/server.d.ts +0 -1184
- package/dist/chunk-6WXOA4BE.mjs.map +0 -1
- package/dist/chunk-AXP7KROR.js.map +0 -1
- package/dist/chunk-GAC4J5GX.js +0 -228
- package/dist/chunk-GAC4J5GX.js.map +0 -1
- package/dist/chunk-IEA55H3G.js +0 -106
- package/dist/chunk-IEA55H3G.js.map +0 -1
- package/dist/chunk-R2F4BXUU.mjs +0 -100
- package/dist/chunk-R2F4BXUU.mjs.map +0 -1
- package/dist/chunk-T6TE7GTY.mjs +0 -218
- package/dist/chunk-T6TE7GTY.mjs.map +0 -1
- package/dist/config/index.d.mts +0 -64
- package/dist/config/index.d.ts +0 -64
- package/dist/config/server/index.d.mts +0 -1533
- package/dist/config/server/index.d.ts +0 -1533
- package/dist/drizzle-auth-service-Bxlovhv8.d.ts +0 -145
- package/dist/drizzle-auth-service-DZY2F1sv.d.mts +0 -145
- package/dist/drizzle-schema-BNhqj2AZ.d.mts +0 -1114
- package/dist/drizzle-schema-BNhqj2AZ.d.ts +0 -1114
- package/dist/enums-Dume-V5Y.d.mts +0 -16
- package/dist/enums-Dume-V5Y.d.ts +0 -16
- package/dist/i18n/index.d.mts +0 -417
- package/dist/i18n/index.d.ts +0 -417
- package/dist/imageCrop/index.d.mts +0 -165
- package/dist/imageCrop/index.d.ts +0 -165
- package/dist/index-DSel44Ke.d.mts +0 -93
- package/dist/index-DSel44Ke.d.ts +0 -93
- package/dist/index.d.mts +0 -671
- package/dist/index.d.ts +0 -671
- package/dist/logger/index.d.mts +0 -125
- package/dist/logger/index.d.ts +0 -125
- package/dist/mmd/admin/index.d.mts +0 -487
- package/dist/mmd/admin/index.d.ts +0 -487
- package/dist/mmd/index.d.mts +0 -599
- package/dist/mmd/index.d.ts +0 -599
- package/dist/mmd/server/index.d.mts +0 -138
- package/dist/mmd/server/index.d.ts +0 -138
- package/dist/music/index.d.mts +0 -79
- package/dist/music/index.d.ts +0 -79
- package/dist/music/server/index.d.mts +0 -1
- package/dist/music/server/index.d.ts +0 -1
- package/dist/request/index.d.mts +0 -51
- package/dist/request/index.d.ts +0 -51
- package/dist/storage/index.d.mts +0 -75
- package/dist/storage/index.d.ts +0 -75
- package/dist/testYourself/admin/index.d.mts +0 -58
- package/dist/testYourself/admin/index.d.ts +0 -58
- package/dist/testYourself/index.d.mts +0 -53
- package/dist/testYourself/index.d.ts +0 -53
- package/dist/testYourself/server/index.d.mts +0 -1029
- package/dist/testYourself/server/index.d.ts +0 -1029
- package/dist/types-B60F7EZZ.d.mts +0 -248
- package/dist/types-B60F7EZZ.d.ts +0 -248
- package/dist/types-BINlP9MK.d.mts +0 -286
- package/dist/types-BINlP9MK.d.ts +0 -286
- package/dist/types-BaZccpvk.d.mts +0 -48
- package/dist/types-BaZccpvk.d.ts +0 -48
- package/dist/types-CK4We_aI.d.mts +0 -270
- package/dist/types-CK4We_aI.d.ts +0 -270
- package/dist/types-CbTsi9CZ.d.mts +0 -31
- package/dist/types-CbTsi9CZ.d.ts +0 -31
- package/dist/types-CroexXnI.d.ts +0 -99
- package/dist/types-DmsXCWvm.d.mts +0 -99
- package/dist/types-Dt0oqeFM.d.mts +0 -70
- package/dist/types-zK6kDzDQ.d.ts +0 -70
- package/dist/universalExport/index.d.mts +0 -235
- package/dist/universalExport/index.d.ts +0 -235
- package/dist/universalExport/server/index.d.mts +0 -1270
- package/dist/universalExport/server/index.d.ts +0 -1270
- package/dist/universalFile/index.d.mts +0 -480
- package/dist/universalFile/index.d.ts +0 -480
- package/dist/universalFile/server/index.d.mts +0 -4516
- package/dist/universalFile/server/index.d.ts +0 -4516
- package/dist/useElectronStorage-Dj0rcorG.d.mts +0 -65
- package/dist/useElectronStorage-DwnNfIhl.d.ts +0 -65
- package/dist/utils/index.d.mts +0 -192
- package/dist/utils/index.d.ts +0 -192
|
@@ -1,1270 +0,0 @@
|
|
|
1
|
-
import { d as ExportFormat, E as ExportConfig$1, k as ExportStatus, m as ExportField, U as UniversalExportServiceConfig$1, a as ExportRequest, b as ExportResult$1, c as ExportProgress$1, u as ExportEventListener$1, i as FieldType } from '../../types-BINlP9MK.mjs';
|
|
2
|
-
import * as drizzle_orm from 'drizzle-orm';
|
|
3
|
-
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* UniversalExport Server 端类型定义
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/** 导出服务配置 */
|
|
10
|
-
interface UniversalExportServiceConfig {
|
|
11
|
-
/** 数据库连接(可选) */
|
|
12
|
-
db?: any;
|
|
13
|
-
/** 导出文件存储目录 */
|
|
14
|
-
exportDir?: string;
|
|
15
|
-
/** 临时文件目录 */
|
|
16
|
-
tempDir?: string;
|
|
17
|
-
/** 最大导出行数 */
|
|
18
|
-
maxRows?: number;
|
|
19
|
-
/** 是否启用流式导出 */
|
|
20
|
-
enableStreaming?: boolean;
|
|
21
|
-
/** 导出超时时间(毫秒) */
|
|
22
|
-
timeout?: number;
|
|
23
|
-
}
|
|
24
|
-
/** 导出引擎接口 */
|
|
25
|
-
interface IExportEngine {
|
|
26
|
-
/** 引擎格式 */
|
|
27
|
-
readonly format: ExportFormat;
|
|
28
|
-
/** 导出数据 */
|
|
29
|
-
export(data: any[], config: ExportConfig$1): Promise<ExportResult>;
|
|
30
|
-
/** 流式导出 */
|
|
31
|
-
exportStream?(data: AsyncIterable<any>, config: ExportConfig$1): Promise<ExportResult>;
|
|
32
|
-
/** 验证配置 */
|
|
33
|
-
validateConfig(config: ExportConfig$1): boolean;
|
|
34
|
-
/** 获取引擎信息 */
|
|
35
|
-
getInfo(): EngineInfo;
|
|
36
|
-
}
|
|
37
|
-
/** 引擎信息 */
|
|
38
|
-
interface EngineInfo {
|
|
39
|
-
/** 引擎名称 */
|
|
40
|
-
name: string;
|
|
41
|
-
/** 支持的格式 */
|
|
42
|
-
format: ExportFormat;
|
|
43
|
-
/** 支持流式导出 */
|
|
44
|
-
supportsStreaming: boolean;
|
|
45
|
-
/** 最大行数限制 */
|
|
46
|
-
maxRows?: number;
|
|
47
|
-
}
|
|
48
|
-
/** 导出结果 */
|
|
49
|
-
interface ExportResult {
|
|
50
|
-
/** 是否成功 */
|
|
51
|
-
success: boolean;
|
|
52
|
-
/** 文件路径 */
|
|
53
|
-
filePath?: string;
|
|
54
|
-
/** 文件大小(字节) */
|
|
55
|
-
fileSize?: number;
|
|
56
|
-
/** 导出行数 */
|
|
57
|
-
rowCount: number;
|
|
58
|
-
/** 导出时长(毫秒) */
|
|
59
|
-
duration: number;
|
|
60
|
-
/** 错误信息 */
|
|
61
|
-
error?: string;
|
|
62
|
-
/** 元数据 */
|
|
63
|
-
metadata?: Record<string, any>;
|
|
64
|
-
}
|
|
65
|
-
/** 导出进度 */
|
|
66
|
-
interface ExportProgress {
|
|
67
|
-
/** 任务 ID */
|
|
68
|
-
taskId: string;
|
|
69
|
-
/** 当前状态 */
|
|
70
|
-
status: ExportStatus;
|
|
71
|
-
/** 已处理行数 */
|
|
72
|
-
processedRows: number;
|
|
73
|
-
/** 总行数 */
|
|
74
|
-
totalRows: number;
|
|
75
|
-
/** 进度百分比 */
|
|
76
|
-
percentage: number;
|
|
77
|
-
/** 剩余时间(秒) */
|
|
78
|
-
estimatedTime?: number;
|
|
79
|
-
/** 错误信息 */
|
|
80
|
-
error?: string;
|
|
81
|
-
}
|
|
82
|
-
/** 数据转换器 */
|
|
83
|
-
interface DataTransformer {
|
|
84
|
-
/** 转换数据行 */
|
|
85
|
-
transform(row: any, config: ExportConfig$1): any;
|
|
86
|
-
/** 批量转换 */
|
|
87
|
-
transformBatch?(rows: any[], config: ExportConfig$1): any[];
|
|
88
|
-
}
|
|
89
|
-
/** 字段映射器 */
|
|
90
|
-
interface FieldMapper {
|
|
91
|
-
/** 映射字段 */
|
|
92
|
-
map(value: any, field: ExportField): any;
|
|
93
|
-
}
|
|
94
|
-
/** 数据验证器 */
|
|
95
|
-
interface Validator {
|
|
96
|
-
/** 验证数据 */
|
|
97
|
-
validate(data: any[], config: ExportConfig$1): ValidationResult;
|
|
98
|
-
}
|
|
99
|
-
/** 验证结果 */
|
|
100
|
-
interface ValidationResult {
|
|
101
|
-
/** 是否有效 */
|
|
102
|
-
valid: boolean;
|
|
103
|
-
/** 错误列表 */
|
|
104
|
-
errors: ValidationError[];
|
|
105
|
-
}
|
|
106
|
-
/** 验证错误 */
|
|
107
|
-
interface ValidationError {
|
|
108
|
-
/** 行号 */
|
|
109
|
-
row: number;
|
|
110
|
-
/** 字段 */
|
|
111
|
-
field: string;
|
|
112
|
-
/** 错误消息 */
|
|
113
|
-
message: string;
|
|
114
|
-
}
|
|
115
|
-
/** 数据源接口 */
|
|
116
|
-
interface IDataSource {
|
|
117
|
-
/** 获取数据 */
|
|
118
|
-
getData(query: any, options?: DataQueryOptions): Promise<any[]>;
|
|
119
|
-
/** 获取数据流 */
|
|
120
|
-
getDataStream?(query: any, options?: DataQueryOptions): AsyncIterable<any>;
|
|
121
|
-
/** 获取总数 */
|
|
122
|
-
getCount(query: any): Promise<number>;
|
|
123
|
-
}
|
|
124
|
-
/** 数据查询选项 */
|
|
125
|
-
interface DataQueryOptions {
|
|
126
|
-
/** 分页 */
|
|
127
|
-
page?: number;
|
|
128
|
-
pageSize?: number;
|
|
129
|
-
/** 排序 */
|
|
130
|
-
orderBy?: string;
|
|
131
|
-
orderDirection?: 'asc' | 'desc';
|
|
132
|
-
/** 过滤 */
|
|
133
|
-
filters?: Record<string, any>;
|
|
134
|
-
}
|
|
135
|
-
/** 任务创建选项 */
|
|
136
|
-
interface TaskCreateOptions {
|
|
137
|
-
/** 配置 ID */
|
|
138
|
-
configId: string;
|
|
139
|
-
/** 导出格式 */
|
|
140
|
-
format: ExportFormat;
|
|
141
|
-
/** 查询条件 */
|
|
142
|
-
query?: any;
|
|
143
|
-
/** 创建者 ID */
|
|
144
|
-
creatorId?: string;
|
|
145
|
-
/** 任务名称 */
|
|
146
|
-
name?: string;
|
|
147
|
-
/** 任务描述 */
|
|
148
|
-
description?: string;
|
|
149
|
-
}
|
|
150
|
-
/** 任务更新选项 */
|
|
151
|
-
interface TaskUpdateOptions {
|
|
152
|
-
/** 任务状态 */
|
|
153
|
-
status?: ExportStatus;
|
|
154
|
-
/** 进度 */
|
|
155
|
-
progress?: number;
|
|
156
|
-
/** 文件路径 */
|
|
157
|
-
filePath?: string;
|
|
158
|
-
/** 文件大小 */
|
|
159
|
-
fileSize?: number;
|
|
160
|
-
/** 导出行数 */
|
|
161
|
-
rowCount?: number;
|
|
162
|
-
/** 错误信息 */
|
|
163
|
-
error?: string;
|
|
164
|
-
}
|
|
165
|
-
/** 导出配置记录 */
|
|
166
|
-
interface ExportConfigRecord {
|
|
167
|
-
/** 配置 ID */
|
|
168
|
-
id: string;
|
|
169
|
-
/** 配置名称 */
|
|
170
|
-
name: string;
|
|
171
|
-
/** 配置描述 */
|
|
172
|
-
description?: string;
|
|
173
|
-
/** 导出格式 */
|
|
174
|
-
format: ExportFormat;
|
|
175
|
-
/** 字段定义 */
|
|
176
|
-
fields: ExportField[];
|
|
177
|
-
/** 创建时间 */
|
|
178
|
-
createdAt: Date | string;
|
|
179
|
-
/** 更新时间 */
|
|
180
|
-
updatedAt: Date | string;
|
|
181
|
-
/** 创建者 ID */
|
|
182
|
-
creatorId?: string;
|
|
183
|
-
}
|
|
184
|
-
/** 导出任务记录 */
|
|
185
|
-
interface ExportTaskRecord {
|
|
186
|
-
/** 任务 ID */
|
|
187
|
-
id: string;
|
|
188
|
-
/** 配置 ID */
|
|
189
|
-
configId: string;
|
|
190
|
-
/** 任务状态 */
|
|
191
|
-
status: ExportStatus;
|
|
192
|
-
/** 文件路径 */
|
|
193
|
-
filePath?: string;
|
|
194
|
-
/** 导出进度 */
|
|
195
|
-
progress?: number;
|
|
196
|
-
/** 创建时间 */
|
|
197
|
-
createdAt: Date | string;
|
|
198
|
-
/** 更新时间 */
|
|
199
|
-
updatedAt: Date | string;
|
|
200
|
-
/** 完成时间 */
|
|
201
|
-
completedAt?: Date | string;
|
|
202
|
-
}
|
|
203
|
-
/** 导出历史记录 */
|
|
204
|
-
interface ExportHistoryRecord {
|
|
205
|
-
/** 历史 ID */
|
|
206
|
-
id: string;
|
|
207
|
-
/** 任务 ID */
|
|
208
|
-
taskId: string;
|
|
209
|
-
/** 配置 ID */
|
|
210
|
-
configId: string;
|
|
211
|
-
/** 导出格式 */
|
|
212
|
-
format: ExportFormat;
|
|
213
|
-
/** 导出状态 */
|
|
214
|
-
status: ExportStatus;
|
|
215
|
-
/** 文件路径 */
|
|
216
|
-
filePath?: string;
|
|
217
|
-
/** 文件大小 */
|
|
218
|
-
fileSize?: number;
|
|
219
|
-
/** 导出行数 */
|
|
220
|
-
rowCount: number;
|
|
221
|
-
/** 导出时长 */
|
|
222
|
-
duration: number;
|
|
223
|
-
/** 创建者 ID */
|
|
224
|
-
creatorId?: string;
|
|
225
|
-
/** 创建时间 */
|
|
226
|
-
createdAt: Date | string;
|
|
227
|
-
/** 错误信息 */
|
|
228
|
-
error?: string;
|
|
229
|
-
}
|
|
230
|
-
/** 导出事件类型 */
|
|
231
|
-
type ExportEventType = 'task:created' | 'task:started' | 'task:progress' | 'task:completed' | 'task:failed' | 'task:cancelled' | 'config:created' | 'config:updated' | 'config:deleted';
|
|
232
|
-
/** 导出事件 */
|
|
233
|
-
interface ExportEvent {
|
|
234
|
-
/** 事件类型 */
|
|
235
|
-
type: ExportEventType;
|
|
236
|
-
/** 任务 ID */
|
|
237
|
-
taskId?: string;
|
|
238
|
-
/** 配置 ID */
|
|
239
|
-
configId?: string;
|
|
240
|
-
/** 事件数据 */
|
|
241
|
-
data?: any;
|
|
242
|
-
/** 时间戳 */
|
|
243
|
-
timestamp: Date;
|
|
244
|
-
}
|
|
245
|
-
/** 事件监听器 */
|
|
246
|
-
type ExportEventListener = (event: ExportEvent) => void | Promise<void>;
|
|
247
|
-
/** 格式化器函数 */
|
|
248
|
-
type FormatterFunction = (value: any) => string;
|
|
249
|
-
/** 聚合函数 */
|
|
250
|
-
type AggregateFunction = (values: any[]) => any;
|
|
251
|
-
/** 自定义处理函数 */
|
|
252
|
-
type CustomProcessor = (values: any[]) => any;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* 通用导出服务
|
|
256
|
-
*
|
|
257
|
-
* 提供统一的导出功能,支持配置化字段选择、格式化和分组
|
|
258
|
-
*/
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* 导出客户端接口(用于依赖注入)
|
|
262
|
-
*/
|
|
263
|
-
interface IExportClient {
|
|
264
|
-
createConfig(config: Omit<ExportConfig$1, 'id' | 'createdAt' | 'updatedAt'>): Promise<ExportConfig$1>;
|
|
265
|
-
getConfigsByModule(moduleId: string, businessId?: string): Promise<ExportConfig$1[]>;
|
|
266
|
-
}
|
|
267
|
-
declare class UniversalExportService {
|
|
268
|
-
private config;
|
|
269
|
-
private eventListeners;
|
|
270
|
-
private activeExports;
|
|
271
|
-
private configCache;
|
|
272
|
-
private resultCache;
|
|
273
|
-
private client?;
|
|
274
|
-
constructor(config?: Partial<UniversalExportServiceConfig$1>, client?: IExportClient);
|
|
275
|
-
/**
|
|
276
|
-
* 创建导出配置
|
|
277
|
-
*/
|
|
278
|
-
createConfig(config: Omit<ExportConfig$1, 'id' | 'createdAt' | 'updatedAt'>): Promise<ExportConfig$1>;
|
|
279
|
-
/**
|
|
280
|
-
* 获取导出配置
|
|
281
|
-
*/
|
|
282
|
-
getConfig(configId: string): Promise<ExportConfig$1 | null>;
|
|
283
|
-
/**
|
|
284
|
-
* 更新导出配置
|
|
285
|
-
*/
|
|
286
|
-
updateConfig(configId: string, updates: Partial<ExportConfig$1>): Promise<ExportConfig$1>;
|
|
287
|
-
/**
|
|
288
|
-
* 删除导出配置
|
|
289
|
-
*/
|
|
290
|
-
deleteConfig(configId: string): Promise<void>;
|
|
291
|
-
/**
|
|
292
|
-
* 获取模块的配置列表
|
|
293
|
-
*/
|
|
294
|
-
getConfigsByModule(moduleId: string, businessId?: string): Promise<ExportConfig$1[]>;
|
|
295
|
-
/**
|
|
296
|
-
* 执行导出
|
|
297
|
-
*/
|
|
298
|
-
export(request: ExportRequest): Promise<ExportResult$1>;
|
|
299
|
-
/**
|
|
300
|
-
* 获取导出进度
|
|
301
|
-
*/
|
|
302
|
-
getExportProgress(exportId: string): ExportProgress$1 | null;
|
|
303
|
-
/**
|
|
304
|
-
* 取消导出
|
|
305
|
-
*/
|
|
306
|
-
cancelExport(exportId: string): boolean;
|
|
307
|
-
/**
|
|
308
|
-
* 添加事件监听器
|
|
309
|
-
*/
|
|
310
|
-
addEventListener(type: string, listener: ExportEventListener$1): void;
|
|
311
|
-
/**
|
|
312
|
-
* 移除事件监听器
|
|
313
|
-
*/
|
|
314
|
-
removeEventListener(type: string, listener: ExportEventListener$1): void;
|
|
315
|
-
/**
|
|
316
|
-
* 生成唯一ID
|
|
317
|
-
*/
|
|
318
|
-
private generateId;
|
|
319
|
-
/**
|
|
320
|
-
* 验证配置
|
|
321
|
-
*/
|
|
322
|
-
private validateConfig;
|
|
323
|
-
/**
|
|
324
|
-
* 获取数据
|
|
325
|
-
*/
|
|
326
|
-
private getData;
|
|
327
|
-
/**
|
|
328
|
-
* 处理数据
|
|
329
|
-
*/
|
|
330
|
-
private processData;
|
|
331
|
-
/**
|
|
332
|
-
* 应用过滤器
|
|
333
|
-
*/
|
|
334
|
-
private applyFilters;
|
|
335
|
-
/**
|
|
336
|
-
* 应用排序
|
|
337
|
-
*/
|
|
338
|
-
private applySorting;
|
|
339
|
-
/**
|
|
340
|
-
* 获取嵌套值
|
|
341
|
-
*/
|
|
342
|
-
private getNestedValue;
|
|
343
|
-
/**
|
|
344
|
-
* 过滤掉所有行都为空值的字段
|
|
345
|
-
*/
|
|
346
|
-
private filterEmptyFields;
|
|
347
|
-
/**
|
|
348
|
-
* 生成文件
|
|
349
|
-
*/
|
|
350
|
-
private generateFile;
|
|
351
|
-
/**
|
|
352
|
-
* 生成CSV内容
|
|
353
|
-
*/
|
|
354
|
-
private generateCSV;
|
|
355
|
-
/**
|
|
356
|
-
* 生成JSON内容
|
|
357
|
-
*/
|
|
358
|
-
private generateJSON;
|
|
359
|
-
/**
|
|
360
|
-
* 转义CSV字段
|
|
361
|
-
*/
|
|
362
|
-
private escapeCSVField;
|
|
363
|
-
/**
|
|
364
|
-
* 生成文件名
|
|
365
|
-
*/
|
|
366
|
-
private generateFileName;
|
|
367
|
-
/**
|
|
368
|
-
* 获取MIME类型
|
|
369
|
-
*/
|
|
370
|
-
private getMimeType;
|
|
371
|
-
/**
|
|
372
|
-
* 触发事件
|
|
373
|
-
*/
|
|
374
|
-
private emitEvent;
|
|
375
|
-
/**
|
|
376
|
-
* 应用分组
|
|
377
|
-
*/
|
|
378
|
-
private applyGrouping;
|
|
379
|
-
/**
|
|
380
|
-
* 按字段分组数据
|
|
381
|
-
*/
|
|
382
|
-
private groupDataByFields;
|
|
383
|
-
/**
|
|
384
|
-
* 生成分组键
|
|
385
|
-
*/
|
|
386
|
-
private generateGroupKey;
|
|
387
|
-
/**
|
|
388
|
-
* 处理分组后的数据
|
|
389
|
-
*/
|
|
390
|
-
private processGroupedData;
|
|
391
|
-
/**
|
|
392
|
-
* 处理单个分组
|
|
393
|
-
*/
|
|
394
|
-
private processGroup;
|
|
395
|
-
/**
|
|
396
|
-
* 创建分组头行
|
|
397
|
-
*/
|
|
398
|
-
private createGroupHeader;
|
|
399
|
-
/**
|
|
400
|
-
* 处理合并模式
|
|
401
|
-
*/
|
|
402
|
-
private processMergeMode;
|
|
403
|
-
/**
|
|
404
|
-
* 处理多字段合并模式
|
|
405
|
-
*/
|
|
406
|
-
private processMultiFieldMergeMode;
|
|
407
|
-
/**
|
|
408
|
-
* 处理嵌套模式
|
|
409
|
-
*/
|
|
410
|
-
private processNestedMode;
|
|
411
|
-
/**
|
|
412
|
-
* 统计分组数量
|
|
413
|
-
*/
|
|
414
|
-
private countGroups;
|
|
415
|
-
/**
|
|
416
|
-
* 生成Excel文件
|
|
417
|
-
*/
|
|
418
|
-
private generateExcel;
|
|
419
|
-
/**
|
|
420
|
-
* 准备Excel数据
|
|
421
|
-
*/
|
|
422
|
-
private prepareExcelData;
|
|
423
|
-
/**
|
|
424
|
-
* 应用Excel分组和合并单元格
|
|
425
|
-
*/
|
|
426
|
-
private applyExcelGrouping;
|
|
427
|
-
/**
|
|
428
|
-
* 设置Excel列宽和样式
|
|
429
|
-
*/
|
|
430
|
-
private setExcelColumnWidths;
|
|
431
|
-
/**
|
|
432
|
-
* 为Excel数据单元格应用样式
|
|
433
|
-
*/
|
|
434
|
-
private applyExcelDataStyles;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* UniversalExport Service 工厂函数
|
|
439
|
-
* 提供简化的服务初始化方式
|
|
440
|
-
*/
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* 创建导出服务配置(带智能默认值)
|
|
444
|
-
*/
|
|
445
|
-
declare function createExportServiceConfig(options?: Partial<UniversalExportServiceConfig>): UniversalExportServiceConfig;
|
|
446
|
-
/**
|
|
447
|
-
* 创建导出服务实例(简化版)
|
|
448
|
-
*
|
|
449
|
-
* @example
|
|
450
|
-
* ```typescript
|
|
451
|
-
* // 最简配置
|
|
452
|
-
* const service = createUniversalExportService();
|
|
453
|
-
*
|
|
454
|
-
* // 标准配置
|
|
455
|
-
* const service = createUniversalExportService({
|
|
456
|
-
* db: drizzleDb,
|
|
457
|
-
* exportDir: './exports',
|
|
458
|
-
* maxRows: 50000,
|
|
459
|
-
* });
|
|
460
|
-
* ```
|
|
461
|
-
*/
|
|
462
|
-
declare function createUniversalExportService(options?: Partial<UniversalExportServiceConfig>): {
|
|
463
|
-
config: UniversalExportServiceConfig;
|
|
464
|
-
export(): Promise<never>;
|
|
465
|
-
createTask(): Promise<never>;
|
|
466
|
-
};
|
|
467
|
-
/**
|
|
468
|
-
* 从环境变量创建配置(便利函数)
|
|
469
|
-
*
|
|
470
|
-
* @example
|
|
471
|
-
* ```typescript
|
|
472
|
-
* // .env
|
|
473
|
-
* // EXPORT_DIR=./exports
|
|
474
|
-
* // EXPORT_MAX_ROWS=50000
|
|
475
|
-
*
|
|
476
|
-
* const service = createExportServiceFromEnv();
|
|
477
|
-
* ```
|
|
478
|
-
*/
|
|
479
|
-
declare function createExportServiceFromEnv(db?: any): {
|
|
480
|
-
config: UniversalExportServiceConfig;
|
|
481
|
-
export(): Promise<never>;
|
|
482
|
-
createTask(): Promise<never>;
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* UniversalExport 预设配置
|
|
487
|
-
* 提供常见场景的开箱即用配置
|
|
488
|
-
*/
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* 小型应用预设(数据量小)
|
|
492
|
-
*/
|
|
493
|
-
declare function createSmallAppPreset(): Partial<UniversalExportServiceConfig>;
|
|
494
|
-
/**
|
|
495
|
-
* 中型应用预设(默认配置)
|
|
496
|
-
*/
|
|
497
|
-
declare function createMediumAppPreset(): Partial<UniversalExportServiceConfig>;
|
|
498
|
-
/**
|
|
499
|
-
* 大型应用预设(数据量大)
|
|
500
|
-
*/
|
|
501
|
-
declare function createLargeAppPreset(): Partial<UniversalExportServiceConfig>;
|
|
502
|
-
/**
|
|
503
|
-
* 实时导出预设(快速响应)
|
|
504
|
-
*/
|
|
505
|
-
declare function createRealtimeExportPreset(): Partial<UniversalExportServiceConfig>;
|
|
506
|
-
/**
|
|
507
|
-
* 批量导出预设(大批量、离线处理)
|
|
508
|
-
*/
|
|
509
|
-
declare function createBatchExportPreset(): Partial<UniversalExportServiceConfig>;
|
|
510
|
-
/**
|
|
511
|
-
* 智能预设:根据环境自动选择
|
|
512
|
-
*/
|
|
513
|
-
declare function createSmartExportPreset(): Partial<UniversalExportServiceConfig>;
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* UniversalExport 配置验证
|
|
517
|
-
*/
|
|
518
|
-
|
|
519
|
-
declare class ConfigValidationError extends Error {
|
|
520
|
-
field: string;
|
|
521
|
-
constructor(message: string, field: string);
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* 验证导出服务配置
|
|
525
|
-
*/
|
|
526
|
-
declare function validateExportConfig(config: UniversalExportServiceConfig): void;
|
|
527
|
-
/**
|
|
528
|
-
* 验证环境变量
|
|
529
|
-
*/
|
|
530
|
-
declare function validateEnvironment(requiredVars: string[]): void;
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* UniversalExport Server 工具函数
|
|
534
|
-
*/
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* 格式化字段值
|
|
538
|
-
*
|
|
539
|
-
* @param value 原始值
|
|
540
|
-
* @param field 字段定义
|
|
541
|
-
* @returns 格式化后的值
|
|
542
|
-
*/
|
|
543
|
-
declare function formatFieldValue(value: any, field: ExportField): string;
|
|
544
|
-
/**
|
|
545
|
-
* 验证字段值
|
|
546
|
-
*
|
|
547
|
-
* @param value 字段值
|
|
548
|
-
* @param field 字段定义
|
|
549
|
-
* @returns 是否有效
|
|
550
|
-
*/
|
|
551
|
-
declare function validateFieldValue(value: any, field: ExportField): boolean;
|
|
552
|
-
/**
|
|
553
|
-
* 转换字段类型
|
|
554
|
-
*
|
|
555
|
-
* @param value 原始值
|
|
556
|
-
* @param targetType 目标类型
|
|
557
|
-
* @returns 转换后的值
|
|
558
|
-
*/
|
|
559
|
-
declare function convertFieldType(value: any, targetType: FieldType): any;
|
|
560
|
-
/**
|
|
561
|
-
* 安全获取嵌套属性值
|
|
562
|
-
*
|
|
563
|
-
* @param obj 对象
|
|
564
|
-
* @param path 属性路径(支持点号分隔)
|
|
565
|
-
* @returns 属性值
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* ```typescript
|
|
569
|
-
* const obj = { user: { name: 'John', age: 30 } };
|
|
570
|
-
* getNestedValue(obj, 'user.name') // 'John'
|
|
571
|
-
* getNestedValue(obj, 'user.email') // undefined
|
|
572
|
-
* ```
|
|
573
|
-
*/
|
|
574
|
-
declare function getNestedValue(obj: any, path: string): any;
|
|
575
|
-
/**
|
|
576
|
-
* 转义 CSV 字段值
|
|
577
|
-
*
|
|
578
|
-
* @param value 字段值
|
|
579
|
-
* @returns 转义后的值
|
|
580
|
-
*/
|
|
581
|
-
declare function escapeCsvValue(value: string): string;
|
|
582
|
-
/**
|
|
583
|
-
* 生成唯一的文件名
|
|
584
|
-
*
|
|
585
|
-
* @param prefix 前缀
|
|
586
|
-
* @param extension 扩展名
|
|
587
|
-
* @returns 唯一文件名
|
|
588
|
-
*
|
|
589
|
-
* @example
|
|
590
|
-
* ```typescript
|
|
591
|
-
* generateUniqueFilename('export', 'xlsx')
|
|
592
|
-
* // 'export_20231111_123456_abc123.xlsx'
|
|
593
|
-
* ```
|
|
594
|
-
*/
|
|
595
|
-
declare function generateUniqueFilename(prefix: string, extension: string): string;
|
|
596
|
-
/**
|
|
597
|
-
* 计算导出进度百分比
|
|
598
|
-
*
|
|
599
|
-
* @param processed 已处理行数
|
|
600
|
-
* @param total 总行数
|
|
601
|
-
* @returns 百分比(0-100)
|
|
602
|
-
*/
|
|
603
|
-
declare function calculateProgress(processed: number, total: number): number;
|
|
604
|
-
/**
|
|
605
|
-
* 估算剩余时间(秒)
|
|
606
|
-
*
|
|
607
|
-
* @param processed 已处理行数
|
|
608
|
-
* @param total 总行数
|
|
609
|
-
* @param elapsedMs 已用时间(毫秒)
|
|
610
|
-
* @returns 剩余时间(秒)
|
|
611
|
-
*/
|
|
612
|
-
declare function estimateRemainingTime(processed: number, total: number, elapsedMs: number): number;
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* 通用导出服务 - PostgreSQL 数据库表结构定义
|
|
616
|
-
*
|
|
617
|
-
* 提供导出配置和历史记录的数据库表结构。
|
|
618
|
-
*
|
|
619
|
-
* 表结构概览:
|
|
620
|
-
* - export_configs: 导出配置表
|
|
621
|
-
* - export_history: 导出历史记录表
|
|
622
|
-
*
|
|
623
|
-
* 设计特点:
|
|
624
|
-
* - 支持多种导出格式(CSV, Excel, JSON)
|
|
625
|
-
* - 灵活的字段配置和分组
|
|
626
|
-
* - 完整的历史记录追踪
|
|
627
|
-
*
|
|
628
|
-
* @fileoverview 数据库表结构 - 通用导出服务 (PostgreSQL)
|
|
629
|
-
* @package sa2kit/universalExport/server
|
|
630
|
-
*/
|
|
631
|
-
/**
|
|
632
|
-
* 导出配置表 (ExportConfig)
|
|
633
|
-
*
|
|
634
|
-
* 存储导出任务的配置信息,包括字段选择、格式化、分组等。
|
|
635
|
-
*/
|
|
636
|
-
declare const exportConfigs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
637
|
-
name: "ExportConfig";
|
|
638
|
-
schema: undefined;
|
|
639
|
-
columns: {
|
|
640
|
-
id: drizzle_orm_pg_core.PgColumn<{
|
|
641
|
-
name: "id";
|
|
642
|
-
tableName: "ExportConfig";
|
|
643
|
-
dataType: "string";
|
|
644
|
-
columnType: "PgText";
|
|
645
|
-
data: string;
|
|
646
|
-
driverParam: string;
|
|
647
|
-
notNull: true;
|
|
648
|
-
hasDefault: true;
|
|
649
|
-
isPrimaryKey: true;
|
|
650
|
-
isAutoincrement: false;
|
|
651
|
-
hasRuntimeDefault: true;
|
|
652
|
-
enumValues: [string, ...string[]];
|
|
653
|
-
baseColumn: never;
|
|
654
|
-
identity: undefined;
|
|
655
|
-
generated: undefined;
|
|
656
|
-
}, {}, {}>;
|
|
657
|
-
name: drizzle_orm_pg_core.PgColumn<{
|
|
658
|
-
name: "name";
|
|
659
|
-
tableName: "ExportConfig";
|
|
660
|
-
dataType: "string";
|
|
661
|
-
columnType: "PgText";
|
|
662
|
-
data: string;
|
|
663
|
-
driverParam: string;
|
|
664
|
-
notNull: true;
|
|
665
|
-
hasDefault: false;
|
|
666
|
-
isPrimaryKey: false;
|
|
667
|
-
isAutoincrement: false;
|
|
668
|
-
hasRuntimeDefault: false;
|
|
669
|
-
enumValues: [string, ...string[]];
|
|
670
|
-
baseColumn: never;
|
|
671
|
-
identity: undefined;
|
|
672
|
-
generated: undefined;
|
|
673
|
-
}, {}, {}>;
|
|
674
|
-
description: drizzle_orm_pg_core.PgColumn<{
|
|
675
|
-
name: "description";
|
|
676
|
-
tableName: "ExportConfig";
|
|
677
|
-
dataType: "string";
|
|
678
|
-
columnType: "PgText";
|
|
679
|
-
data: string;
|
|
680
|
-
driverParam: string;
|
|
681
|
-
notNull: false;
|
|
682
|
-
hasDefault: false;
|
|
683
|
-
isPrimaryKey: false;
|
|
684
|
-
isAutoincrement: false;
|
|
685
|
-
hasRuntimeDefault: false;
|
|
686
|
-
enumValues: [string, ...string[]];
|
|
687
|
-
baseColumn: never;
|
|
688
|
-
identity: undefined;
|
|
689
|
-
generated: undefined;
|
|
690
|
-
}, {}, {}>;
|
|
691
|
-
format: drizzle_orm_pg_core.PgColumn<{
|
|
692
|
-
name: "format";
|
|
693
|
-
tableName: "ExportConfig";
|
|
694
|
-
dataType: "string";
|
|
695
|
-
columnType: "PgText";
|
|
696
|
-
data: string;
|
|
697
|
-
driverParam: string;
|
|
698
|
-
notNull: true;
|
|
699
|
-
hasDefault: false;
|
|
700
|
-
isPrimaryKey: false;
|
|
701
|
-
isAutoincrement: false;
|
|
702
|
-
hasRuntimeDefault: false;
|
|
703
|
-
enumValues: [string, ...string[]];
|
|
704
|
-
baseColumn: never;
|
|
705
|
-
identity: undefined;
|
|
706
|
-
generated: undefined;
|
|
707
|
-
}, {}, {}>;
|
|
708
|
-
fields: drizzle_orm_pg_core.PgColumn<{
|
|
709
|
-
name: "fields";
|
|
710
|
-
tableName: "ExportConfig";
|
|
711
|
-
dataType: "json";
|
|
712
|
-
columnType: "PgJsonb";
|
|
713
|
-
data: unknown;
|
|
714
|
-
driverParam: unknown;
|
|
715
|
-
notNull: true;
|
|
716
|
-
hasDefault: false;
|
|
717
|
-
isPrimaryKey: false;
|
|
718
|
-
isAutoincrement: false;
|
|
719
|
-
hasRuntimeDefault: false;
|
|
720
|
-
enumValues: undefined;
|
|
721
|
-
baseColumn: never;
|
|
722
|
-
identity: undefined;
|
|
723
|
-
generated: undefined;
|
|
724
|
-
}, {}, {}>;
|
|
725
|
-
grouping: drizzle_orm_pg_core.PgColumn<{
|
|
726
|
-
name: "grouping";
|
|
727
|
-
tableName: "ExportConfig";
|
|
728
|
-
dataType: "json";
|
|
729
|
-
columnType: "PgJsonb";
|
|
730
|
-
data: unknown;
|
|
731
|
-
driverParam: unknown;
|
|
732
|
-
notNull: false;
|
|
733
|
-
hasDefault: false;
|
|
734
|
-
isPrimaryKey: false;
|
|
735
|
-
isAutoincrement: false;
|
|
736
|
-
hasRuntimeDefault: false;
|
|
737
|
-
enumValues: undefined;
|
|
738
|
-
baseColumn: never;
|
|
739
|
-
identity: undefined;
|
|
740
|
-
generated: undefined;
|
|
741
|
-
}, {}, {}>;
|
|
742
|
-
fileNameTemplate: drizzle_orm_pg_core.PgColumn<{
|
|
743
|
-
name: "fileNameTemplate";
|
|
744
|
-
tableName: "ExportConfig";
|
|
745
|
-
dataType: "string";
|
|
746
|
-
columnType: "PgText";
|
|
747
|
-
data: string;
|
|
748
|
-
driverParam: string;
|
|
749
|
-
notNull: true;
|
|
750
|
-
hasDefault: false;
|
|
751
|
-
isPrimaryKey: false;
|
|
752
|
-
isAutoincrement: false;
|
|
753
|
-
hasRuntimeDefault: false;
|
|
754
|
-
enumValues: [string, ...string[]];
|
|
755
|
-
baseColumn: never;
|
|
756
|
-
identity: undefined;
|
|
757
|
-
generated: undefined;
|
|
758
|
-
}, {}, {}>;
|
|
759
|
-
includeHeader: drizzle_orm_pg_core.PgColumn<{
|
|
760
|
-
name: "includeHeader";
|
|
761
|
-
tableName: "ExportConfig";
|
|
762
|
-
dataType: "boolean";
|
|
763
|
-
columnType: "PgBoolean";
|
|
764
|
-
data: boolean;
|
|
765
|
-
driverParam: boolean;
|
|
766
|
-
notNull: true;
|
|
767
|
-
hasDefault: true;
|
|
768
|
-
isPrimaryKey: false;
|
|
769
|
-
isAutoincrement: false;
|
|
770
|
-
hasRuntimeDefault: false;
|
|
771
|
-
enumValues: undefined;
|
|
772
|
-
baseColumn: never;
|
|
773
|
-
identity: undefined;
|
|
774
|
-
generated: undefined;
|
|
775
|
-
}, {}, {}>;
|
|
776
|
-
delimiter: drizzle_orm_pg_core.PgColumn<{
|
|
777
|
-
name: "delimiter";
|
|
778
|
-
tableName: "ExportConfig";
|
|
779
|
-
dataType: "string";
|
|
780
|
-
columnType: "PgText";
|
|
781
|
-
data: string;
|
|
782
|
-
driverParam: string;
|
|
783
|
-
notNull: true;
|
|
784
|
-
hasDefault: true;
|
|
785
|
-
isPrimaryKey: false;
|
|
786
|
-
isAutoincrement: false;
|
|
787
|
-
hasRuntimeDefault: false;
|
|
788
|
-
enumValues: [string, ...string[]];
|
|
789
|
-
baseColumn: never;
|
|
790
|
-
identity: undefined;
|
|
791
|
-
generated: undefined;
|
|
792
|
-
}, {}, {}>;
|
|
793
|
-
encoding: drizzle_orm_pg_core.PgColumn<{
|
|
794
|
-
name: "encoding";
|
|
795
|
-
tableName: "ExportConfig";
|
|
796
|
-
dataType: "string";
|
|
797
|
-
columnType: "PgText";
|
|
798
|
-
data: string;
|
|
799
|
-
driverParam: string;
|
|
800
|
-
notNull: true;
|
|
801
|
-
hasDefault: true;
|
|
802
|
-
isPrimaryKey: false;
|
|
803
|
-
isAutoincrement: false;
|
|
804
|
-
hasRuntimeDefault: false;
|
|
805
|
-
enumValues: [string, ...string[]];
|
|
806
|
-
baseColumn: never;
|
|
807
|
-
identity: undefined;
|
|
808
|
-
generated: undefined;
|
|
809
|
-
}, {}, {}>;
|
|
810
|
-
addBOM: drizzle_orm_pg_core.PgColumn<{
|
|
811
|
-
name: "addBOM";
|
|
812
|
-
tableName: "ExportConfig";
|
|
813
|
-
dataType: "boolean";
|
|
814
|
-
columnType: "PgBoolean";
|
|
815
|
-
data: boolean;
|
|
816
|
-
driverParam: boolean;
|
|
817
|
-
notNull: true;
|
|
818
|
-
hasDefault: true;
|
|
819
|
-
isPrimaryKey: false;
|
|
820
|
-
isAutoincrement: false;
|
|
821
|
-
hasRuntimeDefault: false;
|
|
822
|
-
enumValues: undefined;
|
|
823
|
-
baseColumn: never;
|
|
824
|
-
identity: undefined;
|
|
825
|
-
generated: undefined;
|
|
826
|
-
}, {}, {}>;
|
|
827
|
-
maxRows: drizzle_orm_pg_core.PgColumn<{
|
|
828
|
-
name: "maxRows";
|
|
829
|
-
tableName: "ExportConfig";
|
|
830
|
-
dataType: "number";
|
|
831
|
-
columnType: "PgInteger";
|
|
832
|
-
data: number;
|
|
833
|
-
driverParam: string | number;
|
|
834
|
-
notNull: false;
|
|
835
|
-
hasDefault: false;
|
|
836
|
-
isPrimaryKey: false;
|
|
837
|
-
isAutoincrement: false;
|
|
838
|
-
hasRuntimeDefault: false;
|
|
839
|
-
enumValues: undefined;
|
|
840
|
-
baseColumn: never;
|
|
841
|
-
identity: undefined;
|
|
842
|
-
generated: undefined;
|
|
843
|
-
}, {}, {}>;
|
|
844
|
-
moduleId: drizzle_orm_pg_core.PgColumn<{
|
|
845
|
-
name: "moduleId";
|
|
846
|
-
tableName: "ExportConfig";
|
|
847
|
-
dataType: "string";
|
|
848
|
-
columnType: "PgText";
|
|
849
|
-
data: string;
|
|
850
|
-
driverParam: string;
|
|
851
|
-
notNull: true;
|
|
852
|
-
hasDefault: false;
|
|
853
|
-
isPrimaryKey: false;
|
|
854
|
-
isAutoincrement: false;
|
|
855
|
-
hasRuntimeDefault: false;
|
|
856
|
-
enumValues: [string, ...string[]];
|
|
857
|
-
baseColumn: never;
|
|
858
|
-
identity: undefined;
|
|
859
|
-
generated: undefined;
|
|
860
|
-
}, {}, {}>;
|
|
861
|
-
businessId: drizzle_orm_pg_core.PgColumn<{
|
|
862
|
-
name: "businessId";
|
|
863
|
-
tableName: "ExportConfig";
|
|
864
|
-
dataType: "string";
|
|
865
|
-
columnType: "PgText";
|
|
866
|
-
data: string;
|
|
867
|
-
driverParam: string;
|
|
868
|
-
notNull: false;
|
|
869
|
-
hasDefault: false;
|
|
870
|
-
isPrimaryKey: false;
|
|
871
|
-
isAutoincrement: false;
|
|
872
|
-
hasRuntimeDefault: false;
|
|
873
|
-
enumValues: [string, ...string[]];
|
|
874
|
-
baseColumn: never;
|
|
875
|
-
identity: undefined;
|
|
876
|
-
generated: undefined;
|
|
877
|
-
}, {}, {}>;
|
|
878
|
-
createdBy: drizzle_orm_pg_core.PgColumn<{
|
|
879
|
-
name: "createdBy";
|
|
880
|
-
tableName: "ExportConfig";
|
|
881
|
-
dataType: "string";
|
|
882
|
-
columnType: "PgText";
|
|
883
|
-
data: string;
|
|
884
|
-
driverParam: string;
|
|
885
|
-
notNull: false;
|
|
886
|
-
hasDefault: false;
|
|
887
|
-
isPrimaryKey: false;
|
|
888
|
-
isAutoincrement: false;
|
|
889
|
-
hasRuntimeDefault: false;
|
|
890
|
-
enumValues: [string, ...string[]];
|
|
891
|
-
baseColumn: never;
|
|
892
|
-
identity: undefined;
|
|
893
|
-
generated: undefined;
|
|
894
|
-
}, {}, {}>;
|
|
895
|
-
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
896
|
-
name: "createdAt";
|
|
897
|
-
tableName: "ExportConfig";
|
|
898
|
-
dataType: "date";
|
|
899
|
-
columnType: "PgTimestamp";
|
|
900
|
-
data: Date;
|
|
901
|
-
driverParam: string;
|
|
902
|
-
notNull: true;
|
|
903
|
-
hasDefault: true;
|
|
904
|
-
isPrimaryKey: false;
|
|
905
|
-
isAutoincrement: false;
|
|
906
|
-
hasRuntimeDefault: false;
|
|
907
|
-
enumValues: undefined;
|
|
908
|
-
baseColumn: never;
|
|
909
|
-
identity: undefined;
|
|
910
|
-
generated: undefined;
|
|
911
|
-
}, {}, {}>;
|
|
912
|
-
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
913
|
-
name: "updatedAt";
|
|
914
|
-
tableName: "ExportConfig";
|
|
915
|
-
dataType: "date";
|
|
916
|
-
columnType: "PgTimestamp";
|
|
917
|
-
data: Date;
|
|
918
|
-
driverParam: string;
|
|
919
|
-
notNull: true;
|
|
920
|
-
hasDefault: true;
|
|
921
|
-
isPrimaryKey: false;
|
|
922
|
-
isAutoincrement: false;
|
|
923
|
-
hasRuntimeDefault: false;
|
|
924
|
-
enumValues: undefined;
|
|
925
|
-
baseColumn: never;
|
|
926
|
-
identity: undefined;
|
|
927
|
-
generated: undefined;
|
|
928
|
-
}, {}, {}>;
|
|
929
|
-
};
|
|
930
|
-
dialect: "pg";
|
|
931
|
-
}>;
|
|
932
|
-
/**
|
|
933
|
-
* 导出历史记录表 (ExportHistory)
|
|
934
|
-
*
|
|
935
|
-
* 记录每次导出任务的执行情况,包括状态、耗时、文件信息等。
|
|
936
|
-
*/
|
|
937
|
-
declare const exportHistory: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
938
|
-
name: "ExportHistory";
|
|
939
|
-
schema: undefined;
|
|
940
|
-
columns: {
|
|
941
|
-
id: drizzle_orm_pg_core.PgColumn<{
|
|
942
|
-
name: "id";
|
|
943
|
-
tableName: "ExportHistory";
|
|
944
|
-
dataType: "string";
|
|
945
|
-
columnType: "PgText";
|
|
946
|
-
data: string;
|
|
947
|
-
driverParam: string;
|
|
948
|
-
notNull: true;
|
|
949
|
-
hasDefault: true;
|
|
950
|
-
isPrimaryKey: true;
|
|
951
|
-
isAutoincrement: false;
|
|
952
|
-
hasRuntimeDefault: true;
|
|
953
|
-
enumValues: [string, ...string[]];
|
|
954
|
-
baseColumn: never;
|
|
955
|
-
identity: undefined;
|
|
956
|
-
generated: undefined;
|
|
957
|
-
}, {}, {}>;
|
|
958
|
-
configId: drizzle_orm_pg_core.PgColumn<{
|
|
959
|
-
name: "configId";
|
|
960
|
-
tableName: "ExportHistory";
|
|
961
|
-
dataType: "string";
|
|
962
|
-
columnType: "PgText";
|
|
963
|
-
data: string;
|
|
964
|
-
driverParam: string;
|
|
965
|
-
notNull: true;
|
|
966
|
-
hasDefault: false;
|
|
967
|
-
isPrimaryKey: false;
|
|
968
|
-
isAutoincrement: false;
|
|
969
|
-
hasRuntimeDefault: false;
|
|
970
|
-
enumValues: [string, ...string[]];
|
|
971
|
-
baseColumn: never;
|
|
972
|
-
identity: undefined;
|
|
973
|
-
generated: undefined;
|
|
974
|
-
}, {}, {}>;
|
|
975
|
-
fileName: drizzle_orm_pg_core.PgColumn<{
|
|
976
|
-
name: "fileName";
|
|
977
|
-
tableName: "ExportHistory";
|
|
978
|
-
dataType: "string";
|
|
979
|
-
columnType: "PgText";
|
|
980
|
-
data: string;
|
|
981
|
-
driverParam: string;
|
|
982
|
-
notNull: true;
|
|
983
|
-
hasDefault: false;
|
|
984
|
-
isPrimaryKey: false;
|
|
985
|
-
isAutoincrement: false;
|
|
986
|
-
hasRuntimeDefault: false;
|
|
987
|
-
enumValues: [string, ...string[]];
|
|
988
|
-
baseColumn: never;
|
|
989
|
-
identity: undefined;
|
|
990
|
-
generated: undefined;
|
|
991
|
-
}, {}, {}>;
|
|
992
|
-
fileSize: drizzle_orm_pg_core.PgColumn<{
|
|
993
|
-
name: "fileSize";
|
|
994
|
-
tableName: "ExportHistory";
|
|
995
|
-
dataType: "number";
|
|
996
|
-
columnType: "PgInteger";
|
|
997
|
-
data: number;
|
|
998
|
-
driverParam: string | number;
|
|
999
|
-
notNull: true;
|
|
1000
|
-
hasDefault: false;
|
|
1001
|
-
isPrimaryKey: false;
|
|
1002
|
-
isAutoincrement: false;
|
|
1003
|
-
hasRuntimeDefault: false;
|
|
1004
|
-
enumValues: undefined;
|
|
1005
|
-
baseColumn: never;
|
|
1006
|
-
identity: undefined;
|
|
1007
|
-
generated: undefined;
|
|
1008
|
-
}, {}, {}>;
|
|
1009
|
-
exportedRows: drizzle_orm_pg_core.PgColumn<{
|
|
1010
|
-
name: "exportedRows";
|
|
1011
|
-
tableName: "ExportHistory";
|
|
1012
|
-
dataType: "number";
|
|
1013
|
-
columnType: "PgInteger";
|
|
1014
|
-
data: number;
|
|
1015
|
-
driverParam: string | number;
|
|
1016
|
-
notNull: true;
|
|
1017
|
-
hasDefault: false;
|
|
1018
|
-
isPrimaryKey: false;
|
|
1019
|
-
isAutoincrement: false;
|
|
1020
|
-
hasRuntimeDefault: false;
|
|
1021
|
-
enumValues: undefined;
|
|
1022
|
-
baseColumn: never;
|
|
1023
|
-
identity: undefined;
|
|
1024
|
-
generated: undefined;
|
|
1025
|
-
}, {}, {}>;
|
|
1026
|
-
status: drizzle_orm_pg_core.PgColumn<{
|
|
1027
|
-
name: "status";
|
|
1028
|
-
tableName: "ExportHistory";
|
|
1029
|
-
dataType: "string";
|
|
1030
|
-
columnType: "PgText";
|
|
1031
|
-
data: string;
|
|
1032
|
-
driverParam: string;
|
|
1033
|
-
notNull: true;
|
|
1034
|
-
hasDefault: false;
|
|
1035
|
-
isPrimaryKey: false;
|
|
1036
|
-
isAutoincrement: false;
|
|
1037
|
-
hasRuntimeDefault: false;
|
|
1038
|
-
enumValues: [string, ...string[]];
|
|
1039
|
-
baseColumn: never;
|
|
1040
|
-
identity: undefined;
|
|
1041
|
-
generated: undefined;
|
|
1042
|
-
}, {}, {}>;
|
|
1043
|
-
error: drizzle_orm_pg_core.PgColumn<{
|
|
1044
|
-
name: "error";
|
|
1045
|
-
tableName: "ExportHistory";
|
|
1046
|
-
dataType: "string";
|
|
1047
|
-
columnType: "PgText";
|
|
1048
|
-
data: string;
|
|
1049
|
-
driverParam: string;
|
|
1050
|
-
notNull: false;
|
|
1051
|
-
hasDefault: false;
|
|
1052
|
-
isPrimaryKey: false;
|
|
1053
|
-
isAutoincrement: false;
|
|
1054
|
-
hasRuntimeDefault: false;
|
|
1055
|
-
enumValues: [string, ...string[]];
|
|
1056
|
-
baseColumn: never;
|
|
1057
|
-
identity: undefined;
|
|
1058
|
-
generated: undefined;
|
|
1059
|
-
}, {}, {}>;
|
|
1060
|
-
duration: drizzle_orm_pg_core.PgColumn<{
|
|
1061
|
-
name: "duration";
|
|
1062
|
-
tableName: "ExportHistory";
|
|
1063
|
-
dataType: "number";
|
|
1064
|
-
columnType: "PgInteger";
|
|
1065
|
-
data: number;
|
|
1066
|
-
driverParam: string | number;
|
|
1067
|
-
notNull: false;
|
|
1068
|
-
hasDefault: false;
|
|
1069
|
-
isPrimaryKey: false;
|
|
1070
|
-
isAutoincrement: false;
|
|
1071
|
-
hasRuntimeDefault: false;
|
|
1072
|
-
enumValues: undefined;
|
|
1073
|
-
baseColumn: never;
|
|
1074
|
-
identity: undefined;
|
|
1075
|
-
generated: undefined;
|
|
1076
|
-
}, {}, {}>;
|
|
1077
|
-
startTime: drizzle_orm_pg_core.PgColumn<{
|
|
1078
|
-
name: "startTime";
|
|
1079
|
-
tableName: "ExportHistory";
|
|
1080
|
-
dataType: "date";
|
|
1081
|
-
columnType: "PgTimestamp";
|
|
1082
|
-
data: Date;
|
|
1083
|
-
driverParam: string;
|
|
1084
|
-
notNull: true;
|
|
1085
|
-
hasDefault: false;
|
|
1086
|
-
isPrimaryKey: false;
|
|
1087
|
-
isAutoincrement: false;
|
|
1088
|
-
hasRuntimeDefault: false;
|
|
1089
|
-
enumValues: undefined;
|
|
1090
|
-
baseColumn: never;
|
|
1091
|
-
identity: undefined;
|
|
1092
|
-
generated: undefined;
|
|
1093
|
-
}, {}, {}>;
|
|
1094
|
-
endTime: drizzle_orm_pg_core.PgColumn<{
|
|
1095
|
-
name: "endTime";
|
|
1096
|
-
tableName: "ExportHistory";
|
|
1097
|
-
dataType: "date";
|
|
1098
|
-
columnType: "PgTimestamp";
|
|
1099
|
-
data: Date;
|
|
1100
|
-
driverParam: string;
|
|
1101
|
-
notNull: false;
|
|
1102
|
-
hasDefault: false;
|
|
1103
|
-
isPrimaryKey: false;
|
|
1104
|
-
isAutoincrement: false;
|
|
1105
|
-
hasRuntimeDefault: false;
|
|
1106
|
-
enumValues: undefined;
|
|
1107
|
-
baseColumn: never;
|
|
1108
|
-
identity: undefined;
|
|
1109
|
-
generated: undefined;
|
|
1110
|
-
}, {}, {}>;
|
|
1111
|
-
createdBy: drizzle_orm_pg_core.PgColumn<{
|
|
1112
|
-
name: "createdBy";
|
|
1113
|
-
tableName: "ExportHistory";
|
|
1114
|
-
dataType: "string";
|
|
1115
|
-
columnType: "PgText";
|
|
1116
|
-
data: string;
|
|
1117
|
-
driverParam: string;
|
|
1118
|
-
notNull: false;
|
|
1119
|
-
hasDefault: false;
|
|
1120
|
-
isPrimaryKey: false;
|
|
1121
|
-
isAutoincrement: false;
|
|
1122
|
-
hasRuntimeDefault: false;
|
|
1123
|
-
enumValues: [string, ...string[]];
|
|
1124
|
-
baseColumn: never;
|
|
1125
|
-
identity: undefined;
|
|
1126
|
-
generated: undefined;
|
|
1127
|
-
}, {}, {}>;
|
|
1128
|
-
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1129
|
-
name: "createdAt";
|
|
1130
|
-
tableName: "ExportHistory";
|
|
1131
|
-
dataType: "date";
|
|
1132
|
-
columnType: "PgTimestamp";
|
|
1133
|
-
data: Date;
|
|
1134
|
-
driverParam: string;
|
|
1135
|
-
notNull: true;
|
|
1136
|
-
hasDefault: true;
|
|
1137
|
-
isPrimaryKey: false;
|
|
1138
|
-
isAutoincrement: false;
|
|
1139
|
-
hasRuntimeDefault: false;
|
|
1140
|
-
enumValues: undefined;
|
|
1141
|
-
baseColumn: never;
|
|
1142
|
-
identity: undefined;
|
|
1143
|
-
generated: undefined;
|
|
1144
|
-
}, {}, {}>;
|
|
1145
|
-
};
|
|
1146
|
-
dialect: "pg";
|
|
1147
|
-
}>;
|
|
1148
|
-
/**
|
|
1149
|
-
* 导出配置表关系
|
|
1150
|
-
* 一个配置可以有多个导出历史记录
|
|
1151
|
-
*/
|
|
1152
|
-
declare const exportConfigsRelations: drizzle_orm.Relations<"ExportConfig", {
|
|
1153
|
-
history: drizzle_orm.Many<"ExportHistory">;
|
|
1154
|
-
}>;
|
|
1155
|
-
/**
|
|
1156
|
-
* 导出历史表关系
|
|
1157
|
-
* 每个历史记录关联一个配置
|
|
1158
|
-
*/
|
|
1159
|
-
declare const exportHistoryRelations: drizzle_orm.Relations<"ExportHistory", {
|
|
1160
|
-
config: drizzle_orm.One<"ExportConfig", true>;
|
|
1161
|
-
}>;
|
|
1162
|
-
type ExportConfig = typeof exportConfigs.$inferSelect;
|
|
1163
|
-
type NewExportConfig = typeof exportConfigs.$inferInsert;
|
|
1164
|
-
type ExportHistory = typeof exportHistory.$inferSelect;
|
|
1165
|
-
type NewExportHistory = typeof exportHistory.$inferInsert;
|
|
1166
|
-
|
|
1167
|
-
/**
|
|
1168
|
-
* 通用导出服务 - Drizzle 数据库操作层
|
|
1169
|
-
*
|
|
1170
|
-
* 提供导出配置和历史记录的数据库操作接口。
|
|
1171
|
-
* 支持任何 Drizzle 数据库实例。
|
|
1172
|
-
*
|
|
1173
|
-
* @package sa2kit/universalExport/server
|
|
1174
|
-
*/
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* Drizzle 数据库实例类型
|
|
1178
|
-
*/
|
|
1179
|
-
type DrizzleDb = any;
|
|
1180
|
-
/**
|
|
1181
|
-
* 导出配置数据库服务工厂选项
|
|
1182
|
-
*/
|
|
1183
|
-
interface ExportDatabaseServiceOptions {
|
|
1184
|
-
/**
|
|
1185
|
-
* Drizzle 数据库实例
|
|
1186
|
-
*/
|
|
1187
|
-
db: DrizzleDb;
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* 导出配置数据库服务
|
|
1191
|
-
*
|
|
1192
|
-
* 提供导出配置的 CRUD 操作
|
|
1193
|
-
*/
|
|
1194
|
-
declare class ExportConfigDatabaseService {
|
|
1195
|
-
private readonly db;
|
|
1196
|
-
constructor(db: DrizzleDb);
|
|
1197
|
-
/**
|
|
1198
|
-
* 创建导出配置
|
|
1199
|
-
*/
|
|
1200
|
-
createConfig(config: Omit<NewExportConfig, 'id' | 'createdAt' | 'updatedAt'>): Promise<ExportConfig>;
|
|
1201
|
-
/**
|
|
1202
|
-
* 根据ID获取配置
|
|
1203
|
-
*/
|
|
1204
|
-
getConfigById(id: string): Promise<ExportConfig | null>;
|
|
1205
|
-
/**
|
|
1206
|
-
* 根据模块和业务ID获取配置列表
|
|
1207
|
-
*/
|
|
1208
|
-
getConfigsByModule(moduleId: string, businessId?: string): Promise<ExportConfig[]>;
|
|
1209
|
-
/**
|
|
1210
|
-
* 更新配置
|
|
1211
|
-
*/
|
|
1212
|
-
updateConfig(id: string, updates: Partial<Omit<ExportConfig, 'id' | 'createdAt'>>): Promise<ExportConfig | null>;
|
|
1213
|
-
/**
|
|
1214
|
-
* 删除配置
|
|
1215
|
-
*/
|
|
1216
|
-
deleteConfig(id: string): Promise<boolean>;
|
|
1217
|
-
/**
|
|
1218
|
-
* 根据用户ID获取配置列表
|
|
1219
|
-
*/
|
|
1220
|
-
getConfigsByUser(userId: string): Promise<ExportConfig[]>;
|
|
1221
|
-
}
|
|
1222
|
-
/**
|
|
1223
|
-
* 导出历史记录数据库服务
|
|
1224
|
-
*
|
|
1225
|
-
* 提供导出历史记录的 CRUD 操作
|
|
1226
|
-
*/
|
|
1227
|
-
declare class ExportHistoryDatabaseService {
|
|
1228
|
-
private readonly db;
|
|
1229
|
-
constructor(db: DrizzleDb);
|
|
1230
|
-
/**
|
|
1231
|
-
* 创建导出历史记录
|
|
1232
|
-
*/
|
|
1233
|
-
createHistory(history: Omit<NewExportHistory, 'id' | 'createdAt'>): Promise<ExportHistory>;
|
|
1234
|
-
/**
|
|
1235
|
-
* 根据配置ID获取历史记录
|
|
1236
|
-
*/
|
|
1237
|
-
getHistoryByConfigId(configId: string): Promise<ExportHistory[]>;
|
|
1238
|
-
/**
|
|
1239
|
-
* 根据用户ID获取历史记录
|
|
1240
|
-
*/
|
|
1241
|
-
getHistoryByUser(userId: string): Promise<ExportHistory[]>;
|
|
1242
|
-
/**
|
|
1243
|
-
* 获取最近的导出历史记录
|
|
1244
|
-
*/
|
|
1245
|
-
getRecentHistory(limit?: number): Promise<ExportHistory[]>;
|
|
1246
|
-
}
|
|
1247
|
-
/**
|
|
1248
|
-
* 创建导出数据库服务实例
|
|
1249
|
-
*
|
|
1250
|
-
* @param options - 数据库服务选项
|
|
1251
|
-
* @returns 导出配置和历史记录服务实例
|
|
1252
|
-
*
|
|
1253
|
-
* @example
|
|
1254
|
-
* ```typescript
|
|
1255
|
-
* import { createExportDatabaseServices } from 'sa2kit/universalExport/server';
|
|
1256
|
-
* import { db } from './db';
|
|
1257
|
-
*
|
|
1258
|
-
* const { configDB, historyDB } = createExportDatabaseServices({ db });
|
|
1259
|
-
*
|
|
1260
|
-
* // 使用服务
|
|
1261
|
-
* const config = await configDB.createConfig({ ... });
|
|
1262
|
-
* const history = await historyDB.createHistory({ ... });
|
|
1263
|
-
* ```
|
|
1264
|
-
*/
|
|
1265
|
-
declare function createExportDatabaseServices(options: ExportDatabaseServiceOptions): {
|
|
1266
|
-
configDB: ExportConfigDatabaseService;
|
|
1267
|
-
historyDB: ExportHistoryDatabaseService;
|
|
1268
|
-
};
|
|
1269
|
-
|
|
1270
|
-
export { type AggregateFunction, type CustomProcessor, type DataQueryOptions, type DataTransformer, type DrizzleDb, type EngineInfo, type ExportConfig, ExportConfigDatabaseService, type ExportConfigRecord, ConfigValidationError as ExportConfigValidationError, type ExportDatabaseServiceOptions, type ExportEvent, type ExportEventListener, type ExportEventType, type ExportHistory, ExportHistoryDatabaseService, type ExportHistoryRecord, type ExportProgress, type ExportResult, type ExportTaskRecord, type FieldMapper, type FormatterFunction, type IDataSource, type IExportClient, type IExportEngine, type NewExportConfig, type NewExportHistory, type TaskCreateOptions, type TaskUpdateOptions, UniversalExportService, type UniversalExportServiceConfig, type ValidationError, type ValidationResult, type Validator, calculateProgress, convertFieldType, createBatchExportPreset, createExportDatabaseServices, createExportServiceConfig, createExportServiceFromEnv, createLargeAppPreset, createMediumAppPreset, createRealtimeExportPreset, createSmallAppPreset, createSmartExportPreset, createUniversalExportService, escapeCsvValue, estimateRemainingTime, exportConfigs, exportConfigsRelations, exportHistory, exportHistoryRelations, formatFieldValue, generateUniqueFilename, getNestedValue, validateExportConfig, validateEnvironment as validateExportEnvironment, validateFieldValue };
|