@decaf-ts/integrations 0.12.0 → 0.14.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/dist/integrations.cjs +1 -1
- package/lib/cjs/calendar/environment.cjs +48 -0
- package/lib/cjs/calendar/environment.cjs.map +1 -0
- package/lib/cjs/calendar/google-calendar/GoogleCalendarService.cjs +338 -0
- package/lib/cjs/calendar/google-calendar/GoogleCalendarService.cjs.map +1 -0
- package/lib/cjs/calendar/google-calendar/index.cjs +20 -0
- package/lib/cjs/calendar/google-calendar/index.cjs.map +1 -0
- package/lib/cjs/comms/discord/DiscordService.cjs +318 -0
- package/lib/cjs/comms/discord/DiscordService.cjs.map +1 -0
- package/lib/cjs/comms/discord/index.cjs +19 -0
- package/lib/cjs/comms/discord/index.cjs.map +1 -0
- package/lib/cjs/comms/environment.cjs +16 -0
- package/lib/cjs/comms/environment.cjs.map +1 -1
- package/lib/cjs/comms/index.cjs +3 -0
- package/lib/cjs/comms/index.cjs.map +1 -1
- package/lib/cjs/comms/outlook/MicrosoftOutlookService.cjs +325 -0
- package/lib/cjs/comms/outlook/MicrosoftOutlookService.cjs.map +1 -0
- package/lib/cjs/comms/outlook/index.cjs +19 -0
- package/lib/cjs/comms/outlook/index.cjs.map +1 -0
- package/lib/cjs/comms/whatsapp/WhatsAppService.cjs +274 -0
- package/lib/cjs/comms/whatsapp/WhatsAppService.cjs.map +1 -0
- package/lib/cjs/comms/whatsapp/index.cjs +19 -0
- package/lib/cjs/comms/whatsapp/index.cjs.map +1 -0
- package/lib/cjs/index.cjs +3 -3
- package/lib/cjs/io/confluence/ConfluenceService.cjs +317 -0
- package/lib/cjs/io/confluence/ConfluenceService.cjs.map +1 -0
- package/lib/cjs/io/confluence/index.cjs +19 -0
- package/lib/cjs/io/confluence/index.cjs.map +1 -0
- package/lib/cjs/io/environment.cjs +28 -0
- package/lib/cjs/io/environment.cjs.map +1 -1
- package/lib/cjs/io/google-docs/GoogleDocsService.cjs +275 -0
- package/lib/cjs/io/google-docs/GoogleDocsService.cjs.map +1 -0
- package/lib/cjs/io/google-docs/index.cjs +19 -0
- package/lib/cjs/io/google-docs/index.cjs.map +1 -0
- package/lib/cjs/io/index.cjs +5 -0
- package/lib/cjs/io/index.cjs.map +1 -1
- package/lib/cjs/io/jira/JiraService.cjs +354 -0
- package/lib/cjs/io/jira/JiraService.cjs.map +1 -0
- package/lib/cjs/io/jira/index.cjs +19 -0
- package/lib/cjs/io/jira/index.cjs.map +1 -0
- package/lib/cjs/io/microsoft-excel/MicrosoftExcelService.cjs +253 -0
- package/lib/cjs/io/microsoft-excel/MicrosoftExcelService.cjs.map +1 -0
- package/lib/cjs/io/microsoft-excel/index.cjs +19 -0
- package/lib/cjs/io/microsoft-excel/index.cjs.map +1 -0
- package/lib/cjs/io/microsoft-sharepoint/MicrosoftSharePointService.cjs +261 -0
- package/lib/cjs/io/microsoft-sharepoint/MicrosoftSharePointService.cjs.map +1 -0
- package/lib/cjs/io/microsoft-sharepoint/index.cjs +19 -0
- package/lib/cjs/io/microsoft-sharepoint/index.cjs.map +1 -0
- package/lib/esm/calendar/environment.js +44 -0
- package/lib/esm/calendar/environment.js.map +1 -0
- package/lib/esm/calendar/google-calendar/GoogleCalendarService.js +333 -0
- package/lib/esm/calendar/google-calendar/GoogleCalendarService.js.map +1 -0
- package/lib/esm/calendar/google-calendar/index.js +3 -0
- package/lib/esm/calendar/google-calendar/index.js.map +1 -0
- package/lib/esm/comms/discord/DiscordService.js +313 -0
- package/lib/esm/comms/discord/DiscordService.js.map +1 -0
- package/lib/esm/comms/discord/index.js +2 -0
- package/lib/esm/comms/discord/index.js.map +1 -0
- package/lib/esm/comms/environment.js +16 -0
- package/lib/esm/comms/environment.js.map +1 -1
- package/lib/esm/comms/index.js +3 -0
- package/lib/esm/comms/index.js.map +1 -1
- package/lib/esm/comms/outlook/MicrosoftOutlookService.js +320 -0
- package/lib/esm/comms/outlook/MicrosoftOutlookService.js.map +1 -0
- package/lib/esm/comms/outlook/index.js +2 -0
- package/lib/esm/comms/outlook/index.js.map +1 -0
- package/lib/esm/comms/whatsapp/WhatsAppService.js +269 -0
- package/lib/esm/comms/whatsapp/WhatsAppService.js.map +1 -0
- package/lib/esm/comms/whatsapp/index.js +2 -0
- package/lib/esm/comms/whatsapp/index.js.map +1 -0
- package/lib/esm/index.js +3 -3
- package/lib/esm/io/confluence/ConfluenceService.js +312 -0
- package/lib/esm/io/confluence/ConfluenceService.js.map +1 -0
- package/lib/esm/io/confluence/index.js +2 -0
- package/lib/esm/io/confluence/index.js.map +1 -0
- package/lib/esm/io/environment.js +28 -0
- package/lib/esm/io/environment.js.map +1 -1
- package/lib/esm/io/google-docs/GoogleDocsService.js +270 -0
- package/lib/esm/io/google-docs/GoogleDocsService.js.map +1 -0
- package/lib/esm/io/google-docs/index.js +2 -0
- package/lib/esm/io/google-docs/index.js.map +1 -0
- package/lib/esm/io/index.js +5 -0
- package/lib/esm/io/index.js.map +1 -1
- package/lib/esm/io/jira/JiraService.js +349 -0
- package/lib/esm/io/jira/JiraService.js.map +1 -0
- package/lib/esm/io/jira/index.js +2 -0
- package/lib/esm/io/jira/index.js.map +1 -0
- package/lib/esm/io/microsoft-excel/MicrosoftExcelService.js +248 -0
- package/lib/esm/io/microsoft-excel/MicrosoftExcelService.js.map +1 -0
- package/lib/esm/io/microsoft-excel/index.js +2 -0
- package/lib/esm/io/microsoft-excel/index.js.map +1 -0
- package/lib/esm/io/microsoft-sharepoint/MicrosoftSharePointService.js +256 -0
- package/lib/esm/io/microsoft-sharepoint/MicrosoftSharePointService.js.map +1 -0
- package/lib/esm/io/microsoft-sharepoint/index.js +2 -0
- package/lib/esm/io/microsoft-sharepoint/index.js.map +1 -0
- package/lib/types/calendar/environment.d.cts +48 -0
- package/lib/types/calendar/environment.d.mts +48 -0
- package/lib/types/calendar/google-calendar/GoogleCalendarService.d.cts +316 -0
- package/lib/types/calendar/google-calendar/GoogleCalendarService.d.mts +316 -0
- package/lib/types/calendar/google-calendar/index.d.cts +2 -0
- package/lib/types/calendar/google-calendar/index.d.mts +2 -0
- package/lib/types/comms/discord/DiscordService.d.cts +285 -0
- package/lib/types/comms/discord/DiscordService.d.mts +285 -0
- package/lib/types/comms/discord/index.d.cts +1 -0
- package/lib/types/comms/discord/index.d.mts +1 -0
- package/lib/types/comms/environment.d.cts +34 -8
- package/lib/types/comms/environment.d.mts +34 -8
- package/lib/types/comms/index.d.cts +3 -0
- package/lib/types/comms/index.d.mts +3 -0
- package/lib/types/comms/outlook/MicrosoftOutlookService.d.cts +282 -0
- package/lib/types/comms/outlook/MicrosoftOutlookService.d.mts +282 -0
- package/lib/types/comms/outlook/index.d.cts +1 -0
- package/lib/types/comms/outlook/index.d.mts +1 -0
- package/lib/types/comms/whatsapp/WhatsAppService.d.cts +258 -0
- package/lib/types/comms/whatsapp/WhatsAppService.d.mts +258 -0
- package/lib/types/comms/whatsapp/index.d.cts +1 -0
- package/lib/types/comms/whatsapp/index.d.mts +1 -0
- package/lib/types/index.d.cts +2 -2
- package/lib/types/index.d.mts +2 -2
- package/lib/types/io/confluence/ConfluenceService.d.cts +250 -0
- package/lib/types/io/confluence/ConfluenceService.d.mts +250 -0
- package/lib/types/io/confluence/index.d.cts +1 -0
- package/lib/types/io/confluence/index.d.mts +1 -0
- package/lib/types/io/environment.d.cts +52 -12
- package/lib/types/io/environment.d.mts +52 -12
- package/lib/types/io/google-docs/GoogleDocsService.d.cts +188 -0
- package/lib/types/io/google-docs/GoogleDocsService.d.mts +188 -0
- package/lib/types/io/google-docs/index.d.cts +1 -0
- package/lib/types/io/google-docs/index.d.mts +1 -0
- package/lib/types/io/index.d.cts +5 -0
- package/lib/types/io/index.d.mts +5 -0
- package/lib/types/io/jira/JiraService.d.cts +300 -0
- package/lib/types/io/jira/JiraService.d.mts +300 -0
- package/lib/types/io/jira/index.d.cts +1 -0
- package/lib/types/io/jira/index.d.mts +1 -0
- package/lib/types/io/microsoft-excel/MicrosoftExcelService.d.cts +230 -0
- package/lib/types/io/microsoft-excel/MicrosoftExcelService.d.mts +230 -0
- package/lib/types/io/microsoft-excel/index.d.cts +1 -0
- package/lib/types/io/microsoft-excel/index.d.mts +1 -0
- package/lib/types/io/microsoft-sharepoint/MicrosoftSharePointService.d.cts +226 -0
- package/lib/types/io/microsoft-sharepoint/MicrosoftSharePointService.d.mts +226 -0
- package/lib/types/io/microsoft-sharepoint/index.d.cts +1 -0
- package/lib/types/io/microsoft-sharepoint/index.d.mts +1 -0
- package/package.json +101 -5
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { HttpApiService, type HttpApiServiceConfig } from "../../shared/http/index.d.cts";
|
|
2
|
+
/**
|
|
3
|
+
* @description Configuration for the Jira service
|
|
4
|
+
* @summary Extends {@link HttpApiServiceConfig} with the API `token`, the
|
|
5
|
+
* optional `username` that enables Basic authentication, and the required site
|
|
6
|
+
* `baseUrl`. When omitted, the `io.jira` environment slice supplies the same
|
|
7
|
+
* values (plus optional `timeout`).
|
|
8
|
+
* @category IO
|
|
9
|
+
* @memberOf module:integrations/io/jira/service
|
|
10
|
+
*/
|
|
11
|
+
export interface JiraServiceConfig extends HttpApiServiceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* @description Jira API token
|
|
14
|
+
* @summary Used as the Basic-auth password when `username` is set, otherwise as a bearer token.
|
|
15
|
+
*/
|
|
16
|
+
token?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description Jira account username for Basic authentication
|
|
19
|
+
*/
|
|
20
|
+
username?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description Input for creating a Jira issue
|
|
24
|
+
* @summary Carries the target `projectKey`, issue `summary`, optional
|
|
25
|
+
* `issueType` (default `Task`), `description`, and additional raw `fields`
|
|
26
|
+
* merged into the create payload.
|
|
27
|
+
* @category IO
|
|
28
|
+
* @memberOf module:integrations/io/jira/service
|
|
29
|
+
*/
|
|
30
|
+
export interface JiraIssueInput {
|
|
31
|
+
/**
|
|
32
|
+
* @description Project key that owns the new issue
|
|
33
|
+
*/
|
|
34
|
+
projectKey: string;
|
|
35
|
+
/**
|
|
36
|
+
* @description Issue summary
|
|
37
|
+
*/
|
|
38
|
+
summary: string;
|
|
39
|
+
/**
|
|
40
|
+
* @description Issue type name (default `Task`)
|
|
41
|
+
*/
|
|
42
|
+
issueType?: string;
|
|
43
|
+
/**
|
|
44
|
+
* @description Issue description
|
|
45
|
+
*/
|
|
46
|
+
description?: string;
|
|
47
|
+
/**
|
|
48
|
+
* @description Additional Jira fields merged into the create payload
|
|
49
|
+
*/
|
|
50
|
+
fields?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @description Input for updating a Jira issue
|
|
54
|
+
* @summary Carries the target `issueKey` and the `fields` map to update.
|
|
55
|
+
* @category IO
|
|
56
|
+
* @memberOf module:integrations/io/jira/service
|
|
57
|
+
*/
|
|
58
|
+
export interface JiraIssueUpdate {
|
|
59
|
+
/**
|
|
60
|
+
* @description Issue key to update (e.g. `"SAA-123"`)
|
|
61
|
+
*/
|
|
62
|
+
issueKey: string;
|
|
63
|
+
/**
|
|
64
|
+
* @description Fields to update
|
|
65
|
+
*/
|
|
66
|
+
fields: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @description Input for commenting on a Jira issue
|
|
70
|
+
* @summary Carries the target `issueKey` and the comment `body`.
|
|
71
|
+
* @category IO
|
|
72
|
+
* @memberOf module:integrations/io/jira/service
|
|
73
|
+
*/
|
|
74
|
+
export interface JiraCommentInput {
|
|
75
|
+
/**
|
|
76
|
+
* @description Issue key to comment on
|
|
77
|
+
*/
|
|
78
|
+
issueKey: string;
|
|
79
|
+
/**
|
|
80
|
+
* @description Comment body
|
|
81
|
+
*/
|
|
82
|
+
body: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @description Input for transitioning a Jira issue
|
|
86
|
+
* @summary Carries the target `issueKey` and the workflow `transitionId`.
|
|
87
|
+
* @category IO
|
|
88
|
+
* @memberOf module:integrations/io/jira/service
|
|
89
|
+
*/
|
|
90
|
+
export interface JiraTransitionInput {
|
|
91
|
+
/**
|
|
92
|
+
* @description Issue key to transition
|
|
93
|
+
*/
|
|
94
|
+
issueKey: string;
|
|
95
|
+
/**
|
|
96
|
+
* @description Workflow transition ID
|
|
97
|
+
*/
|
|
98
|
+
transitionId: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @description Input for a Jira JQL search
|
|
102
|
+
* @summary Carries the `jql` query, an optional result cap (default `50`), and
|
|
103
|
+
* an optional list of `fields` to project.
|
|
104
|
+
* @category IO
|
|
105
|
+
* @memberOf module:integrations/io/jira/service
|
|
106
|
+
*/
|
|
107
|
+
export interface JiraSearchInput {
|
|
108
|
+
/**
|
|
109
|
+
* @description JQL query expression
|
|
110
|
+
*/
|
|
111
|
+
jql: string;
|
|
112
|
+
/**
|
|
113
|
+
* @description Maximum number of results (default `50`)
|
|
114
|
+
*/
|
|
115
|
+
maxResults?: number;
|
|
116
|
+
/**
|
|
117
|
+
* @description Field names to include in the results
|
|
118
|
+
*/
|
|
119
|
+
fields?: string[];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @description Jira REST API integration service
|
|
123
|
+
* @summary An undecorated HTTP service for issue CRUD, comments, workflow
|
|
124
|
+
* transitions, and JQL search. The site base URL and API token are required;
|
|
125
|
+
* supplying a `username` switches authentication to Basic, and transport
|
|
126
|
+
* failures are mapped to decaf errors via {@link httpError}.
|
|
127
|
+
* @class JiraService
|
|
128
|
+
* @extends HttpApiService
|
|
129
|
+
* @category IO
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* import { JiraService } from "@decaf-ts/integrations/io/jira";
|
|
133
|
+
*
|
|
134
|
+
* const jira = new JiraService();
|
|
135
|
+
* await jira.initialize({
|
|
136
|
+
* baseUrl: "https://example.atlassian.net",
|
|
137
|
+
* username: process.env.JIRA_USERNAME,
|
|
138
|
+
* token: process.env.GRAPH_CREDENTIAL_JIRA_TOKEN,
|
|
139
|
+
* });
|
|
140
|
+
* const issue = await jira.createIssue({
|
|
141
|
+
* projectKey: "OPS",
|
|
142
|
+
* summary: "Deployment failed",
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
* @mermaid
|
|
146
|
+
* sequenceDiagram
|
|
147
|
+
* autonumber
|
|
148
|
+
* participant Caller
|
|
149
|
+
* participant Service as JiraService
|
|
150
|
+
* participant API as Jira REST API
|
|
151
|
+
* Caller->>Service: createIssue(input)
|
|
152
|
+
* activate Service
|
|
153
|
+
* Service->>Service: requireCredentials()
|
|
154
|
+
* Service->>API: POST /rest/api/2/issue
|
|
155
|
+
* activate API
|
|
156
|
+
* API-->>Service: { id, key }
|
|
157
|
+
* deactivate API
|
|
158
|
+
* Service-->>Caller: created issue
|
|
159
|
+
* deactivate Service
|
|
160
|
+
* @memberOf module:integrations/io/jira/service
|
|
161
|
+
*/
|
|
162
|
+
export declare class JiraService extends HttpApiService<JiraServiceConfig> {
|
|
163
|
+
/**
|
|
164
|
+
* @description The provider name used in error messages
|
|
165
|
+
*/
|
|
166
|
+
protected readonly serviceName = "Jira";
|
|
167
|
+
/**
|
|
168
|
+
* @description The default base URL for Jira
|
|
169
|
+
* @summary Returns an empty string; Jira is site-hosted, so the resolved
|
|
170
|
+
* `baseUrl` (from config or `io.jira.baseUrl`) is required.
|
|
171
|
+
* @returns {string} An empty string.
|
|
172
|
+
*/
|
|
173
|
+
protected defaultBaseUrl(): string;
|
|
174
|
+
/**
|
|
175
|
+
* @description Builds the Jira authentication headers
|
|
176
|
+
* @summary Uses HTTP Basic (`username:token`) when both values are present,
|
|
177
|
+
* otherwise a bearer token when only `token` is present. Always requests
|
|
178
|
+
* JSON responses.
|
|
179
|
+
* @param {JiraServiceConfig} config - The resolved service configuration.
|
|
180
|
+
* @returns {Record<string, string>} The authorization and accept headers.
|
|
181
|
+
*/
|
|
182
|
+
protected authHeaders(config: JiraServiceConfig): Record<string, string>;
|
|
183
|
+
/**
|
|
184
|
+
* @description Reads the Jira credentials and defaults from the environment
|
|
185
|
+
* @summary Reads the `io.jira` slice and returns a partial config when an
|
|
186
|
+
* API token is configured, `undefined` otherwise. Values pass through
|
|
187
|
+
* `envString`/`envNumber` to reject unset-leaf proxies.
|
|
188
|
+
* @returns {Partial<JiraServiceConfig> | undefined} A partial config, or `undefined` when no Jira token is configured.
|
|
189
|
+
*/
|
|
190
|
+
protected configFromEnvironment(): Partial<JiraServiceConfig> | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* @description Asserts that the Jira token and site base URL are configured
|
|
193
|
+
* @summary Called by every operation before it touches the network.
|
|
194
|
+
* @returns {void}
|
|
195
|
+
* @throws {InternalError} When no API token or base URL is configured.
|
|
196
|
+
*/
|
|
197
|
+
protected requireCredentials(): void;
|
|
198
|
+
/**
|
|
199
|
+
* @description Builds the encoded issue path
|
|
200
|
+
* @summary Validates the issue key and URL-encodes it into
|
|
201
|
+
* `/rest/api/2/issue/<key>`.
|
|
202
|
+
* @param {string} issueKey - The Jira issue key.
|
|
203
|
+
* @returns {string} The issue API path.
|
|
204
|
+
* @throws {InternalError} When `issueKey` is empty.
|
|
205
|
+
*/
|
|
206
|
+
private issuePath;
|
|
207
|
+
/**
|
|
208
|
+
* @description Creates a Jira issue
|
|
209
|
+
* @summary `POST`s the project, summary, issue type (default `Task`),
|
|
210
|
+
* optional description, and extra fields to `/rest/api/2/issue`.
|
|
211
|
+
* @param {JiraIssueInput} input - The issue definition.
|
|
212
|
+
* @returns {Promise<unknown>} The created issue payload (including `id` and `key`).
|
|
213
|
+
* @throws {InternalError} When credentials are missing, or the project key or summary is empty.
|
|
214
|
+
* @throws {BadRequestError} When Jira rejects the issue.
|
|
215
|
+
*/
|
|
216
|
+
createIssue(input: JiraIssueInput): Promise<unknown>;
|
|
217
|
+
/**
|
|
218
|
+
* @description Fetches a Jira issue
|
|
219
|
+
* @summary `GET`s the issue by key, optionally projecting the given field
|
|
220
|
+
* names.
|
|
221
|
+
* @param {string} issueKey - The issue key to fetch.
|
|
222
|
+
* @param {string[]} [fields] - Field names to include in the response.
|
|
223
|
+
* @returns {Promise<unknown>} The issue payload.
|
|
224
|
+
* @throws {InternalError} When credentials are missing or the issue key is empty.
|
|
225
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
226
|
+
* @throws {BadRequestError} When Jira rejects the request.
|
|
227
|
+
*/
|
|
228
|
+
getIssue(issueKey: string, fields?: string[]): Promise<unknown>;
|
|
229
|
+
/**
|
|
230
|
+
* @description Updates fields on a Jira issue
|
|
231
|
+
* @summary `PUT`s the `fields` map to the issue and returns
|
|
232
|
+
* `{ updated: true, issueKey }`.
|
|
233
|
+
* @param {JiraIssueUpdate} input - The issue key and fields to update.
|
|
234
|
+
* @returns {Promise<unknown>} `{ updated: true, issueKey }` on success.
|
|
235
|
+
* @throws {InternalError} When credentials are missing, or the issue key or fields are empty.
|
|
236
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
237
|
+
* @throws {BadRequestError} When Jira rejects the update.
|
|
238
|
+
*/
|
|
239
|
+
updateIssue(input: JiraIssueUpdate): Promise<unknown>;
|
|
240
|
+
/**
|
|
241
|
+
* @description Deletes a Jira issue
|
|
242
|
+
* @summary `DELETE`s the issue and returns `{ deleted: true, issueKey }`.
|
|
243
|
+
* @param {string} issueKey - The issue key to delete.
|
|
244
|
+
* @returns {Promise<unknown>} `{ deleted: true, issueKey }` on success.
|
|
245
|
+
* @throws {InternalError} When credentials are missing or the issue key is empty.
|
|
246
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
247
|
+
* @throws {BadRequestError} When Jira rejects the deletion.
|
|
248
|
+
*/
|
|
249
|
+
deleteIssue(issueKey: string): Promise<unknown>;
|
|
250
|
+
/**
|
|
251
|
+
* @description Adds a comment to a Jira issue
|
|
252
|
+
* @summary `POST`s the comment body to the issue's `/comment` endpoint.
|
|
253
|
+
* @param {JiraCommentInput} input - The issue key and comment body.
|
|
254
|
+
* @returns {Promise<unknown>} The created comment payload.
|
|
255
|
+
* @throws {InternalError} When credentials are missing, or the issue key or body is empty.
|
|
256
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
257
|
+
* @throws {BadRequestError} When Jira rejects the comment.
|
|
258
|
+
*/
|
|
259
|
+
addComment(input: JiraCommentInput): Promise<unknown>;
|
|
260
|
+
/**
|
|
261
|
+
* @description Lists the available workflow transitions for a Jira issue
|
|
262
|
+
* @summary `GET`s the issue's `/transitions` collection, whose IDs feed
|
|
263
|
+
* {@link JiraService.transitionIssue}.
|
|
264
|
+
* @param {string} issueKey - The issue key.
|
|
265
|
+
* @returns {Promise<unknown>} The available transitions payload.
|
|
266
|
+
* @throws {InternalError} When credentials are missing or the issue key is empty.
|
|
267
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
268
|
+
* @throws {BadRequestError} When Jira rejects the request.
|
|
269
|
+
*/
|
|
270
|
+
getTransitions(issueKey: string): Promise<unknown>;
|
|
271
|
+
/**
|
|
272
|
+
* @description Transitions a Jira issue through its workflow
|
|
273
|
+
* @summary `POST`s the transition ID to the issue's `/transitions` endpoint
|
|
274
|
+
* and returns the applied transition identifiers.
|
|
275
|
+
* @param {JiraTransitionInput} input - The issue key and transition ID.
|
|
276
|
+
* @returns {Promise<unknown>} `{ transitioned: true, issueKey, transitionId }` on success.
|
|
277
|
+
* @throws {InternalError} When credentials are missing, or the issue key or transition ID is empty.
|
|
278
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
279
|
+
* @throws {BadRequestError} When Jira rejects the transition.
|
|
280
|
+
*/
|
|
281
|
+
transitionIssue(input: JiraTransitionInput): Promise<unknown>;
|
|
282
|
+
/**
|
|
283
|
+
* @description Searches Jira issues with JQL
|
|
284
|
+
* @summary `POST`s the JQL query to `/rest/api/2/search` with a result cap
|
|
285
|
+
* (default `50`) and optional field projection.
|
|
286
|
+
* @param {JiraSearchInput} input - The JQL query and search options.
|
|
287
|
+
* @returns {Promise<unknown>} The search result payload.
|
|
288
|
+
* @throws {InternalError} When credentials are missing or the JQL query is empty.
|
|
289
|
+
* @throws {BadRequestError} When the JQL query is invalid.
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* const results = await jira.search({
|
|
293
|
+
* jql: 'project = "OPS" AND status = "Open"',
|
|
294
|
+
* maxResults: 100,
|
|
295
|
+
* fields: ["summary", "status"],
|
|
296
|
+
* });
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
search(input: JiraSearchInput): Promise<unknown>;
|
|
300
|
+
}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { HttpApiService, type HttpApiServiceConfig } from "../../shared/http/index.d.mts";
|
|
2
|
+
/**
|
|
3
|
+
* @description Configuration for the Jira service
|
|
4
|
+
* @summary Extends {@link HttpApiServiceConfig} with the API `token`, the
|
|
5
|
+
* optional `username` that enables Basic authentication, and the required site
|
|
6
|
+
* `baseUrl`. When omitted, the `io.jira` environment slice supplies the same
|
|
7
|
+
* values (plus optional `timeout`).
|
|
8
|
+
* @category IO
|
|
9
|
+
* @memberOf module:integrations/io/jira/service
|
|
10
|
+
*/
|
|
11
|
+
export interface JiraServiceConfig extends HttpApiServiceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* @description Jira API token
|
|
14
|
+
* @summary Used as the Basic-auth password when `username` is set, otherwise as a bearer token.
|
|
15
|
+
*/
|
|
16
|
+
token?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description Jira account username for Basic authentication
|
|
19
|
+
*/
|
|
20
|
+
username?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description Input for creating a Jira issue
|
|
24
|
+
* @summary Carries the target `projectKey`, issue `summary`, optional
|
|
25
|
+
* `issueType` (default `Task`), `description`, and additional raw `fields`
|
|
26
|
+
* merged into the create payload.
|
|
27
|
+
* @category IO
|
|
28
|
+
* @memberOf module:integrations/io/jira/service
|
|
29
|
+
*/
|
|
30
|
+
export interface JiraIssueInput {
|
|
31
|
+
/**
|
|
32
|
+
* @description Project key that owns the new issue
|
|
33
|
+
*/
|
|
34
|
+
projectKey: string;
|
|
35
|
+
/**
|
|
36
|
+
* @description Issue summary
|
|
37
|
+
*/
|
|
38
|
+
summary: string;
|
|
39
|
+
/**
|
|
40
|
+
* @description Issue type name (default `Task`)
|
|
41
|
+
*/
|
|
42
|
+
issueType?: string;
|
|
43
|
+
/**
|
|
44
|
+
* @description Issue description
|
|
45
|
+
*/
|
|
46
|
+
description?: string;
|
|
47
|
+
/**
|
|
48
|
+
* @description Additional Jira fields merged into the create payload
|
|
49
|
+
*/
|
|
50
|
+
fields?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @description Input for updating a Jira issue
|
|
54
|
+
* @summary Carries the target `issueKey` and the `fields` map to update.
|
|
55
|
+
* @category IO
|
|
56
|
+
* @memberOf module:integrations/io/jira/service
|
|
57
|
+
*/
|
|
58
|
+
export interface JiraIssueUpdate {
|
|
59
|
+
/**
|
|
60
|
+
* @description Issue key to update (e.g. `"SAA-123"`)
|
|
61
|
+
*/
|
|
62
|
+
issueKey: string;
|
|
63
|
+
/**
|
|
64
|
+
* @description Fields to update
|
|
65
|
+
*/
|
|
66
|
+
fields: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @description Input for commenting on a Jira issue
|
|
70
|
+
* @summary Carries the target `issueKey` and the comment `body`.
|
|
71
|
+
* @category IO
|
|
72
|
+
* @memberOf module:integrations/io/jira/service
|
|
73
|
+
*/
|
|
74
|
+
export interface JiraCommentInput {
|
|
75
|
+
/**
|
|
76
|
+
* @description Issue key to comment on
|
|
77
|
+
*/
|
|
78
|
+
issueKey: string;
|
|
79
|
+
/**
|
|
80
|
+
* @description Comment body
|
|
81
|
+
*/
|
|
82
|
+
body: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @description Input for transitioning a Jira issue
|
|
86
|
+
* @summary Carries the target `issueKey` and the workflow `transitionId`.
|
|
87
|
+
* @category IO
|
|
88
|
+
* @memberOf module:integrations/io/jira/service
|
|
89
|
+
*/
|
|
90
|
+
export interface JiraTransitionInput {
|
|
91
|
+
/**
|
|
92
|
+
* @description Issue key to transition
|
|
93
|
+
*/
|
|
94
|
+
issueKey: string;
|
|
95
|
+
/**
|
|
96
|
+
* @description Workflow transition ID
|
|
97
|
+
*/
|
|
98
|
+
transitionId: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @description Input for a Jira JQL search
|
|
102
|
+
* @summary Carries the `jql` query, an optional result cap (default `50`), and
|
|
103
|
+
* an optional list of `fields` to project.
|
|
104
|
+
* @category IO
|
|
105
|
+
* @memberOf module:integrations/io/jira/service
|
|
106
|
+
*/
|
|
107
|
+
export interface JiraSearchInput {
|
|
108
|
+
/**
|
|
109
|
+
* @description JQL query expression
|
|
110
|
+
*/
|
|
111
|
+
jql: string;
|
|
112
|
+
/**
|
|
113
|
+
* @description Maximum number of results (default `50`)
|
|
114
|
+
*/
|
|
115
|
+
maxResults?: number;
|
|
116
|
+
/**
|
|
117
|
+
* @description Field names to include in the results
|
|
118
|
+
*/
|
|
119
|
+
fields?: string[];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @description Jira REST API integration service
|
|
123
|
+
* @summary An undecorated HTTP service for issue CRUD, comments, workflow
|
|
124
|
+
* transitions, and JQL search. The site base URL and API token are required;
|
|
125
|
+
* supplying a `username` switches authentication to Basic, and transport
|
|
126
|
+
* failures are mapped to decaf errors via {@link httpError}.
|
|
127
|
+
* @class JiraService
|
|
128
|
+
* @extends HttpApiService
|
|
129
|
+
* @category IO
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* import { JiraService } from "@decaf-ts/integrations/io/jira";
|
|
133
|
+
*
|
|
134
|
+
* const jira = new JiraService();
|
|
135
|
+
* await jira.initialize({
|
|
136
|
+
* baseUrl: "https://example.atlassian.net",
|
|
137
|
+
* username: process.env.JIRA_USERNAME,
|
|
138
|
+
* token: process.env.GRAPH_CREDENTIAL_JIRA_TOKEN,
|
|
139
|
+
* });
|
|
140
|
+
* const issue = await jira.createIssue({
|
|
141
|
+
* projectKey: "OPS",
|
|
142
|
+
* summary: "Deployment failed",
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
* @mermaid
|
|
146
|
+
* sequenceDiagram
|
|
147
|
+
* autonumber
|
|
148
|
+
* participant Caller
|
|
149
|
+
* participant Service as JiraService
|
|
150
|
+
* participant API as Jira REST API
|
|
151
|
+
* Caller->>Service: createIssue(input)
|
|
152
|
+
* activate Service
|
|
153
|
+
* Service->>Service: requireCredentials()
|
|
154
|
+
* Service->>API: POST /rest/api/2/issue
|
|
155
|
+
* activate API
|
|
156
|
+
* API-->>Service: { id, key }
|
|
157
|
+
* deactivate API
|
|
158
|
+
* Service-->>Caller: created issue
|
|
159
|
+
* deactivate Service
|
|
160
|
+
* @memberOf module:integrations/io/jira/service
|
|
161
|
+
*/
|
|
162
|
+
export declare class JiraService extends HttpApiService<JiraServiceConfig> {
|
|
163
|
+
/**
|
|
164
|
+
* @description The provider name used in error messages
|
|
165
|
+
*/
|
|
166
|
+
protected readonly serviceName = "Jira";
|
|
167
|
+
/**
|
|
168
|
+
* @description The default base URL for Jira
|
|
169
|
+
* @summary Returns an empty string; Jira is site-hosted, so the resolved
|
|
170
|
+
* `baseUrl` (from config or `io.jira.baseUrl`) is required.
|
|
171
|
+
* @returns {string} An empty string.
|
|
172
|
+
*/
|
|
173
|
+
protected defaultBaseUrl(): string;
|
|
174
|
+
/**
|
|
175
|
+
* @description Builds the Jira authentication headers
|
|
176
|
+
* @summary Uses HTTP Basic (`username:token`) when both values are present,
|
|
177
|
+
* otherwise a bearer token when only `token` is present. Always requests
|
|
178
|
+
* JSON responses.
|
|
179
|
+
* @param {JiraServiceConfig} config - The resolved service configuration.
|
|
180
|
+
* @returns {Record<string, string>} The authorization and accept headers.
|
|
181
|
+
*/
|
|
182
|
+
protected authHeaders(config: JiraServiceConfig): Record<string, string>;
|
|
183
|
+
/**
|
|
184
|
+
* @description Reads the Jira credentials and defaults from the environment
|
|
185
|
+
* @summary Reads the `io.jira` slice and returns a partial config when an
|
|
186
|
+
* API token is configured, `undefined` otherwise. Values pass through
|
|
187
|
+
* `envString`/`envNumber` to reject unset-leaf proxies.
|
|
188
|
+
* @returns {Partial<JiraServiceConfig> | undefined} A partial config, or `undefined` when no Jira token is configured.
|
|
189
|
+
*/
|
|
190
|
+
protected configFromEnvironment(): Partial<JiraServiceConfig> | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* @description Asserts that the Jira token and site base URL are configured
|
|
193
|
+
* @summary Called by every operation before it touches the network.
|
|
194
|
+
* @returns {void}
|
|
195
|
+
* @throws {InternalError} When no API token or base URL is configured.
|
|
196
|
+
*/
|
|
197
|
+
protected requireCredentials(): void;
|
|
198
|
+
/**
|
|
199
|
+
* @description Builds the encoded issue path
|
|
200
|
+
* @summary Validates the issue key and URL-encodes it into
|
|
201
|
+
* `/rest/api/2/issue/<key>`.
|
|
202
|
+
* @param {string} issueKey - The Jira issue key.
|
|
203
|
+
* @returns {string} The issue API path.
|
|
204
|
+
* @throws {InternalError} When `issueKey` is empty.
|
|
205
|
+
*/
|
|
206
|
+
private issuePath;
|
|
207
|
+
/**
|
|
208
|
+
* @description Creates a Jira issue
|
|
209
|
+
* @summary `POST`s the project, summary, issue type (default `Task`),
|
|
210
|
+
* optional description, and extra fields to `/rest/api/2/issue`.
|
|
211
|
+
* @param {JiraIssueInput} input - The issue definition.
|
|
212
|
+
* @returns {Promise<unknown>} The created issue payload (including `id` and `key`).
|
|
213
|
+
* @throws {InternalError} When credentials are missing, or the project key or summary is empty.
|
|
214
|
+
* @throws {BadRequestError} When Jira rejects the issue.
|
|
215
|
+
*/
|
|
216
|
+
createIssue(input: JiraIssueInput): Promise<unknown>;
|
|
217
|
+
/**
|
|
218
|
+
* @description Fetches a Jira issue
|
|
219
|
+
* @summary `GET`s the issue by key, optionally projecting the given field
|
|
220
|
+
* names.
|
|
221
|
+
* @param {string} issueKey - The issue key to fetch.
|
|
222
|
+
* @param {string[]} [fields] - Field names to include in the response.
|
|
223
|
+
* @returns {Promise<unknown>} The issue payload.
|
|
224
|
+
* @throws {InternalError} When credentials are missing or the issue key is empty.
|
|
225
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
226
|
+
* @throws {BadRequestError} When Jira rejects the request.
|
|
227
|
+
*/
|
|
228
|
+
getIssue(issueKey: string, fields?: string[]): Promise<unknown>;
|
|
229
|
+
/**
|
|
230
|
+
* @description Updates fields on a Jira issue
|
|
231
|
+
* @summary `PUT`s the `fields` map to the issue and returns
|
|
232
|
+
* `{ updated: true, issueKey }`.
|
|
233
|
+
* @param {JiraIssueUpdate} input - The issue key and fields to update.
|
|
234
|
+
* @returns {Promise<unknown>} `{ updated: true, issueKey }` on success.
|
|
235
|
+
* @throws {InternalError} When credentials are missing, or the issue key or fields are empty.
|
|
236
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
237
|
+
* @throws {BadRequestError} When Jira rejects the update.
|
|
238
|
+
*/
|
|
239
|
+
updateIssue(input: JiraIssueUpdate): Promise<unknown>;
|
|
240
|
+
/**
|
|
241
|
+
* @description Deletes a Jira issue
|
|
242
|
+
* @summary `DELETE`s the issue and returns `{ deleted: true, issueKey }`.
|
|
243
|
+
* @param {string} issueKey - The issue key to delete.
|
|
244
|
+
* @returns {Promise<unknown>} `{ deleted: true, issueKey }` on success.
|
|
245
|
+
* @throws {InternalError} When credentials are missing or the issue key is empty.
|
|
246
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
247
|
+
* @throws {BadRequestError} When Jira rejects the deletion.
|
|
248
|
+
*/
|
|
249
|
+
deleteIssue(issueKey: string): Promise<unknown>;
|
|
250
|
+
/**
|
|
251
|
+
* @description Adds a comment to a Jira issue
|
|
252
|
+
* @summary `POST`s the comment body to the issue's `/comment` endpoint.
|
|
253
|
+
* @param {JiraCommentInput} input - The issue key and comment body.
|
|
254
|
+
* @returns {Promise<unknown>} The created comment payload.
|
|
255
|
+
* @throws {InternalError} When credentials are missing, or the issue key or body is empty.
|
|
256
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
257
|
+
* @throws {BadRequestError} When Jira rejects the comment.
|
|
258
|
+
*/
|
|
259
|
+
addComment(input: JiraCommentInput): Promise<unknown>;
|
|
260
|
+
/**
|
|
261
|
+
* @description Lists the available workflow transitions for a Jira issue
|
|
262
|
+
* @summary `GET`s the issue's `/transitions` collection, whose IDs feed
|
|
263
|
+
* {@link JiraService.transitionIssue}.
|
|
264
|
+
* @param {string} issueKey - The issue key.
|
|
265
|
+
* @returns {Promise<unknown>} The available transitions payload.
|
|
266
|
+
* @throws {InternalError} When credentials are missing or the issue key is empty.
|
|
267
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
268
|
+
* @throws {BadRequestError} When Jira rejects the request.
|
|
269
|
+
*/
|
|
270
|
+
getTransitions(issueKey: string): Promise<unknown>;
|
|
271
|
+
/**
|
|
272
|
+
* @description Transitions a Jira issue through its workflow
|
|
273
|
+
* @summary `POST`s the transition ID to the issue's `/transitions` endpoint
|
|
274
|
+
* and returns the applied transition identifiers.
|
|
275
|
+
* @param {JiraTransitionInput} input - The issue key and transition ID.
|
|
276
|
+
* @returns {Promise<unknown>} `{ transitioned: true, issueKey, transitionId }` on success.
|
|
277
|
+
* @throws {InternalError} When credentials are missing, or the issue key or transition ID is empty.
|
|
278
|
+
* @throws {NotFoundError} When the issue does not exist (HTTP 404).
|
|
279
|
+
* @throws {BadRequestError} When Jira rejects the transition.
|
|
280
|
+
*/
|
|
281
|
+
transitionIssue(input: JiraTransitionInput): Promise<unknown>;
|
|
282
|
+
/**
|
|
283
|
+
* @description Searches Jira issues with JQL
|
|
284
|
+
* @summary `POST`s the JQL query to `/rest/api/2/search` with a result cap
|
|
285
|
+
* (default `50`) and optional field projection.
|
|
286
|
+
* @param {JiraSearchInput} input - The JQL query and search options.
|
|
287
|
+
* @returns {Promise<unknown>} The search result payload.
|
|
288
|
+
* @throws {InternalError} When credentials are missing or the JQL query is empty.
|
|
289
|
+
* @throws {BadRequestError} When the JQL query is invalid.
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* const results = await jira.search({
|
|
293
|
+
* jql: 'project = "OPS" AND status = "Open"',
|
|
294
|
+
* maxResults: 100,
|
|
295
|
+
* fields: ["summary", "status"],
|
|
296
|
+
* });
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
search(input: JiraSearchInput): Promise<unknown>;
|
|
300
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./JiraService.d.cts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./JiraService.d.mts";
|