Merge pull request #17828 from netes/jsforce-update-types

[jsforce] Add few missing definitions
This commit is contained in:
Ryan Cavanaugh
2017-07-13 21:38:48 -07:00
committed by GitHub
6 changed files with 40 additions and 8 deletions
+24 -4
View File
@@ -5,17 +5,30 @@ import { RecordResult } from './record-result';
import { SObject } from './salesforce-object';
export interface ConnectionOptions {
instanceUrl?: string;
accessToken?: string;
refreshToken?: string;
callOptions?: Object;
instanceUrl?: string;
loginUrl?: string;
logLevel?: string;
maxRequest?: number;
oauth2?: {
clientId: string,
clientSecret: string,
redirectUri?: string,
};
sessionId?: string;
serverUrl?: string;
proxyUrl?: string;
redirectUri?: string;
refreshToken?: string;
serverUrl?: string;
sessionId?: string;
signedRequest?: string | Object;
version?: string;
}
export interface UserInfo {
id: string;
organizationId: string;
url: string;
}
export type ConnectionEvent = "refresh";
@@ -23,6 +36,13 @@ export type ConnectionEvent = "refresh";
export class Connection {
constructor(params: ConnectionOptions)
accessToken: string;
sobject(resource: string): SObject;
login(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise<UserInfo>;
loginByOAuth2(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise<UserInfo>;
loginBySoap(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise<UserInfo>;
logout(callback?: (err: Error, res: undefined) => void): Promise<void>;
logoutByOAuth2(callback?: (err: Error, res: undefined) => void): Promise<void>;
logoutBySoap(callback?: (err: Error, res: undefined) => void): Promise<void>;
on(eventName: ConnectionEvent, callback: Function): void;
}
+2
View File
@@ -1,6 +1,7 @@
// Type definitions for jsforce 1.8
// Project: https://github.com/jsforce/jsforce
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
// Kamil Ejsymont <https://github.com/netes>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as fs from 'fs';
@@ -9,6 +10,7 @@ import * as express from 'express';
import * as glob from 'glob';
export { Date } from './date-enum';
export { Record } from './record';
export { RecordResult } from './record-result';
export { Connection } from './connection';
export { SObject } from './salesforce-object';
+2 -2
View File
@@ -32,8 +32,8 @@ salesforceConnection.sobject("ContentVersion").create({
salesforceConnection.sobject("ContentVersion").retrieve("world", {
test: "test"
}, (err: Error, ret: sf.RecordResult) => {
if (err || !ret.success) {
}, (err: Error, ret: sf.Record) => {
if (err) {
return;
}
});
+3
View File
@@ -8,7 +8,9 @@ export interface ExecuteOptions {
}
export class Query<T> {
end(): Query<T>;
filter(filter: Object): Query<T>;
include(include: string): Query<T>;
hint(hint: Object): Query<T>;
limit(value: number): Query<T>;
maxFetch(value: number): Query<T>;
@@ -22,6 +24,7 @@ export class Query<T> {
delete(callback?: (err: Error, ret: RecordResult) => void): any;
destroy(callback?: (err: Error, ret: RecordResult) => void): Promise<RecordResult[]>;
explain(callback?: (err: Error, info: ExplainInfo) => void): Promise<ExplainInfo>;
map(callback: (currentValue: Object) => void): Promise<any>;
scanAll(value: boolean): Query<T>;
select(fields: Object | string[] | string): Query<T>;
then(onSuccess?: Function, onRejected?: Function): Promise<any>;
+6
View File
@@ -0,0 +1,6 @@
import { SalesforceId } from './salesforce-id';
export interface Record {
Id: SalesforceId;
attributes: Object[];
}
+3 -2
View File
@@ -3,6 +3,7 @@ import * as stream from 'stream';
import { SObjectCreateOptions } from './create-options';
import { DescribeSObjectResult } from './describe-result';
import { Query } from './query';
import { Record } from './record';
import { RecordResult } from './record-result';
import { Connection } from './connection';
import { SalesforceId } from './salesforce-id';
@@ -10,8 +11,8 @@ import { SalesforceId } from './salesforce-id';
export class SObject {
record(options: any, callback?: (err: Error, ret: any) => void): void;
update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void;
retrieve(ids: string | string[], callback?: (err: Error, ret: any) => void): void;
retrieve(ids: string | string[], options?: Object, callback?: (err: Error, ret: any) => void): void;
retrieve(ids: string | string[], callback?: (err: Error, ret: Record | Record[]) => void): Promise<Record | Record[]>;
retrieve(ids: string | string[], options?: Object, callback?: (err: Error, ret: Record | Record[]) => void): Promise<Record | Record[]>;
upsert(records: Record | Record[], extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise<RecordResult | RecordResult[]>;
upsertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch;
describeGlobal(callback: (err: Error, res: any) => void): void;