@zenofolio/hyper-decor 1.0.73 → 1.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -12
- package/dist/common/bootstrap.js +6 -1
- package/dist/lib/server/decorators/HyperController.js +2 -14
- package/package.json +10 -2
- package/scripts/clean.js +1 -1
- package/vitest.config.mjs +30 -33
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @zenofolio/hyper-decor
|
|
1
|
+
# @zenofolio/hyper-decor
|
|
2
2
|
|
|
3
3
|
Librería de decoradores para [HyperExpress](https://github.com/kartikk221/hyper-express).
|
|
4
4
|
|
|
@@ -93,17 +93,6 @@ async upload(
|
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
96
|
-
## Rendimiento
|
|
97
|
-
|
|
98
|
-
El sistema está diseñado para introducir la mínima latencia posible sobre HyperExpress.
|
|
99
|
-
|
|
100
|
-
| Escenario | Raw HyperExpress | @zenofolio/hyper-decor |
|
|
101
|
-
| :--- | :--- | :--- |
|
|
102
|
-
| **GET Básico** | 27,150 req/s | 26,660 req/s |
|
|
103
|
-
| **Con Transformación**| 18,120 req/s | 18,335 req/s |
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
96
|
## OpenAPI y DTOs
|
|
108
97
|
|
|
109
98
|
Es posible utilizar clases para definir los esquemas de datos que se reflejarán en la documentación OpenAPI generada.
|
package/dist/common/bootstrap.js
CHANGED
|
@@ -27,7 +27,12 @@ function createApplication(application) {
|
|
|
27
27
|
throw new Error("Application must be decorated with @HyperApp");
|
|
28
28
|
}
|
|
29
29
|
const logger = metadata.logger || console.log;
|
|
30
|
-
const logWrapper = (space, msg) =>
|
|
30
|
+
const logWrapper = (space, msg) => {
|
|
31
|
+
var _a;
|
|
32
|
+
if ((_a = metadata.logs) === null || _a === void 0 ? void 0 : _a[space]) {
|
|
33
|
+
logger(`[${space.toUpperCase()}] ${msg}`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
31
36
|
const appServer = yield (0, prepare_helper_1.prepareApplication)(metadata, application, logWrapper);
|
|
32
37
|
const appInstance = tsyringe_1.container.resolve(application);
|
|
33
38
|
const appProxy = new Proxy(appInstance, {
|
|
@@ -8,20 +8,8 @@ const metadata_1 = require("./metadata");
|
|
|
8
8
|
*/
|
|
9
9
|
function HyperController(options) {
|
|
10
10
|
return (Target) => {
|
|
11
|
-
var _a;
|
|
12
11
|
const isString = typeof options === "string";
|
|
13
|
-
const data = {
|
|
14
|
-
|
|
15
|
-
path: isString ? options : (_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : "/",
|
|
16
|
-
};
|
|
17
|
-
if (!isString && options) {
|
|
18
|
-
if (options.roles)
|
|
19
|
-
data.roles = options.roles;
|
|
20
|
-
if (options.scopes)
|
|
21
|
-
data.scopes = options.scopes;
|
|
22
|
-
if (options.imports)
|
|
23
|
-
data.imports = options.imports;
|
|
24
|
-
}
|
|
25
|
-
metadata_1.HyperMeta.set(Target, undefined, data);
|
|
12
|
+
const data = isString ? { path: options } : (options !== null && options !== void 0 ? options : {});
|
|
13
|
+
metadata_1.HyperMeta.set(Target, undefined, Object.assign({ type: "controller" }, data));
|
|
26
14
|
};
|
|
27
15
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenofolio/hyper-decor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.75",
|
|
4
4
|
"description": "Project core with utilities and features",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "zenozaga",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/zenofolio/hyper-decor.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/zenofolio/hyper-decor/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/zenofolio/hyper-decor#readme",
|
|
8
16
|
"scripts": {
|
|
9
17
|
"test": "vitest run",
|
|
10
18
|
"test:watch": "vitest",
|
|
11
19
|
"test:ui": "vitest --ui",
|
|
12
|
-
"test:server": "vitest tests/server.bench.ts",
|
|
13
20
|
"build": "tsc",
|
|
14
21
|
"publish": "npm run build && npm publish --access public"
|
|
15
22
|
},
|
|
@@ -26,6 +33,7 @@
|
|
|
26
33
|
"vitest": "^4.0.18"
|
|
27
34
|
},
|
|
28
35
|
"dependencies": {
|
|
36
|
+
"@zenofolio/hyper-decor": "file:",
|
|
29
37
|
"core-decorators": "^0.20.0",
|
|
30
38
|
"eventemitter3": "^5.0.4",
|
|
31
39
|
"file-type": "^19.5.0",
|
package/scripts/clean.js
CHANGED
package/vitest.config.mjs
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import swc from 'unplugin-swc';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
test: {
|
|
6
|
-
globals: true,
|
|
7
|
-
environment: 'node',
|
|
8
|
-
include: ['tests/**/*.{test,spec}.ts'],
|
|
9
|
-
poolOptions: {
|
|
10
|
-
threads: {
|
|
11
|
-
singleThread: true,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}),
|
|
32
|
-
],
|
|
33
|
-
});
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import swc from 'unplugin-swc';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
test: {
|
|
6
|
+
globals: true,
|
|
7
|
+
environment: 'node',
|
|
8
|
+
include: ['tests/**/*.{test,spec}.ts'],
|
|
9
|
+
poolOptions: {
|
|
10
|
+
threads: {
|
|
11
|
+
singleThread: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
plugins: [
|
|
16
|
+
swc.vite({
|
|
17
|
+
jsc: {
|
|
18
|
+
parser: {
|
|
19
|
+
syntax: 'typescript',
|
|
20
|
+
decorators: true,
|
|
21
|
+
dynamicImport: true,
|
|
22
|
+
},
|
|
23
|
+
transform: {
|
|
24
|
+
legacyDecorator: true,
|
|
25
|
+
decoratorMetadata: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
});
|