sam-goodwin / punchcard

Type-safe AWS infrastructure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

de-couple types from mappers in Stream and Queue

sam-goodwin opened this issue · comments

commented

It's better to avoid specifying mappers wherever possible. SNS is a good example of this:

export type TopicProps<T> = {
type: Type<T>;
} & sns.TopicProps;

as opposed to Queue:

export interface QueueProps<T> extends sqs.QueueProps {
mapper: Mapper<T, string>;
}

Would rather do something like:

// default to JSON
new Queue(scope, id, {
  type: string()
});

// explicitly define codec along-side the type
new Queue(scope, id, {
  type: string(),
  codec: Codec.Avro
});