chore: Bump version to 0.0.2 and update CHANGELOG (#111)
This commit is contained in:
parent
1ddfef2988
commit
c04bde5e6f
14 changed files with 177 additions and 238 deletions
|
|
@ -18,7 +18,7 @@ enum CrdtDataDeletedReason implements _i1.SerializableModel {
|
|||
userReinsert,
|
||||
userDelete,
|
||||
userCascadeDelete,
|
||||
uniqueLoser
|
||||
uniqueLoser,
|
||||
;
|
||||
|
||||
static CrdtDataDeletedReason fromJson(int index) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ enum CrdtDataRowVisibility implements _i1.SerializableModel {
|
|||
foreignKeyRestrictRestore,
|
||||
userDelete,
|
||||
userCascadeDelete,
|
||||
foreignKeyCascade
|
||||
foreignKeyCascade,
|
||||
;
|
||||
|
||||
static CrdtDataRowVisibility fromJson(int index) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ enum CrdtSyncViolationOperation implements _i1.SerializableModel {
|
|||
mergeDelete,
|
||||
outboundInsert,
|
||||
outboundUpdate,
|
||||
outboundDelete
|
||||
outboundDelete,
|
||||
;
|
||||
|
||||
static CrdtSyncViolationOperation fromJson(String name) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue