import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { InternalApiClient } from '../client/internal-api.js'; import { type Environment } from '../config/environment.js'; export declare const TUNNEL_HINT: string; export declare const DOMAIN_IMPACT: string; export type DomainRejectCode = 'empty' | 'invalid' | 'http_scheme' | 'localhost' | 'ip_address' | 'unsupported_scheme'; export type NormalizedDomain = { ok: true; /** 저장·비교에 쓰는 소문자 호스트. 와일드카드면 '*.' 로 시작한다 */ host: string; wildcard: boolean; /** 입력에서 떼어 낸 것(포트·경로·쿼리) — 결제 복귀 판정은 호스트만 비교하므로 저장하지 않는다 */ dropped: string[]; normalized_from: string | null; } | { ok: false; code: DomainRejectCode; message: string; alternative?: string; }; /** * 사용자가 준 주소를 결제 복귀 도메인 호스트로 바꾼다. * - 스킴 없는 값은 https 로 본다. http:// 로 명시했으면 거부한다(결제 복귀는 https 만 받는다). * - 포트·경로·쿼리는 떼고 dropped 로 알린다. * - localhost·IP 는 거부한다(internal-api 는 경고만 붙여 저장하지만 결제 복귀에는 영원히 매칭되지 않는다). */ export declare function normalizeReturnDomain(raw: string): NormalizedDomain; /** commerce-api Project#domain_pattern_match? 와 같다 — *.a.com 은 a.com 자체는 허용하지 않는다 */ export declare function domainPatternMatch(host: string, pattern: string): boolean; export interface ReturnDomainState { env: Environment; bootpay_default: string[]; subdomain: string | null; /** 저장된 원문 그대로. 포트·localhost 가 붙은 예전 값도 들어 있을 수 있다 */ project_domains: string[]; custom_domains: string[]; /** 읽지 못한 출처와 이유 — 판정이 불완전하다는 뜻이다 */ read_errors: string[]; } type Getter = Pick; /** * 결제 복귀 가능 호스트를 출처별로 읽는다(GET 만). * - GET /session → current_project.subdomain * - GET /project → domains (응답의 키 값은 읽지도 싣지도 않는다) * - GET /mall/custom-domains → status=active 인 domain * 출처 하나가 실패해도 나머지는 계속 읽고 read_errors 에 남긴다. */ export declare function readReturnDomainState(api: Getter): Promise; export type ReturnDomainSource = 'bootpay_default' | 'subdomain' | 'project_domain' | 'custom_domain'; export interface HostMatch { source: ReturnDomainSource; pattern: string; } /** 호스트가 어느 출처로 허용되는지. 없으면 null */ export declare function matchReturnHost(host: string, state: ReturnDomainState): HostMatch | null; export interface UrlCheck { url: string; host: string | null; allowed: boolean; matched_by: HostMatch | null; reason: string; } /** prepare 의 redirect_url 판정과 같은 순서 — https·사용자 정보 없음·등록 호스트 */ export declare function checkReturnUrl(url: string, state: ReturnDomainState): UrlCheck; /** 저장값 중 결제 복귀 판정에 영원히 매칭되지 않는 것(포트·경로·localhost·IP 가 붙은 예전 값) */ export declare function unusableProjectDomains(state: ReturnDomainState): Array<{ value: string; reason: string; }>; export declare function describeState(state: ReturnDomainState): { bootpay_default: string[]; subdomain: string | null; project_domains: string[]; custom_domains: string[]; }; /** 현재 허용 호스트를 한 줄 목록으로 — 경고 문구용 */ export declare function allowedHostSummary(state: ReturnDomainState): string[]; export type RegistrationPlan = { action: 'reject'; input: string; code: DomainRejectCode; message: string; alternative?: string; } | { action: 'already_allowed'; input: string; host: string; matched_by: HostMatch; } | { action: 'register'; input: string; host: string; wildcard: boolean; dropped: string[]; normalized_from: string | null; before: string[]; after: string[]; }; /** * 등록 계획 — 쓰기 없이 판정만 한다. * 와일드카드 입력은 같은 패턴이 이미 있을 때만 already_allowed(서브도메인 하나로 넓은 패턴을 덮지 않는다). */ export declare function planReturnDomainRegistration(input: string, state: ReturnDomainState): RegistrationPlan; export interface AddDomainResult { host: string; added: boolean; normalized_from?: string | null; warnings?: Array<{ code: string; message: string; }>; domains?: string[]; } /** POST /project/domains — 호스트 하나를 원자적으로 추가한다(다른 등록값은 건드리지 않는다) */ export declare function addProjectDomain(api: Pick, host: string): Promise; export declare function registerCheckoutDomainTools(server: McpServer, internalApi: InternalApiClient, session: { hasToken(): boolean; hasProject(): boolean; }): void; export {}; //# sourceMappingURL=checkout-domain.d.ts.map