@credal/actions 0.2.67 → 0.2.68
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/actions/actionMapper.js +7 -1
- package/dist/actions/autogen/templates.d.ts +1 -0
- package/dist/actions/autogen/templates.js +46 -0
- package/dist/actions/autogen/types.d.ts +35 -6
- package/dist/actions/autogen/types.js +15 -0
- package/dist/actions/providers/confluence/updatePage.js +14 -15
- package/dist/actions/providers/generic/fillTemplateAction.d.ts +7 -0
- package/dist/actions/providers/generic/fillTemplateAction.js +18 -0
- package/dist/actions/providers/generic/genericApiCall.d.ts +3 -0
- package/dist/actions/providers/generic/genericApiCall.js +38 -0
- package/dist/actions/providers/google-oauth/getDriveContentById.d.ts +3 -0
- package/dist/actions/providers/google-oauth/getDriveContentById.js +161 -0
- package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.d.ts +3 -0
- package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.js +47 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.d.ts +3 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.js +110 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.d.ts +3 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.js +78 -0
- package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.d.ts +15 -0
- package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.js +129 -0
- package/dist/actions/providers/googlemaps/nearbysearch.d.ts +3 -0
- package/dist/actions/providers/googlemaps/nearbysearch.js +96 -0
- package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.d.ts +3 -0
- package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.js +154 -0
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +3 -0
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +45 -0
- package/dist/actions/providers/zendesk/getTicketDetails.js +2 -2
- package/dist/actions/providers/zendesk/searchZendeskByQuery.d.ts +3 -0
- package/dist/actions/providers/zendesk/searchZendeskByQuery.js +35 -0
- package/dist/actions/util/axiosClient.d.ts +1 -0
- package/dist/actions/util/axiosClient.js +16 -0
- package/package.json +2 -1
- package/dist/actions/providers/jamf/types.d.ts +0 -8
- package/dist/actions/providers/jamf/types.js +0 -7
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
+
const searchZendeskByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
+
const { authToken } = authParams;
|
|
14
|
+
const { subdomain, query, objectType = "ticket", limit = 100 } = params;
|
|
15
|
+
// Endpoint for searching Zendesk objects
|
|
16
|
+
const url = `https://${subdomain}.zendesk.com/api/v2/search.json`;
|
|
17
|
+
if (!authToken) {
|
|
18
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
19
|
+
}
|
|
20
|
+
// Build search query parameters
|
|
21
|
+
const queryParams = new URLSearchParams();
|
|
22
|
+
queryParams.append("query", `type:${objectType} ${query}`);
|
|
23
|
+
queryParams.append("per_page", limit.toString());
|
|
24
|
+
const response = yield axiosClient.get(`${url}?${queryParams.toString()}`, {
|
|
25
|
+
headers: {
|
|
26
|
+
"Content-Type": "application/json",
|
|
27
|
+
Authorization: `Bearer ${authToken}`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
results: response.data.results,
|
|
32
|
+
count: response.data.count,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
export default searchZendeskByQuery;
|
|
@@ -7,3 +7,4 @@ export declare class ApiError extends Error {
|
|
|
7
7
|
export declare function isAxiosTimeoutError(error: unknown): boolean;
|
|
8
8
|
export declare const axiosClient: AxiosInstance;
|
|
9
9
|
export declare function createAxiosClientWithTimeout(timeout: number): AxiosInstance;
|
|
10
|
+
export declare const axiosClientWithRetries: AxiosInstance;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import axiosRetry from "axios-retry";
|
|
2
3
|
export class ApiError extends Error {
|
|
3
4
|
constructor(message, status, data) {
|
|
4
5
|
super(message);
|
|
@@ -44,3 +45,18 @@ export const axiosClient = createAxiosClient();
|
|
|
44
45
|
export function createAxiosClientWithTimeout(timeout) {
|
|
45
46
|
return createAxiosClient(timeout);
|
|
46
47
|
}
|
|
48
|
+
function createAxiosClientWithRetries(timeout) {
|
|
49
|
+
const instance = createAxiosClient(timeout);
|
|
50
|
+
axiosRetry(instance, {
|
|
51
|
+
retries: 3,
|
|
52
|
+
retryDelay: axiosRetry.exponentialDelay,
|
|
53
|
+
retryCondition: error => {
|
|
54
|
+
if (axiosRetry.isNetworkError(error) || !error.response)
|
|
55
|
+
return true;
|
|
56
|
+
const status = error.response.status;
|
|
57
|
+
return status === 408 || status === 429 || status >= 500;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
return instance;
|
|
61
|
+
}
|
|
62
|
+
export const axiosClientWithRetries = createAxiosClientWithRetries();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credal/actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.68",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Actions by Credal AI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@slack/web-api": "^7.8.0",
|
|
55
55
|
"@types/snowflake-sdk": "^1.6.24",
|
|
56
56
|
"ajv": "^8.17.1",
|
|
57
|
+
"axios-retry": "^4.5.0",
|
|
57
58
|
"date-fns": "^4.1.0",
|
|
58
59
|
"docx": "^9.3.0",
|
|
59
60
|
"dotenv": "^16.4.7",
|