flash-store 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -19
- package/dist/package.json +90 -61
- package/dist/src/browser.d.ts +20 -0
- package/dist/src/browser.d.ts.map +1 -0
- package/dist/src/browser.js +24 -0
- package/dist/src/browser.js.map +1 -0
- package/dist/src/config.d.ts +4 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +4 -11
- package/dist/src/config.js.map +1 -1
- package/dist/src/flash-store-core.d.ts +65 -0
- package/dist/src/flash-store-core.d.ts.map +1 -0
- package/dist/src/flash-store-core.js +201 -0
- package/dist/src/flash-store-core.js.map +1 -0
- package/dist/src/flash-store-sync-core.d.ts +72 -0
- package/dist/src/flash-store-sync-core.d.ts.map +1 -0
- package/dist/src/flash-store-sync-core.js +177 -0
- package/dist/src/flash-store-sync-core.js.map +1 -0
- package/dist/src/flash-store-sync.d.ts +5 -66
- package/dist/src/flash-store-sync.d.ts.map +1 -1
- package/dist/src/flash-store-sync.js +7 -171
- package/dist/src/flash-store-sync.js.map +1 -1
- package/dist/src/flash-store.d.ts +5 -63
- package/dist/src/flash-store.d.ts.map +1 -1
- package/dist/src/flash-store.js +70 -208
- package/dist/src/flash-store.js.map +1 -1
- package/dist/src/indexeddb-backend.d.ts +40 -0
- package/dist/src/indexeddb-backend.d.ts.map +1 -0
- package/dist/src/indexeddb-backend.js +200 -0
- package/dist/src/indexeddb-backend.js.map +1 -0
- package/dist/src/key-encoding.d.ts +9 -0
- package/dist/src/key-encoding.d.ts.map +1 -0
- package/dist/src/key-encoding.js +22 -0
- package/dist/src/key-encoding.js.map +1 -0
- package/dist/src/store-backend.d.ts +35 -0
- package/dist/src/store-backend.d.ts.map +1 -0
- package/dist/src/store-backend.js +2 -0
- package/dist/src/store-backend.js.map +1 -0
- package/package.json +38 -9
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements durable browser storage over IndexedDB using native keys.
|
|
3
|
+
* Transaction ownership stays inside this backend so awaiting an async
|
|
4
|
+
* iterator cannot leave an IndexedDB cursor inactive.
|
|
5
|
+
*/
|
|
6
|
+
import type { StoreKey } from './flash-store-core.ts';
|
|
7
|
+
import type { ScanRange, StoreBackend, StoredEntry } from './store-backend.ts';
|
|
8
|
+
/** Connects one browser store handle to an origin-scoped IndexedDB database. */
|
|
9
|
+
export declare class IndexedDbBackend implements StoreBackend {
|
|
10
|
+
private readonly name;
|
|
11
|
+
private readonly connection;
|
|
12
|
+
private readonly pending;
|
|
13
|
+
private closing;
|
|
14
|
+
private invalidated;
|
|
15
|
+
/** Starts opening the database. Operations surface any open failure. */
|
|
16
|
+
constructor(name: string);
|
|
17
|
+
/** Runs a transaction and resolves only after its result has committed. */
|
|
18
|
+
private transaction;
|
|
19
|
+
/** Reads one result from a readonly transaction. */
|
|
20
|
+
private read;
|
|
21
|
+
/** Commits serialized JSON under the key. */
|
|
22
|
+
put(key: StoreKey, json: string): Promise<void>;
|
|
23
|
+
/** Reads stored JSON or returns undefined for a missing key. */
|
|
24
|
+
get(key: StoreKey): Promise<string | undefined>;
|
|
25
|
+
/** Reads presence without retrieving the value. */
|
|
26
|
+
has(key: StoreKey): Promise<boolean>;
|
|
27
|
+
/** Checks existence and deletes atomically so concurrent callers get their own result. */
|
|
28
|
+
delete(key: StoreKey): Promise<boolean>;
|
|
29
|
+
/** Removes all records atomically. */
|
|
30
|
+
clear(): Promise<void>;
|
|
31
|
+
/** Counts records without reading their values. */
|
|
32
|
+
count(): Promise<number>;
|
|
33
|
+
/** Collects the matching snapshot before returning control to the consumer. */
|
|
34
|
+
scan(range: ScanRange): Promise<StoredEntry[]>;
|
|
35
|
+
/** Prevents new work and closes after all already submitted transactions settle. */
|
|
36
|
+
close(): Promise<void>;
|
|
37
|
+
/** Deletes by name after close, rejecting handles invalidated by a version change. */
|
|
38
|
+
destroy(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
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K,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAoBnD;IAED,oFAAoF;IAC9E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAS3B;IAED,sFAAsF;IAChF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAU7B;CACF"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
const records = 'records';
|
|
2
|
+
/** Returns the next string strictly greater than any string with the given prefix. */
|
|
3
|
+
function prefixEnd(prefix) {
|
|
4
|
+
if (prefix === '')
|
|
5
|
+
return undefined;
|
|
6
|
+
let i = prefix.length - 1;
|
|
7
|
+
while (i >= 0 && prefix.charCodeAt(i) === 0xffff)
|
|
8
|
+
i--;
|
|
9
|
+
if (i < 0)
|
|
10
|
+
return undefined;
|
|
11
|
+
return prefix.slice(0, i) + String.fromCharCode(prefix.charCodeAt(i) + 1);
|
|
12
|
+
}
|
|
13
|
+
/** Returns a bounded IndexedDB range or null for an empty interval. */
|
|
14
|
+
function keyRange(range) {
|
|
15
|
+
const isPrefix = range.prefix !== undefined;
|
|
16
|
+
const start = range.prefix !== undefined ? range.prefix : range.lower;
|
|
17
|
+
const end = range.prefix !== undefined ? prefixEnd(range.prefix) : range.upper;
|
|
18
|
+
const lowerOpen = isPrefix ? false : range.lowerOpen;
|
|
19
|
+
const upperOpen = isPrefix ? end !== undefined : range.upperOpen;
|
|
20
|
+
if (start !== undefined && end !== undefined) {
|
|
21
|
+
const order = indexedDB.cmp(start, end);
|
|
22
|
+
if (order > 0 || (order === 0 && (lowerOpen || upperOpen)))
|
|
23
|
+
return null;
|
|
24
|
+
return IDBKeyRange.bound(start, end, lowerOpen, upperOpen);
|
|
25
|
+
}
|
|
26
|
+
if (start !== undefined)
|
|
27
|
+
return IDBKeyRange.lowerBound(start, lowerOpen);
|
|
28
|
+
if (end !== undefined)
|
|
29
|
+
return IDBKeyRange.upperBound(end, upperOpen);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
/** Connects one browser store handle to an origin-scoped IndexedDB database. */
|
|
33
|
+
export class IndexedDbBackend {
|
|
34
|
+
name;
|
|
35
|
+
connection;
|
|
36
|
+
pending = new Set();
|
|
37
|
+
closing = false;
|
|
38
|
+
invalidated = false;
|
|
39
|
+
/** Starts opening the database. Operations surface any open failure. */
|
|
40
|
+
constructor(name) {
|
|
41
|
+
this.name = `flash-store:${name}`;
|
|
42
|
+
this.connection = new Promise((resolve, reject) => {
|
|
43
|
+
const request = indexedDB.open(this.name, 1);
|
|
44
|
+
request.onupgradeneeded = () => request.result.createObjectStore(records);
|
|
45
|
+
request.onerror = () => reject(request.error);
|
|
46
|
+
request.onsuccess = () => {
|
|
47
|
+
const db = request.result;
|
|
48
|
+
db.onversionchange = () => {
|
|
49
|
+
// A peer may upgrade or replace the database after this handle releases it.
|
|
50
|
+
this.invalidated = true;
|
|
51
|
+
this.closing = true;
|
|
52
|
+
db.close();
|
|
53
|
+
};
|
|
54
|
+
db.onclose = () => {
|
|
55
|
+
this.closing = true;
|
|
56
|
+
};
|
|
57
|
+
resolve(db);
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
// Construction stays synchronous, even if nothing consumes the connection.
|
|
61
|
+
void this.connection.catch(() => { });
|
|
62
|
+
}
|
|
63
|
+
/** Runs a transaction and resolves only after its result has committed. */
|
|
64
|
+
transaction(mode, schedule) {
|
|
65
|
+
if (this.closing)
|
|
66
|
+
return Promise.reject(new Error('Store is closing or closed'));
|
|
67
|
+
const operation = this.connection.then((db) => new Promise((resolve, reject) => {
|
|
68
|
+
const tx = db.transaction(records, mode);
|
|
69
|
+
let result;
|
|
70
|
+
let requestError = null;
|
|
71
|
+
tx.oncomplete = () => resolve(result);
|
|
72
|
+
tx.onerror = (event) => {
|
|
73
|
+
// Cancel the default action so unhandled errors do not bubble to window.
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
requestError =
|
|
76
|
+
event.target?.error ??
|
|
77
|
+
tx.error ??
|
|
78
|
+
new Error('IndexedDB transaction failed');
|
|
79
|
+
try {
|
|
80
|
+
tx.abort();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Transaction may already be aborting or aborted.
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
tx.onabort = () => reject(requestError ??
|
|
87
|
+
tx.error ??
|
|
88
|
+
new Error('IndexedDB transaction aborted'));
|
|
89
|
+
try {
|
|
90
|
+
schedule(tx.objectStore(records), (value) => {
|
|
91
|
+
result = value;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
try {
|
|
96
|
+
tx.abort();
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Transaction may already be aborting or aborted.
|
|
100
|
+
}
|
|
101
|
+
reject(error);
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
this.pending.add(operation);
|
|
105
|
+
const remove = () => this.pending.delete(operation);
|
|
106
|
+
void operation.then(remove, remove);
|
|
107
|
+
return operation;
|
|
108
|
+
}
|
|
109
|
+
/** Reads one result from a readonly transaction. */
|
|
110
|
+
read(request) {
|
|
111
|
+
return this.transaction('readonly', (store, result) => {
|
|
112
|
+
const read = request(store);
|
|
113
|
+
read.onsuccess = () => result(read.result);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/** Commits serialized JSON under the key. */
|
|
117
|
+
put(key, json) {
|
|
118
|
+
return this.transaction('readwrite', (store, result) => {
|
|
119
|
+
store.put(json, key);
|
|
120
|
+
result(undefined);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/** Reads stored JSON or returns undefined for a missing key. */
|
|
124
|
+
get(key) {
|
|
125
|
+
return this.read((store) => store.get(key));
|
|
126
|
+
}
|
|
127
|
+
/** Reads presence without retrieving the value. */
|
|
128
|
+
async has(key) {
|
|
129
|
+
return (await this.read((store) => store.getKey(key))) !== undefined;
|
|
130
|
+
}
|
|
131
|
+
/** Checks existence and deletes atomically so concurrent callers get their own result. */
|
|
132
|
+
delete(key) {
|
|
133
|
+
return this.transaction('readwrite', (store, result) => {
|
|
134
|
+
const request = store.getKey(key);
|
|
135
|
+
request.onsuccess = () => {
|
|
136
|
+
const exists = request.result !== undefined;
|
|
137
|
+
if (exists)
|
|
138
|
+
store.delete(key);
|
|
139
|
+
result(exists);
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/** Removes all records atomically. */
|
|
144
|
+
clear() {
|
|
145
|
+
return this.transaction('readwrite', (store, result) => {
|
|
146
|
+
store.clear();
|
|
147
|
+
result(undefined);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/** Counts records without reading their values. */
|
|
151
|
+
count() {
|
|
152
|
+
return this.read((store) => store.count());
|
|
153
|
+
}
|
|
154
|
+
/** Collects the matching snapshot before returning control to the consumer. */
|
|
155
|
+
async scan(range) {
|
|
156
|
+
return this.transaction('readonly', (store, result) => {
|
|
157
|
+
const bounds = keyRange(range);
|
|
158
|
+
const entries = [];
|
|
159
|
+
result(entries);
|
|
160
|
+
if (bounds === null)
|
|
161
|
+
return;
|
|
162
|
+
const request = store.openCursor(bounds, range.reverse ? 'prev' : 'next');
|
|
163
|
+
request.onsuccess = () => {
|
|
164
|
+
const cursor = request.result;
|
|
165
|
+
if (!cursor)
|
|
166
|
+
return;
|
|
167
|
+
const key = cursor.key;
|
|
168
|
+
if (range.prefix !== undefined &&
|
|
169
|
+
(typeof key !== 'string' || !key.startsWith(range.prefix)))
|
|
170
|
+
return;
|
|
171
|
+
entries.push({ key, value: cursor.value });
|
|
172
|
+
if (entries.length !== range.limit)
|
|
173
|
+
cursor.continue();
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/** Prevents new work and closes after all already submitted transactions settle. */
|
|
178
|
+
async close() {
|
|
179
|
+
this.closing = true;
|
|
180
|
+
await Promise.allSettled(this.pending);
|
|
181
|
+
try {
|
|
182
|
+
const db = await this.connection;
|
|
183
|
+
db.close();
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// If opening the database failed, it is already closed.
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/** Deletes by name after close, rejecting handles invalidated by a version change. */
|
|
190
|
+
async destroy() {
|
|
191
|
+
if (this.invalidated)
|
|
192
|
+
throw new Error('Store was closed for an external database version change');
|
|
193
|
+
return new Promise((resolve, reject) => {
|
|
194
|
+
const request = indexedDB.deleteDatabase(this.name);
|
|
195
|
+
request.onsuccess = () => resolve();
|
|
196
|
+
request.onerror = () => reject(request.error);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=indexeddb-backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexeddb-backend.js","sourceRoot":"","sources":["../../src/indexeddb-backend.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAG,SAAS,CAAA;AAEzB,sFAAsF;AACtF,SAAS,SAAS,CAAC,MAAc;IAC/B,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,SAAS,CAAA;IACnC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IACzB,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,CAAC,EAAE,CAAA;IACrD,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAA;IAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,uEAAuE;AACvE,SAAS,QAAQ,CAAC,KAAgB;IAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAA;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAA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,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shares the default LMDB key-size limit and string prefix bounding for LMDB.
|
|
3
|
+
*/
|
|
4
|
+
import type { StoreKey } from './flash-store-core.ts';
|
|
5
|
+
/** Rejects oversized keys before either backend or the write-back cache mutates. */
|
|
6
|
+
export declare function validateKeySize(key: StoreKey): void;
|
|
7
|
+
/** Returns an exclusive bound for a nonempty encoded string prefix for LMDB. */
|
|
8
|
+
export declare function encodePrefixEnd(prefix: string): Uint8Array<ArrayBuffer> | undefined;
|
|
9
|
+
//# sourceMappingURL=key-encoding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-encoding.d.ts","sourceRoot":"","sources":["../../src/key-encoding.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAKrD,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAMnD;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,GACb,UAAU,CAAC,WAAW,CAAC,GAAG,SAAS,CAQrC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const maxKeyBytes = 1978;
|
|
2
|
+
const encoder = new TextEncoder();
|
|
3
|
+
/** Rejects oversized keys before either backend or the write-back cache mutates. */
|
|
4
|
+
export function validateKeySize(key) {
|
|
5
|
+
// Each UTF-16 code unit needs at most three bytes, plus a possible lead byte.
|
|
6
|
+
if (typeof key === 'string' && key.length * 3 + 1 > maxKeyBytes) {
|
|
7
|
+
if (encoder.encode(key).length > maxKeyBytes)
|
|
8
|
+
throw new RangeError('Key was too large');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Returns an exclusive bound for a nonempty encoded string prefix for LMDB. */
|
|
12
|
+
export function encodePrefixEnd(prefix) {
|
|
13
|
+
if (prefix === '')
|
|
14
|
+
return undefined;
|
|
15
|
+
const bytes = encoder.encode(prefix);
|
|
16
|
+
// An encoded UTF-8 string ends in an ASCII or continuation byte (none is 255).
|
|
17
|
+
// Advancing the byte keeps the bound within the key limit.
|
|
18
|
+
const last = bytes.length - 1;
|
|
19
|
+
bytes[last] = (bytes[last] ?? 0) + 1;
|
|
20
|
+
return bytes;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=key-encoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-encoding.js","sourceRoot":"","sources":["../../src/key-encoding.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,GAAG,IAAI,CAAA;AACxB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,GAAa;IAC3C,8EAA8E;IAC9E,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC;QAChE,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,WAAW;YAC1C,MAAM,IAAI,UAAU,CAAC,mBAAmB,CAAC,CAAA;IAC7C,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,eAAe,CAC7B,MAAc;IAEd,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,SAAS,CAAA;IACnC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACpC,+EAA+E;IAC/E,2DAA2D;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;IAC7B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;IACpC,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes the serialized storage contract between the shared Map API and
|
|
3
|
+
* LMDB or IndexedDB. Backends own resource lifetimes and transaction boundaries.
|
|
4
|
+
*/
|
|
5
|
+
import type { StoreKey } from './flash-store-core.ts';
|
|
6
|
+
/** A normalized scan. A string prefix is mutually exclusive with explicit bounds. */
|
|
7
|
+
export interface ScanRange {
|
|
8
|
+
lower?: StoreKey;
|
|
9
|
+
upper?: StoreKey;
|
|
10
|
+
lowerOpen: boolean;
|
|
11
|
+
upperOpen: boolean;
|
|
12
|
+
reverse: boolean;
|
|
13
|
+
prefix?: string;
|
|
14
|
+
limit?: number;
|
|
15
|
+
}
|
|
16
|
+
/** A record whose value is already serialized. */
|
|
17
|
+
export interface StoredEntry {
|
|
18
|
+
key: StoreKey;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
/** Internal storage operations. Writes resolve once the backend commits them. */
|
|
22
|
+
export interface StoreBackend {
|
|
23
|
+
put(key: StoreKey, json: string): Promise<unknown>;
|
|
24
|
+
get(key: StoreKey): string | undefined | Promise<string | undefined>;
|
|
25
|
+
has(key: StoreKey): boolean | Promise<boolean>;
|
|
26
|
+
delete(key: StoreKey): Promise<boolean>;
|
|
27
|
+
clear(): Promise<void>;
|
|
28
|
+
/** Starts a count on the current read snapshot before returning its promise. */
|
|
29
|
+
count(): Promise<number>;
|
|
30
|
+
scan(range: ScanRange): Iterable<StoredEntry> | Promise<Iterable<StoredEntry>>;
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
destroy(): Promise<void>;
|
|
33
|
+
publish?(operation: 'set' | 'delete' | 'clear'): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=store-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-backend.d.ts","sourceRoot":"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AAO,CAAC,CAAC,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAA;CACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-backend.js","sourceRoot":"","sources":["../../src/store-backend.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flash-store",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Persistent Map-like storage
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Persistent Map-like storage for Node.js, Deno, and Chrome.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
+
"browser": {
|
|
9
|
+
"types": "./dist/src/browser.d.ts",
|
|
10
|
+
"import": "./dist/src/browser.js",
|
|
11
|
+
"default": "./dist/src/browser.js"
|
|
12
|
+
},
|
|
8
13
|
"types": "./dist/src/mod.d.ts",
|
|
9
14
|
"import": "./dist/src/mod.js"
|
|
15
|
+
},
|
|
16
|
+
"./browser": {
|
|
17
|
+
"types": "./dist/src/browser.d.ts",
|
|
18
|
+
"import": "./dist/src/browser.js",
|
|
19
|
+
"default": "./dist/src/browser.js"
|
|
10
20
|
}
|
|
11
21
|
},
|
|
12
22
|
"types": "./dist/src/mod.d.ts",
|
|
@@ -15,18 +25,23 @@
|
|
|
15
25
|
"npm": ">=11"
|
|
16
26
|
},
|
|
17
27
|
"scripts": {
|
|
18
|
-
"build": "
|
|
28
|
+
"build": "node scripts/prepare-package.ts && tsc",
|
|
19
29
|
"prepack": "npm run build",
|
|
20
30
|
"demo": "node example/demo.ts",
|
|
21
31
|
"benchmark": "node scripts/benchmark.ts",
|
|
22
|
-
"lint": "biome check src example scripts tsconfig.json package.json biome.json coverage-baselines
|
|
32
|
+
"lint": "biome check src example scripts tests web-test-runner.config.js tsconfig.json package.json biome.json .github/coverage-baselines",
|
|
23
33
|
"typecheck": "tsc --noEmit",
|
|
24
34
|
"test": "npm run typecheck && npm run lint && npm run test:unit",
|
|
25
|
-
"test:unit": "node --test src
|
|
26
|
-
"test:deno": "
|
|
35
|
+
"test:unit": "node --test \"src/**/*.test.ts\"",
|
|
36
|
+
"test:deno": "npm run test:unit:deno",
|
|
27
37
|
"coverage:node": "node scripts/coverage.ts node",
|
|
28
38
|
"coverage:deno": "node scripts/coverage.ts deno",
|
|
29
|
-
"
|
|
39
|
+
"coverage:browser": "node scripts/coverage.ts browser",
|
|
40
|
+
"test:pack": "node scripts/pack-test.ts",
|
|
41
|
+
"test:unit:deno": "deno test --no-check --allow-read --allow-write --allow-env --allow-ffi --allow-sys=homedir src/",
|
|
42
|
+
"test:unit:browser": "wtr --config web-test-runner.config.js",
|
|
43
|
+
"test:integration": "node --test tests/native.integration.test.ts",
|
|
44
|
+
"test:integration:deno": "deno test --no-check --allow-read --allow-write --allow-env --allow-ffi --allow-sys=homedir tests/native.integration.test.ts"
|
|
30
45
|
},
|
|
31
46
|
"repository": {
|
|
32
47
|
"type": "git",
|
|
@@ -44,21 +59,35 @@
|
|
|
44
59
|
},
|
|
45
60
|
"homepage": "https://github.com/huan/flash-store#readme",
|
|
46
61
|
"dependencies": {
|
|
47
|
-
"brolog": "^
|
|
62
|
+
"brolog": "^2.0.0",
|
|
48
63
|
"lmdb": "~3.5.9"
|
|
49
64
|
},
|
|
50
65
|
"devDependencies": {
|
|
51
66
|
"@biomejs/biome": "2.6.7",
|
|
67
|
+
"@types/chai": "^5.2.3",
|
|
52
68
|
"@types/node": "^26.6.6",
|
|
69
|
+
"@web/dev-server-esbuild": "^2.0.1",
|
|
70
|
+
"@web/test-runner": "^1.0.1",
|
|
71
|
+
"@web/test-runner-playwright": "^1.0.2",
|
|
72
|
+
"chai": "^6.3.0",
|
|
73
|
+
"esbuild": "^0.28.2",
|
|
74
|
+
"playwright": "^1.61.1",
|
|
53
75
|
"typescript": "^7.0.2"
|
|
54
76
|
},
|
|
55
77
|
"files": [
|
|
56
78
|
"dist/src/",
|
|
57
|
-
"!dist/src
|
|
79
|
+
"!dist/src/**/*.test.*",
|
|
80
|
+
"!dist/src/**/test-fixture.*",
|
|
58
81
|
"dist/package.json"
|
|
59
82
|
],
|
|
60
83
|
"publishConfig": {
|
|
61
84
|
"access": "public",
|
|
62
85
|
"tag": "next"
|
|
86
|
+
},
|
|
87
|
+
"imports": {
|
|
88
|
+
"#test-store": {
|
|
89
|
+
"browser": "./src/browser.ts",
|
|
90
|
+
"default": "./src/mod.ts"
|
|
91
|
+
}
|
|
63
92
|
}
|
|
64
93
|
}
|