local-lite 2.0.5 → 2.0.7
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 +2 -2
- package/bin/local-lite.mjs +215 -2
- package/dist/core/client.d.ts +3 -3
- package/dist/core/client.js +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/kv-store/index.d.ts +3 -0
- package/dist/kv-store/index.js +19 -0
- package/dist/kv-store/manager.d.ts +52 -0
- package/dist/kv-store/manager.js +167 -0
- package/dist/kv-store/store.d.ts +13 -0
- package/dist/kv-store/store.js +85 -0
- package/dist/kv-store/types.d.ts +27 -0
- package/dist/kv-store/types.js +2 -0
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/kv-store.d.ts +9 -0
- package/dist/react/kv-store.js +53 -0
- package/dist/schema/index.d.ts +0 -1
- package/dist/schema/index.js +0 -1
- package/dist/server/dashboard.d.ts +16 -0
- package/dist/server/dashboard.js +1412 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/package.json +10 -5
- package/skills/local-lite-offline-actions/SKILL.md +11 -11
- package/skills/local-lite-react/SKILL.md +7 -7
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type ApiMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
2
2
|
export * from './email.js';
|
|
3
3
|
export * from './sync.js';
|
|
4
|
+
export * from './dashboard.js';
|
|
4
5
|
export interface ApiRequestContext<TConfig = unknown> {
|
|
5
6
|
request: Request;
|
|
6
7
|
config: TConfig;
|
package/dist/server/index.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.defineServerConfig = defineServerConfig;
|
|
|
18
18
|
exports.createServer = createServer;
|
|
19
19
|
__exportStar(require("./email.js"), exports);
|
|
20
20
|
__exportStar(require("./sync.js"), exports);
|
|
21
|
+
__exportStar(require("./dashboard.js"), exports);
|
|
21
22
|
function normalizePath(path) {
|
|
22
23
|
const normalized = `/${path.split('/').filter(Boolean).join('/')}`;
|
|
23
24
|
return normalized === '/' ? normalized : normalized.replace(/\/$/, '');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "local-lite",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
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",
|
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
"import": "./dist/schema/index.js",
|
|
47
47
|
"default": "./dist/schema/index.js"
|
|
48
48
|
},
|
|
49
|
+
"./schema/migrations": {
|
|
50
|
+
"types": "./dist/schema/sqlMigrations.d.ts",
|
|
51
|
+
"import": "./dist/schema/sqlMigrations.js",
|
|
52
|
+
"default": "./dist/schema/sqlMigrations.js"
|
|
53
|
+
},
|
|
49
54
|
"./supabase": {
|
|
50
55
|
"types": "./dist/adapters/remote/supabase.d.ts",
|
|
51
56
|
"import": "./dist/adapters/remote/supabase.js",
|
|
@@ -131,10 +136,10 @@
|
|
|
131
136
|
"import": "./dist/keys/index.js",
|
|
132
137
|
"default": "./dist/keys/index.js"
|
|
133
138
|
},
|
|
134
|
-
"./kv": {
|
|
135
|
-
"types": "./dist/kv/index.d.ts",
|
|
136
|
-
"import": "./dist/kv/index.js",
|
|
137
|
-
"default": "./dist/kv/index.js"
|
|
139
|
+
"./kv-store": {
|
|
140
|
+
"types": "./dist/kv-store/index.d.ts",
|
|
141
|
+
"import": "./dist/kv-store/index.js",
|
|
142
|
+
"default": "./dist/kv-store/index.js"
|
|
138
143
|
},
|
|
139
144
|
"./search": {
|
|
140
145
|
"types": "./dist/search/index.d.ts",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: local-lite-offline-actions
|
|
3
|
-
description: Queue offline actions, schedule background jobs, store key-value preferences, and track sync telemetry in local-lite. Use when using client.actions, client.scheduler, client.
|
|
3
|
+
description: Queue offline actions, schedule background jobs, store key-value preferences, and track sync telemetry in local-lite. Use when using client.actions, client.scheduler, client.kvStore, client.getMetrics(), or handling offline mutation retries.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# local-lite Offline Actions, KV & Scheduler
|
|
6
|
+
# local-lite Offline Actions, KV Store & Scheduler
|
|
7
7
|
|
|
8
8
|
Guide for executing queued actions, running background jobs, persisting key-value pairs, and inspecting sync telemetry with `local-lite`.
|
|
9
9
|
|
|
@@ -95,20 +95,20 @@ client.actions.registerEmailHandler(
|
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
## 2. Key-Value Store & Secret Preferences (`client.
|
|
98
|
+
## 2. Key-Value Store & Secret Preferences (`client.kvStore`)
|
|
99
99
|
|
|
100
|
-
`client.
|
|
100
|
+
`client.kvStore` provides lightweight key-value storage directly within SQLite with optional TTL expiration and AES-256-GCM encryption.
|
|
101
101
|
|
|
102
|
-
### Basic KV Usage
|
|
102
|
+
### Basic KV Store Usage
|
|
103
103
|
```typescript
|
|
104
104
|
// Store with optional TTL (expires in 24 hours)
|
|
105
|
-
await client.
|
|
105
|
+
await client.kvStore.set('last_viewed_tab', 'dashboard', { ttlMs: 24 * 60 * 60 * 1000 });
|
|
106
106
|
|
|
107
|
-
// Read value (returns
|
|
108
|
-
const tab = await client.
|
|
107
|
+
// Read value (returns undefined if expired or missing)
|
|
108
|
+
const tab = await client.kvStore.get('last_viewed_tab');
|
|
109
109
|
|
|
110
110
|
// Delete value
|
|
111
|
-
await client.
|
|
111
|
+
await client.kvStore.delete('last_viewed_tab');
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
### Encrypted Secrets (AES-256-GCM)
|
|
@@ -116,10 +116,10 @@ Store sensitive API tokens or user secrets securely:
|
|
|
116
116
|
|
|
117
117
|
```typescript
|
|
118
118
|
// Encrypt and persist
|
|
119
|
-
await client.
|
|
119
|
+
await client.kvStore.setSecret('api_token', 'sk-live-secret-token-12345', { passphrase: 'PassphraseOrHardwareKey' });
|
|
120
120
|
|
|
121
121
|
// Decrypt
|
|
122
|
-
const token = await client.
|
|
122
|
+
const token = await client.kvStore.getSecret('api_token', 'PassphraseOrHardwareKey');
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: local-lite-react
|
|
3
|
-
description: Master reactive patterns, hooks, live queries, and optimistic state in React and React Native with local-lite. Use when writing useLiveQuery, useSyncStatus, useLocalAuth,
|
|
3
|
+
description: Master reactive patterns, hooks, live queries, and optimistic state in React and React Native with local-lite. Use when writing useLiveQuery, useSyncStatus, useLocalAuth, useKVStore, useSearch, useQueryBuilder, or optimizing component re-renders.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# local-lite React & React Native Integration
|
|
@@ -16,8 +16,8 @@ Comprehensive guide to building reactive, offline-first user interfaces using `l
|
|
|
16
16
|
| `useLiveQuery(client, sql, params, deps)` | Reactive SQLite query. Auto-re-runs whenever relevant tables mutate. |
|
|
17
17
|
| `useSyncStatus(client)` | Tracks online/offline status, sync worker state, and outbox changes. |
|
|
18
18
|
| `useLocalAuth(client.auth)` | Manages zero-backend SQLite authentication, user profiles, and sessions. |
|
|
19
|
-
| `
|
|
20
|
-
| `useEncryptedKV(client.
|
|
19
|
+
| `useKVStore(client, key, default)` | Reactive key-value store for preferences and application state. |
|
|
20
|
+
| `useEncryptedKV(client.kvStore, key, pass)` | End-to-end encrypted secret preferences with AES-256-GCM. |
|
|
21
21
|
| `useSearch(client, ftsTable, query)` | Real-time full-text search powered by SQLite FTS5. |
|
|
22
22
|
| `useQueryBuilder(client, table, filter)` | Declarative MongoDB-style query filters. |
|
|
23
23
|
| `useCloudBackup(backupClient, db)` | Cloud backups (OneDrive / Google Drive) with live progress. |
|
|
@@ -93,17 +93,17 @@ async function addTodo(client: LocalFirstClient, title: string, projectId: strin
|
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
96
|
-
## 4. Reactive Preferences & Encrypted KV
|
|
96
|
+
## 4. Reactive Preferences & Encrypted KV Store
|
|
97
97
|
|
|
98
98
|
```tsx
|
|
99
|
-
import {
|
|
99
|
+
import { useKVStore, useEncryptedKV } from 'local-lite/react';
|
|
100
100
|
|
|
101
101
|
export function SettingsScreen({ client }) {
|
|
102
102
|
// 1. Plain reactive setting
|
|
103
|
-
const [theme, setTheme] =
|
|
103
|
+
const [theme, setTheme] = useKVStore<'light' | 'dark'>(client, 'app_theme', 'light');
|
|
104
104
|
|
|
105
105
|
// 2. Encrypted setting (AES-256-GCM)
|
|
106
|
-
const [apiKey, setApiKey] = useEncryptedKV(client?.
|
|
106
|
+
const [apiKey, setApiKey] = useEncryptedKV(client?.kvStore, 'openai_key', 'UserPassphrase!');
|
|
107
107
|
|
|
108
108
|
return (
|
|
109
109
|
<View>
|