Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3368712
D9266.id31365.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D9266.id31365.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 8:44 PM (18 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2586160
Default Alt Text
D9266.id31365.diff (6 KB)
Attached To
Mode
D9266: [lib/keyserver] Make Info generic mandatory in state sync specs
Attached
Detach File
Event Timeline
Log In to Comment