UNPKG

@moicky/dynamodb

Version:

Contains a collection of convenience functions for working with AWS DynamoDB

45 lines (44 loc) 1.57 kB
/** * @property {string} hash - The name of the hash key. * @property {string} [range] - The name of the range key. Only required if the table has a range key. */ export declare interface KeySchema { hash: string; range?: string; } /** * @property {string} tableName - The name of the table. */ export declare interface KeySchemaCollection { [tableName: string]: KeySchema; } /** * Initializes the {@link KeySchemaCollection} to use for all operations. * @param schema - The new {@link KeySchemaCollection} to use * @returns The new {@link KeySchemaCollection} */ export declare const initSchema: (schema: KeySchemaCollection) => KeySchemaCollection; /** * Validates the {@link KeySchemaCollection} to use for all operations. * @param schema - The {@link KeySchemaCollection} to validate * @returns true if the schema is valid */ export declare const validateSchema: (schema: KeySchemaCollection) => boolean; /** * Returns the first table name from the {@link KeySchemaCollection}. */ export declare const getDefaultTable: () => string; /** * Returns the {@link KeySchema} for the given or default table. */ export declare const getTableSchema: (tableName?: string) => KeySchema; /** * Returns the default {@link KeySchema}. * @returns The default {@link KeySchema} */ export declare const getDefaultTableSchema: () => KeySchema; /** * Returns whether the {@link KeySchemaCollection} has been initialized. * @returns true if the {@link KeySchemaCollection} has been initialized */ export declare const isInitialized: () => boolean;