module-develop-kit 1.2.0 → 1.2.1
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/main.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare const CallLogger: {
|
|
|
47
47
|
* @param options 检测选项
|
|
48
48
|
* @returns 检测结果
|
|
49
49
|
*/
|
|
50
|
-
export declare function detectFileByExtension(file: File, _allowedExtensions: TMaybeArray<string>, options?:
|
|
50
|
+
export declare function detectFileByExtension(file: File, _allowedExtensions: TMaybeArray<string>, options?: IFileDetectionOptions): Promise<IFileDetectionResult>;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* 检测文件真实类型并验证 MIME 类型
|
|
@@ -57,7 +57,7 @@ export declare function detectFileByExtension(file: File, _allowedExtensions: TM
|
|
|
57
57
|
* @param options 检测选项
|
|
58
58
|
* @returns 检测结果
|
|
59
59
|
*/
|
|
60
|
-
export declare function detectFileByMime(file: File, _allowedMimes: TMaybeArray<string>, options?:
|
|
60
|
+
export declare function detectFileByMime(file: File, _allowedMimes: TMaybeArray<string>, options?: IFileDetectionOptions): Promise<IFileDetectionResult>;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* 批量检测文件扩展名
|
|
@@ -67,7 +67,7 @@ export declare function detectFileByMime(file: File, _allowedMimes: TMaybeArray<
|
|
|
67
67
|
* @param options 检测选项
|
|
68
68
|
* @returns 检测结果列表
|
|
69
69
|
*/
|
|
70
|
-
export declare function detectionFilesByExtension(files: File[], allowedExtensions: TMaybeArray<string>, options?:
|
|
70
|
+
export declare function detectionFilesByExtension(files: File[], allowedExtensions: TMaybeArray<string>, options?: IFileDetectionOptions): Promise<IFileDetectionResult[]>;
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* 批量检测文件 MIME 类型
|
|
@@ -77,7 +77,7 @@ export declare function detectionFilesByExtension(files: File[], allowedExtensio
|
|
|
77
77
|
* @param options 检测选项
|
|
78
78
|
* @returns 检测结果列表
|
|
79
79
|
*/
|
|
80
|
-
export declare function detectionFilesByMime(files: File[], allowedMimes: TMaybeArray<string>, options?:
|
|
80
|
+
export declare function detectionFilesByMime(files: File[], allowedMimes: TMaybeArray<string>, options?: IFileDetectionOptions): Promise<IFileDetectionResult[]>;
|
|
81
81
|
|
|
82
82
|
export declare enum ECallStatus {
|
|
83
83
|
/**
|
|
@@ -162,40 +162,6 @@ export declare interface EventBusProps {
|
|
|
162
162
|
|
|
163
163
|
declare type EventFnc = (...args: any) => void;
|
|
164
164
|
|
|
165
|
-
export declare interface FileDetectionOptions {
|
|
166
|
-
/**
|
|
167
|
-
* 最大文件大小(字节)
|
|
168
|
-
*/
|
|
169
|
-
maxSize?: number;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export declare interface FileDetectionResult {
|
|
173
|
-
/**
|
|
174
|
-
* 是否通过检测
|
|
175
|
-
*/
|
|
176
|
-
valid: boolean;
|
|
177
|
-
/**
|
|
178
|
-
* 检测到的真实MIME类型
|
|
179
|
-
*/
|
|
180
|
-
detectedMime?: string;
|
|
181
|
-
/**
|
|
182
|
-
* 检测到的文件扩展名
|
|
183
|
-
*/
|
|
184
|
-
detectedExt?: string;
|
|
185
|
-
/**
|
|
186
|
-
* 错误信息
|
|
187
|
-
*/
|
|
188
|
-
error?: string;
|
|
189
|
-
/**
|
|
190
|
-
* 文件声称的MIME类型(来自File对象)
|
|
191
|
-
*/
|
|
192
|
-
claimedMime?: string;
|
|
193
|
-
/**
|
|
194
|
-
* MIME类型是否匹配(真实vs声称)
|
|
195
|
-
*/
|
|
196
|
-
mimeMatches?: boolean;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
165
|
/**
|
|
200
166
|
* 安全的解析html内容 防止xss攻击
|
|
201
167
|
* @param input 输入的html内容
|
|
@@ -305,6 +271,40 @@ export declare interface ICallOptions {
|
|
|
305
271
|
call: string;
|
|
306
272
|
}
|
|
307
273
|
|
|
274
|
+
export declare interface IFileDetectionOptions {
|
|
275
|
+
/**
|
|
276
|
+
* 最大文件大小(字节)
|
|
277
|
+
*/
|
|
278
|
+
maxSize?: number;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export declare interface IFileDetectionResult {
|
|
282
|
+
/**
|
|
283
|
+
* 是否通过检测
|
|
284
|
+
*/
|
|
285
|
+
valid: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* 检测到的真实MIME类型
|
|
288
|
+
*/
|
|
289
|
+
detectedMime?: string;
|
|
290
|
+
/**
|
|
291
|
+
* 检测到的文件扩展名
|
|
292
|
+
*/
|
|
293
|
+
detectedExt?: string;
|
|
294
|
+
/**
|
|
295
|
+
* 错误信息
|
|
296
|
+
*/
|
|
297
|
+
error?: string;
|
|
298
|
+
/**
|
|
299
|
+
* 文件声称的MIME类型(来自File对象)
|
|
300
|
+
*/
|
|
301
|
+
claimedMime?: string;
|
|
302
|
+
/**
|
|
303
|
+
* MIME类型是否匹配(真实vs声称)
|
|
304
|
+
*/
|
|
305
|
+
mimeMatches?: boolean;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
308
|
export declare interface IResponseDataEncryptionStep {
|
|
309
309
|
data: string;
|
|
310
310
|
headers: Record<EHeaderKey, string>;
|
|
@@ -327,22 +327,48 @@ export declare interface ISm4Params {
|
|
|
327
327
|
* @param options - 配置选项
|
|
328
328
|
* @returns 是否安全
|
|
329
329
|
*/
|
|
330
|
-
export declare function isUrlSafe(url: unknown, options?:
|
|
330
|
+
export declare function isUrlSafe(url: unknown, options?: IUrlSanitizeOptions): boolean;
|
|
331
331
|
|
|
332
332
|
/**
|
|
333
333
|
* 便捷方法: 检测是否为文档文件(基于 MIME 类型)
|
|
334
334
|
*/
|
|
335
|
-
export declare function isValidDocument(file: File, maxSize?: number): Promise<
|
|
335
|
+
export declare function isValidDocument(file: File, maxSize?: number): Promise<IFileDetectionResult>;
|
|
336
336
|
|
|
337
337
|
/**
|
|
338
338
|
* 便捷方法: 检测是否为图片文件(基于 MIME 类型)
|
|
339
339
|
*/
|
|
340
|
-
export declare function isValidImage(file: File, maxSize?: number): Promise<
|
|
340
|
+
export declare function isValidImage(file: File, maxSize?: number): Promise<IFileDetectionResult>;
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
343
|
* 便捷方法: 检测是否为视频文件(基于 MIME 类型)
|
|
344
344
|
*/
|
|
345
|
-
export declare function isValidVideo(file: File, maxSize?: number): Promise<
|
|
345
|
+
export declare function isValidVideo(file: File, maxSize?: number): Promise<IFileDetectionResult>;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* URL XSS 防护工具
|
|
349
|
+
* 用于检测和拦截包含 XSS 攻击的 URL
|
|
350
|
+
*/
|
|
351
|
+
/**
|
|
352
|
+
* URL 消毒选项
|
|
353
|
+
*/
|
|
354
|
+
export declare interface IUrlSanitizeOptions {
|
|
355
|
+
/**
|
|
356
|
+
* 是否允许相对路径 URL,默认 true
|
|
357
|
+
*/
|
|
358
|
+
allowRelative?: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* 额外的安全协议
|
|
361
|
+
*/
|
|
362
|
+
extraSafeProtocols?: string[];
|
|
363
|
+
/**
|
|
364
|
+
* 当检测到 XSS 时的替代 URL,默认 '#'
|
|
365
|
+
*/
|
|
366
|
+
fallbackUrl?: string;
|
|
367
|
+
/**
|
|
368
|
+
* 是否严格模式,严格模式下只允许 http/https,默认 false
|
|
369
|
+
*/
|
|
370
|
+
strictMode?: boolean;
|
|
371
|
+
}
|
|
346
372
|
|
|
347
373
|
/**
|
|
348
374
|
* 请求数据加密
|
|
@@ -373,7 +399,7 @@ export declare function responseDataEncryption<T>(stepCb: (_headers: {
|
|
|
373
399
|
* @param options - 配置选项
|
|
374
400
|
* @returns 安全的 URL
|
|
375
401
|
*/
|
|
376
|
-
export declare function sanitizeUrl(url: unknown, options?:
|
|
402
|
+
export declare function sanitizeUrl(url: unknown, options?: IUrlSanitizeOptions): string;
|
|
377
403
|
|
|
378
404
|
/**
|
|
379
405
|
* 批量消毒 URL 列表
|
|
@@ -381,7 +407,7 @@ export declare function sanitizeUrl(url: unknown, options?: UrlSanitizeOptions):
|
|
|
381
407
|
* @param options - 配置选项
|
|
382
408
|
* @returns 消毒后的 URL 列表
|
|
383
409
|
*/
|
|
384
|
-
export declare function sanitizeUrls(urls: string[], options?:
|
|
410
|
+
export declare function sanitizeUrls(urls: string[], options?: IUrlSanitizeOptions): string[];
|
|
385
411
|
|
|
386
412
|
/**
|
|
387
413
|
* sip code对应的的状态,优先处理 code 对应的提示文案,如果不存在则按照 causes 状态去处理
|
|
@@ -459,32 +485,6 @@ export declare type TObj<K extends keyof any = string, T = any> = Record<K, T>;
|
|
|
459
485
|
|
|
460
486
|
export declare type TUndefinable<T> = T | undefined;
|
|
461
487
|
|
|
462
|
-
/**
|
|
463
|
-
* URL XSS 防护工具
|
|
464
|
-
* 用于检测和拦截包含 XSS 攻击的 URL
|
|
465
|
-
*/
|
|
466
|
-
/**
|
|
467
|
-
* URL 消毒选项
|
|
468
|
-
*/
|
|
469
|
-
export declare interface UrlSanitizeOptions {
|
|
470
|
-
/**
|
|
471
|
-
* 是否允许相对路径 URL,默认 true
|
|
472
|
-
*/
|
|
473
|
-
allowRelative?: boolean;
|
|
474
|
-
/**
|
|
475
|
-
* 额外的安全协议
|
|
476
|
-
*/
|
|
477
|
-
extraSafeProtocols?: string[];
|
|
478
|
-
/**
|
|
479
|
-
* 当检测到 XSS 时的替代 URL,默认 '#'
|
|
480
|
-
*/
|
|
481
|
-
fallbackUrl?: string;
|
|
482
|
-
/**
|
|
483
|
-
* 是否严格模式,严格模式下只允许 http/https,默认 false
|
|
484
|
-
*/
|
|
485
|
-
strictMode?: boolean;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
488
|
/**
|
|
489
489
|
* 打电话
|
|
490
490
|
* FIXME: callBack 为什么存在?zyy 中通过 useCall 拿到的变量无法实现响应式,所以通过 callback 的方式更新外部依赖。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UINT32_LE as h, StringType as k } from "../../../token-types/lib/index.js";
|
|
2
|
-
import D from "../../../../commonjs-virtual-dir/
|
|
2
|
+
import D from "../../../../commonjs-virtual-dir/browser.js";
|
|
3
3
|
import { Signature as c, EndOfCentralDirectoryRecordToken as L, FileHeader as E, DataDescriptor as y, LocalFileHeaderToken as S } from "./ZipToken.js";
|
|
4
4
|
function m(s) {
|
|
5
5
|
const t = new Uint8Array(h.len);
|