Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/responders/report-responders.js
// @flow | // @flow | ||||
import type { $Response, $Request } from 'express'; | import type { $Response, $Request } from 'express'; | ||||
import t from 'tcomb'; | import t from 'tcomb'; | ||||
import type { TStructProps } from 'tcomb'; | import type { TStructProps } from 'tcomb'; | ||||
import { | import { | ||||
type ReportCreationResponse, | type ReportCreationResponse, | ||||
type ReportCreationRequest, | type ReportCreationRequest, | ||||
type FetchErrorReportInfosResponse, | type FetchErrorReportInfosResponse, | ||||
type FetchErrorReportInfosRequest, | type FetchErrorReportInfosRequest, | ||||
type ThreadInconsistencyReportShape, | |||||
type EntryInconsistencyReportShape, | |||||
reportTypes, | reportTypes, | ||||
} from 'lib/types/report-types.js'; | } from 'lib/types/report-types.js'; | ||||
import { ServerError } from 'lib/utils/errors.js'; | import { ServerError } from 'lib/utils/errors.js'; | ||||
import { | import { | ||||
tShape, | tShape, | ||||
tPlatform, | tPlatform, | ||||
tPlatformDetails, | tPlatformDetails, | ||||
} from 'lib/utils/validation-utils.js'; | } from 'lib/utils/validation-utils.js'; | ||||
import { newEntryQueryInputValidator } from './entry-responders.js'; | import { newEntryQueryInputValidator } from './entry-responders.js'; | ||||
import createReport from '../creators/report-creator.js'; | import createReport from '../creators/report-creator.js'; | ||||
import { | import { | ||||
fetchErrorReportInfos, | fetchErrorReportInfos, | ||||
fetchReduxToolsImport, | fetchReduxToolsImport, | ||||
} from '../fetchers/report-fetchers.js'; | } from '../fetchers/report-fetchers.js'; | ||||
import type { Viewer } from '../session/viewer.js'; | import type { Viewer } from '../session/viewer.js'; | ||||
import { validateInput } from '../utils/validation-utils.js'; | import { validateInput } from '../utils/validation-utils.js'; | ||||
const tActionSummary = tShape({ | const tActionSummary = tShape({ | ||||
type: t.String, | type: t.String, | ||||
time: t.Number, | time: t.Number, | ||||
summary: t.String, | summary: t.String, | ||||
}); | }); | ||||
const threadInconsistencyReportValidatorShape: TStructProps = { | const threadInconsistencyReportValidatorShape: TStructProps<ThreadInconsistencyReportShape> = | ||||
{ | |||||
platformDetails: tPlatformDetails, | platformDetails: tPlatformDetails, | ||||
beforeAction: t.Object, | beforeAction: t.Object, | ||||
action: t.Object, | action: t.Object, | ||||
pollResult: t.maybe(t.Object), | pollResult: t.maybe(t.Object), | ||||
pushResult: t.Object, | pushResult: t.Object, | ||||
lastActionTypes: t.maybe(t.list(t.String)), | lastActionTypes: t.maybe(t.list(t.String)), | ||||
lastActions: t.maybe(t.list(tActionSummary)), | lastActions: t.maybe(t.list(tActionSummary)), | ||||
time: t.maybe(t.Number), | time: t.maybe(t.Number), | ||||
}; | }; | ||||
const entryInconsistencyReportValidatorShape: TStructProps = { | const entryInconsistencyReportValidatorShape: TStructProps<EntryInconsistencyReportShape> = | ||||
{ | |||||
platformDetails: tPlatformDetails, | platformDetails: tPlatformDetails, | ||||
beforeAction: t.Object, | beforeAction: t.Object, | ||||
action: t.Object, | action: t.Object, | ||||
calendarQuery: newEntryQueryInputValidator, | calendarQuery: newEntryQueryInputValidator, | ||||
pollResult: t.maybe(t.Object), | pollResult: t.maybe(t.Object), | ||||
pushResult: t.Object, | pushResult: t.Object, | ||||
lastActionTypes: t.maybe(t.list(t.String)), | lastActionTypes: t.maybe(t.list(t.String)), | ||||
lastActions: t.maybe(t.list(tActionSummary)), | lastActions: t.maybe(t.list(tActionSummary)), | ||||
time: t.Number, | time: t.Number, | ||||
}; | }; | ||||
const userInconsistencyReportValidatorShape = { | const userInconsistencyReportValidatorShape = { | ||||
platformDetails: tPlatformDetails, | platformDetails: tPlatformDetails, | ||||
action: t.Object, | action: t.Object, | ||||
beforeStateCheck: t.Object, | beforeStateCheck: t.Object, | ||||
afterStateCheck: t.Object, | afterStateCheck: t.Object, | ||||
lastActions: t.list(tActionSummary), | lastActions: t.list(tActionSummary), | ||||
time: t.Number, | time: t.Number, | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |