Coder Social home page Coder Social logo

textileio / js-threaddb Goto Github PK

View Code? Open in Web Editor NEW
14.0 7.0 1.0 1.54 MB

This project has been moved to https://github.com/textileio/js-textile

Home Page: https://github.com/textileio/js-textile

License: MIT License

JavaScript 1.03% TypeScript 98.97%
threads ipfs p2p-network database local-first textile

js-threaddb's Introduction

js-threaddb's People

Contributors

carsonfarmer avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

js-threaddb's Issues

Should we persist either the auth or the public key

This could make it easier for consumers to access past access tokens, and potentially let's us do smarter caching of things like user identities locally. Caching identities locally is useful, because it reduces the likelihood that someone will create a bunch of random identities during testing etc.

Add support for write/read validators/filters

This is a new feature of go-threads, it is potentially awesome for thread-db users. In theory, this feature is pretty easy to support, though we should think carefully about how to expose it in the APIs we have here... perhaps we shouldn't?

After state in changes middleware should be optimized

There are some suggestions in comments that should be explored. For example, we could just use undefined[] for deletes, and req.values for add/put if not we aren't waiting for auto-incrementing indexes to come back from IndexedDB (which, maybe we don't need to worry about because we're always using ulids?). If that is the case, then we can just always compute the :after: state using jsonpatch.applyPatch, or we could even just lazily compute the after state when we actually need them?

Cleaner access to threads-client

Right now, we abstract away access to the remote daemon via threads-client, which is great. Ideally, this library shouldn't require that as a dependency at all eventually. In the mean time, however, we need a cleaner way to actually create a threads-client and apply the right gRPC metadata. This is related to #2.

Fix up these messy types in Document + Collection

There is some pretty complex type-system things going on in these two classes to support direct manipulation of instances and then calling things like save, delete, etc. The main issue is that these are generic interfaces that contain generic interfaces, which is messy. This should be possible to cleanup, so that we get proper type inference without all those scary "as" directives.

Versions in IndexedDB are annoying for us.

Is there a way to abstract versions away by using the hash of the indexes or something? I tried this before, but we'd need strictly increasing version numbers, which doesn't really work with hashing. Some auto-incrementing version system would be useful.

Better error reporting to mask out dexie stuff

Since we're wrapping Dexie, we should avoid passing Dexie errors out to the callers, and prefer to catch common errors and throw those ourselves. The same goes for gRPC errors and common errors from our remote calls. These should each have their own specified Error in the right module here. For example, in remote, we have an Errors type that contains our expected remote errors (and one generic one). We should do a similar thing for local db errors, and throw those. This makes it easier for the caller to catch specific errors, rather than inspecting their messages etc.

Track "head" of remote updates

We need some way to know if our local state is in sync with the remote state. A nice way to do this is to simply track the latest "head" of the remote that we know about. Something like the hash of latest remote thread record. This isn't yet exposed in any nice way on the go side, so this ticket would require some updates over there as well. Otherwise, we have to query the remote thread to find out which instances we're missing/have to push.

Integrate with existing Hub connectors

Right now, this lib works with a remote go-threads daemon as long as you are able to explicitly provide the right credentials. For local development and running against a pure go-threads daemon (not the Hub), this is pretty simple, you just need an authentication token (which we have APIs and clients for). But to work against the Hub, this will be cumbersome, so we need to update the gRPC calls to utilize our existing infrastructure/connectors.

cc @andrewxhill for this one.

Create docs and publish them

We should try to find a simple, canonical way to build the docs, and then deploy them here for now, until we are ready to move to the main docs pages for textile "things".

Full text search

Hi @carsonfarmer / Textile team,

I was just playing with this database in a browser locally and trying to figure out how I would do text search. Unless I'm missing it in the docs, I don't see any operators in the dexie-mongoify library that supports text search (i.e. the $text operator).

I ask partly because if this is a feature that is lacking, I might try my hand at contributing. I have a one-off document search mechanism in my project (using Dexie) that I could use as reference. I plan to ditch my existing solution for js-threaddb when it's ready, so I thought I might try to contribute if there is somewhere I can be helpful.

EDIT: here's the full-text search example from the Dexie repo that I used. It searches all words in a string, but only using "starts with". So you can't search for a string in the middle of a word, and it definitely doesn't have any "fuzzy search" capabilities. I'm going to keep looking around for a good full-text search solution. I'll probably pursue making a PR to add the $text operator to dexie-mongoify.

EDIT 2: I also found ydn-db-fulltext from searching around. Please let me know if you have any other leads on existing solutions for the fulltext search in IndexedDB problem :-).

Add "watch" API to remote object

This is for more real-time applications that are online. It would use the clients listen API. It should support auto-reconnecting.

Support deleteRange for track changes

Right now, we assume that a local db operation that deletes a whole range of instances is just a local operation, so should not be replicated to the remote. This might not be the case, as the caller might really want to clear our a bunch of instances. Should we allow this? If yes, we'll have to come up with a clean way to push a range deletion to the remote.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.