@neon/tools 0.7.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 +19 -7
- package/dist/lib/ergonomic/catalog.d.ts +245 -2
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
- package/dist/lib/ergonomic/catalog.js +6 -2
- package/dist/lib/ergonomic/composed.d.ts +327 -3
- package/dist/lib/ergonomic/composed.d.ts.map +1 -1
- package/dist/lib/ergonomic/composed.js +134 -19
- 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 +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,7 +24,9 @@ const tools = createNeonTools({
|
|
|
24
24
|
tools: [
|
|
25
25
|
"projects.list",
|
|
26
26
|
"projects.createAndConnect",
|
|
27
|
-
"branches.
|
|
27
|
+
"branches.createAndConnect",
|
|
28
|
+
"branches.resetFromParent",
|
|
29
|
+
"branches.compareSchema",
|
|
28
30
|
],
|
|
29
31
|
});
|
|
30
32
|
|
|
@@ -33,6 +35,16 @@ const created = await tools["projects.createAndConnect"].execute({
|
|
|
33
35
|
name: "agent-project",
|
|
34
36
|
region_id: "aws-us-east-1",
|
|
35
37
|
});
|
|
38
|
+
await tools["branches.resetFromParent"].execute({
|
|
39
|
+
project_id: "project-id",
|
|
40
|
+
branch_id: "br-feature",
|
|
41
|
+
preserve_under_name: "feature-before-reset",
|
|
42
|
+
});
|
|
43
|
+
const compared = await tools["branches.compareSchema"].execute({
|
|
44
|
+
project_id: "project-id",
|
|
45
|
+
branch_id: "br-feature",
|
|
46
|
+
database_name: "neondb",
|
|
47
|
+
});
|
|
36
48
|
```
|
|
37
49
|
|
|
38
50
|
`limit` on a list tool caps how many items come back.
|
|
@@ -58,7 +70,7 @@ Each tool includes its Zod 4 `inputSchema`, published `id`, title, description,
|
|
|
58
70
|
Paginated lists call `.all()` and return the item array. Do not pass a cursor; those fields are omitted from the input schema.
|
|
59
71
|
|
|
60
72
|
```ts
|
|
61
|
-
const createBranch = createNeonTool("branches.
|
|
73
|
+
const createBranch = createNeonTool("branches.createAndConnect", { apiKey });
|
|
62
74
|
```
|
|
63
75
|
|
|
64
76
|
## Writes and waiting
|
|
@@ -71,7 +83,7 @@ An abort `signal` on `execute` or a wait timeout stops the poll, not the create:
|
|
|
71
83
|
|
|
72
84
|
`metadata.method` and `metadata.path` name the first request; extra readiness GETs are not listed there.
|
|
73
85
|
|
|
74
|
-
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.
|
|
75
87
|
|
|
76
88
|
## Optional host add-ons
|
|
77
89
|
|
|
@@ -115,17 +127,17 @@ This package does not send analytics. Mutating `event.input` does not change a g
|
|
|
115
127
|
```ts
|
|
116
128
|
const tools = createNeonTools({
|
|
117
129
|
apiKey,
|
|
118
|
-
tools: ["branches.
|
|
119
|
-
names: { "branches.
|
|
130
|
+
tools: ["branches.createAndConnect", "projects.list"] as const,
|
|
131
|
+
names: { "branches.createAndConnect": "create_branch" },
|
|
120
132
|
name: (id) => `neon_${id}`,
|
|
121
133
|
});
|
|
122
134
|
```
|
|
123
135
|
|
|
124
|
-
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.
|
|
125
137
|
|
|
126
138
|
### Project and branch injection
|
|
127
139
|
|
|
128
|
-
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:
|
|
129
141
|
|
|
130
142
|
```ts
|
|
131
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;
|
|
@@ -1050,6 +1234,65 @@ export declare const toolFactories: {
|
|
|
1050
1234
|
deletion_method: "user" | "ttl";
|
|
1051
1235
|
} | null | undefined;
|
|
1052
1236
|
}>;
|
|
1237
|
+
"branches.resetFromParent": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
1238
|
+
project_id: z.ZodString;
|
|
1239
|
+
branch_id: z.ZodString;
|
|
1240
|
+
preserve_under_name: z.ZodOptional<z.ZodString>;
|
|
1241
|
+
}, z.core.$strict>, "reset_from_parent_branches", {
|
|
1242
|
+
id: string;
|
|
1243
|
+
project_id: string;
|
|
1244
|
+
parent_id?: string | null | undefined;
|
|
1245
|
+
parent_lsn?: string | null | undefined;
|
|
1246
|
+
parent_timestamp?: string | null | undefined;
|
|
1247
|
+
name: string;
|
|
1248
|
+
current_state: import("@neon/sdk").BranchState;
|
|
1249
|
+
pending_state?: string | null | undefined;
|
|
1250
|
+
state_changed_at: string;
|
|
1251
|
+
logical_size?: number | null | undefined;
|
|
1252
|
+
creation_source: string;
|
|
1253
|
+
primary?: boolean | null | undefined;
|
|
1254
|
+
default: boolean;
|
|
1255
|
+
protected: boolean;
|
|
1256
|
+
cpu_used_sec: number;
|
|
1257
|
+
compute_time_seconds: number;
|
|
1258
|
+
active_time_seconds: number;
|
|
1259
|
+
written_data_bytes: number;
|
|
1260
|
+
data_transfer_bytes: number;
|
|
1261
|
+
created_at: string;
|
|
1262
|
+
updated_at: string;
|
|
1263
|
+
ttl_interval_seconds?: number | null | undefined;
|
|
1264
|
+
expires_at?: string | null | undefined;
|
|
1265
|
+
last_reset_at?: string | null | undefined;
|
|
1266
|
+
created_by?: {
|
|
1267
|
+
name?: string | null | undefined;
|
|
1268
|
+
image?: string | null | undefined;
|
|
1269
|
+
} | null | undefined;
|
|
1270
|
+
init_source?: string | null | undefined;
|
|
1271
|
+
restore_status?: string | null | undefined;
|
|
1272
|
+
restored_from?: string | null | undefined;
|
|
1273
|
+
restored_as?: string | null | undefined;
|
|
1274
|
+
restricted_actions?: {
|
|
1275
|
+
name: string;
|
|
1276
|
+
reason: string;
|
|
1277
|
+
}[] | null | undefined;
|
|
1278
|
+
recovery?: {
|
|
1279
|
+
deleted_at: string;
|
|
1280
|
+
recoverable_until: string;
|
|
1281
|
+
deletion_method: "user" | "ttl";
|
|
1282
|
+
} | null | undefined;
|
|
1283
|
+
}>;
|
|
1284
|
+
"branches.compareSchema": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
1285
|
+
project_id: z.ZodString;
|
|
1286
|
+
branch_id: z.ZodString;
|
|
1287
|
+
database_name: z.ZodString;
|
|
1288
|
+
base_branch_id: z.ZodOptional<z.ZodString>;
|
|
1289
|
+
lsn: z.ZodOptional<z.ZodString>;
|
|
1290
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1291
|
+
base_lsn: z.ZodOptional<z.ZodString>;
|
|
1292
|
+
base_timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1293
|
+
}, z.core.$strict>, "compare_schema_branches", {
|
|
1294
|
+
diff?: string | null | undefined;
|
|
1295
|
+
}>;
|
|
1053
1296
|
"branches.finalizeRestore": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
1054
1297
|
project_id: z.ZodString;
|
|
1055
1298
|
branch_id: z.ZodString;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 { 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",
|
|
@@ -144,6 +146,8 @@ const toolFactories = {
|
|
|
144
146
|
generated: "setDefaultProjectBranch",
|
|
145
147
|
run: (neon, input, signal) => neon.branches.setDefault(input.project_id, input.branch_id, { signal })
|
|
146
148
|
}),
|
|
149
|
+
"branches.resetFromParent": resetFromParentTool,
|
|
150
|
+
"branches.compareSchema": compareSchemaTool,
|
|
147
151
|
"branches.finalizeRestore": (options) => fromGenerated(options, {
|
|
148
152
|
id: "branches.finalizeRestore",
|
|
149
153
|
generated: "finalizeRestoreBranch",
|
|
@@ -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<{
|
|
@@ -70,6 +136,21 @@ export declare const createProjectAndConnectInputSchema: z.ZodObject<{
|
|
|
70
136
|
export declare const getDefaultInputSchema: z.ZodObject<{
|
|
71
137
|
project_id: z.ZodString;
|
|
72
138
|
}, z.core.$strict>;
|
|
139
|
+
export declare const resetFromParentInputSchema: z.ZodObject<{
|
|
140
|
+
project_id: z.ZodString;
|
|
141
|
+
branch_id: z.ZodString;
|
|
142
|
+
preserve_under_name: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, z.core.$strict>;
|
|
144
|
+
export declare const compareSchemaInputSchema: z.ZodObject<{
|
|
145
|
+
project_id: z.ZodString;
|
|
146
|
+
branch_id: z.ZodString;
|
|
147
|
+
database_name: z.ZodString;
|
|
148
|
+
base_branch_id: z.ZodOptional<z.ZodString>;
|
|
149
|
+
lsn: z.ZodOptional<z.ZodString>;
|
|
150
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
151
|
+
base_lsn: z.ZodOptional<z.ZodString>;
|
|
152
|
+
base_timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
153
|
+
}, z.core.$strict>;
|
|
73
154
|
export declare const connectionStringInputSchema: z.ZodObject<{
|
|
74
155
|
project_id: z.ZodString;
|
|
75
156
|
branch_id: z.ZodOptional<z.ZodString>;
|
|
@@ -100,7 +181,60 @@ export declare const setScheduleInputSchema: z.ZodObject<{
|
|
|
100
181
|
retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
101
182
|
}, z.core.$strict>>;
|
|
102
183
|
}, z.core.$strict>;
|
|
103
|
-
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<{
|
|
104
238
|
project_id: z.ZodString;
|
|
105
239
|
name: z.ZodOptional<z.ZodString>;
|
|
106
240
|
parent_id: z.ZodOptional<z.ZodString>;
|
|
@@ -110,7 +244,7 @@ export declare const createBranchWithComputeTool: (options: ToolClientOptions) =
|
|
|
110
244
|
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
111
245
|
}, z.core.$strict>>;
|
|
112
246
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
-
}, z.core.$strict>, "
|
|
247
|
+
}, z.core.$strict>, "create_and_connect_branches", {
|
|
114
248
|
branch: {
|
|
115
249
|
id: string;
|
|
116
250
|
project_id: string;
|
|
@@ -195,6 +329,137 @@ export declare const createBranchWithComputeTool: (options: ToolClientOptions) =
|
|
|
195
329
|
};
|
|
196
330
|
connectionString: string;
|
|
197
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
|
+
}>;
|
|
198
463
|
export declare const createProjectAndConnectTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
199
464
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
200
465
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -375,6 +640,65 @@ export declare const getDefaultTool: (options: ToolClientOptions) => import("../
|
|
|
375
640
|
deletion_method: "user" | "ttl";
|
|
376
641
|
} | null | undefined;
|
|
377
642
|
}>;
|
|
643
|
+
export declare const resetFromParentTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
644
|
+
project_id: z.ZodString;
|
|
645
|
+
branch_id: z.ZodString;
|
|
646
|
+
preserve_under_name: z.ZodOptional<z.ZodString>;
|
|
647
|
+
}, z.core.$strict>, "reset_from_parent_branches", {
|
|
648
|
+
id: string;
|
|
649
|
+
project_id: string;
|
|
650
|
+
parent_id?: string | null | undefined;
|
|
651
|
+
parent_lsn?: string | null | undefined;
|
|
652
|
+
parent_timestamp?: string | null | undefined;
|
|
653
|
+
name: string;
|
|
654
|
+
current_state: import("@neon/sdk").BranchState;
|
|
655
|
+
pending_state?: string | null | undefined;
|
|
656
|
+
state_changed_at: string;
|
|
657
|
+
logical_size?: number | null | undefined;
|
|
658
|
+
creation_source: string;
|
|
659
|
+
primary?: boolean | null | undefined;
|
|
660
|
+
default: boolean;
|
|
661
|
+
protected: boolean;
|
|
662
|
+
cpu_used_sec: number;
|
|
663
|
+
compute_time_seconds: number;
|
|
664
|
+
active_time_seconds: number;
|
|
665
|
+
written_data_bytes: number;
|
|
666
|
+
data_transfer_bytes: number;
|
|
667
|
+
created_at: string;
|
|
668
|
+
updated_at: string;
|
|
669
|
+
ttl_interval_seconds?: number | null | undefined;
|
|
670
|
+
expires_at?: string | null | undefined;
|
|
671
|
+
last_reset_at?: string | null | undefined;
|
|
672
|
+
created_by?: {
|
|
673
|
+
name?: string | null | undefined;
|
|
674
|
+
image?: string | null | undefined;
|
|
675
|
+
} | null | undefined;
|
|
676
|
+
init_source?: string | null | undefined;
|
|
677
|
+
restore_status?: string | null | undefined;
|
|
678
|
+
restored_from?: string | null | undefined;
|
|
679
|
+
restored_as?: string | null | undefined;
|
|
680
|
+
restricted_actions?: {
|
|
681
|
+
name: string;
|
|
682
|
+
reason: string;
|
|
683
|
+
}[] | null | undefined;
|
|
684
|
+
recovery?: {
|
|
685
|
+
deleted_at: string;
|
|
686
|
+
recoverable_until: string;
|
|
687
|
+
deletion_method: "user" | "ttl";
|
|
688
|
+
} | null | undefined;
|
|
689
|
+
}>;
|
|
690
|
+
export declare const compareSchemaTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
691
|
+
project_id: z.ZodString;
|
|
692
|
+
branch_id: z.ZodString;
|
|
693
|
+
database_name: z.ZodString;
|
|
694
|
+
base_branch_id: z.ZodOptional<z.ZodString>;
|
|
695
|
+
lsn: z.ZodOptional<z.ZodString>;
|
|
696
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
697
|
+
base_lsn: z.ZodOptional<z.ZodString>;
|
|
698
|
+
base_timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
699
|
+
}, z.core.$strict>, "compare_schema_branches", {
|
|
700
|
+
diff?: string | null | undefined;
|
|
701
|
+
}>;
|
|
378
702
|
export declare const connectionStringTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
379
703
|
project_id: z.ZodString;
|
|
380
704
|
branch_id: z.ZodOptional<z.ZodString>;
|
|
@@ -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,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAG7C,CAAC;AAEH,eAAO,MAAM,qBAAqB;;kBAEhC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;kBAOrC,CAAC;AAIH,eAAO,MAAM,wBAAwB;;;;;;;;;kBASnC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;kBAOtC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;kBAWrC,CAAC;AAIH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;kBASjC,CAAC;AAEH,eAAO,MAAM,gBAAgB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CzD,CAAC;AAEH,eAAO,MAAM,0BAA0B,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCnE,CAAC;AAEH,eAAO,MAAM,iBAAiB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqB1D,CAAC;AAEH,eAAO,MAAM,2BAA2B,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BpE,CAAC;AAEH,eAAO,MAAM,cAAc,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBvD,CAAC;AAEH,eAAO,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { zBackupScheduleItem, zBranchCreateRequest, zComputeUnit, zCreateProjectBody, zCreateProjectBranchPath, zGetConnectionUriPath, zGetConnectionUriQuery, zListProjectBranchesPath, zRestoreSnapshotBody, zRestoreSnapshotPath, zSetSnapshotSchedulePath, zSuspendTimeoutSeconds } from "../../generated/zod.gen.js";
|
|
1
|
+
import { zBackupScheduleItem, zBranchCreateRequest, zBranchRestoreRequest, zComputeUnit, zCreateProjectBody, zCreateProjectBranchPath, zGetConnectionUriPath, zGetConnectionUriQuery, zGetProjectBranchSchemaComparisonPath, zGetProjectBranchSchemaComparisonQuery, zListProjectBranchesPath, zRestoreProjectBranchPath, zRestoreSnapshotBody, zRestoreSnapshotPath, zSetSnapshotSchedulePath, zSuspendTimeoutSeconds } from "../../generated/zod.gen.js";
|
|
2
2
|
import { bindTool, publishedId } from "./bind.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
//#region src/lib/ergonomic/composed.ts
|
|
@@ -14,22 +14,59 @@ 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({
|
|
29
|
+
project_id: zCreateProjectBranchPath.shape.project_id,
|
|
30
|
+
name: branchCreateFields.name,
|
|
31
|
+
parent_id: branchCreateFields.parent_id,
|
|
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({
|
|
18
42
|
project_id: zCreateProjectBranchPath.shape.project_id,
|
|
19
43
|
name: branchCreateFields.name,
|
|
20
44
|
parent_id: branchCreateFields.parent_id,
|
|
21
|
-
compute:
|
|
22
|
-
min_cu: zComputeUnit.optional(),
|
|
23
|
-
max_cu: zComputeUnit.optional(),
|
|
24
|
-
suspend_timeout_seconds: zSuspendTimeoutSeconds.optional()
|
|
25
|
-
}).optional(),
|
|
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
|
|
31
52
|
});
|
|
32
53
|
const getDefaultInputSchema = z.strictObject({ project_id: zListProjectBranchesPath.shape.project_id });
|
|
54
|
+
const resetFromParentInputSchema = z.strictObject({
|
|
55
|
+
project_id: zRestoreProjectBranchPath.shape.project_id,
|
|
56
|
+
branch_id: zRestoreProjectBranchPath.shape.branch_id,
|
|
57
|
+
preserve_under_name: zBranchRestoreRequest.shape.preserve_under_name.describe("Name under which to save the current branch before the reset. Required when the branch has children; those children move to the new branch.")
|
|
58
|
+
});
|
|
59
|
+
const compareQuery = zGetProjectBranchSchemaComparisonQuery.shape;
|
|
60
|
+
const compareSchemaInputSchema = z.strictObject({
|
|
61
|
+
project_id: zGetProjectBranchSchemaComparisonPath.shape.project_id,
|
|
62
|
+
branch_id: zGetProjectBranchSchemaComparisonPath.shape.branch_id,
|
|
63
|
+
database_name: compareQuery.db_name,
|
|
64
|
+
base_branch_id: compareQuery.base_branch_id,
|
|
65
|
+
lsn: compareQuery.lsn,
|
|
66
|
+
timestamp: compareQuery.timestamp,
|
|
67
|
+
base_lsn: compareQuery.base_lsn,
|
|
68
|
+
base_timestamp: compareQuery.base_timestamp
|
|
69
|
+
});
|
|
33
70
|
const connectionStringInputSchema = z.strictObject({
|
|
34
71
|
project_id: zGetConnectionUriPath.shape.project_id,
|
|
35
72
|
branch_id: zGetConnectionUriQuery.shape.branch_id,
|
|
@@ -58,12 +95,39 @@ const setScheduleInputSchema = z.strictObject({
|
|
|
58
95
|
frequency: snapshotFrequency
|
|
59
96
|
}))
|
|
60
97
|
});
|
|
61
|
-
const
|
|
62
|
-
operationId: "branches.
|
|
63
|
-
id: publishedId("branches.
|
|
64
|
-
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",
|
|
65
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.",
|
|
66
|
-
inputSchema:
|
|
130
|
+
inputSchema: createBranchAndConnectInputSchema,
|
|
67
131
|
annotations: writeAnnotations,
|
|
68
132
|
requiresApproval: true,
|
|
69
133
|
metadata: {
|
|
@@ -73,18 +137,30 @@ const createBranchWithComputeTool = (options) => bindTool(options, {
|
|
|
73
137
|
deprecated: false,
|
|
74
138
|
tags: ["Branch"]
|
|
75
139
|
}
|
|
76
|
-
}, (neon, input, signal) => neon.branches.
|
|
140
|
+
}, (neon, input, signal) => neon.branches.createAndConnect(input.project_id, {
|
|
77
141
|
name: input.name,
|
|
78
142
|
parentId: input.parent_id,
|
|
79
|
-
compute: input.compute
|
|
80
|
-
minCu: input.compute.min_cu,
|
|
81
|
-
maxCu: input.compute.max_cu,
|
|
82
|
-
suspendTimeoutSeconds: input.compute.suspend_timeout_seconds
|
|
83
|
-
}
|
|
143
|
+
compute: mapCompute(input.compute)
|
|
84
144
|
}, {
|
|
85
145
|
signal,
|
|
86
146
|
...input.pooled === void 0 ? {} : { pooled: input.pooled }
|
|
87
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 }));
|
|
88
164
|
const createProjectAndConnectTool = (options) => bindTool(options, {
|
|
89
165
|
operationId: "projects.createAndConnect",
|
|
90
166
|
id: publishedId("projects.createAndConnect"),
|
|
@@ -123,6 +199,45 @@ const getDefaultTool = (options) => bindTool(options, {
|
|
|
123
199
|
tags: ["Branch"]
|
|
124
200
|
}
|
|
125
201
|
}, (neon, input, signal) => neon.branches.getDefault(input.project_id, { signal }));
|
|
202
|
+
const resetFromParentTool = (options) => bindTool(options, {
|
|
203
|
+
operationId: "branches.resetFromParent",
|
|
204
|
+
id: publishedId("branches.resetFromParent"),
|
|
205
|
+
title: "Reset branch from parent",
|
|
206
|
+
description: "Reset a branch to its parent's current HEAD. Discards every change the branch has written since it diverged. preserve_under_name is required when the branch has children. For an LSN or timestamp restore, use the raw restoreProjectBranch operation.",
|
|
207
|
+
inputSchema: resetFromParentInputSchema,
|
|
208
|
+
annotations: writeAnnotations,
|
|
209
|
+
requiresApproval: true,
|
|
210
|
+
metadata: {
|
|
211
|
+
method: "POST",
|
|
212
|
+
path: "/projects/{project_id}/branches/{branch_id}/restore",
|
|
213
|
+
stability: "stable",
|
|
214
|
+
deprecated: false,
|
|
215
|
+
tags: ["Branch"]
|
|
216
|
+
}
|
|
217
|
+
}, (neon, input, signal) => neon.branches.resetFromParent(input.project_id, input.branch_id, input.preserve_under_name === void 0 ? void 0 : { preserveUnderName: input.preserve_under_name }, { signal }));
|
|
218
|
+
const compareSchemaTool = (options) => bindTool(options, {
|
|
219
|
+
operationId: "branches.compareSchema",
|
|
220
|
+
id: publishedId("branches.compareSchema"),
|
|
221
|
+
title: "Compare database schema",
|
|
222
|
+
description: "Compare a branch database schema to another branch. Omitting base_branch_id compares against the parent. Returns a unified SQL diff.",
|
|
223
|
+
inputSchema: compareSchemaInputSchema,
|
|
224
|
+
annotations: readAnnotations,
|
|
225
|
+
requiresApproval: false,
|
|
226
|
+
metadata: {
|
|
227
|
+
method: "GET",
|
|
228
|
+
path: "/projects/{project_id}/branches/{branch_id}/compare_schema",
|
|
229
|
+
stability: "stable",
|
|
230
|
+
deprecated: false,
|
|
231
|
+
tags: ["Branch"]
|
|
232
|
+
}
|
|
233
|
+
}, (neon, input, signal) => neon.branches.compareSchema(input.project_id, input.branch_id, {
|
|
234
|
+
databaseName: input.database_name,
|
|
235
|
+
...input.base_branch_id === void 0 ? {} : { baseBranchId: input.base_branch_id },
|
|
236
|
+
...input.lsn === void 0 ? {} : { lsn: input.lsn },
|
|
237
|
+
...input.timestamp === void 0 ? {} : { timestamp: input.timestamp },
|
|
238
|
+
...input.base_lsn === void 0 ? {} : { baseLsn: input.base_lsn },
|
|
239
|
+
...input.base_timestamp === void 0 ? {} : { baseTimestamp: input.base_timestamp }
|
|
240
|
+
}, { signal }));
|
|
126
241
|
const connectionStringTool = (options) => bindTool(options, {
|
|
127
242
|
operationId: "postgres.connectionString",
|
|
128
243
|
id: publishedId("postgres.connectionString"),
|
|
@@ -183,4 +298,4 @@ const setScheduleTool = (options) => bindTool(options, {
|
|
|
183
298
|
}
|
|
184
299
|
}, (neon, input, signal) => neon.snapshots.setSchedule(input.project_id, input.branch_id, { schedule: input.schedule }, { signal }));
|
|
185
300
|
//#endregion
|
|
186
|
-
export { 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,11 +22,14 @@ 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",
|
|
30
30
|
"branches.setDefault",
|
|
31
|
+
"branches.resetFromParent",
|
|
32
|
+
"branches.compareSchema",
|
|
31
33
|
"branches.finalizeRestore",
|
|
32
34
|
"postgres.connectionString",
|
|
33
35
|
"postgres.endpoints.list",
|
|
@@ -108,8 +110,6 @@ const toolIds = [
|
|
|
108
110
|
];
|
|
109
111
|
const isNeonToolId = (id) => toolIds.includes(id);
|
|
110
112
|
const hiddenToolHint = {
|
|
111
|
-
"projects.create": "Use \"projects.createAndConnect\", which attaches compute and returns a connection string.",
|
|
112
|
-
"branches.create": "Use \"branches.createWithCompute\", which attaches compute and returns a connection string.",
|
|
113
113
|
"operations.waitFor": "Write tools wait for readiness. operations.waitFor is not a tool.",
|
|
114
114
|
"postgres.roles.password": "Role passwords are not published as a tool.",
|
|
115
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",
|