@e-mc/types 0.8.10 → 0.9.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/LICENSE +7 -3
- package/README.md +14 -6
- package/constant.d.ts +23 -2
- package/index.d.ts +25 -0
- package/lib/asset.d.ts +4 -2
- package/lib/cloud.d.ts +31 -16
- package/lib/compat-v4.d.ts +7 -14
- package/lib/compress.d.ts +3 -3
- package/lib/core.d.ts +25 -19
- package/lib/db.d.ts +0 -9
- package/lib/filemanager.d.ts +3 -2
- package/lib/http.d.ts +20 -0
- package/lib/index.d.ts +151 -130
- package/lib/logger.d.ts +4 -14
- package/lib/module.d.ts +12 -2
- package/lib/node.d.ts +0 -2
- package/lib/object.d.ts +2 -0
- package/lib/request.d.ts +6 -4
- package/lib/settings.d.ts +72 -68
- package/lib/squared.d.ts +14 -13
- package/lib/type.d.ts +3 -4
- package/lib/watch.d.ts +3 -3
- package/package.json +4 -5
- package/lib/dom.d.ts +0 -9
package/LICENSE
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
Copyright 2024 An Pham
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @e-mc/types
|
|
2
2
|
|
|
3
|
-
* NodeJS
|
|
4
|
-
*
|
|
3
|
+
* NodeJS 16
|
|
4
|
+
* ES2020
|
|
5
5
|
|
|
6
6
|
## General Usage
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.1/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -17,7 +17,9 @@ import type { CloneObjectOptions } from "./lib/module";
|
|
|
17
17
|
|
|
18
18
|
import type { BytesOptions } from "bytes";
|
|
19
19
|
import type { BinaryLike, CipherGCMTypes, Encoding } from "crypto";
|
|
20
|
+
import type { HighResolutionTime } from "perf_hooks";
|
|
20
21
|
|
|
22
|
+
function createAbortError(reject: true): Promise<never>;
|
|
21
23
|
function createAbortError(): Error;
|
|
22
24
|
function hasBit(value: unknown, flags: number): boolean;
|
|
23
25
|
function ignoreFlag(value: unknown): boolean;
|
|
@@ -162,6 +164,12 @@ interface DB_TRANSACTION {
|
|
|
162
164
|
CACHE: 128;
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
interface TRANSFER_TYPE {
|
|
168
|
+
DISK: 1;
|
|
169
|
+
STREAM: 2;
|
|
170
|
+
CHUNK: 4;
|
|
171
|
+
}
|
|
172
|
+
|
|
165
173
|
interface WATCH_EVENT {
|
|
166
174
|
MODIFIED: "modified";
|
|
167
175
|
BROADCAST: "broadcast";
|
|
@@ -186,12 +194,12 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
186
194
|
|
|
187
195
|
## References
|
|
188
196
|
|
|
189
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
190
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.9.1/lib/logger.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.9.1/lib/module.d.ts
|
|
191
199
|
|
|
192
200
|
* https://nodejs.org/api/perf_hooks.html
|
|
193
201
|
* https://www.npmjs.com/package/@types/bytes
|
|
194
202
|
|
|
195
203
|
## LICENSE
|
|
196
204
|
|
|
197
|
-
|
|
205
|
+
BSD 3-Clause
|
package/constant.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const enum INTERNAL {
|
|
2
|
-
VERSION = '0.
|
|
2
|
+
VERSION = '0.9.1',
|
|
3
3
|
TEMP_DIR = 'tmp',
|
|
4
4
|
CJS = '__cjs__'
|
|
5
5
|
}
|
|
@@ -47,11 +47,16 @@ export const enum ERR_MESSAGE {
|
|
|
47
47
|
PARAMETERS = 'Invalid parameters',
|
|
48
48
|
FORMAT = 'Invalid format',
|
|
49
49
|
CHECKSUM = 'Invalid checksum',
|
|
50
|
+
RESPONSE = 'Invalid response',
|
|
51
|
+
SIZE = 'Size limit was exceeded',
|
|
50
52
|
ERROR_CODE = 'Error code',
|
|
53
|
+
PERMISSION = 'Operation not permitted',
|
|
51
54
|
EXEC_PERMISSION = 'Exec command not permitted',
|
|
52
55
|
NOT_CACHEABLE = 'Not able to cache',
|
|
53
56
|
NOT_COPYABLE = 'Not able to copy file',
|
|
54
57
|
NOT_DIRECTORY = 'Path is not a directory',
|
|
58
|
+
NOT_ABSOLUTE = 'Path is not absolute',
|
|
59
|
+
NOT_READABLE = 'Not able to read buffer',
|
|
55
60
|
CANCELLED = 'Transaction was cancelled',
|
|
56
61
|
INCOMPLETE = 'Transaction was not completed',
|
|
57
62
|
THREAD = 'Thread limit exceeded',
|
|
@@ -62,6 +67,7 @@ export const enum ERR_MESSAGE {
|
|
|
62
67
|
UNSUPPORTED_MIME = 'Unsupported MIME',
|
|
63
68
|
UNSUPPORTED_READ = 'Not permitted to read file',
|
|
64
69
|
UNSUPPORTED_WRITE = 'Not permitted to write file',
|
|
70
|
+
NOTFOUND_PATH = 'Path not found',
|
|
65
71
|
NOTFOUND_FILE = 'File not found',
|
|
66
72
|
NOTFOUND_BINARY = 'Binary not found',
|
|
67
73
|
NOTFOUND_PACKAGE = 'Package not found',
|
|
@@ -161,7 +167,10 @@ export const enum ERR_IMAGE {
|
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
export const enum ERR_HTTP {
|
|
164
|
-
HEADERS = 'Unable to process headers'
|
|
170
|
+
HEADERS = 'Unable to process headers',
|
|
171
|
+
ETAG = 'ETag not supported',
|
|
172
|
+
DOWNLOAD_SUCCESS = 'No files were successfully downloaded',
|
|
173
|
+
MULTIPART_ATTACH = 'No files were attached'
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
export const enum DB_TRANSACTION {
|
|
@@ -175,6 +184,12 @@ export const enum DB_TRANSACTION {
|
|
|
175
184
|
CACHE = 128
|
|
176
185
|
}
|
|
177
186
|
|
|
187
|
+
export const enum TRANSFER_TYPE {
|
|
188
|
+
DISK = 1,
|
|
189
|
+
STREAM = 2,
|
|
190
|
+
CHUNK = 4
|
|
191
|
+
}
|
|
192
|
+
|
|
178
193
|
export const enum TIME {
|
|
179
194
|
Y = 1000 * 60 * 60 * 24 * 7 * 52,
|
|
180
195
|
M = 1000 * 60 * 60 * 24 * 30,
|
|
@@ -247,6 +262,12 @@ export const enum LOG_TYPE {
|
|
|
247
262
|
DB = 65536
|
|
248
263
|
}
|
|
249
264
|
|
|
265
|
+
export const enum LOG_STATE {
|
|
266
|
+
STDIN = 0,
|
|
267
|
+
STDOUT = 1,
|
|
268
|
+
STDERR = 2
|
|
269
|
+
}
|
|
270
|
+
|
|
250
271
|
export const enum READDIR_SORT {
|
|
251
272
|
FILE = 0,
|
|
252
273
|
DIRECTORY = 1,
|
package/index.d.ts
CHANGED
|
@@ -56,6 +56,18 @@ declare namespace types {
|
|
|
56
56
|
DB: 65536;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
+
interface LOG_STATE {
|
|
60
|
+
STDIN: 0;
|
|
61
|
+
STDOUT: 1;
|
|
62
|
+
STDERR: 2;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const LOG_STATE: {
|
|
66
|
+
STDIN: 0;
|
|
67
|
+
STDOUT: 1;
|
|
68
|
+
STDERR: 2;
|
|
69
|
+
};
|
|
70
|
+
|
|
59
71
|
interface STATUS_TYPE {
|
|
60
72
|
UNKNOWN: 0;
|
|
61
73
|
FATAL: 1;
|
|
@@ -202,6 +214,18 @@ declare namespace types {
|
|
|
202
214
|
CACHE: 128;
|
|
203
215
|
};
|
|
204
216
|
|
|
217
|
+
interface TRANSFER_TYPE {
|
|
218
|
+
DISK: 1;
|
|
219
|
+
STREAM: 2;
|
|
220
|
+
CHUNK: 4;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const TRANSFER_TYPE: {
|
|
224
|
+
DISK: 1;
|
|
225
|
+
STREAM: 2;
|
|
226
|
+
CHUNK: 4;
|
|
227
|
+
};
|
|
228
|
+
|
|
205
229
|
interface WATCH_EVENT {
|
|
206
230
|
MODIFIED: "modified";
|
|
207
231
|
BROADCAST: "broadcast";
|
|
@@ -244,6 +268,7 @@ declare namespace types {
|
|
|
244
268
|
|
|
245
269
|
type WatchEventValue = WATCH_EVENT[keyof WATCH_EVENT];
|
|
246
270
|
|
|
271
|
+
function createAbortError(reject: true): Promise<never>;
|
|
247
272
|
function createAbortError(): AbortError;
|
|
248
273
|
function hasBit(value: unknown, flags: number): boolean;
|
|
249
274
|
function ignoreFlag(value: unknown): boolean;
|
package/lib/asset.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, St
|
|
|
58
58
|
id?: number;
|
|
59
59
|
url?: URL;
|
|
60
60
|
socketPath?: string;
|
|
61
|
-
buffer?: Buffer
|
|
61
|
+
buffer?: Null<Buffer>;
|
|
62
62
|
localUri?: string;
|
|
63
63
|
fetchType?: FetchType;
|
|
64
64
|
sourceUTF8?: string;
|
|
@@ -72,4 +72,6 @@ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, St
|
|
|
72
72
|
lastModified?: string;
|
|
73
73
|
contentLength?: number;
|
|
74
74
|
invalid?: boolean;
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512";
|
package/lib/cloud.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DbDataSource, LocationUri, StorageAction } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { ExternalAsset, StreamAction } from './asset';
|
|
4
|
+
import type { ExecuteAction } from './db';
|
|
4
5
|
|
|
5
6
|
export interface UploadAction {
|
|
6
7
|
cloudUrl?: string;
|
|
@@ -8,42 +9,47 @@ export interface UploadAction {
|
|
|
8
9
|
|
|
9
10
|
export interface CloudAsset<T = CloudStorage> extends ExternalAsset, UploadAction, StorageAction<T> {}
|
|
10
11
|
|
|
11
|
-
export interface CloudService {
|
|
12
|
-
service:
|
|
13
|
-
credential?:
|
|
12
|
+
export interface CloudService<T = unknown, U = string> {
|
|
13
|
+
service: U;
|
|
14
|
+
credential?: T;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export interface CloudDatabase<T = unknown, U = PlainObject, V = unknown, W = unknown> extends CloudService
|
|
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> {
|
|
17
18
|
id?: string;
|
|
18
|
-
params?: W;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export interface CloudStorage extends CloudService {
|
|
21
|
+
export interface CloudStorage<T = unknown, U = string> extends CloudService<T, U> {
|
|
22
22
|
bucket?: string;
|
|
23
23
|
admin?: CloudStorageAdmin;
|
|
24
24
|
upload?: CloudStorageUpload;
|
|
25
25
|
download?: CloudStorageDownload;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unknown> extends CloudStorageACL<U> {
|
|
28
|
+
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends CloudStorageACL<U> {
|
|
29
29
|
emptyBucket?: boolean;
|
|
30
30
|
configBucket?: {
|
|
31
31
|
create?: T;
|
|
32
32
|
policy?: V;
|
|
33
|
+
tags?: unknown;
|
|
33
34
|
website?: BucketWebsiteOptions;
|
|
34
35
|
retentionPolicy?: W;
|
|
36
|
+
cors?: X;
|
|
37
|
+
lifecycle?: Y;
|
|
35
38
|
};
|
|
36
39
|
recursive?: boolean;
|
|
37
40
|
preservePath?: boolean;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown> extends Partial<LocationUri>, StreamAction {
|
|
43
|
+
export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends Partial<LocationUri>, StreamAction {
|
|
41
44
|
active?: boolean;
|
|
42
45
|
overwrite?: boolean;
|
|
43
|
-
|
|
46
|
+
chunkSize?: NumString;
|
|
47
|
+
chunkLimit?: number;
|
|
48
|
+
flags?: number;
|
|
49
|
+
admin?: CloudStorageAdmin<T, U, V, W, X, Y>;
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string, X = unknown> extends CloudStorageACL<U>, CloudStorageAction<V, W, unknown, X> {
|
|
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> {
|
|
47
53
|
buffer?: Null<Buffer>;
|
|
48
54
|
contentType?: string;
|
|
49
55
|
metadata?: Record<string, string>;
|
|
@@ -60,8 +66,10 @@ export interface CloudStorageACL<T = string> {
|
|
|
60
66
|
acl?: T;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
export interface CloudStorageDownload<T = unknown> extends CloudStorageAction {
|
|
69
|
+
export interface CloudStorageDownload<T = unknown, U = unknown> extends CloudStorageAction {
|
|
70
|
+
keyname?: string;
|
|
64
71
|
versionId?: string;
|
|
72
|
+
options?: U;
|
|
65
73
|
deleteObject?: T;
|
|
66
74
|
waitStatus?: boolean;
|
|
67
75
|
}
|
|
@@ -73,20 +81,27 @@ export interface BucketWebsiteOptions {
|
|
|
73
81
|
errorPath?: string;
|
|
74
82
|
}
|
|
75
83
|
|
|
76
|
-
export interface UploadData<T = unknown, U = string, V = unknown, W = string, X = unknown> extends BucketAction {
|
|
77
|
-
upload: CloudStorageUpload<T, U, V, W, X>;
|
|
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>;
|
|
78
86
|
localUri: string;
|
|
79
87
|
buffer: Buffer;
|
|
80
88
|
}
|
|
81
89
|
|
|
82
|
-
export interface DownloadData<T = unknown> extends BucketAction {
|
|
83
|
-
download: CloudStorageDownload<T>;
|
|
90
|
+
export interface DownloadData<T = unknown, U = unknown> extends BucketAction {
|
|
91
|
+
download: CloudStorageDownload<T, U>;
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
export interface BucketAction {
|
|
87
95
|
bucket: string;
|
|
88
96
|
}
|
|
89
97
|
|
|
90
|
-
export
|
|
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";
|
|
91
106
|
export type CloudFeatures = "storage" | "database";
|
|
92
107
|
export type CloudFunctions = "upload" | "download";
|
package/lib/compat-v4.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost,
|
|
1
|
+
import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IModule, ModuleConstructor, WatchConstructor } from './index';
|
|
2
2
|
|
|
3
|
-
import type { ExternalAsset
|
|
3
|
+
import type { ExternalAsset } from './asset';
|
|
4
4
|
import type { CacheOptions } from './core';
|
|
5
5
|
import type { QueryResult } from './db';
|
|
6
6
|
import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
|
|
@@ -9,14 +9,11 @@ import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, Interne
|
|
|
9
9
|
import type { CloneObjectOptions, GetFunctionsOptions } from './module';
|
|
10
10
|
import type { LogFailOptions, LogType, LogValue } from './logger';
|
|
11
11
|
import type { HostConfig, OpenOptions, ProxySettings } from './request';
|
|
12
|
-
import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings
|
|
12
|
+
import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
|
|
13
13
|
|
|
14
|
-
import type { Readable, Writable } from 'stream';
|
|
15
14
|
import type { OutgoingHttpHeaders } from 'http';
|
|
16
15
|
import type { LookupFunction } from 'net';
|
|
17
|
-
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
import type { BytesOptions } from 'bytes';
|
|
16
|
+
import type { Readable, Writable } from 'stream';
|
|
20
17
|
|
|
21
18
|
type CpuUsage = NodeJS.CpuUsage;
|
|
22
19
|
|
|
@@ -36,13 +33,13 @@ export interface IModuleLibV4 {
|
|
|
36
33
|
toTimeMs(hrtime: HighResolutionTime, format?: boolean): NumString;
|
|
37
34
|
renameExt(value: string, ext: string, when?: string): string;
|
|
38
35
|
existsSafe(value: string, isFile?: boolean): boolean;
|
|
39
|
-
readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<
|
|
36
|
+
readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<Bufferable>;
|
|
40
37
|
getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
|
|
41
|
-
formatSize(value: NumString, options?:
|
|
38
|
+
formatSize(value: NumString, options?: PlainObject): NumString;
|
|
42
39
|
hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
|
|
43
40
|
hasSize(value: string, keepEmpty?: boolean): boolean;
|
|
44
41
|
getSize(value: string, diskUsed?: boolean): number;
|
|
45
|
-
byteLength(value:
|
|
42
|
+
byteLength(value: Bufferable, encoding?: BufferEncoding): number;
|
|
46
43
|
cleanupStream(target: Readable | Writable, pathname?: string): void;
|
|
47
44
|
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseSettledResult<U>[]>;
|
|
48
45
|
}
|
|
@@ -91,10 +88,6 @@ export interface FileManagerCompatV4Constructor<T extends ExternalAsset = Extern
|
|
|
91
88
|
new(...args: unknown[]): IFileManagerCompatV4<T>;
|
|
92
89
|
}
|
|
93
90
|
|
|
94
|
-
export interface ImageCompatV4Constructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ImageConstructor<T, U> {
|
|
95
|
-
using<V extends ExternalAsset>(this: T, instance: IImage<T, U>, data: IFileThread<V>, command: string): Promise<unknown>;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
91
|
export interface ICloudCompatV4<T extends IHost = IHost> extends ICloud<T> {
|
|
99
92
|
getDatabaseResult(service: string, credential: unknown, queryString: string, options?: CacheOptions | boolean | string): Undef<QueryResult>;
|
|
100
93
|
setDatabaseResult(service: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
package/lib/compress.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface CompressFormat extends ICompressFormat, LogBaseOptions {
|
|
|
7
7
|
startTime?: LogTime;
|
|
8
8
|
etag?: string;
|
|
9
9
|
proxyUrl?: string | ((uri: string) => Undef<string>);
|
|
10
|
+
outExt?: string;
|
|
11
|
+
outFile?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
interface Woff {
|
|
@@ -18,8 +20,6 @@ type ResultCallback<T = Null<Buffer | Uint8Array>> = (err: unknown, data?: T, ex
|
|
|
18
20
|
type ResultData = Null<Buffer | Uint8Array> | string;
|
|
19
21
|
|
|
20
22
|
export type BufferLike = Buffer | Uint8Array | ArrayBuffer | SharedArrayBuffer | readonly number[];
|
|
21
|
-
export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?:
|
|
23
|
+
export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?: ResultCallback<ResultData>) => Void<Promise<ResultData>>;
|
|
22
24
|
export type TryFileCompressorAsync = (data: string | Buffer, output: string, config: CompressFormat) => Promise<ResultData>;
|
|
23
|
-
export type TryFileResult = ResultCallback<ResultData>;
|
|
24
|
-
export type TryImageResult = ResultCallback;
|
|
25
25
|
export type BufferResult = Null<Buffer | Uint8Array>;
|
package/lib/core.d.ts
CHANGED
|
@@ -4,14 +4,20 @@ import type { DataSource, RequestBase } from './squared';
|
|
|
4
4
|
|
|
5
5
|
import type { IExternalConfig, IExternalFunction, IHost, IModule, ModuleConstructor } from './index';
|
|
6
6
|
import type { QueryResult, TimeoutAction } from './db';
|
|
7
|
-
import type { AddEventListenerOptions } from './dom';
|
|
8
7
|
import type { Settings } from './node';
|
|
9
|
-
import type { ClientDbSettings, ClientModule, DbCacheValue, DbCoerceSettings,
|
|
8
|
+
import type { ClientDbSettings, ClientModule, DbCacheValue, DbCoerceSettings, DbSourceOptions } from './settings';
|
|
10
9
|
|
|
11
10
|
export interface IdentifierAction {
|
|
12
11
|
uuidKey?: string;
|
|
13
12
|
}
|
|
14
13
|
|
|
14
|
+
export interface AddEventListenerOptions {
|
|
15
|
+
capture?: boolean;
|
|
16
|
+
once?: boolean;
|
|
17
|
+
passive?: boolean;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
export interface IClient<T extends IHost, U extends ClientModule, V extends FunctionType<any, any> = FunctionType> extends IModule<T>, IExternalConfig<U, U extends ClientModule<infer W> ? W : unknown>, IExternalFunction<V> {
|
|
16
22
|
init(...args: unknown[]): this;
|
|
17
23
|
getUserSettings<X>(): Null<X>;
|
|
@@ -28,14 +34,13 @@ export interface IClientDb<T extends IHost, U extends ClientModule<ClientDbSetti
|
|
|
28
34
|
database: V[];
|
|
29
35
|
cacheExpires: number;
|
|
30
36
|
add(item: V, state?: number): void;
|
|
31
|
-
hasCache(source: string, sessionKey?: string
|
|
37
|
+
hasCache(source: string, sessionKey?: string): boolean;
|
|
32
38
|
hasCoerce(source: string, component: keyof DbCoerceSettings, uuidKey: Undef<string>): boolean;
|
|
33
|
-
hasCoerce(source: string, component: keyof DbCoerceSettings, override: Optional<DbCoerceValue>, credential?: unknown): boolean;
|
|
34
39
|
hasCoerce(source: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
|
|
35
40
|
getQueryResult(source: string, credential: unknown, queryString: string, renewCache: boolean): Undef<QueryResult>;
|
|
36
|
-
getQueryResult(source: string, credential: unknown, queryString: string, sessionKey
|
|
41
|
+
getQueryResult(source: string, credential: unknown, queryString: string, sessionKey?: string, renewCache?: boolean): Undef<QueryResult>;
|
|
37
42
|
getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean): Undef<QueryResult>;
|
|
38
|
-
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey
|
|
43
|
+
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey?: string): QueryResult;
|
|
39
44
|
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
|
40
45
|
applyState(items: ArrayOf<V>, value: number, as?: boolean): void;
|
|
41
46
|
commit(items?: V[]): Promise<boolean>;
|
|
@@ -86,14 +91,14 @@ export interface AbortComponentConstructor {
|
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
export interface IPermission {
|
|
89
|
-
setDiskRead(pathname?:
|
|
90
|
-
setDiskWrite(pathname?:
|
|
91
|
-
setUNCRead(pathname?:
|
|
92
|
-
setUNCWrite(pathname?:
|
|
93
|
-
getDiskRead():
|
|
94
|
-
getDiskWrite():
|
|
95
|
-
getUNCRead():
|
|
96
|
-
getUNCWrite():
|
|
94
|
+
setDiskRead(pathname?: ArrayOf<string>, enabled?: boolean): void;
|
|
95
|
+
setDiskWrite(pathname?: ArrayOf<string>, enabled?: boolean): void;
|
|
96
|
+
setUNCRead(pathname?: ArrayOf<string>, enabled?: boolean): void;
|
|
97
|
+
setUNCWrite(pathname?: ArrayOf<string>, enabled?: boolean): void;
|
|
98
|
+
getDiskRead(): ArrayOf<string>;
|
|
99
|
+
getDiskWrite(): ArrayOf<string>;
|
|
100
|
+
getUNCRead(): ArrayOf<string>;
|
|
101
|
+
getUNCWrite(): ArrayOf<string>;
|
|
97
102
|
hasDiskRead(pathname: string): boolean;
|
|
98
103
|
hasDiskWrite(pathname: string): boolean;
|
|
99
104
|
hasUNCRead(pathname: string): boolean;
|
|
@@ -109,8 +114,8 @@ export interface PermissionConstructor {
|
|
|
109
114
|
create(settings: PermittedDirectories, parent: Null<IPermission>, freeze?: boolean): Null<IPermission>;
|
|
110
115
|
validate(settings: unknown): settings is PermittedDirectories;
|
|
111
116
|
clone(permission: IPermission, freeze?: boolean): IPermission;
|
|
112
|
-
match(pathname: string, pattern:
|
|
113
|
-
toPosix(value: unknown):
|
|
117
|
+
match(pathname: string, pattern: ArrayOf<string>): boolean;
|
|
118
|
+
toPosix(value: unknown): ArrayOf<string>;
|
|
114
119
|
readonly prototype: IPermission;
|
|
115
120
|
new(freeze?: boolean): IPermission;
|
|
116
121
|
}
|
|
@@ -134,11 +139,12 @@ export interface HostInitConfig extends PlainObject, RequestBase<HostInitLog> {
|
|
|
134
139
|
export interface HostInitLog {
|
|
135
140
|
enabled?: boolean;
|
|
136
141
|
level?: NumString;
|
|
137
|
-
exclude?:
|
|
142
|
+
exclude?: ArrayOf<string>;
|
|
138
143
|
useColor?: boolean;
|
|
144
|
+
showProgress?: boolean;
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
export interface PermittedDirectories extends PermissionReadWrite<
|
|
147
|
+
export interface PermittedDirectories extends PermissionReadWrite<ArrayOf<string>> {
|
|
142
148
|
inherit?: boolean;
|
|
143
149
|
}
|
|
144
150
|
|
|
@@ -161,7 +167,7 @@ export interface ThreadInfo {
|
|
|
161
167
|
startTime: number;
|
|
162
168
|
username?: string;
|
|
163
169
|
sessionId?: string;
|
|
164
|
-
broadcastId?:
|
|
170
|
+
broadcastId?: ArrayOf<string>;
|
|
165
171
|
}
|
|
166
172
|
|
|
167
173
|
export interface ThreadCountStat {
|
package/lib/db.d.ts
CHANGED
|
@@ -86,15 +86,6 @@ export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = un
|
|
|
86
86
|
new(pool: U, poolKey: string, uuidKey?: Null<AuthValue>): IDbPool<T, U, V>;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
export interface PoolConfig<T = number> extends MinMax {
|
|
90
|
-
idle?: T;
|
|
91
|
-
queue_max?: number;
|
|
92
|
-
queue_idle?: T;
|
|
93
|
-
purge?: T;
|
|
94
|
-
timeout?: number;
|
|
95
|
-
socket_timeout?: number;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
89
|
export interface TimeoutAction {
|
|
99
90
|
timeout?: NumString;
|
|
100
91
|
}
|
package/lib/filemanager.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BundleAction, ChecksumOutput, FileInfo, LogStatus } from './squared';
|
|
2
2
|
|
|
3
|
-
import type { IFileManager, IModule, ModuleConstructor } from './index';
|
|
3
|
+
import type { IFileManager, IImage, IModule, ImageConstructor, ModuleConstructor } from './index';
|
|
4
4
|
import type { ExternalAsset } from './asset';
|
|
5
5
|
import type { HostInitLog as IHostInitLog } from './core';
|
|
6
6
|
import type { ReadHashOptions } from './module';
|
|
@@ -60,7 +60,7 @@ export interface IHttpMemoryCache<T extends ExternalAsset = ExternalAsset> exten
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export interface HttpDiskCacheAddOptions {
|
|
63
|
-
buffer?: Null<
|
|
63
|
+
buffer?: Null<Bufferable>;
|
|
64
64
|
contentLength?: number;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -117,5 +117,6 @@ export interface ChecksumOptions extends ReadHashOptions, Pick<ChecksumOutput, "
|
|
|
117
117
|
throwsEmpty?: boolean;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
export type ImageMimeMap = Map<string, InstallData<IImage, ImageConstructor>>;
|
|
120
121
|
export type FetchType = FETCH_TYPE[keyof FETCH_TYPE];
|
|
121
122
|
export type PostFinalizeCallback = (files: FileInfo[] | string[], errors: string[], status?: LogStatus[]) => void;
|
package/lib/http.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { LookupAddress } from 'dns';
|
|
|
2
2
|
import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'http';
|
|
3
3
|
import type { Agent as HttpsAgent } from 'https';
|
|
4
4
|
import type { ClientHttp2Stream } from 'http2';
|
|
5
|
+
import type { SecureVersion } from 'tls';
|
|
5
6
|
|
|
6
7
|
export const enum HTTP_STATUS {
|
|
7
8
|
CONTINUE = 100,
|
|
@@ -87,6 +88,25 @@ export interface HttpAgentSettings {
|
|
|
87
88
|
timeout?: number;
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
export interface SecureConfig<T = string, U = T> {
|
|
92
|
+
ca?: T;
|
|
93
|
+
key?: U;
|
|
94
|
+
cert?: T;
|
|
95
|
+
passphrase?: U;
|
|
96
|
+
version?: SecureVersion;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ServerPort<T = NumString> {
|
|
100
|
+
port?: T;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface ServerSecure extends SecureConfig, ServerPort {}
|
|
104
|
+
|
|
105
|
+
export interface AuthValue {
|
|
106
|
+
username?: string;
|
|
107
|
+
password?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
90
110
|
export type HttpRequestClient = ClientRequest | ClientHttp2Stream;
|
|
91
111
|
export type HttpOutgoingHeaders = ObjectMap<OutgoingHttpHeaders>;
|
|
92
112
|
export type HttpProtocolVersion = 1 | 2 | 3;
|