@neon/tools 0.5.0 → 0.6.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 +55 -109
- package/dist/index.d.ts +24 -50
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -43
- package/dist/lib/ergonomic/bind.d.ts +54 -0
- package/dist/lib/ergonomic/bind.d.ts.map +1 -0
- package/dist/lib/ergonomic/bind.js +121 -0
- package/dist/lib/ergonomic/catalog.d.ts +2601 -0
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -0
- package/dist/lib/ergonomic/catalog.js +703 -0
- package/dist/lib/ergonomic/composed.d.ts +450 -0
- package/dist/lib/ergonomic/composed.d.ts.map +1 -0
- package/dist/lib/ergonomic/composed.js +186 -0
- package/dist/lib/ergonomic/ids.d.ts +7 -0
- package/dist/lib/ergonomic/ids.d.ts.map +1 -0
- package/dist/lib/ergonomic/ids.js +122 -0
- package/dist/lib/ergonomic/index.d.ts +4 -0
- package/dist/lib/ergonomic/index.d.ts.map +1 -0
- package/dist/lib/ergonomic/index.js +4 -0
- package/package.json +2 -2
- package/dist/lib/workflows.d.ts +0 -315
- package/dist/lib/workflows.d.ts.map +0 -1
- package/dist/lib/workflows.js +0 -113
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//#region src/lib/ergonomic/ids.ts
|
|
2
|
+
const hiddenToolIds = [
|
|
3
|
+
"operations.waitFor",
|
|
4
|
+
"branches.create",
|
|
5
|
+
"projects.create",
|
|
6
|
+
"postgres.roles.password",
|
|
7
|
+
"storage.objects.get"
|
|
8
|
+
];
|
|
9
|
+
const toolIds = [
|
|
10
|
+
"projects.list",
|
|
11
|
+
"projects.get",
|
|
12
|
+
"projects.createAndConnect",
|
|
13
|
+
"projects.update",
|
|
14
|
+
"projects.delete",
|
|
15
|
+
"projects.recover",
|
|
16
|
+
"projects.transfer",
|
|
17
|
+
"projects.transferFromUser",
|
|
18
|
+
"projects.permissions.list",
|
|
19
|
+
"projects.permissions.grant",
|
|
20
|
+
"projects.permissions.revoke",
|
|
21
|
+
"projects.members.list",
|
|
22
|
+
"projects.members.setRole",
|
|
23
|
+
"projects.members.removeRole",
|
|
24
|
+
"branches.list",
|
|
25
|
+
"branches.get",
|
|
26
|
+
"branches.createWithCompute",
|
|
27
|
+
"branches.update",
|
|
28
|
+
"branches.delete",
|
|
29
|
+
"branches.getDefault",
|
|
30
|
+
"branches.setDefault",
|
|
31
|
+
"branches.finalizeRestore",
|
|
32
|
+
"postgres.connectionString",
|
|
33
|
+
"postgres.endpoints.list",
|
|
34
|
+
"postgres.endpoints.listByBranch",
|
|
35
|
+
"postgres.endpoints.get",
|
|
36
|
+
"postgres.endpoints.create",
|
|
37
|
+
"postgres.endpoints.update",
|
|
38
|
+
"postgres.endpoints.delete",
|
|
39
|
+
"postgres.endpoints.start",
|
|
40
|
+
"postgres.endpoints.suspend",
|
|
41
|
+
"postgres.endpoints.restart",
|
|
42
|
+
"postgres.roles.list",
|
|
43
|
+
"postgres.roles.get",
|
|
44
|
+
"postgres.roles.create",
|
|
45
|
+
"postgres.roles.delete",
|
|
46
|
+
"postgres.roles.resetPassword",
|
|
47
|
+
"postgres.databases.list",
|
|
48
|
+
"postgres.databases.get",
|
|
49
|
+
"postgres.databases.create",
|
|
50
|
+
"postgres.databases.update",
|
|
51
|
+
"postgres.databases.delete",
|
|
52
|
+
"postgres.dataApi.get",
|
|
53
|
+
"postgres.dataApi.create",
|
|
54
|
+
"postgres.dataApi.update",
|
|
55
|
+
"postgres.dataApi.delete",
|
|
56
|
+
"storage.get",
|
|
57
|
+
"storage.buckets.list",
|
|
58
|
+
"storage.buckets.create",
|
|
59
|
+
"storage.buckets.delete",
|
|
60
|
+
"storage.objects.list",
|
|
61
|
+
"storage.objects.delete",
|
|
62
|
+
"storage.objects.deleteByPrefix",
|
|
63
|
+
"storage.objects.presign",
|
|
64
|
+
"functions.list",
|
|
65
|
+
"functions.get",
|
|
66
|
+
"functions.update",
|
|
67
|
+
"functions.delete",
|
|
68
|
+
"functions.deploy",
|
|
69
|
+
"credentials.list",
|
|
70
|
+
"credentials.create",
|
|
71
|
+
"credentials.revoke",
|
|
72
|
+
"aiGateway.get",
|
|
73
|
+
"logs.query",
|
|
74
|
+
"logs.fields",
|
|
75
|
+
"logs.fieldValues",
|
|
76
|
+
"snapshots.list",
|
|
77
|
+
"snapshots.create",
|
|
78
|
+
"snapshots.update",
|
|
79
|
+
"snapshots.delete",
|
|
80
|
+
"snapshots.restore",
|
|
81
|
+
"snapshots.getSchedule",
|
|
82
|
+
"snapshots.setSchedule",
|
|
83
|
+
"operations.list",
|
|
84
|
+
"operations.get",
|
|
85
|
+
"auth.get",
|
|
86
|
+
"auth.create",
|
|
87
|
+
"auth.disable",
|
|
88
|
+
"auth.updateConfig",
|
|
89
|
+
"auth.oauthProviders.list",
|
|
90
|
+
"auth.oauthProviders.add",
|
|
91
|
+
"auth.oauthProviders.update",
|
|
92
|
+
"auth.oauthProviders.delete",
|
|
93
|
+
"auth.trustedDomains.list",
|
|
94
|
+
"auth.trustedDomains.add",
|
|
95
|
+
"auth.trustedDomains.delete",
|
|
96
|
+
"auth.users.create",
|
|
97
|
+
"auth.users.delete",
|
|
98
|
+
"auth.users.updateRole",
|
|
99
|
+
"consumption.perProject",
|
|
100
|
+
"consumption.perProjectV2",
|
|
101
|
+
"consumption.perBranchV2",
|
|
102
|
+
"apiKeys.list",
|
|
103
|
+
"apiKeys.create",
|
|
104
|
+
"apiKeys.revoke",
|
|
105
|
+
"regions.list",
|
|
106
|
+
"user.me",
|
|
107
|
+
"user.organizations"
|
|
108
|
+
];
|
|
109
|
+
const isNeonToolId = (id) => toolIds.includes(id);
|
|
110
|
+
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
|
+
"operations.waitFor": "Write tools wait for readiness. operations.waitFor is not a tool.",
|
|
114
|
+
"postgres.roles.password": "Role passwords are not published as a tool.",
|
|
115
|
+
"storage.objects.get": "Object bytes are not published as a tool."
|
|
116
|
+
};
|
|
117
|
+
const unpublishedToolError = (id) => {
|
|
118
|
+
if (hiddenToolIds.includes(id)) return /* @__PURE__ */ new TypeError(`Neon tool "${id}" is not published. ${hiddenToolHint[id]}`);
|
|
119
|
+
return /* @__PURE__ */ new TypeError(`Unknown Neon tool "${id}".`);
|
|
120
|
+
};
|
|
121
|
+
//#endregion
|
|
122
|
+
export { hiddenToolIds, isNeonToolId, toolIds, unpublishedToolError };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type PublishedId, publishedId, type ToolClientOptions, } from "./bind.js";
|
|
2
|
+
export { type ToolFactory, toolFactories } from "./catalog.js";
|
|
3
|
+
export { type HiddenToolId, hiddenToolIds, isNeonToolId, type NeonToolId, toolIds, unpublishedToolError, } from "./ids.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,iBAAiB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EACN,KAAK,YAAY,EACjB,aAAa,EACb,YAAY,EACZ,KAAK,UAAU,EACf,OAAO,EACP,oBAAoB,GACpB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { publishedId } from "./bind.js";
|
|
2
|
+
import { toolFactories } from "./catalog.js";
|
|
3
|
+
import { hiddenToolIds, isNeonToolId, toolIds, unpublishedToolError } from "./ids.js";
|
|
4
|
+
export { hiddenToolIds, isNeonToolId, publishedId, toolFactories, toolIds, unpublishedToolError };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neon/tools",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Agent tools for the Neon
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Agent tools for the Neon SDK ergonomic client, compatible with MCP, Eve, and Mastra.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neon",
|
|
7
7
|
"database",
|
package/dist/lib/workflows.d.ts
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import { type NeonConfig } from "@neon/sdk";
|
|
2
|
-
import * as z from "zod";
|
|
3
|
-
import { type NeonBearerCredential } from "./auth.js";
|
|
4
|
-
import type { NeonTool } from "./operation.js";
|
|
5
|
-
export interface WorkflowClientOptions {
|
|
6
|
-
apiKey?: NeonBearerCredential;
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
fetch?: typeof fetch;
|
|
9
|
-
wait?: NeonConfig["wait"];
|
|
10
|
-
}
|
|
11
|
-
export declare const createBranchWithComputeInputSchema: z.ZodObject<{
|
|
12
|
-
project_id: z.ZodString;
|
|
13
|
-
name: z.ZodOptional<z.ZodString>;
|
|
14
|
-
parent_id: z.ZodOptional<z.ZodString>;
|
|
15
|
-
compute: z.ZodOptional<z.ZodObject<{
|
|
16
|
-
min_cu: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
max_cu: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
19
|
-
}, z.core.$strict>>;
|
|
20
|
-
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
-
}, z.core.$strict>;
|
|
22
|
-
export declare const createProjectAndConnectInputSchema: z.ZodObject<{
|
|
23
|
-
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
-
settings: z.ZodOptional<z.ZodObject<{
|
|
25
|
-
quota: z.ZodOptional<z.ZodObject<{
|
|
26
|
-
active_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
27
|
-
compute_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
28
|
-
written_data_bytes: z.ZodOptional<z.ZodInt>;
|
|
29
|
-
data_transfer_bytes: z.ZodOptional<z.ZodInt>;
|
|
30
|
-
logical_size_bytes: z.ZodOptional<z.ZodInt>;
|
|
31
|
-
}, z.core.$strict>>;
|
|
32
|
-
allowed_ips: z.ZodOptional<z.ZodObject<{
|
|
33
|
-
ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
-
protected_branches_only: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
-
}, z.core.$strict>>;
|
|
36
|
-
enable_logical_replication: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
-
maintenance_window: z.ZodOptional<z.ZodObject<{
|
|
38
|
-
weekdays: z.ZodArray<z.ZodInt>;
|
|
39
|
-
start_time: z.ZodString;
|
|
40
|
-
end_time: z.ZodString;
|
|
41
|
-
}, z.core.$strict>>;
|
|
42
|
-
block_public_connections: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
-
block_vpc_connections: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
-
audit_log_level: z.ZodOptional<z.ZodEnum<{
|
|
45
|
-
base: "base";
|
|
46
|
-
extended: "extended";
|
|
47
|
-
full: "full";
|
|
48
|
-
}>>;
|
|
49
|
-
hipaa: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
-
preload_libraries: z.ZodOptional<z.ZodObject<{
|
|
51
|
-
use_defaults: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
-
enabled_libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
-
}, z.core.$strict>>;
|
|
54
|
-
}, z.core.$strict>>;
|
|
55
|
-
name: z.ZodOptional<z.ZodString>;
|
|
56
|
-
branch: z.ZodOptional<z.ZodObject<{
|
|
57
|
-
name: z.ZodOptional<z.ZodString>;
|
|
58
|
-
role_name: z.ZodOptional<z.ZodString>;
|
|
59
|
-
database_name: z.ZodOptional<z.ZodString>;
|
|
60
|
-
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
61
|
-
}, z.core.$strict>>;
|
|
62
|
-
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
63
|
-
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
provisioner: z.ZodOptional<z.ZodString>;
|
|
65
|
-
region_id: z.ZodOptional<z.ZodString>;
|
|
66
|
-
default_endpoint_settings: z.ZodOptional<z.ZodObject<{
|
|
67
|
-
pg_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
68
|
-
pgbouncer_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
69
|
-
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
70
|
-
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
71
|
-
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
72
|
-
}, z.core.$strict>>;
|
|
73
|
-
pg_version: z.ZodOptional<z.ZodInt>;
|
|
74
|
-
store_passwords: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
-
history_retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
76
|
-
org_id: z.ZodOptional<z.ZodString>;
|
|
77
|
-
}, z.core.$strict>;
|
|
78
|
-
export declare const workflowIds: readonly ["createBranchWithCompute", "createProjectAndConnect"];
|
|
79
|
-
export type NeonWorkflowId = (typeof workflowIds)[number];
|
|
80
|
-
export declare const workflowFactories: {
|
|
81
|
-
createBranchWithCompute: (options: WorkflowClientOptions) => NeonTool<z.ZodObject<{
|
|
82
|
-
project_id: z.ZodString;
|
|
83
|
-
name: z.ZodOptional<z.ZodString>;
|
|
84
|
-
parent_id: z.ZodOptional<z.ZodString>;
|
|
85
|
-
compute: z.ZodOptional<z.ZodObject<{
|
|
86
|
-
min_cu: z.ZodOptional<z.ZodNumber>;
|
|
87
|
-
max_cu: z.ZodOptional<z.ZodNumber>;
|
|
88
|
-
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
89
|
-
}, z.core.$strict>>;
|
|
90
|
-
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
-
}, z.core.$strict>, "create_branch_with_compute", {
|
|
92
|
-
branch: {
|
|
93
|
-
id: string;
|
|
94
|
-
project_id: string;
|
|
95
|
-
parent_id?: string | null | undefined;
|
|
96
|
-
parent_lsn?: string | null | undefined;
|
|
97
|
-
parent_timestamp?: string | null | undefined;
|
|
98
|
-
name: string;
|
|
99
|
-
current_state: import("@neon/sdk").BranchState;
|
|
100
|
-
pending_state?: string | null | undefined;
|
|
101
|
-
state_changed_at: string;
|
|
102
|
-
logical_size?: number | null | undefined;
|
|
103
|
-
creation_source: string;
|
|
104
|
-
primary?: boolean | null | undefined;
|
|
105
|
-
default: boolean;
|
|
106
|
-
protected: boolean;
|
|
107
|
-
cpu_used_sec: number;
|
|
108
|
-
compute_time_seconds: number;
|
|
109
|
-
active_time_seconds: number;
|
|
110
|
-
written_data_bytes: number;
|
|
111
|
-
data_transfer_bytes: number;
|
|
112
|
-
created_at: string;
|
|
113
|
-
updated_at: string;
|
|
114
|
-
ttl_interval_seconds?: number | null | undefined;
|
|
115
|
-
expires_at?: string | null | undefined;
|
|
116
|
-
last_reset_at?: string | null | undefined;
|
|
117
|
-
created_by?: {
|
|
118
|
-
name?: string | null | undefined;
|
|
119
|
-
image?: string | null | undefined;
|
|
120
|
-
} | null | undefined;
|
|
121
|
-
init_source?: string | null | undefined;
|
|
122
|
-
restore_status?: string | null | undefined;
|
|
123
|
-
restored_from?: string | null | undefined;
|
|
124
|
-
restored_as?: string | null | undefined;
|
|
125
|
-
restricted_actions?: {
|
|
126
|
-
name: string;
|
|
127
|
-
reason: string;
|
|
128
|
-
}[] | null | undefined;
|
|
129
|
-
recovery?: {
|
|
130
|
-
deleted_at: string;
|
|
131
|
-
recoverable_until: string;
|
|
132
|
-
deletion_method: "user" | "ttl";
|
|
133
|
-
} | null | undefined;
|
|
134
|
-
};
|
|
135
|
-
endpoint: {
|
|
136
|
-
host: string;
|
|
137
|
-
id: string;
|
|
138
|
-
name?: string | null | undefined;
|
|
139
|
-
project_id: string;
|
|
140
|
-
branch_id: string;
|
|
141
|
-
autoscaling_limit_min_cu: import("@neon/sdk").ComputeUnit;
|
|
142
|
-
autoscaling_limit_max_cu: import("@neon/sdk").ComputeUnit;
|
|
143
|
-
region_id: string;
|
|
144
|
-
type: import("@neon/sdk").EndpointType;
|
|
145
|
-
current_state: import("@neon/sdk").EndpointState;
|
|
146
|
-
pending_state?: import("@neon/sdk").EndpointState | null | undefined;
|
|
147
|
-
settings: {
|
|
148
|
-
pg_settings?: {
|
|
149
|
-
[x: string]: string;
|
|
150
|
-
} | null | undefined;
|
|
151
|
-
pgbouncer_settings?: {
|
|
152
|
-
[x: string]: string;
|
|
153
|
-
} | null | undefined;
|
|
154
|
-
preload_libraries?: {
|
|
155
|
-
use_defaults?: boolean | null | undefined;
|
|
156
|
-
enabled_libraries?: string[] | null | undefined;
|
|
157
|
-
} | null | undefined;
|
|
158
|
-
};
|
|
159
|
-
pooler_enabled: boolean;
|
|
160
|
-
pooler_mode: import("@neon/sdk").EndpointPoolerMode;
|
|
161
|
-
disabled: boolean;
|
|
162
|
-
passwordless_access: boolean;
|
|
163
|
-
last_active?: string | null | undefined;
|
|
164
|
-
creation_source: string;
|
|
165
|
-
created_at: string;
|
|
166
|
-
updated_at: string;
|
|
167
|
-
started_at?: string | null | undefined;
|
|
168
|
-
suspended_at?: string | null | undefined;
|
|
169
|
-
proxy_host: string;
|
|
170
|
-
suspend_timeout_seconds: import("@neon/sdk").SuspendTimeoutSeconds;
|
|
171
|
-
provisioner: import("@neon/sdk").Provisioner;
|
|
172
|
-
compute_release_version?: string | null | undefined;
|
|
173
|
-
};
|
|
174
|
-
connectionString: string;
|
|
175
|
-
}>;
|
|
176
|
-
createProjectAndConnect: (options: WorkflowClientOptions) => NeonTool<z.ZodObject<{
|
|
177
|
-
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
-
settings: z.ZodOptional<z.ZodObject<{
|
|
179
|
-
quota: z.ZodOptional<z.ZodObject<{
|
|
180
|
-
active_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
181
|
-
compute_time_seconds: z.ZodOptional<z.ZodInt>;
|
|
182
|
-
written_data_bytes: z.ZodOptional<z.ZodInt>;
|
|
183
|
-
data_transfer_bytes: z.ZodOptional<z.ZodInt>;
|
|
184
|
-
logical_size_bytes: z.ZodOptional<z.ZodInt>;
|
|
185
|
-
}, z.core.$strict>>;
|
|
186
|
-
allowed_ips: z.ZodOptional<z.ZodObject<{
|
|
187
|
-
ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
188
|
-
protected_branches_only: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
-
}, z.core.$strict>>;
|
|
190
|
-
enable_logical_replication: z.ZodOptional<z.ZodBoolean>;
|
|
191
|
-
maintenance_window: z.ZodOptional<z.ZodObject<{
|
|
192
|
-
weekdays: z.ZodArray<z.ZodInt>;
|
|
193
|
-
start_time: z.ZodString;
|
|
194
|
-
end_time: z.ZodString;
|
|
195
|
-
}, z.core.$strict>>;
|
|
196
|
-
block_public_connections: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
-
block_vpc_connections: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
-
audit_log_level: z.ZodOptional<z.ZodEnum<{
|
|
199
|
-
base: "base";
|
|
200
|
-
extended: "extended";
|
|
201
|
-
full: "full";
|
|
202
|
-
}>>;
|
|
203
|
-
hipaa: z.ZodOptional<z.ZodBoolean>;
|
|
204
|
-
preload_libraries: z.ZodOptional<z.ZodObject<{
|
|
205
|
-
use_defaults: z.ZodOptional<z.ZodBoolean>;
|
|
206
|
-
enabled_libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
207
|
-
}, z.core.$strict>>;
|
|
208
|
-
}, z.core.$strict>>;
|
|
209
|
-
name: z.ZodOptional<z.ZodString>;
|
|
210
|
-
branch: z.ZodOptional<z.ZodObject<{
|
|
211
|
-
name: z.ZodOptional<z.ZodString>;
|
|
212
|
-
role_name: z.ZodOptional<z.ZodString>;
|
|
213
|
-
database_name: z.ZodOptional<z.ZodString>;
|
|
214
|
-
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
215
|
-
}, z.core.$strict>>;
|
|
216
|
-
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
217
|
-
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
218
|
-
provisioner: z.ZodOptional<z.ZodString>;
|
|
219
|
-
region_id: z.ZodOptional<z.ZodString>;
|
|
220
|
-
default_endpoint_settings: z.ZodOptional<z.ZodObject<{
|
|
221
|
-
pg_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
222
|
-
pgbouncer_settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
223
|
-
autoscaling_limit_min_cu: z.ZodOptional<z.ZodNumber>;
|
|
224
|
-
autoscaling_limit_max_cu: z.ZodOptional<z.ZodNumber>;
|
|
225
|
-
suspend_timeout_seconds: z.ZodOptional<z.ZodInt>;
|
|
226
|
-
}, z.core.$strict>>;
|
|
227
|
-
pg_version: z.ZodOptional<z.ZodInt>;
|
|
228
|
-
store_passwords: z.ZodOptional<z.ZodBoolean>;
|
|
229
|
-
history_retention_seconds: z.ZodOptional<z.ZodInt>;
|
|
230
|
-
org_id: z.ZodOptional<z.ZodString>;
|
|
231
|
-
}, z.core.$strict>, "create_project_and_connect", {
|
|
232
|
-
project: {
|
|
233
|
-
data_storage_bytes_hour: number;
|
|
234
|
-
data_transfer_bytes: number;
|
|
235
|
-
written_data_bytes: number;
|
|
236
|
-
compute_time_seconds: number;
|
|
237
|
-
active_time_seconds: number;
|
|
238
|
-
cpu_used_sec: number;
|
|
239
|
-
id: string;
|
|
240
|
-
platform_id: string;
|
|
241
|
-
region_id: string;
|
|
242
|
-
name: string;
|
|
243
|
-
provisioner: import("@neon/sdk").Provisioner;
|
|
244
|
-
default_endpoint_settings?: {
|
|
245
|
-
pg_settings?: {
|
|
246
|
-
[x: string]: string;
|
|
247
|
-
} | null | undefined;
|
|
248
|
-
pgbouncer_settings?: {
|
|
249
|
-
[x: string]: string;
|
|
250
|
-
} | null | undefined;
|
|
251
|
-
autoscaling_limit_min_cu?: number | null | undefined;
|
|
252
|
-
autoscaling_limit_max_cu?: number | null | undefined;
|
|
253
|
-
suspend_timeout_seconds?: number | null | undefined;
|
|
254
|
-
} | null | undefined;
|
|
255
|
-
settings?: {
|
|
256
|
-
quota?: {
|
|
257
|
-
active_time_seconds?: number | null | undefined;
|
|
258
|
-
compute_time_seconds?: number | null | undefined;
|
|
259
|
-
written_data_bytes?: number | null | undefined;
|
|
260
|
-
data_transfer_bytes?: number | null | undefined;
|
|
261
|
-
logical_size_bytes?: number | null | undefined;
|
|
262
|
-
} | null | undefined;
|
|
263
|
-
allowed_ips?: {
|
|
264
|
-
ips?: string[] | null | undefined;
|
|
265
|
-
protected_branches_only?: boolean | null | undefined;
|
|
266
|
-
} | null | undefined;
|
|
267
|
-
enable_logical_replication?: boolean | null | undefined;
|
|
268
|
-
maintenance_window?: {
|
|
269
|
-
weekdays: number[];
|
|
270
|
-
start_time: string;
|
|
271
|
-
end_time: string;
|
|
272
|
-
} | null | undefined;
|
|
273
|
-
block_public_connections?: boolean | null | undefined;
|
|
274
|
-
block_vpc_connections?: boolean | null | undefined;
|
|
275
|
-
audit_log_level?: import("@neon/sdk").ProjectAuditLogLevel | null | undefined;
|
|
276
|
-
hipaa?: boolean | null | undefined;
|
|
277
|
-
preload_libraries?: {
|
|
278
|
-
use_defaults?: boolean | null | undefined;
|
|
279
|
-
enabled_libraries?: string[] | null | undefined;
|
|
280
|
-
} | null | undefined;
|
|
281
|
-
} | null | undefined;
|
|
282
|
-
pg_version: import("@neon/sdk").PgVersion;
|
|
283
|
-
proxy_host: string;
|
|
284
|
-
branch_logical_size_limit: number;
|
|
285
|
-
branch_logical_size_limit_bytes: number;
|
|
286
|
-
store_passwords: boolean;
|
|
287
|
-
maintenance_starts_at?: string | null | undefined;
|
|
288
|
-
creation_source: string;
|
|
289
|
-
history_retention_seconds: number;
|
|
290
|
-
created_at: string;
|
|
291
|
-
updated_at: string;
|
|
292
|
-
synthetic_storage_size?: number | null | undefined;
|
|
293
|
-
consumption_period_start: string;
|
|
294
|
-
consumption_period_end: string;
|
|
295
|
-
quota_reset_at?: string | null | undefined;
|
|
296
|
-
owner_id: string;
|
|
297
|
-
owner?: {
|
|
298
|
-
email: string;
|
|
299
|
-
name: string;
|
|
300
|
-
branches_limit: number;
|
|
301
|
-
subscription_type: import("@neon/sdk").BillingSubscriptionType;
|
|
302
|
-
} | null | undefined;
|
|
303
|
-
compute_last_active_at?: string | null | undefined;
|
|
304
|
-
org_id?: string | null | undefined;
|
|
305
|
-
maintenance_scheduled_for?: string | null | undefined;
|
|
306
|
-
hipaa_enabled_at?: string | null | undefined;
|
|
307
|
-
effective_project_permission?: (import("@neon/sdk").ProjectPermissionLevel | null) | undefined;
|
|
308
|
-
};
|
|
309
|
-
connectionString: string;
|
|
310
|
-
}>;
|
|
311
|
-
};
|
|
312
|
-
export type WorkflowFactories = typeof workflowFactories;
|
|
313
|
-
export declare const isNeonWorkflowId: (id: string) => id is NeonWorkflowId;
|
|
314
|
-
export declare const workflowFactoryFor: (workflowId: NeonWorkflowId) => WorkflowFactories[NeonWorkflowId];
|
|
315
|
-
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/lib/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAEN,KAAK,oBAAoB,EAEzB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAEX,QAAQ,EAER,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,qBAAqB;IACrC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;CAC1B;AAkBD,eAAO,MAAM,kCAAkC;;;;;;;;;;kBAY7C,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAG7C,CAAC;AAEH,eAAO,MAAM,WAAW,iEAGd,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAkI1D,eAAO,MAAM,iBAAiB;uCA1EgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCA6CrB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgClE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,KAAG,EAAE,IAAI,cACJ,CAAC;AAEjD,eAAO,MAAM,kBAAkB,GAC9B,YAAY,cAAc,KACxB,iBAAiB,CAAC,cAAc,CAQlC,CAAC"}
|
package/dist/lib/workflows.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { missingBearerCredential, requireBearerCredential } from "./auth.js";
|
|
2
|
-
import { zBranchCreateRequest, zComputeUnit, zCreateProjectBody, zCreateProjectBranchPath, zSuspendTimeoutSeconds } from "../generated/zod.gen.js";
|
|
3
|
-
import { toToolResult } from "./result.js";
|
|
4
|
-
import { createNeonClient } from "@neon/sdk";
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
//#region src/lib/workflows.ts
|
|
7
|
-
const branchCreateFields = zBranchCreateRequest.shape.branch.unwrap().shape;
|
|
8
|
-
const projectCreateFields = zCreateProjectBody.shape.project.shape;
|
|
9
|
-
const writeAnnotations = {
|
|
10
|
-
readOnlyHint: false,
|
|
11
|
-
destructiveHint: true,
|
|
12
|
-
openWorldHint: true
|
|
13
|
-
};
|
|
14
|
-
const pooledField = z.boolean().describe("Return a pooled connection string. Default true. Set false for a direct connection.").optional();
|
|
15
|
-
const createBranchWithComputeInputSchema = z.strictObject({
|
|
16
|
-
project_id: zCreateProjectBranchPath.shape.project_id,
|
|
17
|
-
name: branchCreateFields.name,
|
|
18
|
-
parent_id: branchCreateFields.parent_id,
|
|
19
|
-
compute: z.strictObject({
|
|
20
|
-
min_cu: zComputeUnit.optional(),
|
|
21
|
-
max_cu: zComputeUnit.optional(),
|
|
22
|
-
suspend_timeout_seconds: zSuspendTimeoutSeconds.optional()
|
|
23
|
-
}).optional(),
|
|
24
|
-
pooled: pooledField
|
|
25
|
-
});
|
|
26
|
-
const createProjectAndConnectInputSchema = z.strictObject({
|
|
27
|
-
...projectCreateFields,
|
|
28
|
-
pooled: pooledField
|
|
29
|
-
});
|
|
30
|
-
const workflowIds = ["createBranchWithCompute", "createProjectAndConnect"];
|
|
31
|
-
const resolveApiKey = (options, context) => {
|
|
32
|
-
if (context !== void 0 && "apiKey" in context) {
|
|
33
|
-
if (context.apiKey === void 0) throw new TypeError("A Neon API key or OAuth access token is required");
|
|
34
|
-
return requireBearerCredential(context.apiKey);
|
|
35
|
-
}
|
|
36
|
-
return options.apiKey === void 0 ? missingBearerCredential : requireBearerCredential(options.apiKey);
|
|
37
|
-
};
|
|
38
|
-
const workflowClient = (options, context) => createNeonClient({
|
|
39
|
-
apiKey: resolveApiKey(options, context),
|
|
40
|
-
throwOnError: true,
|
|
41
|
-
...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
|
|
42
|
-
...options.fetch === void 0 ? {} : { fetch: options.fetch },
|
|
43
|
-
...options.wait === void 0 ? {} : { wait: options.wait }
|
|
44
|
-
});
|
|
45
|
-
const bindWorkflow = (options, tool, run) => ({
|
|
46
|
-
...tool,
|
|
47
|
-
async execute(input, context) {
|
|
48
|
-
const parsed = await tool.inputSchema.parseAsync(input);
|
|
49
|
-
const result = await run(workflowClient(options, context), parsed, context?.signal);
|
|
50
|
-
return toToolResult(result);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const createBranchWithComputeTool = (options) => bindWorkflow(options, {
|
|
54
|
-
operationId: "createBranchWithCompute",
|
|
55
|
-
id: "create_branch_with_compute",
|
|
56
|
-
title: "Create branch with compute",
|
|
57
|
-
description: "Create a branch with a read-write endpoint and return its connection string. Use this instead of create_project_branch when the next step needs to connect: create_project_branch omits compute unless you pass endpoints, and it does not wait or return a connection string. The call waits until the compute is ready, up to five minutes by default.",
|
|
58
|
-
inputSchema: createBranchWithComputeInputSchema,
|
|
59
|
-
annotations: writeAnnotations,
|
|
60
|
-
requiresApproval: true,
|
|
61
|
-
metadata: {
|
|
62
|
-
method: "POST",
|
|
63
|
-
path: "/projects/{project_id}/branches",
|
|
64
|
-
stability: "stable",
|
|
65
|
-
deprecated: false,
|
|
66
|
-
tags: ["Branch"]
|
|
67
|
-
}
|
|
68
|
-
}, (neon, input, signal) => neon.branches.createWithCompute(input.project_id, {
|
|
69
|
-
name: input.name,
|
|
70
|
-
parentId: input.parent_id,
|
|
71
|
-
compute: input.compute === void 0 ? void 0 : {
|
|
72
|
-
minCu: input.compute.min_cu,
|
|
73
|
-
maxCu: input.compute.max_cu,
|
|
74
|
-
suspendTimeoutSeconds: input.compute.suspend_timeout_seconds
|
|
75
|
-
}
|
|
76
|
-
}, {
|
|
77
|
-
signal,
|
|
78
|
-
...input.pooled === void 0 ? {} : { pooled: input.pooled }
|
|
79
|
-
}));
|
|
80
|
-
const createProjectAndConnectTool = (options) => bindWorkflow(options, {
|
|
81
|
-
operationId: "createProjectAndConnect",
|
|
82
|
-
id: "create_project_and_connect",
|
|
83
|
-
title: "Create project and connect",
|
|
84
|
-
description: "Create a project and return a connection string to its default branch. Use this instead of create_project when the next step needs to connect. The call waits until the default compute is ready, up to five minutes by default.",
|
|
85
|
-
inputSchema: createProjectAndConnectInputSchema,
|
|
86
|
-
annotations: writeAnnotations,
|
|
87
|
-
requiresApproval: true,
|
|
88
|
-
metadata: {
|
|
89
|
-
method: "POST",
|
|
90
|
-
path: "/projects",
|
|
91
|
-
stability: "stable",
|
|
92
|
-
deprecated: false,
|
|
93
|
-
tags: ["Project"]
|
|
94
|
-
}
|
|
95
|
-
}, (neon, input, signal) => {
|
|
96
|
-
const { pooled, ...project } = input;
|
|
97
|
-
return neon.projects.createAndConnect(project, {
|
|
98
|
-
signal,
|
|
99
|
-
...pooled === void 0 ? {} : { pooled }
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
const workflowFactories = {
|
|
103
|
-
createBranchWithCompute: createBranchWithComputeTool,
|
|
104
|
-
createProjectAndConnect: createProjectAndConnectTool
|
|
105
|
-
};
|
|
106
|
-
const isNeonWorkflowId = (id) => workflowIds.includes(id);
|
|
107
|
-
const workflowFactoryFor = (workflowId) => {
|
|
108
|
-
const knownWorkflowId = workflowIds.find((candidate) => candidate === workflowId);
|
|
109
|
-
if (knownWorkflowId === void 0) throw new TypeError(`Unknown Neon workflow "${workflowId}".`);
|
|
110
|
-
return workflowFactories[knownWorkflowId];
|
|
111
|
-
};
|
|
112
|
-
//#endregion
|
|
113
|
-
export { createBranchWithComputeInputSchema, createProjectAndConnectInputSchema, isNeonWorkflowId, workflowFactories, workflowFactoryFor, workflowIds };
|