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.
@@ -21698,7 +21698,7 @@ function html_to_sheet(str, _opts) {
21698
21698
  var opts = _opts || {};
21699
21699
  var dense = (opts.dense != null) ? opts.dense : DENSE;
21700
21700
  var ws = ({}); if(dense) ws["!data"] = [];
21701
- str = str.replace(/<!--.*?-->/g, "");
21701
+ str = str.replace(/<!--[\s\S]*?-->/g, "");
21702
21702
  var mtch = str.match(/<table/i);
21703
21703
  if(!mtch) throw new Error("Invalid HTML: could not find <table>");
21704
21704
  var mtch2 = str.match(/<\/table/i);
@@ -21647,7 +21647,7 @@ function html_to_sheet(str/*:string*/, _opts)/*:Workbook*/ {
21647
21647
  var opts = _opts || {};
21648
21648
  var dense = (opts.dense != null) ? opts.dense : DENSE;
21649
21649
  var ws/*:Worksheet*/ = ({}/*:any*/); if(dense) ws["!data"] = [];
21650
- str = str.replace(/<!--.*?-->/g, "");
21650
+ str = str.replace(/<!--[\s\S]*?-->/g, "");
21651
21651
  var mtch/*:any*/ = str.match(/<table/i);
21652
21652
  if(!mtch) throw new Error("Invalid HTML: could not find <table>");
21653
21653
  var mtch2/*:any*/ = str.match(/<\/table/i);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alasql",
3
3
  "description": "Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV",
4
- "version": "4.6.0",
4
+ "version": "4.6.2",
5
5
  "author": "Andrey Gershun <agershun@gmail.com>",
6
6
  "contributors": [
7
7
  "Mathias Wulff <m@rawu.dk>"
@@ -45,18 +45,18 @@
45
45
  "postversion": "npm publish && git push && git push --tags && echo \"Successfully released version $npm_package_version\""
46
46
  },
47
47
  "dependencies": {
48
- "cross-fetch": "4",
48
+ "cross-fetch": "4.1.0",
49
49
  "yargs": "16"
50
50
  },
51
51
  "devDependencies": {
52
52
  "blueimp-md5": "2.19.0",
53
53
  "cmdmix": "2.2.2",
54
54
  "dom-storage": "2.1.0",
55
- "esbuild": "0.24.0",
55
+ "esbuild": "0.24.2",
56
56
  "git-branch-is": "4.0.0",
57
- "husky": "8.0.3",
57
+ "husky": "9.1.7",
58
58
  "jison": "^0.4.18",
59
- "mocha": "10.7.3",
59
+ "mocha": "11.0.1",
60
60
  "mocha.parallel": "0.15.6",
61
61
  "open": "10.1.0",
62
62
  "prettier": "3.4.2",
@@ -67,14 +67,15 @@
67
67
  "tabletop": "1.6.3",
68
68
  "uglify-js": "3.19.3"
69
69
  },
70
- "X-resolutions": {
71
- "got": "14.4.2",
70
+ "resolutions": {
71
+ "got": "14",
72
72
  "axios": "1",
73
73
  "json5": "2",
74
74
  "underscore": "1",
75
75
  "glob-parent": "6",
76
- "decode-uri-component": "0.2",
77
- "semver": "7"
76
+ "decode-uri-component": "0.4",
77
+ "semver": "7",
78
+ "follow-redirects": "1"
78
79
  },
79
80
  "engines": {
80
81
  "node": ">=15"
package/types/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}