alasql 1.7.3 → 1.7.4
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/.github/workflows/nodejs.yml +1 -1
- package/README.md +9 -7
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql-worker.min.js +2 -2
- package/dist/alasql.fs.js +16 -31
- package/dist/alasql.js +16 -31
- package/dist/alasql.min.js +2 -2
- package/package.json +23 -16
- package/yarn-error.log +1797 -3001
package/README.md
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
<h2>
|
|
2
|
-
Please use version 1.x as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a parameters to AlaSQL.
|
|
3
|
-
</h2>
|
|
4
|
-
|
|
5
1
|
_AlaSQL is an open source project used on more than two million page views per month - and we appreciate any and all contributions we can get. [Please help out](https://github.com/agershun/alasql/labels/Please%20help%20out%21)._
|
|
6
2
|
|
|
7
3
|
_Have a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask?tags=AlaSQL) using the "alasql" tag._
|
|
@@ -475,7 +471,7 @@ var b = browserify("./main.js").bundle();
|
|
|
475
471
|
|
|
476
472
|
#### Vue
|
|
477
473
|
|
|
478
|
-
For some frameworks (lige Vue) alasql cant access XLSX by it self. We recommend
|
|
474
|
+
For some frameworks (lige Vue) alasql cant access XLSX by it self. We recommend handling it by including AlaSQL the following way:
|
|
479
475
|
|
|
480
476
|
```import alasql from 'alasql';
|
|
481
477
|
import XLSX from 'xlsx';
|
|
@@ -605,9 +601,15 @@ The testruns can be found in the [testlog](TESTLOG.md).
|
|
|
605
601
|
|
|
606
602
|
|
|
607
603
|
|
|
608
|
-
##
|
|
604
|
+
## Contributing
|
|
605
|
+
|
|
606
|
+
See [Contributing](CONTRIBUTING.md) for details.
|
|
607
|
+
|
|
608
|
+
Thanks to all the people who already contributed!
|
|
609
609
|
|
|
610
|
-
|
|
610
|
+
<a href="https://github.com/agershun/alasql/graphs/contributors">
|
|
611
|
+
<img src="https://contributors-img.web.app/image?repo=agershun/alasql" />
|
|
612
|
+
</a>
|
|
611
613
|
|
|
612
614
|
|
|
613
615
|
## License
|
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.4-develop-89075a50undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.4-develop-89075a50undefined
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
2
|
-
!function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.alasql=e()}(this,function(){function i(r,e,
|
|
1
|
+
//! AlaSQL v1.7.4-develop-89075a50undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
|
+
!function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.alasql=e()}(this,function(){function i(r,e,o){"function"==typeof(e=e||[])&&(scope=o,o=e,e=[]),"object"!=typeof e&&(e=[e]);var t=i.lastid++;i.buffer[t]=o,i.webworker.postMessage({id:t,sql:r,params:e})}var a;if(i.options={},i.options.progress=function(){},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)},i.promise=function(){throw new Error("Please include a Promise/A+ library")},"undefined"!=typeof Promise&&(a=function(r,e,n,s){return new Promise(function(o,t){i(r,e,function(r,e){e?t(e):(n&&s&&!1!==i.options.progress&&i.options.progress(n,s),o(r))})})},i.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return a(r,e);if(!isArray(r)||r.length<1||void 0!==e)throw new Error("Error in .promise parameters");var o=r;if(!(o.length<1)){for(var t,n,s=[],i=0;i<o.length;i++){if("string"==typeof(n=o[i])&&(n=[n]),!isArray(n)||n.length<1||2<n.length)throw new Error("Error in .promise parameter");t=n[0],n=n[1]||void 0,s.push(a(t,n,i,o.length))}return Promise.all(s)}}),i=i||!1)return i.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(i.worker=function(r,e,o){if(void 0===(r=!0===r?void 0:r))for(var t=document.getElementsByTagName("script"),n=0;n<t.length;n++){if("alasql-worker.js"===t[n].src.substr(-16).toLowerCase()){r=t[n].src.substr(0,t[n].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===t[n].src.substr(-20).toLowerCase()){r=t[n].src.substr(0,t[n].src.length-20)+"alasql.min.js";break}if("alasql.js"===t[n].src.substr(-9).toLowerCase()){r=t[n].src;break}if("alasql.min.js"===t[n].src.substr(-13).toLowerCase()){r=t[n].src.substr(0,t[n].src.length-13)+"alasql.min.js";break}}if(void 0===r)throw new Error("Path to alasql.js is not specified");var s;!1!==r?(s=(s="importScripts('")+r+"');self.onmessage = function(event) {alasql(event.data.sql,event.data.params, function(data){postMessage({id:event.data.id, data:data});});}",s=new Blob([s],{type:"text/plain"}),i.webworker=new Worker(URL.createObjectURL(s)),i.webworker.onmessage=function(r){var e=r.data.id;i.buffer[e](r.data.data),delete i.buffer[e]},i.webworker.onerror=function(r){throw r},1<arguments.length&&i("REQUIRE "+e.map(function(r){return'"'+r+'"'}).join(","),[],o)):!1===r&&delete i.webworker}),i.lastid=0,i.buffer={},i.worker(),i;throw new Error("alasql was not found")});
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.4-develop-89075a50undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.4-develop-89075a50undefined
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
142
142
|
Current version of alasql
|
|
143
143
|
@constant {string}
|
|
144
144
|
*/
|
|
145
|
-
alasql.version = '1.7.
|
|
145
|
+
alasql.version = '1.7.4-develop-89075a50undefined';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -4328,12 +4328,6 @@ var getXLSX = function () {
|
|
|
4328
4328
|
return XLSX;
|
|
4329
4329
|
};
|
|
4330
4330
|
|
|
4331
|
-
var jss = JSON.stringify;
|
|
4332
|
-
var reName = /[^a-z\d@-_]+/gi;
|
|
4333
|
-
var nss = (e) => e.replace(reName, '');
|
|
4334
|
-
var reTick = /`/g;
|
|
4335
|
-
var tss = (e) => e.replace(reTick, '');
|
|
4336
|
-
|
|
4337
4331
|
// set AlaSQl path
|
|
4338
4332
|
alasql.path = alasql.utils.findAlaSQLPath();
|
|
4339
4333
|
|
|
@@ -6314,7 +6308,7 @@ yy.Search.prototype.toString = function () {
|
|
|
6314
6308
|
|
|
6315
6309
|
yy.Search.prototype.toJS = function (context) {
|
|
6316
6310
|
|
|
6317
|
-
var s = 'this.queriesfn[' +
|
|
6311
|
+
var s = 'this.queriesfn[' + (this.queriesidx - 1) + '](this.params,null,' + context + ')';
|
|
6318
6312
|
// var s = '';
|
|
6319
6313
|
return s;
|
|
6320
6314
|
};
|
|
@@ -6675,11 +6669,11 @@ alasql.srch.SET = function (val, args, stope, params) {
|
|
|
6675
6669
|
.map(function (st) {
|
|
6676
6670
|
|
|
6677
6671
|
if (st.method === '@') {
|
|
6678
|
-
return
|
|
6672
|
+
return "alasql.vars['" + st.variable + "']=" + st.expression.toJS('x', '');
|
|
6679
6673
|
} else if (st.method === '$') {
|
|
6680
|
-
return
|
|
6674
|
+
return "params['" + st.variable + "']=" + st.expression.toJS('x', '');
|
|
6681
6675
|
} else {
|
|
6682
|
-
return
|
|
6676
|
+
return "x['" + st.column.columnid + "']=" + st.expression.toJS('x', '');
|
|
6683
6677
|
}
|
|
6684
6678
|
})
|
|
6685
6679
|
.join(';');
|
|
@@ -6766,26 +6760,17 @@ var compileSearchOrder = function (order) {
|
|
|
6766
6760
|
s += 'if(a' + dg + '==b' + dg + '){';
|
|
6767
6761
|
} else {
|
|
6768
6762
|
s +=
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
"]||'')" +
|
|
6763
|
+
"if((a['" +
|
|
6764
|
+
columnid +
|
|
6765
|
+
"']||'')" +
|
|
6772
6766
|
dg +
|
|
6773
6767
|
(ord.direction === 'ASC' ? '>' : '<') +
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
"]||'')" +
|
|
6768
|
+
"(b['" +
|
|
6769
|
+
columnid +
|
|
6770
|
+
"']||'')" +
|
|
6777
6771
|
dg +
|
|
6778
6772
|
')return 1;';
|
|
6779
|
-
s +=
|
|
6780
|
-
'if((a[' +
|
|
6781
|
-
jss(columnid) +
|
|
6782
|
-
"]||'')" +
|
|
6783
|
-
dg +
|
|
6784
|
-
'==(b[' +
|
|
6785
|
-
jss(columnid) +
|
|
6786
|
-
"]||'')" +
|
|
6787
|
-
dg +
|
|
6788
|
-
'){';
|
|
6773
|
+
s += "if((a['" + columnid + "']||'')" + dg + "==(b['" + columnid + "']||'')" + dg + '){';
|
|
6789
6774
|
}
|
|
6790
6775
|
} else {
|
|
6791
6776
|
dg = '.valueOf()';
|
|
@@ -17190,7 +17175,8 @@ alasql.into.XLSX = function (filename, opts, data, columns, cb) {
|
|
|
17190
17175
|
var colm = 1,
|
|
17191
17176
|
rowm = 1;
|
|
17192
17177
|
}
|
|
17193
|
-
var
|
|
17178
|
+
var zeroColumnFix = columns.length ? 0 : 1;
|
|
17179
|
+
var colmax = Math.max(col0 + columns.length - 1 + zeroColumnFix, colm);
|
|
17194
17180
|
var rowmax = Math.max(row0 + dataLength + 2, rowm);
|
|
17195
17181
|
|
|
17196
17182
|
var i = row0 + 1;
|
|
@@ -18779,7 +18765,6 @@ LS.dropDatabase = function (lsdbid, ifexists, cb) {
|
|
|
18779
18765
|
|
|
18780
18766
|
LS.attachDatabase = function (lsdbid, databaseid, args, params, cb) {
|
|
18781
18767
|
var res = 1;
|
|
18782
|
-
// console.warn({lsdbid, databaseid, args, params, cb, dbs: Object.keys(alasql.databases)})
|
|
18783
18768
|
if (alasql.databases[databaseid]) {
|
|
18784
18769
|
throw new Error('Unable to attach database as "' + databaseid + '" because it already exists');
|
|
18785
18770
|
}
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.4-develop-89075a50undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.4-develop-89075a50undefined
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
142
142
|
Current version of alasql
|
|
143
143
|
@constant {string}
|
|
144
144
|
*/
|
|
145
|
-
alasql.version = '1.7.
|
|
145
|
+
alasql.version = '1.7.4-develop-89075a50undefined';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -4323,12 +4323,6 @@ var getXLSX = function () {
|
|
|
4323
4323
|
return XLSX;
|
|
4324
4324
|
};
|
|
4325
4325
|
|
|
4326
|
-
var jss = JSON.stringify;
|
|
4327
|
-
var reName = /[^a-z\d@-_]+/gi;
|
|
4328
|
-
var nss = (e) => e.replace(reName, '');
|
|
4329
|
-
var reTick = /`/g;
|
|
4330
|
-
var tss = (e) => e.replace(reTick, '');
|
|
4331
|
-
|
|
4332
4326
|
// set AlaSQl path
|
|
4333
4327
|
alasql.path = alasql.utils.findAlaSQLPath();
|
|
4334
4328
|
|
|
@@ -6309,7 +6303,7 @@ yy.Search.prototype.toString = function () {
|
|
|
6309
6303
|
|
|
6310
6304
|
yy.Search.prototype.toJS = function (context) {
|
|
6311
6305
|
|
|
6312
|
-
var s = 'this.queriesfn[' +
|
|
6306
|
+
var s = 'this.queriesfn[' + (this.queriesidx - 1) + '](this.params,null,' + context + ')';
|
|
6313
6307
|
// var s = '';
|
|
6314
6308
|
return s;
|
|
6315
6309
|
};
|
|
@@ -6670,11 +6664,11 @@ alasql.srch.SET = function (val, args, stope, params) {
|
|
|
6670
6664
|
.map(function (st) {
|
|
6671
6665
|
|
|
6672
6666
|
if (st.method === '@') {
|
|
6673
|
-
return
|
|
6667
|
+
return "alasql.vars['" + st.variable + "']=" + st.expression.toJS('x', '');
|
|
6674
6668
|
} else if (st.method === '$') {
|
|
6675
|
-
return
|
|
6669
|
+
return "params['" + st.variable + "']=" + st.expression.toJS('x', '');
|
|
6676
6670
|
} else {
|
|
6677
|
-
return
|
|
6671
|
+
return "x['" + st.column.columnid + "']=" + st.expression.toJS('x', '');
|
|
6678
6672
|
}
|
|
6679
6673
|
})
|
|
6680
6674
|
.join(';');
|
|
@@ -6761,26 +6755,17 @@ var compileSearchOrder = function (order) {
|
|
|
6761
6755
|
s += 'if(a' + dg + '==b' + dg + '){';
|
|
6762
6756
|
} else {
|
|
6763
6757
|
s +=
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
"]||'')" +
|
|
6758
|
+
"if((a['" +
|
|
6759
|
+
columnid +
|
|
6760
|
+
"']||'')" +
|
|
6767
6761
|
dg +
|
|
6768
6762
|
(ord.direction === 'ASC' ? '>' : '<') +
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
"]||'')" +
|
|
6763
|
+
"(b['" +
|
|
6764
|
+
columnid +
|
|
6765
|
+
"']||'')" +
|
|
6772
6766
|
dg +
|
|
6773
6767
|
')return 1;';
|
|
6774
|
-
s +=
|
|
6775
|
-
'if((a[' +
|
|
6776
|
-
jss(columnid) +
|
|
6777
|
-
"]||'')" +
|
|
6778
|
-
dg +
|
|
6779
|
-
'==(b[' +
|
|
6780
|
-
jss(columnid) +
|
|
6781
|
-
"]||'')" +
|
|
6782
|
-
dg +
|
|
6783
|
-
'){';
|
|
6768
|
+
s += "if((a['" + columnid + "']||'')" + dg + "==(b['" + columnid + "']||'')" + dg + '){';
|
|
6784
6769
|
}
|
|
6785
6770
|
} else {
|
|
6786
6771
|
dg = '.valueOf()';
|
|
@@ -17185,7 +17170,8 @@ alasql.into.XLSX = function (filename, opts, data, columns, cb) {
|
|
|
17185
17170
|
var colm = 1,
|
|
17186
17171
|
rowm = 1;
|
|
17187
17172
|
}
|
|
17188
|
-
var
|
|
17173
|
+
var zeroColumnFix = columns.length ? 0 : 1;
|
|
17174
|
+
var colmax = Math.max(col0 + columns.length - 1 + zeroColumnFix, colm);
|
|
17189
17175
|
var rowmax = Math.max(row0 + dataLength + 2, rowm);
|
|
17190
17176
|
|
|
17191
17177
|
var i = row0 + 1;
|
|
@@ -18774,7 +18760,6 @@ LS.dropDatabase = function (lsdbid, ifexists, cb) {
|
|
|
18774
18760
|
|
|
18775
18761
|
LS.attachDatabase = function (lsdbid, databaseid, args, params, cb) {
|
|
18776
18762
|
var res = 1;
|
|
18777
|
-
// console.warn({lsdbid, databaseid, args, params, cb, dbs: Object.keys(alasql.databases)})
|
|
18778
18763
|
if (alasql.databases[databaseid]) {
|
|
18779
18764
|
throw new Error('Unable to attach database as "' + databaseid + '" because it already exists');
|
|
18780
18765
|
}
|