@capgo/capacitor-fast-sql 8.2.6 → 8.2.8
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,14 +1,29 @@
|
|
|
1
1
|
# @capgo/capacitor-fast-sql
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
|
|
3
|
+
Run SQLite fast in your Capacitor app: queries go through a local HTTP channel instead of the bridge, so large result sets and sync jobs stay quick. A practical replacement for IndexedDB, with optional encryption.
|
|
4
|
+
|
|
5
|
+
<a href="https://capgo.app/?ref=plugin_fast_sql"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-fast-sql" alt="Capgo - Instant updates for Capacitor" /></a>
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
<p><b>Capgo</b>: open-source live updates for Ionic and Capacitor apps. Ship OTA fixes and features instantly, without waiting for app store review.</p>
|
|
9
|
+
<h2><a href="https://capgo.app/register/?ref=plugin_fast_sql">➡️ Get started for free</a></h2>
|
|
10
|
+
<p>14-day unlimited free trial. No credit card required</p>
|
|
11
|
+
<p><a href="https://capgo.app/consulting/?ref=plugin_fast_sql">Missing a feature? We'll build the plugin for you 💪</a></p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="https://raw.githubusercontent.com/Cap-go/capacitor-fast-sql/main/assets/github-social-preview.png" alt="@capgo/capacitor-fast-sql for Capacitor apps" width="300" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## Key features
|
|
19
|
+
|
|
20
|
+
- **Fast path**: `connect()` opens the database and starts a local server, `getServerInfo()` returns its port and token for direct calls.
|
|
21
|
+
- **SQL**: `execute()` runs statements with parameters, plus batch operations.
|
|
22
|
+
- **Transactions**: `beginTransaction()`, `commitTransaction()` and `rollbackTransaction()`.
|
|
23
|
+
- **Encryption**: optional encrypted databases on iOS and Android via SQLCipher.
|
|
24
|
+
- **Web**: `configureWeb()` sets up the official SQLite Wasm module, with OPFS persistence when your server allows it.
|
|
25
|
+
- **Platforms**: iOS, Android and Web. Native SQLite on iOS and Android, SQLite Wasm on web.
|
|
26
|
+
|
|
12
27
|
## Why Fast SQL?
|
|
13
28
|
|
|
14
29
|
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:
|
|
@@ -80,13 +95,13 @@ This plugin runs a local HTTP server on `localhost`. iOS App Transport Security
|
|
|
80
95
|
</dict>
|
|
81
96
|
```
|
|
82
97
|
|
|
83
|
-
This only permits cleartext to loopback addresses (`localhost` / `127.0.0.1`)
|
|
98
|
+
This only permits cleartext to loopback addresses (`localhost` / `127.0.0.1`), it does not weaken ATS for external connections.
|
|
84
99
|
|
|
85
100
|
## Android Configuration
|
|
86
101
|
|
|
87
102
|
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
103
|
|
|
89
|
-
**Option A
|
|
104
|
+
**Option A, Scoped to localhost only (recommended):**
|
|
90
105
|
|
|
91
106
|
Create `android/app/src/main/res/xml/network_security_config.xml`:
|
|
92
107
|
|
|
@@ -109,7 +124,7 @@ Then reference it in your `AndroidManifest.xml`:
|
|
|
109
124
|
</application>
|
|
110
125
|
```
|
|
111
126
|
|
|
112
|
-
**Option B
|
|
127
|
+
**Option B, Allow all cleartext (simpler but less secure):**
|
|
113
128
|
|
|
114
129
|
```xml
|
|
115
130
|
<application
|
|
@@ -156,7 +171,7 @@ Then run `pod install` in the `ios/App` directory. If you skip this subspec, kee
|
|
|
156
171
|
|
|
157
172
|
## Web Platform
|
|
158
173
|
|
|
159
|
-
On the web, this plugin uses the official [@sqlite.org/sqlite-wasm](https://github.com/sqlite/sqlite-wasm) build with [OPFS](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system) for persistence. SQLite reads and writes the database file directly
|
|
174
|
+
On the web, this plugin uses the official [@sqlite.org/sqlite-wasm](https://github.com/sqlite/sqlite-wasm) build with [OPFS](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system) for persistence. SQLite reads and writes the database file directly, it is not loaded entirely into RAM or mirrored through IndexedDB.
|
|
160
175
|
|
|
161
176
|
For OPFS to work, your web server must send Cross-Origin Isolation headers:
|
|
162
177
|
|
|
@@ -195,7 +210,7 @@ await CapgoCapacitorFastSql.configureWeb({
|
|
|
195
210
|
const db = await FastSQL.connect({ database: 'myapp' });
|
|
196
211
|
```
|
|
197
212
|
|
|
198
|
-
`configureWeb()` is a no-op on iOS and Android
|
|
213
|
+
`configureWeb()` is a no-op on iOS and Android, it is safe to call unconditionally.
|
|
199
214
|
|
|
200
215
|
> **Note:** Existing databases previously stored in IndexedDB by sql.js are not migrated automatically. Re-seed or import data after upgrading if needed.
|
|
201
216
|
|
package/android/build.gradle
CHANGED
|
@@ -54,7 +54,7 @@ dependencies {
|
|
|
54
54
|
implementation 'androidx.sqlite:sqlite:2.7.1'
|
|
55
55
|
implementation 'com.google.code.gson:gson:2.14.0'
|
|
56
56
|
implementation 'org.nanohttpd:nanohttpd:2.3.1'
|
|
57
|
-
compileOnly 'net.zetetic:sqlcipher-android:4.
|
|
57
|
+
compileOnly 'net.zetetic:sqlcipher-android:4.19.1'
|
|
58
58
|
testImplementation "junit:junit:$junitVersion"
|
|
59
59
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
60
60
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
@@ -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.2.
|
|
22
|
+
private final String pluginVersion = "8.2.8";
|
|
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.2.
|
|
13
|
+
private let pluginVersion: String = "8.2.8"
|
|
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.2.
|
|
3
|
+
"version": "8.2.8",
|
|
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",
|