total5 0.0.6-6 → 0.0.6-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/builders.js CHANGED
@@ -1328,9 +1328,11 @@ ActionCaller.prototype.exec = function() {
1328
1328
  }
1329
1329
  };
1330
1330
 
1331
- if (action.user && !$.user) {
1332
- $.invalid(401);
1333
- return;
1331
+ if (action.user != null) {
1332
+ if ((action.user && !$.user) || (!action.user && $.user)) {
1333
+ $.invalid(401);
1334
+ return;
1335
+ }
1334
1336
  }
1335
1337
 
1336
1338
  if (action.sa) {
package/changelog.txt CHANGED
@@ -28,6 +28,9 @@
28
28
  - fixed parsing unpair XML elements in the `HTMLParser`
29
29
  - improved Markdown parser
30
30
  - added a test functionality for testing Flow components
31
+ - added `F.extend(prototype, name, fn)` for extending Total.js prototypes
32
+ - fixed assigning the `name` field in FlowStream
33
+ - fixed prerendering UI after manual using `Flow.add()` method
31
34
 
32
35
  ========================
33
36
  0.0.5
@@ -502,8 +502,13 @@ Instance.prototype.add = function(id, body, callback) {
502
502
  if (callback)
503
503
  CALLBACKS[callbackid] = { id: self.flow.id, callback: callback };
504
504
  self.flow.postMessage2({ TYPE: 'stream/add', id: id, data: body, callbackid: callbackid });
505
- } else
506
- self.flow.add(id, body, callback, ASFILES);
505
+ } else {
506
+ self.flow.add(id, body, function(err) {
507
+ callback && callback(err);
508
+ self.flow.redraw();
509
+ self.flow.save();
510
+ }, ASFILES);
511
+ }
507
512
  return self;
508
513
  };
509
514
 
@@ -1006,6 +1011,7 @@ function init_current(meta, callback, nested) {
1006
1011
  }
1007
1012
  }
1008
1013
 
1014
+ flow.name = meta.name || meta.id;
1009
1015
  flow.env = meta.env;
1010
1016
  flow.origin = meta.origin;
1011
1017
  flow.proxypath = meta.proxypath || '';
@@ -1221,6 +1227,7 @@ function init_current(meta, callback, nested) {
1221
1227
  msg.error = err ? err.toString() : null;
1222
1228
  if (msg.callbackid !== -1)
1223
1229
  Parent.postMessage(msg);
1230
+ flow.redraw();
1224
1231
  flow.save();
1225
1232
  }, ASFILES);
1226
1233
  break;
@@ -1607,6 +1614,7 @@ function init_worker(meta, type, callback) {
1607
1614
  break;
1608
1615
 
1609
1616
  case 'stream/save':
1617
+ worker.$schema.name = msg.data.name;
1610
1618
  worker.$schema.components = msg.data.components;
1611
1619
  worker.$schema.design = msg.data.design;
1612
1620
  worker.$schema.variables = msg.data.variables;
@@ -2707,6 +2715,7 @@ function MAKEFLOWSTREAM(meta) {
2707
2715
 
2708
2716
  flow.proxy.refreshmeta = function() {
2709
2717
 
2718
+ flow.name = flow.$schema.name || flow.$schema.id;
2710
2719
  flow.origin = flow.$schema.origin;
2711
2720
  flow.proxypath = flow.$schema.proxypath || '';
2712
2721
 
package/flow-test.js CHANGED
@@ -76,7 +76,8 @@ exports.load = function(name, source, config, init) {
76
76
  };
77
77
 
78
78
  Test.trigger = function(data) {
79
- Flow.test.component.trigger(data);
79
+ var instances = Test.flow.flow.meta.flow;
80
+ instances.component.trigger && instances.component.trigger(data);
80
81
  };
81
82
 
82
83
  Test.reconfigure = function(value) {
package/flowstream.js CHANGED
@@ -2061,4 +2061,7 @@ exports.create = function(id, errorhandler) {
2061
2061
  let flowstream = new FlowStream(id, errorhandler);
2062
2062
  F.flowstreams[id] = flowstream;
2063
2063
  return flowstream;
2064
- };
2064
+ };
2065
+
2066
+ exports.Message = Message;
2067
+ exports.FlowStream = FlowStream.prototype;
package/http.js CHANGED
@@ -4,8 +4,6 @@
4
4
 
5
5
  'use strict';
6
6
 
7
- const TController = require('./controller');
8
-
9
7
  exports.listen = function(req, res) {
10
8
 
11
9
  // req.ip
@@ -29,7 +27,7 @@ exports.listen = function(req, res) {
29
27
  return;
30
28
  }
31
29
 
32
- var ctrl = new TController.Controller(req, res);
30
+ var ctrl = new F.TController.Controller(req, res);
33
31
 
34
32
  if (F.paused.length) {
35
33
  ctrl.fallback(999);
package/index.js CHANGED
@@ -2397,6 +2397,59 @@ F.backup = function(filename, files, callback, filter) {
2397
2397
  });
2398
2398
  };
2399
2399
 
2400
+ F.extend = function(proto, name, fn) {
2401
+
2402
+ let target = null;
2403
+
2404
+ switch(proto.toLowerCase().replace(/\-\_\s/g, '')) {
2405
+ case '$':
2406
+ case 'options':
2407
+ target = F.TBuilders.Options;
2408
+ break;
2409
+ case 'error':
2410
+ case 'errorbuilder':
2411
+ target = F.TBuilders.ErrorBuilder;
2412
+ break;
2413
+ case 'controller':
2414
+ target = [F.TController.Controller, F.TWebSocket.Controller];
2415
+ break;
2416
+ case 'flowstream':
2417
+ target = F.TFlowStream.FlowStream;
2418
+ break;
2419
+ case 'mail':
2420
+ case 'email':
2421
+ target = F.TMail.Message;
2422
+ break;
2423
+ case 'restbuilder':
2424
+ target = F.TBuilders.RESTBuilder;
2425
+ break;
2426
+ case 'message':
2427
+ case 'flowstreammessage':
2428
+ target = F.TFlowStream.Message;
2429
+ break;
2430
+ case 'view':
2431
+ case 'viewengine':
2432
+ target = F.TViewEngine.View;
2433
+ break;
2434
+ case 'querybuilder':
2435
+ target = T.TQueryBuilder.QueryBuilder;
2436
+ break;
2437
+ case 'database':
2438
+ target = T.TQueryBuilder.Controller;
2439
+ break;
2440
+ }
2441
+
2442
+ if (target) {
2443
+ if (target instanceof Array) {
2444
+ for (let m of target)
2445
+ m.prototype[name] = fn;
2446
+ } else
2447
+ target.prototype[name] = fn;
2448
+ return true;
2449
+ }
2450
+
2451
+ };
2452
+
2400
2453
  F.restart = function() {
2401
2454
  process.send && process.send('total:restart');
2402
2455
  };
@@ -2748,6 +2801,7 @@ process.on('message', function(msg, h) {
2748
2801
  F.TUtils = require('./utils');
2749
2802
  F.TRouting = require('./routing');
2750
2803
  F.TBuilders = require('./builders');
2804
+ F.TController = require('./controller');
2751
2805
  F.TViewEngine = require('./viewengine');
2752
2806
  F.TMinificators = require('./minificators');
2753
2807
  F.TWebSocket = require('./websocket');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total5",
3
- "version": "0.0.6-6",
3
+ "version": "0.0.6-8",
4
4
  "description": "Total.js framework v5",
5
5
  "main": "index.js",
6
6
  "directories": {
package/websocket.js CHANGED
@@ -1960,4 +1960,6 @@ exports.createclient = function(callback) {
1960
1960
  var client = new WebSocketClient();
1961
1961
  callback && callback(client);
1962
1962
  return client;
1963
- };
1963
+ };
1964
+
1965
+ exports.Controller = Controller;