@e-mc/types 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/constant.d.ts CHANGED
@@ -132,6 +132,13 @@ export const enum ERR_CLOUD {
132
132
  METADATA_FAIL = 'Metadata failed'
133
133
  }
134
134
 
135
+ export const enum ERR_IMAGE {
136
+ ROTATE = 'Unable to rotate image',
137
+ FINALIZE = 'Unable to finalize image',
138
+ METHOD_NAME = 'Invalid method name',
139
+ METHOD_ARGS = 'Invalid method arguments'
140
+ }
141
+
135
142
  export const enum DB_TRANSACTION {
136
143
  ACTIVE = 1,
137
144
  PARTIAL = 2,
@@ -161,19 +168,19 @@ export const enum PACKAGE_NAME {
161
168
  DB = '@e-mc/db',
162
169
  DB_POOL = '@e-mc/db/pool',
163
170
  DOCUMENT = '@e-mc/document',
164
- DOCUMENT_ANDROID = '@e-mc/document/android',
165
- DOCUMENT_CHROME = '@e-mc/document/chrome',
171
+ DOCUMENT_ANDROID = '@e-mc2/android',
172
+ DOCUMENT_CHROME = '@e-mc2/chrome',
166
173
  DOCUMENT_TRANSFORM = '@e-mc/document/transform',
167
174
  DOCUMENT_UTIL = '@e-mc/document/util',
168
175
  FILE_MANAGER = '@e-mc/file-manager',
169
176
  IMAGE = '@e-mc/image',
170
- IMAGE_JIMP = '@e-mc/image/jimp',
177
+ IMAGE_JIMP = '@e-mc2/jimp',
171
178
  MODULE = '@e-mc/module',
172
179
  MODULE_LIB_V4 = '@e-mc/module/lib-v4',
173
180
  REQUEST = '@e-mc/request',
174
181
  REQUEST_HTTP_HOST = '@e-mc/request/http/host',
175
182
  TASK = '@e-mc/task',
176
- TASK_GULP = '@e-mc/task/gulp',
183
+ TASK_GULP = '@e-mc2/gulp',
177
184
  TYPES = '@e-mc/types',
178
185
  WATCH = '@e-mc/watch',
179
186
  WATCH_FILEGROUP = '@e-mc/watch/filegroup'
package/index.d.ts CHANGED
@@ -210,10 +210,20 @@ declare namespace types {
210
210
  }
211
211
 
212
212
  const WATCH_EVENT: {
213
- MODIFIED: string;
214
- BROADCAST: string;
215
- CLOSE: string;
216
- ERROR: string;
213
+ MODIFIED: "modified";
214
+ BROADCAST: "broadcast";
215
+ CLOSE: "close";
216
+ ERROR: "error";
217
+ };
218
+
219
+ interface THRESHOLD {
220
+ WATCH_INTERVAL: number;
221
+ WATCH_CHANGE: number;
222
+ }
223
+
224
+ const THRESHOLD: {
225
+ WATCH_INTERVAL: number;
226
+ WATCH_CHANGE: number;
217
227
  };
218
228
 
219
229
  const IMPORT_MAP: StringMap;
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.purgeMemory = exports.errorMessage = exports.errorValue = exports.validateUUID = exports.randomString = exports.decryptUTF8 = exports.encryptUTF8 = exports.getEncoding = exports.asFunction = exports.coerceObject = exports.cloneObject = exports.cascadeObject = exports.formatSize = exports.renameExt = exports.escapePattern = exports.hasGlob = exports.convertTime = exports.formatTime = exports.parseExpires = exports.parseTime = exports.isEmpty = exports.isString = exports.isObject = exports.isPlainObject = exports.isArray = exports.setTempDir = exports.getTempDir = exports.setLogCurrent = exports.getLogCurrent = exports.existsFlag = exports.mainFlag = exports.processFlag = exports.modifiedFlag = exports.watchFlag = exports.usingFlag = exports.cloneFlag = exports.ignoreFlag = exports.hasBit = exports.createAbortError = exports.IMPORT_MAP = exports.WATCH_EVENT = exports.DB_TRANSACTION = exports.DB_TYPE = exports.FETCH_TYPE = exports.DOWNLOAD_TYPE = exports.ERR_CODE = exports.ASSET_FLAG = exports.FILE_TYPE = exports.STATUS_TYPE = exports.LOG_TYPE = void 0;
4
- exports.generateUUID = void 0;
3
+ exports.errorMessage = exports.errorValue = exports.validateUUID = exports.randomString = exports.decryptUTF8 = exports.encryptUTF8 = exports.getEncoding = exports.asFunction = exports.coerceObject = exports.cloneObject = exports.cascadeObject = exports.formatSize = exports.renameExt = exports.escapePattern = exports.hasGlob = exports.convertTime = exports.formatTime = exports.parseExpires = exports.parseTime = exports.isEmpty = exports.isString = exports.isObject = exports.isPlainObject = exports.isArray = exports.setTempDir = exports.getTempDir = exports.setLogCurrent = exports.getLogCurrent = exports.existsFlag = exports.mainFlag = exports.processFlag = exports.modifiedFlag = exports.watchFlag = exports.usingFlag = exports.cloneFlag = exports.ignoreFlag = exports.hasBit = exports.createAbortError = exports.THRESHOLD = exports.IMPORT_MAP = exports.WATCH_EVENT = exports.DB_TRANSACTION = exports.DB_TYPE = exports.FETCH_TYPE = exports.DOWNLOAD_TYPE = exports.ERR_CODE = exports.ASSET_FLAG = exports.FILE_TYPE = exports.STATUS_TYPE = exports.LOG_TYPE = void 0;
4
+ exports.generateUUID = exports.purgeMemory = void 0;
5
5
  const path = require("path");
6
6
  const fs = require("fs");
7
7
  const crypto = require("crypto");
@@ -246,6 +246,36 @@ var WATCH_EVENT;
246
246
  var IMPORT_MAP;
247
247
  (function (IMPORT_MAP) {
248
248
  IMPORT_MAP["@squared-functions/cloud"] = "@e-mc/cloud";
249
+ IMPORT_MAP["@squared-functions/cloud/util"] = "@e-mc/cloud/util";
250
+ IMPORT_MAP["@squared-functions/compress-v3"] = "@e-mc/compress";
251
+ IMPORT_MAP["@squared-functions/core"] = "@e-mc/core";
252
+ IMPORT_MAP["@squared-functions/db"] = "@e-mc/db";
253
+ IMPORT_MAP["@squared-functions/db/pool"] = "@e-mc/db/pool";
254
+ IMPORT_MAP["@squared-functions/db/util"] = "@e-mc/db/util";
255
+ IMPORT_MAP["@squared-functions/document"] = "@e-mc/document";
256
+ IMPORT_MAP["@squared-functions/document/parse"] = "@e-mc/document/parse";
257
+ IMPORT_MAP["@squared-functions/document/parse/dom"] = "@e-mc/document/parse/dom";
258
+ IMPORT_MAP["@squared-functions/document/transform"] = "@e-mc/document/transform";
259
+ IMPORT_MAP["@squared-functions/document/asset"] = "@e-mc/document/asset";
260
+ IMPORT_MAP["@squared-functions/document/util"] = "@e-mc/document/util";
261
+ IMPORT_MAP["@squared-functions/file-manager"] = "@e-mc/file-manager";
262
+ IMPORT_MAP["@squared-functions/file-manager/http/host"] = "@e-mc/request/http/host";
263
+ IMPORT_MAP["@squared-functions/image-v3"] = "@e-mc/image";
264
+ IMPORT_MAP["@squared-functions/module"] = "@e-mc/module";
265
+ IMPORT_MAP["@squared-functions/task"] = "@e-mc/task";
266
+ IMPORT_MAP["@squared-functions/types"] = "@e-mc/types";
267
+ IMPORT_MAP["@squared-functions/watch"] = "@e-mc/watch";
268
+ IMPORT_MAP["@squared-functions/watch/filegroup"] = "@e-mc/watch/filegroup";
269
+ IMPORT_MAP["@squared-functions/document/android"] = "@e-mc2/android";
270
+ IMPORT_MAP["@squared-functions/document/android/extensions/app/manifest"] = "@e-mc2/android/extensions/app/manifest";
271
+ IMPORT_MAP["@squared-functions/document/android/extensions/gradle/dependencies"] = "@e-mc2/android/extensions/gradle/dependencies";
272
+ IMPORT_MAP["@squared-functions/document/android/extensions/gradle/settings"] = "@e-mc2/android/extensions/gradle/settings";
273
+ IMPORT_MAP["@squared-functions/document/android/extensions/task"] = "@e-mc2/android/extensions/task";
274
+ IMPORT_MAP["@squared-functions/document/chrome"] = "@e-mc2/chrome";
275
+ IMPORT_MAP["@squared-functions/image/jimp"] = "@e-mc2/jimp";
276
+ IMPORT_MAP["@squared-functions/image/jimp/util"] = "@e-mc2/jimp/util";
277
+ IMPORT_MAP["@squared-functions/image-v3/jimp"] = "@e-mc2/jimp";
278
+ IMPORT_MAP["@squared-functions/task/gulp"] = "@e-mc2/gulp";
249
279
  IMPORT_MAP["@squared-functions/cloud/atlas"] = "@e-mc2/atlas";
250
280
  IMPORT_MAP["@squared-functions/cloud/aws"] = "@e-mc2/aws";
251
281
  IMPORT_MAP["@squared-functions/cloud/aws/download"] = "@e-mc2/aws/download";
@@ -271,25 +301,12 @@ var IMPORT_MAP;
271
301
  IMPORT_MAP["@squared-functions/cloud/oci"] = "@e-mc2/oci";
272
302
  IMPORT_MAP["@squared-functions/cloud/oci/download"] = "@e-mc2/oci/download";
273
303
  IMPORT_MAP["@squared-functions/cloud/oci/upload"] = "@e-mc2/oci/upload";
274
- IMPORT_MAP["@squared-functions/cloud/util"] = "@e-mc2/util";
275
- IMPORT_MAP["@squared-functions/compress-v3"] = "@e-mc/compress";
276
- IMPORT_MAP["@squared-functions/core"] = "@e-mc/core";
277
- IMPORT_MAP["@squared-functions/db"] = "@e-mc/db";
278
- IMPORT_MAP["@squared-functions/db/mongodb"] = "@e-mc/db/mongodb";
279
- IMPORT_MAP["@squared-functions/db/mssql"] = "@e-mc/db/mssql";
280
- IMPORT_MAP["@squared-functions/db/mysql"] = "@e-mc/db/mysql";
281
- IMPORT_MAP["@squared-functions/db/oracle"] = "@e-mc/db/oracle";
282
- IMPORT_MAP["@squared-functions/db/postgres"] = "@e-mc/db/postgres";
283
- IMPORT_MAP["@squared-functions/db/redis"] = "@e-mc/db/redis";
284
- IMPORT_MAP["@squared-functions/db/pool"] = "@e-mc/db/pool";
285
- IMPORT_MAP["@squared-functions/db/util"] = "@e-mc/db/util";
286
- IMPORT_MAP["@squared-functions/document"] = "@e-mc/document";
287
- IMPORT_MAP["@squared-functions/document/android"] = "@e-mc/document/android";
288
- IMPORT_MAP["@squared-functions/document/android/extensions/app/manifest"] = "@e-mc/document/android/extensions/app/manifest";
289
- IMPORT_MAP["@squared-functions/document/android/extensions/gradle/dependencies"] = "@e-mc/document/android/extensions/gradle/dependencies";
290
- IMPORT_MAP["@squared-functions/document/android/extensions/gradle/settings"] = "@e-mc/document/android/extensions/gradle/settings";
291
- IMPORT_MAP["@squared-functions/document/android/extensions/task"] = "@e-mc/document/android/extensions/task";
292
- IMPORT_MAP["@squared-functions/document/chrome"] = "@e-mc/document/chrome";
304
+ IMPORT_MAP["@squared-functions/db/mongodb"] = "@e-mc2/mongodb";
305
+ IMPORT_MAP["@squared-functions/db/mssql"] = "@e-mc2/mssql";
306
+ IMPORT_MAP["@squared-functions/db/mysql"] = "@e-mc2/mysql";
307
+ IMPORT_MAP["@squared-functions/db/oracle"] = "@e-mc2/oracle";
308
+ IMPORT_MAP["@squared-functions/db/postgres"] = "@e-mc2/postgres";
309
+ IMPORT_MAP["@squared-functions/db/redis"] = "@e-mc2/redis";
293
310
  IMPORT_MAP["@squared-functions/document/packages/@babel/core"] = "@e-mc2/babel";
294
311
  IMPORT_MAP["@squared-functions/document/packages/clean-css"] = "@e-mc2/clean-css";
295
312
  IMPORT_MAP["@squared-functions/document/packages/eslint"] = "@e-mc2/eslint";
@@ -305,24 +322,12 @@ var IMPORT_MAP;
305
322
  IMPORT_MAP["@squared-functions/document/packages/svgo"] = "@e-mc2/svgo";
306
323
  IMPORT_MAP["@squared-functions/document/packages/terser"] = "@e-mc2/terser";
307
324
  IMPORT_MAP["@squared-functions/document/packages/uglify-js"] = "@e-mc2/uglify-js";
308
- IMPORT_MAP["@squared-functions/document/parse"] = "@e-mc/document/parse";
309
- IMPORT_MAP["@squared-functions/document/parse/dom"] = "@e-mc/document/parse/dom";
310
- IMPORT_MAP["@squared-functions/document/transform"] = "@e-mc/document/transform";
311
- IMPORT_MAP["@squared-functions/document/asset"] = "@e-mc/document/asset";
312
- IMPORT_MAP["@squared-functions/document/util"] = "@e-mc/document/util";
313
- IMPORT_MAP["@squared-functions/file-manager"] = "@e-mc/file-manager";
314
- IMPORT_MAP["@squared-functions/file-manager/http/host"] = "@e-mc/request/http/host";
315
- IMPORT_MAP["@squared-functions/image/jimp"] = "@e-mc/image/jimp";
316
- IMPORT_MAP["@squared-functions/image/jimp/util"] = "@e-mc/image/jimp/util";
317
- IMPORT_MAP["@squared-functions/image-v3"] = "@e-mc/image";
318
- IMPORT_MAP["@squared-functions/image-v3/jimp"] = "@e-mc/image/jimp";
319
- IMPORT_MAP["@squared-functions/module"] = "@e-mc/module";
320
- IMPORT_MAP["@squared-functions/task"] = "@e-mc/task";
321
- IMPORT_MAP["@squared-functions/task/gulp"] = "@e-mc/task/gulp";
322
- IMPORT_MAP["@squared-functions/types"] = "@e-mc/types";
323
- IMPORT_MAP["@squared-functions/watch"] = "@e-mc/watch";
324
- IMPORT_MAP["@squared-functions/watch/filegroup"] = "@e-mc/watch/filegroup";
325
325
  })(IMPORT_MAP = exports.IMPORT_MAP || (exports.IMPORT_MAP = {}));
326
+ var THRESHOLD;
327
+ (function (THRESHOLD) {
328
+ THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
329
+ THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
330
+ })(THRESHOLD = exports.THRESHOLD || (exports.THRESHOLD = {}));
326
331
  function createAbortError() {
327
332
  return new AbortError();
328
333
  }
@@ -9,7 +9,7 @@ import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, Interne
9
9
  import type { CloneObjectOptions, GetFunctionsOptions } from './module';
10
10
  import type { LogFailOptions, LogType, LogValue } from './logger';
11
11
  import type { HostConfig, OpenOptions, ProxySettings } from './request';
12
- import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
12
+ import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings, ImageModule } from './settings';
13
13
 
14
14
  import type { Readable, Writable } from 'stream';
15
15
  import type { OutgoingHttpHeaders } from 'http';
@@ -44,7 +44,7 @@ export interface IModuleLibV4 {
44
44
  getSize(value: string, diskUsed?: boolean): number;
45
45
  byteLength(value: BufferContent, encoding?: BufferEncoding): number;
46
46
  cleanupStream(target: Readable | Writable, pathname?: string): void;
47
- allSettled: AllSettledMethod;
47
+ allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseSettledResult<U>[]>;
48
48
  }
49
49
 
50
50
  export interface IModuleCompatV4<T extends IHost = IHost> extends IModule<T> {
@@ -90,8 +90,8 @@ export interface FileManagerCompatV4Constructor<T extends ExternalAsset = Extern
90
90
  new(...args: unknown[]): IFileManagerCompatV4<T>;
91
91
  }
92
92
 
93
- export interface ImageCompatV4Constructor<T extends IHost = IHost, U extends IImage<T> = IImage<T>> extends ImageConstructor<T, U> {
94
- using<V extends ExternalAsset>(this: T, instance: U, data: IFileThread<V>, command: string): Promise<unknown>;
93
+ export interface ImageCompatV4Constructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ImageConstructor<T, U> {
94
+ using<V extends ExternalAsset>(this: T, instance: IImage<T, U>, data: IFileThread<V>, command: string): Promise<unknown>;
95
95
  }
96
96
 
97
97
  export interface ICloudCompatV4<T extends IHost = IHost> extends ICloud<T> {
@@ -119,7 +119,4 @@ export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransfo
119
119
  export interface TransformSeriesCompatV4Constructor extends TransformSeriesConstructor {
120
120
  readonly prototype: ITransformSeriesCompatV4;
121
121
  new(...args: unknown[]): ITransformSeriesCompatV4;
122
- }
123
-
124
- export type SupportedMethod = (major: number, minor?: number, patch?: number, lts?: boolean) => boolean;
125
- export type AllSettledMethod<T extends boolean = false> = <U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType) => Promise<T extends true ? PromiseFulfilledResult<U>[] : PromiseSettledResult<U>[]>;
122
+ }
package/lib/document.d.ts CHANGED
@@ -144,7 +144,8 @@ export interface SourceMapConstructor {
144
144
  removeSourceMappingURL(value: string): [string, string?, Null<RawSourceMap>?];
145
145
  isRaw(map: unknown): map is RawSourceMap;
146
146
  readonly prototype: SourceMap;
147
- new(code: string, uri?: string): SourceMap;
147
+ new(code: string, remove: boolean): SourceMap;
148
+ new(code: string, uri?: string, remove?: boolean): SourceMap;
148
149
  }
149
150
 
150
151
  export interface UpdateGradleOptions {
package/lib/index.d.ts CHANGED
@@ -7,7 +7,6 @@ import type { CompressLevel, DataSource, DbDataSource, IncrementalMatch, LogStat
7
7
 
8
8
  import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
9
9
  import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload } from './cloud';
10
- import type { AllSettledMethod, SupportedMethod } from './compat-v4';
11
10
  import type { BufferResult, CompressFormat, TryFileCompressor, TryFileResult, TryImageResult } from './compress';
12
11
  import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
13
12
  import type { BatchQueryResult, DB_TYPE, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, PoolConfig, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
@@ -15,7 +14,7 @@ import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as Cust
15
14
  import type { AssetContentOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
16
15
  import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
17
16
  import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
18
- import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, ModuleFormatMessageMethod, ModuleWriteFailMethod, STATUS_TYPE, StatusType } from './logger';
17
+ import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
19
18
  import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadFileCallback, ReadFileOptions, RemoveDirOptions, WriteFileOptions } from './module';
20
19
  import type { RequestData, Settings } from './node';
21
20
  import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit } from './request';
@@ -23,8 +22,6 @@ import type { ClientModule, CloudModule, CloudServiceOptions, CompressModule, Co
23
22
  import type { Command, SpawnResult } from './task';
24
23
  import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
25
24
 
26
- import type { DOWNLOAD_TYPE, FILE_TYPE } from '../index';
27
-
28
25
  import type { NoParamCallback, WriteStream } from 'fs';
29
26
  import type { SpawnOptions } from 'child_process';
30
27
  import type { BrotliCompress, Gzip } from 'zlib';
@@ -80,13 +77,19 @@ declare namespace functions {
80
77
  tryImage(file: string | Buffer, output: string, config: CompressFormat, callback?: TryImageResult): Promise<BufferResult>;
81
78
  }
82
79
 
83
- interface CompressConstructor extends ModuleConstructor {
80
+ interface CompressConstructor<T extends CompressModule<U> = CompressModule<any>, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
84
81
  singleton(): ICompress<CompressModule>;
85
- readonly prototype: ICompress<CompressModule>;
86
- new(module?: CompressModule): ICompress<CompressModule>;
82
+ readonly prototype: ICompress<T, U>;
83
+ new(module?: U): ICompress<T, U>;
87
84
  }
88
85
 
89
86
  interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U, FunctionType> {
87
+ resizeData?: ResizeData;
88
+ cropData?: CropData;
89
+ rotateData?: RotateData;
90
+ qualityData?: QualityData;
91
+ methodData?: [string, unknown[]?][];
92
+ opacityValue?: number;
90
93
  setCommand(value: string | CommandData, outputAs?: string): void;
91
94
  getCommand(): string;
92
95
  parseCommand(value: string): CommandData;
@@ -100,15 +103,15 @@ declare namespace functions {
100
103
  get outputAs(): string;
101
104
  }
102
105
 
103
- interface ImageConstructor<T extends IHost = IHost, U extends IImage<T> = IImage<T>> extends ModuleConstructor {
106
+ interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
104
107
  readonly REGEXP_SIZERANGE: RegExp;
105
108
  transform(file: string, command: string, options?: TransformOptions): Promise<Null<Buffer> | string>;
106
109
  clamp(value: unknown, min?: number, max?: number): number;
107
110
  isBinary(mime: unknown): mime is string;
108
111
  toABGR(buffer: Uint8Array | Buffer): Buffer;
109
- using?<V extends ExternalAsset>(this: T, instance: U, data: IFileThread<V>, command: string): Promise<unknown>;
110
- readonly prototype: U;
111
- new(module?: ImageModule): U;
112
+ using?<V extends ExternalAsset>(this: T, instance: IImage<T, U>, data: IFileThread<V>, command: string): Promise<unknown>;
113
+ readonly prototype: IImage<T, U>;
114
+ new(module?: U): IImage<T, U>;
112
115
  }
113
116
 
114
117
  interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
@@ -121,11 +124,11 @@ declare namespace functions {
121
124
  execute?<V extends IFileManager<W>, W extends ExternalAsset>(manager: V, task: PlainObject, callback: (value?: unknown) => void): void;
122
125
  }
123
126
 
124
- interface TaskConstructor<T extends IHost = IHost, U extends ITask<T> = ITask<T>> extends ModuleConstructor {
125
- finalize<V extends ExternalAsset>(this: T, instance: U, assets: V[]): Promise<unknown>;
126
- using?<V extends ExternalAsset>(this: T, instance: U, assets: V[], preceding?: boolean): Promise<unknown>;
127
- readonly prototype: U;
128
- new(module?: TaskModule, ...args: unknown[]): U;
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
+ using?<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[], preceding?: boolean): Promise<unknown>;
130
+ readonly prototype: ITask<T, U>;
131
+ new(module?: U, ...args: unknown[]): ITask<T, U>;
129
132
  }
130
133
 
131
134
  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> {
@@ -150,11 +153,11 @@ declare namespace functions {
150
153
  get commandType(): SQL_COMMAND;
151
154
  }
152
155
 
153
- interface DbConstructor<T extends IHost = IHost, U extends IDb<T> = IDb<T>> extends ClientDbConstructor<T> {
156
+ interface DbConstructor<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource> extends ClientDbConstructor<T> {
154
157
  setPoolConfig(value: ObjectMap<PoolConfig>): void;
155
158
  getPoolConfig(source: string): Undef<Required<PoolConfig>>;
156
- readonly prototype: U;
157
- new(module?: DbModule, database?: DataSource[], ...args: unknown[]): U;
159
+ readonly prototype: IDb<T, U, V>;
160
+ new(module?: U, database?: V[], ...args: unknown[]): IDb<T, U, V>;
158
161
  }
159
162
 
160
163
  interface ICloud<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase, W extends CloudServiceOptions = CloudServiceOptions, X extends DbCoerceSettings = DbCoerceSettings> extends IClientDb<T, U, V, W, X> {
@@ -183,7 +186,7 @@ declare namespace functions {
183
186
  resolveService(service: string, folder?: string): string;
184
187
  }
185
188
 
186
- interface CloudConstructor<T extends IHost = IHost, U extends ICloud<T> = ICloud<T>> extends ClientDbConstructor<T> {
189
+ interface CloudConstructor<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase> extends ClientDbConstructor<T> {
187
190
  LOG_CLOUD_FAIL: LogMessageOptions;
188
191
  LOG_CLOUD_COMMAND: LogMessageOptions;
189
192
  LOG_CLOUD_WARN: LogMessageOptions;
@@ -191,12 +194,12 @@ declare namespace functions {
191
194
  LOG_CLOUD_DOWNLOAD: LogMessageOptions;
192
195
  LOG_CLOUD_DELETE: LogMessageOptions;
193
196
  LOG_CLOUD_DELAYED: LogMessageOptions;
194
- finalize(this: T, instance: U): Promise<unknown>;
195
- uploadAsset<V extends IFileManager<W>, W extends ExternalAsset>(state: IScopeOrigin<V, ICloud<V>>, file: W, ignoreProcess: boolean): Promise<unknown>;
196
- uploadAsset<V extends IFileManager<W>, W extends ExternalAsset>(state: IScopeOrigin<V, ICloud<V>>, file: W, contentType?: string, ignoreProcess?: boolean): Promise<unknown>;
197
- sanitizeAssets<V extends ExternalAsset>(assets: V[]): V[];
198
- readonly prototype: U;
199
- new(module?: CloudModule, database?: CloudDatabase[], ...args: unknown[]): U;
197
+ finalize(this: T, instance: ICloud<T, U, V>): Promise<unknown>;
198
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<unknown>[];
199
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string, ignoreProcess?: boolean): Promise<unknown>[];
200
+ sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
201
+ readonly prototype: ICloud<T, U, V>;
202
+ new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
200
203
  }
201
204
 
202
205
  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> extends IClient<T, V, TransformCallback<T, U>> {
@@ -235,23 +238,24 @@ declare namespace functions {
235
238
  cloudUpload?(state: IScopeOrigin<T, Y>, file: U, url: string, active: boolean): Promise<boolean>;
236
239
  cloudFinalize?(state: IScopeOrigin<T, Y>): Promise<unknown[]>;
237
240
  watchInit?(watch: IFileGroup<U>, assets: U[], sanitize?: boolean): Undef<WatchInitResult>;
238
- watchModified?: ModifiedPostFinalizeListener<U>;
241
+ watchModified?(watch: IFileGroup<U>, assets?: U[]): PostFinalizeCallback;
239
242
  set dataSource(value: DataSource[]);
240
243
  get dataSource(): DataSource[];
241
244
  get watching(): boolean;
242
245
  }
243
246
 
244
- interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends IDocument<T, U> = IDocument<T, U>> extends ModuleConstructor {
245
- finalize(this: T, instance: V): Promise<unknown>;
246
- createSourceMap(code: string, uri?: string): SourceMap;
247
+ 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> extends ModuleConstructor {
248
+ finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
249
+ createSourceMap(code: string, remove: boolean): SourceMap;
250
+ createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
247
251
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
248
252
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions | boolean): string;
249
253
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
250
- using?(this: T, instance: V, file: U): Promise<unknown>;
251
- cleanup?(this: T, instance: V): Promise<unknown>;
254
+ using?(this: T, instance: IDocument<T, U, V, W, X, Y>, file: U): Promise<unknown>;
255
+ cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
252
256
  sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
253
- readonly prototype: V;
254
- new(module?: DocumentModule, ...args: unknown[]): V;
257
+ readonly prototype: IDocument<T, U, V, W, X, Y>;
258
+ new(module?: V, ...args: unknown[]): IDocument<T, U, V, W, X, Y>;
255
259
  }
256
260
 
257
261
  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> {
@@ -275,15 +279,15 @@ declare namespace functions {
275
279
  get securePort(): number;
276
280
  }
277
281
 
278
- interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends IWatch<T, U> = IWatch<T, U>> extends ModuleConstructor {
282
+ interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
279
283
  createServer(port: number, active: boolean): Undef<ws.Server>;
280
284
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Undef<ws.Server>;
281
285
  shutdown(): void;
282
286
  setTimeout(value: NumString): void;
283
287
  checkTimeout(client: ws): boolean;
284
- readonly prototype: V;
285
- new(module?: WatchModule): V;
286
- new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): V;
288
+ readonly prototype: IWatch<T, U, V, W>;
289
+ new(module?: V): IWatch<T, U, V, W>;
290
+ new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
287
291
  }
288
292
 
289
293
  interface IRequest<T extends RequestModule<U>, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
@@ -323,7 +327,7 @@ declare namespace functions {
323
327
  get ipVersion(): InternetProtocolVersion;
324
328
  }
325
329
 
326
- interface RequestConstructor extends ModuleConstructor {
330
+ interface RequestConstructor<T extends RequestModule<U> = RequestModule<any>, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
327
331
  readCACert(value: string, cache?: boolean): string;
328
332
  readTLSKey(value: string, cache?: boolean): string;
329
333
  readTLSCert(value: string, cache?: boolean): string;
@@ -333,8 +337,8 @@ declare namespace functions {
333
337
  defineHttpAgent(options: HttpAgentSettings): void;
334
338
  defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
335
339
  getAria2Path(): string;
336
- readonly prototype: IRequest<RequestModule>;
337
- new(module?: RequestModule): IRequest<RequestModule>;
340
+ readonly prototype: IRequest<T, U>;
341
+ new(module?: T): IRequest<T, U>;
338
342
  }
339
343
 
340
344
  interface IFileManager<T extends ExternalAsset = ExternalAsset> extends IHost, Set<string> {
@@ -383,7 +387,7 @@ declare namespace functions {
383
387
  rename(file: T, value: string): boolean;
384
388
  performAsyncTask(): void;
385
389
  removeAsyncTask(): void;
386
- completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: FILE_TYPE): void;
390
+ completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: number): void;
387
391
  performFinalize(override?: boolean): void;
388
392
  hasDocument(instance: IModule, document: Undef<StringOfArray>): boolean;
389
393
  getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
@@ -398,8 +402,8 @@ declare namespace functions {
398
402
  getProcessTimeout(handler: InstallData): number;
399
403
  clearProcessTimeout(): void;
400
404
  addDownload(value: number | BufferContent, encoding: BufferEncoding): number;
401
- addDownload(value: number | BufferContent, type?: DOWNLOAD_TYPE, encoding?: BufferEncoding): number;
402
- getDownload(type?: DOWNLOAD_TYPE): TupleOf<number>;
405
+ addDownload(value: number | BufferContent, type?: number, encoding?: BufferEncoding): number;
406
+ getDownload(type?: number): TupleOf<number>;
403
407
  transformAsset(data: IFileThread<T>, parent?: T): Promise<void>;
404
408
  addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): Undef<string>;
405
409
  findMime(file: T, rename?: boolean): Promise<string>;
@@ -441,7 +445,7 @@ declare namespace functions {
441
445
  get cleared(): boolean;
442
446
 
443
447
  /* Set */
444
- add(value: string, parent?: T, type?: FILE_TYPE): this;
448
+ add(value: string, parent?: T, type?: number): this;
445
449
  delete(value: string, emptyDir?: boolean): boolean;
446
450
  has(value: unknown): value is string;
447
451
 
@@ -539,7 +543,7 @@ declare namespace functions {
539
543
  interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
540
544
  readonly status: LogStatus<StatusType>[];
541
545
  readonly errors: unknown[];
542
- supported: SupportedMethod;
546
+ supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
543
547
  supports(name: string, value?: boolean): boolean;
544
548
  getTempDir(options: GetTempDirOptions): string;
545
549
  getTempDir(uuidDir: boolean, createDir?: boolean): string;
@@ -584,10 +588,10 @@ declare namespace functions {
584
588
  removeDir<U extends Promise<boolean>>(src: string, options: RemoveDirOptions, promises: true): U;
585
589
  removeDir<U extends NoParamCallback>(src: string, callback: U): void;
586
590
  removeDir<U extends NoParamCallback>(src: string, options: RemoveDirOptions, callback: U): void;
587
- allSettled: AllSettledMethod<true>;
588
- formatMessage: ModuleFormatMessageMethod;
591
+ allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseFulfilledResult<U>[]>;
592
+ formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
589
593
  formatFail(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogFailOptions): void;
590
- writeFail: ModuleWriteFailMethod;
594
+ writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
591
595
  writeTimeProcess(title: string, value: string, startTime: LogTime, options?: LogProcessOptions): void;
592
596
  writeTimeElapsed(title: string, value: LogValue, startTime: LogTime, options?: LogMessageOptions): void;
593
597
  checkPackage(err: unknown, name: Undef<string>, options?: LogFailOptions | LogType): boolean;
@@ -658,7 +662,7 @@ declare namespace functions {
658
662
  emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
659
663
  }
660
664
 
661
- interface ModuleConstructor {
665
+ interface ModuleConstructor<T extends IHost = IHost> {
662
666
  PROCESS_TIMEOUT: number;
663
667
  LOG_STYLE_FAIL: LogMessageOptions;
664
668
  LOG_STYLE_SUCCESS: LogMessageOptions;
@@ -670,12 +674,12 @@ declare namespace functions {
670
674
  readonly LOG_TYPE: LOG_TYPE;
671
675
  readonly STATUS_TYPE: STATUS_TYPE;
672
676
  readonly MAX_TIMEOUT: number;
673
- supported: SupportedMethod;
674
- formatMessage: ModuleFormatMessageMethod;
675
- writeFail: ModuleWriteFailMethod;
677
+ supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
678
+ formatMessage(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions): void;
679
+ writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
676
680
  enabled(key: string, username?: string): boolean;
677
- parseFunction<T = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<T> | T>>;
678
- parseFunction<T = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<T> | T>>;
681
+ parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
682
+ parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
679
683
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
680
684
  asHash(data: BinaryLike, options: AsHashOptions): string;
681
685
  asHash(data: BinaryLike, minLength: number): string;
@@ -724,8 +728,8 @@ declare namespace functions {
724
728
  purgeMemory(percent?: number, limit?: number, parent?: boolean | number): Promise<number>;
725
729
  canWrite(name: "temp" | "home"): boolean;
726
730
  loadSettings(settings: Settings, password?: string): boolean;
727
- readonly prototype: IModule;
728
- new(): IModule;
731
+ readonly prototype: IModule<T>;
732
+ new(): IModule<T>;
729
733
  }
730
734
  }
731
735
 
package/lib/logger.d.ts CHANGED
@@ -119,6 +119,4 @@ export type ForegroundColor = typeof IForegroundColor | HexColor;
119
119
  export type TextAlign = "left" | "center" | "right";
120
120
  export type ErrorOutMethod = (err: Error, data: LogTypeValue, require?: NodeRequire) => void;
121
121
  export type BroadcastOutMethod = (value: string, options: LogMessageOptions, require?: NodeRequire) => void;
122
- export type BroadcastValue = StringOfArray | { value: StringOfArray; stripAnsi?: boolean };
123
- export type ModuleWriteFailMethod = (value: LogValue, message?: unknown, options?: LogFailOptions | LogType) => void;
124
- export type ModuleFormatMessageMethod = (type: LogType, title: string, value: LogValue, message?: unknown, options?: LogMessageOptions) => void;
122
+ export type BroadcastValue = StringOfArray | { value: StringOfArray; stripAnsi?: boolean };
package/lib/settings.d.ts CHANGED
@@ -194,7 +194,7 @@ export interface PurgeComponent extends PurgeBase {
194
194
  export type DbCacheValue = NumString | DbCacheSettings;
195
195
  export type DbCoerceValue = boolean | DbCoerceSettings;
196
196
 
197
- export type ImageModule = ClientModule<ImageSettings>;
197
+ export type ImageModule<T = ImageSettings> = ClientModule<T>;
198
198
 
199
199
  export interface ImageSettings extends PlainObject {
200
200
  cache?: boolean;
@@ -266,7 +266,7 @@ export interface CompressSettings extends PlainObject {
266
266
  chunk_size?: NumString;
267
267
  }
268
268
 
269
- export interface TaskModule<T = PlainObject> extends ClientModule<T>, AnyObject {}
269
+ export interface TaskModule<T = PlainObject> extends ClientModule<T>, PlainObject {}
270
270
 
271
271
  export interface CloudModule<T = CloudSettings> extends ClientModule<T>, CloudServiceDataType<ObjectMap<AnyObject>>, PlainObject {
272
272
  apiVersion?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",