domain-hound 0.1.6 → 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, 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 }
@@ -279,6 +279,8 @@ export async function triageNames(inputs, options = {}) {
279
279
  if (options.endings && !validEndings(options.endings)) return { error: 'Choose supported domain endings.' };
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
+ const preferred = options.preferredEndings ?? [];
283
+ const requestedEndings = preferred;
282
284
  const websiteEndings = [...new Set([...endings, ...coreWebsiteEndings])];
283
285
  // Each name has its DNS label (punycode for æøå) for domains, and a Latin key for the rival, app and mark sources.
284
286
  const names = new Map();
@@ -440,8 +442,11 @@ export async function triageNames(inputs, options = {}) {
440
442
  const rows = domains.groups.map(({ name, results, sites }, index) => {
441
443
  const requested = results.filter(row => endings.includes(row.tld));
442
444
  const available = results.filter(row => row.status === 'probably-free' && endings.includes(row.tld));
443
- const recommendable = available.filter(row => canRecommend(row.tld, options.eligible));
444
- const [best] = recommendable;
445
+ // The person's budget, when given, leaves out rows that cost more upfront (as on the receipt).
446
+ const recommendable = available.filter(row => canRecommend(row.tld, options.eligible)
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);
445
450
  const social = socialByName.get(keys.get(name)) ?? null;
446
451
  const domainFields = {
447
452
  taken: requested.filter(row => row.status === 'taken').map(row => row.tld),
@@ -462,7 +467,7 @@ export async function triageNames(inputs, options = {}) {
462
467
  // Registry answers and prices only. The verdict never reads "No conflict found" without the checks.
463
468
  return {
464
469
  name: names.get(name), verdict: 'Check first', reason: notScreened,
465
- _free: available, _recommendable: recommendable, _googleExplained: true,
470
+ _free: available, _recommendable: recommendable, _pick: best, _googleExplained: true,
466
471
  google: { result: 'not checked', why: 'not screened', link: googleSearchLink(names.get(name)) },
467
472
  ...domainFields,
468
473
  competition: { US: null, mark: null, AppStore: null, GooglePlay: null, Wikidata: null,
@@ -567,7 +572,7 @@ export async function triageNames(inputs, options = {}) {
567
572
  return {
568
573
  // Small and dormant same-name uses are notes after the reason; they never change the verdict.
569
574
  name: names.get(name), verdict: decision, reason: [reason, ...tractionNotes(judged)].join(' · '),
570
- _free: available, _recommendable: recommendable, _mark: mark, _googleExplained: googleExplained,
575
+ _free: available, _recommendable: recommendable, _pick: best, _mark: mark, _googleExplained: googleExplained,
571
576
  ...(summary && { traction: summary }),
572
577
  google: { ...(google.google ?? { result: 'not checked', why: google.unchecked }), link: googleSearchLink(names.get(name)) },
573
578
  ...domainFields,
@@ -599,13 +604,13 @@ export async function triageNames(inputs, options = {}) {
599
604
  row.checks = options.compact ? null
600
605
  : nameCheckLines(row).map(({ label, text, link }) => label + ': ' + text + ' · ' + link);
601
606
  }
602
- for (const row of googleCandidates(rows)) row.google.search = true;
607
+ for (const row of googleCandidates(rows, requestedEndings, options.eligible, options.upfrontCap)) row.google.search = true;
603
608
  const sourcesSummary = Object.fromEntries(Object.entries(counts).map(([source, answered]) =>
604
609
  [source, Math.round(100 * answered / Math.min(names.size, screenLimit))]));
605
610
  const receiptDetails = options.receipt ? structuredClone(rows.map(({ competition, details, traction, google, reason, meaning, _receiptEndings, _handles, _waiting }) =>
606
611
  ({ competition, details, traction, google, reason, meaning, endings: _receiptEndings, handles: _handles,
607
612
  ...(_waiting?.().length && { waiting: _waiting() }) }))) : null;
608
- const result = packTriage(rows, sourcesSummary, options.compact, endings, options.eligible);
613
+ const result = packTriage(rows, sourcesSummary, options.compact, endings, options.eligible, requestedEndings, options.upfrontCap);
609
614
  // The first pass of a follow-up run says more checks are coming.
610
615
  if (answerBy && waiting.size) result.followUp = true;
611
616
  if (options.receipt) {
@@ -641,8 +646,8 @@ function compactHandles(entries) {
641
646
  }
642
647
 
643
648
  // The first three ranked names, filled from the screened names in input order when fewer than three rank.
644
- export function googleCandidates(rows) {
645
- const picked = rankedRows(rows).slice(0, 3);
649
+ export function googleCandidates(rows, requested, eligible, budget) {
650
+ const picked = rankedRows(rows, requested, eligible, budget).slice(0, 3);
646
651
  for (const row of rows) if (picked.length < 3 && !picked.includes(row)) picked.push(row);
647
652
  return picked;
648
653
  }
@@ -670,16 +675,18 @@ export function bestValue(options) {
670
675
  || (row.threeYear === best.threeYear && row.firstPayment < best.firstPayment) ? row : best, undefined);
671
676
  }
672
677
 
673
- function rankedRows(rows) {
678
+ const pickOption = ({ _pick }) => _pick && { domain: _pick.domain, now: _pick.firstPayment, total: _pick.threeYear };
679
+
680
+ function rankedRows(rows, requested = [], eligible = [], budget) {
674
681
  const order = { 'No conflict found': 0, 'Check first': 1 };
675
682
  return rows.filter(row => row.verdict !== 'Avoid').sort((a, b) => order[a.verdict] - order[b.verdict]
676
- || (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));
677
685
  }
678
686
 
679
- function topChoices(rows) {
680
- return rankedRows(rows).slice(0, 3)
681
- .map(({ name, verdict, reason, _recommendable }) => {
682
- const [best] = _recommendable;
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 }) => {
683
690
  const value = bestValue(_recommendable);
684
691
  return {
685
692
  name, verdict, reason, domain: best?.domain ?? null, ending: best?.tld ?? null,
@@ -691,12 +698,12 @@ function topChoices(rows) {
691
698
  }
692
699
 
693
700
  // Share each ending's standard price once and keep only per-name differences.
694
- function packTriage(rows, sources, compact, endings, eligible) {
701
+ function packTriage(rows, sources, compact, endings, eligible, requested = [], budget) {
695
702
  const prices = {};
696
- const top = topChoices(rows);
703
+ const top = topChoices(rows, requested, eligible, budget);
697
704
  // Handle states for the top names: taken, not_found (no public profile found) or check (check yourself).
698
705
  const handles = Object.fromEntries(rows.filter(row => row._social).map(row => [row.name, row._social]));
699
- 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 }) => {
700
707
  const own = {};
701
708
  for (const option of _free) {
702
709
  const entry = priceEntry(option);