sqlparser-rs 0.60.0-rc4 → 0.60.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.
package/wasm/README.md CHANGED
@@ -14,7 +14,6 @@ A SQL parser for JavaScript and TypeScript, powered by [datafusion-sqlparser-rs]
14
14
  - Parse SQL into a detailed Abstract Syntax Tree (AST)
15
15
  - Support for 13+ SQL dialects (PostgreSQL, MySQL, SQLite, BigQuery, etc.)
16
16
  - Full TypeScript type definitions
17
- - Works in Node.js and browsers
18
17
  - Fast and accurate parsing using the battle-tested Rust implementation
19
18
  - Zero native dependencies
20
19
 
@@ -30,22 +29,22 @@ npm install sqlparser-rs
30
29
  import { Parser, GenericDialect, PostgreSqlDialect } from 'sqlparser-rs';
31
30
 
32
31
  // Simple parsing
33
- const statements = await Parser.parse('SELECT * FROM users', new GenericDialect());
32
+ const statements = Parser.parse('SELECT * FROM users', new GenericDialect());
34
33
  console.log(statements);
35
34
 
36
35
  // With specific dialect
37
- const pgStatements = await Parser.parse(
36
+ const pgStatements = Parser.parse(
38
37
  'SELECT * FROM users WHERE id = $1',
39
38
  new PostgreSqlDialect()
40
39
  );
41
40
 
42
41
  // Format SQL
43
- const formatted = await Parser.format('select * from users', new GenericDialect());
42
+ const formatted = Parser.format('select * from users', new GenericDialect());
44
43
  console.log(formatted); // "SELECT * FROM users"
45
44
 
46
45
  // Validate SQL
47
46
  try {
48
- await Parser.validate('SELEC * FROM users', new GenericDialect());
47
+ Parser.validate('SELEC * FROM users', new GenericDialect());
49
48
  } catch (error) {
50
49
  console.log('Invalid SQL:', error.message);
51
50
  }
@@ -61,22 +60,22 @@ The main class for parsing SQL.
61
60
 
62
61
  ```typescript
63
62
  // Parse SQL into statements
64
- const statements = await Parser.parse(sql: string, dialect: Dialect): Promise<Statement[]>;
63
+ const statements = Parser.parse(sql: string, dialect: Dialect): Statement[];
65
64
 
66
65
  // Parse and return JSON string
67
- const json = await Parser.parseToJson(sql: string, dialect: Dialect): Promise<string>;
66
+ const json = Parser.parseToJson(sql: string, dialect: Dialect): string;
68
67
 
69
68
  // Parse and return formatted SQL string
70
- const formatted = await Parser.parseToString(sql: string, dialect: Dialect): Promise<string>;
69
+ const formatted = Parser.parseToString(sql: string, dialect: Dialect): string;
71
70
 
72
71
  // Format SQL (round-trip through parser)
73
- const formatted = await Parser.format(sql: string, dialect: Dialect): Promise<string>;
72
+ const formatted = Parser.format(sql: string, dialect: Dialect): string;
74
73
 
75
74
  // Validate SQL syntax
76
- const isValid = await Parser.validate(sql: string, dialect: Dialect): Promise<boolean>;
75
+ const isValid = Parser.validate(sql: string, dialect: Dialect): boolean;
77
76
 
78
77
  // Get list of supported dialects
79
- const dialects = await Parser.getSupportedDialects(): Promise<string[]>;
78
+ const dialects = Parser.getSupportedDialects(): string[];
80
79
  ```
81
80
 
82
81
  #### Instance Methods (Builder Pattern)
@@ -90,13 +89,7 @@ const parser = new Parser(new PostgreSqlDialect())
90
89
  trailingCommas: true
91
90
  });
92
91
 
93
- // Parse asynchronously
94
- const statements = await parser.parseAsync('SELECT * FROM users');
95
-
96
- // Parse synchronously (requires initWasm() first)
97
- import { initWasm } from 'sqlparser-rs';
98
- await initWasm();
99
- const statements = parser.parseSync('SELECT * FROM users');
92
+ const statements = parser.parse('SELECT * FROM users');
100
93
  ```
101
94
 
102
95
  ### Dialects
@@ -131,7 +124,7 @@ const dialect = dialectFromString('postgresql'); // Returns PostgreSqlDialect in
131
124
  import { Parser, GenericDialect, ParserError } from 'sqlparser-rs';
132
125
 
133
126
  try {
134
- await Parser.parse('SELEC * FROM users', new GenericDialect());
127
+ Parser.parse('SELEC * FROM users', new GenericDialect());
135
128
  } catch (error) {
136
129
  if (error instanceof ParserError) {
137
130
  console.log('Parse error:', error.message);
@@ -149,7 +142,7 @@ Full TypeScript types are provided for the AST:
149
142
  ```typescript
150
143
  import type { Statement, Query, Expr, Ident, ObjectName } from 'sqlparser-rs';
151
144
 
152
- const statements: Statement[] = await Parser.parse('SELECT 1', new GenericDialect());
145
+ const statements: Statement[] = Parser.parse('SELECT 1', new GenericDialect());
153
146
 
154
147
  // Statement is a discriminated union type
155
148
  for (const stmt of statements) {
@@ -162,7 +155,7 @@ for (const stmt of statements) {
162
155
  }
163
156
  ```
164
157
 
165
- ## Building from Source
158
+ ## Development
166
159
 
167
160
  ### Prerequisites
168
161
 
@@ -186,22 +179,29 @@ npm install
186
179
  npm run build
187
180
  ```
188
181
 
189
- ### Run Tests
182
+ ### Tests
190
183
 
191
184
  ```bash
192
185
  cd ts
193
186
  npm test
194
187
  ```
195
188
 
196
- ## Version
189
+ ## Versioning
190
+
191
+ This package follows the upstream [sqlparser-rs](https://github.com/apache/datafusion-sqlparser-rs) version:
192
+
193
+ - **Major.Minor** matches the upstream Rust crate version
194
+ - **Patch** is for TypeScript binding fixes (e.g., `0.60.2` = upstream `0.60.0` + binding fix)
197
195
 
198
196
  | This package | sqlparser-rs |
199
197
  |--------------|--------------|
200
- | 0.60.0-x | 0.60.0 |
198
+ | 0.60.x | 0.60.0 |
199
+
200
+ This approach is similar to [esbuild-wasm](https://github.com/evanw/esbuild) and [duckdb-wasm](https://github.com/duckdb/duckdb-wasm).
201
201
 
202
202
  ## License
203
203
 
204
- Apache-2.0, matching the upstream Rust crate.
204
+ Apache-2.0
205
205
 
206
206
  ## Related Projects
207
207
 
package/wasm/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sqlparser-rs-wasm",
3
3
  "description": "WebAssembly bindings for sqlparser-rs SQL parser",
4
- "version": "0.60.0-rc4",
4
+ "version": "0.60.2",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
Binary file