@credal/actions 0.1.54 → 0.1.56

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: [],
@@ -5333,6 +5333,47 @@ exports.salesforceUpdateRecordDefinition = {
5333
5333
  name: "updateRecord",
5334
5334
  provider: "salesforce",
5335
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
+ };
5336
5377
  exports.salesforceCreateCaseDefinition = {
5337
5378
  description: "Create a case or support ticket in Salesforce",
5338
5379
  scopes: [],
@@ -2389,6 +2389,32 @@ export declare const salesforceUpdateRecordOutputSchema: z.ZodObject<{
2389
2389
  }>;
2390
2390
  export type salesforceUpdateRecordOutputType = z.infer<typeof salesforceUpdateRecordOutputSchema>;
2391
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>;
2392
2418
  export declare const salesforceCreateCaseParamsSchema: z.ZodObject<{
2393
2419
  subject: z.ZodString;
2394
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(),
@@ -2126,6 +2126,15 @@ exports.salesforceUpdateRecordOutputSchema = zod_1.z.object({
2126
2126
  success: zod_1.z.boolean().describe("Whether the record was successfully updated"),
2127
2127
  error: zod_1.z.string().describe("The error that occurred if the record was not successfully updated").optional(),
2128
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
+ });
2129
2138
  exports.salesforceCreateCaseParamsSchema = zod_1.z.object({
2130
2139
  subject: zod_1.z.string().describe("The subject of the case"),
2131
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,
@@ -16,10 +16,8 @@ const axios_1 = __importDefault(require("axios"));
16
16
  const types_1 = require("../../autogen/types");
17
17
  const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
18
  const { authToken } = authParams;
19
- const { repositoryName, repositoryOwner } = params;
19
+ const { repositoryName, repositoryOwner, state } = params;
20
20
  const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/pulls`;
21
- const oneYearAgo = new Date();
22
- oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
23
21
  const allPulls = [];
24
22
  let page = 1;
25
23
  const perPage = 100;
@@ -31,7 +29,7 @@ const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
31
29
  "X-GitHub-Api-Version": "2022-11-28",
32
30
  },
33
31
  params: {
34
- state: "all",
32
+ state: state !== null && state !== void 0 ? state : "all",
35
33
  sort: "created",
36
34
  direction: "desc",
37
35
  per_page: perPage,
@@ -41,11 +39,9 @@ const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
41
39
  const pulls = response.data;
42
40
  if (pulls.length === 0)
43
41
  break;
44
- // Filter by date
45
- const recentPulls = pulls.filter(pr => pr.createdAt && new Date(pr.createdAt) >= oneYearAgo);
46
- allPulls.push(...recentPulls);
42
+ allPulls.push(...pulls);
47
43
  // Stop if the rest are older than one year
48
- if (recentPulls.length < pulls.length)
44
+ if (pulls.length < perPage)
49
45
  break;
50
46
  page++;
51
47
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",