diff --git a/lib/types/dm-ops.js b/lib/types/dm-ops.js --- a/lib/types/dm-ops.js +++ b/lib/types/dm-ops.js @@ -5,6 +5,7 @@ import { clientAvatarValidator, type ClientAvatar } from './avatar-types.js'; import { type Media, mediaValidator } from './media-types.js'; import type { RawMessageInfo } from './message-types.js'; +import type { RelationshipOperation } from './messages/update-relationship.js'; import type { NotificationsCreationData } from './notif-types.js'; import type { OutboundP2PMessage } from './sqlite-types.js'; import { @@ -43,6 +44,7 @@ CREATE_ENTRY: 'create_entry', DELETE_ENTRY: 'delete_entry', EDIT_ENTRY: 'edit_entry', + UPDATE_RELATIONSHIP: 'update_relationship', }); export type DMOperationType = $Values; @@ -448,6 +450,29 @@ messageID: t.String, }); +export type DMUpdateRelationshipOperation = { + +type: 'update_relationship', + +threadID: string, + +creatorID: string, + +time: number, + +operation: RelationshipOperation, + +messageID: string, +}; + +export const dmUpdateRelationshipOperationValidator: TInterface = + tShape({ + type: tString(dmOperationTypes.UPDATE_RELATIONSHIP), + threadID: t.String, + creatorID: t.String, + time: t.Number, + operation: t.enums.of([ + 'request_sent', + 'request_accepted', + 'farcaster_mutual', + ]), + messageID: t.String, + }); + export type DMOperation = | DMCreateThreadOperation | DMCreateSidebarOperation @@ -465,7 +490,8 @@ | DMChangeThreadReadStatusOperation | DMCreateEntryOperation | DMDeleteEntryOperation - | DMEditEntryOperation; + | DMEditEntryOperation + | DMUpdateRelationshipOperation; export const dmOperationValidator: TUnion = t.union([ dmCreateThreadOperationValidator, dmCreateSidebarOperationValidator, @@ -484,6 +510,7 @@ dmCreateEntryOperationValidator, dmDeleteEntryOperationValidator, dmEditEntryOperationValidator, + dmUpdateRelationshipOperationValidator, ]); export type DMOperationResult = { diff --git a/lib/types/messages/update-relationship.js b/lib/types/messages/update-relationship.js --- a/lib/types/messages/update-relationship.js +++ b/lib/types/messages/update-relationship.js @@ -18,6 +18,10 @@ export type FarcasterRelationshipOperation = 'farcaster_mutual'; +export type RelationshipOperation = + | TraditionalRelationshipOperation + | FarcasterRelationshipOperation; + export type UpdateTraditionalRelationshipMessageData = { +type: 22, +threadID: string,