@jderstd/hono 0.8.1 → 0.8.2

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.
@@ -50,8 +50,55 @@ declare enum ResponseErrorCode {
50
50
  Parse = "parse",
51
51
  }
52
52
  /**
53
+ * Response error message.
54
+ */
55
+ declare enum ResponseErrorMessage {
56
+ /**
57
+ * Request body is too large.
58
+ *
59
+ * For `bodyLimit` middleware.
60
+ */
61
+ TooLarge = "Request body is too large",
62
+ /**
63
+ * Forbidden access.
64
+ *
65
+ * For `ipLimit` middleware.
66
+ */
67
+ Forbidden = "Forbidden IP address",
68
+ /**
69
+ * Request timeout.
70
+ *
71
+ * For `timeLimit` middleware.
72
+ */
73
+ Timeout = "Gateway timeout",
74
+ /**
75
+ * Content not found.
76
+ *
77
+ * For `notFoundHandler` function.
78
+ */
79
+ NotFound = "Content not found",
80
+ /**
81
+ * Bad request.
82
+ *
83
+ * For `onErrorHandler` function.
84
+ */
85
+ BadRequest = "Bad request",
86
+ /**
87
+ * Internal server error.
88
+ *
89
+ * For `onErrorHandler` function.
90
+ */
91
+ Server = "Internal server error",
92
+ /**
93
+ * Validation error.
94
+ *
95
+ * For validator package.
96
+ */
97
+ Parse = "Failed to parse the request",
98
+ }
99
+ /**
53
100
  * Get response error message by code.
54
101
  */
55
- declare const getResponseErrorMessage: (code: ResponseErrorCode) => string;
56
- export { ResponseErrorCode, getResponseErrorMessage };
102
+ declare const getResponseErrorMessage: (code: ResponseErrorCode) => ResponseErrorMessage;
103
+ export { ResponseErrorCode, ResponseErrorMessage, getResponseErrorMessage };
57
104
  //# sourceMappingURL=index.d.ts.map
@@ -52,20 +52,69 @@ var ResponseErrorCode = /* @__PURE__ */ function(ResponseErrorCode$1) {
52
52
  return ResponseErrorCode$1;
53
53
  }(ResponseErrorCode || {});
54
54
  /**
55
+ * Response error message.
56
+ */
57
+ var ResponseErrorMessage = /* @__PURE__ */ function(ResponseErrorMessage$1) {
58
+ /**
59
+ * Request body is too large.
60
+ *
61
+ * For `bodyLimit` middleware.
62
+ */
63
+ ResponseErrorMessage$1["TooLarge"] = "Request body is too large";
64
+ /**
65
+ * Forbidden access.
66
+ *
67
+ * For `ipLimit` middleware.
68
+ */
69
+ ResponseErrorMessage$1["Forbidden"] = "Forbidden IP address";
70
+ /**
71
+ * Request timeout.
72
+ *
73
+ * For `timeLimit` middleware.
74
+ */
75
+ ResponseErrorMessage$1["Timeout"] = "Gateway timeout";
76
+ /**
77
+ * Content not found.
78
+ *
79
+ * For `notFoundHandler` function.
80
+ */
81
+ ResponseErrorMessage$1["NotFound"] = "Content not found";
82
+ /**
83
+ * Bad request.
84
+ *
85
+ * For `onErrorHandler` function.
86
+ */
87
+ ResponseErrorMessage$1["BadRequest"] = "Bad request";
88
+ /**
89
+ * Internal server error.
90
+ *
91
+ * For `onErrorHandler` function.
92
+ */
93
+ ResponseErrorMessage$1["Server"] = "Internal server error";
94
+ /**
95
+ * Validation error.
96
+ *
97
+ * For validator package.
98
+ */
99
+ ResponseErrorMessage$1["Parse"] = "Failed to parse the request";
100
+ return ResponseErrorMessage$1;
101
+ }(ResponseErrorMessage || {});
102
+ /**
55
103
  * Get response error message by code.
56
104
  */
57
105
  const getResponseErrorMessage = (code) => {
58
106
  switch (code) {
59
- case ResponseErrorCode.TooLarge: return "Request body is too large";
60
- case ResponseErrorCode.Forbidden: return "Forbidden IP address";
61
- case ResponseErrorCode.Timeout: return "Gateway timeout";
62
- case ResponseErrorCode.NotFound: return "Content not found";
63
- case ResponseErrorCode.BadRequest: return "Bad request";
64
- case ResponseErrorCode.Server: return "Internal server error";
65
- case ResponseErrorCode.Parse: return "Failed to parse the request";
107
+ case ResponseErrorCode.TooLarge: return ResponseErrorMessage.TooLarge;
108
+ case ResponseErrorCode.Forbidden: return ResponseErrorMessage.Forbidden;
109
+ case ResponseErrorCode.Timeout: return ResponseErrorMessage.Timeout;
110
+ case ResponseErrorCode.NotFound: return ResponseErrorMessage.NotFound;
111
+ case ResponseErrorCode.BadRequest: return ResponseErrorMessage.BadRequest;
112
+ case ResponseErrorCode.Server: return ResponseErrorMessage.Server;
113
+ case ResponseErrorCode.Parse: return ResponseErrorMessage.Parse;
66
114
  }
67
115
  };
68
116
 
69
117
  exports.ResponseErrorCode = ResponseErrorCode;
118
+ exports.ResponseErrorMessage = ResponseErrorMessage;
70
119
  exports.getResponseErrorMessage = getResponseErrorMessage;
71
120
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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
+ {"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 * Response error message.\n */\nenum ResponseErrorMessage {\n /**\n * Request body is too large.\n *\n * For `bodyLimit` middleware.\n */\n TooLarge = \"Request body is too large\",\n /**\n * Forbidden access.\n *\n * For `ipLimit` middleware.\n */\n Forbidden = \"Forbidden IP address\",\n /**\n * Request timeout.\n *\n * For `timeLimit` middleware.\n */\n Timeout = \"Gateway timeout\",\n /**\n * Content not found.\n *\n * For `notFoundHandler` function.\n */\n NotFound = \"Content 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 = \"Internal server error\",\n /**\n * Validation error.\n *\n * For validator package.\n */\n Parse = \"Failed to parse the request\",\n}\n\n/**\n * Get response error message by code.\n */\nconst getResponseErrorMessage = (\n code: ResponseErrorCode,\n): ResponseErrorMessage => {\n switch (code) {\n case ResponseErrorCode.TooLarge: {\n return ResponseErrorMessage.TooLarge;\n }\n case ResponseErrorCode.Forbidden: {\n return ResponseErrorMessage.Forbidden;\n }\n case ResponseErrorCode.Timeout: {\n return ResponseErrorMessage.Timeout;\n }\n case ResponseErrorCode.NotFound: {\n return ResponseErrorMessage.NotFound;\n }\n case ResponseErrorCode.BadRequest: {\n return ResponseErrorMessage.BadRequest;\n }\n case ResponseErrorCode.Server: {\n return ResponseErrorMessage.Server;\n }\n case ResponseErrorCode.Parse: {\n return ResponseErrorMessage.Parse;\n }\n }\n};\n\nexport { ResponseErrorCode, ResponseErrorMessage, getResponseErrorMessage };\n"],"mappings":";;;;;;;;AAQA,IAAK,kEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,IAAK,wEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,MAAM,2BACF,SACuB;AACvB,SAAQ,MAAR;EACI,KAAK,kBAAkB,SACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,UACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,QACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,SACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,WACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,OACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,MACnB,QAAO,qBAAqB"}
@@ -51,19 +51,67 @@ var ResponseErrorCode = /* @__PURE__ */ function(ResponseErrorCode$1) {
51
51
  return ResponseErrorCode$1;
52
52
  }(ResponseErrorCode || {});
53
53
  /**
54
+ * Response error message.
55
+ */
56
+ var ResponseErrorMessage = /* @__PURE__ */ function(ResponseErrorMessage$1) {
57
+ /**
58
+ * Request body is too large.
59
+ *
60
+ * For `bodyLimit` middleware.
61
+ */
62
+ ResponseErrorMessage$1["TooLarge"] = "Request body is too large";
63
+ /**
64
+ * Forbidden access.
65
+ *
66
+ * For `ipLimit` middleware.
67
+ */
68
+ ResponseErrorMessage$1["Forbidden"] = "Forbidden IP address";
69
+ /**
70
+ * Request timeout.
71
+ *
72
+ * For `timeLimit` middleware.
73
+ */
74
+ ResponseErrorMessage$1["Timeout"] = "Gateway timeout";
75
+ /**
76
+ * Content not found.
77
+ *
78
+ * For `notFoundHandler` function.
79
+ */
80
+ ResponseErrorMessage$1["NotFound"] = "Content not found";
81
+ /**
82
+ * Bad request.
83
+ *
84
+ * For `onErrorHandler` function.
85
+ */
86
+ ResponseErrorMessage$1["BadRequest"] = "Bad request";
87
+ /**
88
+ * Internal server error.
89
+ *
90
+ * For `onErrorHandler` function.
91
+ */
92
+ ResponseErrorMessage$1["Server"] = "Internal server error";
93
+ /**
94
+ * Validation error.
95
+ *
96
+ * For validator package.
97
+ */
98
+ ResponseErrorMessage$1["Parse"] = "Failed to parse the request";
99
+ return ResponseErrorMessage$1;
100
+ }(ResponseErrorMessage || {});
101
+ /**
54
102
  * Get response error message by code.
55
103
  */
56
104
  const getResponseErrorMessage = (code) => {
57
105
  switch (code) {
58
- case ResponseErrorCode.TooLarge: return "Request body is too large";
59
- case ResponseErrorCode.Forbidden: return "Forbidden IP address";
60
- case ResponseErrorCode.Timeout: return "Gateway timeout";
61
- case ResponseErrorCode.NotFound: return "Content not found";
62
- case ResponseErrorCode.BadRequest: return "Bad request";
63
- case ResponseErrorCode.Server: return "Internal server error";
64
- case ResponseErrorCode.Parse: return "Failed to parse the request";
106
+ case ResponseErrorCode.TooLarge: return ResponseErrorMessage.TooLarge;
107
+ case ResponseErrorCode.Forbidden: return ResponseErrorMessage.Forbidden;
108
+ case ResponseErrorCode.Timeout: return ResponseErrorMessage.Timeout;
109
+ case ResponseErrorCode.NotFound: return ResponseErrorMessage.NotFound;
110
+ case ResponseErrorCode.BadRequest: return ResponseErrorMessage.BadRequest;
111
+ case ResponseErrorCode.Server: return ResponseErrorMessage.Server;
112
+ case ResponseErrorCode.Parse: return ResponseErrorMessage.Parse;
65
113
  }
66
114
  };
67
115
 
68
- export { ResponseErrorCode, getResponseErrorMessage };
116
+ export { ResponseErrorCode, ResponseErrorMessage, getResponseErrorMessage };
69
117
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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"}
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 * Response error message.\n */\nenum ResponseErrorMessage {\n /**\n * Request body is too large.\n *\n * For `bodyLimit` middleware.\n */\n TooLarge = \"Request body is too large\",\n /**\n * Forbidden access.\n *\n * For `ipLimit` middleware.\n */\n Forbidden = \"Forbidden IP address\",\n /**\n * Request timeout.\n *\n * For `timeLimit` middleware.\n */\n Timeout = \"Gateway timeout\",\n /**\n * Content not found.\n *\n * For `notFoundHandler` function.\n */\n NotFound = \"Content 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 = \"Internal server error\",\n /**\n * Validation error.\n *\n * For validator package.\n */\n Parse = \"Failed to parse the request\",\n}\n\n/**\n * Get response error message by code.\n */\nconst getResponseErrorMessage = (\n code: ResponseErrorCode,\n): ResponseErrorMessage => {\n switch (code) {\n case ResponseErrorCode.TooLarge: {\n return ResponseErrorMessage.TooLarge;\n }\n case ResponseErrorCode.Forbidden: {\n return ResponseErrorMessage.Forbidden;\n }\n case ResponseErrorCode.Timeout: {\n return ResponseErrorMessage.Timeout;\n }\n case ResponseErrorCode.NotFound: {\n return ResponseErrorMessage.NotFound;\n }\n case ResponseErrorCode.BadRequest: {\n return ResponseErrorMessage.BadRequest;\n }\n case ResponseErrorCode.Server: {\n return ResponseErrorMessage.Server;\n }\n case ResponseErrorCode.Parse: {\n return ResponseErrorMessage.Parse;\n }\n }\n};\n\nexport { ResponseErrorCode, ResponseErrorMessage, getResponseErrorMessage };\n"],"mappings":";;;;;;;AAQA,IAAK,kEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,IAAK,wEAAL;;;;;;AAMI;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;;;;;AAMA;;EA1CC;;;;AAgDL,MAAM,2BACF,SACuB;AACvB,SAAQ,MAAR;EACI,KAAK,kBAAkB,SACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,UACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,QACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,SACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,WACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,OACnB,QAAO,qBAAqB;EAEhC,KAAK,kBAAkB,MACnB,QAAO,qBAAqB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jderstd/hono",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "A response builder for Hono",
5
5
  "keywords": [
6
6
  "jder",