@rtorcato/js-common 2.8.0 → 2.8.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.8.1](https://github.com/rtorcato/js-common/compare/v2.8.0...v2.8.1) (2026-06-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **docs:** broken links + sidebar + module summaries ([#70](https://github.com/rtorcato/js-common/issues/70)) ([539923a](https://github.com/rtorcato/js-common/commit/539923addefa80c7564facce87d3664226d9fb75)), closes [#0a0e16](https://github.com/rtorcato/js-common/issues/0a0e16)
7
+
1
8
  # [2.8.0](https://github.com/rtorcato/js-common/compare/v2.7.0...v2.8.0) (2026-06-12)
2
9
 
3
10
 
@@ -22,5 +22,10 @@ export declare function maskEmail(email: string): string;
22
22
  * @returns The domain part of the email, or an empty string if invalid.
23
23
  */
24
24
  export declare function getEmailDomain(email: string): string;
25
+ /**
26
+ * Checks if an email address is from a free provider (e.g., gmail, yahoo, outlook).
27
+ * @param email The email address.
28
+ * @returns True if the email is from a free provider, false otherwise.
29
+ */
25
30
  export declare function isFreeEmailProvider(email: string): boolean;
26
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emails/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emails/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAaD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D"}
@@ -1,2 +1,2 @@
1
- export { logger } from './logger';
1
+ export * from './logger';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -1,3 +1,7 @@
1
1
  import pino from 'pino';
2
+ /**
3
+ * Pre-configured Pino logger — pretty-printed with colors in development, plain JSON
4
+ * at `info` level in production.
5
+ */
2
6
  export declare const logger: pino.Logger<never, boolean>;
3
7
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB,eAAO,MAAM,MAAM,6BAyBO,CAAA"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB;;;GAGG;AACH,eAAO,MAAM,MAAM,6BAyBO,CAAA"}
@@ -19,11 +19,14 @@ export declare function error(message: string): void;
19
19
  * @param message The info message.
20
20
  */
21
21
  export declare function info(message: string): void;
22
+ /**
23
+ * One of the four standard console methods used by `captureConsole`.
24
+ */
25
+ export type ConsoleLevel = 'log' | 'info' | 'warn' | 'error';
22
26
  /**
23
27
  * Captures all console output and returns a function to restore it.
24
28
  * @param callback Function to call with each log message.
25
29
  * @returns {() => void} Restore function.
26
30
  */
27
- export type ConsoleLevel = 'log' | 'info' | 'warn' | 'error';
28
31
  export declare function captureConsole(callback: (type: ConsoleLevel, ...args: unknown[]) => void): () => void;
29
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,OAAgB,GAAG,IAAI,CAIjG;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG3C;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;;GAIG;AAEH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACxD,MAAM,IAAI,CAgBZ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,OAAgB,GAAG,IAAI,CAIjG;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG3C;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACxD,MAAM,IAAI,CAgBZ"}
@@ -4592,14 +4592,28 @@ declare const mimeTypesInternal: {
4592
4592
  readonly compressible: null;
4593
4593
  };
4594
4594
  };
4595
+ /**
4596
+ * Union of every file extension string (e.g. `'pdf'`, `'png'`) present in the MIME-type database.
4597
+ */
4595
4598
  export type FileExtension = (typeof mimeTypesInternal)[keyof typeof mimeTypesInternal]['extensions'][number];
4599
+ /**
4600
+ * Union of every MIME type string (e.g. `'application/json'`) present in the database.
4601
+ */
4596
4602
  export type MimeType = keyof typeof mimeTypesInternal;
4597
4603
  type TypedMimeTypes = Record<MimeType, {
4598
4604
  source: string;
4599
4605
  extensions: FileExtension[];
4600
4606
  compressible: boolean | null;
4601
4607
  }>;
4608
+ /**
4609
+ * Full MIME-type database keyed by `MimeType`, with `source`, `extensions`, and
4610
+ * `compressible` metadata per entry.
4611
+ */
4602
4612
  export declare const mimeTypes: TypedMimeTypes;
4613
+ /**
4614
+ * Metadata record for a given `MimeType` — its `source`, associated `extensions`, and
4615
+ * `compressible` flag.
4616
+ */
4603
4617
  export type MimeValue = (typeof mimeTypes)[MimeType];
4604
4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,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAA"}
@@ -13,7 +13,13 @@
13
13
  */
14
14
  import type { FileExtension, MimeType } from './db.js';
15
15
  export * from './db.js';
16
+ /**
17
+ * Map from `MimeType` to its associated file extensions, populated from the database.
18
+ */
16
19
  export declare const extensions: Record<MimeType, FileExtension[]>;
20
+ /**
21
+ * Map from `FileExtension` to its canonical `MimeType`, populated from the database.
22
+ */
17
23
  export declare const types: Record<FileExtension, MimeType>;
18
24
  /**
19
25
  * Lookup the MIME type for a file path/extension.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mime-types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAOtD,cAAc,SAAS,CAAA;AAOvB,eAAO,MAAM,UAAU,EAAS,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAA;AACjE,eAAO,MAAM,KAAK,EAAS,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;AAK1D;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,swzBAalC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mime-types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAOtD,cAAc,SAAS,CAAA;AAOvB;;GAEG;AACH,eAAO,MAAM,UAAU,EAAS,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,KAAK,EAAS,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;AAK1D;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,swzBAalC"}
@@ -10,5 +10,10 @@ export declare function sanitizeString(str: string): string;
10
10
  * @returns True if the password is strong, false otherwise.
11
11
  */
12
12
  export declare function isStrongPassword(password: string): boolean;
13
+ /**
14
+ * Generates a cryptographically secure random token (hex string).
15
+ * @param length The number of bytes (not hex chars).
16
+ * @returns A random hex string.
17
+ */
13
18
  export declare function generateSecureToken(length?: number): string;
14
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI1D;AAQD,wBAAgB,mBAAmB,CAAC,MAAM,SAAK,GAAG,MAAM,CAEvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAK,GAAG,MAAM,CAEvD"}
@@ -1 +1 @@
1
- import"../chunks/chunk-ANN5UYCF.js";import{randomBytes as t}from"node:crypto";function n(r){return r.replace(/<script.*?>.*?<\/script>/gi,"").replace(/on\w+\s*=\s*(['"]).*?\1/gi,"")}function e(r){return/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]).{8,}$/.test(r)}function o(r=32){return t(r).toString("hex")}export{o as generateSecureToken,e as isStrongPassword,n as sanitizeString};
1
+ import"../chunks/chunk-ANN5UYCF.js";import{randomBytes as t}from"node:crypto";function e(r){return r.replace(/<script.*?>.*?<\/script>/gi,"").replace(/on\w+\s*=\s*(['"]).*?\1/gi,"")}function i(r){return/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]).{8,}$/.test(r)}function o(r=32){return t(r).toString("hex")}export{o as generateSecureToken,i as isStrongPassword,e as sanitizeString};
@@ -1,12 +1,29 @@
1
+ /**
2
+ * Successful branch of a `Result` — carries the value and a `null` error.
3
+ */
1
4
  export type Success<T> = {
2
5
  data: T;
3
6
  error: null;
4
7
  };
8
+ /**
9
+ * Error branch of a `Result` — carries a `null` value and an error of type `E`.
10
+ */
5
11
  export type Failure<E> = {
6
12
  data: null;
7
13
  error: E;
8
14
  };
15
+ /**
16
+ * Go-style discriminated union representing either a `Success<T>` or a `Failure<E>`,
17
+ * for async code that prefers explicit error returns over thrown exceptions.
18
+ */
9
19
  export type Result<T, E = Error> = Success<T> | Failure<E>;
20
+ /**
21
+ * Type guard that narrows a `Result` to its `Success` branch when the error is `null`.
22
+ */
10
23
  export declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
24
+ /**
25
+ * Run an async function and capture any thrown error into a `Result`, eliminating
26
+ * try/catch at the call site.
27
+ */
11
28
  export declare function tryCatch<T, E = Error>(fn: () => Promise<T>): Promise<Result<T, E>>;
12
29
  //# sourceMappingURL=trycatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trycatch.d.ts","sourceRoot":"","sources":["../../src/try/trycatch.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAA;AAEjD,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAA;AAEjD,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,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json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtorcato/js-common",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "JavaScript and TypeScript common code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",