Hierarchy

  • QueryService

Constructors

Properties

cache: {
    data: QueryCache;
    tooling: QueryCache;
} = ...

Type declaration

connectionProvider: SalesforceConnectionProvider
logger: Logger
nsService?: NamespaceService
queryCacheDefault: boolean = false
queryCacheEnabled: boolean = true
numberFormat: NumberFormat = ...

Number formatter for Salesforce numbers used by the query service. Change this to change the default number formatting behavior.

Methods

  • Query salesforce for a record

    Type Parameters

    • T extends object = object

    • K extends PropertyKey = keyof T

    Parameters

    • query: string

      Query string

    • Optional useCache: boolean

      Store the query in the internal query cache or retrieve the cached version of the response if it exists

    • Optional cancelToken: CancellationToken

    Returns Promise<QueryResult<T, K>[]>

  • Query salesforce for a record using the tooling API

    Type Parameters

    • T extends object = object

    • K extends PropertyKey = keyof T

    Parameters

    • query: string

      Query string

    • Optional useCache: boolean

      Store the query in the internal query cache or retrieve the cached version of the response if it exists

    • Optional cancelToken: CancellationToken

    Returns Promise<QueryResult<T, K>[]>

  • Sets the query cache options. When the query cache is enabled, the query results are stored in memory and reused when the same query is executed again. When changing cache state the current cache is cleared.

    Parameters

    • options: {
          default?: boolean;
          enabled: boolean;
      }

      The query cache options.

      • Optional default?: boolean

        Indicates what the default behavior should be when the useCache paramter is not explicitly set by the caller.

      • enabled: boolean

        Indicates whether the query cache is enabled.

    Returns QueryService

    The current instance of the QueryService.

  • Format the value of a field to match the Salesforce object schema value so it can be inserted or uploaded

    Parameters

    • value: any
    • field: {
          type: FieldType;
      }
    • options: {
          escapeStrings: boolean;
          wrapStrings: boolean;
      } = ...

      Extra options such as wrapping and escaping; both default to true

      • escapeStrings: boolean
      • wrapStrings: boolean

    Returns string