@jderstd/hono 0.8.0 → 0.8.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"not-found.js","names":["code: ResponseErrorCode","ResponseErrorCode","createJsonResponse","getResponseErrorMessage"],"sources":["../src/handlers/not-found.ts"],"sourcesContent":["import type { Context } from \"hono\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { getResponseErrorMessage, ResponseErrorCode } from \"#/response/error\";\n\n/**\n * Not found handler.\n *\n * Following response will be returned on route not found:\n *\n * ```jsonc\n * // Status: 404\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"not_found\",\n * \"message\": \"Content not found\"\n * }\n * ]\n * }\n * ```\n *\n * ### Example\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { notFoundHandler } from \"@jderstd/hono/not-found\";\n *\n * const app: Hono = new Hono();\n *\n * app.notFound(notFoundHandler());\n * ```\n */\nconst notFoundHandler = (): ((c: Context) => Response) => {\n const code: ResponseErrorCode = ResponseErrorCode.NotFound;\n\n return (c: Context): Response => {\n return createJsonResponse(c, {\n status: 404,\n errors: [\n {\n code,\n message: getResponseErrorMessage(code),\n },\n ],\n });\n };\n};\n\nexport { notFoundHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,wBAAoD;CACtD,MAAMA,OAA0BC,+CAAkB;AAElD,SAAQ,MAAyB;AAC7B,SAAOC,iCAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI;IACA,SAASC,qDAAwB,KAAK;IACzC,CACJ;GACJ,CAAC"}
1
+ {"version":3,"file":"not-found.js","names":["code: ResponseErrorCode","ResponseErrorCode","createJsonResponse","getResponseErrorMessage"],"sources":["../src/handlers/not-found.ts"],"sourcesContent":["/**\n * Not found handler module\n * @module handlers/not-found\n */\n\nimport type { Context } from \"hono\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { getResponseErrorMessage, ResponseErrorCode } from \"#/response/error\";\n\n/**\n * Not found handler.\n *\n * Following response will be returned on route not found:\n *\n * ```jsonc\n * // Status: 404\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"not_found\",\n * \"message\": \"Content not found\"\n * }\n * ]\n * }\n * ```\n *\n * ### Example\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { notFoundHandler } from \"@jderstd/hono/not-found\";\n *\n * const app: Hono = new Hono();\n *\n * app.notFound(notFoundHandler());\n * ```\n */\nconst notFoundHandler = (): ((c: Context) => Response) => {\n const code: ResponseErrorCode = ResponseErrorCode.NotFound;\n\n return (c: Context): Response => {\n return createJsonResponse(c, {\n status: 404,\n errors: [\n {\n code,\n message: getResponseErrorMessage(code),\n },\n ],\n });\n };\n};\n\nexport { notFoundHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,wBAAoD;CACtD,MAAMA,OAA0BC,+CAAkB;AAElD,SAAQ,MAAyB;AAC7B,SAAOC,iCAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI;IACA,SAASC,qDAAwB,KAAK;IACzC,CACJ;GACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"not-found.mjs","names":["code: ResponseErrorCode"],"sources":["../src/handlers/not-found.ts"],"sourcesContent":["import type { Context } from \"hono\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { getResponseErrorMessage, ResponseErrorCode } from \"#/response/error\";\n\n/**\n * Not found handler.\n *\n * Following response will be returned on route not found:\n *\n * ```jsonc\n * // Status: 404\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"not_found\",\n * \"message\": \"Content not found\"\n * }\n * ]\n * }\n * ```\n *\n * ### Example\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { notFoundHandler } from \"@jderstd/hono/not-found\";\n *\n * const app: Hono = new Hono();\n *\n * app.notFound(notFoundHandler());\n * ```\n */\nconst notFoundHandler = (): ((c: Context) => Response) => {\n const code: ResponseErrorCode = ResponseErrorCode.NotFound;\n\n return (c: Context): Response => {\n return createJsonResponse(c, {\n status: 404,\n errors: [\n {\n code,\n message: getResponseErrorMessage(code),\n },\n ],\n });\n };\n};\n\nexport { notFoundHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,wBAAoD;CACtD,MAAMA,OAA0B,kBAAkB;AAElD,SAAQ,MAAyB;AAC7B,SAAO,mBAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI;IACA,SAAS,wBAAwB,KAAK;IACzC,CACJ;GACJ,CAAC"}
1
+ {"version":3,"file":"not-found.mjs","names":["code: ResponseErrorCode"],"sources":["../src/handlers/not-found.ts"],"sourcesContent":["/**\n * Not found handler module\n * @module handlers/not-found\n */\n\nimport type { Context } from \"hono\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { getResponseErrorMessage, ResponseErrorCode } from \"#/response/error\";\n\n/**\n * Not found handler.\n *\n * Following response will be returned on route not found:\n *\n * ```jsonc\n * // Status: 404\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"not_found\",\n * \"message\": \"Content not found\"\n * }\n * ]\n * }\n * ```\n *\n * ### Example\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { notFoundHandler } from \"@jderstd/hono/not-found\";\n *\n * const app: Hono = new Hono();\n *\n * app.notFound(notFoundHandler());\n * ```\n */\nconst notFoundHandler = (): ((c: Context) => Response) => {\n const code: ResponseErrorCode = ResponseErrorCode.NotFound;\n\n return (c: Context): Response => {\n return createJsonResponse(c, {\n status: 404,\n errors: [\n {\n code,\n message: getResponseErrorMessage(code),\n },\n ],\n });\n };\n};\n\nexport { notFoundHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,wBAAoD;CACtD,MAAMA,OAA0B,kBAAkB;AAElD,SAAQ,MAAyB;AAC7B,SAAO,mBAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI;IACA,SAAS,wBAAwB,KAAK;IACzC,CACJ;GACJ,CAAC"}
@@ -62,5 +62,5 @@ type OnErrorHandlerOptions = {
62
62
  * ```
63
63
  */
64
64
  declare const onErrorHandler: (options?: OnErrorHandlerOptions) => ((err: Error | HTTPResponseError, c: Context) => Response);
65
- export { onErrorHandler };
65
+ export { type OnErrorHandlerOptions, onErrorHandler };
66
66
  //# sourceMappingURL=on-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"on-error.js","names":["JderHttpException","HTTPException","res: Response","code: ResponseErrorCode","ResponseErrorCode","createJsonResponse"],"sources":["../src/handlers/on-error.ts"],"sourcesContent":["import type { Context } from \"hono\";\nimport type { HTTPResponseError } from \"hono/types\";\nimport type { StatusCode } from \"hono/utils/http-status\";\n\nimport { HTTPException } from \"hono/http-exception\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { ResponseErrorCode } from \"#/response/error\";\nimport { JderHttpException } from \"#/response/error/http\";\n\n/** Options for `onErrorHandler` function. */\ntype OnErrorHandlerOptions = {\n /**\n * Whether show more information.\n * By default, it's `false`.\n */\n verbose?: boolean;\n};\n\n/**\n * On error handler.\n *\n * Following responses could be returned on error:\n *\n * ```jsonc\n * // Status: 400\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"bad_request\"\n * }\n * ]\n * }\n * ```\n *\n * ```jsonc\n * // Status: 500\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"server\"\n * }\n * ]\n * }\n * ```\n *\n * ### Examples\n *\n * Basic example of using `onErrorHandler` handler:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler());\n * ```\n *\n * Show more information with `verbose` option:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler({ verbose: true }));\n * ```\n */\nconst onErrorHandler = (\n options?: OnErrorHandlerOptions,\n): ((err: Error | HTTPResponseError, c: Context) => Response) => {\n return (err: Error | HTTPResponseError, c: Context): Response => {\n // HTTP Exception for JDER format response\n if (err instanceof JderHttpException) return err.getResponse();\n\n // HTTP Exception\n if (err instanceof HTTPException) {\n const res: Response = err.getResponse();\n\n const status: StatusCode = res.status as StatusCode;\n\n const code: ResponseErrorCode =\n status >= 500\n ? ResponseErrorCode.Server\n : ResponseErrorCode.BadRequest;\n\n return createJsonResponse(c, {\n status: res.status as StatusCode,\n errors: [\n {\n code,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n }\n\n // Internal server error\n return createJsonResponse(c, {\n status: 500,\n errors: [\n {\n code: ResponseErrorCode.Server,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n };\n};\n\nexport { onErrorHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,MAAM,kBACF,YAC6D;AAC7D,SAAQ,KAAgC,MAAyB;AAE7D,MAAI,eAAeA,8CAAmB,QAAO,IAAI,aAAa;AAG9D,MAAI,eAAeC,mCAAe;GAC9B,MAAMC,MAAgB,IAAI,aAAa;GAIvC,MAAMC,OAFqB,IAAI,UAGjB,MACJC,+CAAkB,SAClBA,+CAAkB;AAE5B,UAAOC,iCAAmB,GAAG;IACzB,QAAQ,IAAI;IACZ,QAAQ,CACJ;KACI;KACA,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;KACJ,CACJ;IACJ,CAAC;;AAIN,SAAOA,iCAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI,MAAMD,+CAAkB;IACxB,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;IACJ,CACJ;GACJ,CAAC"}
1
+ {"version":3,"file":"on-error.js","names":["JderHttpException","HTTPException","res: Response","code: ResponseErrorCode","ResponseErrorCode","createJsonResponse"],"sources":["../src/handlers/on-error.ts"],"sourcesContent":["/**\n * On error handler module\n * @module handlers/on-error\n */\n\nimport type { Context } from \"hono\";\nimport type { HTTPResponseError } from \"hono/types\";\nimport type { StatusCode } from \"hono/utils/http-status\";\n\nimport { HTTPException } from \"hono/http-exception\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { ResponseErrorCode } from \"#/response/error\";\nimport { JderHttpException } from \"#/response/error/http\";\n\n/** Options for `onErrorHandler` function. */\ntype OnErrorHandlerOptions = {\n /**\n * Whether show more information.\n * By default, it's `false`.\n */\n verbose?: boolean;\n};\n\n/**\n * On error handler.\n *\n * Following responses could be returned on error:\n *\n * ```jsonc\n * // Status: 400\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"bad_request\"\n * }\n * ]\n * }\n * ```\n *\n * ```jsonc\n * // Status: 500\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"server\"\n * }\n * ]\n * }\n * ```\n *\n * ### Examples\n *\n * Basic example of using `onErrorHandler` handler:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler());\n * ```\n *\n * Show more information with `verbose` option:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler({ verbose: true }));\n * ```\n */\nconst onErrorHandler = (\n options?: OnErrorHandlerOptions,\n): ((err: Error | HTTPResponseError, c: Context) => Response) => {\n return (err: Error | HTTPResponseError, c: Context): Response => {\n // HTTP Exception for JDER format response\n if (err instanceof JderHttpException) return err.getResponse();\n\n // HTTP Exception\n if (err instanceof HTTPException) {\n const res: Response = err.getResponse();\n\n const status: StatusCode = res.status as StatusCode;\n\n const code: ResponseErrorCode =\n status >= 500\n ? ResponseErrorCode.Server\n : ResponseErrorCode.BadRequest;\n\n return createJsonResponse(c, {\n status: res.status as StatusCode,\n errors: [\n {\n code,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n }\n\n // Internal server error\n return createJsonResponse(c, {\n status: 500,\n errors: [\n {\n code: ResponseErrorCode.Server,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n };\n};\n\nexport type { OnErrorHandlerOptions };\nexport { onErrorHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAM,kBACF,YAC6D;AAC7D,SAAQ,KAAgC,MAAyB;AAE7D,MAAI,eAAeA,8CAAmB,QAAO,IAAI,aAAa;AAG9D,MAAI,eAAeC,mCAAe;GAC9B,MAAMC,MAAgB,IAAI,aAAa;GAIvC,MAAMC,OAFqB,IAAI,UAGjB,MACJC,+CAAkB,SAClBA,+CAAkB;AAE5B,UAAOC,iCAAmB,GAAG;IACzB,QAAQ,IAAI;IACZ,QAAQ,CACJ;KACI;KACA,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;KACJ,CACJ;IACJ,CAAC;;AAIN,SAAOA,iCAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI,MAAMD,+CAAkB;IACxB,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;IACJ,CACJ;GACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"on-error.mjs","names":["res: Response","code: ResponseErrorCode"],"sources":["../src/handlers/on-error.ts"],"sourcesContent":["import type { Context } from \"hono\";\nimport type { HTTPResponseError } from \"hono/types\";\nimport type { StatusCode } from \"hono/utils/http-status\";\n\nimport { HTTPException } from \"hono/http-exception\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { ResponseErrorCode } from \"#/response/error\";\nimport { JderHttpException } from \"#/response/error/http\";\n\n/** Options for `onErrorHandler` function. */\ntype OnErrorHandlerOptions = {\n /**\n * Whether show more information.\n * By default, it's `false`.\n */\n verbose?: boolean;\n};\n\n/**\n * On error handler.\n *\n * Following responses could be returned on error:\n *\n * ```jsonc\n * // Status: 400\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"bad_request\"\n * }\n * ]\n * }\n * ```\n *\n * ```jsonc\n * // Status: 500\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"server\"\n * }\n * ]\n * }\n * ```\n *\n * ### Examples\n *\n * Basic example of using `onErrorHandler` handler:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler());\n * ```\n *\n * Show more information with `verbose` option:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler({ verbose: true }));\n * ```\n */\nconst onErrorHandler = (\n options?: OnErrorHandlerOptions,\n): ((err: Error | HTTPResponseError, c: Context) => Response) => {\n return (err: Error | HTTPResponseError, c: Context): Response => {\n // HTTP Exception for JDER format response\n if (err instanceof JderHttpException) return err.getResponse();\n\n // HTTP Exception\n if (err instanceof HTTPException) {\n const res: Response = err.getResponse();\n\n const status: StatusCode = res.status as StatusCode;\n\n const code: ResponseErrorCode =\n status >= 500\n ? ResponseErrorCode.Server\n : ResponseErrorCode.BadRequest;\n\n return createJsonResponse(c, {\n status: res.status as StatusCode,\n errors: [\n {\n code,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n }\n\n // Internal server error\n return createJsonResponse(c, {\n status: 500,\n errors: [\n {\n code: ResponseErrorCode.Server,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n };\n};\n\nexport { onErrorHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,MAAM,kBACF,YAC6D;AAC7D,SAAQ,KAAgC,MAAyB;AAE7D,MAAI,eAAe,kBAAmB,QAAO,IAAI,aAAa;AAG9D,MAAI,eAAe,eAAe;GAC9B,MAAMA,MAAgB,IAAI,aAAa;GAIvC,MAAMC,OAFqB,IAAI,UAGjB,MACJ,kBAAkB,SAClB,kBAAkB;AAE5B,UAAO,mBAAmB,GAAG;IACzB,QAAQ,IAAI;IACZ,QAAQ,CACJ;KACI;KACA,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;KACJ,CACJ;IACJ,CAAC;;AAIN,SAAO,mBAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI,MAAM,kBAAkB;IACxB,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;IACJ,CACJ;GACJ,CAAC"}
1
+ {"version":3,"file":"on-error.mjs","names":["res: Response","code: ResponseErrorCode"],"sources":["../src/handlers/on-error.ts"],"sourcesContent":["/**\n * On error handler module\n * @module handlers/on-error\n */\n\nimport type { Context } from \"hono\";\nimport type { HTTPResponseError } from \"hono/types\";\nimport type { StatusCode } from \"hono/utils/http-status\";\n\nimport { HTTPException } from \"hono/http-exception\";\n\nimport { createJsonResponse } from \"#/response\";\nimport { ResponseErrorCode } from \"#/response/error\";\nimport { JderHttpException } from \"#/response/error/http\";\n\n/** Options for `onErrorHandler` function. */\ntype OnErrorHandlerOptions = {\n /**\n * Whether show more information.\n * By default, it's `false`.\n */\n verbose?: boolean;\n};\n\n/**\n * On error handler.\n *\n * Following responses could be returned on error:\n *\n * ```jsonc\n * // Status: 400\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"bad_request\"\n * }\n * ]\n * }\n * ```\n *\n * ```jsonc\n * // Status: 500\n * {\n * \"success\": false,\n * \"errors\": [\n * {\n * \"code\": \"server\"\n * }\n * ]\n * }\n * ```\n *\n * ### Examples\n *\n * Basic example of using `onErrorHandler` handler:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler());\n * ```\n *\n * Show more information with `verbose` option:\n *\n * ```ts\n * import { Hono } from \"hono\";\n * import { onErrorHandler } from \"@jderstd/hono/on-error\";\n *\n * const app: Hono = new Hono();\n *\n * app.onError(onErrorHandler({ verbose: true }));\n * ```\n */\nconst onErrorHandler = (\n options?: OnErrorHandlerOptions,\n): ((err: Error | HTTPResponseError, c: Context) => Response) => {\n return (err: Error | HTTPResponseError, c: Context): Response => {\n // HTTP Exception for JDER format response\n if (err instanceof JderHttpException) return err.getResponse();\n\n // HTTP Exception\n if (err instanceof HTTPException) {\n const res: Response = err.getResponse();\n\n const status: StatusCode = res.status as StatusCode;\n\n const code: ResponseErrorCode =\n status >= 500\n ? ResponseErrorCode.Server\n : ResponseErrorCode.BadRequest;\n\n return createJsonResponse(c, {\n status: res.status as StatusCode,\n errors: [\n {\n code,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n }\n\n // Internal server error\n return createJsonResponse(c, {\n status: 500,\n errors: [\n {\n code: ResponseErrorCode.Server,\n ...(options?.verbose && {\n message: err.message,\n }),\n },\n ],\n });\n };\n};\n\nexport type { OnErrorHandlerOptions };\nexport { onErrorHandler };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAM,kBACF,YAC6D;AAC7D,SAAQ,KAAgC,MAAyB;AAE7D,MAAI,eAAe,kBAAmB,QAAO,IAAI,aAAa;AAG9D,MAAI,eAAe,eAAe;GAC9B,MAAMA,MAAgB,IAAI,aAAa;GAIvC,MAAMC,OAFqB,IAAI,UAGjB,MACJ,kBAAkB,SAClB,kBAAkB;AAE5B,UAAO,mBAAmB,GAAG;IACzB,QAAQ,IAAI;IACZ,QAAQ,CACJ;KACI;KACA,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;KACJ,CACJ;IACJ,CAAC;;AAIN,SAAO,mBAAmB,GAAG;GACzB,QAAQ;GACR,QAAQ,CACJ;IACI,MAAM,kBAAkB;IACxB,GAAI,SAAS,WAAW,EACpB,SAAS,IAAI,SAChB;IACJ,CACJ;GACJ,CAAC"}
@@ -1,4 +1,7 @@
1
1
  import { HTTPException } from "hono/http-exception";
2
+ /**
3
+ * Jder HTTP exception class extended from `HTTPException`.
4
+ */
2
5
  declare class JderHttpException extends HTTPException {}
3
6
  export { JderHttpException };
4
7
  //# sourceMappingURL=http.d.ts.map
@@ -1,5 +1,12 @@
1
1
  let hono_http_exception = require("hono/http-exception");
2
2
 
3
+ /**
4
+ * HTTP response error module
5
+ * @module response/error/http
6
+ */
7
+ /**
8
+ * Jder HTTP exception class extended from `HTTPException`.
9
+ */
3
10
  var JderHttpException = class extends hono_http_exception.HTTPException {};
4
11
 
5
12
  exports.JderHttpException = JderHttpException;
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","names":["HTTPException"],"sources":["../../../src/response/error/http.ts"],"sourcesContent":["import { HTTPException } from \"hono/http-exception\";\n\nclass JderHttpException extends HTTPException {}\n\nexport { JderHttpException };\n"],"mappings":";;AAEA,IAAM,oBAAN,cAAgCA,kCAAc"}
1
+ {"version":3,"file":"http.js","names":["HTTPException"],"sources":["../../../src/response/error/http.ts"],"sourcesContent":["/**\n * HTTP response error module\n * @module response/error/http\n */\n\nimport { HTTPException } from \"hono/http-exception\";\n\n/**\n * Jder HTTP exception class extended from `HTTPException`.\n */\nclass JderHttpException extends HTTPException {}\n\nexport { JderHttpException };\n"],"mappings":";;;;;;;;;AAUA,IAAM,oBAAN,cAAgCA,kCAAc"}
@@ -1,5 +1,12 @@
1
1
  import { HTTPException } from "hono/http-exception";
2
2
 
3
+ /**
4
+ * HTTP response error module
5
+ * @module response/error/http
6
+ */
7
+ /**
8
+ * Jder HTTP exception class extended from `HTTPException`.
9
+ */
3
10
  var JderHttpException = class extends HTTPException {};
4
11
 
5
12
  export { JderHttpException };
@@ -1 +1 @@
1
- {"version":3,"file":"http.mjs","names":[],"sources":["../../../src/response/error/http.ts"],"sourcesContent":["import { HTTPException } from \"hono/http-exception\";\n\nclass JderHttpException extends HTTPException {}\n\nexport { JderHttpException };\n"],"mappings":";;AAEA,IAAM,oBAAN,cAAgC,cAAc"}
1
+ {"version":3,"file":"http.mjs","names":[],"sources":["../../../src/response/error/http.ts"],"sourcesContent":["/**\n * HTTP response error module\n * @module response/error/http\n */\n\nimport { HTTPException } from \"hono/http-exception\";\n\n/**\n * Jder HTTP exception class extended from `HTTPException`.\n */\nclass JderHttpException extends HTTPException {}\n\nexport { JderHttpException };\n"],"mappings":";;;;;;;;;AAUA,IAAM,oBAAN,cAAgC,cAAc"}
@@ -1,4 +1,8 @@
1
1
  /**
2
+ * Response error module
3
+ * @module response/error
4
+ */
5
+ /**
2
6
  * Response error code.
3
7
  */
4
8
  declare enum ResponseErrorCode {
@@ -1,4 +1,8 @@
1
1
 
2
+ /**
3
+ * Response error module
4
+ * @module response/error
5
+ */
2
6
  /**
3
7
  * Response error code.
4
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/response/error/index.ts"],"sourcesContent":["/**\n * Response error code.\n */\nenum ResponseErrorCode {\n /**\n * Request body is too large.\n *\n * For `bodyLimit` middleware.\n */\n TooLarge = \"too_large\",\n /**\n * Forbidden access.\n *\n * For `ipLimit` middleware.\n */\n Forbidden = \"forbidden\",\n /**\n * Request timeout.\n *\n * For `timeLimit` middleware.\n */\n Timeout = \"timeout\",\n /**\n * Content not found.\n *\n * For `notFoundHandler` function.\n */\n NotFound = \"not_found\",\n /**\n * Bad request.\n *\n * For `onErrorHandler` function.\n */\n BadRequest = \"bad_request\",\n /**\n * Internal server error.\n *\n * For `onErrorHandler` function.\n */\n Server = \"server\",\n /**\n * Validation error.\n *\n * For validator package.\n */\n Parse = \"parse\",\n}\n\n/**\n * Get response error message by code.\n */\nconst getResponseErrorMessage = (code: ResponseErrorCode): string => {\n switch (code) {\n case ResponseErrorCode.TooLarge: {\n return \"Request body is too large\";\n }\n case ResponseErrorCode.Forbidden: {\n return \"Forbidden IP address\";\n }\n case ResponseErrorCode.Timeout: {\n return \"Gateway timeout\";\n }\n case ResponseErrorCode.NotFound: {\n return \"Content not found\";\n }\n case ResponseErrorCode.BadRequest: {\n return \"Bad request\";\n }\n case ResponseErrorCode.Server: {\n return \"Internal server error\";\n }\n case ResponseErrorCode.Parse: {\n return \"Failed to parse the request\";\n }\n }\n};\n\nexport { ResponseErrorCode, getResponseErrorMessage };\n"],"mappings":";;;;AAGA,IAAK,kEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,MAAM,2BAA2B,SAAoC;AACjE,SAAQ,MAAR;EACI,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,UACnB,QAAO;EAEX,KAAK,kBAAkB,QACnB,QAAO;EAEX,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,WACnB,QAAO;EAEX,KAAK,kBAAkB,OACnB,QAAO;EAEX,KAAK,kBAAkB,MACnB,QAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/response/error/index.ts"],"sourcesContent":["/**\n * Response error module\n * @module response/error\n */\n\n/**\n * Response error code.\n */\nenum ResponseErrorCode {\n /**\n * Request body is too large.\n *\n * For `bodyLimit` middleware.\n */\n TooLarge = \"too_large\",\n /**\n * Forbidden access.\n *\n * For `ipLimit` middleware.\n */\n Forbidden = \"forbidden\",\n /**\n * Request timeout.\n *\n * For `timeLimit` middleware.\n */\n Timeout = \"timeout\",\n /**\n * Content not found.\n *\n * For `notFoundHandler` function.\n */\n NotFound = \"not_found\",\n /**\n * Bad request.\n *\n * For `onErrorHandler` function.\n */\n BadRequest = \"bad_request\",\n /**\n * Internal server error.\n *\n * For `onErrorHandler` function.\n */\n Server = \"server\",\n /**\n * Validation error.\n *\n * For validator package.\n */\n Parse = \"parse\",\n}\n\n/**\n * Get response error message by code.\n */\nconst getResponseErrorMessage = (code: ResponseErrorCode): string => {\n switch (code) {\n case ResponseErrorCode.TooLarge: {\n return \"Request body is too large\";\n }\n case ResponseErrorCode.Forbidden: {\n return \"Forbidden IP address\";\n }\n case ResponseErrorCode.Timeout: {\n return \"Gateway timeout\";\n }\n case ResponseErrorCode.NotFound: {\n return \"Content not found\";\n }\n case ResponseErrorCode.BadRequest: {\n return \"Bad request\";\n }\n case ResponseErrorCode.Server: {\n return \"Internal server error\";\n }\n case ResponseErrorCode.Parse: {\n return \"Failed to parse the request\";\n }\n }\n};\n\nexport { ResponseErrorCode, getResponseErrorMessage };\n"],"mappings":";;;;;;;;AAQA,IAAK,kEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,MAAM,2BAA2B,SAAoC;AACjE,SAAQ,MAAR;EACI,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,UACnB,QAAO;EAEX,KAAK,kBAAkB,QACnB,QAAO;EAEX,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,WACnB,QAAO;EAEX,KAAK,kBAAkB,OACnB,QAAO;EAEX,KAAK,kBAAkB,MACnB,QAAO"}
@@ -1,4 +1,8 @@
1
1
  /**
2
+ * Response error module
3
+ * @module response/error
4
+ */
5
+ /**
2
6
  * Response error code.
3
7
  */
4
8
  var ResponseErrorCode = /* @__PURE__ */ function(ResponseErrorCode$1) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/response/error/index.ts"],"sourcesContent":["/**\n * Response error code.\n */\nenum ResponseErrorCode {\n /**\n * Request body is too large.\n *\n * For `bodyLimit` middleware.\n */\n TooLarge = \"too_large\",\n /**\n * Forbidden access.\n *\n * For `ipLimit` middleware.\n */\n Forbidden = \"forbidden\",\n /**\n * Request timeout.\n *\n * For `timeLimit` middleware.\n */\n Timeout = \"timeout\",\n /**\n * Content not found.\n *\n * For `notFoundHandler` function.\n */\n NotFound = \"not_found\",\n /**\n * Bad request.\n *\n * For `onErrorHandler` function.\n */\n BadRequest = \"bad_request\",\n /**\n * Internal server error.\n *\n * For `onErrorHandler` function.\n */\n Server = \"server\",\n /**\n * Validation error.\n *\n * For validator package.\n */\n Parse = \"parse\",\n}\n\n/**\n * Get response error message by code.\n */\nconst getResponseErrorMessage = (code: ResponseErrorCode): string => {\n switch (code) {\n case ResponseErrorCode.TooLarge: {\n return \"Request body is too large\";\n }\n case ResponseErrorCode.Forbidden: {\n return \"Forbidden IP address\";\n }\n case ResponseErrorCode.Timeout: {\n return \"Gateway timeout\";\n }\n case ResponseErrorCode.NotFound: {\n return \"Content not found\";\n }\n case ResponseErrorCode.BadRequest: {\n return \"Bad request\";\n }\n case ResponseErrorCode.Server: {\n return \"Internal server error\";\n }\n case ResponseErrorCode.Parse: {\n return \"Failed to parse the request\";\n }\n }\n};\n\nexport { ResponseErrorCode, getResponseErrorMessage };\n"],"mappings":";;;AAGA,IAAK,kEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,MAAM,2BAA2B,SAAoC;AACjE,SAAQ,MAAR;EACI,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,UACnB,QAAO;EAEX,KAAK,kBAAkB,QACnB,QAAO;EAEX,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,WACnB,QAAO;EAEX,KAAK,kBAAkB,OACnB,QAAO;EAEX,KAAK,kBAAkB,MACnB,QAAO"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/response/error/index.ts"],"sourcesContent":["/**\n * Response error module\n * @module response/error\n */\n\n/**\n * Response error code.\n */\nenum ResponseErrorCode {\n /**\n * Request body is too large.\n *\n * For `bodyLimit` middleware.\n */\n TooLarge = \"too_large\",\n /**\n * Forbidden access.\n *\n * For `ipLimit` middleware.\n */\n Forbidden = \"forbidden\",\n /**\n * Request timeout.\n *\n * For `timeLimit` middleware.\n */\n Timeout = \"timeout\",\n /**\n * Content not found.\n *\n * For `notFoundHandler` function.\n */\n NotFound = \"not_found\",\n /**\n * Bad request.\n *\n * For `onErrorHandler` function.\n */\n BadRequest = \"bad_request\",\n /**\n * Internal server error.\n *\n * For `onErrorHandler` function.\n */\n Server = \"server\",\n /**\n * Validation error.\n *\n * For validator package.\n */\n Parse = \"parse\",\n}\n\n/**\n * Get response error message by code.\n */\nconst getResponseErrorMessage = (code: ResponseErrorCode): string => {\n switch (code) {\n case ResponseErrorCode.TooLarge: {\n return \"Request body is too large\";\n }\n case ResponseErrorCode.Forbidden: {\n return \"Forbidden IP address\";\n }\n case ResponseErrorCode.Timeout: {\n return \"Gateway timeout\";\n }\n case ResponseErrorCode.NotFound: {\n return \"Content not found\";\n }\n case ResponseErrorCode.BadRequest: {\n return \"Bad request\";\n }\n case ResponseErrorCode.Server: {\n return \"Internal server error\";\n }\n case ResponseErrorCode.Parse: {\n return \"Failed to parse the request\";\n }\n }\n};\n\nexport { ResponseErrorCode, getResponseErrorMessage };\n"],"mappings":";;;;;;;AAQA,IAAK,kEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,MAAM,2BAA2B,SAAoC;AACjE,SAAQ,MAAR;EACI,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,UACnB,QAAO;EAEX,KAAK,kBAAkB,QACnB,QAAO;EAEX,KAAK,kBAAkB,SACnB,QAAO;EAEX,KAAK,kBAAkB,WACnB,QAAO;EAEX,KAAK,kBAAkB,OACnB,QAAO;EAEX,KAAK,kBAAkB,MACnB,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jderstd/hono",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "A response builder for Hono",
5
5
  "keywords": [
6
6
  "jder",
@@ -73,7 +73,7 @@
73
73
  "dist"
74
74
  ],
75
75
  "dependencies": {
76
- "@jderstd/core": "0.5.0",
76
+ "@jderstd/core": "~0.5.0",
77
77
  "ts-vista": "~0.2.3"
78
78
  },
79
79
  "devDependencies": {