Differences between Total.js v4 and Total.js v5.


What is new in Total.js v5?

Only shorter, cleaner and improved code. Finally, the repository contains much nicer code. It’s fully optimised for Node >18.

Should I update the Total.js v4 apps?

No. We started testing Total.js v5. You can develop upcoming projects with Total.js v5. For stability reasons, wait before converting older apps to Total.js v5.

Is the Total.js v5 stable?

Almost, but still something… We are working on unit-tests, documentation, etc..

How can I determine Total.js v5 in the code?

console.log(F.is5);
// true or undefined

Schemas

NEWSCHEMA('Users', function(schema) {

	// schema.define() is not supported

	schema.action('save', {
		name: 'Save ',
		params: '*id:String',
		input: '*name:String',
		action: function($, model) {
			// do something
		}
	});

});

// It's the same like this:
NEWACTION('Users/save', {
	name: 'Name of action',
	params: '*id:String',
	input: '*name:String',
	action: function($, model) {
			// do something
	}
});

// !!! IMPORTANT:

// OLD:
DATA.find('tbl_user').callback($.callback);

// NEW:
DATA.find('tbl_user').callback($);

// OLD:
$.success(true, VALUE);

// NEW:
$.success(VALUE);

Linking schemas:

NEWSCHEMA('@Users', '*name:String,*email:Email');
// NEWSCHEMA('Users', '*name:String,*email:Email'); --> it's the same like above declaration

NEWACTION('Users/create', {
	name: 'Create',
	input: '@Users',
	action: function($, model) {
		// Do something
	}
});

NEWACTION('Users/update', {
	name: 'Update',
	input: '@Users',
	action: function($, model) {
		// Do something
	}
});

Partial data:

NEWACTION('Users/save', {
	name: 'Name of action',
	input: '*name:String,*email:Email',
	partial: true, // the same like HTTP PATCH method 
	action: function($, model) {
			// do something
	}
});