1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177 | "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifyClaim = exports.unseedClaim = exports.seedClaim = exports.releaseClaim = exports.getClaim = exports.createClaim = exports.listClaims = exports.deleteRecord = exports.setRecord = exports.getZone = exports.listZones = exports.setHostedNameservers = exports.hostedNameservers = exports.disableDnssec = exports.enableDnssec = exports.getDnssec = exports.disableHosting = exports.enableHosting = void 0;
const gate_js_1 = require("./gate.js");
const http = __importStar(require("./http.js"));
/** POST /domains/registrations/{id}/dns — Put a domain on ird nameservers (202). */
const enableHosting = async (client, id, body) => {
await (0, gate_js_1.checkGate)(client, 'POST /domains/registrations/{id}/dns', { registrationId: id });
return http.post(client, '/domains/registrations/{id}/dns', { params: { id }, body });
};
exports.enableHosting = enableHosting;
/** DELETE /domains/registrations/{id}/dns — Take a domain off ird DNS. */
const disableHosting = async (client, id, body) => {
await (0, gate_js_1.checkGate)(client, 'DELETE /domains/registrations/{id}/dns', { registrationId: id });
return http.del(client, '/domains/registrations/{id}/dns', { params: { id }, body });
};
exports.disableHosting = disableHosting;
/** GET /domains/registrations/{id}/dns/dnssec — DNSSEC state of the hosted zone. */
const getDnssec = (client, id) => http.get(client, '/domains/registrations/{id}/dns/dnssec', { params: { id } });
exports.getDnssec = getDnssec;
/** POST /domains/registrations/{id}/dns/dnssec — Enable DNSSEC on the hosted zone (202). */
const enableDnssec = async (client, id, body) => {
await (0, gate_js_1.checkGate)(client, 'POST /domains/registrations/{id}/dns/dnssec', { registrationId: id });
return http.post(client, '/domains/registrations/{id}/dns/dnssec', { params: { id }, body });
};
exports.enableDnssec = enableDnssec;
/** DELETE /domains/registrations/{id}/dns/dnssec — Disable DNSSEC on the hosted zone (202). */
const disableDnssec = async (client, id, body) => {
await (0, gate_js_1.checkGate)(client, 'DELETE /domains/registrations/{id}/dns/dnssec', { registrationId: id });
return http.del(client, '/domains/registrations/{id}/dns/dnssec', { params: { id }, body });
};
exports.disableDnssec = disableDnssec;
/**
* GET /domains/registrations/{id}/dns/nameservers — The nameserver set the
* hosted zone is published under: `mode` "shared" (ird's public nameservers)
* or "labels" (private nameservers unique to the domain), with
* `nameservers`, `nameservers_ready` and `available_modes`. Free.
*/
const hostedNameservers = (client, id) => http.get(client, '/domains/registrations/{id}/dns/nameservers', { params: { id } });
exports.hostedNameservers = hostedNameservers;
/**
* POST /domains/registrations/{id}/dns/nameservers — Move the hosted zone
* between nameserver sets: `mode` "shared" or "labels" (labels are offered
* for .ro domains only). Answers 200 when nothing had to change, 202 with a
* `registry_action` when a registrar nameserver change was enqueued — poll
* `hostedNameservers` for `nameservers_ready`. Free.
*/
const setHostedNameservers = async (client, id, body) => {
await (0, gate_js_1.checkGate)(client, 'POST /domains/registrations/{id}/dns/nameservers', { registrationId: id });
return http.post(client, '/domains/registrations/{id}/dns/nameservers', { params: { id }, body });
};
exports.setHostedNameservers = setHostedNameservers;
/** GET /dns/domains — Your hosted DNS domains. */
const listZones = (client) => http.get(client, '/dns/domains');
exports.listZones = listZones;
/** GET /dns/domains/{domain} — A hosted domain's zone. */
const getZone = (client, domain) => http.get(client, '/dns/domains/{domain}', { params: { domain } });
exports.getZone = getZone;
/** PUT /dns/domains/{domain}/records — Set a DNS record or RRset. */
const setRecord = async (client, domain, body) => {
await (0, gate_js_1.checkGate)(client, 'PUT /dns/domains/{domain}/records', { domain });
return http.put(client, '/dns/domains/{domain}/records', { params: { domain }, body });
};
exports.setRecord = setRecord;
/** DELETE /dns/domains/{domain}/records — Delete a DNS record (carries a JSON body). */
const deleteRecord = async (client, domain, body) => {
await (0, gate_js_1.checkGate)(client, 'DELETE /dns/domains/{domain}/records', { domain });
return http.del(client, '/dns/domains/{domain}/records', { params: { domain }, body });
};
exports.deleteRecord = deleteRecord;
/**
* GET /dns/claims — Domains you hold at another registrar and host (or are
* about to host) on ird DNS: every live claim plus those ended in the last
* 30 days, newest first. Optional `state` (pending / verified / active /
* lapsed / revoked / expired) and `limit` (1..500, default 50).
*/
const listClaims = (client, query) => http.get(client, '/dns/claims', { query });
exports.listClaims = listClaims;
/**
* POST /dns/claims — Claim a registrable domain registered elsewhere so ird
* can be its DNS (201). The response's `claim` carries the `nameservers` to
* set at your registrar; the claim activates once the parent zone lists
* exactly those (checked every few minutes, or now via `verifyClaim`).
* Gated on `domain`.
*/
const createClaim = async (client, body) => {
await (0, gate_js_1.checkGate)(client, 'POST /dns/claims', { domain: body.domain });
return http.post(client, '/dns/claims', { body });
};
exports.createClaim = createClaim;
/**
* GET /dns/claims/{id} — A claim: nameservers to set, its window while
* pending, the latest delegation read and registry facts.
*/
const getClaim = (client, id) => http.get(client, '/dns/claims/{id}', { params: { id } });
exports.getClaim = getClaim;
/** Resolve the claim's domain (only when gated) and run the gate. */
const checkClaimGate = async (client, op, id) => {
if (!client.gate)
return;
const { claim } = await (0, exports.getClaim)(client, id);
await (0, gate_js_1.checkGate)(client, op, { domain: claim?.domain });
};
/**
* DELETE /dns/claims/{id} — Release a claim: it ends (state revoked) and the
* hosted zone goes out of service, a snapshot of its records kept. Point the
* domain's nameservers elsewhere first. Gated on the claim's domain
* (resolved via `getClaim` when a gate is set).
*/
const releaseClaim = async (client, id) => {
await checkClaimGate(client, 'DELETE /dns/claims/{id}', id);
return http.del(client, '/dns/claims/{id}', { params: { id } });
};
exports.releaseClaim = releaseClaim;
/**
* PUT /dns/claims/{id}/seed — Attach a copy of the domain's current records
* to a pending claim, so the zone ird creates at activation starts from them
* instead of empty. `snapshot_id` comes from `domains.dnsSnapshot`, taken
* while the domain still resolves at its previous host. Gated on the
* claim's domain (resolved via `getClaim` when a gate is set).
*/
const seedClaim = async (client, id, body) => {
await checkClaimGate(client, 'PUT /dns/claims/{id}/seed', id);
return http.put(client, '/dns/claims/{id}/seed', { params: { id }, body });
};
exports.seedClaim = seedClaim;
/**
* DELETE /dns/claims/{id}/seed — Drop the attached copy; the zone then
* starts empty at activation. Gated on the claim's domain (resolved via
* `getClaim` when a gate is set).
*/
const unseedClaim = async (client, id) => {
await checkClaimGate(client, 'DELETE /dns/claims/{id}/seed', id);
return http.del(client, '/dns/claims/{id}/seed', { params: { id } });
};
exports.unseedClaim = unseedClaim;
/**
* POST /dns/claims/{id}/verify — Read the domain's delegation at its parent
* zone now and activate the claim when it lists the claim's nameservers.
* Anything else is not an error: the response is 200 with `check.ok` false
* and a `reason`.
*/
const verifyClaim = (client, id) => http.post(client, '/dns/claims/{id}/verify', { params: { id } });
exports.verifyClaim = verifyClaim;
|