-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Improvement] Better locks and Sync (#33)
Improved locks and sync process
- Loading branch information
1 parent
4120df7
commit c665b3f
Showing
16 changed files
with
181 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'@journeyapps/powersync-sdk-common': major | ||
--- | ||
|
||
- Bump version out of Beta | ||
- The SyncStatus now includes the state of if the connector is uploading or downloading data. | ||
- Crud uploads are now debounced. | ||
- Crud uploads now are also triggered on `execute` method calls. | ||
- Database name is now added to the `DBAdapter` interface for better identification in locks (for Web SDK) | ||
- Failed crud uploads now correctly throw errors, to be caught upstream, and delayed for retry. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@journeyapps/powersync-sdk-react-native': major | ||
'@journeyapps/powersync-react': major | ||
'@journeyapps/powersync-attachments': major | ||
--- | ||
|
||
Release out of beta to production ready |
Submodule supabase-todolist
updated
from e6a1d0 to 95a999
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
# Beta | ||
This package is currently in a beta release. | ||
|
||
|
||
# PowerSync SDK common JS | ||
|
||
This package contains pure TypeScript common functionality for the PowerSync SDK. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/powersync-sdk-common/src/client/AbstractPowerSyncOpenFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,42 @@ | ||
import _ from 'lodash'; | ||
|
||
export type SyncDataFlowStatus = Partial<{ | ||
downloading: boolean; | ||
uploading: boolean; | ||
}>; | ||
|
||
export type SyncStatusOptions = { | ||
connected?: boolean; | ||
dataFlow?: SyncDataFlowStatus; | ||
lastSyncedAt?: Date; | ||
}; | ||
|
||
export class SyncStatus { | ||
constructor(public connected: boolean, public lastSyncedAt: Date) {} | ||
constructor(protected options: SyncStatusOptions) {} | ||
|
||
get connected() { | ||
return this.options.connected ?? false; | ||
} | ||
|
||
get lastSyncedAt() { | ||
return this.options.lastSyncedAt; | ||
} | ||
|
||
get dataFlowStatus() { | ||
return ( | ||
this.options.dataFlow ?? { | ||
downloading: false, | ||
uploading: false | ||
} | ||
); | ||
} | ||
|
||
isEqual(status: SyncStatus) { | ||
return _.isEqual(this.options, status.options); | ||
} | ||
|
||
getMessage() { | ||
return `SyncStatus<connected: ${this.connected} lastSyncedAt: ${this.lastSyncedAt}>`; | ||
const { dataFlow } = this.options; | ||
return `SyncStatus<connected: ${this.connected} lastSyncedAt: ${this.lastSyncedAt}. Downloading: ${dataFlow.downloading}. Uploading: ${dataFlow.uploading}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.