Adding an Adapter
To add a new Adapter is very simple, you just need to implement a new Adapter
class that contains methods to pull/push data to the synchronization server.
You can refer to an existing adapter at adapter/turso/index.ts
- this is the adapter implementation for the Turso database.
Note: Any adapter needs to have synchronization configuration like server URL, secret key, etc., which should be passed through the constructor
.
Inside the adapter, there are simple functions like pullFolders
/pushFolders
, pullNotes
/pushNotes
, pullSettings
/pushSettings
.
The pull
functions take a parameter lastSync
that represents the last synchronization time. Their task is to return the data from after lastSync
to update new data into the application.
The push
functions are responsible for pushing data to the server, and the server should persist the data to serve future pull
requests from other clients.