@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,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a value is an ADF document
|
|
3
|
+
*/
|
|
4
|
+
export function isAdfDocument(value) {
|
|
5
|
+
return (typeof value === 'object' &&
|
|
6
|
+
value !== null &&
|
|
7
|
+
'version' in value &&
|
|
8
|
+
value.version === 1 &&
|
|
9
|
+
'type' in value &&
|
|
10
|
+
value.type === 'doc' &&
|
|
11
|
+
'content' in value &&
|
|
12
|
+
Array.isArray(value.content));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert plain text to ADF document
|
|
16
|
+
*/
|
|
17
|
+
export function textToAdf(text) {
|
|
18
|
+
// Split text into paragraphs by double newlines
|
|
19
|
+
const paragraphs = text.split(/\n\n+/).filter((p) => p.trim());
|
|
20
|
+
const content = paragraphs.map((paragraph) => {
|
|
21
|
+
// Split paragraph into lines and create text nodes with hard breaks
|
|
22
|
+
const lines = paragraph.split('\n');
|
|
23
|
+
const inlineContent = [];
|
|
24
|
+
lines.forEach((line, index) => {
|
|
25
|
+
if (line.trim()) {
|
|
26
|
+
inlineContent.push({ type: 'text', text: line });
|
|
27
|
+
}
|
|
28
|
+
if (index < lines.length - 1) {
|
|
29
|
+
inlineContent.push({ type: 'hardBreak' });
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
type: 'paragraph',
|
|
34
|
+
content: inlineContent.length > 0 ? inlineContent : undefined,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
// If no content, create a single empty paragraph
|
|
38
|
+
if (content.length === 0) {
|
|
39
|
+
content.push({ type: 'paragraph' });
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
version: 1,
|
|
43
|
+
type: 'doc',
|
|
44
|
+
content,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Convert ADF document to plain text
|
|
49
|
+
*/
|
|
50
|
+
export function adfToText(doc) {
|
|
51
|
+
const lines = [];
|
|
52
|
+
function processNode(node) {
|
|
53
|
+
if (node.type === 'text' && 'text' in node) {
|
|
54
|
+
lines.push(node.text);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (node.type === 'hardBreak') {
|
|
58
|
+
lines.push('\n');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if ('content' in node && Array.isArray(node.content)) {
|
|
62
|
+
for (const child of node.content) {
|
|
63
|
+
processNode(child);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Add paragraph breaks
|
|
67
|
+
if (node.type === 'paragraph' || node.type === 'heading') {
|
|
68
|
+
lines.push('\n\n');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const node of doc.content) {
|
|
72
|
+
processNode(node);
|
|
73
|
+
}
|
|
74
|
+
return lines.join('').trim();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Ensure a value is an ADF document, converting from string if necessary
|
|
78
|
+
*/
|
|
79
|
+
export function ensureAdf(value) {
|
|
80
|
+
if (isAdfDocument(value)) {
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
return textToAdf(value);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a simple ADF paragraph with text
|
|
87
|
+
*/
|
|
88
|
+
export function createAdfParagraph(text) {
|
|
89
|
+
return {
|
|
90
|
+
type: 'paragraph',
|
|
91
|
+
content: [{ type: 'text', text }],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create an ADF document with a single paragraph
|
|
96
|
+
*/
|
|
97
|
+
export function createSimpleAdf(text) {
|
|
98
|
+
return {
|
|
99
|
+
version: 1,
|
|
100
|
+
type: 'doc',
|
|
101
|
+
content: [createAdfParagraph(text)],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=adf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adf.js","sourceRoot":"","sources":["../../src/utils/adf.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QACjB,KAAqB,CAAC,OAAO,KAAK,CAAC;QACpC,MAAM,IAAI,KAAK;QACd,KAAqB,CAAC,IAAI,KAAK,KAAK;QACrC,SAAS,IAAI,KAAK;QAClB,KAAK,CAAC,OAAO,CAAE,KAAqB,CAAC,OAAO,CAAC,CAC9C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,gDAAgD;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAE/D,MAAM,OAAO,GAAc,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAgB,EAAE;QACpE,oEAAoE;QACpE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,aAAa,GAA4C,EAAE,CAAC;QAElE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC5B,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;gBAChB,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAA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ACH,CAAC;QAED,uBAAuB;QACvB,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAC/B,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAA2B;IACnD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Transition } from '../types/workflows.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base error class for Jira plugin
|
|
4
|
+
*/
|
|
5
|
+
export declare class JiraPluginError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly cause?: unknown | undefined;
|
|
8
|
+
constructor(message: string, code: string, cause?: unknown | undefined);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Authentication failure error
|
|
12
|
+
*/
|
|
13
|
+
export declare class JiraAuthError extends JiraPluginError {
|
|
14
|
+
constructor(message?: string, cause?: unknown);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Rate limit exceeded error
|
|
18
|
+
*/
|
|
19
|
+
export declare class JiraRateLimitError extends JiraPluginError {
|
|
20
|
+
readonly resetAt?: Date | undefined;
|
|
21
|
+
constructor(message?: string, resetAt?: Date | undefined, cause?: unknown);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resource not found error
|
|
25
|
+
*/
|
|
26
|
+
export declare class JiraNotFoundError extends JiraPluginError {
|
|
27
|
+
constructor(resource: string, identifier: string | number, cause?: unknown);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Input validation error
|
|
31
|
+
*/
|
|
32
|
+
export declare class JiraValidationError extends JiraPluginError {
|
|
33
|
+
readonly details?: Record<string, string[]> | undefined;
|
|
34
|
+
constructor(message: string, details?: Record<string, string[]> | undefined, cause?: unknown);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Workflow transition error
|
|
38
|
+
*/
|
|
39
|
+
export declare class JiraTransitionError extends JiraPluginError {
|
|
40
|
+
readonly availableTransitions?: Transition[] | undefined;
|
|
41
|
+
constructor(message: string, availableTransitions?: Transition[] | undefined, cause?: unknown);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Connection/network error
|
|
45
|
+
*/
|
|
46
|
+
export declare class JiraConnectionError extends JiraPluginError {
|
|
47
|
+
constructor(message?: string, cause?: unknown);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if an error is a Jira API error
|
|
51
|
+
*/
|
|
52
|
+
export declare function isJiraApiError(error: unknown): error is {
|
|
53
|
+
status: number;
|
|
54
|
+
message: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Convert Jira API error to plugin error
|
|
58
|
+
*/
|
|
59
|
+
export declare function wrapJiraError(error: unknown, context?: string): JiraPluginError;
|
|
60
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;aAGtB,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,aAAc,SAAQ,eAAe;gBACpC,OAAO,SAA+B,EAAE,KAAK,CAAC,EAAE,OAAO;CAIpE;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;aAGnC,OAAO,CAAC,EAAE,IAAI;gBAD9B,OAAO,SAAiC,EACxB,OAAO,CAAC,EAAE,IAAI,YAAA,EAC9B,KAAK,CAAC,EAAE,OAAO;CAKlB;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;gBAElD,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,KAAK,CAAC,EAAE,OAAO;CAKlB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;aAGpC,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,mBAAoB,SAAQ,eAAe;aAGpC,oBAAoB,CAAC,EAAE,UAAU,EAAE;gBADnD,OAAO,EAAE,MAAM,EACC,oBAAoB,CAAC,EAAE,UAAU,EAAE,YAAA,EACnD,KAAK,CAAC,EAAE,OAAO;CAKlB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;gBAC1C,OAAO,SAA8B,EAAE,KAAK,CAAC,EAAE,OAAO;CAInE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAO3F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAiC/E"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for Jira plugin
|
|
3
|
+
*/
|
|
4
|
+
export class JiraPluginError 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 = 'JiraPluginError';
|
|
12
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Authentication failure error
|
|
17
|
+
*/
|
|
18
|
+
export class JiraAuthError extends JiraPluginError {
|
|
19
|
+
constructor(message = 'Jira authentication failed', cause) {
|
|
20
|
+
super(message, 'AUTH_ERROR', cause);
|
|
21
|
+
this.name = 'JiraAuthError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Rate limit exceeded error
|
|
26
|
+
*/
|
|
27
|
+
export class JiraRateLimitError extends JiraPluginError {
|
|
28
|
+
resetAt;
|
|
29
|
+
constructor(message = 'Jira API rate limit exceeded', resetAt, cause) {
|
|
30
|
+
super(message, 'RATE_LIMIT_ERROR', cause);
|
|
31
|
+
this.resetAt = resetAt;
|
|
32
|
+
this.name = 'JiraRateLimitError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resource not found error
|
|
37
|
+
*/
|
|
38
|
+
export class JiraNotFoundError extends JiraPluginError {
|
|
39
|
+
constructor(resource, identifier, cause) {
|
|
40
|
+
super(`${resource} '${identifier}' not found`, 'NOT_FOUND_ERROR', cause);
|
|
41
|
+
this.name = 'JiraNotFoundError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Input validation error
|
|
46
|
+
*/
|
|
47
|
+
export class JiraValidationError extends JiraPluginError {
|
|
48
|
+
details;
|
|
49
|
+
constructor(message, details, cause) {
|
|
50
|
+
super(message, 'VALIDATION_ERROR', cause);
|
|
51
|
+
this.details = details;
|
|
52
|
+
this.name = 'JiraValidationError';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Workflow transition error
|
|
57
|
+
*/
|
|
58
|
+
export class JiraTransitionError extends JiraPluginError {
|
|
59
|
+
availableTransitions;
|
|
60
|
+
constructor(message, availableTransitions, cause) {
|
|
61
|
+
super(message, 'TRANSITION_ERROR', cause);
|
|
62
|
+
this.availableTransitions = availableTransitions;
|
|
63
|
+
this.name = 'JiraTransitionError';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Connection/network error
|
|
68
|
+
*/
|
|
69
|
+
export class JiraConnectionError extends JiraPluginError {
|
|
70
|
+
constructor(message = 'Failed to connect to Jira', cause) {
|
|
71
|
+
super(message, 'CONNECTION_ERROR', cause);
|
|
72
|
+
this.name = 'JiraConnectionError';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if an error is a Jira API error
|
|
77
|
+
*/
|
|
78
|
+
export function isJiraApiError(error) {
|
|
79
|
+
return (typeof error === 'object' &&
|
|
80
|
+
error !== null &&
|
|
81
|
+
'status' in error &&
|
|
82
|
+
typeof error.status === 'number');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Convert Jira API error to plugin error
|
|
86
|
+
*/
|
|
87
|
+
export function wrapJiraError(error, context) {
|
|
88
|
+
if (error instanceof JiraPluginError) {
|
|
89
|
+
return error;
|
|
90
|
+
}
|
|
91
|
+
const prefix = context ? `${context}: ` : '';
|
|
92
|
+
if (isJiraApiError(error)) {
|
|
93
|
+
switch (error.status) {
|
|
94
|
+
case 401:
|
|
95
|
+
return new JiraAuthError(`${prefix}${error.message}`, error);
|
|
96
|
+
case 403:
|
|
97
|
+
return new JiraAuthError(`${prefix}Forbidden - ${error.message}`, error);
|
|
98
|
+
case 404:
|
|
99
|
+
return new JiraNotFoundError('Resource', context ?? 'unknown', error);
|
|
100
|
+
case 422:
|
|
101
|
+
return new JiraValidationError(`${prefix}${error.message}`, undefined, error);
|
|
102
|
+
case 429:
|
|
103
|
+
return new JiraRateLimitError(`${prefix}${error.message}`, undefined, error);
|
|
104
|
+
default:
|
|
105
|
+
return new JiraPluginError(`${prefix}${error.message}`, 'API_ERROR', error);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (error instanceof Error) {
|
|
109
|
+
// Check for connection errors
|
|
110
|
+
if (error.message.includes('ECONNREFUSED') || error.message.includes('ETIMEDOUT')) {
|
|
111
|
+
return new JiraConnectionError(`${prefix}${error.message}`, error);
|
|
112
|
+
}
|
|
113
|
+
return new JiraPluginError(`${prefix}${error.message}`, 'UNKNOWN_ERROR', error);
|
|
114
|
+
}
|
|
115
|
+
return new JiraPluginError(`${prefix}${String(error)}`, 'UNKNOWN_ERROR', error);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAGtB;IACA;IAHlB,YACE,OAAe,EACC,IAAY,EACZ,KAAe;QAE/B,KAAK,CAAC,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E,KAAK,GAAG;gBACN,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,OAAO,IAAI,SAAS,EAAE,KAAK,CAAC,CAAC;YACxE,KAAK,GAAG;gBACN,OAAO,IAAI,mBAAmB,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAChF,KAAK,GAAG;gBACN,OAAO,IAAI,kBAAkB,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAC/E;gBACE,OAAO,IAAI,eAAe,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,8BAA8B;QAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAClF,OAAO,IAAI,mBAAmB,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,IAAI,eAAe,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,IAAI,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JQL query builder for constructing type-safe JQL queries
|
|
3
|
+
*/
|
|
4
|
+
export declare class JqlBuilder {
|
|
5
|
+
private conditions;
|
|
6
|
+
private orderByClause;
|
|
7
|
+
/**
|
|
8
|
+
* Add a condition for project
|
|
9
|
+
*/
|
|
10
|
+
project(key: string): this;
|
|
11
|
+
/**
|
|
12
|
+
* Add a condition for projects (multiple)
|
|
13
|
+
*/
|
|
14
|
+
projects(keys: string[]): this;
|
|
15
|
+
/**
|
|
16
|
+
* Add a condition for issue type
|
|
17
|
+
*/
|
|
18
|
+
issueType(type: string): this;
|
|
19
|
+
/**
|
|
20
|
+
* Add a condition for issue types (multiple)
|
|
21
|
+
*/
|
|
22
|
+
issueTypes(types: string[]): this;
|
|
23
|
+
/**
|
|
24
|
+
* Add a condition for status
|
|
25
|
+
*/
|
|
26
|
+
status(name: string): this;
|
|
27
|
+
/**
|
|
28
|
+
* Add a condition for statuses (multiple)
|
|
29
|
+
*/
|
|
30
|
+
statuses(names: string[]): this;
|
|
31
|
+
/**
|
|
32
|
+
* Add a condition for status category
|
|
33
|
+
*/
|
|
34
|
+
statusCategory(category: 'new' | 'indeterminate' | 'done'): this;
|
|
35
|
+
/**
|
|
36
|
+
* Add a condition for assignee
|
|
37
|
+
*/
|
|
38
|
+
assignee(accountId: string): this;
|
|
39
|
+
/**
|
|
40
|
+
* Add a condition for unassigned issues
|
|
41
|
+
*/
|
|
42
|
+
unassigned(): this;
|
|
43
|
+
/**
|
|
44
|
+
* Add a condition for reporter
|
|
45
|
+
*/
|
|
46
|
+
reporter(accountId: string): this;
|
|
47
|
+
/**
|
|
48
|
+
* Add a condition for current user
|
|
49
|
+
*/
|
|
50
|
+
assignedToCurrentUser(): this;
|
|
51
|
+
/**
|
|
52
|
+
* Add a condition for sprint
|
|
53
|
+
*/
|
|
54
|
+
sprint(sprintId: number): this;
|
|
55
|
+
/**
|
|
56
|
+
* Add a condition for active sprint
|
|
57
|
+
*/
|
|
58
|
+
activeSprint(): this;
|
|
59
|
+
/**
|
|
60
|
+
* Add a condition for future sprints
|
|
61
|
+
*/
|
|
62
|
+
futureSprints(): this;
|
|
63
|
+
/**
|
|
64
|
+
* Add a condition for labels
|
|
65
|
+
*/
|
|
66
|
+
label(label: string): this;
|
|
67
|
+
/**
|
|
68
|
+
* Add a condition for labels (multiple, any match)
|
|
69
|
+
*/
|
|
70
|
+
labels(labels: string[]): this;
|
|
71
|
+
/**
|
|
72
|
+
* Add a condition for priority
|
|
73
|
+
*/
|
|
74
|
+
priority(name: string): this;
|
|
75
|
+
/**
|
|
76
|
+
* Add a condition for priorities (multiple)
|
|
77
|
+
*/
|
|
78
|
+
priorities(names: string[]): this;
|
|
79
|
+
/**
|
|
80
|
+
* Add a condition for parent issue (epic)
|
|
81
|
+
*/
|
|
82
|
+
parent(parentKey: string): this;
|
|
83
|
+
/**
|
|
84
|
+
* Add a condition for epic link
|
|
85
|
+
*/
|
|
86
|
+
epicLink(epicKey: string): this;
|
|
87
|
+
/**
|
|
88
|
+
* Add a condition for created date
|
|
89
|
+
*/
|
|
90
|
+
createdAfter(date: Date): this;
|
|
91
|
+
/**
|
|
92
|
+
* Add a condition for created date
|
|
93
|
+
*/
|
|
94
|
+
createdBefore(date: Date): this;
|
|
95
|
+
/**
|
|
96
|
+
* Add a condition for updated date
|
|
97
|
+
*/
|
|
98
|
+
updatedAfter(date: Date): this;
|
|
99
|
+
/**
|
|
100
|
+
* Add a condition for updated date
|
|
101
|
+
*/
|
|
102
|
+
updatedBefore(date: Date): this;
|
|
103
|
+
/**
|
|
104
|
+
* Add a condition for due date
|
|
105
|
+
*/
|
|
106
|
+
dueBefore(date: Date): this;
|
|
107
|
+
/**
|
|
108
|
+
* Add a condition for overdue issues
|
|
109
|
+
*/
|
|
110
|
+
overdue(): this;
|
|
111
|
+
/**
|
|
112
|
+
* Add a text search condition
|
|
113
|
+
*/
|
|
114
|
+
text(query: string): this;
|
|
115
|
+
/**
|
|
116
|
+
* Add a summary search condition
|
|
117
|
+
*/
|
|
118
|
+
summaryContains(text: string): this;
|
|
119
|
+
/**
|
|
120
|
+
* Add a raw JQL condition
|
|
121
|
+
*/
|
|
122
|
+
raw(condition: string): this;
|
|
123
|
+
/**
|
|
124
|
+
* Add order by clause
|
|
125
|
+
*/
|
|
126
|
+
orderBy(field: string, direction?: 'ASC' | 'DESC'): this;
|
|
127
|
+
/**
|
|
128
|
+
* Build the JQL query string
|
|
129
|
+
*/
|
|
130
|
+
build(): string;
|
|
131
|
+
/**
|
|
132
|
+
* Reset the builder
|
|
133
|
+
*/
|
|
134
|
+
reset(): this;
|
|
135
|
+
/**
|
|
136
|
+
* Escape special characters in JQL values
|
|
137
|
+
*/
|
|
138
|
+
private escape;
|
|
139
|
+
/**
|
|
140
|
+
* Format date for JQL
|
|
141
|
+
*/
|
|
142
|
+
private formatDate;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create a new JQL builder
|
|
146
|
+
*/
|
|
147
|
+
export declare function jql(): JqlBuilder;
|
|
148
|
+
//# sourceMappingURL=jql-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jql-builder.d.ts","sourceRoot":"","sources":["../../src/utils/jql-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,aAAa,CAAgB;IAErC;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK1B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAM9B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK7B;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAMjC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK1B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAM/B;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,GAAG,eAAe,GAAG,MAAM,GAAG,IAAI;IAUhE;;OAEG;IACH,QAAQ,CAAC,SAA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