alasql 4.8.0 → 4.8.2
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 +34 -34
- package/package.json +1 -1
package/bin/alasql-cli.js
CHANGED
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.8.2 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.8.2
|
|
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.
|
|
1
|
+
//! AlaSQL v4.8.2 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.8.2
|
|
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.
|
|
144
|
+
alasql.version = '4.8.2';
|
|
145
145
|
alasql.build = 'develop-916ff64e';
|
|
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 {
|
|
@@ -4061,11 +4061,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4061
4061
|
return +obj;
|
|
4062
4062
|
}
|
|
4063
4063
|
|
|
4064
|
-
var temp = new obj.constructor(); // changed
|
|
4064
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4065
4065
|
|
|
4066
4066
|
for (var key in obj) {
|
|
4067
4067
|
if (obj.hasOwnProperty(key)) {
|
|
4068
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4068
|
+
/* 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]); }
|
|
4069
4069
|
}
|
|
4070
4070
|
}
|
|
4071
4071
|
return temp;
|
|
@@ -4137,7 +4137,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4137
4137
|
a = a || {};
|
|
4138
4138
|
for (var key in b) {
|
|
4139
4139
|
if (b.hasOwnProperty(key)) {
|
|
4140
|
-
a[key] = b[key];
|
|
4140
|
+
/* 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]; }
|
|
4141
4141
|
}
|
|
4142
4142
|
}
|
|
4143
4143
|
return a;
|
|
@@ -6575,7 +6575,7 @@ function queryfn3(query) {
|
|
|
6575
6575
|
|
|
6576
6576
|
// Prepare variables
|
|
6577
6577
|
query.data = [];
|
|
6578
|
-
query.xgroups
|
|
6578
|
+
query.xgroups=Object.create(null);
|
|
6579
6579
|
query.groups = [];
|
|
6580
6580
|
|
|
6581
6581
|
// Level of Joins
|
|
@@ -8424,7 +8424,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8424
8424
|
aft2 = '';
|
|
8425
8425
|
|
|
8426
8426
|
if (typeof query.groupStar !== 'undefined') {
|
|
8427
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
8427
|
+
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];};";
|
|
8428
8428
|
}
|
|
8429
8429
|
|
|
8430
8430
|
s += query.selectGroup
|
|
@@ -8873,7 +8873,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
8873
8873
|
} else {
|
|
8874
8874
|
|
|
8875
8875
|
// if column not exist, then copy all
|
|
8876
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
8876
|
+
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]};';
|
|
8877
8877
|
|
|
8878
8878
|
query.dirtyColumns = true;
|
|
8879
8879
|
}
|
|
@@ -9201,10 +9201,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9201
9201
|
self.columns.forEach(function (col) {
|
|
9202
9202
|
|
|
9203
9203
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9204
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9204
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9205
9205
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9206
9206
|
|
|
9207
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9207
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9208
9208
|
return '';
|
|
9209
9209
|
|
|
9210
9210
|
} else {
|
|
@@ -10427,7 +10427,7 @@ yy.Over = class Over {
|
|
|
10427
10427
|
const allValues = this.right.map(value => value.value);
|
|
10428
10428
|
const allValuesStr = allValues.join(',');
|
|
10429
10429
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10430
|
-
s = `alasql.sets[
|
|
10430
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10431
10431
|
}
|
|
10432
10432
|
} else {
|
|
10433
10433
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -10445,7 +10445,7 @@ yy.Over = class Over {
|
|
|
10445
10445
|
const allValues = this.right.map(value => value.value);
|
|
10446
10446
|
const allValuesStr = allValues.join(',');
|
|
10447
10447
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10448
|
-
s = `!alasql.sets[
|
|
10448
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10449
10449
|
}
|
|
10450
10450
|
} else {
|
|
10451
10451
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -12313,7 +12313,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
12313
12313
|
|
|
12314
12314
|
table.update(
|
|
12315
12315
|
function (t) {
|
|
12316
|
-
for (var f in r) t[f] = r[f];
|
|
12316
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
12317
12317
|
},
|
|
12318
12318
|
table.data.indexOf(toreplace),
|
|
12319
12319
|
params
|
|
@@ -13827,7 +13827,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
13827
13827
|
});
|
|
13828
13828
|
} else {
|
|
13829
13829
|
|
|
13830
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
13830
|
+
// 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]};';
|
|
13831
13831
|
sw = JSONtoJS(values);
|
|
13832
13832
|
}
|
|
13833
13833
|
}
|
|
@@ -14859,22 +14859,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
14859
14859
|
if (this.props && this.props.length > 0) {
|
|
14860
14860
|
let fs;
|
|
14861
14861
|
if (this.method === '@') {
|
|
14862
|
-
fs = `alasql.vars['${this.variable}']`;
|
|
14862
|
+
fs = `alasql.vars[k('${this.variable}')]`;
|
|
14863
14863
|
} else {
|
|
14864
|
-
fs = `params['${this.variable}']`;
|
|
14864
|
+
fs = `params[k('${this.variable}')]`;
|
|
14865
14865
|
}
|
|
14866
14866
|
this.props.forEach(prop => {
|
|
14867
14867
|
if (typeof prop === 'string') {
|
|
14868
|
-
fs += `['${prop}']`;
|
|
14868
|
+
fs += `[k('${prop}')]`;
|
|
14869
14869
|
} else if (typeof prop === 'number') {
|
|
14870
14870
|
fs += `[${prop}]`;
|
|
14871
14871
|
} else {
|
|
14872
14872
|
// Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
|
|
14873
|
-
fs += `[${prop.toJS()}]`;
|
|
14873
|
+
fs += `[k(${prop.toJS()})]`;
|
|
14874
14874
|
}
|
|
14875
14875
|
});
|
|
14876
14876
|
|
|
14877
|
-
new Function('value, params, alasql',
|
|
14877
|
+
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);
|
|
14878
14878
|
} else {
|
|
14879
14879
|
if (this.method === '@') {
|
|
14880
14880
|
alasql.vars[this.variable] = res;
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.8.2 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.8.2
|
|
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.
|
|
144
|
+
alasql.version = '4.8.2';
|
|
145
145
|
alasql.build = 'develop-916ff64e';
|
|
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 {
|
|
@@ -4061,11 +4061,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4061
4061
|
return +obj;
|
|
4062
4062
|
}
|
|
4063
4063
|
|
|
4064
|
-
var temp = new obj.constructor(); // changed
|
|
4064
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4065
4065
|
|
|
4066
4066
|
for (var key in obj) {
|
|
4067
4067
|
if (obj.hasOwnProperty(key)) {
|
|
4068
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4068
|
+
/* 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]); }
|
|
4069
4069
|
}
|
|
4070
4070
|
}
|
|
4071
4071
|
return temp;
|
|
@@ -4137,7 +4137,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4137
4137
|
a = a || {};
|
|
4138
4138
|
for (var key in b) {
|
|
4139
4139
|
if (b.hasOwnProperty(key)) {
|
|
4140
|
-
a[key] = b[key];
|
|
4140
|
+
/* 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]; }
|
|
4141
4141
|
}
|
|
4142
4142
|
}
|
|
4143
4143
|
return a;
|
|
@@ -6575,7 +6575,7 @@ function queryfn3(query) {
|
|
|
6575
6575
|
|
|
6576
6576
|
// Prepare variables
|
|
6577
6577
|
query.data = [];
|
|
6578
|
-
query.xgroups
|
|
6578
|
+
query.xgroups=Object.create(null);
|
|
6579
6579
|
query.groups = [];
|
|
6580
6580
|
|
|
6581
6581
|
// Level of Joins
|
|
@@ -8424,7 +8424,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8424
8424
|
aft2 = '';
|
|
8425
8425
|
|
|
8426
8426
|
if (typeof query.groupStar !== 'undefined') {
|
|
8427
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
8427
|
+
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];};";
|
|
8428
8428
|
}
|
|
8429
8429
|
|
|
8430
8430
|
s += query.selectGroup
|
|
@@ -8873,7 +8873,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
8873
8873
|
} else {
|
|
8874
8874
|
|
|
8875
8875
|
// if column not exist, then copy all
|
|
8876
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
8876
|
+
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]};';
|
|
8877
8877
|
|
|
8878
8878
|
query.dirtyColumns = true;
|
|
8879
8879
|
}
|
|
@@ -9201,10 +9201,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9201
9201
|
self.columns.forEach(function (col) {
|
|
9202
9202
|
|
|
9203
9203
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9204
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9204
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9205
9205
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9206
9206
|
|
|
9207
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9207
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9208
9208
|
return '';
|
|
9209
9209
|
|
|
9210
9210
|
} else {
|
|
@@ -10427,7 +10427,7 @@ yy.Over = class Over {
|
|
|
10427
10427
|
const allValues = this.right.map(value => value.value);
|
|
10428
10428
|
const allValuesStr = allValues.join(',');
|
|
10429
10429
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10430
|
-
s = `alasql.sets[
|
|
10430
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10431
10431
|
}
|
|
10432
10432
|
} else {
|
|
10433
10433
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -10445,7 +10445,7 @@ yy.Over = class Over {
|
|
|
10445
10445
|
const allValues = this.right.map(value => value.value);
|
|
10446
10446
|
const allValuesStr = allValues.join(',');
|
|
10447
10447
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
10448
|
-
s = `!alasql.sets[
|
|
10448
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
10449
10449
|
}
|
|
10450
10450
|
} else {
|
|
10451
10451
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -12313,7 +12313,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
12313
12313
|
|
|
12314
12314
|
table.update(
|
|
12315
12315
|
function (t) {
|
|
12316
|
-
for (var f in r) t[f] = r[f];
|
|
12316
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
12317
12317
|
},
|
|
12318
12318
|
table.data.indexOf(toreplace),
|
|
12319
12319
|
params
|
|
@@ -13827,7 +13827,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
13827
13827
|
});
|
|
13828
13828
|
} else {
|
|
13829
13829
|
|
|
13830
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
13830
|
+
// 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]};';
|
|
13831
13831
|
sw = JSONtoJS(values);
|
|
13832
13832
|
}
|
|
13833
13833
|
}
|
|
@@ -14859,22 +14859,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
14859
14859
|
if (this.props && this.props.length > 0) {
|
|
14860
14860
|
let fs;
|
|
14861
14861
|
if (this.method === '@') {
|
|
14862
|
-
fs = `alasql.vars['${this.variable}']`;
|
|
14862
|
+
fs = `alasql.vars[k('${this.variable}')]`;
|
|
14863
14863
|
} else {
|
|
14864
|
-
fs = `params['${this.variable}']`;
|
|
14864
|
+
fs = `params[k('${this.variable}')]`;
|
|
14865
14865
|
}
|
|
14866
14866
|
this.props.forEach(prop => {
|
|
14867
14867
|
if (typeof prop === 'string') {
|
|
14868
|
-
fs += `['${prop}']`;
|
|
14868
|
+
fs += `[k('${prop}')]`;
|
|
14869
14869
|
} else if (typeof prop === 'number') {
|
|
14870
14870
|
fs += `[${prop}]`;
|
|
14871
14871
|
} else {
|
|
14872
14872
|
// Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
|
|
14873
|
-
fs += `[${prop.toJS()}]`;
|
|
14873
|
+
fs += `[k(${prop.toJS()})]`;
|
|
14874
14874
|
}
|
|
14875
14875
|
});
|
|
14876
14876
|
|
|
14877
|
-
new Function('value, params, alasql',
|
|
14877
|
+
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);
|
|
14878
14878
|
} else {
|
|
14879
14879
|
if (this.method === '@') {
|
|
14880
14880
|
alasql.vars[this.variable] = res;
|