sa2kit 1.6.8 → 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 +10 -8
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/index.mjs +3 -1
- 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-VHU2YGRQ.mjs → chunk-4FOBBWXW.mjs} +25 -11
- package/dist/chunk-4FOBBWXW.mjs.map +1 -0
- package/dist/{chunk-ZDRBMSTS.js → chunk-G6WRJ2H2.js} +25 -11
- 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-AXP7KROR.js → chunk-WC5QFO3T.js} +2 -2
- package/dist/chunk-WC5QFO3T.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +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-VHU2YGRQ.mjs.map +0 -1
- package/dist/chunk-ZDRBMSTS.js.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 -693
- package/dist/index.d.ts +0 -693
- 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 -74
- package/dist/music/index.d.ts +0 -74
- 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,480 +0,0 @@
|
|
|
1
|
-
import { a as UploadFileInfo, c as UploadProgress, F as FileMetadata, d as FileQueryOptions, e as PaginatedResult, B as BatchOperationResult, b as ProcessingOptions } from '../types-CK4We_aI.mjs';
|
|
2
|
-
export { A as AccessPermission, l as AudioProcessingOptions, k as CDNProviderError, C as CDNType, o as FileEvent, f as FileEventListener, n as FileEventType, i as FileProcessingError, g as FileServiceError, h as FileUploadError, I as ImageProcessingOptions, P as ProcessorType, j as StorageProviderError, S as StorageType, m as UploadResult, U as UploadStatus, V as VideoProcessingOptions } from '../types-CK4We_aI.mjs';
|
|
3
|
-
import React__default from 'react';
|
|
4
|
-
import { U as UniversalFileService } from '../UniversalFileService-CGGzYeeF.mjs';
|
|
5
|
-
import 'events';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 通用文件服务客户端SDK
|
|
9
|
-
*
|
|
10
|
-
* 提供文件上传、下载、查询等功能的客户端接口
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
interface UniversalFileClientConfig {
|
|
14
|
-
/** API基础URL */
|
|
15
|
-
baseUrl?: string;
|
|
16
|
-
/** 请求超时时间(毫秒) */
|
|
17
|
-
timeout?: number;
|
|
18
|
-
/** 上传超时时间(毫秒) */
|
|
19
|
-
uploadTimeout?: number;
|
|
20
|
-
/** 自定义请求头 */
|
|
21
|
-
headers?: Record<string, string>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 通用文件服务客户端
|
|
25
|
-
*/
|
|
26
|
-
declare class UniversalFileClient {
|
|
27
|
-
private config;
|
|
28
|
-
constructor(config?: UniversalFileClientConfig);
|
|
29
|
-
/**
|
|
30
|
-
* 上传文件
|
|
31
|
-
*/
|
|
32
|
-
uploadFile(fileInfo: UploadFileInfo, onProgress?: (progress: UploadProgress) => void): Promise<FileMetadata>;
|
|
33
|
-
/**
|
|
34
|
-
* 获取文件访问URL
|
|
35
|
-
*/
|
|
36
|
-
getFileUrl(fileId: string, expiresIn?: number): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* 获取文件元数据
|
|
39
|
-
*/
|
|
40
|
-
getFileMetadata(fileId: string): Promise<FileMetadata>;
|
|
41
|
-
/**
|
|
42
|
-
* 查询文件列表
|
|
43
|
-
*/
|
|
44
|
-
queryFiles(options: FileQueryOptions): Promise<PaginatedResult<FileMetadata>>;
|
|
45
|
-
/**
|
|
46
|
-
* 删除文件
|
|
47
|
-
*/
|
|
48
|
-
deleteFile(fileId: string): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* 批量删除文件
|
|
51
|
-
*/
|
|
52
|
-
batchDeleteFiles(fileIds: string[]): Promise<BatchOperationResult>;
|
|
53
|
-
/**
|
|
54
|
-
* 获取上传进度
|
|
55
|
-
*/
|
|
56
|
-
getUploadProgress(fileId: string): Promise<UploadProgress>;
|
|
57
|
-
/**
|
|
58
|
-
* 获取请求头
|
|
59
|
-
*/
|
|
60
|
-
private getHeaders;
|
|
61
|
-
/**
|
|
62
|
-
* 带超时的fetch请求
|
|
63
|
-
*/
|
|
64
|
-
private fetchWithTimeout;
|
|
65
|
-
/**
|
|
66
|
-
* 转换API返回的文件元数据
|
|
67
|
-
*/
|
|
68
|
-
private transformFileMetadataFromAPI;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* 默认客户端实例
|
|
72
|
-
*/
|
|
73
|
-
declare const universalFileClient: UniversalFileClient;
|
|
74
|
-
/**
|
|
75
|
-
* 创建自定义客户端实例
|
|
76
|
-
*/
|
|
77
|
-
declare function createFileClient(config?: UniversalFileClientConfig): UniversalFileClient;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 通用文件服务常量定义
|
|
81
|
-
*/
|
|
82
|
-
/** 模块版本 */
|
|
83
|
-
declare const UNIVERSAL_FILE_VERSION = "1.0.0";
|
|
84
|
-
/** 模块名称 */
|
|
85
|
-
declare const UNIVERSAL_FILE_NAME = "@qhr123/sa2kit/universalFile";
|
|
86
|
-
/** 默认最大文件大小(字节) - 100MB */
|
|
87
|
-
declare const DEFAULT_MAX_FILE_SIZE: number;
|
|
88
|
-
/** 默认最大图片大小(字节) - 10MB */
|
|
89
|
-
declare const DEFAULT_MAX_IMAGE_SIZE: number;
|
|
90
|
-
/** 默认最大视频大小(字节) - 500MB */
|
|
91
|
-
declare const DEFAULT_MAX_VIDEO_SIZE: number;
|
|
92
|
-
/** 默认最大音频大小(字节) - 50MB */
|
|
93
|
-
declare const DEFAULT_MAX_AUDIO_SIZE: number;
|
|
94
|
-
/** 默认最大文档大小(字节) - 20MB */
|
|
95
|
-
declare const DEFAULT_MAX_DOCUMENT_SIZE: number;
|
|
96
|
-
/** 图片MIME类型 */
|
|
97
|
-
declare const IMAGE_MIME_TYPES: string[];
|
|
98
|
-
/** 视频MIME类型 */
|
|
99
|
-
declare const VIDEO_MIME_TYPES: string[];
|
|
100
|
-
/** 音频MIME类型 */
|
|
101
|
-
declare const AUDIO_MIME_TYPES: string[];
|
|
102
|
-
/** 文档MIME类型 */
|
|
103
|
-
declare const DOCUMENT_MIME_TYPES: string[];
|
|
104
|
-
/** 所有支持的MIME类型 */
|
|
105
|
-
declare const ALL_SUPPORTED_MIME_TYPES: string[];
|
|
106
|
-
/** 图片扩展名 */
|
|
107
|
-
declare const IMAGE_EXTENSIONS: string[];
|
|
108
|
-
/** 视频扩展名 */
|
|
109
|
-
declare const VIDEO_EXTENSIONS: string[];
|
|
110
|
-
/** 音频扩展名 */
|
|
111
|
-
declare const AUDIO_EXTENSIONS: string[];
|
|
112
|
-
/** 文档扩展名 */
|
|
113
|
-
declare const DOCUMENT_EXTENSIONS: string[];
|
|
114
|
-
/** API基础路径 */
|
|
115
|
-
declare const API_BASE_PATH = "/api/universal-file";
|
|
116
|
-
/** API端点 */
|
|
117
|
-
declare const API_ENDPOINTS: {
|
|
118
|
-
/** 上传文件 */
|
|
119
|
-
readonly UPLOAD: "/api/universal-file/upload";
|
|
120
|
-
/** 获取文件URL */
|
|
121
|
-
readonly GET_URL: (fileId: string) => string;
|
|
122
|
-
/** 获取文件元数据 */
|
|
123
|
-
readonly GET_METADATA: (fileId: string) => string;
|
|
124
|
-
/** 删除文件 */
|
|
125
|
-
readonly DELETE: (fileId: string) => string;
|
|
126
|
-
/** 查询文件列表 */
|
|
127
|
-
readonly QUERY: "/api/universal-file/files";
|
|
128
|
-
/** 批量删除 */
|
|
129
|
-
readonly BATCH_DELETE: "/api/universal-file/files/batch-delete";
|
|
130
|
-
/** 获取上传进度 */
|
|
131
|
-
readonly GET_PROGRESS: (fileId: string) => string;
|
|
132
|
-
};
|
|
133
|
-
/** 错误代码 */
|
|
134
|
-
declare const ERROR_CODES: {
|
|
135
|
-
/** 文件上传错误 */
|
|
136
|
-
readonly FILE_UPLOAD_ERROR: "FILE_UPLOAD_ERROR";
|
|
137
|
-
/** 文件大小超限 */
|
|
138
|
-
readonly FILE_SIZE_EXCEEDED: "FILE_SIZE_EXCEEDED";
|
|
139
|
-
/** 文件类型不支持 */
|
|
140
|
-
readonly FILE_TYPE_NOT_SUPPORTED: "FILE_TYPE_NOT_SUPPORTED";
|
|
141
|
-
/** 文件不存在 */
|
|
142
|
-
readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
|
|
143
|
-
/** 文件处理错误 */
|
|
144
|
-
readonly FILE_PROCESSING_ERROR: "FILE_PROCESSING_ERROR";
|
|
145
|
-
/** 存储提供者错误 */
|
|
146
|
-
readonly STORAGE_PROVIDER_ERROR: "STORAGE_PROVIDER_ERROR";
|
|
147
|
-
/** CDN提供者错误 */
|
|
148
|
-
readonly CDN_PROVIDER_ERROR: "CDN_PROVIDER_ERROR";
|
|
149
|
-
/** 网络错误 */
|
|
150
|
-
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
151
|
-
/** 超时错误 */
|
|
152
|
-
readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
|
|
153
|
-
/** 未授权 */
|
|
154
|
-
readonly UNAUTHORIZED: "UNAUTHORIZED";
|
|
155
|
-
/** 权限不足 */
|
|
156
|
-
readonly FORBIDDEN: "FORBIDDEN";
|
|
157
|
-
/** 服务器错误 */
|
|
158
|
-
readonly SERVER_ERROR: "SERVER_ERROR";
|
|
159
|
-
};
|
|
160
|
-
/** 默认分页大小 */
|
|
161
|
-
declare const DEFAULT_PAGE_SIZE = 20;
|
|
162
|
-
/** 默认请求超时时间(毫秒) - 30秒 */
|
|
163
|
-
declare const DEFAULT_REQUEST_TIMEOUT = 30000;
|
|
164
|
-
/** 默认上传超时时间(毫秒) - 5分钟 */
|
|
165
|
-
declare const DEFAULT_UPLOAD_TIMEOUT = 300000;
|
|
166
|
-
/** 默认分片上传大小(字节) - 5MB */
|
|
167
|
-
declare const DEFAULT_CHUNK_SIZE: number;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* 通用文件服务工具函数
|
|
171
|
-
*/
|
|
172
|
-
/**
|
|
173
|
-
* 格式化文件大小
|
|
174
|
-
*/
|
|
175
|
-
declare function formatFileSize(bytes: number): string;
|
|
176
|
-
/**
|
|
177
|
-
* 解析文件大小字符串
|
|
178
|
-
*/
|
|
179
|
-
declare function parseFileSize(sizeStr: string): number;
|
|
180
|
-
/**
|
|
181
|
-
* 获取文件扩展名
|
|
182
|
-
*/
|
|
183
|
-
declare function getFileExtension(fileName: string): string;
|
|
184
|
-
/**
|
|
185
|
-
* 根据文件名获取MIME类型
|
|
186
|
-
*/
|
|
187
|
-
declare function getMimeTypeFromFileName(fileName: string): string;
|
|
188
|
-
/**
|
|
189
|
-
* 检查MIME类型是否支持
|
|
190
|
-
*/
|
|
191
|
-
declare function isMimeTypeSupported(mimeType: string, allowedTypes?: string[]): boolean;
|
|
192
|
-
/**
|
|
193
|
-
* 判断是否为图片类型
|
|
194
|
-
*/
|
|
195
|
-
declare function isImageFile(mimeType: string): boolean;
|
|
196
|
-
/**
|
|
197
|
-
* 判断是否为视频类型
|
|
198
|
-
*/
|
|
199
|
-
declare function isVideoFile(mimeType: string): boolean;
|
|
200
|
-
/**
|
|
201
|
-
* 判断是否为音频类型
|
|
202
|
-
*/
|
|
203
|
-
declare function isAudioFile(mimeType: string): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* 判断是否为文档类型
|
|
206
|
-
*/
|
|
207
|
-
declare function isDocumentFile(mimeType: string): boolean;
|
|
208
|
-
/**
|
|
209
|
-
* 获取文件类型类别
|
|
210
|
-
*/
|
|
211
|
-
declare function getFileCategory(mimeType: string): 'image' | 'video' | 'audio' | 'document' | 'other';
|
|
212
|
-
/**
|
|
213
|
-
* 验证文件名是否合法
|
|
214
|
-
*/
|
|
215
|
-
declare function validateFileName(fileName: string): boolean;
|
|
216
|
-
/**
|
|
217
|
-
* 清理文件名,移除非法字符
|
|
218
|
-
*/
|
|
219
|
-
declare function sanitizeFileName(fileName: string): string;
|
|
220
|
-
/**
|
|
221
|
-
* 生成唯一文件名
|
|
222
|
-
*/
|
|
223
|
-
declare function generateUniqueFileName(originalName: string, fileId: string): string;
|
|
224
|
-
/**
|
|
225
|
-
* 生成存储路径
|
|
226
|
-
*/
|
|
227
|
-
declare function generateStoragePath(moduleId: string, fileName: string, options?: {
|
|
228
|
-
businessId?: string;
|
|
229
|
-
useDate?: boolean;
|
|
230
|
-
customPrefix?: string;
|
|
231
|
-
}): string;
|
|
232
|
-
/**
|
|
233
|
-
* 解析存储路径
|
|
234
|
-
*/
|
|
235
|
-
declare function parseStoragePath(path: string): {
|
|
236
|
-
moduleId?: string;
|
|
237
|
-
businessId?: string;
|
|
238
|
-
year?: string;
|
|
239
|
-
month?: string;
|
|
240
|
-
day?: string;
|
|
241
|
-
fileName: string;
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* 验证文件大小
|
|
245
|
-
*/
|
|
246
|
-
declare function validateFileSize(file: File, maxSize: number): {
|
|
247
|
-
valid: boolean;
|
|
248
|
-
error?: string;
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* 验证文件类型
|
|
252
|
-
*/
|
|
253
|
-
declare function validateFileType(file: File, allowedTypes?: string[]): {
|
|
254
|
-
valid: boolean;
|
|
255
|
-
error?: string;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* 验证文件
|
|
259
|
-
*/
|
|
260
|
-
declare function validateFile(file: File, options?: {
|
|
261
|
-
maxSize?: number;
|
|
262
|
-
allowedTypes?: string[];
|
|
263
|
-
}): {
|
|
264
|
-
valid: boolean;
|
|
265
|
-
errors: string[];
|
|
266
|
-
};
|
|
267
|
-
/**
|
|
268
|
-
* 构建查询字符串
|
|
269
|
-
*/
|
|
270
|
-
declare function buildQueryString(params: Record<string, any>): string;
|
|
271
|
-
/**
|
|
272
|
-
* 解析URL查询参数
|
|
273
|
-
*/
|
|
274
|
-
declare function parseQueryString(url: string): Record<string, string>;
|
|
275
|
-
/**
|
|
276
|
-
* 计算上传进度
|
|
277
|
-
*/
|
|
278
|
-
declare function calculateProgress(uploadedBytes: number, totalBytes: number): number;
|
|
279
|
-
/**
|
|
280
|
-
* 计算上传速度
|
|
281
|
-
*/
|
|
282
|
-
declare function calculateSpeed(uploadedBytes: number, elapsedTime: number): number;
|
|
283
|
-
/**
|
|
284
|
-
* 计算剩余时间
|
|
285
|
-
*/
|
|
286
|
-
declare function calculateRemainingTime(uploadedBytes: number, totalBytes: number, speed: number): number;
|
|
287
|
-
/**
|
|
288
|
-
* 创建文件错误对象
|
|
289
|
-
*/
|
|
290
|
-
declare function createFileError(code: string, message: string, details?: Record<string, any>): {
|
|
291
|
-
code: string;
|
|
292
|
-
message: string;
|
|
293
|
-
details?: Record<string, any>;
|
|
294
|
-
timestamp: Date;
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* 格式化错误消息
|
|
298
|
-
*/
|
|
299
|
-
declare function formatErrorMessage(error: unknown): string;
|
|
300
|
-
/**
|
|
301
|
-
* 读取文件为Base64
|
|
302
|
-
*/
|
|
303
|
-
declare function readFileAsBase64(file: File): Promise<string>;
|
|
304
|
-
/**
|
|
305
|
-
* 读取文件为ArrayBuffer
|
|
306
|
-
*/
|
|
307
|
-
declare function readFileAsArrayBuffer(file: File): Promise<ArrayBuffer>;
|
|
308
|
-
/**
|
|
309
|
-
* 读取文件为文本
|
|
310
|
-
*/
|
|
311
|
-
declare function readFileAsText(file: File, encoding?: string): Promise<string>;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* 通用文件上传组件
|
|
315
|
-
* Universal File Uploader Component
|
|
316
|
-
*
|
|
317
|
-
* 支持拖拽上传、进度显示、多文件上传等功能
|
|
318
|
-
* 使用 Tailwind CSS 样式,支持暗色模式
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
|
-
interface FileUploaderProps {
|
|
322
|
-
/** 文件服务实例 */
|
|
323
|
-
fileService: UniversalFileService;
|
|
324
|
-
/** 模块标识 */
|
|
325
|
-
moduleId: string;
|
|
326
|
-
/** 业务标识 */
|
|
327
|
-
businessId?: string;
|
|
328
|
-
/** 允许的文件类型 */
|
|
329
|
-
acceptedTypes?: string[];
|
|
330
|
-
/** 最大文件大小(MB) */
|
|
331
|
-
maxFileSize?: number;
|
|
332
|
-
/** 最大文件数量 */
|
|
333
|
-
maxFiles?: number;
|
|
334
|
-
/** 是否支持多文件上传 */
|
|
335
|
-
multiple?: boolean;
|
|
336
|
-
/** 是否启用文件处理 */
|
|
337
|
-
enableProcessing?: boolean;
|
|
338
|
-
/** 默认处理选项 */
|
|
339
|
-
defaultProcessingOptions?: ProcessingOptions;
|
|
340
|
-
/** 上传成功回调 */
|
|
341
|
-
onUploadSuccess?: (files: FileMetadata[]) => void;
|
|
342
|
-
/** 上传失败回调 */
|
|
343
|
-
onUploadError?: (error: string) => void;
|
|
344
|
-
/** 上传进度回调 */
|
|
345
|
-
onProgress?: (progress: UploadProgress[]) => void;
|
|
346
|
-
/** 自定义样式类名 */
|
|
347
|
-
className?: string;
|
|
348
|
-
/** 是否禁用 */
|
|
349
|
-
disabled?: boolean;
|
|
350
|
-
/** 显示模式 */
|
|
351
|
-
mode?: 'compact' | 'normal' | 'detailed';
|
|
352
|
-
}
|
|
353
|
-
declare const FileUploader: React__default.FC<FileUploaderProps>;
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* 通用文件管理组件
|
|
357
|
-
* 支持文件列表、预览、批量操作、搜索筛选等功能
|
|
358
|
-
*/
|
|
359
|
-
|
|
360
|
-
interface FileManagerProps {
|
|
361
|
-
/** 模块ID,限制显示特定模块的文件 */
|
|
362
|
-
moduleId?: string;
|
|
363
|
-
/** 业务ID,限制显示特定业务的文件 */
|
|
364
|
-
businessId?: string;
|
|
365
|
-
/** 显示模式 */
|
|
366
|
-
mode?: 'grid' | 'list' | 'table';
|
|
367
|
-
/** 是否允许上传 */
|
|
368
|
-
allowUpload?: boolean;
|
|
369
|
-
/** 是否允许下载 */
|
|
370
|
-
allowDownload?: boolean;
|
|
371
|
-
/** 是否允许删除 */
|
|
372
|
-
allowDelete?: boolean;
|
|
373
|
-
/** 是否允许批量操作 */
|
|
374
|
-
allowBatch?: boolean;
|
|
375
|
-
/** 是否显示预览 */
|
|
376
|
-
showPreview?: boolean;
|
|
377
|
-
/** 是否显示搜索 */
|
|
378
|
-
showSearch?: boolean;
|
|
379
|
-
/** 是否显示筛选器 */
|
|
380
|
-
showFilters?: boolean;
|
|
381
|
-
/** 每页显示数量 */
|
|
382
|
-
pageSize?: number;
|
|
383
|
-
/** 自定义操作按钮 */
|
|
384
|
-
customActions?: Array<{
|
|
385
|
-
key: string;
|
|
386
|
-
label: string;
|
|
387
|
-
icon?: string;
|
|
388
|
-
onClick: (files: FileMetadata[]) => void;
|
|
389
|
-
disabled?: (files: FileMetadata[]) => boolean;
|
|
390
|
-
}>;
|
|
391
|
-
/** 文件选择回调 */
|
|
392
|
-
onFileSelect?: (files: FileMetadata[]) => void;
|
|
393
|
-
/** 上传完成回调 */
|
|
394
|
-
onUploadComplete?: (files: FileMetadata[]) => void;
|
|
395
|
-
}
|
|
396
|
-
declare const UniversalFileManager: React__default.FC<FileManagerProps>;
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* 文件夹管理组件
|
|
400
|
-
* 支持创建、重命名、删除文件夹,以及文件夹树形结构显示
|
|
401
|
-
*/
|
|
402
|
-
|
|
403
|
-
interface FolderNode {
|
|
404
|
-
/** 文件夹ID */
|
|
405
|
-
id: string;
|
|
406
|
-
/** 文件夹名称 */
|
|
407
|
-
name: string;
|
|
408
|
-
/** 父文件夹ID */
|
|
409
|
-
parentId?: string;
|
|
410
|
-
/** 子文件夹 */
|
|
411
|
-
children: FolderNode[];
|
|
412
|
-
/** 文件数量 */
|
|
413
|
-
fileCount: number;
|
|
414
|
-
/** 总大小 */
|
|
415
|
-
totalSize: number;
|
|
416
|
-
/** 创建时间 */
|
|
417
|
-
createdAt: Date;
|
|
418
|
-
/** 更新时间 */
|
|
419
|
-
updatedAt: Date;
|
|
420
|
-
/** 是否展开 */
|
|
421
|
-
expanded?: boolean;
|
|
422
|
-
}
|
|
423
|
-
interface FolderManagerProps {
|
|
424
|
-
/** 当前文件夹ID */
|
|
425
|
-
currentFolderId?: string;
|
|
426
|
-
/** 文件夹树数据 */
|
|
427
|
-
folderTree: FolderNode[];
|
|
428
|
-
/** 是否显示文件数量 */
|
|
429
|
-
showFileCount?: boolean;
|
|
430
|
-
/** 是否显示文件大小 */
|
|
431
|
-
showSize?: boolean;
|
|
432
|
-
/** 是否允许创建文件夹 */
|
|
433
|
-
allowCreate?: boolean;
|
|
434
|
-
/** 是否允许重命名 */
|
|
435
|
-
allowRename?: boolean;
|
|
436
|
-
/** 是否允许删除 */
|
|
437
|
-
allowDelete?: boolean;
|
|
438
|
-
/** 是否允许拖拽 */
|
|
439
|
-
allowDrag?: boolean;
|
|
440
|
-
/** 文件夹选择回调 */
|
|
441
|
-
onFolderSelect?: (folderId: string) => void;
|
|
442
|
-
/** 文件夹创建回调 */
|
|
443
|
-
onFolderCreate?: (parentId: string | undefined, name: string) => Promise<FolderNode>;
|
|
444
|
-
/** 文件夹重命名回调 */
|
|
445
|
-
onFolderRename?: (folderId: string, newName: string) => Promise<void>;
|
|
446
|
-
/** 文件夹删除回调 */
|
|
447
|
-
onFolderDelete?: (folderId: string) => Promise<void>;
|
|
448
|
-
/** 文件移动回调 */
|
|
449
|
-
onFileMove?: (fileIds: string[], targetFolderId: string) => Promise<void>;
|
|
450
|
-
}
|
|
451
|
-
declare const FolderManager: React__default.FC<FolderManagerProps>;
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* 文件分享模态框组件
|
|
455
|
-
* 支持生成分享链接、设置访问权限、过期时间等
|
|
456
|
-
*/
|
|
457
|
-
|
|
458
|
-
interface FileShareModalProps {
|
|
459
|
-
/** 要分享的文件 */
|
|
460
|
-
files: FileMetadata[];
|
|
461
|
-
/** 关闭回调 */
|
|
462
|
-
onClose: () => void;
|
|
463
|
-
/** 分享成功回调 */
|
|
464
|
-
onShareSuccess?: (shareInfo: ShareInfo) => void;
|
|
465
|
-
}
|
|
466
|
-
interface ShareInfo {
|
|
467
|
-
/** 分享链接 */
|
|
468
|
-
shareUrl: string;
|
|
469
|
-
/** 访问密码 */
|
|
470
|
-
password?: string;
|
|
471
|
-
/** 过期时间 */
|
|
472
|
-
expiresAt?: Date;
|
|
473
|
-
/** 访问权限 */
|
|
474
|
-
permission: 'view' | 'download';
|
|
475
|
-
/** 分享代码 */
|
|
476
|
-
shareCode: string;
|
|
477
|
-
}
|
|
478
|
-
declare const FileShareModal: React__default.FC<FileShareModalProps>;
|
|
479
|
-
|
|
480
|
-
export { ALL_SUPPORTED_MIME_TYPES, API_BASE_PATH, API_ENDPOINTS, AUDIO_EXTENSIONS, AUDIO_MIME_TYPES, BatchOperationResult, DEFAULT_CHUNK_SIZE, DEFAULT_MAX_AUDIO_SIZE, DEFAULT_MAX_DOCUMENT_SIZE, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_IMAGE_SIZE, DEFAULT_MAX_VIDEO_SIZE, DEFAULT_PAGE_SIZE, DEFAULT_REQUEST_TIMEOUT, DEFAULT_UPLOAD_TIMEOUT, DOCUMENT_EXTENSIONS, DOCUMENT_MIME_TYPES, ERROR_CODES, type FileManagerProps, FileMetadata, FileQueryOptions, FileShareModal, type FileShareModalProps, FileUploader, type FileUploaderProps, FolderManager, type FolderManagerProps, type FolderNode, IMAGE_EXTENSIONS, IMAGE_MIME_TYPES, PaginatedResult, ProcessingOptions, type ShareInfo, UNIVERSAL_FILE_NAME, UNIVERSAL_FILE_VERSION, UniversalFileClient, type UniversalFileClientConfig, UniversalFileManager, UploadFileInfo, UploadProgress, VIDEO_EXTENSIONS, VIDEO_MIME_TYPES, buildQueryString, calculateProgress, calculateRemainingTime, calculateSpeed, createFileClient, createFileError, formatErrorMessage, formatFileSize, generateStoragePath, generateUniqueFileName, getFileCategory, getFileExtension, getMimeTypeFromFileName, isAudioFile, isDocumentFile, isImageFile, isMimeTypeSupported, isVideoFile, parseFileSize, parseQueryString, parseStoragePath, readFileAsArrayBuffer, readFileAsBase64, readFileAsText, sanitizeFileName, universalFileClient, validateFile, validateFileName, validateFileSize, validateFileType };
|