bun-sqlite-for-rxdb 1.8.1 → 1.8.3-beta

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 (35) hide show
  1. package/README.md +76 -76
  2. package/dist/index.js +4961 -3283
  3. package/dist/src/connection-pool.d.ts +1 -1
  4. package/dist/src/instance.d.ts +3 -0
  5. package/dist/src/query/builder.d.ts +17 -6
  6. package/dist/src/query/cache.d.ts +8 -9
  7. package/dist/src/query/js-operators/array.d.ts +7 -0
  8. package/dist/src/query/js-operators/comparison.d.ts +7 -0
  9. package/dist/src/query/js-operators/evaluation.d.ts +7 -0
  10. package/dist/src/query/js-operators/index.d.ts +8 -0
  11. package/dist/src/query/js-regex-matcher.d.ts +3 -0
  12. package/dist/src/query/no-op-cache.d.ts +1 -1
  13. package/dist/src/query/operator-registry.d.ts +61 -0
  14. package/dist/src/query/regex-to-sql.d.ts +8 -0
  15. package/dist/src/query/schema-to-field-type.d.ts +9 -0
  16. package/dist/src/query/sql-operators/array.d.ts +7 -0
  17. package/dist/src/query/sql-operators/comparison.d.ts +10 -0
  18. package/dist/src/query/sql-operators/evaluation.d.ts +8 -0
  19. package/dist/src/query/sql-operators/field-utils.d.ts +2 -0
  20. package/dist/src/query/sql-operators/index.d.ts +16 -0
  21. package/dist/src/query/sql-operators/null-aware.d.ts +4 -0
  22. package/dist/src/query/sql-operators/null-semantics.d.ts +2 -0
  23. package/dist/src/query/sql-operators/primitives.d.ts +17 -0
  24. package/dist/src/query/sql-operators/query-budget.d.ts +4 -0
  25. package/dist/src/query/sql-operators/result.d.ts +34 -0
  26. package/dist/src/query/sql-operators/traversal.d.ts +13 -0
  27. package/dist/src/query/sql-typeguard.d.ts +35 -0
  28. package/dist/src/query/type-guards.d.ts +2 -0
  29. package/dist/src/query/value-from-unknowntype.d.ts +21 -0
  30. package/dist/src/statement-manager.d.ts +1 -2
  31. package/dist/src/telemetry.d.ts +7 -0
  32. package/dist/src/top-k-heap.d.ts +13 -0
  33. package/dist/src/types.d.ts +7 -0
  34. package/dist/src/utils/sieve-cache.d.ts +26 -0
  35. package/package.json +1 -1
package/README.md CHANGED
@@ -1,76 +1,76 @@
1
- # bun-sqlite-for-rxdb
2
-
3
- > Unofficial RxDB storage adapter for Bun's native SQLite (`bun:sqlite`)
4
-
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
-
7
- RxDB storage adapter that translates Mango queries directly to bun:sqlite (except of $regex), bypassing slow in-memory filtering.
8
-
9
- ## Features
10
- - ✅ **18 Mango operators** directly using SQL ($eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $or, $and, $exists, $elemMatch, $not, $nor, $type, $size, $mod, $all if schema defined)
11
- *"If users want performance, they should define their data structures. If they want sloppy schemaless behavior, they pay the Mingo tax. This aligns incentives correctly."*
12
- - ✅ **1 Mango operator optimized in memory** (complex $regex)
13
- - ✅ **Smart regex** - converts simple patterns to SQL LIKE (uses indexes)
14
- - ✅ **Attachments support** (base64 storage with digest validation)
15
-
16
- - ✅ **Multi-instance support** with connection pooling
17
- - ✅ **Dual LRU caching** - prepared statements + query AST parsing
18
- - ✅ **Property-based testing** with fast-check (3000+ assertions vs Mingo and Sift.js)
19
- - ✅ MIT licensed
20
-
21
- ## Performance
22
-
23
- ### Database Performance
24
- Benchmarked against better-sqlite3 (1M documents, WAL mode + PRAGMA synchronous = 1):
25
-
26
- | Operation | Bun SQLite | better-sqlite3 | Speedup |
27
- |-----------|------------|----------------|---------|
28
- | Bulk INSERT (1M docs) | 7.42s | 7.90s | **1.06x faster** |
29
- | SELECT by ID (10K lookups) | 170ms | 170ms | Equal |
30
- | Complex WHERE query | 484ms | 814ms | **1.68x faster** |
31
-
32
- ## Installation
33
-
34
- ```bash
35
- bun add bun-sqlite-for-rxdb
36
- ```
37
-
38
- ## Usage
39
-
40
- ```typescript
41
- import { createRxDatabase } from 'rxdb';
42
- import { getRxStorageBunSQLite } from 'bun-sqlite-for-rxdb';
43
-
44
- const db = await createRxDatabase({
45
- name: 'mydb',
46
- storage: getRxStorageBunSQLite()
47
- });
48
- ```
49
-
50
- ## Development
51
-
52
- ```bash
53
- # Install dependencies
54
- bun install
55
-
56
- # Build
57
- bun run build
58
-
59
- # Test
60
- bun test
61
-
62
- # Type check
63
- bun run typecheck
64
- ```
65
-
66
- ## License
67
-
68
- MIT © adam2am
69
-
70
- ## Contributing
71
-
72
- Contributions welcome! This is a community project.
73
-
74
- ---
75
-
76
- **Not affiliated with RxDB or Bun. Community-maintained adapter.**
1
+ # bun-sqlite-for-rxdb
2
+
3
+ > Unofficial RxDB storage adapter for Bun's native SQLite (`bun:sqlite`)
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ RxDB storage adapter that translates Mango queries directly to bun:sqlite (except of $regex), bypassing slow in-memory filtering.
8
+
9
+ ## Features
10
+ - ✅ **18 Mango operators** directly using SQL ($eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $or, $and, $exists, $elemMatch, $not, $nor, $type, $size, $mod, $all if schema defined)
11
+ *"If users want performance, they should define their data structures. If they want sloppy schemaless behavior, they pay the Mingo tax. This aligns incentives correctly."*
12
+ - ✅ **1 Mango operator optimized in memory** (complex $regex)
13
+ - ✅ **Smart regex** - converts simple patterns to SQL LIKE (uses indexes)
14
+ - ✅ **Attachments support** (base64 storage with digest validation)
15
+
16
+ - ✅ **Multi-instance support** with connection pooling
17
+ - ✅ **Dual LRU caching** - prepared statements + query AST parsing
18
+ - ✅ **Property-based testing** with fast-check (3000+ assertions vs Mingo and Sift.js)
19
+ - ✅ MIT licensed
20
+
21
+ ## Performance
22
+
23
+ ### Database Performance
24
+ Benchmarked against better-sqlite3 (1M documents, WAL mode + PRAGMA synchronous = 1):
25
+
26
+ | Operation | Bun SQLite | better-sqlite3 | Speedup |
27
+ |-----------|------------|----------------|---------|
28
+ | Bulk INSERT (1M docs) | 7.42s | 7.90s | **1.06x faster** |
29
+ | SELECT by ID (10K lookups) | 170ms | 170ms | Equal |
30
+ | Complex WHERE query | 484ms | 814ms | **1.68x faster** |
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ bun add bun-sqlite-for-rxdb
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```typescript
41
+ import { createRxDatabase } from 'rxdb';
42
+ import { getRxStorageBunSQLite } from 'bun-sqlite-for-rxdb';
43
+
44
+ const db = await createRxDatabase({
45
+ name: 'mydb',
46
+ storage: getRxStorageBunSQLite()
47
+ });
48
+ ```
49
+
50
+ ## Development
51
+
52
+ ```bash
53
+ # Install dependencies
54
+ bun install
55
+
56
+ # Build
57
+ bun run build
58
+
59
+ # Test
60
+ bun test
61
+
62
+ # Type check
63
+ bun run typecheck
64
+ ```
65
+
66
+ ## License
67
+
68
+ MIT © adam2am
69
+
70
+ ## Contributing
71
+
72
+ Contributions welcome! This is a community project.
73
+
74
+ ---
75
+
76
+ **Not affiliated with RxDB or Bun. Community-maintained adapter.**