import { NoSQLByte } from './byte'; import { DataType } from './enum'; import { NoSQLMarshall, MarshallOptions } from './marshall'; import { NoSQLByteSet, NoSQLNumberSet, NoSQLStringSet } from './set'; import { TNoSQLByte, TNoSQLItem, TNoSQLValues, TNoSQLAttribute, TNoSQLAttributeResponse } from './types'; /** * Implementation of a NoSQL Item */ export declare class NoSQLItem { #private; constructor(item?: TNoSQLItem); /** * Get value of the null attribute * @param name Attribute name * @returns null if attribute is present */ getNull(name: string): null | undefined; /** * Add null(NULL) attribute to the item * @param name name of the null attribute * @returns NoSQLItem */ addNull(name: string): this; /** * Get value of a string(S) attribute * @param name name of the string attribute * @returns value of the string attribute */ getString(name: string): string | undefined; /** * Add string(S) attribute to the item * @param name name of the string attribute * @param value value of the string attribute * @returns NoSQLItem */ addString(name: string, value: string): this; /** * Get value of a number(N) attribute * @param name name of the number attribute * @returns value of the number attribute */ getNumber(name: string): number | bigint | undefined; /** * Add number(N) attribute to the item * @param name name of the number attribute * @param value value of the number attribute * @returns NoSQLItem */ addNumber(name: string, value: number | bigint): this; /** * Get value of a byte(B) attribute * @param name name of the byte attribute * @returns value of the byte attribute */ getByte(name: string): NoSQLByte | undefined; /** * Add a byte(B) attribute to the item * @param name name of the byte attribute * @param value value(ArrayBuffer) of the byte attribute as base64 encoded string * @returns NoSQLItem */ addByte(name: string, value: string): this; /** * Add a byte(B) attribute to the item * @param name name of the byte attribute * @param value value of the byte attribute as NoSQLByte * @returns NoSQLItem */ addByte(name: string, value: NoSQLByte): this; /** * Add a byte(B) attribute to the item * @param name name of the byte attribute * @param value ArrayBuffer of type {@link TNoSQLByte} */ addByte(name: string, value: TNoSQLByte): this; /** * Get value of a boolean(BOOL) attribute * @param name name of the boolean attribute * @returns value of the boolean attribute */ getBoolean(name: string): boolean | undefined; /** * Add a boolean(BOOL) attribute to the item * @param name name of the boolean attribute * @param value value of the boolean attribute * @returns NoSQLItem */ addBoolean(name: string, value: boolean): this; /** * Get value of a list(L) attribute * @param name name of the list attribute * @returns value of the list attribute */ getList(name: string): Array | undefined; /** * Add a list(L) attribute to the item * @param name name of the list attribute * @param value value of the list attribute * @returns NoSQLItem */ addList(name: string, value: Array): this; /** * Get value of a map(M) attribute * @param name name of the map attribute * @returns value of the map attribute */ getMap(name: string): Record | undefined; /** * Add a map(M) attribute to the item * @param name name of the map attribute * @param value value of the map attribute * @param options marshalling options to convert plain js objects to NoSQL attributes * @returns NoSQLItem */ addMap(name: string, value: Record | Map, options?: MarshallOptions): this; /** * Get value of a string set(SS) attribute * @param name name of the string set attribute * @returns value of the string set attribute */ getStringSet(name: string): NoSQLStringSet | undefined; /** * Add a string set(SS) attribute to the item * @param name name of the string set attribute * @param value value of the string set attribute as a set of string * @returns NoSQLItem */ addStringSet(name: string, value: Set): this; /** * Add a string set(SS) attribute to the item * @param name name of the string set attribute * @param value value of the string set attribute as NoSQLStringSet * @returns NoSQLItem */ addStringSet(name: string, value: NoSQLStringSet): this; /** * Get value of a number set(SN) attribute * @param name name of the number set attribute * @returns value of the number set attribute */ getNumberSet(name: string): NoSQLNumberSet | undefined; /** * Add a number set(SN) attribute to the item * @param name name of the number set attribute * @param value value of the number set attribute as a set of number or bigint * @returns NoSQLItem */ addNumberSet(name: string, value: Set): this; /** * Add a number set(SN) attribute to the item * @param name name of the number set attribute * @param value value of the number set attribute as NoSQLNumberSet * @returns NoSQLItem */ addNumberSet(name: string, value: NoSQLNumberSet): this; /** * Get value of a byte set(SB) attribute * @param name name of the byte set attribute * @returns value of the byte set attribute */ getByteSet(name: string): NoSQLByteSet | undefined; /** * Add a byte set(SB) attribute to the item * @param name name of the byte set attribute * @param value value of the byte set attribute as a set of ArrayBuffers mentioned in {@link TNoSQLByte} * @returns NoSQLItem */ addByteSet(name: string, value: Set): this; /** * Add a byte set(SB) attribute to the item * @param name name of the byte set attribute * @param value value of the byte set attribute as a set of NoSQLByte * @returns NoSQLItem */ addByteSet(name: string, value: Set): this; /** * Add a byte set(SB) attribute to the item * @param name name of the byte set attribute * @param value value of the byte set attribute as a set of base64 encoded string of the buffer * @returns NoSQLItem */ addByteSet(name: string, value: Set): this; /** * Add a byte set(SB) attribute to the item * @param name name of the byte set attribute * @param value value of the byte set attribute as NoSQLByteSet * @returns NoSQLItem */ addByteSet(name: string, value: NoSQLByteSet): this; /** * Add a set of type string or number or TNoSQLByte as an attribute to this item. * @param name attribute name * @param value set to be added * @param options marshalling options * @returns NoSQLItem */ addSet(name: string, value: Set | Set | Set, options: Parameters[1]): this; /** * Adds a NoSQL attribute to the item without any validations or marshalling. * * Note: Use this function only when it's absolutely necessary. Prefer to user other attribute addition functions over this. * @param name name of the attribute * @param type NoSQL type of the attribute * @param value value of the attribute * @returns NoSQLItem */ addRaw(name: string, type: DataType, value: TNoSQLValues | TNoSQLItem): this; /** * Adds a NoSQL attribute to the item with validation and marshalling. * @param name name of the attribute * @param value value of the attribute * @param options options to marshall the value * @returns NoSQLItem */ add(name: string, value: TNoSQLValues, options: MarshallOptions): this; /** * Get a near-native value of the NoSQL attribute * @param name name of the attribute * @returns value of the attribute type TNoSQLValues */ get(name: string): TNoSQLValues; /** * Remove an attribute from the item * @param name name of the attribute to be removed * @returns value of the removed attribute */ remove(name: string): TNoSQLAttribute | TNoSQLAttributeResponse | undefined; /** * Check if an attribute exists in the item * @param name name of the attribute to check * @returns true if the attribute is present */ has(name: string): boolean; /** * Get the total number of attributes present * @returns total number of attributes */ numberOfAttributes(): number; /** * Returns a serializable json object of the item * @returns JSON representation of the NoSQLItem */ toJSON(): TNoSQLItem; /** * Returns a near native object representation of the item * @returns near-native representation of the NoSQLItem */ to(): Record; /** * Create a NoSQL item from plain java script object * @param obj to be used to create the item * @param options marshalling options to convert native js types to NoSQL types * @returns new NoSQLItem */ static from(obj: Record, options?: MarshallOptions): NoSQLItem; }