AbstractThe policy config type extending BasePolicyConfig
The rule type extending BasePolicyRule
Instance state type
Headers type
Params type
The policy config type extending BasePolicyConfig
The rule type extending BasePolicyRule
Instance state type
Headers type
Params type
Whether the policy is initialized and enabled.
Clear the rules cache.
Call this if you need to force re-computation of rules, though typically this is not needed.
ProtectedcomputeCompute rule configuration for a method+path combination.
This is the expensive O(n) operation that gets memoized. Finds matching rule and merges with policy defaults.
HTTP method (uppercase)
Request path
Computed rule or null if disabled
Protected AbstractgetGet the default HTTP methods for this policy. Subclasses must implement this.
Protected AbstractgetGet the default serializer for this policy. Subclasses must implement this.
Initialize the policy with configuration.
Parses the config (boolean or object), validates rules, and sets up internal state for fast lookups.
Optionalconfig: boolean | TConfigBoolean true for defaults, or full config object
Protected AbstractmergeResolve policy configuration for a specific request.
Uses memoization for rule matching (O(n) only once per method+path). Skip callbacks are always evaluated since they depend on request context.
HTTP method (uppercase)
Request path
Full request context for skip callback
OptionalskipCallback: (ctx: RequestKeyOptions<S, H, P>) => boolean | undefinedOptional skip callback from config
Resolved rule or null if disabled
Abstract base class for resilience policies.
Provides the common three-method pattern used by all policies:
init: Parse config, initialize state (O(1))resolve: Memoized lookup + dynamic checks (O(1) amortized)compute: Rule matching, memoized (O(n) first call only)Subclasses must implement:
getDefaultSerializer(): Return the default serializer for this policygetDefaultMethods(): Return the default HTTP methods for this policymergeRuleWithDefaults(rule): Merge a rule with policy defaults