@e-mc/types 0.8.0 → 0.8.2

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,11 +1,11 @@
1
- Copyright 2023 An Pham
2
-
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
-
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
-
7
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
-
9
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
-
1
+ Copyright 2023 An Pham
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
11
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ### @e-mc/types
2
2
 
3
+ https://e-mc.readthedocs.io
4
+
3
5
  ### LICENSE
4
6
 
5
7
  BSD 3-Clause
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.8.0',
2
+ VERSION = '0.8.2',
3
3
  TEMP_DIR = 'tmp', // eslint-disable-line @typescript-eslint/no-shadow
4
4
  CJS = '__cjs__'
5
5
  }
@@ -153,6 +153,10 @@ export const enum ERR_IMAGE {
153
153
  METHOD_ARGS = 'Invalid method arguments'
154
154
  }
155
155
 
156
+ export const enum ERR_HTTP {
157
+ HEADERS = 'Unable to process headers'
158
+ }
159
+
156
160
  export const enum DB_TRANSACTION {
157
161
  ACTIVE = 1,
158
162
  PARTIAL = 2,
@@ -255,6 +259,7 @@ export const enum SETTINGS_KEY_NAME {
255
259
  PERMISSION_HOMEREAD = "permission.home_read",
256
260
  PERMISSION_HOMEWRITE = "permission.home_write",
257
261
  MEMORY_SETTINGS_USERS = "memory.settings.users",
262
+ MEMORY_SETTINGS_CACHE_DISK = "memory.settings.cache_disk",
258
263
  ERROR_OUT = "error.out",
259
264
  ERROR_FATAL = "error.fatal",
260
265
  BROADCAST_OUT = "broadcast.out",
package/index.js CHANGED
@@ -15,7 +15,8 @@ class AbortError extends Error {
15
15
  }
16
16
  }
17
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;
18
- const REGEXP_FUNCTION = /^(async\s+)?(function(?:\b|\s+)([\w_$]*)\s*\(([^)]*)\)\s*\{([\S\s]*)\})$/;
18
+ const REGEXP_FUNCTION = /^(async\s+)?(function(?:\b|\s+)[\w_$]*\s*\(([^)]*)\)\s*\{([\S\s]*)\})$/;
19
+ const REGEXP_FUNCTION_ARROW = /^(async\s+)?(\s*\(([^)]*)\)\s*=>\s*(?:\{([\S\s]*)\}|(?!\s|{)((?:(?<!return\s+)(?:"[^"\n]*"|'[^'\n]*'|`[^`]*`|[^\n;"'`]))*;)))$/;
19
20
  const ASYNC_FUNCTION = Object.getPrototypeOf(async () => { }).constructor;
20
21
  let CACHE_COERCED = new WeakSet();
21
22
  let LOG_CURRENT = null;
@@ -805,10 +806,10 @@ function asFunction(value, sync = true) {
805
806
  return value;
806
807
  }
807
808
  let match;
808
- if (isString(value) && (match = REGEXP_FUNCTION.exec(value = value.trim()))) {
809
+ if (isString(value) && (match = REGEXP_FUNCTION.exec(value = value.trim()) || REGEXP_FUNCTION_ARROW.exec(value))) {
809
810
  if (!sync || match[1]) {
810
- const args = match[4].trim().split(/\s*,\s*/);
811
- args.push(match[5]);
811
+ const args = match[3].trim().split(/\s*,\s*/);
812
+ args.push(match[4] || (match[5] && (match[5] = 'return ' + match[5])));
812
813
  return new ASYNC_FUNCTION(...args);
813
814
  }
814
815
  try {
@@ -824,7 +825,22 @@ function asFunction(value, sync = true) {
824
825
  }
825
826
  exports.asFunction = asFunction;
826
827
  function getEncoding(value, fallback = 'utf-8') {
827
- return typeof value === 'string' && Buffer.isEncoding(value = value.trim().toLowerCase()) ? value : fallback;
828
+ if (typeof value === 'string') {
829
+ switch (value = value.trim().toLowerCase()) {
830
+ case 'utf8':
831
+ case 'utf-8':
832
+ case 'utf16le':
833
+ case 'utf-16le':
834
+ return value;
835
+ case 'utf16':
836
+ case 'utf-16':
837
+ return 'utf-16le';
838
+ }
839
+ if (Buffer.isEncoding(value)) {
840
+ return value;
841
+ }
842
+ }
843
+ return fallback;
828
844
  }
829
845
  exports.getEncoding = getEncoding;
830
846
  function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
package/lib/asset.d.ts CHANGED
@@ -14,6 +14,10 @@ export interface BinaryAction {
14
14
  binOpts?: string[];
15
15
  }
16
16
 
17
+ export interface StreamAction {
18
+ minStreamSize?: NumString;
19
+ }
20
+
17
21
  export interface FileData<T extends ExternalAsset> extends MimeTypeAction {
18
22
  file: T;
19
23
  }
@@ -50,7 +54,7 @@ export interface InitialValue extends Partial<LocationUri>, MimeTypeAction {
50
54
  cacheable?: boolean;
51
55
  }
52
56
 
53
- export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction {
57
+ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, StreamAction {
54
58
  id?: number;
55
59
  url?: URL;
56
60
  socketPath?: string;
package/lib/cloud.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { DbDataSource, LocationUri, StorageAction } from './squared';
2
2
 
3
- import type { ExternalAsset } from './asset';
3
+ import type { ExternalAsset, StreamAction } from './asset';
4
4
 
5
5
  export interface UploadAction {
6
6
  cloudUrl?: string;
@@ -37,7 +37,7 @@ export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unk
37
37
  preservePath?: boolean;
38
38
  }
39
39
 
40
- export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown> extends Partial<LocationUri> {
40
+ export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown> extends Partial<LocationUri>, StreamAction {
41
41
  active?: boolean;
42
42
  overwrite?: boolean;
43
43
  admin?: CloudStorageAdmin<T, U, V, W>;
@@ -49,7 +49,7 @@ export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = st
49
49
  metadata?: Record<string, string>;
50
50
  tags?: Record<string, string> | false;
51
51
  options?: T;
52
- fileGroup?: [BufferContent, string, string?][];
52
+ fileGroup?: UploadContent[];
53
53
  localStorage?: boolean;
54
54
  endpoint?: string;
55
55
  all?: boolean;
@@ -87,5 +87,6 @@ export interface BucketAction {
87
87
  bucket: string;
88
88
  }
89
89
 
90
+ export type UploadContent = [BufferContent, string, string?];
90
91
  export type CloudFeatures = "storage" | "database";
91
92
  export type CloudFunctions = "upload" | "download";
package/lib/core.d.ts CHANGED
@@ -152,6 +152,7 @@ export interface StoreResultOptions {
152
152
  export interface CacheOptions {
153
153
  value?: DbCacheValue;
154
154
  renewCache?: boolean;
155
+ exclusiveOf?: [number, number?, number?];
155
156
  sessionKey?: string;
156
157
  }
157
158
 
package/lib/http.d.ts CHANGED
@@ -45,6 +45,7 @@ export const enum HTTP_STATUS {
45
45
  UNPROCESSABLE_ENTITY = 422,
46
46
  LOCKED = 423,
47
47
  FAILED_DEPENDENCY = 424,
48
+ TOO_EARLY = 425,
48
49
  UPGRADE_REQUIRED = 426,
49
50
  PRECONDITION_REQUIRED = 428,
50
51
  TOO_MANY_REQUESTS = 429,
@@ -62,6 +63,7 @@ export const enum HTTP_STATUS {
62
63
  VARIANT_ALSO_NEGOTIATES = 506,
63
64
  INSUFFICIENT_STORAGE = 507,
64
65
  LOOP_DETECTED = 508,
66
+ BANDWIDTH_LIMIT_EXCEEDED = 509,
65
67
  NOT_EXTENDED = 510,
66
68
  NETWORK_AUTHENTICATION_REQUIRED = 511,
67
69
  WEB_SERVER_IS_DOWN = 521,
package/lib/index.d.ts CHANGED
@@ -15,9 +15,9 @@ import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutp
15
15
  import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
16
16
  import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
17
17
  import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
18
- import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadFileCallback, ReadFileOptions, ReadHashOptions, RemoveDirOptions, WriteFileOptions } from './module';
18
+ import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadBufferOptions, ReadFileCallback, ReadFileOptions, ReadHashOptions, ReadTextOptions, RemoveDirOptions, WriteFileOptions } from './module';
19
19
  import type { RequestData, Settings } from './node';
20
- import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit } from './request';
20
+ import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from './request';
21
21
  import type { ClientModule, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
22
22
  import type { Command, SpawnResult } from './task';
23
23
  import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
@@ -109,6 +109,7 @@ declare namespace functions {
109
109
  clamp(value: unknown, min?: number, max?: number): number;
110
110
  isBinary(mime: unknown): mime is string;
111
111
  toABGR(buffer: Uint8Array | Buffer): Buffer;
112
+ /* @deprecated IImage.using (v0.9) */
112
113
  using?<V extends ExternalAsset>(this: T, instance: IImage<T, U>, data: IFileThread<V>, command: string): Promise<unknown>;
113
114
  readonly prototype: IImage<T, U>;
114
115
  new(module?: U): IImage<T, U>;
@@ -126,6 +127,7 @@ declare namespace functions {
126
127
 
127
128
  interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
128
129
  finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
130
+ /* @deprecated ITask.using (v0.9) */
129
131
  using?<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[], preceding?: boolean): Promise<unknown>;
130
132
  readonly prototype: ITask<T, U>;
131
133
  new(module?: U, ...args: unknown[]): ITask<T, U>;
@@ -254,6 +256,7 @@ declare namespace functions {
254
256
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): Undef<string>;
255
257
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions | boolean): string;
256
258
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
259
+ /* @deprecated IDocument.using (v0.9) */
257
260
  using?(this: T, instance: IDocument<T, U, V, W, X, Y>, file: U): Promise<unknown>;
258
261
  cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
259
262
  sanitizeAssets?(assets: U[], exclusions?: U[]): U[];
@@ -302,9 +305,12 @@ declare namespace functions {
302
305
  proxy: Null<ProxySettings>;
303
306
  init(config?: RequestInit): this;
304
307
  apply(options: ApplyOptions): this;
305
- addDns(hostname: string, address: string, family?: NumString): void;
308
+ addDns(hostname: string, address: string, timeout: number): void;
309
+ addDns(hostname: string, address: string, family?: NumString, timeout?: number): void;
306
310
  lookupDns(hostname: string): LookupFunction;
307
311
  proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
312
+ statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
313
+ statusOn(name: ArrayOf<number>, patternUrl: string, callback: StatusOnCallback): void;
308
314
  headersOn(name: ArrayOf<string>, callback: HeadersOnCallback): void;
309
315
  headersOn(name: ArrayOf<string>, patternUrl: string, callback: HeadersOnCallback): void;
310
316
  headersOf(uri: string): Undef<OutgoingHttpHeaders>;
@@ -412,7 +418,7 @@ declare namespace functions {
412
418
  addCopy(data: FileCommand<T>, saveAs?: string, replace?: boolean): Undef<string>;
413
419
  findMime(file: T, rename?: boolean): Promise<string>;
414
420
  getUTF8String(file: T, uri?: string): string;
415
- getBuffer(file: T): Null<Buffer>;
421
+ getBuffer<U>(file: T, minStreamSize?: U): U extends number ? Promise<Buffer> : Null<Buffer>;
416
422
  getCacheDir(url: string | URL, createDir?: boolean): string;
417
423
  setAssetContent(file: T, content: string, options?: AssetContentOptions): string;
418
424
  getAssetContent(file: T, content?: string): Undef<string>;
@@ -562,7 +568,7 @@ declare namespace functions {
562
568
  canRead(uri: string, options?: PermissionOptions): boolean;
563
569
  canWrite(uri: string, options?: PermissionOptions): boolean;
564
570
  readFile(src: string): Undef<Buffer>;
565
- readFile<U extends ReadFileOptions>(src: string, options?: U): Undef<U extends { encoding: string } ? string : BufferContent>;
571
+ 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>;
566
572
  readFile<U extends Buffer>(src: string, promises: true): Promise<Undef<U>>;
567
573
  readFile<U extends BufferContent>(src: string, options: ReadFileOptions, promises: true): Promise<Undef<U>>;
568
574
  readFile<U extends ReadFileCallback<V>, V extends Buffer>(src: string, callback: U): Undef<U extends ReadFileCallback<infer W> ? W : V>;
@@ -716,8 +722,13 @@ declare namespace functions {
716
722
  copyDir(src: string | URL, dest: string | URL, options: CopyDirOptions): Promise<CopyDirResult>;
717
723
  copyDir(src: string | URL, dest: string | URL, move?: boolean, recursive?: boolean): Promise<CopyDirResult>;
718
724
  renameFile(src: string | URL, dest: string | URL, throws?: boolean): boolean;
725
+ streamFile<U extends BufferContent>(src: string, cache: boolean): Promise<U>;
726
+ streamFile<U extends BufferContent>(src: string, options: U): Promise<U extends { encoding: string } ? string : Buffer>;
727
+ streamFile<U extends BufferContent>(src: string, cache?: boolean | U, options?: U): Promise<U extends { encoding: string } ? string : Buffer>;
719
728
  readText(value: string | URL, cache: boolean): string;
720
- readText(value: string | URL, encoding?: BufferEncoding | boolean, cache?: boolean): string;
729
+ readText<U extends ReadTextOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<string> : string;
730
+ readText(value: string | URL, encoding?: BufferEncoding | boolean | ReadTextOptions, cache?: boolean): string;
731
+ readBuffer<U extends ReadBufferOptions>(value: string | URL, options: U): U extends { minStreamSize: NumString } ? Promise<Null<Buffer>> : Null<Buffer>;
721
732
  readBuffer(value: string | URL, cache?: boolean): Null<Buffer>;
722
733
  resolveMime(data: string | Buffer | Uint8Array | ArrayBuffer): Promise<Undef<FileTypeResult>>;
723
734
  lookupMime(value: string, extension?: boolean): string;
package/lib/logger.d.ts CHANGED
@@ -40,6 +40,7 @@ export interface LoggerFormat<T = NumString> {
40
40
  bold?: boolean;
41
41
  justify?: TextAlign;
42
42
  unit?: string;
43
+ as?: StringMap;
43
44
  }
44
45
 
45
46
  export interface LoggerStatus<T = boolean> {
package/lib/module.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { ChecksumBase } from './squared';
2
2
 
3
+ import type { StreamAction } from './asset';
4
+
3
5
  import type { HashOptions } from 'crypto';
4
6
 
5
7
  declare enum NORMALIZE_FLAGS {
@@ -25,7 +27,7 @@ export interface FileSystemOptions extends PermissionOptions {
25
27
  throwsDoesNotExist?: boolean;
26
28
  }
27
29
 
28
- export interface ReadFileOptions extends FileSystemOptions, RequireAction {
30
+ export interface ReadFileOptions extends FileSystemOptions, StreamBase, RequireAction {
29
31
  cache?: boolean;
30
32
  encoding?: BufferEncoding;
31
33
  }
@@ -97,9 +99,17 @@ export interface CopyDirResult {
97
99
  ignored: string[];
98
100
  }
99
101
 
100
- export interface ReadHashOptions extends ChecksumBase {
102
+ export interface StreamBase extends StreamAction {
103
+ signal?: AbortSignal;
104
+ }
105
+
106
+ export interface ReadHashOptions extends ChecksumBase, StreamBase {
101
107
  chunkSize?: number;
102
- minStreamSize?: number;
108
+ }
109
+
110
+ export interface ReadBufferOptions extends StreamBase {
111
+ encoding?: BufferEncoding;
112
+ cache?: boolean;
103
113
  }
104
114
 
105
115
  export interface AsHashOptions extends HashOptions, ChecksumBase {
@@ -116,5 +126,6 @@ export interface GetTempDirOptions {
116
126
  }
117
127
 
118
128
  export type NormalizeFlags = typeof NORMALIZE_FLAGS[keyof typeof NORMALIZE_FLAGS];
129
+ export type ReadTextOptions = ReadBufferOptions;
119
130
  export type ReadFileCallback<T> = (err: Null<NodeJS.ErrnoException>, data?: T) => void;
120
131
  export type ProtocolType = "http" | "https" | "http/s" | "ftp" | "sftp" | "s/ftp" | "torrent" | "unc";
package/lib/request.d.ts CHANGED
@@ -128,4 +128,5 @@ export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
128
128
  export type ReadExpectType = "always" | "string" | "none";
129
129
  export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Null<BufferContent>;
130
130
  export type DataObjectResult<T extends { format?: unknown; encoding?: BufferEncoding }> = T extends { format: string | PlainObject } ? Null<object> : DataEncodedResult<T>;
131
- export type HeadersOnCallback = (value: IncomingHttpHeaders, url?: URL) => Void<boolean>;
131
+ export type StatusOnCallback = (code: number, headers: IncomingHttpHeaders, url?: URL) => Void<boolean>;
132
+ export type HeadersOnCallback = (headers: IncomingHttpHeaders, url?: URL) => Void<boolean>;
package/lib/settings.d.ts CHANGED
@@ -166,6 +166,14 @@ export interface MemoryModule<T = MemorySettings> extends HandlerSettings<T>, Re
166
166
 
167
167
  export interface MemorySettings extends PlainObject {
168
168
  users?: boolean | string[];
169
+ cache_disk?: MemoryCacheDiskSettings;
170
+ }
171
+
172
+ export interface MemoryCacheDiskSettings<T = NumString> extends IncludeAction<Null<string[]>> {
173
+ enabled?: boolean;
174
+ min_size?: T;
175
+ max_size?: T;
176
+ expires?: T;
169
177
  }
170
178
 
171
179
  export interface DbModule<T = DbSettings> extends ClientModule<T>, DbSourceDataType<ObjectMap<StringMap>>, PlainObject {}
@@ -233,11 +241,9 @@ export interface RequestModule<T = RequestSettings> extends HandlerSettings<T> {
233
241
  http_version?: NumString;
234
242
  accept_encoding?: boolean;
235
243
  };
236
- proxy?: AuthValue & {
244
+ proxy?: AuthValue & IncludeAction & {
237
245
  address?: string;
238
246
  port?: NumString;
239
- include?: string[];
240
- exclude?: string[];
241
247
  keep_alive?: boolean;
242
248
  };
243
249
  headers?: HttpOutgoingHeaders;
@@ -364,12 +370,10 @@ export interface HttpSettings {
364
370
  certs?: ObjectMap<SecureConfig<StringOfArray>>;
365
371
  }
366
372
 
367
- export interface HttpDiskSettings {
373
+ export interface HttpDiskSettings extends IncludeAction {
368
374
  enabled?: boolean;
369
375
  limit?: NumString;
370
376
  expires?: NumString;
371
- include?: string[];
372
- exclude?: string[];
373
377
  }
374
378
 
375
379
  export interface HttpMemorySettings extends HttpDiskSettings {
@@ -392,15 +396,13 @@ export interface DnsLookupSettings {
392
396
  resolve?: ObjectMap<Partial<LookupAddress>>;
393
397
  }
394
398
 
395
- export interface HashConfig {
399
+ export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*">> {
396
400
  enabled?: boolean;
397
401
  algorithm?: HashAlgorithm;
398
402
  etag?: boolean;
399
403
  expires?: NumString;
400
404
  renew?: boolean;
401
405
  limit?: NumString;
402
- exclude?: ObjectMap<string[] | "*">;
403
- include?: ObjectMap<string[] | "*">;
404
406
  }
405
407
 
406
408
  export interface SecureConfig<T = string, U = T> {
@@ -440,6 +442,11 @@ export interface PurgeAction {
440
442
  purge?: PurgeComponent;
441
443
  }
442
444
 
445
+ export interface IncludeAction<T = string[]> {
446
+ include?: T;
447
+ exclude?: T;
448
+ }
449
+
443
450
  export interface CipherConfig {
444
451
  algorithm?: CipherGCMTypes;
445
452
  key?: BinaryLike;
package/lib/squared.d.ts CHANGED
@@ -53,7 +53,7 @@ export interface DataSource<T = unknown> extends DocumentAction {
53
53
  preRender?: string | FunctionType;
54
54
  whenEmpty?: string | FunctionType;
55
55
  removeEmpty?: boolean;
56
- ignoreCache?: boolean | 0 | 1;
56
+ ignoreCache?: boolean | 0 | 1 | [number, number?, number?];
57
57
  transactionState?: number;
58
58
  transactionFail?: boolean;
59
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",