File tree Expand file tree Collapse file tree 6 files changed +63
-3
lines changed
federation-sdk/src/repositories Expand file tree Collapse file tree 6 files changed +63
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import type { StateMapKey } from '@hs/room';
1212import type { PersistentEventBase } from '@hs/room' ;
1313
1414export type StateStore = {
15+ _id : ObjectId ;
1516 delta : {
1617 identifier : StateMapKey ;
1718 eventId : string ;
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ import {
1111 GetMissingEventsBodyDto ,
1212 GetMissingEventsParamsDto ,
1313 GetMissingEventsResponseDto ,
14+ GetStateIdsParamsDto ,
15+ GetStateIdsQueryDto ,
16+ GetStateIdsResponseDto ,
17+ GetStateParamsDto ,
18+ GetStateQueryDto ,
19+ GetStateResponseDto ,
1420 MakeJoinParamsDto ,
1521 MakeJoinQueryDto ,
1622 MakeJoinResponseDto ,
@@ -76,7 +82,7 @@ export const profilesPlugin = (app: Elysia) => {
7682
7783 const { ver } = query ;
7884
79- return profilesService . makeJoin ( roomId , userId , ver ?? [ '1' ] ) as any ;
85+ return profilesService . makeJoin ( roomId , userId , ver ?? [ '1' ] ) ;
8086 } ,
8187 {
8288 params : MakeJoinParamsDto ,
Original file line number Diff line number Diff line change @@ -76,19 +76,26 @@ export const MakeJoinQueryDto = t.Object({
7676 ) ,
7777} ) ;
7878
79+ const MembershipDto = t . Union ( [
80+ t . Literal ( 'join' ) ,
81+ t . Literal ( 'leave' ) ,
82+ t . Literal ( 'invite' ) ,
83+ t . Literal ( 'ban' ) ,
84+ t . Literal ( 'knock' ) ,
85+ ] ) ;
86+
7987export const MakeJoinResponseDto = t . Object ( {
8088 room_version : t . String ( { description : 'Room version' } ) ,
8189 event : t . Object ( {
8290 content : t . Object ( {
83- membership : t . Literal ( 'join' ) ,
91+ membership : MembershipDto ,
8492 join_authorised_via_users_server : t . Optional ( t . String ( ) ) ,
8593 } ) ,
8694 room_id : RoomIdDto ,
8795 sender : UsernameDto ,
8896 state_key : UsernameDto ,
8997 type : t . Literal ( 'm.room.member' ) ,
9098 origin_server_ts : TimestampDto ,
91- origin : ServerNameDto ,
9299 depth : t . Optional (
93100 t . Number ( { description : 'Depth of the event in the DAG' } ) ,
94101 ) ,
Original file line number Diff line number Diff line change 1+ import { type Static , t } from 'elysia' ;
2+ import { RoomIdDto } from '../common/validation.dto' ;
3+
4+ export const GetStateIdsParamsDto = t . Object ( {
5+ roomId : RoomIdDto ,
6+ } ) ;
7+
8+ export const GetStateIdsQueryDto = t . Object ( {
9+ event_id : t . String ( { description : 'Event ID to get state at' } ) ,
10+ } ) ;
11+
12+ export const GetStateIdsResponseDto = t . Object ( {
13+ pdu_ids : t . Array ( t . String ( ) , { description : 'List of state event IDs' } ) ,
14+ auth_chain_ids : t . Array ( t . String ( ) , {
15+ description : 'List of auth chain event IDs' ,
16+ } ) ,
17+ } ) ;
18+
19+ export type GetStateIdsParams = Static < typeof GetStateIdsParamsDto > ;
20+ export type GetStateIdsQuery = Static < typeof GetStateIdsQueryDto > ;
21+ export type GetStateIdsResponse = Static < typeof GetStateIdsResponseDto > ;
Original file line number Diff line number Diff line change 1+ import { type Static , t } from 'elysia' ;
2+ import { RoomIdDto } from '../common/validation.dto' ;
3+
4+ export const GetStateParamsDto = t . Object ( {
5+ roomId : RoomIdDto ,
6+ } ) ;
7+
8+ export const GetStateQueryDto = t . Object ( {
9+ event_id : t . String ( { description : 'Event ID to get state at' } ) ,
10+ } ) ;
11+
12+ export const GetStateResponseDto = t . Object ( {
13+ pdus : t . Array ( t . Record ( t . String ( ) , t . Any ( ) ) , {
14+ description : 'List of state event objects' ,
15+ } ) ,
16+ auth_chain : t . Array ( t . Record ( t . String ( ) , t . Any ( ) ) , {
17+ description : 'List of auth chain event objects' ,
18+ } ) ,
19+ } ) ;
20+
21+ export type GetStateParams = Static < typeof GetStateParamsDto > ;
22+ export type GetStateQuery = Static < typeof GetStateQueryDto > ;
23+ export type GetStateResponse = Static < typeof GetStateResponseDto > ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ export * from './common/validation.dto';
77export * from './federation/invite.dto' ;
88export * from './federation/profiles.dto' ;
99export * from './federation/send-join.dto' ;
10+ export * from './federation/state-ids.dto' ;
11+ export * from './federation/state.dto' ;
1012export * from './federation/transactions.dto' ;
1113export * from './federation/versions.dto' ;
1214
You can’t perform that action at this time.
0 commit comments