Home Reference Source Test Repository

Typedef

Static Public Summary
public
this typedef is experimental. Future versions may allow a more abstract model for endpoints. Interacting directly with and endpoint or its metadata may cause breaking changes.

An endpoint is a prototype method in a Handler subclass.

since 2.0.0
public
this typedef is experimental. The properties of this are likely to change.

Endpoint metadata is what Handler uses to inspect an an Endpoint to determine if it's eligible to handle a given operation. Operations are "whitelisted" so that properties (own or inherited) of the handler don't get exposed as operation endpoints where they aren't meant to.

since 2.0.0
public

The Handler can be customized to inspect different values for the operation and payload within the event.

since 2.0.0
public

Object bound as this value when an Endpoint is invoked as the last stage of the event-handling lifecycle.

since 2.0.0

Static Public

public Endpoint: Function since 2.0.0 source

this typedef is experimental. Future versions may allow a more abstract model for endpoints. Interacting directly with and endpoint or its metadata may cause breaking changes.

An endpoint is a prototype method in a Handler subclass. It's so-called because it is the end destination to which an event is dispatched. In the current version, an endpoint is simply a function with attached EndpointMetadata. In future versions, this may not be the case.

Properties:

NameTypeAttributeDescription
_λ6_metadata EndpointMetadata

attached handler metadata

Example:

 @operation
 testEndpoint() { return 'testEndpoint is an endpoint'; }

public EndpointMetadata: Object since 2.0.0 source

this typedef is experimental. The properties of this are likely to change.

Endpoint metadata is what Handler uses to inspect an an Endpoint to determine if it's eligible to handle a given operation. Operations are "whitelisted" so that properties (own or inherited) of the handler don't get exposed as operation endpoints where they aren't meant to.

public HandlerOptions: Object since 2.0.0 source

The Handler can be customized to inspect different values for the operation and payload within the event. Currently, deep gets are not supported for key values, so the data must reside as a direct child of the root JSON object (event).

Properties:

NameTypeAttributeDescription
operationKey string
  • optional

the key used to lookup the operation from the event object.

payloadKey string
  • optional

the key used to lookup the payload from the event object.

TODO:

  • Add support deep gets for operation and payload keys.

public InvocationContext: Object since 2.0.0 source

Object bound as this value when an Endpoint is invoked as the last stage of the event-handling lifecycle. There are a few reasons for binding to the new context:

  1. Provide only the invoked Endpoint with event and context without needing to make these values universally available.
  2. Allow parameters passed to the endpoint to be only those that are locally relevant, such as the payload. In the future, this may include providing additional filters or middleware.
  3. Implement a more functional approach with no shared state so that the handler has no real side effects to the context or event. This enables future event handling schemes such as fanning out the event to multiple endpoints.

Properties:

NameTypeAttributeDescription
metadata EndpointMetadata

metadata of current endpoint

operation string | number

operation key of current endpoint

event Object

the event being handled

context AWSLambdaContext
  • optional

the AWS Lambda context