Webhook delivery and subscription module for for-http
Methods
# static matchesTopic(actual, pattern) → {boolean}
Supports the enhanced <model>.<action|*>.<item id/pk> form: a bare model
name is treated as <model>.*, and * matches any single segment while a trailing
* swallows any remaining segments. The global catch-alls * and *.* match any
non-empty topic. A * mid-pattern is NOT greedy (it matches exactly one segment),
so patterns must align segment-by-segment.
Matches a concrete event topic against a webhook topic pattern
sequenceDiagram
participant Caller
participant matches as matchesTopic
Caller->>matches: actual, pattern
alt pattern is "*" or "*.*"
matches-->>Caller: true
else pattern has a single model segment
matches->>matches: treat pattern as ".*"
end
loop over pattern segments
alt segment is trailing "*"
matches-->>Caller: true
else segment is mid "*"
matches->>matches: match exactly one actual segment
else
matches->>matches: actual segment must equal pattern segment
end
end
matches-->>Caller: equal lengths
Parameters:
| Name | Type | Description |
|---|---|---|
actual |
string
|
The concrete |
pattern |
string
|
The webhook subscription pattern to match against |
Whether the actual topic matches the pattern
boolean