2024-12-31 13:55:42 +01:00
|
|
|
import type {AxiosRequestConfig, AxiosResponse} from 'axios'
|
|
|
|
|
import axios from 'axios'
|
2024-07-25 02:09:49 +02:00
|
|
|
|
2024-07-27 18:53:07 +02:00
|
|
|
export type EventAction =
|
2024-07-27 13:42:46 +02:00
|
|
|
'registration'
|
|
|
|
|
| 'reregistration'
|
|
|
|
|
| 'last changed'
|
|
|
|
|
| 'expiration'
|
|
|
|
|
| 'deletion'
|
|
|
|
|
| 'reinstantiation'
|
|
|
|
|
| 'transfer'
|
|
|
|
|
| 'locked'
|
|
|
|
|
| 'unlocked'
|
|
|
|
|
| 'last update of RDAP database'
|
|
|
|
|
| 'registrar expiration'
|
|
|
|
|
| 'enum validation expiration'
|
|
|
|
|
| string
|
|
|
|
|
|
2025-05-22 14:00:17 +02:00
|
|
|
export type TriggerAction = 'email' | 'chat'
|
2024-07-30 22:03:04 +02:00
|
|
|
|
2024-07-25 02:09:49 +02:00
|
|
|
export interface Event {
|
2024-07-27 13:42:46 +02:00
|
|
|
action: EventAction
|
2024-07-25 02:09:49 +02:00
|
|
|
date: string
|
2024-09-01 21:26:07 +02:00
|
|
|
deleted: boolean
|
2024-07-25 02:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Entity {
|
|
|
|
|
handle: string
|
2024-12-30 23:50:15 +01:00
|
|
|
jCard: ['vcard', Array<[
|
|
|
|
|
string,
|
|
|
|
|
{ [key: string]: string | string[] },
|
|
|
|
|
string,
|
|
|
|
|
string | string[],
|
|
|
|
|
]>] | []
|
2024-07-25 02:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Nameserver {
|
|
|
|
|
ldhName: string
|
|
|
|
|
entities: Entity[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Tld {
|
|
|
|
|
tld: string
|
|
|
|
|
contractTerminated: boolean
|
|
|
|
|
dateOfContractSignature: string
|
|
|
|
|
registryOperator: string
|
|
|
|
|
delegationDate: string
|
|
|
|
|
removalDate: string
|
|
|
|
|
specification13: boolean
|
|
|
|
|
type: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Domain {
|
|
|
|
|
ldhName: string
|
|
|
|
|
handle: string
|
|
|
|
|
status: string[]
|
|
|
|
|
events: Event[]
|
2024-12-30 23:50:15 +01:00
|
|
|
entities: Array<{
|
2024-07-27 15:45:04 +02:00
|
|
|
entity: Entity
|
|
|
|
|
events: Event[]
|
|
|
|
|
roles: string[]
|
2024-09-04 18:09:42 +02:00
|
|
|
deleted: boolean
|
2024-12-30 23:50:15 +01:00
|
|
|
}>
|
2024-07-25 02:09:49 +02:00
|
|
|
nameservers: Nameserver[]
|
|
|
|
|
tld: Tld
|
2024-07-27 16:45:20 +02:00
|
|
|
deleted: boolean
|
2024-09-09 11:31:33 +02:00
|
|
|
updatedAt: string
|
2024-12-30 14:31:31 +01:00
|
|
|
delegationSigned: boolean
|
2025-01-01 22:00:05 +01:00
|
|
|
expiresInDays?: number
|
2024-07-25 02:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface User {
|
|
|
|
|
email: string
|
|
|
|
|
roles: string[]
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-22 14:00:17 +02:00
|
|
|
export interface WatchlistTrigger {
|
|
|
|
|
event: EventAction
|
|
|
|
|
action: TriggerAction
|
|
|
|
|
watchList?: string
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-16 03:54:48 +02:00
|
|
|
export interface WatchlistRequest {
|
2024-08-03 19:16:58 +02:00
|
|
|
name?: string
|
2024-12-30 23:50:15 +01:00
|
|
|
domains: string[]
|
2025-05-22 14:00:17 +02:00
|
|
|
triggers?: Array<WatchlistTrigger>
|
2024-07-30 22:03:04 +02:00
|
|
|
connector?: string
|
2024-08-16 23:57:52 +02:00
|
|
|
dsn?: string[]
|
2024-07-25 02:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-16 03:54:48 +02:00
|
|
|
export interface Watchlist {
|
2025-05-22 14:00:17 +02:00
|
|
|
'@id': string
|
2024-08-16 03:54:48 +02:00
|
|
|
name?: string
|
2024-12-30 23:50:15 +01:00
|
|
|
token: string
|
|
|
|
|
domains: Domain[]
|
2025-05-22 14:00:17 +02:00
|
|
|
triggers?: Array<WatchlistTrigger>
|
2024-08-16 23:57:52 +02:00
|
|
|
dsn?: string[]
|
2024-12-30 23:50:15 +01:00
|
|
|
connector?: {
|
|
|
|
|
id: string
|
|
|
|
|
provider: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
}
|
|
|
|
|
createdAt: string
|
2024-08-16 03:54:48 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-04 15:49:38 +02:00
|
|
|
export interface InstanceConfig {
|
|
|
|
|
ssoLogin: boolean
|
|
|
|
|
limtedFeatures: boolean
|
2024-08-05 03:11:03 +02:00
|
|
|
registerEnabled: boolean
|
2024-08-04 15:49:38 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-22 19:26:34 +02:00
|
|
|
export interface Statistics {
|
|
|
|
|
rdapQueries: number
|
|
|
|
|
alertSent: number
|
|
|
|
|
domainPurchased: number
|
|
|
|
|
domainPurchaseFailed: number
|
2024-12-30 23:50:15 +01:00
|
|
|
domainCount: Array<{ tld: string, domain: number }>
|
2024-08-22 19:26:34 +02:00
|
|
|
domainCountTotal: number
|
|
|
|
|
domainTracked: number
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-30 23:50:15 +01:00
|
|
|
export interface TrackedDomains {
|
|
|
|
|
'hydra:totalItems': number
|
|
|
|
|
'hydra:member': Domain[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function request<T = object, R = AxiosResponse<T>, D = object>(config: AxiosRequestConfig): Promise<R> {
|
2024-07-25 02:09:49 +02:00
|
|
|
const axiosConfig: AxiosRequestConfig = {
|
|
|
|
|
...config,
|
|
|
|
|
baseURL: '/api',
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
headers: {
|
2024-08-02 01:06:49 +02:00
|
|
|
Accept: 'application/ld+json',
|
2024-12-30 23:50:15 +01:00
|
|
|
...config.headers
|
2024-07-25 02:09:49 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return await axios.request<T, R, D>(axiosConfig)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export * from './domain'
|
|
|
|
|
export * from './tld'
|
|
|
|
|
export * from './user'
|
|
|
|
|
export * from './watchlist'
|