import { Constructable } from '../internal/types.mjs'; import { Table } from '../core/types.mjs'; export type ItemConfig = { /** * Defines the DynamoDB table name or complex configuration. * @see Table */ readonly table: string | Table; /** * Defines the expressions for partition/sort key. This can be omitted but must then be provided using \@{@link Attribute} decorator. */ readonly key?: { readonly partitionKey: string; readonly sortKey?: string; }; /** * Defines the alternativ key expressions for LSIs. The index name must match the ones in the table definition. */ readonly lsi?: Record; /** * Defines the alternative key expressions for GSIs. The index name must match the ones in the table definition. */ readonly gsi?: Record; }; /** * Defines a class to be used with ODynM. * * #### Example 1 * The column names in DynamoDB table for partitionKey and sortKey must be 'pk' and 'sk' respectively. * Both types will bve treated as {@link String}. The expressions for partition/sort key must be provided using \@{@link Attribute} * decorator. * ```ts * Item({ * table: 'table' * }) * ``` * * #### Example 2 * The column names in DynamoDB table for partitionKey and sortKey must be 'pk' and 'sk' respectively. * Both types will bve treated as {@link String}. * * partitionKey will be built from the static part and the substituted value from 'id' member. For example: SOME#1234 * * sortKey is not used. * * This configuration takes always precedence over \@{@link Attribute} decorator. * ```ts * Item({ * table: 'table', * key: { partitionKey: 'SOME#{{id}}' } * }) * ``` * * #### Example 3 * The column names in DynamoDB table for partitionKey and sortKey must be 'partition' and 'sort' respectively. * The type for partitionKey will default to {@link string}. sortKey will be treated as {@link number}. * * partitionKey will be built from the static part and the substituted value from 'id' member. For example: SOME#1234 * * sortKey will evaluate to 12345. * * This configuration takes always precedence over \@{@link Attribute} decorator. * * ```ts * Item({ * table: { * name: 'table', * partitionKey: 'partition', * sortKey: { name: 'sort', type: Number } * }, * key: { partitionKey: 'SOME#{{id}}', sortKey: '{{id}}' } * }) * ``` * * @param config the configuration of the item */ export declare const Item: (config: ItemConfig) => (constr: Constructable) => void;