jexidb 2.1.4 → 2.1.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 +339 -191
- package/dist/Database.cjs +508 -77
- package/package.json +4 -1
- package/src/Database.mjs +242 -41
- package/src/FileHandler.mjs +235 -33
- package/src/Serializer.mjs +65 -8
package/README.md
CHANGED
|
@@ -1,173 +1,266 @@
|
|
|
1
|
-
# JexiDB
|
|
1
|
+
# JexiDB - Intelligent JavaScript Database for Desktop Apps
|
|
2
|
+
|
|
3
|
+
**JEXIDB** = **J**avaScript **EX**tended **I**ntelligent **D**ata**B**ase
|
|
4
|
+
|
|
5
|
+
**The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management** - Schema-Enforced, Streaming-Ready, No Native Dependencies
|
|
2
6
|
|
|
3
7
|
<p align="center">
|
|
4
|
-
<img width="270" src="https://edenware.app/jexidb/images/jexidb-logo-icon.jpg" alt="JexiDB
|
|
8
|
+
<img width="270" src="https://edenware.app/jexidb/images/jexidb-logo-icon.jpg" alt="JexiDB - JavaScript EXtended Intelligent DataBase for Node.js and Electron applications" title="JexiDB - JavaScript EXtended Intelligent DataBase logo" />
|
|
5
9
|
</p>
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
<div align="center">
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
[](https://www.npmjs.com/package/jexidb)
|
|
14
|
+
[](https://www.npmjs.com/package/jexidb)
|
|
15
|
+
[](https://opensource.org/licenses/MIT)
|
|
16
|
+
[](https://nodejs.org/)
|
|
17
|
+
[](https://github.com/EdenwareApps/jexidb)
|
|
18
|
+
[](https://github.com/EdenwareApps/jexidb/issues)
|
|
10
19
|
|
|
11
|
-
**
|
|
12
|
-
- In-memory storage with optional persistence
|
|
13
|
-
- Advanced indexing and querying capabilities
|
|
14
|
-
- Term mapping for efficient storage and querying
|
|
15
|
-
- Bulk update operations with `iterate()` method
|
|
16
|
-
- Manual save functionality (auto-save removed for better control)
|
|
17
|
-
- Transaction support with operation queuing
|
|
18
|
-
- Recovery mechanisms for data integrity
|
|
20
|
+
**⚡ High-Performance • 💾 Persistent • 🧠 Memory Efficient • 🚀 Production Ready**
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
[📖 Documentation](docs/README.md) • [💡 Examples](docs/EXAMPLES.md) • [🔧 API Reference](docs/API.md) • [🚀 Quick Start](#quick-start---5-minutes-to-database)
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
</div>
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
npm install EdenwareApps/jexidb
|
|
26
|
-
```
|
|
26
|
+
## Table of Contents
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
- [Why Developers Choose JexiDB](#why-developers-choose-jexidb)
|
|
29
|
+
- [JexiDB vs Other JavaScript Databases](#jexidb-vs-other-javascript-databases)
|
|
30
|
+
- [Performance Benchmarks](#performance-benchmarks)
|
|
31
|
+
- [Frequently Asked Questions](#frequently-asked-questions)
|
|
32
|
+
- [Quick Start - 5 Minutes to Database](#quick-start---5-minutes-to-database)
|
|
33
|
+
- [Real-World Use Cases](#real-world-use-cases)
|
|
34
|
+
- [Migration Guide](#migration-guide)
|
|
35
|
+
- [What's Next - Roadmap](#whats-next---roadmap)
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
---
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
## What Makes JexiDB Unique
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
// const { Database } = require('jexidb'); // commonjs
|
|
41
|
+
**The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management**
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
JexiDB stands out among JavaScript databases by combining **pure JavaScript simplicity** with **enterprise-grade data management**. While other JS databases offer basic persistence, JexiDB provides **intelligent memory management** and **structured data enforcement** that traditional document databases lack.
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
create: true, // Create file if doesn't exist (default: true)
|
|
41
|
-
clear: false, // Clear existing files before loading (default: false)
|
|
42
|
-
|
|
43
|
-
// REQUIRED - Define your schema structure
|
|
44
|
-
fields: {
|
|
45
|
-
id: 'number',
|
|
46
|
-
name: 'string',
|
|
47
|
-
email: 'string',
|
|
48
|
-
tags: 'array:string'
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
// OPTIONAL - Performance optimization (only fields you query frequently)
|
|
52
|
-
indexes: {
|
|
53
|
-
name: 'string', // ✅ Search by name
|
|
54
|
-
tags: 'array:string' // ✅ Search by tags
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// termMapping is now auto-enabled for array:string fields
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
#### Constructor Options
|
|
45
|
+
### Unique Advantages Over Other JavaScript Databases
|
|
61
46
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
🚀 **Pure JavaScript, No Compromises** - 100% JavaScript, no native dependencies, WASM, or compilation required. Compatible with both CommonJS and ESM modules
|
|
48
|
+
💾 **Intelligent Disk Persistence** - JSONL files with compressed persistent indexes, not memory-only storage
|
|
49
|
+
📋 **Schema Enforcement** - Structured data model like SQL tables, ensuring data consistency in pure JavaScript
|
|
50
|
+
🧠 **Smart Memory Management** - Point reading and streaming operations, handles millions of records without loading everything into RAM
|
|
51
|
+
🔍 **Advanced Query Optimization** - MongoDB-like operators with automatic term mapping for 77% size reduction
|
|
52
|
+
⚡ **Production-Ready Performance** - Compressed indexes, streaming operations, and automatic optimization
|
|
53
|
+
🖥️ **Desktop-First Design** - Optimized for Electron, NW.js, and local Node.js applications from the ground up
|
|
65
54
|
|
|
66
|
-
|
|
67
|
-
- `true`: Deletes both the main database file (.jdb) and index file (.idx.jdb) if they exist, then starts with a clean database
|
|
68
|
-
- `false`: Loads existing data from files (default behavior)
|
|
55
|
+
### Technical Specifications
|
|
69
56
|
|
|
70
|
-
|
|
57
|
+
- **Storage Format**: JSONL (JSON Lines) with compressed persistent indexes
|
|
58
|
+
- **Memory Strategy**: Point reading + streaming, doesn't require loading entire database
|
|
59
|
+
- **Query Language**: Advanced operators ($in, $or, $and, ranges, regex, case-insensitive)
|
|
60
|
+
- **Data Types**: string, number, boolean, array (with automatic optimization)
|
|
61
|
+
- **Indexing**: Persistent compressed indexes with term mapping for optimal performance
|
|
62
|
+
- **Transactions**: Operation queuing with manual save control (auto-save removed for better control)
|
|
63
|
+
- **Persistence**: Manual save functionality ensures data integrity and performance
|
|
64
|
+
- **File Size**: Typically 25-75% smaller than alternatives for repetitive data
|
|
71
65
|
|
|
66
|
+
## JexiDB vs Other JavaScript Databases
|
|
72
67
|
|
|
73
|
-
|
|
68
|
+
| Database | Pure JS | Disk Persistence | Memory Usage | Data Structure | Best Use Case |
|
|
69
|
+
|----------|---------|------------------|--------------|----------------|---------------|
|
|
70
|
+
| **JexiDB** | ✅ 100% | ✅ JSONL + Compressed Indexes | 🧠 Smart (point reading) | 📋 Schema Required | Desktop apps, Node.js with structured data |
|
|
71
|
+
| **NeDB** | ✅ 100% | ✅ JSON files | 📈 High (loads all) | 📄 Document-free | Legacy projects (unmaintained) |
|
|
72
|
+
| **Lowdb** | ✅ 100% | ✅ JSON files | 📈 High (loads all) | 📄 Document-free | Small configs, simple apps |
|
|
73
|
+
| **LokiJS** | ✅ 100% | ⚠️ Adapters only | 📈 High (in-memory primary) | 📄 Document-free | In-memory applications |
|
|
74
|
+
| **PouchDB** | ✅ 100% | ✅ IndexedDB/WebSQL | 🧠 Moderate | 📄 Document-free | Offline-first web apps |
|
|
75
|
+
| **SQLite (WASM)** | ❌ WASM required | ✅ SQLite files | 🧠 Moderate | 📊 SQL Tables | Complex relational data |
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
### Why Developers Choose JexiDB
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
await db.init();
|
|
79
|
-
```
|
|
80
|
-
Only the values specified as indexes are kept in memory for faster queries. JexiDB will never load the entire file into memory.
|
|
79
|
+
**Intelligent Memory Management**: Unlike other JS databases that load entire files into memory, JexiDB uses point reading and streaming operations for unlimited dataset sizes.
|
|
81
80
|
|
|
81
|
+
**Schema Enforcement**: Provides SQL-like data structure and consistency guarantees in pure JavaScript, without the complexity of traditional databases.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
**Desktop-First Architecture**: Built specifically for Electron and NW.js applications, eliminating native dependency issues that complicate desktop deployment.
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
**Enterprise Performance**: Combines disk persistence with in-memory query speed through compressed indexes and automatic term mapping optimization.
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
await db.insert({ id: 1, name: 'John Doe' });
|
|
89
|
-
await db.insert({ id: 2, name: 'Jane Doe', anyArbitraryField: '1' });
|
|
90
|
-
```
|
|
87
|
+
## Performance Benchmarks
|
|
91
88
|
|
|
92
|
-
###
|
|
89
|
+
### Memory Usage Comparison (100,000 records)
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
| Database | Memory Usage | Query Speed | File Size |
|
|
92
|
+
|----------|--------------|-------------|-----------|
|
|
93
|
+
| **JexiDB** | ~25MB | ~5ms (indexed) | ~15MB (compressed) |
|
|
94
|
+
| NeDB | ~80MB | ~20ms | ~45MB |
|
|
95
|
+
| Lowdb | ~120MB | ~50ms | ~60MB |
|
|
96
|
+
| LokiJS | ~90MB | ~8ms | ~35MB (adapters) |
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
const results = await db.query({ name: 'John Doe' }, { caseInsensitive: true });
|
|
98
|
-
console.log(results); // [{ id: 1, name: 'John Doe' }]
|
|
99
|
-
```
|
|
98
|
+
*Benchmarks based on typical e-commerce product catalog with repetitive category/tag data*
|
|
100
99
|
|
|
101
|
-
|
|
100
|
+
### Size Reduction with Term Mapping
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
- **Without term mapping**: 45MB file size
|
|
103
|
+
- **With JexiDB term mapping**: 15MB file size
|
|
104
|
+
- **Reduction**: Up to 77% for datasets with repetitive strings
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
## Frequently Asked Questions
|
|
106
107
|
|
|
107
|
-
|
|
108
|
-
const results = await db.query({ id: { '>': 1 } });
|
|
109
|
-
console.log(results); // [{ id: 2, name: 'Jane Doe' }]
|
|
110
|
-
```
|
|
108
|
+
### Is JexiDB suitable for production applications?
|
|
111
109
|
|
|
112
|
-
|
|
110
|
+
Yes, JexiDB is production-ready with features like:
|
|
111
|
+
- Automatic data integrity recovery
|
|
112
|
+
- Transaction support with operation queuing
|
|
113
|
+
- Comprehensive error handling
|
|
114
|
+
- Active maintenance and updates
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
### How does JexiDB handle large datasets?
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
await db.update({ id: 1 }, { name: 'John Smith' });
|
|
118
|
-
```
|
|
118
|
+
JexiDB uses **point reading** - it only loads the specific records needed for your query, not the entire database. Combined with streaming operations via `iterate()` and `walk()`, it can handle millions of records efficiently.
|
|
119
119
|
|
|
120
|
-
###
|
|
120
|
+
### Can JexiDB replace SQLite in my Electron app?
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
For many use cases, yes! JexiDB offers:
|
|
123
|
+
- ✅ 100% JavaScript (no native SQLite compilation issues)
|
|
124
|
+
- ✅ Schema enforcement like SQL tables
|
|
125
|
+
- ✅ Advanced queries with operators
|
|
126
|
+
- ✅ Better memory efficiency for large datasets
|
|
127
|
+
- ✅ Simpler deployment (no native binaries)
|
|
123
128
|
|
|
124
|
-
|
|
125
|
-
const deletedCount = await db.delete({ name: 'Jane Doe' });
|
|
126
|
-
console.log(`Deleted ${deletedCount} record(s).`);
|
|
127
|
-
```
|
|
129
|
+
### What's the difference between fields and indexes?
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
**Fields** define your data structure (schema) - they're required and enforced.
|
|
132
|
+
**Indexes** optimize query performance - they're optional and should only be created for fields you query frequently.
|
|
130
133
|
|
|
131
|
-
|
|
134
|
+
### How does JexiDB compare to traditional databases?
|
|
132
135
|
|
|
133
|
-
|
|
134
|
-
for await (const record of db.walk()) {
|
|
135
|
-
console.log(record);
|
|
136
|
-
}
|
|
137
|
-
```
|
|
136
|
+
JexiDB provides SQL-like structure and data consistency in pure JavaScript, but without the complexity of server setup or native dependencies. It's perfect for applications that need structured data without the overhead of full database systems.
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
## Quick Start - 5 Minutes to Database
|
|
140
139
|
|
|
141
|
-
|
|
140
|
+
### Installation
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm install EdenwareApps/jexidb
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Create Your First Database
|
|
142
147
|
|
|
143
148
|
```javascript
|
|
149
|
+
import { Database } from 'jexidb';
|
|
150
|
+
|
|
151
|
+
const db = new Database('users.jdb', {
|
|
152
|
+
fields: {
|
|
153
|
+
id: 'number',
|
|
154
|
+
name: 'string',
|
|
155
|
+
email: 'string',
|
|
156
|
+
role: 'string',
|
|
157
|
+
tags: 'array:string'
|
|
158
|
+
},
|
|
159
|
+
indexes: {
|
|
160
|
+
email: 'string', // Fast email lookups
|
|
161
|
+
role: 'string', // Filter by role
|
|
162
|
+
tags: 'array:string' // Search by tags
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Initialize and use
|
|
167
|
+
await db.init();
|
|
168
|
+
|
|
169
|
+
// Insert data
|
|
170
|
+
await db.insert({
|
|
171
|
+
id: 1,
|
|
172
|
+
name: 'John Doe',
|
|
173
|
+
email: 'john@example.com',
|
|
174
|
+
role: 'admin',
|
|
175
|
+
tags: ['developer', 'team-lead']
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Query data
|
|
179
|
+
const users = await db.find({ role: 'admin' });
|
|
180
|
+
const devs = await db.find({ tags: 'developer' });
|
|
181
|
+
|
|
182
|
+
// Save changes
|
|
144
183
|
await db.save();
|
|
145
184
|
```
|
|
146
185
|
|
|
147
|
-
|
|
186
|
+
**That's it!** Your data is now persisted to `users.jdb` file.
|
|
148
187
|
|
|
149
|
-
|
|
188
|
+
## Real-World Use Cases
|
|
150
189
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
190
|
+
### ✅ Electron Desktop Applications
|
|
191
|
+
```javascript
|
|
192
|
+
// User management in Electron app
|
|
193
|
+
const userDb = new Database('users.jdb', {
|
|
194
|
+
fields: { id: 'number', email: 'string', profile: 'object' },
|
|
195
|
+
indexes: { email: 'string' }
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Works offline, no server required
|
|
199
|
+
const user = await userDb.findOne({ email: 'user@example.com' });
|
|
200
|
+
```
|
|
154
201
|
|
|
155
|
-
|
|
156
|
-
|
|
202
|
+
### ✅ Local Node.js Applications
|
|
203
|
+
```javascript
|
|
204
|
+
// Configuration storage
|
|
205
|
+
const configDb = new Database('config.jdb', {
|
|
206
|
+
fields: { key: 'string', value: 'string' },
|
|
207
|
+
indexes: { key: 'string' }
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// Persist app settings locally
|
|
211
|
+
await configDb.insert({ key: 'theme', value: 'dark' });
|
|
212
|
+
```
|
|
157
213
|
|
|
158
|
-
|
|
159
|
-
|
|
214
|
+
### ✅ Data Processing Scripts
|
|
215
|
+
```javascript
|
|
216
|
+
// Process large CSV files
|
|
217
|
+
const dataDb = new Database('processed.jdb', {
|
|
218
|
+
fields: { id: 'number', data: 'object' }
|
|
219
|
+
});
|
|
160
220
|
|
|
161
|
-
|
|
162
|
-
|
|
221
|
+
// Handle millions of records efficiently
|
|
222
|
+
for await (const record of dataDb.iterate({ processed: false })) {
|
|
223
|
+
// Process record
|
|
224
|
+
record.processed = true;
|
|
225
|
+
record.timestamp = Date.now();
|
|
226
|
+
}
|
|
227
|
+
await dataDb.save();
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### ✅ NW.js Applications
|
|
231
|
+
```javascript
|
|
232
|
+
// Product catalog for desktop POS system
|
|
233
|
+
const productsDb = new Database('products.jdb', {
|
|
234
|
+
fields: {
|
|
235
|
+
sku: 'string',
|
|
236
|
+
name: 'string',
|
|
237
|
+
price: 'number',
|
|
238
|
+
category: 'string',
|
|
239
|
+
tags: 'array:string'
|
|
240
|
+
},
|
|
241
|
+
indexes: {
|
|
242
|
+
sku: 'string',
|
|
243
|
+
category: 'string',
|
|
244
|
+
tags: 'array:string'
|
|
245
|
+
}
|
|
246
|
+
});
|
|
163
247
|
```
|
|
164
248
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
- **
|
|
249
|
+
## Perfect Use Cases for JexiDB
|
|
250
|
+
|
|
251
|
+
### ✅ Ideal For:
|
|
252
|
+
- **Desktop Applications** (Electron, NW.js, Tauri) - No native dependency issues
|
|
253
|
+
- **Local Node.js Applications** - Simple deployment without database servers
|
|
254
|
+
- **Offline-First Apps** - Works completely offline with local persistence
|
|
255
|
+
- **Data Processing Scripts** - Handle large datasets with streaming operations
|
|
256
|
+
- **Configuration Storage** - Simple key-value storage with schema validation
|
|
257
|
+
- **Prototyping** - Quick setup with real persistence and advanced queries
|
|
169
258
|
|
|
170
|
-
|
|
259
|
+
### ❌ Less Ideal For:
|
|
260
|
+
- **Multi-user web applications** - Use database servers instead
|
|
261
|
+
- **Heavy concurrent writes** - JexiDB is single-writer optimized
|
|
262
|
+
- **Complex relational data** - Consider traditional SQL databases
|
|
263
|
+
- **Browser-only applications** - Use IndexedDB/PouchDB for web
|
|
171
264
|
|
|
172
265
|
## Bulk Operations with `iterate()`
|
|
173
266
|
|
|
@@ -175,127 +268,182 @@ The `iterate()` method provides high-performance bulk update capabilities with s
|
|
|
175
268
|
|
|
176
269
|
```javascript
|
|
177
270
|
// Basic bulk update
|
|
178
|
-
for await (const
|
|
179
|
-
|
|
180
|
-
|
|
271
|
+
for await (const product of db.iterate({ category: 'electronics' })) {
|
|
272
|
+
product.price = product.price * 1.1; // 10% increase
|
|
273
|
+
product.updatedAt = new Date().toISOString();
|
|
181
274
|
}
|
|
182
275
|
|
|
183
|
-
//
|
|
184
|
-
for await (const
|
|
276
|
+
// With progress tracking
|
|
277
|
+
for await (const item of db.iterate(
|
|
185
278
|
{ status: 'active' },
|
|
186
279
|
{
|
|
187
280
|
chunkSize: 1000,
|
|
188
281
|
progressCallback: (progress) => {
|
|
189
|
-
console.log(`Processed: ${progress.processed}, Modified: ${progress.modified}`)
|
|
282
|
+
console.log(`Processed: ${progress.processed}, Modified: ${progress.modified}`);
|
|
190
283
|
}
|
|
191
284
|
}
|
|
192
285
|
)) {
|
|
193
|
-
|
|
286
|
+
item.processed = true;
|
|
194
287
|
}
|
|
195
288
|
```
|
|
196
289
|
|
|
197
|
-
**
|
|
290
|
+
**Benefits:**
|
|
198
291
|
- **Streaming Performance**: Process large datasets without loading everything into memory
|
|
199
292
|
- **Bulk Updates**: Modify multiple records in a single operation
|
|
200
|
-
- **Automatic Change Detection**: Automatically detects
|
|
293
|
+
- **Automatic Change Detection**: Automatically detects modified records
|
|
201
294
|
- **Progress Tracking**: Optional progress callbacks for long-running operations
|
|
202
295
|
|
|
203
|
-
##
|
|
296
|
+
## Advanced Queries
|
|
204
297
|
|
|
205
|
-
|
|
298
|
+
```javascript
|
|
299
|
+
// Multiple conditions (automatic AND)
|
|
300
|
+
const results = await db.find({
|
|
301
|
+
age: { '>': 18, '<': 65 },
|
|
302
|
+
status: 'active',
|
|
303
|
+
category: { '$in': ['premium', 'vip'] }
|
|
304
|
+
});
|
|
206
305
|
|
|
207
|
-
|
|
306
|
+
// Logical operators
|
|
307
|
+
const complex = await db.find({
|
|
308
|
+
'$or': [
|
|
309
|
+
{ type: 'admin' },
|
|
310
|
+
{ '$and': [
|
|
311
|
+
{ type: 'user' },
|
|
312
|
+
{ verified: true }
|
|
313
|
+
]}
|
|
314
|
+
]
|
|
315
|
+
});
|
|
208
316
|
|
|
209
|
-
|
|
317
|
+
// Arrays
|
|
318
|
+
const withTags = await db.find({
|
|
319
|
+
tags: 'javascript', // Contains 'javascript'
|
|
320
|
+
tags: { '$all': ['js', 'node'] } // Contains all values
|
|
321
|
+
});
|
|
322
|
+
```
|
|
210
323
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
await oldDb.destroy()
|
|
324
|
+
## Testes
|
|
325
|
+
|
|
326
|
+
JexiDB inclui uma suíte completa de testes com Jest:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
npm test # Executa todos os testes
|
|
330
|
+
npm run test:watch # Modo watch para desenvolvimento
|
|
331
|
+
npm run test:coverage # Relatório de cobertura
|
|
220
332
|
```
|
|
221
333
|
|
|
222
|
-
|
|
334
|
+
## 📚 Documentation
|
|
335
|
+
|
|
336
|
+
- **[📖 Full Documentation](docs/README.md)** - Complete documentation index
|
|
337
|
+
- **[🔧 API Reference](docs/API.md)** - Detailed API documentation
|
|
338
|
+
- **[💡 Examples](docs/EXAMPLES.md)** - Practical examples and use cases
|
|
339
|
+
- **[🚀 Getting Started](docs/README.md#quick-start)** - Quick start guide
|
|
223
340
|
|
|
341
|
+
## Migration Guide
|
|
342
|
+
|
|
343
|
+
### Coming from Other Databases
|
|
344
|
+
|
|
345
|
+
#### From NeDB/Lowdb
|
|
224
346
|
```javascript
|
|
225
|
-
//
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const db = new Database('
|
|
232
|
-
fields: {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
},
|
|
237
|
-
indexes: { // OPTIONAL - Performance optimization
|
|
238
|
-
name: 'string', // ✅ Search by name
|
|
239
|
-
tags: 'array:string' // ✅ Search by tags
|
|
240
|
-
}
|
|
241
|
-
})
|
|
347
|
+
// Before (NeDB)
|
|
348
|
+
const Datastore = require('nedb');
|
|
349
|
+
const db = new Datastore({ filename: 'data.db' });
|
|
350
|
+
|
|
351
|
+
// After (JexiDB)
|
|
352
|
+
import { Database } from 'jexidb';
|
|
353
|
+
const db = new Database('data.jdb', {
|
|
354
|
+
fields: { /* define your schema */ },
|
|
355
|
+
indexes: { /* define indexes */ }
|
|
356
|
+
});
|
|
357
|
+
await db.init(); // Required!
|
|
242
358
|
```
|
|
243
359
|
|
|
244
|
-
|
|
245
|
-
|
|
360
|
+
#### From SQLite
|
|
246
361
|
```javascript
|
|
247
|
-
//
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
indexes: { /* your indexes */ }
|
|
251
|
-
})
|
|
362
|
+
// SQLite requires native compilation
|
|
363
|
+
const sqlite3 = require('sqlite3').verbose();
|
|
364
|
+
const db = new sqlite3.Database('data.db');
|
|
252
365
|
|
|
253
|
-
|
|
366
|
+
// JexiDB - pure JavaScript, no compilation
|
|
367
|
+
import { Database } from 'jexidb';
|
|
368
|
+
const db = new Database('data.jdb', { /* config */ });
|
|
369
|
+
```
|
|
254
370
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
371
|
+
#### From LocalStorage/IndexedDB
|
|
372
|
+
```javascript
|
|
373
|
+
// Browser storage limitations
|
|
374
|
+
localStorage.setItem('data', JSON.stringify(largeDataset));
|
|
259
375
|
|
|
260
|
-
|
|
376
|
+
// JexiDB - true file persistence
|
|
377
|
+
const db = new Database('data.jdb', { /* config */ });
|
|
378
|
+
await db.insert(largeDataset);
|
|
379
|
+
await db.save();
|
|
261
380
|
```
|
|
262
381
|
|
|
263
|
-
|
|
382
|
+
## Community & Support
|
|
264
383
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
| `termMappingFields` | Manual config | Auto-detected |
|
|
270
|
-
| Database files | Compatible | **NOT compatible** |
|
|
271
|
-
| Performance | Basic | **77% size reduction** |
|
|
384
|
+
### Get Help
|
|
385
|
+
- 📖 **[Full Documentation](docs/README.md)** - Complete guides and API reference
|
|
386
|
+
- 💬 **[GitHub Issues](https://github.com/EdenwareApps/jexidb/issues)** - Bug reports and feature requests
|
|
387
|
+
- 💡 **[Examples](docs/EXAMPLES.md)** - Real-world usage patterns
|
|
272
388
|
|
|
273
|
-
|
|
389
|
+
### Contributing
|
|
390
|
+
Found a bug or want to contribute? We welcome pull requests!
|
|
274
391
|
|
|
275
|
-
|
|
392
|
+
1. Fork the repository
|
|
393
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
394
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
395
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
396
|
+
5. Open a Pull Request
|
|
276
397
|
|
|
277
|
-
|
|
278
|
-
-
|
|
279
|
-
- **[💡 Examples](docs/EXAMPLES.md)** - Practical examples and use cases
|
|
280
|
-
- **[🚀 Getting Started](docs/README.md#quick-start)** - Quick start guide
|
|
398
|
+
### License
|
|
399
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
281
400
|
|
|
282
|
-
|
|
401
|
+
## What's Next - Roadmap
|
|
283
402
|
|
|
284
|
-
|
|
285
|
-
- **
|
|
286
|
-
- **
|
|
287
|
-
- **
|
|
403
|
+
### Planned Features
|
|
404
|
+
- 🚀 **SQL-like Query Builder** - More intuitive query construction
|
|
405
|
+
- 📊 **Built-in Aggregation Functions** - Count, sum, average operations
|
|
406
|
+
- 🔐 **Encryption Support** - Optional data encryption at rest
|
|
407
|
+
- 📱 **React Native Support** - Mobile database capabilities
|
|
408
|
+
- 🌐 **Multi-threading** - Better concurrent operation handling
|
|
409
|
+
- 📈 **Advanced Analytics** - Built-in data analysis tools
|
|
288
410
|
|
|
289
|
-
|
|
411
|
+
### Recent Updates
|
|
412
|
+
- ✅ **v2.1.0** - Term mapping auto-detection, 77% size reduction
|
|
413
|
+
- ✅ **Schema Enforcement** - Mandatory fields for data consistency
|
|
414
|
+
- ✅ **Streaming Operations** - Memory-efficient bulk operations
|
|
415
|
+
- ✅ **Compressed Indexes** - Persistent indexing with compression
|
|
290
416
|
|
|
291
|
-
|
|
417
|
+
---
|
|
292
418
|
|
|
293
419
|
<p align="center">
|
|
294
|
-
<img width="380" src="https://edenware.app/jexidb/images/jexidb-mascot3.jpg" alt="JexiDB mascot" title="JexiDB mascot" />
|
|
420
|
+
<img width="380" src="https://edenware.app/jexidb/images/jexidb-mascot3.jpg" alt="JexiDB mascot - JavaScript EXtended Intelligent DataBase for desktop applications" title="JexiDB - JavaScript EXtended Intelligent DataBase mascot" />
|
|
295
421
|
</p>
|
|
296
422
|
|
|
297
|
-
|
|
423
|
+
## Support the Project
|
|
424
|
+
|
|
425
|
+
If JexiDB helps your project, consider supporting its development:
|
|
426
|
+
|
|
427
|
+
- ⭐ **Star on GitHub** - Show your support
|
|
428
|
+
- 🐛 **Report Issues** - Help improve stability
|
|
429
|
+
- 💝 **Donate** - [PayPal](https://www.paypal.com/donate/?item_name=megacubo.tv&cmd=_donations&business=efox.web%40gmail.com)
|
|
430
|
+
|
|
431
|
+
**The Only Pure JS Database with Smart Disk Persistence & Intelligent Memory Management**
|
|
432
|
+
|
|
433
|
+
**Built with ❤️ for the JavaScript community**
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Links & Resources
|
|
440
|
+
|
|
441
|
+
- **🏠 Homepage**: [edenware.app/jexidb](https://edenware.app/jexidb)
|
|
442
|
+
- **📦 NPM Package**: [npmjs.com/package/jexidb](https://www.npmjs.com/package/jexidb)
|
|
443
|
+
- **📚 Documentation**: [docs/README.md](docs/README.md)
|
|
444
|
+
- **💬 Issues**: [github.com/EdenwareApps/jexidb/issues](https://github.com/EdenwareApps/jexidb/issues)
|
|
445
|
+
- **⭐ GitHub**: [github.com/EdenwareApps/jexidb](https://github.com/EdenwareApps/jexidb)
|
|
298
446
|
|
|
299
|
-
|
|
447
|
+
## Keywords & Tags
|
|
300
448
|
|
|
301
|
-
|
|
449
|
+
javascript database, nodejs database, electron database, pure javascript database, embedded database, nosql database, json database, desktop database, local database, schema database, streaming database, memory efficient database, persistent database, term mapping, point reading, schema enforced database, jsonl database, compressed indexes
|