Skip to content

v0.9.0

Choose a tag to compare

@github-actions github-actions released this 05 Feb 11:31
· 103 commits to main since this release
d32f154

0.9.0 (2022-02-05)

Features

  • exports "PRIMARY_KEY" and "ENTITY_TYPE" symbols (#191) (d32f154)

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)