@livestore/utils 0.4.0-dev.8 → 0.4.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/dist/.tsbuildinfo +1 -0
- package/dist/NoopTracer.d.ts.map +1 -1
- package/dist/NoopTracer.js +17 -4
- package/dist/NoopTracer.js.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/binary.js.map +1 -1
- package/dist/browser/Opfs/Opfs.d.ts +51 -0
- package/dist/browser/Opfs/Opfs.d.ts.map +1 -0
- package/dist/browser/Opfs/Opfs.js +345 -0
- package/dist/browser/Opfs/Opfs.js.map +1 -0
- package/dist/browser/Opfs/debug-utils.d.ts +20 -0
- package/dist/browser/Opfs/debug-utils.d.ts.map +1 -0
- package/dist/browser/Opfs/debug-utils.js +94 -0
- package/dist/browser/Opfs/debug-utils.js.map +1 -0
- package/dist/browser/Opfs/mod.d.ts +4 -0
- package/dist/browser/Opfs/mod.d.ts.map +1 -0
- package/dist/browser/Opfs/mod.js +4 -0
- package/dist/browser/Opfs/mod.js.map +1 -0
- package/dist/browser/Opfs/utils.d.ts +71 -0
- package/dist/browser/Opfs/utils.d.ts.map +1 -0
- package/dist/browser/Opfs/utils.js +218 -0
- package/dist/browser/Opfs/utils.js.map +1 -0
- package/dist/browser/QuotaExceededError.d.ts +59 -0
- package/dist/browser/QuotaExceededError.d.ts.map +1 -0
- package/dist/browser/QuotaExceededError.js +2 -0
- package/dist/browser/QuotaExceededError.js.map +1 -0
- package/dist/browser/WebChannelBrowser.d.ts +22 -0
- package/dist/browser/WebChannelBrowser.d.ts.map +1 -0
- package/dist/browser/WebChannelBrowser.js +76 -0
- package/dist/browser/WebChannelBrowser.js.map +1 -0
- package/dist/browser/WebError.d.ts +421 -0
- package/dist/browser/WebError.d.ts.map +1 -0
- package/dist/browser/WebError.js +416 -0
- package/dist/browser/WebError.js.map +1 -0
- package/dist/browser/WebError.test.d.ts +2 -0
- package/dist/browser/WebError.test.d.ts.map +1 -0
- package/dist/browser/WebError.test.js +46 -0
- package/dist/browser/WebError.test.js.map +1 -0
- package/dist/browser/WebLock.d.ts.map +1 -0
- package/dist/{effect → browser}/WebLock.js +9 -9
- package/dist/browser/WebLock.js.map +1 -0
- package/dist/{browser.d.ts → browser/detect.d.ts} +1 -1
- package/dist/browser/detect.d.ts.map +1 -0
- package/dist/{browser.js → browser/detect.js} +7 -7
- package/dist/browser/detect.js.map +1 -0
- package/dist/browser/mod.d.ts +8 -0
- package/dist/browser/mod.d.ts.map +1 -0
- package/dist/browser/mod.js +8 -0
- package/dist/browser/mod.js.map +1 -0
- package/dist/cuid/cuid.browser.js +1 -1
- package/dist/cuid/cuid.browser.js.map +1 -1
- package/dist/cuid/cuid.node.js +1 -1
- package/dist/cuid/cuid.node.js.map +1 -1
- package/dist/effect/BucketQueue.d.ts +1 -1
- package/dist/effect/BucketQueue.d.ts.map +1 -1
- package/dist/effect/BucketQueue.js.map +1 -1
- package/dist/effect/Debug.d.ts +41 -0
- package/dist/effect/Debug.d.ts.map +1 -0
- package/dist/effect/Debug.js +354 -0
- package/dist/effect/Debug.js.map +1 -0
- package/dist/effect/Effect.d.ts +72 -12
- package/dist/effect/Effect.d.ts.map +1 -1
- package/dist/effect/Effect.js +96 -12
- package/dist/effect/Effect.js.map +1 -1
- package/dist/effect/Error.js +1 -1
- package/dist/effect/Error.js.map +1 -1
- package/dist/effect/Logger.js +2 -2
- package/dist/effect/Logger.js.map +1 -1
- package/dist/effect/RpcClient.d.ts.map +1 -1
- package/dist/effect/RpcClient.js +11 -4
- package/dist/effect/RpcClient.js.map +1 -1
- package/dist/effect/Schema/debug-diff.js +5 -4
- package/dist/effect/Schema/debug-diff.js.map +1 -1
- package/dist/effect/Schema/debug-diff.test.js +1 -1
- package/dist/effect/Schema/debug-diff.test.js.map +1 -1
- package/dist/effect/Schema/index.d.ts +5 -3
- package/dist/effect/Schema/index.d.ts.map +1 -1
- package/dist/effect/Schema/index.js +2 -2
- package/dist/effect/Schema/index.js.map +1 -1
- package/dist/effect/ServiceContext.js +6 -6
- package/dist/effect/ServiceContext.js.map +1 -1
- package/dist/effect/Stream.test.js +3 -3
- package/dist/effect/Stream.test.js.map +1 -1
- package/dist/effect/SubscriptionRef.d.ts +4 -4
- package/dist/effect/SubscriptionRef.d.ts.map +1 -1
- package/dist/effect/WebChannel/WebChannel.d.ts +4 -23
- package/dist/effect/WebChannel/WebChannel.d.ts.map +1 -1
- package/dist/effect/WebChannel/WebChannel.js +9 -85
- package/dist/effect/WebChannel/WebChannel.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.test.js +1 -1
- package/dist/effect/WebChannel/WebChannel.test.js.map +1 -1
- package/dist/effect/WebChannel/broadcastChannelWithAck.js +4 -4
- package/dist/effect/WebChannel/broadcastChannelWithAck.js.map +1 -1
- package/dist/effect/WebChannel/common.d.ts +2 -2
- package/dist/effect/WebChannel/common.d.ts.map +1 -1
- package/dist/effect/WebChannel/common.js +2 -2
- package/dist/effect/WebChannel/common.js.map +1 -1
- package/dist/effect/WebSocket.d.ts.map +1 -1
- package/dist/effect/WebSocket.js +14 -14
- package/dist/effect/WebSocket.js.map +1 -1
- package/dist/effect/{index.d.ts → mod.d.ts} +4 -4
- package/dist/effect/mod.d.ts.map +1 -0
- package/dist/effect/{index.js → mod.js} +5 -5
- package/dist/effect/mod.js.map +1 -0
- package/dist/effect/spanEvent.d.ts +12 -0
- package/dist/effect/spanEvent.d.ts.map +1 -0
- package/dist/effect/spanEvent.js +12 -0
- package/dist/effect/spanEvent.js.map +1 -0
- package/dist/effect/spanEvent.test.d.ts +2 -0
- package/dist/effect/spanEvent.test.d.ts.map +1 -0
- package/dist/effect/spanEvent.test.js +82 -0
- package/dist/effect/spanEvent.test.js.map +1 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/fast-deep-equal.js +9 -9
- package/dist/fast-deep-equal.js.map +1 -1
- package/dist/global.d.ts +3 -0
- package/dist/global.d.ts.map +1 -1
- package/dist/global.js.map +1 -1
- package/dist/guards.d.ts +14 -0
- package/dist/guards.d.ts.map +1 -1
- package/dist/guards.js +14 -0
- package/dist/guards.js.map +1 -1
- package/dist/misc.d.ts +9 -1
- package/dist/misc.d.ts.map +1 -1
- package/dist/misc.js +11 -3
- package/dist/misc.js.map +1 -1
- package/dist/mod.d.ts +197 -5
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +162 -17
- package/dist/mod.js.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.d.ts.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js +15 -9
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts +8 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js +16 -17
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts +4 -4
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js +3 -3
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js +4 -4
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js.map +1 -1
- package/dist/node/mod.d.ts +34 -1
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +37 -2
- package/dist/node/mod.js.map +1 -1
- package/dist/object/index.d.ts.map +1 -1
- package/dist/object/index.js.map +1 -1
- package/dist/object/omit.js +1 -1
- package/dist/object/omit.js.map +1 -1
- package/dist/object/stringify-object.js +2 -2
- package/dist/object/stringify-object.js.map +1 -1
- package/dist/object/stringify-object.test.js.map +1 -1
- package/dist/qr.d.ts +38 -0
- package/dist/qr.d.ts.map +1 -0
- package/dist/qr.js +109 -0
- package/dist/qr.js.map +1 -0
- package/dist/set.js +1 -1
- package/dist/set.js.map +1 -1
- package/dist/time.js +1 -1
- package/dist/time.js.map +1 -1
- package/package.json +78 -54
- package/src/NoopTracer.ts +22 -8
- package/src/binary.ts +1 -1
- package/src/browser/Opfs/Opfs.ts +436 -0
- package/src/browser/Opfs/debug-utils.ts +153 -0
- package/src/browser/Opfs/mod.ts +3 -0
- package/src/browser/Opfs/utils.ts +287 -0
- package/src/browser/QuotaExceededError.ts +57 -0
- package/src/browser/WebChannelBrowser.ts +131 -0
- package/src/browser/WebError.test.ts +66 -0
- package/src/browser/WebError.ts +613 -0
- package/src/{effect → browser}/WebLock.ts +15 -15
- package/src/{browser.ts → browser/detect.ts} +6 -6
- package/src/browser/mod.ts +8 -0
- package/src/cuid/cuid.browser.ts +1 -1
- package/src/cuid/cuid.node.ts +1 -1
- package/src/effect/BucketQueue.ts +1 -1
- package/src/effect/Debug.ts +470 -0
- package/src/effect/Effect.ts +118 -36
- package/src/effect/Error.ts +1 -1
- package/src/effect/Logger.ts +2 -2
- package/src/effect/RpcClient.ts +14 -6
- package/src/effect/Schema/debug-diff.test.ts +2 -2
- package/src/effect/Schema/debug-diff.ts +6 -5
- package/src/effect/Schema/index.ts +10 -7
- package/src/effect/ServiceContext.ts +6 -6
- package/src/effect/Stream.test.ts +5 -4
- package/src/effect/SubscriptionRef.ts +5 -5
- package/src/effect/WebChannel/WebChannel.test.ts +1 -1
- package/src/effect/WebChannel/WebChannel.ts +19 -141
- package/src/effect/WebChannel/broadcastChannelWithAck.ts +4 -4
- package/src/effect/WebChannel/common.ts +5 -5
- package/src/effect/WebSocket.ts +13 -12
- package/src/effect/{index.ts → mod.ts} +10 -2
- package/src/effect/spanEvent.test.ts +95 -0
- package/src/effect/spanEvent.ts +15 -0
- package/src/env.ts +2 -1
- package/src/fast-deep-equal.ts +9 -9
- package/src/global.ts +4 -2
- package/src/guards.ts +15 -0
- package/src/misc.ts +12 -4
- package/src/mod.ts +209 -17
- package/src/node/ChildProcessRunner/ChildProcessRunner.ts +23 -10
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.ts +30 -21
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.ts +10 -11
- package/src/node/ChildProcessRunner/ChildProcessWorker.ts +5 -4
- package/src/node/mod.ts +41 -2
- package/src/object/index.ts +1 -1
- package/src/object/omit.ts +1 -1
- package/src/object/stringify-object.test.ts +1 -0
- package/src/object/stringify-object.ts +2 -2
- package/src/qr.ts +125 -0
- package/src/set.ts +1 -1
- package/src/time.ts +1 -1
- package/dist/.tsbuildinfo.json +0 -1
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js.map +0 -1
- package/dist/effect/WebLock.d.ts.map +0 -1
- package/dist/effect/WebLock.js.map +0 -1
- package/dist/effect/index.d.ts.map +0 -1
- package/dist/effect/index.js.map +0 -1
- /package/dist/{effect → browser}/WebLock.d.ts +0 -0
package/dist/qr.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { default as QR } from 'qrcode-generator';
|
|
2
|
+
export type QRErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
|
|
3
|
+
export type PrintQrTerminalOptions = {
|
|
4
|
+
errorCorrectionLevel?: QRErrorCorrectionLevel;
|
|
5
|
+
/** number of white-cell rows/cols around the QR (default 2) */
|
|
6
|
+
margin?: number;
|
|
7
|
+
/** Swap dark/light rendering (default false) */
|
|
8
|
+
invert?: boolean;
|
|
9
|
+
/** Use ANSI colors for compact half-block rendering. Default: auto (true on TTY) */
|
|
10
|
+
useAnsi?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Print a QR code to the terminal using Unicode block characters.
|
|
14
|
+
*
|
|
15
|
+
* Notes
|
|
16
|
+
* - Uses `qrcode-generator` under the hood. `typeNumber` is set to `0` which means
|
|
17
|
+
* “auto-select the smallest QR version (1..40) that fits the data”. Larger versions
|
|
18
|
+
* create larger matrices (each version adds 4 modules per side). See the library:
|
|
19
|
+
* - Types (TypeNumber, ErrorCorrectionLevel):
|
|
20
|
+
* https://unpkg.com/qrcode-generator@2.0.4/dist/qrcode.d.ts
|
|
21
|
+
* - Repository / README:
|
|
22
|
+
* https://github.com/kazuhikoarase/qrcode-generator
|
|
23
|
+
* - Error correction level (ECL) controls how much damage/occlusion can be
|
|
24
|
+
* tolerated by adding redundancy. Higher ECL means bigger codes and lower
|
|
25
|
+
* payload capacity:
|
|
26
|
+
* - L ≈ 7% recovery (highest capacity, lowest redundancy)
|
|
27
|
+
* - M ≈ 15% recovery (balanced, common default)
|
|
28
|
+
* - Q ≈ 25% recovery (more robust in noisy/low-contrast prints)
|
|
29
|
+
* - H ≈ 30% recovery (most robust; largest symbols)
|
|
30
|
+
* Reference: https://www.qrcode.com/en/about/error_correction.html
|
|
31
|
+
* - `small` mode compresses two QR rows into one terminal row using the half-block
|
|
32
|
+
* character `▀` and optional ANSI colors (foreground=top, background=bottom).
|
|
33
|
+
* This roughly halves the height while keeping readability in modern terminals.
|
|
34
|
+
* - The QR “quiet zone” (margin) is important for scanners. If scanning is unreliable,
|
|
35
|
+
* consider increasing `margin` to 2–4.
|
|
36
|
+
*/
|
|
37
|
+
export declare const printQrTerminal: (text: string, options?: PrintQrTerminalOptions) => void;
|
|
38
|
+
//# sourceMappingURL=qr.d.ts.map
|
package/dist/qr.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../src/qr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAEhD,MAAM,MAAM,sBAAsB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAE1D,MAAM,MAAM,sBAAsB,GAAG;IACnC,oBAAoB,CAAC,EAAE,sBAAsB,CAAA;IAC7C,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,UAAU,sBAAsB,KAAG,IAmFhF,CAAA"}
|
package/dist/qr.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import qrcode from 'qrcode-generator';
|
|
2
|
+
export { default as QR } from 'qrcode-generator';
|
|
3
|
+
/**
|
|
4
|
+
* Print a QR code to the terminal using Unicode block characters.
|
|
5
|
+
*
|
|
6
|
+
* Notes
|
|
7
|
+
* - Uses `qrcode-generator` under the hood. `typeNumber` is set to `0` which means
|
|
8
|
+
* “auto-select the smallest QR version (1..40) that fits the data”. Larger versions
|
|
9
|
+
* create larger matrices (each version adds 4 modules per side). See the library:
|
|
10
|
+
* - Types (TypeNumber, ErrorCorrectionLevel):
|
|
11
|
+
* https://unpkg.com/qrcode-generator@2.0.4/dist/qrcode.d.ts
|
|
12
|
+
* - Repository / README:
|
|
13
|
+
* https://github.com/kazuhikoarase/qrcode-generator
|
|
14
|
+
* - Error correction level (ECL) controls how much damage/occlusion can be
|
|
15
|
+
* tolerated by adding redundancy. Higher ECL means bigger codes and lower
|
|
16
|
+
* payload capacity:
|
|
17
|
+
* - L ≈ 7% recovery (highest capacity, lowest redundancy)
|
|
18
|
+
* - M ≈ 15% recovery (balanced, common default)
|
|
19
|
+
* - Q ≈ 25% recovery (more robust in noisy/low-contrast prints)
|
|
20
|
+
* - H ≈ 30% recovery (most robust; largest symbols)
|
|
21
|
+
* Reference: https://www.qrcode.com/en/about/error_correction.html
|
|
22
|
+
* - `small` mode compresses two QR rows into one terminal row using the half-block
|
|
23
|
+
* character `▀` and optional ANSI colors (foreground=top, background=bottom).
|
|
24
|
+
* This roughly halves the height while keeping readability in modern terminals.
|
|
25
|
+
* - The QR “quiet zone” (margin) is important for scanners. If scanning is unreliable,
|
|
26
|
+
* consider increasing `margin` to 2–4.
|
|
27
|
+
*/
|
|
28
|
+
export const printQrTerminal = (text, options) => {
|
|
29
|
+
const ec = options?.errorCorrectionLevel ?? 'M';
|
|
30
|
+
const margin = options?.margin ?? 2;
|
|
31
|
+
const invert = options?.invert ?? false;
|
|
32
|
+
// Auto-enable ANSI on TTY; avoid in browsers
|
|
33
|
+
const useAnsi = options?.useAnsi ?? (typeof process !== 'undefined' && !!process?.stdout?.isTTY);
|
|
34
|
+
// Create the QR code. `0` means: choose the smallest possible version automatically.
|
|
35
|
+
// Error correction level (L/M/Q/H) trades capacity for redundancy.
|
|
36
|
+
const qr = qrcode(0, ec);
|
|
37
|
+
qr.addData(text);
|
|
38
|
+
qr.make();
|
|
39
|
+
const size = qr.getModuleCount();
|
|
40
|
+
// Helper: read a module, applying margin and optional inversion.
|
|
41
|
+
// qrcode-generator’s `isDark` signature is (row, col) i.e. (y, x).
|
|
42
|
+
const isDarkAt = (x, y) => {
|
|
43
|
+
const row = y - margin;
|
|
44
|
+
const col = x - margin;
|
|
45
|
+
if (row < 0 || col < 0 || row >= size || col >= size)
|
|
46
|
+
return false;
|
|
47
|
+
const bit = qr.isDark(row, col);
|
|
48
|
+
return invert === true ? !bit : bit;
|
|
49
|
+
};
|
|
50
|
+
const lines = [];
|
|
51
|
+
// Compact rendering: combine two QR rows into one terminal row using half-blocks.
|
|
52
|
+
// With ANSI enabled: use `▀` and paint top as FG, bottom as BG (clear and crisp).
|
|
53
|
+
// Without ANSI: fall back to block chars (`█`, `▀`, `▄`, space). Note that the
|
|
54
|
+
// non-ANSI fallback cannot enforce a white background on dark themes, which may
|
|
55
|
+
// reduce scanner reliability—prefer ANSI when possible.
|
|
56
|
+
const width = size + 2 * margin;
|
|
57
|
+
const height = size + 2 * margin;
|
|
58
|
+
// ANSI helpers (only used when enabled)
|
|
59
|
+
// Use bright white for a strong “paper-like” background on dark terminals.
|
|
60
|
+
const RESET = '\x1b[0m';
|
|
61
|
+
const FG_BLACK = '\x1b[30m';
|
|
62
|
+
const FG_WHITE = '\x1b[97m';
|
|
63
|
+
const BG_BLACK = '\x1b[40m';
|
|
64
|
+
const BG_WHITE = '\x1b[107m';
|
|
65
|
+
for (let y = 0; y < height; y += 2) {
|
|
66
|
+
let row = '';
|
|
67
|
+
let currentStyle = '';
|
|
68
|
+
const setStyle = (style) => {
|
|
69
|
+
if (style !== currentStyle) {
|
|
70
|
+
if (currentStyle !== undefined)
|
|
71
|
+
row += RESET;
|
|
72
|
+
if (style !== undefined)
|
|
73
|
+
row += style;
|
|
74
|
+
currentStyle = style;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
for (let x = 0; x < width; x++) {
|
|
78
|
+
const top = isDarkAt(x, y);
|
|
79
|
+
const bottom = isDarkAt(x, y + 1);
|
|
80
|
+
if (useAnsi === true) {
|
|
81
|
+
// Represent two stacked modules with a single `▀` character.
|
|
82
|
+
// Foreground corresponds to the top pixel; background to the bottom pixel.
|
|
83
|
+
// Always paint both halves to enforce a white quiet zone even on dark terminals.
|
|
84
|
+
const fg = top === true ? FG_BLACK : FG_WHITE;
|
|
85
|
+
const bg = bottom === true ? BG_BLACK : BG_WHITE;
|
|
86
|
+
setStyle(fg + bg);
|
|
87
|
+
row += '▀';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// No ANSI: approximate using block characters.
|
|
91
|
+
let ch = ' ';
|
|
92
|
+
if (top === true && bottom === true)
|
|
93
|
+
ch = '█';
|
|
94
|
+
else if (top === true && bottom === false)
|
|
95
|
+
ch = '▀';
|
|
96
|
+
else if (top === false && bottom === true)
|
|
97
|
+
ch = '▄';
|
|
98
|
+
row += ch;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (useAnsi === true) {
|
|
102
|
+
if (currentStyle !== undefined)
|
|
103
|
+
row += RESET;
|
|
104
|
+
}
|
|
105
|
+
lines.push(row);
|
|
106
|
+
}
|
|
107
|
+
console.log(lines.join('\n'));
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=qr.js.map
|
package/dist/qr.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr.js","sourceRoot":"","sources":["../src/qr.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAA;AAErC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAchD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,OAAgC,EAAQ,EAAE;IACtF,MAAM,EAAE,GAA2B,OAAO,EAAE,oBAAoB,IAAI,GAAG,CAAA;IACvE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,CAAC,CAAA;IACnC,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,KAAK,CAAA;IACvC,6CAA6C;IAC7C,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,CAAC,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,CAAE,OAAe,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAEzG,qFAAqF;IACrF,mEAAmE;IACnE,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACxB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,EAAE,CAAC,IAAI,EAAE,CAAA;IAET,MAAM,IAAI,GAAG,EAAE,CAAC,cAAc,EAAE,CAAA;IAEhC,iEAAiE;IACjE,mEAAmE;IACnE,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,EAAW,EAAE;QACjD,MAAM,GAAG,GAAG,CAAC,GAAG,MAAM,CAAA;QACtB,MAAM,GAA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AC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/B,CAAC,CAAA"}
|
package/dist/set.js
CHANGED
package/dist/set.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.js","sourceRoot":"","sources":["../src/set.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,CAAS,EAAE,CAAS,EAAE,EAAE;IACpD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAK,CAAA;IACzB,KAAK,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"set.js","sourceRoot":"","sources":["../src/set.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,CAAS,EAAE,CAAS,EAAE,EAAE;IACpD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAK,CAAA;IACzB,KAAK,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
package/dist/time.js
CHANGED
|
@@ -14,7 +14,7 @@ export const msAsTimeString = (ms) => {
|
|
|
14
14
|
const hours = Math.floor(minutes / 60);
|
|
15
15
|
const remainingSeconds = (seconds % 60).toString().padStart(2, '0');
|
|
16
16
|
const remainingMinutes = hours > 0 ? (minutes % 60).toString().padStart(2, '0') : minutes % 60;
|
|
17
|
-
const timeString = [hours > 0 ? `${hours}:` : '', `${remainingMinutes}:`,
|
|
17
|
+
const timeString = [hours > 0 ? `${hours}:` : '', `${remainingMinutes}:`, remainingSeconds]
|
|
18
18
|
.filter((val) => val !== '')
|
|
19
19
|
.join('');
|
|
20
20
|
return timeString;
|
package/dist/time.js.map
CHANG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;SACxF,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC;SAC3B,IAAI,CAAC,EAAE,CAAC,CAAA;IAEX,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/utils",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/livestorejs/livestore.git"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"package.json",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
4
14
|
"type": "module",
|
|
5
15
|
"sideEffects": [
|
|
6
16
|
"./src/global.ts",
|
|
7
17
|
"./dist/global.js"
|
|
8
18
|
],
|
|
19
|
+
"react-native": "./dist/index.js",
|
|
9
20
|
"exports": {
|
|
10
21
|
".": {
|
|
11
22
|
"types": "./dist/mod.d.ts",
|
|
12
23
|
"default": "./dist/mod.js"
|
|
13
24
|
},
|
|
25
|
+
"./browser": {
|
|
26
|
+
"types": "./dist/browser/mod.d.ts",
|
|
27
|
+
"default": "./dist/browser/mod.js"
|
|
28
|
+
},
|
|
14
29
|
"./cuid": {
|
|
15
30
|
"types": "./dist/cuid/cuid.node.d.ts",
|
|
16
31
|
"browser": "./dist/cuid/cuid.browser.js",
|
|
@@ -22,8 +37,12 @@
|
|
|
22
37
|
"default": "./dist/nanoid/index.js"
|
|
23
38
|
},
|
|
24
39
|
"./effect": {
|
|
25
|
-
"types": "./dist/effect/
|
|
26
|
-
"default": "./dist/effect/
|
|
40
|
+
"types": "./dist/effect/mod.d.ts",
|
|
41
|
+
"default": "./dist/effect/mod.js"
|
|
42
|
+
},
|
|
43
|
+
"./effect/browser": {
|
|
44
|
+
"types": "./dist/browser/mod.d.ts",
|
|
45
|
+
"default": "./dist/browser/mod.js"
|
|
27
46
|
},
|
|
28
47
|
"./node": {
|
|
29
48
|
"types": "./dist/node/mod.d.ts",
|
|
@@ -34,67 +53,72 @@
|
|
|
34
53
|
"default": "./dist/bun/mod.js"
|
|
35
54
|
}
|
|
36
55
|
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
37
59
|
"dependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
40
|
-
"
|
|
60
|
+
"@effect/platform-node": "0.106.0",
|
|
61
|
+
"@standard-schema/spec": "1.1.0",
|
|
62
|
+
"nanoid": "5.0.9",
|
|
63
|
+
"pretty-bytes": "7.0.1",
|
|
64
|
+
"qrcode-generator": "2.0.4"
|
|
41
65
|
},
|
|
42
66
|
"devDependencies": {
|
|
43
|
-
"@effect/ai": "
|
|
44
|
-
"@effect/cli": "
|
|
45
|
-
"@effect/cluster": "
|
|
46
|
-
"@effect/experimental": "
|
|
47
|
-
"@effect/opentelemetry": "0.
|
|
48
|
-
"@effect/platform": "
|
|
49
|
-
"@effect/platform-browser": "
|
|
50
|
-
"@effect/platform-bun": "
|
|
51
|
-
"@effect/platform-node": "
|
|
52
|
-
"@effect/printer": "
|
|
53
|
-
"@effect/printer-ansi": "
|
|
54
|
-
"@effect/rpc": "
|
|
55
|
-
"@effect/sql": "
|
|
56
|
-
"@effect/typeclass": "
|
|
57
|
-
"@effect/vitest": "
|
|
58
|
-
"@effect/workflow": "
|
|
67
|
+
"@effect/ai": "0.35.0",
|
|
68
|
+
"@effect/cli": "0.75.1",
|
|
69
|
+
"@effect/cluster": "0.58.2",
|
|
70
|
+
"@effect/experimental": "0.60.0",
|
|
71
|
+
"@effect/opentelemetry": "0.63.0",
|
|
72
|
+
"@effect/platform": "0.96.1",
|
|
73
|
+
"@effect/platform-browser": "0.76.0",
|
|
74
|
+
"@effect/platform-bun": "0.89.0",
|
|
75
|
+
"@effect/platform-node": "0.106.0",
|
|
76
|
+
"@effect/printer": "0.49.0",
|
|
77
|
+
"@effect/printer-ansi": "0.49.0",
|
|
78
|
+
"@effect/rpc": "0.75.1",
|
|
79
|
+
"@effect/sql": "0.51.1",
|
|
80
|
+
"@effect/typeclass": "0.40.0",
|
|
81
|
+
"@effect/vitest": "0.29.0",
|
|
82
|
+
"@effect/workflow": "0.18.0",
|
|
59
83
|
"@opentelemetry/api": "1.9.0",
|
|
60
|
-
"@opentelemetry/resources": "
|
|
61
|
-
"@
|
|
62
|
-
"@types/
|
|
63
|
-
"@types/
|
|
64
|
-
"@types/
|
|
65
|
-
"
|
|
66
|
-
"
|
|
84
|
+
"@opentelemetry/resources": "2.2.0",
|
|
85
|
+
"@standard-schema/spec": "1.1.0",
|
|
86
|
+
"@types/bun": "1.3.10",
|
|
87
|
+
"@types/jsdom": "21.1.7",
|
|
88
|
+
"@types/node": "25.3.3",
|
|
89
|
+
"@types/web": "0.0.264",
|
|
90
|
+
"effect": "3.21.2",
|
|
91
|
+
"jsdom": "26.1.0",
|
|
67
92
|
"vitest": "3.2.4"
|
|
68
93
|
},
|
|
69
|
-
"files": [
|
|
70
|
-
"package.json",
|
|
71
|
-
"src",
|
|
72
|
-
"dist"
|
|
73
|
-
],
|
|
74
|
-
"license": "Apache-2.0",
|
|
75
94
|
"peerDependencies": {
|
|
76
|
-
"@effect/ai": "^0.
|
|
77
|
-
"@effect/cli": "^0.
|
|
78
|
-
"@effect/cluster": "^0.
|
|
79
|
-
"@effect/experimental": "^0.
|
|
80
|
-
"@effect/opentelemetry": "^0.
|
|
81
|
-
"@effect/platform": "^0.
|
|
82
|
-
"@effect/platform-browser": "^0.
|
|
83
|
-
"@effect/platform-bun": "^0.
|
|
84
|
-
"@effect/platform-node": "^0.
|
|
85
|
-
"@effect/printer": "^0.
|
|
86
|
-
"@effect/printer-ansi": "^0.
|
|
87
|
-
"@effect/rpc": "^0.
|
|
88
|
-
"@effect/sql": "^0.
|
|
89
|
-
"@effect/typeclass": "^0.
|
|
95
|
+
"@effect/ai": "^0.35.0",
|
|
96
|
+
"@effect/cli": "^0.75.1",
|
|
97
|
+
"@effect/cluster": "^0.58.2",
|
|
98
|
+
"@effect/experimental": "^0.60.0",
|
|
99
|
+
"@effect/opentelemetry": "^0.63.0",
|
|
100
|
+
"@effect/platform": "^0.96.1",
|
|
101
|
+
"@effect/platform-browser": "^0.76.0",
|
|
102
|
+
"@effect/platform-bun": "^0.89.0",
|
|
103
|
+
"@effect/platform-node": "^0.106.0",
|
|
104
|
+
"@effect/printer": "^0.49.0",
|
|
105
|
+
"@effect/printer-ansi": "^0.49.0",
|
|
106
|
+
"@effect/rpc": "^0.75.1",
|
|
107
|
+
"@effect/sql": "^0.51.1",
|
|
108
|
+
"@effect/typeclass": "^0.40.0",
|
|
109
|
+
"@effect/vitest": "^0.29.0",
|
|
90
110
|
"@opentelemetry/api": "^1.9.0",
|
|
91
|
-
"@opentelemetry/resources": "^2.0
|
|
92
|
-
"
|
|
111
|
+
"@opentelemetry/resources": "^2.2.0",
|
|
112
|
+
"@standard-schema/spec": "^1.1.0",
|
|
113
|
+
"effect": "^3.21.2"
|
|
93
114
|
},
|
|
94
|
-
"
|
|
95
|
-
"
|
|
115
|
+
"$genie": {
|
|
116
|
+
"source": "package.json.genie.ts",
|
|
117
|
+
"warning": "DO NOT EDIT - changes will be overwritten",
|
|
118
|
+
"workspaceClosureDirs": [
|
|
119
|
+
"packages/@livestore/utils"
|
|
120
|
+
]
|
|
96
121
|
},
|
|
97
|
-
"react-native": "./dist/index.js",
|
|
98
122
|
"scripts": {
|
|
99
123
|
"test": "vitest"
|
|
100
124
|
}
|
package/src/NoopTracer.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/** biome-ignore-all lint/complexity/noArguments: using arguments is fine here */
|
|
2
|
+
|
|
2
3
|
import type * as otel from '@opentelemetry/api'
|
|
3
4
|
|
|
5
|
+
import { cuid } from '@livestore/utils/cuid'
|
|
6
|
+
|
|
4
7
|
export const makeNoopSpan = () => {
|
|
5
|
-
const performanceStartTime
|
|
8
|
+
const performanceStartTime = performance.now()
|
|
6
9
|
|
|
7
|
-
const
|
|
10
|
+
const spanImpl = {
|
|
8
11
|
_performanceStartTime: performanceStartTime,
|
|
9
12
|
setAttribute: () => null,
|
|
10
13
|
setAttributes: () => null,
|
|
@@ -14,22 +17,27 @@ export const makeNoopSpan = () => {
|
|
|
14
17
|
updateName: () => null,
|
|
15
18
|
recordException: () => null,
|
|
16
19
|
end: () => {
|
|
17
|
-
const endTime
|
|
20
|
+
const endTime = performance.now()
|
|
18
21
|
const duration = endTime - performanceStartTime
|
|
19
22
|
const durationSecs = duration / 1000
|
|
20
23
|
const durationRestNs = (duration % 1000) * 1_000_000
|
|
21
|
-
|
|
24
|
+
spanImpl._duration = [durationSecs, durationRestNs] as [number, number]
|
|
22
25
|
},
|
|
23
26
|
spanContext: () => {
|
|
24
|
-
return {
|
|
27
|
+
return {
|
|
28
|
+
traceId: `livestore-noop-trace-id${cuid()}`,
|
|
29
|
+
spanId: `livestore-noop-span-id${cuid()}`,
|
|
30
|
+
}
|
|
25
31
|
},
|
|
26
|
-
_duration: [0, 0],
|
|
27
|
-
}
|
|
32
|
+
_duration: [0, 0] as [number, number],
|
|
33
|
+
}
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- noop otel.Span implementation; only implements the subset needed by LiveStore
|
|
36
|
+
return spanImpl as unknown as otel.Span
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
export const makeNoopTracer = () => {
|
|
40
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- noop otel.Tracer implementation; only implements the subset needed by LiveStore
|
|
33
41
|
return new NoopTracer() as unknown as otel.Tracer
|
|
34
42
|
}
|
|
35
43
|
|
|
@@ -61,13 +69,19 @@ export class NoopTracer {
|
|
|
61
69
|
if (arguments.length < 2) {
|
|
62
70
|
return
|
|
63
71
|
} else if (arguments.length === 2) {
|
|
72
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- arguments-based overload dispatch: with 2 args, arg2 is the callback
|
|
64
73
|
fn = arg2 as F
|
|
65
74
|
} else if (arguments.length === 3) {
|
|
75
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- arguments-based overload dispatch: with 3 args, arg2 is SpanOptions
|
|
66
76
|
_opts = arg2 as otel.SpanOptions | undefined
|
|
77
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- arguments-based overload dispatch: with 3 args, arg3 is the callback
|
|
67
78
|
fn = arg3 as F
|
|
68
79
|
} else {
|
|
80
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- arguments-based overload dispatch: with 4 args, arg2 is SpanOptions
|
|
69
81
|
_opts = arg2 as otel.SpanOptions | undefined
|
|
82
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- arguments-based overload dispatch: with 4 args, arg3 is Context
|
|
70
83
|
_ctx = arg3 as otel.Context | undefined
|
|
84
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- arguments-based overload dispatch: with 4 args, arg4 is the callback
|
|
71
85
|
fn = arg4 as F
|
|
72
86
|
}
|
|
73
87
|
|
package/src/binary.ts
CHANGED
|
@@ -35,7 +35,7 @@ export const isUint8ArrayBuffer = (array: Uint8Array): array is Uint8Array<Array
|
|
|
35
35
|
* Safer alternative to type assertions.
|
|
36
36
|
*/
|
|
37
37
|
export const toUint8ArrayBuffer = (array: Uint8Array): Uint8Array<ArrayBuffer> => {
|
|
38
|
-
if (isUint8ArrayBuffer(array)) {
|
|
38
|
+
if (isUint8ArrayBuffer(array) === true) {
|
|
39
39
|
return array
|
|
40
40
|
}
|
|
41
41
|
// Copy to ensure ArrayBuffer backing
|