Files
cloudflare-domain-manager/packages/shared/dist/index.d.ts
T
Denozordec d11414666f
Build, Test, and Push CFDM Docker Image / test (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / build-and-push (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / create-release (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / update-wiki (push) Has been cancelled
Refactor project to transition from Rust backend to Node.js with Fastify; update Dockerfile and Docker configurations for new build process; enhance local development instructions in CONTRIBUTING.md; implement health checks in Docker Compose; update pnpm-lock.yaml with new dependencies for API and shared packages; revise README.md to reflect new stack and development setup.
2026-06-19 12:06:32 +07:00

558 lines
20 KiB
TypeScript

import { z } from 'zod';
declare const SYNC_SYNCED = "synced";
declare const SYNC_PENDING_PUSH = "pending_push";
declare const SYNC_PENDING_DELETE = "pending_delete";
declare const SYNC_CONFLICT = "conflict";
declare const SYNC_ERROR = "error";
declare const CERT_OK = "ok";
declare const CERT_WARNING = "warning";
declare const CERT_EXPIRED = "expired";
declare const CERT_ERROR = "error";
declare const CERT_UNKNOWN = "unknown";
declare class ValidationError extends Error {
constructor(message: string);
}
declare function validateDnsRecord(recordType: string, name: string, content: string, ttl: number, proxied: boolean): void;
declare function certStatusFromExpiry(daysLeft: number): string;
declare function isValidIpv4(ip: string): boolean;
declare function dnsNameToSubdomainLabel(recordName: string, zoneName: string): string | null;
declare function subdomainLabelToFqdn(label: string, zoneName: string): string;
interface ParsedFqdn {
zoneName: string;
hostname: string;
fqdn: string;
}
declare function fqdnToDisplay(hostname: string, zoneName: string): string;
declare function parseFqdn(fqdn: string, knownZones: string[]): ParsedFqdn | null;
declare function bindingToFqdn(binding: {
hostname: string;
zone_name: string;
fqdn?: string;
}): string;
declare const groupSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
slug: z.ZodString;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
declare const groupWithStatsSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
slug: z.ZodString;
created_at: z.ZodString;
updated_at: z.ZodString;
domain_count: z.ZodNumber;
}, z.core.$strip>;
declare const serviceGroupTypeSchema: z.ZodEnum<{
vpn: "vpn";
network: "network";
internet: "internet";
bgp: "bgp";
custom: "custom";
}>;
declare const serviceGroupSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
type: z.ZodCatch<z.ZodEnum<{
vpn: "vpn";
network: "network";
internet: "internet";
bgp: "bgp";
custom: "custom";
}>>;
icon: z.ZodNullable<z.ZodString>;
domain: z.ZodNullable<z.ZodString>;
enabled: z.ZodBoolean;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
declare const serviceSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
slug: z.ZodString;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
subdomain: z.ZodOptional<z.ZodString>;
enabled: z.ZodOptional<z.ZodBoolean>;
computed_fqdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
declare const serviceDomainBindingSchema: z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
domain_id: z.ZodNumber;
zone_name: z.ZodString;
hostname: z.ZodString;
fqdn: z.ZodString;
target_ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
target_ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sync_status: z.ZodNullable<z.ZodString>;
}, z.core.$strip>, z.ZodTransform<{
target_ips: string[];
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ip?: string | null | undefined;
}, {
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ips?: string[] | undefined;
target_ip?: string | null | undefined;
}>>;
declare const serviceViewSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
slug: z.ZodString;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
computed_fqdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
domain_id: z.ZodNumber;
zone_name: z.ZodString;
hostname: z.ZodString;
fqdn: z.ZodString;
target_ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
target_ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sync_status: z.ZodNullable<z.ZodString>;
}, z.core.$strip>, z.ZodTransform<{
target_ips: string[];
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ip?: string | null | undefined;
}, {
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ips?: string[] | undefined;
target_ip?: string | null | undefined;
}>>>>;
}, z.core.$strip>;
declare const serviceGroupViewSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
type: z.ZodCatch<z.ZodEnum<{
vpn: "vpn";
network: "network";
internet: "internet";
bgp: "bgp";
custom: "custom";
}>>;
icon: z.ZodNullable<z.ZodString>;
domain: z.ZodNullable<z.ZodString>;
enabled: z.ZodBoolean;
created_at: z.ZodString;
updated_at: z.ZodString;
services: z.ZodDefault<z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
slug: z.ZodString;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
computed_fqdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
domain_id: z.ZodNumber;
zone_name: z.ZodString;
hostname: z.ZodString;
fqdn: z.ZodString;
target_ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
target_ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sync_status: z.ZodNullable<z.ZodString>;
}, z.core.$strip>, z.ZodTransform<{
target_ips: string[];
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ip?: string | null | undefined;
}, {
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ips?: string[] | undefined;
target_ip?: string | null | undefined;
}>>>>;
}, z.core.$strip>>>;
}, z.core.$strip>;
declare const serviceGroupsResponseSchema: z.ZodObject<{
groups: z.ZodDefault<z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
type: z.ZodCatch<z.ZodEnum<{
vpn: "vpn";
network: "network";
internet: "internet";
bgp: "bgp";
custom: "custom";
}>>;
icon: z.ZodNullable<z.ZodString>;
domain: z.ZodNullable<z.ZodString>;
enabled: z.ZodBoolean;
created_at: z.ZodString;
updated_at: z.ZodString;
services: z.ZodDefault<z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
slug: z.ZodString;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
computed_fqdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
domain_id: z.ZodNumber;
zone_name: z.ZodString;
hostname: z.ZodString;
fqdn: z.ZodString;
target_ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
target_ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sync_status: z.ZodNullable<z.ZodString>;
}, z.core.$strip>, z.ZodTransform<{
target_ips: string[];
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ip?: string | null | undefined;
}, {
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ips?: string[] | undefined;
target_ip?: string | null | undefined;
}>>>>;
}, z.core.$strip>>>;
}, z.core.$strip>>>;
ungrouped: z.ZodDefault<z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
slug: z.ZodString;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
computed_fqdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
domain_id: z.ZodNumber;
zone_name: z.ZodString;
hostname: z.ZodString;
fqdn: z.ZodString;
target_ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
target_ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sync_status: z.ZodNullable<z.ZodString>;
}, z.core.$strip>, z.ZodTransform<{
target_ips: string[];
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ip?: string | null | undefined;
}, {
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
sync_status: string | null;
target_ips?: string[] | undefined;
target_ip?: string | null | undefined;
}>>>>;
}, z.core.$strip>>>;
}, z.core.$strip>;
declare const domainSchema: z.ZodObject<{
id: z.ZodNumber;
group_id: z.ZodNullable<z.ZodNumber>;
zone_name: z.ZodString;
cf_zone_id: z.ZodString;
status: z.ZodString;
last_synced_at: z.ZodNullable<z.ZodString>;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
declare const domainListItemSchema: z.ZodObject<{
id: z.ZodNumber;
group_id: z.ZodNullable<z.ZodNumber>;
zone_name: z.ZodString;
cf_zone_id: z.ZodString;
status: z.ZodString;
last_synced_at: z.ZodNullable<z.ZodString>;
created_at: z.ZodString;
updated_at: z.ZodString;
group_name: z.ZodNullable<z.ZodString>;
service_count: z.ZodNumber;
}, z.core.$strip>;
declare const serviceBindingSchema: z.ZodObject<{
id: z.ZodNumber;
domain_id: z.ZodNumber;
service_id: z.ZodNumber;
hostname: z.ZodString;
dns_record_id: z.ZodNullable<z.ZodNumber>;
zone_name: z.ZodString;
group_id: z.ZodNullable<z.ZodNumber>;
group_name: z.ZodNullable<z.ZodString>;
service_name: z.ZodString;
service_slug: z.ZodString;
target_ip: z.ZodNullable<z.ZodString>;
sync_status: z.ZodNullable<z.ZodString>;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
declare const dnsRecordSchema: z.ZodObject<{
id: z.ZodNumber;
domain_id: z.ZodNumber;
cf_record_id: z.ZodNullable<z.ZodString>;
record_type: z.ZodString;
name: z.ZodString;
content: z.ZodString;
ttl: z.ZodNumber;
proxied: z.ZodBoolean;
priority: z.ZodNullable<z.ZodNumber>;
sync_status: z.ZodString;
origin: z.ZodString;
last_error: z.ZodNullable<z.ZodString>;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
declare const certificateSchema: z.ZodObject<{
id: z.ZodNumber;
domain_id: z.ZodNumber;
subdomain_id: z.ZodNullable<z.ZodNumber>;
hostname: z.ZodString;
expires_at: z.ZodNullable<z.ZodString>;
last_checked_at: z.ZodNullable<z.ZodString>;
last_error: z.ZodNullable<z.ZodString>;
status: z.ZodString;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
type Group = z.infer<typeof groupSchema>;
type GroupWithStats = z.infer<typeof groupWithStatsSchema>;
type Service = z.infer<typeof serviceSchema>;
type ServiceDomainBinding = z.infer<typeof serviceDomainBindingSchema>;
type ServiceView = z.infer<typeof serviceViewSchema>;
type ServiceGroup = z.infer<typeof serviceGroupSchema>;
type ServiceGroupView = z.infer<typeof serviceGroupViewSchema>;
type ServiceGroupsResponse = z.infer<typeof serviceGroupsResponseSchema>;
type Domain = z.infer<typeof domainSchema>;
type DomainListItem = z.infer<typeof domainListItemSchema>;
type ServiceBinding = z.infer<typeof serviceBindingSchema>;
type DnsRecord = z.infer<typeof dnsRecordSchema>;
type Certificate = z.infer<typeof certificateSchema>;
declare const createGroupSchema: z.ZodObject<{
name: z.ZodString;
slug: z.ZodString;
}, z.core.$strip>;
declare const createServiceSchema: z.ZodObject<{
name: z.ZodString;
slug: z.ZodString;
}, z.core.$strip>;
declare const createServiceWithConfigSchema: z.ZodObject<{
name: z.ZodString;
slug: z.ZodString;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodObject<{
fqdn: z.ZodString;
target_ips: z.ZodArray<z.ZodString>;
}, z.core.$strip>>>;
}, z.core.$strip>;
declare const createServiceBindingSchema: z.ZodObject<{
domain_id: z.ZodString;
service_id: z.ZodString;
hostname: z.ZodOptional<z.ZodString>;
target_ip: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
declare const updateDomainGroupSchema: z.ZodObject<{
group_id: z.ZodNullable<z.ZodNumber>;
status: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
declare const createDomainSchema: z.ZodObject<{
zone_name: z.ZodString;
group_id: z.ZodString;
}, z.core.$strip>;
declare const loginSchema: z.ZodObject<{
username: z.ZodString;
password: z.ZodString;
}, z.core.$strip>;
declare const createDnsRecordSchema: z.ZodObject<{
record_type: z.ZodEnum<{
A: "A";
AAAA: "AAAA";
CNAME: "CNAME";
TXT: "TXT";
MX: "MX";
}>;
name: z.ZodString;
content: z.ZodString;
ttl: z.ZodNumber;
proxied: z.ZodBoolean;
}, z.core.$strip>;
declare const subdomainSchema: z.ZodObject<{
id: z.ZodNumber;
domain_id: z.ZodNumber;
name: z.ZodString;
fqdn: z.ZodString;
created_at: z.ZodString;
updated_at: z.ZodString;
}, z.core.$strip>;
type SubdomainRecord = z.infer<typeof subdomainSchema>;
type CreateGroupInput = z.infer<typeof createGroupSchema>;
type CreateServiceInput = z.infer<typeof createServiceSchema>;
type CreateServiceWithConfigInput = z.infer<typeof createServiceWithConfigSchema>;
declare const updateServiceConfigSchema: z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
slug: z.ZodOptional<z.ZodString>;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
domains: z.ZodOptional<z.ZodArray<z.ZodObject<{
fqdn: z.ZodString;
target_ips: z.ZodArray<z.ZodString>;
}, z.core.$strip>>>;
}, z.core.$strip>;
type UpdateServiceConfigInput = z.infer<typeof updateServiceConfigSchema>;
declare const createServiceGroupSchema: z.ZodObject<{
name: z.ZodString;
type: z.ZodDefault<z.ZodEnum<{
vpn: "vpn";
network: "network";
internet: "internet";
bgp: "bgp";
custom: "custom";
}>>;
icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>;
declare const toggleEnabledSchema: z.ZodObject<{
enabled: z.ZodBoolean;
}, z.core.$strip>;
type CreateServiceGroupInput = z.infer<typeof createServiceGroupSchema>;
type ToggleEnabledInput = z.infer<typeof toggleEnabledSchema>;
type CreateServiceBindingInput = z.infer<typeof createServiceBindingSchema>;
type CreateDomainInput = z.infer<typeof createDomainSchema>;
type LoginInput = z.infer<typeof loginSchema>;
type CreateDnsRecordInput = z.infer<typeof createDnsRecordSchema>;
interface Subdomain {
id: number;
domain_id: number;
name: string;
fqdn: string;
created_at: string;
updated_at: string;
}
interface ServiceBindingView {
id: number;
domain_id: number;
service_id: number;
hostname: string;
dns_record_id: number | null;
zone_name: string;
group_id: number | null;
group_name: string | null;
service_name: string;
service_slug: string;
target_ip: string | null;
sync_status: string | null;
created_at: string;
updated_at: string;
}
interface ServiceDomainBindingView {
binding_id: number;
domain_id: number;
zone_name: string;
hostname: string;
fqdn: string;
target_ips: string[];
sync_status: string | null;
}
interface SyncJob {
id: string;
status: string;
domain_id: number | null;
message: string | null;
created_at: string;
finished_at: string | null;
}
interface CfZone {
id: string;
name: string;
status: string;
}
interface CfDnsRecord {
id?: string;
type: string;
name: string;
content: string;
ttl: number;
proxied?: boolean;
priority?: number;
}
interface CreateDnsRecordPayload {
type: string;
name: string;
content: string;
ttl: number;
proxied?: boolean;
priority?: number;
}
interface LoginRequest {
username: string;
password: string;
}
interface LoginResponse {
token: string;
expires_at: string;
}
interface JwtClaims {
sub: string;
exp: number;
}
export { CERT_ERROR, CERT_EXPIRED, CERT_OK, CERT_UNKNOWN, CERT_WARNING, type Certificate, type CfDnsRecord, type CfZone, type CreateDnsRecordInput, type CreateDnsRecordPayload, type CreateDomainInput, type CreateGroupInput, type CreateServiceBindingInput, type CreateServiceGroupInput, type CreateServiceInput, type CreateServiceWithConfigInput, type DnsRecord, type Domain, type DomainListItem, type Group, type GroupWithStats, type JwtClaims, type LoginInput, type LoginRequest, type LoginResponse, type ParsedFqdn, SYNC_CONFLICT, SYNC_ERROR, SYNC_PENDING_DELETE, SYNC_PENDING_PUSH, SYNC_SYNCED, type Service, type ServiceBinding, type ServiceBindingView, type ServiceDomainBinding, type ServiceDomainBindingView, type ServiceGroup, type ServiceGroupView, type ServiceGroupsResponse, type ServiceView, type Subdomain, type SubdomainRecord, type SyncJob, type ToggleEnabledInput, type UpdateServiceConfigInput, ValidationError, bindingToFqdn, certStatusFromExpiry, certificateSchema, createDnsRecordSchema, createDomainSchema, createGroupSchema, createServiceBindingSchema, createServiceGroupSchema, createServiceSchema, createServiceWithConfigSchema, dnsNameToSubdomainLabel, dnsRecordSchema, domainListItemSchema, domainSchema, fqdnToDisplay, groupSchema, groupWithStatsSchema, isValidIpv4, loginSchema, parseFqdn, serviceBindingSchema, serviceDomainBindingSchema, serviceGroupSchema, serviceGroupTypeSchema, serviceGroupViewSchema, serviceGroupsResponseSchema, serviceSchema, serviceViewSchema, subdomainLabelToFqdn, subdomainSchema, toggleEnabledSchema, updateDomainGroupSchema, updateServiceConfigSchema, validateDnsRecord };