UNPKG

duenamodb

Version:

Simple DynamoDB client written in TypeScript.

17 lines (16 loc) 1.16 kB
import { UpdateItemCommandInput } from '@aws-sdk/client-dynamodb'; import { Keys } from './object'; import { DynamoDBTypes } from './types'; type DynamoDBOptions = Omit<UpdateItemCommandInput, 'TableName'>; export type UpdateItemOptions<T> = { updateKeys?: Keys<T>; removeKeys?: Keys<T>; dynamodbOptions?: DynamoDBOptions; }; export type UpdateItemFunction<Attributes extends DynamoDBTypes> = (item: Attributes, options: UpdateItemOptions<Attributes>) => Promise<Attributes | undefined>; export declare const createUpdateItem: <Attributes extends DynamoDBTypes>(tablename: string, partitionKeyName: keyof Attributes) => UpdateItemFunction<Attributes>; export declare const createUpdateExpression: (keys: string[]) => string | undefined; export declare const createRemoveExpression: (keys: string[]) => string | undefined; export declare const createUpdateOptions: <Attributes extends DynamoDBTypes>(partitionKeyName: keyof Attributes, updatedObject: Attributes, options: UpdateItemOptions<Attributes>) => DynamoDBOptions | undefined; export declare const updateItem: (tableName: string, input: DynamoDBOptions) => Promise<boolean>; export {};