UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

28 lines (27 loc) 2.12 kB
import type { DeleteCommandInput, DeleteCommandOutput } from '@aws-sdk/lib-dynamodb'; import { $sentArgs } from '../../../entity/constants.js'; import type { Entity, EntitySendableAction } from '../../../entity/entity.js'; import type { FormattedItem } from '../../../entity/index.js'; import type { KeyInputItem } from '../../../entity/index.js'; import { EntityAction } from '../../../entity/index.js'; import type { AllOldReturnValuesOption, NoneReturnValuesOption } from '../../../options/returnValues.js'; import type { DocumentClientOptions } from '../../../types/documentClientOptions.js'; import type { Merge } from '../../../types/merge.js'; import { $key, $options } from './constants.js'; import type { DeleteItemOptions } from './options.js'; type ReturnedAttributes<ENTITY extends Entity, OPTIONS extends DeleteItemOptions<ENTITY>> = OPTIONS['returnValues'] extends NoneReturnValuesOption ? undefined : OPTIONS['returnValues'] extends AllOldReturnValuesOption ? FormattedItem<ENTITY> | undefined : never; export type DeleteItemResponse<ENTITY extends Entity, OPTIONS extends DeleteItemOptions<ENTITY> = DeleteItemOptions<ENTITY>> = Merge<Omit<DeleteCommandOutput, 'Attributes'>, { Attributes?: ReturnedAttributes<ENTITY, OPTIONS> | undefined; }>; export declare class DeleteItemCommand<ENTITY extends Entity = Entity, OPTIONS extends DeleteItemOptions<ENTITY> = DeleteItemOptions<ENTITY>> extends EntityAction<ENTITY> implements EntitySendableAction<ENTITY> { static actionName: "delete"; [$key]?: KeyInputItem<ENTITY>; [$options]: OPTIONS; constructor(entity: ENTITY, key?: KeyInputItem<ENTITY>, options?: OPTIONS); key(nextKey: KeyInputItem<ENTITY>): DeleteItemCommand<ENTITY, OPTIONS>; options<NEXT_OPTIONS extends DeleteItemOptions<ENTITY>>(nextOptions: NEXT_OPTIONS | ((prevOptions: OPTIONS) => NEXT_OPTIONS)): DeleteItemCommand<ENTITY, NEXT_OPTIONS>; [$sentArgs](): [KeyInputItem<ENTITY>, DeleteItemOptions<ENTITY>]; params(): DeleteCommandInput; send(documentClientOptions?: DocumentClientOptions): Promise<DeleteItemResponse<ENTITY, OPTIONS>>; } export {};