Page MenuHomePhabricator

D11938.diff
No OneTemporary

D11938.diff

diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -11,6 +11,14 @@
import { inviteLinkValidator } from 'lib/types/link-types.js';
import { uploadMultimediaResultValidator } from 'lib/types/media-types.js';
import { getOlmSessionInitializationDataResponseValidator } from 'lib/types/request-types.js';
+import {
+ saveEntryResponseValidator,
+ deleteEntryResponseValidator,
+ fetchEntryInfosResponseValidator,
+ fetchEntryRevisionInfosResultValidator,
+ deltaEntryInfosResultValidator,
+ restoreEntryResponseValidator,
+} from 'lib/types/validators/entry-validators.js';
import { updateUserAvatarRequestValidator } from 'lib/utils/avatar-utils.js';
import {
@@ -32,17 +40,11 @@
entryRestorationResponder,
calendarQueryUpdateResponder,
createEntryRequestInputValidator,
- saveEntryResponseValidator,
deleteEntryRequestInputValidator,
- deleteEntryResponseValidator,
entryQueryInputValidator,
entryRevisionHistoryFetchInputValidator,
- fetchEntryInfosResponseValidator,
- fetchEntryRevisionInfosResultValidator,
- deltaEntryInfosResultValidator,
newEntryQueryInputValidator,
restoreEntryRequestInputValidator,
- restoreEntryResponseValidator,
saveEntryRequestInputValidator,
} from './responders/entry-responders.js';
import {
diff --git a/keyserver/src/responders/entry-responders.js b/keyserver/src/responders/entry-responders.js
--- a/keyserver/src/responders/entry-responders.js
+++ b/keyserver/src/responders/entry-responders.js
@@ -15,7 +15,6 @@
type FetchEntryInfosResponse,
type DeltaEntryInfosResult,
type SaveEntryResponse,
- rawEntryInfoValidator,
} from 'lib/types/entry-types.js';
import {
type CalendarFilter,
@@ -24,11 +23,7 @@
import {
type FetchEntryRevisionInfosResult,
type FetchEntryRevisionInfosRequest,
- historyRevisionInfoValidator,
} from 'lib/types/history-types.js';
-import { rawMessageInfoValidator } from 'lib/types/message-types.js';
-import { serverCreateUpdatesResponseValidator } from 'lib/types/update-types.js';
-import { accountUserInfoValidator } from 'lib/types/user-types.js';
import { ServerError } from 'lib/utils/errors.js';
import { tString, tShape, tDate, tID } from 'lib/utils/validation-utils.js';
@@ -128,12 +123,6 @@
}
}
-export const fetchEntryInfosResponseValidator: TInterface<FetchEntryInfosResponse> =
- tShape<FetchEntryInfosResponse>({
- rawEntryInfos: t.list(rawEntryInfoValidator),
- userInfos: t.dict(t.String, accountUserInfoValidator),
- });
-
async function entryFetchResponder(
viewer: Viewer,
inputQuery: EntryQueryInput,
@@ -154,11 +143,6 @@
id: tID,
});
-export const fetchEntryRevisionInfosResultValidator: TInterface<FetchEntryRevisionInfosResult> =
- tShape<FetchEntryRevisionInfosResult>({
- result: t.list(historyRevisionInfoValidator),
- });
-
async function entryRevisionFetchResponder(
viewer: Viewer,
request: FetchEntryRevisionInfosRequest,
@@ -178,13 +162,6 @@
calendarQuery: t.maybe(newEntryQueryInputValidator),
});
-export const saveEntryResponseValidator: TInterface<SaveEntryResponse> =
- tShape<SaveEntryResponse>({
- entryID: tID,
- newMessageInfos: t.list(rawMessageInfoValidator),
- updatesResult: serverCreateUpdatesResponseValidator,
- });
-
async function entryCreationResponder(
viewer: Viewer,
request: CreateEntryRequest,
@@ -218,13 +195,6 @@
calendarQuery: t.maybe(newEntryQueryInputValidator),
});
-export const deleteEntryResponseValidator: TInterface<DeleteEntryResponse> =
- tShape<DeleteEntryResponse>({
- newMessageInfos: t.list(rawMessageInfoValidator),
- threadID: tID,
- updatesResult: serverCreateUpdatesResponseValidator,
- });
-
async function entryDeletionResponder(
viewer: Viewer,
request: DeleteEntryRequest,
@@ -240,12 +210,6 @@
calendarQuery: t.maybe(newEntryQueryInputValidator),
});
-export const restoreEntryResponseValidator: TInterface<RestoreEntryResponse> =
- tShape<RestoreEntryResponse>({
- newMessageInfos: t.list(rawMessageInfoValidator),
- updatesResult: serverCreateUpdatesResponseValidator,
- });
-
async function entryRestorationResponder(
viewer: Viewer,
request: RestoreEntryRequest,
@@ -253,13 +217,6 @@
return await restoreEntry(viewer, request);
}
-export const deltaEntryInfosResultValidator: TInterface<DeltaEntryInfosResult> =
- tShape<DeltaEntryInfosResult>({
- rawEntryInfos: t.list(rawEntryInfoValidator),
- deletedEntryIDs: t.list(tID),
- userInfos: t.list(accountUserInfoValidator),
- });
-
async function calendarQueryUpdateResponder(
viewer: Viewer,
request: CalendarQuery,
diff --git a/keyserver/src/responders/responder-validators.test.js b/keyserver/src/responders/responder-validators.test.js
--- a/keyserver/src/responders/responder-validators.test.js
+++ b/keyserver/src/responders/responder-validators.test.js
@@ -4,7 +4,6 @@
setThreadUnreadStatusResultValidator,
updateActivityResultValidator,
} from 'lib/types/activity-types.js';
-
import {
fetchEntryInfosResponseValidator,
fetchEntryRevisionInfosResultValidator,
@@ -12,7 +11,8 @@
deleteEntryResponseValidator,
deltaEntryInfosResultValidator,
restoreEntryResponseValidator,
-} from './entry-responders.js';
+} from 'lib/types/validators/entry-validators.js';
+
import {
inviteLinkVerificationResponseValidator,
fetchInviteLinksResponseValidator,
diff --git a/lib/types/validators/entry-validators.js b/lib/types/validators/entry-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/entry-validators.js
@@ -0,0 +1,59 @@
+// @flow
+
+import t from 'tcomb';
+import type { TInterface } from 'tcomb';
+
+import { tShape, tID } from '../../utils/validation-utils.js';
+import {
+ type DeleteEntryResponse,
+ type RestoreEntryResponse,
+ type FetchEntryInfosResponse,
+ type DeltaEntryInfosResult,
+ type SaveEntryResponse,
+ rawEntryInfoValidator,
+} from '../entry-types.js';
+import {
+ type FetchEntryRevisionInfosResult,
+ historyRevisionInfoValidator,
+} from '../history-types.js';
+import { rawMessageInfoValidator } from '../message-types.js';
+import { serverCreateUpdatesResponseValidator } from '../update-types.js';
+import { accountUserInfoValidator } from '../user-types.js';
+
+export const fetchEntryInfosResponseValidator: TInterface<FetchEntryInfosResponse> =
+ tShape<FetchEntryInfosResponse>({
+ rawEntryInfos: t.list(rawEntryInfoValidator),
+ userInfos: t.dict(t.String, accountUserInfoValidator),
+ });
+
+export const fetchEntryRevisionInfosResultValidator: TInterface<FetchEntryRevisionInfosResult> =
+ tShape<FetchEntryRevisionInfosResult>({
+ result: t.list(historyRevisionInfoValidator),
+ });
+
+export const saveEntryResponseValidator: TInterface<SaveEntryResponse> =
+ tShape<SaveEntryResponse>({
+ entryID: tID,
+ newMessageInfos: t.list(rawMessageInfoValidator),
+ updatesResult: serverCreateUpdatesResponseValidator,
+ });
+
+export const deleteEntryResponseValidator: TInterface<DeleteEntryResponse> =
+ tShape<DeleteEntryResponse>({
+ newMessageInfos: t.list(rawMessageInfoValidator),
+ threadID: tID,
+ updatesResult: serverCreateUpdatesResponseValidator,
+ });
+
+export const restoreEntryResponseValidator: TInterface<RestoreEntryResponse> =
+ tShape<RestoreEntryResponse>({
+ newMessageInfos: t.list(rawMessageInfoValidator),
+ updatesResult: serverCreateUpdatesResponseValidator,
+ });
+
+export const deltaEntryInfosResultValidator: TInterface<DeltaEntryInfosResult> =
+ tShape<DeltaEntryInfosResult>({
+ rawEntryInfos: t.list(rawEntryInfoValidator),
+ deletedEntryIDs: t.list(tID),
+ userInfos: t.list(accountUserInfoValidator),
+ });

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 12:36 AM (22 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540800
Default Alt Text
D11938.diff (7 KB)

Event Timeline