qail-wasm 0.7.0 → 0.8.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.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # 🪝 QAIL — Universal Query Transpiler
2
+
3
+ > Write one syntax. Compile to **19 databases**.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i qail-wasm
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```javascript
14
+ import init, { transpile, transpile_with_dialect, validate, parse_json } from 'qail-wasm';
15
+
16
+ await init();
17
+
18
+ // Basic transpile (PostgreSQL by default)
19
+ const sql = transpile("get::users:'id'email[active=true][lim=10]");
20
+ // → SELECT "id", "email" FROM "users" WHERE "active" = true LIMIT 10
21
+
22
+ // Specific dialect
23
+ const mysql = transpile_with_dialect("get::users:'_", "mysql");
24
+ // → SELECT * FROM `users`
25
+
26
+ // Validate syntax
27
+ const isValid = validate("get::users:'_");
28
+ // → true
29
+
30
+ // Get AST as JSON
31
+ const ast = parse_json("get::users:'_");
32
+ ```
33
+
34
+ ## Supported Dialects
35
+
36
+ **SQL:** PostgreSQL, MySQL, SQLite, SQL Server, Oracle, BigQuery, Snowflake, Redshift, DuckDB, MariaDB, InfluxDB
37
+
38
+ **NoSQL:** MongoDB, DynamoDB, Redis, Cassandra, Elasticsearch, Neo4j, Qdrant
39
+
40
+ ## Quick Reference
41
+
42
+ | QAIL | SQL |
43
+ |------|-----|
44
+ | `get::users:'_` | `SELECT * FROM users` |
45
+ | `get::users:'id'name[active=true]` | `SELECT id, name FROM users WHERE active = true` |
46
+ | `set::users:[status=active][id=1]` | `UPDATE users SET status = 'active' WHERE id = 1` |
47
+ | `del::users:[id=1]` | `DELETE FROM users WHERE id = 1` |
48
+ | `add::users:[name=John]` | `INSERT INTO users (name) VALUES ('John')` |
49
+
50
+ ## Links
51
+
52
+ - **Website:** https://qail.rs
53
+ - **GitHub:** https://github.com/qail-rs/qail
54
+ - **Docs:** https://qail.rs/docs
55
+
56
+ ## License
57
+
58
+ MIT © 2025 QAIL Contributors
package/package.json CHANGED
@@ -1,20 +1,46 @@
1
1
  {
2
2
  "name": "qail-wasm",
3
- "type": "module",
4
- "description": "QAIL parser and transpiler for JavaScript/TypeScript via WebAssembly",
5
- "version": "0.7.0",
3
+ "description": "🪝 QAIL - Universal Query Transpiler. Write one syntax, compile to 19 databases: PostgreSQL, MySQL, SQLite, SQL Server, Oracle, BigQuery, Snowflake, MongoDB, DynamoDB, Redis, Cassandra, Elasticsearch, Neo4j, and more.",
4
+ "version": "0.8.1",
6
5
  "license": "MIT",
6
+ "type": "module",
7
+ "keywords": [
8
+ "sql",
9
+ "query",
10
+ "transpiler",
11
+ "database",
12
+ "orm",
13
+ "postgresql",
14
+ "mysql",
15
+ "sqlite",
16
+ "mongodb",
17
+ "dynamodb",
18
+ "redis",
19
+ "cassandra",
20
+ "elasticsearch",
21
+ "neo4j",
22
+ "nosql",
23
+ "query-builder",
24
+ "wasm",
25
+ "webassembly",
26
+ "parser",
27
+ "compiler"
28
+ ],
7
29
  "repository": {
8
30
  "type": "git",
9
31
  "url": "https://github.com/qail-rs/qail"
10
32
  },
33
+ "homepage": "https://qail.rs",
34
+ "bugs": {
35
+ "url": "https://github.com/qail-rs/qail/issues"
36
+ },
11
37
  "files": [
38
+ "README.md",
12
39
  "qail_wasm_bg.wasm",
13
40
  "qail_wasm.js",
14
41
  "qail_wasm.d.ts"
15
42
  ],
16
43
  "main": "qail_wasm.js",
17
- "homepage": "https://qail.rs",
18
44
  "types": "qail_wasm.d.ts",
19
45
  "sideEffects": [
20
46
  "./snippets/*"
package/qail_wasm.d.ts CHANGED
@@ -11,6 +11,12 @@ export function parse(qail: string): any;
11
11
  */
12
12
  export function parse_and_transpile(qail: string): string;
13
13
 
14
+ /**
15
+ * Parse QAIL and return SQL string with specific dialect.
16
+ * Dialect: "postgres", "mysql", "sqlite", "sqlserver"
17
+ */
18
+ export function parse_and_transpile_with_dialect(qail: string, dialect: string): string;
19
+
14
20
  /**
15
21
  * Validate QAIL syntax (returns true if valid).
16
22
  */
@@ -26,6 +32,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
26
32
  export interface InitOutput {
27
33
  readonly memory: WebAssembly.Memory;
28
34
  readonly parse_and_transpile: (a: number, b: number) => [number, number, number, number];
35
+ readonly parse_and_transpile_with_dialect: (a: number, b: number, c: number, d: number) => [number, number, number, number];
29
36
  readonly parse: (a: number, b: number) => [number, number, number];
30
37
  readonly validate: (a: number, b: number) => number;
31
38
  readonly version: () => [number, number];
package/qail_wasm.js CHANGED
@@ -134,6 +134,36 @@ export function parse_and_transpile(qail) {
134
134
  }
135
135
  }
136
136
 
137
+ /**
138
+ * Parse QAIL and return SQL string with specific dialect.
139
+ * Dialect: "postgres", "mysql", "sqlite", "sqlserver"
140
+ * @param {string} qail
141
+ * @param {string} dialect
142
+ * @returns {string}
143
+ */
144
+ export function parse_and_transpile_with_dialect(qail, dialect) {
145
+ let deferred4_0;
146
+ let deferred4_1;
147
+ try {
148
+ const ptr0 = passStringToWasm0(qail, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
149
+ const len0 = WASM_VECTOR_LEN;
150
+ const ptr1 = passStringToWasm0(dialect, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
151
+ const len1 = WASM_VECTOR_LEN;
152
+ const ret = wasm.parse_and_transpile_with_dialect(ptr0, len0, ptr1, len1);
153
+ var ptr3 = ret[0];
154
+ var len3 = ret[1];
155
+ if (ret[3]) {
156
+ ptr3 = 0; len3 = 0;
157
+ throw takeFromExternrefTable0(ret[2]);
158
+ }
159
+ deferred4_0 = ptr3;
160
+ deferred4_1 = len3;
161
+ return getStringFromWasm0(ptr3, len3);
162
+ } finally {
163
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
164
+ }
165
+ }
166
+
137
167
  /**
138
168
  * Validate QAIL syntax (returns true if valid).
139
169
  * @param {string} qail
package/qail_wasm_bg.wasm CHANGED
Binary file