@zenofolio/hyper-decor 1.0.75 → 1.0.81

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 (117) hide show
  1. package/README.md +42 -0
  2. package/dist/__internals/helpers/prepare.helper.js +15 -6
  3. package/dist/common/testing.d.ts +56 -0
  4. package/dist/common/testing.js +193 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/lib/server/decorators/HyperService.d.ts +2 -1
  8. package/dist/lib/server/decorators/types.d.ts +1 -1
  9. package/package.json +5 -1
  10. package/dist/__internals/creators/request.creator.d.ts +0 -2
  11. package/dist/__internals/creators/request.creator.js +0 -173
  12. package/dist/__internals/creators/routes.creator.d.ts +0 -9
  13. package/dist/__internals/creators/routes.creator.js +0 -39
  14. package/dist/__internals/decorator-base.d.ts +0 -30
  15. package/dist/__internals/decorator-base.js +0 -122
  16. package/dist/__internals/helpers/imports.helper.d.ts +0 -8
  17. package/dist/__internals/helpers/imports.helper.js +0 -92
  18. package/dist/__internals/helpers/tree.helper.d.ts +0 -36
  19. package/dist/__internals/helpers/tree.helper.js +0 -81
  20. package/dist/__internals/stores/metadata.store.d.ts +0 -15
  21. package/dist/__internals/stores/metadata.store.js +0 -37
  22. package/dist/__internals/stores/service.store.d.ts +0 -1
  23. package/dist/__internals/stores/service.store.js +0 -4
  24. package/dist/decorators/File.d.ts +0 -37
  25. package/dist/decorators/File.js +0 -167
  26. package/dist/decorators/Http.d.ts +0 -22
  27. package/dist/decorators/Http.js +0 -45
  28. package/dist/decorators/HyperApp.d.ts +0 -3
  29. package/dist/decorators/HyperApp.js +0 -96
  30. package/dist/decorators/HyperController.d.ts +0 -2
  31. package/dist/decorators/HyperController.js +0 -20
  32. package/dist/decorators/HyperModule.d.ts +0 -5
  33. package/dist/decorators/HyperModule.js +0 -14
  34. package/dist/decorators/HyperService.d.ts +0 -15
  35. package/dist/decorators/HyperService.js +0 -29
  36. package/dist/decorators/Messaging.d.ts +0 -10
  37. package/dist/decorators/Messaging.js +0 -22
  38. package/dist/decorators/Middleware.d.ts +0 -25
  39. package/dist/decorators/Middleware.js +0 -65
  40. package/dist/decorators/Output.d.ts +0 -9
  41. package/dist/decorators/Output.js +0 -18
  42. package/dist/decorators/Pass.d.ts +0 -15
  43. package/dist/decorators/Pass.js +0 -32
  44. package/dist/decorators/Role.d.ts +0 -6
  45. package/dist/decorators/Role.js +0 -34
  46. package/dist/decorators/Routes.d.ts +0 -15
  47. package/dist/decorators/Routes.js +0 -21
  48. package/dist/decorators/Scope.d.ts +0 -6
  49. package/dist/decorators/Scope.js +0 -25
  50. package/dist/decorators/Transform.d.ts +0 -14
  51. package/dist/decorators/Transform.js +0 -18
  52. package/dist/decorators/index.d.ts +0 -14
  53. package/dist/decorators/index.js +0 -30
  54. package/dist/decorators/types.d.ts +0 -124
  55. package/dist/decorators/types.js +0 -6
  56. package/dist/exeptions/DuplicateControllerPathException.d.ts +0 -14
  57. package/dist/exeptions/DuplicateControllerPathException.js +0 -12
  58. package/dist/exeptions/DuplicatedException.d.ts +0 -8
  59. package/dist/exeptions/DuplicatedException.js +0 -12
  60. package/dist/exeptions/DuplicatedHandlerException.d.ts +0 -4
  61. package/dist/exeptions/DuplicatedHandlerException.js +0 -12
  62. package/dist/exeptions/HyperException.d.ts +0 -8
  63. package/dist/exeptions/HyperException.js +0 -14
  64. package/dist/exeptions/HyperFileException.d.ts +0 -4
  65. package/dist/exeptions/HyperFileException.js +0 -12
  66. package/dist/exeptions/MethodNotFountException.d.ts +0 -4
  67. package/dist/exeptions/MethodNotFountException.js +0 -12
  68. package/dist/exeptions/NotPropertyException.d.ts +0 -6
  69. package/dist/exeptions/NotPropertyException.js +0 -16
  70. package/dist/exeptions/NotRoleException.d.ts +0 -6
  71. package/dist/exeptions/NotRoleException.js +0 -17
  72. package/dist/exeptions/NotScopeException.d.ts +0 -7
  73. package/dist/exeptions/NotScopeException.js +0 -18
  74. package/dist/exeptions/WrongPlaceException.d.ts +0 -8
  75. package/dist/exeptions/WrongPlaceException.js +0 -21
  76. package/dist/exeptions/index.d.ts +0 -8
  77. package/dist/exeptions/index.js +0 -18
  78. package/dist/exeptions/types.d.ts +0 -1
  79. package/dist/exeptions/types.js +0 -2
  80. package/dist/lib/openapi/collectors/param.collector.d.ts +0 -2
  81. package/dist/lib/openapi/collectors/param.collector.js +0 -64
  82. package/dist/lib/openapi/decorators/api-bearer-auth.decorator.d.ts +0 -2
  83. package/dist/lib/openapi/decorators/api-bearer-auth.decorator.js +0 -10
  84. package/dist/lib/openapi/decorators/api-method.decorator.d.ts +0 -3
  85. package/dist/lib/openapi/decorators/api-method.decorator.js +0 -11
  86. package/dist/lib/openapi/decorators/api-parameter.decorator.d.ts +0 -3
  87. package/dist/lib/openapi/decorators/api-parameter.decorator.js +0 -10
  88. package/dist/lib/openapi/decorators/api-request-body.decorator.d.ts +0 -3
  89. package/dist/lib/openapi/decorators/api-request-body.decorator.js +0 -10
  90. package/dist/lib/openapi/decorators/api-response.decorator.d.ts +0 -3
  91. package/dist/lib/openapi/decorators/api-response.decorator.js +0 -10
  92. package/dist/lib/openapi/decorators/api-security.decorator.d.ts +0 -3
  93. package/dist/lib/openapi/decorators/api-security.decorator.js +0 -10
  94. package/dist/lib/openapi/decorators/api-tag.decorator.d.ts +0 -3
  95. package/dist/lib/openapi/decorators/api-tag.decorator.js +0 -13
  96. package/dist/lib/openapi/decorators/index.d.ts +0 -7
  97. package/dist/lib/openapi/decorators/index.js +0 -23
  98. package/dist/lib/openapi/helpers/index.d.ts +0 -7
  99. package/dist/lib/openapi/helpers/index.js +0 -23
  100. package/dist/lib/openapi/helpers/method.helper.d.ts +0 -3
  101. package/dist/lib/openapi/helpers/method.helper.js +0 -20
  102. package/dist/lib/openapi/helpers/openapi.helper.d.ts +0 -7
  103. package/dist/lib/openapi/helpers/openapi.helper.js +0 -51
  104. package/dist/lib/openapi/helpers/parameter.helper.d.ts +0 -3
  105. package/dist/lib/openapi/helpers/parameter.helper.js +0 -16
  106. package/dist/lib/openapi/helpers/request-body.helper.d.ts +0 -3
  107. package/dist/lib/openapi/helpers/request-body.helper.js +0 -9
  108. package/dist/lib/openapi/helpers/response.helper.d.ts +0 -3
  109. package/dist/lib/openapi/helpers/response.helper.js +0 -18
  110. package/dist/lib/openapi/helpers/security.helper.d.ts +0 -3
  111. package/dist/lib/openapi/helpers/security.helper.js +0 -17
  112. package/dist/lib/openapi/helpers/tag.helper.d.ts +0 -3
  113. package/dist/lib/openapi/helpers/tag.helper.js +0 -10
  114. package/dist/stores/index.d.ts +0 -1
  115. package/dist/stores/index.js +0 -17
  116. package/dist/stores/scope.store.d.ts +0 -14
  117. package/dist/stores/scope.store.js +0 -29
@@ -1,7 +0,0 @@
1
- export * from "./method.helper";
2
- export * from "./parameter.helper";
3
- export * from "./request-body.helper";
4
- export * from "./response.helper";
5
- export * from "./security.helper";
6
- export * from "./tag.helper";
7
- export * from "./openapi.helper";
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./method.helper"), exports);
18
- __exportStar(require("./parameter.helper"), exports);
19
- __exportStar(require("./request-body.helper"), exports);
20
- __exportStar(require("./response.helper"), exports);
21
- __exportStar(require("./security.helper"), exports);
22
- __exportStar(require("./tag.helper"), exports);
23
- __exportStar(require("./openapi.helper"), exports);
@@ -1,3 +0,0 @@
1
- import "reflect-metadata";
2
- import { Operation } from "../types";
3
- export declare function apimethod(target: any, propertyKey: string | symbol, options: Partial<Operation>): void;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apimethod = apimethod;
4
- require("reflect-metadata");
5
- const constants_1 = require("../constants");
6
- const response_helper_1 = require("./response.helper");
7
- function apimethod(target, propertyKey, options) {
8
- if (options.summary) {
9
- Reflect.defineMetadata(constants_1.METHOD_SUMMARY, options.summary, target, propertyKey);
10
- }
11
- if (options.operationId) {
12
- Reflect.defineMetadata(constants_1.METHOD_OPERATION_ID, options.operationId, target, propertyKey);
13
- }
14
- if (options.tags) {
15
- Reflect.defineMetadata(constants_1.METHOD_TAGS, options.tags, target, propertyKey);
16
- }
17
- if (options.responses) {
18
- (0, response_helper_1.apiResponse)(target, propertyKey, options.responses);
19
- }
20
- }
@@ -1,7 +0,0 @@
1
- import { OpenAPIDocument } from "../types";
2
- /**
3
- * Generates a complete OpenAPI 3.0.0 document from a HyperApp class.
4
- *
5
- * @param App The HyperApp class (usually decorated with @HyperApp)
6
- */
7
- export declare function getOpenAPI(App: any): OpenAPIDocument;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOpenAPI = getOpenAPI;
4
- const tree_helper_1 = require("../../../__internals/helpers/tree.helper");
5
- /**
6
- * Generates a complete OpenAPI 3.0.0 document from a HyperApp class.
7
- *
8
- * @param App The HyperApp class (usually decorated with @HyperApp)
9
- */
10
- function getOpenAPI(App) {
11
- var _a;
12
- const tree = (0, tree_helper_1.getAppTree)(App);
13
- const appMeta = tree.app;
14
- const doc = {
15
- openapi: "3.0.0",
16
- info: {
17
- title: appMeta.name || "API Documentation",
18
- version: appMeta.version || "1.0.0",
19
- description: appMeta.description || "",
20
- },
21
- paths: {},
22
- components: Object.assign({ schemas: {}, securitySchemes: {} }, (_a = tree.openapi) === null || _a === void 0 ? void 0 : _a.components)
23
- };
24
- // Populate paths from the flattened tree paths
25
- Object.entries(tree.paths).forEach(([path, routes]) => {
26
- // Convert /v1/user/ to /v1/user (remove trailing slash except for root)
27
- const normalizedPath = path.length > 1 && path.endsWith("/") ? path.slice(0, -1) : path;
28
- if (!doc.paths[normalizedPath]) {
29
- doc.paths[normalizedPath] = {};
30
- }
31
- const pathItem = doc.paths[normalizedPath];
32
- routes.forEach(route => {
33
- var _a;
34
- const method = route.method.toLowerCase();
35
- // Merge route-level OpenAPI metadata
36
- const operation = Object.assign(Object.assign({}, route.openapi), { responses: ((_a = route.openapi) === null || _a === void 0 ? void 0 : _a.responses) || {
37
- "200": { description: "Successful operation" }
38
- } });
39
- // Ensure operationId if missing for better client generation
40
- if (!operation.operationId) {
41
- operation.operationId = `${route.propertyKey}`;
42
- }
43
- pathItem[method] = operation;
44
- });
45
- });
46
- // Apply any global tree processors that might have added data to tree.openapi
47
- if (tree.openapi) {
48
- Object.assign(doc, tree.openapi);
49
- }
50
- return doc;
51
- }
@@ -1,3 +0,0 @@
1
- import 'reflect-metadata';
2
- import { OpenApiParameter } from '../types';
3
- export declare function apiParameter(target: any, propertyKey: string, options: OpenApiParameter): void;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiParameter = apiParameter;
4
- require("reflect-metadata");
5
- const constants_1 = require("../constants");
6
- function apiParameter(target, propertyKey, options) {
7
- const existingParameters = Reflect.getMetadata(constants_1.PARAMETERS, target, propertyKey) || [];
8
- existingParameters.push({
9
- name: options.name,
10
- in: options.in,
11
- required: options.required || false,
12
- description: options.description,
13
- schema: options.schema,
14
- });
15
- Reflect.defineMetadata(constants_1.PARAMETERS, existingParameters, target, propertyKey);
16
- }
@@ -1,3 +0,0 @@
1
- import 'reflect-metadata';
2
- import { RequestBody } from '../types';
3
- export declare function apiRequestBody(target: any, propertyKey: string, options: RequestBody): void;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiRequestBody = apiRequestBody;
4
- require("reflect-metadata");
5
- const constants_1 = require("../constants");
6
- function apiRequestBody(target, propertyKey, options) {
7
- Reflect.defineMetadata(constants_1.REQUEST_BODY_DESCRIPTION, options.description, target, propertyKey);
8
- Reflect.defineMetadata(constants_1.REQUEST_BODY_CONTENT, options.content, target, propertyKey);
9
- }
@@ -1,3 +0,0 @@
1
- import "reflect-metadata";
2
- import { OpenApiResponses } from "../types";
3
- export declare function apiResponse(target: any, propertyKey: string | symbol, options: OpenApiResponses): void;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiResponse = apiResponse;
4
- require("reflect-metadata");
5
- const constants_1 = require("../constants");
6
- function apiResponse(target, propertyKey, options) {
7
- const existingResponses = Reflect.getMetadata(constants_1.RESPONSES, target, propertyKey) || {};
8
- for (const key in options) {
9
- if (options.hasOwnProperty(key)) {
10
- const response = options[key];
11
- existingResponses[key] = {
12
- description: response.description,
13
- content: response.content,
14
- };
15
- }
16
- }
17
- Reflect.defineMetadata(constants_1.RESPONSES, existingResponses, target, propertyKey);
18
- }
@@ -1,3 +0,0 @@
1
- import 'reflect-metadata';
2
- import { SecurityRequirement } from '../types';
3
- export declare function apiSecurity(target: any, options: SecurityRequirement, propertyKey?: string): void;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiSecurity = apiSecurity;
4
- require("reflect-metadata");
5
- const constants_1 = require("../constants");
6
- function apiSecurity(target, options, propertyKey) {
7
- const existingSecurity = propertyKey
8
- ? Reflect.getMetadata(constants_1.SECURITY, target, propertyKey) || []
9
- : Reflect.getMetadata(constants_1.SECURITY, target) || [];
10
- existingSecurity.push(options);
11
- if (propertyKey) {
12
- Reflect.defineMetadata(constants_1.SECURITY, existingSecurity, target, propertyKey);
13
- }
14
- else {
15
- Reflect.defineMetadata(constants_1.SECURITY, existingSecurity, target);
16
- }
17
- }
@@ -1,3 +0,0 @@
1
- import 'reflect-metadata';
2
- import { Tag } from '../types';
3
- export declare function apiTag(target: any, options: Tag): void;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiTag = apiTag;
4
- require("reflect-metadata");
5
- const constants_1 = require("../constants");
6
- function apiTag(target, options) {
7
- const existingTags = Reflect.getMetadata(constants_1.TAGS, target) || [];
8
- existingTags.push({ name: options.name, description: options.description });
9
- Reflect.defineMetadata(constants_1.TAGS, existingTags, target);
10
- }
@@ -1 +0,0 @@
1
- export * from "./scope.store";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./scope.store"), exports);
@@ -1,14 +0,0 @@
1
- import { ScopeMap } from "../decorators";
2
- /**
3
- * This class is a store for the scopes that are defined in the application.
4
- *
5
- */
6
- export declare class ScopeStore {
7
- private static scopes;
8
- static add(scope: ScopeMap): void;
9
- static addAll(scopes: ScopeMap[]): void;
10
- static getScopes(): ScopeMap[];
11
- static getScopeNames(): string[];
12
- static isEmpty(): boolean;
13
- static clear(): void;
14
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScopeStore = void 0;
4
- /**
5
- * This class is a store for the scopes that are defined in the application.
6
- *
7
- */
8
- class ScopeStore {
9
- static add(scope) {
10
- this.scopes.set(scope.scope, scope); // Evita duplicados basados en el nombre del scope
11
- }
12
- static addAll(scopes) {
13
- scopes.forEach((scope) => this.add(scope));
14
- }
15
- static getScopes() {
16
- return Array.from(this.scopes.values());
17
- }
18
- static getScopeNames() {
19
- return Array.from(this.scopes.keys());
20
- }
21
- static isEmpty() {
22
- return this.scopes.size === 0;
23
- }
24
- static clear() {
25
- this.scopes.clear();
26
- }
27
- }
28
- exports.ScopeStore = ScopeStore;
29
- ScopeStore.scopes = new Map();