neonctl 2.37.0 → 2.38.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 (160) hide show
  1. package/{LICENSE.md → LICENSE} +27 -3
  2. package/README.md +15 -700
  3. package/bin/cli.js +3 -0
  4. package/package.json +8 -75
  5. package/dist/analytics.js +0 -168
  6. package/dist/api.js +0 -720
  7. package/dist/auth.js +0 -125
  8. package/dist/callback.html +0 -51
  9. package/dist/cli.js +0 -9
  10. package/dist/commands/api.js +0 -278
  11. package/dist/commands/auth.js +0 -214
  12. package/dist/commands/bootstrap.js +0 -481
  13. package/dist/commands/branches.js +0 -488
  14. package/dist/commands/bucket.js +0 -549
  15. package/dist/commands/checkout.js +0 -321
  16. package/dist/commands/config.js +0 -626
  17. package/dist/commands/connection_string.js +0 -172
  18. package/dist/commands/data_api.js +0 -284
  19. package/dist/commands/databases.js +0 -82
  20. package/dist/commands/deploy.js +0 -26
  21. package/dist/commands/dev.js +0 -698
  22. package/dist/commands/diff.js +0 -222
  23. package/dist/commands/env.js +0 -189
  24. package/dist/commands/functions.js +0 -373
  25. package/dist/commands/index.js +0 -62
  26. package/dist/commands/init.js +0 -73
  27. package/dist/commands/inspect.js +0 -65
  28. package/dist/commands/ip_allow.js +0 -137
  29. package/dist/commands/link.js +0 -1121
  30. package/dist/commands/neon_auth.js +0 -1028
  31. package/dist/commands/operations.js +0 -28
  32. package/dist/commands/orgs.js +0 -24
  33. package/dist/commands/projects.js +0 -413
  34. package/dist/commands/psql.js +0 -62
  35. package/dist/commands/roles.js +0 -65
  36. package/dist/commands/schema_diff.js +0 -151
  37. package/dist/commands/set_context.js +0 -29
  38. package/dist/commands/snapshots.js +0 -455
  39. package/dist/commands/status.js +0 -40
  40. package/dist/commands/user.js +0 -15
  41. package/dist/commands/vpc_endpoints.js +0 -134
  42. package/dist/config.js +0 -11
  43. package/dist/config_format.js +0 -72
  44. package/dist/context.js +0 -231
  45. package/dist/current_branch_fast_path.js +0 -55
  46. package/dist/dev/env.js +0 -244
  47. package/dist/dev/functions.js +0 -70
  48. package/dist/dev/inputs.js +0 -63
  49. package/dist/dev/runtime.js +0 -146
  50. package/dist/env.js +0 -36
  51. package/dist/env_file.js +0 -159
  52. package/dist/errors.js +0 -80
  53. package/dist/functions_api.js +0 -48
  54. package/dist/help.js +0 -146
  55. package/dist/index.js +0 -240
  56. package/dist/log.js +0 -18
  57. package/dist/parameters.gen.js +0 -480
  58. package/dist/pkg.js +0 -25
  59. package/dist/psql/cli.js +0 -53
  60. package/dist/psql/command/cmd_cond.js +0 -437
  61. package/dist/psql/command/cmd_connect.js +0 -820
  62. package/dist/psql/command/cmd_copy.js +0 -1035
  63. package/dist/psql/command/cmd_describe.js +0 -1815
  64. package/dist/psql/command/cmd_format.js +0 -948
  65. package/dist/psql/command/cmd_io.js +0 -2193
  66. package/dist/psql/command/cmd_lo.js +0 -393
  67. package/dist/psql/command/cmd_meta.js +0 -969
  68. package/dist/psql/command/cmd_misc.js +0 -187
  69. package/dist/psql/command/cmd_pipeline.js +0 -1148
  70. package/dist/psql/command/cmd_restrict.js +0 -171
  71. package/dist/psql/command/cmd_show.js +0 -766
  72. package/dist/psql/command/dispatch.js +0 -343
  73. package/dist/psql/command/inputQueue.js +0 -42
  74. package/dist/psql/command/shared.js +0 -71
  75. package/dist/psql/complete/filenames.js +0 -139
  76. package/dist/psql/complete/index.js +0 -104
  77. package/dist/psql/complete/matcher.js +0 -315
  78. package/dist/psql/complete/psqlVars.js +0 -249
  79. package/dist/psql/complete/queries.js +0 -493
  80. package/dist/psql/complete/rules.js +0 -2424
  81. package/dist/psql/core/common.js +0 -1253
  82. package/dist/psql/core/help.js +0 -576
  83. package/dist/psql/core/mainloop.js +0 -1360
  84. package/dist/psql/core/prompt.js +0 -439
  85. package/dist/psql/core/settings.js +0 -686
  86. package/dist/psql/core/sqlHelp.js +0 -1066
  87. package/dist/psql/core/startup.js +0 -846
  88. package/dist/psql/core/syncVars.js +0 -116
  89. package/dist/psql/core/variables.js +0 -287
  90. package/dist/psql/describe/formatters.js +0 -1330
  91. package/dist/psql/describe/processNamePattern.js +0 -270
  92. package/dist/psql/describe/queries.js +0 -2452
  93. package/dist/psql/describe/versionGate.js +0 -44
  94. package/dist/psql/index.js +0 -2030
  95. package/dist/psql/io/history.js +0 -299
  96. package/dist/psql/io/input.js +0 -120
  97. package/dist/psql/io/lineEditor/buffer.js +0 -325
  98. package/dist/psql/io/lineEditor/complete.js +0 -227
  99. package/dist/psql/io/lineEditor/filename.js +0 -159
  100. package/dist/psql/io/lineEditor/index.js +0 -893
  101. package/dist/psql/io/lineEditor/keymap.js +0 -745
  102. package/dist/psql/io/lineEditor/vt100.js +0 -363
  103. package/dist/psql/io/pgpass.js +0 -202
  104. package/dist/psql/io/pgservice.js +0 -194
  105. package/dist/psql/io/psqlrc.js +0 -422
  106. package/dist/psql/print/aligned.js +0 -1748
  107. package/dist/psql/print/asciidoc.js +0 -230
  108. package/dist/psql/print/crosstab.js +0 -463
  109. package/dist/psql/print/csv.js +0 -76
  110. package/dist/psql/print/html.js +0 -240
  111. package/dist/psql/print/json.js +0 -96
  112. package/dist/psql/print/latex.js +0 -379
  113. package/dist/psql/print/pager.js +0 -267
  114. package/dist/psql/print/troff.js +0 -240
  115. package/dist/psql/print/unaligned.js +0 -99
  116. package/dist/psql/print/units.js +0 -188
  117. package/dist/psql/scanner/slash.js +0 -515
  118. package/dist/psql/scanner/sql.js +0 -914
  119. package/dist/psql/scanner/stringutils.js +0 -394
  120. package/dist/psql/types/backslash.js +0 -1
  121. package/dist/psql/types/connection.js +0 -1
  122. package/dist/psql/types/index.js +0 -7
  123. package/dist/psql/types/printer.js +0 -1
  124. package/dist/psql/types/repl.js +0 -1
  125. package/dist/psql/types/scanner.js +0 -24
  126. package/dist/psql/types/settings.js +0 -1
  127. package/dist/psql/types/variables.js +0 -1
  128. package/dist/psql/wire/connection.js +0 -2857
  129. package/dist/psql/wire/copy.js +0 -108
  130. package/dist/psql/wire/notify.js +0 -59
  131. package/dist/psql/wire/pipeline.js +0 -521
  132. package/dist/psql/wire/protocol.js +0 -466
  133. package/dist/psql/wire/sasl.js +0 -294
  134. package/dist/psql/wire/tls.js +0 -602
  135. package/dist/storage_api.js +0 -147
  136. package/dist/test_utils/fixtures.js +0 -121
  137. package/dist/test_utils/oauth_server.js +0 -9
  138. package/dist/types.js +0 -1
  139. package/dist/utils/ai_gateway_notice.js +0 -180
  140. package/dist/utils/api_enums.js +0 -33
  141. package/dist/utils/auth.js +0 -5
  142. package/dist/utils/branch_notice.js +0 -22
  143. package/dist/utils/branch_picker.js +0 -103
  144. package/dist/utils/compute_units.js +0 -28
  145. package/dist/utils/config_diff.js +0 -185
  146. package/dist/utils/enrichers.js +0 -161
  147. package/dist/utils/esbuild.js +0 -158
  148. package/dist/utils/formats.js +0 -18
  149. package/dist/utils/git_diff.js +0 -90
  150. package/dist/utils/inspect_db.js +0 -153
  151. package/dist/utils/inspect_queries.js +0 -372
  152. package/dist/utils/middlewares.js +0 -20
  153. package/dist/utils/openapi.js +0 -114
  154. package/dist/utils/package_manager.js +0 -68
  155. package/dist/utils/point_in_time.js +0 -56
  156. package/dist/utils/psql.js +0 -120
  157. package/dist/utils/string.js +0 -5
  158. package/dist/utils/ui.js +0 -59
  159. package/dist/utils/zip.js +0 -4
  160. package/dist/writer.js +0 -97
@@ -1,393 +0,0 @@
1
- /**
2
- * psql large-object backslash commands (WP-23).
3
- *
4
- * TypeScript port of upstream `src/bin/psql/large_obj.c`:
5
- *
6
- * - `\lo_list` / `\lo_list+` — list large-object metadata
7
- * - `\lo_import FILE [COMMENT]` — read a local file, store as new LO
8
- * - `\lo_export OID FILE` — read LO, write to a local file
9
- * - `\lo_unlink OID` — delete an LO
10
- *
11
- * The upstream `do_lo_*` functions wrap their work in
12
- * `start_lo_xact`/`finish_lo_xact` and call libpq's lo client API
13
- * (`lo_import`, `lo_export`, `lo_unlink`). We don't have libpq's
14
- * client-side large-object API in this TS port, so we drive the same
15
- * operations through the server-side functions that psql ≥ 9.4 exposes:
16
- *
17
- * - `pg_catalog.lo_from_bytea(0, $bytea)` returns the new OID in one
18
- * call (replaces the upstream lo_creat + lo_write loop).
19
- * - `pg_catalog.lo_get($oid)` returns the bytes as a `bytea` value.
20
- * - `pg_catalog.lo_unlink($oid)` deletes the LO.
21
- *
22
- * All three calls use the connection's extended-query path (WP-21) for
23
- * parameter binding, which keeps us out of the libpq escape dance.
24
- * Bytea payloads are sent as `\x<hex>` text — the server's text-format
25
- * bytea parser converts back to bytes.
26
- *
27
- * `\lo_list` runs the same SELECT against `pg_largeobject_metadata` that
28
- * upstream's `listLargeObjects()` from `describe.c` uses (already ported
29
- * in WP-20's `queries.ts::listLargeObjects`). We register a primary
30
- * `lo_list` / `lo_list+` spec here so the dispatcher takes our entry
31
- * over the existing alias `dl::lo_list` (which would not match the
32
- * `+` suffix).
33
- *
34
- * Variable side-effects: `\lo_import` sets `LASTOID` to the new OID
35
- * (mirrors `do_lo_import`'s `SetVariable(pset.vars, "LASTOID", oidbuf)`).
36
- */
37
- import { Buffer } from "node:buffer";
38
- import { promises as fsPromises } from "node:fs";
39
- import { listLargeObjects } from "../describe/queries.js";
40
- import { alignedPrinter } from "../print/aligned.js";
41
- import { writeErr, writeOut } from "./shared.js";
42
- // ---------------------------------------------------------------------------
43
- // Helpers shared by all four commands
44
- // ---------------------------------------------------------------------------
45
- /** Return the live connection, or null. */
46
- const conn = (ctx) => ctx.settings.db;
47
- /** Emit "no current connection" error in the psql style. */
48
- const noConn = (ctx) => {
49
- writeErr(`\\${ctx.cmdName}: no connection to the server\n`);
50
- ctx.settings.lastErrorResult = { message: "no connection to the server" };
51
- return { status: "error" };
52
- };
53
- /** Pull the diagnostic-style error message off a thrown value. */
54
- const errMsg = (err) => err instanceof Error ? err.message : String(err);
55
- /**
56
- * Encode a `Buffer` as a Postgres text-format bytea literal: `\x<hex>`.
57
- * Hex form is unambiguous and works regardless of `bytea_output` or
58
- * `standard_conforming_strings`.
59
- */
60
- const byteaText = (buf) => `\\x${buf.toString("hex")}`;
61
- /**
62
- * Parse a string argument as an unsigned 32-bit OID. Returns `null` on
63
- * malformed input (negative, non-integer, or out of range). Matches the
64
- * permissive behaviour of upstream `atooid`, which accepts any leading
65
- * digit run.
66
- */
67
- const parseOid = (raw) => {
68
- if (!/^\d+$/.test(raw))
69
- return null;
70
- const n = Number(raw);
71
- if (!Number.isFinite(n) || n < 0 || n > 0xffffffff)
72
- return null;
73
- return n;
74
- };
75
- /**
76
- * Coerce a single cell coming back from the protocol layer into a string.
77
- * Used by the `\lo_list` renderer. Matches the helper in
78
- * `describe/formatters.ts`.
79
- */
80
- const cellToString = (v) => {
81
- if (v === null || v === undefined)
82
- return "";
83
- if (typeof v === "string")
84
- return v;
85
- if (Buffer.isBuffer(v))
86
- return v.toString("utf-8");
87
- if (typeof v === "number" ||
88
- typeof v === "boolean" ||
89
- typeof v === "bigint") {
90
- return String(v);
91
- }
92
- try {
93
- return JSON.stringify(v);
94
- }
95
- catch {
96
- return "";
97
- }
98
- };
99
- // ---------------------------------------------------------------------------
100
- // \lo_list / \lo_list+
101
- // ---------------------------------------------------------------------------
102
- /**
103
- * Render the result of `listLargeObjects` through the aligned printer.
104
- * The query body itself lives in `describe/queries.ts` (WP-20) — we just
105
- * dispatch to it and feed the result through `alignedPrinter` with the
106
- * upstream "Large objects" title.
107
- */
108
- const runLoList = async (ctx, verbose) => {
109
- const c = conn(ctx);
110
- if (!c)
111
- return noConn(ctx);
112
- const query = listLargeObjects({ verbose, serverVersion: c.serverVersion });
113
- try {
114
- const rs = await c.query(query.sql, query.params);
115
- const coerced = {
116
- ...rs,
117
- rows: rs.rows.map((row) => row.map((v) => v === null || v === undefined ? null : cellToString(v))),
118
- };
119
- const titleOverride = query.description ?? ctx.settings.popt.title;
120
- const opts = {
121
- ...ctx.settings.popt,
122
- title: titleOverride,
123
- topt: {
124
- ...ctx.settings.popt.topt,
125
- title: titleOverride ?? ctx.settings.popt.topt.title,
126
- },
127
- };
128
- await alignedPrinter.printQuery(coerced, opts, process.stdout);
129
- return { status: "ok" };
130
- }
131
- catch (err) {
132
- writeErr(`\\${ctx.cmdName}: ${errMsg(err)}\n`);
133
- ctx.settings.lastErrorResult = { message: errMsg(err) };
134
- return { status: "error" };
135
- }
136
- };
137
- /** `\lo_list` — non-verbose listing. */
138
- export const cmdLoList = {
139
- name: "lo_list",
140
- helpKey: "lo_list",
141
- run: (ctx) => runLoList(ctx, false),
142
- };
143
- /** `\lo_list+` — verbose listing (adds Access privileges column). */
144
- export const cmdLoListPlus = {
145
- name: "lo_list+",
146
- helpKey: "lo_list",
147
- run: (ctx) => runLoList(ctx, true),
148
- };
149
- // ---------------------------------------------------------------------------
150
- // \lo_import FILE [COMMENT]
151
- // ---------------------------------------------------------------------------
152
- /**
153
- * `\lo_import FILE [COMMENT]`.
154
- *
155
- * Strategy:
156
- * 1. `fs.readFile(file)` → Buffer.
157
- * 2. `SELECT pg_catalog.lo_from_bytea(0, $1::bytea)` → new OID. The
158
- * bytea param is the file's bytes serialized as `\x<hex>` text.
159
- * 3. If COMMENT was supplied: `COMMENT ON LARGE OBJECT <oid> IS
160
- * '<escaped>'` (single execSimple round-trip, escaped via the
161
- * connection's `escapeLiteral`).
162
- * 4. Print `lo_import <oid>\n` and set the `LASTOID` variable.
163
- *
164
- * Errors fall through to the standard `\lo_import: <msg>` diagnostic.
165
- */
166
- export const cmdLoImport = {
167
- name: "lo_import",
168
- helpKey: "lo_import",
169
- run: async (ctx) => {
170
- const c = conn(ctx);
171
- if (!c)
172
- return noConn(ctx);
173
- const file = ctx.nextArg("normal");
174
- if (file === null || file.length === 0) {
175
- writeErr("\\lo_import: missing required argument\n");
176
- ctx.settings.lastErrorResult = {
177
- message: "missing required argument",
178
- };
179
- return { status: "error" };
180
- }
181
- // Comment is the next lexed slash-arg token, mirroring upstream
182
- // `do_lo_import`'s second `psql_scan_slash_option(OT_NORMAL)`. Using the
183
- // lexer (not the raw line) means it picks up the token AFTER the file —
184
- // `restOfLine()` ignored the read cursor and re-included the filename
185
- // itself in the comment.
186
- const commentRaw = ctx.nextArg("normal");
187
- const comment = commentRaw !== null && commentRaw.length > 0 ? commentRaw : null;
188
- let bytes;
189
- try {
190
- bytes = await fsPromises.readFile(file);
191
- }
192
- catch (err) {
193
- writeErr(`\\lo_import: ${errMsg(err)}\n`);
194
- ctx.settings.lastErrorResult = { message: errMsg(err) };
195
- return { status: "error" };
196
- }
197
- let oidStr;
198
- try {
199
- const rs = await c.query("SELECT pg_catalog.lo_from_bytea(0, $1::bytea)", [byteaText(bytes)]);
200
- if (rs.rows.length === 0) {
201
- throw new Error("lo_from_bytea returned no rows");
202
- }
203
- oidStr = cellToString(rs.rows[0][0]);
204
- if (!/^\d+$/.test(oidStr)) {
205
- throw new Error(`lo_from_bytea returned invalid oid: ${oidStr}`);
206
- }
207
- }
208
- catch (err) {
209
- writeErr(`\\lo_import: ${errMsg(err)}\n`);
210
- ctx.settings.lastErrorResult = { message: errMsg(err) };
211
- return { status: "error" };
212
- }
213
- if (comment !== null) {
214
- try {
215
- await c.execSimple(`COMMENT ON LARGE OBJECT ${oidStr} IS ${c.escapeLiteral(comment)}`);
216
- }
217
- catch (err) {
218
- writeErr(`\\lo_import: ${errMsg(err)}\n`);
219
- ctx.settings.lastErrorResult = { message: errMsg(err) };
220
- return { status: "error" };
221
- }
222
- }
223
- // Side effect: set LASTOID (matches upstream `do_lo_import`).
224
- ctx.settings.vars.set("LASTOID", oidStr);
225
- writeOut(`lo_import ${oidStr}\n`);
226
- return { status: "ok" };
227
- },
228
- };
229
- // ---------------------------------------------------------------------------
230
- // \lo_export OID FILE
231
- // ---------------------------------------------------------------------------
232
- /**
233
- * `\lo_export OID FILE`.
234
- *
235
- * `SELECT pg_catalog.lo_get($1::oid)` returns a single-row, single-col
236
- * result whose cell is the LO's bytes. We then `fs.writeFile` to the
237
- * supplied path. The protocol layer decodes bytea text into a `Buffer`
238
- * for us when the column oid is bytea; if we get a `\x...` string back
239
- * we decode it explicitly.
240
- *
241
- * Print `lo_export\n` on success — matches upstream `do_lo_export`.
242
- */
243
- export const cmdLoExport = {
244
- name: "lo_export",
245
- helpKey: "lo_export",
246
- run: async (ctx) => {
247
- const c = conn(ctx);
248
- if (!c)
249
- return noConn(ctx);
250
- const oidArg = ctx.nextArg("normal");
251
- const file = ctx.nextArg("normal");
252
- if (oidArg === null || file === null || file.length === 0) {
253
- writeErr("\\lo_export: missing required argument\n");
254
- ctx.settings.lastErrorResult = {
255
- message: "missing required argument",
256
- };
257
- return { status: "error" };
258
- }
259
- const oid = parseOid(oidArg);
260
- if (oid === null) {
261
- writeErr(`\\lo_export: "${oidArg}" is not a valid large object OID\n`);
262
- ctx.settings.lastErrorResult = { message: "invalid OID" };
263
- return { status: "error" };
264
- }
265
- let bytes;
266
- try {
267
- const rs = await c.query("SELECT pg_catalog.lo_get($1::oid)", [
268
- oid,
269
- ]);
270
- if (rs.rows.length === 0) {
271
- throw new Error("lo_get returned no rows");
272
- }
273
- const cell = rs.rows[0][0];
274
- bytes = coerceBytea(cell);
275
- }
276
- catch (err) {
277
- writeErr(`\\lo_export: ${errMsg(err)}\n`);
278
- ctx.settings.lastErrorResult = { message: errMsg(err) };
279
- return { status: "error" };
280
- }
281
- try {
282
- await fsPromises.writeFile(file, bytes);
283
- }
284
- catch (err) {
285
- writeErr(`\\lo_export: ${errMsg(err)}\n`);
286
- ctx.settings.lastErrorResult = { message: errMsg(err) };
287
- return { status: "error" };
288
- }
289
- writeOut("lo_export\n");
290
- return { status: "ok" };
291
- },
292
- };
293
- /**
294
- * Decode a bytea cell coming back from the protocol. The connection may
295
- * deliver:
296
- * - a `Buffer` (decoded by a future binary-format path)
297
- * - a `\x<hex>` string (text format, modern)
298
- * - a legacy `octal-escape` string (text format, pre-9.0 servers; we
299
- * don't generate this but it's the historical default).
300
- */
301
- const coerceBytea = (cell) => {
302
- if (Buffer.isBuffer(cell))
303
- return cell;
304
- if (typeof cell !== "string") {
305
- throw new Error(`lo_get returned unexpected cell type: ${typeof cell}`);
306
- }
307
- if (cell.startsWith("\\x")) {
308
- return Buffer.from(cell.slice(2), "hex");
309
- }
310
- // Legacy octal-escape decode (`\\\\NNN` → byte, `\\\\` → `\\`, others
311
- // pass through). Upstream `PQunescapeBytea` does the same.
312
- const out = [];
313
- let i = 0;
314
- while (i < cell.length) {
315
- if (cell[i] === "\\") {
316
- if (cell[i + 1] === "\\") {
317
- out.push(0x5c);
318
- i += 2;
319
- continue;
320
- }
321
- if (/^[0-7][0-7][0-7]$/.test(cell.slice(i + 1, i + 4))) {
322
- out.push(parseInt(cell.slice(i + 1, i + 4), 8));
323
- i += 4;
324
- continue;
325
- }
326
- }
327
- out.push(cell.charCodeAt(i));
328
- i++;
329
- }
330
- return Buffer.from(out);
331
- };
332
- // ---------------------------------------------------------------------------
333
- // \lo_unlink OID
334
- // ---------------------------------------------------------------------------
335
- /**
336
- * `\lo_unlink OID` — drop a large object by OID. Implemented via
337
- * `SELECT pg_catalog.lo_unlink($1::oid)`. The function returns `1` on
338
- * success or raises an ERROR on missing OID; we just surface either
339
- * outcome.
340
- *
341
- * Print `lo_unlink <oid>\n` on success.
342
- */
343
- export const cmdLoUnlink = {
344
- name: "lo_unlink",
345
- helpKey: "lo_unlink",
346
- run: async (ctx) => {
347
- const c = conn(ctx);
348
- if (!c)
349
- return noConn(ctx);
350
- const oidArg = ctx.nextArg("normal");
351
- if (oidArg === null) {
352
- writeErr("\\lo_unlink: missing required argument\n");
353
- ctx.settings.lastErrorResult = {
354
- message: "missing required argument",
355
- };
356
- return { status: "error" };
357
- }
358
- const oid = parseOid(oidArg);
359
- if (oid === null) {
360
- writeErr(`\\lo_unlink: "${oidArg}" is not a valid large object OID\n`);
361
- ctx.settings.lastErrorResult = { message: "invalid OID" };
362
- return { status: "error" };
363
- }
364
- try {
365
- await c.query("SELECT pg_catalog.lo_unlink($1::oid)", [oid]);
366
- }
367
- catch (err) {
368
- writeErr(`\\lo_unlink: ${errMsg(err)}\n`);
369
- ctx.settings.lastErrorResult = { message: errMsg(err) };
370
- return { status: "error" };
371
- }
372
- writeOut(`lo_unlink ${String(oid)}\n`);
373
- return { status: "ok" };
374
- },
375
- };
376
- // ---------------------------------------------------------------------------
377
- // Registration
378
- // ---------------------------------------------------------------------------
379
- /**
380
- * Register the four large-object commands on the supplied registry.
381
- * Called from `dispatch.ts::defaultRegistry()` (one new line).
382
- *
383
- * Note: `\lo_list` and `\lo_list+` shadow the existing `dl::lo_list`
384
- * alias from `cmd_describe.ts` — the registry's lookup checks primary
385
- * names before alias mappings, so this registration is the winning one.
386
- */
387
- export const registerLargeObjectCommands = (registry) => {
388
- registry.register(cmdLoList);
389
- registry.register(cmdLoListPlus);
390
- registry.register(cmdLoImport);
391
- registry.register(cmdLoExport);
392
- registry.register(cmdLoUnlink);
393
- };