browser-sqlite 1.0.0-rc.4 → 1.0.0-rc.5
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 +66 -430
- package/dist/abandon.d.ts +77 -0
- package/dist/api.d.ts +62 -12
- package/dist/bulk.d.ts +15 -0
- package/dist/client.d.ts +43 -20
- package/dist/delete.d.ts +11 -5
- package/dist/epochs.d.ts +36 -6
- package/dist/errors.d.ts +44 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +96 -0
- package/dist/locks.d.ts +124 -6
- package/dist/pool.d.ts +101 -8
- package/dist/queries.d.ts +36 -7
- package/dist/scheduler.d.ts +14 -0
- package/dist/sqlite-codes.d.ts +154 -0
- package/dist/supervisor.d.ts +1 -1
- package/dist/transaction.d.ts +24 -1
- package/dist/types.d.ts +322 -28
- package/dist/utils.d.ts +42 -2
- package/dist/worker/probes.d.ts +26 -0
- package/dist/worker/sqlite-code.d.ts +9 -0
- package/dist/worker/statement-cache.d.ts +17 -3
- package/dist/worker/worker.js +1 -1
- package/dist/worker/worker.js.map +1 -1
- package/package.json +15 -7
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform features a worker can probe for itself, synchronously, before it
|
|
3
|
+
* loads anything. Pure, and tested in Node for the reason `cloneable.ts` is.
|
|
4
|
+
*
|
|
5
|
+
* `readwrite-unsafe` cannot be probed from the page: `FileSystemSyncAccessHandle`
|
|
6
|
+
* is exposed to dedicated workers only, which is why `capabilities.ts` lists
|
|
7
|
+
* it as unprobeable. A worker can, and without opening a file: the engines that
|
|
8
|
+
* implement the mode also ship the handle's `mode` ATTRIBUTE. That is not the
|
|
9
|
+
* trap `capabilities.ts` warns about — WebIDL ignores an unknown DICTIONARY
|
|
10
|
+
* member, so passing the option proves nothing, but an attribute an engine does
|
|
11
|
+
* not implement is simply absent from the prototype. Measured 2026-09-13 in a
|
|
12
|
+
* dedicated worker: Chromium true, Firefox false, Safari false
|
|
13
|
+
* (spec 2026-09-13, §3.1).
|
|
14
|
+
*/
|
|
15
|
+
import type { PlatformFeature } from '../types';
|
|
16
|
+
/** The globals a probe reads; `globalThis` in a worker, a stub in tests. */
|
|
17
|
+
export type ProbeScope = {
|
|
18
|
+
FileSystemSyncAccessHandle?: unknown;
|
|
19
|
+
};
|
|
20
|
+
export declare const WORKER_PROBES: Partial<Record<PlatformFeature, (scope: ProbeScope) => boolean>>;
|
|
21
|
+
/**
|
|
22
|
+
* The first feature of `features` this worker lacks, or null. A feature with
|
|
23
|
+
* no probe here is never reported missing: declining on something unprobeable
|
|
24
|
+
* would shrink every pool on every engine.
|
|
25
|
+
*/
|
|
26
|
+
export declare const firstMissing: (features: readonly PlatformFeature[], scope?: ProbeScope) => PlatformFeature | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SQLiteResultCode } from '../sqlite-codes';
|
|
2
|
+
/**
|
|
3
|
+
* SQLite's result code on a thrown value, or undefined when SQLite did not
|
|
4
|
+
* raise it (spec 2026-09-14, final review). wa-sqlite raises its own
|
|
5
|
+
* `SQLiteError(message, code)` for every result code. Anything else carrying a
|
|
6
|
+
* numeric `code` — a DOMException's legacy code, 18 for SecurityError — is
|
|
7
|
+
* not SQLite's and must not be published as `sqliteCode`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const sqliteCodeOf: (e: unknown) => SQLiteResultCode | undefined;
|
|
@@ -9,14 +9,28 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/** A `sqlite3_stmt` pointer. Opaque here: the cache only files it. */
|
|
11
11
|
export type StatementHandle = number;
|
|
12
|
+
/**
|
|
13
|
+
* The two bounds, both active. `maxEntries` answers the churn that generated
|
|
14
|
+
* SQL produces; `maxBytes` answers the footprint of a `bulkWrite` template,
|
|
15
|
+
* which is three orders of magnitude heavier than an ordinary statement
|
|
16
|
+
* (`mem:measurements`).
|
|
17
|
+
*/
|
|
18
|
+
export type StatementCacheBounds = {
|
|
19
|
+
maxEntries: number;
|
|
20
|
+
maxBytes: number;
|
|
21
|
+
};
|
|
12
22
|
export type StatementCache = {
|
|
13
23
|
get: (sql: string) => StatementHandle | 'uncacheable' | undefined;
|
|
14
|
-
/**
|
|
15
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Returns the handles evicted by this insertion; the caller finalises them.
|
|
26
|
+
* `weight` is `SQLITE_STMTSTATUS_MEMUSED` and is required on purpose: an
|
|
27
|
+
* optional one would silently account a statement as free.
|
|
28
|
+
*/
|
|
29
|
+
set: (sql: string, handle: StatementHandle, weight: number) => StatementHandle[];
|
|
16
30
|
/** Returns the handles evicted by this marking; the caller finalises them. */
|
|
17
31
|
markUncacheable: (sql: string) => StatementHandle[];
|
|
18
32
|
delete: (sql: string) => StatementHandle | undefined;
|
|
19
33
|
/** Empties the cache and returns every live handle, for close. */
|
|
20
34
|
drain: () => StatementHandle[];
|
|
21
35
|
};
|
|
22
|
-
export declare const createStatementCache: (
|
|
36
|
+
export declare const createStatementCache: ({ maxEntries, maxBytes, }: StatementCacheBounds) => StatementCache;
|