'use strict'; // Openprovider DNS 공급자 (v1.5.36) — 1.4.0 부터 있던 lib/openprovider.js 의 영역·레코드 함수를 공통 공급자 모양(lib/dnszone.js)으로 감싼다 const op = require('../openprovider'); async function listZones() { const d = await op.call('GET', '/dns/zones', null, { limit: 500 }); return ((d && d.results) || []).map((z) => ({ id: z.id, name: String(z.name || '').toLowerCase(), nameServers: [] })); } async function getZone(domain) { const z = await op.getZone(domain); return z ? { id: z.id, name: String(domain).toLowerCase(), nameServers: (z.name_servers || []).map((x) => x.name || x) } : null; } async function createZone(domain, records) { const z = await getZone(domain); if (z) { if (records && records.length) await op.updateRecords(domain, { add: records }); return z; } await op.createZone(domain, records || []); return (await getZone(domain)) || { id: null, name: domain, nameServers: [] }; } async function deleteZone(domain) { const z = await op.getZone(domain); if (!z) return { ok: true, existed: false }; await op.call('DELETE', `/dns/zones/${encodeURIComponent(domain)}`); return { ok: true, existed: true }; } module.exports = { id: 'openprovider', label: 'Openprovider DNS', ready: op.ready, listZones, getZone, createZone, deleteZone, listRecords: op.listRecords, updateRecords: op.updateRecords, nameServers: async (d) => { const z = await getZone(d); return z ? z.nameServers : []; } };