1 | import * as stream from 'stream';
|
2 |
|
3 | import { SObjectCreateOptions } from './create-options';
|
4 | import { DescribeSObjectResult } from './describe-result';
|
5 | import { Query } from './query';
|
6 | import { Record, RecordReference } from './record';
|
7 | import { RecordResult } from './record-result';
|
8 | import { Connection, RestApiOptions, Callback } from './connection';
|
9 | import { SalesforceId } from './salesforce-id';
|
10 | import { Batch, BatchResultInfo } from './batch';
|
11 | import { QuickAction, QuickActionInfo } from './quick-action';
|
12 |
|
13 | export class SObject<T> {
|
14 | record(id: SalesforceId): RecordReference<T>;
|
15 | retrieve(id: SalesforceId, callback?: Callback<Record<T>>): Promise<Record<T>>;
|
16 | retrieve(id: SalesforceId, options?: object, callback?: Callback<Record<T>>): Promise<Record<T>>;
|
17 | retrieve(ids: SalesforceId[], callback?: Callback<Array<Record<T>>>): Promise<Array<Record<T>>>;
|
18 | retrieve(ids: SalesforceId[], options?: object, callback?: Callback<Array<Record<T>>>): Promise<Array<Record<T>>>;
|
19 |
|
20 | update(record: Partial<T>, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
21 | update(record: Partial<T>, options?: RestApiOptions, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
22 | update(records: Array<Partial<T>>, callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
23 | update(records: Array<Partial<T>>, options?: RestApiOptions, callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
24 |
|
25 | updateBulk(input?: Record[] | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
26 | updated(start: string | Date, end: string | Date, callback?: Callback<UpdatedRecordsInfo>): Promise<UpdatedRecordsInfo>;
|
27 | upsert(records: Record<T>, extIdField: string, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
28 | upsert(records: Record<T>, extIdField: string, options?: RestApiOptions, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
29 | upsert(records: Array<Record<T>>, extIdField: string, callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
30 | upsert(records: Array<Record<T>>, extIdField: string, options?: RestApiOptions, callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
31 | upsertBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[] | BatchResultInfo[]>): Batch;
|
32 |
|
33 | find<T>(query?: object | string, callback?: Callback<Array<Record<T>>>): Query<Array<Record<T>>>;
|
34 | find<T>(query?: object | string, fields?: Object | string[] | string, callback?: Callback<Array<Record<T>>>): Query<Array<Record<T>>>;
|
35 | find<T>(query?: object | string, fields?: Object | string[] | string, options?: FindOptions, callback?: Callback<Array<Record<T>>>): Query<Array<Record<T>>>;
|
36 |
|
37 | findOne<T>(query?: object | string, callback?: Callback<Record<T>>): Query<Record<T> | null>;
|
38 | findOne<T>(query?: object | string, fields?: Object | string[] | string, callback?: Callback<Record<T>>): Query<Record<T> | null>;
|
39 | findOne<T>(query?: object | string, fields?: Object | string[] | string, options?: FindOptions, callback?: Callback<Record<T>>): Query<Record<T> | null>;
|
40 |
|
41 | approvalLayouts$: {
|
42 |
|
43 | (callback?: Callback<ApprovalLayoutInfo>): ApprovalLayoutInfo;
|
44 | clear(): void;
|
45 | }
|
46 | approvalLayouts(callback?: Callback<ApprovalLayoutInfo>): Promise<ApprovalLayoutInfo>;
|
47 | bulkload(operation: string, options?: { extIdField?: string | undefined }, input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
48 | compactLayouts$: {
|
49 |
|
50 | (callback?: Callback<CompactLayoutInfo>): CompactLayoutInfo;
|
51 | clear(): void;
|
52 | }
|
53 | compactLayouts(callback?: Callback<CompactLayoutInfo>): Promise<CompactLayoutInfo>;
|
54 | count(conditions?: object | string, callback?: Callback<number>): Query<number>;
|
55 | create(record: T, options?: RestApiOptions, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
56 | create(record: T, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
57 | create(record: Array<T>, options?: RestApiOptions, callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
58 | create(record: Array<T>, callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
59 | createBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
60 | del(id: string, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
61 | del(ids: string[], callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
62 | destroy(id: string, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
63 | destroy(ids: string[], callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
64 | delete(id: string, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
65 | delete(ids: string[], callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
66 | deleteBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
67 | destroyBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
68 | destroyHardBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
69 | deleted(start: Date | string, end: Date | string, callback?: Callback<DeletedRecordsInfo>): Promise<DeletedRecordsInfo>;
|
70 | deleteHardBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
71 | describe(callback?: Callback<DescribeSObjectResult>): Promise<DescribeSObjectResult>;
|
72 | describe$: {
|
73 |
|
74 | (callback?: Callback<DescribeSObjectResult>): DescribeSObjectResult;
|
75 | clear(): void;
|
76 | }
|
77 | insert(record: Record<T>, callback?: Callback<RecordResult>): Promise<RecordResult>;
|
78 | insert(records: Array<Record<T>>, callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
79 | insertBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: Callback<RecordResult[]>): Batch;
|
80 |
|
81 | layouts$: {
|
82 | (layoutName?: string, callback?: Callback<LayoutInfo>): LayoutInfo;
|
83 | clear(): void;
|
84 | }
|
85 | layouts(layoutName?: string, callback?: Callback<LayoutInfo>): Promise<LayoutInfo>;
|
86 | listview(id: string): ListView;
|
87 | listviews(callback?: Callback<ListViewsInfo>): Promise<ListViewsInfo>;
|
88 | quickAction(actionName: string): QuickAction;
|
89 | quickActions(callback?: Callback<QuickActionInfo[]>): Promise<QuickActionInfo[]>;
|
90 | recent(callback?: Callback<RecordResult[]>): Promise<RecordResult[]>;
|
91 | select(callback?: Callback<T[]>): Query<T[]>;
|
92 |
|
93 | select(fields?: {[P in keyof T]: boolean} | Array<(keyof T)> | (keyof T), callback?: Callback<Array<Partial<T>>>): Query<Array<Partial<T>>>;
|
94 | }
|
95 |
|
96 | export interface FindOptions {
|
97 | limit?: number | undefined;
|
98 | offset?: number | undefined;
|
99 | skip?: number | undefined;
|
100 | }
|
101 |
|
102 | export interface UpdatedRecordsInfo {
|
103 | latestDateCovered: string;
|
104 | ids: string[];
|
105 | }
|
106 |
|
107 | export interface ApprovalLayoutInfo {
|
108 | approvalLayouts: Object[];
|
109 | }
|
110 |
|
111 | export interface CompactLayoutInfo {
|
112 | compactLayouts: Object[];
|
113 | defaultCompactLayoutId: string;
|
114 | recordTypeCompactLayoutMappings: Object[];
|
115 | }
|
116 |
|
117 | export interface DeletedRecordsInfo {
|
118 | earliestDateAvailable: string;
|
119 | latestDateCovered: string;
|
120 | deletedRecords: DeletedRecord[];
|
121 | }
|
122 |
|
123 | export interface DeletedRecord {
|
124 | id: string,
|
125 | deletedDate: string,
|
126 | }
|
127 |
|
128 | export interface LayoutInfo {
|
129 | layouts: Object[];
|
130 | recordTypeMappings: Object[];
|
131 | }
|
132 |
|
133 | export class ListView {
|
134 | constructor(connection: Connection, type: string, id: SalesforceId)
|
135 | }
|
136 |
|
137 | export class ListViewsInfo { }
|
138 |
|
139 | export { QuickAction }
|