UNPKG

duenamodb

Version:

Simple, strongly-typed helpers around the AWS SDK DynamoDB client.

17 lines (16 loc) 957 B
import { type DeleteItemCommandInput } from "@aws-sdk/client-dynamodb"; import type { DynamoDBTypes, PK, SK } from "./types"; type DeleteItemOptions = Omit<DeleteItemCommandInput, "TableName" | "Key">; export type DeleteItemFunction<TPK extends PK, TSK extends SK> = (options: { pk: TPK; sk?: TSK; dynamodbOptions?: DeleteItemOptions; }) => Promise<boolean>; type CreateDeleteItemOptions<Attributes extends DynamoDBTypes> = { tablename: string; pkName: keyof Attributes; skName?: keyof Attributes; }; export declare const createDeleteItem: <Attributes extends DynamoDBTypes, TPKN extends keyof Attributes = keyof Attributes, TSKN extends keyof Attributes = keyof Attributes>(options: CreateDeleteItemOptions<Attributes>) => DeleteItemFunction<Attributes[TPKN], Attributes[TSKN]>; export declare const deleteItem: <_T>(tablename: string, key: DeleteItemCommandInput["Key"], options: DeleteItemOptions) => Promise<boolean>; export {};