forked from rocicorp/mono
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull.ts
More file actions
33 lines (27 loc) · 1.09 KB
/
pull.ts
File metadata and controls
33 lines (27 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as v from '../../shared/src/valita.ts';
import {nullableVersionSchema, versionSchema} from './version.ts';
export const pullRequestBodySchema = v.object({
clientGroupID: v.string(),
cookie: nullableVersionSchema,
requestID: v.string(),
});
export const pullResponseBodySchema = v.object({
cookie: versionSchema,
// Matches pullRequestBodySchema requestID that initiated this response
requestID: v.string(),
lastMutationIDChanges: v.record(v.number()),
// Pull is currently only used for mutation recovery which does not use
// the patch so we save work by not computing the patch.
});
export const pullRequestMessageSchema = v.tuple([
v.literal('pull'),
pullRequestBodySchema,
]);
export const pullResponseMessageSchema = v.tuple([
v.literal('pull'),
pullResponseBodySchema,
]);
export type PullRequestBody = v.Infer<typeof pullRequestBodySchema>;
export type PullResponseBody = v.Infer<typeof pullResponseBodySchema>;
export type PullRequestMessage = v.Infer<typeof pullRequestMessageSchema>;
export type PullResponseMessage = v.Infer<typeof pullResponseMessageSchema>;