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.
Files changed (25) hide show
  1. package/README.md +14 -1
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/server/connect/sqlite-connect-store.d.ts +2 -0
  4. package/dist/runtime/server/connect/sqlite-connect-store.js +885 -0
  5. package/dist/runtime/server/db/migrate.js +19 -2
  6. package/dist/runtime/server/db/migrations/009_or3_connect.d.ts +4 -0
  7. package/dist/runtime/server/db/migrations/009_or3_connect.js +91 -0
  8. package/dist/runtime/server/db/migrations/010_connect_user_code_hmac.d.ts +10 -0
  9. package/dist/runtime/server/db/migrations/010_connect_user_code_hmac.js +97 -0
  10. package/dist/runtime/server/db/migrations/011_connect_environment_scope_indexes.d.ts +4 -0
  11. package/dist/runtime/server/db/migrations/011_connect_environment_scope_indexes.js +26 -0
  12. package/dist/runtime/server/db/migrations/012_connect_credential_redelivery.d.ts +4 -0
  13. package/dist/runtime/server/db/migrations/012_connect_credential_redelivery.js +124 -0
  14. package/dist/runtime/server/db/migrations/013_connect_environment_lifecycle.d.ts +10 -0
  15. package/dist/runtime/server/db/migrations/013_connect_environment_lifecycle.js +261 -0
  16. package/dist/runtime/server/db/migrations/014_connect_retention_activation.d.ts +4 -0
  17. package/dist/runtime/server/db/migrations/014_connect_retention_activation.js +44 -0
  18. package/dist/runtime/server/db/migrations/015_rate_limits.d.ts +4 -0
  19. package/dist/runtime/server/db/migrations/015_rate_limits.js +18 -0
  20. package/dist/runtime/server/db/schema.d.ts +57 -0
  21. package/dist/runtime/server/plugins/register.d.ts +1 -1
  22. package/dist/runtime/server/plugins/register.js +24 -8
  23. package/dist/runtime/server/rate-limit/sqlite-provider.d.ts +7 -0
  24. package/dist/runtime/server/rate-limit/sqlite-provider.js +70 -0
  25. 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` with ID `sqlite`
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "or3-provider-sqlite",
3
3
  "configKey": "or3-provider-sqlite",
4
- "version": "0.0.2",
4
+ "version": "0.0.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -0,0 +1,2 @@
1
+ import { type ConnectStore } from '~~/server/connect/store/types';
2
+ export declare function createSqliteConnectStore(): ConnectStore;