earthstar-project / earthstar

Storage for private, distributed, offline-first applications.
https://earthstar-project.org
GNU Lesser General Public License v3.0
633 stars 20 forks source link

Implement participatingAuthor query in sqlite #40

Open cinnamon-bun opened 4 years ago

cinnamon-bun commented 4 years ago

This query field is implemented in the memory Storage, but not sqlite.

The different ways of querying by author are subtle, we need a diagram :)

types.ts:

    // If including history, find paths where the author ever wrote, and return all history for those paths by anyone
    // If not including history, find paths where the author ever wrote, and return the latest doc (maybe not by the author)
    participatingAuthor?: AuthorAddress,

    //// If including history, find paths with the given last-author, and return all history for those paths
    //// If not including history, find paths with the given last-author, and return just the last doc
    //lastAuthor?: AuthorAddress,

    // If including history, it's any revision by this author (heads and non-heads)
    // If not including history, it's any revision by this author which is a head
    versionsByAuthor?: AuthorAddress,

Also enable the tests at https://github.com/earthstar-project/earthstar/blob/master/src/test/storage.test.ts#L602-L607

cinnamon-bun commented 4 years ago

These queries are confusing. Some examples are here: https://github.com/earthstar-project/earthstar-graphql/pull/10#issuecomment-668818070