Skip to content

v2.7.0

Latest

Choose a tag to compare

@danivek danivek released this 23 Jul 08:05

Features

  • Add serializeRelationshipData(type, data, schema?, extraData?) to serialize a relationship endpoint (e.g. GET /articles/1/relationships/tags) as resource identifier objects only ({ type, id }), per the JSON:API spec. Closes #97.
    (fe4a943, #136)
  • Add a data option on relationships: an optional function to transform a relationship's value before serialization (e.g. to unwrap a nested { total, data } shape). (b73f927, #115)
  • Add TypeScript type definitions (index.d.ts), covering the public API — register, serialize(Async), deserialize(Async), serializeError. Closes #60. (444d06a)
  • Support both CommonJS and ESM consumers — adds index.mjs as the ESM entry point alongside an exports map, so import resolves to ESM while require keeps resolving to CJS. (ebfe12b)