@dxos/log-store-idb 0.8.4-main.fdfb99ef29 → 0.9.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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +62 -53
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +62 -53
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/idb-log-store.d.ts +10 -8
- package/dist/types/src/idb-log-store.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/idb-log-store.browser.test.ts +102 -1
- package/src/idb-log-store.ts +102 -66
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -39,6 +39,7 @@ var DEFAULT_FLUSH_BATCH_SIZE = 500;
|
|
|
39
39
|
var DEFAULT_MAX_RECORDS = 15e4;
|
|
40
40
|
var DEFAULT_EVICTION_INTERVAL = 3e4;
|
|
41
41
|
var EVICTION_LOCK_NAME = "@dxos/log-store-idb:evictor";
|
|
42
|
+
var DB_VERSION = 2;
|
|
42
43
|
var IdbLogStore = class {
|
|
43
44
|
#dbName;
|
|
44
45
|
#storeName;
|
|
@@ -48,8 +49,11 @@ var IdbLogStore = class {
|
|
|
48
49
|
#evictionInterval;
|
|
49
50
|
#tabId;
|
|
50
51
|
#filters;
|
|
52
|
+
/** Distinguishes chunk keys written by concurrent contexts against the same database. */
|
|
53
|
+
#writerId = Math.random().toString(36).slice(2);
|
|
51
54
|
#queue = [];
|
|
52
|
-
#
|
|
55
|
+
#writerSeq = 0;
|
|
56
|
+
#flushTask;
|
|
53
57
|
#evictionTimer;
|
|
54
58
|
#pendingFlush;
|
|
55
59
|
#db;
|
|
@@ -88,9 +92,9 @@ var IdbLogStore = class {
|
|
|
88
92
|
this.#queue.push(line);
|
|
89
93
|
if (this.#queue.length >= this.#flushBatchSize) {
|
|
90
94
|
void this.flush();
|
|
91
|
-
} else if (this.#
|
|
92
|
-
this.#
|
|
93
|
-
this.#
|
|
95
|
+
} else if (this.#flushTask === void 0) {
|
|
96
|
+
this.#flushTask = scheduleBackgroundTask(() => {
|
|
97
|
+
this.#flushTask = void 0;
|
|
94
98
|
void this.flush();
|
|
95
99
|
}, this.#flushInterval);
|
|
96
100
|
}
|
|
@@ -100,9 +104,9 @@ var IdbLogStore = class {
|
|
|
100
104
|
* Concurrent calls share a single in-flight flush.
|
|
101
105
|
*/
|
|
102
106
|
async flush() {
|
|
103
|
-
if (this.#
|
|
104
|
-
|
|
105
|
-
this.#
|
|
107
|
+
if (this.#flushTask !== void 0) {
|
|
108
|
+
this.#flushTask.cancel();
|
|
109
|
+
this.#flushTask = void 0;
|
|
106
110
|
}
|
|
107
111
|
if (this.#pendingFlush) {
|
|
108
112
|
return this.#pendingFlush;
|
|
@@ -126,20 +130,21 @@ var IdbLogStore = class {
|
|
|
126
130
|
async export(options = {}) {
|
|
127
131
|
await this.flush();
|
|
128
132
|
const db = await this.#open();
|
|
129
|
-
const
|
|
133
|
+
const chunks = await readAllChunks(db, this.#storeName);
|
|
130
134
|
if (options.maxSize !== void 0 && options.maxSize >= 0) {
|
|
135
|
+
const lines = chunks.flatMap((chunk) => chunk.split("\n"));
|
|
131
136
|
return trimJsonlToSize(lines, options.maxSize);
|
|
132
137
|
}
|
|
133
|
-
return
|
|
138
|
+
return chunks.join("\n");
|
|
134
139
|
}
|
|
135
140
|
/**
|
|
136
141
|
* Discard all stored log records.
|
|
137
142
|
*/
|
|
138
143
|
async clear() {
|
|
139
144
|
this.#queue = [];
|
|
140
|
-
if (this.#
|
|
141
|
-
|
|
142
|
-
this.#
|
|
145
|
+
if (this.#flushTask !== void 0) {
|
|
146
|
+
this.#flushTask.cancel();
|
|
147
|
+
this.#flushTask = void 0;
|
|
143
148
|
}
|
|
144
149
|
const db = await this.#open();
|
|
145
150
|
await runTransaction(db, this.#storeName, "readwrite", (store) => {
|
|
@@ -188,13 +193,17 @@ var IdbLogStore = class {
|
|
|
188
193
|
return;
|
|
189
194
|
}
|
|
190
195
|
try {
|
|
196
|
+
const chunk = {
|
|
197
|
+
lines: batch.join("\n")
|
|
198
|
+
};
|
|
199
|
+
const key = [
|
|
200
|
+
Date.now(),
|
|
201
|
+
this.#writerId,
|
|
202
|
+
this.#writerSeq++,
|
|
203
|
+
batch.length
|
|
204
|
+
];
|
|
191
205
|
await runTransaction(db, this.#storeName, "readwrite", (store) => {
|
|
192
|
-
|
|
193
|
-
const row = {
|
|
194
|
-
line
|
|
195
|
-
};
|
|
196
|
-
store.add(row);
|
|
197
|
-
}
|
|
206
|
+
store.add(chunk, key);
|
|
198
207
|
});
|
|
199
208
|
} catch {
|
|
200
209
|
}
|
|
@@ -256,13 +265,9 @@ var IdbLogStore = class {
|
|
|
256
265
|
} catch {
|
|
257
266
|
return;
|
|
258
267
|
}
|
|
259
|
-
const count = await runTransaction(db, this.#storeName, "readonly", (store) => promisifyRequest(store.count()));
|
|
260
|
-
if (count <= this.#maxRecords) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
const toDelete = count - this.#maxRecords;
|
|
264
268
|
await runTransaction(db, this.#storeName, "readwrite", async (store) => {
|
|
265
|
-
const
|
|
269
|
+
const keys = await promisifyRequest(store.getAllKeys());
|
|
270
|
+
const cutoff = findEvictionCutoff(keys, this.#maxRecords);
|
|
266
271
|
if (cutoff !== void 0) {
|
|
267
272
|
store.delete(IDBKeyRange.upperBound(cutoff));
|
|
268
273
|
}
|
|
@@ -299,15 +304,13 @@ var IdbLogStore = class {
|
|
|
299
304
|
};
|
|
300
305
|
var openDatabase = (name, storeName) => {
|
|
301
306
|
return new Promise((resolve, reject) => {
|
|
302
|
-
const request = indexedDB.open(name,
|
|
307
|
+
const request = indexedDB.open(name, DB_VERSION);
|
|
303
308
|
request.onupgradeneeded = () => {
|
|
304
309
|
const db = request.result;
|
|
305
|
-
if (
|
|
306
|
-
db.
|
|
307
|
-
keyPath: "seq",
|
|
308
|
-
autoIncrement: true
|
|
309
|
-
});
|
|
310
|
+
if (db.objectStoreNames.contains(storeName)) {
|
|
311
|
+
db.deleteObjectStore(storeName);
|
|
310
312
|
}
|
|
313
|
+
db.createObjectStore(storeName);
|
|
311
314
|
};
|
|
312
315
|
request.onsuccess = () => resolve(request.result);
|
|
313
316
|
request.onerror = () => reject(request.error);
|
|
@@ -363,32 +366,38 @@ var runTransaction = (db, storeName, mode, body) => {
|
|
|
363
366
|
}
|
|
364
367
|
});
|
|
365
368
|
};
|
|
366
|
-
var
|
|
367
|
-
return runTransaction(db, storeName, "readonly", (store) => promisifyRequest(store.getAll()).then((rows) => rows.map((row) => row.
|
|
369
|
+
var readAllChunks = async (db, storeName) => {
|
|
370
|
+
return runTransaction(db, storeName, "readonly", (store) => promisifyRequest(store.getAll()).then((rows) => rows.map((row) => row.lines)));
|
|
368
371
|
};
|
|
369
|
-
var
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
var findEvictionCutoff = (keys, maxRecords) => {
|
|
373
|
+
let retained = 0;
|
|
374
|
+
for (let index = keys.length - 1; index >= 0; index--) {
|
|
375
|
+
const [, , , lineCount] = keys[index];
|
|
376
|
+
retained += lineCount;
|
|
377
|
+
if (retained > maxRecords && index < keys.length - 1) {
|
|
378
|
+
return keys[index];
|
|
374
379
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
380
|
+
}
|
|
381
|
+
return void 0;
|
|
382
|
+
};
|
|
383
|
+
var scheduleBackgroundTask = (callback, delay) => {
|
|
384
|
+
const scheduler = globalThis.scheduler;
|
|
385
|
+
if (typeof scheduler?.postTask === "function") {
|
|
386
|
+
const controller = new AbortController();
|
|
387
|
+
scheduler.postTask(callback, {
|
|
388
|
+
priority: "background",
|
|
389
|
+
delay,
|
|
390
|
+
signal: controller.signal
|
|
391
|
+
}).catch(() => {
|
|
392
|
+
});
|
|
393
|
+
return {
|
|
394
|
+
cancel: () => controller.abort()
|
|
389
395
|
};
|
|
390
|
-
|
|
391
|
-
|
|
396
|
+
}
|
|
397
|
+
const timer = setTimeout(callback, delay);
|
|
398
|
+
return {
|
|
399
|
+
cancel: () => clearTimeout(timer)
|
|
400
|
+
};
|
|
392
401
|
};
|
|
393
402
|
export {
|
|
394
403
|
IdbLogStore,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/idb-log-store.ts", "../../../src/trim.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport {\n type LogConfig,\n type LogEntry,\n type LogFilter,\n type LogProcessor,\n inferEnvironmentName,\n parseFilter,\n serializeToJsonl,\n shouldLog,\n} from '@dxos/log';\n\nimport { trimJsonlToSize } from './trim';\n\nconst DEFAULT_STORE_NAME = 'logs';\nconst DEFAULT_LOG_FILTER = 'debug';\nconst DEFAULT_FLUSH_INTERVAL = 250;\nconst DEFAULT_FLUSH_BATCH_SIZE = 500;\n// Sized for ~50 MB on disk at the observed Composer average of ~350 bytes per JSONL line.\n// Adjust `maxRecords` if your workload's per-entry size differs significantly.\nconst DEFAULT_MAX_RECORDS = 150_000;\nconst DEFAULT_EVICTION_INTERVAL = 30_000;\nconst EVICTION_LOCK_NAME = '@dxos/log-store-idb:evictor';\n\n/**\n * Stored log row. The line is pre-encoded JSONL (no trailing newline).\n */\ntype LogRow = {\n /** Auto-incremented sequence (commit order). */\n seq?: number;\n /** Encoded JSONL line. */\n line: string;\n};\n\nexport type IdbLogStoreOptions = {\n /** Name of the IndexedDB database. */\n dbName: string;\n /** Object store name. Default `'logs'`. */\n storeName?: string;\n /** Auto-flush interval in milliseconds. Default `250`. */\n flushInterval?: number;\n /** Auto-flush when in-memory queue reaches this size. Default `500`. */\n flushBatchSize?: number;\n /**\n * Soft cap on retained records. Older rows are evicted past this. Default `150_000`,\n * sized for roughly 50 MB on disk at typical JSONL line sizes (~350 bytes average\n * observed in the Composer app).\n */\n maxRecords?: number;\n /** Eviction sweep interval in milliseconds. Default `30_000`. */\n evictionInterval?: number;\n /**\n * Identifier embedded in every record's `i` field.\n * Defaults to a scope-aware id of the form `<scope>:<name>:<suffix>` — see {@link inferEnvironmentName}.\n */\n tabId?: string;\n /**\n * Same syntax as `DX_LOG` / {@link parseFilter} (e.g. `debug`, `info`, `pattern:warn`).\n * Entries below the minimum level are not stored. Default `debug` (TRACE is excluded).\n */\n logFilter?: string;\n};\n\n/**\n * IndexedDB-backed log store.\n *\n * Logs are batched in memory and flushed to IndexedDB as pre-encoded JSONL strings.\n * Multiple browsing contexts can write to the same database concurrently — IDB\n * serializes transactions, so no extra coordination is needed for writes.\n * Eviction is deduplicated across tabs via the Web Locks API (`ifAvailable`).\n *\n * Flushes are triggered by:\n * - the configured interval timer,\n * - the queue exceeding `flushBatchSize`,\n * - `visibilitychange` to `hidden` and `pagehide` events.\n */\nexport class IdbLogStore {\n readonly #dbName: string;\n readonly #storeName: string;\n readonly #flushInterval: number;\n readonly #flushBatchSize: number;\n readonly #maxRecords: number;\n readonly #evictionInterval: number;\n readonly #tabId: string;\n readonly #filters: LogFilter[];\n\n #queue: string[] = [];\n #flushTimer: ReturnType<typeof setTimeout> | undefined;\n #evictionTimer: ReturnType<typeof setInterval> | undefined;\n #pendingFlush: Promise<void> | undefined;\n #db: IDBDatabase | undefined;\n #dbPromise: Promise<IDBDatabase> | undefined;\n #closed = false;\n #pageHideHandler: (() => void) | undefined;\n #visibilityHandler: (() => void) | undefined;\n\n constructor(options: IdbLogStoreOptions) {\n this.#dbName = options.dbName;\n this.#storeName = options.storeName ?? DEFAULT_STORE_NAME;\n this.#flushInterval = options.flushInterval ?? DEFAULT_FLUSH_INTERVAL;\n this.#flushBatchSize = options.flushBatchSize ?? DEFAULT_FLUSH_BATCH_SIZE;\n this.#maxRecords = options.maxRecords ?? DEFAULT_MAX_RECORDS;\n this.#evictionInterval = options.evictionInterval ?? DEFAULT_EVICTION_INTERVAL;\n this.#tabId = options.tabId ?? inferEnvironmentName();\n this.#filters = parseFilter(options.logFilter ?? DEFAULT_LOG_FILTER);\n\n this.#installLifecycleHandlers();\n this.#scheduleEviction();\n }\n\n /**\n * Log processor — register via `log.addProcessor(store.processor)`.\n */\n readonly processor: LogProcessor = (_config: LogConfig, entry: LogEntry) => {\n if (this.#closed) {\n return;\n }\n if (!shouldLog(entry, this.#filters)) {\n return;\n }\n const line = serializeToJsonl(entry, { env: this.#tabId });\n if (line === undefined) {\n return;\n }\n this.#queue.push(line);\n\n if (this.#queue.length >= this.#flushBatchSize) {\n void this.flush();\n } else if (this.#flushTimer === undefined) {\n this.#flushTimer = setTimeout(() => {\n this.#flushTimer = undefined;\n void this.flush();\n }, this.#flushInterval);\n }\n };\n\n /**\n * Force a flush now and resolve once the IDB transaction commits.\n * Concurrent calls share a single in-flight flush.\n */\n async flush(): Promise<void> {\n if (this.#flushTimer !== undefined) {\n clearTimeout(this.#flushTimer);\n this.#flushTimer = undefined;\n }\n if (this.#pendingFlush) {\n return this.#pendingFlush;\n }\n if (this.#queue.length === 0) {\n return;\n }\n\n const batch = this.#queue;\n this.#queue = [];\n\n this.#pendingFlush = this.#writeBatch(batch).finally(() => {\n this.#pendingFlush = undefined;\n });\n return this.#pendingFlush;\n }\n\n /**\n * Read all retained log lines as a JSONL string.\n *\n * If `maxSize` is provided (in bytes), the newest lines are kept and older lines\n * are dropped from the front; lines are never split.\n */\n async export(options: { maxSize?: number } = {}): Promise<string> {\n await this.flush();\n const db = await this.#open();\n const lines = await readAllLines(db, this.#storeName);\n if (options.maxSize !== undefined && options.maxSize >= 0) {\n return trimJsonlToSize(lines, options.maxSize);\n }\n return lines.join('\\n');\n }\n\n /**\n * Discard all stored log records.\n */\n async clear(): Promise<void> {\n this.#queue = [];\n if (this.#flushTimer !== undefined) {\n clearTimeout(this.#flushTimer);\n this.#flushTimer = undefined;\n }\n const db = await this.#open();\n await runTransaction(db, this.#storeName, 'readwrite', (store) => {\n store.clear();\n });\n }\n\n /**\n * Run an eviction sweep now: trim the store down to `maxRecords` if it has grown past.\n * Eviction runs automatically on a timer; this method is exposed for tests and for\n * callers that want to force a sweep at a particular moment.\n */\n async evictNow(): Promise<void> {\n await this.#maybeEvict();\n }\n\n /**\n * Stop timers, flush remaining entries, and close the database connection.\n */\n async close(): Promise<void> {\n if (this.#closed) {\n return;\n }\n this.#closed = true;\n\n if (this.#evictionTimer !== undefined) {\n clearInterval(this.#evictionTimer);\n this.#evictionTimer = undefined;\n }\n this.#removeLifecycleHandlers();\n\n try {\n await this.flush();\n } catch {\n // Ignore flush errors during shutdown.\n }\n\n if (this.#db) {\n this.#db.close();\n this.#db = undefined;\n this.#dbPromise = undefined;\n }\n }\n\n async #writeBatch(batch: string[]): Promise<void> {\n if (batch.length === 0) {\n return;\n }\n let db: IDBDatabase;\n try {\n db = await this.#open();\n } catch {\n // If the database can't be opened, drop the batch silently — logs must never\n // throw out of the processor path.\n return;\n }\n\n try {\n await runTransaction(db, this.#storeName, 'readwrite', (store) => {\n for (const line of batch) {\n const row: LogRow = { line };\n store.add(row);\n }\n });\n } catch {\n // Ignore write errors.\n }\n }\n\n async #open(): Promise<IDBDatabase> {\n if (this.#db) {\n return this.#db;\n }\n if (!this.#dbPromise) {\n this.#dbPromise = openDatabase(this.#dbName, this.#storeName).then((db) => {\n this.#db = db;\n db.onclose = () => {\n if (this.#db === db) {\n this.#db = undefined;\n this.#dbPromise = undefined;\n }\n };\n db.onversionchange = () => {\n db.close();\n };\n return db;\n });\n }\n return this.#dbPromise;\n }\n\n #scheduleEviction(): void {\n if (this.#evictionInterval <= 0) {\n return;\n }\n this.#evictionTimer = setInterval(() => {\n void this.#maybeEvict();\n }, this.#evictionInterval);\n }\n\n async #maybeEvict(): Promise<void> {\n if (this.#closed) {\n return;\n }\n const locks = (globalThis as any).navigator?.locks as LockManager | undefined;\n if (locks?.request) {\n try {\n await locks.request(EVICTION_LOCK_NAME, { ifAvailable: true }, async (lock) => {\n if (!lock) {\n return;\n }\n await this.#evict();\n });\n return;\n } catch {\n // Fall through to direct eviction if locks fail.\n }\n }\n await this.#evict();\n }\n\n async #evict(): Promise<void> {\n let db: IDBDatabase;\n try {\n db = await this.#open();\n } catch {\n return;\n }\n\n const count = await runTransaction(db, this.#storeName, 'readonly', (store) => promisifyRequest(store.count()));\n if (count <= this.#maxRecords) {\n return;\n }\n\n const toDelete = count - this.#maxRecords;\n await runTransaction(db, this.#storeName, 'readwrite', async (store) => {\n const cutoff = await findCutoffKey(store, toDelete);\n if (cutoff !== undefined) {\n store.delete(IDBKeyRange.upperBound(cutoff));\n }\n });\n }\n\n #installLifecycleHandlers(): void {\n if (typeof globalThis.addEventListener !== 'function') {\n return;\n }\n this.#pageHideHandler = () => {\n void this.flush();\n };\n this.#visibilityHandler = () => {\n if ((globalThis as any).document?.visibilityState === 'hidden') {\n void this.flush();\n }\n };\n globalThis.addEventListener('pagehide', this.#pageHideHandler);\n globalThis.addEventListener('visibilitychange', this.#visibilityHandler);\n }\n\n #removeLifecycleHandlers(): void {\n if (typeof globalThis.removeEventListener !== 'function') {\n return;\n }\n if (this.#pageHideHandler) {\n globalThis.removeEventListener('pagehide', this.#pageHideHandler);\n this.#pageHideHandler = undefined;\n }\n if (this.#visibilityHandler) {\n globalThis.removeEventListener('visibilitychange', this.#visibilityHandler);\n this.#visibilityHandler = undefined;\n }\n }\n}\n\nconst openDatabase = (name: string, storeName: string): Promise<IDBDatabase> => {\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(name, 1);\n request.onupgradeneeded = () => {\n const db = request.result;\n if (!db.objectStoreNames.contains(storeName)) {\n db.createObjectStore(storeName, { keyPath: 'seq', autoIncrement: true });\n }\n };\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n request.onblocked = () => reject(new Error('IndexedDB open blocked'));\n });\n};\n\nconst promisifyRequest = <T>(request: IDBRequest<T>): Promise<T> =>\n new Promise((resolve, reject) => {\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n\nconst runTransaction = <T>(\n db: IDBDatabase,\n storeName: string,\n mode: IDBTransactionMode,\n body: (store: IDBObjectStore) => T | Promise<T>,\n): Promise<T> => {\n return new Promise<T>((resolve, reject) => {\n let tx: IDBTransaction;\n try {\n tx = db.transaction(storeName, mode);\n } catch (err) {\n reject(err);\n return;\n }\n let result: T;\n let bodySettled = false;\n let bodyError: unknown;\n\n tx.oncomplete = () => {\n if (bodyError !== undefined) {\n reject(bodyError);\n } else if (bodySettled) {\n resolve(result);\n } else {\n // Body never settled (shouldn't happen in practice).\n reject(new Error('transaction body did not settle'));\n }\n };\n tx.onerror = () => reject(tx.error);\n tx.onabort = () => reject(tx.error ?? new Error('transaction aborted'));\n\n try {\n const store = tx.objectStore(storeName);\n const value = body(store);\n Promise.resolve(value)\n .then((resolved) => {\n result = resolved;\n bodySettled = true;\n })\n .catch((err) => {\n bodyError = err;\n try {\n tx.abort();\n } catch {\n // Already settled.\n }\n });\n } catch (err) {\n bodyError = err;\n try {\n tx.abort();\n } catch {\n // Ignore.\n }\n }\n });\n};\n\nconst readAllLines = async (db: IDBDatabase, storeName: string): Promise<string[]> => {\n return runTransaction(db, storeName, 'readonly', (store) =>\n promisifyRequest(store.getAll()).then((rows) => (rows as LogRow[]).map((row) => row.line)),\n );\n};\n\n/**\n * Walk the store in key order and return the key of the `count`-th entry.\n * Returns `undefined` if the store has fewer than `count` entries.\n */\nconst findCutoffKey = (store: IDBObjectStore, count: number): Promise<IDBValidKey | undefined> => {\n return new Promise((resolve, reject) => {\n if (count <= 0) {\n resolve(undefined);\n return;\n }\n const request = store.openKeyCursor();\n let advanced = false;\n request.onsuccess = () => {\n const cursor = request.result;\n if (!cursor) {\n resolve(undefined);\n return;\n }\n if (!advanced && count > 1) {\n advanced = true;\n cursor.advance(count - 1);\n return;\n }\n resolve(cursor.key);\n };\n request.onerror = () => reject(request.error);\n });\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\n/**\n * Trim a list of pre-encoded JSONL lines so the joined output (with `\\n` separators)\n * fits within `maxSize` bytes (UTF-8). The newest lines (end of array) are preferred —\n * lines are dropped from the start. Never cuts inside a line.\n *\n * Returns the trimmed JSONL string (no trailing newline).\n */\nexport const trimJsonlToSize = (lines: readonly string[], maxSize: number): string => {\n if (lines.length === 0 || maxSize <= 0) {\n return '';\n }\n\n const sizes = lines.map((line) => byteLengthUtf8(line));\n\n // Walk newest -> oldest, accumulating until next addition would exceed maxSize.\n let total = 0;\n let firstIncludedIndex = lines.length;\n for (let index = lines.length - 1; index >= 0; index--) {\n const lineBytes = sizes[index];\n const sepBytes = total === 0 ? 0 : 1;\n if (total + lineBytes + sepBytes > maxSize) {\n break;\n }\n total += lineBytes + sepBytes;\n firstIncludedIndex = index;\n }\n\n if (firstIncludedIndex >= lines.length) {\n return '';\n }\n return lines.slice(firstIncludedIndex).join('\\n');\n};\n\nconst utf8Encoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined;\n\nconst byteLengthUtf8 = (value: string): number => {\n if (utf8Encoder) {\n return utf8Encoder.encode(value).length;\n }\n // Fallback: assume 1 byte per char (good enough for ASCII-heavy log lines).\n return value.length;\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAKEA,sBACAC,aACAC,kBACAC,iBACK;;;ACFA,IAAMC,kBAAkB,CAACC,OAA0BC,YAAAA;AACxD,MAAID,MAAME,WAAW,KAAKD,WAAW,GAAG;AACtC,WAAO;EACT;AAEA,QAAME,QAAQH,MAAMI,IAAI,CAACC,SAASC,eAAeD,IAAAA,CAAAA;AAGjD,MAAIE,QAAQ;AACZ,MAAIC,qBAAqBR,MAAME;AAC/B,WAASO,QAAQT,MAAME,SAAS,GAAGO,SAAS,GAAGA,SAAS;AACtD,UAAMC,YAAYP,MAAMM,KAAAA;AACxB,UAAME,WAAWJ,UAAU,IAAI,IAAI;AACnC,QAAIA,QAAQG,YAAYC,WAAWV,SAAS;AAC1C;IACF;AACAM,aAASG,YAAYC;AACrBH,yBAAqBC;EACvB;AAEA,MAAID,sBAAsBR,MAAME,QAAQ;AACtC,WAAO;EACT;AACA,SAAOF,MAAMY,MAAMJ,kBAAAA,EAAoBK,KAAK,IAAA;AAC9C;AAEA,IAAMC,cAAc,OAAOC,gBAAgB,cAAc,IAAIA,YAAAA,IAAgBC;AAE7E,IAAMV,iBAAiB,CAACW,UAAAA;AACtB,MAAIH,aAAa;AACf,WAAOA,YAAYI,OAAOD,KAAAA,EAAOf;EACnC;AAEA,SAAOe,MAAMf;AACf;;;AD5BA,IAAMiB,qBAAqB;AAC3B,IAAMC,qBAAqB;AAC3B,IAAMC,yBAAyB;AAC/B,IAAMC,2BAA2B;AAGjC,IAAMC,sBAAsB;AAC5B,IAAMC,4BAA4B;AAClC,IAAMC,qBAAqB;
|
|
6
|
-
"names": ["inferEnvironmentName", "parseFilter", "serializeToJsonl", "shouldLog", "trimJsonlToSize", "lines", "maxSize", "length", "sizes", "map", "line", "byteLengthUtf8", "total", "firstIncludedIndex", "index", "lineBytes", "sepBytes", "slice", "join", "utf8Encoder", "TextEncoder", "undefined", "value", "encode", "DEFAULT_STORE_NAME", "DEFAULT_LOG_FILTER", "DEFAULT_FLUSH_INTERVAL", "DEFAULT_FLUSH_BATCH_SIZE", "DEFAULT_MAX_RECORDS", "DEFAULT_EVICTION_INTERVAL", "EVICTION_LOCK_NAME", "IdbLogStore", "options", "dbName", "storeName", "flushInterval", "flushBatchSize", "maxRecords", "evictionInterval", "tabId", "inferEnvironmentName", "parseFilter", "logFilter", "processor", "_config", "entry", "shouldLog", "line", "serializeToJsonl", "env", "undefined", "push", "length", "flush", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport {\n type LogConfig,\n type LogEntry,\n type LogFilter,\n type LogProcessor,\n inferEnvironmentName,\n parseFilter,\n serializeToJsonl,\n shouldLog,\n} from '@dxos/log';\n\nimport { trimJsonlToSize } from './trim';\n\nconst DEFAULT_STORE_NAME = 'logs';\nconst DEFAULT_LOG_FILTER = 'debug';\nconst DEFAULT_FLUSH_INTERVAL = 250;\nconst DEFAULT_FLUSH_BATCH_SIZE = 500;\n// Sized for ~50 MB on disk at the observed Composer average of ~350 bytes per JSONL line.\n// Adjust `maxRecords` if your workload's per-entry size differs significantly.\nconst DEFAULT_MAX_RECORDS = 150_000;\nconst DEFAULT_EVICTION_INTERVAL = 30_000;\nconst EVICTION_LOCK_NAME = '@dxos/log-store-idb:evictor';\n// v2 introduced chunked rows with out-of-line array keys (v1 stored one row per line\n// under an autoincrement keyPath).\nconst DB_VERSION = 2;\n\n/**\n * Chunk key: `[epochMs, writerId, writerSeq, lineCount]`.\n *\n * Keys order chunks by flush time; `writerId`/`writerSeq` keep keys from concurrent\n * writers unique. `lineCount` rides in the key so eviction can compute the retention\n * budget from `getAllKeys()` alone, without deserializing chunk values.\n */\ntype ChunkKey = [epochMs: number, writerId: string, writerSeq: number, lineCount: number];\n\n/**\n * Stored row: one flush batch of pre-encoded JSONL lines joined with `\\n` (no trailing\n * newline). Storing the whole batch as a single record keeps the per-flush cost at one\n * structured clone and one backend record regardless of batch size.\n */\ntype LogChunk = {\n lines: string;\n};\n\nexport type IdbLogStoreOptions = {\n /** Name of the IndexedDB database. */\n dbName: string;\n /** Object store name. Default `'logs'`. */\n storeName?: string;\n /** Auto-flush interval in milliseconds. Default `250`. */\n flushInterval?: number;\n /** Auto-flush when in-memory queue reaches this size. Default `500`. */\n flushBatchSize?: number;\n /**\n * Soft cap on retained log records (JSONL lines). Eviction drops whole flush chunks,\n * oldest first; the newest chunk is always retained. Default `150_000`, sized for\n * roughly 50 MB on disk at typical JSONL line sizes (~350 bytes average observed in\n * the Composer app).\n */\n maxRecords?: number;\n /** Eviction sweep interval in milliseconds. Default `30_000`. */\n evictionInterval?: number;\n /**\n * Identifier embedded in every record's `i` field.\n * Defaults to a scope-aware id of the form `<scope>:<name>:<suffix>` — see {@link inferEnvironmentName}.\n */\n tabId?: string;\n /**\n * Same syntax as `DX_LOG` / {@link parseFilter} (e.g. `debug`, `info`, `pattern:warn`).\n * Entries below the minimum level are not stored. Default `debug` (TRACE is excluded).\n */\n logFilter?: string;\n};\n\n/**\n * IndexedDB-backed log store.\n *\n * Logs are batched in memory and each flush is written as a single chunk record of\n * pre-encoded JSONL. Multiple browsing contexts can write to the same database\n * concurrently — IDB serializes transactions, so no extra coordination is needed for\n * writes. Eviction is deduplicated across tabs via the Web Locks API (`ifAvailable`).\n *\n * Flushes are triggered by:\n * - a deferred task after `flushInterval` (background priority where the Scheduler API\n * is available, so flushes don't compete with input handling and rendering),\n * - the queue exceeding `flushBatchSize`,\n * - `visibilitychange` to `hidden` and `pagehide` events.\n */\nexport class IdbLogStore {\n readonly #dbName: string;\n readonly #storeName: string;\n readonly #flushInterval: number;\n readonly #flushBatchSize: number;\n readonly #maxRecords: number;\n readonly #evictionInterval: number;\n readonly #tabId: string;\n readonly #filters: LogFilter[];\n /** Distinguishes chunk keys written by concurrent contexts against the same database. */\n readonly #writerId = Math.random().toString(36).slice(2);\n\n #queue: string[] = [];\n #writerSeq = 0;\n #flushTask: ScheduledTask | undefined;\n #evictionTimer: ReturnType<typeof setInterval> | undefined;\n #pendingFlush: Promise<void> | undefined;\n #db: IDBDatabase | undefined;\n #dbPromise: Promise<IDBDatabase> | undefined;\n #closed = false;\n #pageHideHandler: (() => void) | undefined;\n #visibilityHandler: (() => void) | undefined;\n\n constructor(options: IdbLogStoreOptions) {\n this.#dbName = options.dbName;\n this.#storeName = options.storeName ?? DEFAULT_STORE_NAME;\n this.#flushInterval = options.flushInterval ?? DEFAULT_FLUSH_INTERVAL;\n this.#flushBatchSize = options.flushBatchSize ?? DEFAULT_FLUSH_BATCH_SIZE;\n this.#maxRecords = options.maxRecords ?? DEFAULT_MAX_RECORDS;\n this.#evictionInterval = options.evictionInterval ?? DEFAULT_EVICTION_INTERVAL;\n this.#tabId = options.tabId ?? inferEnvironmentName();\n this.#filters = parseFilter(options.logFilter ?? DEFAULT_LOG_FILTER);\n\n this.#installLifecycleHandlers();\n this.#scheduleEviction();\n }\n\n /**\n * Log processor — register via `log.addProcessor(store.processor)`.\n */\n readonly processor: LogProcessor = (_config: LogConfig, entry: LogEntry) => {\n if (this.#closed) {\n return;\n }\n if (!shouldLog(entry, this.#filters)) {\n return;\n }\n const line = serializeToJsonl(entry, { env: this.#tabId });\n if (line === undefined) {\n return;\n }\n this.#queue.push(line);\n\n if (this.#queue.length >= this.#flushBatchSize) {\n void this.flush();\n } else if (this.#flushTask === undefined) {\n this.#flushTask = scheduleBackgroundTask(() => {\n this.#flushTask = undefined;\n void this.flush();\n }, this.#flushInterval);\n }\n };\n\n /**\n * Force a flush now and resolve once the IDB transaction commits.\n * Concurrent calls share a single in-flight flush.\n */\n async flush(): Promise<void> {\n if (this.#flushTask !== undefined) {\n this.#flushTask.cancel();\n this.#flushTask = undefined;\n }\n if (this.#pendingFlush) {\n return this.#pendingFlush;\n }\n if (this.#queue.length === 0) {\n return;\n }\n\n const batch = this.#queue;\n this.#queue = [];\n\n this.#pendingFlush = this.#writeBatch(batch).finally(() => {\n this.#pendingFlush = undefined;\n });\n return this.#pendingFlush;\n }\n\n /**\n * Read all retained log lines as a JSONL string.\n *\n * If `maxSize` is provided (in bytes), the newest lines are kept and older lines\n * are dropped from the front; lines are never split.\n */\n async export(options: { maxSize?: number } = {}): Promise<string> {\n await this.flush();\n const db = await this.#open();\n const chunks = await readAllChunks(db, this.#storeName);\n if (options.maxSize !== undefined && options.maxSize >= 0) {\n // Trim on individual lines so the size cap never under-fills by a whole chunk.\n const lines = chunks.flatMap((chunk) => chunk.split('\\n'));\n return trimJsonlToSize(lines, options.maxSize);\n }\n return chunks.join('\\n');\n }\n\n /**\n * Discard all stored log records.\n */\n async clear(): Promise<void> {\n this.#queue = [];\n if (this.#flushTask !== undefined) {\n this.#flushTask.cancel();\n this.#flushTask = undefined;\n }\n const db = await this.#open();\n await runTransaction(db, this.#storeName, 'readwrite', (store) => {\n store.clear();\n });\n }\n\n /**\n * Run an eviction sweep now: trim the store down to `maxRecords` if it has grown past.\n * Eviction runs automatically on a timer; this method is exposed for tests and for\n * callers that want to force a sweep at a particular moment.\n */\n async evictNow(): Promise<void> {\n await this.#maybeEvict();\n }\n\n /**\n * Stop timers, flush remaining entries, and close the database connection.\n */\n async close(): Promise<void> {\n if (this.#closed) {\n return;\n }\n this.#closed = true;\n\n if (this.#evictionTimer !== undefined) {\n clearInterval(this.#evictionTimer);\n this.#evictionTimer = undefined;\n }\n this.#removeLifecycleHandlers();\n\n try {\n await this.flush();\n } catch {\n // Ignore flush errors during shutdown.\n }\n\n if (this.#db) {\n this.#db.close();\n this.#db = undefined;\n this.#dbPromise = undefined;\n }\n }\n\n async #writeBatch(batch: string[]): Promise<void> {\n if (batch.length === 0) {\n return;\n }\n let db: IDBDatabase;\n try {\n db = await this.#open();\n } catch {\n // If the database can't be opened, drop the batch silently — logs must never\n // throw out of the processor path.\n return;\n }\n\n try {\n const chunk: LogChunk = { lines: batch.join('\\n') };\n const key: ChunkKey = [Date.now(), this.#writerId, this.#writerSeq++, batch.length];\n await runTransaction(db, this.#storeName, 'readwrite', (store) => {\n store.add(chunk, key);\n });\n } catch {\n // Ignore write errors.\n }\n }\n\n async #open(): Promise<IDBDatabase> {\n if (this.#db) {\n return this.#db;\n }\n if (!this.#dbPromise) {\n this.#dbPromise = openDatabase(this.#dbName, this.#storeName).then((db) => {\n this.#db = db;\n db.onclose = () => {\n if (this.#db === db) {\n this.#db = undefined;\n this.#dbPromise = undefined;\n }\n };\n db.onversionchange = () => {\n db.close();\n };\n return db;\n });\n }\n return this.#dbPromise;\n }\n\n #scheduleEviction(): void {\n if (this.#evictionInterval <= 0) {\n return;\n }\n this.#evictionTimer = setInterval(() => {\n void this.#maybeEvict();\n }, this.#evictionInterval);\n }\n\n async #maybeEvict(): Promise<void> {\n if (this.#closed) {\n return;\n }\n const locks = (globalThis as any).navigator?.locks as LockManager | undefined;\n if (locks?.request) {\n try {\n await locks.request(EVICTION_LOCK_NAME, { ifAvailable: true }, async (lock) => {\n if (!lock) {\n return;\n }\n await this.#evict();\n });\n return;\n } catch {\n // Fall through to direct eviction if locks fail.\n }\n }\n await this.#evict();\n }\n\n async #evict(): Promise<void> {\n let db: IDBDatabase;\n try {\n db = await this.#open();\n } catch {\n return;\n }\n\n await runTransaction(db, this.#storeName, 'readwrite', async (store) => {\n // Keys carry per-chunk line counts, so the retention budget is computed from\n // getAllKeys() alone — no count() pre-pass and no chunk values are read.\n // Cast: IDB types keys as IDBValidKey[]; this store only ever receives ChunkKey keys.\n const keys = (await promisifyRequest(store.getAllKeys())) as ChunkKey[];\n const cutoff = findEvictionCutoff(keys, this.#maxRecords);\n if (cutoff !== undefined) {\n store.delete(IDBKeyRange.upperBound(cutoff));\n }\n });\n }\n\n #installLifecycleHandlers(): void {\n if (typeof globalThis.addEventListener !== 'function') {\n return;\n }\n this.#pageHideHandler = () => {\n void this.flush();\n };\n this.#visibilityHandler = () => {\n if ((globalThis as any).document?.visibilityState === 'hidden') {\n void this.flush();\n }\n };\n globalThis.addEventListener('pagehide', this.#pageHideHandler);\n globalThis.addEventListener('visibilitychange', this.#visibilityHandler);\n }\n\n #removeLifecycleHandlers(): void {\n if (typeof globalThis.removeEventListener !== 'function') {\n return;\n }\n if (this.#pageHideHandler) {\n globalThis.removeEventListener('pagehide', this.#pageHideHandler);\n this.#pageHideHandler = undefined;\n }\n if (this.#visibilityHandler) {\n globalThis.removeEventListener('visibilitychange', this.#visibilityHandler);\n this.#visibilityHandler = undefined;\n }\n }\n}\n\nconst openDatabase = (name: string, storeName: string): Promise<IDBDatabase> => {\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(name, DB_VERSION);\n request.onupgradeneeded = () => {\n const db = request.result;\n // The v1 schema stored one row per line under an autoincrement keyPath; chunked\n // storage requires out-of-line keys, so the store is recreated and v1 data is\n // discarded (logs are expendable diagnostics).\n if (db.objectStoreNames.contains(storeName)) {\n db.deleteObjectStore(storeName);\n }\n db.createObjectStore(storeName);\n };\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n request.onblocked = () => reject(new Error('IndexedDB open blocked'));\n });\n};\n\nconst promisifyRequest = <T>(request: IDBRequest<T>): Promise<T> =>\n new Promise((resolve, reject) => {\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n\nconst runTransaction = <T>(\n db: IDBDatabase,\n storeName: string,\n mode: IDBTransactionMode,\n body: (store: IDBObjectStore) => T | Promise<T>,\n): Promise<T> => {\n return new Promise<T>((resolve, reject) => {\n let tx: IDBTransaction;\n try {\n tx = db.transaction(storeName, mode);\n } catch (err) {\n reject(err);\n return;\n }\n let result: T;\n let bodySettled = false;\n let bodyError: unknown;\n\n tx.oncomplete = () => {\n if (bodyError !== undefined) {\n reject(bodyError);\n } else if (bodySettled) {\n resolve(result);\n } else {\n // Body never settled (shouldn't happen in practice).\n reject(new Error('transaction body did not settle'));\n }\n };\n tx.onerror = () => reject(tx.error);\n tx.onabort = () => reject(tx.error ?? new Error('transaction aborted'));\n\n try {\n const store = tx.objectStore(storeName);\n const value = body(store);\n Promise.resolve(value)\n .then((resolved) => {\n result = resolved;\n bodySettled = true;\n })\n .catch((err) => {\n bodyError = err;\n try {\n tx.abort();\n } catch {\n // Already settled.\n }\n });\n } catch (err) {\n bodyError = err;\n try {\n tx.abort();\n } catch {\n // Ignore.\n }\n }\n });\n};\n\nconst readAllChunks = async (db: IDBDatabase, storeName: string): Promise<string[]> => {\n return runTransaction(db, storeName, 'readonly', (store) =>\n promisifyRequest(store.getAll()).then((rows) => (rows as LogChunk[]).map((row) => row.lines)),\n );\n};\n\n/**\n * Given all chunk keys in ascending (key) order, return the key of the newest chunk that\n * must be evicted — delete it and everything older — so the retained line total stays\n * within `maxRecords`. The newest chunk is always retained, even if it alone exceeds the\n * budget. Returns `undefined` when everything fits.\n */\nconst findEvictionCutoff = (keys: readonly ChunkKey[], maxRecords: number): ChunkKey | undefined => {\n let retained = 0;\n for (let index = keys.length - 1; index >= 0; index--) {\n const [, , , lineCount] = keys[index];\n retained += lineCount;\n if (retained > maxRecords && index < keys.length - 1) {\n return keys[index];\n }\n }\n return undefined;\n};\n\ntype ScheduledTask = { cancel: () => void };\n\ntype SchedulerLike = {\n postTask: (\n callback: () => void,\n options?: { priority?: 'background' | 'user-visible' | 'user-blocking'; delay?: number; signal?: AbortSignal },\n ) => Promise<unknown>;\n};\n\n/**\n * Run `callback` after `delay` ms at background priority where the Scheduler API is\n * available, so deferred work yields to input handling and rendering; falls back to a\n * plain timeout elsewhere.\n */\nconst scheduleBackgroundTask = (callback: () => void, delay: number): ScheduledTask => {\n // The Scheduler API is not in the TS DOM lib yet.\n const scheduler = (globalThis as { scheduler?: SchedulerLike }).scheduler;\n if (typeof scheduler?.postTask === 'function') {\n const controller = new AbortController();\n scheduler.postTask(callback, { priority: 'background', delay, signal: controller.signal }).catch(() => {\n // Rejects on abort; the callback never ran.\n });\n return { cancel: () => controller.abort() };\n }\n const timer = setTimeout(callback, delay);\n return { cancel: () => clearTimeout(timer) };\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\n/**\n * Trim a list of pre-encoded JSONL lines so the joined output (with `\\n` separators)\n * fits within `maxSize` bytes (UTF-8). The newest lines (end of array) are preferred —\n * lines are dropped from the start. Never cuts inside a line.\n *\n * Returns the trimmed JSONL string (no trailing newline).\n */\nexport const trimJsonlToSize = (lines: readonly string[], maxSize: number): string => {\n if (lines.length === 0 || maxSize <= 0) {\n return '';\n }\n\n const sizes = lines.map((line) => byteLengthUtf8(line));\n\n // Walk newest -> oldest, accumulating until next addition would exceed maxSize.\n let total = 0;\n let firstIncludedIndex = lines.length;\n for (let index = lines.length - 1; index >= 0; index--) {\n const lineBytes = sizes[index];\n const sepBytes = total === 0 ? 0 : 1;\n if (total + lineBytes + sepBytes > maxSize) {\n break;\n }\n total += lineBytes + sepBytes;\n firstIncludedIndex = index;\n }\n\n if (firstIncludedIndex >= lines.length) {\n return '';\n }\n return lines.slice(firstIncludedIndex).join('\\n');\n};\n\nconst utf8Encoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined;\n\nconst byteLengthUtf8 = (value: string): number => {\n if (utf8Encoder) {\n return utf8Encoder.encode(value).length;\n }\n // Fallback: assume 1 byte per char (good enough for ASCII-heavy log lines).\n return value.length;\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAKEA,sBACAC,aACAC,kBACAC,iBACK;;;ACFA,IAAMC,kBAAkB,CAACC,OAA0BC,YAAAA;AACxD,MAAID,MAAME,WAAW,KAAKD,WAAW,GAAG;AACtC,WAAO;EACT;AAEA,QAAME,QAAQH,MAAMI,IAAI,CAACC,SAASC,eAAeD,IAAAA,CAAAA;AAGjD,MAAIE,QAAQ;AACZ,MAAIC,qBAAqBR,MAAME;AAC/B,WAASO,QAAQT,MAAME,SAAS,GAAGO,SAAS,GAAGA,SAAS;AACtD,UAAMC,YAA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AACJ,MAA2BrD,eAAAA;AACrD,MAAIoG,WAAW;AACf,WAASC,QAAQhD,KAAKtC,SAAS,GAAGsF,SAAS,GAAGA,SAAS;AACrD,UAAM,CAAA,EAAA,EAAA,EAAOC,SAAAA,IAAajD,KAAKgD,KAAAA;AAC/BD,gBAAYE;AACZ,QAAIF,WAAWpG,cAAcqG,QAAQhD,KAAKtC,SAAS,GAAG;AACpD,aAAOsC,KAAKgD,KAAAA;IACd;EACF;AACA,SAAOxF;AACT;AAgBA,IAAMI,yBAAyB,CAACsF,UAAsBC,UAAAA;AAEpD,QAAMC,YAAazD,WAA6CyD;AAChE,MAAI,OAAOA,WAAWC,aAAa,YAAY;AAC7C,UAAMC,aAAa,IAAIC,gBAAAA;AACvBH,cAAUC,SAASH,UAAU;MAAEM,UAAU;MAAcL;MAAOM,QAAQH,WAAWG;IAAO,CAAA,EAAGhB,MAAM,MAAA;IAEjG,CAAA;AACA,WAAO;MAAE5E,QAAQ,MAAMyF,WAAWZ,MAAK;IAAG;EAC5C;AACA,QAAMgB,QAAQC,WAAWT,UAAUC,KAAAA;AACnC,SAAO;IAAEtF,QAAQ,MAAM+F,aAAaF,KAAAA;EAAO;AAC7C;",
|
|
6
|
+
"names": ["inferEnvironmentName", "parseFilter", "serializeToJsonl", "shouldLog", "trimJsonlToSize", "lines", "maxSize", "length", "sizes", "map", "line", "byteLengthUtf8", "total", "firstIncludedIndex", "index", "lineBytes", "sepBytes", "slice", "join", "utf8Encoder", "TextEncoder", "undefined", "value", "encode", "DEFAULT_STORE_NAME", "DEFAULT_LOG_FILTER", "DEFAULT_FLUSH_INTERVAL", "DEFAULT_FLUSH_BATCH_SIZE", "DEFAULT_MAX_RECORDS", "DEFAULT_EVICTION_INTERVAL", "EVICTION_LOCK_NAME", "DB_VERSION", "IdbLogStore", "Math", "random", "toString", "slice", "options", "dbName", "storeName", "flushInterval", "flushBatchSize", "maxRecords", "evictionInterval", "tabId", "inferEnvironmentName", "parseFilter", "logFilter", "processor", "_config", "entry", "shouldLog", "line", "serializeToJsonl", "env", "undefined", "push", "length", "flush", "scheduleBackgroundTask", "cancel", "batch", "finally", "export", "db", "chunks", "readAllChunks", "maxSize", "lines", "flatMap", "chunk", "split", "trimJsonlToSize", "join", "clear", "runTransaction", "store", "evictNow", "close", "clearInterval", "key", "Date", "now", "add", "openDatabase", "then", "onclose", "onversionchange", "setInterval", "locks", "globalThis", "navigator", "request", "ifAvailable", "lock", "keys", "promisifyRequest", "getAllKeys", "cutoff", "findEvictionCutoff", "delete", "IDBKeyRange", "upperBound", "addEventListener", "document", "visibilityState", "removeEventListener", "name", "Promise", "resolve", "reject", "indexedDB", "open", "onupgradeneeded", "result", "objectStoreNames", "contains", "deleteObjectStore", "createObjectStore", "onsuccess", "onerror", "error", "onblocked", "Error", "mode", "body", "tx", "transaction", "err", "bodySettled", "bodyError", "oncomplete", "onabort", "objectStore", "value", "resolved", "catch", "abort", "getAll", "rows", "map", "row", "retained", "index", "lineCount", "callback", "delay", "scheduler", "postTask", "controller", "AbortController", "priority", "signal", "timer", "setTimeout", "clearTimeout"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/trim.ts":{"bytes":4813,"imports":[],"format":"esm"},"src/idb-log-store.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/trim.ts":{"bytes":4813,"imports":[],"format":"esm"},"src/idb-log-store.ts":{"bytes":50603,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/trim.ts","kind":"import-statement","original":"./trim"}],"format":"esm"},"src/index.ts":{"bytes":469,"imports":[{"path":"src/idb-log-store.ts","kind":"import-statement","original":"./idb-log-store"},{"path":"src/trim.ts","kind":"import-statement","original":"./trim"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27664},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["IdbLogStore","trimJsonlToSize"],"entryPoint":"src/index.ts","inputs":{"src/idb-log-store.ts":{"bytesInOutput":10167},"src/trim.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0}},"bytes":11146}}}
|