New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sf-ent

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sf-ent

A declarative interface for working with the Salesforce Composite API

latest
Source
npmnpm
Version
0.5.1
Version published
Maintainers
0
Created
Source

This is a beta version that is not suitable for production use.

Intro

The Salesforce Composite API is an invaluable tool for loading complex data sets across orgs. It is also, unfortunately, verbose and time-consuming to implement.

sf-ent makes harnessing the Composite API fast and intuitive. Use it interactively from the command line or programmatically as a script library. Build requests and load data quickly.

Installation

npm install [--global] sf-ent

Usage

The CLI and script APIs are very similar. Commands and subcommands for each use the same names.

The primary difference is that the CLI will prompt you for required inputs and provides object and field auto-completion based on the schema of an authenticated org. Some CLI commands also support flags. Pass -h or --help with any command to learn more.

generate

The following shows an example of using the generate command to create a composite API request file with a single query subrequest:

CLI:

$ sfent generate --out ./query.json 
$ # prompts will guide you to create the query

Script:

const { ent } = require('sf-ent');

// all commands are chainable and must be terminated by invocation of done(), returning a Promise that resolves to the command output
await ent()
    .generate({ out: './query.json' })
        .query('select id from recordType where sobjectType = \'Account\' and developerName = \'consumer\'')
    .done();

API

Full documentation coming soon.

Notes

TypeInfo in URL Hash

sf-ent appends the name of the class that constructs each Composite subrequest as a URL hash, a la:

{
    // ...
    "url": "/services/data/v60.0/query/?q=SELECT id FROM Account limit 1#Query_github.com/kev4ev/sf-ent#urlTypeInfo"
    // ...
}

It does this so that the prototype can be inferred when a request is loaded into the CLI for interactive modification. Since hashes are not read by the server it has no effect on the request to Salesforce.

Happy Building!

FAQs

Package last updated on 12 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts