@salesforce/apex-node

Salesforce js library for Apex

Usage no npm install needed!

<script type="module">
  import salesforceApexNode from 'https://cdn.skypack.dev/@salesforce/apex-node';
</script>

README

Salesforce Apex Library

CircleCI npm (scoped) License Commitizen friendly

Introduction

Typescript library to support the Apex plugin and Salesforce Extensions for VS Code.

Note: This library is in beta and has been released early so we can collect feedback. It may contain bugs, undergo major changes, or be discontinued. Please report any issues via the Issues tab.


Building the Library

Clone the project and cd into it:

$ git clone git@github.com:forcedotcom/salesforcedx-apex.git
$ cd salesforcedx-apex

Ensure that you have Yarn installed, then run:

$ yarn install
$ yarn build

Using the Library

Install the library locally by adding this information to your project's package.json:

"@salesforce/apex-node": "file://path/to/salesforcedx-apex/packages/apex-node"

Using the library directly requires access to a Salesforce Connection. Create an instance of the specific Apex service to get access to the required methods. For example, to get a list of logs:

$ const authInfo = await AuthInfo.create({ username: myAdminUsername });
$ const connection = await Connection.create({ authInfo });

$ const logService = new LogService(connection);
$ const logList = await logService.getLogRecords();

You can use the same pattern for the Test Service and Execute Service as well.

Running the Test Suite

Run the test suite locally by building the project first and then running the tests.

$ yarn build
$ yarn test