alasql 2.1.9 → 2.1.10

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  //
4
4
  // Command line interface for Alasql
5
- // Version: 2.1.9
5
+ // Version: 2.1.10
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v2.1.9 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v2.1.10 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.1.9
4
+ @version 2.1.10
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2016 Andrey Gershun & Mathias Rangel Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v2.1.9 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v2.1.10 | © 2014-2022 Andrey Gershun & Mathias 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,o){"function"==typeof(e=e||[])&&(scope=o,o=e,e=[]),"object"!=typeof e&&(e=[e]);var t=i.lastid++;i.buffer[t]=o,i.webworker.postMessage({id:t,sql:r,params:e})}var a;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&&(a=function(r,e,n,s){return new Promise(function(o,t){i(r,e,function(r,e){e?t(e):(n&&s&&!1!==i.options.progress&&i.options.progress(n,s),o(r))})})},i.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return a(r,e);if(!isArray(r)||r.length<1||void 0!==e)throw new Error("Error in .promise parameters");var o=r;if(!(o.length<1)){for(var t,n,s=[],i=0;i<o.length;i++){if("string"==typeof(n=o[i])&&(n=[n]),!isArray(n)||n.length<1||2<n.length)throw new Error("Error in .promise parameter");t=n[0],n=n[1]||void 0,s.push(a(t,n,i,o.length))}return Promise.all(s)}}),i=i||!1)return i.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(i.worker=function(r,e,o){if(void 0===(r=!0===r?void 0:r))for(var t=document.getElementsByTagName("script"),n=0;n<t.length;n++){if("alasql-worker.js"===t[n].src.substr(-16).toLowerCase()){r=t[n].src.substr(0,t[n].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===t[n].src.substr(-20).toLowerCase()){r=t[n].src.substr(0,t[n].src.length-20)+"alasql.min.js";break}if("alasql.js"===t[n].src.substr(-9).toLowerCase()){r=t[n].src;break}if("alasql.min.js"===t[n].src.substr(-13).toLowerCase()){r=t[n].src.substr(0,t[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=(s="importScripts('")+r+"');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(","),[],o)):!1===r&&delete i.webworker}),i.lastid=0,i.buffer={},i.worker(),i;throw new Error("alasql was not found")});
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v2.1.9 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v2.1.10 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.1.9
4
+ @version 2.1.10
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 = '2.1.9';
145
+ alasql.version = '2.1.10';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -2495,7 +2495,7 @@ next:function () {
2495
2495
 
2496
2496
  // return next match that has a token
2497
2497
  lex:function lex () {
2498
- var r = this.next();
2498
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2499
2499
  if (r) {
2500
2500
  return r;
2501
2501
  } else {
@@ -6574,7 +6574,7 @@ function queryfn3(query) {
6574
6574
 
6575
6575
  // Prepare variables
6576
6576
  query.data = [];
6577
- query.xgroups = {};
6577
+ query.xgroups=Object.create(null);
6578
6578
  query.groups = [];
6579
6579
 
6580
6580
  // Level of Joins
@@ -15279,19 +15279,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15279
15279
  }
15280
15280
  if (this.props && this.props.length > 0) {
15281
15281
  if (this.method == '@') {
15282
- var fs = "alasql.vars['" + this.variable + "']";
15282
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15283
15283
  } else {
15284
- var fs = "params['" + this.variable + "']";
15284
+ var fs = "params[k('"+this.variable+"')]";
15285
15285
  }
15286
15286
  fs += this.props
15287
15287
  .map(function (prop) {
15288
15288
  if (typeof prop == 'string') {
15289
- return "['" + prop + "']";
15289
+ return "[k('"+prop+"')]";
15290
15290
  } else if (typeof prop == 'number') {
15291
15291
  return '[' + prop + ']';
15292
15292
  } else {
15293
15293
 
15294
- return '[' + prop.toJS() + ']';
15294
+ return "[k("+prop.toJS()+")]";
15295
15295
  // } else {
15296
15296
 
15297
15297
  // throw new Error('Wrong SET property');
@@ -15299,7 +15299,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15299
15299
  })
15300
15300
  .join();
15301
15301
 
15302
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15302
+ 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);
15303
15303
  } else {
15304
15304
  if (this.method == '@') {
15305
15305
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v2.1.9 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v2.1.10 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.1.9
4
+ @version 2.1.10
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 = '2.1.9';
145
+ alasql.version = '2.1.10';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -2495,7 +2495,7 @@ next:function () {
2495
2495
 
2496
2496
  // return next match that has a token
2497
2497
  lex:function lex () {
2498
- var r = this.next();
2498
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2499
2499
  if (r) {
2500
2500
  return r;
2501
2501
  } else {
@@ -6566,7 +6566,7 @@ function queryfn3(query) {
6566
6566
 
6567
6567
  // Prepare variables
6568
6568
  query.data = [];
6569
- query.xgroups = {};
6569
+ query.xgroups=Object.create(null);
6570
6570
  query.groups = [];
6571
6571
 
6572
6572
  // Level of Joins
@@ -15271,19 +15271,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15271
15271
  }
15272
15272
  if (this.props && this.props.length > 0) {
15273
15273
  if (this.method == '@') {
15274
- var fs = "alasql.vars['" + this.variable + "']";
15274
+ var fs = "alasql.vars[k('"+this.variable+"')]";
15275
15275
  } else {
15276
- var fs = "params['" + this.variable + "']";
15276
+ var fs = "params[k('"+this.variable+"')]";
15277
15277
  }
15278
15278
  fs += this.props
15279
15279
  .map(function (prop) {
15280
15280
  if (typeof prop == 'string') {
15281
- return "['" + prop + "']";
15281
+ return "[k('"+prop+"')]";
15282
15282
  } else if (typeof prop == 'number') {
15283
15283
  return '[' + prop + ']';
15284
15284
  } else {
15285
15285
 
15286
- return '[' + prop.toJS() + ']';
15286
+ return "[k("+prop.toJS()+")]";
15287
15287
  // } else {
15288
15288
 
15289
15289
  // throw new Error('Wrong SET property');
@@ -15291,7 +15291,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
15291
15291
  })
15292
15292
  .join();
15293
15293
 
15294
- new Function('value,params,alasql', 'var y;' + fs + '=value')(res, params, alasql);
15294
+ 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);
15295
15295
  } else {
15296
15296
  if (this.method == '@') {
15297
15297
  alasql.vars[this.variable] = res;