@e-mc/types 0.8.4 → 0.8.5

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,7 @@
1
- Copyright 2023 An Pham
1
+ Copyright 2024 Mile Square Park
2
2
 
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
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
- 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.
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,198 +1,7 @@
1
1
  # @e-mc/types
2
2
 
3
- * NodeJS 14
4
- * ES2020
5
-
6
- ## General Usage
7
-
8
- * [Read the Docs](https://e-mc.readthedocs.io)
9
-
10
- ## Interface
11
-
12
- - https://www.unpkg.com/@e-mc/types@0.8.4/index.d.ts
13
-
14
- ```typescript
15
- import type { LogArguments } from "./lib/logger";
16
- import type { CloneObjectOptions } from "./lib/module";
17
-
18
- import type { BinaryLike, CipherGCMTypes, Encoding } from "crypto";
19
-
20
- import type { BytesOptions } from "bytes";
21
-
22
- function createAbortError(): Error;
23
- function hasBit(value: unknown, flags: number): boolean;
24
- function ignoreFlag(value: unknown): boolean;
25
- function cloneFlag(value: unknown): boolean;
26
- function usingFlag(value: unknown): boolean;
27
- function watchFlag(value: unknown): boolean;
28
- function modifiedFlag(value: unknown): boolean;
29
- function processFlag(value: unknown): boolean;
30
- function mainFlag(value: unknown): boolean;
31
- function existsFlag(value: unknown): boolean;
32
- function getLogCurrent(): LogArguments | null;
33
- function setLogCurrent(value: LogArguments): void;
34
- function setTempDir(value: string): boolean;
35
- function getTempDir(): string;
36
- function isArray(value: unknown): value is unknown[];
37
- function isObject(value: unknown): value is object;
38
- function isPlainObject(value: unknown): value is Record<string | number | symbol, unknown>;
39
- function isString(value: unknown): value is string;
40
- function isEmpty(value: unknown): boolean;
41
- function asFunction(value: unknown, sync?: boolean): ((...args: unknown[]) => Promise<unknown> | unknown) | null;
42
- function parseTime(value: number | string, start?: number): number;
43
- function parseExpires(value: number | string, start?: number): number;
44
- function formatTime(value: number, char: string): string;
45
- function formatTime(value: number, elapsed?: boolean, char?: string): string;
46
- function convertTime(value: number | string): number;
47
- function convertTime(value: HighResolutionTime, format: true): string;
48
- function convertTime(value: HighResolutionTime, format?: boolean): number;
49
- function hasGlob(value: string): boolean;
50
- function escapePattern(value: unknown, lookBehind?: boolean): string;
51
- function renameExt(value: string, ext: string, when?: string): string;
52
- function formatSize(value: string): number;
53
- function formatSize(value: number, options?: BytesOptions): string;
54
- function alignSize(value: unknown, kb?: number, factor?: number): number;
55
- function cascadeObject(data: object, query: string, fallback?: unknown): unknown;
56
- function cloneObject(data: unknown, deep: boolean): unknown;
57
- function cloneObject(data: unknown, deepIgnore: WeakSet<object>): unknown;
58
- function cloneObject(data: unknown, options?: CloneObjectOptions<unknown>): unknown;
59
- function coerceObject(data: unknown, cache: boolean): unknown;
60
- function coerceObject(data: unknown, parseString?: (...args: [string]) => unknown, cache?: boolean): unknown;
61
- function getEncoding(value: unknown, fallback?: BufferEncoding): BufferEncoding;
62
- function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
63
- function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
64
- function generateUUID(): string;
65
- function incrementUUID(restart?: boolean): string;
66
- function validateUUID(value: unknown): boolean;
67
- function randomString(format: string, dictionary?: string): string;
68
- function errorValue(value: string, hint?: string): Error;
69
- function errorMessage(title: number | string, value: string, hint?: string): Error;
70
- function purgeMemory(percent?: number): number;
71
-
72
- interface LOG_TYPE {
73
- UNKNOWN: 0;
74
- SYSTEM: 1;
75
- NODE: 2;
76
- PROCESS: 4;
77
- COMPRESS: 8;
78
- WATCH: 16;
79
- FILE: 32;
80
- CLOUD: 64;
81
- TIME_ELAPSED: 128;
82
- TIME_PROCESS: 256;
83
- FAIL: 512;
84
- HTTP: 1024;
85
- IMAGE: 2048;
86
- EXEC: 4096;
87
- PERMISSION: 8192;
88
- TIMEOUT: 16384;
89
- STDOUT: 32768;
90
- DB: 65536;
91
- }
92
-
93
- interface STATUS_TYPE {
94
- UNKNOWN: 0;
95
- FATAL: 1;
96
- ERROR: 2;
97
- WARN: 3;
98
- INFO: 4;
99
- DEBUG: 5;
100
- ASSERT: 6;
101
- TRACE: 7;
102
- }
103
-
104
- interface ASSET_FLAG {
105
- NONE: 0;
106
- IGNORE: 1;
107
- CLONE: 2;
108
- USING: 4;
109
- WATCH: 8;
110
- MODIFIED: 16;
111
- PROCESS: 32;
112
- MAIN: 64;
113
- EXISTS: 128;
114
- }
115
-
116
- interface FILE_TYPE {
117
- UNKNOWN: 0;
118
- ASSET: 1;
119
- TRANSFORM: 2;
120
- COMPRESSED: 4;
121
- SOURCEMAP: 8;
122
- TORRENT: 16;
123
- }
124
-
125
- interface ACTION_FLAG {
126
- NONE: 0;
127
- IGNORE: 1;
128
- }
129
-
130
- interface ERR_CODE {
131
- MODULE_NOT_FOUND: "MODULE_NOT_FOUND";
132
- }
133
-
134
- interface DOWNLOAD_TYPE {
135
- HTTP: 0;
136
- DISK: 1;
137
- CACHE: 2;
138
- }
139
-
140
- interface FETCH_TYPE {
141
- UNKNOWN: 0;
142
- HTTP: 1;
143
- TORRENT: 2;
144
- FTP: 3;
145
- UNIX_SOCKET: 4;
146
- }
147
-
148
- interface DB_TYPE {
149
- SQL: 1;
150
- NOSQL: 2;
151
- DOCUMENT: 4;
152
- KEYVALUE: 8;
153
- }
154
-
155
- interface DB_TRANSACTION {
156
- ACTIVE: 1;
157
- PARTIAL: 2;
158
- COMMIT: 4;
159
- TERMINATE: 8;
160
- ABORT: 16;
161
- FAIL: 32;
162
- AUTH: 64;
163
- CACHE: 128;
164
- }
165
-
166
- interface WATCH_EVENT {
167
- MODIFIED: "modified";
168
- BROADCAST: "broadcast";
169
- CLOSE: "close";
170
- ERROR: "error";
171
- }
172
-
173
- interface READDIR_SORT {
174
- FILE: number;
175
- DIRECTORY: number;
176
- DESCENDING: number;
177
- }
178
-
179
- interface THRESHOLD {
180
- FILEMANAGER_INTERVAL: number;
181
- WATCH_INTERVAL: number;
182
- WATCH_CHANGE: number;
183
- }
184
-
185
- const IMPORT_MAP: Record<string, string | undefined>;
186
- ```
187
-
188
- ## References
189
-
190
- - https://www.unpkg.com/@e-mc/types@0.8.4/lib/logger.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.8.4/lib/module.d.ts
192
-
193
- * https://nodejs.org/api/perf_hooks.html
194
- * https://www.npmjs.com/package/@types/bytes
3
+ PEP 402
195
4
 
196
5
  ## LICENSE
197
6
 
198
- BSD 3-Clause
7
+ MIT
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.8.4',
2
+ VERSION = '0.8.5',
3
3
  TEMP_DIR = 'tmp', // eslint-disable-line @typescript-eslint/no-shadow
4
4
  CJS = '__cjs__'
5
5
  }
@@ -187,11 +187,13 @@ export const enum TIME {
187
187
 
188
188
  export const enum PACKAGE_NAME {
189
189
  CLOUD = '@e-mc/cloud',
190
+ CLOUD_UTIL = '@e-mc/cloud/util',
190
191
  COMPAT_V4 = '@e-mc/compat-v4',
191
192
  COMPRESS = '@e-mc/compress',
192
193
  CORE = '@e-mc/core',
193
194
  DB = '@e-mc/db',
194
195
  DB_POOL = '@e-mc/db/pool',
196
+ DB_UTIL = '@e-mc/db/util',
195
197
  DOCUMENT = '@e-mc/document',
196
198
  DOCUMENT_ANDROID = '@pi-r/android',
197
199
  DOCUMENT_CHROME = '@pi-r/chrome',
@@ -204,6 +206,7 @@ export const enum PACKAGE_NAME {
204
206
  MODULE_LIB_V4 = '@e-mc/module/lib-v4',
205
207
  REQUEST = '@e-mc/request',
206
208
  REQUEST_HTTP_HOST = '@e-mc/request/http/host',
209
+ REQUEST_UTIL = '@e-mc/request/util',
207
210
  TASK = '@e-mc/task',
208
211
  TASK_GULP = '@pi-r/gulp',
209
212
  TYPES = '@e-mc/types',
package/lib/index.d.ts CHANGED
@@ -265,7 +265,7 @@ declare namespace functions {
265
265
 
266
266
  interface IWatch<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends IClient<T, V, W> {
267
267
  connectTimeout: number;
268
- start(assets: U[], permission?: IPermission): void;
268
+ start(assets: U[], permission?: Null<IPermission>): void;
269
269
  modified(watch: IFileGroup<U>): Promise<Void<FinalizeResult>>;
270
270
  configureServer(options: SecureOptions): boolean;
271
271
  setCA(value: string): boolean;
@@ -310,9 +310,9 @@ declare namespace functions {
310
310
  lookupDns(hostname: string): LookupFunction;
311
311
  proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
312
312
  statusOn(name: ArrayOf<number>, callback: StatusOnCallback): void;
313
- statusOn(name: ArrayOf<number>, patternUrl: string, callback: StatusOnCallback): void;
313
+ statusOn(name: ArrayOf<number>, globUrl: string, callback: StatusOnCallback): void;
314
314
  headersOn(name: StringOfArray, callback: HeadersOnCallback): void;
315
- headersOn(name: StringOfArray, patternUrl: string, callback: HeadersOnCallback): void;
315
+ headersOn(name: StringOfArray, globUrl: string, callback: HeadersOnCallback): void;
316
316
  headersOf(uri: string): Undef<OutgoingHttpHeaders>;
317
317
  aria2c(uri: string | URL, pathname: string): Promise<string[]>;
318
318
  aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
package/lib/request.d.ts CHANGED
@@ -65,7 +65,6 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
65
65
  postData?: unknown;
66
66
  connected?: (headers: IncomingHttpHeaders) => Void<boolean>;
67
67
  statusMessage?: string;
68
- silent?: boolean;
69
68
  outFormat?: { out: BufferFormat; parser?: PlainObject };
70
69
  outFilename?: Null<string>;
71
70
  outHeaders?: Null<IncomingHttpHeaders>;
@@ -105,7 +104,9 @@ export interface ProxySettings extends KeepAliveAction {
105
104
 
106
105
  export interface RequestInit extends ProtocolAction {
107
106
  headers?: unknown;
107
+ /* @deprecated - readTimeout */
108
108
  requestTimeout?: number;
109
+ readTimeout?: number;
109
110
  }
110
111
 
111
112
  export interface ClientConfig {
package/lib/settings.d.ts CHANGED
@@ -84,8 +84,8 @@ export interface PermissionModule<T = PermissionSettings> extends PermittedDirec
84
84
  }
85
85
 
86
86
  export interface PermissionSettings extends PlainObject {
87
- picomatch?: PicomatchOptions;
88
- minimatch?: MinimatchOptions;
87
+ picomatch?: Null<PicomatchOptions>;
88
+ minimatch?: Null<MinimatchOptions>;
89
89
  }
90
90
 
91
91
  export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "squared-functions"
18
18
  ],
19
19
  "author": "An Pham <anpham6@gmail.com>",
20
- "license": "BSD 3-Clause",
20
+ "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
23
  "bytes": "^3.1.2",