@e-mc/types 0.13.8 → 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
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.13.8/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,7 +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, expect?: string): unknown;
84
+ function requireESM(name: string, url?: string | URL, expect?: string): unknown;
85
85
  function purgeMemory(percent?: number): number;
86
86
 
87
87
  interface LOG_TYPE {
@@ -209,10 +209,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
209
209
 
210
210
  ## References
211
211
 
212
- - https://www.unpkg.com/@e-mc/types@0.13.8/index.d.ts
213
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/logger.d.ts
214
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/module.d.ts
215
- - https://www.unpkg.com/@e-mc/types@0.13.8/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
216
216
 
217
217
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
218
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.8',
2
+ VERSION = '0.13.9',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.d.ts CHANGED
@@ -344,13 +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>;
353
- function requireESM<T = unknown>(name: string, expect?: string): T;
355
+ function requireESM<T = unknown>(name: string, url?: string | URL, expect?: string): T;
354
356
  function purgeMemory(percent?: number): number;
355
357
  }
356
358
 
package/index.js CHANGED
@@ -53,6 +53,7 @@ const path = require("node:path");
53
53
  const fs = require("node:fs");
54
54
  const crypto = require("node:crypto");
55
55
  const bytes = require("bytes");
56
+ const node_module_1 = require("node:module");
56
57
  const node_os_1 = require("node:os");
57
58
  const node_url_1 = require("node:url");
58
59
  const PATTERN_CHARS = {
@@ -105,6 +106,7 @@ let LOG_CURRENT = null;
105
106
  let SUPPORTED_HASHSINGLE = false;
106
107
  let SUPPORTED_IMPORTATTRIBUTES = false;
107
108
  let SUPPORTED_REGEXPESCAPE = false;
109
+ let SUPPORTED_FLOAT16ARRAY = false;
108
110
  let TEMP_DIR = path.join(process.cwd(), "tmp");
109
111
  let INCREMENT_COUNT = 65536;
110
112
  let INCREMENT_PREFIX = '';
@@ -147,6 +149,9 @@ function fromObject(value, typedArray, structured, shared) {
147
149
  if (value instanceof BigUint64Array) {
148
150
  return BigUint64Array.from(value);
149
151
  }
152
+ if (SUPPORTED_FLOAT16ARRAY && value instanceof Float16Array) {
153
+ return Float16Array.from(value);
154
+ }
150
155
  }
151
156
  if (structured) {
152
157
  try {
@@ -1197,11 +1202,19 @@ function sanitizeArgs(values, doubleQuote) {
1197
1202
  }
1198
1203
  return (typeof values === 'string' ? result[0] : result);
1199
1204
  }
1200
- function errorValue(value, hint) {
1201
- 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);
1202
1211
  }
1203
- function errorMessage(title, value, hint) {
1204
- 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);
1205
1218
  }
1206
1219
  function purgeMemory(percent) {
1207
1220
  CACHE_COERCED = new WeakSet();
@@ -1266,10 +1279,10 @@ async function importESM(name, isDefault, fromPath) {
1266
1279
  }
1267
1280
  return result;
1268
1281
  }
1269
- function requireESM(name, expect) {
1270
- const result = require(name);
1282
+ function requireESM(name, url, expect) {
1283
+ const result = url ? (0, node_module_1.createRequire)(url)(name) : require(name);
1271
1284
  return process.features.require_module && isObject(result) && result.__esModule && 'default' in result && (!expect || typeof result.default === expect) ? result.default : result;
1272
1285
  }
1273
1286
  SUPPORTED_HASHSINGLE = supported(20, 12, true) || supported(21, 7);
1274
1287
  SUPPORTED_IMPORTATTRIBUTES = supported(18, 20, true) || supported(20, 10);
1275
- SUPPORTED_REGEXPESCAPE = supported(24);
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';
@@ -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>;
@@ -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;
@@ -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;
@@ -916,4 +919,4 @@ declare namespace functions {
916
919
  }
917
920
  }
918
921
 
919
- export = functions;
922
+ export = functions;
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;
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.8",
3
+ "version": "0.13.9",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/lib/dom.d.ts DELETED
@@ -1,9 +0,0 @@
1
- interface EventListenerOptions {
2
- capture?: boolean;
3
- }
4
-
5
- export interface AddEventListenerOptions extends EventListenerOptions {
6
- once?: boolean;
7
- passive?: boolean;
8
- signal?: AbortSignal;
9
- }