Release 1.5.0
New
- custom types
ArrayOfandOneOffor schemas
const exampleSchema = new Schema<Prop>('example', {
id: new SchemaValue(OneOf(String, Number)), // define multiple type options for value
options: new SchemaValue(ArrayOf(String)), // specify what type of array it is
}, false)- Allow to override the data via
beforeChangereturn forCREATED,UPDATED, andLOADEDevents
const unsub = todoStore.beforeChange(async (eventType, data) => {
switch (eventType) {
case ClientStore.EventType.CREATED:
return await todoService.createTodo(data); // <- return the data
case ClientStore.EventType.UPDATED:
return await todoService.updateTodo(data.id, data); // <- return the data
case ClientStore.EventType.LOADED:
return await todoService.getAllByIds(data.map(m => m.id)); // <- return the data
default:
};
return true; // required to flag the store that the action should continue
});Fixes
LOADEDwas not broadcasted when the list provided was empty.- Schema was removing explicitly defined values which looked like default values when
includeDefaultKeyswas set to false - All classes where being set directly in window. Now they are available under
CWSobject on the client
What's Changed
- Develop by @ECorreia45 in #5
- #6 additional custom types by @ECorreia45 in #8
- #9 allow override via beforeChange by @ECorreia45 in #10
- #11 by @ECorreia45 in #12
Full Changelog: 1.4.5...1.5.0