honestjs 0.1.4 → 0.1.6

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
@@ -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
- > ⚠️ **Early Development Warning**
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
@@ -66,22 +76,16 @@ ultra-fast performance of Hono, giving you the best of both worlds.
66
76
 
67
77
  ## Quick Start
68
78
 
69
- ### Using Honest CLI _(Coming Soon)_
79
+ ### Using Honest CLI
70
80
 
71
81
  The fastest way to create a new Honest application is to use the Honest CLI:
72
82
 
73
83
  ```bash
74
84
  # Install Honest CLI globally
75
85
  bun add -g @honestjs/cli
76
- # or
77
- pnpm add -g @honestjs/cli
78
- # or
79
- yarn global add @honestjs/cli
80
- # or
81
- npm install -g @honestjs/cli
82
86
 
83
87
  # Create a new project
84
- honest new my-project
88
+ honestjs new my-project # alias: honest, hnjs
85
89
  cd my-project
86
90
 
87
91
  # Start the development server
@@ -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
- response: {
13
- status: number;
14
- message: string;
15
- timestamp: string;
16
- path: string;
17
- requestId?: string | undefined;
18
- code?: string | undefined;
19
- details?: {
20
- [x: string]: any;
21
- } | undefined;
22
- errors?: {
23
- property: string;
24
- constraints: {
25
- [x: string]: string;
26
- };
27
- }[] | undefined;
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,"&quot;");return`${_}="${q}"`}).filter(Boolean).join(" ")},X_=($)=>{let _={...$$,...$};return U`
1
+ import"reflect-metadata";import{Hono as o}from"hono";class M{instances=new Map;resolve($,_=new Set){if(this.instances.has($))return this.instances.get($);if(_.has($))throw 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 a}from"hono/http-exception";function K($,_,W){let Y=new Date().toISOString(),q=_.get("requestId"),Q=_.req.path;if($ instanceof a)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(_)||[]}static clear(){this.routes.clear(),this.controllers.clear(),this.controllerOptions.clear(),this.services.clear(),this.modules.clear(),this.parameters.clear(),this.contextIndices.clear();for(let $ of this.global.values())$.clear();for(let $ of this.controller.values())$.clear();for(let $ of this.handler.values())$.clear()}}class S{static routes=[];static registerRoute($){if(!$)throw Error("Route info is required");if(!$.controller)throw Error("Route controller is required");if(!$.handler)throw Error("Route handler is required");if(!$.method)throw Error("Route method is required");if(!$.fullPath)throw Error("Route fullPath is required");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}=K($,_);return _.json(W,Y)}}}class C{static handle(){return async($)=>{return $.json({message:`Not Found - ${$.req.path}`},404)}}}var O$=($)=>typeof $>"u",O=($)=>$===null||typeof $>"u",V=($)=>$!==null&&typeof $==="object",T$=($)=>{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)},d=($)=>typeof $==="function",I=($)=>typeof $==="string",S$=($)=>typeof $==="number",N$=($)=>$.length===0,w$=($)=>typeof $==="symbol",P$=($)=>typeof $==="string"?$.charAt(0)!=="/"?"/"+$:$:"",v=($)=>$?$.startsWith("/")?("/"+$.replace(/\/+$/,"")).replace(/\/+/g,"/"):"/"+$.replace(/\/+$/,""):"/",R$=($)=>$.endsWith("/")?$.slice(0,-1):$,c=($)=>{return d($)&&!O($.prototype)&&!d($.prototype)&&Object.getOwnPropertyNames($.prototype).length>1};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(V(_)&&"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(V(_)&&"canActivate"in _)return _;return this.container.resolve(_)})}static getHandlerGuards($,_){let W=this.getComponents("guard",$,_);return this.resolveGuards(W)}static resolvePipes($){return $.map((_)=>{if(V(_)&&"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}let{response:Q,status:J}=K($,_);return _.json(Q,J)}static async executeFilters($,_,W){for(let Y of $){let q;if(V(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 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 r}from"hono/http-exception";var y=Symbol("VERSION_NEUTRAL");class h{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(I($))return v($);return $?`/${$}`:""}registerRouteHandler($,_,W,Y){if(W.length>0)this.hono.on($.toUpperCase(),_,...W,Y);else this.hono.on($.toUpperCase(),_,Y)}buildRoutePath($,_,W,Y){return v(`${$}${_}${W}${Y}`)}formatVersionSegment($){if(O($))return"";return $===y?"":`/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:T,method:E,handlerName:f,version:N,prefix:w}=U,P=w!==void 0?w:z,D=!O(P)?this.normalizePath(P):"",L=N!==void 0?N:G,F=this.normalizePath(T);if(O(L)){this.registerRoute(A,U,q,Q,$,D,"",J,F,E);continue}if(L===y){this.registerRoute(A,U,q,Q,$,D,"",J,F,E),this.registerRoute(A,U,q,Q,$,D,"/:version{v[0-9]+}",J,F,E);continue}if(Array.isArray(L)){for(let H of L){let j=this.formatVersionSegment(H);this.registerRoute(A,U,q,Q,$,D,j,J,F,E)}continue}let R=this.formatVersionSegment(L);this.registerRoute(A,U,q,Q,$,D,R,J,F,E)}}registerRoute($,_,W,Y,q,Q,J,A,z,G){let{handlerName:U}=_,T=this.buildRoutePath(Q,J,A,z),E=$[U].bind($),f=W.get(U)||[],N=Y.get(U),w=Z.getHandlerMiddleware(q,U),P=Z.getHandlerPipes(q,U);S.registerRoute({controller:q.name,handler:U,method:G,prefix:Q,version:J,route:A,path:z,fullPath:T,parameters:f});let D=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 r(403,{message:"Forbidden"});let R=Array(E.length);for(let j of f){let m=j.factory(j.data,L),n=await Z.executePipes(m,{type:j.name,metatype:j.metatype,data:j.data},P);R[j.index]=n}let H=await E(...R);if(N!==void 0)return H;if(O(H))return L.json(null);if(I(H))return L.text(H);return L.json(H)}catch(F){return Z.handleException(F,L)}};this.registerRouteHandler(G,T,w,D)}}class i{hono;container;routeManager;options;constructor($={}){this.options=V($)?$:{},this.hono=new o(this.options.hono),this.container=this.options.container||new M,this.setupComponents(),this.setupErrorHandlers(),this.routeManager=new h(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||C.handle()),this.hono.onError(this.options.onError||x.handle())}resolvePlugin($){if(c($))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 i(_),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 S.getRoutes()}}import{html as B,raw as g}from"hono/html";var t={type:"website",locale:"en_US"},u=($)=>{if(!$)return"";return Object.entries($).map(([_,W])=>{if(typeof W==="boolean")return W?_:"";let Y=String(W).replace(/"/g,"&quot;");return`${_}="${Y}"`}).filter(Boolean).join(" ")},Y_=($)=>{let _={...t,...$};return B`
2
2
  <!DOCTYPE html>
3
- <html lang="${_.locale?.split("_")[0]||"en"}" ${h(m(_.htmlAttributes))}>
4
- <head ${h(m(_.headAttributes))}>
3
+ <html lang="${_.locale?.split("_")[0]||"en"}" ${g(u(_.htmlAttributes))}>
4
+ <head ${g(u(_.headAttributes))}>
5
5
  <meta charset="UTF-8" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- ${_.csp?U`<meta http-equiv="Content-Security-Policy" content="${_.csp}" />`:""}
7
+ ${_.csp?B`<meta http-equiv="Content-Security-Policy" content="${_.csp}" />`:""}
8
8
  <title>${_.title}</title>
9
- ${_.description?U`<meta name="description" content="${_.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?U`<meta property="og:description" content="${_.description}" />`:""}
15
- ${_.image?U`<meta property="og:image" content="${_.image}" />`:""}
16
- ${_.url?U`<meta property="og:url" content="${_.url}" />`:""}
17
- ${_.locale?U`<meta property="og:locale" content="${_.locale}" />`:""}
18
- ${_.type?U`<meta property="og:type" content="${_.type}" />`:""}
19
- ${_.siteName?U`<meta property="og:site_name" content="${_.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?U`<meta name="twitter:description" content="${_.description}" />`:""}
28
- ${_.image?U`<meta name="twitter:image" content="${_.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((Y)=>{let q=Y.name?`name="${Y.name}"`:"",Q=Y.property?`property="${Y.property}"`:"";return U`<meta ${q} ${Q} content="${Y.content}" />`}):""}
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?U`<link rel="icon" href="${_.favicon}" />`:""}
34
+ ${_.favicon?B`<link rel="icon" href="${_.favicon}" />`:""}
35
35
 
36
36
  <!-- Stylesheets -->
37
- ${_.stylesheets?_.stylesheets.map((Y)=>U`<link rel="stylesheet" href="${Y}" />`):""}
37
+ ${_.stylesheets?_.stylesheets.map((W)=>B`<link rel="stylesheet" href="${W}" />`):""}
38
38
 
39
39
  <!-- Scripts -->
40
- ${_.scripts?_.scripts.map((Y)=>{if(typeof Y==="string")return U`<script src="${Y}"></script>`;let{src:q,async:Q,defer:X}=Y;if(Q&&X)return U`<script src="${q}" async defer></script>`;if(Q)return U`<script src="${q}" async></script>`;if(X)return U`<script src="${q}" defer></script>`;return U`<script src="${q}"></script>`}):""}
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
- <body ${h(m(_.bodyAttributes))}>
42
+ <body ${g(u(_.bodyAttributes))}>
43
43
  ${_.children}
44
44
  </body>
45
45
  </html>
46
- `};function s($="",_={}){return(Y)=>{Z.setControllerPath(Y,$),Z.setControllerOptions(Y,_)}}var l=V("get"),L_=V("post"),k_=V("put"),z_=V("delete"),j_=V("patch"),E_=V("options"),G_=V("all");function n($={}){return(_)=>{Z.setModuleOptions(_,$)}}function T_($="",_={prefix:null,version:null}){return s($,_)}var S_=l;function N_($={}){return n({imports:$.imports,services:$.services,controllers:($.views||[]).concat($.controllers||[])})}var R_=j("body",async($,_)=>{let Y=await _.req.json();return $?Y[$]:Y}),P_=j("param",($,_)=>{return $?_.req.param($):_.req.param()}),f_=j("query",($,_)=>{return $?_.req.query($):_.req.query()}),M_=j("header",($,_)=>{return $?_.req.header($):_.req.header()}),x_=j("request",($,_)=>_.req),I_=j("request",($,_)=>_.req),C_=j("response",($,_)=>_.res),v_=j("response",($,_)=>_.res),y_=j("context",($,_)=>_),u_=j("context",($,_)=>_),g_=j("variable",($,_)=>_.get($)),h_=j("variable",($,_)=>_.get($));function c_(){return($)=>{Z.addService($)}}function s_($,..._){return(Y,q)=>{if(q){let Q=Y.constructor;J.registerHandler($,Q,q,..._)}else J.registerController($,Y,..._)}}function r_(...$){return(_,Y)=>{if(Y){let q=_.constructor;J.registerHandler("filter",q,Y,...$)}else J.registerController("filter",_,...$)}}function t_(...$){return(_,Y)=>{if(Y){let q=_.constructor;J.registerHandler("guard",q,Y,...$)}else J.registerController("guard",_,...$)}}function _Y(...$){return(_,Y)=>{if(Y){let q=_.constructor;J.registerHandler("middleware",q,Y,...$)}else J.registerController("middleware",_,...$)}}function QY(...$){return(_,Y)=>{if(Y){let q=_.constructor;J.registerHandler("pipe",q,Y,...$)}else J.registerController("pipe",_,...$)}}export{f$ as stripEndSlash,T as normalizePath,S$ as isUndefined,R$ as isSymbol,y as isString,N$ as isPlainObject,v as isObject,w$ as isNumber,O as isNil,c as isFunction,K$ as isEmpty,i as isConstructor,j as createParamDecorator,V as createHttpMethodDecorator,f as createErrorResponse,P$ as addLeadingSlash,T_ as View,h_ as Variable,g_ as Var,u as VERSION_NEUTRAL,QY as UsePipes,_Y as UseMiddleware,t_ as UseGuards,r_ as UseFilters,s_ as UseComponent,c_ as Service,S as RouteRegistry,g as RouteManager,v_ as Response,C_ as Res,I_ as Request,x_ as Req,f_ as Query,k_ as Put,L_ as Post,j_ as Patch,P_ as Param,S_ as Page,E_ as Options,C as NotFoundHandler,N_ as MvcModule,n as Module,Z as MetadataRegistry,X_ as Layout,M_ as Header,l as Get,I as ErrorHandler,z_ as Delete,y_ as Ctx,s as Controller,u_ as Context,x as Container,J as ComponentManager,R_ as Body,p as Application,G_ as All};
46
+ `};function p($="",_={}){return(W)=>{X.setControllerPath(W,$),X.setControllerOptions(W,_)}}var s=b("get"),B_=b("post"),U_=b("put"),z_=b("delete"),L_=b("patch"),k_=b("options"),j_=b("all");function l($={}){return(_)=>{X.setModuleOptions(_,$)}}function H_($="",_={prefix:null,version:null}){return p($,_)}var O_=s;function T_($={}){return l({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),C_=k("response",($,_)=>_.res),I_=k("context",($,_)=>_),v_=k("context",($,_)=>_),y_=k("variable",($,_)=>_.get($)),h_=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{R$ as stripEndSlash,v as normalizePath,O$ as isUndefined,w$ as isSymbol,I as isString,T$ as isPlainObject,V as isObject,S$ as isNumber,O as isNil,d as isFunction,N$ as isEmpty,c as isConstructor,k as createParamDecorator,b as createHttpMethodDecorator,K as createErrorResponse,P$ as addLeadingSlash,H_ as View,h_ as Variable,y_ as Var,y as VERSION_NEUTRAL,WW as UsePipes,e_ as UseMiddleware,r_ as UseGuards,l_ as UseFilters,i_ as UseComponent,m_ as Service,S as RouteRegistry,h as RouteManager,C_ 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,C as NotFoundHandler,T_ as MvcModule,l as Module,X as MetadataRegistry,Y_ as Layout,K_ as Header,s as Get,x as ErrorHandler,z_ as Delete,I_ as Ctx,p as Controller,v_ as Context,M as Container,Z as ComponentManager,w_ as Body,i 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 { ComponentWithpath } from './component-with-path.interface';
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?: (MiddlewareType | ComponentWithpath<MiddlewareType>)[];
52
+ middleware?: MiddlewareType[];
54
53
  /**
55
54
  * Global guards to apply to all routes
56
55
  */
57
- guards?: (GuardType | ComponentWithpath<GuardType>)[];
56
+ guards?: GuardType[];
58
57
  /**
59
58
  * Global pipes to apply to all routes
60
59
  */
61
- pipes?: (PipeType | ComponentWithpath<PipeType>)[];
60
+ pipes?: PipeType[];
62
61
  /**
63
62
  * Global exception filters to apply to all routes
64
63
  */
65
- filters?: (FilterType | ComponentWithpath<FilterType>)[];
64
+ filters?: FilterType[];
66
65
  };
67
66
  /**
68
67
  * Plugins for extending the application functionality
@@ -4,9 +4,9 @@ import type { Constructor } from '../types';
4
4
  */
5
5
  export interface ArgumentMetadata {
6
6
  /**
7
- * The type of argument (body, query, param, or custom)
7
+ * The type of argument (body, query, param, header, request, response, context, variable, or custom)
8
8
  */
9
- type: 'body' | 'query' | 'param' | 'custom';
9
+ type: 'body' | 'query' | 'param' | 'header' | 'request' | 'response' | 'context' | 'variable' | string;
10
10
  /**
11
11
  * The class type of the argument
12
12
  */
@@ -1,6 +1,5 @@
1
1
  import type { Context, Next } from 'hono';
2
- import type { ArgumentMetadata, DiContainer, FilterType, GuardType, IGuard, IPipe, MiddlewareType, PipeType } from '../interfaces';
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?: (MiddlewareType | ComponentWithpath<MiddlewareType>)[];
33
- guards?: (GuardType | ComponentWithpath<GuardType>)[];
34
- pipes?: (PipeType | ComponentWithpath<PipeType>)[];
35
- filters?: (FilterType | ComponentWithpath<FilterType>)[];
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,65 +60,53 @@ 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
- * ..returns An array of component instances
63
+ * @returns An array of component instances
60
64
  */
61
- static getComponents<T extends ComponentType>(type: T, controller: Constructor, handlerName: string | symbol, routePath: string): ComponentTypeMap[T][];
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
65
- * ..returns An array of middleware functions
69
+ * @returns An array of middleware functions
66
70
  */
67
71
  static resolveMiddleware(middlewareItems: MiddlewareType[]): ((c: Context, next: Next) => Promise<Response | void>)[];
68
72
  /**
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
- * ..returns An array of middleware functions
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>)[];
76
79
  /**
77
80
  * Gets global middleware
78
- * ..returns An array of middleware functions
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
92
- * ..returns An array of guard instances
87
+ * @returns An array of guard instances
93
88
  */
94
89
  static resolveGuards(guardItems: GuardType[]): IGuard[];
95
90
  /**
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
- * ..returns An array of guard instances
94
+ * @returns An array of guard instances
101
95
  */
102
- static getHandlerGuards(controller: Constructor, handlerName: string | symbol, routePath: string): IGuard[];
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
106
- * ..returns An array of pipe instances
100
+ * @returns An array of pipe instances
107
101
  */
108
102
  static resolvePipes(pipeItems: PipeType[]): IPipe[];
109
103
  /**
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
- * ..returns An array of pipe instances
107
+ * @returns An array of pipe instances
115
108
  */
116
- static getHandlerPipes(controller: Constructor, handlerName: string | symbol, routePath: string): IPipe[];
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
@@ -137,7 +130,7 @@ export declare class ComponentManager {
137
130
  * @param filterItems - The exception filter classes or instances to execute
138
131
  * @param exception - The exception that was thrown
139
132
  * @param context - The Hono context object
140
- * ..returns The response from the first filter that handles the exception or undefined if no filter handled it
133
+ * @returns The response from the first filter that handles the exception or undefined if no filter handled it
141
134
  */
142
135
  private static executeFilters;
143
136
  /**
@@ -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
  */
@@ -183,4 +169,10 @@ export declare class MetadataRegistry {
183
169
  * Get all handler-level components of a specific type for a handler
184
170
  */
185
171
  static getHandler<T extends ComponentType>(type: T, handlerKey: string): ComponentTypeMap[T][];
172
+ /**
173
+ * Clears all registered metadata from the registry
174
+ * Primarily used for testing and development purposes
175
+ * Use with caution in production environments
176
+ */
177
+ static clear(): void;
186
178
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "honestjs",
3
- "version": "0.1.4",
3
+ "description": "HonestJS - a modern web framework built on top of Hono",
4
+ "version": "0.1.6",
4
5
  "author": "Orkhan Karimov <karimovok1@gmail.com> (https://github.com/kerimovok)",
5
6
  "repository": {
6
7
  "type": "git",
@@ -8,23 +9,24 @@
8
9
  },
9
10
  "main": "dist/index.js",
10
11
  "module": "dist/index.js",
12
+ "type": "module",
13
+ "types": "dist/index.d.ts",
11
14
  "devDependencies": {
12
- "@eslint/js": "^9.30.1",
13
- "@types/bun": "latest",
14
- "eslint": "^9.30.1",
15
- "eslint-config-prettier": "^10.1.5",
16
- "globals": "^16.3.0",
15
+ "@eslint/js": "^9.39.2",
16
+ "@types/bun": "^1.3.5",
17
+ "eslint": "^9.39.2",
18
+ "eslint-config-prettier": "^10.1.8",
19
+ "globals": "^16.5.0",
17
20
  "husky": "^9.1.7",
18
- "lint-staged": "^16.1.2",
19
- "prettier": "3.5.3",
20
- "typescript-eslint": "^8.35.1"
21
+ "lint-staged": "^16.2.7",
22
+ "prettier": "3.6.2",
23
+ "typescript-eslint": "^8.52.0"
21
24
  },
22
25
  "peerDependencies": {
23
- "hono": "^4",
24
- "typescript": "^5",
26
+ "hono": "^4.8.5",
27
+ "typescript": "^5.8.3",
25
28
  "reflect-metadata": "^0.2.2"
26
29
  },
27
- "description": "HonestJS - a modern web framework built on top of Hono",
28
30
  "files": [
29
31
  "dist"
30
32
  ],
@@ -61,7 +63,5 @@
61
63
  "eslint --fix",
62
64
  "prettier --write"
63
65
  ]
64
- },
65
- "type": "module",
66
- "types": "dist/index.d.ts"
66
+ }
67
67
  }
@@ -1,7 +0,0 @@
1
- /**
2
- * Configuration for a component with a path
3
- */
4
- export interface ComponentWithpath<T> {
5
- path: string;
6
- component: T;
7
- }