@rtorcato/js-common 2.7.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 +14 -0
- package/dist/date/index.d.ts +43 -17
- package/dist/date/index.d.ts.map +1 -1
- package/dist/date/index.js +1 -1
- package/dist/emails/index.d.ts +5 -0
- package/dist/emails/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/logger.d.ts +4 -0
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logging/index.d.ts +4 -1
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/mime-types/db.d.ts +14 -0
- package/dist/mime-types/db.d.ts.map +1 -1
- package/dist/mime-types/index.d.ts +6 -0
- package/dist/mime-types/index.d.ts.map +1 -1
- package/dist/security/index.d.ts +5 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -1
- package/dist/try/trycatch.d.ts +17 -0
- package/dist/try/trycatch.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
8
|
+
# [2.8.0](https://github.com/rtorcato/js-common/compare/v2.7.0...v2.8.0) (2026-06-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **docs:** landing + footer design handoff ([#69](https://github.com/rtorcato/js-common/issues/69)) ([1e5a0d3](https://github.com/rtorcato/js-common/commit/1e5a0d3642033390c5c67cbf0df4a8116e40df76)), closes [#0a0e16](https://github.com/rtorcato/js-common/issues/0a0e16)
|
|
14
|
+
|
|
1
15
|
# [2.7.0](https://github.com/rtorcato/js-common/compare/v2.6.0...v2.7.0) (2026-06-12)
|
|
2
16
|
|
|
3
17
|
|
package/dist/date/index.d.ts
CHANGED
|
@@ -1,44 +1,70 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns today's date as a YYYY-MM-DD string.
|
|
3
|
-
* @returns {string}
|
|
4
3
|
*/
|
|
5
4
|
export declare function today(): string;
|
|
6
5
|
/**
|
|
7
|
-
* Returns a Date object from a YYYY-MM-DD string.
|
|
8
|
-
* @param dateStr The date string.
|
|
9
|
-
* @returns {Date}
|
|
6
|
+
* Returns a Date object from a YYYY-MM-DD string (parsed as local time).
|
|
10
7
|
*/
|
|
11
8
|
export declare function parseDate(dateStr: string): Date;
|
|
12
9
|
/**
|
|
13
|
-
* Formats a Date object as YYYY-MM-DD.
|
|
14
|
-
* @param date The Date object.
|
|
15
|
-
* @returns {string}
|
|
10
|
+
* Formats a Date object as YYYY-MM-DD (UTC).
|
|
16
11
|
*/
|
|
17
12
|
export declare function formatDate(date: Date): string;
|
|
18
13
|
/**
|
|
19
14
|
* Returns the difference in days between two dates (date2 - date1).
|
|
20
|
-
* @param date1 The first date (string or Date).
|
|
21
|
-
* @param date2 The second date (string or Date).
|
|
22
|
-
* @returns {number}
|
|
23
15
|
*/
|
|
24
16
|
export declare function daysBetween(date1: string | Date, date2: string | Date): number;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the difference in hours between two dates (date2 - date1).
|
|
19
|
+
*/
|
|
20
|
+
export declare function diffInHours(date1: string | Date, date2: string | Date): number;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the difference in minutes between two dates (date2 - date1).
|
|
23
|
+
*/
|
|
24
|
+
export declare function diffInMinutes(date1: string | Date, date2: string | Date): number;
|
|
25
25
|
/**
|
|
26
26
|
* Checks if a year is a leap year.
|
|
27
|
-
* @param year The year (number or Date).
|
|
28
|
-
* @returns {boolean}
|
|
29
27
|
*/
|
|
30
28
|
export declare function isLeapYear(year: number | Date): boolean;
|
|
31
29
|
/**
|
|
32
30
|
* Adds days to a date and returns a new Date object.
|
|
33
|
-
* @param date The date (string or Date).
|
|
34
|
-
* @param days Number of days to add.
|
|
35
|
-
* @returns {Date}
|
|
36
31
|
*/
|
|
37
32
|
export declare function addDays(date: string | Date, days: number): Date;
|
|
33
|
+
/**
|
|
34
|
+
* Subtracts days from a date and returns a new Date object.
|
|
35
|
+
*/
|
|
36
|
+
export declare function subDays(date: string | Date, days: number): Date;
|
|
37
|
+
/**
|
|
38
|
+
* Adds months to a date and returns a new Date object.
|
|
39
|
+
*/
|
|
40
|
+
export declare function addMonths(date: string | Date, months: number): Date;
|
|
38
41
|
/**
|
|
39
42
|
* Returns the day of the week for a date (0=Sunday, 6=Saturday).
|
|
40
|
-
* @param date The date (string or Date).
|
|
41
|
-
* @returns {number}
|
|
42
43
|
*/
|
|
43
44
|
export declare function getDayOfWeek(date: string | Date): number;
|
|
45
|
+
/**
|
|
46
|
+
* Returns a new Date set to the start of the day (00:00:00.000) in local time.
|
|
47
|
+
*/
|
|
48
|
+
export declare function startOfDay(date: string | Date): Date;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a new Date set to the end of the day (23:59:59.999) in local time.
|
|
51
|
+
*/
|
|
52
|
+
export declare function endOfDay(date: string | Date): Date;
|
|
53
|
+
/**
|
|
54
|
+
* Returns true if the date falls on Saturday or Sunday.
|
|
55
|
+
*/
|
|
56
|
+
export declare function isWeekend(date: string | Date): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Returns true if the two dates fall on the same calendar day (local time).
|
|
59
|
+
*/
|
|
60
|
+
export declare function isSameDay(date1: string | Date, date2: string | Date): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Returns true if the date is today (local time).
|
|
63
|
+
*/
|
|
64
|
+
export declare function isToday(date: string | Date): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Formats a date as a short relative string: "today", "yesterday", "tomorrow",
|
|
67
|
+
* "N days ago", or "in N days". Compared against `now` (defaults to current time).
|
|
68
|
+
*/
|
|
69
|
+
export declare function formatRelative(date: string | Date, now?: Date): string;
|
|
44
70
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/date/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,wBAAgB,KAAK,IAAI,MAAM,CAE9B;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE9E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE9E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEhF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAI/D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE/D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAInE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAIpD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAIlD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAGtD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAQ7E;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEpD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,GAAE,IAAiB,GAAG,MAAM,CAQlF"}
|
package/dist/date/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function n(t){return typeof t=="string"?s(t):new Date(t)}function c(){return new Date().toISOString().slice(0,10)}function s(t){return new Date(`${t}T00:00:00`)}function f(t){return t.toISOString().slice(0,10)}function M(t,e){return Math.floor((n(e).getTime()-n(t).getTime())/864e5)}function d(t,e){return Math.floor((n(e).getTime()-n(t).getTime())/36e5)}function _(t,e){return Math.floor((n(e).getTime()-n(t).getTime())/6e4)}function m(t){let e=t instanceof Date?t.getUTCFullYear():t;return e%4===0&&e%100!==0||e%400===0}function u(t,e){let r=n(t);return r.setDate(r.getDate()+e),r}function p(t,e){return u(t,-e)}function S(t,e){let r=n(t);return r.setMonth(r.getMonth()+e),r}function D(t){return n(t).getDay()}function i(t){let e=n(t);return e.setHours(0,0,0,0),e}function x(t){let e=n(t);return e.setHours(23,59,59,999),e}function y(t){let e=D(t);return e===0||e===6}function g(t,e){let r=n(t),a=n(e);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()&&r.getDate()===a.getDate()}function E(t){return g(n(t),new Date)}function b(t,e=new Date){let r=i(n(t)),a=i(e),o=Math.round((r.getTime()-a.getTime())/864e5);return o===0?"today":o===1?"tomorrow":o===-1?"yesterday":o>0?`in ${o} days`:`${-o} days ago`}export{u as addDays,S as addMonths,M as daysBetween,d as diffInHours,_ as diffInMinutes,x as endOfDay,f as formatDate,b as formatRelative,D as getDayOfWeek,m as isLeapYear,g as isSameDay,E as isToday,y as isWeekend,s as parseDate,i as startOfDay,p as subDays,c as today};
|
package/dist/emails/index.d.ts
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
package/dist/logger/logger.d.ts
CHANGED
|
@@ -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"}
|
package/dist/logging/index.d.ts
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/mime-types/db.d.ts
CHANGED
|
@@ -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
4618
|
export {};
|
|
4605
4619
|
//# sourceMappingURL=db.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/mime-types/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAiB,CAAA;AAErD,KAAK,cAAc,GAAG,MAAM,CAC3B,QAAQ,EACR;IACC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,YAAY,EAAE,OAAO,GAAG,IAAI,CAAA;CAC5B,CACD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAmC,cAAc,CAAA;AAEvE;;;GAGG;AACH,MAAM,MAAM,SAAS,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;
|
|
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"}
|
package/dist/security/index.d.ts
CHANGED
|
@@ -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":"
|
|
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"}
|
package/dist/security/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";import{randomBytes as t}from"node:crypto";function
|
|
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};
|
package/dist/try/trycatch.d.ts
CHANGED
|
@@ -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,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