TableDTO
Builds a Data Transfer Object of the Table
.
A DTO is a JSON-stringifiable object representing the Table
that can be transferred or saved for later use:
import { TableDTO } from 'dynamodb-toolbox/table/actions/dto'
const pokeTableDTO = PokeTable.build(TableDTO)
const pokeTableJSON = JSON.stringify(tableDTO)
On DTO retrieval, you can use the fromDTO
util to re-create the original Table
:
import { fromDTO } from 'dynamodb-toolbox/table/actions/fromDTO'
const pokeTableDTO = JSON.parse(pokeTableJSON)
// 👇 Has the same configuration as the original
const PokeTable = fromDTO(pokeTableDTO)
note
All TS types are lost in the process.