Page MenuHomePhabricator

D9266.diff
No OneTemporary

D9266.diff

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>,
+ RawEntryInfo,
> = Object.freeze({
async fetch(viewer: Viewer, ids?: $ReadOnlySet<string>) {
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<Infos, FullSocketSyncPayload, Info = empty> = {
+export type ServerStateSyncSpec<Infos, FullSocketSyncPayload, Info> = {
+fetch: (viewer: Viewer, ids?: $ReadOnlySet<string>) => Promise<Infos>,
+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<string>) {
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<CurrentUserInfo> =
- 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<RawEntryInfos> = Object.freeze(
- {
+export const entriesStateSyncSpec: StateSyncSpec<RawEntryInfos, RawEntryInfo> =
+ 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<Infos, Info = empty> = {
+export type StateSyncSpec<Infos, Info> = {
+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<any>,
+ +[string]: StateSyncSpec<any, any>,
});
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<RawThreadInfos> =
- 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,
+ );
+ },
+});

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 7, 5:51 PM (21 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2255713
Default Alt Text
D9266.diff (6 KB)

Event Timeline