alasql 4.6.5 → 4.7.0

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- - _AlaSQL is an unfunded open source project installed 250k+ times each month. [Please donate your time](https://github.com/AlaSQL/alasql/issues?q=is%3Aopen+label%3A%22Help+wanted%22+sort%3Aupdated-desc). We appreciate any and all contributions we can get._
1
+ - _AlaSQL is an unfunded open source project installed 500k+ times each month. [Please donate your time](https://github.com/AlaSQL/alasql/issues?q=is%3Aopen+label%3A%22Help+wanted%22+sort%3Aupdated-desc). We appreciate any and all contributions we can get._
2
2
 
3
3
  - _Have a question? [Ask the AlaSQL bot](https://chat.openai.com/g/g-XcBL24WTe-alasql-bot) or post on [Stack Overflow](http://stackoverflow.com/questions/ask?tags=AlaSQL)._
4
4
 
@@ -626,7 +626,7 @@ Thanks to all the people who already contributed!
626
626
  * [Andrey Gershun](https://github.com/alasql)
627
627
  * [Mathias Rangel Wulff](https://twitter.com/rangelwulff)
628
628
 
629
- AlaSQL is an [OPEN Open Source Project](http://openopensource.org/). This means that:
629
+ AlaSQL is an [OPEN Open Source Project](https://openopensource.github.io/). This means that:
630
630
 
631
631
  > Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
632
632
 
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.4 build: develop-ea35f7aa | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.6 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.4
4
+ @version 4.6.6
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.4 build: develop-ea35f7aa | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.6 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.4
4
+ @version 4.6.6
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 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.6.4';
145
- alasql.build = 'develop-ea35f7aa';
144
+ alasql.version = '4.6.6';
145
+ alasql.build = 'develop-272b12b3';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -3619,6 +3619,19 @@ async function fetchData(path, success, error, async) {
3619
3619
  }
3620
3620
 
3621
3621
  function getData(path, success, error) {
3622
+ return _fetch(path)
3623
+ .then(response => response.text())
3624
+ .then(txt => {
3625
+ success(txt);
3626
+ })
3627
+ .catch(e => {
3628
+ if (error) return error(e);
3629
+ console.error(e);
3630
+ throw e;
3631
+ });
3632
+ }
3633
+
3634
+ function getBinaryData(path, success, error) {
3622
3635
  return _fetch(path)
3623
3636
  .then(response => response.arrayBuffer())
3624
3637
  .then(buf => {
@@ -3658,7 +3671,7 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
3658
3671
  fs = require('fs');
3659
3672
 
3660
3673
  if (/^[a-z]+:\/\//i.test(path)) {
3661
- fetchData(path, success, error, runAsync);
3674
+ return getBinaryData(path, success, error);
3662
3675
  } else {
3663
3676
  if (runAsync) {
3664
3677
  fs.readFile(path, function (err, data) {
@@ -9637,7 +9650,7 @@ yy.Select.prototype.compilePivot = function (query) {
9637
9650
  }
9638
9651
  }
9639
9652
  // Provide a fallback if still not found
9640
- aggColDef = aggColDef || { columnid: exprcolid, dbtypeid: 'OBJECT' };
9653
+ aggColDef = aggColDef || {columnid: exprcolid, dbtypeid: 'OBJECT'};
9641
9654
 
9642
9655
  // Keep only the grouping columns initially
9643
9656
  query.columns = query.columns.filter(function (col) {
@@ -16545,7 +16558,12 @@ alasql.from.JSON = function (filename, opts, cb, idx, query) {
16545
16558
  }
16546
16559
  }),
16547
16560
  err => {
16548
- throw new Error(err);
16561
+ const error = err instanceof Error ? err : new Error(err);
16562
+ if(query && query.cb) {
16563
+ query.cb(null, error);
16564
+ return;
16565
+ }
16566
+ throw error;
16549
16567
  };
16550
16568
  return res;
16551
16569
  };
@@ -16570,11 +16588,16 @@ const jsonl = ext => {
16570
16588
  }
16571
16589
  });
16572
16590
  if (cb) {
16573
- res = cb(out, idx, query);
16591
+ out = cb(out, idx, query);
16574
16592
  }
16575
16593
  },
16576
16594
  err => {
16577
- throw new Error(err);
16595
+ const error = err instanceof Error ? err : new Error(err);
16596
+ if(query && query.cb) {
16597
+ query.cb(null, error);
16598
+ return;
16599
+ }
16600
+ throw error;
16578
16601
  }
16579
16602
  );
16580
16603
  return out;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.4 build: develop-ea35f7aa | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.6 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.4
4
+ @version 4.6.6
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 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.6.4';
145
- alasql.build = 'develop-ea35f7aa';
144
+ alasql.version = '4.6.6';
145
+ alasql.build = 'develop-272b12b3';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -3619,6 +3619,19 @@ async function fetchData(path, success, error, async) {
3619
3619
  }
3620
3620
 
3621
3621
  function getData(path, success, error) {
3622
+ return _fetch(path)
3623
+ .then(response => response.text())
3624
+ .then(txt => {
3625
+ success(txt);
3626
+ })
3627
+ .catch(e => {
3628
+ if (error) return error(e);
3629
+ console.error(e);
3630
+ throw e;
3631
+ });
3632
+ }
3633
+
3634
+ function getBinaryData(path, success, error) {
3622
3635
  return _fetch(path)
3623
3636
  .then(response => response.arrayBuffer())
3624
3637
  .then(buf => {
@@ -3658,7 +3671,7 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
3658
3671
  fs = require('fs');
3659
3672
 
3660
3673
  if (/^[a-z]+:\/\//i.test(path)) {
3661
- fetchData(path, success, error, runAsync);
3674
+ return getBinaryData(path, success, error);
3662
3675
  } else {
3663
3676
  if (runAsync) {
3664
3677
  fs.readFile(path, function (err, data) {
@@ -9637,7 +9650,7 @@ yy.Select.prototype.compilePivot = function (query) {
9637
9650
  }
9638
9651
  }
9639
9652
  // Provide a fallback if still not found
9640
- aggColDef = aggColDef || { columnid: exprcolid, dbtypeid: 'OBJECT' };
9653
+ aggColDef = aggColDef || {columnid: exprcolid, dbtypeid: 'OBJECT'};
9641
9654
 
9642
9655
  // Keep only the grouping columns initially
9643
9656
  query.columns = query.columns.filter(function (col) {
@@ -16545,7 +16558,12 @@ alasql.from.JSON = function (filename, opts, cb, idx, query) {
16545
16558
  }
16546
16559
  }),
16547
16560
  err => {
16548
- throw new Error(err);
16561
+ const error = err instanceof Error ? err : new Error(err);
16562
+ if(query && query.cb) {
16563
+ query.cb(null, error);
16564
+ return;
16565
+ }
16566
+ throw error;
16549
16567
  };
16550
16568
  return res;
16551
16569
  };
@@ -16570,11 +16588,16 @@ const jsonl = ext => {
16570
16588
  }
16571
16589
  });
16572
16590
  if (cb) {
16573
- res = cb(out, idx, query);
16591
+ out = cb(out, idx, query);
16574
16592
  }
16575
16593
  },
16576
16594
  err => {
16577
- throw new Error(err);
16595
+ const error = err instanceof Error ? err : new Error(err);
16596
+ if(query && query.cb) {
16597
+ query.cb(null, error);
16598
+ return;
16599
+ }
16600
+ throw error;
16578
16601
  }
16579
16602
  );
16580
16603
  return out;