@e-mc/types 0.10.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +10 -9
- package/constant.d.ts +39 -10
- package/index.d.ts +33 -19
- package/index.js +75 -111
- package/lib/asset.d.ts +3 -3
- package/lib/cloud.d.ts +11 -4
- package/lib/compress.d.ts +12 -11
- package/lib/core.d.ts +31 -30
- package/lib/db.d.ts +20 -17
- package/lib/document.d.ts +17 -16
- package/lib/filemanager.d.ts +12 -11
- package/lib/http.d.ts +7 -6
- package/lib/image.d.ts +53 -43
- package/lib/index.d.ts +195 -170
- package/lib/logger.d.ts +7 -2
- package/lib/module.d.ts +31 -44
- package/lib/node.d.ts +9 -3
- package/lib/object.d.ts +1 -3
- package/lib/request.d.ts +96 -24
- package/lib/settings.d.ts +126 -90
- package/lib/squared.d.ts +25 -56
- package/lib/type.d.ts +11 -6
- package/lib/watch.d.ts +5 -5
- package/package.json +2 -2
- package/lib/compat-v4.d.ts +0 -116
package/lib/cloud.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export interface UploadAction {
|
|
|
7
7
|
cloudUrl?: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface RecursiveAction {
|
|
11
|
+
recursive?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
export interface CloudAsset<T = CloudStorage> extends ExternalAsset, UploadAction, StorageAction<T> {}
|
|
11
15
|
|
|
12
16
|
export interface CloudService<T = unknown, U = string> {
|
|
@@ -26,7 +30,7 @@ export interface CloudStorage<T = unknown, U = string> extends CloudService<T, U
|
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends CloudStorageACL<U> {
|
|
29
|
-
emptyBucket?: boolean;
|
|
33
|
+
emptyBucket?: boolean | DeleteObjectsOptions;
|
|
30
34
|
configBucket?: {
|
|
31
35
|
create?: T;
|
|
32
36
|
policy?: V;
|
|
@@ -36,6 +40,7 @@ export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unk
|
|
|
36
40
|
cors?: X;
|
|
37
41
|
lifecycle?: Y;
|
|
38
42
|
};
|
|
43
|
+
/** @deprecated */
|
|
39
44
|
recursive?: boolean;
|
|
40
45
|
preservePath?: boolean;
|
|
41
46
|
}
|
|
@@ -43,14 +48,14 @@ export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unk
|
|
|
43
48
|
export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends Partial<LocationUri>, StreamAction {
|
|
44
49
|
active?: boolean;
|
|
45
50
|
overwrite?: boolean;
|
|
46
|
-
chunkSize?:
|
|
51
|
+
chunkSize?: number | string;
|
|
47
52
|
chunkLimit?: number;
|
|
48
53
|
flags?: number;
|
|
49
54
|
admin?: CloudStorageAdmin<T, U, V, W, X, Y>;
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
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?:
|
|
58
|
+
buffer?: Buffer | null;
|
|
54
59
|
contentType?: string;
|
|
55
60
|
metadata?: Record<string, string>;
|
|
56
61
|
tags?: Record<string, string> | false;
|
|
@@ -81,6 +86,8 @@ export interface BucketWebsiteOptions {
|
|
|
81
86
|
errorPath?: string;
|
|
82
87
|
}
|
|
83
88
|
|
|
89
|
+
export interface DeleteObjectsOptions extends RecursiveAction, PlainObject {}
|
|
90
|
+
|
|
84
91
|
export interface UploadData<T = unknown, U = string, V = unknown, W = string, X = unknown, Y = unknown, Z = unknown> extends BucketAction {
|
|
85
92
|
upload: CloudStorageUpload<T, U, V, W, X, Y, Z>;
|
|
86
93
|
localUri: string;
|
|
@@ -102,6 +109,6 @@ export interface UploadAssetOptions {
|
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
export type UploadContent = [Bufferable, string, string?];
|
|
105
|
-
export type CloudSource = "atlas" | "aws" | "aws-v3" | "az" | "azure" | "gcp" | "gcloud" | "
|
|
112
|
+
export type CloudSource = "atlas" | "aws" | "aws-v3" | "az" | "azure" | "gcp" | "gcloud" | "oci";
|
|
106
113
|
export type CloudFeatures = "storage" | "database";
|
|
107
114
|
export type CloudFunctions = "upload" | "download";
|
package/lib/compress.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import type { CompressFormat as ICompressFormat } from './squared';
|
|
1
|
+
import type { CompressFormat as ICompressFormat, CompressLevel as ICompressLevel } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { LogBaseOptions, LogTime } from './logger';
|
|
4
|
+
import type { ThrowsAction } from './module';
|
|
4
5
|
|
|
5
|
-
type ResultCallback<T =
|
|
6
|
-
type ResultData =
|
|
6
|
+
type ResultCallback<T = Buffer | Uint8Array | null> = (err: unknown, data?: T, ext?: string) => void;
|
|
7
|
+
type ResultData = Buffer | Uint8Array | string | null;
|
|
7
8
|
|
|
8
|
-
export interface CompressFormat extends ICompressFormat, LogBaseOptions {
|
|
9
|
+
export interface CompressFormat extends ICompressFormat, LogBaseOptions, ReadableOptions {
|
|
9
10
|
filename?: string;
|
|
11
|
+
mimeType?: string;
|
|
10
12
|
startTime?: LogTime;
|
|
11
13
|
etag?: string;
|
|
12
|
-
proxyUrl?: string | ((uri: string) => Undef<string>);
|
|
13
14
|
outExt?: string;
|
|
14
15
|
outFile?: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
18
|
+
export interface CompressLevel extends ICompressLevel, ReadableOptions {}
|
|
19
|
+
|
|
20
|
+
export interface ReadableOptions extends ThrowsAction {}
|
|
21
21
|
|
|
22
22
|
export type BufferLike = Buffer | Uint8Array | ArrayBuffer | SharedArrayBuffer | readonly number[];
|
|
23
|
-
export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?: ResultCallback<ResultData>) =>
|
|
23
|
+
export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?: ResultCallback<ResultData>) => Promise<ResultData | void>;
|
|
24
24
|
export type TryFileCompressorAsync = (data: string | Buffer, output: string, config: CompressFormat) => Promise<ResultData>;
|
|
25
|
-
export type BufferResult =
|
|
25
|
+
export type BufferResult = Buffer | Uint8Array | null;
|
|
26
|
+
export type PluginCompressor = FunctionArgs<[CompressFormat['options'], string?], FunctionArgs<[Buffer], Promise<Buffer | Uint8Array>>>;
|
package/lib/core.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
2
|
-
|
|
3
1
|
import type { DataSource, RequestBase } from './squared';
|
|
4
2
|
|
|
5
3
|
import type { IExternalConfig, IExternalFunction, IHost, IModule, ModuleConstructor } from './index';
|
|
@@ -20,7 +18,7 @@ export interface AddEventListenerOptions {
|
|
|
20
18
|
|
|
21
19
|
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> {
|
|
22
20
|
init(...args: unknown[]): this;
|
|
23
|
-
getUserSettings<X>():
|
|
21
|
+
getUserSettings<X>(): X | null;
|
|
24
22
|
set cacheDir(value: string);
|
|
25
23
|
get cacheDir(): string;
|
|
26
24
|
}
|
|
@@ -35,14 +33,15 @@ export interface IClientDb<T extends IHost, U extends ClientModule<ClientDbSetti
|
|
|
35
33
|
cacheExpires: number;
|
|
36
34
|
add(item: V, state?: number): void;
|
|
37
35
|
hasCache(source: string, sessionKey?: string): boolean;
|
|
38
|
-
hasCoerce(source: string, component: keyof DbCoerceSettings, uuidKey:
|
|
36
|
+
hasCoerce(source: string, component: keyof DbCoerceSettings, uuidKey: string | undefined): boolean;
|
|
39
37
|
hasCoerce(source: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
|
|
40
|
-
getQueryResult(source: string, credential: unknown, queryString: string, renewCache: boolean):
|
|
41
|
-
getQueryResult(source: string, credential: unknown, queryString: string, sessionKey?: string, renewCache?: boolean):
|
|
42
|
-
getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean):
|
|
38
|
+
getQueryResult(source: string, credential: unknown, queryString: string, renewCache: boolean): QueryResult | undefined;
|
|
39
|
+
getQueryResult(source: string, credential: unknown, queryString: string, sessionKey?: string, renewCache?: boolean): QueryResult | undefined;
|
|
40
|
+
getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean): QueryResult | undefined;
|
|
43
41
|
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey?: string): QueryResult;
|
|
44
42
|
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
|
45
|
-
|
|
43
|
+
getCacheResult(source: string, credential: unknown, queryString: string, cacheValue: CacheOptions, ignoreCache?: IntBool | FirstOf<number, number>): QueryResult | undefined;
|
|
44
|
+
applyState(items: V | V[], value: number, as?: boolean): void;
|
|
46
45
|
commit(items?: V[]): Promise<boolean>;
|
|
47
46
|
valueOfKey(credential: unknown, name: keyof W, component?: keyof X): unknown;
|
|
48
47
|
settingsOf(source: string, name: keyof W, component?: keyof X): unknown;
|
|
@@ -62,13 +61,13 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
|
|
|
62
61
|
readonly TRANSACTION_ABORT: number;
|
|
63
62
|
readonly TRANSACTION_FAIL: number;
|
|
64
63
|
loadSettings(settings: Pick<Settings, "process" | "memory">, password?: string): boolean;
|
|
65
|
-
getTimeout(value:
|
|
66
|
-
convertTime(value:
|
|
67
|
-
findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean):
|
|
64
|
+
getTimeout(value: number | string | TimeoutAction | undefined): number;
|
|
65
|
+
convertTime(value: number | string): number;
|
|
66
|
+
findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): QueryResult | undefined;
|
|
68
67
|
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
|
|
69
68
|
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, sessionKey: string, sessionExpires: number): QueryResult;
|
|
70
69
|
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue): QueryResult;
|
|
71
|
-
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache:
|
|
70
|
+
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue | undefined, options: StoreResultOptions): QueryResult;
|
|
72
71
|
purgeResult(prefix?: string): Promise<number>;
|
|
73
72
|
extractUUID(credential: unknown): string;
|
|
74
73
|
setPoolConfig(value: unknown): void;
|
|
@@ -91,14 +90,14 @@ export interface AbortComponentConstructor {
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
export interface IPermission {
|
|
94
|
-
setDiskRead(pathname?:
|
|
95
|
-
setDiskWrite(pathname?:
|
|
96
|
-
setUNCRead(pathname?:
|
|
97
|
-
setUNCWrite(pathname?:
|
|
98
|
-
getDiskRead():
|
|
99
|
-
getDiskWrite():
|
|
100
|
-
getUNCRead():
|
|
101
|
-
getUNCWrite():
|
|
93
|
+
setDiskRead(pathname?: string | string[], enabled?: boolean): void;
|
|
94
|
+
setDiskWrite(pathname?: string | string[], enabled?: boolean): void;
|
|
95
|
+
setUNCRead(pathname?: string | string[], enabled?: boolean): void;
|
|
96
|
+
setUNCWrite(pathname?: string | string[], enabled?: boolean): void;
|
|
97
|
+
getDiskRead(): string | string[];
|
|
98
|
+
getDiskWrite(): string | string[];
|
|
99
|
+
getUNCRead(): string | string[];
|
|
100
|
+
getUNCWrite(): string | string[];
|
|
102
101
|
hasDiskRead(pathname: string): boolean;
|
|
103
102
|
hasDiskWrite(pathname: string): boolean;
|
|
104
103
|
hasUNCRead(pathname: string): boolean;
|
|
@@ -110,12 +109,12 @@ export interface IPermission {
|
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
export interface PermissionConstructor {
|
|
113
|
-
create(settings: PermittedDirectories, freeze?: boolean):
|
|
114
|
-
create(settings: PermittedDirectories, parent:
|
|
112
|
+
create(settings: PermittedDirectories, freeze?: boolean): IPermission | null;
|
|
113
|
+
create(settings: PermittedDirectories, parent: IPermission | null, freeze?: boolean): IPermission | null;
|
|
115
114
|
validate(settings: unknown): settings is PermittedDirectories;
|
|
116
115
|
clone(permission: IPermission, freeze?: boolean): IPermission;
|
|
117
|
-
match(pathname: string, pattern:
|
|
118
|
-
toPosix(value:
|
|
116
|
+
match(pathname: string, pattern: string | string[]): boolean;
|
|
117
|
+
toPosix<T>(value: T): T extends Array<unknown> ? string | string[] : string;
|
|
119
118
|
readonly prototype: IPermission;
|
|
120
119
|
new(freeze?: boolean): IPermission;
|
|
121
120
|
}
|
|
@@ -131,20 +130,22 @@ export interface PermissionAction {
|
|
|
131
130
|
permission?: PermittedDirectories;
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
export interface HostInitConfig extends PlainObject, RequestBase<
|
|
133
|
+
export interface HostInitConfig<T extends HostInitLog = HostInitLog> extends PlainObject, RequestBase<T> {
|
|
135
134
|
username?: string;
|
|
135
|
+
remoteIp?: string;
|
|
136
136
|
ignoreModules?: string[];
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
export interface HostInitLog {
|
|
140
140
|
enabled?: boolean;
|
|
141
|
-
level?:
|
|
142
|
-
exclude?:
|
|
141
|
+
level?: number | string;
|
|
142
|
+
exclude?: string | string[];
|
|
143
143
|
useColor?: boolean;
|
|
144
|
+
silent?: boolean;
|
|
144
145
|
showProgress?: boolean;
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
export interface PermittedDirectories extends PermissionReadWrite<
|
|
148
|
+
export interface PermittedDirectories extends PermissionReadWrite<string | string[]> {
|
|
148
149
|
inherit?: boolean;
|
|
149
150
|
}
|
|
150
151
|
|
|
@@ -158,7 +159,7 @@ export interface StoreResultOptions {
|
|
|
158
159
|
export interface CacheOptions {
|
|
159
160
|
value?: DbCacheValue;
|
|
160
161
|
renewCache?: boolean;
|
|
161
|
-
exclusiveOf?:
|
|
162
|
+
exclusiveOf?: FirstOf<number, number>;
|
|
162
163
|
sessionKey?: string;
|
|
163
164
|
}
|
|
164
165
|
|
|
@@ -167,7 +168,7 @@ export interface ThreadInfo {
|
|
|
167
168
|
startTime: number;
|
|
168
169
|
username?: string;
|
|
169
170
|
sessionId?: string;
|
|
170
|
-
broadcastId?:
|
|
171
|
+
broadcastId?: string | string[];
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
export interface ThreadCountStat {
|
package/lib/db.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DataSource, DbDataSource } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { CacheOptions, IdentifierAction } from './core';
|
|
4
|
+
import type { AuthValue } from './http';
|
|
4
5
|
|
|
5
6
|
import type { DB_TYPE } from '../index.d';
|
|
6
7
|
|
|
@@ -32,14 +33,12 @@ export interface ProcessRowsOptions {
|
|
|
32
33
|
parallel?: boolean;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export interface DbConnection {
|
|
36
|
+
export interface DbConnection extends Required<AuthValue> {
|
|
37
|
+
protocol: string;
|
|
36
38
|
hostname: string;
|
|
37
|
-
password: string;
|
|
38
|
-
pathname: string;
|
|
39
39
|
port: string;
|
|
40
|
-
|
|
40
|
+
pathname: string;
|
|
41
41
|
search: string;
|
|
42
|
-
username: string;
|
|
43
42
|
database: string;
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -56,16 +55,16 @@ export interface ServerAuth<T = number> extends AuthValue, IdentifierAction {
|
|
|
56
55
|
database?: string;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
|
|
58
|
+
export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
|
|
60
59
|
client: U;
|
|
61
60
|
lastAccessed: number;
|
|
62
61
|
success: number;
|
|
63
62
|
failed: number;
|
|
64
63
|
poolKey: string;
|
|
65
|
-
uuidKey:
|
|
64
|
+
uuidKey: AuthValue | null;
|
|
66
65
|
add(item: T, uuidKey?: string): this;
|
|
67
66
|
has(item: T): boolean;
|
|
68
|
-
getConnection(): Promise<V>;
|
|
67
|
+
getConnection(credential?: W): Promise<V>;
|
|
69
68
|
remove(): void;
|
|
70
69
|
detach(force?: boolean): Promise<void>;
|
|
71
70
|
close(): Promise<void>;
|
|
@@ -78,22 +77,26 @@ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V =
|
|
|
78
77
|
set parent(value: ObjectMap<IDbPool<T>>);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
|
|
81
|
+
CACHE_UNUSED: readonly string[];
|
|
82
|
+
asString(credential: unknown): string;
|
|
83
|
+
sanitize(credential: unknown): unknown;
|
|
84
|
+
removeUUIDKey<X>(credential: X & IdentifierAction): X;
|
|
85
|
+
findKey<X extends IDbPool, Y extends DbDataSource>(pools: ObjectMap<X>, uuidKey: unknown, poolKey: string | undefined, ...items: Y[]): X | null;
|
|
86
|
+
validateKey<X extends IDbPool>(pools: ObjectMap<X>, username: string, uuidKey: unknown): [string, X | null];
|
|
87
|
+
checkTimeout<X extends IDbPool>(pools: ObjectMap<X>, value: number, limit?: number): Promise<number>;
|
|
88
|
+
readonly prototype: IDbPool<T, U, V, W>;
|
|
89
|
+
new(pool: U, poolKey: string, uuidKey?: AuthValue | null): IDbPool<T, U, V, W>;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
export interface TimeoutAction {
|
|
90
|
-
timeout?:
|
|
93
|
+
timeout?: number | string;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
export type DbSource = "mariadb" | "mongodb" | "mssql" | "mysql" | "oracle" | "postgres" | "redis";
|
|
94
97
|
export type QueryResult = unknown[];
|
|
95
|
-
export type BatchQueryResult =
|
|
96
|
-
export type CheckObjectCallback = (item: DataSource, data: unknown) =>
|
|
98
|
+
export type BatchQueryResult = QueryResult | null[];
|
|
99
|
+
export type CheckObjectCallback = (item: DataSource, data: unknown) => QueryResult | null;
|
|
97
100
|
export type ErrorQueryCallback = (err: unknown, item: DbDataSource, commandType?: number) => boolean;
|
|
98
101
|
|
|
99
102
|
export interface SQL_COMMAND {
|
package/lib/document.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { LogComponent, LogDate } from './logger';
|
|
|
7
7
|
import type { DocumentTransform } from './settings';
|
|
8
8
|
|
|
9
9
|
export interface DocumentAsset extends ExternalAsset, StorageAction<CloudStorage> {
|
|
10
|
+
inlineFilename?: string;
|
|
10
11
|
initialValue?: InitialValue & { inlineFilename?: string };
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -15,7 +16,7 @@ export interface StartOfSourceMap {
|
|
|
15
16
|
sourceRoot?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export interface RawSourceMap<T =
|
|
19
|
+
export interface RawSourceMap<T = number | string> extends StartOfSourceMap {
|
|
19
20
|
version: T;
|
|
20
21
|
sources: string[];
|
|
21
22
|
names: string[];
|
|
@@ -59,7 +60,7 @@ export interface TransformAction {
|
|
|
59
60
|
|
|
60
61
|
export interface TransformResult extends SourceCode {
|
|
61
62
|
type?: string;
|
|
62
|
-
chunks?:
|
|
63
|
+
chunks?: Array<SourceCode & ChunkFile> | null;
|
|
63
64
|
sourceFiles?: string[];
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -69,8 +70,8 @@ export interface TransformOutput extends Partial<LocationUri>, Omit<SourceInput<
|
|
|
69
70
|
metadata?: unknown;
|
|
70
71
|
external?: PlainObject;
|
|
71
72
|
productionRelease?: boolean;
|
|
72
|
-
getMainFile?(code?: string, imports?: StringMap):
|
|
73
|
-
getSourceFiles?(imports?: StringMap):
|
|
73
|
+
getMainFile?(code?: string, imports?: StringMap): SourceInput<string> | undefined;
|
|
74
|
+
getSourceFiles?(imports?: StringMap): SourceInput | undefined;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
export interface TransformOptions<T = AnyObject, U = T> extends TransformOutput {
|
|
@@ -85,10 +86,11 @@ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, Transfo
|
|
|
85
86
|
init(instance: IModule, dirname?: string): this;
|
|
86
87
|
close(instance: IModule): void;
|
|
87
88
|
createSourceMap(value: string): SourceMap;
|
|
88
|
-
getMainFile(code?: string, imports?: StringMap):
|
|
89
|
-
getSourceFiles(imports?: StringMap):
|
|
89
|
+
getMainFile(code?: string, imports?: StringMap): SourceInput<string> | undefined;
|
|
90
|
+
getSourceFiles(imports?: StringMap): SourceInput | undefined;
|
|
90
91
|
toBaseConfig(all?: boolean): T;
|
|
91
|
-
upgrade<V = unknown>(context: V, dirname?: string,
|
|
92
|
+
upgrade<V = unknown>(context: V, dirname?: string, pkgname?: string): V;
|
|
93
|
+
upgradeESM<V = unknown>(context: V, dirname?: string, pkgname?: string): Promise<V>;
|
|
92
94
|
set code(value);
|
|
93
95
|
get code(): string;
|
|
94
96
|
get out(): IOut;
|
|
@@ -136,12 +138,12 @@ export interface SourceMap extends SourceCode {
|
|
|
136
138
|
reset(): void;
|
|
137
139
|
nextMap(name: string, code: string, map: unknown, sourceMappingURL?: string, emptySources?: boolean): boolean;
|
|
138
140
|
set map(value);
|
|
139
|
-
get map():
|
|
141
|
+
get map(): RawSourceMap | undefined;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
export interface SourceMapConstructor {
|
|
143
|
-
findSourceMap(code?: string, uri?: string):
|
|
144
|
-
removeSourceMappingURL(value: string): [string, string?,
|
|
145
|
+
findSourceMap(code?: string, uri?: string): RawSourceMap | undefined;
|
|
146
|
+
removeSourceMappingURL(value: string): [string, string?, (RawSourceMap | null)?];
|
|
145
147
|
isRaw(map: unknown): map is RawSourceMap;
|
|
146
148
|
readonly prototype: SourceMap;
|
|
147
149
|
new(code: string, remove: boolean): SourceMap;
|
|
@@ -174,8 +176,8 @@ export interface LintMessage {
|
|
|
174
176
|
export interface GenerateLintTableOptions extends Partial<LocationUri> {
|
|
175
177
|
leadingText?: string;
|
|
176
178
|
trailingText?: string;
|
|
177
|
-
errorCount?: number;
|
|
178
|
-
warningCount?: number;
|
|
179
|
+
errorCount?: number | [number, number];
|
|
180
|
+
warningCount?: number | [number, number];
|
|
179
181
|
fatalErrorCount?: number;
|
|
180
182
|
timeStamp?: LogDate;
|
|
181
183
|
ruleWidth?: number;
|
|
@@ -188,11 +190,10 @@ export interface CustomizeOptions {
|
|
|
188
190
|
|
|
189
191
|
export interface AsSourceFileOptions {
|
|
190
192
|
encoding?: BufferEncoding;
|
|
191
|
-
persist?: boolean;
|
|
192
193
|
cache?: boolean;
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
export type Transformer = FunctionType<
|
|
196
|
+
export type Transformer = FunctionType<Promise<string> | string> | undefined;
|
|
196
197
|
export type ConfigOrTransformer = AnyObject | Transformer;
|
|
197
|
-
export type PluginConfig = [string,
|
|
198
|
-
export type TransformCallback<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument<T, U>, requireOrDocumentDir?: NodeJS.Require | string) =>
|
|
198
|
+
export type PluginConfig = [string, ConfigOrTransformer | undefined, AnyObject | undefined, boolean?] | [];
|
|
199
|
+
export type TransformCallback<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument<T, U>, requireOrDocumentDir?: NodeJS.Require | string) => Promise<void >;
|
package/lib/filemanager.d.ts
CHANGED
|
@@ -10,13 +10,13 @@ import type { RequestInit } from './request';
|
|
|
10
10
|
import type { FETCH_TYPE } from '../index.d';
|
|
11
11
|
|
|
12
12
|
export const enum FINALIZE_STATE {
|
|
13
|
-
READY
|
|
14
|
-
COMMIT
|
|
15
|
-
END
|
|
16
|
-
RESTART
|
|
17
|
-
QUEUED
|
|
18
|
-
RESTARTED
|
|
19
|
-
ABORTED
|
|
13
|
+
READY,
|
|
14
|
+
COMMIT,
|
|
15
|
+
END,
|
|
16
|
+
RESTART,
|
|
17
|
+
QUEUED,
|
|
18
|
+
RESTARTED,
|
|
19
|
+
ABORTED
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const enum INCREMENTAL {
|
|
@@ -26,8 +26,8 @@ export const enum INCREMENTAL {
|
|
|
26
26
|
EXISTS = 'exists'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export interface RequestData<T extends ExternalAsset = ExternalAsset> extends IRequestData<T>, RequestInit {
|
|
30
|
-
timeout?: ObjectMap<
|
|
29
|
+
export interface RequestData<T extends ExternalAsset = ExternalAsset, U extends HostInitLog = HostInitLog> extends IRequestData<T, U>, RequestInit {
|
|
30
|
+
timeout?: ObjectMap<number | string>;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface InstallData<T extends IModule = IModule, U extends ModuleConstructor = ModuleConstructor> {
|
|
@@ -53,14 +53,14 @@ export interface IHttpDiskCache<T extends ExternalAsset = ExternalAsset> {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface IHttpMemoryCache<T extends ExternalAsset = ExternalAsset> extends IHttpDiskCache<T> {
|
|
56
|
-
toDisk:
|
|
56
|
+
toDisk: [number, number];
|
|
57
57
|
purge(percent?: number, limit?: number): void;
|
|
58
58
|
withinDisk(value: T | number): boolean;
|
|
59
59
|
clear(uri?: string | URL): void;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export interface HttpDiskCacheAddOptions {
|
|
63
|
-
buffer?:
|
|
63
|
+
buffer?: Bufferable | null;
|
|
64
64
|
contentLength?: number;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -99,6 +99,7 @@ export interface DeleteFileAddendum {
|
|
|
99
99
|
export interface HostInitLog extends IHostInitLog {
|
|
100
100
|
useNumeric: boolean;
|
|
101
101
|
showSize?: boolean;
|
|
102
|
+
showDiff?: string[];
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
|
package/lib/http.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { LookupAddress } from 'dns';
|
|
2
|
-
import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'http';
|
|
3
|
-
import type { Agent as HttpsAgent } from 'https';
|
|
4
|
-
import type { ClientHttp2Stream } from 'http2';
|
|
5
|
-
import type { SecureVersion } from 'tls';
|
|
1
|
+
import type { LookupAddress } from 'node:dns';
|
|
2
|
+
import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
3
|
+
import type { Agent as HttpsAgent } from 'node:https';
|
|
4
|
+
import type { ClientHttp2Stream } from 'node:http2';
|
|
5
|
+
import type { SecureVersion } from 'node:tls';
|
|
6
6
|
|
|
7
7
|
export const enum HTTP_STATUS {
|
|
8
8
|
CONTINUE = 100,
|
|
@@ -93,10 +93,11 @@ export interface SecureConfig<T = string, U = T> {
|
|
|
93
93
|
key?: U;
|
|
94
94
|
cert?: T;
|
|
95
95
|
passphrase?: U;
|
|
96
|
+
ciphers?: string;
|
|
96
97
|
version?: SecureVersion;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
export interface ServerPort<T =
|
|
100
|
+
export interface ServerPort<T = number | string> {
|
|
100
101
|
port?: T;
|
|
101
102
|
}
|
|
102
103
|
|
package/lib/image.d.ts
CHANGED
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
import type { MimeTypeAction } from './squared';
|
|
2
|
-
|
|
3
|
-
import type { BroadcastValue, LogTime } from './logger';
|
|
4
|
-
import type { ImageModule } from './settings';
|
|
5
|
-
|
|
6
|
-
export interface CommandData {
|
|
7
|
-
resize?: ResizeData;
|
|
8
|
-
crop?: CropData;
|
|
9
|
-
rotate?: RotateData;
|
|
10
|
-
quality?: QualityData;
|
|
11
|
-
method?: MethodData;
|
|
12
|
-
opacity?: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface RotateData {
|
|
16
|
-
values: number[];
|
|
17
|
-
color: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ResizeData extends Dimension {
|
|
21
|
-
mode: string;
|
|
22
|
-
color: number;
|
|
23
|
-
align:
|
|
24
|
-
algorithm?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface CropData extends Point, Dimension {}
|
|
28
|
-
|
|
29
|
-
export interface QualityData {
|
|
30
|
-
value: number;
|
|
31
|
-
nearLossless: number;
|
|
32
|
-
method: number;
|
|
33
|
-
preset?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface TransformOptions extends MimeTypeAction {
|
|
37
|
-
tempFile?: boolean;
|
|
38
|
-
startTime?: LogTime;
|
|
39
|
-
module?: ImageModule;
|
|
40
|
-
broadcastId?: BroadcastValue;
|
|
41
|
-
cache?: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
1
|
+
import type { MimeTypeAction } from './squared';
|
|
2
|
+
|
|
3
|
+
import type { BroadcastValue, LogTime } from './logger';
|
|
4
|
+
import type { ImageModule } from './settings';
|
|
5
|
+
|
|
6
|
+
export interface CommandData {
|
|
7
|
+
resize?: ResizeData | null;
|
|
8
|
+
crop?: CropData | null;
|
|
9
|
+
rotate?: RotateData | null;
|
|
10
|
+
quality?: QualityData | null;
|
|
11
|
+
method?: MethodData | null;
|
|
12
|
+
opacity?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RotateData {
|
|
16
|
+
values: number[];
|
|
17
|
+
color: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ResizeData extends Dimension {
|
|
21
|
+
mode: string;
|
|
22
|
+
color: number;
|
|
23
|
+
align: [string | undefined, string | undefined];
|
|
24
|
+
algorithm?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CropData extends Point, Dimension {}
|
|
28
|
+
|
|
29
|
+
export interface QualityData {
|
|
30
|
+
value: number;
|
|
31
|
+
nearLossless: number;
|
|
32
|
+
method: number;
|
|
33
|
+
preset?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TransformOptions extends MimeTypeAction {
|
|
37
|
+
tempFile?: boolean;
|
|
38
|
+
startTime?: LogTime;
|
|
39
|
+
module?: ImageModule;
|
|
40
|
+
broadcastId?: BroadcastValue;
|
|
41
|
+
cache?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Point {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface Dimension {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
export type MethodData = [string, unknown[]?][];
|