@e-mc/types 0.8.4 → 0.8.6

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 An Pham
1
+ Copyright 2024 An Pham
2
2
 
3
3
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
4
 
package/README.md CHANGED
@@ -9,15 +9,14 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- - https://www.unpkg.com/@e-mc/types@0.8.4/index.d.ts
12
+ - https://www.unpkg.com/@e-mc/types@0.8.6/index.d.ts
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
16
16
  import type { CloneObjectOptions } from "./lib/module";
17
17
 
18
- import type { BinaryLike, CipherGCMTypes, Encoding } from "crypto";
19
-
20
18
  import type { BytesOptions } from "bytes";
19
+ import type { BinaryLike, CipherGCMTypes, Encoding } from "crypto";
21
20
 
22
21
  function createAbortError(): Error;
23
22
  function hasBit(value: unknown, flags: number): boolean;
@@ -187,8 +186,8 @@ const IMPORT_MAP: Record<string, string | undefined>;
187
186
 
188
187
  ## References
189
188
 
190
- - https://www.unpkg.com/@e-mc/types@0.8.4/lib/logger.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.8.4/lib/module.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.8.6/lib/logger.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.8.6/lib/module.d.ts
192
191
 
193
192
  * https://nodejs.org/api/perf_hooks.html
194
193
  * https://www.npmjs.com/package/@types/bytes
package/constant.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.8.4',
3
- TEMP_DIR = 'tmp', // eslint-disable-line @typescript-eslint/no-shadow
2
+ VERSION = '0.8.6',
3
+ TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
6
6
 
@@ -187,11 +187,13 @@ export const enum TIME {
187
187
 
188
188
  export const enum PACKAGE_NAME {
189
189
  CLOUD = '@e-mc/cloud',
190
+ CLOUD_UTIL = '@e-mc/cloud/util',
190
191
  COMPAT_V4 = '@e-mc/compat-v4',
191
192
  COMPRESS = '@e-mc/compress',
192
193
  CORE = '@e-mc/core',
193
194
  DB = '@e-mc/db',
194
195
  DB_POOL = '@e-mc/db/pool',
196
+ DB_UTIL = '@e-mc/db/util',
195
197
  DOCUMENT = '@e-mc/document',
196
198
  DOCUMENT_ANDROID = '@pi-r/android',
197
199
  DOCUMENT_CHROME = '@pi-r/chrome',
@@ -204,6 +206,7 @@ export const enum PACKAGE_NAME {
204
206
  MODULE_LIB_V4 = '@e-mc/module/lib-v4',
205
207
  REQUEST = '@e-mc/request',
206
208
  REQUEST_HTTP_HOST = '@e-mc/request/http/host',
209
+ REQUEST_UTIL = '@e-mc/request/util',
207
210
  TASK = '@e-mc/task',
208
211
  TASK_GULP = '@pi-r/gulp',
209
212
  TYPES = '@e-mc/types',
package/index.js CHANGED
@@ -1,27 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateUUID = exports.randomString = exports.decryptUTF8 = exports.encryptUTF8 = exports.getEncoding = exports.asFunction = exports.coerceObject = exports.cloneObject = exports.cascadeObject = exports.alignSize = 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.THRESHOLD = exports.READDIR_SORT = 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.incrementUUID = exports.purgeMemory = exports.errorMessage = exports.errorValue = 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");
8
+ const uuid = require("uuid");
8
9
  const bytes = require("bytes");
9
10
  class AbortError extends Error {
10
11
  constructor() {
11
- super("The operation was aborted" /* ERR_MESSAGE.ABORTED_OPERATION */);
12
+ super("The operation was aborted");
12
13
  this.code = 'ABORT_ERR';
13
14
  this.name = 'AbortError';
14
15
  }
15
16
  }
16
17
  const REGEXP_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
17
- const REGEXP_FUNCTION = /^(async\s+)?(function(?:\b|\s+)[\w_$]*\s*\(([^)]*)\)\s*\{([\S\s]*)\})$/;
18
- const REGEXP_FUNCTION_ARROW = /^(async\s+)?(\s*\(([^)]*)\)\s*=>\s*(?:\{([\S\s]*)\}|(?!\s|{)((?:(?<!return\s+)(?:"[^"\n]*"|'[^'\n]*'|`[^`]*`|[^\n;"'`]))*;)))$/;
18
+ const REGEXP_FUNCTION = /^(async\s+)?(function(?:\b|\s+)([\w_$]*)\s*\(([^)]*)\)\s*\{([\S\s]*)\})$/;
19
19
  const ASYNC_FUNCTION = Object.getPrototypeOf(async () => { }).constructor;
20
20
  let CACHE_COERCED = new WeakSet();
21
21
  let LOG_CURRENT = null;
22
- let TEMP_DIR = path.join(process.cwd(), "tmp" /* INTERNAL.TEMP_DIR */);
23
- let INCREMENT_COUNT = 65536;
24
- let INCREMENT_PREFIX = '';
22
+ let TEMP_DIR = path.join(process.cwd(), "tmp");
25
23
  function fromObject(value, typedArray) {
26
24
  if (isObject(value)) {
27
25
  if (value instanceof Map) {
@@ -243,18 +241,6 @@ var WATCH_EVENT;
243
241
  WATCH_EVENT["CLOSE"] = "close";
244
242
  WATCH_EVENT["ERROR"] = "error";
245
243
  })(WATCH_EVENT || (exports.WATCH_EVENT = WATCH_EVENT = {}));
246
- var READDIR_SORT;
247
- (function (READDIR_SORT) {
248
- READDIR_SORT[READDIR_SORT["FILE"] = 0] = "FILE";
249
- READDIR_SORT[READDIR_SORT["DIRECTORY"] = 1] = "DIRECTORY";
250
- READDIR_SORT[READDIR_SORT["DESCENDING"] = 2] = "DESCENDING";
251
- })(READDIR_SORT || (exports.READDIR_SORT = READDIR_SORT = {}));
252
- var THRESHOLD;
253
- (function (THRESHOLD) {
254
- THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
255
- THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
256
- THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
257
- })(THRESHOLD || (exports.THRESHOLD = THRESHOLD = {}));
258
244
  var IMPORT_MAP;
259
245
  (function (IMPORT_MAP) {
260
246
  IMPORT_MAP["@squared-functions/cloud"] = "@e-mc/cloud";
@@ -322,8 +308,8 @@ var IMPORT_MAP;
322
308
  IMPORT_MAP["@squared-functions/document/packages/@babel/core"] = "@pi-r/babel";
323
309
  IMPORT_MAP["@squared-functions/document/packages/clean-css"] = "@pi-r/clean-css";
324
310
  IMPORT_MAP["@squared-functions/document/packages/eslint"] = "@pi-r/eslint";
325
- IMPORT_MAP["@squared-functions/document/packages/html-minifier"] = "@pi-r/html-minifier";
326
311
  IMPORT_MAP["@squared-functions/document/packages/html-minifier-terser"] = "@pi-r/html-minifier-terser";
312
+ IMPORT_MAP["@squared-functions/document/packages/html-minifier"] = "@pi-r/html-minifier";
327
313
  IMPORT_MAP["@squared-functions/document/packages/html-validate"] = "@pi-r/html-validate";
328
314
  IMPORT_MAP["@squared-functions/document/packages/postcss"] = "@pi-r/postcss";
329
315
  IMPORT_MAP["@squared-functions/document/packages/posthtml"] = "@pi-r/posthtml";
@@ -335,6 +321,12 @@ var IMPORT_MAP;
335
321
  IMPORT_MAP["@squared-functions/document/packages/terser"] = "@pi-r/terser";
336
322
  IMPORT_MAP["@squared-functions/document/packages/uglify-js"] = "@pi-r/uglify-js";
337
323
  })(IMPORT_MAP || (exports.IMPORT_MAP = IMPORT_MAP = {}));
324
+ var THRESHOLD;
325
+ (function (THRESHOLD) {
326
+ THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
327
+ THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
328
+ THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
329
+ })(THRESHOLD || (exports.THRESHOLD = THRESHOLD = {}));
338
330
  function createAbortError() {
339
331
  return new AbortError();
340
332
  }
@@ -344,35 +336,35 @@ function hasBit(value, flags) {
344
336
  }
345
337
  exports.hasBit = hasBit;
346
338
  function ignoreFlag(value) {
347
- return typeof value === 'number' && (value & 1 /* IASSET_FLAG.IGNORE */) === 1 /* IASSET_FLAG.IGNORE */;
339
+ return typeof value === 'number' && (value & 1) === 1;
348
340
  }
349
341
  exports.ignoreFlag = ignoreFlag;
350
342
  function cloneFlag(value) {
351
- return typeof value === 'number' && (value & 2 /* IASSET_FLAG.CLONE */) === 2 /* IASSET_FLAG.CLONE */;
343
+ return typeof value === 'number' && (value & 2) === 2;
352
344
  }
353
345
  exports.cloneFlag = cloneFlag;
354
346
  function usingFlag(value) {
355
- return typeof value === 'number' && (value & 4 /* IASSET_FLAG.USING */) === 4 /* IASSET_FLAG.USING */;
347
+ return typeof value === 'number' && (value & 4) === 4;
356
348
  }
357
349
  exports.usingFlag = usingFlag;
358
350
  function watchFlag(value) {
359
- return typeof value === 'number' && (value & 8 /* IASSET_FLAG.WATCH */) === 8 /* IASSET_FLAG.WATCH */;
351
+ return typeof value === 'number' && (value & 8) === 8;
360
352
  }
361
353
  exports.watchFlag = watchFlag;
362
354
  function modifiedFlag(value) {
363
- return typeof value === 'number' && (value & 16 /* IASSET_FLAG.MODIFIED */) === 16 /* IASSET_FLAG.MODIFIED */;
355
+ return typeof value === 'number' && (value & 16) === 16;
364
356
  }
365
357
  exports.modifiedFlag = modifiedFlag;
366
358
  function processFlag(value) {
367
- return typeof value === 'number' && (value & 32 /* IASSET_FLAG.PROCESS */) === 32 /* IASSET_FLAG.PROCESS */;
359
+ return typeof value === 'number' && (value & 32) === 32;
368
360
  }
369
361
  exports.processFlag = processFlag;
370
362
  function mainFlag(value) {
371
- return typeof value === 'number' && (value & 64 /* IASSET_FLAG.MAIN */) === 64 /* IASSET_FLAG.MAIN */;
363
+ return typeof value === 'number' && (value & 64) === 64;
372
364
  }
373
365
  exports.mainFlag = mainFlag;
374
366
  function existsFlag(value) {
375
- return typeof value === 'number' && (value & 128 /* IASSET_FLAG.EXISTS */) === 128 /* IASSET_FLAG.EXISTS */;
367
+ return typeof value === 'number' && (value & 128) === 128;
376
368
  }
377
369
  exports.existsFlag = existsFlag;
378
370
  function getLogCurrent() {
@@ -404,7 +396,7 @@ function isArray(value) {
404
396
  }
405
397
  exports.isArray = isArray;
406
398
  function isPlainObject(value) {
407
- return typeof value === 'object' && value !== null && (value.constructor === Object || Object.getPrototypeOf(value) === null);
399
+ return value && typeof value === 'object' ? value.constructor === Object || Object.getPrototypeOf(value) === null : false;
408
400
  }
409
401
  exports.isPlainObject = isPlainObject;
410
402
  function isObject(value) {
@@ -431,25 +423,25 @@ function parseTime(value, start = 0) {
431
423
  }
432
424
  switch (match[2]) {
433
425
  case 'y':
434
- result += n * 31449600000 /* TIME.Y */;
426
+ result += n * 31449600000;
435
427
  break;
436
428
  case 'M':
437
- result += n * 2592000000 /* TIME.M */;
429
+ result += n * 2592000000;
438
430
  break;
439
431
  case 'w':
440
- result += n * 604800000 /* TIME.W */;
432
+ result += n * 604800000;
441
433
  break;
442
434
  case 'd':
443
- result += n * 86400000 /* TIME.D */;
435
+ result += n * 86400000;
444
436
  break;
445
437
  case 'h':
446
- result += n * 3600000 /* TIME.H */;
438
+ result += n * 3600000;
447
439
  break;
448
440
  case 'm':
449
- result += n * 60000 /* TIME.m */;
441
+ result += n * 60000;
450
442
  break;
451
443
  case 's':
452
- result += n * 1000 /* TIME.S */;
444
+ result += n * 1000;
453
445
  break;
454
446
  case 'ms':
455
447
  result += Math.ceil(n);
@@ -461,7 +453,7 @@ function parseTime(value, start = 0) {
461
453
  }
462
454
  }
463
455
  else if (seconds > 0) {
464
- return Math.ceil(seconds * 1000 /* TIME.S */) + start;
456
+ return Math.ceil(seconds * 1000) + start;
465
457
  }
466
458
  return 0;
467
459
  }
@@ -484,18 +476,18 @@ function formatTime(value, elapsed, char = ' ') {
484
476
  if (value < 1000) {
485
477
  return value + 'ms';
486
478
  }
487
- const h = Math.floor(value / 3600000 /* TIME.H */);
479
+ const h = Math.floor(value / 3600000);
488
480
  if (h > 0) {
489
- value -= h * 3600000 /* TIME.H */;
481
+ value -= h * 3600000;
490
482
  result.push(h + 'h');
491
483
  }
492
- const m = Math.floor(value / 60000 /* TIME.m */);
484
+ const m = Math.floor(value / 60000);
493
485
  if (m > 0) {
494
- value -= m * 60000 /* TIME.m */;
486
+ value -= m * 60000;
495
487
  result.push(m + 'm');
496
488
  }
497
489
  if (value > 0) {
498
- result.push(value < 100 ? value + 'ms' : (value / 1000 /* TIME.S */).toPrecision(value <= 9950 ? 2 : 3).replace(/\.?0+$/, '') + 's');
490
+ result.push(value < 100 ? value + 'ms' : (value / 1000).toPrecision(value <= 9950 ? 2 : 3).replace(/\.?0+$/, '') + 's');
499
491
  }
500
492
  return result.join(char);
501
493
  }
@@ -571,40 +563,9 @@ function renameExt(value, ext, when) {
571
563
  }
572
564
  exports.renameExt = renameExt;
573
565
  function formatSize(value, options) {
574
- if (typeof value === 'number') {
575
- return (bytes(value, options) || ('0' + (options?.unitSeparator || '') + 'B'));
576
- }
577
- return (bytes(value) || 0);
566
+ return (typeof value === 'number' ? bytes(value, options) : bytes(value));
578
567
  }
579
568
  exports.formatSize = formatSize;
580
- function alignSize(value, kb = 0, factor = 0) {
581
- if (value === undefined) {
582
- return NaN;
583
- }
584
- let result = 0;
585
- switch (typeof value) {
586
- case 'number':
587
- if (value < 0) {
588
- return NaN;
589
- }
590
- result = Math.ceil(factor > 0 ? value * Math.pow(1024, factor) : value);
591
- break;
592
- case 'string':
593
- result = formatSize(value);
594
- if (result < 0) {
595
- return NaN;
596
- }
597
- break;
598
- default:
599
- return NaN;
600
- }
601
- if (kb > 0) {
602
- kb = Math.ceil(kb) * 1024;
603
- return Math.ceil(result / kb) * kb;
604
- }
605
- return result;
606
- }
607
- exports.alignSize = alignSize;
608
569
  function cascadeObject(data, query, fallback) {
609
570
  if (isObject(data) && isString(query)) {
610
571
  const names = query.trim().split(/(?<!\\)\./).map(item => item.includes('.') ? item.replace(/\\(?=\.)/g, '') : item);
@@ -762,7 +723,7 @@ function coerceObject(data, parseString, cache) {
762
723
  }
763
724
  default: {
764
725
  const text = match[2].trim();
765
- let values = []; // eslint-disable-line @typescript-eslint/no-explicit-any
726
+ let values = [];
766
727
  if (text.startsWith('[') && text.endsWith(']')) {
767
728
  values = JSON.parse(text);
768
729
  }
@@ -836,10 +797,10 @@ function asFunction(value, sync = true) {
836
797
  return value;
837
798
  }
838
799
  let match;
839
- if (isString(value) && (match = REGEXP_FUNCTION.exec(value = value.trim()) || REGEXP_FUNCTION_ARROW.exec(value))) {
800
+ if (isString(value) && (match = REGEXP_FUNCTION.exec(value = value.trim()))) {
840
801
  if (!sync || match[1]) {
841
- const args = match[3].trim().split(/\s*,\s*/);
842
- args.push(match[4] || (match[5] && (match[5] = 'return ' + match[5])));
802
+ const args = match[4].trim().split(/\s*,\s*/);
803
+ args.push(match[5]);
843
804
  return new ASYNC_FUNCTION(...args);
844
805
  }
845
806
  try {
@@ -855,22 +816,7 @@ function asFunction(value, sync = true) {
855
816
  }
856
817
  exports.asFunction = asFunction;
857
818
  function getEncoding(value, fallback = 'utf-8') {
858
- if (typeof value === 'string') {
859
- switch (value = value.trim().toLowerCase()) {
860
- case 'utf8':
861
- case 'utf-8':
862
- case 'utf16le':
863
- return value;
864
- case 'utf-16le':
865
- case 'utf16':
866
- case 'utf-16':
867
- return 'utf16le';
868
- }
869
- if (Buffer.isEncoding(value)) {
870
- return value;
871
- }
872
- }
873
- return fallback;
819
+ return typeof value === 'string' && Buffer.isEncoding(value = value.trim().toLowerCase()) ? value : fallback;
874
820
  }
875
821
  exports.getEncoding = getEncoding;
876
822
  function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
@@ -955,12 +901,4 @@ function purgeMemory(percent) {
955
901
  CACHE_COERCED = new WeakSet();
956
902
  }
957
903
  exports.purgeMemory = purgeMemory;
958
- function incrementUUID(restart) {
959
- if (restart || INCREMENT_COUNT === 65536) {
960
- INCREMENT_COUNT = 0;
961
- INCREMENT_PREFIX = (0, exports.generateUUID)().substring(0, 33);
962
- }
963
- return INCREMENT_PREFIX + (INCREMENT_COUNT++).toString(16).padStart(4, '0');
964
- }
965
- exports.incrementUUID = incrementUUID;
966
- exports.generateUUID = typeof crypto.randomUUID === 'function' ? crypto.randomUUID.bind(crypto) : require('uuid').v4;
904
+ exports.generateUUID = typeof crypto.randomUUID === 'function' ? crypto.randomUUID.bind(crypto) : uuid.v4;
package/lib/core.d.ts CHANGED
@@ -12,7 +12,7 @@ export interface IdentifierAction {
12
12
  uuidKey?: string;
13
13
  }
14
14
 
15
- export interface IClient<T extends IHost, U extends ClientModule, V extends FunctionType = FunctionType> extends IModule<T>, IExternalConfig<U, U extends ClientModule<infer W> ? W : unknown>, IExternalFunction<V> {
15
+ export interface IClient<T extends IHost, U extends ClientModule, V extends FunctionType<any, any> = FunctionType> extends IModule<T>, IExternalConfig<U, U extends ClientModule<infer W> ? W : unknown>, IExternalFunction<V> {
16
16
  init(...args: unknown[]): this;
17
17
  getUserSettings<X>(): Null<X>;
18
18
  set cacheDir(value: string);
package/lib/index.d.ts CHANGED
@@ -265,7 +265,7 @@ declare namespace functions {
265
265
 
266
266
  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> {
267
267
  connectTimeout: number;
268
- start(assets: U[], permission?: IPermission): void;
268
+ start(assets: U[], permission?: Null<IPermission>): void;
269
269
  modified(watch: IFileGroup<U>): Promise<Void<FinalizeResult>>;
270
270
  configureServer(options: SecureOptions): boolean;
271
271
  setCA(value: string): boolean;
@@ -310,9 +310,9 @@ declare namespace functions {
310
310
  lookupDns(hostname: string): LookupFunction;
311
311
  proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
312
312
  statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
313
- statusOn(name: ArrayOf<number>, patternUrl: string, callback: StatusOnCallback): void;
313
+ statusOn(name: ArrayOf<number>, globUrl: string, callback: StatusOnCallback): void;
314
314
  headersOn(name: StringOfArray, callback: HeadersOnCallback): void;
315
- headersOn(name: StringOfArray, patternUrl: string, callback: HeadersOnCallback): void;
315
+ headersOn(name: StringOfArray, globUrl: string, callback: HeadersOnCallback): void;
316
316
  headersOf(uri: string): Undef<OutgoingHttpHeaders>;
317
317
  aria2c(uri: string | URL, pathname: string): Promise<string[]>;
318
318
  aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
@@ -572,9 +572,9 @@ declare namespace functions {
572
572
  readFile(src: string): Undef<Buffer>;
573
573
  readFile<U extends ReadFileOptions>(src: string, options?: U): Undef<U extends { encoding: string } ? U extends { minStreamSize: NumString } ? Promise<string> : string : U extends { minStreamSize: NumString } ? Promise<Buffer> : Buffer>;
574
574
  readFile<U extends Buffer>(src: string, promises: true): Promise<Undef<U>>;
575
- readFile<U extends BufferContent>(src: string, options: ReadFileOptions, promises: true): Promise<Undef<U>>;
576
- readFile<U extends ReadFileCallback<V>, V extends Buffer>(src: string, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : V>;
577
- readFile<U extends ReadFileCallback<V>, V extends BufferContent>(src: string, options: ReadFileOptions, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : V>;
575
+ readFile<U extends BufferContent, V extends ReadFileOptions>(src: string, options: V, promises: true): Promise<Undef<V extends { encoding: string } ? string : U>>;
576
+ readFile<U extends ReadFileCallback>(src: string, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : BufferContent>;
577
+ readFile<U extends ReadFileCallback, V extends ReadFileOptions>(src: string, options: V, callback: U): Undef<V extends { encoding: string } ? string : U extends ReadFileCallback<infer W> ? W : BufferContent>;
578
578
  writeFile<U extends boolean>(src: string, data: BufferView, options?: WriteFileOptions): U;
579
579
  writeFile<U extends Promise<boolean>>(src: string, data: BufferView, promises: true): U;
580
580
  writeFile<U extends Promise<boolean>>(src: string, data: BufferView, options: WriteFileOptions, promises: true): U;
package/lib/module.d.ts CHANGED
@@ -127,5 +127,5 @@ export interface GetTempDirOptions {
127
127
 
128
128
  export type NormalizeFlags = typeof NORMALIZE_FLAGS[keyof typeof NORMALIZE_FLAGS];
129
129
  export type ReadTextOptions = ReadBufferOptions;
130
- export type ReadFileCallback<T> = (err: Null<NodeJS.ErrnoException>, data?: T) => void;
130
+ export type ReadFileCallback<T extends BufferContent = BufferContent> = (err: Null<NodeJS.ErrnoException>, data?: T) => void;
131
131
  export type ProtocolType = "http" | "https" | "http/s" | "ftp" | "sftp" | "s/ftp" | "torrent" | "unc";
package/lib/request.d.ts CHANGED
@@ -65,7 +65,6 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
65
65
  postData?: unknown;
66
66
  connected?: (headers: IncomingHttpHeaders) => Void<boolean>;
67
67
  statusMessage?: string;
68
- silent?: boolean;
69
68
  outFormat?: { out: BufferFormat; parser?: PlainObject };
70
69
  outFilename?: Null<string>;
71
70
  outHeaders?: Null<IncomingHttpHeaders>;
@@ -105,7 +104,9 @@ export interface ProxySettings extends KeepAliveAction {
105
104
 
106
105
  export interface RequestInit extends ProtocolAction {
107
106
  headers?: unknown;
107
+ /* @deprecated - readTimeout */
108
108
  requestTimeout?: number;
109
+ readTimeout?: number;
109
110
  }
110
111
 
111
112
  export interface ClientConfig {
package/lib/settings.d.ts CHANGED
@@ -84,8 +84,8 @@ export interface PermissionModule<T = PermissionSettings> extends PermittedDirec
84
84
  }
85
85
 
86
86
  export interface PermissionSettings extends PlainObject {
87
- picomatch?: PicomatchOptions;
88
- minimatch?: MinimatchOptions;
87
+ picomatch?: Null<PicomatchOptions>;
88
+ minimatch?: Null<MinimatchOptions>;
89
89
  }
90
90
 
91
91
  export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",