alasql 1.7.6 → 1.7.7

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: 1.7.6
4
+ // Version: 1.7.7
5
5
  // Date: 28.07.2015
6
6
  // (c) 2014-2015, Andrey Gershun & M. Rangel Wulff
7
7
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v1.7.6 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v1.7.7 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 1.7.6
4
+ @version 1.7.7
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v1.7.6 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v1.7.7 | © 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(void 0===(r=!0===r?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 v1.7.6 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v1.7.7 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 1.7.6
4
+ @version 1.7.7
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 = '1.7.6';
145
+ alasql.version = '1.7.7';
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 {
@@ -6955,7 +6955,7 @@ function queryfn3(query) {
6955
6955
 
6956
6956
  // Prepare variables
6957
6957
  query.data = [];
6958
- query.xgroups = {};
6958
+ query.xgroups=Object.create(null);
6959
6959
  query.groups = [];
6960
6960
 
6961
6961
  // Level of Joins
@@ -15664,19 +15664,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15664
15664
  }
15665
15665
  if (this.props && this.props.length > 0) {
15666
15666
  if (this.method == '@') {
15667
- var fs = "alasql.vars['" + this.variable + "']";
15667
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15668
15668
  } else {
15669
- var fs = "params['" + this.variable + "']";
15669
+ var fs = "params[k('"+this.variable+"')]";
15670
15670
  }
15671
15671
  fs += this.props
15672
15672
  .map(function (prop) {
15673
15673
  if (typeof prop == 'string') {
15674
- return "['" + prop + "']";
15674
+ return "[k('"+prop+"')]";
15675
15675
  } else if (typeof prop == 'number') {
15676
15676
  return '[' + prop + ']';
15677
15677
  } else {
15678
15678
 
15679
- return '[' + prop.toJS() + ']';
15679
+ return "[k("+prop.toJS()+")]";
15680
15680
  // } else {
15681
15681
 
15682
15682
  // throw new Error('Wrong SET property');
@@ -15684,7 +15684,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15684
15684
  })
15685
15685
  .join();
15686
15686
 
15687
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15687
+ 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);
15688
15688
  } else {
15689
15689
  if (this.method == '@') {
15690
15690
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v1.7.6 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v1.7.7 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 1.7.6
4
+ @version 1.7.7
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 = '1.7.6';
145
+ alasql.version = '1.7.7';
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 {
@@ -6950,7 +6950,7 @@ function queryfn3(query) {
6950
6950
 
6951
6951
  // Prepare variables
6952
6952
  query.data = [];
6953
- query.xgroups = {};
6953
+ query.xgroups=Object.create(null);
6954
6954
  query.groups = [];
6955
6955
 
6956
6956
  // Level of Joins
@@ -15659,19 +15659,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15659
15659
  }
15660
15660
  if (this.props && this.props.length > 0) {
15661
15661
  if (this.method == '@') {
15662
- var fs = "alasql.vars['" + this.variable + "']";
15662
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15663
15663
  } else {
15664
- var fs = "params['" + this.variable + "']";
15664
+ var fs = "params[k('"+this.variable+"')]";
15665
15665
  }
15666
15666
  fs += this.props
15667
15667
  .map(function (prop) {
15668
15668
  if (typeof prop == 'string') {
15669
- return "['" + prop + "']";
15669
+ return "[k('"+prop+"')]";
15670
15670
  } else if (typeof prop == 'number') {
15671
15671
  return '[' + prop + ']';
15672
15672
  } else {
15673
15673
 
15674
- return '[' + prop.toJS() + ']';
15674
+ return "[k("+prop.toJS()+")]";
15675
15675
  // } else {
15676
15676
 
15677
15677
  // throw new Error('Wrong SET property');
@@ -15679,7 +15679,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15679
15679
  })
15680
15680
  .join();
15681
15681
 
15682
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15682
+ 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);
15683
15683
  } else {
15684
15684
  if (this.method == '@') {
15685
15685
  alasql.vars[this.variable] = res;