apiblaze 0.3.4 → 0.3.6

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ var import_commander = require("commander");
28
28
  var import_chalk15 = __toESM(require("chalk"));
29
29
 
30
30
  // package.json
31
- var version = "0.3.4";
31
+ var version = "0.3.6";
32
32
 
33
33
  // src/types.ts
34
34
  var ApiError = class extends Error {
@@ -821,9 +821,6 @@ async function offerAutoCreate(teamId, port) {
821
821
  spinner.fail("Failed to create the dev proxy.");
822
822
  throw err;
823
823
  }
824
- const version2 = result.api_version || "1.0.0";
825
- const endpoint = `https://${name}.apiblaze.com/${version2}/dev`;
826
- console.log(` ${import_chalk4.default.dim("Endpoint:")} ${import_chalk4.default.bold(endpoint)}`);
827
824
  if (auth === "api_key") {
828
825
  const key = result.api_keys?.dev ?? Object.values(result.api_keys ?? {})[0];
829
826
  if (key) {
@@ -839,6 +836,32 @@ async function offerAutoCreate(teamId, port) {
839
836
  }
840
837
  return created;
841
838
  }
839
+ function isInternalTarget(url) {
840
+ if (!url) return false;
841
+ try {
842
+ const h = new URL(url).hostname.toLowerCase();
843
+ return h === "localhost" || h.endsWith(".localhost") || h.endsWith(".local") || h === "0.0.0.0" || /^127\./.test(h) || /^10\./.test(h) || /^192\.168\./.test(h) || /^169\.254\./.test(h) || /^172\.(1[6-9]|2\d|3[01])\./.test(h);
844
+ } catch {
845
+ return false;
846
+ }
847
+ }
848
+ function printTunnelEndpoints(restore, targets) {
849
+ if (restore.length === 0) return;
850
+ console.log(import_chalk4.default.bold("\nYour proxy is live at:"));
851
+ for (const r of restore) {
852
+ const label = targets.find((t) => t.projectId === r.projectId)?.projectName ?? r.projectId;
853
+ console.log(`
854
+ ${import_chalk4.default.bold(label)}`);
855
+ const internalEnvs = Object.keys(r.environments ?? {}).filter((e) => isInternalTarget(r.environments[e]?.target));
856
+ const envs = internalEnvs.includes("dev") ? ["dev"] : internalEnvs.length ? internalEnvs : ["dev"];
857
+ for (const env of envs) {
858
+ console.log(` ${import_chalk4.default.dim("API: ")} ${import_chalk4.default.cyan(`https://${r.projectId}.apiblaze.com/${r.apiVersion}/${env}`)}`);
859
+ }
860
+ if (r.tenant) {
861
+ console.log(` ${import_chalk4.default.dim("Portal:")} ${import_chalk4.default.cyan(`https://${r.tenant}.portal.apiblaze.com/${r.apiVersion}`)}`);
862
+ }
863
+ }
864
+ }
842
865
  async function probeLocalServer(port) {
843
866
  const controller = new AbortController();
844
867
  const timer = setTimeout(() => controller.abort(), 1500);
@@ -944,6 +967,7 @@ Tunneling ${selectedTargets.length} project(s) to localhost:${options.port}
944
967
  throw err;
945
968
  }
946
969
  }
970
+ printTunnelEndpoints(restore, selectedTargets);
947
971
  const clients = connect.projects.map(
948
972
  (projectId) => startTunnelClient({
949
973
  connectUrl: connect.url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Dev tunnel CLI for APIblaze — route localhost projects through your APIblaze endpoints",
5
5
  "keywords": [
6
6
  "apiblaze",