Releases: mswjs/data
Releases · mswjs/data
v0.11.0
v0.10.2
v0.10.1
v0.10.0
v0.9.2
v0.9.1
v0.9.0
0.9.0 (2022-02-05)
Features
You can use these symbols to read or transform entities dynamically:
import { PRIMARY_KEY } from '@mswjs/data'
// This utility replaces the actual entity values
// with their primary key/values pairs for lazy evaluation later
// (custom logic from your client, if any).
function toLazyEntity(entity) {
const primaryKeyName = entity[PRIMARY_KEY]
return { [primaryKeyName]: entity[primaryKeyName] }
}
// Usage
db.users.findMany({}).map(toLazyEntity)
v0.8.4
v0.8.3
Features
- Adds runtime validation when updating a relationship (#175):
- Forbids updating a relationship to reference a different model.
- Forbids updating a relationship to a compatible plain object (the next value for a relationship must be an entity of the expected model).