From 39f3df852fd194e48358dd19571ba8f2c1a37767 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Sat, 20 Apr 2024 19:39:33 +0200 Subject: [PATCH] Rename padData/deletePad events to mapData/deleteMap --- client/src/client.ts | 4 +- docs/src/developers/client/README.md | 2 +- docs/src/developers/client/events.md | 4 +- docs/src/developers/client/methods.md | 4 +- docs/src/developers/client/properties.md | 8 +-- .../src/lib/components/client-provider.vue | 4 +- .../src/socket-v1/padData.test.ts | 2 +- .../src/socket-v2/history.test.ts | 8 +-- integration-tests/src/socket-v2/types.test.ts | 16 ++--- .../src/socket-v3/mapData.test.ts | 60 +++++++++---------- integration-tests/src/socket-v3/views.test.ts | 6 +- integration-tests/src/utils.ts | 3 + leaflet/src/markers/marker-cluster.ts | 4 +- leaflet/src/views/initialView.ts | 2 +- server/src/socket/socket-v2.ts | 4 ++ server/src/socket/socket-v3.ts | 6 +- server/src/socket/socket.ts | 2 +- types/src/socket/socket-v2.ts | 4 +- types/src/socket/socket-v3.ts | 4 +- 19 files changed, 78 insertions(+), 69 deletions(-) diff --git a/client/src/client.ts b/client/src/client.ts index bf34cfab..4fccfef3 100644 --- a/client/src/client.ts +++ b/client/src/client.ts @@ -218,7 +218,7 @@ class Client { private _handlers: { [E in EventName]?: EventHandler } = { - padData: (data) => { + mapData: (data) => { this._set(this.data, 'mapData', data); if(data.writable != null) { @@ -231,7 +231,7 @@ class Client { this._set(this.state, 'mapId', id); }, - deletePad: () => { + deleteMap: () => { this._set(this.state, 'readonly', true); this._set(this.state, 'writable', 0); this._set(this.state, 'deleted', true); diff --git a/docs/src/developers/client/README.md b/docs/src/developers/client/README.md index 0244624b..460714f4 100644 --- a/docs/src/developers/client/README.md +++ b/docs/src/developers/client/README.md @@ -56,7 +56,7 @@ console.log(client.mapData, client.types, client.lines); The client [constructor](./methods.md#constructor-server-mapid) takes the URL where the FacilMap server is running and opens a socket.io connection to the server. -When opening a collaborative map using [`setMapId`](./methods.md#setmapid-mapid), the server sends [events](./events.md) for the map settings, types, views and lines (without track points). The same types of events will be received later if the respective objects are changed while the connection is open. The client has some default listeners registered that will store the data received as events in its [properties](./properties.md). For example, a `padData` event contains the map settings and is emitted the first time the map ID is set and every time the map settings are changed while the connection is open. The `client.mapData` property always contains the latest state of the map settings. +When opening a collaborative map using [`setMapId`](./methods.md#setmapid-mapid), the server sends [events](./events.md) for the map settings, types, views and lines (without track points). The same types of events will be received later if the respective objects are changed while the connection is open. The client has some default listeners registered that will store the data received as events in its [properties](./properties.md). For example, a `mapData` event contains the map settings and is emitted the first time the map ID is set and every time the map settings are changed while the connection is open. The `client.mapData` property always contains the latest state of the map settings. Note that most methods of the client are asynchronous. Events that the server fires in response to a method call are always fired before the method returns. This is why in the above example, `client.mapData` and the other properties are available right after the `setMapId` call. diff --git a/docs/src/developers/client/events.md b/docs/src/developers/client/events.md index 8fb9cd0e..85097d2f 100644 --- a/docs/src/developers/client/events.md +++ b/docs/src/developers/client/events.md @@ -8,7 +8,7 @@ Subscribe to events using the [`on(eventName, function)`](./methods.md#on-eventn ```js const client = new FacilMap.Client("https://facilmap.org/", "testMap"); -client.on("padData", (mapData) => { +client.on("mapData", (mapData) => { document.title = mapData.name; }); ``` @@ -17,7 +17,7 @@ client.on("padData", (mapData) => { These events come from socket.io and are [documented there](https://socket.io/docs/v4/client-api/#events). -## `padData` +## `mapData` The settings of the map have changed or are retrieved for the first time. diff --git a/docs/src/developers/client/methods.md b/docs/src/developers/client/methods.md index 46dc5079..5863f172 100644 --- a/docs/src/developers/client/methods.md +++ b/docs/src/developers/client/methods.md @@ -99,7 +99,7 @@ Update the map settings of the current map. * `data` ([MapData](./types.md#mapdata)): The data of the map that should be modified. Fields that are not defined will not be modified. To change the default view, set the `defaultViewId` property. The `defaultView` property is ignored. * **Returns:** A promise that is resolved with the new mapData. -* **Events:** Causes a [`padData`](./events.md#paddata) event. +* **Events:** Causes a [`mapData`](./events.md#mapdata) event. * **Availability:** Only if a collaborative map is opened through its admin ID. ## `deleteMap()` @@ -107,7 +107,7 @@ Update the map settings of the current map. Delete the current map irrevocably. * **Returns:** A promise that is resolved empty when the map has been deleted. -* **Events:** Causes a [`deletePad`](./events.md#deletepad) event. +* **Events:** Causes a [`deleteMap`](./events.md#deletemap) event. * **Availability:** Only if a collaborative map is opened through its admin ID. ## `listenToHistory()` diff --git a/docs/src/developers/client/properties.md b/docs/src/developers/client/properties.md index 4658312c..99ef87b5 100644 --- a/docs/src/developers/client/properties.md +++ b/docs/src/developers/client/properties.md @@ -29,9 +29,9 @@ client.on("marker", (marker) => { The ID of the collaborative map that the client is connected to. Can be the read-only, writable or admin ID of an existing map. -Note that the ID can be changed in the settings. If in case of a [`padData`](./events.md#paddata) event, the ID of the map has changed, this property is updated automatically. +Note that the ID can be changed in the settings. If in case of a [`mapData`](./events.md#mapdata) event, the ID of the map has changed, this property is updated automatically. -_Set:_ when calling [`setMapId`](./methods.md#setmapid-mapid) and in response to a [`padData`](./events.md#paddata) event.\ +_Set:_ when calling [`setMapId`](./methods.md#setmapid-mapid) and in response to a [`mapData`](./events.md#mapdata) event.\ _Type:_ string ## `readonly` @@ -53,14 +53,14 @@ _Type:_ number `true` if the map was deleted while this client was connected to it. -_Set:_ in response to a [`deletePad`](./events.md#deletepad) event.\ +_Set:_ in response to a [`deleteMap`](./events.md#deletemap) event.\ _Type:_ boolean ## `mapData` The current settings of the map. `writeId` and/or `adminId` is null if if has been opened using another ID than the admin ID. -_Set:_ in response to a [`padData`](./events.md#paddata) event.\ +_Set:_ in response to a [`mapData`](./events.md#mapdata) event.\ _Type:_ [MapData](./types.md#mapdata) ## `markers` diff --git a/frontend/src/lib/components/client-provider.vue b/frontend/src/lib/components/client-provider.vue index 29ed4170..3aba167b 100644 --- a/frontend/src/lib/components/client-provider.vue +++ b/frontend/src/lib/components/client-provider.vue @@ -69,7 +69,7 @@ let lastMapId: MapId | undefined = undefined; let lastMapData: MapData | undefined = undefined; - newClient.on("padData", () => { + newClient.on("mapData", () => { for (const bookmark of storage.bookmarks) { if (lastMapId && bookmark.id == lastMapId) bookmark.id = newClient.mapId!; @@ -86,7 +86,7 @@ }); await new Promise((resolve) => { - newClient.once(props.mapId ? "padData" : "connect", () => { resolve(); }); + newClient.once(props.mapId ? "mapData" : "connect", () => { resolve(); }); newClient.on("serverError", () => { resolve(); }); }); diff --git a/integration-tests/src/socket-v1/padData.test.ts b/integration-tests/src/socket-v1/padData.test.ts index 5128bc70..a49376f1 100644 --- a/integration-tests/src/socket-v1/padData.test.ts +++ b/integration-tests/src/socket-v1/padData.test.ts @@ -8,7 +8,7 @@ test("Socket v1 pad name", async () => { const onPadData = vi.fn(); client.on("padData", onPadData); - await createTemporaryMapV2(client, {}, async (createPadData, padData) => { + await createTemporaryMapV2(client, {}, async (createMapData, mapData) => { expect(onPadData).toBeCalledTimes(1); expect(onPadData.mock.calls[0][0].name).toBe("Unnamed map"); diff --git a/integration-tests/src/socket-v2/history.test.ts b/integration-tests/src/socket-v2/history.test.ts index 400f4063..447d94c2 100644 --- a/integration-tests/src/socket-v2/history.test.ts +++ b/integration-tests/src/socket-v2/history.test.ts @@ -5,8 +5,8 @@ import { CRU, SocketVersion, type ID, type LegacyV2Type } from "facilmap-types"; test("Marker update history (socket v2)", async () => { const client1 = await openClient(undefined, SocketVersion.V2); - await createTemporaryMapV2(client1, {}, async (createPadData, padData) => { - const client2 = await openClient(padData.adminId); + await createTemporaryMapV2(client1, {}, async (createMapData, mapData) => { + const client2 = await openClient(mapData.adminId); const markerType = Object.values(client1.types).find((t) => t.type === "marker")!; @@ -62,8 +62,8 @@ test("Marker update history (socket v2)", async () => { test("Type update history (socket v2)", async () => { const client1 = await openClient(undefined, SocketVersion.V2); - await createTemporaryMapV2(client1, { createDefaultTypes: false }, async (createPadData, padData, result) => { - const client2 = await openClient(padData.adminId); + await createTemporaryMapV2(client1, { createDefaultTypes: false }, async (createMapData, mapData, result) => { + const client2 = await openClient(mapData.adminId); const createdType = await client1.addType({ name: "Test type", diff --git a/integration-tests/src/socket-v2/types.test.ts b/integration-tests/src/socket-v2/types.test.ts index ed58503e..420f4a01 100644 --- a/integration-tests/src/socket-v2/types.test.ts +++ b/integration-tests/src/socket-v2/types.test.ts @@ -6,8 +6,8 @@ import { cloneDeep } from "lodash-es"; test("Create type (socket v2)", async () => { const client1 = await openClient(undefined, SocketVersion.V2); - await createTemporaryMapV2(client1, { createDefaultTypes: false }, async (createPadData, padData, result) => { - const client2 = await openClient(padData.id, SocketVersion.V2); + await createTemporaryMapV2(client1, { createDefaultTypes: false }, async (createMapData, mapData, result) => { + const client2 = await openClient(mapData.id, SocketVersion.V2); const onType1 = vi.fn(); client1.on("type", onType1); @@ -50,12 +50,12 @@ test("Create type (socket v2)", async () => { [typeResult.id]: expect.objectContaining(type) }); - const client3 = await openClient(padData.id, SocketVersion.V2); + const client3 = await openClient(mapData.id, SocketVersion.V2); expect(cloneDeep(client3.types)).toEqual({ [typeResult.id]: expect.objectContaining(type) }); - const client4 = await openClient(padData.id); + const client4 = await openClient(mapData.id); expect(cloneDeep(client4.types)).toEqual({ [typeResult.id]: expect.objectContaining({ defaultIcon: "icon", @@ -78,13 +78,13 @@ test("Update type (socket v2)", async () => { const onType = vi.fn(); client1.on("type", onType); - await createTemporaryMapV2(client1, { createDefaultTypes: false }, async (createPadData, padData, result) => { + await createTemporaryMapV2(client1, { createDefaultTypes: false }, async (createMapData, mapData, result) => { const createdType = await client1.addType({ name: "Test type", type: "marker" }); - const client2 = await openClient(padData.id, SocketVersion.V2); + const client2 = await openClient(mapData.id, SocketVersion.V2); const onType1 = vi.fn(); client1.on("type", onType1); @@ -126,7 +126,7 @@ test("Update type (socket v2)", async () => { [createdType.id]: expect.objectContaining(update) }); - const client3 = await openClient(padData.id); + const client3 = await openClient(mapData.id); expect(cloneDeep(client3.types)).toEqual({ [createdType.id]: expect.objectContaining({ defaultIcon: "icon", @@ -145,7 +145,7 @@ test("Update type (socket v2)", async () => { test("Delete type (socket v2)", async () => { const client = await openClient(undefined, SocketVersion.V2); - await createTemporaryMapV2(client, { createDefaultTypes: false }, async (createPadData, padData, result) => { + await createTemporaryMapV2(client, { createDefaultTypes: false }, async (createMapData, mapData, result) => { const type = await client.addType({ name: "Test type", type: "marker", diff --git a/integration-tests/src/socket-v3/mapData.test.ts b/integration-tests/src/socket-v3/mapData.test.ts index 97179a5d..cea66533 100644 --- a/integration-tests/src/socket-v3/mapData.test.ts +++ b/integration-tests/src/socket-v3/mapData.test.ts @@ -7,8 +7,8 @@ import Client from "facilmap-client"; test("Create map (using default values)", async () => { const client = await openClient(); - const onPadData = vi.fn(); - client.on("padData", onPadData); + const onMapData = vi.fn(); + client.on("mapData", onMapData); await createTemporaryMap(client, {}, async (createMapData, mapData) => { const expectedMapData: MapData & { writable: Writable } = { @@ -31,8 +31,8 @@ test("Create map (using default values)", async () => { expect(mapData).toEqual(expectedMapData); expect(client.mapData).toEqual(expectedMapData); - expect(onPadData).toBeCalledTimes(1); - expect(onPadData).toHaveBeenCalledWith(expectedMapData); + expect(onMapData).toBeCalledTimes(1); + expect(onMapData).toHaveBeenCalledWith(expectedMapData); expect(await client.getMap({ padId: createMapData.id })).toEqual(pick(expectedMapData, ["id", "name", "description"])); }); }); @@ -40,8 +40,8 @@ test("Create map (using default values)", async () => { test("Create pad (using custom values)", async () => { const client = await openClient(); - const onPadData = vi.fn(); - client.on("padData", onPadData); + const onMapData = vi.fn(); + client.on("mapData", onMapData); await createTemporaryMap(client, { name: "Test pad", @@ -65,8 +65,8 @@ test("Create pad (using custom values)", async () => { expect(mapData).toEqual(expectedMapData); expect(client.mapData).toEqual(expectedMapData); - expect(onPadData).toBeCalledTimes(1); - expect(onPadData).toHaveBeenCalledWith(expectedMapData); + expect(onMapData).toBeCalledTimes(1); + expect(onMapData).toHaveBeenCalledWith(expectedMapData); expect(await client.getMap({ padId: createMapData.id })).toEqual(pick(expectedMapData, ["id", "name", "description"])); }); }); @@ -126,8 +126,8 @@ test("Create pad (duplicate IDs)", async () => { test("Edit pad", async () => { const client = await openClient(); - const onPadData = vi.fn(); - client.on("padData", onPadData); + const onMapData = vi.fn(); + client.on("mapData", onMapData); await createTemporaryMap(client, {}, async (createMapData, mapData) => { const update = { @@ -151,7 +151,7 @@ test("Edit pad", async () => { expect(updatedMapData).toEqual(expectedMapData); expect(client.mapData).toEqual(expectedMapData); - expect(onPadData).toHaveBeenLastCalledWith(expectedMapData); + expect(onMapData).toHaveBeenLastCalledWith(expectedMapData); expect(await client.getMap({ padId: createMapData.id })).toEqual(pick(expectedMapData, ["id", "name", "description"])); }); }); @@ -159,8 +159,8 @@ test("Edit pad", async () => { test("Rename pad", async () => { const client = await openClient(); - const onPadData = vi.fn(); - client.on("padData", onPadData); + const onMapData = vi.fn(); + client.on("mapData", onMapData); await createTemporaryMap(client, {}, async (createMapData, mapData) => { const update = { @@ -178,7 +178,7 @@ test("Rename pad", async () => { expect(updatedMapData).toEqual(expectedMapData); expect(client.mapData).toEqual(expectedMapData); - expect(onPadData).toHaveBeenLastCalledWith(expectedMapData); + expect(onMapData).toHaveBeenLastCalledWith(expectedMapData); expect(await client.getMap({ padId: createMapData.id })).toBeNull(); expect(await client.getMap({ padId: createMapData.writeId })).toBeNull(); @@ -277,30 +277,30 @@ test("Open existing pad", async () => { expect(client4.mapData).toEqual({ ...mapData, writable: Writable.ADMIN }); const client5 = await openClient(); - const onPadData5 = vi.fn(); - client5.on("padData", onPadData5); + const onMapData5 = vi.fn(); + client5.on("mapData", onMapData5); const result5 = await client5.setMapId(createMapData.id); - expect(result5.padData![0]).toEqual({ ...mapData, writeId: undefined, adminId: undefined, writable: Writable.READ }); - expect(onPadData5).toBeCalledTimes(1); - expect(onPadData5).toBeCalledWith({ ...mapData, writeId: undefined, adminId: undefined, writable: Writable.READ }); + expect(result5.mapData![0]).toEqual({ ...mapData, writeId: undefined, adminId: undefined, writable: Writable.READ }); + expect(onMapData5).toBeCalledTimes(1); + expect(onMapData5).toBeCalledWith({ ...mapData, writeId: undefined, adminId: undefined, writable: Writable.READ }); expect(client5.mapData).toEqual({ ...mapData, writeId: undefined, adminId: undefined, writable: Writable.READ }); const client6 = await openClient(); - const onPadData6 = vi.fn(); - client6.on("padData", onPadData6); + const onMapData6 = vi.fn(); + client6.on("mapData", onMapData6); const result6 = await client6.setMapId(createMapData.writeId); - expect(result6.padData![0]).toEqual({ ...mapData, adminId: undefined, writable: Writable.WRITE }); - expect(onPadData6).toBeCalledTimes(1); - expect(onPadData6).toBeCalledWith({ ...mapData, adminId: undefined, writable: Writable.WRITE }); + expect(result6.mapData![0]).toEqual({ ...mapData, adminId: undefined, writable: Writable.WRITE }); + expect(onMapData6).toBeCalledTimes(1); + expect(onMapData6).toBeCalledWith({ ...mapData, adminId: undefined, writable: Writable.WRITE }); expect(client6.mapData).toEqual({ ...mapData, adminId: undefined, writable: Writable.WRITE }); const client7 = await openClient(); - const onPadData7 = vi.fn(); - client7.on("padData", onPadData7); + const onMapData7 = vi.fn(); + client7.on("mapData", onMapData7); const result7 = await client7.setMapId(createMapData.adminId); - expect(result7.padData![0]).toEqual({ ...mapData, writable: Writable.ADMIN }); - expect(onPadData7).toBeCalledTimes(1); - expect(onPadData7).toBeCalledWith({ ...mapData, writable: Writable.ADMIN }); + expect(result7.mapData![0]).toEqual({ ...mapData, writable: Writable.ADMIN }); + expect(onMapData7).toBeCalledTimes(1); + expect(onMapData7).toBeCalledWith({ ...mapData, writable: Writable.ADMIN }); expect(client7.mapData).toEqual({ ...mapData, writable: Writable.ADMIN }); }); }); @@ -310,7 +310,7 @@ test("Open non-existing pad", async () => { const client1 = new Client(getFacilMapUrl(), id, { reconnection: false }); await expect(new Promise((resolve, reject) => { - client1.on("padData", resolve); + client1.on("mapData", resolve); client1.on("serverError", reject); client1.on("connect_error", reject); })).rejects.toThrowError("does not exist"); diff --git a/integration-tests/src/socket-v3/views.test.ts b/integration-tests/src/socket-v3/views.test.ts index 497f402b..683db608 100644 --- a/integration-tests/src/socket-v3/views.test.ts +++ b/integration-tests/src/socket-v3/views.test.ts @@ -163,8 +163,8 @@ test("Update view", async () => { test("Set default view", async () => { const client = await openClient(); - const onPadData = vi.fn(); - client.on("padData", onPadData); + const onMapData = vi.fn(); + client.on("mapData", onMapData); await createTemporaryMap(client, {}, async (mapData) => { await client.addView({ @@ -193,7 +193,7 @@ test("Set default view", async () => { defaultViewId: view2.id }); expect(mapResult.defaultView).toEqual(view2); - expect(onPadData.mock.lastCall[0].defaultView).toEqual(view2); + expect(onMapData.mock.lastCall[0].defaultView).toEqual(view2); }); }); diff --git a/integration-tests/src/utils.ts b/integration-tests/src/utils.ts index 81513612..506b494a 100644 --- a/integration-tests/src/utils.ts +++ b/integration-tests/src/utils.ts @@ -38,6 +38,9 @@ export async function openClient(id? const client = Object.assign(new clientConstructors[version](getFacilMapUrl(), id, { reconnection: false }) as any, { _version: version }); await new Promise((resolve, reject) => { if (id != null) { + client.on("mapData", () => { + resolve(); + }); client.on("padData", () => { resolve(); }); diff --git a/leaflet/src/markers/marker-cluster.ts b/leaflet/src/markers/marker-cluster.ts index dc7ccb92..4fded223 100644 --- a/leaflet/src/markers/marker-cluster.ts +++ b/leaflet/src/markers/marker-cluster.ts @@ -47,7 +47,7 @@ export default class MarkerCluster extends MarkerClusterGroup { onAdd(map: Map): this { super.onAdd(map); - this.client.on("padData", this.handleMapData); + this.client.on("mapData", this.handleMapData); if (this.client.mapData) this.handleMapData(this.client.mapData); @@ -57,7 +57,7 @@ export default class MarkerCluster extends MarkerClusterGroup { onRemove(map: Map): this { super.onRemove(map); - this.client.removeListener("padData", this.handleMapData); + this.client.removeListener("mapData", this.handleMapData); return this; } diff --git a/leaflet/src/views/initialView.ts b/leaflet/src/views/initialView.ts index dfc80c4b..6993a604 100644 --- a/leaflet/src/views/initialView.ts +++ b/leaflet/src/views/initialView.ts @@ -5,7 +5,7 @@ import type { UnsavedView } from "./views"; export async function getInitialView(client: Client): Promise { if(client.mapId) { const mapData = client.mapData || await new Promise((resolve, reject) => { - client.on("padData", resolve); + client.on("mapData", resolve); client.on("serverError", reject); if (client.serverError) diff --git a/server/src/socket/socket-v2.ts b/server/src/socket/socket-v2.ts index d440e2cd..6acbde61 100644 --- a/server/src/socket/socket-v2.ts +++ b/server/src/socket/socket-v2.ts @@ -22,6 +22,10 @@ function prepareEvent(...args: SocketServerToClientEmitArgs): } else { return [[args[0], args[1]]]; } + } else if (args[0] === "mapData") { + return [["padData", args[1]]]; + } else if (args[0] === "deleteMap") { + return [["deletePad"]]; } else { return [args]; } diff --git a/server/src/socket/socket-v3.ts b/server/src/socket/socket-v3.ts index ddcca15a..d90e6c11 100644 --- a/server/src/socket/socket-v3.ts +++ b/server/src/socket/socket-v3.ts @@ -46,7 +46,7 @@ export class SocketConnectionV3 implements SocketConnection { getMapObjects(mapData: MapData & { writable: Writable }): Promise>> { const promises: PromiseMap>> = { - padData: [ mapData ], + mapData: [ mapData ], view: asyncIteratorToArray(this.database.views.getViews(mapData.id)), type: asyncIteratorToArray(this.database.types.getTypes(mapData.id)), line: asyncIteratorToArray(this.database.lines.getMapLines(mapData.id)) @@ -639,7 +639,7 @@ export class SocketConnectionV3 implements SocketConnection { this.mapId = data.id; - this.emit("padData", { + this.emit("mapData", { ...dataClone, writable: this.writable! }); @@ -648,7 +648,7 @@ export class SocketConnectionV3 implements SocketConnection { deleteMap: (mapId) => { if (mapId == this.mapId) { - this.emit("deletePad"); + this.emit("deleteMap"); this.writable = Writable.READ; } }, diff --git a/server/src/socket/socket.ts b/server/src/socket/socket.ts index 07d1ae28..79a4d170 100644 --- a/server/src/socket/socket.ts +++ b/server/src/socket/socket.ts @@ -67,7 +67,7 @@ export default class Socket { }).then(() => { const remoteAttr = proxyAddr(socket.request, compiledTrust); - const handler = new constructors[version]((...args) => { + const handler = new constructors[version]((...args: any) => { socket.emit.apply(socket, args); }, this.database, remoteAttr); diff --git a/types/src/socket/socket-v2.ts b/types/src/socket/socket-v2.ts index b57aa5f2..370f1954 100644 --- a/types/src/socket/socket-v2.ts +++ b/types/src/socket/socket-v2.ts @@ -91,10 +91,12 @@ export type ResponseDataMapV2 = ReplaceProperties; }>; -export type MapEventsV2 = ReplaceProperties, { marker: [LegacyV2Marker]; type: [LegacyV2Type]; history: [LegacyV2HistoryEntry]; + padData: MapEventsV3["mapData"]; + deletePad: MapEventsV3["deleteMap"]; }>; export function legacyV2MarkerToCurrent, KeepOld extends boolean = false>(marker: M, keepOld?: KeepOld): RenameProperty { diff --git a/types/src/socket/socket-v3.ts b/types/src/socket/socket-v3.ts index 11dcab44..f37df939 100644 --- a/types/src/socket/socket-v3.ts +++ b/types/src/socket/socket-v3.ts @@ -86,8 +86,8 @@ export interface ResponseDataMapV3 { } export interface MapEventsV3Interface { - padData: [MapData & { writable: Writable }]; - deletePad: []; + mapData: [MapData & { writable: Writable }]; + deleteMap: []; marker: [Marker]; deleteMarker: [ObjectWithId]; line: [Line];