pgsql-deparser 13.14.0 → 13.16.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 +1 -1
- package/main/deparser.js +14 -0
- package/module/deparser.js +14 -0
- package/package.json +5 -5
- package/src/deparser.ts +14 -0
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ Our latest is built with `13-latest` branch from libpg_query
|
|
|
89
89
|
|
|
90
90
|
* [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.
|
|
91
91
|
* [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`.
|
|
92
|
-
* [pgsql-enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums
|
|
92
|
+
* [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`
|
|
93
93
|
* [@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.
|
|
94
94
|
* [@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.
|
|
95
95
|
* [@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.
|
package/main/deparser.js
CHANGED
|
@@ -1161,6 +1161,9 @@ class Deparser {
|
|
|
1161
1161
|
if (node.concurrent) {
|
|
1162
1162
|
output.push('CONCURRENTLY');
|
|
1163
1163
|
}
|
|
1164
|
+
if (node.if_not_exists) {
|
|
1165
|
+
output.push('IF NOT EXISTS');
|
|
1166
|
+
}
|
|
1164
1167
|
if (node.idxname) {
|
|
1165
1168
|
output.push(node.idxname);
|
|
1166
1169
|
}
|
|
@@ -1193,6 +1196,14 @@ class Deparser {
|
|
|
1193
1196
|
const output = [];
|
|
1194
1197
|
if (node.name) {
|
|
1195
1198
|
output.push(node.name);
|
|
1199
|
+
if (node.opclass && node.opclass.length) {
|
|
1200
|
+
output.push(this.deparse(node.opclass[0]));
|
|
1201
|
+
}
|
|
1202
|
+
if (node.opclassopts && node.opclassopts.length) {
|
|
1203
|
+
output.push('(');
|
|
1204
|
+
output.push(node.opclassopts.map((opclassopt) => this.deparse(opclassopt)).join(', '));
|
|
1205
|
+
output.push(')');
|
|
1206
|
+
}
|
|
1196
1207
|
if (node.ordering === 'SORTBY_DESC') {
|
|
1197
1208
|
output.push('DESC');
|
|
1198
1209
|
}
|
|
@@ -2027,6 +2038,9 @@ class Deparser {
|
|
|
2027
2038
|
const output = [];
|
|
2028
2039
|
output.push('DROP');
|
|
2029
2040
|
output.push((0, pgsql_enums_1.objtypeName)(node.removeType));
|
|
2041
|
+
if (node.concurrent) {
|
|
2042
|
+
output.push('CONCURRENTLY');
|
|
2043
|
+
}
|
|
2030
2044
|
if (node.missing_ok) {
|
|
2031
2045
|
output.push('IF EXISTS');
|
|
2032
2046
|
}
|
package/module/deparser.js
CHANGED
|
@@ -1159,6 +1159,9 @@ export default class Deparser {
|
|
|
1159
1159
|
if (node.concurrent) {
|
|
1160
1160
|
output.push('CONCURRENTLY');
|
|
1161
1161
|
}
|
|
1162
|
+
if (node.if_not_exists) {
|
|
1163
|
+
output.push('IF NOT EXISTS');
|
|
1164
|
+
}
|
|
1162
1165
|
if (node.idxname) {
|
|
1163
1166
|
output.push(node.idxname);
|
|
1164
1167
|
}
|
|
@@ -1191,6 +1194,14 @@ export default class Deparser {
|
|
|
1191
1194
|
const output = [];
|
|
1192
1195
|
if (node.name) {
|
|
1193
1196
|
output.push(node.name);
|
|
1197
|
+
if (node.opclass && node.opclass.length) {
|
|
1198
|
+
output.push(this.deparse(node.opclass[0]));
|
|
1199
|
+
}
|
|
1200
|
+
if (node.opclassopts && node.opclassopts.length) {
|
|
1201
|
+
output.push('(');
|
|
1202
|
+
output.push(node.opclassopts.map((opclassopt) => this.deparse(opclassopt)).join(', '));
|
|
1203
|
+
output.push(')');
|
|
1204
|
+
}
|
|
1194
1205
|
if (node.ordering === 'SORTBY_DESC') {
|
|
1195
1206
|
output.push('DESC');
|
|
1196
1207
|
}
|
|
@@ -2025,6 +2036,9 @@ export default class Deparser {
|
|
|
2025
2036
|
const output = [];
|
|
2026
2037
|
output.push('DROP');
|
|
2027
2038
|
output.push(objtypeName(node.removeType));
|
|
2039
|
+
if (node.concurrent) {
|
|
2040
|
+
output.push('CONCURRENTLY');
|
|
2041
|
+
}
|
|
2028
2042
|
if (node.missing_ok) {
|
|
2029
2043
|
output.push('IF EXISTS');
|
|
2030
2044
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgsql-deparser",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.16.0",
|
|
4
4
|
"description": "PostgreSQL AST Deparser",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/launchql/pgsql-parser",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"esprima": "4.0.1",
|
|
75
75
|
"glob": "8.0.3",
|
|
76
76
|
"jest": "^29.7.0",
|
|
77
|
-
"pgsql-parser": "^13.
|
|
77
|
+
"pgsql-parser": "^13.17.0",
|
|
78
78
|
"prettier": "^2.8.7",
|
|
79
79
|
"rimraf": "5.0.5",
|
|
80
80
|
"ts-jest": "^29.1.0",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"typescript": "^5.0.4"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@pgsql/types": "^13.
|
|
85
|
+
"@pgsql/types": "^13.10.0",
|
|
86
86
|
"dotty": "^0.1.0",
|
|
87
|
-
"pgsql-enums": "^13.
|
|
87
|
+
"pgsql-enums": "^13.11.0"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "85346892e652a57e570562fdac7a768545113619"
|
|
90
90
|
}
|
package/src/deparser.ts
CHANGED
|
@@ -1510,6 +1510,9 @@ export default class Deparser {
|
|
|
1510
1510
|
if (node.concurrent) {
|
|
1511
1511
|
output.push('CONCURRENTLY');
|
|
1512
1512
|
}
|
|
1513
|
+
if (node.if_not_exists) {
|
|
1514
|
+
output.push('IF NOT EXISTS');
|
|
1515
|
+
}
|
|
1513
1516
|
|
|
1514
1517
|
if (node.idxname) {
|
|
1515
1518
|
output.push(node.idxname);
|
|
@@ -1548,6 +1551,14 @@ export default class Deparser {
|
|
|
1548
1551
|
const output = [];
|
|
1549
1552
|
if (node.name) {
|
|
1550
1553
|
output.push(node.name);
|
|
1554
|
+
if (node.opclass && node.opclass.length) {
|
|
1555
|
+
output.push(this.deparse(node.opclass[0]));
|
|
1556
|
+
}
|
|
1557
|
+
if (node.opclassopts && node.opclassopts.length) {
|
|
1558
|
+
output.push('(');
|
|
1559
|
+
output.push(node.opclassopts.map((opclassopt) => this.deparse(opclassopt)).join(', '));
|
|
1560
|
+
output.push(')');
|
|
1561
|
+
}
|
|
1551
1562
|
if (node.ordering === 'SORTBY_DESC') {
|
|
1552
1563
|
output.push('DESC');
|
|
1553
1564
|
} else if (node.ordering === 'SORTBY_ASC') {
|
|
@@ -2525,6 +2536,9 @@ export default class Deparser {
|
|
|
2525
2536
|
const output = [];
|
|
2526
2537
|
output.push('DROP');
|
|
2527
2538
|
output.push(objtypeName(node.removeType));
|
|
2539
|
+
if (node.concurrent) {
|
|
2540
|
+
output.push('CONCURRENTLY');
|
|
2541
|
+
}
|
|
2528
2542
|
if (node.missing_ok) {
|
|
2529
2543
|
output.push('IF EXISTS');
|
|
2530
2544
|
}
|