Remove SCUM sqlite user projections

This commit is contained in:
npc0-hue
2026-09-14 13:41:44 +08:00
parent b1f102bafb
commit ecdca8e28b
76 changed files with 2264 additions and 1558 deletions
+22 -8
View File
@@ -23,6 +23,11 @@ const apiMocks = vi.hoisted(() => ({
listGamePlugins: vi.fn(),
listLogStreams: vi.fn(),
listPluginData: vi.fn(),
listScumUsers: vi.fn(),
listScumUserTrajectories: vi.fn(),
listScumVehicles: vi.fn(),
listScumVehicleTrajectories: vi.fn(),
listScumVehicleLocks: vi.fn(),
putPluginData: vi.fn(),
queueGameClientBridgeCommand: vi.fn(),
queryLogStream: vi.fn(),
@@ -99,6 +104,11 @@ beforeEach(() => {
apiMocks.getGameClientBridgeCommand.mockResolvedValue({ id: "command-1" });
apiMocks.listGameClientBridgeCommands.mockResolvedValue({ items: [], count: 0 });
apiMocks.listGameClientBridgeSnapshots.mockResolvedValue({ items: [], count: 0 });
apiMocks.listScumUsers.mockResolvedValue({ items: [], count: 0 });
apiMocks.listScumUserTrajectories.mockResolvedValue({ items: [], count: 0 });
apiMocks.listScumVehicles.mockResolvedValue({ items: [], count: 0 });
apiMocks.listScumVehicleTrajectories.mockResolvedValue({ items: [], count: 0 });
apiMocks.listScumVehicleLocks.mockResolvedValue({ items: [], count: 0 });
apiMocks.listLogStreams.mockResolvedValue({ items: [{ id: "stream-login", serverInstanceId: "server-1", source: "file", streamKey: "scum.login", latestSeq: 2, storageBackend: "local-segments", retentionPolicy: "default", createdAt: "2026-08-15T12:00:00Z", updatedAt: "2026-08-15T12:00:00Z" }], count: 1 });
apiMocks.queryLogStream.mockResolvedValue({ logStreamId: "stream-login", entries: [], nextSeq: 2, latestSeq: 2 });
apiMocks.executePluginBridge.mockResolvedValue({ requestId: "request-1", action: "server.instances.read", status: "ok", result: { state: "ready" } });
@@ -208,28 +218,32 @@ describe("PluginPageHostPage", () => {
const snapshotQuery = { profileKey: "example-client", type: "example.positions", streamKey: "current", limit: 50 };
const dispatchEnvelope = { requestId: "request-1", action: "server.instances.read" as const, payload: { view: "summary" } };
await actions?.pluginData?.list("scum_users", "user-1");
await actions?.pluginData?.put("scum_users", "user-1", { name: "Ada" });
await actions?.pluginData?.delete("scum_users", "user-2");
await actions?.pluginData?.transact("scum_users", mutations);
await actions?.pluginData?.list("plugin_users", "user-1");
await actions?.pluginData?.put("plugin_users", "user-1", { name: "Ada" });
await actions?.pluginData?.delete("plugin_users", "user-2");
await actions?.pluginData?.transact("plugin_users", mutations);
await actions?.gameClient?.queue(queueRequest);
await actions?.gameClient?.get("command-1");
await actions?.gameClient?.list(commandFilter);
await actions?.gameClient?.snapshots(snapshotQuery);
await actions?.logs?.listStreams();
await actions?.logs?.query({ logStreamId: "stream-login", afterSeq: 1, limit: 50 });
await actions?.scum?.users({ limit: 10, online: true });
await actions?.scum?.vehicleLocks({ limit: 10, gameVehicleId: "veh-1" });
await expect(actions?.dispatch?.(dispatchEnvelope)).resolves.toMatchObject({ status: "ok", result: { state: "ready" } });
expect(apiMocks.listPluginData).toHaveBeenCalledWith("server-1", "scum_users", "user-1");
expect(apiMocks.putPluginData).toHaveBeenCalledWith("server-1", "scum_users", "user-1", { name: "Ada" });
expect(apiMocks.deletePluginData).toHaveBeenCalledWith("server-1", "scum_users", "user-2");
expect(apiMocks.transactPluginData).toHaveBeenCalledWith("server-1", "scum_users", mutations);
expect(apiMocks.listPluginData).toHaveBeenCalledWith("server-1", "plugin_users", "user-1");
expect(apiMocks.putPluginData).toHaveBeenCalledWith("server-1", "plugin_users", "user-1", { name: "Ada" });
expect(apiMocks.deletePluginData).toHaveBeenCalledWith("server-1", "plugin_users", "user-2");
expect(apiMocks.transactPluginData).toHaveBeenCalledWith("server-1", "plugin_users", mutations);
expect(apiMocks.queueGameClientBridgeCommand).toHaveBeenCalledWith("server-1", queueRequest);
expect(apiMocks.getGameClientBridgeCommand).toHaveBeenCalledWith("server-1", "command-1");
expect(apiMocks.listGameClientBridgeCommands).toHaveBeenCalledWith("server-1", commandFilter);
expect(apiMocks.listGameClientBridgeSnapshots).toHaveBeenCalledWith("server-1", snapshotQuery);
expect(apiMocks.listLogStreams).toHaveBeenCalledWith("server-1");
expect(apiMocks.queryLogStream).toHaveBeenCalledWith({ logStreamId: "stream-login", afterSeq: 1, limit: 50 });
expect(apiMocks.listScumUsers).toHaveBeenCalledWith("server-1", { limit: 10, online: true });
expect(apiMocks.listScumVehicleLocks).toHaveBeenCalledWith("server-1", { limit: 10, gameVehicleId: "veh-1" });
expect(apiMocks.executePluginBridge).toHaveBeenCalledWith({
requestId: "request-1",
pluginId: "game.scum",