alasql 4.21.0 → 4.21.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.21.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.21.0 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.21.1 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.21.0
4
+ @version 4.21.1
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.21.0 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.21.1 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.21.0
4
+ @version 4.21.1
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.21.0';
144
+ alasql.version = '4.21.1';
145
145
  alasql.build = 'develop-38bf3c39';
146
146
 
147
147
  /**
@@ -4632,11 +4632,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4632
4632
  return +obj;
4633
4633
  }
4634
4634
 
4635
- var temp = new obj.constructor(); // changed
4635
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4636
4636
 
4637
4637
  for (var key in obj) {
4638
4638
  if (obj.hasOwnProperty(key)) {
4639
- temp[key] = cloneDeep(obj[key]);
4639
+ /* 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]); }
4640
4640
  }
4641
4641
  }
4642
4642
  return temp;
@@ -4708,7 +4708,7 @@ var extend = (utils.extend = function extend(a, b) {
4708
4708
  a = a || {};
4709
4709
  for (var key in b) {
4710
4710
  if (b.hasOwnProperty(key)) {
4711
- a[key] = b[key];
4711
+ /* 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]; }
4712
4712
  }
4713
4713
  }
4714
4714
  return a;
@@ -9815,7 +9815,7 @@ yy.Select.prototype.compileGroup = function (query) {
9815
9815
  aft2 = '';
9816
9816
 
9817
9817
  if (typeof query.groupStar !== 'undefined') {
9818
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9818
+ 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];};";
9819
9819
  }
9820
9820
 
9821
9821
  s += query.selectGroup
@@ -10299,7 +10299,7 @@ function compileSelectStar(query, aliases, joinstar) {
10299
10299
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
10300
10300
  } else {
10301
10301
  // Default overwrite mode
10302
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
10302
+ 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]};';
10303
10303
  }
10304
10304
 
10305
10305
  query.dirtyColumns = true;
@@ -10779,10 +10779,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10779
10779
  self.columns.forEach(function (col) {
10780
10780
 
10781
10781
  if (col instanceof yy.Column && col.columnid === '*') {
10782
- // s += 'for(var k in g){r[k]=g[k]};';
10782
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10783
10783
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10784
10784
 
10785
- s += 'for(var k in g) {r[k]=g[k]};';
10785
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10786
10786
  return '';
10787
10787
 
10788
10788
  } else {
@@ -12143,7 +12143,7 @@ yy.Over = class Over {
12143
12143
  const allValues = this.right.map(value => value.value);
12144
12144
  const allValuesStr = allValues.join(',');
12145
12145
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
12146
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
12146
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
12147
12147
  }
12148
12148
  } else {
12149
12149
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -12177,7 +12177,7 @@ yy.Over = class Over {
12177
12177
  const allValues = this.right.map(value => value.value);
12178
12178
  const allValuesStr = allValues.join(',');
12179
12179
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
12180
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
12180
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
12181
12181
  }
12182
12182
  } else {
12183
12183
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -14330,7 +14330,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
14330
14330
 
14331
14331
  table.update(
14332
14332
  function (t) {
14333
- for (var f in r) t[f] = r[f];
14333
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
14334
14334
  },
14335
14335
  table.data.indexOf(toreplace),
14336
14336
  params
@@ -16162,7 +16162,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16162
16162
  });
16163
16163
  } else {
16164
16164
 
16165
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
16165
+ // 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]};';
16166
16166
  sw = JSONtoJS(values);
16167
16167
  }
16168
16168
  }
@@ -16241,7 +16241,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16241
16241
  self.output.columns.forEach(function (col) {
16242
16242
  if (col.columnid === '*') {
16243
16243
  // For *, expand all properties
16244
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
16244
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
16245
16245
  } else {
16246
16246
  var colname = col.as || col.columnid;
16247
16247
  // Direct property access for simple columns
@@ -16320,7 +16320,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16320
16320
  if (col.columnid === '*') {
16321
16321
  // For *, expand all properties
16322
16322
  for (var key in r) {
16323
- outputRow[key] = r[key];
16323
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16324
16324
  }
16325
16325
  } else {
16326
16326
  var colname = col.as || col.columnid;
@@ -16672,7 +16672,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16672
16672
  if (col.columnid === '*') {
16673
16673
  // For *, expand all properties
16674
16674
  for (var key in r) {
16675
- outputRow[key] = r[key];
16675
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16676
16676
  }
16677
16677
  } else {
16678
16678
  var colname = col.as || col.columnid;
@@ -16743,7 +16743,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16743
16743
  if (col.columnid === '*') {
16744
16744
  // For *, expand all properties
16745
16745
  for (var key in r) {
16746
- outputRow[key] = r[key];
16746
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16747
16747
  }
16748
16748
  } else {
16749
16749
  var colname = col.as || col.columnid;
@@ -16914,7 +16914,7 @@ yy.Update.prototype.compile = function (databaseid) {
16914
16914
  if (col.columnid === '*') {
16915
16915
  // For *, use INSERTED values
16916
16916
  for (var key in inserted) {
16917
- outputRow[key] = inserted[key];
16917
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16918
16918
  }
16919
16919
  } else {
16920
16920
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.21.0 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.21.1 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.21.0
4
+ @version 4.21.1
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.21.0';
144
+ alasql.version = '4.21.1';
145
145
  alasql.build = 'develop-38bf3c39';
146
146
 
147
147
  /**
@@ -4632,11 +4632,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4632
4632
  return +obj;
4633
4633
  }
4634
4634
 
4635
- var temp = new obj.constructor(); // changed
4635
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4636
4636
 
4637
4637
  for (var key in obj) {
4638
4638
  if (obj.hasOwnProperty(key)) {
4639
- temp[key] = cloneDeep(obj[key]);
4639
+ /* 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]); }
4640
4640
  }
4641
4641
  }
4642
4642
  return temp;
@@ -4708,7 +4708,7 @@ var extend = (utils.extend = function extend(a, b) {
4708
4708
  a = a || {};
4709
4709
  for (var key in b) {
4710
4710
  if (b.hasOwnProperty(key)) {
4711
- a[key] = b[key];
4711
+ /* 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]; }
4712
4712
  }
4713
4713
  }
4714
4714
  return a;
@@ -9815,7 +9815,7 @@ yy.Select.prototype.compileGroup = function (query) {
9815
9815
  aft2 = '';
9816
9816
 
9817
9817
  if (typeof query.groupStar !== 'undefined') {
9818
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9818
+ 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];};";
9819
9819
  }
9820
9820
 
9821
9821
  s += query.selectGroup
@@ -10299,7 +10299,7 @@ function compileSelectStar(query, aliases, joinstar) {
10299
10299
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
10300
10300
  } else {
10301
10301
  // Default overwrite mode
10302
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
10302
+ 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]};';
10303
10303
  }
10304
10304
 
10305
10305
  query.dirtyColumns = true;
@@ -10779,10 +10779,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10779
10779
  self.columns.forEach(function (col) {
10780
10780
 
10781
10781
  if (col instanceof yy.Column && col.columnid === '*') {
10782
- // s += 'for(var k in g){r[k]=g[k]};';
10782
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10783
10783
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10784
10784
 
10785
- s += 'for(var k in g) {r[k]=g[k]};';
10785
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10786
10786
  return '';
10787
10787
 
10788
10788
  } else {
@@ -12143,7 +12143,7 @@ yy.Over = class Over {
12143
12143
  const allValues = this.right.map(value => value.value);
12144
12144
  const allValuesStr = allValues.join(',');
12145
12145
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
12146
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
12146
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
12147
12147
  }
12148
12148
  } else {
12149
12149
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -12177,7 +12177,7 @@ yy.Over = class Over {
12177
12177
  const allValues = this.right.map(value => value.value);
12178
12178
  const allValuesStr = allValues.join(',');
12179
12179
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
12180
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
12180
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
12181
12181
  }
12182
12182
  } else {
12183
12183
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -14330,7 +14330,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
14330
14330
 
14331
14331
  table.update(
14332
14332
  function (t) {
14333
- for (var f in r) t[f] = r[f];
14333
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
14334
14334
  },
14335
14335
  table.data.indexOf(toreplace),
14336
14336
  params
@@ -16162,7 +16162,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16162
16162
  });
16163
16163
  } else {
16164
16164
 
16165
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
16165
+ // 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]};';
16166
16166
  sw = JSONtoJS(values);
16167
16167
  }
16168
16168
  }
@@ -16241,7 +16241,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16241
16241
  self.output.columns.forEach(function (col) {
16242
16242
  if (col.columnid === '*') {
16243
16243
  // For *, expand all properties
16244
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
16244
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
16245
16245
  } else {
16246
16246
  var colname = col.as || col.columnid;
16247
16247
  // Direct property access for simple columns
@@ -16320,7 +16320,7 @@ yy.Insert.prototype.compile = function (databaseid) {
16320
16320
  if (col.columnid === '*') {
16321
16321
  // For *, expand all properties
16322
16322
  for (var key in r) {
16323
- outputRow[key] = r[key];
16323
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16324
16324
  }
16325
16325
  } else {
16326
16326
  var colname = col.as || col.columnid;
@@ -16672,7 +16672,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16672
16672
  if (col.columnid === '*') {
16673
16673
  // For *, expand all properties
16674
16674
  for (var key in r) {
16675
- outputRow[key] = r[key];
16675
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16676
16676
  }
16677
16677
  } else {
16678
16678
  var colname = col.as || col.columnid;
@@ -16743,7 +16743,7 @@ yy.Delete.prototype.compile = function (databaseid) {
16743
16743
  if (col.columnid === '*') {
16744
16744
  // For *, expand all properties
16745
16745
  for (var key in r) {
16746
- outputRow[key] = r[key];
16746
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
16747
16747
  }
16748
16748
  } else {
16749
16749
  var colname = col.as || col.columnid;
@@ -16914,7 +16914,7 @@ yy.Update.prototype.compile = function (databaseid) {
16914
16914
  if (col.columnid === '*') {
16915
16915
  // For *, use INSERTED values
16916
16916
  for (var key in inserted) {
16917
- outputRow[key] = inserted[key];
16917
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16918
16918
  }
16919
16919
  } else {
16920
16920
  var colname = col.as || col.columnid;