-
Notifications
You must be signed in to change notification settings - Fork 826
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(amplify-appsync-simulato): add TransactWriteItems support to Dyn…
…amoDB operations Add TransactWriteItems support to amplify-appsync-simulator implemenst #5504
- Loading branch information
Fernando Chucre
committed
Oct 13, 2020
1 parent
763f4af
commit 520ebda
Showing
2 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
packages/amplify-appsync-simulator/src/data-loader/dynamo-db/AppSyncTransactionWriteItems.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { | ||
ConditionExpression, | ||
ExpressionAttributeNameMap, | ||
ExpressionAttributeValueMap, | ||
Key, | ||
PutItemInputAttributeMap, | ||
UpdateExpression, | ||
} from 'aws-sdk/clients/dynamodb'; | ||
|
||
export interface AppSyncPutItemTransactionWriteItems { | ||
table: string; | ||
operation: 'PutItem'; | ||
key: Key; | ||
attributeValues: PutItemInputAttributeMap; | ||
condition?: { | ||
expression: ConditionExpression; | ||
expressionNames?: ExpressionAttributeNameMap; | ||
expressionValues?: ExpressionAttributeValueMap; | ||
returnValuesOnConditionCheckFailure?: true | false; | ||
}; | ||
} | ||
|
||
export interface AppSyncUpdateItemTransactionWriteItems { | ||
table: string; | ||
operation: 'UpdateItem'; | ||
key: Key; | ||
update: { | ||
expression: string; | ||
expressionNames?: ExpressionAttributeNameMap; | ||
expressionValues?: ExpressionAttributeValueMap; | ||
}; | ||
condition?: { | ||
expression: ConditionExpression; | ||
expressionNames?: ExpressionAttributeNameMap; | ||
expressionValues?: ExpressionAttributeValueMap; | ||
returnValuesOnConditionCheckFailure?: true | false; | ||
}; | ||
} | ||
|
||
export interface AppSyncDeleteItemTransactionWriteItems { | ||
table: 'table3'; | ||
operation: 'DeleteItem'; | ||
key: Key; | ||
condition?: { | ||
expression: ConditionExpression; | ||
expressionNames?: ExpressionAttributeNameMap; | ||
expressionValues?: ExpressionAttributeValueMap; | ||
returnValuesOnConditionCheckFailure?: true | false; | ||
}; | ||
} | ||
|
||
export interface AppSyncConditionCheckTransactionWriteItems { | ||
table: 'table4'; | ||
operation: 'ConditionCheck'; | ||
key: Key; | ||
condition: { | ||
expression: ConditionExpression; | ||
expressionNames?: ExpressionAttributeNameMap; | ||
expressionValues?: ExpressionAttributeValueMap; | ||
returnValuesOnConditionCheckFailure?: true | false; | ||
}; | ||
} | ||
|
||
export type AppSyncTransactionWriteItem = | ||
| AppSyncPutItemTransactionWriteItems | ||
| AppSyncUpdateItemTransactionWriteItems | ||
| AppSyncDeleteItemTransactionWriteItems | ||
| AppSyncConditionCheckTransactionWriteItems; | ||
export type AppSyncTransactionWriteItems = AppSyncTransactionWriteItem[]; | ||
|
||
export interface AppSyncTransactionWriteItemsOperation { | ||
version: '2018-05-29'; | ||
operation: 'TransactWriteItems'; | ||
transactItems: AppSyncTransactionWriteItems; | ||
} | ||
|
||
export interface AppSyncTransactionWriteItemsCancellationReasons { | ||
item?: PutItemInputAttributeMap; | ||
type: string; | ||
message: string; | ||
} | ||
|
||
export interface AppSyncTransactionWriteItemsOperationResponse { | ||
keys: Key[] | null; | ||
cancellationReasons: AppSyncTransactionWriteItemsCancellationReasons[] | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters