neonctl 2.28.0 → 2.29.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.
Files changed (135) hide show
  1. package/README.md +2 -2
  2. package/dist/analytics.js +35 -33
  3. package/dist/api.js +34 -34
  4. package/dist/auth.js +50 -44
  5. package/dist/cli.js +2 -2
  6. package/dist/commands/auth.js +58 -52
  7. package/dist/commands/bootstrap.js +115 -157
  8. package/dist/commands/branches.js +154 -147
  9. package/dist/commands/bucket.js +124 -118
  10. package/dist/commands/checkout.js +49 -49
  11. package/dist/commands/config.js +212 -88
  12. package/dist/commands/connection_string.js +62 -62
  13. package/dist/commands/data_api.js +96 -96
  14. package/dist/commands/databases.js +23 -23
  15. package/dist/commands/deploy.js +12 -12
  16. package/dist/commands/dev.js +114 -114
  17. package/dist/commands/env.js +43 -43
  18. package/dist/commands/functions.js +97 -98
  19. package/dist/commands/index.js +26 -26
  20. package/dist/commands/init.js +23 -22
  21. package/dist/commands/ip_allow.js +29 -29
  22. package/dist/commands/link.js +223 -166
  23. package/dist/commands/neon_auth.js +381 -363
  24. package/dist/commands/operations.js +11 -11
  25. package/dist/commands/orgs.js +8 -8
  26. package/dist/commands/projects.js +101 -99
  27. package/dist/commands/psql.js +31 -31
  28. package/dist/commands/roles.js +21 -21
  29. package/dist/commands/schema_diff.js +23 -23
  30. package/dist/commands/set_context.js +17 -17
  31. package/dist/commands/status.js +17 -17
  32. package/dist/commands/user.js +5 -5
  33. package/dist/commands/vpc_endpoints.js +50 -50
  34. package/dist/config.js +7 -7
  35. package/dist/config_format.js +5 -5
  36. package/dist/context.js +23 -16
  37. package/dist/current_branch_fast_path.js +6 -6
  38. package/dist/dev/env.js +33 -33
  39. package/dist/dev/functions.js +4 -4
  40. package/dist/dev/inputs.js +6 -6
  41. package/dist/dev/runtime.js +25 -25
  42. package/dist/env.js +14 -14
  43. package/dist/env_file.js +13 -13
  44. package/dist/errors.js +19 -19
  45. package/dist/functions_api.js +10 -10
  46. package/dist/help.js +15 -15
  47. package/dist/index.js +94 -92
  48. package/dist/log.js +2 -2
  49. package/dist/pkg.js +5 -5
  50. package/dist/psql/cli.js +4 -2
  51. package/dist/psql/command/cmd_cond.js +61 -61
  52. package/dist/psql/command/cmd_connect.js +159 -154
  53. package/dist/psql/command/cmd_copy.js +107 -97
  54. package/dist/psql/command/cmd_describe.js +368 -363
  55. package/dist/psql/command/cmd_format.js +276 -263
  56. package/dist/psql/command/cmd_io.js +269 -263
  57. package/dist/psql/command/cmd_lo.js +74 -66
  58. package/dist/psql/command/cmd_meta.js +148 -148
  59. package/dist/psql/command/cmd_misc.js +17 -17
  60. package/dist/psql/command/cmd_pipeline.js +142 -135
  61. package/dist/psql/command/cmd_restrict.js +25 -25
  62. package/dist/psql/command/cmd_show.js +183 -168
  63. package/dist/psql/command/dispatch.js +26 -26
  64. package/dist/psql/command/shared.js +14 -14
  65. package/dist/psql/complete/filenames.js +16 -16
  66. package/dist/psql/complete/index.js +4 -4
  67. package/dist/psql/complete/matcher.js +33 -32
  68. package/dist/psql/complete/psqlVars.js +173 -173
  69. package/dist/psql/complete/queries.js +5 -3
  70. package/dist/psql/complete/rules.js +900 -863
  71. package/dist/psql/core/common.js +136 -133
  72. package/dist/psql/core/help.js +343 -343
  73. package/dist/psql/core/mainloop.js +160 -153
  74. package/dist/psql/core/prompt.js +126 -123
  75. package/dist/psql/core/settings.js +111 -111
  76. package/dist/psql/core/sqlHelp.js +150 -150
  77. package/dist/psql/core/startup.js +211 -205
  78. package/dist/psql/core/syncVars.js +14 -14
  79. package/dist/psql/core/variables.js +24 -24
  80. package/dist/psql/describe/formatters.js +302 -289
  81. package/dist/psql/describe/processNamePattern.js +28 -28
  82. package/dist/psql/describe/queries.js +656 -651
  83. package/dist/psql/index.js +436 -411
  84. package/dist/psql/io/history.js +36 -36
  85. package/dist/psql/io/input.js +15 -15
  86. package/dist/psql/io/lineEditor/buffer.js +27 -25
  87. package/dist/psql/io/lineEditor/complete.js +15 -15
  88. package/dist/psql/io/lineEditor/filename.js +22 -22
  89. package/dist/psql/io/lineEditor/index.js +65 -62
  90. package/dist/psql/io/lineEditor/keymap.js +325 -318
  91. package/dist/psql/io/lineEditor/vt100.js +60 -60
  92. package/dist/psql/io/pgpass.js +18 -18
  93. package/dist/psql/io/pgservice.js +14 -14
  94. package/dist/psql/io/psqlrc.js +46 -46
  95. package/dist/psql/print/aligned.js +175 -166
  96. package/dist/psql/print/asciidoc.js +51 -51
  97. package/dist/psql/print/crosstab.js +34 -31
  98. package/dist/psql/print/csv.js +25 -22
  99. package/dist/psql/print/html.js +54 -54
  100. package/dist/psql/print/json.js +12 -12
  101. package/dist/psql/print/latex.js +118 -118
  102. package/dist/psql/print/pager.js +28 -26
  103. package/dist/psql/print/troff.js +48 -48
  104. package/dist/psql/print/unaligned.js +15 -14
  105. package/dist/psql/print/units.js +17 -17
  106. package/dist/psql/scanner/slash.js +48 -46
  107. package/dist/psql/scanner/sql.js +88 -84
  108. package/dist/psql/scanner/stringutils.js +21 -17
  109. package/dist/psql/types/index.js +7 -7
  110. package/dist/psql/types/scanner.js +8 -8
  111. package/dist/psql/wire/connection.js +341 -327
  112. package/dist/psql/wire/copy.js +7 -7
  113. package/dist/psql/wire/pipeline.js +26 -24
  114. package/dist/psql/wire/protocol.js +102 -102
  115. package/dist/psql/wire/sasl.js +62 -62
  116. package/dist/psql/wire/tls.js +79 -73
  117. package/dist/storage_api.js +15 -15
  118. package/dist/test_utils/fixtures.js +34 -31
  119. package/dist/test_utils/oauth_server.js +5 -5
  120. package/dist/utils/api_enums.js +13 -13
  121. package/dist/utils/branch_notice.js +5 -5
  122. package/dist/utils/branch_picker.js +26 -26
  123. package/dist/utils/compute_units.js +4 -4
  124. package/dist/utils/enrichers.js +20 -15
  125. package/dist/utils/esbuild.js +28 -28
  126. package/dist/utils/formats.js +1 -1
  127. package/dist/utils/middlewares.js +3 -3
  128. package/dist/utils/package_manager.js +68 -0
  129. package/dist/utils/point_in_time.js +12 -12
  130. package/dist/utils/psql.js +30 -30
  131. package/dist/utils/string.js +2 -2
  132. package/dist/utils/ui.js +9 -9
  133. package/dist/utils/zip.js +1 -1
  134. package/dist/writer.js +17 -17
  135. package/package.json +6 -7
package/dist/help.js CHANGED
@@ -1,16 +1,16 @@
1
- import cliui from 'cliui';
2
- import chalk from 'chalk';
3
- import { consumeBlockIfMatches, consumeNextMatching, drawPointer, splitColumns, } from './utils/ui.js';
1
+ import chalk from "chalk";
2
+ import cliui from "cliui";
3
+ import { consumeBlockIfMatches, consumeNextMatching, drawPointer, splitColumns, } from "./utils/ui.js";
4
4
  // target width for the leftmost column
5
5
  const SPACE_WIDTH = 20;
6
6
  const formatHelp = (help) => {
7
- const lines = help.split('\n');
7
+ const lines = help.split("\n");
8
8
  const result = [];
9
9
  // full command, like `neonctl projects list`
10
10
  const topLevelCommand = consumeNextMatching(lines, /^.*/);
11
11
  if (topLevelCommand) {
12
- result.push(chalk.bold(topLevelCommand.replace('[options]', chalk.reset.green('[options]'))));
13
- result.push('');
12
+ result.push(chalk.bold(topLevelCommand.replace("[options]", chalk.reset.green("[options]"))));
13
+ result.push("");
14
14
  }
15
15
  // commands description block
16
16
  // example command to see: neonctl projects
@@ -24,7 +24,7 @@ const formatHelp = (help) => {
24
24
  commandsBlock.forEach((line) => {
25
25
  if (/^\s{3,}/.exec(line)) {
26
26
  ui.div({
27
- text: '',
27
+ text: "",
28
28
  width: SPACE_WIDTH,
29
29
  padding: [0, 0, 0, 0],
30
30
  }, { text: line.trim(), padding: [0, 0, 0, 0] });
@@ -44,7 +44,7 @@ const formatHelp = (help) => {
44
44
  }, { text: description, padding: [0, 0, 0, 2] });
45
45
  });
46
46
  result.push(ui.toString());
47
- result.push('');
47
+ result.push("");
48
48
  }
49
49
  // positional args block
50
50
  // example command to see: neonctl branches rename
@@ -67,14 +67,14 @@ const formatHelp = (help) => {
67
67
  });
68
68
  });
69
69
  result.push(ui.toString());
70
- result.push('');
70
+ result.push("");
71
71
  }
72
72
  // command description
73
73
  // example command to see: neonctl projects list
74
74
  const descriptionBlock = consumeBlockIfMatches(lines, /^(?!.*options:)/i);
75
75
  if (descriptionBlock.length > 0) {
76
76
  result.push(...descriptionBlock);
77
- result.push('');
77
+ result.push("");
78
78
  }
79
79
  while (true) {
80
80
  // there are two options blocks: global and specific
@@ -89,7 +89,7 @@ const formatHelp = (help) => {
89
89
  const ui = cliui({
90
90
  width: 0,
91
91
  });
92
- if (option.startsWith('-')) {
92
+ if (option.startsWith("-")) {
93
93
  ui.div({
94
94
  text: chalk.green(option),
95
95
  padding: [0, 0, 0, 0],
@@ -99,14 +99,14 @@ const formatHelp = (help) => {
99
99
  width: SPACE_WIDTH,
100
100
  padding: [0, 2, 0, 0],
101
101
  }, {
102
- text: chalk.rgb(210, 210, 210)(description ?? ''),
102
+ text: chalk.rgb(210, 210, 210)(description ?? ""),
103
103
  padding: [0, 0, 0, 0],
104
104
  });
105
105
  }
106
106
  else {
107
107
  ui.div({
108
108
  padding: [0, 0, 0, 0],
109
- text: '',
109
+ text: "",
110
110
  width: SPACE_WIDTH,
111
111
  }, {
112
112
  text: chalk.rgb(210, 210, 210)(option),
@@ -115,7 +115,7 @@ const formatHelp = (help) => {
115
115
  }
116
116
  result.push(ui.toString());
117
117
  });
118
- result.push('');
118
+ result.push("");
119
119
  }
120
120
  const exampleBlock = consumeBlockIfMatches(lines, /Examples:/);
121
121
  if (exampleBlock.length > 0) {
@@ -141,6 +141,6 @@ const formatHelp = (help) => {
141
141
  export const showHelp = async (argv) => {
142
142
  // add wrap to ensure that there are no line breaks
143
143
  const help = await argv.getHelp();
144
- process.stderr.write(formatHelp(help).join('\n') + '\n');
144
+ process.stderr.write(formatHelp(help).join("\n") + "\n");
145
145
  process.exit(0);
146
146
  };
package/dist/index.js CHANGED
@@ -1,111 +1,111 @@
1
- import { basename } from 'node:path';
2
- import yargs from 'yargs';
3
- import { hideBin } from 'yargs/helpers';
4
- import { isNeonApiError, messageFromBody } from './api.js';
5
- import { ensureAuth, deleteCredentials } from './commands/auth.js';
6
- import { defaultDir, ensureConfigDir } from './config.js';
7
- import { log } from './log.js';
8
- import { defaultClientID } from './auth.js';
9
- import { fillInArgs } from './utils/middlewares.js';
10
- import pkg from './pkg.js';
11
- import commands from './commands/index.js';
12
- import { analyticsMiddleware, initAnalyticsClientMiddleware, closeAnalytics, getAnalyticsEventProperties, sendError, trackEvent, } from './analytics.js';
13
- import { isNetworkError, matchErrorCode, NETWORK_ERROR_MESSAGE, } from './errors.js';
14
- import { showHelp } from './help.js';
15
- import { currentContextFile, enrichFromContext } from './context.js';
1
+ import { basename } from "node:path";
2
+ import yargs from "yargs";
3
+ import { hideBin } from "yargs/helpers";
4
+ import { analyticsMiddleware, closeAnalytics, getAnalyticsEventProperties, initAnalyticsClientMiddleware, sendError, trackEvent, } from "./analytics.js";
5
+ import { isNeonApiError, messageFromBody } from "./api.js";
6
+ import { defaultClientID } from "./auth.js";
7
+ import { deleteCredentials, ensureAuth } from "./commands/auth.js";
8
+ import commands from "./commands/index.js";
9
+ import { defaultDir, ensureConfigDir } from "./config.js";
10
+ import { currentContextFile, enrichFromContext } from "./context.js";
11
+ import { isNetworkError, matchErrorCode, NETWORK_ERROR_MESSAGE, } from "./errors.js";
12
+ import { showHelp } from "./help.js";
13
+ import { log } from "./log.js";
14
+ import pkg from "./pkg.js";
15
+ import { fillInArgs } from "./utils/middlewares.js";
16
16
  const NO_SUBCOMMANDS_VERBS = [
17
17
  // aliases
18
- 'auth',
19
- 'login',
20
- 'me',
18
+ "auth",
19
+ "login",
20
+ "me",
21
21
  // aliases
22
- 'cs',
23
- 'connection-string',
24
- 'psql',
25
- 'set-context',
26
- 'checkout',
27
- 'link',
28
- 'init',
29
- 'dev',
30
- 'deploy',
31
- 'bootstrap',
22
+ "cs",
23
+ "connection-string",
24
+ "psql",
25
+ "set-context",
26
+ "checkout",
27
+ "link",
28
+ "init",
29
+ "dev",
30
+ "deploy",
31
+ "bootstrap",
32
32
  // alias of `config status`
33
- 'status',
33
+ "status",
34
34
  ];
35
35
  let builder = yargs(hideBin(process.argv));
36
36
  builder = builder
37
37
  .scriptName(pkg.name)
38
- .locale('en')
39
- .usage('$0 <command> [options]')
38
+ .locale("en")
39
+ .usage("$0 <command> [options]")
40
40
  .parserConfiguration({
41
- 'populate--': true,
41
+ "populate--": true,
42
42
  })
43
43
  .help()
44
- .option('output', {
45
- alias: 'o',
46
- group: 'Global options:',
47
- describe: 'Set output format',
48
- type: 'string',
49
- choices: ['json', 'yaml', 'table'],
50
- default: 'table',
44
+ .option("output", {
45
+ alias: "o",
46
+ group: "Global options:",
47
+ describe: "Set output format",
48
+ type: "string",
49
+ choices: ["json", "yaml", "table"],
50
+ default: "table",
51
51
  })
52
- .option('api-host', {
53
- describe: 'The API host',
52
+ .option("api-host", {
53
+ describe: "The API host",
54
54
  hidden: true,
55
- default: process.env.NEON_API_HOST ?? 'https://console.neon.tech/api/v2',
55
+ default: process.env.NEON_API_HOST ?? "https://console.neon.tech/api/v2",
56
56
  })
57
57
  // Setup config directory
58
- .option('config-dir', {
59
- describe: 'Path to config directory',
60
- group: 'Global options:',
61
- type: 'string',
58
+ .option("config-dir", {
59
+ describe: "Path to config directory",
60
+ group: "Global options:",
61
+ type: "string",
62
62
  default: defaultDir,
63
63
  })
64
- .option('force-auth', {
65
- describe: 'Force authentication',
66
- type: 'boolean',
64
+ .option("force-auth", {
65
+ describe: "Force authentication",
66
+ type: "boolean",
67
67
  hidden: true,
68
68
  default: false,
69
69
  })
70
70
  .middleware(ensureConfigDir)
71
71
  .options({
72
- 'oauth-host': {
73
- description: 'URL to Neon OAuth host',
72
+ "oauth-host": {
73
+ description: "URL to Neon OAuth host",
74
74
  hidden: true,
75
- default: process.env.NEON_OAUTH_HOST ?? 'https://oauth2.neon.tech',
75
+ default: process.env.NEON_OAUTH_HOST ?? "https://oauth2.neon.tech",
76
76
  },
77
- 'client-id': {
78
- description: 'OAuth client id',
77
+ "client-id": {
78
+ description: "OAuth client id",
79
79
  hidden: true,
80
- type: 'string',
80
+ type: "string",
81
81
  default: defaultClientID,
82
82
  },
83
- 'api-key': {
84
- describe: 'API key',
85
- group: 'Global options:',
86
- type: 'string',
87
- default: process.env.NEON_API_KEY ?? '',
83
+ "api-key": {
84
+ describe: "API key",
85
+ group: "Global options:",
86
+ type: "string",
87
+ default: process.env.NEON_API_KEY ?? "",
88
88
  },
89
89
  apiClient: {
90
90
  hidden: true,
91
91
  coerce: (v) => v,
92
92
  default: null,
93
93
  },
94
- 'context-file': {
95
- describe: 'Context file',
96
- type: 'string',
94
+ "context-file": {
95
+ describe: "Context file",
96
+ type: "string",
97
97
  default: currentContextFile,
98
98
  },
99
99
  color: {
100
- group: 'Global options:',
101
- describe: 'Colorize the output. Example: --no-color, --color false',
102
- type: 'boolean',
100
+ group: "Global options:",
101
+ describe: "Colorize the output. Example: --no-color, --color false",
102
+ type: "boolean",
103
103
  default: true,
104
104
  },
105
105
  analytics: {
106
- describe: 'Manage analytics. Example: --no-analytics, --analytics false',
107
- group: 'Global options:',
108
- type: 'boolean',
106
+ describe: "Manage analytics. Example: --no-analytics, --analytics false",
107
+ group: "Global options:",
108
+ type: "boolean",
109
109
  default: true,
110
110
  },
111
111
  })
@@ -114,13 +114,13 @@ builder = builder
114
114
  }, true)
115
115
  .middleware(initAnalyticsClientMiddleware, true)
116
116
  .help(false)
117
- .group('help', 'Global options:')
118
- .option('help', {
119
- describe: 'Show help',
120
- type: 'boolean',
117
+ .group("help", "Global options:")
118
+ .option("help", {
119
+ describe: "Show help",
120
+ type: "boolean",
121
121
  default: false,
122
122
  })
123
- .alias('help', 'h')
123
+ .alias("help", "h")
124
124
  .middleware(async (args) => {
125
125
  if (args.help ||
126
126
  (args._.length === 1 &&
@@ -134,21 +134,21 @@ builder = builder
134
134
  .command(commands)
135
135
  .strictCommands()
136
136
  .version(pkg.version)
137
- .group('version', 'Global options:')
138
- .alias('version', 'v')
137
+ .group("version", "Global options:")
138
+ .alias("version", "v")
139
139
  .completion()
140
- .scriptName(basename(process.argv[1]) === 'neon' ? 'neon' : 'neonctl')
141
- .epilog('For more information, visit https://neon.com/docs/reference/neon-cli')
140
+ .scriptName(basename(process.argv[1]) === "neon" ? "neon" : "neonctl")
141
+ .epilog("For more information, visit https://neon.com/docs/reference/neon-cli")
142
142
  .wrap(null)
143
143
  .fail(false);
144
144
  async function handleError(msg, err) {
145
- if (process.argv.some((arg) => arg === '--help' || arg === '-h')) {
145
+ if (process.argv.some((arg) => arg === "--help" || arg === "-h")) {
146
146
  await showHelp(builder);
147
147
  process.exit(0);
148
148
  }
149
149
  // Log stack trace if available
150
150
  if (err instanceof Error && err.stack) {
151
- log.debug('Stack: %s', err.stack);
151
+ log.debug("Stack: %s", err.stack);
152
152
  }
153
153
  // A connection-level failure (no response ever reached us) reads as a cryptic
154
154
  // `fetch failed` from the @neon/sdk / global `fetch` path. Detect it first and
@@ -158,24 +158,26 @@ async function handleError(msg, err) {
158
158
  if (isNetworkError(err)) {
159
159
  log.error(NETWORK_ERROR_MESSAGE);
160
160
  const error = err instanceof Error ? err : new Error(NETWORK_ERROR_MESSAGE);
161
- sendError(error, 'NETWORK_ERROR');
161
+ sendError(error, "NETWORK_ERROR");
162
162
  return false;
163
163
  }
164
164
  if (isNeonApiError(err)) {
165
- if (err.code === 'ECONNABORTED') {
166
- log.error('Request timed out');
167
- sendError(err, 'REQUEST_TIMEOUT');
165
+ if (err.code === "ECONNABORTED") {
166
+ log.error("Request timed out");
167
+ sendError(err, "REQUEST_TIMEOUT");
168
168
  return false;
169
169
  }
170
170
  else if (err.status === 401) {
171
- sendError(err, 'AUTH_FAILED');
172
- log.info('Authentication failed, deleting credentials...');
171
+ sendError(err, "AUTH_FAILED");
172
+ log.info("Authentication failed, deleting credentials...");
173
173
  try {
174
174
  deleteCredentials(defaultDir);
175
175
  return true; // Allow retry for auth failures
176
176
  }
177
177
  catch (deleteErr) {
178
- log.debug('Failed to delete credentials: %s', deleteErr instanceof Error ? deleteErr.message : 'unknown error');
178
+ log.debug("Failed to delete credentials: %s", deleteErr instanceof Error
179
+ ? deleteErr.message
180
+ : "unknown error");
179
181
  return false;
180
182
  }
181
183
  }
@@ -184,13 +186,13 @@ async function handleError(msg, err) {
184
186
  if (serverMessage) {
185
187
  log.error(serverMessage);
186
188
  }
187
- log.debug('status: %d %s | path: %s', err.status, err.statusText, err.requestPath);
188
- sendError(err, 'API_ERROR');
189
+ log.debug("status: %d %s | path: %s", err.status, err.statusText, err.requestPath);
190
+ sendError(err, "API_ERROR");
189
191
  return false;
190
192
  }
191
193
  }
192
194
  else {
193
- const error = err instanceof Error ? err : new Error(msg || 'Unknown error');
195
+ const error = err instanceof Error ? err : new Error(msg || "Unknown error");
194
196
  sendError(error, matchErrorCode(error.message));
195
197
  log.error(error.message);
196
198
  return false;
@@ -204,7 +206,7 @@ void (async () => {
204
206
  try {
205
207
  const args = await builder.argv;
206
208
  // Send analytics for a successful attempt
207
- trackEvent('cli_command_success', {
209
+ trackEvent("cli_command_success", {
208
210
  ...getAnalyticsEventProperties(args),
209
211
  projectId: args.projectId,
210
212
  branchId: args.branchId,
@@ -221,7 +223,7 @@ void (async () => {
221
223
  }
222
224
  catch (err) {
223
225
  attempts++;
224
- const shouldRetry = await handleError('', err);
226
+ const shouldRetry = await handleError("", err);
225
227
  if (!shouldRetry || attempts >= MAX_ATTEMPTS) {
226
228
  await closeAnalytics();
227
229
  process.exit(1);
package/dist/log.js CHANGED
@@ -1,5 +1,5 @@
1
- import { format } from 'node:util';
2
- import { isDebug } from './env.js';
1
+ import { format } from "node:util";
2
+ import { isDebug } from "./env.js";
3
3
  export const log = {
4
4
  debug: (...args) => {
5
5
  if (isDebug()) {
package/dist/pkg.js CHANGED
@@ -1,6 +1,6 @@
1
- import { readFileSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
4
  /**
5
5
  * Load the CLI's package.json for version metadata. In the built CLI it sits right next to
6
6
  * this module (the build copies it into `dist`); when running from source (tests, `tsx`) it
@@ -11,12 +11,12 @@ const loadPkg = () => {
11
11
  let dir = dirname(fileURLToPath(import.meta.url));
12
12
  for (;;) {
13
13
  try {
14
- return JSON.parse(readFileSync(join(dir, 'package.json'), 'utf-8'));
14
+ return JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
15
15
  }
16
16
  catch {
17
17
  const parent = dirname(dir);
18
18
  if (parent === dir) {
19
- throw new Error('Could not locate package.json for version detection.');
19
+ throw new Error("Could not locate package.json for version detection.");
20
20
  }
21
21
  dir = parent;
22
22
  }
package/dist/psql/cli.js CHANGED
@@ -29,14 +29,16 @@
29
29
  * EXIT_SUCCESS / EXIT_FAILURE / EXIT_USER / EXIT_BADCONN values; see
30
30
  * `core/mainloop.ts`).
31
31
  */
32
- import { runPsql, looksLikeConnectionString } from './index.js';
32
+ import { looksLikeConnectionString, runPsql } from "./index.js";
33
33
  const main = async () => {
34
34
  const raw = process.argv.slice(2);
35
35
  // Detect whether the first arg is a connection URI/conninfo string.
36
36
  // libpq's `recognized_connection_string()` covers both `postgres[ql]://…`
37
37
  // URIs and bare `key=value` conninfo strings — `looksLikeConnectionString`
38
38
  // mirrors that test.
39
- const argv = raw.length > 0 && looksLikeConnectionString(raw[0]) ? raw : ['', ...raw];
39
+ const argv = raw.length > 0 && looksLikeConnectionString(raw[0])
40
+ ? raw
41
+ : ["", ...raw];
40
42
  const code = await runPsql(argv, {
41
43
  stdin: process.stdin,
42
44
  stdout: process.stdout,