dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
10 lines (9 loc) • 426 B
JavaScript
import { item } from '../../../schema/item/index.js';
import { fromSchemaDTO as _fromSchemaDTO } from './fromSchemaDTO/index.js';
export const fromSchemaDTO = (schemaDTO) => {
const schema = item(Object.fromEntries(Object.entries(schemaDTO.attributes).map(([attributeName, attributeDTO]) => [
attributeName,
_fromSchemaDTO(attributeDTO)
])));
return schemaDTO.strict ? schema.strict() : schema;
};