nameslink 1.0.3 → 1.0.5
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 +10 -0
- package/package.json +1 -1
- package/src/domain.mjs +6 -38
- package/src/journey.mjs +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# NamesLink CLI
|
|
2
2
|
|
|
3
|
+
Agent integrations can set `NAMESLINK_TOUCHPOINT=CODEX_PLUGIN` on an individual CLI process.
|
|
4
|
+
It uses the existing journey, request headers and OAuth state, preserves an earlier first touch,
|
|
5
|
+
and labels later touches. This client-reported label is not installation proof or authorization.
|
|
6
|
+
Keep it process-local so ordinary terminal calls are not mislabeled.
|
|
7
|
+
|
|
3
8
|
Ship a real website in one sentence: check a domain, review an exact quote, approve it explicitly,
|
|
4
9
|
and purchase or reuse the domain through NamesLink. The same CLI manages account-scoped DNS records
|
|
5
10
|
and can publish a reviewed static artifact through NamesLink, then bind it through NamesLink DNS.
|
|
@@ -97,6 +102,11 @@ the authority for availability, premium status, and reference prices. Search res
|
|
|
97
102
|
include aftermarket listings; these are returned as `planEligible: false` because the current Plan
|
|
98
103
|
supports new registration, not aftermarket purchase.
|
|
99
104
|
|
|
105
|
+
Each recommendation price carries the currency supplied by that price's server-side source.
|
|
106
|
+
The CLI does not make extra availability requests to reconstruct missing recommendation currencies;
|
|
107
|
+
an absent currency is displayed as unavailable. Exact checks reject malformed domain input before
|
|
108
|
+
querying; search keywords keep the separate search API contract.
|
|
109
|
+
|
|
100
110
|
Discovery prices are explicitly `INDICATIVE`. After the user chooses one `planEligible` domain,
|
|
101
111
|
create exactly one Plan for that domain. `plan` performs the authoritative availability and quote
|
|
102
112
|
checks and returns an immutable plan ID plus approval digest; it still does not register or charge
|
package/package.json
CHANGED
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
|
|
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
|
}
|
package/src/journey.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from 'node:crypto';
|
|
2
2
|
|
|
3
3
|
const JOURNEY_PATTERN = /^jny_[a-f0-9]{32}$/;
|
|
4
|
-
const TOUCHPOINTS = new Set(['CLI_DIRECT', 'AGENT_SKILL', 'CLI_BROWSER_HANDOFF']);
|
|
4
|
+
const TOUCHPOINTS = new Set(['CLI_DIRECT', 'AGENT_SKILL', 'CLI_BROWSER_HANDOFF', 'CODEX_PLUGIN']);
|
|
5
5
|
const COMMANDS = new Set([
|
|
6
6
|
'login', 'logout', 'whoami', 'auth:status', 'doctor', 'configure', 'capabilities',
|
|
7
7
|
'wallet:balance', 'wallet:top-up', 'mfa:send-code', 'domain:search', 'domain:check',
|