How to use the jsforce.Promise 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 / deploy.js View on Github external
'use strict';

var path = require('path');
var jsforce = require('jsforce');
var archiver = require('archiver');
var Promise = jsforce.Promise;
var connect = require('./connect');

var DEPLOY_OPTIONS =
  "allowMissingFiles,autoUpdatePackage,checkOnly,ignoreWarnings,performRetrieve,purgeOnDelete,rollbackOnError,runAllTests,runTests,singlePackage,testLevel".split(',');

/* @private */
function noop() {}

/**
 *
 */
function deployFromZipStream(zipStream, options) {
  var logger = options.logger || { log: noop };
  return connect(options).then(function(conn) {
    logger.log('Deploying to server...');
    conn.metadata.pollTimeout = options.pollTimeout || 60*1000; // timeout in 60 sec by default
github jsforce / jsforce-metadata-tools / lib / retrieve.js View on Github external
'use strict';

var decompress = require('decompress');
var fs = require('fs');
var fstream = require('fstream');
var path = require('path');
var stream = require('readable-stream');
var jsforce = require('jsforce');
var archiver = require('archiver');
var xml2js = require('xml2js');
var Promise = jsforce.Promise;
var connect = require('./connect');

var RETRIEVE_OPTIONS =
  "apiVersion,packageNames,singlePackage,specificFiles,unpackaged".split(',');

/* @private */
function noop() {}

/**
 *
 */
function retrieve(options) {
  var logger = options.logger || { log: noop };
  return connect(options).then(function(conn) {
    logger.log('Retrieving from server...');
    conn.metadata.pollTimeout = options.pollTimeout || 60*1000; // timeout in 60 sec by default
github jsforce / jsforce-metadata-tools / lib / connect.js View on Github external
'use strict';

var jsforce = require('jsforce');
var Promise = jsforce.Promise;

var CONNECTION_CONFIG_PROPS =
  "loginUrl,accessToken,instanceUrl,refreshToken,clientId,clientSecret,redirectUri,logLevel,version".split(',');

/**
 *
 */
function connect(options) {
  var conn;
  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) {
github jsforce / jsforce-metadata-tools / lib / cli.js View on Github external
var fs = require('fs');
var path = require('path');
var commander = require('commander');
var jsforce = require('jsforce');
var tools = require('./index');
var pkg = require('../package.json');
var Promise = jsforce.Promise;

function acceptConnectionOptions(program) {
  program.option('-u, --username [username]', 'Salesforce username')
         .option('-p, --password [password]', 'Salesforce password (and security token, if available)')
         .option('-c, --connection [connection]', 'Connection name stored in connection registry')
         .option('-l, --loginUrl [loginUrl]', 'Salesforce login url')
         .option('--sandbox', 'Login to Salesforce sandbox');
}

function acceptCommonOptions(program) {
  program.option('--verbose', 'Output execution detail log')
         .version(pkg.version);
}

function readOptions(program) {
  var options = {};

jsforce

Salesforce API Library for JavaScript

MIT
Latest version published 26 days ago

Package Health Score

86 / 100
Full package analysis