nameslink 1.0.3 → 1.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/README.md CHANGED
@@ -97,6 +97,11 @@ the authority for availability, premium status, and reference prices. Search res
97
97
  include aftermarket listings; these are returned as `planEligible: false` because the current Plan
98
98
  supports new registration, not aftermarket purchase.
99
99
 
100
+ Each recommendation price carries the currency supplied by that price's server-side source.
101
+ The CLI does not make extra availability requests to reconstruct missing recommendation currencies;
102
+ an absent currency is displayed as unavailable. Exact checks reject malformed domain input before
103
+ querying; search keywords keep the separate search API contract.
104
+
100
105
  Discovery prices are explicitly `INDICATIVE`. After the user chooses one `planEligible` domain,
101
106
  create exactly one Plan for that domain. `plan` performs the authoritative availability and quote
102
107
  checks and returns an immutable plan ID plus approval digest; it still does not register or charge
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nameslink",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "NamesLink command-line client for domains, DNS, intelligent site building, Security Acceleration and automation",
5
5
  "type": "module",
6
6
  "bin": {
package/src/domain.mjs CHANGED
@@ -83,51 +83,17 @@ export async function searchDomains(client, keyword, { category, limit = DEFAULT
83
83
  const sourceCandidates = Array.isArray(searchResponse?.data)
84
84
  ? searchResponse.data.slice(0, limit)
85
85
  : [];
86
- // Share exact reads within this CLI invocation. Never change the public search/recommendation
87
- // contracts, ranking, or keyword handling to fill a terminal presentation field.
88
- const availabilityReads = new Map();
89
- const readAvailability = (domainName) => {
90
- const key = String(domainName).toLowerCase();
91
- if (!availabilityReads.has(key)) {
92
- availabilityReads.set(key, client.publicRequest(
93
- 'POST', '/domain/registry/check-domain/check', { domainName },
94
- ));
95
- }
96
- return availabilityReads.get(key);
97
- };
98
86
  const checked = await Promise.all(sourceCandidates.map(async (candidate) => {
99
87
  if (candidate?.onSale) return normalizeSearchCandidate(candidate, null);
100
88
  try {
101
- const availability = await readAvailability(candidate.domainName);
89
+ const availability = await client.publicRequest(
90
+ 'POST', '/domain/registry/check-domain/check', { domainName: candidate.domainName },
91
+ );
102
92
  return normalizeSearchCandidate(candidate, availability);
103
93
  } catch (error) {
104
94
  return normalizeSearchCandidate(candidate, null, error);
105
95
  }
106
96
  }));
107
- const recommendations = await Promise.all(
108
- (Array.isArray(recommendationsResponse?.cards) ? recommendationsResponse.cards : [])
109
- .map(async (card) => {
110
- if (card.onSale || !card.domainName
111
- || !card.prices?.some((price) => price.price != null && !price.currency)) {
112
- return normalizeRecommendation(card);
113
- }
114
- try {
115
- const exact = await readAvailability(card.domainName);
116
- const prices = card.prices.map((price) => {
117
- if (price.currency || price.price == null) return price;
118
- const match = exact?.prices?.find((item) => item.currency
119
- && item.action === price.action && item.period === price.period
120
- && item.price != null && Number(item.price) === Number(price.price));
121
- return match ? { ...price, currency: match.currency } : price;
122
- });
123
- return normalizeRecommendation({ ...card, prices });
124
- } catch {
125
- // Discovery remains useful when an exact read fails. Unknown currency is explicit in
126
- // human output; never assume USD or combine a currency with a different priced item.
127
- return normalizeRecommendation(card);
128
- }
129
- }),
130
- );
131
97
  return {
132
98
  apiVersion: API_VERSION,
133
99
  mode: 'SEARCH',
@@ -136,7 +102,9 @@ export async function searchDomains(client, keyword, { category, limit = DEFAULT
136
102
  priceBinding: 'INDICATIVE',
137
103
  total: numberOrNull(searchResponse?.total),
138
104
  recommendationsStatus: recommendationsResponse ? 'AVAILABLE' : 'UNAVAILABLE',
139
- recommendations,
105
+ recommendations: Array.isArray(recommendationsResponse?.cards)
106
+ ? recommendationsResponse.cards.map(normalizeRecommendation)
107
+ : [],
140
108
  candidates: checked,
141
109
  };
142
110
  }