Skip to content

Commit fa793f8

Browse files
committed
🐞 fix: type issues
1 parent dd030a5 commit fa793f8

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

β€Žbun.lockbβ€Ž

0 Bytes
Binary file not shown.

β€Žexample/src/main.tsβ€Ž

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,29 @@ export const db = drizzle(
3030
3131
*/
3232

33-
const { abilityBuilder, schemaBuilder, arg, object, query, pubsub, yoga } =
34-
rumble({
35-
// here we pass the db instance from above
36-
db,
37-
// this is how we can define a context callback
38-
// it takes a request object as an argument and returns the objects you want in the request context
39-
// similar to the context callback in express or similar frameworks
40-
// the type of the request parameter may vary based on the HTTP library you are using
41-
context(request) {
42-
return {
43-
// for our usecase we simply mock a user ID to be set in the context
44-
// this will allow us to perform permission checks based on who the user is
45-
userId: 2,
46-
};
47-
},
48-
});
33+
const {
34+
abilityBuilder,
35+
schemaBuilder,
36+
arg,
37+
object,
38+
query,
39+
pubsub,
40+
createYoga,
41+
} = rumble({
42+
// here we pass the db instance from above
43+
db,
44+
// this is how we can define a context callback
45+
// it takes a request object as an argument and returns the objects you want in the request context
46+
// similar to the context callback in express or similar frameworks
47+
// the type of the request parameter may vary based on the HTTP library you are using
48+
context(request) {
49+
return {
50+
// for our usecase we simply mock a user ID to be set in the context
51+
// this will allow us to perform permission checks based on who the user is
52+
userId: 2,
53+
};
54+
},
55+
});
4956

5057
/*
5158
@@ -304,7 +311,7 @@ schemaBuilder.mutationFields((t) => {
304311

305312
// when we are done defining the objects, queries and mutations,
306313
// we can start the server
307-
const server = createServer(yoga());
314+
const server = createServer(createYoga());
308315
server.listen(3000, () => {
309316
console.info("Visit http://localhost:3000/graphql");
310317
});

β€Žlib/rumble.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const rumble = <
9292
});
9393

9494
const createYoga = (
95-
args:
95+
args?:
9696
| Omit<YogaServerOptions<RequestEvent, any>, "schema" | "context">
9797
| undefined,
9898
) =>

β€Žtest/src/abilities.test.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe("test rumble abilities", async () => {
134134

135135
expect((r as any).data.findManyComments.length).toEqual(10);
136136
expect(
137-
(r as any).data.findManyComments.filter((u) => u.author).length,
137+
(r as any).data.findManyComments.filter((u: any) => u.author).length,
138138
).toEqual(0);
139139
});
140140

β€Žtest/src/rumble/baseInstance.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function makeRumbleSeedInstance(
6565
return {
6666
rumble: r,
6767
build: () => {
68-
const yogaInstance = r.yoga();
68+
const yogaInstance = r.createYoga();
6969
const executor = buildHTTPExecutor({
7070
fetch: yogaInstance.fetch,
7171
endpoint: "http://yoga/graphql",

0 commit comments

Comments
Β (0)