alasql 4.11.0 → 4.11.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.11.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.10.1 build: develop-bc5dc5de | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.11.1 build: develop-bc5dc5de | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.10.1
4
+ @version 4.11.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.10.1 build: develop-bc5dc5de | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.11.1 build: develop-bc5dc5de | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.10.1
4
+ @version 4.11.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.10.1';
144
+ alasql.version = '4.11.1';
145
145
  alasql.build = 'develop-bc5dc5de';
146
146
 
147
147
  /**
@@ -4138,11 +4138,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4138
4138
  return +obj;
4139
4139
  }
4140
4140
 
4141
- var temp = new obj.constructor(); // changed
4141
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4142
4142
 
4143
4143
  for (var key in obj) {
4144
4144
  if (obj.hasOwnProperty(key)) {
4145
- temp[key] = cloneDeep(obj[key]);
4145
+ /* 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]); }
4146
4146
  }
4147
4147
  }
4148
4148
  return temp;
@@ -4214,7 +4214,7 @@ var extend = (utils.extend = function extend(a, b) {
4214
4214
  a = a || {};
4215
4215
  for (var key in b) {
4216
4216
  if (b.hasOwnProperty(key)) {
4217
- a[key] = b[key];
4217
+ /* 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]; }
4218
4218
  }
4219
4219
  }
4220
4220
  return a;
@@ -8871,7 +8871,7 @@ yy.Select.prototype.compileGroup = function (query) {
8871
8871
  aft2 = '';
8872
8872
 
8873
8873
  if (typeof query.groupStar !== 'undefined') {
8874
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8874
+ 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];};";
8875
8875
  }
8876
8876
 
8877
8877
  s += query.selectGroup
@@ -9320,7 +9320,7 @@ function compileSelectStar(query, aliases, joinstar) {
9320
9320
  } else {
9321
9321
 
9322
9322
  // if column not exist, then copy all
9323
- sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
9323
+ sp += 'var w=p["' + alias + '"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
9324
9324
 
9325
9325
  query.dirtyColumns = true;
9326
9326
  }
@@ -9740,10 +9740,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9740
9740
  self.columns.forEach(function (col) {
9741
9741
 
9742
9742
  if (col instanceof yy.Column && col.columnid === '*') {
9743
- // s += 'for(var k in g){r[k]=g[k]};';
9743
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9744
9744
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9745
9745
 
9746
- s += 'for(var k in g) {r[k]=g[k]};';
9746
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9747
9747
  return '';
9748
9748
 
9749
9749
  } else {
@@ -11045,7 +11045,7 @@ yy.Over = class Over {
11045
11045
  const allValues = this.right.map(value => value.value);
11046
11046
  const allValuesStr = allValues.join(',');
11047
11047
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11048
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11048
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11049
11049
  }
11050
11050
  } else {
11051
11051
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11079,7 +11079,7 @@ yy.Over = class Over {
11079
11079
  const allValues = this.right.map(value => value.value);
11080
11080
  const allValuesStr = allValues.join(',');
11081
11081
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11082
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11082
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11083
11083
  }
11084
11084
  } else {
11085
11085
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -12995,7 +12995,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
12995
12995
 
12996
12996
  table.update(
12997
12997
  function (t) {
12998
- for (var f in r) t[f] = r[f];
12998
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
12999
12999
  },
13000
13000
  table.data.indexOf(toreplace),
13001
13001
  params
@@ -14733,7 +14733,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14733
14733
  });
14734
14734
  } else {
14735
14735
 
14736
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14736
+ // 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]};';
14737
14737
  sw = JSONtoJS(values);
14738
14738
  }
14739
14739
  }
@@ -14795,7 +14795,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14795
14795
  self.output.columns.forEach(function (col) {
14796
14796
  if (col.columnid === '*') {
14797
14797
  // For *, expand all properties
14798
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
14798
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
14799
14799
  } else {
14800
14800
  var colname = col.as || col.columnid;
14801
14801
  // Direct property access for simple columns
@@ -14864,7 +14864,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14864
14864
  if (col.columnid === '*') {
14865
14865
  // For *, expand all properties
14866
14866
  for (var key in r) {
14867
- outputRow[key] = r[key];
14867
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
14868
14868
  }
14869
14869
  } else {
14870
14870
  var colname = col.as || col.columnid;
@@ -15158,7 +15158,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15158
15158
  if (col.columnid === '*') {
15159
15159
  // For *, expand all properties
15160
15160
  for (var key in r) {
15161
- outputRow[key] = r[key];
15161
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15162
15162
  }
15163
15163
  } else {
15164
15164
  var colname = col.as || col.columnid;
@@ -15229,7 +15229,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15229
15229
  if (col.columnid === '*') {
15230
15230
  // For *, expand all properties
15231
15231
  for (var key in r) {
15232
- outputRow[key] = r[key];
15232
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15233
15233
  }
15234
15234
  } else {
15235
15235
  var colname = col.as || col.columnid;
@@ -15394,7 +15394,7 @@ yy.Update.prototype.compile = function (databaseid) {
15394
15394
  if (col.columnid === '*') {
15395
15395
  // For *, use INSERTED values
15396
15396
  for (var key in inserted) {
15397
- outputRow[key] = inserted[key];
15397
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
15398
15398
  }
15399
15399
  } else {
15400
15400
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.10.1 build: develop-bc5dc5de | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.11.1 build: develop-bc5dc5de | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.10.1
4
+ @version 4.11.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.10.1';
144
+ alasql.version = '4.11.1';
145
145
  alasql.build = 'develop-bc5dc5de';
146
146
 
147
147
  /**
@@ -4138,11 +4138,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4138
4138
  return +obj;
4139
4139
  }
4140
4140
 
4141
- var temp = new obj.constructor(); // changed
4141
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4142
4142
 
4143
4143
  for (var key in obj) {
4144
4144
  if (obj.hasOwnProperty(key)) {
4145
- temp[key] = cloneDeep(obj[key]);
4145
+ /* 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]); }
4146
4146
  }
4147
4147
  }
4148
4148
  return temp;
@@ -4214,7 +4214,7 @@ var extend = (utils.extend = function extend(a, b) {
4214
4214
  a = a || {};
4215
4215
  for (var key in b) {
4216
4216
  if (b.hasOwnProperty(key)) {
4217
- a[key] = b[key];
4217
+ /* 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]; }
4218
4218
  }
4219
4219
  }
4220
4220
  return a;
@@ -8871,7 +8871,7 @@ yy.Select.prototype.compileGroup = function (query) {
8871
8871
  aft2 = '';
8872
8872
 
8873
8873
  if (typeof query.groupStar !== 'undefined') {
8874
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8874
+ 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];};";
8875
8875
  }
8876
8876
 
8877
8877
  s += query.selectGroup
@@ -9320,7 +9320,7 @@ function compileSelectStar(query, aliases, joinstar) {
9320
9320
  } else {
9321
9321
 
9322
9322
  // if column not exist, then copy all
9323
- sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
9323
+ sp += 'var w=p["' + alias + '"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
9324
9324
 
9325
9325
  query.dirtyColumns = true;
9326
9326
  }
@@ -9740,10 +9740,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9740
9740
  self.columns.forEach(function (col) {
9741
9741
 
9742
9742
  if (col instanceof yy.Column && col.columnid === '*') {
9743
- // s += 'for(var k in g){r[k]=g[k]};';
9743
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9744
9744
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9745
9745
 
9746
- s += 'for(var k in g) {r[k]=g[k]};';
9746
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9747
9747
  return '';
9748
9748
 
9749
9749
  } else {
@@ -11045,7 +11045,7 @@ yy.Over = class Over {
11045
11045
  const allValues = this.right.map(value => value.value);
11046
11046
  const allValuesStr = allValues.join(',');
11047
11047
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11048
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11048
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11049
11049
  }
11050
11050
  } else {
11051
11051
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11079,7 +11079,7 @@ yy.Over = class Over {
11079
11079
  const allValues = this.right.map(value => value.value);
11080
11080
  const allValuesStr = allValues.join(',');
11081
11081
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11082
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11082
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11083
11083
  }
11084
11084
  } else {
11085
11085
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -12995,7 +12995,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
12995
12995
 
12996
12996
  table.update(
12997
12997
  function (t) {
12998
- for (var f in r) t[f] = r[f];
12998
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
12999
12999
  },
13000
13000
  table.data.indexOf(toreplace),
13001
13001
  params
@@ -14733,7 +14733,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14733
14733
  });
14734
14734
  } else {
14735
14735
 
14736
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14736
+ // 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]};';
14737
14737
  sw = JSONtoJS(values);
14738
14738
  }
14739
14739
  }
@@ -14795,7 +14795,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14795
14795
  self.output.columns.forEach(function (col) {
14796
14796
  if (col.columnid === '*') {
14797
14797
  // For *, expand all properties
14798
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
14798
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
14799
14799
  } else {
14800
14800
  var colname = col.as || col.columnid;
14801
14801
  // Direct property access for simple columns
@@ -14864,7 +14864,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14864
14864
  if (col.columnid === '*') {
14865
14865
  // For *, expand all properties
14866
14866
  for (var key in r) {
14867
- outputRow[key] = r[key];
14867
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
14868
14868
  }
14869
14869
  } else {
14870
14870
  var colname = col.as || col.columnid;
@@ -15158,7 +15158,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15158
15158
  if (col.columnid === '*') {
15159
15159
  // For *, expand all properties
15160
15160
  for (var key in r) {
15161
- outputRow[key] = r[key];
15161
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15162
15162
  }
15163
15163
  } else {
15164
15164
  var colname = col.as || col.columnid;
@@ -15229,7 +15229,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15229
15229
  if (col.columnid === '*') {
15230
15230
  // For *, expand all properties
15231
15231
  for (var key in r) {
15232
- outputRow[key] = r[key];
15232
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15233
15233
  }
15234
15234
  } else {
15235
15235
  var colname = col.as || col.columnid;
@@ -15394,7 +15394,7 @@ yy.Update.prototype.compile = function (databaseid) {
15394
15394
  if (col.columnid === '*') {
15395
15395
  // For *, use INSERTED values
15396
15396
  for (var key in inserted) {
15397
- outputRow[key] = inserted[key];
15397
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
15398
15398
  }
15399
15399
  } else {
15400
15400
  var colname = col.as || col.columnid;