Designing Typed Cross-Boundary Result Types for AWS Lambdas with Amplify Gen 2 and Effect

I'm trying to design typed cross‑boundary result types for aws lambdas via Amplify Gen 2 + Effect. Thats a mouthful but ill explain:

I have an auto-generated client for a framework im using that acts as an interface to aws lambdas. It has its own dsl for defining the schema of lambda function input and outputs. you get type safety in the lammbda and in the client which is nice but you have to translate these return types back and forth into effect-land. and theres no set way for returning failures so everything comes out hodge-podge.

has anyone come up with a good pattern for this? I would really love an api that looks like

defineLambda({
  handler: (input)=> Effect.exit
})

but the problem is the generated client is going to be typed to return whatever was defined in their own schema dsl where theres not a great way to enforce shemas conform to Effect.exit or whatever.
Was this page helpful?