Unverified Commit 609bf6bc authored by An Nyeong's avatar An Nyeong
Browse files

Add SQLiteKvStore implementation for Node.js

= Design Decisions

- Atomic implementation for CAS operations with transaction
- Calculate TTL with Temporal.epochMilliseconds since SQLite lacks interval type
- Encode values with JSON.stringify since SQLite lacks native JSON type
- Restrict table names to prevent SQL injection

= Further improvements

- Implement versions for Bun and Deno runtimes
- Refactor to separate Node.js dependencies and create SQLite as a port & adapter pattern
parent 5db6ad89
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
    "./postgres",
    "./redis",
    "./testing",
    "./sqlite",
    "./examples/blog",
    "./examples/cloudflare-workers",
    "./examples/hono-sample"
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
  "exports": {
    ".": "./mod.ts",
    "./compat": "./compat/mod.ts",
    "./sqlite": "./sqlite/mod.ts",
    "./federation": "./federation/mod.ts",
    "./nodeinfo": "./nodeinfo/mod.ts",
    "./runtime": "./runtime/mod.ts",
+25 −0
Original line number Diff line number Diff line
@@ -457,6 +457,31 @@ importers:
        specifier: 'catalog:'
        version: 5.8.3

  sqlite:
    dependencies:
      '@fedify/fedify':
        specifier: 'workspace:'
        version: link:../fedify
      '@logtape/logtape':
        specifier: 'catalog:'
        version: 1.0.0
      es-toolkit:
        specifier: ^1.31.0
        version: 1.39.5
    devDependencies:
      '@js-temporal/polyfill':
        specifier: 'catalog:'
        version: 0.5.1
      '@std/async':
        specifier: 'catalog:'
        version: '@jsr/std__async@1.0.13'
      tsdown:
        specifier: 'catalog:'
        version: 0.12.9(typescript@5.8.3)
      typescript:
        specifier: 'catalog:'
        version: 5.8.3

  testing:
    dependencies:
      '@fedify/fedify':
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ packages:
- postgres
- redis
- testing
- sqlite
- docs

catalog:

sqlite/README.md

0 → 100644
+4 −0
Original line number Diff line number Diff line
@fedify/sqlite: SQLite drivers for Fedify
==============

This package provides a SQLite-based key-value store implementation.
Loading