@e-mc/types 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -10
- package/README.md +208 -208
- package/constant.d.ts +338 -338
- package/index.d.ts +336 -336
- package/index.js +4 -4
- package/lib/asset.d.ts +76 -76
- package/lib/cloud.d.ts +106 -106
- package/lib/compat-v4.d.ts +120 -120
- package/lib/compress.d.ts +25 -25
- package/lib/core.d.ts +195 -195
- package/lib/db.d.ts +107 -109
- package/lib/document.d.ts +199 -199
- package/lib/dom.d.ts +8 -8
- package/lib/filemanager.d.ts +122 -122
- package/lib/http.d.ts +115 -115
- package/lib/index.d.ts +791 -790
- package/lib/logger.d.ts +113 -113
- package/lib/module.d.ts +129 -127
- package/lib/node.d.ts +21 -21
- package/lib/object.d.ts +29 -29
- package/lib/request.d.ts +140 -138
- package/lib/settings.d.ts +490 -490
- package/lib/squared.d.ts +339 -339
- package/lib/type.d.ts +36 -33
- package/lib/watch.d.ts +77 -77
- package/package.json +28 -28
package/lib/index.d.ts
CHANGED
|
@@ -1,790 +1,791 @@
|
|
|
1
|
-
/// <reference path="type.d.ts" />
|
|
2
|
-
/// <reference path="object.d.ts" />
|
|
3
|
-
|
|
4
|
-
import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
|
|
5
|
-
|
|
6
|
-
import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
|
|
7
|
-
import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, UploadAssetOptions } from './cloud';
|
|
8
|
-
import type { BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
|
|
9
|
-
import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
10
|
-
import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
|
|
11
|
-
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
|
|
12
|
-
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
13
|
-
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
14
|
-
import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
|
|
15
|
-
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
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';
|
|
17
|
-
import type { RequestData, Settings } from './node';
|
|
18
|
-
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
|
|
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';
|
|
20
|
-
import type { Command, SpawnResult } from './task';
|
|
21
|
-
import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
|
|
22
|
-
|
|
23
|
-
import type { SpawnOptions } from 'child_process';
|
|
24
|
-
import type { BinaryLike, BinaryToTextEncoding, HashOptions } from 'crypto';
|
|
25
|
-
import type { NoParamCallback, WriteStream } from 'fs';
|
|
26
|
-
import type { ClientRequest, OutgoingHttpHeaders } from 'http';
|
|
27
|
-
import type { LookupFunction } from 'net';
|
|
28
|
-
import type { Readable, Writable } from 'stream';
|
|
29
|
-
import type { SecureContextOptions } from 'tls';
|
|
30
|
-
import type { BrotliCompress, Gzip } from 'zlib';
|
|
31
|
-
|
|
32
|
-
import type * as EventEmitter from 'events';
|
|
33
|
-
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
import type * as ws from 'ws';
|
|
36
|
-
import type { FileTypeResult } from 'file-type';
|
|
37
|
-
|
|
38
|
-
type BufferView = Bufferable | NodeJS.ArrayBufferView;
|
|
39
|
-
type CpuUsage = NodeJS.CpuUsage;
|
|
40
|
-
|
|
41
|
-
declare namespace functions {
|
|
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];
|
|
44
|
-
|
|
45
|
-
interface IScopeOrigin<T extends IHost = IHost, U extends IModule = IModule> {
|
|
46
|
-
host?: T;
|
|
47
|
-
instance?: U;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface IExternalConfig<T extends HandlerSettings, U extends PlainObject = PlainObject> {
|
|
51
|
-
module: T;
|
|
52
|
-
init(...args: unknown[]): this;
|
|
53
|
-
get settings(): U;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface IExternalFunction<T extends FunctionType<any, any>> {
|
|
57
|
-
set extensions(values: unknown[]);
|
|
58
|
-
get extensions(): T[];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
interface ICompress<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
|
|
62
|
-
level: ObjectMap<number>;
|
|
63
|
-
compressors: ObjectMap<TryFileCompressor>;
|
|
64
|
-
register(format: string, callback: TryFileCompressor): void;
|
|
65
|
-
getLevel(value: string, fallback?: number): Undef<number>;
|
|
66
|
-
getReadable(file: string | URL | Buffer, options?: ReadableOptions): Readable;
|
|
67
|
-
createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
|
|
68
|
-
createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
|
|
69
|
-
createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
|
|
70
|
-
createWriteStreamAsBrotli(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
|
|
71
|
-
writeGzip(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
|
|
72
|
-
writeBrotli(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
|
|
73
|
-
tryFile(file: string | Buffer, options: CompressFormat): Promise<BufferResult>;
|
|
74
|
-
tryFile(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
|
|
75
|
-
tryImage(file: string, options: CompressFormat): Promise<BufferResult>;
|
|
76
|
-
tryImage(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
|
|
77
|
-
set chunkSize(value: Undef<number | string>);
|
|
78
|
-
get chunkSize(): Undef<number>;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
interface CompressConstructor<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
|
|
82
|
-
singleton(): ICompress<T, U>;
|
|
83
|
-
readonly prototype: ICompress<T, U>;
|
|
84
|
-
new(module?: U): ICompress<T, U>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U> {
|
|
88
|
-
resizeData?: ResizeData;
|
|
89
|
-
cropData?: CropData;
|
|
90
|
-
rotateData?: RotateData;
|
|
91
|
-
qualityData?: QualityData;
|
|
92
|
-
methodData?: [string, unknown[]?][];
|
|
93
|
-
opacityValue?: number;
|
|
94
|
-
setCommand(value: string | CommandData, outputAs?: string): void;
|
|
95
|
-
getCommand(): string;
|
|
96
|
-
parseCommand(value: string): CommandData;
|
|
97
|
-
parseMethod(value: string): Undef<[string, unknown[]?][]>;
|
|
98
|
-
parseResize(value: string): Undef<ResizeData>;
|
|
99
|
-
parseCrop(value: string): Undef<CropData>;
|
|
100
|
-
parseRotate(value: string): Undef<RotateData>;
|
|
101
|
-
parseQuality(value: string): Undef<QualityData>;
|
|
102
|
-
parseOpacity(value: string): number;
|
|
103
|
-
using?<V extends ExternalAsset>(data: IFileThread<V>, command: string): Promise<unknown>;
|
|
104
|
-
get outputAs(): string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
|
|
108
|
-
readonly REGEXP_SIZERANGE: RegExp;
|
|
109
|
-
transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Null<Buffer>>;
|
|
110
|
-
clamp(value: unknown, min?: number, max?: number): number;
|
|
111
|
-
isBinary(mime: unknown): mime is string;
|
|
112
|
-
toABGR(buffer: Uint8Array | Buffer): Buffer;
|
|
113
|
-
readonly prototype: IImage<T, U>;
|
|
114
|
-
new(module?: U, ...args: unknown[]): IImage<T, U>;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
|
|
118
|
-
using?<V extends ExternalAsset>(data: IFileThread<V>): Promise<unknown>;
|
|
119
|
-
collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
|
|
120
|
-
map?(tasks: Command[]): Promise<Void<SpawnResult>>[];
|
|
121
|
-
series?(tasks: Command[]): Promise<unknown>;
|
|
122
|
-
parallel?(tasks: Command[]): Promise<unknown>;
|
|
123
|
-
spawn?(task: PlainObject, callback: (result?: SpawnResult) => void): void;
|
|
124
|
-
execute?<V extends IFileManager<W>, W extends ExternalAsset>(manager: V, task: PlainObject, callback: (value?: unknown) => void): void;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
|
|
128
|
-
finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
|
|
129
|
-
readonly prototype: ITask<T, U>;
|
|
130
|
-
new(module?: U, ...args: unknown[]): ITask<T, U>;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
interface IDb<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource, W extends DbSourceOptions = DbSourceOptions, X extends DbCoerceSettings = DbCoerceSettings> extends IClientDb<T, U, V, W, X> {
|
|
134
|
-
setCredential(item: V): Promise<void>;
|
|
135
|
-
getCredential<Y = PlainObject>(item: V): Undef<Y>;
|
|
136
|
-
hasSource(source: string, ...type: number[]): boolean;
|
|
137
|
-
applyCommand(...items: V[]): void;
|
|
138
|
-
executeQuery(item: V, callback: ErrorQueryCallback): Promise<QueryResult>;
|
|
139
|
-
executeQuery(item: V, sessionKey: string): Promise<QueryResult>;
|
|
140
|
-
executeQuery(item: V, options?: ExecuteQueryOptions | string): Promise<QueryResult>;
|
|
141
|
-
executeBatchQuery(batch: V[], callback: ErrorQueryCallback, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
142
|
-
executeBatchQuery(batch: V[], sessionKey: string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
143
|
-
executeBatchQuery(batch: V[], options?: ExecuteBatchQueryOptions | string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
144
|
-
processRows(batch: V[], tasks: Promise<Null<QueryResult>>[], parallel: boolean): Promise<BatchQueryResult>;
|
|
145
|
-
processRows(batch: V[], tasks: Promise<Null<QueryResult>>[], options?: ProcessRowsOptions, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
146
|
-
handleFail(err: unknown, item: V, options?: HandleFailOptions): boolean;
|
|
147
|
-
readTLSCert(value: unknown, cache?: boolean): string;
|
|
148
|
-
readTLSConfig(options: SecureContextOptions, cache?: boolean): void;
|
|
149
|
-
settingsOf(source: string, name: keyof Omit<W, "coerce">): unknown;
|
|
150
|
-
settingsOf(source: string, name: "coerce", component: keyof X): unknown;
|
|
151
|
-
settingsKey(source: string, name: keyof Omit<W, "coerce">): unknown;
|
|
152
|
-
settingsKey(source: string, name: "coerce", component: keyof X): unknown;
|
|
153
|
-
getPoolConfig(source: string, uuidKey?: string): Undef<Required<PoolConfig>>;
|
|
154
|
-
get sourceType(): DB_TYPE;
|
|
155
|
-
get commandType(): SQL_COMMAND;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
interface DbConstructor<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource> extends ClientDbConstructor<T> {
|
|
159
|
-
setPoolConfig(value: ObjectMap<PoolConfig>): void;
|
|
160
|
-
getPoolConfig(source: string): Undef<Required<PoolConfig>>;
|
|
161
|
-
readonly prototype: IDb<T, U, V>;
|
|
162
|
-
new(module?: U, database?: V[], ...args: unknown[]): IDb<T, U, V>;
|
|
163
|
-
}
|
|
164
|
-
|
|
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
|
-
readonly uploaded: string[];
|
|
167
|
-
readonly downloaded: string[];
|
|
168
|
-
createBucket(service: string, credential: unknown, bucket: string, acl?: unknown, options?: unknown): Promise<boolean>;
|
|
169
|
-
createBucket(service: string, credential: unknown, bucket: string, publicRead?: boolean): Promise<boolean>;
|
|
170
|
-
setBucketPolicy(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
|
|
171
|
-
setBucketTagging(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
|
|
172
|
-
setBucketWebsite(service: string, credential: unknown, bucket: string, options: BucketWebsiteOptions): Promise<boolean>;
|
|
173
|
-
deleteObjects(service: string, credential: unknown, bucket: string, recursive?: boolean): Promise<void>;
|
|
174
|
-
uploadObject(service: string, credential: unknown, bucket: string, upload: CloudStorageUpload, localUri: string, beforeResolve?: (value: string) => Void<Promise<void>>): Promise<string>;
|
|
175
|
-
downloadObject(service: string, credential: unknown, bucket: string, download: CloudStorageDownload, beforeResolve?: (value: Null<Bufferable>) => Void<Promise<Undef<string>>>): Promise<Bufferable>;
|
|
176
|
-
getStorage(action: CloudFunctions, data: Undef<CloudStorage[]>): Undef<CloudStorage>;
|
|
177
|
-
hasStorage(action: CloudFunctions, storage: CloudStorage): CloudStorageUpload | false;
|
|
178
|
-
getDatabaseRows(item: V, ignoreErrors: boolean, sessionKey?: string): Promise<QueryResult>;
|
|
179
|
-
getDatabaseRows(item: V, sessionKey?: string): Promise<QueryResult>;
|
|
180
|
-
getDatabaseBatchRows(batch: V[], ignoreErrors: boolean, sessionKey?: string): Promise<BatchQueryResult>;
|
|
181
|
-
getDatabaseBatchRows(batch: V[], sessionKey?: string): Promise<BatchQueryResult>;
|
|
182
|
-
hasCredential(feature: CloudFeatures, data: CloudService, credential?: unknown): boolean;
|
|
183
|
-
getCredential(item: CloudService, unused?: boolean): PlainObject;
|
|
184
|
-
getSettings(service: string): Undef<AnyObject>;
|
|
185
|
-
settingsOf(service: string, name: "cache"): unknown;
|
|
186
|
-
settingsOf(service: string, name: "coerce", component: keyof DbCoerceSettings): unknown;
|
|
187
|
-
settingsOf(service: string, name: "auth", component: keyof CloudAuthSettings): unknown;
|
|
188
|
-
getUploadHandler(service: string, credential: unknown): FunctionType<void>;
|
|
189
|
-
getDownloadHandler(service: string, credential: unknown): FunctionType<void>;
|
|
190
|
-
resolveService(service: string, folder?: string): string;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
interface CloudConstructor<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase> extends ClientDbConstructor<T> {
|
|
194
|
-
LOG_CLOUD_FAIL: LogMessageOptions;
|
|
195
|
-
LOG_CLOUD_COMMAND: LogMessageOptions;
|
|
196
|
-
LOG_CLOUD_WARN: LogMessageOptions;
|
|
197
|
-
LOG_CLOUD_UPLOAD: LogMessageOptions;
|
|
198
|
-
LOG_CLOUD_DOWNLOAD: LogMessageOptions;
|
|
199
|
-
LOG_CLOUD_DELETE: LogMessageOptions;
|
|
200
|
-
LOG_CLOUD_DELAYED: LogMessageOptions;
|
|
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
|
-
sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
|
|
206
|
-
readonly prototype: ICloud<T, U, V>;
|
|
207
|
-
new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
interface IDocument<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends IClient<T, V, TransformCallback<T, U>> {
|
|
211
|
-
Db: Null<IDb>;
|
|
212
|
-
assets: U[];
|
|
213
|
-
config: StandardMap;
|
|
214
|
-
init(assets: U[], config?: HostInitConfig): this;
|
|
215
|
-
customize(options?: CustomizeDocument): void;
|
|
216
|
-
findConfig(data: object, name: string, type?: string): PluginConfig;
|
|
217
|
-
loadConfig(data: object, name: string): Optional<ConfigOrTransformer>;
|
|
218
|
-
asSourceFile(value: string, cache: boolean): unknown;
|
|
219
|
-
asSourceFile(value: string, options?: AsSourceFileOptions): unknown;
|
|
220
|
-
findVersion(name: ArrayOf<string>, fallback?: string): string;
|
|
221
|
-
findSourceScope(uri: string, imports: AnyObject): StringMap[];
|
|
222
|
-
findSourceRoot(uri: string, imports?: StringMap): Undef<string>;
|
|
223
|
-
resolveDir(name: string, ...paths: string[]): Undef<string>;
|
|
224
|
-
locateSourceFiles(file: U, code?: string, bundleContent?: string[]): (imports?: StringMap) => Undef<SourceInput>;
|
|
225
|
-
resolveSourceFile(file: U): (code?: string, imports?: StringMap) => Undef<SourceInput<string>>;
|
|
226
|
-
tryParse(source: string, format: string, options?: PlainObject): unknown;
|
|
227
|
-
forDb(item: DataSource): boolean;
|
|
228
|
-
hasEval(name: string): boolean;
|
|
229
|
-
settingsOf(name: keyof W, option: keyof X): unknown;
|
|
230
|
-
parseTemplate(viewEngine: ViewEngine | string, template: string, data: unknown[]): Promise<Null<string>>;
|
|
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;
|
|
234
|
-
restart(): void;
|
|
235
|
-
using?(data: IFileThread<U>): Promise<unknown>;
|
|
236
|
-
setLocalUri?(file: U, replace?: boolean): void;
|
|
237
|
-
resolveUri?(file: U, source: string): string;
|
|
238
|
-
resolveUri?(file: U, source: string, trailing: string): TupleOf<string>;
|
|
239
|
-
resolveImports?(file: U, code: string, baseFile?: string | U): Undef<string>;
|
|
240
|
-
replaceContent?(source: string, statement: RegExpExecArray | string, mimeType?: string): Undef<string>;
|
|
241
|
-
addCopy?(data: FileCommand<U>, saveAs: string, replace?: boolean): Undef<string>;
|
|
242
|
-
writeImage?(output: OutputFinalize<U>): boolean;
|
|
243
|
-
cloudInit?(state: IScopeOrigin<T, Y>): void;
|
|
244
|
-
cloudObject?(state: IScopeOrigin<T, Y>, file: U): boolean;
|
|
245
|
-
cloudUpload?(state: IScopeOrigin<T, Y>, file: U, url: string, active: boolean): Promise<boolean>;
|
|
246
|
-
cloudFinalize?(state: IScopeOrigin<T, Y>): Promise<unknown[]>;
|
|
247
|
-
watchInit?(watch: IFileGroup<U>, assets: U[], sanitize?: boolean): Undef<WatchInitResult>;
|
|
248
|
-
watchModified?(watch: IFileGroup<U>, assets?: U[]): PostFinalizeCallback;
|
|
249
|
-
set dataSource(value: DataSource[]);
|
|
250
|
-
get dataSource(): DataSource[];
|
|
251
|
-
set imports(value);
|
|
252
|
-
get imports(): StringMap;
|
|
253
|
-
get watching(): boolean;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends ModuleConstructor {
|
|
257
|
-
finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
258
|
-
/** @deprecated */
|
|
259
|
-
createSourceMap(code: string, remove: boolean): SourceMap;
|
|
260
|
-
/** @deprecated */
|
|
261
|
-
createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
|
|
262
|
-
writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
|
|
263
|
-
updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
|
|
264
|
-
updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
|
|
265
|
-
generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
|
|
266
|
-
cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
267
|
-
sanitizeAssets?(assets: U[], exclusions?: unknown[]): U[];
|
|
268
|
-
readonly prototype: IDocument<T, U, V, W, X, Y>;
|
|
269
|
-
new(module?: V, ...args: unknown[]): IDocument<T, U, V, W, X, Y>;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
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> {
|
|
273
|
-
connectTimeout: number;
|
|
274
|
-
init(config?: HostInitConfig): this;
|
|
275
|
-
start(assets: U[], permission?: Null<IPermission>): void;
|
|
276
|
-
modified(watch: IFileGroup<U>): Promise<Void<FinalizeResult>>;
|
|
277
|
-
configureServer(options: SecureOptions): boolean;
|
|
278
|
-
setCA(value: string): boolean;
|
|
279
|
-
setSSLKey(value: string): boolean;
|
|
280
|
-
setSSLCert(value: string): boolean;
|
|
281
|
-
hasSecureProtocol(): boolean;
|
|
282
|
-
whenModified?(assets: U[], postFinalize: PostFinalizeCallback): IFileManager<U>;
|
|
283
|
-
whenModified?(assets: U[], sanitize?: boolean, postFinalize?: PostFinalizeCallback): IFileManager<U>;
|
|
284
|
-
set assets(value: U[]);
|
|
285
|
-
get assets(): U[];
|
|
286
|
-
set interval(value);
|
|
287
|
-
get interval(): number;
|
|
288
|
-
set port(value);
|
|
289
|
-
get port(): number;
|
|
290
|
-
set securePort(value);
|
|
291
|
-
get securePort(): number;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
|
|
295
|
-
createServer(port: number, active: boolean): Null<ws.Server>;
|
|
296
|
-
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
|
|
297
|
-
shutdown(): void;
|
|
298
|
-
setTimeout(value: number | string): void;
|
|
299
|
-
checkTimeout(client: ws): boolean;
|
|
300
|
-
readonly prototype: IWatch<T, U, V, W>;
|
|
301
|
-
new(module?: V): IWatch<T, U, V, W>;
|
|
302
|
-
new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
interface IRequest<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
|
|
306
|
-
startTime: number;
|
|
307
|
-
acceptEncoding: boolean;
|
|
308
|
-
keepAlive: Null<boolean>;
|
|
309
|
-
readTimeout: number;
|
|
310
|
-
readExpect: ReadExpectType;
|
|
311
|
-
proxy: Null<ProxySettings>;
|
|
312
|
-
init(config?: RequestInit): this;
|
|
313
|
-
apply(options: ApplyOptions): this;
|
|
314
|
-
addDns(hostname: string, address: string, timeout: number): void;
|
|
315
|
-
addDns(hostname: string, address: string, family?: number | string, timeout?: number): void;
|
|
316
|
-
lookupDns(hostname: string): LookupFunction;
|
|
317
|
-
proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
|
|
318
|
-
statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
|
|
319
|
-
statusOn(name: ArrayOf<number>, globUrl: string, callback: StatusOnCallback): void;
|
|
320
|
-
headersOn(name: ArrayOf<string>, callback: HeadersOnCallback): void;
|
|
321
|
-
headersOn(name: ArrayOf<string>, globUrl: string, callback: HeadersOnCallback): void;
|
|
322
|
-
headersOf(uri: string): Undef<OutgoingHttpHeaders>;
|
|
323
|
-
aria2c(uri: string | URL, pathname: string): Promise<string[]>;
|
|
324
|
-
aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
325
|
-
json(uri: string | URL, options?: OpenOptions): Promise<Null<object>>;
|
|
326
|
-
pipe(uri: string | URL, to: Writable, options?: OpenOptions): Promise<null>;
|
|
327
|
-
opts(url: string | URL, options?: OpenOptions): HostConfig;
|
|
328
|
-
open(uri: string | URL, options: OpenOptions): HttpRequestClient;
|
|
329
|
-
head(uri: string | URL, options?: OpenOptions): ClientRequest;
|
|
330
|
-
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
|
|
331
|
-
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
|
|
332
|
-
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
|
|
333
|
-
post<V extends PostOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
|
|
334
|
-
post<V extends PostOptions>(uri: string | URL, data: unknown, contentType?: string | FormDataPart[] | V, options?: V): Promise<DataObjectResult<V>>;
|
|
335
|
-
get<V extends OpenOptions, W extends V | BufferFormat>(uri: string | URL, options?: W): Promise<W extends BufferFormat ? Null<object> : DataEncodedResult<V>>;
|
|
336
|
-
detach(singleton?: boolean): void;
|
|
337
|
-
reset(): void;
|
|
338
|
-
close(): void;
|
|
339
|
-
set agentTimeout(value);
|
|
340
|
-
get agentTimeout(): number;
|
|
341
|
-
set httpVersion(value);
|
|
342
|
-
get httpVersion(): Null<HttpProtocolVersion>;
|
|
343
|
-
set ipVersion(value);
|
|
344
|
-
get ipVersion(): InternetProtocolVersion;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
interface RequestConstructor<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
|
|
348
|
-
readCACert(value: string, cache?: boolean): string;
|
|
349
|
-
readTLSKey(value: string, cache?: boolean): string;
|
|
350
|
-
readTLSCert(value: string, cache?: boolean): string;
|
|
351
|
-
isCert(value: string): boolean;
|
|
352
|
-
fromURL(url: URL, value: string): string;
|
|
353
|
-
fromStatusCode(value: number | string): string;
|
|
354
|
-
defineHttpAgent(options: HttpAgentSettings): void;
|
|
355
|
-
defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
|
|
356
|
-
getAria2Path(): string;
|
|
357
|
-
readonly prototype: IRequest<T, U>;
|
|
358
|
-
new(module?: T): IRequest<T, U>;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
interface IFileManager<T extends ExternalAsset = ExternalAsset> extends IHost, Set<string> {
|
|
362
|
-
processTimeout: number;
|
|
363
|
-
cacheToDisk: IHttpDiskCache<T>;
|
|
364
|
-
cacheToMemory: IHttpMemoryCache<T>;
|
|
365
|
-
Request: IRequest;
|
|
366
|
-
Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
|
|
367
|
-
Task: InstallData<ITask, TaskConstructor>[];
|
|
368
|
-
Image: Null<ImageMimeMap>;
|
|
369
|
-
Cloud: Null<ICloud>;
|
|
370
|
-
Watch: Null<WatchInstance<T>>;
|
|
371
|
-
Compress: Null<ICompress>;
|
|
372
|
-
readonly documentAssets: T[];
|
|
373
|
-
readonly taskAssets: (T & Required<TaskAction>)[];
|
|
374
|
-
readonly dataSourceItems: DataSource[];
|
|
375
|
-
readonly files: Set<string>;
|
|
376
|
-
readonly filesQueued: Set<string>;
|
|
377
|
-
readonly filesToRemove: Set<string>;
|
|
378
|
-
readonly filesToCompare: Map<T, string[]>;
|
|
379
|
-
readonly contentToAppend: Map<string, string[]>;
|
|
380
|
-
readonly contentToReplace: Map<string, string[]>;
|
|
381
|
-
readonly processing: IFileThread<T>[];
|
|
382
|
-
readonly fetchedAssets: T[];
|
|
383
|
-
readonly copiedAssets: T[];
|
|
384
|
-
readonly emptyDir: Set<string>;
|
|
385
|
-
install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
|
|
386
|
-
install(name: "document", target: DocumentConstructor<IFileManager<T>, T>, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
|
|
387
|
-
install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
|
|
388
|
-
install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
|
|
389
|
-
install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): Undef<ICloud>;
|
|
390
|
-
install(name: "cloud", module?: CloudModule): Undef<ICloud>;
|
|
391
|
-
install(name: "image", handler: string, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
|
|
392
|
-
install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
|
|
393
|
-
install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
|
|
394
|
-
install(name: "watch", module: WatchModule): Undef<WatchInstance<T>>;
|
|
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
|
-
install(name: string, ...args: unknown[]): Undef<IModule>;
|
|
398
|
-
using(...items: FirstOf<T>): this;
|
|
399
|
-
contains(item: T, condition?: FunctionArgs<[T], boolean>): boolean;
|
|
400
|
-
removeCwd(value: unknown): string;
|
|
401
|
-
findAsset(value: string | URL, instance?: IModule | FindAssetOptions<T>): Undef<T>;
|
|
402
|
-
removeAsset(file: T): boolean;
|
|
403
|
-
replace(file: T, replaceWith: string, mimeType: Undef<string>): boolean;
|
|
404
|
-
replace(file: T, replaceWith: string, options?: ReplaceOptions): boolean;
|
|
405
|
-
rename(file: T, value: string): boolean;
|
|
406
|
-
performAsyncTask(): void;
|
|
407
|
-
removeAsyncTask(): void;
|
|
408
|
-
completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: number): void;
|
|
409
|
-
performFinalize(override?: boolean): void;
|
|
410
|
-
hasDocument(instance: IModule, document: Undef<ArrayOf<string>>): boolean;
|
|
411
|
-
getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
|
|
412
|
-
getDataSourceItems(instance: IModule, condition?: FunctionArgs<[DataSource], boolean>): DataSource[];
|
|
413
|
-
checkFilename(file: T, pathname?: string): string;
|
|
414
|
-
setLocalUri(file: T, replace?: boolean): FileOutput;
|
|
415
|
-
getLocalUri(data: FileData<T>): string;
|
|
416
|
-
getMimeType(data: FileData<T>): string;
|
|
417
|
-
openThread(instance: IModule, data: IFileThread<T>, timeout?: number): boolean;
|
|
418
|
-
closeThread(instance: Null<IModule>, data: IFileThread<T>, callback?: FunctionType<void>): boolean;
|
|
419
|
-
addProcessTimeout(instance: IModule, file: T, timeout: number): void;
|
|
420
|
-
removeProcessTimeout(instance: IModule, file: T): void;
|
|
421
|
-
getProcessTimeout(handler: InstallData): number;
|
|
422
|
-
clearProcessTimeout(): void;
|
|
423
|
-
scheduleTask(url: string | URL, data: unknown, priority: number): Promise<unknown>;
|
|
424
|
-
scheduleTask(url: string | URL, data: unknown, thenCallback?: FunctionType, catchCallback?: FunctionType, priority?: number): Promise<unknown>;
|
|
425
|
-
setTaskLimit(value: number): void;
|
|
426
|
-
addDownload(value: number | Bufferable, encoding: BufferEncoding): number;
|
|
427
|
-
addDownload(value: number | Bufferable, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
|
|
428
|
-
getDownload(type?: number): TupleOf<number>;
|
|
429
|
-
transformAsset(data: IFileThread<T>, parent?: T, override?: boolean): Promise<boolean>;
|
|
430
|
-
addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): Undef<string>;
|
|
431
|
-
findMime(file: T, rename?: boolean): Promise<string>;
|
|
432
|
-
getUTF8String(file: T, uri?: string): string;
|
|
433
|
-
getBuffer<U>(file: T, minStreamSize?: U): U extends number ? Promise<Null<Buffer>> : Null<Buffer>;
|
|
434
|
-
getCacheDir(url: string | URL, createDir?: boolean): string;
|
|
435
|
-
setAssetContent(file: T, content: string, options?: AssetContentOptions): string;
|
|
436
|
-
getAssetContent(file: T, content?: string): Undef<string>;
|
|
437
|
-
writeBuffer(file: T, options?: WriteFileOptions): Null<Buffer>;
|
|
438
|
-
writeImage(document: ArrayOf<string>, output: OutputFinalize<T>): boolean;
|
|
439
|
-
compressFile(file: T, overwrite?: boolean): Promise<unknown>;
|
|
440
|
-
fetchObject(uri: string | URL, format: BufferFormat): Promise<Null<object>>;
|
|
441
|
-
fetchObject(uri: string | URL, options?: OpenOptions | BufferFormat): Promise<Null<object>>;
|
|
442
|
-
fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
|
|
443
|
-
fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
|
|
444
|
-
fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
445
|
-
updateProgress(name: "request", id: number | string, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
|
|
446
|
-
start(emptyDir?: boolean): Promise<FinalizeResult>;
|
|
447
|
-
processAssets(emptyDir?: boolean, using?: T[]): void;
|
|
448
|
-
deleteFile<U extends Promise<void>>(src: string, promises: boolean): U;
|
|
449
|
-
deleteFile<U extends Promise<void>>(src: string, options: DeleteFileOptions & DeleteFileAddendum, promises: boolean): U;
|
|
450
|
-
deleteFile<U extends NoParamCallback>(src: string, callback?: U): unknown;
|
|
451
|
-
deleteFile<U extends NoParamCallback>(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: U): unknown;
|
|
452
|
-
restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
|
|
453
|
-
restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
|
|
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>;
|
|
460
|
-
finalize(): Promise<void>;
|
|
461
|
-
close(): void;
|
|
462
|
-
reset(): boolean;
|
|
463
|
-
get baseDirectory(): string;
|
|
464
|
-
get config(): RequestData<T>;
|
|
465
|
-
get assets(): T[];
|
|
466
|
-
get incremental(): IncrementalMatch;
|
|
467
|
-
set restarting(value);
|
|
468
|
-
get restarting(): boolean;
|
|
469
|
-
get delayed(): number;
|
|
470
|
-
set cleared(value);
|
|
471
|
-
get cleared(): boolean;
|
|
472
|
-
set finalizeState(value);
|
|
473
|
-
get finalizeState(): number;
|
|
474
|
-
|
|
475
|
-
/* Set */
|
|
476
|
-
add(value: string, parent?: T, type?: number): this;
|
|
477
|
-
delete(value: string, emptyDir?: boolean): boolean;
|
|
478
|
-
has(value: unknown): value is string;
|
|
479
|
-
|
|
480
|
-
/* EventEmitter */
|
|
481
|
-
on(event: "end", listener: PostFinalizeCallback): this;
|
|
482
|
-
on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
483
|
-
on(event: "error", listener: (err: Error) => void): this;
|
|
484
|
-
on(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
485
|
-
on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
486
|
-
on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
487
|
-
on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
488
|
-
on(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
489
|
-
on(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
490
|
-
on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
491
|
-
once(event: "end", listener: PostFinalizeCallback): this;
|
|
492
|
-
once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
493
|
-
once(event: "error", listener: (err: Error) => void): this;
|
|
494
|
-
once(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
495
|
-
once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
496
|
-
once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
497
|
-
once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
498
|
-
once(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
499
|
-
once(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
500
|
-
once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
501
|
-
emit(event: "end", result: FinalizeResult): boolean;
|
|
502
|
-
emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
|
|
503
|
-
emit(event: "error", err: Error): boolean;
|
|
504
|
-
emit(event: "file:read", src: string, data: Bufferable, options?: ReadFileOptions): boolean;
|
|
505
|
-
emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
|
|
506
|
-
emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
|
|
507
|
-
emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
|
|
508
|
-
emit(event: "file:move", dest: string, options?: MoveFileOptions): boolean;
|
|
509
|
-
emit(event: "dir:create", src: string, options?: CreateDirOptions): boolean;
|
|
510
|
-
emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
interface FileManagerConstructor<T extends ExternalAsset> extends HostConstructor {
|
|
514
|
-
purgeMemory(percent?: number, limit?: number | boolean, parent?: number | boolean): Promise<number>;
|
|
515
|
-
loadSettings(settings: Settings, password?: string): boolean;
|
|
516
|
-
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
517
|
-
sanitizeAssets(assets: T[], exclusions?: string[]): T[];
|
|
518
|
-
writeChecksum(root: string, options: ChecksumOptions): Promise<string[]>;
|
|
519
|
-
writeChecksum(root: string, to?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<string[]>>;
|
|
520
|
-
verifyChecksum(root: string, options: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
|
|
521
|
-
verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
|
|
522
|
-
createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
|
|
523
|
-
setTimeout(options: ObjectMap<number | string>): void;
|
|
524
|
-
defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
|
|
525
|
-
defineHttpConnect(options: HttpConnectSettings): void;
|
|
526
|
-
readonly prototype: IFileManager<T>;
|
|
527
|
-
new(baseDirectory: string, config: RequestData<T>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
|
|
528
|
-
new(baseDirectory: string, config: RequestData<T>, permission?: Null<IPermission>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
interface IHost extends IModule {
|
|
532
|
-
restartable: boolean;
|
|
533
|
-
readonly modules: Set<IModule>;
|
|
534
|
-
readonly subProcesses: Set<IModule>;
|
|
535
|
-
readonly startTime: number;
|
|
536
|
-
using(...items: FirstOf<unknown>): this;
|
|
537
|
-
contains(item: unknown, condition?: FunctionType<boolean, any>): boolean;
|
|
538
|
-
find(name: string): Undef<IModule>;
|
|
539
|
-
findAll(name: string): IModule[];
|
|
540
|
-
willLog(name: string): boolean;
|
|
541
|
-
ignoreLog(values: boolean | ArrayOf<string>): void;
|
|
542
|
-
collectLog(level?: boolean): LogStatus<StatusType>[];
|
|
543
|
-
pauseLog(type?: string): void;
|
|
544
|
-
resumeLog(type?: string): void;
|
|
545
|
-
hasLog(type: string): boolean;
|
|
546
|
-
delayMessage(...args: unknown[]): void;
|
|
547
|
-
willAbort(value: string | IModule): boolean;
|
|
548
|
-
loadModule(name: string, ...args: any[]): Null<IModule>;
|
|
549
|
-
retain(process: IModule): void;
|
|
550
|
-
release(process: IModule, log?: boolean): boolean;
|
|
551
|
-
restart(...args: unknown[]): void;
|
|
552
|
-
joinQueue(options?: JoinQueueOptions): boolean;
|
|
553
|
-
updateProgress(name: string, ...args: unknown[]): void;
|
|
554
|
-
resumeThread?(options: ResumeThreadOptions): void;
|
|
555
|
-
set host(value);
|
|
556
|
-
get host(): null;
|
|
557
|
-
get config(): Readonly<HostInitConfig>;
|
|
558
|
-
get username(): string;
|
|
559
|
-
set done(value);
|
|
560
|
-
get done(): boolean;
|
|
561
|
-
get queued(): boolean;
|
|
562
|
-
get logState(): LogState;
|
|
563
|
-
get errorCount(): number;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
interface HostConstructor extends ModuleConstructor {
|
|
567
|
-
loadSettings(settings: Settings, password?: string): boolean;
|
|
568
|
-
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
569
|
-
isPermission(value: unknown): value is IPermission;
|
|
570
|
-
createPermission(all?: boolean, freeze?: boolean): IPermission;
|
|
571
|
-
kill(username: string, iv: BinaryLike, all: true): number;
|
|
572
|
-
kill(username: string, iv: BinaryLike, pid: ArrayOf<number>): number;
|
|
573
|
-
getThreadCount(full: true): ThreadCountStat;
|
|
574
|
-
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
575
|
-
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
576
|
-
getLogDelayed(): FormatMessageArgs[];
|
|
577
|
-
getPermissionFromSettings(): IPermission;
|
|
578
|
-
readonly prototype: IHost;
|
|
579
|
-
new(config?: HostInitConfig): IHost;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
|
|
583
|
-
readonly status: LogStatus<StatusType>[];
|
|
584
|
-
readonly errors: unknown[];
|
|
585
|
-
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
586
|
-
supports(name: string, value?: boolean): boolean;
|
|
587
|
-
getTempDir(options: TempDirOptions): string;
|
|
588
|
-
getTempDir(uuidDir: boolean, createDir: boolean): string;
|
|
589
|
-
getTempDir(pathname: string, createDir: boolean): string;
|
|
590
|
-
getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
|
|
591
|
-
getTempDir(pathname?: string, filename?: string, createDir?: boolean): string;
|
|
592
|
-
canRead(uri: string | URL, options?: PermissionOptions): boolean;
|
|
593
|
-
canWrite(uri: string | URL, options?: PermissionOptions): boolean;
|
|
594
|
-
readFile(src: string | URL): Undef<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>;
|
|
596
|
-
readFile<U extends Buffer>(src: string | URL, promises: true): Promise<Undef<U>>;
|
|
597
|
-
readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
|
|
598
|
-
readFile<U extends ReadFileCallback>(src: string | URL, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : Bufferable>;
|
|
599
|
-
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>;
|
|
600
|
-
writeFile<U extends boolean>(src: string | URL, data: BufferView, options?: WriteFileOptions): U;
|
|
601
|
-
writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, promises: true): U;
|
|
602
|
-
writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, options: WriteFileOptions, promises: true): U;
|
|
603
|
-
writeFile<U extends NoParamCallback>(src: string | URL, data: BufferView, callback: U): void;
|
|
604
|
-
writeFile<U extends NoParamCallback>(src: string | URL, data: BufferView, options: WriteFileOptions, callback: U): void;
|
|
605
|
-
deleteFile<U extends boolean>(src: string | URL, options?: DeleteFileOptions): U;
|
|
606
|
-
deleteFile<U extends Promise<boolean>>(src: string | URL, promises: true): U;
|
|
607
|
-
deleteFile<U extends Promise<boolean>>(src: string | URL, options: DeleteFileOptions, promises: true): U;
|
|
608
|
-
deleteFile<U extends NoParamCallback>(src: string | URL, callback: U): void;
|
|
609
|
-
deleteFile<U extends NoParamCallback>(src: string | URL, options: DeleteFileOptions, callback: U): void;
|
|
610
|
-
copyFile<U extends boolean>(src: string | URL, dest: string | URL, options?: CopyFileOptions): U;
|
|
611
|
-
copyFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, promises: true): U;
|
|
612
|
-
copyFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, options: CopyFileOptions, promises: true): U;
|
|
613
|
-
copyFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, callback: U): void;
|
|
614
|
-
copyFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, options: CopyFileOptions, callback: U): void;
|
|
615
|
-
moveFile<U extends boolean>(src: string | URL, dest: string | URL, options?: MoveFileOptions): U;
|
|
616
|
-
moveFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, promises: true): U;
|
|
617
|
-
moveFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, options: MoveFileOptions, promises: true): U;
|
|
618
|
-
moveFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, callback: U): void;
|
|
619
|
-
moveFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, options: MoveFileOptions, callback: U): void;
|
|
620
|
-
createDir<U extends boolean>(src: string | URL, options?: CreateDirOptions): U;
|
|
621
|
-
createDir<U extends Promise<boolean>>(src: string | URL, promises: true): U;
|
|
622
|
-
createDir<U extends Promise<boolean>>(src: string | URL, options: CreateDirOptions, promises: true): U;
|
|
623
|
-
createDir<U extends NoParamCallback>(src: string | URL, callback: U): void;
|
|
624
|
-
createDir<U extends NoParamCallback>(src: string | URL, options: CreateDirOptions, callback: U): void;
|
|
625
|
-
removeDir<U extends boolean>(src: string | URL, options?: RemoveDirOptions): U;
|
|
626
|
-
removeDir<U extends Promise<boolean>>(src: string | URL, promises: true): U;
|
|
627
|
-
removeDir<U extends Promise<boolean>>(src: string | URL, options: RemoveDirOptions, promises: true): U;
|
|
628
|
-
removeDir<U extends NoParamCallback>(src: string | URL, callback: U): void;
|
|
629
|
-
removeDir<U extends NoParamCallback>(src: string | URL, options: RemoveDirOptions, callback: U): void;
|
|
630
|
-
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, type?: LogType): Promise<PromiseFulfilledResult<U>[]>;
|
|
631
|
-
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions): Promise<PromiseFulfilledResult<U>[]>;
|
|
632
|
-
formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
|
|
633
|
-
formatFail(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogFailOptions): void;
|
|
634
|
-
writeFail(value: LogValue, message?: unknown, type?: LogType): void;
|
|
635
|
-
writeFail(value: LogValue, message?: unknown, options?: LogFailOptions): void;
|
|
636
|
-
writeTimeProcess(title: string, value: string, startTime: LogTime, options?: LogProcessOptions): void;
|
|
637
|
-
writeTimeElapsed(title: string, value: LogValue, startTime: LogTime, options?: LogMessageOptions): void;
|
|
638
|
-
checkPackage(err: unknown, name: Undef<string>, type: LogType): boolean;
|
|
639
|
-
checkPackage(err: unknown, name: Undef<string>, options: LogFailOptions): boolean;
|
|
640
|
-
checkPackage(err: unknown, name: Undef<string>, value?: LogValue, options?: LogFailOptions | LogType): boolean;
|
|
641
|
-
checkFail(message: unknown, options: LogFailOptions): Undef<LogArguments | false>;
|
|
642
|
-
writeLog(component: LogComponent, queue?: boolean): void;
|
|
643
|
-
writeLog(type: StatusType, value: unknown, options: LogOptions): void;
|
|
644
|
-
writeLog(type: StatusType, value: unknown, timeStamp?: LogDate, duration?: number): void;
|
|
645
|
-
addLog(component: LogComponent, queue?: boolean): void;
|
|
646
|
-
addLog(type: StatusType, value: unknown, options: LogOptions): void;
|
|
647
|
-
addLog(type: StatusType, value: unknown, from: string, source?: string): void;
|
|
648
|
-
addLog(type: StatusType, value: unknown, timeStamp?: LogDate, from?: string, source?: string): void;
|
|
649
|
-
addLog(type: StatusType, value: unknown, timeStamp?: LogDate, duration?: number, from?: string, source?: string): void;
|
|
650
|
-
getLog(...type: StatusType[]): LogStatus<StatusType>[];
|
|
651
|
-
flushLog(): void;
|
|
652
|
-
willAbort(value: unknown): boolean;
|
|
653
|
-
hasOwnPermission(): boolean;
|
|
654
|
-
isFatal(err?: unknown): boolean;
|
|
655
|
-
detach(): void;
|
|
656
|
-
reset(): void;
|
|
657
|
-
get moduleName(): string;
|
|
658
|
-
set host(value);
|
|
659
|
-
get host(): Null<T>;
|
|
660
|
-
set permission(value);
|
|
661
|
-
get permission(): Null<IPermission>;
|
|
662
|
-
get aborted(): boolean;
|
|
663
|
-
set abortable(value);
|
|
664
|
-
get abortable(): boolean;
|
|
665
|
-
get threadable(): boolean;
|
|
666
|
-
set sessionId(value);
|
|
667
|
-
get sessionId(): string;
|
|
668
|
-
set broadcastId(value);
|
|
669
|
-
get broadcastId(): ArrayOf<string>;
|
|
670
|
-
set silent(value);
|
|
671
|
-
get silent(): boolean;
|
|
672
|
-
get logType(): LOG_TYPE;
|
|
673
|
-
set logLevel(value: number | string);
|
|
674
|
-
get logLevel(): number;
|
|
675
|
-
get statusType(): STATUS_TYPE;
|
|
676
|
-
set tempDir(value);
|
|
677
|
-
get tempDir(): string;
|
|
678
|
-
|
|
679
|
-
/* EventEmitter */
|
|
680
|
-
on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
681
|
-
on(event: "error", listener: (err: Error) => void): this;
|
|
682
|
-
on(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
683
|
-
on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
684
|
-
on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
685
|
-
on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
686
|
-
on(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
687
|
-
on(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
688
|
-
on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
689
|
-
once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
690
|
-
once(event: "error", listener: (err: Error) => void): this;
|
|
691
|
-
once(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
692
|
-
once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
693
|
-
once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
694
|
-
once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
695
|
-
once(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
696
|
-
once(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
697
|
-
once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
698
|
-
emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
|
|
699
|
-
emit(event: "error", err: Error): boolean;
|
|
700
|
-
emit(event: "file:read", src: string, data: Bufferable, options?: ReadFileOptions): boolean;
|
|
701
|
-
emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
|
|
702
|
-
emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
|
|
703
|
-
emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
|
|
704
|
-
emit(event: "file:move", dest: string, options?: MoveFileOptions): boolean;
|
|
705
|
-
emit(event: "dir:create", src: string, options?: CreateDirOptions): boolean;
|
|
706
|
-
emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
interface ModuleConstructor<T extends IHost = IHost> {
|
|
710
|
-
PROCESS_TIMEOUT: number;
|
|
711
|
-
LOG_STYLE_FAIL: LogMessageOptions;
|
|
712
|
-
LOG_STYLE_SUCCESS: LogMessageOptions;
|
|
713
|
-
LOG_STYLE_INFO: LogMessageOptions;
|
|
714
|
-
LOG_STYLE_WARN: LogMessageOptions;
|
|
715
|
-
LOG_STYLE_NOTICE: LogMessageOptions;
|
|
716
|
-
LOG_STYLE_REVERSE: LogMessageOptions;
|
|
717
|
-
readonly VERSION: string;
|
|
718
|
-
readonly LOG_TYPE: LOG_TYPE;
|
|
719
|
-
readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
|
|
720
|
-
readonly STATUS_TYPE: STATUS_TYPE;
|
|
721
|
-
readonly PLATFORM_WIN32: boolean;
|
|
722
|
-
readonly MAX_TIMEOUT: number;
|
|
723
|
-
readonly TEMP_DIR: string;
|
|
724
|
-
/** @deprecated Types.supported */
|
|
725
|
-
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
726
|
-
formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
|
|
727
|
-
writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
|
|
728
|
-
enabled(key: string, username?: string): boolean;
|
|
729
|
-
parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
|
|
730
|
-
parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
|
|
731
|
-
asString(value: unknown, cacheKey?: boolean | "throws"): string;
|
|
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;
|
|
735
|
-
readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
|
|
736
|
-
toPosix(value: unknown, normalize: boolean): string;
|
|
737
|
-
toPosix(value: unknown, filename?: string, normalize?: boolean): string;
|
|
738
|
-
hasLogType(value: LogType): boolean;
|
|
739
|
-
isURL(value: string, ...exclude: string[]): boolean;
|
|
740
|
-
isFile(value: string | URL, type?: ProtocolType): boolean;
|
|
741
|
-
isDir(value: string | URL): boolean;
|
|
742
|
-
isPath(value: string | URL, type?: "unc" | "unc-exists"): boolean;
|
|
743
|
-
isPath(value: string | URL, isFile?: boolean): boolean;
|
|
744
|
-
isErrorCode(err: unknown, ...code: string[]): boolean;
|
|
745
|
-
fromLocalPath(value: string): string;
|
|
746
|
-
resolveFile(value: string): string;
|
|
747
|
-
resolvePath(value: string, base: string | URL): string;
|
|
748
|
-
joinPath(...values: [...paths: unknown[], normalize: boolean][]): string;
|
|
749
|
-
joinPath(...values: unknown[]): string;
|
|
750
|
-
normalizePath(value: unknown, flags?: boolean | number): string;
|
|
751
|
-
createDir(value: string | URL, overwrite?: boolean): boolean;
|
|
752
|
-
removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
|
|
753
|
-
removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
|
|
754
|
-
copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
|
|
755
|
-
copyDir(src: string | URL, dest: string | URL, options?: CopyDirOptions): Promise<CopyDirResult>;
|
|
756
|
-
renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
|
|
757
|
-
streamFile<U extends Bufferable>(value: string | URL, cache: boolean): Promise<U>;
|
|
758
|
-
streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
759
|
-
streamFile<U extends ReadBufferOptions>(value: string | URL, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
760
|
-
readText(value: string | URL, cache: boolean): string;
|
|
761
|
-
readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<string> : string;
|
|
762
|
-
readText(value: string | URL, encoding?: BufferEncoding | ReadTextOptions, cache?: boolean): string;
|
|
763
|
-
readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<Null<Buffer>> : Null<Buffer>;
|
|
764
|
-
readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Null<Buffer>;
|
|
765
|
-
resolveMime(data: FileTypeFormat): Promise<Undef<FileTypeResult>>;
|
|
766
|
-
lookupMime(value: string, extension?: boolean): string;
|
|
767
|
-
initCpuUsage(instance?: IModule): CpuUsage;
|
|
768
|
-
getCpuUsage(start: CpuUsage, format: true): string;
|
|
769
|
-
getCpuUsage(start: CpuUsage, format?: boolean): number;
|
|
770
|
-
getMemUsage(format: true): string;
|
|
771
|
-
getMemUsage(format?: boolean): number;
|
|
772
|
-
formatCpuMem(start: CpuUsage, all?: boolean): string;
|
|
773
|
-
getPackageVersion(name: string | TupleOf<string>, startDir: string, baseDir?: string): string;
|
|
774
|
-
getPackageVersion(name: string | TupleOf<string>, unstable?: boolean, startDir?: string, baseDir?: string): string;
|
|
775
|
-
checkSemVer(name: string | TupleOf<string>, options: CheckSemVerOptions): boolean;
|
|
776
|
-
|
|
777
|
-
checkSemVer(name: string | TupleOf<string>, min: number | string, max
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
sanitizeArgs(
|
|
781
|
-
|
|
782
|
-
purgeMemory(percent
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
|
|
1
|
+
/// <reference path="type.d.ts" />
|
|
2
|
+
/// <reference path="object.d.ts" />
|
|
3
|
+
|
|
4
|
+
import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction, ViewEngine } from './squared';
|
|
5
|
+
|
|
6
|
+
import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
|
|
7
|
+
import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, UploadAssetOptions } from './cloud';
|
|
8
|
+
import type { BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
|
|
9
|
+
import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
10
|
+
import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
|
|
11
|
+
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
|
|
12
|
+
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
13
|
+
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
14
|
+
import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
|
|
15
|
+
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
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';
|
|
17
|
+
import type { RequestData, Settings } from './node';
|
|
18
|
+
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
|
|
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';
|
|
20
|
+
import type { Command, SpawnResult } from './task';
|
|
21
|
+
import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
|
|
22
|
+
|
|
23
|
+
import type { SpawnOptions } from 'child_process';
|
|
24
|
+
import type { BinaryLike, BinaryToTextEncoding, HashOptions } from 'crypto';
|
|
25
|
+
import type { NoParamCallback, WriteStream } from 'fs';
|
|
26
|
+
import type { ClientRequest, OutgoingHttpHeaders } from 'http';
|
|
27
|
+
import type { LookupFunction } from 'net';
|
|
28
|
+
import type { Readable, Writable } from 'stream';
|
|
29
|
+
import type { SecureContextOptions } from 'tls';
|
|
30
|
+
import type { BrotliCompress, Gzip } from 'zlib';
|
|
31
|
+
|
|
32
|
+
import type * as EventEmitter from 'events';
|
|
33
|
+
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
import type * as ws from 'ws';
|
|
36
|
+
import type { FileTypeResult } from 'file-type';
|
|
37
|
+
|
|
38
|
+
type BufferView = Bufferable | NodeJS.ArrayBufferView;
|
|
39
|
+
type CpuUsage = NodeJS.CpuUsage;
|
|
40
|
+
|
|
41
|
+
declare namespace functions {
|
|
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];
|
|
44
|
+
|
|
45
|
+
interface IScopeOrigin<T extends IHost = IHost, U extends IModule = IModule> {
|
|
46
|
+
host?: T;
|
|
47
|
+
instance?: U;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface IExternalConfig<T extends HandlerSettings, U extends PlainObject = PlainObject> {
|
|
51
|
+
module: T;
|
|
52
|
+
init(...args: unknown[]): this;
|
|
53
|
+
get settings(): U;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface IExternalFunction<T extends FunctionType<any, any>> {
|
|
57
|
+
set extensions(values: unknown[]);
|
|
58
|
+
get extensions(): T[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface ICompress<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends IModule, IExternalConfig<T, U> {
|
|
62
|
+
level: ObjectMap<number>;
|
|
63
|
+
compressors: ObjectMap<TryFileCompressor>;
|
|
64
|
+
register(format: string, callback: TryFileCompressor): void;
|
|
65
|
+
getLevel(value: string, fallback?: number): Undef<number>;
|
|
66
|
+
getReadable(file: string | URL | Buffer, options?: ReadableOptions): Readable;
|
|
67
|
+
createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
|
|
68
|
+
createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
|
|
69
|
+
createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
|
|
70
|
+
createWriteStreamAsBrotli(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
|
|
71
|
+
writeGzip(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
|
|
72
|
+
writeBrotli(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
|
|
73
|
+
tryFile(file: string | Buffer, options: CompressFormat): Promise<BufferResult>;
|
|
74
|
+
tryFile(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
|
|
75
|
+
tryImage(file: string, options: CompressFormat): Promise<BufferResult>;
|
|
76
|
+
tryImage(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
|
|
77
|
+
set chunkSize(value: Undef<number | string>);
|
|
78
|
+
get chunkSize(): Undef<number>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface CompressConstructor<T extends CompressModule = CompressModule, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
|
|
82
|
+
singleton(): ICompress<T, U>;
|
|
83
|
+
readonly prototype: ICompress<T, U>;
|
|
84
|
+
new(module?: U): ICompress<T, U>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U> {
|
|
88
|
+
resizeData?: ResizeData;
|
|
89
|
+
cropData?: CropData;
|
|
90
|
+
rotateData?: RotateData;
|
|
91
|
+
qualityData?: QualityData;
|
|
92
|
+
methodData?: [string, unknown[]?][];
|
|
93
|
+
opacityValue?: number;
|
|
94
|
+
setCommand(value: string | CommandData, outputAs?: string): void;
|
|
95
|
+
getCommand(): string;
|
|
96
|
+
parseCommand(value: string): CommandData;
|
|
97
|
+
parseMethod(value: string): Undef<[string, unknown[]?][]>;
|
|
98
|
+
parseResize(value: string): Undef<ResizeData>;
|
|
99
|
+
parseCrop(value: string): Undef<CropData>;
|
|
100
|
+
parseRotate(value: string): Undef<RotateData>;
|
|
101
|
+
parseQuality(value: string): Undef<QualityData>;
|
|
102
|
+
parseOpacity(value: string): number;
|
|
103
|
+
using?<V extends ExternalAsset>(data: IFileThread<V>, command: string): Promise<unknown>;
|
|
104
|
+
get outputAs(): string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
|
|
108
|
+
readonly REGEXP_SIZERANGE: RegExp;
|
|
109
|
+
transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Null<Buffer>>;
|
|
110
|
+
clamp(value: unknown, min?: number, max?: number): number;
|
|
111
|
+
isBinary(mime: unknown): mime is string;
|
|
112
|
+
toABGR(buffer: Uint8Array | Buffer): Buffer;
|
|
113
|
+
readonly prototype: IImage<T, U>;
|
|
114
|
+
new(module?: U, ...args: unknown[]): IImage<T, U>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
|
|
118
|
+
using?<V extends ExternalAsset>(data: IFileThread<V>): Promise<unknown>;
|
|
119
|
+
collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
|
|
120
|
+
map?(tasks: Command[]): Promise<Void<SpawnResult>>[];
|
|
121
|
+
series?(tasks: Command[]): Promise<unknown>;
|
|
122
|
+
parallel?(tasks: Command[]): Promise<unknown>;
|
|
123
|
+
spawn?(task: PlainObject, callback: (result?: SpawnResult) => void): void;
|
|
124
|
+
execute?<V extends IFileManager<W>, W extends ExternalAsset>(manager: V, task: PlainObject, callback: (value?: unknown) => void): void;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
|
|
128
|
+
finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
|
|
129
|
+
readonly prototype: ITask<T, U>;
|
|
130
|
+
new(module?: U, ...args: unknown[]): ITask<T, U>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface IDb<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource, W extends DbSourceOptions = DbSourceOptions, X extends DbCoerceSettings = DbCoerceSettings> extends IClientDb<T, U, V, W, X> {
|
|
134
|
+
setCredential(item: V): Promise<void>;
|
|
135
|
+
getCredential<Y = PlainObject>(item: V): Undef<Y>;
|
|
136
|
+
hasSource(source: string, ...type: number[]): boolean;
|
|
137
|
+
applyCommand(...items: V[]): void;
|
|
138
|
+
executeQuery(item: V, callback: ErrorQueryCallback): Promise<QueryResult>;
|
|
139
|
+
executeQuery(item: V, sessionKey: string): Promise<QueryResult>;
|
|
140
|
+
executeQuery(item: V, options?: ExecuteQueryOptions | string): Promise<QueryResult>;
|
|
141
|
+
executeBatchQuery(batch: V[], callback: ErrorQueryCallback, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
142
|
+
executeBatchQuery(batch: V[], sessionKey: string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
143
|
+
executeBatchQuery(batch: V[], options?: ExecuteBatchQueryOptions | string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
144
|
+
processRows(batch: V[], tasks: Promise<Null<QueryResult>>[], parallel: boolean): Promise<BatchQueryResult>;
|
|
145
|
+
processRows(batch: V[], tasks: Promise<Null<QueryResult>>[], options?: ProcessRowsOptions, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
146
|
+
handleFail(err: unknown, item: V, options?: HandleFailOptions): boolean;
|
|
147
|
+
readTLSCert(value: unknown, cache?: boolean): string;
|
|
148
|
+
readTLSConfig(options: SecureContextOptions, cache?: boolean): void;
|
|
149
|
+
settingsOf(source: string, name: keyof Omit<W, "coerce">): unknown;
|
|
150
|
+
settingsOf(source: string, name: "coerce", component: keyof X): unknown;
|
|
151
|
+
settingsKey(source: string, name: keyof Omit<W, "coerce">): unknown;
|
|
152
|
+
settingsKey(source: string, name: "coerce", component: keyof X): unknown;
|
|
153
|
+
getPoolConfig(source: string, uuidKey?: string): Undef<Required<PoolConfig>>;
|
|
154
|
+
get sourceType(): DB_TYPE;
|
|
155
|
+
get commandType(): SQL_COMMAND;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface DbConstructor<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource> extends ClientDbConstructor<T> {
|
|
159
|
+
setPoolConfig(value: ObjectMap<PoolConfig>): void;
|
|
160
|
+
getPoolConfig(source: string): Undef<Required<PoolConfig>>;
|
|
161
|
+
readonly prototype: IDb<T, U, V>;
|
|
162
|
+
new(module?: U, database?: V[], ...args: unknown[]): IDb<T, U, V>;
|
|
163
|
+
}
|
|
164
|
+
|
|
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
|
+
readonly uploaded: string[];
|
|
167
|
+
readonly downloaded: string[];
|
|
168
|
+
createBucket(service: string, credential: unknown, bucket: string, acl?: unknown, options?: unknown): Promise<boolean>;
|
|
169
|
+
createBucket(service: string, credential: unknown, bucket: string, publicRead?: boolean): Promise<boolean>;
|
|
170
|
+
setBucketPolicy(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
|
|
171
|
+
setBucketTagging(service: string, credential: unknown, bucket: string, options: unknown): Promise<boolean>;
|
|
172
|
+
setBucketWebsite(service: string, credential: unknown, bucket: string, options: BucketWebsiteOptions): Promise<boolean>;
|
|
173
|
+
deleteObjects(service: string, credential: unknown, bucket: string, recursive?: boolean): Promise<void>;
|
|
174
|
+
uploadObject(service: string, credential: unknown, bucket: string, upload: CloudStorageUpload, localUri: string, beforeResolve?: (value: string) => Void<Promise<void>>): Promise<string>;
|
|
175
|
+
downloadObject(service: string, credential: unknown, bucket: string, download: CloudStorageDownload, beforeResolve?: (value: Null<Bufferable>) => Void<Promise<Undef<string>>>): Promise<Bufferable>;
|
|
176
|
+
getStorage(action: CloudFunctions, data: Undef<CloudStorage[]>): Undef<CloudStorage>;
|
|
177
|
+
hasStorage(action: CloudFunctions, storage: CloudStorage): CloudStorageUpload | false;
|
|
178
|
+
getDatabaseRows(item: V, ignoreErrors: boolean, sessionKey?: string): Promise<QueryResult>;
|
|
179
|
+
getDatabaseRows(item: V, sessionKey?: string): Promise<QueryResult>;
|
|
180
|
+
getDatabaseBatchRows(batch: V[], ignoreErrors: boolean, sessionKey?: string): Promise<BatchQueryResult>;
|
|
181
|
+
getDatabaseBatchRows(batch: V[], sessionKey?: string): Promise<BatchQueryResult>;
|
|
182
|
+
hasCredential(feature: CloudFeatures, data: CloudService, credential?: unknown): boolean;
|
|
183
|
+
getCredential(item: CloudService, unused?: boolean): PlainObject;
|
|
184
|
+
getSettings(service: string): Undef<AnyObject>;
|
|
185
|
+
settingsOf(service: string, name: "cache"): unknown;
|
|
186
|
+
settingsOf(service: string, name: "coerce", component: keyof DbCoerceSettings): unknown;
|
|
187
|
+
settingsOf(service: string, name: "auth", component: keyof CloudAuthSettings): unknown;
|
|
188
|
+
getUploadHandler(service: string, credential: unknown): FunctionType<void>;
|
|
189
|
+
getDownloadHandler(service: string, credential: unknown): FunctionType<void>;
|
|
190
|
+
resolveService(service: string, folder?: string): string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface CloudConstructor<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase> extends ClientDbConstructor<T> {
|
|
194
|
+
LOG_CLOUD_FAIL: LogMessageOptions;
|
|
195
|
+
LOG_CLOUD_COMMAND: LogMessageOptions;
|
|
196
|
+
LOG_CLOUD_WARN: LogMessageOptions;
|
|
197
|
+
LOG_CLOUD_UPLOAD: LogMessageOptions;
|
|
198
|
+
LOG_CLOUD_DOWNLOAD: LogMessageOptions;
|
|
199
|
+
LOG_CLOUD_DELETE: LogMessageOptions;
|
|
200
|
+
LOG_CLOUD_DELAYED: LogMessageOptions;
|
|
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
|
+
sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
|
|
206
|
+
readonly prototype: ICloud<T, U, V>;
|
|
207
|
+
new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface IDocument<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends IClient<T, V, TransformCallback<T, U>> {
|
|
211
|
+
Db: Null<IDb>;
|
|
212
|
+
assets: U[];
|
|
213
|
+
config: StandardMap;
|
|
214
|
+
init(assets: U[], config?: HostInitConfig): this;
|
|
215
|
+
customize(options?: CustomizeDocument): void;
|
|
216
|
+
findConfig(data: object, name: string, type?: string): PluginConfig;
|
|
217
|
+
loadConfig(data: object, name: string): Optional<ConfigOrTransformer>;
|
|
218
|
+
asSourceFile(value: string, cache: boolean): unknown;
|
|
219
|
+
asSourceFile(value: string, options?: AsSourceFileOptions): unknown;
|
|
220
|
+
findVersion(name: ArrayOf<string>, fallback?: string): string;
|
|
221
|
+
findSourceScope(uri: string, imports: AnyObject): StringMap[];
|
|
222
|
+
findSourceRoot(uri: string, imports?: StringMap): Undef<string>;
|
|
223
|
+
resolveDir(name: string, ...paths: string[]): Undef<string>;
|
|
224
|
+
locateSourceFiles(file: U, code?: string, bundleContent?: string[]): (imports?: StringMap) => Undef<SourceInput>;
|
|
225
|
+
resolveSourceFile(file: U): (code?: string, imports?: StringMap) => Undef<SourceInput<string>>;
|
|
226
|
+
tryParse(source: string, format: string, options?: PlainObject): unknown;
|
|
227
|
+
forDb(item: DataSource): boolean;
|
|
228
|
+
hasEval(name: string): boolean;
|
|
229
|
+
settingsOf(name: keyof W, option: keyof X): unknown;
|
|
230
|
+
parseTemplate(viewEngine: ViewEngine | string, template: string, data: unknown[]): Promise<Null<string>>;
|
|
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;
|
|
234
|
+
restart(): void;
|
|
235
|
+
using?(data: IFileThread<U>): Promise<unknown>;
|
|
236
|
+
setLocalUri?(file: U, replace?: boolean): void;
|
|
237
|
+
resolveUri?(file: U, source: string): string;
|
|
238
|
+
resolveUri?(file: U, source: string, trailing: string): TupleOf<string>;
|
|
239
|
+
resolveImports?(file: U, code: string, baseFile?: string | U): Undef<string>;
|
|
240
|
+
replaceContent?(source: string, statement: RegExpExecArray | string, mimeType?: string): Undef<string>;
|
|
241
|
+
addCopy?(data: FileCommand<U>, saveAs: string, replace?: boolean): Undef<string>;
|
|
242
|
+
writeImage?(output: OutputFinalize<U>): boolean;
|
|
243
|
+
cloudInit?(state: IScopeOrigin<T, Y>): void;
|
|
244
|
+
cloudObject?(state: IScopeOrigin<T, Y>, file: U): boolean;
|
|
245
|
+
cloudUpload?(state: IScopeOrigin<T, Y>, file: U, url: string, active: boolean): Promise<boolean>;
|
|
246
|
+
cloudFinalize?(state: IScopeOrigin<T, Y>): Promise<unknown[]>;
|
|
247
|
+
watchInit?(watch: IFileGroup<U>, assets: U[], sanitize?: boolean): Undef<WatchInitResult>;
|
|
248
|
+
watchModified?(watch: IFileGroup<U>, assets?: U[]): PostFinalizeCallback;
|
|
249
|
+
set dataSource(value: DataSource[]);
|
|
250
|
+
get dataSource(): DataSource[];
|
|
251
|
+
set imports(value);
|
|
252
|
+
get imports(): StringMap;
|
|
253
|
+
get watching(): boolean;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends ModuleConstructor {
|
|
257
|
+
finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
258
|
+
/** @deprecated */
|
|
259
|
+
createSourceMap(code: string, remove: boolean): SourceMap;
|
|
260
|
+
/** @deprecated */
|
|
261
|
+
createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
|
|
262
|
+
writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
|
|
263
|
+
updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
|
|
264
|
+
updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
|
|
265
|
+
generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
|
|
266
|
+
cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
267
|
+
sanitizeAssets?(assets: U[], exclusions?: unknown[]): U[];
|
|
268
|
+
readonly prototype: IDocument<T, U, V, W, X, Y>;
|
|
269
|
+
new(module?: V, ...args: unknown[]): IDocument<T, U, V, W, X, Y>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
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> {
|
|
273
|
+
connectTimeout: number;
|
|
274
|
+
init(config?: HostInitConfig): this;
|
|
275
|
+
start(assets: U[], permission?: Null<IPermission>): void;
|
|
276
|
+
modified(watch: IFileGroup<U>): Promise<Void<FinalizeResult>>;
|
|
277
|
+
configureServer(options: SecureOptions): boolean;
|
|
278
|
+
setCA(value: string): boolean;
|
|
279
|
+
setSSLKey(value: string): boolean;
|
|
280
|
+
setSSLCert(value: string): boolean;
|
|
281
|
+
hasSecureProtocol(): boolean;
|
|
282
|
+
whenModified?(assets: U[], postFinalize: PostFinalizeCallback): IFileManager<U>;
|
|
283
|
+
whenModified?(assets: U[], sanitize?: boolean, postFinalize?: PostFinalizeCallback): IFileManager<U>;
|
|
284
|
+
set assets(value: U[]);
|
|
285
|
+
get assets(): U[];
|
|
286
|
+
set interval(value);
|
|
287
|
+
get interval(): number;
|
|
288
|
+
set port(value);
|
|
289
|
+
get port(): number;
|
|
290
|
+
set securePort(value);
|
|
291
|
+
get securePort(): number;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
|
|
295
|
+
createServer(port: number, active: boolean): Null<ws.Server>;
|
|
296
|
+
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
|
|
297
|
+
shutdown(): void;
|
|
298
|
+
setTimeout(value: number | string): void;
|
|
299
|
+
checkTimeout(client: ws): boolean;
|
|
300
|
+
readonly prototype: IWatch<T, U, V, W>;
|
|
301
|
+
new(module?: V): IWatch<T, U, V, W>;
|
|
302
|
+
new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
interface IRequest<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
|
|
306
|
+
startTime: number;
|
|
307
|
+
acceptEncoding: boolean;
|
|
308
|
+
keepAlive: Null<boolean>;
|
|
309
|
+
readTimeout: number;
|
|
310
|
+
readExpect: ReadExpectType;
|
|
311
|
+
proxy: Null<ProxySettings>;
|
|
312
|
+
init(config?: RequestInit): this;
|
|
313
|
+
apply(options: ApplyOptions): this;
|
|
314
|
+
addDns(hostname: string, address: string, timeout: number): void;
|
|
315
|
+
addDns(hostname: string, address: string, family?: number | string, timeout?: number): void;
|
|
316
|
+
lookupDns(hostname: string): LookupFunction;
|
|
317
|
+
proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
|
|
318
|
+
statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
|
|
319
|
+
statusOn(name: ArrayOf<number>, globUrl: string, callback: StatusOnCallback): void;
|
|
320
|
+
headersOn(name: ArrayOf<string>, callback: HeadersOnCallback): void;
|
|
321
|
+
headersOn(name: ArrayOf<string>, globUrl: string, callback: HeadersOnCallback): void;
|
|
322
|
+
headersOf(uri: string): Undef<OutgoingHttpHeaders>;
|
|
323
|
+
aria2c(uri: string | URL, pathname: string): Promise<string[]>;
|
|
324
|
+
aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
325
|
+
json(uri: string | URL, options?: OpenOptions): Promise<Null<object>>;
|
|
326
|
+
pipe(uri: string | URL, to: Writable, options?: OpenOptions): Promise<null>;
|
|
327
|
+
opts(url: string | URL, options?: OpenOptions): HostConfig;
|
|
328
|
+
open(uri: string | URL, options: OpenOptions): HttpRequestClient;
|
|
329
|
+
head(uri: string | URL, options?: OpenOptions): ClientRequest;
|
|
330
|
+
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
|
|
331
|
+
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
|
|
332
|
+
post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
|
|
333
|
+
post<V extends PostOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
|
|
334
|
+
post<V extends PostOptions>(uri: string | URL, data: unknown, contentType?: string | FormDataPart[] | V, options?: V): Promise<DataObjectResult<V>>;
|
|
335
|
+
get<V extends OpenOptions, W extends V | BufferFormat>(uri: string | URL, options?: W): Promise<W extends BufferFormat ? Null<object> : DataEncodedResult<V>>;
|
|
336
|
+
detach(singleton?: boolean): void;
|
|
337
|
+
reset(): void;
|
|
338
|
+
close(): void;
|
|
339
|
+
set agentTimeout(value);
|
|
340
|
+
get agentTimeout(): number;
|
|
341
|
+
set httpVersion(value);
|
|
342
|
+
get httpVersion(): Null<HttpProtocolVersion>;
|
|
343
|
+
set ipVersion(value);
|
|
344
|
+
get ipVersion(): InternetProtocolVersion;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
interface RequestConstructor<T extends RequestModule = RequestModule, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
|
|
348
|
+
readCACert(value: string, cache?: boolean): string;
|
|
349
|
+
readTLSKey(value: string, cache?: boolean): string;
|
|
350
|
+
readTLSCert(value: string, cache?: boolean): string;
|
|
351
|
+
isCert(value: string): boolean;
|
|
352
|
+
fromURL(url: URL, value: string): string;
|
|
353
|
+
fromStatusCode(value: number | string): string;
|
|
354
|
+
defineHttpAgent(options: HttpAgentSettings): void;
|
|
355
|
+
defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
|
|
356
|
+
getAria2Path(): string;
|
|
357
|
+
readonly prototype: IRequest<T, U>;
|
|
358
|
+
new(module?: T): IRequest<T, U>;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface IFileManager<T extends ExternalAsset = ExternalAsset> extends IHost, Set<string> {
|
|
362
|
+
processTimeout: number;
|
|
363
|
+
cacheToDisk: IHttpDiskCache<T>;
|
|
364
|
+
cacheToMemory: IHttpMemoryCache<T>;
|
|
365
|
+
Request: IRequest;
|
|
366
|
+
Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
|
|
367
|
+
Task: InstallData<ITask, TaskConstructor>[];
|
|
368
|
+
Image: Null<ImageMimeMap>;
|
|
369
|
+
Cloud: Null<ICloud>;
|
|
370
|
+
Watch: Null<WatchInstance<T>>;
|
|
371
|
+
Compress: Null<ICompress>;
|
|
372
|
+
readonly documentAssets: T[];
|
|
373
|
+
readonly taskAssets: (T & Required<TaskAction>)[];
|
|
374
|
+
readonly dataSourceItems: DataSource[];
|
|
375
|
+
readonly files: Set<string>;
|
|
376
|
+
readonly filesQueued: Set<string>;
|
|
377
|
+
readonly filesToRemove: Set<string>;
|
|
378
|
+
readonly filesToCompare: Map<T, string[]>;
|
|
379
|
+
readonly contentToAppend: Map<string, string[]>;
|
|
380
|
+
readonly contentToReplace: Map<string, string[]>;
|
|
381
|
+
readonly processing: IFileThread<T>[];
|
|
382
|
+
readonly fetchedAssets: T[];
|
|
383
|
+
readonly copiedAssets: T[];
|
|
384
|
+
readonly emptyDir: Set<string>;
|
|
385
|
+
install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
|
|
386
|
+
install(name: "document", target: DocumentConstructor<IFileManager<T>, T>, module?: DocumentModule, ...args: unknown[]): Undef<IDocument<IFileManager<T>, T>>;
|
|
387
|
+
install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
|
|
388
|
+
install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): Undef<ITask>;
|
|
389
|
+
install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): Undef<ICloud>;
|
|
390
|
+
install(name: "cloud", module?: CloudModule): Undef<ICloud>;
|
|
391
|
+
install(name: "image", handler: string, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
|
|
392
|
+
install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): Undef<IImage>;
|
|
393
|
+
install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
|
|
394
|
+
install(name: "watch", module: WatchModule): Undef<WatchInstance<T>>;
|
|
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
|
+
install(name: string, ...args: unknown[]): Undef<IModule>;
|
|
398
|
+
using(...items: FirstOf<T>): this;
|
|
399
|
+
contains(item: T, condition?: FunctionArgs<[T], boolean>): boolean;
|
|
400
|
+
removeCwd(value: unknown): string;
|
|
401
|
+
findAsset(value: string | URL, instance?: IModule | FindAssetOptions<T>): Undef<T>;
|
|
402
|
+
removeAsset(file: T): boolean;
|
|
403
|
+
replace(file: T, replaceWith: string, mimeType: Undef<string>): boolean;
|
|
404
|
+
replace(file: T, replaceWith: string, options?: ReplaceOptions): boolean;
|
|
405
|
+
rename(file: T, value: string): boolean;
|
|
406
|
+
performAsyncTask(): void;
|
|
407
|
+
removeAsyncTask(): void;
|
|
408
|
+
completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: number): void;
|
|
409
|
+
performFinalize(override?: boolean): void;
|
|
410
|
+
hasDocument(instance: IModule, document: Undef<ArrayOf<string>>): boolean;
|
|
411
|
+
getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
|
|
412
|
+
getDataSourceItems(instance: IModule, condition?: FunctionArgs<[DataSource], boolean>): DataSource[];
|
|
413
|
+
checkFilename(file: T, pathname?: string): string;
|
|
414
|
+
setLocalUri(file: T, replace?: boolean): FileOutput;
|
|
415
|
+
getLocalUri(data: FileData<T>): string;
|
|
416
|
+
getMimeType(data: FileData<T>): string;
|
|
417
|
+
openThread(instance: IModule, data: IFileThread<T>, timeout?: number): boolean;
|
|
418
|
+
closeThread(instance: Null<IModule>, data: IFileThread<T>, callback?: FunctionType<void>): boolean;
|
|
419
|
+
addProcessTimeout(instance: IModule, file: T, timeout: number): void;
|
|
420
|
+
removeProcessTimeout(instance: IModule, file: T): void;
|
|
421
|
+
getProcessTimeout(handler: InstallData): number;
|
|
422
|
+
clearProcessTimeout(): void;
|
|
423
|
+
scheduleTask(url: string | URL, data: unknown, priority: number): Promise<unknown>;
|
|
424
|
+
scheduleTask(url: string | URL, data: unknown, thenCallback?: FunctionType, catchCallback?: FunctionType, priority?: number): Promise<unknown>;
|
|
425
|
+
setTaskLimit(value: number): void;
|
|
426
|
+
addDownload(value: number | Bufferable, encoding: BufferEncoding): number;
|
|
427
|
+
addDownload(value: number | Bufferable, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
|
|
428
|
+
getDownload(type?: number): TupleOf<number>;
|
|
429
|
+
transformAsset(data: IFileThread<T>, parent?: T, override?: boolean): Promise<boolean>;
|
|
430
|
+
addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): Undef<string>;
|
|
431
|
+
findMime(file: T, rename?: boolean): Promise<string>;
|
|
432
|
+
getUTF8String(file: T, uri?: string): string;
|
|
433
|
+
getBuffer<U>(file: T, minStreamSize?: U): U extends number ? Promise<Null<Buffer>> : Null<Buffer>;
|
|
434
|
+
getCacheDir(url: string | URL, createDir?: boolean): string;
|
|
435
|
+
setAssetContent(file: T, content: string, options?: AssetContentOptions): string;
|
|
436
|
+
getAssetContent(file: T, content?: string): Undef<string>;
|
|
437
|
+
writeBuffer(file: T, options?: WriteFileOptions): Null<Buffer>;
|
|
438
|
+
writeImage(document: ArrayOf<string>, output: OutputFinalize<T>): boolean;
|
|
439
|
+
compressFile(file: T, overwrite?: boolean): Promise<unknown>;
|
|
440
|
+
fetchObject(uri: string | URL, format: BufferFormat): Promise<Null<object>>;
|
|
441
|
+
fetchObject(uri: string | URL, options?: OpenOptions | BufferFormat): Promise<Null<object>>;
|
|
442
|
+
fetchBuffer<U extends OpenOptions>(uri: string | URL, options?: U): Promise<DataEncodedResult<U>>;
|
|
443
|
+
fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
|
|
444
|
+
fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
445
|
+
updateProgress(name: "request", id: number | string, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
|
|
446
|
+
start(emptyDir?: boolean): Promise<FinalizeResult>;
|
|
447
|
+
processAssets(emptyDir?: boolean, using?: T[]): void;
|
|
448
|
+
deleteFile<U extends Promise<void>>(src: string, promises: boolean): U;
|
|
449
|
+
deleteFile<U extends Promise<void>>(src: string, options: DeleteFileOptions & DeleteFileAddendum, promises: boolean): U;
|
|
450
|
+
deleteFile<U extends NoParamCallback>(src: string, callback?: U): unknown;
|
|
451
|
+
deleteFile<U extends NoParamCallback>(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: U): unknown;
|
|
452
|
+
restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
|
|
453
|
+
restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
|
|
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>;
|
|
460
|
+
finalize(): Promise<void>;
|
|
461
|
+
close(): void;
|
|
462
|
+
reset(): boolean;
|
|
463
|
+
get baseDirectory(): string;
|
|
464
|
+
get config(): RequestData<T>;
|
|
465
|
+
get assets(): T[];
|
|
466
|
+
get incremental(): IncrementalMatch;
|
|
467
|
+
set restarting(value);
|
|
468
|
+
get restarting(): boolean;
|
|
469
|
+
get delayed(): number;
|
|
470
|
+
set cleared(value);
|
|
471
|
+
get cleared(): boolean;
|
|
472
|
+
set finalizeState(value);
|
|
473
|
+
get finalizeState(): number;
|
|
474
|
+
|
|
475
|
+
/* Set */
|
|
476
|
+
add(value: string, parent?: T, type?: number): this;
|
|
477
|
+
delete(value: string, emptyDir?: boolean): boolean;
|
|
478
|
+
has(value: unknown): value is string;
|
|
479
|
+
|
|
480
|
+
/* EventEmitter */
|
|
481
|
+
on(event: "end", listener: PostFinalizeCallback): this;
|
|
482
|
+
on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
483
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
484
|
+
on(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
485
|
+
on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
486
|
+
on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
487
|
+
on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
488
|
+
on(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
489
|
+
on(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
490
|
+
on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
491
|
+
once(event: "end", listener: PostFinalizeCallback): this;
|
|
492
|
+
once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
493
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
494
|
+
once(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
495
|
+
once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
496
|
+
once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
497
|
+
once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
498
|
+
once(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
499
|
+
once(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
500
|
+
once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
501
|
+
emit(event: "end", result: FinalizeResult): boolean;
|
|
502
|
+
emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
|
|
503
|
+
emit(event: "error", err: Error): boolean;
|
|
504
|
+
emit(event: "file:read", src: string, data: Bufferable, options?: ReadFileOptions): boolean;
|
|
505
|
+
emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
|
|
506
|
+
emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
|
|
507
|
+
emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
|
|
508
|
+
emit(event: "file:move", dest: string, options?: MoveFileOptions): boolean;
|
|
509
|
+
emit(event: "dir:create", src: string, options?: CreateDirOptions): boolean;
|
|
510
|
+
emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
interface FileManagerConstructor<T extends ExternalAsset> extends HostConstructor {
|
|
514
|
+
purgeMemory(percent?: number, limit?: number | boolean, parent?: number | boolean): Promise<number>;
|
|
515
|
+
loadSettings(settings: Settings, password?: string): boolean;
|
|
516
|
+
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
517
|
+
sanitizeAssets(assets: T[], exclusions?: string[]): T[];
|
|
518
|
+
writeChecksum(root: string, options: ChecksumOptions): Promise<string[]>;
|
|
519
|
+
writeChecksum(root: string, to?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<string[]>>;
|
|
520
|
+
verifyChecksum(root: string, options: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
|
|
521
|
+
verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[], number]>>;
|
|
522
|
+
createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
|
|
523
|
+
setTimeout(options: ObjectMap<number | string>): void;
|
|
524
|
+
defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
|
|
525
|
+
defineHttpConnect(options: HttpConnectSettings): void;
|
|
526
|
+
readonly prototype: IFileManager<T>;
|
|
527
|
+
new(baseDirectory: string, config: RequestData<T>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
|
|
528
|
+
new(baseDirectory: string, config: RequestData<T>, permission?: Null<IPermission>, postFinalize?: PostFinalizeCallback): IFileManager<T>;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
interface IHost extends IModule {
|
|
532
|
+
restartable: boolean;
|
|
533
|
+
readonly modules: Set<IModule>;
|
|
534
|
+
readonly subProcesses: Set<IModule>;
|
|
535
|
+
readonly startTime: number;
|
|
536
|
+
using(...items: FirstOf<unknown>): this;
|
|
537
|
+
contains(item: unknown, condition?: FunctionType<boolean, any>): boolean;
|
|
538
|
+
find(name: string): Undef<IModule>;
|
|
539
|
+
findAll(name: string): IModule[];
|
|
540
|
+
willLog(name: string): boolean;
|
|
541
|
+
ignoreLog(values: boolean | ArrayOf<string>): void;
|
|
542
|
+
collectLog(level?: boolean): LogStatus<StatusType>[];
|
|
543
|
+
pauseLog(type?: string): void;
|
|
544
|
+
resumeLog(type?: string): void;
|
|
545
|
+
hasLog(type: string): boolean;
|
|
546
|
+
delayMessage(...args: unknown[]): void;
|
|
547
|
+
willAbort(value: string | IModule): boolean;
|
|
548
|
+
loadModule(name: string, ...args: any[]): Null<IModule>;
|
|
549
|
+
retain(process: IModule): void;
|
|
550
|
+
release(process: IModule, log?: boolean): boolean;
|
|
551
|
+
restart(...args: unknown[]): void;
|
|
552
|
+
joinQueue(options?: JoinQueueOptions): boolean;
|
|
553
|
+
updateProgress(name: string, ...args: unknown[]): void;
|
|
554
|
+
resumeThread?(options: ResumeThreadOptions): void;
|
|
555
|
+
set host(value);
|
|
556
|
+
get host(): null;
|
|
557
|
+
get config(): Readonly<HostInitConfig>;
|
|
558
|
+
get username(): string;
|
|
559
|
+
set done(value);
|
|
560
|
+
get done(): boolean;
|
|
561
|
+
get queued(): boolean;
|
|
562
|
+
get logState(): LogState;
|
|
563
|
+
get errorCount(): number;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
interface HostConstructor extends ModuleConstructor {
|
|
567
|
+
loadSettings(settings: Settings, password?: string): boolean;
|
|
568
|
+
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
569
|
+
isPermission(value: unknown): value is IPermission;
|
|
570
|
+
createPermission(all?: boolean, freeze?: boolean): IPermission;
|
|
571
|
+
kill(username: string, iv: BinaryLike, all: true): number;
|
|
572
|
+
kill(username: string, iv: BinaryLike, pid: ArrayOf<number>): number;
|
|
573
|
+
getThreadCount(full: true): ThreadCountStat;
|
|
574
|
+
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
575
|
+
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
576
|
+
getLogDelayed(): FormatMessageArgs[];
|
|
577
|
+
getPermissionFromSettings(): IPermission;
|
|
578
|
+
readonly prototype: IHost;
|
|
579
|
+
new(config?: HostInitConfig): IHost;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
|
|
583
|
+
readonly status: LogStatus<StatusType>[];
|
|
584
|
+
readonly errors: unknown[];
|
|
585
|
+
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
586
|
+
supports(name: string, value?: boolean): boolean;
|
|
587
|
+
getTempDir(options: TempDirOptions): string;
|
|
588
|
+
getTempDir(uuidDir: boolean, createDir: boolean): string;
|
|
589
|
+
getTempDir(pathname: string, createDir: boolean): string;
|
|
590
|
+
getTempDir(uuidDir: boolean, filename?: string, createDir?: boolean): string;
|
|
591
|
+
getTempDir(pathname?: string, filename?: string, createDir?: boolean): string;
|
|
592
|
+
canRead(uri: string | URL, options?: PermissionOptions): boolean;
|
|
593
|
+
canWrite(uri: string | URL, options?: PermissionOptions): boolean;
|
|
594
|
+
readFile(src: string | URL): Undef<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>;
|
|
596
|
+
readFile<U extends Buffer>(src: string | URL, promises: true): Promise<Undef<U>>;
|
|
597
|
+
readFile<U extends Bufferable, V extends ReadFileOptions>(src: string | URL, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
|
|
598
|
+
readFile<U extends ReadFileCallback>(src: string | URL, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : Bufferable>;
|
|
599
|
+
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>;
|
|
600
|
+
writeFile<U extends boolean>(src: string | URL, data: BufferView, options?: WriteFileOptions): U;
|
|
601
|
+
writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, promises: true): U;
|
|
602
|
+
writeFile<U extends Promise<boolean>>(src: string | URL, data: BufferView, options: WriteFileOptions, promises: true): U;
|
|
603
|
+
writeFile<U extends NoParamCallback>(src: string | URL, data: BufferView, callback: U): void;
|
|
604
|
+
writeFile<U extends NoParamCallback>(src: string | URL, data: BufferView, options: WriteFileOptions, callback: U): void;
|
|
605
|
+
deleteFile<U extends boolean>(src: string | URL, options?: DeleteFileOptions): U;
|
|
606
|
+
deleteFile<U extends Promise<boolean>>(src: string | URL, promises: true): U;
|
|
607
|
+
deleteFile<U extends Promise<boolean>>(src: string | URL, options: DeleteFileOptions, promises: true): U;
|
|
608
|
+
deleteFile<U extends NoParamCallback>(src: string | URL, callback: U): void;
|
|
609
|
+
deleteFile<U extends NoParamCallback>(src: string | URL, options: DeleteFileOptions, callback: U): void;
|
|
610
|
+
copyFile<U extends boolean>(src: string | URL, dest: string | URL, options?: CopyFileOptions): U;
|
|
611
|
+
copyFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, promises: true): U;
|
|
612
|
+
copyFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, options: CopyFileOptions, promises: true): U;
|
|
613
|
+
copyFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, callback: U): void;
|
|
614
|
+
copyFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, options: CopyFileOptions, callback: U): void;
|
|
615
|
+
moveFile<U extends boolean>(src: string | URL, dest: string | URL, options?: MoveFileOptions): U;
|
|
616
|
+
moveFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, promises: true): U;
|
|
617
|
+
moveFile<U extends Promise<boolean>>(src: string | URL, dest: string | URL, options: MoveFileOptions, promises: true): U;
|
|
618
|
+
moveFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, callback: U): void;
|
|
619
|
+
moveFile<U extends NoParamCallback>(src: string | URL, dest: string | URL, options: MoveFileOptions, callback: U): void;
|
|
620
|
+
createDir<U extends boolean>(src: string | URL, options?: CreateDirOptions): U;
|
|
621
|
+
createDir<U extends Promise<boolean>>(src: string | URL, promises: true): U;
|
|
622
|
+
createDir<U extends Promise<boolean>>(src: string | URL, options: CreateDirOptions, promises: true): U;
|
|
623
|
+
createDir<U extends NoParamCallback>(src: string | URL, callback: U): void;
|
|
624
|
+
createDir<U extends NoParamCallback>(src: string | URL, options: CreateDirOptions, callback: U): void;
|
|
625
|
+
removeDir<U extends boolean>(src: string | URL, options?: RemoveDirOptions): U;
|
|
626
|
+
removeDir<U extends Promise<boolean>>(src: string | URL, promises: true): U;
|
|
627
|
+
removeDir<U extends Promise<boolean>>(src: string | URL, options: RemoveDirOptions, promises: true): U;
|
|
628
|
+
removeDir<U extends NoParamCallback>(src: string | URL, callback: U): void;
|
|
629
|
+
removeDir<U extends NoParamCallback>(src: string | URL, options: RemoveDirOptions, callback: U): void;
|
|
630
|
+
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, type?: LogType): Promise<PromiseFulfilledResult<U>[]>;
|
|
631
|
+
allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions): Promise<PromiseFulfilledResult<U>[]>;
|
|
632
|
+
formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
|
|
633
|
+
formatFail(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogFailOptions): void;
|
|
634
|
+
writeFail(value: LogValue, message?: unknown, type?: LogType): void;
|
|
635
|
+
writeFail(value: LogValue, message?: unknown, options?: LogFailOptions): void;
|
|
636
|
+
writeTimeProcess(title: string, value: string, startTime: LogTime, options?: LogProcessOptions): void;
|
|
637
|
+
writeTimeElapsed(title: string, value: LogValue, startTime: LogTime, options?: LogMessageOptions): void;
|
|
638
|
+
checkPackage(err: unknown, name: Undef<string>, type: LogType): boolean;
|
|
639
|
+
checkPackage(err: unknown, name: Undef<string>, options: LogFailOptions): boolean;
|
|
640
|
+
checkPackage(err: unknown, name: Undef<string>, value?: LogValue, options?: LogFailOptions | LogType): boolean;
|
|
641
|
+
checkFail(message: unknown, options: LogFailOptions): Undef<LogArguments | false>;
|
|
642
|
+
writeLog(component: LogComponent, queue?: boolean): void;
|
|
643
|
+
writeLog(type: StatusType, value: unknown, options: LogOptions): void;
|
|
644
|
+
writeLog(type: StatusType, value: unknown, timeStamp?: LogDate, duration?: number): void;
|
|
645
|
+
addLog(component: LogComponent, queue?: boolean): void;
|
|
646
|
+
addLog(type: StatusType, value: unknown, options: LogOptions): void;
|
|
647
|
+
addLog(type: StatusType, value: unknown, from: string, source?: string): void;
|
|
648
|
+
addLog(type: StatusType, value: unknown, timeStamp?: LogDate, from?: string, source?: string): void;
|
|
649
|
+
addLog(type: StatusType, value: unknown, timeStamp?: LogDate, duration?: number, from?: string, source?: string): void;
|
|
650
|
+
getLog(...type: StatusType[]): LogStatus<StatusType>[];
|
|
651
|
+
flushLog(): void;
|
|
652
|
+
willAbort(value: unknown): boolean;
|
|
653
|
+
hasOwnPermission(): boolean;
|
|
654
|
+
isFatal(err?: unknown): boolean;
|
|
655
|
+
detach(): void;
|
|
656
|
+
reset(): void;
|
|
657
|
+
get moduleName(): string;
|
|
658
|
+
set host(value);
|
|
659
|
+
get host(): Null<T>;
|
|
660
|
+
set permission(value);
|
|
661
|
+
get permission(): Null<IPermission>;
|
|
662
|
+
get aborted(): boolean;
|
|
663
|
+
set abortable(value);
|
|
664
|
+
get abortable(): boolean;
|
|
665
|
+
get threadable(): boolean;
|
|
666
|
+
set sessionId(value);
|
|
667
|
+
get sessionId(): string;
|
|
668
|
+
set broadcastId(value);
|
|
669
|
+
get broadcastId(): ArrayOf<string>;
|
|
670
|
+
set silent(value);
|
|
671
|
+
get silent(): boolean;
|
|
672
|
+
get logType(): LOG_TYPE;
|
|
673
|
+
set logLevel(value: number | string);
|
|
674
|
+
get logLevel(): number;
|
|
675
|
+
get statusType(): STATUS_TYPE;
|
|
676
|
+
set tempDir(value);
|
|
677
|
+
get tempDir(): string;
|
|
678
|
+
|
|
679
|
+
/* EventEmitter */
|
|
680
|
+
on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
681
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
682
|
+
on(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
683
|
+
on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
684
|
+
on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
685
|
+
on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
686
|
+
on(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
687
|
+
on(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
688
|
+
on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
689
|
+
once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
690
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
691
|
+
once(event: "file:read", listener: (src: string, data: Bufferable, options?: ReadFileOptions) => void): this;
|
|
692
|
+
once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
693
|
+
once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
694
|
+
once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
695
|
+
once(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
696
|
+
once(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
697
|
+
once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
698
|
+
emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
|
|
699
|
+
emit(event: "error", err: Error): boolean;
|
|
700
|
+
emit(event: "file:read", src: string, data: Bufferable, options?: ReadFileOptions): boolean;
|
|
701
|
+
emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
|
|
702
|
+
emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
|
|
703
|
+
emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
|
|
704
|
+
emit(event: "file:move", dest: string, options?: MoveFileOptions): boolean;
|
|
705
|
+
emit(event: "dir:create", src: string, options?: CreateDirOptions): boolean;
|
|
706
|
+
emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
interface ModuleConstructor<T extends IHost = IHost> {
|
|
710
|
+
PROCESS_TIMEOUT: number;
|
|
711
|
+
LOG_STYLE_FAIL: LogMessageOptions;
|
|
712
|
+
LOG_STYLE_SUCCESS: LogMessageOptions;
|
|
713
|
+
LOG_STYLE_INFO: LogMessageOptions;
|
|
714
|
+
LOG_STYLE_WARN: LogMessageOptions;
|
|
715
|
+
LOG_STYLE_NOTICE: LogMessageOptions;
|
|
716
|
+
LOG_STYLE_REVERSE: LogMessageOptions;
|
|
717
|
+
readonly VERSION: string;
|
|
718
|
+
readonly LOG_TYPE: LOG_TYPE;
|
|
719
|
+
readonly LOG_FORMAT: LoggerFormatSettings<LoggerFormat<number>>;
|
|
720
|
+
readonly STATUS_TYPE: STATUS_TYPE;
|
|
721
|
+
readonly PLATFORM_WIN32: boolean;
|
|
722
|
+
readonly MAX_TIMEOUT: number;
|
|
723
|
+
readonly TEMP_DIR: string;
|
|
724
|
+
/** @deprecated Types.supported */
|
|
725
|
+
supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
726
|
+
formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
|
|
727
|
+
writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
|
|
728
|
+
enabled(key: string, username?: string): boolean;
|
|
729
|
+
parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
|
|
730
|
+
parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
|
|
731
|
+
asString(value: unknown, cacheKey?: boolean | "throws"): string;
|
|
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;
|
|
735
|
+
readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
|
|
736
|
+
toPosix(value: unknown, normalize: boolean): string;
|
|
737
|
+
toPosix(value: unknown, filename?: string, normalize?: boolean): string;
|
|
738
|
+
hasLogType(value: LogType): boolean;
|
|
739
|
+
isURL(value: string, ...exclude: string[]): boolean;
|
|
740
|
+
isFile(value: string | URL, type?: ProtocolType): boolean;
|
|
741
|
+
isDir(value: string | URL): boolean;
|
|
742
|
+
isPath(value: string | URL, type?: "unc" | "unc-exists"): boolean;
|
|
743
|
+
isPath(value: string | URL, isFile?: boolean): boolean;
|
|
744
|
+
isErrorCode(err: unknown, ...code: string[]): boolean;
|
|
745
|
+
fromLocalPath(value: string): string;
|
|
746
|
+
resolveFile(value: string): string;
|
|
747
|
+
resolvePath(value: string, base: string | URL): string;
|
|
748
|
+
joinPath(...values: [...paths: unknown[], normalize: boolean][]): string;
|
|
749
|
+
joinPath(...values: unknown[]): string;
|
|
750
|
+
normalizePath(value: unknown, flags?: boolean | number): string;
|
|
751
|
+
createDir(value: string | URL, overwrite?: boolean): boolean;
|
|
752
|
+
removeDir(value: string | URL, sinceCreated: number, recursive?: boolean): boolean;
|
|
753
|
+
removeDir(value: string | URL, empty?: boolean, recursive?: boolean): boolean;
|
|
754
|
+
copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
|
|
755
|
+
copyDir(src: string | URL, dest: string | URL, options?: CopyDirOptions): Promise<CopyDirResult>;
|
|
756
|
+
renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
|
|
757
|
+
streamFile<U extends Bufferable>(value: string | URL, cache: boolean): Promise<U>;
|
|
758
|
+
streamFile<U extends ReadBufferOptions>(value: string | URL, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
759
|
+
streamFile<U extends ReadBufferOptions>(value: string | URL, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
|
|
760
|
+
readText(value: string | URL, cache: boolean): string;
|
|
761
|
+
readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<string> : string;
|
|
762
|
+
readText(value: string | URL, encoding?: BufferEncoding | ReadTextOptions, cache?: boolean): string;
|
|
763
|
+
readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: number | string } ? Promise<Null<Buffer>> : Null<Buffer>;
|
|
764
|
+
readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Null<Buffer>;
|
|
765
|
+
resolveMime(data: FileTypeFormat): Promise<Undef<FileTypeResult>>;
|
|
766
|
+
lookupMime(value: string, extension?: boolean): string;
|
|
767
|
+
initCpuUsage(instance?: IModule): CpuUsage;
|
|
768
|
+
getCpuUsage(start: CpuUsage, format: true): string;
|
|
769
|
+
getCpuUsage(start: CpuUsage, format?: boolean): number;
|
|
770
|
+
getMemUsage(format: true): string;
|
|
771
|
+
getMemUsage(format?: boolean): number;
|
|
772
|
+
formatCpuMem(start: CpuUsage, all?: boolean): string;
|
|
773
|
+
getPackageVersion(name: string | TupleOf<string>, startDir: string, baseDir?: string): string;
|
|
774
|
+
getPackageVersion(name: string | TupleOf<string>, unstable?: boolean, startDir?: string, baseDir?: string): string;
|
|
775
|
+
checkSemVer(name: string | TupleOf<string>, options: CheckSemVerOptions): boolean;
|
|
776
|
+
/** @deprecated options */
|
|
777
|
+
checkSemVer(name: string | TupleOf<string>, min: number | string, max?: number | string, unstable?: boolean, startDir?: string): boolean;
|
|
778
|
+
checkSemVer(name: string | TupleOf<string>, min: number | string, max: number | string, options?: Omit<CheckSemVerOptions, "min" | "max" | "equals">): boolean;
|
|
779
|
+
sanitizeCmd(value: string): string;
|
|
780
|
+
sanitizeArgs(value: string, doubleQuote?: boolean): string;
|
|
781
|
+
sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
|
|
782
|
+
purgeMemory(percent: number, limit: number, parent?: boolean): Promise<number>;
|
|
783
|
+
purgeMemory(percent?: number, limit?: number | boolean, parent?: unknown): Promise<number>;
|
|
784
|
+
canWrite(name: "temp" | "home"): boolean;
|
|
785
|
+
loadSettings(settings: Settings, password?: string): boolean;
|
|
786
|
+
readonly prototype: IModule<T>;
|
|
787
|
+
new(): IModule<T>;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export = functions;
|