alasql 4.19.1 → 4.19.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.19.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.19.0 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.19.2 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.19.0
4
+ @version 4.19.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.19.0 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.19.2 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.19.0
4
+ @version 4.19.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.19.0';
144
+ alasql.version = '4.19.2';
145
145
  alasql.build = 'develop-98e852ad';
146
146
 
147
147
  /**
@@ -4581,11 +4581,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4581
4581
  return +obj;
4582
4582
  }
4583
4583
 
4584
- var temp = new obj.constructor(); // changed
4584
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4585
4585
 
4586
4586
  for (var key in obj) {
4587
4587
  if (obj.hasOwnProperty(key)) {
4588
- temp[key] = cloneDeep(obj[key]);
4588
+ /* 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]); }
4589
4589
  }
4590
4590
  }
4591
4591
  return temp;
@@ -4657,7 +4657,7 @@ var extend = (utils.extend = function extend(a, b) {
4657
4657
  a = a || {};
4658
4658
  for (var key in b) {
4659
4659
  if (b.hasOwnProperty(key)) {
4660
- a[key] = b[key];
4660
+ /* 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]; }
4661
4661
  }
4662
4662
  }
4663
4663
  return a;
@@ -9654,7 +9654,7 @@ yy.Select.prototype.compileGroup = function (query) {
9654
9654
  aft2 = '';
9655
9655
 
9656
9656
  if (typeof query.groupStar !== 'undefined') {
9657
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9657
+ 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];};";
9658
9658
  }
9659
9659
 
9660
9660
  s += query.selectGroup
@@ -10138,7 +10138,7 @@ function compileSelectStar(query, aliases, joinstar) {
10138
10138
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
10139
10139
  } else {
10140
10140
  // Default overwrite mode
10141
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
10141
+ 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]};';
10142
10142
  }
10143
10143
 
10144
10144
  query.dirtyColumns = true;
@@ -10614,10 +10614,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10614
10614
  self.columns.forEach(function (col) {
10615
10615
 
10616
10616
  if (col instanceof yy.Column && col.columnid === '*') {
10617
- // s += 'for(var k in g){r[k]=g[k]};';
10617
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10618
10618
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10619
10619
 
10620
- s += 'for(var k in g) {r[k]=g[k]};';
10620
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10621
10621
  return '';
10622
10622
 
10623
10623
  } else {
@@ -11960,7 +11960,7 @@ yy.Over = class Over {
11960
11960
  const allValues = this.right.map(value => value.value);
11961
11961
  const allValuesStr = allValues.join(',');
11962
11962
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11963
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11963
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11964
11964
  }
11965
11965
  } else {
11966
11966
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11994,7 +11994,7 @@ yy.Over = class Over {
11994
11994
  const allValues = this.right.map(value => value.value);
11995
11995
  const allValuesStr = allValues.join(',');
11996
11996
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11997
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11997
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11998
11998
  }
11999
11999
  } else {
12000
12000
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -14068,7 +14068,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
14068
14068
 
14069
14069
  table.update(
14070
14070
  function (t) {
14071
- for (var f in r) t[f] = r[f];
14071
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
14072
14072
  },
14073
14073
  table.data.indexOf(toreplace),
14074
14074
  params
@@ -15839,7 +15839,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15839
15839
  });
15840
15840
  } else {
15841
15841
 
15842
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15842
+ // 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]};';
15843
15843
  sw = JSONtoJS(values);
15844
15844
  }
15845
15845
  }
@@ -15918,7 +15918,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15918
15918
  self.output.columns.forEach(function (col) {
15919
15919
  if (col.columnid === '*') {
15920
15920
  // For *, expand all properties
15921
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15921
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15922
15922
  } else {
15923
15923
  var colname = col.as || col.columnid;
15924
15924
  // Direct property access for simple columns
@@ -15997,7 +15997,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15997
15997
  if (col.columnid === '*') {
15998
15998
  // For *, expand all properties
15999
15999
  for (var key in r) {
16000
- outputRow[key] = r[key];
16000
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16001
16001
  }
16002
16002
  } else {
16003
16003
  var colname = col.as || col.columnid;
@@ -16348,7 +16348,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16348
16348
  if (col.columnid === '*') {
16349
16349
  // For *, expand all properties
16350
16350
  for (var key in r) {
16351
- outputRow[key] = r[key];
16351
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16352
16352
  }
16353
16353
  } else {
16354
16354
  var colname = col.as || col.columnid;
@@ -16419,7 +16419,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16419
16419
  if (col.columnid === '*') {
16420
16420
  // For *, expand all properties
16421
16421
  for (var key in r) {
16422
- outputRow[key] = r[key];
16422
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16423
16423
  }
16424
16424
  } else {
16425
16425
  var colname = col.as || col.columnid;
@@ -16590,7 +16590,7 @@ yy.Update.prototype.compile = function (databaseid) {
16590
16590
  if (col.columnid === '*') {
16591
16591
  // For *, use INSERTED values
16592
16592
  for (var key in inserted) {
16593
- outputRow[key] = inserted[key];
16593
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16594
16594
  }
16595
16595
  } else {
16596
16596
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.19.0 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.19.2 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.19.0
4
+ @version 4.19.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.19.0';
144
+ alasql.version = '4.19.2';
145
145
  alasql.build = 'develop-98e852ad';
146
146
 
147
147
  /**
@@ -4581,11 +4581,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4581
4581
  return +obj;
4582
4582
  }
4583
4583
 
4584
- var temp = new obj.constructor(); // changed
4584
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4585
4585
 
4586
4586
  for (var key in obj) {
4587
4587
  if (obj.hasOwnProperty(key)) {
4588
- temp[key] = cloneDeep(obj[key]);
4588
+ /* 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]); }
4589
4589
  }
4590
4590
  }
4591
4591
  return temp;
@@ -4657,7 +4657,7 @@ var extend = (utils.extend = function extend(a, b) {
4657
4657
  a = a || {};
4658
4658
  for (var key in b) {
4659
4659
  if (b.hasOwnProperty(key)) {
4660
- a[key] = b[key];
4660
+ /* 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]; }
4661
4661
  }
4662
4662
  }
4663
4663
  return a;
@@ -9654,7 +9654,7 @@ yy.Select.prototype.compileGroup = function (query) {
9654
9654
  aft2 = '';
9655
9655
 
9656
9656
  if (typeof query.groupStar !== 'undefined') {
9657
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9657
+ 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];};";
9658
9658
  }
9659
9659
 
9660
9660
  s += query.selectGroup
@@ -10138,7 +10138,7 @@ function compileSelectStar(query, aliases, joinstar) {
10138
10138
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
10139
10139
  } else {
10140
10140
  // Default overwrite mode
10141
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
10141
+ 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]};';
10142
10142
  }
10143
10143
 
10144
10144
  query.dirtyColumns = true;
@@ -10614,10 +10614,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10614
10614
  self.columns.forEach(function (col) {
10615
10615
 
10616
10616
  if (col instanceof yy.Column && col.columnid === '*') {
10617
- // s += 'for(var k in g){r[k]=g[k]};';
10617
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10618
10618
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10619
10619
 
10620
- s += 'for(var k in g) {r[k]=g[k]};';
10620
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10621
10621
  return '';
10622
10622
 
10623
10623
  } else {
@@ -11960,7 +11960,7 @@ yy.Over = class Over {
11960
11960
  const allValues = this.right.map(value => value.value);
11961
11961
  const allValuesStr = allValues.join(',');
11962
11962
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11963
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11963
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11964
11964
  }
11965
11965
  } else {
11966
11966
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11994,7 +11994,7 @@ yy.Over = class Over {
11994
11994
  const allValues = this.right.map(value => value.value);
11995
11995
  const allValuesStr = allValues.join(',');
11996
11996
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11997
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11997
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11998
11998
  }
11999
11999
  } else {
12000
12000
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -14068,7 +14068,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
14068
14068
 
14069
14069
  table.update(
14070
14070
  function (t) {
14071
- for (var f in r) t[f] = r[f];
14071
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
14072
14072
  },
14073
14073
  table.data.indexOf(toreplace),
14074
14074
  params
@@ -15839,7 +15839,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15839
15839
  });
15840
15840
  } else {
15841
15841
 
15842
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15842
+ // 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]};';
15843
15843
  sw = JSONtoJS(values);
15844
15844
  }
15845
15845
  }
@@ -15918,7 +15918,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15918
15918
  self.output.columns.forEach(function (col) {
15919
15919
  if (col.columnid === '*') {
15920
15920
  // For *, expand all properties
15921
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15921
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15922
15922
  } else {
15923
15923
  var colname = col.as || col.columnid;
15924
15924
  // Direct property access for simple columns
@@ -15997,7 +15997,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15997
15997
  if (col.columnid === '*') {
15998
15998
  // For *, expand all properties
15999
15999
  for (var key in r) {
16000
- outputRow[key] = r[key];
16000
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16001
16001
  }
16002
16002
  } else {
16003
16003
  var colname = col.as || col.columnid;
@@ -16348,7 +16348,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16348
16348
  if (col.columnid === '*') {
16349
16349
  // For *, expand all properties
16350
16350
  for (var key in r) {
16351
- outputRow[key] = r[key];
16351
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16352
16352
  }
16353
16353
  } else {
16354
16354
  var colname = col.as || col.columnid;
@@ -16419,7 +16419,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16419
16419
  if (col.columnid === '*') {
16420
16420
  // For *, expand all properties
16421
16421
  for (var key in r) {
16422
- outputRow[key] = r[key];
16422
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16423
16423
  }
16424
16424
  } else {
16425
16425
  var colname = col.as || col.columnid;
@@ -16590,7 +16590,7 @@ yy.Update.prototype.compile = function (databaseid) {
16590
16590
  if (col.columnid === '*') {
16591
16591
  // For *, use INSERTED values
16592
16592
  for (var key in inserted) {
16593
- outputRow[key] = inserted[key];
16593
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16594
16594
  }
16595
16595
  } else {
16596
16596
  var colname = col.as || col.columnid;