JSPM

@salesforce/sf-plugins-core

1.15.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1004944
  • Score
    100M100P100Q203088F
  • License BSD-3-Clause

Utils for writing deploy and retrieve plugins

Package Exports

  • @salesforce/sf-plugins-core
  • @salesforce/sf-plugins-core/lib/exported.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@salesforce/sf-plugins-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM

Description

The @salesforce/sf-plugins-core provides utilities for writing sf plugins.

SfCommand Abstract Class

The SfCommand abstract class extends @oclif/core's Command class for examples of how to build a definition. ) class and adds useful extensions to ease the development of commands for use in the Salesforce Unified CLI.

  • SfCommand takes a generic type that defines the success JSON result
  • Enable the json flag support by default
  • Provides functions that help place success messages, warnings and errors into the correct location in JSON results
  • Enables additional help sections to the standard oclif command help output
  • Provides access to the cli-ux cli actions. This avoids having to import that interface from cli-ux and manually handling the --json flag.

Sf Hooks

Interface that defines the well known Unified CLI command hooks. SfHooks takes advantage of the oclif hooks framework, which provides a set of predefined events and the provides ability to define your own.

A hook has a name, say sf:deploy and to participate in the hook's run call, one creates a hook consumer, that registers itself using the name sf:deploy. There can be more than one hook registered with the same name and when the hook is "run", oclif hook will run each registered hook consumer, collect all results and return those results to the caller.

Deployer Interface

Interface for deploying Deployables. See @salesforce/plugin-deploy-retrieve-metadata#src/utils/metadataDeployer.ts as an example implementation.

Deauthorizer Abstract Class

The Deauthorizer is an abstract class that is used to implement a concrete implementations of deauthorizing an environment.

Prompter Class

A general purpose class that prompts a user for information. See inquirer NPM Module for more information.

Flags

Flags is a convenience reference to @oclif/core#Flags

Specialty Flags

These flags can be imported into a command and used like any other flag. See code examples in the links

  • orgApiVersionFlag
    • specifies a Salesforce API version.
    • reads from Config (if available)
    • validates version is still active
    • warns if version if deprecated
  • requiredOrgFlag
    • accepts a username or alias
    • aware of configuration defaults
    • throws if org or default doesn't exist or can't be found
  • optionalOrgFlag
    • accepts a username or alias
    • aware of configuration defaults
    • might be undefined if an org isn't found
  • requiredHubFlag
    • accepts a username or alias
    • aware of configuration defaults
    • throws if org or default doesn't exist or can't be found
    • throws if an org is found but is not a dev hub
  • durationFlag
    • specify a unit
    • optionally specify a min, max, and defaultValue
    • returns a Duration
    • can be undefined if you don't set the default
  • salesforceIdFlag
    • validates that IDs are valid salesforce ID
    • optionally restrict to 15/18 char
    • optionally require it to be begin with a certain prefix