alasql 4.15.0 → 4.15.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.15.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.14.0 build: develop-3b8d5542 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.15.1 build: develop-3b8d5542 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.14.0
4
+ @version 4.15.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.14.0 build: develop-3b8d5542 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.15.1 build: develop-3b8d5542 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.14.0
4
+ @version 4.15.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.14.0';
144
+ alasql.version = '4.15.1';
145
145
  alasql.build = 'develop-3b8d5542';
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;
@@ -9331,7 +9331,7 @@ yy.Select.prototype.compileGroup = function (query) {
9331
9331
  aft2 = '';
9332
9332
 
9333
9333
  if (typeof query.groupStar !== 'undefined') {
9334
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9334
+ 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];};";
9335
9335
  }
9336
9336
 
9337
9337
  s += query.selectGroup
@@ -9793,7 +9793,7 @@ function compileSelectStar(query, aliases, joinstar) {
9793
9793
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9794
9794
  } else {
9795
9795
  // Default overwrite mode
9796
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9796
+ 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]};';
9797
9797
  }
9798
9798
 
9799
9799
  query.dirtyColumns = true;
@@ -10232,10 +10232,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10232
10232
  self.columns.forEach(function (col) {
10233
10233
 
10234
10234
  if (col instanceof yy.Column && col.columnid === '*') {
10235
- // s += 'for(var k in g){r[k]=g[k]};';
10235
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10236
10236
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10237
10237
 
10238
- s += 'for(var k in g) {r[k]=g[k]};';
10238
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10239
10239
  return '';
10240
10240
 
10241
10241
  } else {
@@ -11537,7 +11537,7 @@ yy.Over = class Over {
11537
11537
  const allValues = this.right.map(value => value.value);
11538
11538
  const allValuesStr = allValues.join(',');
11539
11539
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11540
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11540
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11541
11541
  }
11542
11542
  } else {
11543
11543
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11571,7 +11571,7 @@ yy.Over = class Over {
11571
11571
  const allValues = this.right.map(value => value.value);
11572
11572
  const allValuesStr = allValues.join(',');
11573
11573
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11574
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11574
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11575
11575
  }
11576
11576
  } else {
11577
11577
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13521,7 +13521,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13521
13521
 
13522
13522
  table.update(
13523
13523
  function (t) {
13524
- for (var f in r) t[f] = r[f];
13524
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13525
13525
  },
13526
13526
  table.data.indexOf(toreplace),
13527
13527
  params
@@ -15272,7 +15272,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15272
15272
  });
15273
15273
  } else {
15274
15274
 
15275
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15275
+ // 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]};';
15276
15276
  sw = JSONtoJS(values);
15277
15277
  }
15278
15278
  }
@@ -15351,7 +15351,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15351
15351
  self.output.columns.forEach(function (col) {
15352
15352
  if (col.columnid === '*') {
15353
15353
  // For *, expand all properties
15354
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15354
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15355
15355
  } else {
15356
15356
  var colname = col.as || col.columnid;
15357
15357
  // Direct property access for simple columns
@@ -15430,7 +15430,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15430
15430
  if (col.columnid === '*') {
15431
15431
  // For *, expand all properties
15432
15432
  for (var key in r) {
15433
- outputRow[key] = r[key];
15433
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15434
15434
  }
15435
15435
  } else {
15436
15436
  var colname = col.as || col.columnid;
@@ -15781,7 +15781,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15781
15781
  if (col.columnid === '*') {
15782
15782
  // For *, expand all properties
15783
15783
  for (var key in r) {
15784
- outputRow[key] = r[key];
15784
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15785
15785
  }
15786
15786
  } else {
15787
15787
  var colname = col.as || col.columnid;
@@ -15852,7 +15852,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15852
15852
  if (col.columnid === '*') {
15853
15853
  // For *, expand all properties
15854
15854
  for (var key in r) {
15855
- outputRow[key] = r[key];
15855
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15856
15856
  }
15857
15857
  } else {
15858
15858
  var colname = col.as || col.columnid;
@@ -16022,7 +16022,7 @@ yy.Update.prototype.compile = function (databaseid) {
16022
16022
  if (col.columnid === '*') {
16023
16023
  // For *, use INSERTED values
16024
16024
  for (var key in inserted) {
16025
- outputRow[key] = inserted[key];
16025
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16026
16026
  }
16027
16027
  } else {
16028
16028
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.14.0 build: develop-3b8d5542 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.15.1 build: develop-3b8d5542 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.14.0
4
+ @version 4.15.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.14.0';
144
+ alasql.version = '4.15.1';
145
145
  alasql.build = 'develop-3b8d5542';
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;
@@ -9331,7 +9331,7 @@ yy.Select.prototype.compileGroup = function (query) {
9331
9331
  aft2 = '';
9332
9332
 
9333
9333
  if (typeof query.groupStar !== 'undefined') {
9334
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9334
+ 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];};";
9335
9335
  }
9336
9336
 
9337
9337
  s += query.selectGroup
@@ -9793,7 +9793,7 @@ function compileSelectStar(query, aliases, joinstar) {
9793
9793
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9794
9794
  } else {
9795
9795
  // Default overwrite mode
9796
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9796
+ 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]};';
9797
9797
  }
9798
9798
 
9799
9799
  query.dirtyColumns = true;
@@ -10232,10 +10232,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
10232
10232
  self.columns.forEach(function (col) {
10233
10233
 
10234
10234
  if (col instanceof yy.Column && col.columnid === '*') {
10235
- // s += 'for(var k in g){r[k]=g[k]};';
10235
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10236
10236
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
10237
10237
 
10238
- s += 'for(var k in g) {r[k]=g[k]};';
10238
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
10239
10239
  return '';
10240
10240
 
10241
10241
  } else {
@@ -11537,7 +11537,7 @@ yy.Over = class Over {
11537
11537
  const allValues = this.right.map(value => value.value);
11538
11538
  const allValuesStr = allValues.join(',');
11539
11539
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11540
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11540
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11541
11541
  }
11542
11542
  } else {
11543
11543
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11571,7 +11571,7 @@ yy.Over = class Over {
11571
11571
  const allValues = this.right.map(value => value.value);
11572
11572
  const allValuesStr = allValues.join(',');
11573
11573
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11574
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11574
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11575
11575
  }
11576
11576
  } else {
11577
11577
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13521,7 +13521,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13521
13521
 
13522
13522
  table.update(
13523
13523
  function (t) {
13524
- for (var f in r) t[f] = r[f];
13524
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13525
13525
  },
13526
13526
  table.data.indexOf(toreplace),
13527
13527
  params
@@ -15272,7 +15272,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15272
15272
  });
15273
15273
  } else {
15274
15274
 
15275
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
15275
+ // 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]};';
15276
15276
  sw = JSONtoJS(values);
15277
15277
  }
15278
15278
  }
@@ -15351,7 +15351,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15351
15351
  self.output.columns.forEach(function (col) {
15352
15352
  if (col.columnid === '*') {
15353
15353
  // For *, expand all properties
15354
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15354
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15355
15355
  } else {
15356
15356
  var colname = col.as || col.columnid;
15357
15357
  // Direct property access for simple columns
@@ -15430,7 +15430,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15430
15430
  if (col.columnid === '*') {
15431
15431
  // For *, expand all properties
15432
15432
  for (var key in r) {
15433
- outputRow[key] = r[key];
15433
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15434
15434
  }
15435
15435
  } else {
15436
15436
  var colname = col.as || col.columnid;
@@ -15781,7 +15781,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15781
15781
  if (col.columnid === '*') {
15782
15782
  // For *, expand all properties
15783
15783
  for (var key in r) {
15784
- outputRow[key] = r[key];
15784
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15785
15785
  }
15786
15786
  } else {
15787
15787
  var colname = col.as || col.columnid;
@@ -15852,7 +15852,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15852
15852
  if (col.columnid === '*') {
15853
15853
  // For *, expand all properties
15854
15854
  for (var key in r) {
15855
- outputRow[key] = r[key];
15855
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15856
15856
  }
15857
15857
  } else {
15858
15858
  var colname = col.as || col.columnid;
@@ -16022,7 +16022,7 @@ yy.Update.prototype.compile = function (databaseid) {
16022
16022
  if (col.columnid === '*') {
16023
16023
  // For *, use INSERTED values
16024
16024
  for (var key in inserted) {
16025
- outputRow[key] = inserted[key];
16025
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
16026
16026
  }
16027
16027
  } else {
16028
16028
  var colname = col.as || col.columnid;