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