@credal/actions 0.2.15 → 0.2.16

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 (34) hide show
  1. package/dist/actions/actionMapper.js +13 -1
  2. package/dist/actions/autogen/templates.d.ts +2 -0
  3. package/dist/actions/autogen/templates.js +76 -0
  4. package/dist/actions/autogen/types.d.ts +58 -6
  5. package/dist/actions/autogen/types.js +18 -0
  6. package/dist/actions/groups.js +7 -2
  7. package/dist/actions/providers/confluence/updatePage.d.ts +3 -0
  8. package/dist/actions/providers/confluence/updatePage.js +46 -0
  9. package/dist/actions/providers/credal/callCopilot.d.ts +3 -0
  10. package/dist/actions/providers/credal/callCopilot.js +36 -0
  11. package/dist/actions/providers/generic/fillTemplateAction.d.ts +7 -0
  12. package/dist/actions/providers/generic/fillTemplateAction.js +18 -0
  13. package/dist/actions/providers/generic/genericApiCall.d.ts +3 -0
  14. package/dist/actions/providers/generic/genericApiCall.js +38 -0
  15. package/dist/actions/providers/googlemaps/nearbysearch.d.ts +3 -0
  16. package/dist/actions/providers/googlemaps/nearbysearch.js +96 -0
  17. package/dist/actions/providers/math/index.d.ts +1 -0
  18. package/dist/actions/providers/math/index.js +37 -0
  19. package/dist/actions/providers/slack/archiveChannel.d.ts +3 -0
  20. package/dist/actions/providers/slack/archiveChannel.js +35 -0
  21. package/dist/actions/providers/slack/createChannel.d.ts +3 -0
  22. package/dist/actions/providers/slack/createChannel.js +43 -0
  23. package/dist/actions/providers/slack/index.d.ts +1 -0
  24. package/dist/actions/providers/slack/index.js +37 -0
  25. package/dist/actions/providers/slack/listConversations.d.ts +3 -0
  26. package/dist/actions/providers/slack/listConversations.js +41 -0
  27. package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.d.ts +1 -0
  28. package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +2 -3
  29. package/dist/actions/providers/snowflake/runSnowflakeQuery.js +6 -2
  30. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.d.ts +3 -0
  31. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.js +154 -0
  32. package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +3 -0
  33. package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +45 -0
  34. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { genericFillTemplateParamsSchema, genericFillTemplateOutputSchema, confluenceOverwritePageParamsSchema, confluenceOverwritePageOutputSchema, googlemapsValidateAddressOutputSchema, googlemapsValidateAddressParamsSchema, googleOauthCreateNewGoogleDocParamsSchema, googleOauthCreateNewGoogleDocOutputSchema, mathAddOutputSchema, mathAddParamsSchema, mongoInsertMongoDocOutputSchema, mongoInsertMongoDocParamsSchema, slackSendMessageOutputSchema, slackSendMessageParamsSchema, slackGetChannelMessagesOutputSchema, slackGetChannelMessagesParamsSchema, snowflakeGetRowByFieldValueOutputSchema, snowflakeGetRowByFieldValueParamsSchema, zendeskCreateZendeskTicketOutputSchema, zendeskCreateZendeskTicketParamsSchema, zendeskGetTicketDetailsOutputSchema, zendeskGetTicketDetailsParamsSchema, zendeskUpdateTicketStatusOutputSchema, zendeskUpdateTicketStatusParamsSchema, zendeskAddCommentToTicketOutputSchema, zendeskAddCommentToTicketParamsSchema, zendeskAssignTicketOutputSchema, zendeskAssignTicketParamsSchema, zendeskListZendeskTicketsOutputSchema, zendeskListZendeskTicketsParamsSchema, jiraAssignJiraTicketParamsSchema, jiraAssignJiraTicketOutputSchema, jiraCommentJiraTicketParamsSchema, jiraCommentJiraTicketOutputSchema, jiraCreateJiraTicketParamsSchema, jiraCreateJiraTicketOutputSchema, jiraGetJiraTicketDetailsParamsSchema, jiraGetJiraTicketDetailsOutputSchema, jiraGetJiraTicketHistoryParamsSchema, jiraGetJiraTicketHistoryOutputSchema, jiraUpdateJiraTicketDetailsParamsSchema, jiraUpdateJiraTicketDetailsOutputSchema, jiraUpdateJiraTicketStatusParamsSchema, jiraUpdateJiraTicketStatusOutputSchema, openstreetmapGetLatitudeLongitudeFromLocationParamsSchema, openstreetmapGetLatitudeLongitudeFromLocationOutputSchema, nwsGetForecastForLocationParamsSchema, nwsGetForecastForLocationOutputSchema, googlemapsNearbysearchRestaurantsOutputSchema, googlemapsNearbysearchRestaurantsParamsSchema, firecrawlScrapeUrlOutputSchema, firecrawlScrapeUrlParamsSchema, resendSendEmailOutputSchema, firecrawlScrapeTweetDataWithNitterParamsSchema, firecrawlScrapeTweetDataWithNitterOutputSchema, resendSendEmailParamsSchema, linkedinCreateShareLinkedinPostUrlParamsSchema, linkedinCreateShareLinkedinPostUrlOutputSchema, xCreateShareXPostUrlParamsSchema, xCreateShareXPostUrlOutputSchema, finnhubSymbolLookupParamsSchema, finnhubSymbolLookupOutputSchema, finnhubGetBasicFinancialsParamsSchema, finnhubGetBasicFinancialsOutputSchema, confluenceFetchPageContentParamsSchema, confluenceFetchPageContentOutputSchema, snowflakeRunSnowflakeQueryParamsSchema, snowflakeRunSnowflakeQueryOutputSchema, lookerEnableUserByEmailParamsSchema, lookerEnableUserByEmailOutputSchema, googleOauthUpdateDocParamsSchema, googleOauthUpdateDocOutputSchema, googleOauthCreateSpreadsheetParamsSchema, googleOauthCreateSpreadsheetOutputSchema, googleOauthUpdateSpreadsheetParamsSchema, googleOauthUpdateSpreadsheetOutputSchema, googleOauthScheduleCalendarMeetingParamsSchema, googleOauthScheduleCalendarMeetingOutputSchema, googleOauthListCalendarsParamsSchema, googleOauthListCalendarsOutputSchema, googleOauthListCalendarEventsParamsSchema, googleOauthListCalendarEventsOutputSchema, googleOauthUpdateCalendarEventParamsSchema, googleOauthUpdateCalendarEventOutputSchema, googleOauthDeleteCalendarEventParamsSchema, googleOauthDeleteCalendarEventOutputSchema, googleOauthCreatePresentationParamsSchema, googleOauthCreatePresentationOutputSchema, googleOauthUpdatePresentationParamsSchema, googleOauthUpdatePresentationOutputSchema, googleOauthSearchDriveByKeywordsParamsSchema, googleOauthSearchDriveByKeywordsOutputSchema, googleOauthListGroupsOutputSchema, googleOauthListGroupsParamsSchema, googleOauthGetGroupOutputSchema, googleOauthGetGroupParamsSchema, googleOauthListGroupMembersOutputSchema, googleOauthListGroupMembersParamsSchema, googleOauthHasGroupMemberOutputSchema, googleOauthHasGroupMemberParamsSchema, googleOauthAddGroupMemberOutputSchema, googleOauthAddGroupMemberParamsSchema, googleOauthDeleteGroupMemberOutputSchema, googleOauthDeleteGroupMemberParamsSchema, gongGetGongTranscriptsParamsSchema, gongGetGongTranscriptsOutputSchema, ashbyCreateNoteParamsSchema, ashbyCreateNoteOutputSchema, ashbyGetCandidateInfoParamsSchema, ashbyGetCandidateInfoOutputSchema, salesforceUpdateRecordParamsSchema, salesforceUpdateRecordOutputSchema, salesforceCreateCaseParamsSchema, salesforceCreateCaseOutputSchema, salesforceGenerateSalesReportParamsSchema, salesforceGenerateSalesReportOutputSchema, salesforceGetRecordParamsSchema, salesforceGetRecordOutputSchema, ashbyListCandidatesParamsSchema, ashbyListCandidatesOutputSchema, ashbyListCandidateNotesParamsSchema, ashbyListCandidateNotesOutputSchema, ashbySearchCandidatesParamsSchema, ashbySearchCandidatesOutputSchema, ashbyCreateCandidateParamsSchema, ashbyCreateCandidateOutputSchema, ashbyUpdateCandidateParamsSchema, ashbyUpdateCandidateOutputSchema, microsoftMessageTeamsChatParamsSchema, microsoftMessageTeamsChatOutputSchema, microsoftMessageTeamsChannelParamsSchema, microsoftMessageTeamsChannelOutputSchema, salesforceGetSalesforceRecordsByQueryParamsSchema, salesforceGetSalesforceRecordsByQueryOutputSchema, asanaCommentTaskParamsSchema, asanaCommentTaskOutputSchema, asanaCreateTaskParamsSchema, asanaCreateTaskOutputSchema, asanaUpdateTaskParamsSchema, asanaUpdateTaskOutputSchema, githubCreateOrUpdateFileParamsSchema, githubCreateOrUpdateFileOutputSchema, githubCreateBranchParamsSchema, githubCreateBranchOutputSchema, githubCreatePullRequestParamsSchema, githubCreatePullRequestOutputSchema, microsoftUpdateSpreadsheetParamsSchema, microsoftUpdateSpreadsheetOutputSchema, microsoftUpdateDocumentParamsSchema, microsoftUpdateDocumentOutputSchema, microsoftGetDocumentParamsSchema, microsoftGetDocumentOutputSchema, salesforceFetchSalesforceSchemaByObjectParamsSchema, salesforceFetchSalesforceSchemaByObjectOutputSchema, githubListPullRequestsParamsSchema, githubListPullRequestsOutputSchema, jiraGetJiraIssuesByQueryOutputSchema, jiraGetJiraIssuesByQueryParamsSchema, salesforceCreateRecordParamsSchema, salesforceCreateRecordOutputSchema, firecrawlDeepResearchParamsSchema, firecrawlDeepResearchOutputSchema, bingGetTopNSearchResultUrlsParamsSchema, bingGetTopNSearchResultUrlsOutputSchema, ashbyAddCandidateToProjectParamsSchema, ashbyAddCandidateToProjectOutputSchema, microsoftCreateDocumentParamsSchema, microsoftCreateDocumentOutputSchema, kandjiGetFVRecoveryKeyForDeviceParamsSchema, kandjiGetFVRecoveryKeyForDeviceOutputSchema, asanaListAsanaTasksByProjectParamsSchema, asanaListAsanaTasksByProjectOutputSchema, asanaSearchTasksParamsSchema, asanaSearchTasksOutputSchema, asanaGetTasksDetailsParamsSchema, asanaGetTasksDetailsOutputSchema, notionSearchByTitleParamsSchema, notionSearchByTitleOutputSchema, jamfGetJamfComputerInventoryParamsSchema, jamfGetJamfComputerInventoryOutputSchema, jamfGetJamfFileVaultRecoveryKeyParamsSchema, jamfGetJamfFileVaultRecoveryKeyOutputSchema, googlemailSearchGmailMessagesOutputSchema, googlemailSearchGmailMessagesParamsSchema, googlemailListGmailThreadsOutputSchema, googlemailListGmailThreadsParamsSchema, oktaListOktaUsersParamsSchema, oktaListOktaUsersOutputSchema, oktaGetOktaUserParamsSchema, oktaGetOktaUserOutputSchema, oktaListOktaUserGroupsParamsSchema, oktaListOktaUserGroupsOutputSchema, oktaListOktaGroupsParamsSchema, oktaListOktaGroupsOutputSchema, oktaGetOktaGroupParamsSchema, oktaGetOktaGroupOutputSchema, oktaListOktaGroupMembersParamsSchema, oktaListOktaGroupMembersOutputSchema, oktaRemoveUserFromGroupParamsSchema, oktaRemoveUserFromGroupOutputSchema, oktaAddUserToGroupParamsSchema, oktaAddUserToGroupOutputSchema, oktaResetPasswordParamsSchema, oktaResetPasswordOutputSchema, oktaResetMFAParamsSchema, oktaResetMFAOutputSchema, oktaListMFAParamsSchema, oktaListMFAOutputSchema, } from "./autogen/types.js";
1
+ import { genericFillTemplateParamsSchema, genericFillTemplateOutputSchema, confluenceOverwritePageParamsSchema, confluenceOverwritePageOutputSchema, googlemapsValidateAddressOutputSchema, googlemapsValidateAddressParamsSchema, googleOauthCreateNewGoogleDocParamsSchema, googleOauthCreateNewGoogleDocOutputSchema, mathAddOutputSchema, mathAddParamsSchema, mongoInsertMongoDocOutputSchema, mongoInsertMongoDocParamsSchema, slackSendMessageOutputSchema, slackSendMessageParamsSchema, slackGetChannelMessagesOutputSchema, slackGetChannelMessagesParamsSchema, slackArchiveChannelParamsSchema, slackArchiveChannelOutputSchema, slackCreateChannelParamsSchema, slackCreateChannelOutputSchema, snowflakeGetRowByFieldValueOutputSchema, snowflakeGetRowByFieldValueParamsSchema, zendeskCreateZendeskTicketOutputSchema, zendeskCreateZendeskTicketParamsSchema, zendeskGetTicketDetailsOutputSchema, zendeskGetTicketDetailsParamsSchema, zendeskUpdateTicketStatusOutputSchema, zendeskUpdateTicketStatusParamsSchema, zendeskAddCommentToTicketOutputSchema, zendeskAddCommentToTicketParamsSchema, zendeskAssignTicketOutputSchema, zendeskAssignTicketParamsSchema, zendeskListZendeskTicketsOutputSchema, zendeskListZendeskTicketsParamsSchema, jiraAssignJiraTicketParamsSchema, jiraAssignJiraTicketOutputSchema, jiraCommentJiraTicketParamsSchema, jiraCommentJiraTicketOutputSchema, jiraCreateJiraTicketParamsSchema, jiraCreateJiraTicketOutputSchema, jiraGetJiraTicketDetailsParamsSchema, jiraGetJiraTicketDetailsOutputSchema, jiraGetJiraTicketHistoryParamsSchema, jiraGetJiraTicketHistoryOutputSchema, jiraUpdateJiraTicketDetailsParamsSchema, jiraUpdateJiraTicketDetailsOutputSchema, jiraUpdateJiraTicketStatusParamsSchema, jiraUpdateJiraTicketStatusOutputSchema, openstreetmapGetLatitudeLongitudeFromLocationParamsSchema, openstreetmapGetLatitudeLongitudeFromLocationOutputSchema, nwsGetForecastForLocationParamsSchema, nwsGetForecastForLocationOutputSchema, googlemapsNearbysearchRestaurantsOutputSchema, googlemapsNearbysearchRestaurantsParamsSchema, firecrawlScrapeUrlOutputSchema, firecrawlScrapeUrlParamsSchema, resendSendEmailOutputSchema, firecrawlScrapeTweetDataWithNitterParamsSchema, firecrawlScrapeTweetDataWithNitterOutputSchema, resendSendEmailParamsSchema, linkedinCreateShareLinkedinPostUrlParamsSchema, linkedinCreateShareLinkedinPostUrlOutputSchema, xCreateShareXPostUrlParamsSchema, xCreateShareXPostUrlOutputSchema, finnhubSymbolLookupParamsSchema, finnhubSymbolLookupOutputSchema, finnhubGetBasicFinancialsParamsSchema, finnhubGetBasicFinancialsOutputSchema, confluenceFetchPageContentParamsSchema, confluenceFetchPageContentOutputSchema, snowflakeRunSnowflakeQueryParamsSchema, snowflakeRunSnowflakeQueryOutputSchema, lookerEnableUserByEmailParamsSchema, lookerEnableUserByEmailOutputSchema, googleOauthUpdateDocParamsSchema, googleOauthUpdateDocOutputSchema, googleOauthCreateSpreadsheetParamsSchema, googleOauthCreateSpreadsheetOutputSchema, googleOauthUpdateSpreadsheetParamsSchema, googleOauthUpdateSpreadsheetOutputSchema, googleOauthScheduleCalendarMeetingParamsSchema, googleOauthScheduleCalendarMeetingOutputSchema, googleOauthListCalendarsParamsSchema, googleOauthListCalendarsOutputSchema, googleOauthListCalendarEventsParamsSchema, googleOauthListCalendarEventsOutputSchema, googleOauthUpdateCalendarEventParamsSchema, googleOauthUpdateCalendarEventOutputSchema, googleOauthDeleteCalendarEventParamsSchema, googleOauthDeleteCalendarEventOutputSchema, googleOauthCreatePresentationParamsSchema, googleOauthCreatePresentationOutputSchema, googleOauthUpdatePresentationParamsSchema, googleOauthUpdatePresentationOutputSchema, googleOauthSearchDriveByKeywordsParamsSchema, googleOauthSearchDriveByKeywordsOutputSchema, googleOauthListGroupsOutputSchema, googleOauthListGroupsParamsSchema, googleOauthGetGroupOutputSchema, googleOauthGetGroupParamsSchema, googleOauthListGroupMembersOutputSchema, googleOauthListGroupMembersParamsSchema, googleOauthHasGroupMemberOutputSchema, googleOauthHasGroupMemberParamsSchema, googleOauthAddGroupMemberOutputSchema, googleOauthAddGroupMemberParamsSchema, googleOauthDeleteGroupMemberOutputSchema, googleOauthDeleteGroupMemberParamsSchema, gongGetGongTranscriptsParamsSchema, gongGetGongTranscriptsOutputSchema, ashbyCreateNoteParamsSchema, ashbyCreateNoteOutputSchema, ashbyGetCandidateInfoParamsSchema, ashbyGetCandidateInfoOutputSchema, salesforceUpdateRecordParamsSchema, salesforceUpdateRecordOutputSchema, salesforceCreateCaseParamsSchema, salesforceCreateCaseOutputSchema, salesforceGenerateSalesReportParamsSchema, salesforceGenerateSalesReportOutputSchema, salesforceGetRecordParamsSchema, salesforceGetRecordOutputSchema, ashbyListCandidatesParamsSchema, ashbyListCandidatesOutputSchema, ashbyListCandidateNotesParamsSchema, ashbyListCandidateNotesOutputSchema, ashbySearchCandidatesParamsSchema, ashbySearchCandidatesOutputSchema, ashbyCreateCandidateParamsSchema, ashbyCreateCandidateOutputSchema, ashbyUpdateCandidateParamsSchema, ashbyUpdateCandidateOutputSchema, microsoftMessageTeamsChatParamsSchema, microsoftMessageTeamsChatOutputSchema, microsoftMessageTeamsChannelParamsSchema, microsoftMessageTeamsChannelOutputSchema, salesforceGetSalesforceRecordsByQueryParamsSchema, salesforceGetSalesforceRecordsByQueryOutputSchema, asanaCommentTaskParamsSchema, asanaCommentTaskOutputSchema, asanaCreateTaskParamsSchema, asanaCreateTaskOutputSchema, asanaUpdateTaskParamsSchema, asanaUpdateTaskOutputSchema, githubCreateOrUpdateFileParamsSchema, githubCreateOrUpdateFileOutputSchema, githubCreateBranchParamsSchema, githubCreateBranchOutputSchema, githubCreatePullRequestParamsSchema, githubCreatePullRequestOutputSchema, microsoftUpdateSpreadsheetParamsSchema, microsoftUpdateSpreadsheetOutputSchema, microsoftUpdateDocumentParamsSchema, microsoftUpdateDocumentOutputSchema, microsoftGetDocumentParamsSchema, microsoftGetDocumentOutputSchema, salesforceFetchSalesforceSchemaByObjectParamsSchema, salesforceFetchSalesforceSchemaByObjectOutputSchema, githubListPullRequestsParamsSchema, githubListPullRequestsOutputSchema, jiraGetJiraIssuesByQueryOutputSchema, jiraGetJiraIssuesByQueryParamsSchema, salesforceCreateRecordParamsSchema, salesforceCreateRecordOutputSchema, firecrawlDeepResearchParamsSchema, firecrawlDeepResearchOutputSchema, bingGetTopNSearchResultUrlsParamsSchema, bingGetTopNSearchResultUrlsOutputSchema, ashbyAddCandidateToProjectParamsSchema, ashbyAddCandidateToProjectOutputSchema, microsoftCreateDocumentParamsSchema, microsoftCreateDocumentOutputSchema, kandjiGetFVRecoveryKeyForDeviceParamsSchema, kandjiGetFVRecoveryKeyForDeviceOutputSchema, asanaListAsanaTasksByProjectParamsSchema, asanaListAsanaTasksByProjectOutputSchema, asanaSearchTasksParamsSchema, asanaSearchTasksOutputSchema, asanaGetTasksDetailsParamsSchema, asanaGetTasksDetailsOutputSchema, notionSearchByTitleParamsSchema, notionSearchByTitleOutputSchema, jamfGetJamfComputerInventoryParamsSchema, jamfGetJamfComputerInventoryOutputSchema, jamfGetJamfFileVaultRecoveryKeyParamsSchema, jamfGetJamfFileVaultRecoveryKeyOutputSchema, googlemailSearchGmailMessagesOutputSchema, googlemailSearchGmailMessagesParamsSchema, googlemailListGmailThreadsOutputSchema, googlemailListGmailThreadsParamsSchema, oktaListOktaUsersParamsSchema, oktaListOktaUsersOutputSchema, oktaGetOktaUserParamsSchema, oktaGetOktaUserOutputSchema, oktaListOktaUserGroupsParamsSchema, oktaListOktaUserGroupsOutputSchema, oktaListOktaGroupsParamsSchema, oktaListOktaGroupsOutputSchema, oktaGetOktaGroupParamsSchema, oktaGetOktaGroupOutputSchema, oktaListOktaGroupMembersParamsSchema, oktaListOktaGroupMembersOutputSchema, oktaRemoveUserFromGroupParamsSchema, oktaRemoveUserFromGroupOutputSchema, oktaAddUserToGroupParamsSchema, oktaAddUserToGroupOutputSchema, oktaResetPasswordParamsSchema, oktaResetPasswordOutputSchema, oktaResetMFAParamsSchema, oktaResetMFAOutputSchema, oktaListMFAParamsSchema, oktaListMFAOutputSchema, } from "./autogen/types.js";
2
2
  import validateAddress from "./providers/googlemaps/validateAddress.js";
3
3
  import add from "./providers/math/add.js";
4
4
  import fillTemplate from "./providers/generic/fillTemplate.js";
@@ -103,6 +103,8 @@ import addUserToGroup from "./providers/okta/addUserToGroup.js";
103
103
  import resetPassword from "./providers/okta/resetPassword.js";
104
104
  import resetMFA from "./providers/okta/resetMFA.js";
105
105
  import listMFA from "./providers/okta/listMFA.js";
106
+ import createChannel from "./providers/slack/createChannel.js";
107
+ import archiveChannel from "./providers/slack/archiveChannel.js";
106
108
  export const ActionMapper = {
107
109
  generic: {
108
110
  fillTemplate: {
@@ -173,6 +175,16 @@ export const ActionMapper = {
173
175
  paramsSchema: slackGetChannelMessagesParamsSchema,
174
176
  outputSchema: slackGetChannelMessagesOutputSchema,
175
177
  },
178
+ createChannel: {
179
+ fn: createChannel,
180
+ paramsSchema: slackCreateChannelParamsSchema,
181
+ outputSchema: slackCreateChannelOutputSchema,
182
+ },
183
+ archiveChannel: {
184
+ fn: archiveChannel,
185
+ paramsSchema: slackArchiveChannelParamsSchema,
186
+ outputSchema: slackArchiveChannelOutputSchema,
187
+ },
176
188
  },
177
189
  confluence: {
178
190
  overwritePage: {
@@ -6,6 +6,8 @@ export declare const asanaCreateTaskDefinition: ActionTemplate;
6
6
  export declare const asanaUpdateTaskDefinition: ActionTemplate;
7
7
  export declare const asanaSearchTasksDefinition: ActionTemplate;
8
8
  export declare const asanaGetTasksDetailsDefinition: ActionTemplate;
9
+ export declare const slackCreateChannelDefinition: ActionTemplate;
10
+ export declare const slackArchiveChannelDefinition: ActionTemplate;
9
11
  export declare const slackSendMessageDefinition: ActionTemplate;
10
12
  export declare const slackGetChannelMessagesDefinition: ActionTemplate;
11
13
  export declare const mathAddDefinition: ActionTemplate;
@@ -502,6 +502,78 @@ export const asanaGetTasksDetailsDefinition = {
502
502
  name: "getTasksDetails",
503
503
  provider: "asana",
504
504
  };
505
+ export const slackCreateChannelDefinition = {
506
+ description: "Creates a new Slack channel using a bot token",
507
+ scopes: ["channels:manage"],
508
+ parameters: {
509
+ type: "object",
510
+ required: ["channelName"],
511
+ properties: {
512
+ channelName: {
513
+ type: "string",
514
+ description: "The name of the channel to create (without '#')",
515
+ },
516
+ isPrivate: {
517
+ type: "boolean",
518
+ description: "Whether to create a private channel (defaults to false)",
519
+ },
520
+ },
521
+ },
522
+ output: {
523
+ type: "object",
524
+ required: ["success"],
525
+ properties: {
526
+ success: {
527
+ type: "boolean",
528
+ description: "Whether the channel was created successfully",
529
+ },
530
+ channelId: {
531
+ type: "string",
532
+ description: "The ID of the created channel",
533
+ },
534
+ channelUrl: {
535
+ type: "string",
536
+ description: "The URL of the created channel",
537
+ },
538
+ error: {
539
+ type: "string",
540
+ description: "The error that occurred if the channel was not created successfully",
541
+ },
542
+ },
543
+ },
544
+ name: "createChannel",
545
+ provider: "slack",
546
+ };
547
+ export const slackArchiveChannelDefinition = {
548
+ description: "Archives a Slack channel using a bot token",
549
+ scopes: ["channels:manage"],
550
+ parameters: {
551
+ type: "object",
552
+ required: ["channelId"],
553
+ properties: {
554
+ channelId: {
555
+ type: "string",
556
+ description: "The ID of the channel to archive",
557
+ },
558
+ },
559
+ },
560
+ output: {
561
+ type: "object",
562
+ required: ["success"],
563
+ properties: {
564
+ success: {
565
+ type: "boolean",
566
+ description: "Whether the channel was archived successfully",
567
+ },
568
+ error: {
569
+ type: "string",
570
+ description: "The error that occurred if the channel was not archived successfully",
571
+ },
572
+ },
573
+ },
574
+ name: "archiveChannel",
575
+ provider: "slack",
576
+ };
505
577
  export const slackSendMessageDefinition = {
506
578
  description: "Sends a message to a Slack channel",
507
579
  scopes: ["chat:write"],
@@ -1705,6 +1777,10 @@ export const snowflakeRunSnowflakeQueryDefinition = {
1705
1777
  type: "string",
1706
1778
  description: "The warehouse to use for executing the query",
1707
1779
  },
1780
+ role: {
1781
+ type: "string",
1782
+ description: "The snowflake role to use for executing the query",
1783
+ },
1708
1784
  query: {
1709
1785
  type: "string",
1710
1786
  description: "The SQL query to execute",
@@ -689,6 +689,55 @@ export declare const asanaGetTasksDetailsOutputSchema: z.ZodObject<{
689
689
  }>;
690
690
  export type asanaGetTasksDetailsOutputType = z.infer<typeof asanaGetTasksDetailsOutputSchema>;
691
691
  export type asanaGetTasksDetailsFunction = ActionFunction<asanaGetTasksDetailsParamsType, AuthParamsType, asanaGetTasksDetailsOutputType>;
692
+ export declare const slackCreateChannelParamsSchema: z.ZodObject<{
693
+ channelName: z.ZodString;
694
+ isPrivate: z.ZodOptional<z.ZodBoolean>;
695
+ }, "strip", z.ZodTypeAny, {
696
+ channelName: string;
697
+ isPrivate?: boolean | undefined;
698
+ }, {
699
+ channelName: string;
700
+ isPrivate?: boolean | undefined;
701
+ }>;
702
+ export type slackCreateChannelParamsType = z.infer<typeof slackCreateChannelParamsSchema>;
703
+ export declare const slackCreateChannelOutputSchema: z.ZodObject<{
704
+ success: z.ZodBoolean;
705
+ channelId: z.ZodOptional<z.ZodString>;
706
+ channelUrl: z.ZodOptional<z.ZodString>;
707
+ error: z.ZodOptional<z.ZodString>;
708
+ }, "strip", z.ZodTypeAny, {
709
+ success: boolean;
710
+ error?: string | undefined;
711
+ channelId?: string | undefined;
712
+ channelUrl?: string | undefined;
713
+ }, {
714
+ success: boolean;
715
+ error?: string | undefined;
716
+ channelId?: string | undefined;
717
+ channelUrl?: string | undefined;
718
+ }>;
719
+ export type slackCreateChannelOutputType = z.infer<typeof slackCreateChannelOutputSchema>;
720
+ export type slackCreateChannelFunction = ActionFunction<slackCreateChannelParamsType, AuthParamsType, slackCreateChannelOutputType>;
721
+ export declare const slackArchiveChannelParamsSchema: z.ZodObject<{
722
+ channelId: z.ZodString;
723
+ }, "strip", z.ZodTypeAny, {
724
+ channelId: string;
725
+ }, {
726
+ channelId: string;
727
+ }>;
728
+ export type slackArchiveChannelParamsType = z.infer<typeof slackArchiveChannelParamsSchema>;
729
+ export declare const slackArchiveChannelOutputSchema: z.ZodObject<{
730
+ success: z.ZodBoolean;
731
+ error: z.ZodOptional<z.ZodString>;
732
+ }, "strip", z.ZodTypeAny, {
733
+ success: boolean;
734
+ error?: string | undefined;
735
+ }, {
736
+ success: boolean;
737
+ error?: string | undefined;
738
+ }>;
739
+ export type slackArchiveChannelOutputType = z.infer<typeof slackArchiveChannelOutputSchema>;
740
+ export type slackArchiveChannelFunction = ActionFunction<slackArchiveChannelParamsType, AuthParamsType, slackArchiveChannelOutputType>;
692
741
  export declare const slackSendMessageParamsSchema: z.ZodObject<{
693
742
  channelName: z.ZodString;
694
743
  message: z.ZodString;
@@ -1660,6 +1709,7 @@ export type snowflakeGetRowByFieldValueFunction = ActionFunction<snowflakeGetRow
1660
1709
  export declare const snowflakeRunSnowflakeQueryParamsSchema: z.ZodObject<{
1661
1710
  databaseName: z.ZodString;
1662
1711
  warehouse: z.ZodString;
1712
+ role: z.ZodOptional<z.ZodString>;
1663
1713
  query: z.ZodString;
1664
1714
  accountName: z.ZodString;
1665
1715
  outputFormat: z.ZodOptional<z.ZodEnum<["json", "csv"]>>;
@@ -1672,6 +1722,7 @@ export declare const snowflakeRunSnowflakeQueryParamsSchema: z.ZodObject<{
1672
1722
  accountName: string;
1673
1723
  warehouse: string;
1674
1724
  limit?: number | undefined;
1725
+ role?: string | undefined;
1675
1726
  outputFormat?: "json" | "csv" | undefined;
1676
1727
  codeInterpreterLimit?: number | undefined;
1677
1728
  codeInterpreterImageGenLimit?: number | undefined;
@@ -1681,6 +1732,7 @@ export declare const snowflakeRunSnowflakeQueryParamsSchema: z.ZodObject<{
1681
1732
  accountName: string;
1682
1733
  warehouse: string;
1683
1734
  limit?: number | undefined;
1735
+ role?: string | undefined;
1684
1736
  outputFormat?: "json" | "csv" | undefined;
1685
1737
  codeInterpreterLimit?: number | undefined;
1686
1738
  codeInterpreterImageGenLimit?: number | undefined;
@@ -2839,21 +2891,21 @@ export declare const googleOauthListGroupMembersOutputSchema: z.ZodObject<{
2839
2891
  }, "strip", z.ZodTypeAny, {
2840
2892
  type: string;
2841
2893
  id: string;
2842
- email: string;
2843
2894
  role: string;
2895
+ email: string;
2844
2896
  }, {
2845
2897
  type: string;
2846
2898
  id: string;
2847
- email: string;
2848
2899
  role: string;
2900
+ email: string;
2849
2901
  }>, "many">;
2850
2902
  error: z.ZodOptional<z.ZodString>;
2851
2903
  }, "strip", z.ZodTypeAny, {
2852
2904
  members: {
2853
2905
  type: string;
2854
2906
  id: string;
2855
- email: string;
2856
2907
  role: string;
2908
+ email: string;
2857
2909
  }[];
2858
2910
  success: boolean;
2859
2911
  error?: string | undefined;
@@ -2861,8 +2913,8 @@ export declare const googleOauthListGroupMembersOutputSchema: z.ZodObject<{
2861
2913
  members: {
2862
2914
  type: string;
2863
2915
  id: string;
2864
- email: string;
2865
2916
  role: string;
2917
+ email: string;
2866
2918
  }[];
2867
2919
  success: boolean;
2868
2920
  error?: string | undefined;
@@ -5006,12 +5058,12 @@ export declare const microsoftMessageTeamsChannelParamsSchema: z.ZodObject<{
5006
5058
  message: z.ZodString;
5007
5059
  }, "strip", z.ZodTypeAny, {
5008
5060
  message: string;
5009
- teamId: string;
5010
5061
  channelId: string;
5062
+ teamId: string;
5011
5063
  }, {
5012
5064
  message: string;
5013
- teamId: string;
5014
5065
  channelId: string;
5066
+ teamId: string;
5015
5067
  }>;
5016
5068
  export type microsoftMessageTeamsChannelParamsType = z.infer<typeof microsoftMessageTeamsChannelParamsSchema>;
5017
5069
  export declare const microsoftMessageTeamsChannelOutputSchema: z.ZodObject<{
@@ -202,6 +202,23 @@ export const asanaGetTasksDetailsOutputSchema = z.object({
202
202
  .describe("The list of tasks that match search query")
203
203
  .optional(),
204
204
  });
205
+ export const slackCreateChannelParamsSchema = z.object({
206
+ channelName: z.string().describe("The name of the channel to create (without '#')"),
207
+ isPrivate: z.boolean().describe("Whether to create a private channel (defaults to false)").optional(),
208
+ });
209
+ export const slackCreateChannelOutputSchema = z.object({
210
+ success: z.boolean().describe("Whether the channel was created successfully"),
211
+ channelId: z.string().describe("The ID of the created channel").optional(),
212
+ channelUrl: z.string().describe("The URL of the created channel").optional(),
213
+ error: z.string().describe("The error that occurred if the channel was not created successfully").optional(),
214
+ });
215
+ export const slackArchiveChannelParamsSchema = z.object({
216
+ channelId: z.string().describe("The ID of the channel to archive"),
217
+ });
218
+ export const slackArchiveChannelOutputSchema = z.object({
219
+ success: z.boolean().describe("Whether the channel was archived successfully"),
220
+ error: z.string().describe("The error that occurred if the channel was not archived successfully").optional(),
221
+ });
205
222
  export const slackSendMessageParamsSchema = z.object({
206
223
  channelName: z.string().describe("The name of the Slack channel to send the message to (e.g. general, alerts)"),
207
224
  message: z.string().describe("The message content to send to Slack. Can include markdown formatting."),
@@ -533,6 +550,7 @@ export const snowflakeGetRowByFieldValueOutputSchema = z.object({
533
550
  export const snowflakeRunSnowflakeQueryParamsSchema = z.object({
534
551
  databaseName: z.string().describe("The name of the database to query"),
535
552
  warehouse: z.string().describe("The warehouse to use for executing the query"),
553
+ role: z.string().describe("The snowflake role to use for executing the query").optional(),
536
554
  query: z.string().describe("The SQL query to execute"),
537
555
  accountName: z.string().describe("The name of the Snowflake account"),
538
556
  outputFormat: z.enum(["json", "csv"]).describe("The format of the output").optional(),
@@ -1,4 +1,4 @@
1
- import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, 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, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, } from "./autogen/templates.js";
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, 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, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, } from "./autogen/templates.js";
2
2
  export const ACTION_GROUPS = {
3
3
  GENERIC: {
4
4
  description: "Generic utility actions",
@@ -17,7 +17,12 @@ export const ACTION_GROUPS = {
17
17
  },
18
18
  SLACK_LIST_CONVERSATIONS: {
19
19
  description: "Actions for interacting with Slack",
20
- actions: [slackSendMessageDefinition, slackGetChannelMessagesDefinition],
20
+ actions: [
21
+ slackSendMessageDefinition,
22
+ slackGetChannelMessagesDefinition,
23
+ slackCreateChannelDefinition,
24
+ slackArchiveChannelDefinition,
25
+ ],
21
26
  },
22
27
  CONFLUENCE: {
23
28
  description: "Action for interacting with Confluence",
@@ -0,0 +1,3 @@
1
+ import { confluenceUpdatePageFunction } from "../../../actions/autogen/types";
2
+ declare const confluenceUpdatePage: confluenceUpdatePageFunction;
3
+ export default confluenceUpdatePage;
@@ -0,0 +1,46 @@
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 axiosClient_1 = require("../../util/axiosClient");
13
+ function getConfluenceRequestConfig(baseUrl, username, apiToken) {
14
+ return {
15
+ baseURL: baseUrl,
16
+ headers: {
17
+ Accept: "application/json",
18
+ Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
19
+ },
20
+ };
21
+ }
22
+ const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
23
+ const { pageId, content, title } = params;
24
+ const { baseUrl, authToken, username } = authParams;
25
+ if (!baseUrl || !authToken || !username) {
26
+ throw new Error("Missing required authentication information");
27
+ }
28
+ const config = getConfluenceRequestConfig(baseUrl, username, authToken);
29
+ // Get current version number
30
+ const response = yield axiosClient_1.axiosClient.get(`/api/v2/pages/${pageId}`, config);
31
+ const currVersion = response.data.version.number;
32
+ const payload = {
33
+ id: pageId,
34
+ status: "current",
35
+ title,
36
+ body: {
37
+ representation: "storage",
38
+ value: content,
39
+ },
40
+ version: {
41
+ number: currVersion + 1,
42
+ },
43
+ };
44
+ yield axiosClient_1.axiosClient.put(`/api/v2/pages/${pageId}`, payload, config);
45
+ });
46
+ exports.default = confluenceUpdatePage;
@@ -0,0 +1,3 @@
1
+ import type { credalCallCopilotFunction } from "../../autogen/types";
2
+ declare const callCopilot: credalCallCopilotFunction;
3
+ export default callCopilot;
@@ -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,7 @@
1
+ import type { ActionFunction } from "../../autogen/types";
2
+ declare const fillTemplateAction: ActionFunction<{
3
+ template: string;
4
+ }, {
5
+ result: string;
6
+ }, unknown>;
7
+ export default fillTemplateAction;
@@ -0,0 +1,18 @@
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 fillTemplateAction = (_a) => __awaiter(void 0, [_a], void 0, function* ({ template }) {
13
+ // Simply return the template without any modification
14
+ return {
15
+ result: template,
16
+ };
17
+ });
18
+ exports.default = fillTemplateAction;
@@ -0,0 +1,3 @@
1
+ import type { genericUniversalTestActionFunction } from "../../autogen/types";
2
+ declare const genericApiCall: genericUniversalTestActionFunction;
3
+ export default genericApiCall;
@@ -0,0 +1,38 @@
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
+ const genericApiCall = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, }) {
17
+ try {
18
+ const { endpoint, method, headers, body } = params;
19
+ const response = yield (0, axios_1.default)({
20
+ url: endpoint,
21
+ method,
22
+ headers,
23
+ data: method !== "GET" ? body : undefined,
24
+ });
25
+ return {
26
+ statusCode: response.status,
27
+ headers: response.headers,
28
+ data: response.data,
29
+ };
30
+ }
31
+ catch (error) {
32
+ if (axios_1.default.isAxiosError(error)) {
33
+ throw Error("Axios Error: " + (error.message || "Failed to make API call"));
34
+ }
35
+ throw Error("Error: " + (error || "Failed to make API call"));
36
+ }
37
+ });
38
+ exports.default = genericApiCall;
@@ -0,0 +1,3 @@
1
+ import { googlemapsNearbysearchFunction } from "../../autogen/types";
2
+ declare const nearbysearch: googlemapsNearbysearchFunction;
3
+ export default nearbysearch;
@@ -0,0 +1,96 @@
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
+ const types_1 = require("../../autogen/types");
17
+ const INCLUDED_TYPES = [
18
+ "monument",
19
+ "museum",
20
+ "art_gallery",
21
+ "sculpture",
22
+ "cultural_landmark",
23
+ "historical_place",
24
+ "performing_arts_theater",
25
+ "university",
26
+ "aquarium",
27
+ "botanical_garden",
28
+ "comedy_club",
29
+ "park",
30
+ "movie_theater",
31
+ "national_park",
32
+ "garden",
33
+ "night_club",
34
+ "tourist_attraction",
35
+ "water_park",
36
+ "zoo",
37
+ "bar",
38
+ "restaurant",
39
+ "food_court",
40
+ "bakery",
41
+ "cafe",
42
+ "coffee_shop",
43
+ "pub",
44
+ "wine_bar",
45
+ "spa",
46
+ "beach",
47
+ "market",
48
+ "shopping_mall",
49
+ "stadium",
50
+ ];
51
+ const nearbysearch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
52
+ const url = `https://places.googleapis.com/v1/places:searchNearby`;
53
+ const fieldMask = [
54
+ "places.displayName",
55
+ "places.formattedAddress",
56
+ "places.priceLevel",
57
+ "places.rating",
58
+ "places.primaryTypeDisplayName",
59
+ "places.editorialSummary",
60
+ "places.regularOpeningHours",
61
+ ].join(",");
62
+ const response = yield axios_1.default.post(url, {
63
+ maxResultCount: 20,
64
+ includedTypes: INCLUDED_TYPES,
65
+ locationRestriction: {
66
+ circle: {
67
+ center: {
68
+ latitude: params.latitude,
69
+ longitude: params.longitude,
70
+ },
71
+ radius: 10000,
72
+ },
73
+ },
74
+ }, {
75
+ headers: {
76
+ "X-Goog-Api-Key": authParams.apiKey,
77
+ "X-Goog-FieldMask": fieldMask,
78
+ "Content-Type": "application/json",
79
+ },
80
+ });
81
+ return types_1.googlemapsNearbysearchOutputSchema.parse({
82
+ results: response.data.places.map((place) => {
83
+ var _a, _b;
84
+ return ({
85
+ name: place.displayName.text,
86
+ address: place.formattedAddress,
87
+ priceLevel: place.priceLevel,
88
+ rating: place.rating,
89
+ primaryType: place.primaryTypeDisplayName.text,
90
+ editorialSummary: ((_a = place.editorialSummary) === null || _a === void 0 ? void 0 : _a.text) || "",
91
+ openingHours: ((_b = place.regularOpeningHours) === null || _b === void 0 ? void 0 : _b.weekdayDescriptions.join("\n")) || "",
92
+ });
93
+ }),
94
+ });
95
+ });
96
+ exports.default = nearbysearch;
@@ -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,3 @@
1
+ import type { slackArchiveChannelFunction } from "../../autogen/types";
2
+ declare const archiveChannel: slackArchiveChannelFunction;
3
+ export default archiveChannel;
@@ -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 { WebClient } from "@slack/web-api";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
12
+ const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
13
+ if (!authParams.authToken) {
14
+ throw new Error(MISSING_AUTH_TOKEN);
15
+ }
16
+ try {
17
+ const client = new WebClient(authParams.authToken);
18
+ const { channelId } = params;
19
+ const result = yield client.conversations.archive({ channel: channelId });
20
+ if (!result.ok) {
21
+ return {
22
+ success: false,
23
+ error: result.error || "Unknown error archiving channel",
24
+ };
25
+ }
26
+ return { success: true };
27
+ }
28
+ catch (error) {
29
+ return {
30
+ success: false,
31
+ error: error instanceof Error ? error.message : "Unknown error archiving channel",
32
+ };
33
+ }
34
+ });
35
+ export default archiveChannel;
@@ -0,0 +1,3 @@
1
+ import type { slackCreateChannelFunction } from "../../autogen/types";
2
+ declare const createChannel: slackCreateChannelFunction;
3
+ export default createChannel;
@@ -0,0 +1,43 @@
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";
12
+ const createChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
13
+ if (!authParams.authToken) {
14
+ throw new Error(MISSING_AUTH_TOKEN);
15
+ }
16
+ try {
17
+ const client = new WebClient(authParams.authToken);
18
+ const { channelName, isPrivate } = params;
19
+ const result = yield client.conversations.create({
20
+ name: channelName,
21
+ is_private: !!isPrivate,
22
+ });
23
+ const { ok, channel, error } = result;
24
+ if (!ok || !(channel === null || channel === void 0 ? void 0 : channel.id)) {
25
+ return {
26
+ success: false,
27
+ error: error || "Unknown error creating channel",
28
+ };
29
+ }
30
+ return {
31
+ success: true,
32
+ channelId: channel.id,
33
+ channelUrl: `https://slack.com/app_redirect?channel=${channel.id}`,
34
+ };
35
+ }
36
+ catch (error) {
37
+ return {
38
+ success: false,
39
+ error: error instanceof Error ? error.message : "Unknown error creating channel",
40
+ };
41
+ }
42
+ });
43
+ export default createChannel;
@@ -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,3 @@
1
+ import type { slackListConversationsFunction } from "../../autogen/types";
2
+ declare const slackListConversations: slackListConversationsFunction;
3
+ export default slackListConversations;
@@ -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;
@@ -5,5 +5,6 @@ export declare function getSnowflakeConnection(snowflakeData: {
5
5
  username: string;
6
6
  warehouse: string;
7
7
  database: string;
8
+ role?: string;
8
9
  }, authParams: AuthParamsType): Connection;
9
10
  export declare function connectToSnowflakeAndWarehouse(connection: Connection, warehouse?: string): Promise<void>;
@@ -23,7 +23,7 @@ const getPrivateKeyCorrectFormat = (privateKey) => {
23
23
  };
24
24
  export function getSnowflakeConnection(snowflakeData, authParams) {
25
25
  const { authToken, apiKey } = authParams;
26
- const { account, username, warehouse, database } = snowflakeData;
26
+ const { account, username, warehouse, database, role } = snowflakeData;
27
27
  if (authToken) {
28
28
  // Always try to use Nango-Snowflake OAuth (unused for now)
29
29
  return snowflake.createConnection({
@@ -31,7 +31,6 @@ export function getSnowflakeConnection(snowflakeData, authParams) {
31
31
  username: username,
32
32
  authenticator: "OAUTH",
33
33
  token: authToken,
34
- role: "CREDAL_READ",
35
34
  warehouse: warehouse,
36
35
  database: database,
37
36
  });
@@ -43,7 +42,7 @@ export function getSnowflakeConnection(snowflakeData, authParams) {
43
42
  username: username,
44
43
  privateKey: privateKeyCorrectFormatString,
45
44
  authenticator: "SNOWFLAKE_JWT",
46
- role: "CREDAL_READ",
45
+ role: role,
47
46
  warehouse: warehouse,
48
47
  database: database,
49
48
  });
@@ -12,7 +12,7 @@ import { connectToSnowflakeAndWarehouse, getSnowflakeConnection } from "./auth/g
12
12
  import { formatDataForCodeInterpreter } from "../../util/formatDataForCodeInterpreter.js";
13
13
  snowflake.configure({ logLevel: "ERROR" });
14
14
  const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
- const { databaseName, warehouse, query, accountName, outputFormat = "json", limit } = params;
15
+ const { databaseName, warehouse, query, accountName, outputFormat = "json", limit, role } = params;
16
16
  const executeQueryAndFormatData = () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  const formattedQuery = query.trim().replace(/\s+/g, " "); // Normalize all whitespace to single spaces
18
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -35,12 +35,16 @@ const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
35
35
  const formattedData = formatDataForCodeInterpreter(queryResults, outputFormat);
36
36
  return { formattedData: formattedData, resultsLength: fullResultLength };
37
37
  });
38
+ if (!authParams.username) {
39
+ throw new Error("Snowflake username is required in authParams.");
40
+ }
38
41
  // Set up a connection using snowflake-sdk
39
42
  const connection = getSnowflakeConnection({
40
43
  account: accountName,
41
- username: authParams.username || "CREDAL_USER",
44
+ username: authParams.username,
42
45
  warehouse: warehouse,
43
46
  database: databaseName,
47
+ role: role,
44
48
  }, { authToken: authParams.authToken, apiKey: authParams.apiKey });
45
49
  try {
46
50
  // Connect to Snowflake
@@ -0,0 +1,3 @@
1
+ import { snowflakeRunSnowflakeQueryWriteResultsToS3Function } from "../../autogen/types";
2
+ declare const runSnowflakeQueryWriteResultsToS3: snowflakeRunSnowflakeQueryWriteResultsToS3Function;
3
+ export default runSnowflakeQueryWriteResultsToS3;
@@ -0,0 +1,154 @@
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 snowflake_sdk_1 = __importDefault(require("snowflake-sdk"));
16
+ const crypto_1 = __importDefault(require("crypto"));
17
+ const client_s3_1 = require("@aws-sdk/client-s3");
18
+ const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
19
+ const uuid_1 = require("uuid");
20
+ // Only log errors.
21
+ snowflake_sdk_1.default.configure({ logLevel: "ERROR" });
22
+ const runSnowflakeQueryWriteResultsToS3 = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
23
+ const { databaseName, warehouse, query, user, accountName, s3BucketName, s3Region, outputFormat = "json" } = params;
24
+ const { apiKey: privateKey, awsAccessKeyId, awsSecretAccessKey } = authParams;
25
+ if (!privateKey) {
26
+ throw new Error("Snowflake private key is required");
27
+ }
28
+ if (!awsAccessKeyId || !awsSecretAccessKey) {
29
+ throw new Error("AWS credentials are required");
30
+ }
31
+ if (!accountName || !user || !databaseName || !warehouse || !query || !s3BucketName) {
32
+ throw new Error("Missing required parameters for Snowflake query or S3 destination");
33
+ }
34
+ const getPrivateKeyCorrectFormat = (privateKey) => {
35
+ const buffer = Buffer.from(privateKey);
36
+ const privateKeyObject = crypto_1.default.createPrivateKey({
37
+ key: buffer,
38
+ format: "pem",
39
+ passphrase: "password",
40
+ });
41
+ const privateKeyCorrectFormat = privateKeyObject.export({
42
+ format: "pem",
43
+ type: "pkcs8",
44
+ });
45
+ return privateKeyCorrectFormat.toString();
46
+ };
47
+ const executeQueryAndFormatData = () => __awaiter(void 0, void 0, void 0, function* () {
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ const queryResults = yield new Promise((resolve, reject) => {
50
+ connection.execute({
51
+ sqlText: query,
52
+ complete: (err, stmt, rows) => {
53
+ if (err) {
54
+ return reject(err);
55
+ }
56
+ return resolve(rows || []);
57
+ },
58
+ });
59
+ });
60
+ // Format the results based on the output format
61
+ let formattedData;
62
+ if (outputFormat.toLowerCase() === "csv") {
63
+ if (queryResults.length === 0) {
64
+ formattedData = "";
65
+ }
66
+ else {
67
+ const headers = Object.keys(queryResults[0]).join(",");
68
+ const rows = queryResults.map(row => Object.values(row)
69
+ .map(value => (typeof value === "object" && value !== null ? JSON.stringify(value) : value))
70
+ .join(","));
71
+ formattedData = [headers, ...rows].join("\n");
72
+ }
73
+ }
74
+ else {
75
+ // Default to JSON
76
+ formattedData = JSON.stringify(queryResults, null, 2);
77
+ }
78
+ return { formattedData, resultsLength: queryResults.length };
79
+ });
80
+ const uploadToS3AndGetURL = (formattedData) => __awaiter(void 0, void 0, void 0, function* () {
81
+ // Create S3 client
82
+ const s3Client = new client_s3_1.S3Client({
83
+ region: s3Region,
84
+ credentials: {
85
+ accessKeyId: awsAccessKeyId,
86
+ secretAccessKey: awsSecretAccessKey,
87
+ },
88
+ });
89
+ const contentType = outputFormat.toLowerCase() === "csv" ? "text/csv" : "application/json";
90
+ const fileExtension = outputFormat.toLowerCase() === "csv" ? "csv" : "json";
91
+ const finalKey = `${databaseName}/${(0, uuid_1.v4)()}.${fileExtension}`;
92
+ // Upload to S3 without ACL
93
+ const uploadCommand = new client_s3_1.PutObjectCommand({
94
+ Bucket: s3BucketName,
95
+ Key: finalKey,
96
+ Body: formattedData,
97
+ ContentType: contentType,
98
+ });
99
+ yield s3Client.send(uploadCommand);
100
+ // Generate a presigned URL (valid for an hour)
101
+ const getObjectCommand = new client_s3_1.GetObjectCommand({
102
+ Bucket: s3BucketName,
103
+ Key: finalKey,
104
+ });
105
+ const presignedUrl = yield (0, s3_request_presigner_1.getSignedUrl)(s3Client, getObjectCommand, { expiresIn: 3600 });
106
+ return presignedUrl;
107
+ });
108
+ // Process the private key
109
+ const privateKeyCorrectFormatString = getPrivateKeyCorrectFormat(privateKey);
110
+ // Set up a connection using snowflake-sdk
111
+ const connection = snowflake_sdk_1.default.createConnection({
112
+ account: accountName,
113
+ username: user,
114
+ privateKey: privateKeyCorrectFormatString,
115
+ authenticator: "SNOWFLAKE_JWT",
116
+ role: "ACCOUNTADMIN",
117
+ warehouse: warehouse,
118
+ database: databaseName,
119
+ });
120
+ try {
121
+ // Connect to Snowflake
122
+ yield new Promise((resolve, reject) => {
123
+ connection.connect((err, conn) => {
124
+ if (err) {
125
+ console.error("Unable to connect to Snowflake:", err.message);
126
+ return reject(err);
127
+ }
128
+ resolve(conn);
129
+ });
130
+ });
131
+ const { formattedData, resultsLength } = yield executeQueryAndFormatData();
132
+ const presignedUrl = yield uploadToS3AndGetURL(formattedData);
133
+ // Return fields to match schema definition
134
+ connection.destroy(err => {
135
+ if (err) {
136
+ console.log("Failed to disconnect from Snowflake:", err);
137
+ }
138
+ });
139
+ return {
140
+ bucketUrl: presignedUrl,
141
+ message: `Query results successfully written to S3. URL valid for 1 hour.`,
142
+ rowCount: resultsLength,
143
+ };
144
+ }
145
+ catch (error) {
146
+ connection.destroy(err => {
147
+ if (err) {
148
+ console.log("Failed to disconnect from Snowflake:", err);
149
+ }
150
+ });
151
+ throw Error(`An error occurred: ${error}`);
152
+ }
153
+ });
154
+ exports.default = runSnowflakeQueryWriteResultsToS3;
@@ -0,0 +1,3 @@
1
+ import { xScrapePostDataWithNitterFunction } from "../../autogen/types";
2
+ declare const scrapeTweetDataWithNitter: xScrapePostDataWithNitterFunction;
3
+ export default scrapeTweetDataWithNitter;
@@ -0,0 +1,45 @@
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 firecrawl_js_1 = __importDefault(require("@mendable/firecrawl-js"));
16
+ const scrapeTweetDataWithNitter = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
+ const tweetUrlRegex = /^(?:https?:\/\/)?(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)(?:\?.*)?$/;
18
+ if (!tweetUrlRegex.test(params.tweetUrl)) {
19
+ throw new Error("Invalid tweet URL. Expected format: https://twitter.com/username/status/id or https://x.com/username/status/id");
20
+ }
21
+ const nitterUrl = params.tweetUrl.replace(/^(?:https?:\/\/)?(?:www\.)?(?:twitter\.com|x\.com)/i, "https://nitter.net");
22
+ // Initialize Firecrawl
23
+ if (!authParams.apiKey) {
24
+ throw new Error("API key is required for X+Nitter+Firecrawl");
25
+ }
26
+ const firecrawl = new firecrawl_js_1.default({
27
+ apiKey: authParams.apiKey,
28
+ });
29
+ try {
30
+ // Scrape the Nitter URL
31
+ const result = yield firecrawl.scrapeUrl(nitterUrl);
32
+ if (!result.success) {
33
+ throw new Error(`Failed to scrape tweet: ${result.error || "Unknown error"}`);
34
+ }
35
+ // Extract the tweet text from the scraped content - simple approach - in practice, you might need more robust parsing based on nitter html structure
36
+ const tweetContent = result.markdown;
37
+ return {
38
+ text: tweetContent || "Error scraping with firecrawl",
39
+ };
40
+ }
41
+ catch (error) {
42
+ throw new Error(`Error scraping tweet: ${error instanceof Error ? error.message : error}`);
43
+ }
44
+ });
45
+ exports.default = scrapeTweetDataWithNitter;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "scripts": {
10
- "test": "npx ts-node -r tsconfig-paths/register --project tsconfig.json ",
10
+ "test": "node --loader ts-node/esm",
11
11
  "jest-test": "jest",
12
12
  "build": "tsc",
13
13
  "dev": "node --loader ts-node/esm src/app.ts",