alasql 4.6.6 → 4.6.8
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 +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql.fs.js +21 -21
- package/dist/alasql.js +21 -21
- package/dist/alasql.min.js +15 -15
- package/package.json +1 -1
package/bin/alasql-cli.js
CHANGED
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.6.
|
|
1
|
+
//! AlaSQL v4.6.8 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.6.
|
|
4
|
+
@version 4.6.8
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2024 Andrey Gershun & Mathias Wulff
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.6.
|
|
1
|
+
//! AlaSQL v4.6.8 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.6.
|
|
4
|
+
@version 4.6.8
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2024 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.6.
|
|
144
|
+
alasql.version = '4.6.8';
|
|
145
145
|
alasql.build = 'develop-f6e298b2';
|
|
146
146
|
|
|
147
147
|
/**
|
|
@@ -2505,7 +2505,7 @@ next:function () {
|
|
|
2505
2505
|
|
|
2506
2506
|
// return next match that has a token
|
|
2507
2507
|
lex:function lex () {
|
|
2508
|
-
var r = this.next();
|
|
2508
|
+
var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
|
|
2509
2509
|
if (r) {
|
|
2510
2510
|
return r;
|
|
2511
2511
|
} else {
|
|
@@ -4048,11 +4048,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4048
4048
|
return +obj;
|
|
4049
4049
|
}
|
|
4050
4050
|
|
|
4051
|
-
var temp = new obj.constructor(); // changed
|
|
4051
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4052
4052
|
|
|
4053
4053
|
for (var key in obj) {
|
|
4054
4054
|
if (obj.hasOwnProperty(key)) {
|
|
4055
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4055
|
+
/* 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]); }
|
|
4056
4056
|
}
|
|
4057
4057
|
}
|
|
4058
4058
|
return temp;
|
|
@@ -4124,7 +4124,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4124
4124
|
a = a || {};
|
|
4125
4125
|
for (var key in b) {
|
|
4126
4126
|
if (b.hasOwnProperty(key)) {
|
|
4127
|
-
a[key] = b[key];
|
|
4127
|
+
/* 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]; }
|
|
4128
4128
|
}
|
|
4129
4129
|
}
|
|
4130
4130
|
return a;
|
|
@@ -6562,7 +6562,7 @@ function queryfn3(query) {
|
|
|
6562
6562
|
|
|
6563
6563
|
// Prepare variables
|
|
6564
6564
|
query.data = [];
|
|
6565
|
-
query.xgroups
|
|
6565
|
+
query.xgroups=Object.create(null);
|
|
6566
6566
|
query.groups = [];
|
|
6567
6567
|
|
|
6568
6568
|
// Level of Joins
|
|
@@ -8411,7 +8411,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8411
8411
|
aft2 = '';
|
|
8412
8412
|
|
|
8413
8413
|
if (typeof query.groupStar !== 'undefined') {
|
|
8414
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
8414
|
+
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];};";
|
|
8415
8415
|
}
|
|
8416
8416
|
|
|
8417
8417
|
s += query.selectGroup
|
|
@@ -8853,7 +8853,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
8853
8853
|
} else {
|
|
8854
8854
|
|
|
8855
8855
|
// if column not exist, then copy all
|
|
8856
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
8856
|
+
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]};';
|
|
8857
8857
|
|
|
8858
8858
|
query.dirtyColumns = true;
|
|
8859
8859
|
}
|
|
@@ -9181,10 +9181,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9181
9181
|
self.columns.forEach(function (col) {
|
|
9182
9182
|
|
|
9183
9183
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9184
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9184
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9185
9185
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9186
9186
|
|
|
9187
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9187
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9188
9188
|
return '';
|
|
9189
9189
|
|
|
9190
9190
|
} else {
|
|
@@ -10407,7 +10407,7 @@ yy.Over = class Over {
|
|
|
10407
10407
|
const allValues = this.right.map(value => value.value);
|
|
10408
10408
|
const allValuesStr = allValues.join(',');
|
|
10409
10409
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10410
|
-
s = `alasql.sets[
|
|
10410
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10411
10411
|
}
|
|
10412
10412
|
} else {
|
|
10413
10413
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -10425,7 +10425,7 @@ yy.Over = class Over {
|
|
|
10425
10425
|
const allValues = this.right.map(value => value.value);
|
|
10426
10426
|
const allValuesStr = allValues.join(',');
|
|
10427
10427
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10428
|
-
s = `!alasql.sets[
|
|
10428
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10429
10429
|
}
|
|
10430
10430
|
} else {
|
|
10431
10431
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -12281,7 +12281,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
12281
12281
|
|
|
12282
12282
|
table.update(
|
|
12283
12283
|
function (t) {
|
|
12284
|
-
for (var f in r) t[f] = r[f];
|
|
12284
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
12285
12285
|
},
|
|
12286
12286
|
table.data.indexOf(toreplace),
|
|
12287
12287
|
params
|
|
@@ -13795,7 +13795,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
13795
13795
|
});
|
|
13796
13796
|
} else {
|
|
13797
13797
|
|
|
13798
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
13798
|
+
// 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]};';
|
|
13799
13799
|
sw = JSONtoJS(values);
|
|
13800
13800
|
}
|
|
13801
13801
|
}
|
|
@@ -14827,22 +14827,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
14827
14827
|
if (this.props && this.props.length > 0) {
|
|
14828
14828
|
let fs;
|
|
14829
14829
|
if (this.method === '@') {
|
|
14830
|
-
fs = `alasql.vars['${this.variable}']`;
|
|
14830
|
+
fs = `alasql.vars[k('${this.variable}')]`;
|
|
14831
14831
|
} else {
|
|
14832
|
-
fs = `params['${this.variable}']`;
|
|
14832
|
+
fs = `params[k('${this.variable}')]`;
|
|
14833
14833
|
}
|
|
14834
14834
|
this.props.forEach(prop => {
|
|
14835
14835
|
if (typeof prop === 'string') {
|
|
14836
|
-
fs += `['${prop}']`;
|
|
14836
|
+
fs += `[k('${prop}')]`;
|
|
14837
14837
|
} else if (typeof prop === 'number') {
|
|
14838
14838
|
fs += `[${prop}]`;
|
|
14839
14839
|
} else {
|
|
14840
14840
|
// Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
|
|
14841
|
-
fs += `[${prop.toJS()}]`;
|
|
14841
|
+
fs += `[k(${prop.toJS()})]`;
|
|
14842
14842
|
}
|
|
14843
14843
|
});
|
|
14844
14844
|
|
|
14845
|
-
new Function('value, params, alasql',
|
|
14845
|
+
new Function('value, params, alasql', `var k=function(x){if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(x+" is not allowed");return x};${fs} = value`)(res, params, alasql);
|
|
14846
14846
|
} else {
|
|
14847
14847
|
if (this.method === '@') {
|
|
14848
14848
|
alasql.vars[this.variable] = res;
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.6.
|
|
1
|
+
//! AlaSQL v4.6.8 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.6.
|
|
4
|
+
@version 4.6.8
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2024 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.6.
|
|
144
|
+
alasql.version = '4.6.8';
|
|
145
145
|
alasql.build = 'develop-f6e298b2';
|
|
146
146
|
|
|
147
147
|
/**
|
|
@@ -2505,7 +2505,7 @@ next:function () {
|
|
|
2505
2505
|
|
|
2506
2506
|
// return next match that has a token
|
|
2507
2507
|
lex:function lex () {
|
|
2508
|
-
var r = this.next();
|
|
2508
|
+
var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
|
|
2509
2509
|
if (r) {
|
|
2510
2510
|
return r;
|
|
2511
2511
|
} else {
|
|
@@ -4048,11 +4048,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4048
4048
|
return +obj;
|
|
4049
4049
|
}
|
|
4050
4050
|
|
|
4051
|
-
var temp = new obj.constructor(); // changed
|
|
4051
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4052
4052
|
|
|
4053
4053
|
for (var key in obj) {
|
|
4054
4054
|
if (obj.hasOwnProperty(key)) {
|
|
4055
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4055
|
+
/* 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]); }
|
|
4056
4056
|
}
|
|
4057
4057
|
}
|
|
4058
4058
|
return temp;
|
|
@@ -4124,7 +4124,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4124
4124
|
a = a || {};
|
|
4125
4125
|
for (var key in b) {
|
|
4126
4126
|
if (b.hasOwnProperty(key)) {
|
|
4127
|
-
a[key] = b[key];
|
|
4127
|
+
/* 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]; }
|
|
4128
4128
|
}
|
|
4129
4129
|
}
|
|
4130
4130
|
return a;
|
|
@@ -6562,7 +6562,7 @@ function queryfn3(query) {
|
|
|
6562
6562
|
|
|
6563
6563
|
// Prepare variables
|
|
6564
6564
|
query.data = [];
|
|
6565
|
-
query.xgroups
|
|
6565
|
+
query.xgroups=Object.create(null);
|
|
6566
6566
|
query.groups = [];
|
|
6567
6567
|
|
|
6568
6568
|
// Level of Joins
|
|
@@ -8411,7 +8411,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8411
8411
|
aft2 = '';
|
|
8412
8412
|
|
|
8413
8413
|
if (typeof query.groupStar !== 'undefined') {
|
|
8414
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
8414
|
+
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];};";
|
|
8415
8415
|
}
|
|
8416
8416
|
|
|
8417
8417
|
s += query.selectGroup
|
|
@@ -8853,7 +8853,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
8853
8853
|
} else {
|
|
8854
8854
|
|
|
8855
8855
|
// if column not exist, then copy all
|
|
8856
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
8856
|
+
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]};';
|
|
8857
8857
|
|
|
8858
8858
|
query.dirtyColumns = true;
|
|
8859
8859
|
}
|
|
@@ -9181,10 +9181,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9181
9181
|
self.columns.forEach(function (col) {
|
|
9182
9182
|
|
|
9183
9183
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9184
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9184
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9185
9185
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9186
9186
|
|
|
9187
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9187
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9188
9188
|
return '';
|
|
9189
9189
|
|
|
9190
9190
|
} else {
|
|
@@ -10407,7 +10407,7 @@ yy.Over = class Over {
|
|
|
10407
10407
|
const allValues = this.right.map(value => value.value);
|
|
10408
10408
|
const allValuesStr = allValues.join(',');
|
|
10409
10409
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10410
|
-
s = `alasql.sets[
|
|
10410
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10411
10411
|
}
|
|
10412
10412
|
} else {
|
|
10413
10413
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -10425,7 +10425,7 @@ yy.Over = class Over {
|
|
|
10425
10425
|
const allValues = this.right.map(value => value.value);
|
|
10426
10426
|
const allValuesStr = allValues.join(',');
|
|
10427
10427
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10428
|
-
s = `!alasql.sets[
|
|
10428
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10429
10429
|
}
|
|
10430
10430
|
} else {
|
|
10431
10431
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -12281,7 +12281,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
12281
12281
|
|
|
12282
12282
|
table.update(
|
|
12283
12283
|
function (t) {
|
|
12284
|
-
for (var f in r) t[f] = r[f];
|
|
12284
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
12285
12285
|
},
|
|
12286
12286
|
table.data.indexOf(toreplace),
|
|
12287
12287
|
params
|
|
@@ -13795,7 +13795,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
13795
13795
|
});
|
|
13796
13796
|
} else {
|
|
13797
13797
|
|
|
13798
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
13798
|
+
// 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]};';
|
|
13799
13799
|
sw = JSONtoJS(values);
|
|
13800
13800
|
}
|
|
13801
13801
|
}
|
|
@@ -14827,22 +14827,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
14827
14827
|
if (this.props && this.props.length > 0) {
|
|
14828
14828
|
let fs;
|
|
14829
14829
|
if (this.method === '@') {
|
|
14830
|
-
fs = `alasql.vars['${this.variable}']`;
|
|
14830
|
+
fs = `alasql.vars[k('${this.variable}')]`;
|
|
14831
14831
|
} else {
|
|
14832
|
-
fs = `params['${this.variable}']`;
|
|
14832
|
+
fs = `params[k('${this.variable}')]`;
|
|
14833
14833
|
}
|
|
14834
14834
|
this.props.forEach(prop => {
|
|
14835
14835
|
if (typeof prop === 'string') {
|
|
14836
|
-
fs += `['${prop}']`;
|
|
14836
|
+
fs += `[k('${prop}')]`;
|
|
14837
14837
|
} else if (typeof prop === 'number') {
|
|
14838
14838
|
fs += `[${prop}]`;
|
|
14839
14839
|
} else {
|
|
14840
14840
|
// Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
|
|
14841
|
-
fs += `[${prop.toJS()}]`;
|
|
14841
|
+
fs += `[k(${prop.toJS()})]`;
|
|
14842
14842
|
}
|
|
14843
14843
|
});
|
|
14844
14844
|
|
|
14845
|
-
new Function('value, params, alasql',
|
|
14845
|
+
new Function('value, params, alasql', `var k=function(x){if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(x+" is not allowed");return x};${fs} = value`)(res, params, alasql);
|
|
14846
14846
|
} else {
|
|
14847
14847
|
if (this.method === '@') {
|
|
14848
14848
|
alasql.vars[this.variable] = res;
|