pgsql-deparser 14.0.0 → 15.0.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/{dist/esm → esm}/index.js +3 -3
- package/{dist/esm/v14-to-v17-direct.js → esm/v15-to-v17-direct.js} +9 -19
- package/{dist/index.d.ts → index.d.ts} +1 -1
- package/{dist/index.js → index.js} +3 -3
- package/package.json +3 -4
- package/{dist/v14-to-v17-direct.d.ts → v15-to-v17-direct.d.ts} +4 -5
- package/{dist/v14-to-v17-direct.js → v15-to-v17-direct.js} +11 -21
- package/dist/README.md +0 -160
- package/dist/esm/v14-to-v15.js +0 -1220
- package/dist/package.json +0 -42
- package/dist/v14-to-v15.d.ts +0 -616
- package/dist/v14-to-v15.js +0 -1224
- package/src/deparser/deparser.ts +0 -10026
- package/src/deparser/index.ts +0 -14
- package/src/deparser/utils/list-utils.ts +0 -27
- package/src/deparser/utils/quote-utils.ts +0 -86
- package/src/deparser/utils/sql-formatter.ts +0 -37
- package/src/deparser/visitors/base.ts +0 -40
- package/src/index.ts +0 -27
- package/src/v14-to-v15.ts +0 -1621
- package/src/v14-to-v17-direct.ts +0 -68
- package/src/v15-to-v16.ts +0 -3290
- package/src/v16-to-v17.ts +0 -1897
- package/tsconfig.esm.json +0 -8
- package/tsconfig.json +0 -26
- /package/{dist/LICENSE → LICENSE} +0 -0
- /package/{dist/deparser → deparser}/deparser.d.ts +0 -0
- /package/{dist/deparser → deparser}/deparser.js +0 -0
- /package/{dist/deparser → deparser}/index.d.ts +0 -0
- /package/{dist/deparser → deparser}/index.js +0 -0
- /package/{dist/deparser → deparser}/utils/list-utils.d.ts +0 -0
- /package/{dist/deparser → deparser}/utils/list-utils.js +0 -0
- /package/{dist/deparser → deparser}/utils/quote-utils.d.ts +0 -0
- /package/{dist/deparser → deparser}/utils/quote-utils.js +0 -0
- /package/{dist/deparser → deparser}/utils/sql-formatter.d.ts +0 -0
- /package/{dist/deparser → deparser}/utils/sql-formatter.js +0 -0
- /package/{dist/deparser → deparser}/visitors/base.d.ts +0 -0
- /package/{dist/deparser → deparser}/visitors/base.js +0 -0
- /package/{dist/esm → esm}/deparser/deparser.js +0 -0
- /package/{dist/esm → esm}/deparser/index.js +0 -0
- /package/{dist/esm → esm}/deparser/utils/list-utils.js +0 -0
- /package/{dist/esm → esm}/deparser/utils/quote-utils.js +0 -0
- /package/{dist/esm → esm}/deparser/utils/sql-formatter.js +0 -0
- /package/{dist/esm → esm}/deparser/visitors/base.js +0 -0
- /package/{dist/esm → esm}/v15-to-v16.js +0 -0
- /package/{dist/esm → esm}/v16-to-v17.js +0 -0
- /package/{dist/v15-to-v16.d.ts → v15-to-v16.d.ts} +0 -0
- /package/{dist/v15-to-v16.js → v15-to-v16.js} +0 -0
- /package/{dist/v16-to-v17.d.ts → v16-to-v17.d.ts} +0 -0
- /package/{dist/v16-to-v17.js → v16-to-v17.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Deparser for PostgreSQL version
|
|
2
|
+
* Deparser for PostgreSQL version 15
|
|
3
3
|
* Auto-generated by generate-version-deparsers.ts
|
|
4
4
|
*/
|
|
5
5
|
import { deparse as deparse17, deparseSync as deparseSync17 } from './deparser';
|
|
6
|
-
import {
|
|
7
|
-
const tx = new
|
|
6
|
+
import { PG15ToPG17Transformer } from './v15-to-v17-direct';
|
|
7
|
+
const tx = new PG15ToPG17Transformer();
|
|
8
8
|
export async function deparse(query, opts) {
|
|
9
9
|
const ast17 = tx.transform(query);
|
|
10
10
|
return await deparse17(ast17, opts);
|
|
@@ -2,35 +2,27 @@
|
|
|
2
2
|
* Auto-generated file with types stripped for better tree-shaking
|
|
3
3
|
* DO NOT EDIT - Generated by strip-direct-transformer-types.ts
|
|
4
4
|
*/
|
|
5
|
-
import { V14ToV15Transformer } from "./v14-to-v15";
|
|
6
5
|
import { V15ToV16Transformer } from "./v15-to-v16";
|
|
7
6
|
import { V16ToV17Transformer } from "./v16-to-v17";
|
|
8
7
|
/**
|
|
9
|
-
* Direct transformer from
|
|
10
|
-
* This transformer chains
|
|
8
|
+
* Direct transformer from PG15 to PG17
|
|
9
|
+
* This transformer chains v15->v16->v17 transformations
|
|
11
10
|
*/
|
|
12
|
-
export class
|
|
13
|
-
v14to15 = new V14ToV15Transformer();
|
|
11
|
+
export class PG15ToPG17Transformer {
|
|
14
12
|
v15to16 = new V15ToV16Transformer();
|
|
15
13
|
v16to17 = new V16ToV17Transformer();
|
|
16
14
|
transform(node) {
|
|
17
15
|
// If it's a ParseResult, handle it specially
|
|
18
16
|
if (this.isParseResult(node)) {
|
|
19
|
-
//
|
|
20
|
-
const
|
|
21
|
-
if (stmtWrapper.stmt) {
|
|
22
|
-
const v15Stmt = this.v14to15.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
|
|
23
|
-
return { ...stmtWrapper, stmt: v15Stmt };
|
|
24
|
-
}
|
|
25
|
-
return stmtWrapper;
|
|
26
|
-
});
|
|
27
|
-
const v16Stmts = v15Stmts.map((stmtWrapper) => {
|
|
17
|
+
// First transform statements from v15 to v16
|
|
18
|
+
const v16Stmts = node.stmts.map((stmtWrapper) => {
|
|
28
19
|
if (stmtWrapper.stmt) {
|
|
29
20
|
const v16Stmt = this.v15to16.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
|
|
30
21
|
return { ...stmtWrapper, stmt: v16Stmt };
|
|
31
22
|
}
|
|
32
23
|
return stmtWrapper;
|
|
33
24
|
});
|
|
25
|
+
// Then transform from v16 to v17
|
|
34
26
|
const v17Stmts = v16Stmts.map((stmtWrapper) => {
|
|
35
27
|
if (stmtWrapper.stmt) {
|
|
36
28
|
const v17Stmt = this.v16to17.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
|
|
@@ -45,17 +37,15 @@ export class PG14ToPG17Transformer {
|
|
|
45
37
|
};
|
|
46
38
|
}
|
|
47
39
|
// Otherwise, transform as a regular node through the chain
|
|
48
|
-
const
|
|
49
|
-
const v16Node = this.v15to16.transform(v15Node, { parentNodeTypes: [] });
|
|
40
|
+
const v16Node = this.v15to16.transform(node, { parentNodeTypes: [] });
|
|
50
41
|
return this.v16to17.transform(v16Node, { parentNodeTypes: [] });
|
|
51
42
|
}
|
|
52
43
|
/**
|
|
53
|
-
* Transform a single statement from
|
|
44
|
+
* Transform a single statement from PG15 to PG17
|
|
54
45
|
* @deprecated Use transform() instead, which handles all node types
|
|
55
46
|
*/
|
|
56
47
|
transformStatement(stmt) {
|
|
57
|
-
const
|
|
58
|
-
const v16Stmt = this.v15to16.transform(v15Stmt, { parentNodeTypes: [] });
|
|
48
|
+
const v16Stmt = this.v15to16.transform(stmt, { parentNodeTypes: [] });
|
|
59
49
|
return this.v16to17.transform(v16Stmt, { parentNodeTypes: [] });
|
|
60
50
|
}
|
|
61
51
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Deparser for PostgreSQL version
|
|
3
|
+
* Deparser for PostgreSQL version 15
|
|
4
4
|
* Auto-generated by generate-version-deparsers.ts
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.deparse = deparse;
|
|
8
8
|
exports.deparseSync = deparseSync;
|
|
9
9
|
const deparser_1 = require("./deparser");
|
|
10
|
-
const
|
|
11
|
-
const tx = new
|
|
10
|
+
const v15_to_v17_direct_1 = require("./v15-to-v17-direct");
|
|
11
|
+
const tx = new v15_to_v17_direct_1.PG15ToPG17Transformer();
|
|
12
12
|
async function deparse(query, opts) {
|
|
13
13
|
const ast17 = tx.transform(query);
|
|
14
14
|
return await (0, deparser_1.deparse)(ast17, opts);
|
package/package.json
CHANGED
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"copy": "copyfiles -f ../../../../LICENSE README.md package.json dist",
|
|
11
11
|
"clean": "rimraf dist",
|
|
12
|
-
"prepare": "npm run build",
|
|
13
12
|
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json && npm run copy",
|
|
14
|
-
"publish:pkg": "npm publish --tag
|
|
13
|
+
"publish:pkg": "npm publish --tag pg15"
|
|
15
14
|
},
|
|
16
15
|
"publishConfig": {
|
|
17
16
|
"access": "public",
|
|
@@ -35,8 +34,8 @@
|
|
|
35
34
|
"database"
|
|
36
35
|
],
|
|
37
36
|
"name": "pgsql-deparser",
|
|
38
|
-
"version": "
|
|
37
|
+
"version": "15.0.0",
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@pgsql/types": "^
|
|
39
|
+
"@pgsql/types": "^15.1.1"
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
* DO NOT EDIT - Generated by strip-direct-transformer-types.ts
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Direct transformer from
|
|
7
|
-
* This transformer chains
|
|
6
|
+
* Direct transformer from PG15 to PG17
|
|
7
|
+
* This transformer chains v15->v16->v17 transformations
|
|
8
8
|
*/
|
|
9
|
-
export declare class
|
|
10
|
-
private v14to15;
|
|
9
|
+
export declare class PG15ToPG17Transformer {
|
|
11
10
|
private v15to16;
|
|
12
11
|
private v16to17;
|
|
13
12
|
transform(node: any): any;
|
|
14
13
|
/**
|
|
15
|
-
* Transform a single statement from
|
|
14
|
+
* Transform a single statement from PG15 to PG17
|
|
16
15
|
* @deprecated Use transform() instead, which handles all node types
|
|
17
16
|
*/
|
|
18
17
|
transformStatement(stmt: any): any;
|
|
@@ -4,36 +4,28 @@
|
|
|
4
4
|
* DO NOT EDIT - Generated by strip-direct-transformer-types.ts
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
const v14_to_v15_1 = require("./v14-to-v15");
|
|
7
|
+
exports.PG15ToPG17Transformer = void 0;
|
|
9
8
|
const v15_to_v16_1 = require("./v15-to-v16");
|
|
10
9
|
const v16_to_v17_1 = require("./v16-to-v17");
|
|
11
10
|
/**
|
|
12
|
-
* Direct transformer from
|
|
13
|
-
* This transformer chains
|
|
11
|
+
* Direct transformer from PG15 to PG17
|
|
12
|
+
* This transformer chains v15->v16->v17 transformations
|
|
14
13
|
*/
|
|
15
|
-
class
|
|
16
|
-
v14to15 = new v14_to_v15_1.V14ToV15Transformer();
|
|
14
|
+
class PG15ToPG17Transformer {
|
|
17
15
|
v15to16 = new v15_to_v16_1.V15ToV16Transformer();
|
|
18
16
|
v16to17 = new v16_to_v17_1.V16ToV17Transformer();
|
|
19
17
|
transform(node) {
|
|
20
18
|
// If it's a ParseResult, handle it specially
|
|
21
19
|
if (this.isParseResult(node)) {
|
|
22
|
-
//
|
|
23
|
-
const
|
|
24
|
-
if (stmtWrapper.stmt) {
|
|
25
|
-
const v15Stmt = this.v14to15.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
|
|
26
|
-
return { ...stmtWrapper, stmt: v15Stmt };
|
|
27
|
-
}
|
|
28
|
-
return stmtWrapper;
|
|
29
|
-
});
|
|
30
|
-
const v16Stmts = v15Stmts.map((stmtWrapper) => {
|
|
20
|
+
// First transform statements from v15 to v16
|
|
21
|
+
const v16Stmts = node.stmts.map((stmtWrapper) => {
|
|
31
22
|
if (stmtWrapper.stmt) {
|
|
32
23
|
const v16Stmt = this.v15to16.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
|
|
33
24
|
return { ...stmtWrapper, stmt: v16Stmt };
|
|
34
25
|
}
|
|
35
26
|
return stmtWrapper;
|
|
36
27
|
});
|
|
28
|
+
// Then transform from v16 to v17
|
|
37
29
|
const v17Stmts = v16Stmts.map((stmtWrapper) => {
|
|
38
30
|
if (stmtWrapper.stmt) {
|
|
39
31
|
const v17Stmt = this.v16to17.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
|
|
@@ -48,17 +40,15 @@ class PG14ToPG17Transformer {
|
|
|
48
40
|
};
|
|
49
41
|
}
|
|
50
42
|
// Otherwise, transform as a regular node through the chain
|
|
51
|
-
const
|
|
52
|
-
const v16Node = this.v15to16.transform(v15Node, { parentNodeTypes: [] });
|
|
43
|
+
const v16Node = this.v15to16.transform(node, { parentNodeTypes: [] });
|
|
53
44
|
return this.v16to17.transform(v16Node, { parentNodeTypes: [] });
|
|
54
45
|
}
|
|
55
46
|
/**
|
|
56
|
-
* Transform a single statement from
|
|
47
|
+
* Transform a single statement from PG15 to PG17
|
|
57
48
|
* @deprecated Use transform() instead, which handles all node types
|
|
58
49
|
*/
|
|
59
50
|
transformStatement(stmt) {
|
|
60
|
-
const
|
|
61
|
-
const v16Stmt = this.v15to16.transform(v15Stmt, { parentNodeTypes: [] });
|
|
51
|
+
const v16Stmt = this.v15to16.transform(stmt, { parentNodeTypes: [] });
|
|
62
52
|
return this.v16to17.transform(v16Stmt, { parentNodeTypes: [] });
|
|
63
53
|
}
|
|
64
54
|
/**
|
|
@@ -68,4 +58,4 @@ class PG14ToPG17Transformer {
|
|
|
68
58
|
return node && typeof node === 'object' && 'version' in node && 'stmts' in node;
|
|
69
59
|
}
|
|
70
60
|
}
|
|
71
|
-
exports.
|
|
61
|
+
exports.PG15ToPG17Transformer = PG15ToPG17Transformer;
|
package/dist/README.md
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
# pgsql-deparser
|
|
2
|
-
|
|
3
|
-
<p align="center" width="100%">
|
|
4
|
-
<img height="120" src="https://github.com/launchql/pgsql-parser/assets/545047/6440fa7d-918b-4a3b-8d1b-755d85de8bea" />
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<p align="center" width="100%">
|
|
8
|
-
<a href="https://github.com/launchql/pgsql-parser/actions/workflows/run-tests.yaml">
|
|
9
|
-
<img height="20" src="https://github.com/launchql/pgsql-parser/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
|
-
</a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/pgsql-deparser"><img height="20" src="https://img.shields.io/npm/dt/pgsql-deparser"></a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/pgsql-deparser"><img height="20" src="https://img.shields.io/npm/dw/pgsql-deparser"/></a>
|
|
13
|
-
<a href="https://github.com/launchql/pgsql-parser/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
|
|
14
|
-
<a href="https://www.npmjs.com/package/pgsql-deparser"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/pgsql-parser?filename=packages%2Fdeparser%2Fpackage.json"/></a>
|
|
15
|
-
</p>
|
|
16
|
-
|
|
17
|
-
`pgsql-deparser` is the lightning-fast, pure TypeScript solution for converting PostgreSQL ASTs back into SQL queries. Perfect companion to [`pgsql-parser`](https://github.com/launchql/pgsql-parser), this focused tool delivers SQL generation without any native dependencies or WebAssembly overhead.
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npm install pgsql-deparser
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Features
|
|
26
|
-
|
|
27
|
-
* ⚡ **Pure TypeScript Performance** – Zero runtime dependencies, no WASM, no compilation - just blazing fast SQL generation
|
|
28
|
-
* 🪶 **Ultra Lightweight** – Minimal footprint with laser-focused functionality for AST-to-SQL conversion only
|
|
29
|
-
* 🧪 **Battle-Tested Reliability** – Validated against 23,000+ SQL statements ensuring production-grade stability
|
|
30
|
-
* 🌍 **Universal Compatibility** – Runs anywhere JavaScript does - browsers, Node.js, edge functions, you name it
|
|
31
|
-
|
|
32
|
-
## Deparser Example
|
|
33
|
-
|
|
34
|
-
The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding the full parser's native dependencies. It's useful when only SQL string conversion from ASTs is needed, and is written in pure TypeScript for easy cross-environment deployment.
|
|
35
|
-
|
|
36
|
-
Here's how you can use the deparser in your TypeScript code, using [`@pgsql/utils`](https://github.com/launchql/pgsql-parser/tree/main/packages/utils) to create an AST for `deparse`:
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
import * as t from '@pgsql/utils';
|
|
40
|
-
import { RangeVar, SelectStmt } from '@pgsql/types';
|
|
41
|
-
import { deparseSync as deparse } from 'pgsql-deparser';
|
|
42
|
-
|
|
43
|
-
// This could have been obtained from any JSON or AST, not necessarily @pgsql/utils
|
|
44
|
-
const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
|
|
45
|
-
targetList: [
|
|
46
|
-
t.nodes.resTarget({
|
|
47
|
-
val: t.nodes.columnRef({
|
|
48
|
-
fields: [t.nodes.aStar()]
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
],
|
|
52
|
-
fromClause: [
|
|
53
|
-
t.nodes.rangeVar({
|
|
54
|
-
relname: 'some_table',
|
|
55
|
-
inh: true,
|
|
56
|
-
relpersistence: 'p'
|
|
57
|
-
})
|
|
58
|
-
],
|
|
59
|
-
limitOption: 'LIMIT_OPTION_DEFAULT',
|
|
60
|
-
op: 'SETOP_NONE'
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Modify the AST if needed
|
|
64
|
-
(stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
|
|
65
|
-
|
|
66
|
-
// Deparse the modified AST back to a SQL string
|
|
67
|
-
console.log(deparse(stmt));
|
|
68
|
-
|
|
69
|
-
// Output: SELECT * FROM another_table
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Latest Version (PostgreSQL 17)
|
|
73
|
-
|
|
74
|
-
```sh
|
|
75
|
-
npm install pgsql-deparser
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Version-Specific Packages (PostgreSQL 13-16)
|
|
79
|
-
|
|
80
|
-
While we highly recommend using PG17, for PostgreSQL versions 13-16, use the version-specific packages:
|
|
81
|
-
|
|
82
|
-
```sh
|
|
83
|
-
npm install pgsql-deparser@v13 # PostgreSQL 13
|
|
84
|
-
npm install pgsql-deparser@v14 # PostgreSQL 14
|
|
85
|
-
npm install pgsql-deparser@v15 # PostgreSQL 15
|
|
86
|
-
npm install pgsql-deparser@v16 # PostgreSQL 16
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Options
|
|
90
|
-
|
|
91
|
-
The deparser accepts optional configuration for formatting and output control:
|
|
92
|
-
|
|
93
|
-
```ts
|
|
94
|
-
import { deparseSync as deparse } from 'pgsql-deparser';
|
|
95
|
-
|
|
96
|
-
const options = {
|
|
97
|
-
pretty: true, // Enable pretty formatting (default: false)
|
|
98
|
-
newline: '\n', // Newline character (default: '\n')
|
|
99
|
-
tab: ' ', // Tab/indentation character (default: ' ')
|
|
100
|
-
semicolons: true // Add semicolons to statements (default: true)
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const sql = deparse(ast, options);
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
| Option | Type | Default | Description |
|
|
107
|
-
|--------|------|---------|-------------|
|
|
108
|
-
| `pretty` | `boolean` | `false` | Enable pretty formatting with indentation and line breaks |
|
|
109
|
-
| `newline` | `string` | `'\n'` | Character(s) used for line breaks |
|
|
110
|
-
| `tab` | `string` | `' '` | Character(s) used for indentation |
|
|
111
|
-
| `semicolons` | `boolean` | `true` | Add semicolons to SQL statements |
|
|
112
|
-
|
|
113
|
-
**Pretty formatting example:**
|
|
114
|
-
```ts
|
|
115
|
-
// Without pretty formatting
|
|
116
|
-
const sql1 = deparse(selectAst, { pretty: false });
|
|
117
|
-
// "SELECT id, name FROM users WHERE active = true;"
|
|
118
|
-
|
|
119
|
-
// With pretty formatting
|
|
120
|
-
const sql2 = deparse(selectAst, { pretty: true });
|
|
121
|
-
// SELECT
|
|
122
|
-
// id,
|
|
123
|
-
// name
|
|
124
|
-
// FROM users
|
|
125
|
-
// WHERE
|
|
126
|
-
// active = true;
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
For complete documentation and advanced options, see [DEPARSER_USAGE.md](../../DEPARSER_USAGE.md).
|
|
130
|
-
|
|
131
|
-
## Why Use `pgsql-deparser`?
|
|
132
|
-
|
|
133
|
-
`pgsql-deparser` is particularly useful in development environments where native dependencies are problematic or in applications where only the deparser functionality is required. Its independence from the full `pgsql-parser` package allows for more focused and lightweight SQL generation tasks.
|
|
134
|
-
|
|
135
|
-
## Credits
|
|
136
|
-
|
|
137
|
-
Built on the excellent work of several contributors:
|
|
138
|
-
|
|
139
|
-
* **[Dan Lynch](https://github.com/pyramation)** — official maintainer since 2018 and architect of the current implementation
|
|
140
|
-
* **[Lukas Fittl](https://github.com/lfittl)** for [libpg_query](https://github.com/pganalyze/libpg_query) — the core PostgreSQL parser that powers this project
|
|
141
|
-
* **[Greg Richardson](https://github.com/gregnr)** for AST guidance and pushing the transition to WASM and multiple PG runtimes for better interoperability
|
|
142
|
-
* **[Ethan Resnick](https://github.com/ethanresnick)** for the original Node.js N-API bindings
|
|
143
|
-
* **[Zac McCormick](https://github.com/zhm)** for the foundational [node-pg-query-native](https://github.com/zhm/node-pg-query-native) parser
|
|
144
|
-
|
|
145
|
-
## Related
|
|
146
|
-
|
|
147
|
-
* [pgsql-parser](https://www.npmjs.com/package/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
|
|
148
|
-
* [pgsql-deparser](https://www.npmjs.com/package/pgsql-deparser): A streamlined tool designed for converting PostgreSQL ASTs back into SQL queries, focusing solely on deparser functionality to complement `pgsql-parser`.
|
|
149
|
-
* [@pgsql/parser](https://www.npmjs.com/package/@pgsql/parser): Multi-version PostgreSQL parser with dynamic version selection at runtime, supporting PostgreSQL 15, 16, and 17 in a single package.
|
|
150
|
-
* [@pgsql/types](https://www.npmjs.com/package/@pgsql/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
|
|
151
|
-
* [@pgsql/enums](https://www.npmjs.com/package/@pgsql/enums): Provides TypeScript enum definitions for PostgreSQL constants, enabling type-safe usage of PostgreSQL enums and constants in your applications.
|
|
152
|
-
* [@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): A comprehensive utility library for PostgreSQL, offering type-safe AST node creation and enum value conversions, simplifying the construction and manipulation of PostgreSQL ASTs.
|
|
153
|
-
* [pg-proto-parser](https://www.npmjs.com/package/pg-proto-parser): A TypeScript tool that parses PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
|
|
154
|
-
* [libpg-query](https://github.com/launchql/libpg-query-node): The real PostgreSQL parser exposed for Node.js, used primarily in `pgsql-parser` for parsing and deparsing SQL queries.
|
|
155
|
-
|
|
156
|
-
## Disclaimer
|
|
157
|
-
|
|
158
|
-
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
159
|
-
|
|
160
|
-
No developer or entity involved in creating Software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Software code or Software CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
|