Changeset View
Changeset View
Standalone View
Standalone View
lib/types/message-types.js
Show First 20 Lines • Show All 582 Lines • ▼ Show 20 Lines | export type FetchMessageInfosPayload = { | ||||
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | +rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | ||||
+truncationStatus: MessageTruncationStatus, | +truncationStatus: MessageTruncationStatus, | ||||
}; | }; | ||||
export type MessagesResponse = { | export type MessagesResponse = { | ||||
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | +rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | ||||
+truncationStatuses: MessageTruncationStatuses, | +truncationStatuses: MessageTruncationStatuses, | ||||
+currentAsOf: number, | +currentAsOf: number, | ||||
}; | }; | ||||
export const messagesResponseValidator: TInterface<MessagesResponse> = | |||||
tShape<MessagesResponse>({ | |||||
rawMessageInfos: t.list(rawMessageInfoValidator), | |||||
truncationStatuses: messageTruncationStatusesValidator, | |||||
currentAsOf: t.Number, | |||||
}); | |||||
export type SimpleMessagesPayload = { | export type SimpleMessagesPayload = { | ||||
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | +rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | ||||
+truncationStatuses: MessageTruncationStatuses, | +truncationStatuses: MessageTruncationStatuses, | ||||
}; | }; | ||||
export const defaultNumberPerThread = 20; | export const defaultNumberPerThread = 20; | ||||
export const defaultMaxMessageAge = 14 * 24 * 60 * 60 * 1000; // 2 weeks | export const defaultMaxMessageAge = 14 * 24 * 60 * 60 * 1000; // 2 weeks | ||||
export type SendMessageResponse = { | export type SendMessageResponse = { | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
export type SaveMessagesPayload = { | export type SaveMessagesPayload = { | ||||
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | +rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, | ||||
+updatesCurrentAsOf: number, | +updatesCurrentAsOf: number, | ||||
}; | }; | ||||
export type NewMessagesPayload = { | export type NewMessagesPayload = { | ||||
+messagesResult: MessagesResponse, | +messagesResult: MessagesResponse, | ||||
}; | }; | ||||
export const newMessagesPayloadValidator: TInterface<NewMessagesPayload> = | |||||
tShape<NewMessagesPayload>({ | |||||
messagesResult: messagesResponseValidator, | |||||
}); | |||||
export type MessageStorePrunePayload = { | export type MessageStorePrunePayload = { | ||||
+threadIDs: $ReadOnlyArray<string>, | +threadIDs: $ReadOnlyArray<string>, | ||||
}; | }; | ||||
export type FetchPinnedMessagesRequest = { | export type FetchPinnedMessagesRequest = { | ||||
+threadID: string, | +threadID: string, | ||||
}; | }; | ||||
export type FetchPinnedMessagesResult = { | export type FetchPinnedMessagesResult = { | ||||
+pinnedMessages: $ReadOnlyArray<RawMessageInfo>, | +pinnedMessages: $ReadOnlyArray<RawMessageInfo>, | ||||
}; | }; |