import { DocumentClient } from 'aws-sdk/lib/dynamodb/document_client'; import { Document } from './document'; import { Update } from './method/update'; import { Readable, ReadableParams } from './readable'; declare abstract class Model extends Readable { /** * Create and return Document * @param {S} data * @returns {Document} */ of(data: S): Document; /** * Get items * @deprecated @todo * @todo */ batchGet(): Promise; /** * BatchWrite items, It sends automatically split chunk every 25 items * @param {WriteRequest[]} items * @returns {Promise} */ batchWrite(items: WriteRequest[]): Promise; /** * Put items, `batchPut` call `batchWrite` internally, * @param {S[]} items * @returns {Promise} */ batchPut(items: S[]): Promise; /** * * Delete items, `batchDelete` call `batchWrite` internally, * @param {Partial[]} keyMap - Key object * @returns {Promise} */ batchDelete(keyMap: Partial[]): Promise; get(_: any, __?: any): void; update(_: any, __?: any): void; delete(_: any, __?: any): void; /** * Update item and return Document(data) * @param hashKey * @param rangeKey * @param params * @returns {Promise} * @protected */ protected doUpdate(hashKey: any, rangeKey: any, params: any): Promise | null>; } export declare class HashModel extends Model { /** * API - define HashKey only data type * @param {ReadableParams} params */ constructor(params: ReadableParams); /** * Get Document from server * @param {S[H]} hashKey * @returns {Promise>} */ get(hashKey: S[H]): Promise>; /** * Get `Update` * @param {S[H]} hashKey * @returns {Update} */ update(hashKey: S[H]): Update; /** * Delete item * @param {S[H]} hashKey * @returns {Promise>} */ delete(hashKey: S[H]): Promise; } export declare class RangeModel extends Model { /** * API - define HashKey and RangeKey data type * @param {ReadableParams} params */ constructor(params: ReadableParams); /** * Get Document from server * @param {S[H]} hashKey * @param {S[RK]} rangeKey * @returns {Promise | undefined>} */ get(hashKey: S[H], rangeKey: S[RK]): Promise | undefined>; /** * Get `Update` * @param {S[H]} hashKey * @param {S[RK]} rangeKey * @returns {Update} */ update(hashKey: S[H], rangeKey: S[RK]): Update; /** * Delete item * @param {S[H]} hashKey * @param {S[RK]} rangeKey * @returns {Promise>} */ delete(hashKey: S[H], rangeKey: S[RK]): Promise; } interface WriteRequest extends DocumentClient.WriteRequest { PutRequest?: { Item: S; }; DeleteRequest?: { Key: Partial; }; } export {};