Page MenuHomePhabricator

D8381.diff
No OneTemporary

D8381.diff

diff --git a/lib/types/activity-types.js b/lib/types/activity-types.js
--- a/lib/types/activity-types.js
+++ b/lib/types/activity-types.js
@@ -9,6 +9,12 @@
+threadID: string,
+latestMessage: ?string,
};
+export const activityUpdateValidator: TInterface<ActivityUpdate> =
+ tShape<ActivityUpdate>({
+ focus: t.Boolean,
+ threadID: tID,
+ latestMessage: t.maybe(tID),
+ });
export type UpdateActivityRequest = {
+updates: $ReadOnlyArray<ActivityUpdate>,
diff --git a/lib/types/entry-types.js b/lib/types/entry-types.js
--- a/lib/types/entry-types.js
+++ b/lib/types/entry-types.js
@@ -3,7 +3,11 @@
import t, { type TInterface } from 'tcomb';
import { type Platform, isWebPlatform } from './device-types.js';
-import { type CalendarFilter, defaultCalendarFilters } from './filter-types.js';
+import {
+ type CalendarFilter,
+ calendarFilterValidator,
+ defaultCalendarFilters,
+} from './filter-types.js';
import type { RawMessageInfo } from './message-types.js';
import type {
ServerCreateUpdatesResponse,
@@ -73,6 +77,13 @@
+filters: $ReadOnlyArray<CalendarFilter>,
};
+export const calendarQueryValidator: TInterface<CalendarQuery> =
+ tShape<CalendarQuery>({
+ startDate: t.String,
+ endDate: t.String,
+ filters: t.list(calendarFilterValidator),
+ });
+
export const defaultCalendarQuery = (
platform: ?Platform,
timeZone?: ?string,
diff --git a/lib/types/filter-types.js b/lib/types/filter-types.js
--- a/lib/types/filter-types.js
+++ b/lib/types/filter-types.js
@@ -1,6 +1,9 @@
// @flow
+import t, { type TUnion } from 'tcomb';
+
import type { ResolvedThreadInfo } from './thread-types.js';
+import { tID, tShape, tString } from '../utils/validation-utils.js';
export const calendarThreadFilterTypes = Object.freeze({
THREAD_LIST: 'threads',
@@ -16,6 +19,14 @@
};
export type CalendarFilter = { +type: 'not_deleted' } | CalendarThreadFilter;
+export const calendarFilterValidator: TUnion<CalendarFilter> = t.union([
+ tShape<CalendarThreadFilter>({
+ type: tString('threads'),
+ threadIDs: t.list(tID),
+ }),
+ tShape({ type: tString('not_deleted') }),
+]);
+
export const defaultCalendarFilters: $ReadOnlyArray<CalendarFilter> = [
{ type: calendarThreadFilterTypes.NOT_DELETED },
];
diff --git a/lib/types/socket-types.js b/lib/types/socket-types.js
--- a/lib/types/socket-types.js
+++ b/lib/types/socket-types.js
@@ -5,6 +5,7 @@
import {
type ActivityUpdate,
+ activityUpdateValidator,
type UpdateActivityResult,
updateActivityResultValidator,
} from './activity-types.js';
@@ -14,6 +15,7 @@
type RawEntryInfo,
rawEntryInfoValidator,
type CalendarQuery,
+ calendarQueryValidator,
defaultCalendarQuery,
} from './entry-types.js';
import {
@@ -473,6 +475,21 @@
+lateResponses: $ReadOnlyArray<number>,
+showDisconnectedBar: boolean,
};
+export const connectionInfoValidator: TInterface<ConnectionInfo> =
+ tShape<ConnectionInfo>({
+ status: t.enums.of([
+ 'connecting',
+ 'connected',
+ 'reconnecting',
+ 'disconnecting',
+ 'forcedDisconnecting',
+ 'disconnected',
+ ]),
+ queuedActivityUpdates: t.list(activityUpdateValidator),
+ actualizedCalendarQuery: calendarQueryValidator,
+ lateResponses: t.list(t.Number),
+ showDisconnectedBar: t.Boolean,
+ });
export const defaultConnectionInfo = (
platform: Platform,
timeZone?: ?string,

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 4:19 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2529647
Default Alt Text
D8381.diff (3 KB)

Event Timeline