UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

23 lines (22 loc) 814 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromItemSchemaDTO = void 0; const index_js_1 = require("../../../../schema/item/index.js"); const attribute_js_1 = require("./attribute.js"); /** * @debt feature "handle defaults, links & validators" */ const fromItemSchemaDTO = ({ keyDefault, putDefault, updateDefault, keyLink, putLink, updateLink, strict, attributes }) => { keyDefault; putDefault; updateDefault; keyLink; putLink; updateLink; const schema = (0, index_js_1.item)(Object.fromEntries(Object.entries(attributes).map(([attributeName, attribute]) => [ attributeName, (0, attribute_js_1.fromSchemaDTO)(attribute) ]))); return strict ? schema.strict() : schema; }; exports.fromItemSchemaDTO = fromItemSchemaDTO;