Implement fetch adapter
This should allow using trpc-openapi with Next 13 and other serverless runtimes (eg Cloudflare Workers) (ref. #289).
I've created a sample project at https://github.com/markspolakovs/trpc-openapi-next-13-example.
Should be feature-complete and tested, only thing I'd appreciate thoughts on is an odd typing issue that might be an artifact of my setup - if I remove the as any on https://github.com/markspolakovs/trpc-openapi-next-13-example/blob/190b59da05c9f7ebeb2968aea0648d7f7c93e844/app/api/trpc/_router.ts#L19 I get an error:
Argument of type 'CreateRouterInner<RootConfig<{ ctx: {}; meta: OpenApiMeta; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { ...; }>' is not assignable to parameter of type 'OpenApiRouter'.
The types returned by 'createCaller(...)' are incompatible between these types.
Type 'DecoratedProcedureRecord<{ echo: BuildProcedure<"query", { _config: RootConfig<{ ctx: {}; meta: OpenApiMeta; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>; ... 5 more ...; _output_out: string; }, unknown>; }> & { ...; }' is not assignable to type '{ query: inferHandlerFn<any>; mutation: inferHandlerFn<any>; subscription: inferHandlerFn<any>; } & DecoratedProcedureRecord<any>'.
Type 'DecoratedProcedureRecord<{ echo: BuildProcedure<"query", { _config: RootConfig<{ ctx: {}; meta: OpenApiMeta; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>; ... 5 more ...; _output_out: string; }, unknown>; }> & { ...; }' is not assignable to type '{ query: inferHandlerFn<any>; mutation: inferHandlerFn<any>; subscription: inferHandlerFn<any>; }'.
Types of property 'query' are incompatible.
Type 'inferHandlerFn<{}>' is not assignable to type 'inferHandlerFn<any>'.
Types of parameters 'path' and 'path' are incompatible.
Type 'TPath' is not assignable to type 'never'.
Type 'string' is not assignable to type 'never'.ts(2345)
Oops, didn't see that #315 also implements this 😅 (though in my defence it hasn't had any activity in a month)
Thanks for your work @markspolakovs ! I tested your adapter and get the following error:
The edge runtime does not support Node.js 'stream' module.