@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.
- package/README.md +244 -0
- package/dist/core/command.d.ts +18 -0
- package/dist/core/command.d.ts.map +1 -0
- package/dist/core/command.js +34 -0
- package/dist/core/command.js.map +1 -0
- package/dist/core/deploy.d.ts +175 -0
- package/dist/core/deploy.d.ts.map +1 -0
- package/dist/core/deploy.js +96 -0
- package/dist/core/deploy.js.map +1 -0
- package/dist/core/files.d.ts +94 -0
- package/dist/core/files.d.ts.map +1 -0
- package/dist/core/files.js +200 -0
- package/dist/core/files.js.map +1 -0
- package/dist/core/graphql.d.ts +15 -0
- package/dist/core/graphql.d.ts.map +1 -0
- package/dist/core/graphql.js +13 -0
- package/dist/core/graphql.js.map +1 -0
- package/dist/core/index.d.ts +411 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +65 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logs.d.ts +42 -0
- package/dist/core/logs.d.ts.map +1 -0
- package/dist/core/logs.js +76 -0
- package/dist/core/logs.js.map +1 -0
- package/dist/core/render.d.ts +81 -0
- package/dist/core/render.d.ts.map +1 -0
- package/dist/core/render.js +68 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/template.d.ts +18 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/template.js +31 -0
- package/dist/core/template.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +46 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/context.d.ts +22 -0
- package/dist/utils/context.d.ts.map +1 -0
- package/dist/utils/context.js +37 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/demo.d.ts +15 -0
- package/dist/utils/demo.d.ts.map +1 -0
- package/dist/utils/demo.js +113 -0
- package/dist/utils/demo.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Core tool functions - can be used directly without MCP
|
|
2
|
+
export * from "./command.js";
|
|
3
|
+
export * from "./files.js";
|
|
4
|
+
export * from "./graphql.js";
|
|
5
|
+
export * from "./logs.js";
|
|
6
|
+
export * from "./template.js";
|
|
7
|
+
export * from "./render.js";
|
|
8
|
+
// Re-export types for convenience
|
|
9
|
+
export * from "../types/index.js";
|
|
10
|
+
// Deploy needs special handling due to type conflicts
|
|
11
|
+
export { deployFromSpecification, deployFromSpecificationSchema } from "./deploy.js";
|
|
12
|
+
// Tool collection for easier usage
|
|
13
|
+
import { executeCommand, executeCommandSchema } from "./command.js";
|
|
14
|
+
import { deployFromSpecification, deployFromSpecificationSchema } from "./deploy.js";
|
|
15
|
+
import { decideFilesystem, listFiles, readFile, fileDirRead, decideFilesystemSchema, listFilesSchema, readFileSchema, fileDirReadSchema } from "./files.js";
|
|
16
|
+
import { executeGraphql, executeGraphqlSchema } from "./graphql.js";
|
|
17
|
+
import { getBuildLogs, getRuntimeLogs, getDeployments, getBuildLogsSchema, getRuntimeLogsSchema, getDeploymentsSchema } from "./logs.js";
|
|
18
|
+
import { searchTemplate, searchTemplateSchema } from "./template.js";
|
|
19
|
+
import { renderRegionSelector, renderProjectSelector, renderServiceCard, renderDockerfile, renderRecommendation, renderFloatingButton, renderRegionSelectorSchema, renderProjectSelectorSchema, renderServiceCardSchema, renderDockerfileSchema, renderRecommendationSchema, renderFloatingButtonSchema } from "./render.js";
|
|
20
|
+
// Collection of all tools for easy access
|
|
21
|
+
export const zeaburTools = {
|
|
22
|
+
// Core functionality
|
|
23
|
+
executeCommand,
|
|
24
|
+
deployFromSpecification,
|
|
25
|
+
executeGraphql,
|
|
26
|
+
// File system
|
|
27
|
+
decideFilesystem,
|
|
28
|
+
listFiles,
|
|
29
|
+
readFile,
|
|
30
|
+
fileDirRead,
|
|
31
|
+
// Monitoring
|
|
32
|
+
getBuildLogs,
|
|
33
|
+
getRuntimeLogs,
|
|
34
|
+
getDeployments,
|
|
35
|
+
// Templates
|
|
36
|
+
searchTemplate,
|
|
37
|
+
// UI Rendering
|
|
38
|
+
renderRegionSelector,
|
|
39
|
+
renderProjectSelector,
|
|
40
|
+
renderServiceCard,
|
|
41
|
+
renderDockerfile,
|
|
42
|
+
renderRecommendation,
|
|
43
|
+
renderFloatingButton,
|
|
44
|
+
};
|
|
45
|
+
// Collection of all schemas
|
|
46
|
+
export const zeaburSchemas = {
|
|
47
|
+
executeCommandSchema,
|
|
48
|
+
deployFromSpecificationSchema,
|
|
49
|
+
executeGraphqlSchema,
|
|
50
|
+
decideFilesystemSchema,
|
|
51
|
+
listFilesSchema,
|
|
52
|
+
readFileSchema,
|
|
53
|
+
fileDirReadSchema,
|
|
54
|
+
getBuildLogsSchema,
|
|
55
|
+
getRuntimeLogsSchema,
|
|
56
|
+
getDeploymentsSchema,
|
|
57
|
+
searchTemplateSchema,
|
|
58
|
+
renderRegionSelectorSchema,
|
|
59
|
+
renderProjectSelectorSchema,
|
|
60
|
+
renderServiceCardSchema,
|
|
61
|
+
renderDockerfileSchema,
|
|
62
|
+
renderRecommendationSchema,
|
|
63
|
+
renderFloatingButtonSchema,
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAE5B,kCAAkC;AAClC,cAAc,mBAAmB,CAAC;AAElC,sDAAsD;AACtD,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAGrB,mC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AAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAC1B,2BAA2B;IAC3B,uBAAuB;IACvB,sBAAsB;IACtB,0BAA0B;IAC1B,0BAA0B;CAC3B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const getBuildLogsSchema: z.ZodObject<{
|
|
4
|
+
deploymentId: z.ZodString;
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
limit: number;
|
|
8
|
+
deploymentId: string;
|
|
9
|
+
}, {
|
|
10
|
+
deploymentId: string;
|
|
11
|
+
limit?: number | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export type GetBuildLogsInput = z.infer<typeof getBuildLogsSchema>;
|
|
14
|
+
export declare function getBuildLogs(args: GetBuildLogsInput, context: ZeaburContext): Promise<string>;
|
|
15
|
+
export declare const getRuntimeLogsSchema: z.ZodObject<{
|
|
16
|
+
serviceId: z.ZodString;
|
|
17
|
+
environmentId: z.ZodString;
|
|
18
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
serviceId: string;
|
|
21
|
+
environmentId: string;
|
|
22
|
+
limit: number;
|
|
23
|
+
}, {
|
|
24
|
+
serviceId: string;
|
|
25
|
+
environmentId: string;
|
|
26
|
+
limit?: number | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export type GetRuntimeLogsInput = z.infer<typeof getRuntimeLogsSchema>;
|
|
29
|
+
export declare function getRuntimeLogs(args: GetRuntimeLogsInput, context: ZeaburContext): Promise<string>;
|
|
30
|
+
export declare const getDeploymentsSchema: z.ZodObject<{
|
|
31
|
+
serviceId: z.ZodString;
|
|
32
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
serviceId: string;
|
|
35
|
+
limit: number;
|
|
36
|
+
}, {
|
|
37
|
+
serviceId: string;
|
|
38
|
+
limit?: number | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export type GetDeploymentsInput = z.infer<typeof getDeploymentsSchema>;
|
|
41
|
+
export declare function getDeployments(args: GetDeploymentsInput, context: ZeaburContext): Promise<string>;
|
|
42
|
+
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/core/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,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,CAqBjB;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/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,CAsBjB;AAED,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,CAwBjB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const getBuildLogsSchema = z.object({
|
|
3
|
+
deploymentId: z.string(),
|
|
4
|
+
limit: z.number().default(100),
|
|
5
|
+
});
|
|
6
|
+
export async function getBuildLogs(args, context) {
|
|
7
|
+
const query = `
|
|
8
|
+
query GetBuildLogs($deploymentId: ObjectID!, $limit: Int) {
|
|
9
|
+
buildLogs(deploymentID: $deploymentId, limit: $limit) {
|
|
10
|
+
timestamp
|
|
11
|
+
message
|
|
12
|
+
level
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const response = await context.graphql.query(query, {
|
|
17
|
+
deploymentId: args.deploymentId,
|
|
18
|
+
limit: args.limit
|
|
19
|
+
});
|
|
20
|
+
if (response.errors) {
|
|
21
|
+
throw new Error(JSON.stringify(response.errors));
|
|
22
|
+
}
|
|
23
|
+
return JSON.stringify(response.data);
|
|
24
|
+
}
|
|
25
|
+
export const getRuntimeLogsSchema = z.object({
|
|
26
|
+
serviceId: z.string(),
|
|
27
|
+
environmentId: z.string(),
|
|
28
|
+
limit: z.number().default(100),
|
|
29
|
+
});
|
|
30
|
+
export async function getRuntimeLogs(args, context) {
|
|
31
|
+
const query = `
|
|
32
|
+
query GetRuntimeLogs($serviceId: ObjectID!, $environmentId: ObjectID!, $limit: Int) {
|
|
33
|
+
runtimeLogs(serviceID: $serviceId, environmentID: $environmentId, limit: $limit) {
|
|
34
|
+
timestamp
|
|
35
|
+
message
|
|
36
|
+
level
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const response = await context.graphql.query(query, {
|
|
41
|
+
serviceId: args.serviceId,
|
|
42
|
+
environmentId: args.environmentId,
|
|
43
|
+
limit: args.limit
|
|
44
|
+
});
|
|
45
|
+
if (response.errors) {
|
|
46
|
+
throw new Error(JSON.stringify(response.errors));
|
|
47
|
+
}
|
|
48
|
+
return JSON.stringify(response.data);
|
|
49
|
+
}
|
|
50
|
+
export const getDeploymentsSchema = z.object({
|
|
51
|
+
serviceId: z.string(),
|
|
52
|
+
limit: z.number().default(10),
|
|
53
|
+
});
|
|
54
|
+
export async function getDeployments(args, context) {
|
|
55
|
+
const query = `
|
|
56
|
+
query GetDeployments($serviceId: ObjectID!, $limit: Int) {
|
|
57
|
+
service(id: $serviceId) {
|
|
58
|
+
deployments(limit: $limit) {
|
|
59
|
+
_id
|
|
60
|
+
status
|
|
61
|
+
createdAt
|
|
62
|
+
updatedAt
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
const response = await context.graphql.query(query, {
|
|
68
|
+
serviceId: args.serviceId,
|
|
69
|
+
limit: args.limit
|
|
70
|
+
});
|
|
71
|
+
if (response.errors) {
|
|
72
|
+
throw new Error(JSON.stringify(response.errors));
|
|
73
|
+
}
|
|
74
|
+
return JSON.stringify(response.data);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/core/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;CAC/B,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAuB,EACvB,OAAsB;IAEtB,MAAM,KAAK,GAAG;;;;;;;;GAQb,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE;QAClD,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC;IAEH,IAAI,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yB,EACzB,OAAsB;IAEtB,MAAM,KAAK,GAAG;;;;;;;;;;;GAWb,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE;QAClD,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,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,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const renderRegionSelectorSchema: z.ZodObject<{
|
|
3
|
+
showServers: z.ZodBoolean;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
showServers: boolean;
|
|
6
|
+
}, {
|
|
7
|
+
showServers: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export type RenderRegionSelectorInput = z.infer<typeof renderRegionSelectorSchema>;
|
|
10
|
+
export declare function renderRegionSelector(args: RenderRegionSelectorInput): Promise<string>;
|
|
11
|
+
export declare const renderProjectSelectorSchema: z.ZodObject<{
|
|
12
|
+
showCreateNew: z.ZodBoolean;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
showCreateNew: boolean;
|
|
15
|
+
}, {
|
|
16
|
+
showCreateNew: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
export type RenderProjectSelectorInput = z.infer<typeof renderProjectSelectorSchema>;
|
|
19
|
+
export declare function renderProjectSelector(args: RenderProjectSelectorInput): Promise<string>;
|
|
20
|
+
export declare const renderServiceCardSchema: z.ZodObject<{
|
|
21
|
+
projectID: z.ZodString;
|
|
22
|
+
serviceID: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
projectID: string;
|
|
25
|
+
serviceID: string;
|
|
26
|
+
}, {
|
|
27
|
+
projectID: string;
|
|
28
|
+
serviceID: string;
|
|
29
|
+
}>;
|
|
30
|
+
export type RenderServiceCardInput = z.infer<typeof renderServiceCardSchema>;
|
|
31
|
+
export declare function renderServiceCard(args: RenderServiceCardInput): Promise<string>;
|
|
32
|
+
export declare const renderDockerfileSchema: z.ZodObject<{
|
|
33
|
+
dockerfile: z.ZodString;
|
|
34
|
+
language: z.ZodDefault<z.ZodString>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
dockerfile: string;
|
|
37
|
+
language: string;
|
|
38
|
+
}, {
|
|
39
|
+
dockerfile: string;
|
|
40
|
+
language?: string | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
export type RenderDockerfileInput = z.infer<typeof renderDockerfileSchema>;
|
|
43
|
+
export declare function renderDockerfile(args: RenderDockerfileInput): Promise<string>;
|
|
44
|
+
export declare const renderRecommendationSchema: z.ZodObject<{
|
|
45
|
+
options: z.ZodArray<z.ZodObject<{
|
|
46
|
+
label: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
label: string;
|
|
49
|
+
}, {
|
|
50
|
+
label: string;
|
|
51
|
+
}>, "many">;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
options: {
|
|
54
|
+
label: string;
|
|
55
|
+
}[];
|
|
56
|
+
}, {
|
|
57
|
+
options: {
|
|
58
|
+
label: string;
|
|
59
|
+
}[];
|
|
60
|
+
}>;
|
|
61
|
+
export type RenderRecommendationInput = z.infer<typeof renderRecommendationSchema>;
|
|
62
|
+
export declare function renderRecommendation(args: RenderRecommendationInput): Promise<string>;
|
|
63
|
+
export declare const renderFloatingButtonSchema: z.ZodObject<{
|
|
64
|
+
url: z.ZodString;
|
|
65
|
+
title: z.ZodOptional<z.ZodString>;
|
|
66
|
+
description: z.ZodOptional<z.ZodString>;
|
|
67
|
+
isExternal: z.ZodDefault<z.ZodBoolean>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
url: string;
|
|
70
|
+
isExternal: boolean;
|
|
71
|
+
title?: string | undefined;
|
|
72
|
+
description?: string | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
url: string;
|
|
75
|
+
title?: string | undefined;
|
|
76
|
+
description?: string | undefined;
|
|
77
|
+
isExternal?: boolean | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
export type RenderFloatingButtonInput = z.infer<typeof renderFloatingButtonSchema>;
|
|
80
|
+
export declare function renderFloatingButton(args: RenderFloatingButtonInput): Promise<string>;
|
|
81
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/core/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B;;;;;;EAErC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,eAAO,MAAM,2BAA2B;;;;;;EAEtC,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAErF,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE7E,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EAKrC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAQjB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const renderRegionSelectorSchema = z.object({
|
|
3
|
+
showServers: z.boolean(),
|
|
4
|
+
});
|
|
5
|
+
export async function renderRegionSelector(args) {
|
|
6
|
+
return JSON.stringify({
|
|
7
|
+
type: 'region-selector',
|
|
8
|
+
showServers: args.showServers
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export const renderProjectSelectorSchema = z.object({
|
|
12
|
+
showCreateNew: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export async function renderProjectSelector(args) {
|
|
15
|
+
return JSON.stringify({
|
|
16
|
+
type: 'project-selector',
|
|
17
|
+
showCreateNew: args.showCreateNew
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export const renderServiceCardSchema = z.object({
|
|
21
|
+
projectID: z.string(),
|
|
22
|
+
serviceID: z.string(),
|
|
23
|
+
});
|
|
24
|
+
export async function renderServiceCard(args) {
|
|
25
|
+
return JSON.stringify({
|
|
26
|
+
type: 'service-card',
|
|
27
|
+
projectID: args.projectID,
|
|
28
|
+
serviceID: args.serviceID
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export const renderDockerfileSchema = z.object({
|
|
32
|
+
dockerfile: z.string(),
|
|
33
|
+
language: z.string().default("dockerfile"),
|
|
34
|
+
});
|
|
35
|
+
export async function renderDockerfile(args) {
|
|
36
|
+
return JSON.stringify({
|
|
37
|
+
type: 'dockerfile',
|
|
38
|
+
content: args.dockerfile,
|
|
39
|
+
language: args.language || 'dockerfile'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export const renderRecommendationSchema = z.object({
|
|
43
|
+
options: z.array(z.object({
|
|
44
|
+
label: z.string(),
|
|
45
|
+
})),
|
|
46
|
+
});
|
|
47
|
+
export async function renderRecommendation(args) {
|
|
48
|
+
return JSON.stringify({
|
|
49
|
+
type: 'recommendation',
|
|
50
|
+
options: args.options
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export const renderFloatingButtonSchema = z.object({
|
|
54
|
+
url: z.string(),
|
|
55
|
+
title: z.string().optional(),
|
|
56
|
+
description: z.string().optional(),
|
|
57
|
+
isExternal: z.boolean().default(true),
|
|
58
|
+
});
|
|
59
|
+
export async function renderFloatingButton(args) {
|
|
60
|
+
return JSON.stringify({
|
|
61
|
+
type: 'floating-button',
|
|
62
|
+
url: args.url,
|
|
63
|
+
title: args.title || 'Visit Website',
|
|
64
|
+
description: args.description,
|
|
65
|
+
isExternal: args.isExternal
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/core/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,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 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ZeaburContext } from "../types/index.js";
|
|
3
|
+
export declare const searchTemplateSchema: z.ZodObject<{
|
|
4
|
+
query: z.ZodString;
|
|
5
|
+
category: z.ZodOptional<z.ZodString>;
|
|
6
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
limit: number;
|
|
9
|
+
query: string;
|
|
10
|
+
category?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
query: string;
|
|
13
|
+
limit?: number | undefined;
|
|
14
|
+
category?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export type SearchTemplateInput = z.infer<typeof searchTemplateSchema>;
|
|
17
|
+
export declare function searchTemplate(args: SearchTemplateInput, context: ZeaburContext): Promise<string>;
|
|
18
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +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;AAElD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/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,CA0BjB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const searchTemplateSchema = z.object({
|
|
3
|
+
query: z.string(),
|
|
4
|
+
category: z.string().optional(),
|
|
5
|
+
limit: z.number().default(10),
|
|
6
|
+
});
|
|
7
|
+
export async function searchTemplate(args, context) {
|
|
8
|
+
const query = `
|
|
9
|
+
query SearchTemplates($query: String!, $category: String, $limit: Int) {
|
|
10
|
+
templates(search: $query, category: $category, limit: $limit) {
|
|
11
|
+
_id
|
|
12
|
+
name
|
|
13
|
+
description
|
|
14
|
+
category
|
|
15
|
+
tags
|
|
16
|
+
readme
|
|
17
|
+
config
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
const response = await context.graphql.query(query, {
|
|
22
|
+
query: args.query,
|
|
23
|
+
category: args.category,
|
|
24
|
+
limit: args.limit
|
|
25
|
+
});
|
|
26
|
+
if (response.errors) {
|
|
27
|
+
throw new Error(JSON.stringify(response.errors));
|
|
28
|
+
}
|
|
29
|
+
return JSON.stringify(response.data);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/core/template.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,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CAC9B,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAyB,EACzB,OAAsB;IAEtB,MAAM,KAAK,GAAG;;;;;;;;;;;;GAYb,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE;QAClD,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,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/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./core/index.js";
|
|
2
|
+
export * from "./types/index.js";
|
|
3
|
+
export * from "./utils/context.js";
|
|
4
|
+
import { GraphQLClient } from "./types/index.js";
|
|
5
|
+
export declare function createGraphQLClient(token: string, endpoint?: string): GraphQLClient;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAmC,GAAG,aAAa,CAkC7G"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Export core tools
|
|
2
|
+
export * from "./core/index.js";
|
|
3
|
+
// Export types
|
|
4
|
+
export * from "./types/index.js";
|
|
5
|
+
// Export utilities
|
|
6
|
+
export * from "./utils/context.js";
|
|
7
|
+
// Helper function to create GraphQL client
|
|
8
|
+
export function createGraphQLClient(token, endpoint = 'https://api.zeabur.com/graphql') {
|
|
9
|
+
return {
|
|
10
|
+
async query(query, variables) {
|
|
11
|
+
const response = await fetch(endpoint, {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
'Authorization': `Bearer ${token}`,
|
|
16
|
+
},
|
|
17
|
+
body: JSON.stringify({
|
|
18
|
+
query,
|
|
19
|
+
variables,
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
24
|
+
}
|
|
25
|
+
return await response.json();
|
|
26
|
+
},
|
|
27
|
+
async getUserInfo() {
|
|
28
|
+
const query = `
|
|
29
|
+
query GetUserInfo {
|
|
30
|
+
me {
|
|
31
|
+
_id
|
|
32
|
+
email
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
return this.query(query);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,iBAAiB,CAAC;AAEhC,eAAe;AACf,cAAc,kBAAkB,CAAC;AAEjC,mBAAmB;AACnB,cAAc,oBAAoB,CAAC;AAInC,2CAA2C;AAC3C,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,QAAQ,GAAG,gCAAgC;IAC5F,OAAO;QACL,KAAK,CAAC,KAAK,CAAU,KAAa,EAAE,SAA+B;YACjE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE;gBACrC,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,eAAe,EAAE,UAAU,KAAK,EAAE;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,KAAK;oBACL,SAAS;iBACV,CAAC;aACH,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC5D,CAAC;YAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAiC,CAAC;QAC9D,CAAC;QAED,KAAK,CAAC,WAAW;YACf,MAAM,KAAK,GAAG;;;;;;;OAOb,CAAC;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface GraphQLClient {
|
|
2
|
+
query<T = any>(query: string, variables?: Record<string, any>): Promise<{
|
|
3
|
+
data: T;
|
|
4
|
+
errors?: any[];
|
|
5
|
+
}>;
|
|
6
|
+
getUserInfo(): Promise<{
|
|
7
|
+
data: {
|
|
8
|
+
me: {
|
|
9
|
+
_id: string;
|
|
10
|
+
email: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface Filesystem {
|
|
16
|
+
list(path: string, limit: number, offset: number): Promise<string[]>;
|
|
17
|
+
read(path: string): Promise<string>;
|
|
18
|
+
}
|
|
19
|
+
export interface ZeaburContext {
|
|
20
|
+
graphql: GraphQLClient;
|
|
21
|
+
filesystem?: Filesystem;
|
|
22
|
+
}
|
|
23
|
+
export interface DeployFromSpecificationInput {
|
|
24
|
+
service_id: string;
|
|
25
|
+
specification: DeployFromSpecificationSpecification;
|
|
26
|
+
}
|
|
27
|
+
export interface DeployFromSpecificationSpecification {
|
|
28
|
+
source: {
|
|
29
|
+
source?: "GITHUB" | "UPLOAD_ID";
|
|
30
|
+
repoID?: number;
|
|
31
|
+
branch?: string;
|
|
32
|
+
uploadID?: string;
|
|
33
|
+
image?: string;
|
|
34
|
+
dockerfile?: string;
|
|
35
|
+
};
|
|
36
|
+
env?: {
|
|
37
|
+
key: string;
|
|
38
|
+
default: string;
|
|
39
|
+
expose: boolean;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
export interface ExecuteCommandResult {
|
|
43
|
+
exitCode: number;
|
|
44
|
+
output: string;
|
|
45
|
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AAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,OAAO,CAAC;KACjB,EAAE,CAAC;CACL;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ZeaburContext, GraphQLClient } from "../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a Zeabur context with authentication
|
|
4
|
+
* @param token - Zeabur API token (required - must be provided by your application)
|
|
5
|
+
* @param endpoint - GraphQL endpoint (optional, defaults to 'https://api.zeabur.com/graphql')
|
|
6
|
+
* @throws Error if token is not provided
|
|
7
|
+
*/
|
|
8
|
+
export declare function createZeaburContext(token: string, endpoint?: string): ZeaburContext;
|
|
9
|
+
/**
|
|
10
|
+
* Create a context from existing GraphQL client
|
|
11
|
+
* @param graphqlClient - Pre-configured GraphQL client
|
|
12
|
+
*/
|
|
13
|
+
export declare function createZeaburContextFromClient(graphqlClient: GraphQLClient): ZeaburContext;
|
|
14
|
+
/**
|
|
15
|
+
* Create a demo context for testing without API tokens
|
|
16
|
+
*/
|
|
17
|
+
export declare function createZeaburDemoContext(): ZeaburContext;
|
|
18
|
+
/**
|
|
19
|
+
* Validate that a context has the required GraphQL client
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateContext(context: ZeaburContext): void;
|
|
22
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIjE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAChB,aAAa,CAIf;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,aAAa,GAC3B,aAAa,CAIf;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CAEvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAI5D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createGraphQLClient } from "../index.js";
|
|
2
|
+
import { createDemoContext } from "./demo.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create a Zeabur context with authentication
|
|
5
|
+
* @param token - Zeabur API token (required - must be provided by your application)
|
|
6
|
+
* @param endpoint - GraphQL endpoint (optional, defaults to 'https://api.zeabur.com/graphql')
|
|
7
|
+
* @throws Error if token is not provided
|
|
8
|
+
*/
|
|
9
|
+
export function createZeaburContext(token, endpoint) {
|
|
10
|
+
return {
|
|
11
|
+
graphql: createGraphQLClient(token, endpoint)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a context from existing GraphQL client
|
|
16
|
+
* @param graphqlClient - Pre-configured GraphQL client
|
|
17
|
+
*/
|
|
18
|
+
export function createZeaburContextFromClient(graphqlClient) {
|
|
19
|
+
return {
|
|
20
|
+
graphql: graphqlClient
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a demo context for testing without API tokens
|
|
25
|
+
*/
|
|
26
|
+
export function createZeaburDemoContext() {
|
|
27
|
+
return createDemoContext();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validate that a context has the required GraphQL client
|
|
31
|
+
*/
|
|
32
|
+
export function validateContext(context) {
|
|
33
|
+
if (!context.graphql) {
|
|
34
|
+
throw new Error('ZeaburContext must have a GraphQL client');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,QAAiB;IAEjB,OAAO;QACL,OAAO,EAAE,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,aAA4B;IAE5B,OAAO;QACL,OAAO,EAAE,aAAa;KACvB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ZeaburContext, GraphQLClient } from "../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a demo GraphQL client that returns mock data
|
|
4
|
+
* Useful for testing and development without real API tokens
|
|
5
|
+
*/
|
|
6
|
+
export declare function createDemoGraphQLClient(): GraphQLClient;
|
|
7
|
+
/**
|
|
8
|
+
* Create a demo Zeabur context for testing
|
|
9
|
+
*/
|
|
10
|
+
export declare function createDemoContext(): ZeaburContext;
|
|
11
|
+
/**
|
|
12
|
+
* Check if we're in demo mode
|
|
13
|
+
*/
|
|
14
|
+
export declare function isDemoMode(context: ZeaburContext): boolean;
|
|
15
|
+
//# sourceMappingURL=demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/utils/demo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CAoGvD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAIjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAG1D"}
|