UNPKG

@rudderstack/integrations-lib

Version:

A comprehensive TypeScript library providing shared utilities, SDKs, and tools for RudderStack integrations and destinations.

46 lines 1.66 kB
import * as jsforce from 'jsforce'; import { SalesforceAuthObject, SalesforceConfig, SOQLResult } from './types'; /** * Salesforce SDK using jsforce * Provides type-safe SOQL queries and SObject create/update operations */ export default class Salesforce { private connection; /** * Initialize Salesforce SDK with access token and instance URL * @param authObject - Authentication object containing accessToken and instanceUrl * @param config - Optional configuration including API version */ constructor(authObject: SalesforceAuthObject, config?: SalesforceConfig); /** * Validate authentication object * @param authObject - Authentication object to validate * @throws Error if validation fails */ private validateAuthObject; /** * Execute SOQL query and return type-safe results * @param soql - SOQL query string * @param recordType - Optional type parameter for type-safe record results * @returns Promise resolving to SOQL result with typed records * @example * ```typescript * interface Account { * Id: string; * Name: string; * attributes: { * type: string; * url: string; * }; * } * const result = await sdk.query<Account>('SELECT Id, Name, Industry FROM Account LIMIT 10'); * ``` */ query<T extends Record<string, unknown>>(soql: string): Promise<SOQLResult<T>>; /** * Get the underlying jsforce connection (for advanced use cases) * @returns jsforce Connection instance */ getConnection(): jsforce.Connection; } //# sourceMappingURL=salesforce.d.ts.map