[SSE] Add backend for SSE subscriptions (#17022)

- moved a few gql types to twenty shared to re-use in server
- added a new endpoint, onEventSubscription that expect a streamId to
create a connection
- two new endpoints to store queries in Redis
- updated the existing batch channel to directly use object record type
This commit is contained in:
Thomas Trompette
2026-01-10 15:44:02 +01:00
committed by GitHub
parent 87fb25c703
commit 3acc87a620
78 changed files with 567 additions and 111 deletions
@@ -1 +0,0 @@
export type RecordGqlFieldsDeprecated = Record<string, any>;
@@ -1,3 +0,0 @@
import { type RecordGqlFieldsDeprecated } from '@/object-record/graphql/types/RecordGqlFieldsDeprecated';
export type RecordGqlOperationGqlRecordFields = RecordGqlFieldsDeprecated;
@@ -1,5 +1,7 @@
import { type RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
import { type RecordGqlOperationFilter } from 'twenty-shared/types';
import {
type RecordGqlOperationFilter,
type RecordGqlOperationOrderBy,
} from 'twenty-shared/types';
export type RecordGqlOperationGroupByVariables = {
groupBy: Record<string, any>[] | Record<string, any>;
@@ -1,13 +0,0 @@
import { type OrderBy } from '@/types/OrderBy';
// Recursive type for nested orderBy values
// Supports: OrderBy | { field: OrderBy } | { field: { subField: OrderBy } } | ...
type OrderByValue = OrderBy | { [fieldName: string]: OrderByValue };
// Supports nested ordering for:
// - Scalar fields: { field: OrderBy }
// - Composite fields: { field: { subField: OrderBy } }
// - Relation + composite: { relation: { compositeLabel: { subField: OrderBy } } }
export type RecordGqlOperationOrderBy = Array<{
[fieldName: string]: OrderByValue;
}>;
@@ -1,8 +0,0 @@
import { type RecordGqlOperationGqlRecordFields } from '@/object-record/graphql/types/RecordGqlOperationGqlRecordFields';
import { type RecordGqlOperationVariables } from '@/object-record/graphql/types/RecordGqlOperationVariables';
export type RecordGqlOperationSignature = {
objectNameSingular: string;
variables: RecordGqlOperationVariables;
fields?: RecordGqlOperationGqlRecordFields;
};
@@ -1,4 +1,4 @@
import { type RecordGqlOperationSignature } from '@/object-record/graphql/types/RecordGqlOperationSignature';
import { type RecordGqlOperationSignature } from 'twenty-shared/types';
export type RecordGqlOperationSignatureFactory<FactoryParams extends object> = (
factoryParams: FactoryParams,
@@ -1,13 +0,0 @@
import { type RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
import { type QueryCursorDirection } from '@/object-record/utils/generateFindManyRecordsQuery';
import { type RecordGqlOperationFilter } from 'twenty-shared/types';
export type RecordGqlOperationVariables = {
filter?: RecordGqlOperationFilter;
orderBy?: RecordGqlOperationOrderBy;
limit?: number;
cursorFilter?: {
cursor: string;
cursorDirection: QueryCursorDirection;
};
};