Skip to content

Commit 65033a2

Browse files
committed
Removed the RunTimeZodType
1 parent dcc78d7 commit 65033a2

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

packages/batch/src/parser.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { ParsingError } from './errors.js';
55
import type {
66
BatchProcessorConfig,
77
EventSourceDataClassTypes,
8-
RuntimeZodType,
98
} from './types.js';
109

1110
/**
@@ -14,15 +13,17 @@ import type {
1413
* If `useTransformers` is true, extend using opinionated transformers.
1514
* Otherwise, extend without any transformers.
1615
*
16+
* The vendor is already checked at runtime to ensure Zod is being used when required using `StandardSchemaV1['~standard'].vendor`.
17+
*
1718
* @param options - The options for creating the extended schema
1819
* @param options.eventType - The type of event to process (SQS, Kinesis, DynamoDB)
19-
* @param options.schema - The StandardSchema to be used for parsing
20+
* @param options.innerSchema - The StandardSchema to be used for parsing. To avoid forcing a direct dependency on Zod, we use `unknown` here, which is not ideal but necessary.
2021
* @param options.useTransformers - Whether to use transformers for parsing
2122
* @param options.logger - A logger instance for logging
2223
*/
2324
const createExtendedSchema = async (options: {
2425
eventType: keyof typeof EventType;
25-
innerSchema: RuntimeZodType;
26+
innerSchema: unknown;
2627
transformer?: BatchProcessorConfig['transformer'];
2728
}) => {
2829
const { eventType, innerSchema, transformer } = options;
@@ -114,7 +115,8 @@ const parseWithErrorHandling = async (
114115
* If the passed schema is already an extended schema,
115116
* use the schema directly to parse the record.
116117
*
117-
* Only Zod Schemas are supported for schema extension.
118+
* Parts of the parser integration within BatchProcessor rely on Zod for schema transformations,
119+
* however some other parts also support other Standard Schema-compatible libraries.
118120
*
119121
* @param record - The record to be parsed
120122
* @param eventType - The type of event to process

packages/batch/src/types.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,6 @@ type ParsedRecord<TRecord, TPayload, TOldPayload = TPayload> = TRecord extends {
242242
}
243243
: TRecord;
244244

245-
/**
246-
* Type representing a Zod schema at runtime.
247-
*
248-
* Parts of the parser integration within BatchProcessor rely on Zod for schema transformations,
249-
* however some other parts also support other Standard Schema-compatible libraries.
250-
*
251-
* To avoid forcing a direct dependency on Zod, we use `unknown` here, which is not ideal but necessary.
252-
*
253-
* The vendor is checked at runtime to ensure Zod is being used when required using `StandardSchemaV1['~standard'].vendor`.
254-
*/
255-
type RuntimeZodType = unknown;
256-
257245
export type {
258246
BatchProcessingOptions,
259247
BaseRecord,
@@ -264,5 +252,4 @@ export type {
264252
PartialItemFailureResponse,
265253
BatchProcessorConfig,
266254
ParsedRecord,
267-
RuntimeZodType,
268255
};

0 commit comments

Comments
 (0)