Registry / database / flextree-sqlite-adapter

flextree-sqlite-adapter

JSON →
library2.0.4jsnpmunverified

SQLite adapter for flextree, enabling persistent tree structure storage. Current version 2.0.4. Provides a straightforward adapter interface to store and retrieve hierarchical data using SQLite, tightly coupled with flextree's core tree manipulation. Key differentiator: lightweight, minimal configuration, and directly integrates with flextree without additional ORM layers.

database
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Named export only. No default export.

import { SqliteAdapter } from 'flextree-sqlite-adapter'

Type-only import for TypeScript users.

import type { SqliteAdapterOptions } from 'flextree-sqlite-adapter'

CommonJS require will result in undefined (ESM-only package).

import { adapter } from 'flextree-sqlite-adapter'

Creates a SQLite adapter, initializes the table, and performs basic tree operations using flextree.

import { SqliteAdapter } from 'flextree-sqlite-adapter'; import Database from 'better-sqlite3'; import { Flextree } from 'flextree'; const db = new Database('mydb.sqlite'); const adapter = new SqliteAdapter(db, { tableName: 'nodes' }); adapter.initialize(); const tree = new Flextree(adapter); tree.insert({ id: '1', parentId: null, data: { name: 'root' } }); tree.insert({ id: '2', parentId: '1', data: { name: 'child' } }); console.log(tree.toJSON()); db.close();
Debug
Known footguns
breakingVersion 2.0.0 changed the adapter constructor signature from (db, tableName) to (db, options).
gotchaAdapter does not create the database file automatically; the database must be opened before passing to adapter.
gotchaThe adapter expects a synchronous sqlite3 driver (better-sqlite3). Do not use with async drivers like sql.js.
deprecatedThe option 'tableName' is deprecated in favor of 'table' in version 2.0.3.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
12 hits · last 30 days
gptbot
3
amazonbot
3
mj12bot
1
ahrefsbot
1
Resources