Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393852
D11642.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11642.diff
View Options
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,8 +1,8 @@
// @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 { tID, tNumber, tShape, tString } from '../../utils/validation-utils.js';
import { messageTypes } from '../message-types-enum.js';
import type { RelativeUserInfo } from '../user-types.js';
@@ -41,21 +41,36 @@
id: string,
};
-export const rawUpdateRelationshipMessageInfoValidator: TInterface<RawUpdateRelationshipMessageInfo> =
+export const rawUpdateTraditionalRelationshipMessageInfoValidator: TInterface<RawUpdateRelationshipMessageInfo> =
tShape<RawUpdateRelationshipMessageInfo>({
+ 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<RawUpdateRelationshipMessageInfo> =
+ tShape<RawUpdateRelationshipMessageInfo>({
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: tString('farcaster_mutual'),
});
+export const rawUpdateRelationshipMessageInfoValidator: TUnion<RawUpdateRelationshipMessageInfo> =
+ t.union([
+ rawUpdateTraditionalRelationshipMessageInfoValidator,
+ rawUpdateFarcasterRelationshipMessageInfoValidator,
+ ]);
+
export type UpdateRelationshipMessageInfo = {
+type: 22,
+id: string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 4:15 PM (19 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605505
Default Alt Text
D11642.diff (1 KB)
Attached To
Mode
D11642: [lib] Split `rawUpdateRelationshipMessageInfoValidator` into `rawUpdate[Traditional/Farcaster]RelationshipMessageInfoValidator`
Attached
Detach File
Event Timeline
Log In to Comment