@chedraui/http-codes 1.0.1

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.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Códigos HTTP permitidos - solo valores reales estándar
3
+ * Al agregar uno nuevo se debe agregar aquí también
4
+ */
5
+ type HttpStatusCode = 200 | 2001 | 400 | 500;
6
+ /**
7
+ * Estructura de cada entrada del objeto HttpCode
8
+ */
9
+ type HttpCodeEntry = {
10
+ codigoRespuesta: HttpStatusCode;
11
+ mensaje: string;
12
+ };
13
+
14
+ declare const HttpCode: Readonly<{
15
+ /**
16
+ * Códigos de respuesta HTTP 2xx
17
+ */
18
+ readonly OK: Readonly<HttpCodeEntry>;
19
+ /**
20
+ * Códigos de respuesta HTTP 4xx
21
+ */
22
+ readonly NOT_FOUND: Readonly<HttpCodeEntry>;
23
+ /**
24
+ * Códigos de respuesta HTTP 5xx
25
+ */
26
+ readonly INTERNAL_SERVER_ERROR: Readonly<HttpCodeEntry>;
27
+ }>;
28
+ type HttpCodeKey = keyof typeof HttpCode;
29
+ type HttpCodeValue = (typeof HttpCode)[HttpCodeKey];
30
+
31
+ export { HttpCode, type HttpCodeEntry, type HttpCodeKey, type HttpCodeValue, type HttpStatusCode };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Códigos HTTP permitidos - solo valores reales estándar
3
+ * Al agregar uno nuevo se debe agregar aquí también
4
+ */
5
+ type HttpStatusCode = 200 | 2001 | 400 | 500;
6
+ /**
7
+ * Estructura de cada entrada del objeto HttpCode
8
+ */
9
+ type HttpCodeEntry = {
10
+ codigoRespuesta: HttpStatusCode;
11
+ mensaje: string;
12
+ };
13
+
14
+ declare const HttpCode: Readonly<{
15
+ /**
16
+ * Códigos de respuesta HTTP 2xx
17
+ */
18
+ readonly OK: Readonly<HttpCodeEntry>;
19
+ /**
20
+ * Códigos de respuesta HTTP 4xx
21
+ */
22
+ readonly NOT_FOUND: Readonly<HttpCodeEntry>;
23
+ /**
24
+ * Códigos de respuesta HTTP 5xx
25
+ */
26
+ readonly INTERNAL_SERVER_ERROR: Readonly<HttpCodeEntry>;
27
+ }>;
28
+ type HttpCodeKey = keyof typeof HttpCode;
29
+ type HttpCodeValue = (typeof HttpCode)[HttpCodeKey];
30
+
31
+ export { HttpCode, type HttpCodeEntry, type HttpCodeKey, type HttpCodeValue, type HttpStatusCode };
package/dist/index.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ HttpCode: () => HttpCode
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/constans.ts
28
+ var createEntry = (codigoRespuesta, mensaje) => {
29
+ return Object.freeze({ codigoRespuesta, mensaje });
30
+ };
31
+ var HttpCode = Object.freeze({
32
+ /**
33
+ * Códigos de respuesta HTTP 2xx
34
+ */
35
+ OK: createEntry(200, "\xC9xito"),
36
+ /**
37
+ * Códigos de respuesta HTTP 4xx
38
+ */
39
+ NOT_FOUND: createEntry(400, "No encontrado"),
40
+ /**
41
+ * Códigos de respuesta HTTP 5xx
42
+ */
43
+ INTERNAL_SERVER_ERROR: createEntry(500, "Error interno del servidor")
44
+ });
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ HttpCode
48
+ });
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/constans.ts"],"sourcesContent":["export { HttpCode } from \"./constans\";\n\nexport type { HttpStatusCode, HttpCodeEntry } from \"./types\";\nexport type { HttpCodeKey, HttpCodeValue } from \"./constans\";\n","import type { HttpStatusCode, HttpCodeEntry } from \"./types\";\n\nconst createEntry = (\n codigoRespuesta: HttpStatusCode,\n mensaje: string,\n): Readonly<HttpCodeEntry> => {\n return Object.freeze({ codigoRespuesta, mensaje });\n};\n\nexport const HttpCode = Object.freeze({\n /**\n * Códigos de respuesta HTTP 2xx\n */\n OK: createEntry(200, \"Éxito\"),\n\n /**\n * Códigos de respuesta HTTP 4xx\n */\n NOT_FOUND: createEntry(400, \"No encontrado\"),\n\n /**\n * Códigos de respuesta HTTP 5xx\n */\n INTERNAL_SERVER_ERROR: createEntry(500, \"Error interno del servidor\"),\n} as const);\n\nexport type HttpCodeKey = keyof typeof HttpCode;\nexport type HttpCodeValue = (typeof HttpCode)[HttpCodeKey];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,cAAc,CAClB,iBACA,YAC4B;AAC5B,SAAO,OAAO,OAAO,EAAE,iBAAiB,QAAQ,CAAC;AACnD;AAEO,IAAM,WAAW,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,EAIpC,IAAI,YAAY,KAAK,UAAO;AAAA;AAAA;AAAA;AAAA,EAK5B,WAAW,YAAY,KAAK,eAAe;AAAA;AAAA;AAAA;AAAA,EAK3C,uBAAuB,YAAY,KAAK,4BAA4B;AACtE,CAAU;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,22 @@
1
+ // src/constans.ts
2
+ var createEntry = (codigoRespuesta, mensaje) => {
3
+ return Object.freeze({ codigoRespuesta, mensaje });
4
+ };
5
+ var HttpCode = Object.freeze({
6
+ /**
7
+ * Códigos de respuesta HTTP 2xx
8
+ */
9
+ OK: createEntry(200, "\xC9xito"),
10
+ /**
11
+ * Códigos de respuesta HTTP 4xx
12
+ */
13
+ NOT_FOUND: createEntry(400, "No encontrado"),
14
+ /**
15
+ * Códigos de respuesta HTTP 5xx
16
+ */
17
+ INTERNAL_SERVER_ERROR: createEntry(500, "Error interno del servidor")
18
+ });
19
+ export {
20
+ HttpCode
21
+ };
22
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constans.ts"],"sourcesContent":["import type { HttpStatusCode, HttpCodeEntry } from \"./types\";\n\nconst createEntry = (\n codigoRespuesta: HttpStatusCode,\n mensaje: string,\n): Readonly<HttpCodeEntry> => {\n return Object.freeze({ codigoRespuesta, mensaje });\n};\n\nexport const HttpCode = Object.freeze({\n /**\n * Códigos de respuesta HTTP 2xx\n */\n OK: createEntry(200, \"Éxito\"),\n\n /**\n * Códigos de respuesta HTTP 4xx\n */\n NOT_FOUND: createEntry(400, \"No encontrado\"),\n\n /**\n * Códigos de respuesta HTTP 5xx\n */\n INTERNAL_SERVER_ERROR: createEntry(500, \"Error interno del servidor\"),\n} as const);\n\nexport type HttpCodeKey = keyof typeof HttpCode;\nexport type HttpCodeValue = (typeof HttpCode)[HttpCodeKey];\n"],"mappings":";AAEA,IAAM,cAAc,CAClB,iBACA,YAC4B;AAC5B,SAAO,OAAO,OAAO,EAAE,iBAAiB,QAAQ,CAAC;AACnD;AAEO,IAAM,WAAW,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,EAIpC,IAAI,YAAY,KAAK,UAAO;AAAA;AAAA;AAAA;AAAA,EAK5B,WAAW,YAAY,KAAK,eAAe;AAAA;AAAA;AAAA;AAAA,EAK3C,uBAAuB,YAAY,KAAK,4BAA4B;AACtE,CAAU;","names":[]}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@chedraui/http-codes",
3
+ "version": "1.0.1",
4
+ "main": "./dist/index.cjs",
5
+ "module": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.cts",
15
+ "default": "./dist/index.cjs"
16
+ }
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsup",
24
+ "dev": "tsup --watch"
25
+ },
26
+ "devDependencies": {
27
+ "prettier": "3.8.1",
28
+ "tsup": "^8.5.1",
29
+ "typescript": "^6.0.2"
30
+ }
31
+ }