import { ValidationError } from "../core/index.js";
export function entityKey(entity) {
    return `${entity.id}:${entity.generation}`;
}
export function sameEntity(a, b) {
    return a.id === b.id && a.generation === b.generation;
}
export function assertEntity(entity) {
    if (!Number.isSafeInteger(entity.id) || entity.id < 0)
        throw new ValidationError("ENTITY_ID", "Entity id must be a non-negative safe integer.");
    if (!Number.isSafeInteger(entity.generation) || entity.generation < 0)
        throw new ValidationError("ENTITY_GENERATION", "Entity generation must be a non-negative safe integer.");
}
//# sourceMappingURL=Entity.js.map