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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@salesforce/plugin-bre-to-cml

v1.0.27

Published

Plugin for migrating BRE based configurator rules to CML.

Readme

plugin-bre-to-cml

NPM Downloads/week License

Install

sf plugins install @salesforce/[email protected]

Contributing

  1. Please read our Code of Conduct
  2. Create a new issue before starting your project so that we can keep track of what you are trying to add/fix. That way, we can also offer suggestions or let you know if there is already an effort in progress.
  3. Fork this repository.
  4. Build the plugin locally
  5. Create a topic branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
  6. Edit the code in your fork.
  7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
  8. Sign CLA (see CLA below).
  9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.

CLA

External contributors will be required to sign a Contributor's License Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.

Build

To build the plugin locally, make sure to have yarn installed and run the following commands:

# Clone the repository
git clone [email protected]:salesforcecli/plugin-bre-to-cml

# Install the dependencies and compile
yarn install
yarn build

To use your plugin, run using the local ./bin/dev.js or ./bin/dev.cmd file.

# Run using local run file.
./bin/dev cml

There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.

# Link your plugin to the sf cli
sf plugins link .
# To verify
sf plugins

Commands

sf cml convert prod-cfg-rules

Converts BRE based Standard Configurator rules represented as JSON to CML and saves it as a pair of CML and association files.

USAGE
  $ sf cml convert prod-cfg-rules -o <value> -r <value> -c <value> [--json] [--flags-dir <value>] [--api-version <value>] [-d
    <value>] [-x <value>] [-v <value>]

FLAGS
  -c, --cml-api=<value>              (required) Unique CML API Name to be created.
  -d, --workspace-dir=<value>        Directory where working files are located, exported rules JSON and where CMLs will
                                     be created.
  -o, --target-org=<value>           (required) Username or alias of the target org. Not required if the `target-org`
                                     configuration variable is already set.
  -r, --pcr-file=<value>             (required) Name of the JSON file that contain exported standard Product
                                     Configuration Rules.
  -v, --products-file=<value>        Name of the JSON file that contain exported Products from PCM (if not present
                                     products will be fetched automatically).
  -x, --additional-products=<value>  Comma-separated list of additional product IDs for which CML types should be
                                     generated.
      --api-version=<value>          Override the api version used for api requests made by this command

GLOBAL FLAGS
  --flags-dir=<value>  Import flag values from a directory.
  --json               Format output as json.

DESCRIPTION
  Converts BRE based Standard Configurator rules represented as JSON to CML and saves it as a pair of CML and
  association files.

  Before you execute this command make sure to migrate you PCM or perform migration of rules within the same org.

  Export BRE based Standard Configurator rules using sf data export bulk plugin and save results in a JSON file:
  sf data export bulk -o breMigOrg --query "SELECT ApiName, ConfigurationRuleDefinition,Description, EffectiveFromDate,
  EffectiveToDate, Id, IsDeleted, Name, ProcessScope, RuleSubType, RuleType, Sequence, Status FROM
  ProductConfigurationRule WHERE RuleType = 'Configurator' AND ApiName = 'myTestBundle'" --output-file
  ./data/ProductConfigurationRules.json --result-format json --wait 10 --all-rows

  This command executes following logic:

  - Read SC Rules from the json file and build a list of `ConfiguratorRuleInput` to mimic the JSON structure of
  `ConfigurationRuleDefinition`
  - Group rules by non-intersecting `Product2` IDs (CMLs can’t share products)
  - For each group:
  - Query PCM for related products (for bundle rules) or root definitions (for others)
  - Build an in-memory representation of the CML
  - Apply logic to build constraints
  - Serialize the in-memory CML to a blob for import as an Expression Set, save it in a cml-api.cml file.
  - Create `ExpressionSetConstraintObj` association records pointing to the `cml-api` name and write them to
  `cml-api_associations.csv` file.
  - If multiple CML and association files are produced 1-N number will be appended to the names of files.

EXAMPLES
  $ sf cml convert prod-cfg-rules --pcr-file data/ProductConfigurationRules.json --cml-api MY_TEST --workspace-dir data --target-org breMigOrg

sf cml import as-expression-set

Imports CML and associations to the target org

USAGE
  $ sf cml import as-expression-set -o <value> -x <value> -c <value> [--json] [--flags-dir <value>] [--api-version <value>] [-d
    <value>]

FLAGS
  -c, --cml-api=<value>             (required) Unique CML API Name to be created.
  -d, --workspace-dir=<value>       Directory where converted CML and assocciations csv files are located.
  -o, --target-org=<value>          (required) Username or alias of the target org. Not required if the `target-org`
                                    configuration variable is already set.
  -x, --context-definition=<value>  (required) Context Definition name to be assocciated with the CML.
      --api-version=<value>         Override the api version used for api requests made by this command

GLOBAL FLAGS
  --flags-dir=<value>  Import flag values from a directory.
  --json               Format output as json.

DESCRIPTION
  Imports CML and associations to the target org

  Review CM created by conversion command before doing import.
  This command executes following logic:
  - Import one CML at a time
  - Upsert the Expression Set using the `cml-api` name
  - Read and upsert `ExpressionSetConstraintObj` rows from the `cml-api_associations.csv` file (resolving FKs)
  - Upload the CML blob

EXAMPLES
  $ sf cml import as-expression-set --cml-api MY_TEST --context-definition PricingTransactionCD2 --workspace-dir data --target-org tgtOrg