dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
22 lines (21 loc) • 740 B
TypeScript
import type { Table } from '../../../table/index.js';
import { TableAction } from '../../../table/index.js';
import type { Key, KeyValue } from '../../../table/types/index.js';
/**
* Returns the TS type of a Table Primary Key
*
* @param TABLE Table
* @return Object
*/
export type PrimaryKey<TABLE extends Table = Table> = {
[KEY in TABLE['partitionKey'] | (TABLE extends {
sortKey?: Key;
} ? NonNullable<TABLE['sortKey']> : never) as KEY['name']]: KeyValue<KEY>;
};
export declare class PrimaryKeyParser<TABLE extends Table = Table> extends TableAction<TABLE> {
static actionName: "parsePrimaryKey";
constructor(table: TABLE);
parse(keyInput: {
[KEY: string]: unknown;
}): PrimaryKey<TABLE>;
}