@hasna/domains
Version:
Domain portfolio, registrar, marketplace, and DNS management for AI agents — CLI + MCP + HTTP API + SDK, shared account API and PostgreSQL
96 lines • 5.07 kB
TypeScript
/**
* PG-backed repository for the domains-serve HTTP API.
*
* PURE REMOTE (Amendment A1): every call reads and writes the app's cloud
* Postgres directly through the vendored storage kit's typed query client.
* There is no cache, no local mirror, and no sync engine here — that degraded
* client behaviour lives in the CLIENT, out of scope for the service.
*
* The row shapes mirror the local SQLite model in `src/db`, but the storage is
* native Postgres: booleans are real BOOLEAN columns and the JSON columns
* (nameservers / whois / metadata) are TEXT holding JSON strings.
*/
import type { TypedQueryClient } from "../generated/storage-kit/index.js";
import type { Domain, CreateDomainInput, UpdateDomainInput, DomainStats, DomainOffer, CreateDomainOfferInput } from "../db/domain-records.js";
import type { DnsRecord, CreateDnsRecordInput, UpdateDnsRecordInput } from "../db/dns-records.js";
import type { Alert, CreateAlertInput } from "../db/alerts.js";
import type { DomainEmailLink, CreateDomainEmailLinkInput } from "../db/domain-records.js";
import type { DomainOwner, CreateDomainOwnerInput, DomainWithOwner } from "../db/domain-owners.js";
import type { DomainHistory, CreateHistoryEntryInput } from "../db/domain-history.js";
import type { DomainReputation, CreateReputationInput } from "../db/domain-reputation.js";
export declare class HttpError extends Error {
readonly status: number;
constructor(status: number, message: string);
}
/** Repository bound to a typed query client (the vendored kit's cloud pool). */
export declare class DomainsRepo {
private readonly db;
constructor(db: TypedQueryClient);
createDomain(input: CreateDomainInput): Promise<Domain>;
getDomain(id: string): Promise<Domain | null>;
getDomainByName(name: string): Promise<Domain | null>;
listDomains(opts: {
search?: string;
status?: string;
limit?: number;
offset?: number;
}): Promise<Domain[]>;
updateDomain(id: string, patch: UpdateDomainInput): Promise<Domain | null>;
deleteDomain(id: string): Promise<boolean>;
countDomains(): Promise<number>;
getStats(): Promise<DomainStats>;
listDnsRecords(domainId: string): Promise<DnsRecord[]>;
createDnsRecord(domainId: string, input: CreateDnsRecordInput): Promise<DnsRecord>;
getDnsRecord(id: string): Promise<DnsRecord | null>;
deleteDnsRecord(id: string): Promise<boolean>;
listOffers(domainId: string): Promise<DomainOffer[]>;
createOffer(domainId: string, input: CreateDomainOfferInput): Promise<DomainOffer>;
getOffer(id: string): Promise<DomainOffer | null>;
updateDnsRecord(id: string, patch: UpdateDnsRecordInput): Promise<DnsRecord | null>;
listEmailLinks(domainId: string): Promise<DomainEmailLink[]>;
getEmailLink(id: string): Promise<DomainEmailLink | null>;
linkEmail(domainId: string, input: Omit<CreateDomainEmailLinkInput, "domain_id">): Promise<DomainEmailLink>;
listAlerts(domainId: string): Promise<Alert[]>;
getAlert(id: string): Promise<Alert | null>;
createAlert(domainId: string, input: Omit<CreateAlertInput, "domain_id">): Promise<Alert>;
deleteAlert(id: string): Promise<boolean>;
private ownerRow;
listOwnersForDomain(domainId: string): Promise<DomainOwner[]>;
listOwners(opts: {
search?: string;
source?: string;
verified?: boolean;
}): Promise<DomainOwner[]>;
getOwner(id: string): Promise<DomainOwner | null>;
createOwner(domainId: string, input: Omit<CreateDomainOwnerInput, "domain_id">): Promise<DomainOwner>;
updateOwner(id: string, patch: Partial<CreateDomainOwnerInput>): Promise<DomainOwner | null>;
deleteOwner(id: string): Promise<boolean>;
listDomainsWithOwners(): Promise<DomainWithOwner[]>;
private historyRow;
createHistory(domainId: string, input: Omit<CreateHistoryEntryInput, "domain_id">): Promise<DomainHistory>;
getHistory(id: string): Promise<DomainHistory | null>;
listHistory(domainId: string, opts: {
type?: string;
limit?: number;
}): Promise<DomainHistory[]>;
listHistoryByDateRange(start: string, end: string, domainId?: string): Promise<DomainHistory[]>;
deleteHistory(id: string): Promise<boolean>;
deleteHistoryByDomain(domainId: string): Promise<boolean>;
listHistoryChanges(): Promise<Array<{
domain_id: string;
domain_name: string;
latest_snapshot_type: string;
latest_snapshot_at: string;
snapshot_count: number;
}>>;
private reputationRow;
getReputation(domainId: string): Promise<DomainReputation | null>;
upsertReputation(domainId: string, input: Omit<CreateReputationInput, "domain_id">): Promise<DomainReputation>;
updateReputation(id: string, patch: Partial<CreateReputationInput>): Promise<DomainReputation | null>;
deleteReputation(id: string): Promise<boolean>;
listReputation(opts: {
blacklisted?: boolean;
threshold?: number;
}): Promise<DomainReputation[]>;
}
//# sourceMappingURL=repo.d.ts.map