@nerdware/ddb-single-table
Version:
A schema-based DynamoDB modeling tool, high-level API, and type-generator built to supercharge single-table designs!⚡
56 lines • 3.29 kB
TypeScript
import type { MarshallingMethod, UnmarshallingMethod, SomeUnmarshalledCommandInput, SomeMarshalledCommandOutput, MarshallingConfigs, ToMarshalledSdkInput, ToUnmarshalledSdkOutput, DdbClientFieldParserConstructorParameters } from "./types/index.js";
import type { Simplify } from "type-fest";
/**
* Utility class for preparing DynamoDB client command arguments and parsing client responses.
*/
export declare class DdbClientFieldParser {
/**
* Default {@link MarshallingConfigs} for the DynamoDB `marshall` and `unmarshall` util fns.
* > Note: the SDK defaults all of these options to `false`.
*/
static readonly DEFAULT_MARSHALLING_CONFIGS: {
readonly marshallOptions: {
readonly convertEmptyValues: false;
readonly removeUndefinedValues: true;
readonly convertClassInstanceToMap: true;
readonly convertTopLevelContainer: false;
readonly allowImpreciseNumbers: false;
};
readonly unmarshallOptions: {
readonly wrapNumbers: false;
readonly convertWithoutMapWrapper: false;
};
};
protected readonly tableName: DdbClientFieldParserConstructorParameters["tableName"];
protected readonly defaultMarshallingConfigs: Required<MarshallingConfigs>;
constructor({ tableName, marshallingConfigs }: DdbClientFieldParserConstructorParameters);
/** Invokes the `marshall` util function with the default marshalling configs. */
readonly marshall: MarshallingMethod;
/** Converts JS `Date` objects to datetime strings, and then marshalls the result. */
readonly marshallAndConvertDates: MarshallingMethod;
/** Invokes the `unmarshall` util function with the default unmarshalling configs. */
readonly unmarshall: UnmarshallingMethod;
/** Unmarshalls the provided `data`, and then converts datetime strings to JS `Date` objects. */
readonly unmarshallAndConvertDates: UnmarshallingMethod;
private readonly isBatchGetItemRequestItems;
private readonly prepRequestItems;
/**
* This method prepares command arguments for DynamoDB client commands:
* - Adds the `TableName` parameter
* - Marshalls attribute values (`Key`, `Item`, `ExpressionAttributeValues`, etc.)
* - Converts JS Date objects to ISO-8601 datetime strings
*/
readonly prepCommandArgs: <UnmarshalledCmdInput extends SomeUnmarshalledCommandInput>(unmarshalledCommandArgs: UnmarshalledCmdInput, marshallOpts?: MarshallingConfigs["marshallOptions"]) => Simplify<{
TableName: string;
} & ToMarshalledSdkInput<UnmarshalledCmdInput>>;
private readonly isSingleItemCollectionMetrics;
private readonly parseSingleItemCollectionMetrics;
private readonly parseItemCollectionMetrics;
/**
* This method parses dynamodb-client reponses:
* - Unmarshalls attribute values (`Item`, `Items`, `Attributes`, `ItemCollectionKey`, etc.)
* - Converts ISO-8601 datetime strings to JS Date objects
*/
readonly parseClientResponse: <MarshalledCmdOutput extends SomeMarshalledCommandOutput>(clientResponse: MarshalledCmdOutput, unmarshallOptions?: MarshallingConfigs["unmarshallOptions"]) => ToUnmarshalledSdkOutput<MarshalledCmdOutput>;
}
//# sourceMappingURL=DdbClientFieldParser.d.ts.map