domain-hound 0.1.4 → 0.1.6
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/.agents/plugins/marketplace.json +1 -0
- package/.claude-plugin/marketplace.json +1 -0
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +106 -13
- package/assets/readme-search.png +0 -0
- package/clis/domain-check/broker-atom.mjs +78 -0
- package/clis/domain-check/com-site.mjs +64 -25
- package/clis/domain-check/confirm.mjs +10 -5
- package/clis/domain-check/dossier.mjs +603 -0
- package/clis/domain-check/google-play.mjs +24 -11
- package/clis/domain-check/handles.mjs +337 -0
- package/clis/domain-check/index.mjs +69 -20
- package/clis/domain-check/marketplaces.mjs +107 -0
- package/clis/domain-check/meaning-words.LICENSE.txt +408 -0
- package/clis/domain-check/meaning-words.json +2397 -0
- package/clis/domain-check/meaning.mjs +77 -0
- package/clis/domain-check/name-search.mjs +83 -13
- package/clis/domain-check/naming-method.mjs +6 -4
- package/clis/domain-check/price-catalog.mjs +20 -12
- package/clis/domain-check/price-snapshot.json +142 -10
- package/clis/domain-check/registry.mjs +112 -19
- package/clis/domain-check/safe-web.mjs +207 -0
- package/clis/domain-check/traction.mjs +2 -2
- package/clis/domain-check/trademarks.mjs +372 -0
- package/clis/domain-check/triage-sources.mjs +52 -64
- package/clis/domain-check/triage.mjs +262 -72
- package/clis/spaceship/buy.mjs +327 -0
- package/clis/spaceship/client.mjs +170 -0
- package/clis/spaceship/dns.mjs +292 -0
- package/clis/spaceship/quote.mjs +123 -0
- package/clis/spaceship/setup.mjs +81 -0
- package/clis/spaceship/store.mjs +104 -0
- package/clis/spaceship/tools.mjs +258 -0
- package/display.mjs +16 -9
- package/dossier.mjs +185 -0
- package/package.json +36 -5
- package/plugin.json +4 -3
- package/results-style.mjs +10 -0
- package/results.mjs +291 -61
- package/server.json +3 -3
- package/server.mjs +275 -59
- package/share.mjs +43 -0
- package/site/r/share-format.mjs +125 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Version 2 stores a timestamp and up to five groups of [name, verdict, domain label, endings, facts?].
|
|
2
|
+
// A domain starts with a dot when it reuses the group's label. Prices are in integer cents.
|
|
3
|
+
// facts is optional and only holds what the local receipt worked out for that name:
|
|
4
|
+
// { p: pick row, b: [best value row, three-year payments in cents], j: renewal-jump bit mask by row, t: taken rows, preferred first }.
|
|
5
|
+
// Version 1 links have no facts: they decode with no pick or best value and with jumps worked out from their prices.
|
|
6
|
+
export const sharePage = 'https://domainhound.dev/r/';
|
|
7
|
+
export const shareUrlLimit = 2000;
|
|
8
|
+
export const shareNameLimit = 5;
|
|
9
|
+
export const shareRecordLimit = 28;
|
|
10
|
+
export const shareVersion = '2.';
|
|
11
|
+
const versions = { '1.': 1, '2.': 2 };
|
|
12
|
+
export const shareVerdicts = [null, 'No conflict found', 'Check first', 'Avoid'];
|
|
13
|
+
export const shareStatuses = [
|
|
14
|
+
'Free at the registry',
|
|
15
|
+
'Confirmed at shop',
|
|
16
|
+
'Taken',
|
|
17
|
+
'Taken, possible resale',
|
|
18
|
+
'Not offered for registration',
|
|
19
|
+
'May be premium, price at shop',
|
|
20
|
+
'Premium, price at shop',
|
|
21
|
+
'Check at shop',
|
|
22
|
+
'Check at shop, likely free by DNS',
|
|
23
|
+
'Check at shop, likely taken by DNS',
|
|
24
|
+
'Still checking',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?';
|
|
28
|
+
const baseLabel = new RegExp('^' + label + '$');
|
|
29
|
+
export const shareDomain = new RegExp('^' + label + '(?:\\.' + label + ')+$');
|
|
30
|
+
export const shareName = /^[\p{L}\p{N}\p{M}. -]{1,100}$/u;
|
|
31
|
+
const maximumInflatedBytes = 24 * 1024;
|
|
32
|
+
const isCents = value => value === null || (Number.isSafeInteger(value) && value >= 0);
|
|
33
|
+
const dollars = value => value === null ? null : value / 100;
|
|
34
|
+
const isTaken = row => /^Taken\b/.test(row.status);
|
|
35
|
+
const factKeys = ['p', 'b', 'j', 't'];
|
|
36
|
+
|
|
37
|
+
function parseFacts(facts, rows) {
|
|
38
|
+
if (!facts || typeof facts !== 'object' || Array.isArray(facts) || Object.keys(facts).some(key => !factKeys.includes(key))) return null;
|
|
39
|
+
const { p: pick = null, b: best = null, j: jumps = 0, t: taken = [] } = facts;
|
|
40
|
+
const validIndex = index => Number.isInteger(index) && index >= 0 && index < rows.length;
|
|
41
|
+
const available = index => validIndex(index) && ['Free at the registry', 'Confirmed at shop'].includes(rows[index].status);
|
|
42
|
+
if ((pick !== null && !available(pick))
|
|
43
|
+
|| (best !== null && !(Array.isArray(best) && best.length === 2 && available(best[0]) && best[1] !== null && isCents(best[1])))
|
|
44
|
+
|| !Number.isSafeInteger(jumps) || jumps < 0 || jumps >= 2 ** rows.length
|
|
45
|
+
|| !Array.isArray(taken) || new Set(taken).size !== taken.length
|
|
46
|
+
|| !taken.every(index => validIndex(index) && isTaken(rows[index]))) return null;
|
|
47
|
+
return {
|
|
48
|
+
records: rows.map((record, index) => ({ ...record, jump: Boolean(jumps & (1 << index)), pick: index === pick,
|
|
49
|
+
...(best?.[0] === index && { bestValue: dollars(best[1]) }) })),
|
|
50
|
+
takenDomains: taken.map(index => rows[index].domain),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// An old link only knows statuses and prices. A renewal over twice the first payment is the same rule the lookup used.
|
|
55
|
+
function legacyFacts(rows) {
|
|
56
|
+
const taken = rows.filter(isTaken);
|
|
57
|
+
return {
|
|
58
|
+
records: rows.map(record => ({ ...record, jump: record.now === null || record.renew === null ? null : record.renew > 2 * record.now,
|
|
59
|
+
pick: false })),
|
|
60
|
+
takenDomains: [...taken.filter(record => record.domain.endsWith('.com')), ...taken.filter(record => !record.domain.endsWith('.com'))]
|
|
61
|
+
.map(record => record.domain),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function parseReceipt(receipt, version) {
|
|
66
|
+
if (!Array.isArray(receipt) || receipt.length !== 2) return null;
|
|
67
|
+
const [checkedAt, groups] = receipt;
|
|
68
|
+
if (typeof checkedAt !== 'string' || !/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(checkedAt)
|
|
69
|
+
|| !Number.isFinite(Date.parse(checkedAt)) || new Date(checkedAt).toISOString() !== checkedAt
|
|
70
|
+
|| !Array.isArray(groups) || !groups.length || groups.length > shareNameLimit) return null;
|
|
71
|
+
const parsed = [];
|
|
72
|
+
for (const group of groups) {
|
|
73
|
+
if (!Array.isArray(group) || group.length < 4 || group.length > (version === 1 ? 4 : 5)) return null;
|
|
74
|
+
const [name, verdict, base, records] = group;
|
|
75
|
+
if (typeof name !== 'string' || !shareName.test(name) || !name.trim() || !Number.isInteger(verdict)
|
|
76
|
+
|| verdict < 0 || verdict >= shareVerdicts.length
|
|
77
|
+
|| typeof base !== 'string' || (base && !baseLabel.test(base))
|
|
78
|
+
|| !Array.isArray(records) || !records.length || records.length > shareRecordLimit) return null;
|
|
79
|
+
const endings = [];
|
|
80
|
+
for (const record of records) {
|
|
81
|
+
if (!Array.isArray(record) || record.length !== 5) return null;
|
|
82
|
+
const [part, status, now, renew, term] = record;
|
|
83
|
+
if (typeof part !== 'string') return null;
|
|
84
|
+
const domain = part.startsWith('.') ? base + part : part;
|
|
85
|
+
if (domain.length > 253 || !shareDomain.test(domain)
|
|
86
|
+
|| !Number.isInteger(status) || status < 0 || status >= shareStatuses.length
|
|
87
|
+
|| !isCents(now) || !isCents(renew) || !Number.isInteger(term) || term < 1 || term > 10) return null;
|
|
88
|
+
endings.push({ domain, status: shareStatuses[status], now: dollars(now), renew: dollars(renew), term });
|
|
89
|
+
}
|
|
90
|
+
const facts = version === 1 ? legacyFacts(endings) : parseFacts(group[4] ?? {}, endings);
|
|
91
|
+
if (!facts) return null;
|
|
92
|
+
parsed.push({ name, verdict: shareVerdicts[verdict], ...facts });
|
|
93
|
+
}
|
|
94
|
+
return { checkedAt, groups: parsed };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function readShareFragment(fragment) {
|
|
98
|
+
if (typeof fragment !== 'string' || sharePage.length + fragment.length >= shareUrlLimit) return null;
|
|
99
|
+
const version = versions[fragment.slice(1, 3)];
|
|
100
|
+
if (!fragment.startsWith('#') || !version) return null;
|
|
101
|
+
const encoded = fragment.slice(3);
|
|
102
|
+
if (!/^[A-Za-z0-9_-]+$/.test(encoded)) return null;
|
|
103
|
+
try {
|
|
104
|
+
const bytes = Uint8Array.from(atob(encoded.replaceAll('-', '+').replaceAll('_', '/')), value => value.charCodeAt(0));
|
|
105
|
+
const reader = new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate')).getReader();
|
|
106
|
+
try {
|
|
107
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
108
|
+
let size = 0;
|
|
109
|
+
let json = '';
|
|
110
|
+
for (;;) {
|
|
111
|
+
const { value, done } = await reader.read();
|
|
112
|
+
if (done) break;
|
|
113
|
+
size += value.byteLength;
|
|
114
|
+
if (size > maximumInflatedBytes) return null;
|
|
115
|
+
json += decoder.decode(value, { stream: true });
|
|
116
|
+
}
|
|
117
|
+
return parseReceipt(JSON.parse(json + decoder.decode()), version);
|
|
118
|
+
} finally {
|
|
119
|
+
await reader.cancel().catch(() => {});
|
|
120
|
+
reader.releaseLock();
|
|
121
|
+
}
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|