/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Reads and audits the address-source register. */ import type { PathBuilderLike } from "path-ts"; import { SourceOperation, type AddressSourceRecord, type AddressSourceRegister, type LicenseDecision, type OperationDecision } from "#source-register/types"; /** * Resolves the path of the committed register through the package's `./data/*` export. * * Resolution happens on call so that importing this module works before the build has written the register. */ export declare function addressSourceRegisterPath(): string; /** * Returns the license label that the exclude filter in `@mailwoman/corpus/utils/license` matches by prefix. * * The function returns `undefined` until someone has elected terms for the decision. */ export declare function electedLicenseLabel(decision: LicenseDecision): string | undefined; /** * Replaces generated license decisions with recorded ones that share a license id. * * The build generates an `unchecked` decision for each license and rewrites the register * whole, so reviewed decisions live in a separate input and merge here. * * @throws When a recorded decision refers to a license that the generated set lacks. * Such a decision is a typo or refers to a removed source. */ export declare function applyLicenseDecisions(generated: readonly LicenseDecision[], recorded: ReadonlyMap): LicenseDecision[]; /** * The operations that ingesting a source into the corpus performs. * * Redistribution and commercial sublicensing happen at release, so this list omits them. */ export declare const INGEST_OPERATIONS: readonly SourceOperation[]; /** * The operations that releasing a model trained on a source adds to {@link INGEST_OPERATIONS}. */ export declare const MODEL_RELEASE_OPERATIONS: readonly SourceOperation[]; /** * Returns the recorded permission for one operation under a license decision. * * The result is `unreviewed` when the decision is not elected or does not mention the operation. * The selected terms establish which terms apply. * Each operation still needs its own review. */ export declare function permissionFor(decision: LicenseDecision, operation: SourceOperation): OperationDecision; /** * Returns every reason that a source may not enter a training corpus, or an empty array when it may. * * The function returns reasons so that callers can tell the different blockers apart. */ export declare function ingestEligibilityProblems(source: AddressSourceRecord, register: AddressSourceRegister, operations?: readonly SourceOperation[]): readonly string[]; /** * Returns one message for each structural problem in a register. * * The content digest is checked separately on read, because the build audits registers * before it writes a digest. */ export declare function auditAddressSourceRegister(register: AddressSourceRegister): string[]; /** * Computes the SHA-256 digest of the register without its `contentDigest` field. * * The build and the read audit share this function so that they serialize identically. * The digest covers the parsed object, so reformatting the file keeps it valid. * * Key order is part of the serialization, so reordering keys by hand changes the digest. */ export declare function registerContentDigest(register: AddressSourceRegister): string; /** * Reads the committed register and checks its digest and structure. * * @throws When the file does not parse or the audit reports a problem. * The message lists every problem. */ export declare function readAddressSourceRegister(path?: PathBuilderLike): Promise; //# sourceMappingURL=register.d.ts.map