@e-mc/types 0.13.6 → 0.13.8

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.6/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.13.8/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, 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.6/index.d.ts
212
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/logger.d.ts
213
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/module.d.ts
214
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/node.d.ts
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
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.6',
2
+ VERSION = '0.13.8',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.d.ts CHANGED
@@ -350,6 +350,7 @@ declare namespace types {
350
350
  function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
351
351
  function importESM<T = unknown>(name: string | URL, isDefault: boolean, fromPath?: boolean): Promise<T>;
352
352
  function importESM<T = unknown>(name: string | URL, options?: ImportAttributes, fromPath?: boolean): Promise<T>;
353
+ function requireESM<T = unknown>(name: string, expect?: string): T;
353
354
  function purgeMemory(percent?: number): number;
354
355
  }
355
356
 
package/index.js CHANGED
@@ -48,6 +48,7 @@ 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");
@@ -57,6 +58,7 @@ const node_url_1 = require("node:url");
57
58
  const PATTERN_CHARS = {
58
59
  '&': '\\x26',
59
60
  '!': '\\x21',
61
+ '"': '\\x22',
60
62
  '#': '\\x23',
61
63
  '%': '\\x25',
62
64
  ',': '\\x2c',
@@ -102,6 +104,7 @@ let CACHE_COERCED = new WeakSet();
102
104
  let LOG_CURRENT = null;
103
105
  let SUPPORTED_HASHSINGLE = false;
104
106
  let SUPPORTED_IMPORTATTRIBUTES = false;
107
+ let SUPPORTED_REGEXPESCAPE = false;
105
108
  let TEMP_DIR = path.join(process.cwd(), "tmp");
106
109
  let INCREMENT_COUNT = 65536;
107
110
  let INCREMENT_PREFIX = '';
@@ -176,7 +179,7 @@ function fromObject(value, typedArray, structured, shared) {
176
179
  function trimQuote(value) {
177
180
  value = value.trim();
178
181
  const first = value[0];
179
- return first === value.at(-1) && (first === '"' || first === "'" || first === "`") ? value.substring(1, value.length - 1) : value;
182
+ return first === value.at(-1) && (first === '"' || first === "'" || first === "`") ? value.slice(1, -1) : value;
180
183
  }
181
184
  function checkCipherType(value) {
182
185
  switch (value) {
@@ -761,6 +764,9 @@ function hasGlob(value) {
761
764
  function escapePattern(value, symbols) {
762
765
  switch (typeof value) {
763
766
  case 'string': {
767
+ if (symbols && SUPPORTED_REGEXPESCAPE) {
768
+ return RegExp.escape(value);
769
+ }
764
770
  let result = '', j = 0;
765
771
  for (let i = 0, length = value.length, ch; i < length; ++i) {
766
772
  switch (ch = value[i]) {
@@ -1051,18 +1057,18 @@ function asFunction(value, sync = true) {
1051
1057
  }
1052
1058
  function getEncoding(value, fallback) {
1053
1059
  if (typeof value === 'string') {
1054
- switch (value = value.trim().toLowerCase()) {
1055
- case 'utf8':
1056
- case 'utf-8':
1057
- return 'utf8';
1058
- case 'utf16le':
1059
- case 'utf-16le':
1060
- case 'utf16':
1061
- case 'utf-16':
1062
- return 'utf16le';
1060
+ const result = value.trim().toLowerCase();
1061
+ if (result.slice(0, 3) === 'utf') {
1062
+ switch (result.slice(result[3] === '-' ? 4 : 3)) {
1063
+ case '8':
1064
+ return 'utf8';
1065
+ case '16le':
1066
+ case '16':
1067
+ return 'utf16le';
1068
+ }
1063
1069
  }
1064
- if (Buffer.isEncoding(value)) {
1065
- return value;
1070
+ else if (Buffer.isEncoding(result)) {
1071
+ return result;
1066
1072
  }
1067
1073
  }
1068
1074
  return fallback || 'utf8';
@@ -1102,7 +1108,7 @@ function randomString(format, dictionary) {
1102
1108
  let length = 0, available;
1103
1109
  if (b.startsWith('[') && b.endsWith(']')) {
1104
1110
  length = 1;
1105
- available = b.substring(1, b.length - 1);
1111
+ available = b.slice(1, -1);
1106
1112
  }
1107
1113
  else {
1108
1114
  if (isNaN(length = +b)) {
@@ -1260,5 +1266,10 @@ async function importESM(name, isDefault, fromPath) {
1260
1266
  }
1261
1267
  return result;
1262
1268
  }
1269
+ function requireESM(name, expect) {
1270
+ const result = require(name);
1271
+ return process.features.require_module && isObject(result) && result.__esModule && 'default' in result && (!expect || typeof result.default === expect) ? result.default : result;
1272
+ }
1263
1273
  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);
1274
+ SUPPORTED_IMPORTATTRIBUTES = supported(18, 20, true) || supported(20, 10);
1275
+ SUPPORTED_REGEXPESCAPE = supported(24);
package/lib/core.d.ts CHANGED
@@ -40,11 +40,11 @@ export interface IClientDb<T extends IHost, U extends ClientModule<ClientDbSetti
40
40
  hasCache(source: string, sessionKey?: string): boolean;
41
41
  hasCoerce(source: string, component: keyof DbCoerceSettings, uuidKey: string | undefined): boolean;
42
42
  hasCoerce(source: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
43
+ getQueryResult(source: string, credential: unknown, queryString: string, options: CacheOptions): QueryResult | undefined;
43
44
  getQueryResult(source: string, credential: unknown, queryString: string, renewCache: boolean): QueryResult | undefined;
44
- getQueryResult(source: string, credential: unknown, queryString: string, sessionKey?: string, renewCache?: boolean): QueryResult | undefined;
45
- getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean): QueryResult | undefined;
46
- setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey?: string): QueryResult;
47
- setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
45
+ getQueryResult(source: string, credential: unknown, queryString: string, sessionKey?: string | CacheOptions, renewCache?: boolean): QueryResult | undefined;
46
+ setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options: CacheOptions): QueryResult;
47
+ setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey?: string | CacheOptions): QueryResult;
48
48
  getCacheResult(source: string, credential: unknown, queryString: string, cacheValue: CacheOptions, ignoreCache?: IntBool | FirstOf<number, number>): QueryResult | undefined;
49
49
  applyState(items: V | V[], value: number, as?: boolean): void;
50
50
  commit(items?: V[]): Promise<boolean>;
@@ -68,6 +68,7 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
68
68
  loadSettings(settings: Pick<Settings, "process" | "memory">, password?: string): boolean;
69
69
  getTimeout(value: number | string | TimeoutAction | undefined): number;
70
70
  convertTime(value: number | string): number;
71
+ findResult(source: string, credential: unknown, queryString: string, timeout: number, renewCache: boolean): QueryResult | undefined;
71
72
  findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): QueryResult | undefined;
72
73
  storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
73
74
  /** @deprecated */
package/lib/http.d.ts CHANGED
@@ -112,7 +112,8 @@ export interface AuthValue {
112
112
  }
113
113
 
114
114
  export type HttpRequestClient = ClientRequest | ClientHttp2Stream;
115
- export type HttpOutgoingHeaders = ObjectMap<OutgoingHttpHeaders>;
115
+ export type HttpHeaders = OutgoingHttpHeaders | Headers;
116
+ export type HttpOutgoingHeaders = ObjectMap<HttpHeaders>;
116
117
  export type HttpAgentOptions = Pick<AgentOptions, "timeout" | "maxSockets" | "maxTotalSockets" | "keepAliveMsecs" | "maxFreeSockets" | "proxyEnv">;
117
118
  export type HttpProtocolVersion = 1 | 2 | 3;
118
119
  export type InternetProtocolVersion = 0 | 4 | 6;
package/lib/index.d.ts CHANGED
@@ -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';
@@ -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;
@@ -409,10 +409,10 @@ declare namespace functions {
409
409
  put<V extends PutOptions>(uri: string | URL, data: unknown, options: V): Promise<DataObjectResult<V>>;
410
410
  put<V extends PutOptions>(uri: string | URL, data: unknown, contentType?: string | V, options?: V): Promise<DataObjectResult<V>>;
411
411
  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>>;
412
+ post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, parts: PostFileParts): Promise<DataObjectResult<V>>;
413
+ post<V extends { format: undefined; encoding: undefined }>(uri: string | URL, form: AnyObject, parts: PostFileParts): Promise<DataObjectResult<V>>;
414
414
  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>>;
415
+ post<V extends PostOptions>(uri: string | URL, data: unknown, contentType?: string | PostFileParts | V, options?: V): Promise<DataObjectResult<V>>;
416
416
  get<V extends OpenOptions & { encoding: BufferEncoding }>(uri: string | URL, options: V): Promise<string>;
417
417
  get<V extends BufferFormat>(uri: string | URL, format: V): Promise<object | null>;
418
418
  get<V extends OpenOptions, W extends V | BufferFormat>(uri: string | URL, options?: W): Promise<W extends BufferFormat ? object | null : DataEncodedResult<V>>;
@@ -680,6 +680,7 @@ declare namespace functions {
680
680
  getThreadCount(full: true): ThreadCountStat;
681
681
  getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
682
682
  getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
683
+ parseIp(value: unknown, kind?: "ipv4" | "ipv6"): string;
683
684
  getLogDelayed(): FormatMessageArgs[];
684
685
  getPermissionFromSettings(freeze?: boolean): IPermission;
685
686
  readonly prototype: IHost;
@@ -883,11 +884,17 @@ declare namespace functions {
883
884
  readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Buffer | null;
884
885
  resolveMime(data: FileTypeFormat): Promise<FileTypeResult | undefined>;
885
886
  lookupMime(value: string, extension?: boolean): string;
886
- initCpuUsage(instance?: IModule): CpuUsage;
887
- getCpuUsage(start: CpuUsage, format: true): string;
888
- getCpuUsage(start: CpuUsage, format?: boolean): number;
887
+ /** @deprecated class */
888
+ initCpuUsage(instance?: IModule, thread?: boolean): CpuUsage;
889
+ /** @deprecated private */
890
+ getCpuUsage(start: CpuUsage, format: true, thread?: boolean): string;
891
+ /** @deprecated private */
892
+ getCpuUsage(start: CpuUsage, format?: boolean, thread?: boolean): number;
893
+ /** @deprecated private */
889
894
  getMemUsage(format: true | "%" | Unit, free?: boolean): string;
895
+ /** @deprecated private */
890
896
  getMemUsage(format?: boolean, free?: boolean): number;
897
+ /** @deprecated private */
891
898
  formatCpuMem(start: CpuUsage, all?: boolean): string;
892
899
  getPackageVersion(name: string | [string, string], options?: PackageVersionOptions): string;
893
900
  checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
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
@@ -38,13 +38,20 @@ export interface IHttpHost {
38
38
  success(version: HttpProtocolVersion, status?: boolean): number;
39
39
  failed(version: HttpProtocolVersion, status?: boolean): number;
40
40
  error(version: HttpProtocolVersion, status?: boolean): number;
41
+ /** @deprecated altSvc.did */
41
42
  didAltSvc(version: HttpProtocolVersion): boolean;
43
+ /** @deprecated altSvc.next */
42
44
  nextAltSvc(): boolean;
45
+ /** @deprecated altSvc.close */
43
46
  closeAltSvc(error?: boolean): boolean;
47
+ /** @deprecated altSvc.clear */
44
48
  clearAltSvc(version?: HttpProtocolVersion): void;
49
+ /** @deprecated altSvc.flag */
45
50
  flagAltSvc(version: HttpProtocolVersion, value: number): void;
46
51
  reset(): void;
52
+ v1(): boolean;
47
53
  v2(): boolean;
54
+ get altSvc(): IHttpHostAltSvc;
48
55
  set version(value);
49
56
  get version(): HttpProtocolVersion;
50
57
  get protocol(): string;
@@ -66,6 +73,25 @@ export interface HttpHostConstructor {
66
73
  new(url: URL, httpVersion?: HttpProtocolVersion): IHttpHost;
67
74
  }
68
75
 
76
+ export interface IHttpHostAltSvc {
77
+ did(version: HttpProtocolVersion): boolean;
78
+ next(): boolean;
79
+ close(error?: boolean): boolean;
80
+ clear(version?: HttpProtocolVersion): void;
81
+ flag(version: HttpProtocolVersion, value: number): void;
82
+ valid(hostname: string, port: string, version: number): boolean;
83
+ set available(value: unknown[]);
84
+ get errors(): AltSvcInfo[];
85
+ get hostname(): string | undefined;
86
+ get port(): string | undefined;
87
+ get origin(): string | undefined;
88
+ }
89
+
90
+ export interface HttpHostAltSvcConstructor {
91
+ readonly prototype: IHttpHostAltSvc;
92
+ new(host: IHttpHost, versionData: AltSvcData): IHttpHostAltSvc;
93
+ }
94
+
69
95
  export interface IHttpAdapter<T extends OpenOptions = OpenOptions> {
70
96
  instance: IRequest;
71
97
  state: ControllerState;
@@ -163,7 +189,7 @@ export interface PutOptions extends OpenOptions {
163
189
  }
164
190
 
165
191
  export interface PostOptions extends PutOptions {
166
- formData?: FormDataPart | FormDataPart[];
192
+ formData?: FormDataPart | File | PostFileParts;
167
193
  }
168
194
 
169
195
  export interface FormDataPart {
@@ -218,9 +244,34 @@ export interface ControllerState {
218
244
  readonly config: Required<ClientConfig>;
219
245
  }
220
246
 
247
+ export interface AltSvcInfo {
248
+ hostname: string;
249
+ port: string;
250
+ version: number;
251
+ }
252
+
253
+ export interface AltSvcLocation extends Partial<AltSvcInfo> {
254
+ origin?: string;
255
+ timeout?: NodeJS.Timeout | null;
256
+ }
257
+
258
+ export interface AltSvcAvailability extends AltSvcInfo {
259
+ expires: number;
260
+ persist: boolean;
261
+ }
262
+
263
+ export interface AltSvcData {
264
+ success: number;
265
+ failed: number;
266
+ errors: number;
267
+ alpn: number;
268
+ status: number;
269
+ }
270
+
221
271
  export type HttpMethod = "GET" | "POST" | "PUT" | "HEAD" | "DELETE";
222
272
  export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
223
273
  export type ReadExpectType = "always" | "string" | "none";
274
+ export type PostFileParts = (File | FormDataPart)[];
224
275
  export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Bufferable | null;
225
276
  export type DataObjectResult<T extends { format?: unknown; encoding?: BufferEncoding }> = T extends { format: string | PlainObject } ? object | null : DataEncodedResult<T>;
226
277
  export type StatusOnCallback = (code: number, headers: IncomingHttpHeaders, url?: URL) => boolean | void;
package/lib/settings.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { WatchInterval } from './squared';
1
+ import type { ExpiresAction, WatchInterval } from './squared';
2
2
 
3
3
  import type { HashAlgorithm } from './asset';
4
4
  import type { CloudSource } from './cloud';
@@ -74,20 +74,18 @@ export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
74
74
  };
75
75
  queue?: {
76
76
  limit?: number | string;
77
- expires?: number | string;
78
77
  priority: { bypass?: number | string } & MinMax<number | string>;
79
- };
78
+ } & ExpiresAction;
80
79
  worker?: {
81
80
  users?: boolean | string[];
82
81
  max?: number | string;
83
82
  max_expires?: number | string;
84
83
  locked?: boolean;
85
- channel?: MinMax<number | string> & { expires?: number | string; verbose?: boolean };
84
+ channel?: MinMax<number | string> & ExpiresAction & { verbose?: boolean };
86
85
  };
87
86
  limit?: number | string;
88
87
  sub_limit?: number | string;
89
- expires?: number | string;
90
- };
88
+ } & ExpiresAction;
91
89
  cipher?: CipherConfig;
92
90
  password?: string;
93
91
  }
@@ -114,8 +112,7 @@ export interface PermissionSettings extends PlainObject {
114
112
  minimatch?: MinimatchOptions | null;
115
113
  }
116
114
 
117
- export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
118
- expires?: number | string;
115
+ export interface DownloadModule<T = PlainObject> extends HandlerSettings<T>, ExpiresAction {
119
116
  aria2?: DownloadAction & {
120
117
  check_integrity?: boolean;
121
118
  update_status?: number | string | { interval?: number | string; broadcast_only?: boolean };
@@ -233,7 +230,7 @@ export interface DocumentDirectory extends StringMap {
233
230
  export type DocumentComponentOptions = DocumentComponent<DocumentComponentOption<DocumentTransform>, DocumentComponentOption<boolean>>;
234
231
 
235
232
  export interface ClientDbSettings<T = PlainObject> extends ClientSettings<T>, PurgeAction {
236
- session_expires?: number;
233
+ session_expires?: number | string;
237
234
  user_key?: ObjectMap<DbSourceOptions>;
238
235
  imports?: StringMap;
239
236
  }
@@ -246,13 +243,13 @@ export interface MemorySettings extends PlainObject {
246
243
  file_count?: boolean;
247
244
  };
248
245
  cache_disk?: MemoryCacheDiskSettings;
246
+ gc?: { interval?: number | string; expires_limit?: number | string } & ExpiresAction;
249
247
  }
250
248
 
251
- export interface MemoryCacheDiskSettings<T = number | string, U = string[] | null> extends IncludeAction<U> {
249
+ export interface MemoryCacheDiskSettings<T = number | string, U = string[] | null> extends IncludeAction<U>, ExpiresAction<T> {
252
250
  enabled?: boolean;
253
251
  min_size?: T;
254
252
  max_size?: T;
255
- expires?: T;
256
253
  }
257
254
 
258
255
  export interface DbModule<T = DbSettings> extends ClientModule<T>, DbSourceDataType<ObjectMap<AnyObject>>, PlainObject {
@@ -282,6 +279,7 @@ export interface DbCoerceSettings<T = boolean> {
282
279
 
283
280
  export interface PurgeBase<T = number | string> extends MinMax {
284
281
  enabled?: boolean;
282
+ type?: "lru" | "lfu";
285
283
  percent?: T;
286
284
  limit?: T;
287
285
  }
@@ -504,10 +502,9 @@ export interface HttpSettings {
504
502
  certs?: ObjectMap<SecureConfig<string | string[]>>;
505
503
  }
506
504
 
507
- export interface HttpDiskSettings extends IncludeAction {
505
+ export interface HttpDiskSettings extends IncludeAction, ExpiresAction {
508
506
  enabled?: boolean;
509
507
  limit?: number | string;
510
- expires?: number | string;
511
508
  }
512
509
 
513
510
  export interface HttpMemorySettings extends HttpDiskSettings {
@@ -524,17 +521,15 @@ export interface HttpConnectSettings {
524
521
  redirect_limit?: number | string;
525
522
  }
526
523
 
527
- export interface DnsLookupSettings {
524
+ export interface DnsLookupSettings extends ExpiresAction {
528
525
  family?: number | string;
529
- expires?: number | string;
530
526
  resolve?: ObjectMap<Partial<LookupAddress>>;
531
527
  }
532
528
 
533
- export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*">> {
529
+ export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*">>, ExpiresAction {
534
530
  enabled?: boolean;
535
531
  algorithm?: HashAlgorithm;
536
532
  etag?: boolean;
537
- expires?: number | string;
538
533
  renew?: boolean;
539
534
  limit?: number | string;
540
535
  }
@@ -552,10 +547,9 @@ export interface PurgeAction {
552
547
  purge?: PurgeComponent;
553
548
  }
554
549
 
555
- export interface CacheDirAction {
550
+ export interface CacheDirAction extends ExpiresAction {
556
551
  enabled?: boolean;
557
552
  dir?: string;
558
- expires?: number | string;
559
553
  }
560
554
 
561
555
  export interface PoolConfig<T = number> extends MinMax {
package/lib/squared.d.ts CHANGED
@@ -149,6 +149,10 @@ export interface FromAction {
149
149
  from?: string[];
150
150
  }
151
151
 
152
+ export interface ExpiresAction<T = number | string> {
153
+ expires?: T;
154
+ }
155
+
152
156
  export interface TaskCommand<T = PlainObject> {
153
157
  handler?: string;
154
158
  task?: string | T;
@@ -204,11 +208,10 @@ export interface LocationUri {
204
208
  filename: string;
205
209
  }
206
210
 
207
- export interface ViewEngine<T = unknown, U = PlainObject> {
211
+ export interface ViewEngine<T = unknown, U = PlainObject> extends ExpiresAction {
208
212
  name?: string;
209
213
  singleRow?: boolean;
210
214
  outputEmpty?: boolean;
211
- expires?: number | string;
212
215
  options?: {
213
216
  compile?: T;
214
217
  output?: U;
@@ -323,9 +326,8 @@ export interface ResponseError {
323
326
  hint?: string;
324
327
  }
325
328
 
326
- export interface RequestObserve extends WebSocketClient {
329
+ export interface RequestObserve extends WebSocketClient, ExpiresAction {
327
330
  action?: string;
328
- expires?: number | string;
329
331
  }
330
332
 
331
333
  export interface ChecksumBase<T = BinaryToTextEncoding> {
@@ -342,10 +344,9 @@ export interface ChecksumOutput<T = BinaryToTextEncoding> extends ChecksumBase<T
342
344
  recursive?: boolean | 1;
343
345
  }
344
346
 
345
- export interface TaskBase {
347
+ export interface TaskBase extends ExpiresAction {
346
348
  interval?: number | string;
347
349
  start?: number | string;
348
- expires?: number | string;
349
350
  }
350
351
 
351
352
  export type WebSocketEvent = "close" | "error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.13.6",
3
+ "version": "0.13.8",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",