Significant update UB@5.18

We are pleased to announce a significant product update - UB@5.18

What's new (briefly):

  • metadata transformation hook: allow to modify metadata (*.meta) before Domain in created
  •  metadata localization files can be placed in model sub-folder (or even moved into separate model)
  •  recursive metadata merging: in case several descendant model contains entity with the same name all of them will be merged in the single meta file

Metadata transformation hook

In case _hookMetadataTransformation.js file exists in the root of the model folder it's export
 will be applied to Domain JSON before Domain is created.

Such hooks allow to apply any modifications to metadata (*.meta), for example

  •  adds a new attributes into entities
  •  modify existed attributes
  •  adds new mixins or change existed mixins properties
  •  etc.

 See example in  Autotest app TST model

Metadata localization files in model sub-folder

Before this version all *.meta localization files (*.meta.lang) should be located in the same folder as *.meta file. In case of big model it's uncomfortable - too many files in the same folder obscures important.

Now localization files can be placed in model sub-folder (we recommend to name such folders meta_locale as we did for @unitybase/* models).

In fact localization files can be even moved into his own model. For example for adding a new `zl` localization new model can be created and all `*.meta.zl` files can be placed where.

Recursive entity metadata merging

In case several descendant model contains entity with the same name all of them will be merged in the single meta file (in order they occures in models).

Before this version only last model metafile is merged with original metafile.


Other improvements

  •  dataStore.getAsJsObject() and dataStore.getAsJsArray() methods - direct serialization of TubDataStore into JS Object

 without using JSON.parse. This is 20% faster compared to JSON.parse(dataStore.asJSONObject)

For better performance and code readability we recommend to apply following changes to the applications sources:  
  - JSON.parse(dataStore.asJSONObject) -> dataStore.getAsJsObject()
  - JSON.parse(dataStore.asJSONArray) -> dataStore.getAsJsArray()
(the easiest way if to search for all case sensitive occurrences of `asJSON`)


  • Hmac algorithms support in build-in crypto module

const crypto = require('crypto');
crypto.createHmac('sha256', 'mysecret')

this allow to works with  JsonWebTokens directly form UB. For example jsonwebtoken npm package  works as expected.

OpenSSL 1.1 should be installed on Linux, for Windows build we include openSSL1.1 in UB server setup

 For full list of changes see CHANGELOG files in UB srever and models folders.