alasql 4.18.0 → 4.18.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/bun.lock +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql.fs.js +27 -27
- package/dist/alasql.js +27 -27
- package/dist/alasql.min.js +30 -30
- package/package.json +1 -1
package/bin/alasql-cli.js
CHANGED
package/bun.lock
CHANGED
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
|
|
241
241
|
"lex-parser": ["lex-parser@https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz", {}, "sha512-DuAEISsr1H4LOpmFLkyMc8YStiRWZCO8hMsoXAXSbgyfvs2WQhSt0+/FBv3ZU/JBFZMGcE+FWzEBSzwUU7U27w=="],
|
|
242
242
|
|
|
243
|
-
"lodash": ["lodash@https://registry.npmjs.org/lodash/-/lodash-4.18.
|
|
243
|
+
"lodash": ["lodash@https://registry.npmjs.org/lodash/-/lodash-4.18.2.tgz", {}, "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="],
|
|
244
244
|
|
|
245
245
|
"lru-cache": ["lru-cache@https://registry.npmjs.org/lru-cache/-/lru-cache-11.3.2.tgz", {}, "sha512-wgWa6FWQ3QRRJbIjbsldRJZxdxYngT/dO0I5Ynmlnin8qy7tC6xYzbcJjtN4wHLXtkbVwHzk0C+OejVw1XM+DQ=="],
|
|
246
246
|
|
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.18.2 build: develop-a80b2965 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.18.2
|
|
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.
|
|
1
|
+
//! AlaSQL v4.18.2 build: develop-a80b2965 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.18.2
|
|
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.
|
|
144
|
+
alasql.version = '4.18.2';
|
|
145
145
|
alasql.build = 'develop-a80b2965';
|
|
146
146
|
|
|
147
147
|
/**
|
|
@@ -3003,7 +3003,7 @@ next:function () {
|
|
|
3003
3003
|
|
|
3004
3004
|
// return next match that has a token
|
|
3005
3005
|
lex:function lex () {
|
|
3006
|
-
var r = this.next();
|
|
3006
|
+
var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
|
|
3007
3007
|
if (r) {
|
|
3008
3008
|
return r;
|
|
3009
3009
|
} else {
|
|
@@ -4581,11 +4581,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4581
4581
|
return +obj;
|
|
4582
4582
|
}
|
|
4583
4583
|
|
|
4584
|
-
var temp = new obj.constructor(); // changed
|
|
4584
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4585
4585
|
|
|
4586
4586
|
for (var key in obj) {
|
|
4587
4587
|
if (obj.hasOwnProperty(key)) {
|
|
4588
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4588
|
+
/* 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]); }
|
|
4589
4589
|
}
|
|
4590
4590
|
}
|
|
4591
4591
|
return temp;
|
|
@@ -4657,7 +4657,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4657
4657
|
a = a || {};
|
|
4658
4658
|
for (var key in b) {
|
|
4659
4659
|
if (b.hasOwnProperty(key)) {
|
|
4660
|
-
a[key] = b[key];
|
|
4660
|
+
/* 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]; }
|
|
4661
4661
|
}
|
|
4662
4662
|
}
|
|
4663
4663
|
return a;
|
|
@@ -7254,7 +7254,7 @@ function queryfn3(query) {
|
|
|
7254
7254
|
|
|
7255
7255
|
// Prepare variables
|
|
7256
7256
|
query.data = [];
|
|
7257
|
-
query.xgroups
|
|
7257
|
+
query.xgroups=Object.create(null);
|
|
7258
7258
|
query.groups = [];
|
|
7259
7259
|
|
|
7260
7260
|
// Level of Joins
|
|
@@ -8326,7 +8326,7 @@ yy.Select = class Select {
|
|
|
8326
8326
|
var converted = {};
|
|
8327
8327
|
for (var key in r) {
|
|
8328
8328
|
var colDef = table.xcolumns && table.xcolumns[key];
|
|
8329
|
-
|
|
8329
|
+
var cv=alasql.utils.typeConverter(r[key], colDef ? colDef.dbtypeid : null);if(key==="__proto__"){Object.defineProperty(converted,key,{value:cv,writable:true,enumerable:true,configurable:true})}else{converted[key]=cv}
|
|
8330
8330
|
}
|
|
8331
8331
|
table.data.push(converted);
|
|
8332
8332
|
`;
|
|
@@ -9650,7 +9650,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
9650
9650
|
aft2 = '';
|
|
9651
9651
|
|
|
9652
9652
|
if (typeof query.groupStar !== 'undefined') {
|
|
9653
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
9653
|
+
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];};";
|
|
9654
9654
|
}
|
|
9655
9655
|
|
|
9656
9656
|
s += query.selectGroup
|
|
@@ -10134,7 +10134,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
10134
10134
|
'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
|
|
10135
10135
|
} else {
|
|
10136
10136
|
// Default overwrite mode
|
|
10137
|
-
sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
|
|
10137
|
+
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]};';
|
|
10138
10138
|
}
|
|
10139
10139
|
|
|
10140
10140
|
query.dirtyColumns = true;
|
|
@@ -10610,10 +10610,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
10610
10610
|
self.columns.forEach(function (col) {
|
|
10611
10611
|
|
|
10612
10612
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
10613
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
10613
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10614
10614
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
10615
10615
|
|
|
10616
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
10616
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10617
10617
|
return '';
|
|
10618
10618
|
|
|
10619
10619
|
} else {
|
|
@@ -11920,7 +11920,7 @@ yy.Over = class Over {
|
|
|
11920
11920
|
const allValues = this.right.map(value => value.value);
|
|
11921
11921
|
const allValuesStr = allValues.join(',');
|
|
11922
11922
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11923
|
-
s = `alasql.sets[
|
|
11923
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11924
11924
|
}
|
|
11925
11925
|
} else {
|
|
11926
11926
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -11954,7 +11954,7 @@ yy.Over = class Over {
|
|
|
11954
11954
|
const allValues = this.right.map(value => value.value);
|
|
11955
11955
|
const allValuesStr = allValues.join(',');
|
|
11956
11956
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11957
|
-
s = `!alasql.sets[
|
|
11957
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11958
11958
|
}
|
|
11959
11959
|
} else {
|
|
11960
11960
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -13981,7 +13981,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
13981
13981
|
|
|
13982
13982
|
table.update(
|
|
13983
13983
|
function (t) {
|
|
13984
|
-
for (var f in r) t[f] = r[f];
|
|
13984
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
13985
13985
|
},
|
|
13986
13986
|
table.data.indexOf(toreplace),
|
|
13987
13987
|
params
|
|
@@ -15752,7 +15752,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15752
15752
|
});
|
|
15753
15753
|
} else {
|
|
15754
15754
|
|
|
15755
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
15755
|
+
// 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]};';
|
|
15756
15756
|
sw = JSONtoJS(values);
|
|
15757
15757
|
}
|
|
15758
15758
|
}
|
|
@@ -15831,7 +15831,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15831
15831
|
self.output.columns.forEach(function (col) {
|
|
15832
15832
|
if (col.columnid === '*') {
|
|
15833
15833
|
// For *, expand all properties
|
|
15834
|
-
s += 'for(var key in r){ outputRow[key] = r[key]; }';
|
|
15834
|
+
s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
|
|
15835
15835
|
} else {
|
|
15836
15836
|
var colname = col.as || col.columnid;
|
|
15837
15837
|
// Direct property access for simple columns
|
|
@@ -15910,7 +15910,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15910
15910
|
if (col.columnid === '*') {
|
|
15911
15911
|
// For *, expand all properties
|
|
15912
15912
|
for (var key in r) {
|
|
15913
|
-
outputRow[key] = r[key];
|
|
15913
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
15914
15914
|
}
|
|
15915
15915
|
} else {
|
|
15916
15916
|
var colname = col.as || col.columnid;
|
|
@@ -16261,7 +16261,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16261
16261
|
if (col.columnid === '*') {
|
|
16262
16262
|
// For *, expand all properties
|
|
16263
16263
|
for (var key in r) {
|
|
16264
|
-
outputRow[key] = r[key];
|
|
16264
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16265
16265
|
}
|
|
16266
16266
|
} else {
|
|
16267
16267
|
var colname = col.as || col.columnid;
|
|
@@ -16332,7 +16332,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16332
16332
|
if (col.columnid === '*') {
|
|
16333
16333
|
// For *, expand all properties
|
|
16334
16334
|
for (var key in r) {
|
|
16335
|
-
outputRow[key] = r[key];
|
|
16335
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16336
16336
|
}
|
|
16337
16337
|
} else {
|
|
16338
16338
|
var colname = col.as || col.columnid;
|
|
@@ -16502,7 +16502,7 @@ yy.Update.prototype.compile = function (databaseid) {
|
|
|
16502
16502
|
if (col.columnid === '*') {
|
|
16503
16503
|
// For *, use INSERTED values
|
|
16504
16504
|
for (var key in inserted) {
|
|
16505
|
-
outputRow[key] = inserted[key];
|
|
16505
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
|
|
16506
16506
|
}
|
|
16507
16507
|
} else {
|
|
16508
16508
|
var colname = col.as || col.columnid;
|
|
@@ -17060,22 +17060,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
17060
17060
|
if (this.props && this.props.length > 0) {
|
|
17061
17061
|
let fs;
|
|
17062
17062
|
if (this.method === '@') {
|
|
17063
|
-
fs = `alasql.vars['${this.variable}']`;
|
|
17063
|
+
fs = `alasql.vars[k('${this.variable}')]`;
|
|
17064
17064
|
} else {
|
|
17065
|
-
fs = `params['${this.variable}']`;
|
|
17065
|
+
fs = `params[k('${this.variable}')]`;
|
|
17066
17066
|
}
|
|
17067
17067
|
this.props.forEach(prop => {
|
|
17068
17068
|
if (typeof prop === 'string') {
|
|
17069
|
-
fs += `['${prop}']`;
|
|
17069
|
+
fs += `[k('${prop}')]`;
|
|
17070
17070
|
} else if (typeof prop === 'number') {
|
|
17071
17071
|
fs += `[${prop}]`;
|
|
17072
17072
|
} else {
|
|
17073
17073
|
// Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
|
|
17074
|
-
fs += `[${prop.toJS()}]`;
|
|
17074
|
+
fs += `[k(${prop.toJS()})]`;
|
|
17075
17075
|
}
|
|
17076
17076
|
});
|
|
17077
17077
|
|
|
17078
|
-
new Function('value, params, alasql',
|
|
17078
|
+
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);
|
|
17079
17079
|
} else {
|
|
17080
17080
|
if (this.method === '@') {
|
|
17081
17081
|
alasql.vars[this.variable] = res;
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.18.2 build: develop-a80b2965 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.18.2
|
|
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.
|
|
144
|
+
alasql.version = '4.18.2';
|
|
145
145
|
alasql.build = 'develop-a80b2965';
|
|
146
146
|
|
|
147
147
|
/**
|
|
@@ -3003,7 +3003,7 @@ next:function () {
|
|
|
3003
3003
|
|
|
3004
3004
|
// return next match that has a token
|
|
3005
3005
|
lex:function lex () {
|
|
3006
|
-
var r = this.next();
|
|
3006
|
+
var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
|
|
3007
3007
|
if (r) {
|
|
3008
3008
|
return r;
|
|
3009
3009
|
} else {
|
|
@@ -4581,11 +4581,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4581
4581
|
return +obj;
|
|
4582
4582
|
}
|
|
4583
4583
|
|
|
4584
|
-
var temp = new obj.constructor(); // changed
|
|
4584
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4585
4585
|
|
|
4586
4586
|
for (var key in obj) {
|
|
4587
4587
|
if (obj.hasOwnProperty(key)) {
|
|
4588
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4588
|
+
/* 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]); }
|
|
4589
4589
|
}
|
|
4590
4590
|
}
|
|
4591
4591
|
return temp;
|
|
@@ -4657,7 +4657,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4657
4657
|
a = a || {};
|
|
4658
4658
|
for (var key in b) {
|
|
4659
4659
|
if (b.hasOwnProperty(key)) {
|
|
4660
|
-
a[key] = b[key];
|
|
4660
|
+
/* 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]; }
|
|
4661
4661
|
}
|
|
4662
4662
|
}
|
|
4663
4663
|
return a;
|
|
@@ -7254,7 +7254,7 @@ function queryfn3(query) {
|
|
|
7254
7254
|
|
|
7255
7255
|
// Prepare variables
|
|
7256
7256
|
query.data = [];
|
|
7257
|
-
query.xgroups
|
|
7257
|
+
query.xgroups=Object.create(null);
|
|
7258
7258
|
query.groups = [];
|
|
7259
7259
|
|
|
7260
7260
|
// Level of Joins
|
|
@@ -8326,7 +8326,7 @@ yy.Select = class Select {
|
|
|
8326
8326
|
var converted = {};
|
|
8327
8327
|
for (var key in r) {
|
|
8328
8328
|
var colDef = table.xcolumns && table.xcolumns[key];
|
|
8329
|
-
|
|
8329
|
+
var cv=alasql.utils.typeConverter(r[key], colDef ? colDef.dbtypeid : null);if(key==="__proto__"){Object.defineProperty(converted,key,{value:cv,writable:true,enumerable:true,configurable:true})}else{converted[key]=cv}
|
|
8330
8330
|
}
|
|
8331
8331
|
table.data.push(converted);
|
|
8332
8332
|
`;
|
|
@@ -9650,7 +9650,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
9650
9650
|
aft2 = '';
|
|
9651
9651
|
|
|
9652
9652
|
if (typeof query.groupStar !== 'undefined') {
|
|
9653
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
9653
|
+
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];};";
|
|
9654
9654
|
}
|
|
9655
9655
|
|
|
9656
9656
|
s += query.selectGroup
|
|
@@ -10134,7 +10134,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
10134
10134
|
'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
|
|
10135
10135
|
} else {
|
|
10136
10136
|
// Default overwrite mode
|
|
10137
|
-
sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
|
|
10137
|
+
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]};';
|
|
10138
10138
|
}
|
|
10139
10139
|
|
|
10140
10140
|
query.dirtyColumns = true;
|
|
@@ -10610,10 +10610,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
10610
10610
|
self.columns.forEach(function (col) {
|
|
10611
10611
|
|
|
10612
10612
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
10613
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
10613
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10614
10614
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
10615
10615
|
|
|
10616
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
10616
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10617
10617
|
return '';
|
|
10618
10618
|
|
|
10619
10619
|
} else {
|
|
@@ -11920,7 +11920,7 @@ yy.Over = class Over {
|
|
|
11920
11920
|
const allValues = this.right.map(value => value.value);
|
|
11921
11921
|
const allValuesStr = allValues.join(',');
|
|
11922
11922
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11923
|
-
s = `alasql.sets[
|
|
11923
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11924
11924
|
}
|
|
11925
11925
|
} else {
|
|
11926
11926
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -11954,7 +11954,7 @@ yy.Over = class Over {
|
|
|
11954
11954
|
const allValues = this.right.map(value => value.value);
|
|
11955
11955
|
const allValuesStr = allValues.join(',');
|
|
11956
11956
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11957
|
-
s = `!alasql.sets[
|
|
11957
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11958
11958
|
}
|
|
11959
11959
|
} else {
|
|
11960
11960
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -13981,7 +13981,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
13981
13981
|
|
|
13982
13982
|
table.update(
|
|
13983
13983
|
function (t) {
|
|
13984
|
-
for (var f in r) t[f] = r[f];
|
|
13984
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
13985
13985
|
},
|
|
13986
13986
|
table.data.indexOf(toreplace),
|
|
13987
13987
|
params
|
|
@@ -15752,7 +15752,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15752
15752
|
});
|
|
15753
15753
|
} else {
|
|
15754
15754
|
|
|
15755
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
15755
|
+
// 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]};';
|
|
15756
15756
|
sw = JSONtoJS(values);
|
|
15757
15757
|
}
|
|
15758
15758
|
}
|
|
@@ -15831,7 +15831,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15831
15831
|
self.output.columns.forEach(function (col) {
|
|
15832
15832
|
if (col.columnid === '*') {
|
|
15833
15833
|
// For *, expand all properties
|
|
15834
|
-
s += 'for(var key in r){ outputRow[key] = r[key]; }';
|
|
15834
|
+
s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
|
|
15835
15835
|
} else {
|
|
15836
15836
|
var colname = col.as || col.columnid;
|
|
15837
15837
|
// Direct property access for simple columns
|
|
@@ -15910,7 +15910,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15910
15910
|
if (col.columnid === '*') {
|
|
15911
15911
|
// For *, expand all properties
|
|
15912
15912
|
for (var key in r) {
|
|
15913
|
-
outputRow[key] = r[key];
|
|
15913
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
15914
15914
|
}
|
|
15915
15915
|
} else {
|
|
15916
15916
|
var colname = col.as || col.columnid;
|
|
@@ -16261,7 +16261,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16261
16261
|
if (col.columnid === '*') {
|
|
16262
16262
|
// For *, expand all properties
|
|
16263
16263
|
for (var key in r) {
|
|
16264
|
-
outputRow[key] = r[key];
|
|
16264
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16265
16265
|
}
|
|
16266
16266
|
} else {
|
|
16267
16267
|
var colname = col.as || col.columnid;
|
|
@@ -16332,7 +16332,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16332
16332
|
if (col.columnid === '*') {
|
|
16333
16333
|
// For *, expand all properties
|
|
16334
16334
|
for (var key in r) {
|
|
16335
|
-
outputRow[key] = r[key];
|
|
16335
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16336
16336
|
}
|
|
16337
16337
|
} else {
|
|
16338
16338
|
var colname = col.as || col.columnid;
|
|
@@ -16502,7 +16502,7 @@ yy.Update.prototype.compile = function (databaseid) {
|
|
|
16502
16502
|
if (col.columnid === '*') {
|
|
16503
16503
|
// For *, use INSERTED values
|
|
16504
16504
|
for (var key in inserted) {
|
|
16505
|
-
outputRow[key] = inserted[key];
|
|
16505
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
|
|
16506
16506
|
}
|
|
16507
16507
|
} else {
|
|
16508
16508
|
var colname = col.as || col.columnid;
|
|
@@ -17060,22 +17060,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
17060
17060
|
if (this.props && this.props.length > 0) {
|
|
17061
17061
|
let fs;
|
|
17062
17062
|
if (this.method === '@') {
|
|
17063
|
-
fs = `alasql.vars['${this.variable}']`;
|
|
17063
|
+
fs = `alasql.vars[k('${this.variable}')]`;
|
|
17064
17064
|
} else {
|
|
17065
|
-
fs = `params['${this.variable}']`;
|
|
17065
|
+
fs = `params[k('${this.variable}')]`;
|
|
17066
17066
|
}
|
|
17067
17067
|
this.props.forEach(prop => {
|
|
17068
17068
|
if (typeof prop === 'string') {
|
|
17069
|
-
fs += `['${prop}']`;
|
|
17069
|
+
fs += `[k('${prop}')]`;
|
|
17070
17070
|
} else if (typeof prop === 'number') {
|
|
17071
17071
|
fs += `[${prop}]`;
|
|
17072
17072
|
} else {
|
|
17073
17073
|
// Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
|
|
17074
|
-
fs += `[${prop.toJS()}]`;
|
|
17074
|
+
fs += `[k(${prop.toJS()})]`;
|
|
17075
17075
|
}
|
|
17076
17076
|
});
|
|
17077
17077
|
|
|
17078
|
-
new Function('value, params, alasql',
|
|
17078
|
+
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);
|
|
17079
17079
|
} else {
|
|
17080
17080
|
if (this.method === '@') {
|
|
17081
17081
|
alasql.vars[this.variable] = res;
|