honestjs 0.1.4 → 0.1.5
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 +11 -1
- package/dist/handlers/error.handler.d.ts +16 -19
- package/dist/index.js +16 -16
- package/dist/interfaces/honest-options.interface.d.ts +5 -6
- package/dist/managers/component.manager.d.ts +14 -21
- package/dist/registries/metadata.registry.d.ts +0 -14
- package/package.json +10 -10
- package/dist/interfaces/component-with-path.interface.d.ts +0 -7
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ maintainable web applications. Honest combines the elegance and architecture of
|
|
|
8
8
|
ultra-fast performance of Hono, giving you the best of both worlds.
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://github.com/honestjs/website">
|
|
13
|
+
<u>website</u>
|
|
14
|
+
</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
11
17
|
<p align="center">
|
|
12
18
|
<a href="https://github.com/honestjs/examples">
|
|
13
19
|
<u>examples</u>
|
|
@@ -42,7 +48,7 @@ ultra-fast performance of Hono, giving you the best of both worlds.
|
|
|
42
48
|
</a>
|
|
43
49
|
</p>
|
|
44
50
|
|
|
45
|
-
>
|
|
51
|
+
> 🚨 **Early Development Warning** 🚨
|
|
46
52
|
>
|
|
47
53
|
> Honest is currently in early development (pre-v1.0.0). Please be aware that:
|
|
48
54
|
>
|
|
@@ -53,6 +59,10 @@ ultra-fast performance of Hono, giving you the best of both worlds.
|
|
|
53
59
|
>
|
|
54
60
|
> We recommend not using it in production until v1.0.0 is released.
|
|
55
61
|
|
|
62
|
+
> ⚠️ **Documentation is not yet complete** ⚠️
|
|
63
|
+
>
|
|
64
|
+
> If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
|
|
65
|
+
|
|
56
66
|
## Features
|
|
57
67
|
|
|
58
68
|
- 🚀 **High Performance** - Built on top of the ultra-fast Hono framework
|
|
@@ -9,23 +9,20 @@ export declare class ErrorHandler {
|
|
|
9
9
|
* @returns A middleware function that formats and returns error responses using createErrorResponse
|
|
10
10
|
*/
|
|
11
11
|
static handle(): (err: Error, c: Context) => Promise<Response & import("hono").TypedResponse<{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
30
|
-
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
12
|
+
status: number;
|
|
13
|
+
message: string;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
path: string;
|
|
16
|
+
requestId?: string | undefined;
|
|
17
|
+
code?: string | undefined;
|
|
18
|
+
details?: {
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
} | undefined;
|
|
21
|
+
errors?: {
|
|
22
|
+
property: string;
|
|
23
|
+
constraints: {
|
|
24
|
+
[x: string]: string;
|
|
25
|
+
};
|
|
26
|
+
}[] | undefined;
|
|
27
|
+
}, 100 | 102 | 103 | 200 | 201 | 202 | 203 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 | -1, "json">>;
|
|
31
28
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import"reflect-metadata";import{Hono as e}from"hono";class x{instances=new Map;resolve($,_=new Set){if(this.instances.has($))return this.instances.get($);if(_.has($))throw new Error(`Circular dependency detected: ${[..._.keys(),$].map((X)=>X.name).join(" -> ")}`);_.add($);let q=(Reflect.getMetadata("design:paramtypes",$)||[]).map((X)=>{return this.resolve(X,new Set(_))}),Q=new $(...q);return this.instances.set($,Q),Q}register($,_){this.instances.set($,_)}}import{HTTPException as a}from"hono/http-exception";function f($,_,Y){let q=new Date().toISOString(),Q=_.get("requestId"),X=_.req.path;if($ instanceof a)return{response:{status:Y?.status||$.status,message:Y?.title||$.message,timestamp:q,path:X,requestId:Q,code:Y?.code,details:Y?.additionalDetails,...Y?.detail&&{detail:Y.detail}},status:Y?.status||$.status};if($.statusCode||$.status){let A=$.statusCode||$.status,k=Y?.status||A;return{response:{status:k,message:Y?.title||$.message,timestamp:q,path:X,requestId:Q,code:Y?.code||$.name,details:Y?.additionalDetails,...Y?.detail&&{detail:Y.detail}},status:k}}let W=Y?.status||500;return{response:{status:W,message:Y?.title||$.message,timestamp:q,path:X,requestId:Q,code:Y?.code||$.name,details:Y?.additionalDetails||{stack:$.stack},...Y?.detail&&{detail:Y.detail}},status:W}}class Z{static routes=new Map;static controllers=new Map;static controllerOptions=new Map;static services=new Set;static modules=new Map;static parameters=new Map;static contextIndices=new Map;static global=new Map([["middleware",new Set],["guard",new Set],["pipe",new Set],["filter",new Set]]);static globalWithPath=new Map([["middleware",[]],["guard",[]],["pipe",[]],["filter",[]]]);static controller=new Map([["middleware",new Map],["guard",new Map],["pipe",new Map],["filter",new Map]]);static handler=new Map([["middleware",new Map],["guard",new Map],["pipe",new Map],["filter",new Map]]);static getRoutes($){return this.routes.get($)||[]}static setRoutes($,_){this.routes.set($,_)}static addRoute($,_){if(!this.routes.has($))this.routes.set($,[]);this.routes.get($).push(_)}static getControllerPath($){return this.controllers.get($)||""}static setControllerPath($,_){this.controllers.set($,_)}static getControllerOptions($){return this.controllerOptions.get($)||{}}static setControllerOptions($,_){this.controllerOptions.set($,_)}static isService($){return this.services.has($)}static addService($){this.services.add($)}static getAllServices(){return this.services}static getModuleOptions($){return this.modules.get($)}static setModuleOptions($,_){this.modules.set($,_)}static getParameters($){return this.parameters.get($)||new Map}static setParameterMap($,_){this.parameters.set($,_)}static getContextIndices($){return this.contextIndices.get($)||new Map}static setContextIndices($,_){this.contextIndices.set($,_)}static registerGlobal($,_){this.global.get($).add(_)}static registerGlobalWithPath($,_){this.globalWithPath.get($).push(_)}static getGlobal($){return this.global.get($)}static getGlobalWithPath($){return this.globalWithPath.get($)||[]}static registerController($,_,Y){let q=this.controller.get($);if(!q.has(_))q.set(_,[]);q.get(_).push(Y)}static getController($,_){return this.controller.get($).get(_)||[]}static registerHandler($,_,Y){let q=this.handler.get($);if(!q.has(_))q.set(_,[]);q.get(_).push(Y)}static getHandler($,_){return this.handler.get($).get(_)||[]}}class S{static routes=[];static registerRoute($){this.routes.push($)}static getRoutes(){return this.routes}static getRoutesByController($){return this.routes.filter((_)=>_.controller===$)}static getRoutesByMethod($){return this.routes.filter((_)=>_.method.toUpperCase()===$.toUpperCase())}static getRoutesByPath($){return this.routes.filter((_)=>$.test(_.fullPath))}static clear(){this.routes.length=0}}function V($){return(_="",Y={})=>{return(q,Q,X)=>{let W=q.constructor;Z.addRoute(W,{path:_,method:$,handlerName:Q,parameterMetadata:[],version:Y.version,prefix:Y.prefix})}}}function j($,_){return(Y)=>{return(q,Q,X)=>{let W=q.constructor;if(!Z.getParameters(W).size)Z.setParameterMap(W,new Map);let L=Z.getParameters(W);if(!L.has(Q))L.set(Q,[]);let k=Reflect.getMetadata("design:paramtypes",q,Q)?.[X];if(L.get(Q).push({index:X,name:$,data:Y,factory:_,metatype:k}),$==="context"){if(!Z.getContextIndices(W).size)Z.setContextIndices(W,new Map);Z.getContextIndices(W).set(Q,X)}}}}class I{static handle(){return async($,_)=>{return _.json(f($,_))}}}class C{static handle(){return async($)=>{return $.json({message:`Not Found - ${$.req.path}`},404)}}}var S$=($)=>typeof $==="undefined",O=($)=>$===null||typeof $==="undefined",v=($)=>$!==null&&typeof $==="object",N$=($)=>{if(!v($))return!1;let _=Object.getPrototypeOf($);if(_===null)return!0;let Y=Object.prototype.hasOwnProperty.call(_,"constructor")&&_.constructor;return typeof Y==="function"&&Y instanceof Y&&Function.prototype.toString.call(Y)===Function.prototype.toString.call(Object)},c=($)=>typeof $==="function",y=($)=>typeof $==="string",w$=($)=>typeof $==="number",K$=($)=>$.length===0,R$=($)=>typeof $==="symbol",P$=($)=>typeof $==="string"?$.charAt(0)!=="/"?"/"+$:$:"",T=($)=>$?$.startsWith("/")?("/"+$.replace(/\/+$/,"")).replace(/\/+/g,"/"):"/"+$.replace(/\/+$/,""):"/",f$=($)=>$.endsWith("/")?$.slice(0,-1):$,i=($)=>{return c($)&&!O($.prototype)&&!c($.prototype)&&Object.getOwnPropertyNames($.prototype).length>1};var N=($)=>$!==null&&typeof $==="object";function o($){return N($)&&"path"in $&&"component"in $}class J{static container;static init($){this.container=$}static setupGlobalComponents($){let _=$.components||{},Y=(q,Q)=>{for(let X of Q)if(o(X))Z.registerGlobalWithPath(q,X);else Z.registerGlobal(q,X)};if(_.middleware)Y("middleware",_.middleware);if(_.guards)Y("guard",_.guards);if(_.pipes)Y("pipe",_.pipes);if(_.filters)Y("filter",_.filters)}static registerController($,_,...Y){Y.forEach((q)=>{Z.registerController($,_,q)})}static registerHandler($,_,Y,...q){let Q=`${_.name}:${String(Y)}`;q.forEach((X)=>{Z.registerHandler($,Q,X)})}static getComponents($,_,Y,q){let Q=`${_.name}:${String(Y)}`,X=Z.getHandler($,Q),W=Z.getController($,_);if($==="middleware")return[...W,...X];let L=Array.from(Z.getGlobal($)),k=Z.getGlobalWithPath($).filter((B)=>q.startsWith(T(B.path))).map((B)=>B.component);return[...L,...k,...W,...X]}static resolveMiddleware($){return $.map((_)=>{if(N(_)&&"use"in _)return _.use.bind(_);let Y=this.container.resolve(_);return Y.use.bind(Y)})}static getHandlerMiddleware($,_){let Y=this.getComponents("middleware",$,_,"");return this.resolveMiddleware(Y)}static getGlobalMiddleware(){let $=Array.from(Z.getGlobal("middleware"));return this.resolveMiddleware($)}static getGlobalMiddlewareWithPath(){return Z.getGlobalWithPath("middleware").map((_)=>({path:_.path,middleware:this.resolveMiddleware([_.component])[0]}))}static resolveGuards($){return $.map((_)=>{if(N(_)&&"canActivate"in _)return _;return this.container.resolve(_)})}static getHandlerGuards($,_,Y){let q=this.getComponents("guard",$,_,Y);return this.resolveGuards(q)}static resolvePipes($){return $.map((_)=>{if(N(_)&&"transform"in _)return _;return this.container.resolve(_)})}static getHandlerPipes($,_,Y){let q=this.getComponents("pipe",$,_,Y);return this.resolvePipes(q)}static async executePipes($,_,Y){let q=$;for(let Q of Y)q=await Q.transform(q,_);return q}static async handleException($,_){let Y=_.get("controllerClass"),q=_.get("handlerName"),Q=_.req.path;if(Y&&q){let A=Z.getHandler("filter",`${Y.name}:${q}`);if(A.length>0){let k=await this.executeFilters(A,$,_);if(k)return k}}if(Y){let A=Z.getController("filter",Y);if(A.length>0){let k=await this.executeFilters(A,$,_);if(k)return k}}let X=Array.from(Z.getGlobal("filter")),W=Z.getGlobalWithPath("filter").filter((A)=>Q.startsWith(T(A.path))).map((A)=>A.component),L=[...X,...W];if(L.length>0){let A=await this.executeFilters(L,$,_);if(A)return A}return console.log("No filter handled the exception, creating default response"),_.json(f($,_))}static async executeFilters($,_,Y){for(let q of $){let Q;if(N(q)&&"catch"in q)Q=q;else Q=this.container.resolve(q);try{let X=await Q.catch(_,Y);if(X!==void 0)return X}catch(X){console.error("Error in exception filter:",X)}}return}static async registerModule($,_){let Y=Z.getModuleOptions($);if(!Y)throw new Error(`Module ${$.name} is not properly decorated with @Module()`);let q=[];if(Y.imports&&Y.imports.length>0)for(let Q of Y.imports){let X=await this.registerModule(Q,_);q.push(...X)}if(Y.services&&Y.services.length>0)for(let Q of Y.services)_.resolve(Q);if(Y.controllers&&Y.controllers.length>0)q.push(...Y.controllers);return q}}import{HTTPException as t}from"hono/http-exception";var u=Symbol("VERSION_NEUTRAL");class g{hono;container;globalPrefix;globalVersion;constructor($,_,Y={}){this.hono=$,this.container=_,this.globalPrefix=Y.prefix!==void 0?this.normalizePath(Y.prefix):void 0,this.globalVersion=Y.version,this.applyGlobalMiddleware()}applyGlobalMiddleware(){let $=J.getGlobalMiddleware();for(let Y of $)this.hono.use("*",Y);let _=J.getGlobalMiddlewareWithPath();for(let Y of _)this.hono.use(Y.path,Y.middleware)}normalizePath($){if(y($))return T($);return $?`/${$}`:""}registerRouteHandler($,_,Y,q){if(Y.length>0)this.hono.on($.toUpperCase(),_,...Y,q);else this.hono.on($.toUpperCase(),_,q)}buildRoutePath($,_,Y,q){return T(`${$}${_}${Y}${q}`)}formatVersionSegment($){if(O($))return"";return $===u?"":`/v${String($)}`}async registerController($){let _=Z.getControllerPath($)||"",Y=Z.getControllerOptions($)||{},q=Z.getRoutes($)||[],Q=Z.getParameters($)||new Map,X=Z.getContextIndices($)||new Map,W=this.normalizePath(_),L=this.container.resolve($),A=Y.prefix!==void 0?Y.prefix:this.globalPrefix,k=Y.version!==void 0?Y.version:this.globalVersion;for(let B of q){let{path:H,method:F,handlerName:M,version:w,prefix:K}=B,R=K!==void 0?K:A,b=!O(R)?this.normalizePath(R):"",z=w!==void 0?w:k,G=this.normalizePath(H);if(O(z)){this.registerRoute(L,B,Q,X,$,b,"",W,G,F);continue}if(z===u){this.registerRoute(L,B,Q,X,$,b,"",W,G,F),this.registerRoute(L,B,Q,X,$,b,"/:version{v[0-9]+}",W,G,F);continue}if(Array.isArray(z)){for(let D of z){let E=this.formatVersionSegment(D);this.registerRoute(L,B,Q,X,$,b,E,W,G,F)}continue}let P=this.formatVersionSegment(z);this.registerRoute(L,B,Q,X,$,b,P,W,G,F)}}registerRoute($,_,Y,q,Q,X,W,L,A,k){let{handlerName:B}=_,H=this.buildRoutePath(X,W,L,A),F=$[B].bind($),M=Y.get(B)||[],w=q.get(B),K=J.getHandlerMiddleware(Q,B),R=J.getHandlerPipes(Q,B,H);S.registerRoute({controller:Q.name,handler:B,method:k,prefix:X,version:W,route:L,path:A,fullPath:H,parameters:M});let b=async(z)=>{try{z.set("controllerClass",Q),z.set("handlerName",String(B));let G=J.getHandlerGuards(Q,B,z.req.routePath);for(let E of G)if(!await E.canActivate(z))throw new t(403,{message:"Forbidden"});let P=new Array(F.length);for(let E of M){let d=E.factory(E.data,z),r=await J.executePipes(d,{type:E.type,metatype:E.metatype,data:E.data},R);P[E.index]=r}let D=await F(...P);if(w!==void 0)return D;if(O(D))return z.json(null);if(y(D))return z.text(D);return z.json(D)}catch(G){return J.handleException(G,z)}};this.registerRouteHandler(k,H,K,b)}}class p{hono;container;routeManager;options;constructor($={}){this.options=v($)?$:{},this.hono=new e(this.options.hono),this.container=this.options.container||new x,this.setupComponents(),this.setupErrorHandlers(),this.routeManager=new g(this.hono,this.container,{prefix:this.options.routing?.prefix,version:this.options.routing?.version})}setupComponents(){J.init(this.container),J.setupGlobalComponents(this.options)}setupErrorHandlers(){this.hono.notFound(this.options.notFound||C.handle()),this.hono.onError(this.options.onError||I.handle())}resolvePlugin($){if(i($))return new $;return $}async register($){let _=await J.registerModule($,this.container);for(let Y of _)await this.routeManager.registerController(Y);return this}static async create($,_={}){let Y=new p(_),q=(_.plugins||[]).map((Q)=>Y.resolvePlugin(Q));for(let Q of q)if(Q.beforeModulesRegistered)await Q.beforeModulesRegistered(Y,Y.hono);await Y.register($);for(let Q of q)if(Q.afterModulesRegistered)await Q.afterModulesRegistered(Y,Y.hono);return{app:Y,hono:Y.getApp()}}getApp(){return this.hono}getRoutes(){return S.getRoutes()}}import{html as U,raw as h}from"hono/html";var $$={type:"website",locale:"en_US"},m=($)=>{if(!$)return"";return Object.entries($).map(([_,Y])=>{if(typeof Y==="boolean")return Y?_:"";let q=String(Y).replace(/"/g,""");return`${_}="${q}"`}).filter(Boolean).join(" ")},X_=($)=>{let _={...$$,...$};return U`
|
|
1
|
+
import"reflect-metadata";import{Hono as t}from"hono";class M{instances=new Map;resolve($,_=new Set){if(this.instances.has($))return this.instances.get($);if(_.has($))throw new Error(`Circular dependency detected: ${[..._.keys(),$].map((Q)=>Q.name).join(" -> ")}`);_.add($);let Y=(Reflect.getMetadata("design:paramtypes",$)||[]).map((Q)=>{return this.resolve(Q,new Set(_))}),q=new $(...Y);return this.instances.set($,q),q}register($,_){this.instances.set($,_)}}import{HTTPException as r}from"hono/http-exception";function R($,_,W){let Y=new Date().toISOString(),q=_.get("requestId"),Q=_.req.path;if($ instanceof r)return{response:{status:W?.status||$.status,message:W?.title||$.message,timestamp:Y,path:Q,requestId:q,code:W?.code,details:W?.additionalDetails,...W?.detail&&{detail:W.detail}},status:W?.status||$.status};if($.statusCode||$.status){let z=$.statusCode||$.status,G=W?.status||z;return{response:{status:G,message:W?.title||$.message,timestamp:Y,path:Q,requestId:q,code:W?.code||$.name,details:W?.additionalDetails,...W?.detail&&{detail:W.detail}},status:G}}let J=W?.status||500;return{response:{status:J,message:W?.title||$.message,timestamp:Y,path:Q,requestId:q,code:W?.code||$.name,details:W?.additionalDetails||{stack:$.stack},...W?.detail&&{detail:W.detail}},status:J}}class X{static routes=new Map;static controllers=new Map;static controllerOptions=new Map;static services=new Set;static modules=new Map;static parameters=new Map;static contextIndices=new Map;static global=new Map([["middleware",new Set],["guard",new Set],["pipe",new Set],["filter",new Set]]);static controller=new Map([["middleware",new Map],["guard",new Map],["pipe",new Map],["filter",new Map]]);static handler=new Map([["middleware",new Map],["guard",new Map],["pipe",new Map],["filter",new Map]]);static getRoutes($){return this.routes.get($)||[]}static setRoutes($,_){this.routes.set($,_)}static addRoute($,_){if(!this.routes.has($))this.routes.set($,[]);this.routes.get($).push(_)}static getControllerPath($){return this.controllers.get($)||""}static setControllerPath($,_){this.controllers.set($,_)}static getControllerOptions($){return this.controllerOptions.get($)||{}}static setControllerOptions($,_){this.controllerOptions.set($,_)}static isService($){return this.services.has($)}static addService($){this.services.add($)}static getAllServices(){return this.services}static getModuleOptions($){return this.modules.get($)}static setModuleOptions($,_){this.modules.set($,_)}static getParameters($){return this.parameters.get($)||new Map}static setParameterMap($,_){this.parameters.set($,_)}static getContextIndices($){return this.contextIndices.get($)||new Map}static setContextIndices($,_){this.contextIndices.set($,_)}static registerGlobal($,_){this.global.get($).add(_)}static getGlobal($){return this.global.get($)}static registerController($,_,W){let Y=this.controller.get($);if(!Y.has(_))Y.set(_,[]);Y.get(_).push(W)}static getController($,_){return this.controller.get($).get(_)||[]}static registerHandler($,_,W){let Y=this.handler.get($);if(!Y.has(_))Y.set(_,[]);Y.get(_).push(W)}static getHandler($,_){return this.handler.get($).get(_)||[]}}class T{static routes=[];static registerRoute($){this.routes.push($)}static getRoutes(){return this.routes}static getRoutesByController($){return this.routes.filter((_)=>_.controller===$)}static getRoutesByMethod($){return this.routes.filter((_)=>_.method.toUpperCase()===$.toUpperCase())}static getRoutesByPath($){return this.routes.filter((_)=>$.test(_.fullPath))}static clear(){this.routes.length=0}}function b($){return(_="",W={})=>{return(Y,q,Q)=>{let J=Y.constructor;X.addRoute(J,{path:_,method:$,handlerName:q,parameterMetadata:[],version:W.version,prefix:W.prefix})}}}function k($,_){return(W)=>{return(Y,q,Q)=>{let J=Y.constructor;if(!X.getParameters(J).size)X.setParameterMap(J,new Map);let A=X.getParameters(J);if(!A.has(q))A.set(q,[]);let G=Reflect.getMetadata("design:paramtypes",Y,q)?.[Q];if(A.get(q).push({index:Q,name:$,data:W,factory:_,metatype:G}),$==="context"){if(!X.getContextIndices(J).size)X.setContextIndices(J,new Map);X.getContextIndices(J).set(q,Q)}}}}class x{static handle(){return async($,_)=>{let{response:W,status:Y}=R($,_);return _.json(W,Y)}}}class I{static handle(){return async($)=>{return $.json({message:`Not Found - ${$.req.path}`},404)}}}var K=($)=>$!==null&&typeof $==="object";class Z{static container;static init($){this.container=$}static setupGlobalComponents($){let _=$.components||{};if(_.middleware)this.registerGlobal("middleware",..._.middleware);if(_.guards)this.registerGlobal("guard",..._.guards);if(_.pipes)this.registerGlobal("pipe",..._.pipes);if(_.filters)this.registerGlobal("filter",..._.filters)}static registerGlobal($,..._){_.forEach((W)=>{X.registerGlobal($,W)})}static registerController($,_,...W){W.forEach((Y)=>{X.registerController($,_,Y)})}static registerHandler($,_,W,...Y){let q=`${_.name}:${String(W)}`;Y.forEach((Q)=>{X.registerHandler($,q,Q)})}static getComponents($,_,W){let Y=`${_.name}:${String(W)}`,q=X.getHandler($,Y),Q=X.getController($,_);return[...Array.from(X.getGlobal($)),...Q,...q]}static resolveMiddleware($){return $.map((_)=>{if(K(_)&&"use"in _)return _.use.bind(_);let W=this.container.resolve(_);return W.use.bind(W)})}static getHandlerMiddleware($,_){let W=this.getComponents("middleware",$,_);return this.resolveMiddleware(W)}static getGlobalMiddleware(){let $=Array.from(X.getGlobal("middleware"));return this.resolveMiddleware($)}static resolveGuards($){return $.map((_)=>{if(K(_)&&"canActivate"in _)return _;return this.container.resolve(_)})}static getHandlerGuards($,_){let W=this.getComponents("guard",$,_);return this.resolveGuards(W)}static resolvePipes($){return $.map((_)=>{if(K(_)&&"transform"in _)return _;return this.container.resolve(_)})}static getHandlerPipes($,_){let W=this.getComponents("pipe",$,_);return this.resolvePipes(W)}static async executePipes($,_,W){let Y=$;for(let q of W)Y=await q.transform(Y,_);return Y}static async handleException($,_){let W=_.get("controllerClass"),Y=_.get("handlerName");if(W&&Y){let A=X.getHandler("filter",`${W.name}:${Y}`);if(A.length>0){let z=await this.executeFilters(A,$,_);if(z)return z}}if(W){let A=X.getController("filter",W);if(A.length>0){let z=await this.executeFilters(A,$,_);if(z)return z}}let q=Array.from(X.getGlobal("filter"));if(q.length>0){let A=await this.executeFilters(q,$,_);if(A)return A}console.log("No filter handled the exception, creating default response");let{response:Q,status:J}=R($,_);return _.json(Q,J)}static async executeFilters($,_,W){for(let Y of $){let q;if(K(Y)&&"catch"in Y)q=Y;else q=this.container.resolve(Y);try{let Q=await q.catch(_,W);if(Q!==void 0)return Q}catch(Q){console.error("Error in exception filter:",Q)}}return}static async registerModule($,_){let W=X.getModuleOptions($);if(!W)throw new Error(`Module ${$.name} is not properly decorated with @Module()`);let Y=[];if(W.imports&&W.imports.length>0)for(let q of W.imports){let Q=await this.registerModule(q,_);Y.push(...Q)}if(W.services&&W.services.length>0)for(let q of W.services)_.resolve(q);if(W.controllers&&W.controllers.length>0)Y.push(...W.controllers);return Y}}import{HTTPException as o}from"hono/http-exception";var C=Symbol("VERSION_NEUTRAL");var K$=($)=>typeof $==="undefined",H=($)=>$===null||typeof $==="undefined",v=($)=>$!==null&&typeof $==="object",f$=($)=>{if(!v($))return!1;let _=Object.getPrototypeOf($);if(_===null)return!0;let W=Object.prototype.hasOwnProperty.call(_,"constructor")&&_.constructor;return typeof W==="function"&&W instanceof W&&Function.prototype.toString.call(W)===Function.prototype.toString.call(Object)},c=($)=>typeof $==="function",y=($)=>typeof $==="string",M$=($)=>typeof $==="number",x$=($)=>$.length===0,I$=($)=>typeof $==="symbol",C$=($)=>typeof $==="string"?$.charAt(0)!=="/"?"/"+$:$:"",u=($)=>$?$.startsWith("/")?("/"+$.replace(/\/+$/,"")).replace(/\/+/g,"/"):"/"+$.replace(/\/+$/,""):"/",v$=($)=>$.endsWith("/")?$.slice(0,-1):$,i=($)=>{return c($)&&!H($.prototype)&&!c($.prototype)&&Object.getOwnPropertyNames($.prototype).length>1};class g{hono;container;globalPrefix;globalVersion;constructor($,_,W={}){this.hono=$,this.container=_,this.globalPrefix=W.prefix!==void 0?this.normalizePath(W.prefix):void 0,this.globalVersion=W.version,this.applyGlobalMiddleware()}applyGlobalMiddleware(){let $=Z.getGlobalMiddleware();for(let _ of $)this.hono.use("*",_)}normalizePath($){if(y($))return u($);return $?`/${$}`:""}registerRouteHandler($,_,W,Y){if(W.length>0)this.hono.on($.toUpperCase(),_,...W,Y);else this.hono.on($.toUpperCase(),_,Y)}buildRoutePath($,_,W,Y){return u(`${$}${_}${W}${Y}`)}formatVersionSegment($){if(H($))return"";return $===C?"":`/v${String($)}`}async registerController($){let _=X.getControllerPath($)||"",W=X.getControllerOptions($)||{},Y=X.getRoutes($)||[],q=X.getParameters($)||new Map,Q=X.getContextIndices($)||new Map,J=this.normalizePath(_),A=this.container.resolve($),z=W.prefix!==void 0?W.prefix:this.globalPrefix,G=W.version!==void 0?W.version:this.globalVersion;for(let U of Y){let{path:O,method:E,handlerName:f,version:S,prefix:N}=U,w=N!==void 0?N:z,V=!H(w)?this.normalizePath(w):"",L=S!==void 0?S:G,F=this.normalizePath(O);if(H(L)){this.registerRoute(A,U,q,Q,$,V,"",J,F,E);continue}if(L===C){this.registerRoute(A,U,q,Q,$,V,"",J,F,E),this.registerRoute(A,U,q,Q,$,V,"/:version{v[0-9]+}",J,F,E);continue}if(Array.isArray(L)){for(let D of L){let j=this.formatVersionSegment(D);this.registerRoute(A,U,q,Q,$,V,j,J,F,E)}continue}let P=this.formatVersionSegment(L);this.registerRoute(A,U,q,Q,$,V,P,J,F,E)}}registerRoute($,_,W,Y,q,Q,J,A,z,G){let{handlerName:U}=_,O=this.buildRoutePath(Q,J,A,z),E=$[U].bind($),f=W.get(U)||[],S=Y.get(U),N=Z.getHandlerMiddleware(q,U),w=Z.getHandlerPipes(q,U);T.registerRoute({controller:q.name,handler:U,method:G,prefix:Q,version:J,route:A,path:z,fullPath:O,parameters:f});let V=async(L)=>{try{L.set("controllerClass",q),L.set("handlerName",String(U));let F=Z.getHandlerGuards(q,U);for(let j of F)if(!await j.canActivate(L))throw new o(403,{message:"Forbidden"});let P=new Array(E.length);for(let j of f){let d=j.factory(j.data,L),a=await Z.executePipes(d,{type:j.type,metatype:j.metatype,data:j.data},w);P[j.index]=a}let D=await E(...P);if(S!==void 0)return D;if(H(D))return L.json(null);if(y(D))return L.text(D);return L.json(D)}catch(F){return Z.handleException(F,L)}};this.registerRouteHandler(G,O,N,V)}}class p{hono;container;routeManager;options;constructor($={}){this.options=v($)?$:{},this.hono=new t(this.options.hono),this.container=this.options.container||new M,this.setupComponents(),this.setupErrorHandlers(),this.routeManager=new g(this.hono,this.container,{prefix:this.options.routing?.prefix,version:this.options.routing?.version})}setupComponents(){Z.init(this.container),Z.setupGlobalComponents(this.options)}setupErrorHandlers(){this.hono.notFound(this.options.notFound||I.handle()),this.hono.onError(this.options.onError||x.handle())}resolvePlugin($){if(i($))return new $;return $}async register($){let _=await Z.registerModule($,this.container);for(let W of _)await this.routeManager.registerController(W);return this}static async create($,_={}){let W=new p(_),Y=(_.plugins||[]).map((q)=>W.resolvePlugin(q));for(let q of Y)if(q.beforeModulesRegistered)await q.beforeModulesRegistered(W,W.hono);await W.register($);for(let q of Y)if(q.afterModulesRegistered)await q.afterModulesRegistered(W,W.hono);return{app:W,hono:W.getApp()}}getApp(){return this.hono}getRoutes(){return T.getRoutes()}}import{html as B,raw as h}from"hono/html";var e={type:"website",locale:"en_US"},m=($)=>{if(!$)return"";return Object.entries($).map(([_,W])=>{if(typeof W==="boolean")return W?_:"";let Y=String(W).replace(/"/g,""");return`${_}="${Y}"`}).filter(Boolean).join(" ")},Y_=($)=>{let _={...e,...$};return B`
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html lang="${_.locale?.split("_")[0]||"en"}" ${h(m(_.htmlAttributes))}>
|
|
4
4
|
<head ${h(m(_.headAttributes))}>
|
|
5
5
|
<meta charset="UTF-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
${_.csp?
|
|
7
|
+
${_.csp?B`<meta http-equiv="Content-Security-Policy" content="${_.csp}" />`:""}
|
|
8
8
|
<title>${_.title}</title>
|
|
9
|
-
${_.description?
|
|
9
|
+
${_.description?B`<meta name="description" content="${_.description}" />`:""}
|
|
10
10
|
|
|
11
11
|
<!-- Open Graph / Facebook -->
|
|
12
12
|
<meta prefix="og: http://ogp.me/ns#" />
|
|
13
13
|
<meta property="og:title" content="${_.title}" />
|
|
14
|
-
${_.description?
|
|
15
|
-
${_.image?
|
|
16
|
-
${_.url?
|
|
17
|
-
${_.locale?
|
|
18
|
-
${_.type?
|
|
19
|
-
${_.siteName?
|
|
14
|
+
${_.description?B`<meta property="og:description" content="${_.description}" />`:""}
|
|
15
|
+
${_.image?B`<meta property="og:image" content="${_.image}" />`:""}
|
|
16
|
+
${_.url?B`<meta property="og:url" content="${_.url}" />`:""}
|
|
17
|
+
${_.locale?B`<meta property="og:locale" content="${_.locale}" />`:""}
|
|
18
|
+
${_.type?B`<meta property="og:type" content="${_.type}" />`:""}
|
|
19
|
+
${_.siteName?B`<meta property="og:site_name" content="${_.siteName}" />`:""}
|
|
20
20
|
|
|
21
21
|
<!-- Twitter -->
|
|
22
22
|
<meta
|
|
@@ -24,23 +24,23 @@ import"reflect-metadata";import{Hono as e}from"hono";class x{instances=new Map;r
|
|
|
24
24
|
content="${_.twitterCard||(_.image?"summary_large_image":"summary")}"
|
|
25
25
|
/>
|
|
26
26
|
<meta name="twitter:title" content="${_.title}" />
|
|
27
|
-
${_.description?
|
|
28
|
-
${_.image?
|
|
27
|
+
${_.description?B`<meta name="twitter:description" content="${_.description}" />`:""}
|
|
28
|
+
${_.image?B`<meta name="twitter:image" content="${_.image}" />`:""}
|
|
29
29
|
|
|
30
30
|
<!-- Custom Meta Tags -->
|
|
31
|
-
${_.customMeta?_.customMeta.map((
|
|
31
|
+
${_.customMeta?_.customMeta.map((W)=>{let Y=W.name?`name="${W.name}"`:"",q=W.property?`property="${W.property}"`:"";return B`<meta ${Y} ${q} content="${W.content}" />`}):""}
|
|
32
32
|
|
|
33
33
|
<!-- Favicon -->
|
|
34
|
-
${_.favicon?
|
|
34
|
+
${_.favicon?B`<link rel="icon" href="${_.favicon}" />`:""}
|
|
35
35
|
|
|
36
36
|
<!-- Stylesheets -->
|
|
37
|
-
${_.stylesheets?_.stylesheets.map((
|
|
37
|
+
${_.stylesheets?_.stylesheets.map((W)=>B`<link rel="stylesheet" href="${W}" />`):""}
|
|
38
38
|
|
|
39
39
|
<!-- Scripts -->
|
|
40
|
-
${_.scripts?_.scripts.map((
|
|
40
|
+
${_.scripts?_.scripts.map((W)=>{if(typeof W==="string")return B`<script src="${W}"></script>`;let{src:Y,async:q,defer:Q}=W;if(q&&Q)return B`<script src="${Y}" async defer></script>`;if(q)return B`<script src="${Y}" async></script>`;if(Q)return B`<script src="${Y}" defer></script>`;return B`<script src="${Y}"></script>`}):""}
|
|
41
41
|
</head>
|
|
42
42
|
<body ${h(m(_.bodyAttributes))}>
|
|
43
43
|
${_.children}
|
|
44
44
|
</body>
|
|
45
45
|
</html>
|
|
46
|
-
`};function s($="",_={}){return(
|
|
46
|
+
`};function s($="",_={}){return(W)=>{X.setControllerPath(W,$),X.setControllerOptions(W,_)}}var l=b("get"),B_=b("post"),U_=b("put"),z_=b("delete"),L_=b("patch"),k_=b("options"),j_=b("all");function n($={}){return(_)=>{X.setModuleOptions(_,$)}}function H_($="",_={prefix:null,version:null}){return s($,_)}var O_=l;function T_($={}){return n({imports:$.imports,services:$.services,controllers:($.views||[]).concat($.controllers||[])})}var w_=k("body",async($,_)=>{let W=await _.req.json();return $?W[$]:W}),P_=k("param",($,_)=>{return $?_.req.param($):_.req.param()}),R_=k("query",($,_)=>{return $?_.req.query($):_.req.query()}),K_=k("header",($,_)=>{return $?_.req.header($):_.req.header()}),f_=k("request",($,_)=>_.req),M_=k("request",($,_)=>_.req),x_=k("response",($,_)=>_.res),I_=k("response",($,_)=>_.res),C_=k("context",($,_)=>_),v_=k("context",($,_)=>_),y_=k("variable",($,_)=>_.get($)),u_=k("variable",($,_)=>_.get($));function m_(){return($)=>{X.addService($)}}function i_($,..._){return(W,Y)=>{if(Y){let q=W.constructor;Z.registerHandler($,q,Y,..._)}else Z.registerController($,W,..._)}}function l_(...$){return(_,W)=>{if(W){let Y=_.constructor;Z.registerHandler("filter",Y,W,...$)}else Z.registerController("filter",_,...$)}}function r_(...$){return(_,W)=>{if(W){let Y=_.constructor;Z.registerHandler("guard",Y,W,...$)}else Z.registerController("guard",_,...$)}}function e_(...$){return(_,W)=>{if(W){let Y=_.constructor;Z.registerHandler("middleware",Y,W,...$)}else Z.registerController("middleware",_,...$)}}function WW(...$){return(_,W)=>{if(W){let Y=_.constructor;Z.registerHandler("pipe",Y,W,...$)}else Z.registerController("pipe",_,...$)}}export{v$ as stripEndSlash,u as normalizePath,K$ as isUndefined,I$ as isSymbol,y as isString,f$ as isPlainObject,v as isObject,M$ as isNumber,H as isNil,c as isFunction,x$ as isEmpty,i as isConstructor,k as createParamDecorator,b as createHttpMethodDecorator,R as createErrorResponse,C$ as addLeadingSlash,H_ as View,u_ as Variable,y_ as Var,C as VERSION_NEUTRAL,WW as UsePipes,e_ as UseMiddleware,r_ as UseGuards,l_ as UseFilters,i_ as UseComponent,m_ as Service,T as RouteRegistry,g as RouteManager,I_ as Response,x_ as Res,M_ as Request,f_ as Req,R_ as Query,U_ as Put,B_ as Post,L_ as Patch,P_ as Param,O_ as Page,k_ as Options,I as NotFoundHandler,T_ as MvcModule,n as Module,X as MetadataRegistry,Y_ as Layout,K_ as Header,l as Get,x as ErrorHandler,z_ as Delete,C_ as Ctx,s as Controller,v_ as Context,M as Container,Z as ComponentManager,w_ as Body,p as Application,j_ as All};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Context } from 'hono';
|
|
2
2
|
import type { VERSION_NEUTRAL } from '../constants';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FilterType, GuardType, MiddlewareType, PipeType, PluginType } from '../interfaces';
|
|
4
4
|
import type { DiContainer } from './di-container.interface';
|
|
5
|
-
import type { FilterType, GuardType, MiddlewareType, PipeType, PluginType } from './index';
|
|
6
5
|
/**
|
|
7
6
|
* Options for configuring the Honest application
|
|
8
7
|
*/
|
|
@@ -50,19 +49,19 @@ export interface HonestOptions {
|
|
|
50
49
|
/**
|
|
51
50
|
* Global middleware to apply to all routes
|
|
52
51
|
*/
|
|
53
|
-
middleware?:
|
|
52
|
+
middleware?: MiddlewareType[];
|
|
54
53
|
/**
|
|
55
54
|
* Global guards to apply to all routes
|
|
56
55
|
*/
|
|
57
|
-
guards?:
|
|
56
|
+
guards?: GuardType[];
|
|
58
57
|
/**
|
|
59
58
|
* Global pipes to apply to all routes
|
|
60
59
|
*/
|
|
61
|
-
pipes?:
|
|
60
|
+
pipes?: PipeType[];
|
|
62
61
|
/**
|
|
63
62
|
* Global exception filters to apply to all routes
|
|
64
63
|
*/
|
|
65
|
-
filters?:
|
|
64
|
+
filters?: FilterType[];
|
|
66
65
|
};
|
|
67
66
|
/**
|
|
68
67
|
* Plugins for extending the application functionality
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Context, Next } from 'hono';
|
|
2
|
-
import type { ArgumentMetadata, DiContainer,
|
|
3
|
-
import type { ComponentWithpath } from '../interfaces/component-with-path.interface';
|
|
2
|
+
import type { ArgumentMetadata, DiContainer, GuardType, IGuard, IPipe, MiddlewareType, PipeType } from '../interfaces';
|
|
4
3
|
import { type ComponentType, type ComponentTypeMap } from '../registries';
|
|
5
4
|
import type { Constructor } from '../types';
|
|
6
5
|
/**
|
|
@@ -29,12 +28,18 @@ export declare class ComponentManager {
|
|
|
29
28
|
*/
|
|
30
29
|
static setupGlobalComponents(options: {
|
|
31
30
|
components?: {
|
|
32
|
-
middleware?:
|
|
33
|
-
guards?:
|
|
34
|
-
pipes?:
|
|
35
|
-
filters?:
|
|
31
|
+
middleware?: any[];
|
|
32
|
+
guards?: any[];
|
|
33
|
+
pipes?: any[];
|
|
34
|
+
filters?: any[];
|
|
36
35
|
};
|
|
37
36
|
}): void;
|
|
37
|
+
/**
|
|
38
|
+
* Registers a component at the global level
|
|
39
|
+
* @param type - The type of component to register
|
|
40
|
+
* @param components - The component classes or instances to register
|
|
41
|
+
*/
|
|
42
|
+
static registerGlobal<T extends ComponentType>(type: T, ...components: ComponentTypeMap[T][]): void;
|
|
38
43
|
/**
|
|
39
44
|
* Registers a component at the controller level
|
|
40
45
|
* @param type - The type of component to register
|
|
@@ -55,10 +60,9 @@ export declare class ComponentManager {
|
|
|
55
60
|
* @param type - The type of component to get
|
|
56
61
|
* @param controller - The controller class
|
|
57
62
|
* @param handlerName - The handler method name
|
|
58
|
-
* @param routePath - The route path
|
|
59
63
|
* ..returns An array of component instances
|
|
60
64
|
*/
|
|
61
|
-
static getComponents<T extends ComponentType>(type: T, controller: Constructor, handlerName: string | symbol
|
|
65
|
+
static getComponents<T extends ComponentType>(type: T, controller: Constructor, handlerName: string | symbol): ComponentTypeMap[T][];
|
|
62
66
|
/**
|
|
63
67
|
* Resolves middleware classes or instances to middleware functions
|
|
64
68
|
* @param middlewareItems - The middleware classes or instances to resolve
|
|
@@ -69,7 +73,6 @@ export declare class ComponentManager {
|
|
|
69
73
|
* Gets middleware for a specific handler
|
|
70
74
|
* @param controller - The controller class
|
|
71
75
|
* @param handlerName - The handler method name
|
|
72
|
-
* @param routePath - The route path
|
|
73
76
|
* ..returns An array of middleware functions
|
|
74
77
|
*/
|
|
75
78
|
static getHandlerMiddleware(controller: Constructor, handlerName: string | symbol): ((c: Context, next: Next) => Promise<Response | void>)[];
|
|
@@ -78,14 +81,6 @@ export declare class ComponentManager {
|
|
|
78
81
|
* ..returns An array of middleware functions
|
|
79
82
|
*/
|
|
80
83
|
static getGlobalMiddleware(): ((c: Context, next: Next) => Promise<Response | void>)[];
|
|
81
|
-
/**
|
|
82
|
-
* Gets global middleware with their paths
|
|
83
|
-
* @returns An array of objects with path and middleware function
|
|
84
|
-
*/
|
|
85
|
-
static getGlobalMiddlewareWithPath(): {
|
|
86
|
-
path: string;
|
|
87
|
-
middleware: (c: Context, next: Next) => Promise<void | Response>;
|
|
88
|
-
}[];
|
|
89
84
|
/**
|
|
90
85
|
* Resolves guard classes or instances to guard instances
|
|
91
86
|
* @param guardItems - The guard classes or instances to resolve
|
|
@@ -96,10 +91,9 @@ export declare class ComponentManager {
|
|
|
96
91
|
* Gets guards for a specific handler
|
|
97
92
|
* @param controller - The controller class
|
|
98
93
|
* @param handlerName - The handler method name
|
|
99
|
-
* @param routePath - The route path
|
|
100
94
|
* ..returns An array of guard instances
|
|
101
95
|
*/
|
|
102
|
-
static getHandlerGuards(controller: Constructor, handlerName: string | symbol
|
|
96
|
+
static getHandlerGuards(controller: Constructor, handlerName: string | symbol): IGuard[];
|
|
103
97
|
/**
|
|
104
98
|
* Resolves pipe classes or instances to pipe instances
|
|
105
99
|
* @param pipeItems - The pipe classes or instances to resolve
|
|
@@ -110,10 +104,9 @@ export declare class ComponentManager {
|
|
|
110
104
|
* Gets pipes for a specific handler
|
|
111
105
|
* @param controller - The controller class
|
|
112
106
|
* @param handlerName - The handler method name
|
|
113
|
-
* @param routePath - The route path
|
|
114
107
|
* ..returns An array of pipe instances
|
|
115
108
|
*/
|
|
116
|
-
static getHandlerPipes(controller: Constructor, handlerName: string | symbol
|
|
109
|
+
static getHandlerPipes(controller: Constructor, handlerName: string | symbol): IPipe[];
|
|
117
110
|
/**
|
|
118
111
|
* Executes a series of pipes on a value
|
|
119
112
|
* Pipes are executed in sequence, with each pipe's output feeding into the next pipe
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ControllerOptions, FilterType, GuardType, MiddlewareType, ModuleOptions, ParameterMetadata, PipeType, RouteDefinition } from '../interfaces';
|
|
2
|
-
import type { ComponentWithpath } from '../interfaces/component-with-path.interface';
|
|
3
2
|
import type { Constructor } from '../types';
|
|
4
3
|
/**
|
|
5
4
|
* Available component types that can be registered at different levels in the application
|
|
@@ -70,11 +69,6 @@ export declare class MetadataRegistry {
|
|
|
70
69
|
* Components registered here apply to all routes
|
|
71
70
|
*/
|
|
72
71
|
private static readonly global;
|
|
73
|
-
/**
|
|
74
|
-
* Registry for global-level components with a path
|
|
75
|
-
* Components registered here apply to routes matching the path
|
|
76
|
-
*/
|
|
77
|
-
private static readonly globalWithPath;
|
|
78
72
|
/**
|
|
79
73
|
* Registry for controller-level components
|
|
80
74
|
* Components registered here apply to all routes in a specific controller
|
|
@@ -155,18 +149,10 @@ export declare class MetadataRegistry {
|
|
|
155
149
|
* Register a component at the global level
|
|
156
150
|
*/
|
|
157
151
|
static registerGlobal<T extends ComponentType>(type: T, component: ComponentTypeMap[T]): void;
|
|
158
|
-
/**
|
|
159
|
-
* Register a component with a path at the global level
|
|
160
|
-
*/
|
|
161
|
-
static registerGlobalWithPath<T extends ComponentType>(type: T, component: ComponentWithpath<ComponentTypeMap[T]>): void;
|
|
162
152
|
/**
|
|
163
153
|
* Get all global components of a specific type
|
|
164
154
|
*/
|
|
165
155
|
static getGlobal<T extends ComponentType>(type: T): Set<ComponentTypeMap[T]>;
|
|
166
|
-
/**
|
|
167
|
-
* Get all global components with a path of a specific type
|
|
168
|
-
*/
|
|
169
|
-
static getGlobalWithPath<T extends ComponentType>(type: T): ComponentWithpath<ComponentTypeMap[T]>[];
|
|
170
156
|
/**
|
|
171
157
|
* Register a component at the controller level
|
|
172
158
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "honestjs",
|
|
3
|
-
"
|
|
3
|
+
"description": "HonestJS - a modern web framework built on top of Hono",
|
|
4
|
+
"version": "0.1.5",
|
|
4
5
|
"author": "Orkhan Karimov <karimovok1@gmail.com> (https://github.com/kerimovok)",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -9,22 +10,21 @@
|
|
|
9
10
|
"main": "dist/index.js",
|
|
10
11
|
"module": "dist/index.js",
|
|
11
12
|
"devDependencies": {
|
|
12
|
-
"@eslint/js": "^9.
|
|
13
|
-
"@types/bun": "
|
|
14
|
-
"eslint": "^9.
|
|
15
|
-
"eslint-config-prettier": "^10.1.
|
|
13
|
+
"@eslint/js": "^9.31.0",
|
|
14
|
+
"@types/bun": "^1.2.19",
|
|
15
|
+
"eslint": "^9.31.0",
|
|
16
|
+
"eslint-config-prettier": "^10.1.8",
|
|
16
17
|
"globals": "^16.3.0",
|
|
17
18
|
"husky": "^9.1.7",
|
|
18
19
|
"lint-staged": "^16.1.2",
|
|
19
|
-
"prettier": "3.
|
|
20
|
-
"typescript-eslint": "^8.
|
|
20
|
+
"prettier": "3.6.2",
|
|
21
|
+
"typescript-eslint": "^8.37.0"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
|
-
"hono": "^4",
|
|
24
|
-
"typescript": "^5",
|
|
24
|
+
"hono": "^4.8.5",
|
|
25
|
+
"typescript": "^5.8.3",
|
|
25
26
|
"reflect-metadata": "^0.2.2"
|
|
26
27
|
},
|
|
27
|
-
"description": "HonestJS - a modern web framework built on top of Hono",
|
|
28
28
|
"files": [
|
|
29
29
|
"dist"
|
|
30
30
|
],
|