Facilities to build an asynchronous handler, compatible with aleph, out of an interceptor chain.
This builds an opinionated chain with sane defaults, and a way to adapt the chain to the consumer's liking.
Processing of the chain is done by interceptor.
Facilities to build an asynchronous handler, compatible with aleph, out of an interceptor chain. This builds an opinionated chain with sane defaults, and a way to adapt the chain to the consumer's liking. Processing of the chain is done by [interceptor](https://github.com/exoscale/interceptor).
(add-to-chain chain {:blueprint.handler/keys [position target] :as interceptor})
Adds an interceptor to the chain, :blueprint.handler/position
determines
the position in the chain, and can be:
:first
: Puts the interceptor at the beginning of the chain.:last
: Puts the interceptor at the end of the chain.:before
: Puts the interceptor before the one whose name is stored at the
:blueprint.handler/target
key in the input map.:after
: Puts the interceptor after the one whose name is stored at the
:blueprint.handler/target
key in the input map.Incorrect parameters will yield to thrown exceptions.
Adds an interceptor to the chain, `:blueprint.handler/position` determines the position in the chain, and can be: - `:first`: Puts the interceptor at the beginning of the chain. - `:last`: Puts the interceptor at the end of the chain. - `:before`: Puts the interceptor before the one whose name is stored at the `:blueprint.handler/target` key in the input map. - `:after`: Puts the interceptor after the one whose name is stored at the `:blueprint.handler/target` key in the input map. Incorrect parameters will yield to thrown exceptions.
(interceptor-chain this)
Yield a partial interceptor chain
Yield a partial interceptor chain
(build-chain {:blueprint.handler/keys [additional disabled] :as config})
Build an interceptor chain in three phases:
::additional
::disabled
Build an interceptor chain in three phases: - Start from the default chain - Process additional interceptors provided in `::additional` - Removes interceptors by name based on those provided in `::disabled` - Call the interceptor build step if any with the provided config
(build-with config {:keys [builder spec] :as interceptor})
Interceptor builder, if a :builder
key is found in the
interceptor, it will be called on itself, with the configuration
as a second argument. Validates with spec at :spec
key if provided.
This allows providing configuration to the chain
Interceptor builder, if a `:builder` key is found in the interceptor, it will be called on itself, with the configuration as a second argument. Validates with spec at `:spec` key if provided. This allows providing configuration to the chain
The default interceptor chain. doc/interceptor.md should be updated when this changes.
The default interceptor chain. doc/interceptor.md should be updated when this changes.
(expand-chain ixdef)
Resolve element to an interceptor chain. Works against all
implementations of BlueprintInterceptorChain, maps containing
::interceptor-chain
, vectors are rendered as is, and single
interceptors are rendered as a vector of themselves.
Resolve element to an interceptor chain. Works against all implementations of BlueprintInterceptorChain, maps containing `::interceptor-chain`, vectors are rendered as is, and single interceptors are rendered as a vector of themselves.
(place interceptor position)
(place interceptor position target)
Helper function to populate an interceptor with position info
Helper function to populate an interceptor with position info
(ring-handler config)
(ring-handler definition handler)
(ring-handler definition handler config)
Build a ring handler from a configuration map, optionally takes the two required arguments: the API definition and handler function as arguments.
Yields a function of a single request argument which processes the chain and yields a final deferred ring response
Build a ring handler from a configuration map, optionally takes the two required arguments: the API definition and handler function as arguments. Yields a function of a single request argument which processes the chain and yields a final deferred ring response
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close