apiblaze 0.1.13 → 0.1.17
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 +23 -17
- 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.17";
|
|
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 });
|
|
@@ -515,21 +521,21 @@ async function runDev(options) {
|
|
|
515
521
|
}
|
|
516
522
|
selectedTargets = targets;
|
|
517
523
|
} else {
|
|
524
|
+
const ALL = "__all__";
|
|
518
525
|
const { chosen } = await import_inquirer.default.prompt([{
|
|
519
|
-
type: "
|
|
526
|
+
type: "list",
|
|
520
527
|
name: "chosen",
|
|
521
|
-
message: `Found ${targets.length} projects with an internal target \u2014
|
|
522
|
-
choices:
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
528
|
+
message: `Found ${targets.length} projects with an internal target \u2014 pick one to tunnel:`,
|
|
529
|
+
choices: [
|
|
530
|
+
...targets.map((t) => ({
|
|
531
|
+
name: `${import_chalk3.default.bold(t.projectName)} (${t.tenantName}) \u2014 ${t.target}`,
|
|
532
|
+
value: t
|
|
533
|
+
})),
|
|
534
|
+
new import_inquirer.default.Separator(),
|
|
535
|
+
{ name: `Tunnel all ${targets.length}`, value: ALL }
|
|
536
|
+
]
|
|
527
537
|
}]);
|
|
528
|
-
|
|
529
|
-
console.log("No projects selected. Aborted.");
|
|
530
|
-
process.exit(0);
|
|
531
|
-
}
|
|
532
|
-
selectedTargets = chosen;
|
|
538
|
+
selectedTargets = chosen === ALL ? targets : [chosen];
|
|
533
539
|
}
|
|
534
540
|
console.log(
|
|
535
541
|
import_chalk3.default.green(`
|
|
@@ -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();
|