-
Notifications
You must be signed in to change notification settings - Fork 14
feat: Add support for webhook #14
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
Conversation
| type GraphQLEventFields = { | ||
| type: string, | ||
| parents: (Record<string, any>)[] | null, | ||
| args: Record<string, any>, | ||
| authHeader?: AuthHeaderField | ||
| authHeader?: AuthHeaderField, | ||
| event?: eventPayload | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make this a different type. Instead of GraphQLEventFields, I'd make it GraphQLChangeEventFields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH, this is an input thing. Could you rethink these types in such a way that GraphQLEvent doesn't have .event please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/evaluate-script.ts
Outdated
| @@ -81,12 +91,15 @@ export function evaluateScript(source: string) { | |||
|
|
|||
| return async function(e: GraphQLEventFields): Promise<any | undefined> { | |||
| let retPromise: ResolverResponse | undefined = undefined; | |||
| const event = { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why this is not const? I don’t see where it is reassigned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my bad, fixed. thanks!
This PR enables support for webhook events coming from Dgraph. Check out this PR and the discuss post for more info.
Now using
self.addWebHookResolversone can add resolvers for webhook events.