@myapihq/sdk 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domain.d.ts +41 -4
- package/dist/domain.js +28 -2
- package/package.json +1 -1
- package/src/domain.ts +78 -2
- package/dist/email-verify.d.ts +0 -30
- package/dist/email-verify.js +0 -17
package/dist/domain.d.ts
CHANGED
|
@@ -37,16 +37,53 @@ export declare function checkDomain(apiKey: string, orgId: string, domain: strin
|
|
|
37
37
|
}>;
|
|
38
38
|
export declare function registerDomain(apiKey: string, orgId: string, domain: string, input: RegisterDomainInput): Promise<DomainRecord>;
|
|
39
39
|
export declare function renewDomain(apiKey: string, orgId: string, domain: string): Promise<DomainRecord>;
|
|
40
|
-
export
|
|
40
|
+
export interface PreservedRecord {
|
|
41
|
+
type: string;
|
|
42
|
+
name: string;
|
|
43
|
+
content: string;
|
|
44
|
+
ttl: number;
|
|
45
|
+
}
|
|
46
|
+
export interface ImportDomainResponse {
|
|
41
47
|
domain: string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
domain_id: string;
|
|
49
|
+
status: string;
|
|
50
|
+
nameservers: string[];
|
|
51
|
+
preserved_records: PreservedRecord[];
|
|
52
|
+
preserved_count: number;
|
|
53
|
+
probe_warning: string;
|
|
54
|
+
next_step: string;
|
|
55
|
+
}
|
|
56
|
+
export declare function importDomain(apiKey: string, orgId: string, domain: string): Promise<ImportDomainResponse>;
|
|
45
57
|
export declare function listDomains(apiKey: string, orgId: string, filter?: string): Promise<DomainRecord[]>;
|
|
46
58
|
export declare function getDomainStatus(apiKey: string, orgId: string, domain: string): Promise<DomainRecord>;
|
|
47
59
|
export declare function assignDomain(apiKey: string, orgId: string, domain: string): Promise<DomainRecord>;
|
|
48
60
|
export declare function unassignDomain(apiKey: string, orgId: string, domain: string): Promise<DomainRecord>;
|
|
49
61
|
export declare function getDomainSettings(apiKey: string, orgId: string, domain: string): Promise<DomainSettings>;
|
|
62
|
+
export type DnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT';
|
|
63
|
+
export interface DnsRecord {
|
|
64
|
+
id: string;
|
|
65
|
+
type: DnsRecordType;
|
|
66
|
+
name: string;
|
|
67
|
+
content: string;
|
|
68
|
+
ttl: number;
|
|
69
|
+
priority: number | null;
|
|
70
|
+
proxied: boolean | null;
|
|
71
|
+
created_on: string;
|
|
72
|
+
modified_on: string;
|
|
73
|
+
}
|
|
74
|
+
export interface DnsRecordInput {
|
|
75
|
+
type: DnsRecordType;
|
|
76
|
+
name: string;
|
|
77
|
+
content: string;
|
|
78
|
+
ttl?: number;
|
|
79
|
+
priority?: number;
|
|
80
|
+
proxied?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export declare function listDnsRecords(apiKey: string, orgId: string, domain: string, type?: DnsRecordType): Promise<DnsRecord[]>;
|
|
83
|
+
export declare function getDnsRecord(apiKey: string, orgId: string, domain: string, recordId: string): Promise<DnsRecord>;
|
|
84
|
+
export declare function createDnsRecord(apiKey: string, orgId: string, domain: string, input: DnsRecordInput): Promise<DnsRecord>;
|
|
85
|
+
export declare function updateDnsRecord(apiKey: string, orgId: string, domain: string, recordId: string, input: Partial<Omit<DnsRecordInput, 'type'>>): Promise<DnsRecord>;
|
|
86
|
+
export declare function deleteDnsRecord(apiKey: string, orgId: string, domain: string, recordId: string): Promise<void>;
|
|
50
87
|
export declare function updateDomainSettings(apiKey: string, orgId: string, domain: string, payload: {
|
|
51
88
|
security_level?: 'essentially_off' | 'medium' | 'high' | 'under_attack';
|
|
52
89
|
browser_check?: 'on' | 'off';
|
package/dist/domain.js
CHANGED
|
@@ -10,6 +10,11 @@ exports.getDomainStatus = getDomainStatus;
|
|
|
10
10
|
exports.assignDomain = assignDomain;
|
|
11
11
|
exports.unassignDomain = unassignDomain;
|
|
12
12
|
exports.getDomainSettings = getDomainSettings;
|
|
13
|
+
exports.listDnsRecords = listDnsRecords;
|
|
14
|
+
exports.getDnsRecord = getDnsRecord;
|
|
15
|
+
exports.createDnsRecord = createDnsRecord;
|
|
16
|
+
exports.updateDnsRecord = updateDnsRecord;
|
|
17
|
+
exports.deleteDnsRecord = deleteDnsRecord;
|
|
13
18
|
exports.updateDomainSettings = updateDomainSettings;
|
|
14
19
|
const client_1 = require("./client");
|
|
15
20
|
const config_1 = require("./config");
|
|
@@ -23,6 +28,11 @@ exports.EXPOSES = [
|
|
|
23
28
|
'GET /domain/orgs/{org_id}/{domain}/settings',
|
|
24
29
|
'POST /domain/orgs/{org_id}/{domain}/settings',
|
|
25
30
|
'GET /domain/orgs/{org_id}/{domain}/status',
|
|
31
|
+
'GET /domain/orgs/{org_id}/{domain}/records',
|
|
32
|
+
'GET /domain/orgs/{org_id}/{domain}/records/{record_id}',
|
|
33
|
+
'POST /domain/orgs/{org_id}/{domain}/records',
|
|
34
|
+
'PATCH /domain/orgs/{org_id}/{domain}/records/{record_id}',
|
|
35
|
+
'DELETE /domain/orgs/{org_id}/{domain}/records/{record_id}',
|
|
26
36
|
];
|
|
27
37
|
async function checkDomain(apiKey, orgId, domain) {
|
|
28
38
|
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/check/available/${encodeURIComponent(domain)}`, apiKey);
|
|
@@ -37,8 +47,8 @@ async function registerDomain(apiKey, orgId, domain, input) {
|
|
|
37
47
|
async function renewDomain(apiKey, orgId, domain) {
|
|
38
48
|
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/renew`, apiKey);
|
|
39
49
|
}
|
|
40
|
-
async function importDomain(apiKey, orgId,
|
|
41
|
-
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/import`, apiKey,
|
|
50
|
+
async function importDomain(apiKey, orgId, domain) {
|
|
51
|
+
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/import`, apiKey, { domain });
|
|
42
52
|
}
|
|
43
53
|
async function listDomains(apiKey, orgId, filter) {
|
|
44
54
|
const query = filter ? `?filter=${encodeURIComponent(filter)}` : '';
|
|
@@ -56,6 +66,22 @@ async function unassignDomain(apiKey, orgId, domain) {
|
|
|
56
66
|
async function getDomainSettings(apiKey, orgId, domain) {
|
|
57
67
|
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/settings`, apiKey);
|
|
58
68
|
}
|
|
69
|
+
async function listDnsRecords(apiKey, orgId, domain, type) {
|
|
70
|
+
const query = type ? `?type=${encodeURIComponent(type)}` : '';
|
|
71
|
+
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records${query}`, apiKey);
|
|
72
|
+
}
|
|
73
|
+
async function getDnsRecord(apiKey, orgId, domain, recordId) {
|
|
74
|
+
return (0, client_1.request)('GET', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records/${encodeURIComponent(recordId)}`, apiKey);
|
|
75
|
+
}
|
|
76
|
+
async function createDnsRecord(apiKey, orgId, domain, input) {
|
|
77
|
+
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records`, apiKey, input);
|
|
78
|
+
}
|
|
79
|
+
async function updateDnsRecord(apiKey, orgId, domain, recordId, input) {
|
|
80
|
+
return (0, client_1.request)('PATCH', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records/${encodeURIComponent(recordId)}`, apiKey, input);
|
|
81
|
+
}
|
|
82
|
+
async function deleteDnsRecord(apiKey, orgId, domain, recordId) {
|
|
83
|
+
return (0, client_1.request)('DELETE', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records/${encodeURIComponent(recordId)}`, apiKey);
|
|
84
|
+
}
|
|
59
85
|
async function updateDomainSettings(apiKey, orgId, domain, payload) {
|
|
60
86
|
return (0, client_1.request)('POST', `${config_1.DOMAIN_BASE}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/settings`, apiKey, payload);
|
|
61
87
|
}
|
package/package.json
CHANGED
package/src/domain.ts
CHANGED
|
@@ -12,6 +12,11 @@ export const EXPOSES: Exposes = [
|
|
|
12
12
|
'GET /domain/orgs/{org_id}/{domain}/settings',
|
|
13
13
|
'POST /domain/orgs/{org_id}/{domain}/settings',
|
|
14
14
|
'GET /domain/orgs/{org_id}/{domain}/status',
|
|
15
|
+
'GET /domain/orgs/{org_id}/{domain}/records',
|
|
16
|
+
'GET /domain/orgs/{org_id}/{domain}/records/{record_id}',
|
|
17
|
+
'POST /domain/orgs/{org_id}/{domain}/records',
|
|
18
|
+
'PATCH /domain/orgs/{org_id}/{domain}/records/{record_id}',
|
|
19
|
+
'DELETE /domain/orgs/{org_id}/{domain}/records/{record_id}',
|
|
15
20
|
];
|
|
16
21
|
|
|
17
22
|
|
|
@@ -71,8 +76,29 @@ export async function renewDomain(apiKey: string, orgId: string, domain: string)
|
|
|
71
76
|
return request('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/renew`, apiKey);
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
// BYOD import — registrar-agnostic. Backend uses CF zone creation + best-effort
|
|
80
|
+
// public DNS probe to snapshot existing records before the NS swap. Customer's
|
|
81
|
+
// next action is changing NS at their current registrar to the returned values.
|
|
82
|
+
export interface PreservedRecord {
|
|
83
|
+
type: string;
|
|
84
|
+
name: string;
|
|
85
|
+
content: string;
|
|
86
|
+
ttl: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ImportDomainResponse {
|
|
90
|
+
domain: string;
|
|
91
|
+
domain_id: string;
|
|
92
|
+
status: string; // 'pending_ns_change' initially
|
|
93
|
+
nameservers: string[];
|
|
94
|
+
preserved_records: PreservedRecord[];
|
|
95
|
+
preserved_count: number;
|
|
96
|
+
probe_warning: string;
|
|
97
|
+
next_step: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function importDomain(apiKey: string, orgId: string, domain: string): Promise<ImportDomainResponse> {
|
|
101
|
+
return request('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/import`, apiKey, { domain });
|
|
76
102
|
}
|
|
77
103
|
|
|
78
104
|
export async function listDomains(apiKey: string, orgId: string, filter?: string): Promise<DomainRecord[]> {
|
|
@@ -96,6 +122,56 @@ export async function getDomainSettings(apiKey: string, orgId: string, domain: s
|
|
|
96
122
|
return request('GET', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/settings`, apiKey);
|
|
97
123
|
}
|
|
98
124
|
|
|
125
|
+
// ── DNS records ──────────────────────────────────────────────────────────────
|
|
126
|
+
// Per-zone CRUD on the Cloudflare zone the backend manages for this domain.
|
|
127
|
+
// v1 supports A / AAAA / CNAME / MX / TXT. `priority` is non-null only for MX,
|
|
128
|
+
// `proxied` is non-null only for A/AAAA/CNAME. `ttl: 1` is CF's "automatic"
|
|
129
|
+
// sentinel.
|
|
130
|
+
|
|
131
|
+
export type DnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT';
|
|
132
|
+
|
|
133
|
+
export interface DnsRecord {
|
|
134
|
+
id: string;
|
|
135
|
+
type: DnsRecordType;
|
|
136
|
+
name: string; // FQDN as stored by CF
|
|
137
|
+
content: string;
|
|
138
|
+
ttl: number;
|
|
139
|
+
priority: number | null;
|
|
140
|
+
proxied: boolean | null;
|
|
141
|
+
created_on: string;
|
|
142
|
+
modified_on: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface DnsRecordInput {
|
|
146
|
+
type: DnsRecordType;
|
|
147
|
+
name: string; // Accepts FQDN, host-only, or apex tokens (`@`, `""`).
|
|
148
|
+
content: string;
|
|
149
|
+
ttl?: number; // Default 1 (CF auto). Range [60, 86400] otherwise.
|
|
150
|
+
priority?: number; // Required for MX.
|
|
151
|
+
proxied?: boolean; // A/AAAA/CNAME only. Defaults false.
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export async function listDnsRecords(apiKey: string, orgId: string, domain: string, type?: DnsRecordType): Promise<DnsRecord[]> {
|
|
155
|
+
const query = type ? `?type=${encodeURIComponent(type)}` : '';
|
|
156
|
+
return request('GET', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records${query}`, apiKey);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export async function getDnsRecord(apiKey: string, orgId: string, domain: string, recordId: string): Promise<DnsRecord> {
|
|
160
|
+
return request('GET', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records/${encodeURIComponent(recordId)}`, apiKey);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export async function createDnsRecord(apiKey: string, orgId: string, domain: string, input: DnsRecordInput): Promise<DnsRecord> {
|
|
164
|
+
return request('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records`, apiKey, input);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export async function updateDnsRecord(apiKey: string, orgId: string, domain: string, recordId: string, input: Partial<Omit<DnsRecordInput, 'type'>>): Promise<DnsRecord> {
|
|
168
|
+
return request('PATCH', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records/${encodeURIComponent(recordId)}`, apiKey, input);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export async function deleteDnsRecord(apiKey: string, orgId: string, domain: string, recordId: string): Promise<void> {
|
|
172
|
+
return request('DELETE', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/records/${encodeURIComponent(recordId)}`, apiKey);
|
|
173
|
+
}
|
|
174
|
+
|
|
99
175
|
export async function updateDomainSettings(apiKey: string, orgId: string, domain: string, payload: {
|
|
100
176
|
security_level?: 'essentially_off' | 'medium' | 'high' | 'under_attack';
|
|
101
177
|
browser_check?: 'on' | 'off';
|
package/dist/email-verify.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Exposes } from './exposes';
|
|
2
|
-
export declare const EXPOSES: Exposes;
|
|
3
|
-
export type VerifyVerdict = 'deliverable' | 'undeliverable' | 'unknown';
|
|
4
|
-
export interface VerifyChecks {
|
|
5
|
-
syntax: {
|
|
6
|
-
valid: boolean;
|
|
7
|
-
detail?: string;
|
|
8
|
-
};
|
|
9
|
-
dns?: {
|
|
10
|
-
valid: boolean;
|
|
11
|
-
mx_records?: string[];
|
|
12
|
-
};
|
|
13
|
-
microsoft?: {
|
|
14
|
-
verdict: string;
|
|
15
|
-
if_exists_result: number;
|
|
16
|
-
domain_type: number;
|
|
17
|
-
federated: boolean;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export interface VerifyResult {
|
|
21
|
-
email: string;
|
|
22
|
-
verdict: VerifyVerdict;
|
|
23
|
-
confidence: number;
|
|
24
|
-
smtp_recommended: boolean;
|
|
25
|
-
checks: VerifyChecks;
|
|
26
|
-
elapsed_ms: number;
|
|
27
|
-
}
|
|
28
|
-
export declare function verifyEmail(apiKey: string, orgId: string, { email }: {
|
|
29
|
-
email: string;
|
|
30
|
-
}): Promise<VerifyResult>;
|
package/dist/email-verify.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Scaffolded from schema by scripts/scaffold-sdk.js — DO NOT remove the
|
|
3
|
-
// EXPOSES array (the coverage tool verifies it against the live schema).
|
|
4
|
-
// Types and function names ARE editable; re-running the scaffolder against
|
|
5
|
-
// a service whose config has been changed will diff vs. existing file
|
|
6
|
-
// (use --dry-run to inspect).
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.EXPOSES = void 0;
|
|
9
|
-
exports.verifyEmail = verifyEmail;
|
|
10
|
-
const client_1 = require("./client");
|
|
11
|
-
const config_1 = require("./config");
|
|
12
|
-
exports.EXPOSES = [
|
|
13
|
-
'POST /email-verify/orgs/{org_id}/verify',
|
|
14
|
-
];
|
|
15
|
-
async function verifyEmail(apiKey, orgId, { email }) {
|
|
16
|
-
return (0, client_1.request)('POST', `${config_1.EMAIL_VERIFY_BASE}/email-verify/orgs/${encodeURIComponent(orgId)}/verify`, apiKey, { email });
|
|
17
|
-
}
|