local-lite 3.0.0 → 3.0.1

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 CHANGED
@@ -59,9 +59,17 @@ to discard failed writes belong to the caller. The core does not inspect backend
59
59
  error codes to delete failed mutations. Conflict resolution and retry settings
60
60
  remain configurable; the existing default conflict strategy is last-write-wins.
61
61
 
62
- For an application-level upgrade checklist or AI-assisted code review, see the
62
+ For an application-level upgrade checklist or AI-assisted code review (including `v3.0.0` breaking changes), see the
63
63
  [Breaking Changes and AI Code-Review Guide](./docs/breaking-changes.md).
64
64
 
65
+ ### What's new in 3.0.0
66
+
67
+ - **Subpath-only feature & adapter imports:** Root `'local-lite'` exports core, config, schema, and utils; adapters, React/Vue/Svelte/Solid bindings, auth, backups, payments, testing, and presence live at their dedicated `local-lite/<subpath>` entry points.
68
+ - **QueryBuilder & CRDTs:** `.whereNot()`, `.orWhere()`, `.distinct()`, `.having()`, `.with()` eager relation preloading, `.clone()`, `.prepare()`, plus `'set-union'`, `'pn-counter'`, and `'lww-element-set'` CRDT rules in `createFieldMergeResolver()`.
69
+ - **New Adapters & Bindings:** `local-lite/sqlite-wasm` (OPFS), `local-lite/postgres`, WebSocket realtime (`wsUrl`) on `SelfHostedRemoteAdapter`, `local-lite/vue`, `local-lite/svelte`, `local-lite/solid`, `local-lite/testing`, and `local-lite/presence`.
70
+ - **Security & Audit:** `FieldEncryptor` (AES-256-GCM column encryption), `applySqlCipherKey()`, and `AuditManager` (`_audit_log` + `undo()` / `redo()`).
71
+ - **Modern SDKs:** Firebase Modular SDK v11+ only (compat/v8 removed) and strict `PushResult` on `RemoteDBAdapter.pushChanges()`.
72
+
65
73
  ## AI Skills
66
74
 
67
75
  The package ships [Agent Skills](./skills) that AI coding assistants can load:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-lite",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Never let a lost connection break a promise. Local-first sync that faithfully keeps data safe until you're back online.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -206,7 +206,7 @@ export const unifiedAuth = new UnifiedAuthManager({
206
206
 
207
207
  // Sign in with any provider - user sessions and local tables link seamlessly
208
208
  const user = await unifiedAuth.signIn('google');
209
- console.log('Unified Canonical User ID:', user.userId);
209
+ console.log('Unified Canonical User ID:', user.id);
210
210
 
211
211
  // Listen to unified state changes
212
212
  const unsubscribe = unifiedAuth.onAuthStateChange((user) => {
@@ -9,7 +9,7 @@ Implement `RemoteDBAdapter` (exported from `local-lite`, with `SyncOperation`, `
9
9
 
10
10
  ## Contract
11
11
 
12
- - `pushChanges(operations): Promise<boolean | PushResult>`
12
+ - `pushChanges(operations): Promise<PushResult>`
13
13
  - Must be idempotent: the client retries after failures, so applying the same operation twice must be safe.
14
14
  - Return `false` (or a failing `PushResult`) or reject on failure so operations stay in the outbox. Never report success for operations that were not stored.
15
15
  - `fetchChanges(sinceTimestamp, scope?): Promise<DeltaChanges>`
@@ -27,16 +27,19 @@ Implement `RemoteDBAdapter` (exported from `local-lite`, with `SyncOperation`, `
27
27
  ## Skeleton
28
28
 
29
29
  ```typescript
30
- import type { RemoteDBAdapter, SyncOperation, DeltaChanges } from 'local-lite';
30
+ import type { RemoteDBAdapter, SyncOperation, DeltaChanges, PushResult } from 'local-lite/core';
31
31
 
32
32
  export class MyAdapter implements RemoteDBAdapter {
33
- async pushChanges(operations: SyncOperation[]): Promise<boolean> {
33
+ async pushChanges(operations: SyncOperation[]): Promise<PushResult> {
34
34
  const res = await fetch('/sync/push', {
35
35
  method: 'POST',
36
36
  headers: { 'Content-Type': 'application/json' },
37
37
  body: JSON.stringify({ operations }),
38
38
  });
39
- return res.ok;
39
+ if (!res.ok) {
40
+ return { success: false, successfulIds: [], failedIds: operations.map((op) => op.id) };
41
+ }
42
+ return { success: true, successfulIds: operations.map((op) => op.id), failedIds: [] };
40
43
  }
41
44
 
42
45
  async fetchChanges(since: number, scope?: Record<string, any>): Promise<DeltaChanges> {
@@ -32,7 +32,7 @@ Comprehensive guide to building reactive, offline-first user interfaces using `l
32
32
  import React, { useMemo } from 'react';
33
33
  import { FlatList, Text, View } from 'react-native';
34
34
  import { useLiveQuery } from 'local-lite/react';
35
- import type { LocalFirstClient } from 'local-lite/config';
35
+ import type { LocalFirstClient } from 'local-lite';
36
36
 
37
37
  interface Todo {
38
38
  id: string;
@@ -70,7 +70,8 @@ Create a singleton client configuration with `defineSyncConfig` and `createSyncC
70
70
 
71
71
  ```typescript
72
72
  import * as SQLite from 'expo-sqlite';
73
- import { defineSyncConfig, createSyncClient, type LocalFirstClient } from 'local-lite/config';
73
+ import { defineSyncConfig, createSyncClient } from 'local-lite/config';
74
+ import type { LocalFirstClient } from 'local-lite';
74
75
 
75
76
  export const syncConfig = defineSyncConfig({
76
77
  // 1. Local Database instance or factory
@@ -177,7 +178,7 @@ import React, { useState, useEffect } from 'react';
177
178
  import { View, Text, Button } from 'react-native';
178
179
  import { useLiveQuery, useSyncStatus, useLocalAuth } from 'local-lite/react';
179
180
  import { getSyncClient } from './sync.config';
180
- import type { LocalFirstClient } from 'local-lite/config';
181
+ import type { LocalFirstClient } from 'local-lite';
181
182
 
182
183
  export function App() {
183
184
  const [client, setClient] = useState<LocalFirstClient | null>(null);
@@ -7,6 +7,22 @@ description: Review a codebase that uses the local-lite npm package for code tha
7
7
 
8
8
  Checklist and automated review instructions for upgrading apps to the latest version of `local-lite`.
9
9
 
10
+ ## 0. Upgrade Checklist (3.0.0 Breaking Changes)
11
+
12
+ * **Trimmed Root & Config Barrels**:
13
+ - `'local-lite'` now exports only `core`, `config`, `schema`, and `utils` (`uuid`, `sql`, `portability`).
14
+ - `'local-lite/config'` no longer re-exports `LocalFirstClient` or provider adapters.
15
+ - **Action**: Move React hooks to `'local-lite/react'`, auth to `'local-lite/auth'`, feature modules (`actions`, `backups`, `keys`, `kv-store`, `search`, `storage`, `scheduler`, `payments`) to `'local-lite/<module>'`, and adapters to `'local-lite/<adapter>'`.
16
+ * **Firebase Modular SDK v11+ Only**:
17
+ - Removed v8/compat `.collection()`, `.batch()`, `.ref()`, `.put()`, and `.save()` branches from `FirestoreRemoteAdapter` and `createFirebaseStorageUploader`.
18
+ - **Action**: Pass modular `firebase/firestore` and `firebase/storage` (`firebase >= 11.0.0`) instances/modules.
19
+ * **Strict `RemoteDBAdapter.pushChanges(): Promise<PushResult>`**:
20
+ - Returning `boolean` from `pushChanges()` is no longer supported.
21
+ - **Action**: Return `{ success, successfulIds, failedIds, errors? }` from all custom remote adapters.
22
+ * **Canonical `AuthUser` Shape (`local-lite/auth`)**:
23
+ - Removed `userId`, `displayName`, `picture`, and `UnifiedAuthUser` aliases.
24
+ - **Action**: Replace with `id`, `name`, `avatarUrl`, and `AuthUser`.
25
+
10
26
  ## 1. Upgrade Checklist (2.0.0 & Legacy Migrations)
11
27
 
12
28
  Search the codebase for each affected pattern and apply the migration: