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
package/dist/api.js DELETED
@@ -1,720 +0,0 @@
1
- // Thin fetch-based client layer over `@neon/sdk` (the official, fetch-native
2
- // Neon SDK). neonctl was originally built on the axios-based
3
- // `@neondatabase/api-client`, whose generated `Api` object exposes one
4
- // positional method per endpoint and resolves to an `AxiosResponse`. This module
5
- // reproduces exactly the subset of `Api` methods neonctl uses, backed by the
6
- // tree-shakeable `@neon/sdk/raw` functions, and returns a small
7
- // `{ data, status, headers }` envelope the call sites destructure.
8
- //
9
- // On a non-2xx response (or a network/timeout failure) it throws a single typed
10
- // {@link NeonApiError}; every call site narrows failures with
11
- // {@link isNeonApiError} and reads `error.status` / `error.data`. There is no
12
- // axios anywhere in neonctl: requests go through the global `fetch`, and this is
13
- // the one place HTTP errors are shaped.
14
- import { Readable } from "node:stream";
15
- import * as raw from "@neon/sdk/raw";
16
- import { createClient, createConfig } from "@neon/sdk/raw";
17
- import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
18
- import { log } from "./log.js";
19
- import pkg from "./pkg.js";
20
- // Node's global `fetch` (undici) ignores HTTP_PROXY / HTTPS_PROXY / NO_PROXY,
21
- // whereas the axios-based client neonctl used previously honored them. Restore
22
- // that behaviour by installing a proxy-aware global dispatcher — but only when a
23
- // proxy is actually configured, so the default (no-proxy) path stays untouched.
24
- // This covers every `fetch` neonctl makes, including the direct S3 upload.
25
- const PROXY_ENV_VARS = [
26
- "HTTP_PROXY",
27
- "http_proxy",
28
- "HTTPS_PROXY",
29
- "https_proxy",
30
- "ALL_PROXY",
31
- "all_proxy",
32
- ];
33
- if (PROXY_ENV_VARS.some((name) => process.env[name])) {
34
- setGlobalDispatcher(new EnvHttpProxyAgent());
35
- }
36
- const DEFAULT_API_HOST = "https://console.neon.tech/api/v2";
37
- const REQUEST_TIMEOUT_MS = 60000;
38
- const USER_AGENT = `neonctl v${pkg.version}`;
39
- /** Mirrors the api-client `ContentType` enum used by the `request()` escape hatch. */
40
- export var ContentType;
41
- (function (ContentType) {
42
- ContentType["Json"] = "application/json";
43
- ContentType["FormData"] = "multipart/form-data";
44
- ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
45
- ContentType["Text"] = "text/plain";
46
- })(ContentType || (ContentType = {}));
47
- /**
48
- * The single error type thrown by the neonctl API layer. It carries the HTTP
49
- * status and parsed body for a non-2xx response, or a `code` (e.g. `ETIMEDOUT`)
50
- * for a network/timeout failure. Call sites narrow with {@link isNeonApiError}
51
- * and read `status` / `data` rather than reaching into an axios-shaped object.
52
- */
53
- export class NeonApiError extends Error {
54
- constructor(message, init = {}) {
55
- super(message);
56
- this.name = "NeonApiError";
57
- this.status = init.status;
58
- this.statusText = init.statusText;
59
- this.data = init.data;
60
- this.headers = init.headers;
61
- this.requestPath = init.requestPath;
62
- this.code = init.code;
63
- }
64
- }
65
- /** Narrow an unknown error to a {@link NeonApiError}. */
66
- export function isNeonApiError(err) {
67
- return err instanceof NeonApiError;
68
- }
69
- /** Extract a `message` string from a parsed error body, if present. */
70
- export function messageFromBody(body) {
71
- if (body && typeof body === "object" && "message" in body) {
72
- const message = body.message;
73
- if (typeof message === "string")
74
- return message;
75
- }
76
- return undefined;
77
- }
78
- /** Extract a machine-readable `code` string from a parsed error body, if present. */
79
- export function codeFromBody(body) {
80
- if (body && typeof body === "object" && "code" in body) {
81
- const code = body.code;
82
- if (typeof code === "string")
83
- return code;
84
- }
85
- return undefined;
86
- }
87
- /**
88
- * Adapt a WHATWG `ReadableStream` (what `fetch` gives us as `response.body`) to
89
- * a Node `Readable`, so callers can `pipeline()` the body straight to disk. Done
90
- * by hand rather than `Readable.fromWeb` to sidestep the DOM-vs-`node:stream/web`
91
- * `ReadableStream` type friction without an unsafe cast.
92
- */
93
- function webStreamToNodeReadable(body) {
94
- const reader = body.getReader();
95
- return new Readable({
96
- async read() {
97
- try {
98
- const { done, value } = await reader.read();
99
- this.push(done ? null : Buffer.from(value));
100
- }
101
- catch (err) {
102
- this.destroy(err instanceof Error ? err : new Error(String(err)));
103
- }
104
- },
105
- });
106
- }
107
- function headersToObject(headers) {
108
- const out = {};
109
- headers.forEach((value, key) => {
110
- out[key] = value;
111
- });
112
- return out;
113
- }
114
- function isAbortError(err) {
115
- return (err instanceof Error &&
116
- (err.name === "AbortError" || err.name === "TimeoutError"));
117
- }
118
- /**
119
- * Walk an error's `cause` chain to find the underlying socket/DNS `code` (e.g.
120
- * `ECONNREFUSED`, `ENOTFOUND`) — `fetch` surfaces these as the `cause` of a bare
121
- * `TypeError: fetch failed`. Preserving the code lets `isNetworkError` classify
122
- * the resulting {@link NeonApiError} as a connectivity failure.
123
- */
124
- function readSocketCode(err) {
125
- let current = err;
126
- for (let depth = 0; depth < 6 && current != null; depth++) {
127
- if (typeof current === "object" && "code" in current) {
128
- const code = current.code;
129
- if (typeof code === "string")
130
- return code;
131
- }
132
- current = current.cause;
133
- }
134
- return undefined;
135
- }
136
- /**
137
- * The wrapped `@neon/sdk/raw` layer surfaces a typed `NeonError` on `.error`, whose `.body`
138
- * holds the original parsed API error body. Unwrap it so {@link httpError} sees the body
139
- * (message/code) rather than the SDK wrapper object.
140
- */
141
- function rawErrorBody(error) {
142
- if (error && typeof error === "object" && "body" in error) {
143
- return error.body;
144
- }
145
- return error;
146
- }
147
- /** Build a {@link NeonApiError} from a non-2xx `Response` and its parsed body. */
148
- function httpError(response, body) {
149
- let requestPath;
150
- try {
151
- requestPath = new URL(response.url).pathname;
152
- }
153
- catch {
154
- // response.url may be empty in some runtimes; the path is best-effort.
155
- }
156
- return new NeonApiError(messageFromBody(body) ??
157
- `Request failed with status code ${response.status}`, {
158
- status: response.status,
159
- statusText: response.statusText,
160
- data: body,
161
- headers: headersToObject(response.headers),
162
- requestPath,
163
- });
164
- }
165
- /**
166
- * Translate a thrown `fetch` failure into a {@link NeonApiError}. A request
167
- * timeout uses `ECONNABORTED` (matching the old axios behaviour, and excluded
168
- * from `isNetworkError`'s connectivity codes so it's still reported as a
169
- * timeout). A connection failure keeps its real socket code (e.g.
170
- * `ECONNREFUSED`) so `isNetworkError` recognises it as a connectivity problem.
171
- */
172
- function networkError(err) {
173
- if (isAbortError(err)) {
174
- return new NeonApiError("Request timed out", { code: "ECONNABORTED" });
175
- }
176
- return new NeonApiError(err instanceof Error ? err.message : String(err), {
177
- code: readSocketCode(err) ?? "ENETWORK",
178
- });
179
- }
180
- /**
181
- * `fetch` with neonctl's request timeout applied (preserving any caller signal)
182
- * and lightweight debug logging of the request line + response status — the
183
- * fetch-native replacement for the old `axios-debug-log` wiring.
184
- */
185
- const timedFetch = async (input, init) => {
186
- const timeout = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
187
- const signal = init?.signal
188
- ? AbortSignal.any([init.signal, timeout])
189
- : timeout;
190
- const method = init?.method ?? (input instanceof Request ? input.method : "GET");
191
- const url = input instanceof Request ? input.url : String(input);
192
- log.debug("%s %s", method.toUpperCase(), url);
193
- const response = await fetch(input, { ...init, signal });
194
- log.debug("%d %s", response.status, response.statusText);
195
- return response;
196
- };
197
- const RETRY_COUNT = 5;
198
- const RETRY_DELAY = 3000;
199
- /**
200
- * Retry a call while the API answers 423 (Locked) — Neon's "a prior mutation on
201
- * this resource is still in flight" signal.
202
- */
203
- export const retryOnLock = async (fn) => {
204
- let attempt = 0;
205
- let errOut;
206
- while (attempt < RETRY_COUNT) {
207
- try {
208
- return await fn();
209
- }
210
- catch (err) {
211
- errOut = err;
212
- if (isNeonApiError(err) && err.status === 423) {
213
- attempt++;
214
- log.info(`Resource is locked. Waiting ${RETRY_DELAY}ms before retrying...`);
215
- await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY));
216
- }
217
- else {
218
- throw err;
219
- }
220
- }
221
- }
222
- throw errOut;
223
- };
224
- function buildUrl(apiHost, path, query) {
225
- const url = new URL(`${apiHost.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`);
226
- if (query) {
227
- for (const [key, value] of Object.entries(query)) {
228
- if (value === undefined || value === null)
229
- continue;
230
- url.searchParams.set(key, String(value));
231
- }
232
- }
233
- return url.toString();
234
- }
235
- async function readJsonBody(response) {
236
- const text = await response.text();
237
- if (text.trim() === "")
238
- return undefined;
239
- try {
240
- return JSON.parse(text);
241
- }
242
- catch {
243
- // Match axios' `responseType: 'json'` behaviour: a body that isn't valid
244
- // JSON is surfaced as the raw string rather than coerced into an object, so
245
- // callers' `body?.message` checks correctly see "no structured message".
246
- return text;
247
- }
248
- }
249
- export const getApiClient = ({ apiKey, apiHost }) => {
250
- const baseUrl = apiHost ?? DEFAULT_API_HOST;
251
- const client = createClient(createConfig({
252
- auth: () => apiKey,
253
- baseUrl,
254
- fetch: timedFetch,
255
- headers: { "User-Agent": USER_AGENT },
256
- }));
257
- /** Await a raw call, unwrap to a `{ data, status, headers }` envelope, or throw {@link NeonApiError}. */
258
- async function call(run) {
259
- let result;
260
- try {
261
- result = await run();
262
- }
263
- catch (err) {
264
- throw networkError(err);
265
- }
266
- const response = result.response;
267
- if (!response) {
268
- throw networkError(result.error ?? new Error("No response from Neon API"));
269
- }
270
- if (!response.ok) {
271
- throw httpError(response, rawErrorBody(result.error) ?? result.data);
272
- }
273
- return {
274
- data: result.data,
275
- status: response.status,
276
- statusText: response.statusText,
277
- headers: headersToObject(response.headers),
278
- };
279
- }
280
- /**
281
- * Low-level request used by the object-storage and functions helpers for
282
- * endpoints not (yet) modeled as typed SDK functions. Mirrors the api-client
283
- * `HttpClient.request()`: `format: 'json'` parses the body, `format: 'stream'`
284
- * returns a Node `Readable`, and `type: ContentType.FormData` sends multipart.
285
- */
286
- async function request(params) {
287
- const url = buildUrl(baseUrl, params.path, params.query);
288
- const headers = { "User-Agent": USER_AGENT };
289
- if (params.secure !== false) {
290
- headers.Authorization = `Bearer ${apiKey}`;
291
- }
292
- let payload;
293
- if (params.body instanceof FormData ||
294
- params.type === ContentType.FormData) {
295
- payload = params.body;
296
- }
297
- else if (params.body !== undefined) {
298
- headers["Content-Type"] = ContentType.Json;
299
- payload = JSON.stringify(params.body);
300
- }
301
- // Caller-supplied headers win over the defaults set above.
302
- if (params.headers) {
303
- for (const [key, value] of Object.entries(params.headers)) {
304
- headers[key] = value;
305
- }
306
- }
307
- let response;
308
- try {
309
- response = await timedFetch(url, {
310
- method: params.method,
311
- headers,
312
- ...(payload !== undefined ? { body: payload } : {}),
313
- });
314
- }
315
- catch (err) {
316
- throw networkError(err);
317
- }
318
- if (!response.ok) {
319
- // For a streamed download the error body arrives as a stream too; hand it
320
- // back as a Node `Readable` so the caller can drain it for a message.
321
- const errorBody = params.format === "stream" && response.body
322
- ? webStreamToNodeReadable(response.body)
323
- : await readJsonBody(response);
324
- throw httpError(response, errorBody);
325
- }
326
- let data;
327
- if (params.format === "stream") {
328
- data = response.body
329
- ? webStreamToNodeReadable(response.body)
330
- : undefined;
331
- }
332
- else {
333
- data = await readJsonBody(response);
334
- }
335
- return {
336
- data: data,
337
- status: response.status,
338
- statusText: response.statusText,
339
- headers: headersToObject(response.headers),
340
- };
341
- }
342
- return {
343
- request,
344
- // ─── Account / user ──────────────────────────────────────────────────
345
- getCurrentUserInfo: () => call(() => raw.getCurrentUserInfo({ client })),
346
- getCurrentUserOrganizations: () => call(() => raw.getCurrentUserOrganizations({ client })),
347
- getAuthDetails: () => call(() => raw.getAuthDetails({ client })),
348
- getActiveRegions: () => call(() => raw.getActiveRegions({ client })),
349
- // ─── Projects ────────────────────────────────────────────────────────
350
- listProjects: (query = {}) => call(() => raw.listProjects({ client, query })),
351
- listSharedProjects: (query = {}) => call(() => raw.listSharedProjects({
352
- client,
353
- query: {
354
- ...(query.cursor !== undefined
355
- ? { cursor: query.cursor }
356
- : {}),
357
- ...(query.limit !== undefined
358
- ? { limit: query.limit }
359
- : {}),
360
- ...(query.search !== undefined
361
- ? { search: query.search }
362
- : {}),
363
- },
364
- })),
365
- getProject: (projectId) => call(() => raw.getProject({ client, path: { project_id: projectId } })),
366
- createProject: (data) => call(() => raw.createProject({ client, body: data })),
367
- updateProject: (projectId, data) => call(() => raw.updateProject({
368
- client,
369
- path: { project_id: projectId },
370
- body: data,
371
- })),
372
- deleteProject: (projectId) => call(() => raw.deleteProject({ client, path: { project_id: projectId } })),
373
- recoverProject: (projectId) => call(() => raw.recoverProject({ client, path: { project_id: projectId } })),
374
- listProjectOperations: ({ projectId, ...query }) => call(() => raw.listProjectOperations({
375
- client,
376
- path: { project_id: projectId },
377
- query,
378
- })),
379
- // ─── Branches ────────────────────────────────────────────────────────
380
- listProjectBranches: ({ projectId, ...query }) => call(() => raw.listProjectBranches({
381
- client,
382
- path: { project_id: projectId },
383
- query,
384
- })),
385
- createProjectBranch: (projectId, data) => call(() => raw.createProjectBranch({
386
- client,
387
- path: { project_id: projectId },
388
- ...(data !== undefined ? { body: data } : {}),
389
- })),
390
- getProjectBranch: (projectId, branchId) => call(() => raw.getProjectBranch({
391
- client,
392
- path: { project_id: projectId, branch_id: branchId },
393
- })),
394
- updateProjectBranch: (projectId, branchId, data) => call(() => raw.updateProjectBranch({
395
- client,
396
- path: { project_id: projectId, branch_id: branchId },
397
- body: data,
398
- })),
399
- deleteProjectBranch: (projectId, branchId) => call(() => raw.deleteProjectBranch({
400
- client,
401
- path: { project_id: projectId, branch_id: branchId },
402
- })),
403
- restoreProjectBranch: (projectId, branchId, data) => call(() => raw.restoreProjectBranch({
404
- client,
405
- path: { project_id: projectId, branch_id: branchId },
406
- body: data,
407
- })),
408
- setDefaultProjectBranch: (projectId, branchId) => call(() => raw.setDefaultProjectBranch({
409
- client,
410
- path: { project_id: projectId, branch_id: branchId },
411
- })),
412
- getProjectBranchSchema: ({ projectId, branchId, ...query }) => call(() => raw.getProjectBranchSchema({
413
- client,
414
- path: { project_id: projectId, branch_id: branchId },
415
- query,
416
- })),
417
- listProjectBranchEndpoints: (projectId, branchId) => call(() => raw.listProjectBranchEndpoints({
418
- client,
419
- path: { project_id: projectId, branch_id: branchId },
420
- })),
421
- createProjectEndpoint: (projectId, data) => call(() => raw.createProjectEndpoint({
422
- client,
423
- path: { project_id: projectId },
424
- body: data,
425
- })),
426
- // ─── Snapshots ───────────────────────────────────────────────────────
427
- listSnapshots: (projectId) => call(() => raw.listSnapshots({
428
- client,
429
- path: { project_id: projectId },
430
- })),
431
- createSnapshot: (projectId, branchId, query) => call(() => raw.createSnapshot({
432
- client,
433
- path: { project_id: projectId, branch_id: branchId },
434
- ...(query !== undefined ? { query } : {}),
435
- })),
436
- updateSnapshot: (projectId, snapshotId, data) => call(() => raw.updateSnapshot({
437
- client,
438
- path: { project_id: projectId, snapshot_id: snapshotId },
439
- body: data,
440
- })),
441
- deleteSnapshot: (projectId, snapshotId) => call(() => raw.deleteSnapshot({
442
- client,
443
- path: { project_id: projectId, snapshot_id: snapshotId },
444
- })),
445
- restoreSnapshot: (projectId, snapshotId, data) => call(() => raw.restoreSnapshot({
446
- client,
447
- path: { project_id: projectId, snapshot_id: snapshotId },
448
- ...(data !== undefined ? { body: data } : {}),
449
- })),
450
- finalizeRestoreBranch: (projectId, branchId, data) => call(() => raw.finalizeRestoreBranch({
451
- client,
452
- path: { project_id: projectId, branch_id: branchId },
453
- ...(data !== undefined ? { body: data } : {}),
454
- })),
455
- getSnapshotSchedule: (projectId, branchId) => call(() => raw.getSnapshotSchedule({
456
- client,
457
- path: { project_id: projectId, branch_id: branchId },
458
- })),
459
- setSnapshotSchedule: (projectId, branchId, data) => call(() => raw.setSnapshotSchedule({
460
- client,
461
- path: { project_id: projectId, branch_id: branchId },
462
- body: data,
463
- })),
464
- // ─── Databases ───────────────────────────────────────────────────────
465
- listProjectBranchDatabases: (projectId, branchId) => call(() => raw.listProjectBranchDatabases({
466
- client,
467
- path: { project_id: projectId, branch_id: branchId },
468
- })),
469
- createProjectBranchDatabase: (projectId, branchId, data) => call(() => raw.createProjectBranchDatabase({
470
- client,
471
- path: { project_id: projectId, branch_id: branchId },
472
- body: data,
473
- })),
474
- deleteProjectBranchDatabase: (projectId, branchId, databaseName) => call(() => raw.deleteProjectBranchDatabase({
475
- client,
476
- path: {
477
- project_id: projectId,
478
- branch_id: branchId,
479
- database_name: databaseName,
480
- },
481
- })),
482
- // ─── Roles ───────────────────────────────────────────────────────────
483
- listProjectBranchRoles: (projectId, branchId) => call(() => raw.listProjectBranchRoles({
484
- client,
485
- path: { project_id: projectId, branch_id: branchId },
486
- })),
487
- createProjectBranchRole: (projectId, branchId, data) => call(() => raw.createProjectBranchRole({
488
- client,
489
- path: { project_id: projectId, branch_id: branchId },
490
- body: data,
491
- })),
492
- deleteProjectBranchRole: (projectId, branchId, roleName) => call(() => raw.deleteProjectBranchRole({
493
- client,
494
- path: {
495
- project_id: projectId,
496
- branch_id: branchId,
497
- role_name: roleName,
498
- },
499
- })),
500
- getProjectBranchRolePassword: (projectId, branchId, roleName) => call(() => raw.getProjectBranchRolePassword({
501
- client,
502
- path: {
503
- project_id: projectId,
504
- branch_id: branchId,
505
- role_name: roleName,
506
- },
507
- })),
508
- // ─── Data API ────────────────────────────────────────────────────────
509
- createProjectBranchDataApi: (projectId, branchId, databaseName, data) => call(() => raw.createProjectBranchDataApi({
510
- client,
511
- path: {
512
- project_id: projectId,
513
- branch_id: branchId,
514
- database_name: databaseName,
515
- },
516
- body: data,
517
- })),
518
- updateProjectBranchDataApi: (projectId, branchId, databaseName, data) => call(() => raw.updateProjectBranchDataApi({
519
- client,
520
- path: {
521
- project_id: projectId,
522
- branch_id: branchId,
523
- database_name: databaseName,
524
- },
525
- body: data,
526
- })),
527
- deleteProjectBranchDataApi: (projectId, branchId, databaseName) => call(() => raw.deleteProjectBranchDataApi({
528
- client,
529
- path: {
530
- project_id: projectId,
531
- branch_id: branchId,
532
- database_name: databaseName,
533
- },
534
- })),
535
- getProjectBranchDataApi: (projectId, branchId, databaseName) => call(() => raw.getProjectBranchDataApi({
536
- client,
537
- path: {
538
- project_id: projectId,
539
- branch_id: branchId,
540
- database_name: databaseName,
541
- },
542
- })),
543
- // ─── VPC endpoints (project + organization) ──────────────────────────
544
- listProjectVpcEndpoints: (projectId) => call(() => raw.listProjectVpcEndpoints({
545
- client,
546
- path: { project_id: projectId },
547
- })),
548
- assignProjectVpcEndpoint: (projectId, vpcEndpointId, data) => call(() => raw.assignProjectVpcEndpoint({
549
- client,
550
- path: {
551
- project_id: projectId,
552
- vpc_endpoint_id: vpcEndpointId,
553
- },
554
- body: data,
555
- })),
556
- deleteProjectVpcEndpoint: (projectId, vpcEndpointId) => call(() => raw.deleteProjectVpcEndpoint({
557
- client,
558
- path: {
559
- project_id: projectId,
560
- vpc_endpoint_id: vpcEndpointId,
561
- },
562
- })),
563
- listOrganizationVpcEndpoints: (orgId, regionId) => call(() => raw.listOrganizationVpcEndpoints({
564
- client,
565
- path: { org_id: orgId, region_id: regionId },
566
- })),
567
- getOrganizationVpcEndpointDetails: (orgId, regionId, vpcEndpointId) => call(() => raw.getOrganizationVpcEndpointDetails({
568
- client,
569
- path: {
570
- org_id: orgId,
571
- region_id: regionId,
572
- vpc_endpoint_id: vpcEndpointId,
573
- },
574
- })),
575
- assignOrganizationVpcEndpoint: (orgId, regionId, vpcEndpointId, data) => call(() => raw.assignOrganizationVpcEndpoint({
576
- client,
577
- path: {
578
- org_id: orgId,
579
- region_id: regionId,
580
- vpc_endpoint_id: vpcEndpointId,
581
- },
582
- body: data,
583
- })),
584
- deleteOrganizationVpcEndpoint: (orgId, regionId, vpcEndpointId) => call(() => raw.deleteOrganizationVpcEndpoint({
585
- client,
586
- path: {
587
- org_id: orgId,
588
- region_id: regionId,
589
- vpc_endpoint_id: vpcEndpointId,
590
- },
591
- })),
592
- // ─── Neon Auth ───────────────────────────────────────────────────────
593
- getNeonAuth: (projectId, branchId) => call(() => raw.getNeonAuth({
594
- client,
595
- path: { project_id: projectId, branch_id: branchId },
596
- })),
597
- createNeonAuth: (projectId, branchId, data) => call(() => raw.createNeonAuth({
598
- client,
599
- path: { project_id: projectId, branch_id: branchId },
600
- body: data,
601
- })),
602
- disableNeonAuth: (projectId, branchId, data) => call(() => raw.disableNeonAuth({
603
- client,
604
- path: { project_id: projectId, branch_id: branchId },
605
- body: data,
606
- })),
607
- listBranchNeonAuthOauthProviders: (projectId, branchId) => call(() => raw.listBranchNeonAuthOauthProviders({
608
- client,
609
- path: { project_id: projectId, branch_id: branchId },
610
- })),
611
- addBranchNeonAuthOauthProvider: (projectId, branchId, data) => call(() => raw.addBranchNeonAuthOauthProvider({
612
- client,
613
- path: { project_id: projectId, branch_id: branchId },
614
- body: data,
615
- })),
616
- updateBranchNeonAuthOauthProvider: (projectId, branchId, oauthProviderId, data) => call(() => raw.updateBranchNeonAuthOauthProvider({
617
- client,
618
- path: {
619
- project_id: projectId,
620
- branch_id: branchId,
621
- oauth_provider_id: oauthProviderId,
622
- },
623
- body: data,
624
- })),
625
- deleteBranchNeonAuthOauthProvider: (projectId, branchId, oauthProviderId) => call(() => raw.deleteBranchNeonAuthOauthProvider({
626
- client,
627
- path: {
628
- project_id: projectId,
629
- branch_id: branchId,
630
- oauth_provider_id: oauthProviderId,
631
- },
632
- })),
633
- listBranchNeonAuthTrustedDomains: (projectId, branchId) => call(() => raw.listBranchNeonAuthTrustedDomains({
634
- client,
635
- path: { project_id: projectId, branch_id: branchId },
636
- })),
637
- addBranchNeonAuthTrustedDomain: (projectId, branchId, data) => call(() => raw.addBranchNeonAuthTrustedDomain({
638
- client,
639
- path: { project_id: projectId, branch_id: branchId },
640
- body: data,
641
- })),
642
- deleteBranchNeonAuthTrustedDomain: (projectId, branchId, data) => call(() => raw.deleteBranchNeonAuthTrustedDomain({
643
- client,
644
- path: { project_id: projectId, branch_id: branchId },
645
- body: data,
646
- })),
647
- getNeonAuthAllowLocalhost: (projectId, branchId) => call(() => raw.getNeonAuthAllowLocalhost({
648
- client,
649
- path: { project_id: projectId, branch_id: branchId },
650
- })),
651
- updateNeonAuthAllowLocalhost: (projectId, branchId, data) => call(() => raw.updateNeonAuthAllowLocalhost({
652
- client,
653
- path: { project_id: projectId, branch_id: branchId },
654
- body: data,
655
- })),
656
- getNeonAuthEmailAndPasswordConfig: (projectId, branchId) => call(() => raw.getNeonAuthEmailAndPasswordConfig({
657
- client,
658
- path: { project_id: projectId, branch_id: branchId },
659
- })),
660
- updateNeonAuthEmailAndPasswordConfig: (projectId, branchId, data) => call(() => raw.updateNeonAuthEmailAndPasswordConfig({
661
- client,
662
- path: { project_id: projectId, branch_id: branchId },
663
- body: data,
664
- })),
665
- getNeonAuthEmailProvider: (projectId, branchId) => call(() => raw.getNeonAuthEmailProvider({
666
- client,
667
- path: { project_id: projectId, branch_id: branchId },
668
- })),
669
- updateNeonAuthEmailProvider: (projectId, branchId, data) => call(() => raw.updateNeonAuthEmailProvider({
670
- client,
671
- path: { project_id: projectId, branch_id: branchId },
672
- body: data,
673
- })),
674
- sendNeonAuthTestEmail: (projectId, branchId, data) => call(() => raw.sendNeonAuthTestEmail({
675
- client,
676
- path: { project_id: projectId, branch_id: branchId },
677
- body: data,
678
- })),
679
- getNeonAuthPluginConfigs: (projectId, branchId) => call(() => raw.getNeonAuthPluginConfigs({
680
- client,
681
- path: { project_id: projectId, branch_id: branchId },
682
- })),
683
- updateNeonAuthOrganizationPlugin: (projectId, branchId, data) => call(() => raw.updateNeonAuthOrganizationPlugin({
684
- client,
685
- path: { project_id: projectId, branch_id: branchId },
686
- body: data,
687
- })),
688
- getNeonAuthWebhookConfig: (projectId, branchId) => call(() => raw.getNeonAuthWebhookConfig({
689
- client,
690
- path: { project_id: projectId, branch_id: branchId },
691
- })),
692
- updateNeonAuthWebhookConfig: (projectId, branchId, data) => call(() => raw.updateNeonAuthWebhookConfig({
693
- client,
694
- path: { project_id: projectId, branch_id: branchId },
695
- body: data,
696
- })),
697
- createBranchNeonAuthNewUser: (projectId, branchId, data) => call(() => raw.createBranchNeonAuthNewUser({
698
- client,
699
- path: { project_id: projectId, branch_id: branchId },
700
- body: data,
701
- })),
702
- deleteBranchNeonAuthUser: (projectId, branchId, authUserId) => call(() => raw.deleteBranchNeonAuthUser({
703
- client,
704
- path: {
705
- project_id: projectId,
706
- branch_id: branchId,
707
- auth_user_id: authUserId,
708
- },
709
- })),
710
- updateNeonAuthUserRole: (projectId, branchId, authUserId, data) => call(() => raw.updateNeonAuthUserRole({
711
- client,
712
- path: {
713
- project_id: projectId,
714
- branch_id: branchId,
715
- auth_user_id: authUserId,
716
- },
717
- body: data,
718
- })),
719
- };
720
- };