@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 CHANGED
@@ -1,4 +1,4 @@
1
- # @zenofolio/hyper-decor (v1.0.72)
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.
@@ -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) => logger(`[${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
- type: "controller",
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.73",
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
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
 
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
- benchmark: {
15
- include: ['tests/bench/**/*.{bench}.ts'],
16
- }
17
- },
18
- plugins: [
19
- swc.vite({
20
- jsc: {
21
- parser: {
22
- syntax: 'typescript',
23
- decorators: true,
24
- dynamicImport: true,
25
- },
26
- transform: {
27
- legacyDecorator: true,
28
- decoratorMetadata: true,
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
+ });