Skip to content

Commit 751214e

Browse files
committed
fixed merge conflicts and added increased test coverage
2 parents 010d06b + 1a37d87 commit 751214e

File tree

4 files changed

+207
-298
lines changed

4 files changed

+207
-298
lines changed

packages/batch/src/BasePartialBatchProcessor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from './constants.js';
1414
import { FullBatchFailureError } from './errors.js';
1515
import type {
16-
BasePartialBatchProcessorParserConfig,
16+
BatchProcessorConfig,
1717
EventSourceDataClassTypes,
1818
PartialItemFailureResponse,
1919
PartialItemFailures,
@@ -55,7 +55,7 @@ abstract class BasePartialBatchProcessor extends BasePartialProcessor {
5555
/**
5656
* The configuration options for the parser integration
5757
*/
58-
protected parserConfig?: BasePartialBatchProcessorParserConfig;
58+
protected parserConfig?: BatchProcessorConfig;
5959

6060
/**
6161
* Initializes base batch processing class
@@ -64,7 +64,7 @@ abstract class BasePartialBatchProcessor extends BasePartialProcessor {
6464
*/
6565
public constructor(
6666
eventType: keyof typeof EventType,
67-
parserConfig?: BasePartialBatchProcessorParserConfig
67+
parserConfig?: BatchProcessorConfig
6868
) {
6969
super();
7070
this.eventType = eventType;

packages/batch/src/parser.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { StandardSchemaV1 } from '@standard-schema/spec';
33
import { EventType, SchemaVendor } from './constants.js';
44
import { ParsingError } from './errors.js';
55
import type {
6-
BasePartialBatchProcessorParserConfig,
6+
BatchProcessorConfig,
77
EventSourceDataClassTypes,
88
RuntimeZodType,
99
} from './types.js';
@@ -19,7 +19,7 @@ const isZodSchema = (schema: StandardSchemaV1): schema is RuntimeZodType =>
1919
/**
2020
* Extend the schema according to the event type passed.
2121
*
22-
* If useTransformers is true, extend using opinionated transformers.
22+
* If `useTransformers` is true, extend using opinionated transformers.
2323
* Otherwise, extend without any transformers.
2424
*
2525
* @param options - The options for creating the extended schema
@@ -31,7 +31,7 @@ const isZodSchema = (schema: StandardSchemaV1): schema is RuntimeZodType =>
3131
const createExtendedSchema = async (options: {
3232
eventType: keyof typeof EventType;
3333
innerSchema: RuntimeZodType;
34-
transformer?: BasePartialBatchProcessorParserConfig['transformer'];
34+
transformer?: BatchProcessorConfig['transformer'];
3535
}) => {
3636
const { eventType, innerSchema, transformer } = options;
3737
let schema = innerSchema;
@@ -109,7 +109,7 @@ const parseWithErrorHandling = async (
109109
const errorMessage = issues
110110
.map((issue) => `${issue.path?.join('.')}: ${issue.message}`)
111111
.join('; ');
112-
logger.debug(errorMessage);
112+
logger.debug(`Failed to parse record: ${errorMessage}`);
113113
throw new ParsingError(errorMessage);
114114
};
115115

@@ -130,7 +130,7 @@ const parser = async (
130130
record: EventSourceDataClassTypes,
131131
eventType: keyof typeof EventType,
132132
logger: Pick<GenericLogger, 'debug' | 'warn' | 'error'>,
133-
parserConfig: BasePartialBatchProcessorParserConfig
133+
parserConfig: BatchProcessorConfig
134134
): Promise<EventSourceDataClassTypes> => {
135135
const { schema, innerSchema, transformer } = parserConfig;
136136
// If the external schema is specified, use it to parse the record

packages/batch/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type PartialItemFailureResponse = { batchItemFailures: PartialItemFailures[] };
118118
* @property transformer - Payload transformer (only available with innerSchema)
119119
* @property logger - Optional logger for debug/warning messages
120120
*/
121-
type BasePartialBatchProcessorParserConfig =
121+
type BatchProcessorConfig =
122122
| {
123123
/**
124124
* Required when using schema parsing - import from `@aws-lambda-powertools/batch/parser`
@@ -264,7 +264,7 @@ export type {
264264
FailureResponse,
265265
PartialItemFailures,
266266
PartialItemFailureResponse,
267-
BasePartialBatchProcessorParserConfig,
267+
BatchProcessorConfig,
268268
ParsedRecord,
269269
RuntimeZodType,
270270
};

0 commit comments

Comments
 (0)