Hooks/Middleware for Data Changes #94
Closed
MentalGear
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Thanks for the extensive write up! We already have a system of hooks internally that we use to do schema validation, indexing, rule enforcement, etc. We're just working on the system to expose this on the server and in the schema definition. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Request
Please consider adding data change hooks/middleware.
The docs do not currently mention any middleware/hooks to listen for data changes.
Use cases
Track Record / Accountability
Any kind of shared state requires traceability and explain-ability. End users need to know how data changed, e.g.
"Why has the data on this record item changed? The item was updated, but what was updated?"
If devs could listen to changes to add entries to a history dataset, so that end users can simply pull up a sidebar of recent changes in the UI, this would address the issue. (also any serious enterprise SAAS requires an audit log).
Custom data validation rules
It's often required to pass user data through additional specific validation steps (eg zod) before approving pushes.
Custom Conflict Resolution
Some scenarios, due to lo-fi's nature, may require specific custom merge handling. For ex: What do you do if a client after a long time comes back online but wants to overwrite more recent data entries. Maybe the application logic should be that the server rejects changes and invokes a UI for the client so that the user can check whether to still use his proposed offline changes or keep those more recent one that are stored already.
Prior work
rxdb does an excellent job of giving developers controllability through middleware.
Beta Was this translation helpful? Give feedback.
All reactions