@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.
- package/README.md +42 -0
- package/dist/__internals/helpers/prepare.helper.js +15 -6
- package/dist/common/testing.d.ts +56 -0
- package/dist/common/testing.js +193 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/server/decorators/HyperService.d.ts +2 -1
- package/dist/lib/server/decorators/types.d.ts +1 -1
- package/package.json +5 -1
- package/dist/__internals/creators/request.creator.d.ts +0 -2
- package/dist/__internals/creators/request.creator.js +0 -173
- package/dist/__internals/creators/routes.creator.d.ts +0 -9
- package/dist/__internals/creators/routes.creator.js +0 -39
- package/dist/__internals/decorator-base.d.ts +0 -30
- package/dist/__internals/decorator-base.js +0 -122
- package/dist/__internals/helpers/imports.helper.d.ts +0 -8
- package/dist/__internals/helpers/imports.helper.js +0 -92
- package/dist/__internals/helpers/tree.helper.d.ts +0 -36
- package/dist/__internals/helpers/tree.helper.js +0 -81
- package/dist/__internals/stores/metadata.store.d.ts +0 -15
- package/dist/__internals/stores/metadata.store.js +0 -37
- package/dist/__internals/stores/service.store.d.ts +0 -1
- package/dist/__internals/stores/service.store.js +0 -4
- package/dist/decorators/File.d.ts +0 -37
- package/dist/decorators/File.js +0 -167
- package/dist/decorators/Http.d.ts +0 -22
- package/dist/decorators/Http.js +0 -45
- package/dist/decorators/HyperApp.d.ts +0 -3
- package/dist/decorators/HyperApp.js +0 -96
- package/dist/decorators/HyperController.d.ts +0 -2
- package/dist/decorators/HyperController.js +0 -20
- package/dist/decorators/HyperModule.d.ts +0 -5
- package/dist/decorators/HyperModule.js +0 -14
- package/dist/decorators/HyperService.d.ts +0 -15
- package/dist/decorators/HyperService.js +0 -29
- package/dist/decorators/Messaging.d.ts +0 -10
- package/dist/decorators/Messaging.js +0 -22
- package/dist/decorators/Middleware.d.ts +0 -25
- package/dist/decorators/Middleware.js +0 -65
- package/dist/decorators/Output.d.ts +0 -9
- package/dist/decorators/Output.js +0 -18
- package/dist/decorators/Pass.d.ts +0 -15
- package/dist/decorators/Pass.js +0 -32
- package/dist/decorators/Role.d.ts +0 -6
- package/dist/decorators/Role.js +0 -34
- package/dist/decorators/Routes.d.ts +0 -15
- package/dist/decorators/Routes.js +0 -21
- package/dist/decorators/Scope.d.ts +0 -6
- package/dist/decorators/Scope.js +0 -25
- package/dist/decorators/Transform.d.ts +0 -14
- package/dist/decorators/Transform.js +0 -18
- package/dist/decorators/index.d.ts +0 -14
- package/dist/decorators/index.js +0 -30
- package/dist/decorators/types.d.ts +0 -124
- package/dist/decorators/types.js +0 -6
- package/dist/exeptions/DuplicateControllerPathException.d.ts +0 -14
- package/dist/exeptions/DuplicateControllerPathException.js +0 -12
- package/dist/exeptions/DuplicatedException.d.ts +0 -8
- package/dist/exeptions/DuplicatedException.js +0 -12
- package/dist/exeptions/DuplicatedHandlerException.d.ts +0 -4
- package/dist/exeptions/DuplicatedHandlerException.js +0 -12
- package/dist/exeptions/HyperException.d.ts +0 -8
- package/dist/exeptions/HyperException.js +0 -14
- package/dist/exeptions/HyperFileException.d.ts +0 -4
- package/dist/exeptions/HyperFileException.js +0 -12
- package/dist/exeptions/MethodNotFountException.d.ts +0 -4
- package/dist/exeptions/MethodNotFountException.js +0 -12
- package/dist/exeptions/NotPropertyException.d.ts +0 -6
- package/dist/exeptions/NotPropertyException.js +0 -16
- package/dist/exeptions/NotRoleException.d.ts +0 -6
- package/dist/exeptions/NotRoleException.js +0 -17
- package/dist/exeptions/NotScopeException.d.ts +0 -7
- package/dist/exeptions/NotScopeException.js +0 -18
- package/dist/exeptions/WrongPlaceException.d.ts +0 -8
- package/dist/exeptions/WrongPlaceException.js +0 -21
- package/dist/exeptions/index.d.ts +0 -8
- package/dist/exeptions/index.js +0 -18
- package/dist/exeptions/types.d.ts +0 -1
- package/dist/exeptions/types.js +0 -2
- package/dist/lib/openapi/collectors/param.collector.d.ts +0 -2
- package/dist/lib/openapi/collectors/param.collector.js +0 -64
- package/dist/lib/openapi/decorators/api-bearer-auth.decorator.d.ts +0 -2
- package/dist/lib/openapi/decorators/api-bearer-auth.decorator.js +0 -10
- package/dist/lib/openapi/decorators/api-method.decorator.d.ts +0 -3
- package/dist/lib/openapi/decorators/api-method.decorator.js +0 -11
- package/dist/lib/openapi/decorators/api-parameter.decorator.d.ts +0 -3
- package/dist/lib/openapi/decorators/api-parameter.decorator.js +0 -10
- package/dist/lib/openapi/decorators/api-request-body.decorator.d.ts +0 -3
- package/dist/lib/openapi/decorators/api-request-body.decorator.js +0 -10
- package/dist/lib/openapi/decorators/api-response.decorator.d.ts +0 -3
- package/dist/lib/openapi/decorators/api-response.decorator.js +0 -10
- package/dist/lib/openapi/decorators/api-security.decorator.d.ts +0 -3
- package/dist/lib/openapi/decorators/api-security.decorator.js +0 -10
- package/dist/lib/openapi/decorators/api-tag.decorator.d.ts +0 -3
- package/dist/lib/openapi/decorators/api-tag.decorator.js +0 -13
- package/dist/lib/openapi/decorators/index.d.ts +0 -7
- package/dist/lib/openapi/decorators/index.js +0 -23
- package/dist/lib/openapi/helpers/index.d.ts +0 -7
- package/dist/lib/openapi/helpers/index.js +0 -23
- package/dist/lib/openapi/helpers/method.helper.d.ts +0 -3
- package/dist/lib/openapi/helpers/method.helper.js +0 -20
- package/dist/lib/openapi/helpers/openapi.helper.d.ts +0 -7
- package/dist/lib/openapi/helpers/openapi.helper.js +0 -51
- package/dist/lib/openapi/helpers/parameter.helper.d.ts +0 -3
- package/dist/lib/openapi/helpers/parameter.helper.js +0 -16
- package/dist/lib/openapi/helpers/request-body.helper.d.ts +0 -3
- package/dist/lib/openapi/helpers/request-body.helper.js +0 -9
- package/dist/lib/openapi/helpers/response.helper.d.ts +0 -3
- package/dist/lib/openapi/helpers/response.helper.js +0 -18
- package/dist/lib/openapi/helpers/security.helper.d.ts +0 -3
- package/dist/lib/openapi/helpers/security.helper.js +0 -17
- package/dist/lib/openapi/helpers/tag.helper.d.ts +0 -3
- package/dist/lib/openapi/helpers/tag.helper.js +0 -10
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -17
- package/dist/stores/scope.store.d.ts +0 -14
- package/dist/stores/scope.store.js +0 -29
|
@@ -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,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,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,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,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,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,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,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
|
-
}
|
package/dist/stores/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./scope.store";
|
package/dist/stores/index.js
DELETED
|
@@ -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();
|