alasql 4.18.0 → 4.19.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.
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.17.3 build: develop-a80b2965 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.19.0 build: develop-98e852ad | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.17.3
4
+ @version 4.19.0
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2025 Andrey Gershun & Mathias Wulff
package/dist/alasql.d.ts CHANGED
@@ -4,11 +4,11 @@ declare module 'alasql' {
4
4
  import * as xlsx from 'xlsx';
5
5
 
6
6
  // Callback with error-first convention and optional data
7
- interface AlaSQLCallback<T = unknown> {
7
+ export interface AlaSQLCallback<T = unknown> {
8
8
  (err: Error | null, data?: T): void;
9
9
  }
10
10
 
11
- interface AlaSQLOptions {
11
+ export interface AlaSQLOptions {
12
12
  errorlog: boolean;
13
13
  valueof: boolean;
14
14
  dropifnotexists: boolean; // drop database in any case
@@ -35,34 +35,100 @@ declare module 'alasql' {
35
35
  }
36
36
 
37
37
  // compiled Statement
38
- interface AlaSQLStatement {
38
+ export interface AlaSQLStatement {
39
39
  <T = unknown>(params?: any, cb?: AlaSQLCallback<T>, scope?: unknown): T;
40
40
  }
41
41
 
42
+ export type AlaSQLDefaultColumns = {[columnName: string]: string};
43
+
44
+ /**
45
+ * Base parsed expression node.
46
+ * Node shapes below are part of the public parser AST surface and follow semver.
47
+ */
48
+ export interface AlaSQLExpression {
49
+ toJS(context: string, tableid: string | number, defcols: AlaSQLDefaultColumns | null): string;
50
+ }
51
+
52
+ export interface Op extends AlaSQLExpression {
53
+ left: ExpressionNode;
54
+ op: string;
55
+ right?: ExpressionNode;
56
+ right1?: ExpressionNode;
57
+ right2?: ExpressionNode;
58
+ }
59
+
60
+ export interface Column extends AlaSQLExpression {
61
+ columnid: string;
62
+ tableid?: string;
63
+ databaseid?: string;
64
+ }
65
+
66
+ export interface ParamValue extends AlaSQLExpression {
67
+ param: string | number;
68
+ }
69
+
70
+ export interface NumValue extends AlaSQLExpression {
71
+ value: number;
72
+ }
73
+
74
+ export interface StringValue extends AlaSQLExpression {
75
+ value: string;
76
+ }
77
+
78
+ export interface LogicValue extends AlaSQLExpression {
79
+ value: boolean;
80
+ }
81
+
82
+ export interface UniOp extends AlaSQLExpression {
83
+ op: string | null;
84
+ right: ExpressionNode;
85
+ }
86
+
87
+ export type ExpressionNode =
88
+ | Op
89
+ | Column
90
+ | ParamValue
91
+ | NumValue
92
+ | StringValue
93
+ | LogicValue
94
+ | UniOp;
95
+
96
+ export interface ExpressionWrapper extends AlaSQLExpression {
97
+ expression: ExpressionNode;
98
+ reduced?: boolean;
99
+ }
100
+
101
+ export interface Statement {
102
+ compile(databaseid: string): AlaSQLStatement;
103
+ where?: ExpressionWrapper;
104
+ [key: string]: unknown;
105
+ }
106
+
42
107
  // abstract Syntax Tree
43
- interface AlaSQLAST {
108
+ export interface AlaSQLAST {
109
+ statements: Statement[];
44
110
  compile(databaseid: string): AlaSQLStatement;
45
111
  }
46
112
 
47
113
  // see https://github.com/alasql/alasql/wiki/User%20Defined%20Functions
48
- interface userDefinedFunction {
114
+ export interface userDefinedFunction {
49
115
  (...x: unknown[]): unknown;
50
116
  }
51
117
 
52
- interface userDefinedFunctionLookUp {
118
+ export interface userDefinedFunctionLookUp {
53
119
  [x: string]: userDefinedFunction;
54
120
  }
55
121
 
56
122
  // see https://github.com/alasql/alasql/wiki/User%20Defined%20Functions
57
- interface userAggregator {
123
+ export interface userAggregator {
58
124
  (value: unknown, accumulator: unknown, stage: number): unknown;
59
125
  }
60
126
 
61
- interface userAggregatorLookUp {
127
+ export interface userAggregatorLookUp {
62
128
  [x: string]: userAggregator;
63
129
  }
64
130
 
65
- interface userFromFunction {
131
+ export interface userFromFunction {
66
132
  (
67
133
  dataReference: unknown,
68
134
  options: unknown,
@@ -72,7 +138,7 @@ declare module 'alasql' {
72
138
  ): void;
73
139
  }
74
140
 
75
- interface userFromFunctionLookUp {
141
+ export interface userFromFunctionLookUp {
76
142
  [x: string]: userFromFunction;
77
143
  }
78
144
 
@@ -81,7 +147,7 @@ declare module 'alasql' {
81
147
  *
82
148
  * @interface database
83
149
  */
84
- interface database {
150
+ export interface database {
85
151
  /**
86
152
  * The database ID.
87
153
  *
@@ -104,7 +170,7 @@ declare module 'alasql' {
104
170
  *
105
171
  * @interface table
106
172
  */
107
- interface table {
173
+ export interface table {
108
174
  /**
109
175
  * The array of data stored in the table which can be queried
110
176
  *
@@ -119,7 +185,7 @@ declare module 'alasql' {
119
185
  *
120
186
  * @interface databaseLookUp
121
187
  */
122
- interface databaseLookUp {
188
+ export interface databaseLookUp {
123
189
  [databaseName: string]: database;
124
190
  }
125
191
 
@@ -128,11 +194,11 @@ declare module 'alasql' {
128
194
  *
129
195
  * @interface tableLookUp
130
196
  */
131
- interface tableLookUp {
197
+ export interface tableLookUp {
132
198
  [tableName: string]: table;
133
199
  }
134
200
 
135
- interface Database {
201
+ export interface Database {
136
202
  new (databaseid?: string): Database;
137
203
  databaseid: string;
138
204
  dbversion: number;
@@ -150,7 +216,7 @@ declare module 'alasql' {
150
216
  autoval(tablename: string, colname: string, getNext: boolean): unknown;
151
217
  }
152
218
 
153
- interface AlaSQL {
219
+ export interface AlaSQL {
154
220
  options: AlaSQLOptions;
155
221
  error: Error;
156
222
  <T = unknown>(sql: string, params?: any, cb?: AlaSQLCallback<T>, scope?: unknown): T;