apiblaze 0.21.1 → 0.21.2
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 +13 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1291,7 +1291,7 @@ var import_commander = require("commander");
|
|
|
1291
1291
|
var import_chalk57 = __toESM(require("chalk"));
|
|
1292
1292
|
|
|
1293
1293
|
// package.json
|
|
1294
|
-
var version = "0.21.
|
|
1294
|
+
var version = "0.21.2";
|
|
1295
1295
|
|
|
1296
1296
|
// src/index.ts
|
|
1297
1297
|
init_types();
|
|
@@ -4864,13 +4864,20 @@ function printTryIt(block, highlights) {
|
|
|
4864
4864
|
}
|
|
4865
4865
|
}
|
|
4866
4866
|
var VALID_AUTH = ["api_key", "none", "oauth"];
|
|
4867
|
+
function planSentence(args) {
|
|
4868
|
+
const { name, auth, families, adminEmail } = args;
|
|
4869
|
+
const doors = auth.doors.length === 2 ? `use an API key for your own server and an ${B.product} login (with GitHub) for people and agents` : auth.doors[0] === "api_key" ? "use an API key" : auth.doors[0] === "oauth" ? auth.ownIssuer ? "use your own login" : `use an ${B.product} login (with GitHub)` : "be open to anyone";
|
|
4870
|
+
const locked = families?.length ? `, lock ${describeFamilies(families.map((f) => f.key)).replace(/ \+ /, " and ")} to whoever created them` : ", stay open to every caller who gets in (no rules yet)";
|
|
4871
|
+
const admin2 = adminEmail ? `, and let ${adminEmail} change anything` : "";
|
|
4872
|
+
return `${name} will ${doors}${locked}${admin2}.`;
|
|
4873
|
+
}
|
|
4867
4874
|
var BOTH_DOORS = (() => {
|
|
4868
4875
|
const { auth_type, ...bodyPatch } = bothDoorsBody();
|
|
4869
4876
|
return {
|
|
4870
4877
|
auth: auth_type,
|
|
4871
4878
|
doors: ["api_key", "oauth"],
|
|
4872
4879
|
bodyPatch,
|
|
4873
|
-
summary:
|
|
4880
|
+
summary: `your backend and widget use the API key; people and agents use an ${B.product} login (with GitHub)`,
|
|
4874
4881
|
provider: "GitHub"
|
|
4875
4882
|
};
|
|
4876
4883
|
})();
|
|
@@ -4878,7 +4885,7 @@ var MANAGED_GITHUB = {
|
|
|
4878
4885
|
auth: "oauth",
|
|
4879
4886
|
doors: ["oauth"],
|
|
4880
4887
|
bodyPatch: { login: { providers: [{ type: "github", managed: true }] } },
|
|
4881
|
-
summary:
|
|
4888
|
+
summary: `callers use an ${B.product} login (with GitHub) \u2014 no API key`,
|
|
4882
4889
|
provider: "GitHub"
|
|
4883
4890
|
};
|
|
4884
4891
|
var API_KEY = { auth: "api_key", doors: ["api_key"], bodyPatch: {}, summary: "callers send the API key (X-API-Key) \u2014 no sign-in" };
|
|
@@ -5441,7 +5448,9 @@ Create an ${B.thing}
|
|
|
5441
5448
|
const { families, adminEmail } = await planSetup({ openapi: openapiContent, auth, name, interactive, quiet: !!opts.json });
|
|
5442
5449
|
if (interactive && !opts.yes && !opts.auto) {
|
|
5443
5450
|
const { default: inquirer3 } = await import("inquirer");
|
|
5444
|
-
console.log(
|
|
5451
|
+
console.log();
|
|
5452
|
+
console.log(` ${planSentence({ name, auth, families, adminEmail })}`);
|
|
5453
|
+
console.log();
|
|
5445
5454
|
const { ok } = await inquirer3.prompt([{
|
|
5446
5455
|
type: "confirm",
|
|
5447
5456
|
name: "ok",
|