// http://jsforce.github.io/jsforce/doc/Query.html
import { Readable } from 'stream';
import { RecordResult } from './record-result';
export interface ExecuteOptions {
autoFetch?: boolean;
maxFetch?: number;
headers?: object;
scanAll?: boolean;
}
export interface QueryResult {
done: boolean;
nextRecordsUrl?: string;
totalSize: number;
records: T[];
}
export class Query extends Readable implements Promise {
end(): Query;
filter(filter: Object): Query;
include(include: string): Query;
hint(hint: Object): Query;
limit(value: number): Query;
maxFetch(value: number): Query;
offset(value: number): Query;
skip(value: number): Query;
sort(keyOrList: string | Object[] | Object, direction?: 'ASC' | 'DESC' | number): Query;
run(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query;
execute(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query;
exec(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query;
del(type?: string, callback?: (err: Error, ret: RecordResult) => void): any;
del(callback?: (err: Error, ret: RecordResult) => void): any;
delete(type?: string, callback?: (err: Error, ret: RecordResult) => void): any;
delete(callback?: (err: Error, ret: RecordResult) => void): any;
destroy(type?: string, callback?: (err: Error, ret: RecordResult) => void): Promise;
destroy(callback?: (err: Error, ret: RecordResult) => void): Promise;
destroy(error?: Error): void;
explain(callback?: (err: Error, info: ExplainInfo) => void): Promise;
map(callback: (currentValue: Object) => void): Promise;
scanAll(value: boolean): Query;
select(fields: Object | string[] | string): Query;
thenCall(callback?: (err: Error, records: T) => void): Query;
toSOQL(callback: (err: Error, soql: string) => void): Promise;
update(mapping: any, type: string, callback: (err: Error, records: RecordResult[]) => void): Promise;
update(mapping: any, callback: (err: Error, records: RecordResult[]) => void): Promise;
where(conditions: Object | string): Query;
finally(): Promise;
[Symbol.toStringTag]: 'Promise';
catch(onrejected?: ((reason: any) => (PromiseLike | TResult))): Promise;
then(onfulfilled?: ((value: T) => (PromiseLike | TResult1)),
onrejected?: ((reason: any) => (PromiseLike | TResult2))): Promise;
}
export class ExplainInfo {}