aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext/xtextMessages.ts
blob: 4bf49c17d68dc1d4f75b1765d82da81de894ff14 (plain) (blame)
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
34
35
36
37
38
39
40
import { z } from 'zod';

export const xtextWebRequest = z.object({
  id: z.string().min(1),
  request: z.unknown(),
});

export type XtextWebRequest = z.infer<typeof xtextWebRequest>;

export const xtextWebOkResponse = z.object({
  id: z.string().min(1),
  response: z.unknown(),
});

export type XtextWebOkResponse = z.infer<typeof xtextWebOkResponse>;

export const xtextWebErrorKind = z.enum(['request', 'server']);

export type XtextWebErrorKind = z.infer<typeof xtextWebErrorKind>;

export const xtextWebErrorResponse = z.object({
  id: z.string().min(1),
  error: xtextWebErrorKind,
  message: z.string(),
});

export type XtextWebErrorResponse = z.infer<typeof xtextWebErrorResponse>;

export const xtextWebPushService = z.enum(['highlight', 'validate']);

export type XtextWebPushService = z.infer<typeof xtextWebPushService>;

export const xtextWebPushMessage = z.object({
  resource: z.string().min(1),
  stateId: z.string().min(1),
  service: xtextWebPushService,
  push: z.unknown(),
});

export type XtextWebPushMessage = z.infer<typeof xtextWebPushMessage>;