import { type Op } from '@geoprotocol/grc-20'; import type { Id } from '../id.js'; import type { RankType, Vote } from './types.js'; /** * Validates every vote and enforces `(entityId, spaceId)` uniqueness within a * rank. A rank may include the same `entityId` under multiple `spaceId`s (ranking * perspectives), so uniqueness is keyed on the pair rather than the entity alone. * The pair is compared after normalizing each ID, so a dashed and a dashless form * of the same UUID still collide. * * For `WEIGHTED` ranks every vote must carry a finite numeric `value` — the `Vote` * union is not discriminated by `rankType`, so this is enforced at runtime to stop * weighted ranks from emitting `undefined` float values. * * @throws When any `entityId`/`spaceId` is invalid, a weighted vote is missing a * finite numeric `value`, or a `(entityId, spaceId)` pair is duplicated. */ export declare function validateVotes(votes: Vote[], rankType: RankType, context: string): void; /** * Builds the vote relation + reified vote entity ops for a rank's votes. * * A fractional index is generated from the array order for every vote and set as * the vote relation's `position`, so clients can order votes natively by the * relation's `position` field. For ordinal ranks the same fractional index is * also stored as the ordinal value on the reified vote entity; weighted ranks * store the provided numeric value. * * Each vote relation also sets `toSpace` to the vote's `spaceId`, scoping the * ranked entity to a space perspective. * * Callers are expected to have validated the votes via {@link validateVotes}. */ export declare function buildVoteOps(rankId: Id | string, rankType: RankType, votes: Vote[]): { ops: Op[]; voteIds: Id[]; }; //# sourceMappingURL=vote-ops.d.ts.map