Open gthau opened 8 months ago
Good point. You need to regenerated generated file however before commiting this. You should not edit generated file, but edit the files that are used as an output of generation
Good point. You need to regenerated generated file however before commiting this. You should not edit generated file, but edit the files that are used as an output of generation
Ohhh, I didn't see that it's a 2-level generation. I'll have a look at the source files that the libBuilder.ts file processes and bundles to create this generated.ts file.
I'm hitting a wall here.
From what I understand, the files under packages/graphql-zeus-core/TreeToTS/functions/new
are not generated but are actual source code files bundled by libBundler.ts
, along with files under packages/graphql-zeus-core/TreeToTS/functions/apiSubscription
, with a bit of processing to remove imports and such.
I'm not sure how to integrate the env
variable that's necessary to take the proper implementation of WebSocket (native in browser or from ws
package in node world).
Any more detailed instructions are welcome.
The file generated by Zeus is missing a few things when using both the
--n
(target Node) and--subscriptions graphql-ws
(subscriptions withgraphql-ws
lib instead of the legacy websocket client):Headers
type from@types/node-fetch
as the type definition is not compatible with the one from TS lib DOM (Headers in the browser).webSocketImpl
param must be passed to thecreateClient
function, as Node doesn't have an out-of-the-box implementation of WebSocket as the browsers doPoint 1 creates a
tsc
compile time error. Point 2 creates a runtimegraphql-ws
error.Open question: What to do with the
apiSubscription
function? I didn't know out to distinguish between the node or the browser for this function and how we could pass it a WebSocket implementation in the case of Node and graphql-ws.