diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1c369874..e9ff280f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "10.1.0" + ".": "10.2.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..d4650940 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +## [10.2.0](https://github.com/margelo/react-native-nitro-sqlite/compare/v10.1.0...v10.2.0) (2026-10-12) + + +### 🛠️ Dependency Upgrades + +* **deps:** bump actions/download-artifact from 4 to 8 ([#437](https://github.com/margelo/react-native-nitro-sqlite/issues/437)) ([8f38649](https://github.com/margelo/react-native-nitro-sqlite/commit/8f38649c437160454b40ec91d70e277d38427d0a)) +* **deps:** bump actions/upload-artifact from 4 to 7 ([#438](https://github.com/margelo/react-native-nitro-sqlite/issues/438)) ([251e509](https://github.com/margelo/react-native-nitro-sqlite/commit/251e509b4cc8166cbb64a14c8a2e5e763b9693d1)) + + +### ✨ Features + +* expose error type constants ([#441](https://github.com/margelo/react-native-nitro-sqlite/issues/441)) ([74c7409](https://github.com/margelo/react-native-nitro-sqlite/commit/74c7409d6c3834cf6b7c7bf6ad065a6f493fc59f)) + + +### 💨 Performance Improvements + +* improve query and write performance ([#440](https://github.com/margelo/react-native-nitro-sqlite/issues/440)) ([47e0ea5](https://github.com/margelo/react-native-nitro-sqlite/commit/47e0ea5a25c4e1d9de28204576e3d7e0409e472f)) + + +### 🐛 Bug Fixes + +* reject SQL containing more than one statement ([#439](https://github.com/margelo/react-native-nitro-sqlite/issues/439)) ([c6d6aab](https://github.com/margelo/react-native-nitro-sqlite/commit/c6d6aab4ee131716d4f71cc9d53ef60b12dc4e47)), closes [#3](https://github.com/margelo/react-native-nitro-sqlite/issues/3) + + +### 🏗️ Project configuration and build flow + +* **deps-dev:** upgrade Mocha to 12 in the example ([#418](https://github.com/margelo/react-native-nitro-sqlite/issues/418)) ([6c47743](https://github.com/margelo/react-native-nitro-sqlite/commit/6c4774364711048e104428d71eb64bfa40ca374e)) diff --git a/bun.lock b/bun.lock index 1a6b2090..47236b0a 100644 --- a/bun.lock +++ b/bun.lock @@ -69,7 +69,7 @@ }, "example": { "name": "react-native-nitro-sqlite-example", - "version": "10.1.0", + "version": "10.2.0", "dependencies": { "@craftzdog/react-native-buffer": "^6.1.2", "@react-native-clipboard/clipboard": "^1.16.3", @@ -82,8 +82,8 @@ "react": "19.2.3", "react-native": "0.87.1", "react-native-nitro-modules": "*", - "react-native-nitro-sqlite": "10.1.0", - "react-native-nitro-sqlite-vec": "10.1.0", + "react-native-nitro-sqlite": "10.2.0", + "react-native-nitro-sqlite-vec": "10.2.0", "react-native-quick-base64": "^3.0.0", "react-native-quick-crypto": "^1.1.5", "react-native-safe-area-context": "^5.10.0", @@ -158,7 +158,7 @@ }, "packages/react-native-nitro-sqlite": { "name": "react-native-nitro-sqlite", - "version": "10.1.0", + "version": "10.2.0", "dependencies": { "typeorm": "1.1.1", }, @@ -185,9 +185,9 @@ }, "packages/react-native-nitro-sqlite-vec": { "name": "react-native-nitro-sqlite-vec", - "version": "10.1.0", + "version": "10.2.0", "devDependencies": { - "react-native-nitro-sqlite": "10.1.0", + "react-native-nitro-sqlite": "10.2.0", "typescript": "^5.8.3", }, "peerDependencies": { diff --git a/docs/releases/v10.2.0.md b/docs/releases/v10.2.0.md new file mode 100644 index 00000000..bdef56c6 --- /dev/null +++ b/docs/releases/v10.2.0.md @@ -0,0 +1,38 @@ +NitroSQLite 10.2.0 improves repeated queries, async result delivery, and Android writes. It also adds runtime error constants and an errors-only entry point for shared code and Node.js tests. This minor release includes compatibility changes to SQL validation and query result objects, so review the upgrade notes before rebuilding your app. + +## Performance improvements + +Each connection now caches its 32 most recently used query and data-change statements. Repeated calls to `execute()` and `executeAsync()` can reuse compiled SQL when the query text stays the same. Bind values as parameters to benefit from this cache. Statements such as `PRAGMA`, `ATTACH`, and transaction commands still compile on every call. See the [performance guide](https://sqlite.margelo.com/docs/guides/performance). + +Async queries, batches, and file imports now run on a dedicated worker thread per connection. Large managed async queries convert rows to JavaScript in batches while SQLite reads the remaining rows. The promise still resolves once with every row in order; paginate large queries to limit the final result size. + +Android builds now use `fdatasync()` and enable batch atomic writes on supported F2FS filesystems. These changes reduce commit I/O without lowering `PRAGMA synchronous`. SQLite falls back to its rollback journal when atomic writes are unavailable. See the [Android configuration guide](https://sqlite.margelo.com/docs/configuration/android) for details and build-time opt-outs. [#440](https://github.com/margelo/react-native-nitro-sqlite/pull/440) + +## Breaking changes and migration + +### One SQL statement per query + +SQL strings containing more than one statement now throw or reject instead of running the first statement and silently ignoring the rest. This affects `execute()`, `executeAsync()`, `prepare()`, each batch command, and each nonempty SQL-file line. Trailing whitespace, comments, and extra semicolons remain allowed. [#439](https://github.com/margelo/react-native-nitro-sqlite/pull/439) + +Replace a query such as `db.execute('CREATE TABLE foo (id INTEGER); CREATE TABLE bar (id INTEGER);')` with separate statements. Use a batch when the changes should commit together: + +```ts +await db.executeBatchAsync([ + { query: 'CREATE TABLE foo (id INTEGER)' }, + { query: 'CREATE TABLE bar (id INTEGER)' }, +]) +``` + +Use separate `execute()` or `executeAsync()` calls when you need each statement's results. Inside a transaction callback, execute each statement through the callback's `tx` methods. SQL files must contain one complete statement per nonempty line; a line with multiple statements now fails and rolls back the import. Do not split SQL by semicolons alone, since semicolons can appear inside strings and trigger bodies. See [batch operations](https://sqlite.margelo.com/docs/guides/batch-operations) and [SQL file loading](https://sqlite.margelo.com/docs/guides/load-sql-file). + +### Query results are plain objects + +`NitroSQLiteQueryResult` no longer extends Nitro's `HybridObject`. Results no longer have `name`, `toString()`, `equals()`, or `dispose()` members from Nitro. Remove result-specific Nitro lifecycle calls and hybrid-object assumptions; ordinary JavaScript garbage collection reclaims results. The data fields `rowsAffected`, `insertId`, `results`, and `metadata` remain, and managed results retain `rows._array`, `rows.length`, and `rows.item()`. + +For users calling `NitroSQLite.native.executeAsync()` directly, the new optional `onRows` callback receives leading rows in batches. When supplied, those rows are excluded from the resolved result's `results` array, so combine the callback batches with the final rows if you need the complete result. Omitting the callback returns every row as before. Managed `executeAsync()` handles this automatically. See [native access](https://sqlite.margelo.com/docs/guides/sync-and-async#global-helpers-and-native-access). [#440](https://github.com/margelo/react-native-nitro-sqlite/pull/440) + +## Error handling and upgrading + +`NitroSQLiteExceptionType` is now available as runtime constants as well as a TypeScript type. Import it with `NitroSQLiteError` from `react-native-nitro-sqlite/errors` to classify failures without importing React Native or initializing the native module. Both exports remain available from the package root. [#441](https://github.com/margelo/react-native-nitro-sqlite/pull/441) + +Update `react-native-nitro-sqlite` to 10.2.0 and, if you use sqlite-vec, update `react-native-nitro-sqlite-vec` to the same version. Install Pods again on Apple platforms and rebuild your native app. The native bindings changed, so this upgrade requires a new native build. diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index a04a56c1..253c34c9 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1766,7 +1766,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - RNNitroSQLite (10.1.0): + - RNNitroSQLite (10.2.0): - hermes-engine - NitroModules - RCTRequired @@ -1789,7 +1789,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - RNNitroSqliteVec (10.1.0): + - RNNitroSqliteVec (10.2.0): - RNNitroSQLite - RNScreens (4.28.0): - hermes-engine @@ -2222,8 +2222,8 @@ SPEC CHECKSUMS: ReactCommon: 749169e12aa3461a3df3656a00e48dbe0456b2d6 ReactNativeDependencies: 94c922c39e0e6150ee9ad05e2ca1946e0ef55783 RNCClipboard: e706ef7ccbbfd69f829c1b683f893bc7668c9fdb - RNNitroSQLite: 8f61cb932daf0f55b10310821b9982c43ca5b1c4 - RNNitroSqliteVec: 6f95f4347daf1fcbf64d273170b2fbf235b46a87 + RNNitroSQLite: dc6b7ede85f596a34192a2d2717547c022274e12 + RNNitroSqliteVec: 2ad86d0717e2eecd168a02fda178af760d6bf45b RNScreens: 3c977859fd13e67dc4ebfc24afb4d7c2e894db61 SocketRocket: 37aec555668fb852ec12e3c0de59a86ca58f0871 Yoga: d1c536142c5ff8ec8cd856ab2a7c227a1d875c8e diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 0af85bd9..24895679 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -2311,7 +2311,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - RNNitroSQLite (10.1.0): + - RNNitroSQLite (10.2.0): - boost - DoubleConversion - fast_float @@ -2340,7 +2340,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - RNNitroSqliteVec (10.1.0): + - RNNitroSqliteVec (10.2.0): - RNNitroSQLite - SocketRocket (0.7.1) - Yoga (0.0.0) @@ -2658,8 +2658,8 @@ SPEC CHECKSUMS: ReactCodegen: 4dff081e9dbb8acd8b15a8acc9374b4ac1a9869d ReactCommon: bc273d1cfc32a36ea662e81293e0961de8c21c77 RNCClipboard: 4b58c780f63676367640f23c8e114e9bd0cf86ac - RNNitroSQLite: 2822f30e998d8da8fda8dbe7735d4719f12c27a3 - RNNitroSqliteVec: 040c036e18036398be019353bd26afb1146c6dc4 + RNNitroSQLite: 2ae5e37bd04820a7f3c0de69f0cc2affdb2eedd8 + RNNitroSqliteVec: 2ad86d0717e2eecd168a02fda178af760d6bf45b SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 Yoga: a88f30ac6f89fded00f9840e7d043315e5ab4fe0 diff --git a/example/package.json b/example/package.json index 1e9e557d..5f4e9e1a 100644 --- a/example/package.json +++ b/example/package.json @@ -1,6 +1,6 @@ { "name": "react-native-nitro-sqlite-example", - "version": "10.1.0", + "version": "10.2.0", "private": true, "nitroSQLite": { "threadSafe": true, @@ -33,8 +33,8 @@ "react": "19.2.3", "react-native": "0.87.1", "react-native-nitro-modules": "*", - "react-native-nitro-sqlite": "10.1.0", - "react-native-nitro-sqlite-vec": "10.1.0", + "react-native-nitro-sqlite": "10.2.0", + "react-native-nitro-sqlite-vec": "10.2.0", "react-native-quick-base64": "^3.0.0", "react-native-quick-crypto": "^1.1.5", "react-native-safe-area-context": "^5.10.0", diff --git a/package.json b/package.json index 038338ae..2fd4a70f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-nitro-sqlite-workspace", - "version": "10.1.0", + "version": "10.2.0", "packageManager": "bun@1.3.1", "private": "true", "workspaces": [ diff --git a/packages/react-native-nitro-sqlite-vec/package.json b/packages/react-native-nitro-sqlite-vec/package.json index 03c646fb..73da8329 100644 --- a/packages/react-native-nitro-sqlite-vec/package.json +++ b/packages/react-native-nitro-sqlite-vec/package.json @@ -1,6 +1,6 @@ { "name": "react-native-nitro-sqlite-vec", - "version": "10.1.0", + "version": "10.2.0", "description": "Vector search (sqlite-vec) for react-native-nitro-sqlite. Native sqlite-vec is statically linked into the core's single sqlite3 — no second SQLite, no runtime extension loading.", "source": "./src/index", "react-native": "./src/index", @@ -45,7 +45,7 @@ "react-native-nitro-sqlite": ">=9.0.0" }, "devDependencies": { - "react-native-nitro-sqlite": "10.1.0", + "react-native-nitro-sqlite": "10.2.0", "typescript": "^5.8.3" }, "jest": { diff --git a/packages/react-native-nitro-sqlite/package.json b/packages/react-native-nitro-sqlite/package.json index 446745b7..d880ecfa 100644 --- a/packages/react-native-nitro-sqlite/package.json +++ b/packages/react-native-nitro-sqlite/package.json @@ -1,6 +1,6 @@ { "name": "react-native-nitro-sqlite", - "version": "10.1.0", + "version": "10.2.0", "description": "Fast SQLite library for React Native built using Nitro Modules", "main": "./lib/module/index", "module": "./lib/module/index",