alasql 0.6.8 → 0.6.9

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.6.8
4
+ // Version: 0.6.9
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.6.8 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.6.9 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.6.8
4
+ @version 0.6.9
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v0.6.8 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.6.9 | © 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 i(r,e,t){"function"==typeof(e=e||[])&&(scope=t,t=e,e=[]),"object"!=typeof e&&(e=[e]);var o=i.lastid++;i.buffer[o]=t,i.webworker.postMessage({id:o,sql:r,params:e})}var s;if(i.options={},i.options.progress=function(){},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)},i.promise=function(){throw new Error("Please include a Promise/A+ library")},"undefined"!=typeof Promise&&(s=function(r,e,n,s){return new Promise(function(t,o){i(r,e,function(r,e){e?o(e):(n&&s&&!1!==i.options.progress&&i.options.progress(n,s),t(r))})})},i.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return s(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=0;n<r.length;n++){if("string"==typeof(t=r[n])&&(t=[t]),!isArray(t)||t.length<1||2<t.length)throw new Error("Error in .promise parameter");e=t[0],t=t[1]||void 0,o.push(s(e,t,n,r.length))}return Promise.all(o)}}(r)}),!(i=i||!1))throw new Error("alasql was not found");return i.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(i.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");var s;!1!==r?(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});});}",s=new Blob([s],{type:"text/plain"}),i.webworker=new Worker(URL.createObjectURL(s)),i.webworker.onmessage=function(r){var e=r.data.id;i.buffer[e](r.data.data),delete i.buffer[e]},i.webworker.onerror=function(r){throw r},1<arguments.length&&i("REQUIRE "+e.map(function(r){return'"'+r+'"'}).join(","),[],t)):!1===r&&delete i.webworker}),i.lastid=0,i.buffer={},i.worker(),i});
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.6.8 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.6.9 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.6.8
4
+ @version 0.6.9
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.6.8';
145
+ alasql.version = '0.6.9';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -2492,7 +2492,7 @@ next:function () {
2492
2492
 
2493
2493
  // return next match that has a token
2494
2494
  lex:function lex () {
2495
- var r = this.next();
2495
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2496
2496
  if (r) {
2497
2497
  return r;
2498
2498
  } else {
@@ -6940,7 +6940,7 @@ function queryfn3(query) {
6940
6940
 
6941
6941
  // Prepare variables
6942
6942
  query.data = [];
6943
- query.xgroups = {};
6943
+ query.xgroups=Object.create(null);
6944
6944
  query.groups = [];
6945
6945
 
6946
6946
  // Level of Joins
@@ -15637,19 +15637,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15637
15637
  }
15638
15638
  if (this.props && this.props.length > 0) {
15639
15639
  if (this.method == '@') {
15640
- var fs = "alasql.vars['" + this.variable + "']";
15640
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15641
15641
  } else {
15642
- var fs = "params['" + this.variable + "']";
15642
+ var fs = "params[k('"+this.variable+"')]";
15643
15643
  }
15644
15644
  fs += this.props
15645
15645
  .map(function (prop) {
15646
15646
  if (typeof prop == 'string') {
15647
- return "['" + prop + "']";
15647
+ return "[k('"+prop+"')]";
15648
15648
  } else if (typeof prop == 'number') {
15649
15649
  return '[' + prop + ']';
15650
15650
  } else {
15651
15651
 
15652
- return '[' + prop.toJS() + ']';
15652
+ return "[k("+prop.toJS()+")]";
15653
15653
  // } else {
15654
15654
 
15655
15655
  // throw new Error('Wrong SET property');
@@ -15657,7 +15657,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15657
15657
  })
15658
15658
  .join();
15659
15659
 
15660
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15660
+ 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);
15661
15661
  } else {
15662
15662
  if (this.method == '@') {
15663
15663
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v0.6.8 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v0.6.9 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 0.6.8
4
+ @version 0.6.9
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.6.8';
145
+ alasql.version = '0.6.9';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -2492,7 +2492,7 @@ next:function () {
2492
2492
 
2493
2493
  // return next match that has a token
2494
2494
  lex:function lex () {
2495
- var r = this.next();
2495
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2496
2496
  if (r) {
2497
2497
  return r;
2498
2498
  } else {
@@ -6935,7 +6935,7 @@ function queryfn3(query) {
6935
6935
 
6936
6936
  // Prepare variables
6937
6937
  query.data = [];
6938
- query.xgroups = {};
6938
+ query.xgroups=Object.create(null);
6939
6939
  query.groups = [];
6940
6940
 
6941
6941
  // Level of Joins
@@ -15632,19 +15632,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15632
15632
  }
15633
15633
  if (this.props && this.props.length > 0) {
15634
15634
  if (this.method == '@') {
15635
- var fs = "alasql.vars['" + this.variable + "']";
15635
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15636
15636
  } else {
15637
- var fs = "params['" + this.variable + "']";
15637
+ var fs = "params[k('"+this.variable+"')]";
15638
15638
  }
15639
15639
  fs += this.props
15640
15640
  .map(function (prop) {
15641
15641
  if (typeof prop == 'string') {
15642
- return "['" + prop + "']";
15642
+ return "[k('"+prop+"')]";
15643
15643
  } else if (typeof prop == 'number') {
15644
15644
  return '[' + prop + ']';
15645
15645
  } else {
15646
15646
 
15647
- return '[' + prop.toJS() + ']';
15647
+ return "[k("+prop.toJS()+")]";
15648
15648
  // } else {
15649
15649
 
15650
15650
  // throw new Error('Wrong SET property');
@@ -15652,7 +15652,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15652
15652
  })
15653
15653
  .join();
15654
15654
 
15655
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15655
+ 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);
15656
15656
  } else {
15657
15657
  if (this.method == '@') {
15658
15658
  alasql.vars[this.variable] = res;