diff --git a/keyserver/src/shared/state-sync/current-user-state-sync-spec.js b/keyserver/src/shared/state-sync/current-user-state-sync-spec.js --- a/keyserver/src/shared/state-sync/current-user-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/current-user-state-sync-spec.js @@ -10,6 +10,7 @@ export const currentUserStateSyncSpec: ServerStateSyncSpec< CurrentUserInfo, CurrentUserInfo, + CurrentUserInfo, > = Object.freeze({ fetch(viewer: Viewer) { return fetchCurrentUserInfo(viewer); diff --git a/keyserver/src/shared/state-sync/entries-state-sync-spec.js b/keyserver/src/shared/state-sync/entries-state-sync-spec.js --- a/keyserver/src/shared/state-sync/entries-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/entries-state-sync-spec.js @@ -18,6 +18,7 @@ export const entriesStateSyncSpec: ServerStateSyncSpec< RawEntryInfos, $ReadOnlyArray, + RawEntryInfo, > = Object.freeze({ async fetch(viewer: Viewer, ids?: $ReadOnlySet) { if (ids) { diff --git a/keyserver/src/shared/state-sync/state-sync-spec.js b/keyserver/src/shared/state-sync/state-sync-spec.js --- a/keyserver/src/shared/state-sync/state-sync-spec.js +++ b/keyserver/src/shared/state-sync/state-sync-spec.js @@ -5,7 +5,7 @@ import type { Viewer } from '../../session/viewer.js'; -export type ServerStateSyncSpec = { +export type ServerStateSyncSpec = { +fetch: (viewer: Viewer, ids?: $ReadOnlySet) => Promise, +fetchFullSocketSyncPayload: ( viewer: Viewer, diff --git a/keyserver/src/shared/state-sync/threads-state-sync-spec.js b/keyserver/src/shared/state-sync/threads-state-sync-spec.js --- a/keyserver/src/shared/state-sync/threads-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/threads-state-sync-spec.js @@ -1,7 +1,10 @@ // @flow import { threadsStateSyncSpec as libSpec } from 'lib/shared/state-sync/threads-state-sync-spec.js'; -import type { RawThreadInfos } from 'lib/types/thread-types.js'; +import { + type RawThreadInfos, + type RawThreadInfo, +} from 'lib/types/thread-types.js'; import type { ServerStateSyncSpec } from './state-sync-spec.js'; import { fetchThreadInfos } from '../../fetchers/thread-fetchers.js'; @@ -10,6 +13,7 @@ export const threadsStateSyncSpec: ServerStateSyncSpec< RawThreadInfos, RawThreadInfos, + RawThreadInfo, > = Object.freeze({ async fetch(viewer: Viewer, ids?: $ReadOnlySet) { const filter = ids ? { threadIDs: ids } : undefined; diff --git a/lib/shared/state-sync/current-user-state-sync-spec.js b/lib/shared/state-sync/current-user-state-sync-spec.js --- a/lib/shared/state-sync/current-user-state-sync-spec.js +++ b/lib/shared/state-sync/current-user-state-sync-spec.js @@ -8,14 +8,16 @@ import { convertClientIDsToServerIDs } from '../../utils/conversion-utils.js'; import { ashoatKeyserverID } from '../../utils/validation-utils.js'; -export const currentUserStateSyncSpec: StateSyncSpec = - Object.freeze({ - hashKey: 'currentUserInfo', - convertClientToServerInfos(info: CurrentUserInfo) { - return convertClientIDsToServerIDs( - ashoatKeyserverID, - currentUserInfoValidator, - info, - ); - }, - }); +export const currentUserStateSyncSpec: StateSyncSpec< + CurrentUserInfo, + CurrentUserInfo, +> = Object.freeze({ + hashKey: 'currentUserInfo', + convertClientToServerInfos(info: CurrentUserInfo) { + return convertClientIDsToServerIDs( + ashoatKeyserverID, + currentUserInfoValidator, + info, + ); + }, +}); diff --git a/lib/shared/state-sync/entries-state-sync-spec.js b/lib/shared/state-sync/entries-state-sync-spec.js --- a/lib/shared/state-sync/entries-state-sync-spec.js +++ b/lib/shared/state-sync/entries-state-sync-spec.js @@ -7,6 +7,7 @@ type CalendarQuery, type RawEntryInfos, rawEntryInfoValidator, + type RawEntryInfo, } from '../../types/entry-types.js'; import { convertClientIDsToServerIDs } from '../../utils/conversion-utils.js'; import { values } from '../../utils/objects.js'; @@ -16,8 +17,8 @@ serverEntryInfosObject, } from '../entry-utils.js'; -export const entriesStateSyncSpec: StateSyncSpec = Object.freeze( - { +export const entriesStateSyncSpec: StateSyncSpec = + Object.freeze({ hashKey: 'entryInfos', innerHashSpec: { hashKey: 'entryInfo', @@ -39,5 +40,4 @@ filteredEntryInfos, ); }, - }, -); + }); diff --git a/lib/shared/state-sync/state-sync-spec.js b/lib/shared/state-sync/state-sync-spec.js --- a/lib/shared/state-sync/state-sync-spec.js +++ b/lib/shared/state-sync/state-sync-spec.js @@ -2,7 +2,7 @@ import type { CalendarQuery } from '../../types/entry-types.js'; -export type StateSyncSpec = { +export type StateSyncSpec = { +hashKey: string, +innerHashSpec?: { +hashKey: string, diff --git a/lib/shared/state-sync/state-sync-specs.js b/lib/shared/state-sync/state-sync-specs.js --- a/lib/shared/state-sync/state-sync-specs.js +++ b/lib/shared/state-sync/state-sync-specs.js @@ -14,5 +14,5 @@ }); (stateSyncSpecs: { - +[string]: StateSyncSpec, + +[string]: StateSyncSpec, }); diff --git a/lib/shared/state-sync/threads-state-sync-spec.js b/lib/shared/state-sync/threads-state-sync-spec.js --- a/lib/shared/state-sync/threads-state-sync-spec.js +++ b/lib/shared/state-sync/threads-state-sync-spec.js @@ -5,24 +5,27 @@ import type { StateSyncSpec } from './state-sync-spec.js'; import { type RawThreadInfos, + type RawThreadInfo, rawThreadInfoValidator, } from '../../types/thread-types.js'; import { convertClientIDsToServerIDs } from '../../utils/conversion-utils.js'; import { ashoatKeyserverID, tID } from '../../utils/validation-utils.js'; -export const threadsStateSyncSpec: StateSyncSpec = - Object.freeze({ - hashKey: 'threadInfos', - innerHashSpec: { - hashKey: 'threadInfo', - deleteKey: 'deleteThreadIDs', - rawInfosKey: 'rawThreadInfos', - }, - convertClientToServerInfos(infos: RawThreadInfos) { - return convertClientIDsToServerIDs( - ashoatKeyserverID, - t.dict(tID, rawThreadInfoValidator), - infos, - ); - }, - }); +export const threadsStateSyncSpec: StateSyncSpec< + RawThreadInfos, + RawThreadInfo, +> = Object.freeze({ + hashKey: 'threadInfos', + innerHashSpec: { + hashKey: 'threadInfo', + deleteKey: 'deleteThreadIDs', + rawInfosKey: 'rawThreadInfos', + }, + convertClientToServerInfos(infos: RawThreadInfos) { + return convertClientIDsToServerIDs( + ashoatKeyserverID, + t.dict(tID, rawThreadInfoValidator), + infos, + ); + }, +});