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 @@ -15,7 +15,7 @@ } from 'lib/shared/timeouts.js'; import { mostRecentUpdateTimestamp } from 'lib/shared/update-utils.js'; import { hasMinCodeVersion } from 'lib/shared/version-utils.js'; -import { endpointIsSocketSafe } from 'lib/types/endpoints.js'; +import { endpointIsSocketSafe, endpoints } from 'lib/types/endpoints.js'; import { redisMessageTypes, type RedisMessage } from 'lib/types/redis-types.js'; import { serverRequestTypes, @@ -126,7 +126,7 @@ ), id: t.Number, payload: tShape({ - endpoint: t.String, + endpoint: t.enums.of(endpoints), input: t.maybe(t.Object), }), }), diff --git a/lib/types/endpoints.js b/lib/types/endpoints.js --- a/lib/types/endpoints.js +++ b/lib/types/endpoints.js @@ -1,5 +1,7 @@ // @flow +import { values } from '../utils/objects.js'; + export type APIRequest = { endpoint: Endpoint, input?: Object, @@ -144,3 +146,11 @@ export function endpointIsSocketOnly(endpoint: Endpoint): boolean { return socketOnlyEndpointSet.has(endpoint); } + +export const endpoints: $ReadOnlyArray = [ + ...values(sessionChangingEndpoints), + ...values(uploadEndpoints), + ...values(largeDataFetchEndpoints), + ...values(socketOnlyEndpoints), + ...values(httpPreferredEndpoints), +];