Liking cljdoc? Tell your friends :D

com.walmartlabs.lacinia.pedestal

Defines Pedestal interceptors and supporting code.

Many functions here were deprecated in 0.14.0, with replacements in the com.walmartlabs.lacinia.pedestal2 namespace.

Defines Pedestal interceptors and supporting code.

Many functions here were deprecated in 0.14.0, with replacements in the
[[com.walmartlabs.lacinia.pedestal2]] namespace.
raw docstring

async-query-executor-handlercljdeprecated

Async variant of query-executor-handler which returns a channel that conveys the updated context.

Deprecated: Use pedestal2/async-query-executor-handler instead.

Async variant of [[query-executor-handler]] which returns a channel that conveys the
updated context.

Deprecated: Use [[pedestal2/async-query-executor-handler]] instead.
raw docstring

body-data-interceptorcljdeprecated

Converts the POSTed body from a input stream into a string.

Deprecated: Use pedestal2/body-data-interceptor instead.

Converts the POSTed body from a input stream into a string.

Deprecated: Use [[pedestal2/body-data-interceptor]] instead.
raw docstring

default-interceptorscljdeprecated

(default-interceptors compiled-schema options)

Returns the default set of GraphQL interceptors, as a seq:

compiled-schema may be the actual compiled schema, or a no-arguments function that returns the compiled schema.

Often, this list of interceptors is augmented by calls to inject.

Options are as defined by service-map.

Deprecated: Use pedestal2/default-interceptors instead.

Returns the default set of GraphQL interceptors, as a seq:

  * ::json-response [[json-response-interceptor]]
  * ::error-response [[error-response-interceptor]]
  * ::graphql-data [[graphql-data-interceptor]]
  * ::status-conversion [[status-conversion-interceptor]]
  * ::missing-query [[missing-query-interceptor]]
  * ::query-parser [[query-parser-interceptor]]
  * ::disallow-subscriptions [[disallow-subscriptions-interceptor]]
  * ::prepare-query [[prepare-query-interceptor]]
  * ::inject-app-context [[inject-app-context-interceptor]]
  * ::query-executor [[query-executor-handler]] or [[async-query-executor-handler]]

`compiled-schema` may be the actual compiled schema, or a no-arguments function that returns the compiled schema.

Often, this list of interceptors is augmented by calls to [[inject]].

Options are as defined by [[service-map]].

Deprecated: Use [[pedestal2/default-interceptors]] instead.
raw docstring

disallow-subscriptions-interceptorcljdeprecated

Handles requests for subscriptions. Subscription requests must only be sent to the subscriptions web-socket, not the general query endpoint, so any subscription request received in this pipeline is a bad request.

Deprecated: Use pedestal2/disallow-subscriptions-interceptor instead.

Handles requests for subscriptions.  Subscription requests must only be sent to the subscriptions web-socket, not the
general query endpoint, so any subscription request received in this pipeline is a bad request.

Deprecated: Use [[pedestal2/disallow-subscriptions-interceptor]] instead.
raw docstring

error-response-interceptorcljdeprecated

Returns an internal server error response when an exception was not handled in prior interceptors.

This must come after json-response-interceptor, as the error still needs to be converted to json.

Deprecated: Use pedestal2/error-response-interceptor instead.

Returns an internal server error response when an exception was not handled in prior interceptors.

This must come after [[json-response-interceptor]], as the error still needs to be converted to json.

Deprecated: Use [[pedestal2/error-response-interceptor]] instead.
raw docstring

extract-querycljmultimethod

Based on the content type of the query, adds up to three keys to the request:

:graphql-query : The query itself, as a string (parsing the query happens later).

:graphql-vars : A map of variables used when executing the query.

:graphql-operation-name : The specific operation requested (for queries that define multiple named operations).

Based on the content type of the query, adds up to three keys to the request:

:graphql-query
: The query itself, as a string (parsing the query happens later).

:graphql-vars
: A map of variables used when executing the query.

:graphql-operation-name
: The specific operation requested (for queries that define multiple named operations).
raw docstring

graphiql-ide-responsecljdeprecated

(graphiql-ide-response options)

Reads the graphiql.html resource, then injects new content into it, and ultimately returns a Ring response map.

This function is used when creating customized Pedestal routers that expose the GraphiQL IDE.

Options are as specified in graphql-routes.

Reads the template file, makes necessary substitutions, and returns a Ring response.

Deprecated: Use pedestal2/graphiql-ide-handler instead.

Reads the graphiql.html resource, then injects new content into it, and ultimately returns a Ring
response map.

This function is used when creating customized Pedestal routers that expose the GraphiQL IDE.

Options are as specified in [[graphql-routes]].

Reads the template file, makes necessary substitutions, and returns a Ring response.

Deprecated: Use [[pedestal2/graphiql-ide-handler]] instead.
raw docstring

graphql-data-interceptorcljdeprecated

Extracts the raw data (query and variables) from the request using extract-query.

Deprecated: Use pedestal2/graphql-data-interceptor instead.

Extracts the raw data (query and variables) from the request using [[extract-query]].

Deprecated: Use [[pedestal2/graphql-data-interceptor]] instead.
raw docstring

graphql-routescljdeprecated

(graphql-routes compiled-schema options)

Creates default routes for handling GET and POST requests and (optionally) the GraphiQL IDE.

The paths for the routes are determined by the options.

Returns a set of route vectors, compatible with io.pedestal.http.route.definition.table/table-routes.

Uses default-interceptors to define the base seq of interceptors. For the POST route, body-data-interceptor is prepended. May add an additional route to handle named queries.

The options for this function are described by service-map.

Asset paths use wildcard matching; you should be careful to ensure that the asset path does not overlap the paths for query request handling, the IDE, or subscriptions (or the asset handler will override the others and deliver 404 responses).

Deprecated: Use the com.walmartlabs.lacinia.pedestal2 namespace instead.

Creates default routes for handling GET and POST requests and
(optionally) the GraphiQL IDE.

The paths for the routes are determined by the options.

Returns a set of route vectors, compatible with
`io.pedestal.http.route.definition.table/table-routes`.

Uses [[default-interceptors]] to define the base seq of interceptors.
For the POST route, [[body-data-interceptor]] is prepended.
May add an additional route to handle named queries.

The options for this function are described by [[service-map]].

Asset paths use wildcard matching; you should be careful to ensure that the asset path does not
overlap the paths for query request handling, the IDE, or subscriptions (or the asset handler will override the others
and deliver 404 responses).

Deprecated: Use the [[com.walmartlabs.lacinia.pedestal2]] namespace instead.
raw docstring

injectclj

(inject interceptors new-interceptor relative-position interceptor-name)

Locates the named interceptor in the list of interceptors and adds (or replaces) the new interceptor to the list.

relative-position may be :before, :after, or :replace.

For :replace, the new interceptor may be nil, in which case the interceptor is removed.

The named interceptor must exist, or an exception is thrown.

Locates the named interceptor in the list of interceptors and adds (or replaces)
the new interceptor to the list.

relative-position may be :before, :after, or :replace.

For :replace, the new interceptor may be nil, in which case the interceptor is removed.

The named interceptor must exist, or an exception is thrown.
raw docstring

json-response-interceptorcljdeprecated

An interceptor that sees if the response body is a map and, if so, converts the map to JSON and sets the response Content-Type header.

Deprecated: Use pedestal2/json-response-interceptor instead.

An interceptor that sees if the response body is a map and, if so,
converts the map to JSON and sets the response Content-Type header.

Deprecated: Use [[pedestal2/json-response-interceptor]] instead.
raw docstring

missing-query-interceptorcljdeprecated

Rejects the request when there's no GraphQL query in the request map.

This must come after graphql-data-interceptor, which is responsible for adding the query to the request map.

Deprecated: Use pedestal2/missing-query-interceptor instead.

Rejects the request when there's no GraphQL query in the request map.

This must come after [[graphql-data-interceptor]], which is responsible for adding the query to the request map.

Deprecated: Use [[pedestal2/missing-query-interceptor]] instead.
raw docstring

prepare-query-interceptorcljdeprecated

Prepares (with query variables) and validates the query, previously parsed by query-parser-interceptor.

In earlier releases of lacinia-pedestal, this logic was combined with query-parser-interceptor.

Deprecated: Use pedestal2/prepare-query-interceptor instead.

Prepares (with query variables) and validates the query, previously parsed
by [[query-parser-interceptor]].

In earlier releases of lacinia-pedestal, this logic was combined with [[query-parser-interceptor]].

Deprecated: Use [[pedestal2/prepare-query-interceptor]] instead.
raw docstring

query-executor-handlercljdeprecated

The handler at the end of interceptor chain, invokes Lacinia to execute the query and return the main response.

This comes after query-parser-interceptor, [[inject-app-context-interceptor]], and status-conversion-interceptor in the interceptor chain.

Deprecated: Use pedestal2/query-executor-handler instead.

The handler at the end of interceptor chain, invokes Lacinia to
execute the query and return the main response.

This comes after [[query-parser-interceptor]], [[inject-app-context-interceptor]],
and [[status-conversion-interceptor]] in the interceptor chain.

Deprecated: Use [[pedestal2/query-executor-handler]] instead.
raw docstring

query-parser-interceptorcljdeprecated

(query-parser-interceptor compiled-schema)

Given a compiled schema, returns an interceptor that parses the query.

compiled-schema may be the actual compiled schema, or a no-arguments function that returns the compiled schema.

Expected to come after missing-query-interceptor in the interceptor chain.

Adds a new request key, :parsed-lacinia-query, containing the parsed query.

Before execution, prepare-query-interceptor injects query variables and performs validations.

Deprecated: Use pedestal2/query-parser-interceptor instead.

Given a compiled schema, returns an interceptor that parses the query.

`compiled-schema` may be the actual compiled schema, or a no-arguments function
that returns the compiled schema.

Expected to come after [[missing-query-interceptor]] in the interceptor chain.

Adds a new request key, :parsed-lacinia-query, containing the parsed query.

Before execution, [[prepare-query-interceptor]] injects query variables and performs
validations.

Deprecated: Use [[pedestal2/query-parser-interceptor]] instead.
raw docstring

routes-from-interceptorscljdeprecated

(routes-from-interceptors _compiled-schema interceptors options)

Returns a set of route vectors from a primary seq of interceptors. This returns a set, one element for GET (using the seq as is), one for POST (prefixing with body-data-interceptor).

Options:

:get-enabled (default true) : If true, then a route for the GET method is included.

Deprecated with no replacement (build the route yourself).

Returns a set of route vectors from a primary seq of interceptors.
This returns a set, one element for GET (using the seq as is),
one for POST (prefixing with [[body-data-interceptor]]).

Options:

:get-enabled (default true)
: If true, then a route for the GET method is included.

Deprecated with no replacement (build the route yourself).
raw docstring

service-mapcljdeprecated

(service-map compiled-schema options)

Creates and returns a Pedestal service map. This uses a server type of :jetty.

The returned service map can be passed to the io.pedestal.http/create-server function.

The deprecated function [[pedestal-service]] invokes create-server before returning. However, in many cases, further extensions to the service map are needed before creating and starting the server.

compiled-schema may be the actual compiled schema, or a no-arguments function that returns the compiled schema.

Options:

:graphiql (default: false) : If given, then enables resources to support the GraphiQL IDE. This includes disabling the Content-Security-Policy headers that Pedestal 0.5.3 generates by default.

:routes (default: via graphql-routes) : Used when explicitly setting up the routes. It is significantly easier to configure the interceptors than to set up the routes explicitly, this option exists primarily for backwards compatibility.

:subscriptions (default: false) : If enabled, then support for WebSocket-based subscriptions is added. : See [[listener-fn-factory]] for further options related to subscriptions.

:path (default: "/graphql") : Path at which GraphQL requests are serviced (distinct from the GraphQL IDE).

:ide-path (default: "/") : Path from which the GraphiQL IDE, if enabled, can be loaded.

:asset-path (default: "/assets/graphiql") : Path from which the JavaScript and CSS assets may be loaded.

:ide-headers : A map from header name to header value. Keys and values may be strings, keywords, or symbols and are converted to strings using clojure.core/name. These define additional headers to be included in the requests from the IDE. Typically, the headers are used to identify and authenticate the requests.

:ide-connection-params : A value that is used with the GraphiQL IDE; this value is converted to JSON, and becomes the connectionParams passed in the initial subscription web service call; this can be used to identify and authenticate subscription requests.

:interceptors : A seq of interceptors to be used in GraphQL routes; passed to routes-from-interceptors. If not provided, default-interceptors is invoked.

:get-enabled (default true) : If true, then a route for the GET method is included. GET requests include the query as the query query parameter, and can't specify variables or an operation name.

:async (default: false) : If true, the query will execute asynchronously; the handler will return a clojure.core.async channel rather than blocking.

:host (default: localhost) : HOST address bind to pedestal/jetty.

:app-context : The base application context provided to Lacinia when executing a query.

:subscriptions-path (default: "/graphql-ws") : If subscriptions are enabled, the path at which to service GraphQL websocket requests. This must be a distinct path (not the same as the main path or the GraphiQL IDE path).

:port (default: 8888) : HTTP port to use.

:env (default: :dev) : Environment being started.

See further notes in graphql-routes and default-interceptors.

Deprecated: Use [[default-service]] initially, then roll your own. Seriously.

Creates and returns a Pedestal service map.
This uses a server type of :jetty.

The returned service map can be passed to the `io.pedestal.http/create-server` function.

The deprecated function [[pedestal-service]] invokes `create-server` before returning.
However, in many cases, further extensions to the service map are needed before
creating and starting the server.

`compiled-schema` may be the actual compiled schema, or a no-arguments function
that returns the compiled schema.

Options:

:graphiql (default: false)
: If given, then enables resources to support the GraphiQL IDE.
  This includes disabling the Content-Security-Policy headers
  that Pedestal 0.5.3 generates by default.

:routes (default: via [[graphql-routes]])
: Used when explicitly setting up the routes.
  It is significantly easier to configure the interceptors than to set up
  the routes explicitly, this option exists primarily for backwards compatibility.

:subscriptions (default: false)
: If enabled, then support for WebSocket-based subscriptions is added.
: See [[listener-fn-factory]] for further options related to subscriptions.

:path (default: "/graphql")
: Path at which GraphQL requests are serviced (distinct from the GraphQL IDE).

:ide-path (default: "/")
: Path from which the GraphiQL IDE, if enabled, can be loaded.

:asset-path (default: "/assets/graphiql")
: Path from which the JavaScript and CSS assets may be loaded.

:ide-headers
: A map from header name to header value. Keys and values may be strings, keywords,
  or symbols and are converted to strings using clojure.core/name.
  These define additional headers to be included in the requests from the IDE.
  Typically, the headers are used to identify and authenticate the requests.

:ide-connection-params
: A value that is used with the GraphiQL IDE; this value is converted to JSON,
  and becomes the connectionParams passed in the initial subscription web service call;
  this can be used to identify and authenticate subscription requests.

:interceptors
: A seq of interceptors to be used in GraphQL routes; passed to [[routes-from-interceptors]].
  If not provided, [[default-interceptors]] is invoked.

:get-enabled (default true)
: If true, then a route for the GET method is included. GET requests include the query
  as the `query` query parameter, and can't specify variables or an operation name.

:async (default: false)
: If true, the query will execute asynchronously; the handler will return a clojure.core.async
  channel rather than blocking.

:host (default: localhost)
: HOST address bind to pedestal/jetty.

:app-context
: The base application context provided to Lacinia when executing a query.

:subscriptions-path (default: "/graphql-ws")
: If subscriptions are enabled, the path at which to service GraphQL websocket requests.
  This must be a distinct path (not the same as the main path or the GraphiQL IDE path).

:port (default: 8888)
: HTTP port to use.

:env (default: :dev)
: Environment being started.

See further notes in [[graphql-routes]] and [[default-interceptors]].

Deprecated: Use [[default-service]] initially, then roll your own. Seriously.
raw docstring

status-conversion-interceptorcljdeprecated

Checks to see if any error map in the :errors key of the response contains a :status value (under it's :extensions key). If so, the maximum status value of such errors is found and used as the status of the overall response, and the :status key is dissoc'ed from all errors.

Deprecated: use pedestal2/status-conversion-interceptor.

Checks to see if any error map in the :errors key of the response
contains a :status value (under it's :extensions key).
If so, the maximum status value of such errors is found and used as the status of the overall response, and the
:status key is dissoc'ed from all errors.

Deprecated: use [[pedestal2/status-conversion-interceptor]].
raw docstring

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

× close