@polyglot-sql/sdk 0.4.4 → 0.5.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/README.md +17 -1
- package/dist/cdn/polyglot.esm.js +1381 -1354
- package/dist/index.cjs +62 -3
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +78 -3
- package/dist/index.node.js +60 -3
- package/dist/manual.js +74 -3
- package/dist/polyglot_sql.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,22 @@ const result = transpile(
|
|
|
25
25
|
console.log(result.sql[0]); // SELECT COALESCE(a, b) FROM t
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Use `unsupportedLevel: 'raise'` when you want transpilation to fail instead of
|
|
29
|
+
silently preserving known unsupported target-dialect constructs.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
const strict = transpile(
|
|
33
|
+
'SELECT ARRAY_AGG(x) FROM t',
|
|
34
|
+
Dialect.PostgreSQL,
|
|
35
|
+
Dialect.Fabric,
|
|
36
|
+
{ unsupportedLevel: 'raise' },
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
if (!strict.success) {
|
|
40
|
+
console.error(strict.error);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
28
44
|
### Parse + Generate
|
|
29
45
|
|
|
30
46
|
```typescript
|
|
@@ -664,7 +680,7 @@ const formattedSafe = pg.formatWithOptions('SELECT a,b FROM t', Dialect.Generic,
|
|
|
664
680
|
|
|
665
681
|
| Function | Description |
|
|
666
682
|
|----------|-------------|
|
|
667
|
-
| `transpile(sql, read, write)` | Transpile SQL between dialects |
|
|
683
|
+
| `transpile(sql, read, write, options?)` | Transpile SQL between dialects |
|
|
668
684
|
| `parse(sql, dialect?)` | Parse SQL into AST |
|
|
669
685
|
| `generate(ast, dialect?)` | Generate SQL from AST |
|
|
670
686
|
| `format(sql, dialect?)` | Pretty-print SQL |
|