apiblaze 0.1.7 → 0.1.8

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 +17 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -682,6 +682,18 @@ function isHttpUrl(s) {
682
682
  return false;
683
683
  }
684
684
  }
685
+ function stripTenantFromPortal(devPortal) {
686
+ try {
687
+ const u = new URL(devPortal);
688
+ const dot = u.hostname.indexOf(".");
689
+ if (dot < 0) return devPortal;
690
+ const product = u.hostname.slice(0, dot).split("-")[0];
691
+ u.hostname = `${product}${u.hostname.slice(dot)}`;
692
+ return u.toString();
693
+ } catch {
694
+ return devPortal;
695
+ }
696
+ }
685
697
  async function runCreate() {
686
698
  const creds = loadCredentials();
687
699
  if (!creds) {
@@ -748,18 +760,18 @@ async function runCreate() {
748
760
  }
749
761
  const version = result.api_version || "1.0.0";
750
762
  const keys = result.api_keys ?? {};
751
- const adminKey = keys.prod ?? Object.values(keys)[0];
763
+ const adminKey = keys.dev ?? Object.values(keys)[0];
752
764
  console.log();
753
- console.log(` ${import_chalk5.default.dim("Proxy URL: ")} ${import_chalk5.default.bold(`https://${name}.apiblaze.com/${version}/prod`)}`);
765
+ console.log(` ${import_chalk5.default.dim("Proxy URL: ")} ${import_chalk5.default.bold(`https://${name}.apiblaze.com/${version}/dev`)}`);
754
766
  if (result.devPortal) {
755
- console.log(` ${import_chalk5.default.dim("Dev portal:")} ${import_chalk5.default.bold(result.devPortal)}`);
767
+ console.log(` ${import_chalk5.default.dim("Dev portal:")} ${import_chalk5.default.bold(stripTenantFromPortal(result.devPortal))}`);
756
768
  }
757
769
  if (adminKey) {
758
770
  console.log();
759
- console.log(` ${import_chalk5.default.dim("Consumer admin API key (prod):")}`);
771
+ console.log(` ${import_chalk5.default.dim("Consumer admin API key (dev):")}`);
760
772
  console.log(` ${import_chalk5.default.bold.green(adminKey)}`);
761
773
  console.log(import_chalk5.default.dim("\n Save this now \u2014 send it as the X-API-Key header. It may not be shown again."));
762
- const otherEnvs = Object.keys(keys).filter((e) => e !== "prod");
774
+ const otherEnvs = Object.keys(keys).filter((e) => e !== "dev");
763
775
  if (otherEnvs.length) {
764
776
  console.log(import_chalk5.default.dim(` (Separate keys were also created for: ${otherEnvs.join(", ")}.)`));
765
777
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Dev tunnel CLI for APIblaze — route localhost projects through Cloudflare tunnels",
5
5
  "keywords": [
6
6
  "apiblaze",