alasql 0.3.10 → 0.3.11

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/bin/alasql-cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  //
3
3
  // Command line interface for Alasql
4
- // Version: 0.2.2
4
+ // Version: 0.3.11
5
5
  // Date: 28.07.2015
6
6
  // (c) 2014-2015, Andrey Gershun & M. Rangel Wulff
7
7
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.3.9 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.3.11 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.3.9
4
+ @version 0.3.11
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v0.3.9 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.3.11 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  !function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.alasql=e()}(this,function(){function r(e,t,o){t=t||[],"function"==typeof t&&(scope=o,o=t,t=[]),"object"!=typeof t&&(t=[t]);var n=r.lastid++;r.buffer[n]=o,r.webworker.postMessage({id:n,sql:e,params:t})}if(r.options={},r.options.progress=function(){},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)},r.promise=function(){throw new Error("Please include a Promise/A+ library")},"undefined"!=typeof Promise){var e=function(e,t,o,n){return new Promise(function(s,i){r(e,t,function(e,t){t?i(t):(o&&n&&r.options.progress!==!1&&r.options.progress(o,n),s(e))})})},t=function(r){if(!(r.length<1)){for(var t,o,n,s=[],i=0;i<r.length;i++){if(t=r[i],"string"==typeof t&&(t=[t]),!isArray(t)||t.length<1||2<t.length)throw new Error("Error in .promise parameter");o=t[0],n=t[1]||void 0,s.push(e(o,n,i,r.length))}return Promise.all(s)}};r.promise=function(r,o){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return e(r,o);if(!isArray(r)||r.length<1||void 0!==o)throw new Error("Error in .promise parameters");return t(r)}}if(!(r=r||!1))throw new Error("alasql was not found");return r.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(r.worker=function(e,t,o){if(e===!0&&(e=void 0),void 0===e)for(var n=document.getElementsByTagName("script"),s=0;s<n.length;s++){if("alasql-worker.js"===n[s].src.substr(-16).toLowerCase()){e=n[s].src.substr(0,n[s].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===n[s].src.substr(-20).toLowerCase()){e=n[s].src.substr(0,n[s].src.length-20)+"alasql.min.js";break}if("alasql.js"===n[s].src.substr(-9).toLowerCase()){e=n[s].src;break}if("alasql.min.js"===n[s].src.substr(-13).toLowerCase()){e=n[s].src.substr(0,n[s].src.length-13)+"alasql.min.js";break}}if(void 0===e)throw new Error("Path to alasql.js is not specified");if(e!==!1){var i="importScripts('";i+=e,i+="');self.onmessage = function(event) {alasql(event.data.sql,event.data.params, function(data){postMessage({id:event.data.id, data:data});});}";var a=new Blob([i],{type:"text/plain"});if(r.webworker=new Worker(URL.createObjectURL(a)),r.webworker.onmessage=function(e){var t=e.data.id;r.buffer[t](e.data.data),delete r.buffer[t]},r.webworker.onerror=function(r){throw r},arguments.length>1){r("REQUIRE "+t.map(function(r){return'"'+r+'"'}).join(","),[],o)}}else if(e===!1)return void delete r.webworker}),r.lastid=0,r.buffer={},r.worker(),r});
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.3.9 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.3.11 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.3.9
4
+ @version 0.3.11
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -137,7 +137,7 @@ var alasql = function(sql, params, cb, scope) {
137
137
  Current version of alasql
138
138
  @constant {string}
139
139
  */
140
- alasql.version = '0.3.9';
140
+ alasql.version = '0.3.11';
141
141
 
142
142
  /**
143
143
  Debug flag
@@ -3980,11 +3980,11 @@ var cloneDeep = utils.cloneDeep = function cloneDeep(obj) {
3980
3980
  return new Date(obj);
3981
3981
  }
3982
3982
 
3983
- var temp = obj.constructor(); // changed
3983
+ var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
3984
3984
 
3985
3985
  for(var key in obj) {
3986
3986
  if(obj.hasOwnProperty(key)) {
3987
- temp[key] = cloneDeep(obj[key]);
3987
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(temp, key, {value: cloneDeep(obj[key]), writable: true, enumerable: true, configurable: true}); } else { temp[key] = cloneDeep(obj[key]); }
3988
3988
  }
3989
3989
  }
3990
3990
  return temp;
@@ -4053,7 +4053,7 @@ var extend = utils.extend = function extend (a,b){
4053
4053
  a = a || {};
4054
4054
  for(var key in b) {
4055
4055
  if(b.hasOwnProperty(key)) {
4056
- a[key] = b[key];
4056
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(a, key, {value: b[key], writable: true, enumerable: true, configurable: true}); } else { a[key] = b[key]; }
4057
4057
  }
4058
4058
  }
4059
4059
  return a;
@@ -8284,7 +8284,7 @@ yy.Select.prototype.compileGroup = function(query) {
8284
8284
  var aft = '', aft2='';
8285
8285
 
8286
8286
  if(typeof query.groupStar !== 'undefined') {
8287
- aft2 += 'for(var f in p[\''+query.groupStar+'\']) {g[f]=p[\''+query.groupStar+'\'][f];};';
8287
+ aft2 += 'for(var f in p[\''+query.groupStar+'\']) {if(/^__proto__$/.test(f))Object.defineProperty(g,f,{writable:true,enumerable:true,configurable:true});g[f]=p[\''+query.groupStar+'\'][f];};';
8288
8288
  };
8289
8289
 
8290
8290
  /*
@@ -8497,7 +8497,7 @@ function compileSelectStar (query, alias, joinstar) {
8497
8497
  } else {
8498
8498
 
8499
8499
  // if column not exists, then copy all
8500
- sp += 'var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';
8500
+ sp += 'var w=p["'+alias+'"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
8501
8501
 
8502
8502
  query.dirtyColumns = true;
8503
8503
  }
@@ -8764,7 +8764,7 @@ yy.Select.prototype.compileSelectGroup1 = function(query) {
8764
8764
 
8765
8765
  if(col instanceof yy.Column && col.columnid === '*') {
8766
8766
 
8767
- s += 'for(var k in g) {r[k]=g[k]};';
8767
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
8768
8768
  return '';
8769
8769
 
8770
8770
  } else {
@@ -11501,7 +11501,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
11501
11501
  // Do UPDATE!!!
11502
11502
 
11503
11503
  table.update(function(t){
11504
- for(var f in r) t[f] = r[f];
11504
+ for(var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
11505
11505
  },table.data.indexOf(toreplace),params);
11506
11506
  } else {
11507
11507
  table.data.push(r);
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.3.9 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.3.11 | © 2014-2016 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.3.9
4
+ @version 0.3.11
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -137,7 +137,7 @@ var alasql = function(sql, params, cb, scope) {
137
137
  Current version of alasql
138
138
  @constant {string}
139
139
  */
140
- alasql.version = '0.3.9';
140
+ alasql.version = '0.3.11';
141
141
 
142
142
  /**
143
143
  Debug flag
@@ -3980,11 +3980,11 @@ var cloneDeep = utils.cloneDeep = function cloneDeep(obj) {
3980
3980
  return new Date(obj);
3981
3981
  }
3982
3982
 
3983
- var temp = obj.constructor(); // changed
3983
+ var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
3984
3984
 
3985
3985
  for(var key in obj) {
3986
3986
  if(obj.hasOwnProperty(key)) {
3987
- temp[key] = cloneDeep(obj[key]);
3987
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(temp, key, {value: cloneDeep(obj[key]), writable: true, enumerable: true, configurable: true}); } else { temp[key] = cloneDeep(obj[key]); }
3988
3988
  }
3989
3989
  }
3990
3990
  return temp;
@@ -4053,7 +4053,7 @@ var extend = utils.extend = function extend (a,b){
4053
4053
  a = a || {};
4054
4054
  for(var key in b) {
4055
4055
  if(b.hasOwnProperty(key)) {
4056
- a[key] = b[key];
4056
+ /* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(a, key, {value: b[key], writable: true, enumerable: true, configurable: true}); } else { a[key] = b[key]; }
4057
4057
  }
4058
4058
  }
4059
4059
  return a;
@@ -8284,7 +8284,7 @@ yy.Select.prototype.compileGroup = function(query) {
8284
8284
  var aft = '', aft2='';
8285
8285
 
8286
8286
  if(typeof query.groupStar !== 'undefined') {
8287
- aft2 += 'for(var f in p[\''+query.groupStar+'\']) {g[f]=p[\''+query.groupStar+'\'][f];};';
8287
+ aft2 += 'for(var f in p[\''+query.groupStar+'\']) {if(/^__proto__$/.test(f))Object.defineProperty(g,f,{writable:true,enumerable:true,configurable:true});g[f]=p[\''+query.groupStar+'\'][f];};';
8288
8288
  };
8289
8289
 
8290
8290
  /*
@@ -8497,7 +8497,7 @@ function compileSelectStar (query, alias, joinstar) {
8497
8497
  } else {
8498
8498
 
8499
8499
  // if column not exists, then copy all
8500
- sp += 'var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';
8500
+ sp += 'var w=p["'+alias+'"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
8501
8501
 
8502
8502
  query.dirtyColumns = true;
8503
8503
  }
@@ -8764,7 +8764,7 @@ yy.Select.prototype.compileSelectGroup1 = function(query) {
8764
8764
 
8765
8765
  if(col instanceof yy.Column && col.columnid === '*') {
8766
8766
 
8767
- s += 'for(var k in g) {r[k]=g[k]};';
8767
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
8768
8768
  return '';
8769
8769
 
8770
8770
  } else {
@@ -11501,7 +11501,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
11501
11501
  // Do UPDATE!!!
11502
11502
 
11503
11503
  table.update(function(t){
11504
- for(var f in r) t[f] = r[f];
11504
+ for(var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
11505
11505
  },table.data.indexOf(toreplace),params);
11506
11506
  } else {
11507
11507
  table.data.push(r);