@neon/tools 2.15.0 → 2.16.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 +117 -4
- package/dist/descriptions.gen.js +2 -2
- package/dist/generated/zod.gen.d.ts +3 -3
- package/dist/index.d.ts +17 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -9
- package/dist/lib/custom/auth-config.d.ts +0 -1
- package/dist/lib/custom/auth-config.d.ts.map +1 -1
- package/dist/lib/custom/auth-config.js +13 -6
- package/dist/lib/custom/docs.d.ts.map +1 -1
- package/dist/lib/custom/docs.js +2 -0
- package/dist/lib/custom/feedback.d.ts.map +1 -1
- package/dist/lib/custom/feedback.js +1 -0
- package/dist/lib/custom/fetch.d.ts.map +1 -1
- package/dist/lib/custom/fetch.js +1 -0
- package/dist/lib/custom/organizations.d.ts.map +1 -1
- package/dist/lib/custom/organizations.js +1 -0
- package/dist/lib/custom/resources.d.ts.map +1 -1
- package/dist/lib/custom/resources.js +1 -0
- package/dist/lib/custom/sql/connection.d.ts +6 -7
- package/dist/lib/custom/sql/connection.d.ts.map +1 -1
- package/dist/lib/custom/sql/connection.js +9 -11
- package/dist/lib/custom/sql/describe-branch.js +2 -2
- package/dist/lib/custom/sql/inspect/inspect.js +2 -2
- package/dist/lib/custom/sql/migrations.d.ts.map +1 -1
- package/dist/lib/custom/sql/migrations.js +3 -5
- package/dist/lib/custom/sql/query-tuning.d.ts.map +1 -1
- package/dist/lib/custom/sql/query-tuning.js +3 -5
- package/dist/lib/custom/sql/run.d.ts.map +1 -1
- package/dist/lib/custom/sql/run.js +4 -5
- package/dist/lib/custom/sql/schema.js +3 -3
- package/dist/lib/custom/sql/slow-queries.js +2 -2
- package/dist/lib/customize.d.ts +1 -1
- package/dist/lib/customize.d.ts.map +1 -1
- package/dist/lib/customize.js +8 -4
- package/dist/lib/ergonomic/bind.d.ts +10 -6
- package/dist/lib/ergonomic/bind.d.ts.map +1 -1
- package/dist/lib/ergonomic/bind.js +11 -2
- package/dist/lib/ergonomic/catalog.d.ts +2 -8
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
- package/dist/lib/ergonomic/catalog.js +100 -22
- package/dist/lib/ergonomic/composed.d.ts.map +1 -1
- package/dist/lib/ergonomic/composed.js +29 -0
- package/dist/lib/operation.d.ts +50 -4
- package/dist/lib/operation.d.ts.map +1 -1
- package/dist/lib/operation.js +6 -1
- package/dist/lib/policy.d.ts +24 -0
- package/dist/lib/policy.d.ts.map +1 -0
- package/dist/lib/policy.js +49 -0
- package/dist/lib/redact.d.ts +8 -0
- package/dist/lib/redact.d.ts.map +1 -0
- package/dist/lib/redact.js +40 -0
- package/dist/mastra.d.ts +2 -1
- package/dist/mastra.d.ts.map +1 -1
- package/dist/operations.gen.d.ts +388 -388
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ const tools = createNeonTools({
|
|
|
144
144
|
const { data: config } = await tools["auth.getConfig"].execute({
|
|
145
145
|
project_id: "project-id",
|
|
146
146
|
});
|
|
147
|
-
config.oauth_providers; // [{ id: "google", type: "standard", client_id: "…", client_secret: "
|
|
147
|
+
config.oauth_providers; // [{ id: "google", type: "standard", client_id: "…", client_secret: "****abcd" }]
|
|
148
148
|
|
|
149
149
|
const { data: found } = await tools["resources.search"].execute({
|
|
150
150
|
query: "checkout",
|
|
@@ -194,7 +194,7 @@ const { data: result } = await tools["sql.run"].execute({
|
|
|
194
194
|
result; // { rows: [{ id: 1, email: "a@example.com" }, { id: 2, email: "b@example.com" }], totalRowCount: 40, truncated: true, note: "Showing the first 2 of 40 rows. …" }
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
`auth.getConfig`
|
|
197
|
+
`auth.getConfig` returns the OAuth client secrets and SMTP password the API returns to the caller; they are `stored` secrets, so `secrets: "setup"` or `"none"` hides them (see [Secrets](#secrets)). Trusted origins, localhost access, email and password, and OAuth providers are required reads: an error on any of them fails the call, and a branch without Neon Auth throws `NeonNotFoundError`. The email provider, plugins, and webhook reads are reported under `_errors` when they fail; an email provider that was never configured is `null`.
|
|
198
198
|
|
|
199
199
|
`user.organizations` takes an optional `search` that filters by a case-insensitive part of the name or id. An organization API key gets its own organization.
|
|
200
200
|
|
|
@@ -227,7 +227,7 @@ await tools["sql.run"].execute(
|
|
|
227
227
|
|
|
228
228
|
| Field | Effect |
|
|
229
229
|
| --- | --- |
|
|
230
|
-
| `readOnly` | `sql.run` and `sql.explain` run the statement in a `READ ONLY` transaction, so Postgres rejects writes. `sql.runTransaction`, `migrations.*`, and `queryTuning.*`
|
|
230
|
+
| `readOnly` | A tool whose `metadata.readOnlySafe` is `false` throws `NeonClientError` without a request (see [Read-only](#read-only)). `sql.run` and `sql.explain` run the statement in a `READ ONLY` transaction, so Postgres rejects writes. `sql.runTransaction`, `migrations.*`, and `queryTuning.*` are not read-only safe, because a caller statement such as `COMMIT` or `SET TRANSACTION READ WRITE` can leave a read-only transaction. `schema.*` and `queries.listSlow` behave like `sql.run`; `branches.describe` and `database.inspect` always use a `READ ONLY` transaction. |
|
|
231
231
|
| `postgresRole` | Every SQL connection logs in as this role, and `postgres.connectionString` returns a URI for it. A `role_name` that differs throws `NeonClientError`. |
|
|
232
232
|
| `caller` | Sent with `docs.search` as `x-caller-source`, `x-caller-user-agent`, and `x-caller-client`. Without it, or when `source` cannot be a header value, `x-caller-source` is `neon_tools`. The search service records `website`, `cli`, `mcp`, and `monitor` by name and counts any other source as `rest`. |
|
|
233
233
|
|
|
@@ -250,6 +250,119 @@ const { data: page } = await tools["docs.get"].execute({ slug: data.hits[0].slug
|
|
|
250
250
|
|
|
251
251
|
Neon's feedback reporting counts `manual_test`, `neon_agent`, `neon_cli`, `neon_mcp`, and `neon_website` by name and any other `feedbackSource`, including the default, as `other`.
|
|
252
252
|
|
|
253
|
+
## Read-only
|
|
254
|
+
|
|
255
|
+
`metadata.readOnlySafe` is `true` when a tool changes no Neon resource and returns no connection string or role password: a `GET` that needs no approval, `logs.query`, the SQL tools that run one statement in a `READ ONLY` transaction, and the docs, feedback, search, and incidents tools. `postgres.connectionString` is a `GET` but not read-only safe, because its URI carries a role password that works against the read-write compute.
|
|
256
|
+
|
|
257
|
+
`readOnly: true` on `createNeonTools`, `createNeonTool`, or `execute` refuses every tool that is not read-only safe. The execution context wins over the factory:
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
const tools = createNeonTools({
|
|
261
|
+
apiKey,
|
|
262
|
+
tools: ["projects.list", "projects.delete", "sql.run"],
|
|
263
|
+
readOnly: true,
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
await tools["projects.list"].execute({}); // runs
|
|
267
|
+
await tools["sql.run"].execute({ project_id: "project-id", sql: "SELECT 1" }); // READ ONLY transaction
|
|
268
|
+
await tools["projects.delete"].execute({ project_id: "project-id" });
|
|
269
|
+
// throws NeonClientError: delete_projects is unavailable in read-only mode ...
|
|
270
|
+
await tools["projects.delete"].execute(
|
|
271
|
+
{ project_id: "project-id" },
|
|
272
|
+
{ readOnly: false },
|
|
273
|
+
); // runs
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
The refusal happens inside `onExecute`, so a tracking hook sees it as a failed call, and before `inject` resolves a project or branch id.
|
|
277
|
+
|
|
278
|
+
### Select tools by metadata
|
|
279
|
+
|
|
280
|
+
`tools` also takes a predicate. It sees every published tool without its `execute` (`operationId`, `id`, `title`, `description`, `annotations`, `requiresApproval`, `metadata`) and keeps the ones it returns `true` for, in `toolIds` order. A predicate that matches nothing throws.
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
const readTools = createNeonTools({
|
|
284
|
+
apiKey,
|
|
285
|
+
readOnly: true,
|
|
286
|
+
tools: (tool) =>
|
|
287
|
+
tool.metadata.readOnlySafe && tool.metadata.tags.includes("Branch"),
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
await readTools["branches.list"]?.execute({ project_id: "project-id" });
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
The result is typed as a partial record, since which tools the predicate keeps is known only at runtime. `toMastraTools` keeps that optionality, also when the record mixes in tools from a list. `CreateNeonToolsPredicateOptions` types predicate options declared ahead of the call. Pass a list of selectors when you need exact keys.
|
|
294
|
+
|
|
295
|
+
## Secrets
|
|
296
|
+
|
|
297
|
+
Tools return secrets as the API returns them. `secrets` on `createNeonTools`, `createNeonTool`, or `execute` chooses which ones results keep, and the execution context wins over the factory:
|
|
298
|
+
|
|
299
|
+
| `secrets` | Results keep |
|
|
300
|
+
| --- | --- |
|
|
301
|
+
| `"all"` (default) | every secret |
|
|
302
|
+
| `"setup"` | `setup` secrets: credentials Neon issues for an app, CI job, or agent to use |
|
|
303
|
+
| `"none"` | no secret |
|
|
304
|
+
|
|
305
|
+
A hidden secret becomes `REDACTED_SECRET` (`"***redacted***"`). An absent, `null`, or empty value stays as it is.
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
import { createNeonTools, REDACTED_SECRET } from "@neon/tools";
|
|
309
|
+
|
|
310
|
+
const tools = createNeonTools({
|
|
311
|
+
apiKey,
|
|
312
|
+
tools: ["credentials.create", "auth.emailProvider.get", "realtime.secret"],
|
|
313
|
+
secrets: "setup",
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
const { data: credential } = await tools["credentials.create"].execute({
|
|
317
|
+
project_id: "project-id",
|
|
318
|
+
branch_id: "br-main",
|
|
319
|
+
scopes: ["ai_gateway:invoke"],
|
|
320
|
+
principal_type: "user",
|
|
321
|
+
});
|
|
322
|
+
credential.api_token; // "nt_live_..."
|
|
323
|
+
|
|
324
|
+
const { data: smtp } = await tools["auth.emailProvider.get"].execute({
|
|
325
|
+
project_id: "project-id",
|
|
326
|
+
branch_id: "br-main",
|
|
327
|
+
});
|
|
328
|
+
smtp.password === REDACTED_SECRET; // true
|
|
329
|
+
|
|
330
|
+
await tools["realtime.secret"].execute(
|
|
331
|
+
{ project_id: "project-id", branch_id: "br-main" },
|
|
332
|
+
{ secrets: "none" },
|
|
333
|
+
);
|
|
334
|
+
// throws NeonClientError: secret_realtime is unavailable with secrets: "none" because its result is a secret.
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
`metadata.secretOutputFields` lists where a tool's result carries a secret, as `{ path, kind }`. A path is `$` (the whole value), `.key`, or `[*]` (every array item). `kind` is `setup` for a credential Neon issues, or `stored` for a secret you gave Neon to call another service. `metadata.returnsOnlySecrets` is `true` when the result is the secret itself; such a tool refuses before it sends a request when `secrets` would hide its result.
|
|
338
|
+
|
|
339
|
+
| Tool | `secretOutputFields` | `kind` | `returnsOnlySecrets` |
|
|
340
|
+
| --- | --- | --- | --- |
|
|
341
|
+
| `postgres.connectionString` | `$` | `setup` | yes |
|
|
342
|
+
| `projects.createAndConnect`, `branches.createAndConnect` | `$.connectionString` | `setup` | no |
|
|
343
|
+
| `postgres.roles.list` | `$[*].password` | `setup` | no |
|
|
344
|
+
| `postgres.roles.get`, `postgres.roles.create` | `$.password` | `setup` | no |
|
|
345
|
+
| `postgres.roles.resetPassword` | `$.password` | `setup` | yes |
|
|
346
|
+
| `credentials.create` | `$.api_token`, `$.s3_secret_access_key` | `setup` | no |
|
|
347
|
+
| `credentials.rotate` | `$.api_token`, `$.s3_secret_access_key` | `setup` | yes |
|
|
348
|
+
| `realtime.secret` | `$.secret` | `setup` | yes |
|
|
349
|
+
| `storage.objects.presign` | `$.url` | `setup` | yes |
|
|
350
|
+
| `auth.create` | `$.secret_server_key` | `setup` | no |
|
|
351
|
+
| `auth.oauthClients.create` | `$.client_secret` | `setup` | no |
|
|
352
|
+
| `auth.oauthClients.rotateSecret` | `$.client_secret` | `setup` | yes |
|
|
353
|
+
| `apiKeys.create`, `organizations.apiKeys.create` | `$.key` | `setup` | no |
|
|
354
|
+
| `auth.oauthProviders.list` | `$[*].client_secret` | `stored` | no |
|
|
355
|
+
| `auth.oauthProviders.add`, `auth.oauthProviders.update` | `$.client_secret` | `stored` | no |
|
|
356
|
+
| `auth.emailProvider.get`, `auth.emailProvider.update` | `$.password` | `stored` | no |
|
|
357
|
+
| `auth.plugins.get` | `$.email_provider.password`, `$.oauth_providers[*].client_secret` | `stored` | no |
|
|
358
|
+
| `auth.getConfig` | `$.oauth_providers[*].client_secret`, `$.email_provider.password` | `stored` | no |
|
|
359
|
+
|
|
360
|
+
`withheldUnderSecrets(tool.metadata, mode)` tells whether a tool refuses under a mode, so a host can leave those tools out: `(tool) => !withheldUnderSecrets(tool.metadata, "none")`. `hiddenSecretFields(tool.metadata, mode)` returns the fields a mode hides.
|
|
361
|
+
|
|
362
|
+
A rotation that returns the replacement (`credentials.rotate`, `postgres.roles.resetPassword`, `auth.oauthClients.rotateSecret`) counts as only a secret, because hiding it would discard the new value after the old one stopped working. `realtime.rotateSecret` returns nothing and stays available. Creates still run when their secret is hidden, so a secret the API returns only once, such as `apiKeys.create`'s `key` or a confidential client's `client_secret`, is lost. `readOnly` does not change `secrets`.
|
|
363
|
+
|
|
364
|
+
Redaction runs inside `onExecute`, so a tracking hook sees the redacted result.
|
|
365
|
+
|
|
253
366
|
## Writes and waiting
|
|
254
367
|
|
|
255
368
|
Tools run with `waitForReadiness: true`. When a mutation response includes an `operations` array, the call waits until those operations finish. The default deadline is five minutes (`wait.timeoutMs`). Pass `wait: { timeoutMs: 30_000 }` on `createNeonTools` or `createNeonTool` to bound that. Set it below the host's own tool-call timeout, otherwise the host gives up first.
|
|
@@ -587,7 +700,7 @@ Retries are off unless you pass `retry`. The SDK already retries 423, 429, and 5
|
|
|
587
700
|
|
|
588
701
|
## Safety and binary data
|
|
589
702
|
|
|
590
|
-
Every non-read operation requires approval. Generated non-read operations are conservatively marked as potentially destructive; `migrations.prepare` and `queryTuning.prepare` (which write only to a new temporary branch) and `feedback.send` are not. Reads that return connection credentials also require approval.
|
|
703
|
+
Every non-read operation requires approval. Generated non-read operations are conservatively marked as potentially destructive; `migrations.prepare` and `queryTuning.prepare` (which write only to a new temporary branch) and `feedback.send` are not. Reads that return connection credentials or Neon Auth secrets also require approval.
|
|
591
704
|
|
|
592
705
|
Binary request fields accept base64 strings:
|
|
593
706
|
|
package/dist/descriptions.gen.js
CHANGED
|
@@ -110,10 +110,10 @@ const toolDescriptions = {
|
|
|
110
110
|
"auth.allowLocalhost.update": "Sets whether a branch's Neon Auth accepts localhost origins; turn it off for production. Current value: {{auth.getConfig}}.",
|
|
111
111
|
"auth.emailAndPassword.get": "Gets a branch's Neon Auth email and password sign-in settings.",
|
|
112
112
|
"auth.emailAndPassword.update": "Updates a branch's Neon Auth email and password sign-in; omitted fields keep their value. Current values: {{auth.getConfig}}.",
|
|
113
|
-
"auth.emailProvider.get": "Gets a branch's Neon Auth email provider
|
|
113
|
+
"auth.emailProvider.get": "Gets a branch's Neon Auth email provider.",
|
|
114
114
|
"auth.emailProvider.update": "Sets the email provider for Neon Auth's emails: body.type \"shared\" for Neon's sender, or \"standard\" with your SMTP details. Test it with {{auth.emailProvider.sendTest}}.",
|
|
115
115
|
"auth.emailProvider.sendTest": "Sends a test email through the branch's saved standard SMTP provider to recipient_email. Only send to an address the user gave you. A failed send returns success false with error_message, not an error.",
|
|
116
|
-
"auth.plugins.get": "Gets all Neon Auth plugin settings of a branch.
|
|
116
|
+
"auth.plugins.get": "Gets all Neon Auth plugin settings of a branch.",
|
|
117
117
|
"auth.plugins.magicLink.update": "Updates the Neon Auth magic link plugin; omitted fields keep their value. Current values: {{auth.getConfig}}.",
|
|
118
118
|
"auth.plugins.organization.update": "Updates the Neon Auth organization plugin, which lets your app's users form organizations (not Neon organizations). Omitted fields keep their value. Current values: {{auth.getConfig}}.",
|
|
119
119
|
"auth.plugins.phoneNumber.get": "Gets a branch's Neon Auth SMS OTP plugin settings.",
|
|
@@ -1320,8 +1320,8 @@ export declare const zBillingSubscriptionType: z.ZodEnum<{
|
|
|
1320
1320
|
*
|
|
1321
1321
|
*/
|
|
1322
1322
|
export declare const zBillingPaymentMethod: z.ZodEnum<{
|
|
1323
|
-
UNKNOWN: "UNKNOWN";
|
|
1324
1323
|
none: "none";
|
|
1324
|
+
UNKNOWN: "UNKNOWN";
|
|
1325
1325
|
stripe: "stripe";
|
|
1326
1326
|
direct_payment: "direct_payment";
|
|
1327
1327
|
aws_mp: "aws_mp";
|
|
@@ -1374,8 +1374,8 @@ export declare const zBillingAccount: z.ZodObject<{
|
|
|
1374
1374
|
vercel_pg_legacy: "vercel_pg_legacy";
|
|
1375
1375
|
}>;
|
|
1376
1376
|
payment_method: z.ZodEnum<{
|
|
1377
|
-
UNKNOWN: "UNKNOWN";
|
|
1378
1377
|
none: "none";
|
|
1378
|
+
UNKNOWN: "UNKNOWN";
|
|
1379
1379
|
stripe: "stripe";
|
|
1380
1380
|
direct_payment: "direct_payment";
|
|
1381
1381
|
aws_mp: "aws_mp";
|
|
@@ -1705,8 +1705,8 @@ export declare const zCurrentUserInfoResponse: z.ZodObject<{
|
|
|
1705
1705
|
vercel_pg_legacy: "vercel_pg_legacy";
|
|
1706
1706
|
}>;
|
|
1707
1707
|
payment_method: z.ZodEnum<{
|
|
1708
|
-
UNKNOWN: "UNKNOWN";
|
|
1709
1708
|
none: "none";
|
|
1709
|
+
UNKNOWN: "UNKNOWN";
|
|
1710
1710
|
stripe: "stripe";
|
|
1711
1711
|
direct_payment: "direct_payment";
|
|
1712
1712
|
aws_mp: "aws_mp";
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,15 @@ import { inspectChecks } from "./lib/custom/sql/inspect/catalog.js";
|
|
|
3
3
|
import { InspectDiagnosticError } from "./lib/custom/sql/inspect/inspect.js";
|
|
4
4
|
import { type InjectedNeonTool, type NeonToolCustomizeOptions, type NeonToolInjectOptions, type NeonToolNameOverrides } from "./lib/customize.js";
|
|
5
5
|
import { customToolIds, type NeonToolId, type PublishedId, publishedId, type ToolClientOptions, toolFactories, toolIds } from "./lib/ergonomic/index.js";
|
|
6
|
+
import { type NeonToolPolicyOptions, type NeonToolPredicate } from "./lib/policy.js";
|
|
6
7
|
export type { NeonBearerCredential } from "./lib/auth.js";
|
|
7
8
|
export type { InspectCheckInfo } from "./lib/custom/sql/inspect/catalog.js";
|
|
8
9
|
export type { InspectCheck } from "./lib/custom/sql/inspect/queries.js";
|
|
9
10
|
export type { InjectedNeonTool, NeonToolCustomizeOptions, NeonToolDescriptionOverrides, NeonToolDescriptionSource, NeonToolInjectOptions, NeonToolInjectValue, NeonToolNameOverrides, NeonToolNameSource, NeonToolOnExecute, NeonToolOnExecuteEvent, } from "./lib/customize.js";
|
|
10
|
-
export type { JsonSafe, JsonSafeBlob, NeonTool, NeonToolAnnotations, NeonToolCaller, NeonToolExecutionContext, NeonToolMetadata, NeonToolResult, } from "./lib/operation.js";
|
|
11
|
+
export type { JsonSafe, JsonSafeBlob, NeonOperationMetadata, NeonSecretField, NeonSecretKind, NeonSecretsMode, NeonTool, NeonToolAnnotations, NeonToolCaller, NeonToolExecutionContext, NeonToolMetadata, NeonToolResult, } from "./lib/operation.js";
|
|
12
|
+
export type { NeonToolDescriptor, NeonToolPolicyOptions, NeonToolPredicate, } from "./lib/policy.js";
|
|
13
|
+
export { hiddenSecretFields, withheldUnderSecrets } from "./lib/policy.js";
|
|
14
|
+
export { REDACTED_SECRET } from "./lib/redact.js";
|
|
11
15
|
export type { NeonToolId, PublishedId };
|
|
12
16
|
export { customToolIds, InspectDiagnosticError, inspectChecks, NeonError, publishedId, toolIds, };
|
|
13
17
|
type ToolFactories = typeof toolFactories;
|
|
@@ -22,24 +26,32 @@ type WithPublishedId<Tool> = Tool extends {
|
|
|
22
26
|
} ? Omit<Tool, "id"> & {
|
|
23
27
|
id: string;
|
|
24
28
|
} : Tool;
|
|
25
|
-
export interface NeonToolsClientOptions extends ToolClientOptions, Omit<NeonToolCustomizeOptions, "name" | "names"> {
|
|
29
|
+
export interface NeonToolsClientOptions extends ToolClientOptions, NeonToolPolicyOptions, Omit<NeonToolCustomizeOptions, "name" | "names"> {
|
|
26
30
|
}
|
|
27
31
|
type CreateNeonToolsInput = NeonToolsClientOptions & {
|
|
28
|
-
tools: readonly NeonToolId[];
|
|
32
|
+
tools: readonly NeonToolId[] | NeonToolPredicate;
|
|
29
33
|
};
|
|
34
|
+
type AllNeonToolIds = typeof toolIds;
|
|
30
35
|
export type CreateNeonToolsOptions<Tools extends readonly NeonToolId[] = readonly NeonToolId[]> = NeonToolsClientOptions & {
|
|
31
36
|
tools: Tools;
|
|
32
37
|
};
|
|
38
|
+
export type CreateNeonToolsPredicateOptions = NeonToolsClientOptions & {
|
|
39
|
+
tools: NeonToolPredicate;
|
|
40
|
+
};
|
|
33
41
|
type SelectedTools<T> = T extends {
|
|
34
42
|
tools: infer S extends readonly NeonToolId[];
|
|
35
43
|
} ? S : [];
|
|
36
|
-
type NeonToolsFor<T, Inject> = T extends CreateNeonToolsInput ?
|
|
44
|
+
type NeonToolsFor<T, Inject> = T extends CreateNeonToolsInput ? T extends {
|
|
45
|
+
tools: NeonToolPredicate;
|
|
46
|
+
} ? Partial<Inject extends NeonToolInjectOptions ? InjectedNeonTools<AllNeonToolIds, Inject> : NeonTools<AllNeonToolIds>> : Inject extends NeonToolInjectOptions ? InjectedNeonTools<SelectedTools<T>, Inject> : NeonTools<SelectedTools<T>> : never;
|
|
37
47
|
type ToolForId<Id extends NeonToolId> = ReturnType<ToolFactories[Id]>;
|
|
38
48
|
type NamedNeonTools<Tools extends readonly NeonToolId[], Inject> = {
|
|
39
49
|
[Tool in Tools[number]]: WithPublishedId<Inject extends NeonToolInjectOptions ? InjectedNeonTool<ReturnType<ToolFactories[Tool]>, Inject> : ReturnType<ToolFactories[Tool]>>;
|
|
40
50
|
};
|
|
41
51
|
type NamedNeonTool<Id extends NeonToolId, Inject> = WithPublishedId<Inject extends NeonToolInjectOptions ? InjectedNeonTool<ToolForId<Id>, Inject> : ToolForId<Id>>;
|
|
42
|
-
type NamedNeonToolsFor<T, Inject> = T extends CreateNeonToolsInput ?
|
|
52
|
+
type NamedNeonToolsFor<T, Inject> = T extends CreateNeonToolsInput ? T extends {
|
|
53
|
+
tools: NeonToolPredicate;
|
|
54
|
+
} ? Partial<NamedNeonTools<AllNeonToolIds, Inject>> : NamedNeonTools<SelectedTools<T>, Inject> : never;
|
|
43
55
|
export declare function createNeonTools<const T extends CreateNeonToolsInput, const Inject extends NeonToolInjectOptions | undefined = undefined>(options: T & {
|
|
44
56
|
inject?: Inject;
|
|
45
57
|
} & ({
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAGN,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,aAAa,EAEb,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,iBAAiB,EAEtB,aAAa,EACb,OAAO,EAEP,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAGN,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,aAAa,EAEb,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,iBAAiB,EAEtB,aAAa,EACb,OAAO,EAEP,MAAM,0BAA0B,CAAC;AAClC,OAAO,E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AM,SAAS,qBAAqB,GACpC,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,GACvC,SAAS,CAAC,EAAE,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,8 @@ import { InspectDiagnosticError } from "./lib/custom/sql/inspect/inspect.js";
|
|
|
4
4
|
import { customToolIds, isNeonToolId, toolIds, unpublishedToolError } from "./lib/ergonomic/ids.js";
|
|
5
5
|
import { applyToolCustomization, assertToolCustomizeOptions, publishedToolId } from "./lib/customize.js";
|
|
6
6
|
import { toolFactories } from "./lib/ergonomic/catalog.js";
|
|
7
|
+
import { REDACTED_SECRET } from "./lib/redact.js";
|
|
8
|
+
import { applyToolPolicy, hiddenSecretFields, toolCallGuard, toolDescriptor, withheldUnderSecrets } from "./lib/policy.js";
|
|
7
9
|
import { NeonError } from "@neon/sdk";
|
|
8
10
|
// src/index.ts
|
|
9
11
|
const assertKnownNameKeys = (names, tools) => {
|
|
@@ -21,16 +23,30 @@ const factoryFor = (id) => {
|
|
|
21
23
|
if (known === void 0) throw unpublishedToolError(id);
|
|
22
24
|
return toolFactories[known];
|
|
23
25
|
};
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const publishedIdOf = (publishedIds, toolId) => {
|
|
27
|
+
const published = publishedIds.get(toolId);
|
|
28
|
+
if (published === void 0) throw new TypeError(`No published id for ${toolId}`);
|
|
29
|
+
return published;
|
|
30
|
+
};
|
|
31
|
+
const selectedEntries = (options) => {
|
|
32
|
+
const selection = options.tools;
|
|
33
|
+
if (typeof selection === "function") {
|
|
34
|
+
const entries = toolIds.map((toolId) => [toolId, factoryFor(toolId)(options)]).filter(([, tool]) => selection(toolDescriptor(tool)));
|
|
35
|
+
if (entries.length === 0) throw new TypeError("The createNeonTools tools predicate matched no tool");
|
|
36
|
+
return entries;
|
|
37
|
+
}
|
|
38
|
+
if (selection === void 0 || selection.length === 0) throw new TypeError("createNeonTools requires at least one tool");
|
|
28
39
|
const seen = /* @__PURE__ */ new Set();
|
|
29
|
-
|
|
40
|
+
return selection.map((toolId) => {
|
|
30
41
|
if (seen.has(toolId)) throw new Error(`Duplicate Neon tool "${toolId}"`);
|
|
31
42
|
seen.add(toolId);
|
|
32
43
|
return [toolId, factoryFor(toolId)(options)];
|
|
33
44
|
});
|
|
45
|
+
};
|
|
46
|
+
const bindTools = (options) => {
|
|
47
|
+
assertToolCustomizeOptions(options);
|
|
48
|
+
const rawEntries = selectedEntries(options);
|
|
49
|
+
const selected = rawEntries.map(([toolId]) => toolId);
|
|
34
50
|
assertKnownNameKeys(options.names, rawEntries.map(([, tool]) => tool));
|
|
35
51
|
const publishedIds = /* @__PURE__ */ new Map();
|
|
36
52
|
const selectorsById = /* @__PURE__ */ new Map();
|
|
@@ -41,7 +57,10 @@ const bindTools = (options) => {
|
|
|
41
57
|
selectorsById.set(published, id);
|
|
42
58
|
publishedIds.set(id, published);
|
|
43
59
|
}
|
|
44
|
-
const entries = rawEntries.map(([id, tool]) =>
|
|
60
|
+
const entries = rawEntries.map(([id, tool]) => {
|
|
61
|
+
const guard = toolCallGuard(tool, options, publishedIdOf(publishedIds, id));
|
|
62
|
+
return [id, applyToolCustomization(applyToolPolicy(tool, options, guard), options, publishedIds, guard)];
|
|
63
|
+
});
|
|
45
64
|
const tools = Object.fromEntries(entries);
|
|
46
65
|
assertNeonTools(tools, selected);
|
|
47
66
|
return tools;
|
|
@@ -54,7 +73,9 @@ function createNeonTool(id, options) {
|
|
|
54
73
|
assertToolCustomizeOptions(options);
|
|
55
74
|
const tool = factoryFor(id)(options);
|
|
56
75
|
assertKnownNameKeys(options.names, [tool]);
|
|
57
|
-
const
|
|
58
|
-
|
|
76
|
+
const published = publishedToolId(tool, options);
|
|
77
|
+
const publishedIds = /* @__PURE__ */ new Map([[id, published]]);
|
|
78
|
+
const guard = toolCallGuard(tool, options, published);
|
|
79
|
+
return applyToolCustomization(applyToolPolicy(tool, options, guard), options, publishedIds, guard);
|
|
59
80
|
}
|
|
60
|
-
export { InspectDiagnosticError, NeonError, createNeonTool, createNeonTools, customToolIds, inspectChecks, publishedId, toolIds };
|
|
81
|
+
export { InspectDiagnosticError, NeonError, REDACTED_SECRET, createNeonTool, createNeonTools, customToolIds, hiddenSecretFields, inspectChecks, publishedId, toolIds, withheldUnderSecrets };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type NeonAuthWebhookConfig, type NeonClient } from "@neon/sdk";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { type ToolClientOptions } from "../ergonomic/bind.js";
|
|
4
|
-
export declare const REDACTED_SECRET = "***redacted***";
|
|
5
4
|
export declare const getAuthConfigInputSchema: z.ZodObject<{
|
|
6
5
|
project_id: z.ZodString;
|
|
7
6
|
branch_id: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-config.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/auth-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"auth-config.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/auth-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,wBAAwB;;;kBASnC,CAAC;AA0GH,eAAO,MAAM,cAAc,GAC1B,MAAM,UAAU,CAAC,IAAI,CAAC,EACtB,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,EAChD,SAAS,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyFpB,CAAC;AAgCF,eAAO,MAAM,iBAAiB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC1D,CAAC"}
|
|
@@ -5,7 +5,6 @@ import { NeonAuthIntegration } from "../../generated/output.gen.js";
|
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { NeonApiError } from "@neon/sdk";
|
|
7
7
|
// src/lib/custom/auth-config.ts
|
|
8
|
-
const REDACTED_SECRET = "***redacted***";
|
|
9
8
|
const getAuthConfigInputSchema = z.strictObject({
|
|
10
9
|
project_id: zGetNeonAuthPath.shape.project_id.describe(pathInputDescriptions.project_id),
|
|
11
10
|
branch_id: zGetNeonAuthPath.shape.branch_id.describe(`${pathInputDescriptions.branch_id} Omit it for the project's default branch.`).optional()
|
|
@@ -25,7 +24,7 @@ const oauthProviderSettings = (provider) => ({
|
|
|
25
24
|
id: provider.id,
|
|
26
25
|
type: provider.type,
|
|
27
26
|
client_id: provider.client_id ?? null,
|
|
28
|
-
client_secret: provider.client_secret
|
|
27
|
+
client_secret: provider.client_secret ?? null,
|
|
29
28
|
...provider.microsoft_tenant_id && { microsoft_tenant_id: provider.microsoft_tenant_id },
|
|
30
29
|
...provider.apple_team_id && { apple_team_id: provider.apple_team_id },
|
|
31
30
|
...provider.apple_key_id && { apple_key_id: provider.apple_key_id }
|
|
@@ -38,7 +37,7 @@ const emailProviderSettings = (data) => {
|
|
|
38
37
|
host: data.host,
|
|
39
38
|
port: data.port,
|
|
40
39
|
username: data.username,
|
|
41
|
-
password:
|
|
40
|
+
password: data.password ?? null,
|
|
42
41
|
sender_email: data.sender_email,
|
|
43
42
|
sender_name: data.sender_name
|
|
44
43
|
};
|
|
@@ -177,7 +176,7 @@ const getAuthConfigTool = (options) => bindTool(options, {
|
|
|
177
176
|
operationId: "auth.getConfig",
|
|
178
177
|
id: publishedId("auth.getConfig"),
|
|
179
178
|
title: "Get Neon Auth configuration",
|
|
180
|
-
description: "Returns a branch's Neon Auth integration and settings: trusted origins, localhost, email and password, OAuth and email providers, plugins, webhook, and logs export
|
|
179
|
+
description: "Returns a branch's Neon Auth integration and settings: trusted origins, localhost, email and password, OAuth and email providers, plugins, webhook, and logs export. Needs Neon Auth on the branch ({{auth.create}}).",
|
|
181
180
|
inputSchema: getAuthConfigInputSchema,
|
|
182
181
|
outputSchema: authConfigOutputSchema,
|
|
183
182
|
annotations: {
|
|
@@ -186,13 +185,21 @@ const getAuthConfigTool = (options) => bindTool(options, {
|
|
|
186
185
|
idempotentHint: true,
|
|
187
186
|
openWorldHint: false
|
|
188
187
|
},
|
|
189
|
-
requiresApproval:
|
|
188
|
+
requiresApproval: true,
|
|
190
189
|
metadata: {
|
|
191
190
|
method: "GET",
|
|
191
|
+
readOnlySafe: true,
|
|
192
|
+
secretOutputFields: [{
|
|
193
|
+
path: "$.oauth_providers[*].client_secret",
|
|
194
|
+
kind: "stored"
|
|
195
|
+
}, {
|
|
196
|
+
path: "$.email_provider.password",
|
|
197
|
+
kind: "stored"
|
|
198
|
+
}],
|
|
192
199
|
path: "/projects/{project_id}/branches/{branch_id}/auth",
|
|
193
200
|
stability: "stable",
|
|
194
201
|
deprecated: false,
|
|
195
202
|
tags: ["Auth"]
|
|
196
203
|
}
|
|
197
204
|
}, readAuthConfig);
|
|
198
|
-
export {
|
|
205
|
+
export { getAuthConfigInputSchema, getAuthConfigTool, readAuthConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/docs.ts"],"names":[],"m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7B,QAAQ,cAAc,GAAG,SAAS,KAChC,MAAM,CAAC,MAAM,EAAE,MAAM,CAkBvB,CAAC;AAoCF,eAAO,MAAM,cAAc,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DxD,CAAC;AAOF,eAAO,MAAM,UAAU,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;CA2CpD,CAAC"}
|
package/dist/lib/custom/docs.js
CHANGED
|
@@ -90,6 +90,7 @@ const searchDocsTool = (options) => {
|
|
|
90
90
|
requiresApproval: false,
|
|
91
91
|
metadata: {
|
|
92
92
|
method: "POST",
|
|
93
|
+
readOnlySafe: true,
|
|
93
94
|
path: "/site-search",
|
|
94
95
|
stability: "stable",
|
|
95
96
|
deprecated: false,
|
|
@@ -137,6 +138,7 @@ const getDocTool = (options) => {
|
|
|
137
138
|
requiresApproval: false,
|
|
138
139
|
metadata: {
|
|
139
140
|
method: "GET",
|
|
141
|
+
readOnlySafe: true,
|
|
140
142
|
path: "/{slug}.md",
|
|
141
143
|
stability: "stable",
|
|
142
144
|
deprecated: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/feedback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,uBAAuB,eAAe,CAAC;AAGpD,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,eAAO,MAAM,uBAAuB;;kBASlC,CAAC;AAKH,eAAO,MAAM,gBAAgB,GAAI,SAAS,iBAAiB;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/feedback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CA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@
|
|
|
1
|
-
{"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,4BAA4B;;kBAKvC,CAAC;AAEH,eAAO,MAAM,eAAe,GAC3B,QAAQ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EACpC,OAAO,MAAM,YAOb,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,4BAA4B;;kBAKvC,CAAC;AAEH,eAAO,MAAM,eAAe,GAC3B,QAAQ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EACpC,OAAO,MAAM,YAOb,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAGvE,eAAO,MAAM,0BAA0B;;kBAOrC,CAAC;AAQH,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,WACT,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,OAEF,CAAC;AAwIhD,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;YAtJzD,MAAM;eACH,MAAM;aACR,MAAM;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAGvE,eAAO,MAAM,0BAA0B;;kBAOrC,CAAC;AAQH,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,WACT,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,OAEF,CAAC;AAwIhD,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;YAtJzD,MAAM;eACH,MAAM;aACR,MAAM;;;;;;;;;;;;;;;;CAwLX,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { type NeonClient } from "@neon/sdk";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
import type { NeonToolExecutionContext,
|
|
3
|
+
import type { NeonToolExecutionContext, NeonToolMetadataInput } from "../../operation.js";
|
|
4
4
|
export declare const NEON_DEFAULT_DATABASE_NAME = "neondb";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* `readOnlySafe` for a tool that runs caller SQL means it runs one statement
|
|
7
|
+
* in its own `READ ONLY` transaction when `readOnly` is set.
|
|
8
|
+
*/
|
|
9
|
+
export declare const sqlMetadata: (readOnlySafe: boolean) => NeonToolMetadataInput;
|
|
6
10
|
export declare const DATABASE_NAME_DESCRIPTION = "Database name. Omit for neondb, else the first database.";
|
|
7
11
|
export declare const projectIdField: z.ZodString;
|
|
8
12
|
export declare const branchIdField: z.ZodOptional<z.ZodString>;
|
|
@@ -38,9 +42,4 @@ export declare const defaultDatabase: (neonClient: NeonClient<true>, ids: {
|
|
|
38
42
|
*/
|
|
39
43
|
export declare const resolveConnection: (neonClient: NeonClient<true>, target: ConnectionTarget, context: NeonToolExecutionContext, signal?: AbortSignal) => Promise<ResolvedConnection>;
|
|
40
44
|
export declare const sqlClient: (uri: string, signal?: AbortSignal) => import("@neondatabase/serverless").NeonQueryFunction<false, false>;
|
|
41
|
-
/**
|
|
42
|
-
* Caller SQL that shares one transaction can escape `READ ONLY` with `COMMIT`
|
|
43
|
-
* or `SET TRANSACTION READ WRITE`, so these tools refuse instead.
|
|
44
|
-
*/
|
|
45
|
-
export declare const refuseInReadOnly: (context: NeonToolExecutionContext) => void;
|
|
46
45
|
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/sql/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,WAAW,CAAC;AAE7D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EACX,wBAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/sql/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,WAAW,CAAC;AAE7D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EACX,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,0BAA0B,WAAW,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,cAAc,OAAO,KAAG,qBAOlD,CAAC;AAEH,eAAO,MAAM,yBAAyB,6DAAoF,CAAC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k";
|
|
5
5
|
// src/lib/custom/sql/connection.ts
|
|
6
6
|
const NEON_DEFAULT_DATABASE_NAME = "neondb";
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* `readOnlySafe` for a tool that runs caller SQL means it runs one statement
|
|
9
|
+
* in its own `READ ONLY` transaction when `readOnly` is set.
|
|
10
|
+
*/
|
|
11
|
+
const sqlMetadata = (readOnlySafe) => ({
|
|
8
12
|
method: "SQL",
|
|
9
13
|
path: "/projects/{project_id}/connection_uri",
|
|
10
14
|
stability: "stable",
|
|
11
15
|
deprecated: false,
|
|
12
|
-
tags: ["SQL"]
|
|
13
|
-
|
|
16
|
+
tags: ["SQL"],
|
|
17
|
+
readOnlySafe
|
|
18
|
+
});
|
|
14
19
|
const DATABASE_NAME_DESCRIPTION = `Database name. Omit for ${NEON_DEFAULT_DATABASE_NAME}, else the first database.`;
|
|
15
20
|
const projectIdField = z.string().describe(pathInputDescriptions.project_id);
|
|
16
21
|
const branchIdField = z.string().optional().describe(`${pathInputDescriptions.branch_id} Omit it for the default branch.`);
|
|
@@ -68,11 +73,4 @@ const resolveConnection = async (neonClient, target, context, signal) => {
|
|
|
68
73
|
};
|
|
69
74
|
};
|
|
70
75
|
const sqlClient = (uri, signal) => neon(uri, signal === void 0 ? {} : { fetchOptions: { signal } });
|
|
71
|
-
|
|
72
|
-
* Caller SQL that shares one transaction can escape `READ ONLY` with `COMMIT`
|
|
73
|
-
* or `SET TRANSACTION READ WRITE`, so these tools refuse instead.
|
|
74
|
-
*/
|
|
75
|
-
const refuseInReadOnly = (context) => {
|
|
76
|
-
if (context.readOnly === true) throw new NeonClientError("This tool is unavailable in read-only mode because it runs caller SQL that can leave a read-only transaction.");
|
|
77
|
-
};
|
|
78
|
-
export { COMPUTE_ID_DESCRIPTION, DATABASE_NAME_DESCRIPTION, NEON_DEFAULT_DATABASE_NAME, SQL_METADATA, branchIdField, computeIdField, databaseNameField, defaultDatabase, projectIdField, refuseInReadOnly, resolveConnection, roleNameField, sqlClient };
|
|
76
|
+
export { COMPUTE_ID_DESCRIPTION, DATABASE_NAME_DESCRIPTION, NEON_DEFAULT_DATABASE_NAME, branchIdField, computeIdField, databaseNameField, defaultDatabase, projectIdField, resolveConnection, roleNameField, sqlClient, sqlMetadata };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pathInputDescriptions } from "../../../descriptions.gen.js";
|
|
2
2
|
import { bindTool, publishedId } from "../../ergonomic/bind.js";
|
|
3
|
-
import {
|
|
3
|
+
import { databaseNameField, projectIdField, resolveConnection, sqlClient, sqlMetadata } from "./connection.js";
|
|
4
4
|
import { sqlReadAnnotations } from "./schema.js";
|
|
5
5
|
import { Branch } from "../../../generated/output.gen.js";
|
|
6
6
|
import { consoleBaseUrl } from "../resources.js";
|
|
@@ -158,7 +158,7 @@ const describeBranchTool = (options) => {
|
|
|
158
158
|
outputSchema: describeBranchOutputSchema,
|
|
159
159
|
annotations: sqlReadAnnotations,
|
|
160
160
|
requiresApproval: false,
|
|
161
|
-
metadata:
|
|
161
|
+
metadata: sqlMetadata(true)
|
|
162
162
|
}, (neonClient, input, signal, context) => describeBranch(neonClient, input, context, consoleUrl, signal));
|
|
163
163
|
};
|
|
164
164
|
export { branchConsoleUrl, describeBranch, describeBranchInputSchema, describeBranchTool };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { INSPECT_CHECKS, INSPECT_MAX_LIMIT, INSPECT_QUERIES } from "./queries.js";
|
|
2
2
|
import { assembleInspectReport } from "./report.js";
|
|
3
3
|
import { bindTool, publishedId } from "../../../ergonomic/bind.js";
|
|
4
|
-
import {
|
|
4
|
+
import { branchIdField, computeIdField, projectIdField, resolveConnection, sqlClient, sqlMetadata } from "../connection.js";
|
|
5
5
|
import { sqlReadAnnotations } from "../schema.js";
|
|
6
6
|
import { formatInspectQueryError, selectInspectTargets } from "./targets.js";
|
|
7
7
|
import { NeonDbError } from "@neondatabase/serverless";
|
|
@@ -88,7 +88,7 @@ const inspectDatabaseTool = (options) => bindTool(options, {
|
|
|
88
88
|
outputSchema: inspectDatabaseOutputSchema,
|
|
89
89
|
annotations: sqlReadAnnotations,
|
|
90
90
|
requiresApproval: false,
|
|
91
|
-
metadata:
|
|
91
|
+
metadata: sqlMetadata(true)
|
|
92
92
|
}, async (neonClient, input, signal, context) => {
|
|
93
93
|
const { check, database_name: databaseName, limit } = input;
|
|
94
94
|
const query = INSPECT_QUERIES[check];
|