import * as stream from "stream"; import { Batch, BatchResultInfo } from "./batch"; import { Callback, Connection, RestApiOptions } from "./connection"; import { SObjectCreateOptions } from "./create-options"; import { DescribeSObjectResult } from "./describe-result"; import { Query } from "./query"; import { QuickAction, QuickActionInfo } from "./quick-action"; import { Record, RecordReference } from "./record"; import { RecordResult } from "./record-result"; import { SalesforceId } from "./salesforce-id"; export class SObject { record(id: SalesforceId): RecordReference; retrieve(id: SalesforceId, callback?: Callback>): Promise>; retrieve(id: SalesforceId, options?: object, callback?: Callback>): Promise>; retrieve(ids: SalesforceId[], callback?: Callback>>): Promise>>; retrieve(ids: SalesforceId[], options?: object, callback?: Callback>>): Promise>>; // Should update require that the record Id field be provided? update(record: Partial, callback?: Callback): Promise; update(record: Partial, options?: RestApiOptions, callback?: Callback): Promise; update(records: Array>, callback?: Callback): Promise; update( records: Array>, options?: RestApiOptions, callback?: Callback, ): Promise; // should input really be optional? the documentation says so, but how can you actually update without it? updateBulk(input?: Record[] | stream.Stream | string, callback?: Callback): Batch; updated( start: string | Date, end: string | Date, callback?: Callback, ): Promise; upsert(records: Record, extIdField: string, callback?: Callback): Promise; upsert( records: Record, extIdField: string, options?: RestApiOptions, callback?: Callback, ): Promise; upsert(records: Array>, extIdField: string, callback?: Callback): Promise; upsert( records: Array>, extIdField: string, options?: RestApiOptions, callback?: Callback, ): Promise; upsertBulk( input?: Array> | stream.Stream | string, callback?: Callback, ): Batch; find(query?: object | string, callback?: Callback>>): Query>>; find( query?: object | string, fields?: Object | string[] | string, callback?: Callback>>, ): Query>>; find( query?: object | string, fields?: Object | string[] | string, options?: FindOptions, callback?: Callback>>, ): Query>>; findOne(query?: object | string, callback?: Callback>): Query | null>; findOne( query?: object | string, fields?: Object | string[] | string, callback?: Callback>, ): Query | null>; findOne( query?: object | string, fields?: Object | string[] | string, options?: FindOptions, callback?: Callback>, ): Query | null>; approvalLayouts$: { /** Returns a value from the cache if it exists, otherwise calls SObject.approvalLayouts */ (callback?: Callback): ApprovalLayoutInfo; clear(): void; }; approvalLayouts(callback?: Callback): Promise; bulkload( operation: string, options?: { extIdField?: string | undefined }, input?: Array> | stream.Stream | string, callback?: Callback, ): Batch; compactLayouts$: { /** Returns a value from the cache if it exists, otherwise calls SObject.compactLayouts */ (callback?: Callback): CompactLayoutInfo; clear(): void; }; compactLayouts(callback?: Callback): Promise; count(conditions?: object | string, callback?: Callback): Query; create(record: T, options?: RestApiOptions, callback?: Callback): Promise; create(record: T, callback?: Callback): Promise; create(record: T[], options?: RestApiOptions, callback?: Callback): Promise; create(record: T[], callback?: Callback): Promise; createBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; del(id: string, callback?: Callback): Promise; del(ids: string[], callback?: Callback): Promise; destroy(id: string, callback?: Callback): Promise; destroy(ids: string[], callback?: Callback): Promise; delete(id: string, callback?: Callback): Promise; delete(ids: string[], callback?: Callback): Promise; deleteBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; destroyBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; destroyHardBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; deleted( start: Date | string, end: Date | string, callback?: Callback, ): Promise; deleteHardBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; describe(callback?: Callback): Promise; describe$: { /** Returns a value from the cache if it exists, otherwise calls SObject.describe */ (callback?: Callback): DescribeSObjectResult; clear(): void; }; insert(record: Record, callback?: Callback): Promise; insert(records: Array>, callback?: Callback): Promise; insertBulk(input?: Array> | stream.Stream | string, callback?: Callback): Batch; /** Returns a value from the cache if it exists, otherwise calls SObject.layouts */ layouts$: { (layoutName?: string, callback?: Callback): LayoutInfo; clear(): void; }; layouts(layoutName?: string, callback?: Callback): Promise; listview(id: string): ListView; listviews(callback?: Callback): Promise; quickAction(actionName: string): QuickAction; quickActions(callback?: Callback): Promise; recent(callback?: Callback): Promise; select(callback?: Callback): Query; // TODO:use a typed pluck to turn `fields` into a subset of T's fields so that the output is slimmed down appropriately select( fields?: { [P in keyof T]: boolean } | Array<(keyof T)> | (keyof T), callback?: Callback>>, ): Query>>; } export interface FindOptions { limit?: number | undefined; offset?: number | undefined; skip?: number | undefined; } export interface UpdatedRecordsInfo { latestDateCovered: string; ids: string[]; } export interface ApprovalLayoutInfo { approvalLayouts: Object[]; } export interface CompactLayoutInfo { compactLayouts: Object[]; defaultCompactLayoutId: string; recordTypeCompactLayoutMappings: Object[]; } export interface DeletedRecordsInfo { earliestDateAvailable: string; latestDateCovered: string; deletedRecords: DeletedRecord[]; } export interface DeletedRecord { id: string; deletedDate: string; } export interface LayoutInfo { layouts: Object[]; recordTypeMappings: Object[]; } export class ListView { constructor(connection: Connection, type: string, id: SalesforceId); } export class ListViewsInfo {} // TODO: Remove this export export { QuickAction }; // for compatibility if anyone had imported it from this file