Skip to content

Commit c2595e1

Browse files
committed
Created the type combinations for the parser config
1 parent 96e5b60 commit c2595e1

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

packages/batch/src/types.ts

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -99,32 +99,19 @@ type PartialItemFailureResponse = { batchItemFailures: PartialItemFailures[] };
9999
* @property transformer - The transformer to be used for parsing the payload
100100
* @property logger - The logger to be used for logging debug and warning messages.
101101
*/
102-
type BasePartialBatchProcessorParserConfig = {
103-
/**
104-
* The schema for the full event including the extended inner payload schema.
105-
*
106-
* StandardSchema is supported.
107-
*/
108-
schema?: StandardSchemaV1;
109-
/**
110-
* The schema for the inner payload of the event.
111-
* Only Zod schemas are supported.
112-
*/
113-
innerSchema?: StandardSchemaV1;
114-
/**
115-
* The transformer to be used for parsing the payload.
116-
* No transformers will be used if this is not provided.
117-
* Supported transformers are:
118-
* 1. 'json': Uses JSONStringified helper
119-
* 2. 'base64': Uses Base64Encoded helper
120-
* 3. 'unmarshall': Uses DynamoDBMarshalled helper
121-
*/
122-
transformer?: 'json' | 'base64' | 'unmarshall';
123-
/**
124-
* The logger to be used for logging debug and warning messages.
125-
*/
126-
logger?: Pick<GenericLogger, 'debug' | 'warn' | 'error'>;
127-
};
102+
type BasePartialBatchProcessorParserConfig =
103+
| {
104+
schema?: StandardSchemaV1;
105+
innerSchema?: never;
106+
transformer?: never;
107+
logger?: Pick<GenericLogger, 'debug' | 'warn' | 'error'>;
108+
}
109+
| {
110+
schema?: never;
111+
innerSchema?: StandardSchemaV1;
112+
transformer?: 'json' | 'base64' | 'unmarshall';
113+
logger?: Pick<GenericLogger, 'debug' | 'warn' | 'error'>;
114+
};
128115

129116
export type {
130117
BatchProcessingOptions,

0 commit comments

Comments
 (0)