alasql 0.5.11 → 0.5.12

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.5.11
4
+ // Version: 0.5.12
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.5.11 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.5.12 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.5.11
4
+ @version 0.5.12
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v0.5.11 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.5.12 | © 2014-2018 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 a(r,e,t){"function"==typeof(e=e||[])&&(scope=t,t=e,e=[]),"object"!=typeof e&&(e=[e]);var o=a.lastid++;a.buffer[o]=t,a.webworker.postMessage({id:o,sql:r,params:e})}if(a.options={},a.options.progress=function(){},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)},a.promise=function(){throw new Error("Please include a Promise/A+ library")},"undefined"!=typeof Promise){function i(r,e,n,s){return new Promise(function(t,o){a(r,e,function(r,e){e?o(e):(n&&s&&!1!==a.options.progress&&a.options.progress(n,s),t(r))})})}a.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return i(r,e);if(!isArray(r)||r.length<1||void 0!==e)throw new Error("Error in .promise parameters");return function(r){if(!(r.length<1)){for(var e,t,o,n=[],s=0;s<r.length;s++){if("string"==typeof(e=r[s])&&(e=[e]),!isArray(e)||e.length<1||2<e.length)throw new Error("Error in .promise parameter");t=e[0],o=e[1]||void 0,n.push(i(t,o,s,r.length))}return Promise.all(n)}}(r)}}if(!(a=a||!1))throw new Error("alasql was not found");return a.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(a.worker=function(r,e,t){if(!0===r&&(r=void 0),void 0===r)for(var o=document.getElementsByTagName("script"),n=0;n<o.length;n++){if("alasql-worker.js"===o[n].src.substr(-16).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===o[n].src.substr(-20).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-20)+"alasql.min.js";break}if("alasql.js"===o[n].src.substr(-9).toLowerCase()){r=o[n].src;break}if("alasql.min.js"===o[n].src.substr(-13).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-13)+"alasql.min.js";break}}if(void 0===r)throw new Error("Path to alasql.js is not specified");if(!1!==r){var s="importScripts('";s+=r,s+="');self.onmessage = function(event) {alasql(event.data.sql,event.data.params, function(data){postMessage({id:event.data.id, data:data});});}";var i=new Blob([s],{type:"text/plain"});if(a.webworker=new Worker(URL.createObjectURL(i)),a.webworker.onmessage=function(r){var e=r.data.id;a.buffer[e](r.data.data),delete a.buffer[e]},a.webworker.onerror=function(r){throw r},1<arguments.length)a("REQUIRE "+e.map(function(r){return'"'+r+'"'}).join(","),[],t)}else if(!1===r)return void delete a.webworker}),a.lastid=0,a.buffer={},a.worker(),a});
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.5.11 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.5.12 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.5.11
4
+ @version 0.5.12
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
142
142
  Current version of alasql
143
143
  @constant {string}
144
144
  */
145
- alasql.version = '0.5.11';
145
+ alasql.version = '0.5.12';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -2483,7 +2483,7 @@ next:function () {
2483
2483
 
2484
2484
  // return next match that has a token
2485
2485
  lex:function lex() {
2486
- var r = this.next();
2486
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2487
2487
  if (r) {
2488
2488
  return r;
2489
2489
  } else {
@@ -6963,7 +6963,7 @@ function queryfn3(query) {
6963
6963
 
6964
6964
  // Prepare variables
6965
6965
  query.data = [];
6966
- query.xgroups = {};
6966
+ query.xgroups=Object.create(null);
6967
6967
  query.groups = [];
6968
6968
 
6969
6969
  // Level of Joins
@@ -15746,19 +15746,19 @@ yy.SetVariable.prototype.execute = function(databaseid, params, cb) {
15746
15746
  }
15747
15747
  if (this.props && this.props.length > 0) {
15748
15748
  if (this.method == '@') {
15749
- var fs = "alasql.vars['" + this.variable + "']";
15749
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15750
15750
  } else {
15751
- var fs = "params['" + this.variable + "']";
15751
+ var fs = "params[k('"+this.variable+"')]";
15752
15752
  }
15753
15753
  fs += this.props
15754
15754
  .map(function(prop) {
15755
15755
  if (typeof prop == 'string') {
15756
- return "['" + prop + "']";
15756
+ return "[k('"+prop+"')]";
15757
15757
  } else if (typeof prop == 'number') {
15758
15758
  return '[' + prop + ']';
15759
15759
  } else {
15760
15760
 
15761
- return '[' + prop.toJS() + ']';
15761
+ return "[k("+prop.toJS()+")]";
15762
15762
  // } else {
15763
15763
 
15764
15764
  // throw new Error('Wrong SET property');
@@ -15766,7 +15766,7 @@ yy.SetVariable.prototype.execute = function(databaseid, params, cb) {
15766
15766
  })
15767
15767
  .join();
15768
15768
 
15769
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15769
+ new Function('value,params,alasql', 'var y;var k=function(x){if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(x+" is not allowed");return x};'+fs+'=value')(res, params, alasql);
15770
15770
  } else {
15771
15771
  if (this.method == '@') {
15772
15772
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.5.11 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.5.12 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.5.11
4
+ @version 0.5.12
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
142
142
  Current version of alasql
143
143
  @constant {string}
144
144
  */
145
- alasql.version = '0.5.11';
145
+ alasql.version = '0.5.12';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -2483,7 +2483,7 @@ next:function () {
2483
2483
 
2484
2484
  // return next match that has a token
2485
2485
  lex:function lex() {
2486
- var r = this.next();
2486
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2487
2487
  if (r) {
2488
2488
  return r;
2489
2489
  } else {
@@ -6958,7 +6958,7 @@ function queryfn3(query) {
6958
6958
 
6959
6959
  // Prepare variables
6960
6960
  query.data = [];
6961
- query.xgroups = {};
6961
+ query.xgroups=Object.create(null);
6962
6962
  query.groups = [];
6963
6963
 
6964
6964
  // Level of Joins
@@ -15741,19 +15741,19 @@ yy.SetVariable.prototype.execute = function(databaseid, params, cb) {
15741
15741
  }
15742
15742
  if (this.props && this.props.length > 0) {
15743
15743
  if (this.method == '@') {
15744
- var fs = "alasql.vars['" + this.variable + "']";
15744
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15745
15745
  } else {
15746
- var fs = "params['" + this.variable + "']";
15746
+ var fs = "params[k('"+this.variable+"')]";
15747
15747
  }
15748
15748
  fs += this.props
15749
15749
  .map(function(prop) {
15750
15750
  if (typeof prop == 'string') {
15751
- return "['" + prop + "']";
15751
+ return "[k('"+prop+"')]";
15752
15752
  } else if (typeof prop == 'number') {
15753
15753
  return '[' + prop + ']';
15754
15754
  } else {
15755
15755
 
15756
- return '[' + prop.toJS() + ']';
15756
+ return "[k("+prop.toJS()+")]";
15757
15757
  // } else {
15758
15758
 
15759
15759
  // throw new Error('Wrong SET property');
@@ -15761,7 +15761,7 @@ yy.SetVariable.prototype.execute = function(databaseid, params, cb) {
15761
15761
  })
15762
15762
  .join();
15763
15763
 
15764
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15764
+ new Function('value,params,alasql', 'var y;var k=function(x){if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(x+" is not allowed");return x};'+fs+'=value')(res, params, alasql);
15765
15765
  } else {
15766
15766
  if (this.method == '@') {
15767
15767
  alasql.vars[this.variable] = res;