Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ export abstract class DynamoDBDocumentClientCommand<

public abstract middlewareStack: MiddlewareStack<Input | BaseInput, Output | BaseOutput>;

private static defaultLogFilterOverrides = {
overrideInputFilterSensitiveLog(...args: any[]) {},
overrideOutputFilterSensitiveLog(...args: any[]) {},
};

protected addMarshallingMiddleware(configuration: DynamoDBDocumentClientResolvedConfig): void {
const { marshallOptions = {}, unmarshallOptions = {} } = configuration.translateConfig || {};

Expand All @@ -54,13 +49,6 @@ export abstract class DynamoDBDocumentClientCommand<
): Promise<InitializeHandlerOutput<Output | BaseOutput>> => {
setFeature(context, "DDB_MAPPER", "d");
args.input = marshallInput(args.input, this.inputKeyNodes, marshallOptions);
context.dynamoDbDocumentClientOptions =
context.dynamoDbDocumentClientOptions || DynamoDBDocumentClientCommand.defaultLogFilterOverrides;

const input = args.input;
context.dynamoDbDocumentClientOptions.overrideInputFilterSensitiveLog = () => {
return context.inputFilterSensitiveLog?.(input);
};
return next(args);
},
{
Expand All @@ -76,21 +64,6 @@ export abstract class DynamoDBDocumentClientCommand<
args: DeserializeHandlerArguments<Input | BaseInput>
): Promise<DeserializeHandlerOutput<Output | BaseOutput>> => {
const deserialized = await next(args);

/**
* The original filter function is based on the shape of the
* base DynamoDB type, whereas the returned output will be
* unmarshalled. Therefore the filter log needs to be modified
* to act on the original output structure.
*/
const output = deserialized.output;
context.dynamoDbDocumentClientOptions =
context.dynamoDbDocumentClientOptions || DynamoDBDocumentClientCommand.defaultLogFilterOverrides;

context.dynamoDbDocumentClientOptions.overrideOutputFilterSensitiveLog = () => {
return context.outputFilterSensitiveLog?.(output);
};

deserialized.output = unmarshallOutput(deserialized.output, this.outputKeyNodes, unmarshallOptions);
return deserialized;
},
Expand Down
Loading