apiblaze 0.21.3 → 0.21.4
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 +25 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1292,7 +1292,7 @@ var import_commander = require("commander");
|
|
|
1292
1292
|
var import_chalk57 = __toESM(require("chalk"));
|
|
1293
1293
|
|
|
1294
1294
|
// package.json
|
|
1295
|
-
var version = "0.21.
|
|
1295
|
+
var version = "0.21.4";
|
|
1296
1296
|
|
|
1297
1297
|
// src/index.ts
|
|
1298
1298
|
init_types();
|
|
@@ -4865,12 +4865,17 @@ function printTryIt(block, highlights) {
|
|
|
4865
4865
|
}
|
|
4866
4866
|
}
|
|
4867
4867
|
var VALID_AUTH = ["api_key", "none", "oauth"];
|
|
4868
|
-
function
|
|
4868
|
+
function planLines(args) {
|
|
4869
4869
|
const { name, auth, families, adminEmail } = args;
|
|
4870
|
-
const
|
|
4871
|
-
const
|
|
4872
|
-
const
|
|
4873
|
-
|
|
4870
|
+
const cli = `npx ${B.cli}`;
|
|
4871
|
+
const key = `${import_chalk16.default.bold("API key")} \u2014 ${import_chalk16.default.cyan(`${cli} consumer apikeys`)} (list and create keys)`;
|
|
4872
|
+
const signIn = auth.ownIssuer ? `${import_chalk16.default.bold("Your own login")} \u2014 callers bring a JWT from your issuer` : `${import_chalk16.default.bold("OAuth")} \u2014 ${import_chalk16.default.cyan(`${cli} consumer login`)} (${auth.ownApp ? `your own ${auth.provider} app` : `${B.product} login with GitHub`})`;
|
|
4873
|
+
const doors = auth.doors.length === 2 ? [key, signIn] : auth.doors[0] === "api_key" ? [key] : auth.doors[0] === "oauth" ? [signIn] : [`${import_chalk16.default.bold("Open")} \u2014 no credential required`];
|
|
4874
|
+
const what = `You are about to create a proxy and an MCP to your backend${doors.length > 1 ? ", authenticated by both:" : doors[0].startsWith(import_chalk16.default.bold("Open")) ? ":" : ", authenticated by:"}`;
|
|
4875
|
+
const lines = [` ${what}`, ...doors.map((d) => ` ${d}`)];
|
|
4876
|
+
lines.push(` ${import_chalk16.default.bold("Rules:")} ${families?.length ? `${describeFamilies(families.map((f) => f.key)).replace(/ \+ /, " and ")} \u2014 only their creator, or an admin, can change them` : "none yet \u2014 every caller who gets in can reach every route"}`);
|
|
4877
|
+
if (adminEmail) lines.push(` ${import_chalk16.default.bold("Admin:")} ${adminEmail} \u2014 can change anything`);
|
|
4878
|
+
return lines;
|
|
4874
4879
|
}
|
|
4875
4880
|
var BOTH_DOORS = (() => {
|
|
4876
4881
|
const { auth_type, ...bodyPatch } = bothDoorsBody();
|
|
@@ -5242,6 +5247,16 @@ function printAgentPrompts(lines) {
|
|
|
5242
5247
|
console.log(` ${l.ok ? import_chalk16.default.green("\u2713") : import_chalk16.default.red("\u2717")} ${import_chalk16.default.bold(`"${l.say}"`.padEnd(width))} \u2192 ${import_chalk16.default.dim(l.why)}`);
|
|
5243
5248
|
}
|
|
5244
5249
|
}
|
|
5250
|
+
function printEnvironments(o) {
|
|
5251
|
+
const envs = o.environments ?? {};
|
|
5252
|
+
const names = Object.keys(envs);
|
|
5253
|
+
const rows = names.length ? names.map((e) => [`/${e}`, o.dev && e === "dev" ? `localhost:${o.dev.port} (tunnelled from this machine)` : envs[e]?.target ?? "\u2014"]) : o.dev ? [["/dev", `localhost:${o.dev.port} (tunnelled from this machine)`]] : [];
|
|
5254
|
+
if (!rows.length) return;
|
|
5255
|
+
const w = Math.max(...rows.map(([e]) => e.length));
|
|
5256
|
+
for (const [env, target] of rows) {
|
|
5257
|
+
console.log(` ${import_chalk16.default.cyan(env.padEnd(w))} ${import_chalk16.default.green("\u2192")} ${target}`);
|
|
5258
|
+
}
|
|
5259
|
+
}
|
|
5245
5260
|
async function finishSetup(o) {
|
|
5246
5261
|
if (o.dev) return printDevOutcome(o, o.dev.port);
|
|
5247
5262
|
return printOutcome(o);
|
|
@@ -5322,6 +5337,7 @@ async function printOutcome(o) {
|
|
|
5322
5337
|
const locked = (o.families ?? []).filter((f) => applied.includes(f.key));
|
|
5323
5338
|
console.log();
|
|
5324
5339
|
console.log(` ${import_chalk16.default.green("\u2713")} ${import_chalk16.default.bold(shown)} \u2014 ${o.auth.summary}`);
|
|
5340
|
+
printEnvironments(o);
|
|
5325
5341
|
if (applied.length && s?.enforced) {
|
|
5326
5342
|
const skipped = s.skipped?.length ? ` (${s.skipped.length} skipped)` : "";
|
|
5327
5343
|
console.log(` ${import_chalk16.default.green("\u2713")} ${describeFamilies(applied)} locked to their creator${skipped}`);
|
|
@@ -5501,7 +5517,7 @@ Create an ${B.thing}
|
|
|
5501
5517
|
if (interactive && !opts.yes && !opts.auto) {
|
|
5502
5518
|
const { default: inquirer3 } = await import("inquirer");
|
|
5503
5519
|
console.log();
|
|
5504
|
-
|
|
5520
|
+
for (const line of planLines({ name, auth, families, adminEmail })) console.log(line);
|
|
5505
5521
|
console.log();
|
|
5506
5522
|
const { ok } = await inquirer3.prompt([{
|
|
5507
5523
|
type: "confirm",
|
|
@@ -5585,6 +5601,7 @@ Create an ${B.thing}
|
|
|
5585
5601
|
teamId,
|
|
5586
5602
|
auth,
|
|
5587
5603
|
apiKey: adminKey,
|
|
5604
|
+
environments: result.environments,
|
|
5588
5605
|
keys,
|
|
5589
5606
|
secure: result.secure,
|
|
5590
5607
|
families,
|
|
@@ -5814,6 +5831,7 @@ Create an ${B.thing}`));
|
|
|
5814
5831
|
openapi: openapiText,
|
|
5815
5832
|
adminEmail,
|
|
5816
5833
|
samplePath: secure?.applied?.[0] ?? firstPlainPath(openapiText),
|
|
5834
|
+
environments: result.environments,
|
|
5817
5835
|
interactive,
|
|
5818
5836
|
claim: { claimCode: result.claim_code || cred?.claim_code, claimUrl: result.claim_url }
|
|
5819
5837
|
});
|