Skip to content

Commit

Permalink
Merge pull request #330 from dialedai/increase-transact-write-items-l…
Browse files Browse the repository at this point in the history
…imit

Increase transact write items limit
  • Loading branch information
simonmumenthaler authored Sep 24, 2020
2 parents ac4e476 + 34cc3de commit a5e1c50
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"tsutils": "^3.17.1",
"typedoc": "0.14.0",
"typedoc-plugin-external-module-name": "^2.1.0",
"typescript": ">=2.9.1"
"typescript": ">=2.9.1 <4.0.0"
},
"peerDependencies": {
"aws-sdk": "^2.401.0",
Expand Down
8 changes: 4 additions & 4 deletions src/dynamo/transactwrite/transact-write.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DynamoDbWrapper } from '../dynamo-db-wrapper'
import { TransactOperation } from './transact-operation.type'

/**
* Request class for the TransactWriteItems operation. Write up to 10 items to one or many tables in a transaction.
* Request class for the TransactWriteItems operation. Write up to 25 items to one or many tables in a transaction.
*/
export class TransactWriteRequest {
get dynamoDB(): DynamoDB {
Expand Down Expand Up @@ -40,16 +40,16 @@ export class TransactWriteRequest {
}

/**
* add up to 10 transaction operations
* add up to 25 transaction operations
* create the operations with:
* {@link TransactConditionCheck}, {@link TransactDelete}, {@link TransactPut}, {@link TransactUpdate}
*/
transact(...writeOperations: TransactOperation[]): this {
if (!writeOperations || writeOperations.length === 0) {
throw new Error('at least one transaction operation must be added')
}
if (this.params.TransactItems.length + writeOperations.length > 10) {
throw new Error(`Each transaction can include up to 10 unique items, including conditions.\
if (this.params.TransactItems.length + writeOperations.length > 25) {
throw new Error(`Each transaction can include up to 25 unique items, including conditions.\
Given operations count: ${this.params.TransactItems.length + writeOperations.length}`)
}
this.params.TransactItems.push(...writeOperations.map((wo) => wo.transactItem))
Expand Down
6 changes: 3 additions & 3 deletions test/models/model-with-custom-mapper-for-sort-key.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export class CustomId {
}

static unparse(customId: CustomId): string {
const yyyy = customId.date.getFullYear()
const mm = (<any>(customId.date.getMonth() + 1).toString()).padStart(2, '0')
const dd = (<any>customId.date.getDate().toString()).padStart(2, '0')
const yyyy = customId.date.getUTCFullYear()
const mm = (<any>(customId.date.getUTCMonth() + 1).toString()).padStart(2, '0')
const dd = (<any>customId.date.getUTCDate().toString()).padStart(2, '0')
return `${yyyy}${mm}${dd}${(<any>customId.id.toString()).padStart(CustomId.MULTIPLIER_E, '0')}`
}

Expand Down

0 comments on commit a5e1c50

Please sign in to comment.