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/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
 
@@ -6,7 +6,7 @@
6
6
  * These are thin wrappers that provide type safety and a clean API.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.SUPPORTED_DIALECTS = exports.HiveDialect = exports.DatabricksDialect = exports.DuckDbDialect = exports.BigQueryDialect = exports.ClickHouseDialect = exports.MsSqlDialect = exports.RedshiftDialect = exports.SnowflakeDialect = exports.SQLiteDialect = exports.PostgreSqlDialect = exports.MySqlDialect = exports.AnsiDialect = exports.GenericDialect = void 0;
9
+ exports.SUPPORTED_DIALECTS = exports.OracleDialect = exports.HiveDialect = exports.DatabricksDialect = exports.DuckDbDialect = exports.BigQueryDialect = exports.ClickHouseDialect = exports.MsSqlDialect = exports.RedshiftDialect = exports.SnowflakeDialect = exports.SQLiteDialect = exports.PostgreSqlDialect = exports.MySqlDialect = exports.AnsiDialect = exports.GenericDialect = void 0;
10
10
  exports.dialectFromString = dialectFromString;
11
11
  /**
12
12
  * Generic SQL dialect - accepts most SQL syntax
@@ -125,6 +125,15 @@ class HiveDialect {
125
125
  }
126
126
  }
127
127
  exports.HiveDialect = HiveDialect;
128
+ /**
129
+ * Oracle dialect
130
+ */
131
+ class OracleDialect {
132
+ constructor() {
133
+ this.name = 'oracle';
134
+ }
135
+ }
136
+ exports.OracleDialect = OracleDialect;
128
137
  /**
129
138
  * All supported dialect names
130
139
  */
@@ -142,6 +151,7 @@ exports.SUPPORTED_DIALECTS = [
142
151
  'duckdb',
143
152
  'databricks',
144
153
  'hive',
154
+ 'oracle',
145
155
  ];
146
156
  /**
147
157
  * Map of dialect names to dialect classes
@@ -160,6 +170,7 @@ const DIALECT_MAP = {
160
170
  duckdb: DuckDbDialect,
161
171
  databricks: DatabricksDialect,
162
172
  hive: HiveDialect,
173
+ oracle: OracleDialect,
163
174
  };
164
175
  /**
165
176
  * Create a dialect instance from a string name
@@ -1 +1 @@
1
- {"version":3,"file":"dialects.js","sourceRoot":"","sources":["../../src/dialects.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA2JH,8CAeC;AAhKD;;GAEG;AACH,MAAa,cAAc;IAA3B;QACW,SAAI,GAAG,SAAS,CAAC;IAC5B,CAAC;CAAA;AAFD,wCAEC;AAED;;GAEG;AACH,MAAa,WAAW;IAAxB;QACW,SAAI,GAAG,MAAM,CAAC;IACzB,CAAC;CAAA;AAFD,kCAEC;AAED;;GAEG;AACH,MAAa,YAAY;IAAzB;QACW,SAAI,GAAG,OAAO,CAAC;IAC1B,CAAC;CAAA;AAFD,oCAEC;AAED;;GAEG;AACH,MAAa,iBAAiB;IAA9B;QACW,SAAI,GAAG,YAAY,CAAC;IAC/B,CAAC;CA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D,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,UAAU,EAAE,iBAAiB;IAC7B,MAAM,EAAE,aAAa;IACrB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,eAAe;IACzB,KAAK,EAAE,YAAY;IACnB,UAAU,EAAE,iBAAiB;IAC7B,QAAQ,EAAE,eAAe;IACzB,MAAM,EAAE,aAAa;IACrB,UAAU,EAAE,iBAAiB;IAC7B,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,aAAa;CACtB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAiB,CAAC;IAErD,wBAAwB;IACxB,MAAM,QAAQ,GAAgC;QAC5C,QAAQ,EAAE,YAAY;QACtB,EAAE,EAAE,YAAY;QAChB,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE,QAAQ;KACf,CAAC;IAEF,MAAM,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC;IACvD,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9C,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -10,10 +10,10 @@
10
10
  * import { Parser, GenericDialect, PostgreSqlDialect } from 'sqlparser-rs';
11
11
  *
12
12
  * // Simple parsing
13
- * const statements = await Parser.parse('SELECT * FROM users', new GenericDialect());
13
+ * const statements = Parser.parse('SELECT * FROM users', new GenericDialect());
14
14
  *
15
15
  * // With specific dialect
16
- * const pgStatements = await Parser.parse(
16
+ * const pgStatements = Parser.parse(
17
17
  * 'SELECT * FROM users WHERE id = $1',
18
18
  * new PostgreSqlDialect()
19
19
  * );
@@ -23,15 +23,15 @@
23
23
  * .withRecursionLimit(50)
24
24
  * .withOptions({ trailingCommas: true });
25
25
  *
26
- * const ast = await parser.parseAsync('SELECT * FROM users');
26
+ * const ast = parser.parse('SELECT * FROM users');
27
27
  *
28
28
  * // Format SQL
29
- * const formatted = await Parser.format('select * from users', new GenericDialect());
29
+ * const formatted = Parser.format('select * from users', new GenericDialect());
30
30
  * // Returns: "SELECT * FROM users"
31
31
  *
32
32
  * // Validate SQL
33
33
  * try {
34
- * await Parser.validate('SELECT * FRO users', new GenericDialect());
34
+ * Parser.validate('SELECT * FRO users', new GenericDialect());
35
35
  * } catch (e) {
36
36
  * console.log('Invalid SQL:', e.message);
37
37
  * }
@@ -54,28 +54,28 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
54
54
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
55
55
  };
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.SUPPORTED_DIALECTS = exports.dialectFromString = exports.HiveDialect = exports.DatabricksDialect = exports.DuckDbDialect = exports.BigQueryDialect = exports.ClickHouseDialect = exports.MsSqlDialect = exports.RedshiftDialect = exports.SnowflakeDialect = exports.SQLiteDialect = exports.PostgreSqlDialect = exports.MySqlDialect = exports.AnsiDialect = exports.GenericDialect = exports.initWasm = exports.Parser = void 0;
57
+ exports.SUPPORTED_DIALECTS = exports.dialectFromString = exports.OracleDialect = exports.HiveDialect = exports.DatabricksDialect = exports.DuckDbDialect = exports.BigQueryDialect = exports.ClickHouseDialect = exports.MsSqlDialect = exports.RedshiftDialect = exports.SnowflakeDialect = exports.SQLiteDialect = exports.PostgreSqlDialect = exports.MySqlDialect = exports.AnsiDialect = exports.GenericDialect = exports.Parser = void 0;
58
58
  // Parser
59
- var parser_1 = require("./parser");
60
- Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return parser_1.Parser; } });
61
- Object.defineProperty(exports, "initWasm", { enumerable: true, get: function () { return parser_1.initWasm; } });
59
+ var parser_js_1 = require("./parser.js");
60
+ Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return parser_js_1.Parser; } });
62
61
  // Dialects
63
- var dialects_1 = require("./dialects");
64
- Object.defineProperty(exports, "GenericDialect", { enumerable: true, get: function () { return dialects_1.GenericDialect; } });
65
- Object.defineProperty(exports, "AnsiDialect", { enumerable: true, get: function () { return dialects_1.AnsiDialect; } });
66
- Object.defineProperty(exports, "MySqlDialect", { enumerable: true, get: function () { return dialects_1.MySqlDialect; } });
67
- Object.defineProperty(exports, "PostgreSqlDialect", { enumerable: true, get: function () { return dialects_1.PostgreSqlDialect; } });
68
- Object.defineProperty(exports, "SQLiteDialect", { enumerable: true, get: function () { return dialects_1.SQLiteDialect; } });
69
- Object.defineProperty(exports, "SnowflakeDialect", { enumerable: true, get: function () { return dialects_1.SnowflakeDialect; } });
70
- Object.defineProperty(exports, "RedshiftDialect", { enumerable: true, get: function () { return dialects_1.RedshiftDialect; } });
71
- Object.defineProperty(exports, "MsSqlDialect", { enumerable: true, get: function () { return dialects_1.MsSqlDialect; } });
72
- Object.defineProperty(exports, "ClickHouseDialect", { enumerable: true, get: function () { return dialects_1.ClickHouseDialect; } });
73
- Object.defineProperty(exports, "BigQueryDialect", { enumerable: true, get: function () { return dialects_1.BigQueryDialect; } });
74
- Object.defineProperty(exports, "DuckDbDialect", { enumerable: true, get: function () { return dialects_1.DuckDbDialect; } });
75
- Object.defineProperty(exports, "DatabricksDialect", { enumerable: true, get: function () { return dialects_1.DatabricksDialect; } });
76
- Object.defineProperty(exports, "HiveDialect", { enumerable: true, get: function () { return dialects_1.HiveDialect; } });
77
- Object.defineProperty(exports, "dialectFromString", { enumerable: true, get: function () { return dialects_1.dialectFromString; } });
78
- Object.defineProperty(exports, "SUPPORTED_DIALECTS", { enumerable: true, get: function () { return dialects_1.SUPPORTED_DIALECTS; } });
62
+ var dialects_js_1 = require("./dialects.js");
63
+ Object.defineProperty(exports, "GenericDialect", { enumerable: true, get: function () { return dialects_js_1.GenericDialect; } });
64
+ Object.defineProperty(exports, "AnsiDialect", { enumerable: true, get: function () { return dialects_js_1.AnsiDialect; } });
65
+ Object.defineProperty(exports, "MySqlDialect", { enumerable: true, get: function () { return dialects_js_1.MySqlDialect; } });
66
+ Object.defineProperty(exports, "PostgreSqlDialect", { enumerable: true, get: function () { return dialects_js_1.PostgreSqlDialect; } });
67
+ Object.defineProperty(exports, "SQLiteDialect", { enumerable: true, get: function () { return dialects_js_1.SQLiteDialect; } });
68
+ Object.defineProperty(exports, "SnowflakeDialect", { enumerable: true, get: function () { return dialects_js_1.SnowflakeDialect; } });
69
+ Object.defineProperty(exports, "RedshiftDialect", { enumerable: true, get: function () { return dialects_js_1.RedshiftDialect; } });
70
+ Object.defineProperty(exports, "MsSqlDialect", { enumerable: true, get: function () { return dialects_js_1.MsSqlDialect; } });
71
+ Object.defineProperty(exports, "ClickHouseDialect", { enumerable: true, get: function () { return dialects_js_1.ClickHouseDialect; } });
72
+ Object.defineProperty(exports, "BigQueryDialect", { enumerable: true, get: function () { return dialects_js_1.BigQueryDialect; } });
73
+ Object.defineProperty(exports, "DuckDbDialect", { enumerable: true, get: function () { return dialects_js_1.DuckDbDialect; } });
74
+ Object.defineProperty(exports, "DatabricksDialect", { enumerable: true, get: function () { return dialects_js_1.DatabricksDialect; } });
75
+ Object.defineProperty(exports, "HiveDialect", { enumerable: true, get: function () { return dialects_js_1.HiveDialect; } });
76
+ Object.defineProperty(exports, "OracleDialect", { enumerable: true, get: function () { return dialects_js_1.OracleDialect; } });
77
+ Object.defineProperty(exports, "dialectFromString", { enumerable: true, get: function () { return dialects_js_1.dialectFromString; } });
78
+ Object.defineProperty(exports, "SUPPORTED_DIALECTS", { enumerable: true, get: function () { return dialects_js_1.SUPPORTED_DIALECTS; } });
79
79
  // Types
80
- __exportStar(require("./types"), exports);
80
+ __exportStar(require("./types/index.js"), exports);
81
81
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"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kB,OAAA;AAIpB,QAAQ;AACR,mDAAiC"}
@@ -1,86 +1,27 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.Parser = void 0;
37
- exports.initWasm = initWasm;
38
- const dialects_1 = require("./dialects");
39
- const errors_1 = require("./types/errors");
40
- // Global WASM module instance
4
+ const dialects_js_1 = require("./dialects.js");
5
+ const errors_js_1 = require("./types/errors.js");
6
+ // Lazily loaded WASM module - loaded synchronously on first access
41
7
  let wasmModule = null;
42
- let wasmInitPromise = null;
43
8
  /**
44
- * Initialize the WASM module
45
- * This is called automatically when needed, but can be called manually for eager loading
9
+ * Get the WASM module (loads synchronously on first access)
46
10
  */
47
- async function initWasm() {
48
- await getWasmModule();
49
- }
50
- /**
51
- * Get or initialize the WASM module
52
- */
53
- async function getWasmModule() {
11
+ function getWasmModule() {
54
12
  if (wasmModule) {
55
13
  return wasmModule;
56
14
  }
57
- if (wasmInitPromise) {
58
- return wasmInitPromise;
15
+ try {
16
+ // Use require() for synchronous loading
17
+ // The path is relative to the compiled output in dist/cjs or dist/esm
18
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
19
+ wasmModule = require('../../wasm/sqlparser_rs_wasm.js');
20
+ return wasmModule;
59
21
  }
60
- wasmInitPromise = (async () => {
61
- try {
62
- // Try to load the WASM module
63
- // Use dynamic path to avoid TypeScript path resolution issues
64
- // The path is relative to the compiled output in dist/cjs or dist/esm
65
- const wasmPath = '../../wasm/sqlparser_rs_wasm.js';
66
- const wasm = await Promise.resolve(`${wasmPath}`).then(s => __importStar(require(s)));
67
- wasmModule = wasm;
68
- return wasmModule;
69
- }
70
- catch (error) {
71
- throw new errors_1.WasmInitError(`Failed to initialize WASM module: ${error instanceof Error ? error.message : String(error)}`);
72
- }
73
- })();
74
- return wasmInitPromise;
75
- }
76
- /**
77
- * Get the WASM module synchronously (throws if not initialized)
78
- */
79
- function getWasmModuleSync() {
80
- if (!wasmModule) {
81
- throw new errors_1.WasmInitError('WASM module not initialized. Call initWasm() first or use async methods.');
22
+ catch (error) {
23
+ throw new errors_js_1.WasmInitError(`Failed to load WASM module: ${error instanceof Error ? error.message : String(error)}`);
82
24
  }
83
- return wasmModule;
84
25
  }
85
26
  /**
86
27
  * SQL Parser
@@ -92,14 +33,14 @@ function getWasmModuleSync() {
92
33
  * import { Parser, PostgreSqlDialect } from 'sqlparser-rs';
93
34
  *
94
35
  * // Simple parsing
95
- * const statements = await Parser.parse('SELECT * FROM users', new PostgreSqlDialect());
36
+ * const statements = Parser.parse('SELECT * FROM users', new PostgreSqlDialect());
96
37
  *
97
38
  * // With builder pattern
98
39
  * const parser = new Parser(new PostgreSqlDialect())
99
40
  * .withRecursionLimit(50)
100
41
  * .withOptions({ trailingCommas: true });
101
42
  *
102
- * const ast = await parser.parseAsync('SELECT * FROM users');
43
+ * const ast = parser.parse('SELECT * FROM users');
103
44
  * ```
104
45
  */
105
46
  class Parser {
@@ -108,7 +49,7 @@ class Parser {
108
49
  *
109
50
  * @param dialect - The SQL dialect to use (defaults to GenericDialect)
110
51
  */
111
- constructor(dialect = new dialects_1.GenericDialect()) {
52
+ constructor(dialect = new dialects_js_1.GenericDialect()) {
112
53
  this.dialect = dialect;
113
54
  this.options = {};
114
55
  }
@@ -133,27 +74,13 @@ class Parser {
133
74
  return this;
134
75
  }
135
76
  /**
136
- * Parse SQL statements asynchronously
77
+ * Parse SQL statements
137
78
  *
138
79
  * @param sql - SQL string to parse
139
80
  * @returns Array of parsed statements
140
81
  */
141
- async parseAsync(sql) {
142
- const wasm = await getWasmModule();
143
- return this.parseWithWasm(wasm, sql);
144
- }
145
- /**
146
- * Parse SQL statements synchronously
147
- * Requires WASM module to be initialized first via initWasm()
148
- *
149
- * @param sql - SQL string to parse
150
- * @returns Array of parsed statements
151
- */
152
- parseSync(sql) {
153
- const wasm = getWasmModuleSync();
154
- return this.parseWithWasm(wasm, sql);
155
- }
156
- parseWithWasm(wasm, sql) {
82
+ parse(sql) {
83
+ const wasm = getWasmModule();
157
84
  try {
158
85
  const hasOptions = Object.keys(this.options).length > 0;
159
86
  if (hasOptions) {
@@ -166,14 +93,14 @@ class Parser {
166
93
  }
167
94
  }
168
95
  catch (error) {
169
- throw errors_1.ParserError.fromWasmError(error);
96
+ throw errors_js_1.ParserError.fromWasmError(error);
170
97
  }
171
98
  }
172
99
  // ============================================================================
173
100
  // Static methods for simple one-off parsing
174
101
  // ============================================================================
175
102
  /**
176
- * Parse SQL statements (async)
103
+ * Parse SQL statements
177
104
  *
178
105
  * @param sql - SQL string to parse
179
106
  * @param dialect - SQL dialect to use
@@ -181,43 +108,43 @@ class Parser {
181
108
  *
182
109
  * @example
183
110
  * ```typescript
184
- * const statements = await Parser.parse('SELECT 1', new GenericDialect());
111
+ * const statements = Parser.parse('SELECT 1', new GenericDialect());
185
112
  * ```
186
113
  */
187
- static async parse(sql, dialect = new dialects_1.GenericDialect()) {
114
+ static parse(sql, dialect = new dialects_js_1.GenericDialect()) {
188
115
  const parser = new Parser(dialect);
189
- return parser.parseAsync(sql);
116
+ return parser.parse(sql);
190
117
  }
191
118
  /**
192
- * Parse SQL and return the AST as a JSON string (async)
119
+ * Parse SQL and return the AST as a JSON string
193
120
  *
194
121
  * @param sql - SQL string to parse
195
122
  * @param dialect - SQL dialect to use
196
123
  * @returns JSON string representation of the AST
197
124
  */
198
- static async parseToJson(sql, dialect = new dialects_1.GenericDialect()) {
199
- const wasm = await getWasmModule();
125
+ static parseToJson(sql, dialect = new dialects_js_1.GenericDialect()) {
126
+ const wasm = getWasmModule();
200
127
  try {
201
128
  return wasm.parse_sql_to_json_string(dialect.name, sql);
202
129
  }
203
130
  catch (error) {
204
- throw errors_1.ParserError.fromWasmError(error);
131
+ throw errors_js_1.ParserError.fromWasmError(error);
205
132
  }
206
133
  }
207
134
  /**
208
- * Parse SQL and return a formatted string representation (async)
135
+ * Parse SQL and return a formatted string representation
209
136
  *
210
137
  * @param sql - SQL string to parse
211
138
  * @param dialect - SQL dialect to use
212
139
  * @returns String representation of the parsed SQL
213
140
  */
214
- static async parseToString(sql, dialect = new dialects_1.GenericDialect()) {
215
- const wasm = await getWasmModule();
141
+ static parseToString(sql, dialect = new dialects_js_1.GenericDialect()) {
142
+ const wasm = getWasmModule();
216
143
  try {
217
144
  return wasm.parse_sql_to_string(dialect.name, sql);
218
145
  }
219
146
  catch (error) {
220
- throw errors_1.ParserError.fromWasmError(error);
147
+ throw errors_js_1.ParserError.fromWasmError(error);
221
148
  }
222
149
  }
223
150
  /**
@@ -227,13 +154,13 @@ class Parser {
227
154
  * @param dialect - SQL dialect to use
228
155
  * @returns Formatted SQL string
229
156
  */
230
- static async format(sql, dialect = new dialects_1.GenericDialect()) {
231
- const wasm = await getWasmModule();
157
+ static format(sql, dialect = new dialects_js_1.GenericDialect()) {
158
+ const wasm = getWasmModule();
232
159
  try {
233
160
  return wasm.format_sql(dialect.name, sql);
234
161
  }
235
162
  catch (error) {
236
- throw errors_1.ParserError.fromWasmError(error);
163
+ throw errors_js_1.ParserError.fromWasmError(error);
237
164
  }
238
165
  }
239
166
  /**
@@ -243,20 +170,20 @@ class Parser {
243
170
  * @param dialect - SQL dialect to use
244
171
  * @returns true if valid, throws ParserError if invalid
245
172
  */
246
- static async validate(sql, dialect = new dialects_1.GenericDialect()) {
247
- const wasm = await getWasmModule();
173
+ static validate(sql, dialect = new dialects_js_1.GenericDialect()) {
174
+ const wasm = getWasmModule();
248
175
  try {
249
176
  return wasm.validate_sql(dialect.name, sql);
250
177
  }
251
178
  catch (error) {
252
- throw errors_1.ParserError.fromWasmError(error);
179
+ throw errors_js_1.ParserError.fromWasmError(error);
253
180
  }
254
181
  }
255
182
  /**
256
183
  * Get the list of supported dialect names
257
184
  */
258
- static async getSupportedDialects() {
259
- const wasm = await getWasmModule();
185
+ static getSupportedDialects() {
186
+ const wasm = getWasmModule();
260
187
  return wasm.get_supported_dialects();
261
188
  }
262
189
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,4BAEC;AAxCD,yCAA4C;AAC5C,2CAA4D;AA6B5D,8BAA8B;AAC9B,IAAI,UAAU,GAAsB,IAAI,CAAC;AACzC,IAAI,eAAe,GAA+B,IAAI,CAAC;AAEvD;;;GAGG;AACI,KAAK,UAAU,QAAQ;IAC5B,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,aAAa;IAC1B,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC;IAC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AAC;YACf,MAAM,uBAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB;QACzB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC;IACvC,CAAC;CACF;AA3JD,wBA2JC"}
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ast"), exports);
18
- __exportStar(require("./errors"), exports);
17
+ __exportStar(require("./ast.js"), exports);
18
+ __exportStar(require("./errors.js"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B"}
@@ -108,6 +108,14 @@ export class HiveDialect {
108
108
  this.name = 'hive';
109
109
  }
110
110
  }
111
+ /**
112
+ * Oracle dialect
113
+ */
114
+ export class OracleDialect {
115
+ constructor() {
116
+ this.name = 'oracle';
117
+ }
118
+ }
111
119
  /**
112
120
  * All supported dialect names
113
121
  */
@@ -125,6 +133,7 @@ export const SUPPORTED_DIALECTS = [
125
133
  'duckdb',
126
134
  'databricks',
127
135
  'hive',
136
+ 'oracle',
128
137
  ];
129
138
  /**
130
139
  * Map of dialect names to dialect classes
@@ -143,6 +152,7 @@ const DIALECT_MAP = {
143
152
  duckdb: DuckDbDialect,
144
153
  databricks: DatabricksDialect,
145
154
  hive: HiveDialect,
155
+ oracle: OracleDialect,
146
156
  };
147
157
  /**
148
158
  * Create a dialect instance from a string name
@@ -1 +1 @@
1
- {"version":3,"file":"dialects.js","sourceRoot":"","sources":["../../src/dialects.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;GAEG;AACH,MAAM,OAAO,cAAc;IAA3B;QACW,SAAI,GAAG,SAAS,CAAC;IAC5B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,WAAW;IAAxB;QACW,SAAI,GAAG,MAAM,CAAC;IACzB,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,YAAY;IAAzB;QACW,SAAI,GAAG,OAAO,CAAC;IAC1B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACW,SAAI,GAAG,YAAY,CAAC;IAC/B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,aAAa;IAA1B;QACW,SAAI,GAAG,QAAQ,CAAC;IAC3B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QACW,SAAI,GAAG,WAAW,CAAC;IAC9B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,eAAe;IAA5B;QACW,SAAI,GAAG,UAAU,CAAC;IAC7B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,YAAY;IAAzB;QACW,SAAI,GAAG,OAAO,CAAC;IAC1B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACW,SAAI,GAAG,YAAY,CAAC;IAC/B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,eAAe;IAA5B;QACW,SAAI,GAAG,UAAU,CAAC;IAC7B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,aAAa;IAA1B;QACW,SAAI,GAAG,QAAQ,CAAC;IAC3B,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACW,SAAI,GAAG,YAAY,CAAC;IAC/B,CAAC;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