mirror of
https://github.com/DevVoxel/VectorDNS.git
synced 2026-02-27 01:38:20 +00:00
Add TypeScript types for DNS, WHOIS, availability, and database models
This commit is contained in:
14
lib/types/availability.ts
Normal file
14
lib/types/availability.ts
Normal file
@@ -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;
|
||||
}
|
||||
51
lib/types/database.ts
Normal file
51
lib/types/database.ts
Normal file
@@ -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;
|
||||
}
|
||||
92
lib/types/dns.ts
Normal file
92
lib/types/dns.ts
Normal file
@@ -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<DnsRecordType, string> = {
|
||||
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
|
||||
}
|
||||
4
lib/types/index.ts
Normal file
4
lib/types/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./dns";
|
||||
export * from "./whois";
|
||||
export * from "./availability";
|
||||
export * from "./database";
|
||||
20
lib/types/whois.ts
Normal file
20
lib/types/whois.ts
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user