import { removeCustomDomain, type CustomDomainRemoveInput, type CustomDomainRemoveResult, } from './custom-domain-core.ts' import { authFrom, liveDeps } from './custom-domain-runtime.ts' export type { CustomDomainRemoveInput, CustomDomainRemoveResult } from './custom-domain-core.ts' /** * Undo `./custom-domain` for one hostname: delete the DNS records that helper * created (identified by their `kody-custom-domain` comment) and the Kody * hostname registration. Records it did not create are listed in `skipped` and * left alone. Without `confirm: true` it only reports the plan. * * Must run from `execute` as a signed-in org admin. * * @param params.hostname - The custom hostname to remove. * @param params.confirm - Must be `true` to delete; otherwise returns the plan with no writes. * @param params.account - Cloudflare token alias (`default`, `kody`, `pages`). * @param params.apiTokenSecret - Explicit Kody secret name for the Cloudflare token. * @returns `{ ok, status: 'planned' | 'removed' | 'nothing_to_remove', actions, skipped, nextStep }`. * @example * import removeCustomDomain from 'kody:@kentcdodds/cloudflare/custom-domain-remove' * const plan = await removeCustomDomain({ hostname: 'app.example.com' }) * // => { status: 'planned', actions: [{ kind: 'dns.delete', ... }, { kind: 'kody.delete', ... }] } * await removeCustomDomain({ hostname: 'app.example.com', confirm: true }) */ export default async function removeKodyCustomDomain( params: CustomDomainRemoveInput, ): Promise { return removeCustomDomain(params, liveDeps(authFrom(params))) }