import Connection from '../connection'; import Cache, { CachedFunction } from '../cache'; import SObject from '../sobject'; import { DescribeGlobalResult, DescribeSObjectResult, HttpRequest, Schema, SObjectNames } from '../types'; /** * */ export type ExecuteAnonymousResult = { compiled: boolean; compileProblem: string | null; success: boolean; line: number; column: number; exceptionMessage: string | null; exceptionStackTrace: string | null; }; export type RunTestLevel = 'RunSpecifiedTests' | 'RunLocalTests' | 'RunAllTestsInOrg'; type TestsNode = { classId: string; testMethods?: string[]; } | { className: string; testMethods?: string[]; }; export type RunTestsRequest = { tests: TestsNode[]; maxFailedTests?: number; testLevel?: RunTestLevel; skipCodeCoverage?: boolean; }; export type RunTestsAsyncRequest = { classids?: string; classNames?: string; suiteids?: string; suiteNames?: string; maxFailedTests?: number; testLevel?: RunTestLevel; skipCodeCoverage?: boolean; } | { tests: TestsNode[]; maxFailedTests?: number; testLevel?: RunTestLevel; skipCodeCoverage?: boolean; }; type CodeCoverageResult = { id: string; locationsNotCovered: any[]; name: string; namespace: string | null; numLocations: number; numLocationsNotCovered: number; type: string; }; type CodeCoverageWarning = { id: string; message: string; name: string | null; namespace: string | null; }; type FlowCoverageResult = { elementsNotCovered: string[]; flowId: string; flowName: string; flowNamespace: string | null; numElements: number; numElementsNotCovered: number; processType: string; }; type FlowCoverageWarning = { flowId: string; flowName: string; flowNamespace: string | null; message: string; }; type RunTestSuccess = { id: string; methodName: string; name: string; namespace: string | null; seeAllData: boolean; time: number; }; type RunTestFailure = { id: string; message: string; methodName: string; name: string; namespace: string | null; seeAllData: boolean; stackTrace: string; time: number; type: string; }; export type RunTestsResult = { apexLogId: string; codeCoverage: CodeCoverageResult[]; codeCoverageWarnings: CodeCoverageWarning[]; flowCoverage: FlowCoverageResult[]; flowCoverageWarnings: FlowCoverageWarning[]; numFailures: number; numTestsRun: number; successes: RunTestSuccess[]; failures: RunTestFailure[]; totalTime: number; }; type ConstructorDeclaration = { methodDoc: string | null; name: string; parameters: Array<{ name: string; type: string; }>; references: any[]; }; type MethodDeclaration = { argTypes: string[]; isStatic: boolean; methodDoc: string | null; name: string; parameters: Array<{ name: string; type: string; }>; references: any[]; }; type PropertyDeclaration = { name: string; references: any[]; }; type ClassDeclaration = { constructors: ConstructorDeclaration[]; methods: MethodDeclaration[]; properties: PropertyDeclaration[]; }; export type CompletionsResult = { publicDeclarations?: { [namespace: string]: { [name: string]: ClassDeclaration; }; }; completions?: { [component: string]: { simple: boolean; attribs: { [attr: string]: {}; }; }; }; }; /** * API class for Tooling API call */ export declare class Tooling { _conn: Connection; get version(): string; /** * Execute query by using SOQL */ query: Connection['query']; /** * Query next record set by using query locator */ queryMore: Connection['queryMore']; _ensureVersion: Connection['_ensureVersion']; /** * Create records */ create: Connection['create']; _createSingle: (type: string, record: import("../types").Record, options: import("../types").DmlOptions) => Promise; _createParallel: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise; _createMany: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise; /** * Synonym of Tooling#create() */ insert: { > = Partial>>(type: N, records: InputRecord[], options?: import("../types").DmlOptions | undefined): Promise; > = Partial>>(type: N_1, record: InputRecord_1, options?: import("../types").DmlOptions | undefined): Promise; > = Partial>>(type: N_2, records: InputRecord_2 | InputRecord_2[], options?: import("../types").DmlOptions | undefined): Promise; }; /** * Retrieve specified records */ retrieve: Connection['retrieve']; _retrieveSingle: (type: string, id: string, options: import("../types").RetrieveOptions) => Promise; _retrieveParallel: (type: string, ids: string[], options: import("../types").RetrieveOptions) => Promise; _retrieveMany: (type: string, ids: string[], options: import("../types").RetrieveOptions) => Promise; /** * Update records */ update: Connection['update']; _updateSingle: (type: string, record: import("../types").Record, options: import("../types").DmlOptions) => Promise; _updateParallel: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise; _updateMany: (type: string, records: import("../types").Record[], options: import("../types").DmlOptions) => Promise; /** * Upsert records */ upsert: Connection['upsert']; /** * Delete records */ destroy: Connection['destroy']; _destroySingle: (type: string, id: string, options: import("../types").DmlOptions) => Promise; _destroyParallel: (type: string, ids: string[], options: import("../types").DmlOptions) => Promise; _destroyMany: (type: string, ids: string[], options: import("../types").DmlOptions) => Promise; /** * Synonym of Tooling#destroy() */ delete: { (type: N, ids: string[], options?: import("../types").DmlOptions | undefined): Promise; (type: N_1, id: string, options?: import("../types").DmlOptions | undefined): Promise; (type: N_2, ids: string | string[], options?: import("../types").DmlOptions | undefined): Promise; }; /** * Synonym of Tooling#destroy() */ del: { (type: N, ids: string[], options?: import("../types").DmlOptions | undefined): Promise; (type: N_1, id: string, options?: import("../types").DmlOptions | undefined): Promise; (type: N_2, ids: string | string[], options?: import("../types").DmlOptions | undefined): Promise; }; cache: Cache; /** * Describe SObject metadata */ describe: CachedFunction<(type: string) => Promise>; describe$: CachedFunction<(type: string) => Promise>; describe$$: CachedFunction<(name: string) => DescribeSObjectResult>; /** * Synonym of Tooling#describe() */ describeSObject: CachedFunction<(type: string) => Promise>; describeSObject$: CachedFunction<(type: string) => Promise>; describeSObject$$: CachedFunction<(name: string) => DescribeSObjectResult>; /** * Describe global SObjects */ describeGlobal: CachedFunction<() => Promise>; describeGlobal$: CachedFunction<() => Promise>; describeGlobal$$: CachedFunction<(name: string) => DescribeGlobalResult>; /** * Get SObject instance */ sobject: Connection['sobject']; sobjects: { [N in SObjectNames]?: SObject; }; /** * */ constructor(conn: Connection); /** * @private */ _establish(): void; /** * @private */ _baseUrl(): string; /** * @private */ _supports(feature: string): boolean; /** * */ request(request: string | HttpRequest, options?: Object): import("../types").StreamPromise; /** * Executes Apex code anonymously */ executeAnonymous(body: string): import("../types").StreamPromise; /** * Executes Apex tests asynchronously */ runTestsAsynchronous(req: RunTestsAsyncRequest): import("../types").StreamPromise; /** * Executes Apex tests synchronously */ runTestsSynchronous(req: RunTestsRequest): import("../types").StreamPromise; /** * Retrieves available code completions of the referenced type */ completions(type?: 'apex' | 'visualforce'): import("../types").StreamPromise; } export default Tooling;