@generacy-ai/generacy-plugin-jira 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/client.d.ts +81 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +163 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/comments.d.ts +35 -0
- package/dist/operations/comments.d.ts.map +1 -0
- package/dist/operations/comments.js +128 -0
- package/dist/operations/comments.js.map +1 -0
- package/dist/operations/custom-fields.d.ts +48 -0
- package/dist/operations/custom-fields.d.ts.map +1 -0
- package/dist/operations/custom-fields.js +184 -0
- package/dist/operations/custom-fields.js.map +1 -0
- package/dist/operations/issues.d.ts +34 -0
- package/dist/operations/issues.d.ts.map +1 -0
- package/dist/operations/issues.js +215 -0
- package/dist/operations/issues.js.map +1 -0
- package/dist/operations/search.d.ts +47 -0
- package/dist/operations/search.d.ts.map +1 -0
- package/dist/operations/search.js +174 -0
- package/dist/operations/search.js.map +1 -0
- package/dist/operations/sprints.d.ts +54 -0
- package/dist/operations/sprints.d.ts.map +1 -0
- package/dist/operations/sprints.js +196 -0
- package/dist/operations/sprints.js.map +1 -0
- package/dist/operations/transitions.d.ts +41 -0
- package/dist/operations/transitions.d.ts.map +1 -0
- package/dist/operations/transitions.js +135 -0
- package/dist/operations/transitions.js.map +1 -0
- package/dist/plugin.d.ts +221 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +403 -0
- package/dist/plugin.js.map +1 -0
- package/dist/types/config.d.ts +149 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +33 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/custom-fields.d.ts +48 -0
- package/dist/types/custom-fields.d.ts.map +1 -0
- package/dist/types/custom-fields.js +2 -0
- package/dist/types/custom-fields.js.map +1 -0
- package/dist/types/events.d.ts +250 -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 +9 -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/types/issues.d.ts +139 -0
- package/dist/types/issues.d.ts.map +1 -0
- package/dist/types/issues.js +2 -0
- package/dist/types/issues.js.map +1 -0
- package/dist/types/projects.d.ts +48 -0
- package/dist/types/projects.d.ts.map +1 -0
- package/dist/types/projects.js +2 -0
- package/dist/types/projects.js.map +1 -0
- package/dist/types/sprints.d.ts +26 -0
- package/dist/types/sprints.d.ts.map +1 -0
- package/dist/types/sprints.js +2 -0
- package/dist/types/sprints.js.map +1 -0
- package/dist/types/workflows.d.ts +60 -0
- package/dist/types/workflows.d.ts.map +1 -0
- package/dist/types/workflows.js +2 -0
- package/dist/types/workflows.js.map +1 -0
- package/dist/utils/adf.d.ts +26 -0
- package/dist/utils/adf.d.ts.map +1 -0
- package/dist/utils/adf.js +104 -0
- package/dist/utils/adf.js.map +1 -0
- package/dist/utils/errors.d.ts +60 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +117 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/jql-builder.d.ts +148 -0
- package/dist/utils/jql-builder.d.ts.map +1 -0
- package/dist/utils/jql-builder.js +264 -0
- package/dist/utils/jql-builder.js.map +1 -0
- package/dist/utils/validation.d.ts +31 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +75 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/webhooks/handler.d.ts +80 -0
- package/dist/webhooks/handler.d.ts.map +1 -0
- package/dist/webhooks/handler.js +130 -0
- package/dist/webhooks/handler.js.map +1 -0
- package/dist/webhooks/parser.d.ts +34 -0
- package/dist/webhooks/parser.d.ts.map +1 -0
- package/dist/webhooks/parser.js +155 -0
- package/dist/webhooks/parser.js.map +1 -0
- package/dist/webhooks/types.d.ts +94 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/dist/webhooks/types.js +2 -0
- package/dist/webhooks/types.js.map +1 -0
- package/dist/webhooks/verify.d.ts +53 -0
- package/dist/webhooks/verify.d.ts.map +1 -0
- package/dist/webhooks/verify.js +140 -0
- package/dist/webhooks/verify.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ensureIssueKey } from '../utils/validation.js';
|
|
2
|
+
import { wrapJiraError, JiraTransitionError, JiraNotFoundError } from '../utils/errors.js';
|
|
3
|
+
import { ensureAdf } from '../utils/adf.js';
|
|
4
|
+
/**
|
|
5
|
+
* Map API response to Transition
|
|
6
|
+
*/
|
|
7
|
+
function mapTransition(raw) {
|
|
8
|
+
return {
|
|
9
|
+
id: raw.id,
|
|
10
|
+
name: raw.name,
|
|
11
|
+
to: raw.to,
|
|
12
|
+
hasScreen: raw.hasScreen ?? false,
|
|
13
|
+
isGlobal: raw.isGlobal ?? false,
|
|
14
|
+
isInitial: raw.isInitial ?? false,
|
|
15
|
+
isConditional: raw.isConditional ?? false,
|
|
16
|
+
fields: raw.fields,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Transition (workflow) operations
|
|
21
|
+
*/
|
|
22
|
+
export class TransitionOperations {
|
|
23
|
+
client;
|
|
24
|
+
constructor(client) {
|
|
25
|
+
this.client = client;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get available transitions for an issue
|
|
29
|
+
*/
|
|
30
|
+
async getTransitions(issueKey) {
|
|
31
|
+
const key = ensureIssueKey(issueKey);
|
|
32
|
+
try {
|
|
33
|
+
const response = await this.client.v3.issues.getTransitions({
|
|
34
|
+
issueIdOrKey: key,
|
|
35
|
+
expand: 'transitions.fields',
|
|
36
|
+
});
|
|
37
|
+
return (response.transitions ?? []).map((t) => mapTransition(t));
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw wrapJiraError(error, `Failed to get transitions for ${key}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async transition(issueKey, transitionIdOrParams, options) {
|
|
44
|
+
const key = ensureIssueKey(issueKey);
|
|
45
|
+
let transitionId;
|
|
46
|
+
let fields;
|
|
47
|
+
let comment;
|
|
48
|
+
if (typeof transitionIdOrParams === 'string') {
|
|
49
|
+
transitionId = transitionIdOrParams;
|
|
50
|
+
fields = options?.fields;
|
|
51
|
+
comment = options?.comment;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
transitionId = transitionIdOrParams.transitionId;
|
|
55
|
+
fields = transitionIdOrParams.fields;
|
|
56
|
+
comment = transitionIdOrParams.comment;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const requestBody = {
|
|
60
|
+
transition: { id: transitionId },
|
|
61
|
+
};
|
|
62
|
+
if (fields) {
|
|
63
|
+
requestBody.fields = fields;
|
|
64
|
+
}
|
|
65
|
+
if (comment) {
|
|
66
|
+
requestBody.update = {
|
|
67
|
+
comment: [{ add: { body: ensureAdf(comment) } }],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
await this.client.v3.issues.doTransition({
|
|
71
|
+
issueIdOrKey: key,
|
|
72
|
+
...requestBody,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
// If transition failed, provide helpful error with available transitions
|
|
77
|
+
if (typeof error === 'object' && error !== null && 'status' in error) {
|
|
78
|
+
const status = error.status;
|
|
79
|
+
if (status === 400 || status === 422) {
|
|
80
|
+
const available = await this.getTransitions(key);
|
|
81
|
+
throw new JiraTransitionError(`Transition '${transitionId}' is not available for issue ${key}`, available, error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
throw wrapJiraError(error, `Failed to transition ${key}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Transition an issue by target status name
|
|
89
|
+
*/
|
|
90
|
+
async transitionToStatus(issueKey, targetStatusName, options) {
|
|
91
|
+
const key = ensureIssueKey(issueKey);
|
|
92
|
+
const transitions = await this.getTransitions(key);
|
|
93
|
+
// Find transition that leads to the target status
|
|
94
|
+
const transition = transitions.find((t) => t.to.name.toLowerCase() === targetStatusName.toLowerCase());
|
|
95
|
+
if (!transition) {
|
|
96
|
+
throw new JiraTransitionError(`No transition available to status '${targetStatusName}' for issue ${key}`, transitions);
|
|
97
|
+
}
|
|
98
|
+
await this.transition(key, transition.id, options);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get the current status of an issue
|
|
102
|
+
*/
|
|
103
|
+
async getStatus(issueKey) {
|
|
104
|
+
const key = ensureIssueKey(issueKey);
|
|
105
|
+
try {
|
|
106
|
+
const response = await this.client.v3.issues.getIssue({
|
|
107
|
+
issueIdOrKey: key,
|
|
108
|
+
fields: ['status'],
|
|
109
|
+
});
|
|
110
|
+
const fields = response.fields;
|
|
111
|
+
return fields.status;
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
if (typeof error === 'object' && error !== null && 'status' in error && error.status === 404) {
|
|
115
|
+
throw new JiraNotFoundError('Issue', key, error);
|
|
116
|
+
}
|
|
117
|
+
throw wrapJiraError(error, `Failed to get status for ${key}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Check if a transition is available for an issue
|
|
122
|
+
*/
|
|
123
|
+
async isTransitionAvailable(issueKey, transitionName) {
|
|
124
|
+
const transitions = await this.getTransitions(issueKey);
|
|
125
|
+
return transitions.some((t) => t.name.toLowerCase() === transitionName.toLowerCase() ||
|
|
126
|
+
t.to.name.toLowerCase() === transitionName.toLowerCase());
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create transition operations instance
|
|
131
|
+
*/
|
|
132
|
+
export function createTransitionOperations(client) {
|
|
133
|
+
return new TransitionOperations(client);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=transitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.js","sourceRoot":"","sources":["../../src/operations/transitions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,SAAS,aAAa,CAAC,GAA4B;IACjD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAY;QACpB,IAAI,EAAE,GAAG,CAAC,IAAc;QACxB,EAAE,EAAE,GAAG,CAAC,EAAgB;QACxB,SAAS,EAAG,GAAG,CAAC,SAAqB,IAAI,KAAK;QAC9C,QAAQ,EAAG,GAAG,CAAC,QAAoB,IAAI,KAAK;QAC5C,SAAS,EAAG,GAAG,CAAC,SAAqB,IAAI,KAAK;QAC9C,aAAa,EAAG,GAAG,CAAC,aAAyB,IAAI,KAAK;QACtD,MAAM,EAAE,GAAG,CAAC,MAAqD;KAClE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,QAAgB;QACnC,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;QAErC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;gBAC1D,YAAY,EAAE,GAAG;gBACjB,MAAM,EAAE,oBAAoB;aAC7B,CAAC,CAAC;YACH,OAAO,CAAC,QAAQ,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG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ugin.d.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { Issue as LatencyIssue, IssueSpec as LatencyIssueSpec, IssueUpdate as LatencyIssueUpdate, IssueQuery as LatencyIssueQuery, Comment as LatencyComment, PaginatedResult } from '@generacy-ai/latency';
|
|
2
|
+
import { AbstractIssueTrackerPlugin } from '@generacy-ai/latency-plugin-issue-tracker';
|
|
3
|
+
import type { JiraConfig, JiraIssue, CreateJiraIssueParams, UpdateJiraIssueParams, SearchOptions, JiraComment, AddCommentParams, Transition, TransitionParams, CustomField, Sprint, Board, AdfDocument } from './types/index.js';
|
|
4
|
+
import { IssueOperations } from './operations/issues.js';
|
|
5
|
+
import { SearchOperations } from './operations/search.js';
|
|
6
|
+
import { CommentOperations } from './operations/comments.js';
|
|
7
|
+
import { TransitionOperations } from './operations/transitions.js';
|
|
8
|
+
import { CustomFieldOperations } from './operations/custom-fields.js';
|
|
9
|
+
import { SprintOperations } from './operations/sprints.js';
|
|
10
|
+
import { JiraWebhookHandler } from './webhooks/handler.js';
|
|
11
|
+
import type { JiraWebhookEvent, WebhookAction } from './webhooks/types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Jira Plugin for Generacy
|
|
14
|
+
*
|
|
15
|
+
* Extends AbstractIssueTrackerPlugin to provide the standard IssueTracker interface
|
|
16
|
+
* while also exposing Jira-specific functionality.
|
|
17
|
+
*
|
|
18
|
+
* Provides programmatic access to Jira functionality including:
|
|
19
|
+
* - Issue CRUD operations (via IssueTracker interface)
|
|
20
|
+
* - JQL search with async iteration
|
|
21
|
+
* - Workflow transitions
|
|
22
|
+
* - Custom field management
|
|
23
|
+
* - Sprint operations
|
|
24
|
+
* - Webhook event processing
|
|
25
|
+
*/
|
|
26
|
+
export declare class JiraPlugin extends AbstractIssueTrackerPlugin {
|
|
27
|
+
private readonly client;
|
|
28
|
+
private readonly issueOps;
|
|
29
|
+
private readonly searchOps;
|
|
30
|
+
private readonly commentOps;
|
|
31
|
+
private readonly transitionOps;
|
|
32
|
+
private readonly customFieldOps;
|
|
33
|
+
private readonly sprintOps;
|
|
34
|
+
private readonly webhookHandler;
|
|
35
|
+
private readonly defaultProjectKey?;
|
|
36
|
+
constructor(config: JiraConfig);
|
|
37
|
+
/**
|
|
38
|
+
* Fetch a single issue from Jira (implements abstract method)
|
|
39
|
+
*/
|
|
40
|
+
protected fetchIssue(id: string): Promise<LatencyIssue>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a new issue in Jira (implements abstract method)
|
|
43
|
+
*/
|
|
44
|
+
protected doCreateIssue(spec: LatencyIssueSpec): Promise<LatencyIssue>;
|
|
45
|
+
/**
|
|
46
|
+
* Update an existing issue (implements abstract method)
|
|
47
|
+
*/
|
|
48
|
+
protected doUpdateIssue(id: string, update: LatencyIssueUpdate): Promise<LatencyIssue>;
|
|
49
|
+
/**
|
|
50
|
+
* List issues matching the query (implements abstract method)
|
|
51
|
+
*/
|
|
52
|
+
protected doListIssues(query: LatencyIssueQuery): Promise<PaginatedResult<LatencyIssue>>;
|
|
53
|
+
/**
|
|
54
|
+
* Add a comment to an issue (implements abstract method)
|
|
55
|
+
*/
|
|
56
|
+
protected doAddComment(issueId: string, comment: string): Promise<LatencyComment>;
|
|
57
|
+
/**
|
|
58
|
+
* List comments for an issue (implements abstract method)
|
|
59
|
+
*/
|
|
60
|
+
protected doListComments(issueId: string): Promise<LatencyComment[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new issue (Jira-specific version with full return type)
|
|
63
|
+
*/
|
|
64
|
+
createJiraIssue(params: CreateJiraIssueParams): Promise<JiraIssue>;
|
|
65
|
+
/**
|
|
66
|
+
* Get an issue by key or ID (Jira-specific version with full return type)
|
|
67
|
+
*/
|
|
68
|
+
getJiraIssue(keyOrId: string): Promise<JiraIssue>;
|
|
69
|
+
/**
|
|
70
|
+
* Update an issue (Jira-specific version)
|
|
71
|
+
*/
|
|
72
|
+
updateJiraIssue(keyOrId: string, params: UpdateJiraIssueParams): Promise<JiraIssue>;
|
|
73
|
+
/**
|
|
74
|
+
* Delete an issue
|
|
75
|
+
*/
|
|
76
|
+
deleteIssue(keyOrId: string, deleteSubtasks?: boolean): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Assign an issue to a user
|
|
79
|
+
*/
|
|
80
|
+
assignIssue(keyOrId: string, accountId: string | null): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Search issues using JQL (returns async iterator)
|
|
83
|
+
*/
|
|
84
|
+
searchJiraIssues(jql: string, options?: SearchOptions): AsyncGenerator<JiraIssue>;
|
|
85
|
+
/**
|
|
86
|
+
* Search issues and return all results as array
|
|
87
|
+
*/
|
|
88
|
+
searchJiraIssuesAll(jql: string, options?: SearchOptions): Promise<JiraIssue[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Count issues matching a JQL query
|
|
91
|
+
*/
|
|
92
|
+
countIssues(jql: string): Promise<number>;
|
|
93
|
+
/**
|
|
94
|
+
* Add a comment to an issue (Jira-specific version with full return type)
|
|
95
|
+
*/
|
|
96
|
+
addJiraComment(issueKey: string, body: string | AdfDocument): Promise<JiraComment>;
|
|
97
|
+
addJiraComment(issueKey: string, params: AddCommentParams): Promise<JiraComment>;
|
|
98
|
+
/**
|
|
99
|
+
* Get all comments for an issue
|
|
100
|
+
*/
|
|
101
|
+
getComments(issueKey: string): Promise<JiraComment[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Update a comment
|
|
104
|
+
*/
|
|
105
|
+
updateComment(issueKey: string, commentId: string, body: string | AdfDocument): Promise<JiraComment>;
|
|
106
|
+
/**
|
|
107
|
+
* Delete a comment
|
|
108
|
+
*/
|
|
109
|
+
deleteComment(issueKey: string, commentId: string): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Get available transitions for an issue
|
|
112
|
+
*/
|
|
113
|
+
getTransitions(issueKey: string): Promise<Transition[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Transition an issue
|
|
116
|
+
*/
|
|
117
|
+
transitionIssue(issueKey: string, transitionId: string, options?: {
|
|
118
|
+
fields?: Record<string, unknown>;
|
|
119
|
+
comment?: string;
|
|
120
|
+
}): Promise<void>;
|
|
121
|
+
transitionIssue(issueKey: string, params: TransitionParams): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Transition an issue to a specific status by name
|
|
124
|
+
*/
|
|
125
|
+
transitionToStatus(issueKey: string, statusName: string, options?: {
|
|
126
|
+
fields?: Record<string, unknown>;
|
|
127
|
+
comment?: string;
|
|
128
|
+
}): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Get all custom fields
|
|
131
|
+
*/
|
|
132
|
+
getCustomFields(): Promise<CustomField[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Get a custom field by ID
|
|
135
|
+
*/
|
|
136
|
+
getCustomField(fieldId: string): Promise<CustomField>;
|
|
137
|
+
/**
|
|
138
|
+
* Set a custom field value
|
|
139
|
+
*/
|
|
140
|
+
setCustomField(issueKey: string, fieldId: string, value: unknown): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Get the active sprint for a board
|
|
143
|
+
*/
|
|
144
|
+
getActiveSprint(boardId: number): Promise<Sprint | null>;
|
|
145
|
+
/**
|
|
146
|
+
* Get all sprints for a board
|
|
147
|
+
*/
|
|
148
|
+
getSprintsForBoard(boardId: number): Promise<Sprint[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Add an issue to a sprint
|
|
151
|
+
*/
|
|
152
|
+
addToSprint(issueKey: string, sprintId: number): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Get boards for a project
|
|
155
|
+
*/
|
|
156
|
+
getBoardsForProject(projectKey: string): Promise<Board[]>;
|
|
157
|
+
/**
|
|
158
|
+
* Handle a webhook event
|
|
159
|
+
* Returns the parsed action from the event
|
|
160
|
+
*/
|
|
161
|
+
handleWebhook(event: JiraWebhookEvent): Promise<WebhookAction>;
|
|
162
|
+
/**
|
|
163
|
+
* Handle a raw webhook payload
|
|
164
|
+
*/
|
|
165
|
+
handleRawWebhook(payload: unknown): Promise<WebhookAction>;
|
|
166
|
+
/**
|
|
167
|
+
* Verify authentication
|
|
168
|
+
*/
|
|
169
|
+
verifyAuth(): Promise<{
|
|
170
|
+
accountId: string;
|
|
171
|
+
displayName: string;
|
|
172
|
+
email: string;
|
|
173
|
+
}>;
|
|
174
|
+
/**
|
|
175
|
+
* Check connectivity
|
|
176
|
+
*/
|
|
177
|
+
checkConnection(): Promise<{
|
|
178
|
+
version: string;
|
|
179
|
+
baseUrl: string;
|
|
180
|
+
}>;
|
|
181
|
+
/**
|
|
182
|
+
* Get the Jira host URL
|
|
183
|
+
*/
|
|
184
|
+
get host(): string;
|
|
185
|
+
/**
|
|
186
|
+
* Get the default project key
|
|
187
|
+
*/
|
|
188
|
+
get projectKey(): string | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Access to underlying operations for advanced usage
|
|
191
|
+
*/
|
|
192
|
+
get operations(): {
|
|
193
|
+
issues: IssueOperations;
|
|
194
|
+
search: SearchOperations;
|
|
195
|
+
comments: CommentOperations;
|
|
196
|
+
transitions: TransitionOperations;
|
|
197
|
+
customFields: CustomFieldOperations;
|
|
198
|
+
sprints: SprintOperations;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Access to webhook handler for advanced usage
|
|
202
|
+
*/
|
|
203
|
+
get webhook(): JiraWebhookHandler;
|
|
204
|
+
/**
|
|
205
|
+
* Map a Jira Issue to the Latency Issue type
|
|
206
|
+
*/
|
|
207
|
+
private mapToLatencyIssue;
|
|
208
|
+
/**
|
|
209
|
+
* Map a Jira Comment to the Latency Comment type
|
|
210
|
+
*/
|
|
211
|
+
private mapToLatencyComment;
|
|
212
|
+
/**
|
|
213
|
+
* Convert ADF document to plain string
|
|
214
|
+
*/
|
|
215
|
+
private adfToString;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Create a new Jira plugin instance
|
|
219
|
+
*/
|
|
220
|
+
export declare function createPlugin(config: JiraConfig): JiraPlugin;
|
|
221
|
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