@credal/actions 0.2.128 → 0.2.129
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 +20 -1
- package/dist/actions/autogen/types.d.ts +25 -2
- package/dist/actions/autogen/types.js +7 -0
- package/dist/actions/groups.d.ts +6 -0
- package/dist/actions/groups.js +261 -0
- package/dist/actions/providers/confluence/updatePage.d.ts +3 -0
- package/dist/actions/providers/confluence/updatePage.js +47 -0
- package/dist/actions/providers/credal/callCopilot.d.ts +3 -0
- package/dist/actions/providers/credal/callCopilot.js +36 -0
- package/dist/actions/providers/jamf/types.d.ts +8 -0
- package/dist/actions/providers/jamf/types.js +7 -0
- package/dist/actions/providers/math/index.d.ts +1 -0
- package/dist/actions/providers/math/index.js +37 -0
- package/dist/actions/providers/slack/archiveChannel.d.ts +3 -0
- package/dist/actions/providers/slack/archiveChannel.js +42 -0
- package/dist/actions/providers/slack/index.d.ts +1 -0
- package/dist/actions/providers/slack/index.js +37 -0
- package/dist/actions/providers/slack/listConversations.d.ts +3 -0
- package/dist/actions/providers/slack/listConversations.js +41 -0
- package/dist/actions/providers/slackUser/searchSlack.js +73 -7
- package/package.json +1 -1
- package/dist/actions/providers/jira/updateServiceDeskRequest.d.ts +0 -3
- package/dist/actions/providers/jira/updateServiceDeskRequest.js +0 -72
|
@@ -771,7 +771,7 @@ export const slackUserSearchSlackDefinition = {
|
|
|
771
771
|
},
|
|
772
772
|
output: {
|
|
773
773
|
type: "object",
|
|
774
|
-
required: ["query", "results"],
|
|
774
|
+
required: ["query", "results", "currentUser"],
|
|
775
775
|
properties: {
|
|
776
776
|
query: {
|
|
777
777
|
type: "string",
|
|
@@ -851,6 +851,25 @@ export const slackUserSearchSlackDefinition = {
|
|
|
851
851
|
},
|
|
852
852
|
},
|
|
853
853
|
},
|
|
854
|
+
currentUser: {
|
|
855
|
+
type: "object",
|
|
856
|
+
required: ["userId"],
|
|
857
|
+
description: "The current user who's running the search",
|
|
858
|
+
properties: {
|
|
859
|
+
userId: {
|
|
860
|
+
type: "string",
|
|
861
|
+
description: "The ID of the current user",
|
|
862
|
+
},
|
|
863
|
+
userName: {
|
|
864
|
+
type: "string",
|
|
865
|
+
description: "The name of the current user",
|
|
866
|
+
},
|
|
867
|
+
userEmail: {
|
|
868
|
+
type: "string",
|
|
869
|
+
description: "The email of the current user",
|
|
870
|
+
},
|
|
871
|
+
},
|
|
872
|
+
},
|
|
854
873
|
},
|
|
855
874
|
},
|
|
856
875
|
name: "searchSlack",
|
|
@@ -973,6 +973,19 @@ export declare const slackUserSearchSlackOutputSchema: z.ZodObject<{
|
|
|
973
973
|
}[] | undefined;
|
|
974
974
|
};
|
|
975
975
|
}>, "many">;
|
|
976
|
+
currentUser: z.ZodObject<{
|
|
977
|
+
userId: z.ZodString;
|
|
978
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
979
|
+
userEmail: z.ZodOptional<z.ZodString>;
|
|
980
|
+
}, "strip", z.ZodTypeAny, {
|
|
981
|
+
userId: string;
|
|
982
|
+
userEmail?: string | undefined;
|
|
983
|
+
userName?: string | undefined;
|
|
984
|
+
}, {
|
|
985
|
+
userId: string;
|
|
986
|
+
userEmail?: string | undefined;
|
|
987
|
+
userName?: string | undefined;
|
|
988
|
+
}>;
|
|
976
989
|
}, "strip", z.ZodTypeAny, {
|
|
977
990
|
query: string;
|
|
978
991
|
results: {
|
|
@@ -993,6 +1006,11 @@ export declare const slackUserSearchSlackOutputSchema: z.ZodObject<{
|
|
|
993
1006
|
}[] | undefined;
|
|
994
1007
|
};
|
|
995
1008
|
}[];
|
|
1009
|
+
currentUser: {
|
|
1010
|
+
userId: string;
|
|
1011
|
+
userEmail?: string | undefined;
|
|
1012
|
+
userName?: string | undefined;
|
|
1013
|
+
};
|
|
996
1014
|
}, {
|
|
997
1015
|
query: string;
|
|
998
1016
|
results: {
|
|
@@ -1013,6 +1031,11 @@ export declare const slackUserSearchSlackOutputSchema: z.ZodObject<{
|
|
|
1013
1031
|
}[] | undefined;
|
|
1014
1032
|
};
|
|
1015
1033
|
}[];
|
|
1034
|
+
currentUser: {
|
|
1035
|
+
userId: string;
|
|
1036
|
+
userEmail?: string | undefined;
|
|
1037
|
+
userName?: string | undefined;
|
|
1038
|
+
};
|
|
1016
1039
|
}>;
|
|
1017
1040
|
export type slackUserSearchSlackOutputType = z.infer<typeof slackUserSearchSlackOutputSchema>;
|
|
1018
1041
|
export type slackUserSearchSlackFunction = ActionFunction<slackUserSearchSlackParamsType, AuthParamsType, slackUserSearchSlackOutputType>;
|
|
@@ -6267,12 +6290,12 @@ export declare const oktaResetPasswordParamsSchema: z.ZodObject<{
|
|
|
6267
6290
|
sendEmail: z.ZodBoolean;
|
|
6268
6291
|
revokeSessions: z.ZodOptional<z.ZodBoolean>;
|
|
6269
6292
|
}, "strip", z.ZodTypeAny, {
|
|
6270
|
-
sendEmail: boolean;
|
|
6271
6293
|
userId: string;
|
|
6294
|
+
sendEmail: boolean;
|
|
6272
6295
|
revokeSessions?: boolean | undefined;
|
|
6273
6296
|
}, {
|
|
6274
|
-
sendEmail: boolean;
|
|
6275
6297
|
userId: string;
|
|
6298
|
+
sendEmail: boolean;
|
|
6276
6299
|
revokeSessions?: boolean | undefined;
|
|
6277
6300
|
}>;
|
|
6278
6301
|
export type oktaResetPasswordParamsType = z.infer<typeof oktaResetPasswordParamsSchema>;
|
|
@@ -323,6 +323,13 @@ export const slackUserSearchSlackOutputSchema = z.object({
|
|
|
323
323
|
}),
|
|
324
324
|
}))
|
|
325
325
|
.describe("Hydrated search results (threads or small context windows), sorted by ts desc."),
|
|
326
|
+
currentUser: z
|
|
327
|
+
.object({
|
|
328
|
+
userId: z.string().describe("The ID of the current user"),
|
|
329
|
+
userName: z.string().describe("The name of the current user").optional(),
|
|
330
|
+
userEmail: z.string().describe("The email of the current user").optional(),
|
|
331
|
+
})
|
|
332
|
+
.describe("The current user who's running the search"),
|
|
326
333
|
});
|
|
327
334
|
export const mathAddParamsSchema = z.object({
|
|
328
335
|
a: z.number().describe("The first number to add"),
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, 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, linearGetIssueDetailsDefinition, linearGetProjectsDefinition, linearGetProjectDetailsDefinition, linearGetTeamDetailsDefinition, linearGetTeamsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, googleOauthSearchDriveByQueryAndGetFileContentDefinition, githubGetFileContentDefinition, githubListDirectoryDefinition, } 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: [
|
|
21
|
+
slackSendMessageDefinition,
|
|
22
|
+
slackGetChannelMessagesDefinition,
|
|
23
|
+
slackCreateChannelDefinition,
|
|
24
|
+
slackArchiveChannelDefinition,
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
CONFLUENCE: {
|
|
28
|
+
description: "Action for interacting with Confluence",
|
|
29
|
+
actions: [confluenceOverwritePageDefinition, confluenceFetchPageContentDefinition],
|
|
30
|
+
},
|
|
31
|
+
MATH_ADD: {
|
|
32
|
+
description: "Action for adding two numbers",
|
|
33
|
+
actions: [mathAddDefinition],
|
|
34
|
+
},
|
|
35
|
+
GOOGLE_MAPS: {
|
|
36
|
+
description: "Action for interacting with Google Maps",
|
|
37
|
+
actions: [googlemapsValidateAddressDefinition, googlemapsNearbysearchRestaurantsDefinition],
|
|
38
|
+
},
|
|
39
|
+
GOOGLE_DRIVE: {
|
|
40
|
+
description: "Action for interacting with Google Drive",
|
|
41
|
+
actions: [
|
|
42
|
+
googleOauthCreateNewGoogleDocDefinition,
|
|
43
|
+
googleOauthUpdateDocDefinition,
|
|
44
|
+
googleOauthCreateSpreadsheetDefinition,
|
|
45
|
+
googleOauthUpdateSpreadsheetDefinition,
|
|
46
|
+
googleOauthCreatePresentationDefinition,
|
|
47
|
+
googleOauthUpdatePresentationDefinition,
|
|
48
|
+
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
|
+
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
+
googleOauthSearchDriveByQueryAndGetFileContentDefinition,
|
|
51
|
+
googleOauthGetDriveFileContentByIdDefinition,
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
GOOGLE_CALENDAR: {
|
|
55
|
+
description: "Actions for interacting with Google Calendar",
|
|
56
|
+
actions: [
|
|
57
|
+
googleOauthScheduleCalendarMeetingDefinition,
|
|
58
|
+
googleOauthListCalendarsDefinition,
|
|
59
|
+
googleOauthListCalendarEventsDefinition,
|
|
60
|
+
googleOauthUpdateCalendarEventDefinition,
|
|
61
|
+
googleOauthDeleteCalendarEventDefinition,
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
GMAIL: {
|
|
65
|
+
description: "Actions for interacting with Gmail",
|
|
66
|
+
actions: [googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition],
|
|
67
|
+
},
|
|
68
|
+
LINKEDIN_SHARE_POST: {
|
|
69
|
+
description: "Action for creating a share post url on linkedin",
|
|
70
|
+
actions: [linkedinCreateShareLinkedinPostUrlDefinition],
|
|
71
|
+
},
|
|
72
|
+
ZENDESK_ACTIONS: {
|
|
73
|
+
description: "Actions for interacting with Zendesk",
|
|
74
|
+
actions: [
|
|
75
|
+
zendeskCreateZendeskTicketDefinition,
|
|
76
|
+
zendeskListZendeskTicketsDefinition,
|
|
77
|
+
zendeskGetTicketDetailsDefinition,
|
|
78
|
+
zendeskUpdateTicketStatusDefinition,
|
|
79
|
+
zendeskAddCommentToTicketDefinition,
|
|
80
|
+
zendeskAssignTicketDefinition,
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
BING_SEARCH: {
|
|
84
|
+
description: "Action for searching Bing",
|
|
85
|
+
actions: [bingGetTopNSearchResultUrlsDefinition],
|
|
86
|
+
},
|
|
87
|
+
MONGO_INSERT_DOC: {
|
|
88
|
+
description: "Action for inserting a document into a MongoDB collection",
|
|
89
|
+
actions: [mongoInsertMongoDocDefinition],
|
|
90
|
+
},
|
|
91
|
+
SNOWFLAKE_ACTIONS: {
|
|
92
|
+
description: "Action for getting content from a Snowflake table",
|
|
93
|
+
actions: [snowflakeGetRowByFieldValueDefinition, snowflakeRunSnowflakeQueryDefinition],
|
|
94
|
+
},
|
|
95
|
+
JIRA_ACTIONS: {
|
|
96
|
+
description: "Action for interacting with Jira tickets",
|
|
97
|
+
actions: [
|
|
98
|
+
jiraAssignJiraTicketDefinition,
|
|
99
|
+
jiraCreateJiraTicketDefinition,
|
|
100
|
+
jiraCommentJiraTicketDefinition,
|
|
101
|
+
jiraGetJiraTicketDetailsDefinition,
|
|
102
|
+
jiraGetJiraTicketHistoryDefinition,
|
|
103
|
+
jiraUpdateJiraTicketDetailsDefinition,
|
|
104
|
+
jiraUpdateJiraTicketStatusDefinition,
|
|
105
|
+
jiraGetJiraIssuesByQueryDefinition,
|
|
106
|
+
jiraGetServiceDesksDefinition,
|
|
107
|
+
jiraCreateServiceDeskRequestDefinition,
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
JIRA_ORG_ACTIONS: {
|
|
111
|
+
description: "Action for interacting with Jira tickets",
|
|
112
|
+
actions: [
|
|
113
|
+
jiraOrgAssignJiraTicketDefinition,
|
|
114
|
+
jiraOrgCreateJiraTicketDefinition,
|
|
115
|
+
jiraOrgCommentJiraTicketDefinition,
|
|
116
|
+
jiraOrgGetJiraTicketDetailsDefinition,
|
|
117
|
+
jiraOrgGetJiraTicketHistoryDefinition,
|
|
118
|
+
jiraOrgUpdateJiraTicketDetailsDefinition,
|
|
119
|
+
jiraOrgUpdateJiraTicketStatusDefinition,
|
|
120
|
+
jiraOrgGetJiraIssuesByQueryDefinition,
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
OPENSTREETMAP_GET_LATITUDE_LONGITUDE_FROM_LOCATION: {
|
|
124
|
+
description: "Action for getting the latitude and longitude of a location",
|
|
125
|
+
actions: [openstreetmapGetLatitudeLongitudeFromLocationDefinition],
|
|
126
|
+
},
|
|
127
|
+
NWS_GET_FORECAST_FOR_LOCATION: {
|
|
128
|
+
description: "Action for getting the weather forecast for a location",
|
|
129
|
+
actions: [nwsGetForecastForLocationDefinition],
|
|
130
|
+
},
|
|
131
|
+
FIRECRAWL: {
|
|
132
|
+
description: "Actions for interacting with Firecrawl",
|
|
133
|
+
actions: [
|
|
134
|
+
firecrawlScrapeUrlDefinition,
|
|
135
|
+
firecrawlScrapeTweetDataWithNitterDefinition,
|
|
136
|
+
firecrawlDeepResearchDefinition,
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
RESEND: {
|
|
140
|
+
description: "Action for sending an email",
|
|
141
|
+
actions: [resendSendEmailDefinition],
|
|
142
|
+
},
|
|
143
|
+
X: {
|
|
144
|
+
description: "Actions for interacting with X(formerly twitter)",
|
|
145
|
+
actions: [xCreateShareXPostUrlDefinition],
|
|
146
|
+
},
|
|
147
|
+
GONG: {
|
|
148
|
+
description: "Actions for interacting with Gong",
|
|
149
|
+
actions: [gongGetGongTranscriptsDefinition],
|
|
150
|
+
},
|
|
151
|
+
FINNHUB: {
|
|
152
|
+
description: "Action for interacting with Finnhub for stock market data",
|
|
153
|
+
actions: [finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition],
|
|
154
|
+
},
|
|
155
|
+
JAMF: {
|
|
156
|
+
description: "Actions for interacting with Jamf",
|
|
157
|
+
actions: [
|
|
158
|
+
jamfGetJamfComputerInventoryDefinition,
|
|
159
|
+
jamfGetJamfFileVaultRecoveryKeyDefinition,
|
|
160
|
+
jamfGetJamfUserComputerIdDefinition,
|
|
161
|
+
jamfLockJamfComputerByIdDefinition,
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
LOOKER: {
|
|
165
|
+
description: "Actions for interacting with Looker",
|
|
166
|
+
actions: [lookerEnableUserByEmailDefinition],
|
|
167
|
+
},
|
|
168
|
+
SALESFORCE: {
|
|
169
|
+
description: "Actions for interacting with Salesforce",
|
|
170
|
+
actions: [
|
|
171
|
+
salesforceUpdateRecordDefinition,
|
|
172
|
+
salesforceCreateRecordDefinition,
|
|
173
|
+
salesforceCreateCaseDefinition,
|
|
174
|
+
salesforceGenerateSalesReportDefinition,
|
|
175
|
+
salesforceGetRecordDefinition,
|
|
176
|
+
salesforceGetSalesforceRecordsByQueryDefinition,
|
|
177
|
+
salesforceFetchSalesforceSchemaByObjectDefinition,
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
MICROSOFT: {
|
|
181
|
+
description: "Actions for interacting with Microsoft 365",
|
|
182
|
+
actions: [
|
|
183
|
+
microsoftMessageTeamsChatDefinition,
|
|
184
|
+
microsoftMessageTeamsChannelDefinition,
|
|
185
|
+
microsoftUpdateSpreadsheetDefinition,
|
|
186
|
+
microsoftUpdateDocumentDefinition,
|
|
187
|
+
microsoftCreateDocumentDefinition,
|
|
188
|
+
microsoftGetDocumentDefinition,
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
KANDJI: {
|
|
192
|
+
description: "Actions for interacting with Kandji",
|
|
193
|
+
actions: [kandjiGetFVRecoveryKeyForDeviceDefinition],
|
|
194
|
+
},
|
|
195
|
+
GITHUB: {
|
|
196
|
+
description: "Actions for interacting with GitHub",
|
|
197
|
+
actions: [
|
|
198
|
+
githubCreateOrUpdateFileDefinition,
|
|
199
|
+
githubCreateBranchDefinition,
|
|
200
|
+
githubCreatePullRequestDefinition,
|
|
201
|
+
githubListPullRequestsDefinition,
|
|
202
|
+
githubGetFileContentDefinition,
|
|
203
|
+
githubListDirectoryDefinition,
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
ASHBY: {
|
|
207
|
+
description: "Actions for interacting with Ashby",
|
|
208
|
+
actions: [
|
|
209
|
+
ashbyCreateNoteDefinition,
|
|
210
|
+
ashbyGetCandidateInfoDefinition,
|
|
211
|
+
ashbyListCandidatesDefinition,
|
|
212
|
+
ashbyListCandidateNotesDefinition,
|
|
213
|
+
ashbySearchCandidatesDefinition,
|
|
214
|
+
ashbyCreateCandidateDefinition,
|
|
215
|
+
ashbyUpdateCandidateDefinition,
|
|
216
|
+
ashbyAddCandidateToProjectDefinition,
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
NOTION: {
|
|
220
|
+
description: "Actions for interacting with Notion",
|
|
221
|
+
actions: [notionSearchByTitleDefinition],
|
|
222
|
+
},
|
|
223
|
+
GOOGLE_GROUPS: {
|
|
224
|
+
description: "Google Workspace Groups management actions",
|
|
225
|
+
actions: [
|
|
226
|
+
googleOauthListGroupsDefinition,
|
|
227
|
+
googleOauthGetGroupDefinition,
|
|
228
|
+
googleOauthListGroupMembersDefinition,
|
|
229
|
+
googleOauthHasGroupMemberDefinition,
|
|
230
|
+
googleOauthAddGroupMemberDefinition,
|
|
231
|
+
googleOauthDeleteGroupMemberDefinition,
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
OKTA: {
|
|
235
|
+
description: "Actions for interacting with Okta",
|
|
236
|
+
actions: [
|
|
237
|
+
oktaListOktaUsersDefinition,
|
|
238
|
+
oktaGetOktaUserDefinition,
|
|
239
|
+
oktaListOktaUserGroupsDefinition,
|
|
240
|
+
oktaListOktaGroupsDefinition,
|
|
241
|
+
oktaGetOktaGroupDefinition,
|
|
242
|
+
oktaListOktaGroupMembersDefinition,
|
|
243
|
+
oktaRemoveUserFromGroupDefinition,
|
|
244
|
+
oktaAddUserToGroupDefinition,
|
|
245
|
+
oktaResetPasswordDefinition,
|
|
246
|
+
oktaResetMFADefinition,
|
|
247
|
+
oktaListMFADefinition,
|
|
248
|
+
oktaTriggerOktaWorkflowDefinition,
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
LINEAR: {
|
|
252
|
+
description: "Actions for interacting with Linear",
|
|
253
|
+
actions: [
|
|
254
|
+
linearGetIssueDetailsDefinition,
|
|
255
|
+
linearGetProjectsDefinition,
|
|
256
|
+
linearGetProjectDetailsDefinition,
|
|
257
|
+
linearGetTeamDetailsDefinition,
|
|
258
|
+
linearGetTeamsDefinition,
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
function getConfluenceApi(baseUrl, username, apiToken) {
|
|
17
|
+
const api = axios_1.default.create({
|
|
18
|
+
baseURL: baseUrl,
|
|
19
|
+
headers: {
|
|
20
|
+
Accept: "application/json",
|
|
21
|
+
// Tokens are associated with a specific user.
|
|
22
|
+
Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return api;
|
|
26
|
+
}
|
|
27
|
+
const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
28
|
+
const { pageId, username, content, title } = params;
|
|
29
|
+
const { baseUrl, authToken } = authParams;
|
|
30
|
+
const api = getConfluenceApi(baseUrl, username, authToken);
|
|
31
|
+
// Get current version number
|
|
32
|
+
const response = yield api.get(`/api/v2/pages/${pageId}`);
|
|
33
|
+
const currVersion = response.data.version.number;
|
|
34
|
+
yield api.put(`/api/v2/pages/${pageId}`, {
|
|
35
|
+
id: pageId,
|
|
36
|
+
status: "current",
|
|
37
|
+
title,
|
|
38
|
+
body: {
|
|
39
|
+
representation: "storage",
|
|
40
|
+
value: content,
|
|
41
|
+
},
|
|
42
|
+
version: {
|
|
43
|
+
number: currVersion + 1,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
exports.default = confluenceUpdatePage;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const sdk_1 = require("@credal/sdk");
|
|
13
|
+
const callCopilot = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
+
var _b;
|
|
15
|
+
const requestBody = {
|
|
16
|
+
agentId: params.agentId,
|
|
17
|
+
query: params.query,
|
|
18
|
+
userEmail: params.userEmail,
|
|
19
|
+
};
|
|
20
|
+
const baseUrl = (_b = authParams.baseUrl) !== null && _b !== void 0 ? _b : "https://app.credal.ai/api";
|
|
21
|
+
const client = new sdk_1.CredalClient({ environment: baseUrl, apiKey: authParams.apiKey });
|
|
22
|
+
const response = yield client.copilots.sendMessage({
|
|
23
|
+
agentId: requestBody.agentId,
|
|
24
|
+
message: requestBody.query,
|
|
25
|
+
userEmail: requestBody.userEmail,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
response: response.sendChatResult.type === "ai_response_result"
|
|
29
|
+
? response.sendChatResult.response.message
|
|
30
|
+
: "Error getting response",
|
|
31
|
+
referencedSources: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.referencedSources : [],
|
|
32
|
+
sourcesInDataContext: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.sourcesInDataContext : [],
|
|
33
|
+
webSearchResults: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.webSearchResults : [],
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
exports.default = callCopilot;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as add from "./add";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.add = void 0;
|
|
37
|
+
exports.add = __importStar(require("./add"));
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
import { getSlackChannels } from "./helpers.js";
|
|
13
|
+
const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
+
if (!authParams.authToken) {
|
|
15
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const client = new WebClient(authParams.authToken);
|
|
19
|
+
const { channelName } = params;
|
|
20
|
+
const allChannels = yield getSlackChannels(client);
|
|
21
|
+
const channel = allChannels.find(channel => channel.name == channelName);
|
|
22
|
+
if (!channel || !channel.id) {
|
|
23
|
+
throw Error(`Channel with name ${channelName} not found`);
|
|
24
|
+
}
|
|
25
|
+
yield client.conversations.join({ channel: channel.id });
|
|
26
|
+
const result = yield client.conversations.archive({ channel: channel.id });
|
|
27
|
+
if (!result.ok) {
|
|
28
|
+
return {
|
|
29
|
+
success: false,
|
|
30
|
+
error: result.error || "Unknown error archiving channel",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return { success: true };
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
error: error instanceof Error ? error.message : "Unknown error archiving channel",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export default archiveChannel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as listConversations from "./listConversations";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.listConversations = void 0;
|
|
37
|
+
exports.listConversations = __importStar(require("./listConversations"));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const web_api_1 = require("@slack/web-api");
|
|
13
|
+
const helpers_1 = require("./helpers");
|
|
14
|
+
const slackListConversations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
|
15
|
+
const client = new web_api_1.WebClient(authParams.authToken);
|
|
16
|
+
try {
|
|
17
|
+
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
|
18
|
+
const filteredChannels = [];
|
|
19
|
+
for (const channel of allChannels) {
|
|
20
|
+
if (channel.name && channel.topic && channel.topic.value && channel.purpose && channel.purpose.value) {
|
|
21
|
+
const purpose = channel.purpose.value;
|
|
22
|
+
const topic = channel.topic.value;
|
|
23
|
+
const name = channel.name;
|
|
24
|
+
filteredChannels.push(Object.assign(Object.assign({}, channel), { purpose, topic, name }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
channels: filteredChannels,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error instanceof Error) {
|
|
33
|
+
// Enhance error with more context
|
|
34
|
+
throw new Error(`Failed to list Slack conversations: ${error.message}`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
exports.default = slackListConversations;
|
|
@@ -12,6 +12,10 @@ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
|
12
12
|
import pLimit from "p-limit";
|
|
13
13
|
const HIT_ENRICH_POOL = 5;
|
|
14
14
|
const limitHit = pLimit(HIT_ENRICH_POOL);
|
|
15
|
+
const MENTION_USER_RE = /<@([UW][A-Z0-9]+)(?:\|[^>]+)?>/g;
|
|
16
|
+
const MENTION_CHANNEL_RE = /<#(C[A-Z0-9]+)(?:\|[^>]+)?>/g;
|
|
17
|
+
const SPECIAL_RE = /<!(channel|here|everyone)>/g;
|
|
18
|
+
const SUBTEAM_RE = /<!subteam\^([A-Z0-9]+)(?:\|[^>]+)?>/g; // user group
|
|
15
19
|
class SlackUserCache {
|
|
16
20
|
constructor(client) {
|
|
17
21
|
this.client = client;
|
|
@@ -171,11 +175,17 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
171
175
|
const slackUserCache = new SlackUserCache(client);
|
|
172
176
|
const { emails, channel, topic, timeRange, limit } = params;
|
|
173
177
|
const parts = [];
|
|
178
|
+
const { user_id: myUserId } = yield client.auth.test();
|
|
179
|
+
if (!myUserId)
|
|
180
|
+
throw new Error("Failed to get my user ID.");
|
|
181
|
+
const me = yield slackUserCache.get(myUserId);
|
|
182
|
+
const currentUser = {
|
|
183
|
+
userId: myUserId,
|
|
184
|
+
userName: me === null || me === void 0 ? void 0 : me.name,
|
|
185
|
+
userEmail: me === null || me === void 0 ? void 0 : me.email,
|
|
186
|
+
};
|
|
174
187
|
if (emails === null || emails === void 0 ? void 0 : emails.length) {
|
|
175
188
|
const userIds = yield lookupUserIdsByEmail(client, emails, slackUserCache);
|
|
176
|
-
const { user_id: myUserId } = yield client.auth.test();
|
|
177
|
-
if (!myUserId)
|
|
178
|
-
throw new Error("Failed to get my user ID.");
|
|
179
189
|
const userIdsWithoutMe = userIds.filter(id => id !== myUserId);
|
|
180
190
|
if (userIdsWithoutMe.length === 0)
|
|
181
191
|
throw new Error("No users resolved from emails.");
|
|
@@ -204,10 +214,11 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
204
214
|
const hitsPromises = matches.slice(0, limit).map((m) => __awaiter(void 0, void 0, void 0, function* () {
|
|
205
215
|
var _a, _b, _c, _d;
|
|
206
216
|
const user = m.user ? yield slackUserCache.get(m.user) : undefined;
|
|
217
|
+
const prettyText = m.text ? yield expandSlackEntities(client, slackUserCache, m.text) : undefined;
|
|
207
218
|
return {
|
|
208
219
|
channelId: ((_a = m.channel) === null || _a === void 0 ? void 0 : _a.id) || ((_b = m.channel) === null || _b === void 0 ? void 0 : _b.name) || "",
|
|
209
220
|
ts: m.ts,
|
|
210
|
-
text:
|
|
221
|
+
text: prettyText,
|
|
211
222
|
userEmail: (_c = user === null || user === void 0 ? void 0 : user.email) !== null && _c !== void 0 ? _c : undefined,
|
|
212
223
|
userName: (_d = user === null || user === void 0 ? void 0 : user.name) !== null && _d !== void 0 ? _d : undefined,
|
|
213
224
|
};
|
|
@@ -231,19 +242,22 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
231
242
|
.map((t) => __awaiter(void 0, void 0, void 0, function* () {
|
|
232
243
|
var _a, _b;
|
|
233
244
|
const user = t.user ? yield slackUserCache.get(t.user) : undefined;
|
|
245
|
+
const prettyText = t.text ? yield expandSlackEntities(client, slackUserCache, t.text) : undefined;
|
|
234
246
|
return {
|
|
235
247
|
ts: t.ts,
|
|
236
|
-
text:
|
|
248
|
+
text: prettyText,
|
|
237
249
|
userEmail: (_a = user === null || user === void 0 ? void 0 : user.email) !== null && _a !== void 0 ? _a : undefined,
|
|
238
250
|
userName: (_b = user === null || user === void 0 ? void 0 : user.name) !== null && _b !== void 0 ? _b : undefined,
|
|
239
251
|
};
|
|
240
252
|
}));
|
|
241
253
|
const context = yield Promise.all(contextPromises);
|
|
242
254
|
const user = anchor.user ? yield slackUserCache.get(anchor.user) : undefined;
|
|
255
|
+
const textResponse = (_a = anchor.text) !== null && _a !== void 0 ? _a : h.text;
|
|
256
|
+
const prettyText = textResponse ? yield expandSlackEntities(client, slackUserCache, textResponse) : undefined;
|
|
243
257
|
return {
|
|
244
258
|
channelId: h.channelId,
|
|
245
259
|
ts: rootTs,
|
|
246
|
-
text:
|
|
260
|
+
text: prettyText,
|
|
247
261
|
userEmail: (_b = user === null || user === void 0 ? void 0 : user.email) !== null && _b !== void 0 ? _b : h.userEmail,
|
|
248
262
|
userName: (_c = user === null || user === void 0 ? void 0 : user.name) !== null && _c !== void 0 ? _c : h.userName,
|
|
249
263
|
context,
|
|
@@ -286,7 +300,7 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
286
300
|
return {
|
|
287
301
|
channelId: h.channelId,
|
|
288
302
|
ts: h.ts,
|
|
289
|
-
text: h.text,
|
|
303
|
+
text: h.text ? yield expandSlackEntities(client, slackUserCache, h.text) : undefined,
|
|
290
304
|
userEmail: h.userEmail,
|
|
291
305
|
userName: h.userName,
|
|
292
306
|
permalink: yield getPermalink(client, h.channelId, h.ts),
|
|
@@ -306,6 +320,58 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
306
320
|
url: r.permalink || "",
|
|
307
321
|
contents: r,
|
|
308
322
|
})),
|
|
323
|
+
currentUser,
|
|
309
324
|
};
|
|
310
325
|
});
|
|
326
|
+
function expandSlackEntities(client_1, cache_1, raw_1) {
|
|
327
|
+
return __awaiter(this, arguments, void 0, function* (client, cache, raw, { includeEmail = false } = {}) {
|
|
328
|
+
let text = raw;
|
|
329
|
+
// 1) Users: <@U12345> -> @Name (or @Name <email>)
|
|
330
|
+
const userIds = new Set();
|
|
331
|
+
for (const m of raw.matchAll(MENTION_USER_RE))
|
|
332
|
+
userIds.add(m[1]);
|
|
333
|
+
const idToUser = {};
|
|
334
|
+
yield Promise.all([...userIds].map((id) => __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
try {
|
|
336
|
+
const u = yield cache.get(id);
|
|
337
|
+
idToUser[id] = { name: u === null || u === void 0 ? void 0 : u.name, email: u === null || u === void 0 ? void 0 : u.email };
|
|
338
|
+
}
|
|
339
|
+
catch (_a) {
|
|
340
|
+
idToUser[id] = {};
|
|
341
|
+
}
|
|
342
|
+
})));
|
|
343
|
+
text = text.replace(MENTION_USER_RE, (_, id) => {
|
|
344
|
+
const u = idToUser[id];
|
|
345
|
+
if (u === null || u === void 0 ? void 0 : u.name) {
|
|
346
|
+
return includeEmail && u.email ? `@${u.name} <${u.email}>` : `@${u.name}`;
|
|
347
|
+
}
|
|
348
|
+
// fallback: keep original token if we can't resolve
|
|
349
|
+
return `@${id}`;
|
|
350
|
+
});
|
|
351
|
+
// 2) Channels: <#C12345|name> -> #name (fallback to #C12345)
|
|
352
|
+
const channelIds = new Set();
|
|
353
|
+
for (const m of raw.matchAll(MENTION_CHANNEL_RE))
|
|
354
|
+
channelIds.add(m[1]);
|
|
355
|
+
const idToChannel = {};
|
|
356
|
+
yield Promise.all([...channelIds].map((id) => __awaiter(this, void 0, void 0, function* () {
|
|
357
|
+
var _a, _b;
|
|
358
|
+
try {
|
|
359
|
+
const info = yield client.conversations.info({ channel: id });
|
|
360
|
+
idToChannel[id] = (_b = (_a = info.channel) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : undefined;
|
|
361
|
+
}
|
|
362
|
+
catch (_c) {
|
|
363
|
+
idToChannel[id] = undefined;
|
|
364
|
+
}
|
|
365
|
+
})));
|
|
366
|
+
text = text.replace(MENTION_CHANNEL_RE, (_, id) => { var _a; return `#${(_a = idToChannel[id]) !== null && _a !== void 0 ? _a : id}`; });
|
|
367
|
+
// 3) Special mentions: <!here>, <!channel>, <!everyone>
|
|
368
|
+
text = text.replace(SPECIAL_RE, (_, kind) => `@${kind}`);
|
|
369
|
+
// 4) User groups: <!subteam^S123|@group> -> @group (fallback to @S123)
|
|
370
|
+
text = text.replace(SUBTEAM_RE, (_m, sid) => `@${sid}`);
|
|
371
|
+
// 5) Slack links: <https://x|label> -> label (or the URL)
|
|
372
|
+
text = text.replace(/<([^>|]+)\|([^>]+)>/g, (_m, _url, label) => label); // keep label
|
|
373
|
+
text = text.replace(/<([^>|]+)>/g, (_m, url) => url); // bare <https://…>
|
|
374
|
+
return text;
|
|
375
|
+
});
|
|
376
|
+
}
|
|
311
377
|
export default searchSlack;
|
package/package.json
CHANGED
|
@@ -1,72 +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 { 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;
|