@e-mc/types 0.13.9 → 0.14.0

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 LTS
3
+ * NodeJS 20 (Minimum 18)
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.9/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.14.0/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -31,7 +31,7 @@ function mainFlag(value: unknown): boolean;
31
31
  function existsFlag(value: unknown): boolean;
32
32
  function getLogCurrent(): LogArguments | null;
33
33
  function setLogCurrent(value: LogArguments): void;
34
- function setTempDir(value: string): boolean;
34
+ function setTempDir(value: string, lock?: boolean): boolean;
35
35
  function getTempDir(create: true, prefix?: string): string;
36
36
  function getTempDir(...values: string[]): string;
37
37
  function isArray(value: unknown): value is unknown[];
@@ -39,9 +39,12 @@ function isObject(value: unknown): value is object;
39
39
  function isPlainObject(value: unknown): value is Record<string | number | symbol, unknown>;
40
40
  function isString(value: unknown): value is string;
41
41
  function isEmpty(value: unknown): boolean;
42
- function isFunction(value: unknown, cjs?: boolean): value is Function;
42
+ function isFunction(value: unknown, cjs: boolean): value is Function;
43
+ function isFunction(value: unknown, type?: string): value is Function;
44
+ function isError(err: unknown, ...name: string[]): err is Error;
43
45
  function isErrorCode(err: unknown, ...code: unknown[]): err is Required<ErrorCode>;
44
46
  function asFunction(value: unknown, sync?: boolean): ((...args: unknown[]) => unknown) | null;
47
+ function asExt(value: string): string;
45
48
  function parseTime(value: number | string, epoch: true): number;
46
49
  function parseTime(value: number | string, negative: false): number;
47
50
  function parseTime(value: number | string, start?: number): number;
@@ -53,6 +56,7 @@ function convertTime(value: number | string): number;
53
56
  function convertTime(value: HighResolutionTime, format: true): string;
54
57
  function convertTime(value: HighResolutionTime, format?: boolean): number;
55
58
  function hasGlob(value: string): boolean;
59
+ /** @deprecated RegExp.escape */
56
60
  function escapePattern(value: unknown, symbols?: boolean): string;
57
61
  function renameExt(value: string, ext: string, when?: string): string;
58
62
  function formatSize(value: string): number;
@@ -60,8 +64,7 @@ function formatSize(value: number, options?: BytesOptions): string;
60
64
  function alignSize(value: unknown, kb?: number, factor?: number): number;
61
65
  function cascadeObject(data: object, query: string, fallback?: unknown): unknown;
62
66
  function cloneObject(data: unknown, deep: boolean): unknown;
63
- /** @deprecated WeakMap<object> */
64
- function cloneObject<T>(data: T, deepIgnore: WeakSet<object> | WeakMap<object, object>): T;
67
+ function cloneObject<T>(data: T, deepIgnore: WeakMap<object, object>): T;
65
68
  function cloneObject(data: unknown, options?: CloneObjectOptions<unknown>): unknown;
66
69
  function coerceObject(data: unknown, cache: boolean): unknown;
67
70
  function coerceObject(data: unknown, parseString?: (...args: [string]) => unknown, cache?: boolean): unknown;
@@ -74,6 +77,7 @@ function validateUUID(value: unknown): boolean;
74
77
  function sanitizeCmd(value: string, ...args: unknown[]): string;
75
78
  function sanitizeArgs(value: string, doubleQuote?: boolean): string;
76
79
  function sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
80
+ /** @deprecated crypto.randomUUID */
77
81
  function randomString(format: string, dictionary?: string): string;
78
82
  function errorValue(value: string, hint?: string): Error;
79
83
  function errorMessage(title: number | string, value: string, hint?: string): Error;
@@ -209,14 +213,15 @@ const IMPORT_MAP: Record<string, string | undefined>;
209
213
 
210
214
  ## References
211
215
 
212
- - https://www.unpkg.com/@e-mc/types@0.13.9/index.d.ts
213
- - https://www.unpkg.com/@e-mc/types@0.13.9/lib/logger.d.ts
214
- - https://www.unpkg.com/@e-mc/types@0.13.9/lib/module.d.ts
215
- - https://www.unpkg.com/@e-mc/types@0.13.9/lib/node.d.ts
216
+ - https://www.unpkg.com/@e-mc/types@0.14.0/index.d.ts
217
+ - https://www.unpkg.com/@e-mc/types@0.14.0/lib/logger.d.ts
218
+ - https://www.unpkg.com/@e-mc/types@0.14.0/lib/node.d.ts
216
219
 
217
- * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
220
+ * https://www.npmjs.com/package/@types/node
218
221
  * https://www.npmjs.com/package/@types/bytes
219
222
 
223
+ * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
224
+
220
225
  ## LICENSE
221
226
 
222
227
  BSD 3-Clause
package/constant.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.13.9',
2
+ VERSION = '0.14.0',
3
3
  TEMP_DIR = 'tmp',
4
- CJS = '__cjs__'
4
+ CJS = '__cjs__',
5
+ FUNCTION_TYPE = '__type__'
5
6
  }
6
7
 
7
8
  export const enum VAL_MESSAGE {
@@ -80,6 +81,7 @@ export const enum ERR_MESSAGE {
80
81
  UNSUPPORTED_WRITE = 'Not permitted to write file',
81
82
  UNSUPPORTED_OVERWRITE = 'Not permitted to overwrite file',
82
83
  UNSUPPORTED_PATH = 'Not permitted to set absolute path',
84
+ UNSUPPORTED_PROCESS = 'Not implemented by runtime application',
83
85
  NOTFOUND_PATH = 'Path not found',
84
86
  NOTFOUND_FILE = 'File not found',
85
87
  NOTFOUND_BINARY = 'Binary not found',
@@ -296,7 +298,8 @@ export const enum LOG_TYPE {
296
298
  PERMISSION = 8192,
297
299
  TIMEOUT = 16384,
298
300
  STDOUT = 32768,
299
- DB = 65536
301
+ DB = 65536,
302
+ USER = 131072
300
303
  }
301
304
 
302
305
  export const enum LOG_STATE {
package/index.d.ts CHANGED
@@ -29,6 +29,7 @@ declare namespace types {
29
29
  TIMEOUT: 16384;
30
30
  STDOUT: 32768;
31
31
  DB: 65536;
32
+ USER: 131072;
32
33
  }
33
34
 
34
35
  const LOG_TYPE: {
@@ -50,6 +51,7 @@ declare namespace types {
50
51
  TIMEOUT: 16384;
51
52
  STDOUT: 32768;
52
53
  DB: 65536;
54
+ USER: 131072;
53
55
  };
54
56
 
55
57
  interface LOG_STATE {
@@ -269,8 +271,7 @@ declare namespace types {
269
271
  interface CloneObjectOptions<T = unknown> {
270
272
  target?: T;
271
273
  deep?: boolean;
272
- /** @deprecated WeakSet<object> */
273
- deepIgnore?: WeakSet<object> | WeakMap<object, object>;
274
+ deepIgnore?: WeakMap<object, object>;
274
275
  freezeDepth?: number | boolean;
275
276
  mergeArray?: MergeArrayMethod;
276
277
  mergeDepth?: number;
@@ -300,7 +301,7 @@ declare namespace types {
300
301
  function existsFlag(value: unknown): boolean;
301
302
  function getLogCurrent(): LogArguments | null;
302
303
  function setLogCurrent(value: LogArguments | null): void;
303
- function setTempDir(value: string): boolean;
304
+ function setTempDir(value: string, lock?: boolean): boolean;
304
305
  function getTempDir(create: true, prefix?: string): string;
305
306
  function getTempDir(...values: string[]): string;
306
307
  function isArray<T>(value: unknown): value is T[];
@@ -308,9 +309,12 @@ declare namespace types {
308
309
  function isPlainObject<T = PlainObject>(value: unknown): value is T;
309
310
  function isString<T extends string>(value: unknown): value is T;
310
311
  function isEmpty(value: unknown): boolean;
311
- function isFunction<T extends Function>(value: unknown, cjs?: boolean): value is T;
312
+ function isFunction<T extends Function>(value: unknown, cjs: boolean): value is T;
313
+ function isFunction<T extends Function>(value: unknown, type?: string): value is T;
314
+ function isError<T extends Error>(err: unknown, ...name: string[]): err is T;
312
315
  function isErrorCode<T extends unknown[]>(err: unknown, ...code: T): err is Required<ErrorCode<T[number]>>;
313
316
  function asFunction<U = unknown, V = unknown>(value: unknown, sync?: boolean): FunctionType<U, V> | null;
317
+ function asExt(value: string): string;
314
318
  function parseTime(value: number | string, epoch: true): number;
315
319
  function parseTime(value: number | string, negative: false): number;
316
320
  function parseTime(value: number | string, start?: number): number;
@@ -322,6 +326,7 @@ declare namespace types {
322
326
  function convertTime(value: HighResolutionTime, format: true): string;
323
327
  function convertTime(value: HighResolutionTime, format?: boolean): number;
324
328
  function hasGlob(value: string): boolean;
329
+ /** @deprecated RegExp.escape */
325
330
  function escapePattern(value: unknown, symbols?: boolean): string;
326
331
  function renameExt(value: string, ext: string, when?: string): string;
327
332
  function formatSize(value: string): number;
@@ -329,17 +334,18 @@ declare namespace types {
329
334
  function alignSize(value: unknown, kb?: number, factor?: number): number;
330
335
  function cascadeObject<T = unknown>(data: object, query: string, fallback?: unknown): T;
331
336
  function cloneObject<T>(data: T, deep: boolean): T;
332
- /** @deprecated WeakMap<object> */
333
- function cloneObject<T>(data: T, deepIgnore: WeakSet<object> | WeakMap<object, object>): T;
337
+ function cloneObject<T>(data: T, deepIgnore: WeakMap<object, object>): T;
334
338
  function cloneObject<T, U>(data: T, options?: CloneObjectOptions<U>): T;
335
339
  function coerceObject<T = unknown>(data: T, cache: boolean): T;
336
340
  function coerceObject<T = unknown>(data: T, parseString?: FunctionArgs<[string]>, cache?: boolean): T;
337
341
  function getEncoding(value: unknown, fallback?: BufferEncoding): BufferEncoding;
342
+ function getAlgorithm(value: unknown, fallback?: string): string | undefined;
338
343
  function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
339
344
  function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
340
345
  function hashKey(data: BinaryLike, algorithm?: string, encoding?: BinaryToTextEncoding): string;
341
346
  function incrementUUID(restart?: boolean): string;
342
347
  function validateUUID(value: unknown): boolean;
348
+ /** @deprecated crypto.randomUUID */
343
349
  function randomString(format: string, dictionary?: string): string;
344
350
  function sanitizeCmd(value: string, ...args: unknown[]): string;
345
351
  function sanitizeArgs(value: string, doubleQuote?: boolean): string;