@neon/tools 2.12.0 → 2.14.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 +152 -7
- package/dist/descriptions.gen.d.ts +10 -0
- package/dist/descriptions.gen.d.ts.map +1 -0
- package/dist/descriptions.gen.js +150 -0
- package/dist/generated/zod.gen.d.ts +6 -6
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -11
- package/dist/lib/custom/auth-config.d.ts +164 -0
- package/dist/lib/custom/auth-config.d.ts.map +1 -0
- package/dist/lib/custom/auth-config.js +177 -0
- package/dist/lib/custom/docs.d.ts +58 -0
- package/dist/lib/custom/docs.d.ts.map +1 -0
- package/dist/lib/custom/docs.js +143 -0
- package/dist/lib/custom/feedback.d.ts +15 -0
- package/dist/lib/custom/feedback.d.ts.map +1 -0
- package/dist/lib/custom/feedback.js +55 -0
- package/dist/lib/custom/fetch.d.ts +402 -0
- package/dist/lib/custom/fetch.d.ts.map +1 -0
- package/dist/lib/custom/fetch.js +198 -0
- package/dist/lib/custom/organizations.d.ts +23 -0
- package/dist/lib/custom/organizations.d.ts.map +1 -0
- package/dist/lib/custom/organizations.js +32 -0
- package/dist/lib/custom/resources.d.ts +22 -0
- package/dist/lib/custom/resources.d.ts.map +1 -0
- package/dist/lib/custom/resources.js +113 -0
- package/dist/lib/custom/sql/connection.d.ts +46 -0
- package/dist/lib/custom/sql/connection.d.ts.map +1 -0
- package/dist/lib/custom/sql/connection.js +78 -0
- package/dist/lib/custom/sql/describe-branch.d.ts +84 -0
- package/dist/lib/custom/sql/describe-branch.d.ts.map +1 -0
- package/dist/lib/custom/sql/describe-branch.js +155 -0
- package/dist/lib/custom/sql/inspect/catalog.d.ts +22 -0
- package/dist/lib/custom/sql/inspect/catalog.d.ts.map +1 -0
- package/dist/lib/custom/sql/inspect/catalog.js +18 -0
- package/dist/lib/custom/sql/inspect/inspect.d.ts +75 -0
- package/dist/lib/custom/sql/inspect/inspect.d.ts.map +1 -0
- package/dist/lib/custom/sql/inspect/inspect.js +135 -0
- package/dist/lib/custom/sql/inspect/queries.d.ts +63 -0
- package/dist/lib/custom/sql/inspect/queries.d.ts.map +1 -0
- package/dist/lib/custom/sql/inspect/queries.js +528 -0
- package/dist/lib/custom/sql/inspect/report.d.ts +33 -0
- package/dist/lib/custom/sql/inspect/report.d.ts.map +1 -0
- package/dist/lib/custom/sql/inspect/report.js +45 -0
- package/dist/lib/custom/sql/inspect/targets.d.ts +27 -0
- package/dist/lib/custom/sql/inspect/targets.d.ts.map +1 -0
- package/dist/lib/custom/sql/inspect/targets.js +33 -0
- package/dist/lib/custom/sql/migrations.d.ts +69 -0
- package/dist/lib/custom/sql/migrations.d.ts.map +1 -0
- package/dist/lib/custom/sql/migrations.js +144 -0
- package/dist/lib/custom/sql/plan.d.ts +27 -0
- package/dist/lib/custom/sql/plan.d.ts.map +1 -0
- package/dist/lib/custom/sql/plan.js +53 -0
- package/dist/lib/custom/sql/query-tuning.d.ts +107 -0
- package/dist/lib/custom/sql/query-tuning.d.ts.map +1 -0
- package/dist/lib/custom/sql/query-tuning.js +129 -0
- package/dist/lib/custom/sql/rows.d.ts +11 -0
- package/dist/lib/custom/sql/rows.d.ts.map +1 -0
- package/dist/lib/custom/sql/rows.js +19 -0
- package/dist/lib/custom/sql/run.d.ts +81 -0
- package/dist/lib/custom/sql/run.d.ts.map +1 -0
- package/dist/lib/custom/sql/run.js +90 -0
- package/dist/lib/custom/sql/schema.d.ts +84 -0
- package/dist/lib/custom/sql/schema.d.ts.map +1 -0
- package/dist/lib/custom/sql/schema.js +201 -0
- package/dist/lib/custom/sql/slow-queries.d.ts +43 -0
- package/dist/lib/custom/sql/slow-queries.d.ts.map +1 -0
- package/dist/lib/custom/sql/slow-queries.js +87 -0
- package/dist/lib/customize.d.ts +9 -2
- package/dist/lib/customize.d.ts.map +1 -1
- package/dist/lib/customize.js +21 -7
- package/dist/lib/ergonomic/bind.d.ts +11 -1
- package/dist/lib/ergonomic/bind.d.ts.map +1 -1
- package/dist/lib/ergonomic/bind.js +13 -3
- package/dist/lib/ergonomic/catalog.d.ts +902 -87
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
- package/dist/lib/ergonomic/catalog.js +35 -8
- package/dist/lib/ergonomic/composed.d.ts +4 -4
- package/dist/lib/ergonomic/composed.d.ts.map +1 -1
- package/dist/lib/ergonomic/composed.js +47 -45
- package/dist/lib/ergonomic/ids.d.ts +3 -1
- package/dist/lib/ergonomic/ids.d.ts.map +1 -1
- package/dist/lib/ergonomic/ids.js +41 -2
- package/dist/lib/ergonomic/index.d.ts +1 -1
- package/dist/lib/ergonomic/index.d.ts.map +1 -1
- package/dist/lib/ergonomic/index.js +2 -2
- package/dist/lib/operation.d.ts +11 -0
- package/dist/lib/operation.d.ts.map +1 -1
- package/dist/lib/references.d.ts +10 -0
- package/dist/lib/references.d.ts.map +1 -0
- package/dist/lib/references.js +28 -0
- package/dist/operations.gen.d.ts +2 -2
- package/dist/operations.gen.js +302 -302
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ npm install @neon/tools
|
|
|
8
8
|
|
|
9
9
|
## Create tools
|
|
10
10
|
|
|
11
|
-
Selectors are SDK paths. The returned record is keyed by those
|
|
11
|
+
Selectors are SDK paths, plus the custom tools listed in `customToolIds` (see [Custom tools](#custom-tools)). The returned record is keyed by those selectors. Each tool's published `id` is the last path segment, then the resource, in snake_case (`projects.list` → `list_projects`, `postgres.roles.resetPassword` → `reset_password_postgres_roles`, `postgres.connectionString` → `connection_string_postgres`). `publishedId` derives that string. `toolIds` lists every published selector.
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
import { createNeonTools, publishedId } from "@neon/tools";
|
|
@@ -110,6 +110,146 @@ const { data } = await incidents.execute({});
|
|
|
110
110
|
// { status: "operational", incidents: [], maintenance: [], affected_components: [], ... }
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
## Custom tools
|
|
114
|
+
|
|
115
|
+
Custom tools combine several requests into one call, or call Postgres or neon.com, and are not a single `NeonClient` method. They are selected, adapted, and executed like every other tool. `customToolIds` lists them.
|
|
116
|
+
|
|
117
|
+
| Selector | Published id | Returns |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| `auth.getConfig` | `get_config_auth` | The branch's Neon Auth integration and settings: trusted origins, localhost access, email and password, OAuth providers, email provider, the organization, magic link, and phone number plugins, and the webhook. `branch_id` defaults to the project's default branch. |
|
|
120
|
+
| `resources.search` | `search_resources` | `{ results: [{ id, title, url }] }` for organizations, projects (including projects shared with the user), branches, compute endpoints, and snapshots whose name or id contains `query`. A compute endpoint also matches its host, with or without `-pooler`, so a host from a connection string finds it. The id prefix (`org:`, `project:`, `branch:<project>/<branch>`, `endpoint:<project>/<endpoint>`, `snapshot:<project>/<snapshot>`) names the kind. |
|
|
121
|
+
| `resources.fetch` | `fetch_resources` | `{ id, title, text, url, metadata }` for an id from `resources.search`: markdown details in `text`, the console URL, and the organization with members and projects, the project with branches, the `branches.describe` result, the endpoint, or the snapshot in `metadata`. |
|
|
122
|
+
| `sql.run` | `run_sql` | `{ rows, totalRowCount, truncated, note? }` for one statement. `rows` holds at most `max_rows` (default 100, at most 10,000). |
|
|
123
|
+
| `sql.runTransaction` | `run_transaction_sql` | One `{ rows, totalRowCount, truncated, note? }` per statement, run in one transaction. |
|
|
124
|
+
| `sql.explain` | `explain_sql` | The `EXPLAIN (FORMAT JSON)` rows. `analyze: true` executes the statement. |
|
|
125
|
+
| `schema.listTables` | `list_tables_schema` | `{ table_schema, table_name, table_type }` for every table outside `pg_catalog` and `information_schema`. |
|
|
126
|
+
| `schema.describeTable` | `describe_table_schema` | `{ raw, formatted }`: columns, indexes, constraints, and sizes. A missing table throws `NeonClientError`. |
|
|
127
|
+
| `branches.describe` | `describe_branches` | `{ branch, console_url, text, database_structure }`, where `database_structure` is `[[], rows]`: one `{ tree_structure }` row per database, then the connected database's schemas and objects, read from the system catalogs in a `READ ONLY` transaction. When that query fails it is `null` and `database_structure_error` says why. |
|
|
128
|
+
| `queries.listSlow` | `list_slow_queries` | `{ slow_queries, total_queries_found }` from `pg_stat_statements`, slowest mean time first. Without the extension it throws `NeonClientError`. |
|
|
129
|
+
| `database.inspect` | `inspect_database` | One `neon inspect db` check: `{ check, describe, projectId, branchId, databases, fields, totalRowCount, rows, truncated, note? }`. |
|
|
130
|
+
| `migrations.prepare` | `prepare_migrations` | Runs `migration_sql` on a new temporary branch and returns `{ complete, temporary_branch, migration_result }`. `complete` holds exactly the fields `migrations.complete` takes (`migration_id`, `migration_sql`, `database_name`, `project_id`, `temporary_branch_id`, `parent_branch_id`); `temporary_branch` is `{ id, name, parent_id }`; `migration_result` holds each statement's rows. |
|
|
131
|
+
| `migrations.complete` | `complete_migrations` | Applies the migration to the parent unless `apply_changes` is false, deletes the temporary branch, and returns `{ applied, deletedBranchId?, cleanupError?, migrationResult? }`. |
|
|
132
|
+
| `queryTuning.prepare` | `prepare_query_tuning` | Runs `EXPLAIN ANALYZE` on a new temporary branch and returns `{ complete, execution_plan, table_schemas, sql, baseline_metrics }`. `complete` holds `tuning_id`, `database_name`, `project_id`, `temporary_branch_id`, and `role_name` when one was passed; `baseline_metrics` holds time, cost, rows, and buffer counters of the root plan node. |
|
|
133
|
+
| `queryTuning.complete` | `complete_query_tuning` | Applies `suggested_sql_statements` when `apply_changes` is true, deletes the temporary branch unless `should_delete_temporary_branch` is false, and returns `{ appliedChanges?, results?, deletedBranches?, message }`. |
|
|
134
|
+
| `docs.search` | `search_docs` | `{ hits: [{ title, url, slug, category, breadcrumb, heading, excerpt }] }` from neon.com site search. |
|
|
135
|
+
| `docs.get` | `get_docs` | `{ url, markdown }` for one neon.com page slug. |
|
|
136
|
+
| `feedback.send` | `send_feedback` | Posts `{ feedback, source }` to the Neon feedback service. |
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
const tools = createNeonTools({
|
|
140
|
+
apiKey,
|
|
141
|
+
tools: ["auth.getConfig", "resources.search", "resources.fetch", "sql.run"],
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const { data: config } = await tools["auth.getConfig"].execute({
|
|
145
|
+
project_id: "project-id",
|
|
146
|
+
});
|
|
147
|
+
config.oauth_providers; // [{ id: "google", type: "standard", client_id: "…", client_secret: "***redacted***" }]
|
|
148
|
+
|
|
149
|
+
const { data: found } = await tools["resources.search"].execute({
|
|
150
|
+
query: "checkout",
|
|
151
|
+
});
|
|
152
|
+
found.results; // [{ id: "project:project-id", title: "checkout-service", url: "https://console.neon.tech/app/projects/project-id" }]
|
|
153
|
+
|
|
154
|
+
const { data: project } = await tools["resources.fetch"].execute({
|
|
155
|
+
id: "project:project-id",
|
|
156
|
+
});
|
|
157
|
+
project.text; // "**Project Details**\n\n**Basic Information:**\n- Name: checkout-service\n…"
|
|
158
|
+
project.metadata; // { project: { id: "project-id", … }, branches: [ … ] }
|
|
159
|
+
|
|
160
|
+
const migrationTools = createNeonTools({
|
|
161
|
+
apiKey,
|
|
162
|
+
tools: ["migrations.prepare", "migrations.complete"],
|
|
163
|
+
});
|
|
164
|
+
const prepared = await migrationTools["migrations.prepare"].execute({
|
|
165
|
+
project_id: "project-id",
|
|
166
|
+
migration_sql: "ALTER TABLE users ADD COLUMN plan text",
|
|
167
|
+
});
|
|
168
|
+
await migrationTools["migrations.complete"].execute({
|
|
169
|
+
...prepared.data.complete,
|
|
170
|
+
apply_changes: true,
|
|
171
|
+
});
|
|
172
|
+
prepared.data.temporary_branch; // { id: "br-…", name: "mcp-migration-2026-11-06T20-05-00", parent_id: "br-main-…" }
|
|
173
|
+
|
|
174
|
+
const tuningTools = createNeonTools({
|
|
175
|
+
apiKey,
|
|
176
|
+
tools: ["queryTuning.prepare", "queryTuning.complete"],
|
|
177
|
+
});
|
|
178
|
+
const tuning = await tuningTools["queryTuning.prepare"].execute({
|
|
179
|
+
project_id: "project-id",
|
|
180
|
+
database_name: "neondb",
|
|
181
|
+
sql: "SELECT * FROM orders WHERE customer_id = 42",
|
|
182
|
+
});
|
|
183
|
+
await tuningTools["queryTuning.complete"].execute({
|
|
184
|
+
...tuning.data.complete,
|
|
185
|
+
suggested_sql_statements: ["CREATE INDEX ON orders (customer_id)"],
|
|
186
|
+
apply_changes: true,
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const { data: result } = await tools["sql.run"].execute({
|
|
190
|
+
project_id: "project-id",
|
|
191
|
+
sql: "SELECT id, email FROM users ORDER BY id",
|
|
192
|
+
max_rows: 2,
|
|
193
|
+
});
|
|
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
|
+
```
|
|
196
|
+
|
|
197
|
+
`auth.getConfig` replaces OAuth client secrets and the SMTP password with `"***redacted***"`. 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
|
+
|
|
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
|
+
|
|
201
|
+
`resources.search` leaves out a resource whose list the API refuses with 403 or 404, and fails on any other error, including a 5xx, an exhausted 429, and an aborted `signal`. It reads up to 400 projects per organization and 400 shared projects, and lists each project's branches, compute endpoints, and snapshots in parallel. Resources that belong to a branch (databases, roles, functions, buckets, triggers, credentials) are not searched, since each would cost one request per branch. `resources.fetch` reads the first page of an organization's members and projects and skips either when the API refuses it with 403 or 404; other errors fail the call. An id without a known prefix throws `NeonClientError`. Console URLs follow `baseUrl`: `https://console.neon.tech/api/v2` links to `https://console.neon.tech`.
|
|
202
|
+
|
|
203
|
+
### SQL tools
|
|
204
|
+
|
|
205
|
+
The SQL tools resolve a connection from `project_id` (required), then `branch_id` (default branch), `database_name` (`neondb`, else the first database), `role_name` (that database's owner), and `compute_id` (the branch's read-write compute). Their `metadata.method` is `"SQL"` and `metadata.path` is `/projects/{project_id}/connection_uri`, so `inject.projectId` fills `project_id`. Whether a tool can change data is in `annotations`, not `metadata.method`. `postgres.connectionString` resolves the same way and returns the URI, with `endpoint_id` as the compute and `pooled` defaulting to `true`.
|
|
206
|
+
|
|
207
|
+
A Postgres error rejects with the `NeonDbError` from `@neondatabase/serverless`, carrying `code` (SQLSTATE), `position`, `detail`, `hint`, and `where`. `database.inspect` throws `InspectDiagnosticError` (exported from `@neon/tools`, with `check` and the `NeonDbError` as `cause`) when Postgres rejects one of its own diagnostic queries, which is a bug in this package rather than in the input. A caller-side problem, such as a missing extension, a missing database, or a refused connection, keeps its own class.
|
|
208
|
+
|
|
209
|
+
`inspectChecks` lists every `database.inspect` check from the catalog the tool runs, as frozen objects with `id`, `scope` (`database` or `compute`), `requiresExtension`, `fields`, `sqlLimit`, and the `emptyNote` an empty result carries (`emptyNoteAllDatabases` when `database_name` is omitted).
|
|
210
|
+
|
|
211
|
+
`migrations.prepare` and `queryTuning.prepare` delete the temporary branch when anything after its creation fails, including the readiness wait (a `wait` timeout, a failed operation, or an aborted `signal`). Cleanup waits up to 60 seconds for the branch to finish provisioning before deleting it, regardless of `wait` and `signal`. `migrations.complete` applies first; if that fails the temporary branch stays so the call can be retried, and a failed delete after a successful apply is reported as `cleanupError`.
|
|
212
|
+
|
|
213
|
+
### Execution context
|
|
214
|
+
|
|
215
|
+
`execute(input, context)` takes these fields in addition to `signal` and `apiKey`:
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
await tools["sql.run"].execute(
|
|
219
|
+
{ project_id: "project-id", sql: "SELECT count(*) FROM orders" },
|
|
220
|
+
{
|
|
221
|
+
readOnly: true,
|
|
222
|
+
postgresRole: "app_reader",
|
|
223
|
+
caller: { source: "my_host", userAgent: "my-agent/1.0", client: "cursor" },
|
|
224
|
+
},
|
|
225
|
+
);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
| Field | Effect |
|
|
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.*` throw `NeonClientError` without running anything, because a caller statement such as `COMMIT` or `SET TRANSACTION READ WRITE` can leave a read-only transaction. `schema.*` and `queries.listSlow` behave the same; `branches.describe` and `database.inspect` always use a `READ ONLY` transaction. |
|
|
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
|
+
| `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
|
+
|
|
234
|
+
### Docs and feedback
|
|
235
|
+
|
|
236
|
+
`docs.search`, `docs.get`, and `feedback.send` call neon.com and the Neon feedback service, not the Neon API, and run without `apiKey`. Each request times out after 10 seconds. `docs.get` rejects slugs that contain `..` or `://` or start with `/`. Configure the endpoints on `createNeonTools`:
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
const tools = createNeonTools({
|
|
240
|
+
tools: ["docs.search", "docs.get", "feedback.send"],
|
|
241
|
+
siteSearchUrl: "https://example.com/site-search", // default: neon.com site search
|
|
242
|
+
docsBaseUrl: "https://neon.com", // docs.get reads <docsBaseUrl>/<slug>.md
|
|
243
|
+
feedbackUrl: "https://feedback.neon.tech/",
|
|
244
|
+
feedbackSource: "my_host", // default "neon_tools"
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
const { data } = await tools["docs.search"].execute({ query: "reset a branch" });
|
|
248
|
+
const { data: page } = await tools["docs.get"].execute({ slug: data.hits[0].slug });
|
|
249
|
+
```
|
|
250
|
+
|
|
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
|
+
|
|
113
253
|
## Writes and waiting
|
|
114
254
|
|
|
115
255
|
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.
|
|
@@ -145,21 +285,26 @@ const { data: role } = await tools["postgres.roles.create"].execute({
|
|
|
145
285
|
|
|
146
286
|
### Descriptions
|
|
147
287
|
|
|
148
|
-
|
|
288
|
+
Every tool and every top-level input has a description. A description that names another tool uses the name that tool publishes under, after `names` and `name`. `names` and `name` run once per selected tool. A tool you did not select is named by its default `id`, without calling them.
|
|
149
289
|
|
|
150
|
-
|
|
290
|
+
Pass `descriptions` to replace the package's copy: a map keyed by SDK path or the current published `id`, or a function that receives the package's text. A key that matches neither is ignored. Write `{{selector}}` to name another tool the same way; an unknown selector throws.
|
|
151
291
|
|
|
152
292
|
```ts
|
|
153
293
|
const tools = createNeonTools({
|
|
154
294
|
apiKey,
|
|
155
|
-
tools: ["projects.
|
|
295
|
+
tools: ["projects.create", "postgres.connectionString", "projects.delete"],
|
|
296
|
+
names: { "postgres.connectionString": "get_connection_string" },
|
|
156
297
|
descriptions: {
|
|
157
|
-
"
|
|
158
|
-
"
|
|
298
|
+
"postgres.connectionString":
|
|
299
|
+
"Get a connection string. Call it after {{projects.create}}.",
|
|
159
300
|
delete_projects:
|
|
160
301
|
"Delete a Neon project and all its data. NEVER run autonomously; always ask the user first.",
|
|
161
302
|
},
|
|
162
303
|
});
|
|
304
|
+
tools["projects.create"].description;
|
|
305
|
+
// "Creates a project with a default branch and read-write compute and waits until it is ready. Returns no connection string; use get_connection_string."
|
|
306
|
+
tools["postgres.connectionString"].description;
|
|
307
|
+
// "Get a connection string. Call it after create_projects."
|
|
163
308
|
```
|
|
164
309
|
|
|
165
310
|
### Tracking
|
|
@@ -365,7 +510,7 @@ The adapter maps approval requirements to Mastra's `requireApproval` field and f
|
|
|
365
510
|
|
|
366
511
|
## Safety and binary data
|
|
367
512
|
|
|
368
|
-
Every non-read operation
|
|
513
|
+
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.
|
|
369
514
|
|
|
370
515
|
Binary request fields accept base64 strings:
|
|
371
516
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NeonToolId } from "./lib/ergonomic/ids.js";
|
|
2
|
+
/** Tool descriptions that replace the generated OpenAPI first sentence, by selector. */
|
|
3
|
+
export declare const toolDescriptions: Readonly<Partial<Record<NeonToolId, string>>>;
|
|
4
|
+
/** Descriptions every operation gives these path parameters. */
|
|
5
|
+
export declare const pathInputDescriptions: {
|
|
6
|
+
readonly branch_id: "A br-... id, not a name.";
|
|
7
|
+
readonly org_id: "Organization id.";
|
|
8
|
+
readonly project_id: "Project id.";
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=descriptions.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptions.gen.d.ts","sourceRoot":"","sources":["../src/descriptions.gen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CA4I1E,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// src/descriptions.gen.ts
|
|
2
|
+
/** Tool descriptions that replace the generated OpenAPI first sentence, by selector. */
|
|
3
|
+
const toolDescriptions = {
|
|
4
|
+
"projects.list": "Lists the projects in an organization; search filters by name or id. To also find branches, computes, or snapshots, use {{resources.search}}.",
|
|
5
|
+
"projects.count": "Counts an organization's active projects without listing them; ones being created or deleted are not counted.",
|
|
6
|
+
"projects.get": "Gets a project's settings, owner, and usage. For branches, use {{branches.list}}.",
|
|
7
|
+
"projects.update": "Updates a project's name, settings, default compute settings, or history retention.",
|
|
8
|
+
"projects.delete": "Deletes a project with all its branches, computes, databases, and roles. NEVER run autonomously; always ask the user first. {{projects.recover}} undoes it within 7 days. For one branch, use {{branches.delete}}.",
|
|
9
|
+
"projects.recover": "Recovers a project deleted in the last 7 days; {{projects.list}} with recoverable true finds them. Some integrations need setting up again.",
|
|
10
|
+
"projects.transfer": "Moves projects from one organization to another. The API key needs access to both organizations.",
|
|
11
|
+
"projects.transferFromUser": "Deprecated: personal accounts are now organizations. Use {{projects.transfer}}.",
|
|
12
|
+
"projects.permissions.list": "Lists who has access to a project: each permission id, email, and grant date.",
|
|
13
|
+
"projects.permissions.grant": "Gives the Neon account with this email access to a project.",
|
|
14
|
+
"projects.permissions.revoke": "Removes one person's access to a project.",
|
|
15
|
+
"projects.members.list": "Lists organization members and their roles on an org-owned project; 404 when the project is not org-owned or per-project roles are off.",
|
|
16
|
+
"projects.members.setRole": "Sets an organization member's explicit role on a project. Idempotent.",
|
|
17
|
+
"projects.members.removeRole": "Removes an organization member's explicit role on a project; their organization role's project access remains. Idempotent.",
|
|
18
|
+
"branches.list": "Lists a project's branches with id (br-...), name, parent, and default flag; search finds a branch's id by name.",
|
|
19
|
+
"branches.get": "Gets a branch record: name, parent, state, protection, size, and timestamps. For its databases and tables, use {{branches.describe}}.",
|
|
20
|
+
"branches.update": "Renames a branch, protects or unprotects it, or sets when it expires.",
|
|
21
|
+
"branches.delete": "Deletes a branch with all its data and disconnects its clients. NEVER run autonomously; always ask the user first. The root, the default, and a branch with children cannot be deleted. For the whole project, use {{projects.delete}}.",
|
|
22
|
+
"branches.setDefault": "Makes a branch the project's default; the previous default loses the flag.",
|
|
23
|
+
"branches.finalizeRestore": "Finalizes a branch restored with finalize false: moves the original branch's computes onto it, restarting them, and takes over its name.",
|
|
24
|
+
"postgres.endpoints.list": "Lists the compute endpoints of every branch in a project. For one branch, use {{postgres.endpoints.listByBranch}}.",
|
|
25
|
+
"postgres.endpoints.listByBranch": "Lists a branch's compute endpoints. For every branch in the project, use {{postgres.endpoints.list}}.",
|
|
26
|
+
"postgres.endpoints.get": "Gets a compute endpoint (ep-...), including its host and state.",
|
|
27
|
+
"postgres.endpoints.create": "Creates a compute endpoint on a branch; a branch takes one read-write endpoint and any number of read-only. Returns no connection string; use {{postgres.connectionString}}.",
|
|
28
|
+
"postgres.endpoints.update": "Updates a compute endpoint's settings.",
|
|
29
|
+
"postgres.endpoints.delete": "Deletes a compute endpoint and drops its connections.",
|
|
30
|
+
"postgres.endpoints.start": "Starts a suspended compute endpoint.",
|
|
31
|
+
"postgres.endpoints.suspend": "Suspends a compute endpoint, dropping its connections.",
|
|
32
|
+
"postgres.endpoints.restart": "Restarts a compute endpoint by suspending and starting it, dropping its connections.",
|
|
33
|
+
"postgres.roles.list": "Lists a branch's Postgres roles.",
|
|
34
|
+
"postgres.roles.get": "Gets a Postgres role on a branch.",
|
|
35
|
+
"postgres.roles.delete": "Deletes a Postgres role from a branch.",
|
|
36
|
+
"postgres.roles.resetPassword": "Sets a new random password for a Postgres role and returns it. Drops the compute's connections.",
|
|
37
|
+
"postgres.databases.list": "Lists a branch's databases and their owners.",
|
|
38
|
+
"postgres.databases.get": "Gets a database on a branch and its owner.",
|
|
39
|
+
"postgres.databases.create": "Creates a database on a branch, owned by owner_name.",
|
|
40
|
+
"postgres.databases.update": "Renames a database or changes its owner.",
|
|
41
|
+
"postgres.databases.delete": "Deletes a database and its data from a branch.",
|
|
42
|
+
"postgres.dataApi.get": "Gets the Neon Data API configuration for one database on a branch.",
|
|
43
|
+
"postgres.dataApi.create": "Creates the Neon Data API, a REST interface over database_name, on a branch.",
|
|
44
|
+
"postgres.dataApi.update": "Updates the Neon Data API settings for a database and refreshes its schema cache.",
|
|
45
|
+
"postgres.dataApi.delete": "Deletes the Neon Data API for a database; requests to its endpoint start failing.",
|
|
46
|
+
"storage.get": "Checks whether object storage is available on a branch; a 404 says why not.",
|
|
47
|
+
"storage.buckets.list": "Lists a branch's object storage buckets, inherited ones included.",
|
|
48
|
+
"storage.buckets.create": "Creates an object storage bucket on a branch.",
|
|
49
|
+
"storage.buckets.delete": "Deletes a bucket from a branch.",
|
|
50
|
+
"storage.objects.list": "Lists a bucket's objects on a branch, inherited ones included.",
|
|
51
|
+
"storage.objects.delete": "Deletes one object from a bucket on a branch.",
|
|
52
|
+
"storage.objects.deleteByPrefix": "Soft-deletes every object on this branch whose key starts with prefix and returns the count; inherited objects stay.",
|
|
53
|
+
"storage.objects.presign": "Returns a short-lived presigned PUT or GET URL for one object, with the headers to send; no S3 credentials needed.",
|
|
54
|
+
"functions.list": "Lists the functions on a branch.",
|
|
55
|
+
"functions.get": "Gets a function on a branch by slug.",
|
|
56
|
+
"functions.update": "Sets a function's display name; null resets it to the slug. Only the branch that owns the function can rename it.",
|
|
57
|
+
"functions.delete": "Deletes a function from a branch.",
|
|
58
|
+
"functions.deploy": "Deploys a function version from any of zip, environment, and runtime; omitted ones keep the latest value, and the first deployment needs zip. It can return while still pending.",
|
|
59
|
+
"functions.customDomains.list": "Lists a branch's custom domains and their targets.",
|
|
60
|
+
"functions.customDomains.register": "Routes a domain you own to a function: entity_type function, entity_id the slug from {{functions.list}}. It goes live once a CNAME to the returned cname_target resolves.",
|
|
61
|
+
"functions.customDomains.delete": "Removes a custom domain from a branch and stops routing it.",
|
|
62
|
+
"triggers.list": "Lists a branch's function triggers, including inherited ones, which stay disabled on this branch until enabled.",
|
|
63
|
+
"triggers.get": "Gets a function trigger on a branch.",
|
|
64
|
+
"triggers.create": "Creates a trigger that calls a function on a five-field UTC cron schedule, or after an upload to one bucket, optionally under a key prefix. Names are unique on the branch.",
|
|
65
|
+
"triggers.update": "Updates a function trigger; body.type must match its kind. Editing an inherited trigger makes a local copy, disabled unless this request enables it.",
|
|
66
|
+
"triggers.delete": "Deletes a function trigger, or hides an inherited one on this branch. Invocations already queued still run.",
|
|
67
|
+
"credentials.list": "Lists the scoped credentials issued on a branch, without secrets.",
|
|
68
|
+
"credentials.create": "Issues a scoped credential on a branch. api_token and s3_secret_access_key are returned once: show them to the user and tell them to store them.",
|
|
69
|
+
"credentials.revoke": "Revokes a scoped credential. Idempotent.",
|
|
70
|
+
"credentials.rotate": "Replaces a scoped credential's secrets in place and returns them once; token_id stays. Not idempotent: if the response is lost, create a new credential ({{credentials.create}}) and revoke this one instead of retrying.",
|
|
71
|
+
"aiGateway.get": "Gets a branch's AI Gateway host; a 404 says why it is unavailable.",
|
|
72
|
+
"realtime.get": "Gets a branch's Realtime state, URL, and allowed origins; the secret comes from {{realtime.secret}}.",
|
|
73
|
+
"realtime.enable": "Enables Realtime on a branch, or changes its allowed origins, and waits until it is applied.",
|
|
74
|
+
"realtime.disable": "Disables Realtime on a branch, discarding its secret, and waits until it is applied.",
|
|
75
|
+
"realtime.secret": "Gets the secret the application backend issues Realtime tokens with; 404 until {{realtime.enable}} has run.",
|
|
76
|
+
"realtime.rotateSecret": "Replaces a branch's Realtime secret and waits until the old one stops working. NEVER run autonomously; always ask the user first. Then update the application backend from {{realtime.secret}}.",
|
|
77
|
+
"logs.query": "Returns a branch's log records. Filters combine with AND; pass logql or structured filters, not both. Pass since or start_time, not both; default last hour, max seven days. Private beta: a branch without logs returns 404 telemetry_not_enabled. Stream labels: {{logs.loki.queryRange}}.",
|
|
78
|
+
"logs.fields": "Lists the low-cardinality log fields seen on a branch, for {{logs.fieldValues}}.",
|
|
79
|
+
"logs.fieldValues": "Lists the distinct values of one log field; a field the branch never emitted returns unknown_field. Pass since or start_time, not both; default last six hours, max seven days.",
|
|
80
|
+
"snapshots.list": "Lists a project's snapshots.",
|
|
81
|
+
"snapshots.create": "Creates a snapshot of a branch.",
|
|
82
|
+
"snapshots.update": "Renames a snapshot or changes when it expires.",
|
|
83
|
+
"snapshots.delete": "Deletes a snapshot.",
|
|
84
|
+
"snapshots.getSchedule": "Gets a branch's automatic snapshot schedule.",
|
|
85
|
+
"operations.list": "Lists a project's operations; ones older than six months may be gone.",
|
|
86
|
+
"operations.get": "Gets one operation and its status.",
|
|
87
|
+
"auth.get": "Gets a branch's Neon Auth integration record: provider, base URL, JWKS URL, and database. Prefer {{auth.getConfig}}, which adds the auth settings, unless you only need the record.",
|
|
88
|
+
"auth.create": "Enables Neon Auth on a branch and creates the neon_auth schema in its database.",
|
|
89
|
+
"auth.disable": "Disables Neon Auth on a branch. delete_data also drops the neon_auth schema and its tables.",
|
|
90
|
+
"auth.updateConfig": "Sets the application name Neon Auth uses in its emails.",
|
|
91
|
+
"auth.oauthProviders.list": "Lists the social login providers (Google, GitHub, Microsoft, Vercel, Apple) of a branch's Neon Auth. For Neon Auth as an OAuth server, use {{auth.oauthServer.get}}.",
|
|
92
|
+
"auth.oauthProviders.add": "Adds a social login provider to a branch's Neon Auth. Microsoft and Apple need your own client_id and client_secret; for Apple these are the Services ID and .p8 key, plus apple_team_id and apple_key_id.",
|
|
93
|
+
"auth.oauthProviders.update": "Updates a social login provider on a branch's Neon Auth. For Apple, send a new client_secret (.p8 key) together with its apple_key_id.",
|
|
94
|
+
"auth.oauthProviders.delete": "Removes a social login provider from a branch's Neon Auth.",
|
|
95
|
+
"auth.oauthServer.get": "Gets a branch's Neon Auth OAuth 2.1 server settings (oauth_provider plugin), for example for MCP clients. For social login, use {{auth.oauthProviders.list}}.",
|
|
96
|
+
"auth.oauthServer.update": "Configures a branch's Neon Auth as an OAuth 2.1 server (oauth_provider plugin); root branch only. Enabling needs login_page, consent_page, and a resource or MCP resource. resources replaces the stored list, so send the full list from {{auth.oauthServer.get}}.",
|
|
97
|
+
"auth.oauthClients.list": "Lists the OAuth clients (apps, MCP clients) of a branch's Neon Auth OAuth server, without secrets; not social login providers.",
|
|
98
|
+
"auth.oauthClients.get": "Gets an OAuth client of a branch's Neon Auth OAuth server, without its secret.",
|
|
99
|
+
"auth.oauthClients.create": "Registers an OAuth client with a branch's Neon Auth OAuth server. A confidential client's client_secret is returned once: show it to the user and tell them to store it. resources must already be on the server, or be its MCP resource ({{auth.oauthServer.get}}). type is permanent.",
|
|
100
|
+
"auth.oauthClients.update": "Updates an OAuth client of Neon Auth's OAuth server; redirect_uris and resources replace the stored lists, and type cannot change.",
|
|
101
|
+
"auth.oauthClients.delete": "Deletes an OAuth client from Neon Auth's OAuth server, irreversibly; tokens already issued stay valid.",
|
|
102
|
+
"auth.oauthClients.rotateSecret": "Issues a new secret for a confidential OAuth client; the old one stops working at once. The new client_secret is returned once: show it to the user and tell them to store it.",
|
|
103
|
+
"auth.trustedDomains.list": "Lists the domains a branch's Neon Auth may redirect to after sign-in.",
|
|
104
|
+
"auth.trustedDomains.add": "Adds a domain a branch's Neon Auth may redirect to after sign-in.",
|
|
105
|
+
"auth.trustedDomains.delete": "Removes a domain from the ones a branch's Neon Auth may redirect to.",
|
|
106
|
+
"auth.users.create": "Creates a Neon Auth user on a branch who can sign in right away.",
|
|
107
|
+
"auth.users.delete": "Deletes a Neon Auth user from a branch. Irreversible.",
|
|
108
|
+
"auth.users.updateRole": "Sets the roles of a Neon Auth user on a branch.",
|
|
109
|
+
"auth.allowLocalhost.get": "Gets whether a branch's Neon Auth accepts localhost origins.",
|
|
110
|
+
"auth.allowLocalhost.update": "Sets whether a branch's Neon Auth accepts localhost origins; turn it off for production. Current value: {{auth.getConfig}}.",
|
|
111
|
+
"auth.emailAndPassword.get": "Gets a branch's Neon Auth email and password sign-in settings.",
|
|
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; the SMTP password comes back empty.",
|
|
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
|
+
"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. OAuth and SMTP secrets come back empty.",
|
|
117
|
+
"auth.plugins.magicLink.update": "Updates the Neon Auth magic link plugin; omitted fields keep their value. Current values: {{auth.getConfig}}.",
|
|
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
|
+
"auth.plugins.phoneNumber.get": "Gets a branch's Neon Auth SMS OTP plugin settings.",
|
|
120
|
+
"auth.plugins.phoneNumber.update": "Updates the Neon Auth SMS OTP plugin; omitted fields keep their value. SMS needs a webhook with the send.otp event ({{auth.webhooks.update}}). Current values: {{auth.getConfig}}.",
|
|
121
|
+
"auth.webhooks.get": "Gets a branch's Neon Auth webhook configuration.",
|
|
122
|
+
"auth.webhooks.update": "Replaces a branch's Neon Auth webhook configuration; omitted fields reset, so { enabled: false } alone clears webhook_url and enabled_events. Send every field to keep, read from {{auth.getConfig}}.",
|
|
123
|
+
"consumption.perProject": "Returns per-project consumption on legacy Scale, Business, and Enterprise billing. For current plans, use {{consumption.perProjectV2}}.",
|
|
124
|
+
"consumption.perProjectV2": "Returns per-project consumption in an organization. metrics: every name {{consumption.perBranchV2}} takes, plus extra_branches_month and snapshot_storage_bytes_month. Launch, Scale, Agent, Business, or Enterprise plans; others get 403.",
|
|
125
|
+
"consumption.perBranchV2": "Returns per-branch consumption for project_ids. metrics: compute_unit_seconds, root_branch_bytes_month, child_branch_bytes_month, instant_restore_bytes_month, public_network_transfer_bytes, private_network_transfer_bytes, functions_active_capacity_microseconds, functions_waiting_capacity_microseconds, functions_invocations, functions_egress_bytes. Usage-based Launch, Scale, Agent, or Enterprise plans only.",
|
|
126
|
+
"apiKeys.list": "Lists your personal API keys, without tokens. An organization API key gets 404; use {{organizations.apiKeys.list}}.",
|
|
127
|
+
"apiKeys.create": "Creates a personal API key. The key is returned once: show it to the user and tell them to store it.",
|
|
128
|
+
"apiKeys.revoke": "Revokes a personal API key. Irreversible.",
|
|
129
|
+
"organizations.get": "Gets an organization's name, plan, and settings.",
|
|
130
|
+
"organizations.members.list": "Lists an organization's members and their roles.",
|
|
131
|
+
"organizations.members.get": "Gets an organization member and their role.",
|
|
132
|
+
"organizations.members.update": "Changes an organization member's role. Admins only.",
|
|
133
|
+
"organizations.members.remove": "Removes a member from an organization. Admins only; the last admin cannot be removed.",
|
|
134
|
+
"organizations.invitations.list": "Lists an organization's pending and accepted invitations.",
|
|
135
|
+
"organizations.invitations.create": "Invites people to an organization by email; existing Neon users join at once, others are asked to sign up.",
|
|
136
|
+
"organizations.spendingLimit.get": "Gets an organization's monthly spending limit (spending_limit_cents null means none). Launch and Scale only.",
|
|
137
|
+
"organizations.spendingLimit.set": "Sets an organization's monthly spending limit; Neon emails at 80% and 100% and never suspends computes. Admins on Launch and Scale only.",
|
|
138
|
+
"organizations.spendingLimit.delete": "Removes an organization's monthly spending limit. Idempotent.",
|
|
139
|
+
"organizations.apiKeys.list": "Lists an organization's API keys, without their tokens.",
|
|
140
|
+
"organizations.apiKeys.create": "Creates an organization API key, optionally limited to one project. The key is returned once: show it to the user and tell them to store it.",
|
|
141
|
+
"organizations.apiKeys.revoke": "Revokes an organization API key. Irreversible.",
|
|
142
|
+
"user.me": "Gets the authenticated Neon user: ids, plan, and linked login accounts. An organization API key gets 404."
|
|
143
|
+
};
|
|
144
|
+
/** Descriptions every operation gives these path parameters. */
|
|
145
|
+
const pathInputDescriptions = {
|
|
146
|
+
"branch_id": "A br-... id, not a name.",
|
|
147
|
+
"org_id": "Organization id.",
|
|
148
|
+
"project_id": "Project id."
|
|
149
|
+
};
|
|
150
|
+
export { pathInputDescriptions, toolDescriptions };
|
|
@@ -2801,8 +2801,8 @@ export declare const zDataApiSettings: z.ZodObject<{
|
|
|
2801
2801
|
*/
|
|
2802
2802
|
export declare const zDataApiCreateRequest: z.ZodObject<{
|
|
2803
2803
|
auth_provider: z.ZodOptional<z.ZodEnum<{
|
|
2804
|
-
external: "external";
|
|
2805
2804
|
neon_auth: "neon_auth";
|
|
2805
|
+
external: "external";
|
|
2806
2806
|
}>>;
|
|
2807
2807
|
jwks_url: z.ZodOptional<z.ZodURL>;
|
|
2808
2808
|
provider_name: z.ZodOptional<z.ZodString>;
|
|
@@ -2849,8 +2849,8 @@ export declare const zDataApiReponse: z.ZodObject<{
|
|
|
2849
2849
|
available_schemas: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
2850
2850
|
observed_at: z.ZodOptional<z.ZodISODateTime>;
|
|
2851
2851
|
auth_provider: z.ZodOptional<z.ZodEnum<{
|
|
2852
|
-
external: "external";
|
|
2853
2852
|
neon_auth: "neon_auth";
|
|
2853
|
+
external: "external";
|
|
2854
2854
|
}>>;
|
|
2855
2855
|
jwks_url: z.ZodOptional<z.ZodURL>;
|
|
2856
2856
|
provider_name: z.ZodOptional<z.ZodString>;
|
|
@@ -2882,8 +2882,8 @@ export declare const zNeonAuthSupportedAuthProvider: z.ZodEnum<{
|
|
|
2882
2882
|
better_auth: "better_auth";
|
|
2883
2883
|
}>;
|
|
2884
2884
|
export declare const zNeonAuthProviderProjectOwnedBy: z.ZodEnum<{
|
|
2885
|
-
user: "user";
|
|
2886
2885
|
neon: "neon";
|
|
2886
|
+
user: "user";
|
|
2887
2887
|
}>;
|
|
2888
2888
|
export declare const zNeonAuthProviderProjectTransferStatus: z.ZodEnum<{
|
|
2889
2889
|
finished: "finished";
|
|
@@ -3450,8 +3450,8 @@ export declare const zNeonAuthIntegration: z.ZodObject<{
|
|
|
3450
3450
|
db_name: z.ZodString;
|
|
3451
3451
|
created_at: z.ZodISODateTime;
|
|
3452
3452
|
owned_by: z.ZodEnum<{
|
|
3453
|
-
user: "user";
|
|
3454
3453
|
neon: "neon";
|
|
3454
|
+
user: "user";
|
|
3455
3455
|
}>;
|
|
3456
3456
|
transfer_status: z.ZodOptional<z.ZodEnum<{
|
|
3457
3457
|
finished: "finished";
|
|
@@ -3473,8 +3473,8 @@ export declare const zListNeonAuthIntegrationsResponse: z.ZodObject<{
|
|
|
3473
3473
|
db_name: z.ZodString;
|
|
3474
3474
|
created_at: z.ZodISODateTime;
|
|
3475
3475
|
owned_by: z.ZodEnum<{
|
|
3476
|
-
user: "user";
|
|
3477
3476
|
neon: "neon";
|
|
3477
|
+
user: "user";
|
|
3478
3478
|
}>;
|
|
3479
3479
|
transfer_status: z.ZodOptional<z.ZodEnum<{
|
|
3480
3480
|
finished: "finished";
|
|
@@ -5379,8 +5379,8 @@ export declare const zUpdateProjectBranchDataApiPath: z.ZodObject<{
|
|
|
5379
5379
|
}, z.core.$strict>;
|
|
5380
5380
|
export declare const zCreateProjectBranchDataApiBody: z.ZodObject<{
|
|
5381
5381
|
auth_provider: z.ZodOptional<z.ZodEnum<{
|
|
5382
|
-
external: "external";
|
|
5383
5382
|
neon_auth: "neon_auth";
|
|
5383
|
+
external: "external";
|
|
5384
5384
|
}>>;
|
|
5385
5385
|
jwks_url: z.ZodOptional<z.ZodURL>;
|
|
5386
5386
|
provider_name: z.ZodOptional<z.ZodString>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { NeonError } from "@neon/sdk";
|
|
2
|
+
import { inspectChecks } from "./lib/custom/sql/inspect/catalog.js";
|
|
3
|
+
import { InspectDiagnosticError } from "./lib/custom/sql/inspect/inspect.js";
|
|
2
4
|
import { type InjectedNeonTool, type NeonToolCustomizeOptions, type NeonToolInjectOptions, type NeonToolNameOverrides } from "./lib/customize.js";
|
|
3
|
-
import { type NeonToolId, type PublishedId, publishedId, type ToolClientOptions, toolFactories, toolIds } from "./lib/ergonomic/index.js";
|
|
5
|
+
import { customToolIds, type NeonToolId, type PublishedId, publishedId, type ToolClientOptions, toolFactories, toolIds } from "./lib/ergonomic/index.js";
|
|
4
6
|
export type { NeonBearerCredential } from "./lib/auth.js";
|
|
7
|
+
export type { InspectCheckInfo } from "./lib/custom/sql/inspect/catalog.js";
|
|
8
|
+
export type { InspectCheck } from "./lib/custom/sql/inspect/queries.js";
|
|
5
9
|
export type { InjectedNeonTool, NeonToolCustomizeOptions, NeonToolDescriptionOverrides, NeonToolDescriptionSource, NeonToolInjectOptions, NeonToolInjectValue, NeonToolNameOverrides, NeonToolNameSource, NeonToolOnExecute, NeonToolOnExecuteEvent, } from "./lib/customize.js";
|
|
6
|
-
export type { JsonSafe, JsonSafeBlob, NeonTool, NeonToolAnnotations, NeonToolExecutionContext, NeonToolMetadata, NeonToolResult, } from "./lib/operation.js";
|
|
10
|
+
export type { JsonSafe, JsonSafeBlob, NeonTool, NeonToolAnnotations, NeonToolCaller, NeonToolExecutionContext, NeonToolMetadata, NeonToolResult, } from "./lib/operation.js";
|
|
7
11
|
export type { NeonToolId, PublishedId };
|
|
8
|
-
export { NeonError, publishedId, toolIds };
|
|
12
|
+
export { customToolIds, InspectDiagnosticError, inspectChecks, NeonError, publishedId, toolIds, };
|
|
9
13
|
type ToolFactories = typeof toolFactories;
|
|
10
14
|
export type NeonTools<Tools extends readonly NeonToolId[] = []> = {
|
|
11
15
|
[Tool in Tools[number]]: ReturnType<ToolFactories[Tool]>;
|
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,
|
|
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,sBA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,CAAC,EAAE,MAAM,CAAC,CAAC;AAY7D,wBAAgB,cAAc,CAC7B,KAAK,CAAC,EAAE,SAAS,UAAU,EAC3B,KAAK,CAAC,MAAM,SAAS,qBAAqB,GAAG,SAAS,GAAG,SAAS,EAElE,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,sBAAsB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,CACA;IAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,qBAAqB,CAAA;CAAE,GAC/D;IAAE,KAAK,EAAE,qBAAqB,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,CACjE,GACA,aAAa,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AAC7B,wBAAgB,cAAc,CAC7B,KAAK,CAAC,EAAE,SAAS,UAAU,EAC3B,KAAK,CAAC,MAAM,SAAS,qBAAqB,GAAG,SAAS,GAAG,SAAS,EAElE,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,sBAAsB,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,MAAM,SAAS,qBAAqB,GACpC,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,GACvC,SAAS,CAAC,EAAE,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inspectChecks } from "./lib/custom/sql/inspect/catalog.js";
|
|
2
2
|
import { publishedId } from "./lib/ergonomic/bind.js";
|
|
3
|
+
import { InspectDiagnosticError } from "./lib/custom/sql/inspect/inspect.js";
|
|
4
|
+
import { customToolIds, isNeonToolId, toolIds, unpublishedToolError } from "./lib/ergonomic/ids.js";
|
|
5
|
+
import { applyToolCustomization, assertToolCustomizeOptions, publishedToolId } from "./lib/customize.js";
|
|
3
6
|
import { toolFactories } from "./lib/ergonomic/catalog.js";
|
|
4
|
-
import { isNeonToolId, toolIds, unpublishedToolError } from "./lib/ergonomic/ids.js";
|
|
5
7
|
import { NeonError } from "@neon/sdk";
|
|
6
8
|
// src/index.ts
|
|
7
9
|
const assertKnownNameKeys = (names, tools) => {
|
|
@@ -30,15 +32,16 @@ const bindTools = (options) => {
|
|
|
30
32
|
return [toolId, factoryFor(toolId)(options)];
|
|
31
33
|
});
|
|
32
34
|
assertKnownNameKeys(options.names, rawEntries.map(([, tool]) => tool));
|
|
33
|
-
const entries = rawEntries.map(([id, tool]) => {
|
|
34
|
-
return [id, hasToolCustomization(options) ? applyToolCustomization(tool, options) : tool];
|
|
35
|
-
});
|
|
36
35
|
const publishedIds = /* @__PURE__ */ new Map();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const selectorsById = /* @__PURE__ */ new Map();
|
|
37
|
+
for (const [id, tool] of rawEntries) {
|
|
38
|
+
const published = publishedToolId(tool, options);
|
|
39
|
+
const previous = selectorsById.get(published);
|
|
40
|
+
if (previous !== void 0) throw new Error(`Duplicate Neon tool id "${published}" for ${previous}, ${id}`);
|
|
41
|
+
selectorsById.set(published, id);
|
|
42
|
+
publishedIds.set(id, published);
|
|
41
43
|
}
|
|
44
|
+
const entries = rawEntries.map(([id, tool]) => [id, applyToolCustomization(tool, options, publishedIds)]);
|
|
42
45
|
const tools = Object.fromEntries(entries);
|
|
43
46
|
assertNeonTools(tools, selected);
|
|
44
47
|
return tools;
|
|
@@ -51,6 +54,7 @@ function createNeonTool(id, options) {
|
|
|
51
54
|
assertToolCustomizeOptions(options);
|
|
52
55
|
const tool = factoryFor(id)(options);
|
|
53
56
|
assertKnownNameKeys(options.names, [tool]);
|
|
54
|
-
|
|
57
|
+
const publishedIds = /* @__PURE__ */ new Map([[id, publishedToolId(tool, options)]]);
|
|
58
|
+
return applyToolCustomization(tool, options, publishedIds);
|
|
55
59
|
}
|
|
56
|
-
export { NeonError, createNeonTool, createNeonTools, publishedId, toolIds };
|
|
60
|
+
export { InspectDiagnosticError, NeonError, createNeonTool, createNeonTools, customToolIds, inspectChecks, publishedId, toolIds };
|