alasql 4.14.0 → 4.14.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.14.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.13.0 build: develop-4992fcb1 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.14.1 build: develop-4992fcb1 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.13.0
4
+ @version 4.14.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.13.0 build: develop-4992fcb1 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.14.1 build: develop-4992fcb1 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.13.0
4
+ @version 4.14.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.13.0';
144
+ alasql.version = '4.14.1';
145
145
  alasql.build = 'develop-4992fcb1';
146
146
 
147
147
  /**
@@ -4240,11 +4240,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4240
4240
  return +obj;
4241
4241
  }
4242
4242
 
4243
- var temp = new obj.constructor(); // changed
4243
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4244
4244
 
4245
4245
  for (var key in obj) {
4246
4246
  if (obj.hasOwnProperty(key)) {
4247
- temp[key] = cloneDeep(obj[key]);
4247
+ /* 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]); }
4248
4248
  }
4249
4249
  }
4250
4250
  return temp;
@@ -4316,7 +4316,7 @@ var extend = (utils.extend = function extend(a, b) {
4316
4316
  a = a || {};
4317
4317
  for (var key in b) {
4318
4318
  if (b.hasOwnProperty(key)) {
4319
- a[key] = b[key];
4319
+ /* 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]; }
4320
4320
  }
4321
4321
  }
4322
4322
  return a;
@@ -9017,7 +9017,7 @@ yy.Select.prototype.compileGroup = function (query) {
9017
9017
  aft2 = '';
9018
9018
 
9019
9019
  if (typeof query.groupStar !== 'undefined') {
9020
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9020
+ 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];};";
9021
9021
  }
9022
9022
 
9023
9023
  s += query.selectGroup
@@ -9479,7 +9479,7 @@ function compileSelectStar(query, aliases, joinstar) {
9479
9479
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9480
9480
  } else {
9481
9481
  // Default overwrite mode
9482
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9482
+ 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]};';
9483
9483
  }
9484
9484
 
9485
9485
  query.dirtyColumns = true;
@@ -9918,10 +9918,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9918
9918
  self.columns.forEach(function (col) {
9919
9919
 
9920
9920
  if (col instanceof yy.Column && col.columnid === '*') {
9921
- // s += 'for(var k in g){r[k]=g[k]};';
9921
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9922
9922
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9923
9923
 
9924
- s += 'for(var k in g) {r[k]=g[k]};';
9924
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9925
9925
  return '';
9926
9926
 
9927
9927
  } else {
@@ -11223,7 +11223,7 @@ yy.Over = class Over {
11223
11223
  const allValues = this.right.map(value => value.value);
11224
11224
  const allValuesStr = allValues.join(',');
11225
11225
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11226
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11226
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11227
11227
  }
11228
11228
  } else {
11229
11229
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11257,7 +11257,7 @@ yy.Over = class Over {
11257
11257
  const allValues = this.right.map(value => value.value);
11258
11258
  const allValuesStr = allValues.join(',');
11259
11259
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11260
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11260
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11261
11261
  }
11262
11262
  } else {
11263
11263
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13188,7 +13188,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13188
13188
 
13189
13189
  table.update(
13190
13190
  function (t) {
13191
- for (var f in r) t[f] = r[f];
13191
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13192
13192
  },
13193
13193
  table.data.indexOf(toreplace),
13194
13194
  params
@@ -14957,7 +14957,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14957
14957
  });
14958
14958
  } else {
14959
14959
 
14960
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14960
+ // 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]};';
14961
14961
  sw = JSONtoJS(values);
14962
14962
  }
14963
14963
  }
@@ -15036,7 +15036,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15036
15036
  self.output.columns.forEach(function (col) {
15037
15037
  if (col.columnid === '*') {
15038
15038
  // For *, expand all properties
15039
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15039
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15040
15040
  } else {
15041
15041
  var colname = col.as || col.columnid;
15042
15042
  // Direct property access for simple columns
@@ -15115,7 +15115,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15115
15115
  if (col.columnid === '*') {
15116
15116
  // For *, expand all properties
15117
15117
  for (var key in r) {
15118
- outputRow[key] = r[key];
15118
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15119
15119
  }
15120
15120
  } else {
15121
15121
  var colname = col.as || col.columnid;
@@ -15440,7 +15440,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15440
15440
  if (col.columnid === '*') {
15441
15441
  // For *, expand all properties
15442
15442
  for (var key in r) {
15443
- outputRow[key] = r[key];
15443
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15444
15444
  }
15445
15445
  } else {
15446
15446
  var colname = col.as || col.columnid;
@@ -15511,7 +15511,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15511
15511
  if (col.columnid === '*') {
15512
15512
  // For *, expand all properties
15513
15513
  for (var key in r) {
15514
- outputRow[key] = r[key];
15514
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15515
15515
  }
15516
15516
  } else {
15517
15517
  var colname = col.as || col.columnid;
@@ -15681,7 +15681,7 @@ yy.Update.prototype.compile = function (databaseid) {
15681
15681
  if (col.columnid === '*') {
15682
15682
  // For *, use INSERTED values
15683
15683
  for (var key in inserted) {
15684
- outputRow[key] = inserted[key];
15684
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
15685
15685
  }
15686
15686
  } else {
15687
15687
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.13.0 build: develop-4992fcb1 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.14.1 build: develop-4992fcb1 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.13.0
4
+ @version 4.14.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.13.0';
144
+ alasql.version = '4.14.1';
145
145
  alasql.build = 'develop-4992fcb1';
146
146
 
147
147
  /**
@@ -4240,11 +4240,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4240
4240
  return +obj;
4241
4241
  }
4242
4242
 
4243
- var temp = new obj.constructor(); // changed
4243
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4244
4244
 
4245
4245
  for (var key in obj) {
4246
4246
  if (obj.hasOwnProperty(key)) {
4247
- temp[key] = cloneDeep(obj[key]);
4247
+ /* 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]); }
4248
4248
  }
4249
4249
  }
4250
4250
  return temp;
@@ -4316,7 +4316,7 @@ var extend = (utils.extend = function extend(a, b) {
4316
4316
  a = a || {};
4317
4317
  for (var key in b) {
4318
4318
  if (b.hasOwnProperty(key)) {
4319
- a[key] = b[key];
4319
+ /* 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]; }
4320
4320
  }
4321
4321
  }
4322
4322
  return a;
@@ -9017,7 +9017,7 @@ yy.Select.prototype.compileGroup = function (query) {
9017
9017
  aft2 = '';
9018
9018
 
9019
9019
  if (typeof query.groupStar !== 'undefined') {
9020
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
9020
+ 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];};";
9021
9021
  }
9022
9022
 
9023
9023
  s += query.selectGroup
@@ -9479,7 +9479,7 @@ function compileSelectStar(query, aliases, joinstar) {
9479
9479
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9480
9480
  } else {
9481
9481
  // Default overwrite mode
9482
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9482
+ 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]};';
9483
9483
  }
9484
9484
 
9485
9485
  query.dirtyColumns = true;
@@ -9918,10 +9918,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9918
9918
  self.columns.forEach(function (col) {
9919
9919
 
9920
9920
  if (col instanceof yy.Column && col.columnid === '*') {
9921
- // s += 'for(var k in g){r[k]=g[k]};';
9921
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9922
9922
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9923
9923
 
9924
- s += 'for(var k in g) {r[k]=g[k]};';
9924
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9925
9925
  return '';
9926
9926
 
9927
9927
  } else {
@@ -11223,7 +11223,7 @@ yy.Over = class Over {
11223
11223
  const allValues = this.right.map(value => value.value);
11224
11224
  const allValuesStr = allValues.join(',');
11225
11225
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11226
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11226
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11227
11227
  }
11228
11228
  } else {
11229
11229
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11257,7 +11257,7 @@ yy.Over = class Over {
11257
11257
  const allValues = this.right.map(value => value.value);
11258
11258
  const allValuesStr = allValues.join(',');
11259
11259
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11260
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11260
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11261
11261
  }
11262
11262
  } else {
11263
11263
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13188,7 +13188,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13188
13188
 
13189
13189
  table.update(
13190
13190
  function (t) {
13191
- for (var f in r) t[f] = r[f];
13191
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13192
13192
  },
13193
13193
  table.data.indexOf(toreplace),
13194
13194
  params
@@ -14957,7 +14957,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14957
14957
  });
14958
14958
  } else {
14959
14959
 
14960
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14960
+ // 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]};';
14961
14961
  sw = JSONtoJS(values);
14962
14962
  }
14963
14963
  }
@@ -15036,7 +15036,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15036
15036
  self.output.columns.forEach(function (col) {
15037
15037
  if (col.columnid === '*') {
15038
15038
  // For *, expand all properties
15039
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
15039
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
15040
15040
  } else {
15041
15041
  var colname = col.as || col.columnid;
15042
15042
  // Direct property access for simple columns
@@ -15115,7 +15115,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15115
15115
  if (col.columnid === '*') {
15116
15116
  // For *, expand all properties
15117
15117
  for (var key in r) {
15118
- outputRow[key] = r[key];
15118
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15119
15119
  }
15120
15120
  } else {
15121
15121
  var colname = col.as || col.columnid;
@@ -15440,7 +15440,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15440
15440
  if (col.columnid === '*') {
15441
15441
  // For *, expand all properties
15442
15442
  for (var key in r) {
15443
- outputRow[key] = r[key];
15443
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15444
15444
  }
15445
15445
  } else {
15446
15446
  var colname = col.as || col.columnid;
@@ -15511,7 +15511,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15511
15511
  if (col.columnid === '*') {
15512
15512
  // For *, expand all properties
15513
15513
  for (var key in r) {
15514
- outputRow[key] = r[key];
15514
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15515
15515
  }
15516
15516
  } else {
15517
15517
  var colname = col.as || col.columnid;
@@ -15681,7 +15681,7 @@ yy.Update.prototype.compile = function (databaseid) {
15681
15681
  if (col.columnid === '*') {
15682
15682
  // For *, use INSERTED values
15683
15683
  for (var key in inserted) {
15684
- outputRow[key] = inserted[key];
15684
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
15685
15685
  }
15686
15686
  } else {
15687
15687
  var colname = col.as || col.columnid;