alasql 4.19.0 → 4.19.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.d.ts +35 -28
- package/dist/alasql.fs.js +21 -20
- package/dist/alasql.js +21 -20
- package/dist/alasql.min.js +29 -29
- package/package.json +3 -3
- package/types/alasql.d.ts +35 -28
package/bin/alasql-cli.js
CHANGED
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.19.2 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.19.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2025 Andrey Gershun & Mathias Wulff
|
package/dist/alasql.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ declare module 'alasql' {
|
|
|
4
4
|
import * as xlsx from 'xlsx';
|
|
5
5
|
|
|
6
6
|
// Callback with error-first convention and optional data
|
|
7
|
-
interface AlaSQLCallback<T = unknown> {
|
|
7
|
+
export interface AlaSQLCallback<T = unknown> {
|
|
8
8
|
(err: Error | null, data?: T): void;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
interface AlaSQLOptions {
|
|
11
|
+
export interface AlaSQLOptions {
|
|
12
12
|
errorlog: boolean;
|
|
13
13
|
valueof: boolean;
|
|
14
14
|
dropifnotexists: boolean; // drop database in any case
|
|
@@ -35,21 +35,21 @@ declare module 'alasql' {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// compiled Statement
|
|
38
|
-
interface AlaSQLStatement {
|
|
38
|
+
export interface AlaSQLStatement {
|
|
39
39
|
<T = unknown>(params?: any, cb?: AlaSQLCallback<T>, scope?: unknown): T;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
type AlaSQLDefaultColumns = {[columnName: string]: string};
|
|
42
|
+
export type AlaSQLDefaultColumns = {[columnName: string]: string};
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Base parsed expression node.
|
|
46
46
|
* Node shapes below are part of the public parser AST surface and follow semver.
|
|
47
47
|
*/
|
|
48
|
-
interface AlaSQLExpression {
|
|
48
|
+
export interface AlaSQLExpression {
|
|
49
49
|
toJS(context: string, tableid: string | number, defcols: AlaSQLDefaultColumns | null): string;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
interface Op extends AlaSQLExpression {
|
|
52
|
+
export interface Op extends AlaSQLExpression {
|
|
53
53
|
left: ExpressionNode;
|
|
54
54
|
op: string;
|
|
55
55
|
right?: ExpressionNode;
|
|
@@ -57,71 +57,78 @@ declare module 'alasql' {
|
|
|
57
57
|
right2?: ExpressionNode;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
interface Column extends AlaSQLExpression {
|
|
60
|
+
export interface Column extends AlaSQLExpression {
|
|
61
61
|
columnid: string;
|
|
62
62
|
tableid?: string;
|
|
63
63
|
databaseid?: string;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
interface ParamValue extends AlaSQLExpression {
|
|
66
|
+
export interface ParamValue extends AlaSQLExpression {
|
|
67
67
|
param: string | number;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
interface NumValue extends AlaSQLExpression {
|
|
70
|
+
export interface NumValue extends AlaSQLExpression {
|
|
71
71
|
value: number;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
interface StringValue extends AlaSQLExpression {
|
|
74
|
+
export interface StringValue extends AlaSQLExpression {
|
|
75
75
|
value: string;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
interface LogicValue extends AlaSQLExpression {
|
|
78
|
+
export interface LogicValue extends AlaSQLExpression {
|
|
79
79
|
value: boolean;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
interface UniOp extends AlaSQLExpression {
|
|
82
|
+
export interface UniOp extends AlaSQLExpression {
|
|
83
83
|
op: string | null;
|
|
84
84
|
right: ExpressionNode;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
type ExpressionNode =
|
|
87
|
+
export type ExpressionNode =
|
|
88
|
+
| Op
|
|
89
|
+
| Column
|
|
90
|
+
| ParamValue
|
|
91
|
+
| NumValue
|
|
92
|
+
| StringValue
|
|
93
|
+
| LogicValue
|
|
94
|
+
| UniOp;
|
|
88
95
|
|
|
89
|
-
interface ExpressionWrapper extends AlaSQLExpression {
|
|
96
|
+
export interface ExpressionWrapper extends AlaSQLExpression {
|
|
90
97
|
expression: ExpressionNode;
|
|
91
98
|
reduced?: boolean;
|
|
92
99
|
}
|
|
93
100
|
|
|
94
|
-
interface Statement {
|
|
101
|
+
export interface Statement {
|
|
95
102
|
compile(databaseid: string): AlaSQLStatement;
|
|
96
103
|
where?: ExpressionWrapper;
|
|
97
104
|
[key: string]: unknown;
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
// abstract Syntax Tree
|
|
101
|
-
interface AlaSQLAST {
|
|
108
|
+
export interface AlaSQLAST {
|
|
102
109
|
statements: Statement[];
|
|
103
110
|
compile(databaseid: string): AlaSQLStatement;
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
// see https://github.com/alasql/alasql/wiki/User%20Defined%20Functions
|
|
107
|
-
interface userDefinedFunction {
|
|
114
|
+
export interface userDefinedFunction {
|
|
108
115
|
(...x: unknown[]): unknown;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
interface userDefinedFunctionLookUp {
|
|
118
|
+
export interface userDefinedFunctionLookUp {
|
|
112
119
|
[x: string]: userDefinedFunction;
|
|
113
120
|
}
|
|
114
121
|
|
|
115
122
|
// see https://github.com/alasql/alasql/wiki/User%20Defined%20Functions
|
|
116
|
-
interface userAggregator {
|
|
123
|
+
export interface userAggregator {
|
|
117
124
|
(value: unknown, accumulator: unknown, stage: number): unknown;
|
|
118
125
|
}
|
|
119
126
|
|
|
120
|
-
interface userAggregatorLookUp {
|
|
127
|
+
export interface userAggregatorLookUp {
|
|
121
128
|
[x: string]: userAggregator;
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
interface userFromFunction {
|
|
131
|
+
export interface userFromFunction {
|
|
125
132
|
(
|
|
126
133
|
dataReference: unknown,
|
|
127
134
|
options: unknown,
|
|
@@ -131,7 +138,7 @@ declare module 'alasql' {
|
|
|
131
138
|
): void;
|
|
132
139
|
}
|
|
133
140
|
|
|
134
|
-
interface userFromFunctionLookUp {
|
|
141
|
+
export interface userFromFunctionLookUp {
|
|
135
142
|
[x: string]: userFromFunction;
|
|
136
143
|
}
|
|
137
144
|
|
|
@@ -140,7 +147,7 @@ declare module 'alasql' {
|
|
|
140
147
|
*
|
|
141
148
|
* @interface database
|
|
142
149
|
*/
|
|
143
|
-
interface database {
|
|
150
|
+
export interface database {
|
|
144
151
|
/**
|
|
145
152
|
* The database ID.
|
|
146
153
|
*
|
|
@@ -163,7 +170,7 @@ declare module 'alasql' {
|
|
|
163
170
|
*
|
|
164
171
|
* @interface table
|
|
165
172
|
*/
|
|
166
|
-
interface table {
|
|
173
|
+
export interface table {
|
|
167
174
|
/**
|
|
168
175
|
* The array of data stored in the table which can be queried
|
|
169
176
|
*
|
|
@@ -178,7 +185,7 @@ declare module 'alasql' {
|
|
|
178
185
|
*
|
|
179
186
|
* @interface databaseLookUp
|
|
180
187
|
*/
|
|
181
|
-
interface databaseLookUp {
|
|
188
|
+
export interface databaseLookUp {
|
|
182
189
|
[databaseName: string]: database;
|
|
183
190
|
}
|
|
184
191
|
|
|
@@ -187,11 +194,11 @@ declare module 'alasql' {
|
|
|
187
194
|
*
|
|
188
195
|
* @interface tableLookUp
|
|
189
196
|
*/
|
|
190
|
-
interface tableLookUp {
|
|
197
|
+
export interface tableLookUp {
|
|
191
198
|
[tableName: string]: table;
|
|
192
199
|
}
|
|
193
200
|
|
|
194
|
-
interface Database {
|
|
201
|
+
export interface Database {
|
|
195
202
|
new (databaseid?: string): Database;
|
|
196
203
|
databaseid: string;
|
|
197
204
|
dbversion: number;
|
|
@@ -209,7 +216,7 @@ declare module 'alasql' {
|
|
|
209
216
|
autoval(tablename: string, colname: string, getNext: boolean): unknown;
|
|
210
217
|
}
|
|
211
218
|
|
|
212
|
-
interface AlaSQL {
|
|
219
|
+
export interface AlaSQL {
|
|
213
220
|
options: AlaSQLOptions;
|
|
214
221
|
error: Error;
|
|
215
222
|
<T = unknown>(sql: string, params?: any, cb?: AlaSQLCallback<T>, scope?: unknown): T;
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.19.2 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.19.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2025 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ SOFTWARE.
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.19.2';
|
|
145
|
+
alasql.build = 'develop-98e852ad';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -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;
|
|
@@ -9654,7 +9654,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
9654
9654
|
aft2 = '';
|
|
9655
9655
|
|
|
9656
9656
|
if (typeof query.groupStar !== 'undefined') {
|
|
9657
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
9657
|
+
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];};";
|
|
9658
9658
|
}
|
|
9659
9659
|
|
|
9660
9660
|
s += query.selectGroup
|
|
@@ -10138,7 +10138,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
10138
10138
|
'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
|
|
10139
10139
|
} else {
|
|
10140
10140
|
// Default overwrite mode
|
|
10141
|
-
sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
|
|
10141
|
+
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]};';
|
|
10142
10142
|
}
|
|
10143
10143
|
|
|
10144
10144
|
query.dirtyColumns = true;
|
|
@@ -10614,10 +10614,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
10614
10614
|
self.columns.forEach(function (col) {
|
|
10615
10615
|
|
|
10616
10616
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
10617
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
10617
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10618
10618
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
10619
10619
|
|
|
10620
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
10620
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10621
10621
|
return '';
|
|
10622
10622
|
|
|
10623
10623
|
} else {
|
|
@@ -11960,7 +11960,7 @@ yy.Over = class Over {
|
|
|
11960
11960
|
const allValues = this.right.map(value => value.value);
|
|
11961
11961
|
const allValuesStr = allValues.join(',');
|
|
11962
11962
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11963
|
-
s = `alasql.sets[
|
|
11963
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11964
11964
|
}
|
|
11965
11965
|
} else {
|
|
11966
11966
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -11994,7 +11994,7 @@ yy.Over = class Over {
|
|
|
11994
11994
|
const allValues = this.right.map(value => value.value);
|
|
11995
11995
|
const allValuesStr = allValues.join(',');
|
|
11996
11996
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11997
|
-
s = `!alasql.sets[
|
|
11997
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11998
11998
|
}
|
|
11999
11999
|
} else {
|
|
12000
12000
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -14068,7 +14068,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
14068
14068
|
|
|
14069
14069
|
table.update(
|
|
14070
14070
|
function (t) {
|
|
14071
|
-
for (var f in r) t[f] = r[f];
|
|
14071
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
14072
14072
|
},
|
|
14073
14073
|
table.data.indexOf(toreplace),
|
|
14074
14074
|
params
|
|
@@ -15839,7 +15839,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15839
15839
|
});
|
|
15840
15840
|
} else {
|
|
15841
15841
|
|
|
15842
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
15842
|
+
// 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]};';
|
|
15843
15843
|
sw = JSONtoJS(values);
|
|
15844
15844
|
}
|
|
15845
15845
|
}
|
|
@@ -15918,7 +15918,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15918
15918
|
self.output.columns.forEach(function (col) {
|
|
15919
15919
|
if (col.columnid === '*') {
|
|
15920
15920
|
// For *, expand all properties
|
|
15921
|
-
s += 'for(var key in r){ outputRow[key] = r[key]; }';
|
|
15921
|
+
s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
|
|
15922
15922
|
} else {
|
|
15923
15923
|
var colname = col.as || col.columnid;
|
|
15924
15924
|
// Direct property access for simple columns
|
|
@@ -15997,7 +15997,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15997
15997
|
if (col.columnid === '*') {
|
|
15998
15998
|
// For *, expand all properties
|
|
15999
15999
|
for (var key in r) {
|
|
16000
|
-
outputRow[key] = r[key];
|
|
16000
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16001
16001
|
}
|
|
16002
16002
|
} else {
|
|
16003
16003
|
var colname = col.as || col.columnid;
|
|
@@ -16348,7 +16348,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16348
16348
|
if (col.columnid === '*') {
|
|
16349
16349
|
// For *, expand all properties
|
|
16350
16350
|
for (var key in r) {
|
|
16351
|
-
outputRow[key] = r[key];
|
|
16351
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16352
16352
|
}
|
|
16353
16353
|
} else {
|
|
16354
16354
|
var colname = col.as || col.columnid;
|
|
@@ -16419,7 +16419,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16419
16419
|
if (col.columnid === '*') {
|
|
16420
16420
|
// For *, expand all properties
|
|
16421
16421
|
for (var key in r) {
|
|
16422
|
-
outputRow[key] = r[key];
|
|
16422
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16423
16423
|
}
|
|
16424
16424
|
} else {
|
|
16425
16425
|
var colname = col.as || col.columnid;
|
|
@@ -16525,6 +16525,7 @@ yy.Update.prototype.compile = function (databaseid) {
|
|
|
16525
16525
|
|
|
16526
16526
|
var statement = function (params, cb) {
|
|
16527
16527
|
var db = alasql.databases[databaseid];
|
|
16528
|
+
self.params = params;
|
|
16528
16529
|
|
|
16529
16530
|
if (db.engineid && alasql.engines[db.engineid].updateTable) {
|
|
16530
16531
|
|
|
@@ -16589,7 +16590,7 @@ yy.Update.prototype.compile = function (databaseid) {
|
|
|
16589
16590
|
if (col.columnid === '*') {
|
|
16590
16591
|
// For *, use INSERTED values
|
|
16591
16592
|
for (var key in inserted) {
|
|
16592
|
-
outputRow[key] = inserted[key];
|
|
16593
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
|
|
16593
16594
|
}
|
|
16594
16595
|
} else {
|
|
16595
16596
|
var colname = col.as || col.columnid;
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.19.2 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.19.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2025 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ SOFTWARE.
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.19.2';
|
|
145
|
+
alasql.build = 'develop-98e852ad';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -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;
|
|
@@ -9654,7 +9654,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
9654
9654
|
aft2 = '';
|
|
9655
9655
|
|
|
9656
9656
|
if (typeof query.groupStar !== 'undefined') {
|
|
9657
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
9657
|
+
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];};";
|
|
9658
9658
|
}
|
|
9659
9659
|
|
|
9660
9660
|
s += query.selectGroup
|
|
@@ -10138,7 +10138,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
10138
10138
|
'var w=p["' + escapeq(alias) + '"];for(var k in w){r["' + escapeq(alias) + '_"+k]=w[k]};';
|
|
10139
10139
|
} else {
|
|
10140
10140
|
// Default overwrite mode
|
|
10141
|
-
sp += 'var w=p["' + escapeq(alias) + '"];for(var k in w){r[k]=w[k]};';
|
|
10141
|
+
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]};';
|
|
10142
10142
|
}
|
|
10143
10143
|
|
|
10144
10144
|
query.dirtyColumns = true;
|
|
@@ -10614,10 +10614,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
10614
10614
|
self.columns.forEach(function (col) {
|
|
10615
10615
|
|
|
10616
10616
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
10617
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
10617
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10618
10618
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
10619
10619
|
|
|
10620
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
10620
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
10621
10621
|
return '';
|
|
10622
10622
|
|
|
10623
10623
|
} else {
|
|
@@ -11960,7 +11960,7 @@ yy.Over = class Over {
|
|
|
11960
11960
|
const allValues = this.right.map(value => value.value);
|
|
11961
11961
|
const allValuesStr = allValues.join(',');
|
|
11962
11962
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11963
|
-
s = `alasql.sets[
|
|
11963
|
+
s = `alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11964
11964
|
}
|
|
11965
11965
|
} else {
|
|
11966
11966
|
s = `(${rightJS()}.indexOf(${leftJS()}) > -1)`;
|
|
@@ -11994,7 +11994,7 @@ yy.Over = class Over {
|
|
|
11994
11994
|
const allValues = this.right.map(value => value.value);
|
|
11995
11995
|
const allValuesStr = allValues.join(',');
|
|
11996
11996
|
alasql.sets[allValuesStr] = alasql.sets[allValuesStr] || new Set(allValues);
|
|
11997
|
-
s = `!alasql.sets[
|
|
11997
|
+
s = `!alasql.sets[${JSON.stringify(allValuesStr)}].has(alasql.utils.getValueOf(${leftJS()}))`;
|
|
11998
11998
|
}
|
|
11999
11999
|
} else {
|
|
12000
12000
|
s = `(${rightJS()}.indexOf(${leftJS()}) === -1)`;
|
|
@@ -14068,7 +14068,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
14068
14068
|
|
|
14069
14069
|
table.update(
|
|
14070
14070
|
function (t) {
|
|
14071
|
-
for (var f in r) t[f] = r[f];
|
|
14071
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
14072
14072
|
},
|
|
14073
14073
|
table.data.indexOf(toreplace),
|
|
14074
14074
|
params
|
|
@@ -15839,7 +15839,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15839
15839
|
});
|
|
15840
15840
|
} else {
|
|
15841
15841
|
|
|
15842
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
15842
|
+
// 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]};';
|
|
15843
15843
|
sw = JSONtoJS(values);
|
|
15844
15844
|
}
|
|
15845
15845
|
}
|
|
@@ -15918,7 +15918,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15918
15918
|
self.output.columns.forEach(function (col) {
|
|
15919
15919
|
if (col.columnid === '*') {
|
|
15920
15920
|
// For *, expand all properties
|
|
15921
|
-
s += 'for(var key in r){ outputRow[key] = r[key]; }';
|
|
15921
|
+
s += 'for(var key in r){ if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key]; }';
|
|
15922
15922
|
} else {
|
|
15923
15923
|
var colname = col.as || col.columnid;
|
|
15924
15924
|
// Direct property access for simple columns
|
|
@@ -15997,7 +15997,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15997
15997
|
if (col.columnid === '*') {
|
|
15998
15998
|
// For *, expand all properties
|
|
15999
15999
|
for (var key in r) {
|
|
16000
|
-
outputRow[key] = r[key];
|
|
16000
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16001
16001
|
}
|
|
16002
16002
|
} else {
|
|
16003
16003
|
var colname = col.as || col.columnid;
|
|
@@ -16348,7 +16348,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16348
16348
|
if (col.columnid === '*') {
|
|
16349
16349
|
// For *, expand all properties
|
|
16350
16350
|
for (var key in r) {
|
|
16351
|
-
outputRow[key] = r[key];
|
|
16351
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16352
16352
|
}
|
|
16353
16353
|
} else {
|
|
16354
16354
|
var colname = col.as || col.columnid;
|
|
@@ -16419,7 +16419,7 @@ yy.Delete.prototype.compile = function (databaseid) {
|
|
|
16419
16419
|
if (col.columnid === '*') {
|
|
16420
16420
|
// For *, expand all properties
|
|
16421
16421
|
for (var key in r) {
|
|
16422
|
-
outputRow[key] = r[key];
|
|
16422
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = r[key];
|
|
16423
16423
|
}
|
|
16424
16424
|
} else {
|
|
16425
16425
|
var colname = col.as || col.columnid;
|
|
@@ -16525,6 +16525,7 @@ yy.Update.prototype.compile = function (databaseid) {
|
|
|
16525
16525
|
|
|
16526
16526
|
var statement = function (params, cb) {
|
|
16527
16527
|
var db = alasql.databases[databaseid];
|
|
16528
|
+
self.params = params;
|
|
16528
16529
|
|
|
16529
16530
|
if (db.engineid && alasql.engines[db.engineid].updateTable) {
|
|
16530
16531
|
|
|
@@ -16589,7 +16590,7 @@ yy.Update.prototype.compile = function (databaseid) {
|
|
|
16589
16590
|
if (col.columnid === '*') {
|
|
16590
16591
|
// For *, use INSERTED values
|
|
16591
16592
|
for (var key in inserted) {
|
|
16592
|
-
outputRow[key] = inserted[key];
|
|
16593
|
+
if(/^__proto__$/.test(key))Object.defineProperty(outputRow,key,{writable:true,enumerable:true,configurable:true});outputRow[key] = inserted[key];
|
|
16593
16594
|
}
|
|
16594
16595
|
} else {
|
|
16595
16596
|
var colname = col.as || col.columnid;
|