uityu.shared 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -109,6 +109,18 @@ const limit = clampLimit(undefined, { defaultValue: 10, max: 50, min: 5 });
109
109
  // -> 10
110
110
  ```
111
111
 
112
+ ### Normalización de texto genérica
113
+
114
+ ```ts
115
+ import { normalizeText } from 'uityu.shared/common/string';
116
+
117
+ const emailKey = normalizeText(' USER@domain.COM ');
118
+ // -> 'user@domain.com'
119
+
120
+ const keepCase = normalizeText(' Mixed Value ', { lowercase: false });
121
+ // -> 'Mixed Value'
122
+ ```
123
+
112
124
  ## Errores + HTTP (`uityu.shared/errors`, `uityu.shared/http`)
113
125
 
114
126
  ```ts
@@ -128,6 +140,29 @@ export async function handler(req): Promise<Response> {
128
140
  }
129
141
  ```
130
142
 
143
+ ### Middleware CORS configurable
144
+
145
+ ```ts
146
+ import { createCorsToolkit } from 'uityu.shared/http';
147
+
148
+ const cors = createCorsToolkit({
149
+ allowedOrigins: ['https://app.uityu.com', 'https://admin.uityu.com'],
150
+ allowedMethods: ['GET', 'POST'],
151
+ allowedHeaders: ['Content-Type', 'Authorization'],
152
+ exposeHeaders: ['X-Trace-Id'],
153
+ allowCredentials: true,
154
+ });
155
+
156
+ export const handler = (req, res, next) => {
157
+ cors.corsHandler(req, res, (err) => {
158
+ if (err) return next(err);
159
+ if (!cors.ensureMethod(req, res, 'POST')) return;
160
+ // ...logic
161
+ next();
162
+ });
163
+ };
164
+ ```
165
+
131
166
  ## Búsqueda (`uityu.shared/search`)
132
167
 
133
168
  ```ts
@@ -1,3 +1,4 @@
1
1
  export * from "./math/index.js";
2
2
  export * from "./logging/index.js";
3
+ export * from "./string/index.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./math/index.js";
2
2
  export * from "./logging/index.js";
3
+ export * from "./string/index.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./normalize-text.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./normalize-text.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type NormalizeTextOptions = {
2
+ /** When false, keeps original casing */
3
+ lowercase?: boolean;
4
+ /** When false, preserves surrounding whitespace */
5
+ trim?: boolean;
6
+ };
7
+ /**
8
+ * Normalize arbitrary strings (emails, identifiers, etc.)
9
+ * by trimming and lowercasing by default.
10
+ */
11
+ export declare function normalizeText(value: string | null | undefined, options?: NormalizeTextOptions): string;
12
+ //# sourceMappingURL=normalize-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-text.d.ts","sourceRoot":"","sources":["../../../src/common/string/normalize-text.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAOF;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,GAAE,oBAAsC,GAC9C,MAAM,CAYR"}
@@ -0,0 +1,19 @@
1
+ const DEFAULT_OPTIONS = {
2
+ lowercase: true,
3
+ trim: true,
4
+ };
5
+ /**
6
+ * Normalize arbitrary strings (emails, identifiers, etc.)
7
+ * by trimming and lowercasing by default.
8
+ */
9
+ export function normalizeText(value, options = DEFAULT_OPTIONS) {
10
+ if (typeof value !== "string") {
11
+ return "";
12
+ }
13
+ let result = options.trim === false ? value : value.trim();
14
+ if (options.lowercase !== false) {
15
+ result = result.toLowerCase();
16
+ }
17
+ return result;
18
+ }
19
+ //# sourceMappingURL=normalize-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-text.js","sourceRoot":"","sources":["../../../src/common/string/normalize-text.ts"],"names":[],"mappings":"AAOA,MAAM,eAAe,GAAmC;IACtD,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;CACX,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAgC,EAChC,UAAgC,eAAe;IAE/C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,MAAM,GAAG,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAE3D,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;QAChC,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,27 @@
1
+ export type CorsRequestLike = {
2
+ headers?: Record<string, unknown>;
3
+ method?: string;
4
+ get?(header: string): string | undefined;
5
+ };
6
+ export type CorsResponseLike = {
7
+ setHeader(name: string, value: string): void;
8
+ status?(code: number): CorsResponseLike | void;
9
+ send?(body?: unknown): unknown;
10
+ };
11
+ export type CorsNextLike = (error?: unknown) => unknown;
12
+ export interface CorsConfig {
13
+ allowedOrigins: string[];
14
+ allowedMethods?: string[];
15
+ allowedHeaders?: string[];
16
+ exposeHeaders?: string[];
17
+ allowCredentials?: boolean;
18
+ preflightStatusCode?: number;
19
+ enableDebugHeader?: boolean;
20
+ }
21
+ export interface CorsToolkit {
22
+ applyCorsHeaders(req: CorsRequestLike, res: CorsResponseLike): void;
23
+ corsHandler(req: CorsRequestLike, res: CorsResponseLike, next: CorsNextLike): unknown;
24
+ ensureMethod(req: CorsRequestLike, res: CorsResponseLike, expectedMethod: string): boolean;
25
+ }
26
+ export declare function createCorsToolkit(config: CorsConfig): CorsToolkit;
27
+ //# sourceMappingURL=cors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../src/http/cors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAC/C,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpE,WAAW,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC;IACtF,YAAY,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5F;AAOD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,CA2DjE"}
@@ -0,0 +1,103 @@
1
+ const DEFAULT_ALLOWED_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"];
2
+ const DEFAULT_ALLOWED_HEADERS = ["Content-Type", "Authorization", "X-Requested-With"];
3
+ const DEFAULT_EXPOSE_HEADERS = ["X-Trace-Id", "WWW-Authenticate"];
4
+ const DEFAULT_PREFLIGHT_STATUS = 204;
5
+ export function createCorsToolkit(config) {
6
+ const normalizedConfig = normalizeConfig(config);
7
+ const allowedOriginSet = new Set(normalizedConfig.allowedOrigins);
8
+ const applyCorsHeaders = (req, res) => {
9
+ const origin = readHeader(req, "origin");
10
+ const allowedOrigin = resolveAllowedOrigin(origin, allowedOriginSet);
11
+ if (allowedOrigin) {
12
+ res.setHeader("Access-Control-Allow-Origin", allowedOrigin);
13
+ }
14
+ else if (normalizedConfig.enableDebugHeader) {
15
+ res.setHeader("X-CORS-Not-Allowed-Origin", origin ?? "<none>");
16
+ }
17
+ res.setHeader("Vary", "Origin");
18
+ res.setHeader("Access-Control-Allow-Headers", normalizedConfig.allowedHeaders.join(", "));
19
+ res.setHeader("Access-Control-Allow-Methods", normalizedConfig.allowedMethods.join(", "));
20
+ res.setHeader("Access-Control-Expose-Headers", normalizedConfig.exposeHeaders.join(", "));
21
+ res.setHeader("Access-Control-Allow-Credentials", normalizedConfig.allowCredentials ? "true" : "false");
22
+ };
23
+ const corsHandler = (req, res, next) => {
24
+ applyCorsHeaders(req, res);
25
+ if (isPreflight(req)) {
26
+ respond(res, normalizedConfig.preflightStatusCode, "");
27
+ return undefined;
28
+ }
29
+ return next();
30
+ };
31
+ const ensureMethod = (req, res, expectedMethod) => {
32
+ if (isPreflight(req)) {
33
+ return true;
34
+ }
35
+ const method = (req.method ?? "").toUpperCase();
36
+ if (method !== expectedMethod.toUpperCase()) {
37
+ respond(res, 405, "Method Not Allowed");
38
+ return false;
39
+ }
40
+ return true;
41
+ };
42
+ return {
43
+ applyCorsHeaders,
44
+ corsHandler,
45
+ ensureMethod,
46
+ };
47
+ }
48
+ const normalizeConfig = (config) => {
49
+ const allowedOrigins = config.allowedOrigins.map((value) => value?.trim()).filter(Boolean);
50
+ if (!allowedOrigins.length) {
51
+ throw new Error("CORS configuration requires at least one allowed origin");
52
+ }
53
+ if (config.allowCredentials && allowedOrigins.includes("*")) {
54
+ throw new Error("Cannot use wildcard origin when allowCredentials is true");
55
+ }
56
+ return {
57
+ allowedOrigins,
58
+ allowedMethods: normalizeList(config.allowedMethods, DEFAULT_ALLOWED_METHODS),
59
+ allowedHeaders: normalizeList(config.allowedHeaders, DEFAULT_ALLOWED_HEADERS),
60
+ exposeHeaders: normalizeList(config.exposeHeaders, DEFAULT_EXPOSE_HEADERS),
61
+ allowCredentials: Boolean(config.allowCredentials),
62
+ preflightStatusCode: config.preflightStatusCode ?? DEFAULT_PREFLIGHT_STATUS,
63
+ enableDebugHeader: Boolean(config.enableDebugHeader),
64
+ };
65
+ };
66
+ const normalizeList = (value, fallback) => {
67
+ const source = value && value.length ? value : fallback;
68
+ return Array.from(new Set(source.map((entry) => entry.trim()).filter(Boolean)));
69
+ };
70
+ const resolveAllowedOrigin = (origin, whitelist) => {
71
+ if (!origin) {
72
+ return null;
73
+ }
74
+ if (whitelist.has("*")) {
75
+ return origin;
76
+ }
77
+ return whitelist.has(origin) ? origin : null;
78
+ };
79
+ const readHeader = (req, name) => {
80
+ if (typeof req.get === "function") {
81
+ const value = req.get(name);
82
+ if (typeof value === "string") {
83
+ return value;
84
+ }
85
+ }
86
+ const headers = req.headers ?? {};
87
+ const value = headers[name] ?? headers[name.toLowerCase()];
88
+ return typeof value === "string" ? value : undefined;
89
+ };
90
+ const isPreflight = (req) => (req.method ?? "").toUpperCase() === "OPTIONS";
91
+ const respond = (res, status, body) => {
92
+ if (typeof res.status === "function") {
93
+ const next = res.status(status);
94
+ if (next && typeof next.send === "function") {
95
+ next.send(body);
96
+ return;
97
+ }
98
+ }
99
+ if (typeof res.send === "function") {
100
+ res.send(body);
101
+ }
102
+ };
103
+ //# sourceMappingURL=cors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cors.js","sourceRoot":"","sources":["../../src/http/cors.ts"],"names":[],"mappings":"AA8BA,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAC9F,MAAM,uBAAuB,GAAG,CAAC,cAAc,EAAE,eAAe,EAAE,kBAAkB,CAAU,CAAC;AAC/F,MAAM,sBAAsB,G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1
1
  export * from "./error-mapper.js";
2
+ export * from "./cors.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./error-mapper.js";
2
+ export * from "./cors.js";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uityu.shared",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Shared infrastructure toolkit for UITYU microservices (Cloud Functions, SSR, APIs).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,6 +22,10 @@
22
22
  "import": "./dist/common/logging/index.js",
23
23
  "types": "./dist/common/logging/index.d.ts"
24
24
  },
25
+ "./common/string": {
26
+ "import": "./dist/common/string/index.js",
27
+ "types": "./dist/common/string/index.d.ts"
28
+ },
25
29
  "./errors": {
26
30
  "import": "./dist/errors/index.js",
27
31
  "types": "./dist/errors/index.d.ts"