import { hasSortKey } from '../decorator/metadata/metadata';
import { toDbOne } from '../mapper/index';
export function createKeyAttributes(metadata, partitionKey, sortKey) {
    const partitionKeyProp = metadata.getPartitionKey();
    const keyAttributeMap = {
        [partitionKeyProp]: toDbOne(partitionKey, metadata.forProperty(partitionKeyProp)),
    };
    if (hasSortKey(metadata)) {
        if (sortKey === null || sortKey === undefined) {
            throw new Error(`please provide the sort key for attribute ${metadata.getSortKey()}`);
        }
        const sortKeyProp = metadata.getSortKey();
        keyAttributeMap[sortKeyProp] = toDbOne(sortKey, metadata.forProperty(sortKeyProp));
    }
    return keyAttributeMap;
}
//# sourceMappingURL=create-ket-attributes.function.js.map