@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.
- 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/cjs/sftp/aws/index.cjs +24 -0
- package/lib/cjs/sftp/aws/index.cjs.map +1 -0
- package/lib/cjs/sftp/ssh2/index.cjs +24 -0
- package/lib/cjs/sftp/ssh2/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/esm/sftp/aws/index.js +7 -0
- package/lib/esm/sftp/aws/index.js.map +1 -0
- package/lib/esm/sftp/ssh2/index.js +7 -0
- package/lib/esm/sftp/ssh2/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/lib/types/sftp/aws/index.d.cts +6 -0
- package/lib/types/sftp/aws/index.d.mts +6 -0
- package/lib/types/sftp/ssh2/index.d.cts +6 -0
- package/lib/types/sftp/ssh2/index.d.mts +6 -0
- package/package.json +263 -59
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { HttpApiService, type HttpApiServiceConfig } from "../../shared/http/index.d.cts";
|
|
2
|
+
/**
|
|
3
|
+
* @description Configuration for the Microsoft Excel service
|
|
4
|
+
* @summary Extends {@link HttpApiServiceConfig} with the Microsoft Graph
|
|
5
|
+
* access token sent as a bearer token. When omitted, the
|
|
6
|
+
* `io.microsoftExcel` environment slice supplies the token (plus optional
|
|
7
|
+
* `baseUrl`/`timeout`).
|
|
8
|
+
* @category IO
|
|
9
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
10
|
+
*/
|
|
11
|
+
export interface MicrosoftExcelServiceConfig extends HttpApiServiceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* @description Microsoft Graph access token
|
|
14
|
+
* @summary Sent as `Authorization: Bearer <token>` with every API call.
|
|
15
|
+
*/
|
|
16
|
+
token?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Reference to an Excel workbook
|
|
20
|
+
* @summary Identifies a workbook by its drive item `itemId` and, optionally,
|
|
21
|
+
* the `driveId` that owns it. Without `driveId` the signed-in user's drive is
|
|
22
|
+
* used.
|
|
23
|
+
* @category IO
|
|
24
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
25
|
+
*/
|
|
26
|
+
export interface ExcelWorkbookRef {
|
|
27
|
+
/**
|
|
28
|
+
* @description Drive item ID of the workbook
|
|
29
|
+
*/
|
|
30
|
+
itemId: string;
|
|
31
|
+
/**
|
|
32
|
+
* @description Drive ID owning the workbook (defaults to the user's drive)
|
|
33
|
+
*/
|
|
34
|
+
driveId?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @description Reference to a worksheet range
|
|
38
|
+
* @summary Carries the workbook reference plus the `worksheet` name and the
|
|
39
|
+
* A1-style `range` address (e.g. `"A1:C10"`).
|
|
40
|
+
* @category IO
|
|
41
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
42
|
+
*/
|
|
43
|
+
export interface ExcelRangeInput extends ExcelWorkbookRef {
|
|
44
|
+
/**
|
|
45
|
+
* @description Worksheet name
|
|
46
|
+
*/
|
|
47
|
+
worksheet: string;
|
|
48
|
+
/**
|
|
49
|
+
* @description A1-style range address
|
|
50
|
+
*/
|
|
51
|
+
range: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @description Input for writing values to a worksheet range
|
|
55
|
+
* @summary Carries the range reference plus the two-dimensional `values`
|
|
56
|
+
* matrix written to it.
|
|
57
|
+
* @category IO
|
|
58
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
59
|
+
*/
|
|
60
|
+
export interface ExcelRangeWriteInput extends ExcelRangeInput {
|
|
61
|
+
/**
|
|
62
|
+
* @description Row-major matrix of values to write
|
|
63
|
+
*/
|
|
64
|
+
values: unknown[][];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @description Input for appending a row to an Excel table
|
|
68
|
+
* @summary Carries the workbook reference, the `tableId`, and the row
|
|
69
|
+
* `values` in table-column order.
|
|
70
|
+
* @category IO
|
|
71
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
72
|
+
*/
|
|
73
|
+
export interface ExcelTableRowInput extends ExcelWorkbookRef {
|
|
74
|
+
/**
|
|
75
|
+
* @description Table ID within the workbook
|
|
76
|
+
*/
|
|
77
|
+
tableId: string;
|
|
78
|
+
/**
|
|
79
|
+
* @description Row values in table-column order
|
|
80
|
+
*/
|
|
81
|
+
values: unknown[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description Microsoft Excel (Graph) workbook integration service
|
|
85
|
+
* @summary An undecorated HTTP service for listing worksheets and tables,
|
|
86
|
+
* reading and writing ranges, and appending table rows. Every operation
|
|
87
|
+
* requires a Graph access token and a workbook `itemId`; missing credentials or
|
|
88
|
+
* identifiers raise `InternalError`, and transport failures are mapped to decaf
|
|
89
|
+
* errors via {@link httpError}.
|
|
90
|
+
* @class MicrosoftExcelService
|
|
91
|
+
* @extends HttpApiService
|
|
92
|
+
* @category IO
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { MicrosoftExcelService } from "@decaf-ts/integrations/io/microsoft-excel";
|
|
96
|
+
*
|
|
97
|
+
* const excel = new MicrosoftExcelService();
|
|
98
|
+
* await excel.initialize({
|
|
99
|
+
* token: process.env.GRAPH_CREDENTIAL_MICROSOFT_EXCEL_TOKEN,
|
|
100
|
+
* });
|
|
101
|
+
* const range = await excel.getRange({
|
|
102
|
+
* itemId: process.env.EXCEL_ITEM_ID ?? "",
|
|
103
|
+
* worksheet: "Sheet1",
|
|
104
|
+
* range: "A1:C10",
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
* @mermaid
|
|
108
|
+
* sequenceDiagram
|
|
109
|
+
* autonumber
|
|
110
|
+
* participant Caller
|
|
111
|
+
* participant Service as MicrosoftExcelService
|
|
112
|
+
* participant Graph as Microsoft Graph
|
|
113
|
+
* Caller->>Service: updateRange(input)
|
|
114
|
+
* activate Service
|
|
115
|
+
* Service->>Service: requireAccessToken()
|
|
116
|
+
* Service->>Graph: PATCH /me/drive/items/{id}/workbook/worksheets/{name}/range(...)
|
|
117
|
+
* activate Graph
|
|
118
|
+
* Graph-->>Service: updated range payload
|
|
119
|
+
* deactivate Graph
|
|
120
|
+
* Service-->>Caller: updated range payload
|
|
121
|
+
* deactivate Service
|
|
122
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
123
|
+
*/
|
|
124
|
+
export declare class MicrosoftExcelService extends HttpApiService<MicrosoftExcelServiceConfig> {
|
|
125
|
+
/**
|
|
126
|
+
* @description The provider name used in error messages
|
|
127
|
+
*/
|
|
128
|
+
protected readonly serviceName = "Microsoft Excel";
|
|
129
|
+
/**
|
|
130
|
+
* @description The Microsoft Graph base URL
|
|
131
|
+
* @summary Used when the resolved config carries no `baseUrl`.
|
|
132
|
+
* @returns {string} `"https://graph.microsoft.com/v1.0"`.
|
|
133
|
+
*/
|
|
134
|
+
protected defaultBaseUrl(): string;
|
|
135
|
+
/**
|
|
136
|
+
* @description Builds the Microsoft Graph bearer authorization headers
|
|
137
|
+
* @summary Returns `Authorization: Bearer <token>` when configured, and no
|
|
138
|
+
* headers otherwise.
|
|
139
|
+
* @param {MicrosoftExcelServiceConfig} config - The resolved service configuration.
|
|
140
|
+
* @returns {Record<string, string>} The authorization headers (empty without a token).
|
|
141
|
+
*/
|
|
142
|
+
protected authHeaders(config: MicrosoftExcelServiceConfig): Record<string, string>;
|
|
143
|
+
/**
|
|
144
|
+
* @description Reads the Excel credentials and defaults from the environment
|
|
145
|
+
* @summary Reads the `io.microsoftExcel` slice and returns a partial config
|
|
146
|
+
* when an access token is configured, `undefined` otherwise. Values pass
|
|
147
|
+
* through `envString`/`envNumber` to reject unset-leaf proxies.
|
|
148
|
+
* @returns {Partial<MicrosoftExcelServiceConfig> | undefined} A partial config, or `undefined` when no Excel token is configured.
|
|
149
|
+
*/
|
|
150
|
+
protected configFromEnvironment(): Partial<MicrosoftExcelServiceConfig> | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* @description Asserts that a Microsoft Graph access token is configured
|
|
153
|
+
* @summary Delegates to the shared `requireToken()` guard used by every
|
|
154
|
+
* operation.
|
|
155
|
+
* @returns {void}
|
|
156
|
+
* @throws {InternalError} When the resolved config has no `token`.
|
|
157
|
+
*/
|
|
158
|
+
protected requireAccessToken(): void;
|
|
159
|
+
/**
|
|
160
|
+
* @description Builds the Graph workbook path for a drive item
|
|
161
|
+
* @summary Uses `/drives/<driveId>/items/<itemId>/workbook` when a `driveId`
|
|
162
|
+
* is set, otherwise the signed-in user's `/me/drive/...` path.
|
|
163
|
+
* @param {ExcelWorkbookRef} input - The workbook reference.
|
|
164
|
+
* @returns {string} The workbook API path.
|
|
165
|
+
* @throws {InternalError} When `itemId` is empty.
|
|
166
|
+
*/
|
|
167
|
+
private workbookPath;
|
|
168
|
+
/**
|
|
169
|
+
* @description Builds the Graph worksheet range path
|
|
170
|
+
* @summary Appends the encoded worksheet and A1 `range(address=...)`
|
|
171
|
+
* segments to the workbook path.
|
|
172
|
+
* @param {ExcelRangeInput} input - The workbook, worksheet, and range.
|
|
173
|
+
* @returns {string} The worksheet range API path.
|
|
174
|
+
* @throws {InternalError} When the worksheet or range is empty.
|
|
175
|
+
*/
|
|
176
|
+
private rangePath;
|
|
177
|
+
/**
|
|
178
|
+
* @description Lists the worksheets in a workbook
|
|
179
|
+
* @summary `GET`s the workbook's `/worksheets` collection.
|
|
180
|
+
* @param {ExcelWorkbookRef} input - The workbook reference.
|
|
181
|
+
* @returns {Promise<unknown>} The Graph worksheet collection.
|
|
182
|
+
* @throws {InternalError} When no token is configured or `itemId` is empty.
|
|
183
|
+
* @throws {NotFoundError} When the workbook does not exist (HTTP 404).
|
|
184
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
185
|
+
*/
|
|
186
|
+
listWorksheets(input: ExcelWorkbookRef): Promise<unknown>;
|
|
187
|
+
/**
|
|
188
|
+
* @description Reads values from a worksheet range
|
|
189
|
+
* @summary `GET`s the addressed range and returns its values and formatting
|
|
190
|
+
* payload.
|
|
191
|
+
* @param {ExcelRangeInput} input - The workbook, worksheet, and range.
|
|
192
|
+
* @returns {Promise<unknown>} The range payload.
|
|
193
|
+
* @throws {InternalError} When no token is configured, or the workbook, worksheet, or range is empty.
|
|
194
|
+
* @throws {NotFoundError} When the workbook or range does not exist (HTTP 404).
|
|
195
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
196
|
+
*/
|
|
197
|
+
getRange(input: ExcelRangeInput): Promise<unknown>;
|
|
198
|
+
/**
|
|
199
|
+
* @description Writes values into a worksheet range
|
|
200
|
+
* @summary `PATCH`es the addressed range with the supplied `values` matrix
|
|
201
|
+
* and returns the updated range payload.
|
|
202
|
+
* @param {ExcelRangeWriteInput} input - The range reference and values to write.
|
|
203
|
+
* @returns {Promise<unknown>} The updated range payload.
|
|
204
|
+
* @throws {InternalError} When no token is configured, or the workbook, worksheet, or range is empty.
|
|
205
|
+
* @throws {NotFoundError} When the workbook or range does not exist (HTTP 404).
|
|
206
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
207
|
+
*/
|
|
208
|
+
updateRange(input: ExcelRangeWriteInput): Promise<unknown>;
|
|
209
|
+
/**
|
|
210
|
+
* @description Lists the tables in a workbook
|
|
211
|
+
* @summary `GET`s the workbook's `/tables` collection.
|
|
212
|
+
* @param {ExcelWorkbookRef} input - The workbook reference.
|
|
213
|
+
* @returns {Promise<unknown>} The Graph table collection.
|
|
214
|
+
* @throws {InternalError} When no token is configured or `itemId` is empty.
|
|
215
|
+
* @throws {NotFoundError} When the workbook does not exist (HTTP 404).
|
|
216
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
217
|
+
*/
|
|
218
|
+
listTables(input: ExcelWorkbookRef): Promise<unknown>;
|
|
219
|
+
/**
|
|
220
|
+
* @description Appends a row to an Excel table
|
|
221
|
+
* @summary `POST`s the single row to the table's `/rows/add` endpoint and
|
|
222
|
+
* returns the Graph row payload.
|
|
223
|
+
* @param {ExcelTableRowInput} input - The workbook, table, and row values.
|
|
224
|
+
* @returns {Promise<unknown>} The created table row payload.
|
|
225
|
+
* @throws {InternalError} When no token is configured, or the workbook, table, or values are missing.
|
|
226
|
+
* @throws {NotFoundError} When the workbook or table does not exist (HTTP 404).
|
|
227
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
228
|
+
*/
|
|
229
|
+
addTableRow(input: ExcelTableRowInput): Promise<unknown>;
|
|
230
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { HttpApiService, type HttpApiServiceConfig } from "../../shared/http/index.d.mts";
|
|
2
|
+
/**
|
|
3
|
+
* @description Configuration for the Microsoft Excel service
|
|
4
|
+
* @summary Extends {@link HttpApiServiceConfig} with the Microsoft Graph
|
|
5
|
+
* access token sent as a bearer token. When omitted, the
|
|
6
|
+
* `io.microsoftExcel` environment slice supplies the token (plus optional
|
|
7
|
+
* `baseUrl`/`timeout`).
|
|
8
|
+
* @category IO
|
|
9
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
10
|
+
*/
|
|
11
|
+
export interface MicrosoftExcelServiceConfig extends HttpApiServiceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* @description Microsoft Graph access token
|
|
14
|
+
* @summary Sent as `Authorization: Bearer <token>` with every API call.
|
|
15
|
+
*/
|
|
16
|
+
token?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Reference to an Excel workbook
|
|
20
|
+
* @summary Identifies a workbook by its drive item `itemId` and, optionally,
|
|
21
|
+
* the `driveId` that owns it. Without `driveId` the signed-in user's drive is
|
|
22
|
+
* used.
|
|
23
|
+
* @category IO
|
|
24
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
25
|
+
*/
|
|
26
|
+
export interface ExcelWorkbookRef {
|
|
27
|
+
/**
|
|
28
|
+
* @description Drive item ID of the workbook
|
|
29
|
+
*/
|
|
30
|
+
itemId: string;
|
|
31
|
+
/**
|
|
32
|
+
* @description Drive ID owning the workbook (defaults to the user's drive)
|
|
33
|
+
*/
|
|
34
|
+
driveId?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @description Reference to a worksheet range
|
|
38
|
+
* @summary Carries the workbook reference plus the `worksheet` name and the
|
|
39
|
+
* A1-style `range` address (e.g. `"A1:C10"`).
|
|
40
|
+
* @category IO
|
|
41
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
42
|
+
*/
|
|
43
|
+
export interface ExcelRangeInput extends ExcelWorkbookRef {
|
|
44
|
+
/**
|
|
45
|
+
* @description Worksheet name
|
|
46
|
+
*/
|
|
47
|
+
worksheet: string;
|
|
48
|
+
/**
|
|
49
|
+
* @description A1-style range address
|
|
50
|
+
*/
|
|
51
|
+
range: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @description Input for writing values to a worksheet range
|
|
55
|
+
* @summary Carries the range reference plus the two-dimensional `values`
|
|
56
|
+
* matrix written to it.
|
|
57
|
+
* @category IO
|
|
58
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
59
|
+
*/
|
|
60
|
+
export interface ExcelRangeWriteInput extends ExcelRangeInput {
|
|
61
|
+
/**
|
|
62
|
+
* @description Row-major matrix of values to write
|
|
63
|
+
*/
|
|
64
|
+
values: unknown[][];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @description Input for appending a row to an Excel table
|
|
68
|
+
* @summary Carries the workbook reference, the `tableId`, and the row
|
|
69
|
+
* `values` in table-column order.
|
|
70
|
+
* @category IO
|
|
71
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
72
|
+
*/
|
|
73
|
+
export interface ExcelTableRowInput extends ExcelWorkbookRef {
|
|
74
|
+
/**
|
|
75
|
+
* @description Table ID within the workbook
|
|
76
|
+
*/
|
|
77
|
+
tableId: string;
|
|
78
|
+
/**
|
|
79
|
+
* @description Row values in table-column order
|
|
80
|
+
*/
|
|
81
|
+
values: unknown[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description Microsoft Excel (Graph) workbook integration service
|
|
85
|
+
* @summary An undecorated HTTP service for listing worksheets and tables,
|
|
86
|
+
* reading and writing ranges, and appending table rows. Every operation
|
|
87
|
+
* requires a Graph access token and a workbook `itemId`; missing credentials or
|
|
88
|
+
* identifiers raise `InternalError`, and transport failures are mapped to decaf
|
|
89
|
+
* errors via {@link httpError}.
|
|
90
|
+
* @class MicrosoftExcelService
|
|
91
|
+
* @extends HttpApiService
|
|
92
|
+
* @category IO
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { MicrosoftExcelService } from "@decaf-ts/integrations/io/microsoft-excel";
|
|
96
|
+
*
|
|
97
|
+
* const excel = new MicrosoftExcelService();
|
|
98
|
+
* await excel.initialize({
|
|
99
|
+
* token: process.env.GRAPH_CREDENTIAL_MICROSOFT_EXCEL_TOKEN,
|
|
100
|
+
* });
|
|
101
|
+
* const range = await excel.getRange({
|
|
102
|
+
* itemId: process.env.EXCEL_ITEM_ID ?? "",
|
|
103
|
+
* worksheet: "Sheet1",
|
|
104
|
+
* range: "A1:C10",
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
* @mermaid
|
|
108
|
+
* sequenceDiagram
|
|
109
|
+
* autonumber
|
|
110
|
+
* participant Caller
|
|
111
|
+
* participant Service as MicrosoftExcelService
|
|
112
|
+
* participant Graph as Microsoft Graph
|
|
113
|
+
* Caller->>Service: updateRange(input)
|
|
114
|
+
* activate Service
|
|
115
|
+
* Service->>Service: requireAccessToken()
|
|
116
|
+
* Service->>Graph: PATCH /me/drive/items/{id}/workbook/worksheets/{name}/range(...)
|
|
117
|
+
* activate Graph
|
|
118
|
+
* Graph-->>Service: updated range payload
|
|
119
|
+
* deactivate Graph
|
|
120
|
+
* Service-->>Caller: updated range payload
|
|
121
|
+
* deactivate Service
|
|
122
|
+
* @memberOf module:integrations/io/microsoft-excel/service
|
|
123
|
+
*/
|
|
124
|
+
export declare class MicrosoftExcelService extends HttpApiService<MicrosoftExcelServiceConfig> {
|
|
125
|
+
/**
|
|
126
|
+
* @description The provider name used in error messages
|
|
127
|
+
*/
|
|
128
|
+
protected readonly serviceName = "Microsoft Excel";
|
|
129
|
+
/**
|
|
130
|
+
* @description The Microsoft Graph base URL
|
|
131
|
+
* @summary Used when the resolved config carries no `baseUrl`.
|
|
132
|
+
* @returns {string} `"https://graph.microsoft.com/v1.0"`.
|
|
133
|
+
*/
|
|
134
|
+
protected defaultBaseUrl(): string;
|
|
135
|
+
/**
|
|
136
|
+
* @description Builds the Microsoft Graph bearer authorization headers
|
|
137
|
+
* @summary Returns `Authorization: Bearer <token>` when configured, and no
|
|
138
|
+
* headers otherwise.
|
|
139
|
+
* @param {MicrosoftExcelServiceConfig} config - The resolved service configuration.
|
|
140
|
+
* @returns {Record<string, string>} The authorization headers (empty without a token).
|
|
141
|
+
*/
|
|
142
|
+
protected authHeaders(config: MicrosoftExcelServiceConfig): Record<string, string>;
|
|
143
|
+
/**
|
|
144
|
+
* @description Reads the Excel credentials and defaults from the environment
|
|
145
|
+
* @summary Reads the `io.microsoftExcel` slice and returns a partial config
|
|
146
|
+
* when an access token is configured, `undefined` otherwise. Values pass
|
|
147
|
+
* through `envString`/`envNumber` to reject unset-leaf proxies.
|
|
148
|
+
* @returns {Partial<MicrosoftExcelServiceConfig> | undefined} A partial config, or `undefined` when no Excel token is configured.
|
|
149
|
+
*/
|
|
150
|
+
protected configFromEnvironment(): Partial<MicrosoftExcelServiceConfig> | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* @description Asserts that a Microsoft Graph access token is configured
|
|
153
|
+
* @summary Delegates to the shared `requireToken()` guard used by every
|
|
154
|
+
* operation.
|
|
155
|
+
* @returns {void}
|
|
156
|
+
* @throws {InternalError} When the resolved config has no `token`.
|
|
157
|
+
*/
|
|
158
|
+
protected requireAccessToken(): void;
|
|
159
|
+
/**
|
|
160
|
+
* @description Builds the Graph workbook path for a drive item
|
|
161
|
+
* @summary Uses `/drives/<driveId>/items/<itemId>/workbook` when a `driveId`
|
|
162
|
+
* is set, otherwise the signed-in user's `/me/drive/...` path.
|
|
163
|
+
* @param {ExcelWorkbookRef} input - The workbook reference.
|
|
164
|
+
* @returns {string} The workbook API path.
|
|
165
|
+
* @throws {InternalError} When `itemId` is empty.
|
|
166
|
+
*/
|
|
167
|
+
private workbookPath;
|
|
168
|
+
/**
|
|
169
|
+
* @description Builds the Graph worksheet range path
|
|
170
|
+
* @summary Appends the encoded worksheet and A1 `range(address=...)`
|
|
171
|
+
* segments to the workbook path.
|
|
172
|
+
* @param {ExcelRangeInput} input - The workbook, worksheet, and range.
|
|
173
|
+
* @returns {string} The worksheet range API path.
|
|
174
|
+
* @throws {InternalError} When the worksheet or range is empty.
|
|
175
|
+
*/
|
|
176
|
+
private rangePath;
|
|
177
|
+
/**
|
|
178
|
+
* @description Lists the worksheets in a workbook
|
|
179
|
+
* @summary `GET`s the workbook's `/worksheets` collection.
|
|
180
|
+
* @param {ExcelWorkbookRef} input - The workbook reference.
|
|
181
|
+
* @returns {Promise<unknown>} The Graph worksheet collection.
|
|
182
|
+
* @throws {InternalError} When no token is configured or `itemId` is empty.
|
|
183
|
+
* @throws {NotFoundError} When the workbook does not exist (HTTP 404).
|
|
184
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
185
|
+
*/
|
|
186
|
+
listWorksheets(input: ExcelWorkbookRef): Promise<unknown>;
|
|
187
|
+
/**
|
|
188
|
+
* @description Reads values from a worksheet range
|
|
189
|
+
* @summary `GET`s the addressed range and returns its values and formatting
|
|
190
|
+
* payload.
|
|
191
|
+
* @param {ExcelRangeInput} input - The workbook, worksheet, and range.
|
|
192
|
+
* @returns {Promise<unknown>} The range payload.
|
|
193
|
+
* @throws {InternalError} When no token is configured, or the workbook, worksheet, or range is empty.
|
|
194
|
+
* @throws {NotFoundError} When the workbook or range does not exist (HTTP 404).
|
|
195
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
196
|
+
*/
|
|
197
|
+
getRange(input: ExcelRangeInput): Promise<unknown>;
|
|
198
|
+
/**
|
|
199
|
+
* @description Writes values into a worksheet range
|
|
200
|
+
* @summary `PATCH`es the addressed range with the supplied `values` matrix
|
|
201
|
+
* and returns the updated range payload.
|
|
202
|
+
* @param {ExcelRangeWriteInput} input - The range reference and values to write.
|
|
203
|
+
* @returns {Promise<unknown>} The updated range payload.
|
|
204
|
+
* @throws {InternalError} When no token is configured, or the workbook, worksheet, or range is empty.
|
|
205
|
+
* @throws {NotFoundError} When the workbook or range does not exist (HTTP 404).
|
|
206
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
207
|
+
*/
|
|
208
|
+
updateRange(input: ExcelRangeWriteInput): Promise<unknown>;
|
|
209
|
+
/**
|
|
210
|
+
* @description Lists the tables in a workbook
|
|
211
|
+
* @summary `GET`s the workbook's `/tables` collection.
|
|
212
|
+
* @param {ExcelWorkbookRef} input - The workbook reference.
|
|
213
|
+
* @returns {Promise<unknown>} The Graph table collection.
|
|
214
|
+
* @throws {InternalError} When no token is configured or `itemId` is empty.
|
|
215
|
+
* @throws {NotFoundError} When the workbook does not exist (HTTP 404).
|
|
216
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
217
|
+
*/
|
|
218
|
+
listTables(input: ExcelWorkbookRef): Promise<unknown>;
|
|
219
|
+
/**
|
|
220
|
+
* @description Appends a row to an Excel table
|
|
221
|
+
* @summary `POST`s the single row to the table's `/rows/add` endpoint and
|
|
222
|
+
* returns the Graph row payload.
|
|
223
|
+
* @param {ExcelTableRowInput} input - The workbook, table, and row values.
|
|
224
|
+
* @returns {Promise<unknown>} The created table row payload.
|
|
225
|
+
* @throws {InternalError} When no token is configured, or the workbook, table, or values are missing.
|
|
226
|
+
* @throws {NotFoundError} When the workbook or table does not exist (HTTP 404).
|
|
227
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
228
|
+
*/
|
|
229
|
+
addTableRow(input: ExcelTableRowInput): Promise<unknown>;
|
|
230
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MicrosoftExcelService.d.cts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MicrosoftExcelService.d.mts";
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { HttpApiService, type HttpApiServiceConfig } from "../../shared/http/index.d.cts";
|
|
2
|
+
/**
|
|
3
|
+
* @description Configuration for the Microsoft SharePoint service
|
|
4
|
+
* @summary Extends {@link HttpApiServiceConfig} with the Microsoft Graph
|
|
5
|
+
* access token sent as a bearer token. When omitted, the
|
|
6
|
+
* `io.microsoftSharePoint` environment slice supplies the token (plus optional
|
|
7
|
+
* `baseUrl`/`timeout`).
|
|
8
|
+
* @category IO
|
|
9
|
+
* @memberOf module:integrations/io/microsoft-sharepoint/service
|
|
10
|
+
*/
|
|
11
|
+
export interface MicrosoftSharePointServiceConfig extends HttpApiServiceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* @description Microsoft Graph access token
|
|
14
|
+
* @summary Sent as `Authorization: Bearer <token>` with every API call.
|
|
15
|
+
*/
|
|
16
|
+
token?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Input for listing SharePoint list items
|
|
20
|
+
* @summary Carries the owning `siteId`, the `listId`, and optional `top` and
|
|
21
|
+
* `filter` query options.
|
|
22
|
+
* @category IO
|
|
23
|
+
* @memberOf module:integrations/io/microsoft-sharepoint/service
|
|
24
|
+
*/
|
|
25
|
+
export interface SharePointItemsInput {
|
|
26
|
+
/**
|
|
27
|
+
* @description SharePoint site ID
|
|
28
|
+
*/
|
|
29
|
+
siteId: string;
|
|
30
|
+
/**
|
|
31
|
+
* @description List ID within the site
|
|
32
|
+
*/
|
|
33
|
+
listId: string;
|
|
34
|
+
/**
|
|
35
|
+
* @description Maximum number of items to return (`$top`)
|
|
36
|
+
*/
|
|
37
|
+
top?: number;
|
|
38
|
+
/**
|
|
39
|
+
* @description OData filter expression (`$filter`)
|
|
40
|
+
*/
|
|
41
|
+
filter?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @description Input for creating a SharePoint list item
|
|
45
|
+
* @summary Carries the owning `siteId`, the `listId`, and the item `fields`
|
|
46
|
+
* map to write.
|
|
47
|
+
* @category IO
|
|
48
|
+
* @memberOf module:integrations/io/microsoft-sharepoint/service
|
|
49
|
+
*/
|
|
50
|
+
export interface SharePointListItemInput {
|
|
51
|
+
/**
|
|
52
|
+
* @description SharePoint site ID
|
|
53
|
+
*/
|
|
54
|
+
siteId: string;
|
|
55
|
+
/**
|
|
56
|
+
* @description List ID within the site
|
|
57
|
+
*/
|
|
58
|
+
listId: string;
|
|
59
|
+
/**
|
|
60
|
+
* @description Column values for the new item
|
|
61
|
+
*/
|
|
62
|
+
fields: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @description Input for listing a SharePoint drive folder's children
|
|
66
|
+
* @summary Carries the `siteId`, an optional folder `itemId` (default `root`),
|
|
67
|
+
* and an optional `top` cap.
|
|
68
|
+
* @category IO
|
|
69
|
+
* @memberOf module:integrations/io/microsoft-sharepoint/service
|
|
70
|
+
*/
|
|
71
|
+
export interface SharePointDriveItemsInput {
|
|
72
|
+
/**
|
|
73
|
+
* @description SharePoint site ID
|
|
74
|
+
*/
|
|
75
|
+
siteId: string;
|
|
76
|
+
/**
|
|
77
|
+
* @description Drive item (folder) ID; defaults to the drive root
|
|
78
|
+
*/
|
|
79
|
+
itemId?: string;
|
|
80
|
+
/**
|
|
81
|
+
* @description Maximum number of children to return (`$top`)
|
|
82
|
+
*/
|
|
83
|
+
top?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @description Microsoft SharePoint (Graph) integration service
|
|
87
|
+
* @summary An undecorated HTTP service for searching sites, reading a site's
|
|
88
|
+
* lists and list items, creating list items, and listing drive folder
|
|
89
|
+
* contents. Every operation requires a Graph access token; missing credentials
|
|
90
|
+
* or identifiers raise `InternalError`, and transport failures are mapped to
|
|
91
|
+
* decaf errors via {@link httpError}.
|
|
92
|
+
* @class MicrosoftSharePointService
|
|
93
|
+
* @extends HttpApiService
|
|
94
|
+
* @category IO
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { MicrosoftSharePointService } from "@decaf-ts/integrations/io/microsoft-sharepoint";
|
|
98
|
+
*
|
|
99
|
+
* const sharepoint = new MicrosoftSharePointService();
|
|
100
|
+
* await sharepoint.initialize({
|
|
101
|
+
* token: process.env.GRAPH_CREDENTIAL_MICROSOFT_SHAREPOINT_TOKEN,
|
|
102
|
+
* });
|
|
103
|
+
* const sites = await sharepoint.listSites("ops");
|
|
104
|
+
* ```
|
|
105
|
+
* @mermaid
|
|
106
|
+
* sequenceDiagram
|
|
107
|
+
* autonumber
|
|
108
|
+
* participant Caller
|
|
109
|
+
* participant Service as MicrosoftSharePointService
|
|
110
|
+
* participant Graph as Microsoft Graph
|
|
111
|
+
* Caller->>Service: listItems(input)
|
|
112
|
+
* activate Service
|
|
113
|
+
* Service->>Service: requireAccessToken()
|
|
114
|
+
* Service->>Graph: GET /sites/{siteId}/lists/{listId}/items
|
|
115
|
+
* activate Graph
|
|
116
|
+
* Graph-->>Service: list items payload
|
|
117
|
+
* deactivate Graph
|
|
118
|
+
* Service-->>Caller: list items payload
|
|
119
|
+
* deactivate Service
|
|
120
|
+
* @memberOf module:integrations/io/microsoft-sharepoint/service
|
|
121
|
+
*/
|
|
122
|
+
export declare class MicrosoftSharePointService extends HttpApiService<MicrosoftSharePointServiceConfig> {
|
|
123
|
+
/**
|
|
124
|
+
* @description The provider name used in error messages
|
|
125
|
+
*/
|
|
126
|
+
protected readonly serviceName = "Microsoft SharePoint";
|
|
127
|
+
/**
|
|
128
|
+
* @description The Microsoft Graph base URL
|
|
129
|
+
* @summary Used when the resolved config carries no `baseUrl`.
|
|
130
|
+
* @returns {string} `"https://graph.microsoft.com/v1.0"`.
|
|
131
|
+
*/
|
|
132
|
+
protected defaultBaseUrl(): string;
|
|
133
|
+
/**
|
|
134
|
+
* @description Builds the Microsoft Graph bearer authorization headers
|
|
135
|
+
* @summary Returns `Authorization: Bearer <token>` when configured, and no
|
|
136
|
+
* headers otherwise.
|
|
137
|
+
* @param {MicrosoftSharePointServiceConfig} config - The resolved service configuration.
|
|
138
|
+
* @returns {Record<string, string>} The authorization headers (empty without a token).
|
|
139
|
+
*/
|
|
140
|
+
protected authHeaders(config: MicrosoftSharePointServiceConfig): Record<string, string>;
|
|
141
|
+
/**
|
|
142
|
+
* @description Reads the SharePoint credentials and defaults from the environment
|
|
143
|
+
* @summary Reads the `io.microsoftSharePoint` slice and returns a partial
|
|
144
|
+
* config when an access token is configured, `undefined` otherwise. Values
|
|
145
|
+
* pass through `envString`/`envNumber` to reject unset-leaf proxies.
|
|
146
|
+
* @returns {Partial<MicrosoftSharePointServiceConfig> | undefined} A partial config, or `undefined` when no SharePoint token is configured.
|
|
147
|
+
*/
|
|
148
|
+
protected configFromEnvironment(): Partial<MicrosoftSharePointServiceConfig> | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* @description Asserts that a Microsoft Graph access token is configured
|
|
151
|
+
* @summary Delegates to the shared `requireToken()` guard used by every
|
|
152
|
+
* operation.
|
|
153
|
+
* @returns {void}
|
|
154
|
+
* @throws {InternalError} When the resolved config has no `token`.
|
|
155
|
+
*/
|
|
156
|
+
protected requireAccessToken(): void;
|
|
157
|
+
/**
|
|
158
|
+
* @description Builds the encoded path for a SharePoint site
|
|
159
|
+
* @summary Validates the site ID and URL-encodes it into `/sites/<id>`.
|
|
160
|
+
* @param {string} siteId - The SharePoint site ID.
|
|
161
|
+
* @returns {string} The site API path.
|
|
162
|
+
* @throws {InternalError} When `siteId` is empty.
|
|
163
|
+
*/
|
|
164
|
+
private sitePath;
|
|
165
|
+
/**
|
|
166
|
+
* @description Searches SharePoint sites
|
|
167
|
+
* @summary `GET`s `/sites` with a `search` term (default `"*"`).
|
|
168
|
+
* @param {string} [search] - Site search term; defaults to `"*"`.
|
|
169
|
+
* @returns {Promise<unknown>} The site collection payload.
|
|
170
|
+
* @throws {InternalError} When no token is configured.
|
|
171
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
172
|
+
*/
|
|
173
|
+
listSites(search?: string): Promise<unknown>;
|
|
174
|
+
/**
|
|
175
|
+
* @description Fetches a SharePoint site
|
|
176
|
+
* @summary `GET`s `/sites/<id>` and returns the site payload.
|
|
177
|
+
* @param {string} siteId - The site ID to fetch.
|
|
178
|
+
* @returns {Promise<unknown>} The site payload.
|
|
179
|
+
* @throws {InternalError} When no token is configured or the site ID is empty.
|
|
180
|
+
* @throws {NotFoundError} When the site does not exist (HTTP 404).
|
|
181
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
182
|
+
*/
|
|
183
|
+
getSite(siteId: string): Promise<unknown>;
|
|
184
|
+
/**
|
|
185
|
+
* @description Lists the lists in a SharePoint site
|
|
186
|
+
* @summary `GET`s `/sites/<id>/lists`.
|
|
187
|
+
* @param {string} siteId - The site whose lists are listed.
|
|
188
|
+
* @returns {Promise<unknown>} The list collection payload.
|
|
189
|
+
* @throws {InternalError} When no token is configured or the site ID is empty.
|
|
190
|
+
* @throws {NotFoundError} When the site does not exist (HTTP 404).
|
|
191
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
192
|
+
*/
|
|
193
|
+
listLists(siteId: string): Promise<unknown>;
|
|
194
|
+
/**
|
|
195
|
+
* @description Lists items in a SharePoint list
|
|
196
|
+
* @summary `GET`s the list's `/items` endpoint expanding `fields` and
|
|
197
|
+
* applying the optional `$top` and `$filter` options.
|
|
198
|
+
* @param {SharePointItemsInput} input - The site, list, and query options.
|
|
199
|
+
* @returns {Promise<unknown>} The list item collection payload.
|
|
200
|
+
* @throws {InternalError} When no token is configured, or the site or list ID is empty.
|
|
201
|
+
* @throws {NotFoundError} When the site or list does not exist (HTTP 404).
|
|
202
|
+
* @throws {BadRequestError} When Graph rejects the query.
|
|
203
|
+
*/
|
|
204
|
+
listItems(input: SharePointItemsInput): Promise<unknown>;
|
|
205
|
+
/**
|
|
206
|
+
* @description Creates a SharePoint list item
|
|
207
|
+
* @summary `POST`s the `fields` map to the list's `/items` endpoint.
|
|
208
|
+
* @param {SharePointListItemInput} input - The site, list, and item fields.
|
|
209
|
+
* @returns {Promise<unknown>} The created item payload.
|
|
210
|
+
* @throws {InternalError} When no token is configured, or the site, list, or fields are missing.
|
|
211
|
+
* @throws {NotFoundError} When the site or list does not exist (HTTP 404).
|
|
212
|
+
* @throws {BadRequestError} When Graph rejects the item.
|
|
213
|
+
*/
|
|
214
|
+
createListItem(input: SharePointListItemInput): Promise<unknown>;
|
|
215
|
+
/**
|
|
216
|
+
* @description Lists the children of a SharePoint drive folder
|
|
217
|
+
* @summary `GET`s `/sites/<id>/drive/items/<item or root>/children` with an
|
|
218
|
+
* optional `$top` cap.
|
|
219
|
+
* @param {SharePointDriveItemsInput} input - The site, folder, and result cap.
|
|
220
|
+
* @returns {Promise<unknown>} The drive item collection payload.
|
|
221
|
+
* @throws {InternalError} When no token is configured or the site ID is empty.
|
|
222
|
+
* @throws {NotFoundError} When the site or folder does not exist (HTTP 404).
|
|
223
|
+
* @throws {BadRequestError} When Graph rejects the request.
|
|
224
|
+
*/
|
|
225
|
+
listDriveItems(input: SharePointDriveItemsInput): Promise<unknown>;
|
|
226
|
+
}
|