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 @@ -1,6 +1,6 @@ // @flow -import t, { type TInterface } from 'tcomb'; +import t, { type TInterface, type TUnion } from 'tcomb'; import { tID, tNumber, tShape } from '../../utils/validation-utils.js'; import { messageTypes } from '../message-types-enum.js'; @@ -41,21 +41,36 @@ id: string, }; -export const rawUpdateRelationshipMessageInfoValidator: TInterface = +export const rawUpdateTraditionalRelationshipMessageInfoValidator: TInterface = tShape({ + id: tID, type: tNumber(messageTypes.UPDATE_RELATIONSHIP), threadID: tID, creatorID: t.String, targetID: t.String, time: t.Number, - operation: t.enums.of([ - 'request_sent', - 'request_accepted', - 'farcaster_mutual', - ]), + operation: t.enums.of(['request_sent', 'request_accepted']), + }); + +export const rawUpdateFarcasterRelationshipMessageInfoValidator: TInterface = + tShape({ id: tID, + type: tNumber(messageTypes.UPDATE_RELATIONSHIP), + threadID: tID, + creatorID: t.String, + creatorFID: t.String, + targetID: t.String, + targetFID: t.String, + time: t.Number, + operation: t.enums.of(['farcaster_mutual']), }); +export const rawUpdateRelationshipMessageInfoValidator: TUnion = + t.union([ + rawUpdateTraditionalRelationshipMessageInfoValidator, + rawUpdateFarcasterRelationshipMessageInfoValidator, + ]); + export type UpdateRelationshipMessageInfo = { +type: 22, +id: string,