1 |
|
2 | import { Readable } from 'stream';
|
3 | import { RecordResult } from './record-result';
|
4 |
|
5 | export interface ExecuteOptions {
|
6 | autoFetch?: boolean;
|
7 | maxFetch?: number;
|
8 | headers?: object;
|
9 | scanAll?: boolean;
|
10 | }
|
11 |
|
12 | export interface QueryResult<T> {
|
13 | done: boolean;
|
14 | nextRecordsUrl?: string;
|
15 | totalSize: number;
|
16 | records: T[];
|
17 | }
|
18 |
|
19 | export class Query<T> extends Readable implements Promise<T> {
|
20 | end(): Query<T>;
|
21 |
|
22 | filter(filter: Object): Query<T>;
|
23 |
|
24 | include(include: string): Query<T>;
|
25 |
|
26 | hint(hint: Object): Query<T>;
|
27 |
|
28 | limit(value: number): Query<T>;
|
29 |
|
30 | maxFetch(value: number): Query<T>;
|
31 |
|
32 | offset(value: number): Query<T>;
|
33 |
|
34 | skip(value: number): Query<T>;
|
35 |
|
36 | sort(keyOrList: string | Object[] | Object, direction?: 'ASC' | 'DESC' | number): Query<T>;
|
37 |
|
38 | run(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query<T>;
|
39 |
|
40 | execute(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query<T>;
|
41 |
|
42 | exec(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query<T>;
|
43 |
|
44 | del(type?: string, callback?: (err: Error, ret: RecordResult) => void): any;
|
45 | del(callback?: (err: Error, ret: RecordResult) => void): any;
|
46 |
|
47 | delete(type?: string, callback?: (err: Error, ret: RecordResult) => void): any;
|
48 | delete(callback?: (err: Error, ret: RecordResult) => void): any;
|
49 |
|
50 | destroy(type?: string, callback?: (err: Error, ret: RecordResult) => void): Promise<RecordResult[]>;
|
51 | destroy(callback?: (err: Error, ret: RecordResult) => void): Promise<RecordResult[]>;
|
52 | destroy(error?: Error): void;
|
53 |
|
54 | explain(callback?: (err: Error, info: ExplainInfo) => void): Promise<ExplainInfo>;
|
55 |
|
56 | map(callback: (currentValue: Object) => void): Promise<any>;
|
57 |
|
58 | scanAll(value: boolean): Query<T>;
|
59 |
|
60 | select(fields: Object | string[] | string): Query<T>;
|
61 |
|
62 | thenCall(callback?: (err: Error, records: T) => void): Query<T>;
|
63 |
|
64 | toSOQL(callback: (err: Error, soql: string) => void): Promise<string>;
|
65 |
|
66 | update(mapping: any, type: string, callback: (err: Error, records: RecordResult[]) => void): Promise<RecordResult[]>;
|
67 | update(mapping: any, callback: (err: Error, records: RecordResult[]) => void): Promise<RecordResult[]>;
|
68 |
|
69 | where(conditions: Object | string): Query<T>;
|
70 |
|
71 | finally<never>(): Promise<T>;
|
72 |
|
73 | [Symbol.toStringTag]: 'Promise';
|
74 |
|
75 | catch<TResult>(onrejected?: ((reason: any) => (PromiseLike<TResult> | TResult))): Promise<T | TResult>;
|
76 |
|
77 | then<TResult1, TResult2>(onfulfilled?: ((value: T) => (PromiseLike<TResult1> | TResult1)),
|
78 | onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2))): Promise<TResult1 | TResult2>;
|
79 | }
|
80 |
|
81 | export class ExplainInfo {}
|
82 |
|
\ | No newline at end of file |