Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32263814
D12362.1765249018.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D12362.1765249018.diff
View Options
diff --git a/keyserver/src/socket/socket.js b/keyserver/src/socket/socket.js
--- a/keyserver/src/socket/socket.js
+++ b/keyserver/src/socket/socket.js
@@ -17,10 +17,7 @@
import { mostRecentUpdateTimestamp } from 'lib/shared/update-utils.js';
import { hasMinCodeVersion } from 'lib/shared/version-utils.js';
import { endpointIsSocketSafe } from 'lib/types/endpoints.js';
-import {
- type RawEntryInfo,
- calendarQueryValidator,
-} from 'lib/types/entry-types.js';
+import type { RawEntryInfo } from 'lib/types/entry-types.js';
import { defaultNumberPerThread } from 'lib/types/message-types.js';
import { redisMessageTypes, type RedisMessage } from 'lib/types/redis-types.js';
import {
@@ -30,6 +27,7 @@
import {
sessionCheckFrequency,
stateCheckInactivityActivationInterval,
+ sessionStateValidator,
} from 'lib/types/session-types.js';
import {
type ClientSocketMessage,
@@ -106,12 +104,7 @@
cookie: t.maybe(tCookie),
sessionID: t.maybe(t.String),
}),
- sessionState: tShape({
- calendarQuery: calendarQueryValidator,
- messagesCurrentAsOf: t.Number,
- updatesCurrentAsOf: t.Number,
- watchedIDs: t.list(t.String),
- }),
+ sessionState: sessionStateValidator,
clientResponses: t.list(clientResponseInputValidator),
}),
}),
diff --git a/lib/types/session-types.js b/lib/types/session-types.js
--- a/lib/types/session-types.js
+++ b/lib/types/session-types.js
@@ -1,13 +1,16 @@
// @flow
+import t, { type TInterface } from 'tcomb';
+
import type { AuthActionSource } from './account-types.js';
-import type { CalendarQuery } from './entry-types.js';
+import { type CalendarQuery, calendarQueryValidator } from './entry-types.js';
import type { MixedRawThreadInfos } from './thread-types.js';
import {
type UserInfo,
type CurrentUserInfo,
type LoggedOutUserInfo,
} from './user-types.js';
+import { tShape } from '../utils/validation-utils.js';
export const cookieLifetime = 30 * 24 * 60 * 60 * 1000; // in milliseconds
// Interval the server waits after a state check before starting a new one
@@ -95,12 +98,19 @@
};
export type SessionState = {
- calendarQuery: CalendarQuery,
- messagesCurrentAsOf: number,
- updatesCurrentAsOf: number,
- watchedIDs: $ReadOnlyArray<string>,
+ +calendarQuery: CalendarQuery,
+ +messagesCurrentAsOf: number,
+ +updatesCurrentAsOf: number,
+ +watchedIDs: $ReadOnlyArray<string>,
};
+export const sessionStateValidator: TInterface<SessionState> = tShape({
+ calendarQuery: calendarQueryValidator,
+ messagesCurrentAsOf: t.Number,
+ updatesCurrentAsOf: t.Number,
+ watchedIDs: t.list(t.String),
+});
+
export type SessionIdentification = Partial<{
cookie: ?string,
sessionID: ?string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 9, 2:56 AM (11 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5852227
Default Alt Text
D12362.1765249018.diff (2 KB)
Attached To
Mode
D12362: [keyserver][lib] Move sessionStateValidator to lib
Attached
Detach File
Event Timeline
Log In to Comment