vortez 5.0.0-dev.19 → 5.0.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/.gitignore +2 -0
- package/README.md +26 -9
- package/build/Template/Compiler.d.ts +70 -0
- package/build/Template/Compiler.js +135 -0
- package/build/Template/Compiler.js.map +1 -0
- package/build/Template/StreamCompiler.d.ts +16 -0
- package/build/Template/StreamCompiler.js +54 -0
- package/build/Template/StreamCompiler.js.map +1 -0
- package/build/Template/Template.d.ts +49 -0
- package/build/Template/Template.js +77 -0
- package/build/Template/Template.js.map +1 -0
- package/build/Vortez.d.ts +1 -1
- package/build/Vortez.js +1 -1
- package/build/Vortez.js.map +1 -1
- package/build/beta/JwtManager/JwtError.d.ts +8 -0
- package/build/beta/JwtManager/JwtError.js +10 -0
- package/build/beta/JwtManager/JwtError.js.map +1 -0
- package/build/beta/JwtManager/JwtManager.d.ts +3 -0
- package/build/beta/JwtManager/JwtManager.js +24 -7
- package/build/beta/JwtManager/JwtManager.js.map +1 -1
- package/build/server/BodyParser.d.ts +6 -0
- package/build/server/BodyParser.js +18 -3
- package/build/server/BodyParser.js.map +1 -1
- package/build/server/Request.d.ts +6 -4
- package/build/server/Request.js +15 -10
- package/build/server/Request.js.map +1 -1
- package/build/server/Response.d.ts +24 -9
- package/build/server/Response.js +160 -74
- package/build/server/Response.js.map +1 -1
- package/build/server/Server.js +29 -6
- package/build/server/Server.js.map +1 -1
- package/build/server/config/Config.d.ts +15 -13
- package/build/server/config/Config.js +8 -6
- package/build/server/config/Config.js.map +1 -1
- package/build/server/config/Loader.js +1 -1
- package/build/server/config/Loader.js.map +1 -1
- package/build/server/router/Router.d.ts +1 -1
- package/build/server/router/Router.js +3 -3
- package/build/server/router/Router.js.map +1 -1
- package/build/server/router/middleware/HttpMiddleware.js +1 -1
- package/build/server/router/middleware/HttpMiddleware.js.map +1 -1
- package/build/server/router/middleware/WsMiddleware.js +1 -1
- package/build/server/router/middleware/WsMiddleware.js.map +1 -1
- package/build/server/security/PathSecurity.d.ts +45 -0
- package/build/server/security/PathSecurity.js +108 -0
- package/build/server/security/PathSecurity.js.map +1 -0
- package/build/server/websocket/Websocket.js +4 -1
- package/build/server/websocket/Websocket.js.map +1 -1
- package/build/utilities/ConsoleUI.d.ts +2 -1
- package/build/utilities/ConsoleUI.js +2 -1
- package/build/utilities/ConsoleUI.js.map +1 -1
- package/build/utilities/DebugUI.d.ts +1 -1
- package/build/utilities/DebugUI.js +1 -1
- package/build/utilities/Encoding.d.ts +22 -0
- package/build/utilities/Encoding.js +26 -0
- package/build/utilities/Encoding.js.map +1 -0
- package/build/utilities/Env.js +7 -2
- package/build/utilities/Env.js.map +1 -1
- package/build/utilities/File.d.ts +10 -0
- package/build/utilities/File.js +19 -0
- package/build/utilities/File.js.map +1 -0
- package/build/utilities/Flatten.d.ts +18 -1
- package/build/utilities/Flatten.js +18 -1
- package/build/utilities/Flatten.js.map +1 -1
- package/build/utilities/Object.d.ts +16 -0
- package/build/utilities/Object.js +48 -0
- package/build/utilities/Object.js.map +1 -0
- package/build/utilities/Path.d.ts +31 -11
- package/build/utilities/Path.js +48 -15
- package/build/utilities/Path.js.map +1 -1
- package/build/utilities/Time.d.ts +21 -0
- package/build/utilities/Time.js +25 -0
- package/build/utilities/Time.js.map +1 -0
- package/build/utilities/Utilities.d.ts +43 -34
- package/build/utilities/Utilities.js +48 -38
- package/build/utilities/Utilities.js.map +1 -1
- package/changes.md +4 -0
- package/docs/ARCHITECTURE.md +142 -0
- package/global/style/template/error.css +29 -0
- package/global/style/template/folder.css +79 -0
- package/global/{Style/Template/Template.css → style/template/template.css} +60 -68
- package/global/template/error.vhtml +29 -0
- package/global/template/folder.vhtml +54 -0
- package/package.json +2 -2
- package/build/Template.d.ts +0 -46
- package/build/Template.js +0 -81
- package/build/Template.js.map +0 -1
- package/global/Style/Template/Error.css +0 -30
- package/global/Style/Template/Folder.css +0 -77
- package/global/Template/Error.vhtml +0 -29
- package/global/Template/Folder.vhtml +0 -41
- package/tests/Template/template.js +0 -18
- package/tests/Template/template.txt +0 -13
- package/tests/Template/template.vhtml +0 -23
- package/tests/config/config.js +0 -233
- package/tests/debug.js +0 -34
- package/tests/jwtManager/jwtManager.js +0 -342
- package/tests/router.js +0 -596
- package/tests/schema/schema.js +0 -368
- package/tests/test.env +0 -0
- package/tests/test.js +0 -131
- package/tests/test.vhtml +0 -14
- package/tests/utilities.js +0 -28
- package/tests/websocket.vhtml +0 -86
- /package/global/{Source/Logo_960.png → source/logo_960.png} +0 -0
- /package/global/{Source/Logo_SM_960.png → source/logo_SM_960.png} +0 -0
|
@@ -7,12 +7,17 @@ export class Flatten {
|
|
|
7
7
|
/**
|
|
8
8
|
* Flattens a nested plain-object into dot-notation keys.
|
|
9
9
|
* Non-plain objects (Date, RegExp, Map, Set, etc.) are treated as leaf values.
|
|
10
|
+
* @param object - The object to flatten.
|
|
11
|
+
* @param depth - The maximum depth to flatten (default is 10).
|
|
12
|
+
* @returns A new object with flattened keys.
|
|
10
13
|
*/
|
|
11
14
|
static object(object, depth = 10) {
|
|
12
15
|
return this.flattenCore(object, depth);
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
18
|
+
* Unflattens a flattened object back into its original nested structure.
|
|
19
|
+
* @param obj - The flattened object to unflatten.
|
|
20
|
+
* @returns A new object with the original nested structure.
|
|
16
21
|
*/
|
|
17
22
|
static unObject(obj) {
|
|
18
23
|
const result = {};
|
|
@@ -34,6 +39,13 @@ export class Flatten {
|
|
|
34
39
|
}
|
|
35
40
|
return result;
|
|
36
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Core recursive function to flatten an object. It handles the actual flattening logic, while the public `object` method provides type safety and a cleaner interface.
|
|
44
|
+
* @param object - The object to flatten.
|
|
45
|
+
* @param depth - The remaining depth to flatten.
|
|
46
|
+
* @param prefix - The current key prefix for nested keys.
|
|
47
|
+
* @returns A flattened object with dot-notation keys.
|
|
48
|
+
*/
|
|
37
49
|
static flattenCore(object, depth = 10, prefix = '') {
|
|
38
50
|
const result = {};
|
|
39
51
|
for (const key in object) {
|
|
@@ -48,6 +60,11 @@ export class Flatten {
|
|
|
48
60
|
}
|
|
49
61
|
return result;
|
|
50
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a value is a plain object (i.e., an object created by the Object constructor or with a null prototype). This is used to determine whether to flatten a value or treat it as a leaf.
|
|
65
|
+
* @param value - The value to check.
|
|
66
|
+
* @returns True if the value is a plain object, false otherwise.
|
|
67
|
+
*/
|
|
51
68
|
static isPlainObject(value) {
|
|
52
69
|
if (value == null || typeof value !== 'object' || Array.isArray(value))
|
|
53
70
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flatten.js","sourceRoot":"","sources":["../../src/utilities/Flatten.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,OAAO;IAChB
|
|
1
|
+
{"version":3,"file":"Flatten.js","sourceRoot":"","sources":["../../src/utilities/Flatten.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,OAAO;IAChB;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAChB,MAAS,EACT,QAAW,EAAO;QAElB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAyB,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAA2B,GAAqB;QAClE,MAAM,MAAM,GAAQ,EAAE,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;iBACxC,CA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AC,KAAc;QACvC,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACrF,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;IACxD,CAAC;CACJ;AAsGD,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
+
* @description Provides utilities for deep object comparison and manipulation, such as checking for deep equality between objects. This is useful for comparing complex data structures in a way that goes beyond simple reference checks.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export declare class Object {
|
|
7
|
+
/**
|
|
8
|
+
* Compares two objects recursively for deep equality.
|
|
9
|
+
* @param obj1 - The first object to compare.
|
|
10
|
+
* @param obj2 - The second object to compare.
|
|
11
|
+
* @returns true if the objects are deeply equal, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
static deepEqual(obj1: any, obj2: any): boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare namespace Object { }
|
|
16
|
+
export default Object;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
+
* @description Provides utilities for deep object comparison and manipulation, such as checking for deep equality between objects. This is useful for comparing complex data structures in a way that goes beyond simple reference checks.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export class Object {
|
|
7
|
+
/**
|
|
8
|
+
* Compares two objects recursively for deep equality.
|
|
9
|
+
* @param obj1 - The first object to compare.
|
|
10
|
+
* @param obj2 - The second object to compare.
|
|
11
|
+
* @returns true if the objects are deeply equal, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
static deepEqual(obj1, obj2) {
|
|
14
|
+
if (obj1 === obj2)
|
|
15
|
+
return true;
|
|
16
|
+
if (typeof obj1 !== typeof obj2 ||
|
|
17
|
+
obj1 === null || obj2 === null)
|
|
18
|
+
return false;
|
|
19
|
+
const isArray1 = Array.isArray(obj1);
|
|
20
|
+
const isArray2 = Array.isArray(obj2);
|
|
21
|
+
if (isArray1 || isArray2) {
|
|
22
|
+
if (!isArray1 || !isArray2)
|
|
23
|
+
return false;
|
|
24
|
+
if (obj1.length !== obj2.length)
|
|
25
|
+
return false;
|
|
26
|
+
for (let i = 0; i < obj1.length; i++) {
|
|
27
|
+
const hasIndex1 = i in obj1;
|
|
28
|
+
const hasIndex2 = i in obj2;
|
|
29
|
+
if (hasIndex1 !== hasIndex2)
|
|
30
|
+
return false;
|
|
31
|
+
if (hasIndex1 && !this.deepEqual(obj1[i], obj2[i]))
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
const keys1 = globalThis.Object.keys(obj1);
|
|
37
|
+
const keys2 = globalThis.Object.keys(obj2);
|
|
38
|
+
if (keys1.length !== keys2.length)
|
|
39
|
+
return false;
|
|
40
|
+
for (const key of keys1)
|
|
41
|
+
if (!keys2.includes(key) ||
|
|
42
|
+
!this.deepEqual(obj1[key], obj2[key]))
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export default Object;
|
|
48
|
+
//# sourceMappingURL=Object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Object.js","sourceRoot":"","sources":["../../src/utilities/Object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,MAAM;IACf;;;;;OAKG;IACI,MAAM,CAAC,SAAS,CAAC,IAAS,EAAE,IAAS;QACxC,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC/B,IACI,OAAO,IAAI,KAA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AAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;gBACvC,OAAO,KAAK,CAAC;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAGD,eAAe,MAAM,CAAC"}
|
|
@@ -1,24 +1,44 @@
|
|
|
1
1
|
export declare class Path {
|
|
2
|
+
/** The directory where the Vortez module is located. */
|
|
2
3
|
static readonly moduleDir: string;
|
|
3
|
-
|
|
4
|
+
/** The directory where the user is running the server from. */
|
|
5
|
+
static readonly rootDir: string;
|
|
4
6
|
/**
|
|
5
|
-
* Normalizes a path by replacing
|
|
6
|
-
* @param path - The path to
|
|
7
|
-
* @
|
|
7
|
+
* Normalizes a file path by replacing multiple slashes with a single separator and ensuring consistent use of separators.
|
|
8
|
+
* @param path - The file path to normalize.
|
|
9
|
+
* @return The normalized file path.
|
|
8
10
|
*/
|
|
9
11
|
static normalize(path: string): string;
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @
|
|
13
|
+
* Resolves an absolute path from the root of the user project.
|
|
14
|
+
* @param paths - The path to resolve.
|
|
15
|
+
* @return The resolved path.
|
|
14
16
|
*/
|
|
15
|
-
static
|
|
17
|
+
static root(...paths: string[]): string;
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
19
|
+
* Resolves an absolute path from the root of Vortez (internal).
|
|
20
|
+
* @param paths - The path to resolve.
|
|
21
|
+
* @return The resolved path.
|
|
22
|
+
*/
|
|
23
|
+
static module(...paths: string[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the directory name of a path, similar to `PATH.dirname`, but ensures the path is normalized first.
|
|
26
|
+
* @param path - The path to get the directory name of.
|
|
27
|
+
* @return The directory name of the path.
|
|
20
28
|
*/
|
|
21
29
|
static dirname(path: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Joins multiple path segments into a single path, ensuring that the result is normalized.
|
|
32
|
+
* @param paths - The path segments to join.
|
|
33
|
+
* @return The joined path.
|
|
34
|
+
*/
|
|
35
|
+
static join(...paths: string[]): string;
|
|
36
|
+
/**
|
|
37
|
+
* Resolves an absolute path from the root of the user project.
|
|
38
|
+
* @param paths - The path to resolve.
|
|
39
|
+
* @return The resolved path.
|
|
40
|
+
*/
|
|
41
|
+
static resolve(...paths: string[]): string;
|
|
22
42
|
}
|
|
23
43
|
export declare namespace Path { }
|
|
24
44
|
export default Path;
|
package/build/utilities/Path.js
CHANGED
|
@@ -1,36 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
+
* @description Provides utilities for handling file paths, including normalization and resolution of paths relative to the module and user project.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
import PATH from 'path';
|
|
2
7
|
import URL from 'url';
|
|
3
8
|
export class Path {
|
|
9
|
+
/** The directory where the Vortez module is located. */
|
|
4
10
|
static moduleDir = PATH.dirname(PATH.dirname(PATH.dirname(URL.fileURLToPath(import.meta.url))));
|
|
5
|
-
|
|
11
|
+
/** The directory where the user is running the server from. */
|
|
12
|
+
static rootDir = process.cwd();
|
|
6
13
|
/**
|
|
7
|
-
* Normalizes a path by replacing
|
|
8
|
-
* @param path - The path to
|
|
9
|
-
* @
|
|
14
|
+
* Normalizes a file path by replacing multiple slashes with a single separator and ensuring consistent use of separators.
|
|
15
|
+
* @param path - The file path to normalize.
|
|
16
|
+
* @return The normalized file path.
|
|
10
17
|
*/
|
|
11
18
|
static normalize(path) {
|
|
12
|
-
path = path.replace(/[\\/]
|
|
19
|
+
path = path.replace(/[\\/]+/g, PATH.sep);
|
|
13
20
|
return path;
|
|
14
21
|
}
|
|
15
22
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @param
|
|
18
|
-
* @
|
|
23
|
+
* Resolves an absolute path from the root of the user project.
|
|
24
|
+
* @param paths - The path to resolve.
|
|
25
|
+
* @return The resolved path.
|
|
19
26
|
*/
|
|
20
|
-
static
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return PATH.normalize(path);
|
|
27
|
+
static root(...paths) {
|
|
28
|
+
paths = paths.map(path => this.normalize(path));
|
|
29
|
+
return PATH.join(this.rootDir, ...paths);
|
|
24
30
|
}
|
|
25
31
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @param
|
|
28
|
-
* @
|
|
32
|
+
* Resolves an absolute path from the root of Vortez (internal).
|
|
33
|
+
* @param paths - The path to resolve.
|
|
34
|
+
* @return The resolved path.
|
|
35
|
+
*/
|
|
36
|
+
static module(...paths) {
|
|
37
|
+
paths = paths.map(path => this.normalize(path));
|
|
38
|
+
return PATH.join(this.moduleDir, ...paths);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns the directory name of a path, similar to `PATH.dirname`, but ensures the path is normalized first.
|
|
42
|
+
* @param path - The path to get the directory name of.
|
|
43
|
+
* @return The directory name of the path.
|
|
29
44
|
*/
|
|
30
45
|
static dirname(path) {
|
|
31
46
|
path = this.normalize(path);
|
|
32
47
|
return PATH.dirname(path);
|
|
33
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Joins multiple path segments into a single path, ensuring that the result is normalized.
|
|
51
|
+
* @param paths - The path segments to join.
|
|
52
|
+
* @return The joined path.
|
|
53
|
+
*/
|
|
54
|
+
static join(...paths) {
|
|
55
|
+
paths = paths.map(path => this.normalize(path));
|
|
56
|
+
return PATH.join(...paths);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolves an absolute path from the root of the user project.
|
|
60
|
+
* @param paths - The path to resolve.
|
|
61
|
+
* @return The resolved path.
|
|
62
|
+
*/
|
|
63
|
+
static resolve(...paths) {
|
|
64
|
+
paths = paths.map(path => this.normalize(path));
|
|
65
|
+
return PATH.resolve(...paths);
|
|
66
|
+
}
|
|
34
67
|
}
|
|
35
68
|
export default Path;
|
|
36
69
|
//# sourceMappingURL=Path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Path.js","sourceRoot":"","sources":["../../src/utilities/Path.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,OAAO,IAAI;
|
|
1
|
+
{"version":3,"file":"Path.js","sourceRoot":"","sources":["../../src/utilities/Path.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,OAAO,IAAI;IACb,wDAAwD;IACjD,MAAM,CAAU,SAAS,GAAW,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACxH,+DAA+D;IACxD,MAAM,CAAU,OAAO,GAAW,OAAO,CAAC,GAAG,EAAE,CAAC;IAEvD;;;;OAIG;IACI,MAAM,CAAC,SAAS,CAAC,IAAY;QAChC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAe;QACjC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC;IAC7C,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,GAAG,KAAe;QACnC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,CAAC;IAC/C,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,IAAY;QAC9B,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAe;QACjC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,GAAG,KAAe;QACpC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IAClC,CAAC;;AAGL,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
+
* @description Provides time-related utilities, such as sleep functions for delaying execution.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export declare class Time {
|
|
7
|
+
/**
|
|
8
|
+
* Converts a timestamp in milliseconds to seconds.
|
|
9
|
+
* @param timestamp - The timestamp in milliseconds to convert.
|
|
10
|
+
* @returns The equivalent timestamp in seconds.
|
|
11
|
+
*/
|
|
12
|
+
static timestampToSecond(timestamp: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Pauses execution for a specified duration.
|
|
15
|
+
* @param ms - The number of milliseconds to sleep.
|
|
16
|
+
* @returns A promise that resolves after the given time.
|
|
17
|
+
*/
|
|
18
|
+
static sleep(ms: number): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare namespace Time { }
|
|
21
|
+
export default Time;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
+
* @description Provides time-related utilities, such as sleep functions for delaying execution.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export class Time {
|
|
7
|
+
/**
|
|
8
|
+
* Converts a timestamp in milliseconds to seconds.
|
|
9
|
+
* @param timestamp - The timestamp in milliseconds to convert.
|
|
10
|
+
* @returns The equivalent timestamp in seconds.
|
|
11
|
+
*/
|
|
12
|
+
static timestampToSecond(timestamp) {
|
|
13
|
+
return Math.floor(timestamp / 1000);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Pauses execution for a specified duration.
|
|
17
|
+
* @param ms - The number of milliseconds to sleep.
|
|
18
|
+
* @returns A promise that resolves after the given time.
|
|
19
|
+
*/
|
|
20
|
+
static sleep(ms) {
|
|
21
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export default Time;
|
|
25
|
+
//# sourceMappingURL=Time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../src/utilities/Time.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,IAAI;IACb;;;;OAIG;IACI,MAAM,CAAC,iBAAiB,CAAC,SAAiB;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACxC,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,EAAU;QAC1B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACJ;AAGD,eAAe,IAAI,CAAC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description
|
|
3
|
+
* @description Exports all utility classes and functions, providing a centralized access point for various helper methods used throughout the project.
|
|
4
|
+
* This includes:
|
|
5
|
+
* - file operations: `Utilities.File`.
|
|
6
|
+
* - object manipulation: `Utilities.Object`.
|
|
7
|
+
* - encoding: `Utilities.Encoding`.
|
|
8
|
+
* - time utilities: `Utilities.Time`.
|
|
9
|
+
* and more utilities.
|
|
4
10
|
* @license Apache-2.0
|
|
5
11
|
*/
|
|
6
12
|
import _Path from './Path.js';
|
|
@@ -9,56 +15,70 @@ import _ConsoleUI from './ConsoleUI.js';
|
|
|
9
15
|
import _DebugUI from './DebugUI.js';
|
|
10
16
|
import _Schema from './schema/Schema.js';
|
|
11
17
|
import _Flatten from './Flatten.js';
|
|
18
|
+
import _File from './File.js';
|
|
19
|
+
import _Object from './Object.js';
|
|
20
|
+
import _Encoding from './Encoding.js';
|
|
21
|
+
import _Time from './Time.js';
|
|
12
22
|
export { Path } from './Path.js';
|
|
13
23
|
export { Env } from './Env.js';
|
|
14
24
|
export { ConsoleUI } from './ConsoleUI.js';
|
|
15
25
|
export { DebugUI } from './DebugUI.js';
|
|
16
26
|
export { Schema } from './schema/Schema.js';
|
|
17
27
|
export { Flatten } from './Flatten.js';
|
|
28
|
+
export { File } from './File.js';
|
|
29
|
+
export { Object } from './Object.js';
|
|
30
|
+
export { Encoding } from './Encoding.js';
|
|
31
|
+
export { Time } from './Time.js';
|
|
18
32
|
export declare class Utilities {
|
|
19
33
|
/**
|
|
20
|
-
* Checks if a file exists
|
|
21
|
-
* @param path - The path to
|
|
22
|
-
* @returns A promise that resolves to
|
|
34
|
+
* Checks if a file exists at the given path.
|
|
35
|
+
* @param path - The file path to check.
|
|
36
|
+
* @returns A promise that resolves to true if the file exists, false otherwise.
|
|
37
|
+
* @deprecated Use Utilities.File.exists instead.
|
|
23
38
|
*/
|
|
24
39
|
static fileExists(path: string): Promise<boolean>;
|
|
25
40
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @param obj1 - The first
|
|
28
|
-
* @param obj2 - The second
|
|
29
|
-
* @returns A boolean indicating
|
|
41
|
+
* Checks if two values are deeply equal.
|
|
42
|
+
* @param obj1 - The first value to compare.
|
|
43
|
+
* @param obj2 - The second value to compare.
|
|
44
|
+
* @returns A boolean indicating if the values are deeply equal.
|
|
45
|
+
* @deprecated Use Utilities.Object.deepEqual instead.
|
|
30
46
|
*/
|
|
31
47
|
static deepEqual(obj1: any, obj2: any): boolean;
|
|
32
48
|
/**
|
|
33
|
-
* Flattens a nested object into a single-level object with dot
|
|
49
|
+
* Flattens a nested object into a single-level object with dot-separated keys.
|
|
34
50
|
* @param object - The object to flatten.
|
|
35
|
-
* @param depth - The maximum depth to
|
|
36
|
-
* @returns
|
|
51
|
+
* @param depth - The maximum depth to flatten (default is 10).
|
|
52
|
+
* @returns A new object with flattened keys.
|
|
53
|
+
* @deprecated Use Utilities.Flatten.object instead.
|
|
37
54
|
*/
|
|
38
55
|
static flattenObject<T extends object, D extends number = 10>(object: T, depth?: D): Utilities.Flatten.Object<T, D>;
|
|
39
56
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
42
|
-
* @
|
|
43
|
-
* @
|
|
57
|
+
* Unflattens a flattened object back into its original nested structure.
|
|
58
|
+
* @param obj - The flattened object to unflatten.
|
|
59
|
+
* @returns A new object with the original nested structure.
|
|
60
|
+
* @deprecated Use Utilities.Flatten.unObject instead.
|
|
44
61
|
*/
|
|
45
62
|
static unFlattenObject<Result extends any = any>(obj: any): Result;
|
|
46
63
|
/**
|
|
47
|
-
* Pauses
|
|
64
|
+
* Pauses execution for a specified duration.
|
|
48
65
|
* @param ms - The number of milliseconds to sleep.
|
|
49
66
|
* @returns A promise that resolves after the given time.
|
|
67
|
+
* @deprecated Use Utilities.Time.sleep instead.
|
|
50
68
|
*/
|
|
51
69
|
static sleep(ms: number): Promise<void>;
|
|
52
70
|
/**
|
|
53
71
|
* Encodes a string to base64url format.
|
|
54
|
-
* @param data - The string
|
|
72
|
+
* @param data - The string to encode.
|
|
55
73
|
* @returns The base64url-encoded string.
|
|
74
|
+
* @deprecated Use Utilities.Encoding.base64UrlEncode instead.
|
|
56
75
|
*/
|
|
57
76
|
static base64UrlEncode(data: string): string;
|
|
58
77
|
/**
|
|
59
78
|
* Decodes a base64url-encoded string.
|
|
60
|
-
* @param data - The base64url-encoded string
|
|
61
|
-
* @returns The decoded string.
|
|
79
|
+
* @param data - The base64url-encoded string to decode.
|
|
80
|
+
* @returns The decoded UTF-8 string.
|
|
81
|
+
* @deprecated Use Utilities.Encoding.base64UrlDecode instead.
|
|
62
82
|
*/
|
|
63
83
|
static base64UrlDecode(data: string): string;
|
|
64
84
|
}
|
|
@@ -69,28 +89,17 @@ export declare namespace Utilities {
|
|
|
69
89
|
export import DebugUI = _DebugUI;
|
|
70
90
|
export import Schema = _Schema;
|
|
71
91
|
export import Flatten = _Flatten;
|
|
92
|
+
export import File = _File;
|
|
93
|
+
export import Object = _Object;
|
|
94
|
+
export import Encoding = _Encoding;
|
|
95
|
+
export import Time = _Time;
|
|
72
96
|
namespace Types {
|
|
73
97
|
type NumListAdd = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
|
74
98
|
type strToNum<str extends string> = str extends `${infer num extends number}` ? num : never;
|
|
75
|
-
/**
|
|
76
|
-
* Adds one to a number type.
|
|
77
|
-
* @template Number the number to add one to.
|
|
78
|
-
* @returns The number incremented by one.
|
|
79
|
-
*/
|
|
80
99
|
export type Inc<Number extends number | string> = (`${Number}` extends `${infer surPlus}${NumListAdd[number]}` ? `${Number}` extends `${surPlus}${infer unit extends number}` ? unit extends Exclude<NumListAdd[number], 9> ? strToNum<`${surPlus}${NumListAdd[unit]}`> : strToNum<`${surPlus extends `${infer Num extends number}` ? '' : '1'}${surPlus extends '' ? '' : Inc<surPlus>}${NumListAdd[unit]}`> : number : number);
|
|
81
|
-
/**
|
|
82
|
-
* Converts a union of object types into an intersection type.
|
|
83
|
-
* @template U the union to convert.
|
|
84
|
-
* @returns The intersection type of the given union.
|
|
85
|
-
*/
|
|
86
100
|
export type UnionToIntersection<U extends object> = ((U extends any ? (arg: U) => void : never) extends (arg: infer I) => void ? I extends object ? {
|
|
87
101
|
[K in keyof I]: I[K] extends object ? UnionToIntersection<I[K]> : I[K];
|
|
88
102
|
} : I : never);
|
|
89
|
-
/**
|
|
90
|
-
* Converts properties with `undefined` in an object type to optional properties.
|
|
91
|
-
* @template T the object to convert.
|
|
92
|
-
* @returns The object type with properties containing `undefined` marked as optional.
|
|
93
|
-
*/
|
|
94
103
|
export type undefinedToPartial<T extends object> = {
|
|
95
104
|
[K in keyof T as undefined extends T[K] ? never : K]: T[K];
|
|
96
105
|
} & {
|
|
@@ -1,93 +1,99 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description
|
|
3
|
+
* @description Exports all utility classes and functions, providing a centralized access point for various helper methods used throughout the project.
|
|
4
|
+
* This includes:
|
|
5
|
+
* - file operations: `Utilities.File`.
|
|
6
|
+
* - object manipulation: `Utilities.Object`.
|
|
7
|
+
* - encoding: `Utilities.Encoding`.
|
|
8
|
+
* - time utilities: `Utilities.Time`.
|
|
9
|
+
* and more utilities.
|
|
4
10
|
* @license Apache-2.0
|
|
5
11
|
*/
|
|
6
|
-
import { promises as FSP } from "fs";
|
|
7
12
|
import _Path from './Path.js';
|
|
8
13
|
import _Env from './Env.js';
|
|
9
14
|
import _ConsoleUI from './ConsoleUI.js';
|
|
10
15
|
import _DebugUI from './DebugUI.js';
|
|
11
16
|
import _Schema from './schema/Schema.js';
|
|
12
17
|
import _Flatten from './Flatten.js';
|
|
18
|
+
import _File from './File.js';
|
|
19
|
+
import _Object from './Object.js';
|
|
20
|
+
import _Encoding from './Encoding.js';
|
|
21
|
+
import _Time from './Time.js';
|
|
13
22
|
export { Path } from './Path.js';
|
|
14
23
|
export { Env } from './Env.js';
|
|
15
24
|
export { ConsoleUI } from './ConsoleUI.js';
|
|
16
25
|
export { DebugUI } from './DebugUI.js';
|
|
17
26
|
export { Schema } from './schema/Schema.js';
|
|
18
27
|
export { Flatten } from './Flatten.js';
|
|
28
|
+
export { File } from './File.js';
|
|
29
|
+
export { Object } from './Object.js';
|
|
30
|
+
export { Encoding } from './Encoding.js';
|
|
31
|
+
export { Time } from './Time.js';
|
|
19
32
|
export class Utilities {
|
|
20
33
|
/**
|
|
21
|
-
* Checks if a file exists
|
|
22
|
-
* @param path - The path to
|
|
23
|
-
* @returns A promise that resolves to
|
|
34
|
+
* Checks if a file exists at the given path.
|
|
35
|
+
* @param path - The file path to check.
|
|
36
|
+
* @returns A promise that resolves to true if the file exists, false otherwise.
|
|
37
|
+
* @deprecated Use Utilities.File.exists instead.
|
|
24
38
|
*/
|
|
25
39
|
static async fileExists(path) {
|
|
26
|
-
return
|
|
40
|
+
return Utilities.File.exists(path);
|
|
27
41
|
}
|
|
28
42
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param obj1 - The first
|
|
31
|
-
* @param obj2 - The second
|
|
32
|
-
* @returns A boolean indicating
|
|
43
|
+
* Checks if two values are deeply equal.
|
|
44
|
+
* @param obj1 - The first value to compare.
|
|
45
|
+
* @param obj2 - The second value to compare.
|
|
46
|
+
* @returns A boolean indicating if the values are deeply equal.
|
|
47
|
+
* @deprecated Use Utilities.Object.deepEqual instead.
|
|
33
48
|
*/
|
|
34
49
|
static deepEqual(obj1, obj2) {
|
|
35
|
-
|
|
36
|
-
return true;
|
|
37
|
-
if (typeof obj1 !== typeof obj2 ||
|
|
38
|
-
obj1 === null || obj2 === null)
|
|
39
|
-
return false;
|
|
40
|
-
const keys1 = Object.keys(obj1);
|
|
41
|
-
const keys2 = Object.keys(obj2);
|
|
42
|
-
if (keys1.length !== keys2.length)
|
|
43
|
-
return false;
|
|
44
|
-
for (const key of keys1)
|
|
45
|
-
if (!keys2.includes(key) ||
|
|
46
|
-
!this.deepEqual(obj1[key], obj2[key]))
|
|
47
|
-
return false;
|
|
48
|
-
return true;
|
|
50
|
+
return Utilities.Object.deepEqual(obj1, obj2);
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
|
-
* Flattens a nested object into a single-level object with dot
|
|
53
|
+
* Flattens a nested object into a single-level object with dot-separated keys.
|
|
52
54
|
* @param object - The object to flatten.
|
|
53
|
-
* @param depth - The maximum depth to
|
|
54
|
-
* @returns
|
|
55
|
+
* @param depth - The maximum depth to flatten (default is 10).
|
|
56
|
+
* @returns A new object with flattened keys.
|
|
57
|
+
* @deprecated Use Utilities.Flatten.object instead.
|
|
55
58
|
*/
|
|
56
59
|
static flattenObject(object, depth = 10) {
|
|
57
60
|
return Utilities.Flatten.object(object, depth);
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
63
|
-
* @
|
|
63
|
+
* Unflattens a flattened object back into its original nested structure.
|
|
64
|
+
* @param obj - The flattened object to unflatten.
|
|
65
|
+
* @returns A new object with the original nested structure.
|
|
66
|
+
* @deprecated Use Utilities.Flatten.unObject instead.
|
|
64
67
|
*/
|
|
65
68
|
static unFlattenObject(obj) {
|
|
66
69
|
return Utilities.Flatten.unObject(obj);
|
|
67
70
|
}
|
|
68
71
|
/**
|
|
69
|
-
* Pauses
|
|
72
|
+
* Pauses execution for a specified duration.
|
|
70
73
|
* @param ms - The number of milliseconds to sleep.
|
|
71
74
|
* @returns A promise that resolves after the given time.
|
|
75
|
+
* @deprecated Use Utilities.Time.sleep instead.
|
|
72
76
|
*/
|
|
73
77
|
static sleep(ms) {
|
|
74
|
-
return
|
|
78
|
+
return Utilities.Time.sleep(ms);
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
81
|
* Encodes a string to base64url format.
|
|
78
|
-
* @param data - The string
|
|
82
|
+
* @param data - The string to encode.
|
|
79
83
|
* @returns The base64url-encoded string.
|
|
84
|
+
* @deprecated Use Utilities.Encoding.base64UrlEncode instead.
|
|
80
85
|
*/
|
|
81
86
|
static base64UrlEncode(data) {
|
|
82
|
-
return
|
|
87
|
+
return Utilities.Encoding.base64UrlEncode(data);
|
|
83
88
|
}
|
|
84
89
|
/**
|
|
85
90
|
* Decodes a base64url-encoded string.
|
|
86
|
-
* @param data - The base64url-encoded string
|
|
87
|
-
* @returns The decoded string.
|
|
91
|
+
* @param data - The base64url-encoded string to decode.
|
|
92
|
+
* @returns The decoded UTF-8 string.
|
|
93
|
+
* @deprecated Use Utilities.Encoding.base64UrlDecode instead.
|
|
88
94
|
*/
|
|
89
95
|
static base64UrlDecode(data) {
|
|
90
|
-
return
|
|
96
|
+
return Utilities.Encoding.base64UrlDecode(data);
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
(function (Utilities) {
|
|
@@ -97,6 +103,10 @@ export class Utilities {
|
|
|
97
103
|
Utilities.DebugUI = _DebugUI;
|
|
98
104
|
Utilities.Schema = _Schema;
|
|
99
105
|
Utilities.Flatten = _Flatten;
|
|
106
|
+
Utilities.File = _File;
|
|
107
|
+
Utilities.Object = _Object;
|
|
108
|
+
Utilities.Encoding = _Encoding;
|
|
109
|
+
Utilities.Time = _Time;
|
|
100
110
|
})(Utilities || (Utilities = {}));
|
|
101
111
|
export default Utilities;
|
|
102
112
|
//# sourceMappingURL=Utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../src/utilities/Utilities.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../src/utilities/Utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,MAAM,WAAW,CAAC;AAC9B,OAAO,IAAI,MAAM,UA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