pgsql-deparser 17.15.1 → 17.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 +3 -0
- package/deparser.js +16 -4
- package/esm/deparser.js +16 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -153,6 +153,9 @@ Built on the excellent work of several contributors:
|
|
|
153
153
|
|
|
154
154
|
## Related
|
|
155
155
|
|
|
156
|
+
* [pgpm](https://pgpm.dev): A Postgres Package Manager that brings modular development to PostgreSQL with reusable packages, deterministic migrations, recursive dependency resolution, and tag-aware versioning.
|
|
157
|
+
* [pgsql-test](https://www.npmjs.com/package/pgsql-test): Instant, isolated PostgreSQL databases for each test with automatic transaction rollbacks, context switching, and clean seeding for fast, reliable database testing.
|
|
158
|
+
* [pgsql-seed](https://www.npmjs.com/package/pgsql-seed): PostgreSQL seeding utilities for CSV, JSON, SQL data loading, and pgpm deployment.
|
|
156
159
|
* [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.
|
|
157
160
|
* [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`.
|
|
158
161
|
* [@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.
|
package/deparser.js
CHANGED
|
@@ -5170,7 +5170,13 @@ class Deparser {
|
|
|
5170
5170
|
})
|
|
5171
5171
|
.map((param) => this.visit(param, context));
|
|
5172
5172
|
if (params.length > 0) {
|
|
5173
|
-
|
|
5173
|
+
if (context.isPretty()) {
|
|
5174
|
+
const formattedParams = params.map(p => context.indent(p)).join(',' + context.newline());
|
|
5175
|
+
output.push(funcName + '(' + context.newline() + formattedParams + context.newline() + ')');
|
|
5176
|
+
}
|
|
5177
|
+
else {
|
|
5178
|
+
output.push(funcName + '(' + params.join(', ') + ')');
|
|
5179
|
+
}
|
|
5174
5180
|
}
|
|
5175
5181
|
else {
|
|
5176
5182
|
output.push(funcName + '()');
|
|
@@ -5185,15 +5191,21 @@ class Deparser {
|
|
|
5185
5191
|
return paramData.mode === 'FUNC_PARAM_TABLE';
|
|
5186
5192
|
});
|
|
5187
5193
|
if (hasTableParams) {
|
|
5188
|
-
output.push('RETURNS TABLE (');
|
|
5189
5194
|
const tableParams = node.parameters
|
|
5190
5195
|
.filter((param) => {
|
|
5191
5196
|
const paramData = this.getNodeData(param);
|
|
5192
5197
|
return paramData.mode === 'FUNC_PARAM_TABLE';
|
|
5193
5198
|
})
|
|
5194
5199
|
.map((param) => this.visit(param, context));
|
|
5195
|
-
|
|
5196
|
-
|
|
5200
|
+
if (context.isPretty()) {
|
|
5201
|
+
const formattedTableParams = tableParams.map(p => context.indent(p)).join(',' + context.newline());
|
|
5202
|
+
output.push('RETURNS TABLE (' + context.newline() + formattedTableParams + context.newline() + ')');
|
|
5203
|
+
}
|
|
5204
|
+
else {
|
|
5205
|
+
output.push('RETURNS TABLE (');
|
|
5206
|
+
output.push(tableParams.join(', '));
|
|
5207
|
+
output.push(')');
|
|
5208
|
+
}
|
|
5197
5209
|
}
|
|
5198
5210
|
else if (node.returnType) {
|
|
5199
5211
|
output.push('RETURNS');
|
package/esm/deparser.js
CHANGED
|
@@ -5167,7 +5167,13 @@ export class Deparser {
|
|
|
5167
5167
|
})
|
|
5168
5168
|
.map((param) => this.visit(param, context));
|
|
5169
5169
|
if (params.length > 0) {
|
|
5170
|
-
|
|
5170
|
+
if (context.isPretty()) {
|
|
5171
|
+
const formattedParams = params.map(p => context.indent(p)).join(',' + context.newline());
|
|
5172
|
+
output.push(funcName + '(' + context.newline() + formattedParams + context.newline() + ')');
|
|
5173
|
+
}
|
|
5174
|
+
else {
|
|
5175
|
+
output.push(funcName + '(' + params.join(', ') + ')');
|
|
5176
|
+
}
|
|
5171
5177
|
}
|
|
5172
5178
|
else {
|
|
5173
5179
|
output.push(funcName + '()');
|
|
@@ -5182,15 +5188,21 @@ export class Deparser {
|
|
|
5182
5188
|
return paramData.mode === 'FUNC_PARAM_TABLE';
|
|
5183
5189
|
});
|
|
5184
5190
|
if (hasTableParams) {
|
|
5185
|
-
output.push('RETURNS TABLE (');
|
|
5186
5191
|
const tableParams = node.parameters
|
|
5187
5192
|
.filter((param) => {
|
|
5188
5193
|
const paramData = this.getNodeData(param);
|
|
5189
5194
|
return paramData.mode === 'FUNC_PARAM_TABLE';
|
|
5190
5195
|
})
|
|
5191
5196
|
.map((param) => this.visit(param, context));
|
|
5192
|
-
|
|
5193
|
-
|
|
5197
|
+
if (context.isPretty()) {
|
|
5198
|
+
const formattedTableParams = tableParams.map(p => context.indent(p)).join(',' + context.newline());
|
|
5199
|
+
output.push('RETURNS TABLE (' + context.newline() + formattedTableParams + context.newline() + ')');
|
|
5200
|
+
}
|
|
5201
|
+
else {
|
|
5202
|
+
output.push('RETURNS TABLE (');
|
|
5203
|
+
output.push(tableParams.join(', '));
|
|
5204
|
+
output.push(')');
|
|
5205
|
+
}
|
|
5194
5206
|
}
|
|
5195
5207
|
else if (node.returnType) {
|
|
5196
5208
|
output.push('RETURNS');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgsql-deparser",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.16.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PostgreSQL AST Deparser",
|
|
6
6
|
"main": "index.js",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@pgsql/types": "^17.6.2"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "a1fd1b05dfdf557fad8d5c7d952754353b01e9b6"
|
|
64
64
|
}
|