earthstar-project / earthstar-graphql

Query, sync and set data to earthstar workspaces using GraphQL.
GNU Affero General Public License v3.0
6 stars 1 forks source link

Add `syncGraphQL` export #5

Closed sgwilym closed 3 years ago

sgwilym commented 3 years ago

Add a function with the following signature to this package's exports:

syncGraphQL(storage: IStorage, graphqlUrl: string)

This would kick off a predefined GraphQL query to the provided GraphQL endpoint which would retrieve all the documents of the provided's IStorage's address. The function would then use the response from the GraphQL endpoint to pass documents along to ingestDocument.

It would also need to push all the documents from IStorage to the GraphQL endpoint. This would probably need a new push mutation intended for pushing many documents at a time.


For now this would be an inefficient sync like the base earthstar package has, but once the schema adds support for document filtering we can begin to open up efficient syncing methods.