local-lite 1.0.4 → 2.0.0
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/dist/adapters/local/better-sqlite3.js +10 -3
- package/dist/adapters/local/expo-sqlite.js +3 -3
- package/dist/adapters/local/node-sqlite.js +10 -3
- package/dist/adapters/remote/index.d.ts +5 -2
- package/dist/adapters/remote/self-hosted.d.ts +3 -3
- package/dist/adapters/remote/self-hosted.js +17 -4
- package/dist/adapters/remote/supabase.d.ts +1 -2
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +3 -10
- package/dist/config/types.d.ts +5 -10
- package/dist/core/client.d.ts +3 -12
- package/dist/core/client.js +166 -59
- package/dist/core/outbox-store.d.ts +1 -1
- package/dist/core/outbox-store.js +58 -21
- package/dist/core/query-builder.js +36 -45
- package/dist/core/sync-worker.d.ts +12 -2
- package/dist/core/sync-worker.js +84 -21
- package/dist/core/table-manager.js +19 -8
- package/dist/core/types.d.ts +1 -0
- package/dist/react/index.js +54 -2
- package/dist/server/sync.d.ts +38 -0
- package/dist/server/sync.js +214 -2
- package/dist/storage/supabase.d.ts +7 -2
- package/package.json +4 -5
- package/skills/local-lite-auth/SKILL.md +1 -1
- package/skills/local-lite-setup/SKILL.md +1 -1
- package/skills/local-lite-upgrade/SKILL.md +32 -9
|
@@ -35,7 +35,7 @@ import { defineSyncConfig } from 'local-lite/config';
|
|
|
35
35
|
export const syncConfig = defineSyncConfig({
|
|
36
36
|
database: () => SQLite.openDatabaseAsync('app.db'),
|
|
37
37
|
tables: ['tasks'],
|
|
38
|
-
|
|
38
|
+
auth: {
|
|
39
39
|
// Optional table names (defaults: '_local_users', '_local_user_tokens')
|
|
40
40
|
usersTable: '_local_users',
|
|
41
41
|
tokensTable: '_local_user_tokens',
|
|
@@ -114,7 +114,7 @@ export const syncConfig = defineSyncConfig({
|
|
|
114
114
|
touchUpdatedAt: true,
|
|
115
115
|
|
|
116
116
|
// 6. Zero-backend local SQLite authentication
|
|
117
|
-
|
|
117
|
+
auth: {
|
|
118
118
|
minPasswordLength: 8,
|
|
119
119
|
maxFailedAttempts: 5,
|
|
120
120
|
lockoutDurationMs: 15 * 60 * 1000, // 15 minutes
|
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: local-lite-upgrade
|
|
3
|
-
description: Review a codebase that uses the local-lite npm package for code that must change after a local-lite upgrade. Use when upgrading local-lite, migrating from legacy options, fixing bundler errors in Metro/Web, or updating authentication and adapters.
|
|
3
|
+
description: Review a codebase that uses the local-lite npm package for code that must change after a local-lite upgrade. Use when upgrading local-lite, migrating from legacy options or aliases, fixing bundler errors in Metro/Web, or updating authentication, queries, and adapters.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# local-lite upgrade review
|
|
7
7
|
|
|
8
8
|
Checklist and automated review instructions for upgrading apps to the latest version of `local-lite`.
|
|
9
9
|
|
|
10
|
-
## 1. Upgrade Checklist
|
|
10
|
+
## 1. Upgrade Checklist (2.0.0 & Legacy Migrations)
|
|
11
11
|
|
|
12
12
|
Search the codebase for each affected pattern and apply the migration:
|
|
13
13
|
|
|
14
|
+
### Removed Configuration Aliases (`localAuth`, `maxRetries`, `autoHydrateJSON`)
|
|
15
|
+
* **Old**: `createSyncClient({ localAuth: ..., maxRetries: 5, autoHydrateJSON: true })`
|
|
16
|
+
* **New**: `createSyncClient({ auth: ..., retry: 5, jsonColumns: { todos: ['meta'] } })`
|
|
17
|
+
* **Action**:
|
|
18
|
+
- Replace `localAuth` with `auth`.
|
|
19
|
+
- Replace top-level `maxRetries` on `LocalFirstClient` / `defineSyncConfig` / `SyncWorker` with `retry: number | RetryConfig`.
|
|
20
|
+
- Replace `autoHydrateJSON: true` with explicit `jsonColumns` per table.
|
|
21
|
+
|
|
22
|
+
### Query Method & Operator Aliases (`find`, unprefixed operators)
|
|
23
|
+
* **Old**: `client.find('todos', { where: { count: { gt: 5 } } })`
|
|
24
|
+
* **New**: `client.findMany('todos', { where: { count: { $gt: 5 } } })`
|
|
25
|
+
* **Action**:
|
|
26
|
+
- Replace `client.find()` / `tx.find()` with `findMany()`.
|
|
27
|
+
- Prefix all `QueryOptions.where` operators with `$` (`$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in`, `$nin`, `$contains`, `$startsWith`, `$endsWith`, `$null`).
|
|
28
|
+
- Note: `$contains`, `$startsWith`, and `$endsWith` now escape literal `%` and `_` characters (`LIKE ? ESCAPE '\'`).
|
|
29
|
+
|
|
30
|
+
### Demo Adapter Imports in `local-lite/config`
|
|
31
|
+
* **Old**: `import { MemoryDemoRemoteAdapter, NoopRemoteAdapter } from 'local-lite/config'`
|
|
32
|
+
* **New**: `import { MemoryDemoRemoteAdapter, NoopRemoteAdapter } from 'local-lite'` (or `'local-lite/core'`)
|
|
33
|
+
|
|
34
|
+
### Hardened Defaults & Server Storage
|
|
35
|
+
* **Remote Timeouts**: `SyncWorker` defaults to `requestTimeoutMs: 30000` (with `AbortSignal` forwarded to `SelfHostedRemoteAdapter`). Set `requestTimeoutMs: 0` to disable.
|
|
36
|
+
* **Persistent Self-Hosted Server**: Prefer `SQLiteServerSyncStorage` from `local-lite/server` over `MemoryServerSyncStorage` in production; both default to `maxChangeLogEntries: 10000`.
|
|
37
|
+
* **Expo SQLite**: `ExpoSQLiteAdapter` requires Expo SDK 51+ (`runAsync()` / `execAsync()`).
|
|
38
|
+
* **Expo SQLite**: `ExpoSQLiteAdapter` requires Expo SDK 54+ (`runAsync()` / `execAsync()`).
|
|
39
|
+
|
|
14
40
|
### Schema Migrations (`schemaMigrations` vs `migrations`)
|
|
15
41
|
* **Old**: `createSyncClient({ migrations: [ ... ] })`
|
|
16
42
|
* **New**: `createSyncClient({ schemaMigrations: [ { version: 1, up: [ ... ] } ] })`
|
|
@@ -40,15 +66,12 @@ Search the codebase for each affected pattern and apply the migration:
|
|
|
40
66
|
* **New**: `import { ... } from 'local-lite/email'`
|
|
41
67
|
* **Action**: Update imports to the unified email module supporting Nodemailer, Resend, SendGrid, Postmark, and Dev Mailbox.
|
|
42
68
|
|
|
43
|
-
### Self-Hosted Sync
|
|
44
|
-
* **Old**: Requiring Supabase or Convex for multi-client synchronization.
|
|
45
|
-
* **New**: Use `defineSyncConfig({ server: { url: 'https://api.yourdomain.com/sync', token: '...' } })` with turnkey `createSyncEndpoint()` from `local-lite/server`.
|
|
46
|
-
|
|
47
69
|
---
|
|
48
70
|
|
|
49
71
|
## 2. Review Workflow
|
|
50
72
|
|
|
51
|
-
1. Scan `sync.config.ts`
|
|
52
|
-
2.
|
|
73
|
+
1. Scan `sync.config.ts` and `LocalFirstClient` instantiations for removed options (`localAuth`, `maxRetries`, `autoHydrateJSON`, `migrations`).
|
|
74
|
+
2. Scan `find(` calls and `where:` objects for unprefixed operators (`eq`, `gt`, `in`, `contains`, etc.).
|
|
53
75
|
3. Verify `schemaMigrations` versions are strictly sequential integers starting from 1.
|
|
54
|
-
4.
|
|
76
|
+
4. Check `expo-sqlite` mocks/instances provide `runAsync()` for parameterized writes.
|
|
77
|
+
5. Report each match with file path and line number alongside minimal migration code.
|