Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a modular graphql server #56

Merged
merged 16 commits into from
Nov 2, 2023
Merged

Add a modular graphql server #56

merged 16 commits into from
Nov 2, 2023

Conversation

rpanic
Copy link
Member

@rpanic rpanic commented Oct 11, 2023

No description provided.

@rpanic rpanic requested a review from maht0rz October 25, 2023 13:33
packages/api/src/graphql/GraphqlModule.ts Show resolved Hide resolved
export function graphqlModule() {
return (
/**
* Check if the target class extends RuntimeModule, while
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuntimeModule -> GraphqlModule

import { GraphqlServer } from "./GraphqlServer";
import { SchemaGeneratingGraphqlModule } from "./GraphqlModule";

export type GraphqlModulesRecord = ModulesRecord<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be ModulesRecord<TypedClass<GraphqlModule<unknown>>>?

public async start(): Promise<void> {
assert(this.graphqlServer !== undefined);

this.graphqlServer.setContext(this.container);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setContext -> setContainer


const yoga = createYoga<Koa.ParameterizedContext>({
schema,
graphiql: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

things like this should be configurable from above

@@ -10,7 +10,8 @@
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./src/** ./test/**",
"test:watch": "npm run test:file -- ./src/** ./test/** --watch"
"test:watch": "npm run test:file -- ./src/** ./test/** --watch",
"graphql": "cd ../api && npm run build && cd ../sdk && npm run build && node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads --es-module-specifier-resolution=node ./dist/graphql.js"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a way to run this without building? like a watch/dev mode

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a testing leftover, should we move it to ./test or something?

private readonly mempool: Mempool;

public constructor(@inject("mempool") mempool: Mempool) {
public constructor(@inject("Mempool") mempool: Mempool) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe public mempool?

@@ -31,18 +31,11 @@
"@types/node": "^20.2.5"
},
"dependencies": {
"@types/ws": "^8.5.4",
"@types/koa": "^2.13.10",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be only a part of the api(-graphql) module?

export * from "./transaction/AppChainTransaction";
export * from "./transaction/InMemorySigner";
export * from "./transaction/InMemoryTransactionSender";
export * from "./transaction/AuroSigner";
export * from "./graphql";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be removed, assuming that file was just for testing purposes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be in later PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason this is there is bcs prior to using koa, fastify didnt start in a Jest environment, so I had to do this to test stuff

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the export though

@maht0rz maht0rz merged commit 52b50d0 into develop Nov 2, 2023
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants