@neon/tools 0.8.0 → 1.0.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 +7 -7
- package/dist/lib/ergonomic/catalog.d.ts +186 -2
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
- package/dist/lib/ergonomic/catalog.js +4 -2
- package/dist/lib/ergonomic/composed.d.ts +253 -3
- package/dist/lib/ergonomic/composed.d.ts.map +1 -1
- package/dist/lib/ergonomic/composed.js +78 -18
- package/dist/lib/ergonomic/ids.d.ts +2 -2
- package/dist/lib/ergonomic/ids.d.ts.map +1 -1
- package/dist/lib/ergonomic/ids.js +3 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ const tools = createNeonTools({
|
|
|
24
24
|
tools: [
|
|
25
25
|
"projects.list",
|
|
26
26
|
"projects.createAndConnect",
|
|
27
|
-
"branches.
|
|
27
|
+
"branches.createAndConnect",
|
|
28
28
|
"branches.resetFromParent",
|
|
29
29
|
"branches.compareSchema",
|
|
30
30
|
],
|
|
@@ -70,7 +70,7 @@ Each tool includes its Zod 4 `inputSchema`, published `id`, title, description,
|
|
|
70
70
|
Paginated lists call `.all()` and return the item array. Do not pass a cursor; those fields are omitted from the input schema.
|
|
71
71
|
|
|
72
72
|
```ts
|
|
73
|
-
const createBranch = createNeonTool("branches.
|
|
73
|
+
const createBranch = createNeonTool("branches.createAndConnect", { apiKey });
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
## Writes and waiting
|
|
@@ -83,7 +83,7 @@ An abort `signal` on `execute` or a wait timeout stops the poll, not the create:
|
|
|
83
83
|
|
|
84
84
|
`metadata.method` and `metadata.path` name the first request; extra readiness GETs are not listed there.
|
|
85
85
|
|
|
86
|
-
These public client methods are not tools: `
|
|
86
|
+
These public client methods are not tools: `operations.waitFor`, `postgres.roles.password`, and `storage.objects.get`. Waiting is what the write tools already do. `projects.create` and `branches.create` return the created resource without a connection string; `createAndConnect` returns a URI.
|
|
87
87
|
|
|
88
88
|
## Optional host add-ons
|
|
89
89
|
|
|
@@ -127,17 +127,17 @@ This package does not send analytics. Mutating `event.input` does not change a g
|
|
|
127
127
|
```ts
|
|
128
128
|
const tools = createNeonTools({
|
|
129
129
|
apiKey,
|
|
130
|
-
tools: ["branches.
|
|
131
|
-
names: { "branches.
|
|
130
|
+
tools: ["branches.createAndConnect", "projects.list"] as const,
|
|
131
|
+
names: { "branches.createAndConnect": "create_branch" },
|
|
132
132
|
name: (id) => `neon_${id}`,
|
|
133
133
|
});
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
Those tools publish as `neon_create_branch` and `neon_list_projects`. The record is still keyed by SDK path (`tools["branches.
|
|
136
|
+
Those tools publish as `neon_create_branch` and `neon_list_projects`. The record is still keyed by SDK path (`tools["branches.createAndConnect"]`). MCP and Mastra publish `tool.id`. Eve uses the filename as the model-facing name, so name the file after the published `id`. Duplicate or non-snake-case ids throw, and a `names` key that matches no selected tool throws.
|
|
137
137
|
|
|
138
138
|
### Project and branch injection
|
|
139
139
|
|
|
140
|
-
Tools take path parameters as `project_id` and `branch_id`. A host that already knows those values can inject them, including on `branches.
|
|
140
|
+
Tools take path parameters as `project_id` and `branch_id`. A host that already knows those values can inject them, including on `branches.createAndConnect`. Without `omitFromSchema`, the published field becomes optional and a caller-supplied value wins. With `omitFromSchema: true`, the field is removed from the published schema and the injector is the only source:
|
|
141
141
|
|
|
142
142
|
```ts
|
|
143
143
|
const tools = createNeonTools({
|
|
@@ -173,6 +173,137 @@ export declare const toolFactories: {
|
|
|
173
173
|
hipaa_enabled_at?: string | null | undefined;
|
|
174
174
|
effective_project_permission?: (import("@neon/sdk").ProjectPermissionLevel | null) | undefined;
|
|
175
175
|
}>;
|
|
176
|
+
"projects.create": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
177
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
quota: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
active_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
180
|
+
compute_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
181
|
+
written_data_bytes: z.ZodOptional<z.ZodInt>;
|
|
182
|
+
data_transfer_bytes: z.ZodOptional<z.ZodInt>;
|
|
183
|
+
logical_size_bytes: z.ZodOptional<z.ZodInt>;
|
|
184
|
+
}, z.core.$strict>>;
|
|
185
|
+
allowed_ips: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
+
protected_branches_only: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
enable_logical_replication: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
maintenance_window: z.ZodOptional<z.ZodObject<{
|
|
191
|
+
weekdays: z.ZodArray<z.ZodInt>;
|
|
192
|
+
start_time: z.ZodString;
|
|
193
|
+
end_time: z.ZodString;
|
|
194
|
+
}, z.core.$strict>>;
|
|
195
|
+
block_public_connections: z.ZodOptional<z.ZodBoolean>;
|
|
196
|
+
block_vpc_connections: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
+
audit_log_level: z.ZodOptional<z.ZodEnum<{
|
|
198
|
+
base: "base";
|
|
199
|
+
extended: "extended";
|
|
200
|
+
full: "full";
|
|
201
|
+
}>>;
|
|
202
|
+
hipaa: z.ZodOptional<z.ZodBoolean>;
|
|
203
|
+
preload_libraries: z.ZodOptional<z.ZodObject<{
|
|
204
|
+
use_defaults: z.ZodOptional<z.ZodBoolean>;
|
|
205
|
+
enabled_libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
206
|
+
}, z.core.$strict>>;
|
|
207
|
+
}, z.core.$strict>>;
|
|
208
|
+
name: z.ZodOptional<z.ZodString>;
|
|
209
|
+
branch: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
name: z.ZodOptional<z.ZodString>;
|
|
211
|
+
role_name: z.ZodOptional<z.ZodString>;
|
|
212
|
+
database_name: z.ZodOptional<z.ZodString>;
|
|
213
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
214
|
+
}, z.core.$strict>>;
|
|
215
|
+
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
provisioner: z.ZodOptional<z.ZodString>;
|
|
218
|
+
region_id: z.ZodOptional<z.ZodString>;
|
|
219
|
+
default_endpoint_settings: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
pg_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
221
|
+
pgbouncer_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
222
|
+
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
225
|
+
}, z.core.$strict>>;
|
|
226
|
+
pg_version: z.ZodOptional<z.ZodInt>;
|
|
227
|
+
store_passwords: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
history_retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
229
|
+
org_id: z.ZodOptional<z.ZodString>;
|
|
230
|
+
}, z.core.$strict>, "create_projects", {
|
|
231
|
+
data_storage_bytes_hour: number;
|
|
232
|
+
data_transfer_bytes: number;
|
|
233
|
+
written_data_bytes: number;
|
|
234
|
+
compute_time_seconds: number;
|
|
235
|
+
active_time_seconds: number;
|
|
236
|
+
cpu_used_sec: number;
|
|
237
|
+
id: string;
|
|
238
|
+
platform_id: string;
|
|
239
|
+
region_id: string;
|
|
240
|
+
name: string;
|
|
241
|
+
provisioner: import("@neon/sdk").Provisioner;
|
|
242
|
+
default_endpoint_settings?: {
|
|
243
|
+
pg_settings?: {
|
|
244
|
+
[x: string]: string;
|
|
245
|
+
} | null | undefined;
|
|
246
|
+
pgbouncer_settings?: {
|
|
247
|
+
[x: string]: string;
|
|
248
|
+
} | null | undefined;
|
|
249
|
+
autoscaling_limit_min_cu?: number | null | undefined;
|
|
250
|
+
autoscaling_limit_max_cu?: number | null | undefined;
|
|
251
|
+
suspend_timeout_seconds?: number | null | undefined;
|
|
252
|
+
} | null | undefined;
|
|
253
|
+
settings?: {
|
|
254
|
+
quota?: {
|
|
255
|
+
active_time_seconds?: number | null | undefined;
|
|
256
|
+
compute_time_seconds?: number | null | undefined;
|
|
257
|
+
written_data_bytes?: number | null | undefined;
|
|
258
|
+
data_transfer_bytes?: number | null | undefined;
|
|
259
|
+
logical_size_bytes?: number | null | undefined;
|
|
260
|
+
} | null | undefined;
|
|
261
|
+
allowed_ips?: {
|
|
262
|
+
ips?: string[] | null | undefined;
|
|
263
|
+
protected_branches_only?: boolean | null | undefined;
|
|
264
|
+
} | null | undefined;
|
|
265
|
+
enable_logical_replication?: boolean | null | undefined;
|
|
266
|
+
maintenance_window?: {
|
|
267
|
+
weekdays: number[];
|
|
268
|
+
start_time: string;
|
|
269
|
+
end_time: string;
|
|
270
|
+
} | null | undefined;
|
|
271
|
+
block_public_connections?: boolean | null | undefined;
|
|
272
|
+
block_vpc_connections?: boolean | null | undefined;
|
|
273
|
+
audit_log_level?: import("@neon/sdk").ProjectAuditLogLevel | null | undefined;
|
|
274
|
+
hipaa?: boolean | null | undefined;
|
|
275
|
+
preload_libraries?: {
|
|
276
|
+
use_defaults?: boolean | null | undefined;
|
|
277
|
+
enabled_libraries?: string[] | null | undefined;
|
|
278
|
+
} | null | undefined;
|
|
279
|
+
} | null | undefined;
|
|
280
|
+
pg_version: import("@neon/sdk").PgVersion;
|
|
281
|
+
proxy_host: string;
|
|
282
|
+
branch_logical_size_limit: number;
|
|
283
|
+
branch_logical_size_limit_bytes: number;
|
|
284
|
+
store_passwords: boolean;
|
|
285
|
+
maintenance_starts_at?: string | null | undefined;
|
|
286
|
+
creation_source: string;
|
|
287
|
+
history_retention_seconds: number;
|
|
288
|
+
created_at: string;
|
|
289
|
+
updated_at: string;
|
|
290
|
+
synthetic_storage_size?: number | null | undefined;
|
|
291
|
+
consumption_period_start: string;
|
|
292
|
+
consumption_period_end: string;
|
|
293
|
+
quota_reset_at?: string | null | undefined;
|
|
294
|
+
owner_id: string;
|
|
295
|
+
owner?: {
|
|
296
|
+
email: string;
|
|
297
|
+
name: string;
|
|
298
|
+
branches_limit: number;
|
|
299
|
+
subscription_type: import("@neon/sdk").BillingSubscriptionType;
|
|
300
|
+
} | null | undefined;
|
|
301
|
+
compute_last_active_at?: string | null | undefined;
|
|
302
|
+
org_id?: string | null | undefined;
|
|
303
|
+
maintenance_scheduled_for?: string | null | undefined;
|
|
304
|
+
hipaa_enabled_at?: string | null | undefined;
|
|
305
|
+
effective_project_permission?: (import("@neon/sdk").ProjectPermissionLevel | null) | undefined;
|
|
306
|
+
}>;
|
|
176
307
|
"projects.createAndConnect": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
177
308
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
178
309
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -802,7 +933,60 @@ export declare const toolFactories: {
|
|
|
802
933
|
deletion_method: "user" | "ttl";
|
|
803
934
|
} | null | undefined;
|
|
804
935
|
}>;
|
|
805
|
-
"branches.
|
|
936
|
+
"branches.create": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
937
|
+
project_id: z.ZodString;
|
|
938
|
+
name: z.ZodOptional<z.ZodString>;
|
|
939
|
+
parent_id: z.ZodOptional<z.ZodString>;
|
|
940
|
+
compute: z.ZodOptional<z.ZodObject<{
|
|
941
|
+
min_cu: z.ZodOptional<z.ZodNumber>;
|
|
942
|
+
max_cu: z.ZodOptional<z.ZodNumber>;
|
|
943
|
+
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
944
|
+
}, z.core.$strict>>;
|
|
945
|
+
no_compute: z.ZodOptional<z.ZodBoolean>;
|
|
946
|
+
}, z.core.$strict>, "create_branches", {
|
|
947
|
+
id: string;
|
|
948
|
+
project_id: string;
|
|
949
|
+
parent_id?: string | null | undefined;
|
|
950
|
+
parent_lsn?: string | null | undefined;
|
|
951
|
+
parent_timestamp?: string | null | undefined;
|
|
952
|
+
name: string;
|
|
953
|
+
current_state: import("@neon/sdk").BranchState;
|
|
954
|
+
pending_state?: string | null | undefined;
|
|
955
|
+
state_changed_at: string;
|
|
956
|
+
logical_size?: number | null | undefined;
|
|
957
|
+
creation_source: string;
|
|
958
|
+
primary?: boolean | null | undefined;
|
|
959
|
+
default: boolean;
|
|
960
|
+
protected: boolean;
|
|
961
|
+
cpu_used_sec: number;
|
|
962
|
+
compute_time_seconds: number;
|
|
963
|
+
active_time_seconds: number;
|
|
964
|
+
written_data_bytes: number;
|
|
965
|
+
data_transfer_bytes: number;
|
|
966
|
+
created_at: string;
|
|
967
|
+
updated_at: string;
|
|
968
|
+
ttl_interval_seconds?: number | null | undefined;
|
|
969
|
+
expires_at?: string | null | undefined;
|
|
970
|
+
last_reset_at?: string | null | undefined;
|
|
971
|
+
created_by?: {
|
|
972
|
+
name?: string | null | undefined;
|
|
973
|
+
image?: string | null | undefined;
|
|
974
|
+
} | null | undefined;
|
|
975
|
+
init_source?: string | null | undefined;
|
|
976
|
+
restore_status?: string | null | undefined;
|
|
977
|
+
restored_from?: string | null | undefined;
|
|
978
|
+
restored_as?: string | null | undefined;
|
|
979
|
+
restricted_actions?: {
|
|
980
|
+
name: string;
|
|
981
|
+
reason: string;
|
|
982
|
+
}[] | null | undefined;
|
|
983
|
+
recovery?: {
|
|
984
|
+
deleted_at: string;
|
|
985
|
+
recoverable_until: string;
|
|
986
|
+
deletion_method: "user" | "ttl";
|
|
987
|
+
} | null | undefined;
|
|
988
|
+
}>;
|
|
989
|
+
"branches.createAndConnect": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
806
990
|
project_id: z.ZodString;
|
|
807
991
|
name: z.ZodOptional<z.ZodString>;
|
|
808
992
|
parent_id: z.ZodOptional<z.ZodString>;
|
|
@@ -812,7 +996,7 @@ export declare const toolFactories: {
|
|
|
812
996
|
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
813
997
|
}, z.core.$strict>>;
|
|
814
998
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
815
|
-
}, z.core.$strict>, "
|
|
999
|
+
}, z.core.$strict>, "create_and_connect_branches", {
|
|
816
1000
|
branch: {
|
|
817
1001
|
id: string;
|
|
818
1002
|
project_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAMN,KAAK,iBAAiB,EACtB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAMN,KAAK,iBAAiB,EACtB,MAAM,WAAW,CAAC;AAanB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC;AAE7D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAytC6C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decodeBase64 } from "../binary.js";
|
|
2
2
|
import { bindTool, collectObjectList, collectPages, fromGenerated, publishedId } from "./bind.js";
|
|
3
|
-
import { compareSchemaTool, connectionStringTool,
|
|
3
|
+
import { compareSchemaTool, connectionStringTool, createBranchAndConnectTool, createBranchTool, createProjectAndConnectTool, createProjectTool, getDefaultTool, resetFromParentTool, restoreSnapshotTool, setScheduleTool } from "./composed.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
//#region src/lib/ergonomic/catalog.ts
|
|
6
6
|
const logReadAnnotations = {
|
|
@@ -28,6 +28,7 @@ const toolFactories = {
|
|
|
28
28
|
generated: "getProject",
|
|
29
29
|
run: (neon, input, signal) => neon.projects.get(input.project_id, { signal })
|
|
30
30
|
}),
|
|
31
|
+
"projects.create": createProjectTool,
|
|
31
32
|
"projects.createAndConnect": createProjectAndConnectTool,
|
|
32
33
|
"projects.update": (options) => fromGenerated(options, {
|
|
33
34
|
id: "projects.update",
|
|
@@ -122,7 +123,8 @@ const toolFactories = {
|
|
|
122
123
|
generated: "getProjectBranch",
|
|
123
124
|
run: (neon, input, signal) => neon.branches.get(input.project_id, input.branch_id, { signal })
|
|
124
125
|
}),
|
|
125
|
-
"branches.
|
|
126
|
+
"branches.create": createBranchTool,
|
|
127
|
+
"branches.createAndConnect": createBranchAndConnectTool,
|
|
126
128
|
"branches.update": (options) => fromGenerated(options, {
|
|
127
129
|
id: "branches.update",
|
|
128
130
|
generated: "updateProjectBranch",
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { type ToolClientOptions } from "./bind.js";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const createBranchInputSchema: z.ZodObject<{
|
|
4
|
+
project_id: z.ZodString;
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
parent_id: z.ZodOptional<z.ZodString>;
|
|
7
|
+
compute: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
min_cu: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
max_cu: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
11
|
+
}, z.core.$strict>>;
|
|
12
|
+
no_compute: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export declare const createBranchAndConnectInputSchema: z.ZodObject<{
|
|
4
15
|
project_id: z.ZodString;
|
|
5
16
|
name: z.ZodOptional<z.ZodString>;
|
|
6
17
|
parent_id: z.ZodOptional<z.ZodString>;
|
|
@@ -11,6 +22,61 @@ export declare const createBranchWithComputeInputSchema: z.ZodObject<{
|
|
|
11
22
|
}, z.core.$strict>>;
|
|
12
23
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
13
24
|
}, z.core.$strict>;
|
|
25
|
+
export declare const createProjectInputSchema: z.ZodObject<{
|
|
26
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
quota: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
active_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
29
|
+
compute_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
30
|
+
written_data_bytes: z.ZodOptional<z.ZodInt>;
|
|
31
|
+
data_transfer_bytes: z.ZodOptional<z.ZodInt>;
|
|
32
|
+
logical_size_bytes: z.ZodOptional<z.ZodInt>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
allowed_ips: z.ZodOptional<z.ZodObject<{
|
|
35
|
+
ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
protected_branches_only: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
enable_logical_replication: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
maintenance_window: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
weekdays: z.ZodArray<z.ZodInt>;
|
|
41
|
+
start_time: z.ZodString;
|
|
42
|
+
end_time: z.ZodString;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
block_public_connections: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
block_vpc_connections: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
audit_log_level: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
base: "base";
|
|
48
|
+
extended: "extended";
|
|
49
|
+
full: "full";
|
|
50
|
+
}>>;
|
|
51
|
+
hipaa: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
preload_libraries: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
use_defaults: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
enabled_libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
name: z.ZodOptional<z.ZodString>;
|
|
58
|
+
branch: z.ZodOptional<z.ZodObject<{
|
|
59
|
+
name: z.ZodOptional<z.ZodString>;
|
|
60
|
+
role_name: z.ZodOptional<z.ZodString>;
|
|
61
|
+
database_name: z.ZodOptional<z.ZodString>;
|
|
62
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
provisioner: z.ZodOptional<z.ZodString>;
|
|
67
|
+
region_id: z.ZodOptional<z.ZodString>;
|
|
68
|
+
default_endpoint_settings: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
pg_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
70
|
+
pgbouncer_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
|
+
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
74
|
+
}, z.core.$strict>>;
|
|
75
|
+
pg_version: z.ZodOptional<z.ZodInt>;
|
|
76
|
+
store_passwords: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
history_retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
78
|
+
org_id: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strict>;
|
|
14
80
|
export declare const createProjectAndConnectInputSchema: z.ZodObject<{
|
|
15
81
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
16
82
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -115,7 +181,60 @@ export declare const setScheduleInputSchema: z.ZodObject<{
|
|
|
115
181
|
retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
116
182
|
}, z.core.$strict>>;
|
|
117
183
|
}, z.core.$strict>;
|
|
118
|
-
export declare const
|
|
184
|
+
export declare const createBranchTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
185
|
+
project_id: z.ZodString;
|
|
186
|
+
name: z.ZodOptional<z.ZodString>;
|
|
187
|
+
parent_id: z.ZodOptional<z.ZodString>;
|
|
188
|
+
compute: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
min_cu: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
max_cu: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
192
|
+
}, z.core.$strict>>;
|
|
193
|
+
no_compute: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
}, z.core.$strict>, "create_branches", {
|
|
195
|
+
id: string;
|
|
196
|
+
project_id: string;
|
|
197
|
+
parent_id?: string | null | undefined;
|
|
198
|
+
parent_lsn?: string | null | undefined;
|
|
199
|
+
parent_timestamp?: string | null | undefined;
|
|
200
|
+
name: string;
|
|
201
|
+
current_state: import("@neon/sdk").BranchState;
|
|
202
|
+
pending_state?: string | null | undefined;
|
|
203
|
+
state_changed_at: string;
|
|
204
|
+
logical_size?: number | null | undefined;
|
|
205
|
+
creation_source: string;
|
|
206
|
+
primary?: boolean | null | undefined;
|
|
207
|
+
default: boolean;
|
|
208
|
+
protected: boolean;
|
|
209
|
+
cpu_used_sec: number;
|
|
210
|
+
compute_time_seconds: number;
|
|
211
|
+
active_time_seconds: number;
|
|
212
|
+
written_data_bytes: number;
|
|
213
|
+
data_transfer_bytes: number;
|
|
214
|
+
created_at: string;
|
|
215
|
+
updated_at: string;
|
|
216
|
+
ttl_interval_seconds?: number | null | undefined;
|
|
217
|
+
expires_at?: string | null | undefined;
|
|
218
|
+
last_reset_at?: string | null | undefined;
|
|
219
|
+
created_by?: {
|
|
220
|
+
name?: string | null | undefined;
|
|
221
|
+
image?: string | null | undefined;
|
|
222
|
+
} | null | undefined;
|
|
223
|
+
init_source?: string | null | undefined;
|
|
224
|
+
restore_status?: string | null | undefined;
|
|
225
|
+
restored_from?: string | null | undefined;
|
|
226
|
+
restored_as?: string | null | undefined;
|
|
227
|
+
restricted_actions?: {
|
|
228
|
+
name: string;
|
|
229
|
+
reason: string;
|
|
230
|
+
}[] | null | undefined;
|
|
231
|
+
recovery?: {
|
|
232
|
+
deleted_at: string;
|
|
233
|
+
recoverable_until: string;
|
|
234
|
+
deletion_method: "user" | "ttl";
|
|
235
|
+
} | null | undefined;
|
|
236
|
+
}>;
|
|
237
|
+
export declare const createBranchAndConnectTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
119
238
|
project_id: z.ZodString;
|
|
120
239
|
name: z.ZodOptional<z.ZodString>;
|
|
121
240
|
parent_id: z.ZodOptional<z.ZodString>;
|
|
@@ -125,7 +244,7 @@ export declare const createBranchWithComputeTool: (options: ToolClientOptions) =
|
|
|
125
244
|
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
126
245
|
}, z.core.$strict>>;
|
|
127
246
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
-
}, z.core.$strict>, "
|
|
247
|
+
}, z.core.$strict>, "create_and_connect_branches", {
|
|
129
248
|
branch: {
|
|
130
249
|
id: string;
|
|
131
250
|
project_id: string;
|
|
@@ -210,6 +329,137 @@ export declare const createBranchWithComputeTool: (options: ToolClientOptions) =
|
|
|
210
329
|
};
|
|
211
330
|
connectionString: string;
|
|
212
331
|
}>;
|
|
332
|
+
export declare const createProjectTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
333
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
334
|
+
quota: z.ZodOptional<z.ZodObject<{
|
|
335
|
+
active_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
336
|
+
compute_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
337
|
+
written_data_bytes: z.ZodOptional<z.ZodInt>;
|
|
338
|
+
data_transfer_bytes: z.ZodOptional<z.ZodInt>;
|
|
339
|
+
logical_size_bytes: z.ZodOptional<z.ZodInt>;
|
|
340
|
+
}, z.core.$strict>>;
|
|
341
|
+
allowed_ips: z.ZodOptional<z.ZodObject<{
|
|
342
|
+
ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
343
|
+
protected_branches_only: z.ZodOptional<z.ZodBoolean>;
|
|
344
|
+
}, z.core.$strict>>;
|
|
345
|
+
enable_logical_replication: z.ZodOptional<z.ZodBoolean>;
|
|
346
|
+
maintenance_window: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
weekdays: z.ZodArray<z.ZodInt>;
|
|
348
|
+
start_time: z.ZodString;
|
|
349
|
+
end_time: z.ZodString;
|
|
350
|
+
}, z.core.$strict>>;
|
|
351
|
+
block_public_connections: z.ZodOptional<z.ZodBoolean>;
|
|
352
|
+
block_vpc_connections: z.ZodOptional<z.ZodBoolean>;
|
|
353
|
+
audit_log_level: z.ZodOptional<z.ZodEnum<{
|
|
354
|
+
base: "base";
|
|
355
|
+
extended: "extended";
|
|
356
|
+
full: "full";
|
|
357
|
+
}>>;
|
|
358
|
+
hipaa: z.ZodOptional<z.ZodBoolean>;
|
|
359
|
+
preload_libraries: z.ZodOptional<z.ZodObject<{
|
|
360
|
+
use_defaults: z.ZodOptional<z.ZodBoolean>;
|
|
361
|
+
enabled_libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
362
|
+
}, z.core.$strict>>;
|
|
363
|
+
}, z.core.$strict>>;
|
|
364
|
+
name: z.ZodOptional<z.ZodString>;
|
|
365
|
+
branch: z.ZodOptional<z.ZodObject<{
|
|
366
|
+
name: z.ZodOptional<z.ZodString>;
|
|
367
|
+
role_name: z.ZodOptional<z.ZodString>;
|
|
368
|
+
database_name: z.ZodOptional<z.ZodString>;
|
|
369
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
370
|
+
}, z.core.$strict>>;
|
|
371
|
+
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
372
|
+
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
373
|
+
provisioner: z.ZodOptional<z.ZodString>;
|
|
374
|
+
region_id: z.ZodOptional<z.ZodString>;
|
|
375
|
+
default_endpoint_settings: z.ZodOptional<z.ZodObject<{
|
|
376
|
+
pg_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
377
|
+
pgbouncer_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
378
|
+
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
379
|
+
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
380
|
+
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
381
|
+
}, z.core.$strict>>;
|
|
382
|
+
pg_version: z.ZodOptional<z.ZodInt>;
|
|
383
|
+
store_passwords: z.ZodOptional<z.ZodBoolean>;
|
|
384
|
+
history_retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
385
|
+
org_id: z.ZodOptional<z.ZodString>;
|
|
386
|
+
}, z.core.$strict>, "create_projects", {
|
|
387
|
+
data_storage_bytes_hour: number;
|
|
388
|
+
data_transfer_bytes: number;
|
|
389
|
+
written_data_bytes: number;
|
|
390
|
+
compute_time_seconds: number;
|
|
391
|
+
active_time_seconds: number;
|
|
392
|
+
cpu_used_sec: number;
|
|
393
|
+
id: string;
|
|
394
|
+
platform_id: string;
|
|
395
|
+
region_id: string;
|
|
396
|
+
name: string;
|
|
397
|
+
provisioner: import("@neon/sdk").Provisioner;
|
|
398
|
+
default_endpoint_settings?: {
|
|
399
|
+
pg_settings?: {
|
|
400
|
+
[x: string]: string;
|
|
401
|
+
} | null | undefined;
|
|
402
|
+
pgbouncer_settings?: {
|
|
403
|
+
[x: string]: string;
|
|
404
|
+
} | null | undefined;
|
|
405
|
+
autoscaling_limit_min_cu?: number | null | undefined;
|
|
406
|
+
autoscaling_limit_max_cu?: number | null | undefined;
|
|
407
|
+
suspend_timeout_seconds?: number | null | undefined;
|
|
408
|
+
} | null | undefined;
|
|
409
|
+
settings?: {
|
|
410
|
+
quota?: {
|
|
411
|
+
active_time_seconds?: number | null | undefined;
|
|
412
|
+
compute_time_seconds?: number | null | undefined;
|
|
413
|
+
written_data_bytes?: number | null | undefined;
|
|
414
|
+
data_transfer_bytes?: number | null | undefined;
|
|
415
|
+
logical_size_bytes?: number | null | undefined;
|
|
416
|
+
} | null | undefined;
|
|
417
|
+
allowed_ips?: {
|
|
418
|
+
ips?: string[] | null | undefined;
|
|
419
|
+
protected_branches_only?: boolean | null | undefined;
|
|
420
|
+
} | null | undefined;
|
|
421
|
+
enable_logical_replication?: boolean | null | undefined;
|
|
422
|
+
maintenance_window?: {
|
|
423
|
+
weekdays: number[];
|
|
424
|
+
start_time: string;
|
|
425
|
+
end_time: string;
|
|
426
|
+
} | null | undefined;
|
|
427
|
+
block_public_connections?: boolean | null | undefined;
|
|
428
|
+
block_vpc_connections?: boolean | null | undefined;
|
|
429
|
+
audit_log_level?: import("@neon/sdk").ProjectAuditLogLevel | null | undefined;
|
|
430
|
+
hipaa?: boolean | null | undefined;
|
|
431
|
+
preload_libraries?: {
|
|
432
|
+
use_defaults?: boolean | null | undefined;
|
|
433
|
+
enabled_libraries?: string[] | null | undefined;
|
|
434
|
+
} | null | undefined;
|
|
435
|
+
} | null | undefined;
|
|
436
|
+
pg_version: import("@neon/sdk").PgVersion;
|
|
437
|
+
proxy_host: string;
|
|
438
|
+
branch_logical_size_limit: number;
|
|
439
|
+
branch_logical_size_limit_bytes: number;
|
|
440
|
+
store_passwords: boolean;
|
|
441
|
+
maintenance_starts_at?: string | null | undefined;
|
|
442
|
+
creation_source: string;
|
|
443
|
+
history_retention_seconds: number;
|
|
444
|
+
created_at: string;
|
|
445
|
+
updated_at: string;
|
|
446
|
+
synthetic_storage_size?: number | null | undefined;
|
|
447
|
+
consumption_period_start: string;
|
|
448
|
+
consumption_period_end: string;
|
|
449
|
+
quota_reset_at?: string | null | undefined;
|
|
450
|
+
owner_id: string;
|
|
451
|
+
owner?: {
|
|
452
|
+
email: string;
|
|
453
|
+
name: string;
|
|
454
|
+
branches_limit: number;
|
|
455
|
+
subscription_type: import("@neon/sdk").BillingSubscriptionType;
|
|
456
|
+
} | null | undefined;
|
|
457
|
+
compute_last_active_at?: string | null | undefined;
|
|
458
|
+
org_id?: string | null | undefined;
|
|
459
|
+
maintenance_scheduled_for?: string | null | undefined;
|
|
460
|
+
hipaa_enabled_at?: string | null | undefined;
|
|
461
|
+
effective_project_permission?: (import("@neon/sdk").ProjectPermissionLevel | null) | undefined;
|
|
462
|
+
}>;
|
|
213
463
|
export declare const createProjectAndConnectTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
214
464
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
215
465
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composed.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/composed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"composed.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/composed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAmD1E,eAAO,MAAM,uBAAuB;;;;;;;;;;kBAqBjC,CAAC;AAEJ,eAAO,MAAM,iCAAiC;;;;;;;;;;kBAM5C,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAEnC,CAAC;AAEH,eAAO,MA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O,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B5D,CAAC;AAEH,eAAO,MAAM,iBAAiB,GAAI,SAAS,iBAAiB;;;;;;;;;;;EA0C1D,CAAC;AAEH,eAAO,MAAM,oBAAoB,GAAI,SAAS,iBAAiB;;;;;;;yDA0C7D,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B5D,CAAC;AAEH,eAAO,MAAM,eAAe,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;mDA2BxD,CAAC"}
|
|
@@ -14,17 +14,38 @@ const readAnnotations = {
|
|
|
14
14
|
const pooledField = z.boolean().describe("Return a pooled connection string. Default true. Set false for a direct connection.").optional();
|
|
15
15
|
const branchCreateFields = zBranchCreateRequest.shape.branch.unwrap().shape;
|
|
16
16
|
const projectCreateFields = zCreateProjectBody.shape.project.shape;
|
|
17
|
-
const
|
|
17
|
+
const computeSettingsSchema = z.strictObject({
|
|
18
|
+
min_cu: zComputeUnit.optional(),
|
|
19
|
+
max_cu: zComputeUnit.optional(),
|
|
20
|
+
suspend_timeout_seconds: zSuspendTimeoutSeconds.optional()
|
|
21
|
+
}).optional();
|
|
22
|
+
const mapCompute = (compute) => compute === void 0 ? void 0 : {
|
|
23
|
+
minCu: compute.min_cu,
|
|
24
|
+
maxCu: compute.max_cu,
|
|
25
|
+
suspendTimeoutSeconds: compute.suspend_timeout_seconds
|
|
26
|
+
};
|
|
27
|
+
const NO_COMPUTE_WITH_COMPUTE = "Pass compute settings or no_compute, not both.";
|
|
28
|
+
const createBranchInputSchema = z.strictObject({
|
|
18
29
|
project_id: zCreateProjectBranchPath.shape.project_id,
|
|
19
30
|
name: branchCreateFields.name,
|
|
20
31
|
parent_id: branchCreateFields.parent_id,
|
|
21
|
-
compute:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
compute: computeSettingsSchema,
|
|
33
|
+
no_compute: z.boolean().describe("Skip the read-write endpoint. Default false. Cannot be combined with compute.").optional()
|
|
34
|
+
}).superRefine((value, ctx) => {
|
|
35
|
+
if (value.no_compute === true && value.compute !== void 0) ctx.addIssue({
|
|
36
|
+
code: "custom",
|
|
37
|
+
message: NO_COMPUTE_WITH_COMPUTE,
|
|
38
|
+
path: ["no_compute"]
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
const createBranchAndConnectInputSchema = z.strictObject({
|
|
42
|
+
project_id: zCreateProjectBranchPath.shape.project_id,
|
|
43
|
+
name: branchCreateFields.name,
|
|
44
|
+
parent_id: branchCreateFields.parent_id,
|
|
45
|
+
compute: computeSettingsSchema,
|
|
26
46
|
pooled: pooledField
|
|
27
47
|
});
|
|
48
|
+
const createProjectInputSchema = z.strictObject({ ...projectCreateFields });
|
|
28
49
|
const createProjectAndConnectInputSchema = z.strictObject({
|
|
29
50
|
...projectCreateFields,
|
|
30
51
|
pooled: pooledField
|
|
@@ -74,12 +95,39 @@ const setScheduleInputSchema = z.strictObject({
|
|
|
74
95
|
frequency: snapshotFrequency
|
|
75
96
|
}))
|
|
76
97
|
});
|
|
77
|
-
const
|
|
78
|
-
operationId: "branches.
|
|
79
|
-
id: publishedId("branches.
|
|
80
|
-
title: "Create branch
|
|
98
|
+
const createBranchTool = (options) => bindTool(options, {
|
|
99
|
+
operationId: "branches.create",
|
|
100
|
+
id: publishedId("branches.create"),
|
|
101
|
+
title: "Create branch",
|
|
102
|
+
description: "Create a branch with a read-write endpoint by default. Pass no_compute to skip the endpoint. The call waits until operation-backed provisioning finishes, up to five minutes by default. Does not return a connection string; use branches.createAndConnect or postgres.connectionString for that.",
|
|
103
|
+
inputSchema: createBranchInputSchema,
|
|
104
|
+
annotations: writeAnnotations,
|
|
105
|
+
requiresApproval: true,
|
|
106
|
+
metadata: {
|
|
107
|
+
method: "POST",
|
|
108
|
+
path: "/projects/{project_id}/branches",
|
|
109
|
+
stability: "stable",
|
|
110
|
+
deprecated: false,
|
|
111
|
+
tags: ["Branch"]
|
|
112
|
+
}
|
|
113
|
+
}, (neon, input, signal) => {
|
|
114
|
+
if (input.no_compute === true) return neon.branches.create(input.project_id, {
|
|
115
|
+
name: input.name,
|
|
116
|
+
parent_id: input.parent_id,
|
|
117
|
+
noCompute: true
|
|
118
|
+
}, { signal });
|
|
119
|
+
return neon.branches.create(input.project_id, {
|
|
120
|
+
name: input.name,
|
|
121
|
+
parent_id: input.parent_id,
|
|
122
|
+
compute: mapCompute(input.compute)
|
|
123
|
+
}, { signal });
|
|
124
|
+
});
|
|
125
|
+
const createBranchAndConnectTool = (options) => bindTool(options, {
|
|
126
|
+
operationId: "branches.createAndConnect",
|
|
127
|
+
id: publishedId("branches.createAndConnect"),
|
|
128
|
+
title: "Create branch and connect",
|
|
81
129
|
description: "Create a branch with a read-write endpoint and return its connection string. The call waits until operation-backed provisioning finishes, up to five minutes by default.",
|
|
82
|
-
inputSchema:
|
|
130
|
+
inputSchema: createBranchAndConnectInputSchema,
|
|
83
131
|
annotations: writeAnnotations,
|
|
84
132
|
requiresApproval: true,
|
|
85
133
|
metadata: {
|
|
@@ -89,18 +137,30 @@ const createBranchWithComputeTool = (options) => bindTool(options, {
|
|
|
89
137
|
deprecated: false,
|
|
90
138
|
tags: ["Branch"]
|
|
91
139
|
}
|
|
92
|
-
}, (neon, input, signal) => neon.branches.
|
|
140
|
+
}, (neon, input, signal) => neon.branches.createAndConnect(input.project_id, {
|
|
93
141
|
name: input.name,
|
|
94
142
|
parentId: input.parent_id,
|
|
95
|
-
compute: input.compute
|
|
96
|
-
minCu: input.compute.min_cu,
|
|
97
|
-
maxCu: input.compute.max_cu,
|
|
98
|
-
suspendTimeoutSeconds: input.compute.suspend_timeout_seconds
|
|
99
|
-
}
|
|
143
|
+
compute: mapCompute(input.compute)
|
|
100
144
|
}, {
|
|
101
145
|
signal,
|
|
102
146
|
...input.pooled === void 0 ? {} : { pooled: input.pooled }
|
|
103
147
|
}));
|
|
148
|
+
const createProjectTool = (options) => bindTool(options, {
|
|
149
|
+
operationId: "projects.create",
|
|
150
|
+
id: publishedId("projects.create"),
|
|
151
|
+
title: "Create project",
|
|
152
|
+
description: "Create a project. The API always provisions a default branch with read-write compute. The call waits until operation-backed provisioning finishes, up to five minutes by default. Does not return a connection string; use projects.createAndConnect or postgres.connectionString for that.",
|
|
153
|
+
inputSchema: createProjectInputSchema,
|
|
154
|
+
annotations: writeAnnotations,
|
|
155
|
+
requiresApproval: true,
|
|
156
|
+
metadata: {
|
|
157
|
+
method: "POST",
|
|
158
|
+
path: "/projects",
|
|
159
|
+
stability: "stable",
|
|
160
|
+
deprecated: false,
|
|
161
|
+
tags: ["Project"]
|
|
162
|
+
}
|
|
163
|
+
}, (neon, input, signal) => neon.projects.create(input, { signal }));
|
|
104
164
|
const createProjectAndConnectTool = (options) => bindTool(options, {
|
|
105
165
|
operationId: "projects.createAndConnect",
|
|
106
166
|
id: publishedId("projects.createAndConnect"),
|
|
@@ -238,4 +298,4 @@ const setScheduleTool = (options) => bindTool(options, {
|
|
|
238
298
|
}
|
|
239
299
|
}, (neon, input, signal) => neon.snapshots.setSchedule(input.project_id, input.branch_id, { schedule: input.schedule }, { signal }));
|
|
240
300
|
//#endregion
|
|
241
|
-
export { compareSchemaInputSchema, compareSchemaTool, connectionStringInputSchema, connectionStringTool,
|
|
301
|
+
export { compareSchemaInputSchema, compareSchemaTool, connectionStringInputSchema, connectionStringTool, createBranchAndConnectInputSchema, createBranchAndConnectTool, createBranchInputSchema, createBranchTool, createProjectAndConnectInputSchema, createProjectAndConnectTool, createProjectInputSchema, createProjectTool, getDefaultInputSchema, getDefaultTool, resetFromParentInputSchema, resetFromParentTool, restoreSnapshotInputSchema, restoreSnapshotTool, setScheduleInputSchema, setScheduleTool };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const hiddenToolIds: readonly ["operations.waitFor", "
|
|
1
|
+
export declare const hiddenToolIds: readonly ["operations.waitFor", "postgres.roles.password", "storage.objects.get"];
|
|
2
2
|
export type HiddenToolId = (typeof hiddenToolIds)[number];
|
|
3
|
-
export declare const toolIds: readonly ["projects.list", "projects.get", "projects.createAndConnect", "projects.update", "projects.delete", "projects.recover", "projects.transfer", "projects.transferFromUser", "projects.permissions.list", "projects.permissions.grant", "projects.permissions.revoke", "projects.members.list", "projects.members.setRole", "projects.members.removeRole", "branches.list", "branches.get", "branches.
|
|
3
|
+
export declare const toolIds: readonly ["projects.list", "projects.get", "projects.create", "projects.createAndConnect", "projects.update", "projects.delete", "projects.recover", "projects.transfer", "projects.transferFromUser", "projects.permissions.list", "projects.permissions.grant", "projects.permissions.revoke", "projects.members.list", "projects.members.setRole", "projects.members.removeRole", "branches.list", "branches.get", "branches.create", "branches.createAndConnect", "branches.update", "branches.delete", "branches.getDefault", "branches.setDefault", "branches.resetFromParent", "branches.compareSchema", "branches.finalizeRestore", "postgres.connectionString", "postgres.endpoints.list", "postgres.endpoints.listByBranch", "postgres.endpoints.get", "postgres.endpoints.create", "postgres.endpoints.update", "postgres.endpoints.delete", "postgres.endpoints.start", "postgres.endpoints.suspend", "postgres.endpoints.restart", "postgres.roles.list", "postgres.roles.get", "postgres.roles.create", "postgres.roles.delete", "postgres.roles.resetPassword", "postgres.databases.list", "postgres.databases.get", "postgres.databases.create", "postgres.databases.update", "postgres.databases.delete", "postgres.dataApi.get", "postgres.dataApi.create", "postgres.dataApi.update", "postgres.dataApi.delete", "storage.get", "storage.buckets.list", "storage.buckets.create", "storage.buckets.delete", "storage.objects.list", "storage.objects.delete", "storage.objects.deleteByPrefix", "storage.objects.presign", "functions.list", "functions.get", "functions.update", "functions.delete", "functions.deploy", "credentials.list", "credentials.create", "credentials.revoke", "aiGateway.get", "logs.query", "logs.fields", "logs.fieldValues", "snapshots.list", "snapshots.create", "snapshots.update", "snapshots.delete", "snapshots.restore", "snapshots.getSchedule", "snapshots.setSchedule", "operations.list", "operations.get", "auth.get", "auth.create", "auth.disable", "auth.updateConfig", "auth.oauthProviders.list", "auth.oauthProviders.add", "auth.oauthProviders.update", "auth.oauthProviders.delete", "auth.trustedDomains.list", "auth.trustedDomains.add", "auth.trustedDomains.delete", "auth.users.create", "auth.users.delete", "auth.users.updateRole", "consumption.perProject", "consumption.perProjectV2", "consumption.perBranchV2", "apiKeys.list", "apiKeys.create", "apiKeys.revoke", "regions.list", "user.me", "user.organizations"];
|
|
4
4
|
export type NeonToolId = (typeof toolIds)[number];
|
|
5
5
|
export declare const isNeonToolId: (id: string) => id is NeonToolId;
|
|
6
6
|
export declare const unpublishedToolError: (id: string) => TypeError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/ids.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/ids.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,mFAIhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,OAAO,22EAuGV,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,KAAG,EAAE,IAAI,UACJ,CAAC;AAS7C,eAAO,MAAM,oBAAoB,GAAI,IAAI,MAAM,KAAG,SAOjD,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
//#region src/lib/ergonomic/ids.ts
|
|
2
2
|
const hiddenToolIds = [
|
|
3
3
|
"operations.waitFor",
|
|
4
|
-
"branches.create",
|
|
5
|
-
"projects.create",
|
|
6
4
|
"postgres.roles.password",
|
|
7
5
|
"storage.objects.get"
|
|
8
6
|
];
|
|
9
7
|
const toolIds = [
|
|
10
8
|
"projects.list",
|
|
11
9
|
"projects.get",
|
|
10
|
+
"projects.create",
|
|
12
11
|
"projects.createAndConnect",
|
|
13
12
|
"projects.update",
|
|
14
13
|
"projects.delete",
|
|
@@ -23,7 +22,8 @@ const toolIds = [
|
|
|
23
22
|
"projects.members.removeRole",
|
|
24
23
|
"branches.list",
|
|
25
24
|
"branches.get",
|
|
26
|
-
"branches.
|
|
25
|
+
"branches.create",
|
|
26
|
+
"branches.createAndConnect",
|
|
27
27
|
"branches.update",
|
|
28
28
|
"branches.delete",
|
|
29
29
|
"branches.getDefault",
|
|
@@ -110,8 +110,6 @@ const toolIds = [
|
|
|
110
110
|
];
|
|
111
111
|
const isNeonToolId = (id) => toolIds.includes(id);
|
|
112
112
|
const hiddenToolHint = {
|
|
113
|
-
"projects.create": "Use \"projects.createAndConnect\", which attaches compute and returns a connection string.",
|
|
114
|
-
"branches.create": "Use \"branches.createWithCompute\", which attaches compute and returns a connection string.",
|
|
115
113
|
"operations.waitFor": "Write tools wait for readiness. operations.waitFor is not a tool.",
|
|
116
114
|
"postgres.roles.password": "Role passwords are not published as a tool.",
|
|
117
115
|
"storage.objects.get": "Object bytes are not published as a tool."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neon/tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Agent tools for the Neon SDK ergonomic client, compatible with MCP, Eve, and Mastra.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"zod": "^4.4.3",
|
|
72
|
-
"@neon/sdk": "
|
|
72
|
+
"@neon/sdk": "3.0.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@hey-api/openapi-ts": "0.98.2",
|