domain-hound 0.1.7 → 0.1.8

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.
@@ -303,6 +303,97 @@
303
303
  "transfer": null
304
304
  }
305
305
  }
306
+ },
307
+ "cloudflare": {
308
+ "checkedAt": "2026-11-25T00:00:00.000Z",
309
+ "source": "https://pricing.registrar.cloudflare.com/",
310
+ "note": "Standard registration and renewal from the official public table; needs Cloudflare DNS",
311
+ "prices": {
312
+ "com": {
313
+ "shop": "Cloudflare",
314
+ "firstYear": 11.17,
315
+ "renewal": 11.17,
316
+ "transfer": null
317
+ },
318
+ "ai": {
319
+ "shop": "Cloudflare",
320
+ "firstYear": 80,
321
+ "renewal": 80,
322
+ "transfer": null
323
+ },
324
+ "io": {
325
+ "shop": "Cloudflare",
326
+ "firstYear": 50,
327
+ "renewal": 50,
328
+ "transfer": null
329
+ },
330
+ "dev": {
331
+ "shop": "Cloudflare",
332
+ "firstYear": 12.2,
333
+ "renewal": 12.2,
334
+ "transfer": null
335
+ },
336
+ "app": {
337
+ "shop": "Cloudflare",
338
+ "firstYear": 14.2,
339
+ "renewal": 14.2,
340
+ "transfer": null
341
+ },
342
+ "co": {
343
+ "shop": "Cloudflare",
344
+ "firstYear": 30,
345
+ "renewal": 30,
346
+ "transfer": null
347
+ },
348
+ "me": {
349
+ "shop": "Cloudflare",
350
+ "firstYear": 16.56,
351
+ "renewal": 16.56,
352
+ "transfer": null
353
+ },
354
+ "xyz": {
355
+ "shop": "Cloudflare",
356
+ "firstYear": 13.5,
357
+ "renewal": 13.5,
358
+ "transfer": null
359
+ },
360
+ "tech": {
361
+ "shop": "Cloudflare",
362
+ "firstYear": 49.2,
363
+ "renewal": 49.2,
364
+ "transfer": null
365
+ },
366
+ "net": {
367
+ "shop": "Cloudflare",
368
+ "firstYear": 11.86,
369
+ "renewal": 11.86,
370
+ "transfer": null
371
+ },
372
+ "org": {
373
+ "shop": "Cloudflare",
374
+ "firstYear": 11.2,
375
+ "renewal": 11.2,
376
+ "transfer": null
377
+ },
378
+ "studio": {
379
+ "shop": "Cloudflare",
380
+ "firstYear": 31.2,
381
+ "renewal": 31.2,
382
+ "transfer": null
383
+ },
384
+ "uk": {
385
+ "shop": "Cloudflare",
386
+ "firstYear": 5.3,
387
+ "renewal": 5.3,
388
+ "transfer": null
389
+ },
390
+ "co.uk": {
391
+ "shop": "Cloudflare",
392
+ "firstYear": 5.3,
393
+ "renewal": 5.3,
394
+ "transfer": null
395
+ }
396
+ }
306
397
  }
307
398
  }
308
399
  }
@@ -50,6 +50,11 @@ export function offer(shop, domain, details) {
50
50
  };
51
51
  }
52
52
 
53
+ // The short note a list-price row carries when buying there needs that registrar's DNS: "Needs Cloudflare DNS".
54
+ export function dnsNeed(shopName) {
55
+ return shopName === shops.cloudflare.name ? 'Needs Cloudflare DNS' : null;
56
+ }
57
+
53
58
  export function linkable(shop) {
54
59
  return Object.hasOwn(shops, shop) && !shops[shop].dataOnly;
55
60
  }
@@ -1,4 +1,4 @@
1
- import { canRecommend, defaultEndings, eligibilityNotes, endingTier, nameCandidates, normalizeName, searchCandidates, searchKey,
1
+ import { canRecommend, comparePicks, defaultEndings, eligibilityNotes, nameCandidates, pickName, normalizeName, searchCandidates, searchKey,
2
2
  validEligibility, validEndings } from './name-search.mjs';
3
3
  import { shopSearchUrl } from './prices.mjs';
4
4
  import { checkHandles, compactText, handleSearches, letters, markOrder, searchApps, searchEntities, searchMarks, trademarkSearches }
@@ -280,7 +280,7 @@ export async function triageNames(inputs, options = {}) {
280
280
  if (options.eligible !== undefined && !validEligibility(options.eligible)) return { error: 'Eligible endings must list supported restricted endings, such as no.' };
281
281
  const endings = options.endings ?? defaultEndings;
282
282
  const preferred = options.preferredEndings ?? [];
283
- const requestedEndings = [...preferred, ...(options.eligible ?? [])];
283
+ const requestedEndings = preferred;
284
284
  const websiteEndings = [...new Set([...endings, ...coreWebsiteEndings])];
285
285
  // Each name has its DNS label (punycode for æøå) for domains, and a Latin key for the rival, app and mark sources.
286
286
  const names = new Map();
@@ -442,10 +442,11 @@ export async function triageNames(inputs, options = {}) {
442
442
  const rows = domains.groups.map(({ name, results, sites }, index) => {
443
443
  const requested = results.filter(row => endings.includes(row.tld));
444
444
  const available = results.filter(row => row.status === 'probably-free' && endings.includes(row.tld));
445
+ // The person's budget, when given, leaves out rows that cost more upfront (as on the receipt).
445
446
  const recommendable = available.filter(row => canRecommend(row.tld, options.eligible)
446
- && (!preferred.length || preferred.includes(row.tld)));
447
- if (preferred.length) recommendable.sort((a, b) => preferred.indexOf(a.tld) - preferred.indexOf(b.tld));
448
- const [best] = recommendable;
447
+ && (!preferred.length || preferred.includes(row.tld))
448
+ && (options.upfrontCap == null || (row.firstPayment ?? Infinity) <= options.upfrontCap));
449
+ const best = pickName(recommendable, options.eligible, preferred, options.upfrontCap);
449
450
  const social = socialByName.get(keys.get(name)) ?? null;
450
451
  const domainFields = {
451
452
  taken: requested.filter(row => row.status === 'taken').map(row => row.tld),
@@ -466,7 +467,7 @@ export async function triageNames(inputs, options = {}) {
466
467
  // Registry answers and prices only. The verdict never reads "No conflict found" without the checks.
467
468
  return {
468
469
  name: names.get(name), verdict: 'Check first', reason: notScreened,
469
- _free: available, _recommendable: recommendable, _googleExplained: true,
470
+ _free: available, _recommendable: recommendable, _pick: best, _googleExplained: true,
470
471
  google: { result: 'not checked', why: 'not screened', link: googleSearchLink(names.get(name)) },
471
472
  ...domainFields,
472
473
  competition: { US: null, mark: null, AppStore: null, GooglePlay: null, Wikidata: null,
@@ -571,7 +572,7 @@ export async function triageNames(inputs, options = {}) {
571
572
  return {
572
573
  // Small and dormant same-name uses are notes after the reason; they never change the verdict.
573
574
  name: names.get(name), verdict: decision, reason: [reason, ...tractionNotes(judged)].join(' · '),
574
- _free: available, _recommendable: recommendable, _mark: mark, _googleExplained: googleExplained,
575
+ _free: available, _recommendable: recommendable, _pick: best, _mark: mark, _googleExplained: googleExplained,
575
576
  ...(summary && { traction: summary }),
576
577
  google: { ...(google.google ?? { result: 'not checked', why: google.unchecked }), link: googleSearchLink(names.get(name)) },
577
578
  ...domainFields,
@@ -603,13 +604,13 @@ export async function triageNames(inputs, options = {}) {
603
604
  row.checks = options.compact ? null
604
605
  : nameCheckLines(row).map(({ label, text, link }) => label + ': ' + text + ' · ' + link);
605
606
  }
606
- for (const row of googleCandidates(rows, requestedEndings)) row.google.search = true;
607
+ for (const row of googleCandidates(rows, requestedEndings, options.eligible, options.upfrontCap)) row.google.search = true;
607
608
  const sourcesSummary = Object.fromEntries(Object.entries(counts).map(([source, answered]) =>
608
609
  [source, Math.round(100 * answered / Math.min(names.size, screenLimit))]));
609
610
  const receiptDetails = options.receipt ? structuredClone(rows.map(({ competition, details, traction, google, reason, meaning, _receiptEndings, _handles, _waiting }) =>
610
611
  ({ competition, details, traction, google, reason, meaning, endings: _receiptEndings, handles: _handles,
611
612
  ...(_waiting?.().length && { waiting: _waiting() }) }))) : null;
612
- const result = packTriage(rows, sourcesSummary, options.compact, endings, options.eligible, requestedEndings);
613
+ const result = packTriage(rows, sourcesSummary, options.compact, endings, options.eligible, requestedEndings, options.upfrontCap);
613
614
  // The first pass of a follow-up run says more checks are coming.
614
615
  if (answerBy && waiting.size) result.followUp = true;
615
616
  if (options.receipt) {
@@ -645,8 +646,8 @@ function compactHandles(entries) {
645
646
  }
646
647
 
647
648
  // The first three ranked names, filled from the screened names in input order when fewer than three rank.
648
- export function googleCandidates(rows, requested) {
649
- const picked = rankedRows(rows, requested).slice(0, 3);
649
+ export function googleCandidates(rows, requested, eligible, budget) {
650
+ const picked = rankedRows(rows, requested, eligible, budget).slice(0, 3);
650
651
  for (const row of rows) if (picked.length < 3 && !picked.includes(row)) picked.push(row);
651
652
  return picked;
652
653
  }
@@ -674,28 +675,19 @@ export function bestValue(options) {
674
675
  || (row.threeYear === best.threeYear && row.firstPayment < best.firstPayment) ? row : best, undefined);
675
676
  }
676
677
 
677
- // Best value within the most attractive tier that has an in-scope row. When that tier's rows lack a usable three-year
678
- // total, there is no best value yet (it needs a shop quote); a fallback ending never takes over silently.
679
- export function tierBestValue(options, requested = []) {
680
- const tier = Math.min(...options.map(row => endingTier(row.domain, requested)));
681
- return bestValue(options.filter(row => endingTier(row.domain, requested) === tier));
682
- }
683
-
684
- // A name's pick is its first recommendable row (ranked by tier, then upfront payment); a name without one sorts last.
685
- const pickTier = (row, requested) => row._recommendable[0] ? endingTier(row._recommendable[0].domain, requested) : Infinity;
678
+ const pickOption = ({ _pick }) => _pick && { domain: _pick.domain, now: _pick.firstPayment, total: _pick.threeYear };
686
679
 
687
- function rankedRows(rows, requested = []) {
680
+ function rankedRows(rows, requested = [], eligible = [], budget) {
688
681
  const order = { 'No conflict found': 0, 'Check first': 1 };
689
682
  return rows.filter(row => row.verdict !== 'Avoid').sort((a, b) => order[a.verdict] - order[b.verdict]
690
- || pickTier(a, requested) - pickTier(b, requested)
691
- || (a._recommendable[0]?.firstPayment ?? Infinity) - (b._recommendable[0]?.firstPayment ?? Infinity));
683
+ || Number(!pickOption(a)) - Number(!pickOption(b))
684
+ || (pickOption(a) && pickOption(b) ? comparePicks(pickOption(a), pickOption(b), { requested, eligible, budget }) : 0));
692
685
  }
693
686
 
694
- function topChoices(rows, requested) {
695
- return rankedRows(rows, requested).slice(0, 3)
696
- .map(({ name, verdict, reason, _recommendable }) => {
697
- const [best] = _recommendable;
698
- const value = tierBestValue(_recommendable, requested);
687
+ function topChoices(rows, requested, eligible, budget) {
688
+ return rankedRows(rows, requested, eligible, budget).slice(0, 3)
689
+ .map(({ name, verdict, reason, _recommendable, _pick: best }) => {
690
+ const value = bestValue(_recommendable);
699
691
  return {
700
692
  name, verdict, reason, domain: best?.domain ?? null, ending: best?.tld ?? null,
701
693
  now: best?.firstPayment ?? null, renew: best?.renewalPayment ?? null, term: best?.minimumYears ?? null,
@@ -706,12 +698,12 @@ function topChoices(rows, requested) {
706
698
  }
707
699
 
708
700
  // Share each ending's standard price once and keep only per-name differences.
709
- function packTriage(rows, sources, compact, endings, eligible, requested = []) {
701
+ function packTriage(rows, sources, compact, endings, eligible, requested = [], budget) {
710
702
  const prices = {};
711
- const top = topChoices(rows, requested);
703
+ const top = topChoices(rows, requested, eligible, budget);
712
704
  // Handle states for the top names: taken, not_found (no public profile found) or check (check yourself).
713
705
  const handles = Object.fromEntries(rows.filter(row => row._social).map(row => [row.name, row._social]));
714
- const names = rows.map(({ _free, _recommendable, _mark, _googleExplained, _receiptEndings, _handles, _social, _waiting, ...row }) => {
706
+ const names = rows.map(({ _free, _recommendable, _pick, _mark, _googleExplained, _receiptEndings, _handles, _social, _waiting, ...row }) => {
715
707
  const own = {};
716
708
  for (const option of _free) {
717
709
  const entry = priceEntry(option);
@@ -719,7 +711,7 @@ function packTriage(rows, sources, compact, endings, eligible, requested = []) {
719
711
  if (!prices[option.tld]) prices[option.tld] = entry;
720
712
  else if (JSON.stringify(prices[option.tld]) !== JSON.stringify(entry)) own[option.tld] = entry;
721
713
  }
722
- return { ...row, free: _free.map(option => option.tld), own, bestValue: tierBestValue(_recommendable, requested)?.tld ?? null };
714
+ return { ...row, free: _free.map(option => option.tld), own, bestValue: bestValue(_recommendable)?.tld ?? null };
723
715
  });
724
716
  const result = { top, names, prices, sources, eligibility: eligibilityNotes(endings),
725
717
  ...(Object.keys(handles).length && { handles }),