@aztec/kv-store 0.0.1-commit.3fd054f6 → 0.0.1-commit.431c48d

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.
Files changed (145) hide show
  1. package/README.md +10 -1
  2. package/dest/bench/shared_map_bench.d.ts +19 -0
  3. package/dest/bench/shared_map_bench.d.ts.map +1 -0
  4. package/dest/bench/shared_map_bench.js +91 -0
  5. package/dest/deprecated/indexeddb/array.d.ts +22 -0
  6. package/dest/deprecated/indexeddb/array.d.ts.map +1 -0
  7. package/dest/deprecated/indexeddb/index.d.ts +7 -0
  8. package/dest/deprecated/indexeddb/index.d.ts.map +1 -0
  9. package/dest/deprecated/indexeddb/index.js +8 -0
  10. package/dest/deprecated/indexeddb/map.d.ts +38 -0
  11. package/dest/deprecated/indexeddb/map.d.ts.map +1 -0
  12. package/dest/deprecated/indexeddb/multi_map.d.ts +14 -0
  13. package/dest/deprecated/indexeddb/multi_map.d.ts.map +1 -0
  14. package/dest/{indexeddb → deprecated/indexeddb}/multi_map.js +2 -1
  15. package/dest/deprecated/indexeddb/set.d.ts +17 -0
  16. package/dest/deprecated/indexeddb/set.d.ts.map +1 -0
  17. package/dest/deprecated/indexeddb/singleton.d.ts +17 -0
  18. package/dest/deprecated/indexeddb/singleton.d.ts.map +1 -0
  19. package/dest/deprecated/indexeddb/store.d.ts +98 -0
  20. package/dest/deprecated/indexeddb/store.d.ts.map +1 -0
  21. package/dest/{indexeddb → deprecated/indexeddb}/store.js +2 -0
  22. package/dest/interfaces/array_test_suite.d.ts +1 -1
  23. package/dest/interfaces/array_test_suite.d.ts.map +1 -1
  24. package/dest/interfaces/array_test_suite.js +33 -34
  25. package/dest/interfaces/index.d.ts +2 -2
  26. package/dest/interfaces/index.d.ts.map +1 -1
  27. package/dest/interfaces/map_test_suite.d.ts +1 -1
  28. package/dest/interfaces/map_test_suite.d.ts.map +1 -1
  29. package/dest/interfaces/map_test_suite.js +32 -33
  30. package/dest/interfaces/multi_map_test_suite.d.ts +1 -1
  31. package/dest/interfaces/multi_map_test_suite.d.ts.map +1 -1
  32. package/dest/interfaces/multi_map_test_suite.js +68 -69
  33. package/dest/interfaces/set_test_suite.d.ts +1 -1
  34. package/dest/interfaces/set_test_suite.d.ts.map +1 -1
  35. package/dest/interfaces/set_test_suite.js +13 -14
  36. package/dest/interfaces/singleton_test_suite.d.ts +1 -1
  37. package/dest/interfaces/singleton_test_suite.d.ts.map +1 -1
  38. package/dest/interfaces/singleton_test_suite.js +6 -7
  39. package/dest/lmdb/index.js +2 -2
  40. package/dest/lmdb-v2/factory.d.ts +29 -3
  41. package/dest/lmdb-v2/factory.d.ts.map +1 -1
  42. package/dest/lmdb-v2/factory.js +62 -10
  43. package/dest/lmdb-v2/read_transaction.js +21 -19
  44. package/dest/lmdb-v2/store.d.ts +2 -2
  45. package/dest/lmdb-v2/store.d.ts.map +1 -1
  46. package/dest/lmdb-v2/store.js +4 -4
  47. package/dest/sqlite-opfs/array.d.ts +21 -0
  48. package/dest/sqlite-opfs/array.d.ts.map +1 -0
  49. package/dest/sqlite-opfs/array.js +128 -0
  50. package/dest/sqlite-opfs/errors.d.ts +54 -0
  51. package/dest/sqlite-opfs/errors.d.ts.map +1 -0
  52. package/dest/sqlite-opfs/errors.js +77 -0
  53. package/dest/sqlite-opfs/index.d.ts +14 -0
  54. package/dest/sqlite-opfs/index.d.ts.map +1 -0
  55. package/dest/sqlite-opfs/index.js +16 -0
  56. package/dest/sqlite-opfs/internal/ordered-binary-browser.d.ts +32 -0
  57. package/dest/sqlite-opfs/internal/ordered-binary-browser.d.ts.map +1 -0
  58. package/dest/sqlite-opfs/internal/ordered-binary-browser.js +448 -0
  59. package/dest/sqlite-opfs/manage.d.ts +22 -0
  60. package/dest/sqlite-opfs/manage.d.ts.map +1 -0
  61. package/dest/sqlite-opfs/manage.js +38 -0
  62. package/dest/sqlite-opfs/map.d.ts +35 -0
  63. package/dest/sqlite-opfs/map.d.ts.map +1 -0
  64. package/dest/sqlite-opfs/map.js +163 -0
  65. package/dest/sqlite-opfs/messages.d.ts +66 -0
  66. package/dest/sqlite-opfs/messages.d.ts.map +1 -0
  67. package/dest/sqlite-opfs/messages.js +5 -0
  68. package/dest/sqlite-opfs/multi_map.d.ts +16 -0
  69. package/dest/sqlite-opfs/multi_map.d.ts.map +1 -0
  70. package/dest/sqlite-opfs/multi_map.js +67 -0
  71. package/dest/sqlite-opfs/pool_integrity.d.ts +20 -0
  72. package/dest/sqlite-opfs/pool_integrity.d.ts.map +1 -0
  73. package/dest/sqlite-opfs/pool_integrity.js +282 -0
  74. package/dest/sqlite-opfs/pool_lock.d.ts +8 -0
  75. package/dest/sqlite-opfs/pool_lock.d.ts.map +1 -0
  76. package/dest/sqlite-opfs/pool_lock.js +47 -0
  77. package/dest/sqlite-opfs/set.d.ts +13 -0
  78. package/dest/sqlite-opfs/set.d.ts.map +1 -0
  79. package/dest/sqlite-opfs/set.js +19 -0
  80. package/dest/sqlite-opfs/singleton.d.ts +13 -0
  81. package/dest/sqlite-opfs/singleton.d.ts.map +1 -0
  82. package/dest/sqlite-opfs/singleton.js +48 -0
  83. package/dest/sqlite-opfs/store.d.ts +84 -0
  84. package/dest/sqlite-opfs/store.d.ts.map +1 -0
  85. package/dest/sqlite-opfs/store.js +317 -0
  86. package/dest/sqlite-opfs/worker.d.ts +2 -0
  87. package/dest/sqlite-opfs/worker.d.ts.map +1 -0
  88. package/dest/sqlite-opfs/worker.js +275 -0
  89. package/dest/stores/l2_tips_store.d.ts +7 -13
  90. package/dest/stores/l2_tips_store.d.ts.map +1 -1
  91. package/dest/stores/l2_tips_store.js +24 -43
  92. package/package.json +23 -20
  93. package/src/bench/shared_map_bench.ts +111 -0
  94. package/src/{indexeddb → deprecated/indexeddb}/array.ts +2 -2
  95. package/src/deprecated/indexeddb/index.ts +12 -0
  96. package/src/{indexeddb → deprecated/indexeddb}/map.ts +2 -2
  97. package/src/{indexeddb → deprecated/indexeddb}/multi_map.ts +5 -3
  98. package/src/{indexeddb → deprecated/indexeddb}/set.ts +2 -2
  99. package/src/{indexeddb → deprecated/indexeddb}/singleton.ts +2 -2
  100. package/src/{indexeddb → deprecated/indexeddb}/store.ts +10 -9
  101. package/src/interfaces/array_test_suite.ts +33 -35
  102. package/src/interfaces/index.ts +1 -1
  103. package/src/interfaces/map_test_suite.ts +32 -34
  104. package/src/interfaces/multi_map_test_suite.ts +65 -67
  105. package/src/interfaces/set_test_suite.ts +13 -15
  106. package/src/interfaces/singleton_test_suite.ts +6 -8
  107. package/src/lmdb/index.ts +2 -2
  108. package/src/lmdb-v2/factory.ts +85 -9
  109. package/src/lmdb-v2/read_transaction.ts +23 -23
  110. package/src/lmdb-v2/store.ts +4 -2
  111. package/src/sqlite-opfs/array.ts +124 -0
  112. package/src/sqlite-opfs/errors.ts +94 -0
  113. package/src/sqlite-opfs/index.ts +27 -0
  114. package/src/sqlite-opfs/internal/ordered-binary-browser.js +465 -0
  115. package/src/sqlite-opfs/manage.ts +46 -0
  116. package/src/sqlite-opfs/map.ts +163 -0
  117. package/src/sqlite-opfs/messages.ts +39 -0
  118. package/src/sqlite-opfs/multi_map.ts +74 -0
  119. package/src/sqlite-opfs/pool_integrity.ts +327 -0
  120. package/src/sqlite-opfs/pool_lock.ts +62 -0
  121. package/src/sqlite-opfs/set.ts +29 -0
  122. package/src/sqlite-opfs/singleton.ts +48 -0
  123. package/src/sqlite-opfs/store.ts +330 -0
  124. package/src/sqlite-opfs/worker.ts +259 -0
  125. package/src/stores/l2_tips_store.ts +20 -41
  126. package/dest/indexeddb/array.d.ts +0 -22
  127. package/dest/indexeddb/array.d.ts.map +0 -1
  128. package/dest/indexeddb/index.d.ts +0 -7
  129. package/dest/indexeddb/index.d.ts.map +0 -1
  130. package/dest/indexeddb/index.js +0 -16
  131. package/dest/indexeddb/map.d.ts +0 -38
  132. package/dest/indexeddb/map.d.ts.map +0 -1
  133. package/dest/indexeddb/multi_map.d.ts +0 -14
  134. package/dest/indexeddb/multi_map.d.ts.map +0 -1
  135. package/dest/indexeddb/set.d.ts +0 -17
  136. package/dest/indexeddb/set.d.ts.map +0 -1
  137. package/dest/indexeddb/singleton.d.ts +0 -17
  138. package/dest/indexeddb/singleton.d.ts.map +0 -1
  139. package/dest/indexeddb/store.d.ts +0 -96
  140. package/dest/indexeddb/store.d.ts.map +0 -1
  141. package/src/indexeddb/index.ts +0 -31
  142. /package/dest/{indexeddb → deprecated/indexeddb}/array.js +0 -0
  143. /package/dest/{indexeddb → deprecated/indexeddb}/map.js +0 -0
  144. /package/dest/{indexeddb → deprecated/indexeddb}/set.js +0 -0
  145. /package/dest/{indexeddb → deprecated/indexeddb}/singleton.js +0 -0
@@ -0,0 +1,282 @@
1
+ import { normalizePoolDirectory } from './pool_lock.js';
2
+ // The constants below mirror the opaque-file header format of the pinned opfs-sahpool VFS
3
+ // (`yarn-project/sqlite3mc-wasm/vendor/jswasm/sqlite3.mjs`, class `OpfsSAHPool`). The pool names its files randomly
4
+ // under `.opaque/` and prepends a header that maps each one back to its logical SQLite path:
5
+ //
6
+ // bytes [0, 512) logical path, NUL-terminated UTF-8 (HEADER_MAX_PATH_SIZE)
7
+ // bytes [512, 516) SQLite open-flags of the file, big-endian uint32 (HEADER_FLAGS_SIZE)
8
+ // bytes [516, 524) digest over the preceding 516 bytes, two uint32 words (HEADER_DIGEST_SIZE)
9
+ //
10
+ // Database content starts at byte 4096 (the pool's SECTOR_SIZE). We re-read the header ourselves rather than asking
11
+ // the VFS because the upstream pool "repairs" anything it cannot validate by disassociating the file — destroying
12
+ // exactly the evidence this module exists to quarantine. The browser regression test writes a real pool through the
13
+ // pinned VFS before duplicating an opaque file, so a vendor upgrade that changes the layout breaks detection loudly
14
+ // rather than silently.
15
+ const OPAQUE_DIRECTORY = '.opaque';
16
+ const HEADER_MAX_PATH_SIZE = 512;
17
+ const HEADER_FLAGS_SIZE = 4;
18
+ const HEADER_DIGEST_SIZE = 8;
19
+ const HEADER_CORPUS_SIZE = HEADER_MAX_PATH_SIZE + HEADER_FLAGS_SIZE;
20
+ const HEADER_SIZE = HEADER_CORPUS_SIZE + HEADER_DIGEST_SIZE;
21
+ // Standard SQLite open-flag bit values (sqlite3.h). Restated as literals because the header stores them numerically
22
+ // and this module runs on the main thread, without the sqlite3 WASM bundle that defines `capi.SQLITE_OPEN_*`.
23
+ const SQLITE_OPEN_DELETEONCLOSE = 0x00000008;
24
+ const SQLITE_OPEN_MEMORY = 0x00000080;
25
+ const SQLITE_OPEN_MAIN_DB = 0x00000100;
26
+ const SQLITE_OPEN_MAIN_JOURNAL = 0x00000800;
27
+ const SQLITE_OPEN_SUPER_JOURNAL = 0x00004000;
28
+ const SQLITE_OPEN_WAL = 0x00080000;
29
+ // A live association must name one of the file types the pool persists; transient types (temp DBs, statement
30
+ // journals) never survive in a valid header.
31
+ const PERSISTENT_FILE_TYPES = SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_MAIN_JOURNAL | SQLITE_OPEN_SUPER_JOURNAL | SQLITE_OPEN_WAL;
32
+ // The upstream VFS repurposes SQLITE_OPEN_MEMORY — meaningless for a file that exists on disk — as a header version
33
+ // marker: headers written with it set carry a real digest, while legacy headers leave it unset and store all-zero
34
+ // digest words.
35
+ const FLAG_COMPUTE_DIGEST_V2 = SQLITE_OPEN_MEMORY;
36
+ export const OPFS_QUARANTINE_ROOT_DIRECTORY = '.aztec-sqlite-quarantine';
37
+ /**
38
+ * Detects duplicate SAH logical-file associations and, if found, copies the complete pool into quarantine before
39
+ * removing the original. The caller must hold the pool's exclusive Web Lock for the whole operation.
40
+ */ export async function quarantineDuplicatePool(poolDirectory) {
41
+ poolDirectory = normalizePoolDirectory(poolDirectory);
42
+ const root = await navigator.storage.getDirectory();
43
+ const source = await getDirectory(root, poolDirectory);
44
+ if (!source) {
45
+ return undefined;
46
+ }
47
+ const opaque = await getChildDirectory(source, OPAQUE_DIRECTORY);
48
+ if (!opaque) {
49
+ return undefined;
50
+ }
51
+ const duplicateAssociations = await findDuplicateAssociations(opaque);
52
+ if (duplicateAssociations.length === 0) {
53
+ return undefined;
54
+ }
55
+ const quarantineRoot = await root.getDirectoryHandle(OPFS_QUARANTINE_ROOT_DIRECTORY, {
56
+ create: true
57
+ });
58
+ const quarantineName = createQuarantineName();
59
+ const destination = await quarantineRoot.getDirectoryHandle(quarantineName, {
60
+ create: true
61
+ });
62
+ const metadata = {
63
+ formatVersion: 1,
64
+ originalPoolDirectory: poolDirectory,
65
+ quarantinedAt: new Date().toISOString(),
66
+ duplicateAssociations
67
+ };
68
+ let quarantineComplete = false;
69
+ try {
70
+ await copyDirectory(source, destination);
71
+ await verifyDirectoryCopy(source, destination);
72
+ await writeJson(destination, 'quarantine.json', metadata);
73
+ quarantineComplete = true;
74
+ await removeDirectory(root, poolDirectory);
75
+ } catch (err) {
76
+ if (!quarantineComplete) {
77
+ await quarantineRoot.removeEntry(quarantineName, {
78
+ recursive: true
79
+ }).catch(()=>{});
80
+ }
81
+ throw err;
82
+ }
83
+ return {
84
+ ...metadata,
85
+ quarantineDirectory: `${OPFS_QUARANTINE_ROOT_DIRECTORY}/${quarantineName}`
86
+ };
87
+ }
88
+ async function findDuplicateAssociations(opaque) {
89
+ const associations = new Map();
90
+ for await (const [opaqueName, handle] of opaque.entries()){
91
+ if (handle.kind !== 'file') {
92
+ continue;
93
+ }
94
+ const logicalPath = await readAssociatedPath(handle);
95
+ if (logicalPath) {
96
+ const names = associations.get(logicalPath) ?? [];
97
+ names.push(opaqueName);
98
+ associations.set(logicalPath, names);
99
+ }
100
+ }
101
+ return [
102
+ ...associations.entries()
103
+ ].filter(([, names])=>names.length > 1).map(([logicalPath, opaqueFileNames])=>({
104
+ logicalPath,
105
+ opaqueFileNames: opaqueFileNames.sort()
106
+ })).sort((a, b)=>a.logicalPath.localeCompare(b.logicalPath));
107
+ }
108
+ /**
109
+ * Returns the logical SQLite path an opaque SAH file is associated with, or undefined if the file is not a live,
110
+ * valid association. Applies the same checks as the vendored pool's `getAssociatedPath`: a non-empty NUL-terminated
111
+ * path, open-flags naming a persistent file type without DELETEONCLOSE, and a matching header digest. Files failing
112
+ * any check are the pool's free-list or garbage entries — the VFS itself would disassociate them on open — so they
113
+ * cannot participate in a duplicate mapping.
114
+ */ async function readAssociatedPath(handle) {
115
+ const file = await handle.getFile();
116
+ if (file.size < HEADER_SIZE) {
117
+ return undefined;
118
+ }
119
+ const header = new Uint8Array(await file.slice(0, HEADER_SIZE).arrayBuffer());
120
+ const pathEnd = header.subarray(0, HEADER_MAX_PATH_SIZE).indexOf(0);
121
+ if (pathEnd <= 0) {
122
+ return undefined;
123
+ }
124
+ const dataView = new DataView(header.buffer, header.byteOffset, header.byteLength);
125
+ const flags = dataView.getUint32(HEADER_MAX_PATH_SIZE);
126
+ if ((flags & SQLITE_OPEN_DELETEONCLOSE) !== 0 || (flags & PERSISTENT_FILE_TYPES) === 0) {
127
+ return undefined;
128
+ }
129
+ if (!hasValidDigest(header, flags)) {
130
+ return undefined;
131
+ }
132
+ try {
133
+ return new TextDecoder('utf-8', {
134
+ fatal: true
135
+ }).decode(header.subarray(0, pathEnd));
136
+ } catch {
137
+ return undefined;
138
+ }
139
+ }
140
+ /**
141
+ * Byte-for-byte port of the vendored pool's `computeDigest`, checked against the digest words stored in the header.
142
+ */ function hasValidDigest(header, flags) {
143
+ let expected0 = 0;
144
+ let expected1 = 0;
145
+ if ((flags & FLAG_COMPUTE_DIGEST_V2) !== 0) {
146
+ // These seeds (0xdeadbeef, 0x41c6ce57) and odd multipliers (2654435761, 104729) are the upstream author's choices
147
+ // (a cyrb53-hash variant) and carry no meaning here beyond having to match the vendored implementation bit for
148
+ // bit.
149
+ expected0 = 0xdeadbeef;
150
+ expected1 = 0x41c6ce57;
151
+ for (const value of header.subarray(0, HEADER_CORPUS_SIZE)){
152
+ expected0 = Math.imul(expected0 ^ value, 2654435761);
153
+ expected1 = Math.imul(expected1 ^ value, 104729);
154
+ }
155
+ expected0 >>>= 0;
156
+ expected1 >>>= 0;
157
+ }
158
+ const dataView = new DataView(header.buffer, header.byteOffset, header.byteLength);
159
+ return dataView.getUint32(HEADER_CORPUS_SIZE, true) === expected0 && dataView.getUint32(HEADER_CORPUS_SIZE + 4, true) === expected1;
160
+ }
161
+ async function getDirectory(root, path) {
162
+ let current = root;
163
+ try {
164
+ for (const segment of path.split('/')){
165
+ current = await current.getDirectoryHandle(segment);
166
+ }
167
+ return current;
168
+ } catch (err) {
169
+ if (err instanceof DOMException && err.name === 'NotFoundError') {
170
+ return undefined;
171
+ }
172
+ throw err;
173
+ }
174
+ }
175
+ async function getChildDirectory(parent, name) {
176
+ try {
177
+ return await parent.getDirectoryHandle(name);
178
+ } catch (err) {
179
+ if (err instanceof DOMException && err.name === 'NotFoundError') {
180
+ return undefined;
181
+ }
182
+ throw err;
183
+ }
184
+ }
185
+ async function removeDirectory(root, path) {
186
+ const segments = path.split('/');
187
+ const name = segments.pop();
188
+ let parent = root;
189
+ for (const segment of segments){
190
+ parent = await parent.getDirectoryHandle(segment);
191
+ }
192
+ await parent.removeEntry(name, {
193
+ recursive: true
194
+ });
195
+ }
196
+ async function copyDirectory(source, destination) {
197
+ for await (const [name, handle] of source.entries()){
198
+ if (handle.kind === 'directory') {
199
+ const childDestination = await destination.getDirectoryHandle(name, {
200
+ create: true
201
+ });
202
+ await copyDirectory(handle, childDestination);
203
+ continue;
204
+ }
205
+ const sourceFile = await handle.getFile();
206
+ const destinationHandle = await destination.getFileHandle(name, {
207
+ create: true
208
+ });
209
+ const writable = await destinationHandle.createWritable();
210
+ try {
211
+ await writable.write(sourceFile);
212
+ await writable.close();
213
+ } catch (err) {
214
+ await writable.abort().catch(()=>{});
215
+ throw err;
216
+ }
217
+ }
218
+ }
219
+ async function verifyDirectoryCopy(source, destination) {
220
+ const sourceEntries = await getSortedEntries(source);
221
+ const destinationEntries = await getSortedEntries(destination);
222
+ if (sourceEntries.length !== destinationEntries.length || sourceEntries.some(([name, handle], index)=>{
223
+ const destinationEntry = destinationEntries[index];
224
+ return name !== destinationEntry[0] || handle.kind !== destinationEntry[1].kind;
225
+ })) {
226
+ throw new Error('Failed to verify quarantined OPFS directory structure');
227
+ }
228
+ for(let i = 0; i < sourceEntries.length; i++){
229
+ const [, sourceHandle] = sourceEntries[i];
230
+ const [, destinationHandle] = destinationEntries[i];
231
+ if (sourceHandle.kind === 'directory') {
232
+ await verifyDirectoryCopy(sourceHandle, destinationHandle);
233
+ } else {
234
+ await verifyFilesEqual(sourceHandle, destinationHandle);
235
+ }
236
+ }
237
+ }
238
+ async function getSortedEntries(directory) {
239
+ const entries = [];
240
+ for await (const entry of directory.entries()){
241
+ entries.push(entry);
242
+ }
243
+ return entries.sort(([a], [b])=>a.localeCompare(b));
244
+ }
245
+ async function verifyFilesEqual(sourceHandle, destinationHandle) {
246
+ const source = await sourceHandle.getFile();
247
+ const destination = await destinationHandle.getFile();
248
+ if (source.size !== destination.size) {
249
+ throw new Error(`Failed to verify quarantined OPFS file "${source.name}"`);
250
+ }
251
+ const chunkSize = 1024 * 1024;
252
+ for(let offset = 0; offset < source.size; offset += chunkSize){
253
+ const [sourceChunk, destinationChunk] = await Promise.all([
254
+ source.slice(offset, offset + chunkSize).arrayBuffer(),
255
+ destination.slice(offset, offset + chunkSize).arrayBuffer()
256
+ ]);
257
+ const sourceBytes = new Uint8Array(sourceChunk);
258
+ const destinationBytes = new Uint8Array(destinationChunk);
259
+ if (sourceBytes.some((value, index)=>value !== destinationBytes[index])) {
260
+ throw new Error(`Failed to verify quarantined OPFS file "${source.name}"`);
261
+ }
262
+ }
263
+ }
264
+ async function writeJson(directory, name, value) {
265
+ const handle = await directory.getFileHandle(name, {
266
+ create: true
267
+ });
268
+ const writable = await handle.createWritable();
269
+ try {
270
+ await writable.write(JSON.stringify(value, undefined, 2));
271
+ await writable.close();
272
+ } catch (err) {
273
+ await writable.abort().catch(()=>{});
274
+ throw err;
275
+ }
276
+ }
277
+ function createQuarantineName() {
278
+ const random = globalThis.crypto.getRandomValues(new Uint8Array(8));
279
+ return `${Date.now()}-${[
280
+ ...random
281
+ ].map((byte)=>byte.toString(16).padStart(2, '0')).join('')}`;
282
+ }
@@ -0,0 +1,8 @@
1
+ export declare const DEFAULT_SAH_POOL_DIRECTORY = ".aztec-kv";
2
+ export interface PoolLockLease {
3
+ release(): Promise<void>;
4
+ }
5
+ export declare function normalizePoolDirectory(poolDirectory?: string): string;
6
+ export declare function acquirePoolLock(poolDirectory?: string): Promise<PoolLockLease>;
7
+ export declare function withPoolLock<T>(poolDirectory: string, callback: () => Promise<T>): Promise<T>;
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9vbF9sb2NrLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3FsaXRlLW9wZnMvcG9vbF9sb2NrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLGVBQU8sTUFBTSwwQkFBMEIsY0FBYyxDQUFDO0FBSXRELE1BQU0sV0FBVyxhQUFhO0lBQzVCLE9BQU8sSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7Q0FDMUI7QUFFRCx3QkFBZ0Isc0JBQXNCLENBQUMsYUFBYSxDQUFDLEVBQUUsTUFBTSxHQUFHLE1BQU0sQ0FNckU7QUFFRCx3QkFBc0IsZUFBZSxDQUFDLGFBQWEsQ0FBQyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBa0NwRjtBQUVELHdCQUFzQixZQUFZLENBQUMsQ0FBQyxFQUFFLGFBQWEsRUFBRSxNQUFNLEVBQUUsUUFBUSxFQUFFLE1BQU0sT0FBTyxDQUFDLENBQUMsQ0FBQyxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FPbkcifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool_lock.d.ts","sourceRoot":"","sources":["../../src/sqlite-opfs/pool_lock.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,cAAc,CAAC;AAItD,MAAM,WAAW,aAAa;IAC5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAgB,sBAAsB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAMrE;AAED,wBAAsB,eAAe,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAkCpF;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOnG"}
@@ -0,0 +1,47 @@
1
+ import { SqlitePoolBusyError, SqliteWebLocksUnavailableError } from './errors.js';
2
+ export const DEFAULT_SAH_POOL_DIRECTORY = '.aztec-kv';
3
+ const WEB_LOCK_PREFIX = 'aztec.sqlite-opfs.pool:';
4
+ export function normalizePoolDirectory(poolDirectory) {
5
+ const path = poolDirectory?.split('/').filter((segment)=>segment.length > 0).join('/');
6
+ return path || DEFAULT_SAH_POOL_DIRECTORY;
7
+ }
8
+ export async function acquirePoolLock(poolDirectory) {
9
+ if (!navigator.locks) {
10
+ throw new SqliteWebLocksUnavailableError();
11
+ }
12
+ const normalizedDirectory = normalizePoolDirectory(poolDirectory);
13
+ const acquired = Promise.withResolvers();
14
+ const hold = Promise.withResolvers();
15
+ const request = navigator.locks.request(`${WEB_LOCK_PREFIX}${normalizedDirectory}`, {
16
+ mode: 'exclusive',
17
+ ifAvailable: true
18
+ }, async (lock)=>{
19
+ acquired.resolve(lock);
20
+ if (lock) {
21
+ await hold.promise;
22
+ }
23
+ });
24
+ request.catch(acquired.reject);
25
+ if (!await acquired.promise) {
26
+ await request;
27
+ throw new SqlitePoolBusyError(normalizedDirectory);
28
+ }
29
+ let released = false;
30
+ return {
31
+ release: async ()=>{
32
+ if (!released) {
33
+ released = true;
34
+ hold.resolve();
35
+ }
36
+ await request;
37
+ }
38
+ };
39
+ }
40
+ export async function withPoolLock(poolDirectory, callback) {
41
+ const lease = await acquirePoolLock(poolDirectory);
42
+ try {
43
+ return await callback();
44
+ } finally{
45
+ await lease.release();
46
+ }
47
+ }
@@ -0,0 +1,13 @@
1
+ import type { Key, Range } from '../interfaces/common.js';
2
+ import type { AztecAsyncSet } from '../interfaces/set.js';
3
+ import type { AztecSQLiteOPFSStore } from './store.js';
4
+ /** Set backed by SQLite. Composes a Map<K, true>. */
5
+ export declare class SQLiteOPFSAztecSet<K extends Key> implements AztecAsyncSet<K> {
6
+ #private;
7
+ constructor(store: AztecSQLiteOPFSStore, name: string);
8
+ hasAsync(key: K): Promise<boolean>;
9
+ add(key: K): Promise<void>;
10
+ delete(key: K): Promise<void>;
11
+ entriesAsync(range?: Range<K>): AsyncIterableIterator<K>;
12
+ }
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3FsaXRlLW9wZnMvc2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxLQUFLLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV2RCxxREFBcUQ7QUFDckQscUJBQWEsa0JBQWtCLENBQUMsQ0FBQyxTQUFTLEdBQUcsQ0FBRSxZQUFXLGFBQWEsQ0FBQyxDQUFDLENBQUM7O0lBR3hFLFlBQVksS0FBSyxFQUFFLG9CQUFvQixFQUFFLElBQUksRUFBRSxNQUFNLEVBRXBEO0lBRUQsUUFBUSxDQUFDLEdBQUcsRUFBRSxDQUFDLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUVqQztJQUVELEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFekI7SUFFRCxNQUFNLENBQUMsR0FBRyxFQUFFLENBQUMsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRTVCO0lBRU0sWUFBWSxDQUFDLEtBQUssR0FBRSxLQUFLLENBQUMsQ0FBQyxDQUFNLEdBQUcscUJBQXFCLENBQUMsQ0FBQyxDQUFDLENBRWxFO0NBQ0YifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/sqlite-opfs/set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,qDAAqD;AACrD,qBAAa,kBAAkB,CAAC,CAAC,SAAS,GAAG,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;;IAGxE,YAAY,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAEpD;IAED,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjC;IAED,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzB;IAED,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5B;IAEM,YAAY,CAAC,KAAK,GAAE,KAAK,CAAC,CAAC,CAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAElE;CACF"}
@@ -0,0 +1,19 @@
1
+ import { SQLiteOPFSAztecMap } from './map.js';
2
+ /** Set backed by SQLite. Composes a Map<K, true>. */ export class SQLiteOPFSAztecSet {
3
+ #map;
4
+ constructor(store, name){
5
+ this.#map = new SQLiteOPFSAztecMap(store, name);
6
+ }
7
+ hasAsync(key) {
8
+ return this.#map.hasAsync(key);
9
+ }
10
+ add(key) {
11
+ return this.#map.set(key, true);
12
+ }
13
+ delete(key) {
14
+ return this.#map.delete(key);
15
+ }
16
+ async *entriesAsync(range = {}) {
17
+ yield* this.#map.keysAsync(range);
18
+ }
19
+ }
@@ -0,0 +1,13 @@
1
+ import type { Value } from '../interfaces/common.js';
2
+ import type { AztecAsyncSingleton } from '../interfaces/singleton.js';
3
+ import type { AztecSQLiteOPFSStore } from './store.js';
4
+ /** Stores a single value identified by `name`. */
5
+ export declare class SQLiteOPFSAztecSingleton<T extends Value> implements AztecAsyncSingleton<T> {
6
+ #private;
7
+ private readonly store;
8
+ constructor(store: AztecSQLiteOPFSStore, name: string);
9
+ getAsync(): Promise<T | undefined>;
10
+ set(val: T): Promise<boolean>;
11
+ delete(): Promise<boolean>;
12
+ }
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2luZ2xldG9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3FsaXRlLW9wZnMvc2luZ2xldG9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3JELE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFDdEUsT0FBTyxLQUFLLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFFdkQsa0RBQWtEO0FBQ2xELHFCQUFhLHdCQUF3QixDQUFDLENBQUMsU0FBUyxLQUFLLENBQUUsWUFBVyxtQkFBbUIsQ0FBQyxDQUFDLENBQUM7O0lBTXBGLE9BQU8sQ0FBQyxRQUFRLENBQUMsS0FBSztJQUR4QixZQUNtQixLQUFLLEVBQUUsb0JBQW9CLEVBQzVDLElBQUksRUFBRSxNQUFNLEVBSWI7SUFFSyxRQUFRLElBQUksT0FBTyxDQUFDLENBQUMsR0FBRyxTQUFTLENBQUMsQ0FVdkM7SUFFSyxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUMsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBT2xDO0lBRUssTUFBTSxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FHL0I7Q0FDRiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../src/sqlite-opfs/singleton.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,kDAAkD;AAClD,qBAAa,wBAAwB,CAAC,CAAC,SAAS,KAAK,CAAE,YAAW,mBAAmB,CAAC,CAAC,CAAC;;IAMpF,OAAO,CAAC,QAAQ,CAAC,KAAK;IADxB,YACmB,KAAK,EAAE,oBAAoB,EAC5C,IAAI,EAAE,MAAM,EAIb;IAEK,QAAQ,IAAI,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAUvC;IAEK,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAOlC;IAEK,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAG/B;CACF"}
@@ -0,0 +1,48 @@
1
+ import { Encoder } from '#msgpackr';
2
+ import { toBufferKey } from '#ordered-binary';
3
+ import { hash } from 'ohash';
4
+ /** Stores a single value identified by `name`. */ export class SQLiteOPFSAztecSingleton {
5
+ store;
6
+ #container;
7
+ #slot;
8
+ #encoder;
9
+ constructor(store, name){
10
+ this.store = store;
11
+ this.#encoder = new Encoder();
12
+ this.#container = `singleton:${name}`;
13
+ this.#slot = `singleton:${name}:value`;
14
+ }
15
+ async getAsync() {
16
+ const rows = await this.store.allAsync('SELECT value FROM data WHERE slot = ? LIMIT 1', [
17
+ this.#slot
18
+ ]);
19
+ if (rows.length === 0) {
20
+ return undefined;
21
+ }
22
+ const raw = rows[0][0];
23
+ if (raw instanceof Uint8Array) {
24
+ return this.#encoder.unpack(raw);
25
+ }
26
+ return undefined;
27
+ }
28
+ async set(val) {
29
+ const { changes } = await this.store.runAsync(`INSERT OR REPLACE INTO data (slot, container, key, key_count, hash, value)
30
+ VALUES (?, ?, ?, ?, ?, ?)`, [
31
+ this.#slot,
32
+ this.#container,
33
+ toBufferKey([
34
+ this.#slot
35
+ ]),
36
+ 1,
37
+ hash(val),
38
+ this.#encoder.pack(val)
39
+ ]);
40
+ return changes > 0;
41
+ }
42
+ async delete() {
43
+ await this.store.runAsync('DELETE FROM data WHERE slot = ?', [
44
+ this.#slot
45
+ ]);
46
+ return true;
47
+ }
48
+ }
@@ -0,0 +1,84 @@
1
+ import type { Logger } from '@aztec/foundation/log';
2
+ import type { AztecAsyncArray } from '../interfaces/array.js';
3
+ import type { Key, StoreSize, Value } from '../interfaces/common.js';
4
+ import type { AztecAsyncCounter } from '../interfaces/counter.js';
5
+ import type { AztecAsyncMap } from '../interfaces/map.js';
6
+ import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js';
7
+ import type { AztecAsyncSet } from '../interfaces/set.js';
8
+ import type { AztecAsyncSingleton } from '../interfaces/singleton.js';
9
+ import type { AztecAsyncKVStore } from '../interfaces/store.js';
10
+ import type { ResultRow, SqlValue } from './messages.js';
11
+ /**
12
+ * Main-thread handle for a SQLite database persisted to OPFS via the `opfs-sahpool`
13
+ * VFS. Owns a dedicated Web Worker (the SAH Pool VFS requires Worker context) and
14
+ * routes every SQL op through it via typed postMessage RPC.
15
+ *
16
+ * Transaction ordering is guaranteed by a `SerialQueue` on the main thread combined
17
+ * with an `#inTx` flag: outside a `transactionAsync` block, each op acquires the
18
+ * queue for its own auto-commit; inside a block, the outer call holds the queue and
19
+ * nested ops bypass it to avoid deadlock.
20
+ */
21
+ export declare class AztecSQLiteOPFSStore implements AztecAsyncKVStore {
22
+ #private;
23
+ readonly isEphemeral: boolean;
24
+ private readonly poolLock?;
25
+ private constructor();
26
+ /**
27
+ * Opens (or creates) a SQLite database stored in the OPFS SAH Pool. When `ephemeral`
28
+ * is true the database lives only in memory and is lost when the worker terminates.
29
+ * Pass `poolDirectory` to place the SAH Pool in a non-default OPFS subdirectory —
30
+ * required when multiple stores coexist in the same tab, because the SAH Pool holds
31
+ * an exclusive lock on its directory.
32
+ *
33
+ * Persistent stores hold an origin-wide Web Lock for the pool directory until close
34
+ * or delete. If another store instance already owns it, open fails immediately with
35
+ * `SqlitePoolBusyError`.
36
+ *
37
+ * Pass `encryptionKey` (exactly 32 bytes) to enable at-rest encryption via sqlite3mc's
38
+ * ChaCha20 page cipher. The key buffer is **transferred** to the worker — its
39
+ * ArrayBuffer detaches on the caller side after `postMessage`. This is intentional:
40
+ * the API encodes a one-key-one-owner invariant. A caller that wants to use the same
41
+ * key for multiple stores must explicitly clone it per call (e.g.
42
+ * `new Uint8Array(savedKey)`), making the duplication a visible, deliberate decision
43
+ * rather than a silent structured-clone operation. The default path (one `.open()`,
44
+ * one consumption of the key) leaves zero key bytes on the main thread after the call.
45
+ */
46
+ static open(log: Logger, name?: string, ephemeral?: boolean, poolDirectory?: string, encryptionKey?: Uint8Array): Promise<AztecSQLiteOPFSStore>;
47
+ openMap<K extends Key, V extends Value>(name: string): AztecAsyncMap<K, V>;
48
+ openSet<K extends Key>(name: string): AztecAsyncSet<K>;
49
+ openMultiMap<K extends Key, V extends Value>(name: string): AztecAsyncMultiMap<K, V>;
50
+ openCounter<K extends Key>(_name: string): AztecAsyncCounter<K>;
51
+ openArray<T extends Value>(name: string): AztecAsyncArray<T>;
52
+ openSingleton<T extends Value>(name: string): AztecAsyncSingleton<T>;
53
+ transactionAsync<T>(callback: () => Promise<T>): Promise<T>;
54
+ clear(): Promise<void>;
55
+ delete(): Promise<void>;
56
+ /**
57
+ * Placeholder — returns zeros to mirror the IndexedDB backend. SQLite exposes real
58
+ * numbers cheaply via `PRAGMA page_count` / `page_size` / `freelist_count` and
59
+ * `SELECT COUNT(*) FROM data`, which would populate `physicalFileSize`, `actualSize`,
60
+ * and `numItems` meaningfully (`mappingSize` stays 0 — it's an LMDB mmap concept).
61
+ * Upgrade when any caller actually consumes these values; all current consumers
62
+ * tolerate zeros.
63
+ */
64
+ estimateSize(): Promise<StoreSize>;
65
+ close(): Promise<void>;
66
+ backupTo(_dstPath: string, _compact?: boolean): Promise<void>;
67
+ /**
68
+ * Returns a raw SQLite image (bytes suitable for writing as a `.sqlite` file and
69
+ * opening in any SQLite tool). Works only for non-ephemeral DBs because the OPFS
70
+ * SAH Pool has to be initialized. Useful for inspection/debugging.
71
+ */
72
+ exportDb(): Promise<Uint8Array>;
73
+ /**
74
+ * Runs a write statement (INSERT/UPDATE/DELETE/DDL). If called inside a
75
+ * `transactionAsync` block, bypasses the queue; otherwise acquires it so the
76
+ * op runs in its own auto-commit.
77
+ */
78
+ runAsync(sql: string, bind?: SqlValue[]): Promise<{
79
+ changes: number;
80
+ }>;
81
+ /** Runs a SELECT statement and returns rows in array row-mode. */
82
+ allAsync(sql: string, bind?: SqlValue[]): Promise<ResultRow[]>;
83
+ }
84
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zcWxpdGUtb3Bmcy9zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUdwRCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx3QkFBd0IsQ0FB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