@credal/actions 0.2.38 → 0.2.40
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.
@@ -17,7 +17,7 @@ const searchDriveByKeywords = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
17
17
|
const { keywords, limit } = params;
|
18
18
|
// Build the query: fullText contains 'keyword1' or fullText contains 'keyword2' ...
|
19
19
|
const query = keywords.map(kw => `fullText contains '${kw.replace(/'/g, "\\'")}'`).join(" or ");
|
20
|
-
const url = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true`;
|
20
|
+
const url = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true&corpora=allDrives`;
|
21
21
|
try {
|
22
22
|
const res = yield axiosClient.get(url, {
|
23
23
|
headers: {
|
@@ -15,7 +15,7 @@ const searchDriveByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
15
15
|
return { success: false, error: MISSING_AUTH_TOKEN, files: [] };
|
16
16
|
}
|
17
17
|
const { query, limit } = params;
|
18
|
-
const url = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true`;
|
18
|
+
const url = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true&corpora=allDrives`;
|
19
19
|
try {
|
20
20
|
const res = yield axiosClient.get(url, {
|
21
21
|
headers: {
|
@@ -18,7 +18,8 @@ const searchSalesforceRecords = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
18
18
|
};
|
19
19
|
}
|
20
20
|
const maxLimit = 25;
|
21
|
-
const
|
21
|
+
const dateFieldExists = fieldsToSearch.includes("CreatedDate");
|
22
|
+
const url = `${baseUrl}/services/data/v64.0/search/?q=${encodeURIComponent(`FIND {${keyword}} RETURNING ${recordType} (${fieldsToSearch.join(", ") + (dateFieldExists ? " ORDER BY CreatedDate DESC" : "")}) LIMIT ${params.limit && params.limit <= maxLimit ? params.limit : maxLimit}`)}`;
|
22
23
|
try {
|
23
24
|
const response = yield axiosClient.get(url, {
|
24
25
|
headers: {
|
@@ -28,7 +29,16 @@ const searchSalesforceRecords = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
28
29
|
if (recordType === "Knowledge__kav") {
|
29
30
|
for (const record of response.data.searchRecords) {
|
30
31
|
if (record.Article_Body__c) {
|
31
|
-
record.Article_Body__c = record.Article_Body__c
|
32
|
+
record.Article_Body__c = record.Article_Body__c
|
33
|
+
// Convert links to text (URL) format
|
34
|
+
.replace(/<a[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi, "$2 ($1)")
|
35
|
+
// Add line breaks for block elements
|
36
|
+
.replace(/<\/?(p|div|br|h[1-6])[^>]*>/gi, "\n")
|
37
|
+
// Remove all other HTML tags
|
38
|
+
.replace(/<[^>]*>/g, "")
|
39
|
+
// Clean up extra whitespace
|
40
|
+
.replace(/\n\s*\n/g, "\n")
|
41
|
+
.trim();
|
32
42
|
}
|
33
43
|
}
|
34
44
|
}
|