import { Construct } from 'constructs'; import { CreateTableCommandInput } from '@aws-sdk/client-dynamodb'; import { Table as BaseTable, TableProps as BaseTableProps, GlobalSecondaryIndexProps, LocalSecondaryIndexProps } from 'aws-cdk-lib/aws-dynamodb'; import { Mutable } from '../../lib/Mutable'; declare const dynamoAttributeTypes: readonly ["string", "number", "boolean"]; declare type AttributeType = typeof dynamoAttributeTypes[number]; export declare type DynamoAttribute = { [attributeName: string]: AttributeType; }; export declare type OmittedIndexProps = 'partitionKey' | 'sortKey'; export interface LsiProps extends Omit { sortKey: DynamoAttribute; } export interface GsiProps extends Omit { partitionKey: DynamoAttribute; sortKey?: DynamoAttribute; } export interface TableProps extends Mutable> { /** * The name of the resource to make. Generally this is a few short words. When passing `prefix` and * `name` the physical name of resources will take the format of `${prefix}-${name}`. If just name is passed * it will just be the value of `name` */ name: string; /** * The prefix to use for the resources. Will prefix all resource names with this value. For more info, see * [Naming](https://full-stack-pattern.matthewkeil.com/docs/naming) */ prefix?: string; /** * Partition key for the table. Uses the format of: * * ```typescript * type DynamoAttribute = { [attributeName: string]: 'string' | 'number' | 'boolean' } * * // Example: * partitionKey: { * id: 'string', * } * * // Instead of natively: * partitionKey: { * name: 'id', * type: AttributeType.STRING * } * ``` * * I find this syntax a bit verbose and prefer to not need to import the * enum into my projects so I shortened the syntax. */ partitionKey: DynamoAttribute; /** * Sort key for the table. Uses the format of: * * ```typescript * type DynamoAttribute = { [attributeName: string]: 'string' | 'number' | 'boolean' } * * // Example: * partitionKey: { * id: 'string', * } * * // Instead of natively: * partitionKey: { * name: 'id', * type: AttributeType.STRING * } * ``` * * I find this syntax a bit verbose and prefer to not need to import the * enum into my projects so I shortened the syntax. */ sortKey?: DynamoAttribute; /** * Array of Local Secondary Indexes. LsiProps extend LocalSecondaryIndexProps * but use this constructs syntax for the sortKey. */ lsi?: LsiProps[]; /** * Array of Local Secondary Indexes. LsiProps extend LocalSecondaryIndexProps * but use this constructs syntax for the partitionKey and sortKey. */ gsi?: GsiProps[]; /** * LogicalId for the RestApi resource for in-place upgrades. For more * info, see [Naming](https://full-stack-pattern.matthewkeil.com/docs/naming) */ logicalId?: string; /** * Option to not use fixed logicalId's for the RestApi resource. For more * info, see [Naming](https://full-stack-pattern.matthewkeil.com/docs/naming) */ dontOverrideLogicalId?: boolean; } export declare class Table extends BaseTable { static constructPropsToSdkProps(table: TableProps): CreateTableCommandInput; name: string; constructor(scope: Construct, id: string, props: TableProps); private static convertAttribute; } export {};