Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions PROJECT_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ All aspects are configurable with sensible defaults:
interface SQLiteWASMConfig {
filename: string;
vfs?: {
type?: 'opfs-sahpool' | 'opfs' | 'memdb';
type?: 'opfs-sahpool' | 'opfs' | 'memory';
poolConfig?: {
initialCapacity?: number; // Default: 3
clearOnInit?: boolean; // Default: false
Expand Down Expand Up @@ -184,13 +184,13 @@ await db.transaction(async (tx) => {
| **Configuration** | Hardcoded values | Fully configurable |
| **Table API** | Full ORM-like (insert, update, delete, etc.) | Type hints only (query, exec, run) |
| **PRAGMA** | Hardcoded (MEMORY, NORMAL) | User configurable |
| **VFS** | Hardcoded opfs-sahpool | User can choose (opfs-sahpool, opfs, memdb) |
| **VFS** | Hardcoded opfs-sahpool | User can choose (opfs-sahpool, opfs, memory) |
| **Pool Config** | Fixed (initialCapacity: 3) | Configurable |
| **Console Filtering** | Always on | Optional (configurable) |

## What's Configurable (vs Hardcoded Before)

✅ **VFS Method** - User chooses: opfs-sahpool, opfs, or memdb
✅ **VFS Method** - User chooses: opfs-sahpool, opfs, or memory
✅ **Pool Settings** - initialCapacity, clearOnInit, name
✅ **PRAGMA Settings** - journal_mode, synchronous, temp_store, cache_size, etc.
✅ **Logging** - filterSqlTrace, custom print/printErr functions
Expand Down
4 changes: 2 additions & 2 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const users = await usersTable.query('SELECT * FROM users');
const db = new SQLiteWASM({
filename: 'myapp.db',
vfs: {
type: 'opfs-sahpool', // or 'opfs', 'memdb'
type: 'opfs-sahpool', // or 'opfs', 'memory'
poolConfig: {
initialCapacity: 5,
name: 'my-custom-pool'
Expand Down Expand Up @@ -155,7 +155,7 @@ await db.delete() // Delete database
vfs?: {
type?: 'opfs-sahpool' // Default: 'opfs-sahpool'
| 'opfs'
| 'memdb';
| 'memory';
poolConfig?: {
initialCapacity?: number; // Default: 3
clearOnInit?: boolean; // Default: false
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Key interfaces for better TypeScript integration.
interface SQLiteWASMConfig {
filename: string; // Required: Database file name
vfs?: {
type?: 'opfs' | 'opfs-sahpool' | 'memdb'; // Default: 'opfs'
type?: 'opfs' | 'opfs-sahpool' | 'memory'; // Default: 'opfs'
poolConfig?: {
// Only used when type is 'opfs-sahpool'
initialCapacity?: number; // Default: 3
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@haroonwaves/sqlite-wasm-easy",
"version": "0.2.5",
"version": "0.2.6",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bump minor version for the breaking VFS rename

This change intentionally introduces a backwards-incompatible API rename (memdb to memory) but only bumps the package from 0.2.5 to 0.2.6. Consumers using a range like ^0.2.5 will receive this as a routine patch update even though it can break runtime behavior, so this should be released as a new minor version (for pre-1.0, 0.3.0) or kept backward-compatible.

Useful? React with 👍 / 👎.

"description": "A simple, zero-config wrapper around @sqlite.org/sqlite-wasm",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* VFS (Virtual File System) type options
*/
export type VFSType = 'opfs-sahpool' | 'opfs' | 'memdb';
export type VFSType = 'opfs-sahpool' | 'opfs' | 'memory';

/**
* PRAGMA journal_mode options
Expand Down
4 changes: 2 additions & 2 deletions src/worker/sqliteWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function initDatabase(config: SQLiteWASMConfig) {
} else if (vfsType === 'opfs') {
// Direct OPFS VFS (if available)
PoolUtil = sqlite3.opfs || null;
} else if (vfsType === 'memdb') {
} else if (vfsType === 'memory') {
// In-memory database
PoolUtil = null;
}
Expand All @@ -69,7 +69,7 @@ async function openDatabase(filename: string) {
flags: 'create',
vfs: 'opfs-sahpool',
});
} else if (vfsType === 'memdb') {
} else if (vfsType === 'memory') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep legacy memdb configs working or fail fast

Changing the VFS discriminator to memory here means existing configs that still send vfs.type = 'memdb' no longer take the in-memory branch and instead fall through to the OPFS path in openDatabase (OpfsDb/COOP-COEP check in the else). For untyped JS consumers or persisted configs from prior releases, upgrading can silently switch storage semantics from ephemeral memory to persistent OPFS (or start throwing header errors), which is a regression that should be handled via aliasing or an explicit validation error.

Useful? React with 👍 / 👎.

db = new sqlite3.oo1.DB(':memory:', 'c');
} else {
// Check if OpfsDb is available (requires COOP/COEP headers)
Expand Down
Loading