@qhr123/sa2kit 0.1.1 → 0.2.0

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 CHANGED
@@ -1,4 +1,4 @@
1
- # React Utils Kit
1
+ # SA2Kit
2
2
 
3
3
  A modern, type-safe React utility library with cross-platform support for building scalable applications.
4
4
 
@@ -12,15 +12,17 @@ A modern, type-safe React utility library with cross-platform support for buildi
12
12
  - 🎯 **React Hooks** - Custom hooks for common patterns
13
13
  - 📝 **Logger System** - Unified logging with multiple adapters
14
14
  - 💾 **Storage Adapters** - Universal storage abstraction
15
+ - 📁 **File Upload** - Complete file management with progress tracking
16
+ - 📊 **Data Export** - Flexible export to CSV, Excel, JSON formats
15
17
 
16
18
  ## Installation
17
19
 
18
20
  ```bash
19
- npm install @react-utils-kit/core
21
+ npm install @qhr123/sa2kit
20
22
  # or
21
- yarn add @react-utils-kit/core
23
+ yarn add @qhr123/sa2kit
22
24
  # or
23
- pnpm add @react-utils-kit/core
25
+ pnpm add @qhr123/sa2kit
24
26
  ```
25
27
 
26
28
  ## Quick Start
@@ -28,7 +30,7 @@ pnpm add @react-utils-kit/core
28
30
  ### Logger
29
31
 
30
32
  ```typescript
31
- import { logger, createLogger, LogLevel } from '@react-utils-kit/core/logger';
33
+ import { logger, createLogger, LogLevel } from '@qhr123/sa2kit/logger';
32
34
 
33
35
  // Use default logger
34
36
  logger.info('Application started');
@@ -47,7 +49,7 @@ apiLogger.info('API request completed');
47
49
  ### Utility Functions
48
50
 
49
51
  ```typescript
50
- import { stringUtils, arrayUtils, fileUtils } from '@react-utils-kit/core/utils';
52
+ import { stringUtils, arrayUtils, fileUtils } from '@qhr123/sa2kit/utils';
51
53
 
52
54
  // String utilities
53
55
  const capitalized = stringUtils.capitalize('hello world');
@@ -65,7 +67,7 @@ const isValid = fileUtils.isValidFilename('document.pdf');
65
67
  ### React Hooks
66
68
 
67
69
  ```typescript
68
- import { useLocalStorage, useAsyncStorage } from '@react-utils-kit/core/hooks';
70
+ import { useLocalStorage, useAsyncStorage } from '@qhr123/sa2kit/hooks';
69
71
 
70
72
  function MyComponent() {
71
73
  // Persistent state with localStorage
@@ -78,12 +80,80 @@ function MyComponent() {
78
80
  }
79
81
  ```
80
82
 
83
+ ### File Upload
84
+
85
+ ```typescript
86
+ import { universalFileClient } from '@qhr123/sa2kit/universalFile';
87
+
88
+ // Upload a file with progress tracking
89
+ const uploadFile = async (file: File) => {
90
+ const fileMetadata = await universalFileClient.uploadFile(
91
+ {
92
+ file,
93
+ moduleId: 'user-avatars',
94
+ businessId: 'user-123',
95
+ permission: 'public',
96
+ },
97
+ (progress) => {
98
+ console.log(`Upload progress: ${progress.progress}%`);
99
+ console.log(`Speed: ${progress.speed} bytes/sec`);
100
+ }
101
+ );
102
+
103
+ console.log('File uploaded:', fileMetadata.id);
104
+ return fileMetadata;
105
+ };
106
+
107
+ // Query files
108
+ const files = await universalFileClient.queryFiles({
109
+ moduleId: 'user-avatars',
110
+ pageSize: 20,
111
+ });
112
+
113
+ // Get file URL
114
+ const fileUrl = await universalFileClient.getFileUrl(fileId);
115
+ ```
116
+
117
+ ### Data Export
118
+
119
+ ```typescript
120
+ import { universalExportClient } from '@qhr123/sa2kit/universalExport';
121
+
122
+ // Export data to CSV
123
+ const exportData = async () => {
124
+ const result = await universalExportClient.exportData({
125
+ configId: 'my-export-config',
126
+ dataSource: async () => [
127
+ { id: 1, name: 'John', email: 'john@example.com' },
128
+ { id: 2, name: 'Jane', email: 'jane@example.com' },
129
+ ],
130
+ format: 'csv',
131
+ callbacks: {
132
+ onProgress: (progress) => {
133
+ console.log(`Export progress: ${progress.progress}%`);
134
+ },
135
+ onSuccess: (result) => {
136
+ console.log('Export completed:', result.fileName);
137
+ // Download the file
138
+ const url = URL.createObjectURL(result.fileBlob!);
139
+ const a = document.createElement('a');
140
+ a.href = url;
141
+ a.download = result.fileName;
142
+ a.click();
143
+ },
144
+ },
145
+ });
146
+ };
147
+ ```
148
+
81
149
  ## Documentation
82
150
 
83
151
  - [Logger Documentation](./docs/logger.md)
84
152
  - [Utility Functions](./docs/utils.md)
85
153
  - [React Hooks](./docs/hooks.md)
86
154
  - [Storage Adapters](./docs/storage.md)
155
+ - [File Upload Service](./docs/universalFile.md)
156
+ - [Data Export Service](./docs/universalExport.md)
87
157
 
88
158
  ## Examples
89
159
 
@@ -0,0 +1,517 @@
1
+ /**
2
+ * 通用导出服务类型定义
3
+ *
4
+ * 定义了导出功能的核心接口和类型
5
+ */
6
+ /** 导出格式类型 */
7
+ type ExportFormat = 'csv' | 'excel' | 'json';
8
+ /** 字段类型 */
9
+ type FieldType = 'string' | 'number' | 'date' | 'boolean' | 'array' | 'object';
10
+ /** 字段对齐方式 */
11
+ type FieldAlignment = 'left' | 'center' | 'right';
12
+ /** 导出状态 */
13
+ type ExportStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
14
+ /** 分组模式 */
15
+ type GroupingMode = 'merge' | 'separate' | 'nested';
16
+ /** 分组处理类型 */
17
+ type GroupValueProcessing = 'first' | 'last' | 'concat' | 'sum' | 'count' | 'custom';
18
+ /** 导出字段定义 */
19
+ interface ExportField {
20
+ /** 字段键名 */
21
+ key: string;
22
+ /** 字段显示名称 */
23
+ label: string;
24
+ /** 字段类型 */
25
+ type: FieldType;
26
+ /** 是否启用 */
27
+ enabled: boolean;
28
+ /** 字段宽度 */
29
+ width?: number;
30
+ /** 对齐方式 */
31
+ alignment?: FieldAlignment;
32
+ /** 格式化函数 */
33
+ formatter?: (value: any) => string;
34
+ /** 排序权重 */
35
+ sortOrder?: number;
36
+ /** 是否必填 */
37
+ required?: boolean;
38
+ /** 字段描述 */
39
+ description?: string;
40
+ /** 自定义样式 */
41
+ style?: Record<string, any>;
42
+ }
43
+ /** 分组字段配置 */
44
+ interface GroupingField {
45
+ /** 分组字段键名 */
46
+ key: string;
47
+ /** 分组字段显示名称 */
48
+ label: string;
49
+ /** 分组模式 */
50
+ mode: GroupingMode;
51
+ /** 其他字段的值处理方式 */
52
+ valueProcessing: GroupValueProcessing;
53
+ /** 自定义处理函数 */
54
+ customProcessor?: (values: any[]) => any;
55
+ /** 是否显示分组行 */
56
+ showGroupHeader: boolean;
57
+ /** 分组行模板 */
58
+ groupHeaderTemplate?: string;
59
+ /** 是否合并单元格(仅Excel格式支持) */
60
+ mergeCells: boolean;
61
+ }
62
+ /** 分组配置 */
63
+ interface GroupingConfig {
64
+ /** 是否启用分组 */
65
+ enabled: boolean;
66
+ /** 分组字段列表(支持多级分组) */
67
+ fields: GroupingField[];
68
+ /** 分组后是否保持原始顺序 */
69
+ preserveOrder: boolean;
70
+ /** 空值处理方式 */
71
+ nullValueHandling: 'skip' | 'group' | 'separate';
72
+ /** 空值分组名称 */
73
+ nullGroupName?: string;
74
+ }
75
+ /** 导出配置 */
76
+ interface ExportConfig {
77
+ /** 配置ID */
78
+ id: string;
79
+ /** 配置名称 */
80
+ name: string;
81
+ /** 配置描述 */
82
+ description?: string;
83
+ /** 导出格式 */
84
+ format: ExportFormat;
85
+ /** 字段定义 */
86
+ fields: ExportField[];
87
+ /** 分组配置 */
88
+ grouping?: GroupingConfig;
89
+ /** 文件名模板 */
90
+ fileNameTemplate: string;
91
+ /** 是否包含表头 */
92
+ includeHeader: boolean;
93
+ /** 分隔符 */
94
+ delimiter: string;
95
+ /** 编码格式 */
96
+ encoding: string;
97
+ /** 是否添加BOM */
98
+ addBOM: boolean;
99
+ /** 最大行数限制 */
100
+ maxRows?: number;
101
+ /** 创建时间 */
102
+ createdAt: Date;
103
+ /** 更新时间 */
104
+ updatedAt: Date;
105
+ /** 模块标识 */
106
+ moduleId: string;
107
+ /** 业务标识 */
108
+ businessId?: string;
109
+ /** 创建者ID */
110
+ createdBy?: string;
111
+ }
112
+ /** 导出请求 */
113
+ interface ExportRequest {
114
+ /** 导出配置ID或配置对象 */
115
+ configId: string | ExportConfig;
116
+ /** 数据源 */
117
+ dataSource: string | (() => Promise<any[]>);
118
+ /** 查询参数 */
119
+ queryParams?: Record<string, any>;
120
+ /** 自定义字段映射 */
121
+ fieldMapping?: Record<string, string>;
122
+ /** 过滤条件 */
123
+ filters?: ExportFilter[];
124
+ /** 排序条件 */
125
+ sortBy?: ExportSort[];
126
+ /** 分页参数 */
127
+ pagination?: {
128
+ page: number;
129
+ pageSize: number;
130
+ };
131
+ /** 自定义文件名 */
132
+ customFileName?: string;
133
+ /** 回调函数 */
134
+ callbacks?: {
135
+ onProgress?: (progress: ExportProgress) => void;
136
+ onSuccess?: (result: ExportResult) => void;
137
+ onError?: (error: ExportError) => void;
138
+ };
139
+ }
140
+ /** 导出过滤器 */
141
+ interface ExportFilter {
142
+ /** 字段名 */
143
+ field: string;
144
+ /** 操作符 */
145
+ operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'startsWith' | 'endsWith' | 'in' | 'notIn';
146
+ /** 值 */
147
+ value: any;
148
+ }
149
+ /** 导出排序 */
150
+ interface ExportSort {
151
+ /** 字段名 */
152
+ field: string;
153
+ /** 排序方向 */
154
+ direction: 'asc' | 'desc';
155
+ }
156
+ /** 导出进度 */
157
+ interface ExportProgress {
158
+ /** 导出ID */
159
+ exportId: string;
160
+ /** 状态 */
161
+ status: ExportStatus;
162
+ /** 进度百分比 */
163
+ progress: number;
164
+ /** 已处理行数 */
165
+ processedRows: number;
166
+ /** 总行数 */
167
+ totalRows: number;
168
+ /** 开始时间 */
169
+ startTime: Date;
170
+ /** 预计完成时间 */
171
+ estimatedEndTime?: Date;
172
+ /** 当前处理的数据 */
173
+ currentData?: any;
174
+ /** 错误信息 */
175
+ error?: string;
176
+ }
177
+ /** 导出结果 */
178
+ interface ExportResult {
179
+ /** 导出ID */
180
+ exportId: string;
181
+ /** 文件名 */
182
+ fileName: string;
183
+ /** 文件大小 */
184
+ fileSize: number;
185
+ /** 文件URL */
186
+ fileUrl?: string;
187
+ /** 文件Blob */
188
+ fileBlob?: Blob;
189
+ /** 导出行数 */
190
+ exportedRows: number;
191
+ /** 开始时间 */
192
+ startTime: Date;
193
+ /** 完成时间 */
194
+ endTime: Date;
195
+ /** 耗时(毫秒) */
196
+ duration: number;
197
+ /** 统计信息 */
198
+ statistics?: {
199
+ totalRows: number;
200
+ filteredRows: number;
201
+ exportedRows: number;
202
+ skippedRows: number;
203
+ };
204
+ }
205
+ /** 导出错误 */
206
+ interface ExportError {
207
+ /** 错误代码 */
208
+ code: string;
209
+ /** 错误消息 */
210
+ message: string;
211
+ /** 错误详情 */
212
+ details?: Record<string, any>;
213
+ /** 错误时间 */
214
+ timestamp: Date;
215
+ }
216
+ /** 通用导出服务配置 */
217
+ interface UniversalExportServiceConfig {
218
+ /** 默认导出格式 */
219
+ defaultFormat: ExportFormat;
220
+ /** 默认分隔符 */
221
+ defaultDelimiter: string;
222
+ /** 默认编码 */
223
+ defaultEncoding: string;
224
+ /** 是否默认添加BOM */
225
+ defaultAddBOM: boolean;
226
+ /** 最大文件大小限制(字节) */
227
+ maxFileSize: number;
228
+ /** 最大行数限制 */
229
+ maxRowsLimit: number;
230
+ /** 并发导出数量限制 */
231
+ maxConcurrentExports: number;
232
+ /** 导出超时时间(毫秒) */
233
+ exportTimeout: number;
234
+ /** 缓存配置 */
235
+ cache: {
236
+ /** 配置缓存TTL(秒) */
237
+ configTTL: number;
238
+ /** 结果缓存TTL(秒) */
239
+ resultTTL: number;
240
+ };
241
+ }
242
+ /** 导出服务基础异常 */
243
+ declare class ExportServiceError extends Error {
244
+ readonly code: string;
245
+ readonly details?: Record<string, any> | undefined;
246
+ constructor(message: string, code: string, details?: Record<string, any> | undefined);
247
+ }
248
+ /** 导出配置错误 */
249
+ declare class ExportConfigError extends ExportServiceError {
250
+ constructor(message: string, details?: Record<string, any>);
251
+ }
252
+ /** 导出数据处理错误 */
253
+ declare class ExportDataError extends ExportServiceError {
254
+ constructor(message: string, details?: Record<string, any>);
255
+ }
256
+ /** 导出文件生成错误 */
257
+ declare class ExportFileError extends ExportServiceError {
258
+ constructor(message: string, details?: Record<string, any>);
259
+ }
260
+ /** 导出事件类型 */
261
+ type ExportEventType = 'export:start' | 'export:progress' | 'export:complete' | 'export:error' | 'export:cancel' | 'config:save' | 'config:delete';
262
+ /** 导出事件 */
263
+ interface ExportEvent {
264
+ /** 事件类型 */
265
+ type: ExportEventType;
266
+ /** 导出ID */
267
+ exportId: string;
268
+ /** 事件时间 */
269
+ timestamp: Date;
270
+ /** 事件数据 */
271
+ data?: Record<string, any>;
272
+ /** 错误信息 */
273
+ error?: string;
274
+ }
275
+ /** 导出事件监听器 */
276
+ type ExportEventListener = (event: ExportEvent) => void | Promise<void>;
277
+ /** 字段映射函数 */
278
+ type FieldMapper<T = any> = (item: T, index: number) => Record<string, any>;
279
+ /** 数据转换函数 */
280
+ type DataTransformer<T = any, R = any> = (data: T[]) => R[];
281
+ /** 验证函数 */
282
+ type Validator<T = any> = (data: T) => boolean | string;
283
+ /** 格式化函数 */
284
+ type Formatter<T = any> = (value: T) => string;
285
+
286
+ /**
287
+ * 通用导出服务客户端SDK
288
+ *
289
+ * 提供与后端API交互的客户端接口
290
+ */
291
+
292
+ interface UniversalExportClientConfig {
293
+ /** API基础URL */
294
+ baseUrl?: string;
295
+ /** 请求超时时间(毫秒) */
296
+ timeout?: number;
297
+ /** 自定义请求头 */
298
+ headers?: Record<string, string>;
299
+ }
300
+ /**
301
+ * 通用导出服务客户端
302
+ */
303
+ declare class UniversalExportClient {
304
+ private config;
305
+ constructor(config?: UniversalExportClientConfig);
306
+ /**
307
+ * 获取模块的导出配置列表
308
+ */
309
+ getConfigsByModule(moduleId: string, businessId?: string): Promise<ExportConfig[]>;
310
+ /**
311
+ * 创建导出配置
312
+ */
313
+ createConfig(config: Omit<ExportConfig, 'id' | 'createdAt' | 'updatedAt'>): Promise<ExportConfig>;
314
+ /**
315
+ * 更新导出配置
316
+ */
317
+ updateConfig(configId: string, updates: Partial<ExportConfig>): Promise<ExportConfig>;
318
+ /**
319
+ * 删除导出配置
320
+ */
321
+ deleteConfig(configId: string): Promise<void>;
322
+ /**
323
+ * 触发数据导出
324
+ */
325
+ exportData(request: Omit<ExportRequest, 'callbacks'>): Promise<ExportResult>;
326
+ /**
327
+ * 查询导出进度
328
+ */
329
+ getExportProgress(exportId: string): Promise<ExportProgress>;
330
+ /**
331
+ * 下载导出文件
332
+ */
333
+ downloadExportFile(exportId: string): Promise<Blob>;
334
+ /**
335
+ * 获取请求头
336
+ */
337
+ private getHeaders;
338
+ /**
339
+ * 带超时的fetch请求
340
+ */
341
+ private fetchWithTimeout;
342
+ /**
343
+ * 转换API返回的配置数据
344
+ */
345
+ private transformConfigFromAPI;
346
+ /**
347
+ * 转换API返回的配置列表
348
+ */
349
+ private transformConfigsFromAPI;
350
+ /**
351
+ * 转换API返回的导出结果
352
+ */
353
+ private transformExportResultFromAPI;
354
+ /**
355
+ * 转换API返回的进度数据
356
+ */
357
+ private transformProgressFromAPI;
358
+ }
359
+ /**
360
+ * 默认客户端实例
361
+ */
362
+ declare const universalExportClient: UniversalExportClient;
363
+ /**
364
+ * 创建自定义客户端实例
365
+ */
366
+ declare function createExportClient(config?: UniversalExportClientConfig): UniversalExportClient;
367
+
368
+ /**
369
+ * 通用导出服务常量定义
370
+ */
371
+
372
+ /** 模块版本 */
373
+ declare const UNIVERSAL_EXPORT_VERSION = "1.0.0";
374
+ /** 模块名称 */
375
+ declare const UNIVERSAL_EXPORT_NAME = "@lyricnote/universal-export";
376
+ /** 默认导出格式 */
377
+ declare const DEFAULT_EXPORT_FORMAT: ExportFormat;
378
+ /** 默认CSV分隔符 */
379
+ declare const DEFAULT_CSV_DELIMITER = ",";
380
+ /** 默认编码格式 */
381
+ declare const DEFAULT_ENCODING = "utf-8";
382
+ /** 默认是否添加BOM */
383
+ declare const DEFAULT_ADD_BOM = true;
384
+ /** 默认最大文件大小(字节) - 100MB */
385
+ declare const DEFAULT_MAX_FILE_SIZE: number;
386
+ /** 默认最大行数限制 */
387
+ declare const DEFAULT_MAX_ROWS = 100000;
388
+ /** 默认并发导出数量 */
389
+ declare const DEFAULT_MAX_CONCURRENT_EXPORTS = 5;
390
+ /** 默认导出超时时间(毫秒) - 5分钟 */
391
+ declare const DEFAULT_EXPORT_TIMEOUT = 300000;
392
+ /** 默认配置缓存TTL(秒) - 1小时 */
393
+ declare const DEFAULT_CONFIG_CACHE_TTL = 3600;
394
+ /** 默认结果缓存TTL(秒) - 30分钟 */
395
+ declare const DEFAULT_RESULT_CACHE_TTL = 1800;
396
+ /** 导出格式对应的文件扩展名 */
397
+ declare const EXPORT_FORMAT_EXTENSIONS: Record<ExportFormat, string>;
398
+ /** 导出格式对应的MIME类型 */
399
+ declare const EXPORT_FORMAT_MIME_TYPES: Record<ExportFormat, string>;
400
+ /** API基础路径 */
401
+ declare const API_BASE_PATH = "/api/universal-export";
402
+ /** API端点 */
403
+ declare const API_ENDPOINTS: {
404
+ /** 获取配置列表 */
405
+ readonly GET_CONFIGS: "/api/universal-export/configs";
406
+ /** 创建配置 */
407
+ readonly CREATE_CONFIG: "/api/universal-export/configs";
408
+ /** 更新配置 */
409
+ readonly UPDATE_CONFIG: (configId: string) => string;
410
+ /** 删除配置 */
411
+ readonly DELETE_CONFIG: (configId: string) => string;
412
+ /** 触发导出 */
413
+ readonly EXPORT_DATA: "/api/universal-export/export";
414
+ /** 查询导出进度 */
415
+ readonly GET_PROGRESS: (exportId: string) => string;
416
+ /** 下载导出文件 */
417
+ readonly DOWNLOAD_FILE: (exportId: string) => string;
418
+ };
419
+ /** 错误代码 */
420
+ declare const ERROR_CODES: {
421
+ /** 导出配置错误 */
422
+ readonly EXPORT_CONFIG_ERROR: "EXPORT_CONFIG_ERROR";
423
+ /** 导出数据错误 */
424
+ readonly EXPORT_DATA_ERROR: "EXPORT_DATA_ERROR";
425
+ /** 导出文件错误 */
426
+ readonly EXPORT_FILE_ERROR: "EXPORT_FILE_ERROR";
427
+ /** 网络错误 */
428
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
429
+ /** 超时错误 */
430
+ readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
431
+ /** 未授权 */
432
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
433
+ /** 服务器错误 */
434
+ readonly SERVER_ERROR: "SERVER_ERROR";
435
+ };
436
+
437
+ /**
438
+ * 通用导出服务工具函数
439
+ */
440
+
441
+ /**
442
+ * 生成导出文件名
443
+ */
444
+ declare function generateExportFileName(template: string, format: ExportFormat): string;
445
+ /**
446
+ * 验证文件名是否合法
447
+ */
448
+ declare function validateFileName(fileName: string): boolean;
449
+ /**
450
+ * 清理文件名,移除非法字符
451
+ */
452
+ declare function sanitizeFileName(fileName: string): string;
453
+ /**
454
+ * 转义CSV字段
455
+ */
456
+ declare function escapeCSVField(value: string, delimiter?: string): string;
457
+ /**
458
+ * 解析CSV字段
459
+ */
460
+ declare function parseCSVField(field: string): string;
461
+ /**
462
+ * 内置格式化器集合
463
+ */
464
+ declare const DEFAULT_FORMATTERS: Record<string, Formatter>;
465
+ /**
466
+ * 应用格式化器
467
+ */
468
+ declare function applyFormatter(value: any, formatter?: Formatter, type?: string): string;
469
+ /**
470
+ * 验证导出配置
471
+ */
472
+ declare function validateExportConfig(config: any): {
473
+ valid: boolean;
474
+ errors: string[];
475
+ };
476
+ /**
477
+ * 验证导出请求
478
+ */
479
+ declare function validateExportRequest(request: any): {
480
+ valid: boolean;
481
+ errors: string[];
482
+ };
483
+ /**
484
+ * 格式化文件大小
485
+ */
486
+ declare function formatFileSize(bytes: number): string;
487
+ /**
488
+ * 格式化持续时间
489
+ */
490
+ declare function formatDuration(milliseconds: number): string;
491
+ /**
492
+ * 计算预计完成时间
493
+ */
494
+ declare function estimateEndTime(startTime: Date, processedRows: number, totalRows: number): Date | undefined;
495
+ /**
496
+ * 获取嵌套对象的值
497
+ */
498
+ declare function getNestedValue(obj: any, path: string): any;
499
+ /**
500
+ * 设置嵌套对象的值
501
+ */
502
+ declare function setNestedValue(obj: any, path: string, value: any): void;
503
+ /**
504
+ * 创建导出错误对象
505
+ */
506
+ declare function createExportError(code: string, message: string, details?: Record<string, any>): {
507
+ code: string;
508
+ message: string;
509
+ details?: Record<string, any>;
510
+ timestamp: Date;
511
+ };
512
+ /**
513
+ * 格式化错误消息
514
+ */
515
+ declare function formatErrorMessage(error: unknown): string;
516
+
517
+ export { API_BASE_PATH, API_ENDPOINTS, DEFAULT_ADD_BOM, DEFAULT_CONFIG_CACHE_TTL, DEFAULT_CSV_DELIMITER, DEFAULT_ENCODING, DEFAULT_EXPORT_FORMAT, DEFAULT_EXPORT_TIMEOUT, DEFAULT_FORMATTERS, DEFAULT_MAX_CONCURRENT_EXPORTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_ROWS, DEFAULT_RESULT_CACHE_TTL, type DataTransformer, ERROR_CODES, EXPORT_FORMAT_EXTENSIONS, EXPORT_FORMAT_MIME_TYPES, type ExportConfig, ExportConfigError, ExportDataError, type ExportError, type ExportEvent, type ExportEventListener, type ExportEventType, type ExportField, ExportFileError, type ExportFilter, type ExportFormat, type ExportProgress, type ExportRequest, type ExportResult, ExportServiceError, type ExportSort, type ExportStatus, type FieldAlignment, type FieldMapper, type FieldType, type Formatter, type GroupValueProcessing, type GroupingConfig, type GroupingField, type GroupingMode, UNIVERSAL_EXPORT_NAME, UNIVERSAL_EXPORT_VERSION, UniversalExportClient, type UniversalExportClientConfig, type UniversalExportServiceConfig, type Validator, applyFormatter, createExportClient, createExportError, escapeCSVField, estimateEndTime, formatDuration, formatErrorMessage, formatFileSize, generateExportFileName, getNestedValue, parseCSVField, sanitizeFileName, setNestedValue, universalExportClient, validateExportConfig, validateExportRequest, validateFileName };