Documentation / @warp-drive/utilities / json-api / serializePatch
Function: serializePatch()
ts
function serializePatch(cache, identifier): object;
Defined in: utilities/src/-private/json-api/serialize.ts:126
Serializes changes to a resource for use with PATCH requests.
Only attributes which are changed are serialized. Only relationships which are changed are serialized.
Collection relationships serialize the collection as a whole.
If you would like to serialize updates to a collection more granularly (for instance, as operations) request the diff from the store and serialize as desired:
ts
const relationshipDiffMap = cache.changedRelationships(identifier);
Parameters
cache
identifier
Returns
object
An object with a data
property containing the serialized resource patch
data
ts
data: JsonApiResourcePatch;