import { aws_dynamodb } from "aws-cdk-lib"; import { FormatObject, JsonFormat } from "typesafe-dynamodb/lib/json-format"; import { TableKey } from "typesafe-dynamodb/lib/key"; import { DynamoDBAppsyncExpression } from "./appsync"; import { ITable } from "./table"; import { AttributeKeyToObject } from "./util"; export interface TransactWriteItemsInput, Format extends JsonFormat = JsonFormat.Document> extends Omit { TransactItems: TransactWriteItem[]; } export interface TransactWriteItem, Format extends JsonFormat> { ConditionCheck?: ConditionCheck; Delete?: Delete; Put?: Put; Update?: Update; } export declare type ConditionCheck, Format extends JsonFormat = JsonFormat.Document> = Omit & { Key: Key; }; export declare type Delete, Format extends JsonFormat = JsonFormat.Document> = Omit & { Key: Key; }; /** * Initiates a `PutItem` operation to write a new item. This structure * specifies the primary key of the item to be written, an optional condition expression * that must be satisfied for the write to succeed, a list of the item's attributes, and * a field indicating whether to retrieve the item's attributes if the condition is not met. */ export declare type Put = Omit & { Item: FormatObject; }; export declare type Update, Format extends JsonFormat = JsonFormat.Document> = Omit & { Key: Key; }; export interface TransactWriteItemsOutput extends AWS.DynamoDB.TransactWriteItemsOutput { } export declare type TransactWriteItems = >(request: TransactWriteItemsInput) => Promise; export declare function createTransactWriteItemsIntegration(table: aws_dynamodb.ITable, format: Format): TransactWriteItems; export declare type TransactWriteItemAppsync> = TransactPutItemAppsync | TransactUpdateItemAppsync | TransactDeleteItemAppsync | TransactConditionCheckAppsync; export interface TransactPutItemAppsync> { operation: "PutItem"; key: Key; attributeValues: FormatObject>, JsonFormat.AttributeValue>; condition?: DynamoDBAppsyncExpression; } export interface TransactUpdateItemAppsync> { operation: "UpdateItem"; key: Key; update: DynamoDBAppsyncExpression; condition?: DynamoDBAppsyncExpression; } export interface TransactDeleteItemAppsync> { operation: "DeleteItem"; key: Key; condition?: DynamoDBAppsyncExpression; } export interface TransactConditionCheckAppsync> { operation: "ConditionCheck"; key: Key; condition?: DynamoDBAppsyncExpression; } /** * @see https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html#aws-appsync-resolver-mapping-template-reference-dynamodb-getitem */ export declare type TransactWriteItemsAppsync = >(transactItems: TransactWriteItemAppsync[]) => Promise<{ keys: AttributeKeyToObject[] | null; cancellationReasons: { type: string; message: string; }[] | null; }>; export declare function createTransactWriteItemsAppsyncIntegration(table: ITable): TransactWriteItemsAppsync; //# sourceMappingURL=transact-write-item.d.ts.map