alasql 4.16.0 → 4.16.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.16.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.15.0 build: develop-ff717ec7 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.16.1 build: develop-ff717ec7 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.15.0
4
+ @version 4.16.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.15.0 build: develop-ff717ec7 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.16.1 build: develop-ff717ec7 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.15.0
4
+ @version 4.16.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.15.0';
144
+ alasql.version = '4.16.1';
145
145
  alasql.build = 'develop-ff717ec7';
146
146
 
147
147
  /**
@@ -4522,11 +4522,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4522
4522
  return +obj;
4523
4523
  }
4524
4524
 
4525
- var temp = new obj.constructor(); // changed
4525
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4526
4526
 
4527
4527
  for (var key in obj) {
4528
4528
  if (obj.hasOwnProperty(key)) {
4529
- temp[key] = cloneDeep(obj[key]);
4529
+ /* 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]); }
4530
4530
  }
4531
4531
  }
4532
4532
  return temp;
@@ -4598,7 +4598,7 @@ var extend = (utils.extend = function extend(a, b) {
4598
4598
  a = a || {};
4599
4599
  for (var key in b) {
4600
4600
  if (b.hasOwnProperty(key)) {
4601
- a[key] = b[key];
4601
+ /* 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]; }
4602
4602
  }
4603
4603
  }
4604
4604
  return a;
@@ -9342,7 +9342,7 @@ yy.Select.prototype.compileGroup = function (query) {
9342
9342
  aft2 = '';
9343
9343
 
9344
9344
  if (typeof query.groupStar !== 'undefined') {
9345
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9345
+ 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];};";
9346
9346
  }
9347
9347
 
9348
9348
  s += query.selectGroup
@@ -9804,7 +9804,7 @@ function compileSelectStar(query, aliases, joinstar) {
9804
9804
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9805
9805
  } else {
9806
9806
  // Default overwrite mode
9807
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9807
+ 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]};';
9808
9808
  }
9809
9809
 
9810
9810
  query.dirtyColumns = true;
@@ -10243,10 +10243,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10243
10243
  self.columns.forEach(function (col) {
10244
10244
 
10245
10245
  if (col instanceof yy.Column && col.columnid === '*') {
10246
- // s += 'for(var k in g){r[k]=g[k]};';
10246
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10247
10247
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10248
10248
 
10249
- s += 'for(var k in g) {r[k]=g[k]};';
10249
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10250
10250
  return '';
10251
10251
 
10252
10252
  } else {
@@ -11548,7 +11548,7 @@ yy.Over = class Over {
11548
11548
  const allValues = this.right.map(value => value.value);
11549
11549
  const allValuesStr = allValues.join(',');
11550
11550
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11551
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11551
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11552
11552
  }
11553
11553
  } else {
11554
11554
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11582,7 +11582,7 @@ yy.Over = class Over {
11582
11582
  const allValues = this.right.map(value => value.value);
11583
11583
  const allValuesStr = allValues.join(',');
11584
11584
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11585
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11585
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11586
11586
  }
11587
11587
  } else {
11588
11588
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13553,7 +13553,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13553
13553
 
13554
13554
  table.update(
13555
13555
  function (t) {
13556
- for (var f in r) t[f] = r[f];
13556
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13557
13557
  },
13558
13558
  table.data.indexOf(toreplace),
13559
13559
  params
@@ -15324,7 +15324,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15324
15324
  });
15325
15325
  } else {
15326
15326
 
15327
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15327
+ // 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]};';
15328
15328
  sw = JSONtoJS(values);
15329
15329
  }
15330
15330
  }
@@ -15403,7 +15403,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15403
15403
  self.output.columns.forEach(function (col) {
15404
15404
  if (col.columnid === '*') {
15405
15405
  // For *, expand all properties
15406
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15406
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15407
15407
  } else {
15408
15408
  var colname = col.as || col.columnid;
15409
15409
  // Direct property access for simple columns
@@ -15482,7 +15482,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15482
15482
  if (col.columnid === '*') {
15483
15483
  // For *, expand all properties
15484
15484
  for (var key in r) {
15485
- outputRow[key] = r[key];
15485
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15486
15486
  }
15487
15487
  } else {
15488
15488
  var colname = col.as || col.columnid;
@@ -15833,7 +15833,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15833
15833
  if (col.columnid === '*') {
15834
15834
  // For *, expand all properties
15835
15835
  for (var key in r) {
15836
- outputRow[key] = r[key];
15836
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15837
15837
  }
15838
15838
  } else {
15839
15839
  var colname = col.as || col.columnid;
@@ -15904,7 +15904,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15904
15904
  if (col.columnid === '*') {
15905
15905
  // For *, expand all properties
15906
15906
  for (var key in r) {
15907
- outputRow[key] = r[key];
15907
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15908
15908
  }
15909
15909
  } else {
15910
15910
  var colname = col.as || col.columnid;
@@ -16074,7 +16074,7 @@ yy.Update.prototype.compile = function (databaseid) {
16074
16074
  if (col.columnid === '*') {
16075
16075
  // For *, use INSERTED values
16076
16076
  for (var key in inserted) {
16077
- outputRow[key] = inserted[key];
16077
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16078
16078
  }
16079
16079
  } else {
16080
16080
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.15.0 build: develop-ff717ec7 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.16.1 build: develop-ff717ec7 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.15.0
4
+ @version 4.16.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.15.0';
144
+ alasql.version = '4.16.1';
145
145
  alasql.build = 'develop-ff717ec7';
146
146
 
147
147
  /**
@@ -4522,11 +4522,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4522
4522
  return +obj;
4523
4523
  }
4524
4524
 
4525
- var temp = new obj.constructor(); // changed
4525
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4526
4526
 
4527
4527
  for (var key in obj) {
4528
4528
  if (obj.hasOwnProperty(key)) {
4529
- temp[key] = cloneDeep(obj[key]);
4529
+ /* 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]); }
4530
4530
  }
4531
4531
  }
4532
4532
  return temp;
@@ -4598,7 +4598,7 @@ var extend = (utils.extend = function extend(a, b) {
4598
4598
  a = a || {};
4599
4599
  for (var key in b) {
4600
4600
  if (b.hasOwnProperty(key)) {
4601
- a[key] = b[key];
4601
+ /* 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]; }
4602
4602
  }
4603
4603
  }
4604
4604
  return a;
@@ -9342,7 +9342,7 @@ yy.Select.prototype.compileGroup = function (query) {
9342
9342
  aft2 = '';
9343
9343
 
9344
9344
  if (typeof query.groupStar !== 'undefined') {
9345
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9345
+ 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];};";
9346
9346
  }
9347
9347
 
9348
9348
  s += query.selectGroup
@@ -9804,7 +9804,7 @@ function compileSelectStar(query, aliases, joinstar) {
9804
9804
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9805
9805
  } else {
9806
9806
  // Default overwrite mode
9807
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9807
+ 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]};';
9808
9808
  }
9809
9809
 
9810
9810
  query.dirtyColumns = true;
@@ -10243,10 +10243,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10243
10243
  self.columns.forEach(function (col) {
10244
10244
 
10245
10245
  if (col instanceof yy.Column && col.columnid === '*') {
10246
- // s += 'for(var k in g){r[k]=g[k]};';
10246
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10247
10247
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10248
10248
 
10249
- s += 'for(var k in g) {r[k]=g[k]};';
10249
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10250
10250
  return '';
10251
10251
 
10252
10252
  } else {
@@ -11548,7 +11548,7 @@ yy.Over = class Over {
11548
11548
  const allValues = this.right.map(value => value.value);
11549
11549
  const allValuesStr = allValues.join(',');
11550
11550
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11551
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11551
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11552
11552
  }
11553
11553
  } else {
11554
11554
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11582,7 +11582,7 @@ yy.Over = class Over {
11582
11582
  const allValues = this.right.map(value => value.value);
11583
11583
  const allValuesStr = allValues.join(',');
11584
11584
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11585
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11585
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11586
11586
  }
11587
11587
  } else {
11588
11588
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13553,7 +13553,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13553
13553
 
13554
13554
  table.update(
13555
13555
  function (t) {
13556
- for (var f in r) t[f] = r[f];
13556
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13557
13557
  },
13558
13558
  table.data.indexOf(toreplace),
13559
13559
  params
@@ -15324,7 +15324,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15324
15324
  });
15325
15325
  } else {
15326
15326
 
15327
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15327
+ // 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]};';
15328
15328
  sw = JSONtoJS(values);
15329
15329
  }
15330
15330
  }
@@ -15403,7 +15403,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15403
15403
  self.output.columns.forEach(function (col) {
15404
15404
  if (col.columnid === '*') {
15405
15405
  // For *, expand all properties
15406
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15406
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15407
15407
  } else {
15408
15408
  var colname = col.as || col.columnid;
15409
15409
  // Direct property access for simple columns
@@ -15482,7 +15482,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15482
15482
  if (col.columnid === '*') {
15483
15483
  // For *, expand all properties
15484
15484
  for (var key in r) {
15485
- outputRow[key] = r[key];
15485
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15486
15486
  }
15487
15487
  } else {
15488
15488
  var colname = col.as || col.columnid;
@@ -15833,7 +15833,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15833
15833
  if (col.columnid === '*') {
15834
15834
  // For *, expand all properties
15835
15835
  for (var key in r) {
15836
- outputRow[key] = r[key];
15836
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15837
15837
  }
15838
15838
  } else {
15839
15839
  var colname = col.as || col.columnid;
@@ -15904,7 +15904,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15904
15904
  if (col.columnid === '*') {
15905
15905
  // For *, expand all properties
15906
15906
  for (var key in r) {
15907
- outputRow[key] = r[key];
15907
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15908
15908
  }
15909
15909
  } else {
15910
15910
  var colname = col.as || col.columnid;
@@ -16074,7 +16074,7 @@ yy.Update.prototype.compile = function (databaseid) {
16074
16074
  if (col.columnid === '*') {
16075
16075
  // For *, use INSERTED values
16076
16076
  for (var key in inserted) {
16077
- outputRow[key] = inserted[key];
16077
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16078
16078
  }
16079
16079
  } else {
16080
16080
  var colname = col.as || col.columnid;