share/ShareJS — pull request #265 by geigerzaehler (2013-10-18 13:06:11+00:00)
Title: Middleware refactor

These commits move the backend and filtering logic of `UserAgent` to `ShareInstance` and extend the middleware framework.

The `ShareInstance` API consists of a single method `process(action, request, callback)`, which responds to requests with a through a middleware stack. Each action has its own stack. The livedb methods like `fetch`, `query`, `submit` are all handled by the middleware. `UserAgent` is basically a facade for the very general `process` method.

* Improves separation of concerns. All the logic for filtering is in a separate file the is mixed into the `ShareInstance`
* The middleware stack becomes more flexible. It may even allow for multiple backends to be used.
* `UserAgent` becomes ignorant of `backend`.

**Todo**

- [ ] Middleware to emulate bulkSubscribe
- [ ] Documentation on writing middleware