@capgo/capacitor-fast-sql 8.0.42 → 8.0.44

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
@@ -1,305 +1,319 @@
1
- # @capgo/capacitor-fast-sql
2
- <a href="https://capgo.app/"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-fast-sql" alt="Capgo - Instant updates for Capacitor" /></a>
3
-
4
- <div align="center">
5
- <h2><a href="https://capgo.app/?ref=plugin_fast_sql"> ➡️ Get Instant updates for your App with Capgo</a></h2>
6
- <h2><a href="https://capgo.app/consulting/?ref=plugin_fast_sql"> Missing a feature? We'll build the plugin for you 💪</a></h2>
7
- </div>
8
-
9
- High-performance native SQLite plugin with HTTP server for efficient sync operations and IndexedDB replacement.
10
- Official Capgo alternative to Ionic Appflow Secure Storage.
11
-
12
- ## Why Fast SQL?
13
-
14
- Traditional Capacitor plugins serialize data through the JavaScript bridge, which becomes inefficient with large datasets. Fast SQL solves this by establishing a local HTTP server for direct native communication, making it ideal for:
15
-
16
- - **Local-first sync systems** (CRDTs, operational transforms)
17
- - **IndexedDB replacement** on platforms with broken/limited implementations
18
- - **Large dataset operations** requiring high throughput
19
- - **Batch operations** with thousands of rows
20
- - **Binary data storage** (BLOBs, files)
21
-
22
- ## Documentation
23
-
24
- The most complete doc is available here: https://capgo.app/docs/plugins/fast-sql/
25
-
26
- ## Compatibility
27
-
28
- | Plugin version | Capacitor compatibility | Maintained |
29
- | -------------- | ----------------------- | ---------- |
30
- | v8.\*.\* | v8.\*.\* | ✅ |
31
- | v7.\*.\* | v7.\*.\* | On demand |
32
- | v6.\*.\* | v6.\*.\* | ❌ |
33
- | v5.\*.\* | v5.\*.\* | ❌ |
34
-
35
- > **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.
36
-
37
- ## Install
38
-
39
- ```bash
40
- npm install @capgo/capacitor-fast-sql
41
- npx cap sync
42
- ```
43
-
44
- ## Overview
45
-
46
- This plugin provides direct native SQLite database access with a custom communication protocol inspired by [capacitor-blob-writer](https://github.com/diachedelic/capacitor-blob-writer). Instead of using Capacitor's standard bridge (which serializes data inefficiently), it establishes a local HTTP server for optimal performance with large datasets and sync operations.
47
-
48
- ### Key Features
49
-
50
- - **Custom HTTP Protocol**: Bypasses Capacitor's bridge for up to 25x faster performance with large data
51
- - **Direct Native SQLite**: Full SQL support with transactions, batch operations, and binary data
52
- - **Sync-Friendly**: Designed for local sync systems (CRDTs, operational transforms, etc.)
53
- - **IndexedDB Replacement**: Provides reliable alternative to broken/limited IndexedDB implementations
54
- - **Cross-Platform**: iOS, Android, and Web (using sql.js + IndexedDB for persistence)
55
- - **Optional RAG VectorStore**: Persist many named vector stores for retrieval-augmented generation without adding a native dependency
56
-
57
- ## iOS Configuration
58
-
59
- This plugin runs a local HTTP server on `localhost`. iOS App Transport Security (ATS) blocks cleartext HTTP by default, so you **must** allow local networking in your `Info.plist`:
60
-
61
- ```xml
62
- <key>NSAppTransportSecurity</key>
63
- <dict>
64
- <key>NSAllowsLocalNetworking</key>
65
- <true/>
66
- </dict>
67
- ```
68
-
69
- This only permits cleartext to loopback addresses (`localhost` / `127.0.0.1`) — it does not weaken ATS for external connections.
70
-
71
- ## Android Configuration
72
-
73
- This plugin runs a local HTTP server on `localhost` to bypass Capacitor's bridge for performance. Android 9+ blocks cleartext (non-HTTPS) traffic by default, so you **must** allow it for `localhost`.
74
-
75
- **Option A — Scoped to localhost only (recommended):**
76
-
77
- Create `android/app/src/main/res/xml/network_security_config.xml`:
78
-
79
- ```xml
80
- <?xml version="1.0" encoding="utf-8"?>
81
- <network-security-config>
82
- <domain-config cleartextTrafficPermitted="true">
83
- <domain includeSubdomains="false">localhost</domain>
84
- <domain includeSubdomains="false">127.0.0.1</domain>
85
- </domain-config>
86
- </network-security-config>
87
- ```
88
-
89
- Then reference it in your `AndroidManifest.xml`:
90
-
91
- ```xml
92
- <application
93
- android:networkSecurityConfig="@xml/network_security_config">
94
- ...
95
- </application>
96
- ```
97
-
98
- **Option B — Allow all cleartext (simpler but less secure):**
99
-
100
- ```xml
101
- <application
102
- android:usesCleartextTraffic="true">
103
- ...
104
- </application>
105
- ```
106
-
107
- ## Encryption
108
-
109
- ### Android
110
-
111
- Encryption uses [SQLCipher](https://www.zetetic.net/sqlcipher/) and is opt-in. Add the SQLCipher dependency to your **app-level** `build.gradle`:
112
-
113
- ```gradle
114
- dependencies {
115
- implementation 'net.zetetic:sqlcipher-android:4.13.0'
116
- }
117
- ```
118
-
119
- Then connect with encryption enabled:
120
-
121
- ```typescript
122
- const db = await FastSQL.connect({
123
- database: 'secure',
124
- encrypted: true,
125
- encryptionKey: 'my-secret-key',
126
- });
127
- ```
128
-
129
- If SQLCipher is not installed and `encrypted: true` is passed, the plugin returns a clear error message instead of crashing.
130
-
131
- ### iOS
132
-
133
- SQLCipher is optional on iOS. The plugin builds without it; encryption calls will return `Encryption is not available in this build` unless SQLCipher is installed.
134
-
135
- To enable encryption via CocoaPods, update your `ios/App/Podfile` after `capacitor install`/`cap sync` to use the SQLCipher subspec:
136
-
137
- ```ruby
138
- pod 'CapgoCapacitorFastSql/SQLCipher', :path => '../../node_modules/@capgo/capacitor-fast-sql'
139
- ```
140
-
141
- Then run `pod install` in the `ios/App` directory. If you skip this subspec, keep `encrypted: false`.
142
-
143
- ## Web Platform
144
-
145
- On the web, this plugin uses [sql.js](https://sql.js.org/) (SQLite compiled to WebAssembly) with IndexedDB for persistence.
146
-
147
- By default, the plugin loads `sql-wasm.js` and `sql-wasm.wasm` from the cdnjs CDN. If you want to bundle these files with your web application (to avoid a CDN dependency), call `configureWeb()` once at startup **before** the first `connect()`:
148
-
149
- ```typescript
150
- import { CapgoCapacitorFastSql, FastSQL } from '@capgo/capacitor-fast-sql';
151
-
152
- // Point to your locally bundled sql.js files
153
- await CapgoCapacitorFastSql.configureWeb({
154
- sqlJsUrl: '/assets/sql-wasm.js',
155
- wasmUrl: '/assets/sql-wasm.wasm',
156
- });
157
-
158
- const db = await FastSQL.connect({ database: 'myapp' });
159
- ```
160
-
161
- `configureWeb()` is a no-op on iOS and Android — it is safe to call unconditionally.
162
-
163
- ## Usage
164
-
165
- ### Basic Example
166
-
167
- ```typescript
168
- import { FastSQL } from '@capgo/capacitor-fast-sql';
169
-
170
- // Connect to database
171
- const db = await FastSQL.connect({ database: 'myapp' });
172
-
173
- // Create table
174
- await db.execute(`
175
- CREATE TABLE IF NOT EXISTS users (
176
- id INTEGER PRIMARY KEY AUTOINCREMENT,
177
- name TEXT NOT NULL,
178
- email TEXT UNIQUE
179
- )
180
- `);
181
-
182
- // Insert data
183
- const result = await db.run(
184
- 'INSERT INTO users (name, email) VALUES (?, ?)',
185
- ['John Doe', 'john@example.com']
186
- );
187
- console.log('Inserted row ID:', result.insertId);
188
-
189
- // Query data
190
- const users = await db.query('SELECT * FROM users WHERE name LIKE ?', ['John%']);
191
- console.log('Users:', users);
192
-
193
- // Close connection
194
- await FastSQL.disconnect('myapp');
195
- ```
196
-
197
- ### Transaction Example
198
-
199
- ```typescript
200
- const db = await FastSQL.connect({ database: 'myapp' });
201
-
202
- try {
203
- await db.transaction(async (tx) => {
204
- await tx.run('INSERT INTO accounts (name, balance) VALUES (?, ?)', ['Alice', 1000]);
205
- await tx.run('INSERT INTO accounts (name, balance) VALUES (?, ?)', ['Bob', 500]);
206
- await tx.run('UPDATE accounts SET balance = balance - 100 WHERE name = ?', ['Alice']);
207
- await tx.run('UPDATE accounts SET balance = balance + 100 WHERE name = ?', ['Bob']);
208
- });
209
- console.log('Transaction successful!');
210
- } catch (error) {
211
- console.error('Transaction failed:', error);
212
- }
213
- ```
214
-
215
- ### Batch Operations
216
-
217
- ```typescript
218
- const db = await FastSQL.connect({ database: 'myapp' });
219
-
220
- const results = await db.executeBatch([
221
- { statement: 'INSERT INTO logs (message) VALUES (?)', params: ['Log 1'] },
222
- { statement: 'INSERT INTO logs (message) VALUES (?)', params: ['Log 2'] },
223
- { statement: 'INSERT INTO logs (message) VALUES (?)', params: ['Log 3'] },
224
- ]);
225
- ```
226
-
227
- ### Key-Value Storage (Mobile-focused)
228
-
229
- ```typescript
230
- import { KeyValueStore } from '@capgo/capacitor-fast-sql';
231
-
232
- const kv = await KeyValueStore.open({
233
- database: 'myapp',
234
- encrypted: true,
235
- encryptionKey: 'super-secret-key',
236
- });
237
-
238
- await kv.set('session', { token: 'abc123', expiresAt: 1710000000 });
239
- const session = await kv.get('session');
240
- await kv.remove('session');
241
- ```
242
-
243
- ### RAG Vector Stores (Optional)
244
-
245
- `FastSQLVectorStore` provides a dependency-free VectorStore-compatible helper inspired by `@react-native-rag/op-sqlite`. It stores embeddings in SQLite as binary Float32 vectors and computes cosine similarity in TypeScript, so it works anywhere this plugin works.
246
-
247
- Each store is namespaced by the `store` option, so one database can hold as many independent vector stores as you need:
248
-
249
- ```typescript
250
- import { FastSQLVectorStore } from '@capgo/capacitor-fast-sql';
251
-
252
- const docs = await FastSQLVectorStore.open({
253
- database: 'rag',
254
- store: 'docs',
255
- embeddings,
256
- });
257
-
258
- const tickets = await FastSQLVectorStore.open({
259
- database: 'rag',
260
- store: 'tickets',
261
- embeddings,
262
- });
263
-
264
- await docs.add({
265
- document: 'Capgo ships instant updates for Capacitor apps.',
266
- metadata: { source: 'docs' },
267
- });
268
-
269
- const results = await docs.query({
270
- queryText: 'How do instant updates work?',
271
- nResults: 3,
272
- });
273
-
274
- await docs.close();
275
- await tickets.close();
276
- ```
277
-
278
- You can also use precomputed embeddings without an embeddings provider:
279
-
280
- ```typescript
281
- const store = await FastSQLVectorStore.open({
282
- database: 'rag',
283
- store: 'offline-embeddings',
284
- embeddingDimension: 384,
285
- });
286
-
287
- await store.add({
288
- id: 'intro',
289
- document: 'Local RAG entry',
290
- embedding: [0.12, 0.08, 0.31 /* ...384 values */],
291
- });
292
-
293
- const matches = await store.query({
294
- queryEmbedding: [0.11, 0.09, 0.29 /* ...384 values */],
295
- nResults: 5,
296
- });
297
- ```
298
-
299
- > Note: Web support is intended for minimal testing only. The primary focus is iOS/Android.
300
-
301
- ## API
302
-
1
+ # @capgo/capacitor-fast-sql
2
+ <a href="https://capgo.app/"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-fast-sql" alt="Capgo - Instant updates for Capacitor" /></a>
3
+
4
+ <div align="center">
5
+ <h2><a href="https://capgo.app/?ref=plugin_fast_sql"> ➡️ Get Instant updates for your App with Capgo</a></h2>
6
+ <h2><a href="https://capgo.app/consulting/?ref=plugin_fast_sql"> Missing a feature? We'll build the plugin for you 💪</a></h2>
7
+ </div>
8
+
9
+ High-performance native SQLite plugin with HTTP server for efficient sync operations and IndexedDB replacement.
10
+ Official Capgo alternative to Ionic Appflow Secure Storage.
11
+
12
+ ## Why Fast SQL?
13
+
14
+ Traditional Capacitor plugins serialize data through the JavaScript bridge, which becomes inefficient with large datasets. Fast SQL solves this by establishing a local HTTP server for direct native communication, making it ideal for:
15
+
16
+ - **Local-first sync systems** (CRDTs, operational transforms)
17
+ - **IndexedDB replacement** on platforms with broken/limited implementations
18
+ - **Large dataset operations** requiring high throughput
19
+ - **Batch operations** with thousands of rows
20
+ - **Binary data storage** (BLOBs, files)
21
+
22
+ ## Documentation
23
+
24
+ The most complete doc is available here: https://capgo.app/docs/plugins/fast-sql/
25
+
26
+ ## Compatibility
27
+
28
+ | Plugin version | Capacitor compatibility | Maintained |
29
+ | -------------- | ----------------------- | ---------- |
30
+ | v8.\*.\* | v8.\*.\* | ✅ |
31
+ | v7.\*.\* | v7.\*.\* | On demand |
32
+ | v6.\*.\* | v6.\*.\* | ❌ |
33
+ | v5.\*.\* | v5.\*.\* | ❌ |
34
+
35
+ > **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.
36
+
37
+ ## Install
38
+
39
+ You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
40
+
41
+ ```bash
42
+ npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins
43
+ ```
44
+
45
+ Then use the following prompt:
46
+
47
+ ```text
48
+ Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-fast-sql` plugin in my project.
49
+ ```
50
+
51
+ If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
52
+
53
+ ```bash
54
+ npm install @capgo/capacitor-fast-sql
55
+ npx cap sync
56
+ ```
57
+
58
+ ## Overview
59
+
60
+ This plugin provides direct native SQLite database access with a custom communication protocol inspired by [capacitor-blob-writer](https://github.com/diachedelic/capacitor-blob-writer). Instead of using Capacitor's standard bridge (which serializes data inefficiently), it establishes a local HTTP server for optimal performance with large datasets and sync operations.
61
+
62
+ ### Key Features
63
+
64
+ - **Custom HTTP Protocol**: Bypasses Capacitor's bridge for up to 25x faster performance with large data
65
+ - **Direct Native SQLite**: Full SQL support with transactions, batch operations, and binary data
66
+ - **Sync-Friendly**: Designed for local sync systems (CRDTs, operational transforms, etc.)
67
+ - **IndexedDB Replacement**: Provides reliable alternative to broken/limited IndexedDB implementations
68
+ - **Cross-Platform**: iOS, Android, and Web (using sql.js + IndexedDB for persistence)
69
+ - **Optional RAG VectorStore**: Persist many named vector stores for retrieval-augmented generation without adding a native dependency
70
+
71
+ ## iOS Configuration
72
+
73
+ This plugin runs a local HTTP server on `localhost`. iOS App Transport Security (ATS) blocks cleartext HTTP by default, so you **must** allow local networking in your `Info.plist`:
74
+
75
+ ```xml
76
+ <key>NSAppTransportSecurity</key>
77
+ <dict>
78
+ <key>NSAllowsLocalNetworking</key>
79
+ <true/>
80
+ </dict>
81
+ ```
82
+
83
+ This only permits cleartext to loopback addresses (`localhost` / `127.0.0.1`) — it does not weaken ATS for external connections.
84
+
85
+ ## Android Configuration
86
+
87
+ This plugin runs a local HTTP server on `localhost` to bypass Capacitor's bridge for performance. Android 9+ blocks cleartext (non-HTTPS) traffic by default, so you **must** allow it for `localhost`.
88
+
89
+ **Option A — Scoped to localhost only (recommended):**
90
+
91
+ Create `android/app/src/main/res/xml/network_security_config.xml`:
92
+
93
+ ```xml
94
+ <?xml version="1.0" encoding="utf-8"?>
95
+ <network-security-config>
96
+ <domain-config cleartextTrafficPermitted="true">
97
+ <domain includeSubdomains="false">localhost</domain>
98
+ <domain includeSubdomains="false">127.0.0.1</domain>
99
+ </domain-config>
100
+ </network-security-config>
101
+ ```
102
+
103
+ Then reference it in your `AndroidManifest.xml`:
104
+
105
+ ```xml
106
+ <application
107
+ android:networkSecurityConfig="@xml/network_security_config">
108
+ ...
109
+ </application>
110
+ ```
111
+
112
+ **Option B — Allow all cleartext (simpler but less secure):**
113
+
114
+ ```xml
115
+ <application
116
+ android:usesCleartextTraffic="true">
117
+ ...
118
+ </application>
119
+ ```
120
+
121
+ ## Encryption
122
+
123
+ ### Android
124
+
125
+ Encryption uses [SQLCipher](https://www.zetetic.net/sqlcipher/) and is opt-in. Add the SQLCipher dependency to your **app-level** `build.gradle`:
126
+
127
+ ```gradle
128
+ dependencies {
129
+ implementation 'net.zetetic:sqlcipher-android:4.13.0'
130
+ }
131
+ ```
132
+
133
+ Then connect with encryption enabled:
134
+
135
+ ```typescript
136
+ const db = await FastSQL.connect({
137
+ database: 'secure',
138
+ encrypted: true,
139
+ encryptionKey: 'my-secret-key',
140
+ });
141
+ ```
142
+
143
+ If SQLCipher is not installed and `encrypted: true` is passed, the plugin returns a clear error message instead of crashing.
144
+
145
+ ### iOS
146
+
147
+ SQLCipher is optional on iOS. The plugin builds without it; encryption calls will return `Encryption is not available in this build` unless SQLCipher is installed.
148
+
149
+ To enable encryption via CocoaPods, update your `ios/App/Podfile` after `capacitor install`/`cap sync` to use the SQLCipher subspec:
150
+
151
+ ```ruby
152
+ pod 'CapgoCapacitorFastSql/SQLCipher', :path => '../../node_modules/@capgo/capacitor-fast-sql'
153
+ ```
154
+
155
+ Then run `pod install` in the `ios/App` directory. If you skip this subspec, keep `encrypted: false`.
156
+
157
+ ## Web Platform
158
+
159
+ On the web, this plugin uses [sql.js](https://sql.js.org/) (SQLite compiled to WebAssembly) with IndexedDB for persistence.
160
+
161
+ By default, the plugin loads `sql-wasm.js` and `sql-wasm.wasm` from the cdnjs CDN. If you want to bundle these files with your web application (to avoid a CDN dependency), call `configureWeb()` once at startup **before** the first `connect()`:
162
+
163
+ ```typescript
164
+ import { CapgoCapacitorFastSql, FastSQL } from '@capgo/capacitor-fast-sql';
165
+
166
+ // Point to your locally bundled sql.js files
167
+ await CapgoCapacitorFastSql.configureWeb({
168
+ sqlJsUrl: '/assets/sql-wasm.js',
169
+ wasmUrl: '/assets/sql-wasm.wasm',
170
+ });
171
+
172
+ const db = await FastSQL.connect({ database: 'myapp' });
173
+ ```
174
+
175
+ `configureWeb()` is a no-op on iOS and Android — it is safe to call unconditionally.
176
+
177
+ ## Usage
178
+
179
+ ### Basic Example
180
+
181
+ ```typescript
182
+ import { FastSQL } from '@capgo/capacitor-fast-sql';
183
+
184
+ // Connect to database
185
+ const db = await FastSQL.connect({ database: 'myapp' });
186
+
187
+ // Create table
188
+ await db.execute(`
189
+ CREATE TABLE IF NOT EXISTS users (
190
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
191
+ name TEXT NOT NULL,
192
+ email TEXT UNIQUE
193
+ )
194
+ `);
195
+
196
+ // Insert data
197
+ const result = await db.run(
198
+ 'INSERT INTO users (name, email) VALUES (?, ?)',
199
+ ['John Doe', 'john@example.com']
200
+ );
201
+ console.log('Inserted row ID:', result.insertId);
202
+
203
+ // Query data
204
+ const users = await db.query('SELECT * FROM users WHERE name LIKE ?', ['John%']);
205
+ console.log('Users:', users);
206
+
207
+ // Close connection
208
+ await FastSQL.disconnect('myapp');
209
+ ```
210
+
211
+ ### Transaction Example
212
+
213
+ ```typescript
214
+ const db = await FastSQL.connect({ database: 'myapp' });
215
+
216
+ try {
217
+ await db.transaction(async (tx) => {
218
+ await tx.run('INSERT INTO accounts (name, balance) VALUES (?, ?)', ['Alice', 1000]);
219
+ await tx.run('INSERT INTO accounts (name, balance) VALUES (?, ?)', ['Bob', 500]);
220
+ await tx.run('UPDATE accounts SET balance = balance - 100 WHERE name = ?', ['Alice']);
221
+ await tx.run('UPDATE accounts SET balance = balance + 100 WHERE name = ?', ['Bob']);
222
+ });
223
+ console.log('Transaction successful!');
224
+ } catch (error) {
225
+ console.error('Transaction failed:', error);
226
+ }
227
+ ```
228
+
229
+ ### Batch Operations
230
+
231
+ ```typescript
232
+ const db = await FastSQL.connect({ database: 'myapp' });
233
+
234
+ const results = await db.executeBatch([
235
+ { statement: 'INSERT INTO logs (message) VALUES (?)', params: ['Log 1'] },
236
+ { statement: 'INSERT INTO logs (message) VALUES (?)', params: ['Log 2'] },
237
+ { statement: 'INSERT INTO logs (message) VALUES (?)', params: ['Log 3'] },
238
+ ]);
239
+ ```
240
+
241
+ ### Key-Value Storage (Mobile-focused)
242
+
243
+ ```typescript
244
+ import { KeyValueStore } from '@capgo/capacitor-fast-sql';
245
+
246
+ const kv = await KeyValueStore.open({
247
+ database: 'myapp',
248
+ encrypted: true,
249
+ encryptionKey: 'super-secret-key',
250
+ });
251
+
252
+ await kv.set('session', { token: 'abc123', expiresAt: 1710000000 });
253
+ const session = await kv.get('session');
254
+ await kv.remove('session');
255
+ ```
256
+
257
+ ### RAG Vector Stores (Optional)
258
+
259
+ `FastSQLVectorStore` provides a dependency-free VectorStore-compatible helper inspired by `@react-native-rag/op-sqlite`. It stores embeddings in SQLite as binary Float32 vectors and computes cosine similarity in TypeScript, so it works anywhere this plugin works.
260
+
261
+ Each store is namespaced by the `store` option, so one database can hold as many independent vector stores as you need:
262
+
263
+ ```typescript
264
+ import { FastSQLVectorStore } from '@capgo/capacitor-fast-sql';
265
+
266
+ const docs = await FastSQLVectorStore.open({
267
+ database: 'rag',
268
+ store: 'docs',
269
+ embeddings,
270
+ });
271
+
272
+ const tickets = await FastSQLVectorStore.open({
273
+ database: 'rag',
274
+ store: 'tickets',
275
+ embeddings,
276
+ });
277
+
278
+ await docs.add({
279
+ document: 'Capgo ships instant updates for Capacitor apps.',
280
+ metadata: { source: 'docs' },
281
+ });
282
+
283
+ const results = await docs.query({
284
+ queryText: 'How do instant updates work?',
285
+ nResults: 3,
286
+ });
287
+
288
+ await docs.close();
289
+ await tickets.close();
290
+ ```
291
+
292
+ You can also use precomputed embeddings without an embeddings provider:
293
+
294
+ ```typescript
295
+ const store = await FastSQLVectorStore.open({
296
+ database: 'rag',
297
+ store: 'offline-embeddings',
298
+ embeddingDimension: 384,
299
+ });
300
+
301
+ await store.add({
302
+ id: 'intro',
303
+ document: 'Local RAG entry',
304
+ embedding: [0.12, 0.08, 0.31 /* ...384 values */],
305
+ });
306
+
307
+ const matches = await store.query({
308
+ queryEmbedding: [0.11, 0.09, 0.29 /* ...384 values */],
309
+ nResults: 5,
310
+ });
311
+ ```
312
+
313
+ > Note: Web support is intended for minimal testing only. The primary focus is iOS/Android.
314
+
315
+ ## API
316
+
303
317
  <docgen-index>
304
318
 
305
319
  * [`connect(...)`](#connect)
@@ -315,8 +329,8 @@ const matches = await store.query({
315
329
  * [Type Aliases](#type-aliases)
316
330
  * [Enums](#enums)
317
331
 
318
- </docgen-index>
319
-
332
+ </docgen-index>
333
+
320
334
  <docgen-api>
321
335
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
322
336
 
@@ -632,4 +646,4 @@ SQL value types supported by the plugin
632
646
  | **`RepeatableRead`** | <code>'REPEATABLE READ'</code> |
633
647
  | **`Serializable`** | <code>'SERIALIZABLE'</code> |
634
648
 
635
- </docgen-api>
649
+ </docgen-api>
@@ -19,7 +19,7 @@ import java.util.Map;
19
19
  @CapacitorPlugin(name = "CapgoCapacitorFastSql")
20
20
  public class CapgoCapacitorFastSqlPlugin extends Plugin {
21
21
 
22
- private final String pluginVersion = "8.0.42";
22
+ private final String pluginVersion = "8.0.44";
23
23
 
24
24
  private Map<String, DatabaseConnection> databases = new HashMap<>();
25
25
  private SQLHTTPServer server;
@@ -10,7 +10,7 @@ import SQLite3
10
10
  */
11
11
  @objc(CapgoCapacitorFastSqlPlugin)
12
12
  public class CapgoCapacitorFastSqlPlugin: CAPPlugin, CAPBridgedPlugin {
13
- private let pluginVersion: String = "8.0.42"
13
+ private let pluginVersion: String = "8.0.44"
14
14
  public let identifier = "CapgoCapacitorFastSqlPlugin"
15
15
  public let jsName = "CapgoCapacitorFastSql"
16
16
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-fast-sql",
3
- "version": "8.0.42",
3
+ "version": "8.0.44",
4
4
  "description": "High-performance native SQLite plugin with custom protocol for efficient sync operations and IndexedDB replacement",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",