pgsql-deparser 17.15.2 → 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/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
- output.push(funcName + '(' + params.join(', ') + ')');
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
- output.push(tableParams.join(', '));
5196
- output.push(')');
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
- output.push(funcName + '(' + params.join(', ') + ')');
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
- output.push(tableParams.join(', '));
5193
- output.push(')');
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.15.2",
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": "e5fdba1e3a67157bb5cab8ab40741f6f206d71b3"
63
+ "gitHead": "a1fd1b05dfdf557fad8d5c7d952754353b01e9b6"
64
64
  }