import type { SchemaMetadata } from '../schema/types'; import type { DetailedResolution, Operation, Policy, PolicyContext, ResolvedPolicies } from './types'; /** * Build an immutable resolver from a registry. The registry is built by * the OGM constructor after schema validation. * * The resolver is the single place where "which policies fire for this * (type, op, ctx)" is decided. Both compilers and the model wrappers use * the same resolver instance, so behavior stays consistent. */ export declare class PolicyResolver { private readonly registry; private readonly schema; constructor(registry: ReadonlyMap>>, schema: SchemaMetadata); /** Whether ANY policies are configured. Used to skip work in non-policy paths. */ hasAny(): boolean; /** * Resolve the policy set for `(typeName, op, ctx)`. Considers both the * concrete type's own policies AND inherited interface policies (per * v1.7.0 inheritance rule: AND-restrictive, OR-permissive). * * Returns `null` when no policies are registered anywhere applicable * to this type (so call sites can short-circuit and emit byte- * identical Cypher). */ resolve(typeName: string, op: Operation, ctx: C): ResolvedPolicies | null; /** * Resolve every operation-matching policy for `(typeName, op, ctx)` * WITHOUT dropping any: `applied` records the `appliesWhen(ctx)` gate * (or, for overrides, `when(ctx)`), and `skipped` marks policies never * evaluated because an earlier override fired. This is the single place * the resolver invokes `appliesWhen`; `resolve()` projects from it. * * Callback invocation order is unchanged from the pre-explain resolver: * override `when` callbacks first (stopping at the first that fires), * then `appliesWhen` in registration order — skipped entirely when an * override fired. * * Returns `null` exactly when `resolve()` does. */ resolveDetailed(typeName: string, op: Operation, ctx: C): DetailedResolution | null; /** * Gather all sources of policy that apply to a given concrete type: * the type's own list, plus any interfaces it implements — each tagged * with the registry key that declared it. */ private gatherSources; } /** * Project a detailed resolution onto the `ResolvedPolicies` shape the * compilers consume. `PolicyResolver.resolve()` is exactly * `projectResolution(resolveDetailed(...))`; the explain path calls it on * the SAME detailed object it reports on, so the compiled fragments stay * positionally aligned with the reported entries. */ export declare function projectResolution(detailed: DetailedResolution): ResolvedPolicies; /** * Stable, value-free fingerprint of a context object. Used in audit * metadata so query logs can be correlated by ctx-shape WITHOUT leaking * any sensitive ctx values. Hashes the SORTED key list only. * * Truncated to 16 hex chars — collision resistance is not the goal here. * Documented as NOT a security primitive. */ export declare function hashCtx(ctx: PolicyContext | undefined): string; //# sourceMappingURL=resolver.d.ts.map