@felixgeelhaar/jira-sdk 0.1.0
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 +21 -0
- package/README.md +535 -0
- package/dist/index.cjs +5583 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +250 -0
- package/dist/index.d.ts +250 -0
- package/dist/index.js +5361 -0
- package/dist/index.js.map +1 -0
- package/dist/project-DNkPXkPv.d.cts +10216 -0
- package/dist/project-DNkPXkPv.d.ts +10216 -0
- package/dist/schemas/index.cjs +4639 -0
- package/dist/schemas/index.cjs.map +1 -0
- package/dist/schemas/index.d.cts +1503 -0
- package/dist/schemas/index.d.ts +1503 -0
- package/dist/schemas/index.js +4584 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/services/index.cjs +5110 -0
- package/dist/services/index.cjs.map +1 -0
- package/dist/services/index.d.cts +4304 -0
- package/dist/services/index.d.ts +4304 -0
- package/dist/services/index.js +5104 -0
- package/dist/services/index.js.map +1 -0
- package/package.json +91 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { RetryMiddlewareConfig, RateLimitMiddlewareConfig, CircuitBreakerConfig, Middleware, CircuitBreaker, AuthProvider, Logger, HttpClient } from '@felixgeelhaar/sdk-core';
|
|
2
|
+
export { AbortError, ApiError, ApiTokenAuth, ApiTokenAuthConfig, AuthConfigError, AuthError, AuthProvider, BasicAuth, BasicAuthConfig, CircuitBreaker, CircuitBreakerConfig, CircuitBreakerOpenError, CircuitState, ConfigValidationError, ConsoleLogger, ForbiddenError, JiraSdkError, LogLevel, Logger, Middleware, MiddlewareContext, NetworkError, NoopLogger, NotFoundError, OAuth2Auth, OAuth2AuthConfig, PatAuth, PatAuthConfig, RateLimitError, ResponseValidationError, ServerError, TimeoutError, TokenExpiredError, TokenRefreshError, UnauthorizedError, ValidationError, composeMiddleware, createApiTokenAuth, createBasicAuth, createCircuitBreakerMiddleware, createDefaultCircuitBreaker, createLoggingMiddleware, createOAuth2Auth, createPatAuth, createRateLimitMiddleware, createRequestIdMiddleware, createRetryMiddleware, createUserAgentMiddleware } from '@felixgeelhaar/sdk-core';
|
|
3
|
+
import { IssueService, ProjectService, SearchService, UserService } from './services/index.cjs';
|
|
4
|
+
export { BaseService, SearchOptions, SearchResult } from './services/index.cjs';
|
|
5
|
+
export { AddAttachmentResponse, AddAttachmentResponseSchema, Attachment, AttachmentMetadata, AttachmentMetadataSchema, AttachmentSchema, Component, ComponentInput, ComponentInputSchema, ComponentSchema, CreateIssueLinkInput, CreateIssueLinkInputSchema, Insight, InsightSchema, IssueLink, IssueLinkSchema, IssueLinkType, IssueLinkTypeSchema, IssueLinkTypesResponse, IssueLinkTypesResponseSchema, IssuePriority, IssuePrioritySchema, IssueProject, IssueProjectSchema, IssueResolution, IssueResolutionSchema, IssueStatus, IssueStatusSchema, IssueType, IssueTypeInput, IssueTypeInputSchema, IssueTypeSchema, PriorityInput, PriorityInputSchema, ProjectCategory, ProjectCategorySchema, ProjectInput, ProjectInputSchema, ProjectLead, ProjectLeadSchema, ProjectStyle, ProjectStyleSchema, ProjectType, ProjectTypeSchema, ResolutionInput, ResolutionInputSchema, StatusCategory, StatusCategorySchema, Version, VersionInput, VersionInputSchema, VersionSchema } from './schemas/index.cjs';
|
|
6
|
+
export { q as AddCommentInput, A as AddCommentInputSchema, H as AddWorklogInput, F as AddWorklogInputSchema, p as Comment, o as CommentSchema, n as CommentVisibility, m as CommentVisibilitySchema, u as CommentsPage, t as CommentsPageSchema, f as CreateIssueFields, C as CreateIssueFieldsSchema, h as CreateIssueInput, g as CreateIssueInputSchema, k as CreateIssueResponse, j as CreateIssueResponseSchema, X as CreateProjectInput, V as CreateProjectInputSchema, y as DoTransitionInput, D as DoTransitionInputSchema, l as GetIssueOptions, G as GetIssueOptionsSchema, a1 as GetProjectsOptions, a0 as GetProjectsOptionsSchema, e as Issue, c as IssueFields, b as IssueFieldsSchema, a as IssueRef, I as IssueRefSchema, d as IssueSchema, S as Project, Q as ProjectRef, P as ProjectRefSchema, R as ProjectSchema, $ as ProjectSearchResult, _ as ProjectSearchResultSchema, v as Transition, T as TransitionSchema, x as TransitionsResponse, w as TransitionsResponseSchema, s as UpdateCommentInput, r as UpdateCommentInputSchema, i as UpdateIssueInput, U as UpdateIssueInputSchema, Z as UpdateProjectInput, Y as UpdateProjectInputSchema, K as UpdateWorklogInput, J as UpdateWorklogInputSchema, O as Watchers, N as WatchersSchema, E as Worklog, B as WorklogSchema, z as WorklogVisibility, W as WorklogVisibilitySchema, M as WorklogsPage, L as WorklogsPageSchema } from './project-DNkPXkPv.cjs';
|
|
7
|
+
import 'zod';
|
|
8
|
+
import '@felixgeelhaar/sdk-core/schemas';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resilience configuration for the Jira client
|
|
12
|
+
*/
|
|
13
|
+
interface ResilienceConfig {
|
|
14
|
+
/**
|
|
15
|
+
* Retry configuration
|
|
16
|
+
* Set to false to disable retries
|
|
17
|
+
*/
|
|
18
|
+
retry?: RetryMiddlewareConfig | false;
|
|
19
|
+
/**
|
|
20
|
+
* Client-side rate limiting configuration
|
|
21
|
+
* Set to false to disable
|
|
22
|
+
*/
|
|
23
|
+
rateLimit?: RateLimitMiddlewareConfig | false;
|
|
24
|
+
/**
|
|
25
|
+
* Circuit breaker configuration
|
|
26
|
+
* Set to false to disable
|
|
27
|
+
*/
|
|
28
|
+
circuitBreaker?: CircuitBreakerConfig | false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Default resilience configuration optimized for Jira API
|
|
32
|
+
*/
|
|
33
|
+
declare const DEFAULT_RESILIENCE_CONFIG: ResilienceConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Result of creating resilience middleware
|
|
36
|
+
*/
|
|
37
|
+
interface ResilienceMiddlewareResult {
|
|
38
|
+
/**
|
|
39
|
+
* Combined middleware to add to the HTTP client
|
|
40
|
+
*/
|
|
41
|
+
middleware: Middleware;
|
|
42
|
+
/**
|
|
43
|
+
* Circuit breaker instance (if enabled) for monitoring
|
|
44
|
+
*/
|
|
45
|
+
circuitBreaker: CircuitBreaker | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create resilience middleware for the Jira client
|
|
49
|
+
*
|
|
50
|
+
* This function creates a composed middleware that includes:
|
|
51
|
+
* - Retry with exponential backoff for transient failures
|
|
52
|
+
* - Client-side rate limiting to avoid hitting Jira's limits
|
|
53
|
+
* - Circuit breaker for fail-fast behavior
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { createJiraClient } from '@felixgeelhaar/jira-sdk';
|
|
58
|
+
* import { createResilienceMiddleware } from '@felixgeelhaar/jira-sdk/client/resilience';
|
|
59
|
+
*
|
|
60
|
+
* const { middleware, circuitBreaker } = createResilienceMiddleware();
|
|
61
|
+
*
|
|
62
|
+
* const client = createJiraClient({
|
|
63
|
+
* host: 'https://your-domain.atlassian.net',
|
|
64
|
+
* auth: apiTokenAuth,
|
|
65
|
+
* middleware: [middleware],
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Monitor circuit breaker state
|
|
69
|
+
* console.log(circuitBreaker?.getStats());
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example Custom configuration
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const { middleware } = createResilienceMiddleware({
|
|
75
|
+
* retry: {
|
|
76
|
+
* maxRetries: 5,
|
|
77
|
+
* initialDelayMs: 500,
|
|
78
|
+
* },
|
|
79
|
+
* rateLimit: false, // Disable rate limiting
|
|
80
|
+
* circuitBreaker: {
|
|
81
|
+
* failureThreshold: 10,
|
|
82
|
+
* resetTimeoutMs: 60000,
|
|
83
|
+
* },
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
declare function createResilienceMiddleware(config?: ResilienceConfig): ResilienceMiddlewareResult;
|
|
88
|
+
/**
|
|
89
|
+
* Create a Jira client option that adds resilience middleware
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* import { JiraClient, withResilience } from '@felixgeelhaar/jira-sdk';
|
|
94
|
+
*
|
|
95
|
+
* const client = new JiraClient(
|
|
96
|
+
* { host: '...', auth: '...' },
|
|
97
|
+
* withResilience()
|
|
98
|
+
* );
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function withResilience(config?: ResilienceConfig): (internalConfig: {
|
|
102
|
+
middleware?: Middleware[];
|
|
103
|
+
}) => void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Jira client configuration
|
|
107
|
+
*/
|
|
108
|
+
interface JiraClientConfig {
|
|
109
|
+
/**
|
|
110
|
+
* Jira Cloud instance URL (e.g., https://your-domain.atlassian.net)
|
|
111
|
+
*/
|
|
112
|
+
host: string;
|
|
113
|
+
/**
|
|
114
|
+
* Authentication provider
|
|
115
|
+
*/
|
|
116
|
+
auth: AuthProvider;
|
|
117
|
+
/**
|
|
118
|
+
* Logger instance (optional)
|
|
119
|
+
*/
|
|
120
|
+
logger?: Logger;
|
|
121
|
+
/**
|
|
122
|
+
* Request timeout in milliseconds (default: 30000)
|
|
123
|
+
*/
|
|
124
|
+
timeout?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Additional middleware to apply
|
|
127
|
+
*/
|
|
128
|
+
middleware?: Middleware[];
|
|
129
|
+
/**
|
|
130
|
+
* User agent suffix (optional)
|
|
131
|
+
*/
|
|
132
|
+
userAgent?: string;
|
|
133
|
+
/**
|
|
134
|
+
* API version (default: '3')
|
|
135
|
+
*/
|
|
136
|
+
apiVersion?: '2' | '3';
|
|
137
|
+
/**
|
|
138
|
+
* Enable automatic retry on failures (default: true)
|
|
139
|
+
*/
|
|
140
|
+
retryEnabled?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Maximum number of retries (default: 3)
|
|
143
|
+
*/
|
|
144
|
+
maxRetries?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Enable request logging (default: false)
|
|
147
|
+
*/
|
|
148
|
+
debug?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Functional option for client configuration
|
|
152
|
+
*/
|
|
153
|
+
type JiraClientOption = (config: JiraClientConfig) => JiraClientConfig;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Jira API Client
|
|
157
|
+
*
|
|
158
|
+
* The main entry point for interacting with the Jira REST API.
|
|
159
|
+
* Provides access to all Jira services through a unified interface.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* import { JiraClient, ApiTokenAuth } from '@felixgeelhaar/jira-sdk';
|
|
164
|
+
*
|
|
165
|
+
* const client = new JiraClient({
|
|
166
|
+
* host: 'https://your-domain.atlassian.net',
|
|
167
|
+
* auth: new ApiTokenAuth({
|
|
168
|
+
* email: 'user@example.com',
|
|
169
|
+
* apiToken: 'your-api-token',
|
|
170
|
+
* }),
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* // Get an issue
|
|
174
|
+
* const issue = await client.issues.get('PROJECT-123');
|
|
175
|
+
*
|
|
176
|
+
* // Search issues
|
|
177
|
+
* const results = await client.search.jql('project = PROJECT AND status = Open');
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
declare class JiraClient {
|
|
181
|
+
private readonly httpClient;
|
|
182
|
+
private readonly config;
|
|
183
|
+
private _issues?;
|
|
184
|
+
private _projects?;
|
|
185
|
+
private _search?;
|
|
186
|
+
private _users?;
|
|
187
|
+
constructor(config: JiraClientConfig, ...options: JiraClientOption[]);
|
|
188
|
+
/**
|
|
189
|
+
* Get the API base path for the configured version
|
|
190
|
+
*/
|
|
191
|
+
get apiBasePath(): string;
|
|
192
|
+
/**
|
|
193
|
+
* Get the Agile API base path
|
|
194
|
+
*/
|
|
195
|
+
get agileApiBasePath(): string;
|
|
196
|
+
/**
|
|
197
|
+
* Issues service - CRUD operations for issues
|
|
198
|
+
*/
|
|
199
|
+
get issues(): IssueService;
|
|
200
|
+
/**
|
|
201
|
+
* Projects service - CRUD operations for projects
|
|
202
|
+
*/
|
|
203
|
+
get projects(): ProjectService;
|
|
204
|
+
/**
|
|
205
|
+
* Search service - JQL search and filters
|
|
206
|
+
*/
|
|
207
|
+
get search(): SearchService;
|
|
208
|
+
/**
|
|
209
|
+
* Users service - User management
|
|
210
|
+
*/
|
|
211
|
+
get users(): UserService;
|
|
212
|
+
/**
|
|
213
|
+
* Get the underlying HTTP client for advanced usage
|
|
214
|
+
*/
|
|
215
|
+
getHttpClient(): HttpClient;
|
|
216
|
+
/**
|
|
217
|
+
* Get the configured host URL
|
|
218
|
+
*/
|
|
219
|
+
getHost(): string;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Factory function to create a Jira client
|
|
223
|
+
*/
|
|
224
|
+
declare function createJiraClient(config: JiraClientConfig, ...options: JiraClientOption[]): JiraClient;
|
|
225
|
+
/**
|
|
226
|
+
* Set the API version
|
|
227
|
+
*/
|
|
228
|
+
declare function withApiVersion(version: '2' | '3'): JiraClientOption;
|
|
229
|
+
/**
|
|
230
|
+
* Set the request timeout
|
|
231
|
+
*/
|
|
232
|
+
declare function withTimeout(timeout: number): JiraClientOption;
|
|
233
|
+
/**
|
|
234
|
+
* Enable debug logging
|
|
235
|
+
*/
|
|
236
|
+
declare function withDebug(enabled?: boolean): JiraClientOption;
|
|
237
|
+
/**
|
|
238
|
+
* Configure retry behavior
|
|
239
|
+
*/
|
|
240
|
+
declare function withRetry(enabled: boolean, maxRetries?: number): JiraClientOption;
|
|
241
|
+
/**
|
|
242
|
+
* Add custom middleware
|
|
243
|
+
*/
|
|
244
|
+
declare function withMiddleware(...middleware: Middleware[]): JiraClientOption;
|
|
245
|
+
/**
|
|
246
|
+
* Set custom logger
|
|
247
|
+
*/
|
|
248
|
+
declare function withLogger(logger: Logger): JiraClientOption;
|
|
249
|
+
|
|
250
|
+
export { DEFAULT_RESILIENCE_CONFIG, IssueService, JiraClient, type JiraClientConfig, type JiraClientOption, ProjectService, type ResilienceConfig, type ResilienceMiddlewareResult, SearchService, UserService, createJiraClient, createResilienceMiddleware, withApiVersion, withDebug, withLogger, withMiddleware, withResilience, withRetry, withTimeout };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { RetryMiddlewareConfig, RateLimitMiddlewareConfig, CircuitBreakerConfig, Middleware, CircuitBreaker, AuthProvider, Logger, HttpClient } from '@felixgeelhaar/sdk-core';
|
|
2
|
+
export { AbortError, ApiError, ApiTokenAuth, ApiTokenAuthConfig, AuthConfigError, AuthError, AuthProvider, BasicAuth, BasicAuthConfig, CircuitBreaker, CircuitBreakerConfig, CircuitBreakerOpenError, CircuitState, ConfigValidationError, ConsoleLogger, ForbiddenError, JiraSdkError, LogLevel, Logger, Middleware, MiddlewareContext, NetworkError, NoopLogger, NotFoundError, OAuth2Auth, OAuth2AuthConfig, PatAuth, PatAuthConfig, RateLimitError, ResponseValidationError, ServerError, TimeoutError, TokenExpiredError, TokenRefreshError, UnauthorizedError, ValidationError, composeMiddleware, createApiTokenAuth, createBasicAuth, createCircuitBreakerMiddleware, createDefaultCircuitBreaker, createLoggingMiddleware, createOAuth2Auth, createPatAuth, createRateLimitMiddleware, createRequestIdMiddleware, createRetryMiddleware, createUserAgentMiddleware } from '@felixgeelhaar/sdk-core';
|
|
3
|
+
import { IssueService, ProjectService, SearchService, UserService } from './services/index.js';
|
|
4
|
+
export { BaseService, SearchOptions, SearchResult } from './services/index.js';
|
|
5
|
+
export { AddAttachmentResponse, AddAttachmentResponseSchema, Attachment, AttachmentMetadata, AttachmentMetadataSchema, AttachmentSchema, Component, ComponentInput, ComponentInputSchema, ComponentSchema, CreateIssueLinkInput, CreateIssueLinkInputSchema, Insight, InsightSchema, IssueLink, IssueLinkSchema, IssueLinkType, IssueLinkTypeSchema, IssueLinkTypesResponse, IssueLinkTypesResponseSchema, IssuePriority, IssuePrioritySchema, IssueProject, IssueProjectSchema, IssueResolution, IssueResolutionSchema, IssueStatus, IssueStatusSchema, IssueType, IssueTypeInput, IssueTypeInputSchema, IssueTypeSchema, PriorityInput, PriorityInputSchema, ProjectCategory, ProjectCategorySchema, ProjectInput, ProjectInputSchema, ProjectLead, ProjectLeadSchema, ProjectStyle, ProjectStyleSchema, ProjectType, ProjectTypeSchema, ResolutionInput, ResolutionInputSchema, StatusCategory, StatusCategorySchema, Version, VersionInput, VersionInputSchema, VersionSchema } from './schemas/index.js';
|
|
6
|
+
export { q as AddCommentInput, A as AddCommentInputSchema, H as AddWorklogInput, F as AddWorklogInputSchema, p as Comment, o as CommentSchema, n as CommentVisibility, m as CommentVisibilitySchema, u as CommentsPage, t as CommentsPageSchema, f as CreateIssueFields, C as CreateIssueFieldsSchema, h as CreateIssueInput, g as CreateIssueInputSchema, k as CreateIssueResponse, j as CreateIssueResponseSchema, X as CreateProjectInput, V as CreateProjectInputSchema, y as DoTransitionInput, D as DoTransitionInputSchema, l as GetIssueOptions, G as GetIssueOptionsSchema, a1 as GetProjectsOptions, a0 as GetProjectsOptionsSchema, e as Issue, c as IssueFields, b as IssueFieldsSchema, a as IssueRef, I as IssueRefSchema, d as IssueSchema, S as Project, Q as ProjectRef, P as ProjectRefSchema, R as ProjectSchema, $ as ProjectSearchResult, _ as ProjectSearchResultSchema, v as Transition, T as TransitionSchema, x as TransitionsResponse, w as TransitionsResponseSchema, s as UpdateCommentInput, r as UpdateCommentInputSchema, i as UpdateIssueInput, U as UpdateIssueInputSchema, Z as UpdateProjectInput, Y as UpdateProjectInputSchema, K as UpdateWorklogInput, J as UpdateWorklogInputSchema, O as Watchers, N as WatchersSchema, E as Worklog, B as WorklogSchema, z as WorklogVisibility, W as WorklogVisibilitySchema, M as WorklogsPage, L as WorklogsPageSchema } from './project-DNkPXkPv.js';
|
|
7
|
+
import 'zod';
|
|
8
|
+
import '@felixgeelhaar/sdk-core/schemas';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resilience configuration for the Jira client
|
|
12
|
+
*/
|
|
13
|
+
interface ResilienceConfig {
|
|
14
|
+
/**
|
|
15
|
+
* Retry configuration
|
|
16
|
+
* Set to false to disable retries
|
|
17
|
+
*/
|
|
18
|
+
retry?: RetryMiddlewareConfig | false;
|
|
19
|
+
/**
|
|
20
|
+
* Client-side rate limiting configuration
|
|
21
|
+
* Set to false to disable
|
|
22
|
+
*/
|
|
23
|
+
rateLimit?: RateLimitMiddlewareConfig | false;
|
|
24
|
+
/**
|
|
25
|
+
* Circuit breaker configuration
|
|
26
|
+
* Set to false to disable
|
|
27
|
+
*/
|
|
28
|
+
circuitBreaker?: CircuitBreakerConfig | false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Default resilience configuration optimized for Jira API
|
|
32
|
+
*/
|
|
33
|
+
declare const DEFAULT_RESILIENCE_CONFIG: ResilienceConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Result of creating resilience middleware
|
|
36
|
+
*/
|
|
37
|
+
interface ResilienceMiddlewareResult {
|
|
38
|
+
/**
|
|
39
|
+
* Combined middleware to add to the HTTP client
|
|
40
|
+
*/
|
|
41
|
+
middleware: Middleware;
|
|
42
|
+
/**
|
|
43
|
+
* Circuit breaker instance (if enabled) for monitoring
|
|
44
|
+
*/
|
|
45
|
+
circuitBreaker: CircuitBreaker | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create resilience middleware for the Jira client
|
|
49
|
+
*
|
|
50
|
+
* This function creates a composed middleware that includes:
|
|
51
|
+
* - Retry with exponential backoff for transient failures
|
|
52
|
+
* - Client-side rate limiting to avoid hitting Jira's limits
|
|
53
|
+
* - Circuit breaker for fail-fast behavior
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { createJiraClient } from '@felixgeelhaar/jira-sdk';
|
|
58
|
+
* import { createResilienceMiddleware } from '@felixgeelhaar/jira-sdk/client/resilience';
|
|
59
|
+
*
|
|
60
|
+
* const { middleware, circuitBreaker } = createResilienceMiddleware();
|
|
61
|
+
*
|
|
62
|
+
* const client = createJiraClient({
|
|
63
|
+
* host: 'https://your-domain.atlassian.net',
|
|
64
|
+
* auth: apiTokenAuth,
|
|
65
|
+
* middleware: [middleware],
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Monitor circuit breaker state
|
|
69
|
+
* console.log(circuitBreaker?.getStats());
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example Custom configuration
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const { middleware } = createResilienceMiddleware({
|
|
75
|
+
* retry: {
|
|
76
|
+
* maxRetries: 5,
|
|
77
|
+
* initialDelayMs: 500,
|
|
78
|
+
* },
|
|
79
|
+
* rateLimit: false, // Disable rate limiting
|
|
80
|
+
* circuitBreaker: {
|
|
81
|
+
* failureThreshold: 10,
|
|
82
|
+
* resetTimeoutMs: 60000,
|
|
83
|
+
* },
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
declare function createResilienceMiddleware(config?: ResilienceConfig): ResilienceMiddlewareResult;
|
|
88
|
+
/**
|
|
89
|
+
* Create a Jira client option that adds resilience middleware
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* import { JiraClient, withResilience } from '@felixgeelhaar/jira-sdk';
|
|
94
|
+
*
|
|
95
|
+
* const client = new JiraClient(
|
|
96
|
+
* { host: '...', auth: '...' },
|
|
97
|
+
* withResilience()
|
|
98
|
+
* );
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function withResilience(config?: ResilienceConfig): (internalConfig: {
|
|
102
|
+
middleware?: Middleware[];
|
|
103
|
+
}) => void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Jira client configuration
|
|
107
|
+
*/
|
|
108
|
+
interface JiraClientConfig {
|
|
109
|
+
/**
|
|
110
|
+
* Jira Cloud instance URL (e.g., https://your-domain.atlassian.net)
|
|
111
|
+
*/
|
|
112
|
+
host: string;
|
|
113
|
+
/**
|
|
114
|
+
* Authentication provider
|
|
115
|
+
*/
|
|
116
|
+
auth: AuthProvider;
|
|
117
|
+
/**
|
|
118
|
+
* Logger instance (optional)
|
|
119
|
+
*/
|
|
120
|
+
logger?: Logger;
|
|
121
|
+
/**
|
|
122
|
+
* Request timeout in milliseconds (default: 30000)
|
|
123
|
+
*/
|
|
124
|
+
timeout?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Additional middleware to apply
|
|
127
|
+
*/
|
|
128
|
+
middleware?: Middleware[];
|
|
129
|
+
/**
|
|
130
|
+
* User agent suffix (optional)
|
|
131
|
+
*/
|
|
132
|
+
userAgent?: string;
|
|
133
|
+
/**
|
|
134
|
+
* API version (default: '3')
|
|
135
|
+
*/
|
|
136
|
+
apiVersion?: '2' | '3';
|
|
137
|
+
/**
|
|
138
|
+
* Enable automatic retry on failures (default: true)
|
|
139
|
+
*/
|
|
140
|
+
retryEnabled?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Maximum number of retries (default: 3)
|
|
143
|
+
*/
|
|
144
|
+
maxRetries?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Enable request logging (default: false)
|
|
147
|
+
*/
|
|
148
|
+
debug?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Functional option for client configuration
|
|
152
|
+
*/
|
|
153
|
+
type JiraClientOption = (config: JiraClientConfig) => JiraClientConfig;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Jira API Client
|
|
157
|
+
*
|
|
158
|
+
* The main entry point for interacting with the Jira REST API.
|
|
159
|
+
* Provides access to all Jira services through a unified interface.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* import { JiraClient, ApiTokenAuth } from '@felixgeelhaar/jira-sdk';
|
|
164
|
+
*
|
|
165
|
+
* const client = new JiraClient({
|
|
166
|
+
* host: 'https://your-domain.atlassian.net',
|
|
167
|
+
* auth: new ApiTokenAuth({
|
|
168
|
+
* email: 'user@example.com',
|
|
169
|
+
* apiToken: 'your-api-token',
|
|
170
|
+
* }),
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* // Get an issue
|
|
174
|
+
* const issue = await client.issues.get('PROJECT-123');
|
|
175
|
+
*
|
|
176
|
+
* // Search issues
|
|
177
|
+
* const results = await client.search.jql('project = PROJECT AND status = Open');
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
declare class JiraClient {
|
|
181
|
+
private readonly httpClient;
|
|
182
|
+
private readonly config;
|
|
183
|
+
private _issues?;
|
|
184
|
+
private _projects?;
|
|
185
|
+
private _search?;
|
|
186
|
+
private _users?;
|
|
187
|
+
constructor(config: JiraClientConfig, ...options: JiraClientOption[]);
|
|
188
|
+
/**
|
|
189
|
+
* Get the API base path for the configured version
|
|
190
|
+
*/
|
|
191
|
+
get apiBasePath(): string;
|
|
192
|
+
/**
|
|
193
|
+
* Get the Agile API base path
|
|
194
|
+
*/
|
|
195
|
+
get agileApiBasePath(): string;
|
|
196
|
+
/**
|
|
197
|
+
* Issues service - CRUD operations for issues
|
|
198
|
+
*/
|
|
199
|
+
get issues(): IssueService;
|
|
200
|
+
/**
|
|
201
|
+
* Projects service - CRUD operations for projects
|
|
202
|
+
*/
|
|
203
|
+
get projects(): ProjectService;
|
|
204
|
+
/**
|
|
205
|
+
* Search service - JQL search and filters
|
|
206
|
+
*/
|
|
207
|
+
get search(): SearchService;
|
|
208
|
+
/**
|
|
209
|
+
* Users service - User management
|
|
210
|
+
*/
|
|
211
|
+
get users(): UserService;
|
|
212
|
+
/**
|
|
213
|
+
* Get the underlying HTTP client for advanced usage
|
|
214
|
+
*/
|
|
215
|
+
getHttpClient(): HttpClient;
|
|
216
|
+
/**
|
|
217
|
+
* Get the configured host URL
|
|
218
|
+
*/
|
|
219
|
+
getHost(): string;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Factory function to create a Jira client
|
|
223
|
+
*/
|
|
224
|
+
declare function createJiraClient(config: JiraClientConfig, ...options: JiraClientOption[]): JiraClient;
|
|
225
|
+
/**
|
|
226
|
+
* Set the API version
|
|
227
|
+
*/
|
|
228
|
+
declare function withApiVersion(version: '2' | '3'): JiraClientOption;
|
|
229
|
+
/**
|
|
230
|
+
* Set the request timeout
|
|
231
|
+
*/
|
|
232
|
+
declare function withTimeout(timeout: number): JiraClientOption;
|
|
233
|
+
/**
|
|
234
|
+
* Enable debug logging
|
|
235
|
+
*/
|
|
236
|
+
declare function withDebug(enabled?: boolean): JiraClientOption;
|
|
237
|
+
/**
|
|
238
|
+
* Configure retry behavior
|
|
239
|
+
*/
|
|
240
|
+
declare function withRetry(enabled: boolean, maxRetries?: number): JiraClientOption;
|
|
241
|
+
/**
|
|
242
|
+
* Add custom middleware
|
|
243
|
+
*/
|
|
244
|
+
declare function withMiddleware(...middleware: Middleware[]): JiraClientOption;
|
|
245
|
+
/**
|
|
246
|
+
* Set custom logger
|
|
247
|
+
*/
|
|
248
|
+
declare function withLogger(logger: Logger): JiraClientOption;
|
|
249
|
+
|
|
250
|
+
export { DEFAULT_RESILIENCE_CONFIG, IssueService, JiraClient, type JiraClientConfig, type JiraClientOption, ProjectService, type ResilienceConfig, type ResilienceMiddlewareResult, SearchService, UserService, createJiraClient, createResilienceMiddleware, withApiVersion, withDebug, withLogger, withMiddleware, withResilience, withRetry, withTimeout };
|