eutaxy/aws
import { … } from "eutaxy/aws"; 12 functions and values, 13 types; each links to the file that declares it.
Functions, classes and values
atLeastOncePerMessage
function atLeastOncePerMessage(name: string, drive: SqsDrive, effect: EffectSelector, key: string, bodyKey: string): AtLeastOnce
Every message's bodyKey value must appear at least once as key in a selected effect. Source
atMostOncePerKey
function atMostOncePerKey(name: string, effect: EffectSelector, key: string): AtMostOncePerKey
No two selected effects share the value at key (a dot path into the effect's payload): nothing happened twice for one key, a payment recorded twice, a message sent twice. Source
createAwsPlatform
function createAwsPlatform(options: AwsPlatformOptions): Platform
The AWS Lambda platform for check: SQS delivery with redelivery up to the queue's maxReceiveCount, every AWS SDK call one effect redirected to the local client of its class, and DynamoDB tables reset and snapshotted per run. Source
defineAwsScenario
function defineAwsScenario(input: AwsScenarioInput): ScenarioSpec
Build and validate a scenario spec for the AWS platform; throws with every problem listed. Source
dynamoRows
function dynamoRows(table: string, where?: readonly RowCondition[]): StateQuery
Rows of a table in the end-of-run snapshot. Source
dynamoTable
function dynamoTable(name: string, partitionKey: KeyDef, sortKey?: KeyDef): TableSpec
A DynamoDB table the scenario uses, by name and key schema: created empty before each run and snapshotted after it. Source
dynamoWrite
function dynamoWrite(table: string, op: "PutItem" | "UpdateItem" | "DeleteItem" | "BatchWriteItem" | "TransactWriteItems" = "PutItem"): EffectSelector
Selects committed writes to a table: results whose written is at least 1. Source
resetTables
function resetTables(client: DynamoDBClient, tables: readonly TableSpec[]): Promise<void>
Drop and recreate the tables, so every run starts from the same empty state. Source
runAwsDifferential
function runAwsDifferential(spec: ScenarioSpec, options: AwsPlatformOptions): Promise<DifferentialResult>
Run a scenario through Eutaxy's proxies and again with the handler calling the raw local clients, and compare the attempts and the final tables: the check that the proxies change nothing the handler sees. Source
snapshotTables
function snapshotTables(client: DynamoDBClient, tables: readonly TableSpec[]): Promise<{ readonly [table: string]: readonly JsonValue[] }>
Every item of every table, unmarshalled and sorted canonically. Source
sqs
function sqs(queue: string, messages: readonly SqsMessage[], options: { readonly maxReceiveCount?: number } = {}): SqsDrive
Drive the Lambda with these messages from an SQS queue; maxReceiveCount defaults to 3. Source
sqsDelete
function sqsDelete(queue: string): EffectSelector
Selects the implicit deletion of each successfully handled message. Source
Types
AttemptRecord
type AttemptRecord
A type, not an interface, so it is JSON data the comparison takes as it is. Source
AwsPlatformOptions
interface AwsPlatformOptions
What createAwsPlatform needs: the handler, local SDK clients by class name, and the function's name and region. Source
AwsScenarioInput
interface AwsScenarioInput
The input to defineAwsScenario: the handler, the SQS drive, the tables, the externals, the invariants and the bounds. Source
DifferentialResult
interface DifferentialResult
What runAwsDifferential found: whether the proxied run and the raw run agree, each side's attempts and tables, the differences when they do not, and any reason the proxied side was UNSUPPORTED. Source
KeyDef
type KeyDef
A type alias, not an interface, so it satisfies PlatformData's JSON index signature. Source
LambdaContext
interface LambdaContext
The context object Lambda passes beside the event: the request id, the function's identity and its remaining time. Source
SqsBatchResponse
interface SqsBatchResponse
What a handler may return to report partial batch failures: the message ids in batchItemFailures stay on the queue and are redelivered, the others are deleted. Source
SqsDrive
interface SqsDrive
Drive the Lambda with these SQS messages, one record per invocation. Source
SqsEvent
interface SqsEvent
The event an SQS-triggered Lambda receives: its records, one per message in the batch. Source
SqsHandler
type SqsHandler
An SQS-triggered Lambda handler: async or not, returning nothing or a partial batch response. Source
SqsMessage
interface SqsMessage
One message to deliver: its body, and an id (default msg-<n>, by position). Source
SqsRecord
interface SqsRecord
One SQS message as Lambda's event source hands it to the function, with the attributes AWS sets. Source
TableSpec
interface TableSpec
A table to create before each run. Source