Liking cljdoc? Tell your friends :D

cljs-lambda.context

Representation & manipulation of Lambda-handler execution context.

Contexts are represented as records with keys:

  • :aws-request-id
  • :client-context
  • :log-group-name
  • :log-stream-name
  • :function-name
  • :function-arn
  • :identity (optional)
  • :handler-callback (optional)
Representation & manipulation of Lambda-handler execution context.

  Contexts are represented as records with keys:

* `:aws-request-id`
* `:client-context`
* `:log-group-name`
* `:log-stream-name`
* `:function-name`
* `:function-arn`
* `:identity` (optional)
* `:handler-callback` (optional)
raw docstring

ContextHandlecljsprotocol

waits?cljs

(waits? this)

By default, the callback will wait until the Node.js runtime event loop is empty before freezing the process and returning the results to the caller. You can set this property to false to request AWS Lambda to freeze the process soon after the callback is called, even if there are events in the event loop.

By default, the callback will wait until the Node.js runtime event loop is
empty before freezing the process and returning the results to the caller.
You can set this property to false to request AWS Lambda to freeze the
process soon after the callback is called, even if there are events in the
event loop.

msecs-remainingcljs

(msecs-remaining this)

The number of milliseconds remaining until the timeout of the invocation associated with this context.

The number of milliseconds remaining until the timeout of the invocation
associated with this context.

set-wait!cljs

(set-wait! this tf)

Set the callback-waits

Set the callback-waits

-done!cljs

(-done! this err result)

See done!

See [[done!]]

environmentcljs

(environment this)

Retrieve a map of environment variables.

Retrieve a map of environment variables.
source

done!cljs

(done! ctx & [err result])

Terminate execution of the handler associated w/ the given context, conveying the given error (if non-nil), or the given success result (if non-nil). No arguments communicates generic success.

(deflambda quick [_ ctx]
  (ctx/done! ctx))
Terminate execution of the handler associated w/ the given context, conveying
  the given error (if non-nil), or the given success result (if non-nil).  No
  arguments communicates generic success.

```clojure
(deflambda quick [_ ctx]
  (ctx/done! ctx))
```
sourceraw docstring

envcljs

(env ctx k)

Retrieve an environment variable by name, defaulting to nil if not found.

(env ctx "USER")
(env ctx :USER)
(env ctx 'USER)
Retrieve an environment variable by name, defaulting to `nil` if not found.

```clojure
(env ctx "USER")
(env ctx :USER)
(env ctx 'USER)
```
sourceraw docstring

fail!cljs

(fail! ctx & [err])

Trivial wrapper around done!

Terminate execution of the handler associated w/ the given context, conveying the given error, if non-nil - otherwise mark the execution as failed w/ no specific error.

(deflambda purchase [item-name ctx]
  (ctx/fail! ctx (js/Error. (str "Sorry, no more " item-name))))
Trivial wrapper around [[done!]]

  Terminate execution of the handler associated w/ the given context, conveying
  the given error, if non-nil - otherwise mark the execution as failed w/ no
  specific error.

```clojure
(deflambda purchase [item-name ctx]
  (ctx/fail! ctx (js/Error. (str "Sorry, no more " item-name))))
```
sourceraw docstring

set-wait-on-event-loop!cljs

(set-wait-on-event-loop! ctx tf)

Set the context property callbackWaitsForEmptyEventLoop

Set the context property callbackWaitsForEmptyEventLoop
sourceraw docstring

succeed!cljs

(succeed! ctx & [result])

Trivial wrapper around done!

Terminate execution of the handler associated w/ the given context, conveying the given JSON-serializable success value, if non-nil - otherwise mark the execution as successful w/ no specific result.

(deflambda purchase [item-name ctx]
  (ctx/succeed! ctx "You bought something"))
Trivial wrapper around [[done!]]

  Terminate execution of the handler associated w/ the given context, conveying
  the given JSON-serializable success value, if non-nil - otherwise mark the
  execution as successful w/ no specific result.

```clojure
(deflambda purchase [item-name ctx]
  (ctx/succeed! ctx "You bought something"))
```
sourceraw docstring

waits-on-event-loop?cljs

(waits-on-event-loop? ctx)
source

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

× close