Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3339559
D13315.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13315.diff
View Options
diff --git a/keyserver/src/updaters/entry-updaters.js b/keyserver/src/updaters/entry-updaters.js
--- a/keyserver/src/updaters/entry-updaters.js
+++ b/keyserver/src/updaters/entry-updaters.js
@@ -157,7 +157,7 @@
`),
);
}
- const updatedEntryInfo = {
+ const updatedEntryInfo: RawEntryInfo = {
...entryInfo,
text: request.text,
};
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
@@ -1,6 +1,6 @@
// @flow
-import t, { type TInterface } from 'tcomb';
+import t, { type TInterface, type TUnion } from 'tcomb';
import { type Platform, isWebPlatform } from './device-types.js';
import {
@@ -19,37 +19,65 @@
fifteenDaysLater,
thisMonthDates,
} from '../utils/date-utils.js';
-import { tUserID, tID, tShape } from '../utils/validation-utils.js';
+import { tUserID, tID, tShape, tBool } from '../utils/validation-utils.js';
-export type RawEntryInfo = {
- id?: string, // null if local copy without ID yet
- localID?: string, // for optimistic creations
- threadID: string,
- text: string,
- year: number,
- month: number, // 1-indexed
- day: number, // 1-indexed
- creationTime: number, // millisecond timestamp
- creatorID: string,
- deleted: boolean,
+export type RawEntryInfoBase = {
+ +id?: string, // null if local copy without ID yet
+ +localID?: string, // for optimistic creations
+ +threadID: string,
+ +text: string,
+ +year: number,
+ +month: number, // 1-indexed
+ +day: number, // 1-indexed
+ +creationTime: number, // millisecond timestamp
+ +creatorID: string,
+ +deleted: boolean,
};
-export type RawEntryInfos = {
- +[id: string]: RawEntryInfo,
+const rawEntryInfoBaseValidatorShape = {
+ localID: t.maybe(t.String),
+ threadID: tID,
+ text: t.String,
+ year: t.Number,
+ month: t.Number,
+ day: t.Number,
+ creationTime: t.Number,
+ creatorID: tUserID,
+ deleted: t.Boolean,
};
-export const rawEntryInfoValidator: TInterface<RawEntryInfo> =
- tShape<RawEntryInfo>({
+
+export type ThinRawEntryInfo = $ReadOnly<{
+ ...RawEntryInfoBase,
+ id?: string,
+}>;
+const thinRawEntryInfoValidator: TInterface<ThinRawEntryInfo> =
+ tShape<ThinRawEntryInfo>({
+ ...rawEntryInfoBaseValidatorShape,
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: tUserID,
- deleted: t.Boolean,
});
+export type ThickRawEntryInfo = $ReadOnly<{
+ ...RawEntryInfoBase,
+ +id: string,
+ +thick: true,
+ +lastUpdatedTime: number,
+}>;
+const thickRawEntryInfoValidator: TInterface<ThickRawEntryInfo> =
+ tShape<ThickRawEntryInfo>({
+ ...rawEntryInfoBaseValidatorShape,
+ id: t.String,
+ thick: tBool(true),
+ lastUpdatedTime: t.Number,
+ });
+
+export type RawEntryInfo = ThinRawEntryInfo | ThickRawEntryInfo;
+export const rawEntryInfoValidator: TUnion<RawEntryInfo> = t.union([
+ thinRawEntryInfoValidator,
+ thickRawEntryInfoValidator,
+]);
+export type RawEntryInfos = {
+ +[id: string]: RawEntryInfo,
+};
+
export type EntryInfo = {
id?: string, // null if local copy without ID yet
localID?: string, // for optimistic creations
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 8:06 PM (17 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2564608
Default Alt Text
D13315.diff (3 KB)
Attached To
Mode
D13315: [keyserver][lib] Update raw entry info to be thick or thin
Attached
Detach File
Event Timeline
Log In to Comment