@karmaniverous/entity-client-dynamodb
    Preparing search index...

    Tables & Table Definition

    Generate a DynamoDB table definition directly from your EntityManager config and create the table via the client.

    Generate the definition

    import { generateTableDefinition } from '@karmaniverous/entity-client-dynamodb';

    const def = generateTableDefinition(client.entityManager);
    // def includes:
    // - AttributeDefinitions (global & index tokens)
    // - GlobalSecondaryIndexes (with projections resolved)
    // - KeySchema

    Create a table

    await client.createTable({
    BillingMode: 'PAY_PER_REQUEST',
    ...def,
    });

    Attribute typing helpers

    If your transcodes include non-string types, you can control AttributeType mapping via the TranscodeAttributeTypeMap helpers.

    import {
    defaultTranscodeAttributeTypeMap,
    type TranscodeAttributeTypeMap,
    } from '@karmaniverous/entity-client-dynamodb';
    // defaultTranscodeAttributeTypeMap maps numeric-like transcodes to 'N'

    Related