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)
source

apply-tx-cloudclj

(apply-tx-cloud conn tx-data args)
source

AttachActionclj

source

bindclj

(bind param-syms)
source

CloudQueryActionclj

source

CloudTransactActionclj

source

coerce-arg-valclj

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

coerce-paramsclj

(coerce-params req-params coercions)
source

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`
sourceraw docstring

ConformActionclj

source

DatomicCodeGencljprotocol

query-exprclj

(query-expr this)

Return the correct code for issuing a query to this backend.

Return the correct code for issuing a query to this backend.

transact-exprclj

(transact-expr this)

Return the correct code for running a transaction on this backend.

Return the correct code for running a transaction on this backend.
source

db-opsclj

source

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.
sourceraw docstring

dynamic-interceptorclj

(dynamic-interceptor name exprs)
(dynamic-interceptor name _ 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.
sourceraw docstring

eavclj

source

hash-set?clj

(hash-set? x)
source

InterceptActionclj

source

merged-parametersclj

(merged-parameters request)
source

peer-code-genclj

(peer-code-gen)
source

process-assertclj

(process-assert args)
source

process-idclj

(process-id entity-data)
source

process-lookup-refclj

(process-lookup-ref r)
source

process-retractclj

(process-retract args)
source

query-action-exprsclj

(query-action-exprs code-gen 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.
sourceraw docstring

QueryActionclj

source

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.
sourceraw docstring

RedirectActionclj

source

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.
sourceraw docstring

RespondActionclj

source

transact-action-exprsclj

(transact-action-exprs code-gen 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.
sourceraw docstring

TransactActionclj

source

tx-processorclj

(tx-processor op)
source

validate-action-exprsclj

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

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

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

ValidateActionclj

source

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

× close