@e-mc/types 0.2.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
@@ -168,8 +168,8 @@ export const enum PACKAGE_NAME {
168
168
  DB = '@e-mc/db',
169
169
  DB_POOL = '@e-mc/db/pool',
170
170
  DOCUMENT = '@e-mc/document',
171
- DOCUMENT_ANDROID = '@e-mc/document/android',
172
- DOCUMENT_CHROME = '@e-mc/document/chrome',
171
+ DOCUMENT_ANDROID = '@e-mc2/android',
172
+ DOCUMENT_CHROME = '@e-mc2/chrome',
173
173
  DOCUMENT_TRANSFORM = '@e-mc/document/transform',
174
174
  DOCUMENT_UTIL = '@e-mc/document/util',
175
175
  FILE_MANAGER = '@e-mc/file-manager',
package/index.d.ts CHANGED
@@ -210,10 +210,10 @@ 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
217
  };
218
218
 
219
219
  interface THRESHOLD {
package/index.js CHANGED
@@ -253,12 +253,6 @@ var IMPORT_MAP;
253
253
  IMPORT_MAP["@squared-functions/db/pool"] = "@e-mc/db/pool";
254
254
  IMPORT_MAP["@squared-functions/db/util"] = "@e-mc/db/util";
255
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
256
  IMPORT_MAP["@squared-functions/document/parse"] = "@e-mc/document/parse";
263
257
  IMPORT_MAP["@squared-functions/document/parse/dom"] = "@e-mc/document/parse/dom";
264
258
  IMPORT_MAP["@squared-functions/document/transform"] = "@e-mc/document/transform";
@@ -266,16 +260,22 @@ var IMPORT_MAP;
266
260
  IMPORT_MAP["@squared-functions/document/util"] = "@e-mc/document/util";
267
261
  IMPORT_MAP["@squared-functions/file-manager"] = "@e-mc/file-manager";
268
262
  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
263
  IMPORT_MAP["@squared-functions/image-v3"] = "@e-mc/image";
272
- IMPORT_MAP["@squared-functions/image-v3/jimp"] = "@e-mc2/jimp";
273
264
  IMPORT_MAP["@squared-functions/module"] = "@e-mc/module";
274
265
  IMPORT_MAP["@squared-functions/task"] = "@e-mc/task";
275
- IMPORT_MAP["@squared-functions/task/gulp"] = "@e-mc2/gulp";
276
266
  IMPORT_MAP["@squared-functions/types"] = "@e-mc/types";
277
267
  IMPORT_MAP["@squared-functions/watch"] = "@e-mc/watch";
278
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";
279
279
  IMPORT_MAP["@squared-functions/cloud/atlas"] = "@e-mc2/atlas";
280
280
  IMPORT_MAP["@squared-functions/cloud/aws"] = "@e-mc2/aws";
281
281
  IMPORT_MAP["@squared-functions/cloud/aws/download"] = "@e-mc2/aws/download";
@@ -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> {
@@ -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/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';
@@ -198,8 +195,8 @@ declare namespace functions {
198
195
  LOG_CLOUD_DELETE: LogMessageOptions;
199
196
  LOG_CLOUD_DELAYED: LogMessageOptions;
200
197
  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>;
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>[];
203
200
  sanitizeAssets<W extends ExternalAsset>(assets: W[]): W[];
204
201
  readonly prototype: ICloud<T, U, V>;
205
202
  new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
@@ -241,24 +238,24 @@ declare namespace functions {
241
238
  cloudUpload?(state: IScopeOrigin<T, Y>, file: U, url: string, active: boolean): Promise<boolean>;
242
239
  cloudFinalize?(state: IScopeOrigin<T, Y>): Promise<unknown[]>;
243
240
  watchInit?(watch: IFileGroup<U>, assets: U[], sanitize?: boolean): Undef<WatchInitResult>;
244
- watchModified?: ModifiedPostFinalizeListener<U>;
241
+ watchModified?(watch: IFileGroup<U>, assets?: U[]): PostFinalizeCallback;
245
242
  set dataSource(value: DataSource[]);
246
243
  get dataSource(): DataSource[];
247
244
  get watching(): boolean;
248
245
  }
249
246
 
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>;
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>;
252
249
  createSourceMap(code: string, remove: boolean): SourceMap;
253
250
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
254
251
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
255
252
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions | boolean): string;
256
253
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
257
- using?(this: T, instance: IDocument<T, U, V>, file: U): Promise<unknown>;
258
- cleanup?(this: T, instance: IDocument<T, U, 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>;
259
256
  sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
260
- readonly prototype: IDocument<T, U, V>;
261
- new(module?: V, ...args: unknown[]): IDocument<T, U, V>;
257
+ readonly prototype: IDocument<T, U, V, W, X, Y>;
258
+ new(module?: V, ...args: unknown[]): IDocument<T, U, V, W, X, Y>;
262
259
  }
263
260
 
264
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> {
@@ -390,7 +387,7 @@ declare namespace functions {
390
387
  rename(file: T, value: string): boolean;
391
388
  performAsyncTask(): void;
392
389
  removeAsyncTask(): void;
393
- completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: FILE_TYPE): void;
390
+ completeAsyncTask(err?: unknown, uri?: string, parent?: T, type?: number): void;
394
391
  performFinalize(override?: boolean): void;
395
392
  hasDocument(instance: IModule, document: Undef<StringOfArray>): boolean;
396
393
  getDocumentAssets(instance: IModule, condition?: FunctionArgs<[T], boolean>): T[];
@@ -405,8 +402,8 @@ declare namespace functions {
405
402
  getProcessTimeout(handler: InstallData): number;
406
403
  clearProcessTimeout(): void;
407
404
  addDownload(value: number | BufferContent, encoding: BufferEncoding): number;
408
- addDownload(value: number | BufferContent, type?: DOWNLOAD_TYPE, encoding?: BufferEncoding): number;
409
- getDownload(type?: DOWNLOAD_TYPE): TupleOf<number>;
405
+ addDownload(value: number | BufferContent, type?: number, encoding?: BufferEncoding): number;
406
+ getDownload(type?: number): TupleOf<number>;
410
407
  transformAsset(data: IFileThread<T>, parent?: T): Promise<void>;
411
408
  addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): Undef<string>;
412
409
  findMime(file: T, rename?: boolean): Promise<string>;
@@ -448,7 +445,7 @@ declare namespace functions {
448
445
  get cleared(): boolean;
449
446
 
450
447
  /* Set */
451
- add(value: string, parent?: T, type?: FILE_TYPE): this;
448
+ add(value: string, parent?: T, type?: number): this;
452
449
  delete(value: string, emptyDir?: boolean): boolean;
453
450
  has(value: unknown): value is string;
454
451
 
@@ -546,7 +543,7 @@ declare namespace functions {
546
543
  interface IModule<T extends IHost = IHost> extends EventEmitter, IAbortComponent {
547
544
  readonly status: LogStatus<StatusType>[];
548
545
  readonly errors: unknown[];
549
- supported: SupportedMethod;
546
+ supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
550
547
  supports(name: string, value?: boolean): boolean;
551
548
  getTempDir(options: GetTempDirOptions): string;
552
549
  getTempDir(uuidDir: boolean, createDir?: boolean): string;
@@ -591,10 +588,10 @@ declare namespace functions {
591
588
  removeDir<U extends Promise<boolean>>(src: string, options: RemoveDirOptions, promises: true): U;
592
589
  removeDir<U extends NoParamCallback>(src: string, callback: U): void;
593
590
  removeDir<U extends NoParamCallback>(src: string, options: RemoveDirOptions, callback: U): void;
594
- allSettled: AllSettledMethod<true>;
595
- 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;
596
593
  formatFail(type: LogType, title: string, value: LogValue, message?: unknown, options?: LogFailOptions): void;
597
- writeFail: ModuleWriteFailMethod;
594
+ writeFail(value: LogValue, message?: unknown, options?: LogFailOptions | LogType): void;
598
595
  writeTimeProcess(title: string, value: string, startTime: LogTime, options?: LogProcessOptions): void;
599
596
  writeTimeElapsed(title: string, value: LogValue, startTime: LogTime, options?: LogMessageOptions): void;
600
597
  checkPackage(err: unknown, name: Undef<string>, options?: LogFailOptions | LogType): boolean;
@@ -677,9 +674,9 @@ declare namespace functions {
677
674
  readonly LOG_TYPE: LOG_TYPE;
678
675
  readonly STATUS_TYPE: STATUS_TYPE;
679
676
  readonly MAX_TIMEOUT: number;
680
- supported: SupportedMethod;
681
- formatMessage: ModuleFormatMessageMethod;
682
- 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;
683
680
  enabled(key: string, username?: string): boolean;
684
681
  parseFunction<U = unknown>(value: unknown, options?: ParseFunctionOptions): Null<FunctionType<Promise<U> | U>>;
685
682
  parseFunction<U = unknown>(value: unknown, absolute: boolean, sync?: boolean): Null<FunctionType<Promise<U> | U>>;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.2.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",