Releases: devioarts/capacitor-sqlite
Releases · devioarts/capacitor-sqlite
Release list
v0.1.1
Added
- Added the cross-platform
runMany()API for one SQL statement and many value sets. It validates every set before the first write, is atomic by default, reuses one prepared statement on Android/iOS/Electron, uses a compact single-SQL request on sqlite-wasm Worker1, returns only aggregate changes by default, and optionally returns per-item changes/row IDs. Existing APIs are unchanged. - Added
runMany(10,000)to the full-load stress profile next torunBatch(10,000), so the repeated-statement transport gain is visible in normal and quiet in-app benchmark runs instead of only in layer diagnostics. - Added shared
rm-01..13, iOS nativeRunManyTests, an Electron worker regression, and diagnosticsd-15..24: runMany versus runBatch, pure JS row reconstruction, native BLOB envelope encoding, equivalent payload serialization, Android/iOS nativerunBatchtiming breakdown, concurrent-write fan-out, mixed read/write fan-out, and filtered-query plan comparisons. - Expanded regression coverage for bind counts, UPSERT row IDs, query planning, migrations, busy timeout, Electron worker lifecycle, compact query transport, and Android device-reported failures.
- Added a separate 24-case performance-diagnostic profile (
d-01..d-24) with latency percentiles and controlled comparisons for JS harness cost, platform dispatch, plugin queue/registry, minimal SQL, transactional versus autocommit writes, concurrent bridge throughput, SQLite-heavy single-call work, batch/runMany wrapping, TEXT/BLOB input and output, large-result materialization, pure-JS stage baselines, detailed native Android/iOS batch breakdown, concurrent write/mixed workload breakdowns, and filtered-query plan comparisons. The original full-load profile remains separate and unchanged.
Changed
- Removed leftover Capacitor-plugin-generator boilerplate test stubs (
android/src/test/kotlin/com/getcapacitor/ExampleUnitTest.kt,android/src/androidTest/kotlin/com/getcapacitor/android/ExampleInstrumentedTest.kt) — dead code, never published in the npm package, no functional effect. - Excluded
dist/docs.json(docgen intermediate artifact, no runtime purpose) from the published npm package. - Added
electronas an optional peer dependency (peerDependenciesMeta.electron.optional: true) so npm can report a version mismatch when Electron is present without warning pure iOS/Android/Web consumers who never install it. - README: corrected the "iOS multi-database scheduling" caveat to state explicitly that Android shares the identical single-thread/single-queue limitation across all open databases (previously only called out for iOS); documented that a multi-version
migrationslist is not atomic as a whole (a later version's failure leaves earlier versions durably committed); documented the new UPSERTlastInsertIdbehavior; documentedCapacitorSqlite.dispose()for Electron. src/definitions.tsJSDoc forrun()updated to document the UPSERTlastInsertId: 0behavior (source of the generated README API section).- Transaction documentation now checks every resolved
SqliteResultinstead of relying ontry/catch; plugin SQL failures resolve withsuccess: falseand do not reject Promises. - Documentation now describes the shared underlying executor/worker scheduling accurately and specifies live-connection migration, exact anonymous-bind-count, ambiguous-rowid behavior, known bulk-write/fan-out limitations, Web/OPFS autocommit durability cost, mixed read/write serialization, and the need for application indexes on large filtered/sorted queries.
Fixed
- Cross-platform SQL validation is now consistent.
run(),query(),runBatch(), andrunMany()reject missing/extra bind values, unsupported placeholders, malformed multi-statement SQL, non-finite native numbers, and relevant invalid-parameter cases with the expected public error codes. - Transaction and lifecycle state is more reliable. Reopening an already-open database applies pending migrations consistently, invalid manual-transaction migration attempts are rejected,
OR ROLLBACKresynchronizes mirrored state, Web readonly connections reassertquery_only, Android teardown no longer blocks/drops queued calls, and iOS close/open registry races are guarded. lastInsertIdis now conservative and portable. UPSERT update paths,WITHOUT ROWIDtables, unchanged connection rowids, replacement of the same explicit key, and rowid reuse return0; useRETURNINGwhen the exact affected row ID is required. iOS also uses the 64-bit total-changes counter where available.- Web parity gaps were closed. Web now enforces the already-open
directorycontract, setsbusy_timeout, mirrors connection-local rowid state to avoid extra successfulrun()worker round-trips, and resynchronizes that mirror after errors. - Binary and result transport no longer do unnecessary object expansion. Android/iOS use a private tagged-base64 BLOB envelope, Electron keeps
Uint8Arraythrough structured clone, and Android/iOS/Electron renderer queries use compact column/value transport before reconstructing the public row-object shape in JavaScript. - Bulk write paths avoid duplicated native work. Transactional
runBatch()reuses prepared statements for repeated SQL, validates the full input before the first write, avoids duplicate bind/metadata passes, and keepstransaction:falsesemantics unchanged. Repeated SQL analysis now uses bounded caches. - Packaging and generated-output issues were fixed. The published package includes
android/proguard-rules.pro, generated ESM output is importable by plain Node ESM consumers, and Electron'srunMany()metadata/compatibility path is covered. - Benchmark and suite reliability improved. Capability skips are explicit, runners report skip counts, Android CDP attaches to the intended WebView, stress tests validate API results and large payload contents, and the full-load matrix keeps its original release-scale counts.
v0.1.0
Added
- Added a real Web/OPFS CLI suite runner:
npm run test:suite:webandnpm run test:suite:web:stress. - Added Web runner validation for cross-origin isolation and OPFS availability before executing the suite.
- Added shared suite regression coverage for
query()rejecting DML withoutRETURNING. - Added JS parser tests for result-producing SQL accepted by
query(). - Added explicit SQL trust-boundary documentation.
- Added native lifecycle cleanup for open database handles on Android and iOS.
- Expanded
TESTING.mdrelease-test guidance. - Added cross-platform stress benchmark results for Electron, Web/OPFS, Android, and iOS.
- Added GitHub Actions workflows for fast CI and a manually triggered release matrix with retained platform logs.
- Added regression tests for the migration-version-bound and BLOB-clamping fixes below:
isValidMigrationVersionboundary cases intest/migration-validation.test.cjs(shared by Web and Electron), new iOS XCTest cases, andme-05in the shared suite. - Added regression tests for the bare-identifier statement-splitting fix below: new cases in
test/sql-guard.test.cjsandSqlStatementGuardTest.kt, a newSQLStatementGuardTests.swift(iOS previously had no direct unit test for this scanner), andmstmt-06in the shared suite.
Changed
query()now only accepts result-producing SQL:SELECT,PRAGMA,EXPLAIN, andINSERT/UPDATE/DELETE/REPLACE ... RETURNING.- Android SQLite work now runs on a single executor thread to preserve transaction thread affinity.
- Android CDP suite runner now starts long-running tests in the WebView and polls for completion instead of holding one long
Runtime.evaluatecall open. - Stress benchmarks now use release-relevant sizes: 10,000 writes, 100,000-row reads, 1 MB large values, and 2 x 10,000-row multi-DB load.
- Stress runner timeouts were raised for larger release-scale benchmark runs.
- README API documentation was regenerated and updated for the corrected
query()contract. - iOS Swift implementation was split into smaller helper files for maintainability.
- iOS unit tests were split by concern to keep test files easier to audit.
TESTING.mdnow documents all four suite runners: Electron, Web, Android, and iOS.
Fixed
- Fixed
query()allowing write DML without result rows on some backends. - Fixed Android manual transactions hanging when
beginTransaction()and later statements ran on different executor threads. - Fixed Android executor resource risk from unbounded cached thread creation.
- Fixed Android/iOS plugin teardown leaving open database handles until process cleanup.
- Fixed SwiftLint maintenance warnings; lint now reports 0 violations.
- Fixed Web runtime coverage gap by running the shared suite in a real browser against sqlite-wasm/OPFS.
- Fixed migration
versionaccepting values above the 32-bituser_versionceiling on Web, Electron, and iOS — Web/Electron silently truncated an out-of-range version via a| 0cast when writingPRAGMA user_version, which could make a migration re-apply on a lateropen()without any error being surfaced; iOS had no upper bound at all. All four platforms now rejectversion > 2147483647up front withMIGRATION_FAILED. - Fixed iOS BLOB bind values passed as a plain byte array (
number[]) silently clamping an out-of-range byte instead of rejecting it, matching the existing Android and Electron behavior. - Fixed the single-statement guard (
hasMultipleSqlStatements/hasMultipleStatements, all three ports) misreading a barebeginorcaseidentifier (e.g. a column namedbegin— SQLite does not reserve either word) as a trigger-body keyword, which swallowed the following semicolon and letexecute()silently run a second statement it should have rejected. Found via automated code review. - Fixed
npm run test:suite:webhanging indefinitely on CI (GitHub Actionsubuntu-latest) after the suite finished and printed its result. Chrome was launched without--headless, which relies on a display server that CI runners don't have; even after adding--headless=new, an orphaned Chrome helper process could still hold an inherited stdio pipe open and keep the script's Node process alive. Fixed by launching Chrome/npm detached (their own process group), killing the whole group on cleanup instead of just the direct child, and forcing an explicitprocess.exit()as a safety net.
v0.0.2
New Features
directoryoption — databases can now be stored indefault,documents,library, orcachelocations with platform-aware path mapping (iOS, Android, Electron, Web)
Bug Fixes
- Android compatibility and stability fixes
readonlymode now correctly blocks all write operations (execute,run,runBatch,beginTransaction, migrations)DB_ALREADY_OPENis now correctly detected when reopening with a differentdirectoryorreadonlyvalue
Other
- Replaced
example-appwith a newplaygroundapp (React + Vite) covering CRUD, batch, transactions, migrations, and stress tests - Added
TESTING.mdwith test pattern documentation