diff --git a/lib/types/availability.ts b/lib/types/availability.ts new file mode 100644 index 0000000..5d3d559 --- /dev/null +++ b/lib/types/availability.ts @@ -0,0 +1,14 @@ +export interface AvailabilityResult { + domainName: string; + available: boolean; + rdapStatus: string[] | null; +} + +export interface AvailabilityCheckRequest { + domain: string; +} + +export interface AvailabilityCheckResponse { + result: AvailabilityResult; + queriedAt: string; +} diff --git a/lib/types/database.ts b/lib/types/database.ts new file mode 100644 index 0000000..9724607 --- /dev/null +++ b/lib/types/database.ts @@ -0,0 +1,51 @@ +import type { DNSRecord } from "./dns"; + +export interface Profile { + id: string; + email: string; + displayName: string | null; + avatarUrl: string | null; + notificationEmail: boolean; + createdAt: string; + updatedAt: string; +} + +export interface SavedDomain { + id: string; + userId: string; + domain: string; + notes: string | null; + tags: string[]; + createdAt: string; + updatedAt: string; +} + +export interface DnsHistory { + id: string; + savedDomainId: string; + records: DNSRecord[]; + checkedAt: string; +} + +export interface AvailabilityHistory { + id: string; + savedDomainId: string; + available: boolean; + rdapStatus: string[] | null; + checkedAt: string; +} + +export type NotificationType = + | "dns_change" + | "availability_change" + | "expiry_warning"; + +export interface Notification { + id: string; + userId: string; + savedDomainId: string; + type: NotificationType; + message: string; + read: boolean; + createdAt: string; +} diff --git a/lib/types/dns.ts b/lib/types/dns.ts new file mode 100644 index 0000000..77b41f4 --- /dev/null +++ b/lib/types/dns.ts @@ -0,0 +1,92 @@ +export interface ARecord { + type: "A"; + address: string; +} + +export interface AAAARecord { + type: "AAAA"; + address: string; +} + +export interface CNAMERecord { + type: "CNAME"; + target: string; +} + +export interface NSRecord { + type: "NS"; + nameserver: string; +} + +export interface MXRecord { + type: "MX"; + priority: number; + exchange: string; +} + +export interface TXTRecord { + type: "TXT"; + values: string[]; +} + +export interface SOARecord { + type: "SOA"; + nsname: string; + hostmaster: string; + serial: number; + refresh: number; + retry: number; + expire: number; + minttl: number; +} + +export interface CAARecord { + type: "CAA"; + critical: number; + iodef?: string; + issue?: string; + issuewild?: string; +} + +export interface SRVRecord { + type: "SRV"; + priority: number; + weight: number; + port: number; + name: string; +} + +export type DNSRecord = + | ARecord + | AAAARecord + | CNAMERecord + | NSRecord + | MXRecord + | TXTRecord + | SOARecord + | CAARecord + | SRVRecord; + +export type DnsRecordType = DNSRecord["type"]; + +export const DNS_RECORD_DESCRIPTIONS: Record = { + A: "IPv4 Address", + AAAA: "IPv6 Address", + CNAME: "Alias Target", + NS: "Nameserver", + MX: "Mail Server Exchange", + TXT: "Text Chunk Array", + SOA: "Start of Authority", + CAA: "Certificate Authority", + SRV: "Service Locator", +}; + +export interface DnsLookupRequest { + domain: string; +} + +export interface DnsLookupResponse { + domain: string; + records: DNSRecord[]; + queriedAt: string; // ISO Timestamp +} diff --git a/lib/types/index.ts b/lib/types/index.ts new file mode 100644 index 0000000..ac86d28 --- /dev/null +++ b/lib/types/index.ts @@ -0,0 +1,4 @@ +export * from "./dns"; +export * from "./whois"; +export * from "./availability"; +export * from "./database"; diff --git a/lib/types/whois.ts b/lib/types/whois.ts new file mode 100644 index 0000000..bfd89e7 --- /dev/null +++ b/lib/types/whois.ts @@ -0,0 +1,20 @@ +export interface WhoIsResult { + domainName: string; + registrar: string | null; + createdDate: string | null; + updatedDate: string | null; + expiresDate: string | null; + nameservers: string[]; + status: string[]; + dnssec: string | null; +} + +export interface WhoIsLookupRequest { + domain: string; +} + +export interface WhoIsLookupResponse { + domain: string; + result: WhoIsResult; + queriedAt: string; +}