bdy 1.22.51-stage → 1.22.53-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
|
@@ -118,7 +118,7 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf, onlyA
|
|
|
118
118
|
formatted: output_1.default.formatDomain(buyable),
|
|
119
119
|
value: createValue('domain', prompt, buyable.available),
|
|
120
120
|
name: prompt,
|
|
121
|
-
price: buyable
|
|
121
|
+
price: (0, utils_1.isDomainAvailable)(buyable) ? buyable.prices.create.price : Infinity,
|
|
122
122
|
});
|
|
123
123
|
added[prompt] = true;
|
|
124
124
|
}
|
|
@@ -151,7 +151,7 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf, onlyA
|
|
|
151
151
|
formatted: output_1.default.formatDomain(d),
|
|
152
152
|
value: createValue('domain', d.name, true),
|
|
153
153
|
name: d.name,
|
|
154
|
-
price: d.prices.create
|
|
154
|
+
price: d.prices.create?.price || 0,
|
|
155
155
|
});
|
|
156
156
|
added[d.name] = true;
|
|
157
157
|
}
|
|
@@ -233,7 +233,7 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf, onlyA
|
|
|
233
233
|
formatted: output_1.default.formatDomain(d),
|
|
234
234
|
value: createValue('domain', d.name, true),
|
|
235
235
|
name: d.name,
|
|
236
|
-
price: d
|
|
236
|
+
price: (0, utils_1.isDomainAvailable)(d) ? d.prices.create.price : Infinity,
|
|
237
237
|
});
|
|
238
238
|
added[d.name] = true;
|
|
239
239
|
i += 1;
|
|
@@ -289,6 +289,10 @@ const nonInteractive = async (client, workspace, prompt, tlds, onOwnerBehalf) =>
|
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
291
|
const domains = suggestions.domains.sort((a, b) => {
|
|
292
|
+
if (!a.prices.create)
|
|
293
|
+
return 1;
|
|
294
|
+
if (!b.prices.create)
|
|
295
|
+
return -1;
|
|
292
296
|
return a.prices.create.price < b.prices.create.price ? -1 : 1;
|
|
293
297
|
});
|
|
294
298
|
if (domains.length > 0) {
|
|
@@ -59,7 +59,7 @@ commandDomainSearch.action(async (text, options) => {
|
|
|
59
59
|
(!onlyAvailable || buyable.available)) {
|
|
60
60
|
matched.push({
|
|
61
61
|
formatted: output_1.default.formatDomain(buyable),
|
|
62
|
-
price: !buyable
|
|
62
|
+
price: !(0, utils_1.isDomainAvailable)(buyable) ? Infinity : buyable.prices.create.price,
|
|
63
63
|
name: buyable.name,
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -92,10 +92,11 @@ commandDomainSearch.action(async (text, options) => {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
search.domains.forEach((d) => {
|
|
95
|
-
|
|
95
|
+
const isAvailable = (0, utils_1.isDomainAvailable)(d);
|
|
96
|
+
if (!onlyAvailable || isAvailable) {
|
|
96
97
|
matched.push({
|
|
97
98
|
formatted: output_1.default.formatDomain(d),
|
|
98
|
-
price: !
|
|
99
|
+
price: !isAvailable ? Infinity : d.prices.create.price,
|
|
99
100
|
name: d.name,
|
|
100
101
|
});
|
|
101
102
|
}
|
|
@@ -123,10 +124,11 @@ commandDomainSearch.action(async (text, options) => {
|
|
|
123
124
|
});
|
|
124
125
|
});
|
|
125
126
|
result.domains.forEach((d) => {
|
|
126
|
-
|
|
127
|
+
const isAvailable = (0, utils_1.isDomainAvailable)(d);
|
|
128
|
+
if (!onlyAvailable || isAvailable) {
|
|
127
129
|
suggestions.push({
|
|
128
130
|
formatted: output_1.default.formatDomain(d),
|
|
129
|
-
price: !
|
|
131
|
+
price: !isAvailable ? Infinity : d.prices.create.price,
|
|
130
132
|
name: d.name,
|
|
131
133
|
});
|
|
132
134
|
}
|
package/distTs/src/input.js
CHANGED
|
@@ -303,7 +303,13 @@ class Input {
|
|
|
303
303
|
return type;
|
|
304
304
|
}
|
|
305
305
|
static restApiToken(allowNoToken = false, token = '') {
|
|
306
|
-
|
|
306
|
+
const inSandbox = (0, utils_1.isInSandbox)();
|
|
307
|
+
// Inside a sandbox, cfg (written by an explicit `bdy login`) takes precedence
|
|
308
|
+
// over the sandbox-injected BUDDY_TOKEN env var. Outside a sandbox, env beats cfg
|
|
309
|
+
const tokenEnv = process.env.BUDDY_TOKEN;
|
|
310
|
+
let t = token;
|
|
311
|
+
if (!t && !inSandbox && tokenEnv)
|
|
312
|
+
t = tokenEnv;
|
|
307
313
|
let rf = '';
|
|
308
314
|
let cid = '';
|
|
309
315
|
let cs = '';
|
|
@@ -315,6 +321,8 @@ class Input {
|
|
|
315
321
|
cs = cfg_1.default.getApiClientSecret();
|
|
316
322
|
ct = cfg_1.default.getApiClientToken();
|
|
317
323
|
}
|
|
324
|
+
if (!t && inSandbox && tokenEnv)
|
|
325
|
+
t = tokenEnv;
|
|
318
326
|
if (!t && !allowNoToken) {
|
|
319
327
|
output_1.default.exitError(texts_1.ERR_REST_API_TOKEN);
|
|
320
328
|
}
|
|
@@ -856,14 +864,20 @@ class Input {
|
|
|
856
864
|
return p;
|
|
857
865
|
}
|
|
858
866
|
static restApiWorkspace(workspace, allowNull, ignoreProjectConfig = false) {
|
|
867
|
+
// Inside a sandbox, cfg/project cfg (set by an explicit `bdy login` or .bdy/cfg.json)
|
|
868
|
+
// takes precedence over the sandbox-injected BUDDY_WORKSPACE env var.
|
|
869
|
+
// Outside a sandbox, env beats cfg.
|
|
859
870
|
const ProjectCfg = require('./project/cfg').default;
|
|
860
|
-
let w =
|
|
861
|
-
|
|
862
|
-
|
|
871
|
+
let w = workspace;
|
|
872
|
+
const inSandbox = (0, utils_1.isInSandbox)();
|
|
873
|
+
if (!w && !inSandbox && process.env.BUDDY_WORKSPACE)
|
|
874
|
+
w = process.env.BUDDY_WORKSPACE;
|
|
863
875
|
if (!w && !ignoreProjectConfig)
|
|
864
876
|
w = ProjectCfg.getWorkspace();
|
|
865
877
|
if (!w)
|
|
866
878
|
w = cfg_1.default.getWorkspace();
|
|
879
|
+
if (!w && inSandbox && process.env.BUDDY_WORKSPACE)
|
|
880
|
+
w = process.env.BUDDY_WORKSPACE;
|
|
867
881
|
if (!w) {
|
|
868
882
|
if (allowNull)
|
|
869
883
|
return null;
|
|
@@ -895,7 +909,7 @@ class Input {
|
|
|
895
909
|
return {
|
|
896
910
|
identifier,
|
|
897
911
|
version,
|
|
898
|
-
isDefault
|
|
912
|
+
isDefault,
|
|
899
913
|
};
|
|
900
914
|
}
|
|
901
915
|
static restApiSandboxIsUpload(destPath) {
|
package/distTs/src/output.js
CHANGED
|
@@ -377,7 +377,7 @@ class Output {
|
|
|
377
377
|
return `${sign}${value.toFixed(2)}/${duration}`;
|
|
378
378
|
}
|
|
379
379
|
static formatDomain(domain) {
|
|
380
|
-
if (!
|
|
380
|
+
if (!(0, utils_1.isDomainAvailable)(domain)) {
|
|
381
381
|
return this.getDimColor(`${domain.name} (Unavailable)`);
|
|
382
382
|
}
|
|
383
383
|
return `${this.getGreenColor(domain.name)} ${this.formatDomainPrice(domain.prices.create)}`;
|
package/distTs/src/utils.js
CHANGED
|
@@ -36,8 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.getCurrentUser = exports.getServiceUser = exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = exports.getCurrentVersionWithoutEnv = exports.getVersionWithoutEnv = void 0;
|
|
39
|
+
exports.isInstalledByChoco = exports.isInstalledByApt = exports.isInstalledByBrew = exports.isInstalledByNpm = exports.tryGetEmail = exports.execLocally = exports.getHomeDirectory = exports.isDomainAvailable = exports.newCommand = exports.formatBytes = exports.formatHelp = exports.getPlatform = exports.getHostname = exports.isStringRegExp = exports.getWorkingDir = exports.getRootDir = exports.TARGET_ONLY_PORT_REGEX = exports.TARGET_HTTP_REGEX = exports.TARGET_TCP_TLS_REGEX = exports.ApiErrorTunnelsDisabled = exports.ApiErrorWorkspaceFlagged = exports.ApiErrorTunnelLimitReached = exports.ApiErrorAgentLimitReached = exports.ApiErrorDomainRestricted = exports.ApiErrorTargetInvalid = exports.ApiErrorWrongToken = exports.ApiErrorFailedToConnect = exports.ApiErrorAgentNotFound = exports.ARTIFACT_AUTH_TYPE = exports.ARTIFACT_SCOPE = exports.ARTIFACT_TYPE = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_APP_STATUS = exports.SANDBOX_SETUP_STATUS = exports.SANDBOX_EXEC_STATUS = exports.SANDBOX_EXEC_RUNTIME = exports.SANDBOX_STATUS = exports.REST_API_ENDPOINT = exports.REST_API_REGION = exports.DEFAULT_SANDBOX_CP_USER = exports.ARTIFACT_DEFAULT_VERSION = exports.SUGGESTED_BROWSER_VERSION = exports.DEFAULT_TIMEOUT = exports.TUNNEL_HTTP_CB_MIN_REQUESTS = exports.TUNNEL_HTTP_CB_WINDOW = exports.TUNNEL_MAX_REQUEST_SIZE_TO_SYNC = exports.TUNNEL_HTTP_LOG_MAX_REQUESTS = exports.TUNNEL_HTTP_LOG_MAX_BODY = exports.TUNNEL_HTTP_RATE_WINDOW = exports.TUNNEL_HTTP_RATE_LIMIT = void 0;
|
|
40
|
+
exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.getCurrentUser = exports.getServiceUser = exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = exports.getCurrentVersionWithoutEnv = exports.getVersionWithoutEnv = exports.getVersion = void 0;
|
|
41
41
|
exports.apiErrorCodeToClass = apiErrorCodeToClass;
|
|
42
42
|
exports.isFile = isFile;
|
|
43
43
|
exports.getAppWorkspaceUrl = getAppWorkspaceUrl;
|
|
@@ -329,6 +329,10 @@ const newCommand = (name, desc) => {
|
|
|
329
329
|
return cmd;
|
|
330
330
|
};
|
|
331
331
|
exports.newCommand = newCommand;
|
|
332
|
+
const isDomainAvailable = (domain) => {
|
|
333
|
+
return domain.available && !!domain.prices && !!domain.prices.create;
|
|
334
|
+
};
|
|
335
|
+
exports.isDomainAvailable = isDomainAvailable;
|
|
332
336
|
const getHomeDirectory = () => {
|
|
333
337
|
if ((0, exports.isDocker)())
|
|
334
338
|
return '/buddy';
|