alasql 4.2.7 → 4.2.8

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: 0.2.3
5
+ // Version: 4.2.8
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.2.6 build: develop-6db74fcc | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.2.8 build: develop-6db74fcc | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.2.6
4
+ @version 4.2.8
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 Andrey Gershun & Mathias Wulff
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.2.6 build: develop-6db74fcc | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.2.8 build: develop-6db74fcc | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.2.6
4
+ @version 4.2.8
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 Andrey Gershun & Mathias Wulff
@@ -141,7 +141,7 @@ SOFTWARE.
141
141
  Current version of alasql
142
142
  @constant {string}
143
143
  */
144
- alasql.version = '4.2.6';
144
+ alasql.version = '4.2.8';
145
145
  alasql.build = 'develop-6db74fcc';
146
146
 
147
147
  /**
@@ -4036,11 +4036,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4036
4036
  return +obj;
4037
4037
  }
4038
4038
 
4039
- var temp = new obj.constructor(); // changed
4039
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4040
4040
 
4041
4041
  for (var key in obj) {
4042
4042
  if (obj.hasOwnProperty(key)) {
4043
- temp[key] = cloneDeep(obj[key]);
4043
+ /* 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]); }
4044
4044
  }
4045
4045
  }
4046
4046
  return temp;
@@ -4112,7 +4112,7 @@ var extend = (utils.extend = function extend(a, b) {
4112
4112
  a = a || {};
4113
4113
  for (var key in b) {
4114
4114
  if (b.hasOwnProperty(key)) {
4115
- a[key] = b[key];
4115
+ /* 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]; }
4116
4116
  }
4117
4117
  }
4118
4118
  return a;
@@ -8625,7 +8625,7 @@ yy.Select.prototype.compileGroup = function (query) {
8625
8625
  aft2 = '';
8626
8626
 
8627
8627
  if (typeof query.groupStar !== 'undefined') {
8628
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8628
+ 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];};";
8629
8629
  }
8630
8630
 
8631
8631
  /*
@@ -9068,7 +9068,7 @@ function compileSelectStar(query, aliases, joinstar) {
9068
9068
  } else {
9069
9069
 
9070
9070
  // if column not exist, then copy all
9071
- sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
9071
+ 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]};';
9072
9072
 
9073
9073
  query.dirtyColumns = true;
9074
9074
  }
@@ -9396,10 +9396,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9396
9396
  self.columns.forEach(function (col) {
9397
9397
 
9398
9398
  if (col instanceof yy.Column && col.columnid === '*') {
9399
- // s += 'for(var k in g){r[k]=g[k]};';
9399
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9400
9400
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9401
9401
 
9402
- s += 'for(var k in g) {r[k]=g[k]};';
9402
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9403
9403
  return '';
9404
9404
 
9405
9405
  } else {
@@ -10609,7 +10609,7 @@ yy.Over = class Over {
10609
10609
  alasql.sets[allValuesStr] = new Set(allValues);
10610
10610
  }
10611
10611
  s =
10612
- 'alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
10612
+ 'alasql.sets[' + JSON.stringify(allValuesStr) + '].has(alasql.utils.getValueOf(' + leftJS() + '))';
10613
10613
  }
10614
10614
  } else {
10615
10615
  s = '(' + rightJS() + '.indexOf(' + leftJS() + ')>-1)';
@@ -10650,7 +10650,7 @@ yy.Over = class Over {
10650
10650
  alasql.sets[allValuesStr] = new Set(allValues);
10651
10651
  }
10652
10652
  s =
10653
- '!alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
10653
+ '!alasql.sets[' + JSON.stringify(allValuesStr) + '].has(alasql.utils.getValueOf(' + leftJS() + '))';
10654
10654
  }
10655
10655
  } else {
10656
10656
  s = '(' + rightJS() + '.indexOf(';
@@ -12589,7 +12589,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
12589
12589
 
12590
12590
  table.update(
12591
12591
  function (t) {
12592
- for (var f in r) t[f] = r[f];
12592
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
12593
12593
  },
12594
12594
  table.data.indexOf(toreplace),
12595
12595
  params
@@ -14146,7 +14146,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14146
14146
  });
14147
14147
  } else {
14148
14148
 
14149
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14149
+ // sw = 'var w='+JSONtoJS(values)+';for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
14150
14150
  sw = JSONtoJS(values);
14151
14151
  }
14152
14152
  }
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.2.6 build: develop-6db74fcc | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.2.8 build: develop-6db74fcc | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.2.6
4
+ @version 4.2.8
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 Andrey Gershun & Mathias Wulff
@@ -141,7 +141,7 @@ SOFTWARE.
141
141
  Current version of alasql
142
142
  @constant {string}
143
143
  */
144
- alasql.version = '4.2.6';
144
+ alasql.version = '4.2.8';
145
145
  alasql.build = 'develop-6db74fcc';
146
146
 
147
147
  /**
@@ -4036,11 +4036,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4036
4036
  return +obj;
4037
4037
  }
4038
4038
 
4039
- var temp = new obj.constructor(); // changed
4039
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4040
4040
 
4041
4041
  for (var key in obj) {
4042
4042
  if (obj.hasOwnProperty(key)) {
4043
- temp[key] = cloneDeep(obj[key]);
4043
+ /* 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]); }
4044
4044
  }
4045
4045
  }
4046
4046
  return temp;
@@ -4112,7 +4112,7 @@ var extend = (utils.extend = function extend(a, b) {
4112
4112
  a = a || {};
4113
4113
  for (var key in b) {
4114
4114
  if (b.hasOwnProperty(key)) {
4115
- a[key] = b[key];
4115
+ /* 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]; }
4116
4116
  }
4117
4117
  }
4118
4118
  return a;
@@ -8625,7 +8625,7 @@ yy.Select.prototype.compileGroup = function (query) {
8625
8625
  aft2 = '';
8626
8626
 
8627
8627
  if (typeof query.groupStar !== 'undefined') {
8628
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8628
+ 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];};";
8629
8629
  }
8630
8630
 
8631
8631
  /*
@@ -9068,7 +9068,7 @@ function compileSelectStar(query, aliases, joinstar) {
9068
9068
  } else {
9069
9069
 
9070
9070
  // if column not exist, then copy all
9071
- sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
9071
+ 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]};';
9072
9072
 
9073
9073
  query.dirtyColumns = true;
9074
9074
  }
@@ -9396,10 +9396,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9396
9396
  self.columns.forEach(function (col) {
9397
9397
 
9398
9398
  if (col instanceof yy.Column && col.columnid === '*') {
9399
- // s += 'for(var k in g){r[k]=g[k]};';
9399
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9400
9400
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9401
9401
 
9402
- s += 'for(var k in g) {r[k]=g[k]};';
9402
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9403
9403
  return '';
9404
9404
 
9405
9405
  } else {
@@ -10609,7 +10609,7 @@ yy.Over = class Over {
10609
10609
  alasql.sets[allValuesStr] = new Set(allValues);
10610
10610
  }
10611
10611
  s =
10612
- 'alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
10612
+ 'alasql.sets[' + JSON.stringify(allValuesStr) + '].has(alasql.utils.getValueOf(' + leftJS() + '))';
10613
10613
  }
10614
10614
  } else {
10615
10615
  s = '(' + rightJS() + '.indexOf(' + leftJS() + ')>-1)';
@@ -10650,7 +10650,7 @@ yy.Over = class Over {
10650
10650
  alasql.sets[allValuesStr] = new Set(allValues);
10651
10651
  }
10652
10652
  s =
10653
- '!alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
10653
+ '!alasql.sets[' + JSON.stringify(allValuesStr) + '].has(alasql.utils.getValueOf(' + leftJS() + '))';
10654
10654
  }
10655
10655
  } else {
10656
10656
  s = '(' + rightJS() + '.indexOf(';
@@ -12589,7 +12589,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
12589
12589
 
12590
12590
  table.update(
12591
12591
  function (t) {
12592
- for (var f in r) t[f] = r[f];
12592
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
12593
12593
  },
12594
12594
  table.data.indexOf(toreplace),
12595
12595
  params
@@ -14146,7 +14146,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14146
14146
  });
14147
14147
  } else {
14148
14148
 
14149
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14149
+ // sw = 'var w='+JSONtoJS(values)+';for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
14150
14150
  sw = JSONtoJS(values);
14151
14151
  }
14152
14152
  }