alasql 4.20.1 → 4.20.2

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.20.2
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.20.0 build: develop-a98910ff | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.20.2 build: develop-a98910ff | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.20.0
4
+ @version 4.20.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2025 Andrey Gershun & Mathias Wulff
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.20.0 build: develop-a98910ff | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.20.2 build: develop-a98910ff | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.20.0
4
+ @version 4.20.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2025 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.20.0';
144
+ alasql.version = '4.20.2';
145
145
  alasql.build = 'develop-a98910ff';
146
146
 
147
147
  /**
@@ -4593,11 +4593,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4593
4593
  return +obj;
4594
4594
  }
4595
4595
 
4596
- var temp = new obj.constructor(); // changed
4596
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4597
4597
 
4598
4598
  for (var key in obj) {
4599
4599
  if (obj.hasOwnProperty(key)) {
4600
- temp[key] = cloneDeep(obj[key]);
4600
+ /* 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]); }
4601
4601
  }
4602
4602
  }
4603
4603
  return temp;
@@ -4669,7 +4669,7 @@ var extend = (utils.extend = function extend(a, b) {
4669
4669
  a = a || {};
4670
4670
  for (var key in b) {
4671
4671
  if (b.hasOwnProperty(key)) {
4672
- a[key] = b[key];
4672
+ /* 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]; }
4673
4673
  }
4674
4674
  }
4675
4675
  return a;
@@ -9676,7 +9676,7 @@ yy.Select.prototype.compileGroup = function (query) {
9676
9676
  aft2 = '';
9677
9677
 
9678
9678
  if (typeof query.groupStar !== 'undefined') {
9679
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9679
+ 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];};";
9680
9680
  }
9681
9681
 
9682
9682
  s += query.selectGroup
@@ -10160,7 +10160,7 @@ function compileSelectStar(query, aliases, joinstar) {
10160
10160
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
10161
10161
  } else {
10162
10162
  // Default overwrite mode
10163
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
10163
+ sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
10164
10164
  }
10165
10165
 
10166
10166
  query.dirtyColumns = true;
@@ -10636,10 +10636,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10636
10636
  self.columns.forEach(function (col) {
10637
10637
 
10638
10638
  if (col instanceof yy.Column && col.columnid === '*') {
10639
- // s += 'for(var k in g){r[k]=g[k]};';
10639
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10640
10640
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10641
10641
 
10642
- s += 'for(var k in g) {r[k]=g[k]};';
10642
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10643
10643
  return '';
10644
10644
 
10645
10645
  } else {
@@ -11982,7 +11982,7 @@ yy.Over = class Over {
11982
11982
  const allValues = this.right.map(value => value.value);
11983
11983
  const allValuesStr = allValues.join(',');
11984
11984
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11985
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11985
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11986
11986
  }
11987
11987
  } else {
11988
11988
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -12016,7 +12016,7 @@ yy.Over = class Over {
12016
12016
  const allValues = this.right.map(value => value.value);
12017
12017
  const allValuesStr = allValues.join(',');
12018
12018
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
12019
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
12019
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
12020
12020
  }
12021
12021
  } else {
12022
12022
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -14120,7 +14120,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
14120
14120
 
14121
14121
  table.update(
14122
14122
  function (t) {
14123
- for (var f in r) t[f] = r[f];
14123
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
14124
14124
  },
14125
14125
  table.data.indexOf(toreplace),
14126
14126
  params
@@ -15912,7 +15912,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15912
15912
  });
15913
15913
  } else {
15914
15914
 
15915
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15915
+ // 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]};';
15916
15916
  sw = JSONtoJS(values);
15917
15917
  }
15918
15918
  }
@@ -15991,7 +15991,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15991
15991
  self.output.columns.forEach(function (col) {
15992
15992
  if (col.columnid === '*') {
15993
15993
  // For *, expand all properties
15994
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15994
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15995
15995
  } else {
15996
15996
  var colname = col.as || col.columnid;
15997
15997
  // Direct property access for simple columns
@@ -16070,7 +16070,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16070
16070
  if (col.columnid === '*') {
16071
16071
  // For *, expand all properties
16072
16072
  for (var key in r) {
16073
- outputRow[key] = r[key];
16073
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16074
16074
  }
16075
16075
  } else {
16076
16076
  var colname = col.as || col.columnid;
@@ -16421,7 +16421,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16421
16421
  if (col.columnid === '*') {
16422
16422
  // For *, expand all properties
16423
16423
  for (var key in r) {
16424
- outputRow[key] = r[key];
16424
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16425
16425
  }
16426
16426
  } else {
16427
16427
  var colname = col.as || col.columnid;
@@ -16492,7 +16492,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16492
16492
  if (col.columnid === '*') {
16493
16493
  // For *, expand all properties
16494
16494
  for (var key in r) {
16495
- outputRow[key] = r[key];
16495
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16496
16496
  }
16497
16497
  } else {
16498
16498
  var colname = col.as || col.columnid;
@@ -16663,7 +16663,7 @@ yy.Update.prototype.compile = function (databaseid) {
16663
16663
  if (col.columnid === '*') {
16664
16664
  // For *, use INSERTED values
16665
16665
  for (var key in inserted) {
16666
- outputRow[key] = inserted[key];
16666
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16667
16667
  }
16668
16668
  } else {
16669
16669
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.20.0 build: develop-a98910ff | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.20.2 build: develop-a98910ff | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.20.0
4
+ @version 4.20.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2025 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.20.0';
144
+ alasql.version = '4.20.2';
145
145
  alasql.build = 'develop-a98910ff';
146
146
 
147
147
  /**
@@ -4593,11 +4593,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4593
4593
  return +obj;
4594
4594
  }
4595
4595
 
4596
- var temp = new obj.constructor(); // changed
4596
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4597
4597
 
4598
4598
  for (var key in obj) {
4599
4599
  if (obj.hasOwnProperty(key)) {
4600
- temp[key] = cloneDeep(obj[key]);
4600
+ /* 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]); }
4601
4601
  }
4602
4602
  }
4603
4603
  return temp;
@@ -4669,7 +4669,7 @@ var extend = (utils.extend = function extend(a, b) {
4669
4669
  a = a || {};
4670
4670
  for (var key in b) {
4671
4671
  if (b.hasOwnProperty(key)) {
4672
- a[key] = b[key];
4672
+ /* 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]; }
4673
4673
  }
4674
4674
  }
4675
4675
  return a;
@@ -9676,7 +9676,7 @@ yy.Select.prototype.compileGroup = function (query) {
9676
9676
  aft2 = '';
9677
9677
 
9678
9678
  if (typeof query.groupStar !== 'undefined') {
9679
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9679
+ 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];};";
9680
9680
  }
9681
9681
 
9682
9682
  s += query.selectGroup
@@ -10160,7 +10160,7 @@ function compileSelectStar(query, aliases, joinstar) {
10160
10160
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
10161
10161
  } else {
10162
10162
  // Default overwrite mode
10163
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
10163
+ sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
10164
10164
  }
10165
10165
 
10166
10166
  query.dirtyColumns = true;
@@ -10636,10 +10636,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10636
10636
  self.columns.forEach(function (col) {
10637
10637
 
10638
10638
  if (col instanceof yy.Column && col.columnid === '*') {
10639
- // s += 'for(var k in g){r[k]=g[k]};';
10639
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10640
10640
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10641
10641
 
10642
- s += 'for(var k in g) {r[k]=g[k]};';
10642
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10643
10643
  return '';
10644
10644
 
10645
10645
  } else {
@@ -11982,7 +11982,7 @@ yy.Over = class Over {
11982
11982
  const allValues = this.right.map(value => value.value);
11983
11983
  const allValuesStr = allValues.join(',');
11984
11984
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11985
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11985
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11986
11986
  }
11987
11987
  } else {
11988
11988
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -12016,7 +12016,7 @@ yy.Over = class Over {
12016
12016
  const allValues = this.right.map(value => value.value);
12017
12017
  const allValuesStr = allValues.join(',');
12018
12018
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
12019
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
12019
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
12020
12020
  }
12021
12021
  } else {
12022
12022
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -14120,7 +14120,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
14120
14120
 
14121
14121
  table.update(
14122
14122
  function (t) {
14123
- for (var f in r) t[f] = r[f];
14123
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
14124
14124
  },
14125
14125
  table.data.indexOf(toreplace),
14126
14126
  params
@@ -15912,7 +15912,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15912
15912
  });
15913
15913
  } else {
15914
15914
 
15915
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15915
+ // 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]};';
15916
15916
  sw = JSONtoJS(values);
15917
15917
  }
15918
15918
  }
@@ -15991,7 +15991,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15991
15991
  self.output.columns.forEach(function (col) {
15992
15992
  if (col.columnid === '*') {
15993
15993
  // For *, expand all properties
15994
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15994
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15995
15995
  } else {
15996
15996
  var colname = col.as || col.columnid;
15997
15997
  // Direct property access for simple columns
@@ -16070,7 +16070,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16070
16070
  if (col.columnid === '*') {
16071
16071
  // For *, expand all properties
16072
16072
  for (var key in r) {
16073
- outputRow[key] = r[key];
16073
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16074
16074
  }
16075
16075
  } else {
16076
16076
  var colname = col.as || col.columnid;
@@ -16421,7 +16421,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16421
16421
  if (col.columnid === '*') {
16422
16422
  // For *, expand all properties
16423
16423
  for (var key in r) {
16424
- outputRow[key] = r[key];
16424
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16425
16425
  }
16426
16426
  } else {
16427
16427
  var colname = col.as || col.columnid;
@@ -16492,7 +16492,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16492
16492
  if (col.columnid === '*') {
16493
16493
  // For *, expand all properties
16494
16494
  for (var key in r) {
16495
- outputRow[key] = r[key];
16495
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16496
16496
  }
16497
16497
  } else {
16498
16498
  var colname = col.as || col.columnid;
@@ -16663,7 +16663,7 @@ yy.Update.prototype.compile = function (databaseid) {
16663
16663
  if (col.columnid === '*') {
16664
16664
  // For *, use INSERTED values
16665
16665
  for (var key in inserted) {
16666
- outputRow[key] = inserted[key];
16666
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16667
16667
  }
16668
16668
  } else {
16669
16669
  var colname = col.as || col.columnid;