dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
32 lines (31 loc) • 2.19 kB
TypeScript
import type { PutCommandInput, PutCommandOutput } 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 { EntityAction } from '../../../entity/index.js';
import type { ValidItem } 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 { $item, $options } from './constants.js';
import type { PutItemOptions } from './options.js';
import type { PutItemInput } from './types.js';
type ReturnedAttributes<ENTITY extends Entity, OPTIONS extends PutItemOptions<ENTITY>> = OPTIONS['returnValues'] extends NoneReturnValuesOption ? undefined : OPTIONS['returnValues'] extends AllOldReturnValuesOption ? FormattedItem<ENTITY> | undefined : never;
export type PutItemResponse<ENTITY extends Entity, OPTIONS extends PutItemOptions<ENTITY> = PutItemOptions<ENTITY>> = Merge<Omit<PutCommandOutput, 'Attributes'>, {
Attributes?: ReturnedAttributes<ENTITY, OPTIONS>;
ToolboxItem: ValidItem<ENTITY>;
}>;
export declare class PutItemCommand<ENTITY extends Entity = Entity, OPTIONS extends PutItemOptions<ENTITY> = PutItemOptions<ENTITY>> extends EntityAction<ENTITY> implements EntitySendableAction<ENTITY> {
static actionName: "put";
[$item]?: PutItemInput<ENTITY>;
[$options]: OPTIONS;
constructor(entity: ENTITY, item?: PutItemInput<ENTITY>, options?: OPTIONS);
item(nextItem: PutItemInput<ENTITY>): PutItemCommand<ENTITY, OPTIONS>;
options<NEXT_OPTIONS extends PutItemOptions<ENTITY>>(nextOptions: NEXT_OPTIONS | ((prevOptions: OPTIONS) => NEXT_OPTIONS)): PutItemCommand<ENTITY, NEXT_OPTIONS>;
[$sentArgs](): [PutItemInput<ENTITY>, PutItemOptions<ENTITY>];
params(): PutCommandInput & {
ToolboxItem: ValidItem<ENTITY>;
};
send(documentClientOptions?: DocumentClientOptions): Promise<PutItemResponse<ENTITY, OPTIONS>>;
}
export {};