@credal/actions 0.2.108 → 0.2.109
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/autogen/templates.js +43 -1
- package/dist/actions/autogen/types.d.ts +38 -0
- package/dist/actions/autogen/types.js +17 -0
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.d.ts +1 -0
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +48 -4
- package/dist/actions/providers/zendesk/addCommentToTicket.js +2 -1
- package/dist/actions/providers/zendesk/assignTicket.js +2 -1
- package/dist/actions/providers/zendesk/createZendeskTicket.js +2 -1
- package/dist/actions/providers/zendesk/getTicketDetails.js +3 -2
- package/dist/actions/providers/zendesk/listTickets.js +2 -1
- package/dist/actions/providers/zendesk/searchZendeskByQuery.js +2 -1
- package/dist/actions/providers/zendesk/updateTicketStatus.js +2 -1
- package/dist/actions/util/axiosClient.d.ts +4 -1
- package/dist/actions/util/axiosClient.js +7 -3
- package/package.json +1 -1
|
@@ -4447,7 +4447,7 @@ export const googleOauthUpdateDocDefinition = {
|
|
|
4447
4447
|
provider: "googleOauth",
|
|
4448
4448
|
};
|
|
4449
4449
|
export const googleOauthScheduleCalendarMeetingDefinition = {
|
|
4450
|
-
description: "Schedule a meeting on google calendar using OAuth authentication",
|
|
4450
|
+
description: "Schedule a meeting on google calendar using OAuth authentication. Supports both one-time and recurring meetings.",
|
|
4451
4451
|
scopes: [],
|
|
4452
4452
|
parameters: {
|
|
4453
4453
|
type: "object",
|
|
@@ -4489,6 +4489,48 @@ export const googleOauthScheduleCalendarMeetingDefinition = {
|
|
|
4489
4489
|
type: "string",
|
|
4490
4490
|
description: "The time zone for the meeting, IANA Time Zone identifier (e.g., 'America/New_York')",
|
|
4491
4491
|
},
|
|
4492
|
+
recurrence: {
|
|
4493
|
+
type: "object",
|
|
4494
|
+
description: "Recurring meeting configuration. If not provided, creates a one-time meeting.",
|
|
4495
|
+
properties: {
|
|
4496
|
+
frequency: {
|
|
4497
|
+
type: "string",
|
|
4498
|
+
enum: ["DAILY", "WEEKLY", "MONTHLY", "YEARLY"],
|
|
4499
|
+
description: "How often the meeting repeats",
|
|
4500
|
+
},
|
|
4501
|
+
interval: {
|
|
4502
|
+
type: "integer",
|
|
4503
|
+
minimum: 1,
|
|
4504
|
+
description: "The interval between recurrences (e.g., every 2 weeks)",
|
|
4505
|
+
},
|
|
4506
|
+
count: {
|
|
4507
|
+
type: "integer",
|
|
4508
|
+
minimum: 1,
|
|
4509
|
+
description: "Number of occurrences after which to stop the recurrence",
|
|
4510
|
+
},
|
|
4511
|
+
until: {
|
|
4512
|
+
type: "string",
|
|
4513
|
+
description: "End date for the recurrence in RFC3339 format (YYYY-MM-DDTHH:MM:SSZ)",
|
|
4514
|
+
},
|
|
4515
|
+
byDay: {
|
|
4516
|
+
type: "array",
|
|
4517
|
+
description: "Days of the week when the meeting occurs (for WEEKLY frequency)",
|
|
4518
|
+
items: {
|
|
4519
|
+
type: "string",
|
|
4520
|
+
enum: ["MO", "TU", "WE", "TH", "FR", "SA", "SU"],
|
|
4521
|
+
},
|
|
4522
|
+
},
|
|
4523
|
+
byMonthDay: {
|
|
4524
|
+
type: "array",
|
|
4525
|
+
description: "Days of the month when the meeting occurs (for MONTHLY frequency)",
|
|
4526
|
+
items: {
|
|
4527
|
+
type: "integer",
|
|
4528
|
+
minimum: 1,
|
|
4529
|
+
maximum: 31,
|
|
4530
|
+
},
|
|
4531
|
+
},
|
|
4532
|
+
},
|
|
4533
|
+
},
|
|
4492
4534
|
},
|
|
4493
4535
|
},
|
|
4494
4536
|
output: {
|
|
@@ -3261,6 +3261,28 @@ export declare const googleOauthScheduleCalendarMeetingParamsSchema: z.ZodObject
|
|
|
3261
3261
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3262
3262
|
useGoogleMeet: z.ZodOptional<z.ZodBoolean>;
|
|
3263
3263
|
timeZone: z.ZodOptional<z.ZodString>;
|
|
3264
|
+
recurrence: z.ZodOptional<z.ZodObject<{
|
|
3265
|
+
frequency: z.ZodOptional<z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]>>;
|
|
3266
|
+
interval: z.ZodOptional<z.ZodNumber>;
|
|
3267
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
3268
|
+
until: z.ZodOptional<z.ZodString>;
|
|
3269
|
+
byDay: z.ZodOptional<z.ZodArray<z.ZodEnum<["MO", "TU", "WE", "TH", "FR", "SA", "SU"]>, "many">>;
|
|
3270
|
+
byMonthDay: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
3271
|
+
}, "strip", z.ZodTypeAny, {
|
|
3272
|
+
count?: number | undefined;
|
|
3273
|
+
until?: string | undefined;
|
|
3274
|
+
frequency?: "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY" | undefined;
|
|
3275
|
+
interval?: number | undefined;
|
|
3276
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
3277
|
+
byMonthDay?: number[] | undefined;
|
|
3278
|
+
}, {
|
|
3279
|
+
count?: number | undefined;
|
|
3280
|
+
until?: string | undefined;
|
|
3281
|
+
frequency?: "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY" | undefined;
|
|
3282
|
+
interval?: number | undefined;
|
|
3283
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
3284
|
+
byMonthDay?: number[] | undefined;
|
|
3285
|
+
}>>;
|
|
3264
3286
|
}, "strip", z.ZodTypeAny, {
|
|
3265
3287
|
name: string;
|
|
3266
3288
|
calendarId: string;
|
|
@@ -3270,6 +3292,14 @@ export declare const googleOauthScheduleCalendarMeetingParamsSchema: z.ZodObject
|
|
|
3270
3292
|
attendees?: string[] | undefined;
|
|
3271
3293
|
useGoogleMeet?: boolean | undefined;
|
|
3272
3294
|
timeZone?: string | undefined;
|
|
3295
|
+
recurrence?: {
|
|
3296
|
+
count?: number | undefined;
|
|
3297
|
+
until?: string | undefined;
|
|
3298
|
+
frequency?: "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY" | undefined;
|
|
3299
|
+
interval?: number | undefined;
|
|
3300
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
3301
|
+
byMonthDay?: number[] | undefined;
|
|
3302
|
+
} | undefined;
|
|
3273
3303
|
}, {
|
|
3274
3304
|
name: string;
|
|
3275
3305
|
calendarId: string;
|
|
@@ -3279,6 +3309,14 @@ export declare const googleOauthScheduleCalendarMeetingParamsSchema: z.ZodObject
|
|
|
3279
3309
|
attendees?: string[] | undefined;
|
|
3280
3310
|
useGoogleMeet?: boolean | undefined;
|
|
3281
3311
|
timeZone?: string | undefined;
|
|
3312
|
+
recurrence?: {
|
|
3313
|
+
count?: number | undefined;
|
|
3314
|
+
until?: string | undefined;
|
|
3315
|
+
frequency?: "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY" | undefined;
|
|
3316
|
+
interval?: number | undefined;
|
|
3317
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
3318
|
+
byMonthDay?: number[] | undefined;
|
|
3319
|
+
} | undefined;
|
|
3282
3320
|
}>;
|
|
3283
3321
|
export type googleOauthScheduleCalendarMeetingParamsType = z.infer<typeof googleOauthScheduleCalendarMeetingParamsSchema>;
|
|
3284
3322
|
export declare const googleOauthScheduleCalendarMeetingOutputSchema: z.ZodObject<{
|
|
@@ -1541,6 +1541,23 @@ export const googleOauthScheduleCalendarMeetingParamsSchema = z.object({
|
|
|
1541
1541
|
.string()
|
|
1542
1542
|
.describe("The time zone for the meeting, IANA Time Zone identifier (e.g., 'America/New_York')")
|
|
1543
1543
|
.optional(),
|
|
1544
|
+
recurrence: z
|
|
1545
|
+
.object({
|
|
1546
|
+
frequency: z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).describe("How often the meeting repeats").optional(),
|
|
1547
|
+
interval: z.number().int().gte(1).describe("The interval between recurrences (e.g., every 2 weeks)").optional(),
|
|
1548
|
+
count: z.number().int().gte(1).describe("Number of occurrences after which to stop the recurrence").optional(),
|
|
1549
|
+
until: z.string().describe("End date for the recurrence in RFC3339 format (YYYY-MM-DDTHH:MM:SSZ)").optional(),
|
|
1550
|
+
byDay: z
|
|
1551
|
+
.array(z.enum(["MO", "TU", "WE", "TH", "FR", "SA", "SU"]))
|
|
1552
|
+
.describe("Days of the week when the meeting occurs (for WEEKLY frequency)")
|
|
1553
|
+
.optional(),
|
|
1554
|
+
byMonthDay: z
|
|
1555
|
+
.array(z.number().int().gte(1).lte(31))
|
|
1556
|
+
.describe("Days of the month when the meeting occurs (for MONTHLY frequency)")
|
|
1557
|
+
.optional(),
|
|
1558
|
+
})
|
|
1559
|
+
.describe("Recurring meeting configuration. If not provided, creates a one-time meeting.")
|
|
1560
|
+
.optional(),
|
|
1544
1561
|
});
|
|
1545
1562
|
export const googleOauthScheduleCalendarMeetingOutputSchema = z.object({
|
|
1546
1563
|
success: z.boolean().describe("Whether the meeting was scheduled successfully"),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { googleOauthScheduleCalendarMeetingFunction } from "../../autogen/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a new Google calendar event using OAuth authentication
|
|
4
|
+
* Supports both one-time and recurring meetings
|
|
4
5
|
*/
|
|
5
6
|
declare const scheduleCalendarMeeting: googleOauthScheduleCalendarMeetingFunction;
|
|
6
7
|
export default scheduleCalendarMeeting;
|
|
@@ -11,20 +11,50 @@ import { v4 } from "uuid";
|
|
|
11
11
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
12
12
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
13
13
|
import { getDayOfWeek } from "../../../utils/datetime.js";
|
|
14
|
+
/**
|
|
15
|
+
* Generates a recurrence rule (RRULE) based on the recurrence parameters
|
|
16
|
+
*/
|
|
17
|
+
function generateRecurrenceRule(recurrence) {
|
|
18
|
+
let rrule = `RRULE:FREQ=${recurrence.frequency}`;
|
|
19
|
+
if (recurrence.interval) {
|
|
20
|
+
rrule += `;INTERVAL=${recurrence.interval}`;
|
|
21
|
+
}
|
|
22
|
+
if (recurrence.count) {
|
|
23
|
+
rrule += `;COUNT=${recurrence.count}`;
|
|
24
|
+
}
|
|
25
|
+
if (recurrence.until) {
|
|
26
|
+
const date = new Date(recurrence.until);
|
|
27
|
+
const year = date.getUTCFullYear();
|
|
28
|
+
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
|
|
29
|
+
const day = String(date.getUTCDate()).padStart(2, "0");
|
|
30
|
+
const hour = String(date.getUTCHours()).padStart(2, "0");
|
|
31
|
+
const minute = String(date.getUTCMinutes()).padStart(2, "0");
|
|
32
|
+
const second = String(date.getUTCSeconds()).padStart(2, "0");
|
|
33
|
+
rrule += `;UNTIL=${year}${month}${day}T${hour}${minute}${second}Z`; // trufflehog:ignore
|
|
34
|
+
}
|
|
35
|
+
if (recurrence.byDay && recurrence.byDay.length > 0) {
|
|
36
|
+
rrule += `;BYDAY=${recurrence.byDay.join(",")}`;
|
|
37
|
+
}
|
|
38
|
+
if (recurrence.byMonthDay && recurrence.byMonthDay.length > 0) {
|
|
39
|
+
rrule += `;BYMONTHDAY=${recurrence.byMonthDay.join(",")}`;
|
|
40
|
+
}
|
|
41
|
+
return rrule;
|
|
42
|
+
}
|
|
14
43
|
/**
|
|
15
44
|
* Creates a new Google calendar event using OAuth authentication
|
|
45
|
+
* Supports both one-time and recurring meetings
|
|
16
46
|
*/
|
|
17
47
|
const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
18
48
|
if (!authParams.authToken) {
|
|
19
49
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
20
50
|
}
|
|
21
|
-
const { calendarId, name, start, end, description, attendees, useGoogleMeet, timeZone } = params;
|
|
51
|
+
const { calendarId, name, start, end, description, attendees, useGoogleMeet, timeZone, recurrence } = params;
|
|
22
52
|
// https://developers.google.com/calendar/api/v3/reference/events/insert
|
|
23
|
-
let createEventApiUrl = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events`;
|
|
53
|
+
let createEventApiUrl = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events`;
|
|
24
54
|
const data = {
|
|
25
55
|
summary: name,
|
|
26
|
-
start: Object.assign({ dateTime: start }, (timeZone
|
|
27
|
-
end: Object.assign({ dateTime: end }, (timeZone
|
|
56
|
+
start: Object.assign({ dateTime: start }, (timeZone ? { timeZone } : { timeZone: "UTC" })),
|
|
57
|
+
end: Object.assign({ dateTime: end }, (timeZone ? { timeZone } : { timeZone: "UTC" })),
|
|
28
58
|
};
|
|
29
59
|
if (description) {
|
|
30
60
|
data.description = description;
|
|
@@ -40,6 +70,20 @@ const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
40
70
|
},
|
|
41
71
|
};
|
|
42
72
|
}
|
|
73
|
+
// Add recurrence rule if specified
|
|
74
|
+
if (recurrence) {
|
|
75
|
+
try {
|
|
76
|
+
const rrule = generateRecurrenceRule(recurrence);
|
|
77
|
+
data.recurrence = [rrule];
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error("Error generating recurrence rule", error);
|
|
81
|
+
return {
|
|
82
|
+
success: false,
|
|
83
|
+
error: "Invalid recurrence configuration: " + (error instanceof Error ? error.message : "Unknown error"),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
43
87
|
try {
|
|
44
88
|
const response = yield axiosClient.post(createEventApiUrl, data, {
|
|
45
89
|
headers: {
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const addCommentToTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken } = authParams;
|
|
@@ -16,6 +16,7 @@ const addCommentToTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
16
16
|
if (!authToken) {
|
|
17
17
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
18
18
|
}
|
|
19
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 20000, retryCount: 5 });
|
|
19
20
|
try {
|
|
20
21
|
const response = yield axiosClient.request({
|
|
21
22
|
url: url,
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken } = authParams;
|
|
@@ -16,6 +16,7 @@ const updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
16
16
|
if (!authToken) {
|
|
17
17
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
18
18
|
}
|
|
19
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
19
20
|
yield axiosClient.request({
|
|
20
21
|
url: url,
|
|
21
22
|
method: "PUT",
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken } = authParams;
|
|
@@ -24,6 +24,7 @@ const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
24
24
|
if (!authToken) {
|
|
25
25
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
26
26
|
}
|
|
27
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
27
28
|
const response = yield axiosClient.post(url, payload, {
|
|
28
29
|
headers: {
|
|
29
30
|
"Content-Type": "application/json",
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const getZendeskTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken } = authParams;
|
|
@@ -16,7 +16,8 @@ const getZendeskTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
16
16
|
if (!authToken) {
|
|
17
17
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
20
|
+
const response = yield axiosClient.request({
|
|
20
21
|
url: url,
|
|
21
22
|
method: "GET",
|
|
22
23
|
headers: {
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const listZendeskTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken } = authParams;
|
|
@@ -21,6 +21,7 @@ const listZendeskTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
21
21
|
if (!authToken) {
|
|
22
22
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
23
23
|
}
|
|
24
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
24
25
|
// Add query parameters for filtering
|
|
25
26
|
const queryParams = new URLSearchParams();
|
|
26
27
|
queryParams.append("created_after", formattedDate);
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const searchZendeskByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken } = authParams;
|
|
@@ -17,6 +17,7 @@ const searchZendeskByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
17
17
|
if (!authToken) {
|
|
18
18
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
19
19
|
}
|
|
20
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
20
21
|
// Build search query parameters
|
|
21
22
|
const queryParams = new URLSearchParams();
|
|
22
23
|
queryParams.append("query", `type:${objectType} ${query}`);
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken } = authParams;
|
|
@@ -16,6 +16,7 @@ const updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
16
16
|
if (!authToken) {
|
|
17
17
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
18
18
|
}
|
|
19
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
19
20
|
yield axiosClient.request({
|
|
20
21
|
url: url,
|
|
21
22
|
method: "PUT",
|
|
@@ -7,4 +7,7 @@ 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
|
|
10
|
+
export declare function createAxiosClientWithRetries(args: {
|
|
11
|
+
timeout: number;
|
|
12
|
+
retryCount: number;
|
|
13
|
+
}): AxiosInstance;
|
|
@@ -45,10 +45,11 @@ export const axiosClient = createAxiosClient();
|
|
|
45
45
|
export function createAxiosClientWithTimeout(timeout) {
|
|
46
46
|
return createAxiosClient(timeout);
|
|
47
47
|
}
|
|
48
|
-
function createAxiosClientWithRetries(
|
|
48
|
+
export function createAxiosClientWithRetries(args) {
|
|
49
|
+
const { timeout, retryCount } = args;
|
|
49
50
|
const instance = createAxiosClient(timeout);
|
|
50
51
|
axiosRetry(instance, {
|
|
51
|
-
retries:
|
|
52
|
+
retries: retryCount,
|
|
52
53
|
retryDelay: axiosRetry.exponentialDelay,
|
|
53
54
|
retryCondition: error => {
|
|
54
55
|
if (axiosRetry.isNetworkError(error) || !error.response)
|
|
@@ -56,7 +57,10 @@ function createAxiosClientWithRetries(timeout) {
|
|
|
56
57
|
const status = error.response.status;
|
|
57
58
|
return status === 408 || status === 429 || status >= 500;
|
|
58
59
|
},
|
|
60
|
+
onRetry: (retryCount, error) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
console.log(`Retry ${retryCount}: ${((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) || "Network Error"} - ${(_b = error.config) === null || _b === void 0 ? void 0 : _b.url}`);
|
|
63
|
+
},
|
|
59
64
|
});
|
|
60
65
|
return instance;
|
|
61
66
|
}
|
|
62
|
-
export const axiosClientWithRetries = createAxiosClientWithRetries();
|