@zeabur/ai-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +244 -0
  2. package/dist/core/command.d.ts +18 -0
  3. package/dist/core/command.d.ts.map +1 -0
  4. package/dist/core/command.js +34 -0
  5. package/dist/core/command.js.map +1 -0
  6. package/dist/core/deploy.d.ts +175 -0
  7. package/dist/core/deploy.d.ts.map +1 -0
  8. package/dist/core/deploy.js +96 -0
  9. package/dist/core/deploy.js.map +1 -0
  10. package/dist/core/files.d.ts +94 -0
  11. package/dist/core/files.d.ts.map +1 -0
  12. package/dist/core/files.js +200 -0
  13. package/dist/core/files.js.map +1 -0
  14. package/dist/core/graphql.d.ts +15 -0
  15. package/dist/core/graphql.d.ts.map +1 -0
  16. package/dist/core/graphql.js +13 -0
  17. package/dist/core/graphql.js.map +1 -0
  18. package/dist/core/index.d.ts +411 -0
  19. package/dist/core/index.d.ts.map +1 -0
  20. package/dist/core/index.js +65 -0
  21. package/dist/core/index.js.map +1 -0
  22. package/dist/core/logs.d.ts +42 -0
  23. package/dist/core/logs.d.ts.map +1 -0
  24. package/dist/core/logs.js +76 -0
  25. package/dist/core/logs.js.map +1 -0
  26. package/dist/core/render.d.ts +81 -0
  27. package/dist/core/render.d.ts.map +1 -0
  28. package/dist/core/render.js +68 -0
  29. package/dist/core/render.js.map +1 -0
  30. package/dist/core/template.d.ts +18 -0
  31. package/dist/core/template.d.ts.map +1 -0
  32. package/dist/core/template.js +31 -0
  33. package/dist/core/template.js.map +1 -0
  34. package/dist/index.d.ts +6 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +40 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/types/index.d.ts +46 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +2 -0
  41. package/dist/types/index.js.map +1 -0
  42. package/dist/utils/context.d.ts +22 -0
  43. package/dist/utils/context.d.ts.map +1 -0
  44. package/dist/utils/context.js +37 -0
  45. package/dist/utils/context.js.map +1 -0
  46. package/dist/utils/demo.d.ts +15 -0
  47. package/dist/utils/demo.d.ts.map +1 -0
  48. package/dist/utils/demo.js +113 -0
  49. package/dist/utils/demo.js.map +1 -0
  50. package/package.json +43 -0
@@ -0,0 +1,200 @@
1
+ import { z } from "zod";
2
+ const MAX_COMMAND_RESPONSE_LENGTH = 2048;
3
+ export class UploadIdFilesystem {
4
+ graphql;
5
+ uploadId;
6
+ constructor(graphql, uploadId) {
7
+ this.graphql = graphql;
8
+ this.uploadId = uploadId;
9
+ }
10
+ async list(path) {
11
+ const query = `
12
+ query ListUploadIdFiles($uploadID: ObjectID!, $path: String) {
13
+ files(uploadID: $uploadID, path: $path)
14
+ }
15
+ `;
16
+ const response = await this.graphql.query(query, {
17
+ uploadID: this.uploadId,
18
+ path: path
19
+ });
20
+ if (response.errors) {
21
+ throw new Error(JSON.stringify(response.errors));
22
+ }
23
+ return response.data.files;
24
+ }
25
+ async read(path) {
26
+ const query = `
27
+ query ReadUploadIdFile($uploadID: ObjectID!, $path: String) {
28
+ fileContent(uploadID: $uploadID, path: $path)
29
+ }
30
+ `;
31
+ const response = await this.graphql.query(query, {
32
+ uploadID: this.uploadId,
33
+ path: path
34
+ });
35
+ if (response.errors) {
36
+ throw new Error(JSON.stringify(response.errors));
37
+ }
38
+ return response.data.fileContent;
39
+ }
40
+ }
41
+ export class GitHubFilesystem {
42
+ graphql;
43
+ repoId;
44
+ ref;
45
+ constructor(graphql, repoId, ref) {
46
+ this.graphql = graphql;
47
+ this.repoId = repoId;
48
+ this.ref = ref;
49
+ }
50
+ async list(path) {
51
+ const query = `
52
+ query ListGitHubFiles($repoID: Int!, $ref: String, $path: String) {
53
+ files(gitRef: { repoID: $repoID, ref: $ref }, path: $path)
54
+ }
55
+ `;
56
+ const response = await this.graphql.query(query, {
57
+ repoID: this.repoId,
58
+ ref: this.ref,
59
+ path: path
60
+ });
61
+ if (response.errors) {
62
+ throw new Error(JSON.stringify(response.errors));
63
+ }
64
+ return response.data.files;
65
+ }
66
+ async read(path) {
67
+ const query = `
68
+ query ReadGitHubFile($repoID: Int!, $ref: String, $path: String) {
69
+ fileContent(gitRef: { repoID: $repoID, ref: $ref }, path: $path)
70
+ }
71
+ `;
72
+ const response = await this.graphql.query(query, {
73
+ repoID: this.repoId,
74
+ ref: this.ref,
75
+ path: path
76
+ });
77
+ if (response.errors) {
78
+ throw new Error(JSON.stringify(response.errors));
79
+ }
80
+ return response.data.fileContent;
81
+ }
82
+ }
83
+ export function decideFilesystemFromSchema(graphql, source) {
84
+ switch (source.type) {
85
+ case "GITHUB":
86
+ if (!source.github) {
87
+ throw new Error("No 'github' provided");
88
+ }
89
+ return new GitHubFilesystem(graphql, source.github.repo_id, source.github.ref ?? null);
90
+ case "UPLOAD_ID":
91
+ if (!source.upload_id) {
92
+ throw new Error("No upload_id provided");
93
+ }
94
+ return new UploadIdFilesystem(graphql, source.upload_id);
95
+ default:
96
+ throw new Error(`Invalid filesystem type: ${source.type}`);
97
+ }
98
+ }
99
+ export const decideFilesystemSchema = z.object({
100
+ type: z.enum(["GITHUB", "UPLOAD_ID"]),
101
+ github: z.object({
102
+ repo_id: z.number(),
103
+ ref: z.string().optional(),
104
+ }).optional(),
105
+ upload_id: z.string().optional(),
106
+ });
107
+ export async function decideFilesystem(args, context) {
108
+ const filesystem = decideFilesystemFromSchema(context.graphql, args);
109
+ context.filesystem = filesystem;
110
+ return JSON.stringify({ picked: args.type });
111
+ }
112
+ export const listFilesSchema = z.object({
113
+ path: z.string(),
114
+ limit: z.number().max(64).default(64),
115
+ offset: z.number().default(0),
116
+ });
117
+ export async function listFiles(args, context) {
118
+ if (!context.filesystem) {
119
+ throw new Error("No filesystem provided. Run 'decide_filesystem' to decide which filesystem to use.");
120
+ }
121
+ const files = await context.filesystem.list(args.path, args.limit, args.offset);
122
+ return JSON.stringify(files);
123
+ }
124
+ export const readFileSchema = z.object({
125
+ path: z.string(),
126
+ limit: z.number().max(1024).default(256),
127
+ offset: z.number().default(0),
128
+ });
129
+ export async function readFile(args, context) {
130
+ if (!context.filesystem) {
131
+ throw new Error("No filesystem provided. Run 'decide_filesystem' to decide which filesystem to use.");
132
+ }
133
+ const fullContent = await context.filesystem.read(args.path);
134
+ const totalLength = fullContent.length;
135
+ const startPos = args.offset;
136
+ if (args.limit === 0) {
137
+ const content = fullContent.slice(startPos);
138
+ return JSON.stringify({
139
+ content,
140
+ metadata: {
141
+ totalLength,
142
+ startPosition: startPos,
143
+ endPosition: totalLength,
144
+ hasMore: false,
145
+ returnedLength: content.length
146
+ }
147
+ });
148
+ }
149
+ const endPos = Math.min(startPos + args.limit, totalLength);
150
+ const content = fullContent.slice(startPos, endPos);
151
+ const hasMore = endPos < totalLength;
152
+ return JSON.stringify({
153
+ content,
154
+ metadata: {
155
+ totalLength,
156
+ startPosition: startPos,
157
+ endPosition: endPos,
158
+ hasMore,
159
+ returnedLength: content.length,
160
+ nextOffset: hasMore ? endPos : null
161
+ }
162
+ });
163
+ }
164
+ export const fileDirReadSchema = z.object({
165
+ serviceId: z.string(),
166
+ environmentId: z.string(),
167
+ command: z.array(z.string()),
168
+ });
169
+ export async function fileDirRead(args, context) {
170
+ const allowedCommands = ['ls', 'cat', 'head', 'tail', 'find', 'grep', 'tree', 'pwd', 'whoami', 'which', 'file'];
171
+ const baseCommand = args.command[0];
172
+ if (!allowedCommands.includes(baseCommand)) {
173
+ throw new Error(`Command '${baseCommand}' is not allowed. Only read operations are permitted: ${allowedCommands.join(', ')}`);
174
+ }
175
+ const query = `
176
+ mutation ExecuteCommand($serviceId: ObjectID!, $environmentId: ObjectID!, $command: [String!]!) {
177
+ executeCommand(serviceID: $serviceId, environmentID: $environmentId, command: $command) {
178
+ exitCode
179
+ output
180
+ }
181
+ }
182
+ `;
183
+ const variables = {
184
+ serviceId: args.serviceId,
185
+ environmentId: args.environmentId,
186
+ command: args.command
187
+ };
188
+ const response = await context.graphql.query(query, variables);
189
+ if (response.errors) {
190
+ throw new Error(JSON.stringify(response.errors));
191
+ }
192
+ const output = response.data.executeCommand.output ?? "";
193
+ let truncatedResponse = output.slice(0, MAX_COMMAND_RESPONSE_LENGTH)
194
+ + (output.length > MAX_COMMAND_RESPONSE_LENGTH ? '... (truncated)' : '');
195
+ if (response.data.executeCommand.exitCode !== 0) {
196
+ truncatedResponse = `(exit code ${response.data.executeCommand.exitCode}) ` + truncatedResponse;
197
+ }
198
+ return truncatedResponse;
199
+ }
200
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/core/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAEzC,MAAM,OAAO,kBAAkB;IACrB,OAAO,CAAgB;IACvB,QAAQ,CAAS;IAEzB,YAAY,OAAsB,EAAE,QAAgB;QAClD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY;QACrB,MAAM,KAAK,GAAG;;;;KAIb,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAsB,KAAK,EAAE;YACpE,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY;QACrB,MAAM,KAAK,GAAG;;;;KAIb,CAAC;QAEF,MAAM,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AAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,EAAE,CAAC;IACzD,IAAI,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,2BAA2B,CAAC;UAChE,CAAC,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAE3E,IAAI,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QAChD,iBAAiB,GAAG,cAAc,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,IAAI,GAAG,iBAAiB,CAAC;IAClG,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import { ZeaburContext } from "../types/index.js";
3
+ export declare const executeGraphqlSchema: z.ZodObject<{
4
+ query: z.ZodString;
5
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ query: string;
8
+ variables?: Record<string, any> | undefined;
9
+ }, {
10
+ query: string;
11
+ variables?: Record<string, any> | undefined;
12
+ }>;
13
+ export type ExecuteGraphqlInput = z.infer<typeof executeGraphqlSchema>;
14
+ export declare function executeGraphql(args: ExecuteGraphqlInput, context: ZeaburContext): Promise<string>;
15
+ //# sourceMappingURL=graphql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/core/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/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,CAQjB"}
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ export const executeGraphqlSchema = z.object({
3
+ query: z.string(),
4
+ variables: z.record(z.any()).optional(),
5
+ });
6
+ export async function executeGraphql(args, context) {
7
+ const response = await context.graphql.query(args.query, args.variables);
8
+ if (response.errors) {
9
+ throw new Error(JSON.stringify(response.errors));
10
+ }
11
+ return JSON.stringify(response.data);
12
+ }
13
+ //# sourceMappingURL=graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/core/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAyB,EACzB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAEzE,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,411 @@
1
+ export * from "./command.js";
2
+ export * from "./files.js";
3
+ export * from "./graphql.js";
4
+ export * from "./logs.js";
5
+ export * from "./template.js";
6
+ export * from "./render.js";
7
+ export * from "../types/index.js";
8
+ export { deployFromSpecification, deployFromSpecificationSchema } from "./deploy.js";
9
+ export type { DeployFromSpecificationInput } from "./deploy.js";
10
+ import { executeCommand } from "./command.js";
11
+ import { deployFromSpecification } from "./deploy.js";
12
+ import { decideFilesystem, listFiles, readFile, fileDirRead } from "./files.js";
13
+ import { executeGraphql } from "./graphql.js";
14
+ import { getBuildLogs, getRuntimeLogs, getDeployments } from "./logs.js";
15
+ import { searchTemplate } from "./template.js";
16
+ import { renderRegionSelector, renderProjectSelector, renderServiceCard, renderDockerfile, renderRecommendation, renderFloatingButton } from "./render.js";
17
+ export declare const zeaburTools: {
18
+ executeCommand: typeof executeCommand;
19
+ deployFromSpecification: typeof deployFromSpecification;
20
+ executeGraphql: typeof executeGraphql;
21
+ decideFilesystem: typeof decideFilesystem;
22
+ listFiles: typeof listFiles;
23
+ readFile: typeof readFile;
24
+ fileDirRead: typeof fileDirRead;
25
+ getBuildLogs: typeof getBuildLogs;
26
+ getRuntimeLogs: typeof getRuntimeLogs;
27
+ getDeployments: typeof getDeployments;
28
+ searchTemplate: typeof searchTemplate;
29
+ renderRegionSelector: typeof renderRegionSelector;
30
+ renderProjectSelector: typeof renderProjectSelector;
31
+ renderServiceCard: typeof renderServiceCard;
32
+ renderDockerfile: typeof renderDockerfile;
33
+ renderRecommendation: typeof renderRecommendation;
34
+ renderFloatingButton: typeof renderFloatingButton;
35
+ };
36
+ export declare const zeaburSchemas: {
37
+ executeCommandSchema: import("zod").ZodObject<{
38
+ serviceId: import("zod").ZodString;
39
+ environmentId: import("zod").ZodString;
40
+ command: import("zod").ZodArray<import("zod").ZodString, "many">;
41
+ }, "strip", import("zod").ZodTypeAny, {
42
+ serviceId: string;
43
+ environmentId: string;
44
+ command: string[];
45
+ }, {
46
+ serviceId: string;
47
+ environmentId: string;
48
+ command: string[];
49
+ }>;
50
+ deployFromSpecificationSchema: import("zod").ZodObject<{
51
+ service_id: import("zod").ZodString;
52
+ source: import("zod").ZodObject<{
53
+ type: import("zod").ZodEnum<["BUILD_FROM_SOURCE", "DOCKER_IMAGE"]>;
54
+ build_from_source: import("zod").ZodOptional<import("zod").ZodObject<{
55
+ source: import("zod").ZodObject<{
56
+ type: import("zod").ZodEnum<["GITHUB", "UPLOAD_ID"]>;
57
+ github: import("zod").ZodOptional<import("zod").ZodObject<{
58
+ repo_id: import("zod").ZodNumber;
59
+ ref: import("zod").ZodOptional<import("zod").ZodString>;
60
+ }, "strip", import("zod").ZodTypeAny, {
61
+ repo_id: number;
62
+ ref?: string | undefined;
63
+ }, {
64
+ repo_id: number;
65
+ ref?: string | undefined;
66
+ }>>;
67
+ upload_id: import("zod").ZodOptional<import("zod").ZodString>;
68
+ }, "strip", import("zod").ZodTypeAny, {
69
+ type: "GITHUB" | "UPLOAD_ID";
70
+ github?: {
71
+ repo_id: number;
72
+ ref?: string | undefined;
73
+ } | undefined;
74
+ upload_id?: string | undefined;
75
+ }, {
76
+ type: "GITHUB" | "UPLOAD_ID";
77
+ github?: {
78
+ repo_id: number;
79
+ ref?: string | undefined;
80
+ } | undefined;
81
+ upload_id?: string | undefined;
82
+ }>;
83
+ dockerfile: import("zod").ZodObject<{
84
+ content: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
85
+ path: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
86
+ }, "strip", import("zod").ZodTypeAny, {
87
+ path?: string | null | undefined;
88
+ content?: string | null | undefined;
89
+ }, {
90
+ path?: string | null | undefined;
91
+ content?: string | null | undefined;
92
+ }>;
93
+ }, "strip", import("zod").ZodTypeAny, {
94
+ dockerfile: {
95
+ path?: string | null | undefined;
96
+ content?: string | null | undefined;
97
+ };
98
+ source: {
99
+ type: "GITHUB" | "UPLOAD_ID";
100
+ github?: {
101
+ repo_id: number;
102
+ ref?: string | undefined;
103
+ } | undefined;
104
+ upload_id?: string | undefined;
105
+ };
106
+ }, {
107
+ dockerfile: {
108
+ path?: string | null | undefined;
109
+ content?: string | null | undefined;
110
+ };
111
+ source: {
112
+ type: "GITHUB" | "UPLOAD_ID";
113
+ github?: {
114
+ repo_id: number;
115
+ ref?: string | undefined;
116
+ } | undefined;
117
+ upload_id?: string | undefined;
118
+ };
119
+ }>>;
120
+ docker_image: import("zod").ZodOptional<import("zod").ZodString>;
121
+ }, "strip", import("zod").ZodTypeAny, {
122
+ type: "BUILD_FROM_SOURCE" | "DOCKER_IMAGE";
123
+ build_from_source?: {
124
+ dockerfile: {
125
+ path?: string | null | undefined;
126
+ content?: string | null | undefined;
127
+ };
128
+ source: {
129
+ type: "GITHUB" | "UPLOAD_ID";
130
+ github?: {
131
+ repo_id: number;
132
+ ref?: string | undefined;
133
+ } | undefined;
134
+ upload_id?: string | undefined;
135
+ };
136
+ } | undefined;
137
+ docker_image?: string | undefined;
138
+ }, {
139
+ type: "BUILD_FROM_SOURCE" | "DOCKER_IMAGE";
140
+ build_from_source?: {
141
+ dockerfile: {
142
+ path?: string | null | undefined;
143
+ content?: string | null | undefined;
144
+ };
145
+ source: {
146
+ type: "GITHUB" | "UPLOAD_ID";
147
+ github?: {
148
+ repo_id: number;
149
+ ref?: string | undefined;
150
+ } | undefined;
151
+ upload_id?: string | undefined;
152
+ };
153
+ } | undefined;
154
+ docker_image?: string | undefined;
155
+ }>;
156
+ env: import("zod").ZodArray<import("zod").ZodObject<{
157
+ key: import("zod").ZodString;
158
+ value: import("zod").ZodString;
159
+ expose: import("zod").ZodDefault<import("zod").ZodBoolean>;
160
+ }, "strip", import("zod").ZodTypeAny, {
161
+ value: string;
162
+ key: string;
163
+ expose: boolean;
164
+ }, {
165
+ value: string;
166
+ key: string;
167
+ expose?: boolean | undefined;
168
+ }>, "many">;
169
+ }, "strip", import("zod").ZodTypeAny, {
170
+ service_id: string;
171
+ source: {
172
+ type: "BUILD_FROM_SOURCE" | "DOCKER_IMAGE";
173
+ build_from_source?: {
174
+ dockerfile: {
175
+ path?: string | null | undefined;
176
+ content?: string | null | undefined;
177
+ };
178
+ source: {
179
+ type: "GITHUB" | "UPLOAD_ID";
180
+ github?: {
181
+ repo_id: number;
182
+ ref?: string | undefined;
183
+ } | undefined;
184
+ upload_id?: string | undefined;
185
+ };
186
+ } | undefined;
187
+ docker_image?: string | undefined;
188
+ };
189
+ env: {
190
+ value: string;
191
+ key: string;
192
+ expose: boolean;
193
+ }[];
194
+ }, {
195
+ service_id: string;
196
+ source: {
197
+ type: "BUILD_FROM_SOURCE" | "DOCKER_IMAGE";
198
+ build_from_source?: {
199
+ dockerfile: {
200
+ path?: string | null | undefined;
201
+ content?: string | null | undefined;
202
+ };
203
+ source: {
204
+ type: "GITHUB" | "UPLOAD_ID";
205
+ github?: {
206
+ repo_id: number;
207
+ ref?: string | undefined;
208
+ } | undefined;
209
+ upload_id?: string | undefined;
210
+ };
211
+ } | undefined;
212
+ docker_image?: string | undefined;
213
+ };
214
+ env: {
215
+ value: string;
216
+ key: string;
217
+ expose?: boolean | undefined;
218
+ }[];
219
+ }>;
220
+ executeGraphqlSchema: import("zod").ZodObject<{
221
+ query: import("zod").ZodString;
222
+ variables: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
223
+ }, "strip", import("zod").ZodTypeAny, {
224
+ query: string;
225
+ variables?: Record<string, any> | undefined;
226
+ }, {
227
+ query: string;
228
+ variables?: Record<string, any> | undefined;
229
+ }>;
230
+ decideFilesystemSchema: import("zod").ZodObject<{
231
+ type: import("zod").ZodEnum<["GITHUB", "UPLOAD_ID"]>;
232
+ github: import("zod").ZodOptional<import("zod").ZodObject<{
233
+ repo_id: import("zod").ZodNumber;
234
+ ref: import("zod").ZodOptional<import("zod").ZodString>;
235
+ }, "strip", import("zod").ZodTypeAny, {
236
+ repo_id: number;
237
+ ref?: string | undefined;
238
+ }, {
239
+ repo_id: number;
240
+ ref?: string | undefined;
241
+ }>>;
242
+ upload_id: import("zod").ZodOptional<import("zod").ZodString>;
243
+ }, "strip", import("zod").ZodTypeAny, {
244
+ type: "GITHUB" | "UPLOAD_ID";
245
+ github?: {
246
+ repo_id: number;
247
+ ref?: string | undefined;
248
+ } | undefined;
249
+ upload_id?: string | undefined;
250
+ }, {
251
+ type: "GITHUB" | "UPLOAD_ID";
252
+ github?: {
253
+ repo_id: number;
254
+ ref?: string | undefined;
255
+ } | undefined;
256
+ upload_id?: string | undefined;
257
+ }>;
258
+ listFilesSchema: import("zod").ZodObject<{
259
+ path: import("zod").ZodString;
260
+ limit: import("zod").ZodDefault<import("zod").ZodNumber>;
261
+ offset: import("zod").ZodDefault<import("zod").ZodNumber>;
262
+ }, "strip", import("zod").ZodTypeAny, {
263
+ path: string;
264
+ limit: number;
265
+ offset: number;
266
+ }, {
267
+ path: string;
268
+ limit?: number | undefined;
269
+ offset?: number | undefined;
270
+ }>;
271
+ readFileSchema: import("zod").ZodObject<{
272
+ path: import("zod").ZodString;
273
+ limit: import("zod").ZodDefault<import("zod").ZodNumber>;
274
+ offset: import("zod").ZodDefault<import("zod").ZodNumber>;
275
+ }, "strip", import("zod").ZodTypeAny, {
276
+ path: string;
277
+ limit: number;
278
+ offset: number;
279
+ }, {
280
+ path: string;
281
+ limit?: number | undefined;
282
+ offset?: number | undefined;
283
+ }>;
284
+ fileDirReadSchema: import("zod").ZodObject<{
285
+ serviceId: import("zod").ZodString;
286
+ environmentId: import("zod").ZodString;
287
+ command: import("zod").ZodArray<import("zod").ZodString, "many">;
288
+ }, "strip", import("zod").ZodTypeAny, {
289
+ serviceId: string;
290
+ environmentId: string;
291
+ command: string[];
292
+ }, {
293
+ serviceId: string;
294
+ environmentId: string;
295
+ command: string[];
296
+ }>;
297
+ getBuildLogsSchema: import("zod").ZodObject<{
298
+ deploymentId: import("zod").ZodString;
299
+ limit: import("zod").ZodDefault<import("zod").ZodNumber>;
300
+ }, "strip", import("zod").ZodTypeAny, {
301
+ limit: number;
302
+ deploymentId: string;
303
+ }, {
304
+ deploymentId: string;
305
+ limit?: number | undefined;
306
+ }>;
307
+ getRuntimeLogsSchema: import("zod").ZodObject<{
308
+ serviceId: import("zod").ZodString;
309
+ environmentId: import("zod").ZodString;
310
+ limit: import("zod").ZodDefault<import("zod").ZodNumber>;
311
+ }, "strip", import("zod").ZodTypeAny, {
312
+ serviceId: string;
313
+ environmentId: string;
314
+ limit: number;
315
+ }, {
316
+ serviceId: string;
317
+ environmentId: string;
318
+ limit?: number | undefined;
319
+ }>;
320
+ getDeploymentsSchema: import("zod").ZodObject<{
321
+ serviceId: import("zod").ZodString;
322
+ limit: import("zod").ZodDefault<import("zod").ZodNumber>;
323
+ }, "strip", import("zod").ZodTypeAny, {
324
+ serviceId: string;
325
+ limit: number;
326
+ }, {
327
+ serviceId: string;
328
+ limit?: number | undefined;
329
+ }>;
330
+ searchTemplateSchema: import("zod").ZodObject<{
331
+ query: import("zod").ZodString;
332
+ category: import("zod").ZodOptional<import("zod").ZodString>;
333
+ limit: import("zod").ZodDefault<import("zod").ZodNumber>;
334
+ }, "strip", import("zod").ZodTypeAny, {
335
+ limit: number;
336
+ query: string;
337
+ category?: string | undefined;
338
+ }, {
339
+ query: string;
340
+ limit?: number | undefined;
341
+ category?: string | undefined;
342
+ }>;
343
+ renderRegionSelectorSchema: import("zod").ZodObject<{
344
+ showServers: import("zod").ZodBoolean;
345
+ }, "strip", import("zod").ZodTypeAny, {
346
+ showServers: boolean;
347
+ }, {
348
+ showServers: boolean;
349
+ }>;
350
+ renderProjectSelectorSchema: import("zod").ZodObject<{
351
+ showCreateNew: import("zod").ZodBoolean;
352
+ }, "strip", import("zod").ZodTypeAny, {
353
+ showCreateNew: boolean;
354
+ }, {
355
+ showCreateNew: boolean;
356
+ }>;
357
+ renderServiceCardSchema: import("zod").ZodObject<{
358
+ projectID: import("zod").ZodString;
359
+ serviceID: import("zod").ZodString;
360
+ }, "strip", import("zod").ZodTypeAny, {
361
+ projectID: string;
362
+ serviceID: string;
363
+ }, {
364
+ projectID: string;
365
+ serviceID: string;
366
+ }>;
367
+ renderDockerfileSchema: import("zod").ZodObject<{
368
+ dockerfile: import("zod").ZodString;
369
+ language: import("zod").ZodDefault<import("zod").ZodString>;
370
+ }, "strip", import("zod").ZodTypeAny, {
371
+ dockerfile: string;
372
+ language: string;
373
+ }, {
374
+ dockerfile: string;
375
+ language?: string | undefined;
376
+ }>;
377
+ renderRecommendationSchema: import("zod").ZodObject<{
378
+ options: import("zod").ZodArray<import("zod").ZodObject<{
379
+ label: import("zod").ZodString;
380
+ }, "strip", import("zod").ZodTypeAny, {
381
+ label: string;
382
+ }, {
383
+ label: string;
384
+ }>, "many">;
385
+ }, "strip", import("zod").ZodTypeAny, {
386
+ options: {
387
+ label: string;
388
+ }[];
389
+ }, {
390
+ options: {
391
+ label: string;
392
+ }[];
393
+ }>;
394
+ renderFloatingButtonSchema: import("zod").ZodObject<{
395
+ url: import("zod").ZodString;
396
+ title: import("zod").ZodOptional<import("zod").ZodString>;
397
+ description: import("zod").ZodOptional<import("zod").ZodString>;
398
+ isExternal: import("zod").ZodDefault<import("zod").ZodBoolean>;
399
+ }, "strip", import("zod").ZodTypeAny, {
400
+ url: string;
401
+ isExternal: boolean;
402
+ title?: string | undefined;
403
+ description?: string | undefined;
404
+ }, {
405
+ url: string;
406
+ title?: string | undefined;
407
+ description?: string | undefined;
408
+ isExternal?: boolean | undefined;
409
+ }>;
410
+ };
411
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,C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