@neon/tools 0.7.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 +12 -0
- package/dist/lib/ergonomic/catalog.d.ts +59 -0
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
- package/dist/lib/ergonomic/catalog.js +3 -1
- package/dist/lib/ergonomic/composed.d.ts +74 -0
- package/dist/lib/ergonomic/composed.d.ts.map +1 -1
- package/dist/lib/ergonomic/composed.js +57 -2
- 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
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ const tools = createNeonTools({
|
|
|
25
25
|
"projects.list",
|
|
26
26
|
"projects.createAndConnect",
|
|
27
27
|
"branches.createWithCompute",
|
|
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.
|
|
@@ -1050,6 +1050,65 @@ export declare const toolFactories: {
|
|
|
1050
1050
|
deletion_method: "user" | "ttl";
|
|
1051
1051
|
} | null | undefined;
|
|
1052
1052
|
}>;
|
|
1053
|
+
"branches.resetFromParent": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
1054
|
+
project_id: z.ZodString;
|
|
1055
|
+
branch_id: z.ZodString;
|
|
1056
|
+
preserve_under_name: z.ZodOptional<z.ZodString>;
|
|
1057
|
+
}, z.core.$strict>, "reset_from_parent_branches", {
|
|
1058
|
+
id: string;
|
|
1059
|
+
project_id: string;
|
|
1060
|
+
parent_id?: string | null | undefined;
|
|
1061
|
+
parent_lsn?: string | null | undefined;
|
|
1062
|
+
parent_timestamp?: string | null | undefined;
|
|
1063
|
+
name: string;
|
|
1064
|
+
current_state: import("@neon/sdk").BranchState;
|
|
1065
|
+
pending_state?: string | null | undefined;
|
|
1066
|
+
state_changed_at: string;
|
|
1067
|
+
logical_size?: number | null | undefined;
|
|
1068
|
+
creation_source: string;
|
|
1069
|
+
primary?: boolean | null | undefined;
|
|
1070
|
+
default: boolean;
|
|
1071
|
+
protected: boolean;
|
|
1072
|
+
cpu_used_sec: number;
|
|
1073
|
+
compute_time_seconds: number;
|
|
1074
|
+
active_time_seconds: number;
|
|
1075
|
+
written_data_bytes: number;
|
|
1076
|
+
data_transfer_bytes: number;
|
|
1077
|
+
created_at: string;
|
|
1078
|
+
updated_at: string;
|
|
1079
|
+
ttl_interval_seconds?: number | null | undefined;
|
|
1080
|
+
expires_at?: string | null | undefined;
|
|
1081
|
+
last_reset_at?: string | null | undefined;
|
|
1082
|
+
created_by?: {
|
|
1083
|
+
name?: string | null | undefined;
|
|
1084
|
+
image?: string | null | undefined;
|
|
1085
|
+
} | null | undefined;
|
|
1086
|
+
init_source?: string | null | undefined;
|
|
1087
|
+
restore_status?: string | null | undefined;
|
|
1088
|
+
restored_from?: string | null | undefined;
|
|
1089
|
+
restored_as?: string | null | undefined;
|
|
1090
|
+
restricted_actions?: {
|
|
1091
|
+
name: string;
|
|
1092
|
+
reason: string;
|
|
1093
|
+
}[] | null | undefined;
|
|
1094
|
+
recovery?: {
|
|
1095
|
+
deleted_at: string;
|
|
1096
|
+
recoverable_until: string;
|
|
1097
|
+
deletion_method: "user" | "ttl";
|
|
1098
|
+
} | null | undefined;
|
|
1099
|
+
}>;
|
|
1100
|
+
"branches.compareSchema": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
1101
|
+
project_id: z.ZodString;
|
|
1102
|
+
branch_id: z.ZodString;
|
|
1103
|
+
database_name: z.ZodString;
|
|
1104
|
+
base_branch_id: z.ZodOptional<z.ZodString>;
|
|
1105
|
+
lsn: z.ZodOptional<z.ZodString>;
|
|
1106
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1107
|
+
base_lsn: z.ZodOptional<z.ZodString>;
|
|
1108
|
+
base_timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1109
|
+
}, z.core.$strict>, "compare_schema_branches", {
|
|
1110
|
+
diff?: string | null | undefined;
|
|
1111
|
+
}>;
|
|
1053
1112
|
"branches.finalizeRestore": (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
|
|
1054
1113
|
project_id: z.ZodString;
|
|
1055
1114
|
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;AAWnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,UAAU,CAAC,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAutC6C,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, createBranchWithComputeTool, createProjectAndConnectTool, getDefaultTool, restoreSnapshotTool, setScheduleTool } from "./composed.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",
|
|
@@ -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>;
|
|
@@ -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>;
|
|
@@ -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;AAuB1E,eAAO,MAAM,kCAAkC;;;;;;;;;;kBAY7C,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAG7C,CAAC;AAEH,eAAO,MAAM,qBAAqB;;kBAEhC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;kBAOtC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;kBAWrC,CAAC;AAIH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;kBASjC,CAAC;AAEH,eAAO,MAAM,2BAA2B,GAAI,S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uery, 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
|
|
@@ -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,
|
|
@@ -123,6 +139,45 @@ 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
183
|
id: publishedId("postgres.connectionString"),
|
|
@@ -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",
|