@kikiutils/shared 18.2.0 → 19.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/README.md +0 -7
- package/dist/buffer.d.ts +0 -2
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +1 -2
- package/dist/classes/enhanced-date.d.ts +0 -2
- package/dist/classes/enhanced-date.d.ts.map +1 -1
- package/dist/classes/enhanced-date.js +1 -2
- package/dist/classes/path.d.ts +2 -3
- package/dist/classes/path.d.ts.map +1 -1
- package/dist/classes/path.js +1 -2
- package/dist/classes/precision-number.d.ts +0 -2
- package/dist/classes/precision-number.d.ts.map +1 -1
- package/dist/classes/precision-number.js +1 -2
- package/dist/clipboard.d.ts +1 -2
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js +1 -2
- package/dist/crypto-hash.d.ts +0 -2
- package/dist/crypto-hash.d.ts.map +1 -1
- package/dist/crypto-hash.js +1 -2
- package/dist/datetime.d.ts +0 -2
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +1 -2
- package/dist/element-plus.d.ts +0 -2
- package/dist/element-plus.d.ts.map +1 -1
- package/dist/element-plus.js +1 -2
- package/dist/enum.d.ts +0 -2
- package/dist/enum.d.ts.map +1 -1
- package/dist/enum.js +1 -2
- package/dist/env.d.ts +0 -2
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -2
- package/dist/event-awaiter.d.ts +0 -2
- package/dist/event-awaiter.d.ts.map +1 -1
- package/dist/event-awaiter.js +1 -2
- package/dist/file.d.ts +25 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/file.js +30 -0
- package/dist/file.js.map +1 -0
- package/dist/general.d.ts +0 -2
- package/dist/general.d.ts.map +1 -1
- package/dist/general.js +1 -2
- package/dist/hash.d.ts +0 -2
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +1 -2
- package/dist/logger/_internals/formatter.d.ts +13 -0
- package/dist/logger/_internals/formatter.d.ts.map +1 -0
- package/dist/logger/_internals/formatter.js +57 -0
- package/dist/logger/_internals/formatter.js.map +1 -0
- package/dist/logger/_internals/levels.d.ts +54 -0
- package/dist/logger/_internals/levels.d.ts.map +1 -0
- package/dist/logger/_internals/levels.js +59 -0
- package/dist/logger/_internals/levels.js.map +1 -0
- package/dist/logger/_internals/logger.d.ts +12 -0
- package/dist/logger/_internals/logger.d.ts.map +1 -0
- package/dist/logger/_internals/logger.js +147 -0
- package/dist/logger/_internals/logger.js.map +1 -0
- package/dist/logger/_internals/types.d.ts +12 -0
- package/dist/logger/_internals/types.d.ts.map +1 -0
- package/dist/logger/_internals/types.js +1 -0
- package/dist/logger/index.d.ts +10 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +25 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/node/_internals/file-writer.d.ts +11 -0
- package/dist/logger/node/_internals/file-writer.d.ts.map +1 -0
- package/dist/logger/node/_internals/file-writer.js +188 -0
- package/dist/logger/node/_internals/file-writer.js.map +1 -0
- package/dist/logger/node/_internals/formatter.d.ts +4 -0
- package/dist/logger/node/_internals/formatter.d.ts.map +1 -0
- package/dist/logger/node/_internals/formatter.js +21 -0
- package/dist/logger/node/_internals/formatter.js.map +1 -0
- package/dist/logger/node/index.d.ts +10 -0
- package/dist/logger/node/index.d.ts.map +1 -0
- package/dist/logger/node/index.js +122 -0
- package/dist/logger/node/index.js.map +1 -0
- package/dist/logger/node/types.d.ts +43 -0
- package/dist/logger/node/types.d.ts.map +1 -0
- package/dist/logger/node/types.js +1 -0
- package/dist/logger/types.d.ts +49 -0
- package/dist/logger/types.d.ts.map +1 -0
- package/dist/logger/types.js +1 -0
- package/dist/math.d.ts +1 -2
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +1 -2
- package/dist/number.d.ts +0 -2
- package/dist/number.d.ts.map +1 -1
- package/dist/number.js +1 -2
- package/dist/random.d.ts +0 -2
- package/dist/random.d.ts.map +1 -1
- package/dist/random.js +1 -2
- package/dist/redis/script-runner.d.ts +0 -2
- package/dist/redis/script-runner.d.ts.map +1 -1
- package/dist/redis/script-runner.js +1 -2
- package/dist/storages/lru/keyed-store.d.ts +2 -2
- package/dist/storages/lru/keyed-store.d.ts.map +1 -1
- package/dist/storages/lru/keyed-store.js +6 -3
- package/dist/storages/lru/keyed-store.js.map +1 -1
- package/dist/storages/redis/keyed-store.d.ts +0 -2
- package/dist/storages/redis/keyed-store.d.ts.map +1 -1
- package/dist/storages/redis/keyed-store.js +1 -2
- package/dist/storages/redis/msgpack.d.ts +0 -2
- package/dist/storages/redis/msgpack.d.ts.map +1 -1
- package/dist/storages/redis/msgpack.js +1 -2
- package/dist/storages/redis/types.d.ts +0 -2
- package/dist/storages/redis/types.d.ts.map +1 -1
- package/dist/string.d.ts +0 -2
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +1 -2
- package/dist/time.d.ts +0 -2
- package/dist/time.d.ts.map +1 -1
- package/dist/time.js +1 -2
- package/dist/types/filtered-key-path.d.ts +1 -2
- package/dist/types/filtered-key-path.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -10
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/vue.d.ts +0 -2
- package/dist/types/vue.d.ts.map +1 -1
- package/dist/url.d.ts +0 -2
- package/dist/url.d.ts.map +1 -1
- package/dist/url.js +1 -2
- package/dist/vue.d.ts +0 -2
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +1 -2
- package/dist/web.d.ts +0 -2
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +1 -2
- package/package.json +78 -45
- package/src/file.ts +37 -0
- package/src/logger/_internals/formatter.ts +80 -0
- package/src/logger/_internals/levels.ts +60 -0
- package/src/logger/_internals/logger.ts +224 -0
- package/src/logger/_internals/types.ts +12 -0
- package/src/logger/index.ts +34 -0
- package/src/logger/node/_internals/file-writer.ts +298 -0
- package/src/logger/node/_internals/formatter.ts +33 -0
- package/src/logger/node/index.ts +175 -0
- package/src/logger/node/types.ts +58 -0
- package/src/logger/types.ts +59 -0
- package/src/storages/lru/keyed-store.ts +4 -0
- package/src/types/index.ts +0 -10
- package/dist/classes/ssh-client.d.ts +0 -39
- package/dist/classes/ssh-client.d.ts.map +0 -1
- package/dist/classes/ssh-client.js +0 -130
- package/dist/classes/ssh-client.js.map +0 -1
- package/dist/consola.d.ts +0 -24
- package/dist/consola.d.ts.map +0 -1
- package/dist/consola.js +0 -29
- package/dist/consola.js.map +0 -1
- package/dist/object.d.ts +0 -44
- package/dist/object.d.ts.map +0 -1
- package/dist/object.js +0 -59
- package/dist/object.js.map +0 -1
- package/dist/pino.d.ts +0 -25
- package/dist/pino.d.ts.map +0 -1
- package/dist/pino.js +0 -34
- package/dist/pino.js.map +0 -1
- package/src/classes/ssh-client.ts +0 -175
- package/src/consola.ts +0 -25
- package/src/object.ts +0 -78
- package/src/pino.ts +0 -33
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@ A lightweight, modular TypeScript utility library for Node.js and browser projec
|
|
|
16
16
|
- 🔁 General helpers — normalize single-or-array values with `extractFirstValue`.
|
|
17
17
|
- 🧬 Binary helpers — convert `Blob`, `File`, `ArrayBuffer`, `Uint8Array`, and `Buffer` to Node `Buffer`.
|
|
18
18
|
- 🔒 Hashing helpers — SHA-3 helpers for universal usage and Node `crypto` MD5/SHA-3 helpers.
|
|
19
|
-
- 📜 Logging helpers — preconfigured Consola and Pino logger instances with env-based levels.
|
|
20
19
|
- 📅 Date helpers — format dates and compute common ranges such as today, this week, and last month.
|
|
21
20
|
- 🔢 Number and math helpers — compact number display, precise percentages, and fixed-decimal arithmetic.
|
|
22
21
|
- 🔤 String/random helpers — random strings and randomized-length value generation.
|
|
@@ -52,7 +51,6 @@ You can also use `npm`, `yarn`, or `bun`.
|
|
|
52
51
|
Import individual modules to keep dependency usage explicit:
|
|
53
52
|
|
|
54
53
|
```typescript
|
|
55
|
-
import { logger } from '@kikiutils/shared/consola';
|
|
56
54
|
import { extractFirstValue } from '@kikiutils/shared/general';
|
|
57
55
|
|
|
58
56
|
const value = extractFirstValue([
|
|
@@ -69,7 +67,6 @@ logger.info(value); // 0
|
|
|
69
67
|
| --- | --- | --- | --- |
|
|
70
68
|
| `buffer` | Node/browser-compatible inputs, Node output | `toBuffer` | Convert `Blob`, `File`, `ArrayBuffer`, `Uint8Array`, or `Buffer` to Node `Buffer`. |
|
|
71
69
|
| `clipboard` | Browser | `copyTextToClipboard`, `copyBlobToClipboard` | Safe result wrappers around the modern Clipboard API. |
|
|
72
|
-
| `consola` | Node/browser | `consolaLogger`, `logger` | Shared Consola instance with env-based log level. |
|
|
73
70
|
| `crypto-hash` | Node | `cryptoMd5`, `cryptoSha3*`, `*ToBuffer` | Node `crypto` MD5/SHA-3 helpers with text or raw-buffer output. |
|
|
74
71
|
| `datetime` | Node/browser | `formatDate`, `getDateRangeFromDate`, `getMidnightDateFromToday` | Date formatting and common date-range calculations via `date-fns`. |
|
|
75
72
|
| `element-plus` | Vue/browser | `createElFormItemRuleWithDefaults` | Create Element Plus form rules with default `required`, `trigger`, and `type`. |
|
|
@@ -80,8 +77,6 @@ logger.info(value); // 0
|
|
|
80
77
|
| `hash` | Any | `sha3224`, `sha3256`, `sha3384`, `sha3512` | SHA-3 helpers backed by `@noble/hashes`; returns hex strings. |
|
|
81
78
|
| `math` | Any | `toPercentageString` | Precise percentage strings using `decimal.js`. |
|
|
82
79
|
| `number` | Any | `toCompactNumberString` | Compact display strings using `millify`. |
|
|
83
|
-
| `object` | Any | `stringifyObjectDeterministically` | Stable flattened object serialization for signatures/cache keys. |
|
|
84
|
-
| `pino` | Node | `pinoLogger`, `logger` | Shared Pino logger with pretty output and env-based level. |
|
|
85
80
|
| `random` | Any | `generateWithNestedRandomLength` | Generate values with a two-step randomized length. |
|
|
86
81
|
| `string` | Any | `randomString` | Random strings from preset character sets. |
|
|
87
82
|
| `time` | Any | `abortableDelay` | Promise delay that resolves early on abort. |
|
|
@@ -158,8 +153,6 @@ Most modules are tiny wrappers around platform APIs or optional peers. If your p
|
|
|
158
153
|
| `element-plus` | `async-validator`, `element-plus` |
|
|
159
154
|
| `classes/precision-number`, `math` | `decimal.js` |
|
|
160
155
|
| `number` | `millify` |
|
|
161
|
-
| `consola` | `consola` |
|
|
162
|
-
| `pino` | `pino`, `pino-pretty` |
|
|
163
156
|
| `storages/lru/keyed-store` | `lru-cache` |
|
|
164
157
|
| `storages/redis/msgpack` | `msgpackr` |
|
|
165
158
|
| `vue` | `vue`, `vue-router` |
|
package/dist/buffer.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BinaryInput } from "./types/index.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
|
-
//#region src/buffer.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Converts binary input to a Node.js `Buffer`.
|
|
6
5
|
*
|
|
@@ -31,5 +30,4 @@ import { Buffer } from "node:buffer";
|
|
|
31
30
|
* ```
|
|
32
31
|
*/
|
|
33
32
|
export declare function toBuffer(input: BinaryInput): Promise<Buffer<ArrayBufferLike>>;
|
|
34
|
-
//#endregion
|
|
35
33
|
//# sourceMappingURL=buffer.d.ts.map
|
package/dist/buffer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiCsB,SAAS,OAAO,cAAW,QAAA,OAAA"}
|
package/dist/buffer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
|
-
|
|
2
|
+
// src/buffer.ts
|
|
3
3
|
/**
|
|
4
4
|
* Converts binary input to a Node.js `Buffer`.
|
|
5
5
|
*
|
|
@@ -36,7 +36,6 @@ async function toBuffer(input) {
|
|
|
36
36
|
if (typeof input.arrayBuffer === "function") return Buffer.from(await input.arrayBuffer());
|
|
37
37
|
throw new TypeError("The provided input is not a supported binary type (Blob, Buffer, File, ArrayBuffer, or Uint8Array).");
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { toBuffer };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=buffer.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as dateFns from "date-fns";
|
|
2
|
-
//#region src/classes/enhanced-date.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* A mutable calendar date with chainable date-fns operations.
|
|
5
4
|
*
|
|
@@ -453,5 +452,4 @@ export declare class EnhancedDate extends Date {
|
|
|
453
452
|
*/
|
|
454
453
|
toSubYears(amount: number): EnhancedDate;
|
|
455
454
|
}
|
|
456
|
-
//#endregion
|
|
457
455
|
//# sourceMappingURL=enhanced-date.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhanced-date.d.ts","names":[],"sources":["../../src/classes/enhanced-date.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"enhanced-date.d.ts","names":[],"sources":["../../src/classes/enhanced-date.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+Ba,qBAAqB;;;;SAMvB,cAAU;;;;SAOV,iBAAa;;;;SAOb,kBAAc;;;;;;;;;;;SAcd,WACH,eACA,iBACA,eAAe,QAAQ,QAAQ,OAC/B,UAAU,QAAQ,eAAY;;;;;;;;;SAa3B,QAAQ,eAAe,UAAU,QAAQ,kBAAe;;;;;;SASxD,gBAAgB,kBAAe;;;;;;;;SAW/B,IAAI,QAAQ,mBAAgB;;;;;;;;SAW5B,IAAI,QAAQ,mBAAgB;;;;SAO5B,gBAAY;;;;SAOZ,mBAAe;;;;SAOf,oBAAgB;;;;;;;;EAavB,QAAQ;;;;;;;;EAYR,SAAS;;;;;;;;EAYT,gBAAgB;;;;;;;;EAYhB,WAAW;;;;;;;;EAYX,UAAU;;;;;;;;EAYV,WAAW;;;;;;;;EAYX,SAAS;;;;;;;;EAYT,SAAS;;;;EAQT,SAAK;;;;;;;EAUL,yBAAyB,OAAO,QAAQ,QAAQ;;;;;;;EAUhD,0BAA0B,OAAO,QAAQ,QAAQ,OAAO,UAAU,QAAQ;;;;;;;EAU1E,oBAAoB,OAAO,QAAQ,QAAQ,OAAO,UAAU,QAAQ;;;;;;EASpE;;;;;;EAUA;;;;;;EAUA;;;;;;;;EAYA,UAAU,UAAU,QAAQ;;;;;;;EAW5B,OAAO,kBAAyC,UAAU,QAAQ;;;;EAOlE,oBAAoB,UAAU,QAAQ;;;;EAOtC;;;;EAOA,QAAQ,OAAO,QAAQ,QAAQ;;;;EAO/B,SAAS,OAAO,QAAQ,QAAQ;;;;EAOhC,QAAQ,OAAO,QAAQ,QAAQ;;;;EAO/B;;;;EAOA,UAAU,OAAO,QAAQ,QAAQ;;;;EAOjC,aAAa,OAAO,QAAQ,QAAQ;;;;EAOpC;;;;EAOA;;;;EAOA;;;;;;EASA;;;;;;EAUA;;;;;;EAUA;;;;;;;;EAYA,YAAY,UAAU,QAAQ;;;;;;;;EAY9B,QAAQ;;;;;;;;EAYR,SAAS;;;;;;;;EAYT,gBAAgB;;;;;;;;EAYhB,WAAW;;;;;;;;EAYX,UAAU;;;;;;;;EAYV,WAAW;;;;;;;;EAYX,SAAS;;;;;;;;EAYT,SAAS;;;;EAQT,UAAU,iBAAc;;;;EAOxB,WAAW,iBAAc;;;;EAOzB,kBAAkB,iBAAc;;;;EAOhC,aAAa,iBAAc;;;;EAO3B,YAAY,iBAAc;;;;EAO1B,aAAa,iBAAc;;;;EAO3B,WAAW,iBAAc;;;;EAOzB,WAAW,iBAAc;;;;EAOzB,UAAM;;;;EAON,cAAU;;;;EAOV,iBAAa;;;;EAOb,gBAAY;;;;EAOZ,YAAY,UAAU,QAAQ,mBAAgB;;;;EAO9C,gBAAY;;;;EAOZ,mBAAe;;;;EAOf,kBAAc;;;;EAOd,cAAc,UAAU,QAAQ,qBAAkB;;;;EAOlD,UAAU,iBAAc;;;;EAOxB,WAAW,iBAAc;;;;EAOzB,kBAAkB,iBAAc;;;;EAOhC,aAAa,iBAAc;;;;EAO3B,YAAY,iBAAc;;;;EAO1B,aAAa,iBAAc;;;;EAO3B,WAAW,iBAAc;;;;EAOzB,WAAW,iBAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as dateFns from "date-fns";
|
|
2
|
-
|
|
2
|
+
// src/classes/enhanced-date.ts
|
|
3
3
|
/**
|
|
4
4
|
* A mutable calendar date with chainable date-fns operations.
|
|
5
5
|
*
|
|
@@ -629,7 +629,6 @@ var EnhancedDate = class EnhancedDate extends Date {
|
|
|
629
629
|
return this.clone().subYears(amount);
|
|
630
630
|
}
|
|
631
631
|
};
|
|
632
|
-
//#endregion
|
|
633
632
|
export { EnhancedDate };
|
|
634
633
|
|
|
635
634
|
//# sourceMappingURL=enhanced-date.js.map
|
package/dist/classes/path.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
import * as fsp from "node:fs/promises";
|
|
3
3
|
import * as nodePath from "node:path";
|
|
4
|
-
import { Abortable } from "node:events";
|
|
5
4
|
import * as fs from "node:fs";
|
|
6
|
-
|
|
5
|
+
import { Abortable } from "node:events";
|
|
7
6
|
type DropFirstParameters<T extends (...args: any) => any> = Parameters<T> extends [any, ...infer R] ? R : never;
|
|
8
7
|
/**
|
|
9
8
|
* Values accepted by the `Path` constructor and path-composition methods.
|
|
@@ -359,5 +358,5 @@ export declare class Path {
|
|
|
359
358
|
*/
|
|
360
359
|
writeFile(...args: DropFirstParameters<typeof fsp.writeFile>): Promise<void>;
|
|
361
360
|
}
|
|
362
|
-
|
|
361
|
+
export {};
|
|
363
362
|
//# sourceMappingURL=path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","names":[],"sources":["../../src/classes/path.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"path.d.ts","names":[],"sources":["../../src/classes/path.ts"],"mappings":";;;;;KAMK,oBAAoB,cAAc,qBAAqB,WAAW,0BAA0B,KAAK;;;;YAK1F,WAAW,GAAG,WAAW;;;;;;;;;;qBAWxB;;;;;;;EAWG,eAAG,OAAO;;;;;;MAoBlB,UAAM;;;;MAON;;;;;;;;;;SAeG,OAAO,YAAY,SAAS,wBAAqB;;;;;;;;;;;;;;SAiBjD,WAAW,OAAO,aAAU;GASlC,OAAO,aAAa;;;;;;;;EAYrB,SAAS;;;;;;;;EAWT,WAAO;;;;;;;;EAWP;;;;;;;;EAWA;;;;;;;;EAWA,aAAS;;;;;;;;;;EAaT,QAAQ,OAAO,aAAU;;;;;;;;EAWzB,SAAK,SAAA;;;;;;;;;;EAaL,SAAS,IAAI,WAAQ;;;;;;;;;;;EAcrB,WAAO;EAIP;;;;;;;;;EAYA;;;;EAOA;;;;;;;;;EAYA,UAAU,MAAM,2BAA2B,IAAI,UAAO;;;;;;;;;EAYtD,cAAc,MAAM,2BAA2B,IAAI,cAAW;;;;;;;;;EAY9D,SAAS,MAAM,2BAA2B,IAAI,SAAM;;;;;;;;;EAYpD,SAAS,MAAM,2BAA2B,IAAI,SAAM;;;;;;;;;EAYpD,YAAY,MAAM,2BAA2B,IAAI,YAAS;;;;;;;;;;EAa1D,MAAM,SAAS,GAAG;IAAyB;MAAoB;EAC/D,MACI,WACK,GAAG;IAAyB;OAC7B,GAAG,cAER;EACH,MAAM,UAAU,GAAG,uBAAuB,GAAG,cAAc;;;;;;;;;EAa3D,QAAQ,MAAM,2BAA2B,IAAI,QAAK,QAAA,GAAA,SAAA;;;;;;;;;EAYlD,QACI,UACI,kBACC,GAAG;IACF;IACA;cAGP;EACH,QACI;IAGM;IACA;IACA;MAEP,QAAQ;EACX,QACI,UACI,kBACC,GAAG;IACF;IACA;cAGP,QAAQ;EACX,QACI,SAAS,GAAG;IACR;IACA;MAEL,QAAQ,GAAG;EACd,QACI;IACI;IACA;IACA;MAEL,QAAQ,GAAG,OAAO;;;;;;;;;EAarB,SACI,WACK;IACC;IACA,OAAO,GAAG;cAGjB,QAAQ;EACX,SACI,UACK;IACC,UAAU;IACV,OAAO,GAAG;OAEZ,iBACL;EACH,SACI,WAEQ,YACA,GAAG;IACD,OAAO,GAAG;OAEd,wBAEP,QAAQ;;;;;;;;;;;EAeX,OAAO,SAAS,WAAQ;;;;;;;;;EAYxB,MAAM,MAAM,2BAA2B,IAAI,MAAG;;;;;;;;;EAY9C,SAAS,MAAM,2BAA2B,IAAI,SAAM;;;;;;;;;;EAapD,KACI,OAAO,GAAG;IACN;IACA;MAEL,QAAQ,GAAG;EACd,KACI,MAAM,GAAG;IACL;IACA;MAEL,QAAQ,GAAG;EACd,KACI,MAAM,GAAG;IACL;IACA;MAEL,QAAQ,GAAG;EACd,KACI,MAAM,GAAG;IACL;IACA;MAEL,QAAQ,GAAG;EACd,KAAK,MAAM,GAAG;IAAgB;MAA0B,QAAQ,GAAG,cAAc,GAAG;EACpF,KAAK,OAAO,GAAG,cAAc,QAAQ,GAAG,cAAc,GAAG;;;;;;;;;EAwBzD,YAAY,MAAM,2BAA2B,IAAI,YAAS;;;;;;;;;EAY1D,UAAM;;;;;;;;;EAYN,aAAa,MAAM,2BAA2B,IAAI,aAAU"}
|
package/dist/classes/path.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fsp from "node:fs/promises";
|
|
2
2
|
import * as nodePath from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/classes/path.ts
|
|
4
4
|
/**
|
|
5
5
|
* An immutable file system path with Node.js path and file operations.
|
|
6
6
|
*
|
|
@@ -344,7 +344,6 @@ var Path = class Path {
|
|
|
344
344
|
return fsp.writeFile(this.#value, ...args);
|
|
345
345
|
}
|
|
346
346
|
};
|
|
347
|
-
//#endregion
|
|
348
347
|
export { Path };
|
|
349
348
|
|
|
350
349
|
//# sourceMappingURL=path.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Decimal } from "decimal.js";
|
|
2
|
-
//#region src/classes/precision-number.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Values accepted by `PrecisionNumber` constructors and arithmetic methods.
|
|
5
4
|
*/
|
|
@@ -262,5 +261,4 @@ export declare class PrecisionNumber {
|
|
|
262
261
|
*/
|
|
263
262
|
toTimes(value: PrecisionNumberValue): PrecisionNumber;
|
|
264
263
|
}
|
|
265
|
-
//#endregion
|
|
266
264
|
//# sourceMappingURL=precision-number.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precision-number.d.ts","names":[],"sources":["../../src/classes/precision-number.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"precision-number.d.ts","names":[],"sources":["../../src/classes/precision-number.ts"],"mappings":";;;;YAKY,uBAAuB,QAAQ,QAAQ;EAAoB;;;;;;;;;;;;;;;;;;;;;;;;qBAwB1D;;;;;;;;;EAgBL,YAAA,QAAO,sBACP,wBACA,WAAU,QAAQ;;;;MAqBlB;;;;MAOA,YAAQ,QAAA;;;;MAOR;;;;;;;;;;SAeG,QACH,OAAO,sBACP,wBACA,WAAU,QAAQ;;;;;;GAmBrB,OAAO,aAAa;;;;;;EAUrB;;;;;;;;;EAaA;;;;;;;;;;;EAeA,MAAM,KAAK,sBAAsB,KAAK;;;;EAWtC,SAAK;;;;;;;;EAWL,UAAU,OAAO;;;;;;;;EAYjB,OAAO,OAAO;;;;;;;;;EAYd;;;;EAQA,GAAG,OAAO;;;;EAOV,IAAI,OAAO;;;;EAOX;;;;EAOA;;;;EAOA;;;;EAOA;;;;EAOA;;;;EAOA;;;;EAOA,GAAG,OAAO;;;;EAOV,IAAI,OAAO;;;;EAOX,MAAM,OAAO;;;;;;;;EAYb,OAAO,OAAO;;;;EAQd;;;;EAQA,KAAK,OAAO;;;;;;;;EAYZ,IAAI,OAAO;;;;EAQX,MAAM,OAAO;;;;EAQb,mBAAe;;;;EAOf,UAAM;;;;;;;;;EAYN,UAAU,KAAK,sBAAsB,KAAK,uBAAoB;;;;EAO9D,YAAY,OAAO,uBAAoB;;;;EAWvC,WAAO;;;;EAOP;;;;EAOA,QAAQ,OAAO,uBAAoB;;;;EAWnC,SAAS,OAAO,uBAAoB;;;;EAWpC,aAAS;;;;EAOT,OAAO,OAAO,uBAAoB;;;;EAOlC,MAAM,OAAO,uBAAoB;;;;;;;EAUjC;;;;EAOA;;;;EAOA,QAAQ,wBAA6C,WAAU,QAAQ;;;;EAOvE,QAAQ,OAAO,uBAAoB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decimal } from "decimal.js";
|
|
2
|
-
|
|
2
|
+
// src/classes/precision-number.ts
|
|
3
3
|
/**
|
|
4
4
|
* A fixed-decimal number with mutable and immutable arithmetic operations.
|
|
5
5
|
*
|
|
@@ -375,7 +375,6 @@ var PrecisionNumber = class PrecisionNumber {
|
|
|
375
375
|
return new PrecisionNumber(this.#decimal.times(this.#valueToString(value)), this.#decimalPlaces, this.#rounding);
|
|
376
376
|
}
|
|
377
377
|
};
|
|
378
|
-
//#endregion
|
|
379
378
|
export { PrecisionNumber };
|
|
380
379
|
|
|
381
380
|
//# sourceMappingURL=precision-number.js.map
|
package/dist/clipboard.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/clipboard.d.ts
|
|
2
1
|
type CopyResult = {
|
|
3
2
|
error: unknown;
|
|
4
3
|
ok: false;
|
|
@@ -61,5 +60,5 @@ export declare function copyBlobToClipboard(blob: Blob, options?: ClipboardItemO
|
|
|
61
60
|
* ```
|
|
62
61
|
*/
|
|
63
62
|
export declare function copyTextToClipboard(text: string): Promise<CopyResult>;
|
|
64
|
-
|
|
63
|
+
export {};
|
|
65
64
|
//# sourceMappingURL=clipboard.d.ts.map
|
package/dist/clipboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","names":[],"sources":["../src/clipboard.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","names":[],"sources":["../src/clipboard.ts"],"mappings":"A,KAAK;EACC;EAAgB;;EAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8BgB,oBAAoB,MAAM,MAAM,UAAU,uBAAuB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8CzE,oBAAoB,eAAe,QAAQ"}
|
package/dist/clipboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/clipboard.ts
|
|
2
2
|
/**
|
|
3
3
|
* Attempts to copy a blob to the browser clipboard.
|
|
4
4
|
*
|
|
@@ -80,7 +80,6 @@ async function copyTextToClipboard(text) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
//#endregion
|
|
84
83
|
export { copyBlobToClipboard, copyTextToClipboard };
|
|
85
84
|
|
|
86
85
|
//# sourceMappingURL=clipboard.js.map
|
package/dist/crypto-hash.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BinaryLike } from "node:crypto";
|
|
2
|
-
//#region src/crypto-hash.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Computes the MD5 hash of the given data.
|
|
5
4
|
*
|
|
@@ -165,5 +164,4 @@ export declare function cryptoSha3512(data: BinaryLike, outputEncoding?: BufferE
|
|
|
165
164
|
* ```
|
|
166
165
|
*/
|
|
167
166
|
export declare function cryptoSha3512ToBuffer(data: BinaryLike): NonSharedBuffer;
|
|
168
|
-
//#endregion
|
|
169
167
|
//# sourceMappingURL=crypto-hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-hash.d.ts","names":[],"sources":["../src/crypto-hash.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"crypto-hash.d.ts","names":[],"sources":["../src/crypto-hash.ts"],"mappings":";;;;;;;;;;;;;;;;;wBAoBgB,UAAU,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;;wBAmB5C,kBAAkB,MAAM,aAAU;;;;;;;;;;;;;;;;;wBAoBlC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;;wBAmBhD,sBAAsB,MAAM,aAAU;;;;;;;;;;;;;;;;;wBAoBtC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;;wBAmBhD,sBAAsB,MAAM,aAAU;;;;;;;;;;;;;;;;;wBAoBtC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;;wBAmBhD,sBAAsB,MAAM,aAAU;;;;;;;;;;;;;;;;;wBAoBtC,cAAc,MAAM,YAAY,iBAAgB;;;;;;;;;;;;;;;;wBAmBhD,sBAAsB,MAAM,aAAU"}
|
package/dist/crypto-hash.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
|
|
3
|
+
// src/crypto-hash.ts
|
|
4
4
|
/**
|
|
5
5
|
* Computes the MD5 hash of the given data.
|
|
6
6
|
*
|
|
@@ -189,7 +189,6 @@ function cryptoSha3512ToBuffer(data) {
|
|
|
189
189
|
function normalizeHashData(data) {
|
|
190
190
|
return typeof data === "string" || ArrayBuffer.isView(data) ? data : Buffer.from(data);
|
|
191
191
|
}
|
|
192
|
-
//#endregion
|
|
193
192
|
export { cryptoMd5, cryptoMd5ToBuffer, cryptoSha3224, cryptoSha3224ToBuffer, cryptoSha3256, cryptoSha3256ToBuffer, cryptoSha3384, cryptoSha3384ToBuffer, cryptoSha3512, cryptoSha3512ToBuffer };
|
|
194
193
|
|
|
195
194
|
//# sourceMappingURL=crypto-hash.js.map
|
package/dist/datetime.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EnhancedDate } from "./classes/enhanced-date.js";
|
|
2
2
|
import * as dateFns from "date-fns";
|
|
3
|
-
//#region src/datetime.d.ts
|
|
4
3
|
export type DateRangeType = 'lastMonth' | 'lastWeek' | 'thisMonth' | 'thisWeek' | 'today' | 'yesterday';
|
|
5
4
|
/**
|
|
6
5
|
* Formats a date using a date-fns pattern without changing the input.
|
|
@@ -67,5 +66,4 @@ export declare function getDateRangeFromDate(date: Date, type: DateRangeType, op
|
|
|
67
66
|
* @returns A new `EnhancedDate` at local midnight on the selected day.
|
|
68
67
|
*/
|
|
69
68
|
export declare function getMidnightDateFromToday(offsetDays?: number): EnhancedDate;
|
|
70
|
-
//#endregion
|
|
71
69
|
//# sourceMappingURL=datetime.d.ts.map
|
package/dist/datetime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","names":[],"sources":["../src/datetime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","names":[],"sources":["../src/datetime.ts"],"mappings":";;YAIY;;;;;;;;;;;;;;;;;;;;;;;wBAwBI,WACZ,MAAM,QAAQ,QAAQ,OACtB,iBACA,UAAU,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCN,qBACZ,MAAM,MACN,MAAM,eACN;EACI;EACA,eAAe,QAAQ;;;;;;;;;;;;wBA8Df,yBAAyB,sBAAsB"}
|
package/dist/datetime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EnhancedDate } from "./classes/enhanced-date.js";
|
|
2
2
|
import * as dateFns from "date-fns";
|
|
3
|
-
|
|
3
|
+
// src/datetime.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formats a date using a date-fns pattern without changing the input.
|
|
6
6
|
*
|
|
@@ -109,7 +109,6 @@ function getDateRangeFromDate(date, type, options) {
|
|
|
109
109
|
function getMidnightDateFromToday(offsetDays = 0) {
|
|
110
110
|
return new EnhancedDate().addDays(offsetDays).startOfDay();
|
|
111
111
|
}
|
|
112
|
-
//#endregion
|
|
113
112
|
export { formatDate, getDateRangeFromDate, getMidnightDateFromToday };
|
|
114
113
|
|
|
115
114
|
//# sourceMappingURL=datetime.js.map
|
package/dist/element-plus.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RuleType } from "async-validator";
|
|
2
2
|
import { FormItemRule } from "element-plus";
|
|
3
|
-
//#region src/element-plus.d.ts
|
|
4
3
|
export type DoNotRemoveOrUseThisType = RuleType;
|
|
5
4
|
/**
|
|
6
5
|
* Creates a new Element Plus form validation rule with overridable defaults.
|
|
@@ -26,5 +25,4 @@ export type DoNotRemoveOrUseThisType = RuleType;
|
|
|
26
25
|
* ```
|
|
27
26
|
*/
|
|
28
27
|
export declare function createElFormItemRuleWithDefaults(message: FormItemRule['message'], options?: FormItemRule): FormItemRule;
|
|
29
|
-
//#endregion
|
|
30
28
|
//# sourceMappingURL=element-plus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-plus.d.ts","names":[],"sources":["../src/element-plus.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"element-plus.d.ts","names":[],"sources":["../src/element-plus.ts"],"mappings":";;YAGY,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;wBAyBvB,iCACZ,SAAS,yBACT,UAAS,eACV"}
|
package/dist/element-plus.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/element-plus.ts
|
|
2
2
|
/**
|
|
3
3
|
* Creates a new Element Plus form validation rule with overridable defaults.
|
|
4
4
|
*
|
|
@@ -31,7 +31,6 @@ function createElFormItemRuleWithDefaults(message, options = {}) {
|
|
|
31
31
|
type: options.type ?? "string"
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { createElFormItemRuleWithDefaults };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=element-plus.js.map
|
package/dist/enum.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/enum.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Extracts only the numeric values from an enumeration-like object.
|
|
4
3
|
*
|
|
@@ -98,5 +97,4 @@ export declare function getEnumStringValues<T extends Record<string, any>>(enumO
|
|
|
98
97
|
* ```
|
|
99
98
|
*/
|
|
100
99
|
export declare function getEnumValues<T extends Record<string, any>>(enumObject: T): (T[keyof T])[];
|
|
101
|
-
//#endregion
|
|
102
100
|
//# sourceMappingURL=enum.d.ts.map
|
package/dist/enum.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","names":[],"sources":["../src/enum.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"enum.d.ts","names":[],"sources":["../src/enum.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;wBAwBgB,oBAAoB,UAAU,qBAAqB,YAAY,IAAI,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;wBA4BnF,oBAAoB,UAAU,qBAAqB,YAAY,IAAI,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAoDnF,cAAc,UAAU,qBAAqB,YAAY,KAAK,QAAQ"}
|
package/dist/enum.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/enum.ts
|
|
2
2
|
/**
|
|
3
3
|
* Extracts only the numeric values from an enumeration-like object.
|
|
4
4
|
*
|
|
@@ -106,7 +106,6 @@ function getEnumValues(enumObject) {
|
|
|
106
106
|
if (!values.some((value) => typeof value === "number")) return values;
|
|
107
107
|
return Object.keys(enumObject).filter((key) => Number.isNaN(Number(key))).map((key) => enumObject[key]);
|
|
108
108
|
}
|
|
109
|
-
//#endregion
|
|
110
109
|
export { getEnumNumberValues, getEnumStringValues, getEnumValues };
|
|
111
110
|
|
|
112
111
|
//# sourceMappingURL=enum.js.map
|
package/dist/env.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/env.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Custom error class for handling missing environment variables.
|
|
4
3
|
*
|
|
@@ -47,5 +46,4 @@ export declare class EnvironmentNotFoundError extends Error {
|
|
|
47
46
|
* ```
|
|
48
47
|
*/
|
|
49
48
|
export declare function checkAndGetEnvValue(key: string): string;
|
|
50
|
-
//#endregion
|
|
51
49
|
//# sourceMappingURL=env.d.ts.map
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","names":[],"sources":["../src/env.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.d.ts","names":[],"sources":["../src/env.ts"],"mappings":";;;;;;qBAMa,iCAAiC;WACjC;;;;;;EAOG,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCA,oBAAoB"}
|
package/dist/env.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/env.ts
|
|
2
2
|
/**
|
|
3
3
|
* Custom error class for handling missing environment variables.
|
|
4
4
|
*
|
|
@@ -55,7 +55,6 @@ function checkAndGetEnvValue(key) {
|
|
|
55
55
|
if (process.env[key] === void 0) throw new EnvironmentNotFoundError(key);
|
|
56
56
|
return process.env[key];
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { EnvironmentNotFoundError, checkAndGetEnvValue };
|
|
60
59
|
|
|
61
60
|
//# sourceMappingURL=env.js.map
|
package/dist/event-awaiter.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/event-awaiter.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* An asynchronous keyed event rendezvous for one or more waiting consumers.
|
|
4
3
|
*
|
|
@@ -75,5 +74,4 @@ export declare class EventAwaiter<T> {
|
|
|
75
74
|
*/
|
|
76
75
|
waitLatest(key: string, timeoutMs?: number, signal?: AbortSignal): Promise<T | undefined>;
|
|
77
76
|
}
|
|
78
|
-
//#endregion
|
|
79
77
|
//# sourceMappingURL=event-awaiter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-awaiter.d.ts","names":[],"sources":["../src/event-awaiter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-awaiter.d.ts","names":[],"sources":["../src/event-awaiter.ts"],"mappings":";;;;;;;;;;;qBAWa,aAAa;;;;;;;;EAYtB,QAAQ,aAAa,OAAO;;;;;;EAa5B,WAAW,QAAO;;;;;;;;;;;;;;;;;;;;EAwBlB,KAAK,aAAa,oBAAoB,8BAA8B,SAAS,cAAW,QAAA;;;;;;;;;;;;;;EA8DxF,cAAc,aAAa,oBAAoB,SAAS,cAAW,QAAA;;;;;;;;;;;;;;;EAkBnE,WAAW,aAAa,oBAAoB,SAAS,cAAW,QAAA"}
|
package/dist/event-awaiter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/event-awaiter.ts
|
|
2
2
|
/**
|
|
3
3
|
* An asynchronous keyed event rendezvous for one or more waiting consumers.
|
|
4
4
|
*
|
|
@@ -119,7 +119,6 @@ var EventAwaiter = class {
|
|
|
119
119
|
return this.wait(key, timeoutMs, "override", signal);
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
//#endregion
|
|
123
122
|
export { EventAwaiter };
|
|
124
123
|
|
|
125
124
|
//# sourceMappingURL=event-awaiter.js.map
|
package/dist/file.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BinaryInput } from "./types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Detects a lowercase MIME type from binary content rather than its name or declared type.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Requires the optional `file-type` peer dependency. Only formats supported by its binary detection
|
|
7
|
+
* are recognized; this is not a general text-file detector or a guarantee that a file is safe.
|
|
8
|
+
* Blob and File inputs are read through the detector's tokenizer instead of being fully buffered up front.
|
|
9
|
+
* The amount of content inspected depends on its format; this does not impose a fixed read limit.
|
|
10
|
+
* Detection and input-reading errors propagate to the caller.
|
|
11
|
+
*
|
|
12
|
+
* @param input - The binary content to inspect.
|
|
13
|
+
*
|
|
14
|
+
* @returns The detected lowercase MIME type, or `undefined` when the content is not recognized.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { getFileMimeType } from '@kikiutils/shared/file';
|
|
20
|
+
*
|
|
21
|
+
* const mimeType = await getFileMimeType(file);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function getFileMimeType(input: BinaryInput): Promise<string | undefined>;
|
|
25
|
+
//# sourceMappingURL=file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","names":[],"sources":["../src/file.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;wBA6BsB,gBAAgB,OAAO,cAAW"}
|
package/dist/file.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { fileTypeFromBlob, fileTypeFromBuffer } from "file-type";
|
|
2
|
+
// src/file.ts
|
|
3
|
+
/**
|
|
4
|
+
* Detects a lowercase MIME type from binary content rather than its name or declared type.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Requires the optional `file-type` peer dependency. Only formats supported by its binary detection
|
|
8
|
+
* are recognized; this is not a general text-file detector or a guarantee that a file is safe.
|
|
9
|
+
* Blob and File inputs are read through the detector's tokenizer instead of being fully buffered up front.
|
|
10
|
+
* The amount of content inspected depends on its format; this does not impose a fixed read limit.
|
|
11
|
+
* Detection and input-reading errors propagate to the caller.
|
|
12
|
+
*
|
|
13
|
+
* @param input - The binary content to inspect.
|
|
14
|
+
*
|
|
15
|
+
* @returns The detected lowercase MIME type, or `undefined` when the content is not recognized.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { getFileMimeType } from '@kikiutils/shared/file';
|
|
21
|
+
*
|
|
22
|
+
* const mimeType = await getFileMimeType(file);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async function getFileMimeType(input) {
|
|
26
|
+
return (input instanceof ArrayBuffer || input instanceof Uint8Array ? await fileTypeFromBuffer(input) : await fileTypeFromBlob(input))?.mime.toLowerCase();
|
|
27
|
+
}
|
|
28
|
+
export { getFileMimeType };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=file.js.map
|
package/dist/file.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","names":[],"sources":["../src/file.ts"],"sourcesContent":["import {\n fileTypeFromBlob,\n fileTypeFromBuffer,\n} from 'file-type';\n\nimport type { BinaryInput } from './types';\n\n/**\n * Detects a lowercase MIME type from binary content rather than its name or declared type.\n *\n * @remarks\n * Requires the optional `file-type` peer dependency. Only formats supported by its binary detection\n * are recognized; this is not a general text-file detector or a guarantee that a file is safe.\n * Blob and File inputs are read through the detector's tokenizer instead of being fully buffered up front.\n * The amount of content inspected depends on its format; this does not impose a fixed read limit.\n * Detection and input-reading errors propagate to the caller.\n *\n * @param input - The binary content to inspect.\n *\n * @returns The detected lowercase MIME type, or `undefined` when the content is not recognized.\n *\n * @example\n *\n * ```ts\n * import { getFileMimeType } from '@kikiutils/shared/file';\n *\n * const mimeType = await getFileMimeType(file);\n * ```\n */\nexport async function getFileMimeType(input: BinaryInput) {\n // The tokenizer only uses size, slice, and arrayBuffer; Node/DOM Blob stream typings differ.\n const result = input instanceof ArrayBuffer || input instanceof Uint8Array\n ? await fileTypeFromBuffer(input)\n : await fileTypeFromBlob(input as Blob);\n\n return result?.mime.toLowerCase();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,eAAsB,gBAAgB,OAAoB;CAMtD,QAJe,iBAAiB,eAAe,iBAAiB,aAC1D,MAAM,mBAAmB,KAAK,IAC9B,MAAM,iBAAiB,KAAa,EAAA,EAE3B,KAAK,YAAY;AACpC"}
|
package/dist/general.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/general.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Returns the first array element or the input value, with a nullish fallback.
|
|
4
3
|
*
|
|
@@ -32,5 +31,4 @@
|
|
|
32
31
|
*/
|
|
33
32
|
export declare function extractFirstValue<T>(value: T | T[]): T | undefined;
|
|
34
33
|
export declare function extractFirstValue<T, D>(value: T | T[], defaultValue: D): D | NonNullable<T>;
|
|
35
|
-
//#endregion
|
|
36
34
|
//# sourceMappingURL=general.d.ts.map
|
package/dist/general.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","names":[],"sources":["../src/general.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"general.d.ts","names":[],"sources":["../src/general.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiCgB,kBAAkB,GAAG,OAAO,IAAI,MAAM;wBACtC,kBAAkB,GAAG,GAAG,OAAO,IAAI,KAAK,cAAc,IAAI,IAAI,YAAY"}
|
package/dist/general.js
CHANGED
package/dist/hash.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/hash.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Computes the SHA-3 hash of the given data using the 224-bit digest.
|
|
4
3
|
*
|
|
@@ -63,5 +62,4 @@ export declare function sha3384(data: string | Uint8Array): string;
|
|
|
63
62
|
* ```
|
|
64
63
|
*/
|
|
65
64
|
export declare function sha3512(data: string | Uint8Array): string;
|
|
66
|
-
//#endregion
|
|
67
65
|
//# sourceMappingURL=hash.d.ts.map
|
package/dist/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","names":[],"sources":["../src/hash.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.d.ts","names":[],"sources":["../src/hash.ts"],"mappings":";;;;;;;;;;;;;;;wBA0BgB,QAAQ,eAAe;;;;;;;;;;;;;;;;wBAmBvB,QAAQ,eAAe;;;;;;;;;;;;;;;;wBAmBvB,QAAQ,eAAe;;;;;;;;;;;;;;;;wBAmBvB,QAAQ,eAAe"}
|
package/dist/hash.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sha3_224, sha3_256, sha3_384, sha3_512 } from "@noble/hashes/sha3.js";
|
|
2
2
|
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
3
|
-
|
|
3
|
+
// src/hash.ts
|
|
4
4
|
/**
|
|
5
5
|
* Computes the SHA-3 hash of the given data using the 224-bit digest.
|
|
6
6
|
*
|
|
@@ -73,7 +73,6 @@ function sha3384(data) {
|
|
|
73
73
|
function sha3512(data) {
|
|
74
74
|
return bytesToHex(sha3_512(typeof data === "string" ? utf8ToBytes(data) : data));
|
|
75
75
|
}
|
|
76
|
-
//#endregion
|
|
77
76
|
export { sha3224, sha3256, sha3384, sha3512 };
|
|
78
77
|
|
|
79
78
|
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LoggerRecord } from "./types.js";
|
|
2
|
+
/** Native console formatting keeps user strings literal and objects expandable. */
|
|
3
|
+
export declare function formatLoggerConsoleArgs(record: LoggerRecord): unknown[];
|
|
4
|
+
/** Keeps data arguments intact so browser developer tools can expand objects. */
|
|
5
|
+
export declare function formatLoggerParts(record: LoggerRecord, colors?: boolean): unknown[];
|
|
6
|
+
/** Fixed local-time representation, deliberately without a per-second cache. */
|
|
7
|
+
export declare function formatLoggerTime(date: Date): string;
|
|
8
|
+
/** Use native terminal detection; redirected streams still honor FORCE_COLOR. */
|
|
9
|
+
export declare function supportsLoggerColor(target: {
|
|
10
|
+
hasColors?: () => boolean;
|
|
11
|
+
isTTY?: boolean;
|
|
12
|
+
}): boolean;
|
|
13
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","names":[],"sources":["../../../src/logger/_internals/formatter.ts"],"mappings":";;wBASgB,wBAAwB,QAAQ;;wBAiChC,kBAAkB,QAAQ,cAAc;;wBAYxC,iBAAiB,MAAM;;wBAQvB,oBAAoB;EAAU;EAA2B"}
|