-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Ws poc #11293
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
Ws poc #11293
Conversation
closing for now to keep the history of PR clean, let's re-open it once ready |
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.
Great work!! Looks really promising ❤️
@@ -9,7 +9,7 @@ const globalCoverage = { | |||
|
|||
const modulesCoverage = { | |||
branches: 25, | |||
statements: 44, | |||
statements: 43, |
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.
you are allowed this time because of the masterpiece!
const tokenPair = getTokenPair(); | ||
|
||
const sseClient = useMemo(() => { | ||
return createClient({ |
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.
interesting, isn't there an apollo native integration?
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.
Nope, not for sse
@@ -81,6 +83,8 @@ import { FileModule } from './file/file.module'; | |||
RoleModule, | |||
TwentyConfigModule, | |||
RedisClientModule, | |||
WorkspaceQueryRunnerModule, |
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 this needed?
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.
Yes, it is needed so that databaseEventListener works also on the worker. Without that import, records created by a workflow action won't trigger webhooks for example
I have created a ticket to improve dbEventListener management -> twentyhq/core-team-issues#753
updatedFields: string[]; | ||
diff: object; | ||
}) { | ||
const workspaceId = this.scopedWorkspaceContextFactory.create().workspaceId; |
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 this the regular syntax?
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.
It exists elsewhere, but
const { workspaceId, workspaceMetadataVersion, userWorkspaceId } = this.scopedWorkspaceContextFactory.create();
also exists
|
||
@Resolver() | ||
@UseGuards(WorkspaceAuthGuard, UserAuthGuard) | ||
export class SubscriptionsResolver { |
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.
what schema is this resolver part of?
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.
/graphql
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.
Bravo, added questions but non merge blocker, this is a POC :)
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.
LGTM, great job! 👏
related to twentyhq/core-team-issues#601
Done
onDbEvent
Subscription
graphql endpoint to listen to database_event using what we have done with webhooks:action
(created, updated, ...) for anyobjectNameSingular
or a specificrecordId
. Parameters are nullable and treated as wildcards when null.<ListenRecordUpdatesEffect />
that listen for anobjectNameSingular
, arecordId
and a list oflistenedFields
. It subscribes to record updates and updates its apollo cached value for specifiedlistenedFields
Result
Here is an application with
workflowRun
Enregistrement.de.l.ecran.2025-04-16.a.10.54.08.mov