···11-import { Branded } from "$lib/types";
22-import Type, { type StaticDecode } from "typebox";
33-44-// eslint-disable-next-line @typescript-eslint/naming-convention -- TypeBox types are named like types */
55-export const FieldId = Branded("FieldId", Type.Integer());
66-export type FieldId = StaticDecode<typeof FieldId>;
77-88-// eslint-disable-next-line @typescript-eslint/naming-convention -- TypeBox types are named like types */
99-export const Field = Type.Object({
1010- id: FieldId,
1111- name: Type.String(),
1212-});
1313-export type Field = StaticDecode<typeof Field>;
+9
app/src/lib/appserver/model/Field.ts
···11+import { Branded } from "$lib/types";
22+import Type, { type StaticDecode } from "typebox";
33+44+// eslint-disable-next-line @typescript-eslint/naming-convention -- TypeBox types are named like types */
55+export const Field = Type.Object({
66+ id: Type.Integer(),
77+ name: Type.String(),
88+});
99+export type Field = StaticDecode<typeof Field>;
+1-2
app/src/lib/appserver/socket/SocketV1.svelte.ts
···1212 type SocketV1Protocol,
1313} from "./SocketV1Protocol";
1414import jsonpatch from "json-patch";
1515-import type { FieldId } from "../dto/Field";
16151716interface SocketV1EventMap {
1817 message: MessageEvent;
···101100 });
102101 }
103102104104- $watchField(data: { id: FieldId }, subscriber: (gameState: GameState | undefined) => void) {
103103+ $watchField(data: { id: number }, subscriber: (gameState: GameState | undefined) => void) {
105104 let gameState: GameState | undefined = undefined;
106105 this.#sendMessage({ type: "WatchField", data: data.id }).$subscribe((response) => {
107106 if (response.type === "PutFieldState") {
+1-2
app/src/lib/appserver/socket/SocketV1Protocol.ts
···88import { Branded } from "$lib/types";
99import type { OpPatch } from "json-patch";
1010import Type, { type StaticDecode, type TSchema } from "typebox";
1111-import { FieldId } from "../dto/Field";
12111312const JsonPointer = Type.String({
1413 pattern: "^(/[^/~]*(~[01][^/~]*)*)*$",
···116115});
117116export type Authenticate = StaticDecode<typeof Authenticate>;
118117119119-export const WatchField = Type.Object({ type: Type.Literal("WatchField"), data: FieldId });
118118+export const WatchField = Type.Object({ type: Type.Literal("WatchField"), data: Type.Integer() });
120119export type WatchField = StaticDecode<typeof WatchField>;
121120122121export const Unsubscribe = Type.Object({ type: Type.Literal("Unsubscribe") });