EncodedEntity
type EncodedEntity<E> = ZodInput<E["schema"]>;Utility type to derive the input type of a DynamoEntity’s schema.
This is the Zod input type of a Zod schema (the type before a codec has been applied).
It is the equivalent of z.input<typeof entity.schema>.
Type Parameters
Section titled “Type Parameters”E extends DynamoEntity<any>
Example
Section titled “Example”import { DynamoTable, DynamoEntity, type EncodedEntity } from 'dynamo-document-builder';import { z } from 'zod';
const table = new DynamoTable({ tableName: 'ExampleTable', documentClient,});
const isoDatetimeToDate = z.codec(z.iso.datetime(), z.date(), { decode: isoString => new Date(isoString), encode: date => date.toISOString(),});
const checkinEntity = new DynamoEntity({ table, schema: z.object({ id: z.string(), timestamp: isoDatetimeToDate, }),});
type EncodedUser = EncodedEntity<typeof userEntity>;
// EncodedUser is:// {// id: string;// timestamp: string; // ISO datetime string// }