vortez 5.0.2 → 6.0.0-dev.1
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/build/Template/Template.d.ts +0 -5
- package/build/Template/Template.js +5 -5
- package/build/Template/Template.js.map +1 -1
- package/build/Vortez.d.ts +2 -2
- package/build/Vortez.js +2 -2
- package/build/Vortez.js.map +1 -1
- package/build/beta/Mail.d.ts +2 -8
- package/build/beta/Mail.js +7 -2
- package/build/beta/Mail.js.map +1 -1
- package/build/server/Cookie.d.ts +9 -5
- package/build/server/Cookie.js +28 -24
- package/build/server/Cookie.js.map +1 -1
- package/build/server/LoggerManager.d.ts +1 -1
- package/build/server/LoggerManager.js +5 -5
- package/build/server/LoggerManager.js.map +1 -1
- package/build/server/Response.js +11 -11
- package/build/server/Response.js.map +1 -1
- package/build/server/Server.js +4 -4
- package/build/server/Server.js.map +1 -1
- package/build/server/ServerDebug.d.ts +1 -1
- package/build/server/ServerDebug.js +1 -1
- package/build/server/ServerDebug.js.map +1 -1
- package/build/server/config/Config.d.ts +7 -7
- package/build/server/config/Config.js +4 -3
- package/build/server/config/Config.js.map +1 -1
- package/build/server/config/Loader.js +5 -5
- package/build/server/config/Loader.js.map +1 -1
- package/build/server/router/HttpRule.d.ts +2 -2
- package/build/server/router/HttpRule.js +1 -1
- package/build/server/router/HttpRule.js.map +1 -1
- package/build/server/router/Router.d.ts +1 -1
- package/build/server/router/Router.js +5 -5
- package/build/server/router/Router.js.map +1 -1
- package/build/server/router/Rule.d.ts +1 -1
- package/build/server/router/WsRule.d.ts +2 -2
- package/build/server/router/WsRule.js +2 -2
- package/build/server/router/WsRule.js.map +1 -1
- package/build/server/router/algorithm/Algorithm.d.ts +1 -1
- package/build/server/router/algorithm/Algorithm.js +2 -2
- package/build/server/router/algorithm/Algorithm.js.map +1 -1
- package/build/server/router/algorithm/FIFO.d.ts +1 -1
- package/build/server/router/algorithm/FIFO.js +2 -2
- package/build/server/router/algorithm/FIFO.js.map +1 -1
- package/build/server/router/algorithm/Tree.d.ts +1 -1
- package/build/server/router/algorithm/Tree.js.map +1 -1
- package/build/server/router/middleware/Middleware.d.ts +5 -5
- package/build/server/router/middleware/WsMiddleware.d.ts +4 -4
- package/build/server/router/middleware/WsMiddleware.js +24 -23
- package/build/server/router/middleware/WsMiddleware.js.map +1 -1
- package/build/server/security/PathSecurity.js +5 -5
- package/build/server/security/PathSecurity.js.map +1 -1
- package/build/server/websocket/Codec.d.ts +128 -0
- package/build/server/websocket/Codec.js +192 -0
- package/build/server/websocket/Codec.js.map +1 -0
- package/build/server/websocket/Websocket.d.ts +38 -84
- package/build/server/websocket/Websocket.js +41 -221
- package/build/server/websocket/Websocket.js.map +1 -1
- package/build/server/websocket/WebsocketBase.d.ts +130 -0
- package/build/server/websocket/WebsocketBase.js +272 -0
- package/build/server/websocket/WebsocketBase.js.map +1 -0
- package/build/server/websocket/WebsocketCSInit.d.ts +57 -0
- package/build/server/websocket/WebsocketCSInit.js +95 -0
- package/build/server/websocket/WebsocketCSInit.js.map +1 -0
- package/build/server/websocket/WebsocketSSInit.d.ts +24 -0
- package/build/server/websocket/WebsocketSSInit.js +46 -0
- package/build/server/websocket/WebsocketSSInit.js.map +1 -0
- package/build/server/websocket/frame/Frame.d.ts +31 -0
- package/build/server/websocket/frame/Frame.js +45 -0
- package/build/server/websocket/frame/Frame.js.map +1 -0
- package/build/server/websocket/frame/Header.d.ts +31 -0
- package/build/server/websocket/frame/Header.js +31 -0
- package/build/server/websocket/frame/Header.js.map +1 -0
- package/build/server/websocket/frame/HeaderParser.d.ts +58 -0
- package/build/server/websocket/frame/HeaderParser.js +109 -0
- package/build/server/websocket/frame/HeaderParser.js.map +1 -0
- package/build/server/websocket/handshake/CSHandshaker.d.ts +46 -0
- package/build/server/websocket/handshake/CSHandshaker.js +122 -0
- package/build/server/websocket/handshake/CSHandshaker.js.map +1 -0
- package/build/server/websocket/handshake/SSHandshaker.d.ts +57 -0
- package/build/server/websocket/handshake/SSHandshaker.js +113 -0
- package/build/server/websocket/handshake/SSHandshaker.js.map +1 -0
- package/build/server/websocket/messageAssembler/Message.d.ts +21 -0
- package/build/server/websocket/messageAssembler/Message.js +20 -0
- package/build/server/websocket/messageAssembler/Message.js.map +1 -0
- package/build/server/websocket/messageAssembler/MessageAssembler.d.ts +25 -0
- package/build/server/websocket/messageAssembler/MessageAssembler.js +47 -0
- package/build/server/websocket/messageAssembler/MessageAssembler.js.map +1 -0
- package/changes.md +28 -0
- package/package.json +6 -1
- package/build/logger/Debug.d.ts +0 -174
- package/build/logger/Debug.js +0 -295
- package/build/logger/Debug.js.map +0 -1
- package/build/logger/Logger.d.ts +0 -38
- package/build/logger/Logger.js +0 -48
- package/build/logger/Logger.js.map +0 -1
- package/build/server/websocket/Chunk.d.ts +0 -36
- package/build/server/websocket/Chunk.js +0 -81
- package/build/server/websocket/Chunk.js.map +0 -1
- package/build/utilities/ConsoleUI.d.ts +0 -89
- package/build/utilities/ConsoleUI.js +0 -142
- package/build/utilities/ConsoleUI.js.map +0 -1
- package/build/utilities/DebugUI.d.ts +0 -66
- package/build/utilities/DebugUI.js +0 -98
- package/build/utilities/DebugUI.js.map +0 -1
- package/build/utilities/Encoding.d.ts +0 -22
- package/build/utilities/Encoding.js +0 -26
- package/build/utilities/Encoding.js.map +0 -1
- package/build/utilities/Env.d.ts +0 -81
- package/build/utilities/Env.js +0 -140
- package/build/utilities/Env.js.map +0 -1
- package/build/utilities/File.d.ts +0 -10
- package/build/utilities/File.js +0 -19
- package/build/utilities/File.js.map +0 -1
- package/build/utilities/Flatten.d.ts +0 -73
- package/build/utilities/Flatten.js +0 -76
- package/build/utilities/Flatten.js.map +0 -1
- package/build/utilities/Object.d.ts +0 -16
- package/build/utilities/Object.js +0 -48
- package/build/utilities/Object.js.map +0 -1
- package/build/utilities/Path.d.ts +0 -44
- package/build/utilities/Path.js +0 -69
- package/build/utilities/Path.js.map +0 -1
- package/build/utilities/Time.d.ts +0 -21
- package/build/utilities/Time.js +0 -25
- package/build/utilities/Time.js.map +0 -1
- package/build/utilities/Utilities.d.ts +0 -118
- package/build/utilities/Utilities.js +0 -112
- package/build/utilities/Utilities.js.map +0 -1
- package/build/utilities/schema/Introspection.d.ts +0 -24
- package/build/utilities/schema/Introspection.js +0 -87
- package/build/utilities/schema/Introspection.js.map +0 -1
- package/build/utilities/schema/JSONSchema.d.ts +0 -68
- package/build/utilities/schema/JSONSchema.js +0 -13
- package/build/utilities/schema/JSONSchema.js.map +0 -1
- package/build/utilities/schema/Schema.d.ts +0 -253
- package/build/utilities/schema/Schema.js +0 -241
- package/build/utilities/schema/Schema.js.map +0 -1
- package/build/utilities/schema/SchemaError.d.ts +0 -10
- package/build/utilities/schema/SchemaError.js +0 -13
- package/build/utilities/schema/SchemaError.js.map +0 -1
- package/build/utilities/schema/Validator.d.ts +0 -94
- package/build/utilities/schema/Validator.js +0 -246
- package/build/utilities/schema/Validator.js.map +0 -1
package/build/utilities/Time.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
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.
|
|
10
|
-
* @license Apache-2.0
|
|
11
|
-
*/
|
|
12
|
-
import _Path from './Path.js';
|
|
13
|
-
import _Env from './Env.js';
|
|
14
|
-
import _ConsoleUI from './ConsoleUI.js';
|
|
15
|
-
import _DebugUI from './DebugUI.js';
|
|
16
|
-
import _Schema from './schema/Schema.js';
|
|
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';
|
|
22
|
-
export { Path } from './Path.js';
|
|
23
|
-
export { Env } from './Env.js';
|
|
24
|
-
export { ConsoleUI } from './ConsoleUI.js';
|
|
25
|
-
export { DebugUI } from './DebugUI.js';
|
|
26
|
-
export { Schema } from './schema/Schema.js';
|
|
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';
|
|
32
|
-
export declare class Utilities {
|
|
33
|
-
/**
|
|
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.
|
|
38
|
-
*/
|
|
39
|
-
static fileExists(path: string): Promise<boolean>;
|
|
40
|
-
/**
|
|
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.
|
|
46
|
-
*/
|
|
47
|
-
static deepEqual(obj1: any, obj2: any): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Flattens a nested object into a single-level object with dot-separated keys.
|
|
50
|
-
* @param object - The object to flatten.
|
|
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.
|
|
54
|
-
*/
|
|
55
|
-
static flattenObject<T extends object, D extends number = 10>(object: T, depth?: D): Utilities.Flatten.Object<T, D>;
|
|
56
|
-
/**
|
|
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.
|
|
61
|
-
*/
|
|
62
|
-
static unFlattenObject<Result extends any = any>(obj: any): Result;
|
|
63
|
-
/**
|
|
64
|
-
* Pauses execution for a specified duration.
|
|
65
|
-
* @param ms - The number of milliseconds to sleep.
|
|
66
|
-
* @returns A promise that resolves after the given time.
|
|
67
|
-
* @deprecated Use Utilities.Time.sleep instead.
|
|
68
|
-
*/
|
|
69
|
-
static sleep(ms: number): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Encodes a string to base64url format.
|
|
72
|
-
* @param data - The string to encode.
|
|
73
|
-
* @returns The base64url-encoded string.
|
|
74
|
-
* @deprecated Use Utilities.Encoding.base64UrlEncode instead.
|
|
75
|
-
*/
|
|
76
|
-
static base64UrlEncode(data: string): string;
|
|
77
|
-
/**
|
|
78
|
-
* Decodes a base64url-encoded string.
|
|
79
|
-
* @param data - The base64url-encoded string to decode.
|
|
80
|
-
* @returns The decoded UTF-8 string.
|
|
81
|
-
* @deprecated Use Utilities.Encoding.base64UrlDecode instead.
|
|
82
|
-
*/
|
|
83
|
-
static base64UrlDecode(data: string): string;
|
|
84
|
-
}
|
|
85
|
-
export declare namespace Utilities {
|
|
86
|
-
export import Path = _Path;
|
|
87
|
-
export import Env = _Env;
|
|
88
|
-
export import ConsoleUI = _ConsoleUI;
|
|
89
|
-
export import DebugUI = _DebugUI;
|
|
90
|
-
export import Schema = _Schema;
|
|
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;
|
|
96
|
-
namespace Types {
|
|
97
|
-
type NumListAdd = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
|
98
|
-
type strToNum<str extends string> = str extends `${infer num extends number}` ? num : never;
|
|
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);
|
|
100
|
-
export type UnionToIntersection<U extends object> = ((U extends any ? (arg: U) => void : never) extends (arg: infer I) => void ? I extends object ? {
|
|
101
|
-
[K in keyof I]: I[K] extends object ? UnionToIntersection<I[K]> : I[K];
|
|
102
|
-
} : I : never);
|
|
103
|
-
export type undefinedToPartial<T extends object> = {
|
|
104
|
-
[K in keyof T as undefined extends T[K] ? never : K]: T[K];
|
|
105
|
-
} & {
|
|
106
|
-
[K in keyof T as undefined extends T[K] ? K : never]?: Exclude<T[K], undefined>;
|
|
107
|
-
};
|
|
108
|
-
export type Document = {
|
|
109
|
-
[key: string]: any;
|
|
110
|
-
};
|
|
111
|
-
export {};
|
|
112
|
-
}
|
|
113
|
-
type FlattenObject<T extends Types.Document, depth extends number = 5> = Flatten.Object<T, depth>;
|
|
114
|
-
interface env {
|
|
115
|
-
[key: string]: string;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
export default Utilities;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
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.
|
|
10
|
-
* @license Apache-2.0
|
|
11
|
-
*/
|
|
12
|
-
import _Path from './Path.js';
|
|
13
|
-
import _Env from './Env.js';
|
|
14
|
-
import _ConsoleUI from './ConsoleUI.js';
|
|
15
|
-
import _DebugUI from './DebugUI.js';
|
|
16
|
-
import _Schema from './schema/Schema.js';
|
|
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';
|
|
22
|
-
export { Path } from './Path.js';
|
|
23
|
-
export { Env } from './Env.js';
|
|
24
|
-
export { ConsoleUI } from './ConsoleUI.js';
|
|
25
|
-
export { DebugUI } from './DebugUI.js';
|
|
26
|
-
export { Schema } from './schema/Schema.js';
|
|
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';
|
|
32
|
-
export class Utilities {
|
|
33
|
-
/**
|
|
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.
|
|
38
|
-
*/
|
|
39
|
-
static async fileExists(path) {
|
|
40
|
-
return Utilities.File.exists(path);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
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.
|
|
48
|
-
*/
|
|
49
|
-
static deepEqual(obj1, obj2) {
|
|
50
|
-
return Utilities.Object.deepEqual(obj1, obj2);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Flattens a nested object into a single-level object with dot-separated keys.
|
|
54
|
-
* @param object - The object to flatten.
|
|
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.
|
|
58
|
-
*/
|
|
59
|
-
static flattenObject(object, depth = 10) {
|
|
60
|
-
return Utilities.Flatten.object(object, depth);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
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.
|
|
67
|
-
*/
|
|
68
|
-
static unFlattenObject(obj) {
|
|
69
|
-
return Utilities.Flatten.unObject(obj);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Pauses execution for a specified duration.
|
|
73
|
-
* @param ms - The number of milliseconds to sleep.
|
|
74
|
-
* @returns A promise that resolves after the given time.
|
|
75
|
-
* @deprecated Use Utilities.Time.sleep instead.
|
|
76
|
-
*/
|
|
77
|
-
static sleep(ms) {
|
|
78
|
-
return Utilities.Time.sleep(ms);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Encodes a string to base64url format.
|
|
82
|
-
* @param data - The string to encode.
|
|
83
|
-
* @returns The base64url-encoded string.
|
|
84
|
-
* @deprecated Use Utilities.Encoding.base64UrlEncode instead.
|
|
85
|
-
*/
|
|
86
|
-
static base64UrlEncode(data) {
|
|
87
|
-
return Utilities.Encoding.base64UrlEncode(data);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Decodes a base64url-encoded string.
|
|
91
|
-
* @param data - The base64url-encoded string to decode.
|
|
92
|
-
* @returns The decoded UTF-8 string.
|
|
93
|
-
* @deprecated Use Utilities.Encoding.base64UrlDecode instead.
|
|
94
|
-
*/
|
|
95
|
-
static base64UrlDecode(data) {
|
|
96
|
-
return Utilities.Encoding.base64UrlDecode(data);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
(function (Utilities) {
|
|
100
|
-
Utilities.Path = _Path;
|
|
101
|
-
Utilities.Env = _Env;
|
|
102
|
-
Utilities.ConsoleUI = _ConsoleUI;
|
|
103
|
-
Utilities.DebugUI = _DebugUI;
|
|
104
|
-
Utilities.Schema = _Schema;
|
|
105
|
-
Utilities.Flatten = _Flatten;
|
|
106
|
-
Utilities.File = _File;
|
|
107
|
-
Utilities.Object = _Object;
|
|
108
|
-
Utilities.Encoding = _Encoding;
|
|
109
|
-
Utilities.Time = _Time;
|
|
110
|
-
})(Utilities || (Utilities = {}));
|
|
111
|
-
export default Utilities;
|
|
112
|
-
//# sourceMappingURL=Utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,UAAU,CAAC;AAC5B,OAAO,UAAU,MAAM,gBAAgB,CAAC;AACxC,OAAO,QAAQ,MAAM,cAAc,CAAC;AACpC,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,QAAQ,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,MAAM,WAAW,CAAC;AAC9B,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,MAAM,WAAW,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,OAAO,SAAS;IAClB;;;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,OAAO,CAAC;IACjB,kBAAQ,GAAG,SAAS,CAAC;IACrB,cAAI,GAAG,KAAK,CAAC;AA0C/B,CAAC,EApDgB,SAAS,KAAT,SAAS,QAoDzB;AACD,eAAe,SAAS,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description Provides utilities for schema introspection, including listing unique properties and converting custom schemas to JSON Schema format.
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import type { JSONSchema } from './JSONSchema.js';
|
|
7
|
-
import type { Schema } from './Schema.js';
|
|
8
|
-
export declare class Introspection {
|
|
9
|
-
/**
|
|
10
|
-
* Lists all unique properties in a schema, including nested unique properties, and returns their full paths.
|
|
11
|
-
* @param doc The schema to list unique properties from
|
|
12
|
-
* @param parentKey The parent key of the current schema, used for building full paths of nested properties
|
|
13
|
-
* @returns An array of full paths to unique properties in the schema
|
|
14
|
-
*/
|
|
15
|
-
static listUniques(doc: Schema.Schema, parentKey?: string): string[];
|
|
16
|
-
/**
|
|
17
|
-
* Converts a schema to a JSON Schema, used for validating data against the schema and generating documentation.
|
|
18
|
-
* @param schema The schema to convert to JSON Schema
|
|
19
|
-
* @returns The JSON Schema representation of the input schema
|
|
20
|
-
*/
|
|
21
|
-
static toJsonSchema(schema: Schema.Schema): JSONSchema.schema;
|
|
22
|
-
}
|
|
23
|
-
export declare namespace Introspection { }
|
|
24
|
-
export default Introspection;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description Provides utilities for schema introspection, including listing unique properties and converting custom schemas to JSON Schema format.
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
export class Introspection {
|
|
7
|
-
/**
|
|
8
|
-
* Lists all unique properties in a schema, including nested unique properties, and returns their full paths.
|
|
9
|
-
* @param doc The schema to list unique properties from
|
|
10
|
-
* @param parentKey The parent key of the current schema, used for building full paths of nested properties
|
|
11
|
-
* @returns An array of full paths to unique properties in the schema
|
|
12
|
-
*/
|
|
13
|
-
static listUniques(doc, parentKey) {
|
|
14
|
-
const uniques = [];
|
|
15
|
-
for (const key in doc) {
|
|
16
|
-
const prop = doc[key];
|
|
17
|
-
if (key !== '_id' && prop.unique)
|
|
18
|
-
uniques.push(parentKey ? `${parentKey}.${key}` : key);
|
|
19
|
-
if (prop.type === 'object') {
|
|
20
|
-
uniques.push(...this.listUniques(prop.schema, parentKey ? `${parentKey}.${key}` : key));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return uniques;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Converts a schema to a JSON Schema, used for validating data against the schema and generating documentation.
|
|
27
|
-
* @param schema The schema to convert to JSON Schema
|
|
28
|
-
* @returns The JSON Schema representation of the input schema
|
|
29
|
-
*/
|
|
30
|
-
static toJsonSchema(schema) {
|
|
31
|
-
const sch = {};
|
|
32
|
-
sch.type = 'object';
|
|
33
|
-
sch.properties = {};
|
|
34
|
-
for (const key in schema) {
|
|
35
|
-
const prop = schema[key];
|
|
36
|
-
let subSch = {};
|
|
37
|
-
subSch.type = prop.nullable ? [prop.type, 'null'] : prop.type;
|
|
38
|
-
if (prop.required) {
|
|
39
|
-
if (sch.required == null)
|
|
40
|
-
sch.required = [];
|
|
41
|
-
sch.required.push(key);
|
|
42
|
-
}
|
|
43
|
-
switch (prop.type) {
|
|
44
|
-
case 'string': {
|
|
45
|
-
if (prop.enum !== undefined)
|
|
46
|
-
subSch.enum = [...prop.enum];
|
|
47
|
-
if (prop.minLength !== undefined)
|
|
48
|
-
subSch.minLength = prop.minLength;
|
|
49
|
-
if (prop.maxLength !== undefined)
|
|
50
|
-
subSch.maxLength = prop.maxLength;
|
|
51
|
-
if (prop.pattern !== undefined)
|
|
52
|
-
subSch.pattern = prop.pattern.source;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
case 'boolean': break;
|
|
56
|
-
case 'number': {
|
|
57
|
-
if (prop.minimum !== undefined)
|
|
58
|
-
subSch.minimum = prop.minimum;
|
|
59
|
-
if (prop.maximum !== undefined)
|
|
60
|
-
subSch.maximum = prop.maximum;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
case 'array': {
|
|
64
|
-
if (prop.minimum !== undefined)
|
|
65
|
-
subSch.minItems = prop.minimum;
|
|
66
|
-
if (prop.maximum !== undefined)
|
|
67
|
-
subSch.maxItems = prop.maximum;
|
|
68
|
-
const itemContainer = this.toJsonSchema({ item: prop.property });
|
|
69
|
-
const itemSchema = itemContainer.properties?.item;
|
|
70
|
-
if (itemSchema)
|
|
71
|
-
subSch.items = itemSchema;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
case 'object': {
|
|
75
|
-
subSch = this.toJsonSchema(prop.schema);
|
|
76
|
-
if (prop.nullable)
|
|
77
|
-
subSch.type = ['object', 'null'];
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
sch.properties[key] = subSch;
|
|
82
|
-
}
|
|
83
|
-
return sch;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export default Introspection;
|
|
87
|
-
//# sourceMappingURL=Introspection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Introspection.js","sourceRoot":"","sources":["../../../src/utilities/schema/Introspection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,OAAO,aAAa;IACtB;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,GAAkB,EAAE,SAAkB;QAC5D,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACpB,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACtB,IAAI,GAAG,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM;gBAAE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AG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACxC,IAAI,IAAI,CAAC,QAAQ;wBAAE,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;oBACpD,MAAM;gBACV,CAAC;YACL,CAAC;YACD,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QACjC,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description Provides type definitions for JSON Schema, a powerful tool for validating and describing the structure of JSON data.
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
export declare namespace JSONSchema {
|
|
7
|
-
type schemeArray = schemeTypes[];
|
|
8
|
-
type schemaObject = {
|
|
9
|
-
[key: string]: schemeTypes;
|
|
10
|
-
};
|
|
11
|
-
interface SchemaTypeMap {
|
|
12
|
-
string: string;
|
|
13
|
-
number: number;
|
|
14
|
-
boolean: boolean;
|
|
15
|
-
object: schemaObject;
|
|
16
|
-
array: schemeArray;
|
|
17
|
-
null: null;
|
|
18
|
-
}
|
|
19
|
-
type schemaNames = keyof SchemaTypeMap;
|
|
20
|
-
type schemeTypes = SchemaTypeMap[schemaNames];
|
|
21
|
-
type schemaVersion = string;
|
|
22
|
-
type schema = {
|
|
23
|
-
title?: string;
|
|
24
|
-
description?: string;
|
|
25
|
-
multipleOf?: number;
|
|
26
|
-
maximum?: number;
|
|
27
|
-
exclusiveMaximum?: boolean;
|
|
28
|
-
minimum?: number;
|
|
29
|
-
exclusiveMinimum?: boolean;
|
|
30
|
-
maxLength?: number;
|
|
31
|
-
minLength?: number;
|
|
32
|
-
pattern?: string;
|
|
33
|
-
additionalItems?: schema;
|
|
34
|
-
items?: schema | schema[];
|
|
35
|
-
maxItems?: number;
|
|
36
|
-
minItems?: number;
|
|
37
|
-
uniqueItems?: boolean;
|
|
38
|
-
maxProperties?: number;
|
|
39
|
-
minProperties?: number;
|
|
40
|
-
required?: string[];
|
|
41
|
-
properties?: {
|
|
42
|
-
[key: string]: schema;
|
|
43
|
-
};
|
|
44
|
-
additionalProperties?: boolean | schema;
|
|
45
|
-
patternProperties?: {
|
|
46
|
-
[key: string]: schema;
|
|
47
|
-
};
|
|
48
|
-
dependencies?: {
|
|
49
|
-
[key: string]: string[] | schema;
|
|
50
|
-
};
|
|
51
|
-
enum?: schemeTypes[];
|
|
52
|
-
type?: schemaNames | schemaNames[];
|
|
53
|
-
allOf?: schema[];
|
|
54
|
-
anyOf?: schema[];
|
|
55
|
-
oneOf?: schema[];
|
|
56
|
-
not?: schema;
|
|
57
|
-
extends?: string | string[];
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* provide the type definition of a json schema
|
|
62
|
-
* @param schema the json schema to validate
|
|
63
|
-
*/
|
|
64
|
-
export declare function schema(schema: JSONSchema.schema): JSONSchema.schema;
|
|
65
|
-
export declare const JSONSchema: {
|
|
66
|
-
schema: typeof schema;
|
|
67
|
-
};
|
|
68
|
-
export default JSONSchema;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description Provides type definitions for JSON Schema, a powerful tool for validating and describing the structure of JSON data.
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* provide the type definition of a json schema
|
|
8
|
-
* @param schema the json schema to validate
|
|
9
|
-
*/
|
|
10
|
-
export function schema(schema) { return schema; }
|
|
11
|
-
export const JSONSchema = { schema };
|
|
12
|
-
export default JSONSchema;
|
|
13
|
-
//# sourceMappingURL=JSONSchema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JSONSchema.js","sourceRoot":"","sources":["../../../src/utilities/schema/JSONSchema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoEH;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,MAAyB,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,MAAM,EAAE,CAAC;AACrC,eAAe,UAAU,CAAC"}
|