Changeset View
Changeset View
Standalone View
Standalone View
lib/types/entry-types.js
// @flow | // @flow | ||||
import t, { type TInterface } from 'tcomb'; | |||||
import { type Platform, isWebPlatform } from './device-types.js'; | import { type Platform, isWebPlatform } from './device-types.js'; | ||||
import { type CalendarFilter, defaultCalendarFilters } from './filter-types.js'; | import { type CalendarFilter, defaultCalendarFilters } from './filter-types.js'; | ||||
import type { RawMessageInfo } from './message-types.js'; | import type { RawMessageInfo } from './message-types.js'; | ||||
import type { | import type { | ||||
ServerCreateUpdatesResponse, | ServerCreateUpdatesResponse, | ||||
ClientCreateUpdatesResponse, | ClientCreateUpdatesResponse, | ||||
} from './update-types.js'; | } from './update-types.js'; | ||||
import type { UserInfo, AccountUserInfo } from './user-types.js'; | import type { UserInfo, AccountUserInfo } from './user-types.js'; | ||||
import { | import { | ||||
fifteenDaysEarlier, | fifteenDaysEarlier, | ||||
fifteenDaysLater, | fifteenDaysLater, | ||||
thisMonthDates, | thisMonthDates, | ||||
} from '../utils/date-utils.js'; | } from '../utils/date-utils.js'; | ||||
import { tID, tShape } from '../utils/validation-utils.js'; | |||||
export type RawEntryInfo = { | export type RawEntryInfo = { | ||||
id?: string, // null if local copy without ID yet | id?: string, // null if local copy without ID yet | ||||
localID?: string, // for optimistic creations | localID?: string, // for optimistic creations | ||||
threadID: string, | threadID: string, | ||||
text: string, | text: string, | ||||
year: number, | year: number, | ||||
month: number, // 1-indexed | month: number, // 1-indexed | ||||
day: number, // 1-indexed | day: number, // 1-indexed | ||||
creationTime: number, // millisecond timestamp | creationTime: number, // millisecond timestamp | ||||
creatorID: string, | creatorID: string, | ||||
deleted: boolean, | deleted: boolean, | ||||
}; | }; | ||||
export const rawEntryInfoValidator: TInterface<RawEntryInfo> = | |||||
tShape<RawEntryInfo>({ | |||||
id: t.maybe(tID), | |||||
localID: t.maybe(t.String), | |||||
threadID: tID, | |||||
text: t.String, | |||||
year: t.Number, | |||||
month: t.Number, | |||||
day: t.Number, | |||||
creationTime: t.Number, | |||||
creatorID: t.String, | |||||
deleted: t.Boolean, | |||||
}); | |||||
export type EntryInfo = { | export type EntryInfo = { | ||||
id?: string, // null if local copy without ID yet | id?: string, // null if local copy without ID yet | ||||
localID?: string, // for optimistic creations | localID?: string, // for optimistic creations | ||||
threadID: string, | threadID: string, | ||||
text: string, | text: string, | ||||
year: number, | year: number, | ||||
month: number, // 1-indexed | month: number, // 1-indexed | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |