Skip to content

[Chore] Update Sqlite Async Web #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-anonymous-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-anonymous-auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ 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
logging: ^1.2.0
sqlite_async: 0.7.0-alpha.5
sqlite_async: ^0.8.0
universal_io: ^2.2.2

dev_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-edge-function-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-edge-function-auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ 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
logging: ^1.2.0
sqlite_async: 0.7.0-alpha.5
sqlite_async: ^0.8.0
universal_io: ^2.2.2

dev_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-simple-chat/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion demos/supabase-simple-chat/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions demos/supabase-todolist/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions demos/supabase-todolist/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ 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
logging: ^1.2.0
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:
Expand Down
6 changes: 6 additions & 0 deletions packages/powersync/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.3.0-alpha.8

- **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

- Updates and uses the latest `sqlite_async` alpha.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Future<void> _powerSyncDatabaseIsolate(
}

runZonedGuarded(() async {
db = await args.dbRef.openFactory
db = args.dbRef.openFactory
.open(SqliteOpenOptions(primaryConnection: false, readOnly: false));
final connection = SyncSqliteConnection(db!, mutex);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'package:universal_io/io.dart';
import 'dart:math';

import 'package:powersync/sqlite_async.dart';
Expand Down Expand Up @@ -28,8 +29,8 @@ abstract class AbstractPowerSyncOpenFactory extends DefaultSqliteOpenFactory {
}

@override
FutureOr<CommonDatabase> 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);
}
Expand All @@ -48,15 +49,15 @@ 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<CommonDatabase> _retriedOpen(SqliteOpenOptions options) async {
CommonDatabase _retriedOpen(SqliteOpenOptions options) {
final stopwatch = Stopwatch()..start();
var retryDelay = 2;
while (stopwatch.elapsedMilliseconds < 500) {
try {
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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -59,10 +58,10 @@ class PowerSyncOpenFactory extends AbstractPowerSyncOpenFactory {
}

@override
FutureOr<CommonDatabase> 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;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/powersync/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/powersync/test/utils/native_test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TestOpenFactory extends PowerSyncOpenFactory {
TestOpenFactory({required super.path});

@override
FutureOr<CommonDatabase> open(SqliteOpenOptions options) {
CommonDatabase open(SqliteOpenOptions options) {
sqlite_open.open.overrideFor(sqlite_open.OperatingSystem.linux, () {
return DynamicLibrary.open('libsqlite3.so.0');
});
Expand Down
4 changes: 4 additions & 0 deletions packages/powersync_attachments_helper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/powersync_attachments_helper/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ packages:
source: hosted
version: "2.1.0"
path:
dependency: transitive
dependency: "direct dev"
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ 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.

dev_dependencies:
lints: ^2.1.1
melos: ^3.4.0
test: ^1.25.0
path: ^1.0.0
Loading