Give DB adapter access to agent `custom` property
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 456
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 5
Description
In some situations, it makes sense to have database adapters that can read connection properties.
For example, if you have a database adapter that's talking to a remote API, and the API handles read / write permissions, it would make sense to have each ShareDB connection speak to the API on behalf of the user using that ShareDB connection, instead of managing permissions in two different places.
Right now, you can hack this together with middleware and op metadata for submitting ops, but it's impossible to get the information you need to run getOps and getSnapshot differently depending on the connection properties.
There might be a more generic way to solve this. It might make even more sense for database methods to have per-request properties, instead of just per-connection. But this seemed like the simplest -- it seems like everything that uses .db has access to the agent, and agent.custom seems like the right place to store this kind of information.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the database adapter entry points for getOps and getSnapshot, then inspect how those methods access the agent and its custom property. Compare that flow with the existing middleware and op-metadata approach described in the issue. Done means settling on an API that lets adapter reads vary by connection or request properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100