import { NoSQLByte } from './byte'; import { DataType } from './enum'; import { NoSQLByteSet, NoSQLNumberSet, NoSQLStringSet } from './set'; import { TNoSQLByte, TNoSQLValues, TNoSQLAttribute } from './types'; /** * An optional configuration object for `serialize` */ export interface MarshallOptions { /** * Whether to automatically convert empty strings, buffers, and sets to `null` */ convertEmptyValues?: boolean; /** * Whether to remove undefined values while serializing. */ removeUndefinedValues?: boolean; /** * Whether to convert class object to map attribute. */ convertClassInstanceToMap?: boolean; } /** * Class that contains the marshalling utils. * Converts native or near-native js object to NoSQL attributes */ export declare class NoSQLMarshall { /** * Make a NoSQL null attribute * @returns NoSQL null(NULL) attribute */ static makeNull(): { [DataType.NULL]: true; }; /** * Make a NoSQL string attribute from string value * @param value string value * @returns NoSQL string(S) attribute */ static makeString(value: string): { [DataType.S]: string; }; /** * Make a NoSQL number attribute from number or bigint values * @param value number or bigint value * @returns NoSQL number(N) attribute */ static makeNumber(value: number | bigint): { [DataType.N]: string; }; /** * Make a NoSQL byte attribute * @param value base64 encoded string or NoSQLByte or array buffers listed in TNoSQLByte type * @returns NoSQL byte attribute */ static makeByte(value: string | TNoSQLByte | NoSQLByte): { [DataType.B]: NoSQLByte; }; /** * Make a NoSQL boolean attribute * @param value boolean value * @returns NoSQL boolean (BOOL) attribute */ static makeBoolean(value: boolean): { [DataType.BOOL]: string; }; /** * Make a NoSQL list attribute from an Array * @param value Array of NoSQL compatible data types * @returns NoSQL list(L) attribute */ static makeList(value: Array): { [DataType.L]: Array; }; /** * Make a NoSQL map attribute from an object * @param value object * @param options marshalling options * @returns NoSQL Map(M) attribute */ static makeMap(value: Record | Map, options?: MarshallOptions): { [DataType.M]: Record; }; /** * Make a NoSQL string set attribute from a set of strings or NoSQLStringSet * @param value Set of strings or NoSQLStringSet value * @returns NoSQL string set(SS) attribute */ static makeStringSet(value: Set | NoSQLStringSet): { [DataType.SS]: NoSQLStringSet; }; /** * Make a NoSQL number set attribute from a set of number or bigint or NoSQLNumberSet * @param value Set of number or bigint or NoSQLNumberSet value * @returns NoSQL number set(SN) attribute */ static makeNumberSet(value: Set | NoSQLNumberSet): { [DataType.SN]: NoSQLNumberSet; }; /** * Make a NoSQL byte set attribute from a set of byte or base64 encoded string or NoSQLByteSet * @param value Set of byte or base64 encoded string or NoSQLByteSet value * @returns NoSQL byte set(SB) attribute */ static makeByteSet(value: Set | Set | Set | NoSQLByteSet): { [DataType.SB]: NoSQLByteSet; }; /** * Make NoSQL set attribute from set * @param set set to be converted * @param options options to be used when marshalling * @returns NoSQL set attribute (SS, SN, SB) */ static makeSet(set: Set | NoSQLStringSet | Set | NoSQLNumberSet | Set | NoSQLByteSet, options?: Omit): { [DataType.SS]: NoSQLStringSet; } | { [DataType.SB]: NoSQLByteSet; } | { [DataType.SN]: NoSQLNumberSet; } | { [DataType.NULL]: true; }; /** * Make a NoSQL attribute from native js values * @param data value to be converted to NoSQL attribute * @param options options to be used when converting js values to NoSQL attributes * @returns NoSQL attribute */ static make(data: TNoSQLValues, options?: MarshallOptions): TNoSQLAttribute; }