[@types/jsforce] Add ConnectionOptions.refreshFn (#38925)

* Add refreshFn option

* update tests

* sort imports, add Doug Ayers

* remove "// TODOS" comment

* (lint) MAJOR.MINOR (patch version not allowed)
This commit is contained in:
Doug Ayers 2019-10-07 18:44:34 -05:00 committed by Armando Aguirre
parent 6f83edcabb
commit 300c8e7c23
4 changed files with 7 additions and 3 deletions

View File

@ -50,6 +50,7 @@ export interface ConnectionOptions extends PartialOAuth2Options {
proxyUrl?: string;
redirectUri?: string;
refreshToken?: string;
refreshFn?: (conn: Connection, callback: Callback<UserInfo>) => Promise<UserInfo>;
serverUrl?: string;
sessionId?: string;
signedRequest?: string | Object;

View File

@ -8,13 +8,14 @@
// Borys Kupar <https://github.com/borys-kupar>
// Andrés Catalán <https://github.com/catalandres>
// Ken Human <https://github.com/kenhuman>
// Doug Ayers <https://github.com/douglascayers>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export * from './api/analytics';
export * from './api/apex';
export * from './api/chatter';
export * from './api/metadata';
export * from './api/apex';
export * from './batch';
export * from './bulk';
export * from './cache';
@ -23,6 +24,7 @@ export * from './connection';
export * from './date-enum';
export * from './describe-result';
export * from './job';
export * from './limits-info';
export * from './oauth2';
export * from './promise';
export * from './query';
@ -32,4 +34,3 @@ export * from './salesforce-id';
export * from './salesforce-object';
export * from './streaming';
export * from './topic';
export * from './limits-info';

View File

@ -15,6 +15,9 @@ const salesforceConnection: sf.Connection = new sf.Connection({
clientId: '',
clientSecret: '',
},
refreshFn: (conn: sf.Connection, callback?: sf.Callback<sf.UserInfo>): Promise<sf.UserInfo> => {
return conn.login('username', 'password', callback);
},
});
async function testSObject(connection: sf.Connection) {

View File

@ -1,7 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODOs
"array-type": false,
"await-promise": [true, "Request"],
"ban-types": false,