Files
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

35 lines
984 B
TypeScript

import type {
onDisconnectPayload,
onLoadDocumentPayload,
Extension,
connectedPayload,
onConnectPayload,
} from "@hocuspocus/server";
import Logger from "@server/logging/Logger";
import type { withContext } from "./types";
export default class LoggerExtension implements Extension {
async onLoadDocument(data: withContext<onLoadDocumentPayload>) {
Logger.info("multiplayer", `Loaded document "${data.documentName}"`, {
userId: data.context.user?.id,
});
}
async onConnect(data: withContext<onConnectPayload>) {
Logger.info("multiplayer", `New connection to "${data.documentName}"`);
}
async connected(data: withContext<connectedPayload>) {
Logger.info(
"multiplayer",
`Authenticated connection to "${data.documentName}"`
);
}
async onDisconnect(data: withContext<onDisconnectPayload>) {
Logger.info("multiplayer", `Closed connection to "${data.documentName}"`, {
userId: data.context.user?.id,
});
}
}