@generacy-ai/generacy-plugin-github-issues 0.0.0-preview-20260304013206
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/LICENSE +191 -0
- package/dist/auth/auth-factory.d.ts +44 -0
- package/dist/auth/auth-factory.d.ts.map +1 -0
- package/dist/auth/auth-factory.js +85 -0
- package/dist/auth/auth-factory.js.map +1 -0
- package/dist/auth/env.d.ts +32 -0
- package/dist/auth/env.d.ts.map +1 -0
- package/dist/auth/env.js +88 -0
- package/dist/auth/env.js.map +1 -0
- package/dist/auth/github-app.d.ts +69 -0
- package/dist/auth/github-app.d.ts.map +1 -0
- package/dist/auth/github-app.js +191 -0
- package/dist/auth/github-app.js.map +1 -0
- package/dist/auth/index.d.ts +10 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +10 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/token-cache.d.ts +70 -0
- package/dist/auth/token-cache.d.ts.map +1 -0
- package/dist/auth/token-cache.js +112 -0
- package/dist/auth/token-cache.js.map +1 -0
- package/dist/auth/types.d.ts +119 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +27 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/client.d.ts +101 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +197 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/comments.d.ts +46 -0
- package/dist/operations/comments.d.ts.map +1 -0
- package/dist/operations/comments.js +127 -0
- package/dist/operations/comments.js.map +1 -0
- package/dist/operations/issues.d.ts +46 -0
- package/dist/operations/issues.d.ts.map +1 -0
- package/dist/operations/issues.js +188 -0
- package/dist/operations/issues.js.map +1 -0
- package/dist/operations/labels.d.ts +46 -0
- package/dist/operations/labels.d.ts.map +1 -0
- package/dist/operations/labels.js +132 -0
- package/dist/operations/labels.js.map +1 -0
- package/dist/operations/pull-requests.d.ts +41 -0
- package/dist/operations/pull-requests.d.ts.map +1 -0
- package/dist/operations/pull-requests.js +162 -0
- package/dist/operations/pull-requests.js.map +1 -0
- package/dist/plugin.d.ts +181 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +324 -0
- package/dist/plugin.js.map +1 -0
- package/dist/types/config.d.ts +126 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +22 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/events.d.ts +72 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +2 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/issues.d.ts +178 -0
- package/dist/types/issues.d.ts.map +1 -0
- package/dist/types/issues.js +29 -0
- package/dist/types/issues.js.map +1 -0
- package/dist/types/responses.d.ts +61 -0
- package/dist/types/responses.d.ts.map +1 -0
- package/dist/types/responses.js +5 -0
- package/dist/types/responses.js.map +1 -0
- package/dist/utils/errors.d.ts +69 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +123 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/validation.d.ts +33 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +69 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/webhooks/handler.d.ts +66 -0
- package/dist/webhooks/handler.d.ts.map +1 -0
- package/dist/webhooks/handler.js +176 -0
- package/dist/webhooks/handler.js.map +1 -0
- package/dist/webhooks/parser.d.ts +36 -0
- package/dist/webhooks/parser.d.ts.map +1 -0
- package/dist/webhooks/parser.js +220 -0
- package/dist/webhooks/parser.js.map +1 -0
- package/dist/webhooks/triggers.d.ts +25 -0
- package/dist/webhooks/triggers.d.ts.map +1 -0
- package/dist/webhooks/triggers.js +119 -0
- package/dist/webhooks/triggers.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Issue, User, Label, Comment, PullRequest } from './issues.js';
|
|
2
|
+
/**
|
|
3
|
+
* Repository reference in webhook events
|
|
4
|
+
*/
|
|
5
|
+
export interface Repository {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
fullName: string;
|
|
9
|
+
owner: User;
|
|
10
|
+
htmlUrl: string;
|
|
11
|
+
private: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Base webhook event structure
|
|
15
|
+
*/
|
|
16
|
+
export interface WebhookEvent<T = unknown> {
|
|
17
|
+
/** Event type (e.g., 'issues', 'issue_comment') */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Event payload from GitHub */
|
|
20
|
+
payload: T;
|
|
21
|
+
/** Delivery ID for idempotency */
|
|
22
|
+
deliveryId?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Issues webhook event payload
|
|
26
|
+
*/
|
|
27
|
+
export interface IssuesEventPayload {
|
|
28
|
+
action: 'opened' | 'edited' | 'deleted' | 'transferred' | 'pinned' | 'unpinned' | 'closed' | 'reopened' | 'assigned' | 'unassigned' | 'labeled' | 'unlabeled' | 'locked' | 'unlocked' | 'milestoned' | 'demilestoned';
|
|
29
|
+
issue: Issue;
|
|
30
|
+
sender: User;
|
|
31
|
+
repository: Repository;
|
|
32
|
+
/** Assignee when action is 'assigned' or 'unassigned' */
|
|
33
|
+
assignee?: User;
|
|
34
|
+
/** Label when action is 'labeled' or 'unlabeled' */
|
|
35
|
+
label?: Label;
|
|
36
|
+
/** Field changes when action is 'edited' */
|
|
37
|
+
changes?: Record<string, {
|
|
38
|
+
from: unknown;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Issue comment webhook event payload
|
|
43
|
+
*/
|
|
44
|
+
export interface IssueCommentEventPayload {
|
|
45
|
+
action: 'created' | 'edited' | 'deleted';
|
|
46
|
+
issue: Issue;
|
|
47
|
+
comment: Comment;
|
|
48
|
+
sender: User;
|
|
49
|
+
repository: Repository;
|
|
50
|
+
/** Field changes when action is 'edited' */
|
|
51
|
+
changes?: Record<string, {
|
|
52
|
+
from: unknown;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Pull request webhook event payload
|
|
57
|
+
*/
|
|
58
|
+
export interface PullRequestEventPayload {
|
|
59
|
+
action: 'opened' | 'edited' | 'closed' | 'reopened' | 'assigned' | 'unassigned' | 'labeled' | 'unlabeled' | 'synchronize' | 'ready_for_review' | 'locked' | 'unlocked' | 'review_requested';
|
|
60
|
+
pull_request: PullRequest;
|
|
61
|
+
sender: User;
|
|
62
|
+
repository: Repository;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Supported webhook event names
|
|
66
|
+
*/
|
|
67
|
+
export type WebhookEventName = 'issues' | 'issue_comment' | 'pull_request';
|
|
68
|
+
/**
|
|
69
|
+
* Type-safe webhook event union
|
|
70
|
+
*/
|
|
71
|
+
export type TypedWebhookEvent = WebhookEvent<IssuesEventPayload> | WebhookEvent<IssueCommentEventPayload> | WebhookEvent<PullRequestEventPayload>;
|
|
72
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,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GACT,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,QAAQ,GACR,UAAU,GACV,kBAAkB,CAAC;IACvB,YAAY,EAAE,WAAW,CAAC;IAC1B,MAAM,EAAE,IAAI,CAAC;IACb,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,eAAe,GAAG,cAAc,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,YAAY,CAAC,kBAAkB,CAAC,GAChC,YAAY,CAAC,wBAAwB,CAAC,GACtC,YAAY,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { GitHubIssuesConfig, ValidatedConfig } from './config.js';
|
|
2
|
+
export { GitHubIssuesConfigSchema } from './config.js';
|
|
3
|
+
export type { User, Label, Comment, Milestone, Issue, PullRequest, CreateIssueParams, UpdateIssueParams, IssueFilter, } from './issues.js';
|
|
4
|
+
export { CreateIssueParamsSchema, UpdateIssueParamsSchema, IssueFilterSchema, } from './issues.js';
|
|
5
|
+
export type { Repository, WebhookEvent, IssuesEventPayload, IssueCommentEventPayload, PullRequestEventPayload, WebhookEventName, TypedWebhookEvent, } from './events.js';
|
|
6
|
+
export type { QueueForProcessingAction, StartWorkflowAction, ResumeWorkflowAction, NoAction, WorkflowAction, OperationResult, OperationError, OperationResponse, } from './responses.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAGvD,YAAY,EACV,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAcvD,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* GitHub user representation
|
|
4
|
+
*/
|
|
5
|
+
export interface User {
|
|
6
|
+
id: number;
|
|
7
|
+
login: string;
|
|
8
|
+
avatarUrl: string;
|
|
9
|
+
type: 'User' | 'Bot' | 'Organization';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Issue label
|
|
13
|
+
*/
|
|
14
|
+
export interface Label {
|
|
15
|
+
id: number;
|
|
16
|
+
name: string;
|
|
17
|
+
color: string;
|
|
18
|
+
description: string | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Issue comment
|
|
22
|
+
*/
|
|
23
|
+
export interface Comment {
|
|
24
|
+
id: number;
|
|
25
|
+
body: string;
|
|
26
|
+
author: User;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
htmlUrl: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Milestone
|
|
33
|
+
*/
|
|
34
|
+
export interface Milestone {
|
|
35
|
+
id: number;
|
|
36
|
+
number: number;
|
|
37
|
+
title: string;
|
|
38
|
+
description: string | null;
|
|
39
|
+
state: 'open' | 'closed';
|
|
40
|
+
dueOn: string | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* GitHub issue representation
|
|
44
|
+
*/
|
|
45
|
+
export interface Issue {
|
|
46
|
+
number: number;
|
|
47
|
+
title: string;
|
|
48
|
+
body: string | null;
|
|
49
|
+
state: 'open' | 'closed';
|
|
50
|
+
labels: Label[];
|
|
51
|
+
assignees: User[];
|
|
52
|
+
milestone: Milestone | null;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
closedAt: string | null;
|
|
56
|
+
author: User;
|
|
57
|
+
url: string;
|
|
58
|
+
htmlUrl: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Pull request reference
|
|
62
|
+
*/
|
|
63
|
+
export interface PullRequest {
|
|
64
|
+
number: number;
|
|
65
|
+
title: string;
|
|
66
|
+
state: 'open' | 'closed' | 'merged';
|
|
67
|
+
author: User;
|
|
68
|
+
htmlUrl: string;
|
|
69
|
+
linkedIssues: number[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parameters for creating an issue
|
|
73
|
+
*/
|
|
74
|
+
export interface CreateIssueParams {
|
|
75
|
+
title: string;
|
|
76
|
+
body?: string;
|
|
77
|
+
labels?: string[];
|
|
78
|
+
assignees?: string[];
|
|
79
|
+
milestone?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Parameters for updating an issue
|
|
83
|
+
*/
|
|
84
|
+
export interface UpdateIssueParams {
|
|
85
|
+
title?: string;
|
|
86
|
+
body?: string;
|
|
87
|
+
state?: 'open' | 'closed';
|
|
88
|
+
labels?: string[];
|
|
89
|
+
assignees?: string[];
|
|
90
|
+
milestone?: number | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Filter for listing issues
|
|
94
|
+
*/
|
|
95
|
+
export interface IssueFilter {
|
|
96
|
+
state?: 'open' | 'closed' | 'all';
|
|
97
|
+
labels?: string[];
|
|
98
|
+
assignee?: string;
|
|
99
|
+
creator?: string;
|
|
100
|
+
mentioned?: string;
|
|
101
|
+
milestone?: number | 'none' | '*';
|
|
102
|
+
since?: string;
|
|
103
|
+
sort?: 'created' | 'updated' | 'comments';
|
|
104
|
+
direction?: 'asc' | 'desc';
|
|
105
|
+
}
|
|
106
|
+
export declare const CreateIssueParamsSchema: z.ZodObject<{
|
|
107
|
+
title: z.ZodString;
|
|
108
|
+
body: z.ZodOptional<z.ZodString>;
|
|
109
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
110
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
111
|
+
milestone: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
title: string;
|
|
114
|
+
body?: string | undefined;
|
|
115
|
+
labels?: string[] | undefined;
|
|
116
|
+
assignees?: string[] | undefined;
|
|
117
|
+
milestone?: number | undefined;
|
|
118
|
+
}, {
|
|
119
|
+
title: string;
|
|
120
|
+
body?: string | undefined;
|
|
121
|
+
labels?: string[] | undefined;
|
|
122
|
+
assignees?: string[] | undefined;
|
|
123
|
+
milestone?: number | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
export declare const UpdateIssueParamsSchema: z.ZodObject<{
|
|
126
|
+
title: z.ZodOptional<z.ZodString>;
|
|
127
|
+
body: z.ZodOptional<z.ZodString>;
|
|
128
|
+
state: z.ZodOptional<z.ZodEnum<["open", "closed"]>>;
|
|
129
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
130
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
milestone: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
title?: string | undefined;
|
|
134
|
+
body?: string | undefined;
|
|
135
|
+
labels?: string[] | undefined;
|
|
136
|
+
assignees?: string[] | undefined;
|
|
137
|
+
milestone?: number | null | undefined;
|
|
138
|
+
state?: "open" | "closed" | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
title?: string | undefined;
|
|
141
|
+
body?: string | undefined;
|
|
142
|
+
labels?: string[] | undefined;
|
|
143
|
+
assignees?: string[] | undefined;
|
|
144
|
+
milestone?: number | null | undefined;
|
|
145
|
+
state?: "open" | "closed" | undefined;
|
|
146
|
+
}>;
|
|
147
|
+
export declare const IssueFilterSchema: z.ZodObject<{
|
|
148
|
+
state: z.ZodOptional<z.ZodEnum<["open", "closed", "all"]>>;
|
|
149
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
150
|
+
assignee: z.ZodOptional<z.ZodString>;
|
|
151
|
+
creator: z.ZodOptional<z.ZodString>;
|
|
152
|
+
mentioned: z.ZodOptional<z.ZodString>;
|
|
153
|
+
milestone: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"none">, z.ZodLiteral<"*">]>>;
|
|
154
|
+
since: z.ZodOptional<z.ZodString>;
|
|
155
|
+
sort: z.ZodOptional<z.ZodEnum<["created", "updated", "comments"]>>;
|
|
156
|
+
direction: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
157
|
+
}, "strip", z.ZodTypeAny, {
|
|
158
|
+
sort?: "created" | "updated" | "comments" | undefined;
|
|
159
|
+
labels?: string[] | undefined;
|
|
160
|
+
milestone?: number | "none" | "*" | undefined;
|
|
161
|
+
state?: "all" | "open" | "closed" | undefined;
|
|
162
|
+
assignee?: string | undefined;
|
|
163
|
+
creator?: string | undefined;
|
|
164
|
+
mentioned?: string | undefined;
|
|
165
|
+
since?: string | undefined;
|
|
166
|
+
direction?: "asc" | "desc" | undefined;
|
|
167
|
+
}, {
|
|
168
|
+
sort?: "created" | "updated" | "comments" | undefined;
|
|
169
|
+
labels?: string[] | undefined;
|
|
170
|
+
milestone?: number | "none" | "*" | undefined;
|
|
171
|
+
state?: "all" | "open" | "closed" | undefined;
|
|
172
|
+
assignee?: string | undefined;
|
|
173
|
+
creator?: string | undefined;
|
|
174
|
+
mentioned?: string | undefined;
|
|
175
|
+
since?: string | undefined;
|
|
176
|
+
direction?: "asc" | "desc" | undefined;
|
|
177
|
+
}>;
|
|
178
|
+
//# sourceMappingURL=issues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/types/issues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,cAAc,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,C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M,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1C,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B;AAID,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;EAMlC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;EAOlC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU5B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Zod schemas for validation
|
|
3
|
+
export const CreateIssueParamsSchema = z.object({
|
|
4
|
+
title: z.string().min(1, 'Title is required').max(256, 'Title must be 256 characters or less'),
|
|
5
|
+
body: z.string().max(65536, 'Body must be 65536 characters or less').optional(),
|
|
6
|
+
labels: z.array(z.string()).optional(),
|
|
7
|
+
assignees: z.array(z.string()).optional(),
|
|
8
|
+
milestone: z.number().positive('Milestone must be positive').optional(),
|
|
9
|
+
});
|
|
10
|
+
export const UpdateIssueParamsSchema = z.object({
|
|
11
|
+
title: z.string().min(1).max(256).optional(),
|
|
12
|
+
body: z.string().max(65536).optional(),
|
|
13
|
+
state: z.enum(['open', 'closed']).optional(),
|
|
14
|
+
labels: z.array(z.string()).optional(),
|
|
15
|
+
assignees: z.array(z.string()).optional(),
|
|
16
|
+
milestone: z.number().positive().nullable().optional(),
|
|
17
|
+
});
|
|
18
|
+
export const IssueFilterSchema = z.object({
|
|
19
|
+
state: z.enum(['open', 'closed', 'all']).optional(),
|
|
20
|
+
labels: z.array(z.string()).optional(),
|
|
21
|
+
assignee: z.string().optional(),
|
|
22
|
+
creator: z.string().optional(),
|
|
23
|
+
mentioned: z.string().optional(),
|
|
24
|
+
milestone: z.union([z.number(), z.literal('none'), z.literal('*')]).optional(),
|
|
25
|
+
since: z.string().datetime().optional(),
|
|
26
|
+
sort: z.enum(['created', 'updated', 'comments']).optional(),
|
|
27
|
+
direction: z.enum(['asc', 'desc']).optional(),
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.js","sourceRoot":"","sources":["../../src/types/issues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmHxB,6BAA6B;AAE7B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,sCAAsC,CAAC;IAC9F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,uCAAuC,CAAC,CAAC,QAAQ,EAAE;IAC/E,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACtC,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AC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACvC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3D,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow action types returned by webhook handler
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Action to queue an issue for processing
|
|
6
|
+
*/
|
|
7
|
+
export interface QueueForProcessingAction {
|
|
8
|
+
type: 'queue_for_processing';
|
|
9
|
+
issueNumber: number;
|
|
10
|
+
priority?: 'high' | 'normal' | 'low';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Action to start a workflow on an issue
|
|
14
|
+
*/
|
|
15
|
+
export interface StartWorkflowAction {
|
|
16
|
+
type: 'start_workflow';
|
|
17
|
+
issueNumber: number;
|
|
18
|
+
workflowType?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Action to resume a paused workflow
|
|
22
|
+
*/
|
|
23
|
+
export interface ResumeWorkflowAction {
|
|
24
|
+
type: 'resume_workflow';
|
|
25
|
+
issueNumber: number;
|
|
26
|
+
triggeredBy: 'comment' | 'label';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* No action needed for this event
|
|
30
|
+
*/
|
|
31
|
+
export interface NoAction {
|
|
32
|
+
type: 'no_action';
|
|
33
|
+
reason: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Union of all possible workflow actions
|
|
37
|
+
*/
|
|
38
|
+
export type WorkflowAction = QueueForProcessingAction | StartWorkflowAction | ResumeWorkflowAction | NoAction;
|
|
39
|
+
/**
|
|
40
|
+
* Result of a successful API operation
|
|
41
|
+
*/
|
|
42
|
+
export interface OperationResult<T> {
|
|
43
|
+
success: true;
|
|
44
|
+
data: T;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Result of a failed API operation
|
|
48
|
+
*/
|
|
49
|
+
export interface OperationError {
|
|
50
|
+
success: false;
|
|
51
|
+
error: {
|
|
52
|
+
code: string;
|
|
53
|
+
message: string;
|
|
54
|
+
details?: unknown;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Generic operation result type
|
|
59
|
+
*/
|
|
60
|
+
export type OperationResponse<T> = OperationResult<T> | OperationError;
|
|
61
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/types/responses.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,iBAAiB,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,mBAAmB,GACnB,oBAAoB,GACpB,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/types/responses.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for GitHub Issues plugin
|
|
3
|
+
*/
|
|
4
|
+
export declare class GitHubIssuesError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly cause?: unknown | undefined;
|
|
7
|
+
constructor(message: string, code: string, cause?: unknown | undefined);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Authentication failure error
|
|
11
|
+
*/
|
|
12
|
+
export declare class GitHubAuthError extends GitHubIssuesError {
|
|
13
|
+
constructor(message?: string, cause?: unknown);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* GitHub App authentication error codes
|
|
17
|
+
*/
|
|
18
|
+
export declare enum GitHubAppErrorCode {
|
|
19
|
+
INVALID_PRIVATE_KEY = "INVALID_PRIVATE_KEY",
|
|
20
|
+
PRIVATE_KEY_NOT_FOUND = "PRIVATE_KEY_NOT_FOUND",
|
|
21
|
+
INSTALLATION_NOT_FOUND = "INSTALLATION_NOT_FOUND",
|
|
22
|
+
TOKEN_GENERATION_FAILED = "TOKEN_GENERATION_FAILED",
|
|
23
|
+
JWT_GENERATION_FAILED = "JWT_GENERATION_FAILED"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* GitHub App authentication specific error
|
|
27
|
+
*/
|
|
28
|
+
export declare class GitHubAppAuthError extends GitHubIssuesError {
|
|
29
|
+
readonly errorCode: GitHubAppErrorCode;
|
|
30
|
+
constructor(message: string, errorCode: GitHubAppErrorCode, cause?: unknown);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rate limit exceeded error
|
|
34
|
+
*/
|
|
35
|
+
export declare class GitHubRateLimitError extends GitHubIssuesError {
|
|
36
|
+
readonly resetAt?: Date | undefined;
|
|
37
|
+
constructor(message?: string, resetAt?: Date | undefined, cause?: unknown);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resource not found error
|
|
41
|
+
*/
|
|
42
|
+
export declare class GitHubNotFoundError extends GitHubIssuesError {
|
|
43
|
+
constructor(resource: string, identifier: string | number, cause?: unknown);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Input validation error
|
|
47
|
+
*/
|
|
48
|
+
export declare class GitHubValidationError extends GitHubIssuesError {
|
|
49
|
+
readonly details?: Record<string, string[]> | undefined;
|
|
50
|
+
constructor(message: string, details?: Record<string, string[]> | undefined, cause?: unknown);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Webhook signature verification error
|
|
54
|
+
*/
|
|
55
|
+
export declare class WebhookVerificationError extends GitHubIssuesError {
|
|
56
|
+
constructor(message?: string, cause?: unknown);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if an error is a GitHub API error
|
|
60
|
+
*/
|
|
61
|
+
export declare function isGitHubApiError(error: unknown): error is {
|
|
62
|
+
status: number;
|
|
63
|
+
message: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Convert GitHub API error to plugin error
|
|
67
|
+
*/
|
|
68
|
+
export declare function wrapGitHubError(error: unknown, context?: string): GitHubIssuesError;
|
|
69
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;aAGxB,IAAI,EAAE,MAAM;aACZ,KAAK,CAAC,EAAE,OAAO;gBAF/B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,OAAO,YAAA;CAMlC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,iBAAiB;gBACxC,OAAO,SAAiC,EAAE,KAAK,CAAC,EAAE,OAAO;CAItE;AAED;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,mBAAmB,wBAAwB;IAC3C,qBAAqB,0BAA0B;IAC/C,sBAAsB,2BAA2B;IACjD,uBAAuB,4BAA4B;IACnD,qBAAqB,0BAA0B;CAChD;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;aAGrC,SAAS,EAAE,kBAAkB;gBAD7C,OAAO,EAAE,MAAM,EACC,SAAS,EAAE,kBAAkB,EAC7C,KAAK,CAAC,EAAE,OAAO;CAKlB;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;aAGvC,OAAO,CAAC,EAAE,IAAI;gBAD9B,OAAO,SAAmC,EAC1B,OAAO,CAAC,EAAE,IAAI,YAAA,EAC9B,KAAK,CAAC,EAAE,OAAO;CAKlB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,iBAAiB;gBAEtD,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,KAAK,CAAC,EAAE,OAAO;CAKlB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;aAGxC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;gBADlD,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,YAAA,EAClD,KAAK,CAAC,EAAE,OAAO;CAKlB;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB;gBACjD,OAAO,SAA8B,EAAE,KAAK,CAAC,EAAE,OAAO;CAInE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAO7F;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,iBAAiB,CA4BnF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for GitHub Issues plugin
|
|
3
|
+
*/
|
|
4
|
+
export class GitHubIssuesError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
cause;
|
|
7
|
+
constructor(message, code, cause) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.cause = cause;
|
|
11
|
+
this.name = 'GitHubIssuesError';
|
|
12
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Authentication failure error
|
|
17
|
+
*/
|
|
18
|
+
export class GitHubAuthError extends GitHubIssuesError {
|
|
19
|
+
constructor(message = 'GitHub authentication failed', cause) {
|
|
20
|
+
super(message, 'AUTH_ERROR', cause);
|
|
21
|
+
this.name = 'GitHubAuthError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* GitHub App authentication error codes
|
|
26
|
+
*/
|
|
27
|
+
export var GitHubAppErrorCode;
|
|
28
|
+
(function (GitHubAppErrorCode) {
|
|
29
|
+
GitHubAppErrorCode["INVALID_PRIVATE_KEY"] = "INVALID_PRIVATE_KEY";
|
|
30
|
+
GitHubAppErrorCode["PRIVATE_KEY_NOT_FOUND"] = "PRIVATE_KEY_NOT_FOUND";
|
|
31
|
+
GitHubAppErrorCode["INSTALLATION_NOT_FOUND"] = "INSTALLATION_NOT_FOUND";
|
|
32
|
+
GitHubAppErrorCode["TOKEN_GENERATION_FAILED"] = "TOKEN_GENERATION_FAILED";
|
|
33
|
+
GitHubAppErrorCode["JWT_GENERATION_FAILED"] = "JWT_GENERATION_FAILED";
|
|
34
|
+
})(GitHubAppErrorCode || (GitHubAppErrorCode = {}));
|
|
35
|
+
/**
|
|
36
|
+
* GitHub App authentication specific error
|
|
37
|
+
*/
|
|
38
|
+
export class GitHubAppAuthError extends GitHubIssuesError {
|
|
39
|
+
errorCode;
|
|
40
|
+
constructor(message, errorCode, cause) {
|
|
41
|
+
super(message, errorCode, cause);
|
|
42
|
+
this.errorCode = errorCode;
|
|
43
|
+
this.name = 'GitHubAppAuthError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Rate limit exceeded error
|
|
48
|
+
*/
|
|
49
|
+
export class GitHubRateLimitError extends GitHubIssuesError {
|
|
50
|
+
resetAt;
|
|
51
|
+
constructor(message = 'GitHub API rate limit exceeded', resetAt, cause) {
|
|
52
|
+
super(message, 'RATE_LIMIT_ERROR', cause);
|
|
53
|
+
this.resetAt = resetAt;
|
|
54
|
+
this.name = 'GitHubRateLimitError';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resource not found error
|
|
59
|
+
*/
|
|
60
|
+
export class GitHubNotFoundError extends GitHubIssuesError {
|
|
61
|
+
constructor(resource, identifier, cause) {
|
|
62
|
+
super(`${resource} '${identifier}' not found`, 'NOT_FOUND_ERROR', cause);
|
|
63
|
+
this.name = 'GitHubNotFoundError';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Input validation error
|
|
68
|
+
*/
|
|
69
|
+
export class GitHubValidationError extends GitHubIssuesError {
|
|
70
|
+
details;
|
|
71
|
+
constructor(message, details, cause) {
|
|
72
|
+
super(message, 'VALIDATION_ERROR', cause);
|
|
73
|
+
this.details = details;
|
|
74
|
+
this.name = 'GitHubValidationError';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Webhook signature verification error
|
|
79
|
+
*/
|
|
80
|
+
export class WebhookVerificationError extends GitHubIssuesError {
|
|
81
|
+
constructor(message = 'Invalid webhook signature', cause) {
|
|
82
|
+
super(message, 'WEBHOOK_VERIFICATION_ERROR', cause);
|
|
83
|
+
this.name = 'WebhookVerificationError';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Check if an error is a GitHub API error
|
|
88
|
+
*/
|
|
89
|
+
export function isGitHubApiError(error) {
|
|
90
|
+
return (typeof error === 'object' &&
|
|
91
|
+
error !== null &&
|
|
92
|
+
'status' in error &&
|
|
93
|
+
typeof error.status === 'number');
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Convert GitHub API error to plugin error
|
|
97
|
+
*/
|
|
98
|
+
export function wrapGitHubError(error, context) {
|
|
99
|
+
if (error instanceof GitHubIssuesError) {
|
|
100
|
+
return error;
|
|
101
|
+
}
|
|
102
|
+
if (isGitHubApiError(error)) {
|
|
103
|
+
const prefix = context ? `${context}: ` : '';
|
|
104
|
+
switch (error.status) {
|
|
105
|
+
case 401:
|
|
106
|
+
case 403:
|
|
107
|
+
return new GitHubAuthError(`${prefix}${error.message}`, error);
|
|
108
|
+
case 404:
|
|
109
|
+
return new GitHubNotFoundError('Resource', context ?? 'unknown', error);
|
|
110
|
+
case 422:
|
|
111
|
+
return new GitHubValidationError(`${prefix}${error.message}`, undefined, error);
|
|
112
|
+
case 429:
|
|
113
|
+
return new GitHubRateLimitError(`${prefix}${error.message}`, undefined, error);
|
|
114
|
+
default:
|
|
115
|
+
return new GitHubIssuesError(`${prefix}${error.message}`, 'API_ERROR', error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (error instanceof Error) {
|
|
119
|
+
return new GitHubIssuesError(error.message, 'UNKNOWN_ERROR', error);
|
|
120
|
+
}
|
|
121
|
+
return new GitHubIssuesError(String(error), 'UNKNOWN_ERROR', error);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAGxB;IACA;IAHlB,YACE,OAAe,EACC,IAAY,EACZ,KAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAU;QAG/B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IACpD,YAAY,OAAO,GAAG,8BAA8B,EAAE,KAAe;QACnE,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,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CAAC;YACjF;gBACE,OAAO,IAAI,iBAAiB,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z, type ZodSchema } from 'zod';
|
|
2
|
+
import { GitHubIssuesConfigSchema, CreateIssueParamsSchema, UpdateIssueParamsSchema, IssueFilterSchema } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validate data against a Zod schema
|
|
5
|
+
* @throws GitHubValidationError if validation fails
|
|
6
|
+
*/
|
|
7
|
+
export declare function validate<T>(schema: ZodSchema<T>, data: unknown, context?: string): T;
|
|
8
|
+
/**
|
|
9
|
+
* Validate configuration
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateConfig(config: unknown): z.infer<typeof GitHubIssuesConfigSchema>;
|
|
12
|
+
/**
|
|
13
|
+
* Validate create issue parameters
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateCreateIssueParams(params: unknown): z.infer<typeof CreateIssueParamsSchema>;
|
|
16
|
+
/**
|
|
17
|
+
* Validate update issue parameters
|
|
18
|
+
*/
|
|
19
|
+
export declare function validateUpdateIssueParams(params: unknown): z.infer<typeof UpdateIssueParamsSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* Validate issue filter parameters
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateIssueFilter(filter: unknown): z.infer<typeof IssueFilterSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Check if a value is a non-empty string
|
|
26
|
+
*/
|
|
27
|
+
export declare function isNonEmptyString(value: unknown): value is string;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a value is a positive integer
|
|
30
|
+
*/
|
|
31
|
+
export declare function isPositiveInteger(value: unknown): value is number;
|
|
32
|
+
export { GitHubIssuesConfigSchema, CreateIssueParamsSchema, UpdateIssueParamsSchema, IssueFilterSchema, };
|
|
33
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,SAAS,EAAiB,MAAM,KAAK,CAAC;AAEvD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAmB3B;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAWpF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAExF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,GACd,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAEzC;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,GACd,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAEzC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAEtF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEjE;AAGD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,CAAC"}
|