apiblaze 0.1.13 → 0.1.16
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/dist/index.js +13 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -166,6 +166,11 @@ var init_api = __esm({
|
|
|
166
166
|
// src/index.ts
|
|
167
167
|
var import_commander = require("commander");
|
|
168
168
|
var import_chalk7 = __toESM(require("chalk"));
|
|
169
|
+
|
|
170
|
+
// package.json
|
|
171
|
+
var version = "0.1.16";
|
|
172
|
+
|
|
173
|
+
// src/index.ts
|
|
169
174
|
init_types();
|
|
170
175
|
|
|
171
176
|
// src/commands/login.ts
|
|
@@ -431,7 +436,8 @@ function startTunnelClient(opts) {
|
|
|
431
436
|
send(socket, { id, type: "chunk", seq: seq++, data: slice.toString("base64"), final: off + CHUNK_BYTES >= buf.length });
|
|
432
437
|
}
|
|
433
438
|
} catch (err) {
|
|
434
|
-
const
|
|
439
|
+
const code = err?.cause?.code;
|
|
440
|
+
const message = code === "ECONNREFUSED" || code === "ECONNRESET" || code === "ENOTFOUND" || code === "EHOSTUNREACH" ? `No local server reachable at ${target} \u2014 is your dev server running on port ${opts.localPort}?` : err?.cause?.message || err?.message || String(err);
|
|
435
441
|
send(socket, { id, type: "err", message });
|
|
436
442
|
}
|
|
437
443
|
opts.onEntry({ method: f.method, path: f.path, status, latency: Date.now() - f.start });
|
|
@@ -518,11 +524,11 @@ async function runDev(options) {
|
|
|
518
524
|
const { chosen } = await import_inquirer.default.prompt([{
|
|
519
525
|
type: "checkbox",
|
|
520
526
|
name: "chosen",
|
|
521
|
-
message: `Found ${targets.length} projects with an internal target \u2014
|
|
527
|
+
message: `Found ${targets.length} projects with an internal target \u2014 pick which to tunnel (space to select, a for all):`,
|
|
522
528
|
choices: targets.map((t) => ({
|
|
523
529
|
name: `${import_chalk3.default.bold(t.projectName)} (${t.tenantName}) \u2014 ${t.target}`,
|
|
524
530
|
value: t,
|
|
525
|
-
checked:
|
|
531
|
+
checked: false
|
|
526
532
|
}))
|
|
527
533
|
}]);
|
|
528
534
|
if (chosen.length === 0) {
|
|
@@ -788,15 +794,15 @@ async function runCreate(opts = {}) {
|
|
|
788
794
|
spinner?.fail("Failed to create proxy.");
|
|
789
795
|
throw err;
|
|
790
796
|
}
|
|
791
|
-
const
|
|
797
|
+
const version2 = result.api_version || "1.0.0";
|
|
792
798
|
const keys = result.api_keys ?? {};
|
|
793
799
|
const adminKey = keys.dev ?? Object.values(keys)[0];
|
|
794
|
-
const proxyUrl = `https://${name}.apiblaze.com/${
|
|
800
|
+
const proxyUrl = `https://${name}.apiblaze.com/${version2}/dev`;
|
|
795
801
|
const devPortal = result.devPortal ? stripTenantFromPortal(result.devPortal) : void 0;
|
|
796
802
|
if (opts.json) {
|
|
797
803
|
process.stdout.write(JSON.stringify({
|
|
798
804
|
project_id: result.project_id,
|
|
799
|
-
api_version:
|
|
805
|
+
api_version: version2,
|
|
800
806
|
proxy_url: proxyUrl,
|
|
801
807
|
dev_portal: devPortal,
|
|
802
808
|
api_key: adminKey,
|
|
@@ -869,7 +875,7 @@ async function runTeam(arg) {
|
|
|
869
875
|
|
|
870
876
|
// src/index.ts
|
|
871
877
|
var program = new import_commander.Command();
|
|
872
|
-
program.name("apiblaze").description("APIblaze dev tunnel CLI").version(
|
|
878
|
+
program.name("apiblaze").description("APIblaze dev tunnel CLI").version(version);
|
|
873
879
|
program.command("login").description("Authenticate with APIblaze").action(async () => {
|
|
874
880
|
try {
|
|
875
881
|
await runLogin();
|