fritz2 v0.7 Release Notes

Release Date: 2020-08-13 // over 3 years ago
  • ๐Ÿ’ฅ breaking changes

    ๐Ÿš€ This release contains changes that break code written with earlier versions:

    • ๐Ÿšš Handlers are now suspendable, so you can call suspend-methods directly inside your Handler. There is no need for Applicator anymore. Therefore this class and it's utility-functions have been removed. (PR#124 & PR#126)
    • ๐Ÿ“ฆ FormateStore and interface Format have been removed. Use format-factory-function inside lenses package to create a formatting Lens and create a normal SubStore (by using sub). (PR#139 & PR#146)

      val df: DateFormat = DateFormat("yyyy-MM-dd")// converts a Date into String in vice versaval dateFormat = format( parse = { df.parseDate(it) }, format = { df.format(it) } )//using the dateLensval birthday = personStore.sub(L.Person.birthday + dateFormat)// orval birthday = personStore.sub(L.Person.birthday).sub(dateFormat)

    • ๐Ÿ”จ Validation has been extracted as a service and refactored to be more concise. (PR#149 & #157)

    in commonMain

    data class Message(val id: String, val status: Status, val text: String) : ValidationMessage { override fun isError(): Boolean = status \> Status.Valid // renamed from failed() -\> isError()}object PersonValidator : Validator\<Person, Message, String\>() { // return your validation messages hereoverride fun validate(data: Person, metadata: String): List\<Message\> { ... } }
    

    in jsMain

    val personStore = object : RootStore\<Person\>(Person()) { // only update when it's validval addOrUpdate = handle\<Person\> { oldPerson, newPerson -\>if (PersonValidator.isValid(newPerson, "update")) new else oldPerson } } ...// then render the validation message list in your htmlPersonValidator.msgs.render { msg -\> ... }.bind()
    

    in jvmMain

    if (PersonValidator.isValid(newPerson , "add")) { //e.g. save your new Person to Database ... } else { // get the messages, only available after isValid() was calledval msgs = PersonValidator.msgs ... }
    

    ๐Ÿ†• new features

    • โž• added tracking-service to access process state of Handlers (e.g. to show process indicator). (PR#147)
    • โž• added history-service to keep track of historical values in Stores and provide back() function. (PR#152)
    • โž• added Repository to offer CRUD-functionality for entities and dealing with queries. Implementations are available for REST and LocalStorage (see example). (PR#141, PR#144, PR#155 & PR#153)
    • โž• added storeOf() function to create a minimal RootStore (without Handlers) (PR#144)
    • โž• added convenience-funtion render on Seq, so you can directly write each(...).render { ... } (and leave out map) (PR#142)
    • โž• added convenience-funtion render on Flow, so you can directly write flow.render { ... } (and leave out map) (PR#154)
    • โž• added functions to deal with errors in Handlers (PR#137)
    • snapshots are now provided on oss.jfrog.org (PR#128)
    • โž• added append function to remote (PR#127)
    • ๐Ÿ”„ changed IdProvider to generic type (PR#123)
    • โœ… use Inspector (created by inspect()-function) to navigate through your model in validation and test and have data and corresponding ids available at any point (PR#118)

    ๐Ÿ›  fixed bugs

    • โž• added isValid on JVM (PR#135)
    • โž• added missing factories for <dt> and <dd> (PR#134)
    • โž• added missing SelectedAttribteDelegate (PR#131)
    • ๐Ÿ›  fixed some bugs in Router and minor API changes (PR#151)