alasql 4.2.4 → 4.2.6

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.2.3 build: develop-aada421c | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.2.5 build: develop-40f8e9c3 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.2.3
4
+ @version 4.2.5
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
package/dist/alasql.d.ts CHANGED
@@ -138,6 +138,22 @@ declare module 'alasql' {
138
138
  [tableName: string]: table;
139
139
  }
140
140
 
141
+ interface Database {
142
+ databaseid: string;
143
+ dbversion: number;
144
+ tables: {[key: string]: any};
145
+ views: {[key: string]: any};
146
+ triggers: {[key: string]: any};
147
+ indices: {[key: string]: any};
148
+ objects: {[key: string]: any};
149
+ counter: number;
150
+ sqlCache: {[key: string]: any};
151
+ sqlCacheSize: number;
152
+ astCache: {[key: string]: any};
153
+ resetSqlCache: () => void;
154
+ exec: (sql: string, params?: object, cb?: Function) => any;
155
+ autoval: (tablename: string, colname: string, getNext: boolean) => any;
156
+ }
141
157
  interface AlaSQL {
142
158
  options: AlaSQLOptions;
143
159
  error: Error;
@@ -150,6 +166,7 @@ declare module 'alasql' {
150
166
  autoval(tablename: string, colname: string, getNext?: boolean): number;
151
167
  yy: {};
152
168
  setXLSX(xlsxlib: typeof xlsx): void;
169
+ Database: Database;
153
170
 
154
171
  /**
155
172
  * Array of databases in the AlaSQL object.
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.2.3 build: develop-aada421c | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.2.5 build: develop-40f8e9c3 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.2.3
4
+ @version 4.2.5
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -141,8 +141,8 @@ var alasql = function(sql, params, cb, scope) {
141
141
  Current version of alasql
142
142
  @constant {string}
143
143
  */
144
- alasql.version = '4.2.3';
145
- alasql.build = 'develop-aada421c';
144
+ alasql.version = '4.2.5';
145
+ alasql.build = 'develop-40f8e9c3';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -10420,9 +10420,29 @@ yy.Over = class Over {
10420
10420
  const toTypeNumberOps = new Set(['-', '*', '/', '%', '^']);
10421
10421
  const toTypeStringOps = new Set(['||']);
10422
10422
  const toTypeBoolOps = new Set([
10423
- 'AND', 'OR', 'NOT', '=', '==', '===', '!=', '!==', '!===',
10424
- '>', '>=', '<', '<=', 'IN', 'NOT IN', 'LIKE', 'NOT LIKE',
10425
- 'REGEXP', 'GLOB', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'
10423
+ 'AND',
10424
+ 'OR',
10425
+ 'NOT',
10426
+ '=',
10427
+ '==',
10428
+ '===',
10429
+ '!=',
10430
+ '!==',
10431
+ '!===',
10432
+ '>',
10433
+ '>=',
10434
+ '<',
10435
+ '<=',
10436
+ 'IN',
10437
+ 'NOT IN',
10438
+ 'LIKE',
10439
+ 'NOT LIKE',
10440
+ 'REGEXP',
10441
+ 'GLOB',
10442
+ 'BETWEEN',
10443
+ 'NOT BETWEEN',
10444
+ 'IS NULL',
10445
+ 'IS NOT NULL',
10426
10446
  ]);
10427
10447
  class Op {
10428
10448
  constructor(params) {
@@ -10466,11 +10486,9 @@ yy.Over = class Over {
10466
10486
  }
10467
10487
 
10468
10488
  toType(tableid) {
10469
- if (toTypeNumberOps.has(this.op))
10470
- return 'number';
10489
+ if (toTypeNumberOps.has(this.op)) return 'number';
10471
10490
 
10472
- if (toTypeStringOps.has(this.op))
10473
- return 'string';
10491
+ if (toTypeStringOps.has(this.op)) return 'string';
10474
10492
 
10475
10493
  if (this.op === '+') {
10476
10494
  const leftType = this.left.toType(tableid);
@@ -10484,11 +10502,9 @@ yy.Over = class Over {
10484
10502
  }
10485
10503
  }
10486
10504
 
10487
- if (toTypeBoolOps.has(this.op) || this.allsome)
10488
- return 'boolean';
10505
+ if (toTypeBoolOps.has(this.op) || this.allsome) return 'boolean';
10489
10506
 
10490
- if (!this.op)
10491
- return this.left.toType(tableid);
10507
+ if (!this.op) return this.left.toType(tableid);
10492
10508
 
10493
10509
  return 'unknown';
10494
10510
  }
@@ -10945,7 +10961,7 @@ yy.Over = class Over {
10945
10961
  '~': '~',
10946
10962
  '-': '-',
10947
10963
  '+': '+',
10948
- 'NOT': '!',
10964
+ NOT: '!',
10949
10965
  };
10950
10966
 
10951
10967
  class UniOp {
@@ -10954,7 +10970,7 @@ yy.Over = class Over {
10954
10970
  }
10955
10971
 
10956
10972
  toString() {
10957
- const { op, right } = this;
10973
+ const {op, right} = this;
10958
10974
  const res = right.toString();
10959
10975
 
10960
10976
  switch (op) {
@@ -11005,7 +11021,6 @@ yy.Over = class Over {
11005
11021
 
11006
11022
  throw new Error(`Unsupported operator: ${this.op}`);
11007
11023
  }
11008
-
11009
11024
  }
11010
11025
 
11011
11026
  class Column {
@@ -11033,7 +11048,11 @@ yy.Over = class Over {
11033
11048
 
11034
11049
  toJS(context, tableid, defcols) {
11035
11050
  if (!this.tableid && tableid === '' && !defcols) {
11036
- return this.columnid !== '_' ? `${context}['${this.columnid}']` : (context === 'g' ? "g['_']" : context);
11051
+ return this.columnid !== '_'
11052
+ ? `${context}['${this.columnid}']`
11053
+ : context === 'g'
11054
+ ? "g['_']"
11055
+ : context;
11037
11056
  }
11038
11057
 
11039
11058
  if (context === 'g') {
@@ -11041,17 +11060,27 @@ yy.Over = class Over {
11041
11060
  }
11042
11061
 
11043
11062
  if (this.tableid) {
11044
- return this.columnid !== '_' ? `${context}['${this.tableid}']['${this.columnid}']` : (context === 'g' ? "g['_']" : `${context}['${this.tableid}']`);
11063
+ return this.columnid !== '_'
11064
+ ? `${context}['${this.tableid}']['${this.columnid}']`
11065
+ : context === 'g'
11066
+ ? "g['_']"
11067
+ : `${context}['${this.tableid}']`;
11045
11068
  }
11046
11069
 
11047
11070
  if (defcols) {
11048
11071
  const tbid = defcols[this.columnid];
11049
11072
  if (tbid === '-') {
11050
- throw new Error(`Cannot resolve column "${this.columnid}" because it exists in two source tables`);
11073
+ throw new Error(
11074
+ `Cannot resolve column "${this.columnid}" because it exists in two source tables`
11075
+ );
11051
11076
  } else if (tbid) {
11052
- return this.columnid !== '_' ? `${context}['${tbid}']['${this.columnid}']` : `${context}['${tbid}']`;
11077
+ return this.columnid !== '_'
11078
+ ? `${context}['${tbid}']['${this.columnid}']`
11079
+ : `${context}['${tbid}']`;
11053
11080
  } else {
11054
- return this.columnid !== '_' ? `${context}['${this.tableid || tableid}']['${this.columnid}']` : `${context}['${this.tableid || tableid}']`;
11081
+ return this.columnid !== '_'
11082
+ ? `${context}['${this.tableid || tableid}']['${this.columnid}']`
11083
+ : `${context}['${this.tableid || tableid}']`;
11055
11084
  }
11056
11085
  }
11057
11086
 
@@ -11059,9 +11088,10 @@ yy.Over = class Over {
11059
11088
  return `${context}['${this.columnid}']`;
11060
11089
  }
11061
11090
 
11062
- return this.columnid !== '_' ? `${context}['${this.tableid || tableid}']['${this.columnid}']` : `${context}['${this.tableid || tableid}']`;
11091
+ return this.columnid !== '_'
11092
+ ? `${context}['${this.tableid || tableid}']['${this.columnid}']`
11093
+ : `${context}['${this.tableid || tableid}']`;
11063
11094
  }
11064
-
11065
11095
  }
11066
11096
 
11067
11097
  class AggrValue {
@@ -11070,7 +11100,10 @@ yy.Over = class Over {
11070
11100
  }
11071
11101
 
11072
11102
  toString() {
11073
- const funcName = this.aggregatorid === 'REDUCE' ? this.funcid.replace(re_invalidFnNameChars, '') : this.aggregatorid;
11103
+ const funcName =
11104
+ this.aggregatorid === 'REDUCE'
11105
+ ? this.funcid.replace(re_invalidFnNameChars, '')
11106
+ : this.aggregatorid;
11074
11107
  const distinctPart = this.distinct ? 'DISTINCT ' : '';
11075
11108
  const expressionPart = this.expression ? this.expression.toString() : '';
11076
11109
  const overPart = this.over ? ` ${this.over.toString()}` : '';
@@ -11093,7 +11126,11 @@ yy.Over = class Over {
11093
11126
  }
11094
11127
 
11095
11128
  toType() {
11096
- if (['SUM', 'COUNT', 'AVG', 'MIN', 'MAX', 'AGGR', 'VAR', 'STDDEV', 'TOTAL'].includes(this.aggregatorid)) {
11129
+ if (
11130
+ ['SUM', 'COUNT', 'AVG', 'MIN', 'MAX', 'AGGR', 'VAR', 'STDDEV', 'TOTAL'].includes(
11131
+ this.aggregatorid
11132
+ )
11133
+ ) {
11097
11134
  return 'number';
11098
11135
  }
11099
11136
 
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.2.3 build: develop-aada421c | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.2.5 build: develop-40f8e9c3 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.2.3
4
+ @version 4.2.5
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -141,8 +141,8 @@ var alasql = function(sql, params, cb, scope) {
141
141
  Current version of alasql
142
142
  @constant {string}
143
143
  */
144
- alasql.version = '4.2.3';
145
- alasql.build = 'develop-aada421c';
144
+ alasql.version = '4.2.5';
145
+ alasql.build = 'develop-40f8e9c3';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -10420,9 +10420,29 @@ yy.Over = class Over {
10420
10420
  const toTypeNumberOps = new Set(['-', '*', '/', '%', '^']);
10421
10421
  const toTypeStringOps = new Set(['||']);
10422
10422
  const toTypeBoolOps = new Set([
10423
- 'AND', 'OR', 'NOT', '=', '==', '===', '!=', '!==', '!===',
10424
- '>', '>=', '<', '<=', 'IN', 'NOT IN', 'LIKE', 'NOT LIKE',
10425
- 'REGEXP', 'GLOB', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'
10423
+ 'AND',
10424
+ 'OR',
10425
+ 'NOT',
10426
+ '=',
10427
+ '==',
10428
+ '===',
10429
+ '!=',
10430
+ '!==',
10431
+ '!===',
10432
+ '>',
10433
+ '>=',
10434
+ '<',
10435
+ '<=',
10436
+ 'IN',
10437
+ 'NOT IN',
10438
+ 'LIKE',
10439
+ 'NOT LIKE',
10440
+ 'REGEXP',
10441
+ 'GLOB',
10442
+ 'BETWEEN',
10443
+ 'NOT BETWEEN',
10444
+ 'IS NULL',
10445
+ 'IS NOT NULL',
10426
10446
  ]);
10427
10447
  class Op {
10428
10448
  constructor(params) {
@@ -10466,11 +10486,9 @@ yy.Over = class Over {
10466
10486
  }
10467
10487
 
10468
10488
  toType(tableid) {
10469
- if (toTypeNumberOps.has(this.op))
10470
- return 'number';
10489
+ if (toTypeNumberOps.has(this.op)) return 'number';
10471
10490
 
10472
- if (toTypeStringOps.has(this.op))
10473
- return 'string';
10491
+ if (toTypeStringOps.has(this.op)) return 'string';
10474
10492
 
10475
10493
  if (this.op === '+') {
10476
10494
  const leftType = this.left.toType(tableid);
@@ -10484,11 +10502,9 @@ yy.Over = class Over {
10484
10502
  }
10485
10503
  }
10486
10504
 
10487
- if (toTypeBoolOps.has(this.op) || this.allsome)
10488
- return 'boolean';
10505
+ if (toTypeBoolOps.has(this.op) || this.allsome) return 'boolean';
10489
10506
 
10490
- if (!this.op)
10491
- return this.left.toType(tableid);
10507
+ if (!this.op) return this.left.toType(tableid);
10492
10508
 
10493
10509
  return 'unknown';
10494
10510
  }
@@ -10945,7 +10961,7 @@ yy.Over = class Over {
10945
10961
  '~': '~',
10946
10962
  '-': '-',
10947
10963
  '+': '+',
10948
- 'NOT': '!',
10964
+ NOT: '!',
10949
10965
  };
10950
10966
 
10951
10967
  class UniOp {
@@ -10954,7 +10970,7 @@ yy.Over = class Over {
10954
10970
  }
10955
10971
 
10956
10972
  toString() {
10957
- const { op, right } = this;
10973
+ const {op, right} = this;
10958
10974
  const res = right.toString();
10959
10975
 
10960
10976
  switch (op) {
@@ -11005,7 +11021,6 @@ yy.Over = class Over {
11005
11021
 
11006
11022
  throw new Error(`Unsupported operator: ${this.op}`);
11007
11023
  }
11008
-
11009
11024
  }
11010
11025
 
11011
11026
  class Column {
@@ -11033,7 +11048,11 @@ yy.Over = class Over {
11033
11048
 
11034
11049
  toJS(context, tableid, defcols) {
11035
11050
  if (!this.tableid && tableid === '' && !defcols) {
11036
- return this.columnid !== '_' ? `${context}['${this.columnid}']` : (context === 'g' ? "g['_']" : context);
11051
+ return this.columnid !== '_'
11052
+ ? `${context}['${this.columnid}']`
11053
+ : context === 'g'
11054
+ ? "g['_']"
11055
+ : context;
11037
11056
  }
11038
11057
 
11039
11058
  if (context === 'g') {
@@ -11041,17 +11060,27 @@ yy.Over = class Over {
11041
11060
  }
11042
11061
 
11043
11062
  if (this.tableid) {
11044
- return this.columnid !== '_' ? `${context}['${this.tableid}']['${this.columnid}']` : (context === 'g' ? "g['_']" : `${context}['${this.tableid}']`);
11063
+ return this.columnid !== '_'
11064
+ ? `${context}['${this.tableid}']['${this.columnid}']`
11065
+ : context === 'g'
11066
+ ? "g['_']"
11067
+ : `${context}['${this.tableid}']`;
11045
11068
  }
11046
11069
 
11047
11070
  if (defcols) {
11048
11071
  const tbid = defcols[this.columnid];
11049
11072
  if (tbid === '-') {
11050
- throw new Error(`Cannot resolve column "${this.columnid}" because it exists in two source tables`);
11073
+ throw new Error(
11074
+ `Cannot resolve column "${this.columnid}" because it exists in two source tables`
11075
+ );
11051
11076
  } else if (tbid) {
11052
- return this.columnid !== '_' ? `${context}['${tbid}']['${this.columnid}']` : `${context}['${tbid}']`;
11077
+ return this.columnid !== '_'
11078
+ ? `${context}['${tbid}']['${this.columnid}']`
11079
+ : `${context}['${tbid}']`;
11053
11080
  } else {
11054
- return this.columnid !== '_' ? `${context}['${this.tableid || tableid}']['${this.columnid}']` : `${context}['${this.tableid || tableid}']`;
11081
+ return this.columnid !== '_'
11082
+ ? `${context}['${this.tableid || tableid}']['${this.columnid}']`
11083
+ : `${context}['${this.tableid || tableid}']`;
11055
11084
  }
11056
11085
  }
11057
11086
 
@@ -11059,9 +11088,10 @@ yy.Over = class Over {
11059
11088
  return `${context}['${this.columnid}']`;
11060
11089
  }
11061
11090
 
11062
- return this.columnid !== '_' ? `${context}['${this.tableid || tableid}']['${this.columnid}']` : `${context}['${this.tableid || tableid}']`;
11091
+ return this.columnid !== '_'
11092
+ ? `${context}['${this.tableid || tableid}']['${this.columnid}']`
11093
+ : `${context}['${this.tableid || tableid}']`;
11063
11094
  }
11064
-
11065
11095
  }
11066
11096
 
11067
11097
  class AggrValue {
@@ -11070,7 +11100,10 @@ yy.Over = class Over {
11070
11100
  }
11071
11101
 
11072
11102
  toString() {
11073
- const funcName = this.aggregatorid === 'REDUCE' ? this.funcid.replace(re_invalidFnNameChars, '') : this.aggregatorid;
11103
+ const funcName =
11104
+ this.aggregatorid === 'REDUCE'
11105
+ ? this.funcid.replace(re_invalidFnNameChars, '')
11106
+ : this.aggregatorid;
11074
11107
  const distinctPart = this.distinct ? 'DISTINCT ' : '';
11075
11108
  const expressionPart = this.expression ? this.expression.toString() : '';
11076
11109
  const overPart = this.over ? ` ${this.over.toString()}` : '';
@@ -11093,7 +11126,11 @@ yy.Over = class Over {
11093
11126
  }
11094
11127
 
11095
11128
  toType() {
11096
- if (['SUM', 'COUNT', 'AVG', 'MIN', 'MAX', 'AGGR', 'VAR', 'STDDEV', 'TOTAL'].includes(this.aggregatorid)) {
11129
+ if (
11130
+ ['SUM', 'COUNT', 'AVG', 'MIN', 'MAX', 'AGGR', 'VAR', 'STDDEV', 'TOTAL'].includes(
11131
+ this.aggregatorid
11132
+ )
11133
+ ) {
11097
11134
  return 'number';
11098
11135
  }
11099
11136