@ekumlin/typescript-toolkit 1.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 (80) hide show
  1. package/README.md +98 -0
  2. package/dist/collections.d.mts +7 -0
  3. package/dist/collections.d.ts +7 -0
  4. package/dist/collections.js +60 -0
  5. package/dist/collections.js.map +1 -0
  6. package/dist/collections.mjs +31 -0
  7. package/dist/collections.mjs.map +1 -0
  8. package/dist/dom.d.mts +161 -0
  9. package/dist/dom.d.ts +161 -0
  10. package/dist/dom.js +359 -0
  11. package/dist/dom.js.map +1 -0
  12. package/dist/dom.mjs +314 -0
  13. package/dist/dom.mjs.map +1 -0
  14. package/dist/environment.d.mts +3 -0
  15. package/dist/environment.d.ts +3 -0
  16. package/dist/environment.js +33 -0
  17. package/dist/environment.js.map +1 -0
  18. package/dist/environment.mjs +6 -0
  19. package/dist/environment.mjs.map +1 -0
  20. package/dist/error.d.mts +5 -0
  21. package/dist/error.d.ts +5 -0
  22. package/dist/error.js +61 -0
  23. package/dist/error.js.map +1 -0
  24. package/dist/error.mjs +33 -0
  25. package/dist/error.mjs.map +1 -0
  26. package/dist/http.d.mts +145 -0
  27. package/dist/http.d.ts +145 -0
  28. package/dist/http.js +439 -0
  29. package/dist/http.js.map +1 -0
  30. package/dist/http.mjs +283 -0
  31. package/dist/http.mjs.map +1 -0
  32. package/dist/io.d.mts +244 -0
  33. package/dist/io.d.ts +244 -0
  34. package/dist/io.js +521 -0
  35. package/dist/io.js.map +1 -0
  36. package/dist/io.mjs +365 -0
  37. package/dist/io.mjs.map +1 -0
  38. package/dist/number.d.mts +8 -0
  39. package/dist/number.d.ts +8 -0
  40. package/dist/number.js +70 -0
  41. package/dist/number.js.map +1 -0
  42. package/dist/number.mjs +40 -0
  43. package/dist/number.mjs.map +1 -0
  44. package/dist/promise.d.mts +3 -0
  45. package/dist/promise.d.ts +3 -0
  46. package/dist/promise.js +37 -0
  47. package/dist/promise.js.map +1 -0
  48. package/dist/promise.mjs +10 -0
  49. package/dist/promise.mjs.map +1 -0
  50. package/dist/routing.d.mts +3 -0
  51. package/dist/routing.d.ts +3 -0
  52. package/dist/routing.js +43 -0
  53. package/dist/routing.js.map +1 -0
  54. package/dist/routing.mjs +16 -0
  55. package/dist/routing.mjs.map +1 -0
  56. package/dist/string.d.mts +9 -0
  57. package/dist/string.d.ts +9 -0
  58. package/dist/string.js +75 -0
  59. package/dist/string.js.map +1 -0
  60. package/dist/string.mjs +45 -0
  61. package/dist/string.mjs.map +1 -0
  62. package/dist/time.d.mts +9 -0
  63. package/dist/time.d.ts +9 -0
  64. package/dist/time.js +50 -0
  65. package/dist/time.js.map +1 -0
  66. package/dist/time.mjs +21 -0
  67. package/dist/time.mjs.map +1 -0
  68. package/dist/types.d.mts +11 -0
  69. package/dist/types.d.ts +11 -0
  70. package/dist/types.js +58 -0
  71. package/dist/types.js.map +1 -0
  72. package/dist/types.mjs +23 -0
  73. package/dist/types.mjs.map +1 -0
  74. package/dist/values.d.mts +8 -0
  75. package/dist/values.d.ts +8 -0
  76. package/dist/values.js +58 -0
  77. package/dist/values.js.map +1 -0
  78. package/dist/values.mjs +30 -0
  79. package/dist/values.mjs.map +1 -0
  80. package/package.json +40 -0
package/dist/http.mjs ADDED
@@ -0,0 +1,283 @@
1
+ // src/http/authorizationToken.ts
2
+ var getAuthorizationHeader = (token) => `${token.tokenType} ${token.value}`;
3
+ var isExpired = (token) => token.expiresOn < Date.now();
4
+
5
+ // src/http/getQueryParameters.ts
6
+ var getQueryParameters = (url) => {
7
+ const urlString = url.toString();
8
+ const queryStringIndex = urlString.indexOf("?");
9
+ const queryString = queryStringIndex >= 0 ? urlString.substring(queryStringIndex) : "";
10
+ const query = new URLSearchParams(queryString);
11
+ return query;
12
+ };
13
+
14
+ // src/http/httpHeaders.ts
15
+ var Accept = "Accept";
16
+ var AcceptCharset = "Accept-Charset";
17
+ var AcceptDatetime = "Accept-Datetime";
18
+ var AcceptEncoding = "Accept-Encoding";
19
+ var AcceptLanguage = "Accept-Language";
20
+ var AcceptRanges = "Accept-Ranges";
21
+ var Age = "Age";
22
+ var Allow = "Allow";
23
+ var Authorization = "Authorization";
24
+ var CacheControl = "Cache-Control";
25
+ var Connection = "Connection";
26
+ var ContentDisposition = "Content-Disposition";
27
+ var ContentEncoding = "Content-Encoding";
28
+ var ContentLanguage = "Content-Language";
29
+ var ContentLength = "Content-Length";
30
+ var ContentLocation = "Content-Location";
31
+ var ContentMd5 = "Content-MD5";
32
+ var ContentRange = "Content-Range";
33
+ var ContentType = "Content-Type";
34
+ var Cookie = "Cookie";
35
+ var DateTime = "Date";
36
+ var ETag = "ETag";
37
+ var Expect = "Expect";
38
+ var Expires = "Expires";
39
+ var From = "From";
40
+ var Host = "Host";
41
+ var IfMatch = "If-Match";
42
+ var IfModifiedSince = "If-Modified-Since";
43
+ var IfNoneMatch = "If-None-Match";
44
+ var IfRange = "If-Range";
45
+ var IfunmodifiedSince = "If-Unmodified-Since";
46
+ var LastModified = "Last-Modified";
47
+ var Link = "Link";
48
+ var LocationUri = "Location";
49
+ var MaxForwards = "Max-Forwards";
50
+ var P3P = "P3P";
51
+ var Pragma = "Pragma";
52
+ var ProxyAuthenticate = "Proxy-Authenticate";
53
+ var ProxyAuthorization = "Proxy-Authorization";
54
+ var Ranges = "Range";
55
+ var Referer = "Referer";
56
+ var Referrer = Referer;
57
+ var Refresh = "Refresh";
58
+ var RetryAfter = "Retry-After";
59
+ var Server = "Server";
60
+ var SetCookie = "Set-Cookie";
61
+ var StrictTransportSecurity = "Strict-Transport-Security";
62
+ var TE = "TE";
63
+ var Trailer = "Trailer";
64
+ var TransferEncodingRequest = TE;
65
+ var TransferEncodingResponse = "Transfer-Encoding";
66
+ var Upgrade = "Upgrade";
67
+ var UserAgent = "User-Agent";
68
+ var Vary = "Vary";
69
+ var Via = "Via";
70
+ var Warning = "Warning";
71
+ var WwwAuthenticate = "WWW-Authenticate";
72
+
73
+ // src/http/httpStatusCodes.ts
74
+ import { z } from "zod";
75
+ var Continue = 100;
76
+ var SwitchingProtocols = 101;
77
+ var Processing = 102;
78
+ var EarlyHints = 103;
79
+ var Ok = 200;
80
+ var Created = 201;
81
+ var Accepted = 202;
82
+ var NonAuthoritativeInformation = 203;
83
+ var NoContent = 204;
84
+ var ResetContent = 205;
85
+ var PartialContent = 206;
86
+ var MultiStatus = 207;
87
+ var AlreadyReported = 208;
88
+ var ImUsed = 226;
89
+ var MultipleChoices = 300;
90
+ var MovedPermanently = 301;
91
+ var Found = 302;
92
+ var SeeOther = 303;
93
+ var NotModified = 304;
94
+ var UseProxyDeprecated = 305;
95
+ var TemporaryRedirect = 307;
96
+ var PermanentRedirect = 308;
97
+ var BadRequest = 400;
98
+ var Unauthorized = 401;
99
+ var PaymentRequired = 402;
100
+ var Forbidden = 403;
101
+ var NotFound = 404;
102
+ var MethodNotAllowed = 405;
103
+ var NotAcceptable = 406;
104
+ var ProxyAuthenticationRequired = 407;
105
+ var RequestTimeout = 408;
106
+ var Conflict = 409;
107
+ var Gone = 410;
108
+ var LengthRequired = 411;
109
+ var PreconditionFailed = 412;
110
+ var PayloadTooLarge = 413;
111
+ var UriTooLong = 414;
112
+ var UnsupportedMediaType = 415;
113
+ var RangeNotSatisfiable = 416;
114
+ var ExpectationFailed = 417;
115
+ var ImATeapot = 418;
116
+ var MisdirectedRequest = 421;
117
+ var UnprocessableContent = 422;
118
+ var Locked = 423;
119
+ var FailedDependency = 424;
120
+ var TooEarly = 425;
121
+ var UpgradeRequired = 426;
122
+ var PreconditionRequired = 428;
123
+ var TooManyRequests = 429;
124
+ var RequestHeaderFieldsTooLarge = 431;
125
+ var UnavailableForLegalReasons = 451;
126
+ var InternalServerError = 500;
127
+ var NotImplemented = 501;
128
+ var BadGateway = 502;
129
+ var ServiceUnavailable = 503;
130
+ var GatewayTimeout = 504;
131
+ var HttpVersionNotSupported = 505;
132
+ var VariantAlsoNegotiates = 506;
133
+ var InsufficientStorage = 507;
134
+ var LoopDetected = 508;
135
+ var NotExtended = 510;
136
+ var NetworkAuthenticationRequired = 511;
137
+ var httpStatusCodeSchema = z.number().int().gte(100).lt(600);
138
+ var clientErrorHttpStatusCodeSchema = httpStatusCodeSchema.and(
139
+ z.number().gte(400).lt(500)
140
+ );
141
+ var serverErrorHttpStatusCodeSchema = httpStatusCodeSchema.and(
142
+ z.number().gte(500).lt(600)
143
+ );
144
+ var successHttpStatusCodeSchema = httpStatusCodeSchema.and(
145
+ z.number().gte(100).lt(400)
146
+ );
147
+ var isHttpStatusCode = (obj) => httpStatusCodeSchema.safeParse(obj).success;
148
+ var isClientErrorHttpStatusCode = (obj) => clientErrorHttpStatusCodeSchema.safeParse(obj).success;
149
+ var isServerErrorHttpStatusCode = (obj) => serverErrorHttpStatusCodeSchema.safeParse(obj).success;
150
+ var isSuccessHttpStatusCode = (obj) => successHttpStatusCodeSchema.safeParse(obj).success;
151
+ export {
152
+ Accept,
153
+ AcceptCharset,
154
+ AcceptDatetime,
155
+ AcceptEncoding,
156
+ AcceptLanguage,
157
+ AcceptRanges,
158
+ Accepted,
159
+ Age,
160
+ Allow,
161
+ AlreadyReported,
162
+ Authorization,
163
+ BadGateway,
164
+ BadRequest,
165
+ CacheControl,
166
+ Conflict,
167
+ Connection,
168
+ ContentDisposition,
169
+ ContentEncoding,
170
+ ContentLanguage,
171
+ ContentLength,
172
+ ContentLocation,
173
+ ContentMd5,
174
+ ContentRange,
175
+ ContentType,
176
+ Continue,
177
+ Cookie,
178
+ Created,
179
+ DateTime,
180
+ ETag,
181
+ EarlyHints,
182
+ Expect,
183
+ ExpectationFailed,
184
+ Expires,
185
+ FailedDependency,
186
+ Forbidden,
187
+ Found,
188
+ From,
189
+ GatewayTimeout,
190
+ Gone,
191
+ Host,
192
+ HttpVersionNotSupported,
193
+ IfMatch,
194
+ IfModifiedSince,
195
+ IfNoneMatch,
196
+ IfRange,
197
+ IfunmodifiedSince,
198
+ ImATeapot,
199
+ ImUsed,
200
+ InsufficientStorage,
201
+ InternalServerError,
202
+ LastModified,
203
+ LengthRequired,
204
+ Link,
205
+ LocationUri,
206
+ Locked,
207
+ LoopDetected,
208
+ MaxForwards,
209
+ MethodNotAllowed,
210
+ MisdirectedRequest,
211
+ MovedPermanently,
212
+ MultiStatus,
213
+ MultipleChoices,
214
+ NetworkAuthenticationRequired,
215
+ NoContent,
216
+ NonAuthoritativeInformation,
217
+ NotAcceptable,
218
+ NotExtended,
219
+ NotFound,
220
+ NotImplemented,
221
+ NotModified,
222
+ Ok,
223
+ P3P,
224
+ PartialContent,
225
+ PayloadTooLarge,
226
+ PaymentRequired,
227
+ PermanentRedirect,
228
+ Pragma,
229
+ PreconditionFailed,
230
+ PreconditionRequired,
231
+ Processing,
232
+ ProxyAuthenticate,
233
+ ProxyAuthenticationRequired,
234
+ ProxyAuthorization,
235
+ RangeNotSatisfiable,
236
+ Ranges,
237
+ Referer,
238
+ Referrer,
239
+ Refresh,
240
+ RequestHeaderFieldsTooLarge,
241
+ RequestTimeout,
242
+ ResetContent,
243
+ RetryAfter,
244
+ SeeOther,
245
+ Server,
246
+ ServiceUnavailable,
247
+ SetCookie,
248
+ StrictTransportSecurity,
249
+ SwitchingProtocols,
250
+ TE,
251
+ TemporaryRedirect,
252
+ TooEarly,
253
+ TooManyRequests,
254
+ Trailer,
255
+ TransferEncodingRequest,
256
+ TransferEncodingResponse,
257
+ Unauthorized,
258
+ UnavailableForLegalReasons,
259
+ UnprocessableContent,
260
+ UnsupportedMediaType,
261
+ Upgrade,
262
+ UpgradeRequired,
263
+ UriTooLong,
264
+ UseProxyDeprecated,
265
+ UserAgent,
266
+ VariantAlsoNegotiates,
267
+ Vary,
268
+ Via,
269
+ Warning,
270
+ WwwAuthenticate,
271
+ clientErrorHttpStatusCodeSchema,
272
+ getAuthorizationHeader,
273
+ getQueryParameters,
274
+ httpStatusCodeSchema,
275
+ isClientErrorHttpStatusCode,
276
+ isExpired,
277
+ isHttpStatusCode,
278
+ isServerErrorHttpStatusCode,
279
+ isSuccessHttpStatusCode,
280
+ serverErrorHttpStatusCodeSchema,
281
+ successHttpStatusCodeSchema
282
+ };
283
+ //# sourceMappingURL=http.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/http/authorizationToken.ts","../src/http/getQueryParameters.ts","../src/http/httpHeaders.ts","../src/http/httpStatusCodes.ts"],"sourcesContent":["export interface AuthorizationToken {\n\texpiresOn: number;\n\ttokenType: string;\n\tvalue: string;\n}\n\nexport const getAuthorizationHeader = (token: AuthorizationToken): string =>\n\t`${token.tokenType} ${token.value}`;\n\nexport const isExpired = (token: AuthorizationToken): boolean =>\n\ttoken.expiresOn < Date.now();\n","export const getQueryParameters = (url: string | URL): URLSearchParams => {\n\tconst urlString = url.toString();\n\n\tconst queryStringIndex = urlString.indexOf(\"?\");\n\tconst queryString =\n\t\tqueryStringIndex >= 0 ? urlString.substring(queryStringIndex) : \"\";\n\tconst query = new URLSearchParams(queryString);\n\n\treturn query;\n};\n","export type HttpRequestHeader =\n\t| \"Accept\"\n\t| \"Accept-Charset\"\n\t| \"Accept-Datetime\"\n\t| \"Accept-Encoding\"\n\t| \"Accept-Language\"\n\t| \"Authorization\"\n\t| \"Cache-Control\"\n\t| \"Connection\"\n\t| \"Content-Length\"\n\t| \"Content-MD5\"\n\t| \"Content-Type\"\n\t| \"Cookie\"\n\t| \"Date\"\n\t| \"Expect\"\n\t| \"From\"\n\t| \"Host\"\n\t| \"If-Match\"\n\t| \"If-Modified-Since\"\n\t| \"If-None-Match\"\n\t| \"If-Range\"\n\t| \"If-Unmodified-Since\"\n\t| \"Max-Forwards\"\n\t| \"Pragma\"\n\t| \"Proxy-Authorization\"\n\t| \"Range\"\n\t| \"Referer\"\n\t| \"TE\"\n\t| \"Upgrade\"\n\t| \"User-Agent\"\n\t| \"Via\"\n\t| \"Warning\";\n\nexport type HttpResponseHeader =\n\t| \"Accept-Ranges\"\n\t| \"Age\"\n\t| \"Allow\"\n\t| \"Cache-Control\"\n\t| \"Connection\"\n\t| \"Content-Disposition\"\n\t| \"Content-Encoding\"\n\t| \"Content-Language\"\n\t| \"Content-Length\"\n\t| \"Content-Location\"\n\t| \"Content-MD5\"\n\t| \"Content-Range\"\n\t| \"Content-Type\"\n\t| \"Date\"\n\t| \"ETag\"\n\t| \"Expires\"\n\t| \"Last-Modified\"\n\t| \"Link\"\n\t| \"Location\"\n\t| \"P3P\"\n\t| \"Pragma\"\n\t| \"Proxy-Authenticate\"\n\t| \"Refresh\"\n\t| \"Retry-After\"\n\t| \"Server\"\n\t| \"Set-Cookie\"\n\t| \"Strict-Transport-Security\"\n\t| \"Trailer\"\n\t| \"Transfer-Encoding\"\n\t| \"Vary\"\n\t| \"Via\"\n\t| \"Warning\"\n\t| \"WWW-Authenticate\";\n\nexport const Accept: HttpRequestHeader = \"Accept\";\nexport const AcceptCharset: HttpRequestHeader = \"Accept-Charset\";\nexport const AcceptDatetime: HttpRequestHeader = \"Accept-Datetime\";\nexport const AcceptEncoding: HttpRequestHeader = \"Accept-Encoding\";\nexport const AcceptLanguage: HttpRequestHeader = \"Accept-Language\";\nexport const AcceptRanges: HttpResponseHeader = \"Accept-Ranges\";\nexport const Age: HttpResponseHeader = \"Age\";\nexport const Allow: HttpResponseHeader = \"Allow\";\nexport const Authorization: HttpRequestHeader = \"Authorization\";\nexport const CacheControl: HttpRequestHeader | HttpResponseHeader =\n\t\"Cache-Control\";\nexport const Connection: HttpRequestHeader | HttpResponseHeader = \"Connection\";\nexport const ContentDisposition: HttpResponseHeader = \"Content-Disposition\";\nexport const ContentEncoding: HttpResponseHeader = \"Content-Encoding\";\nexport const ContentLanguage: HttpResponseHeader = \"Content-Language\";\nexport const ContentLength: HttpRequestHeader | HttpResponseHeader =\n\t\"Content-Length\";\nexport const ContentLocation: HttpResponseHeader = \"Content-Location\";\nexport const ContentMd5: HttpRequestHeader | HttpResponseHeader = \"Content-MD5\";\nexport const ContentRange: HttpResponseHeader = \"Content-Range\";\nexport const ContentType: HttpRequestHeader | HttpResponseHeader =\n\t\"Content-Type\";\nexport const Cookie: HttpRequestHeader = \"Cookie\";\nexport const DateTime: HttpRequestHeader | HttpResponseHeader = \"Date\";\nexport const ETag: HttpResponseHeader = \"ETag\";\nexport const Expect: HttpRequestHeader = \"Expect\";\nexport const Expires: HttpResponseHeader = \"Expires\";\nexport const From: HttpRequestHeader = \"From\";\nexport const Host: HttpRequestHeader = \"Host\";\nexport const IfMatch: HttpRequestHeader = \"If-Match\";\nexport const IfModifiedSince: HttpRequestHeader = \"If-Modified-Since\";\nexport const IfNoneMatch: HttpRequestHeader = \"If-None-Match\";\nexport const IfRange: HttpRequestHeader = \"If-Range\";\nexport const IfunmodifiedSince: HttpRequestHeader = \"If-Unmodified-Since\";\nexport const LastModified: HttpResponseHeader = \"Last-Modified\";\nexport const Link: HttpResponseHeader = \"Link\";\nexport const LocationUri: HttpResponseHeader = \"Location\";\nexport const MaxForwards: HttpRequestHeader = \"Max-Forwards\";\nexport const P3P: HttpResponseHeader = \"P3P\";\nexport const Pragma: HttpRequestHeader | HttpResponseHeader = \"Pragma\";\nexport const ProxyAuthenticate: HttpResponseHeader = \"Proxy-Authenticate\";\nexport const ProxyAuthorization: HttpRequestHeader = \"Proxy-Authorization\";\nexport const Ranges: HttpRequestHeader = \"Range\";\nexport const Referer: HttpRequestHeader = \"Referer\";\nexport const Referrer: HttpRequestHeader = Referer;\nexport const Refresh: HttpResponseHeader = \"Refresh\";\nexport const RetryAfter: HttpResponseHeader = \"Retry-After\";\nexport const Server: HttpResponseHeader = \"Server\";\nexport const SetCookie: HttpResponseHeader = \"Set-Cookie\";\nexport const StrictTransportSecurity: HttpResponseHeader =\n\t\"Strict-Transport-Security\";\nexport const TE: HttpRequestHeader = \"TE\";\nexport const Trailer: HttpResponseHeader = \"Trailer\";\nexport const TransferEncodingRequest: HttpRequestHeader = TE;\nexport const TransferEncodingResponse: HttpResponseHeader = \"Transfer-Encoding\";\nexport const Upgrade: HttpRequestHeader = \"Upgrade\";\nexport const UserAgent: HttpRequestHeader = \"User-Agent\";\nexport const Vary: HttpResponseHeader = \"Vary\";\nexport const Via: HttpRequestHeader | HttpResponseHeader = \"Via\";\nexport const Warning: HttpRequestHeader | HttpResponseHeader = \"Warning\";\nexport const WwwAuthenticate: HttpResponseHeader = \"WWW-Authenticate\";\n","import { z } from \"zod\";\n\nexport type HttpStatusCode =\n\t| 100\n\t| 101\n\t| 102\n\t| 103\n\t| 200\n\t| 201\n\t| 202\n\t| 203\n\t| 204\n\t| 205\n\t| 206\n\t| 207\n\t| 208\n\t| 226\n\t| 300\n\t| 301\n\t| 302\n\t| 303\n\t| 304\n\t| 305\n\t| 307\n\t| 308\n\t| 400\n\t| 401\n\t| 402\n\t| 403\n\t| 404\n\t| 405\n\t| 406\n\t| 407\n\t| 408\n\t| 409\n\t| 410\n\t| 411\n\t| 412\n\t| 413\n\t| 414\n\t| 415\n\t| 416\n\t| 417\n\t| 418\n\t| 421\n\t| 422\n\t| 423\n\t| 424\n\t| 425\n\t| 426\n\t| 428\n\t| 429\n\t| 431\n\t| 451\n\t| 500\n\t| 501\n\t| 502\n\t| 503\n\t| 504\n\t| 505\n\t| 506\n\t| 507\n\t| 508\n\t| 510\n\t| 511;\n\nexport const Continue: HttpStatusCode = 100 as const;\nexport const SwitchingProtocols: HttpStatusCode = 101 as const;\nexport const Processing: HttpStatusCode = 102 as const;\nexport const EarlyHints: HttpStatusCode = 103 as const;\nexport const Ok: HttpStatusCode = 200 as const;\nexport const Created: HttpStatusCode = 201 as const;\nexport const Accepted: HttpStatusCode = 202 as const;\nexport const NonAuthoritativeInformation: HttpStatusCode = 203 as const;\nexport const NoContent: HttpStatusCode = 204 as const;\nexport const ResetContent: HttpStatusCode = 205 as const;\nexport const PartialContent: HttpStatusCode = 206 as const;\nexport const MultiStatus: HttpStatusCode = 207 as const;\nexport const AlreadyReported: HttpStatusCode = 208 as const;\nexport const ImUsed: HttpStatusCode = 226 as const;\nexport const MultipleChoices: HttpStatusCode = 300 as const;\nexport const MovedPermanently: HttpStatusCode = 301 as const;\nexport const Found: HttpStatusCode = 302 as const;\nexport const SeeOther: HttpStatusCode = 303 as const;\nexport const NotModified: HttpStatusCode = 304 as const;\nexport const UseProxyDeprecated: HttpStatusCode = 305 as const;\nexport const TemporaryRedirect: HttpStatusCode = 307 as const;\nexport const PermanentRedirect: HttpStatusCode = 308 as const;\nexport const BadRequest: HttpStatusCode = 400 as const;\nexport const Unauthorized: HttpStatusCode = 401 as const;\nexport const PaymentRequired: HttpStatusCode = 402 as const;\nexport const Forbidden: HttpStatusCode = 403 as const;\nexport const NotFound: HttpStatusCode = 404 as const;\nexport const MethodNotAllowed: HttpStatusCode = 405 as const;\nexport const NotAcceptable: HttpStatusCode = 406 as const;\nexport const ProxyAuthenticationRequired: HttpStatusCode = 407 as const;\nexport const RequestTimeout: HttpStatusCode = 408 as const;\nexport const Conflict: HttpStatusCode = 409 as const;\nexport const Gone: HttpStatusCode = 410 as const;\nexport const LengthRequired: HttpStatusCode = 411 as const;\nexport const PreconditionFailed: HttpStatusCode = 412 as const;\nexport const PayloadTooLarge: HttpStatusCode = 413 as const;\nexport const UriTooLong: HttpStatusCode = 414 as const;\nexport const UnsupportedMediaType: HttpStatusCode = 415 as const;\nexport const RangeNotSatisfiable: HttpStatusCode = 416 as const;\nexport const ExpectationFailed: HttpStatusCode = 417 as const;\nexport const ImATeapot: HttpStatusCode = 418 as const;\nexport const MisdirectedRequest: HttpStatusCode = 421 as const;\nexport const UnprocessableContent: HttpStatusCode = 422 as const;\nexport const Locked: HttpStatusCode = 423 as const;\nexport const FailedDependency: HttpStatusCode = 424 as const;\nexport const TooEarly: HttpStatusCode = 425 as const;\nexport const UpgradeRequired: HttpStatusCode = 426 as const;\nexport const PreconditionRequired: HttpStatusCode = 428 as const;\nexport const TooManyRequests: HttpStatusCode = 429 as const;\nexport const RequestHeaderFieldsTooLarge: HttpStatusCode = 431 as const;\nexport const UnavailableForLegalReasons: HttpStatusCode = 451 as const;\nexport const InternalServerError: HttpStatusCode = 500 as const;\nexport const NotImplemented: HttpStatusCode = 501 as const;\nexport const BadGateway: HttpStatusCode = 502 as const;\nexport const ServiceUnavailable: HttpStatusCode = 503 as const;\nexport const GatewayTimeout: HttpStatusCode = 504 as const;\nexport const HttpVersionNotSupported: HttpStatusCode = 505 as const;\nexport const VariantAlsoNegotiates: HttpStatusCode = 506 as const;\nexport const InsufficientStorage: HttpStatusCode = 507 as const;\nexport const LoopDetected: HttpStatusCode = 508 as const;\nexport const NotExtended: HttpStatusCode = 510 as const;\nexport const NetworkAuthenticationRequired: HttpStatusCode = 511 as const;\n\n// Allow any numbers between 100 and 599 as those are potentially valid.\n// https://en.wikipedia.org/wiki/List_of_HTTP_status_codes\nexport const httpStatusCodeSchema = z.number().int().gte(100).lt(600);\n\nexport const clientErrorHttpStatusCodeSchema = httpStatusCodeSchema.and(\n\tz.number().gte(400).lt(500),\n);\nexport const serverErrorHttpStatusCodeSchema = httpStatusCodeSchema.and(\n\tz.number().gte(500).lt(600),\n);\nexport const successHttpStatusCodeSchema = httpStatusCodeSchema.and(\n\tz.number().gte(100).lt(400),\n);\n\nexport const isHttpStatusCode = (obj: unknown): obj is HttpStatusCode =>\n\thttpStatusCodeSchema.safeParse(obj).success;\n\nexport const isClientErrorHttpStatusCode = (\n\tobj: unknown,\n): obj is HttpStatusCode =>\n\tclientErrorHttpStatusCodeSchema.safeParse(obj).success;\n\nexport const isServerErrorHttpStatusCode = (\n\tobj: unknown,\n): obj is HttpStatusCode =>\n\tserverErrorHttpStatusCodeSchema.safeParse(obj).success;\n\nexport const isSuccessHttpStatusCode = (obj: unknown): obj is HttpStatusCode =>\n\tsuccessHttpStatusCodeSchema.safeParse(obj).success;\n"],"mappings":";AAMO,IAAM,yBAAyB,CAAC,UACtC,GAAG,MAAM,SAAS,IAAI,MAAM,KAAK;AAE3B,IAAM,YAAY,CAAC,UACzB,MAAM,YAAY,KAAK,IAAI;;;ACVrB,IAAM,qBAAqB,CAAC,QAAuC;AACzE,QAAM,Y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AACvC,IAAM,0BAA0C;AAChD,IAAM,wBAAwC;AAC9C,IAAM,sBAAsC;AAC5C,IAAM,eAA+B;AACrC,IAAM,cAA8B;AACpC,IAAM,gCAAgD;AAItD,IAAM,uBAAuB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,GAAG,GAAG;AAE7D,IAAM,kCAAkC,qBAAqB;AAAA,EACnE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,GAAG,GAAG;AAC3B;AACO,IAAM,kCAAkC,qBAAqB;AAAA,EACnE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,GAAG,GAAG;AAC3B;AACO,IAAM,8BAA8B,qBAAqB;AAAA,EAC/D,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,GAAG,GAAG;AAC3B;AAEO,IAAM,mBAAmB,CAAC,QAChC,qBAAqB,UAAU,GAAG,EAAE;AAE9B,IAAM,8BAA8B,CAC1C,QAEA,gCAAgC,UAAU,GAAG,EAAE;AAEzC,IAAM,8BAA8B,CAC1C,QAEA,gCAAgC,UAAU,GAAG,EAAE;AAEzC,IAAM,0BAA0B,CAAC,QACvC,4BAA4B,UAAU,GAAG,EAAE;","names":[]}
package/dist/io.d.mts ADDED
@@ -0,0 +1,244 @@
1
+ import z, { z as z$1 } from 'zod';
2
+
3
+ declare const keyCodeSchema: z.ZodEnum<{
4
+ AltLeft: "AltLeft";
5
+ AltRight: "AltRight";
6
+ ArrowDown: "ArrowDown";
7
+ ArrowLeft: "ArrowLeft";
8
+ ArrowRight: "ArrowRight";
9
+ ArrowUp: "ArrowUp";
10
+ Backquote: "Backquote";
11
+ Backslash: "Backslash";
12
+ Backspace: "Backspace";
13
+ BracketLeft: "BracketLeft";
14
+ BracketRight: "BracketRight";
15
+ CapsLock: "CapsLock";
16
+ Comma: "Comma";
17
+ ContextMenu: "ContextMenu";
18
+ ControlLeft: "ControlLeft";
19
+ ControlRight: "ControlRight";
20
+ Delete: "Delete";
21
+ Digit0: "Digit0";
22
+ Digit1: "Digit1";
23
+ Digit2: "Digit2";
24
+ Digit3: "Digit3";
25
+ Digit4: "Digit4";
26
+ Digit5: "Digit5";
27
+ Digit6: "Digit6";
28
+ Digit7: "Digit7";
29
+ Digit8: "Digit8";
30
+ Digit9: "Digit9";
31
+ End: "End";
32
+ Enter: "Enter";
33
+ Equal: "Equal";
34
+ Escape: "Escape";
35
+ F1: "F1";
36
+ F10: "F10";
37
+ F11: "F11";
38
+ F12: "F12";
39
+ F2: "F2";
40
+ F3: "F3";
41
+ F4: "F4";
42
+ F5: "F5";
43
+ F6: "F6";
44
+ F7: "F7";
45
+ F8: "F8";
46
+ F9: "F9";
47
+ Home: "Home";
48
+ Insert: "Insert";
49
+ KeyA: "KeyA";
50
+ KeyB: "KeyB";
51
+ KeyC: "KeyC";
52
+ KeyD: "KeyD";
53
+ KeyE: "KeyE";
54
+ KeyF: "KeyF";
55
+ KeyG: "KeyG";
56
+ KeyH: "KeyH";
57
+ KeyI: "KeyI";
58
+ KeyJ: "KeyJ";
59
+ KeyK: "KeyK";
60
+ KeyL: "KeyL";
61
+ KeyM: "KeyM";
62
+ KeyN: "KeyN";
63
+ KeyO: "KeyO";
64
+ KeyP: "KeyP";
65
+ KeyQ: "KeyQ";
66
+ KeyR: "KeyR";
67
+ KeyS: "KeyS";
68
+ KeyT: "KeyT";
69
+ KeyU: "KeyU";
70
+ KeyV: "KeyV";
71
+ KeyW: "KeyW";
72
+ KeyX: "KeyX";
73
+ KeyY: "KeyY";
74
+ KeyZ: "KeyZ";
75
+ MetaLeft: "MetaLeft";
76
+ MetaRight: "MetaRight";
77
+ Minus: "Minus";
78
+ NumLock: "NumLock";
79
+ Numpad0: "Numpad0";
80
+ Numpad1: "Numpad1";
81
+ Numpad2: "Numpad2";
82
+ Numpad3: "Numpad3";
83
+ Numpad4: "Numpad4";
84
+ Numpad5: "Numpad5";
85
+ Numpad6: "Numpad6";
86
+ Numpad7: "Numpad7";
87
+ Numpad8: "Numpad8";
88
+ Numpad9: "Numpad9";
89
+ NumpadAdd: "NumpadAdd";
90
+ NumpadDecimal: "NumpadDecimal";
91
+ NumpadDivide: "NumpadDivide";
92
+ NumpadMultiply: "NumpadMultiply";
93
+ NumpadSubtract: "NumpadSubtract";
94
+ PageDown: "PageDown";
95
+ PageUp: "PageUp";
96
+ Pause: "Pause";
97
+ Period: "Period";
98
+ PrintScreen: "PrintScreen";
99
+ Quote: "Quote";
100
+ ScrollLock: "ScrollLock";
101
+ Semicolon: "Semicolon";
102
+ ShiftLeft: "ShiftLeft";
103
+ ShiftRight: "ShiftRight";
104
+ Slash: "Slash";
105
+ Space: "Space";
106
+ Tab: "Tab";
107
+ }>;
108
+ type KeyCode = z.infer<typeof keyCodeSchema>;
109
+ declare const asKeyCode: (value: unknown) => KeyCode;
110
+ declare const isKeyCode: (obj: unknown) => obj is KeyCode;
111
+ declare const AltLeft: KeyCode;
112
+ declare const AltRight: KeyCode;
113
+ declare const ArrowDown: KeyCode;
114
+ declare const ArrowLeft: KeyCode;
115
+ declare const ArrowRight: KeyCode;
116
+ declare const ArrowUp: KeyCode;
117
+ declare const Backquote: KeyCode;
118
+ declare const Backslash: KeyCode;
119
+ declare const Backspace: KeyCode;
120
+ declare const BracketLeft: KeyCode;
121
+ declare const BracketRight: KeyCode;
122
+ declare const CapsLock: KeyCode;
123
+ declare const Comma: KeyCode;
124
+ declare const ContextMenu: KeyCode;
125
+ declare const ControlLeft: KeyCode;
126
+ declare const ControlRight: KeyCode;
127
+ declare const Delete: KeyCode;
128
+ declare const Digit0: KeyCode;
129
+ declare const Digit1: KeyCode;
130
+ declare const Digit2: KeyCode;
131
+ declare const Digit3: KeyCode;
132
+ declare const Digit4: KeyCode;
133
+ declare const Digit5: KeyCode;
134
+ declare const Digit6: KeyCode;
135
+ declare const Digit7: KeyCode;
136
+ declare const Digit8: KeyCode;
137
+ declare const Digit9: KeyCode;
138
+ declare const End: KeyCode;
139
+ declare const Enter: KeyCode;
140
+ declare const Equal: KeyCode;
141
+ declare const Escape: KeyCode;
142
+ declare const F1: KeyCode;
143
+ declare const F10: KeyCode;
144
+ declare const F11: KeyCode;
145
+ declare const F12: KeyCode;
146
+ declare const F2: KeyCode;
147
+ declare const F3: KeyCode;
148
+ declare const F4: KeyCode;
149
+ declare const F5: KeyCode;
150
+ declare const F6: KeyCode;
151
+ declare const F7: KeyCode;
152
+ declare const F8: KeyCode;
153
+ declare const F9: KeyCode;
154
+ declare const Home: KeyCode;
155
+ declare const Insert: KeyCode;
156
+ declare const KeyA: KeyCode;
157
+ declare const KeyB: KeyCode;
158
+ declare const KeyC: KeyCode;
159
+ declare const KeyD: KeyCode;
160
+ declare const KeyE: KeyCode;
161
+ declare const KeyF: KeyCode;
162
+ declare const KeyG: KeyCode;
163
+ declare const KeyH: KeyCode;
164
+ declare const KeyI: KeyCode;
165
+ declare const KeyJ: KeyCode;
166
+ declare const KeyK: KeyCode;
167
+ declare const KeyL: KeyCode;
168
+ declare const KeyM: KeyCode;
169
+ declare const KeyN: KeyCode;
170
+ declare const KeyO: KeyCode;
171
+ declare const KeyP: KeyCode;
172
+ declare const KeyQ: KeyCode;
173
+ declare const KeyR: KeyCode;
174
+ declare const KeyS: KeyCode;
175
+ declare const KeyT: KeyCode;
176
+ declare const KeyU: KeyCode;
177
+ declare const KeyV: KeyCode;
178
+ declare const KeyW: KeyCode;
179
+ declare const KeyX: KeyCode;
180
+ declare const KeyY: KeyCode;
181
+ declare const KeyZ: KeyCode;
182
+ declare const MetaLeft: KeyCode;
183
+ declare const MetaRight: KeyCode;
184
+ declare const Minus: KeyCode;
185
+ declare const NumLock: KeyCode;
186
+ declare const Numpad0: KeyCode;
187
+ declare const Numpad1: KeyCode;
188
+ declare const Numpad2: KeyCode;
189
+ declare const Numpad3: KeyCode;
190
+ declare const Numpad4: KeyCode;
191
+ declare const Numpad5: KeyCode;
192
+ declare const Numpad6: KeyCode;
193
+ declare const Numpad7: KeyCode;
194
+ declare const Numpad8: KeyCode;
195
+ declare const Numpad9: KeyCode;
196
+ declare const NumpadAdd: KeyCode;
197
+ declare const NumpadDecimal: KeyCode;
198
+ declare const NumpadDivide: KeyCode;
199
+ declare const NumpadMultiply: KeyCode;
200
+ declare const NumpadSubtract: KeyCode;
201
+ declare const PageDown: KeyCode;
202
+ declare const PageUp: KeyCode;
203
+ declare const Pause: KeyCode;
204
+ declare const Period: KeyCode;
205
+ declare const PrintScreen: KeyCode;
206
+ declare const Quote: KeyCode;
207
+ declare const ScrollLock: KeyCode;
208
+ declare const Semicolon: KeyCode;
209
+ declare const ShiftLeft: KeyCode;
210
+ declare const ShiftRight: KeyCode;
211
+ declare const Slash: KeyCode;
212
+ declare const Space: KeyCode;
213
+ declare const Tab: KeyCode;
214
+
215
+ declare const mimeTypeNameSchema: z$1.ZodEnum<{
216
+ "application/json": "application/json";
217
+ "application/octet-stream": "application/octet-stream";
218
+ "application/zip": "application/zip";
219
+ "image/gif": "image/gif";
220
+ "image/jpeg": "image/jpeg";
221
+ "image/png": "image/png";
222
+ "text/css": "text/css";
223
+ "text/csv": "text/csv";
224
+ "text/plain": "text/plain";
225
+ "video/mp4": "video/mp4";
226
+ "video/msvideo": "video/msvideo";
227
+ "video/x-ms-wmv": "video/x-ms-wmv";
228
+ }>;
229
+ type MimeTypeName = z$1.infer<typeof mimeTypeNameSchema>;
230
+ declare const asMimeTypeName: (value: unknown) => MimeTypeName;
231
+ declare const isMimeTypeName: (obj: unknown) => obj is MimeTypeName;
232
+ declare const ApplicationJson: MimeTypeName;
233
+ declare const ApplicationOctetStream: MimeTypeName;
234
+ declare const ApplicationZip: MimeTypeName;
235
+ declare const ImageGif: MimeTypeName;
236
+ declare const ImageJpeg: MimeTypeName;
237
+ declare const ImagePng: MimeTypeName;
238
+ declare const TextCsv: MimeTypeName;
239
+ declare const TextPlain: MimeTypeName;
240
+ declare const VideoMp4: MimeTypeName;
241
+ declare const VideoMsVideo: MimeTypeName;
242
+ declare const VideoWmv: MimeTypeName;
243
+
244
+ export { AltLeft, AltRight, ApplicationJson, ApplicationOctetStream, ApplicationZip, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, Backquote, Backslash, Backspace, BracketLeft, BracketRight, CapsLock, Comma, ContextMenu, ControlLeft, ControlRight, Delete, Digit0, Digit1, Digit2, Digit3, Digit4, Digit5, Digit6, Digit7, Digit8, Digit9, End, Enter, Equal, Escape, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, Home, ImageGif, ImageJpeg, ImagePng, Insert, KeyA, KeyB, KeyC, type KeyCode, KeyD, KeyE, KeyF, KeyG, KeyH, KeyI, KeyJ, KeyK, KeyL, KeyM, KeyN, KeyO, KeyP, KeyQ, KeyR, KeyS, KeyT, KeyU, KeyV, KeyW, KeyX, KeyY, KeyZ, MetaLeft, MetaRight, type MimeTypeName, Minus, NumLock, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9, NumpadAdd, NumpadDecimal, NumpadDivide, NumpadMultiply, NumpadSubtract, PageDown, PageUp, Pause, Period, PrintScreen, Quote, ScrollLock, Semicolon, ShiftLeft, ShiftRight, Slash, Space, Tab, TextCsv, TextPlain, VideoMp4, VideoMsVideo, VideoWmv, asKeyCode, asMimeTypeName, isKeyCode, isMimeTypeName, keyCodeSchema, mimeTypeNameSchema };