chore: Bump version to 0.0.2 and update CHANGELOG (#111)

This commit is contained in:
Marcelo Mendonça Soares 2026-08-11 09:23:10 -03:00 • committed by GitHub
commit c04bde5e6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 177 additions and 238 deletions

View file

@ -54,7 +54,7 @@ jobs:
- uses: ./.github/actions/setup
- name: Verify formatting
run: melos format
run: dart format . --output=none --set-exit-if-changed
dart_analyze:
name: dart analyze

View file

@ -1,3 +1,10 @@
## 0.0.2
- fix: Skips tracking FKs for relations with non-sync tables.
- fix: Fixes batch `insert` of previously tombstoned rows not being tracked correctly.
- refactor: Moves the core implementation to the `serverpod_offline_sync` shared package.
- chore: Updated Serverpod to `4.0.0-beta.2`.
## 0.0.1
- Initial version.
- chore: Initial version.

View file

@ -101,17 +101,17 @@ Add the packages to the server and client `pubspec.yaml` files.
```yaml
# your_project_client/pubspec.yaml
dependencies:
serverpod_offline_sync_client: 0.0.1
serverpod_offline_sync_client: 0.0.2
```
```yaml
# your_project_server/pubspec.yaml
dependencies:
serverpod_offline_sync_server: 0.0.1
serverpod_offline_sync_server: 0.0.2
```
> [!NOTE]
> Version `0.0.1` requires Serverpod `4.0.0-beta.0`.
> Version `0.0.2` requires Serverpod `4.0.0-beta.2`.
After adding the dependencies, list the `serverpod_offline_sync` module on the
`generator.yaml` file:

View file

@ -11,7 +11,7 @@ dependencies:
benchmark_harness: ^2.4.0
intl: ^0.20.2
path: ^1.9.1
serverpod_database: 4.0.0-beta.1
serverpod_database: 4.0.0-beta.2
serverpod_offline_sync:
path: ../packages/serverpod_offline_sync
serverpod_offline_sync_server:

View file

@ -16,7 +16,7 @@ dependencies:
http: ^1.5.0
path: ^1.9.1
path_provider: ^2.1.5
serverpod_database: 4.0.0-beta.1
serverpod_database: 4.0.0-beta.2
serverpod_offline_sync_client:
path: ../../packages/serverpod_offline_sync_client
serverpod_offline_sync_test_client:
@ -27,35 +27,35 @@ dependencies:
dev_dependencies:
flutter_lints: ^6.0.0
dependency_overrides:
meta: 1.18.2
serverpod_auth_core_client:
git:
url: https://github.com/serverpod/serverpod.git
path: modules/serverpod_auth/serverpod_auth_core/serverpod_auth_core_client
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_client:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_client
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_database:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_database
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_offline_sync:
path: ../../packages/serverpod_offline_sync
serverpod_serialization:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_serialization
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_shared:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_shared
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# dependency_overrides:
# meta: 1.18.2
# serverpod_auth_core_client:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: modules/serverpod_auth/serverpod_auth_core/serverpod_auth_core_client
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_client:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_client
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_database:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_database
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_offline_sync:
# path: ../../packages/serverpod_offline_sync
# serverpod_serialization:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_serialization
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_shared:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_shared
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
flutter:
uses-material-design: true

View file

@ -18,7 +18,7 @@ enum CrdtDataDeletedReason implements _i1.SerializableModel {
userReinsert,
userDelete,
userCascadeDelete,
uniqueLoser
uniqueLoser,
;
static CrdtDataDeletedReason fromJson(int index) {

View file

@ -26,7 +26,7 @@ enum CrdtForeignKeyOverrideReason implements _i1.SerializableModel {
/// cannot repair the value (restrict, no action, cascade, or the column is
/// non-nullable), so the row is hidden by projection while the attempt is
/// preserved.
missingParent
missingParent,
;
static CrdtForeignKeyOverrideReason fromJson(int index) {

View file

@ -22,7 +22,7 @@ enum CrdtDataRowVisibility implements _i1.SerializableModel {
foreignKeyRestrictRestore,
userDelete,
userCascadeDelete,
foreignKeyCascade
foreignKeyCascade,
;
static CrdtDataRowVisibility fromJson(int index) {

View file

@ -350,8 +350,6 @@ class CrdtScopeRepository {
final attachRow = const CrdtScopeAttachRowRepository._();
final detach = const CrdtScopeDetachRepository._();
final detachRow = const CrdtScopeDetachRowRepository._();
/// Returns a list of [CrdtScope]s matching the given query parameters.
@ -831,34 +829,6 @@ class CrdtScopeAttachRowRepository {
}
}
class CrdtScopeDetachRepository {
const CrdtScopeDetachRepository._();
/// Detaches the relation between this [CrdtScope] and the given [CrdtScopeNode]
/// by setting the [CrdtScopeNode]'s foreign key `scopeId` to `null`.
///
/// This removes the association between the two models without deleting
/// the related record.
Future<void> nodes(
_i1.DatabaseSession session,
List<_i3.CrdtScopeNode> crdtScopeNode, {
_i1.Transaction? transaction,
}) async {
if (crdtScopeNode.any((e) => e.id == null)) {
throw ArgumentError.notNull('crdtScopeNode.id');
}
var $crdtScopeNode = crdtScopeNode
.map((e) => e.copyWith(scopeId: null))
.toList();
await session.db.update<_i3.CrdtScopeNode>(
$crdtScopeNode,
columns: [_i3.CrdtScopeNode.t.scopeId],
transaction: transaction,
);
}
}
class CrdtScopeDetachRowRepository {
const CrdtScopeDetachRowRepository._();
@ -883,26 +853,4 @@ class CrdtScopeDetachRowRepository {
transaction: transaction,
);
}
/// Detaches the relation between this [CrdtScope] and the given [CrdtScopeNode]
/// by setting the [CrdtScopeNode]'s foreign key `scopeId` to `null`.
///
/// This removes the association between the two models without deleting
/// the related record.
Future<void> nodes(
_i1.DatabaseSession session,
_i3.CrdtScopeNode crdtScopeNode, {
_i1.Transaction? transaction,
}) async {
if (crdtScopeNode.id == null) {
throw ArgumentError.notNull('crdtScopeNode.id');
}
var $crdtScopeNode = crdtScopeNode.copyWith(scopeId: null);
await session.db.updateRow<_i3.CrdtScopeNode>(
$crdtScopeNode,
columns: [_i3.CrdtScopeNode.t.scopeId],
transaction: transaction,
);
}
}

View file

@ -17,7 +17,7 @@ import 'package:serverpod_serialization/serverpod_serialization.dart' as _i1;
/// The role gates CRDT writes only. Reads remain membership-wide.
enum CrdtScopeRole implements _i1.SerializableModel {
readOnly,
readWrite
readWrite,
;
static CrdtScopeRole fromJson(String name) {

View file

@ -64,7 +64,9 @@ class Protocol extends _i1.DatabaseSerializationManager {
static final Protocol _instance = Protocol._();
static final List<_i1.TableDefinition> targetTableDefinitions = [
final Set<_i2.SerializationManager> _hostProtocols = {};
static List<_i1.TableDefinition> get targetTableDefinitions => [
_i1.TableDefinition(
name: 'crdt_data_fields',
dartName: 'CrdtDataField',
@ -904,8 +906,6 @@ class Protocol extends _i1.DatabaseSerializationManager {
),
];
final Set<_i2.SerializationManager> _hostProtocols = {};
void registerHostProtocol(
String projectName,
_i2.SerializationManager protocol,

View file

@ -19,7 +19,7 @@ enum CrdtSyncViolationOperation implements _i1.SerializableModel {
mergeDelete,
outboundInsert,
outboundUpdate,
outboundDelete
outboundDelete,
;
static CrdtSyncViolationOperation fromJson(String name) {

View file

@ -16,7 +16,7 @@ import 'package:serverpod_serialization/serverpod_serialization.dart' as _i1;
enum CrdtSyncViolationType implements _i1.SerializableModel {
ownershipCollision,
missingDomainRow,
unauthorizedWrite
unauthorizedWrite,
;
static CrdtSyncViolationType fromJson(String name) {

View file

@ -1,5 +1,5 @@
name: serverpod_offline_sync
version: 0.0.1
version: 0.0.2
description: Shared package for the Serverpod Offline Sync project.
homepage: https://github.com/marcelomendoncasoares/serverpod_offline_sync
@ -11,8 +11,8 @@ resolution: workspace
dependencies:
clock: ^1.1.2
meta: ^1.18.0
serverpod_database: 4.0.0-beta.1
serverpod_serialization: 4.0.0-beta.1
serverpod_database: 4.0.0-beta.2
serverpod_serialization: 4.0.0-beta.2
uuid: ^4.5.3
dev_dependencies:

View file

@ -12,8 +12,8 @@
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod_database/serverpod_database.dart' as _i1;
import 'package:serverpod_offline_sync/serverpod_offline_sync.dart' as _i2;
import 'package:serverpod_client/serverpod_client.dart' as _i3;
import 'package:serverpod_client/serverpod_client.dart' as _i2;
import 'package:serverpod_offline_sync/serverpod_offline_sync.dart' as _i3;
export 'package:serverpod_offline_sync/serverpod_offline_sync.dart'
hide Protocol;
export 'client.dart';
@ -25,21 +25,21 @@ class Protocol extends _i1.DatabaseSerializationManager {
static final Protocol _instance = Protocol._();
static final List<_i1.TableDefinition> targetTableDefinitions = [
..._i2.Protocol() is _i1.DatabaseSerializationManager
? (_i2.Protocol() as _i1.DatabaseSerializationManager)
final Set<_i2.SerializationManager> _hostProtocols = {};
static List<_i1.TableDefinition> get targetTableDefinitions => [
..._i3.Protocol() is _i1.DatabaseSerializationManager
? (_i3.Protocol() as _i1.DatabaseSerializationManager)
.getTargetTableDefinitions()
: [],
];
final Set<_i3.SerializationManager> _hostProtocols = {};
void registerHostProtocol(
String projectName,
_i3.SerializationManager protocol,
_i2.SerializationManager protocol,
) {
_hostProtocols.add(protocol);
_i2.Protocol().registerHostProtocol(projectName, protocol);
_i3.Protocol().registerHostProtocol(projectName, protocol);
}
static String? getClassNameFromObjectJson(dynamic data) {
@ -71,21 +71,21 @@ class Protocol extends _i1.DatabaseSerializationManager {
}
}
if (t == _i2.Hlc) {
return _i2.Hlc.fromJson(data) as T;
if (t == _i3.Hlc) {
return _i3.Hlc.fromJson(data) as T;
}
if (t == _i3.getType<_i2.Hlc?>()) {
return (data != null ? _i2.Hlc.fromJson(data) : null) as T;
if (t == _i2.getType<_i3.Hlc?>()) {
return (data != null ? _i3.Hlc.fromJson(data) : null) as T;
}
try {
return _i2.Protocol().deserialize<T>(data, t);
} on _i3.DeserializationTypeNotFoundException catch (_) {}
return _i3.Protocol().deserialize<T>(data, t);
} on _i2.DeserializationTypeNotFoundException catch (_) {}
return super.deserialize<T>(data, t);
}
static String? getClassNameForType(Type type) {
return switch (type) {
_i2.Hlc => 'Hlc',
_i3.Hlc => 'Hlc',
_ => null,
};
}
@ -103,10 +103,10 @@ class Protocol extends _i1.DatabaseSerializationManager {
}
switch (data) {
case _i2.Hlc():
case _i3.Hlc():
return 'Hlc';
}
className = _i2.Protocol().getClassNameForObject(data);
className = _i3.Protocol().getClassNameForObject(data);
if (className != null) return className;
return null;
}
@ -118,10 +118,10 @@ class Protocol extends _i1.DatabaseSerializationManager {
return super.deserializeByClassName(data);
}
if (dataClassName == 'Hlc') {
return deserialize<_i2.Hlc>(data['data']);
return deserialize<_i3.Hlc>(data['data']);
}
try {
return _i2.Protocol().deserializeByClassName(data);
return _i3.Protocol().deserializeByClassName(data);
} on FormatException catch (_) {}
return super.deserializeByClassName(data);
}
@ -144,8 +144,8 @@ class Protocol extends _i1.DatabaseSerializationManager {
'data': object,
};
return forProtocol
? _i3.SerializationManager.toEncodableForProtocol(wrapped)
: _i3.SerializationManager.toEncodable(wrapped);
? _i2.SerializationManager.toEncodableForProtocol(wrapped)
: _i2.SerializationManager.toEncodable(wrapped);
}
return super.dynamicFieldToJson(object, forProtocol: forProtocol);
}
@ -188,7 +188,7 @@ class Protocol extends _i1.DatabaseSerializationManager {
@override
_i1.Table? getTableForType(Type t) {
{
var protocol = _i2.Protocol();
var protocol = _i3.Protocol();
var table = protocol is _i1.DatabaseSerializationManager
? (protocol as _i1.DatabaseSerializationManager).getTableForType(t)
: null;

View file

@ -1,5 +1,5 @@
name: serverpod_offline_sync_client
version: 0.0.1
version: 0.0.2
description: Client transport adapter for the Serverpod Offline Sync project.
homepage: https://github.com/marcelomendoncasoares/serverpod_offline_sync
@ -9,9 +9,9 @@ environment:
resolution: workspace
dependencies:
serverpod_client: 4.0.0-beta.1
serverpod_database: 4.0.0-beta.1
serverpod_offline_sync: 0.0.1
serverpod_client: 4.0.0-beta.2
serverpod_database: 4.0.0-beta.2
serverpod_offline_sync: 0.0.2
dev_dependencies:
lints: '>=3.0.0 <7.0.0'

View file

@ -24,15 +24,15 @@ class Protocol extends _i1.DatabaseSerializationManager {
static final Protocol _instance = Protocol._();
static final List<_i2.TableDefinition> targetTableDefinitions = [
final Set<_i1.SerializationManager> _hostProtocols = {};
static List<_i2.TableDefinition> get targetTableDefinitions => [
..._i3.Protocol() is _i1.DatabaseSerializationManager
? (_i3.Protocol() as _i1.DatabaseSerializationManager)
.getTargetTableDefinitions()
: [],
];
final Set<_i1.SerializationManager> _hostProtocols = {};
void registerHostProtocol(
String projectName,
_i1.SerializationManager protocol,

View file

@ -1,5 +1,5 @@
name: serverpod_offline_sync_server
version: 0.0.1
version: 0.0.2
description: Server module for the Serverpod Offline Sync project.
homepage: https://github.com/marcelomendoncasoares/serverpod_offline_sync
@ -10,11 +10,11 @@ resolution: workspace
dependencies:
meta: ^1.16.0
serverpod: 4.0.0-beta.1
serverpod_database: 4.0.0-beta.1
serverpod_offline_sync: 0.0.1
serverpod: 4.0.0-beta.2
serverpod_database: 4.0.0-beta.2
serverpod_offline_sync: 0.0.2
dev_dependencies:
lints: '>=3.0.0 <7.0.0'
serverpod_test: 4.0.0-beta.1
serverpod_test: 4.0.0-beta.2
test: ^1.25.5

View file

@ -176,24 +176,22 @@ class _CrdtSyncEndpoint {
required _i4.Stream<_i5.CrdtSyncStreamEvent> changes,
required bool once,
}) {
var _localTestStreamManager =
_i1.TestStreamManager<_i5.CrdtSyncStreamEvent>();
var _localTestStreamManager = _i1.TestStreamManager<_i5.CrdtSyncStreamEvent>();
_i1.callStreamFunctionAndHandleExceptions(
() async {
var _localUniqueSession =
(sessionBuilder as _i1.InternalTestSessionBuilder).internalBuild(
var _localUniqueSession = (sessionBuilder as _i1.InternalTestSessionBuilder)
.internalBuild(
endpoint: 'crdtSync',
method: 'sync',
);
var _localCallContext = await _endpointDispatch
.getMethodStreamCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'crdtSync',
methodName: 'sync',
arguments: {'once': once},
requestedInputStreams: ['changes'],
serializationManager: _serializationManager,
);
var _localCallContext = await _endpointDispatch.getMethodStreamCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'crdtSync',
methodName: 'sync',
arguments: {'once': once},
requestedInputStreams: ['changes'],
serializationManager: _serializationManager,
);
await _localTestStreamManager.callStreamMethod(
_localCallContext,
_localUniqueSession,

View file

@ -14,64 +14,64 @@ workspace:
dev_dependencies:
melos: ^7.5.1
serverpod_cli: 4.0.0-beta.1
serverpod_cli: 4.0.0-beta.2
dependency_overrides:
serverpod:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_auth_core_client:
git:
url: https://github.com/serverpod/serverpod.git
path: modules/serverpod_auth/serverpod_auth_core/serverpod_auth_core_client
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_auth_core_server:
git:
url: https://github.com/serverpod/serverpod.git
path: modules/serverpod_auth/serverpod_auth_core/serverpod_auth_core_server
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_cli:
git:
url: https://github.com/serverpod/serverpod.git
path: tools/serverpod_cli
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_client:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_client
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_database:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_database
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_embedded_postgres:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_embedded_postgres
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_shared:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_shared
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_serialization:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_serialization
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_service_client:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_service_client
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
serverpod_test:
git:
url: https://github.com/serverpod/serverpod.git
path: packages/serverpod_test
ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# dependency_overrides:
# serverpod:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_auth_core_client:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: modules/serverpod_auth/serverpod_auth_core/serverpod_auth_core_client
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_auth_core_server:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: modules/serverpod_auth/serverpod_auth_core/serverpod_auth_core_server
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_cli:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: tools/serverpod_cli
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_client:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_client
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_database:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_database
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_embedded_postgres:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_embedded_postgres
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_shared:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_shared
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_serialization:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_serialization
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_service_client:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_service_client
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
# serverpod_test:
# git:
# url: https://github.com/serverpod/serverpod.git
# path: packages/serverpod_test
# ref: 062691764e38c53b0db05f24a4d07780c11bf0ba
melos:
packages:
@ -94,16 +94,6 @@ melos:
exec: dart analyze . --fatal-infos --fatal-warnings
fix:
exec: dart fix --apply
format:
run: |
git ls-files '*.dart' \
| grep -v '/lib/src/generated/' \
| grep -v '/lib/src/protocol/' \
| grep -v '/lib/migrations/' \
| grep -v '/serverpod_test_tools\.dart$' \
| grep -v '\.g\.dart$' \
| grep -v '\.drift\.dart$' \
| xargs -r dart format --output=none --set-exit-if-changed
generate:
# Must run the module first, or the test project won't have the tables.
run: |

Some files were not shown because too many files have changed in this diff Show more