Skip to content

Match and Replace ​

CurrentMatchReplaceRuleChangeEvent ​

CurrentMatchReplaceRuleChangeEvent = object

Event fired when the current match and replace rule changes.

Properties ​

ruleId ​

ruleId: ID | undefined

The ID of the newly selected rule, or undefined if no rule is selected.


MatchReplaceCollection ​

MatchReplaceCollection = object

A collection in Match and Replace.

Properties ​

id ​

id: ID

name ​

name: string

ruleIds ​

ruleIds: ID[]


MatchReplaceMatcherName ​

MatchReplaceMatcherName = object

A matcher that matches by name (for headers, query parameters, etc.).

Properties ​

kind ​

kind: "MatcherName"

name ​

name: string


MatchReplaceMatcherRaw ​

MatchReplaceMatcherRaw = MatchReplaceMatcherRawRegex | MatchReplaceMatcherRawValue | MatchReplaceMatcherRawFull

A matcher for raw operations in Match and Replace.


MatchReplaceMatcherRawFull ​

MatchReplaceMatcherRawFull = object

This matcher will match the entire section.

Properties ​

kind ​

kind: "MatcherRawFull"


MatchReplaceMatcherRawRegex ​

MatchReplaceMatcherRawRegex = object

This matcher will match using a regex over the section.

Properties ​

kind ​

kind: "MatcherRawRegex"

regex ​

regex: string


MatchReplaceMatcherRawValue ​

MatchReplaceMatcherRawValue = object

This matcher will match the value if present in the section.

Properties ​

kind ​

kind: "MatcherRawValue"

value ​

value: string


MatchReplaceOperationAll ​

MatchReplaceOperationAll = KeepOperation<MatchReplaceOperationAllRaw>

An operation for the entire request/response section.


MatchReplaceOperationAllRaw ​

MatchReplaceOperationAllRaw = object

A raw operation for the entire request/response section.

Properties ​

kind ​

kind: "OperationAllRaw"

matcher ​

matcher: MatchReplaceMatcherRaw

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationBody ​

MatchReplaceOperationBody = KeepOperation<MatchReplaceOperationBodyRaw>

An operation for the body section.


MatchReplaceOperationBodyRaw ​

MatchReplaceOperationBodyRaw = object

A raw operation for the body section.

Properties ​

kind ​

kind: "OperationBodyRaw"

matcher ​

matcher: MatchReplaceMatcherRaw

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationFirstLine ​

MatchReplaceOperationFirstLine = KeepOperation<MatchReplaceOperationFirstLineRaw>

An operation for the first line section.


MatchReplaceOperationFirstLineRaw ​

MatchReplaceOperationFirstLineRaw = object

A raw operation for the request first line.

Properties ​

kind ​

kind: "OperationFirstLineRaw"

matcher ​

matcher: MatchReplaceMatcherRaw

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationHeader ​

MatchReplaceOperationHeader = MatchReplaceOperationHeaderRaw | MatchReplaceOperationHeaderAdd | MatchReplaceOperationHeaderRemove | MatchReplaceOperationHeaderUpdate

An operation for the header section.


MatchReplaceOperationHeaderAdd ​

MatchReplaceOperationHeaderAdd = object

An operation to add a header.

Properties ​

kind ​

kind: "OperationHeaderAdd"

matcher ​

matcher: MatchReplaceMatcherName

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationHeaderRaw ​

MatchReplaceOperationHeaderRaw = object

A raw operation for the header section.

Properties ​

kind ​

kind: "OperationHeaderRaw"

matcher ​

matcher: MatchReplaceMatcherRaw

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationHeaderRemove ​

MatchReplaceOperationHeaderRemove = object

An operation to remove a header.

Properties ​

kind ​

kind: "OperationHeaderRemove"

matcher ​

matcher: MatchReplaceMatcherName


MatchReplaceOperationHeaderUpdate ​

MatchReplaceOperationHeaderUpdate = object

An operation to update a header.

Properties ​

kind ​

kind: "OperationHeaderUpdate"

matcher ​

matcher: MatchReplaceMatcherName

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationMethod ​

MatchReplaceOperationMethod = KeepOperation<MatchReplaceOperationMethodUpdate>

An operation for the request method section.


MatchReplaceOperationMethodUpdate ​

MatchReplaceOperationMethodUpdate = object

An operation to update the request method.

Properties ​

kind ​

kind: "OperationMethodUpdate"

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationPath ​

MatchReplaceOperationPath = KeepOperation<MatchReplaceOperationPathRaw>

An operation for the request path section.


MatchReplaceOperationPathRaw ​

MatchReplaceOperationPathRaw = object

A raw operation for the request path section.

Properties ​

kind ​

kind: "OperationPathRaw"

matcher ​

matcher: MatchReplaceMatcherRaw

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationQuery ​

MatchReplaceOperationQuery = MatchReplaceOperationQueryRaw | MatchReplaceOperationQueryAdd | MatchReplaceOperationQueryRemove | MatchReplaceOperationQueryUpdate

An operation for the request query section.


MatchReplaceOperationQueryAdd ​

MatchReplaceOperationQueryAdd = object

An operation to add a query parameter.

Properties ​

kind ​

kind: "OperationQueryAdd"

matcher ​

matcher: MatchReplaceMatcherName

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationQueryRaw ​

MatchReplaceOperationQueryRaw = object

A raw operation for the request query section.

Properties ​

kind ​

kind: "OperationQueryRaw"

matcher ​

matcher: MatchReplaceMatcherRaw

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationQueryRemove ​

MatchReplaceOperationQueryRemove = object

An operation to remove a query parameter.

Properties ​

kind ​

kind: "OperationQueryRemove"

matcher ​

matcher: MatchReplaceMatcherName


MatchReplaceOperationQueryUpdate ​

MatchReplaceOperationQueryUpdate = object

An operation to update a query parameter.

Properties ​

kind ​

kind: "OperationQueryUpdate"

matcher ​

matcher: MatchReplaceMatcherName

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationSNI ​

MatchReplaceOperationSNI = KeepOperation<MatchReplaceOperationSNIRaw>

An operation for the request SNI section.


MatchReplaceOperationSNIRaw ​

MatchReplaceOperationSNIRaw = object

A raw operation for the request SNI.

Properties ​

kind ​

kind: "OperationSNIRaw"

replacer ​

replacer: MatchReplaceReplacer


MatchReplaceOperationStatusCode ​

MatchReplaceOperationStatusCode = KeepOperation<MatchReplaceOperationStatusCodeUpdate>

An operation for the response status code section.


MatchReplaceOperationStatusCodeUpdate ​

MatchReplaceOperationStatusCodeUpdate = object

An operation to update the response status code.

Properties ​

kind ​

kind: "OperationStatusCodeUpdate"

replacer ​

replacer: MatchReplaceReplacer


MatchReplacePageContext ​

MatchReplacePageContext = object

Match and Replace page context.

Properties ​

kind ​

kind: "MatchReplace"

selection ​

selection: Selection<ID>


MatchReplaceReplacer ​

MatchReplaceReplacer = MatchReplaceReplacerTerm | MatchReplaceReplacerWorkflow

A replacer in Match and Replace.


MatchReplaceReplacerTerm ​

MatchReplaceReplacerTerm = object

A replacer that replaces with a term. If the matcher is a regex, groups will be interpolated.

Properties ​

kind ​

kind: "ReplacerTerm"

term ​

term: string


MatchReplaceReplacerWorkflow ​

MatchReplaceReplacerWorkflow = object

A replacer that replaces with the result of a workflow. The input of the workflow depends on the operation and matcher.

Properties ​

kind ​

kind: "ReplacerWorkflow"

workflowId ​

workflowId: ID


MatchReplaceRule ​

MatchReplaceRule = object

A rule in Match and Replace.

Properties ​

collectionId ​

collectionId: ID

The ID of the collection the rule belongs to.

id ​

id: ID

The ID of the rule.

isEnabled ​

isEnabled: boolean

Whether the rule is enabled.

name ​

name: string

The name of the rule.

query ​

query: HTTPQL

The HTTPQL query to match the rule against. Only requests that match the query will be affected by the rule.

section ​

section: MatchReplaceSection

The section of the rule.


MatchReplaceSDK ​

MatchReplaceSDK = object

Utilities to interact with the Match and Replace page.

Properties ​

addRuleIndicator() ​

addRuleIndicator: (ruleId: ID, indicator: AddIndicatorOptions) => Indicator

Add an indicator to a rule. Indicators are displayed next to the session name in the collections tree.

Parameters ​
ParameterTypeDescription
ruleIdIDThe ID of the rule to add the indicator to.
indicatorAddIndicatorOptionsThe indicator configuration.
Returns ​

Indicator

A handle object with a remove method to remove the indicator.

Example ​
ts
const indicator = sdk.matchReplace.addRuleIndicator(ruleId, {
  icon: "fas fa-exclamation-triangle",
  description: "Security warning",
});

// Later, remove the indicator
indicator.remove();
addToSlot ​

addToSlot: DefineAddToSlotFn<MatchReplaceSlotContent>

Add a component to a slot.

Param ​

The slot to add the component to.

Param ​

The content to add to the slot.

Example ​
ts
sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
  type: "Button",
  label: "My Button",
  icon: "my-icon",
  onClick: () => {
    console.log("Button clicked");
  },
});

sdk.matchReplace.addToSlot(MatchReplaceSlot.CreateHeader, {
  type: "Custom",
  definition: MyComponent,
});

sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
  type: "Command",
  commandId: "my-command",
  icon: "my-icon",
});
createCollection() ​

createCollection: (options: object) => Promise<MatchReplaceCollection>

Create a collection.

Parameters ​
ParameterTypeDescription
options{ name: string; }The options for the collection.
options.namestringThe name of the collection.
Returns ​

Promise<MatchReplaceCollection>

createRule() ​

createRule: (options: object) => Promise<MatchReplaceRule>

Create a rule.

Parameters ​
ParameterTypeDescription
options{ collectionId: ID; name: string; query: HTTPQL; section: MatchReplaceSection; sources: Source[]; }The options for the rule.
options.collectionIdIDThe ID of the collection the rule belongs to.
options.namestringThe name of the rule.
options.queryHTTPQLThe HTTPQL query to match the rule against.
options.sectionMatchReplaceSection-
options.sourcesSource[]The sources the rule belongs to.
Returns ​

Promise<MatchReplaceRule>

deleteCollection() ​

deleteCollection: (id: ID) => Promise<void>

Delete a collection.

Parameters ​
ParameterTypeDescription
idIDThe ID of the collection.
Returns ​

Promise<void>

deleteRule() ​

deleteRule: (id: ID) => Promise<void>

Delete a rule.

Parameters ​
ParameterTypeDescription
idIDThe ID of the rule.
Returns ​

Promise<void>

getActiveRules() ​

getActiveRules: () => MatchReplaceRule[]

Get all active rules. Rules are ordered in priority from highest to lowest.

Returns ​

MatchReplaceRule[]

All active rules.

getCollections() ​

getCollections: () => MatchReplaceCollection[]

Get all collections.

Returns ​

MatchReplaceCollection[]

getCurrentRule() ​

getCurrentRule: () => MatchReplaceRule | undefined

Get the currently selected rule.

Returns ​

MatchReplaceRule | undefined

The currently selected rule, or undefined if no rule is selected.

getRules() ​

getRules: () => MatchReplaceRule[]

Get all rules.

Returns ​

MatchReplaceRule[]

All rules.

onCurrentRuleChange() ​

onCurrentRuleChange: (callback: (event: CurrentMatchReplaceRuleChangeEvent) => void) => ListenerHandle

Subscribe to current rule changes.

Parameters ​
ParameterTypeDescription
callback(event: CurrentMatchReplaceRuleChangeEvent) => voidThe callback to call when the selected rule changes.
Returns ​

ListenerHandle

An object with a stop method that can be called to stop listening to rule changes.

Example ​
ts
const handler = sdk.matchReplace.onCurrentRuleChange((event) => {
  console.log(`Rule ${event.ruleId} got selected!`);
});

// Later, stop listening
handler.stop();
selectRule() ​

selectRule: (id: ID | undefined) => void

Select a rule to be displayed in the UI.

Parameters ​
ParameterTypeDescription
idID | undefinedThe ID of the rule, or undefined to clear the selection.
Returns ​

void

toggleRule() ​

toggleRule: (id: ID, enabled: boolean) => Promise<void>

Toggle a rule.

Parameters ​
ParameterTypeDescription
idIDThe ID of the rule.
enabledbooleanWhether the rule should be enabled.
Returns ​

Promise<void>

updateCollection() ​

updateCollection: (id: ID, options: object) => Promise<MatchReplaceCollection>

Update a collection.

Parameters ​
ParameterTypeDescription
idIDThe ID of the collection.
options{ name: string; }The new values for the collection.
options.namestringThe new name of the collection.
Returns ​

Promise<MatchReplaceCollection>

updateRule() ​

updateRule: (id: ID, options: object) => Promise<MatchReplaceRule>

Update a rule.

Parameters ​
ParameterTypeDescription
idIDThe ID of the rule.
options{ name: string; query?: HTTPQL; section: MatchReplaceSection; sources: Source[]; }The new values for the rule.
options.namestringThe new name of the rule.
options.query?HTTPQLThe new HTTPQL query of the rule.
options.sectionMatchReplaceSectionThe new section of the rule.
options.sourcesSource[]The new sources of the rule.
Returns ​

Promise<MatchReplaceRule>


MatchReplaceSection ​

MatchReplaceSection = MatchReplaceSectionRequestAll | MatchReplaceSectionRequestBody | MatchReplaceSectionRequestFirstLine | MatchReplaceSectionRequestHeader | MatchReplaceSectionRequestMethod | MatchReplaceSectionRequestPath | MatchReplaceSectionRequestQuery | MatchReplaceSectionRequestSNI | MatchReplaceSectionResponseAll | MatchReplaceSectionResponseBody | MatchReplaceSectionResponseFirstLine | MatchReplaceSectionResponseHeader | MatchReplaceSectionResponseStatusCode

A discriminated union of all possible match and replace sections.


MatchReplaceSectionRequestAll ​

MatchReplaceSectionRequestAll = object

A section for the entire request.

Properties ​

kind ​

kind: "SectionRequestAll"

operation ​

operation: MatchReplaceOperationAll


MatchReplaceSectionRequestBody ​

MatchReplaceSectionRequestBody = object

A section for the request body.

Properties ​

kind ​

kind: "SectionRequestBody"

operation ​

operation: MatchReplaceOperationBody


MatchReplaceSectionRequestFirstLine ​

MatchReplaceSectionRequestFirstLine = object

A section for the request first line.

Properties ​

kind ​

kind: "SectionRequestFirstLine"

operation ​

operation: MatchReplaceOperationFirstLine


MatchReplaceSectionRequestHeader ​

MatchReplaceSectionRequestHeader = object

A section for the request headers.

Properties ​

kind ​

kind: "SectionRequestHeader"

operation ​

operation: MatchReplaceOperationHeader


MatchReplaceSectionRequestMethod ​

MatchReplaceSectionRequestMethod = object

A section for the request method.

Properties ​

kind ​

kind: "SectionRequestMethod"

operation ​

operation: MatchReplaceOperationMethod


MatchReplaceSectionRequestPath ​

MatchReplaceSectionRequestPath = object

A section for the request path.

Properties ​

kind ​

kind: "SectionRequestPath"

operation ​

operation: MatchReplaceOperationPath


MatchReplaceSectionRequestQuery ​

MatchReplaceSectionRequestQuery = object

A section for the request query string.

Properties ​

kind ​

kind: "SectionRequestQuery"

operation ​

operation: MatchReplaceOperationQuery


MatchReplaceSectionRequestSNI ​

MatchReplaceSectionRequestSNI = object

A section for the request SNI.

Properties ​

kind ​

kind: "SectionRequestSNI"

operation ​

operation: MatchReplaceOperationSNI


MatchReplaceSectionResponseAll ​

MatchReplaceSectionResponseAll = object

A section for the entire response.

Properties ​

kind ​

kind: "SectionResponseAll"

operation ​

operation: MatchReplaceOperationAll


MatchReplaceSectionResponseBody ​

MatchReplaceSectionResponseBody = object

A section for the response body.

Properties ​

kind ​

kind: "SectionResponseBody"

operation ​

operation: MatchReplaceOperationBody


MatchReplaceSectionResponseFirstLine ​

MatchReplaceSectionResponseFirstLine = object

A section for the response first line.

Properties ​

kind ​

kind: "SectionResponseFirstLine"

operation ​

operation: MatchReplaceOperationFirstLine


MatchReplaceSectionResponseHeader ​

MatchReplaceSectionResponseHeader = object

A section for the response headers.

Properties ​

kind ​

kind: "SectionResponseHeader"

operation ​

operation: MatchReplaceOperationHeader


MatchReplaceSectionResponseStatusCode ​

MatchReplaceSectionResponseStatusCode = object

A section for the response status code.

Properties ​

kind ​

kind: "SectionResponseStatusCode"

operation ​

operation: MatchReplaceOperationStatusCode


MatchReplaceSlotContent ​

MatchReplaceSlotContent = object

Content that can be added to match and replace slots.

Properties ​

create-header ​

create-header: ButtonSlotContent | CustomSlotContent | CommandSlotContent

update-header ​

update-header: ButtonSlotContent | CustomSlotContent | CommandSlotContent


MatchReplaceSlot ​

const MatchReplaceSlot: object

The slots in the Match and Replace UI.

Type Declaration ​

CreateHeader ​

readonly CreateHeader: "create-header"

The header area of the rule form create component.

UpdateHeader ​

readonly UpdateHeader: "update-header"

The header area of the rule form update component.


Source ​

const Source: object

The source of a match and replace rule.

Type Declaration ​

Automate ​

readonly Automate: "AUTOMATE"

Intercept ​

readonly Intercept: "INTERCEPT"

Plugin ​

readonly Plugin: "PLUGIN"

Replay ​

readonly Replay: "REPLAY"

Sample ​

readonly Sample: "SAMPLE"

Workflow ​

readonly Workflow: "WORKFLOW"