@e-mc/types 0.10.5 → 0.10.7

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.10.5/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.10.7/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -68,6 +68,7 @@ function validateUUID(value: unknown): boolean;
68
68
  function randomString(format: string, dictionary?: string): string;
69
69
  function errorValue(value: string, hint?: string): Error;
70
70
  function errorMessage(title: number | string, value: string, hint?: string): Error;
71
+ function supported(major: number, minor: number, lts: boolean): boolean;
71
72
  function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
72
73
  function importESM<T = unknown>(name: string, isDefault?: boolean, fromPath?: boolean): Promise<T>;
73
74
  function purgeMemory(percent?: number): number;
@@ -196,10 +197,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
196
197
 
197
198
  ## References
198
199
 
199
- - https://www.unpkg.com/@e-mc/types@0.10.5/index.d.ts
200
- - https://www.unpkg.com/@e-mc/types@0.10.5/lib/logger.d.ts
201
- - https://www.unpkg.com/@e-mc/types@0.10.5/lib/module.d.ts
202
- - https://www.unpkg.com/@e-mc/types@0.10.5/lib/object.d.ts
200
+ - https://www.unpkg.com/@e-mc/types@0.10.7/index.d.ts
201
+ - https://www.unpkg.com/@e-mc/types@0.10.7/lib/logger.d.ts
202
+ - https://www.unpkg.com/@e-mc/types@0.10.7/lib/module.d.ts
203
+ - https://www.unpkg.com/@e-mc/types@0.10.7/lib/object.d.ts
203
204
 
204
205
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
205
206
  * 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.9.15',
2
+ VERSION = '0.10.7',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
@@ -8,6 +8,7 @@ export const enum VAL_MESSAGE {
8
8
  SUCCESS = 'Success',
9
9
  COMPLETED = 'Completed',
10
10
  CHECKSUM = 'Checksum matched',
11
+ MODIFIED_FILE = 'File modified',
11
12
  MODIFIED_DIRECTORY = 'Directory was modified',
12
13
  COMMIT_TRANSACTION = 'Transactions were committed'
13
14
  }
@@ -38,18 +39,22 @@ export const enum ERR_MESSAGE {
38
39
  FAIL = 'FAIL!',
39
40
  WARN = 'WARN!',
40
41
  ABORTED = 'Aborted',
42
+ EXPIRED = 'Expired',
41
43
  ABORTED_HOST = 'Aborted by host',
42
44
  ABORTED_CLIENT = 'Aborted by client',
43
45
  ABORTED_PROCESS = 'Aborted by process',
44
- ABORTED_OPERATION = 'The operation was aborted',
46
+ ABORTED_OPERATION = 'This operation was aborted',
45
47
  FAILED = 'Failed',
46
48
  FAILED_CHECKSUM = 'Checksum did not match',
47
49
  PARAMETERS = 'Invalid parameters',
48
50
  FORMAT = 'Invalid format',
49
51
  CHECKSUM = 'Invalid checksum',
52
+ CONFIG = 'Invalid config',
50
53
  RESPONSE = 'Invalid response',
54
+ FUNCTION = 'Invalid function',
51
55
  SIZE = 'Size limit was exceeded',
52
56
  ERROR_CODE = 'Error code',
57
+ BUSY_RESOURCE = 'Resource already in use',
53
58
  PERMISSION = 'Operation not permitted',
54
59
  EXEC_PERMISSION = 'Exec command not permitted',
55
60
  NOT_CACHEABLE = 'Not able to cache',
@@ -64,6 +69,7 @@ export const enum ERR_MESSAGE {
64
69
  TIMEOUT = 'Timeout was exceeded',
65
70
  HANDLED_REJECTION = 'Handled rejection',
66
71
  UNSUPPORTED_ACCESS = 'Unsupported access',
72
+ UNSUPPORTED_PROTOCOL = 'Unsupported protocol',
67
73
  UNSUPPORTED_MIME = 'Unsupported MIME',
68
74
  UNSUPPORTED_READ = 'Not permitted to read file',
69
75
  UNSUPPORTED_WRITE = 'Not permitted to write file',
@@ -72,6 +78,7 @@ export const enum ERR_MESSAGE {
72
78
  NOTFOUND_BINARY = 'Binary not found',
73
79
  NOTFOUND_PACKAGE = 'Package not found',
74
80
  NOTFOUND_MIME = 'MIME not found',
81
+ NOTFOUND_TLS = 'TLS/SSL key and cert not found',
75
82
  INSTALL = 'Install required?',
76
83
  INLINE_METHOD = 'Unable to parse inline method',
77
84
  INLINE_OBJECT = 'Unable to parse inline object',
@@ -118,6 +125,7 @@ export const enum ERR_DB {
118
125
  TABLE = 'Missing database table',
119
126
  QUERY = 'Missing database query',
120
127
  CONNECTION = 'Missing connection string',
128
+ TLS = 'Missing TLS/SSL credentials',
121
129
  CLIENT = 'Unable to configure client',
122
130
  EXEC_QUERY = 'Unable to execute query',
123
131
  FILTER_QUERY = 'Unable to filter results',
@@ -159,6 +167,10 @@ export const enum ERR_CLOUD {
159
167
  METADATA_FAIL = 'Metadata failed'
160
168
  }
161
169
 
170
+ export const enum ERR_COMPRESS {
171
+ API_KEY = 'Missing API key'
172
+ }
173
+
162
174
  export const enum ERR_IMAGE {
163
175
  ROTATE = 'Unable to rotate image',
164
176
  FINALIZE = 'Unable to finalize image',
@@ -168,7 +180,16 @@ export const enum ERR_IMAGE {
168
180
 
169
181
  export const enum ERR_HTTP {
170
182
  HEADERS = 'Unable to process headers',
183
+ FORMAT = 'Unable to parse URI response',
184
+ SERVER_WEBSOCKET = 'Unable to create WebSocket server',
171
185
  ETAG = 'ETag not supported',
186
+ REQUEST = 'Invalid HTTP request',
187
+ TIMEOUT = 'HTTP request timeout',
188
+ TIMEOUT_CONNECTION = 'HTTP connection timeout',
189
+ DATA_RECEIVED = 'No data received',
190
+ REDIRECT_LIMIT = 'Exceeded redirect limit',
191
+ REDIRECT_FOLLOW = 'Follow redirect was disabled',
192
+ REDIRECT_MISSING = 'Missing redirect location',
172
193
  DOWNLOAD_SUCCESS = 'No files were successfully downloaded',
173
194
  MULTIPART_ATTACH = 'No files were attached'
174
195
  }
@@ -229,6 +250,14 @@ export const enum PACKAGE_NAME {
229
250
  WATCH_FILEGROUP = '@e-mc/watch/filegroup'
230
251
  }
231
252
 
253
+ export const enum MIME_TYPE {
254
+ MULTIPART = 'multipart/form-data',
255
+ URLENCODED = 'application/x-www-form-urlencoded',
256
+ JSON = 'application/json',
257
+ TEXT = 'text/plain',
258
+ OCTET_STREAM = 'application/octet-stream'
259
+ }
260
+
232
261
  export const enum ASSET_FLAG {
233
262
  NONE = 0,
234
263
  IGNORE = 1,
@@ -263,15 +292,15 @@ export const enum LOG_TYPE {
263
292
  }
264
293
 
265
294
  export const enum LOG_STATE {
266
- STDIN = 0,
267
- STDOUT = 1,
268
- STDERR = 2
295
+ STDIN,
296
+ STDOUT,
297
+ STDERR
269
298
  }
270
299
 
271
300
  export const enum READDIR_SORT {
272
- FILE = 0,
273
- DIRECTORY = 1,
274
- DESCENDING = 2
301
+ FILE,
302
+ DIRECTORY,
303
+ DESCENDING
275
304
  }
276
305
 
277
306
  export const enum SETTINGS_KEY_NAME {
package/index.d.ts CHANGED
@@ -1,18 +1,14 @@
1
+ /// <reference lib="dom" />
1
2
  /// <reference path="./lib/type.d.ts" />
2
3
  /// <reference path="./lib/object.d.ts" />
3
4
 
4
5
  import type { LogArguments } from './lib/logger';
5
- import type { CloneObjectOptions } from './lib/module';
6
6
 
7
- import type { BinaryLike, CipherGCMTypes, Encoding } from 'crypto';
7
+ import type { BinaryLike, BinaryToTextEncoding, CipherGCMTypes, Encoding, RandomUUIDOptions } from 'crypto';
8
8
 
9
9
  // @ts-ignore
10
10
  import type { BytesOptions } from 'bytes';
11
11
 
12
- declare class AbortError extends Error {
13
- code: string;
14
- }
15
-
16
12
  declare namespace types {
17
13
  interface LOG_TYPE {
18
14
  UNKNOWN: 0;
@@ -266,10 +262,24 @@ declare namespace types {
266
262
 
267
263
  const IMPORT_MAP: StringMap;
268
264
 
265
+ interface CloneObjectOptions<T = unknown> {
266
+ target?: T;
267
+ deep?: boolean;
268
+ deepIgnore?: WeakSet<object>;
269
+ mergeArray?: MergeArrayMethod;
270
+ mergeDepth?: number;
271
+ typedArray?: boolean;
272
+ symbol?: boolean;
273
+ inherited?: boolean;
274
+ nonenumerable?: boolean;
275
+ preserve?: boolean;
276
+ }
277
+
278
+ type MergeArrayMethod = "concat" | "concat-pre" | "includes" | "unshift" | "push" | "flat" | "join" | "slice" | "reverse" | ["flat", number] | ["join", string] | ["slice", number, number?];
269
279
  type WatchEventValue = WATCH_EVENT[keyof WATCH_EVENT];
270
280
 
271
281
  function createAbortError(reject: true): Promise<never>;
272
- function createAbortError(): AbortError;
282
+ function createAbortError(): DOMException;
273
283
  function hasBit(value: unknown, flags: number): boolean;
274
284
  function ignoreFlag(value: unknown): boolean;
275
285
  function cloneFlag(value: unknown): boolean;
@@ -280,7 +290,7 @@ declare namespace types {
280
290
  function mainFlag(value: unknown): boolean;
281
291
  function existsFlag(value: unknown): boolean;
282
292
  function getLogCurrent(): Null<LogArguments>;
283
- function setLogCurrent(value: LogArguments): void;
293
+ function setLogCurrent(value: Null<LogArguments>): void;
284
294
  function setTempDir(value: string): boolean;
285
295
  function getTempDir(): string;
286
296
  function isArray<T>(value: unknown): value is T[];
@@ -289,11 +299,11 @@ declare namespace types {
289
299
  function isString(value: unknown): value is string;
290
300
  function isEmpty(value: unknown): boolean;
291
301
  function asFunction<U = unknown, V = unknown>(value: unknown, sync?: boolean): Null<FunctionType<U, V>>;
292
- function parseTime(value: NumString, start?: number): number;
293
- function parseExpires(value: NumString, start?: number): number;
302
+ function parseTime(value: number | string, start?: number): number;
303
+ function parseExpires(value: number | string, start?: number): number;
294
304
  function formatTime(value: number, char: string): string;
295
305
  function formatTime(value: number, elapsed?: boolean, char?: string): string;
296
- function convertTime(value: NumString): number;
306
+ function convertTime(value: number | string): number;
297
307
  function convertTime(value: HighResolutionTime, format: true): string;
298
308
  function convertTime(value: HighResolutionTime, format?: boolean): number;
299
309
  function hasGlob(value: string): boolean;
@@ -311,13 +321,17 @@ declare namespace types {
311
321
  function getEncoding(value: unknown, fallback?: BufferEncoding): BufferEncoding;
312
322
  function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
313
323
  function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
314
- /** @deprecated crypto.randomUUID */
315
- function generateUUID(): string;
324
+ function hashKey(data: BinaryLike, algorithm?: string, encoding?: BinaryToTextEncoding): string;
325
+ /** @deprecated - crypto.randomUUID */
326
+ function generateUUID(options?: RandomUUIDOptions): string;
316
327
  function incrementUUID(restart?: boolean): string;
317
328
  function validateUUID(value: unknown): boolean;
318
329
  function randomString(format: string, dictionary?: string): string;
319
330
  function errorValue(value: string, hint?: string): Error;
320
- function errorMessage(title: NumString, value: string, hint?: string): Error;
331
+ function errorMessage(title: number | string, value: string, hint?: string): Error;
332
+ function supported(major: number, minor: number, lts: boolean): boolean;
333
+ function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
334
+ function importESM<T = unknown>(name: string, isDefault?: boolean, fromPath?: boolean): Promise<T>;
321
335
  function purgeMemory(percent?: number): number;
322
336
  }
323
337
 
package/index.js CHANGED
@@ -91,6 +91,9 @@ function fromObject(value, typedArray) {
91
91
  if (value instanceof RegExp) {
92
92
  return new RegExp(value);
93
93
  }
94
+ if (value instanceof URL) {
95
+ return new URL(value);
96
+ }
94
97
  if (typedArray) {
95
98
  if (value instanceof Buffer) {
96
99
  return Buffer.from(value);
@@ -1076,10 +1079,12 @@ function errorValue(value, hint) {
1076
1079
  return new Error(value + (hint ? ` (${hint})` : ''));
1077
1080
  }
1078
1081
  function errorMessage(title, value, hint) {
1079
- return new Error((title !== '' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''));
1082
+ return new Error((isString(title) || typeof title === 'number' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''));
1080
1083
  }
1081
1084
  function purgeMemory(percent) {
1082
1085
  CACHE_COERCED = new WeakSet();
1086
+ INCREMENT_COUNT = 65536;
1087
+ LOG_CURRENT = null;
1083
1088
  }
1084
1089
  function incrementUUID(restart) {
1085
1090
  if (restart || INCREMENT_COUNT === 65536) {
@@ -1096,10 +1101,14 @@ function hashKey(data, algorithm = 'md5', encoding = 'base64') {
1096
1101
  return crypto.randomUUID();
1097
1102
  }
1098
1103
  }
1099
- function supported(major, minor = 0, patch = 0, lts) {
1104
+ function supported(major, minor = 0, patch = 0, lts = false) {
1100
1105
  if (VER_MAJOR < major) {
1101
1106
  return false;
1102
1107
  }
1108
+ if (typeof patch === 'boolean') {
1109
+ lts = patch;
1110
+ patch = 0;
1111
+ }
1103
1112
  if (VER_MAJOR === major) {
1104
1113
  if (VER_MINOR < minor) {
1105
1114
  return false;
package/lib/asset.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface BinaryAction {
15
15
  }
16
16
 
17
17
  export interface StreamAction {
18
- minStreamSize?: NumString;
18
+ minStreamSize?: number | string;
19
19
  }
20
20
 
21
21
  export interface FileData<T extends ExternalAsset> extends MimeTypeAction {
@@ -74,4 +74,4 @@ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, St
74
74
  invalid?: boolean;
75
75
  }
76
76
 
77
- export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512";
77
+ export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512" | "ripemd" | "ripemd-160";
package/lib/cloud.d.ts CHANGED
@@ -43,7 +43,7 @@ export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unk
43
43
  export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown, X = unknown, Y = unknown> extends Partial<LocationUri>, StreamAction {
44
44
  active?: boolean;
45
45
  overwrite?: boolean;
46
- chunkSize?: NumString;
46
+ chunkSize?: number | string;
47
47
  chunkLimit?: number;
48
48
  flags?: number;
49
49
  admin?: CloudStorageAdmin<T, U, V, W, X, Y>;
@@ -1,12 +1,13 @@
1
1
  import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IModule, ModuleConstructor, WatchConstructor } from './index';
2
2
 
3
+ import type { CloneObjectOptions } from '../index.d';
3
4
  import type { ExternalAsset } from './asset';
4
5
  import type { CacheOptions } from './core';
5
6
  import type { QueryResult } from './db';
6
7
  import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
7
8
  import type { IHttpMemoryCache } from './filemanager';
8
9
  import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
9
- import type { CloneObjectOptions, GetFunctionsOptions } from './module';
10
+ import type { ParseFunctionOptions } from './module';
10
11
  import type { LogFailOptions, LogType, LogValue } from './logger';
11
12
  import type { HostConfig, OpenOptions, ProxySettings } from './request';
12
13
  import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
@@ -17,6 +18,10 @@ import type { Readable, Writable } from 'stream';
17
18
 
18
19
  type CpuUsage = NodeJS.CpuUsage;
19
20
 
21
+ export interface GetFunctionsOptions extends ParseFunctionOptions {
22
+ outFailed?: string[];
23
+ }
24
+
20
25
  export interface IModuleLibV4 {
21
26
  isString(value: unknown): value is string;
22
27
  isObject<T = object>(value: unknown): value is T;
@@ -30,12 +35,12 @@ export interface IModuleLibV4 {
30
35
  isFileHTTP(value: string | URL): boolean;
31
36
  isFileUNC(value: string | URL): boolean;
32
37
  isPathUNC(value: string | URL): boolean;
33
- toTimeMs(hrtime: HighResolutionTime, format?: boolean): NumString;
38
+ toTimeMs(hrtime: HighResolutionTime, format?: boolean): number | string;
34
39
  renameExt(value: string, ext: string, when?: string): string;
35
40
  existsSafe(value: string, isFile?: boolean): boolean;
36
41
  readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<Bufferable>;
37
42
  getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
38
- formatSize(value: NumString, options?: PlainObject): NumString;
43
+ formatSize(value: number | string, options?: PlainObject): number | string;
39
44
  hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
40
45
  hasSize(value: string, keepEmpty?: boolean): boolean;
41
46
  getSize(value: string, diskUsed?: boolean): number;
@@ -62,7 +67,7 @@ export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> e
62
67
  httpProxy: Null<ProxySettings>;
63
68
  acceptEncoding: boolean;
64
69
  keepAliveTimeout: number;
65
- addDns(hostname: string, address: string, family?: NumString): void;
70
+ addDns(hostname: string, address: string, family?: number | string): void;
66
71
  lookupDns(hostname: string): LookupFunction;
67
72
  getHttpProxy(uri: string, localhost?: boolean): Null<ProxySettings>;
68
73
  getHttpHeaders(uri: string): Undef<OutgoingHttpHeaders>;
@@ -75,7 +80,7 @@ export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> e
75
80
  }
76
81
 
77
82
  export interface FileManagerCompatV4Constructor<T extends ExternalAsset = ExternalAsset> extends FileManagerConstructor<T> {
78
- fromHttpStatusCode(value: NumString): string;
83
+ fromHttpStatusCode(value: number | string): string;
79
84
  resetHttpHost(version?: HttpProtocolVersion): void;
80
85
  defineHttpBuffer(options: HttpMemorySettings): void;
81
86
  defineHttpSettings(options: HttpSettings): void;
@@ -105,7 +110,7 @@ export interface WatchCompatV4Constructor<T extends IFileManager<U>, U extends E
105
110
  readTLSKey(value: string, cache?: boolean): string;
106
111
  readTLSCert(value: string, cache?: boolean): string;
107
112
  isCert(value: string): boolean;
108
- parseExpires(value: NumString, start?: number): number;
113
+ parseExpires(value: number | string, start?: number): number;
109
114
  }
110
115
 
111
116
  export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransformSeries<T, U>, PropertyAction<OutV3, "out"> {}
package/lib/compress.d.ts CHANGED
@@ -1,25 +1,26 @@
1
- import type { CompressFormat as ICompressFormat } from './squared';
1
+ import type { CompressFormat as ICompressFormat, CompressLevel as ICompressLevel } from './squared';
2
2
 
3
3
  import type { LogBaseOptions, LogTime } from './logger';
4
+ import type { ThrowsAction } from './module';
4
5
 
5
6
  type ResultCallback<T = Null<Buffer | Uint8Array>> = (err: unknown, data?: T, ext?: string) => void;
6
7
  type ResultData = Null<Buffer | Uint8Array> | string;
7
8
 
8
- export interface CompressFormat extends ICompressFormat, LogBaseOptions {
9
+ export interface CompressFormat extends ICompressFormat, LogBaseOptions, ReadableOptions {
9
10
  filename?: string;
11
+ mimeType?: string;
10
12
  startTime?: LogTime;
11
13
  etag?: string;
12
- proxyUrl?: string | ((uri: string) => Undef<string>);
13
14
  outExt?: string;
14
15
  outFile?: string;
15
16
  }
16
17
 
17
- export interface Woff {
18
- toWoff(this: void, data: BufferLike): Buffer;
19
- toSfnt(this: void, data: BufferLike): Buffer;
20
- }
18
+ export interface CompressLevel extends ICompressLevel, ReadableOptions {}
19
+
20
+ export interface ReadableOptions extends ThrowsAction {}
21
21
 
22
22
  export type BufferLike = Buffer | Uint8Array | ArrayBuffer | SharedArrayBuffer | readonly number[];
23
23
  export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?: ResultCallback<ResultData>) => Void<Promise<ResultData>>;
24
24
  export type TryFileCompressorAsync = (data: string | Buffer, output: string, config: CompressFormat) => Promise<ResultData>;
25
- export type BufferResult = Null<Buffer | Uint8Array>;
25
+ export type BufferResult = Null<Buffer | Uint8Array>;
26
+ export type PluginCompressor = FunctionArgs<[CompressFormat['options'], string?], FunctionArgs<[Buffer], Promise<Buffer | Uint8Array>>>;
package/lib/core.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /* eslint @typescript-eslint/no-explicit-any: "off" */
2
-
3
1
  import type { DataSource, RequestBase } from './squared';
4
2
 
5
3
  import type { IExternalConfig, IExternalFunction, IHost, IModule, ModuleConstructor } from './index';
@@ -42,6 +40,7 @@ export interface IClientDb<T extends IHost, U extends ClientModule<ClientDbSetti
42
40
  getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean): Undef<QueryResult>;
43
41
  setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey?: string): QueryResult;
44
42
  setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
43
+ getCacheResult(source: string, credential: unknown, queryString: string, cacheValue: CacheOptions, ignoreCache?: IntBool | FirstOf<number, number>): Undef<QueryResult>;
45
44
  applyState(items: ArrayOf<V>, value: number, as?: boolean): void;
46
45
  commit(items?: V[]): Promise<boolean>;
47
46
  valueOfKey(credential: unknown, name: keyof W, component?: keyof X): unknown;
@@ -62,8 +61,8 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
62
61
  readonly TRANSACTION_ABORT: number;
63
62
  readonly TRANSACTION_FAIL: number;
64
63
  loadSettings(settings: Pick<Settings, "process" | "memory">, password?: string): boolean;
65
- getTimeout(value: Undef<NumString | TimeoutAction>): number;
66
- convertTime(value: NumString): number;
64
+ getTimeout(value: Undef<number | string | TimeoutAction>): number;
65
+ convertTime(value: number | string): number;
67
66
  findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): Undef<QueryResult>;
68
67
  storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
69
68
  storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, sessionKey: string, sessionExpires: number): QueryResult;
@@ -131,16 +130,17 @@ export interface PermissionAction {
131
130
  permission?: PermittedDirectories;
132
131
  }
133
132
 
134
- export interface HostInitConfig extends PlainObject, RequestBase<HostInitLog> {
133
+ export interface HostInitConfig<T extends HostInitLog = HostInitLog> extends PlainObject, RequestBase<T> {
135
134
  username?: string;
136
135
  ignoreModules?: string[];
137
136
  }
138
137
 
139
138
  export interface HostInitLog {
140
139
  enabled?: boolean;
141
- level?: NumString;
140
+ level?: number | string;
142
141
  exclude?: ArrayOf<string>;
143
142
  useColor?: boolean;
143
+ silent?: boolean;
144
144
  showProgress?: boolean;
145
145
  }
146
146
 
@@ -158,7 +158,7 @@ export interface StoreResultOptions {
158
158
  export interface CacheOptions {
159
159
  value?: DbCacheValue;
160
160
  renewCache?: boolean;
161
- exclusiveOf?: [number, number?, number?];
161
+ exclusiveOf?: FirstOf<number, number>;
162
162
  sessionKey?: string;
163
163
  }
164
164
 
package/lib/db.d.ts CHANGED
@@ -32,14 +32,12 @@ export interface ProcessRowsOptions {
32
32
  parallel?: boolean;
33
33
  }
34
34
 
35
- export interface DbConnection {
35
+ export interface DbConnection extends Required<AuthValue> {
36
+ protocol: string;
36
37
  hostname: string;
37
- password: string;
38
- pathname: string;
39
38
  port: string;
40
- protocol: string;
39
+ pathname: string;
41
40
  search: string;
42
- username: string;
43
41
  database: string;
44
42
  }
45
43
 
@@ -56,7 +54,7 @@ export interface ServerAuth<T = number> extends AuthValue, IdentifierAction {
56
54
  database?: string;
57
55
  }
58
56
 
59
- export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
57
+ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
60
58
  client: U;
61
59
  lastAccessed: number;
62
60
  success: number;
@@ -65,7 +63,7 @@ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V =
65
63
  uuidKey: Null<AuthValue>;
66
64
  add(item: T, uuidKey?: string): this;
67
65
  has(item: T): boolean;
68
- getConnection(): Promise<V>;
66
+ getConnection(credential?: W): Promise<V>;
69
67
  remove(): void;
70
68
  detach(force?: boolean): Promise<void>;
71
69
  close(): Promise<void>;
@@ -78,16 +76,20 @@ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V =
78
76
  set parent(value: ObjectMap<IDbPool<T>>);
79
77
  }
80
78
 
81
- export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
82
- findKey<W extends IDbPool, X extends DbDataSource>(pools: ObjectMap<W>, uuidKey: unknown, poolKey: Undef<string>, ...items: X[]): Null<W>;
83
- validateKey<W extends IDbPool>(pools: ObjectMap<W>, username: string, uuidKey: unknown): [string, Null<W>];
84
- checkTimeout<W extends IDbPool>(pools: ObjectMap<W>, value: number, limit?: number): Promise<number>;
85
- readonly prototype: IDbPool<T, U, V>;
86
- new(pool: U, poolKey: string, uuidKey?: Null<AuthValue>): IDbPool<T, U, V>;
79
+ export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
80
+ CACHE_UNUSED: readonly string[];
81
+ asString(credential: unknown): string;
82
+ sanitize(credential: unknown): unknown;
83
+ removeUUIDKey<X>(credential: X & IdentifierAction): X;
84
+ findKey<X extends IDbPool, Y extends DbDataSource>(pools: ObjectMap<X>, uuidKey: unknown, poolKey: Undef<string>, ...items: Y[]): Null<X>;
85
+ validateKey<X extends IDbPool>(pools: ObjectMap<X>, username: string, uuidKey: unknown): [string, Null<X>];
86
+ checkTimeout<X extends IDbPool>(pools: ObjectMap<X>, value: number, limit?: number): Promise<number>;
87
+ readonly prototype: IDbPool<T, U, V, W>;
88
+ new(pool: U, poolKey: string, uuidKey?: Null<AuthValue>): IDbPool<T, U, V, W>;
87
89
  }
88
90
 
89
91
  export interface TimeoutAction {
90
- timeout?: NumString;
92
+ timeout?: number | string;
91
93
  }
92
94
 
93
95
  export type DbSource = "mariadb" | "mongodb" | "mssql" | "mysql" | "oracle" | "postgres" | "redis";
package/lib/document.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { LogComponent, LogDate } from './logger';
7
7
  import type { DocumentTransform } from './settings';
8
8
 
9
9
  export interface DocumentAsset extends ExternalAsset, StorageAction<CloudStorage> {
10
+ inlineFilename?: string;
10
11
  initialValue?: InitialValue & { inlineFilename?: string };
11
12
  }
12
13
 
@@ -15,7 +16,7 @@ export interface StartOfSourceMap {
15
16
  sourceRoot?: string;
16
17
  }
17
18
 
18
- export interface RawSourceMap<T = NumString> extends StartOfSourceMap {
19
+ export interface RawSourceMap<T = number | string> extends StartOfSourceMap {
19
20
  version: T;
20
21
  sources: string[];
21
22
  names: string[];
@@ -88,7 +89,8 @@ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, Transfo
88
89
  getMainFile(code?: string, imports?: StringMap): Undef<SourceInput<string>>;
89
90
  getSourceFiles(imports?: StringMap): Undef<SourceInput>;
90
91
  toBaseConfig(all?: boolean): T;
91
- upgrade<V = unknown>(context: V, dirname?: string, name?: string): V;
92
+ upgrade<V = unknown>(context: V, dirname?: string, pkgname?: string): V;
93
+ upgradeESM<V = unknown>(context: V, dirname?: string, pkgname?: string): Promise<V>;
92
94
  set code(value);
93
95
  get code(): string;
94
96
  get out(): IOut;
@@ -174,8 +176,8 @@ export interface LintMessage {
174
176
  export interface GenerateLintTableOptions extends Partial<LocationUri> {
175
177
  leadingText?: string;
176
178
  trailingText?: string;
177
- errorCount?: number;
178
- warningCount?: number;
179
+ errorCount?: number | TupleOf<number>;
180
+ warningCount?: number | TupleOf<number>;
179
181
  fatalErrorCount?: number;
180
182
  timeStamp?: LogDate;
181
183
  ruleWidth?: number;
@@ -10,13 +10,13 @@ import type { RequestInit } from './request';
10
10
  import type { FETCH_TYPE } from '../index.d';
11
11
 
12
12
  export const enum FINALIZE_STATE {
13
- READY = 0,
14
- COMMIT = 1,
15
- END = 2,
16
- RESTART = 3,
17
- QUEUED = 4,
18
- RESTARTED = 5,
19
- ABORTED = 6
13
+ READY,
14
+ COMMIT,
15
+ END,
16
+ RESTART,
17
+ QUEUED,
18
+ RESTARTED,
19
+ ABORTED
20
20
  }
21
21
 
22
22
  export const enum INCREMENTAL {
@@ -26,8 +26,8 @@ export const enum INCREMENTAL {
26
26
  EXISTS = 'exists'
27
27
  }
28
28
 
29
- export interface RequestData<T extends ExternalAsset = ExternalAsset> extends IRequestData<T>, RequestInit {
30
- timeout?: ObjectMap<NumString>;
29
+ export interface RequestData<T extends ExternalAsset = ExternalAsset, U extends HostInitLog = HostInitLog> extends IRequestData<T, U>, RequestInit {
30
+ timeout?: ObjectMap<number | string>;
31
31
  }
32
32
 
33
33
  export interface InstallData<T extends IModule = IModule, U extends ModuleConstructor = ModuleConstructor> {
@@ -99,6 +99,7 @@ export interface DeleteFileAddendum {
99
99
  export interface HostInitLog extends IHostInitLog {
100
100
  useNumeric: boolean;
101
101
  showSize?: boolean;
102
+ showDiff?: string[];
102
103
  }
103
104
 
104
105
  export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
package/lib/http.d.ts CHANGED
@@ -93,10 +93,11 @@ export interface SecureConfig<T = string, U = T> {
93
93
  key?: U;
94
94
  cert?: T;
95
95
  passphrase?: U;
96
+ ciphers?: string;
96
97
  version?: SecureVersion;
97
98
  }
98
99
 
99
- export interface ServerPort<T = NumString> {
100
+ export interface ServerPort<T = number | string> {
100
101
  port?: T;
101
102
  }
102
103