tursodatabase / tursodatabase/libsql-client-ts
Support for `opfs-ahp://` when creating a client to access OPFS via the SHA Pool
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 576
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Hi, we're looking to connect to an OPFS stored SQLLite instance running in WASM, however, we are required to use the SHA Pool for connection (we're unable to control/change the security headers from the server that would allow alternative OPFS approaches).
Ideally, this would work:
const sqlite3 = await sqlite3InitModule();
const poolUtil = await sqlite3.installOpfsSAHPoolVfs({ directory: '/data' });
const accessPool = new poolUtil.OpfsSAHPoolDb('my-db');
const client: Client = createClient({ url: `opfs-ahp://${accessPool.filename}` });
I appreciate that opfs-ahp is not a currently supported protocol, and I wanted to ask if this might be added in the future?
As a reference example, this is supported by PGLite
- https://pglite.dev/docs/filesystems#opfs-ahp-fs (although not on Safari due to the access limited that is required for PG files).
- https://github.com/electric-sql/pglite/blob/main/packages/pglite/src/fs/opfs-ahp.ts
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the createClient entry point and compare the requested opfs-ahp:// URL with the PGLite reference at packages/pglite/src/fs/opfs-ahp.ts. Trace how the provided OpfsSAHPoolDb filename should be opened, and consider the sqlite.installOpfsSAHPoolVfs example as the expected integration context. Done means a client can connect through opfs-ahp:// using the SHA Pool.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript, wasm
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100