@e-mc/types 0.10.1 → 0.10.3
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/LICENSE +10 -10
- package/README.md +208 -208
- package/constant.d.ts +338 -338
- package/index.d.ts +336 -336
- package/index.js +4 -4
- package/lib/asset.d.ts +76 -76
- package/lib/cloud.d.ts +106 -106
- package/lib/compat-v4.d.ts +120 -120
- package/lib/compress.d.ts +25 -25
- package/lib/core.d.ts +195 -195
- package/lib/db.d.ts +107 -109
- package/lib/document.d.ts +199 -199
- package/lib/filemanager.d.ts +122 -122
- package/lib/http.d.ts +115 -115
- package/lib/index.d.ts +796 -790
- package/lib/logger.d.ts +113 -113
- package/lib/module.d.ts +137 -127
- package/lib/node.d.ts +21 -21
- package/lib/object.d.ts +29 -29
- package/lib/request.d.ts +146 -138
- package/lib/settings.d.ts +490 -490
- package/lib/squared.d.ts +339 -339
- package/lib/type.d.ts +34 -33
- package/lib/watch.d.ts +77 -77
- package/package.json +28 -28
- package/lib/dom.d.ts +0 -9
package/index.js
CHANGED
|
@@ -884,7 +884,7 @@ function cloneObject(data, options) {
|
|
|
884
884
|
}
|
|
885
885
|
let nested;
|
|
886
886
|
if (deep) {
|
|
887
|
-
deepIgnore
|
|
887
|
+
deepIgnore ||= new WeakSet();
|
|
888
888
|
nested = { deep, deepIgnore, mergeArray, mergeDepth, typedArray, preserve };
|
|
889
889
|
}
|
|
890
890
|
if (Array.isArray(data)) {
|
|
@@ -961,7 +961,7 @@ function coerceObject(data, parseString, cache) {
|
|
|
961
961
|
else if (parseString && typeof parseString !== 'function') {
|
|
962
962
|
return data;
|
|
963
963
|
}
|
|
964
|
-
parseString
|
|
964
|
+
parseString ||= parseStringDefault;
|
|
965
965
|
if (Array.isArray(data)) {
|
|
966
966
|
for (let i = 0, length = data.length; i < length; ++i) {
|
|
967
967
|
data[i] = recurseObject(data[i], parseString, new WeakSet(), cache);
|
|
@@ -978,7 +978,7 @@ function asFunction(value, sync = true) {
|
|
|
978
978
|
if (isString(value) && (match = REGEXP_FUNCTION.exec(value = value.trim()) || REGEXP_FUNCTION_ARROW.exec(value))) {
|
|
979
979
|
if (!sync || match[1]) {
|
|
980
980
|
const args = match[3].trim().split(/\s*,\s*/);
|
|
981
|
-
args.push(match[4] || (match[5]
|
|
981
|
+
args.push(match[4] || (match[5] &&= 'return ' + match[5]));
|
|
982
982
|
return new ASYNC_FUNCTION(...args);
|
|
983
983
|
}
|
|
984
984
|
try {
|
|
@@ -1035,7 +1035,7 @@ function randomString(format, dictionary) {
|
|
|
1035
1035
|
if (format !== '8-4-4-4-12' || dictionary) {
|
|
1036
1036
|
const match = format.match(/(\d+|[^\d]+)/g);
|
|
1037
1037
|
if (match) {
|
|
1038
|
-
dictionary
|
|
1038
|
+
dictionary ||= '0123456789abcdef';
|
|
1039
1039
|
const result = format.match(/(\d+|[^\d[]+|\[[^\]]+\]|\[)/g)?.reduce((a, b) => {
|
|
1040
1040
|
let length, available;
|
|
1041
1041
|
if (b.startsWith('[') && b.endsWith(']')) {
|
package/lib/asset.d.ts
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import type { BundleAction, FileAsset, LocationUri, MimeTypeAction } from './squared';
|
|
2
|
-
|
|
3
|
-
import type { IFileManager, IModule } from './index';
|
|
4
|
-
import type { IAbortComponent } from './core';
|
|
5
|
-
import type { FetchType } from './filemanager';
|
|
6
|
-
|
|
7
|
-
interface ProcessInit {
|
|
8
|
-
threadCount: number;
|
|
9
|
-
startTime: number;
|
|
10
|
-
timeout: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface BinaryAction {
|
|
14
|
-
binOpts?: string[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface StreamAction {
|
|
18
|
-
minStreamSize?: number | string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface FileData<T extends ExternalAsset> extends MimeTypeAction {
|
|
22
|
-
file: T;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface FileCommand<T extends ExternalAsset> extends FileData<T> {
|
|
26
|
-
command?: string;
|
|
27
|
-
outputType?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface IFileThread<T extends ExternalAsset = ExternalAsset> extends IAbortComponent, Required<FileData<T>> {
|
|
31
|
-
threadCount: number;
|
|
32
|
-
readonly startTime: number;
|
|
33
|
-
openThread(instance: IModule, timeout?: number): boolean;
|
|
34
|
-
closeThread(instance: IModule, callback?: FunctionType<void>): boolean;
|
|
35
|
-
getObject<U extends FileCommand<T>>(data?: PlainObject): U;
|
|
36
|
-
get host(): IFileManager<T>;
|
|
37
|
-
get queuedTasks(): FunctionType<void>[];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface FileThreadConstructor<T extends ExternalAsset = ExternalAsset> {
|
|
41
|
-
readonly prototype: IFileThread<T>;
|
|
42
|
-
new(host: IFileManager<T>, file: ExternalAsset, threadCount: number): IFileThread<T>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface OutputFinalize<T extends ExternalAsset> extends FileCommand<T> {
|
|
46
|
-
output: string;
|
|
47
|
-
baseDirectory?: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface InitialValue extends Partial<LocationUri>, MimeTypeAction {
|
|
51
|
-
localUri?: string;
|
|
52
|
-
buffer?: Buffer;
|
|
53
|
-
etag?: string;
|
|
54
|
-
cacheable?: boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, StreamAction {
|
|
58
|
-
id?: number;
|
|
59
|
-
url?: URL;
|
|
60
|
-
socketPath?: string;
|
|
61
|
-
buffer?: Null<Buffer>;
|
|
62
|
-
localUri?: string;
|
|
63
|
-
fetchType?: FetchType;
|
|
64
|
-
sourceUTF8?: string;
|
|
65
|
-
transforms?: string[];
|
|
66
|
-
descendants?: string[];
|
|
67
|
-
torrentFiles?: string[];
|
|
68
|
-
sourceFiles?: string[];
|
|
69
|
-
initialValue?: InitialValue;
|
|
70
|
-
processModule?: ObjectMap<ProcessInit>;
|
|
71
|
-
etag?: string;
|
|
72
|
-
lastModified?: string;
|
|
73
|
-
contentLength?: number;
|
|
74
|
-
invalid?: boolean;
|
|
75
|
-
}
|
|
76
|
-
|
|
1
|
+
import type { BundleAction, FileAsset, LocationUri, MimeTypeAction } from './squared';
|
|
2
|
+
|
|
3
|
+
import type { IFileManager, IModule } from './index';
|
|
4
|
+
import type { IAbortComponent } from './core';
|
|
5
|
+
import type { FetchType } from './filemanager';
|
|
6
|
+
|
|
7
|
+
interface ProcessInit {
|
|
8
|
+
threadCount: number;
|
|
9
|
+
startTime: number;
|
|
10
|
+
timeout: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface BinaryAction {
|
|
14
|
+
binOpts?: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface StreamAction {
|
|
18
|
+
minStreamSize?: number | string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FileData<T extends ExternalAsset> extends MimeTypeAction {
|
|
22
|
+
file: T;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface FileCommand<T extends ExternalAsset> extends FileData<T> {
|
|
26
|
+
command?: string;
|
|
27
|
+
outputType?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IFileThread<T extends ExternalAsset = ExternalAsset> extends IAbortComponent, Required<FileData<T>> {
|
|
31
|
+
threadCount: number;
|
|
32
|
+
readonly startTime: number;
|
|
33
|
+
openThread(instance: IModule, timeout?: number): boolean;
|
|
34
|
+
closeThread(instance: IModule, callback?: FunctionType<void>): boolean;
|
|
35
|
+
getObject<U extends FileCommand<T>>(data?: PlainObject): U;
|
|
36
|
+
get host(): IFileManager<T>;
|
|
37
|
+
get queuedTasks(): FunctionType<void>[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface FileThreadConstructor<T extends ExternalAsset = ExternalAsset> {
|
|
41
|
+
readonly prototype: IFileThread<T>;
|
|
42
|
+
new(host: IFileManager<T>, file: ExternalAsset, threadCount: number): IFileThread<T>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface OutputFinalize<T extends ExternalAsset> extends FileCommand<T> {
|
|
46
|
+
output: string;
|
|
47
|
+
baseDirectory?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface InitialValue extends Partial<LocationUri>, MimeTypeAction {
|
|
51
|
+
localUri?: string;
|
|
52
|
+
buffer?: Buffer;
|
|
53
|
+
etag?: string;
|
|
54
|
+
cacheable?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, StreamAction {
|
|
58
|
+
id?: number;
|
|
59
|
+
url?: URL;
|
|
60
|
+
socketPath?: string;
|
|
61
|
+
buffer?: Null<Buffer>;
|
|
62
|
+
localUri?: string;
|
|
63
|
+
fetchType?: FetchType;
|
|
64
|
+
sourceUTF8?: string;
|
|
65
|
+
transforms?: string[];
|
|
66
|
+
descendants?: string[];
|
|
67
|
+
torrentFiles?: string[];
|
|
68
|
+
sourceFiles?: string[];
|
|
69
|
+
initialValue?: InitialValue;
|
|
70
|
+
processModule?: ObjectMap<ProcessInit>;
|
|
71
|
+
etag?: string;
|
|
72
|
+
lastModified?: string;
|
|
73
|
+
contentLength?: number;
|
|
74
|
+
invalid?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
77
|
export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512" | "ripemd" | "ripemd-160";
|
package/lib/cloud.d.ts
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import type { DbDataSource, LocationUri, StorageAction } from './squared';
|
|
2
|
-
|
|
3
|
-
import type { ExternalAsset, StreamAction } from './asset';
|
|
4
|
-
import type { ExecuteAction } from './db';
|
|
5
|
-
|
|
6
|
-
export interface UploadAction {
|
|
7
|
-
cloudUrl?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface CloudAsset<T = CloudStorage> extends ExternalAsset, UploadAction, StorageAction<T> {}
|
|
11
|
-
|
|
12
|
-
export interface CloudService<T = unknown, U = string> {
|
|
13
|
-
service: U;
|
|
14
|
-
credential?: T;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface CloudDatabase<T = unknown, U = PlainObject, V = unknown, W = unknown, X = unknown> extends CloudService<X>, Omit<DbDataSource<T, U, V>, "credential" | "parallel" | "withCommand" | "usePool">, ExecuteAction<W> {
|
|
18
|
-
id?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface CloudStorage<T = unknown, U = string> extends CloudService<T, U> {
|
|
22
|
-
bucket?: string;
|
|
23
|
-
admin?: CloudStorageAdmin;
|
|
24
|
-
upload?: CloudStorageUpload;
|
|
25
|
-
download?: CloudStorageDownload;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends CloudStorageACL<U> {
|
|
29
|
-
emptyBucket?: boolean;
|
|
30
|
-
configBucket?: {
|
|
31
|
-
create?: T;
|
|
32
|
-
policy?: V;
|
|
33
|
-
tags?: unknown;
|
|
34
|
-
website?: BucketWebsiteOptions;
|
|
35
|
-
retentionPolicy?: W;
|
|
36
|
-
cors?: X;
|
|
37
|
-
lifecycle?: Y;
|
|
38
|
-
};
|
|
39
|
-
recursive?: boolean;
|
|
40
|
-
preservePath?: boolean;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends Partial<LocationUri>, StreamAction {
|
|
44
|
-
active?: boolean;
|
|
45
|
-
overwrite?: boolean;
|
|
46
|
-
chunkSize?: number | string;
|
|
47
|
-
chunkLimit?: number;
|
|
48
|
-
flags?: number;
|
|
49
|
-
admin?: CloudStorageAdmin<T, U, V, W, X, Y>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string, X = unknown, Y = unknown, Z = unknown> extends CloudStorageACL<U>, CloudStorageAction<V, W, unknown, X, Y, Z> {
|
|
53
|
-
buffer?: Null<Buffer>;
|
|
54
|
-
contentType?: string;
|
|
55
|
-
metadata?: Record<string, string>;
|
|
56
|
-
tags?: Record<string, string> | false;
|
|
57
|
-
options?: T;
|
|
58
|
-
fileGroup?: UploadContent[];
|
|
59
|
-
localStorage?: boolean;
|
|
60
|
-
endpoint?: string;
|
|
61
|
-
all?: boolean;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface CloudStorageACL<T = string> {
|
|
65
|
-
publicRead?: boolean | 0;
|
|
66
|
-
acl?: T;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface CloudStorageDownload<T = unknown, U = unknown> extends CloudStorageAction {
|
|
70
|
-
keyname?: string;
|
|
71
|
-
versionId?: string;
|
|
72
|
-
options?: U;
|
|
73
|
-
deleteObject?: T;
|
|
74
|
-
waitStatus?: boolean;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface BucketWebsiteOptions {
|
|
78
|
-
indexPage?: string;
|
|
79
|
-
errorPage?: string;
|
|
80
|
-
indexPath?: string;
|
|
81
|
-
errorPath?: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface UploadData<T = unknown, U = string, V = unknown, W = string, X = unknown, Y = unknown, Z = unknown> extends BucketAction {
|
|
85
|
-
upload: CloudStorageUpload<T, U, V, W, X, Y, Z>;
|
|
86
|
-
localUri: string;
|
|
87
|
-
buffer: Buffer;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface DownloadData<T = unknown, U = unknown> extends BucketAction {
|
|
91
|
-
download: CloudStorageDownload<T, U>;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface BucketAction {
|
|
95
|
-
bucket: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface UploadAssetOptions {
|
|
99
|
-
contentType?: string;
|
|
100
|
-
ignoreProcess?: boolean;
|
|
101
|
-
preferBuffer?: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export type UploadContent = [Bufferable, string, string?];
|
|
105
|
-
export type CloudSource = "atlas" | "aws" | "aws-v3" | "az" | "azure" | "gcp" | "gcloud" | "ibm" | "oci" | "minio";
|
|
106
|
-
export type CloudFeatures = "storage" | "database";
|
|
1
|
+
import type { DbDataSource, LocationUri, StorageAction } from './squared';
|
|
2
|
+
|
|
3
|
+
import type { ExternalAsset, StreamAction } from './asset';
|
|
4
|
+
import type { ExecuteAction } from './db';
|
|
5
|
+
|
|
6
|
+
export interface UploadAction {
|
|
7
|
+
cloudUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CloudAsset<T = CloudStorage> extends ExternalAsset, UploadAction, StorageAction<T> {}
|
|
11
|
+
|
|
12
|
+
export interface CloudService<T = unknown, U = string> {
|
|
13
|
+
service: U;
|
|
14
|
+
credential?: T;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CloudDatabase<T = unknown, U = PlainObject, V = unknown, W = unknown, X = unknown> extends CloudService<X>, Omit<DbDataSource<T, U, V>, "credential" | "parallel" | "withCommand" | "usePool">, ExecuteAction<W> {
|
|
18
|
+
id?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CloudStorage<T = unknown, U = string> extends CloudService<T, U> {
|
|
22
|
+
bucket?: string;
|
|
23
|
+
admin?: CloudStorageAdmin;
|
|
24
|
+
upload?: CloudStorageUpload;
|
|
25
|
+
download?: CloudStorageDownload;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends CloudStorageACL<U> {
|
|
29
|
+
emptyBucket?: boolean;
|
|
30
|
+
configBucket?: {
|
|
31
|
+
create?: T;
|
|
32
|
+
policy?: V;
|
|
33
|
+
tags?: unknown;
|
|
34
|
+
website?: BucketWebsiteOptions;
|
|
35
|
+
retentionPolicy?: W;
|
|
36
|
+
cors?: X;
|
|
37
|
+
lifecycle?: Y;
|
|
38
|
+
};
|
|
39
|
+
recursive?: boolean;
|
|
40
|
+
preservePath?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends Partial<LocationUri>, StreamAction {
|
|
44
|
+
active?: boolean;
|
|
45
|
+
overwrite?: boolean;
|
|
46
|
+
chunkSize?: number | string;
|
|
47
|
+
chunkLimit?: number;
|
|
48
|
+
flags?: number;
|
|
49
|
+
admin?: CloudStorageAdmin<T, U, V, W, X, Y>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string, X = unknown, Y = unknown, Z = unknown> extends CloudStorageACL<U>, CloudStorageAction<V, W, unknown, X, Y, Z> {
|
|
53
|
+
buffer?: Null<Buffer>;
|
|
54
|
+
contentType?: string;
|
|
55
|
+
metadata?: Record<string, string>;
|
|
56
|
+
tags?: Record<string, string> | false;
|
|
57
|
+
options?: T;
|
|
58
|
+
fileGroup?: UploadContent[];
|
|
59
|
+
localStorage?: boolean;
|
|
60
|
+
endpoint?: string;
|
|
61
|
+
all?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface CloudStorageACL<T = string> {
|
|
65
|
+
publicRead?: boolean | 0;
|
|
66
|
+
acl?: T;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface CloudStorageDownload<T = unknown, U = unknown> extends CloudStorageAction {
|
|
70
|
+
keyname?: string;
|
|
71
|
+
versionId?: string;
|
|
72
|
+
options?: U;
|
|
73
|
+
deleteObject?: T;
|
|
74
|
+
waitStatus?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface BucketWebsiteOptions {
|
|
78
|
+
indexPage?: string;
|
|
79
|
+
errorPage?: string;
|
|
80
|
+
indexPath?: string;
|
|
81
|
+
errorPath?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface UploadData<T = unknown, U = string, V = unknown, W = string, X = unknown, Y = unknown, Z = unknown> extends BucketAction {
|
|
85
|
+
upload: CloudStorageUpload<T, U, V, W, X, Y, Z>;
|
|
86
|
+
localUri: string;
|
|
87
|
+
buffer: Buffer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface DownloadData<T = unknown, U = unknown> extends BucketAction {
|
|
91
|
+
download: CloudStorageDownload<T, U>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface BucketAction {
|
|
95
|
+
bucket: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface UploadAssetOptions {
|
|
99
|
+
contentType?: string;
|
|
100
|
+
ignoreProcess?: boolean;
|
|
101
|
+
preferBuffer?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type UploadContent = [Bufferable, string, string?];
|
|
105
|
+
export type CloudSource = "atlas" | "aws" | "aws-v3" | "az" | "azure" | "gcp" | "gcloud" | "ibm" | "oci" | "minio";
|
|
106
|
+
export type CloudFeatures = "storage" | "database";
|
|
107
107
|
export type CloudFunctions = "upload" | "download";
|
package/lib/compat-v4.d.ts
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IModule, ModuleConstructor, WatchConstructor } from './index';
|
|
2
|
-
|
|
3
|
-
import type { CloneObjectOptions } from '../index.d';
|
|
4
|
-
import type { ExternalAsset } from './asset';
|
|
5
|
-
import type { CacheOptions } from './core';
|
|
6
|
-
import type { QueryResult } from './db';
|
|
7
|
-
import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
|
|
8
|
-
import type { IHttpMemoryCache } from './filemanager';
|
|
9
|
-
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
10
|
-
import type { ParseFunctionOptions } from './module';
|
|
11
|
-
import type { LogFailOptions, LogType, LogValue } from './logger';
|
|
12
|
-
import type { HostConfig, OpenOptions, ProxySettings } from './request';
|
|
13
|
-
import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
|
|
14
|
-
|
|
15
|
-
import type { OutgoingHttpHeaders } from 'http';
|
|
16
|
-
import type { LookupFunction } from 'net';
|
|
17
|
-
import type { Readable, Writable } from 'stream';
|
|
18
|
-
|
|
19
|
-
type CpuUsage = NodeJS.CpuUsage;
|
|
20
|
-
|
|
21
|
-
export interface GetFunctionsOptions extends ParseFunctionOptions {
|
|
22
|
-
outFailed?: string[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface IModuleLibV4 {
|
|
26
|
-
isString(value: unknown): value is string;
|
|
27
|
-
isObject<T = object>(value: unknown): value is T;
|
|
28
|
-
isPlainObject<T = PlainObject>(value: unknown): value is T;
|
|
29
|
-
escapePattern(value: unknown, lookBehind?: boolean): string;
|
|
30
|
-
generateUUID(format?: string, dictionary?: string): string;
|
|
31
|
-
validateUUID(value: unknown): boolean;
|
|
32
|
-
cloneObject<T, U = unknown>(data: T, options?: boolean | WeakSet<object> | CloneObjectOptions<U>): T;
|
|
33
|
-
coerceObject<T = unknown>(data: T, parseString?: FunctionType<unknown, string> | boolean, cache?: boolean): T;
|
|
34
|
-
asFunction<T = unknown, U = FunctionType<Promise<T> | T>>(value: unknown, sync?: boolean): Null<U>;
|
|
35
|
-
isFileHTTP(value: string | URL): boolean;
|
|
36
|
-
isFileUNC(value: string | URL): boolean;
|
|
37
|
-
isPathUNC(value: string | URL): boolean;
|
|
38
|
-
toTimeMs(hrtime: HighResolutionTime, format?: boolean): number | string;
|
|
39
|
-
renameExt(value: string, ext: string, when?: string): string;
|
|
40
|
-
existsSafe(value: string, isFile?: boolean): boolean;
|
|
41
|
-
readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<Bufferable>;
|
|
42
|
-
getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
|
|
43
|
-
formatSize(value: number | string, options?: PlainObject): number | string;
|
|
44
|
-
hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
|
|
45
|
-
hasSize(value: string, keepEmpty?: boolean): boolean;
|
|
46
|
-
getSize(value: string, diskUsed?: boolean): number;
|
|
47
|
-
byteLength(value: Bufferable, encoding?: BufferEncoding): number;
|
|
48
|
-
cleanupStream(target: Readable | Writable, pathname?: string): void;
|
|
49
|
-
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseSettledResult<U>[]>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface IModuleCompatV4<T extends IHost = IHost> extends IModule<T> {
|
|
53
|
-
set startCPU(value);
|
|
54
|
-
get startCPU(): Null<CpuUsage>;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ModuleCompatV4Constructor extends ModuleConstructor, IModuleLibV4 {
|
|
58
|
-
readonly prototype: IModuleCompatV4;
|
|
59
|
-
new(...args: unknown[]): IModuleCompatV4;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> extends IFileManager<T> {
|
|
63
|
-
archiving: boolean;
|
|
64
|
-
cacheHttpRequest: boolean | FirstOf<string>;
|
|
65
|
-
cacheHttpRequestBuffer: IHttpMemoryCache<T>;
|
|
66
|
-
fetchTimeout: number;
|
|
67
|
-
httpProxy: Null<ProxySettings>;
|
|
68
|
-
acceptEncoding: boolean;
|
|
69
|
-
keepAliveTimeout: number;
|
|
70
|
-
addDns(hostname: string, address: string, family?: number | string): void;
|
|
71
|
-
lookupDns(hostname: string): LookupFunction;
|
|
72
|
-
getHttpProxy(uri: string, localhost?: boolean): Null<ProxySettings>;
|
|
73
|
-
getHttpHeaders(uri: string): Undef<OutgoingHttpHeaders>;
|
|
74
|
-
createHttpRequest(uri: string | URL, options?: OpenOptions): HostConfig;
|
|
75
|
-
getHttpClient(uri: string | URL, options: OpenOptions): HttpRequestClient;
|
|
76
|
-
set httpVersion(value);
|
|
77
|
-
get httpVersion(): Null<HttpProtocolVersion>;
|
|
78
|
-
set ipVersion(value);
|
|
79
|
-
get ipVersion(): InternetProtocolVersion;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface FileManagerCompatV4Constructor<T extends ExternalAsset = ExternalAsset> extends FileManagerConstructor<T> {
|
|
83
|
-
fromHttpStatusCode(value: number | string): string;
|
|
84
|
-
resetHttpHost(version?: HttpProtocolVersion): void;
|
|
85
|
-
defineHttpBuffer(options: HttpMemorySettings): void;
|
|
86
|
-
defineHttpSettings(options: HttpSettings): void;
|
|
87
|
-
defineHttpAgent(options: HttpAgentSettings): void;
|
|
88
|
-
defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
|
|
89
|
-
clearDnsLookup(): void;
|
|
90
|
-
getAria2Path(): string;
|
|
91
|
-
clearHttpBuffer(percent?: number, limit?: number): void;
|
|
92
|
-
readonly prototype: IFileManagerCompatV4<T>;
|
|
93
|
-
new(...args: unknown[]): IFileManagerCompatV4<T>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface ICloudCompatV4<T extends IHost = IHost> extends ICloud<T> {
|
|
97
|
-
getDatabaseResult(service: string, credential: unknown, queryString: string, options?: CacheOptions | boolean | string): Undef<QueryResult>;
|
|
98
|
-
setDatabaseResult(service: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
|
99
|
-
hasDatabaseCache(service: string, sessionKey?: string): boolean;
|
|
100
|
-
hasDatabaseCoerce(service: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface CloudCompatV4Constructor extends CloudConstructor {
|
|
104
|
-
readonly prototype: ICloudCompatV4;
|
|
105
|
-
new(...args: unknown[]): ICloudCompatV4;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface WatchCompatV4Constructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> extends WatchConstructor<T, U> {
|
|
109
|
-
readCACert(value: string, cache?: boolean): string;
|
|
110
|
-
readTLSKey(value: string, cache?: boolean): string;
|
|
111
|
-
readTLSCert(value: string, cache?: boolean): string;
|
|
112
|
-
isCert(value: string): boolean;
|
|
113
|
-
parseExpires(value: number | string, start?: number): number;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransformSeries<T, U>, PropertyAction<OutV3, "out"> {}
|
|
117
|
-
|
|
118
|
-
export interface TransformSeriesCompatV4Constructor extends TransformSeriesConstructor {
|
|
119
|
-
readonly prototype: ITransformSeriesCompatV4;
|
|
120
|
-
new(...args: unknown[]): ITransformSeriesCompatV4;
|
|
1
|
+
import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IModule, ModuleConstructor, WatchConstructor } from './index';
|
|
2
|
+
|
|
3
|
+
import type { CloneObjectOptions } from '../index.d';
|
|
4
|
+
import type { ExternalAsset } from './asset';
|
|
5
|
+
import type { CacheOptions } from './core';
|
|
6
|
+
import type { QueryResult } from './db';
|
|
7
|
+
import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
|
|
8
|
+
import type { IHttpMemoryCache } from './filemanager';
|
|
9
|
+
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
10
|
+
import type { ParseFunctionOptions } from './module';
|
|
11
|
+
import type { LogFailOptions, LogType, LogValue } from './logger';
|
|
12
|
+
import type { HostConfig, OpenOptions, ProxySettings } from './request';
|
|
13
|
+
import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
|
|
14
|
+
|
|
15
|
+
import type { OutgoingHttpHeaders } from 'http';
|
|
16
|
+
import type { LookupFunction } from 'net';
|
|
17
|
+
import type { Readable, Writable } from 'stream';
|
|
18
|
+
|
|
19
|
+
type CpuUsage = NodeJS.CpuUsage;
|
|
20
|
+
|
|
21
|
+
export interface GetFunctionsOptions extends ParseFunctionOptions {
|
|
22
|
+
outFailed?: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface IModuleLibV4 {
|
|
26
|
+
isString(value: unknown): value is string;
|
|
27
|
+
isObject<T = object>(value: unknown): value is T;
|
|
28
|
+
isPlainObject<T = PlainObject>(value: unknown): value is T;
|
|
29
|
+
escapePattern(value: unknown, lookBehind?: boolean): string;
|
|
30
|
+
generateUUID(format?: string, dictionary?: string): string;
|
|
31
|
+
validateUUID(value: unknown): boolean;
|
|
32
|
+
cloneObject<T, U = unknown>(data: T, options?: boolean | WeakSet<object> | CloneObjectOptions<U>): T;
|
|
33
|
+
coerceObject<T = unknown>(data: T, parseString?: FunctionType<unknown, string> | boolean, cache?: boolean): T;
|
|
34
|
+
asFunction<T = unknown, U = FunctionType<Promise<T> | T>>(value: unknown, sync?: boolean): Null<U>;
|
|
35
|
+
isFileHTTP(value: string | URL): boolean;
|
|
36
|
+
isFileUNC(value: string | URL): boolean;
|
|
37
|
+
isPathUNC(value: string | URL): boolean;
|
|
38
|
+
toTimeMs(hrtime: HighResolutionTime, format?: boolean): number | string;
|
|
39
|
+
renameExt(value: string, ext: string, when?: string): string;
|
|
40
|
+
existsSafe(value: string, isFile?: boolean): boolean;
|
|
41
|
+
readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<Bufferable>;
|
|
42
|
+
getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
|
|
43
|
+
formatSize(value: number | string, options?: PlainObject): number | string;
|
|
44
|
+
hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
|
|
45
|
+
hasSize(value: string, keepEmpty?: boolean): boolean;
|
|
46
|
+
getSize(value: string, diskUsed?: boolean): number;
|
|
47
|
+
byteLength(value: Bufferable, encoding?: BufferEncoding): number;
|
|
48
|
+
cleanupStream(target: Readable | Writable, pathname?: string): void;
|
|
49
|
+
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseSettledResult<U>[]>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface IModuleCompatV4<T extends IHost = IHost> extends IModule<T> {
|
|
53
|
+
set startCPU(value);
|
|
54
|
+
get startCPU(): Null<CpuUsage>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ModuleCompatV4Constructor extends ModuleConstructor, IModuleLibV4 {
|
|
58
|
+
readonly prototype: IModuleCompatV4;
|
|
59
|
+
new(...args: unknown[]): IModuleCompatV4;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> extends IFileManager<T> {
|
|
63
|
+
archiving: boolean;
|
|
64
|
+
cacheHttpRequest: boolean | FirstOf<string>;
|
|
65
|
+
cacheHttpRequestBuffer: IHttpMemoryCache<T>;
|
|
66
|
+
fetchTimeout: number;
|
|
67
|
+
httpProxy: Null<ProxySettings>;
|
|
68
|
+
acceptEncoding: boolean;
|
|
69
|
+
keepAliveTimeout: number;
|
|
70
|
+
addDns(hostname: string, address: string, family?: number | string): void;
|
|
71
|
+
lookupDns(hostname: string): LookupFunction;
|
|
72
|
+
getHttpProxy(uri: string, localhost?: boolean): Null<ProxySettings>;
|
|
73
|
+
getHttpHeaders(uri: string): Undef<OutgoingHttpHeaders>;
|
|
74
|
+
createHttpRequest(uri: string | URL, options?: OpenOptions): HostConfig;
|
|
75
|
+
getHttpClient(uri: string | URL, options: OpenOptions): HttpRequestClient;
|
|
76
|
+
set httpVersion(value);
|
|
77
|
+
get httpVersion(): Null<HttpProtocolVersion>;
|
|
78
|
+
set ipVersion(value);
|
|
79
|
+
get ipVersion(): InternetProtocolVersion;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface FileManagerCompatV4Constructor<T extends ExternalAsset = ExternalAsset> extends FileManagerConstructor<T> {
|
|
83
|
+
fromHttpStatusCode(value: number | string): string;
|
|
84
|
+
resetHttpHost(version?: HttpProtocolVersion): void;
|
|
85
|
+
defineHttpBuffer(options: HttpMemorySettings): void;
|
|
86
|
+
defineHttpSettings(options: HttpSettings): void;
|
|
87
|
+
defineHttpAgent(options: HttpAgentSettings): void;
|
|
88
|
+
defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
|
|
89
|
+
clearDnsLookup(): void;
|
|
90
|
+
getAria2Path(): string;
|
|
91
|
+
clearHttpBuffer(percent?: number, limit?: number): void;
|
|
92
|
+
readonly prototype: IFileManagerCompatV4<T>;
|
|
93
|
+
new(...args: unknown[]): IFileManagerCompatV4<T>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ICloudCompatV4<T extends IHost = IHost> extends ICloud<T> {
|
|
97
|
+
getDatabaseResult(service: string, credential: unknown, queryString: string, options?: CacheOptions | boolean | string): Undef<QueryResult>;
|
|
98
|
+
setDatabaseResult(service: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
|
99
|
+
hasDatabaseCache(service: string, sessionKey?: string): boolean;
|
|
100
|
+
hasDatabaseCoerce(service: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface CloudCompatV4Constructor extends CloudConstructor {
|
|
104
|
+
readonly prototype: ICloudCompatV4;
|
|
105
|
+
new(...args: unknown[]): ICloudCompatV4;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface WatchCompatV4Constructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> extends WatchConstructor<T, U> {
|
|
109
|
+
readCACert(value: string, cache?: boolean): string;
|
|
110
|
+
readTLSKey(value: string, cache?: boolean): string;
|
|
111
|
+
readTLSCert(value: string, cache?: boolean): string;
|
|
112
|
+
isCert(value: string): boolean;
|
|
113
|
+
parseExpires(value: number | string, start?: number): number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransformSeries<T, U>, PropertyAction<OutV3, "out"> {}
|
|
117
|
+
|
|
118
|
+
export interface TransformSeriesCompatV4Constructor extends TransformSeriesConstructor {
|
|
119
|
+
readonly prototype: ITransformSeriesCompatV4;
|
|
120
|
+
new(...args: unknown[]): ITransformSeriesCompatV4;
|
|
121
121
|
}
|