@devpad/api 1.0.1

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.
@@ -0,0 +1,19 @@
1
+ export declare class ApiError extends Error {
2
+ readonly code?: string;
3
+ readonly statusCode?: number;
4
+ constructor(message: string, options?: {
5
+ code?: string;
6
+ statusCode?: number;
7
+ });
8
+ static fromResponse(response: Response): ApiError;
9
+ }
10
+ export declare class AuthenticationError extends ApiError {
11
+ constructor(message?: string);
12
+ }
13
+ export declare class NetworkError extends ApiError {
14
+ constructor(message?: string);
15
+ }
16
+ export declare class ValidationError extends ApiError {
17
+ constructor(message?: string);
18
+ }
19
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAG5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACf;IAQP,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;CAKjD;AAED,qBAAa,mBAAoB,SAAQ,QAAQ;gBACpC,OAAO,GAAE,MAAgC;CAGrD;AAED,qBAAa,YAAa,SAAQ,QAAQ;gBAC7B,OAAO,GAAE,MAAiC;CAGtD;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAChC,OAAO,GAAE,MAA4B;CAGjD"}
package/dist/errors.js ADDED
@@ -0,0 +1,28 @@
1
+ export class ApiError extends Error {
2
+ constructor(message, options = {}) {
3
+ super(message);
4
+ this.name = "ApiError";
5
+ this.code = options.code ?? undefined;
6
+ this.statusCode = options.statusCode ?? undefined;
7
+ }
8
+ static fromResponse(response) {
9
+ return new ApiError(`API request failed: ${response.statusText}`, {
10
+ statusCode: response.status,
11
+ });
12
+ }
13
+ }
14
+ export class AuthenticationError extends ApiError {
15
+ constructor(message = "Authentication failed") {
16
+ super(message, { code: "AUTHENTICATION_ERROR" });
17
+ }
18
+ }
19
+ export class NetworkError extends ApiError {
20
+ constructor(message = "Network request failed") {
21
+ super(message, { code: "NETWORK_ERROR" });
22
+ }
23
+ }
24
+ export class ValidationError extends ApiError {
25
+ constructor(message = "Validation failed") {
26
+ super(message, { code: "VALIDATION_ERROR" });
27
+ }
28
+ }
@@ -0,0 +1,11 @@
1
+ import { ApiClient } from "./api-client";
2
+ export type { Project, ProjectConfig, SaveConfigRequest, Task, TaskWithDetails, UpsertProject, UpsertTag, UpsertTodo, } from "@devpad/schema";
3
+ export { getUserFriendlyErrorMessage, parseZodErrors } from "./error-handlers";
4
+ export type { ApiError, AuthenticationError, NetworkError, ValidationError } from "./errors";
5
+ export type { RequestHistoryEntry, RequestOptions } from "./request";
6
+ export type { AuthMode } from "./api-client";
7
+ export { wrap, type Result, type Success, type Failure } from "./result";
8
+ export { tools, getTool, toolNames, type ToolDefinition } from "./tools";
9
+ export { ApiClient };
10
+ export default ApiClient;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EACX,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,IAAI,EACJ,eAAe,EACf,aAAa,EACb,SAAS,EACT,UAAU,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/E,YAAY,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7F,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACrE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,eAAe,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { ApiClient } from "./api-client";
2
+ export { getUserFriendlyErrorMessage, parseZodErrors } from "./error-handlers";
3
+ export { wrap } from "./result";
4
+ export { tools, getTool, toolNames } from "./tools";
5
+ export { ApiClient };
6
+ export default ApiClient;
@@ -0,0 +1,41 @@
1
+ import { type BufferedQueue } from "@devpad/schema";
2
+ export type RequestOptions = {
3
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
4
+ headers?: Record<string, string>;
5
+ body?: unknown;
6
+ query?: Record<string, string>;
7
+ };
8
+ export type RequestHistoryEntry = {
9
+ timestamp: string;
10
+ method: string;
11
+ path: string;
12
+ options: RequestOptions;
13
+ url: string;
14
+ status?: number;
15
+ duration?: number;
16
+ error?: string;
17
+ };
18
+ export declare class ApiClient {
19
+ private base_url;
20
+ private api_key;
21
+ private request_history;
22
+ private category;
23
+ constructor(options: {
24
+ base_url: string;
25
+ api_key: string;
26
+ max_history_size?: number;
27
+ category?: string;
28
+ });
29
+ private buildUrl;
30
+ private generateRequestId;
31
+ private request;
32
+ get<T>(path: string, options?: Omit<RequestOptions, "method">): Promise<T>;
33
+ post<T>(path: string, options?: Omit<RequestOptions, "method">): Promise<T>;
34
+ patch<T>(path: string, options?: Omit<RequestOptions, "method">): Promise<T>;
35
+ put<T>(path: string, options?: Omit<RequestOptions, "method">): Promise<T>;
36
+ delete<T>(path: string, options?: Omit<RequestOptions, "method">): Promise<T>;
37
+ history(): BufferedQueue<RequestHistoryEntry>;
38
+ url(): string;
39
+ headers(): Record<string, string>;
40
+ }
41
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIxE,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,SAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,eAAe,CAAqC;IAC5D,OAAO,CAAC,QAAQ,CAAiB;gBAErB,OAAO,EAAE;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB;IAeD,OAAO,CAAC,QAAQ;IAYhB,OAAO,CAAC,iBAAiB;YAIX,OAAO;IA2Hd,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI9E,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI/E,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhF,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI9E,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjF,OAAO;IAIP,GAAG,IAAI,MAAM;IAIb,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAgBxC"}
@@ -0,0 +1,178 @@
1
+ import { ArrayBufferedQueue } from "@devpad/schema";
2
+ import { HTTP_STATUS, handleHttpResponse, handleNetworkError, handleResponseError } from "./error-handlers";
3
+ import { ApiError, AuthenticationError } from "./errors";
4
+ export class ApiClient {
5
+ constructor(options) {
6
+ this.category = "api";
7
+ if (!options.api_key) {
8
+ throw new Error("API key is required");
9
+ }
10
+ if (options.api_key.length < 10) {
11
+ throw new Error("API key is too short");
12
+ }
13
+ this.base_url = options.base_url;
14
+ this.api_key = options.api_key;
15
+ this.category = options.category || "api";
16
+ this.request_history = new ArrayBufferedQueue(options.max_history_size ?? 5);
17
+ }
18
+ buildUrl(path, query) {
19
+ const url = new URL(`${this.base_url}${path}`);
20
+ if (query) {
21
+ Object.entries(query).forEach(([key, value]) => {
22
+ if (value)
23
+ url.searchParams.append(key, value);
24
+ });
25
+ }
26
+ return url.toString();
27
+ }
28
+ generateRequestId() {
29
+ return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
30
+ }
31
+ async request(path, options = {}) {
32
+ const { method = "GET", headers = {}, body, query } = options;
33
+ const url = this.buildUrl(path, query);
34
+ const requestId = this.generateRequestId();
35
+ const startTime = Date.now();
36
+ const timestamp = new Date().toISOString();
37
+ // Log request start
38
+ console.log(`[DEBUG][${this.category}] ${method} ${path} [${requestId}]`, {
39
+ body,
40
+ query,
41
+ });
42
+ const request_headers = {
43
+ "Content-Type": "application/json",
44
+ Authorization: `Bearer ${this.api_key}`,
45
+ "X-Request-ID": requestId,
46
+ ...headers,
47
+ };
48
+ // Initialize history entry
49
+ const historyEntry = {
50
+ timestamp,
51
+ method,
52
+ path,
53
+ options: { ...options, method },
54
+ url,
55
+ };
56
+ try {
57
+ const fetchOptions = {
58
+ method,
59
+ headers: request_headers,
60
+ };
61
+ if (body) {
62
+ fetchOptions.body = JSON.stringify(body);
63
+ }
64
+ const response = await fetch(url, fetchOptions);
65
+ const duration = Date.now() - startTime;
66
+ // Update history entry with response info
67
+ historyEntry.status = response.status;
68
+ historyEntry.duration = duration;
69
+ if (!response.ok) {
70
+ console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
71
+ status: response.status,
72
+ duration: `${duration}ms`,
73
+ body,
74
+ query,
75
+ });
76
+ try {
77
+ // Use centralized error handling
78
+ handleHttpResponse(response);
79
+ await handleResponseError(response);
80
+ }
81
+ catch (error) {
82
+ // Log error in history and re-throw
83
+ const errorMessage = error instanceof Error ? error.message : "Request failed";
84
+ historyEntry.error = errorMessage;
85
+ this.request_history.add(historyEntry);
86
+ throw error;
87
+ }
88
+ }
89
+ // Success - add to history
90
+ this.request_history.add(historyEntry);
91
+ // Handle response parsing
92
+ let result;
93
+ if (response.status === HTTP_STATUS.NO_CONTENT) {
94
+ result = undefined;
95
+ }
96
+ else {
97
+ const text = await response.text();
98
+ if (!text || text.trim() === "" || text.trim() === "null") {
99
+ result = undefined;
100
+ }
101
+ else {
102
+ try {
103
+ result = JSON.parse(text);
104
+ }
105
+ catch (parseError) {
106
+ result = text;
107
+ }
108
+ }
109
+ }
110
+ // Log success
111
+ console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
112
+ status: response.status,
113
+ duration: `${duration}ms`,
114
+ });
115
+ return result;
116
+ }
117
+ catch (error) {
118
+ const duration = Date.now() - startTime;
119
+ console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
120
+ duration: `${duration}ms`,
121
+ error: error instanceof Error ? error.message : String(error),
122
+ body,
123
+ query,
124
+ });
125
+ // If this is already an API error, just re-throw it (already added to history above)
126
+ if (error instanceof ApiError || error instanceof AuthenticationError) {
127
+ throw error;
128
+ }
129
+ // Handle network error
130
+ historyEntry.duration = duration;
131
+ try {
132
+ handleNetworkError(error);
133
+ }
134
+ catch (networkError) {
135
+ const errorMessage = networkError instanceof Error ? networkError.message : "Unknown network error";
136
+ historyEntry.error = errorMessage;
137
+ this.request_history.add(historyEntry);
138
+ throw networkError;
139
+ }
140
+ }
141
+ }
142
+ get(path, options = {}) {
143
+ return this.request(path, { ...options, method: "GET" });
144
+ }
145
+ post(path, options = {}) {
146
+ return this.request(path, { ...options, method: "POST" });
147
+ }
148
+ patch(path, options = {}) {
149
+ return this.request(path, { ...options, method: "PATCH" });
150
+ }
151
+ put(path, options = {}) {
152
+ return this.request(path, { ...options, method: "PUT" });
153
+ }
154
+ delete(path, options = {}) {
155
+ return this.request(path, { ...options, method: "DELETE" });
156
+ }
157
+ history() {
158
+ return this.request_history;
159
+ }
160
+ url() {
161
+ return this.base_url;
162
+ }
163
+ headers() {
164
+ const isJWT = this.api_key.startsWith("jwt:");
165
+ const headers = {
166
+ "Content-Type": "application/json",
167
+ };
168
+ if (isJWT) {
169
+ // JWT token in Authorization header
170
+ headers.Authorization = `Bearer ${this.api_key.replace("jwt:", "")}`;
171
+ }
172
+ else {
173
+ // API key in X-API-KEY header
174
+ headers["X-API-KEY"] = this.api_key;
175
+ }
176
+ return headers;
177
+ }
178
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Result type system for clean error handling in API operations
3
+ * Provides type-safe success/failure patterns with context-aware property names
4
+ */
5
+ export type Success<TData, TName extends string> = {
6
+ [K in TName]: TData;
7
+ } & {
8
+ error: null;
9
+ };
10
+ export type Failure<TName extends string> = {
11
+ [K in TName]: null;
12
+ } & {
13
+ error: {
14
+ message: string;
15
+ code?: string;
16
+ status_code?: number;
17
+ };
18
+ };
19
+ export type Result<TData, TName extends string> = Success<TData, TName> | Failure<TName>;
20
+ /**
21
+ * Wraps any async function with Result type for clean error handling
22
+ * Automatically generates context-aware property names
23
+ *
24
+ * @param fn - The async function to wrap
25
+ * @param data_name - The property name for the data in the result
26
+ * @returns Promise that resolves to Result type with success/error pattern
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const getProject = (id: string) =>
31
+ * wrap(() => client.projects.find(id), 'project');
32
+ *
33
+ * const { project, error } = await getProject('123');
34
+ * if (error) {
35
+ * console.error(error.message);
36
+ * return;
37
+ * }
38
+ * // project is guaranteed to be non-null here
39
+ * ```
40
+ */
41
+ export declare function wrap<TData, TName extends string>(fn: () => Promise<TData>, data_name: TName): Promise<Result<TData, TName>>;
42
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,MAAM,OAAO,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,IAAI;KACjD,CAAC,IAAI,KAAK,GAAG,KAAK;CACnB,GAAG;IACH,KAAK,EAAE,IAAI,CAAC;CACZ,CAAC;AAGF,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,MAAM,IAAI;KAC1C,CAAC,IAAI,KAAK,GAAG,IAAI;CAClB,GAAG;IACH,KAAK,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACF,CAAC;AAGF,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,IAAI,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAkB3H"}
package/dist/result.js ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Result type system for clean error handling in API operations
3
+ * Provides type-safe success/failure patterns with context-aware property names
4
+ */
5
+ /**
6
+ * Wraps any async function with Result type for clean error handling
7
+ * Automatically generates context-aware property names
8
+ *
9
+ * @param fn - The async function to wrap
10
+ * @param data_name - The property name for the data in the result
11
+ * @returns Promise that resolves to Result type with success/error pattern
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const getProject = (id: string) =>
16
+ * wrap(() => client.projects.find(id), 'project');
17
+ *
18
+ * const { project, error } = await getProject('123');
19
+ * if (error) {
20
+ * console.error(error.message);
21
+ * return;
22
+ * }
23
+ * // project is guaranteed to be non-null here
24
+ * ```
25
+ */
26
+ export function wrap(fn, data_name) {
27
+ return fn()
28
+ .then(data => {
29
+ const result = { error: null };
30
+ result[data_name] = data;
31
+ return result;
32
+ })
33
+ .catch(error => {
34
+ const result = {
35
+ error: {
36
+ message: error.message || `Failed to fetch ${data_name}`,
37
+ code: error.code,
38
+ status_code: error.statusCode || error.status_code,
39
+ },
40
+ };
41
+ result[data_name] = null;
42
+ return result;
43
+ });
44
+ }
@@ -0,0 +1,84 @@
1
+ import { z } from "zod";
2
+ import { ApiClient } from "./api-client";
3
+ export declare const project_filters: z.ZodObject<{
4
+ private: z.ZodOptional<z.ZodBoolean>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ private?: boolean | undefined;
7
+ }, {
8
+ private?: boolean | undefined;
9
+ }>;
10
+ export declare const project_by_id_or_name: z.ZodEffects<z.ZodObject<{
11
+ id: z.ZodOptional<z.ZodString>;
12
+ name: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ id?: string | undefined;
15
+ name?: string | undefined;
16
+ }, {
17
+ id?: string | undefined;
18
+ name?: string | undefined;
19
+ }>, {
20
+ id?: string | undefined;
21
+ name?: string | undefined;
22
+ }, {
23
+ id?: string | undefined;
24
+ name?: string | undefined;
25
+ }>;
26
+ export declare const task_filters: z.ZodObject<{
27
+ project_id: z.ZodOptional<z.ZodString>;
28
+ tag_id: z.ZodOptional<z.ZodString>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ project_id?: string | undefined;
31
+ tag_id?: string | undefined;
32
+ }, {
33
+ project_id?: string | undefined;
34
+ tag_id?: string | undefined;
35
+ }>;
36
+ export declare const task_by_id: z.ZodObject<{
37
+ id: z.ZodString;
38
+ }, "strip", z.ZodTypeAny, {
39
+ id: string;
40
+ }, {
41
+ id: string;
42
+ }>;
43
+ export declare const milestone_filters: z.ZodObject<{
44
+ project_id: z.ZodOptional<z.ZodString>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ project_id?: string | undefined;
47
+ }, {
48
+ project_id?: string | undefined;
49
+ }>;
50
+ export declare const milestone_by_id: z.ZodObject<{
51
+ id: z.ZodString;
52
+ }, "strip", z.ZodTypeAny, {
53
+ id: string;
54
+ }, {
55
+ id: string;
56
+ }>;
57
+ export declare const goal_by_id: z.ZodObject<{
58
+ id: z.ZodString;
59
+ }, "strip", z.ZodTypeAny, {
60
+ id: string;
61
+ }, {
62
+ id: string;
63
+ }>;
64
+ export declare const github_branches: z.ZodObject<{
65
+ owner: z.ZodString;
66
+ repo: z.ZodString;
67
+ }, "strip", z.ZodTypeAny, {
68
+ owner: string;
69
+ repo: string;
70
+ }, {
71
+ owner: string;
72
+ repo: string;
73
+ }>;
74
+ export interface ToolDefinition<TInput = any, TOutput = any> {
75
+ name: string;
76
+ description: string;
77
+ inputSchema: z.ZodType<TInput>;
78
+ execute: (client: ApiClient, input: TInput) => Promise<TOutput>;
79
+ }
80
+ export declare const tools: Record<string, ToolDefinition>;
81
+ export declare function zodToMCPSchema(schema: z.ZodType<any>): z.ZodType<any, z.ZodTypeDef, any>;
82
+ export declare const toolNames: string[];
83
+ export declare function getTool(name: string): ToolDefinition | undefined;
84
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAO/B,CAAC;AAEJ,eAAO,MAAM,YAAY;;;;;;;;;EAGvB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;EAErB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;EAErB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAC;AAGH,MAAM,WAAW,cAAc,CAAC,MAAM,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAChE;AAGD,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAsXhD,CAAC;AAGF,wBAAgB,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,qCAIpD;AAGD,eAAO,MAAM,SAAS,UAAqB,CAAC;AAG5C,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEhE"}