pgsql-parser 16.0.0 → 16.1.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 +11 -8
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# pgsql-parser
|
|
2
2
|
|
|
3
3
|
<p align="center" width="100%">
|
|
4
|
-
<img height="120" src="https://github.com/
|
|
4
|
+
<img height="120" src="https://github.com/constructive-io/pgsql-parser/assets/545047/6440fa7d-918b-4a3b-8d1b-755d85de8bea" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center" width="100%">
|
|
8
|
-
<a href="https://github.com/
|
|
9
|
-
<img height="20" src="https://github.com/
|
|
8
|
+
<a href="https://github.com/constructive-io/pgsql-parser/actions/workflows/run-tests.yaml">
|
|
9
|
+
<img height="20" src="https://github.com/constructive-io/pgsql-parser/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/pgsql-parser"><img height="20" src="https://img.shields.io/npm/dt/pgsql-parser"></a>
|
|
12
12
|
<a href="https://www.npmjs.com/package/pgsql-parser"><img height="20" src="https://img.shields.io/npm/dw/pgsql-parser"/></a>
|
|
13
|
-
<a href="https://github.com/
|
|
14
|
-
<a href="https://www.npmjs.com/package/pgsql-parser"><img height="20" src="https://img.shields.io/github/package-json/v/
|
|
13
|
+
<a href="https://github.com/constructive-io/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-parser"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/pgsql-parser?filename=packages%2Fparser%2Fpackage.json"/></a>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
The real PostgreSQL parser for Node.js. Built with the actual [PostgreSQL parser](https://github.com/pganalyze/libpg_query), `pgsql-parser` delivers true-to-spec SQL parsing and reconstruction. Transform SQL queries into ASTs, modify them programmatically, and convert them back to SQL with complete fidelity.
|
|
@@ -34,7 +34,7 @@ npm install pgsql-parser
|
|
|
34
34
|
|
|
35
35
|
The package exports both async and sync methods. Async methods handle initialization automatically, while sync methods require explicit initialization.
|
|
36
36
|
|
|
37
|
-
⚠️ If you don't need the parser functionality, consider using the TS-only (no WASM, zero runtime dependencies) [`pgsql-deparser`](https://github.com/
|
|
37
|
+
⚠️ If you don't need the parser functionality, consider using the TS-only (no WASM, zero runtime dependencies) [`pgsql-deparser`](https://github.com/constructive-io/pgsql-parser/tree/main/packages/deparser) for a super fast, lightweight deparser. Battle-tested with 23,000+ SQL statements 🚀
|
|
38
38
|
|
|
39
39
|
### Async Methods (Recommended)
|
|
40
40
|
|
|
@@ -86,7 +86,7 @@ console.log(await deparse(stmts));
|
|
|
86
86
|
|
|
87
87
|
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.
|
|
88
88
|
|
|
89
|
-
Here's how you can use the deparser in your TypeScript code, using [`@pgsql/utils`](https://github.com/
|
|
89
|
+
Here's how you can use the deparser in your TypeScript code, using [`@pgsql/utils`](https://github.com/constructive-io/pgsql-parser/tree/main/packages/utils) to create an AST for `deparse`:
|
|
90
90
|
|
|
91
91
|
```ts
|
|
92
92
|
import * as t from '@pgsql/utils';
|
|
@@ -132,6 +132,8 @@ Built on the excellent work of several contributors:
|
|
|
132
132
|
* **[Ethan Resnick](https://github.com/ethanresnick)** for the original Node.js N-API bindings
|
|
133
133
|
* **[Zac McCormick](https://github.com/zhm)** for the foundational [node-pg-query-native](https://github.com/zhm/node-pg-query-native) parser
|
|
134
134
|
|
|
135
|
+
**🛠 Built by the [Constructive](https://constructive.io) team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on [GitHub](https://github.com/constructive-io).**
|
|
136
|
+
|
|
135
137
|
## Related
|
|
136
138
|
|
|
137
139
|
* [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.
|
|
@@ -140,8 +142,9 @@ Built on the excellent work of several contributors:
|
|
|
140
142
|
* [@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.
|
|
141
143
|
* [@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.
|
|
142
144
|
* [@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.
|
|
145
|
+
* [@pgsql/traverse](https://www.npmjs.com/package/@pgsql/traverse): PostgreSQL AST traversal utilities for pgsql-parser, providing a visitor pattern for traversing PostgreSQL Abstract Syntax Tree nodes, similar to Babel's traverse functionality but specifically designed for PostgreSQL AST structures.
|
|
143
146
|
* [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.
|
|
144
|
-
* [libpg-query](https://github.com/
|
|
147
|
+
* [libpg-query](https://github.com/constructive-io/libpg-query-node): The real PostgreSQL parser exposed for Node.js, used primarily in `pgsql-parser` for parsing and deparsing SQL queries.
|
|
145
148
|
|
|
146
149
|
## Disclaimer
|
|
147
150
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgsql-parser",
|
|
3
|
-
"version": "16.
|
|
4
|
-
"author": "
|
|
3
|
+
"version": "16.1.1",
|
|
4
|
+
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "The real PostgreSQL query parser",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "esm/index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
|
-
"homepage": "https://github.com/
|
|
9
|
+
"homepage": "https://github.com/constructive-io/pgsql-parser",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/constructive-io/pgsql-parser"
|
|
18
18
|
},
|
|
19
19
|
"bugs": {
|
|
20
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/constructive-io/pgsql-parser/issues"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"copy": "copyfiles -f ../../../../LICENSE README.md package.json dist",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@pgsql/types": "16.1.1",
|
|
39
|
-
"libpg-query": "16.
|
|
40
|
-
"pgsql-deparser": "16.
|
|
39
|
+
"libpg-query": "16.6.0",
|
|
40
|
+
"pgsql-deparser": "16.1.1"
|
|
41
41
|
}
|
|
42
42
|
}
|