Preserve room JSON, seats, credentials and messages while removed rooms deny ordinary reads and writes. Add deliberate room-scoped controls, removed-directory filters, persistent player notices and live-authorized atomic version/revision audit receipts. Retain uncertain room/seat requests and hidden recovery drafts through removal; restore the prior pause/join settings without reviving revoked credentials. Fix AI readiness after a joining human or human faction change so real lobby starts remain legal. Verified types, lint, 5314 offline tests, 52 HTTP tests and build. Fourteen authenticated HTTP groups and independent privacy/persistence review passed. Desktop/mobile browser QA confirmed a saved removal after a lost response and refresh, one audit on exact retry, persistent notices and recovery draft continuity. All 1,945 baseline rooms, 4,121 seats and related records preserved. Positive authenticated production admin acceptance remains pending authorized QA operator access; full admin and rules gates remain open.
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
export type AdminRemovalInput = {
|
|
operationId: string;
|
|
expectedVersion: number;
|
|
expectedRevision: number;
|
|
removed: boolean;
|
|
reason: string;
|
|
};
|
|
|
|
export type AdminRemovalView = {
|
|
code: string;
|
|
version: number;
|
|
removed: boolean;
|
|
revision: number;
|
|
removedAt: number | null;
|
|
updatedAt: number | null;
|
|
paused: boolean;
|
|
joinLocked: boolean;
|
|
};
|
|
|
|
export type AdminRemovalResult = {
|
|
operationId: string;
|
|
replayed: boolean;
|
|
appliedRevision: number;
|
|
appliedVersion: number;
|
|
room: AdminRemovalView;
|
|
};
|
|
|
|
export function validAdminRemovalInput(
|
|
value: unknown,
|
|
): value is AdminRemovalInput {
|
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
const input = value as Record<string, unknown>;
|
|
const fields = [
|
|
'operationId',
|
|
'expectedVersion',
|
|
'expectedRevision',
|
|
'removed',
|
|
'reason',
|
|
];
|
|
return (
|
|
Object.keys(input).length === fields.length &&
|
|
fields.every((field) => Object.hasOwn(input, field)) &&
|
|
typeof input.operationId === 'string' &&
|
|
input.operationId.length === 36 &&
|
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(
|
|
input.operationId,
|
|
) &&
|
|
[input.expectedVersion, input.expectedRevision].every(
|
|
(version) =>
|
|
Number.isSafeInteger(version) &&
|
|
Number(version) >= 0 &&
|
|
Number(version) < Number.MAX_SAFE_INTEGER,
|
|
) &&
|
|
typeof input.removed === 'boolean' &&
|
|
typeof input.reason === 'string' &&
|
|
!!input.reason.trim() &&
|
|
input.reason.length <= 300 &&
|
|
!input.reason
|
|
.split('')
|
|
.some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127)
|
|
);
|
|
}
|