2024-07-25 02:09:49 +02:00
|
|
|
import axios, {AxiosRequestConfig, AxiosResponse} from "axios";
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2024-07-30 22:03:04 +02:00
|
|
|
export type TriggerAction = 'email' | string
|
|
|
|
|
|
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-07-27 16:45:20 +02:00
|
|
|
jCard: any
|
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-07-27 15:45:04 +02:00
|
|
|
entities: {
|
|
|
|
|
entity: Entity
|
|
|
|
|
events: Event[]
|
|
|
|
|
roles: string[]
|
|
|
|
|
}[]
|
2024-07-25 02:09:49 +02:00
|
|
|
nameservers: Nameserver[]
|
|
|
|
|
tld: Tld
|
2024-07-27 16:45:20 +02:00
|
|
|
deleted: boolean
|
2024-07-25 02:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface User {
|
|
|
|
|
email: string
|
|
|
|
|
roles: string[]
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-16 03:54:48 +02:00
|
|
|
export interface WatchlistRequest {
|
2024-08-03 19:16:58 +02:00
|
|
|
name?: string
|
2024-07-30 22:03:04 +02:00
|
|
|
domains: string[],
|
|
|
|
|
triggers: { event: EventAction, action: TriggerAction }[],
|
|
|
|
|
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 {
|
|
|
|
|
token: string
|
|
|
|
|
name?: string
|
|
|
|
|
domains: Domain[],
|
|
|
|
|
triggers: { event: EventAction, action: TriggerAction }[],
|
|
|
|
|
connector?: string
|
|
|
|
|
createdAt: string
|
2024-08-16 23:57:52 +02:00
|
|
|
dsn?: 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
|
|
|
|
|
domainCount: {tld: string, domain: number}[]
|
|
|
|
|
domainCountTotal: number
|
|
|
|
|
domainTracked: number
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-25 02:09:49 +02:00
|
|
|
export async function request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig): Promise<R> {
|
|
|
|
|
const axiosConfig: AxiosRequestConfig = {
|
|
|
|
|
...config,
|
|
|
|
|
baseURL: '/api',
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
headers: {
|
2024-08-02 01:06:49 +02:00
|
|
|
Accept: 'application/ld+json',
|
2024-07-25 02:09:49 +02:00
|
|
|
...config.headers,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return await axios.request<T, R, D>(axiosConfig)
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-04 15:49:38 +02:00
|
|
|
|
2024-07-25 02:09:49 +02:00
|
|
|
export * from './domain'
|
|
|
|
|
export * from './tld'
|
|
|
|
|
export * from './user'
|
|
|
|
|
export * from './watchlist'
|
|
|
|
|
|
|
|
|
|
|