npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sfio

v0.0.15

Published

Stream CSV data in and out of Salesforce

Downloads

3

Readme

sfio

Stream CSV data in and out of Salesforce.

sfio uses the new Bulk API 2.0 for insert, update, upsert, and delete. https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/introduction_bulk_api_2.htm

sfio uses the old Bulk API for query because the new one doesn't support query (yet, maybe never will).

Get Started

See https://github.com/Candoris/sfio-starter for a quick start template project.

No More Lookup Maps!!!

One of the big reasons we moved to the new bulk api 2.0 is the relationship feature.

In the example below, we can use an external id field on Account to link the contact to the account. This is much more convenient than having somehow lookup the account's Salesforce Id.

FirstName,LastName,Account.SomeExternalId__c
Tom,Jones,293483

https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/datafiles_csv_rel_field_header_row.htm

Install

npm i -g git+ssh://[email protected]:Candoris/sfio.git

Enjoy

For help type a command without any argument.

poll waits till the job in Salesforce has completed successfully or failed before returning. On error, we exit with a non-zero (error) code.

sf-query        SOQL [pkChunking] [queryAll] > some.csv

sf-insert       OBJECT [poll] < some.csv
sf-update       OBJECT [poll] < some.csv
sf-upsert       OBJECT ID_COLUMN [poll] < some.csv
sf-delete       OBJECT [poll] < some.csv

sf-info         JOB_ID > some.json

sf-failed       JOB_ID [plain] > some.csv
sf-unprocessed  JOB_ID > some.csv
sf-success      JOB_ID > some.csv

Configure

sfio looks for a file named sfio-config.js in the current directory. This file should not contain any secrets. It should simply point to the actual config file which should be located in the folder one level above your project folder and be named something that tells us which customer it is.

./sfio-config.js

exports = module.exports = require('../sfio-my-customer.js');

The real config file will contain both source and destination information because you may be querying from one Salesforce organization and updating another. It also will contain secrets which must be secret and never checked into git.

~/my-configs/sfio-my-customer.js

exports = module.exports = {
  source: {
    url: 'https://login.salesforce.com',
    username: '[email protected]',
    password: '***',
    token: '***',
    apiVersion: '41.0',
    consumerKey: '3MV***xu4',
    consumerSecret: '694***048'
  },
  dest: {
    url: 'https://login.salesforce.com',
    username: '[email protected]',
    password: '***',
    token: '***',
    apiVersion: '41.0',
    consumerKey: '3MV***xu4',
    consumerSecret: '694***048'
  }
};

// exports = module.exports = {
//   source: {
//     url: 'https://test.salesforce.com',
//     username: '[email protected]',
//     password: '***',
//     token: '***',
//     apiVersion: '41.0',
//     consumerKey: '3MV***xu4',
//     consumerSecret: '694***048'
//   },
//   dest: {
//     url: 'https://test.salesforce.com',
//     username: '[email protected]',
//     password: '***',
//     token: '***',
//     apiVersion: '41.0',
//     consumerKey: '3MV***xu4',
//     consumerSecret: '694***048'
//   }
// };