UNPKG

amazon-qldb-kvs-nodejs

Version:

A helper module, simplifying basic interactions with Amazon Quantum Ledger Database for Node.js through a simple key-value store interface.

49 lines (48 loc) 2.38 kB
import { TransactionExecutor } from "amazon-qldb-driver-nodejs"; import { dom } from "ion-js"; export interface GetDocIdAndVersionResult { id: string; version: number; } export interface GetDocumentResult { data: dom.Value; version: number; } /** * Gets a document by the value of one attribute. * @param txn The {@linkcode TransactionExecutor} for lambda execute. * @param tableName The name of a table. * @param keyAttributeName The name of an attribute for indexing. * @param keyAttributeValue A value of a key attribute. * @returns Array of results as ION documents. * @throws Error: If error happen during the process. */ export declare function getByKeyAttribute(txn: TransactionExecutor, tableName: string, keyAttributeName: string, keyAttributeValue: string): Promise<GetDocumentResult[]>; /** * Gets a document by the value of one attribute. * @param txn The {@linkcode TransactionExecutor} for lambda execute. * @param tableName The name of a table. * @param keyAttributeName The name of an attribute for indexing. * @param keyAttributeValues An array of values of key attribute. * @returns Array of results as ION documents. * @throws Error: If error happen during the process. */ export declare function getByKeyAttributes(txn: TransactionExecutor, tableName: string, keyAttributeName: string, keyAttributeValues: string[]): Promise<GetDocumentResult[]>; /** * Gets a document by QLDB Document Id * @param txn The {@linkcode TransactionExecutor} for lambda execute. * @param tableName The name of a table. * @param documentId Document Id string. * @returns Array of results as ION documents. * @throws Error: If error happen during the process. */ export declare function getDocumentById(txn: TransactionExecutor, tableName: string, documentId: string): Promise<GetDocumentResult[]>; /** * Get the document IDs from the given table. * @param txn The {@linkcode TransactionExecutor} for lambda execute. * @param tableName The table name to query. * @param keyAttributeName A keyAttributeName to query. * @param keyAttributeValue The key of the given keyAttributeName. * @returns Promise which fulfills with the document ID as a string. */ export declare function getDocumentIdsAndVersions(txn: TransactionExecutor, tableName: string, keyAttributeName: string, keyAttributeValue: string): Promise<GetDocIdAndVersionResult[]>;