@augment-vir/core 30.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.
- package/LICENSE-CC0 +121 -0
- package/LICENSE-MIT +21 -0
- package/dist/augments/array/array.d.ts +4 -0
- package/dist/augments/array/array.js +1 -0
- package/dist/augments/array/tuple.d.ts +13 -0
- package/dist/augments/array/tuple.js +1 -0
- package/dist/augments/enum/enum-type.d.ts +1 -0
- package/dist/augments/enum/enum-type.js +1 -0
- package/dist/augments/enum/enum-values.d.ts +2 -0
- package/dist/augments/enum/enum-values.js +10 -0
- package/dist/augments/error/ensure-error.d.ts +2 -0
- package/dist/augments/error/ensure-error.js +14 -0
- package/dist/augments/error/error-message.d.ts +3 -0
- package/dist/augments/error/error-message.js +41 -0
- package/dist/augments/function/generic-function-type.d.ts +2 -0
- package/dist/augments/function/generic-function-type.js +1 -0
- package/dist/augments/function/typed-function-type.d.ts +17 -0
- package/dist/augments/function/typed-function-type.js +1 -0
- package/dist/augments/http/http-status.d.ts +496 -0
- package/dist/augments/http/http-status.js +564 -0
- package/dist/augments/narrow-type.d.ts +2 -0
- package/dist/augments/narrow-type.js +1 -0
- package/dist/augments/object/generic-object-type.d.ts +2 -0
- package/dist/augments/object/generic-object-type.js +1 -0
- package/dist/augments/object/object-keys.d.ts +7 -0
- package/dist/augments/object/object-keys.js +14 -0
- package/dist/augments/object/object-value-types.d.ts +3 -0
- package/dist/augments/object/object-value-types.js +1 -0
- package/dist/augments/object/required-keys.d.ts +36 -0
- package/dist/augments/object/required-keys.js +1 -0
- package/dist/augments/object/stringify.d.ts +1 -0
- package/dist/augments/object/stringify.js +9 -0
- package/dist/augments/overwrite-type.d.ts +2 -0
- package/dist/augments/overwrite-type.js +1 -0
- package/dist/augments/partial-type.d.ts +7 -0
- package/dist/augments/partial-type.js +1 -0
- package/dist/augments/promise/deferred-promise.d.ts +7 -0
- package/dist/augments/promise/deferred-promise.js +19 -0
- package/dist/augments/promise/maybe-promise.d.ts +1 -0
- package/dist/augments/promise/maybe-promise.js +1 -0
- package/dist/augments/promise/wait.d.ts +3 -0
- package/dist/augments/promise/wait.js +16 -0
- package/dist/augments/runtime-env.d.ts +33 -0
- package/dist/augments/runtime-env.js +43 -0
- package/dist/augments/string/ansi.d.ts +3 -0
- package/dist/augments/string/ansi.js +36 -0
- package/dist/augments/string/punctuation.d.ts +6 -0
- package/dist/augments/string/punctuation.js +13 -0
- package/dist/augments/string/uuid.d.ts +4 -0
- package/dist/augments/string/uuid.js +4 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +24 -0
- package/package.json +54 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import type { ArrayElement } from '../array/array.js';
|
|
2
|
+
/**
|
|
3
|
+
* All standardized HTTP status codes.
|
|
4
|
+
*
|
|
5
|
+
* These values are automatically parsed from https://developer.mozilla.org/docs/Web/HTTP/Status via
|
|
6
|
+
* https://github.com/electrovir/augment-vir/blob/dev/packages/scripts/src/scripts/generate-http-status.script.ts
|
|
7
|
+
*/
|
|
8
|
+
export declare enum HttpStatus {
|
|
9
|
+
/** 100 level codes (information) */
|
|
10
|
+
/**
|
|
11
|
+
* This interim response indicates that the client should continue the request or ignore the
|
|
12
|
+
* response if the request is already finished.
|
|
13
|
+
*
|
|
14
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/100
|
|
15
|
+
*/
|
|
16
|
+
Continue = 100,
|
|
17
|
+
/**
|
|
18
|
+
* This code is sent in response to an Upgrade request header from the client and indicates the
|
|
19
|
+
* protocol the server is switching to.
|
|
20
|
+
*
|
|
21
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/101
|
|
22
|
+
*/
|
|
23
|
+
SwitchingProtocols = 101,
|
|
24
|
+
/**
|
|
25
|
+
* This code indicates that the server has received and is processing the request, but no
|
|
26
|
+
* response is available yet.
|
|
27
|
+
*
|
|
28
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/102
|
|
29
|
+
*/
|
|
30
|
+
Processing = 102,
|
|
31
|
+
/**
|
|
32
|
+
* This status code is primarily intended to be used with the Link header, letting the user
|
|
33
|
+
* agent start preloading resources while the server prepares a response or preconnect to an
|
|
34
|
+
* origin from which the page will need resources.
|
|
35
|
+
*
|
|
36
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/103
|
|
37
|
+
*/
|
|
38
|
+
EarlyHints = 103,
|
|
39
|
+
/** 200 level codes (success) */
|
|
40
|
+
/**
|
|
41
|
+
* The request succeeded. The result meaning of "success" depends on the HTTP method:
|
|
42
|
+
*
|
|
43
|
+
* - GET: The resource has been fetched and transmitted in the message body.
|
|
44
|
+
* - HEAD: The representation headers are included in the response without any message body.
|
|
45
|
+
* - PUT or POST: The resource describing the result of the action is transmitted in the message
|
|
46
|
+
* body.
|
|
47
|
+
* - TRACE: The message body contains the request message as received by the server.
|
|
48
|
+
*
|
|
49
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/200
|
|
50
|
+
*/
|
|
51
|
+
Ok = 200,
|
|
52
|
+
/**
|
|
53
|
+
* The request succeeded, and a new resource was created as a result. This is typically the
|
|
54
|
+
* response sent after POST requests, or some PUT requests.
|
|
55
|
+
*
|
|
56
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/201
|
|
57
|
+
*/
|
|
58
|
+
Created = 201,
|
|
59
|
+
/**
|
|
60
|
+
* The request has been received but not yet acted upon. It is noncommittal, since there is no
|
|
61
|
+
* way in HTTP to later send an asynchronous response indicating the outcome of the request. It
|
|
62
|
+
* is intended for cases where another process or server handles the request, or for batch
|
|
63
|
+
* processing.
|
|
64
|
+
*
|
|
65
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/202
|
|
66
|
+
*/
|
|
67
|
+
Accepted = 202,
|
|
68
|
+
/**
|
|
69
|
+
* This response code means the returned metadata is not exactly the same as is available from
|
|
70
|
+
* the origin server, but is collected from a local or a third-party copy. This is mostly used
|
|
71
|
+
* for mirrors or backups of another resource. Except for that specific case, the 200 OK
|
|
72
|
+
* response is preferred to this status.
|
|
73
|
+
*
|
|
74
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/203
|
|
75
|
+
*/
|
|
76
|
+
NonAuthoritativeInformation = 203,
|
|
77
|
+
/**
|
|
78
|
+
* There is no content to send for this request, but the headers may be useful. The user agent
|
|
79
|
+
* may update its cached headers for this resource with the new ones.
|
|
80
|
+
*
|
|
81
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/204
|
|
82
|
+
*/
|
|
83
|
+
NoContent = 204,
|
|
84
|
+
/**
|
|
85
|
+
* Tells the user agent to reset the document which sent this request.
|
|
86
|
+
*
|
|
87
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/205
|
|
88
|
+
*/
|
|
89
|
+
ResetContent = 205,
|
|
90
|
+
/**
|
|
91
|
+
* This response code is used when the Range header is sent from the client to request only part
|
|
92
|
+
* of a resource.
|
|
93
|
+
*
|
|
94
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/206
|
|
95
|
+
*/
|
|
96
|
+
PartialContent = 206,
|
|
97
|
+
/**
|
|
98
|
+
* Conveys information about multiple resources, for situations where multiple status codes
|
|
99
|
+
* might be appropriate.
|
|
100
|
+
*
|
|
101
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/207
|
|
102
|
+
*/
|
|
103
|
+
MultiStatus = 207,
|
|
104
|
+
/**
|
|
105
|
+
* Used inside a [dav:propstat](dav:propstat) response element to avoid repeatedly enumerating
|
|
106
|
+
* the internal members of multiple bindings to the same collection.
|
|
107
|
+
*
|
|
108
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/208
|
|
109
|
+
*/
|
|
110
|
+
AlreadyReported = 208,
|
|
111
|
+
/**
|
|
112
|
+
* The server has fulfilled a GET request for the resource, and the response is a representation
|
|
113
|
+
* of the result of one or more instance-manipulations applied to the current instance.
|
|
114
|
+
*
|
|
115
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/226
|
|
116
|
+
*/
|
|
117
|
+
ImUsed = 226,
|
|
118
|
+
/** 300 level codes (redirect) */
|
|
119
|
+
/**
|
|
120
|
+
* The request has more than one possible response. The user agent or user should choose one of
|
|
121
|
+
* them. (There is no standardized way of choosing one of the responses, but HTML links to the
|
|
122
|
+
* possibilities are recommended so the user can pick.)
|
|
123
|
+
*
|
|
124
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/300
|
|
125
|
+
*/
|
|
126
|
+
MultipleChoices = 300,
|
|
127
|
+
/**
|
|
128
|
+
* The URL of the requested resource has been changed permanently. The new URL is given in the
|
|
129
|
+
* response.
|
|
130
|
+
*
|
|
131
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/301
|
|
132
|
+
*/
|
|
133
|
+
MovedPermanently = 301,
|
|
134
|
+
/**
|
|
135
|
+
* This response code means that the URI of requested resource has been changed temporarily.
|
|
136
|
+
* Further changes in the URI might be made in the future. Therefore, this same URI should be
|
|
137
|
+
* used by the client in future requests.
|
|
138
|
+
*
|
|
139
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/302
|
|
140
|
+
*/
|
|
141
|
+
Found = 302,
|
|
142
|
+
/**
|
|
143
|
+
* The server sent this response to direct the client to get the requested resource at another
|
|
144
|
+
* URI with a GET request.
|
|
145
|
+
*
|
|
146
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/303
|
|
147
|
+
*/
|
|
148
|
+
SeeOther = 303,
|
|
149
|
+
/**
|
|
150
|
+
* This is used for caching purposes. It tells the client that the response has not been
|
|
151
|
+
* modified, so the client can continue to use the same cached version of the response.
|
|
152
|
+
*
|
|
153
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/304
|
|
154
|
+
*/
|
|
155
|
+
NotModified = 304,
|
|
156
|
+
/**
|
|
157
|
+
* Defined in a previous version of the HTTP specification to indicate that a requested response
|
|
158
|
+
* must be accessed by a proxy. It has been deprecated due to security concerns regarding
|
|
159
|
+
* in-band configuration of a proxy.
|
|
160
|
+
*
|
|
161
|
+
* See https://developer.mozilla.org/about:blank#305_use_proxy
|
|
162
|
+
*/
|
|
163
|
+
UseProxy = 305,
|
|
164
|
+
/**
|
|
165
|
+
* This response code is no longer used; it is just reserved. It was used in a previous version
|
|
166
|
+
* of the HTTP/1.1 specification.
|
|
167
|
+
*
|
|
168
|
+
* See https://developer.mozilla.org/about:blank#306_unused
|
|
169
|
+
*/
|
|
170
|
+
Unused = 306,
|
|
171
|
+
/**
|
|
172
|
+
* The server sends this response to direct the client to get the requested resource at another
|
|
173
|
+
* URI with the same method that was used in the prior request. This has the same semantics as
|
|
174
|
+
* the 302 Found HTTP response code, with the exception that the user agent must not change the
|
|
175
|
+
* HTTP method used: if a POST was used in the first request, a POST must be used in the second
|
|
176
|
+
* request.
|
|
177
|
+
*
|
|
178
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/307
|
|
179
|
+
*/
|
|
180
|
+
TemporaryRedirect = 307,
|
|
181
|
+
/**
|
|
182
|
+
* This means that the resource is now permanently located at another URI, specified by the
|
|
183
|
+
* Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP
|
|
184
|
+
* response code, with the exception that the user agent must not change the HTTP method used:
|
|
185
|
+
* if a POST was used in the first request, a POST must be used in the second request.
|
|
186
|
+
*
|
|
187
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/308
|
|
188
|
+
*/
|
|
189
|
+
PermanentRedirect = 308,
|
|
190
|
+
/** 400 level codes (clientError) */
|
|
191
|
+
/**
|
|
192
|
+
* The server cannot or will not process the request due to something that is perceived to be a
|
|
193
|
+
* client error (e.g., malformed request syntax, invalid request message framing, or deceptive
|
|
194
|
+
* request routing).
|
|
195
|
+
*
|
|
196
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/400
|
|
197
|
+
*/
|
|
198
|
+
BadRequest = 400,
|
|
199
|
+
/**
|
|
200
|
+
* Although the HTTP standard specifies "unauthorized", semantically this response means
|
|
201
|
+
* "unauthenticated". That is, the client must authenticate itself to get the requested
|
|
202
|
+
* response.
|
|
203
|
+
*
|
|
204
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/401
|
|
205
|
+
*/
|
|
206
|
+
Unauthorized = 401,
|
|
207
|
+
/**
|
|
208
|
+
* This response code is reserved for future use. The initial aim for creating this code was
|
|
209
|
+
* using it for digital payment systems, however this status code is used very rarely and no
|
|
210
|
+
* standard convention exists.
|
|
211
|
+
*
|
|
212
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/402
|
|
213
|
+
*/
|
|
214
|
+
PaymentRequired = 402,
|
|
215
|
+
/**
|
|
216
|
+
* The client does not have access rights to the content; that is, it is unauthorized, so the
|
|
217
|
+
* server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's
|
|
218
|
+
* identity is known to the server.
|
|
219
|
+
*
|
|
220
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/403
|
|
221
|
+
*/
|
|
222
|
+
Forbidden = 403,
|
|
223
|
+
/**
|
|
224
|
+
* The server cannot find the requested resource. In the browser, this means the URL is not
|
|
225
|
+
* recognized. In an API, this can also mean that the endpoint is valid but the resource itself
|
|
226
|
+
* does not exist. Servers may also send this response instead of 403 Forbidden to hide the
|
|
227
|
+
* existence of a resource from an unauthorized client. This response code is probably the most
|
|
228
|
+
* well known due to its frequent occurrence on the web.
|
|
229
|
+
*
|
|
230
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/404
|
|
231
|
+
*/
|
|
232
|
+
NotFound = 404,
|
|
233
|
+
/**
|
|
234
|
+
* The request method is known by the server but is not supported by the target resource. For
|
|
235
|
+
* example, an API may not allow calling DELETE to remove a resource.
|
|
236
|
+
*
|
|
237
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/405
|
|
238
|
+
*/
|
|
239
|
+
MethodNotAllowed = 405,
|
|
240
|
+
/**
|
|
241
|
+
* This response is sent when the web server, after performing server-driven content
|
|
242
|
+
* negotiation, doesn't find any content that conforms to the criteria given by the user agent.
|
|
243
|
+
*
|
|
244
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/406
|
|
245
|
+
*/
|
|
246
|
+
NotAcceptable = 406,
|
|
247
|
+
/**
|
|
248
|
+
* This is similar to 401 Unauthorized but authentication is needed to be done by a proxy.
|
|
249
|
+
*
|
|
250
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/407
|
|
251
|
+
*/
|
|
252
|
+
ProxyAuthenticationRequired = 407,
|
|
253
|
+
/**
|
|
254
|
+
* This response is sent on an idle connection by some servers, even without any previous
|
|
255
|
+
* request by the client. It means that the server would like to shut down this unused
|
|
256
|
+
* connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or
|
|
257
|
+
* IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers
|
|
258
|
+
* merely shut down the connection without sending this message.
|
|
259
|
+
*
|
|
260
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/408
|
|
261
|
+
*/
|
|
262
|
+
RequestTimeout = 408,
|
|
263
|
+
/**
|
|
264
|
+
* This response is sent when a request conflicts with the current state of the server.
|
|
265
|
+
*
|
|
266
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/409
|
|
267
|
+
*/
|
|
268
|
+
Conflict = 409,
|
|
269
|
+
/**
|
|
270
|
+
* This response is sent when the requested content has been permanently deleted from server,
|
|
271
|
+
* with no forwarding address. Clients are expected to remove their caches and links to the
|
|
272
|
+
* resource. The HTTP specification intends this status code to be used for "limited-time,
|
|
273
|
+
* promotional services". APIs should not feel compelled to indicate resources that have been
|
|
274
|
+
* deleted with this status code.
|
|
275
|
+
*
|
|
276
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/410
|
|
277
|
+
*/
|
|
278
|
+
Gone = 410,
|
|
279
|
+
/**
|
|
280
|
+
* Server rejected the request because the Content-Length header field is not defined and the
|
|
281
|
+
* server requires it.
|
|
282
|
+
*
|
|
283
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/411
|
|
284
|
+
*/
|
|
285
|
+
LengthRequired = 411,
|
|
286
|
+
/**
|
|
287
|
+
* The client has indicated preconditions in its headers which the server does not meet.
|
|
288
|
+
*
|
|
289
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/412
|
|
290
|
+
*/
|
|
291
|
+
PreconditionFailed = 412,
|
|
292
|
+
/**
|
|
293
|
+
* Request entity is larger than limits defined by server. The server might close the connection
|
|
294
|
+
* or return an Retry-After header field.
|
|
295
|
+
*
|
|
296
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/413
|
|
297
|
+
*/
|
|
298
|
+
PayloadTooLarge = 413,
|
|
299
|
+
/**
|
|
300
|
+
* The URI requested by the client is longer than the server is willing to interpret.
|
|
301
|
+
*
|
|
302
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/414
|
|
303
|
+
*/
|
|
304
|
+
UriTooLong = 414,
|
|
305
|
+
/**
|
|
306
|
+
* The media format of the requested data is not supported by the server, so the server is
|
|
307
|
+
* rejecting the request.
|
|
308
|
+
*
|
|
309
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/415
|
|
310
|
+
*/
|
|
311
|
+
UnsupportedMediaType = 415,
|
|
312
|
+
/**
|
|
313
|
+
* The range specified by the Range header field in the request cannot be fulfilled. It's
|
|
314
|
+
* possible that the range is outside the size of the target URI's data.
|
|
315
|
+
*
|
|
316
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/416
|
|
317
|
+
*/
|
|
318
|
+
RangeNotSatisfiable = 416,
|
|
319
|
+
/**
|
|
320
|
+
* This response code means the expectation indicated by the Expect request header field cannot
|
|
321
|
+
* be met by the server.
|
|
322
|
+
*
|
|
323
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/417
|
|
324
|
+
*/
|
|
325
|
+
ExpectationFailed = 417,
|
|
326
|
+
/**
|
|
327
|
+
* The server refuses the attempt to brew coffee with a teapot.
|
|
328
|
+
*
|
|
329
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/418
|
|
330
|
+
*/
|
|
331
|
+
ImATeapot = 418,
|
|
332
|
+
/**
|
|
333
|
+
* The request was directed at a server that is not able to produce a response. This can be sent
|
|
334
|
+
* by a server that is not configured to produce responses for the combination of scheme and
|
|
335
|
+
* authority that are included in the request URI.
|
|
336
|
+
*
|
|
337
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/421
|
|
338
|
+
*/
|
|
339
|
+
MisdirectedRequest = 421,
|
|
340
|
+
/**
|
|
341
|
+
* The request was well-formed but was unable to be followed due to semantic errors.
|
|
342
|
+
*
|
|
343
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/422
|
|
344
|
+
*/
|
|
345
|
+
UnprocessableContent = 422,
|
|
346
|
+
/**
|
|
347
|
+
* The resource that is being accessed is locked.
|
|
348
|
+
*
|
|
349
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/423
|
|
350
|
+
*/
|
|
351
|
+
Locked = 423,
|
|
352
|
+
/**
|
|
353
|
+
* The request failed due to failure of a previous request.
|
|
354
|
+
*
|
|
355
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/424
|
|
356
|
+
*/
|
|
357
|
+
FailedDependency = 424,
|
|
358
|
+
/**
|
|
359
|
+
* Indicates that the server is unwilling to risk processing a request that might be replayed.
|
|
360
|
+
*
|
|
361
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/425
|
|
362
|
+
*/
|
|
363
|
+
TooEarly = 425,
|
|
364
|
+
/**
|
|
365
|
+
* The server refuses to perform the request using the current protocol but might be willing to
|
|
366
|
+
* do so after the client upgrades to a different protocol. The server sends an Upgrade header
|
|
367
|
+
* in a 426 response to indicate the required protocol(s).
|
|
368
|
+
*
|
|
369
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/426
|
|
370
|
+
*/
|
|
371
|
+
UpgradeRequired = 426,
|
|
372
|
+
/**
|
|
373
|
+
* The origin server requires the request to be conditional. This response is intended to
|
|
374
|
+
* prevent the 'lost update' problem, where a client GETs a resource's state, modifies it and
|
|
375
|
+
* PUTs it back to the server, when meanwhile a third party has modified the state on the
|
|
376
|
+
* server, leading to a conflict.
|
|
377
|
+
*
|
|
378
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/428
|
|
379
|
+
*/
|
|
380
|
+
PreconditionRequired = 428,
|
|
381
|
+
/**
|
|
382
|
+
* The user has sent too many requests in a given amount of time ("rate limiting").
|
|
383
|
+
*
|
|
384
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/429
|
|
385
|
+
*/
|
|
386
|
+
TooManyRequests = 429,
|
|
387
|
+
/**
|
|
388
|
+
* The server is unwilling to process the request because its header fields are too large. The
|
|
389
|
+
* request may be resubmitted after reducing the size of the request header fields.
|
|
390
|
+
*
|
|
391
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/431
|
|
392
|
+
*/
|
|
393
|
+
RequestHeaderFieldsTooLarge = 431,
|
|
394
|
+
/**
|
|
395
|
+
* The user agent requested a resource that cannot legally be provided, such as a web page
|
|
396
|
+
* censored by a government.
|
|
397
|
+
*
|
|
398
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/451
|
|
399
|
+
*/
|
|
400
|
+
UnavailableForLegalReasons = 451,
|
|
401
|
+
/** 500 level codes (serverError) */
|
|
402
|
+
/**
|
|
403
|
+
* The server has encountered a situation it does not know how to handle.
|
|
404
|
+
*
|
|
405
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/500
|
|
406
|
+
*/
|
|
407
|
+
InternalServerError = 500,
|
|
408
|
+
/**
|
|
409
|
+
* The request method is not supported by the server and cannot be handled. The only methods
|
|
410
|
+
* that servers are required to support (and therefore that must not return this code) are GET
|
|
411
|
+
* and HEAD.
|
|
412
|
+
*
|
|
413
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/501
|
|
414
|
+
*/
|
|
415
|
+
NotImplemented = 501,
|
|
416
|
+
/**
|
|
417
|
+
* This error response means that the server, while working as a gateway to get a response
|
|
418
|
+
* needed to handle the request, got an invalid response.
|
|
419
|
+
*
|
|
420
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/502
|
|
421
|
+
*/
|
|
422
|
+
BadGateway = 502,
|
|
423
|
+
/**
|
|
424
|
+
* The server is not ready to handle the request. Common causes are a server that is down for
|
|
425
|
+
* maintenance or that is overloaded. Note that together with this response, a user-friendly
|
|
426
|
+
* page explaining the problem should be sent. This response should be used for temporary
|
|
427
|
+
* conditions and the Retry-After HTTP header should, if possible, contain the estimated time
|
|
428
|
+
* before the recovery of the service. The webmaster must also take care about the
|
|
429
|
+
* caching-related headers that are sent along with this response, as these temporary condition
|
|
430
|
+
* responses should usually not be cached.
|
|
431
|
+
*
|
|
432
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/503
|
|
433
|
+
*/
|
|
434
|
+
ServiceUnavailable = 503,
|
|
435
|
+
/**
|
|
436
|
+
* This error response is given when the server is acting as a gateway and cannot get a response
|
|
437
|
+
* in time.
|
|
438
|
+
*
|
|
439
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/504
|
|
440
|
+
*/
|
|
441
|
+
GatewayTimeout = 504,
|
|
442
|
+
/**
|
|
443
|
+
* The HTTP version used in the request is not supported by the server.
|
|
444
|
+
*
|
|
445
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/505
|
|
446
|
+
*/
|
|
447
|
+
HttpVersionNotSupported = 505,
|
|
448
|
+
/**
|
|
449
|
+
* The server has an internal configuration error: the chosen variant resource is configured to
|
|
450
|
+
* engage in transparent content negotiation itself, and is therefore not a proper end point in
|
|
451
|
+
* the negotiation process.
|
|
452
|
+
*
|
|
453
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/506
|
|
454
|
+
*/
|
|
455
|
+
VariantAlsoNegotiates = 506,
|
|
456
|
+
/**
|
|
457
|
+
* The method could not be performed on the resource because the server is unable to store the
|
|
458
|
+
* representation needed to successfully complete the request.
|
|
459
|
+
*
|
|
460
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/507
|
|
461
|
+
*/
|
|
462
|
+
InsufficientStorage = 507,
|
|
463
|
+
/**
|
|
464
|
+
* The server detected an infinite loop while processing the request.
|
|
465
|
+
*
|
|
466
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/508
|
|
467
|
+
*/
|
|
468
|
+
LoopDetected = 508,
|
|
469
|
+
/**
|
|
470
|
+
* Further extensions to the request are required for the server to fulfill it.
|
|
471
|
+
*
|
|
472
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/510
|
|
473
|
+
*/
|
|
474
|
+
NotExtended = 510,
|
|
475
|
+
/**
|
|
476
|
+
* Indicates that the client needs to authenticate to gain network access.
|
|
477
|
+
*
|
|
478
|
+
* See https://developer.mozilla.org/docs/Web/HTTP/Status/511
|
|
479
|
+
*/
|
|
480
|
+
NetworkAuthenticationRequired = 511
|
|
481
|
+
}
|
|
482
|
+
export declare enum HttpStatusCategory {
|
|
483
|
+
Information = "information",
|
|
484
|
+
Success = "success",
|
|
485
|
+
Redirect = "redirect",
|
|
486
|
+
ClientError = "clientError",
|
|
487
|
+
ServerError = "serverError"
|
|
488
|
+
}
|
|
489
|
+
export declare const httpStatusByCategory: {
|
|
490
|
+
readonly information: readonly [HttpStatus.Continue, HttpStatus.SwitchingProtocols, HttpStatus.Processing, HttpStatus.EarlyHints];
|
|
491
|
+
readonly success: readonly [HttpStatus.Ok, HttpStatus.Created, HttpStatus.Accepted, HttpStatus.NonAuthoritativeInformation, HttpStatus.NoContent, HttpStatus.ResetContent, HttpStatus.PartialContent, HttpStatus.MultiStatus, HttpStatus.AlreadyReported, HttpStatus.ImUsed];
|
|
492
|
+
readonly redirect: readonly [HttpStatus.MultipleChoices, HttpStatus.MovedPermanently, HttpStatus.Found, HttpStatus.SeeOther, HttpStatus.NotModified, HttpStatus.UseProxy, HttpStatus.Unused, HttpStatus.TemporaryRedirect, HttpStatus.PermanentRedirect];
|
|
493
|
+
readonly clientError: readonly [HttpStatus.BadRequest, HttpStatus.Unauthorized, HttpStatus.PaymentRequired, HttpStatus.Forbidden, HttpStatus.NotFound, HttpStatus.MethodNotAllowed, HttpStatus.NotAcceptable, HttpStatus.ProxyAuthenticationRequired, HttpStatus.RequestTimeout, HttpStatus.Conflict, HttpStatus.Gone, HttpStatus.LengthRequired, HttpStatus.PreconditionFailed, HttpStatus.PayloadTooLarge, HttpStatus.UriTooLong, HttpStatus.UnsupportedMediaType, HttpStatus.RangeNotSatisfiable, HttpStatus.ExpectationFailed, HttpStatus.ImATeapot, HttpStatus.MisdirectedRequest, HttpStatus.UnprocessableContent, HttpStatus.Locked, HttpStatus.FailedDependency, HttpStatus.TooEarly, HttpStatus.UpgradeRequired, HttpStatus.PreconditionRequired, HttpStatus.TooManyRequests, HttpStatus.RequestHeaderFieldsTooLarge, HttpStatus.UnavailableForLegalReasons];
|
|
494
|
+
readonly serverError: readonly [HttpStatus.InternalServerError, HttpStatus.NotImplemented, HttpStatus.BadGateway, HttpStatus.ServiceUnavailable, HttpStatus.GatewayTimeout, HttpStatus.HttpVersionNotSupported, HttpStatus.VariantAlsoNegotiates, HttpStatus.InsufficientStorage, HttpStatus.LoopDetected, HttpStatus.NotExtended, HttpStatus.NetworkAuthenticationRequired];
|
|
495
|
+
};
|
|
496
|
+
export type HttpStatusByCategory<Category extends HttpStatusCategory> = ArrayElement<(typeof httpStatusByCategory)[Category]>;
|