Liking cljdoc? Tell your friends :D

com.cognitect.vase.actions

Functions to construct interceptors dynamically.

The functions with names that end in '-action' compile Pedestal interceptors. These are the main public entry points, and are used by the literals namespace when loading Vase descriptors.

Take care to avoid code generation during request processing. It is time-consuming, so it should be done at application startup time instead.

Actions are created by emitting code (in the functions named -exprs) which gets evaluated to build an interceptor. Arguments to the -exprs functions are interpolated into the emitted code. These arguments can contain literals or one s-expression each.

For example, respond-action-exprs has an argument body that will be used as the HTTP response body. It may be a string or an s-expression.

When s-expression arguments are evaluated, they have some bindings available in scope:

  • request - contains the Pedestal request map
  • context - contains the Pedestal context map
  • request parameters captured from path-params or parsed body parameters and named in the params seq

E.g., if params holds ['userid] and the request matched a route with "/users/:userid", then the s-expression will have the symbol 'userid bound to the value of that request parameter.

Functions to construct interceptors dynamically.

The functions with names that end in '-action' compile Pedestal
interceptors. These are the main public entry points, and are used
by the `literals` namespace when loading Vase descriptors.

Take care to avoid code generation during request processing. It is
time-consuming, so it should be done at application startup time
instead.

Actions are created by emitting code (in the functions named
`-exprs`) which gets evaluated to build an interceptor. Arguments to
the `-exprs` functions are interpolated into the emitted code. These
arguments can contain literals or one s-expression each.

For example, `respond-action-exprs` has an argument `body` that will
be used as the HTTP response body. It may be a string or an
s-expression.

When s-expression arguments are evaluated, they have some bindings
available in scope:

- `request` - contains the Pedestal request map
- `context` - contains the Pedestal context map
- request parameters captured from path-params or parsed body
  parameters _and_ named in the `params` seq

E.g., if `params` holds `['userid]` and the request matched a route
with "/users/:userid", then the s-expression will have the symbol
`'userid` bound to the value of that request parameter.
raw docstring

apply-txclj

(apply-tx conn tx-data args)

bindclj

(bind param-syms)

coerce-arg-valclj

(coerce-arg-val v)
(coerce-arg-val args k)
(coerce-arg-val args k default-v)

coerce-paramsclj

(coerce-params req-params coercions)

conform-actionclj

(conform-action name from spec to explain-to)

Returns a Pedestal interceptor that performs conforms data from the context.

The interceptor will take data from the key named in :from, conform it according to the specs in :spec and reattach it to the context under the key named in :to.

Returns a Pedestal interceptor that performs conforms data from the context.

The interceptor will take data from the key named in `:from`,
conform it according to the specs in `:spec` and reattach it to the
context under the key named in `:to`.
raw docstring

conform-action-exprsclj

(conform-action-exprs from spec to explain-to)

Return code for a Pedestal interceptor function that performs spec validation on the data attached at from. If the data does not conform, the explain-data will be attached at explain-to

Return code for a Pedestal interceptor function that performs
spec validation on the data attached at `from`. If the data
does not conform, the explain-data will be attached at `explain-to`
raw docstring

db-opsclj


decode-mapclj

(decode-map m)

URL Decode the values of a Map This opens up the potential for non-sanitized input to be rendered.

URL Decode the values of a Map
This opens up the potential for non-sanitized input to be rendered.
raw docstring

dynamic-interceptorclj

(dynamic-interceptor name literal exprs)

Build an interceptor/interceptor from a map of keys to expressions. The expressions will be evaluated and must evaluate to a function of 1 argument. At runtime the function will be called with a Pedestal context map.

Build an interceptor/interceptor from a map of keys to
expressions. The expressions will be evaluated and must evaluate to
a function of 1 argument. At runtime the function will be called
with a Pedestal context map.
raw docstring

eavclj


hash-set?clj

(hash-set? x)

merged-parametersclj

(merged-parameters request)

process-assertclj

(process-assert args)

process-idclj

(process-id entity-data)

process-lookup-refclj

(process-lookup-ref r)

process-retractclj

(process-retract args)

query-actionclj

(query-action name query variables coercions constants headers to)

Returns a Pedestal interceptor that executes a Datomic query on entry.

Returns a Pedestal interceptor that executes a Datomic query on
entry.
raw docstring

query-action-exprsclj

(query-action-exprs query variables coercions constants headers to)

Return code for a Pedestal interceptor function that performs a Datomic query.

query holds a query expression in any supported Datomic format. Required.

variables is a vector of the query variables (expressed as symbols) that should arrive in the Pedestal request map (as keywords). These will be supplied to the query as inputs. Values within the variables vector may also be pair-vectors, in the form [sym-key default-value], allowing for default values if the key/keyword is not found in the request map. variables may be nil.

coercions is a collection of variable names (expressed as symbols) that should be read as EDN values from the Pedestal request map. (I.e., anything that needs to be converted from String to Date, Long, etc.) May be nil.

constants is a vector of extra inputs to the query. These will be appended to the query inputs after the variables. May be nil.

headers is an expression that evaluates to a map of header name (string) to header value (string). May be nil.

Return code for a Pedestal interceptor function that performs a
Datomic query.

`query` holds a query expression in any supported Datomic
format. Required.

`variables` is a vector of the query variables (expressed as
symbols) that should arrive in the Pedestal request map (as keywords).
These will be supplied to the query as inputs. Values within the
`variables` vector may also be pair-vectors, in the form `[sym-key default-value]`,
allowing for default values if the key/keyword is not found in the request map.
`variables` may be nil.

`coercions` is a collection of variable names (expressed as symbols) that
should be read as EDN values from the Pedestal request map. (I.e.,
anything that needs to be converted from String to Date, Long, etc.)
May be nil.

`constants` is a vector of extra inputs to the query. These will be
appended to the query inputs _after_ the variables. May be nil.

`headers` is an expression that evaluates to a map of header
name (string) to header value (string). May be nil.
raw docstring

redirect-actionclj

(redirect-action name params body status headers url)

Return a Pedestal interceptor that redirects to a static URL.

Return a Pedestal interceptor that redirects to a static URL.
raw docstring

redirect-action-exprsclj

(redirect-action-exprs params body status headers url)

Return code for a Pedestal interceptor function that returns a redirect response.

Return code for a Pedestal interceptor function that returns a
redirect response.
raw docstring

respond-actionclj

(respond-action name params edn-coerce body status headers)

Return a Pedestal interceptor that responds with a canned response.

Return a Pedestal interceptor that responds with a canned
response.
raw docstring

respond-action-exprsclj

(respond-action-exprs params edn-coerce body status headers)

Return code for a Pedestal interceptor that will respond with a canned response. The same body, status, and headers arguments are returned for every HTTP request.

Return code for a Pedestal interceptor that will respond with a
canned response. The same `body`, `status`, and `headers` arguments
are returned for every HTTP request.
raw docstring

transact-actionclj

(transact-action name properties db-op headers to)

Returns a Pedestal interceptor that executes a Datomic transaction on entry.

Returns a Pedestal interceptor that executes a Datomic transaction
on entry.
raw docstring

transact-action-exprsclj

(transact-action-exprs properties db-op headers to)

Return code for a Pedestal context function that executes a transaction.

properties is a collection of keywords that name Datomic attributes. When an HTTP request arrives, these keywords are matched with their parameter values in the request to form an entity map.

db-op may be either :vase/assert-entity, :vase/retract-entity, or nil. When nil, Vase will assume the transaction body is a collection of Datomic entity maps.

headers is an expression that evaluates to a map of header name (string) to header value (string). May be nil.

Return code for a Pedestal context function that executes a
transaction.

`properties` is a collection of keywords that name Datomic
attributes. When an HTTP request arrives, these keywords are matched
with their parameter values in the request to form an entity map.

`db-op` may be either :vase/assert-entity, :vase/retract-entity, or
nil. When `nil`, Vase will assume the transaction body is a
collection of Datomic entity maps.

`headers` is an expression that evaluates to a map of header
name (string) to header value (string). May be nil.
raw docstring

tx-processorclj

(tx-processor op)

validate-actionclj

(validate-action name params headers spec)
(validate-action name params headers spec request-params-path)

Returns a Pedestal interceptor that performs validations on the parameters.

The response body will be a list of data structures as returned by clojure.spec/explain-data.

Returns a Pedestal interceptor that performs validations on the
parameters.

The response body will be a list of data structures as returned by
clojure.spec/explain-data.
raw docstring

validate-action-exprsclj

(validate-action-exprs params headers spec request-params-path)

Return code for a Pedestal interceptor function that performs clojure.spec validation on the parameters.

Return code for a Pedestal interceptor function that performs
clojure.spec validation on the parameters.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close