alasql 4.6.0 → 4.6.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/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.5.2 build: develop-1e5fefa4 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.1 build: develop-a4c1a42d | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.5.2
4
+ @version 4.6.1
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 Andrey Gershun & Mathias Wulff
package/dist/alasql.d.ts CHANGED
@@ -3,8 +3,9 @@
3
3
  declare module 'alasql' {
4
4
  import * as xlsx from 'xlsx';
5
5
 
6
- interface AlaSQLCallback {
7
- (data?: any, err?: Error): void;
6
+ // Callback with error-first convention and optional data
7
+ interface AlaSQLCallback<T = unknown> {
8
+ (err: Error | null, data?: T): void;
8
9
  }
9
10
 
10
11
  interface AlaSQLOptions {
@@ -15,7 +16,7 @@ declare module 'alasql' {
15
16
  casesensitive: boolean; // table and column names are case sensitive and converted to lower-case
16
17
  logtarget: string; // target for log. Values: 'console', 'output', 'id' of html tag
17
18
  logprompt: boolean; // print SQL at log
18
- modifier: any; // values: RECORDSET, VALUE, ROW, COLUMN, MATRIX, TEXTSTRING, INDEX
19
+ modifier?: 'RECORDSET' | 'VALUE' | 'ROW' | 'COLUMN' | 'MATRIX' | 'TEXTSTRING' | 'INDEX';
19
20
  columnlookup: number; // how many rows to lookup to define columns
20
21
  autovertex: boolean; // create vertex if not found
21
22
  usedbo: boolean; // use dbo as current database (for partial T-SQL comaptibility)
@@ -30,12 +31,12 @@ declare module 'alasql' {
30
31
  oracle: boolean;
31
32
  sqlite: boolean;
32
33
  orientdb: boolean;
33
- excel: any;
34
+ excel?: xlsx.WorkBook; // now typed
34
35
  }
35
36
 
36
37
  // compiled Statement
37
38
  interface AlaSQLStatement {
38
- (params?: any, cb?: AlaSQLCallback, scope?: any): any;
39
+ <T = unknown>(params?: Record<string, unknown>, cb?: AlaSQLCallback<T>, scope?: unknown): T;
39
40
  }
40
41
 
41
42
  // abstract Syntax Tree
@@ -43,22 +44,9 @@ declare module 'alasql' {
43
44
  compile(databaseid: string): AlaSQLStatement;
44
45
  }
45
46
 
46
- // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/es6-promise/es6-promise.d.ts
47
- interface Thenable<T> {
48
- then<U>(
49
- onFulfilled?: (value: T) => U | Thenable<U>,
50
- onRejected?: (error: any) => U | Thenable<U>
51
- ): Thenable<U>;
52
- then<U>(
53
- onFulfilled?: (value: T) => U | Thenable<U>,
54
- onRejected?: (error: any) => void
55
- ): Thenable<U>;
56
- catch<U>(onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
57
- }
58
-
59
47
  // see https://github.com/alasql/alasql/wiki/User%20Defined%20Functions
60
48
  interface userDefinedFunction {
61
- (...x: any[]): any;
49
+ (...x: unknown[]): unknown;
62
50
  }
63
51
 
64
52
  interface userDefinedFunctionLookUp {
@@ -67,7 +55,7 @@ declare module 'alasql' {
67
55
 
68
56
  // see https://github.com/alasql/alasql/wiki/User%20Defined%20Functions
69
57
  interface userAggregator {
70
- (value: any, accumulator: any, stage: number): any;
58
+ (value: unknown, accumulator: unknown, stage: number): unknown;
71
59
  }
72
60
 
73
61
  interface userAggregatorLookUp {
@@ -75,7 +63,13 @@ declare module 'alasql' {
75
63
  }
76
64
 
77
65
  interface userFromFunction {
78
- (dataReference: any, options: any, callback: any, index: any, query: any): any;
66
+ (
67
+ dataReference: unknown,
68
+ options: unknown,
69
+ callback: (res: unknown) => void,
70
+ index: unknown,
71
+ query: unknown
72
+ ): void;
79
73
  }
80
74
 
81
75
  interface userFromFunctionLookUp {
@@ -117,7 +111,7 @@ declare module 'alasql' {
117
111
  * @type {any[]}
118
112
  * @memberof table
119
113
  */
120
- data: any[];
114
+ data: unknown[];
121
115
  }
122
116
 
123
117
  /**
@@ -142,25 +136,31 @@ declare module 'alasql' {
142
136
  new (databaseid?: string): Database;
143
137
  databaseid: string;
144
138
  dbversion: number;
145
- tables: {[key: string]: any};
146
- views: {[key: string]: any};
147
- triggers: {[key: string]: any};
148
- indices: {[key: string]: any};
149
- objects: {[key: string]: any};
139
+ tables: {[key: string]: unknown};
140
+ views: {[key: string]: unknown};
141
+ triggers: {[key: string]: unknown};
142
+ indices: {[key: string]: unknown};
143
+ objects: {[key: string]: unknown};
150
144
  counter: number;
151
- sqlCache: {[key: string]: any};
145
+ sqlCache: {[key: string]: unknown};
152
146
  sqlCacheSize: number;
153
- astCache: {[key: string]: any};
154
- resetSqlCache: () => void;
155
- exec: (sql: string, params?: object, cb?: Function) => any;
156
- autoval: (tablename: string, colname: string, getNext: boolean) => any;
147
+ astCache: {[key: string]: unknown};
148
+ resetSqlCache(): void;
149
+ exec<T = unknown>(sql: string, params?: Record<string, unknown>, cb?: AlaSQLCallback<T>): T;
150
+ autoval(tablename: string, colname: string, getNext: boolean): unknown;
157
151
  }
152
+
158
153
  interface AlaSQL {
159
154
  options: AlaSQLOptions;
160
155
  error: Error;
161
- (sql: any, params?: any, cb?: AlaSQLCallback, scope?: any): any;
162
- parse(sql: any): AlaSQLAST;
163
- promise(sql: any, params?: any): Thenable<any>;
156
+ <T = unknown>(
157
+ sql: string,
158
+ params?: Record<string, unknown>,
159
+ cb?: AlaSQLCallback<T>,
160
+ scope?: unknown
161
+ ): T;
162
+ parse(sql: string): AlaSQLAST;
163
+ promise<T = unknown>(sql: string, params?: Record<string, unknown>): Promise<T>;
164
164
  fn: userDefinedFunctionLookUp;
165
165
  from: userFromFunctionLookUp;
166
166
  aggr: userAggregatorLookUp;
@@ -200,7 +200,7 @@ declare module 'alasql' {
200
200
 
201
201
  /**
202
202
  * Array of the tables in the default database (called alasql). If
203
- * the database is changes via a USE statement or the use method, this
203
+ * the database is changed via a USE statement or the use method, this
204
204
  * becomes the tables in the new database.
205
205
  *
206
206
  * @type {tableLookUp}