Skip to content

Commit ae0442c

Browse files
committed
Remove localstorage driver and references
Remove the @objectql/driver-localstorage package and associated docs/tests. Deleted package files (src, tests, README, CHANGELOG, package.json, tsconfig) under packages/drivers/localstorage and removed driver from docs metadata. Updated documentation and guides to reflect 6 drivers (removed LocalStorage references), adjusted performance guide and getting-started/index pages, and updated examples to use MemoryDriver only (index.html, package.json, vite.config.js). Work plan updated to mark the localstorage issue resolved and note persistence deferred to a future IndexedDB driver. Minor config/lockfile updates included.
1 parent af4cad1 commit ae0442c

18 files changed

Lines changed: 26 additions & 2773 deletions

File tree

content/docs/drivers/localstorage.mdx

Lines changed: 0 additions & 420 deletions
This file was deleted.

content/docs/drivers/meta.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"sql",
66
"mongodb",
77
"memory",
8-
"localstorage",
98
"fs",
109
"excel",
1110
"redis",

content/docs/getting-started/index.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ ObjectQL ships with 7 drivers. The default `starter` template uses SQLite, but s
221221
| **SQL** (PostgreSQL, MySQL, SQLite) | Production apps | `@objectql/driver-sql` |
222222
| **MongoDB** | Document-oriented data | `@objectql/driver-mongo` |
223223
| **Memory** | Testing, prototyping | `@objectql/driver-memory` |
224-
| **LocalStorage** | Browser/offline apps | `@objectql/driver-localstorage` |
225224
| **File System** | Embedded/config storage | `@objectql/driver-fs` |
226225
| **Excel** | Data import/export | `@objectql/driver-excel` |
227226
| **Redis** | Caching layer | `@objectql/driver-redis` |

content/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ From this single file, ObjectQL automatically generates:
5656
5757
### Production-Ready
5858
59-
- **7 Database Drivers** — SQL (PostgreSQL, MySQL, SQLite), MongoDB, Memory, LocalStorage, File System, Excel, Redis
59+
- **6 Database Drivers** — SQL (PostgreSQL, MySQL, SQLite), MongoDB, Memory, File System, Excel, Redis
6060
- **4 API Protocols** — REST, GraphQL, OData V4, JSON-RPC — auto-generated from your schema
6161
- **Validation Engine** — Field-level, cross-field, and state machine validation
6262
- **Formula Engine** — Computed fields with JavaScript expressions and dependency tracking

content/docs/performance/driver-optimization.mdx

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -704,55 +704,6 @@ const app = new ObjectQL({
704704
});
705705
706706
// Data persists in browser memory until page refresh
707-
// For persistent storage, use LocalStorage driver
708-
```
709-
710-
---
711-
712-
## LocalStorage Driver
713-
714-
Browser-based persistent storage using localStorage API.
715-
716-
### Configuration
717-
718-
```typescript
719-
import { LocalStorageDriver } from '@objectql/driver-localstorage';
720-
721-
const driver = new LocalStorageDriver({
722-
prefix: 'myapp_', // Key prefix in localStorage
723-
compress: true, // Compress data (saves space)
724-
encrypt: false // Optional encryption
725-
});
726-
```
727-
728-
### Storage Limits
729-
730-
| Browser | Limit |
731-
|---------|-------|
732-
| Chrome | 10MB |
733-
| Firefox | 10MB |
734-
| Safari | 5MB |
735-
| Edge | 10MB |
736-
737-
**Check available space**:
738-
739-
```typescript
740-
const quota = await navigator.storage.estimate();
741-
console.log(`Used: ${quota.usage}, Available: ${quota.quota}`);
742-
```
743-
744-
### Performance Tips
745-
746-
1. **Minimize data stored**: Only store essential fields
747-
2. **Use compression**: Enable `compress: true`
748-
3. **Batch updates**: Group multiple operations
749-
4. **Clear old data**: Remove stale records periodically
750-
751-
```typescript
752-
// Clear old sessions
753-
await driver.deleteMany('sessions', [
754-
['expires_at', '<', new Date()]
755-
]);
756707
```
757708

758709
---
@@ -902,7 +853,7 @@ Choose the right driver for your use case:
902853
| Real-time apps | Redis | In-memory speed, pub/sub |
903854
| Unit tests | Memory | Fast, no setup, clean slate |
904855
| Serverless/Edge | Memory | No external dependencies |
905-
| Browser apps | LocalStorage | Persistent client-side storage |
856+
| Browser apps | Memory | Client-side storage, no persistence |
906857
| Mobile apps | SQLite (SQL Driver) | Embedded, reliable |
907858
| Analytics | PostgreSQL | Advanced aggregations, window functions |
908859
| Session store | Redis | TTL, fast access |

docs/WORK_PLAN_2026_Q1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Package removed in B3.
216216
| ISS-008 | ✅ Resolved | `plugin-security` | Test coverage expanded (1→6 files, 13→136 tests) |
217217
| ISS-009 | ✅ Resolved | `plugin-validator` | TODO stubs implemented with tests |
218218
| ISS-010 | ✅ Resolved | `cli` | Version sourced from package.json; CLI scope delegated to @objectstack/cli |
219-
| ISS-011 | 🟡 Medium | `localstorage` | Compression feature flagged but unimplemented |
219+
| ISS-011 | ✅ Resolved | `localstorage` | Package removed — `driver-memory` sufficient for demos; browser persistence deferred to future `driver-indexeddb` |
220220
| ISS-012 | ✅ Resolved | `protocol-rest` | Ghost project reference in root `tsconfig.json` caused Vite to fail when parsing projects — removed reference |
221221
| ISS-013 | ✅ Resolved | `platform-node` | Cross-layer tsconfig references removed |
222222
| ISS-014 | ✅ Resolved | All packages | `exports` field added to 17 packages |

examples/integrations/browser/index.html

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -199,48 +199,26 @@ <h2>📝 Your Notes</h2>
199199

200200
<div class="demo-card">
201201
<h2>🖥️ Console Output</h2>
202-
<div id="output">Initializing ObjectQL with LocalStorage...
202+
<div id="output">Initializing ObjectQL with Memory Driver...
203203
</div>
204204
</div>
205205
</div>
206206

207207
<script type="module">
208208
import { ObjectQL } from '@objectql/core';
209-
import { LocalStorageDriver } from '@objectql/driver-localstorage';
210209
import { MemoryDriver } from '@objectql/driver-memory';
211210

212211
// Global variables
213212
window.app = null;
214213
window.driver = null;
215214
window.noteRepo = null;
216-
window.currentDriverType = 'localstorage'; // Default
217-
218-
window.switchDriver = async function(type) {
219-
if (type === window.currentDriverType) return;
220-
if (!confirm('Switching drivers will reload the app. Continue?')) {
221-
document.getElementById('driverSelect').value = window.currentDriverType;
222-
return;
223-
}
224-
window.currentDriverType = type;
225-
document.getElementById('noteList').innerHTML = '';
226-
document.getElementById('output').textContent = '';
227-
await initObjectQL();
228-
}
229215

230216
async function initObjectQL() {
231217
try {
232-
if (window.currentDriverType === 'localstorage') {
233-
log('💾 Creating LocalStorage Driver...');
234-
window.driver = new LocalStorageDriver({
235-
namespace: 'objectql-notes-demo',
236-
strictMode: true
237-
});
238-
} else {
239-
log('🧠 Creating Memory Driver...');
240-
window.driver = new MemoryDriver();
241-
}
218+
log('🧠 Creating Memory Driver...');
219+
window.driver = new MemoryDriver();
242220

243-
log(`🚀 Initializing ObjectQL with ${window.currentDriverType}...`);
221+
log('🚀 Initializing ObjectQL with Memory Driver...');
244222

245223
window.app = new ObjectQL({
246224
datasources: { default: window.driver }
@@ -262,16 +240,16 @@ <h2>🖥️ Console Output</h2>
262240
});
263241

264242
await window.app.init();
265-
log('✅ ObjectQL initialized with LocalStorage!');
243+
log('✅ ObjectQL initialized with Memory Driver!');
266244

267245
const ctx = window.app.createContext({ isSystem: true });
268246
window.noteRepo = ctx.object('notes');
269247

270-
// Load existing notes from LocalStorage
248+
// Load existing notes
271249
await loadNotes();
272250
updateStorageCount();
273251

274-
log('🎉 Ready! Your data persists across page refreshes.');
252+
log('🎉 Ready! Add notes using the form above.');
275253

276254
} catch (error) {
277255
log('❌ Error:', error);
@@ -291,7 +269,7 @@ <h2>🖥️ Console Output</h2>
291269
log(`➕ Creating note: "${content}"`);
292270
const note = await window.noteRepo.create({ content });
293271

294-
log('✅ Note created and saved to LocalStorage');
272+
log('✅ Note created');
295273
document.getElementById('noteContent').value = '';
296274

297275
await loadNotes();
@@ -306,7 +284,7 @@ <h2>🖥️ Console Output</h2>
306284
window.loadNotes = async function() {
307285
try {
308286
const notes = await window.noteRepo.find({});
309-
log(`📋 Loaded ${notes.length} notes from LocalStorage`);
287+
log(`📋 Loaded ${notes.length} notes`);
310288

311289
displayNotes(notes);
312290
updateStorageCount();
@@ -345,7 +323,7 @@ <h2>🖥️ Console Output</h2>
345323
try {
346324
log(`🗑 Deleting note ${id}...`);
347325
await window.noteRepo.delete(id);
348-
log('✅ Note deleted from LocalStorage');
326+
log('✅ Note deleted');
349327

350328
await loadNotes();
351329
updateStorageCount();
@@ -361,7 +339,7 @@ <h2>🖥️ Console Output</h2>
361339
}
362340

363341
try {
364-
log('🗑 Clearing all data from LocalStorage...');
342+
log('🗑 Clearing all data...');
365343
await window.driver.clear();
366344
log('✅ All data cleared');
367345

examples/integrations/browser/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@objectql/example-browser",
33
"version": "4.1.0",
44
"private": true,
5-
"description": "Browser demo for ObjectQL showing Memory and LocalStorage drivers",
5+
"description": "Browser demo for ObjectQL showing Memory driver",
66
"type": "module",
77
"scripts": {
88
"dev": "vite",
@@ -11,7 +11,6 @@
1111
},
1212
"dependencies": {
1313
"@objectql/core": "workspace:*",
14-
"@objectql/driver-localstorage": "workspace:*",
1514
"@objectql/driver-memory": "workspace:*",
1615
"@objectql/types": "workspace:*"
1716
},

examples/integrations/browser/vite.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default defineConfig({
1414
resolve: {
1515
alias: {
1616
// '@objectql/core': resolve(__dirname, '../../../packages/foundation/core/src/index.ts'),
17-
// '@objectql/driver-localstorage': resolve(__dirname, '../../../packages/drivers/localstorage/src/index.ts'),
1817
// '@objectql/driver-memory': resolve(__dirname, '../../../packages/drivers/memory/src/index.ts'),
1918
// '@objectql/types': resolve(__dirname, '../../../packages/foundation/types/src/index.ts'),
2019
// '@objectstack/runtime': resolve(__dirname, '../../../packages/objectstack/runtime/src/index.ts'),
@@ -25,7 +24,6 @@ export default defineConfig({
2524
include: [
2625
'@objectql/types',
2726
'@objectql/core',
28-
'@objectql/driver-localstorage',
2927
'@objectql/driver-memory'
3028
]
3129
},

0 commit comments

Comments
 (0)