vlocode-project - v2.4.3
    Preparing search index...

    Class SalesforceSchemaService

    Provides access to Database Schema methods like describe.

    Implements

    Index

    Constructors

    Properties

    connectionProvider: SalesforceConnectionProvider
    fieldMatchingStrategies: ((field: Field, name: string) => boolean)[] = ...
    logger: Logger
    nsService: NamespaceService
    schemaAccess: CompositeSchemaAccess

    Methods

    • Filters a list of Salesforce IDs based on the provided filter function.

      This method groups IDs by their 3-character prefix, determines the corresponding SObject type for each prefix, and then applies the filter function to each ID based on its SObject type.

      Parameters

      • ids: string | string[]

        A single Salesforce ID or an array of Salesforce IDs to filter

      • predicate: (type: DescribeSObjectResult, id: string) => boolean

        A function that determines whether an ID should be included based on its SObject type

      Returns Promise<string[]>

      A Promise that resolves to an array of filtered Salesforce IDs

      // Filter only Contact IDs
      const contactIds = await filterIds(mixedIds, (type) => type.name === 'Contact');
    • Retrieves the API name of the name field for a specific Salesforce object type.

      Parameters

      • type: string

        The API name of the Salesforce object type (e.g., 'Account', 'Contact')

      Returns Promise<string | undefined>

      A Promise that resolves to the API name of the name field, or undefined if no name field is found

    • Gets the SObject describe for a given SObject type; returns undefined when the SObject is not accessible for the current user, this does not check if the SObject is actually defined but only if it's accessible through the describe API, this means that for objects that are not accessible for the current user this method will return undefined even when they are actually defined in the org.

      Parameters

      • type: string

        Type of SObject

      Returns Promise<DescribeGlobalSObjectResult | undefined>

      the SObject describe when the SObject is accessible for the current user otherwise undefined; when undefined is returned it can either mean that the SObject is not defined or that it's not accessible for the current user

    • Checks if the SObject is accessible for the current user; this does not check if the SObject is actually defined but only if it's accessible through the describe API, this means that for objects that are not accessible for the current user this method will return false even when they are actually defined in the org.

      Parameters

      • type: string

        Type of SObject

      Returns Promise<boolean>

      true when the SObject is accessible for the current user otherwise false; when false is returned it can either mean that the SObject is not defined or that it's not accessible for the current user