neon 2.47.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/dist/_shared/auth_selection.js +76 -79
- package/dist/_shared/credentials.js +166 -187
- package/dist/_shared/env-core/env.js +395 -0
- package/dist/_shared/env-core/reuse-secrets.js +179 -0
- package/dist/_shared/paths.js +129 -126
- package/dist/_shared/profiles.js +192 -242
- package/dist/_shared/secure_file.js +36 -38
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/analytics.js +163 -207
- package/dist/api.js +815 -758
- package/dist/auth.js +121 -141
- package/dist/auth_context.js +39 -53
- package/dist/cli.js +4 -7
- package/dist/commands/api.js +220 -250
- package/dist/commands/api_keys.js +251 -314
- package/dist/commands/auth.js +283 -328
- package/dist/commands/bootstrap.js +372 -437
- package/dist/commands/branches.js +304 -455
- package/dist/commands/bucket.js +374 -514
- package/dist/commands/checkout.js +213 -298
- package/dist/commands/config.js +575 -658
- package/dist/commands/connection_string.js +137 -165
- package/dist/commands/data_api.js +238 -260
- package/dist/commands/databases.js +67 -76
- package/dist/commands/deploy.js +31 -25
- package/dist/commands/dev.js +642 -681
- package/dist/commands/diff.js +156 -200
- package/dist/commands/env.js +243 -303
- package/dist/commands/functions.js +275 -341
- package/dist/commands/index.js +70 -65
- package/dist/commands/init.js +84 -119
- package/dist/commands/inspect.js +55 -55
- package/dist/commands/ip_allow.js +88 -120
- package/dist/commands/link.js +874 -1019
- package/dist/commands/logs.js +291 -0
- package/dist/commands/neon_auth.js +725 -933
- package/dist/commands/operations.js +34 -25
- package/dist/commands/orgs.js +28 -18
- package/dist/commands/profile.js +614 -845
- package/dist/commands/projects.js +313 -373
- package/dist/commands/psql.js +60 -58
- package/dist/commands/roles.js +55 -58
- package/dist/commands/schema_diff.js +87 -131
- package/dist/commands/set_context.js +34 -26
- package/dist/commands/snapshots.js +288 -413
- package/dist/commands/status.js +41 -37
- package/dist/commands/user.js +21 -10
- package/dist/commands/vpc_endpoints.js +85 -113
- package/dist/config.js +7 -6
- package/dist/config_format.js +50 -66
- package/dist/config_template.js +128 -157
- package/dist/context.js +183 -235
- package/dist/current_branch_fast_path.js +40 -49
- package/dist/dev/env.js +313 -394
- package/dist/dev/functions.js +54 -64
- package/dist/dev/inputs.js +46 -58
- package/dist/dev/runtime.js +135 -164
- package/dist/dev/websocket.js +766 -959
- package/dist/env.js +27 -33
- package/dist/env_file.js +118 -132
- package/dist/env_services.js +36 -38
- package/dist/errors.js +57 -68
- package/dist/functions_api.js +45 -43
- package/dist/help.js +189 -140
- package/dist/index.js +182 -257
- package/dist/init/agents.js +137 -118
- package/dist/init/auth.js +58 -68
- package/dist/init/bootstrap.js +325 -396
- package/dist/init/build_config.js +4 -2
- package/dist/init/detect_agent.js +56 -101
- package/dist/init/editors.js +35 -52
- package/dist/init/enrich_output.js +51 -66
- package/dist/init/extension.js +134 -171
- package/dist/init/inspect.js +179 -266
- package/dist/init/interactive.js +510 -622
- package/dist/init/neonctl.js +117 -168
- package/dist/init/orchestrate.js +157 -173
- package/dist/init/phases/auth.js +188 -202
- package/dist/init/phases/cleanup.js +23 -23
- package/dist/init/phases/db.js +251 -277
- package/dist/init/phases/getting_started.js +213 -223
- package/dist/init/phases/mcp.js +174 -224
- package/dist/init/phases/migrations.js +247 -248
- package/dist/init/phases/neon_auth.js +114 -133
- package/dist/init/phases/setup.js +546 -703
- package/dist/init/phases/skills.js +75 -86
- package/dist/init/phases/status.js +72 -67
- package/dist/init/resolve_context.js +102 -99
- package/dist/init/route_command.js +91 -98
- package/dist/init/skills.js +174 -218
- package/dist/init/vsix.js +77 -99
- package/dist/log.js +17 -16
- package/dist/neon_services.js +104 -129
- package/dist/parameters.gen.js +481 -471
- package/dist/pkg.js +17 -19
- package/dist/profile_keys.js +44 -47
- package/dist/psql/cli.js +44 -47
- package/dist/psql/command/cmd_cond.js +231 -406
- package/dist/psql/command/cmd_connect.js +557 -764
- package/dist/psql/command/cmd_copy.js +727 -983
- package/dist/psql/command/cmd_describe.js +1499 -1688
- package/dist/psql/command/cmd_format.js +733 -905
- package/dist/psql/command/cmd_io.js +1293 -2082
- package/dist/psql/command/cmd_lo.js +297 -359
- package/dist/psql/command/cmd_meta.js +727 -878
- package/dist/psql/command/cmd_misc.js +138 -172
- package/dist/psql/command/cmd_pipeline.js +547 -1099
- package/dist/psql/command/cmd_restrict.js +119 -155
- package/dist/psql/command/cmd_show.js +529 -688
- package/dist/psql/command/dispatch.js +261 -325
- package/dist/psql/command/inputQueue.js +35 -33
- package/dist/psql/command/shared.js +49 -63
- package/dist/psql/complete/filenames.js +90 -133
- package/dist/psql/complete/index.js +59 -97
- package/dist/psql/complete/matcher.js +236 -300
- package/dist/psql/complete/psqlVars.js +218 -223
- package/dist/psql/complete/queries.js +159 -177
- package/dist/psql/complete/rules.js +1493 -2299
- package/dist/psql/core/common.js +762 -1180
- package/dist/psql/core/help.js +456 -546
- package/dist/psql/core/mainloop.js +692 -1302
- package/dist/psql/core/prompt.js +391 -408
- package/dist/psql/core/settings.js +429 -644
- package/dist/psql/core/sqlHelp.js +480 -554
- package/dist/psql/core/startup.js +626 -815
- package/dist/psql/core/syncVars.js +67 -110
- package/dist/psql/core/variables.js +156 -278
- package/dist/psql/describe/formatters.js +884 -1285
- package/dist/psql/describe/processNamePattern.js +173 -260
- package/dist/psql/describe/queries.js +1368 -2403
- package/dist/psql/describe/versionGate.js +32 -41
- package/dist/psql/index.js +1414 -1927
- package/dist/psql/io/history.js +232 -271
- package/dist/psql/io/input.js +103 -108
- package/dist/psql/io/lineEditor/buffer.js +238 -319
- package/dist/psql/io/lineEditor/complete.js +135 -213
- package/dist/psql/io/lineEditor/filename.js +139 -148
- package/dist/psql/io/lineEditor/index.js +653 -870
- package/dist/psql/io/lineEditor/keymap.js +544 -702
- package/dist/psql/io/lineEditor/vt100.js +294 -341
- package/dist/psql/io/pgpass.js +158 -187
- package/dist/psql/io/pgservice.js +146 -183
- package/dist/psql/io/psqlrc.js +328 -403
- package/dist/psql/print/aligned.js +1020 -1683
- package/dist/psql/print/asciidoc.js +180 -214
- package/dist/psql/print/crosstab.js +281 -442
- package/dist/psql/print/csv.js +48 -70
- package/dist/psql/print/html.js +195 -226
- package/dist/psql/print/json.js +75 -88
- package/dist/psql/print/latex.js +291 -364
- package/dist/psql/print/pager.js +171 -242
- package/dist/psql/print/troff.js +194 -226
- package/dist/psql/print/unaligned.js +69 -95
- package/dist/psql/print/units.js +167 -169
- package/dist/psql/scanner/slash.js +428 -483
- package/dist/psql/scanner/sql.js +445 -889
- package/dist/psql/scanner/stringutils.js +309 -379
- package/dist/psql/types/index.js +2 -7
- package/dist/psql/types/scanner.js +25 -22
- package/dist/psql/wire/connection.js +2042 -2803
- package/dist/psql/wire/copy.js +84 -100
- package/dist/psql/wire/notify.js +39 -59
- package/dist/psql/wire/pipeline.js +305 -518
- package/dist/psql/wire/protocol.js +349 -417
- package/dist/psql/wire/sasl.js +180 -265
- package/dist/psql/wire/tls.js +400 -561
- package/dist/storage_api.js +115 -129
- package/dist/test_utils/fixtures.js +94 -113
- package/dist/test_utils/oauth_server.js +10 -7
- package/dist/test_utils/project_dir.js +33 -0
- package/dist/utils/ai_gateway_notice.js +131 -162
- package/dist/utils/api_enums.js +21 -28
- package/dist/utils/auth.js +10 -4
- package/dist/utils/branch_notice.js +20 -19
- package/dist/utils/branch_picker.js +83 -89
- package/dist/utils/cli_name.js +15 -12
- package/dist/utils/compute_units.js +20 -27
- package/dist/utils/config_diff.js +127 -158
- package/dist/utils/enrichers.js +95 -148
- package/dist/utils/esbuild.js +133 -147
- package/dist/utils/flags.js +35 -47
- package/dist/utils/formats.js +8 -15
- package/dist/utils/git_diff.js +69 -80
- package/dist/utils/inspect_db.js +101 -143
- package/dist/utils/inspect_queries.js +179 -142
- package/dist/utils/middlewares.js +37 -44
- package/dist/utils/openapi.js +87 -99
- package/dist/utils/package_manager.js +312 -110
- package/dist/utils/point_in_time.js +49 -53
- package/dist/utils/psql.js +89 -106
- package/dist/utils/service_picker.js +55 -58
- package/dist/utils/string.js +5 -5
- package/dist/utils/ui.js +38 -55
- package/dist/utils/write_sync.js +26 -35
- package/dist/utils/zip.js +4 -3
- package/dist/writer.js +67 -87
- package/package.json +9 -7
package/dist/api.js
CHANGED
|
@@ -1,808 +1,865 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.
|
|
1
|
+
import { log } from "./log.js";
|
|
2
|
+
import pkg_default from "./pkg.js";
|
|
14
3
|
import { Readable } from "node:stream";
|
|
15
4
|
import * as raw from "@neon/sdk/raw";
|
|
16
5
|
import { createClient, createConfig } from "@neon/sdk/raw";
|
|
17
6
|
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
}
|
|
7
|
+
//#region src/api.ts
|
|
8
|
+
if ([
|
|
9
|
+
"HTTP_PROXY",
|
|
10
|
+
"http_proxy",
|
|
11
|
+
"HTTPS_PROXY",
|
|
12
|
+
"https_proxy",
|
|
13
|
+
"ALL_PROXY",
|
|
14
|
+
"all_proxy"
|
|
15
|
+
].some((name) => process.env[name])) setGlobalDispatcher(new EnvHttpProxyAgent());
|
|
36
16
|
const DEFAULT_API_HOST = "https://console.neon.tech/api/v2";
|
|
37
|
-
const REQUEST_TIMEOUT_MS =
|
|
38
|
-
const USER_AGENT = `neonctl v${
|
|
17
|
+
const REQUEST_TIMEOUT_MS = 6e4;
|
|
18
|
+
const USER_AGENT = `neonctl v${pkg_default.version}`;
|
|
39
19
|
/** Mirrors the api-client `ContentType` enum used by the `request()` escape hatch. */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
20
|
+
let ContentType = /* @__PURE__ */ function(ContentType) {
|
|
21
|
+
ContentType["Json"] = "application/json";
|
|
22
|
+
ContentType["FormData"] = "multipart/form-data";
|
|
23
|
+
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
24
|
+
ContentType["Text"] = "text/plain";
|
|
25
|
+
return ContentType;
|
|
26
|
+
}({});
|
|
47
27
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
28
|
+
* The single error type thrown by the neonctl API layer. It carries the HTTP
|
|
29
|
+
* status and parsed body for a non-2xx response, or a `code` (e.g. `ETIMEDOUT`)
|
|
30
|
+
* for a network/timeout failure. Call sites narrow with {@link isNeonApiError}
|
|
31
|
+
* and read `status` / `data` rather than reaching into an axios-shaped object.
|
|
32
|
+
*/
|
|
33
|
+
var NeonApiError = class extends Error {
|
|
34
|
+
constructor(message, init = {}) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = "NeonApiError";
|
|
37
|
+
this.status = init.status;
|
|
38
|
+
this.statusText = init.statusText;
|
|
39
|
+
this.data = init.data;
|
|
40
|
+
this.headers = init.headers;
|
|
41
|
+
this.requestPath = init.requestPath;
|
|
42
|
+
this.code = init.code;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
65
45
|
/** Narrow an unknown error to a {@link NeonApiError}. */
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
function isNeonApiError(err) {
|
|
47
|
+
return err instanceof NeonApiError;
|
|
68
48
|
}
|
|
69
49
|
/** Extract a `message` string from a parsed error body, if present. */
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
return undefined;
|
|
50
|
+
function messageFromBody(body) {
|
|
51
|
+
if (body && typeof body === "object" && "message" in body) {
|
|
52
|
+
const message = body.message;
|
|
53
|
+
if (typeof message === "string") return message;
|
|
54
|
+
}
|
|
77
55
|
}
|
|
78
56
|
/** Extract a machine-readable `code` string from a parsed error body, if present. */
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
return undefined;
|
|
57
|
+
function codeFromBody(body) {
|
|
58
|
+
if (body && typeof body === "object" && "code" in body) {
|
|
59
|
+
const code = body.code;
|
|
60
|
+
if (typeof code === "string") return code;
|
|
61
|
+
}
|
|
86
62
|
}
|
|
87
63
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
64
|
+
* Adapt a WHATWG `ReadableStream` (what `fetch` gives us as `response.body`) to
|
|
65
|
+
* a Node `Readable`, so callers can `pipeline()` the body straight to disk. Done
|
|
66
|
+
* by hand rather than `Readable.fromWeb` to sidestep the DOM-vs-`node:stream/web`
|
|
67
|
+
* `ReadableStream` type friction without an unsafe cast.
|
|
68
|
+
*/
|
|
93
69
|
function webStreamToNodeReadable(body) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
});
|
|
70
|
+
const reader = body.getReader();
|
|
71
|
+
return new Readable({ async read() {
|
|
72
|
+
try {
|
|
73
|
+
const { done, value } = await reader.read();
|
|
74
|
+
this.push(done ? null : Buffer.from(value));
|
|
75
|
+
} catch (err) {
|
|
76
|
+
this.destroy(err instanceof Error ? err : new Error(String(err)));
|
|
77
|
+
}
|
|
78
|
+
} });
|
|
106
79
|
}
|
|
107
80
|
function headersToObject(headers) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
81
|
+
const out = {};
|
|
82
|
+
headers.forEach((value, key) => {
|
|
83
|
+
out[key] = value;
|
|
84
|
+
});
|
|
85
|
+
return out;
|
|
113
86
|
}
|
|
114
87
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
88
|
+
* Raised by {@link makeTimedFetch} when the CLI's own request timeout fires. Owning the
|
|
89
|
+
* type is what makes the timeout recognisable further up: `@neon/sdk` reports every
|
|
90
|
+
* transport failure as a `NeonNetworkError`, so matching on names or codes cannot tell a
|
|
91
|
+
* timeout from a reset connection.
|
|
92
|
+
*/
|
|
93
|
+
var RequestTimeoutError = class extends Error {
|
|
94
|
+
constructor(timeoutMs, reason) {
|
|
95
|
+
super(`Request timed out after ${timeoutMs}ms`);
|
|
96
|
+
this.name = "RequestTimeoutError";
|
|
97
|
+
this.reason = reason;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
127
100
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
101
|
+
* Whether a failure was a request timeout rather than a connectivity problem.
|
|
102
|
+
*
|
|
103
|
+
* Walks the `cause` chain, because the SDK wraps whatever `fetch` threw. Before this, the
|
|
104
|
+
* check only looked at the top-level error's `name` — which is `NeonNetworkError` on every
|
|
105
|
+
* SDK path — so a timeout fell through to the connectivity branch and the user was told to
|
|
106
|
+
* check an internet connection that was working.
|
|
107
|
+
*/
|
|
135
108
|
function isAbortError(err) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// does not set them today, but reading them keeps this correct if it ever does.
|
|
146
|
-
const kind = current.kind;
|
|
147
|
-
if (kind === "timeout" || kind === "aborted")
|
|
148
|
-
return true;
|
|
149
|
-
current = current.cause;
|
|
150
|
-
}
|
|
151
|
-
return false;
|
|
109
|
+
let current = err;
|
|
110
|
+
for (let depth = 0; depth < 6 && current != null; depth++) {
|
|
111
|
+
if (current instanceof RequestTimeoutError) return true;
|
|
112
|
+
if (current instanceof Error && (current.name === "AbortError" || current.name === "TimeoutError")) return true;
|
|
113
|
+
const kind = current.kind;
|
|
114
|
+
if (kind === "timeout" || kind === "aborted") return true;
|
|
115
|
+
current = current.cause;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
152
118
|
}
|
|
153
119
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
120
|
+
* Walk an error's `cause` chain to find the underlying socket/DNS `code` (e.g.
|
|
121
|
+
* `ECONNREFUSED`, `ENOTFOUND`) — `fetch` surfaces these as the `cause` of a bare
|
|
122
|
+
* `TypeError: fetch failed`. Preserving the code lets `isNetworkError` classify
|
|
123
|
+
* the resulting {@link NeonApiError} as a connectivity failure.
|
|
124
|
+
*/
|
|
159
125
|
function readSocketCode(err) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
return undefined;
|
|
126
|
+
let current = err;
|
|
127
|
+
for (let depth = 0; depth < 6 && current != null; depth++) {
|
|
128
|
+
if (typeof current === "object" && "code" in current) {
|
|
129
|
+
const code = current.code;
|
|
130
|
+
if (typeof code === "string") return code;
|
|
131
|
+
}
|
|
132
|
+
current = current.cause;
|
|
133
|
+
}
|
|
170
134
|
}
|
|
171
135
|
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
136
|
+
* The wrapped `@neon/sdk/raw` layer surfaces a typed `NeonError` on `.error`, whose `.body`
|
|
137
|
+
* holds the original parsed API error body. Unwrap it so {@link httpError} sees the body
|
|
138
|
+
* (message/code) rather than the SDK wrapper object.
|
|
139
|
+
*/
|
|
176
140
|
function rawErrorBody(error) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
return error;
|
|
141
|
+
if (error && typeof error === "object" && "body" in error) return error.body;
|
|
142
|
+
return error;
|
|
181
143
|
}
|
|
182
144
|
/** Build a {@link NeonApiError} from a non-2xx `Response` and its parsed body. */
|
|
183
145
|
function httpError(response, body) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
data: body,
|
|
196
|
-
headers: headersToObject(response.headers),
|
|
197
|
-
requestPath,
|
|
198
|
-
});
|
|
146
|
+
let requestPath;
|
|
147
|
+
try {
|
|
148
|
+
requestPath = new URL(response.url).pathname;
|
|
149
|
+
} catch {}
|
|
150
|
+
return new NeonApiError(messageFromBody(body) ?? `Request failed with status code ${response.status}`, {
|
|
151
|
+
status: response.status,
|
|
152
|
+
statusText: response.statusText,
|
|
153
|
+
data: body,
|
|
154
|
+
headers: headersToObject(response.headers),
|
|
155
|
+
requestPath
|
|
156
|
+
});
|
|
199
157
|
}
|
|
200
158
|
/**
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
159
|
+
* Translate a thrown `fetch` failure into a {@link NeonApiError}. A request
|
|
160
|
+
* timeout uses `ECONNABORTED` (matching the old axios behaviour, and excluded
|
|
161
|
+
* from `isNetworkError`'s connectivity codes so it's still reported as a
|
|
162
|
+
* timeout). A connection failure keeps its real socket code (e.g.
|
|
163
|
+
* `ECONNREFUSED`) so `isNetworkError` recognises it as a connectivity problem.
|
|
164
|
+
*/
|
|
207
165
|
function networkError(err) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
return new NeonApiError(err instanceof Error ? err.message : String(err), {
|
|
212
|
-
code: readSocketCode(err) ?? "ENETWORK",
|
|
213
|
-
});
|
|
166
|
+
if (isAbortError(err)) return new NeonApiError("Request timed out", { code: "ECONNABORTED" });
|
|
167
|
+
return new NeonApiError(err instanceof Error ? err.message : String(err), { code: readSocketCode(err) ?? "ENETWORK" });
|
|
214
168
|
}
|
|
215
169
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
170
|
+
* `fetch` with neonctl's request timeout applied (preserving any caller signal)
|
|
171
|
+
* and lightweight debug logging of the request line + response status — the
|
|
172
|
+
* fetch-native replacement for the old `axios-debug-log` wiring.
|
|
173
|
+
*/
|
|
220
174
|
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
175
|
+
* The largest delay a timer can represent. Above it Node warns
|
|
176
|
+
* (`TimeoutOverflowWarning`) and fires after 1ms instead.
|
|
177
|
+
*/
|
|
224
178
|
const MAX_TIMER_MS = 2 ** 31 - 1;
|
|
225
179
|
/**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
180
|
+
* Reject a timeout `AbortSignal.timeout` would refuse or silently mistreat.
|
|
181
|
+
*
|
|
182
|
+
* Without this the bad value surfaces as the very failure this classification exists to
|
|
183
|
+
* prevent: `-1`, `NaN`, `Infinity`, fractions and anything above `4294967295` throw
|
|
184
|
+
* `ERR_OUT_OF_RANGE` from inside the fetch wrapper, which is then wrapped as a
|
|
185
|
+
* `NeonNetworkError` and reported as a broken internet connection.
|
|
186
|
+
*
|
|
187
|
+
* `0`, and the band from {@link MAX_TIMER_MS} + 1 up to `4294967295`, are worse still:
|
|
188
|
+
* both are accepted, and both make every request time out immediately — `0` by asking for
|
|
189
|
+
* it, the band because a timer above the signed 32-bit ceiling collapses to 1ms.
|
|
190
|
+
*/
|
|
237
191
|
function validateRequestTimeout(ms) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
return ms;
|
|
192
|
+
if (!Number.isInteger(ms) || ms < 1 || ms > MAX_TIMER_MS) throw new Error(`requestTimeoutMs must be a whole number of milliseconds between 1 and ${MAX_TIMER_MS}; received ${ms}.`);
|
|
193
|
+
return ms;
|
|
242
194
|
}
|
|
243
195
|
const makeTimedFetch = (requestTimeoutMs) => async (input, init) => {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// string code to recognise. Raise something we own instead of leaving the
|
|
261
|
-
// classification to guess.
|
|
262
|
-
if (timeout.aborted && !init?.signal?.aborted) {
|
|
263
|
-
throw new RequestTimeoutError(requestTimeoutMs, err);
|
|
264
|
-
}
|
|
265
|
-
throw err;
|
|
266
|
-
}
|
|
196
|
+
const timeout = AbortSignal.timeout(requestTimeoutMs);
|
|
197
|
+
const signal = init?.signal ? AbortSignal.any([init.signal, timeout]) : timeout;
|
|
198
|
+
const method = init?.method ?? (input instanceof Request ? input.method : "GET");
|
|
199
|
+
const url = input instanceof Request ? input.url : String(input);
|
|
200
|
+
log.debug("%s %s", method.toUpperCase(), url);
|
|
201
|
+
try {
|
|
202
|
+
const response = await fetch(input, {
|
|
203
|
+
...init,
|
|
204
|
+
signal
|
|
205
|
+
});
|
|
206
|
+
log.debug("%d %s", response.status, response.statusText);
|
|
207
|
+
return response;
|
|
208
|
+
} catch (err) {
|
|
209
|
+
if (timeout.aborted && !init?.signal?.aborted) throw new RequestTimeoutError(requestTimeoutMs, err);
|
|
210
|
+
throw err;
|
|
211
|
+
}
|
|
267
212
|
};
|
|
268
213
|
const RETRY_COUNT = 5;
|
|
269
|
-
const RETRY_DELAY =
|
|
214
|
+
const RETRY_DELAY = 3e3;
|
|
270
215
|
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
else {
|
|
289
|
-
throw err;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
throw errOut;
|
|
216
|
+
* Retry a call while the API answers 423 (Locked) — Neon's "a prior mutation on
|
|
217
|
+
* this resource is still in flight" signal.
|
|
218
|
+
*/
|
|
219
|
+
const retryOnLock = async (fn) => {
|
|
220
|
+
let attempt = 0;
|
|
221
|
+
let errOut;
|
|
222
|
+
while (attempt < RETRY_COUNT) try {
|
|
223
|
+
return await fn();
|
|
224
|
+
} catch (err) {
|
|
225
|
+
errOut = err;
|
|
226
|
+
if (isNeonApiError(err) && err.status === 423) {
|
|
227
|
+
attempt++;
|
|
228
|
+
log.info(`Resource is locked. Waiting ${RETRY_DELAY}ms before retrying...`);
|
|
229
|
+
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY));
|
|
230
|
+
} else throw err;
|
|
231
|
+
}
|
|
232
|
+
throw errOut;
|
|
294
233
|
};
|
|
295
234
|
function buildUrl(apiHost, path, query) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return url.toString();
|
|
235
|
+
const url = new URL(`${apiHost.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`);
|
|
236
|
+
if (query) for (const [key, value] of Object.entries(query)) {
|
|
237
|
+
if (value === void 0 || value === null) continue;
|
|
238
|
+
url.searchParams.set(key, String(value));
|
|
239
|
+
}
|
|
240
|
+
return url.toString();
|
|
305
241
|
}
|
|
306
242
|
async function readJsonBody(response) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
// Match axios' `responseType: 'json'` behaviour: a body that isn't valid
|
|
315
|
-
// JSON is surfaced as the raw string rather than coerced into an object, so
|
|
316
|
-
// callers' `body?.message` checks correctly see "no structured message".
|
|
317
|
-
return text;
|
|
318
|
-
}
|
|
243
|
+
const text = await response.text();
|
|
244
|
+
if (text.trim() === "") return void 0;
|
|
245
|
+
try {
|
|
246
|
+
return JSON.parse(text);
|
|
247
|
+
} catch {
|
|
248
|
+
return text;
|
|
249
|
+
}
|
|
319
250
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
251
|
+
const getApiClient = ({ apiKey, apiHost, requestTimeoutMs = REQUEST_TIMEOUT_MS }) => {
|
|
252
|
+
const baseUrl = apiHost ?? DEFAULT_API_HOST;
|
|
253
|
+
const fetchWithTimeout = makeTimedFetch(validateRequestTimeout(requestTimeoutMs));
|
|
254
|
+
const client = createClient(createConfig({
|
|
255
|
+
auth: () => apiKey,
|
|
256
|
+
baseUrl,
|
|
257
|
+
fetch: fetchWithTimeout,
|
|
258
|
+
headers: { "User-Agent": USER_AGENT }
|
|
259
|
+
}));
|
|
260
|
+
/** Await a raw call, unwrap to a `{ data, status, headers }` envelope, or throw {@link NeonApiError}. */
|
|
261
|
+
async function call(run) {
|
|
262
|
+
let result;
|
|
263
|
+
try {
|
|
264
|
+
result = await run();
|
|
265
|
+
} catch (err) {
|
|
266
|
+
throw networkError(err);
|
|
267
|
+
}
|
|
268
|
+
const response = result.response;
|
|
269
|
+
if (!response) throw networkError(result.error ?? /* @__PURE__ */ new Error("No response from Neon API"));
|
|
270
|
+
if (!response.ok) throw httpError(response, rawErrorBody(result.error) ?? result.data);
|
|
271
|
+
return {
|
|
272
|
+
data: result.data,
|
|
273
|
+
status: response.status,
|
|
274
|
+
statusText: response.statusText,
|
|
275
|
+
headers: headersToObject(response.headers)
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Low-level request used by the object-storage and functions helpers for
|
|
280
|
+
* endpoints not (yet) modeled as typed SDK functions. Mirrors the api-client
|
|
281
|
+
* `HttpClient.request()`: `format: 'json'` parses the body, `format: 'stream'`
|
|
282
|
+
* returns a Node `Readable`, and `type: ContentType.FormData` sends multipart.
|
|
283
|
+
*/
|
|
284
|
+
async function request(params) {
|
|
285
|
+
const url = buildUrl(baseUrl, params.path, params.query);
|
|
286
|
+
const headers = { "User-Agent": USER_AGENT };
|
|
287
|
+
if (params.secure !== false) headers.Authorization = `Bearer ${apiKey}`;
|
|
288
|
+
let payload;
|
|
289
|
+
if (params.body instanceof FormData || params.type === "multipart/form-data") payload = params.body;
|
|
290
|
+
else if (params.body !== void 0) {
|
|
291
|
+
headers["Content-Type"] = "application/json";
|
|
292
|
+
payload = JSON.stringify(params.body);
|
|
293
|
+
}
|
|
294
|
+
if (params.headers) for (const [key, value] of Object.entries(params.headers)) headers[key] = value;
|
|
295
|
+
let response;
|
|
296
|
+
try {
|
|
297
|
+
response = await fetchWithTimeout(url, {
|
|
298
|
+
method: params.method,
|
|
299
|
+
headers,
|
|
300
|
+
...payload !== void 0 ? { body: payload } : {}
|
|
301
|
+
});
|
|
302
|
+
} catch (err) {
|
|
303
|
+
throw networkError(err);
|
|
304
|
+
}
|
|
305
|
+
if (!response.ok) {
|
|
306
|
+
const errorBody = params.format === "stream" && response.body ? webStreamToNodeReadable(response.body) : await readJsonBody(response);
|
|
307
|
+
throw httpError(response, errorBody);
|
|
308
|
+
}
|
|
309
|
+
let data;
|
|
310
|
+
if (params.format === "stream") data = response.body ? webStreamToNodeReadable(response.body) : void 0;
|
|
311
|
+
else data = await readJsonBody(response);
|
|
312
|
+
return {
|
|
313
|
+
data,
|
|
314
|
+
status: response.status,
|
|
315
|
+
statusText: response.statusText,
|
|
316
|
+
headers: headersToObject(response.headers)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
request,
|
|
321
|
+
getCurrentUserInfo: () => call(() => raw.getCurrentUserInfo({ client })),
|
|
322
|
+
getCurrentUserOrganizations: () => call(() => raw.getCurrentUserOrganizations({ client })),
|
|
323
|
+
getAuthDetails: () => call(() => raw.getAuthDetails({ client })),
|
|
324
|
+
getActiveRegions: () => call(() => raw.getActiveRegions({ client })),
|
|
325
|
+
listApiKeys: () => call(() => raw.listApiKeys({ client })),
|
|
326
|
+
createApiKey: (body) => call(() => raw.createApiKey({
|
|
327
|
+
client,
|
|
328
|
+
body
|
|
329
|
+
})),
|
|
330
|
+
revokeApiKey: (keyId) => call(() => raw.revokeApiKey({
|
|
331
|
+
client,
|
|
332
|
+
path: { key_id: keyId }
|
|
333
|
+
})),
|
|
334
|
+
listOrgApiKeys: (orgId) => call(() => raw.listOrgApiKeys({
|
|
335
|
+
client,
|
|
336
|
+
path: { org_id: orgId }
|
|
337
|
+
})),
|
|
338
|
+
createOrgApiKey: (orgId, body) => call(() => raw.createOrgApiKey({
|
|
339
|
+
client,
|
|
340
|
+
path: { org_id: orgId },
|
|
341
|
+
body
|
|
342
|
+
})),
|
|
343
|
+
revokeOrgApiKey: (orgId, keyId) => call(() => raw.revokeOrgApiKey({
|
|
344
|
+
client,
|
|
345
|
+
path: {
|
|
346
|
+
org_id: orgId,
|
|
347
|
+
key_id: keyId
|
|
348
|
+
}
|
|
349
|
+
})),
|
|
350
|
+
listProjects: (query = {}) => call(() => raw.listProjects({
|
|
351
|
+
client,
|
|
352
|
+
query
|
|
353
|
+
})),
|
|
354
|
+
listSharedProjects: (query = {}) => call(() => raw.listSharedProjects({
|
|
355
|
+
client,
|
|
356
|
+
query: {
|
|
357
|
+
...query.cursor !== void 0 ? { cursor: query.cursor } : {},
|
|
358
|
+
...query.limit !== void 0 ? { limit: query.limit } : {},
|
|
359
|
+
...query.search !== void 0 ? { search: query.search } : {}
|
|
360
|
+
}
|
|
361
|
+
})),
|
|
362
|
+
getProject: (projectId) => call(() => raw.getProject({
|
|
363
|
+
client,
|
|
364
|
+
path: { project_id: projectId }
|
|
365
|
+
})),
|
|
366
|
+
createProject: (data) => call(() => raw.createProject({
|
|
367
|
+
client,
|
|
368
|
+
body: data
|
|
369
|
+
})),
|
|
370
|
+
updateProject: (projectId, data) => call(() => raw.updateProject({
|
|
371
|
+
client,
|
|
372
|
+
path: { project_id: projectId },
|
|
373
|
+
body: data
|
|
374
|
+
})),
|
|
375
|
+
deleteProject: (projectId) => call(() => raw.deleteProject({
|
|
376
|
+
client,
|
|
377
|
+
path: { project_id: projectId }
|
|
378
|
+
})),
|
|
379
|
+
recoverProject: (projectId) => call(() => raw.recoverProject({
|
|
380
|
+
client,
|
|
381
|
+
path: { project_id: projectId }
|
|
382
|
+
})),
|
|
383
|
+
listProjectOperations: ({ projectId, ...query }) => call(() => raw.listProjectOperations({
|
|
384
|
+
client,
|
|
385
|
+
path: { project_id: projectId },
|
|
386
|
+
query
|
|
387
|
+
})),
|
|
388
|
+
listProjectBranches: ({ projectId, ...query }) => call(() => raw.listProjectBranches({
|
|
389
|
+
client,
|
|
390
|
+
path: { project_id: projectId },
|
|
391
|
+
query
|
|
392
|
+
})),
|
|
393
|
+
createProjectBranch: (projectId, data) => call(() => raw.createProjectBranch({
|
|
394
|
+
client,
|
|
395
|
+
path: { project_id: projectId },
|
|
396
|
+
...data !== void 0 ? { body: data } : {}
|
|
397
|
+
})),
|
|
398
|
+
getProjectBranch: (projectId, branchId) => call(() => raw.getProjectBranch({
|
|
399
|
+
client,
|
|
400
|
+
path: {
|
|
401
|
+
project_id: projectId,
|
|
402
|
+
branch_id: branchId
|
|
403
|
+
}
|
|
404
|
+
})),
|
|
405
|
+
updateProjectBranch: (projectId, branchId, data) => call(() => raw.updateProjectBranch({
|
|
406
|
+
client,
|
|
407
|
+
path: {
|
|
408
|
+
project_id: projectId,
|
|
409
|
+
branch_id: branchId
|
|
410
|
+
},
|
|
411
|
+
body: data
|
|
412
|
+
})),
|
|
413
|
+
deleteProjectBranch: (projectId, branchId) => call(() => raw.deleteProjectBranch({
|
|
414
|
+
client,
|
|
415
|
+
path: {
|
|
416
|
+
project_id: projectId,
|
|
417
|
+
branch_id: branchId
|
|
418
|
+
}
|
|
419
|
+
})),
|
|
420
|
+
restoreProjectBranch: (projectId, branchId, data) => call(() => raw.restoreProjectBranch({
|
|
421
|
+
client,
|
|
422
|
+
path: {
|
|
423
|
+
project_id: projectId,
|
|
424
|
+
branch_id: branchId
|
|
425
|
+
},
|
|
426
|
+
body: data
|
|
427
|
+
})),
|
|
428
|
+
setDefaultProjectBranch: (projectId, branchId) => call(() => raw.setDefaultProjectBranch({
|
|
429
|
+
client,
|
|
430
|
+
path: {
|
|
431
|
+
project_id: projectId,
|
|
432
|
+
branch_id: branchId
|
|
433
|
+
}
|
|
434
|
+
})),
|
|
435
|
+
getProjectBranchSchema: ({ projectId, branchId, ...query }) => call(() => raw.getProjectBranchSchema({
|
|
436
|
+
client,
|
|
437
|
+
path: {
|
|
438
|
+
project_id: projectId,
|
|
439
|
+
branch_id: branchId
|
|
440
|
+
},
|
|
441
|
+
query
|
|
442
|
+
})),
|
|
443
|
+
listProjectBranchEndpoints: (projectId, branchId) => call(() => raw.listProjectBranchEndpoints({
|
|
444
|
+
client,
|
|
445
|
+
path: {
|
|
446
|
+
project_id: projectId,
|
|
447
|
+
branch_id: branchId
|
|
448
|
+
}
|
|
449
|
+
})),
|
|
450
|
+
createProjectEndpoint: (projectId, data) => call(() => raw.createProjectEndpoint({
|
|
451
|
+
client,
|
|
452
|
+
path: { project_id: projectId },
|
|
453
|
+
body: data
|
|
454
|
+
})),
|
|
455
|
+
listSnapshots: (projectId) => call(() => raw.listSnapshots({
|
|
456
|
+
client,
|
|
457
|
+
path: { project_id: projectId }
|
|
458
|
+
})),
|
|
459
|
+
createSnapshot: (projectId, branchId, query) => call(() => raw.createSnapshot({
|
|
460
|
+
client,
|
|
461
|
+
path: {
|
|
462
|
+
project_id: projectId,
|
|
463
|
+
branch_id: branchId
|
|
464
|
+
},
|
|
465
|
+
...query !== void 0 ? { query } : {}
|
|
466
|
+
})),
|
|
467
|
+
updateSnapshot: (projectId, snapshotId, data) => call(() => raw.updateSnapshot({
|
|
468
|
+
client,
|
|
469
|
+
path: {
|
|
470
|
+
project_id: projectId,
|
|
471
|
+
snapshot_id: snapshotId
|
|
472
|
+
},
|
|
473
|
+
body: data
|
|
474
|
+
})),
|
|
475
|
+
deleteSnapshot: (projectId, snapshotId) => call(() => raw.deleteSnapshot({
|
|
476
|
+
client,
|
|
477
|
+
path: {
|
|
478
|
+
project_id: projectId,
|
|
479
|
+
snapshot_id: snapshotId
|
|
480
|
+
}
|
|
481
|
+
})),
|
|
482
|
+
restoreSnapshot: (projectId, snapshotId, data) => call(() => raw.restoreSnapshot({
|
|
483
|
+
client,
|
|
484
|
+
path: {
|
|
485
|
+
project_id: projectId,
|
|
486
|
+
snapshot_id: snapshotId
|
|
487
|
+
},
|
|
488
|
+
...data !== void 0 ? { body: data } : {}
|
|
489
|
+
})),
|
|
490
|
+
finalizeRestoreBranch: (projectId, branchId, data) => call(() => raw.finalizeRestoreBranch({
|
|
491
|
+
client,
|
|
492
|
+
path: {
|
|
493
|
+
project_id: projectId,
|
|
494
|
+
branch_id: branchId
|
|
495
|
+
},
|
|
496
|
+
...data !== void 0 ? { body: data } : {}
|
|
497
|
+
})),
|
|
498
|
+
getSnapshotSchedule: (projectId, branchId) => call(() => raw.getSnapshotSchedule({
|
|
499
|
+
client,
|
|
500
|
+
path: {
|
|
501
|
+
project_id: projectId,
|
|
502
|
+
branch_id: branchId
|
|
503
|
+
}
|
|
504
|
+
})),
|
|
505
|
+
setSnapshotSchedule: (projectId, branchId, data) => call(() => raw.setSnapshotSchedule({
|
|
506
|
+
client,
|
|
507
|
+
path: {
|
|
508
|
+
project_id: projectId,
|
|
509
|
+
branch_id: branchId
|
|
510
|
+
},
|
|
511
|
+
body: data
|
|
512
|
+
})),
|
|
513
|
+
listProjectBranchDatabases: (projectId, branchId) => call(() => raw.listProjectBranchDatabases({
|
|
514
|
+
client,
|
|
515
|
+
path: {
|
|
516
|
+
project_id: projectId,
|
|
517
|
+
branch_id: branchId
|
|
518
|
+
}
|
|
519
|
+
})),
|
|
520
|
+
createProjectBranchDatabase: (projectId, branchId, data) => call(() => raw.createProjectBranchDatabase({
|
|
521
|
+
client,
|
|
522
|
+
path: {
|
|
523
|
+
project_id: projectId,
|
|
524
|
+
branch_id: branchId
|
|
525
|
+
},
|
|
526
|
+
body: data
|
|
527
|
+
})),
|
|
528
|
+
deleteProjectBranchDatabase: (projectId, branchId, databaseName) => call(() => raw.deleteProjectBranchDatabase({
|
|
529
|
+
client,
|
|
530
|
+
path: {
|
|
531
|
+
project_id: projectId,
|
|
532
|
+
branch_id: branchId,
|
|
533
|
+
database_name: databaseName
|
|
534
|
+
}
|
|
535
|
+
})),
|
|
536
|
+
listProjectBranchRoles: (projectId, branchId) => call(() => raw.listProjectBranchRoles({
|
|
537
|
+
client,
|
|
538
|
+
path: {
|
|
539
|
+
project_id: projectId,
|
|
540
|
+
branch_id: branchId
|
|
541
|
+
}
|
|
542
|
+
})),
|
|
543
|
+
createProjectBranchRole: (projectId, branchId, data) => call(() => raw.createProjectBranchRole({
|
|
544
|
+
client,
|
|
545
|
+
path: {
|
|
546
|
+
project_id: projectId,
|
|
547
|
+
branch_id: branchId
|
|
548
|
+
},
|
|
549
|
+
body: data
|
|
550
|
+
})),
|
|
551
|
+
deleteProjectBranchRole: (projectId, branchId, roleName) => call(() => raw.deleteProjectBranchRole({
|
|
552
|
+
client,
|
|
553
|
+
path: {
|
|
554
|
+
project_id: projectId,
|
|
555
|
+
branch_id: branchId,
|
|
556
|
+
role_name: roleName
|
|
557
|
+
}
|
|
558
|
+
})),
|
|
559
|
+
getProjectBranchRolePassword: (projectId, branchId, roleName) => call(() => raw.getProjectBranchRolePassword({
|
|
560
|
+
client,
|
|
561
|
+
path: {
|
|
562
|
+
project_id: projectId,
|
|
563
|
+
branch_id: branchId,
|
|
564
|
+
role_name: roleName
|
|
565
|
+
}
|
|
566
|
+
})),
|
|
567
|
+
queryProjectBranchLogs: (projectId, branchId, data) => call(() => raw.queryProjectBranchLogs({
|
|
568
|
+
client,
|
|
569
|
+
path: {
|
|
570
|
+
project_id: projectId,
|
|
571
|
+
branch_id: branchId
|
|
572
|
+
},
|
|
573
|
+
body: data
|
|
574
|
+
})),
|
|
575
|
+
listProjectBranchLogFields: (projectId, branchId) => call(() => raw.listProjectBranchLogFields({
|
|
576
|
+
client,
|
|
577
|
+
path: {
|
|
578
|
+
project_id: projectId,
|
|
579
|
+
branch_id: branchId
|
|
580
|
+
}
|
|
581
|
+
})),
|
|
582
|
+
listProjectBranchLogFieldValues: ({ projectId, branchId, fieldName, ...query }) => call(() => raw.listProjectBranchLogFieldValues({
|
|
583
|
+
client,
|
|
584
|
+
path: {
|
|
585
|
+
project_id: projectId,
|
|
586
|
+
branch_id: branchId,
|
|
587
|
+
field_name: fieldName
|
|
588
|
+
},
|
|
589
|
+
query
|
|
590
|
+
})),
|
|
591
|
+
createProjectBranchDataApi: (projectId, branchId, databaseName, data) => call(() => raw.createProjectBranchDataApi({
|
|
592
|
+
client,
|
|
593
|
+
path: {
|
|
594
|
+
project_id: projectId,
|
|
595
|
+
branch_id: branchId,
|
|
596
|
+
database_name: databaseName
|
|
597
|
+
},
|
|
598
|
+
body: data
|
|
599
|
+
})),
|
|
600
|
+
updateProjectBranchDataApi: (projectId, branchId, databaseName, data) => call(() => raw.updateProjectBranchDataApi({
|
|
601
|
+
client,
|
|
602
|
+
path: {
|
|
603
|
+
project_id: projectId,
|
|
604
|
+
branch_id: branchId,
|
|
605
|
+
database_name: databaseName
|
|
606
|
+
},
|
|
607
|
+
body: data
|
|
608
|
+
})),
|
|
609
|
+
deleteProjectBranchDataApi: (projectId, branchId, databaseName) => call(() => raw.deleteProjectBranchDataApi({
|
|
610
|
+
client,
|
|
611
|
+
path: {
|
|
612
|
+
project_id: projectId,
|
|
613
|
+
branch_id: branchId,
|
|
614
|
+
database_name: databaseName
|
|
615
|
+
}
|
|
616
|
+
})),
|
|
617
|
+
getProjectBranchDataApi: (projectId, branchId, databaseName) => call(() => raw.getProjectBranchDataApi({
|
|
618
|
+
client,
|
|
619
|
+
path: {
|
|
620
|
+
project_id: projectId,
|
|
621
|
+
branch_id: branchId,
|
|
622
|
+
database_name: databaseName
|
|
623
|
+
}
|
|
624
|
+
})),
|
|
625
|
+
listProjectVpcEndpoints: (projectId) => call(() => raw.listProjectVpcEndpoints({
|
|
626
|
+
client,
|
|
627
|
+
path: { project_id: projectId }
|
|
628
|
+
})),
|
|
629
|
+
assignProjectVpcEndpoint: (projectId, vpcEndpointId, data) => call(() => raw.assignProjectVpcEndpoint({
|
|
630
|
+
client,
|
|
631
|
+
path: {
|
|
632
|
+
project_id: projectId,
|
|
633
|
+
vpc_endpoint_id: vpcEndpointId
|
|
634
|
+
},
|
|
635
|
+
body: data
|
|
636
|
+
})),
|
|
637
|
+
deleteProjectVpcEndpoint: (projectId, vpcEndpointId) => call(() => raw.deleteProjectVpcEndpoint({
|
|
638
|
+
client,
|
|
639
|
+
path: {
|
|
640
|
+
project_id: projectId,
|
|
641
|
+
vpc_endpoint_id: vpcEndpointId
|
|
642
|
+
}
|
|
643
|
+
})),
|
|
644
|
+
listOrganizationVpcEndpoints: (orgId, regionId) => call(() => raw.listOrganizationVpcEndpoints({
|
|
645
|
+
client,
|
|
646
|
+
path: {
|
|
647
|
+
org_id: orgId,
|
|
648
|
+
region_id: regionId
|
|
649
|
+
}
|
|
650
|
+
})),
|
|
651
|
+
getOrganizationVpcEndpointDetails: (orgId, regionId, vpcEndpointId) => call(() => raw.getOrganizationVpcEndpointDetails({
|
|
652
|
+
client,
|
|
653
|
+
path: {
|
|
654
|
+
org_id: orgId,
|
|
655
|
+
region_id: regionId,
|
|
656
|
+
vpc_endpoint_id: vpcEndpointId
|
|
657
|
+
}
|
|
658
|
+
})),
|
|
659
|
+
assignOrganizationVpcEndpoint: (orgId, regionId, vpcEndpointId, data) => call(() => raw.assignOrganizationVpcEndpoint({
|
|
660
|
+
client,
|
|
661
|
+
path: {
|
|
662
|
+
org_id: orgId,
|
|
663
|
+
region_id: regionId,
|
|
664
|
+
vpc_endpoint_id: vpcEndpointId
|
|
665
|
+
},
|
|
666
|
+
body: data
|
|
667
|
+
})),
|
|
668
|
+
deleteOrganizationVpcEndpoint: (orgId, regionId, vpcEndpointId) => call(() => raw.deleteOrganizationVpcEndpoint({
|
|
669
|
+
client,
|
|
670
|
+
path: {
|
|
671
|
+
org_id: orgId,
|
|
672
|
+
region_id: regionId,
|
|
673
|
+
vpc_endpoint_id: vpcEndpointId
|
|
674
|
+
}
|
|
675
|
+
})),
|
|
676
|
+
getNeonAuth: (projectId, branchId) => call(() => raw.getNeonAuth({
|
|
677
|
+
client,
|
|
678
|
+
path: {
|
|
679
|
+
project_id: projectId,
|
|
680
|
+
branch_id: branchId
|
|
681
|
+
}
|
|
682
|
+
})),
|
|
683
|
+
createNeonAuth: (projectId, branchId, data) => call(() => raw.createNeonAuth({
|
|
684
|
+
client,
|
|
685
|
+
path: {
|
|
686
|
+
project_id: projectId,
|
|
687
|
+
branch_id: branchId
|
|
688
|
+
},
|
|
689
|
+
body: data
|
|
690
|
+
})),
|
|
691
|
+
disableNeonAuth: (projectId, branchId, data) => call(() => raw.disableNeonAuth({
|
|
692
|
+
client,
|
|
693
|
+
path: {
|
|
694
|
+
project_id: projectId,
|
|
695
|
+
branch_id: branchId
|
|
696
|
+
},
|
|
697
|
+
body: data
|
|
698
|
+
})),
|
|
699
|
+
listBranchNeonAuthOauthProviders: (projectId, branchId) => call(() => raw.listBranchNeonAuthOauthProviders({
|
|
700
|
+
client,
|
|
701
|
+
path: {
|
|
702
|
+
project_id: projectId,
|
|
703
|
+
branch_id: branchId
|
|
704
|
+
}
|
|
705
|
+
})),
|
|
706
|
+
addBranchNeonAuthOauthProvider: (projectId, branchId, data) => call(() => raw.addBranchNeonAuthOauthProvider({
|
|
707
|
+
client,
|
|
708
|
+
path: {
|
|
709
|
+
project_id: projectId,
|
|
710
|
+
branch_id: branchId
|
|
711
|
+
},
|
|
712
|
+
body: data
|
|
713
|
+
})),
|
|
714
|
+
updateBranchNeonAuthOauthProvider: (projectId, branchId, oauthProviderId, data) => call(() => raw.updateBranchNeonAuthOauthProvider({
|
|
715
|
+
client,
|
|
716
|
+
path: {
|
|
717
|
+
project_id: projectId,
|
|
718
|
+
branch_id: branchId,
|
|
719
|
+
oauth_provider_id: oauthProviderId
|
|
720
|
+
},
|
|
721
|
+
body: data
|
|
722
|
+
})),
|
|
723
|
+
deleteBranchNeonAuthOauthProvider: (projectId, branchId, oauthProviderId) => call(() => raw.deleteBranchNeonAuthOauthProvider({
|
|
724
|
+
client,
|
|
725
|
+
path: {
|
|
726
|
+
project_id: projectId,
|
|
727
|
+
branch_id: branchId,
|
|
728
|
+
oauth_provider_id: oauthProviderId
|
|
729
|
+
}
|
|
730
|
+
})),
|
|
731
|
+
listBranchNeonAuthTrustedDomains: (projectId, branchId) => call(() => raw.listBranchNeonAuthTrustedDomains({
|
|
732
|
+
client,
|
|
733
|
+
path: {
|
|
734
|
+
project_id: projectId,
|
|
735
|
+
branch_id: branchId
|
|
736
|
+
}
|
|
737
|
+
})),
|
|
738
|
+
addBranchNeonAuthTrustedDomain: (projectId, branchId, data) => call(() => raw.addBranchNeonAuthTrustedDomain({
|
|
739
|
+
client,
|
|
740
|
+
path: {
|
|
741
|
+
project_id: projectId,
|
|
742
|
+
branch_id: branchId
|
|
743
|
+
},
|
|
744
|
+
body: data
|
|
745
|
+
})),
|
|
746
|
+
deleteBranchNeonAuthTrustedDomain: (projectId, branchId, data) => call(() => raw.deleteBranchNeonAuthTrustedDomain({
|
|
747
|
+
client,
|
|
748
|
+
path: {
|
|
749
|
+
project_id: projectId,
|
|
750
|
+
branch_id: branchId
|
|
751
|
+
},
|
|
752
|
+
body: data
|
|
753
|
+
})),
|
|
754
|
+
getNeonAuthAllowLocalhost: (projectId, branchId) => call(() => raw.getNeonAuthAllowLocalhost({
|
|
755
|
+
client,
|
|
756
|
+
path: {
|
|
757
|
+
project_id: projectId,
|
|
758
|
+
branch_id: branchId
|
|
759
|
+
}
|
|
760
|
+
})),
|
|
761
|
+
updateNeonAuthAllowLocalhost: (projectId, branchId, data) => call(() => raw.updateNeonAuthAllowLocalhost({
|
|
762
|
+
client,
|
|
763
|
+
path: {
|
|
764
|
+
project_id: projectId,
|
|
765
|
+
branch_id: branchId
|
|
766
|
+
},
|
|
767
|
+
body: data
|
|
768
|
+
})),
|
|
769
|
+
getNeonAuthEmailAndPasswordConfig: (projectId, branchId) => call(() => raw.getNeonAuthEmailAndPasswordConfig({
|
|
770
|
+
client,
|
|
771
|
+
path: {
|
|
772
|
+
project_id: projectId,
|
|
773
|
+
branch_id: branchId
|
|
774
|
+
}
|
|
775
|
+
})),
|
|
776
|
+
updateNeonAuthEmailAndPasswordConfig: (projectId, branchId, data) => call(() => raw.updateNeonAuthEmailAndPasswordConfig({
|
|
777
|
+
client,
|
|
778
|
+
path: {
|
|
779
|
+
project_id: projectId,
|
|
780
|
+
branch_id: branchId
|
|
781
|
+
},
|
|
782
|
+
body: data
|
|
783
|
+
})),
|
|
784
|
+
getNeonAuthEmailProvider: (projectId, branchId) => call(() => raw.getNeonAuthEmailProvider({
|
|
785
|
+
client,
|
|
786
|
+
path: {
|
|
787
|
+
project_id: projectId,
|
|
788
|
+
branch_id: branchId
|
|
789
|
+
}
|
|
790
|
+
})),
|
|
791
|
+
updateNeonAuthEmailProvider: (projectId, branchId, data) => call(() => raw.updateNeonAuthEmailProvider({
|
|
792
|
+
client,
|
|
793
|
+
path: {
|
|
794
|
+
project_id: projectId,
|
|
795
|
+
branch_id: branchId
|
|
796
|
+
},
|
|
797
|
+
body: data
|
|
798
|
+
})),
|
|
799
|
+
sendNeonAuthTestEmail: (projectId, branchId, data) => call(() => raw.sendNeonAuthTestEmail({
|
|
800
|
+
client,
|
|
801
|
+
path: {
|
|
802
|
+
project_id: projectId,
|
|
803
|
+
branch_id: branchId
|
|
804
|
+
},
|
|
805
|
+
body: data
|
|
806
|
+
})),
|
|
807
|
+
getNeonAuthPluginConfigs: (projectId, branchId) => call(() => raw.getNeonAuthPluginConfigs({
|
|
808
|
+
client,
|
|
809
|
+
path: {
|
|
810
|
+
project_id: projectId,
|
|
811
|
+
branch_id: branchId
|
|
812
|
+
}
|
|
813
|
+
})),
|
|
814
|
+
updateNeonAuthOrganizationPlugin: (projectId, branchId, data) => call(() => raw.updateNeonAuthOrganizationPlugin({
|
|
815
|
+
client,
|
|
816
|
+
path: {
|
|
817
|
+
project_id: projectId,
|
|
818
|
+
branch_id: branchId
|
|
819
|
+
},
|
|
820
|
+
body: data
|
|
821
|
+
})),
|
|
822
|
+
getNeonAuthWebhookConfig: (projectId, branchId) => call(() => raw.getNeonAuthWebhookConfig({
|
|
823
|
+
client,
|
|
824
|
+
path: {
|
|
825
|
+
project_id: projectId,
|
|
826
|
+
branch_id: branchId
|
|
827
|
+
}
|
|
828
|
+
})),
|
|
829
|
+
updateNeonAuthWebhookConfig: (projectId, branchId, data) => call(() => raw.updateNeonAuthWebhookConfig({
|
|
830
|
+
client,
|
|
831
|
+
path: {
|
|
832
|
+
project_id: projectId,
|
|
833
|
+
branch_id: branchId
|
|
834
|
+
},
|
|
835
|
+
body: data
|
|
836
|
+
})),
|
|
837
|
+
createBranchNeonAuthNewUser: (projectId, branchId, data) => call(() => raw.createBranchNeonAuthNewUser({
|
|
838
|
+
client,
|
|
839
|
+
path: {
|
|
840
|
+
project_id: projectId,
|
|
841
|
+
branch_id: branchId
|
|
842
|
+
},
|
|
843
|
+
body: data
|
|
844
|
+
})),
|
|
845
|
+
deleteBranchNeonAuthUser: (projectId, branchId, authUserId) => call(() => raw.deleteBranchNeonAuthUser({
|
|
846
|
+
client,
|
|
847
|
+
path: {
|
|
848
|
+
project_id: projectId,
|
|
849
|
+
branch_id: branchId,
|
|
850
|
+
auth_user_id: authUserId
|
|
851
|
+
}
|
|
852
|
+
})),
|
|
853
|
+
updateNeonAuthUserRole: (projectId, branchId, authUserId, data) => call(() => raw.updateNeonAuthUserRole({
|
|
854
|
+
client,
|
|
855
|
+
path: {
|
|
856
|
+
project_id: projectId,
|
|
857
|
+
branch_id: branchId,
|
|
858
|
+
auth_user_id: authUserId
|
|
859
|
+
},
|
|
860
|
+
body: data
|
|
861
|
+
}))
|
|
862
|
+
};
|
|
808
863
|
};
|
|
864
|
+
//#endregion
|
|
865
|
+
export { ContentType, NeonApiError, codeFromBody, getApiClient, isNeonApiError, messageFromBody, retryOnLock };
|