diff --git a/README.md b/README.md
index 21c7df23..9fa490cc 100644
--- a/README.md
+++ b/README.md
@@ -97,20 +97,21 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
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`:
```ts
-import ast from '@pgsql/utils';
-import { deparse } from 'pgsql-deparser';
+import * as t from '@pgsql/utils';
+import { RangeVar, SelectStmt } from '@pgsql/types';
+import { deparseSync as deparse } from 'pgsql-deparser';
// This could have been obtained from any JSON or AST, not necessarily @pgsql/utils
-const stmt = ast.selectStmt({
+const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
targetList: [
- ast.resTarget({
- val: ast.columnRef({
- fields: [ast.aStar()]
+ t.nodes.resTarget({
+ val: t.nodes.columnRef({
+ fields: [t.nodes.aStar()]
})
})
],
fromClause: [
- ast.rangeVar({
+ t.nodes.rangeVar({
relname: 'some_table',
inh: true,
relpersistence: 'p'
@@ -120,11 +121,11 @@ const stmt = ast.selectStmt({
op: 'SETOP_NONE'
});
-// Modify the AST if needed
-stmt.SelectStmt.fromClause[0].RangeVar.relname = 'another_table';
+// Modify the AST if needed
+(stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
// Deparse the modified AST back to a SQL string
-console.log(deparse(stmts));
+console.log(deparse(stmt));
// Output: SELECT * FROM another_table
```
diff --git a/packages/deparser/README.md b/packages/deparser/README.md
index 4bc754b7..98b1f9e6 100644
--- a/packages/deparser/README.md
+++ b/packages/deparser/README.md
@@ -14,7 +14,7 @@
-`pgsql-deparser` is a streamlined tool designed to convert PostgreSQL Abstract Syntax Trees (AST) back into SQL queries. It is a companion module to [`pgsql-parser`](https://github.com/launchql/pgsql-parser), which is capable of both parsing SQL queries into ASTs and deparsing these ASTs back into SQL. However, unlike `pgsql-parser`, which incorporates the full PostgreSQL parser, `pgsql-deparser` focuses solely on the deparser functionality. This makes it an excellent choice for scenarios where only AST-to-SQL conversion is needed, avoiding the extra overhead associated with the full parsing capabilities.
+`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.
## Installation
@@ -22,11 +22,12 @@
npm install pgsql-deparser
```
-## Key Features
+## Features
-- **Lightweight and Pure TypeScript**: Built entirely in TypeScript, `pgsql-deparser` is lightweight and doesn't rely on native dependencies, facilitating easier integration and deployment across various environments.
-- **Focused Functionality**: By concentrating on decompiling ASTs to SQL, `pgsql-deparser` offers a specialized, efficient solution for those who need to generate SQL statements from ASTs without the full parsing mechanism.
-- **Compatibility**: Ideal for use cases where the AST is already obtained from another source or process, allowing for seamless SQL generation from AST representations.
+* β‘ **Pure TypeScript Performance** β Zero dependencies, no WASM, no compilation - just blazing fast SQL generation
+* πͺΆ **Ultra Lightweight** β Minimal footprint with laser-focused functionality for AST-to-SQL conversion only
+* π§ͺ **Battle-Tested Reliability** β Validated against 23,000+ SQL statements ensuring production-grade stability
+* π **Universal Compatibility** β Runs anywhere JavaScript does - browsers, Node.js, edge functions, you name it
## Deparser Example
@@ -35,20 +36,21 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
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`:
```ts
-import ast, { SelectStmt } from '@pgsql/utils';
-import { deparse } from 'pgsql-deparser';
+import * as t from '@pgsql/utils';
+import { RangeVar, SelectStmt } from '@pgsql/types';
+import { deparseSync as deparse } from 'pgsql-deparser';
// This could have been obtained from any JSON or AST, not necessarily @pgsql/utils
-const stmt: SelectStmt = ast.selectStmt({
+const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
targetList: [
- ast.resTarget({
- val: ast.columnRef({
- fields: [ast.aStar()]
+ t.nodes.resTarget({
+ val: t.nodes.columnRef({
+ fields: [t.nodes.aStar()]
})
})
],
fromClause: [
- ast.rangeVar({
+ t.nodes.rangeVar({
relname: 'some_table',
inh: true,
relpersistence: 'p'
@@ -58,11 +60,11 @@ const stmt: SelectStmt = ast.selectStmt({
op: 'SETOP_NONE'
});
-// Modify the AST if needed
-stmt.SelectStmt.fromClause[0].RangeVar.relname = 'another_table';
+// Modify the AST if needed
+(stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
// Deparse the modified AST back to a SQL string
-console.log(deparse(stmts));
+console.log(deparse(stmt));
// Output: SELECT * FROM another_table
```
@@ -75,43 +77,41 @@ console.log(deparse(stmts));
As of PG 13, PG majors versions maintained will have a matching dedicated major npm version. Only the latest Postgres stable release receives active updates.
-Our latest is built with `13-latest` branch from libpg_query
+Our latest is built with `17-latest` branch from libpg_query
-| PostgreSQL Major Version | libpg_query | Status | npm
+| PostgreSQL Major Version | libpg_query | Status | npm tag |
|--------------------------|-------------|---------------------|---------|
-| 13 | 13-latest | Active development | `latest`
+| 17 | 17-latest | Active Development | `latest` |
+| 16 | (n/a) | Not supported |
+| 15 | (n/a) | Not supported |
+| 14 | (n/a) | Not supported |
+| 13 | 13-latest | Only Critical Fixes | `13.16.0` |
| 12 | (n/a) | Not supported |
| 11 | (n/a) | Not supported |
| 10 | 10-latest | Not supported | `@1.3.1` ([tree](https://github.com/launchql/pgsql-parser/tree/39b7b1adc8914253226e286a48105785219a81ca)) |
+## Credits
-## Related
-
-* [pgsql-parser](https://github.com/launchql/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
-* [pgsql-deparser](https://github.com/launchql/pgsql-parser/tree/main/packages/deparser): A streamlined tool designed for converting PostgreSQL ASTs back into SQL queries, focusing solely on deparser functionality to complement `pgsql-parser`.
-* [pgsql-enums](https://github.com/launchql/pgsql-parser/tree/main/packages/pgsql-enums): A utility package offering easy access to PostgreSQL enumeration types in JSON format, aiding in string and integer conversions of enums used within ASTs to compliment `pgsql-parser`
-* [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): Provides PostgreSQL AST enums in TypeScript, enhancing type safety and usability in projects interacting with PostgreSQL AST nodes.
-* [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
-* [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/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.
-* [pg-proto-parser](https://github.com/launchql/pg-proto-parser): A TypeScript tool that parses PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
-* [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.
-
-Thanks [@lfittl](https://github.com/lfittl) for building the core `libpg_query` suite:
-
-* [libpg_query](https://github.com/pganalyze/libpg_query)
-* [pg_query](https://github.com/lfittl/pg_query)
-* [pg_query.go](https://github.com/lfittl/pg_query.go)
+Built on the excellent work of several contributors:
-## Credits
+* **[Dan Lynch](https://github.com/pyramation)** β official maintainer since 2018 and architect of the current implementation
+* **[Lukas Fittl](https://github.com/lfittl)** for [libpg_query](https://github.com/pganalyze/libpg_query) β the core PostgreSQL parser that powers this project
+* **[Greg Richardson](https://github.com/gregnr)** for AST guidance and pushing the transition to WASM for better interoperability
+* **[Ethan Resnick](https://github.com/ethanresnick)** for the original Node.js N-API bindings
+* **[Zac McCormick](https://github.com/zhm)** for the foundational [node-pg-query-native](https://github.com/zhm/node-pg-query-native) parser
-Thanks to [@zhm](https://github.com/zhm) for the OG parser that started it all:
+## Related
-* [pg-query-parser](https://github.com/zhm/pg-query-parser)
-* [pg-query-native](https://github.com/zhm/node-pg-query-native)
-* [Original LICENSE](https://github.com/zhm/pg-query-parser/blob/master/LICENSE.md)
+* [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.
+* [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`.
+* [@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.
+* [@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.
+* [@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.
+* [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.
+* [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.
## Disclaimer
-AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED βAS ISβ, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
+AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
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.
\ No newline at end of file
diff --git a/packages/deparser/package.json b/packages/deparser/package.json
index 6d302d5a..eaf5aa7f 100644
--- a/packages/deparser/package.json
+++ b/packages/deparser/package.json
@@ -46,9 +46,9 @@
"database"
],
"devDependencies": {
- "libpg-query": "17.3.3"
+ "libpg-query": "17.5.2"
},
"dependencies": {
- "@pgsql/types": "^17.5.3"
+ "@pgsql/types": "^17.6.1"
}
}
diff --git a/packages/deparser/src/index.ts b/packages/deparser/src/index.ts
index 0720c096..dba098cc 100644
--- a/packages/deparser/src/index.ts
+++ b/packages/deparser/src/index.ts
@@ -1,4 +1,13 @@
import { Deparser, DeparserOptions } from "./deparser";
-const deparse = Deparser.deparse;
-export { deparse, Deparser, DeparserOptions };
+const deparseMethod = Deparser.deparse;
+
+// Export the original sync version as deparseSync
+export const deparseSync = deparseMethod;
+
+// Create an async wrapper for deparse
+export const deparse = async (...args: Parameters): Promise> => {
+ return deparseMethod(...args);
+};
+
+export { Deparser, DeparserOptions };
\ No newline at end of file
diff --git a/packages/deparser/test-utils/index.ts b/packages/deparser/test-utils/index.ts
index 9c9392e0..6efb4b4e 100644
--- a/packages/deparser/test-utils/index.ts
+++ b/packages/deparser/test-utils/index.ts
@@ -1,10 +1,10 @@
import { parse } from 'libpg-query';
-import { deparse } from '../src';
+import { deparseSync as deparse } from '../src';
import { cleanTree } from '../src/utils';
import { readFileSync } from 'fs';
import * as path from 'path';
import { expect } from '@jest/globals';
-import {diff} from 'jest-diff'
+import { diff } from 'jest-diff'
type ParseErrorType =
| 'PARSE_FAILED'
diff --git a/packages/parser/README.md b/packages/parser/README.md
index 21c7df23..11428456 100644
--- a/packages/parser/README.md
+++ b/packages/parser/README.md
@@ -14,7 +14,7 @@
-The real PostgreSQL parser for Node.js, `pgsql-parser` provides symmetric parsing and deparsing of SQL statements using the actual [PostgreSQL parser](https://github.com/pganalyze/libpg_query). It allows you to parse SQL queries into AST and modify or reconstruct SQL queries from the AST.
+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.
## Installation
@@ -22,38 +22,30 @@ The real PostgreSQL parser for Node.js, `pgsql-parser` provides symmetric parsin
npm install pgsql-parser
```
-## Key Features
+## Features
-- **True PostgreSQL Parsing:** Utilizes the real PostgreSQL source code for accurate parsing.
-- **Symmetric Parsing and Deparsing:** Convert SQL to AST and back, enabling query manipulation.
-- **AST Manipulation:** Easily modify parts of a SQL statement through the AST.
-- **WebAssembly Powered:** Cross-platform compatibility without native dependencies.
+* π **Symmetric Parsing & Deparsing** β Parse SQL to AST and reconstruct it back to SQL with perfect round-trip accuracy
+* π§ͺ **Battle-Tested Reliability** β Validated against 23,000+ SQL statements ensuring production-grade stability
+* π§ **Direct from PostgreSQL** β Uses the official Postgres C parser compiled to WebAssembly for 100% spec compliance
+* π **WebAssembly Powered:** - Cross-platform compatibility without native dependencies.
+* π οΈ **AST Manipulation:** - Easily modify parts of a SQL statement through the AST.
## API
The package exports both async and sync methods. Async methods handle initialization automatically, while sync methods require explicit initialization.
-β οΈ We recommend using `@pgsql/deparser` instead of `deparse` from `pgsql-parser`. The deparser package is more complete, supports sub-expressions, and doesn't require the WebAssembly module, making it lighter and more flexible for most use cases. It will soon be deprecated, in a minor version bump.
+β οΈ If you don't need the parser functionality, consider using the TS-only (no WASM, zero dependencies) [`pgsql-deparser`](https://github.com/launchql/pgsql-parser/tree/main/packages/deparser) for a super fast, lightweight deparser. Battle-tested with 23,000+ SQL statements π
### Async Methods (Recommended)
```typescript
-import { parse, deparse, parseFunction } from 'pgsql-parser';
+import { parse, deparse } from 'pgsql-parser';
// Parse SQL to AST
const stmts = await parse('SELECT * FROM test_table');
// Deparse AST back to SQL
const sql = await deparse(stmts);
-
-// Parse PL/pgSQL functions
-const funcAst = await parseFunction(`
- CREATE FUNCTION get_count() RETURNS integer AS $$
- BEGIN
- RETURN (SELECT COUNT(*) FROM users);
- END;
- $$ LANGUAGE plpgsql;
-`);
```
### Sync Methods
@@ -97,20 +89,21 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
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`:
```ts
-import ast from '@pgsql/utils';
-import { deparse } from 'pgsql-deparser';
+import * as t from '@pgsql/utils';
+import { RangeVar, SelectStmt } from '@pgsql/types';
+import { deparseSync as deparse } from 'pgsql-deparser';
// This could have been obtained from any JSON or AST, not necessarily @pgsql/utils
-const stmt = ast.selectStmt({
+const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
targetList: [
- ast.resTarget({
- val: ast.columnRef({
- fields: [ast.aStar()]
+ t.nodes.resTarget({
+ val: t.nodes.columnRef({
+ fields: [t.nodes.aStar()]
})
})
],
fromClause: [
- ast.rangeVar({
+ t.nodes.rangeVar({
relname: 'some_table',
inh: true,
relpersistence: 'p'
@@ -120,11 +113,11 @@ const stmt = ast.selectStmt({
op: 'SETOP_NONE'
});
-// Modify the AST if needed
-stmt.SelectStmt.fromClause[0].RangeVar.relname = 'another_table';
+// Modify the AST if needed
+(stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
// Deparse the modified AST back to a SQL string
-console.log(deparse(stmts));
+console.log(deparse(stmt));
// Output: SELECT * FROM another_table
```
@@ -158,27 +151,25 @@ Our latest is built with `17-latest` branch from libpg_query
| 11 | (n/a) | Not supported |
| 10 | 10-latest | Not supported | `@1.3.1` ([tree](https://github.com/launchql/pgsql-parser/tree/39b7b1adc8914253226e286a48105785219a81ca)) |
-
-## Related
-
-* [pgsql-parser](https://github.com/launchql/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
-* [pgsql-deparser](https://github.com/launchql/pgsql-parser/tree/main/packages/deparser): A streamlined tool designed for converting PostgreSQL ASTs back into SQL queries, focusing solely on deparser functionality to complement `pgsql-parser`.
-* [pgsql-enums](https://github.com/launchql/pgsql-parser/tree/main/packages/pgsql-enums): A utility package offering easy access to PostgreSQL enumeration types in JSON format, aiding in string and integer conversions of enums used within ASTs to compliment `pgsql-parser`
-* [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): Provides PostgreSQL AST enums in TypeScript, enhancing type safety and usability in projects interacting with PostgreSQL AST nodes.
-* [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
-* [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/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.
-* [pg-proto-parser](https://github.com/launchql/pg-proto-parser): A TypeScript tool that parses PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
-* [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.
-
## Credits
-Thanks [@lfittl](https://github.com/lfittl) for building the core `libpg_query` suite:
+Built on the excellent work of several contributors:
-* [libpg_query](https://github.com/pganalyze/libpg_query)
-* [pg_query](https://github.com/lfittl/pg_query)
-* [pg_query.go](https://github.com/lfittl/pg_query.go)
+* **[Dan Lynch](https://github.com/pyramation)** β official maintainer since 2018 and architect of the current implementation
+* **[Lukas Fittl](https://github.com/lfittl)** for [libpg_query](https://github.com/pganalyze/libpg_query) β the core PostgreSQL parser that powers this project
+* **[Greg Richardson](https://github.com/gregnr)** for AST guidance and pushing the transition to WASM for better interoperability
+* **[Ethan Resnick](https://github.com/ethanresnick)** for the original Node.js N-API bindings
+* **[Zac McCormick](https://github.com/zhm)** for the foundational [node-pg-query-native](https://github.com/zhm/node-pg-query-native) parser
-Thanks to [@zhm](https://github.com/zhm) for the [OG Parser](https://github.com/zhm/pg-query-parser/blob/master/LICENSE.md) that started it all.
+## Related
+
+* [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.
+* [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`.
+* [@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.
+* [@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.
+* [@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.
+* [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.
+* [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.
## Disclaimer
diff --git a/packages/parser/package.json b/packages/parser/package.json
index 32ab9845..89fea750 100644
--- a/packages/parser/package.json
+++ b/packages/parser/package.json
@@ -42,8 +42,9 @@
"database"
],
"dependencies": {
- "@pgsql/types": "^17.5.3",
- "libpg-query": "17.3.3",
+ "@pgsql/types": "^17.6.1",
+ "libpg-query": "17.5.2",
+ "pgsql-deparser": "^17.6.2",
"minimist": "^1.2.6"
}
}
diff --git a/packages/parser/src/index.ts b/packages/parser/src/index.ts
index ee38816f..056fce41 100644
--- a/packages/parser/src/index.ts
+++ b/packages/parser/src/index.ts
@@ -1,8 +1,7 @@
export {
parse as parse,
parseSync as parseSync,
- parsePlPgSQL as parseFunction,
- deparseSync as deparseSync,
- deparse as deparse,
loadModule as loadModule
} from 'libpg-query';
+
+export { deparse, deparseSync } from 'pgsql-deparser';
diff --git a/packages/proto-parser/README.md b/packages/proto-parser/README.md
index 101dd0d2..8ca3a028 100644
--- a/packages/proto-parser/README.md
+++ b/packages/proto-parser/README.md
@@ -11,7 +11,6 @@
-
`pg-proto-parser` is a TypeScript project that parses [pganalyze/libpg_query](https://github.com/pganalyze/libpg_query) PostgreSQL Protocol Buffers (protobuf) definitions and generates TypeScript interfaces, utility functions, and JSON mappings for the enums defined in the protobuf schema. Designed to work with [launchql/pgsql-parser](https://github.com/launchql/pgsql-parser) for maintainable upgrades.
## Features
@@ -318,14 +317,16 @@ ast.selectStmt({
## Related
-* [launchql/pgsql-parser](https://github.com/launchql/pgsql-parser): A node.js PostgreSQL parser/deparser that interprets and converts PostgresSQL syntax.
-* [launchql/libpg-query-node](https://github.com/launchql/libpg-query-node): Node.js bindings for the libpg_query library, allowing parsing of PostgreSQL queries into parse trees.
-* [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): Provides PostgreSQL AST enums in TypeScript, enhancing type safety and usability in projects interacting with PostgreSQL AST nodes.
-* [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
-* [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/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.
+* [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.
+* [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`.
+* [@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.
+* [@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.
+* [@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.
+* [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.
+* [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.
## Disclaimer
-AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED βAS ISβ, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
+AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
-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.
+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.
\ No newline at end of file
diff --git a/packages/transform/README.md b/packages/transform/README.md
index 340f0ed6..c5af6ec2 100644
--- a/packages/transform/README.md
+++ b/packages/transform/README.md
@@ -16,6 +16,18 @@
`@pgsql/types` is a TypeScript library providing type definitions for PostgreSQL AST nodes, primarily used in conjunction with [`pgsql-parser`](https://github.com/launchql/pgsql-parser). It offers a comprehensive and type-safe way to interact with the AST nodes generated by PostgreSQL query parsing.
+## Related
+* [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.
+* [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`.
+* [@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.
+* [@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.
+* [@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.
+* [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.
+* [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.
-TODO
\ No newline at end of file
+## Disclaimer
+
+AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
+
+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.
\ No newline at end of file
diff --git a/packages/utils/README.md b/packages/utils/README.md
index f85b03bf..e6961f50 100644
--- a/packages/utils/README.md
+++ b/packages/utils/README.md
@@ -211,17 +211,16 @@ console.log(enumName); // Outputs 'SORTBY_ASC' if 1 corresponds to 'SORTBY_ASC'
## Related
-* [pgsql-parser](https://github.com/launchql/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
-* [pgsql-deparser](https://github.com/launchql/pgsql-parser/tree/main/packages/deparser): A streamlined tool designed for converting PostgreSQL ASTs back into SQL queries, focusing solely on deparser functionality to complement `pgsql-parser`.
-* [pgsql-enums](https://github.com/launchql/pgsql-parser/tree/main/packages/pgsql-enums): A utility package offering easy access to PostgreSQL enumeration types in JSON format, aiding in string and integer conversions of enums used within ASTs to compliment `pgsql-parser`
-* [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): Provides PostgreSQL AST enums in TypeScript, enhancing type safety and usability in projects interacting with PostgreSQL AST nodes.
-* [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
-* [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/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.
-* [pg-proto-parser](https://github.com/launchql/pg-proto-parser): A TypeScript tool that parses PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
+* [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.
+* [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`.
+* [@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.
+* [@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.
+* [@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.
+* [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.
* [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.
## Disclaimer
-AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED βAS ISβ, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
+AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
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.
\ No newline at end of file
diff --git a/packages/utils/__test__/utils.test.ts b/packages/utils/__test__/utils.test.ts
index 1957e7d9..1120ec86 100644
--- a/packages/utils/__test__/utils.test.ts
+++ b/packages/utils/__test__/utils.test.ts
@@ -1,6 +1,6 @@
import * as t from '../src';
import { RangeVar, SelectStmt } from '@pgsql/types';
-import { deparse } from 'pgsql-deparser';
+import { deparseSync as deparse } from 'pgsql-deparser';
it('simple SelectStmt', () => {
const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
@@ -25,7 +25,7 @@ it('simple SelectStmt', () => {
(stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
expect(stmt).toMatchSnapshot();
- expect(deparse(stmt, {})).toMatchSnapshot();
+ expect(deparse(stmt)).toMatchSnapshot();
});
it('SelectStmt with WHERE clause', () => {
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 9ae42769..528d1733 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -35,7 +35,7 @@
"pgsql-deparser": "^17.6.2"
},
"dependencies": {
- "@pgsql/types": "^17.5.3",
+ "@pgsql/types": "^17.6.1",
"nested-obj": "0.0.1"
},
"keywords": []
diff --git a/yarn.lock b/yarn.lock
index 6963969a..40c5b366 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1227,10 +1227,10 @@
node-addon-api "^3.2.1"
node-gyp-build "^4.3.0"
-"@pgsql/types@^17.0.0", "@pgsql/types@^17.5.3":
- version "17.5.3"
- resolved "https://registry.yarnpkg.com/@pgsql/types/-/types-17.5.3.tgz#b4a53ba71a1bf111de744d01fc49a4e1576f3e31"
- integrity sha512-lRPdKcipoKLoovXw6tVwg9gdqV1fIvfjzqFDY1UFsJa8I+/yaVrGWCtmE+CeWU5e+imXd7X3fTWs8N8bK3R+AQ==
+"@pgsql/types@^17.6.1":
+ version "17.6.1"
+ resolved "https://registry.yarnpkg.com/@pgsql/types/-/types-17.6.1.tgz#fcbe4910321bd0dfa38aa0c26d87eff7b098d0e9"
+ integrity sha512-Hk51+nyOxS7Dy5oySWywyNZxo5HndX1VDXT4ZEBD+p+vvMFM2Vc+sKSuByCiI8banou4edbgdnOC251IOuq7QQ==
"@pkgjs/parseargs@^0.11.0":
version "0.11.0"
@@ -4571,13 +4571,12 @@ libnpmpublish@7.1.4:
sigstore "^1.4.0"
ssri "^10.0.1"
-libpg-query@17.3.3:
- version "17.3.3"
- resolved "https://registry.yarnpkg.com/libpg-query/-/libpg-query-17.3.3.tgz#d48f7e58a48fbaf6080d09ce50ec965fe475d7d9"
- integrity sha512-xpz80GZqE+kM0hrvIjxm5TuLlmj502GZfDDwLcaPo/Rv/JuBPnG439j+nsL5+050kA/hBBRJ14kNshAxVwpSog==
+libpg-query@17.5.2:
+ version "17.5.2"
+ resolved "https://registry.yarnpkg.com/libpg-query/-/libpg-query-17.5.2.tgz#1d3663f482dc2fb253948a0d2d4bc3540b10d752"
+ integrity sha512-9VhuzWrWyZ6AalSCtF2+BDx/aHpp8JKLAsYa1qF77x7f+kJ5BxAXvdRYOduNNFqdwu67110eFpoBr6BtN4WH/A==
dependencies:
- "@launchql/protobufjs" "7.2.6"
- "@pgsql/types" "^17.0.0"
+ "@pgsql/types" "^17.6.1"
lines-and-columns@^1.1.6:
version "1.2.4"