@credal/actions 0.2.49 → 0.2.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/actions/providers/confluence/updatePage.js +14 -15
  2. package/dist/actions/providers/generic/fillTemplateAction.d.ts +7 -0
  3. package/dist/actions/providers/generic/fillTemplateAction.js +18 -0
  4. package/dist/actions/providers/generic/genericApiCall.d.ts +3 -0
  5. package/dist/actions/providers/generic/genericApiCall.js +38 -0
  6. package/dist/actions/providers/google-oauth/getDriveContentById.d.ts +3 -0
  7. package/dist/actions/providers/google-oauth/getDriveContentById.js +161 -0
  8. package/dist/actions/providers/google-oauth/getDriveFileContentById.js +75 -54
  9. package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.d.ts +3 -0
  10. package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.js +47 -0
  11. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.d.ts +3 -0
  12. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.js +110 -0
  13. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.d.ts +3 -0
  14. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.js +78 -0
  15. package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.d.ts +15 -0
  16. package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.js +129 -0
  17. package/dist/actions/providers/googlemaps/nearbysearch.d.ts +3 -0
  18. package/dist/actions/providers/googlemaps/nearbysearch.js +96 -0
  19. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.d.ts +3 -0
  20. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.js +154 -0
  21. package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +3 -0
  22. package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +45 -0
  23. package/dist/utils/google.d.ts +85 -0
  24. package/dist/utils/google.js +170 -0
  25. package/package.json +1 -1
  26. package/dist/actions/providers/jamf/types.d.ts +0 -8
  27. package/dist/actions/providers/jamf/types.js +0 -7
@@ -0,0 +1,170 @@
1
+ // Helper function to parse Google Docs content to plain text
2
+ export function parseGoogleDocFromRawContentToPlainText(snapshotRawContent) {
3
+ var _a, _b, _c, _d, _e, _f;
4
+ const docSections = [
5
+ {
6
+ heading: undefined,
7
+ paragraphs: [],
8
+ },
9
+ ];
10
+ if (!((_a = snapshotRawContent.body) === null || _a === void 0 ? void 0 : _a.content))
11
+ return "";
12
+ for (const content of snapshotRawContent.body.content) {
13
+ if (!content)
14
+ continue;
15
+ // Handle paragraphs (existing logic)
16
+ if (content.paragraph) {
17
+ const paragraph = content.paragraph;
18
+ if ((_b = paragraph.paragraphStyle) === null || _b === void 0 ? void 0 : _b.headingId) {
19
+ // New heading
20
+ docSections.push({
21
+ heading: {
22
+ id: paragraph.paragraphStyle.headingId,
23
+ type: paragraph.paragraphStyle.namedStyleType || "",
24
+ },
25
+ paragraphs: [],
26
+ });
27
+ }
28
+ if (paragraph === null || paragraph === void 0 ? void 0 : paragraph.elements) {
29
+ const combinedTextRuns = paragraph.elements
30
+ .map(element => { var _a; return (_a = element.textRun) === null || _a === void 0 ? void 0 : _a.content; })
31
+ .filter((content) => Boolean(content))
32
+ .join("");
33
+ const bulletNestingLevel = paragraph.bullet === undefined ? undefined : ((_d = (_c = paragraph.bullet) === null || _c === void 0 ? void 0 : _c.nestingLevel) !== null && _d !== void 0 ? _d : 0);
34
+ const paragraphContent = bulletNestingLevel === undefined
35
+ ? combinedTextRuns
36
+ : "\t".repeat(bulletNestingLevel) + " • " + combinedTextRuns;
37
+ docSections[docSections.length - 1].paragraphs.push(paragraphContent);
38
+ }
39
+ }
40
+ // Handle tables
41
+ if (content.table) {
42
+ const table = content.table;
43
+ const tableText = [];
44
+ if (table.tableRows) {
45
+ for (const row of table.tableRows) {
46
+ if (!row.tableCells)
47
+ continue;
48
+ const cellTexts = [];
49
+ for (const cell of row.tableCells) {
50
+ if (!cell.content)
51
+ continue;
52
+ const cellText = [];
53
+ for (const cellContent of cell.content) {
54
+ if ((_e = cellContent.paragraph) === null || _e === void 0 ? void 0 : _e.elements) {
55
+ const cellParagraphText = cellContent.paragraph.elements
56
+ .map(element => { var _a; return (_a = element.textRun) === null || _a === void 0 ? void 0 : _a.content; })
57
+ .filter((content) => Boolean(content))
58
+ .join("");
59
+ if (cellParagraphText.trim()) {
60
+ cellText.push(cellParagraphText.trim());
61
+ }
62
+ }
63
+ }
64
+ cellTexts.push(cellText.join(" "));
65
+ }
66
+ if (cellTexts.some(text => text.trim())) {
67
+ tableText.push(cellTexts.join(" | "));
68
+ }
69
+ }
70
+ }
71
+ if (tableText.length > 0) {
72
+ docSections[docSections.length - 1].paragraphs.push(tableText.join("\n"));
73
+ }
74
+ }
75
+ // Handle section breaks (just in case they contain text)
76
+ if (content.sectionBreak) {
77
+ // Section breaks typically don't contain text, but we'll check anyway
78
+ // This is mostly for completeness
79
+ continue;
80
+ }
81
+ // Handle table of contents (extract any text)
82
+ if (content.tableOfContents) {
83
+ const toc = content.tableOfContents;
84
+ if (toc.content) {
85
+ const tocText = [];
86
+ for (const tocContent of toc.content) {
87
+ if ((_f = tocContent.paragraph) === null || _f === void 0 ? void 0 : _f.elements) {
88
+ const tocParagraphText = tocContent.paragraph.elements
89
+ .map(element => { var _a; return (_a = element.textRun) === null || _a === void 0 ? void 0 : _a.content; })
90
+ .filter((content) => Boolean(content))
91
+ .join("");
92
+ if (tocParagraphText.trim()) {
93
+ tocText.push(tocParagraphText.trim());
94
+ }
95
+ }
96
+ }
97
+ if (tocText.length > 0) {
98
+ docSections[docSections.length - 1].paragraphs.push(tocText.join("\n"));
99
+ }
100
+ }
101
+ }
102
+ }
103
+ const validDocSections = docSections.filter(section => section.heading || section.paragraphs.length > 0);
104
+ return validDocSections.map(section => section.paragraphs.join(" ")).join("\n");
105
+ }
106
+ export function parseGoogleSheetsFromRawContentToPlainText(snapshotRawContent) {
107
+ var _a;
108
+ if (!snapshotRawContent.sheets)
109
+ return "";
110
+ const sheetContents = [];
111
+ for (const sheet of snapshotRawContent.sheets) {
112
+ if (!sheet.data || !((_a = sheet.properties) === null || _a === void 0 ? void 0 : _a.title))
113
+ continue;
114
+ const sheetTitle = sheet.properties.title;
115
+ const sheetRows = [`Sheet: ${sheetTitle}`];
116
+ for (const gridData of sheet.data) {
117
+ if (!gridData.rowData)
118
+ continue;
119
+ for (const rowData of gridData.rowData) {
120
+ if (!rowData.values)
121
+ continue;
122
+ const cellValues = rowData.values
123
+ .map(cell => {
124
+ var _a, _b, _c;
125
+ if (cell.formattedValue)
126
+ return cell.formattedValue;
127
+ if ((_a = cell.userEnteredValue) === null || _a === void 0 ? void 0 : _a.stringValue)
128
+ return cell.userEnteredValue.stringValue;
129
+ if ((_b = cell.userEnteredValue) === null || _b === void 0 ? void 0 : _b.numberValue)
130
+ return cell.userEnteredValue.numberValue.toString();
131
+ if ((_c = cell.userEnteredValue) === null || _c === void 0 ? void 0 : _c.boolValue)
132
+ return cell.userEnteredValue.boolValue.toString();
133
+ return "";
134
+ })
135
+ .filter(value => value !== "");
136
+ if (cellValues.length > 0) {
137
+ sheetRows.push(cellValues.join(" | "));
138
+ }
139
+ }
140
+ }
141
+ if (sheetRows.length > 1) {
142
+ sheetContents.push(sheetRows.join("\n"));
143
+ }
144
+ }
145
+ return sheetContents.join("\n\n");
146
+ }
147
+ export function parseGoogleSlidesFromRawContentToPlainText(snapshotRawContent) {
148
+ var _a, _b, _c;
149
+ if (!snapshotRawContent.slides)
150
+ return "";
151
+ const slideContents = [];
152
+ for (const slide of snapshotRawContent.slides) {
153
+ if (!slide.pageElements)
154
+ continue;
155
+ const slideTexts = [];
156
+ for (const pageElement of slide.pageElements) {
157
+ if (!((_b = (_a = pageElement.shape) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.textElements))
158
+ continue;
159
+ for (const textElement of pageElement.shape.text.textElements) {
160
+ if ((_c = textElement.textRun) === null || _c === void 0 ? void 0 : _c.content) {
161
+ slideTexts.push(textElement.textRun.content.trim());
162
+ }
163
+ }
164
+ }
165
+ if (slideTexts.length > 0) {
166
+ slideContents.push(slideTexts.join(" "));
167
+ }
168
+ }
169
+ return slideContents.join("\n\n");
170
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.49",
3
+ "version": "0.2.51",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const TokenResponseSchema: z.ZodObject<{
3
- token: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- token: string;
6
- }, {
7
- token: string;
8
- }>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenResponseSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.TokenResponseSchema = zod_1.z.object({
6
- token: zod_1.z.string(),
7
- });