How to use the jsforce.registry function in jsforce

To help you get started, we’ve selected a few jsforce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jsforce / jsforce-metadata-tools / lib / connect.js View on Github external
return Promise.resolve().then(function() {
    if (options.connection) {
      conn = jsforce.registry.getConnection(options.connection);
      if (!conn) {
        throw new Error('No connection named "' + options.connection + '" in registry');
      }
    } else if (options.username && options.password) {
      var config = {};
      CONNECTION_CONFIG_PROPS.forEach(function(prop) {
        if (options[prop]) { config[prop] = options[prop]; }
      });
      conn = new jsforce.Connection(config);
      return conn.login(options.username, options.password);
    } else {
      throw new Error(
        'Credential to salesforce server is not found in options.\n' +
        'Specify "username" and "password" in options.'
      );
    }

jsforce

Salesforce API Library for JavaScript

MIT
Latest version published 24 days ago

Package Health Score

86 / 100
Full package analysis