BETA
My accountGet started
Dec 072018
Total.js Platform

New release: Total.js v3.1

I have released a new version of Total.js with bug fixes and with small improvements.

New release: Total.js v3.1

This version brings bug fixes and some improvements. You can upgrade your current version of Total.js framework from NPM via $ npm install total.js. I recommend to update Total.js now!

Updated default config keys

This is very important change in this version. I have replaced all keys with - chars to keys with _ chars. This change saves a lot of code and personally I think that the performance is may be better. For example:

Big differences in the code:

I don't know what the compiler really makes, but in the most cases (in different JS engines) can the compiler evaluates ['mail-smtp'] as a string which can affect CPU and memory consumption (maybe). Don't worry about backward compatibility because Total.js solves older keys without any problem and you will be notified about all older keys in app log. Backward compatibility will be removed in Total.js v4.

Config supports a simple encryption of values

New version of Total.js supports a very simple encryption of config values. You can encrypt/encode values via base64 or hex. So now you can encode credentials, secrets or SMTP credentials.

Extended bundles

This version can extend .js, .css and .html files. If you don't want to rewrite the entire content of some file and you want to extend a file for example script then you can use /path/path/--name_of_file.js:

  • a content of --ui.js will be added into the /themes/admin/ui.js at the end of file
  • the file won't be overwritten

External bundles

This version of Total.js supports external bundles which can be downloaded from URL address. Implementation is very easy, just create plain-text file /bundles/cms.url with this content:

.bundlesignore

Total.js v3.1 supports .bundlesignore file with a similiar syntax as .gitignore file.

Extended routing

Code less, do more. The framework automatically pair a dynamic value as Total.js Schema and it's case insensitive. So you can merge multiple routes into the one. If the schema doesn't exist then the framework responds with 404.

CSS variables support a default value

This was a missing feature. It's very helpful for e.g. Total.js CMS. Declaration is similar like or operator in JavaScript:

Extended NoSQL storage

NoSQL storage is a good choice for storing data from IoT sensors. NoSQL storage creates a new NoSQL database every day. And this version of Total.js extends NoSQL storage by adding three new methods:

  • .find(beg, end, [threads])
  • .count(beg, end, [threads])
  • .scalar(beg, end, type, field, [threads])

This methods return NoSQL DatabaseBuilder. The big benefit is that Total.js can read NoSQL storage with multiple threads, so you can traverse all data / million documents very effective outside of main thread:

New method: U.reader()

Is a special feature for streaming and filtering data. It uses NoSQL reader filter engine which is optimized for the best performance. U.reader() can be combined with e.g. U.streamer(). It can be used in Total.js Flow.

Cookies support SameSite attribute

TaskBuilder

TaskBuilder can create simple async tasks.

  • supports great features
  • supports error handling
  • supports similar features like Schemas or Operations
  • Documentation

Usage in Schemas/Operations/Controllers:

Improved OPERATIONS

This version brings better features for Total.js OPERATIONS. Operations are something like Schema methods - operation/workflow/transform but they aren't have any declared schema, they are schemaless.

Operations chaining

This is a new powerful feature which can run multiple operations in a row:

Additional features:

Routing

Now are operations part of routing, example:

Logger for Schemas and Operations

I have added a logger for measuring time of Schemas and Operations. It can be used only for better debugging of Total.js applications.

Example of output:

Multiple HTTP methods in the routing

Tip from Tema Smirnov. Now you can defined a multiple HTTP methods directly in URL argument. IMPORATNT: between methods can't be any empty space.

Improvements

String.slug()

I have improved String.slug() for UTF characters for Chinese/Japan/Arabic/etc. languages. It creates a hash from String. For example:

NoSQL reader

I have improved NOSQL/TABLE reader. I separated filtering engine to independent class and now the class is used for NOSQL / TABLE and NOSQL STORAGE. Of course, engine can be used for streaming data with new utils called U.reader().

UID generator

This version brings a more secured UID() results, Total.js changes ending hash each minute. Now you can use UID results in URL address directly as an argument.

CORS

I have implemented a new config key default-cors which can contain hostnames as origin. It's very helpful for the last restricting of CORS() method. And from now the CORS supports internal caching, so evaluating is a bit faster.

/config:

Many thanks to M.Sc. Jens Mueller / Security Researcher for the alert.

Components

Now the framework uses scripts/styles according the group of components, so scripts/styles won't be rendered into the common file. I have enabled caching for components in debug mode (previous versions use caching in release mode only).

New global aliases

New global aliases can improve readability of the code in your Total.js application. Here is a simple comparison:

CONF vs F.config:

FUNC vs F.functions:

CACHE vs F.cache:

Good to know

Total.js framework doesn't processed Total.js files (controllers, definitions, schemas, etc) if the file ends with -bk.js or starts with . dot.

Fixes

  • a critical bug with storing uploaded files via httpfile.fs() or httpfile.nosql()
  • a critical bug with JavaScript minificator
  • a critical bug with rendering of multiple async components
  • a critical bug with NoSQL counter and freezing app
  • a critical bug with GZIP compression (sometimes appeared in Safari)
  • nosql.update() and nosql.modify() methods if the first argument is a function
  • F.wait() in the test mode
  • LOCALIZE() didn't work for nested directories
  • error handling when WebSocketClient is connecting (for example, if the request is unauthorized)
  • versions with auto value and with enabled F.wait()
  • LOAD('release') a release mode
  • SchemaInstance.$clean() for nested schemas
  • extracting bundles
  • subdomain routing for localhost
  • a service for cleaning NoSQL embedded databases
  • async rendering of components in Total.js View Engine
  • RESTBuilder cache works only if the response status is 200
  • compressing CSS with \t tabs
  • controller.autoclear()

Road to v4

Total.js v4 will remove all older declaration from Schemas, Operations and some internal funcionallity. I have created a lot of projects and I learned a lot, so the core won't be changed.

Happy coding!