Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 1x 2x 2x 2x 1x 1x 2x 1x | import * as jsforce from 'jsforce';
import { JsForceConfigOptions } from './common/interfaces';
export class Client {
conn!: jsforce.Connection;
initialization!: Promise<any>;
constructor(config: JsForceConfigOptions) {
this.conn = new jsforce.Connection(config.options);
this.initialization = this.init(config.username, config.password, config.security_token);
}
async init(username:string, password: string, security_token?:string, callback?: (err: Error, result: jsforce.UserInfo) => {}) {
if (security_token) {
password += security_token;
console.log('password+security_token', password);
}
await this.conn.login(username,password).catch(
(err) => {
return err;
}
);
}
async logout(revoke?:boolean, callback?: (err:Error, res: undefined) => {}){
return await this.conn.logout();
}
} |