@e-mc/types 0.9.6 → 0.10.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/lib/asset.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface BinaryAction {
15
15
  }
16
16
 
17
17
  export interface StreamAction {
18
- minStreamSize?: NumString;
18
+ minStreamSize?: number | string;
19
19
  }
20
20
 
21
21
  export interface FileData<T extends ExternalAsset> extends MimeTypeAction {
@@ -74,4 +74,4 @@ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, St
74
74
  invalid?: boolean;
75
75
  }
76
76
 
77
- export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512";
77
+ export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512" | "ripemd" | "ripemd-160";
package/lib/cloud.d.ts CHANGED
@@ -43,7 +43,7 @@ export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unk
43
43
  export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends Partial<LocationUri>, StreamAction {
44
44
  active?: boolean;
45
45
  overwrite?: boolean;
46
- chunkSize?: NumString;
46
+ chunkSize?: number | string;
47
47
  chunkLimit?: number;
48
48
  flags?: number;
49
49
  admin?: CloudStorageAdmin<T, U, V, W, X, Y>;
@@ -1,12 +1,13 @@
1
1
  import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IModule, ModuleConstructor, WatchConstructor } from './index';
2
2
 
3
+ import type { CloneObjectOptions } from '../index.d';
3
4
  import type { ExternalAsset } from './asset';
4
5
  import type { CacheOptions } from './core';
5
6
  import type { QueryResult } from './db';
6
7
  import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
7
8
  import type { IHttpMemoryCache } from './filemanager';
8
9
  import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
9
- import type { CloneObjectOptions, GetFunctionsOptions } from './module';
10
+ import type { ParseFunctionOptions } from './module';
10
11
  import type { LogFailOptions, LogType, LogValue } from './logger';
11
12
  import type { HostConfig, OpenOptions, ProxySettings } from './request';
12
13
  import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
@@ -17,6 +18,10 @@ import type { Readable, Writable } from 'stream';
17
18
 
18
19
  type CpuUsage = NodeJS.CpuUsage;
19
20
 
21
+ export interface GetFunctionsOptions extends ParseFunctionOptions {
22
+ outFailed?: string[];
23
+ }
24
+
20
25
  export interface IModuleLibV4 {
21
26
  isString(value: unknown): value is string;
22
27
  isObject<T = object>(value: unknown): value is T;
@@ -30,12 +35,12 @@ export interface IModuleLibV4 {
30
35
  isFileHTTP(value: string | URL): boolean;
31
36
  isFileUNC(value: string | URL): boolean;
32
37
  isPathUNC(value: string | URL): boolean;
33
- toTimeMs(hrtime: HighResolutionTime, format?: boolean): NumString;
38
+ toTimeMs(hrtime: HighResolutionTime, format?: boolean): number | string;
34
39
  renameExt(value: string, ext: string, when?: string): string;
35
40
  existsSafe(value: string, isFile?: boolean): boolean;
36
41
  readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<Bufferable>;
37
42
  getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
38
- formatSize(value: NumString, options?: PlainObject): NumString;
43
+ formatSize(value: number | string, options?: PlainObject): number | string;
39
44
  hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
40
45
  hasSize(value: string, keepEmpty?: boolean): boolean;
41
46
  getSize(value: string, diskUsed?: boolean): number;
@@ -62,7 +67,7 @@ export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> e
62
67
  httpProxy: Null<ProxySettings>;
63
68
  acceptEncoding: boolean;
64
69
  keepAliveTimeout: number;
65
- addDns(hostname: string, address: string, family?: NumString): void;
70
+ addDns(hostname: string, address: string, family?: number | string): void;
66
71
  lookupDns(hostname: string): LookupFunction;
67
72
  getHttpProxy(uri: string, localhost?: boolean): Null<ProxySettings>;
68
73
  getHttpHeaders(uri: string): Undef<OutgoingHttpHeaders>;
@@ -75,7 +80,7 @@ export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> e
75
80
  }
76
81
 
77
82
  export interface FileManagerCompatV4Constructor<T extends ExternalAsset = ExternalAsset> extends FileManagerConstructor<T> {
78
- fromHttpStatusCode(value: NumString): string;
83
+ fromHttpStatusCode(value: number | string): string;
79
84
  resetHttpHost(version?: HttpProtocolVersion): void;
80
85
  defineHttpBuffer(options: HttpMemorySettings): void;
81
86
  defineHttpSettings(options: HttpSettings): void;
@@ -105,7 +110,7 @@ export interface WatchCompatV4Constructor<T extends IFileManager<U>, U extends E
105
110
  readTLSKey(value: string, cache?: boolean): string;
106
111
  readTLSCert(value: string, cache?: boolean): string;
107
112
  isCert(value: string): boolean;
108
- parseExpires(value: NumString, start?: number): number;
113
+ parseExpires(value: number | string, start?: number): number;
109
114
  }
110
115
 
111
116
  export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransformSeries<T, U>, PropertyAction<OutV3, "out"> {}
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
6
  type ResultCallback<T = Null<Buffer | Uint8Array>> = (err: unknown, data?: T, ext?: string) => void;
6
7
  type ResultData = Null<Buffer | Uint8Array> | string;
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 Woff {
18
- toWoff(this: void, data: BufferLike): Buffer;
19
- toSfnt(this: void, data: BufferLike): Buffer;
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
23
  export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?: ResultCallback<ResultData>) => Void<Promise<ResultData>>;
24
24
  export type TryFileCompressorAsync = (data: string | Buffer, output: string, config: CompressFormat) => Promise<ResultData>;
25
- export type BufferResult = Null<Buffer | Uint8Array>;
25
+ export type BufferResult = Null<Buffer | Uint8Array>;
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';
@@ -42,6 +40,7 @@ export interface IClientDb<T extends IHost, U extends ClientModule<ClientDbSetti
42
40
  getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean): Undef<QueryResult>;
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;
43
+ getCacheResult(source: string, credential: unknown, queryString: string, cacheValue: CacheOptions, ignoreCache?: IntBool | FirstOf<number, number>): Undef<QueryResult>;
45
44
  applyState(items: ArrayOf<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;
@@ -62,8 +61,8 @@ 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: Undef<NumString | TimeoutAction>): number;
66
- convertTime(value: NumString): number;
64
+ getTimeout(value: Undef<number | string | TimeoutAction>): number;
65
+ convertTime(value: number | string): number;
67
66
  findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): Undef<QueryResult>;
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;
@@ -131,16 +130,17 @@ export interface PermissionAction {
131
130
  permission?: PermittedDirectories;
132
131
  }
133
132
 
134
- export interface HostInitConfig extends PlainObject, RequestBase<HostInitLog> {
133
+ export interface HostInitConfig<T extends HostInitLog = HostInitLog> extends PlainObject, RequestBase<T> {
135
134
  username?: string;
136
135
  ignoreModules?: string[];
137
136
  }
138
137
 
139
138
  export interface HostInitLog {
140
139
  enabled?: boolean;
141
- level?: NumString;
140
+ level?: number | string;
142
141
  exclude?: ArrayOf<string>;
143
142
  useColor?: boolean;
143
+ silent?: boolean;
144
144
  showProgress?: boolean;
145
145
  }
146
146
 
@@ -158,7 +158,7 @@ export interface StoreResultOptions {
158
158
  export interface CacheOptions {
159
159
  value?: DbCacheValue;
160
160
  renewCache?: boolean;
161
- exclusiveOf?: [number, number?, number?];
161
+ exclusiveOf?: FirstOf<number, number>;
162
162
  sessionKey?: string;
163
163
  }
164
164
 
package/lib/db.d.ts CHANGED
@@ -56,7 +56,7 @@ export interface ServerAuth<T = number> extends AuthValue, IdentifierAction {
56
56
  database?: string;
57
57
  }
58
58
 
59
- export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
59
+ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
60
60
  client: U;
61
61
  lastAccessed: number;
62
62
  success: number;
@@ -65,7 +65,7 @@ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V =
65
65
  uuidKey: Null<AuthValue>;
66
66
  add(item: T, uuidKey?: string): this;
67
67
  has(item: T): boolean;
68
- getConnection(): Promise<V>;
68
+ getConnection(credential?: W): Promise<V>;
69
69
  remove(): void;
70
70
  detach(force?: boolean): Promise<void>;
71
71
  close(): Promise<void>;
@@ -78,16 +78,20 @@ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V =
78
78
  set parent(value: ObjectMap<IDbPool<T>>);
79
79
  }
80
80
 
81
- export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
82
- findKey<W extends IDbPool, X extends DbDataSource>(pools: ObjectMap<W>, uuidKey: unknown, poolKey: Undef<string>, ...items: X[]): Null<W>;
83
- validateKey<W extends IDbPool>(pools: ObjectMap<W>, username: string, uuidKey: unknown): [string, Null<W>];
84
- checkTimeout<W extends IDbPool>(pools: ObjectMap<W>, value: number, limit?: number): Promise<number>;
85
- readonly prototype: IDbPool<T, U, V>;
86
- new(pool: U, poolKey: string, uuidKey?: Null<AuthValue>): IDbPool<T, U, V>;
81
+ export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
82
+ CACHE_UNUSED: readonly string[];
83
+ asString(credential: unknown): string;
84
+ sanitize(credential: unknown): unknown;
85
+ removeUUIDKey<X>(credential: X & IdentifierAction): X;
86
+ findKey<X extends IDbPool, Y extends DbDataSource>(pools: ObjectMap<X>, uuidKey: unknown, poolKey: Undef<string>, ...items: Y[]): Null<X>;
87
+ validateKey<X extends IDbPool>(pools: ObjectMap<X>, username: string, uuidKey: unknown): [string, Null<X>];
88
+ checkTimeout<X extends IDbPool>(pools: ObjectMap<X>, value: number, limit?: number): Promise<number>;
89
+ readonly prototype: IDbPool<T, U, V, W>;
90
+ new(pool: U, poolKey: string, uuidKey?: Null<AuthValue>): IDbPool<T, U, V, W>;
87
91
  }
88
92
 
89
93
  export interface TimeoutAction {
90
- timeout?: NumString;
94
+ timeout?: number | string;
91
95
  }
92
96
 
93
97
  export type DbSource = "mariadb" | "mongodb" | "mssql" | "mysql" | "oracle" | "postgres" | "redis";
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 = NumString> extends StartOfSourceMap {
19
+ export interface RawSourceMap<T = number | string> extends StartOfSourceMap {
19
20
  version: T;
20
21
  sources: string[];
21
22
  names: string[];
@@ -88,7 +89,8 @@ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, Transfo
88
89
  getMainFile(code?: string, imports?: StringMap): Undef<SourceInput<string>>;
89
90
  getSourceFiles(imports?: StringMap): Undef<SourceInput>;
90
91
  toBaseConfig(all?: boolean): T;
91
- upgrade<V = unknown>(context: V, dirname?: string, name?: string): V;
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;
@@ -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 | TupleOf<number>;
180
+ warningCount?: number | TupleOf<number>;
179
181
  fatalErrorCount?: number;
180
182
  timeStamp?: LogDate;
181
183
  ruleWidth?: number;
@@ -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 = 0,
14
- COMMIT = 1,
15
- END = 2,
16
- RESTART = 3,
17
- QUEUED = 4,
18
- RESTARTED = 5,
19
- ABORTED = 6
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<NumString>;
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> {
@@ -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
@@ -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 = NumString> {
100
+ export interface ServerPort<T = number | string> {
100
101
  port?: T;
101
102
  }
102
103
 
package/lib/index.d.ts CHANGED
@@ -1,13 +1,11 @@
1
- /* eslint @typescript-eslint/no-explicit-any: "off" */
2
-
3
1
  /// <reference path="type.d.ts" />
4
2
  /// <reference path="object.d.ts" />
5
3
 
6
- import type { CompressLevel, DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
4
+ import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
7
5
 
8
6
  import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
9
7
  import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, UploadAssetOptions } from './cloud';
10
- import type { BufferResult, CompressFormat, TryFileCompressor } from './compress';
8
+ import type { BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
11
9
  import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
12
10
  import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
13
11
  import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
@@ -15,7 +13,7 @@ import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutp
15
13
  import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
16
14
  import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
17
15
  import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
18
- import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, WriteFileOptions } from './module';
16
+ import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, FileTypeFormat, MoveFileOptions, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, TempDirOptions, WriteFileOptions } from './module';
19
17
  import type { RequestData, Settings } from './node';
20
18
  import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
21
19
  import type { ClientModule, CloudAuthSettings, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HandlerSettings, HttpConnectSettings, HttpMemorySettings, ImageModule, LoggerFormat, LoggerFormatSettings, PoolConfig, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
@@ -23,7 +21,7 @@ import type { Command, SpawnResult } from './task';
23
21
  import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
24
22
 
25
23
  import type { SpawnOptions } from 'child_process';
26
- import type { BinaryLike } from 'crypto';
24
+ import type { BinaryLike, BinaryToTextEncoding, HashOptions } from 'crypto';
27
25
  import type { NoParamCallback, WriteStream } from 'fs';
28
26
  import type { ClientRequest, OutgoingHttpHeaders } from 'http';
29
27
  import type { LookupFunction } from 'net';
@@ -42,6 +40,7 @@ type CpuUsage = NodeJS.CpuUsage;
42
40
 
43
41
  declare namespace functions {
44
42
  type WatchInstance<T extends ExternalAsset, U extends WatchModule = WatchModule> = IWatch<IFileManager<T>, T, U, ModifiedPostFinalizeListener<T>>;
43
+ type FormatMessageArgs = [type: LogType, title: string, value: LogValue, message: unknown, options: LogMessageOptions];
45
44
 
46
45
  interface IScopeOrigin<T extends IHost = IHost, U extends IModule = IModule> {
47
46
  host?: T;
@@ -59,13 +58,12 @@ declare namespace functions {
59
58
  get extensions(): T[];
60
59
  }
61
60
 
62
- interface ICompress<T extends CompressModule<U>, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
61
+ interface ICompress<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
63
62
  level: ObjectMap<number>;
64
63
  compressors: ObjectMap<TryFileCompressor>;
65
- chunkSize?: number;
66
64
  register(format: string, callback: TryFileCompressor): void;
67
65
  getLevel(value: string, fallback?: number): Undef<number>;
68
- getReadable(file: string | URL | Buffer): Readable;
66
+ getReadable(file: string | URL | Buffer, options?: ReadableOptions): Readable;
69
67
  createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
70
68
  createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
71
69
  createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
@@ -76,10 +74,12 @@ declare namespace functions {
76
74
  tryFile(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
77
75
  tryImage(file: string, options: CompressFormat): Promise<BufferResult>;
78
76
  tryImage(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
77
+ set chunkSize(value: Undef<number | string>);
78
+ get chunkSize(): Undef<number>;
79
79
  }
80
80
 
81
- interface CompressConstructor<T extends CompressModule<U> = CompressModule<any>, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
82
- singleton(): ICompress<CompressModule>;
81
+ interface CompressConstructor<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
82
+ singleton(): ICompress<T, U>;
83
83
  readonly prototype: ICompress<T, U>;
84
84
  new(module?: U): ICompress<T, U>;
85
85
  }
@@ -198,10 +198,10 @@ declare namespace functions {
198
198
  LOG_CLOUD_DOWNLOAD: LogMessageOptions;
199
199
  LOG_CLOUD_DELETE: LogMessageOptions;
200
200
  LOG_CLOUD_DELAYED: LogMessageOptions;
201
- finalize(this: T, instance: ICloud<T, U, V>): Promise<unknown>;
202
- uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, options: UploadAssetOptions): Promise<unknown>[];
203
- uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<unknown>[];
204
- uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string | boolean | UploadAssetOptions, ignoreProcess?: boolean): Promise<unknown>[];
201
+ finalize(this: T, instance: ICloud<T, U, V>): Promise<void>;
202
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, options: UploadAssetOptions): Promise<void>[];
203
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<void>[];
204
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string | boolean | UploadAssetOptions, ignoreProcess?: boolean): Promise<void>[];
205
205
  sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
206
206
  readonly prototype: ICloud<T, U, V>;
207
207
  new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
@@ -264,7 +264,7 @@ declare namespace functions {
264
264
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
265
265
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
266
266
  cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
267
- sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
267
+ sanitizeAssets?(assets: U[], exclusions?: unknown[]): U[];
268
268
  readonly prototype: IDocument<T, U, V, W, X, Y>;
269
269
  new(module?: V, ...args: unknown[]): IDocument<T, U, V, W, X, Y>;
270
270
  }
@@ -295,14 +295,14 @@ declare namespace functions {
295
295
  createServer(port: number, active: boolean): Null<ws.Server>;
296
296
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
297
297
  shutdown(): void;
298
- setTimeout(value: NumString): void;
298
+ setTimeout(value: number | string): void;
299
299
  checkTimeout(client: ws): boolean;
300
300
  readonly prototype: IWatch<T, U, V, W>;
301
301
  new(module?: V): IWatch<T, U, V, W>;
302
302
  new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
303
303
  }
304
304
 
305
- interface IRequest<T extends RequestModule<U>, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
305
+ interface IRequest<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
306
306
  startTime: number;
307
307
  acceptEncoding: boolean;
308
308
  keepAlive: Null<boolean>;
@@ -312,7 +312,7 @@ declare namespace functions {
312
312
  init(config?: RequestInit): this;
313
313
  apply(options: ApplyOptions): this;
314
314
  addDns(hostname: string, address: string, timeout: number): void;
315
- addDns(hostname: string, address: string, family?: NumString, timeout?: number): void;
315
+ addDns(hostname: string, address: string, family?: number | string, timeout?: number): void;
316
316
  lookupDns(hostname: string): LookupFunction;
317
317
  proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
318
318
  statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
@@ -344,13 +344,13 @@ declare namespace functions {
344
344
  get ipVersion(): InternetProtocolVersion;
345
345
  }
346
346
 
347
- interface RequestConstructor<T extends RequestModule<U> = RequestModule<any>, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
347
+ interface RequestConstructor<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
348
348
  readCACert(value: string, cache?: boolean): string;
349
349
  readTLSKey(value: string, cache?: boolean): string;
350
350
  readTLSCert(value: string, cache?: boolean): string;
351
351
  isCert(value: string): boolean;
352
352
  fromURL(url: URL, value: string): string;
353
- fromStatusCode(value: NumString): string;
353
+ fromStatusCode(value: number | string): string;
354
354
  defineHttpAgent(options: HttpAgentSettings): void;
355
355
  defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
356
356
  getAria2Path(): string;
@@ -362,13 +362,13 @@ declare namespace functions {
362
362
  processTimeout: number;
363
363
  cacheToDisk: IHttpDiskCache<T>;
364
364
  cacheToMemory: IHttpMemoryCache<T>;
365
- Request: IRequest<RequestModule>;
365
+ Request: IRequest;
366
366
  Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
367
367
  Task: InstallData<ITask, TaskConstructor>[];
368
368
  Image: Null<ImageMimeMap>;
369
369
  Cloud: Null<ICloud>;
370
370
  Watch: Null<WatchInstance<T>>;
371
- Compress: Null<ICompress<CompressModule>>;
371
+ Compress: Null<ICompress>;
372
372
  readonly documentAssets: T[];
373
373
  readonly taskAssets: (T & Required<TaskAction>)[];
374
374
  readonly dataSourceItems: DataSource[];
@@ -392,8 +392,8 @@ declare namespace functions {
392
392
  install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
393
393
  install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
394
394
  install(name: "watch", module: WatchModule): Undef<WatchInstance<T>>;
395
- install(name: "watch", interval?: NumString, port?: NumString, securePort?: NumString, extensions?: unknown[]): Undef<WatchInstance<T>>;
396
- install(name: "compress", module?: CompressModule): Undef<ICompress<CompressModule>>;
395
+ install(name: "watch", interval?: number | string, port?: number | string, securePort?: number | string, extensions?: unknown[]): Undef<WatchInstance<T>>;
396
+ install(name: "compress", module?: CompressModule): Undef<ICompress>;
397
397
  install(name: string, ...args: unknown[]): Undef<IModule>;
398
398
  using(...items: FirstOf<T>): this;
399
399
  contains(item: T, condition?: FunctionArgs<[T], boolean>): boolean;
@@ -410,6 +410,7 @@ declare namespace functions {
410
410
  hasDocument(instance: IModule, document: Undef<ArrayOf<string>>): boolean;
411
411
  getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
412
412
  getDataSourceItems(instance: IModule, condition?: FunctionArgs<[DataSource], boolean>): DataSource[];
413
+ checkFilename(file: T, pathname?: string): string;
413
414
  setLocalUri(file: T, replace?: boolean): FileOutput;
414
415
  getLocalUri(data: FileData<T>): string;
415
416
  getMimeType(data: FileData<T>): string;
@@ -441,7 +442,7 @@ declare namespace functions {
441
442
  fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
442
443
  fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
443
444
  fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
444
- updateProgress(name: "request", id: NumString, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
445
+ updateProgress(name: "request", id: number | string, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
445
446
  start(emptyDir?: boolean): Promise<FinalizeResult>;
446
447
  processAssets(emptyDir?: boolean, using?: T[]): void;
447
448
  deleteFile<U extends Promise<void>>(src: string, promises: boolean): U;
@@ -450,11 +451,12 @@ declare namespace functions {
450
451
  deleteFile<U extends NoParamCallback>(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: U): unknown;
451
452
  restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
452
453
  restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
453
- finalizeCompress(assets: T[]): Promise<unknown>;
454
- finalizeDocument(): Promise<unknown>;
455
- finalizeTask(assets: (T & Required<TaskAction>)[]): Promise<unknown>;
456
- finalizeCloud(): Promise<unknown>;
457
- finalizeCleanup(): Promise<unknown>;
454
+ finalizeCompress(assets: T[]): Promise<void>;
455
+ finalizeDocument(): Promise<void>;
456
+ finalizeTask(assets: (T & Required<TaskAction>)[]): Promise<void>;
457
+ finalizeCloud(): Promise<void>;
458
+ finalizeChecksum(): Promise<void>;
459
+ finalizeCleanup(): Promise<void>;
458
460
  finalize(): Promise<void>;
459
461
  close(): void;
460
462
  reset(): boolean;
@@ -518,7 +520,7 @@ declare namespace functions {
518
520
  verifyChecksum(root: string, options: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
519
521
  verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
520
522
  createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
521
- setTimeout(options: ObjectMap<NumString>): void;
523
+ setTimeout(options: ObjectMap<number | string>): void;
522
524
  defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
523
525
  defineHttpConnect(options: HttpConnectSettings): void;
524
526
  readonly prototype: IFileManager<T>;
@@ -538,8 +540,8 @@ declare namespace functions {
538
540
  willLog(name: string): boolean;
539
541
  ignoreLog(values: boolean | ArrayOf<string>): void;
540
542
  collectLog(level?: boolean): LogStatus<StatusType>[];
541
- pauseLog(): void;
542
- resumeLog(): void;
543
+ pauseLog(type?: string): void;
544
+ resumeLog(type?: string): void;
543
545
  hasLog(type: string): boolean;
544
546
  delayMessage(...args: unknown[]): void;
545
547
  willAbort(value: string | IModule): boolean;
@@ -571,6 +573,7 @@ declare namespace functions {
571
573
  getThreadCount(full: true): ThreadCountStat;
572
574
  getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
573
575
  getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
576
+ getLogDelayed(): FormatMessageArgs[];
574
577
  getPermissionFromSettings(): IPermission;
575
578
  readonly prototype: IHost;
576
579
  new(config?: HostInitConfig): IHost;
@@ -579,10 +582,9 @@ declare namespace functions {
579
582
  interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
580
583
  readonly status: LogStatus<StatusType>[];
581
584
  readonly errors: unknown[];
582
- /** @deprecated */
583
585
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
584
586
  supports(name: string, value?: boolean): boolean;
585
- getTempDir(options: GetTempDirOptions): string;
587
+ getTempDir(options: TempDirOptions): string;
586
588
  getTempDir(uuidDir: boolean, createDir: boolean): string;
587
589
  getTempDir(pathname: string, createDir: boolean): string;
588
590
  getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
@@ -590,7 +592,7 @@ declare namespace functions {
590
592
  canRead(uri: string | URL, options?: PermissionOptions): boolean;
591
593
  canWrite(uri: string | URL, options?: PermissionOptions): boolean;
592
594
  readFile(src: string | URL): Undef<Buffer>;
593
- readFile<U extends ReadFileOptions>(src: string | URL, options?: U): Undef<U extends { encoding: string } ? U extends { minStreamSize: NumString } ? Promise<string> : string : U extends { minStreamSize: NumString } ? Promise<Buffer> : Buffer>;
595
+ readFile<U extends ReadFileOptions>(src: string | URL, options?: U): Undef<U extends { encoding: string } ? U extends { minStreamSize: number | string } ? Promise<string> : string : U extends { minStreamSize: number | string } ? Promise<Buffer> : Buffer>;
594
596
  readFile<U extends Buffer>(src: string | URL, promises: true): Promise<Undef<U>>;
595
597
  readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
596
598
  readFile<U extends ReadFileCallback>(src: string | URL, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : Bufferable>;
@@ -665,8 +667,10 @@ declare namespace functions {
665
667
  get sessionId(): string;
666
668
  set broadcastId(value);
667
669
  get broadcastId(): ArrayOf<string>;
670
+ set silent(value);
671
+ get silent(): boolean;
668
672
  get logType(): LOG_TYPE;
669
- set logLevel(value: NumString);
673
+ set logLevel(value: number | string);
670
674
  get logLevel(): number;
671
675
  get statusType(): STATUS_TYPE;
672
676
  set tempDir(value);
@@ -714,8 +718,10 @@ declare namespace functions {
714
718
  readonly LOG_TYPE: LOG_TYPE;
715
719
  readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
716
720
  readonly STATUS_TYPE: STATUS_TYPE;
721
+ readonly PLATFORM_WIN32: boolean;
717
722
  readonly MAX_TIMEOUT: number;
718
723
  readonly TEMP_DIR: string;
724
+ /** @deprecated Types.supported */
719
725
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
720
726
  formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
721
727
  writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
@@ -723,9 +729,9 @@ declare namespace functions {
723
729
  parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
724
730
  parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
725
731
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
726
- asHash(data: BinaryLike, algorithm: string, minLength?: number): string;
727
- asHash(data: BinaryLike, algorithm?: string, options?: AsHashOptions): string;
728
732
  asHash(data: BinaryLike, options?: AsHashOptions): string;
733
+ asHash(data: BinaryLike, algorithm?: string, options?: HashOptions): string;
734
+ asHash(data: BinaryLike, algorithm?: string, digest?: BinaryToTextEncoding): string;
729
735
  readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
730
736
  toPosix(value: unknown, normalize: boolean): string;
731
737
  toPosix(value: unknown, filename?: string, normalize?: boolean): string;
@@ -741,7 +747,7 @@ declare namespace functions {
741
747
  resolvePath(value: string, base: string | URL): string;
742
748
  joinPath(...values: [...paths: unknown[], normalize: boolean][]): string;
743
749
  joinPath(...values: unknown[]): string;
744
- normalizePath(value: unknown, flags?: boolean | NormalizeFlags): string;
750
+ normalizePath(value: unknown, flags?: boolean | number): string;
745
751
  createDir(value: string | URL, overwrite?: boolean): boolean;
746
752
  removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
747
753
  removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
@@ -752,11 +758,11 @@ declare namespace functions {
752
758
  streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
753
759
  streamFile<U extends ReadBufferOptions>(value: string | URL, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
754
760
  readText(value: string | URL, cache: boolean): string;
755
- readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<string> : string;
761
+ readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<string> : string;
756
762
  readText(value: string | URL, encoding?: BufferEncoding | ReadTextOptions, cache?: boolean): string;
757
- readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<Null<Buffer>> : Null<Buffer>;
763
+ readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<Null<Buffer>> : Null<Buffer>;
758
764
  readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Null<Buffer>;
759
- resolveMime(data: string | Buffer | Uint8Array | ArrayBuffer): Promise<Undef<FileTypeResult>>;
765
+ resolveMime(data: FileTypeFormat): Promise<Undef<FileTypeResult>>;
760
766
  lookupMime(value: string, extension?: boolean): string;
761
767
  initCpuUsage(instance?: IModule): CpuUsage;
762
768
  getCpuUsage(start: CpuUsage, format: true): string;
@@ -767,8 +773,8 @@ declare namespace functions {
767
773
  getPackageVersion(name: string | TupleOf<string>, startDir: string, baseDir?: string): string;
768
774
  getPackageVersion(name: string | TupleOf<string>, unstable?: boolean, startDir?: string, baseDir?: string): string;
769
775
  checkSemVer(name: string | TupleOf<string>, options: CheckSemVerOptions): boolean;
770
- checkSemVer(name: string | TupleOf<string>, min: NumString, max?: NumString, unstable?: boolean, startDir?: string): boolean;
771
- checkSemVer(name: string | TupleOf<string>, min: NumString, max: NumString, options?: CheckSemVerOptions): boolean;
776
+ checkSemVer(name: string | TupleOf<string>, min: number | string, max?: number | string, unstable?: boolean, startDir?: string): boolean;
777
+ checkSemVer(name: string | TupleOf<string>, min: number | string, max: number | string, options?: CheckSemVerOptions): boolean;
772
778
  sanitizeCmd(value: string): string;
773
779
  sanitizeArgs(value: string, doubleQuote?: boolean): string;
774
780
  sanitizeArgs(values: string[], doubleQuote?: boolean): string[];