bun-sqlite-for-rxdb 1.3.1 → 1.5.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 +10 -22
- package/dist/index.js +642 -232
- package/dist/src/instance.d.ts +2 -1
- package/dist/src/query/builder.d.ts +2 -1
- package/dist/src/query/lightweight-matcher.d.ts +3 -0
- package/dist/src/query/operators.d.ts +12 -11
- package/dist/src/query/schema-mapper.d.ts +1 -1
- package/dist/src/query/smart-regex.d.ts +1 -0
- package/package.json +10 -8
- package/CHANGELOG.md +0 -722
package/README.md
CHANGED
|
@@ -4,33 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
RxDB storage adapter that translates Mango queries directly to bun:sqlite (except of $regex), bypassing slow in-memory filtering.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- ✅ **
|
|
11
|
-
- ✅
|
|
9
|
+
## Features
|
|
10
|
+
- ✅ **17 Mango operators** directly using SQL ($eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $or, $and, $exists, $elemMatch, $not, $nor, $type, $size, $mod)
|
|
11
|
+
- ✅ **1 Mango operator optimized in memory** (complex $regex)
|
|
12
|
+
- ✅ **Smart regex** - converts simple patterns to SQL LIKE (uses indexes)
|
|
12
13
|
- ✅ **Attachments support** (base64 storage with digest validation)
|
|
13
|
-
|
|
14
|
-
- ✅ **18 Mango operators** ($eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $or, $and, $exists, $regex, $elemMatch, $not, $nor, $type, $size, $mod)
|
|
14
|
+
|
|
15
15
|
- ✅ **Multi-instance support** with connection pooling
|
|
16
|
-
- ✅ **
|
|
16
|
+
- ✅ **Dual LRU caching** - prepared statements + query AST parsing
|
|
17
|
+
- ✅ **Property-based testing** with fast-check (3000+ assertions vs Mingo and Sift.js)
|
|
17
18
|
- ✅ MIT licensed
|
|
18
19
|
|
|
19
20
|
## Performance
|
|
20
21
|
|
|
22
|
+
### Database Performance
|
|
21
23
|
Benchmarked against better-sqlite3 (1M documents, WAL mode + PRAGMA synchronous = 1):
|
|
22
24
|
|
|
23
25
|
| Operation | Bun SQLite | better-sqlite3 | Speedup |
|
|
24
26
|
|-----------|------------|----------------|---------|
|
|
25
27
|
| Bulk INSERT (1M docs) | 7.42s | 7.90s | **1.06x faster** |
|
|
26
28
|
| SELECT by ID (10K lookups) | 170ms | 170ms | Equal |
|
|
27
|
-
| Complex WHERE query | 484ms | 814ms | **1.68x faster** |
|
|
28
|
-
|
|
29
|
-
**Requirements for optimal performance:**
|
|
30
|
-
```typescript
|
|
31
|
-
db.run("PRAGMA journal_mode = WAL");
|
|
32
|
-
db.run("PRAGMA synchronous = 1");
|
|
33
|
-
```
|
|
29
|
+
| Complex WHERE query | 484ms | 814ms | **1.68x faster** |
|
|
34
30
|
|
|
35
31
|
## Installation
|
|
36
32
|
|
|
@@ -66,14 +62,6 @@ bun test
|
|
|
66
62
|
bun run typecheck
|
|
67
63
|
```
|
|
68
64
|
|
|
69
|
-
## Architecture
|
|
70
|
-
|
|
71
|
-
**Key components:**
|
|
72
|
-
- `RxStorage` factory
|
|
73
|
-
- `RxStorageInstance` implementation (11 required methods)
|
|
74
|
-
- Mango query → SQL translator
|
|
75
|
-
- Change stream observables
|
|
76
|
-
|
|
77
65
|
## License
|
|
78
66
|
|
|
79
67
|
MIT © adam2am
|