alasql 4.20.0 → 4.21.0

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": "4.20.0",
4
+ "version": "4.21.0",
5
5
  "author": "Andrey Gershun <agershun@gmail.com>",
6
6
  "contributors": [
7
7
  "Mathias Wulff <m@rawu.dk>"
@@ -29,6 +29,8 @@
29
29
  "test-cover": "# istanbul cover -x 'lib/zt/zt.js' --dir test/coverage _mocha",
30
30
  "build": "yarn format && yarn build-only",
31
31
  "build-only": "sh build.sh",
32
+ "test-perf": "bun test/performance/vs-npm.js",
33
+ "test-perf-mini": "bun test/performance/vs-npm.js --scale=0.5 --runs=2 --runtime=node --fail-above=105",
32
34
  "install-g": "yarn build && npm uninstall alasql -g && npm install -g .",
33
35
  "release": "yarn version",
34
36
  "jison": "jison ./src/alasqlparser.jison -o ./src/alasqlparser.js",
@@ -51,6 +53,7 @@
51
53
  "pre-pr": "cmdmix 'yarn fresh '%1' && yarn repush'",
52
54
  "prepare": "husky",
53
55
  "preversion": "yarn && yarn test && npm login",
56
+ "prepublishOnly": "sh build.sh </dev/null",
54
57
  "postversion": "npm publish && git push && git push --tags && echo \"Successfully released version $npm_package_version\""
55
58
  },
56
59
  "dependencies": {
@@ -69,7 +72,7 @@
69
72
  "husky": "9.1.7",
70
73
  "jison": "^0.4.18",
71
74
  "open": "11.0.4",
72
- "prettier": "3.9.9",
75
+ "prettier": "3.9.10",
73
76
  "react-native-fetch-blob": "^0.10.8",
74
77
  "rexreplace": "7.1.14",
75
78
  "strftime": "0.10.3",
package/test1107.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "alasql": "{\"databases\":{}}"
3
+ }
package/types/alasql.d.ts CHANGED
@@ -39,6 +39,11 @@ declare module 'alasql' {
39
39
  <T = unknown>(params?: any, cb?: AlaSQLCallback<T>, scope?: unknown): T;
40
40
  }
41
41
 
42
+ // returned by alasql.compile(): a compiled statement with a promise helper
43
+ export interface AlaSQLCompiledStatement extends AlaSQLStatement {
44
+ promise<T = unknown>(params?: any): Promise<T>;
45
+ }
46
+
42
47
  export type AlaSQLDefaultColumns = {[columnName: string]: string};
43
48
 
44
49
  /**
@@ -52,7 +57,8 @@ declare module 'alasql' {
52
57
  export interface Op extends AlaSQLExpression {
53
58
  left: ExpressionNode;
54
59
  op: string;
55
- right?: ExpressionNode;
60
+ // `->` with a bare property name (`a->b`, `tx.a.b`) puts the name as a string
61
+ right?: ExpressionNode | string;
56
62
  right1?: ExpressionNode;
57
63
  right2?: ExpressionNode;
58
64
  }
@@ -84,8 +90,13 @@ declare module 'alasql' {
84
90
  right: ExpressionNode;
85
91
  }
86
92
 
93
+ export interface FuncValue extends AlaSQLExpression {
94
+ funcid: string;
95
+ args?: ExpressionNode[];
96
+ }
97
+
87
98
  export type ExpressionNode =
88
- Op | Column | ParamValue | NumValue | StringValue | LogicValue | UniOp;
99
+ Op | Column | ParamValue | NumValue | StringValue | LogicValue | UniOp | FuncValue;
89
100
 
90
101
  export interface ExpressionWrapper extends AlaSQLExpression {
91
102
  expression: ExpressionNode;
@@ -215,6 +226,7 @@ declare module 'alasql' {
215
226
  error: Error;
216
227
  <T = unknown>(sql: string, params?: any, cb?: AlaSQLCallback<T>, scope?: unknown): T;
217
228
  parse(sql: string): AlaSQLAST;
229
+ compile(sql: string, databaseid?: string): AlaSQLCompiledStatement;
218
230
  promise<T = unknown>(sql: string, params?: any): Promise<T>;
219
231
  fn: userDefinedFunctionLookUp;
220
232
  from: userFromFunctionLookUp;