diff --git a/lib/shared/updates/update-spec.js b/lib/shared/updates/update-spec.js index a6fcd38b0..8118bf8e1 100644 --- a/lib/shared/updates/update-spec.js +++ b/lib/shared/updates/update-spec.js @@ -1,103 +1,103 @@ // @flow import type { TType } from 'tcomb'; import type { ThreadStoreOperation } from '../../ops/thread-store-ops.js'; import type { UserStoreOperation } from '../../ops/user-store-ops.js'; import type { FetchEntryInfosBase, RawEntryInfo, RawEntryInfos, } from '../../types/entry-types.js'; import type { RawMessageInfo, MessageTruncationStatuses, FetchMessageInfosResult, } from '../../types/message-types.js'; import type { RawThreadInfos } from '../../types/thread-types.js'; import type { UpdateType } from '../../types/update-types-enum.js'; import type { ClientUpdateInfo, RawUpdateInfo, UpdateData, } from '../../types/update-types.js'; import type { CurrentUserInfo, LoggedInUserInfo, UserInfos, } from '../../types/user-types.js'; export type UpdateInfosRawData = { +threadInfos: RawThreadInfos, +messageInfosResult: ?FetchMessageInfosResult, +calendarResult: ?FetchEntryInfosBase, +entryInfosResult: ?RawEntryInfos, - +currentUserInfoResult: LoggedInUserInfo, + +currentUserInfoResult: ?LoggedInUserInfo, +userInfosResult: ?UserInfos, }; export type UpdateInfoFromRawInfoParams = { +data: UpdateInfosRawData, +rawEntryInfosByThreadID: { +[id: string]: $ReadOnlyArray, }, +rawMessageInfosByThreadID: { +[id: string]: $ReadOnlyArray, }, }; export type UpdateTypes = 'all_types' | $ReadOnlySet; export type UpdateSpec< UpdateInfo: ClientUpdateInfo, RawInfo: RawUpdateInfo, Data: UpdateData, > = { +generateOpsForThreadUpdates?: ( storeThreadInfos: RawThreadInfos, update: UpdateInfo, ) => ?$ReadOnlyArray, +mergeEntryInfos?: ( entryIDs: Set, mergedEntryInfos: Array, update: UpdateInfo, ) => void, +reduceCurrentUser?: ( state: ?CurrentUserInfo, update: UpdateInfo, ) => ?CurrentUserInfo, +reduceUserInfos?: (state: UserInfos, update: UpdateInfo) => UserInfos, +reduceCalendarThreadFilters?: ( filteredThreadIDs: $ReadOnlySet, update: UpdateInfo, ) => $ReadOnlySet, +getRawMessageInfos?: (update: UpdateInfo) => $ReadOnlyArray, +mergeMessageInfosAndTruncationStatuses?: ( messageIDs: Set, messageInfos: Array, truncationStatuses: MessageTruncationStatuses, update: UpdateInfo, ) => void, +rawUpdateInfoFromRow: (row: Object) => RawInfo, +updateContentForServerDB: (data: Data) => ?string, +entitiesToFetch?: (update: RawInfo) => { +threadID?: string, +detailedThreadID?: string, +entryID?: string, +currentUser?: boolean, +userID?: string, }, +rawInfoFromData: (data: Data, id: string) => RawInfo, +updateInfoFromRawInfo: ( info: RawInfo, params: UpdateInfoFromRawInfoParams, ) => ?UpdateInfo, +deleteCondition: ?UpdateTypes, +keyForUpdateData?: (data: Data) => string, +keyForUpdateInfo?: (info: UpdateInfo) => string, +typesOfReplacedUpdatesForMatchingKey: ?UpdateTypes, +infoValidator: TType, +generateOpsForUserInfoUpdates?: ( update: UpdateInfo, ) => ?$ReadOnlyArray, };