apiblaze 0.19.2 → 0.19.3
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 +37 -14
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -933,7 +933,7 @@ var import_commander = require("commander");
|
|
|
933
933
|
var import_chalk44 = __toESM(require("chalk"));
|
|
934
934
|
|
|
935
935
|
// package.json
|
|
936
|
-
var version = "0.19.
|
|
936
|
+
var version = "0.19.3";
|
|
937
937
|
|
|
938
938
|
// src/index.ts
|
|
939
939
|
init_types();
|
|
@@ -1668,7 +1668,22 @@ async function runDev(options) {
|
|
|
1668
1668
|
}
|
|
1669
1669
|
}
|
|
1670
1670
|
let selectedTargets;
|
|
1671
|
-
if (
|
|
1671
|
+
if (options.project) {
|
|
1672
|
+
const want = options.project.toLowerCase();
|
|
1673
|
+
const match = targets.find(
|
|
1674
|
+
(t) => t.projectId?.toLowerCase() === want || t.projectName?.toLowerCase() === want
|
|
1675
|
+
);
|
|
1676
|
+
if (!match) {
|
|
1677
|
+
console.error(import_chalk4.default.red(`No localhost project named "${options.project}" found.`));
|
|
1678
|
+
if (targets.length) {
|
|
1679
|
+
console.error(import_chalk4.default.dim(" Projects pointing at this machine: " + targets.map((t) => t.projectName).join(", ")));
|
|
1680
|
+
} else {
|
|
1681
|
+
console.error(import_chalk4.default.dim(" No projects point at localhost yet \u2014 create one with `apiblaze create --target http://localhost:<port>`."));
|
|
1682
|
+
}
|
|
1683
|
+
process.exit(1);
|
|
1684
|
+
}
|
|
1685
|
+
selectedTargets = [match];
|
|
1686
|
+
} else if (targets.length === 0) {
|
|
1672
1687
|
const created = await offerAutoCreate(teamId, options.port);
|
|
1673
1688
|
if (!created) {
|
|
1674
1689
|
console.log("Set a project's upstream target to localhost or a private IP, then try again.");
|
|
@@ -1676,17 +1691,25 @@ async function runDev(options) {
|
|
|
1676
1691
|
}
|
|
1677
1692
|
selectedTargets = [created];
|
|
1678
1693
|
} else if (targets.length === 1) {
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1694
|
+
if (options.yes || !process.stdin.isTTY) {
|
|
1695
|
+
selectedTargets = targets;
|
|
1696
|
+
} else {
|
|
1697
|
+
const { confirmed } = await import_inquirer.default.prompt([{
|
|
1698
|
+
type: "confirm",
|
|
1699
|
+
name: "confirmed",
|
|
1700
|
+
message: `Found 1 project with an internal target \u2014 tunnel "${import_chalk4.default.bold(targets[0].projectName)}" (${targets[0].tenantName})?`,
|
|
1701
|
+
default: true
|
|
1702
|
+
}]);
|
|
1703
|
+
if (!confirmed) {
|
|
1704
|
+
console.log("Aborted.");
|
|
1705
|
+
process.exit(0);
|
|
1706
|
+
}
|
|
1707
|
+
selectedTargets = targets;
|
|
1688
1708
|
}
|
|
1689
|
-
|
|
1709
|
+
} else if (!process.stdin.isTTY) {
|
|
1710
|
+
console.error(import_chalk4.default.red(`Found ${targets.length} projects pointing at localhost \u2014 pass --project <name> to choose one non-interactively.`));
|
|
1711
|
+
console.error(import_chalk4.default.dim(" " + targets.map((t) => t.projectName).join(", ")));
|
|
1712
|
+
process.exit(1);
|
|
1690
1713
|
} else {
|
|
1691
1714
|
const ALL = "__all__";
|
|
1692
1715
|
const { chosen } = await import_inquirer.default.prompt([{
|
|
@@ -7354,14 +7377,14 @@ withSetupOptions(sidecar.command("setup").description("Wire a Next.js app to rou
|
|
|
7354
7377
|
sidecar.command("approve").description("Route an origin through APIblaze (creates its proxy)").argument("<origin>", "Origin, e.g. api.stripe.com").option("--team <id|name>", "Team (defaults to active team)").option("--json", "Machine-readable output").action(action((origin, opts) => runOriginsApprove(origin, opts)));
|
|
7355
7378
|
sidecar.command("deny").description("Dismiss a candidate origin so it stops being suggested").argument("<origin>", "Origin, e.g. sentry.io").option("--team <id|name>", "Team (defaults to active team)").action(action((origin, opts) => runOriginsDeny(origin, opts)));
|
|
7356
7379
|
sidecar.command("remove").description("Un-route an approved origin (deletes its proxy; the app goes direct again)").argument("<origin>", "Origin, e.g. api.stripe.com").option("--team <id|name>", "Team (defaults to active team)").action(action((origin, opts) => runOriginsRemove(origin, opts)));
|
|
7357
|
-
program.command("dev").description("Put your localhost behind a public URL (dev tunnel)").argument("[port]", "Local port to tunnel (positional; overrides --port)").option("-p, --port <number>", "Local port to tunnel", "3000").option("-o, --capture-file <path>", "Stream full request/response traffic to a file (JSON lines)").action(async (port, opts) => {
|
|
7380
|
+
program.command("dev").description("Put your localhost behind a public URL (dev tunnel)").argument("[port]", "Local port to tunnel (positional; overrides --port)").option("-p, --port <number>", "Local port to tunnel", "3000").option("--project <nameOrId>", "Tunnel this specific project (skips the picker \u2014 for scripts)").option("-y, --yes", "Skip confirmation prompts (non-interactive)").option("-o, --capture-file <path>", "Stream full request/response traffic to a file (JSON lines)").action(async (port, opts) => {
|
|
7358
7381
|
try {
|
|
7359
7382
|
const resolved = parseInt(port ?? opts.port, 10);
|
|
7360
7383
|
if (Number.isNaN(resolved)) {
|
|
7361
7384
|
console.error(import_chalk44.default.red(`Invalid port: ${port ?? opts.port}`));
|
|
7362
7385
|
process.exit(1);
|
|
7363
7386
|
}
|
|
7364
|
-
await runDev({ port: resolved, captureFile: opts.captureFile });
|
|
7387
|
+
await runDev({ port: resolved, project: opts.project, yes: opts.yes, captureFile: opts.captureFile });
|
|
7365
7388
|
} catch (err) {
|
|
7366
7389
|
await printError(err);
|
|
7367
7390
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apiblaze",
|
|
3
|
-
"version": "0.19.
|
|
4
|
-
"description": "APIblaze CLI
|
|
3
|
+
"version": "0.19.3",
|
|
4
|
+
"description": "APIblaze CLI — Chat with your APIs, Manage your API keys, users and groups with the APIblaze serverless proxy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apiblaze",
|
|
7
7
|
"dev-tunnel",
|