@hasna/domains 0.0.2 → 0.0.4
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/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/dns.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/domain.d.ts +3 -0
- package/dist/cli/commands/domain.d.ts.map +1 -0
- package/dist/cli/commands/mcp-install.d.ts +3 -0
- package/dist/cli/commands/mcp-install.d.ts.map +1 -0
- package/dist/cli/commands/monitor.d.ts +3 -0
- package/dist/cli/commands/monitor.d.ts.map +1 -0
- package/dist/cli/commands/provider.d.ts +3 -0
- package/dist/cli/commands/provider.d.ts.map +1 -0
- package/dist/cli/commands/route53.d.ts.map +1 -1
- package/dist/cli/commands/serve.d.ts +3 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/ssl.d.ts +3 -0
- package/dist/cli/commands/ssl.d.ts.map +1 -0
- package/dist/cli/commands/zone.d.ts +3 -0
- package/dist/cli/commands/zone.d.ts.map +1 -0
- package/dist/cli/index.js +3521 -2765
- package/dist/index.js +347 -41
- package/dist/lib/brandsight.d.ts +42 -2
- package/dist/lib/brandsight.d.ts.map +1 -1
- package/dist/lib/cloudflare.d.ts +39 -0
- package/dist/lib/cloudflare.d.ts.map +1 -0
- package/dist/lib/config.d.ts +49 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/registrar.d.ts +22 -4
- package/dist/lib/registrar.d.ts.map +1 -1
- package/dist/lib/route53.d.ts +2 -2
- package/dist/lib/route53.d.ts.map +1 -1
- package/dist/mcp/index.js +23974 -21327
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39662,6 +39662,283 @@ function createRoute53Provider(config) {
|
|
|
39662
39662
|
};
|
|
39663
39663
|
}
|
|
39664
39664
|
|
|
39665
|
+
// src/lib/cloudflare.ts
|
|
39666
|
+
function getConfig3() {
|
|
39667
|
+
return {
|
|
39668
|
+
apiToken: process.env["CLOUDFLARE_API_TOKEN"],
|
|
39669
|
+
accountId: process.env["CLOUDFLARE_ACCOUNT_ID"]
|
|
39670
|
+
};
|
|
39671
|
+
}
|
|
39672
|
+
function checkCredentials2(cfg) {
|
|
39673
|
+
if (!cfg.apiToken) {
|
|
39674
|
+
throw new Error("Cloudflare credentials not configured. Set CLOUDFLARE_API_TOKEN environment variable.");
|
|
39675
|
+
}
|
|
39676
|
+
}
|
|
39677
|
+
var CF_BASE = "https://api.cloudflare.com/client/v4";
|
|
39678
|
+
async function cfFetch(path, opts = {}) {
|
|
39679
|
+
const cfg = opts.config ?? getConfig3();
|
|
39680
|
+
checkCredentials2(cfg);
|
|
39681
|
+
const res = await fetch(`${CF_BASE}${path}`, {
|
|
39682
|
+
method: opts.method ?? "GET",
|
|
39683
|
+
headers: {
|
|
39684
|
+
Authorization: `Bearer ${cfg.apiToken}`,
|
|
39685
|
+
"Content-Type": "application/json"
|
|
39686
|
+
},
|
|
39687
|
+
body: opts.body ? JSON.stringify(opts.body) : undefined
|
|
39688
|
+
});
|
|
39689
|
+
const json = await res.json();
|
|
39690
|
+
if (!json.success) {
|
|
39691
|
+
const msg = json.errors?.[0]?.message ?? `Cloudflare API error (${res.status})`;
|
|
39692
|
+
throw new Error(msg);
|
|
39693
|
+
}
|
|
39694
|
+
return json.result;
|
|
39695
|
+
}
|
|
39696
|
+
async function getZone(domain, config) {
|
|
39697
|
+
const result = await cfFetch(`/zones?name=${encodeURIComponent(domain)}`, { config });
|
|
39698
|
+
if (!result || result.length === 0)
|
|
39699
|
+
return null;
|
|
39700
|
+
const z2 = result[0];
|
|
39701
|
+
return { id: z2.id, name: z2.name, status: z2.status, nameservers: z2.name_servers, original_nameservers: z2.original_name_servers };
|
|
39702
|
+
}
|
|
39703
|
+
async function listRecords2(zoneId, config) {
|
|
39704
|
+
const records = [];
|
|
39705
|
+
let page = 1;
|
|
39706
|
+
while (true) {
|
|
39707
|
+
const result = await cfFetch(`/zones/${zoneId}/dns_records?per_page=100&page=${page}`, { config });
|
|
39708
|
+
if (!result || result.length === 0)
|
|
39709
|
+
break;
|
|
39710
|
+
for (const r3 of result) {
|
|
39711
|
+
records.push({ id: r3.id, type: r3.type, name: r3.name, content: r3.content, ttl: r3.ttl, priority: r3.priority, proxied: r3.proxied });
|
|
39712
|
+
}
|
|
39713
|
+
if (result.length < 100)
|
|
39714
|
+
break;
|
|
39715
|
+
page++;
|
|
39716
|
+
}
|
|
39717
|
+
return records;
|
|
39718
|
+
}
|
|
39719
|
+
async function upsertRecord2(zoneId, record, config) {
|
|
39720
|
+
const existing = await cfFetch(`/zones/${zoneId}/dns_records?type=${record.type}&name=${encodeURIComponent(record.name)}`, { config });
|
|
39721
|
+
const body = {
|
|
39722
|
+
type: record.type,
|
|
39723
|
+
name: record.name,
|
|
39724
|
+
content: record.content,
|
|
39725
|
+
ttl: record.ttl ?? 1,
|
|
39726
|
+
priority: record.priority,
|
|
39727
|
+
proxied: record.proxied ?? false
|
|
39728
|
+
};
|
|
39729
|
+
if (existing && existing.length > 0) {
|
|
39730
|
+
await cfFetch(`/zones/${zoneId}/dns_records/${existing[0].id}`, { method: "PUT", body, config });
|
|
39731
|
+
} else {
|
|
39732
|
+
await cfFetch(`/zones/${zoneId}/dns_records`, { method: "POST", body, config });
|
|
39733
|
+
}
|
|
39734
|
+
}
|
|
39735
|
+
function createCloudflareProvider(config) {
|
|
39736
|
+
const cfg = config ?? getConfig3();
|
|
39737
|
+
return {
|
|
39738
|
+
name: "cloudflare",
|
|
39739
|
+
async getDnsRecords(domain) {
|
|
39740
|
+
const zone = await getZone(domain, cfg);
|
|
39741
|
+
if (!zone)
|
|
39742
|
+
return [];
|
|
39743
|
+
const records = await listRecords2(zone.id, cfg);
|
|
39744
|
+
return records.map((r3) => ({
|
|
39745
|
+
type: r3.type,
|
|
39746
|
+
name: r3.name,
|
|
39747
|
+
value: r3.content,
|
|
39748
|
+
ttl: r3.ttl === 1 ? 0 : r3.ttl,
|
|
39749
|
+
priority: r3.priority
|
|
39750
|
+
}));
|
|
39751
|
+
},
|
|
39752
|
+
async setDnsRecords(domain, records) {
|
|
39753
|
+
const zone = await getZone(domain, cfg);
|
|
39754
|
+
if (!zone)
|
|
39755
|
+
throw new Error(`No Cloudflare zone found for ${domain}`);
|
|
39756
|
+
for (const r3 of records) {
|
|
39757
|
+
await upsertRecord2(zone.id, { type: r3.type, name: r3.name, content: r3.value, ttl: r3.ttl || 1, priority: r3.priority }, cfg);
|
|
39758
|
+
}
|
|
39759
|
+
return true;
|
|
39760
|
+
}
|
|
39761
|
+
};
|
|
39762
|
+
}
|
|
39763
|
+
|
|
39764
|
+
// src/lib/brandsight.ts
|
|
39765
|
+
class BrandsightApiError extends Error {
|
|
39766
|
+
statusCode;
|
|
39767
|
+
responseBody;
|
|
39768
|
+
constructor(message, statusCode, responseBody) {
|
|
39769
|
+
super(message);
|
|
39770
|
+
this.statusCode = statusCode;
|
|
39771
|
+
this.responseBody = responseBody;
|
|
39772
|
+
this.name = "BrandsightApiError";
|
|
39773
|
+
}
|
|
39774
|
+
}
|
|
39775
|
+
var _fetchFn = null;
|
|
39776
|
+
function getConfig4() {
|
|
39777
|
+
return {
|
|
39778
|
+
apiKey: process.env["BRANDSIGHT_API_KEY"] ?? "",
|
|
39779
|
+
accountId: process.env["BRANDSIGHT_ACCOUNT_ID"]
|
|
39780
|
+
};
|
|
39781
|
+
}
|
|
39782
|
+
var BRANDSIGHT_BASE = "https://api.brandsight.com/v1";
|
|
39783
|
+
async function apiRequest3(method, path, apiKey, body, baseUrl = BRANDSIGHT_BASE) {
|
|
39784
|
+
const fetchFn = _fetchFn || globalThis.fetch;
|
|
39785
|
+
const url = `${baseUrl}${path}`;
|
|
39786
|
+
const headers = {
|
|
39787
|
+
Authorization: `Bearer ${apiKey}`,
|
|
39788
|
+
"Content-Type": "application/json",
|
|
39789
|
+
Accept: "application/json",
|
|
39790
|
+
"User-Agent": "open-domains/0.0.3"
|
|
39791
|
+
};
|
|
39792
|
+
try {
|
|
39793
|
+
const response = await fetchFn(url, {
|
|
39794
|
+
method,
|
|
39795
|
+
headers,
|
|
39796
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
39797
|
+
signal: AbortSignal.timeout(15000)
|
|
39798
|
+
});
|
|
39799
|
+
if (!response.ok) {
|
|
39800
|
+
throw new BrandsightApiError(`Brandsight API ${method} ${path} failed with status ${response.status}`, response.status, await response.text());
|
|
39801
|
+
}
|
|
39802
|
+
const data = await response.json();
|
|
39803
|
+
return { data, stub: false };
|
|
39804
|
+
} catch (error) {
|
|
39805
|
+
if (error instanceof BrandsightApiError)
|
|
39806
|
+
throw error;
|
|
39807
|
+
return { data: null, stub: true };
|
|
39808
|
+
}
|
|
39809
|
+
}
|
|
39810
|
+
async function apiGet(path, apiKey, baseUrl = BRANDSIGHT_BASE) {
|
|
39811
|
+
const fetchFn = _fetchFn || globalThis.fetch;
|
|
39812
|
+
const url = `${baseUrl}${path}`;
|
|
39813
|
+
const headers = {
|
|
39814
|
+
Authorization: `Bearer ${apiKey}`,
|
|
39815
|
+
"Content-Type": "application/json",
|
|
39816
|
+
Accept: "application/json",
|
|
39817
|
+
"User-Agent": "open-domains/0.0.3"
|
|
39818
|
+
};
|
|
39819
|
+
try {
|
|
39820
|
+
const response = await fetchFn(url, {
|
|
39821
|
+
method: "GET",
|
|
39822
|
+
headers,
|
|
39823
|
+
signal: AbortSignal.timeout(15000)
|
|
39824
|
+
});
|
|
39825
|
+
if (!response.ok) {
|
|
39826
|
+
throw new BrandsightApiError(`Brandsight API GET ${path} failed with status ${response.status}`, response.status, await response.text());
|
|
39827
|
+
}
|
|
39828
|
+
const data = await response.json();
|
|
39829
|
+
return { data, stub: false };
|
|
39830
|
+
} catch (error) {
|
|
39831
|
+
if (error instanceof BrandsightApiError)
|
|
39832
|
+
throw error;
|
|
39833
|
+
return { data: null, stub: true };
|
|
39834
|
+
}
|
|
39835
|
+
}
|
|
39836
|
+
async function listDomains2(config) {
|
|
39837
|
+
const cfg = config ?? getConfig4();
|
|
39838
|
+
const result = await apiGet("/portfolio/domains", cfg.apiKey);
|
|
39839
|
+
if (result.stub)
|
|
39840
|
+
return [];
|
|
39841
|
+
return result.data.domains ?? [];
|
|
39842
|
+
}
|
|
39843
|
+
async function getDomainInfo3(domain, config) {
|
|
39844
|
+
const cfg = config ?? getConfig4();
|
|
39845
|
+
const result = await apiGet(`/portfolio/domains/${encodeURIComponent(domain)}`, cfg.apiKey);
|
|
39846
|
+
if (result.stub)
|
|
39847
|
+
return null;
|
|
39848
|
+
return result.data;
|
|
39849
|
+
}
|
|
39850
|
+
async function checkAvailability4(domain, config) {
|
|
39851
|
+
const cfg = config ?? getConfig4();
|
|
39852
|
+
const result = await apiGet(`/domains/check?domain=${encodeURIComponent(domain)}`, cfg.apiKey);
|
|
39853
|
+
if (result.stub)
|
|
39854
|
+
return { domain, available: false };
|
|
39855
|
+
return result.data;
|
|
39856
|
+
}
|
|
39857
|
+
async function renewDomain3(domain, years = 1, config) {
|
|
39858
|
+
const cfg = config ?? getConfig4();
|
|
39859
|
+
const result = await apiRequest3("POST", `/portfolio/domains/${encodeURIComponent(domain)}/renew`, cfg.apiKey, { years });
|
|
39860
|
+
if (result.stub)
|
|
39861
|
+
return { success: false };
|
|
39862
|
+
return { success: true, orderId: result.data.orderId };
|
|
39863
|
+
}
|
|
39864
|
+
async function syncToLocalDb3(dbFns, config) {
|
|
39865
|
+
const domains = await listDomains2(config);
|
|
39866
|
+
let synced = 0, created = 0, updated = 0;
|
|
39867
|
+
const errors = [];
|
|
39868
|
+
for (const d3 of domains) {
|
|
39869
|
+
try {
|
|
39870
|
+
const existing = dbFns.getDomainByName(d3.domain);
|
|
39871
|
+
if (existing) {
|
|
39872
|
+
dbFns.updateDomain(existing.id, {
|
|
39873
|
+
registrar: "Brandsight",
|
|
39874
|
+
expires_at: d3.expires || undefined,
|
|
39875
|
+
auto_renew: d3.auto_renew,
|
|
39876
|
+
status: "active",
|
|
39877
|
+
nameservers: d3.nameservers
|
|
39878
|
+
});
|
|
39879
|
+
updated++;
|
|
39880
|
+
} else {
|
|
39881
|
+
dbFns.createDomain({
|
|
39882
|
+
name: d3.domain,
|
|
39883
|
+
registrar: "Brandsight",
|
|
39884
|
+
expires_at: d3.expires || undefined,
|
|
39885
|
+
auto_renew: d3.auto_renew,
|
|
39886
|
+
status: "active",
|
|
39887
|
+
nameservers: d3.nameservers
|
|
39888
|
+
});
|
|
39889
|
+
created++;
|
|
39890
|
+
}
|
|
39891
|
+
synced++;
|
|
39892
|
+
} catch (err) {
|
|
39893
|
+
errors.push(`${d3.domain}: ${err instanceof Error ? err.message : String(err)}`);
|
|
39894
|
+
}
|
|
39895
|
+
}
|
|
39896
|
+
return { synced, created, updated, errors };
|
|
39897
|
+
}
|
|
39898
|
+
function createBrandsightProvider(config) {
|
|
39899
|
+
const cfg = config ?? getConfig4();
|
|
39900
|
+
return {
|
|
39901
|
+
name: "brandsight",
|
|
39902
|
+
async listDomains() {
|
|
39903
|
+
const domains = await listDomains2(cfg);
|
|
39904
|
+
return domains.map((d3) => ({
|
|
39905
|
+
domain: d3.domain,
|
|
39906
|
+
registrar: "Brandsight",
|
|
39907
|
+
created: "",
|
|
39908
|
+
expires: d3.expires,
|
|
39909
|
+
nameservers: d3.nameservers,
|
|
39910
|
+
status: d3.status === "ACTIVE" ? "active" : d3.status.toLowerCase(),
|
|
39911
|
+
auto_renew: d3.auto_renew
|
|
39912
|
+
}));
|
|
39913
|
+
},
|
|
39914
|
+
async getDomainInfo(domain) {
|
|
39915
|
+
const d3 = await getDomainInfo3(domain, cfg);
|
|
39916
|
+
if (!d3)
|
|
39917
|
+
throw new Error(`Domain not found in Brandsight: ${domain}`);
|
|
39918
|
+
return {
|
|
39919
|
+
domain: d3.domain,
|
|
39920
|
+
registrar: "Brandsight",
|
|
39921
|
+
created: "",
|
|
39922
|
+
expires: d3.expires,
|
|
39923
|
+
nameservers: d3.nameservers,
|
|
39924
|
+
status: d3.status === "ACTIVE" ? "active" : d3.status.toLowerCase(),
|
|
39925
|
+
auto_renew: d3.auto_renew
|
|
39926
|
+
};
|
|
39927
|
+
},
|
|
39928
|
+
async renewDomain(domain) {
|
|
39929
|
+
const result = await renewDomain3(domain, 1, cfg);
|
|
39930
|
+
return { domain, success: result.success, orderId: result.orderId };
|
|
39931
|
+
},
|
|
39932
|
+
async checkAvailability(domain) {
|
|
39933
|
+
const result = await checkAvailability4(domain, cfg);
|
|
39934
|
+
return { domain: result.domain, available: result.available };
|
|
39935
|
+
},
|
|
39936
|
+
async syncToLocalDb(dbFns) {
|
|
39937
|
+
return syncToLocalDb3(dbFns, cfg);
|
|
39938
|
+
}
|
|
39939
|
+
};
|
|
39940
|
+
}
|
|
39941
|
+
|
|
39665
39942
|
// src/lib/registrar.ts
|
|
39666
39943
|
function createNamecheapProvider() {
|
|
39667
39944
|
return {
|
|
@@ -39814,52 +40091,80 @@ function createGoDaddyProvider() {
|
|
|
39814
40091
|
}
|
|
39815
40092
|
};
|
|
39816
40093
|
}
|
|
39817
|
-
|
|
39818
|
-
|
|
39819
|
-
|
|
39820
|
-
return createNamecheapProvider();
|
|
39821
|
-
case "godaddy":
|
|
39822
|
-
return createGoDaddyProvider();
|
|
39823
|
-
case "route53":
|
|
39824
|
-
return createRoute53Provider();
|
|
39825
|
-
default:
|
|
39826
|
-
throw new Error(`Unknown registrar provider: ${name}`);
|
|
39827
|
-
}
|
|
39828
|
-
}
|
|
39829
|
-
function getAvailableProviders() {
|
|
39830
|
-
return [
|
|
39831
|
-
{
|
|
40094
|
+
var providerRegistry = new Map([
|
|
40095
|
+
["namecheap", {
|
|
40096
|
+
info: {
|
|
39832
40097
|
name: "namecheap",
|
|
39833
|
-
|
|
40098
|
+
type: "full",
|
|
40099
|
+
configured: false,
|
|
39834
40100
|
envVars: ["NAMECHEAP_API_KEY", "NAMECHEAP_USERNAME", "NAMECHEAP_CLIENT_IP"]
|
|
39835
40101
|
},
|
|
39836
|
-
|
|
40102
|
+
createRegistrar: createNamecheapProvider,
|
|
40103
|
+
createDns: createNamecheapProvider
|
|
40104
|
+
}],
|
|
40105
|
+
["godaddy", {
|
|
40106
|
+
info: {
|
|
39837
40107
|
name: "godaddy",
|
|
39838
|
-
|
|
40108
|
+
type: "full",
|
|
40109
|
+
configured: false,
|
|
39839
40110
|
envVars: ["GODADDY_API_KEY", "GODADDY_API_SECRET"]
|
|
39840
40111
|
},
|
|
39841
|
-
|
|
40112
|
+
createRegistrar: createGoDaddyProvider,
|
|
40113
|
+
createDns: createGoDaddyProvider
|
|
40114
|
+
}],
|
|
40115
|
+
["route53", {
|
|
40116
|
+
info: {
|
|
39842
40117
|
name: "route53",
|
|
39843
|
-
|
|
40118
|
+
type: "full",
|
|
40119
|
+
configured: false,
|
|
39844
40120
|
envVars: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_REGION"]
|
|
39845
40121
|
},
|
|
39846
|
-
|
|
40122
|
+
createRegistrar: () => createRoute53Provider(),
|
|
40123
|
+
createDns: () => createRoute53Provider()
|
|
40124
|
+
}],
|
|
40125
|
+
["cloudflare", {
|
|
40126
|
+
info: {
|
|
40127
|
+
name: "cloudflare",
|
|
40128
|
+
type: "dns",
|
|
40129
|
+
configured: false,
|
|
40130
|
+
envVars: ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]
|
|
40131
|
+
},
|
|
40132
|
+
createDns: createCloudflareProvider
|
|
40133
|
+
}],
|
|
40134
|
+
["brandsight", {
|
|
40135
|
+
info: {
|
|
39847
40136
|
name: "brandsight",
|
|
39848
|
-
|
|
39849
|
-
|
|
39850
|
-
|
|
39851
|
-
|
|
40137
|
+
type: "registrar",
|
|
40138
|
+
configured: false,
|
|
40139
|
+
envVars: ["BRANDSIGHT_API_KEY", "BRANDSIGHT_ACCOUNT_ID"]
|
|
40140
|
+
},
|
|
40141
|
+
createRegistrar: createBrandsightProvider
|
|
40142
|
+
}]
|
|
40143
|
+
]);
|
|
40144
|
+
function isConfigured(envVars) {
|
|
40145
|
+
return envVars.slice(0, 2).every((v3) => !!process.env[v3]);
|
|
40146
|
+
}
|
|
40147
|
+
function getAvailableProviders() {
|
|
40148
|
+
return Array.from(providerRegistry.values()).map((e3) => ({
|
|
40149
|
+
...e3.info,
|
|
40150
|
+
configured: isConfigured(e3.info.envVars)
|
|
40151
|
+
}));
|
|
40152
|
+
}
|
|
40153
|
+
function getRegistrarProvider(name) {
|
|
40154
|
+
const entry = providerRegistry.get(name);
|
|
40155
|
+
if (!entry?.createRegistrar)
|
|
40156
|
+
throw new Error(`No registrar provider: ${name}`);
|
|
40157
|
+
return entry.createRegistrar();
|
|
40158
|
+
}
|
|
40159
|
+
function getProvider(name) {
|
|
40160
|
+
return getRegistrarProvider(name);
|
|
39852
40161
|
}
|
|
39853
40162
|
async function syncAll(dbFns) {
|
|
39854
|
-
const available = getAvailableProviders().filter((p3) => p3.configured && (p3.
|
|
39855
|
-
const result = {
|
|
39856
|
-
providers: [],
|
|
39857
|
-
totalSynced: 0,
|
|
39858
|
-
totalErrors: []
|
|
39859
|
-
};
|
|
40163
|
+
const available = getAvailableProviders().filter((p3) => p3.configured && (p3.type === "registrar" || p3.type === "full") && p3.name !== "brandsight");
|
|
40164
|
+
const result = { providers: [], totalSynced: 0, totalErrors: [] };
|
|
39860
40165
|
for (const info of available) {
|
|
39861
40166
|
try {
|
|
39862
|
-
const provider =
|
|
40167
|
+
const provider = getRegistrarProvider(info.name);
|
|
39863
40168
|
const syncResult = await provider.syncToLocalDb(dbFns);
|
|
39864
40169
|
result.providers.push({ name: info.name, result: syncResult });
|
|
39865
40170
|
result.totalSynced += syncResult.synced;
|
|
@@ -39867,25 +40172,26 @@ async function syncAll(dbFns) {
|
|
|
39867
40172
|
} catch (error) {
|
|
39868
40173
|
const msg = `[${info.name}] Sync failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
39869
40174
|
result.totalErrors.push(msg);
|
|
39870
|
-
result.providers.push({
|
|
39871
|
-
name: info.name,
|
|
39872
|
-
result: { synced: 0, created: 0, updated: 0, errors: [msg] }
|
|
39873
|
-
});
|
|
40175
|
+
result.providers.push({ name: info.name, result: { synced: 0, created: 0, updated: 0, errors: [msg] } });
|
|
39874
40176
|
}
|
|
39875
40177
|
}
|
|
39876
40178
|
return result;
|
|
39877
40179
|
}
|
|
39878
40180
|
function autoDetectRegistrar(domain, getDomainByName2) {
|
|
39879
40181
|
const dbDomain = getDomainByName2(domain);
|
|
39880
|
-
if (!dbDomain
|
|
40182
|
+
if (!dbDomain?.registrar)
|
|
39881
40183
|
return null;
|
|
39882
|
-
const
|
|
39883
|
-
if (
|
|
40184
|
+
const r3 = dbDomain.registrar.toLowerCase();
|
|
40185
|
+
if (r3.includes("namecheap"))
|
|
39884
40186
|
return "namecheap";
|
|
39885
|
-
if (
|
|
40187
|
+
if (r3.includes("godaddy"))
|
|
39886
40188
|
return "godaddy";
|
|
39887
|
-
if (
|
|
40189
|
+
if (r3.includes("route 53") || r3.includes("route53") || r3.includes("aws"))
|
|
39888
40190
|
return "route53";
|
|
40191
|
+
if (r3.includes("cloudflare"))
|
|
40192
|
+
return "cloudflare";
|
|
40193
|
+
if (r3.includes("brandsight"))
|
|
40194
|
+
return "brandsight";
|
|
39889
40195
|
return null;
|
|
39890
40196
|
}
|
|
39891
40197
|
export {
|
package/dist/lib/brandsight.d.ts
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Brandsight
|
|
2
|
+
* Brandsight — GoDaddy's enterprise brand protection and domain registrar platform
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Two distinct capabilities:
|
|
5
|
+
* 1. Domain registrar (GoDaddy Corporate Domains via Brandsight)
|
|
6
|
+
* 2. Brand monitoring / threat detection
|
|
7
|
+
*
|
|
8
|
+
* Env vars:
|
|
5
9
|
* BRANDSIGHT_API_KEY — API key for Brandsight
|
|
10
|
+
* BRANDSIGHT_ACCOUNT_ID — Account ID for corporate domain operations (optional)
|
|
6
11
|
*/
|
|
7
12
|
export interface BrandsightConfig {
|
|
8
13
|
apiKey: string;
|
|
14
|
+
accountId?: string;
|
|
9
15
|
baseUrl?: string;
|
|
10
16
|
}
|
|
17
|
+
export interface BrandsightDomain {
|
|
18
|
+
domain: string;
|
|
19
|
+
status: string;
|
|
20
|
+
expires: string;
|
|
21
|
+
auto_renew: boolean;
|
|
22
|
+
locked: boolean;
|
|
23
|
+
nameservers: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface BrandsightAvailability {
|
|
26
|
+
domain: string;
|
|
27
|
+
available: boolean;
|
|
28
|
+
price?: number;
|
|
29
|
+
currency?: string;
|
|
30
|
+
}
|
|
11
31
|
export interface BrandsightAlert {
|
|
12
32
|
domain: string;
|
|
13
33
|
type: "typosquat" | "homoglyph" | "keyword" | "tld_variation";
|
|
@@ -43,6 +63,7 @@ export declare class BrandsightApiError extends Error {
|
|
|
43
63
|
type FetchFn = typeof globalThis.fetch;
|
|
44
64
|
export declare function _setFetch(fn: FetchFn | null): void;
|
|
45
65
|
export declare function getApiKey(): string;
|
|
66
|
+
export declare function getConfig(): BrandsightConfig;
|
|
46
67
|
export declare function monitorBrand(brandName: string): Promise<BrandMonitorResult>;
|
|
47
68
|
export declare function getSimilarDomains(domain: string): Promise<{
|
|
48
69
|
domain: string;
|
|
@@ -51,5 +72,24 @@ export declare function getSimilarDomains(domain: string): Promise<{
|
|
|
51
72
|
}>;
|
|
52
73
|
export declare function getWhoisHistory(domain: string): Promise<WhoisHistoryResult>;
|
|
53
74
|
export declare function getThreatAssessment(domain: string): Promise<ThreatAssessment>;
|
|
75
|
+
export declare function listDomains(config?: BrandsightConfig): Promise<BrandsightDomain[]>;
|
|
76
|
+
export declare function getDomainInfo(domain: string, config?: BrandsightConfig): Promise<BrandsightDomain | null>;
|
|
77
|
+
export declare function checkAvailability(domain: string, config?: BrandsightConfig): Promise<BrandsightAvailability>;
|
|
78
|
+
export declare function renewDomain(domain: string, years?: number, config?: BrandsightConfig): Promise<{
|
|
79
|
+
success: boolean;
|
|
80
|
+
orderId?: string;
|
|
81
|
+
}>;
|
|
82
|
+
export declare function syncToLocalDb(dbFns: {
|
|
83
|
+
getDomainByName: (name: string) => import("../db/domains.js").Domain | null;
|
|
84
|
+
createDomain: (input: import("../db/domains.js").CreateDomainInput) => import("../db/domains.js").Domain;
|
|
85
|
+
updateDomain: (id: string, input: import("../db/domains.js").UpdateDomainInput) => import("../db/domains.js").Domain | null;
|
|
86
|
+
}, config?: BrandsightConfig): Promise<{
|
|
87
|
+
synced: number;
|
|
88
|
+
created: number;
|
|
89
|
+
updated: number;
|
|
90
|
+
errors: string[];
|
|
91
|
+
}>;
|
|
92
|
+
import type { RegistrarProvider } from "./registrar.js";
|
|
93
|
+
export declare function createBrandsightProvider(config?: BrandsightConfig): RegistrarProvider;
|
|
54
94
|
export {};
|
|
55
95
|
//# sourceMappingURL=brandsight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brandsight.d.ts","sourceRoot":"","sources":["../../src/lib/brandsight.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"brandsight.d.ts","sourceRoot":"","sources":["../../src/lib/brandsight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WA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,kBAAkB,EAAE,iBAAiB,KAAK,OAAO,kBAAkB,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,iBAAiB,KAAK,OAAO,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CAAE,EAC9T,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAmCjF;AAMD,OAAO,KAAK,EAAE,iBAAiB,EAAkG,MAAM,gBAAgB,CAAC;AAExJ,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CA+CrF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare DNS provider — zone and record management via Cloudflare API v4
|
|
3
|
+
*
|
|
4
|
+
* Env vars:
|
|
5
|
+
* CLOUDFLARE_API_TOKEN — API token with Zone:Edit + DNS:Edit permissions
|
|
6
|
+
* CLOUDFLARE_ACCOUNT_ID — Account ID (required for zone creation)
|
|
7
|
+
*/
|
|
8
|
+
import type { DnsProvider } from "./registrar.js";
|
|
9
|
+
export interface CloudflareConfig {
|
|
10
|
+
apiToken?: string;
|
|
11
|
+
accountId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CloudflareZone {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
status: string;
|
|
17
|
+
nameservers: string[];
|
|
18
|
+
original_nameservers?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface CloudflareRecord {
|
|
21
|
+
id?: string;
|
|
22
|
+
type: string;
|
|
23
|
+
name: string;
|
|
24
|
+
content: string;
|
|
25
|
+
ttl: number;
|
|
26
|
+
priority?: number;
|
|
27
|
+
proxied?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function getConfig(): CloudflareConfig;
|
|
30
|
+
export declare function listZones(config?: CloudflareConfig): Promise<CloudflareZone[]>;
|
|
31
|
+
export declare function getZone(domain: string, config?: CloudflareConfig): Promise<CloudflareZone | null>;
|
|
32
|
+
export declare function createZone(domain: string, config?: CloudflareConfig): Promise<CloudflareZone>;
|
|
33
|
+
export declare function deleteZone(zoneId: string, config?: CloudflareConfig): Promise<void>;
|
|
34
|
+
export declare function listRecords(zoneId: string, config?: CloudflareConfig): Promise<CloudflareRecord[]>;
|
|
35
|
+
export declare function upsertRecord(zoneId: string, record: CloudflareRecord, config?: CloudflareConfig): Promise<void>;
|
|
36
|
+
export declare function deleteRecord(zoneId: string, recordId: string, config?: CloudflareConfig): Promise<void>;
|
|
37
|
+
export declare function deleteRecordByNameType(zoneId: string, name: string, type: string, config?: CloudflareConfig): Promise<void>;
|
|
38
|
+
export declare function createCloudflareProvider(config?: CloudflareConfig): DnsProvider;
|
|
39
|
+
//# sourceMappingURL=cloudflare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../../src/lib/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AAIrE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAA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AAID,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,WAAW,CA4B/E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent config stored at ~/.hasna/domains/config.json
|
|
3
|
+
*/
|
|
4
|
+
export interface DomainContact {
|
|
5
|
+
first_name?: string;
|
|
6
|
+
last_name?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
phone?: string;
|
|
9
|
+
address_line_1?: string;
|
|
10
|
+
city?: string;
|
|
11
|
+
state?: string;
|
|
12
|
+
country_code?: string;
|
|
13
|
+
zip_code?: string;
|
|
14
|
+
organization_name?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DomainsConfig {
|
|
17
|
+
default_registrar?: string;
|
|
18
|
+
default_dns?: string;
|
|
19
|
+
contact?: DomainContact;
|
|
20
|
+
}
|
|
21
|
+
export declare function loadConfig(): DomainsConfig;
|
|
22
|
+
export declare function saveConfig(config: DomainsConfig): void;
|
|
23
|
+
export declare function setConfigKey(keyPath: string, value: string): DomainsConfig;
|
|
24
|
+
/** Return a DomainContactInfo-shaped object from config, with CLI opts overriding stored values */
|
|
25
|
+
export declare function resolveContact(opts: {
|
|
26
|
+
email?: string;
|
|
27
|
+
firstName?: string;
|
|
28
|
+
lastName?: string;
|
|
29
|
+
phone?: string;
|
|
30
|
+
address?: string;
|
|
31
|
+
city?: string;
|
|
32
|
+
state?: string;
|
|
33
|
+
country?: string;
|
|
34
|
+
zip?: string;
|
|
35
|
+
org?: string;
|
|
36
|
+
}): {
|
|
37
|
+
first_name: string;
|
|
38
|
+
last_name: string;
|
|
39
|
+
email: string;
|
|
40
|
+
phone: string;
|
|
41
|
+
address_line_1: string;
|
|
42
|
+
city: string;
|
|
43
|
+
state: string;
|
|
44
|
+
country_code: string;
|
|
45
|
+
zip_code: string;
|
|
46
|
+
organization_name?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function getConfigKey(keyPath: string): string | undefined;
|
|
49
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,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CAC9C,GAAG;IACF,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IACpE,cAAc,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAC1E,QAAQ,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9C,CA2BA;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUhE"}
|
package/dist/lib/registrar.d.ts
CHANGED
|
@@ -41,18 +41,26 @@ export type DbFunctions = {
|
|
|
41
41
|
createDomain: (input: CreateDomainInput) => Domain;
|
|
42
42
|
updateDomain: (id: string, input: UpdateDomainInput) => Domain | null;
|
|
43
43
|
};
|
|
44
|
+
/** Handles domain registration, renewal, and availability checks */
|
|
44
45
|
export interface RegistrarProvider {
|
|
45
46
|
name: string;
|
|
46
47
|
listDomains(): Promise<ProviderDomainInfo[]>;
|
|
47
48
|
getDomainInfo(domain: string): Promise<ProviderDomainInfo>;
|
|
48
49
|
renewDomain(domain: string): Promise<ProviderRenewResult>;
|
|
49
|
-
getDnsRecords(domain: string): Promise<ProviderDnsRecord[]>;
|
|
50
|
-
setDnsRecords(domain: string, records: ProviderDnsRecord[]): Promise<boolean>;
|
|
51
50
|
checkAvailability(domain: string): Promise<ProviderAvailability>;
|
|
52
51
|
syncToLocalDb(dbFns: DbFunctions): Promise<ProviderSyncResult>;
|
|
53
52
|
}
|
|
53
|
+
/** Handles DNS zone and record management */
|
|
54
|
+
export interface DnsProvider {
|
|
55
|
+
name: string;
|
|
56
|
+
getDnsRecords(domain: string): Promise<ProviderDnsRecord[]>;
|
|
57
|
+
setDnsRecords(domain: string, records: ProviderDnsRecord[]): Promise<boolean>;
|
|
58
|
+
}
|
|
59
|
+
/** A provider that does both — e.g. Route 53 */
|
|
60
|
+
export type FullProvider = RegistrarProvider & DnsProvider;
|
|
54
61
|
export interface ProviderInfo {
|
|
55
62
|
name: string;
|
|
63
|
+
type: "registrar" | "dns" | "full";
|
|
56
64
|
configured: boolean;
|
|
57
65
|
envVars: string[];
|
|
58
66
|
}
|
|
@@ -64,8 +72,18 @@ export interface SyncAllResult {
|
|
|
64
72
|
totalSynced: number;
|
|
65
73
|
totalErrors: string[];
|
|
66
74
|
}
|
|
67
|
-
|
|
75
|
+
interface RegistryEntry {
|
|
76
|
+
info: ProviderInfo;
|
|
77
|
+
createRegistrar?: () => RegistrarProvider;
|
|
78
|
+
createDns?: () => DnsProvider;
|
|
79
|
+
}
|
|
80
|
+
export declare function registerProvider(entry: RegistryEntry): void;
|
|
68
81
|
export declare function getAvailableProviders(): ProviderInfo[];
|
|
82
|
+
export declare function getRegistrarProvider(name: string): RegistrarProvider;
|
|
83
|
+
export declare function getDnsProvider(name: string): DnsProvider;
|
|
84
|
+
/** @deprecated Use getRegistrarProvider() */
|
|
85
|
+
export declare function getProvider(name: string): RegistrarProvider;
|
|
69
86
|
export declare function syncAll(dbFns: DbFunctions): Promise<SyncAllResult>;
|
|
70
|
-
export declare function autoDetectRegistrar(domain: string, getDomainByName: (name: string) => Domain | null):
|
|
87
|
+
export declare function autoDetectRegistrar(domain: string, getDomainByName: (name: string) => Domain | null): string | null;
|
|
88
|
+
export {};
|
|
71
89
|
//# sourceMappingURL=registrar.d.ts.map
|