vortez 4.1.3 → 5.0.0-dev.14

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.
Files changed (137) hide show
  1. package/README.md +235 -289
  2. package/build/Template.d.ts +16 -2
  3. package/build/Template.js +20 -8
  4. package/build/Template.js.map +1 -1
  5. package/build/Vortez.d.ts +8 -15
  6. package/build/Vortez.js +8 -16
  7. package/build/Vortez.js.map +1 -1
  8. package/build/beta/Beta.d.ts +8 -0
  9. package/build/beta/Beta.js +9 -0
  10. package/build/beta/Beta.js.map +1 -0
  11. package/build/{Beta → beta}/JwtManager.js +1 -1
  12. package/build/{Beta → beta}/JwtManager.js.map +1 -1
  13. package/build/{Beta → beta}/Mail.d.ts +1 -1
  14. package/build/{Beta → beta}/Mail.js +1 -1
  15. package/build/beta/Mail.js.map +1 -0
  16. package/build/logger/Debug.d.ts +174 -0
  17. package/build/logger/Debug.js +295 -0
  18. package/build/logger/Debug.js.map +1 -0
  19. package/build/logger/Logger.d.ts +38 -0
  20. package/build/logger/Logger.js +48 -0
  21. package/build/logger/Logger.js.map +1 -0
  22. package/build/{Server → server}/BodyParser.js.map +1 -1
  23. package/build/{Server → server}/Cookie.js.map +1 -1
  24. package/build/server/LoggerManager.d.ts +21 -0
  25. package/build/server/LoggerManager.js +30 -0
  26. package/build/server/LoggerManager.js.map +1 -0
  27. package/build/{Server → server}/Request.d.ts +4 -2
  28. package/build/{Server → server}/Request.js +2 -1
  29. package/build/server/Request.js.map +1 -0
  30. package/build/{Server → server}/Response.d.ts +4 -1
  31. package/build/{Server → server}/Response.js +24 -8
  32. package/build/server/Response.js.map +1 -0
  33. package/build/{Server → server}/Server.d.ts +20 -67
  34. package/build/server/Server.js +211 -0
  35. package/build/server/Server.js.map +1 -0
  36. package/build/server/ServerDebug.d.ts +17 -0
  37. package/build/server/ServerDebug.js +67 -0
  38. package/build/server/ServerDebug.js.map +1 -0
  39. package/build/server/ServerError.d.ts +18 -0
  40. package/build/server/ServerError.js +15 -0
  41. package/build/server/ServerError.js.map +1 -0
  42. package/build/{Server → server}/Session.d.ts +9 -13
  43. package/build/{Server → server}/Session.js +34 -35
  44. package/build/server/Session.js.map +1 -0
  45. package/build/{Config.d.ts → server/config/Config.d.ts} +19 -3
  46. package/build/server/config/Config.js +60 -0
  47. package/build/server/config/Config.js.map +1 -0
  48. package/build/server/config/ConfigLoader.d.ts +24 -0
  49. package/build/server/config/ConfigLoader.js +53 -0
  50. package/build/server/config/ConfigLoader.js.map +1 -0
  51. package/build/server/config/ConfigValidator.d.ts +71 -0
  52. package/build/server/config/ConfigValidator.js +131 -0
  53. package/build/server/config/ConfigValidator.js.map +1 -0
  54. package/build/server/router/HttpRule.d.ts +69 -0
  55. package/build/server/router/HttpRule.js +96 -0
  56. package/build/server/router/HttpRule.js.map +1 -0
  57. package/build/server/router/Router.d.ts +127 -0
  58. package/build/server/router/Router.js +211 -0
  59. package/build/server/router/Router.js.map +1 -0
  60. package/build/server/router/Rule.d.ts +71 -0
  61. package/build/server/router/Rule.js +113 -0
  62. package/build/server/router/Rule.js.map +1 -0
  63. package/build/server/router/WsRule.d.ts +25 -0
  64. package/build/server/router/WsRule.js +34 -0
  65. package/build/server/router/WsRule.js.map +1 -0
  66. package/build/server/router/middleware/HttpMiddleware.d.ts +35 -0
  67. package/build/server/router/middleware/HttpMiddleware.js +90 -0
  68. package/build/server/router/middleware/HttpMiddleware.js.map +1 -0
  69. package/build/server/router/middleware/Middleware.d.ts +77 -0
  70. package/build/server/router/middleware/Middleware.js +69 -0
  71. package/build/server/router/middleware/Middleware.js.map +1 -0
  72. package/build/server/router/middleware/WsMiddleware.d.ts +24 -0
  73. package/build/server/router/middleware/WsMiddleware.js +90 -0
  74. package/build/server/router/middleware/WsMiddleware.js.map +1 -0
  75. package/build/{Server/WebSocket → server/websocket}/Chunk.js.map +1 -1
  76. package/build/server/websocket/Websocket.d.ts +88 -0
  77. package/build/{Server/WebSocket/WebSocket.js → server/websocket/Websocket.js} +91 -53
  78. package/build/server/websocket/Websocket.js.map +1 -0
  79. package/build/utilities/ConsoleUI.d.ts +88 -0
  80. package/build/utilities/ConsoleUI.js +141 -0
  81. package/build/utilities/ConsoleUI.js.map +1 -0
  82. package/build/utilities/DebugUI.d.ts +66 -0
  83. package/build/utilities/DebugUI.js +98 -0
  84. package/build/utilities/DebugUI.js.map +1 -0
  85. package/build/utilities/Env.d.ts +81 -0
  86. package/build/{Utilities → utilities}/Env.js +47 -35
  87. package/build/utilities/Env.js.map +1 -0
  88. package/build/utilities/Path.d.ts +24 -0
  89. package/build/utilities/Path.js +36 -0
  90. package/build/{Utilities → utilities}/Path.js.map +1 -1
  91. package/build/{Utilities → utilities}/Utilities.d.ts +68 -55
  92. package/build/{Utilities → utilities}/Utilities.js +36 -19
  93. package/build/utilities/Utilities.js.map +1 -0
  94. package/changes.md +122 -88
  95. package/package.json +10 -13
  96. package/tests/debug.js +9 -3
  97. package/tests/test.js +50 -48
  98. package/tests/utilities.js +1 -1
  99. package/Notes.md +0 -12
  100. package/build/Beta/Mail.js.map +0 -1
  101. package/build/Config.js +0 -33
  102. package/build/Config.js.map +0 -1
  103. package/build/ConsoleUI.d.ts +0 -57
  104. package/build/ConsoleUI.js +0 -110
  105. package/build/ConsoleUI.js.map +0 -1
  106. package/build/Debug.d.ts +0 -154
  107. package/build/Debug.js +0 -256
  108. package/build/Debug.js.map +0 -1
  109. package/build/LoggerManager/Logger.d.ts +0 -23
  110. package/build/LoggerManager/Logger.js +0 -23
  111. package/build/LoggerManager/Logger.js.map +0 -1
  112. package/build/LoggerManager/LoggerManager.d.ts +0 -18
  113. package/build/LoggerManager/LoggerManager.js +0 -30
  114. package/build/LoggerManager/LoggerManager.js.map +0 -1
  115. package/build/Server/Request.js.map +0 -1
  116. package/build/Server/Response.js.map +0 -1
  117. package/build/Server/Rule.d.ts +0 -81
  118. package/build/Server/Rule.js +0 -146
  119. package/build/Server/Rule.js.map +0 -1
  120. package/build/Server/Server.js +0 -330
  121. package/build/Server/Server.js.map +0 -1
  122. package/build/Server/Session.js.map +0 -1
  123. package/build/Server/WebSocket/WebSocket.d.ts +0 -70
  124. package/build/Server/WebSocket/WebSocket.js.map +0 -1
  125. package/build/Utilities/Env.d.ts +0 -75
  126. package/build/Utilities/Env.js.map +0 -1
  127. package/build/Utilities/Path.d.ts +0 -18
  128. package/build/Utilities/Path.js +0 -27
  129. package/build/Utilities/Utilities.js.map +0 -1
  130. package/tests/test.env +0 -0
  131. /package/build/{Beta → beta}/JwtManager.d.ts +0 -0
  132. /package/build/{Server → server}/BodyParser.d.ts +0 -0
  133. /package/build/{Server → server}/BodyParser.js +0 -0
  134. /package/build/{Server → server}/Cookie.d.ts +0 -0
  135. /package/build/{Server → server}/Cookie.js +0 -0
  136. /package/build/{Server/WebSocket → server/websocket}/Chunk.d.ts +0 -0
  137. /package/build/{Server/WebSocket → server/websocket}/Chunk.js +0 -0
package/changes.md CHANGED
@@ -1,89 +1,123 @@
1
-
2
- # version (4.1.0)
3
- ## Added
4
- - **(Logger)**: added to help in log with prefix.
5
- - this was exported from `Vortez`
6
- ```ts
7
- import { Logger } from `vortez`
8
- ```
9
- - **(LoggerManager)**: added to manager the Vortez logs.
10
- - this was exported from namespace `Vortez`
11
- ```ts
12
- import Vortez from `vortez`
13
- Vortez.LoggerManager
14
- ```
15
- ## 🐞 Fixes
16
- - The default templates now use absolute path to prevent errors
17
- - Note: the user can use relative path`s
18
- ## ✏️ Changes
19
- - **(Debug)**: Debugging tools were added.
20
- - Added methods to help in debug time: log, warn, info and error.
21
- - The default value to show was changed to true.
22
- - **(Server)**: The server startup was changed.
23
- - Added methods: start, stop, restart
24
- - Now the user should use the method start
25
- ```ts
26
- import Vortez from 'vortez';
27
- const server = new Vortez();
28
- server.start();
29
- ```
30
- - The server config can be provided in constructor or changed after start.
31
- ```ts
32
- // example 1;
33
- const server = new Vortez({
34
- port: 80, host: 'localhost', ssl: {
35
- pubKey: 'public.pem',
36
- privKey: 'private.pem'
37
- port: 443
38
- }
39
- });
40
- // example 2
41
- const server = new Vortez();
42
- server.config.port = 80;
43
- server.config.host = 'localhost';
44
- server.config.ssl = {
45
- pubKey: 'public.pem',
46
- privKey: 'private.pem'
47
- port: 443
48
- }
49
- ```
50
-
51
- # version (4.0.0)
52
- ## 📒 Notes
53
- - The project was migrated to TypeScript.
54
- - Properties and methods now start with a camelcase.
55
- - Skipped version 3.7.0 to make way for 4.0.0.
56
- ## ✏️ Changes
57
- - **(Template)**: The `load` method now works with async/await instead of directly returning a promise.
58
- - **(Template)**: syntax of array changed.
59
- ```text
60
- // from
61
- $(name) { the key is $key with value $value }
62
- $(name, customKeyName, customValueName) { the key is $customKeyName with value $customValueName }
63
- // to
64
- $(name) { the key is %key% with value %value% }
65
- $(name, customKeyName, customValueName) { the key is %customKeyName% with value %customValueName% }
66
- ```
67
- - **(Utilities)**: Added the functions `loadEnv`, `flattenObject`, and `sleep`.
68
- - **(Utilities)**: Modified the `flattenObject` function to retain null and undefined values and provide better typing.
69
- - **(Debug)**: Can now only be used from the `getInstance` method (subject to possible changes).
70
- - **(Config)**: Converted to a singleton.
71
- - **(Response)**: The `send` method is now limited to receiving `string|buffer`.
72
- - **(Response)**: The `sendFile`, `sendFolder`, and `sendTemplate` methods now work with async/await.
73
- - **(Response)**: The `POST.content` object will no longer be a `Map` when appropriate, but a `Request.POST.VarList` object.
74
- - **(Response)**: The `POST.files` object will always have the type `Request.POST.FileList`.
75
- - **(Request)**: The `GET` attribute is now `searchParams`.
76
- - **(Request)**: Request body processing has been delegated to `BodyParser.ts`.
77
- - **(Request)**: The type of search param is no longer a `Map`, but an object `{ [key: string]: string | undefined }`.
78
- - **(WebSocket)**: The logic behind WebSocket reception was separated into `Chunk.ts`.
79
- - **(WebSocket)**: `Chunk.ts` was optimized.
80
- - **(Beta)**: `JsonWT` was converted to `JwtManager`.
81
-
82
-
83
-
84
- # version (x.x.x)
85
- ## 📒 Notes
86
- ## Added
87
- ## Removed
88
- ## 🐞 Fixes
1
+ # version (5.0.0)
2
+ ## 📒 Notes
3
+ - **Breaking Change**: The server's debugging interface has been refactored. Users interacting with the old `DebugUI` will need to adapt to the new `ServerDebug` module.
4
+ ## Added
5
+ - **(Utilities/DebugUI)**: Introduced a new generic, reusable `DebugUI` class for creating command-line interfaces.
6
+ - **(Server/ServerDebug)**: Added a new `ServerDebug` module to provide server-specific commands, built upon the new generic `DebugUI`.
7
+ - **(Server/Middleware)**: Created middleware system.
8
+ - Implemented middleware system in Router for global middlewares.
9
+ - Implemented middleware system in Rule for custom middlewares in single rule.
10
+ ## Removed
11
+ - **(Server/DebugUI)**: Deleted the old `DebugUI.ts` which was tightly coupled with the `Server` class.
12
+ ## 🐞 Fixes
13
+ ## ✏️ Changes
14
+ - **(Vortez/DebugUI)**: The entire debugging system has been refactored for modularity. **This is a breaking change.**
15
+ - The `DebugUI` is no longer part of the `Server` class but is now composed of a generic `DebugUI` from utilities and a specific `ServerDebug` module.
16
+ - This decoupling allows other packages to leverage the `DebugUI` from `vortez`.
17
+ - **(Debug)**: Added new properties and refactored methods:
18
+ - Debug now supports multiline formatting in prints.
19
+ - Debug now have static default and static defaultID attributes.
20
+ - Debug now return directly Debug.default when use getInstance without params or with id === Debug.defaultID;
21
+ - **(Server/Config)**: Introduced a new configuration system:
22
+ - The config system is based on a `.json` file.
23
+ - You can load config from a specific file or use the default.
24
+ - You can still configure everything dynamically (like in older versions).
25
+ - Using the config system is optional, not required.
26
+ - Documentation is available in the `README.md`.
27
+ - **(Server/Router)**: Refactored Rule to support async authExec and optional parameters in url rules.
28
+ - The rules now can accept async authExec.
29
+ - Url rules now accept `$?<name>` as optional param `$<name>` continue as required param.
30
+ - Added support for global middlewares.
31
+ - added support for sub routers.
32
+ - **(Server/WebSocket)**: Overhauled the WebSocket connection lifecycle for improved security and developer experience.
33
+ - The `WebSocket` class no longer accepts connections in its constructor. Instead, it waits in a `pending` state.
34
+ - Added `accept()` and `reject()` methods to give the framework full control over the connection handshake.
35
+
36
+ # version (4.1.0)
37
+ ## ➕ Added
38
+ - **(Logger)**: added to help in log with prefix.
39
+ - this was exported from `Vortez`
40
+ ```ts
41
+ import { Logger } from `vortez`
42
+ ```
43
+ - **(LoggerManager)**: added to manager the Vortez logs.
44
+ - this was exported from namespace `Vortez`
45
+ ```ts
46
+ import Vortez from `vortez`
47
+ Vortez.LoggerManager
48
+ ```
49
+ ## 🐞 Fixes
50
+ - The default templates now use absolute path to prevent errors
51
+ - Note: the user can use relative path`s
52
+ ## ✏️ Changes
53
+ - **(Debug)**: Debugging tools were added.
54
+ - Added methods to help in debug time: log, warn, info and error.
55
+ - The default value to show was changed to true.
56
+ - **(Server)**: The server startup was changed.
57
+ - Added methods: start, stop, restart
58
+ - Now the user should use the method start
59
+ ```ts
60
+ import Vortez from 'vortez';
61
+ const server = new Vortez();
62
+ server.start();
63
+ ```
64
+ - The server config can be provided in constructor or changed after start.
65
+ ```ts
66
+ // example 1;
67
+ const server = new Vortez({
68
+ port: 80, host: 'localhost', ssl: {
69
+ pubKey: 'public.pem',
70
+ privKey: 'private.pem'
71
+ port: 443
72
+ }
73
+ });
74
+ // example 2
75
+ const server = new Vortez();
76
+ server.config.port = 80;
77
+ server.config.host = 'localhost';
78
+ server.config.ssl = {
79
+ pubKey: 'public.pem',
80
+ privKey: 'private.pem'
81
+ port: 443
82
+ }
83
+ ```
84
+
85
+ # version (4.0.0)
86
+ ## 📒 Notes
87
+ - The project was migrated to TypeScript.
88
+ - Properties and methods now start with a camelcase.
89
+ - Skipped version 3.7.0 to make way for 4.0.0.
90
+ ## ✏️ Changes
91
+ - **(Template)**: The `load` method now works with async/await instead of directly returning a promise.
92
+ - **(Template)**: syntax of array changed.
93
+ ```text
94
+ // from
95
+ $(name) { the key is $key with value $value }
96
+ $(name, customKeyName, customValueName) { the key is $customKeyName with value $customValueName }
97
+ // to
98
+ $(name) { the key is %key% with value %value% }
99
+ $(name, customKeyName, customValueName) { the key is %customKeyName% with value %customValueName% }
100
+ ```
101
+ - **(Utilities)**: Added the functions `loadEnv`, `flattenObject`, and `sleep`.
102
+ - **(Utilities)**: Modified the `flattenObject` function to retain null and undefined values and provide better typing.
103
+ - **(Debug)**: Can now only be used from the `getInstance` method (subject to possible changes).
104
+ - **(Config)**: Converted to a singleton.
105
+ - **(Response)**: The `send` method is now limited to receiving `string|buffer`.
106
+ - **(Response)**: The `sendFile`, `sendFolder`, and `sendTemplate` methods now work with async/await.
107
+ - **(Response)**: The `POST.content` object will no longer be a `Map` when appropriate, but a `Request.POST.VarList` object.
108
+ - **(Response)**: The `POST.files` object will always have the type `Request.POST.FileList`.
109
+ - **(Request)**: The `GET` attribute is now `searchParams`.
110
+ - **(Request)**: Request body processing has been delegated to `BodyParser.ts`.
111
+ - **(Request)**: The type of search param is no longer a `Map`, but an object `{ [key: string]: string | undefined }`.
112
+ - **(WebSocket)**: The logic behind WebSocket reception was separated into `Chunk.ts`.
113
+ - **(WebSocket)**: `Chunk.ts` was optimized.
114
+ - **(Beta)**: `JsonWT` was converted to `JwtManager`.
115
+
116
+
117
+
118
+ # version (x.x.x)
119
+ ## 📒 Notes
120
+ ## ➕ Added
121
+ ## ❌ Removed
122
+ ## 🐞 Fixes
89
123
  ## ✏️ Changes
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "vortez",
3
- "version": "4.1.3",
4
- "description": "a module for http/s and ws/s servers",
3
+ "version": "5.0.0-dev.14",
4
+ "description": "a module for web server creation",
5
5
  "type": "module",
6
6
  "main": "build/Vortez.js",
7
7
  "scripts": {
8
- "dev": "npm run compile && tsc --watch",
9
- "test": "node tests/test.js",
10
- "compile": "rm -rf build && tsc",
11
- "dev.publish": "npm run compile && npm publish --tag Dev"
8
+ "compile": "bash scripts/compile.sh",
9
+ "test": "bash scripts/test.sh",
10
+ "publish": "bash scripts/publish.sh",
11
+ "dev": "bash scripts/dev.sh",
12
+ "dev.publish": "bash scripts/publish.sh --dev"
12
13
  },
13
14
  "author": {
14
15
  "name": "NetFeez",
@@ -32,13 +33,9 @@
32
33
  "README.md"
33
34
  ],
34
35
  "keywords": [
35
- "server",
36
- "core",
37
- "http",
38
- "https",
39
- "ws",
40
- "wss",
41
- "socket"
36
+ "web", "server",
37
+ "http", "https",
38
+ "ws", "wss", "websocket"
42
39
  ],
43
40
  "devDependencies": {
44
41
  "@types/node": "^20.14.12",
package/tests/debug.js CHANGED
@@ -1,6 +1,10 @@
1
- import Debug from "../build/Debug.js";
1
+ /// @ts-check
2
2
 
3
- Debug.log('Hola mundo');
3
+ import { Logger } from "../build/Vortez.js";
4
+
5
+ const Debug = Logger.Debug;
6
+
7
+ Debug.log('Hello world');
4
8
  Debug.log([
5
9
  'Prueba de envió de multiples datos',
6
10
  'Para saber el comportamiento'
@@ -11,7 +15,9 @@ const X = Debug.getInstance('_Debug');
11
15
  X.log('Prueba para ver si creando una instancia con una ID existente se devuelve la instancia con dicha ID');
12
16
  X.log('Prueba para ver si no se crea un archivo diferente con ID igual');
13
17
 
14
- const Y = Debug.getInstance('SEA', undefined, false);
18
+ const Y = Debug.getInstance('SEA', {
19
+ show: false
20
+ });
15
21
 
16
22
  Y.log('Prueba para verificar que no se muestra en consola si se inicializa con EnConsola = false');
17
23
 
package/tests/test.js CHANGED
@@ -1,70 +1,66 @@
1
- //@ts-check
1
+ /// @ts-check
2
2
 
3
- import Rule from "../build/Server/Rule.js";
4
- import Vortez, { Debug, Utilities } from "../build/Vortez.js";
3
+ import Vortez, { Logger, Utilities } from "../build/Vortez.js";
5
4
  import "./debug.js";
6
5
  import "./utilities.js";
7
6
 
8
- /* | HABILITAR VISTA EN CONSOLA DE LOS DEBUGS DE Vortez | */
9
- Debug.showAll = true;
10
- /* | CREANDO UN DEBUG PARA LA SALIDA DE LOS TESTS | */
11
- const $Test = Debug.getInstance('Test');
7
+ /* | ENABLING ALL THE Vortez LOGS IN CONSOLE | */
8
+ Logger.Debug.showAll = true;
9
+ /* | CREATING DEBUG INSTANCE TO THE TESTS | */
10
+ const debug = new Logger({ prefix: 'TEST' });
12
11
 
13
- /* | CARGANDO VARIABLES DE ENTORNO DE PRUEBA | */
12
+ /* | CREATING ENV VARIABLES FOR THE TESTS | */
14
13
 
15
14
  await Utilities.Env.load('tests/test.env');
15
+ // Utilities.Env.loadSync('tests/test.env');
16
16
 
17
- const HOST = process.env.HOST;
18
- const PORT = process.env.PORT ?
19
- Number(process.env.PORT)
20
- ? Number(process.env.PORT)
21
- : 5050 : 5050;
22
- const WEBSOCKET_URL = process.env['REMOTE-WS'] ?? `ws://${HOST ?? 'localhost'}:${PORT}`;
23
-
24
- /* | INICIANDO SERVIDOR | */
17
+ /* | CREATING SERVER | */
25
18
  const server = new Vortez({ port: 3000 });
26
19
 
27
- /* | PRUEBAS DE REGLAS FILE | */
28
- server.addFile('/File', 'changes.md')
29
- server.addFile('/favicon.ico', 'Global/Source/Logo_SM_960.png');
20
+ /* | FILE RULE TEST | */
21
+ server.router.addFile('/File', 'changes.md')
22
+ server.router.addFile('/favicon.ico', 'global/Source/Logo_SM_960.png');
30
23
 
31
- /* | PRUEBAS DE REGLAS FILE usando AUTH | */
32
- server.addFile('/FileWA', 'changes.md',
33
- (Request) => (Request.searchParams.Auth != null && Request.searchParams.Auth == 'AuthYes')
34
- )
24
+ /* | FILE RULE TEST USING AUTH EXEC | */
25
+ server.router.addFile('/FileWA', 'changes.md')
26
+ .use(async (request, Response, next) => {
27
+ const { Auth } = request.searchParams;
28
+ if (Auth === 'AuthYes') return next();
29
+ throw new Vortez.ServerError('No authorized', 401);
30
+ });
35
31
 
36
- /* | CREANDO REGLAS CON EL CONSTRUCTOR Rule | */
37
- server.addRules(
38
- new Vortez.Rule('File', 'GET', '/MyFile/*', 'Test/Test.js', () => true)
32
+ /* | CREATING RULES WITH THE RULE CONSTRUCTOR | */
33
+ server.router.addRules(
34
+ new Vortez.Router.HttpRule('GET', '/MyFile/*', (Rq, Rs) => Rs.sendFile('Test/Test.js'))
39
35
  );
40
36
 
41
- /* | PRUEBAS DE REGLAS FOLDER | */
42
- server.addFolder('/Folder', '.debug');
37
+ /* | FOLDER RULES TEST | */
38
+ server.router.addFolder('/Folder', '.debug');
43
39
 
44
- /* | PRUEBAS DE REGLAS ACTION | */
45
- server.addAction('ALL', '/', (Rq, Rs) => {
46
- Rs.sendTemplate('tests/test.vhtml', {
40
+ /* | ACTION RULES TEST | */
41
+ server.router.addAction('ALL', '/', (Rq, Rs) => {
42
+ return Rs.sendTemplate('tests/test.vhtml', {
47
43
  Tittle: '[NetFeez-Labs] · Tests',
48
44
  Sources: {
49
45
  File: '/File',
50
46
  FileWithAuthFunction_NoAuth: '/FileWA',
51
47
  FileWithAuthFunction_Auth: '/FileWA?Auth=AuthYes',
52
48
  Folder: '/Folder',
53
- RuleParams: '/RuleParams/algo1/otro2/nose3/XD',
49
+ RuleParams: '/RuleParams/param1/param2/param3/XD',
54
50
  WebSocket: '/WebSocket'
55
51
  }
56
52
  });
57
53
  });
58
54
 
59
- /* | PRUEBAS DE URL PARAMS | */
60
- server.addAction('ALL', '/RuleParams/$?param1/$?b/$?c/*', (Rq, Rs) => {
55
+ /* | URL RULE PARAMS TEST | */
56
+ server.router.addAction('ALL', '/RuleParams/$?param1/$?b/$?c/*', (Rq, Rs) => {
61
57
  Rs.sendJson({
62
58
  Url: Rq.url,
63
59
  RuleParams: Rq.ruleParams
64
60
  })
65
61
  });
66
62
 
67
- /* | PRUEBAS DE REGLAS WEB-SOCKET | */
63
+ /* | WEBSOCKET RULE TEST | */
68
64
  /**
69
65
  * @typedef {import('../build/Server/WebSocket/WebSocket.js').WebSocket} WebSocket
70
66
  */
@@ -84,13 +80,13 @@ function broadCast(message, exclude = null) {
84
80
  })
85
81
  }
86
82
 
87
- server.addAction('ALL', 'WebSocket', (Rq, Rs) => {
88
- Rs.sendTemplate('tests/websocket.vhtml', {
89
- Host: `${WEBSOCKET_URL}/WebSocket`
83
+ server.router.addAction('ALL', 'WebSocket', (Rq, Rs) => {
84
+ return Rs.sendTemplate('tests/websocket.vhtml', {
85
+ Host: `/WebSocket`
90
86
  });
91
87
  });
92
88
 
93
- server.addWebSocket('/WebSocket/$?username', (request, socket) => {
89
+ server.router.addWebSocket('/WebSocket/$?username', (request, socket) => {
94
90
  const username = request.ruleParams.username;
95
91
  if (!username) {
96
92
  socket.send('error: no username');
@@ -104,26 +100,32 @@ server.addWebSocket('/WebSocket/$?username', (request, socket) => {
104
100
  }
105
101
  usernames.add(username)
106
102
  clients.add(socket);
107
- $Test.log("[WebSocket]", "new client", username);
103
+ debug.log("[WebSocket]", "new client", username);
108
104
 
109
- socket.send("server: hallo");
110
- broadCast('server: nuevo cliente: ' + username, socket);
105
+ socket.send("[server] hallo");
106
+ broadCast('[server] new client: ' + username, socket);
111
107
 
112
108
  socket.on('message', (data, info) => {
113
109
  if (info.opCode !== 0x1) return;
114
110
  const message = username + ': ' + data.toString();
115
- $Test.log(['[WebSocket]', message]);
111
+ debug.log(['[WebSocket]', message]);
116
112
  broadCast(message, socket);
117
113
  });
118
114
  socket.on('error', (Error) => {
119
- $Test.log('[WebSocket-Error]: ' + Error.message);
115
+ debug.log('[WebSocket-Error]: ' + Error.message);
120
116
  });
121
117
  socket.on('finish', () => {
122
118
  clients.delete(socket);
123
119
  usernames.delete(username);
124
- broadCast('server: cliente desconectado: ' + username);
125
- $Test.log('[WebSocket-Finish]: client disconnected')
120
+ broadCast('[server] client disconnected: ' + username);
121
+ debug.log('[WebSocket-Finish]: client disconnected')
126
122
  });
123
+ }).use((request, client, next) => {
124
+ const { username } = request.ruleParams;
125
+ if (!username) return next(new Vortez.ServerError('no username', 400));
126
+ if (username === 'system') return next(new Vortez.ServerError('you cant use system as username', 400));
127
+ return next();
127
128
  });
128
- server.start();
129
- // new Rule('Action', 'POST', '/a/b/c/d/e/$f/*', () => {});
129
+ const cli = new Vortez.ServerDebug(server);
130
+ cli.start();
131
+ server.start();
@@ -1,5 +1,5 @@
1
1
  //@ts-check
2
- import Utilities from "../build/Utilities/Utilities.js";
2
+ import Utilities from "../build/utilities/Utilities.js";
3
3
 
4
4
  try {
5
5
  const toFlatten = {
package/Notes.md DELETED
@@ -1,12 +0,0 @@
1
- [Server]
2
- - Separar la lógica de enrutamiento en funciones mas pequeñas
3
- - Crear funciones para las comprobaciones de los condicionales
4
- ternarios para mejorar la legibilidad
5
- - Reconsiderar el uso de Session para que sea opcional para el usuario
6
- - Poner el uso del Debug.Log como opcional al usuario para evitar la
7
- creación de demasiados archivos o eliminar logs viejos
8
- - Eliminar comentarios en el futuro: [Server/Server.js] LN(249)
9
- - Añadir comprobaciones para AddFile, AddFolder, AddAction, AddWebSocket: [Server/Server.js]
10
-
11
- [Bugs]
12
- - Al usar WSL para levantar el servidor en una carpeta de windows no cargan las carpetas por que no encuentra la plantilla Folder.vhtml.
@@ -1 +0,0 @@
1
- {"version":3,"file":"Mail.js","sourceRoot":"","sources":["../../src/Beta/Mail.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;AAE7E,MAAM,OAAO,IAAI;IACL,IAAI,CAAS;IACb,IAAI,CAAS;IACb,MAAM,CAAU;IAChB,WAAW,CAAU;IACrB,QAAQ,CAAS;IACjB,QAAQ,CAAS;IACjB,KAAK,CAAS;IACtB;;;OAGG;IACH,YAAmB,OAA2B;QAC1C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;QAC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AC,uCAAuC,CAAC,CAAC;wBACtD,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;wBAC3D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;wBACrB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;wBACrE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBACzB,CAAC,CAAC,CAAC;oBACH,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS,QAAQ,CAAC,CAAC;gBACzC,CAAC;gBAED,6BAA6B;gBAC7B,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAC1B,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAsBD,eAAe,IAAI,CAAC"}
package/build/Config.js DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * @author NetFeez <codefeez.dev@gmail.com>
3
- * @description add the config manager to the Vortez.
4
- * @license Apache-2.0
5
- */
6
- import Debug from "./Debug.js";
7
- import LoggerManager from "./LoggerManager/LoggerManager.js";
8
- import Utilities from "./Utilities/Utilities.js";
9
- export class Config {
10
- templates;
11
- host;
12
- port;
13
- logger;
14
- ssl;
15
- static instance;
16
- constructor(options = {}) {
17
- this.host = options.host ?? 'localhost';
18
- this.port = options.port ?? 80;
19
- this.ssl = options.ssl ?? null;
20
- this.logger = options.logger ?? LoggerManager.getInstance();
21
- this.templates = options.templates ?? Config.defaultTemplates();
22
- }
23
- get showAll() { return Debug.showAll; }
24
- set showAll(value) { Debug.showAll = value; }
25
- static defaultTemplates() {
26
- return {
27
- folder: Utilities.Path.relative('./global/Template/Folder.vhtml'),
28
- error: Utilities.Path.relative('./global/Template/Error.vhtml')
29
- };
30
- }
31
- }
32
- export default Config;
33
- //# sourceMappingURL=Config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.js","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,aAAa,MAAM,kCAAkC,CAAC;AAC7D,OAAO,SAAS,MAAM,0BAA0B,CAAC;AAEjD,MAAM,OAAO,MAAM;IACR,SAAS,CAAmB;IAC5B,IAAI,CAAS;IACb,IAAI,CAAS;IACb,MAAM,CAAgB;IACtB,GAAG,CAA2B;IAC9B,MAAM,CAAC,QAAQ,CAAS;IAC/B,YAAmB,UAA0B,EAAE;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;IACD,IAAW,OAAO,KAAc,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,IAAW,OAAO,CAAC,KAAc,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;IACtD,MAAM,CAAC,gBAAgB;QAC1B,OAAO;YACH,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YACjE,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC;SAClE,CAAC;IACN,CAAC;CACJ;AAuBD,eAAe,MAAM,CAAC"}
@@ -1,57 +0,0 @@
1
- /**
2
- * @author NetFeez <codefeez.dev@gmail.com>
3
- * @description contains the basic functionalities for module NetFeez-Labs tools
4
- * @license Apache-2.0
5
- */
6
- export declare class ConsoleUI {
7
- private static formatString;
8
- private static rgbString;
9
- private static formats;
10
- /**
11
- * delete text formats and colors.
12
- * @param text the text to clean.
13
- * @param prefix the prefix.
14
- */
15
- static cleanFormat(text: string, prefix?: string): string;
16
- /**
17
- * colors the text.
18
- * @param text the text to color.
19
- * @param prefix the prefix.
20
- * The default prefix is `&`
21
- * Colors and formats
22
- * - Formats:
23
- * - - `N`: Bold
24
- * - - `S`: Underline
25
- * - - `P`: Blink
26
- * - - `I`: Invert
27
- * - - `R`: Reset
28
- * - `B`: Used before a color to refer to the background.
29
- * - - Example: `&B2Hello` will change the background of the text to green.
30
- * - `C`: Used before a color to refer to the text.
31
- * - - Example: `&C2Hello` will change the color of the text to green.
32
- * - Colors:
33
- * - - `(R,G,B)`: an RGB color, replace R, G, and B with their respective values.
34
- * - - - No spaces after the `,`
35
- * - - - Example: `&B(0,255,0)Hello` will change the background of the text to green.
36
- * - - - Example: `&C(0,255,0)Hello` will change the color of the text to green.
37
- * - - `0`: Black
38
- * - - `1`: White
39
- * - - `2`: Green
40
- * - - `3`: Cyan
41
- * - - `4`: Blue
42
- * - - `5`: Magenta
43
- * - - `6`: Red
44
- * - - `7`: Yellow
45
- */
46
- static formatText(text: string, prefix?: string): string;
47
- /**
48
- * sends a message to the user through the console
49
- * @param message the message(s) you want to send to the user
50
- * @param newLine whether there is a line break or not
51
- */
52
- static send(message: string | string[], newLine?: boolean): void;
53
- }
54
- export declare namespace ConsoleUI {
55
- type formatKey = ('N' | 'S' | 'P' | 'I' | 'R' | 'C0' | 'C1' | 'C2' | 'C3' | 'C4' | 'C5' | 'C6' | 'C7' | 'C' | 'B0' | 'B1' | 'B2' | 'B3' | 'B4' | 'B5' | 'B6' | 'B7' | 'B');
56
- }
57
- export default ConsoleUI;