/** * Salesforce client types. */ import type { z } from "zod"; import type { BaseIntegrationClient } from "../../types.js"; import type { TraceMetadata } from "../registry.js"; /** * Salesforce CRUD action identifiers matching proto CrudAction enum. */ export type SalesforceCrudAction = "CRUD_ACTION_CREATE" | "CRUD_ACTION_UPDATE" | "CRUD_ACTION_DELETE" | "CRUD_ACTION_READ"; /** * Salesforce bulk action identifiers matching proto BulkAction enum. */ export type SalesforceBulkAction = "BULK_ACTION_CREATE" | "BULK_ACTION_UPDATE" | "BULK_ACTION_DELETE" | "BULK_ACTION_UPSERT"; /** * Salesforce client for SOQL queries, CRUD, and bulk operations. * * Provides methods for querying, creating, updating, and deleting * Salesforce objects with schema validation. * * @example * ```typescript * // Declare in api(): integrations: { sf: salesforce(INTEGRATION_ID) } * // In run(), access via ctx.integrations.sf * * // SOQL query * const accounts = await ctx.integrations.sf.query( * 'SELECT Id, Name FROM Account LIMIT 10', * z.object({ Id: z.string(), Name: z.string() }) * ); * * // Create a record * await ctx.integrations.sf.create('Account', { Name: 'Acme Corp', Industry: 'Tech' }); * * // Read a record * const account = await ctx.integrations.sf.read('Account', '001xx000003DGb2AAG', * z.object({ Id: z.string(), Name: z.string() }) * ); * * // Update a record * await ctx.integrations.sf.update('Account', '001xx000003DGb2AAG', { Name: 'New Name' }); * * // Delete a record * await ctx.integrations.sf.remove('Account', '001xx000003DGb2AAG'); * * // Bulk upsert * await ctx.integrations.sf.bulkUpsert('Account', [{ Name: 'A' }, { Name: 'B' }], 'ExternalId__c'); * ``` */ export interface SalesforceClient extends BaseIntegrationClient { /** * Execute a SOQL query and validate the results. * * @param soql - The SOQL query string * @param schema - Zod schema for validating each row in the result * @returns Array of validated records */ query(soql: string, schema: z.ZodSchema, metadata?: TraceMetadata): Promise; /** * Create a new Salesforce object. * * @param resourceType - Salesforce object type (e.g., 'Account', 'Contact') * @param body - Object fields as key-value pairs * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from Salesforce */ create(resourceType: string, body: Record, metadata?: TraceMetadata): Promise; /** * Read a single Salesforce object by ID. * * @param resourceType - Salesforce object type (e.g., 'Account', 'Contact') * @param resourceId - The record ID * @param schema - Zod schema for validating the result * @param metadata - Optional trace metadata for diagnostics * @returns The validated record */ read(resourceType: string, resourceId: string, schema: z.ZodSchema, metadata?: TraceMetadata): Promise; /** * Update a Salesforce object by ID. * * @param resourceType - Salesforce object type (e.g., 'Account', 'Contact') * @param resourceId - The record ID * @param body - Fields to update as key-value pairs * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from Salesforce */ update(resourceType: string, resourceId: string, body: Record, metadata?: TraceMetadata): Promise; /** * Delete a Salesforce object by ID. * * @param resourceType - Salesforce object type (e.g., 'Account', 'Contact') * @param resourceId - The record ID * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from Salesforce */ remove(resourceType: string, resourceId: string, metadata?: TraceMetadata): Promise; /** * Bulk create multiple Salesforce objects. * * @param resourceType - Salesforce object type * @param records - Array of objects to create * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from Salesforce */ bulkCreate(resourceType: string, records: Array>, metadata?: TraceMetadata): Promise; /** * Bulk update multiple Salesforce objects. * * @param resourceType - Salesforce object type * @param records - Array of objects to update (must include Id field) * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from Salesforce */ bulkUpdate(resourceType: string, records: Array>, metadata?: TraceMetadata): Promise; /** * Bulk delete multiple Salesforce objects. * * @param resourceType - Salesforce object type * @param records - Array of objects to delete (must include Id field) * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from Salesforce */ bulkDelete(resourceType: string, records: Array>, metadata?: TraceMetadata): Promise; /** * Bulk upsert (create or update) multiple Salesforce objects. * * @param resourceType - Salesforce object type * @param records - Array of objects to upsert * @param externalId - External ID field name used for matching * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from Salesforce */ bulkUpsert(resourceType: string, records: Array>, externalId: string, metadata?: TraceMetadata): Promise; } //# sourceMappingURL=types.d.ts.map