or3-provider-sqlite 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/dist/module.json +1 -1
- package/dist/runtime/server/connect/sqlite-connect-store.d.ts +2 -0
- package/dist/runtime/server/connect/sqlite-connect-store.js +885 -0
- package/dist/runtime/server/db/migrate.js +19 -2
- package/dist/runtime/server/db/migrations/009_or3_connect.d.ts +4 -0
- package/dist/runtime/server/db/migrations/009_or3_connect.js +91 -0
- package/dist/runtime/server/db/migrations/010_connect_user_code_hmac.d.ts +10 -0
- package/dist/runtime/server/db/migrations/010_connect_user_code_hmac.js +97 -0
- package/dist/runtime/server/db/migrations/011_connect_environment_scope_indexes.d.ts +4 -0
- package/dist/runtime/server/db/migrations/011_connect_environment_scope_indexes.js +26 -0
- package/dist/runtime/server/db/migrations/012_connect_credential_redelivery.d.ts +4 -0
- package/dist/runtime/server/db/migrations/012_connect_credential_redelivery.js +124 -0
- package/dist/runtime/server/db/migrations/013_connect_environment_lifecycle.d.ts +10 -0
- package/dist/runtime/server/db/migrations/013_connect_environment_lifecycle.js +261 -0
- package/dist/runtime/server/db/migrations/014_connect_retention_activation.d.ts +4 -0
- package/dist/runtime/server/db/migrations/014_connect_retention_activation.js +44 -0
- package/dist/runtime/server/db/migrations/015_rate_limits.d.ts +4 -0
- package/dist/runtime/server/db/migrations/015_rate_limits.js +18 -0
- package/dist/runtime/server/db/schema.d.ts +57 -0
- package/dist/runtime/server/plugins/register.d.ts +1 -1
- package/dist/runtime/server/plugins/register.js +24 -8
- package/dist/runtime/server/rate-limit/sqlite-provider.d.ts +7 -0
- package/dist/runtime/server/rate-limit/sqlite-provider.js +70 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ SQLite sync and workspace store provider for OR3 Chat. Provides a lightweight, s
|
|
|
6
6
|
|
|
7
7
|
- **AuthWorkspaceStore** (`sqlite`) — user identity mapping, workspace CRUD, role resolution
|
|
8
8
|
- **SyncGatewayAdapter** (`sqlite`) — push/pull sync, consistent materialized snapshot pages, LWW conflict resolution, and cursor tracking
|
|
9
|
+
- **ConnectStore** (`sqlite`) — durable, atomic device enrollment and connected-computer records for OR3 Connect
|
|
9
10
|
|
|
10
11
|
## Install
|
|
11
12
|
|
|
@@ -39,6 +40,15 @@ OR3_SQLITE_PRAGMA_JOURNAL_MODE=WAL
|
|
|
39
40
|
OR3_SQLITE_PRAGMA_SYNCHRONOUS=NORMAL
|
|
40
41
|
```
|
|
41
42
|
|
|
43
|
+
OR3 Connect uses this same database by default:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
OR3_CONNECT_ENABLED=true
|
|
47
|
+
OR3_CONNECT_PROVIDER=sqlite
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
No Convex deployment or second database is required.
|
|
51
|
+
|
|
42
52
|
## How it works
|
|
43
53
|
|
|
44
54
|
### Registration
|
|
@@ -48,7 +58,8 @@ On server startup, the Nitro plugin:
|
|
|
48
58
|
1. Initializes the SQLite database (creates file if needed)
|
|
49
59
|
2. Runs schema migrations automatically
|
|
50
60
|
3. Registers `AuthWorkspaceStore` with ID `sqlite`
|
|
51
|
-
4. Registers `SyncGatewayAdapter`
|
|
61
|
+
4. Registers `SyncGatewayAdapter` when SQLite sync is selected
|
|
62
|
+
5. Registers `ConnectStore` when SQLite Connect persistence is selected
|
|
52
63
|
|
|
53
64
|
Registration is skipped when `auth.enabled` is `false` (local-only mode).
|
|
54
65
|
|
|
@@ -60,6 +71,7 @@ Ordered migrations create and evolve all tables:
|
|
|
60
71
|
- **002_sync_tables**: `server_version_counter`, `change_log`, `device_cursors`, `tombstones`, plus materialized entity tables (`s_threads`, `s_messages`, etc.)
|
|
61
72
|
- **003–005**: workspace-scoped sync keys, invitations, and admin stores
|
|
62
73
|
- **006_sync_snapshots**: winning operation IDs plus immutable snapshot headers/items
|
|
74
|
+
- **009_or3_connect**: single-use device authorizations and connected computers
|
|
63
75
|
|
|
64
76
|
All tables use snake_case aligned with the sync wire format.
|
|
65
77
|
|
|
@@ -103,6 +115,7 @@ bun run build # build for distribution
|
|
|
103
115
|
|
|
104
116
|
- Works with multiple auth providers (`basic-auth`, `clerk`, or custom)
|
|
105
117
|
- Replaces `or3-provider-convex` for sync + workspace store functionality
|
|
118
|
+
- Provides OR3 Connect persistence without Convex
|
|
106
119
|
- Does NOT provide storage — pair with `or3-provider-fs` for file storage
|
|
107
120
|
|
|
108
121
|
### Known differences vs Convex
|
package/dist/module.json
CHANGED