serverpod_offline_sync 1.0.0
serverpod_offline_sync: ^1.0.0 copied to clipboard
Shared package for the Serverpod Offline Sync project.
1.0.0 #
- feat: BREAKING. Changes
onMergeSuccessto receive oneOfflineSyncMergeEventper space and batch. - feat: BREAKING. Moves the server's
onMergeSuccessfromsession.offlineSync.synctopod.configureOfflineSync, called beforepod.start(). - feat: Supports
transactionForUserandtransactionForSpaceson the server'ssession.db, including inwithServerpodtests. - fix: Limits
includeHiddenRowsqueries and watches to the user's spaces. - fix: Reports client
onMergeSuccesserrors even after the server closes the sync stream. - fix: Repairs stale projections before the first typed watch or sync capture on a raw database session.
- fix: Serializes concurrent PostgreSQL schema repairs.
- fix: Rejects foreign keys between synced and non-synced application tables.
Non-synced tables can reference
offline_sync_spaces.id. - fix: Rejects sync when peers use different
onDelete=SetDefaultfallback UUIDs.
0.0.13 #
Important
This version is not compatible with earlier ones. Upgrade the server and all clients together, and start from empty client and server databases: data written by earlier versions doesn't sync after the upgrade.
- feat: BREAKING. Sends sync batches both ways over one stream, and each side acknowledges a batch after committing it.
- fix: BREAKING. Keeps progress as per-space revisions instead of HLCs, so synced rows are no longer re-uploaded and older changes relayed late are no longer skipped.
- feat: BREAKING. Passes the changed domain tables to the
onMergeSuccesscallback as a third argument. - feat: Wakes up sync streams on other processes on commit through Serverpod's message central when Redis is enabled, for a 2.3× speedup in cross-node wake-ups.
- feat: Adds opt-in sync timing events for benchmarking the package. Import
them through
package:serverpod_offline_sync/diagnostics.dart. - fix: Stops re-running unrelated SQLite
watchstreams when a write changes only sync metadata. - fix: Rolls back the unfinished merge and drops queued ones when a sync is cancelled.
- fix: Rebuilds stored projections once per database instead of once per session.
- perf: Merges new rows about 2× faster, unique conflicts 2.4× and foreign-key chains 3.8×, with up to 49× fewer queries.
- perf: Replaces polling for changes with a wake-up on commit, delivering writes to other devices 4× faster.
- perf: Batches outbound reads and PostgreSQL edits, making multi-row updates on the server 2.9× faster.
- perf: Holds fewer database connections while merges wait, by queueing merge requests in memory first. Database locks still act as a fallback.
- perf: Shares one recovery scan per database across idle streams instead of running one per sync stream.
- perf: Reduces memory consumption during continuous sync by releasing rows that were sent to the other peer.
- docs: Clarifies that
onDelete=Restrictis supported and is generated asNO ACTIONon synced tables. - chore: Requires Serverpod
^4.1.2.
0.0.12 #
- fix: BREAKING. Each user has their own clock per database, so users writing
in different spaces no longer wait on each other. Existing local clocks will
be reset with this change. Several interfaces have changed:
HlcManager.forSpaceis replaced byHlcManager(spaceId, node).mergeChangestakes the syncinguserIdseparately fromspaceId.recordSyncCheckpointtakesspaceIdinstead ofuserId.transactionForUserlocks the user's clock and the space for read and write.- Orders writes after facts other users committed to the same space.
- feat: Add
transactionForSpaces(userId, spaceIds, fn)and awaitedspaces.runForSpace(spaceId, fn)scopes for atomic local writes across declared spaces, using the acting user's clock. Nested failures roll back their domain, CRDT, and in-memory clock changes. - fix: Reject tracked reads and writes between multi-space scopes, including through persistent-user wrappers, and recheck membership within each scope.
- fix: Reload persistent-user clocks after caller savepoint rollbacks so concurrent commits cannot cause later writes to be skipped by sync.
- fix: Prevents a local
updateBatchfrom failing with no rows updated when it moves rows to a deleted parent that a restricting child still keeps visible. - perf: Keeps SQLite inserts batched when projected nulls and database defaults differ between rows.
- chore: Requires Serverpod
^4.1.0.
0.0.11 #
- feat: Supports Serverpod 4.1 typed SQLite
watchAPI with CRDT visibility and live space membership, including nested included lists. - fix: Preserves caller include graphs across queries and keep nested object visibility predicates inside their containing list query.
- chore: Requires Serverpod
^4.1.0-beta.3.
0.0.10 #
- fix: Prevents concurrent edits from being skipped during sync.
- fix: Prevents database operations on the web from hanging inside transactions.
- fix: Respects space access changes made in the same transaction.
- fix: Prevents sync from stalling after reconnects, including when the device clock moves backward.
- fix: Prevents previously synced data from being repeatedly resent after reconnects.
- fix: Rejects checkpoints attributed to the wrong node with
ArgumentError. - fix: Keeps unique-conflict results consistent across devices after updates and upserts.
- fix: Keeps foreign key defaults consistent across devices when an upsert supplies null, including after a previously referenced record is restored.
- perf: Improves performance when applying synced changes.
- perf: Improves conflict resolution performance.
- chore: Requires Serverpod
>=4.0.4 <4.1.0.
0.0.9 #
- fix: Refreshes node clocks across sync wrappers.
- fix: Repairs foreign keys on columns that also carry a unique claim.
- chore: Release the Serverpod dependency version to
^4.0.0.
0.0.8 #
- fix: BREAKING. Reject unique-text values ending in
__conflict__<UUID>,__hidden__<UUID>, or__park__<UUID>, and unique version-8 UUIDs (except primary keys, foreign keys, and nullable UUID columns). Local writes and incoming sync throwOfflineSyncReservedValueExceptionfor these values. - fix: Enforce database unique constraints on local writes and restores, and reject upsert batches that target the same record more than once.
- fix: Retain upserted values and explicit nulls when replacing a conflicting value, including upserts matched through another unique index.
- fix: Treat restored rows as fresh writes so field values and conflict ages stay consistent across sync and bootstrap.
- fix: Preserve UUID-shaped text and binary values during conflict resolution and sync, and encode restored values according to their column types.
- fix: Show UUIDs correctly in errors for references to deleted records.
0.0.7 #
- fix: Keep non-synced
updateRowcalls in the test harness transaction. - fix: Allow generated client sync sessions to close their SQLite connections.
- fix: Resolve shared-package models and enums during projection and sync.
- fix: Preserve boolean types when syncing SQLite column updates.
- fix: Preserve JSON and JSONB field types and values through inserts, updates, and explicit nulls.
0.0.6 #
- refactor: BREAKING. Rename integration APIs and ownership scopes:
- Rename
CrdtDatabase*wrappers toOfflineSyncDatabase*. - Rename
CrdtSynctoOfflineSyncEngineandCrdtSyncSessiontoOfflineSyncSubscription. - Access sync through
.offlineSyncand.offlineSyncDbinstead of.crdtand.crdtDb. - Replace
CrdtScope*models and services withOfflineSyncSpace* - Change access to shared spaces through
.spacesinstead of.scopes. - Use
spaceIdin models and indexes, andoffline_sync_spacesin ownership relations. - Initialize with
initializeOfflineSyncand useofflineSyncDatabaseInterceptor. - Import client helpers from
offline_sync.dartinstead ofcrdt.dart. - Rename the synchronization endpoint, serialized events, and space metadata tables.
- Rename
- fix: Recompute
onDelete=SetDefaultrepairs when default targets are inserted, deleted, restored, or hidden to preserve authored values. - fix: Reject local deletes atomically when a needed
SetDefaulttarget is missing, hidden, owned by another space, or deleted in the same batch. - fix: Preserve projection-selected nulls during inserts instead of reapplying column defaults, and apply fixed UUID foreign-key defaults in local upserts.
- fix: Resolve composite unique conflicts when only a fixed discriminator column changes.
- perf: Avoid redundant foreign-key projection for ordinary local writes and primary-key upserts, and batch dependency checks and field-clock writes.
- perf: Overlap independent membership reads and skip unnecessary space lookups for untracked tables.
- chore: Update Serverpod to
4.0.0and use the published CLI.
0.0.5 #
- fix: BREAKING. Rebuilds foreign key and unique projection from authored facts.
- perf: Increases unique-conflict merge throughput by ~40%.
- perf: Increases foreign-key chain insert merge throughput by ~3.3×.
- perf: Increases foreign-key chain delete merge throughput by ~44%.
- perf: Reduces storage used by CRDT metadata on relations.
- chore: Updated Serverpod to
4.0.0-rc.2.
0.0.4 #
- chore: Updated Serverpod to
4.0.0-rc.1.
0.0.3 #
- fix: Requires non-nullable foreign keys to be
deferred. - fix: Rejects
onDelete=Restricton synced tables in favor ofonDelete=NoAction. - fix: Throws proper
DatabaseExceptioninstead of bareExceptionon the database. - chore: Updated Serverpod to
4.0.0-rc.1.
0.0.2 #
- fix: Skips tracking FKs for relations with non-sync tables.
- fix: Fixes batch
insertof previously tombstoned rows not being tracked correctly. - refactor: Moves the core implementation to the
serverpod_offline_syncshared package. - chore: Updated Serverpod to
4.0.0-beta.2.
0.0.1 #
- chore: Initial version.