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

sfpecli

v1.2.0

Published

This is sfpe CLI application for working with Salesforce platform events from the command line.

Downloads

5

Readme

SfPeCli

sfpe is a command-line interface (CLI) application for working with Salesforce Platform Events. With this CLI, you can subscribe to platform events and Change Data Capture events, publish platform events, and listen to events within Salesforce or any other system subscribed to those platform events.

Features

Subscribe to Platform Events: Subscribe with a replayId to receive all platform events published after that replayId. You can also specify the number of events to receive.
Publish Platform Events: Publish platform events directly from the CLI.
Authentication Management: Store and manage authenticated connections securely.

See command line help with -h or --help parameters of the cli.

To install CLI

npm install sfpecli -g

For CLI help:

sfpe -h

Authenticated Connection Details

Authenticated connections are stored in OS-specific temporary storage. Access tokens are stored as encrypted strings. You can override the encryption key using the SFPE_ENCRYPTION_KEY environment variable.
To allow CLI to authenticate you need to create and configure a connected app in Salesforce.

Alias

Most commands, except list, require an alias. When you authenticate against a Salesforce org, you need to provide an alias, which is used for subsequent platform event commands. The list command displays all available authenticated connections, but note that available connections may have expired access tokens. If a token is expired, re-authentication is required. You can use any string without white spaces as org alias.

Authentication Methods

Below 3 authorization flows are supported. For all available flags see commands help with -h flag.

Using Username and Password OAuth Flow

You can use aup subcommand to authorize in Salesforce using username and password by providing the required inputs into CLI. This flow is not recommended to be used in production orgs. Optionally you can provide instance url.

sfpe aup -a <org_alias> -u <salesforce_username> --token <security_token> -p <password>  -s <client_secret> -c <client_id>

Using client credential flow

You can use acc subcommand to authorize in Salesforce using client credentials flow. This flow only require client_id and client_secret.

sfpe acc -a <org_alias>  -s <client_secret> -c <client_id> -l <instance_url>

Using jwt flow

You can use awt subcommand to authorize in Salesforce using jwt flow.This flow requires RS256 based private and public keys pair.

sfpe awt -a <org_alias>  -c <client_id> -u <salesforce_username> -f <private_key_filepath>

Platform events commands

Subscribe to platform events

sfpe evtsub -a <org_alias> -t <platformevent_or_changeevent>
# Note: org_alias is alias of already athenticated org, make sure authentication is still valid (valid access_token).

You can provide number of events to receive with -n flag.
Also you can provide replayId to receive all events published after that replayId, like shown below.

sfpe evtsub -a <org_alias> -t <platformevent_or_changeevent> -n 10 -r 18932
# This gives you 10 events published after replayId 18932

Publishing platform events

sfpe evtpub -a <org_alias> -t <platform_event> -m <"any_text_string">

If you need to pass JSON, you can use stringified json in the message input for command.

To get code for development

Clone the git repository

install dependencies:

npm install

Roadmap

  1. Implemntation of refresh token flow.