alasql 2.2.5 → 2.3.1

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/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": "2.2.5",
4
+ "version": "2.3.1",
5
5
  "author": "Andrey Gershun <agershun@gmail.com>",
6
6
  "contributors": [
7
7
  "Mathias Wulff <m@rawu.dk>"
@@ -11,7 +11,7 @@
11
11
  "directories": {
12
12
  "test": "test"
13
13
  },
14
- "typings": "dist/alasql.d.ts",
14
+ "typings": "types/alasql.d.ts",
15
15
  "scripts": {
16
16
  "test": "gulp && yarn test-only",
17
17
  "test-ci": "(yarn test-format || 1) && yarn test && yarn install-g && alasql 'select 1 as Succes'",
@@ -46,6 +46,7 @@
46
46
  "postversion": "npm publish && git push && git push --tags && echo \"Successfully released version $npm_package_version\""
47
47
  },
48
48
  "dependencies": {
49
+ "cross-fetch": "^3.1.5",
49
50
  "dom-storage": "2.1.0",
50
51
  "es6-promise": "4.2.8",
51
52
  "node-fetch": "2",
@@ -55,7 +56,12 @@
55
56
  "devDependencies": {
56
57
  "blueimp-md5": "2.19.0",
57
58
  "cmdmix": "2.1.1",
58
- "eslint": "^8.29.0",
59
+ "eslint": "^8.30.0",
60
+ "eslint-config-standard": "^17.0.0",
61
+ "eslint-plugin-import": "^2.26.0",
62
+ "eslint-plugin-node": "^11.1.0",
63
+ "eslint-plugin-promise": "^6.1.1",
64
+ "eslint-plugin-standard": "^5.0.0",
59
65
  "git-branch-is": "4.0.0",
60
66
  "gulp": "4.0.2",
61
67
  "gulp-concat": "2.6.1",
@@ -0,0 +1,89 @@
1
+ // Project: https://github.com/agershun/alasql
2
+
3
+ import * as xlsx from 'xlsx';
4
+
5
+ declare namespace alaSQLSpace {
6
+ interface AlaSQLCallback {
7
+ (data?: any, err?: Error): void;
8
+ }
9
+
10
+ interface AlaSQLOptions {
11
+ errorlog: boolean;
12
+ valueof: boolean;
13
+ dropifnotexists: boolean; // drop database in any case
14
+ datetimeformat: string; // how to handle DATE and DATETIME types
15
+ casesensitive: boolean; // table and column names are case sensitive and converted to lower-case
16
+ logtarget: string; // target for log. Values: 'console', 'output', 'id' of html tag
17
+ logprompt: boolean; // print SQL at log
18
+ modifier: any; // values: RECORDSET, VALUE, ROW, COLUMN, MATRIX, TEXTSTRING, INDEX
19
+ columnlookup: number; // how many rows to lookup to define columns
20
+ autovertex: boolean; // create vertex if not found
21
+ usedbo: boolean; // use dbo as current database (for partial T-SQL comaptibility)
22
+ autocommit: boolean; // the AUTOCOMMIT ON | OFF
23
+ cache: boolean; // use cache
24
+ nocount: boolean; // for SET NOCOUNT OFF
25
+ nan: boolean; // check for NaN and convert it to undefined
26
+ angularjs: boolean;
27
+ tsql: boolean;
28
+ mysql: boolean;
29
+ postgres: boolean;
30
+ oracle: boolean;
31
+ sqlite: boolean;
32
+ orientdb: boolean;
33
+ excel: any;
34
+ }
35
+
36
+ // compiled Statement
37
+ interface AlaSQLStatement {
38
+ (params?: any, cb?: AlaSQLCallback, scope?: any): any;
39
+ }
40
+
41
+ // abstract Syntax Tree
42
+ interface AlaSQLAST {
43
+ compile(databaseid: string): AlaSQLStatement;
44
+ }
45
+
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
+ // see https://github.com/agershun/alasql/wiki/User%20Defined%20Functions
60
+ interface userDefinedFunction {
61
+ (...x: any[]): any;
62
+ }
63
+ interface userDefinedFunctionLookUp {
64
+ [x: string]: userDefinedFunction;
65
+ }
66
+ // see https://github.com/agershun/alasql/wiki/User%20Defined%20Functions
67
+ interface userAggregator {
68
+ (value: any, accumulator: any, stage: number): any;
69
+ }
70
+ interface userAggregatorLookUp {
71
+ [x: string]: userAggregator;
72
+ }
73
+
74
+ interface AlaSQL {
75
+ options: AlaSQLOptions;
76
+ error: Error;
77
+ (sql: any, params?: any, cb?: AlaSQLCallback, scope?: any): any;
78
+ parse(sql: any): AlaSQLAST;
79
+ promise(sql: any, params?: any): Thenable<any>;
80
+ fn: userDefinedFunctionLookUp;
81
+ aggr: userAggregatorLookUp;
82
+ autoval(tablename: string, colname: string, getNext?: boolean): number;
83
+ yy: {};
84
+ setXLSX(xlsxlib: typeof xlsx): void;
85
+ }
86
+ }
87
+
88
+ declare let alasql: alaSQLSpace.AlaSQL;
89
+ export default alasql;