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?
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 usingjsonpatch.applyPatch
, or we could even just lazily compute the after state when we actually need them?