@credal/actions 0.1.53 → 0.1.55

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.
@@ -76,6 +76,7 @@ const fetchSalesforceSchema_1 = __importDefault(require("./providers/salesforce/
76
76
  const deepResearch_1 = __importDefault(require("./providers/firecrawl/deepResearch"));
77
77
  const listPullRequests_1 = __importDefault(require("./providers/github/listPullRequests"));
78
78
  const getJiraIssuesByQuery_1 = __importDefault(require("./providers/jira/getJiraIssuesByQuery"));
79
+ const createRecord_1 = __importDefault(require("./providers/salesforce/createRecord"));
79
80
  exports.ActionMapper = {
80
81
  generic: {
81
82
  fillTemplate: {
@@ -400,6 +401,11 @@ exports.ActionMapper = {
400
401
  paramsSchema: types_1.salesforceUpdateRecordParamsSchema,
401
402
  outputSchema: types_1.salesforceUpdateRecordOutputSchema,
402
403
  },
404
+ createRecord: {
405
+ fn: createRecord_1.default,
406
+ paramsSchema: types_1.salesforceCreateRecordParamsSchema,
407
+ outputSchema: types_1.salesforceCreateRecordOutputSchema,
408
+ },
403
409
  createCase: {
404
410
  fn: createCase_1.default,
405
411
  paramsSchema: types_1.salesforceCreateCaseParamsSchema,
@@ -55,6 +55,7 @@ export declare const ashbyListCandidateNotesDefinition: ActionTemplate;
55
55
  export declare const ashbyCreateCandidateDefinition: ActionTemplate;
56
56
  export declare const ashbyUpdateCandidateDefinition: ActionTemplate;
57
57
  export declare const salesforceUpdateRecordDefinition: ActionTemplate;
58
+ export declare const salesforceCreateRecordDefinition: ActionTemplate;
58
59
  export declare const salesforceCreateCaseDefinition: ActionTemplate;
59
60
  export declare const salesforceGenerateSalesReportDefinition: ActionTemplate;
60
61
  export declare const salesforceGetSalesforceRecordsByQueryDefinition: ActionTemplate;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ashbyAddCandidateToProjectDefinition = exports.ashbyGetCandidateInfoDefinition = exports.ashbyCreateNoteDefinition = exports.lookerEnableUserByEmailDefinition = exports.finnhubGetBasicFinancialsDefinition = exports.finnhubSymbolLookupDefinition = exports.googleOauthUpdatePresentationDefinition = exports.googleOauthCreatePresentationDefinition = exports.googleOauthUpdateSpreadsheetDefinition = exports.googleOauthCreateSpreadsheetDefinition = exports.googleOauthScheduleCalendarMeetingDefinition = exports.googleOauthUpdateDocDefinition = exports.googleOauthCreateNewGoogleDocDefinition = exports.resendSendEmailDefinition = exports.firecrawlScrapeTweetDataWithNitterDefinition = exports.firecrawlScrapeUrlDefinition = exports.firecrawlDeepResearchDefinition = exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeRunSnowflakeQueryDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.xCreateShareXPostUrlDefinition = exports.linkedinCreateShareLinkedinPostUrlDefinition = exports.zendeskAssignTicketDefinition = exports.zendeskAddCommentToTicketDefinition = exports.zendeskUpdateTicketStatusDefinition = exports.zendeskGetTicketDetailsDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchRestaurantsDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraGetJiraIssuesByQueryDefinition = exports.jiraUpdateJiraTicketStatusDefinition = exports.jiraUpdateJiraTicketDetailsDefinition = exports.jiraGetJiraTicketHistoryDefinition = exports.jiraGetJiraTicketDetailsDefinition = exports.jiraCreateJiraTicketDefinition = exports.jiraCommentJiraTicketDefinition = exports.jiraAssignJiraTicketDefinition = exports.confluenceFetchPageContentDefinition = exports.confluenceOverwritePageDefinition = exports.mathAddDefinition = exports.slackGetChannelMessagesDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = exports.asanaUpdateTaskDefinition = exports.asanaCreateTaskDefinition = exports.asanaCommentTaskDefinition = exports.genericFillTemplateDefinition = void 0;
4
- exports.githubListPullRequestsDefinition = exports.githubCreatePullRequestDefinition = exports.githubCreateBranchDefinition = exports.githubCreateOrUpdateFileDefinition = exports.microsoftGetDocumentDefinition = exports.microsoftMessageTeamsChannelDefinition = exports.microsoftMessageTeamsChatDefinition = exports.microsoftUpdateSpreadsheetDefinition = exports.microsoftUpdateDocumentDefinition = exports.microsoftCreateDocumentDefinition = exports.salesforceFetchSalesforceSchemaByObjectDefinition = exports.salesforceGetRecordDefinition = exports.salesforceGetSalesforceRecordsByQueryDefinition = exports.salesforceGenerateSalesReportDefinition = exports.salesforceCreateCaseDefinition = exports.salesforceUpdateRecordDefinition = exports.ashbyUpdateCandidateDefinition = exports.ashbyCreateCandidateDefinition = exports.ashbyListCandidateNotesDefinition = exports.ashbySearchCandidatesDefinition = exports.ashbyListCandidatesDefinition = void 0;
4
+ exports.githubListPullRequestsDefinition = exports.githubCreatePullRequestDefinition = exports.githubCreateBranchDefinition = exports.githubCreateOrUpdateFileDefinition = exports.microsoftGetDocumentDefinition = exports.microsoftMessageTeamsChannelDefinition = exports.microsoftMessageTeamsChatDefinition = exports.microsoftUpdateSpreadsheetDefinition = exports.microsoftUpdateDocumentDefinition = exports.microsoftCreateDocumentDefinition = exports.salesforceFetchSalesforceSchemaByObjectDefinition = exports.salesforceGetRecordDefinition = exports.salesforceGetSalesforceRecordsByQueryDefinition = exports.salesforceGenerateSalesReportDefinition = exports.salesforceCreateCaseDefinition = exports.salesforceCreateRecordDefinition = exports.salesforceUpdateRecordDefinition = exports.ashbyUpdateCandidateDefinition = exports.ashbyCreateCandidateDefinition = exports.ashbyListCandidateNotesDefinition = exports.ashbySearchCandidatesDefinition = exports.ashbyListCandidatesDefinition = void 0;
5
5
  exports.genericFillTemplateDefinition = {
6
6
  description: "Simple utility that takes a template and returns it filled in",
7
7
  scopes: [],
@@ -213,6 +213,20 @@ exports.slackSendMessageDefinition = {
213
213
  },
214
214
  },
215
215
  },
216
+ output: {
217
+ type: "object",
218
+ required: ["success"],
219
+ properties: {
220
+ success: {
221
+ type: "boolean",
222
+ description: "Whether the email was sent successfully",
223
+ },
224
+ error: {
225
+ type: "string",
226
+ description: "The error that occurred if the email was not sent successfully",
227
+ },
228
+ },
229
+ },
216
230
  name: "sendMessage",
217
231
  provider: "slack",
218
232
  };
@@ -5319,6 +5333,47 @@ exports.salesforceUpdateRecordDefinition = {
5319
5333
  name: "updateRecord",
5320
5334
  provider: "salesforce",
5321
5335
  };
5336
+ exports.salesforceCreateRecordDefinition = {
5337
+ description: "Create a record in Salesforce",
5338
+ scopes: [],
5339
+ parameters: {
5340
+ type: "object",
5341
+ required: ["objectType", "fieldsToCreate"],
5342
+ properties: {
5343
+ objectType: {
5344
+ type: "string",
5345
+ description: "The Salesforce object type to create (e.g., Lead, Account, Contact)",
5346
+ },
5347
+ fieldsToCreate: {
5348
+ type: "object",
5349
+ description: "The fields to create on the record",
5350
+ additionalProperties: {
5351
+ type: "string",
5352
+ },
5353
+ },
5354
+ },
5355
+ },
5356
+ output: {
5357
+ type: "object",
5358
+ required: ["success"],
5359
+ properties: {
5360
+ success: {
5361
+ type: "boolean",
5362
+ description: "Whether the record was successfully created",
5363
+ },
5364
+ recordId: {
5365
+ type: "string",
5366
+ description: "The ID of the created object",
5367
+ },
5368
+ error: {
5369
+ type: "string",
5370
+ description: "The error that occurred if the record was not successfully created",
5371
+ },
5372
+ },
5373
+ },
5374
+ name: "createRecord",
5375
+ provider: "salesforce",
5376
+ };
5322
5377
  exports.salesforceCreateCaseDefinition = {
5323
5378
  description: "Create a case or support ticket in Salesforce",
5324
5379
  scopes: [],
@@ -207,7 +207,16 @@ export declare const slackSendMessageParamsSchema: z.ZodObject<{
207
207
  channelName: string;
208
208
  }>;
209
209
  export type slackSendMessageParamsType = z.infer<typeof slackSendMessageParamsSchema>;
210
- export declare const slackSendMessageOutputSchema: z.ZodVoid;
210
+ export declare const slackSendMessageOutputSchema: z.ZodObject<{
211
+ success: z.ZodBoolean;
212
+ error: z.ZodOptional<z.ZodString>;
213
+ }, "strip", z.ZodTypeAny, {
214
+ success: boolean;
215
+ error?: string | undefined;
216
+ }, {
217
+ success: boolean;
218
+ error?: string | undefined;
219
+ }>;
211
220
  export type slackSendMessageOutputType = z.infer<typeof slackSendMessageOutputSchema>;
212
221
  export type slackSendMessageFunction = ActionFunction<slackSendMessageParamsType, AuthParamsType, slackSendMessageOutputType>;
213
222
  export declare const slackListConversationsParamsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
@@ -2380,6 +2389,32 @@ export declare const salesforceUpdateRecordOutputSchema: z.ZodObject<{
2380
2389
  }>;
2381
2390
  export type salesforceUpdateRecordOutputType = z.infer<typeof salesforceUpdateRecordOutputSchema>;
2382
2391
  export type salesforceUpdateRecordFunction = ActionFunction<salesforceUpdateRecordParamsType, AuthParamsType, salesforceUpdateRecordOutputType>;
2392
+ export declare const salesforceCreateRecordParamsSchema: z.ZodObject<{
2393
+ objectType: z.ZodString;
2394
+ fieldsToCreate: z.ZodRecord<z.ZodString, z.ZodString>;
2395
+ }, "strip", z.ZodTypeAny, {
2396
+ objectType: string;
2397
+ fieldsToCreate: Record<string, string>;
2398
+ }, {
2399
+ objectType: string;
2400
+ fieldsToCreate: Record<string, string>;
2401
+ }>;
2402
+ export type salesforceCreateRecordParamsType = z.infer<typeof salesforceCreateRecordParamsSchema>;
2403
+ export declare const salesforceCreateRecordOutputSchema: z.ZodObject<{
2404
+ success: z.ZodBoolean;
2405
+ recordId: z.ZodOptional<z.ZodString>;
2406
+ error: z.ZodOptional<z.ZodString>;
2407
+ }, "strip", z.ZodTypeAny, {
2408
+ success: boolean;
2409
+ error?: string | undefined;
2410
+ recordId?: string | undefined;
2411
+ }, {
2412
+ success: boolean;
2413
+ error?: string | undefined;
2414
+ recordId?: string | undefined;
2415
+ }>;
2416
+ export type salesforceCreateRecordOutputType = z.infer<typeof salesforceCreateRecordOutputSchema>;
2417
+ export type salesforceCreateRecordFunction = ActionFunction<salesforceCreateRecordParamsType, AuthParamsType, salesforceCreateRecordOutputType>;
2383
2418
  export declare const salesforceCreateCaseParamsSchema: z.ZodObject<{
2384
2419
  subject: z.ZodString;
2385
2420
  description: z.ZodString;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.zendeskAddCommentToTicketParamsSchema = exports.zendeskUpdateTicketStatusOutputSchema = exports.zendeskUpdateTicketStatusParamsSchema = exports.zendeskGetTicketDetailsOutputSchema = exports.zendeskGetTicketDetailsParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchRestaurantsOutputSchema = exports.googlemapsNearbysearchRestaurantsParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.jiraGetJiraIssuesByQueryOutputSchema = exports.jiraGetJiraIssuesByQueryParamsSchema = exports.jiraUpdateJiraTicketStatusOutputSchema = exports.jiraUpdateJiraTicketStatusParamsSchema = exports.jiraUpdateJiraTicketDetailsOutputSchema = exports.jiraUpdateJiraTicketDetailsParamsSchema = exports.jiraGetJiraTicketHistoryOutputSchema = exports.jiraGetJiraTicketHistoryParamsSchema = exports.jiraGetJiraTicketDetailsOutputSchema = exports.jiraGetJiraTicketDetailsParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.jiraCommentJiraTicketOutputSchema = exports.jiraCommentJiraTicketParamsSchema = exports.jiraAssignJiraTicketOutputSchema = exports.jiraAssignJiraTicketParamsSchema = exports.confluenceFetchPageContentOutputSchema = exports.confluenceFetchPageContentParamsSchema = exports.confluenceOverwritePageOutputSchema = exports.confluenceOverwritePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackGetChannelMessagesOutputSchema = exports.slackGetChannelMessagesParamsSchema = exports.slackListConversationsOutputSchema = exports.slackListConversationsParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.asanaUpdateTaskOutputSchema = exports.asanaUpdateTaskParamsSchema = exports.asanaCreateTaskOutputSchema = exports.asanaCreateTaskParamsSchema = exports.asanaCommentTaskOutputSchema = exports.asanaCommentTaskParamsSchema = exports.genericFillTemplateOutputSchema = exports.genericFillTemplateParamsSchema = exports.AuthParamsSchema = void 0;
4
4
  exports.ashbyAddCandidateToProjectParamsSchema = exports.ashbyGetCandidateInfoOutputSchema = exports.ashbyGetCandidateInfoParamsSchema = exports.ashbyCreateNoteOutputSchema = exports.ashbyCreateNoteParamsSchema = exports.lookerEnableUserByEmailOutputSchema = exports.lookerEnableUserByEmailParamsSchema = exports.finnhubGetBasicFinancialsOutputSchema = exports.finnhubGetBasicFinancialsParamsSchema = exports.finnhubSymbolLookupOutputSchema = exports.finnhubSymbolLookupParamsSchema = exports.googleOauthUpdatePresentationOutputSchema = exports.googleOauthUpdatePresentationParamsSchema = exports.googleOauthCreatePresentationOutputSchema = exports.googleOauthCreatePresentationParamsSchema = exports.googleOauthUpdateSpreadsheetOutputSchema = exports.googleOauthUpdateSpreadsheetParamsSchema = exports.googleOauthCreateSpreadsheetOutputSchema = exports.googleOauthCreateSpreadsheetParamsSchema = exports.googleOauthScheduleCalendarMeetingOutputSchema = exports.googleOauthScheduleCalendarMeetingParamsSchema = exports.googleOauthUpdateDocOutputSchema = exports.googleOauthUpdateDocParamsSchema = exports.googleOauthCreateNewGoogleDocOutputSchema = exports.googleOauthCreateNewGoogleDocParamsSchema = exports.resendSendEmailOutputSchema = exports.resendSendEmailParamsSchema = exports.firecrawlScrapeTweetDataWithNitterOutputSchema = exports.firecrawlScrapeTweetDataWithNitterParamsSchema = exports.firecrawlScrapeUrlOutputSchema = exports.firecrawlScrapeUrlParamsSchema = exports.firecrawlDeepResearchOutputSchema = exports.firecrawlDeepResearchParamsSchema = exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeRunSnowflakeQueryOutputSchema = exports.snowflakeRunSnowflakeQueryParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.xCreateShareXPostUrlOutputSchema = exports.xCreateShareXPostUrlParamsSchema = exports.linkedinCreateShareLinkedinPostUrlOutputSchema = exports.linkedinCreateShareLinkedinPostUrlParamsSchema = exports.zendeskAssignTicketOutputSchema = exports.zendeskAssignTicketParamsSchema = exports.zendeskAddCommentToTicketOutputSchema = void 0;
5
- exports.githubListPullRequestsOutputSchema = exports.githubListPullRequestsParamsSchema = exports.githubCreatePullRequestOutputSchema = exports.githubCreatePullRequestParamsSchema = exports.githubCreateBranchOutputSchema = exports.githubCreateBranchParamsSchema = exports.githubCreateOrUpdateFileOutputSchema = exports.githubCreateOrUpdateFileParamsSchema = exports.microsoftGetDocumentOutputSchema = exports.microsoftGetDocumentParamsSchema = exports.microsoftMessageTeamsChannelOutputSchema = exports.microsoftMessageTeamsChannelParamsSchema = exports.microsoftMessageTeamsChatOutputSchema = exports.microsoftMessageTeamsChatParamsSchema = exports.microsoftUpdateSpreadsheetOutputSchema = exports.microsoftUpdateSpreadsheetParamsSchema = exports.microsoftUpdateDocumentOutputSchema = exports.microsoftUpdateDocumentParamsSchema = exports.microsoftCreateDocumentOutputSchema = exports.microsoftCreateDocumentParamsSchema = exports.salesforceFetchSalesforceSchemaByObjectOutputSchema = exports.salesforceFetchSalesforceSchemaByObjectParamsSchema = exports.salesforceGetRecordOutputSchema = exports.salesforceGetRecordParamsSchema = exports.salesforceGetSalesforceRecordsByQueryOutputSchema = exports.salesforceGetSalesforceRecordsByQueryParamsSchema = exports.salesforceGenerateSalesReportOutputSchema = exports.salesforceGenerateSalesReportParamsSchema = exports.salesforceCreateCaseOutputSchema = exports.salesforceCreateCaseParamsSchema = exports.salesforceUpdateRecordOutputSchema = exports.salesforceUpdateRecordParamsSchema = exports.ashbyUpdateCandidateOutputSchema = exports.ashbyUpdateCandidateParamsSchema = exports.ashbyCreateCandidateOutputSchema = exports.ashbyCreateCandidateParamsSchema = exports.ashbyListCandidateNotesOutputSchema = exports.ashbyListCandidateNotesParamsSchema = exports.ashbySearchCandidatesOutputSchema = exports.ashbySearchCandidatesParamsSchema = exports.ashbyListCandidatesOutputSchema = exports.ashbyListCandidatesParamsSchema = exports.ashbyAddCandidateToProjectOutputSchema = void 0;
5
+ exports.githubListPullRequestsOutputSchema = exports.githubListPullRequestsParamsSchema = exports.githubCreatePullRequestOutputSchema = exports.githubCreatePullRequestParamsSchema = exports.githubCreateBranchOutputSchema = exports.githubCreateBranchParamsSchema = exports.githubCreateOrUpdateFileOutputSchema = exports.githubCreateOrUpdateFileParamsSchema = exports.microsoftGetDocumentOutputSchema = exports.microsoftGetDocumentParamsSchema = exports.microsoftMessageTeamsChannelOutputSchema = exports.microsoftMessageTeamsChannelParamsSchema = exports.microsoftMessageTeamsChatOutputSchema = exports.microsoftMessageTeamsChatParamsSchema = exports.microsoftUpdateSpreadsheetOutputSchema = exports.microsoftUpdateSpreadsheetParamsSchema = exports.microsoftUpdateDocumentOutputSchema = exports.microsoftUpdateDocumentParamsSchema = exports.microsoftCreateDocumentOutputSchema = exports.microsoftCreateDocumentParamsSchema = exports.salesforceFetchSalesforceSchemaByObjectOutputSchema = exports.salesforceFetchSalesforceSchemaByObjectParamsSchema = exports.salesforceGetRecordOutputSchema = exports.salesforceGetRecordParamsSchema = exports.salesforceGetSalesforceRecordsByQueryOutputSchema = exports.salesforceGetSalesforceRecordsByQueryParamsSchema = exports.salesforceGenerateSalesReportOutputSchema = exports.salesforceGenerateSalesReportParamsSchema = exports.salesforceCreateCaseOutputSchema = exports.salesforceCreateCaseParamsSchema = exports.salesforceCreateRecordOutputSchema = exports.salesforceCreateRecordParamsSchema = exports.salesforceUpdateRecordOutputSchema = exports.salesforceUpdateRecordParamsSchema = exports.ashbyUpdateCandidateOutputSchema = exports.ashbyUpdateCandidateParamsSchema = exports.ashbyCreateCandidateOutputSchema = exports.ashbyCreateCandidateParamsSchema = exports.ashbyListCandidateNotesOutputSchema = exports.ashbyListCandidateNotesParamsSchema = exports.ashbySearchCandidatesOutputSchema = exports.ashbySearchCandidatesParamsSchema = exports.ashbyListCandidatesOutputSchema = exports.ashbyListCandidatesParamsSchema = exports.ashbyAddCandidateToProjectOutputSchema = void 0;
6
6
  const zod_1 = require("zod");
7
7
  exports.AuthParamsSchema = zod_1.z.object({
8
8
  authToken: zod_1.z.string().optional(),
@@ -78,7 +78,10 @@ exports.slackSendMessageParamsSchema = zod_1.z.object({
78
78
  channelName: zod_1.z.string().describe("The name of the Slack channel to send the message to (e.g. general, alerts)"),
79
79
  message: zod_1.z.string().describe("The message content to send to Slack. Can include markdown formatting."),
80
80
  });
81
- exports.slackSendMessageOutputSchema = zod_1.z.void();
81
+ exports.slackSendMessageOutputSchema = zod_1.z.object({
82
+ success: zod_1.z.boolean().describe("Whether the email was sent successfully"),
83
+ error: zod_1.z.string().describe("The error that occurred if the email was not sent successfully").optional(),
84
+ });
82
85
  exports.slackListConversationsParamsSchema = zod_1.z.object({});
83
86
  exports.slackListConversationsOutputSchema = zod_1.z.object({
84
87
  channels: zod_1.z
@@ -2123,6 +2126,15 @@ exports.salesforceUpdateRecordOutputSchema = zod_1.z.object({
2123
2126
  success: zod_1.z.boolean().describe("Whether the record was successfully updated"),
2124
2127
  error: zod_1.z.string().describe("The error that occurred if the record was not successfully updated").optional(),
2125
2128
  });
2129
+ exports.salesforceCreateRecordParamsSchema = zod_1.z.object({
2130
+ objectType: zod_1.z.string().describe("The Salesforce object type to create (e.g., Lead, Account, Contact)"),
2131
+ fieldsToCreate: zod_1.z.record(zod_1.z.string()).describe("The fields to create on the record"),
2132
+ });
2133
+ exports.salesforceCreateRecordOutputSchema = zod_1.z.object({
2134
+ success: zod_1.z.boolean().describe("Whether the record was successfully created"),
2135
+ recordId: zod_1.z.string().describe("The ID of the created object").optional(),
2136
+ error: zod_1.z.string().describe("The error that occurred if the record was not successfully created").optional(),
2137
+ });
2126
2138
  exports.salesforceCreateCaseParamsSchema = zod_1.z.object({
2127
2139
  subject: zod_1.z.string().describe("The subject of the case"),
2128
2140
  description: zod_1.z.string().describe("The detailed description of the case"),
@@ -111,6 +111,7 @@ exports.ACTION_GROUPS = {
111
111
  description: "Actions for interacting with Salesforce",
112
112
  actions: [
113
113
  templates_1.salesforceUpdateRecordDefinition,
114
+ templates_1.salesforceCreateRecordDefinition,
114
115
  templates_1.salesforceCreateCaseDefinition,
115
116
  templates_1.salesforceGenerateSalesReportDefinition,
116
117
  templates_1.salesforceGetRecordDefinition,
@@ -131,6 +132,11 @@ exports.ACTION_GROUPS = {
131
132
  },
132
133
  GITHUB: {
133
134
  description: "Actions for interacting with GitHub",
134
- actions: [templates_1.githubCreateOrUpdateFileDefinition, templates_1.githubCreateBranchDefinition, templates_1.githubCreatePullRequestDefinition],
135
+ actions: [
136
+ templates_1.githubCreateOrUpdateFileDefinition,
137
+ templates_1.githubCreateBranchDefinition,
138
+ templates_1.githubCreatePullRequestDefinition,
139
+ templates_1.githubListPullRequestsDefinition,
140
+ ],
135
141
  },
136
142
  };
@@ -0,0 +1,3 @@
1
+ import type { salesforceCreateRecordFunction } from "../../autogen/types";
2
+ declare const createRecord: salesforceCreateRecordFunction;
3
+ export default createRecord;
@@ -0,0 +1,43 @@
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
+ const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ const { authToken, baseUrl } = authParams;
15
+ const { objectType, fieldsToCreate } = params;
16
+ if (!authToken || !baseUrl) {
17
+ return {
18
+ success: false,
19
+ error: "authToken and baseUrl are required for Salesforce API",
20
+ };
21
+ }
22
+ const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/`;
23
+ try {
24
+ const response = yield axiosClient_1.axiosClient.post(url, fieldsToCreate, {
25
+ headers: {
26
+ Authorization: `Bearer ${authToken}`,
27
+ "Content-Type": "application/json",
28
+ },
29
+ });
30
+ return {
31
+ success: true,
32
+ recordId: response.data.id,
33
+ };
34
+ }
35
+ catch (error) {
36
+ console.error("Error creating Salesforce object:", error);
37
+ return {
38
+ success: false,
39
+ error: error instanceof Error ? error.message : "An unknown error occurred",
40
+ };
41
+ }
42
+ });
43
+ exports.default = createRecord;
@@ -0,0 +1,3 @@
1
+ import { salesforceGetSalesforceRecordsByQueryFunction } from "../../autogen/types";
2
+ declare const getSalesforceRecordByQuery: salesforceGetSalesforceRecordsByQueryFunction;
3
+ export default getSalesforceRecordByQuery;
@@ -0,0 +1,43 @@
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
+ const getSalesforceRecordByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ const { authToken, baseUrl } = authParams;
15
+ const { query, limit } = params;
16
+ if (!authToken || !baseUrl) {
17
+ return {
18
+ success: false,
19
+ error: "authToken and baseUrl are required for Salesforce API",
20
+ };
21
+ }
22
+ // The API limits the maximum number of records returned to 2000, the limit lets the user set a smaller custom limit
23
+ const url = `${baseUrl}/services/data/v56.0/query/?q=${encodeURIComponent(query + " LIMIT " + (limit != undefined && limit <= 2000 ? limit : 2000))}`;
24
+ try {
25
+ const response = yield axiosClient_1.axiosClient.get(url, {
26
+ headers: {
27
+ Authorization: `Bearer ${authToken}`,
28
+ },
29
+ });
30
+ return {
31
+ success: true,
32
+ records: response.data,
33
+ };
34
+ }
35
+ catch (error) {
36
+ console.error("Error retrieving Salesforce record:", error);
37
+ return {
38
+ success: false,
39
+ error: error instanceof Error ? error.message : "An unknown error occurred",
40
+ };
41
+ }
42
+ });
43
+ exports.default = getSalesforceRecordByQuery;
@@ -1,3 +1,3 @@
1
- import type { slackSendMessageFunction } from "../../autogen/types";
1
+ import { type slackSendMessageFunction } from "../../autogen/types";
2
2
  declare const sendMessage: slackSendMessageFunction;
3
3
  export default sendMessage;
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const web_api_1 = require("@slack/web-api");
13
+ const types_1 = require("../../autogen/types");
13
14
  const helpers_1 = require("./helpers");
14
15
  const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
16
  const client = new web_api_1.WebClient(authParams.authToken);
@@ -19,18 +20,28 @@ const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
19
20
  if (!channel || !channel.id) {
20
21
  throw Error(`Channel with name ${channelName} not found`);
21
22
  }
22
- yield client.chat.postMessage({
23
- channel: channel.id,
24
- blocks: [
25
- {
26
- type: "section",
27
- text: {
28
- type: "mrkdwn",
29
- text: message,
23
+ try {
24
+ yield client.chat.postMessage({
25
+ channel: channel.id,
26
+ blocks: [
27
+ {
28
+ type: "section",
29
+ text: {
30
+ type: "mrkdwn",
31
+ text: message,
32
+ },
30
33
  },
31
- },
32
- ],
33
- });
34
- return;
34
+ ],
35
+ });
36
+ return types_1.slackSendMessageOutputSchema.parse({
37
+ success: true,
38
+ });
39
+ }
40
+ catch (error) {
41
+ return types_1.slackSendMessageOutputSchema.parse({
42
+ success: false,
43
+ error: error instanceof Error ? error.message : "Unknown error",
44
+ });
45
+ }
35
46
  });
36
47
  exports.default = sendMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.53",
3
+ "version": "0.1.55",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,3 +0,0 @@
1
- import { confluenceUpdatePageFunction } from "../../../actions/autogen/types";
2
- declare const confluenceUpdatePage: confluenceUpdatePageFunction;
3
- export default confluenceUpdatePage;
@@ -1,47 +0,0 @@
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;
@@ -1,23 +0,0 @@
1
- declare const axios: any;
2
- declare const WORKDAY_BASE_URL = "https://your-workday-url/ccx/service/YOUR_TENANT/Absence_Management/v43.2";
3
- declare const TOKEN_URL = "https://your-workday-url/oauth2/YOUR_TENANT/token";
4
- declare const CLIENT_ID = "your-client-id";
5
- declare const CLIENT_SECRET = "your-client-secret";
6
- /**
7
- * Fetches an OAuth 2.0 access token from Workday.
8
- */
9
- declare function getAccessToken(): Promise<any>;
10
- /**
11
- * Submits a time-off request to Workday.
12
- * @param {Object} params - Time-off details.
13
- * @param {string} params.workerId - Worker's ID in Workday.
14
- * @param {string} params.startDate - Start date (YYYY-MM-DD).
15
- * @param {string} params.endDate - End date (YYYY-MM-DD).
16
- * @param {string} params.timeOffType - Time-off type (e.g., "SICK_LEAVE").
17
- */
18
- declare function submitTimeOff({ workerId, startDate, endDate, timeOffType }: {
19
- workerId: any;
20
- startDate: any;
21
- endDate: any;
22
- timeOffType: any;
23
- }): Promise<any>;
@@ -1,88 +0,0 @@
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
- const axios = require("axios");
12
- const WORKDAY_BASE_URL = "https://your-workday-url/ccx/service/YOUR_TENANT/Absence_Management/v43.2";
13
- const TOKEN_URL = "https://your-workday-url/oauth2/YOUR_TENANT/token"; // OAuth token endpoint
14
- const CLIENT_ID = "your-client-id";
15
- const CLIENT_SECRET = "your-client-secret";
16
- /**
17
- * Fetches an OAuth 2.0 access token from Workday.
18
- */
19
- function getAccessToken() {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- var _a;
22
- try {
23
- const response = yield axios.post(TOKEN_URL, new URLSearchParams({ grant_type: "client_credentials" }), {
24
- auth: {
25
- username: CLIENT_ID,
26
- password: CLIENT_SECRET
27
- },
28
- headers: { "Content-Type": "application/x-www-form-urlencoded" }
29
- });
30
- return response.data.access_token;
31
- }
32
- catch (error) {
33
- console.error("Error fetching access token:", ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || error.message);
34
- throw error;
35
- }
36
- });
37
- }
38
- /**
39
- * Submits a time-off request to Workday.
40
- * @param {Object} params - Time-off details.
41
- * @param {string} params.workerId - Worker's ID in Workday.
42
- * @param {string} params.startDate - Start date (YYYY-MM-DD).
43
- * @param {string} params.endDate - End date (YYYY-MM-DD).
44
- * @param {string} params.timeOffType - Time-off type (e.g., "SICK_LEAVE").
45
- */
46
- function submitTimeOff(_a) {
47
- return __awaiter(this, arguments, void 0, function* ({ workerId, startDate, endDate, timeOffType }) {
48
- var _b;
49
- try {
50
- const token = yield getAccessToken(); // Get OAuth token
51
- const requestBody = {
52
- "wd:Enter_Time_Off_Request": {
53
- "wd:Worker_Reference": {
54
- "wd:ID": [{ "_": workerId, "$": { "wd:type": "WID" } }]
55
- },
56
- "wd:Time_Off_Entries": [
57
- {
58
- "wd:Start_Date": startDate,
59
- "wd:End_Date": endDate,
60
- "wd:Time_Off_Type_Reference": {
61
- "wd:ID": [{ "_": timeOffType, "$": { "wd:type": "Time_Off_Type_ID" } }]
62
- }
63
- }
64
- ]
65
- }
66
- };
67
- const response = yield axios.post(`${WORKDAY_BASE_URL}/Enter_Time_Off`, requestBody, {
68
- headers: {
69
- "Authorization": `Bearer ${token}`,
70
- "Content-Type": "application/json"
71
- }
72
- });
73
- console.log("Time-off request submitted successfully:", response.data);
74
- return response.data;
75
- }
76
- catch (error) {
77
- console.error("Error submitting time-off request:", ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) || error.message);
78
- throw error;
79
- }
80
- });
81
- }
82
- // Example Usage:
83
- submitTimeOff({
84
- workerId: "12345",
85
- startDate: "2025-03-10",
86
- endDate: "2025-03-12",
87
- timeOffType: "SICK_LEAVE"
88
- }).then(console.log).catch(console.error);