-
Notifications
You must be signed in to change notification settings - Fork 180
Description
Use case
There's no named type for values parsed by DynamoDBStreamRecord (the schema) 1:
const DynamoDBStreamRecord = z.object({...
Conversely, there is a named type for the overall Stream (Event) 2:
type DynamoDBStreamEvent = z.infer<typeof DynamoDBStreamSchema>;While the documentation encourages overriding the schemas 3, in our app we want to defer this and therefore pass values conforming to the original "raw" or "base" DynamoDBStreamRecord schema. Hence wanting to import a type for values parsed by the schema.
Although this is just a one-liner, it would be nice not to have to write it in our app.
Solution/User Experience
Add the following in packages/parser/src/types/schema.ts:
import { DynamoDBStreamRecord as DynamoDBStreamRecordSchema } from '../schemas/index.js'
...
type DynamoDBStreamRecord = z.infer<typeof DynamoDBStreamRecordSchema>;
Alternative solutions
Acknowledgment
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Footnotes
-
https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/parser/src/schemas/dynamodb.ts ↩
-
https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/parser/src/types/schema.ts#L104 ↩
-
https://docs.aws.amazon.com/powertools/typescript/latest/features/parser/#dynamodb-stream-event-parsing ↩
Metadata
Metadata
Assignees
Labels
Type
Projects
Status