@neon/tools 0.6.0 → 0.8.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 +26 -9
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/lib/ergonomic/bind.d.ts +4 -1
- package/dist/lib/ergonomic/bind.d.ts.map +1 -1
- package/dist/lib/ergonomic/bind.js +6 -1
- package/dist/lib/ergonomic/catalog.d.ts +157 -98
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
- package/dist/lib/ergonomic/catalog.js +5 -3
- package/dist/lib/ergonomic/composed.d.ts +80 -6
- package/dist/lib/ergonomic/composed.d.ts.map +1 -1
- package/dist/lib/ergonomic/composed.js +64 -9
- package/dist/lib/ergonomic/ids.d.ts +1 -1
- package/dist/lib/ergonomic/ids.d.ts.map +1 -1
- package/dist/lib/ergonomic/ids.js +2 -0
- package/package.json +2 -2
|
@@ -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,
|
|
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;AAWnB,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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAutC6C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decodeBase64 } from "../binary.js";
|
|
2
|
-
import { bindTool, collectObjectList, collectPages, fromGenerated } from "./bind.js";
|
|
3
|
-
import { connectionStringTool, createBranchWithComputeTool, createProjectAndConnectTool, getDefaultTool, restoreSnapshotTool, setScheduleTool } from "./composed.js";
|
|
2
|
+
import { bindTool, collectObjectList, collectPages, fromGenerated, publishedId } from "./bind.js";
|
|
3
|
+
import { compareSchemaTool, connectionStringTool, createBranchWithComputeTool, createProjectAndConnectTool, 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 = {
|
|
@@ -144,6 +144,8 @@ const toolFactories = {
|
|
|
144
144
|
generated: "setDefaultProjectBranch",
|
|
145
145
|
run: (neon, input, signal) => neon.branches.setDefault(input.project_id, input.branch_id, { signal })
|
|
146
146
|
}),
|
|
147
|
+
"branches.resetFromParent": resetFromParentTool,
|
|
148
|
+
"branches.compareSchema": compareSchemaTool,
|
|
147
149
|
"branches.finalizeRestore": (options) => fromGenerated(options, {
|
|
148
150
|
id: "branches.finalizeRestore",
|
|
149
151
|
generated: "finalizeRestoreBranch",
|
|
@@ -671,7 +673,7 @@ const toolFactories = {
|
|
|
671
673
|
}),
|
|
672
674
|
"regions.list": (options) => bindTool(options, {
|
|
673
675
|
operationId: "regions.list",
|
|
674
|
-
id: "
|
|
676
|
+
id: publishedId("regions.list"),
|
|
675
677
|
title: "List regions",
|
|
676
678
|
description: "Lists Neon regions available to the authenticated account.",
|
|
677
679
|
inputSchema: z.strictObject({}),
|
|
@@ -70,6 +70,21 @@ export declare const createProjectAndConnectInputSchema: z.ZodObject<{
|
|
|
70
70
|
export declare const getDefaultInputSchema: z.ZodObject<{
|
|
71
71
|
project_id: z.ZodString;
|
|
72
72
|
}, z.core.$strict>;
|
|
73
|
+
export declare const resetFromParentInputSchema: z.ZodObject<{
|
|
74
|
+
project_id: z.ZodString;
|
|
75
|
+
branch_id: z.ZodString;
|
|
76
|
+
preserve_under_name: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
export declare const compareSchemaInputSchema: z.ZodObject<{
|
|
79
|
+
project_id: z.ZodString;
|
|
80
|
+
branch_id: z.ZodString;
|
|
81
|
+
database_name: z.ZodString;
|
|
82
|
+
base_branch_id: z.ZodOptional<z.ZodString>;
|
|
83
|
+
lsn: z.ZodOptional<z.ZodString>;
|
|
84
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
85
|
+
base_lsn: z.ZodOptional<z.ZodString>;
|
|
86
|
+
base_timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
87
|
+
}, z.core.$strict>;
|
|
73
88
|
export declare const connectionStringInputSchema: z.ZodObject<{
|
|
74
89
|
project_id: z.ZodString;
|
|
75
90
|
branch_id: z.ZodOptional<z.ZodString>;
|
|
@@ -110,7 +125,7 @@ export declare const createBranchWithComputeTool: (options: ToolClientOptions) =
|
|
|
110
125
|
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
111
126
|
}, z.core.$strict>>;
|
|
112
127
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
-
}, z.core.$strict>, "
|
|
128
|
+
}, z.core.$strict>, "create_with_compute_branches", {
|
|
114
129
|
branch: {
|
|
115
130
|
id: string;
|
|
116
131
|
project_id: string;
|
|
@@ -250,7 +265,7 @@ export declare const createProjectAndConnectTool: (options: ToolClientOptions) =
|
|
|
250
265
|
store_passwords: z.ZodOptional<z.ZodBoolean>;
|
|
251
266
|
history_retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
252
267
|
org_id: z.ZodOptional<z.ZodString>;
|
|
253
|
-
}, z.core.$strict>, "
|
|
268
|
+
}, z.core.$strict>, "create_and_connect_projects", {
|
|
254
269
|
project: {
|
|
255
270
|
data_storage_bytes_hour: number;
|
|
256
271
|
data_transfer_bytes: number;
|
|
@@ -332,7 +347,7 @@ export declare const createProjectAndConnectTool: (options: ToolClientOptions) =
|
|
|
332
347
|
}>;
|
|
333
348
|
export declare const getDefaultTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
334
349
|
project_id: z.ZodString;
|
|
335
|
-
}, z.core.$strict>, "
|
|
350
|
+
}, z.core.$strict>, "get_default_branches", {
|
|
336
351
|
id: string;
|
|
337
352
|
project_id: string;
|
|
338
353
|
parent_id?: string | null | undefined;
|
|
@@ -375,6 +390,65 @@ export declare const getDefaultTool: (options: ToolClientOptions) => import("../
|
|
|
375
390
|
deletion_method: "user" | "ttl";
|
|
376
391
|
} | null | undefined;
|
|
377
392
|
}>;
|
|
393
|
+
export declare const resetFromParentTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
394
|
+
project_id: z.ZodString;
|
|
395
|
+
branch_id: z.ZodString;
|
|
396
|
+
preserve_under_name: z.ZodOptional<z.ZodString>;
|
|
397
|
+
}, z.core.$strict>, "reset_from_parent_branches", {
|
|
398
|
+
id: string;
|
|
399
|
+
project_id: string;
|
|
400
|
+
parent_id?: string | null | undefined;
|
|
401
|
+
parent_lsn?: string | null | undefined;
|
|
402
|
+
parent_timestamp?: string | null | undefined;
|
|
403
|
+
name: string;
|
|
404
|
+
current_state: import("@neon/sdk").BranchState;
|
|
405
|
+
pending_state?: string | null | undefined;
|
|
406
|
+
state_changed_at: string;
|
|
407
|
+
logical_size?: number | null | undefined;
|
|
408
|
+
creation_source: string;
|
|
409
|
+
primary?: boolean | null | undefined;
|
|
410
|
+
default: boolean;
|
|
411
|
+
protected: boolean;
|
|
412
|
+
cpu_used_sec: number;
|
|
413
|
+
compute_time_seconds: number;
|
|
414
|
+
active_time_seconds: number;
|
|
415
|
+
written_data_bytes: number;
|
|
416
|
+
data_transfer_bytes: number;
|
|
417
|
+
created_at: string;
|
|
418
|
+
updated_at: string;
|
|
419
|
+
ttl_interval_seconds?: number | null | undefined;
|
|
420
|
+
expires_at?: string | null | undefined;
|
|
421
|
+
last_reset_at?: string | null | undefined;
|
|
422
|
+
created_by?: {
|
|
423
|
+
name?: string | null | undefined;
|
|
424
|
+
image?: string | null | undefined;
|
|
425
|
+
} | null | undefined;
|
|
426
|
+
init_source?: string | null | undefined;
|
|
427
|
+
restore_status?: string | null | undefined;
|
|
428
|
+
restored_from?: string | null | undefined;
|
|
429
|
+
restored_as?: string | null | undefined;
|
|
430
|
+
restricted_actions?: {
|
|
431
|
+
name: string;
|
|
432
|
+
reason: string;
|
|
433
|
+
}[] | null | undefined;
|
|
434
|
+
recovery?: {
|
|
435
|
+
deleted_at: string;
|
|
436
|
+
recoverable_until: string;
|
|
437
|
+
deletion_method: "user" | "ttl";
|
|
438
|
+
} | null | undefined;
|
|
439
|
+
}>;
|
|
440
|
+
export declare const compareSchemaTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
441
|
+
project_id: z.ZodString;
|
|
442
|
+
branch_id: z.ZodString;
|
|
443
|
+
database_name: z.ZodString;
|
|
444
|
+
base_branch_id: z.ZodOptional<z.ZodString>;
|
|
445
|
+
lsn: z.ZodOptional<z.ZodString>;
|
|
446
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
447
|
+
base_lsn: z.ZodOptional<z.ZodString>;
|
|
448
|
+
base_timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
449
|
+
}, z.core.$strict>, "compare_schema_branches", {
|
|
450
|
+
diff?: string | null | undefined;
|
|
451
|
+
}>;
|
|
378
452
|
export declare const connectionStringTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
379
453
|
project_id: z.ZodString;
|
|
380
454
|
branch_id: z.ZodOptional<z.ZodString>;
|
|
@@ -382,14 +456,14 @@ export declare const connectionStringTool: (options: ToolClientOptions) => impor
|
|
|
382
456
|
database_name: z.ZodString;
|
|
383
457
|
role_name: z.ZodString;
|
|
384
458
|
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
385
|
-
}, z.core.$strict>, "
|
|
459
|
+
}, z.core.$strict>, "connection_string_postgres", string>;
|
|
386
460
|
export declare const restoreSnapshotTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
387
461
|
project_id: z.ZodString;
|
|
388
462
|
snapshot_id: z.ZodString;
|
|
389
463
|
name: z.ZodOptional<z.ZodString>;
|
|
390
464
|
target_branch_id: z.ZodOptional<z.ZodString>;
|
|
391
465
|
finalize: z.ZodOptional<z.ZodBoolean>;
|
|
392
|
-
}, z.core.$strict>, "
|
|
466
|
+
}, z.core.$strict>, "restore_snapshots", {
|
|
393
467
|
id: string;
|
|
394
468
|
project_id: string;
|
|
395
469
|
parent_id?: string | null | undefined;
|
|
@@ -446,5 +520,5 @@ export declare const setScheduleTool: (options: ToolClientOptions) => import("..
|
|
|
446
520
|
month: z.ZodOptional<z.ZodInt>;
|
|
447
521
|
retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
448
522
|
}, z.core.$strict>>;
|
|
449
|
-
}, z.core.$strict>, "
|
|
523
|
+
}, z.core.$strict>, "set_schedule_snapshots", null>;
|
|
450
524
|
//# sourceMappingURL=composed.d.ts.map
|
|
@@ -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,
|
|
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;AAuB1E,eAAO,MAAM,kCAAkC;;;;;;;;;;kBAY7C,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,2BAA2B,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CpE,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,5 +1,5 @@
|
|
|
1
|
-
import { zBackupScheduleItem, zBranchCreateRequest, zComputeUnit, zCreateProjectBody, zCreateProjectBranchPath, zGetConnectionUriPath, zGetConnectionUriQuery, zListProjectBranchesPath, zRestoreSnapshotBody, zRestoreSnapshotPath, zSetSnapshotSchedulePath, zSuspendTimeoutSeconds } from "../../generated/zod.gen.js";
|
|
2
|
-
import { bindTool } from "./bind.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
|
+
import { bindTool, publishedId } from "./bind.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
//#region src/lib/ergonomic/composed.ts
|
|
5
5
|
const writeAnnotations = {
|
|
@@ -30,6 +30,22 @@ const createProjectAndConnectInputSchema = z.strictObject({
|
|
|
30
30
|
pooled: pooledField
|
|
31
31
|
});
|
|
32
32
|
const getDefaultInputSchema = z.strictObject({ project_id: zListProjectBranchesPath.shape.project_id });
|
|
33
|
+
const resetFromParentInputSchema = z.strictObject({
|
|
34
|
+
project_id: zRestoreProjectBranchPath.shape.project_id,
|
|
35
|
+
branch_id: zRestoreProjectBranchPath.shape.branch_id,
|
|
36
|
+
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.")
|
|
37
|
+
});
|
|
38
|
+
const compareQuery = zGetProjectBranchSchemaComparisonQuery.shape;
|
|
39
|
+
const compareSchemaInputSchema = z.strictObject({
|
|
40
|
+
project_id: zGetProjectBranchSchemaComparisonPath.shape.project_id,
|
|
41
|
+
branch_id: zGetProjectBranchSchemaComparisonPath.shape.branch_id,
|
|
42
|
+
database_name: compareQuery.db_name,
|
|
43
|
+
base_branch_id: compareQuery.base_branch_id,
|
|
44
|
+
lsn: compareQuery.lsn,
|
|
45
|
+
timestamp: compareQuery.timestamp,
|
|
46
|
+
base_lsn: compareQuery.base_lsn,
|
|
47
|
+
base_timestamp: compareQuery.base_timestamp
|
|
48
|
+
});
|
|
33
49
|
const connectionStringInputSchema = z.strictObject({
|
|
34
50
|
project_id: zGetConnectionUriPath.shape.project_id,
|
|
35
51
|
branch_id: zGetConnectionUriQuery.shape.branch_id,
|
|
@@ -60,7 +76,7 @@ const setScheduleInputSchema = z.strictObject({
|
|
|
60
76
|
});
|
|
61
77
|
const createBranchWithComputeTool = (options) => bindTool(options, {
|
|
62
78
|
operationId: "branches.createWithCompute",
|
|
63
|
-
id: "
|
|
79
|
+
id: publishedId("branches.createWithCompute"),
|
|
64
80
|
title: "Create branch with compute",
|
|
65
81
|
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
82
|
inputSchema: createBranchWithComputeInputSchema,
|
|
@@ -87,7 +103,7 @@ const createBranchWithComputeTool = (options) => bindTool(options, {
|
|
|
87
103
|
}));
|
|
88
104
|
const createProjectAndConnectTool = (options) => bindTool(options, {
|
|
89
105
|
operationId: "projects.createAndConnect",
|
|
90
|
-
id: "
|
|
106
|
+
id: publishedId("projects.createAndConnect"),
|
|
91
107
|
title: "Create project and connect",
|
|
92
108
|
description: "Create a project and return a connection string to its default branch. The call waits until operation-backed provisioning finishes, up to five minutes by default.",
|
|
93
109
|
inputSchema: createProjectAndConnectInputSchema,
|
|
@@ -109,7 +125,7 @@ const createProjectAndConnectTool = (options) => bindTool(options, {
|
|
|
109
125
|
});
|
|
110
126
|
const getDefaultTool = (options) => bindTool(options, {
|
|
111
127
|
operationId: "branches.getDefault",
|
|
112
|
-
id: "
|
|
128
|
+
id: publishedId("branches.getDefault"),
|
|
113
129
|
title: "Get default branch",
|
|
114
130
|
description: "Resolve the project's default branch by the default flag, not by name.",
|
|
115
131
|
inputSchema: getDefaultInputSchema,
|
|
@@ -123,9 +139,48 @@ const getDefaultTool = (options) => bindTool(options, {
|
|
|
123
139
|
tags: ["Branch"]
|
|
124
140
|
}
|
|
125
141
|
}, (neon, input, signal) => neon.branches.getDefault(input.project_id, { signal }));
|
|
142
|
+
const resetFromParentTool = (options) => bindTool(options, {
|
|
143
|
+
operationId: "branches.resetFromParent",
|
|
144
|
+
id: publishedId("branches.resetFromParent"),
|
|
145
|
+
title: "Reset branch from parent",
|
|
146
|
+
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.",
|
|
147
|
+
inputSchema: resetFromParentInputSchema,
|
|
148
|
+
annotations: writeAnnotations,
|
|
149
|
+
requiresApproval: true,
|
|
150
|
+
metadata: {
|
|
151
|
+
method: "POST",
|
|
152
|
+
path: "/projects/{project_id}/branches/{branch_id}/restore",
|
|
153
|
+
stability: "stable",
|
|
154
|
+
deprecated: false,
|
|
155
|
+
tags: ["Branch"]
|
|
156
|
+
}
|
|
157
|
+
}, (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 }));
|
|
158
|
+
const compareSchemaTool = (options) => bindTool(options, {
|
|
159
|
+
operationId: "branches.compareSchema",
|
|
160
|
+
id: publishedId("branches.compareSchema"),
|
|
161
|
+
title: "Compare database schema",
|
|
162
|
+
description: "Compare a branch database schema to another branch. Omitting base_branch_id compares against the parent. Returns a unified SQL diff.",
|
|
163
|
+
inputSchema: compareSchemaInputSchema,
|
|
164
|
+
annotations: readAnnotations,
|
|
165
|
+
requiresApproval: false,
|
|
166
|
+
metadata: {
|
|
167
|
+
method: "GET",
|
|
168
|
+
path: "/projects/{project_id}/branches/{branch_id}/compare_schema",
|
|
169
|
+
stability: "stable",
|
|
170
|
+
deprecated: false,
|
|
171
|
+
tags: ["Branch"]
|
|
172
|
+
}
|
|
173
|
+
}, (neon, input, signal) => neon.branches.compareSchema(input.project_id, input.branch_id, {
|
|
174
|
+
databaseName: input.database_name,
|
|
175
|
+
...input.base_branch_id === void 0 ? {} : { baseBranchId: input.base_branch_id },
|
|
176
|
+
...input.lsn === void 0 ? {} : { lsn: input.lsn },
|
|
177
|
+
...input.timestamp === void 0 ? {} : { timestamp: input.timestamp },
|
|
178
|
+
...input.base_lsn === void 0 ? {} : { baseLsn: input.base_lsn },
|
|
179
|
+
...input.base_timestamp === void 0 ? {} : { baseTimestamp: input.base_timestamp }
|
|
180
|
+
}, { signal }));
|
|
126
181
|
const connectionStringTool = (options) => bindTool(options, {
|
|
127
182
|
operationId: "postgres.connectionString",
|
|
128
|
-
id: "
|
|
183
|
+
id: publishedId("postgres.connectionString"),
|
|
129
184
|
title: "Get connection string",
|
|
130
185
|
description: "Resolve a Postgres connection string. Auto-selects the default branch and the sole role and database when those are omitted. Errors when the selection is ambiguous.",
|
|
131
186
|
inputSchema: connectionStringInputSchema,
|
|
@@ -148,7 +203,7 @@ const connectionStringTool = (options) => bindTool(options, {
|
|
|
148
203
|
}, { signal }));
|
|
149
204
|
const restoreSnapshotTool = (options) => bindTool(options, {
|
|
150
205
|
operationId: "snapshots.restore",
|
|
151
|
-
id: "
|
|
206
|
+
id: publishedId("snapshots.restore"),
|
|
152
207
|
title: "Restore snapshot",
|
|
153
208
|
description: "Restore a snapshot onto a new or existing branch. The call waits until operation-backed provisioning finishes. Preview callbacks are not available on this tool.",
|
|
154
209
|
inputSchema: restoreSnapshotInputSchema,
|
|
@@ -168,7 +223,7 @@ const restoreSnapshotTool = (options) => bindTool(options, {
|
|
|
168
223
|
}, { signal }));
|
|
169
224
|
const setScheduleTool = (options) => bindTool(options, {
|
|
170
225
|
operationId: "snapshots.setSchedule",
|
|
171
|
-
id: "
|
|
226
|
+
id: publishedId("snapshots.setSchedule"),
|
|
172
227
|
title: "Set snapshot schedule",
|
|
173
228
|
description: "Replace a branch's automatic snapshot schedule. Frequency must be daily, weekly, or monthly.",
|
|
174
229
|
inputSchema: setScheduleInputSchema,
|
|
@@ -183,4 +238,4 @@ const setScheduleTool = (options) => bindTool(options, {
|
|
|
183
238
|
}
|
|
184
239
|
}, (neon, input, signal) => neon.snapshots.setSchedule(input.project_id, input.branch_id, { schedule: input.schedule }, { signal }));
|
|
185
240
|
//#endregion
|
|
186
|
-
export { connectionStringInputSchema, connectionStringTool, createBranchWithComputeInputSchema, createBranchWithComputeTool, createProjectAndConnectInputSchema, createProjectAndConnectTool, getDefaultInputSchema, getDefaultTool, restoreSnapshotInputSchema, restoreSnapshotTool, setScheduleInputSchema, setScheduleTool };
|
|
241
|
+
export { compareSchemaInputSchema, compareSchemaTool, connectionStringInputSchema, connectionStringTool, createBranchWithComputeInputSchema, createBranchWithComputeTool, createProjectAndConnectInputSchema, createProjectAndConnectTool, getDefaultInputSchema, getDefaultTool, resetFromParentInputSchema, resetFromParentTool, restoreSnapshotInputSchema, restoreSnapshotTool, setScheduleInputSchema, setScheduleTool };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const hiddenToolIds: readonly ["operations.waitFor", "branches.create", "projects.create", "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.createWithCompute", "branches.update", "branches.delete", "branches.getDefault", "branches.setDefault", "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"];
|
|
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.createWithCompute", "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,yHAMhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/ids.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,yHAMhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,OAAO,s0EAqGV,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;AAa7C,eAAO,MAAM,oBAAoB,GAAI,IAAI,MAAM,KAAG,SAOjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neon/tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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": "2.
|
|
72
|
+
"@neon/sdk": "2.3.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@hey-api/openapi-ts": "0.98.2",
|