@ghcrawl/api-contract 0.1.0 → 0.1.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.
- package/README.md +18 -0
- package/dist/client.d.ts +41 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +90 -0
- package/dist/client.js.map +1 -0
- package/dist/contracts.d.ts +1784 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +174 -0
- package/dist/contracts.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +1 -0
- package/dist/index.js.map +1 -0
- package/package.json +5 -4
- package/src/client.ts +0 -135
- package/src/contracts.test.ts +0 -85
- package/src/contracts.ts +0 -229
package/src/contracts.ts
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
export const threadKindSchema = z.enum(['issue', 'pull_request']);
|
|
4
|
-
export type ThreadKind = z.infer<typeof threadKindSchema>;
|
|
5
|
-
|
|
6
|
-
export const searchModeSchema = z.enum(['keyword', 'semantic', 'hybrid']);
|
|
7
|
-
export type SearchMode = z.infer<typeof searchModeSchema>;
|
|
8
|
-
|
|
9
|
-
export const repositorySchema = z.object({
|
|
10
|
-
id: z.number().int().positive(),
|
|
11
|
-
owner: z.string(),
|
|
12
|
-
name: z.string(),
|
|
13
|
-
fullName: z.string(),
|
|
14
|
-
githubRepoId: z.string().nullable(),
|
|
15
|
-
updatedAt: z.string(),
|
|
16
|
-
});
|
|
17
|
-
export type RepositoryDto = z.infer<typeof repositorySchema>;
|
|
18
|
-
|
|
19
|
-
export const threadSchema = z.object({
|
|
20
|
-
id: z.number().int().positive(),
|
|
21
|
-
repoId: z.number().int().positive(),
|
|
22
|
-
number: z.number().int().positive(),
|
|
23
|
-
kind: threadKindSchema,
|
|
24
|
-
state: z.string(),
|
|
25
|
-
title: z.string(),
|
|
26
|
-
body: z.string().nullable(),
|
|
27
|
-
authorLogin: z.string().nullable(),
|
|
28
|
-
htmlUrl: z.string().url(),
|
|
29
|
-
labels: z.array(z.string()),
|
|
30
|
-
updatedAtGh: z.string().nullable(),
|
|
31
|
-
clusterId: z.number().int().positive().nullable().optional(),
|
|
32
|
-
});
|
|
33
|
-
export type ThreadDto = z.infer<typeof threadSchema>;
|
|
34
|
-
|
|
35
|
-
export const healthResponseSchema = z.object({
|
|
36
|
-
ok: z.boolean(),
|
|
37
|
-
configPath: z.string(),
|
|
38
|
-
configFileExists: z.boolean(),
|
|
39
|
-
dbPath: z.string(),
|
|
40
|
-
apiPort: z.number().int().positive(),
|
|
41
|
-
githubConfigured: z.boolean(),
|
|
42
|
-
openaiConfigured: z.boolean(),
|
|
43
|
-
});
|
|
44
|
-
export type HealthResponse = z.infer<typeof healthResponseSchema>;
|
|
45
|
-
|
|
46
|
-
export const repositoriesResponseSchema = z.object({
|
|
47
|
-
repositories: z.array(repositorySchema),
|
|
48
|
-
});
|
|
49
|
-
export type RepositoriesResponse = z.infer<typeof repositoriesResponseSchema>;
|
|
50
|
-
|
|
51
|
-
export const threadsResponseSchema = z.object({
|
|
52
|
-
repository: repositorySchema,
|
|
53
|
-
threads: z.array(threadSchema),
|
|
54
|
-
});
|
|
55
|
-
export type ThreadsResponse = z.infer<typeof threadsResponseSchema>;
|
|
56
|
-
|
|
57
|
-
export const neighborSchema = z.object({
|
|
58
|
-
threadId: z.number().int().positive(),
|
|
59
|
-
number: z.number().int().positive(),
|
|
60
|
-
kind: threadKindSchema,
|
|
61
|
-
title: z.string(),
|
|
62
|
-
score: z.number(),
|
|
63
|
-
});
|
|
64
|
-
export type NeighborDto = z.infer<typeof neighborSchema>;
|
|
65
|
-
|
|
66
|
-
export const searchHitSchema = z.object({
|
|
67
|
-
thread: threadSchema,
|
|
68
|
-
keywordScore: z.number().nullable(),
|
|
69
|
-
semanticScore: z.number().nullable(),
|
|
70
|
-
hybridScore: z.number(),
|
|
71
|
-
neighbors: z.array(neighborSchema).default([]),
|
|
72
|
-
});
|
|
73
|
-
export type SearchHitDto = z.infer<typeof searchHitSchema>;
|
|
74
|
-
|
|
75
|
-
export const searchResponseSchema = z.object({
|
|
76
|
-
repository: repositorySchema,
|
|
77
|
-
query: z.string(),
|
|
78
|
-
mode: searchModeSchema,
|
|
79
|
-
hits: z.array(searchHitSchema),
|
|
80
|
-
});
|
|
81
|
-
export type SearchResponse = z.infer<typeof searchResponseSchema>;
|
|
82
|
-
|
|
83
|
-
export const neighborsResponseSchema = z.object({
|
|
84
|
-
repository: repositorySchema,
|
|
85
|
-
thread: threadSchema,
|
|
86
|
-
neighbors: z.array(neighborSchema),
|
|
87
|
-
});
|
|
88
|
-
export type NeighborsResponse = z.infer<typeof neighborsResponseSchema>;
|
|
89
|
-
|
|
90
|
-
export const clusterMemberSchema = z.object({
|
|
91
|
-
threadId: z.number().int().positive(),
|
|
92
|
-
number: z.number().int().positive(),
|
|
93
|
-
kind: threadKindSchema,
|
|
94
|
-
title: z.string(),
|
|
95
|
-
scoreToRepresentative: z.number().nullable(),
|
|
96
|
-
});
|
|
97
|
-
export type ClusterMemberDto = z.infer<typeof clusterMemberSchema>;
|
|
98
|
-
|
|
99
|
-
export const clusterSchema = z.object({
|
|
100
|
-
id: z.number().int().positive(),
|
|
101
|
-
repoId: z.number().int().positive(),
|
|
102
|
-
representativeThreadId: z.number().int().positive().nullable(),
|
|
103
|
-
memberCount: z.number().int().nonnegative(),
|
|
104
|
-
members: z.array(clusterMemberSchema),
|
|
105
|
-
});
|
|
106
|
-
export type ClusterDto = z.infer<typeof clusterSchema>;
|
|
107
|
-
|
|
108
|
-
export const clustersResponseSchema = z.object({
|
|
109
|
-
repository: repositorySchema,
|
|
110
|
-
clusters: z.array(clusterSchema),
|
|
111
|
-
});
|
|
112
|
-
export type ClustersResponse = z.infer<typeof clustersResponseSchema>;
|
|
113
|
-
|
|
114
|
-
export const repoStatsSchema = z.object({
|
|
115
|
-
openIssueCount: z.number().int().nonnegative(),
|
|
116
|
-
openPullRequestCount: z.number().int().nonnegative(),
|
|
117
|
-
lastGithubReconciliationAt: z.string().nullable(),
|
|
118
|
-
lastEmbedRefreshAt: z.string().nullable(),
|
|
119
|
-
staleEmbedThreadCount: z.number().int().nonnegative(),
|
|
120
|
-
staleEmbedSourceCount: z.number().int().nonnegative(),
|
|
121
|
-
latestClusterRunId: z.number().int().positive().nullable(),
|
|
122
|
-
latestClusterRunFinishedAt: z.string().nullable(),
|
|
123
|
-
});
|
|
124
|
-
export type RepoStatsDto = z.infer<typeof repoStatsSchema>;
|
|
125
|
-
|
|
126
|
-
export const clusterSummarySchema = z.object({
|
|
127
|
-
clusterId: z.number().int().positive(),
|
|
128
|
-
displayTitle: z.string(),
|
|
129
|
-
totalCount: z.number().int().nonnegative(),
|
|
130
|
-
issueCount: z.number().int().nonnegative(),
|
|
131
|
-
pullRequestCount: z.number().int().nonnegative(),
|
|
132
|
-
latestUpdatedAt: z.string().nullable(),
|
|
133
|
-
representativeThreadId: z.number().int().positive().nullable(),
|
|
134
|
-
representativeNumber: z.number().int().positive().nullable(),
|
|
135
|
-
representativeKind: threadKindSchema.nullable(),
|
|
136
|
-
});
|
|
137
|
-
export type ClusterSummaryDto = z.infer<typeof clusterSummarySchema>;
|
|
138
|
-
|
|
139
|
-
export const clusterSummariesResponseSchema = z.object({
|
|
140
|
-
repository: repositorySchema,
|
|
141
|
-
stats: repoStatsSchema,
|
|
142
|
-
clusters: z.array(clusterSummarySchema),
|
|
143
|
-
});
|
|
144
|
-
export type ClusterSummariesResponse = z.infer<typeof clusterSummariesResponseSchema>;
|
|
145
|
-
|
|
146
|
-
export const threadSummariesSchema = z.object({
|
|
147
|
-
problem_summary: z.string().optional(),
|
|
148
|
-
solution_summary: z.string().optional(),
|
|
149
|
-
maintainer_signal_summary: z.string().optional(),
|
|
150
|
-
dedupe_summary: z.string().optional(),
|
|
151
|
-
});
|
|
152
|
-
export type ThreadSummariesDto = z.infer<typeof threadSummariesSchema>;
|
|
153
|
-
|
|
154
|
-
export const clusterThreadDumpSchema = z.object({
|
|
155
|
-
thread: threadSchema,
|
|
156
|
-
bodySnippet: z.string().nullable(),
|
|
157
|
-
summaries: threadSummariesSchema,
|
|
158
|
-
});
|
|
159
|
-
export type ClusterThreadDumpDto = z.infer<typeof clusterThreadDumpSchema>;
|
|
160
|
-
|
|
161
|
-
export const clusterDetailResponseSchema = z.object({
|
|
162
|
-
repository: repositorySchema,
|
|
163
|
-
stats: repoStatsSchema,
|
|
164
|
-
cluster: clusterSummarySchema,
|
|
165
|
-
members: z.array(clusterThreadDumpSchema),
|
|
166
|
-
});
|
|
167
|
-
export type ClusterDetailResponse = z.infer<typeof clusterDetailResponseSchema>;
|
|
168
|
-
|
|
169
|
-
export const syncResultSchema = z.object({
|
|
170
|
-
runId: z.number().int().positive(),
|
|
171
|
-
threadsSynced: z.number().int().nonnegative(),
|
|
172
|
-
commentsSynced: z.number().int().nonnegative(),
|
|
173
|
-
threadsClosed: z.number().int().nonnegative(),
|
|
174
|
-
});
|
|
175
|
-
export type SyncResultDto = z.infer<typeof syncResultSchema>;
|
|
176
|
-
|
|
177
|
-
export const embedResultSchema = z.object({
|
|
178
|
-
runId: z.number().int().positive(),
|
|
179
|
-
embedded: z.number().int().nonnegative(),
|
|
180
|
-
});
|
|
181
|
-
export type EmbedResultDto = z.infer<typeof embedResultSchema>;
|
|
182
|
-
|
|
183
|
-
export const clusterResultSchema = z.object({
|
|
184
|
-
runId: z.number().int().positive(),
|
|
185
|
-
edges: z.number().int().nonnegative(),
|
|
186
|
-
clusters: z.number().int().nonnegative(),
|
|
187
|
-
});
|
|
188
|
-
export type ClusterResultDto = z.infer<typeof clusterResultSchema>;
|
|
189
|
-
|
|
190
|
-
export const refreshRequestSchema = z.object({
|
|
191
|
-
owner: z.string(),
|
|
192
|
-
repo: z.string(),
|
|
193
|
-
sync: z.boolean().optional(),
|
|
194
|
-
embed: z.boolean().optional(),
|
|
195
|
-
cluster: z.boolean().optional(),
|
|
196
|
-
});
|
|
197
|
-
export type RefreshRequest = z.infer<typeof refreshRequestSchema>;
|
|
198
|
-
|
|
199
|
-
export const refreshResponseSchema = z.object({
|
|
200
|
-
repository: repositorySchema,
|
|
201
|
-
selected: z.object({
|
|
202
|
-
sync: z.boolean(),
|
|
203
|
-
embed: z.boolean(),
|
|
204
|
-
cluster: z.boolean(),
|
|
205
|
-
}),
|
|
206
|
-
sync: syncResultSchema.nullable(),
|
|
207
|
-
embed: embedResultSchema.nullable(),
|
|
208
|
-
cluster: clusterResultSchema.nullable(),
|
|
209
|
-
});
|
|
210
|
-
export type RefreshResponse = z.infer<typeof refreshResponseSchema>;
|
|
211
|
-
|
|
212
|
-
export const rerunActionSchema = z.enum(['summarize', 'embed', 'cluster']);
|
|
213
|
-
export type RerunAction = z.infer<typeof rerunActionSchema>;
|
|
214
|
-
|
|
215
|
-
export const actionRequestSchema = z.object({
|
|
216
|
-
owner: z.string(),
|
|
217
|
-
repo: z.string(),
|
|
218
|
-
action: rerunActionSchema,
|
|
219
|
-
threadNumber: z.number().int().positive().optional(),
|
|
220
|
-
});
|
|
221
|
-
export type ActionRequest = z.infer<typeof actionRequestSchema>;
|
|
222
|
-
|
|
223
|
-
export const actionResponseSchema = z.object({
|
|
224
|
-
ok: z.boolean(),
|
|
225
|
-
action: rerunActionSchema,
|
|
226
|
-
runId: z.number().int().positive().nullable(),
|
|
227
|
-
message: z.string(),
|
|
228
|
-
});
|
|
229
|
-
export type ActionResponse = z.infer<typeof actionResponseSchema>;
|