UNPKG

dynamodb-toolbox

Version:

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

13 lines (12 loc) 421 B
import { getSchemaDTO } from './schema.js'; export const getItemSchemaDTO = (schema) => { const { strict } = schema.props; return { type: 'item', attributes: Object.fromEntries(Object.entries(schema.attributes).map(([attributeName, attribute]) => [ attributeName, getSchemaDTO(attribute) ])), ...(strict !== undefined && strict ? { strict } : {}) }; };