@e-mc/types 0.0.4 → 0.2.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,
@@ -167,13 +174,13 @@ export const enum PACKAGE_NAME {
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
@@ -216,6 +216,16 @@ declare namespace types {
216
216
  ERROR: string;
217
217
  };
218
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;
227
+ };
228
+
219
229
  const IMPORT_MAP: StringMap;
220
230
 
221
231
  type WatchEventValue = WATCH_EVENT[keyof WATCH_EVENT];
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/android"] = "@e-mc/document/android";
257
+ IMPORT_MAP["@squared-functions/document/android/extensions/app/manifest"] = "@e-mc/document/android/extensions/app/manifest";
258
+ IMPORT_MAP["@squared-functions/document/android/extensions/gradle/dependencies"] = "@e-mc/document/android/extensions/gradle/dependencies";
259
+ IMPORT_MAP["@squared-functions/document/android/extensions/gradle/settings"] = "@e-mc/document/android/extensions/gradle/settings";
260
+ IMPORT_MAP["@squared-functions/document/android/extensions/task"] = "@e-mc/document/android/extensions/task";
261
+ IMPORT_MAP["@squared-functions/document/chrome"] = "@e-mc/document/chrome";
262
+ IMPORT_MAP["@squared-functions/document/parse"] = "@e-mc/document/parse";
263
+ IMPORT_MAP["@squared-functions/document/parse/dom"] = "@e-mc/document/parse/dom";
264
+ IMPORT_MAP["@squared-functions/document/transform"] = "@e-mc/document/transform";
265
+ IMPORT_MAP["@squared-functions/document/asset"] = "@e-mc/document/asset";
266
+ IMPORT_MAP["@squared-functions/document/util"] = "@e-mc/document/util";
267
+ IMPORT_MAP["@squared-functions/file-manager"] = "@e-mc/file-manager";
268
+ IMPORT_MAP["@squared-functions/file-manager/http/host"] = "@e-mc/request/http/host";
269
+ IMPORT_MAP["@squared-functions/image/jimp"] = "@e-mc2/jimp";
270
+ IMPORT_MAP["@squared-functions/image/jimp/util"] = "@e-mc2/jimp/util";
271
+ IMPORT_MAP["@squared-functions/image-v3"] = "@e-mc/image";
272
+ IMPORT_MAP["@squared-functions/image-v3/jimp"] = "@e-mc2/jimp";
273
+ IMPORT_MAP["@squared-functions/module"] = "@e-mc/module";
274
+ IMPORT_MAP["@squared-functions/task"] = "@e-mc/task";
275
+ IMPORT_MAP["@squared-functions/task/gulp"] = "@e-mc2/gulp";
276
+ IMPORT_MAP["@squared-functions/types"] = "@e-mc/types";
277
+ IMPORT_MAP["@squared-functions/watch"] = "@e-mc/watch";
278
+ IMPORT_MAP["@squared-functions/watch/filegroup"] = "@e-mc/watch/filegroup";
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';
@@ -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> {
package/lib/db.d.ts CHANGED
@@ -110,4 +110,4 @@ export interface SQL_COMMAND {
110
110
  DELETE: 4;
111
111
  }
112
112
 
113
- export type { DB_TYPE, CacheOptions, IdentifierAction, RedisCommandArgument, RedisJSON };
113
+ export type { DB_TYPE, CacheOptions, IdentifierAction };
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
@@ -80,13 +80,19 @@ declare namespace functions {
80
80
  tryImage(file: string | Buffer, output: string, config: CompressFormat, callback?: TryImageResult): Promise<BufferResult>;
81
81
  }
82
82
 
83
- interface CompressConstructor extends ModuleConstructor {
83
+ interface CompressConstructor<T extends CompressModule<U> = CompressModule<any>, U extends CompressSettings = CompressSettings> extends ModuleConstructor {
84
84
  singleton(): ICompress<CompressModule>;
85
- readonly prototype: ICompress<CompressModule>;
86
- new(module?: CompressModule): ICompress<CompressModule>;
85
+ readonly prototype: ICompress<T, U>;
86
+ new(module?: U): ICompress<T, U>;
87
87
  }
88
88
 
89
89
  interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U, FunctionType> {
90
+ resizeData?: ResizeData;
91
+ cropData?: CropData;
92
+ rotateData?: RotateData;
93
+ qualityData?: QualityData;
94
+ methodData?: [string, unknown[]?][];
95
+ opacityValue?: number;
90
96
  setCommand(value: string | CommandData, outputAs?: string): void;
91
97
  getCommand(): string;
92
98
  parseCommand(value: string): CommandData;
@@ -100,15 +106,15 @@ declare namespace functions {
100
106
  get outputAs(): string;
101
107
  }
102
108
 
103
- interface ImageConstructor<T extends IHost = IHost, U extends IImage<T> = IImage<T>> extends ModuleConstructor {
109
+ interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
104
110
  readonly REGEXP_SIZERANGE: RegExp;
105
111
  transform(file: string, command: string, options?: TransformOptions): Promise<Null<Buffer> | string>;
106
112
  clamp(value: unknown, min?: number, max?: number): number;
107
113
  isBinary(mime: unknown): mime is string;
108
114
  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;
115
+ using?<V extends ExternalAsset>(this: T, instance: IImage<T, U>, data: IFileThread<V>, command: string): Promise<unknown>;
116
+ readonly prototype: IImage<T, U>;
117
+ new(module?: U): IImage<T, U>;
112
118
  }
113
119
 
114
120
  interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
@@ -121,11 +127,11 @@ declare namespace functions {
121
127
  execute?<V extends IFileManager<W>, W extends ExternalAsset>(manager: V, task: PlainObject, callback: (value?: unknown) => void): void;
122
128
  }
123
129
 
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;
130
+ interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
131
+ finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
132
+ using?<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[], preceding?: boolean): Promise<unknown>;
133
+ readonly prototype: ITask<T, U>;
134
+ new(module?: U, ...args: unknown[]): ITask<T, U>;
129
135
  }
130
136
 
131
137
  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 +156,11 @@ declare namespace functions {
150
156
  get commandType(): SQL_COMMAND;
151
157
  }
152
158
 
153
- interface DbConstructor<T extends IHost = IHost, U extends IDb<T> = IDb<T>> extends ClientDbConstructor<T> {
159
+ interface DbConstructor<T extends IHost = IHost, U extends DbModule = DbModule, V extends DbDataSource = DbDataSource> extends ClientDbConstructor<T> {
154
160
  setPoolConfig(value: ObjectMap<PoolConfig>): void;
155
161
  getPoolConfig(source: string): Undef<Required<PoolConfig>>;
156
- readonly prototype: U;
157
- new(module?: DbModule, database?: DataSource[], ...args: unknown[]): U;
162
+ readonly prototype: IDb<T, U, V>;
163
+ new(module?: U, database?: V[], ...args: unknown[]): IDb<T, U, V>;
158
164
  }
159
165
 
160
166
  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 +189,7 @@ declare namespace functions {
183
189
  resolveService(service: string, folder?: string): string;
184
190
  }
185
191
 
186
- interface CloudConstructor<T extends IHost = IHost, U extends ICloud<T> = ICloud<T>> extends ClientDbConstructor<T> {
192
+ interface CloudConstructor<T extends IHost = IHost, U extends CloudModule = CloudModule, V extends CloudDatabase = CloudDatabase> extends ClientDbConstructor<T> {
187
193
  LOG_CLOUD_FAIL: LogMessageOptions;
188
194
  LOG_CLOUD_COMMAND: LogMessageOptions;
189
195
  LOG_CLOUD_WARN: LogMessageOptions;
@@ -191,12 +197,12 @@ declare namespace functions {
191
197
  LOG_CLOUD_DOWNLOAD: LogMessageOptions;
192
198
  LOG_CLOUD_DELETE: LogMessageOptions;
193
199
  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;
200
+ finalize(this: T, instance: ICloud<T, U, V>): Promise<unknown>;
201
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, ignoreProcess: boolean): Promise<unknown>;
202
+ uploadAsset<W extends IFileManager<X>, X extends ExternalAsset>(state: IScopeOrigin<W, ICloud<W>>, file: X, contentType?: string, ignoreProcess?: boolean): Promise<unknown>;
203
+ sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
204
+ readonly prototype: ICloud<T, U, V>;
205
+ new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
200
206
  }
201
207
 
202
208
  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>> {
@@ -241,17 +247,18 @@ declare namespace functions {
241
247
  get watching(): boolean;
242
248
  }
243
249
 
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;
250
+ interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule> extends ModuleConstructor {
251
+ finalize(this: T, instance: IDocument<T, U, V>): Promise<unknown>;
252
+ createSourceMap(code: string, remove: boolean): SourceMap;
253
+ createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
247
254
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
248
255
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions | boolean): string;
249
256
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
250
- using?(this: T, instance: V, file: U): Promise<unknown>;
251
- cleanup?(this: T, instance: V): Promise<unknown>;
257
+ using?(this: T, instance: IDocument<T, U, V>, file: U): Promise<unknown>;
258
+ cleanup?(this: T, instance: IDocument<T, U, V>): Promise<unknown>;
252
259
  sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
253
- readonly prototype: V;
254
- new(module?: DocumentModule, ...args: unknown[]): V;
260
+ readonly prototype: IDocument<T, U, V>;
261
+ new(module?: V, ...args: unknown[]): IDocument<T, U, V>;
255
262
  }
256
263
 
257
264
  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 +282,15 @@ declare namespace functions {
275
282
  get securePort(): number;
276
283
  }
277
284
 
278
- interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends IWatch<T, U> = IWatch<T, U>> extends ModuleConstructor {
285
+ interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
279
286
  createServer(port: number, active: boolean): Undef<ws.Server>;
280
287
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Undef<ws.Server>;
281
288
  shutdown(): void;
282
289
  setTimeout(value: NumString): void;
283
290
  checkTimeout(client: ws): boolean;
284
- readonly prototype: V;
285
- new(module?: WatchModule): V;
286
- new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): V;
291
+ readonly prototype: IWatch<T, U, V, W>;
292
+ new(module?: V): IWatch<T, U, V, W>;
293
+ new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
287
294
  }
288
295
 
289
296
  interface IRequest<T extends RequestModule<U>, U extends RequestSettings = RequestSettings> extends IModule, IExternalConfig<T, U> {
@@ -323,7 +330,7 @@ declare namespace functions {
323
330
  get ipVersion(): InternetProtocolVersion;
324
331
  }
325
332
 
326
- interface RequestConstructor extends ModuleConstructor {
333
+ interface RequestConstructor<T extends RequestModule<U> = RequestModule<any>, U extends RequestSettings = RequestSettings> extends ModuleConstructor {
327
334
  readCACert(value: string, cache?: boolean): string;
328
335
  readTLSKey(value: string, cache?: boolean): string;
329
336
  readTLSCert(value: string, cache?: boolean): string;
@@ -333,8 +340,8 @@ declare namespace functions {
333
340
  defineHttpAgent(options: HttpAgentSettings): void;
334
341
  defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
335
342
  getAria2Path(): string;
336
- readonly prototype: IRequest<RequestModule>;
337
- new(module?: RequestModule): IRequest<RequestModule>;
343
+ readonly prototype: IRequest<T, U>;
344
+ new(module?: T): IRequest<T, U>;
338
345
  }
339
346
 
340
347
  interface IFileManager<T extends ExternalAsset = ExternalAsset> extends IHost, Set<string> {
@@ -658,7 +665,7 @@ declare namespace functions {
658
665
  emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
659
666
  }
660
667
 
661
- interface ModuleConstructor {
668
+ interface ModuleConstructor<T extends IHost = IHost> {
662
669
  PROCESS_TIMEOUT: number;
663
670
  LOG_STYLE_FAIL: LogMessageOptions;
664
671
  LOG_STYLE_SUCCESS: LogMessageOptions;
@@ -674,8 +681,8 @@ declare namespace functions {
674
681
  formatMessage: ModuleFormatMessageMethod;
675
682
  writeFail: ModuleWriteFailMethod;
676
683
  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>>;
684
+ parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
685
+ parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
679
686
  asString(value: unknown, cacheKey?: boolean | "throws"): string;
680
687
  asHash(data: BinaryLike, options: AsHashOptions): string;
681
688
  asHash(data: BinaryLike, minLength: number): string;
@@ -724,8 +731,8 @@ declare namespace functions {
724
731
  purgeMemory(percent?: number, limit?: number, parent?: boolean | number): Promise<number>;
725
732
  canWrite(name: "temp" | "home"): boolean;
726
733
  loadSettings(settings: Settings, password?: string): boolean;
727
- readonly prototype: IModule;
728
- new(): IModule;
734
+ readonly prototype: IModule<T>;
735
+ new(): IModule<T>;
729
736
  }
730
737
  }
731
738
 
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.0.4",
3
+ "version": "0.2.0",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",