jsharmony 1.26.3 → 1.26.5

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/AppSrv.DB.js CHANGED
@@ -569,7 +569,11 @@ exports.ExecTasks = function (req, res, dbtasks, trans, callback, options) {
569
569
  function(dbtrans, callback, transtbl){ ... }
570
570
  */
571
571
  var _this = this;
572
- if (_.isEmpty(dbtasks)) { res.end(JSON.stringify({ '_success': 1, '_stats': {} })); return; }
572
+ if (_.isEmpty(dbtasks)) {
573
+ res.type('json');
574
+ res.end(JSON.stringify({ '_success': 1, '_stats': {} }));
575
+ return;
576
+ }
573
577
 
574
578
  //Split off post-processing
575
579
  var posttasks = [];
@@ -608,6 +612,7 @@ exports.ExecTasks = function (req, res, dbtasks, trans, callback, options) {
608
612
  posttask(postcallback, rslt);
609
613
  }, function (err) {
610
614
  if (err != null) { _this.AppDBError(req, res, err); return; }
615
+ res.type('json');
611
616
  res.send(JSON.stringify(rslt));
612
617
  if (typeof callback != 'undefined') callback();
613
618
  });
package/AppSrv.File.js CHANGED
@@ -74,7 +74,10 @@ exports.Upload = function (req, res) {
74
74
  else {
75
75
  rslt = { '_success': 1, 'file_size': file_size, 'file_token': file_token, 'file_orig_name': file_orig_name, 'file_extension': file_ext };
76
76
  if (req.jsproxyid) return res.end(Helper.js_proxy(req, rslt));
77
- else return res.end(JSON.stringify(rslt));
77
+ else{
78
+ res.type('json');
79
+ return res.end(JSON.stringify(rslt));
80
+ }
78
81
  }
79
82
  });
80
83
  });
@@ -144,6 +147,7 @@ exports.ClearUpload = function (req, res) {
144
147
  if (!('_DBContext' in req) || (req._DBContext == '') || (req._DBContext == null)) { return Helper.GenError(req, res, -30, 'Invalid file upload request.'); }
145
148
  var user_folder = jsh.Config.datadir + 'temp/' + req._DBContext + '/';
146
149
  HelperFS.clearFiles(user_folder, -1, -1, function (err) {
150
+ res.type('json');
147
151
  res.end(JSON.stringify({ '_success': 1 }));
148
152
  });
149
153
  };
package/AppSrv.Queue.js CHANGED
@@ -29,6 +29,7 @@ exports.GetToken = function (req, res) {
29
29
  if (!req.jshsite.auth.getToken) { return Helper.GenError(req, res, -99999, 'Token generation not defined'); }
30
30
  req.jshsite.auth.getToken(this, req, function (rslt, err) {
31
31
  if (err) { return Helper.GenError(req, res, -99999, err); }
32
+ res.type('json');
32
33
  res.end(JSON.stringify(rslt));
33
34
  });
34
35
  };
@@ -67,7 +68,10 @@ exports.PopQueue = function (req, res, next, queueid) {
67
68
  if (!_.isEmpty(verrors)) { return Helper.GenError(req, res, -2, verrors[''].join('\n')); }
68
69
 
69
70
  if (!Helper.hasModelAction(req, queue, 'D')) { return Helper.GenError(req, res, -11, 'Invalid Access'); }
70
- this.JobProc.PopQueue(req, res, queueid, P, function () { res.end(JSON.stringify({ '_success': 1 })); });
71
+ this.JobProc.PopQueue(req, res, queueid, P, function () {
72
+ res.type('json');
73
+ res.end(JSON.stringify({ '_success': 1 }));
74
+ });
71
75
  };
72
76
 
73
77
  exports.SendQueue = function (queueid, message) {
package/AppSrvModel.js CHANGED
@@ -117,11 +117,13 @@ AppSrvModel.prototype.GetModel = function (req, res, fullmodelid) {
117
117
  helpurl_onclick: '',
118
118
  ejs: rslt
119
119
  });
120
+ res.type('json');
120
121
  res.end(JSON.stringify(model));
121
122
  } });
122
123
  return;
123
124
  }
124
125
  else {
126
+ res.type('json');
125
127
  res.end(JSON.stringify(rslt));
126
128
  }
127
129
  } });
package/AppSrvRpt.js CHANGED
@@ -911,6 +911,7 @@ AppSrvRpt.prototype.runReportJob = function (req, res, fullmodelid, Q, P, onComp
911
911
  if (err != null) { thisapp.AppDBError(req, res, err, stats); return; }
912
912
  else rslt = { '_success': _.size(jobtasks) };
913
913
  rslt['_stats'] = Helper.FormatStats(req, stats);
914
+ res.type('json');
914
915
  res.send(JSON.stringify(rslt));
915
916
  });
916
917
  }
@@ -521,7 +521,10 @@ exports = module.exports = function(jsh){
521
521
  var field = this.Fields[id];
522
522
  if (!field) return false;
523
523
  var oldval = this[id];
524
- oldval = jsh.XFormat.Decode(field.format, oldval);
524
+ if ('format' in field) {
525
+ var oldval_fmt = jsh.XFormat.Apply(field.format, oldval);
526
+ oldval = jsh.XFormat.Decode(field.format, oldval_fmt);
527
+ }
525
528
  var newval = this.GetValue(field);
526
529
  if(!XExtXModel.StringEquals(oldval, newval)){
527
530
  if(jsh && jsh._debug){
@@ -738,7 +738,7 @@ exports.ParseSQLObjects = function(){
738
738
  obj.tables = resolvedTables;
739
739
 
740
740
  //Resolve Dependencies
741
- if(obj.dependencies) for(var i=0;i<obj.dependencies.length;i++){
741
+ if(obj.dependencies) for(let i=0;i<obj.dependencies.length;i++){
742
742
  let depName = obj.dependencies[i];
743
743
  if(module.schema && ((depName.indexOf('.')<0))){
744
744
  obj.dependencies[i] = module.schema + '.' + depName;
@@ -750,7 +750,7 @@ exports.ParseSQLObjects = function(){
750
750
  let tbl = obj.tables[tblname];
751
751
  let resolvedTable = tbl.table ? tbl.table : tblname;
752
752
  obj._tables[resolvedTable] = resolvedTable;
753
- if(tbl.columns) for(var i=0;i<tbl.columns.length;i++){
753
+ if(tbl.columns) for(let i=0;i<tbl.columns.length;i++){
754
754
  var col = tbl.columns[i];
755
755
  if(_.isString(col)) tbl.columns[i] = col = { name: col };
756
756
  }
package/lib/Helper.js CHANGED
@@ -139,6 +139,7 @@ exports.GenError = function(req,res,num,txt,options){
139
139
  if ('jsproxyid' in req) { res.end(this.js_proxy_raw(req, JSON.stringify(erslt))); return erslt; }
140
140
  if ('jsonpcallback' in req.query) { res.end(this.jsonp(req, erslt)); return erslt; }
141
141
  res.status(500);
142
+ res.type('json');
142
143
  res.end(JSON.stringify(erslt));
143
144
  return erslt;
144
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsharmony",
3
- "version": "1.26.3",
3
+ "version": "1.26.5",
4
4
  "description": "Rapid Application Development (RAD) Platform for Node.js Database Application Development",
5
5
  "main": "index.js",
6
6
  "scripts": {