Skip to content

@salesforce/b2c-tooling-sdk / safety / SafetyRule

Interface: SafetyRule ​

Defined in: packages/b2c-tooling-sdk/src/safety/types.ts:37

A safety rule that matches operations and specifies an action.

Rules support three matcher types, all using glob patterns (via minimatch):

  • method + path: Matches HTTP requests by method and URL path
  • job: Matches job execution by job ID (extracted from OCAPI URLs)
  • command: Matches CLI commands by oclif command ID (e.g., "sandbox:delete")

Example ​

json
{ "job": "sfcc-site-archive-export", "action": "allow" }
{ "command": "ecdn:cache:purge", "action": "confirm" }
{ "method": "DELETE", "path": "/code_versions/*", "action": "block" }

Properties ​

action ​

action: SafetyAction

Defined in: packages/b2c-tooling-sdk/src/safety/types.ts:47

Action to take when this rule matches.


command? ​

optional command: string

Defined in: packages/b2c-tooling-sdk/src/safety/types.ts:45

CLI command ID glob pattern (e.g., "sandbox:*", "ecdn:cache:purge").


job? ​

optional job: string

Defined in: packages/b2c-tooling-sdk/src/safety/types.ts:43

Job ID glob pattern. Matches OCAPI job execution URLs by job ID.


method? ​

optional method: string

Defined in: packages/b2c-tooling-sdk/src/safety/types.ts:39

HTTP method pattern (e.g., "POST", "DELETE"). Omit to match any method.


path? ​

optional path: string

Defined in: packages/b2c-tooling-sdk/src/safety/types.ts:41

URL path glob pattern (e.g., "/jobs/*/executions"). Matched with minimatch.

Released under the Apache-2.0 License.