title: Using @ngrx/data, how can you form JSON patch documents from updates to entities on a custom data service?
body: <p>My use case of @ngrx/data requires that I build custom entity data services by extending <code>DefaultDataService&lt;T&gt;</code>. The API I am working with accepts JSON patch documents for updates. <code>EntityCollectionDataService&lt;T&gt;</code> defines the following function for updates:</p>
  <pre><code>update(update: Update&lt;T&gt;): Observable&lt;T&gt;;
  </code></pre>
  <p>Where <code>Update&lt;T&gt;</code> has the member <code>changes</code> which is of type <code>Partial&lt;T&gt;</code>. The issue I am facing here is that I am not able to form a JSON patch document with only a slice of the changed fields of the entity. I would need both the unchanged and changed state of the entity.</p>
  <p>The only solution I can see here would be to access the <code>EntityChangeTracker</code> through the <code>EntityCollectionService</code> for my entity, I'm just a bit confused about how to use the change tracker, as it's just an observable stream of changes through the EntityCollectionService's <code>changeState$</code> field.</p>
  <p>Is there a simpler way I'm not seeing here? I also thought to just access the store and pull the current state of the entity, but I'd prefer to use optimistic concurrency, so the store has already changed by the time the <code>DefaultDataService</code> I am writing is called through a side effect for the update.</p>