neonctl 2.27.1 → 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 (136) hide show
  1. package/README.md +35 -3
  2. package/dist/analytics.js +52 -34
  3. package/dist/api.js +643 -13
  4. package/dist/auth.js +50 -44
  5. package/dist/cli.js +8 -1
  6. package/dist/commands/auth.js +64 -51
  7. package/dist/commands/bootstrap.js +115 -157
  8. package/dist/commands/branches.js +160 -150
  9. package/dist/commands/bucket.js +183 -146
  10. package/dist/commands/checkout.js +51 -51
  11. package/dist/commands/config.js +228 -82
  12. package/dist/commands/connection_string.js +62 -62
  13. package/dist/commands/data_api.js +100 -101
  14. package/dist/commands/databases.js +29 -26
  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 +101 -104
  19. package/dist/commands/index.js +27 -25
  20. package/dist/commands/init.js +23 -22
  21. package/dist/commands/ip_allow.js +29 -29
  22. package/dist/commands/link.js +232 -182
  23. package/dist/commands/neon_auth.js +385 -370
  24. package/dist/commands/operations.js +11 -11
  25. package/dist/commands/orgs.js +8 -8
  26. package/dist/commands/projects.js +103 -101
  27. package/dist/commands/psql.js +31 -31
  28. package/dist/commands/roles.js +27 -24
  29. package/dist/commands/schema_diff.js +25 -26
  30. package/dist/commands/set_context.js +17 -17
  31. package/dist/commands/status.js +40 -0
  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 +37 -14
  37. package/dist/current_branch_fast_path.js +55 -0
  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 +68 -5
  45. package/dist/functions_api.js +10 -10
  46. package/dist/help.js +15 -15
  47. package/dist/index.js +110 -107
  48. package/dist/log.js +2 -2
  49. package/dist/parameters.gen.js +14 -14
  50. package/dist/pkg.js +5 -5
  51. package/dist/psql/cli.js +4 -2
  52. package/dist/psql/command/cmd_cond.js +61 -61
  53. package/dist/psql/command/cmd_connect.js +159 -154
  54. package/dist/psql/command/cmd_copy.js +107 -97
  55. package/dist/psql/command/cmd_describe.js +368 -363
  56. package/dist/psql/command/cmd_format.js +276 -263
  57. package/dist/psql/command/cmd_io.js +269 -263
  58. package/dist/psql/command/cmd_lo.js +74 -66
  59. package/dist/psql/command/cmd_meta.js +148 -148
  60. package/dist/psql/command/cmd_misc.js +17 -17
  61. package/dist/psql/command/cmd_pipeline.js +142 -135
  62. package/dist/psql/command/cmd_restrict.js +25 -25
  63. package/dist/psql/command/cmd_show.js +183 -168
  64. package/dist/psql/command/dispatch.js +26 -26
  65. package/dist/psql/command/shared.js +14 -14
  66. package/dist/psql/complete/filenames.js +16 -16
  67. package/dist/psql/complete/index.js +4 -4
  68. package/dist/psql/complete/matcher.js +33 -32
  69. package/dist/psql/complete/psqlVars.js +173 -173
  70. package/dist/psql/complete/queries.js +5 -3
  71. package/dist/psql/complete/rules.js +900 -863
  72. package/dist/psql/core/common.js +136 -133
  73. package/dist/psql/core/help.js +343 -343
  74. package/dist/psql/core/mainloop.js +160 -153
  75. package/dist/psql/core/prompt.js +126 -123
  76. package/dist/psql/core/settings.js +111 -111
  77. package/dist/psql/core/sqlHelp.js +150 -150
  78. package/dist/psql/core/startup.js +211 -205
  79. package/dist/psql/core/syncVars.js +14 -14
  80. package/dist/psql/core/variables.js +24 -24
  81. package/dist/psql/describe/formatters.js +302 -289
  82. package/dist/psql/describe/processNamePattern.js +28 -28
  83. package/dist/psql/describe/queries.js +656 -651
  84. package/dist/psql/index.js +436 -411
  85. package/dist/psql/io/history.js +36 -36
  86. package/dist/psql/io/input.js +15 -15
  87. package/dist/psql/io/lineEditor/buffer.js +27 -25
  88. package/dist/psql/io/lineEditor/complete.js +15 -15
  89. package/dist/psql/io/lineEditor/filename.js +22 -22
  90. package/dist/psql/io/lineEditor/index.js +65 -62
  91. package/dist/psql/io/lineEditor/keymap.js +325 -318
  92. package/dist/psql/io/lineEditor/vt100.js +60 -60
  93. package/dist/psql/io/pgpass.js +18 -18
  94. package/dist/psql/io/pgservice.js +14 -14
  95. package/dist/psql/io/psqlrc.js +46 -46
  96. package/dist/psql/print/aligned.js +175 -166
  97. package/dist/psql/print/asciidoc.js +51 -51
  98. package/dist/psql/print/crosstab.js +34 -31
  99. package/dist/psql/print/csv.js +25 -22
  100. package/dist/psql/print/html.js +54 -54
  101. package/dist/psql/print/json.js +12 -12
  102. package/dist/psql/print/latex.js +118 -118
  103. package/dist/psql/print/pager.js +28 -26
  104. package/dist/psql/print/troff.js +48 -48
  105. package/dist/psql/print/unaligned.js +15 -14
  106. package/dist/psql/print/units.js +17 -17
  107. package/dist/psql/scanner/slash.js +48 -46
  108. package/dist/psql/scanner/sql.js +88 -84
  109. package/dist/psql/scanner/stringutils.js +21 -17
  110. package/dist/psql/types/index.js +7 -7
  111. package/dist/psql/types/scanner.js +8 -8
  112. package/dist/psql/wire/connection.js +341 -327
  113. package/dist/psql/wire/copy.js +7 -7
  114. package/dist/psql/wire/pipeline.js +26 -24
  115. package/dist/psql/wire/protocol.js +102 -102
  116. package/dist/psql/wire/sasl.js +62 -62
  117. package/dist/psql/wire/tls.js +79 -73
  118. package/dist/storage_api.js +22 -23
  119. package/dist/test_utils/fixtures.js +74 -41
  120. package/dist/test_utils/oauth_server.js +5 -5
  121. package/dist/utils/api_enums.js +33 -0
  122. package/dist/utils/branch_notice.js +5 -5
  123. package/dist/utils/branch_picker.js +26 -26
  124. package/dist/utils/compute_units.js +4 -4
  125. package/dist/utils/enrichers.js +28 -16
  126. package/dist/utils/esbuild.js +28 -28
  127. package/dist/utils/formats.js +1 -1
  128. package/dist/utils/middlewares.js +3 -3
  129. package/dist/utils/package_manager.js +68 -0
  130. package/dist/utils/point_in_time.js +12 -12
  131. package/dist/utils/psql.js +30 -30
  132. package/dist/utils/string.js +2 -2
  133. package/dist/utils/ui.js +9 -9
  134. package/dist/utils/zip.js +1 -1
  135. package/dist/writer.js +17 -17
  136. package/package.json +10 -12
@@ -11,8 +11,8 @@
11
11
  * in {@link registerMiscCommands} below — `cmdCrosstabview` is the worked
12
12
  * example.
13
13
  */
14
- import { printCrosstab } from '../print/crosstab.js';
15
- import { writeErr } from './shared.js';
14
+ import { printCrosstab } from "../print/crosstab.js";
15
+ import { writeErr } from "./shared.js";
16
16
  // ---------------------------------------------------------------------------
17
17
  // Helpers
18
18
  // ---------------------------------------------------------------------------
@@ -23,7 +23,7 @@ const errResult = (ctx, message) => {
23
23
  // does not double-print `psql: ERROR: <msg>`. Matches the pattern
24
24
  // used by `cmd_io.ts::errResult` for the same reason. The conformance
25
25
  // expected output has one error line per failure, not two.
26
- return { status: 'error', errorWritten: true };
26
+ return { status: "error", errorWritten: true };
27
27
  };
28
28
  /**
29
29
  * Decode a slash arg into a `CrosstabOptions` value (name or 1-based index).
@@ -60,28 +60,28 @@ const isCommentOnly = (text) => {
60
60
  let i = 0;
61
61
  while (i < n) {
62
62
  const c = text[i];
63
- if (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
63
+ if (c === " " || c === "\t" || c === "\n" || c === "\r") {
64
64
  i++;
65
65
  continue;
66
66
  }
67
- if (c === '-' && text[i + 1] === '-') {
67
+ if (c === "-" && text[i + 1] === "-") {
68
68
  // Skip to end-of-line.
69
69
  i += 2;
70
- while (i < n && text[i] !== '\n' && text[i] !== '\r')
70
+ while (i < n && text[i] !== "\n" && text[i] !== "\r")
71
71
  i++;
72
72
  continue;
73
73
  }
74
- if (c === '/' && text[i + 1] === '*') {
74
+ if (c === "/" && text[i + 1] === "*") {
75
75
  // Skip nested block comment (PG extends C-style comments with nesting).
76
76
  let depth = 1;
77
77
  i += 2;
78
78
  while (i < n && depth > 0) {
79
- if (text[i] === '/' && text[i + 1] === '*') {
79
+ if (text[i] === "/" && text[i + 1] === "*") {
80
80
  depth++;
81
81
  i += 2;
82
82
  continue;
83
83
  }
84
- if (text[i] === '*' && text[i + 1] === '/') {
84
+ if (text[i] === "*" && text[i + 1] === "/") {
85
85
  depth--;
86
86
  i += 2;
87
87
  continue;
@@ -118,11 +118,11 @@ const lastTuplesResult = (results) => {
118
118
  return results.length > 0 ? results[results.length - 1] : null;
119
119
  };
120
120
  export const cmdCrosstabview = {
121
- name: 'crosstabview',
122
- helpKey: 'crosstabview',
121
+ name: "crosstabview",
122
+ helpKey: "crosstabview",
123
123
  async run(ctx) {
124
124
  if (!ctx.settings.db) {
125
- return errResult(ctx, 'no connection to the server');
125
+ return errResult(ctx, "no connection to the server");
126
126
  }
127
127
  // Source SQL is the active query buffer; when that's effectively
128
128
  // empty (whitespace + comments only — the common shape after a
@@ -134,7 +134,7 @@ export const cmdCrosstabview = {
134
134
  sql = ctx.settings.lastQuery.trim();
135
135
  }
136
136
  if (sql.length === 0) {
137
- return errResult(ctx, 'no SQL command');
137
+ return errResult(ctx, "no SQL command");
138
138
  }
139
139
  // Read up to four args from the slash arg stream. Each is optional;
140
140
  // missing args fall back to the pivot defaults (1, 2, 3, none).
@@ -145,7 +145,7 @@ export const cmdCrosstabview = {
145
145
  undefined,
146
146
  ];
147
147
  for (let i = 0; i < 4; i++) {
148
- const a = ctx.nextArg('normal');
148
+ const a = ctx.nextArg("normal");
149
149
  if (a === null)
150
150
  break;
151
151
  args[i] = parseColRef(a);
@@ -160,10 +160,10 @@ export const cmdCrosstabview = {
160
160
  }
161
161
  const target = lastTuplesResult(results);
162
162
  if (!target) {
163
- return errResult(ctx, 'statement did not return a result set');
163
+ return errResult(ctx, "statement did not return a result set");
164
164
  }
165
165
  if (target.fields.length === 0) {
166
- return errResult(ctx, 'statement did not return a result set');
166
+ return errResult(ctx, "statement did not return a result set");
167
167
  }
168
168
  const opts = {
169
169
  colV: args[0],
@@ -175,7 +175,7 @@ export const cmdCrosstabview = {
175
175
  if (err) {
176
176
  return errResult(ctx, err.error);
177
177
  }
178
- return { status: 'reset-buf', newBuf: '' };
178
+ return { status: "reset-buf", newBuf: "" };
179
179
  },
180
180
  };
181
181
  /**