apiblaze 0.12.0 → 0.12.1
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 +18 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -492,7 +492,7 @@ var import_commander = require("commander");
|
|
|
492
492
|
var import_chalk34 = __toESM(require("chalk"));
|
|
493
493
|
|
|
494
494
|
// package.json
|
|
495
|
-
var version = "0.12.
|
|
495
|
+
var version = "0.12.1";
|
|
496
496
|
|
|
497
497
|
// src/index.ts
|
|
498
498
|
init_types();
|
|
@@ -2729,10 +2729,12 @@ async function runTenantUse(query, opts) {
|
|
|
2729
2729
|
}
|
|
2730
2730
|
async function runTenantList(opts) {
|
|
2731
2731
|
const { teamId, teamName } = await resolveTeam(opts.team);
|
|
2732
|
+
const limit = opts.limit ?? (opts.q ? "50" : void 0);
|
|
2733
|
+
const qs = `?detail=1${opts.q ? `&q=${encodeURIComponent(opts.q)}` : ""}${limit ? `&limit=${encodeURIComponent(limit)}` : ""}`;
|
|
2732
2734
|
const out = await admin({
|
|
2733
2735
|
method: "GET",
|
|
2734
|
-
path: `/teams/${encodeURIComponent(teamId)}/tenants
|
|
2735
|
-
summary: `List tenants for team ${teamName ?? teamId}`
|
|
2736
|
+
path: `/teams/${encodeURIComponent(teamId)}/tenants${qs}`,
|
|
2737
|
+
summary: opts.q ? `Search tenants matching "${opts.q}"` : `List tenants for team ${teamName ?? teamId}`
|
|
2736
2738
|
});
|
|
2737
2739
|
const tenants = out?.tenants ?? [];
|
|
2738
2740
|
if (opts.json) {
|
|
@@ -2740,7 +2742,7 @@ async function runTenantList(opts) {
|
|
|
2740
2742
|
return;
|
|
2741
2743
|
}
|
|
2742
2744
|
if (!tenants.length) {
|
|
2743
|
-
console.log(import_chalk23.default.yellow("No tenants."));
|
|
2745
|
+
console.log(import_chalk23.default.yellow(opts.q ? `No tenants matching "${opts.q}".` : "No tenants."));
|
|
2744
2746
|
return;
|
|
2745
2747
|
}
|
|
2746
2748
|
for (const t of tenants) {
|
|
@@ -2748,6 +2750,10 @@ async function runTenantList(opts) {
|
|
|
2748
2750
|
const display = typeof t === "string" ? "" : import_chalk23.default.dim(` ${t.display_name ?? ""}`);
|
|
2749
2751
|
console.log(` ${import_chalk23.default.bold(name)}${display}`);
|
|
2750
2752
|
}
|
|
2753
|
+
const total = out?.total ?? tenants.length;
|
|
2754
|
+
if (total > tenants.length) {
|
|
2755
|
+
console.log(import_chalk23.default.dim(` \u2026 showing ${tenants.length} of ${total} \u2014 narrow with --q <search>`));
|
|
2756
|
+
}
|
|
2751
2757
|
}
|
|
2752
2758
|
async function runTenantCreate(opts) {
|
|
2753
2759
|
if (!opts.name) {
|
|
@@ -5247,10 +5253,10 @@ domain.command("list").description("List custom domains for a proxy").argument("
|
|
|
5247
5253
|
domain.command("status").description("Check a custom domain's validation status").argument("<project>", "Project name or id").requiredOption("--id <domainId>", "Domain id (see `domain list`)").option("--team <id|name>", "Team the project is in").option("--apiversion <version>", "API version").option("--json", "Output machine-readable JSON").action(action((project, opts) => runDomainStatus(project, opts)));
|
|
5248
5254
|
domain.command("rm").description("Remove a custom domain").argument("<project>", "Project name or id").requiredOption("--id <domainId>", "Domain id (see `domain list`)").option("--team <id|name>", "Team the project is in").option("--apiversion <version>", "API version").action(action((project, opts) => runDomainRemove(project, opts)));
|
|
5249
5255
|
domain.command("set-base").description("Choose which version/environment your main URL serves").argument("<project>", "Project name or id").option("--env <env>", "Environment (default: prod)").option("--team <id|name>", "Team the project is in").option("--apiversion <version>", "API version").action(action((project, opts) => runDomainSetBase(project, opts)));
|
|
5250
|
-
var tenant = program.command("tenant").description("Manage tenants \u2014
|
|
5256
|
+
var tenant = program.command("tenant").description("Manage tenants \u2014 bare command opens the interactive picker (settings, app clients, providers)").action(action(() => runTenantManage(void 0, {})));
|
|
5251
5257
|
tenant.command("manage").description("Browse & edit one tenant: settings, login app clients, providers, issuers (search-first picker)").argument("[query]", "Search by tenant name/display name (omit to use your tenant scope or pick)").option("--tenant <slug>", "Exact tenant slug (skips the picker)").option("--team <id|name>", "Team (defaults to active team)").action(action((query, opts) => runTenantManage(query, opts)));
|
|
5252
5258
|
tenant.command("use").description("Set the sticky tenant scope for future commands (search-first; --clear to unset)").argument("[query]", "Search by tenant name/display name").option("--clear", "Clear the tenant scope").option("--team <id|name>", "Team (defaults to active team)").action(action((query, opts) => runTenantUse(query, opts)));
|
|
5253
|
-
tenant.command("list").description("List tenants in your team").option("--team <id|name>", "Team (defaults to active team)").option("--json", "Output machine-readable JSON").action(action((opts) => runTenantList(opts)));
|
|
5259
|
+
tenant.command("list").description("List tenants in your team (--q searches server-side)").option("--q <search>", "Filter by tenant name or display name").option("--limit <n>", "Page size (max 200)").option("--team <id|name>", "Team (defaults to active team)").option("--json", "Output machine-readable JSON").action(action((opts) => runTenantList(opts)));
|
|
5254
5260
|
tenant.command("create").description("Create a tenant in your team").requiredOption("--name <display>", "Display name").option("--slug <tenant_name>", "Explicit tenant slug (generated if omitted)").option("--team <id|name>", "Team (defaults to active team)").option("--json", "Output machine-readable JSON").action(action((opts) => runTenantCreate(opts)));
|
|
5255
5261
|
tenant.command("attach").description("Attach a tenant to a proxy").argument("<project>", "Project name or id").requiredOption("--tenant <slug>", "Tenant slug to attach").option("--auth-config <id>", "Auth config id to bind").option("--team <id|name>", "Team the project is in").option("--apiversion <version>", "API version").option("--json", "Output machine-readable JSON").action(action((project, opts) => runTenantAttach(project, opts)));
|
|
5256
5262
|
tenant.command("delete").description("Delete a tenant (full cascade)").argument("<slug>", "Tenant slug to delete").option("--team <id|name>", "Team (defaults to active team)").option("-y, --yes", "Skip the confirmation prompt").action(action((slug, opts) => runTenantDelete(slug, opts)));
|
|
@@ -5315,8 +5321,13 @@ Examples:
|
|
|
5315
5321
|
`);
|
|
5316
5322
|
function printError(err) {
|
|
5317
5323
|
if (err instanceof ApiError) {
|
|
5324
|
+
const data = err.body;
|
|
5325
|
+
const extra = [data?.body?.reason, data?.body?.details, data?.details, data?.body?.error].find((x) => typeof x === "string" && x && x !== err.message);
|
|
5318
5326
|
console.error(import_chalk34.default.red(`
|
|
5319
|
-
API error (${err.status}): ${err.message}`));
|
|
5327
|
+
API error (${err.status}): ${err.message}${extra ? ` \u2014 ${extra}` : ""}`));
|
|
5328
|
+
if (err.status === 403 || err.status === 404) {
|
|
5329
|
+
console.error(import_chalk34.default.dim("If your team/tenant was recently deleted or recreated, re-run `apiblaze login` or switch with `apiblaze team`."));
|
|
5330
|
+
}
|
|
5320
5331
|
} else if (err instanceof Error) {
|
|
5321
5332
|
console.error(import_chalk34.default.red(`
|
|
5322
5333
|
Error: ${err.message}`));
|
package/package.json
CHANGED