Breaking changes
- Relational properties can no longer be updated using compatible plain objects (#130). Always use an entity reference when updating a relational property.
const db = factory({
user: {
id: primaryKey(String),
country: oneOf('country'),
},
country: {
code: primaryKey(String),
},
})
db.user.update({
where: {
id: { equals: 'user-1' }
},
data: {
// Always provide a reference
// to an existing entity.
country: db.country.create({
code: 'us'
})
}
})
Features
- Model definition now supports nested objects and arrays (#113).
const db = factory({
user: {
id: primaryKey(String),
address: {
billing: {
street: String,
phoneNumbers: [],
country: oneOf('country'),
},
},
},
})
- Supports updating relational properties (#126).
Bug fixes
- Fixes an issue that prevented an update of a property if it wasn't specified when the entity was created (#130).
- Fixes an issue that broke the querying by an entity's property if that property has no value (#130).
db.user.create({ id: 'abc-123' })
// The following query would throw.
db.user.findFirst({ where: { anotherProperty: { equals: 'value' } } })
- Fixes an issue that would throw an exception when validating a unique relational value if that value is currently assigned to the entity that's being operated on (must exclude the current entity from the validation query) (#130).