@e-mc/types 0.8.7 → 0.9.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/index.d.ts CHANGED
@@ -6,30 +6,30 @@
6
6
  import type { CompressLevel, DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
7
7
 
8
8
  import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
9
- import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload } from './cloud';
10
- import type { BufferResult, CompressFormat, TryFileCompressor, TryFileResult, TryImageResult } from './compress';
9
+ import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, UploadAssetOptions } from './cloud';
10
+ import type { BufferResult, CompressFormat, TryFileCompressor } from './compress';
11
11
  import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
12
- import type { BatchQueryResult, DB_TYPE, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, PoolConfig, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
12
+ import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
13
13
  import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
14
- import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
14
+ import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
15
15
  import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
16
16
  import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
17
- import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
17
+ import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
18
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';
19
19
  import type { RequestData, Settings } from './node';
20
20
  import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
21
- import type { ClientModule, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
21
+ 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';
22
22
  import type { Command, SpawnResult } from './task';
23
23
  import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
24
24
 
25
- import type { NoParamCallback, WriteStream } from 'fs';
26
25
  import type { SpawnOptions } from 'child_process';
27
- import type { BrotliCompress, Gzip } from 'zlib';
28
- import type { Readable, Writable } from 'stream';
26
+ import type { BinaryLike } from 'crypto';
27
+ import type { NoParamCallback, WriteStream } from 'fs';
28
+ import type { ClientRequest, OutgoingHttpHeaders } from 'http';
29
29
  import type { LookupFunction } from 'net';
30
+ import type { Readable, Writable } from 'stream';
30
31
  import type { SecureContextOptions } from 'tls';
31
- import type { ClientRequest, OutgoingHttpHeaders } from 'http';
32
- import type { BinaryLike } from 'crypto';
32
+ import type { BrotliCompress, Gzip } from 'zlib';
33
33
 
34
34
  import type * as EventEmitter from 'events';
35
35
 
@@ -37,7 +37,7 @@ import type * as EventEmitter from 'events';
37
37
  import type * as ws from 'ws';
38
38
  import type { FileTypeResult } from 'file-type';
39
39
 
40
- type BufferView = BufferContent | NodeJS.ArrayBufferView;
40
+ type BufferView = Bufferable | NodeJS.ArrayBufferView;
41
41
  type CpuUsage = NodeJS.CpuUsage;
42
42
 
43
43
  declare namespace functions {
@@ -48,13 +48,13 @@ declare namespace functions {
48
48
  instance?: U;
49
49
  }
50
50
 
51
- interface IExternalConfig<T = unknown, U = unknown> {
51
+ interface IExternalConfig<T extends HandlerSettings, U extends PlainObject = PlainObject> {
52
52
  module: T;
53
53
  init(...args: unknown[]): this;
54
54
  get settings(): U;
55
55
  }
56
56
 
57
- interface IExternalFunction<T = FunctionType> {
57
+ interface IExternalFunction<T extends FunctionType<any, any>> {
58
58
  set extensions(values: unknown[]);
59
59
  get extensions(): T[];
60
60
  }
@@ -70,10 +70,12 @@ declare namespace functions {
70
70
  createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
71
71
  createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
72
72
  createWriteStreamAsBrotli(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
73
- tryFile(file: string | Buffer, config: CompressFormat, callback?: TryFileResult): Promise<BufferResult>;
74
- tryFile(file: string | Buffer, output: string, config: CompressFormat, callback?: TryFileResult): Promise<BufferResult>;
75
- tryImage(file: string, config: CompressFormat, callback?: TryImageResult): Promise<BufferResult>;
76
- tryImage(file: string | Buffer, output: string, config: CompressFormat, callback?: TryImageResult): Promise<BufferResult>;
73
+ writeGzip(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
74
+ writeBrotli(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
75
+ tryFile(file: string | Buffer, options: CompressFormat): Promise<BufferResult>;
76
+ tryFile(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
77
+ tryImage(file: string, options: CompressFormat): Promise<BufferResult>;
78
+ tryImage(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
77
79
  }
78
80
 
79
81
  interface CompressConstructor<T extends CompressModule<U> = CompressModule<any>, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
@@ -104,20 +106,18 @@ declare namespace functions {
104
106
 
105
107
  interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
106
108
  readonly REGEXP_SIZERANGE: RegExp;
107
- transform(file: string, command: string, options?: TransformOptions): Promise<Null<Buffer> | string>;
109
+ transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<U extends { tempFile: true } ? string : Null<Buffer>>;
108
110
  clamp(value: unknown, min?: number, max?: number): number;
109
111
  isBinary(mime: unknown): mime is string;
110
112
  toABGR(buffer: Uint8Array | Buffer): Buffer;
111
- /* @deprecated - IImage.using */
112
- using?<V extends ExternalAsset>(this: T, instance: IImage<T, U>, data: IFileThread<V>, command: string): Promise<unknown>;
113
113
  readonly prototype: IImage<T, U>;
114
- new(module?: U): IImage<T, U>;
114
+ new(module?: U, ...args: unknown[]): IImage<T, U>;
115
115
  }
116
116
 
117
117
  interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
118
118
  using?<V extends ExternalAsset>(data: IFileThread<V>): Promise<unknown>;
119
119
  collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
120
- map?(tasks: Command[]): Promise<Undef<SpawnResult>>[];
120
+ map?(tasks: Command[]): Promise<Void<SpawnResult>>[];
121
121
  series?(tasks: Command[]): Promise<unknown>;
122
122
  parallel?(tasks: Command[]): Promise<unknown>;
123
123
  spawn?(task: PlainObject, callback: (result?: SpawnResult) => void): void;
@@ -126,8 +126,6 @@ declare namespace functions {
126
126
 
127
127
  interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
128
128
  finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
129
- /* @deprecated - ITask.using */
130
- using?<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[], preceding?: boolean): Promise<unknown>;
131
129
  readonly prototype: ITask<T, U>;
132
130
  new(module?: U, ...args: unknown[]): ITask<T, U>;
133
131
  }
@@ -137,8 +135,10 @@ declare namespace functions {
137
135
  getCredential<Y = PlainObject>(item: V): Undef<Y>;
138
136
  hasSource(source: string, ...type: number[]): boolean;
139
137
  applyCommand(...items: V[]): void;
138
+ executeQuery(item: V, callback: ErrorQueryCallback): Promise<QueryResult>;
140
139
  executeQuery(item: V, sessionKey: string): Promise<QueryResult>;
141
140
  executeQuery(item: V, options?: ExecuteQueryOptions | string): Promise<QueryResult>;
141
+ executeBatchQuery(batch: V[], callback: ErrorQueryCallback, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
142
142
  executeBatchQuery(batch: V[], sessionKey: string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
143
143
  executeBatchQuery(batch: V[], options?: ExecuteBatchQueryOptions | string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
144
144
  processRows(batch: V[], tasks: Promise<Null<QueryResult>>[], parallel: boolean): Promise<BatchQueryResult>;
@@ -162,16 +162,17 @@ declare namespace functions {
162
162
  new(module?: U, database?: V[], ...args: unknown[]): IDb<T, U, V>;
163
163
  }
164
164
 
165
- interface ICloud<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase, W extends CloudServiceOptions = CloudServiceOptions, X extends DbCoerceSettings = DbCoerceSettings> extends IClientDb<T, U, V, W, X> {
165
+ interface ICloud<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase, W extends CloudServiceOptions = CloudServiceOptions, X extends DbCoerceSettings = DbCoerceSettings & CloudAuthSettings> extends IClientDb<T, U, V, W, X> {
166
166
  readonly uploaded: string[];
167
167
  readonly downloaded: string[];
168
168
  createBucket(service: string, credential: unknown, bucket: string, acl?: unknown, options?: unknown): Promise<boolean>;
169
169
  createBucket(service: string, credential: unknown, bucket: string, publicRead?: boolean): Promise<boolean>;
170
170
  setBucketPolicy(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
171
+ setBucketTagging(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
171
172
  setBucketWebsite(service: string, credential: unknown, bucket: string, options: BucketWebsiteOptions): Promise<boolean>;
172
173
  deleteObjects(service: string, credential: unknown, bucket: string, recursive?: boolean): Promise<void>;
173
174
  uploadObject(service: string, credential: unknown, bucket: string, upload: CloudStorageUpload, localUri: string, beforeResolve?: (value: string) => Void<Promise<void>>): Promise<string>;
174
- downloadObject(service: string, credential: unknown, bucket: string, download: CloudStorageDownload, beforeResolve?: (value: Null<BufferContent>) => Void<Promise<Undef<string>>>): Promise<BufferContent>;
175
+ downloadObject(service: string, credential: unknown, bucket: string, download: CloudStorageDownload, beforeResolve?: (value: Null<Bufferable>) => Void<Promise<Undef<string>>>): Promise<Bufferable>;
175
176
  getStorage(action: CloudFunctions, data: Undef<CloudStorage[]>): Undef<CloudStorage>;
176
177
  hasStorage(action: CloudFunctions, storage: CloudStorage): CloudStorageUpload | false;
177
178
  getDatabaseRows(item: V, ignoreErrors: boolean, sessionKey?: string): Promise<QueryResult>;
@@ -182,7 +183,8 @@ declare namespace functions {
182
183
  getCredential(item: CloudService, unused?: boolean): PlainObject;
183
184
  getSettings(service: string): Undef<AnyObject>;
184
185
  settingsOf(service: string, name: "cache"): unknown;
185
- settingsOf(service: string, name: "coerce", component: keyof X): unknown;
186
+ settingsOf(service: string, name: "coerce", component: keyof DbCoerceSettings): unknown;
187
+ settingsOf(service: string, name: "auth", component: keyof CloudAuthSettings): unknown;
186
188
  getUploadHandler(service: string, credential: unknown): FunctionType<void>;
187
189
  getDownloadHandler(service: string, credential: unknown): FunctionType<void>;
188
190
  resolveService(service: string, folder?: string): string;
@@ -197,8 +199,9 @@ declare namespace functions {
197
199
  LOG_CLOUD_DELETE: LogMessageOptions;
198
200
  LOG_CLOUD_DELAYED: LogMessageOptions;
199
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>[];
200
203
  uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<unknown>[];
201
- uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string, 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>[];
202
205
  sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
203
206
  readonly prototype: ICloud<T, U, V>;
204
207
  new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
@@ -212,8 +215,9 @@ declare namespace functions {
212
215
  customize(options?: CustomizeDocument): void;
213
216
  findConfig(data: object, name: string, type?: string): PluginConfig;
214
217
  loadConfig(data: object, name: string): Optional<ConfigOrTransformer>;
215
- asSourceFile(value: string, options?: AsSourceFileOptions | boolean): unknown;
216
- findVersion(name: StringOfArray, fallback?: string): string;
218
+ asSourceFile(value: string, cache: boolean): unknown;
219
+ asSourceFile(value: string, options?: AsSourceFileOptions): unknown;
220
+ findVersion(name: ArrayOf<string>, fallback?: string): string;
217
221
  findSourceScope(uri: string, imports: AnyObject): StringMap[];
218
222
  findSourceRoot(uri: string, imports?: StringMap): Undef<string>;
219
223
  resolveDir(name: string, ...paths: string[]): Undef<string>;
@@ -224,8 +228,9 @@ declare namespace functions {
224
228
  hasEval(name: string): boolean;
225
229
  settingsOf(name: keyof W, option: keyof X): unknown;
226
230
  parseTemplate(viewEngine: ViewEngine | string, template: string, data: unknown[]): Promise<Null<string>>;
227
- transform(type: string, code: string, format: StringOfArray, options?: TransformOutput & TransformAction): Promise<Void<TransformResult>>;
228
- abort(name?: keyof W | Error, reason?: unknown): void;
231
+ transform(type: string, code: string, format: ArrayOf<string>, options?: TransformOutput & TransformAction): Promise<Void<TransformResult>>;
232
+ abort(err: Error): void;
233
+ abort(name?: keyof W, reason?: unknown): void;
229
234
  restart(): void;
230
235
  using?(data: IFileThread<U>): Promise<unknown>;
231
236
  setLocalUri?(file: U, replace?: boolean): void;
@@ -253,10 +258,9 @@ declare namespace functions {
253
258
  createSourceMap(code: string, remove: boolean): SourceMap;
254
259
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
255
260
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
256
- updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions | boolean): string;
261
+ updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
262
+ updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
257
263
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
258
- /* @deprecated - IDocument.using */
259
- using?(this: T, instance: IDocument<T, U, V, W, X, Y>, file: U): Promise<unknown>;
260
264
  cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
261
265
  sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
262
266
  readonly prototype: IDocument<T, U, V, W, X, Y>;
@@ -265,6 +269,7 @@ declare namespace functions {
265
269
 
266
270
  interface IWatch<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends IClient<T, V, W> {
267
271
  connectTimeout: number;
272
+ init(config?: HostInitConfig): this;
268
273
  start(assets: U[], permission?: Null<IPermission>): void;
269
274
  modified(watch: IFileGroup<U>): Promise<Void<FinalizeResult>>;
270
275
  configureServer(options: SecureOptions): boolean;
@@ -273,7 +278,7 @@ declare namespace functions {
273
278
  setSSLCert(value: string): boolean;
274
279
  hasSecureProtocol(): boolean;
275
280
  whenModified?(assets: U[], postFinalize: PostFinalizeCallback): IFileManager<U>;
276
- whenModified?(assets: U[], sanitize?: boolean | PostFinalizeCallback, postFinalize?: PostFinalizeCallback): IFileManager<U>;
281
+ whenModified?(assets: U[], sanitize?: boolean, postFinalize?: PostFinalizeCallback): IFileManager<U>;
277
282
  set assets(value: U[]);
278
283
  get assets(): U[];
279
284
  set interval(value);
@@ -292,7 +297,6 @@ declare namespace functions {
292
297
  checkTimeout(client: ws): boolean;
293
298
  readonly prototype: IWatch<T, U, V, W>;
294
299
  new(module?: V): IWatch<T, U, V, W>;
295
- /* @deprecated */
296
300
  new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
297
301
  }
298
302
 
@@ -311,8 +315,8 @@ declare namespace functions {
311
315
  proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
312
316
  statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
313
317
  statusOn(name: ArrayOf<number>, globUrl: string, callback: StatusOnCallback): void;
314
- headersOn(name: StringOfArray, callback: HeadersOnCallback): void;
315
- headersOn(name: StringOfArray, globUrl: string, callback: HeadersOnCallback): void;
318
+ headersOn(name: ArrayOf<string>, callback: HeadersOnCallback): void;
319
+ headersOn(name: ArrayOf<string>, globUrl: string, callback: HeadersOnCallback): void;
316
320
  headersOf(uri: string): Undef<OutgoingHttpHeaders>;
317
321
  aria2c(uri: string | URL, pathname: string): Promise<string[]>;
318
322
  aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
@@ -353,14 +357,13 @@ declare namespace functions {
353
357
  }
354
358
 
355
359
  interface IFileManager<T extends ExternalAsset = ExternalAsset> extends IHost, Set<string> {
356
- finalizeState: number;
357
360
  processTimeout: number;
358
361
  cacheToDisk: IHttpDiskCache<T>;
359
362
  cacheToMemory: IHttpMemoryCache<T>;
360
363
  Request: IRequest<RequestModule>;
361
364
  Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
362
365
  Task: InstallData<ITask, TaskConstructor>[];
363
- Image: Null<Map<string, InstallData<IImage, ImageConstructor>>>;
366
+ Image: Null<ImageMimeMap>;
364
367
  Cloud: Null<ICloud>;
365
368
  Watch: Null<WatchInstance<T>>;
366
369
  Compress: Null<ICompress<CompressModule>>;
@@ -377,11 +380,14 @@ declare namespace functions {
377
380
  readonly fetchedAssets: T[];
378
381
  readonly copiedAssets: T[];
379
382
  readonly emptyDir: Set<string>;
380
- install(name: "document", target: DocumentConstructor<IFileManager<T>, T>, module?: DocumentModule): Undef<IDocument<IFileManager<T>, T>>;
381
- install(name: "task", target: TaskConstructor, module?: TaskModule): Undef<ITask>;
382
- install(name: "cloud", handler: string, module?: CloudModule): Undef<ICloud>;
383
+ install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
384
+ install(name: "document", target: DocumentConstructor<IFileManager<T>, T>, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
385
+ install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
386
+ install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
387
+ install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): Undef<ICloud>;
383
388
  install(name: "cloud", module?: CloudModule): Undef<ICloud>;
384
- install(name: "db", module?: DbModule): Undef<IDb>;
389
+ install(name: "image", handler: string, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
390
+ install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
385
391
  install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
386
392
  install(name: "watch", module: WatchModule): Undef<WatchInstance<T>>;
387
393
  install(name: "watch", interval?: NumString, port?: NumString, securePort?: NumString, extensions?: unknown[]): Undef<WatchInstance<T>>;
@@ -392,14 +398,14 @@ declare namespace functions {
392
398
  removeCwd(value: unknown): string;
393
399
  findAsset(value: string | URL, instance?: IModule | FindAssetOptions<T>): Undef<T>;
394
400
  removeAsset(file: T): boolean;
395
- replace(file: T, replaceWith: string, options: ReplaceOptions): boolean;
396
- replace(file: T, replaceWith: string, mimeType?: string | ReplaceOptions): boolean;
401
+ replace(file: T, replaceWith: string, mimeType: Undef<string>): boolean;
402
+ replace(file: T, replaceWith: string, options?: ReplaceOptions): boolean;
397
403
  rename(file: T, value: string): boolean;
398
404
  performAsyncTask(): void;
399
405
  removeAsyncTask(): void;
400
406
  completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: number): void;
401
407
  performFinalize(override?: boolean): void;
402
- hasDocument(instance: IModule, document: Undef<StringOfArray>): boolean;
408
+ hasDocument(instance: IModule, document: Undef<ArrayOf<string>>): boolean;
403
409
  getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
404
410
  getDataSourceItems(instance: IModule, condition?: FunctionArgs<[DataSource], boolean>): DataSource[];
405
411
  setLocalUri(file: T, replace?: boolean): FileOutput;
@@ -411,25 +417,29 @@ declare namespace functions {
411
417
  removeProcessTimeout(instance: IModule, file: T): void;
412
418
  getProcessTimeout(handler: InstallData): number;
413
419
  clearProcessTimeout(): void;
414
- addDownload(value: number | BufferContent, encoding: BufferEncoding): number;
415
- addDownload(value: number | BufferContent, type?: number, encoding?: BufferEncoding): number;
420
+ scheduleTask(url: string | URL, data: unknown, priority: number): Promise<unknown>;
421
+ scheduleTask(url: string | URL, data: unknown, thenCallback?: FunctionType, catchCallback?: FunctionType, priority?: number): Promise<unknown>;
422
+ setTaskLimit(value: number): void;
423
+ addDownload(value: number | Bufferable, encoding: BufferEncoding): number;
424
+ addDownload(value: number | Bufferable, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
416
425
  getDownload(type?: number): TupleOf<number>;
417
- transformAsset(data: IFileThread<T>, parent?: T): Promise<void>;
426
+ transformAsset(data: IFileThread<T>, parent?: T, override?: boolean): Promise<boolean>;
418
427
  addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): Undef<string>;
419
428
  findMime(file: T, rename?: boolean): Promise<string>;
420
429
  getUTF8String(file: T, uri?: string): string;
421
- getBuffer<U>(file: T, minStreamSize?: U): U extends number ? Promise<Buffer> : Null<Buffer>;
430
+ getBuffer<U>(file: T, minStreamSize?: U): U extends number ? Promise<Null<Buffer>> : Null<Buffer>;
422
431
  getCacheDir(url: string | URL, createDir?: boolean): string;
423
432
  setAssetContent(file: T, content: string, options?: AssetContentOptions): string;
424
433
  getAssetContent(file: T, content?: string): Undef<string>;
425
434
  writeBuffer(file: T, options?: WriteFileOptions): Null<Buffer>;
426
- writeImage(document: StringOfArray, output: OutputFinalize<T>): boolean;
435
+ writeImage(document: ArrayOf<string>, output: OutputFinalize<T>): boolean;
427
436
  compressFile(file: T, overwrite?: boolean): Promise<unknown>;
428
437
  fetchObject(uri: string | URL, format: BufferFormat): Promise<Null<object>>;
429
438
  fetchObject(uri: string | URL, options?: OpenOptions | BufferFormat): Promise<Null<object>>;
430
439
  fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
431
440
  fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
432
- fetchFiles(uri: string | URL, options?: Aria2Options | string): Promise<string[]>;
441
+ fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
442
+ updateProgress(name: "request", id: NumString, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
433
443
  start(emptyDir?: boolean): Promise<FinalizeResult>;
434
444
  processAssets(emptyDir?: boolean, using?: T[]): void;
435
445
  deleteFile<U extends Promise<void>>(src: string, promises: boolean): U;
@@ -455,6 +465,8 @@ declare namespace functions {
455
465
  get delayed(): number;
456
466
  set cleared(value);
457
467
  get cleared(): boolean;
468
+ set finalizeState(value);
469
+ get finalizeState(): number;
458
470
 
459
471
  /* Set */
460
472
  add(value: string, parent?: T, type?: number): this;
@@ -465,7 +477,7 @@ declare namespace functions {
465
477
  on(event: "end", listener: PostFinalizeCallback): this;
466
478
  on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
467
479
  on(event: "error", listener: (err: Error) => void): this;
468
- on(event: "file:read", listener: (src: string, data: BufferContent, options?: ReadFileOptions) => void): this;
480
+ on(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
469
481
  on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
470
482
  on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
471
483
  on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
@@ -475,7 +487,7 @@ declare namespace functions {
475
487
  once(event: "end", listener: PostFinalizeCallback): this;
476
488
  once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
477
489
  once(event: "error", listener: (err: Error) => void): this;
478
- once(event: "file:read", listener: (src: string, data: BufferContent, options?: ReadFileOptions) => void): this;
490
+ once(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
479
491
  once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
480
492
  once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
481
493
  once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
@@ -485,7 +497,7 @@ declare namespace functions {
485
497
  emit(event: "end", result: FinalizeResult): boolean;
486
498
  emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
487
499
  emit(event: "error", err: Error): boolean;
488
- emit(event: "file:read", src: string, data: BufferContent, options?: ReadFileOptions): boolean;
500
+ emit(event: "file:read", src: string, data: Bufferable, options?: ReadFileOptions): boolean;
489
501
  emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
490
502
  emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
491
503
  emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
@@ -495,22 +507,21 @@ declare namespace functions {
495
507
  }
496
508
 
497
509
  interface FileManagerConstructor<T extends ExternalAsset> extends HostConstructor {
510
+ purgeMemory(percent?: number, limit?: number | boolean, parent?: number | boolean): Promise<number>;
498
511
  loadSettings(settings: Settings, password?: string): boolean;
499
512
  loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
500
513
  sanitizeAssets(assets: T[], exclusions?: string[]): T[];
501
- writeChecksum(root: string, options?: ChecksumOptions): Promise<string[]>;
502
- writeChecksum(root: string, to: Undef<string>, options?: ChecksumOptions): Promise<Null<string[]>>;
514
+ writeChecksum(root: string, options: ChecksumOptions): Promise<string[]>;
503
515
  writeChecksum(root: string, to?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<string[]>>;
504
- verifyChecksum(root: string, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
505
- verifyChecksum(root: string, from: Undef<string>, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
506
- verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
516
+ verifyChecksum(root: string, options: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
517
+ verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
507
518
  createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
508
519
  setTimeout(options: ObjectMap<NumString>): void;
509
520
  defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
510
521
  defineHttpConnect(options: HttpConnectSettings): void;
511
522
  readonly prototype: IFileManager<T>;
512
523
  new(baseDirectory: string, config: RequestData<T>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
513
- new(baseDirectory: string, config: RequestData<T>, permission?: IPermission, postFinalize?: PostFinalizeCallback): IFileManager<T>;
524
+ new(baseDirectory: string, config: RequestData<T>, permission?: Null<IPermission>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
514
525
  }
515
526
 
516
527
  interface IHost extends IModule {
@@ -523,23 +534,29 @@ declare namespace functions {
523
534
  find(name: string): Undef<IModule>;
524
535
  findAll(name: string): IModule[];
525
536
  willLog(name: string): boolean;
526
- ignoreLog(values: boolean | StringOfArray): void;
537
+ ignoreLog(values: boolean | ArrayOf<string>): void;
527
538
  collectLog(level?: boolean): LogStatus<StatusType>[];
539
+ pauseLog(): void;
540
+ resumeLog(): void;
541
+ hasLog(type: string): boolean;
542
+ delayMessage(...args: unknown[]): void;
528
543
  willAbort(value: string | IModule): boolean;
529
544
  loadModule(name: string, ...args: any[]): Null<IModule>;
530
545
  retain(process: IModule): void;
531
546
  release(process: IModule, log?: boolean): boolean;
532
547
  restart(...args: unknown[]): void;
533
548
  joinQueue(options?: JoinQueueOptions): boolean;
549
+ updateProgress(name: string, ...args: unknown[]): void;
534
550
  resumeThread?(options: ResumeThreadOptions): void;
535
551
  set host(value);
536
552
  get host(): null;
537
553
  get config(): Readonly<HostInitConfig>;
538
- get errorCount(): number;
539
554
  get username(): string;
540
555
  set done(value);
541
556
  get done(): boolean;
542
557
  get queued(): boolean;
558
+ get logState(): LogState;
559
+ get errorCount(): number;
543
560
  }
544
561
 
545
562
  interface HostConstructor extends ModuleConstructor {
@@ -548,7 +565,7 @@ declare namespace functions {
548
565
  isPermission(value: unknown): value is IPermission;
549
566
  createPermission(all?: boolean, freeze?: boolean): IPermission;
550
567
  kill(username: string, iv: BinaryLike, all: true): number;
551
- kill(username: string, iv: BinaryLike, pid: ArrayOf<number> | boolean): number;
568
+ kill(username: string, iv: BinaryLike, pid: ArrayOf<number>): number;
552
569
  getThreadCount(full: true): ThreadCountStat;
553
570
  getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
554
571
  getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
@@ -563,63 +580,66 @@ declare namespace functions {
563
580
  supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
564
581
  supports(name: string, value?: boolean): boolean;
565
582
  getTempDir(options: GetTempDirOptions): string;
566
- getTempDir(uuidDir: boolean, createDir?: boolean): string;
567
- getTempDir(pathname: string, createDir?: boolean): string;
568
- getTempDir(uuidDir: boolean, filename: string, createDir?: boolean): string;
583
+ getTempDir(uuidDir: boolean, createDir: boolean): string;
584
+ getTempDir(pathname: string, createDir: boolean): string;
585
+ getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
569
586
  getTempDir(pathname?: string, filename?: string, createDir?: boolean): string;
570
- canRead(uri: string, options?: PermissionOptions): boolean;
571
- canWrite(uri: string, options?: PermissionOptions): boolean;
572
- readFile(src: string): Undef<Buffer>;
573
- readFile<U extends ReadFileOptions>(src: string, options?: U): Undef<U extends { encoding: string } ? U extends { minStreamSize: NumString } ? Promise<string> : string : U extends { minStreamSize: NumString } ? Promise<Buffer> : Buffer>;
574
- readFile<U extends Buffer>(src: string, promises: true): Promise<Undef<U>>;
575
- readFile<U extends BufferContent, V extends ReadFileOptions>(src: string, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
576
- readFile<U extends ReadFileCallback>(src: string, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : BufferContent>;
577
- readFile<U extends ReadFileCallback, V extends ReadFileOptions>(src: string, options: V, callback: U): Undef<V extends { encoding: string } ? string : U extends ReadFileCallback<infer W> ? W : BufferContent>;
578
- writeFile<U extends boolean>(src: string, data: BufferView, options?: WriteFileOptions): U;
579
- writeFile<U extends Promise<boolean>>(src: string, data: BufferView, promises: true): U;
580
- writeFile<U extends Promise<boolean>>(src: string, data: BufferView, options: WriteFileOptions, promises: true): U;
581
- writeFile<U extends NoParamCallback>(src: string, data: BufferView, callback: U): void;
582
- writeFile<U extends NoParamCallback>(src: string, data: BufferView, options: WriteFileOptions, callback: U): void;
583
- deleteFile<U extends boolean>(src: string, options?: DeleteFileOptions): U;
584
- deleteFile<U extends Promise<boolean>>(src: string, promises: true): U;
585
- deleteFile<U extends Promise<boolean>>(src: string, options: DeleteFileOptions, promises: true): U;
586
- deleteFile<U extends NoParamCallback>(src: string, callback: U): void;
587
- deleteFile<U extends NoParamCallback>(src: string, options: DeleteFileOptions, callback: U): void;
588
- copyFile<U extends boolean>(src: string, dest: string, options?: CopyFileOptions): U;
589
- copyFile<U extends Promise<boolean>>(src: string, dest: string, promises: true): U;
590
- copyFile<U extends Promise<boolean>>(src: string, dest: string, options: CopyFileOptions, promises: true): U;
591
- copyFile<U extends NoParamCallback>(src: string, dest: string, callback: U): void;
592
- copyFile<U extends NoParamCallback>(src: string, dest: string, options: CopyFileOptions, callback: U): void;
593
- moveFile<U extends boolean>(src: string, dest: string, options?: MoveFileOptions): U;
594
- moveFile<U extends Promise<boolean>>(src: string, dest: string, promises: true): U;
595
- moveFile<U extends Promise<boolean>>(src: string, dest: string, options: MoveFileOptions, promises: true): U;
596
- moveFile<U extends NoParamCallback>(src: string, dest: string, callback: U): void;
597
- moveFile<U extends NoParamCallback>(src: string, dest: string, options: MoveFileOptions, callback: U): void;
598
- createDir<U extends boolean>(src: string, options?: CreateDirOptions): U;
599
- createDir<U extends Promise<boolean>>(src: string, promises: true): U;
600
- createDir<U extends Promise<boolean>>(src: string, options: CreateDirOptions, promises: true): U;
601
- createDir<U extends NoParamCallback>(src: string, callback: U): void;
602
- createDir<U extends NoParamCallback>(src: string, options: CreateDirOptions, callback: U): void;
603
- removeDir<U extends boolean>(src: string, options?: RemoveDirOptions): U;
604
- removeDir<U extends Promise<boolean>>(src: string, promises: true): U;
605
- removeDir<U extends Promise<boolean>>(src: string, options: RemoveDirOptions, promises: true): U;
606
- removeDir<U extends NoParamCallback>(src: string, callback: U): void;
607
- removeDir<U extends NoParamCallback>(src: string, options: RemoveDirOptions, callback: U): void;
608
- allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseFulfilledResult<U>[]>;
587
+ canRead(uri: string | URL, options?: PermissionOptions): boolean;
588
+ canWrite(uri: string | URL, options?: PermissionOptions): boolean;
589
+ readFile(src: string | URL): Undef<Buffer>;
590
+ 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>;
591
+ readFile<U extends Buffer>(src: string | URL, promises: true): Promise<Undef<U>>;
592
+ readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
593
+ readFile<U extends ReadFileCallback>(src: string | URL, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : Bufferable>;
594
+ readFile<U extends ReadFileCallback, V extends ReadFileOptions>(src: string | URL, options: V, callback: U): Undef<V extends { encoding: string } ? string : U extends ReadFileCallback<infer W> ? W : Bufferable>;
595
+ writeFile<U extends boolean>(src: string | URL, data: BufferView, options?: WriteFileOptions): U;
596
+ writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, promises: true): U;
597
+ writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, options: WriteFileOptions, promises: true): U;
598
+ writeFile<U extends NoParamCallback>(src: string | URL, data: BufferView, callback: U): void;
599
+ writeFile<U extends NoParamCallback>(src: string | URL, data: BufferView, options: WriteFileOptions, callback: U): void;
600
+ deleteFile<U extends boolean>(src: string | URL, options?: DeleteFileOptions): U;
601
+ deleteFile<U extends Promise<boolean>>(src: string | URL, promises: true): U;
602
+ deleteFile<U extends Promise<boolean>>(src: string | URL, options: DeleteFileOptions, promises: true): U;
603
+ deleteFile<U extends NoParamCallback>(src: string | URL, callback: U): void;
604
+ deleteFile<U extends NoParamCallback>(src: string | URL, options: DeleteFileOptions, callback: U): void;
605
+ copyFile<U extends boolean>(src: string | URL, dest: string | URL, options?: CopyFileOptions): U;
606
+ copyFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, promises: true): U;
607
+ copyFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, options: CopyFileOptions, promises: true): U;
608
+ copyFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, callback: U): void;
609
+ copyFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, options: CopyFileOptions, callback: U): void;
610
+ moveFile<U extends boolean>(src: string | URL, dest: string | URL, options?: MoveFileOptions): U;
611
+ moveFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, promises: true): U;
612
+ moveFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, options: MoveFileOptions, promises: true): U;
613
+ moveFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, callback: U): void;
614
+ moveFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, options: MoveFileOptions, callback: U): void;
615
+ createDir<U extends boolean>(src: string | URL, options?: CreateDirOptions): U;
616
+ createDir<U extends Promise<boolean>>(src: string | URL, promises: true): U;
617
+ createDir<U extends Promise<boolean>>(src: string | URL, options: CreateDirOptions, promises: true): U;
618
+ createDir<U extends NoParamCallback>(src: string | URL, callback: U): void;
619
+ createDir<U extends NoParamCallback>(src: string | URL, options: CreateDirOptions, callback: U): void;
620
+ removeDir<U extends boolean>(src: string | URL, options?: RemoveDirOptions): U;
621
+ removeDir<U extends Promise<boolean>>(src: string | URL, promises: true): U;
622
+ removeDir<U extends Promise<boolean>>(src: string | URL, options: RemoveDirOptions, promises: true): U;
623
+ removeDir<U extends NoParamCallback>(src: string | URL, callback: U): void;
624
+ removeDir<U extends NoParamCallback>(src: string | URL, options: RemoveDirOptions, callback: U): void;
625
+ allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, type?: LogType): Promise<PromiseFulfilledResult<U>[]>;
626
+ allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions): Promise<PromiseFulfilledResult<U>[]>;
609
627
  formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
610
628
  formatFail(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogFailOptions): void;
611
- writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
629
+ writeFail(value: LogValue, message?: unknown, type?: LogType): void;
630
+ writeFail(value: LogValue, message?: unknown, options?: LogFailOptions): void;
612
631
  writeTimeProcess(title: string, value: string, startTime: LogTime, options?: LogProcessOptions): void;
613
632
  writeTimeElapsed(title: string, value: LogValue, startTime: LogTime, options?: LogMessageOptions): void;
614
- checkPackage(err: unknown, name: Undef<string>, options?: LogFailOptions | LogType): boolean;
633
+ checkPackage(err: unknown, name: Undef<string>, type: LogType): boolean;
634
+ checkPackage(err: unknown, name: Undef<string>, options: LogFailOptions): boolean;
615
635
  checkPackage(err: unknown, name: Undef<string>, value?: LogValue, options?: LogFailOptions | LogType): boolean;
616
636
  checkFail(message: unknown, options: LogFailOptions): Undef<LogArguments | false>;
617
637
  writeLog(component: LogComponent, queue?: boolean): void;
618
- writeLog(type: StatusType, value: unknown, options?: LogOptions): void;
638
+ writeLog(type: StatusType, value: unknown, options: LogOptions): void;
619
639
  writeLog(type: StatusType, value: unknown, timeStamp?: LogDate, duration?: number): void;
620
640
  addLog(component: LogComponent, queue?: boolean): void;
641
+ addLog(type: StatusType, value: unknown, options: LogOptions): void;
621
642
  addLog(type: StatusType, value: unknown, from: string, source?: string): void;
622
- addLog(type: StatusType, value: unknown, options?: LogOptions): void;
623
643
  addLog(type: StatusType, value: unknown, timeStamp?: LogDate, from?: string, source?: string): void;
624
644
  addLog(type: StatusType, value: unknown, timeStamp?: LogDate, duration?: number, from?: string, source?: string): void;
625
645
  getLog(...type: StatusType[]): LogStatus<StatusType>[];
@@ -641,7 +661,7 @@ declare namespace functions {
641
661
  set sessionId(value);
642
662
  get sessionId(): string;
643
663
  set broadcastId(value);
644
- get broadcastId(): StringOfArray;
664
+ get broadcastId(): ArrayOf<string>;
645
665
  get logType(): LOG_TYPE;
646
666
  set logLevel(value: NumString);
647
667
  get logLevel(): number;
@@ -652,7 +672,7 @@ declare namespace functions {
652
672
  /* EventEmitter */
653
673
  on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
654
674
  on(event: "error", listener: (err: Error) => void): this;
655
- on(event: "file:read", listener: (src: string, data: BufferContent, options?: ReadFileOptions) => void): this;
675
+ on(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
656
676
  on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
657
677
  on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
658
678
  on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
@@ -661,7 +681,7 @@ declare namespace functions {
661
681
  on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
662
682
  once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
663
683
  once(event: "error", listener: (err: Error) => void): this;
664
- once(event: "file:read", listener: (src: string, data: BufferContent, options?: ReadFileOptions) => void): this;
684
+ once(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
665
685
  once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
666
686
  once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
667
687
  once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
@@ -670,7 +690,7 @@ declare namespace functions {
670
690
  once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
671
691
  emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
672
692
  emit(event: "error", err: Error): boolean;
673
- emit(event: "file:read", src: string, data: BufferContent, options?: ReadFileOptions): boolean;
693
+ emit(event: "file:read", src: string, data: Bufferable, options?: ReadFileOptions): boolean;
674
694
  emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
675
695
  emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
676
696
  emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
@@ -689,6 +709,7 @@ declare namespace functions {
689
709
  LOG_STYLE_REVERSE: LogMessageOptions;
690
710
  readonly VERSION: string;
691
711
  readonly LOG_TYPE: LOG_TYPE;
712
+ readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
692
713
  readonly STATUS_TYPE: STATUS_TYPE;
693
714
  readonly MAX_TIMEOUT: number;
694
715
  readonly TEMP_DIR: string;
@@ -699,9 +720,9 @@ declare namespace functions {
699
720
  parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
700
721
  parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
701
722
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
702
- asHash(data: BinaryLike, options: AsHashOptions): string;
703
- asHash(data: BinaryLike, minLength: number): string;
704
- asHash(data: BinaryLike, algorithm?: NumString | AsHashOptions, minLength?: number | AsHashOptions): string;
723
+ asHash(data: BinaryLike, algorithm: string, minLength?: number): string;
724
+ asHash(data: BinaryLike, algorithm?: string, options?: AsHashOptions): string;
725
+ asHash(data: BinaryLike, options?: AsHashOptions): string;
705
726
  readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
706
727
  toPosix(value: unknown, normalize: boolean): string;
707
728
  toPosix(value: unknown, filename?: string, normalize?: boolean): string;
@@ -721,17 +742,17 @@ declare namespace functions {
721
742
  createDir(value: string | URL, overwrite?: boolean): boolean;
722
743
  removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
723
744
  removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
724
- copyDir(src: string | URL, dest: string | URL, options: CopyDirOptions): Promise<CopyDirResult>;
725
745
  copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
746
+ copyDir(src: string | URL, dest: string | URL, options?: CopyDirOptions): Promise<CopyDirResult>;
726
747
  renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
727
- streamFile<U extends BufferContent>(src: string, cache: boolean): Promise<U>;
728
- streamFile<U extends ReadBufferOptions>(src: string, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
729
- streamFile<U extends ReadBufferOptions>(src: string, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
748
+ streamFile<U extends Bufferable>(value: string | URL, cache: boolean): Promise<U>;
749
+ streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
750
+ streamFile<U extends ReadBufferOptions>(value: string | URL, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
730
751
  readText(value: string | URL, cache: boolean): string;
731
752
  readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<string> : string;
732
- readText(value: string | URL, encoding?: BufferEncoding | boolean | ReadTextOptions, cache?: boolean): string;
753
+ readText(value: string | URL, encoding?: BufferEncoding | ReadTextOptions, cache?: boolean): string;
733
754
  readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<Null<Buffer>> : Null<Buffer>;
734
- readBuffer(value: string | URL, cache?: boolean): Null<Buffer>;
755
+ readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Null<Buffer>;
735
756
  resolveMime(data: string | Buffer | Uint8Array | ArrayBuffer): Promise<Undef<FileTypeResult>>;
736
757
  lookupMime(value: string, extension?: boolean): string;
737
758
  initCpuUsage(instance?: IModule): CpuUsage;
@@ -743,13 +764,13 @@ declare namespace functions {
743
764
  getPackageVersion(name: string | TupleOf<string>, startDir: string, baseDir?: string): string;
744
765
  getPackageVersion(name: string | TupleOf<string>, unstable?: boolean, startDir?: string, baseDir?: string): string;
745
766
  checkSemVer(name: string | TupleOf<string>, options: CheckSemVerOptions): boolean;
746
- checkSemVer(name: string | TupleOf<string>, min: NumString, max: NumString, options: CheckSemVerOptions): boolean;
747
767
  checkSemVer(name: string | TupleOf<string>, min: NumString, max?: NumString, unstable?: boolean, startDir?: string): boolean;
768
+ checkSemVer(name: string | TupleOf<string>, min: NumString, max: NumString, options?: CheckSemVerOptions): boolean;
748
769
  sanitizeCmd(value: string): string;
749
770
  sanitizeArgs(value: string, doubleQuote?: boolean): string;
750
771
  sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
751
- purgeMemory(percent: number, parent: boolean | number): Promise<number>;
752
- purgeMemory(percent?: number, limit?: number, parent?: boolean | number): Promise<number>;
772
+ purgeMemory(percent: number, limit: number, parent?: boolean): Promise<number>;
773
+ purgeMemory(percent?: number, limit?: number | boolean, parent?: unknown): Promise<number>;
753
774
  canWrite(name: "temp" | "home"): boolean;
754
775
  loadSettings(settings: Settings, password?: string): boolean;
755
776
  readonly prototype: IModule<T>;
@@ -757,4 +778,4 @@ declare namespace functions {
757
778
  }
758
779
  }
759
780
 
760
- export = functions;
781
+ export = functions;