@e-mc/types 0.13.7 → 0.13.9

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @e-mc/types
2
2
 
3
- * NodeJS 18.20.5 LTS
3
+ * NodeJS 18.20 LTS
4
4
  * ES2022
5
5
 
6
6
  ## General Usage
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.13.7/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.13.9/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -81,6 +81,7 @@ function supported(major: number, minor: number, lts: boolean): boolean;
81
81
  function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
82
82
  function importESM(name: string | URL, isDefault: boolean, fromPath?: boolean): Promise<unknown>;
83
83
  function importESM(name: string | URL, options?: ImportAttributes, fromPath?: boolean): Promise<unknown>;
84
+ function requireESM(name: string, url?: string | URL, expect?: string): unknown;
84
85
  function purgeMemory(percent?: number): number;
85
86
 
86
87
  interface LOG_TYPE {
@@ -208,10 +209,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
208
209
 
209
210
  ## References
210
211
 
211
- - https://www.unpkg.com/@e-mc/types@0.13.7/index.d.ts
212
- - https://www.unpkg.com/@e-mc/types@0.13.7/lib/logger.d.ts
213
- - https://www.unpkg.com/@e-mc/types@0.13.7/lib/module.d.ts
214
- - https://www.unpkg.com/@e-mc/types@0.13.7/lib/node.d.ts
212
+ - https://www.unpkg.com/@e-mc/types@0.13.9/index.d.ts
213
+ - https://www.unpkg.com/@e-mc/types@0.13.9/lib/logger.d.ts
214
+ - https://www.unpkg.com/@e-mc/types@0.13.9/lib/module.d.ts
215
+ - https://www.unpkg.com/@e-mc/types@0.13.9/lib/node.d.ts
215
216
 
216
217
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
217
218
  * https://www.npmjs.com/package/@types/bytes
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.13.7',
2
+ VERSION = '0.13.9',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.d.ts CHANGED
@@ -344,12 +344,15 @@ declare namespace types {
344
344
  function sanitizeCmd(value: string, ...args: unknown[]): string;
345
345
  function sanitizeArgs(value: string, doubleQuote?: boolean): string;
346
346
  function sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
347
- function errorValue(value: string, hint?: string): Error;
348
- function errorMessage(title: number | string, value: string, hint?: string): Error;
347
+ function errorValue(value: string, cause: unknown): Error;
348
+ function errorValue(value: string, hint?: string, cause?: unknown): Error;
349
+ function errorMessage(title: number | string, value: string, cause: unknown): Error;
350
+ function errorMessage(title: number | string, value: string, hint?: string, cause?: unknown): Error;
349
351
  function supported(major: number, minor: number, lts: boolean): boolean;
350
352
  function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
351
353
  function importESM<T = unknown>(name: string | URL, isDefault: boolean, fromPath?: boolean): Promise<T>;
352
354
  function importESM<T = unknown>(name: string | URL, options?: ImportAttributes, fromPath?: boolean): Promise<T>;
355
+ function requireESM<T = unknown>(name: string, url?: string | URL, expect?: string): T;
353
356
  function purgeMemory(percent?: number): number;
354
357
  }
355
358
 
package/index.js CHANGED
@@ -48,15 +48,18 @@ exports.incrementUUID = incrementUUID;
48
48
  exports.hashKey = hashKey;
49
49
  exports.supported = supported;
50
50
  exports.importESM = importESM;
51
+ exports.requireESM = requireESM;
51
52
  const path = require("node:path");
52
53
  const fs = require("node:fs");
53
54
  const crypto = require("node:crypto");
54
55
  const bytes = require("bytes");
56
+ const node_module_1 = require("node:module");
55
57
  const node_os_1 = require("node:os");
56
58
  const node_url_1 = require("node:url");
57
59
  const PATTERN_CHARS = {
58
60
  '&': '\\x26',
59
61
  '!': '\\x21',
62
+ '"': '\\x22',
60
63
  '#': '\\x23',
61
64
  '%': '\\x25',
62
65
  ',': '\\x2c',
@@ -102,6 +105,8 @@ let CACHE_COERCED = new WeakSet();
102
105
  let LOG_CURRENT = null;
103
106
  let SUPPORTED_HASHSINGLE = false;
104
107
  let SUPPORTED_IMPORTATTRIBUTES = false;
108
+ let SUPPORTED_REGEXPESCAPE = false;
109
+ let SUPPORTED_FLOAT16ARRAY = false;
105
110
  let TEMP_DIR = path.join(process.cwd(), "tmp");
106
111
  let INCREMENT_COUNT = 65536;
107
112
  let INCREMENT_PREFIX = '';
@@ -144,6 +149,9 @@ function fromObject(value, typedArray, structured, shared) {
144
149
  if (value instanceof BigUint64Array) {
145
150
  return BigUint64Array.from(value);
146
151
  }
152
+ if (SUPPORTED_FLOAT16ARRAY && value instanceof Float16Array) {
153
+ return Float16Array.from(value);
154
+ }
147
155
  }
148
156
  if (structured) {
149
157
  try {
@@ -176,7 +184,7 @@ function fromObject(value, typedArray, structured, shared) {
176
184
  function trimQuote(value) {
177
185
  value = value.trim();
178
186
  const first = value[0];
179
- return first === value.at(-1) && (first === '"' || first === "'" || first === "`") ? value.substring(1, value.length - 1) : value;
187
+ return first === value.at(-1) && (first === '"' || first === "'" || first === "`") ? value.slice(1, -1) : value;
180
188
  }
181
189
  function checkCipherType(value) {
182
190
  switch (value) {
@@ -761,6 +769,9 @@ function hasGlob(value) {
761
769
  function escapePattern(value, symbols) {
762
770
  switch (typeof value) {
763
771
  case 'string': {
772
+ if (symbols && SUPPORTED_REGEXPESCAPE) {
773
+ return RegExp.escape(value);
774
+ }
764
775
  let result = '', j = 0;
765
776
  for (let i = 0, length = value.length, ch; i < length; ++i) {
766
777
  switch (ch = value[i]) {
@@ -1102,7 +1113,7 @@ function randomString(format, dictionary) {
1102
1113
  let length = 0, available;
1103
1114
  if (b.startsWith('[') && b.endsWith(']')) {
1104
1115
  length = 1;
1105
- available = b.substring(1, b.length - 1);
1116
+ available = b.slice(1, -1);
1106
1117
  }
1107
1118
  else {
1108
1119
  if (isNaN(length = +b)) {
@@ -1191,11 +1202,19 @@ function sanitizeArgs(values, doubleQuote) {
1191
1202
  }
1192
1203
  return (typeof values === 'string' ? result[0] : result);
1193
1204
  }
1194
- function errorValue(value, hint) {
1195
- return new Error(value + (hint ? ` (${hint})` : ''));
1205
+ function errorValue(value, hint, cause) {
1206
+ if (!cause && isObject(hint)) {
1207
+ cause = hint;
1208
+ hint = undefined;
1209
+ }
1210
+ return new Error(value + (hint ? ` (${hint})` : ''), cause ? { cause } : undefined);
1196
1211
  }
1197
- function errorMessage(title, value, hint) {
1198
- return new Error((isString(title) || typeof title === 'number' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''));
1212
+ function errorMessage(title, value, hint, cause) {
1213
+ if (!cause && isObject(hint)) {
1214
+ cause = hint;
1215
+ hint = undefined;
1216
+ }
1217
+ return new Error((isString(title) || typeof title === 'number' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''), cause ? { cause } : undefined);
1199
1218
  }
1200
1219
  function purgeMemory(percent) {
1201
1220
  CACHE_COERCED = new WeakSet();
@@ -1260,5 +1279,10 @@ async function importESM(name, isDefault, fromPath) {
1260
1279
  }
1261
1280
  return result;
1262
1281
  }
1282
+ function requireESM(name, url, expect) {
1283
+ const result = url ? (0, node_module_1.createRequire)(url)(name) : require(name);
1284
+ return process.features.require_module && isObject(result) && result.__esModule && 'default' in result && (!expect || typeof result.default === expect) ? result.default : result;
1285
+ }
1263
1286
  SUPPORTED_HASHSINGLE = supported(20, 12, true) || supported(21, 7);
1264
- SUPPORTED_IMPORTATTRIBUTES = supported(18, 20, 5, true) || supported(20, 18, 3, true) || supported(22, 12, true) || supported(23, 1);
1287
+ SUPPORTED_IMPORTATTRIBUTES = supported(18, 20, true) || supported(20, 10);
1288
+ SUPPORTED_REGEXPESCAPE = SUPPORTED_FLOAT16ARRAY = supported(24);
package/lib/asset.d.ts CHANGED
@@ -36,6 +36,7 @@ export interface IFileThread<T extends ExternalAsset = ExternalAsset> extends IA
36
36
  getObject<U extends FileCommand<T>>(data?: PlainObject): U;
37
37
  get host(): IFileManager<T>;
38
38
  get queuedTasks(): FunctionType<void>[];
39
+ get localUri(): string | undefined;
39
40
  }
40
41
 
41
42
  export interface FileThreadConstructor<T extends ExternalAsset = ExternalAsset> {
@@ -0,0 +1,121 @@
1
+ import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IModule, ModuleConstructor, WatchConstructor } from './index';
2
+
3
+ import type { CloneObjectOptions } from '../index.d';
4
+ import type { ExternalAsset } from './asset';
5
+ import type { CacheOptions } from './core';
6
+ import type { QueryResult } from './db';
7
+ import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
8
+ import type { IHttpMemoryCache } from './filemanager';
9
+ import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
10
+ import type { ParseFunctionOptions } from './module';
11
+ import type { LogFailOptions, LogType, LogValue } from './logger';
12
+ import type { HostConfig, OpenOptions, ProxySettings } from './request';
13
+ import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
14
+
15
+ import type { OutgoingHttpHeaders } from 'http';
16
+ import type { LookupFunction } from 'net';
17
+ import type { Readable, Writable } from 'stream';
18
+
19
+ type CpuUsage = NodeJS.CpuUsage;
20
+
21
+ export interface GetFunctionsOptions extends ParseFunctionOptions {
22
+ outFailed?: string[];
23
+ }
24
+
25
+ export interface IModuleLibV4 {
26
+ isString(value: unknown): value is string;
27
+ isObject<T = object>(value: unknown): value is T;
28
+ isPlainObject<T = PlainObject>(value: unknown): value is T;
29
+ escapePattern(value: unknown, lookBehind?: boolean): string;
30
+ generateUUID(format?: string, dictionary?: string): string;
31
+ validateUUID(value: unknown): boolean;
32
+ cloneObject<T, U = unknown>(data: T, options?: boolean | WeakSet<object> | CloneObjectOptions<U>): T;
33
+ coerceObject<T = unknown>(data: T, parseString?: FunctionType<unknown, string> | boolean, cache?: boolean): T;
34
+ asFunction<T = unknown, U = FunctionType<Promise<T> | T>>(value: unknown, sync?: boolean): Null<U>;
35
+ isFileHTTP(value: string | URL): boolean;
36
+ isFileUNC(value: string | URL): boolean;
37
+ isPathUNC(value: string | URL): boolean;
38
+ toTimeMs(hrtime: HighResolutionTime, format?: boolean): number | string;
39
+ renameExt(value: string, ext: string, when?: string): string;
40
+ existsSafe(value: string, isFile?: boolean): boolean;
41
+ readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<Bufferable>;
42
+ getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
43
+ formatSize(value: number | string, options?: PlainObject): number | string;
44
+ hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
45
+ hasSize(value: string, keepEmpty?: boolean): boolean;
46
+ getSize(value: string, diskUsed?: boolean): number;
47
+ byteLength(value: Bufferable, encoding?: BufferEncoding): number;
48
+ cleanupStream(target: Readable | Writable, pathname?: string): void;
49
+ allSettled<U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise<PromiseSettledResult<U>[]>;
50
+ }
51
+
52
+ export interface IModuleCompatV4<T extends IHost = IHost> extends IModule<T> {
53
+ set startCPU(value);
54
+ get startCPU(): Null<CpuUsage>;
55
+ }
56
+
57
+ export interface ModuleCompatV4Constructor extends ModuleConstructor, IModuleLibV4 {
58
+ readonly prototype: IModuleCompatV4;
59
+ new(...args: unknown[]): IModuleCompatV4;
60
+ }
61
+
62
+ export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> extends IFileManager<T> {
63
+ archiving: boolean;
64
+ cacheHttpRequest: boolean | FirstOf<string>;
65
+ cacheHttpRequestBuffer: IHttpMemoryCache<T>;
66
+ fetchTimeout: number;
67
+ httpProxy: Null<ProxySettings>;
68
+ acceptEncoding: boolean;
69
+ keepAliveTimeout: number;
70
+ addDns(hostname: string, address: string, family?: number | string): void;
71
+ lookupDns(hostname: string): LookupFunction;
72
+ getHttpProxy(uri: string, localhost?: boolean): Null<ProxySettings>;
73
+ getHttpHeaders(uri: string): Undef<OutgoingHttpHeaders>;
74
+ createHttpRequest(uri: string | URL, options?: OpenOptions): HostConfig;
75
+ getHttpClient(uri: string | URL, options: OpenOptions): HttpRequestClient;
76
+ set httpVersion(value);
77
+ get httpVersion(): Null<HttpProtocolVersion>;
78
+ set ipVersion(value);
79
+ get ipVersion(): InternetProtocolVersion;
80
+ }
81
+
82
+ export interface FileManagerCompatV4Constructor<T extends ExternalAsset = ExternalAsset> extends FileManagerConstructor<T> {
83
+ fromHttpStatusCode(value: number | string): string;
84
+ resetHttpHost(version?: HttpProtocolVersion): void;
85
+ defineHttpBuffer(options: HttpMemorySettings): void;
86
+ defineHttpSettings(options: HttpSettings): void;
87
+ defineHttpAgent(options: HttpAgentSettings): void;
88
+ defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
89
+ clearDnsLookup(): void;
90
+ getAria2Path(): string;
91
+ clearHttpBuffer(percent?: number, limit?: number): void;
92
+ readonly prototype: IFileManagerCompatV4<T>;
93
+ new(...args: unknown[]): IFileManagerCompatV4<T>;
94
+ }
95
+
96
+ export interface ICloudCompatV4<T extends IHost = IHost> extends ICloud<T> {
97
+ getDatabaseResult(service: string, credential: unknown, queryString: string, options?: CacheOptions | boolean | string): Undef<QueryResult>;
98
+ setDatabaseResult(service: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
99
+ hasDatabaseCache(service: string, sessionKey?: string): boolean;
100
+ hasDatabaseCoerce(service: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
101
+ }
102
+
103
+ export interface CloudCompatV4Constructor extends CloudConstructor {
104
+ readonly prototype: ICloudCompatV4;
105
+ new(...args: unknown[]): ICloudCompatV4;
106
+ }
107
+
108
+ export interface WatchCompatV4Constructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> extends WatchConstructor<T, U> {
109
+ readCACert(value: string, cache?: boolean): string;
110
+ readTLSKey(value: string, cache?: boolean): string;
111
+ readTLSCert(value: string, cache?: boolean): string;
112
+ isCert(value: string): boolean;
113
+ parseExpires(value: number | string, start?: number): number;
114
+ }
115
+
116
+ export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransformSeries<T, U>, PropertyAction<OutV3, "out"> {}
117
+
118
+ export interface TransformSeriesCompatV4Constructor extends TransformSeriesConstructor {
119
+ readonly prototype: ITransformSeriesCompatV4;
120
+ new(...args: unknown[]): ITransformSeriesCompatV4;
121
+ }
package/lib/core.d.ts CHANGED
@@ -87,7 +87,7 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
87
87
  }
88
88
 
89
89
  export interface IWorkerGroup extends WorkerBase {
90
- [Symbol.iterator](): IteratorObject<IWorkerChannel, BuiltinIteratorReturn>;
90
+ [Symbol.iterator](): IterableIterator<IWorkerChannel>;
91
91
  add(name: string, item: IWorkerChannel, priority?: number): this;
92
92
  get(name: string, force?: boolean | number): IWorkerChannel | undefined;
93
93
  delete(name: string | IWorkerChannel): boolean;
@@ -111,7 +111,7 @@ export interface WorkerGroupConstructor {
111
111
  }
112
112
 
113
113
  export interface IWorkerChannel<T = unknown> extends EventEmitter, Iterable<Worker>, WorkerInfo {
114
- [Symbol.iterator](): IteratorObject<Worker, BuiltinIteratorReturn>;
114
+ [Symbol.iterator](): IterableIterator<Worker>;
115
115
  sendObject(data: unknown, transferList?: Transferable[], callback?: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker;
116
116
  sendBuffer(data: Buffer | SharedArrayBuffer, callback: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker | null;
117
117
  sendBuffer(data: Buffer | SharedArrayBuffer, shared?: boolean, callback?: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker | null;
package/lib/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { ChecksumValue, DataSource, DbDataSource, IncrementalMatch, LogStat
5
5
  import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
6
6
  import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudLogMessageType, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, CopyObjectOptions, DeleteObjectsOptions, UploadAssetOptions } from './cloud';
7
7
  import type { BrotliCompressLevel, BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
8
- import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
8
+ import type { ClientConstructor, ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
9
9
  import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
10
10
  import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
11
11
  import type { AssetContentOptions, CheckHashOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
@@ -14,7 +14,7 @@ import type { CommandData, CropData, QualityData, ResizeData, RotateData, Transf
14
14
  import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogState, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
15
15
  import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, DirectoryActionType, FileActionType, FileTypeFormat, GlobDirOptions, MoveFileOptions, PackageVersionOptions, ParseFunctionOptions, PermissionOptions, PermissionType, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, TempDirOptions, WriteFileOptions } from './module';
16
16
  import type { ErrorCode, HighResolutionTime, RequestData, Settings } from './node';
17
- import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, IHttpAdapter, OpenOptions, PostOptions, ProxySettings, PutOptions, RcloneOptions, ReadExpectType, RequestInit, StatusOnCallback } from './request';
17
+ import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, HeadersOnCallback, HostConfig, IHttpAdapter, OpenOptions, PostFileParts as PostFileParts, PostOptions, ProxySettings, PutOptions, RcloneOptions, ReadExpectType, RequestInit, StatusOnCallback } from './request';
18
18
  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';
19
19
  import type { Command, SpawnResult } from './task';
20
20
  import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
@@ -92,7 +92,7 @@ declare namespace functions {
92
92
  new(module?: U): ICompress<T, U>;
93
93
  }
94
94
 
95
- interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U> {
95
+ interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule, V extends ExternalAsset = ExternalAsset> extends IClient<T, U> {
96
96
  resizeData?: ResizeData | null;
97
97
  cropData?: CropData | null;
98
98
  rotateData?: RotateData | null;
@@ -110,13 +110,13 @@ declare namespace functions {
110
110
  parseQuality(value: string): QualityData | null;
111
111
  parseOpacity(value: string): number;
112
112
  parseWorker(command: string | CommandData, outputType?: string): CommandData | null;
113
- using?<V extends ExternalAsset>(data: IFileThread<V>, command: string): Promise<unknown>;
113
+ using?(data: IFileThread<V>, command: string): Promise<unknown>;
114
114
  get outputAs(): string;
115
115
  set host(value);
116
116
  get host(): T | null;
117
117
  }
118
118
 
119
- interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor, IWorkerConstructor {
119
+ interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ClientConstructor, IWorkerConstructor {
120
120
  readonly MIME_JPEG: string;
121
121
  readonly MIME_PNG: string;
122
122
  readonly MIME_WEBP: string;
@@ -132,19 +132,19 @@ declare namespace functions {
132
132
  new(module?: U, ...args: unknown[]): IImage<T, U>;
133
133
  }
134
134
 
135
- interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
136
- using?<V extends ExternalAsset>(data: IFileThread<V>): Promise<unknown>;
135
+ interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule, V extends ExternalAsset = ExternalAsset> extends IClient<T, U> {
136
+ using?(data: IFileThread<V>): Promise<unknown>;
137
137
  collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
138
138
  map?(tasks: Command[]): Promise<SpawnResult | void>[];
139
139
  series?(tasks: Command[]): Promise<unknown>;
140
140
  parallel?(tasks: Command[]): Promise<unknown>;
141
141
  spawn?(task: PlainObject, callback: (result?: SpawnResult) => void): void;
142
- execute?<V extends IFileManager<W>, W extends ExternalAsset>(manager: V, task: PlainObject, callback: (value?: unknown) => void): void;
142
+ execute?<W extends IFileManager<X>, X extends ExternalAsset>(manager: W, task: PlainObject, callback: (value?: unknown) => void): void;
143
143
  set host(value);
144
144
  get host(): T | null;
145
145
  }
146
146
 
147
- interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
147
+ interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ClientConstructor {
148
148
  finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
149
149
  readonly prototype: ITask<T, U>;
150
150
  new(module?: U, ...args: unknown[]): ITask<T, U>;
@@ -159,8 +159,8 @@ declare namespace functions {
159
159
  executeQuery(item: V, sessionKey: string): Promise<QueryResult>;
160
160
  executeQuery(item: V, options?: ExecuteQueryOptions | string): Promise<QueryResult>;
161
161
  executeBatchQuery(batch: V[], callback: ErrorQueryCallback, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
162
- executeBatchQuery(batch: V[], sessionKey: string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
163
- executeBatchQuery(batch: V[], options?: ExecuteBatchQueryOptions | string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
162
+ executeBatchQuery(batch: V[], sessionKey: string | undefined, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
163
+ executeBatchQuery(batch: V[], options?: ExecuteBatchQueryOptions, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
164
164
  processRows(batch: V[], tasks: Promise<QueryResult | null>[], parallel: boolean): Promise<BatchQueryResult>;
165
165
  processRows(batch: V[], tasks: Promise<QueryResult | null>[], options?: ProcessRowsOptions | boolean, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
166
166
  handleFail(err: unknown, item: V, options?: HandleFailOptions): boolean;
@@ -327,12 +327,14 @@ declare namespace functions {
327
327
  get host(): T | null;
328
328
  }
329
329
 
330
- 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 {
330
+ 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 ClientConstructor {
331
331
  finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
332
332
  createSourceMap(code: string, remove: boolean): SourceMap;
333
333
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
334
334
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
335
+ /** @deprecated */
335
336
  updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
337
+ /** @deprecated */
336
338
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
337
339
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
338
340
  cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
@@ -366,7 +368,7 @@ declare namespace functions {
366
368
  get host(): T | null;
367
369
  }
368
370
 
369
- interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
371
+ interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ClientConstructor {
370
372
  createServer(port: number, active: boolean): ws.Server | null;
371
373
  createServer(port: number, secure?: SecureOptions | null, active?: boolean): ws.Server | null;
372
374
  shutdown(): void;
@@ -401,6 +403,7 @@ declare namespace functions {
401
403
  rclone(uri: string | URL, pathname: string | URL): Promise<string[]>;
402
404
  rclone(uri: string | URL, options?: RcloneOptions): Promise<string[]>;
403
405
  json(uri: string | URL, options?: OpenOptions): Promise<object | null>;
406
+ blob(uri: string | URL, options?: OpenOptions): Promise<Blob | null>;
404
407
  pipe(uri: string | URL, to: Writable, options?: OpenOptions): Promise<null>;
405
408
  opts<V extends OpenOptions>(url: string | URL, options?: V): HostConfig & V;
406
409
  open(uri: string | URL, options: OpenOptions): HttpRequestClient;
@@ -409,10 +412,10 @@ declare namespace functions {
409
412
  put<V extends PutOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
410
413
  put<V extends PutOptions>(uri: string | URL, data: unknown, contentType?: string | V, options?: V): Promise<DataObjectResult<V>>;
411
414
  post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, data: unknown, contentType: string): Promise<DataObjectResult<V>>;
412
- post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
413
- post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: FormDataPart[]): Promise<DataObjectResult<V>>;
415
+ post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, parts: PostFileParts): Promise<DataObjectResult<V>>;
416
+ post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: PostFileParts): Promise<DataObjectResult<V>>;
414
417
  post<V extends PostOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
415
- post<V extends PostOptions>(uri: string | URL, data: unknown, contentType?: string | FormDataPart[] | V, options?: V): Promise<DataObjectResult<V>>;
418
+ post<V extends PostOptions>(uri: string | URL, data: unknown, contentType?: string | PostFileParts | V, options?: V): Promise<DataObjectResult<V>>;
416
419
  get<V extends OpenOptions & { encoding: BufferEncoding }>(uri: string | URL, options: V): Promise<string>;
417
420
  get<V extends BufferFormat>(uri: string | URL, format: V): Promise<object | null>;
418
421
  get<V extends OpenOptions, W extends V | BufferFormat>(uri: string | URL, options?: W): Promise<W extends BufferFormat ? object | null : DataEncodedResult<V>>;
@@ -445,7 +448,7 @@ declare namespace functions {
445
448
  interface IFileManager<T extends ExternalAsset = ExternalAsset> extends IHost, Set<string> {
446
449
  processTimeout: number;
447
450
  Request: IRequest;
448
- Document: InstallData<IDocument<IFileManager<T>, T>, DocumentConstructor<IFileManager<T>, T>>[];
451
+ Document: InstallData<IDocument<this, T>, DocumentConstructor<this, T>>[];
449
452
  Task: InstallData<ITask, TaskConstructor>[];
450
453
  Image: ImageMimeMap | null;
451
454
  Cloud: ICloud | null;
@@ -466,8 +469,8 @@ declare namespace functions {
466
469
  readonly emptyDir: Set<string>;
467
470
  readonly cacheToDisk: IHttpDiskCache<T>;
468
471
  readonly cacheToMemory: IHttpMemoryCache<T>;
469
- install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): IDocument<IFileManager<T>, T> | undefined;
470
- install(name: "document", target: DocumentConstructor<IFileManager<T>, T>, module?: DocumentModule, ...args: unknown[]): IDocument<IFileManager<T>, T> | undefined;
472
+ install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): IDocument<this, T> | undefined;
473
+ install(name: "document", target: DocumentConstructor<this, T>, module?: DocumentModule, ...args: unknown[]): IDocument<this, T> | undefined;
471
474
  install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): ITask | undefined;
472
475
  install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): ITask | undefined;
473
476
  install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): ICloud | undefined;
@@ -476,7 +479,7 @@ declare namespace functions {
476
479
  install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): IImage | undefined;
477
480
  install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
478
481
  install(name: "watch", handler: string, module?: WatchModule, ...args: unknown[]): WatchInstance<T> | undefined;
479
- install(name: "watch", target: WatchConstructor<IFileManager<T>, T>, module?: WatchModule, ...args: unknown[]): WatchInstance<T> | undefined;
482
+ install(name: "watch", target: WatchConstructor<this, T>, module?: WatchModule, ...args: unknown[]): WatchInstance<T> | undefined;
480
483
  install(name: "watch", module: WatchModule): WatchInstance<T> | undefined;
481
484
  install(name: "compress", module?: CompressModule): ICompress | undefined;
482
485
  install<U extends IModule>(name: string, ...args: unknown[]): U | undefined;
@@ -512,7 +515,7 @@ declare namespace functions {
512
515
  addDownload(value: number | Bufferable, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
513
516
  getDownload(type?: number): [number, number];
514
517
  checkHash(checksum: ChecksumValue, options: CheckHashOptions): boolean;
515
- checkHash(checksum: ChecksumValue, data: Bufferable | null, uri: string | URL | undefined): boolean;
518
+ checkHash(checksum: ChecksumValue, data: Optional<Bufferable>, uri: string | URL | undefined): boolean;
516
519
  checkHash(checksum: ChecksumValue, data: Bufferable, options?: CheckHashOptions): boolean;
517
520
  transformAsset(data: IFileThread<T>, parent?: T, override?: boolean): Promise<boolean>;
518
521
  addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): string | undefined;
@@ -884,11 +887,17 @@ declare namespace functions {
884
887
  readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Buffer | null;
885
888
  resolveMime(data: FileTypeFormat): Promise<FileTypeResult | undefined>;
886
889
  lookupMime(value: string, extension?: boolean): string;
887
- initCpuUsage(instance?: IModule): CpuUsage;
888
- getCpuUsage(start: CpuUsage, format: true): string;
889
- getCpuUsage(start: CpuUsage, format?: boolean): number;
890
+ /** @deprecated class */
891
+ initCpuUsage(instance?: IModule, thread?: boolean): CpuUsage;
892
+ /** @deprecated private */
893
+ getCpuUsage(start: CpuUsage, format: true, thread?: boolean): string;
894
+ /** @deprecated private */
895
+ getCpuUsage(start: CpuUsage, format?: boolean, thread?: boolean): number;
896
+ /** @deprecated private */
890
897
  getMemUsage(format: true | "%" | Unit, free?: boolean): string;
898
+ /** @deprecated private */
891
899
  getMemUsage(format?: boolean, free?: boolean): number;
900
+ /** @deprecated private */
892
901
  formatCpuMem(start: CpuUsage, all?: boolean): string;
893
902
  getPackageVersion(name: string | [string, string], options?: PackageVersionOptions): string;
894
903
  checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
@@ -910,4 +919,4 @@ declare namespace functions {
910
919
  }
911
920
  }
912
921
 
913
- export = functions;
922
+ export = functions;
package/lib/module.d.ts CHANGED
@@ -57,6 +57,7 @@ export interface CopyFileOptions extends FileSystemOptions {
57
57
  overwrite?: boolean;
58
58
  createDir?: boolean;
59
59
  outSrc?: string;
60
+ mode?: number;
60
61
  }
61
62
 
62
63
  export interface RemoveDirOptions extends FileSystemOptions {
package/lib/object.d.ts CHANGED
@@ -34,4 +34,8 @@ interface MinMax<T = number> {
34
34
  }
35
35
 
36
36
  /** @deprecated lib/node **/
37
- type HighResolutionTime = bigint | [number, number];
37
+ type HighResolutionTime = bigint | [number, number];
38
+
39
+ interface RegExpConstructor {
40
+ escape(value: string): string;
41
+ }
package/lib/request.d.ts CHANGED
@@ -166,6 +166,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction, EncodingActi
166
166
  expectContinue?: boolean;
167
167
  expectTimeout?: number;
168
168
  maxBufferSize?: number | string;
169
+ maxConcurrentStreams?: number;
169
170
  format?: BufferFormat | { out?: BufferFormat; parser?: PlainObject };
170
171
  headers?: OutgoingHttpHeaders | Headers;
171
172
  signal?: AbortSignal;
@@ -178,6 +179,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction, EncodingActi
178
179
  progressId?: number | string;
179
180
  outFormat?: { out: BufferFormat; parser?: PlainObject };
180
181
  outFilename?: string | null;
182
+ outContentType?: string;
181
183
  outHeaders?: IncomingHttpHeaders | null;
182
184
  outStream?: Writable | null;
183
185
  outAbort?: AbortController | null;
@@ -189,7 +191,7 @@ export interface PutOptions extends OpenOptions {
189
191
  }
190
192
 
191
193
  export interface PostOptions extends PutOptions {
192
- formData?: FormDataPart | FormDataPart[];
194
+ formData?: FormDataPart | File | PostFileParts;
193
195
  }
194
196
 
195
197
  export interface FormDataPart {
@@ -271,6 +273,7 @@ export interface AltSvcData {
271
273
  export type HttpMethod = "GET" | "POST" | "PUT" | "HEAD" | "DELETE";
272
274
  export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
273
275
  export type ReadExpectType = "always" | "string" | "none";
276
+ export type PostFileParts = (File | FormDataPart)[];
274
277
  export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Bufferable | null;
275
278
  export type DataObjectResult<T extends { format?: unknown; encoding?: BufferEncoding }> = T extends { format: string | PlainObject } ? object | null : DataEncodedResult<T>;
276
279
  export type StatusOnCallback = (code: number, headers: IncomingHttpHeaders, url?: URL) => boolean | void;
package/lib/settings.d.ts CHANGED
@@ -311,6 +311,7 @@ export interface ImageSettings extends PlainObject {
311
311
  export interface RequestModule<T = RequestSettings> extends HandlerSettings<T>, HttpHostSettings {
312
312
  timeout?: number | string;
313
313
  read_timeout?: number | string;
314
+ max_concurrent_streams?: number | string;
314
315
  agent?: {
315
316
  keep_alive?: boolean;
316
317
  keep_alive_interval?: number | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.13.7",
3
+ "version": "0.13.9",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",