cloud-adapter-aws API
Everything the package exports, by the path you import it from. Open an export for its signature and options.
@evolve-framework/cloud-adapter-aws
Messaging: SqsPublisher, EventBridgePublisher, createSQSHandler, createEventBridgeSQSHandler and deserializeMessage. HTTP: createHttpLambdaHandler. Lambda: lambdaHandlerFactory and withSentryHandler. Storage: AwsS3StorageClient. Configuration: awsParameterStoreSource
Classes
AwsS3StorageClientStores files in S3, as core's StorageClient, and signs URLs to one object with the client's own credentials.
import { AwsS3StorageClient } from "@evolve-framework/cloud-adapter-aws";new AwsS3StorageClient(s3Client?: S3Client)| Method | Description |
|---|---|
save(
bucket: string,
key: string,
data: string,
options?: SaveOptions,
): Promise<void> | Writes data as the object key in bucket, replacing what was stored there, with options.ContentType as its content type. |
signUpload(
bucket: string,
key: string,
options: SignedUploadOptions,
): Promise<string> | The Content-Type is part of the signature, so the PUT has to send it. |
signRead(
bucket: string,
key: string,
options: SignedUrlOptions,
): Promise<string> | A URL a client GETs the object from until it expires. |
stat(bucket: string, key: string): Promise<StoredObject | undefined> | The object, or undefined when nothing was stored under the key. |
EventBridgePublisherPublishes internal events to one EventBridge bus, with the publish options' origin as the event's source and type as its detail type, so a rule can route on either.
import { EventBridgePublisher } from "@evolve-framework/cloud-adapter-aws";new EventBridgePublisher(eventBusArn: string)| Method | Description |
|---|---|
publish(
data: Message,
options?: PublishMessageOptions,
): Promise<void> | Hand a message to the provider. |
SqsPublisherPublishes internal events to one SQS queue.
import { SqsPublisher } from "@evolve-framework/cloud-adapter-aws";new SqsPublisher(queueUrl: string)| Method | Description |
|---|---|
publish(
data: Message,
options?: PublishMessageOptions,
): Promise<void> | Hand a message to the provider. |
Functions
awsParameterStoreSourceReads AWS Systems Manager Parameter Store.
import { awsParameterStoreSource } from "@evolve-framework/cloud-adapter-aws";WithDecryption covers SecureString parameters, and Parameter Store
resolves its own /aws/reference/secretsmanager/ paths server-side, so a
secret needs no second client and no second hop here.
function awsParameterStoreSource( options: AwsParameterStoreSourceOptions,): ConfigSource| Option | Type | Description |
|---|---|---|
path | string | The parameter path this source reads, for example |
client | SSMClient | The SSM client. Injected rather than constructed here so that a caller chooses the region, credentials and retry policy once for the whole service, and so that a test can hand over a stub. |
prefix? | string | Tried within the path before the bare name. |
prefixFallback? | boolean | |
keys? | KeyTransformer | |
lookup? | "index" | "direct" | |
recursive? | boolean | Reads nested paths too, so |
Returns ConfigSource
createEventBridgeSQSHandlerA Lambda handler for an SQS queue EventBridge delivers to.
import { createEventBridgeSQSHandler } from "@evolve-framework/cloud-adapter-aws";function createEventBridgeSQSHandler<T>( handler: MessageHandler<T>,): ({ Records }: SQSEvent) => Promise<SQSBatchResponse>Returns ({ Records }: SQSEvent) => Promise<SQSBatchResponse>
createHttpLambdaHandler
import { createHttpLambdaHandler } from "@evolve-framework/cloud-adapter-aws";function createHttpLambdaHandler( app: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProviderDefault>, options?: HttpLambdaHandlerOptions,): Handler| Option | Type | Description |
|---|---|---|
binaryMimeTypes? | string[] | Content types whose responses are returned base64-encoded. Responses that carry a Content-Encoding are already recognised as binary, so this is only needed for uncompressed binary bodies such as images or archives. |
albMultiValueHeaders? | boolean | Set when the load balancer target group has multi value headers enabled. That setting changes the response shape the load balancer expects, and it is not visible in the invocation event, so it has to be declared here. |
Returns Handler
createSQSHandlerA Lambda handler for an SQS batch: each record's body is parsed as JSON, passed through deserializer when given, and handed to handler in order.
import { createSQSHandler } from "@evolve-framework/cloud-adapter-aws";function createSQSHandler<T>( handler: MessageHandler<T>, deserializer?: ((message: unknown) => T),): (event: SQSEvent) => Promise<void>Returns (event: SQSEvent) => Promise<void>
deserializeMessageDeserializes an SQS message into a Message object.
import { deserializeMessage } from "@evolve-framework/cloud-adapter-aws";function deserializeMessage(message: SQSRecord): MessageReturns Message
lambdaHandlerFactoryCreate an AWS Lambda handler that wraps the given handler with OpenTelemetry, Sentry and starts a new span.
import { lambdaHandlerFactory } from "@evolve-framework/cloud-adapter-aws";function lambdaHandlerFactory(name: string, initFn: () => Handler): HandlerReturns Handler
withSentryHandlerConfigures Sentry, then builds the handler.
import { withSentryHandler } from "@evolve-framework/cloud-adapter-aws";function withSentryHandler(initFn: () => Handler): HandlerReturns Handler
Not listed: 2 options types. They appear as the tables under the constructors and functions they type.

