@zeabur/ai-sdk 1.0.4 → 1.1.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/dist/core/domain.d.ts +11 -0
- package/dist/core/domain.d.ts.map +1 -0
- package/dist/core/domain.js +29 -0
- package/dist/core/domain.js.map +1 -0
- package/dist/core/git.d.ts +19 -0
- package/dist/core/git.d.ts.map +1 -0
- package/dist/core/git.js +49 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/index.d.ts +82 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +46 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/port.d.ts +18 -0
- package/dist/core/port.d.ts.map +1 -0
- package/dist/core/port.js +27 -0
- package/dist/core/port.js.map +1 -0
- package/dist/core/project.d.ts +12 -0
- package/dist/core/project.d.ts.map +1 -0
- package/dist/core/project.js +53 -0
- package/dist/core/project.js.map +1 -0
- package/dist/core/region.d.ts +8 -0
- package/dist/core/region.d.ts.map +1 -0
- package/dist/core/region.js +67 -0
- package/dist/core/region.js.map +1 -0
- package/dist/core/service.d.ts +19 -0
- package/dist/core/service.d.ts.map +1 -0
- package/dist/core/service.js +95 -0
- package/dist/core/service.js.map +1 -0
- package/dist/core/template.d.ts +7 -0
- package/dist/core/template.d.ts.map +1 -1
- package/dist/core/template.js +24 -0
- package/dist/core/template.js.map +1 -1
- package/dist/core/user.d.ts +6 -0
- package/dist/core/user.d.ts.map +1 -0
- package/dist/core/user.js +30 -0
- package/dist/core/user.js.map +1 -0
- package/package.json +14 -8
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const addDomainSchema: z.ZodObject<{
|
|
4
|
+
serviceId: z.ZodString;
|
|
5
|
+
domain: z.ZodString;
|
|
6
|
+
isGenerated: z.ZodBoolean;
|
|
7
|
+
portName: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type AddDomainInput = z.infer<typeof addDomainSchema>;
|
|
10
|
+
export declare function addDomain(args: AddDomainInput, context: ZeaburContext): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/core/domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAYlD,eAAO,MAAM,eAAe;;;;;iBAK1B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE7D,wBAAsB,SAAS,CAC7B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAajB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const ADD_DOMAIN_MUTATION = `
|
|
3
|
+
mutation AddDomain($serviceID: ObjectID!, $domain: String!, $isGenerated: Boolean!, $portName: String!) {
|
|
4
|
+
addDomain(serviceID: $serviceID, domain: $domain, isGenerated: $isGenerated, portName: $portName) {
|
|
5
|
+
_id
|
|
6
|
+
domain
|
|
7
|
+
status
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
export const addDomainSchema = z.object({
|
|
12
|
+
serviceId: z.string().describe("ID of the service to add domain to"),
|
|
13
|
+
domain: z.string().describe("Domain name. If isGenerated is true, this should be the subdomain prefix (without .zeabur.app)"),
|
|
14
|
+
isGenerated: z.boolean().describe("Whether this is a generated Zeabur domain (xxx.zeabur.app)"),
|
|
15
|
+
portName: z.string().describe("The port.id exposed on service (e.g., 'web')"),
|
|
16
|
+
});
|
|
17
|
+
export async function addDomain(args, context) {
|
|
18
|
+
const response = await context.graphql.query(ADD_DOMAIN_MUTATION, {
|
|
19
|
+
serviceID: args.serviceId,
|
|
20
|
+
domain: args.domain,
|
|
21
|
+
isGenerated: args.isGenerated,
|
|
22
|
+
portName: args.portName,
|
|
23
|
+
});
|
|
24
|
+
if (response.errors) {
|
|
25
|
+
throw new Error(JSON.stringify(response.errors));
|
|
26
|
+
}
|
|
27
|
+
return JSON.stringify(response.data);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../src/core/domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,mBAAmB,GAAG;;;;;;;;CAQ3B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACpE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gGAAgG,CAAC;IAC7H,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IAC/F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;CAC9E,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAoB,EACpB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE;QAChE,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const getRepoIdSchema: z.ZodObject<{
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type GetRepoIdInput = z.infer<typeof getRepoIdSchema>;
|
|
7
|
+
export declare function getRepoId(args: GetRepoIdInput, context: ZeaburContext): Promise<string>;
|
|
8
|
+
export declare const searchGitReposSchema: z.ZodObject<{
|
|
9
|
+
provider: z.ZodEnum<{
|
|
10
|
+
GITHUB: "GITHUB";
|
|
11
|
+
GITLAB: "GITLAB";
|
|
12
|
+
}>;
|
|
13
|
+
keyword: z.ZodOptional<z.ZodString>;
|
|
14
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
15
|
+
gitNamespaceId: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type SearchGitReposInput = z.infer<typeof searchGitReposSchema>;
|
|
18
|
+
export declare function searchGitRepos(args: SearchGitReposInput, context: ZeaburContext): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/core/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAYlD,eAAO,MAAM,eAAe;;iBAE1B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE7D,wBAAsB,SAAS,CAC7B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAUjB;AAWD,eAAO,MAAM,oBAAoB;;;;;;;;iBAK/B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE,wBAAsB,cAAc,CAClC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAajB"}
|
package/dist/core/git.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Get Repo ID from GitHub URL
|
|
3
|
+
const GET_REPO_ID_QUERY = `
|
|
4
|
+
query GetRepoId($url: String!) {
|
|
5
|
+
getRepoId(url: $url) {
|
|
6
|
+
id
|
|
7
|
+
full_name
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
export const getRepoIdSchema = z.object({
|
|
12
|
+
url: z.string().describe("Full GitHub repository URL (e.g., https://github.com/owner/repo)"),
|
|
13
|
+
});
|
|
14
|
+
export async function getRepoId(args, context) {
|
|
15
|
+
const response = await context.graphql.query(GET_REPO_ID_QUERY, {
|
|
16
|
+
url: args.url,
|
|
17
|
+
});
|
|
18
|
+
if (response.errors) {
|
|
19
|
+
throw new Error(JSON.stringify(response.errors));
|
|
20
|
+
}
|
|
21
|
+
return JSON.stringify(response.data);
|
|
22
|
+
}
|
|
23
|
+
// Search Git Repositories
|
|
24
|
+
const SEARCH_GIT_REPOS_QUERY = `
|
|
25
|
+
query SearchGitRepositories($provider: GitProvider!, $limit: Int!, $gitNamespaceId: Int, $keyword: String) {
|
|
26
|
+
searchGitRepositories(provider: $provider, Limit: $limit, gitNamespaceID: $gitNamespaceId, keyword: $keyword) {
|
|
27
|
+
id
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
export const searchGitReposSchema = z.object({
|
|
32
|
+
provider: z.enum(["GITHUB", "GITLAB"]).describe("Git provider"),
|
|
33
|
+
keyword: z.string().optional().describe("Search keyword (usually the repo name)"),
|
|
34
|
+
limit: z.number().optional().default(10).describe("Maximum number of results"),
|
|
35
|
+
gitNamespaceId: z.number().optional().describe("Git namespace ID (optional)"),
|
|
36
|
+
});
|
|
37
|
+
export async function searchGitRepos(args, context) {
|
|
38
|
+
const response = await context.graphql.query(SEARCH_GIT_REPOS_QUERY, {
|
|
39
|
+
provider: args.provider,
|
|
40
|
+
limit: args.limit || 10,
|
|
41
|
+
gitNamespaceId: args.gitNamespaceId,
|
|
42
|
+
keyword: args.keyword,
|
|
43
|
+
});
|
|
44
|
+
if (response.errors) {
|
|
45
|
+
throw new Error(JSON.stringify(response.errors));
|
|
46
|
+
}
|
|
47
|
+
return JSON.stringify(response.data);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/core/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,8BAA8B;AAC9B,MAAM,iBAAiB,GAAG;;;;;;;CAOzB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC;CAC7F,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAoB,EACpB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE;QAC9D,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,K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S,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ export * from "./graphql.js";
|
|
|
4
4
|
export * from "./logs.js";
|
|
5
5
|
export * from "./template.js";
|
|
6
6
|
export * from "./render.js";
|
|
7
|
+
export * from "./project.js";
|
|
8
|
+
export * from "./region.js";
|
|
9
|
+
export * from "./service.js";
|
|
10
|
+
export * from "./port.js";
|
|
11
|
+
export * from "./domain.js";
|
|
12
|
+
export * from "./user.js";
|
|
13
|
+
export * from "./git.js";
|
|
7
14
|
export * from "../types/index.js";
|
|
8
15
|
export { deployFromSpecification, deployFromSpecificationSchema } from "./deploy.js";
|
|
9
16
|
export type { DeployFromSpecificationInput } from "./deploy.js";
|
|
@@ -12,8 +19,15 @@ import { deployFromSpecification } from "./deploy.js";
|
|
|
12
19
|
import { decideFilesystem, listFiles, readFile, fileDirRead } from "./files.js";
|
|
13
20
|
import { executeGraphql } from "./graphql.js";
|
|
14
21
|
import { getBuildLogs, getRuntimeLogs, getDeployments } from "./logs.js";
|
|
15
|
-
import { searchTemplate } from "./template.js";
|
|
22
|
+
import { searchTemplate, deployTemplate } from "./template.js";
|
|
16
23
|
import { renderRegionSelector, renderProjectSelector, renderServiceCard, renderDockerfile, renderRecommendation, renderFloatingButton } from "./render.js";
|
|
24
|
+
import { listProjects, createProject } from "./project.js";
|
|
25
|
+
import { listRegions } from "./region.js";
|
|
26
|
+
import { listServices, getService, createService } from "./service.js";
|
|
27
|
+
import { updateServicePorts } from "./port.js";
|
|
28
|
+
import { addDomain } from "./domain.js";
|
|
29
|
+
import { getMe } from "./user.js";
|
|
30
|
+
import { getRepoId, searchGitRepos } from "./git.js";
|
|
17
31
|
export declare const zeaburTools: {
|
|
18
32
|
executeCommand: typeof executeCommand;
|
|
19
33
|
deployFromSpecification: typeof deployFromSpecification;
|
|
@@ -26,6 +40,18 @@ export declare const zeaburTools: {
|
|
|
26
40
|
getRuntimeLogs: typeof getRuntimeLogs;
|
|
27
41
|
getDeployments: typeof getDeployments;
|
|
28
42
|
searchTemplate: typeof searchTemplate;
|
|
43
|
+
deployTemplate: typeof deployTemplate;
|
|
44
|
+
listProjects: typeof listProjects;
|
|
45
|
+
createProject: typeof createProject;
|
|
46
|
+
listRegions: typeof listRegions;
|
|
47
|
+
listServices: typeof listServices;
|
|
48
|
+
getService: typeof getService;
|
|
49
|
+
createService: typeof createService;
|
|
50
|
+
updateServicePorts: typeof updateServicePorts;
|
|
51
|
+
addDomain: typeof addDomain;
|
|
52
|
+
getMe: typeof getMe;
|
|
53
|
+
getRepoId: typeof getRepoId;
|
|
54
|
+
searchGitRepos: typeof searchGitRepos;
|
|
29
55
|
renderRegionSelector: typeof renderRegionSelector;
|
|
30
56
|
renderProjectSelector: typeof renderProjectSelector;
|
|
31
57
|
renderServiceCard: typeof renderServiceCard;
|
|
@@ -117,6 +143,61 @@ export declare const zeaburSchemas: {
|
|
|
117
143
|
searchTemplateSchema: import("zod").ZodObject<{
|
|
118
144
|
query: import("zod").ZodString;
|
|
119
145
|
}, import("zod/v4/core").$strip>;
|
|
146
|
+
deployTemplateSchema: import("zod").ZodObject<{
|
|
147
|
+
code: import("zod").ZodString;
|
|
148
|
+
variables: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
149
|
+
projectId: import("zod").ZodString;
|
|
150
|
+
}, import("zod/v4/core").$strip>;
|
|
151
|
+
listProjectsSchema: import("zod").ZodObject<{}, import("zod/v4/core").$strip>;
|
|
152
|
+
createProjectSchema: import("zod").ZodObject<{
|
|
153
|
+
name: import("zod").ZodString;
|
|
154
|
+
region: import("zod").ZodString;
|
|
155
|
+
}, import("zod/v4/core").$strip>;
|
|
156
|
+
listRegionsSchema: import("zod").ZodObject<{
|
|
157
|
+
includeServers: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
158
|
+
}, import("zod/v4/core").$strip>;
|
|
159
|
+
listServicesSchema: import("zod").ZodObject<{
|
|
160
|
+
projectId: import("zod").ZodString;
|
|
161
|
+
}, import("zod/v4/core").$strip>;
|
|
162
|
+
getServiceSchema: import("zod").ZodObject<{
|
|
163
|
+
serviceId: import("zod").ZodString;
|
|
164
|
+
}, import("zod/v4/core").$strip>;
|
|
165
|
+
createServiceSchema: import("zod").ZodObject<{
|
|
166
|
+
name: import("zod").ZodString;
|
|
167
|
+
projectId: import("zod").ZodString;
|
|
168
|
+
}, import("zod/v4/core").$strip>;
|
|
169
|
+
updateServicePortsSchema: import("zod").ZodObject<{
|
|
170
|
+
serviceId: import("zod").ZodString;
|
|
171
|
+
environmentId: import("zod").ZodString;
|
|
172
|
+
ports: import("zod").ZodArray<import("zod").ZodObject<{
|
|
173
|
+
id: import("zod").ZodString;
|
|
174
|
+
port: import("zod").ZodNumber;
|
|
175
|
+
type: import("zod").ZodEnum<{
|
|
176
|
+
HTTP: "HTTP";
|
|
177
|
+
TCP: "TCP";
|
|
178
|
+
UDP: "UDP";
|
|
179
|
+
}>;
|
|
180
|
+
}, import("zod/v4/core").$strip>>;
|
|
181
|
+
}, import("zod/v4/core").$strip>;
|
|
182
|
+
addDomainSchema: import("zod").ZodObject<{
|
|
183
|
+
serviceId: import("zod").ZodString;
|
|
184
|
+
domain: import("zod").ZodString;
|
|
185
|
+
isGenerated: import("zod").ZodBoolean;
|
|
186
|
+
portName: import("zod").ZodString;
|
|
187
|
+
}, import("zod/v4/core").$strip>;
|
|
188
|
+
getMeSchema: import("zod").ZodObject<{}, import("zod/v4/core").$strip>;
|
|
189
|
+
getRepoIdSchema: import("zod").ZodObject<{
|
|
190
|
+
url: import("zod").ZodString;
|
|
191
|
+
}, import("zod/v4/core").$strip>;
|
|
192
|
+
searchGitReposSchema: import("zod").ZodObject<{
|
|
193
|
+
provider: import("zod").ZodEnum<{
|
|
194
|
+
GITHUB: "GITHUB";
|
|
195
|
+
GITLAB: "GITLAB";
|
|
196
|
+
}>;
|
|
197
|
+
keyword: import("zod").ZodOptional<import("zod").ZodString>;
|
|
198
|
+
limit: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
|
|
199
|
+
gitNamespaceId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
200
|
+
}, import("zod/v4/core").$strip>;
|
|
120
201
|
renderRegionSelectorSchema: import("zod").ZodObject<{
|
|
121
202
|
showServers: import("zod").ZodBoolean;
|
|
122
203
|
}, import("zod/v4/core").$strip>;
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,EACL,cAAc,EAGf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,uBAAuB,EAGxB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,WAAW,EASZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,cAAc,EAGf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EAOf,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,cAAc,EAEd,cAAc,EAIf,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EAarB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EAEZ,aAAa,EAId,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,WAAW,EAGZ,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EAEZ,UAAU,EAEV,aAAa,EAKd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAGnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,SAAS,EAGV,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,EAGN,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,SAAS,EAET,cAAc,EAIf,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDvB,CAAC;AAGF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BzB,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -5,6 +5,13 @@ export * from "./graphql.js";
|
|
|
5
5
|
export * from "./logs.js";
|
|
6
6
|
export * from "./template.js";
|
|
7
7
|
export * from "./render.js";
|
|
8
|
+
export * from "./project.js";
|
|
9
|
+
export * from "./region.js";
|
|
10
|
+
export * from "./service.js";
|
|
11
|
+
export * from "./port.js";
|
|
12
|
+
export * from "./domain.js";
|
|
13
|
+
export * from "./user.js";
|
|
14
|
+
export * from "./git.js";
|
|
8
15
|
// Re-export types for convenience
|
|
9
16
|
export * from "../types/index.js";
|
|
10
17
|
// Deploy needs special handling due to type conflicts
|
|
@@ -15,8 +22,15 @@ import { deployFromSpecification, deployFromSpecificationSchema } from "./deploy
|
|
|
15
22
|
import { decideFilesystem, listFiles, readFile, fileDirRead, decideFilesystemSchema, listFilesSchema, readFileSchema, fileDirReadSchema } from "./files.js";
|
|
16
23
|
import { executeGraphql, executeGraphqlSchema } from "./graphql.js";
|
|
17
24
|
import { getBuildLogs, getRuntimeLogs, getDeployments, getBuildLogsSchema, getRuntimeLogsSchema, getDeploymentsSchema } from "./logs.js";
|
|
18
|
-
import { searchTemplate, searchTemplateSchema } from "./template.js";
|
|
25
|
+
import { searchTemplate, searchTemplateSchema, deployTemplate, deployTemplateSchema } from "./template.js";
|
|
19
26
|
import { renderRegionSelector, renderProjectSelector, renderServiceCard, renderDockerfile, renderRecommendation, renderFloatingButton, renderRegionSelectorSchema, renderProjectSelectorSchema, renderServiceCardSchema, renderDockerfileSchema, renderRecommendationSchema, renderFloatingButtonSchema } from "./render.js";
|
|
27
|
+
import { listProjects, listProjectsSchema, createProject, createProjectSchema } from "./project.js";
|
|
28
|
+
import { listRegions, listRegionsSchema } from "./region.js";
|
|
29
|
+
import { listServices, listServicesSchema, getService, getServiceSchema, createService, createServiceSchema } from "./service.js";
|
|
30
|
+
import { updateServicePorts, updateServicePortsSchema } from "./port.js";
|
|
31
|
+
import { addDomain, addDomainSchema } from "./domain.js";
|
|
32
|
+
import { getMe, getMeSchema } from "./user.js";
|
|
33
|
+
import { getRepoId, getRepoIdSchema, searchGitRepos, searchGitReposSchema } from "./git.js";
|
|
20
34
|
// Collection of all tools for easy access
|
|
21
35
|
export const zeaburTools = {
|
|
22
36
|
// Core functionality
|
|
@@ -34,6 +48,25 @@ export const zeaburTools = {
|
|
|
34
48
|
getDeployments,
|
|
35
49
|
// Templates
|
|
36
50
|
searchTemplate,
|
|
51
|
+
deployTemplate,
|
|
52
|
+
// Projects
|
|
53
|
+
listProjects,
|
|
54
|
+
createProject,
|
|
55
|
+
// Regions
|
|
56
|
+
listRegions,
|
|
57
|
+
// Services
|
|
58
|
+
listServices,
|
|
59
|
+
getService,
|
|
60
|
+
createService,
|
|
61
|
+
// Ports
|
|
62
|
+
updateServicePorts,
|
|
63
|
+
// Domains
|
|
64
|
+
addDomain,
|
|
65
|
+
// User
|
|
66
|
+
getMe,
|
|
67
|
+
// Git
|
|
68
|
+
getRepoId,
|
|
69
|
+
searchGitRepos,
|
|
37
70
|
// UI Rendering
|
|
38
71
|
renderRegionSelector,
|
|
39
72
|
renderProjectSelector,
|
|
@@ -55,6 +88,18 @@ export const zeaburSchemas = {
|
|
|
55
88
|
getRuntimeLogsSchema,
|
|
56
89
|
getDeploymentsSchema,
|
|
57
90
|
searchTemplateSchema,
|
|
91
|
+
deployTemplateSchema,
|
|
92
|
+
listProjectsSchema,
|
|
93
|
+
createProjectSchema,
|
|
94
|
+
listRegionsSchema,
|
|
95
|
+
listServicesSchema,
|
|
96
|
+
getServiceSchema,
|
|
97
|
+
createServiceSchema,
|
|
98
|
+
updateServicePortsSchema,
|
|
99
|
+
addDomainSchema,
|
|
100
|
+
getMeSchema,
|
|
101
|
+
getRepoIdSchema,
|
|
102
|
+
searchGitReposSchema,
|
|
58
103
|
renderRegionSelectorSchema,
|
|
59
104
|
renderProjectSelectorSchema,
|
|
60
105
|
renderServiceCardSchema,
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW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MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,oBAAoB;IACpB,6BAA6B;IAC7B,oBAAoB;IACpB,sBAAsB;IACtB,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,kBAAkB;IAClB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,wBAAwB;IACxB,eAAe;IACf,WAAW;IACX,eAAe;IACf,oBAAoB;IACpB,0BAA0B;IAC1B,2BAA2B;IAC3B,uBAAuB;IACvB,sBAAsB;IACtB,0BAA0B;IAC1B,0BAA0B;CAC3B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const updateServicePortsSchema: z.ZodObject<{
|
|
4
|
+
serviceId: z.ZodString;
|
|
5
|
+
environmentId: z.ZodString;
|
|
6
|
+
ports: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
port: z.ZodNumber;
|
|
9
|
+
type: z.ZodEnum<{
|
|
10
|
+
HTTP: "HTTP";
|
|
11
|
+
TCP: "TCP";
|
|
12
|
+
UDP: "UDP";
|
|
13
|
+
}>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type UpdateServicePortsInput = z.infer<typeof updateServicePortsSchema>;
|
|
17
|
+
export declare function updateServicePorts(args: UpdateServicePortsInput, context: ZeaburContext): Promise<string>;
|
|
18
|
+
//# sourceMappingURL=port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/core/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQlD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;iBAQnC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE/E,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,uBAAuB,EAC7B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const UPDATE_SERVICE_PORTS_MUTATION = `
|
|
3
|
+
mutation UpdateServicePorts($serviceID: ObjectID!, $environmentID: ObjectID!, $ports: [ServiceSpecPortInput!]!) {
|
|
4
|
+
updateServicePorts(serviceID: $serviceID, environmentID: $environmentID, ports: $ports)
|
|
5
|
+
}
|
|
6
|
+
`;
|
|
7
|
+
export const updateServicePortsSchema = z.object({
|
|
8
|
+
serviceId: z.string().describe("ID of the service to update ports for"),
|
|
9
|
+
environmentId: z.string().describe("ID of the environment"),
|
|
10
|
+
ports: z.array(z.object({
|
|
11
|
+
id: z.string().describe("Port identifier (e.g., 'web')"),
|
|
12
|
+
port: z.number().describe("Port number (e.g., 8080)"),
|
|
13
|
+
type: z.enum(["HTTP", "TCP", "UDP"]).describe("Port type"),
|
|
14
|
+
})).describe("Array of ports to set. This will replace all existing ports."),
|
|
15
|
+
});
|
|
16
|
+
export async function updateServicePorts(args, context) {
|
|
17
|
+
const response = await context.graphql.query(UPDATE_SERVICE_PORTS_MUTATION, {
|
|
18
|
+
serviceID: args.serviceId,
|
|
19
|
+
environmentID: args.environmentId,
|
|
20
|
+
ports: args.ports,
|
|
21
|
+
});
|
|
22
|
+
if (response.errors) {
|
|
23
|
+
throw new Error(JSON.stringify(response.errors));
|
|
24
|
+
}
|
|
25
|
+
return JSON.stringify(response.data);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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C,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const listProjectsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
4
|
+
export type ListProjectsInput = z.infer<typeof listProjectsSchema>;
|
|
5
|
+
export declare function listProjects(_args: ListProjectsInput, context: ZeaburContext): Promise<string>;
|
|
6
|
+
export declare const createProjectSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
region: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type CreateProjectInput = z.infer<typeof createProjectSchema>;
|
|
11
|
+
export declare function createProject(args: CreateProjectInput, context: ZeaburContext): Promise<string>;
|
|
12
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAwBlD,eAAO,MAAM,kBAAkB,gCAAe,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAWD,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,wBAAsB,aAAa,CACjC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAWjB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// List Projects
|
|
3
|
+
const LIST_PROJECTS_QUERY = `
|
|
4
|
+
query ListProjects {
|
|
5
|
+
projects {
|
|
6
|
+
edges {
|
|
7
|
+
node {
|
|
8
|
+
_id
|
|
9
|
+
name
|
|
10
|
+
region {
|
|
11
|
+
code
|
|
12
|
+
name
|
|
13
|
+
}
|
|
14
|
+
environments {
|
|
15
|
+
_id
|
|
16
|
+
name
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
export const listProjectsSchema = z.object({});
|
|
24
|
+
export async function listProjects(_args, context) {
|
|
25
|
+
const response = await context.graphql.query(LIST_PROJECTS_QUERY);
|
|
26
|
+
if (response.errors) {
|
|
27
|
+
throw new Error(JSON.stringify(response.errors));
|
|
28
|
+
}
|
|
29
|
+
return JSON.stringify(response.data);
|
|
30
|
+
}
|
|
31
|
+
// Create Project
|
|
32
|
+
const CREATE_PROJECT_MUTATION = `
|
|
33
|
+
mutation CreateProject($name: String!, $region: String!) {
|
|
34
|
+
createProject(name: $name, region: $region) {
|
|
35
|
+
_id
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
export const createProjectSchema = z.object({
|
|
40
|
+
name: z.string().describe("Name of the project (alphanumeric, 4-16 chars, hyphens allowed, must start with letter)"),
|
|
41
|
+
region: z.string().describe("Region code for the project. Use 'listRegions' to get available regions. For dedicated servers, use 'server-{SERVER_ID}' format."),
|
|
42
|
+
});
|
|
43
|
+
export async function createProject(args, context) {
|
|
44
|
+
const response = await context.graphql.query(CREATE_PROJECT_MUTATION, {
|
|
45
|
+
name: args.name,
|
|
46
|
+
region: args.region,
|
|
47
|
+
});
|
|
48
|
+
if (response.errors) {
|
|
49
|
+
throw new Error(JSON.stringify(response.errors));
|
|
50
|
+
}
|
|
51
|
+
return JSON.stringify(response.data);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,gBAAgB;AAChB,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;CAmB3B,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAI/C,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAwB,EACxB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAElE,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,iBAAiB;AACjB,MAAM,uBAAuB,GAAG;;;;;;CAM/B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yFAAyF,CAAC;IACpH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kIAAkI,CAAC;CAChK,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAwB,EACxB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE;QACpE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const listRegionsSchema: z.ZodObject<{
|
|
4
|
+
includeServers: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type ListRegionsInput = z.infer<typeof listRegionsSchema>;
|
|
7
|
+
export declare function listRegions(args: ListRegionsInput, context: ZeaburContext): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=region.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../../src/core/region.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAiDlD,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE,wBAAsB,WAAW,CAC/B,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAsBjB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const LIST_REGIONS_QUERY = `
|
|
3
|
+
query ListRegions {
|
|
4
|
+
regions {
|
|
5
|
+
id
|
|
6
|
+
code
|
|
7
|
+
name
|
|
8
|
+
description
|
|
9
|
+
available
|
|
10
|
+
continent
|
|
11
|
+
country
|
|
12
|
+
city
|
|
13
|
+
providerInfo {
|
|
14
|
+
name
|
|
15
|
+
code
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const LIST_SERVERS_QUERY = `
|
|
21
|
+
query ListServers {
|
|
22
|
+
servers {
|
|
23
|
+
_id
|
|
24
|
+
name
|
|
25
|
+
ip
|
|
26
|
+
status {
|
|
27
|
+
isOnline
|
|
28
|
+
totalCPU
|
|
29
|
+
usedCPU
|
|
30
|
+
totalMemory
|
|
31
|
+
usedMemory
|
|
32
|
+
vmStatus
|
|
33
|
+
}
|
|
34
|
+
providerInfo {
|
|
35
|
+
name
|
|
36
|
+
code
|
|
37
|
+
}
|
|
38
|
+
country
|
|
39
|
+
city
|
|
40
|
+
continent
|
|
41
|
+
createdAt
|
|
42
|
+
isManaged
|
|
43
|
+
expiresAt
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
export const listRegionsSchema = z.object({
|
|
48
|
+
includeServers: z.boolean().optional().describe("Whether to include dedicated servers in the result"),
|
|
49
|
+
});
|
|
50
|
+
export async function listRegions(args, context) {
|
|
51
|
+
const regionsResponse = await context.graphql.query(LIST_REGIONS_QUERY);
|
|
52
|
+
if (regionsResponse.errors) {
|
|
53
|
+
throw new Error(JSON.stringify(regionsResponse.errors));
|
|
54
|
+
}
|
|
55
|
+
const result = {
|
|
56
|
+
regions: regionsResponse.data.regions,
|
|
57
|
+
};
|
|
58
|
+
if (args.includeServers) {
|
|
59
|
+
const serversResponse = await context.graphql.query(LIST_SERVERS_QUERY);
|
|
60
|
+
if (serversResponse.errors) {
|
|
61
|
+
throw new Error(JSON.stringify(serversResponse.errors));
|
|
62
|
+
}
|
|
63
|
+
result.servers = serversResponse.data.servers;
|
|
64
|
+
}
|
|
65
|
+
return JSON.stringify(result);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=region.js.map
|
|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AAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const listServicesSchema: z.ZodObject<{
|
|
4
|
+
projectId: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type ListServicesInput = z.infer<typeof listServicesSchema>;
|
|
7
|
+
export declare function listServices(args: ListServicesInput, context: ZeaburContext): Promise<string>;
|
|
8
|
+
export declare const getServiceSchema: z.ZodObject<{
|
|
9
|
+
serviceId: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type GetServiceInput = z.infer<typeof getServiceSchema>;
|
|
12
|
+
export declare function getService(args: GetServiceInput, context: ZeaburContext): Promise<string>;
|
|
13
|
+
export declare const createServiceSchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
projectId: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type CreateServiceInput = z.infer<typeof createServiceSchema>;
|
|
18
|
+
export declare function createService(args: CreateServiceInput, context: ZeaburContext): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/core/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAmBlD,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,wBAAsB,YAAY,CAChC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAUjB;AAkCD,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/D,wBAAsB,UAAU,CAC9B,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAUjB;AAWD,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,wBAAsB,aAAa,CACjC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAWjB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// List Services
|
|
3
|
+
const LIST_SERVICES_QUERY = `
|
|
4
|
+
query ListServices($projectID: ObjectID!) {
|
|
5
|
+
services(projectID: $projectID) {
|
|
6
|
+
edges {
|
|
7
|
+
node {
|
|
8
|
+
_id
|
|
9
|
+
name
|
|
10
|
+
template
|
|
11
|
+
createdAt
|
|
12
|
+
status
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const listServicesSchema = z.object({
|
|
19
|
+
projectId: z.string().describe("ID of the project to list services from"),
|
|
20
|
+
});
|
|
21
|
+
export async function listServices(args, context) {
|
|
22
|
+
const response = await context.graphql.query(LIST_SERVICES_QUERY, {
|
|
23
|
+
projectID: args.projectId,
|
|
24
|
+
});
|
|
25
|
+
if (response.errors) {
|
|
26
|
+
throw new Error(JSON.stringify(response.errors));
|
|
27
|
+
}
|
|
28
|
+
return JSON.stringify(response.data);
|
|
29
|
+
}
|
|
30
|
+
// Get Service
|
|
31
|
+
const GET_SERVICE_QUERY = `
|
|
32
|
+
query GetService($id: ObjectID!) {
|
|
33
|
+
service(_id: $id) {
|
|
34
|
+
_id
|
|
35
|
+
name
|
|
36
|
+
template
|
|
37
|
+
createdAt
|
|
38
|
+
status
|
|
39
|
+
domains {
|
|
40
|
+
_id
|
|
41
|
+
domain
|
|
42
|
+
status
|
|
43
|
+
isGenerated
|
|
44
|
+
portName
|
|
45
|
+
}
|
|
46
|
+
spec {
|
|
47
|
+
source {
|
|
48
|
+
dockerfile
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
deployments {
|
|
52
|
+
_id
|
|
53
|
+
status
|
|
54
|
+
createdAt
|
|
55
|
+
startedAt
|
|
56
|
+
finishedAt
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
export const getServiceSchema = z.object({
|
|
62
|
+
serviceId: z.string().describe("ID of the service to get"),
|
|
63
|
+
});
|
|
64
|
+
export async function getService(args, context) {
|
|
65
|
+
const response = await context.graphql.query(GET_SERVICE_QUERY, {
|
|
66
|
+
id: args.serviceId,
|
|
67
|
+
});
|
|
68
|
+
if (response.errors) {
|
|
69
|
+
throw new Error(JSON.stringify(response.errors));
|
|
70
|
+
}
|
|
71
|
+
return JSON.stringify(response.data);
|
|
72
|
+
}
|
|
73
|
+
// Create Service
|
|
74
|
+
const CREATE_SERVICE_MUTATION = `
|
|
75
|
+
mutation CreateService($name: String!, $projectID: ObjectID!) {
|
|
76
|
+
createService(name: $name, template: PREBUILT_V2, projectID: $projectID) {
|
|
77
|
+
_id
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
export const createServiceSchema = z.object({
|
|
82
|
+
name: z.string().describe("Name of the service to create"),
|
|
83
|
+
projectId: z.string().describe("ID of the project to create the service in"),
|
|
84
|
+
});
|
|
85
|
+
export async function createService(args, context) {
|
|
86
|
+
const response = await context.graphql.query(CREATE_SERVICE_MUTATION, {
|
|
87
|
+
name: args.name,
|
|
88
|
+
projectID: args.projectId,
|
|
89
|
+
});
|
|
90
|
+
if (response.errors) {
|
|
91
|
+
throw new Error(JSON.stringify(response.errors));
|
|
92
|
+
}
|
|
93
|
+
return JSON.stringify(response.data);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/core/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,gBAAgB;AAChB,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;CAc3B,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CAC1E,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAuB,EACvB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE;QAChE,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,cAAc;AACd,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BzB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;CAC3D,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,IAAqB,EACrB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE;QAC9D,EAAE,EAAE,IAAI,CAAC,SAAS;KACnB,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,iBAAiB;AACjB,MAAM,uBAAuB,GAAG;;;;;;CAM/B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC1D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;CAC7E,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAwB,EACxB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE;QACpE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/core/template.d.ts
CHANGED
|
@@ -5,4 +5,11 @@ export declare const searchTemplateSchema: z.ZodObject<{
|
|
|
5
5
|
}, z.core.$strip>;
|
|
6
6
|
export type SearchTemplateInput = z.infer<typeof searchTemplateSchema>;
|
|
7
7
|
export declare function searchTemplate(args: SearchTemplateInput, context: ZeaburContext): Promise<string>;
|
|
8
|
+
export declare const deployTemplateSchema: z.ZodObject<{
|
|
9
|
+
code: z.ZodString;
|
|
10
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
11
|
+
projectId: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type DeployTemplateInput = z.infer<typeof deployTemplateSchema>;
|
|
14
|
+
export declare function deployTemplate(args: DeployTemplateInput, context: ZeaburContext): Promise<string>;
|
|
8
15
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/core/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA6BlD,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AA6BvE,wBAAsB,cAAc,CAClC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/core/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA6BlD,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AA6BvE,wBAAsB,cAAc,CAClC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAWD,eAAO,MAAM,oBAAoB;;;;iBAI/B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE,wBAAsB,cAAc,CAClC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
package/dist/core/template.js
CHANGED
|
@@ -39,4 +39,28 @@ export async function searchTemplate(args, context) {
|
|
|
39
39
|
template.node.description.toLowerCase().includes(query));
|
|
40
40
|
return JSON.stringify(filteredTemplates);
|
|
41
41
|
}
|
|
42
|
+
// Deploy Template
|
|
43
|
+
const DEPLOY_TEMPLATE_MUTATION = `
|
|
44
|
+
mutation DeployTemplate($code: String!, $variables: Map, $projectID: ObjectID!) {
|
|
45
|
+
deployTemplate(code: $code, variables: $variables, projectID: $projectID) {
|
|
46
|
+
_id
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
export const deployTemplateSchema = z.object({
|
|
51
|
+
code: z.string().describe("Code of the template to deploy"),
|
|
52
|
+
variables: z.record(z.string(), z.any()).optional().describe("Variables for the template. For DOMAIN type variables, provide the subdomain prefix (without .zeabur.app)"),
|
|
53
|
+
projectId: z.string().describe("ID of the project to deploy the template to"),
|
|
54
|
+
});
|
|
55
|
+
export async function deployTemplate(args, context) {
|
|
56
|
+
const response = await context.graphql.query(DEPLOY_TEMPLATE_MUTATION, {
|
|
57
|
+
code: args.code,
|
|
58
|
+
variables: args.variables || {},
|
|
59
|
+
projectID: args.projectId,
|
|
60
|
+
});
|
|
61
|
+
if (response.errors) {
|
|
62
|
+
throw new Error(JSON.stringify(response.errors));
|
|
63
|
+
}
|
|
64
|
+
return JSON.stringify(response.data);
|
|
65
|
+
}
|
|
42
66
|
//# sourceMappingURL=template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/core/template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,EAAE,CAAC,QAAQ,CAAC,2GAA2G,CAAC;IACzK,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CAC9E,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAyB,EACzB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE;QACrE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;QAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const getMeSchema: z.ZodObject<{}, z.core.$strip>;
|
|
4
|
+
export type GetMeInput = z.infer<typeof getMeSchema>;
|
|
5
|
+
export declare function getMe(_args: GetMeInput, context: ZeaburContext): Promise<string>;
|
|
6
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/core/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAuBlD,eAAO,MAAM,WAAW,gCAAe,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAErD,wBAAsB,KAAK,CACzB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,CAQjB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const GET_ME_QUERY = `
|
|
3
|
+
query GetMe {
|
|
4
|
+
me {
|
|
5
|
+
_id
|
|
6
|
+
name
|
|
7
|
+
email
|
|
8
|
+
language
|
|
9
|
+
githubID
|
|
10
|
+
discordID
|
|
11
|
+
avatarURL
|
|
12
|
+
createdAt
|
|
13
|
+
referralCode
|
|
14
|
+
username
|
|
15
|
+
credit
|
|
16
|
+
subscription {
|
|
17
|
+
plan
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const getMeSchema = z.object({});
|
|
23
|
+
export async function getMe(_args, context) {
|
|
24
|
+
const response = await context.graphql.query(GET_ME_QUERY);
|
|
25
|
+
if (response.errors) {
|
|
26
|
+
throw new Error(JSON.stringify(response.errors));
|
|
27
|
+
}
|
|
28
|
+
return JSON.stringify(response.data);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/core/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;CAmBpB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAIxC,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,KAAiB,EACjB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE3D,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeabur/ai-sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Zeabur SDK for AI agents and applications",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,20 +11,26 @@
|
|
|
11
11
|
"type-check": "tsc --noEmit",
|
|
12
12
|
"lint": "eslint src --ext .ts"
|
|
13
13
|
},
|
|
14
|
-
"keywords": [
|
|
14
|
+
"keywords": [
|
|
15
|
+
"zeabur",
|
|
16
|
+
"ai",
|
|
17
|
+
"sdk",
|
|
18
|
+
"tools",
|
|
19
|
+
"agent"
|
|
20
|
+
],
|
|
15
21
|
"author": "Zeabur",
|
|
16
22
|
"license": "MIT",
|
|
17
23
|
"dependencies": {
|
|
18
|
-
"zod": "^4.
|
|
24
|
+
"zod": "^4.2.1"
|
|
19
25
|
},
|
|
20
26
|
"devDependencies": {
|
|
21
27
|
"@types/node": "^20.0.0",
|
|
22
|
-
"typescript": "^5.0.0",
|
|
23
|
-
"tsx": "^4.0.0",
|
|
24
|
-
"eslint": "^8.0.0",
|
|
25
28
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
26
29
|
"@typescript-eslint/parser": "^6.0.0",
|
|
27
|
-
"ai": "^5.0.0"
|
|
30
|
+
"ai": "^5.0.0",
|
|
31
|
+
"eslint": "^8.0.0",
|
|
32
|
+
"tsx": "^4.0.0",
|
|
33
|
+
"typescript": "^5.0.0"
|
|
28
34
|
},
|
|
29
35
|
"peerDependencies": {
|
|
30
36
|
"ai": "^5.0.0"
|
|
@@ -40,4 +46,4 @@
|
|
|
40
46
|
"dist/**/*",
|
|
41
47
|
"README.md"
|
|
42
48
|
]
|
|
43
|
-
}
|
|
49
|
+
}
|