RecordsDiff
See source codeTable of contents
A diff describing the changes to records, containing collections of records that were added, updated, or removed. This is the fundamental data structure used throughout the store system to track and communicate changes.
interface RecordsDiff<R extends UnknownRecord> {}
Example
const diff: RecordsDiff<Book> = {
added: {
'book:1': { id: 'book:1', typeName: 'book', title: 'New Book' },
},
updated: {
'book:2': [
{ id: 'book:2', typeName: 'book', title: 'Old Title' }, // from
{ id: 'book:2', typeName: 'book', title: 'New Title' }, // to
],
},
removed: {
'book:3': { id: 'book:3', typeName: 'book', title: 'Deleted Book' },
},
}
Properties
added
Records that were created, keyed by their ID
added: Record<IdOf<R>, R>
removed
Records that were deleted, keyed by their ID
removed: Record<IdOf<R>, R>
updated
Records that were modified, keyed by their ID. Each entry contains [from, to] tuple
updated: Record<IdOf<R>, [from: R, to: R]>
Prev
MigrationSequenceNext
SerializedSchemaV1