@decaf-ts/integrations 0.12.0 → 0.14.2

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.
Files changed (156) hide show
  1. package/dist/integrations.cjs +1 -1
  2. package/lib/cjs/calendar/environment.cjs +48 -0
  3. package/lib/cjs/calendar/environment.cjs.map +1 -0
  4. package/lib/cjs/calendar/google-calendar/GoogleCalendarService.cjs +338 -0
  5. package/lib/cjs/calendar/google-calendar/GoogleCalendarService.cjs.map +1 -0
  6. package/lib/cjs/calendar/google-calendar/index.cjs +20 -0
  7. package/lib/cjs/calendar/google-calendar/index.cjs.map +1 -0
  8. package/lib/cjs/comms/discord/DiscordService.cjs +318 -0
  9. package/lib/cjs/comms/discord/DiscordService.cjs.map +1 -0
  10. package/lib/cjs/comms/discord/index.cjs +19 -0
  11. package/lib/cjs/comms/discord/index.cjs.map +1 -0
  12. package/lib/cjs/comms/environment.cjs +16 -0
  13. package/lib/cjs/comms/environment.cjs.map +1 -1
  14. package/lib/cjs/comms/index.cjs +3 -0
  15. package/lib/cjs/comms/index.cjs.map +1 -1
  16. package/lib/cjs/comms/outlook/MicrosoftOutlookService.cjs +325 -0
  17. package/lib/cjs/comms/outlook/MicrosoftOutlookService.cjs.map +1 -0
  18. package/lib/cjs/comms/outlook/index.cjs +19 -0
  19. package/lib/cjs/comms/outlook/index.cjs.map +1 -0
  20. package/lib/cjs/comms/whatsapp/WhatsAppService.cjs +274 -0
  21. package/lib/cjs/comms/whatsapp/WhatsAppService.cjs.map +1 -0
  22. package/lib/cjs/comms/whatsapp/index.cjs +19 -0
  23. package/lib/cjs/comms/whatsapp/index.cjs.map +1 -0
  24. package/lib/cjs/index.cjs +3 -3
  25. package/lib/cjs/io/confluence/ConfluenceService.cjs +317 -0
  26. package/lib/cjs/io/confluence/ConfluenceService.cjs.map +1 -0
  27. package/lib/cjs/io/confluence/index.cjs +19 -0
  28. package/lib/cjs/io/confluence/index.cjs.map +1 -0
  29. package/lib/cjs/io/environment.cjs +28 -0
  30. package/lib/cjs/io/environment.cjs.map +1 -1
  31. package/lib/cjs/io/google-docs/GoogleDocsService.cjs +275 -0
  32. package/lib/cjs/io/google-docs/GoogleDocsService.cjs.map +1 -0
  33. package/lib/cjs/io/google-docs/index.cjs +19 -0
  34. package/lib/cjs/io/google-docs/index.cjs.map +1 -0
  35. package/lib/cjs/io/index.cjs +5 -0
  36. package/lib/cjs/io/index.cjs.map +1 -1
  37. package/lib/cjs/io/jira/JiraService.cjs +354 -0
  38. package/lib/cjs/io/jira/JiraService.cjs.map +1 -0
  39. package/lib/cjs/io/jira/index.cjs +19 -0
  40. package/lib/cjs/io/jira/index.cjs.map +1 -0
  41. package/lib/cjs/io/microsoft-excel/MicrosoftExcelService.cjs +253 -0
  42. package/lib/cjs/io/microsoft-excel/MicrosoftExcelService.cjs.map +1 -0
  43. package/lib/cjs/io/microsoft-excel/index.cjs +19 -0
  44. package/lib/cjs/io/microsoft-excel/index.cjs.map +1 -0
  45. package/lib/cjs/io/microsoft-sharepoint/MicrosoftSharePointService.cjs +261 -0
  46. package/lib/cjs/io/microsoft-sharepoint/MicrosoftSharePointService.cjs.map +1 -0
  47. package/lib/cjs/io/microsoft-sharepoint/index.cjs +19 -0
  48. package/lib/cjs/io/microsoft-sharepoint/index.cjs.map +1 -0
  49. package/lib/cjs/sftp/aws/index.cjs +24 -0
  50. package/lib/cjs/sftp/aws/index.cjs.map +1 -0
  51. package/lib/cjs/sftp/ssh2/index.cjs +24 -0
  52. package/lib/cjs/sftp/ssh2/index.cjs.map +1 -0
  53. package/lib/esm/calendar/environment.js +44 -0
  54. package/lib/esm/calendar/environment.js.map +1 -0
  55. package/lib/esm/calendar/google-calendar/GoogleCalendarService.js +333 -0
  56. package/lib/esm/calendar/google-calendar/GoogleCalendarService.js.map +1 -0
  57. package/lib/esm/calendar/google-calendar/index.js +3 -0
  58. package/lib/esm/calendar/google-calendar/index.js.map +1 -0
  59. package/lib/esm/comms/discord/DiscordService.js +313 -0
  60. package/lib/esm/comms/discord/DiscordService.js.map +1 -0
  61. package/lib/esm/comms/discord/index.js +2 -0
  62. package/lib/esm/comms/discord/index.js.map +1 -0
  63. package/lib/esm/comms/environment.js +16 -0
  64. package/lib/esm/comms/environment.js.map +1 -1
  65. package/lib/esm/comms/index.js +3 -0
  66. package/lib/esm/comms/index.js.map +1 -1
  67. package/lib/esm/comms/outlook/MicrosoftOutlookService.js +320 -0
  68. package/lib/esm/comms/outlook/MicrosoftOutlookService.js.map +1 -0
  69. package/lib/esm/comms/outlook/index.js +2 -0
  70. package/lib/esm/comms/outlook/index.js.map +1 -0
  71. package/lib/esm/comms/whatsapp/WhatsAppService.js +269 -0
  72. package/lib/esm/comms/whatsapp/WhatsAppService.js.map +1 -0
  73. package/lib/esm/comms/whatsapp/index.js +2 -0
  74. package/lib/esm/comms/whatsapp/index.js.map +1 -0
  75. package/lib/esm/index.js +3 -3
  76. package/lib/esm/io/confluence/ConfluenceService.js +312 -0
  77. package/lib/esm/io/confluence/ConfluenceService.js.map +1 -0
  78. package/lib/esm/io/confluence/index.js +2 -0
  79. package/lib/esm/io/confluence/index.js.map +1 -0
  80. package/lib/esm/io/environment.js +28 -0
  81. package/lib/esm/io/environment.js.map +1 -1
  82. package/lib/esm/io/google-docs/GoogleDocsService.js +270 -0
  83. package/lib/esm/io/google-docs/GoogleDocsService.js.map +1 -0
  84. package/lib/esm/io/google-docs/index.js +2 -0
  85. package/lib/esm/io/google-docs/index.js.map +1 -0
  86. package/lib/esm/io/index.js +5 -0
  87. package/lib/esm/io/index.js.map +1 -1
  88. package/lib/esm/io/jira/JiraService.js +349 -0
  89. package/lib/esm/io/jira/JiraService.js.map +1 -0
  90. package/lib/esm/io/jira/index.js +2 -0
  91. package/lib/esm/io/jira/index.js.map +1 -0
  92. package/lib/esm/io/microsoft-excel/MicrosoftExcelService.js +248 -0
  93. package/lib/esm/io/microsoft-excel/MicrosoftExcelService.js.map +1 -0
  94. package/lib/esm/io/microsoft-excel/index.js +2 -0
  95. package/lib/esm/io/microsoft-excel/index.js.map +1 -0
  96. package/lib/esm/io/microsoft-sharepoint/MicrosoftSharePointService.js +256 -0
  97. package/lib/esm/io/microsoft-sharepoint/MicrosoftSharePointService.js.map +1 -0
  98. package/lib/esm/io/microsoft-sharepoint/index.js +2 -0
  99. package/lib/esm/io/microsoft-sharepoint/index.js.map +1 -0
  100. package/lib/esm/sftp/aws/index.js +7 -0
  101. package/lib/esm/sftp/aws/index.js.map +1 -0
  102. package/lib/esm/sftp/ssh2/index.js +7 -0
  103. package/lib/esm/sftp/ssh2/index.js.map +1 -0
  104. package/lib/types/calendar/environment.d.cts +48 -0
  105. package/lib/types/calendar/environment.d.mts +48 -0
  106. package/lib/types/calendar/google-calendar/GoogleCalendarService.d.cts +316 -0
  107. package/lib/types/calendar/google-calendar/GoogleCalendarService.d.mts +316 -0
  108. package/lib/types/calendar/google-calendar/index.d.cts +2 -0
  109. package/lib/types/calendar/google-calendar/index.d.mts +2 -0
  110. package/lib/types/comms/discord/DiscordService.d.cts +285 -0
  111. package/lib/types/comms/discord/DiscordService.d.mts +285 -0
  112. package/lib/types/comms/discord/index.d.cts +1 -0
  113. package/lib/types/comms/discord/index.d.mts +1 -0
  114. package/lib/types/comms/environment.d.cts +34 -8
  115. package/lib/types/comms/environment.d.mts +34 -8
  116. package/lib/types/comms/index.d.cts +3 -0
  117. package/lib/types/comms/index.d.mts +3 -0
  118. package/lib/types/comms/outlook/MicrosoftOutlookService.d.cts +282 -0
  119. package/lib/types/comms/outlook/MicrosoftOutlookService.d.mts +282 -0
  120. package/lib/types/comms/outlook/index.d.cts +1 -0
  121. package/lib/types/comms/outlook/index.d.mts +1 -0
  122. package/lib/types/comms/whatsapp/WhatsAppService.d.cts +258 -0
  123. package/lib/types/comms/whatsapp/WhatsAppService.d.mts +258 -0
  124. package/lib/types/comms/whatsapp/index.d.cts +1 -0
  125. package/lib/types/comms/whatsapp/index.d.mts +1 -0
  126. package/lib/types/index.d.cts +2 -2
  127. package/lib/types/index.d.mts +2 -2
  128. package/lib/types/io/confluence/ConfluenceService.d.cts +250 -0
  129. package/lib/types/io/confluence/ConfluenceService.d.mts +250 -0
  130. package/lib/types/io/confluence/index.d.cts +1 -0
  131. package/lib/types/io/confluence/index.d.mts +1 -0
  132. package/lib/types/io/environment.d.cts +52 -12
  133. package/lib/types/io/environment.d.mts +52 -12
  134. package/lib/types/io/google-docs/GoogleDocsService.d.cts +188 -0
  135. package/lib/types/io/google-docs/GoogleDocsService.d.mts +188 -0
  136. package/lib/types/io/google-docs/index.d.cts +1 -0
  137. package/lib/types/io/google-docs/index.d.mts +1 -0
  138. package/lib/types/io/index.d.cts +5 -0
  139. package/lib/types/io/index.d.mts +5 -0
  140. package/lib/types/io/jira/JiraService.d.cts +300 -0
  141. package/lib/types/io/jira/JiraService.d.mts +300 -0
  142. package/lib/types/io/jira/index.d.cts +1 -0
  143. package/lib/types/io/jira/index.d.mts +1 -0
  144. package/lib/types/io/microsoft-excel/MicrosoftExcelService.d.cts +230 -0
  145. package/lib/types/io/microsoft-excel/MicrosoftExcelService.d.mts +230 -0
  146. package/lib/types/io/microsoft-excel/index.d.cts +1 -0
  147. package/lib/types/io/microsoft-excel/index.d.mts +1 -0
  148. package/lib/types/io/microsoft-sharepoint/MicrosoftSharePointService.d.cts +226 -0
  149. package/lib/types/io/microsoft-sharepoint/MicrosoftSharePointService.d.mts +226 -0
  150. package/lib/types/io/microsoft-sharepoint/index.d.cts +1 -0
  151. package/lib/types/io/microsoft-sharepoint/index.d.mts +1 -0
  152. package/lib/types/sftp/aws/index.d.cts +6 -0
  153. package/lib/types/sftp/aws/index.d.mts +6 -0
  154. package/lib/types/sftp/ssh2/index.d.cts +6 -0
  155. package/lib/types/sftp/ssh2/index.d.mts +6 -0
  156. package/package.json +263 -59
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/io/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oCAA2B;AAC3B,yCAAgC;AAChC,mCAA0B;AAC1B,uCAA8B;AAC9B,iCAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/io/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oCAA2B;AAC3B,yCAAgC;AAChC,mCAA0B;AAC1B,uCAA8B;AAC9B,2CAAkC;AAClC,sCAA6B;AAC7B,gCAAuB;AACvB,uCAA8B;AAC9B,gDAAuC;AACvC,iCAA8B"}
@@ -0,0 +1,349 @@
1
+ /**
2
+ * @module integrations/io/jira/service
3
+ * @summary Jira REST API integration service for issues, comments, and workflows.
4
+ * @description Exposes Jira issue operations (create, read, update, delete,
5
+ * comment, transition, and JQL search) through the Jira REST `api/2` surface as
6
+ * an undecorated client-based service built on {@link HttpApiService}.
7
+ * Configuration comes from an explicit `JiraServiceConfig` or the `io.jira`
8
+ * environment slice. When both `username` and `token` are configured the
9
+ * service sends HTTP Basic authentication (API token as the password);
10
+ * otherwise the token is sent as a bearer token. The site `baseUrl` is
11
+ * required. Credentials are referenced from configuration (and, from as-graph
12
+ * nodes, from the resolved `jira` credential secret) and are never embedded in
13
+ * source. Failures are mapped to decaf errors via {@link httpError}.
14
+ */
15
+ import { InternalError } from "@decaf-ts/db-decorators";
16
+ import { IoEnvironment } from "./../environment.js";
17
+ import { envNumber, envString } from "./../../shared/environmentValue.js";
18
+ import { HttpApiService, httpError, } from "./../../shared/http/index.js";
19
+ /** Default issue type written when a create does not specify one (`"Task"`). */
20
+ const DEFAULT_ISSUE_TYPE = "Task";
21
+ /**
22
+ * @description Jira REST API integration service
23
+ * @summary An undecorated HTTP service for issue CRUD, comments, workflow
24
+ * transitions, and JQL search. The site base URL and API token are required;
25
+ * supplying a `username` switches authentication to Basic, and transport
26
+ * failures are mapped to decaf errors via {@link httpError}.
27
+ * @class JiraService
28
+ * @extends HttpApiService
29
+ * @category IO
30
+ * @example
31
+ * ```ts
32
+ * import { JiraService } from "@decaf-ts/integrations/io/jira";
33
+ *
34
+ * const jira = new JiraService();
35
+ * await jira.initialize({
36
+ * baseUrl: "https://example.atlassian.net",
37
+ * username: process.env.JIRA_USERNAME,
38
+ * token: process.env.GRAPH_CREDENTIAL_JIRA_TOKEN,
39
+ * });
40
+ * const issue = await jira.createIssue({
41
+ * projectKey: "OPS",
42
+ * summary: "Deployment failed",
43
+ * });
44
+ * ```
45
+ * @mermaid
46
+ * sequenceDiagram
47
+ * autonumber
48
+ * participant Caller
49
+ * participant Service as JiraService
50
+ * participant API as Jira REST API
51
+ * Caller->>Service: createIssue(input)
52
+ * activate Service
53
+ * Service->>Service: requireCredentials()
54
+ * Service->>API: POST /rest/api/2/issue
55
+ * activate API
56
+ * API-->>Service: { id, key }
57
+ * deactivate API
58
+ * Service-->>Caller: created issue
59
+ * deactivate Service
60
+ * @memberOf module:integrations/io/jira/service
61
+ */
62
+ export class JiraService extends HttpApiService {
63
+ constructor() {
64
+ super(...arguments);
65
+ /**
66
+ * @description The provider name used in error messages
67
+ */
68
+ this.serviceName = "Jira";
69
+ }
70
+ /**
71
+ * @description The default base URL for Jira
72
+ * @summary Returns an empty string; Jira is site-hosted, so the resolved
73
+ * `baseUrl` (from config or `io.jira.baseUrl`) is required.
74
+ * @returns {string} An empty string.
75
+ */
76
+ defaultBaseUrl() {
77
+ return "";
78
+ }
79
+ /**
80
+ * @description Builds the Jira authentication headers
81
+ * @summary Uses HTTP Basic (`username:token`) when both values are present,
82
+ * otherwise a bearer token when only `token` is present. Always requests
83
+ * JSON responses.
84
+ * @param {JiraServiceConfig} config - The resolved service configuration.
85
+ * @returns {Record<string, string>} The authorization and accept headers.
86
+ */
87
+ authHeaders(config) {
88
+ if (config.username && config.token) {
89
+ const encoded = Buffer.from(`${config.username}:${config.token}`, "utf8").toString("base64");
90
+ return {
91
+ Authorization: `Basic ${encoded}`,
92
+ Accept: "application/json",
93
+ };
94
+ }
95
+ return config.token
96
+ ? { Authorization: `Bearer ${config.token}`, Accept: "application/json" }
97
+ : { Accept: "application/json" };
98
+ }
99
+ /**
100
+ * @description Reads the Jira credentials and defaults from the environment
101
+ * @summary Reads the `io.jira` slice and returns a partial config when an
102
+ * API token is configured, `undefined` otherwise. Values pass through
103
+ * `envString`/`envNumber` to reject unset-leaf proxies.
104
+ * @returns {Partial<JiraServiceConfig> | undefined} A partial config, or `undefined` when no Jira token is configured.
105
+ */
106
+ configFromEnvironment() {
107
+ const env = IoEnvironment.io.jira;
108
+ const token = envString(env?.token);
109
+ if (!token)
110
+ return undefined;
111
+ return {
112
+ token,
113
+ username: envString(env.username),
114
+ baseUrl: envString(env.baseUrl),
115
+ timeout: envNumber(env.timeout),
116
+ };
117
+ }
118
+ /**
119
+ * @description Asserts that the Jira token and site base URL are configured
120
+ * @summary Called by every operation before it touches the network.
121
+ * @returns {void}
122
+ * @throws {InternalError} When no API token or base URL is configured.
123
+ */
124
+ requireCredentials() {
125
+ if (!this.config.token) {
126
+ throw new InternalError("Jira requires an API token");
127
+ }
128
+ if (!this.config.baseUrl) {
129
+ throw new InternalError("Jira requires a base URL");
130
+ }
131
+ }
132
+ /**
133
+ * @description Builds the encoded issue path
134
+ * @summary Validates the issue key and URL-encodes it into
135
+ * `/rest/api/2/issue/<key>`.
136
+ * @param {string} issueKey - The Jira issue key.
137
+ * @returns {string} The issue API path.
138
+ * @throws {InternalError} When `issueKey` is empty.
139
+ */
140
+ issuePath(issueKey) {
141
+ if (!issueKey) {
142
+ throw new InternalError("Jira requires an issue key");
143
+ }
144
+ return `/rest/api/2/issue/${encodeURIComponent(issueKey)}`;
145
+ }
146
+ /**
147
+ * @description Creates a Jira issue
148
+ * @summary `POST`s the project, summary, issue type (default `Task`),
149
+ * optional description, and extra fields to `/rest/api/2/issue`.
150
+ * @param {JiraIssueInput} input - The issue definition.
151
+ * @returns {Promise<unknown>} The created issue payload (including `id` and `key`).
152
+ * @throws {InternalError} When credentials are missing, or the project key or summary is empty.
153
+ * @throws {BadRequestError} When Jira rejects the issue.
154
+ */
155
+ async createIssue(input) {
156
+ this.requireCredentials();
157
+ if (!input.projectKey || !input.summary) {
158
+ throw new InternalError("Jira createIssue requires a project key and summary");
159
+ }
160
+ try {
161
+ const response = await this.client.post("/rest/api/2/issue", {
162
+ fields: {
163
+ project: { key: input.projectKey },
164
+ summary: input.summary,
165
+ issuetype: { name: input.issueType ?? DEFAULT_ISSUE_TYPE },
166
+ ...(input.description ? { description: input.description } : {}),
167
+ ...(input.fields ?? {}),
168
+ },
169
+ });
170
+ return response.data;
171
+ }
172
+ catch (error) {
173
+ throw httpError("Jira", "create issue", error);
174
+ }
175
+ }
176
+ /**
177
+ * @description Fetches a Jira issue
178
+ * @summary `GET`s the issue by key, optionally projecting the given field
179
+ * names.
180
+ * @param {string} issueKey - The issue key to fetch.
181
+ * @param {string[]} [fields] - Field names to include in the response.
182
+ * @returns {Promise<unknown>} The issue payload.
183
+ * @throws {InternalError} When credentials are missing or the issue key is empty.
184
+ * @throws {NotFoundError} When the issue does not exist (HTTP 404).
185
+ * @throws {BadRequestError} When Jira rejects the request.
186
+ */
187
+ async getIssue(issueKey, fields) {
188
+ this.requireCredentials();
189
+ try {
190
+ const response = await this.client.get(this.issuePath(issueKey), {
191
+ params: fields?.length ? { fields: fields.join(",") } : {},
192
+ });
193
+ return response.data;
194
+ }
195
+ catch (error) {
196
+ throw httpError("Jira", "get issue", error);
197
+ }
198
+ }
199
+ /**
200
+ * @description Updates fields on a Jira issue
201
+ * @summary `PUT`s the `fields` map to the issue and returns
202
+ * `{ updated: true, issueKey }`.
203
+ * @param {JiraIssueUpdate} input - The issue key and fields to update.
204
+ * @returns {Promise<unknown>} `{ updated: true, issueKey }` on success.
205
+ * @throws {InternalError} When credentials are missing, or the issue key or fields are empty.
206
+ * @throws {NotFoundError} When the issue does not exist (HTTP 404).
207
+ * @throws {BadRequestError} When Jira rejects the update.
208
+ */
209
+ async updateIssue(input) {
210
+ this.requireCredentials();
211
+ if (!input.fields) {
212
+ throw new InternalError("Jira updateIssue requires fields");
213
+ }
214
+ try {
215
+ await this.client.put(this.issuePath(input.issueKey), {
216
+ fields: input.fields,
217
+ });
218
+ return { updated: true, issueKey: input.issueKey };
219
+ }
220
+ catch (error) {
221
+ throw httpError("Jira", "update issue", error);
222
+ }
223
+ }
224
+ /**
225
+ * @description Deletes a Jira issue
226
+ * @summary `DELETE`s the issue and returns `{ deleted: true, issueKey }`.
227
+ * @param {string} issueKey - The issue key to delete.
228
+ * @returns {Promise<unknown>} `{ deleted: true, issueKey }` on success.
229
+ * @throws {InternalError} When credentials are missing or the issue key is empty.
230
+ * @throws {NotFoundError} When the issue does not exist (HTTP 404).
231
+ * @throws {BadRequestError} When Jira rejects the deletion.
232
+ */
233
+ async deleteIssue(issueKey) {
234
+ this.requireCredentials();
235
+ try {
236
+ await this.client.delete(this.issuePath(issueKey));
237
+ return { deleted: true, issueKey };
238
+ }
239
+ catch (error) {
240
+ throw httpError("Jira", "delete issue", error);
241
+ }
242
+ }
243
+ /**
244
+ * @description Adds a comment to a Jira issue
245
+ * @summary `POST`s the comment body to the issue's `/comment` endpoint.
246
+ * @param {JiraCommentInput} input - The issue key and comment body.
247
+ * @returns {Promise<unknown>} The created comment payload.
248
+ * @throws {InternalError} When credentials are missing, or the issue key or body is empty.
249
+ * @throws {NotFoundError} When the issue does not exist (HTTP 404).
250
+ * @throws {BadRequestError} When Jira rejects the comment.
251
+ */
252
+ async addComment(input) {
253
+ this.requireCredentials();
254
+ if (!input.body) {
255
+ throw new InternalError("Jira addComment requires a body");
256
+ }
257
+ try {
258
+ const response = await this.client.post(`${this.issuePath(input.issueKey)}/comment`, { body: input.body });
259
+ return response.data;
260
+ }
261
+ catch (error) {
262
+ throw httpError("Jira", "add comment", error);
263
+ }
264
+ }
265
+ /**
266
+ * @description Lists the available workflow transitions for a Jira issue
267
+ * @summary `GET`s the issue's `/transitions` collection, whose IDs feed
268
+ * {@link JiraService.transitionIssue}.
269
+ * @param {string} issueKey - The issue key.
270
+ * @returns {Promise<unknown>} The available transitions payload.
271
+ * @throws {InternalError} When credentials are missing or the issue key is empty.
272
+ * @throws {NotFoundError} When the issue does not exist (HTTP 404).
273
+ * @throws {BadRequestError} When Jira rejects the request.
274
+ */
275
+ async getTransitions(issueKey) {
276
+ this.requireCredentials();
277
+ try {
278
+ const response = await this.client.get(`${this.issuePath(issueKey)}/transitions`);
279
+ return response.data;
280
+ }
281
+ catch (error) {
282
+ throw httpError("Jira", "get transitions", error);
283
+ }
284
+ }
285
+ /**
286
+ * @description Transitions a Jira issue through its workflow
287
+ * @summary `POST`s the transition ID to the issue's `/transitions` endpoint
288
+ * and returns the applied transition identifiers.
289
+ * @param {JiraTransitionInput} input - The issue key and transition ID.
290
+ * @returns {Promise<unknown>} `{ transitioned: true, issueKey, transitionId }` on success.
291
+ * @throws {InternalError} When credentials are missing, or the issue key or transition ID is empty.
292
+ * @throws {NotFoundError} When the issue does not exist (HTTP 404).
293
+ * @throws {BadRequestError} When Jira rejects the transition.
294
+ */
295
+ async transitionIssue(input) {
296
+ this.requireCredentials();
297
+ if (!input.transitionId) {
298
+ throw new InternalError("Jira transitionIssue requires a transition id");
299
+ }
300
+ try {
301
+ await this.client.post(`${this.issuePath(input.issueKey)}/transitions`, {
302
+ transition: { id: input.transitionId },
303
+ });
304
+ return {
305
+ transitioned: true,
306
+ issueKey: input.issueKey,
307
+ transitionId: input.transitionId,
308
+ };
309
+ }
310
+ catch (error) {
311
+ throw httpError("Jira", "transition issue", error);
312
+ }
313
+ }
314
+ /**
315
+ * @description Searches Jira issues with JQL
316
+ * @summary `POST`s the JQL query to `/rest/api/2/search` with a result cap
317
+ * (default `50`) and optional field projection.
318
+ * @param {JiraSearchInput} input - The JQL query and search options.
319
+ * @returns {Promise<unknown>} The search result payload.
320
+ * @throws {InternalError} When credentials are missing or the JQL query is empty.
321
+ * @throws {BadRequestError} When the JQL query is invalid.
322
+ * @example
323
+ * ```ts
324
+ * const results = await jira.search({
325
+ * jql: 'project = "OPS" AND status = "Open"',
326
+ * maxResults: 100,
327
+ * fields: ["summary", "status"],
328
+ * });
329
+ * ```
330
+ */
331
+ async search(input) {
332
+ this.requireCredentials();
333
+ if (!input.jql) {
334
+ throw new InternalError("Jira search requires a JQL query");
335
+ }
336
+ try {
337
+ const response = await this.client.post("/rest/api/2/search", {
338
+ jql: input.jql,
339
+ maxResults: input.maxResults ?? 50,
340
+ ...(input.fields ? { fields: input.fields } : {}),
341
+ });
342
+ return response.data;
343
+ }
344
+ catch (error) {
345
+ throw httpError("Jira", "search issues", error);
346
+ }
347
+ }
348
+ }
349
+ //# sourceMappingURL=JiraService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JiraService.js","sourceRoot":"","sources":["../../../../src/io/jira/JiraService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,4BAAuB;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,2CAAsC;AACrE,OAAO,EACL,cAAc,EAEd,SAAS,GACV,qCAA0B;AA+H3B,gFAAgF;AAChF,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,OAAO,WAAY,SAAQ,cAAiC;IAAlE;;QACE;;WAEG;QACgB,gBAAW,GAAG,MAAM,CAAC;IAqS1C,CAAC;IAnSC;;;;;OAKG;IACO,cAAc;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;;;;OAOG;IACO,WAAW,CAAC,MAAyB;QAC7C,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACpC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CACzB,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE,EACpC,MAAM,CACP,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACrB,OAAO;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ot":"","sources":["../../../../src/io/jira/index.ts"],"names":[],"mappings":"AAAA,iCAA8B"}
@@ -0,0 +1,248 @@
1
+ /**
2
+ * @module integrations/io/microsoft-excel/service
3
+ * @summary Microsoft Excel workbook integration service (Microsoft Graph).
4
+ * @description Exposes Graph workbook operations (worksheets, ranges, tables,
5
+ * and table rows) as an undecorated client-based service built on
6
+ * {@link HttpApiService}. Configuration comes from an explicit
7
+ * `MicrosoftExcelServiceConfig` or the `io.microsoftExcel` environment slice;
8
+ * the access token is sent as `Authorization: Bearer <token>`. Workbooks are
9
+ * addressed by OneDrive/SharePoint `itemId`, optionally within a `driveId`.
10
+ * Credentials are referenced from configuration (and, from as-graph nodes, from
11
+ * the resolved `microsoft-excel` credential secret) and are never embedded in
12
+ * source. Failures are mapped to decaf errors via {@link httpError}.
13
+ */
14
+ import { InternalError } from "@decaf-ts/db-decorators";
15
+ import { IoEnvironment } from "./../environment.js";
16
+ import { envNumber, envString } from "./../../shared/environmentValue.js";
17
+ import { HttpApiService, httpError, } from "./../../shared/http/index.js";
18
+ /**
19
+ * @description Microsoft Excel (Graph) workbook integration service
20
+ * @summary An undecorated HTTP service for listing worksheets and tables,
21
+ * reading and writing ranges, and appending table rows. Every operation
22
+ * requires a Graph access token and a workbook `itemId`; missing credentials or
23
+ * identifiers raise `InternalError`, and transport failures are mapped to decaf
24
+ * errors via {@link httpError}.
25
+ * @class MicrosoftExcelService
26
+ * @extends HttpApiService
27
+ * @category IO
28
+ * @example
29
+ * ```ts
30
+ * import { MicrosoftExcelService } from "@decaf-ts/integrations/io/microsoft-excel";
31
+ *
32
+ * const excel = new MicrosoftExcelService();
33
+ * await excel.initialize({
34
+ * token: process.env.GRAPH_CREDENTIAL_MICROSOFT_EXCEL_TOKEN,
35
+ * });
36
+ * const range = await excel.getRange({
37
+ * itemId: process.env.EXCEL_ITEM_ID ?? "",
38
+ * worksheet: "Sheet1",
39
+ * range: "A1:C10",
40
+ * });
41
+ * ```
42
+ * @mermaid
43
+ * sequenceDiagram
44
+ * autonumber
45
+ * participant Caller
46
+ * participant Service as MicrosoftExcelService
47
+ * participant Graph as Microsoft Graph
48
+ * Caller->>Service: updateRange(input)
49
+ * activate Service
50
+ * Service->>Service: requireAccessToken()
51
+ * Service->>Graph: PATCH /me/drive/items/{id}/workbook/worksheets/{name}/range(...)
52
+ * activate Graph
53
+ * Graph-->>Service: updated range payload
54
+ * deactivate Graph
55
+ * Service-->>Caller: updated range payload
56
+ * deactivate Service
57
+ * @memberOf module:integrations/io/microsoft-excel/service
58
+ */
59
+ export class MicrosoftExcelService extends HttpApiService {
60
+ constructor() {
61
+ super(...arguments);
62
+ /**
63
+ * @description The provider name used in error messages
64
+ */
65
+ this.serviceName = "Microsoft Excel";
66
+ }
67
+ /**
68
+ * @description The Microsoft Graph base URL
69
+ * @summary Used when the resolved config carries no `baseUrl`.
70
+ * @returns {string} `"https://graph.microsoft.com/v1.0"`.
71
+ */
72
+ defaultBaseUrl() {
73
+ return "https://graph.microsoft.com/v1.0";
74
+ }
75
+ /**
76
+ * @description Builds the Microsoft Graph bearer authorization headers
77
+ * @summary Returns `Authorization: Bearer <token>` when configured, and no
78
+ * headers otherwise.
79
+ * @param {MicrosoftExcelServiceConfig} config - The resolved service configuration.
80
+ * @returns {Record<string, string>} The authorization headers (empty without a token).
81
+ */
82
+ authHeaders(config) {
83
+ return config.token ? { Authorization: `Bearer ${config.token}` } : {};
84
+ }
85
+ /**
86
+ * @description Reads the Excel credentials and defaults from the environment
87
+ * @summary Reads the `io.microsoftExcel` slice and returns a partial config
88
+ * when an access token is configured, `undefined` otherwise. Values pass
89
+ * through `envString`/`envNumber` to reject unset-leaf proxies.
90
+ * @returns {Partial<MicrosoftExcelServiceConfig> | undefined} A partial config, or `undefined` when no Excel token is configured.
91
+ */
92
+ configFromEnvironment() {
93
+ const env = IoEnvironment.io.microsoftExcel;
94
+ const token = envString(env?.token);
95
+ if (!token)
96
+ return undefined;
97
+ return {
98
+ token,
99
+ baseUrl: envString(env.baseUrl),
100
+ timeout: envNumber(env.timeout),
101
+ };
102
+ }
103
+ /**
104
+ * @description Asserts that a Microsoft Graph access token is configured
105
+ * @summary Delegates to the shared `requireToken()` guard used by every
106
+ * operation.
107
+ * @returns {void}
108
+ * @throws {InternalError} When the resolved config has no `token`.
109
+ */
110
+ requireAccessToken() {
111
+ this.requireToken();
112
+ }
113
+ /**
114
+ * @description Builds the Graph workbook path for a drive item
115
+ * @summary Uses `/drives/<driveId>/items/<itemId>/workbook` when a `driveId`
116
+ * is set, otherwise the signed-in user's `/me/drive/...` path.
117
+ * @param {ExcelWorkbookRef} input - The workbook reference.
118
+ * @returns {string} The workbook API path.
119
+ * @throws {InternalError} When `itemId` is empty.
120
+ */
121
+ workbookPath(input) {
122
+ if (!input.itemId) {
123
+ throw new InternalError("Microsoft Excel requires a workbook item id");
124
+ }
125
+ const item = encodeURIComponent(input.itemId);
126
+ return input.driveId
127
+ ? `/drives/${encodeURIComponent(input.driveId)}/items/${item}/workbook`
128
+ : `/me/drive/items/${item}/workbook`;
129
+ }
130
+ /**
131
+ * @description Builds the Graph worksheet range path
132
+ * @summary Appends the encoded worksheet and A1 `range(address=...)`
133
+ * segments to the workbook path.
134
+ * @param {ExcelRangeInput} input - The workbook, worksheet, and range.
135
+ * @returns {string} The worksheet range API path.
136
+ * @throws {InternalError} When the worksheet or range is empty.
137
+ */
138
+ rangePath(input) {
139
+ if (!input.worksheet || !input.range) {
140
+ throw new InternalError("Microsoft Excel requires a worksheet and range");
141
+ }
142
+ return `${this.workbookPath(input)}/worksheets/${encodeURIComponent(input.worksheet)}/range(address='${encodeURIComponent(input.range)}')`;
143
+ }
144
+ /**
145
+ * @description Lists the worksheets in a workbook
146
+ * @summary `GET`s the workbook's `/worksheets` collection.
147
+ * @param {ExcelWorkbookRef} input - The workbook reference.
148
+ * @returns {Promise<unknown>} The Graph worksheet collection.
149
+ * @throws {InternalError} When no token is configured or `itemId` is empty.
150
+ * @throws {NotFoundError} When the workbook does not exist (HTTP 404).
151
+ * @throws {BadRequestError} When Graph rejects the request.
152
+ */
153
+ async listWorksheets(input) {
154
+ this.requireAccessToken();
155
+ try {
156
+ const response = await this.client.get(`${this.workbookPath(input)}/worksheets`);
157
+ return response.data;
158
+ }
159
+ catch (error) {
160
+ throw httpError("Microsoft Excel", "list worksheets", error);
161
+ }
162
+ }
163
+ /**
164
+ * @description Reads values from a worksheet range
165
+ * @summary `GET`s the addressed range and returns its values and formatting
166
+ * payload.
167
+ * @param {ExcelRangeInput} input - The workbook, worksheet, and range.
168
+ * @returns {Promise<unknown>} The range payload.
169
+ * @throws {InternalError} When no token is configured, or the workbook, worksheet, or range is empty.
170
+ * @throws {NotFoundError} When the workbook or range does not exist (HTTP 404).
171
+ * @throws {BadRequestError} When Graph rejects the request.
172
+ */
173
+ async getRange(input) {
174
+ this.requireAccessToken();
175
+ try {
176
+ const response = await this.client.get(this.rangePath(input));
177
+ return response.data;
178
+ }
179
+ catch (error) {
180
+ throw httpError("Microsoft Excel", "get range", error);
181
+ }
182
+ }
183
+ /**
184
+ * @description Writes values into a worksheet range
185
+ * @summary `PATCH`es the addressed range with the supplied `values` matrix
186
+ * and returns the updated range payload.
187
+ * @param {ExcelRangeWriteInput} input - The range reference and values to write.
188
+ * @returns {Promise<unknown>} The updated range payload.
189
+ * @throws {InternalError} When no token is configured, or the workbook, worksheet, or range is empty.
190
+ * @throws {NotFoundError} When the workbook or range does not exist (HTTP 404).
191
+ * @throws {BadRequestError} When Graph rejects the request.
192
+ */
193
+ async updateRange(input) {
194
+ this.requireAccessToken();
195
+ try {
196
+ const response = await this.client.patch(this.rangePath(input), {
197
+ values: input.values,
198
+ });
199
+ return response.data;
200
+ }
201
+ catch (error) {
202
+ throw httpError("Microsoft Excel", "update range", error);
203
+ }
204
+ }
205
+ /**
206
+ * @description Lists the tables in a workbook
207
+ * @summary `GET`s the workbook's `/tables` collection.
208
+ * @param {ExcelWorkbookRef} input - The workbook reference.
209
+ * @returns {Promise<unknown>} The Graph table collection.
210
+ * @throws {InternalError} When no token is configured or `itemId` is empty.
211
+ * @throws {NotFoundError} When the workbook does not exist (HTTP 404).
212
+ * @throws {BadRequestError} When Graph rejects the request.
213
+ */
214
+ async listTables(input) {
215
+ this.requireAccessToken();
216
+ try {
217
+ const response = await this.client.get(`${this.workbookPath(input)}/tables`);
218
+ return response.data;
219
+ }
220
+ catch (error) {
221
+ throw httpError("Microsoft Excel", "list tables", error);
222
+ }
223
+ }
224
+ /**
225
+ * @description Appends a row to an Excel table
226
+ * @summary `POST`s the single row to the table's `/rows/add` endpoint and
227
+ * returns the Graph row payload.
228
+ * @param {ExcelTableRowInput} input - The workbook, table, and row values.
229
+ * @returns {Promise<unknown>} The created table row payload.
230
+ * @throws {InternalError} When no token is configured, or the workbook, table, or values are missing.
231
+ * @throws {NotFoundError} When the workbook or table does not exist (HTTP 404).
232
+ * @throws {BadRequestError} When Graph rejects the request.
233
+ */
234
+ async addTableRow(input) {
235
+ this.requireAccessToken();
236
+ if (!input.tableId || !input.values?.length) {
237
+ throw new InternalError("Microsoft Excel addTableRow requires a table id and values");
238
+ }
239
+ try {
240
+ const response = await this.client.post(`${this.workbookPath(input)}/tables/${encodeURIComponent(input.tableId)}/rows/add`, { values: [input.values] });
241
+ return response.data;
242
+ }
243
+ catch (error) {
244
+ throw httpError("Microsoft Excel", "add table row", error);
245
+ }
246
+ }
247
+ }
248
+ //# sourceMappingURL=MicrosoftExcelService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MicrosoftExcelService.js","sourceRoot":"","sources":["../../../../src/io/microsoft-excel/MicrosoftExcelService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,4BAAuB;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,2CAAsC;AACrE,OAAO,EACL,cAAc,EAEd,SAAS,GACV,qCAA0B;AAwF3B;;;;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,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAC3B,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,SAAS,CAAC,iBAAiB,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from "./MicrosoftExcelService.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/io/microsoft-excel/index.ts"],"names":[],"mappings":"AAAA,2CAAwC"}