UNPKG

@mbc-cqrs-serverless/core

Version:
39 lines (38 loc) 1.78 kB
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { ConfigService } from '@nestjs/config'; import { TableType } from '../commands'; import { DdbUpdateItem, DetailKey } from '../interfaces'; import { S3Service } from './s3.service'; declare const CLIENT_INSTANCE: unique symbol; export declare class DynamoDbService { private readonly config; private readonly s3Service; private readonly logger; private readonly [CLIENT_INSTANCE]; private readonly tablePrefix; constructor(config: ConfigService, s3Service: S3Service); get client(): DynamoDBClient; putItem(tableName: string, item: Record<string, any>, conditions?: string): Promise<Record<string, any>>; updateItem(tableName: string, key: DetailKey, item: DdbUpdateItem, conditions?: string): Promise<any>; getItem(tableName: string, key: DetailKey): Promise<any>; deleteItem(tableName: string, key: DetailKey, conditions?: string): Promise<import("@aws-sdk/client-dynamodb").DeleteItemCommandOutput>; listItemsByPk(tableName: string, pk: string, sk?: { skExpression: string; skAttributeValues: Record<string, string>; skAttributeNames?: Record<string, string>; }, startFromSk?: string, limit?: number, order?: 'asc' | 'desc'): Promise<any>; listAllItems(tableName: string, startKey?: DetailKey, limit?: number): Promise<{ lastKey: DetailKey; items: any[]; }>; private ddbItemToObj; private objToDdbItem; private toDdbKey; private buildUpdateExpression; private buildUpdateSetExpression; private buildUpdateRemoveExpression; private buildUpdateDeleteExpression; getTableName(moduleName: string, type?: TableType): string; getModuleName(tableName: string): string; } export {};