From 30db8dc0f4d43edfd6906097099dd68c34c35f9f Mon Sep 17 00:00:00 2001 From: Gil Avignon Date: Thu, 25 Jun 2020 16:55:41 +0200 Subject: [PATCH] Add API Version management --- README.md | 3 ++- bin/cli | 1 + index.js | 6 +++++- lib/downloader.js | 3 +++ package.json | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb000f9..c7ff3c9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # -![version](https://img.shields.io/badge/version-1.2.6-blue) +![version](https://img.shields.io/badge/version-1.2.7-blue) Generate data dictionary from a Salesforce Org. This tool can also generate a file that can be imported in Lucidchart to define entities and relationships. @@ -33,6 +33,7 @@ $ sgd -h -u, --username [username] salesforce username -p, --password [password] salesforce password -l, --loginUrl [loginUrl] salesforce login URL [https://login.salesforce.com] + -a, --apiVersion [apiVersion] salesforce API Version [48.0] -c, --customObjects [customObjects] retrieve all custom objects [true] -lc, --lucidchart [lucidchart] generate ERD file for Lucidchart [true] -s, --standardObjects [standardObjects] standard sObjects to retrieve separated with commas diff --git a/bin/cli b/bin/cli index df3fb39..798180d 100755 --- a/bin/cli +++ b/bin/cli @@ -11,6 +11,7 @@ program .option('-u, --username [username]', 'salesforce username') .option('-p, --password [password]', 'salesforce password') .option('-l, --loginUrl [loginUrl]', 'salesforce login URL [https://login.salesforce.com]', 'https://login.salesforce.com') + .option('-a, --apiVersion [apiVersion]', 'salesforce API Version [48.0]', '48.0') .option('-c, --customObjects [customObjects]', 'retrieve all custom objects [true]', true) .option('-lc, --lucidchart [lucidchart]', 'generate ERD file for Lucidchart [true]', true) .option('-s, --standardObjects [standardObjects]', 'standard sObjects to retrieve separated with commas') diff --git a/index.js b/index.js index a550c21..9508454 100644 --- a/index.js +++ b/index.js @@ -15,6 +15,9 @@ module.exports = (config, logger) => { if (typeof config.loginUrl === 'undefined' || config.loginUrl === null) { config.loginUrl = 'https://login.salesforce.com'; } + if (typeof config.apiVersion === 'undefined' || config.apiVersion === null) { + config.apiVersion = '48.0'; + } if (typeof config.output === 'undefined' || config.output === null) { config.output = '.'; } @@ -95,7 +98,8 @@ module.exports = (config, logger) => { const promise = new Promise((resolve, reject) => { const conn = new jsforce.Connection({ - loginUrl: config.loginUrl + loginUrl: config.loginUrl, + version: config.apiVersion }); // Salesforce connection diff --git a/lib/downloader.js b/lib/downloader.js index 3a42d5e..84d77b2 100644 --- a/lib/downloader.js +++ b/lib/downloader.js @@ -22,6 +22,9 @@ module.exports = class Downloader { const stats = fs.statSync(filePath); resolve(stats.size); + }).catch(function(err) { + console.log(err); + console.log(err.stack); }); }); } diff --git a/package.json b/package.json index 09521b6..177eb8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sfdc-generate-data-dictionary", - "version": "1.2.5", + "version": "1.2.7", "description": "Generate data dictionary from a Salesforce Org", "main": "index.js", "bin": {