From 193e11a50a18f380a632b3e1c3a073dc8bf28108 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 4 Jul 2024 16:21:50 +0200 Subject: [PATCH 1/7] update sqlite async --- demos/supabase-anonymous-auth/pubspec.lock | 4 ++-- demos/supabase-anonymous-auth/pubspec.yaml | 2 +- demos/supabase-edge-function-auth/pubspec.lock | 4 ++-- demos/supabase-edge-function-auth/pubspec.yaml | 2 +- demos/supabase-simple-chat/pubspec.lock | 4 ++-- demos/supabase-todolist/pubspec.lock | 4 ++-- demos/supabase-todolist/pubspec.yaml | 2 +- .../open_factory/abstract_powersync_open_factory.dart | 9 +++++---- .../lib/src/open_factory/native/native_open_factory.dart | 7 +++---- packages/powersync/pubspec.yaml | 3 ++- packages/powersync/test/utils/native_test_utils.dart | 2 +- 11 files changed, 22 insertions(+), 21 deletions(-) diff --git a/demos/supabase-anonymous-auth/pubspec.lock b/demos/supabase-anonymous-auth/pubspec.lock index 4b329fdf..3578096b 100644 --- a/demos/supabase-anonymous-auth/pubspec.lock +++ b/demos/supabase-anonymous-auth/pubspec.lock @@ -480,10 +480,10 @@ packages: dependency: "direct main" description: name: sqlite_async - sha256: bf989697c50db97043702c625330895a8ebec4491548a8e46d315b9f60b7582e + sha256: "7c5a9bec86b6f5b7511b9ba30974fa7ea470aee2dc0d5b7021f6321a439a8d63" url: "https://pub.dev" source: hosted - version: "0.7.0-alpha.5" + version: "0.8.0" stack_trace: dependency: transitive description: diff --git a/demos/supabase-anonymous-auth/pubspec.yaml b/demos/supabase-anonymous-auth/pubspec.yaml index 33eda935..6548eedb 100644 --- a/demos/supabase-anonymous-auth/pubspec.yaml +++ b/demos/supabase-anonymous-auth/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: supabase_flutter: ^2.0.2 path: ^1.8.3 logging: ^1.2.0 - sqlite_async: 0.7.0-alpha.5 + sqlite_async: ^0.8.0 universal_io: ^2.2.2 dev_dependencies: diff --git a/demos/supabase-edge-function-auth/pubspec.lock b/demos/supabase-edge-function-auth/pubspec.lock index 4b329fdf..3578096b 100644 --- a/demos/supabase-edge-function-auth/pubspec.lock +++ b/demos/supabase-edge-function-auth/pubspec.lock @@ -480,10 +480,10 @@ packages: dependency: "direct main" description: name: sqlite_async - sha256: bf989697c50db97043702c625330895a8ebec4491548a8e46d315b9f60b7582e + sha256: "7c5a9bec86b6f5b7511b9ba30974fa7ea470aee2dc0d5b7021f6321a439a8d63" url: "https://pub.dev" source: hosted - version: "0.7.0-alpha.5" + version: "0.8.0" stack_trace: dependency: transitive description: diff --git a/demos/supabase-edge-function-auth/pubspec.yaml b/demos/supabase-edge-function-auth/pubspec.yaml index fedddfcd..48549288 100644 --- a/demos/supabase-edge-function-auth/pubspec.yaml +++ b/demos/supabase-edge-function-auth/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: supabase_flutter: ^2.0.2 path: ^1.8.3 logging: ^1.2.0 - sqlite_async: 0.7.0-alpha.5 + sqlite_async: ^0.8.0 universal_io: ^2.2.2 dev_dependencies: diff --git a/demos/supabase-simple-chat/pubspec.lock b/demos/supabase-simple-chat/pubspec.lock index fca23bb9..7cb0dc60 100644 --- a/demos/supabase-simple-chat/pubspec.lock +++ b/demos/supabase-simple-chat/pubspec.lock @@ -536,10 +536,10 @@ packages: dependency: transitive description: name: sqlite_async - sha256: bf989697c50db97043702c625330895a8ebec4491548a8e46d315b9f60b7582e + sha256: "7c5a9bec86b6f5b7511b9ba30974fa7ea470aee2dc0d5b7021f6321a439a8d63" url: "https://pub.dev" source: hosted - version: "0.7.0-alpha.5" + version: "0.8.0" stack_trace: dependency: transitive description: diff --git a/demos/supabase-todolist/pubspec.lock b/demos/supabase-todolist/pubspec.lock index ade0e5ee..d494f966 100644 --- a/demos/supabase-todolist/pubspec.lock +++ b/demos/supabase-todolist/pubspec.lock @@ -591,10 +591,10 @@ packages: dependency: "direct main" description: name: sqlite_async - sha256: bf989697c50db97043702c625330895a8ebec4491548a8e46d315b9f60b7582e + sha256: "7c5a9bec86b6f5b7511b9ba30974fa7ea470aee2dc0d5b7021f6321a439a8d63" url: "https://pub.dev" source: hosted - version: "0.7.0-alpha.5" + version: "0.8.0" stack_trace: dependency: transitive description: diff --git a/demos/supabase-todolist/pubspec.yaml b/demos/supabase-todolist/pubspec.yaml index aaa6f74d..17ae3c27 100644 --- a/demos/supabase-todolist/pubspec.yaml +++ b/demos/supabase-todolist/pubspec.yaml @@ -20,7 +20,7 @@ dependencies: camera: ^0.10.5+7 image: ^4.1.3 universal_io: ^2.2.2 - sqlite_async: 0.7.0-alpha.5 + sqlite_async: ^0.8.0 dev_dependencies: flutter_test: diff --git a/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart b/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart index 664d73e1..5e3d9343 100644 --- a/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart +++ b/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'dart:math'; import 'package:powersync/sqlite_async.dart'; @@ -28,8 +29,8 @@ abstract class AbstractPowerSyncOpenFactory extends DefaultSqliteOpenFactory { } @override - FutureOr open(SqliteOpenOptions options) async { - var db = await _retriedOpen(options); + CommonDatabase open(SqliteOpenOptions options) { + var db = _retriedOpen(options); for (final statement in pragmaStatements(options)) { db.select(statement); } @@ -48,7 +49,7 @@ abstract class AbstractPowerSyncOpenFactory extends DefaultSqliteOpenFactory { /// Usually a delay of 1-2ms is sufficient for the next try to succeed, but /// we increase the retry delay up to 16ms per retry, and a maximum of 500ms /// in total. - FutureOr _retriedOpen(SqliteOpenOptions options) async { + CommonDatabase _retriedOpen(SqliteOpenOptions options) { final stopwatch = Stopwatch()..start(); var retryDelay = 2; while (stopwatch.elapsedMilliseconds < 500) { @@ -56,7 +57,7 @@ abstract class AbstractPowerSyncOpenFactory extends DefaultSqliteOpenFactory { return super.open(options); } catch (e) { if (e is SqliteException && e.resultCode == 5) { - await Future.delayed(Duration(milliseconds: retryDelay)); + sleep(Duration(milliseconds: retryDelay)); retryDelay = min(retryDelay * 2, 16); continue; } diff --git a/packages/powersync/lib/src/open_factory/native/native_open_factory.dart b/packages/powersync/lib/src/open_factory/native/native_open_factory.dart index 949d578d..59416291 100644 --- a/packages/powersync/lib/src/open_factory/native/native_open_factory.dart +++ b/packages/powersync/lib/src/open_factory/native/native_open_factory.dart @@ -1,5 +1,4 @@ -import 'dart:async'; -import 'dart:io'; +import 'package:universal_io/io.dart'; import 'dart:isolate'; import 'package:powersync/src/open_factory/abstract_powersync_open_factory.dart'; import 'package:sqlite_async/sqlite3.dart' as sqlite; @@ -59,10 +58,10 @@ class PowerSyncOpenFactory extends AbstractPowerSyncOpenFactory { } @override - FutureOr open(SqliteOpenOptions options) async { + CommonDatabase open(SqliteOpenOptions options) { // ignore: deprecated_member_use_from_same_package _sqliteSetup?.setup(); - var db = await super.open(options); + var db = super.open(options); db.execute('PRAGMA recursive_triggers = TRUE'); return db; } diff --git a/packages/powersync/pubspec.yaml b/packages/powersync/pubspec.yaml index 28d85679..ffb8a9e1 100644 --- a/packages/powersync/pubspec.yaml +++ b/packages/powersync/pubspec.yaml @@ -10,7 +10,8 @@ dependencies: flutter: sdk: flutter - sqlite_async: 0.7.0-alpha.5 + sqlite_async: ^0.8.0 + universal_io: ^2.0.0 sqlite3_flutter_libs: ^0.5.15 meta: ^1.0.0 http: ^1.1.0 diff --git a/packages/powersync/test/utils/native_test_utils.dart b/packages/powersync/test/utils/native_test_utils.dart index c1dcaa73..00d3e429 100644 --- a/packages/powersync/test/utils/native_test_utils.dart +++ b/packages/powersync/test/utils/native_test_utils.dart @@ -14,7 +14,7 @@ class TestOpenFactory extends PowerSyncOpenFactory { TestOpenFactory({required super.path}); @override - FutureOr open(SqliteOpenOptions options) { + CommonDatabase open(SqliteOpenOptions options) { sqlite_open.open.overrideFor(sqlite_open.OperatingSystem.linux, () { return DynamicLibrary.open('libsqlite3.so.0'); }); From 6b3a197a66b2c3eadfb3bd9dbefd10c5aa0837f2 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 4 Jul 2024 16:28:04 +0200 Subject: [PATCH 2/7] lint fix --- .../lib/src/database/native/native_powersync_database.dart | 2 +- pubspec.lock | 2 +- pubspec.yaml | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/powersync/lib/src/database/native/native_powersync_database.dart b/packages/powersync/lib/src/database/native/native_powersync_database.dart index c5d8cb08..4044c0df 100644 --- a/packages/powersync/lib/src/database/native/native_powersync_database.dart +++ b/packages/powersync/lib/src/database/native/native_powersync_database.dart @@ -325,7 +325,7 @@ Future _powerSyncDatabaseIsolate( } runZonedGuarded(() async { - db = await args.dbRef.openFactory + db = args.dbRef.openFactory .open(SqliteOpenOptions(primaryConnection: false, readOnly: false)); final connection = SyncSqliteConnection(db!, mutex); diff --git a/pubspec.lock b/pubspec.lock index 02fdf572..0ffee54d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -266,7 +266,7 @@ packages: source: hosted version: "2.1.0" path: - dependency: transitive + dependency: "direct dev" description: name: path sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" diff --git a/pubspec.yaml b/pubspec.yaml index a192f2c4..829a05de 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A sample command-line application. version: 1.0.0 environment: - sdk: '>=3.3.0 <4.0.0' + sdk: ">=3.3.0 <4.0.0" # Add regular dependencies here. @@ -11,3 +11,4 @@ dev_dependencies: lints: ^2.1.1 melos: ^3.4.0 test: ^1.25.0 + path: ^1.0.0 From c30936c5a505a35f93c0ed66a8e329cc2d0a0314 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 4 Jul 2024 16:44:11 +0200 Subject: [PATCH 3/7] fix broken pana check --- packages/powersync_attachments_helper/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/powersync_attachments_helper/pubspec.yaml b/packages/powersync_attachments_helper/pubspec.yaml index f39cbffc..767f8fdf 100644 --- a/packages/powersync_attachments_helper/pubspec.yaml +++ b/packages/powersync_attachments_helper/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: flutter: sdk: flutter - powersync: ^1.3.0-alpha.7 + powersync: 1.3.0-alpha.7 logging: ^1.2.0 sqlite3: "^2.4.4" path_provider: ^2.0.13 From 57ce553f6e13a683ce39603a152bb81cd8218cc4 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 4 Jul 2024 16:48:02 +0200 Subject: [PATCH 4/7] use universal io --- .../lib/src/open_factory/abstract_powersync_open_factory.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart b/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart index 5e3d9343..f89f2b80 100644 --- a/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart +++ b/packages/powersync/lib/src/open_factory/abstract_powersync_open_factory.dart @@ -1,5 +1,5 @@ import 'dart:async'; -import 'dart:io'; +import 'package:universal_io/io.dart'; import 'dart:math'; import 'package:powersync/sqlite_async.dart'; From ee046b8a6b3e233b0beb63339f6e756726866f70 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 4 Jul 2024 17:26:19 +0200 Subject: [PATCH 5/7] pin versions --- demos/supabase-anonymous-auth/pubspec.yaml | 2 +- demos/supabase-edge-function-auth/pubspec.yaml | 2 +- demos/supabase-simple-chat/pubspec.yaml | 2 +- demos/supabase-todolist/pubspec.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demos/supabase-anonymous-auth/pubspec.yaml b/demos/supabase-anonymous-auth/pubspec.yaml index 6548eedb..a8d286a8 100644 --- a/demos/supabase-anonymous-auth/pubspec.yaml +++ b/demos/supabase-anonymous-auth/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter - powersync: ^1.3.0-alpha.7 + powersync: 1.3.0-alpha.7 path_provider: ^2.1.1 supabase_flutter: ^2.0.2 path: ^1.8.3 diff --git a/demos/supabase-edge-function-auth/pubspec.yaml b/demos/supabase-edge-function-auth/pubspec.yaml index 48549288..1554cbd0 100644 --- a/demos/supabase-edge-function-auth/pubspec.yaml +++ b/demos/supabase-edge-function-auth/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter - powersync: ^1.3.0-alpha.7 + powersync: 1.3.0-alpha.7 path_provider: ^2.1.1 supabase_flutter: ^2.0.2 path: ^1.8.3 diff --git a/demos/supabase-simple-chat/pubspec.yaml b/demos/supabase-simple-chat/pubspec.yaml index 6a9a84cd..3fce33ee 100644 --- a/demos/supabase-simple-chat/pubspec.yaml +++ b/demos/supabase-simple-chat/pubspec.yaml @@ -37,7 +37,7 @@ dependencies: supabase_flutter: ^1.10.25 timeago: ^3.6.0 - powersync: ^1.3.0-alpha.7 + powersync: 1.3.0-alpha.7 path_provider: ^2.1.1 path: ^1.8.3 logging: ^1.2.0 diff --git a/demos/supabase-todolist/pubspec.yaml b/demos/supabase-todolist/pubspec.yaml index 17ae3c27..b0bb3896 100644 --- a/demos/supabase-todolist/pubspec.yaml +++ b/demos/supabase-todolist/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: sdk: flutter powersync_attachments_helper: ^0.3.0-alpha.2 - powersync: ^1.3.0-alpha.7 + powersync: 1.3.0-alpha.7 path_provider: ^2.1.1 supabase_flutter: ^2.0.1 path: ^1.8.3 From 76d24026d695916dd3cbcef0693cb9a8f4074ca9 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 4 Jul 2024 17:30:33 +0200 Subject: [PATCH 6/7] chore(release): publish packages - powersync@1.3.0-alpha.8 - powersync_attachments_helper@0.3.0-alpha.3 --- CHANGELOG.md | 29 +++++++++++++++++++ demos/supabase-anonymous-auth/pubspec.yaml | 2 +- .../supabase-edge-function-auth/pubspec.yaml | 2 +- demos/supabase-simple-chat/pubspec.yaml | 2 +- demos/supabase-todolist/pubspec.yaml | 4 +-- packages/powersync/CHANGELOG.md | 5 ++++ packages/powersync/pubspec.yaml | 2 +- .../powersync_attachments_helper/CHANGELOG.md | 4 +++ .../powersync_attachments_helper/pubspec.yaml | 4 +-- 9 files changed, 46 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc95ad6a..80557a58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2024-07-04 + +### Changes + +--- + +Packages with breaking changes: + + - There are no breaking changes in this release. + +Packages with other changes: + + - [`powersync` - `v1.3.0-alpha.8`](#powersync---v130-alpha8) + - [`powersync_attachments_helper` - `v0.3.0-alpha.3`](#powersync_attachments_helper---v030-alpha3) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `powersync_attachments_helper` - `v0.3.0-alpha.3` + +--- + +#### `powersync` - `v1.3.0-alpha.8` + + - **FIX**(powersync-attachements-helper): pubspec file (#29). + - **DOCS**: update readme and getting started (#51). + + ## 2024-05-30 ### Changes diff --git a/demos/supabase-anonymous-auth/pubspec.yaml b/demos/supabase-anonymous-auth/pubspec.yaml index a8d286a8..4dc04e83 100644 --- a/demos/supabase-anonymous-auth/pubspec.yaml +++ b/demos/supabase-anonymous-auth/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter - powersync: 1.3.0-alpha.7 + powersync: 1.3.0-alpha.8 path_provider: ^2.1.1 supabase_flutter: ^2.0.2 path: ^1.8.3 diff --git a/demos/supabase-edge-function-auth/pubspec.yaml b/demos/supabase-edge-function-auth/pubspec.yaml index 1554cbd0..a6d8e5bd 100644 --- a/demos/supabase-edge-function-auth/pubspec.yaml +++ b/demos/supabase-edge-function-auth/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter - powersync: 1.3.0-alpha.7 + powersync: 1.3.0-alpha.8 path_provider: ^2.1.1 supabase_flutter: ^2.0.2 path: ^1.8.3 diff --git a/demos/supabase-simple-chat/pubspec.yaml b/demos/supabase-simple-chat/pubspec.yaml index 3fce33ee..70ebaf6c 100644 --- a/demos/supabase-simple-chat/pubspec.yaml +++ b/demos/supabase-simple-chat/pubspec.yaml @@ -37,7 +37,7 @@ dependencies: supabase_flutter: ^1.10.25 timeago: ^3.6.0 - powersync: 1.3.0-alpha.7 + powersync: 1.3.0-alpha.8 path_provider: ^2.1.1 path: ^1.8.3 logging: ^1.2.0 diff --git a/demos/supabase-todolist/pubspec.yaml b/demos/supabase-todolist/pubspec.yaml index b0bb3896..11e8ae6f 100644 --- a/demos/supabase-todolist/pubspec.yaml +++ b/demos/supabase-todolist/pubspec.yaml @@ -10,9 +10,9 @@ environment: dependencies: flutter: sdk: flutter - powersync_attachments_helper: ^0.3.0-alpha.2 + powersync_attachments_helper: ^0.3.0-alpha.3 - powersync: 1.3.0-alpha.7 + powersync: 1.3.0-alpha.8 path_provider: ^2.1.1 supabase_flutter: ^2.0.1 path: ^1.8.3 diff --git a/packages/powersync/CHANGELOG.md b/packages/powersync/CHANGELOG.md index 227bfdc9..4421911d 100644 --- a/packages/powersync/CHANGELOG.md +++ b/packages/powersync/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.3.0-alpha.8 + + - **FIX**(powersync-attachements-helper): pubspec file (#29). + - **DOCS**: update readme and getting started (#51). + ## 1.3.0-alpha.7 - Updates and uses the latest `sqlite_async` alpha. diff --git a/packages/powersync/pubspec.yaml b/packages/powersync/pubspec.yaml index ffb8a9e1..25a1a5c3 100644 --- a/packages/powersync/pubspec.yaml +++ b/packages/powersync/pubspec.yaml @@ -1,5 +1,5 @@ name: powersync -version: 1.3.0-alpha.7 +version: 1.3.0-alpha.8 homepage: https://powersync.com repository: https://github.com/powersync-ja/powersync.dart description: PowerSync Flutter SDK - keep PostgreSQL databases in sync with on-device SQLite databases. diff --git a/packages/powersync_attachments_helper/CHANGELOG.md b/packages/powersync_attachments_helper/CHANGELOG.md index 79d05e44..4e54661b 100644 --- a/packages/powersync_attachments_helper/CHANGELOG.md +++ b/packages/powersync_attachments_helper/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0-alpha.3 + + - Update a dependency to the latest release. + ## 0.3.0-alpha.2 > Note: This release has breaking changes. diff --git a/packages/powersync_attachments_helper/pubspec.yaml b/packages/powersync_attachments_helper/pubspec.yaml index 767f8fdf..1f43e557 100644 --- a/packages/powersync_attachments_helper/pubspec.yaml +++ b/packages/powersync_attachments_helper/pubspec.yaml @@ -1,6 +1,6 @@ name: powersync_attachments_helper description: A helper library for handling attachments when using PowerSync. -version: 0.3.0-alpha.2 +version: 0.3.0-alpha.3 repository: https://github.com/powersync-ja/powersync.dart homepage: https://www.powersync.com/ environment: @@ -10,7 +10,7 @@ dependencies: flutter: sdk: flutter - powersync: 1.3.0-alpha.7 + powersync: 1.3.0-alpha.8 logging: ^1.2.0 sqlite3: "^2.4.4" path_provider: ^2.0.13 From fdbab159e2cb1aed5cdb4fc20d25449b61562dc1 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Thu, 4 Jul 2024 17:39:59 +0200 Subject: [PATCH 7/7] update changelog --- packages/powersync/CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/powersync/CHANGELOG.md b/packages/powersync/CHANGELOG.md index 4421911d..087f3c2d 100644 --- a/packages/powersync/CHANGELOG.md +++ b/packages/powersync/CHANGELOG.md @@ -1,7 +1,8 @@ ## 1.3.0-alpha.8 - - **FIX**(powersync-attachements-helper): pubspec file (#29). - - **DOCS**: update readme and getting started (#51). +- **FIX**(powersync-attachements-helper): pubspec file (#29). +- **DOCS**: update readme and getting started (#51). +- Updates and uses the latest `sqlite_async` package. ## 1.3.0-alpha.7