@rivuty/http-status 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oleg Michailov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # @rivuty/http-status
2
+
3
+ Type-safe HTTP status codes for TypeScript and JavaScript projects.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install @rivuty/http-status
9
+ # or
10
+ pnpm add @rivuty/http-status
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { HttpStatusCode } from "@rivuty/http-status";
17
+
18
+ response.status(HttpStatusCode.Ok); // 200
19
+ response.status(HttpStatusCode.NotFound); // 404
20
+ response.status(HttpStatusCode.Unauthorized); // 401
21
+ ```
22
+
23
+ ## API
24
+
25
+ ### `HttpStatusCode`
26
+
27
+ A readonly object mapping semantic names to their numeric HTTP status codes.
28
+
29
+ #### 1xx Informational
30
+
31
+ | Name | Code |
32
+ | -------------------- | ---- |
33
+ | `Continue` | 100 |
34
+ | `SwitchingProtocols` | 101 |
35
+ | `Processing` | 102 |
36
+ | `EarlyHints` | 103 |
37
+
38
+ #### 2xx Success
39
+
40
+ | Name | Code |
41
+ | ----------------------------- | ---- |
42
+ | `Ok` | 200 |
43
+ | `Created` | 201 |
44
+ | `Accepted` | 202 |
45
+ | `NonAuthoritativeInformation` | 203 |
46
+ | `NoContent` | 204 |
47
+ | `ResetContent` | 205 |
48
+ | `PartialContent` | 206 |
49
+ | `MultiStatus` | 207 |
50
+ | `AlreadyReported` | 208 |
51
+ | `InstanceManipulationUsed` | 226 |
52
+
53
+ #### 3xx Redirection
54
+
55
+ | Name | Code |
56
+ | ------------------- | ---- |
57
+ | `MultipleChoices` | 300 |
58
+ | `MovedPermanently` | 301 |
59
+ | `Found` | 302 |
60
+ | `SeeOther` | 303 |
61
+ | `NotModified` | 304 |
62
+ | `UseProxy` | 305 |
63
+ | `TemporaryRedirect` | 307 |
64
+ | `PermanentRedirect` | 308 |
65
+
66
+ #### 4xx Client Errors
67
+
68
+ | Name | Code |
69
+ | ----------------------------- | ---- |
70
+ | `BadRequest` | 400 |
71
+ | `Unauthorized` | 401 |
72
+ | `PaymentRequired` | 402 |
73
+ | `Forbidden` | 403 |
74
+ | `NotFound` | 404 |
75
+ | `MethodNotAllowed` | 405 |
76
+ | `NotAcceptable` | 406 |
77
+ | `ProxyAuthenticationRequired` | 407 |
78
+ | `RequestTimeout` | 408 |
79
+ | `Conflict` | 409 |
80
+ | `Gone` | 410 |
81
+ | `LengthRequired` | 411 |
82
+ | `PreconditionFailed` | 412 |
83
+ | `PayloadTooLarge` | 413 |
84
+ | `UriTooLong` | 414 |
85
+ | `UnsupportedMediaType` | 415 |
86
+ | `RangeNotSatisfiable` | 416 |
87
+ | `ExpectationFailed` | 417 |
88
+ | `MisdirectedRequest` | 421 |
89
+ | `UnprocessableContent` | 422 |
90
+ | `Locked` | 423 |
91
+ | `FailedDependency` | 424 |
92
+ | `TooEarly` | 425 |
93
+ | `UpgradeRequired` | 426 |
94
+ | `PreconditionRequired` | 428 |
95
+ | `TooManyRequests` | 429 |
96
+ | `RequestHeaderFieldsTooLarge` | 431 |
97
+ | `UnavailableForLegalReasons` | 451 |
98
+
99
+ #### 5xx Server Errors
100
+
101
+ | Name | Code |
102
+ | ------------------------------- | ---- |
103
+ | `InternalServerError` | 500 |
104
+ | `NotImplemented` | 501 |
105
+ | `BadGateway` | 502 |
106
+ | `ServiceUnavailable` | 503 |
107
+ | `GatewayTimeout` | 504 |
108
+ | `HttpVersionNotSupported` | 505 |
109
+ | `VariantAlsoNegotiates` | 506 |
110
+ | `InsufficientStorage` | 507 |
111
+ | `LoopDetected` | 508 |
112
+ | `NotExtended` | 510 |
113
+ | `NetworkAuthenticationRequired` | 511 |
114
+
115
+ ## License
116
+
117
+ @rivuty/http-status is open-sourced under the [MIT license](LICENSE)
@@ -0,0 +1,63 @@
1
+ export declare const HttpStatusCode: {
2
+ readonly Continue: 100;
3
+ readonly SwitchingProtocols: 101;
4
+ readonly Processing: 102;
5
+ readonly EarlyHints: 103;
6
+ readonly Ok: 200;
7
+ readonly Created: 201;
8
+ readonly Accepted: 202;
9
+ readonly NonAuthoritativeInformation: 203;
10
+ readonly NoContent: 204;
11
+ readonly ResetContent: 205;
12
+ readonly PartialContent: 206;
13
+ readonly MultiStatus: 207;
14
+ readonly AlreadyReported: 208;
15
+ readonly InstanceManipulationUsed: 226;
16
+ readonly MultipleChoices: 300;
17
+ readonly MovedPermanently: 301;
18
+ readonly Found: 302;
19
+ readonly SeeOther: 303;
20
+ readonly NotModified: 304;
21
+ readonly UseProxy: 305;
22
+ readonly TemporaryRedirect: 307;
23
+ readonly PermanentRedirect: 308;
24
+ readonly BadRequest: 400;
25
+ readonly Unauthorized: 401;
26
+ readonly PaymentRequired: 402;
27
+ readonly Forbidden: 403;
28
+ readonly NotFound: 404;
29
+ readonly MethodNotAllowed: 405;
30
+ readonly NotAcceptable: 406;
31
+ readonly ProxyAuthenticationRequired: 407;
32
+ readonly RequestTimeout: 408;
33
+ readonly Conflict: 409;
34
+ readonly Gone: 410;
35
+ readonly LengthRequired: 411;
36
+ readonly PreconditionFailed: 412;
37
+ readonly PayloadTooLarge: 413;
38
+ readonly UriTooLong: 414;
39
+ readonly UnsupportedMediaType: 415;
40
+ readonly RangeNotSatisfiable: 416;
41
+ readonly ExpectationFailed: 417;
42
+ readonly MisdirectedRequest: 421;
43
+ readonly UnprocessableContent: 422;
44
+ readonly Locked: 423;
45
+ readonly FailedDependency: 424;
46
+ readonly TooEarly: 425;
47
+ readonly UpgradeRequired: 426;
48
+ readonly PreconditionRequired: 428;
49
+ readonly TooManyRequests: 429;
50
+ readonly RequestHeaderFieldsTooLarge: 431;
51
+ readonly UnavailableForLegalReasons: 451;
52
+ readonly InternalServerError: 500;
53
+ readonly NotImplemented: 501;
54
+ readonly BadGateway: 502;
55
+ readonly ServiceUnavailable: 503;
56
+ readonly GatewayTimeout: 504;
57
+ readonly HttpVersionNotSupported: 505;
58
+ readonly VariantAlsoNegotiates: 506;
59
+ readonly InsufficientStorage: 507;
60
+ readonly LoopDetected: 508;
61
+ readonly NotExtended: 510;
62
+ readonly NetworkAuthenticationRequired: 511;
63
+ };
@@ -0,0 +1 @@
1
+ export { HttpStatusCode } from './HttpStatusCode';
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ //#region src/HttpStatusCode.ts
2
+ var e = {
3
+ Continue: 100,
4
+ SwitchingProtocols: 101,
5
+ Processing: 102,
6
+ EarlyHints: 103,
7
+ Ok: 200,
8
+ Created: 201,
9
+ Accepted: 202,
10
+ NonAuthoritativeInformation: 203,
11
+ NoContent: 204,
12
+ ResetContent: 205,
13
+ PartialContent: 206,
14
+ MultiStatus: 207,
15
+ AlreadyReported: 208,
16
+ InstanceManipulationUsed: 226,
17
+ MultipleChoices: 300,
18
+ MovedPermanently: 301,
19
+ Found: 302,
20
+ SeeOther: 303,
21
+ NotModified: 304,
22
+ UseProxy: 305,
23
+ TemporaryRedirect: 307,
24
+ PermanentRedirect: 308,
25
+ BadRequest: 400,
26
+ Unauthorized: 401,
27
+ PaymentRequired: 402,
28
+ Forbidden: 403,
29
+ NotFound: 404,
30
+ MethodNotAllowed: 405,
31
+ NotAcceptable: 406,
32
+ ProxyAuthenticationRequired: 407,
33
+ RequestTimeout: 408,
34
+ Conflict: 409,
35
+ Gone: 410,
36
+ LengthRequired: 411,
37
+ PreconditionFailed: 412,
38
+ PayloadTooLarge: 413,
39
+ UriTooLong: 414,
40
+ UnsupportedMediaType: 415,
41
+ RangeNotSatisfiable: 416,
42
+ ExpectationFailed: 417,
43
+ MisdirectedRequest: 421,
44
+ UnprocessableContent: 422,
45
+ Locked: 423,
46
+ FailedDependency: 424,
47
+ TooEarly: 425,
48
+ UpgradeRequired: 426,
49
+ PreconditionRequired: 428,
50
+ TooManyRequests: 429,
51
+ RequestHeaderFieldsTooLarge: 431,
52
+ UnavailableForLegalReasons: 451,
53
+ InternalServerError: 500,
54
+ NotImplemented: 501,
55
+ BadGateway: 502,
56
+ ServiceUnavailable: 503,
57
+ GatewayTimeout: 504,
58
+ HttpVersionNotSupported: 505,
59
+ VariantAlsoNegotiates: 506,
60
+ InsufficientStorage: 507,
61
+ LoopDetected: 508,
62
+ NotExtended: 510,
63
+ NetworkAuthenticationRequired: 511
64
+ };
65
+ //#endregion
66
+ export { e as HttpStatusCode };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@rivuty/http-status",
3
+ "version": "1.0.0",
4
+ "description": "Type-safe HTTP status codes",
5
+ "keywords": [
6
+ "http-status",
7
+ "http-status-code",
8
+ "status-code"
9
+ ],
10
+ "license": "MIT",
11
+ "author": "Oleg Michailov",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/rivuty/http-status.git"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "type": "module",
20
+ "sideEffects": false,
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "vite build",
32
+ "lint": "oxlint",
33
+ "lint:fix": "oxlint --fix",
34
+ "format": "oxfmt --check",
35
+ "format:fix": "oxfmt --write",
36
+ "typecheck": "tsc",
37
+ "verify": "run-p -c lint format typecheck",
38
+ "release": "release-it"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^25.5.0",
42
+ "npm-run-all2": "^8.0.4",
43
+ "oxfmt": "^0.41.0",
44
+ "oxlint": "^1.56.0",
45
+ "oxlint-tsgolint": "^0.17.0",
46
+ "release-it": "^19.2.4",
47
+ "typescript": "^5.9.3",
48
+ "vite": "^8.0.1",
49
+ "vite-plugin-dts": "^4.5.4"
50
+ },
51
+ "engines": {
52
+ "node": "25.8.1"
53
+ },
54
+ "packageManager": "pnpm@10.32.1"
55
+ }