alasql 4.7.0 → 4.7.1

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.7.1
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.6 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.7.1 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.6
4
+ @version 4.7.1
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.6.6 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.7.1 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.6
4
+ @version 4.7.1
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.6.6';
144
+ alasql.version = '4.7.1';
145
145
  alasql.build = 'develop-272b12b3';
146
146
 
147
147
  /**
@@ -4061,11 +4061,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4061
4061
  return +obj;
4062
4062
  }
4063
4063
 
4064
- var temp = new obj.constructor(); // changed
4064
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4065
4065
 
4066
4066
  for (var key in obj) {
4067
4067
  if (obj.hasOwnProperty(key)) {
4068
- temp[key] = cloneDeep(obj[key]);
4068
+ /* 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]); }
4069
4069
  }
4070
4070
  }
4071
4071
  return temp;
@@ -4137,7 +4137,7 @@ var extend = (utils.extend = function extend(a, b) {
4137
4137
  a = a || {};
4138
4138
  for (var key in b) {
4139
4139
  if (b.hasOwnProperty(key)) {
4140
- a[key] = b[key];
4140
+ /* 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]; }
4141
4141
  }
4142
4142
  }
4143
4143
  return a;
@@ -8424,7 +8424,7 @@ yy.Select.prototype.compileGroup = function (query) {
8424
8424
  aft2 = '';
8425
8425
 
8426
8426
  if (typeof query.groupStar !== 'undefined') {
8427
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8427
+ 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];};";
8428
8428
  }
8429
8429
 
8430
8430
  s += query.selectGroup
@@ -8866,7 +8866,7 @@ function compileSelectStar(query, aliases, joinstar) {
8866
8866
  } else {
8867
8867
 
8868
8868
  // if column not exist, then copy all
8869
- sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
8869
+ 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]};';
8870
8870
 
8871
8871
  query.dirtyColumns = true;
8872
8872
  }
@@ -9194,10 +9194,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9194
9194
  self.columns.forEach(function (col) {
9195
9195
 
9196
9196
  if (col instanceof yy.Column && col.columnid === '*') {
9197
- // s += 'for(var k in g){r[k]=g[k]};';
9197
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9198
9198
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9199
9199
 
9200
- s += 'for(var k in g) {r[k]=g[k]};';
9200
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9201
9201
  return '';
9202
9202
 
9203
9203
  } else {
@@ -10420,7 +10420,7 @@ yy.Over = class Over {
10420
10420
  const allValues = this.right.map(value => value.value);
10421
10421
  const allValuesStr = allValues.join(',');
10422
10422
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
10423
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
10423
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
10424
10424
  }
10425
10425
  } else {
10426
10426
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -10438,7 +10438,7 @@ yy.Over = class Over {
10438
10438
  const allValues = this.right.map(value => value.value);
10439
10439
  const allValuesStr = allValues.join(',');
10440
10440
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
10441
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
10441
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
10442
10442
  }
10443
10443
  } else {
10444
10444
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -12294,7 +12294,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
12294
12294
 
12295
12295
  table.update(
12296
12296
  function (t) {
12297
- for (var f in r) t[f] = r[f];
12297
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
12298
12298
  },
12299
12299
  table.data.indexOf(toreplace),
12300
12300
  params
@@ -13808,7 +13808,7 @@ yy.Insert.prototype.compile = function (databaseid) {
13808
13808
  });
13809
13809
  } else {
13810
13810
 
13811
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
13811
+ // 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]};';
13812
13812
  sw = JSONtoJS(values);
13813
13813
  }
13814
13814
  }
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.6 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.7.1 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.6
4
+ @version 4.7.1
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.6.6';
144
+ alasql.version = '4.7.1';
145
145
  alasql.build = 'develop-272b12b3';
146
146
 
147
147
  /**
@@ -4061,11 +4061,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4061
4061
  return +obj;
4062
4062
  }
4063
4063
 
4064
- var temp = new obj.constructor(); // changed
4064
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4065
4065
 
4066
4066
  for (var key in obj) {
4067
4067
  if (obj.hasOwnProperty(key)) {
4068
- temp[key] = cloneDeep(obj[key]);
4068
+ /* 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]); }
4069
4069
  }
4070
4070
  }
4071
4071
  return temp;
@@ -4137,7 +4137,7 @@ var extend = (utils.extend = function extend(a, b) {
4137
4137
  a = a || {};
4138
4138
  for (var key in b) {
4139
4139
  if (b.hasOwnProperty(key)) {
4140
- a[key] = b[key];
4140
+ /* 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]; }
4141
4141
  }
4142
4142
  }
4143
4143
  return a;
@@ -8424,7 +8424,7 @@ yy.Select.prototype.compileGroup = function (query) {
8424
8424
  aft2 = '';
8425
8425
 
8426
8426
  if (typeof query.groupStar !== 'undefined') {
8427
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8427
+ 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];};";
8428
8428
  }
8429
8429
 
8430
8430
  s += query.selectGroup
@@ -8866,7 +8866,7 @@ function compileSelectStar(query, aliases, joinstar) {
8866
8866
  } else {
8867
8867
 
8868
8868
  // if column not exist, then copy all
8869
- sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
8869
+ 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]};';
8870
8870
 
8871
8871
  query.dirtyColumns = true;
8872
8872
  }
@@ -9194,10 +9194,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9194
9194
  self.columns.forEach(function (col) {
9195
9195
 
9196
9196
  if (col instanceof yy.Column && col.columnid === '*') {
9197
- // s += 'for(var k in g){r[k]=g[k]};';
9197
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9198
9198
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9199
9199
 
9200
- s += 'for(var k in g) {r[k]=g[k]};';
9200
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9201
9201
  return '';
9202
9202
 
9203
9203
  } else {
@@ -10420,7 +10420,7 @@ yy.Over = class Over {
10420
10420
  const allValues = this.right.map(value => value.value);
10421
10421
  const allValuesStr = allValues.join(',');
10422
10422
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
10423
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
10423
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
10424
10424
  }
10425
10425
  } else {
10426
10426
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -10438,7 +10438,7 @@ yy.Over = class Over {
10438
10438
  const allValues = this.right.map(value => value.value);
10439
10439
  const allValuesStr = allValues.join(',');
10440
10440
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
10441
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
10441
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
10442
10442
  }
10443
10443
  } else {
10444
10444
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -12294,7 +12294,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
12294
12294
 
12295
12295
  table.update(
12296
12296
  function (t) {
12297
- for (var f in r) t[f] = r[f];
12297
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
12298
12298
  },
12299
12299
  table.data.indexOf(toreplace),
12300
12300
  params
@@ -13808,7 +13808,7 @@ yy.Insert.prototype.compile = function (databaseid) {
13808
13808
  });
13809
13809
  } else {
13810
13810
 
13811
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
13811
+ // 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]};';
13812
13812
  sw = JSONtoJS(values);
13813
13813
  }
13814
13814
  }