// ── SQL for Backpacks (PLAN_REDESIGNS §11.3.2) ──────────────────────────── // // What each server's last hello said about Backpacks. The backpacks themselves // are never stored (§11.3.2: live, never stored); this file only reads the // report the plugin makes about the plugin. const core = require('../../core') const STATE = 'rust_server_state' /** * One server's report: `{ serverId, backpacks }`, with `backpacks` as the * driver hands JSON_EXTRACT back — text, or null for a server whose plugin * never said (no state yet, or a plugin before protocol 14). */ async function reportFor(serverId) { const rows = await core.query( `SELECT server_id AS serverId, JSON_EXTRACT(raw, '$.integrations.backpacks') AS backpacks FROM ${STATE} WHERE server_id = ?`, [serverId], ) return rows[0] || null } /** Every server's report, for the step's size list. */ async function reports() { return core.query( `SELECT server_id AS serverId, JSON_EXTRACT(raw, '$.integrations.backpacks') AS backpacks FROM ${STATE}`, ) } module.exports = { reportFor, reports }