alasql 4.12.0 → 4.12.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.12.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.11.0 build: develop-9b30298b | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.12.1 build: develop-9b30298b | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.11.0
4
+ @version 4.12.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.11.0 build: develop-9b30298b | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.12.1 build: develop-9b30298b | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.11.0
4
+ @version 4.12.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.11.0';
144
+ alasql.version = '4.12.1';
145
145
  alasql.build = 'develop-9b30298b';
146
146
 
147
147
  /**
@@ -4234,11 +4234,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4234
4234
  return +obj;
4235
4235
  }
4236
4236
 
4237
- var temp = new obj.constructor(); // changed
4237
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4238
4238
 
4239
4239
  for (var key in obj) {
4240
4240
  if (obj.hasOwnProperty(key)) {
4241
- temp[key] = cloneDeep(obj[key]);
4241
+ /* 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]); }
4242
4242
  }
4243
4243
  }
4244
4244
  return temp;
@@ -4310,7 +4310,7 @@ var extend = (utils.extend = function extend(a, b) {
4310
4310
  a = a || {};
4311
4311
  for (var key in b) {
4312
4312
  if (b.hasOwnProperty(key)) {
4313
- a[key] = b[key];
4313
+ /* 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]; }
4314
4314
  }
4315
4315
  }
4316
4316
  return a;
@@ -8970,7 +8970,7 @@ yy.Select.prototype.compileGroup = function (query) {
8970
8970
  aft2 = '';
8971
8971
 
8972
8972
  if (typeof query.groupStar !== 'undefined') {
8973
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8973
+ 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];};";
8974
8974
  }
8975
8975
 
8976
8976
  s += query.selectGroup
@@ -9432,7 +9432,7 @@ function compileSelectStar(query, aliases, joinstar) {
9432
9432
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9433
9433
  } else {
9434
9434
  // Default overwrite mode
9435
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9435
+ 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]};';
9436
9436
  }
9437
9437
 
9438
9438
  query.dirtyColumns = true;
@@ -9871,10 +9871,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9871
9871
  self.columns.forEach(function (col) {
9872
9872
 
9873
9873
  if (col instanceof yy.Column && col.columnid === '*') {
9874
- // s += 'for(var k in g){r[k]=g[k]};';
9874
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9875
9875
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9876
9876
 
9877
- s += 'for(var k in g) {r[k]=g[k]};';
9877
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9878
9878
  return '';
9879
9879
 
9880
9880
  } else {
@@ -11176,7 +11176,7 @@ yy.Over = class Over {
11176
11176
  const allValues = this.right.map(value => value.value);
11177
11177
  const allValuesStr = allValues.join(',');
11178
11178
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11179
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11179
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11180
11180
  }
11181
11181
  } else {
11182
11182
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11210,7 +11210,7 @@ yy.Over = class Over {
11210
11210
  const allValues = this.right.map(value => value.value);
11211
11211
  const allValuesStr = allValues.join(',');
11212
11212
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11213
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11213
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11214
11214
  }
11215
11215
  } else {
11216
11216
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13141,7 +13141,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13141
13141
 
13142
13142
  table.update(
13143
13143
  function (t) {
13144
- for (var f in r) t[f] = r[f];
13144
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13145
13145
  },
13146
13146
  table.data.indexOf(toreplace),
13147
13147
  params
@@ -14904,7 +14904,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14904
14904
  });
14905
14905
  } else {
14906
14906
 
14907
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14907
+ // 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]};';
14908
14908
  sw = JSONtoJS(values);
14909
14909
  }
14910
14910
  }
@@ -14983,7 +14983,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14983
14983
  self.output.columns.forEach(function (col) {
14984
14984
  if (col.columnid === '*') {
14985
14985
  // For *, expand all properties
14986
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
14986
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
14987
14987
  } else {
14988
14988
  var colname = col.as || col.columnid;
14989
14989
  // Direct property access for simple columns
@@ -15062,7 +15062,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15062
15062
  if (col.columnid === '*') {
15063
15063
  // For *, expand all properties
15064
15064
  for (var key in r) {
15065
- outputRow[key] = r[key];
15065
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15066
15066
  }
15067
15067
  } else {
15068
15068
  var colname = col.as || col.columnid;
@@ -15381,7 +15381,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15381
15381
  if (col.columnid === '*') {
15382
15382
  // For *, expand all properties
15383
15383
  for (var key in r) {
15384
- outputRow[key] = r[key];
15384
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15385
15385
  }
15386
15386
  } else {
15387
15387
  var colname = col.as || col.columnid;
@@ -15452,7 +15452,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15452
15452
  if (col.columnid === '*') {
15453
15453
  // For *, expand all properties
15454
15454
  for (var key in r) {
15455
- outputRow[key] = r[key];
15455
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15456
15456
  }
15457
15457
  } else {
15458
15458
  var colname = col.as || col.columnid;
@@ -15617,7 +15617,7 @@ yy.Update.prototype.compile = function (databaseid) {
15617
15617
  if (col.columnid === '*') {
15618
15618
  // For *, use INSERTED values
15619
15619
  for (var key in inserted) {
15620
- outputRow[key] = inserted[key];
15620
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
15621
15621
  }
15622
15622
  } else {
15623
15623
  var colname = col.as || col.columnid;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.11.0 build: develop-9b30298b | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.12.1 build: develop-9b30298b | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.11.0
4
+ @version 4.12.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.11.0';
144
+ alasql.version = '4.12.1';
145
145
  alasql.build = 'develop-9b30298b';
146
146
 
147
147
  /**
@@ -4234,11 +4234,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
4234
4234
  return +obj;
4235
4235
  }
4236
4236
 
4237
- var temp = new obj.constructor(); // changed
4237
+ var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
4238
4238
 
4239
4239
  for (var key in obj) {
4240
4240
  if (obj.hasOwnProperty(key)) {
4241
- temp[key] = cloneDeep(obj[key]);
4241
+ /* 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]); }
4242
4242
  }
4243
4243
  }
4244
4244
  return temp;
@@ -4310,7 +4310,7 @@ var extend = (utils.extend = function extend(a, b) {
4310
4310
  a = a || {};
4311
4311
  for (var key in b) {
4312
4312
  if (b.hasOwnProperty(key)) {
4313
- a[key] = b[key];
4313
+ /* 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]; }
4314
4314
  }
4315
4315
  }
4316
4316
  return a;
@@ -8970,7 +8970,7 @@ yy.Select.prototype.compileGroup = function (query) {
8970
8970
  aft2 = '';
8971
8971
 
8972
8972
  if (typeof query.groupStar !== 'undefined') {
8973
- aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
8973
+ 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];};";
8974
8974
  }
8975
8975
 
8976
8976
  s += query.selectGroup
@@ -9432,7 +9432,7 @@ function compileSelectStar(query, aliases, joinstar) {
9432
9432
  'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
9433
9433
  } else {
9434
9434
  // Default overwrite mode
9435
- sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
9435
+ 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]};';
9436
9436
  }
9437
9437
 
9438
9438
  query.dirtyColumns = true;
@@ -9871,10 +9871,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
9871
9871
  self.columns.forEach(function (col) {
9872
9872
 
9873
9873
  if (col instanceof yy.Column && col.columnid === '*') {
9874
- // s += 'for(var k in g){r[k]=g[k]};';
9874
+ // s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9875
9875
  // s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
9876
9876
 
9877
- s += 'for(var k in g) {r[k]=g[k]};';
9877
+ s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
9878
9878
  return '';
9879
9879
 
9880
9880
  } else {
@@ -11176,7 +11176,7 @@ yy.Over = class Over {
11176
11176
  const allValues = this.right.map(value => value.value);
11177
11177
  const allValuesStr = allValues.join(',');
11178
11178
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11179
- s = `alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11179
+ s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11180
11180
  }
11181
11181
  } else {
11182
11182
  s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
@@ -11210,7 +11210,7 @@ yy.Over = class Over {
11210
11210
  const allValues = this.right.map(value => value.value);
11211
11211
  const allValuesStr = allValues.join(',');
11212
11212
  alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
11213
- s = `!alasql.sets["${allValuesStr}"].has(alasql.utils.getValueOf(${leftJS()}))`;
11213
+ s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
11214
11214
  }
11215
11215
  } else {
11216
11216
  s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
@@ -13141,7 +13141,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
13141
13141
 
13142
13142
  table.update(
13143
13143
  function (t) {
13144
- for (var f in r) t[f] = r[f];
13144
+ for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
13145
13145
  },
13146
13146
  table.data.indexOf(toreplace),
13147
13147
  params
@@ -14904,7 +14904,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14904
14904
  });
14905
14905
  } else {
14906
14906
 
14907
- // sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
14907
+ // 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]};';
14908
14908
  sw = JSONtoJS(values);
14909
14909
  }
14910
14910
  }
@@ -14983,7 +14983,7 @@ yy.Insert.prototype.compile = function (databaseid) {
14983
14983
  self.output.columns.forEach(function (col) {
14984
14984
  if (col.columnid === '*') {
14985
14985
  // For *, expand all properties
14986
- s += 'for(var key in r){ outputRow[key] = r[key]; }';
14986
+ s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
14987
14987
  } else {
14988
14988
  var colname = col.as || col.columnid;
14989
14989
  // Direct property access for simple columns
@@ -15062,7 +15062,7 @@ yy.Insert.prototype.compile = function (databaseid) {
15062
15062
  if (col.columnid === '*') {
15063
15063
  // For *, expand all properties
15064
15064
  for (var key in r) {
15065
- outputRow[key] = r[key];
15065
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15066
15066
  }
15067
15067
  } else {
15068
15068
  var colname = col.as || col.columnid;
@@ -15381,7 +15381,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15381
15381
  if (col.columnid === '*') {
15382
15382
  // For *, expand all properties
15383
15383
  for (var key in r) {
15384
- outputRow[key] = r[key];
15384
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15385
15385
  }
15386
15386
  } else {
15387
15387
  var colname = col.as || col.columnid;
@@ -15452,7 +15452,7 @@ yy.Delete.prototype.compile = function (databaseid) {
15452
15452
  if (col.columnid === '*') {
15453
15453
  // For *, expand all properties
15454
15454
  for (var key in r) {
15455
- outputRow[key] = r[key];
15455
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
15456
15456
  }
15457
15457
  } else {
15458
15458
  var colname = col.as || col.columnid;
@@ -15617,7 +15617,7 @@ yy.Update.prototype.compile = function (databaseid) {
15617
15617
  if (col.columnid === '*') {
15618
15618
  // For *, use INSERTED values
15619
15619
  for (var key in inserted) {
15620
- outputRow[key] = inserted[key];
15620
+ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
15621
15621
  }
15622
15622
  } else {
15623
15623
  var colname = col.as || col.columnid;