@credal/actions 0.2.224 → 0.2.226

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.
@@ -11484,15 +11484,19 @@ export const microsoftCreateDocumentDefinition = {
11484
11484
  properties: {
11485
11485
  siteId: {
11486
11486
  type: "string",
11487
- description: "The ID of the site where the document will be created",
11487
+ description: "The ID of the site where the document will be created (targets the site's default document library; ignored if driveId is provided)",
11488
+ },
11489
+ driveId: {
11490
+ type: "string",
11491
+ description: "The ID of the drive (document library) to create the document in. Required to target a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action",
11488
11492
  },
11489
11493
  name: {
11490
11494
  type: "string",
11491
- description: "The name of the new document (include extension like .docx or .xlsx)",
11495
+ description: "The name of the new document, including the extension. Use .docx for a Word document (the content is converted into a real Word file) or a plain-text extension like .txt or .md. Other Office extensions (.doc, .xlsx, .xls, .pptx, .ppt) are not supported and will be rejected",
11492
11496
  },
11493
11497
  content: {
11494
11498
  type: "string",
11495
- description: "The content to add to the new document",
11499
+ description: "The plain-text content of the document. When the name ends in .docx it is converted into a Word document with one paragraph per line; otherwise it is written as-is",
11496
11500
  },
11497
11501
  folderId: {
11498
11502
  type: "string",
@@ -11540,7 +11544,11 @@ export const microsoftUpdateDocumentDefinition = {
11540
11544
  properties: {
11541
11545
  siteId: {
11542
11546
  type: "string",
11543
- description: "The ID of the site where the document is located",
11547
+ description: "The ID of the site where the document is located (targets the site's default document library; ignored if driveId is provided)",
11548
+ },
11549
+ driveId: {
11550
+ type: "string",
11551
+ description: "The ID of the drive (document library) containing the document. Required when the document is in a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action",
11544
11552
  },
11545
11553
  documentId: {
11546
11554
  type: "string",
@@ -11548,7 +11556,7 @@ export const microsoftUpdateDocumentDefinition = {
11548
11556
  },
11549
11557
  content: {
11550
11558
  type: "string",
11551
- description: "The new content to update in the document",
11559
+ description: "The new plain-text content for the document (replaces the existing content entirely). If the target file is a .docx it is converted into a Word document with one paragraph per line; other Office formats (.doc, .xlsx, .xls, .pptx, .ppt) cannot be updated",
11552
11560
  },
11553
11561
  },
11554
11562
  },
@@ -11602,7 +11610,11 @@ export const microsoftUpdateSpreadsheetDefinition = {
11602
11610
  },
11603
11611
  siteId: {
11604
11612
  type: "string",
11605
- description: "The ID of the site where the spreadsheet is located",
11613
+ description: "The ID of the site where the spreadsheet is located (targets the site's default document library; ignored if driveId is provided)",
11614
+ },
11615
+ driveId: {
11616
+ type: "string",
11617
+ description: "The ID of the drive (document library) containing the spreadsheet. Required when the spreadsheet is in a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action",
11606
11618
  },
11607
11619
  },
11608
11620
  },
@@ -11722,7 +11734,11 @@ export const microsoftGetDocumentDefinition = {
11722
11734
  properties: {
11723
11735
  siteId: {
11724
11736
  type: "string",
11725
- description: "The ID of the site where the document is located (optional for OneDrive)",
11737
+ description: "The ID of the site where the document is located (optional for OneDrive; targets the site's default document library; ignored if driveId is provided)",
11738
+ },
11739
+ driveId: {
11740
+ type: "string",
11741
+ description: "The ID of the drive (document library) containing the document. Required when the document is in a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action",
11726
11742
  },
11727
11743
  documentId: {
11728
11744
  type: "string",
@@ -8228,6 +8228,7 @@ export type salesforceGetReportMetadataOutputType = z.infer<typeof salesforceGet
8228
8228
  export type salesforceGetReportMetadataFunction = ActionFunction<salesforceGetReportMetadataParamsType, AuthParamsType, salesforceGetReportMetadataOutputType>;
8229
8229
  export declare const microsoftCreateDocumentParamsSchema: z.ZodObject<{
8230
8230
  siteId: z.ZodOptional<z.ZodString>;
8231
+ driveId: z.ZodOptional<z.ZodString>;
8231
8232
  name: z.ZodString;
8232
8233
  content: z.ZodString;
8233
8234
  folderId: z.ZodOptional<z.ZodString>;
@@ -8235,11 +8236,13 @@ export declare const microsoftCreateDocumentParamsSchema: z.ZodObject<{
8235
8236
  name: string;
8236
8237
  content: string;
8237
8238
  siteId?: string | undefined;
8239
+ driveId?: string | undefined;
8238
8240
  folderId?: string | undefined;
8239
8241
  }, {
8240
8242
  name: string;
8241
8243
  content: string;
8242
8244
  siteId?: string | undefined;
8245
+ driveId?: string | undefined;
8243
8246
  folderId?: string | undefined;
8244
8247
  }>;
8245
8248
  export type microsoftCreateDocumentParamsType = z.infer<typeof microsoftCreateDocumentParamsSchema>;
@@ -8266,16 +8269,19 @@ export type microsoftCreateDocumentOutputType = z.infer<typeof microsoftCreateDo
8266
8269
  export type microsoftCreateDocumentFunction = ActionFunction<microsoftCreateDocumentParamsType, AuthParamsType, microsoftCreateDocumentOutputType>;
8267
8270
  export declare const microsoftUpdateDocumentParamsSchema: z.ZodObject<{
8268
8271
  siteId: z.ZodOptional<z.ZodString>;
8272
+ driveId: z.ZodOptional<z.ZodString>;
8269
8273
  documentId: z.ZodString;
8270
8274
  content: z.ZodString;
8271
8275
  }, "strip", z.ZodTypeAny, {
8272
8276
  content: string;
8273
8277
  documentId: string;
8274
8278
  siteId?: string | undefined;
8279
+ driveId?: string | undefined;
8275
8280
  }, {
8276
8281
  content: string;
8277
8282
  documentId: string;
8278
8283
  siteId?: string | undefined;
8284
+ driveId?: string | undefined;
8279
8285
  }>;
8280
8286
  export type microsoftUpdateDocumentParamsType = z.infer<typeof microsoftUpdateDocumentParamsSchema>;
8281
8287
  export declare const microsoftUpdateDocumentOutputSchema: z.ZodObject<{
@@ -8298,16 +8304,19 @@ export declare const microsoftUpdateSpreadsheetParamsSchema: z.ZodObject<{
8298
8304
  range: z.ZodString;
8299
8305
  values: z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">;
8300
8306
  siteId: z.ZodOptional<z.ZodString>;
8307
+ driveId: z.ZodOptional<z.ZodString>;
8301
8308
  }, "strip", z.ZodTypeAny, {
8302
8309
  values: string[][];
8303
8310
  range: string;
8304
8311
  spreadsheetId: string;
8305
8312
  siteId?: string | undefined;
8313
+ driveId?: string | undefined;
8306
8314
  }, {
8307
8315
  values: string[][];
8308
8316
  range: string;
8309
8317
  spreadsheetId: string;
8310
8318
  siteId?: string | undefined;
8319
+ driveId?: string | undefined;
8311
8320
  }>;
8312
8321
  export type microsoftUpdateSpreadsheetParamsType = z.infer<typeof microsoftUpdateSpreadsheetParamsSchema>;
8313
8322
  export declare const microsoftUpdateSpreadsheetOutputSchema: z.ZodObject<{
@@ -8382,13 +8391,16 @@ export type microsoftMessageTeamsChannelOutputType = z.infer<typeof microsoftMes
8382
8391
  export type microsoftMessageTeamsChannelFunction = ActionFunction<microsoftMessageTeamsChannelParamsType, AuthParamsType, microsoftMessageTeamsChannelOutputType>;
8383
8392
  export declare const microsoftGetDocumentParamsSchema: z.ZodObject<{
8384
8393
  siteId: z.ZodOptional<z.ZodString>;
8394
+ driveId: z.ZodOptional<z.ZodString>;
8385
8395
  documentId: z.ZodString;
8386
8396
  }, "strip", z.ZodTypeAny, {
8387
8397
  documentId: string;
8388
8398
  siteId?: string | undefined;
8399
+ driveId?: string | undefined;
8389
8400
  }, {
8390
8401
  documentId: string;
8391
8402
  siteId?: string | undefined;
8403
+ driveId?: string | undefined;
8392
8404
  }>;
8393
8405
  export type microsoftGetDocumentParamsType = z.infer<typeof microsoftGetDocumentParamsSchema>;
8394
8406
  export declare const microsoftGetDocumentOutputSchema: z.ZodObject<{
@@ -4260,9 +4260,20 @@ export const salesforceGetReportMetadataOutputSchema = z.object({
4260
4260
  .optional(),
4261
4261
  });
4262
4262
  export const microsoftCreateDocumentParamsSchema = z.object({
4263
- siteId: z.string().describe("The ID of the site where the document will be created").optional(),
4264
- name: z.string().describe("The name of the new document (include extension like .docx or .xlsx)"),
4265
- content: z.string().describe("The content to add to the new document"),
4263
+ siteId: z
4264
+ .string()
4265
+ .describe("The ID of the site where the document will be created (targets the site's default document library; ignored if driveId is provided)")
4266
+ .optional(),
4267
+ driveId: z
4268
+ .string()
4269
+ .describe("The ID of the drive (document library) to create the document in. Required to target a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action")
4270
+ .optional(),
4271
+ name: z
4272
+ .string()
4273
+ .describe("The name of the new document, including the extension. Use .docx for a Word document (the content is converted into a real Word file) or a plain-text extension like .txt or .md. Other Office extensions (.doc, .xlsx, .xls, .pptx, .ppt) are not supported and will be rejected"),
4274
+ content: z
4275
+ .string()
4276
+ .describe("The plain-text content of the document. When the name ends in .docx it is converted into a Word document with one paragraph per line; otherwise it is written as-is"),
4266
4277
  folderId: z.string().describe("The ID of the folder to create the document in (optional)").optional(),
4267
4278
  });
4268
4279
  export const microsoftCreateDocumentOutputSchema = z.object({
@@ -4273,9 +4284,18 @@ export const microsoftCreateDocumentOutputSchema = z.object({
4273
4284
  error: z.string().describe("The error that occurred if the document was not created successfully").optional(),
4274
4285
  });
4275
4286
  export const microsoftUpdateDocumentParamsSchema = z.object({
4276
- siteId: z.string().describe("The ID of the site where the document is located").optional(),
4287
+ siteId: z
4288
+ .string()
4289
+ .describe("The ID of the site where the document is located (targets the site's default document library; ignored if driveId is provided)")
4290
+ .optional(),
4291
+ driveId: z
4292
+ .string()
4293
+ .describe("The ID of the drive (document library) containing the document. Required when the document is in a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action")
4294
+ .optional(),
4277
4295
  documentId: z.string().describe("The ID of the document"),
4278
- content: z.string().describe("The new content to update in the document"),
4296
+ content: z
4297
+ .string()
4298
+ .describe("The new plain-text content for the document (replaces the existing content entirely). If the target file is a .docx it is converted into a Word document with one paragraph per line; other Office formats (.doc, .xlsx, .xls, .pptx, .ppt) cannot be updated"),
4279
4299
  });
4280
4300
  export const microsoftUpdateDocumentOutputSchema = z.object({
4281
4301
  success: z.boolean().describe("Whether the document was updated successfully"),
@@ -4286,7 +4306,14 @@ export const microsoftUpdateSpreadsheetParamsSchema = z.object({
4286
4306
  spreadsheetId: z.string().describe("The ID of the spreadsheet to update"),
4287
4307
  range: z.string().describe('The range of cells to update (e.g., "Sheet1!A1:B2")'),
4288
4308
  values: z.array(z.array(z.string())).describe("The values to update in the specified range"),
4289
- siteId: z.string().describe("The ID of the site where the spreadsheet is located").optional(),
4309
+ siteId: z
4310
+ .string()
4311
+ .describe("The ID of the site where the spreadsheet is located (targets the site's default document library; ignored if driveId is provided)")
4312
+ .optional(),
4313
+ driveId: z
4314
+ .string()
4315
+ .describe("The ID of the drive (document library) containing the spreadsheet. Required when the spreadsheet is in a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action")
4316
+ .optional(),
4290
4317
  });
4291
4318
  export const microsoftUpdateSpreadsheetOutputSchema = z.object({
4292
4319
  success: z.boolean().describe("Whether the spreadsheet was updated successfully"),
@@ -4313,7 +4340,14 @@ export const microsoftMessageTeamsChannelOutputSchema = z.object({
4313
4340
  messageId: z.string().describe("The ID of the message that was sent").optional(),
4314
4341
  });
4315
4342
  export const microsoftGetDocumentParamsSchema = z.object({
4316
- siteId: z.string().describe("The ID of the site where the document is located (optional for OneDrive)").optional(),
4343
+ siteId: z
4344
+ .string()
4345
+ .describe("The ID of the site where the document is located (optional for OneDrive; targets the site's default document library; ignored if driveId is provided)")
4346
+ .optional(),
4347
+ driveId: z
4348
+ .string()
4349
+ .describe("The ID of the drive (document library) containing the document. Required when the document is in a non-default document library; takes precedence over siteId. Can be resolved from a SharePoint URL with the getSharepointItem action")
4350
+ .optional(),
4317
4351
  documentId: z.string().describe("The ID of the document to retrieve"),
4318
4352
  });
4319
4353
  export const microsoftGetDocumentOutputSchema = z.object({
@@ -47,7 +47,7 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
47
47
  name: item.name,
48
48
  path: item.path,
49
49
  sha: item.sha.slice(0, 7),
50
- url: item.html_url,
50
+ url: item.url,
51
51
  score: item.score,
52
52
  textMatches: item.text_matches
53
53
  ? item.text_matches.map(match => {
@@ -68,7 +68,7 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
68
68
  const full = commitDetails.find(c => c.data.sha === item.sha);
69
69
  return {
70
70
  sha: item.sha,
71
- url: item.html_url,
71
+ url: item.url,
72
72
  commit: {
73
73
  message: item.commit.message,
74
74
  author: item.commit.author,
@@ -76,11 +76,11 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
76
76
  score: item.score,
77
77
  author: (_a = item.author) !== null && _a !== void 0 ? _a : undefined,
78
78
  files: ((_b = full === null || full === void 0 ? void 0 : full.data.files) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_FILES_PER_COMMIT).map(f => {
79
- var _a, _b, _c;
79
+ var _a;
80
80
  return ({
81
81
  filename: f.filename,
82
82
  status: f.status,
83
- patch: (_c = (_b = (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n")) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_PATCH_LINES)) === null || _c === void 0 ? void 0 : _c.join("\n"),
83
+ patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
84
84
  });
85
85
  })) || [],
86
86
  };
@@ -104,18 +104,18 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
104
104
  const prIndex = prNumbers.indexOf(item.number);
105
105
  const files = isPR && prIndex !== -1
106
106
  ? prFiles[prIndex].data.slice(0, MAX_FILES_PER_PR).map(f => {
107
- var _a, _b, _c;
107
+ var _a;
108
108
  return ({
109
109
  filename: f.filename,
110
110
  status: f.status,
111
- patch: (_c = (_b = (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n")) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_PATCH_LINES)) === null || _c === void 0 ? void 0 : _c.join("\n"),
111
+ patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
112
112
  });
113
113
  })
114
114
  : undefined;
115
115
  return {
116
116
  number: item.number,
117
117
  title: item.title,
118
- url: item.html_url,
118
+ html_url: item.html_url,
119
119
  state: item.state,
120
120
  isPullRequest: isPR,
121
121
  body: item.body,
@@ -0,0 +1,3 @@
1
+ import type { googleOauthListFilesWithAssignedCommentsFunction } from "../../autogen/types.js";
2
+ declare const listFilesWithAssignedComments: googleOauthListFilesWithAssignedCommentsFunction;
3
+ export default listFilesWithAssignedComments;
@@ -0,0 +1,41 @@
1
+ import { axiosClient } from "../../util/axiosClient.js";
2
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
3
+ import { dedupeByIdKeepFirst, filterReadableFiles } from "./utils.js";
4
+ const ASSIGNED_COMMENTS_QUERY = "followup='assignedcomments' and trashed=false";
5
+ const listFilesWithAssignedComments = async ({ params, authParams, }) => {
6
+ if (!authParams.authToken) {
7
+ return { success: false, error: MISSING_AUTH_TOKEN, files: [] };
8
+ }
9
+ const { limit } = params;
10
+ try {
11
+ const allDrivesUrl = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(ASSIGNED_COMMENTS_QUERY)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true&corpora=allDrives&pageSize=100`;
12
+ const orgWideUrl = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(ASSIGNED_COMMENTS_QUERY)}&fields=files(id,name,mimeType,webViewLink)&corpora=domain&pageSize=100`;
13
+ const [allDrivesRes, orgWideRes] = await Promise.all([
14
+ axiosClient.get(allDrivesUrl, { headers: { Authorization: `Bearer ${authParams.authToken}` } }),
15
+ axiosClient.get(orgWideUrl, { headers: { Authorization: `Bearer ${authParams.authToken}` } }),
16
+ ]);
17
+ const rawFiles = [allDrivesRes.data.files, orgWideRes.data.files]
18
+ .filter(Boolean)
19
+ .flatMap(files => filterReadableFiles(files));
20
+ const files = rawFiles.map((file) => ({
21
+ id: file.id || "",
22
+ name: file.name || "",
23
+ mimeType: file.mimeType || "",
24
+ url: file.webViewLink || "",
25
+ }));
26
+ const dedupedFiles = dedupeByIdKeepFirst(files);
27
+ return {
28
+ success: true,
29
+ files: limit ? dedupedFiles.slice(0, limit) : dedupedFiles,
30
+ };
31
+ }
32
+ catch (error) {
33
+ console.error("Error listing files with assigned comments", error);
34
+ return {
35
+ success: false,
36
+ error: error instanceof Error ? error.message : "Unknown error",
37
+ files: [],
38
+ };
39
+ }
40
+ };
41
+ export default listFilesWithAssignedComments;
@@ -0,0 +1,3 @@
1
+ import type { jiraUpdateServiceDeskRequestFunction } from "../../autogen/types.js";
2
+ declare const updateServiceDeskRequest: jiraUpdateServiceDeskRequestFunction;
3
+ export default updateServiceDeskRequest;
@@ -0,0 +1,72 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { axiosClient } from "../../util/axiosClient.js";
11
+ const updateServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
12
+ const { issueId, requestTypeId, summary, description, priority, customFields } = params;
13
+ const { authToken, cloudId, baseUrl } = authParams;
14
+ if (!cloudId || !authToken) {
15
+ throw new Error("Valid Cloud ID and auth token are required to update service desk request");
16
+ }
17
+ // Use the regular Jira API for updating service desk requests as they are still Jira issues
18
+ const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
19
+ const formattedDescription = description
20
+ ? {
21
+ type: "doc",
22
+ version: 1,
23
+ content: [
24
+ {
25
+ type: "paragraph",
26
+ content: [
27
+ {
28
+ type: "text",
29
+ text: description,
30
+ },
31
+ ],
32
+ },
33
+ ],
34
+ }
35
+ : undefined;
36
+ const payload = {
37
+ fields: Object.assign(Object.assign(Object.assign(Object.assign({}, (summary && { summary })), (formattedDescription && { description: formattedDescription })), (priority && { priority: { name: priority } })), (customFields && Object.assign({}, customFields))),
38
+ };
39
+ try {
40
+ yield axiosClient.put(apiUrl, payload, {
41
+ headers: {
42
+ Authorization: `Bearer ${authToken}`,
43
+ Accept: "application/json",
44
+ "Content-Type": "application/json",
45
+ },
46
+ });
47
+ // Get the updated issue details to return current status and web link
48
+ const getResponse = yield axiosClient.get(apiUrl, {
49
+ headers: {
50
+ Authorization: `Bearer ${authToken}`,
51
+ Accept: "application/json",
52
+ },
53
+ });
54
+ const issueKey = getResponse.data.key;
55
+ const currentStatus = getResponse.data.fields.status.name;
56
+ const webLink = `${baseUrl}/browse/${issueKey}`;
57
+ return {
58
+ success: true,
59
+ issueKey,
60
+ webLink,
61
+ currentStatus,
62
+ };
63
+ }
64
+ catch (error) {
65
+ console.error("Error updating service desk request:", error);
66
+ return {
67
+ success: false,
68
+ error: error instanceof Error ? error.message : "Unknown error",
69
+ };
70
+ }
71
+ });
72
+ export default updateServiceDeskRequest;
@@ -1,6 +1,6 @@
1
- import { getGraphClient, validateAndSanitizeFileName } from "./utils.js";
1
+ import { fileNameHasDocxExtension, generateDocxFromPlainText, getDrivePath, getGraphClient, getUnsupportedOfficeExtension, validateAndSanitizeFileName, } from "./utils.js";
2
2
  const createDocument = async ({ params, authParams, }) => {
3
- const { folderId, name, content, siteId } = params;
3
+ const { folderId, name, content, siteId, driveId } = params;
4
4
  let client = undefined;
5
5
  try {
6
6
  client = await getGraphClient(authParams);
@@ -11,12 +11,21 @@ const createDocument = async ({ params, authParams, }) => {
11
11
  error: "Error while authorizing: " + (error instanceof Error ? error.message : "Unknown error"),
12
12
  };
13
13
  }
14
- const apiEndpointPrefix = siteId ? `/sites/${siteId}` : "/me";
15
14
  const sanitizedFileName = validateAndSanitizeFileName(name);
16
- const endpoint = `${apiEndpointPrefix}/drive/items/${folderId || "root"}:/${sanitizedFileName}:/content`;
15
+ const unsupportedOfficeExtension = getUnsupportedOfficeExtension(sanitizedFileName);
16
+ if (unsupportedOfficeExtension) {
17
+ return {
18
+ success: false,
19
+ error: `Cannot create "${unsupportedOfficeExtension}" files: this action writes the provided text and can only generate Word documents. Use a .docx extension for a Word document, or a plain-text extension like .txt.`,
20
+ };
21
+ }
22
+ const endpoint = `${getDrivePath({ driveId, siteId })}/items/${folderId || "root"}:/${sanitizedFileName}:/content`;
17
23
  try {
24
+ // .docx is a ZIP-of-XML container, so the text must be converted into real OOXML
25
+ // bytes; writing it directly would produce a file Word cannot open.
26
+ const body = fileNameHasDocxExtension(sanitizedFileName) ? await generateDocxFromPlainText(content) : content;
18
27
  // Create or update the document
19
- const response = await client.api(endpoint).put(content);
28
+ const response = await client.api(endpoint).put(body);
20
29
  return {
21
30
  success: true,
22
31
  documentId: response.id,
@@ -1,6 +1,6 @@
1
- import { getGraphClient } from "./utils.js";
1
+ import { getDrivePath, getGraphClient } from "./utils.js";
2
2
  const getDocument = async ({ params, authParams, }) => {
3
- const { siteId, documentId } = params;
3
+ const { siteId, driveId, documentId } = params;
4
4
  let client;
5
5
  try {
6
6
  client = await getGraphClient(authParams);
@@ -12,10 +12,7 @@ const getDocument = async ({ params, authParams, }) => {
12
12
  };
13
13
  }
14
14
  try {
15
- // Construct the API endpoint
16
- const endpoint = siteId
17
- ? `/sites/${siteId}/drive/items/${documentId}/content`
18
- : `/me/drive/items/${documentId}/content`;
15
+ const endpoint = `${getDrivePath({ driveId, siteId })}/items/${documentId}/content`;
19
16
  // Fetch the document content
20
17
  const response = await client.api(endpoint).get();
21
18
  return {
@@ -0,0 +1,3 @@
1
+ import type { microsoftSendOutlookEmailFunction } from "../../autogen/types.js";
2
+ declare const sendEmail: microsoftSendOutlookEmailFunction;
3
+ export default sendEmail;
@@ -0,0 +1,48 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getGraphClient } from "./utils.js";
11
+ const sendEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
12
+ const { toRecipients, subject, body, ccRecipients, bccRecipients } = params;
13
+ let client = undefined;
14
+ try {
15
+ client = yield getGraphClient(authParams);
16
+ }
17
+ catch (error) {
18
+ return {
19
+ success: false,
20
+ error: "Error while authorizing: " + (error instanceof Error ? error.message : "Unknown error"),
21
+ };
22
+ }
23
+ try {
24
+ const message = {
25
+ message: Object.assign(Object.assign({ subject, body: {
26
+ contentType: "HTML",
27
+ content: body,
28
+ }, toRecipients: toRecipients.map(email => ({ emailAddress: { address: email } })) }, (ccRecipients && ccRecipients.length > 0
29
+ ? { ccRecipients: ccRecipients.map(email => ({ emailAddress: { address: email } })) }
30
+ : {})), (bccRecipients && bccRecipients.length > 0
31
+ ? { bccRecipients: bccRecipients.map(email => ({ emailAddress: { address: email } })) }
32
+ : {})),
33
+ saveToSentItems: true,
34
+ };
35
+ yield client.api("/me/sendMail").post(message);
36
+ return {
37
+ success: true,
38
+ };
39
+ }
40
+ catch (error) {
41
+ console.error(error);
42
+ return {
43
+ success: false,
44
+ error: "Error sending email: " + (error instanceof Error ? error.message : "Unknown error"),
45
+ };
46
+ }
47
+ });
48
+ export default sendEmail;
@@ -1,6 +1,6 @@
1
- import { getGraphClient } from "./utils.js";
1
+ import { fileNameHasDocxExtension, generateDocxFromPlainText, getDrivePath, getGraphClient, getUnsupportedOfficeExtension, } from "./utils.js";
2
2
  const updateDocument = async ({ params, authParams, }) => {
3
- const { documentId, content, siteId } = params;
3
+ const { documentId, content, siteId, driveId } = params;
4
4
  let client = undefined;
5
5
  try {
6
6
  client = await getGraphClient(authParams);
@@ -12,11 +12,21 @@ const updateDocument = async ({ params, authParams, }) => {
12
12
  };
13
13
  }
14
14
  try {
15
- // Determine the endpoint based on whether siteId is provided
16
- const endpoint = siteId
17
- ? `/sites/${siteId}/drive/items/${documentId}/content`
18
- : `/me/drive/items/${documentId}/content`;
19
- const response = await client.api(endpoint).put(content);
15
+ const drivePath = getDrivePath({ driveId, siteId });
16
+ // The target's filename decides how the content must be written: .docx is a
17
+ // ZIP-of-XML container, so overwriting it with raw text would corrupt it.
18
+ const itemMetadata = await client.api(`${drivePath}/items/${documentId}?$select=name`).get();
19
+ const fileName = itemMetadata?.name ?? "";
20
+ const unsupportedOfficeExtension = getUnsupportedOfficeExtension(fileName);
21
+ if (unsupportedOfficeExtension) {
22
+ return {
23
+ success: false,
24
+ error: `Cannot update "${unsupportedOfficeExtension}" files: this action writes the provided text and can only generate Word documents. Only .docx and plain-text files can be updated.`,
25
+ };
26
+ }
27
+ const body = fileNameHasDocxExtension(fileName) ? await generateDocxFromPlainText(content) : content;
28
+ const endpoint = `${drivePath}/items/${documentId}/content`;
29
+ const response = await client.api(endpoint).put(body);
20
30
  return {
21
31
  success: true,
22
32
  documentUrl: response.webUrl,
@@ -1,6 +1,6 @@
1
- import { getGraphClient } from "./utils.js";
1
+ import { getDrivePath, getGraphClient } from "./utils.js";
2
2
  const updateSpreadsheet = async ({ params, authParams, }) => {
3
- const { spreadsheetId, range, values, siteId } = params; // Added siteId to destructured params
3
+ const { spreadsheetId, range, values, siteId, driveId } = params;
4
4
  let client = undefined;
5
5
  try {
6
6
  client = await getGraphClient(authParams);
@@ -11,7 +11,6 @@ const updateSpreadsheet = async ({ params, authParams, }) => {
11
11
  error: "Error while authorizing: " + (error instanceof Error ? error.message : "Unknown error"),
12
12
  };
13
13
  }
14
- const apiEndpointPrefix = siteId ? `/sites/${siteId}` : "/me";
15
14
  if (!range.includes("!")) {
16
15
  return {
17
16
  success: false,
@@ -25,7 +24,7 @@ const updateSpreadsheet = async ({ params, authParams, }) => {
25
24
  error: "Invalid range format. Both sheet name and cell range must be specified.",
26
25
  };
27
26
  }
28
- const apiEndpoint = `${apiEndpointPrefix}/drive/items/${spreadsheetId}/workbook/worksheets/${sheetName}/range(address='${cellRange}')`;
27
+ const apiEndpoint = `${getDrivePath({ driveId, siteId })}/items/${spreadsheetId}/workbook/worksheets/${sheetName}/range(address='${cellRange}')`;
29
28
  try {
30
29
  const response = await client.api(apiEndpoint).patch({ values });
31
30
  return {
@@ -1,10 +1,27 @@
1
1
  import { Client } from "@microsoft/microsoft-graph-client";
2
2
  import type { AuthParamsType } from "../../autogen/types.js";
3
3
  export declare function getGraphClient(authParams: AuthParamsType): Promise<Client>;
4
+ /**
5
+ * Builds the Graph API path prefix addressing a drive. Item IDs are scoped to a drive, so a
6
+ * driveId (when known) addresses the exact document library; /sites/{siteId}/drive only ever
7
+ * reaches the site's default library, and /me/drive the user's personal OneDrive.
8
+ */
9
+ export declare function getDrivePath({ driveId, siteId }: {
10
+ driveId?: string;
11
+ siteId?: string;
12
+ }): string;
4
13
  /**
5
14
  * Validates and sanitizes a filename for SharePoint or OneDrive.
6
15
  * @param fileName The original filename to validate and sanitize.
7
16
  * @returns A sanitized filename that is safe to use.
8
17
  */
9
18
  export declare function validateAndSanitizeFileName(fileName: string): string;
19
+ export declare function fileNameHasDocxExtension(fileName: string): boolean;
20
+ export declare function getUnsupportedOfficeExtension(fileName: string): string | undefined;
21
+ /**
22
+ * Builds a valid .docx file from plain text, one paragraph per line. A .docx is a ZIP
23
+ * archive of XML parts, so text bytes written directly under a .docx name produce a
24
+ * corrupted document — the bytes must be generated with an OOXML writer.
25
+ */
26
+ export declare function generateDocxFromPlainText(text: string): Promise<Buffer>;
10
27
  export declare const MICROSOFT_GRAPH_API_URL = "https://graph.microsoft.com/v1.0";
@@ -1,4 +1,5 @@
1
1
  import { Client } from "@microsoft/microsoft-graph-client";
2
+ import { Document, Packer, Paragraph, TextRun } from "docx";
2
3
  export async function getGraphClient(authParams) {
3
4
  if (!authParams.authToken) {
4
5
  throw new Error("Missing required authentication parameters");
@@ -10,6 +11,14 @@ export async function getGraphClient(authParams) {
10
11
  },
11
12
  });
12
13
  }
14
+ /**
15
+ * Builds the Graph API path prefix addressing a drive. Item IDs are scoped to a drive, so a
16
+ * driveId (when known) addresses the exact document library; /sites/{siteId}/drive only ever
17
+ * reaches the site's default library, and /me/drive the user's personal OneDrive.
18
+ */
19
+ export function getDrivePath({ driveId, siteId }) {
20
+ return driveId ? `/drives/${driveId}` : siteId ? `/sites/${siteId}/drive` : "/me/drive";
21
+ }
13
22
  /**
14
23
  * Validates and sanitizes a filename for SharePoint or OneDrive.
15
24
  * @param fileName The original filename to validate and sanitize.
@@ -33,4 +42,24 @@ export function validateAndSanitizeFileName(fileName) {
33
42
  }
34
43
  return sanitizedFileName;
35
44
  }
45
+ // Office formats that are binary/ZIP containers. Writing plain text bytes under these
46
+ // extensions produces a file the corresponding Office app cannot open.
47
+ const UNSUPPORTED_OFFICE_EXTENSIONS = [".doc", ".xlsx", ".xls", ".pptx", ".ppt"];
48
+ export function fileNameHasDocxExtension(fileName) {
49
+ return fileName.toLowerCase().endsWith(".docx");
50
+ }
51
+ export function getUnsupportedOfficeExtension(fileName) {
52
+ const lowerCaseFileName = fileName.toLowerCase();
53
+ return UNSUPPORTED_OFFICE_EXTENSIONS.find(extension => lowerCaseFileName.endsWith(extension));
54
+ }
55
+ /**
56
+ * Builds a valid .docx file from plain text, one paragraph per line. A .docx is a ZIP
57
+ * archive of XML parts, so text bytes written directly under a .docx name produce a
58
+ * corrupted document — the bytes must be generated with an OOXML writer.
59
+ */
60
+ export async function generateDocxFromPlainText(text) {
61
+ const paragraphs = text.split(/\r?\n/).map(line => new Paragraph({ children: [new TextRun({ text: line })] }));
62
+ const document = new Document({ sections: [{ properties: {}, children: paragraphs }] });
63
+ return Packer.toBuffer(document);
64
+ }
36
65
  export const MICROSOFT_GRAPH_API_URL = "https://graph.microsoft.com/v1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.224",
3
+ "version": "0.2.226",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "overrides": {
89
89
  "@xmldom/xmldom": "^0.8.13",
90
- "axios": "^1.17.0",
90
+ "axios": "^1.18.1",
91
91
  "fast-xml-parser": "^5.7.0",
92
92
  "minimatch": "^10.2.1",
93
93
  "file-type": "^22.0.0"
@@ -1,6 +0,0 @@
1
- import type { ActionTemplate } from "./parse.js";
2
- export type ActionGroups = Record<string, {
3
- description: string;
4
- actions: ActionTemplate[];
5
- }>;
6
- export declare const ACTION_GROUPS: ActionGroups;
@@ -1,220 +0,0 @@
1
- import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, } from "./autogen/templates.js";
2
- export const ACTION_GROUPS = {
3
- GENERIC: {
4
- description: "Generic utility actions",
5
- actions: [genericFillTemplateDefinition],
6
- },
7
- ASANA: {
8
- description: "Actions for interacting with Asana",
9
- actions: [
10
- asanaCommentTaskDefinition,
11
- asanaCreateTaskDefinition,
12
- asanaUpdateTaskDefinition,
13
- asanaSearchTasksDefinition,
14
- asanaListAsanaTasksByProjectDefinition,
15
- asanaGetTasksDetailsDefinition,
16
- ],
17
- },
18
- SLACK_LIST_CONVERSATIONS: {
19
- description: "Actions for interacting with Slack",
20
- actions: [slackSendMessageDefinition, slackGetChannelMessagesDefinition],
21
- },
22
- CONFLUENCE: {
23
- description: "Action for interacting with Confluence",
24
- actions: [confluenceOverwritePageDefinition, confluenceFetchPageContentDefinition],
25
- },
26
- MATH_ADD: {
27
- description: "Action for adding two numbers",
28
- actions: [mathAddDefinition],
29
- },
30
- GOOGLE_MAPS: {
31
- description: "Action for interacting with Google Maps",
32
- actions: [googlemapsValidateAddressDefinition, googlemapsNearbysearchRestaurantsDefinition],
33
- },
34
- GOOGLE_DRIVE: {
35
- description: "Action for interacting with Google Drive",
36
- actions: [
37
- googleOauthCreateNewGoogleDocDefinition,
38
- googleOauthUpdateDocDefinition,
39
- googleOauthCreateSpreadsheetDefinition,
40
- googleOauthUpdateSpreadsheetDefinition,
41
- googleOauthCreatePresentationDefinition,
42
- googleOauthUpdatePresentationDefinition,
43
- googleOauthSearchDriveByKeywordsDefinition,
44
- ],
45
- },
46
- GOOGLE_CALENDAR: {
47
- description: "Actions for interacting with Google Calendar",
48
- actions: [
49
- googleOauthScheduleCalendarMeetingDefinition,
50
- googleOauthListCalendarsDefinition,
51
- googleOauthListCalendarEventsDefinition,
52
- googleOauthUpdateCalendarEventDefinition,
53
- googleOauthDeleteCalendarEventDefinition,
54
- ],
55
- },
56
- GMAIL: {
57
- description: "Actions for interacting with Gmail",
58
- actions: [googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition],
59
- },
60
- LINKEDIN_SHARE_POST: {
61
- description: "Action for creating a share post url on linkedin",
62
- actions: [linkedinCreateShareLinkedinPostUrlDefinition],
63
- },
64
- ZENDESK_ACTIONS: {
65
- description: "Actions for interacting with Zendesk",
66
- actions: [
67
- zendeskCreateZendeskTicketDefinition,
68
- zendeskListZendeskTicketsDefinition,
69
- zendeskGetTicketDetailsDefinition,
70
- zendeskUpdateTicketStatusDefinition,
71
- zendeskAddCommentToTicketDefinition,
72
- zendeskAssignTicketDefinition,
73
- ],
74
- },
75
- BING_SEARCH: {
76
- description: "Action for searching Bing",
77
- actions: [bingGetTopNSearchResultUrlsDefinition],
78
- },
79
- MONGO_INSERT_DOC: {
80
- description: "Action for inserting a document into a MongoDB collection",
81
- actions: [mongoInsertMongoDocDefinition],
82
- },
83
- SNOWFLAKE_ACTIONS: {
84
- description: "Action for getting content from a Snowflake table",
85
- actions: [snowflakeGetRowByFieldValueDefinition, snowflakeRunSnowflakeQueryDefinition],
86
- },
87
- JIRA_ACTIONS: {
88
- description: "Action for interacting with Jira tickets",
89
- actions: [
90
- jiraAssignJiraTicketDefinition,
91
- jiraCreateJiraTicketDefinition,
92
- jiraCommentJiraTicketDefinition,
93
- jiraGetJiraTicketDetailsDefinition,
94
- jiraGetJiraTicketHistoryDefinition,
95
- jiraUpdateJiraTicketDetailsDefinition,
96
- jiraUpdateJiraTicketStatusDefinition,
97
- jiraGetJiraIssuesByQueryDefinition,
98
- ],
99
- },
100
- OPENSTREETMAP_GET_LATITUDE_LONGITUDE_FROM_LOCATION: {
101
- description: "Action for getting the latitude and longitude of a location",
102
- actions: [openstreetmapGetLatitudeLongitudeFromLocationDefinition],
103
- },
104
- NWS_GET_FORECAST_FOR_LOCATION: {
105
- description: "Action for getting the weather forecast for a location",
106
- actions: [nwsGetForecastForLocationDefinition],
107
- },
108
- FIRECRAWL: {
109
- description: "Actions for interacting with Firecrawl",
110
- actions: [
111
- firecrawlScrapeUrlDefinition,
112
- firecrawlScrapeTweetDataWithNitterDefinition,
113
- firecrawlDeepResearchDefinition,
114
- ],
115
- },
116
- RESEND: {
117
- description: "Action for sending an email",
118
- actions: [resendSendEmailDefinition],
119
- },
120
- X: {
121
- description: "Actions for interacting with X(formerly twitter)",
122
- actions: [xCreateShareXPostUrlDefinition],
123
- },
124
- GONG: {
125
- description: "Actions for interacting with Gong",
126
- actions: [gongGetGongTranscriptsDefinition],
127
- },
128
- FINNHUB: {
129
- description: "Action for interacting with Finnhub for stock market data",
130
- actions: [finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition],
131
- },
132
- JAMF: {
133
- description: "Actions for interacting with Jamf",
134
- actions: [jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition],
135
- },
136
- LOOKER: {
137
- description: "Actions for interacting with Looker",
138
- actions: [lookerEnableUserByEmailDefinition],
139
- },
140
- SALESFORCE: {
141
- description: "Actions for interacting with Salesforce",
142
- actions: [
143
- salesforceUpdateRecordDefinition,
144
- salesforceCreateRecordDefinition,
145
- salesforceCreateCaseDefinition,
146
- salesforceGenerateSalesReportDefinition,
147
- salesforceGetRecordDefinition,
148
- salesforceGetSalesforceRecordsByQueryDefinition,
149
- salesforceFetchSalesforceSchemaByObjectDefinition,
150
- ],
151
- },
152
- MICROSOFT: {
153
- description: "Actions for interacting with Microsoft 365",
154
- actions: [
155
- microsoftMessageTeamsChatDefinition,
156
- microsoftMessageTeamsChannelDefinition,
157
- microsoftUpdateSpreadsheetDefinition,
158
- microsoftUpdateDocumentDefinition,
159
- microsoftCreateDocumentDefinition,
160
- microsoftGetDocumentDefinition,
161
- ],
162
- },
163
- KANDJI: {
164
- description: "Actions for interacting with Kandji",
165
- actions: [kandjiGetFVRecoveryKeyForDeviceDefinition],
166
- },
167
- GITHUB: {
168
- description: "Actions for interacting with GitHub",
169
- actions: [
170
- githubCreateOrUpdateFileDefinition,
171
- githubCreateBranchDefinition,
172
- githubCreatePullRequestDefinition,
173
- githubListPullRequestsDefinition,
174
- ],
175
- },
176
- ASHBY: {
177
- description: "Actions for interacting with Ashby",
178
- actions: [
179
- ashbyCreateNoteDefinition,
180
- ashbyGetCandidateInfoDefinition,
181
- ashbyListCandidatesDefinition,
182
- ashbyListCandidateNotesDefinition,
183
- ashbySearchCandidatesDefinition,
184
- ashbyCreateCandidateDefinition,
185
- ashbyUpdateCandidateDefinition,
186
- ashbyAddCandidateToProjectDefinition,
187
- ],
188
- },
189
- NOTION: {
190
- description: "Actions for interacting with Notion",
191
- actions: [notionSearchByTitleDefinition],
192
- },
193
- GOOGLE_GROUPS: {
194
- description: "Google Workspace Groups management actions",
195
- actions: [
196
- googleOauthListGroupsDefinition,
197
- googleOauthGetGroupDefinition,
198
- googleOauthListGroupMembersDefinition,
199
- googleOauthHasGroupMemberDefinition,
200
- googleOauthAddGroupMemberDefinition,
201
- googleOauthDeleteGroupMemberDefinition,
202
- ],
203
- },
204
- OKTA: {
205
- description: "Actions for interacting with Okta",
206
- actions: [
207
- oktaListOktaUsersDefinition,
208
- oktaGetOktaUserDefinition,
209
- oktaListOktaUserGroupsDefinition,
210
- oktaListOktaGroupsDefinition,
211
- oktaGetOktaGroupDefinition,
212
- oktaListOktaGroupMembersDefinition,
213
- oktaRemoveUserFromGroupDefinition,
214
- oktaAddUserToGroupDefinition,
215
- oktaResetPasswordDefinition,
216
- oktaResetMFADefinition,
217
- oktaListMFADefinition,
218
- ],
219
- },
220
- };
@@ -1,3 +0,0 @@
1
- import type { slackArchiveChannelFunction } from "../../autogen/types.js";
2
- declare const archiveChannel: slackArchiveChannelFunction;
3
- export default archiveChannel;
@@ -1,35 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { WebClient } from "@slack/web-api";
11
- import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
- const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
13
- if (!authParams.authToken) {
14
- throw new Error(MISSING_AUTH_TOKEN);
15
- }
16
- try {
17
- const client = new WebClient(authParams.authToken);
18
- const { channelId } = params;
19
- const result = yield client.conversations.archive({ channel: channelId });
20
- if (!result.ok) {
21
- return {
22
- success: false,
23
- error: result.error || "Unknown error archiving channel",
24
- };
25
- }
26
- return { success: true };
27
- }
28
- catch (error) {
29
- return {
30
- success: false,
31
- error: error instanceof Error ? error.message : "Unknown error archiving channel",
32
- };
33
- }
34
- });
35
- export default archiveChannel;