@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.
Files changed (53) hide show
  1. package/LICENSE-CC0 +121 -0
  2. package/LICENSE-MIT +21 -0
  3. package/dist/augments/array/array.d.ts +4 -0
  4. package/dist/augments/array/array.js +1 -0
  5. package/dist/augments/array/tuple.d.ts +13 -0
  6. package/dist/augments/array/tuple.js +1 -0
  7. package/dist/augments/enum/enum-type.d.ts +1 -0
  8. package/dist/augments/enum/enum-type.js +1 -0
  9. package/dist/augments/enum/enum-values.d.ts +2 -0
  10. package/dist/augments/enum/enum-values.js +10 -0
  11. package/dist/augments/error/ensure-error.d.ts +2 -0
  12. package/dist/augments/error/ensure-error.js +14 -0
  13. package/dist/augments/error/error-message.d.ts +3 -0
  14. package/dist/augments/error/error-message.js +41 -0
  15. package/dist/augments/function/generic-function-type.d.ts +2 -0
  16. package/dist/augments/function/generic-function-type.js +1 -0
  17. package/dist/augments/function/typed-function-type.d.ts +17 -0
  18. package/dist/augments/function/typed-function-type.js +1 -0
  19. package/dist/augments/http/http-status.d.ts +496 -0
  20. package/dist/augments/http/http-status.js +564 -0
  21. package/dist/augments/narrow-type.d.ts +2 -0
  22. package/dist/augments/narrow-type.js +1 -0
  23. package/dist/augments/object/generic-object-type.d.ts +2 -0
  24. package/dist/augments/object/generic-object-type.js +1 -0
  25. package/dist/augments/object/object-keys.d.ts +7 -0
  26. package/dist/augments/object/object-keys.js +14 -0
  27. package/dist/augments/object/object-value-types.d.ts +3 -0
  28. package/dist/augments/object/object-value-types.js +1 -0
  29. package/dist/augments/object/required-keys.d.ts +36 -0
  30. package/dist/augments/object/required-keys.js +1 -0
  31. package/dist/augments/object/stringify.d.ts +1 -0
  32. package/dist/augments/object/stringify.js +9 -0
  33. package/dist/augments/overwrite-type.d.ts +2 -0
  34. package/dist/augments/overwrite-type.js +1 -0
  35. package/dist/augments/partial-type.d.ts +7 -0
  36. package/dist/augments/partial-type.js +1 -0
  37. package/dist/augments/promise/deferred-promise.d.ts +7 -0
  38. package/dist/augments/promise/deferred-promise.js +19 -0
  39. package/dist/augments/promise/maybe-promise.d.ts +1 -0
  40. package/dist/augments/promise/maybe-promise.js +1 -0
  41. package/dist/augments/promise/wait.d.ts +3 -0
  42. package/dist/augments/promise/wait.js +16 -0
  43. package/dist/augments/runtime-env.d.ts +33 -0
  44. package/dist/augments/runtime-env.js +43 -0
  45. package/dist/augments/string/ansi.d.ts +3 -0
  46. package/dist/augments/string/ansi.js +36 -0
  47. package/dist/augments/string/punctuation.d.ts +6 -0
  48. package/dist/augments/string/punctuation.js +13 -0
  49. package/dist/augments/string/uuid.d.ts +4 -0
  50. package/dist/augments/string/uuid.js +4 -0
  51. package/dist/index.d.ts +24 -0
  52. package/dist/index.js +24 -0
  53. package/package.json +54 -0
@@ -0,0 +1,564 @@
1
+ /**
2
+ * All standardized HTTP status codes.
3
+ *
4
+ * These values are automatically parsed from https://developer.mozilla.org/docs/Web/HTTP/Status via
5
+ * https://github.com/electrovir/augment-vir/blob/dev/packages/scripts/src/scripts/generate-http-status.script.ts
6
+ */
7
+ export var HttpStatus;
8
+ (function (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
+ HttpStatus[HttpStatus["Continue"] = 100] = "Continue";
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
+ HttpStatus[HttpStatus["SwitchingProtocols"] = 101] = "SwitchingProtocols";
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
+ HttpStatus[HttpStatus["Processing"] = 102] = "Processing";
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
+ HttpStatus[HttpStatus["EarlyHints"] = 103] = "EarlyHints";
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
+ HttpStatus[HttpStatus["Ok"] = 200] = "Ok";
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
+ HttpStatus[HttpStatus["Created"] = 201] = "Created";
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
+ HttpStatus[HttpStatus["Accepted"] = 202] = "Accepted";
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
+ HttpStatus[HttpStatus["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
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
+ HttpStatus[HttpStatus["NoContent"] = 204] = "NoContent";
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
+ HttpStatus[HttpStatus["ResetContent"] = 205] = "ResetContent";
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
+ HttpStatus[HttpStatus["PartialContent"] = 206] = "PartialContent";
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
+ HttpStatus[HttpStatus["MultiStatus"] = 207] = "MultiStatus";
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
+ HttpStatus[HttpStatus["AlreadyReported"] = 208] = "AlreadyReported";
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
+ HttpStatus[HttpStatus["ImUsed"] = 226] = "ImUsed";
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
+ HttpStatus[HttpStatus["MultipleChoices"] = 300] = "MultipleChoices";
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
+ HttpStatus[HttpStatus["MovedPermanently"] = 301] = "MovedPermanently";
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
+ HttpStatus[HttpStatus["Found"] = 302] = "Found";
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
+ HttpStatus[HttpStatus["SeeOther"] = 303] = "SeeOther";
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
+ HttpStatus[HttpStatus["NotModified"] = 304] = "NotModified";
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
+ HttpStatus[HttpStatus["UseProxy"] = 305] = "UseProxy";
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
+ HttpStatus[HttpStatus["Unused"] = 306] = "Unused";
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
+ HttpStatus[HttpStatus["TemporaryRedirect"] = 307] = "TemporaryRedirect";
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
+ HttpStatus[HttpStatus["PermanentRedirect"] = 308] = "PermanentRedirect";
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
+ HttpStatus[HttpStatus["BadRequest"] = 400] = "BadRequest";
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
+ HttpStatus[HttpStatus["Unauthorized"] = 401] = "Unauthorized";
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
+ HttpStatus[HttpStatus["PaymentRequired"] = 402] = "PaymentRequired";
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
+ HttpStatus[HttpStatus["Forbidden"] = 403] = "Forbidden";
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
+ HttpStatus[HttpStatus["NotFound"] = 404] = "NotFound";
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
+ HttpStatus[HttpStatus["MethodNotAllowed"] = 405] = "MethodNotAllowed";
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
+ HttpStatus[HttpStatus["NotAcceptable"] = 406] = "NotAcceptable";
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
+ HttpStatus[HttpStatus["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
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
+ HttpStatus[HttpStatus["RequestTimeout"] = 408] = "RequestTimeout";
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
+ HttpStatus[HttpStatus["Conflict"] = 409] = "Conflict";
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
+ HttpStatus[HttpStatus["Gone"] = 410] = "Gone";
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
+ HttpStatus[HttpStatus["LengthRequired"] = 411] = "LengthRequired";
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
+ HttpStatus[HttpStatus["PreconditionFailed"] = 412] = "PreconditionFailed";
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
+ HttpStatus[HttpStatus["PayloadTooLarge"] = 413] = "PayloadTooLarge";
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
+ HttpStatus[HttpStatus["UriTooLong"] = 414] = "UriTooLong";
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
+ HttpStatus[HttpStatus["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
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
+ HttpStatus[HttpStatus["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
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
+ HttpStatus[HttpStatus["ExpectationFailed"] = 417] = "ExpectationFailed";
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
+ HttpStatus[HttpStatus["ImATeapot"] = 418] = "ImATeapot";
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
+ HttpStatus[HttpStatus["MisdirectedRequest"] = 421] = "MisdirectedRequest";
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
+ HttpStatus[HttpStatus["UnprocessableContent"] = 422] = "UnprocessableContent";
346
+ /**
347
+ * The resource that is being accessed is locked.
348
+ *
349
+ * See https://developer.mozilla.org/docs/Web/HTTP/Status/423
350
+ */
351
+ HttpStatus[HttpStatus["Locked"] = 423] = "Locked";
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
+ HttpStatus[HttpStatus["FailedDependency"] = 424] = "FailedDependency";
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
+ HttpStatus[HttpStatus["TooEarly"] = 425] = "TooEarly";
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
+ HttpStatus[HttpStatus["UpgradeRequired"] = 426] = "UpgradeRequired";
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
+ HttpStatus[HttpStatus["PreconditionRequired"] = 428] = "PreconditionRequired";
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
+ HttpStatus[HttpStatus["TooManyRequests"] = 429] = "TooManyRequests";
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
+ HttpStatus[HttpStatus["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
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
+ HttpStatus[HttpStatus["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
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
+ HttpStatus[HttpStatus["InternalServerError"] = 500] = "InternalServerError";
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
+ HttpStatus[HttpStatus["NotImplemented"] = 501] = "NotImplemented";
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
+ HttpStatus[HttpStatus["BadGateway"] = 502] = "BadGateway";
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
+ HttpStatus[HttpStatus["ServiceUnavailable"] = 503] = "ServiceUnavailable";
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
+ HttpStatus[HttpStatus["GatewayTimeout"] = 504] = "GatewayTimeout";
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
+ HttpStatus[HttpStatus["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
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
+ HttpStatus[HttpStatus["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
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
+ HttpStatus[HttpStatus["InsufficientStorage"] = 507] = "InsufficientStorage";
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
+ HttpStatus[HttpStatus["LoopDetected"] = 508] = "LoopDetected";
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
+ HttpStatus[HttpStatus["NotExtended"] = 510] = "NotExtended";
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
+ HttpStatus[HttpStatus["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
481
+ })(HttpStatus || (HttpStatus = {}));
482
+ export var HttpStatusCategory;
483
+ (function (HttpStatusCategory) {
484
+ HttpStatusCategory["Information"] = "information";
485
+ HttpStatusCategory["Success"] = "success";
486
+ HttpStatusCategory["Redirect"] = "redirect";
487
+ HttpStatusCategory["ClientError"] = "clientError";
488
+ HttpStatusCategory["ServerError"] = "serverError";
489
+ })(HttpStatusCategory || (HttpStatusCategory = {}));
490
+ export const httpStatusByCategory = {
491
+ [HttpStatusCategory.Information]: [
492
+ HttpStatus.Continue,
493
+ HttpStatus.SwitchingProtocols,
494
+ HttpStatus.Processing,
495
+ HttpStatus.EarlyHints,
496
+ ],
497
+ [HttpStatusCategory.Success]: [
498
+ HttpStatus.Ok,
499
+ HttpStatus.Created,
500
+ HttpStatus.Accepted,
501
+ HttpStatus.NonAuthoritativeInformation,
502
+ HttpStatus.NoContent,
503
+ HttpStatus.ResetContent,
504
+ HttpStatus.PartialContent,
505
+ HttpStatus.MultiStatus,
506
+ HttpStatus.AlreadyReported,
507
+ HttpStatus.ImUsed,
508
+ ],
509
+ [HttpStatusCategory.Redirect]: [
510
+ HttpStatus.MultipleChoices,
511
+ HttpStatus.MovedPermanently,
512
+ HttpStatus.Found,
513
+ HttpStatus.SeeOther,
514
+ HttpStatus.NotModified,
515
+ HttpStatus.UseProxy,
516
+ HttpStatus.Unused,
517
+ HttpStatus.TemporaryRedirect,
518
+ HttpStatus.PermanentRedirect,
519
+ ],
520
+ [HttpStatusCategory.ClientError]: [
521
+ HttpStatus.BadRequest,
522
+ HttpStatus.Unauthorized,
523
+ HttpStatus.PaymentRequired,
524
+ HttpStatus.Forbidden,
525
+ HttpStatus.NotFound,
526
+ HttpStatus.MethodNotAllowed,
527
+ HttpStatus.NotAcceptable,
528
+ HttpStatus.ProxyAuthenticationRequired,
529
+ HttpStatus.RequestTimeout,
530
+ HttpStatus.Conflict,
531
+ HttpStatus.Gone,
532
+ HttpStatus.LengthRequired,
533
+ HttpStatus.PreconditionFailed,
534
+ HttpStatus.PayloadTooLarge,
535
+ HttpStatus.UriTooLong,
536
+ HttpStatus.UnsupportedMediaType,
537
+ HttpStatus.RangeNotSatisfiable,
538
+ HttpStatus.ExpectationFailed,
539
+ HttpStatus.ImATeapot,
540
+ HttpStatus.MisdirectedRequest,
541
+ HttpStatus.UnprocessableContent,
542
+ HttpStatus.Locked,
543
+ HttpStatus.FailedDependency,
544
+ HttpStatus.TooEarly,
545
+ HttpStatus.UpgradeRequired,
546
+ HttpStatus.PreconditionRequired,
547
+ HttpStatus.TooManyRequests,
548
+ HttpStatus.RequestHeaderFieldsTooLarge,
549
+ HttpStatus.UnavailableForLegalReasons,
550
+ ],
551
+ [HttpStatusCategory.ServerError]: [
552
+ HttpStatus.InternalServerError,
553
+ HttpStatus.NotImplemented,
554
+ HttpStatus.BadGateway,
555
+ HttpStatus.ServiceUnavailable,
556
+ HttpStatus.GatewayTimeout,
557
+ HttpStatus.HttpVersionNotSupported,
558
+ HttpStatus.VariantAlsoNegotiates,
559
+ HttpStatus.InsufficientStorage,
560
+ HttpStatus.LoopDetected,
561
+ HttpStatus.NotExtended,
562
+ HttpStatus.NetworkAuthenticationRequired,
563
+ ],
564
+ };
@@ -0,0 +1,2 @@
1
+ export type NarrowToExpected<Actual, Expected> = Extract<Expected, Actual> extends never ? Extract<Actual, Expected> extends never ? Expected extends Actual ? Expected : never : Extract<Actual, Expected> : Extract<Expected, Actual>;
2
+ export type NarrowToActual<Actual, Expected> = Extract<Actual, Expected> extends never ? Extract<Expected, Actual> extends never ? Expected extends Actual ? Expected : never : Extract<Expected, Actual> : Extract<Actual, Expected>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export type AnyObject = Record<PropertyKey, any>;
2
+ export type UnknownObject = Record<PropertyKey, unknown>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare function getObjectTypedKeys<const ObjectGeneric>(input: ObjectGeneric): Array<keyof ObjectGeneric>;
2
+ export type ExtractKeysWithMatchingValues<OriginalObject extends object, Matcher> = keyof {
3
+ [Prop in keyof OriginalObject as OriginalObject[Prop] extends Matcher ? Prop : never]: Prop;
4
+ };
5
+ export type ExcludeKeysWithMatchingValues<OriginalObject extends object, Matcher> = keyof {
6
+ [Prop in keyof OriginalObject as OriginalObject[Prop] extends Matcher ? never : Prop]: Prop;
7
+ };
@@ -0,0 +1,14 @@
1
+ export function getObjectTypedKeys(input) {
2
+ let reflectKeys;
3
+ try {
4
+ reflectKeys = Reflect.ownKeys(input);
5
+ }
6
+ catch {
7
+ // do nothing
8
+ }
9
+ return (reflectKeys ??
10
+ [
11
+ ...Object.keys(input),
12
+ ...Object.getOwnPropertySymbols(input),
13
+ ]);
14
+ }
@@ -0,0 +1,3 @@
1
+ import type { CompleteRequire } from './required-keys.js';
2
+ export type Values<T> = CompleteRequire<T>[keyof T];
3
+ export type ValueAtRequiredKey<Parent, Key extends keyof Parent> = CompleteRequire<Parent>[Key];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Except, Simplify } from 'type-fest';
2
+ export type { SetRequired } from 'type-fest';
3
+ /**
4
+ * Same as the Required<> built-in type helper but this requires that each property be present and
5
+ * be not null.
6
+ */
7
+ export type RequiredAndNotNull<T> = {
8
+ [P in keyof CompleteRequire<T>]-?: NonNullable<T[P]>;
9
+ };
10
+ /**
11
+ * Require only a subset of object properties and require that they be not null. This is
12
+ * particularly useful in conjunction with the "exactOptionalPropertyTypes" tsconfig flag.
13
+ */
14
+ export type SetRequiredAndNotNull<T, K extends keyof T> = Omit<T, K> & CompleteRequire<{
15
+ [PropertyName in K]: NonNullable<T[PropertyName]>;
16
+ }>;
17
+ export type SetOptionalAndNullable<OriginalObjectGeneric, OptionalKeysGeneric extends keyof OriginalObjectGeneric> = Simplify<Except<OriginalObjectGeneric, OptionalKeysGeneric> & {
18
+ [PropKey in OptionalKeysGeneric]?: OriginalObjectGeneric[PropKey] | null | undefined;
19
+ }>;
20
+ /**
21
+ * Modified version of `RequiredKeys` from `type-fest` that does not require `BaseType` to extends
22
+ * `object`.
23
+ */
24
+ export type RequiredKeysOf<BaseType> = Exclude<{
25
+ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never;
26
+ }[keyof BaseType], undefined>;
27
+ /**
28
+ * Requires every part of an object, even the indexed keys. This is needed because
29
+ * `Required<Partial<T>>` doesn't fully remove `| undefined` from indexed keys when the
30
+ * `noUncheckedIndexedAccess` TSConfig compiler option is enabled.
31
+ *
32
+ * @category Object:Common
33
+ */
34
+ export type CompleteRequire<Parent> = {
35
+ [Prop in keyof Parent]-?: Parent extends Partial<Record<Prop, infer V>> ? V : never;
36
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function stringify(input: unknown): string;
@@ -0,0 +1,9 @@
1
+ import JSON5 from 'json5';
2
+ export function stringify(input) {
3
+ try {
4
+ return JSON5.stringify(input);
5
+ }
6
+ catch {
7
+ return String(input);
8
+ }
9
+ }
@@ -0,0 +1,2 @@
1
+ /** Replace properties in T with properties in U. */
2
+ export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
@@ -0,0 +1 @@
1
+ export {};