@env0/dynamo-easy
Version:
DynamoDB client for NodeJS and browser with a fluent api to build requests. We take care of the type mapping between JS and DynamoDB, customizable trough typescript decorators.
24 lines • 776 B
JavaScript
import { toDb } from '../../mapper/mapper';
import { createIfNotExistsCondition } from '../expression/create-if-not-exists-condition.function';
import { TransactBaseOperation } from './transact-base-operation';
/**
* TransactOperation class for transactional put items.
*/
export class TransactPut extends TransactBaseOperation {
constructor(modelClazz, item) {
super(modelClazz);
this.params.Item = toDb(item, this.modelClazz);
}
ifNotExists(predicate = true) {
if (predicate) {
this.onlyIf(...createIfNotExistsCondition(this.metadata));
}
return this;
}
get transactItem() {
return {
Put: Object.assign({}, this.params),
};
}
}
//# sourceMappingURL=transact-put.js.map