@pgfsm/api 0.0.0-stage → 0.0.0

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.
Files changed (118) hide show
  1. package/esm/_dnt.polyfills.d.ts +17 -0
  2. package/esm/_dnt.polyfills.js +15 -0
  3. package/esm/_dnt.shims.d.ts +5 -0
  4. package/esm/_dnt.shims.js +61 -0
  5. package/esm/database-src/generated/database.types.d.ts +2131 -0
  6. package/esm/database-src/generated/database.types.js +21 -0
  7. package/esm/deps/jsr.io/@std/cli/1.0.31/parse_args.d.ts +342 -0
  8. package/esm/deps/jsr.io/@std/cli/1.0.31/parse_args.js +372 -0
  9. package/esm/fsm-api-ts/env.d.ts +143 -0
  10. package/esm/fsm-api-ts/env.js +72 -0
  11. package/esm/fsm-api-ts/lib/configure-open-api.d.ts +3 -0
  12. package/esm/fsm-api-ts/lib/configure-open-api.js +25 -0
  13. package/esm/fsm-api-ts/lib/constants.d.ts +15 -0
  14. package/esm/fsm-api-ts/lib/constants.js +11 -0
  15. package/esm/fsm-api-ts/lib/create-app.d.ts +19 -0
  16. package/esm/fsm-api-ts/lib/create-app.js +137 -0
  17. package/esm/fsm-api-ts/lib/create-router.d.ts +3 -0
  18. package/esm/fsm-api-ts/lib/create-router.js +10 -0
  19. package/esm/fsm-api-ts/lib/license.d.ts +13 -0
  20. package/esm/fsm-api-ts/lib/license.js +15 -0
  21. package/esm/fsm-api-ts/lib/types.d.ts +19 -0
  22. package/esm/fsm-api-ts/lib/types.js +1 -0
  23. package/esm/fsm-api-ts/logger.d.ts +3 -0
  24. package/esm/fsm-api-ts/logger.js +20 -0
  25. package/esm/fsm-api-ts/middlewares/api-key-auth.d.ts +34 -0
  26. package/esm/fsm-api-ts/middlewares/api-key-auth.js +70 -0
  27. package/esm/fsm-api-ts/middlewares/logtape-logger.d.ts +2 -0
  28. package/esm/fsm-api-ts/middlewares/logtape-logger.js +33 -0
  29. package/esm/fsm-api-ts/middlewares/otel-trace.d.ts +2 -0
  30. package/esm/fsm-api-ts/middlewares/otel-trace.js +29 -0
  31. package/esm/fsm-api-ts/middlewares/supabase.d.ts +10 -0
  32. package/esm/fsm-api-ts/middlewares/supabase.js +34 -0
  33. package/esm/fsm-api-ts/mod.d.ts +2 -0
  34. package/esm/fsm-api-ts/mod.js +6 -0
  35. package/esm/fsm-api-ts/routes/admin/admin.handlers.d.ts +8 -0
  36. package/esm/fsm-api-ts/routes/admin/admin.handlers.js +98 -0
  37. package/esm/fsm-api-ts/routes/admin/admin.index.d.ts +189 -0
  38. package/esm/fsm-api-ts/routes/admin/admin.index.js +11 -0
  39. package/esm/fsm-api-ts/routes/admin/admin.routes.d.ts +473 -0
  40. package/esm/fsm-api-ts/routes/admin/admin.routes.js +130 -0
  41. package/esm/fsm-api-ts/routes/definitions/definitions.handlers.d.ts +5 -0
  42. package/esm/fsm-api-ts/routes/definitions/definitions.handlers.js +29 -0
  43. package/esm/fsm-api-ts/routes/definitions/definitions.index.d.ts +86 -0
  44. package/esm/fsm-api-ts/routes/definitions/definitions.index.js +8 -0
  45. package/esm/fsm-api-ts/routes/definitions/definitions.routes.d.ts +204 -0
  46. package/esm/fsm-api-ts/routes/definitions/definitions.routes.js +56 -0
  47. package/esm/fsm-api-ts/routes/index.route.d.ts +19 -0
  48. package/esm/fsm-api-ts/routes/index.route.js +31 -0
  49. package/esm/fsm-api-ts/routes/instances/instances.handlers.d.ts +8 -0
  50. package/esm/fsm-api-ts/routes/instances/instances.handlers.js +108 -0
  51. package/esm/fsm-api-ts/routes/instances/instances.index.d.ts +237 -0
  52. package/esm/fsm-api-ts/routes/instances/instances.index.js +11 -0
  53. package/esm/fsm-api-ts/routes/instances/instances.routes.d.ts +411 -0
  54. package/esm/fsm-api-ts/routes/instances/instances.routes.js +104 -0
  55. package/esm/fsm-api-ts/src/cli/index.d.ts +2 -0
  56. package/esm/fsm-api-ts/src/cli/index.js +197 -0
  57. package/esm/fsm-api-ts/src/cli/invocation.node.d.ts +1 -0
  58. package/esm/fsm-api-ts/src/cli/invocation.node.js +4 -0
  59. package/esm/fsm-api-ts/src/cli/key-bootstrap.d.ts +14 -0
  60. package/esm/fsm-api-ts/src/cli/key-bootstrap.js +35 -0
  61. package/esm/fsm-api-ts/src/cli/serve.node.d.ts +6 -0
  62. package/esm/fsm-api-ts/src/cli/serve.node.js +20 -0
  63. package/esm/fsm-api-ts/src/cli/version.node.d.ts +1 -0
  64. package/esm/fsm-api-ts/src/cli/version.node.js +2 -0
  65. package/esm/fsm-api-ts/stoker-src/http-status-codes.d.ts +354 -0
  66. package/esm/fsm-api-ts/stoker-src/http-status-codes.js +356 -0
  67. package/esm/fsm-api-ts/stoker-src/http-status-phrases.d.ts +354 -0
  68. package/esm/fsm-api-ts/stoker-src/http-status-phrases.js +356 -0
  69. package/esm/fsm-api-ts/stoker-src/middlewares/index.d.ts +3 -0
  70. package/esm/fsm-api-ts/stoker-src/middlewares/index.js +3 -0
  71. package/esm/fsm-api-ts/stoker-src/middlewares/not-found.d.ts +3 -0
  72. package/esm/fsm-api-ts/stoker-src/middlewares/not-found.js +8 -0
  73. package/esm/fsm-api-ts/stoker-src/middlewares/on-error.d.ts +3 -0
  74. package/esm/fsm-api-ts/stoker-src/middlewares/on-error.js +19 -0
  75. package/esm/fsm-api-ts/stoker-src/middlewares/serve-emoji-favicon.d.ts +3 -0
  76. package/esm/fsm-api-ts/stoker-src/middlewares/serve-emoji-favicon.js +10 -0
  77. package/esm/fsm-api-ts/stoker-src/openapi/default-hook.d.ts +3 -0
  78. package/esm/fsm-api-ts/stoker-src/openapi/default-hook.js +11 -0
  79. package/esm/fsm-api-ts/stoker-src/openapi/helpers/index.d.ts +4 -0
  80. package/esm/fsm-api-ts/stoker-src/openapi/helpers/index.js +4 -0
  81. package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-one-of.d.ts +12 -0
  82. package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-one-of.js +14 -0
  83. package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-required.d.ts +11 -0
  84. package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-required.js +8 -0
  85. package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content.d.ts +10 -0
  86. package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content.js +11 -0
  87. package/esm/fsm-api-ts/stoker-src/openapi/helpers/one-of.d.ts +3 -0
  88. package/esm/fsm-api-ts/stoker-src/openapi/helpers/one-of.js +13 -0
  89. package/esm/fsm-api-ts/stoker-src/openapi/helpers/types.d.ts +2 -0
  90. package/esm/fsm-api-ts/stoker-src/openapi/helpers/types.js +1 -0
  91. package/esm/fsm-api-ts/stoker-src/openapi/index.d.ts +3 -0
  92. package/esm/fsm-api-ts/stoker-src/openapi/index.js +3 -0
  93. package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-error-schema.d.ts +56 -0
  94. package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-error-schema.js +25 -0
  95. package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-message-object.d.ts +9 -0
  96. package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-message-object.js +11 -0
  97. package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-params.d.ts +9 -0
  98. package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-params.js +13 -0
  99. package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-uuid-params.d.ts +9 -0
  100. package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-uuid-params.js +13 -0
  101. package/esm/fsm-api-ts/stoker-src/openapi/schemas/index.d.ts +5 -0
  102. package/esm/fsm-api-ts/stoker-src/openapi/schemas/index.js +5 -0
  103. package/esm/fsm-api-ts/stoker-src/openapi/schemas/slug-params.d.ts +9 -0
  104. package/esm/fsm-api-ts/stoker-src/openapi/schemas/slug-params.js +18 -0
  105. package/esm/fsm-core-db-ts/src/database.types.d.ts +4 -0
  106. package/esm/fsm-core-db-ts/src/database.types.js +17 -0
  107. package/esm/package.json +3 -0
  108. package/package.json +45 -3
  109. package/script/_dnt.polyfills.d.ts +17 -0
  110. package/script/_dnt.polyfills.js +16 -0
  111. package/script/_dnt.shims.d.ts +5 -0
  112. package/script/_dnt.shims.js +65 -0
  113. package/script/fsm-api-ts/mod.d.ts +2 -0
  114. package/script/fsm-api-ts/mod.js +10 -0
  115. package/script/fsm-api-ts/src/cli/version.node.d.ts +1 -0
  116. package/script/fsm-api-ts/src/cli/version.node.js +5 -0
  117. package/script/package.json +3 -0
  118. package/README.md +0 -3
@@ -0,0 +1,356 @@
1
+ // Generated file. Do not edit
2
+ // Phrases retrieved on Thu, 03 Oct 2024 12:05:14 GMT from https://raw.githubusercontent.com/prettymuchbryce/http-status-codes/refs/heads/master/codes.json
3
+ /**
4
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3
5
+ *
6
+ * The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing.
7
+ */
8
+ export const ACCEPTED = "Accepted";
9
+ /**
10
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3
11
+ *
12
+ * This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.
13
+ */
14
+ export const BAD_GATEWAY = "Bad Gateway";
15
+ /**
16
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1
17
+ *
18
+ * This response means that server could not understand the request due to invalid syntax.
19
+ */
20
+ export const BAD_REQUEST = "Bad Request";
21
+ /**
22
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8
23
+ *
24
+ * This response is sent when a request conflicts with the current state of the server.
25
+ */
26
+ export const CONFLICT = "Conflict";
27
+ /**
28
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1
29
+ *
30
+ * This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished.
31
+ */
32
+ export const CONTINUE = "Continue";
33
+ /**
34
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2
35
+ *
36
+ * The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request.
37
+ */
38
+ export const CREATED = "Created";
39
+ /**
40
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14
41
+ *
42
+ * This response code means the expectation indicated by the Expect request header field can't be met by the server.
43
+ */
44
+ export const EXPECTATION_FAILED = "Expectation Failed";
45
+ /**
46
+ * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5
47
+ *
48
+ * The request failed due to failure of a previous request.
49
+ */
50
+ export const FAILED_DEPENDENCY = "Failed Dependency";
51
+ /**
52
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3
53
+ *
54
+ * The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server.
55
+ */
56
+ export const FORBIDDEN = "Forbidden";
57
+ /**
58
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5
59
+ *
60
+ * This error response is given when the server is acting as a gateway and cannot get a response in time.
61
+ */
62
+ export const GATEWAY_TIMEOUT = "Gateway Timeout";
63
+ /**
64
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9
65
+ *
66
+ * This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for "limited-time, promotional services". APIs should not feel compelled to indicate resources that have been deleted with this status code.
67
+ */
68
+ export const GONE = "Gone";
69
+ /**
70
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6
71
+ *
72
+ * The HTTP version used in the request is not supported by the server.
73
+ */
74
+ export const HTTP_VERSION_NOT_SUPPORTED = "HTTP Version Not Supported";
75
+ /**
76
+ * Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2
77
+ *
78
+ * Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout.
79
+ */
80
+ export const IM_A_TEAPOT = "I'm a teapot";
81
+ /**
82
+ * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6
83
+ *
84
+ * The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action.
85
+ */
86
+ export const INSUFFICIENT_SPACE_ON_RESOURCE = "Insufficient Space on Resource";
87
+ /**
88
+ * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6
89
+ *
90
+ * The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.
91
+ */
92
+ export const INSUFFICIENT_STORAGE = "Insufficient Storage";
93
+ /**
94
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1
95
+ *
96
+ * The server encountered an unexpected condition that prevented it from fulfilling the request.
97
+ */
98
+ export const INTERNAL_SERVER_ERROR = "Internal Server Error";
99
+ /**
100
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10
101
+ *
102
+ * The server rejected the request because the Content-Length header field is not defined and the server requires it.
103
+ */
104
+ export const LENGTH_REQUIRED = "Length Required";
105
+ /**
106
+ * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4
107
+ *
108
+ * The resource that is being accessed is locked.
109
+ */
110
+ export const LOCKED = "Locked";
111
+ /**
112
+ * @deprecated
113
+ * Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt
114
+ *
115
+ * A deprecated response used by the Spring Framework when a method has failed.
116
+ */
117
+ export const METHOD_FAILURE = "Method Failure";
118
+ /**
119
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5
120
+ *
121
+ * The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code.
122
+ */
123
+ export const METHOD_NOT_ALLOWED = "Method Not Allowed";
124
+ /**
125
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2
126
+ *
127
+ * This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response.
128
+ */
129
+ export const MOVED_PERMANENTLY = "Moved Permanently";
130
+ /**
131
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3
132
+ *
133
+ * This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.
134
+ */
135
+ export const MOVED_TEMPORARILY = "Moved Temporarily";
136
+ /**
137
+ * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2
138
+ *
139
+ * A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate.
140
+ */
141
+ export const MULTI_STATUS = "Multi-Status";
142
+ /**
143
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1
144
+ *
145
+ * The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses.
146
+ */
147
+ export const MULTIPLE_CHOICES = "Multiple Choices";
148
+ /**
149
+ * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6
150
+ *
151
+ * The 511 status code indicates that the client needs to authenticate to gain network access.
152
+ */
153
+ export const NETWORK_AUTHENTICATION_REQUIRED = "Network Authentication Required";
154
+ /**
155
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5
156
+ *
157
+ * There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.
158
+ */
159
+ export const NO_CONTENT = "No Content";
160
+ /**
161
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4
162
+ *
163
+ * This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response.
164
+ */
165
+ export const NON_AUTHORITATIVE_INFORMATION = "Non Authoritative Information";
166
+ /**
167
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6
168
+ *
169
+ * This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent.
170
+ */
171
+ export const NOT_ACCEPTABLE = "Not Acceptable";
172
+ /**
173
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4
174
+ *
175
+ * The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web.
176
+ */
177
+ export const NOT_FOUND = "Not Found";
178
+ /**
179
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2
180
+ *
181
+ * The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.
182
+ */
183
+ export const NOT_IMPLEMENTED = "Not Implemented";
184
+ /**
185
+ * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1
186
+ *
187
+ * This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response.
188
+ */
189
+ export const NOT_MODIFIED = "Not Modified";
190
+ /**
191
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1
192
+ *
193
+ * The request has succeeded. The meaning of a success varies depending on the HTTP method:
194
+ * GET: The resource has been fetched and is transmitted in the message body.
195
+ * HEAD: The entity headers are in the message body.
196
+ * POST: The resource describing the result of the action is transmitted in the message body.
197
+ * TRACE: The message body contains the request message as received by the server
198
+ */
199
+ export const OK = "OK";
200
+ /**
201
+ * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1
202
+ *
203
+ * This response code is used because of range header sent by the client to separate download into multiple streams.
204
+ */
205
+ export const PARTIAL_CONTENT = "Partial Content";
206
+ /**
207
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2
208
+ *
209
+ * This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently.
210
+ */
211
+ export const PAYMENT_REQUIRED = "Payment Required";
212
+ /**
213
+ * Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3
214
+ *
215
+ * This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.
216
+ */
217
+ export const PERMANENT_REDIRECT = "Permanent Redirect";
218
+ /**
219
+ * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2
220
+ *
221
+ * The client has indicated preconditions in its headers which the server does not meet.
222
+ */
223
+ export const PRECONDITION_FAILED = "Precondition Failed";
224
+ /**
225
+ * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3
226
+ *
227
+ * The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.
228
+ */
229
+ export const PRECONDITION_REQUIRED = "Precondition Required";
230
+ /**
231
+ * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1
232
+ *
233
+ * This code indicates that the server has received and is processing the request, but no response is available yet.
234
+ */
235
+ export const PROCESSING = "Processing";
236
+ /**
237
+ * Official Documentation @ https://www.rfc-editor.org/rfc/rfc8297#page-3
238
+ *
239
+ * This code indicates to the client that the server is likely to send a final response with the header fields included in the informational response.
240
+ */
241
+ export const EARLY_HINTS = "Early Hints";
242
+ /**
243
+ * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.15
244
+ *
245
+ * The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.
246
+ */
247
+ export const UPGRADE_REQUIRED = "Upgrade Required";
248
+ /**
249
+ * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2
250
+ *
251
+ * This is similar to 401 but authentication is needed to be done by a proxy.
252
+ */
253
+ export const PROXY_AUTHENTICATION_REQUIRED = "Proxy Authentication Required";
254
+ /**
255
+ * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5
256
+ *
257
+ * The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.
258
+ */
259
+ export const REQUEST_HEADER_FIELDS_TOO_LARGE = "Request Header Fields Too Large";
260
+ /**
261
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7
262
+ *
263
+ * This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.
264
+ */
265
+ export const REQUEST_TIMEOUT = "Request Timeout";
266
+ /**
267
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11
268
+ *
269
+ * Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field.
270
+ */
271
+ export const REQUEST_TOO_LONG = "Request Entity Too Large";
272
+ /**
273
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12
274
+ *
275
+ * The URI requested by the client is longer than the server is willing to interpret.
276
+ */
277
+ export const REQUEST_URI_TOO_LONG = "Request-URI Too Long";
278
+ /**
279
+ * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4
280
+ *
281
+ * The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data.
282
+ */
283
+ export const REQUESTED_RANGE_NOT_SATISFIABLE = "Requested Range Not Satisfiable";
284
+ /**
285
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6
286
+ *
287
+ * This response code is sent after accomplishing request to tell user agent reset document view which sent this request.
288
+ */
289
+ export const RESET_CONTENT = "Reset Content";
290
+ /**
291
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4
292
+ *
293
+ * Server sent this response to directing client to get requested resource to another URI with an GET request.
294
+ */
295
+ export const SEE_OTHER = "See Other";
296
+ /**
297
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4
298
+ *
299
+ * The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.
300
+ */
301
+ export const SERVICE_UNAVAILABLE = "Service Unavailable";
302
+ /**
303
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2
304
+ *
305
+ * This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too.
306
+ */
307
+ export const SWITCHING_PROTOCOLS = "Switching Protocols";
308
+ /**
309
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7
310
+ *
311
+ * Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.
312
+ */
313
+ export const TEMPORARY_REDIRECT = "Temporary Redirect";
314
+ /**
315
+ * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4
316
+ *
317
+ * The user has sent too many requests in a given amount of time ("rate limiting").
318
+ */
319
+ export const TOO_MANY_REQUESTS = "Too Many Requests";
320
+ /**
321
+ * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1
322
+ *
323
+ * Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.
324
+ */
325
+ export const UNAUTHORIZED = "Unauthorized";
326
+ /**
327
+ * Official Documentation @ https://tools.ietf.org/html/rfc7725
328
+ *
329
+ * The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government.
330
+ */
331
+ export const UNAVAILABLE_FOR_LEGAL_REASONS = "Unavailable For Legal Reasons";
332
+ /**
333
+ * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3
334
+ *
335
+ * The request was well-formed but was unable to be followed due to semantic errors.
336
+ */
337
+ export const UNPROCESSABLE_ENTITY = "Unprocessable Entity";
338
+ /**
339
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13
340
+ *
341
+ * The media format of the requested data is not supported by the server, so the server is rejecting the request.
342
+ */
343
+ export const UNSUPPORTED_MEDIA_TYPE = "Unsupported Media Type";
344
+ /**
345
+ * @deprecated
346
+ * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6
347
+ *
348
+ * Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.
349
+ */
350
+ export const USE_PROXY = "Use Proxy";
351
+ /**
352
+ * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2
353
+ *
354
+ * Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI.
355
+ */
356
+ export const MISDIRECTED_REQUEST = "Misdirected Request";
@@ -0,0 +1,3 @@
1
+ export { default as notFound } from "./not-found.js";
2
+ export { default as onError } from "./on-error.js";
3
+ export { default as serveEmojiFavicon } from "./serve-emoji-favicon.js";
@@ -0,0 +1,3 @@
1
+ export { default as notFound } from "./not-found.js";
2
+ export { default as onError } from "./on-error.js";
3
+ export { default as serveEmojiFavicon } from "./serve-emoji-favicon.js";
@@ -0,0 +1,3 @@
1
+ import type { NotFoundHandler } from "hono";
2
+ declare const notFound: NotFoundHandler;
3
+ export default notFound;
@@ -0,0 +1,8 @@
1
+ import { NOT_FOUND } from "../http-status-codes.js";
2
+ import { NOT_FOUND as NOT_FOUND_MESSAGE } from "../http-status-phrases.js";
3
+ const notFound = (c) => {
4
+ return c.json({
5
+ message: `${NOT_FOUND_MESSAGE} - ${c.req.path}`,
6
+ }, NOT_FOUND);
7
+ };
8
+ export default notFound;
@@ -0,0 +1,3 @@
1
+ import type { ErrorHandler } from "hono";
2
+ declare const onError: ErrorHandler;
3
+ export default onError;
@@ -0,0 +1,19 @@
1
+ import { INTERNAL_SERVER_ERROR, OK } from "../http-status-codes.js";
2
+ const onError = (err, c) => {
3
+ const currentStatus = "status" in err
4
+ ? err.status
5
+ : c.newResponse(null).status;
6
+ const statusCode = currentStatus !== OK
7
+ ? currentStatus
8
+ : INTERNAL_SERVER_ERROR;
9
+ // eslint-disable-next-line node/prefer-global/process
10
+ const env = c.env?.NODE_ENV || process.env?.NODE_ENV;
11
+ return c.json({
12
+ message: err.message,
13
+ stack: env === "production" ? undefined : err.stack,
14
+ },
15
+ // c.json requires a contentful (body-bearing) status; statusCode is a
16
+ // broader StatusCode union in this vendored middleware.
17
+ statusCode);
18
+ };
19
+ export default onError;
@@ -0,0 +1,3 @@
1
+ import type { MiddlewareHandler } from "hono";
2
+ declare const serveEmojiFavicon: (emoji: string) => MiddlewareHandler;
3
+ export default serveEmojiFavicon;
@@ -0,0 +1,10 @@
1
+ const serveEmojiFavicon = (emoji) => {
2
+ return async (c, next) => {
3
+ if (c.req.path === "/favicon.ico") {
4
+ c.header("Content-Type", "image/svg+xml");
5
+ return c.body(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" x="-0.1em" font-size="90">${emoji}</text></svg>`);
6
+ }
7
+ return await next();
8
+ };
9
+ };
10
+ export default serveEmojiFavicon;
@@ -0,0 +1,3 @@
1
+ import type { Hook } from "@hono/zod-openapi";
2
+ declare const defaultHook: Hook<any, any, any, any>;
3
+ export default defaultHook;
@@ -0,0 +1,11 @@
1
+ import { UNPROCESSABLE_ENTITY } from "../http-status-codes.js";
2
+ // deno-lint-ignore no-explicit-any -- generic hook must apply to any route's result/env/path/response types
3
+ const defaultHook = (result, c) => {
4
+ if (!result.success) {
5
+ return c.json({
6
+ success: result.success,
7
+ error: result.error,
8
+ }, UNPROCESSABLE_ENTITY);
9
+ }
10
+ };
11
+ export default defaultHook;
@@ -0,0 +1,4 @@
1
+ export { default as jsonContentOneOf } from "./json-content-one-of.js";
2
+ export { default as jsonContentRequired } from "./json-content-required.js";
3
+ export { default as jsonContent } from "./json-content.js";
4
+ export { default as oneOf } from "./one-of.js";
@@ -0,0 +1,4 @@
1
+ export { default as jsonContentOneOf } from "./json-content-one-of.js";
2
+ export { default as jsonContentRequired } from "./json-content-required.js";
3
+ export { default as jsonContent } from "./json-content.js";
4
+ export { default as oneOf } from "./one-of.js";
@@ -0,0 +1,12 @@
1
+ import type { ZodSchema } from "./types.js";
2
+ declare const jsonContentOneOf: <T extends ZodSchema>(schemas: T[], description: string) => {
3
+ content: {
4
+ "application/json": {
5
+ schema: {
6
+ oneOf: (import("openapi3-ts/oas30").SchemaObject | import("openapi3-ts/oas30").ReferenceObject)[];
7
+ };
8
+ };
9
+ };
10
+ description: string;
11
+ };
12
+ export default jsonContentOneOf;
@@ -0,0 +1,14 @@
1
+ import oneOf from "./one-of.js";
2
+ const jsonContentOneOf = (schemas, description) => {
3
+ return {
4
+ content: {
5
+ "application/json": {
6
+ schema: {
7
+ oneOf: oneOf(schemas),
8
+ },
9
+ },
10
+ },
11
+ description,
12
+ };
13
+ };
14
+ export default jsonContentOneOf;
@@ -0,0 +1,11 @@
1
+ import type { ZodSchema } from "./types.js";
2
+ declare const jsonContentRequired: <T extends ZodSchema>(schema: T, description: string) => {
3
+ required: boolean;
4
+ content: {
5
+ "application/json": {
6
+ schema: T;
7
+ };
8
+ };
9
+ description: string;
10
+ };
11
+ export default jsonContentRequired;
@@ -0,0 +1,8 @@
1
+ import jsonContent from "./json-content.js";
2
+ const jsonContentRequired = (schema, description) => {
3
+ return {
4
+ ...jsonContent(schema, description),
5
+ required: true,
6
+ };
7
+ };
8
+ export default jsonContentRequired;
@@ -0,0 +1,10 @@
1
+ import type { ZodSchema } from "./types.js";
2
+ declare const jsonContent: <T extends ZodSchema>(schema: T, description: string) => {
3
+ content: {
4
+ "application/json": {
5
+ schema: T;
6
+ };
7
+ };
8
+ description: string;
9
+ };
10
+ export default jsonContent;
@@ -0,0 +1,11 @@
1
+ const jsonContent = (schema, description) => {
2
+ return {
3
+ content: {
4
+ "application/json": {
5
+ schema,
6
+ },
7
+ },
8
+ description,
9
+ };
10
+ };
11
+ export default jsonContent;
@@ -0,0 +1,3 @@
1
+ import type { ZodSchema } from "./types.js";
2
+ declare const oneOf: <T extends ZodSchema>(schemas: T[]) => (import("openapi3-ts/oas30").SchemaObject | import("openapi3-ts/oas30").ReferenceObject)[];
3
+ export default oneOf;
@@ -0,0 +1,13 @@
1
+ import { OpenApiGeneratorV3, OpenAPIRegistry, } from "@asteasolutions/zod-to-openapi";
2
+ const oneOf = (schemas) => {
3
+ const registry = new OpenAPIRegistry();
4
+ schemas.forEach((schema, index) => {
5
+ registry.register(index.toString(), schema);
6
+ });
7
+ const generator = new OpenApiGeneratorV3(registry.definitions);
8
+ const components = generator.generateComponents();
9
+ return components.components?.schemas
10
+ ? Object.values(components.components.schemas)
11
+ : [];
12
+ };
13
+ export default oneOf;
@@ -0,0 +1,2 @@
1
+ import type { z } from "@hono/zod-openapi";
2
+ export type ZodSchema = z.ZodUnion<any> | z.AnyZodObject | z.ZodArray<z.AnyZodObject>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { default as defaultHook } from "./default-hook.js";
2
+ export * as helpers from "./helpers/index.js";
3
+ export * as schemas from "./schemas/index.js";
@@ -0,0 +1,3 @@
1
+ export { default as defaultHook } from "./default-hook.js";
2
+ export * as helpers from "./helpers/index.js";
3
+ export * as schemas from "./schemas/index.js";
@@ -0,0 +1,56 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import type { ZodSchema } from "../helpers/types.js";
3
+ declare const createErrorSchema: <T extends ZodSchema>(schema: T) => z.ZodObject<{
4
+ success: z.ZodBoolean;
5
+ error: z.ZodObject<{
6
+ issues: z.ZodArray<z.ZodObject<{
7
+ code: z.ZodString;
8
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
9
+ message: z.ZodOptional<z.ZodString>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ code: string;
12
+ path: (string | number)[];
13
+ message?: string | undefined;
14
+ }, {
15
+ code: string;
16
+ path: (string | number)[];
17
+ message?: string | undefined;
18
+ }>, "many">;
19
+ name: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ name: string;
22
+ issues: {
23
+ code: string;
24
+ path: (string | number)[];
25
+ message?: string | undefined;
26
+ }[];
27
+ }, {
28
+ name: string;
29
+ issues: {
30
+ code: string;
31
+ path: (string | number)[];
32
+ message?: string | undefined;
33
+ }[];
34
+ }>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ error: {
37
+ name: string;
38
+ issues: {
39
+ code: string;
40
+ path: (string | number)[];
41
+ message?: string | undefined;
42
+ }[];
43
+ };
44
+ success: boolean;
45
+ }, {
46
+ error: {
47
+ name: string;
48
+ issues: {
49
+ code: string;
50
+ path: (string | number)[];
51
+ message?: string | undefined;
52
+ }[];
53
+ };
54
+ success: boolean;
55
+ }>;
56
+ export default createErrorSchema;
@@ -0,0 +1,25 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ const createErrorSchema = (schema) => {
3
+ const { error } = schema.safeParse(schema._def.typeName ===
4
+ z.ZodFirstPartyTypeKind.ZodArray
5
+ ? []
6
+ : {});
7
+ return z.object({
8
+ success: z.boolean().openapi({
9
+ example: false,
10
+ }),
11
+ error: z
12
+ .object({
13
+ issues: z.array(z.object({
14
+ code: z.string(),
15
+ path: z.array(z.union([z.string(), z.number()])),
16
+ message: z.string().optional(),
17
+ })),
18
+ name: z.string(),
19
+ })
20
+ .openapi({
21
+ example: error,
22
+ }),
23
+ });
24
+ };
25
+ export default createErrorSchema;