import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; import { NamedGlobalSecondaryIndexKeyNames, NamedLocalSecondaryIndexKeyNames } from './index.js'; import { TableCommand } from '../commands/index.js'; /** * Configuration type for creating a DynamoTable. * * The table is assumed to have a primary key composed of a partition key named `"PK"` and * a sort key named `"SK"` by default, unless overridden in the `keyNames` property. * * @template Schema - The Zod schema representing the entity's structure. * * @property tableName - The name of the DynamoDB table. * @property documentClient - The DynamoDB Document Client instance to use for operations. * @property keyNames - Key names object for the table's primary key and secondary indexes. */ type DynamoTableConfig = { tableName: string; documentClient?: DynamoDBDocumentClient; keyNames?: { partitionKey: string; sortKey?: string | null; globalSecondaryIndexes?: NamedGlobalSecondaryIndexKeyNames; localSecondaryIndexes?: NamedLocalSecondaryIndexKeyNames; }; }; /** * Core class that represents a DynamoDB table. */ declare class DynamoTable { #private; constructor(config: DynamoTableConfig); /** * The name of the DynamoDB table. */ get tableName(): string; /** * The DynamoDB Document Client instance used for operations. * @throws Error if no client has been provided via the constructor or `initClient`. */ get documentClient(): DynamoDBDocumentClient; /** * Sets the DynamoDB Document Client for this table, allowing the client * to be initialized after table construction. */ initClient(client: DynamoDBDocumentClient): void; /** * The name of the partition key for the table. */ get partitionKeyName(): string; /** * The name of the sort key for the table, or `null` if the table does not have a sort key * (`null` would indicate a "simple" primary key). */ get sortKeyName(): string | null; /** * The key names for the global secondary indexes defined on the table. */ get globalSecondaryIndexKeyNames(): NamedGlobalSecondaryIndexKeyNames; /** * The key names for the local secondary indexes defined on the table. */ get localSecondaryIndexKeyNames(): NamedLocalSecondaryIndexKeyNames; /** * Sends a table-level command to be executed against this table. */ send(command: TableCommand): Promise; } export { DynamoTable }; export type { DynamoTableConfig };