Salesforcer
Salesforcer is a wrapper around SalesForce API allowing to simply build single and composite requests.
It uses axios to make HTTP requests.
LIMITATIONS AND DISCLAIMER
This library is in pre 1.0.0 state. Api and structure can change and break frequently.
Currently only sobjects
, query
and composite
requests are supported.
Authentification only supports grant_type=password
.
Documentation
You can check the documentation here.
Usage
Installing
Install using npm
:
npm install --save @digitregroup/salesforcer
Install using yarn
:
yarn add @digitregroup/salesforcer
Request example
const {Auth, SObjects} = require('@digitregroup/salesforcer');
const auth = new Auth({ /* Ommited */ });
const so = new SObjects({
method: 'POST',
sobject: 'Task',
body: { foo: 'bar' },
});
const response = await so.execute(auth);
Composite example
const {Auth, SObjects, Composite} = require('@digitregroup/salesforcer');
const auth = new Auth({ /* Ommited */ });
const composite = new Composite(true);
composite
.add('NewLead', new SObjects({
method: 'POST',
sobject: 'Lead',
body: { foo: 'bar' },
}))
.add('AddTask', new SObjects({
method: 'POST',
sobject: 'Task',
body: { bar: 'baz', WhoId: '@{NewLead.id}' },
}));
const response = await composite.execute(auth);
Contributing
Building
yarn build
Linting
yarn lint
Running tests
yarn test
Releasing version
npm version <version>
This will:
- update the
version
field in package.json - commit the package.json
- tag with
v<version>