bdy 1.18.6-stage → 1.18.8-dev
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/distTs/package.json
CHANGED
|
@@ -52,6 +52,7 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
|
|
|
52
52
|
output_1.default.arrowSign();
|
|
53
53
|
output_1.default.normal(`Searching...`);
|
|
54
54
|
let items = [];
|
|
55
|
+
const added = {};
|
|
55
56
|
const createValue = (type, name, available) => {
|
|
56
57
|
return `${type}:${name}:${available ? '1' : '0'}`;
|
|
57
58
|
};
|
|
@@ -62,6 +63,7 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
|
|
|
62
63
|
if (claimable) {
|
|
63
64
|
items.push(output_1.default.createMenuSeparator('Matched'));
|
|
64
65
|
items.push(output_1.default.createMenuItem(output_1.default.formatDomainClaim(prompt, claimable.available), createValue('claim', prompt, claimable.available)));
|
|
66
|
+
added[prompt] = true;
|
|
65
67
|
}
|
|
66
68
|
else {
|
|
67
69
|
const search = await client.domainSearch(workspace, [prompt]);
|
|
@@ -69,6 +71,7 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
|
|
|
69
71
|
if (buyable) {
|
|
70
72
|
items.push(output_1.default.createMenuSeparator('Matched'));
|
|
71
73
|
items.push(output_1.default.createMenuItem(output_1.default.formatDomain(buyable), createValue('domain', prompt, buyable.available && !buyable.premium)));
|
|
74
|
+
added[prompt] = true;
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -94,23 +97,35 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
|
|
|
94
97
|
const domainsAvailable = search.domains.filter((d) => d.available && !d.premium);
|
|
95
98
|
const domainsUnavailable = search.domains.filter((d) => !d.available || d.premium);
|
|
96
99
|
domainsAvailable.forEach((d) => {
|
|
97
|
-
|
|
100
|
+
if (!added[d.name]) {
|
|
101
|
+
items.push(output_1.default.createMenuItem(output_1.default.formatDomain(d), createValue('domain', d.name, true)));
|
|
102
|
+
added[d.name] = true;
|
|
103
|
+
}
|
|
98
104
|
});
|
|
99
105
|
claimsAvailable.forEach((c, i) => {
|
|
100
106
|
const domain = `${prompt}.${c.domain}`;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
if (!added[domain]) {
|
|
108
|
+
const item = output_1.default.createMenuItem(output_1.default.formatDomainClaim(domain, true), createValue('claim', domain, true));
|
|
109
|
+
if (i < 5)
|
|
110
|
+
items.unshift(item);
|
|
111
|
+
else
|
|
112
|
+
items.push(item);
|
|
113
|
+
added[domain] = true;
|
|
114
|
+
}
|
|
106
115
|
});
|
|
107
116
|
domainsUnavailable.forEach((d) => {
|
|
108
|
-
|
|
117
|
+
if (!added[d.name]) {
|
|
118
|
+
items.push(output_1.default.createMenuItem(output_1.default.formatDomain(d), createValue('domain', d.name, false)));
|
|
119
|
+
added[d.name] = true;
|
|
120
|
+
}
|
|
109
121
|
});
|
|
110
122
|
claimsUnavailable.forEach((c) => {
|
|
111
123
|
const domain = `${prompt}.${c.domain}`;
|
|
112
|
-
|
|
113
|
-
|
|
124
|
+
if (!added[domain]) {
|
|
125
|
+
const item = output_1.default.createMenuItem(output_1.default.formatDomainClaim(domain, false), createValue('claim', domain, false));
|
|
126
|
+
items.push(item);
|
|
127
|
+
added[domain] = true;
|
|
128
|
+
}
|
|
114
129
|
});
|
|
115
130
|
if (items.length > 10)
|
|
116
131
|
items = items.filter((_, i) => i < 10);
|
|
@@ -124,14 +139,20 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
|
|
|
124
139
|
suggestions.claims.forEach((c) => {
|
|
125
140
|
if (i >= 10)
|
|
126
141
|
return;
|
|
127
|
-
|
|
128
|
-
|
|
142
|
+
if (!added[c]) {
|
|
143
|
+
items.push(output_1.default.createMenuItem(output_1.default.formatDomainClaim(c, true), createValue('claim', c, true)));
|
|
144
|
+
added[c] = true;
|
|
145
|
+
i += 1;
|
|
146
|
+
}
|
|
129
147
|
});
|
|
130
148
|
suggestions.domains.forEach((d) => {
|
|
131
149
|
if (i >= 10)
|
|
132
150
|
return;
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
if (!added[d.name]) {
|
|
152
|
+
items.push(output_1.default.createMenuItem(output_1.default.formatDomain(d), createValue('domain', d.name, true)));
|
|
153
|
+
added[d.name] = true;
|
|
154
|
+
i += 1;
|
|
155
|
+
}
|
|
135
156
|
});
|
|
136
157
|
}
|
|
137
158
|
output_1.default.clearPreviousLine();
|
|
@@ -33,16 +33,15 @@ const OAUTH_CLIENT_APP_SCOPES = [
|
|
|
33
33
|
];
|
|
34
34
|
async function oauthServer(api, clientId, clientSecret) {
|
|
35
35
|
const ApiClient = require('../api/client').default;
|
|
36
|
-
const open = require('open');
|
|
37
|
-
return new Promise((resolve
|
|
36
|
+
const open = require('open').default;
|
|
37
|
+
return new Promise((resolve) => {
|
|
38
38
|
const s = node_http_1.default.createServer(async (req, res) => {
|
|
39
39
|
const url = new URL(req.url || '', `http://${OAUTH_CLIENT_APP_HOST}`);
|
|
40
40
|
const urlCode = url.searchParams.get('code');
|
|
41
41
|
if (!urlCode) {
|
|
42
42
|
res.end(texts_1.ERR_LOGIN_HTTP_FAILED);
|
|
43
43
|
s.close();
|
|
44
|
-
|
|
45
|
-
return;
|
|
44
|
+
output_1.default.exitError(texts_1.ERR_LOGIN_HTTP_FAILED);
|
|
46
45
|
}
|
|
47
46
|
const client = new ApiClient(new URL(`https://${api}`));
|
|
48
47
|
try {
|
|
@@ -57,17 +56,17 @@ async function oauthServer(api, clientId, clientSecret) {
|
|
|
57
56
|
catch {
|
|
58
57
|
res.end(texts_1.ERR_LOGIN_HTTP_FAILED);
|
|
59
58
|
s.close();
|
|
60
|
-
|
|
61
|
-
return;
|
|
59
|
+
output_1.default.exitError(texts_1.ERR_LOGIN_HTTP_FAILED);
|
|
62
60
|
}
|
|
63
61
|
});
|
|
64
62
|
s.on('error', () => {
|
|
65
63
|
s.close();
|
|
66
|
-
|
|
64
|
+
output_1.default.exitError(texts_1.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN);
|
|
65
|
+
});
|
|
66
|
+
s.listen(OAUTH_CLIENT_APP_PORT, OAUTH_CLIENT_APP_HOST, () => {
|
|
67
|
+
const url = `https://${api}/oauth2/authorize?type=web_server&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(OAUTH_CLIENT_APP_REDIRECT_URL)}&response_type=code&scope=${encodeURIComponent(OAUTH_CLIENT_APP_SCOPES.join(' '))}`;
|
|
68
|
+
open(url);
|
|
67
69
|
});
|
|
68
|
-
s.listen(OAUTH_CLIENT_APP_PORT, OAUTH_CLIENT_APP_HOST);
|
|
69
|
-
const url = `https://${api}/oauth2/authorize?type=web_server&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(OAUTH_CLIENT_APP_REDIRECT_URL)}&response_type=code&scope=${encodeURIComponent(OAUTH_CLIENT_APP_SCOPES.join(' '))}`;
|
|
70
|
-
open(url);
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
async function getOrCreateApp(api) {
|
|
@@ -39,7 +39,7 @@ commandUtUpload.action(async (input, options) => {
|
|
|
39
39
|
});
|
|
40
40
|
exports.default = commandUtUpload;
|
|
41
41
|
function validateInputAndOptions(input, options) {
|
|
42
|
-
const z = require('zod')
|
|
42
|
+
const z = require('zod');
|
|
43
43
|
const { ZodError } = require('zod');
|
|
44
44
|
const globSchema = z.string();
|
|
45
45
|
const optionsSchema = z.object({
|