UNPKG

duenamodb

Version:

Simple DynamoDB client written in TypeScript.

15 lines (14 loc) 1.16 kB
import { QueryCommandInput } from '@aws-sdk/client-dynamodb'; import { FilterOptions } from './expression'; import { DynamoDBTypes, GSI, PK } from './types'; type QueryDynamoDBOptions = Omit<QueryCommandInput, 'TableName'>; export type QueryOptions<Attributes extends DynamoDBTypes, GSISK extends PK> = { sortKey?: GSISK; filterOptions?: FilterOptions<Attributes>; dynamodbOptions?: QueryDynamoDBOptions; }; export type QueryItemsFunction<Attributes extends DynamoDBTypes, GSIPK extends PK, GSISK extends PK = string> = (key: GSIPK, options?: QueryOptions<Attributes, GSISK>) => Promise<Attributes[]>; export declare const createQueryItems: <Attributes extends DynamoDBTypes, GSIPK extends PK, GSISK extends PK = string>(tablename: string, gsiOptions: GSI<Attributes>) => QueryItemsFunction<Attributes, GSIPK, GSISK>; export declare const createQueryOptions: <Attributes extends DynamoDBTypes>(index: string, keyOptions: Partial<Attributes>, filterOptions?: FilterOptions<Attributes> | undefined) => Partial<QueryDynamoDBOptions>; export declare const queryItems: <T>(tablename: string, options: QueryDynamoDBOptions) => Promise<T[]>; export {};