alasql 4.6.1 → 4.6.3

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,8 +1,8 @@
1
- - _AlaSQL is an unfunded open source project installed 200k+ 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 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._
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
 
5
- [![CI-test](https://github.com/alasql/alasql/workflows/CI-test/badge.svg)](https://github.com/alasql/alasql/actions)
5
+ [![CI-test](https://github.com/alasql/alasql/workflows/CI%20build%20&%20test/badge.svg)](https://github.com/alasql/alasql/actions)
6
6
  [![NPM downloads](http://img.shields.io/npm/dm/alasql.svg?style=flat&label=npm%20downloads)](https://npm-stat.com/charts.html?package=alasql)
7
7
  [![OPEN open source software](https://img.shields.io/badge/Open--OSS-%E2%9C%94-brightgreen.svg)](http://open-oss.com)
8
8
  [![Release](https://img.shields.io/github/release/alasql/alasql.svg?label=npm&a)](https://www.npmjs.com/package/alasql)
@@ -600,6 +600,15 @@ AlaSQL uses `SQLLOGICTEST` to test its compatibility with SQL-99. The tests incl
600
600
 
601
601
  The testruns can be found in the [testlog](TESTLOG.md).
602
602
 
603
+ ## Rebuilding the parser
604
+
605
+ To rebuild the parser, follow these steps:
606
+
607
+ * Make changes to alasqlparser.jison
608
+ * `npm install -g jison`
609
+ * `npm run jison`
610
+ * `npm test` to validate the changes made
611
+ * Commit changes to alasqlparser.jison and alasqlparser.js
603
612
 
604
613
 
605
614
  ## Contributing
@@ -612,13 +621,7 @@ Thanks to all the people who already contributed!
612
621
  <img src="https://contributors-img.web.app/image?repo=alasql/alasql" />
613
622
  </a>
614
623
 
615
-
616
- ## License
617
-
618
- MIT - see [MIT licence information](LICENSE)
619
-
620
-
621
- ## Main contributors
624
+ **Main contributors**
622
625
 
623
626
  * [Andrey Gershun](https://github.com/alasql)
624
627
  * [Mathias Rangel Wulff](https://twitter.com/rangelwulff)
@@ -629,15 +632,51 @@ AlaSQL is an [OPEN Open Source Project](http://openopensource.org/). This means
629
632
 
630
633
  We appreciate any and all contributions we can get. If you feel like contributing, have a look at [CONTRIBUTING.md](https://github.com/alasql/alasql/blob/develop/CONTRIBUTING.md)
631
634
 
632
- ## Rebuilding the parser
633
635
 
634
- To rebuild the parser, follow these steps:
635
636
 
636
- * Make changes to alasqlparser.jison
637
- * `npm install -g jison`
638
- * `npm run jison`
639
- * `npm test` to validate the changes made
640
- * Commit changes to alasqlparser.jison and alasqlparser.js
637
+ ## Sponsors
638
+
639
+ We extend our heartfelt thanks to each and every sponsor for generously supporting the AlaSQL open-source project by providing infrastructure at no cost. Their contributions enhance the development experience, and we highly recommend exploring their offerings.
640
+
641
+
642
+ ### Faster GitHub Actions with Blacksmith
643
+
644
+ [Blacksmith](https://www.blacksmith.sh/?source=alasql) significantly improves the speed of our GitHub Actions workflows by offering more powerful machines and enhanced caching mechanisms. Transitining was a one-line change and it has reduced our automated test times from 70-90 seconds to 15-17 seconds.
645
+
646
+ <a href="https://www.blacksmith.sh/?source=alasql">
647
+ <img src="https://github.com/user-attachments/assets/a85a8a5f-65fd-48e1-aaad-b3f247248928" alt="Blacksmith Logo" width="300">
648
+ </a>
649
+
650
+ ----
651
+
652
+ ### Browser Testing on Physical Devices with BrowserStack
653
+
654
+ [BrowserStack](https://www.browserstack.com/?source=alasql) enables us to run automated tests in real browsers on physical devices to help us identify cross-browser issues early.
655
+
656
+ <a href="https://www.browserstack.com/?source=alasql">
657
+ <img src="https://github.com/user-attachments/assets/9f74c25b-7dde-4a62-944e-8f23fc399ba9" alt="BrowserStack Logo" width="300">
658
+ </a>
659
+
660
+ ----
661
+
662
+ ### Development Practice Tracking with OpenSSF
663
+
664
+ The [Open Source Security Foundation (OpenSSF)](https://openssf.org) provides automated tools to evaluate and monitor the development practices in our repository, ensuring we maintain high standards of security and reliability.
665
+
666
+ <div style="background-color: #321e6b; padding: 10px;">
667
+ <a href="https://openssf.org">
668
+ <img src="https://github.com/user-attachments/assets/30a5e4ef-62b2-431d-905e-19ce5f9b6048" alt="OpenSSF Logo" width="300">
669
+ </a>
670
+ </div>
671
+
672
+
673
+
674
+ ## License
675
+
676
+ MIT - see [MIT licence information](LICENSE)
677
+
678
+
679
+
641
680
 
642
681
  ## Credits
643
682
 
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.0 build: develop-e45f0308 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.2 build: develop-8fb37384 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.0
4
+ @version 4.6.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 Andrey Gershun & Mathias Wulff
package/dist/alasql.d.ts CHANGED
@@ -153,14 +153,9 @@ declare module 'alasql' {
153
153
  interface AlaSQL {
154
154
  options: AlaSQLOptions;
155
155
  error: Error;
156
- <T = unknown>(
157
- sql: string,
158
- params?: Record<string, unknown>,
159
- cb?: AlaSQLCallback<T>,
160
- scope?: unknown
161
- ): T;
156
+ <T = unknown>(sql: string, params?: any, cb?: AlaSQLCallback<T>, scope?: unknown): T;
162
157
  parse(sql: string): AlaSQLAST;
163
- promise<T = unknown>(sql: string, params?: Record<string, unknown>): Promise<T>;
158
+ promise<T = unknown>(sql: string, params?: any): Promise<T>;
164
159
  fn: userDefinedFunctionLookUp;
165
160
  from: userFromFunctionLookUp;
166
161
  aggr: userAggregatorLookUp;
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.0 build: develop-e45f0308 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.2 build: develop-8fb37384 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.0
4
+ @version 4.6.2
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.0';
145
- alasql.build = 'develop-e45f0308';
144
+ alasql.version = '4.6.2';
145
+ alasql.build = 'develop-8fb37384';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -4694,6 +4694,23 @@ alasql.exec = function (sql, params, cb, scope) {
4694
4694
  }
4695
4695
  };
4696
4696
 
4697
+ /**
4698
+ * Clears any unneeded properties from a given AST statement closure used for caching
4699
+ * @param {Object} statement the statement to cleanup
4700
+ */
4701
+ function cleanupCache(statement) {
4702
+ if (!statement) {
4703
+ return;
4704
+ }
4705
+ if (!alasql.options.cache) {
4706
+ return;
4707
+ }
4708
+ // cleanup the table data to prevent storing this information in the SQL cache
4709
+ if (statement && statement.query && statement.query.data) {
4710
+ statement.query.data = [];
4711
+ }
4712
+ }
4713
+
4697
4714
  /**
4698
4715
  Run SQL statement on specific database
4699
4716
  */
@@ -4708,7 +4725,9 @@ alasql.dexec = function (databaseid, sql, params, cb, scope) {
4708
4725
  let statement = db.sqlCache[hh];
4709
4726
  // If database structure was not changed since last time return cache
4710
4727
  if (statement && db.dbversion === statement.dbversion) {
4711
- return statement(params, cb);
4728
+ var res = statement(params, cb);
4729
+ cleanupCache(statement);
4730
+ return res;
4712
4731
  }
4713
4732
  }
4714
4733
 
@@ -4751,6 +4770,7 @@ alasql.dexec = function (databaseid, sql, params, cb, scope) {
4751
4770
  db.sqlCache[hh] = statement;
4752
4771
  }
4753
4772
  var res = (alasql.res = statement(params, cb, scope));
4773
+ cleanupCache(statement);
4754
4774
  return res;
4755
4775
  }
4756
4776
  alasql.precompile(ast.statements[0], alasql.useid, params);
@@ -16638,7 +16658,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
16638
16658
  parseText(contents);
16639
16659
  } else {
16640
16660
  contents = alasql.utils.autoExtFilename(contents, 'csv', opts);
16641
- alasql.utils.loadFile(contents, !!cb, parseText, query.cb);
16661
+ alasql.utils.loadFile(contents, !!cb, parseText, e => query.cb(null, e));
16642
16662
  }
16643
16663
  return res;
16644
16664
  };
@@ -16763,6 +16783,10 @@ function XLSXLSX(X, filename, opts, cb, idx, query) {
16763
16783
  }
16764
16784
  },
16765
16785
  function (err) {
16786
+ if(query && query.cb) {
16787
+ query.cb(null, err);
16788
+ return;
16789
+ }
16766
16790
  throw err;
16767
16791
  }
16768
16792
  );
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.0 build: develop-e45f0308 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.2 build: develop-8fb37384 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.0
4
+ @version 4.6.2
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.0';
145
- alasql.build = 'develop-e45f0308';
144
+ alasql.version = '4.6.2';
145
+ alasql.build = 'develop-8fb37384';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -4694,6 +4694,23 @@ alasql.exec = function (sql, params, cb, scope) {
4694
4694
  }
4695
4695
  };
4696
4696
 
4697
+ /**
4698
+ * Clears any unneeded properties from a given AST statement closure used for caching
4699
+ * @param {Object} statement the statement to cleanup
4700
+ */
4701
+ function cleanupCache(statement) {
4702
+ if (!statement) {
4703
+ return;
4704
+ }
4705
+ if (!alasql.options.cache) {
4706
+ return;
4707
+ }
4708
+ // cleanup the table data to prevent storing this information in the SQL cache
4709
+ if (statement && statement.query && statement.query.data) {
4710
+ statement.query.data = [];
4711
+ }
4712
+ }
4713
+
4697
4714
  /**
4698
4715
  Run SQL statement on specific database
4699
4716
  */
@@ -4708,7 +4725,9 @@ alasql.dexec = function (databaseid, sql, params, cb, scope) {
4708
4725
  let statement = db.sqlCache[hh];
4709
4726
  // If database structure was not changed since last time return cache
4710
4727
  if (statement && db.dbversion === statement.dbversion) {
4711
- return statement(params, cb);
4728
+ var res = statement(params, cb);
4729
+ cleanupCache(statement);
4730
+ return res;
4712
4731
  }
4713
4732
  }
4714
4733
 
@@ -4751,6 +4770,7 @@ alasql.dexec = function (databaseid, sql, params, cb, scope) {
4751
4770
  db.sqlCache[hh] = statement;
4752
4771
  }
4753
4772
  var res = (alasql.res = statement(params, cb, scope));
4773
+ cleanupCache(statement);
4754
4774
  return res;
4755
4775
  }
4756
4776
  alasql.precompile(ast.statements[0], alasql.useid, params);
@@ -16638,7 +16658,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
16638
16658
  parseText(contents);
16639
16659
  } else {
16640
16660
  contents = alasql.utils.autoExtFilename(contents, 'csv', opts);
16641
- alasql.utils.loadFile(contents, !!cb, parseText, query.cb);
16661
+ alasql.utils.loadFile(contents, !!cb, parseText, e => query.cb(null, e));
16642
16662
  }
16643
16663
  return res;
16644
16664
  };
@@ -16763,6 +16783,10 @@ function XLSXLSX(X, filename, opts, cb, idx, query) {
16763
16783
  }
16764
16784
  },
16765
16785
  function (err) {
16786
+ if(query && query.cb) {
16787
+ query.cb(null, err);
16788
+ return;
16789
+ }
16766
16790
  throw err;
16767
16791
  }
16768
16792
  );