Skip to content

Commit

Permalink
feat(update): add native document client options support ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioArnt committed Sep 26, 2019
1 parent 08544fb commit 6d7c36f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/base-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,21 @@ export default abstract class Model<T> {
public async update(
pk: Key,
actions: IUpdateActions,
options?: Partial<DocumentClient.UpdateItemInput>,
): Promise<PromiseResult<DocumentClient.UpdateItemOutput, AWSError>>;

public async update(
pk: Key,
sk: Key,
actions: IUpdateActions,
options?: Partial<DocumentClient.UpdateItemInput>,
): Promise<PromiseResult<DocumentClient.UpdateItemOutput, AWSError>>;

public async update(
pk: Key,
sk_actions: Key | IUpdateActions,
actions?: IUpdateActions,
options?: Partial<DocumentClient.UpdateItemInput>,
): Promise<PromiseResult<DocumentClient.UpdateItemOutput, AWSError>> {
// Handle overloading
const sk: Key = isKey(sk_actions) ? sk_actions : null;
Expand All @@ -422,7 +425,9 @@ export default abstract class Model<T> {
Key: this.buildKeys(pk, sk),
AttributeUpdates: buildUpdateActions(updateActions),
};

if (options) {
Object.assign(params, options);
}
return this.documentClient.update(params).promise();
}

Expand Down

0 comments on commit 6d7c36f

Please sign in to comment.