"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const metadata_1 = require("../decorator/metadata/metadata");
const index_1 = require("../mapper/index");
function createKeyAttributes(metadata, partitionKey, sortKey) {
    const partitionKeyProp = metadata.getPartitionKey();
    const keyAttributeMap = {
        [partitionKeyProp]: index_1.toDbOne(partitionKey, metadata.forProperty(partitionKeyProp)),
    };
    if (metadata_1.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] = index_1.toDbOne(sortKey, metadata.forProperty(sortKeyProp));
    }
    return keyAttributeMap;
}
exports.createKeyAttributes = createKeyAttributes;
//# sourceMappingURL=create-ket-attributes.function.js.map