@kikiutils/shared 18.3.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 +1 -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 +0 -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 +0 -2
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +1 -2
- 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 +0 -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 +0 -2
- package/dist/storages/lru/keyed-store.d.ts.map +1 -1
- package/dist/storages/lru/keyed-store.js +1 -2
- 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 +0 -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 +73 -45
- 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/types/index.ts +0 -10
- package/dist/classes/ssh-client.d.ts +0 -40
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","names":[],"sources":["../../../../src/logger/node/_internals/formatter.ts"],"sourcesContent":["import { inspect } from 'node:util';\n\nimport { formatLoggerParts } from '../../_internals/formatter';\nimport type { LoggerRecord } from '../../_internals/types';\n\n// Functions\n\n/** Preserve user ANSI for console output without invoking custom inspect callbacks/getters. */\nexport function formatNodeLoggerRecord(record: LoggerRecord, colors = false) {\n const message = record.args.map(\n (arg) => typeof arg === 'string'\n ? arg\n : inspect(\n arg,\n {\n colors: false,\n customInspect: false,\n depth: 6,\n getters: false,\n maxArrayLength: 100,\n maxStringLength: 10_000,\n },\n ),\n ).join(' ');\n\n return formatLoggerParts(\n {\n ...record,\n args: record.args.length ? [message] : [],\n },\n colors,\n ).join(' ');\n}\n"],"mappings":";;;;AAQA,SAAgB,uBAAuB,QAAsB,SAAS,OAAO;CACzE,MAAM,UAAU,OAAO,KAAK,KACvB,QAAQ,OAAO,QAAQ,WAClB,MACA,QACE,KACA;EACI,QAAQ;EACR,eAAe;EACf,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,iBAAiB;CACrB,CACJ,CACR,CAAC,CAAC,KAAK,GAAG;CAEV,OAAO,kBACH;EACI,GAAG;EACH,MAAM,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI,CAAC;CAC5C,GACA,MACJ,CAAC,CAAC,KAAK,GAAG;AACd"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NodeLogger, NodeLoggerOptions } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Node.js/Bun logger with optional bounded, append-only file output and rotation.
|
|
4
|
+
*
|
|
5
|
+
* Log calls never throw or reject. Awaiting them waits for processing, not proof of successful
|
|
6
|
+
* persistence: overload drops the newest file record and failures are reported safely. Factory
|
|
7
|
+
* validation/open failures reject. Call close explicitly; no process signal handlers are installed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createNodeLogger(options?: NodeLoggerOptions): Promise<NodeLogger>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/logger/node/index.ts"],"mappings":";;;;;;;;wBAqCsB,iBAAiB,UAAS,oBAAyB,QAAQ"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { getLoggerStreamName } from "../_internals/levels.js";
|
|
2
|
+
import { supportsLoggerColor } from "../_internals/formatter.js";
|
|
3
|
+
import { createDiagnosticReporter, createLoggerCore } from "../_internals/logger.js";
|
|
4
|
+
import { createFileWriter } from "./_internals/file-writer.js";
|
|
5
|
+
import { formatNodeLoggerRecord } from "./_internals/formatter.js";
|
|
6
|
+
import { writeSync } from "node:fs";
|
|
7
|
+
import { stripVTControlCharacters } from "node:util";
|
|
8
|
+
// src/logger/node/index.ts
|
|
9
|
+
const consoleStreams = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
/**
|
|
11
|
+
* Creates a Node.js/Bun logger with optional bounded, append-only file output and rotation.
|
|
12
|
+
*
|
|
13
|
+
* Log calls never throw or reject. Awaiting them waits for processing, not proof of successful
|
|
14
|
+
* persistence: overload drops the newest file record and failures are reported safely. Factory
|
|
15
|
+
* validation/open failures reject. Call close explicitly; no process signal handlers are installed.
|
|
16
|
+
*/
|
|
17
|
+
async function createNodeLogger(options = {}) {
|
|
18
|
+
const report = createDiagnosticReporter(options.onError, (message) => writeSync(2, message));
|
|
19
|
+
let writer;
|
|
20
|
+
let closed = false;
|
|
21
|
+
let closePromise;
|
|
22
|
+
const consoleOwner = {};
|
|
23
|
+
const consoleTargets = /* @__PURE__ */ new Set();
|
|
24
|
+
const consoleWrites = /* @__PURE__ */ new Set();
|
|
25
|
+
const logger = createLoggerCore(options, {
|
|
26
|
+
report,
|
|
27
|
+
write(record) {
|
|
28
|
+
if (closed) {
|
|
29
|
+
report({
|
|
30
|
+
message: "Logger is closed.",
|
|
31
|
+
type: "closed"
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!record.console && !writer) return;
|
|
36
|
+
const target = process[getLoggerStreamName(record.type)];
|
|
37
|
+
const text = formatNodeLoggerRecord(record, record.console && supportsLoggerColor(target));
|
|
38
|
+
if (record.console) {
|
|
39
|
+
const line = `${text}\n`;
|
|
40
|
+
consoleTargets.add(target);
|
|
41
|
+
const completion = writeConsole(target, line, report, consoleOwner);
|
|
42
|
+
consoleWrites.add(completion);
|
|
43
|
+
completion.then(() => consoleWrites.delete(completion));
|
|
44
|
+
const fileCompletion = writer?.write(`${stripVTControlCharacters(text)}\n`);
|
|
45
|
+
return fileCompletion ? Promise.all([completion, fileCompletion]).then(() => {}) : completion;
|
|
46
|
+
}
|
|
47
|
+
return writer?.write(`${stripVTControlCharacters(text)}\n`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (options.file !== void 0 && options.file !== false) writer = await createFileWriter(options.file, report);
|
|
51
|
+
return Object.assign(logger, {
|
|
52
|
+
close() {
|
|
53
|
+
if (closePromise) return closePromise;
|
|
54
|
+
closed = true;
|
|
55
|
+
closePromise = (async () => {
|
|
56
|
+
await Promise.all([writer?.close(), ...consoleWrites]);
|
|
57
|
+
for (const target of consoleTargets) {
|
|
58
|
+
const state = consoleStreams.get(target);
|
|
59
|
+
if (!state) continue;
|
|
60
|
+
state.owners.delete(consoleOwner);
|
|
61
|
+
if (!state.owners.size) {
|
|
62
|
+
target.off("error", state.onError);
|
|
63
|
+
target.off("close", state.onClose);
|
|
64
|
+
consoleStreams.delete(target);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
consoleTargets.clear();
|
|
68
|
+
})();
|
|
69
|
+
return closePromise;
|
|
70
|
+
},
|
|
71
|
+
getStats: () => writer?.getStats() ?? {
|
|
72
|
+
droppedCount: 0,
|
|
73
|
+
pendingBytes: 0,
|
|
74
|
+
writeErrorCount: 0
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** One error listener per shared output stream; retained until its last owning logger calls close(). */
|
|
79
|
+
function writeConsole(target, text, report, owner) {
|
|
80
|
+
let state = consoleStreams.get(target);
|
|
81
|
+
if (!state) {
|
|
82
|
+
const pending = /* @__PURE__ */ new Set();
|
|
83
|
+
const onError = (error) => {
|
|
84
|
+
for (const settle of pending) settle(error);
|
|
85
|
+
};
|
|
86
|
+
const onClose = () => onError(/* @__PURE__ */ new Error("Console stream closed."));
|
|
87
|
+
state = {
|
|
88
|
+
onClose,
|
|
89
|
+
onError,
|
|
90
|
+
owners: /* @__PURE__ */ new Set(),
|
|
91
|
+
pending
|
|
92
|
+
};
|
|
93
|
+
consoleStreams.set(target, state);
|
|
94
|
+
target.on("error", onError);
|
|
95
|
+
target.on("close", onClose);
|
|
96
|
+
}
|
|
97
|
+
state.owners.add(owner);
|
|
98
|
+
const current = state;
|
|
99
|
+
return new Promise((resolveWritten) => {
|
|
100
|
+
let settled = false;
|
|
101
|
+
const settle = (error) => {
|
|
102
|
+
if (settled) return;
|
|
103
|
+
settled = true;
|
|
104
|
+
current.pending.delete(settle);
|
|
105
|
+
if (error) report({
|
|
106
|
+
error,
|
|
107
|
+
message: "Console output failed.",
|
|
108
|
+
type: "console"
|
|
109
|
+
});
|
|
110
|
+
resolveWritten();
|
|
111
|
+
};
|
|
112
|
+
current.pending.add(settle);
|
|
113
|
+
try {
|
|
114
|
+
target.write(text, settle);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
settle(error instanceof Error ? error : /* @__PURE__ */ new Error("Console output failed."));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export { createNodeLogger };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/logger/node/index.ts"],"sourcesContent":["import { writeSync } from 'node:fs';\nimport { stripVTControlCharacters } from 'node:util';\n\nimport { supportsLoggerColor } from '../_internals/formatter';\nimport { getLoggerStreamName } from '../_internals/levels';\nimport {\n createDiagnosticReporter,\n createLoggerCore,\n} from '../_internals/logger';\nimport type { LoggerDiagnostic } from '../types';\n\nimport { createFileWriter } from './_internals/file-writer';\nimport { formatNodeLoggerRecord } from './_internals/formatter';\nimport type {\n NodeLogger,\n NodeLoggerOptions,\n} from './types';\n\ninterface ConsoleStreamState {\n onClose: () => void;\n onError: (error: Error) => void;\n owners: Set<object>;\n pending: Set<(error?: Error | null) => void>;\n}\n\n// Constants/Variables\nconst consoleStreams = new WeakMap<NodeJS.WriteStream, ConsoleStreamState>();\n\n// Functions\n\n/**\n * Creates a Node.js/Bun logger with optional bounded, append-only file output and rotation.\n *\n * Log calls never throw or reject. Awaiting them waits for processing, not proof of successful\n * persistence: overload drops the newest file record and failures are reported safely. Factory\n * validation/open failures reject. Call close explicitly; no process signal handlers are installed.\n */\nexport async function createNodeLogger(options: NodeLoggerOptions = {}): Promise<NodeLogger> {\n const report = createDiagnosticReporter(options.onError, (message) => writeSync(2, message));\n let writer: Awaited<ReturnType<typeof createFileWriter>> | undefined;\n let closed = false;\n let closePromise: Promise<void> | undefined;\n const consoleOwner = {};\n const consoleTargets = new Set<NodeJS.WriteStream>();\n const consoleWrites = new Set<Promise<void>>();\n const logger = createLoggerCore(\n options,\n {\n report,\n write(record) {\n if (closed) {\n report({\n message: 'Logger is closed.',\n type: 'closed',\n });\n\n return;\n }\n\n if (!record.console && !writer) return;\n const target = process[getLoggerStreamName(record.type)];\n\n const text = formatNodeLoggerRecord(record, record.console && supportsLoggerColor(target));\n if (record.console) {\n const line = `${text}\\n`;\n consoleTargets.add(target);\n const completion = writeConsole(target, line, report, consoleOwner);\n consoleWrites.add(completion);\n void completion.then(() => consoleWrites.delete(completion));\n const fileCompletion = writer?.write(`${stripVTControlCharacters(text)}\\n`);\n return fileCompletion\n ? Promise.all([\n completion,\n fileCompletion,\n ]).then(() => {})\n : completion;\n }\n\n return writer?.write(`${stripVTControlCharacters(text)}\\n`);\n },\n },\n );\n\n if (options.file !== undefined && options.file !== false) writer = await createFileWriter(options.file, report);\n\n return Object.assign(\n logger,\n {\n close() {\n if (closePromise) return closePromise;\n closed = true;\n closePromise = (async () => {\n await Promise.all([\n writer?.close(),\n ...consoleWrites,\n ]);\n\n for (const target of consoleTargets) {\n const state = consoleStreams.get(target);\n if (!state) continue;\n state.owners.delete(consoleOwner);\n if (!state.owners.size) {\n target.off('error', state.onError);\n target.off('close', state.onClose);\n consoleStreams.delete(target);\n }\n }\n\n consoleTargets.clear();\n })();\n return closePromise;\n },\n getStats: () => writer?.getStats() ?? {\n droppedCount: 0,\n pendingBytes: 0,\n writeErrorCount: 0,\n },\n },\n );\n}\n\n/** One error listener per shared output stream; retained until its last owning logger calls close(). */\nfunction writeConsole(\n target: NodeJS.WriteStream,\n text: string,\n report: (event: LoggerDiagnostic) => void,\n owner: object,\n) {\n let state = consoleStreams.get(target);\n if (!state) {\n const pending = new Set<(error?: Error | null) => void>();\n const onError = (error: Error) => {\n for (const settle of pending) settle(error);\n };\n\n const onClose = () => onError(new Error('Console stream closed.'));\n state = {\n onClose,\n onError,\n owners: new Set(),\n pending,\n };\n\n consoleStreams.set(target, state);\n target.on('error', onError);\n target.on('close', onClose);\n }\n\n state.owners.add(owner);\n const current = state;\n return new Promise<void>((resolveWritten) => {\n let settled = false;\n const settle = (error?: Error | null) => {\n if (settled) return;\n settled = true;\n current.pending.delete(settle);\n if (error) {\n report({\n error,\n message: 'Console output failed.',\n type: 'console',\n });\n }\n\n resolveWritten();\n };\n\n current.pending.add(settle);\n try {\n target.write(text, settle);\n } catch (error) {\n settle(error instanceof Error ? error : new Error('Console output failed.'));\n }\n });\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PathLike } from "../../classes/path.js";
|
|
2
|
+
import { Logger, LoggerOptions } from "../types.js";
|
|
3
|
+
/** Specify interval and/or maxSize. Size limits use positive integers with B, K, M, or G (binary units). */
|
|
4
|
+
export type LoggerRotationOptions = {
|
|
5
|
+
/** Gzip historical files. Defaults to true. */
|
|
6
|
+
compress?: boolean;
|
|
7
|
+
/** Number of historical files, excluding the active file. Defaults to 30. */
|
|
8
|
+
keepFiles?: number;
|
|
9
|
+
/** Maximum combined size of historical files. */
|
|
10
|
+
maxTotalSize?: string;
|
|
11
|
+
} & ({
|
|
12
|
+
/** Opt-in time rotation aligned to the system's local calendar boundary. */
|
|
13
|
+
interval: 'daily' | 'hourly';
|
|
14
|
+
maxSize?: string;
|
|
15
|
+
} | {
|
|
16
|
+
/** Opt-in time rotation aligned to the system's local calendar boundary. */
|
|
17
|
+
interval?: 'daily' | 'hourly';
|
|
18
|
+
maxSize: string;
|
|
19
|
+
});
|
|
20
|
+
export interface LoggerFileOptions {
|
|
21
|
+
/** Maximum unfinished payload bytes, including data already submitted to the stream. */
|
|
22
|
+
maxPendingBytes?: number;
|
|
23
|
+
/** Resolved once at creation. The file is opened in append mode. */
|
|
24
|
+
path: PathLike;
|
|
25
|
+
/** Omitted or false disables rotation. An object must specify interval or maxSize. */
|
|
26
|
+
rotate?: false | LoggerRotationOptions;
|
|
27
|
+
}
|
|
28
|
+
export interface NodeLogger extends Logger {
|
|
29
|
+
/** Stop accepting records, finish accepted file writes, then release the stream. Not fsync. */
|
|
30
|
+
close: () => Promise<void>;
|
|
31
|
+
/** A fresh snapshot. Dropped/failed records still resolve their logging promises. */
|
|
32
|
+
getStats: () => NodeLoggerStats;
|
|
33
|
+
}
|
|
34
|
+
export interface NodeLoggerOptions extends LoggerOptions {
|
|
35
|
+
/** Disabled by default. Each logger owns at most one fixed file destination. */
|
|
36
|
+
file?: false | LoggerFileOptions;
|
|
37
|
+
}
|
|
38
|
+
export interface NodeLoggerStats {
|
|
39
|
+
droppedCount: number;
|
|
40
|
+
pendingBytes: number;
|
|
41
|
+
writeErrorCount: number;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/logger/node/types.ts"],"mappings":";;;YAOY;;EAER;;EAGA;;EAGA;;;EAIE;EACA;;;EAIA;EACA;;iBAIW;;EAEb;;EAGA,MAAM;;EAGN,iBAAiB;;iBAGJ,mBAAmB;;EAEhC,aAAa;;EAGb,gBAAgB;;iBAGH,0BAA0B;;EAEvC,eAAe;;iBAGF;EACb;EACA;EACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Minimum severity to emit; `success` uses the same threshold as `info`. */
|
|
2
|
+
export type LoggerLevel = 'debug' | 'error' | 'fatal' | 'info' | 'silent' | 'trace' | 'warn';
|
|
3
|
+
/** A logging method, including the informational success presentation. */
|
|
4
|
+
export type LoggerMethod = 'success' | Exclude<LoggerLevel, 'silent'>;
|
|
5
|
+
/**
|
|
6
|
+
* A logger whose logging methods never throw or reject for recoverable failures.
|
|
7
|
+
*
|
|
8
|
+
* Awaiting a method waits for processing, not guaranteed successful delivery or fsync.
|
|
9
|
+
* Configuration errors may throw from the factory, configure(), or setLevel().
|
|
10
|
+
*/
|
|
11
|
+
export interface Logger {
|
|
12
|
+
configure: (options: Pick<LoggerOptions, 'console' | 'icons' | 'prefix' | 'suffix' | 'timestamp'>) => void;
|
|
13
|
+
debug: (...args: unknown[]) => Promise<void>;
|
|
14
|
+
error: (...args: unknown[]) => Promise<void>;
|
|
15
|
+
fatal: (...args: unknown[]) => Promise<void>;
|
|
16
|
+
info: (...args: unknown[]) => Promise<void>;
|
|
17
|
+
/** Accepts success as an informational method; it is not a configurable threshold. */
|
|
18
|
+
isLevelEnabled: (level: LoggerLevel | LoggerMethod) => boolean;
|
|
19
|
+
/** Sets a severity threshold (not success); env restores environment-driven filtering. */
|
|
20
|
+
setLevel: (level: 'env' | LoggerLevel) => void;
|
|
21
|
+
success: (...args: unknown[]) => Promise<void>;
|
|
22
|
+
trace: (...args: unknown[]) => Promise<void>;
|
|
23
|
+
warn: (...args: unknown[]) => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/** A recoverable logging failure, reported without throwing from log methods. */
|
|
26
|
+
export interface LoggerDiagnostic {
|
|
27
|
+
droppedCount?: number;
|
|
28
|
+
error?: unknown;
|
|
29
|
+
message: string;
|
|
30
|
+
/** Same-type notifications suppressed since the previous emitted diagnostic. */
|
|
31
|
+
suppressedCount?: number;
|
|
32
|
+
type: 'closed' | 'console' | 'file' | 'format' | 'invalid-level' | 'overflow';
|
|
33
|
+
}
|
|
34
|
+
/** Configuration shared by browser and server loggers. */
|
|
35
|
+
export interface LoggerOptions {
|
|
36
|
+
/** Enables console output. Defaults to `true`. */
|
|
37
|
+
console?: boolean;
|
|
38
|
+
/** Enables Unicode level icons. Defaults to `true`. */
|
|
39
|
+
icons?: boolean;
|
|
40
|
+
/** Overrides LOG_LEVEL; `env` restores the environment-driven threshold. */
|
|
41
|
+
level?: 'env' | LoggerLevel;
|
|
42
|
+
/** Best-effort, rate-limited notification; failures in this callback are contained. */
|
|
43
|
+
onError?: (event: LoggerDiagnostic) => void;
|
|
44
|
+
prefix?: string;
|
|
45
|
+
suffix?: string;
|
|
46
|
+
/** Enables the fixed local-time millisecond prefix. Defaults to `true`. */
|
|
47
|
+
timestamp?: boolean;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/logger/types.ts"],"mappings":";YACY;;YAGA,2BAA2B,QAAQ;;;;;;;iBAQ9B;EACb,YAAY,SAAS,KAAK;EAC1B,WAAW,oBAAoB;EAC/B,WAAW,oBAAoB;EAC/B,WAAW,oBAAoB;EAC/B,UAAU,oBAAoB;;EAG9B,iBAAiB,OAAO,cAAc;;EAGtC,WAAW,eAAe;EAC1B,aAAa,oBAAoB;EACjC,WAAW,oBAAoB;EAC/B,UAAU,oBAAoB;;;iBAIjB;EACb;EACA;EACA;;EAGA;EACA;;;iBAIa;;EAEb;;EAGA;;EAGA,gBAAgB;;EAGhB,WAAW,OAAO;EAClB;EACA;;EAGA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/math.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Decimal } from "decimal.js";
|
|
2
|
-
//#region src/math.d.ts
|
|
3
2
|
type CalculableValue = Decimal.Value | {
|
|
4
3
|
toString: () => string;
|
|
5
4
|
};
|
|
@@ -45,6 +44,5 @@ export interface ToPercentageStringOptions {
|
|
|
45
44
|
* ```
|
|
46
45
|
*/
|
|
47
46
|
export declare function toPercentageString(molecular: CalculableValue, denominator: CalculableValue, options?: ToPercentageStringOptions): string;
|
|
48
|
-
//#endregion
|
|
49
47
|
export {};
|
|
50
48
|
//# sourceMappingURL=math.d.ts.map
|
package/dist/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":";KAEK,kBAAkB,QAAQ;EAAU;;;;;iBAKxB;;;;;;EAMb;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2BY,mBACZ,WAAW,iBACX,aAAa,iBACb,UAAU"}
|
package/dist/math.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decimal } from "decimal.js";
|
|
2
|
-
|
|
2
|
+
// src/math.ts
|
|
3
3
|
/**
|
|
4
4
|
* Converts a numerator and denominator into a formatted percentage.
|
|
5
5
|
*
|
|
@@ -31,7 +31,6 @@ function toPercentageString(molecular, denominator, options) {
|
|
|
31
31
|
const result = calculationResult.isNaN() || !calculationResult.isFinite() ? "0.00" : calculationResult.times(100).toFixed(options?.decimalPlaces ?? 2);
|
|
32
32
|
return options?.withSymbol ?? true ? `${result}%` : result;
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { toPercentageString };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=math.js.map
|
package/dist/number.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { millify } from "millify";
|
|
2
|
-
//#region src/number.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Converts a large number into a compact, human-readable string using `millify`.
|
|
5
4
|
*
|
|
@@ -21,5 +20,4 @@ import { millify } from "millify";
|
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
22
|
export declare function toCompactNumberString(value: number, options?: Parameters<typeof millify>[1]): string;
|
|
24
|
-
//#endregion
|
|
25
23
|
//# sourceMappingURL=number.d.ts.map
|
package/dist/number.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","names":[],"sources":["../src/number.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"number.d.ts","names":[],"sources":["../src/number.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;wBAsBgB,sBAAsB,eAAe,UAAU,kBAAkB"}
|
package/dist/number.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { millify } from "millify";
|
|
2
|
-
|
|
2
|
+
// src/number.ts
|
|
3
3
|
/**
|
|
4
4
|
* Converts a large number into a compact, human-readable string using `millify`.
|
|
5
5
|
*
|
|
@@ -27,7 +27,6 @@ function toCompactNumberString(value, options) {
|
|
|
27
27
|
...options
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { toCompactNumberString };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=number.js.map
|
package/dist/random.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/random.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Calls a generator once with a length sampled from two nested random ranges.
|
|
4
3
|
*
|
|
@@ -23,5 +22,4 @@
|
|
|
23
22
|
* @throws Error if `minMin` exceeds `minMax` or `maxMin` exceeds `maxMax`.
|
|
24
23
|
*/
|
|
25
24
|
export declare function generateWithNestedRandomLength<T = string>(generator: (length: number) => T, minMin: number, minMax: number, maxMin: number, maxMax: number): T;
|
|
26
|
-
//#endregion
|
|
27
25
|
//# sourceMappingURL=random.d.ts.map
|
package/dist/random.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.d.ts","names":[],"sources":["../src/random.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"random.d.ts","names":[],"sources":["../src/random.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;wBAuBgB,+BAA+B,YAC3C,YAAY,mBAAmB,GAC/B,gBACA,gBACA,gBACA,iBAAc"}
|
package/dist/random.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/random.ts
|
|
2
2
|
/**
|
|
3
3
|
* Calls a generator once with a length sampled from two nested random ranges.
|
|
4
4
|
*
|
|
@@ -29,7 +29,6 @@ function generateWithNestedRandomLength(generator, minMin, minMax, maxMin, maxMa
|
|
|
29
29
|
const innerMin = random(minMin, minMax);
|
|
30
30
|
return generator(random(Math.max(innerMin, maxMin), maxMax));
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { generateWithNestedRandomLength };
|
|
34
33
|
|
|
35
34
|
//# sourceMappingURL=random.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/redis/script-runner.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* An asynchronous Lua script runner with caller-declared results.
|
|
4
3
|
*
|
|
@@ -53,5 +52,4 @@ export interface RedisLikeScriptClient {
|
|
|
53
52
|
* @throws RangeError if `maxAttempts` is not a positive safe integer.
|
|
54
53
|
*/
|
|
55
54
|
export declare function createRedisScriptRunner<T = unknown>(client: RedisLikeScriptClient, source: string, maxAttempts?: number): RedisScriptRunner<T>;
|
|
56
|
-
//#endregion
|
|
57
55
|
//# sourceMappingURL=script-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-runner.d.ts","names":[],"sources":["../../src/redis/script-runner.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"script-runner.d.ts","names":[],"sources":["../../src/redis/script-runner.ts"],"mappings":";;;;;;;;;;;;;;YAgBY,kBAAkB,gBAAgB,yBAAyB,uCAAuC,QAC1G;;;;;;;;;iBAWa;;;;;;;EAOb,OAAO,iBAAiB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;wBAwB/B,wBAAwB,aACpC,QAAQ,uBACR,gBACA,uBACD,kBAAkB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
2
|
+
// src/redis/script-runner.ts
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Lua script runner that reloads missing cached scripts before retrying execution.
|
|
5
5
|
*
|
|
@@ -40,7 +40,6 @@ function createRedisScriptRunner(client, source, maxAttempts = 3) {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { createRedisScriptRunner };
|
|
45
44
|
|
|
46
45
|
//# sourceMappingURL=script-runner.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LRUCache } from "lru-cache";
|
|
2
|
-
//#region src/storages/lru/keyed-store.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a keyed cache factory sharing a caller-owned LRU cache.
|
|
5
4
|
*
|
|
@@ -45,5 +44,4 @@ export declare function createLruKeyedStore<D = unknown>(lruInstance: LRUCache<a
|
|
|
45
44
|
setItem: (value: D, ...args: P) => LRUCache<any, any, any>;
|
|
46
45
|
setItemWithTtl(ttlMilliseconds: number, value: D, ...args: P): LRUCache<any, any, any>;
|
|
47
46
|
}>;
|
|
48
|
-
//#endregion
|
|
49
47
|
//# sourceMappingURL=keyed-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/lru/keyed-store.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/lru/keyed-store.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8BgB,oBAAoB,aAAa,aAAa,2BAClD,iBAAiB,WAAW,MAAM,iBAAY;;;;;;EAMjC,WAAA,MAAA,IAAC,YAAA;EAII,gBAAA,MAAA;EACH,aAAA,MAAA;EACG,gBAAA,MAAA;;;;EAIA,gBAAA,MAAA;EACL,UAAA,OAAA,MAAC,MAAW,MAAC;EACE,eAAA,yBAAM,OAAS,MAAC,MAAW,IAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/storages/lru/keyed-store.ts
|
|
2
2
|
/**
|
|
3
3
|
* Creates a keyed cache factory sharing a caller-owned LRU cache.
|
|
4
4
|
*
|
|
@@ -50,7 +50,6 @@ function createLruKeyedStore(lruInstance) {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { createLruKeyedStore };
|
|
55
54
|
|
|
56
55
|
//# sourceMappingURL=keyed-store.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MaybeReadonly } from "../../types/index.js";
|
|
2
2
|
import { RedisLikeStorage } from "./types.js";
|
|
3
|
-
//#region src/storages/redis/keyed-store.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Creates a keyed store factory sharing a caller-owned Redis-like storage facade.
|
|
6
5
|
*
|
|
@@ -26,5 +25,4 @@ export declare function createRedisKeyedStore<D = unknown>(storage: MaybeReadonl
|
|
|
26
25
|
setItem: (value: D, ...args: P) => Promise<boolean>;
|
|
27
26
|
setItemWithTtl(ttlSeconds: number, value: D, ...args: P): Promise<boolean>;
|
|
28
27
|
}>;
|
|
29
|
-
//#endregion
|
|
30
28
|
//# sourceMappingURL=keyed-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/redis/keyed-store.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyed-store.d.ts","names":[],"sources":["../../../src/storages/redis/keyed-store.ts"],"mappings":";;;;;;;;;;;;;;;;;;wBAoBgB,sBAAsB,aAAa,SAAS,cAAc,qBAC9D,iBAAiB,WAAW,MAAM,iBAAY;EAC/B,aAAA,MAAA,MAAC,QAAA;EACE,gBAAA,MAAA,MAAC;EACJ,aAAA,MAAA,MAAC;EACE,gBAAA,MAAA,MAAC;EACD,gBAAA,MAAA;EACL,UAAA,OAAA,MAAC,MAAW,MAAC;EACH,eAAA,oBAAM,OAAS,MAAC,MAAW,IAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/storages/redis/keyed-store.ts
|
|
2
2
|
/**
|
|
3
3
|
* Creates a keyed store factory sharing a caller-owned Redis-like storage facade.
|
|
4
4
|
*
|
|
@@ -28,7 +28,6 @@ function createRedisKeyedStore(storage) {
|
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { createRedisKeyedStore };
|
|
33
32
|
|
|
34
33
|
//# sourceMappingURL=keyed-store.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RedisLikeAdapter, RedisLikeStorage } from "./types.js";
|
|
2
|
-
//#region src/storages/redis/msgpack.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Creates a frozen Redis-like storage facade using MessagePack serialization.
|
|
5
4
|
*
|
|
@@ -42,5 +41,4 @@ import { RedisLikeAdapter, RedisLikeStorage } from "./types.js";
|
|
|
42
41
|
* ```
|
|
43
42
|
*/
|
|
44
43
|
export declare function createRedisMsgpackStorage(adapter: RedisLikeAdapter): Readonly<RedisLikeStorage>;
|
|
45
|
-
//#endregion
|
|
46
44
|
//# sourceMappingURL=msgpack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msgpack.d.ts","names":[],"sources":["../../../src/storages/redis/msgpack.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"msgpack.d.ts","names":[],"sources":["../../../src/storages/redis/msgpack.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwDgB,0BAA0B,SAAS,mBAAmB,SAAS"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { decode, encode, isNativeAccelerationEnabled } from "msgpackr";
|
|
2
|
-
|
|
2
|
+
// src/storages/redis/msgpack.ts
|
|
3
3
|
if (!isNativeAccelerationEnabled) console.warn("Native acceleration not enabled for msgpackr, verify that install finished properly");
|
|
4
4
|
/**
|
|
5
5
|
* Creates a frozen Redis-like storage facade using MessagePack serialization.
|
|
@@ -57,7 +57,6 @@ function createRedisMsgpackStorage(adapter) {
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
//#endregion
|
|
61
60
|
export { createRedisMsgpackStorage };
|
|
62
61
|
|
|
63
62
|
//# sourceMappingURL=msgpack.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/storages/redis/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* A caller-owned asynchronous adapter for Redis-like binary operations.
|
|
4
3
|
*
|
|
@@ -75,5 +74,4 @@ export interface RedisLikeStorage {
|
|
|
75
74
|
*/
|
|
76
75
|
setItemWithTtl: (key: string, ttlSeconds: number, value: any) => Promise<boolean>;
|
|
77
76
|
}
|
|
78
|
-
//#endregion
|
|
79
77
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/storages/redis/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/storages/redis/types.ts"],"mappings":";;;;;;;iBAOiB;;;;EAIb,SAAS,gBAAgB;;;;EAKzB,YAAY,gBAAgB,eAAe;;;;EAK3C,MAAM,gBAAgB;;;;EAKtB,YAAY,aAAa,OAAO,eAAe;;;;;;;;EAS/C,cAAc,aAAa,oBAAoB,OAAO,eAAe;;;;EAKrE,MAAM,gBAAgB;;;;;;;;;iBAUT;;;;;;EAMb,UAAU,aAAa,gBAAgB,eAAe;;;;EAKtD,aAAa,gBAAgB;;;;EAK7B,UAAU,gBAAgB;;;;EAK1B,aAAa,gBAAgB;;;;EAK7B,UAAU,aAAa,eAAe;;;;;;;;EAStC,iBAAiB,aAAa,oBAAoB,eAAe"}
|
package/dist/string.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/string.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Character-set presets supported by `randomString`.
|
|
4
3
|
*/
|
|
@@ -28,5 +27,4 @@ export type RandomStringMode = 'alphabetic' | 'alphanumeric' | 'lowercase' | 'lo
|
|
|
28
27
|
* ```
|
|
29
28
|
*/
|
|
30
29
|
export declare function randomString(length: number, mode?: RandomStringMode): string;
|
|
31
|
-
//#endregion
|
|
32
30
|
//# sourceMappingURL=string.d.ts.map
|
package/dist/string.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","names":[],"sources":["../src/string.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.d.ts","names":[],"sources":["../src/string.ts"],"mappings":";;;YAGY;;;;;;;;;;;;;;;;;;;;;;;;;wBA8CI,aAAa,gBAAgB,OAAM"}
|
package/dist/string.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/string.ts
|
|
2
2
|
const DIGITS = "0123456789";
|
|
3
3
|
const LOWERCASE = "abcdefghijklmnopqrstuvwxyz";
|
|
4
4
|
const UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
@@ -41,7 +41,6 @@ function randomString(length, mode = "alphabetic") {
|
|
|
41
41
|
if (!charset) throw new Error(`Unsupported mode: ${mode}`);
|
|
42
42
|
return Array.from({ length }, () => charset[Math.floor(Math.random() * charset.length)]).join("");
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { randomString };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=string.js.map
|
package/dist/time.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/time.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Waits until a duration elapses or cancellation occurs without rejecting on cancellation.
|
|
4
3
|
*
|
|
@@ -45,5 +44,4 @@ export declare function delay(ms: number, signal?: AbortSignal): Promise<void>;
|
|
|
45
44
|
* ```
|
|
46
45
|
*/
|
|
47
46
|
export declare function delayOrThrow(ms: number, signal?: AbortSignal): Promise<void>;
|
|
48
|
-
//#endregion
|
|
49
47
|
//# sourceMappingURL=time.d.ts.map
|
package/dist/time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","names":[],"sources":["../src/time.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"time.d.ts","names":[],"sources":["../src/time.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAoBgB,MAAM,YAAY,SAAS,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;wBA2CzC,aAAa,YAAY,SAAS,cAAc"}
|
package/dist/time.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/time.ts
|
|
2
2
|
/**
|
|
3
3
|
* Waits until a duration elapses or cancellation occurs without rejecting on cancellation.
|
|
4
4
|
*
|
|
@@ -75,7 +75,6 @@ function delayOrThrow(ms, signal) {
|
|
|
75
75
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
//#endregion
|
|
79
78
|
export { delay, delayOrThrow };
|
|
80
79
|
|
|
81
80
|
//# sourceMappingURL=time.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ObjectId } from "bson";
|
|
2
|
-
//#region src/types/filtered-key-path.d.ts
|
|
3
2
|
type ConditionalPath<K extends number | string, V, U> = V extends U ? `${K}` : DefaultPath<K, V, U, never>;
|
|
4
3
|
type DefaultPath<K extends number | string, V, U = never, RK = `${K}`> = V extends TerminalType ? RK : `${K}.${FilteredKeyPath<V, U>}`;
|
|
5
4
|
/**
|
|
@@ -13,6 +12,5 @@ type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false
|
|
|
13
12
|
type PathImpl<K extends number | string, V, U> = [U] extends [never] ? DefaultPath<K, V> : ConditionalPath<K, V, U>;
|
|
14
13
|
type TerminalType = bigint | Blob | boolean | Date | File | null | number | ObjectId | RegExp | string | symbol | undefined;
|
|
15
14
|
type TupleKey<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
|
|
16
|
-
//#endregion
|
|
17
15
|
export {};
|
|
18
16
|
//# sourceMappingURL=filtered-key-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filtered-key-path.d.ts","names":[],"sources":["../../src/types/filtered-key-path.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"filtered-key-path.d.ts","names":[],"sources":["../../src/types/filtered-key-path.ts"],"mappings":";KAKK,gBAAgB,2BAA2B,GAAG,KAAK,UAAU,OAAO,MAAM,YAAY,GAAG,GAAG;KAC5F,YACD,2BACA,GACA,WACA,QAAQ,OACR,UAAU,eAAe,QAAQ,KAAK,gBAAgB,GAAG;;;;;;;YAUjD,gBAAgB,GAAG,aAAa,UAAU,oBAAoB,MAAM,QAAQ,qBAAqB,KAAK,SAAS,OAAO,SAAS,QAAQ,YAAY,EAAE,IAAI,MAAK,SAAS,MAAM,iBAAiB,GAAG,SAAS,WAAW,MAAM,SAAS,QAAQ,YAAY,EAAE,IAAI,YAAW;KAGhR,QAAQ,UAAU,qCAAqC;KACvD,SAAS,2BAA2B,GAAG,MAAM,qBAAqB,YAAY,GAAG,KAAK,gBAAgB,GAAG,GAAG;KAC5G,wBAED,iBAEA,OACA,uBAGA,WACA;KAKC,SAAS,UAAU,sBAAsB,cAAc"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { FilteredKeyPath } from "./filtered-key-path.js";
|
|
2
2
|
import { Blob as Blob$1, Buffer, File as File$1 } from "node:buffer";
|
|
3
|
-
//#region src/types/index.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* A generic string-keyed object for utility APIs that intentionally accept any value shape.
|
|
6
|
-
*/
|
|
7
|
-
export type AnyRecord = Record<string, any>;
|
|
8
3
|
/**
|
|
9
4
|
* Binary-like inputs accepted by `toBuffer` across browser and Node.js runtimes.
|
|
10
5
|
*/
|
|
@@ -21,10 +16,6 @@ export type MaybePartial<T> = Partial<T> | T;
|
|
|
21
16
|
* Accepts either a mutable value or a readonly view of that value.
|
|
22
17
|
*/
|
|
23
18
|
export type MaybeReadonly<T> = Readonly<T> | T;
|
|
24
|
-
/**
|
|
25
|
-
* Number-like value represented as a number or a numeric string.
|
|
26
|
-
*/
|
|
27
|
-
export type Numberish = number | string;
|
|
28
19
|
/**
|
|
29
20
|
* A `Record` where every key is optional.
|
|
30
21
|
*/
|
|
@@ -37,6 +28,5 @@ export type ReadonlyPartialRecord<K extends keyof any, T> = Readonly<PartialReco
|
|
|
37
28
|
* A readonly `Record`.
|
|
38
29
|
*/
|
|
39
30
|
export type ReadonlyRecord<K extends keyof any, T> = Readonly<Record<K, T>>;
|
|
40
|
-
//#endregion
|
|
41
31
|
export type { FilteredKeyPath };
|
|
42
32
|
//# sourceMappingURL=index.d.ts.map
|